hardcore gdc problems
Downs
default_357-line at yahoo.de
Tue Apr 10 18:13:17 PDT 2007
Update!
It might be related to something that I think is a GC bug.
Consider, please, the following GDB session.
To sum it up, I have a character array in a struct in a dynamic array in another struct in a class instance, pointed to by the main program.
And apparently the char array gets collected, since the hardware watchpoints show how the memory area it points to is being overwritten by a new object.
When I std.gc.disable, the problem goes away.
D:\code\d\yawr>gdb bin\dbg\yawr.exe
GNU gdb 5.2.1
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i686-pc-mingw32"...
(gdb) b main.d:353
Breakpoint 1 at 0x406dca: file main.d, line 353.
(gdb) r
Starting program: D:\code\d\yawr/bin\dbg\yawr.exe
[Switching to thread 3708.0x16a0]
Breakpoint 1, _D4main9earthsong6updateMFDFZvDFZvZv (this=@0x1304780, redraw=
{object = 0x1df6380, func = 0x40c712 <_D4main14user_interface7refreshMFZv>
}, got=
{object = 0x1ebcdc0, func = 0x53a570 <_D3std4bind117__T9BoundFuncTDFC4main
5comicZvS41_D3std4bind9NullAliasS3std4bind9EmptySlotTS3std4bind23__T5TupleTC4mai
n5comicZ5TupleZ9BoundFunc16__T10MBoundFuncZ4funcMFZv>}) at main.d:353
353 sgms[part]++; flush; got(); redraw();
(gdb) c
Continuing.
Breakpoint 1, _D4main9earthsong6updateMFDFZvDFZvZv (this=@0x1304780, redraw=
{object = 0x1df6380, func = 0x40c712 <_D4main14user_interface7refreshMFZv>
}, got=
{object = 0x1ebcdc0, func = 0x53a570 <_D3std4bind117__T9BoundFuncTDFC4main
5comicZvS41_D3std4bind9NullAliasS3std4bind9EmptySlotTS3std4bind23__T5TupleTC4mai
n5comicZ5TupleZ9BoundFunc16__T10MBoundFuncZ4funcMFZv>}) at main.d:353
353 sgms[part]++; flush; got(); redraw();
(gdb) p this.data.pages
$1 = {length = 2, ptr = 0x2fbb200}
(gdb) p *(this.data.pages.ptr)
$2 = {url = {length = 45,
ptr = 0x2d38140 "www.earthsongsaga.com/images/Redux/cover1.jpg"}, title = {
length = 16,
ptr = 0x2d6eb31 "December 1, 2005 </strong></p>\r\n <p>I'd like to th
ank all of you who took the time to write me emails of congratulations re: my en
gagement - it was very touching *has much love for all her read"...},
chapter = {length = 0, ptr = 0x0}, read = false, reserve = {length = 0,
ptr = 0x0}}
(gdb) i thr
5 thread 3708.0x15bc 0x7c90eb94 in _libws2_32_a_iname ()
4 thread 3708.0xcf0 0x7c90eb94 in _libws2_32_a_iname ()
3 thread 3708.0x148c 0x7c90eb94 in _libws2_32_a_iname ()
* 2 thread 3708.0x16a0 _D4main9earthsong6updateMFDFZvDFZvZv (this=@0x1304780,
redraw=
{object = 0x1df6380, func = 0x40c712 <_D4main14user_interface7refreshMFZv>
}, got=
{object = 0x1ebcdc0, func = 0x53a570 <_D3std4bind117__T9BoundFuncTDFC4main
5comicZvS41_D3std4bind9NullAliasS3std4bind9EmptySlotTS3std4bind23__T5TupleTC4mai
n5comicZ5TupleZ9BoundFunc16__T10MBoundFuncZ4funcMFZv>}) at main.d:353
1 thread 3708.0x318 0x7c90eb94 in _libws2_32_a_iname ()
(gdb) watch *(int*)0x2d38140
Hardware watchpoint 2: *(int *) 47415616
(gdb) thr 3
[Switching to thread 3 (thread 3708.0x148c)]#0 0x7c90eb94 in _libws2_32_a_iname
()
(gdb) watch *(int*)0x2d38140
Hardware watchpoint 3: *(int *) 47415616
(gdb) thr 4
[Switching to thread 4 (thread 3708.0xcf0)]#0 0x7c90eb94 in _libws2_32_a_iname
()
(gdb) watch *(int*)0x2d38140
Hardware watchpoint 4: *(int *) 47415616
(gdb) thr 5
[Switching to thread 5 (thread 3708.0x15bc)]#0 0x7c90eb94 in _libws2_32_a_iname
()
(gdb) watch *(int*)0x2d38140
Hardware watchpoint 5: *(int *) 47415616
(gdb) c
Continuing.
[Switching to thread 3708.0x16a0]
Breakpoint 1, _D4main9earthsong6updateMFDFZvDFZvZv (this=@0x1304780, redraw=
{object = 0x1df6380, func = 0x40c712 <_D4main14user_interface7refreshMFZv>
}, got=
{object = 0x1ebcdc0, func = 0x53a570 <_D3std4bind117__T9BoundFuncTDFC4main
5comicZvS41_D3std4bind9NullAliasS3std4bind9EmptySlotTS3std4bind23__T5TupleTC4mai
n5comicZ5TupleZ9BoundFunc16__T10MBoundFuncZ4funcMFZv>}) at main.d:353
353 sgms[part]++; flush; got(); redraw();
(gdb) p *(this.data.pages)
Structure has no component named operator*.
(gdb) p *(this.data.pages.ptr)
$3 = {url = {length = 45,
ptr = 0x2d38140 "www.earthsongsaga.com/images/Redux/cover1.jpg"}, title = {
length = 16,
ptr = 0x2d6eb31 "December 1, 2005 </strong></p>\r\n <p>I'd like to th
ank all of you who took the time to write me emails of congratulations re: my en
gagement - it was very touching *has much love for all her read"...},
chapter = {length = 0, ptr = 0x0}, read = false, reserve = {length = 0,
ptr = 0x0}}
(gdb) c
Continuing.
Breakpoint 1, _D4main9earthsong6updateMFDFZvDFZvZv (this=@0x1304780, redraw=
{object = 0x1df6380, func = 0x40c712 <_D4main14user_interface7refreshMFZv>
}, got=
{object = 0x1ebcdc0, func = 0x53a570 <_D3std4bind117__T9BoundFuncTDFC4main
5comicZvS41_D3std4bind9NullAliasS3std4bind9EmptySlotTS3std4bind23__T5TupleTC4mai
n5comicZ5TupleZ9BoundFunc16__T10MBoundFuncZ4funcMFZv>}) at main.d:353
353 sgms[part]++; flush; got(); redraw();
(gdb) p *(this.data.pages.ptr)
$4 = {url = {length = 45,
ptr = 0x2d38140 "www.earthsongsaga.com/images/Redux/cover1.jpg"}, title = {
length = 16,
ptr = 0x2d6eb31 "December 1, 2005 </strong></p>\r\n <p>I'd like to th
ank all of you who took the time to write me emails of congratulations re: my en
gagement - it was very touching *has much love for all her read"...},
chapter = {length = 0, ptr = 0x0}, read = false, reserve = {length = 0,
ptr = 0x0}}
(gdb) c
Continuing.
Breakpoint 1, _D4main9earthsong6updateMFDFZvDFZvZv (this=@0x1304780, redraw=
{object = 0x1df6380, func = 0x40c712 <_D4main14user_interface7refreshMFZv>
}, got=
{object = 0x1ebcdc0, func = 0x53a570 <_D3std4bind117__T9BoundFuncTDFC4main
5comicZvS41_D3std4bind9NullAliasS3std4bind9EmptySlotTS3std4bind23__T5TupleTC4mai
n5comicZ5TupleZ9BoundFunc16__T10MBoundFuncZ4funcMFZv>}) at main.d:353
353 sgms[part]++; flush; got(); redraw();
(gdb) p *(this.data.pages.ptr)
$5 = {url = {length = 45,
ptr = 0x2d38140 "www.earthsongsaga.com/images/Redux/cover1.jpg"}, title = {
length = 16,
ptr = 0x2d6eb31 "December 1, 2005 </strong></p>\r\n <p>I'd like to th
ank all of you who took the time to write me emails of congratulations re: my en
gagement - it was very touching *has much love for all her read"...},
chapter = {length = 0, ptr = 0x0}, read = false, reserve = {length = 0,
ptr = 0x0}}
(gdb) c
Continuing.
Breakpoint 1, _D4main9earthsong6updateMFDFZvDFZvZv (this=@0x1304780, redraw=
{object = 0x1df6380, func = 0x40c712 <_D4main14user_interface7refreshMFZv>
}, got=
{object = 0x1ebcdc0, func = 0x53a570 <_D3std4bind117__T9BoundFuncTDFC4main
5comicZvS41_D3std4bind9NullAliasS3std4bind9EmptySlotTS3std4bind23__T5TupleTC4mai
n5comicZ5TupleZ9BoundFunc16__T10MBoundFuncZ4funcMFZv>}) at main.d:353
353 sgms[part]++; flush; got(); redraw();
(gdb) c
Continuing.
Breakpoint 1, _D4main9earthsong6updateMFDFZvDFZvZv (this=@0x1304780, redraw=
{object = 0x1df6380, func = 0x40c712 <_D4main14user_interface7refreshMFZv>
}, got=
{object = 0x1ebcdc0, func = 0x53a570 <_D3std4bind117__T9BoundFuncTDFC4main
5comicZvS41_D3std4bind9NullAliasS3std4bind9EmptySlotTS3std4bind23__T5TupleTC4mai
n5comicZ5TupleZ9BoundFunc16__T10MBoundFuncZ4funcMFZv>}) at main.d:353
353 sgms[part]++; flush; got(); redraw();
(gdb) c
Continuing.
Breakpoint 1, _D4main9earthsong6updateMFDFZvDFZvZv (this=@0x1304780, redraw=
{object = 0x1df6380, func = 0x40c712 <_D4main14user_interface7refreshMFZv>
}, got=
{object = 0x1ebcdc0, func = 0x53a570 <_D3std4bind117__T9BoundFuncTDFC4main
5comicZvS41_D3std4bind9NullAliasS3std4bind9EmptySlotTS3std4bind23__T5TupleTC4mai
n5comicZ5TupleZ9BoundFunc16__T10MBoundFuncZ4funcMFZv>}) at main.d:353
353 sgms[part]++; flush; got(); redraw();
(gdb) p *(this.data.pages.ptr)
$6 = {url = {length = 45,
ptr = 0x2d38140 "www.earthsongsaga.com/images/Redux/cover1.jpg"}, title = {
length = 16,
ptr = 0x2d6eb31 "December 1, 2005 </strong></p>\r\n <p>I'd like to th
ank all of you who took the time to write me emails of congratulations re: my en
gagement - it was very touching *has much love for all her read"...},
chapter = {length = 0, ptr = 0x0}, read = false, reserve = {length = 0,
ptr = 0x0}}
(gdb) d 1
(gdb) c
Continuing.
[Switching to thread 3708.0x318]
Hardware watchpoint 2: *(int *) 47415616
Old value = 779581303
New value = 0
Hardware watchpoint 3: *(int *) 47415616
Old value = 779581303
New value = 0
Hardware watchpoint 4: *(int *) 47415616
Old value = 779581303
New value = 0
Hardware watchpoint 5: *(int *) 47415616
Old value = 779581303
New value = 0
0x0042acb0 in _d_newclass (ci=@0x54e530)
at ../../../gcc-4.1.2/libphobos/internal/gc/gc.d:170
170 (cast(byte*)p)[0 .. ci.init.length] = ci.init[];
(gdb) bt
#0 0x0042acb0 in _d_newclass (ci=@0x54e530)
at ../../../gcc-4.1.2/libphobos/internal/gc/gc.d:170
#1 0x0040de1d in _D4main14user_interface13buildTreeviewMFkkZAC7widgets6widget
(this=@0x1df6380, start=0, end=23) at main.d:1063
#2 0x0054bd84 in _D7widgets29__T7dgArrayTC7widgets6widgetZ7dgArray6opCallMFkkZA
C7widgets6widget (this=0x1df61a8, start=0, end=23) at widgets.d:275
#3 0x0041fa49 in _D7widgets14fixedscrollbox4drawMFPS3SDL11SDL_SurfaceZv (
this=@0x1df6180, surf=0xf15c68) at widgets.d:796
#4 0x00419f19 in _D7widgets15compositeWidget4drawMFPS3SDL11SDL_SurfaceZv (
this=@0x1e1c800, surf=0xf15c68) at widgets.d:179
#5 0x00420747 in _D7widgets10fixedSplit4drawMFPS3SDL11SDL_SurfaceZv (
this=@0x1e1c800, surf=0xf15c68) at widgets.d:876
#6 0x00419f19 in _D7widgets15compositeWidget4drawMFPS3SDL11SDL_SurfaceZv (
this=@0x1e1ca80, surf=0xf15c68) at widgets.d:179
#7 0x0041e996 in _D7widgets11splitWidget4drawMFPS3SDL11SDL_SurfaceZv (
this=@0x1e1ca80, surf=0xf15c68) at widgets.d:700
#8 0x0041a314 in _D7widgets8callback4drawMFPS3SDL11SDL_SurfaceZv (
this=@0x1e1ccc0, surf=0xf15c68) at widgets.d:215
#9 0x0041513c in _D10sdl_bridge10sdl_bridge10mustRedrawMFZb (this=@0x1e1b620)
at sdl_bridge.d:27
#10 0x004156a1 in _D10sdl_bridge10sdl_bridge4idleMFZv (this=@0x1e1b620)
at sdl_bridge.d:81
#11 0x00419d01 in _D7widgets9ui_bridge4loopMFZv (this=@0x1e1b620)
---Type <return> to continue, or q <return> to quit---
at widgets.d:156
#12 0x00410200 in _D4main14user_interface3runMFZv (this=@0x1df6380)
at main.d:1251
#13 0x004108f7 in _D4main4MainFAAaZi (args={length = 1, ptr = 0xd32720})
at main.d:1279
#14 0x0040563f in _Dmain (args={length = 2293416, ptr = 0x43f253})
at main.d:262
#15 0x0043f253 in _D9dgccmain211_d_run_mainUiPPaPUAAaZiZi2goMFZv ()
at ../../../gcc-4.1.2/libphobos/internal/dgccmain2.d:83
#16 0x0043f0bf in _d_run_main (argc=1, argv=0xd33f88,
main_func=0x40561c <_Dmain>)
at ../../../gcc-4.1.2/libphobos/internal/dgccmain2.d:93
#17 0x00421018 in main (argc=2293680, argv=0x401237)
at ../../../gcc-4.1.2/libphobos/internal/cmain.d:5
(gdb) f 13
#13 0x004108f7 in _D4main4MainFAAaZi (args={length = 1, ptr = 0xd32720})
at main.d:1279
1279 UserInterface.run;
(gdb) p es
$7 = (comic &) @0x1304780: {<> = {vptr = 0x55d3e0, monitor = 0x0}, data = {
pages = {length = 10, ptr = 0x2d6ce00}, custom = {length = 16,
ptr = 0x2d66890 "\003"}}, gotNew = true, updating = true, fs = @0xe10fc0}
(gdb) p es.data.pages
$8 = {length = 10, ptr = 0x2d6ce00}
(gdb) p *(es.data.pages.ptr)
$9 = {url = {length = 45, ptr = 0x2d38140 ""}, title = {length = 16,
ptr = 0x2d6eb31 ""}, chapter = {length = 0, ptr = 0x0}, read = false,
reserve = {length = 0, ptr = 0x0}}
(gdb) q
The program is running. Exit anyway? (y or n) y
D:\code\d\yawr>
More information about the D.gnu
mailing list