From mboxrd@z Thu Jan 1 00:00:00 1970 From: Brian Grant To: gdb@sources.redhat.com Subject: support for compilation units with discontiguous address ranges? (.debug_ranges) Date: Thu, 19 Jul 2001 14:56:00 -0000 Message-id: <200107192155.OAA10252@grant-linux2.transmeta.com> X-SW-Source: 2001-07/msg00290.html Has anyone implemented dwarf2 support in gdb for compilation units with discontiguous ranges of addresses? gcc 3.x doesn't seem to produce .debug_ranges and gdb 5.0 doesn't read it at all. gdb also seems to ignore .debug_aranges. What I've tried to do is to put different functions in the same C file into different text sections using gcc as follows: foobar.c: __attribute__((section(".text1"))) void foo() {...} __attribute__((section(".text2"))) void bar() {...} In the executable, they are located something like: Sections: Idx Name Size VMA LMA File off Algn ... 2 .text1 0000a688 00ec5800 00ec5800 000001b4 2**10 CONTENTS, ALLOC, LOAD, READONLY, CODE 3 .text2 0000ee58 00ed5800 00ed5800 0000a83c 2**10 CONTENTS, ALLOC, LOAD, READONLY, CODE ... What currently happens in gdb is that all functions in .text1 and .text2 at addresses between foo() and bar() are attributed the file and line number of the last line of foo(). Their real, accurate line-number info is overshadowed completely. I noticed that gcc doesn't produce DW_AT_low_pc/high_pc fields for foobar.c, as it normally would for a DW_TAG_compilation_unit record, where all functions in the compilation unit were in the same section. Does anyone know of a workaround for this problem? --Brian Grant Transmeta Corp.