* Reference to .debug_loc
@ 2003-02-14 14:57 Michal Ludvig
2003-02-14 15:26 ` Daniel Jacobowitz
0 siblings, 1 reply; 10+ messages in thread
From: Michal Ludvig @ 2003-02-14 14:57 UTC (permalink / raw)
To: Daniel Berlin; +Cc: gdb, gcc
Hi again,
when location lists are in use, .debug_info looks like this:
.section .debug_info
.long 0x187 # Length of Compilation Unit Info
.value 0x2 # DWARF version number
.long .Ldebug_abbrev0 # Offset Into Abbrev. Section
.byte 0x8 # Pointer Size (in bytes)
.uleb128 0x1 # (DIE (0xb) DW_TAG_compile_unit)
.long .Ldebug_line0 # DW_AT_stmt_list
.quad .Letext0 # DW_AT_high_pc
.quad .Ltext0 # DW_AT_low_pc
.byte 0x1 # DW_AT_language
[...]
.uleb128 0x3 # (DIE (0x50) DW_TAG_formal_parameter)
.long .LASF2 # DW_AT_name: "value"
.byte 0x1 # DW_AT_decl_file
.byte 0x2 # DW_AT_decl_line
.long 0x8f # DW_AT_type
.long .LLST0-.Ldebug_loc0 # DW_AT_location
So, the reference to .debug_loc on the last line of the example
(DW_AT_location) is an offset within that section, ie. it's 0 (NULL) for
the first entry with a location list. However when I link several .o
files together, each of them have DW_AT_location entries based at the
same NULL.
This time I realy can't see a way to find out at what position in the
resulting (ie. linked from several ones) .debug_loc should I start
reading for a given compilation unit.
Should there be something more in the CU header? Something similar to
.long .Ldebug_abbrev0 # Offset Into Abbrev. Section
For example
.long .Ldebug_loc0 # Offset Into Loclist Section
Or is there another way?
Thanks in advance!
Michal Ludvig
--
* SuSE CR, s.r.o * mludvig@suse.cz
* (+420) 296.545.373 * http://www.suse.cz
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: Reference to .debug_loc 2003-02-14 14:57 Reference to .debug_loc Michal Ludvig @ 2003-02-14 15:26 ` Daniel Jacobowitz 2003-02-14 19:24 ` Daniel Berlin 0 siblings, 1 reply; 10+ messages in thread From: Daniel Jacobowitz @ 2003-02-14 15:26 UTC (permalink / raw) To: Michal Ludvig; +Cc: Daniel Berlin, gdb, gcc On Fri, Feb 14, 2003 at 03:57:55PM +0100, Michal Ludvig wrote: > Hi again, > when location lists are in use, .debug_info looks like this: > > .section .debug_info > .long 0x187 # Length of Compilation Unit Info > .value 0x2 # DWARF version number > .long .Ldebug_abbrev0 # Offset Into Abbrev. Section > .byte 0x8 # Pointer Size (in bytes) > .uleb128 0x1 # (DIE (0xb) DW_TAG_compile_unit) > .long .Ldebug_line0 # DW_AT_stmt_list > .quad .Letext0 # DW_AT_high_pc > .quad .Ltext0 # DW_AT_low_pc > .byte 0x1 # DW_AT_language > [...] > .uleb128 0x3 # (DIE (0x50) DW_TAG_formal_parameter) > .long .LASF2 # DW_AT_name: "value" > .byte 0x1 # DW_AT_decl_file > .byte 0x2 # DW_AT_decl_line > .long 0x8f # DW_AT_type > .long .LLST0-.Ldebug_loc0 # DW_AT_location > > So, the reference to .debug_loc on the last line of the example > (DW_AT_location) is an offset within that section, ie. it's 0 (NULL) for > the first entry with a location list. However when I link several .o > files together, each of them have DW_AT_location entries based at the > same NULL. > > This time I realy can't see a way to find out at what position in the > resulting (ie. linked from several ones) .debug_loc should I start > reading for a given compilation unit. > > Should there be something more in the CU header? Something similar to > .long .Ldebug_abbrev0 # Offset Into Abbrev. Section > For example > .long .Ldebug_loc0 # Offset Into Loclist Section > > Or is there another way? At a guess it should be like DW_AT_ranges: .long .Ldebug_ranges0+0x0 # DW_AT_ranges I.E. dw2_asm_output_offset, rather than dw2_asm_output_delta, in GCC. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Reference to .debug_loc 2003-02-14 15:26 ` Daniel Jacobowitz @ 2003-02-14 19:24 ` Daniel Berlin 2003-02-14 19:51 ` Daniel Jacobowitz 0 siblings, 1 reply; 10+ messages in thread From: Daniel Berlin @ 2003-02-14 19:24 UTC (permalink / raw) To: Daniel Jacobowitz; +Cc: Michal Ludvig, gdb, gcc On Friday, February 14, 2003, at 10:26 AM, Daniel Jacobowitz wrote: > On Fri, Feb 14, 2003 at 03:57:55PM +0100, Michal Ludvig wrote: >> Hi again, >> when location lists are in use, .debug_info looks like this: >> >> .section .debug_info >> .long 0x187 # Length of Compilation Unit Info >> .value 0x2 # DWARF version number >> .long .Ldebug_abbrev0 # Offset Into Abbrev. Section >> .byte 0x8 # Pointer Size (in bytes) >> .uleb128 0x1 # (DIE (0xb) DW_TAG_compile_unit) >> .long .Ldebug_line0 # DW_AT_stmt_list >> .quad .Letext0 # DW_AT_high_pc >> .quad .Ltext0 # DW_AT_low_pc >> .byte 0x1 # DW_AT_language >> [...] >> .uleb128 0x3 # (DIE (0x50) DW_TAG_formal_parameter) >> .long .LASF2 # DW_AT_name: "value" >> .byte 0x1 # DW_AT_decl_file >> .byte 0x2 # DW_AT_decl_line >> .long 0x8f # DW_AT_type >> .long .LLST0-.Ldebug_loc0 # DW_AT_location >> >> So, the reference to .debug_loc on the last line of the example >> (DW_AT_location) is an offset within that section, ie. it's 0 (NULL) >> for >> the first entry with a location list. However when I link several .o >> files together, each of them have DW_AT_location entries based at the >> same NULL. >> Err, why? If they are in different files, it should be adjusting the offsets when it merges the sections together, no? >> This time I realy can't see a way to find out at what position in the >> resulting (ie. linked from several ones) .debug_loc should I start >> reading for a given compilation unit. >> >> Should there be something more in the CU header? Something similar to >> .long .Ldebug_abbrev0 # Offset Into Abbrev. Section >> For example >> .long .Ldebug_loc0 # Offset Into Loclist Section >> No. >> Or is there another way? > > At a guess it should be like DW_AT_ranges: > .long .Ldebug_ranges0+0x0 # DW_AT_ranges > > I.E. dw2_asm_output_offset, rather than dw2_asm_output_delta, in GCC. > It's supposed to be the offset from the beginning of the debug_loc section. Will this do that? > -- > Daniel Jacobowitz > MontaVista Software Debian GNU/Linux Developer ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Reference to .debug_loc 2003-02-14 19:24 ` Daniel Berlin @ 2003-02-14 19:51 ` Daniel Jacobowitz 2003-02-14 20:23 ` Daniel Berlin 2003-02-14 20:35 ` Jakub Jelinek 0 siblings, 2 replies; 10+ messages in thread From: Daniel Jacobowitz @ 2003-02-14 19:51 UTC (permalink / raw) To: Daniel Berlin; +Cc: Michal Ludvig, gdb, gcc On Fri, Feb 14, 2003 at 02:24:43PM -0500, Daniel Berlin wrote: > > On Friday, February 14, 2003, at 10:26 AM, Daniel Jacobowitz wrote: > > >On Fri, Feb 14, 2003 at 03:57:55PM +0100, Michal Ludvig wrote: > >>Hi again, > >>when location lists are in use, .debug_info looks like this: > >> > >> .section .debug_info > >> .long 0x187 # Length of Compilation Unit Info > >> .value 0x2 # DWARF version number > >> .long .Ldebug_abbrev0 # Offset Into Abbrev. Section > >> .byte 0x8 # Pointer Size (in bytes) > >> .uleb128 0x1 # (DIE (0xb) DW_TAG_compile_unit) > >> .long .Ldebug_line0 # DW_AT_stmt_list > >> .quad .Letext0 # DW_AT_high_pc > >> .quad .Ltext0 # DW_AT_low_pc > >> .byte 0x1 # DW_AT_language > >> [...] > >> .uleb128 0x3 # (DIE (0x50) DW_TAG_formal_parameter) > >> .long .LASF2 # DW_AT_name: "value" > >> .byte 0x1 # DW_AT_decl_file > >> .byte 0x2 # DW_AT_decl_line > >> .long 0x8f # DW_AT_type > >> .long .LLST0-.Ldebug_loc0 # DW_AT_location > >> > >>So, the reference to .debug_loc on the last line of the example > >>(DW_AT_location) is an offset within that section, ie. it's 0 (NULL) > >>for > >>the first entry with a location list. However when I link several .o > >>files together, each of them have DW_AT_location entries based at the > >>same NULL. > >> > > Err, why? > If they are in different files, it should be adjusting the offsets when > it merges the sections together, no? Look at that operand. It's the difference of two local labels - it gets resolved at assembly time. > >>Or is there another way? > > > >At a guess it should be like DW_AT_ranges: > > .long .Ldebug_ranges0+0x0 # DW_AT_ranges > > > >I.E. dw2_asm_output_offset, rather than dw2_asm_output_delta, in GCC. > > > > It's supposed to be the offset from the beginning of the debug_loc > section. > Will this do that? I think so. The result will be something like .Ldebug_ranges0 + (.LLST0-.Ldebug_loc0). If the assembler won't take that then we'll have to track addresses for loclists the same as we do for rangelists. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Reference to .debug_loc 2003-02-14 19:51 ` Daniel Jacobowitz @ 2003-02-14 20:23 ` Daniel Berlin 2003-02-14 20:35 ` Jakub Jelinek 1 sibling, 0 replies; 10+ messages in thread From: Daniel Berlin @ 2003-02-14 20:23 UTC (permalink / raw) To: Daniel Jacobowitz; +Cc: Michal Ludvig, gdb, gcc > > >>Or is there another way? > > > > > >At a guess it should be like DW_AT_ranges: > > > .long .Ldebug_ranges0+0x0 # DW_AT_ranges > > > > > >I.E. dw2_asm_output_offset, rather than dw2_asm_output_delta, in GCC. > > > > > > > It's supposed to be the offset from the beginning of the debug_loc > > section. > > Will this do that? > > I think so. The result will be something like .Ldebug_ranges0 + > (.LLST0-.Ldebug_loc0). If the assembler won't take that then we'll > have to track addresses for loclists the same as we do for rangelists. I'm compiling a compiler that does it right now, i'll post the results. > > -- > Daniel Jacobowitz > MontaVista Software Debian GNU/Linux Developer > ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Reference to .debug_loc 2003-02-14 19:51 ` Daniel Jacobowitz 2003-02-14 20:23 ` Daniel Berlin @ 2003-02-14 20:35 ` Jakub Jelinek 2003-02-14 20:40 ` Daniel Jacobowitz 2003-02-14 21:09 ` Daniel Berlin 1 sibling, 2 replies; 10+ messages in thread From: Jakub Jelinek @ 2003-02-14 20:35 UTC (permalink / raw) To: Daniel Berlin, Michal Ludvig, gdb, gcc On Fri, Feb 14, 2003 at 02:51:24PM -0500, Daniel Jacobowitz wrote: > > >>Or is there another way? > > > > > >At a guess it should be like DW_AT_ranges: > > > .long .Ldebug_ranges0+0x0 # DW_AT_ranges > > > > > >I.E. dw2_asm_output_offset, rather than dw2_asm_output_delta, in GCC. > > > > > > > It's supposed to be the offset from the beginning of the debug_loc > > section. > > Will this do that? > > I think so. The result will be something like .Ldebug_ranges0 + > (.LLST0-.Ldebug_loc0). If the assembler won't take that then we'll > have to track addresses for loclists the same as we do for rangelists. Why simple .long .LLST0 is not sufficient (@secrel(.LLST0) on IA-64)? It is not the only place where gcc relies on VMA of debugging sections to be 0 if the architecture lacks section relative relocations. Jakub ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Reference to .debug_loc 2003-02-14 20:35 ` Jakub Jelinek @ 2003-02-14 20:40 ` Daniel Jacobowitz 2003-02-17 14:55 ` Michal Ludvig 2003-02-14 21:09 ` Daniel Berlin 1 sibling, 1 reply; 10+ messages in thread From: Daniel Jacobowitz @ 2003-02-14 20:40 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Daniel Berlin, Michal Ludvig, gdb, gcc On Fri, Feb 14, 2003 at 09:35:21PM +0100, Jakub Jelinek wrote: > On Fri, Feb 14, 2003 at 02:51:24PM -0500, Daniel Jacobowitz wrote: > > > >>Or is there another way? > > > > > > > >At a guess it should be like DW_AT_ranges: > > > > .long .Ldebug_ranges0+0x0 # DW_AT_ranges > > > > > > > >I.E. dw2_asm_output_offset, rather than dw2_asm_output_delta, in GCC. > > > > > > > > > > It's supposed to be the offset from the beginning of the debug_loc > > > section. > > > Will this do that? > > > > I think so. The result will be something like .Ldebug_ranges0 + > > (.LLST0-.Ldebug_loc0). If the assembler won't take that then we'll > > have to track addresses for loclists the same as we do for rangelists. > > Why simple .long .LLST0 is not sufficient (@secrel(.LLST0) on IA-64)? > It is not the only place where gcc relies on VMA of debugging sections > to be 0 if the architecture lacks section relative relocations. I suppose that would work. Do you know why DW_AT_ranges is done the way it is? -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Reference to .debug_loc 2003-02-14 20:40 ` Daniel Jacobowitz @ 2003-02-17 14:55 ` Michal Ludvig 0 siblings, 0 replies; 10+ messages in thread From: Michal Ludvig @ 2003-02-17 14:55 UTC (permalink / raw) To: Daniel Jacobowitz; +Cc: Jakub Jelinek, Daniel Berlin, gdb, gcc Daniel Jacobowitz wrote: > On Fri, Feb 14, 2003 at 09:35:21PM +0100, Jakub Jelinek wrote: > >>On Fri, Feb 14, 2003 at 02:51:24PM -0500, Daniel Jacobowitz wrote: >> >>>>>>Or is there another way? >>>>> >>>>>At a guess it should be like DW_AT_ranges: >>>>> .long .Ldebug_ranges0+0x0 # DW_AT_ranges >>>>> >>>>>I.E. dw2_asm_output_offset, rather than dw2_asm_output_delta, in GCC. >>>>> >>>> >>>>It's supposed to be the offset from the beginning of the debug_loc >>>>section. >>>>Will this do that? >>> >>>I think so. The result will be something like .Ldebug_ranges0 + >>>(.LLST0-.Ldebug_loc0). If the assembler won't take that then we'll >>>have to track addresses for loclists the same as we do for rangelists. >> >>Why simple .long .LLST0 is not sufficient (@secrel(.LLST0) on IA-64)? >>It is not the only place where gcc relies on VMA of debugging sections >>to be 0 if the architecture lacks section relative relocations. > > I suppose that would work. Do you know why DW_AT_ranges is done the > way it is? Why? Michal Ludvig -- * SuSE CR, s.r.o * mludvig@suse.cz * (+420) 296.545.373 * http://www.suse.cz ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Reference to .debug_loc 2003-02-14 20:35 ` Jakub Jelinek 2003-02-14 20:40 ` Daniel Jacobowitz @ 2003-02-14 21:09 ` Daniel Berlin 2003-02-19 10:51 ` Michal Ludvig 1 sibling, 1 reply; 10+ messages in thread From: Daniel Berlin @ 2003-02-14 21:09 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Michal Ludvig, gdb, gcc On Fri, 14 Feb 2003, Jakub Jelinek wrote: > On Fri, Feb 14, 2003 at 02:51:24PM -0500, Daniel Jacobowitz wrote: > > > >>Or is there another way? > > > > > > > >At a guess it should be like DW_AT_ranges: > > > > .long .Ldebug_ranges0+0x0 # DW_AT_ranges > > > > > > > >I.E. dw2_asm_output_offset, rather than dw2_asm_output_delta, in GCC. > > > > > > > > > > It's supposed to be the offset from the beginning of the debug_loc > > > section. > > > Will this do that? > > > > I think so. The result will be something like .Ldebug_ranges0 + > > (.LLST0-.Ldebug_loc0). If the assembler won't take that then we'll > > have to track addresses for loclists the same as we do for rangelists. > > Why simple .long .LLST0 is not sufficient (@secrel(.LLST0) on IA-64)? > It is not the only place where gcc relies on VMA of debugging sections > to be 0 if the architecture lacks section relative relocations. That seems to work. Michael, try this: Index: dwarf2out.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/dwarf2out.c,v retrieving revision 1.382.2.8 diff -u -3 -p -r1.382.2.8 dwarf2out.c --- dwarf2out.c 8 Feb 2003 19:43:32 -0000 1.382.2.8 +++ dwarf2out.c 14 Feb 2003 21:09:27 -0000 @@ -6924,8 +6924,7 @@ output_die (die) if (sym == 0) abort (); - dw2_asm_output_delta (DWARF_OFFSET_SIZE, sym, - loc_section_label, "%s", name); + dw2_asm_output_offset (DWARF_OFFSET_SIZE, sym, "%s", name); } break; ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Reference to .debug_loc 2003-02-14 21:09 ` Daniel Berlin @ 2003-02-19 10:51 ` Michal Ludvig 0 siblings, 0 replies; 10+ messages in thread From: Michal Ludvig @ 2003-02-19 10:51 UTC (permalink / raw) To: Daniel Berlin; +Cc: Jakub Jelinek, gdb, gcc Daniel Berlin wrote: > > Michael, try this: > Index: dwarf2out.c > =================================================================== > RCS file: /cvs/gcc/gcc/gcc/dwarf2out.c,v > retrieving revision 1.382.2.8 > diff -u -3 -p -r1.382.2.8 dwarf2out.c > --- dwarf2out.c 8 Feb 2003 19:43:32 -0000 1.382.2.8 > +++ dwarf2out.c 14 Feb 2003 21:09:27 -0000 > @@ -6924,8 +6924,7 @@ output_die (die) > > if (sym == 0) > abort (); > - dw2_asm_output_delta (DWARF_OFFSET_SIZE, sym, > - loc_section_label, "%s", name); > + dw2_asm_output_offset (DWARF_OFFSET_SIZE, sym, "%s", name); > } > break; > Yes, this works fine. Please commit it. Thanks! Michal Ludvig -- * SuSE CR, s.r.o * mludvig@suse.cz * (+420) 296.545.373 * http://www.suse.cz ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2003-02-19 10:51 UTC | newest] Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2003-02-14 14:57 Reference to .debug_loc Michal Ludvig 2003-02-14 15:26 ` Daniel Jacobowitz 2003-02-14 19:24 ` Daniel Berlin 2003-02-14 19:51 ` Daniel Jacobowitz 2003-02-14 20:23 ` Daniel Berlin 2003-02-14 20:35 ` Jakub Jelinek 2003-02-14 20:40 ` Daniel Jacobowitz 2003-02-17 14:55 ` Michal Ludvig 2003-02-14 21:09 ` Daniel Berlin 2003-02-19 10:51 ` Michal Ludvig
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox