gcl-devel
[Top][All Lists]
Advanced

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

Re: [Gcl-devel] vs_top and vs_base and further debugging notes


From: Camm Maguire
Subject: Re: [Gcl-devel] vs_top and vs_base and further debugging notes
Date: 25 Mar 2004 13:51:33 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Greetings!

"Mike Thomas" <address@hidden> writes:

> Hi Camm.
> 
> I've narrowed the point of corruption to between the 155th and 156th call to
> "mark_c_stack" and between the 1700th and 1720th subsequent execution of
> "Iinvoke_c_function_from_value_stack"!
> 

Great!  The stack definitely appears mangled by the end, though again
I repeat the caution that gdb may not be able to always report the
stack correctly when compiled object files are involved.  If push
comes to shove we can try to run interpreted, but I don't suspect the
compiler at this point.

> See end for details.
> 
> Here is a question about the value stack:
> 
> My understanding is that the values of vs_top and vs_limit should migrate
> through the course of execution of the program between the values of vs_org
> and vs_limit.  Is this correct?
> 

Correct.

> For example, if I break at main and single step past RECREATE_HEAP I get
> this:
> 
> =======================================================
> (gdb) b mark_c_stack
> Breakpoint 1 at 0x438df1: file gbc.c, line 865.
> (gdb) b main
> Breakpoint 2 at 0x40279f: file main.c, line 120.
> (gdb) r
> Starting program: c:\cvs\head\gcl\ansi-tests/../unixport/saved_ansi_gcl.exe
> 
> Breakpoint 2, main (argc=1, argv=0xca41f0, envp=0xca2ef0) at main.c:120
> 120         RECREATE_HEAP
> (gdb) p vs_top
> $1 = (object *) 0x0
> (gdb) p vs_base
> $2 = (object *) 0x0
> (gdb) n
>         0x0064E120 BSS start in memory.
>         0x00b80000 BSS offset in saved executable.
>         0x00116570 BSS size in bytes.
>         0x00116570 bytes read.
>         0x10100000 Heap start in memory.
>         0x00790000 Heap offset in executable.
>         0x003f0000 Heap size in bytes.
>         0x10100000 file base.
> 132         setbuf(stdin, stdin_buf);
> (gdb) p vs_top
> $3 = (object *) 0x6c147c
> (gdb) p vs_base
> $4 = (object *) 0x6c1478
> (gdb) p vs_top-vs_base
> $5 = 1
> 
> =======================================================
> 
> And by the time I get a mangled stack (narrowed down now to somewhere
> between the mark_c_stack crossings 155 and 156) I get the following values:
> 
> (gdb) p ihs_org
> $19 = 0x6b86c0
> (gdb) p ihs_top
> $20 = 0x6b87a8
> (gdb) p ihs_limit
> $21 = 0x6c06c0
> (gdb) p frs_org
> $22 = 0x6572c0
> (gdb) p frs_limit
> $23 = 0x6ab2c0
> (gdb) p frs_top
> $24 = 0x6577ac
> (gdb) p vs_org
> $25 = (object *) 0x6c1420
> (gdb) p vs_top
> $26 = (object *) 0x6c1a5c
> (gdb) p vs_limit
> $27 = (object *) 0x741420
> (gdb) p vs_base
> $28 = (object *) 0x6c1a58
> (gdb) info registers
> eax            0x0      0
> ecx            0x10103fa4       269500324
> edx            0x0      0
> ebx            0x10258e10       270896656
> esp            0x2293c0 0x2293c0
> ebp            0x229428 0x229428
> esi            0x6b5f90 7036816
> edi            0x6c1a48 7084616
> eip            0x438df1 0x438df1
> eflags         0x206    518
> cs             0x1b     27
> ss             0x23     35
> ds             0x23     35
> es             0x23     35
> fs             0x38     56
> gs             0x0      0
> (gdb)
> =======================================================

This all looks fine from what I can tell.  You asked earlier how to
tell if object pointers are valid.  Except in very exceptional cases
(e.g. &Cnil_body, &Ct_body), object pointers lie in the heap, which in
your case start at 0x101......  Your static area is at 0x6...., which
will include your lisp value stack, vs_top, vs_base, etc.  In general,
vs_base[i] should contain object pointers (in the heap), not pointers
to object pointers (in the static area). I was initially worried that
something akin to vs_base[0]=vs_base was occurring, though from your
latest round I think everything looks like a missed setjmp/longjmp,
though of course I can easily be mistaken.

Take care,



> 
> Late again!
> 
> Mike Thomas.
> 
> 
> 
> [GC for 108 STRING pages..
> Breakpoint 1, mark_c_stack (env1=0x22b960, n=0,
>     fn=0x438960 <mark_stack_carefully>) at gbc.c:865
> 865       if (n== N_RECURSION_REQD)
> (gdb) bt
> #0  mark_c_stack (env1=0x22b960, n=0, fn=0x438960 <mark_stack_carefully>)
>     at gbc.c:865
> #1  0x00438e28 in mark_c_stack (env1=0x22b9e0, n=1,
>     fn=0x438960 <mark_stack_carefully>) at gbc.c:873
> #2  0x00438e28 in mark_c_stack (env1=0x0, n=2,
>     fn=0x438960 <mark_stack_carefully>) at gbc.c:873
> #3  0x00438de3 in mark_phase () at gbc.c:793
> #4  0x0043959b in GBC (t=t_string) at gbc.c:1209
> #5  0x00404869 in alloc_object (t=t_string) at alloc.c:286
> #6  0x004718c0 in alloc_simple_string (l=5) at string.d:42
> #7  0x00471c81 in coerce_to_string (x=0x10d702d0) at string.d:170
> #8  0x00473613 in Lstring () at string.d:565
> #9  0x0041f487 in eval (form=0x651a90) at eval.c:1090
> #10 0x0041f40a in eval (form=0x10bd0e40) at eval.c:1077
> #11 0x0041f40a in eval (form=0x10bd0e28) at eval.c:1077
> #12 0x0041dc47 in funcall (fun=0x106f6b60) at eval.c:327
> #13 0x0041df01 in funcall_no_event (fun=0x10bd0e10) at eval.c:381
> #14 0x0041f494 in eval (form=0x651a90) at eval.c:1092
> #15 0x004134c8 in letA_bind (body=0x10bb9948, start=0x6c1690, end=0x6c1820)
>     at bind.c:699
> #16 0x0043e67f in FletA (form=0x10bcb0f0) at let.c:106
> #17 0x0041f217 in eval (form=0x10bcd498) at eval.c:1037
> #18 0x0041dc47 in funcall (fun=0x10788140) at eval.c:327
> ---Type <return> to continue, or q <return> to quit---
> #19 0x0041df01 in funcall_no_event (fun=0x10bb9930) at eval.c:381
> #20 0x0041f494 in eval (form=0x651a90) at eval.c:1092
> #21 0x0041dc47 in funcall (fun=0x107882e0) at eval.c:327
> #22 0x0044abbc in IapplyVector (fun=0x10bcd558, nargs=2, base=0x6c1650)
>     at nfunlink.c:239
> #23 0x0041f703 in fLfuncall (fun=0x10bcd558) at eval.c:1140
> #24 0x00431e0e in c_apply_n (fn=0x41f678 <fLfuncall>, n=3, x=0x6c1644)
>     at funlink.c:365
> #25 0x0044aa7b in IapplyVector (fun=0x10107e4c, nargs=3, base=0x6c1644)
>     at nfunlink.c:229
> #26 0x0041d5b7 in funcall (fun=0x10107e4c) at eval.c:190
> #27 0x0044abbc in IapplyVector (fun=0x10109b1c, nargs=3, base=0x6c1638)
>     at nfunlink.c:239
> #28 0x0047c3d5 in Ifuncall_n (fun=0x10109b1c, n=3) at utils.c:89
> #29 0x0044648c in Imacro_expand1 (exp_fun=0x10bcd558, form=0x10e96e64)
>     at macros.c:139
> #30 0x0041f2cd in eval (form=0x10e96e64) at eval.c:1060
> #31 0x00429123 in Lload () at file.d:1908
> #32 0x00498270 in L13 () at clcs_install.c:569
> #33 0x0041f487 in eval (form=0x651a90) at eval.c:1090
> #34 0x00429123 in Lload () at file.d:1908
> #35 0x00498270 in L13 () at clcs_install.c:569
> #36 0x0041f487 in eval (form=0x651a90) at eval.c:1090
> ---Type <return> to continue, or q <return> to quit---
> #37 0x00429123 in Lload () at file.d:1908
> #38 0x00498270 in L13 () at clcs_install.c:569
> #39 0x0041f487 in eval (form=0x651a90) at eval.c:1090
> #40 0x00429123 in Lload () at file.d:1908
> #41 0x00498270 in L13 () at clcs_install.c:569
> #42 0x0041f487 in eval (form=0x651a90) at eval.c:1090
> #43 0x0041f981 in fLeval (x0=0x103e9f18) at eval.c:1178
> #44 0x00431dc6 in c_apply_n (fn=0x41f925 <fLeval>, n=1, x=0x6c1488)
>     at funlink.c:363
> #45 0x0044aa7b in IapplyVector (fun=0x10107e24, nargs=1, base=0x6c1488)
>     at nfunlink.c:229
> #46 0x0041d5b7 in funcall (fun=0x10107e24) at eval.c:190
> #47 0x0041e57f in symlispcall (sym=0x10109ad4, base=0x6c1484, narg=1)
>     at eval.c:507
> #48 0x0060ef1a in LI1 () at gcl_top.c:140
> #49 0x0041ca1c in quick_call_sfun (fun=0x10131fdc) at eval.c:117
> #50 0x0041d533 in funcall (fun=0x10131fdc) at eval.c:178
> #51 0x0044abbc in IapplyVector (fun=0x10131fdc, nargs=0, base=0x6c145c)
>     at nfunlink.c:239
> #52 0x0041f703 in fLfuncall (fun=0x10131fdc) at eval.c:1140
> #53 0x00431dc6 in c_apply_n (fn=0x41f678 <fLfuncall>, n=1, x=0x6c1458)
>     at funlink.c:363
> #54 0x0044aa7b in IapplyVector (fun=0x10107e4c, nargs=1, base=0x6c1458)
> ---Type <return> to continue, or q <return> to quit---
>     at nfunlink.c:229
> #55 0x0041d5b7 in funcall (fun=0x10107e4c) at eval.c:190
> #56 0x0041df01 in funcall_no_event (fun=0x10107e4c) at eval.c:381
> #57 0x0041f494 in eval (form=0x651a90) at eval.c:1092
> #58 0x0041dc47 in funcall (fun=0x1035afe8) at eval.c:327
> #59 0x0041df01 in funcall_no_event (fun=0x103e9954) at eval.c:381
> #60 0x0041f494 in eval (form=0x651a90) at eval.c:1092
> #61 0x0041dc47 in funcall (fun=0x1035aff0) at eval.c:327
> #62 0x0041ec95 in super_funcall (fun=0x103e9fb4) at eval.c:743
> #63 0x00402c67 in main (argc=1, argv=0xca41f0, envp=0xca2ef0) at main.c:296
> (gdb)
> (gdb) b Iinvoke_c_function_from_value_stack
> Breakpoint 2 at 0x44ac4a: file nfunlink.c, line 265.
> (gdb) c
> Continuing.
> (T=1466).GC finished]
> 
> Breakpoint 2, Iinvoke_c_function_from_value_stack (f=0x4086a3
> <fSmake_vector>,
>     fargd=4167) at nfunlink.c:265
> 265       int atypes = F_TYPES(fargd)>> F_TYPE_WIDTH;
> (gdb) ignore 2 1700
> Will ignore next 1700 crossings of breakpoint 2.
> (gdb) c
> Continuing.
> 
> Breakpoint 2, Iinvoke_c_function_from_value_stack (f=0x4086a3
> <fSmake_vector>,
>     fargd=4167) at nfunlink.c:265
> 265       int atypes = F_TYPES(fargd)>> F_TYPE_WIDTH;
> (gdb) bt
> #0  Iinvoke_c_function_from_value_stack (f=0x4086a3 <fSmake_vector>,
>     fargd=4167) at nfunlink.c:265
> #1  0x0040869e in siLmake_vector () at array.c:494
> #2  0x005febe0 in LI3 (V20=0x6b5fa0, first=0x1010a240) at gcl_arraylib.c:196
> #3  0x005f898f in LI10 (V180=0x6b5fa0, V181=0x10daff9c, V182=0x10b7fd44)
>     at gcl_defstruct.c:1127
> #4  0x005f9995 in LI13 (V259=0x10dafe34, V258=0x10dafd14, V257=0x651a90,
>     V256=0x651a90, V255=0x651a90, V254=0x10b7fd44, V253=0x10dafda4,
>     V252=0x651a90, V251=0x10daff9c, V250=0x651a90, V249=0x10b7fd2c,
>     V248=0x6b5fa0, V247=0x10dafd80, first=0x651a90) at gcl_defstruct.c:1661
> #5  0x004321cd in c_apply_n (fn=0x5f93d6 <LI13>, n=14, x=0x6c1640)
>     at funlink.c:381
> #6  0x0041d3e5 in call_vfun (fun=0x10131884) at eval.c:150
> #7  0x0041def1 in funcall_no_event (fun=0x10131884) at eval.c:378
> #8  0x0041f494 in eval (form=0x651a90) at eval.c:1092
> #9  0x0046175a in Fprogn (body=0x10b7e894) at prog.c:248
> #10 0x0041f217 in eval (form=0x10b7e8a0) at eval.c:1037
> #11 0x00429123 in Lload () at file.d:1908
> #12 0x00498270 in L13 () at clcs_install.c:569
> #13 0x0041f487 in eval (form=0x651a90) at eval.c:1090
> #14 0x00429123 in Lload () at file.d:1908
> #15 0x00498270 in L13 () at clcs_install.c:569
> #16 0x0041f487 in eval (form=0x651a90) at eval.c:1090
> ---Type <return> to continue, or q <return> to quit---
> #17 0x00429123 in Lload () at file.d:1908
> #18 0x00498270 in L13 () at clcs_install.c:569
> #19 0x0041f487 in eval (form=0x651a90) at eval.c:1090
> #20 0x00429123 in Lload () at file.d:1908
> #21 0x00498270 in L13 () at clcs_install.c:569
> #22 0x0041f487 in eval (form=0x651a90) at eval.c:1090
> #23 0x0041f981 in fLeval (x0=0x103e9f18) at eval.c:1178
> #24 0x00431dc6 in c_apply_n (fn=0x41f925 <fLeval>, n=1, x=0x6c1488)
>     at funlink.c:363
> #25 0x0044aa7b in IapplyVector (fun=0x10107e24, nargs=1, base=0x6c1488)
>     at nfunlink.c:229
> #26 0x0041d5b7 in funcall (fun=0x10107e24) at eval.c:190
> #27 0x0041e57f in symlispcall (sym=0x10109ad4, base=0x6c1484, narg=1)
>     at eval.c:507
> #28 0x0060ef1a in LI1 () at gcl_top.c:140
> #29 0x0041ca1c in quick_call_sfun (fun=0x10131fdc) at eval.c:117
> #30 0x0041d533 in funcall (fun=0x10131fdc) at eval.c:178
> #31 0x0044abbc in IapplyVector (fun=0x10131fdc, nargs=0, base=0x6c145c)
>     at nfunlink.c:239
> #32 0x0041f703 in fLfuncall (fun=0x10131fdc) at eval.c:1140
> #33 0x00431dc6 in c_apply_n (fn=0x41f678 <fLfuncall>, n=1, x=0x6c1458)
>     at funlink.c:363
> #34 0x0044aa7b in IapplyVector (fun=0x10107e4c, nargs=1, base=0x6c1458)
> ---Type <return> to continue, or q <return> to quit---
>     at nfunlink.c:229
> #35 0x0041d5b7 in funcall (fun=0x10107e4c) at eval.c:190
> #36 0x0041df01 in funcall_no_event (fun=0x10107e4c) at eval.c:381
> #37 0x0041f494 in eval (form=0x651a90) at eval.c:1092
> #38 0x0041dc47 in funcall (fun=0x1035afe8) at eval.c:327
> #39 0x0041df01 in funcall_no_event (fun=0x103e9954) at eval.c:381
> #40 0x0041f494 in eval (form=0x651a90) at eval.c:1092
> #41 0x0041dc47 in funcall (fun=0x1035aff0) at eval.c:327
> #42 0x0041ec95 in super_funcall (fun=0x103e9fb4) at eval.c:743
> #43 0x00402c67 in main (argc=1, argv=0xca41f0, envp=0xca2ef0) at main.c:296
> (gdb)
> (gdb)
> (gdb) c
> Continuing.
> 
> Breakpoint 2, Iinvoke_c_function_from_value_stack (f=0x40d95b <fSfset>,
>     fargd=1026) at nfunlink.c:265
> 265       int atypes = F_TYPES(fargd)>> F_TYPE_WIDTH;
> (gdb) bt
> #0  Iinvoke_c_function_from_value_stack (f=0x40d95b <fSfset>, fargd=1026)
>     at nfunlink.c:265
> #1  0x0040d956 in siLfset () at assignment.c:143
> #2  0x005f9b9d in LI13 (V259=0x10dafe34, V258=0x10dafd14, V257=0x651a90,
>     V256=0x651a90, V255=0x651a90, V254=0x10b7fd44, V253=0x10dafda4,
>     V252=0x651a90, V251=0x10daff9c, V250=0x651a90, V249=0x10b7fd2c,
>     V248=0x6b5fa0, V247=0x10dafd80, first=0x651a90) at gcl_defstruct.c:1713
> #3  0x004321cd in c_apply_n (fn=0x5f93d6 <LI13>, n=14, x=0x6c1640)
>     at funlink.c:381
> #4  0x0041d3e5 in call_vfun (fun=0x10131884) at eval.c:150
> #5  0x0041def1 in funcall_no_event (fun=0x10131884) at eval.c:378
> #6  0x0041f494 in eval (form=0x651a90) at eval.c:1092
> #7  0x0046175a in Fprogn (body=0x10b7e894) at prog.c:248
> #8  0x0041f217 in eval (form=0x10b7e8a0) at eval.c:1037
> #9  0x00429123 in Lload () at file.d:1908
> #10 0x00498270 in L13 () at clcs_install.c:569
> #11 0x0041f487 in eval (form=0x651a90) at eval.c:1090
> #12 0x00429123 in Lload () at file.d:1908
> #13 0x00498270 in L13 () at clcs_install.c:569
> #14 0x0041f487 in eval (form=0x651a90) at eval.c:1090
> #15 0x00429123 in Lload () at file.d:1908
> #16 0x00498270 in L13 () at clcs_install.c:569
> #17 0x0041f487 in eval (form=0x651a90) at eval.c:1090
> ---Type <return> to continue, or q <return> to quit---
> #18 0x00429123 in Lload () at file.d:1908
> #19 0x00498270 in L13 () at clcs_install.c:569
> #20 0x0041f487 in eval (form=0x651a90) at eval.c:1090
> #21 0x0041f981 in fLeval (x0=0x103e9f18) at eval.c:1178
> #22 0x00431dc6 in c_apply_n (fn=0x41f925 <fLeval>, n=1, x=0x6c1488)
>     at funlink.c:363
> #23 0x0044aa7b in IapplyVector (fun=0x10107e24, nargs=1, base=0x6c1488)
>     at nfunlink.c:229
> #24 0x0041d5b7 in funcall (fun=0x10107e24) at eval.c:190
> #25 0x0041e57f in symlispcall (sym=0x10109ad4, base=0x6c1484, narg=1)
>     at eval.c:507
> #26 0x0060ef1a in LI1 () at gcl_top.c:140
> #27 0x0041ca1c in quick_call_sfun (fun=0x10131fdc) at eval.c:117
> #28 0x0041d533 in funcall (fun=0x10131fdc) at eval.c:178
> #29 0x0044abbc in IapplyVector (fun=0x10131fdc, nargs=0, base=0x6c145c)
>     at nfunlink.c:239
> #30 0x0041f703 in fLfuncall (fun=0x10131fdc) at eval.c:1140
> #31 0x00431dc6 in c_apply_n (fn=0x41f678 <fLfuncall>, n=1, x=0x6c1458)
>     at funlink.c:363
> #32 0x0044aa7b in IapplyVector (fun=0x10107e4c, nargs=1, base=0x6c1458)
>     at nfunlink.c:229
> #33 0x0041d5b7 in funcall (fun=0x10107e4c) at eval.c:190
> #34 0x0041df01 in funcall_no_event (fun=0x10107e4c) at eval.c:381
> ---Type <return> to continue, or q <return> to quit---
> #35 0x0041f494 in eval (form=0x651a90) at eval.c:1092
> #36 0x0041dc47 in funcall (fun=0x1035afe8) at eval.c:327
> #37 0x0041df01 in funcall_no_event (fun=0x103e9954) at eval.c:381
> #38 0x0041f494 in eval (form=0x651a90) at eval.c:1092
> #39 0x0041dc47 in funcall (fun=0x1035aff0) at eval.c:327
> #40 0x0041ec95 in super_funcall (fun=0x103e9fb4) at eval.c:743
> #41 0x00402c67 in main (argc=1, argv=0xca41f0, envp=0xca2ef0) at main.c:296
> (gdb)
> (gdb) c
> Continuing.
> 
> Breakpoint 2, Iinvoke_c_function_from_value_stack (f=0x430e61 <fLformat>,
>     fargd=32322) at nfunlink.c:265
> 265       int atypes = F_TYPES(fargd)>> F_TYPE_WIDTH;
> (gdb) bt
> #0  Iinvoke_c_function_from_value_stack (f=0x430e61 <fLformat>, fargd=32322)
>     at nfunlink.c:265
> #1  0x00430e5c in Lformat () at format.c:2194
> #2  0x0055bf71 in LI3 (V4=0x55c719, V5=0x10a5b5f4, V6=0x101665e8)
>     at /cvs/head/gcl/pcl/pcl_defclass.c:16
> #3  0x10a59030 in ?? ()
> #4  0x00651af0 in sKinvalid_form ()
> #5  0x10a59108 in ?? ()
> #6  0x00651a90 in sKoverwrite ()
> #7  0x006c166c in value_stack ()
> #8  0x10a59cc0 in ?? ()
> #9  0x0055c719 in LI8 (V18=0x55c1c8, V19=0x10d9e7bc, V20=0x651a90,
>     V21=0x10a60a44) at /cvs/head/gcl/pcl/pcl_defclass.c:306
> #10 0x006c167c in value_stack ()
> #11 0x00651a90 in sKoverwrite ()
> #12 0x00651a90 in sKoverwrite ()
> #13 0x10109dc8 in ?? ()
> #14 0x006c1690 in value_stack ()
> #15 0x10a5b5f4 in ?? ()
> #16 0x101665e8 in ?? ()
> #17 0x00651a90 in sKoverwrite ()
> #18 0x10a5b5dc in ?? ()
> #19 0x10a5a030 in ?? ()
> ---Type <return> to continue, or q <return> to quit---
> #20 0x10a59cf0 in ?? ()
> #21 0x00651a90 in sKoverwrite ()
> #22 0x006c1650 in value_stack ()
> #23 0x006c166c in value_stack ()
> #24 0x0022bed8 in ?? ()
> #25 0x0055c1c8 in L7 () at /cvs/head/gcl/pcl/pcl_defclass.c:80
> #26 0x00651a90 in sKoverwrite ()
> #27 0x10a60a44 in ?? ()
> #28 0x00651a90 in sKoverwrite ()
> (gdb) info breakpoints
> Num Type           Disp Enb Address    What
> 1   breakpoint     keep y   0x00438df1 in mark_c_stack at gbc.c:865
>         breakpoint already hit 156 times
> 2   breakpoint     keep y   0x0044ac4a in
> Iinvoke_c_function_from_value_stack
>                                        at nfunlink.c:265
>         breakpoint already hit 1704 times
> (gdb)
> 
> 
> 
> 
> _______________________________________________
> Gcl-devel mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/gcl-devel
> 
> 
> 

-- 
Camm Maguire                                            address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah




reply via email to

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