gcc45 wrong debug info?

Eric Dedrick dedrick at vbnm.net
Mon Feb 28 02:36:56 UTC 2011

Hmm.  When I compile with -gstabs -ggdb, at least addr2line and gdb
can at least see the correct line info.  The info below is correct
except I don't know what's up with the argc thing.



Breakpoint 1, main (argc=Cannot access memory at address
) at interreflect_driver.c:9
(gdb) info breakpoints
Num Type           Disp Enb Address            What
1   breakpoint     keep y   0x0000000000400fed in main at
	breakpoint already hit 1 time
2   breakpoint     keep y   0x00000000004013bb in main at
3   breakpoint     keep y   0x0000000000401cd3 in
reconstruction_load_points at interreflect3d.c:296
4   breakpoint     keep y   0x0000000000404419 in reconstruction_prune
at interreflect3d.c:1107
On Sun, Feb 27, 2011 at 07:30:38PM -0500, Eric Dedrick wrote:
> Wondering if anyone has encountered this problem where gdb/gcc doesn't
> seem to be getting the line number info right.
> I compiled code in as
> ----------------------------------------------------------------------
> gcc45 -g -W -Wall -O0 -std=c99 -D_BSD_SOURCE -DDEBUG -D__BSD_VISIBLE
> -DFREEBSD  -c interreflect3d.c 
> -o x86-debug/objects/interreflections/interreflect3d.o
> gcc45 -g -W -Wall -O0 -std=c99 -D_BSD_SOURCE -DDEBUG -D__BSD_VISIBLE
> -DFREEBSD interreflect_driver.c
> x86-debug/objects/interreflections/interreflect3d.o 
> -o x86-debug/bin/interreflect_driver 
> -I./ 
> -Ix86-debug/include
> -Ix86-debug/../external/include 
> -Lx86-debug/../external/lib
> -llapack -lf77blas -lcblas -latlas -lgfortran
> ----------------------------------------------------------------------
> and then I go to debug.  I seem to stop in my function ok, locals and
> such seem ok, gdb seems to handle OK, except the line number
> information is wrong:
> #0  0x000000000040467b in reconstruction_prune (r=0x7fffffffe420,
> intensity_threshold_min=1, 
>     intensity_threshold_max=999999, jump_discontinuity_threshold=100,
>     clustersize=5)
>     at interreflect3d.c:296
> #1  0x00000000004013ef in main (argc=26, argv=0x7fffffffe620) at
> interreflect_driver.c:103
> For #0, the correct line is 1108, not 296.  #1 is correct.  
> This incorrect line number info is giving me grief while I'm trying to
> step through my code.
> Anyone have a hunch what's going on here?
> Thanks.

More information about the freebsd-questions mailing list