gcl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Gcl-devel] HEAD Maxima and HEAD trad GCL


From: Mike Thomas
Subject: RE: [Gcl-devel] HEAD Maxima and HEAD trad GCL
Date: Wed, 14 Jan 2004 15:38:41 +1000

Hi Camm.


| > | > Keep in mind when reflecting on this that on Windows, uninitialised
| > | > variables do not get automatically set to 0, they are set
| to whatever is
| > | > sitting in memory when they are instantiated.
| > | >
| > |
| > | Nor in Linux.
| >
| > I have been worried for two years that we might be working at crossed
| > purposes over issues like this one.  Is it an Intel
| architecture thing or
| > simply an OS design decision?
| >
|
| AFAICT, malloc never initializes its memory by definition in the C
| standard.   mmap, which may be Linux specific, fills in with zeroes
| when maps are extended.  One could implement malloc on top of this if
| one wanted.  But no C program can count on malloc initializing memory,
| and in some performance-sensitive cases, one wants to make sure that
| this in fact is not done unnecessarily.

I think I miscommunicated; when I say "uninitialised variables" I mean
"uninitialised local or automatic variables" rather than the contents of
dynamically allocated memory returned by malloc().


|
| OK!  Now the procedure is to set breakpoints at the addresses
| corresponding to the 'calls' reported in your pcL_dfun dump file.
| I.e. the first one is reported at offset 1bb, which at your load
| address is 0x1030c1bb, so you can break right before and right after,
| with b *0x1030c1bb and b *0x1030c1c0.  You want to find the call which
| does not return to the following instruction.


As it happens, it doesn't get anywhere near to the call instructions as the
program crashes in the instruction at offset 0x13d where the instruction:

mov    0x0,%ecx

tries to execute.  I presume %ecx means "the address held in the ecx
register"?  The content of ecx is 0x63c.

Below find a segment of the object dump, the gdb session and register and
stack dumps:


00000130 <_L2>:
     130:       55                      push   %ebp
     131:       57                      push   %edi
     132:       56                      push   %esi
     133:       53                      push   %ebx
     134:       83 ec 1c                sub    $0x1c,%esp
     137:       8b 35 00 00 00 00       mov    0x0,%esi
     13d:       8b 0d 00 00 00 00       mov    0x0,%ecx
....

Breakpoint 8, call_or_link (sym=0x1019a630, link=0x1032857c) at funlink.c:71
71                  ( *(void (*)()) (fun->cf.cf_self)) ();
(gdb) stepi
0x004314e7      71                  ( *(void (*)()) (fun->cf.cf_self)) ();
(gdb) stepi
0x004314ea      71                  ( *(void (*)()) (fun->cf.cf_self)) ();
(gdb) stepi
0x10317130 in ?? ()
(gdb) stepi
0x10317131 in ?? ()
(gdb) disassemble
No function contains program counter for selected frame.

(gdb) stepi
0x10317132 in ?? ()
(gdb) stepi
0x10317133 in ?? ()
(gdb) stepi
0x10317134 in ?? ()
(gdb) stepi
0x10317137 in ?? ()
(gdb) stepi
0x1031713d in ?? ()
(gdb) stepi

Program received signal SIGSEGV, Segmentation fault.
0x1031713d in ?? ()
(gdb) frame
#0  0x1031713d in ?? ()
(gdb) info frame
Stack level 0, frame at 0x22be54:
 eip = 0x1031713d; saved eip 0x640
 called by frame at 0x22be58
 Arglist at 0x22be4c, args:
 Locals at 0x22be4c, Previous frame's sp is 0x22be54
 Saved registers:
  eip at 0x22be50

(gdb) info all-registers
eax            0x10317130       271675696
ecx            0x63c    1596
edx            0x1032857c       271746428
ebx            0x5b0f18 5967640
esp            0x22be50 0x22be50
ebp            0x22be88 0x22be88
esi            0x5b0f10 5967632
edi            0x5b0f10 5967632
eip            0x1031713d       0x1031713d
eflags         0x10306  66310
cs             0x1b     27
ss             0x23     35
ds             0x23     35
es             0x23     35
fs             0x38     56
gs             0x0      0
st0            <invalid float value>    (raw 0x00010000038c00000017)
st1            <invalid float value>    (raw 0x204877c33eb00022ffe0)
st2            <invalid float value>    (raw 0x005477c2ac2a77c2ac19)
st3            <invalid float value>    (raw 0x22bd0000000000000054)
st4            <invalid float value>    (raw 0x00540000005400000054)
st5            0        (raw 0x00000000000000000000)
st6            2        (raw 0x40008000000000000000)
---Type <return> to continue, or q <return> to quit---
st7            716.79998779296875       (raw 0x4008b333330000000000)
fctrl          0xffff037f       -64641
fstat          0xffff0120       -65248
ftag           0xffffffff       -1
fiseg          0x1b     27
fioff          0x43a7f1 4433905
foseg          0xffff0023       -65501
fooff          0x102a0bf4       271191028
fop            0x1c9    457
mm0            {uint64 = 0x38c00000017, v2_int32 = {0x17, 0x38c}, v4_int16 =
{
    0x17, 0x0, 0x38c, 0x0}, v8_int8 = {0x17, 0x0, 0x0, 0x0, 0x8c, 0x3, 0x0,
    0x0}}
mm1            {uint64 = 0x77c33eb00022ffe0, v2_int32 = {0x22ffe0,
    0x77c33eb0}, v4_int16 = {0xffe0, 0x22, 0x3eb0, 0x77c3}, v8_int8 = {0xe0,
    0xff, 0x22, 0x0, 0xb0, 0x3e, 0xc3, 0x77}}
mm2            {uint64 = 0x77c2ac2a77c2ac19, v2_int32 = {0x77c2ac19,
    0x77c2ac2a}, v4_int16 = {0xac19, 0x77c2, 0xac2a, 0x77c2}, v8_int8 =
{0x19,
    0xac, 0xc2, 0x77, 0x2a, 0xac, 0xc2, 0x77}}
mm3            {uint64 = 0x54, v2_int32 = {0x54, 0x0}, v4_int16 = {0x54,
0x0,
    0x0, 0x0}, v8_int8 = {0x54, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}
mm4            {uint64 = 0x5400000054, v2_int32 = {0x54, 0x54}, v4_int16 = {
    0x54, 0x0, 0x54, 0x0}, v8_int8 = {0x54, 0x0, 0x0, 0x0, 0x54, 0x0, 0x0,
    0x0}}
---Type <return> to continue, or q <return> to quit---
mm5            {uint64 = 0x0, v2_int32 = {0x0, 0x0}, v4_int16 = {0x0, 0x0,
    0x0, 0x0}, v8_int8 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}
mm6            {uint64 = 0x8000000000000000, v2_int32 = {0x0, 0x80000000},
  v4_int16 = {0x0, 0x0, 0x0, 0x8000}, v8_int8 = {0x0, 0x0, 0x0, 0x0, 0x0,
0x0,
    0x0, 0x80}}
mm7            {uint64 = 0xb333330000000000, v2_int32 = {0x0, 0xb3333300},
  v4_int16 = {0x0, 0x0, 0x3300, 0xb333}, v8_int8 = {0x0, 0x0, 0x0, 0x0, 0x0,
    0x33, 0x33, 0xb3}}



(gdb) info stack
#0  0x1031713d in ?? ()
#1  0x00000640 in ?? ()
#2  0x00000640 in ?? ()
#3  0xffffffff in ?? ()
#4  0x102e0104 in ?? ()
#5  0x005b0f14 in value_stack ()
#6  0x101c03a8 in ?? ()
#7  0x0022be88 in ?? ()
#8  0x005b0f18 in value_stack ()
#9  0x005b0ef8 in value_stack ()
#10 0x005b0f10 in value_stack ()
#11 0x0022be88 in ?? ()
#12 0x004314ec in call_or_link (sym=0x1019a630, link=0x1032857c)
    at funlink.c:71
#13 0x10327b77 in ?? ()
#14 0x1019a630 in ?? ()
#15 0x1032857c in ?? ()
#16 0x10356d74 in ?? ()
#17 0x103194b7 in ?? ()
#18 0x10301f78 in ?? ()
#19 0x005a5860 in small_fixnum_table ()
#20 0x10341fdc in ?? ()
#21 0x103194eb in ?? ()

---Type <return> to continue, or q <return> to quit---q
Quit (expect signal SIGINT when the program is resumed)
(gdb) up 12
#12 0x004314ec in call_or_link (sym=0x1019a630, link=0x1032857c)
    at funlink.c:71
71                  ( *(void (*)()) (fun->cf.cf_self)) ();
(gdb) info frame
Stack level 12, frame at 0x22be90:
 eip = 0x4314ec in call_or_link (funlink.c:71); saved eip 0x10327b77
 called by frame at 0x22be94, caller of frame at 0x22be80
 source language c.
 Arglist at 0x22be88, args: sym=0x1019a630, link=0x1032857c
 Locals at 0x22be88, Previous frame's sp is 0x22be90
 Saved registers:
  ebp at 0x22be88, eip at 0x22be8c
(gdb)


Cheers

Mike Thomas.



|
| You can also look at the C source, and break at the functions called
| by their name as a cross check.  I.e. if arguments are passed, the
| first would be b make_cons, and then b eql.
|
| My guess now is that one of the function addresses used in this
| function in calling another has not been properly relocated.  Once we
| identify the function call that does not return, we can then inspect
| and report the register and stack content right before the call.
|
| Apart from this main line of inquiry, I'd also like you to try a build
| with --enable-dlopen, if mingw has such.  If the above gets tedious, I
| can show you how to build an image with the pcl objects linked via ld,
| so that debugging in gdb will refer you directly to the compiled C
| source.
|
| Take care,
|
| > Cheers
| >
| > Mike Thomas.
| >
|
| --
| Camm Maguire                                          address@hidden
| ==========================================================================
| "The earth is but one country, and mankind its citizens."  --  Baha'u'llah
|
|
| _______________________________________________
| Gcl-devel mailing list
| address@hidden
| http://mail.gnu.org/mailman/listinfo/gcl-devel
|
|






reply via email to

[Prev in Thread] Current Thread [Next in Thread]