This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
RE: Wrong mapping pc to line numbers when listing coff
- To: Elena Zannoni <ezannoni at cygnus dot com>
- Subject: RE: Wrong mapping pc to line numbers when listing coff
- From: Andrew Volkov <Andrew dot Volkov at transas dot com>
- Date: Fri, 9 Nov 2001 20:39:54 +0300
- Cc: gdb at sources dot redhat dot com
Elena,
Sorry, but provide simple example (and backtrace) is not so easy. I'm
attached very elementary bzipped project for Hitachi 2623 (h8S/300) based
board (sorry for clumsy make file, it was generated automaticlly), gcc
v3.0.2 (with last Kazu Hirata's patch
http://prdownloads.sourceforge.net/h8300-hms/h8300-hms-gcc-3.0.2-1.patch),
binutils v 2.11.90 (I trying with older version of both - result the same).
For building, type
make -f test.mak rebuild
So when debugging under gdb-5.0.92 (h8300-hms-gdb test.out) you could wrote:
(gdb) list main
And you will see next:
37 }
38
39
40 int main()
41 {
42 LED_ON();
43 CpuUnlock();
44
45 for(;;)
46 {
But, right list (as I understand)
40 int main()
41 {
42 LED_ON();
43 CpuUnlock();
44
45 for(;;)
46 {
47 LED_TOGGLE();
48
49 }
50 }
I'm checking assembly listing with debug info and all, what insert gcc, was
correct. Object files I checked with nm and its output show all ok too. When
I tracing find_pc_sect_line, then "prev" setting on truely previous symbol
(end of function _low_level_init) and "item" pointed to "main". But when
returning, "best" contain information from "*prev" :(.
Andrey
P.S. This bug influence not only to list (this is not comfortable, but
tolerably), but on breakpoints and tracing, whats ugly :(.
> -----Original Message-----
> From: Elena Zannoni [mailto:ezannoni@cygnus.com]
> Sent: Friday, November 09, 2001 6:28 PM
> To: Andrew Volkov
> Cc: ezannoni@redhat.com; gdb@sources.redhat.com
> Subject: Re: Wrong mapping pc to line numbers when listing coff
>
>
> Andrew Volkov writes:
> > Hi Elena,
> >
> > As I understand (may be I wrong :), file gdb/symtab.c
> belong to you. Well, I
> > found next bug/incorrectness in find_pc_sect_line function:
> > When I build coff target from c++ files (with templates)
> and debugging it,
> > then find_pc_sect_line return wrong start line number.
> It's because this
> > function consider that symbol with lower pc then current
> pc (argument of
> > find_pc_sect_line) is belong to first line (or vice
> versa), this is not
> > always correct, especcially for functions. In functions
> first line came
> > after prologs, and hence, best.pc (and best.line) must be
> greater then
> > current pc. I could correct this incorrectness, but it
> will be better, if
> > you tell me your ideas about this situation.
> >
> > Regards,
> > Andrey
>
>
> Andrey,
> yes I am one of the maintainers for that file.
>
> Could you provide an example where this situation occurs?
> Also a backtrace from find_pc_sect_line could be useful.
>
> Have you verified that the debug information for your program
> is correct?
>
>
> Thanks
> Elena
>
test.tar.bz2