Messed up debug symbols GDB/GDC

Rainer Schuetze r.sagitario at gmx.de
Sat Dec 9 11:22:52 UTC 2017



On 07.12.2017 20:08, kk wrote:
> Hey so I recently got back into D a bit, but I'm having a bit of trouble 
> with debugging.
> 
> So for this minimal test file:
> 
> void main()
> {
>      int x = 5;
>      int y = x * 20;
> 
> 
>      float b = 6.7432143;
> 
>      b *= 2;
> 
> }
> 
> Compiled with gdc (Ubuntu 7.2.0-8ubuntu3) 7.2.0
> $ gdc -g test.d -otest
> 
> I get this output in gdb
> -------------------------------------------------------------------------------- 
> 
> (gdb) b main
> Breakpoint 1 at 0x104f9: file 
> /usr/lib/gcc/x86_64-linux-gnu/7/include/d/__entrypoint.di, line 44.
> (gdb) r
> Starting program: /home/kyoji/ProgrammingTests/dlang/test
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
> 
> Breakpoint 1, main (argc=1, argv=0x7fffffffdd78) at 
> /usr/lib/gcc/x86_64-linux-gnu/7/include/d/__entrypoint.di:44
> 44          return _d_run_main(argc, argv, &_Dmain);
> (gdb) n
> 45      }
> (gdb)
> __libc_start_main (main=0x5555555644ea <main>, argc=1, 
> argv=0x7fffffffdd78, init=<optimized out>, fini=<optimized out>, 
> rtld_fini=<optimized out>,
>      stack_end=0x7fffffffdd68) at ../csu/libc-start.c:342
> 342     ../csu/libc-start.c: No such file or directory.
> (gdb)
> [Inferior 1 (process 11211) exited normally]
> ---------------------------------------------------------------------------------- 
> 
> 
> 
> Sometimes if I reformatted the text, it would print a random line, such 
> as 'b *= 2'
> but it was more less random.
> 
> I also did try forcing different dwarf versions, but it was the exact 
> same result.
> 
> 
> If I need to post anymore info please let me know.
> Thanks!
> 
>

I'm not a GDC/gdb user, but with "b main" you are breaking into the 
automatically generated C main function, not D's main. Try "b Dmain" or 
"b _Dmain" or use the source line.


More information about the Digitalmars-d-debugger mailing list