* dwarf2_get_pc_bounds problem @ 2003-02-14 10:59 Martin M. Hunt 2003-02-14 15:12 ` Daniel Jacobowitz 0 siblings, 1 reply; 3+ messages in thread From: Martin M. Hunt @ 2003-02-14 10:59 UTC (permalink / raw) To: gdb I'm investigating several errors in recent versions of gdb and they all seem to be caused by bogus values for lowpc and highpc returned from dwarf2_get_pc_bounds(). I'm not a DWARF expert so maybe the problem is bad debug info, but the code in dwarf2_get_pc_bounds seems suspicious. What I'm seeing is that with a program linked at 0x80000000, all the highpc and lowpc look fine, except those derived from DW_AT_ranges information. Those are all very small, like 0x100. Looking at the code in dwarf2_get_pc_bounds(), most of it seems to be trying to calculate a variable "base" which is then never used. Perhaps a simple addition was left out? Martin ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: dwarf2_get_pc_bounds problem 2003-02-14 10:59 dwarf2_get_pc_bounds problem Martin M. Hunt @ 2003-02-14 15:12 ` Daniel Jacobowitz 2003-02-14 19:01 ` Martin M. Hunt 0 siblings, 1 reply; 3+ messages in thread From: Daniel Jacobowitz @ 2003-02-14 15:12 UTC (permalink / raw) To: Martin M. Hunt; +Cc: gdb On Fri, Feb 14, 2003 at 02:59:40AM -0800, Martin M. Hunt wrote: > I'm investigating several errors in recent versions of gdb and they all > seem to be caused by bogus values for lowpc and highpc returned from > dwarf2_get_pc_bounds(). I'm not a DWARF expert so maybe the problem is > bad debug info, but the code in dwarf2_get_pc_bounds seems suspicious. > > What I'm seeing is that with a program linked at 0x80000000, all the > highpc and lowpc look fine, except those derived from DW_AT_ranges > information. Those are all very small, like 0x100. Looking at the code > in dwarf2_get_pc_bounds(), most of it seems to be trying to calculate a > variable "base" which is then never used. Perhaps a simple addition was > left out? Ah, er, um, er.... I tested this, how the heck did it work? Aha, my test case involved multiple sections, so GCC used a base of 0. That's how. Could you try this obvious fix? Still doesn't fix Jakub's test (we really do need discontiguous ranges for that to work) but r_type searches one local block instead of going straight to the function. Oddly, I remember this happening before. I may have lost the addition in a merge somewhere. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer 2003-02-14 Daniel Jacobowitz <drow@mvista.com> * dwarf2read.c (dwarf2_get_pc_bounds): Offset addresses by base. Index: dwarf2read.c =================================================================== RCS file: /cvs/src/src/gdb/dwarf2read.c,v retrieving revision 1.85 diff -u -p -r1.85 dwarf2read.c --- dwarf2read.c 4 Feb 2003 20:17:02 -0000 1.85 +++ dwarf2read.c 14 Feb 2003 15:10:24 -0000 @@ -2195,6 +2195,9 @@ dwarf2_get_pc_bounds (struct die_info *d return 0; } + range_beginning += base; + range_end += base; + /* FIXME: This is recording everything as a low-high segment of consecutive addresses. We should have a data structure for discontiguous block ranges ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: dwarf2_get_pc_bounds problem 2003-02-14 15:12 ` Daniel Jacobowitz @ 2003-02-14 19:01 ` Martin M. Hunt 0 siblings, 0 replies; 3+ messages in thread From: Martin M. Hunt @ 2003-02-14 19:01 UTC (permalink / raw) To: Daniel Jacobowitz; +Cc: gdb Your patch fixes the problems I was seeing. Martin On Fri, 2003-02-14 at 07:12, Daniel Jacobowitz wrote: > On Fri, Feb 14, 2003 at 02:59:40AM -0800, Martin M. Hunt wrote: > > I'm investigating several errors in recent versions of gdb and they all > > seem to be caused by bogus values for lowpc and highpc returned from > > dwarf2_get_pc_bounds(). I'm not a DWARF expert so maybe the problem is > > bad debug info, but the code in dwarf2_get_pc_bounds seems suspicious. > > > > What I'm seeing is that with a program linked at 0x80000000, all the > > highpc and lowpc look fine, except those derived from DW_AT_ranges > > information. Those are all very small, like 0x100. Looking at the code > > in dwarf2_get_pc_bounds(), most of it seems to be trying to calculate a > > variable "base" which is then never used. Perhaps a simple addition was > > left out? > > Ah, er, um, er.... I tested this, how the heck did it work? Aha, my > test case involved multiple sections, so GCC used a base of 0. That's > how. > > Could you try this obvious fix? Still doesn't fix Jakub's test (we > really do need discontiguous ranges for that to work) but r_type > searches one local block instead of going straight to the function. > > Oddly, I remember this happening before. I may have lost the addition > in a merge somewhere. > > -- > Daniel Jacobowitz > MontaVista Software Debian GNU/Linux Developer > > 2003-02-14 Daniel Jacobowitz <drow@mvista.com> > > * dwarf2read.c (dwarf2_get_pc_bounds): Offset addresses by base. > > Index: dwarf2read.c > =================================================================== > RCS file: /cvs/src/src/gdb/dwarf2read.c,v > retrieving revision 1.85 > diff -u -p -r1.85 dwarf2read.c > --- dwarf2read.c 4 Feb 2003 20:17:02 -0000 1.85 > +++ dwarf2read.c 14 Feb 2003 15:10:24 -0000 > @@ -2195,6 +2195,9 @@ dwarf2_get_pc_bounds (struct die_info *d > return 0; > } > > + range_beginning += base; > + range_end += base; > + > /* FIXME: This is recording everything as a low-high > segment of consecutive addresses. We should have a > data structure for discontiguous block ranges ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-02-14 19:01 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2003-02-14 10:59 dwarf2_get_pc_bounds problem Martin M. Hunt 2003-02-14 15:12 ` Daniel Jacobowitz 2003-02-14 19:01 ` Martin M. Hunt
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox