Article View: gnu.gdb.bug
Article #1306BUG REPORT
From: Konstantin Kostyuhin
Date: Mon, 19 Jul 2004 09:52
Date: Mon, 19 Jul 2004 09:52
125 lines
3803 bytes
3803 bytes
--yrj/dFKFPuw6o+aM
Content-Type: text/plain; charset=koi8r
Content-Disposition: inline
--yrj/dFKFPuw6o+aM
Content-Type: text/plain; charset=koi8r
Content-Disposition: attachment; filename="bugreport.txt"
To: bug-gdb@gnu.org
Subject: BUG REPORT
1. GDB version 6.1 and lower
2. Native platform is `i686-pc-linux-gnu',
target platform is `mips64-*-*'
3. GDB was compiled with GCC 3.2.2
4. The debugged program was compiled with GCC 3.4
5. Options used for compilation of the debugged program: "-g -G 0 -c"
6. The debugged program:
a.c:
int a()
{
return 0;
}
int __attribute__ ((section ("faraway"))) b()
{
return 1;
}
int c()
{
return 2;
}
b.c:
int d()
{
return 3;
}
int main()
{
a(); b(); c(); d();
return 4;
}
7. Compile a.c with DWARF2 debugging info and b.c without any debugging info:
gcc -gdwarf-2 -O0 -o a.o a.c
gcc -O2 -o b.o b.c
And link it together:
gcc -o ab a.o b.o
Run GDB and try to set breakpoint on the function main (or d):
(gdb) b main
Breakpoint 1 at ... file a.c, line 14
But with DWARF1 debugging info we get the correct situation:
(gdb) b main
Breakpoint 1 at ...
8. I suppose that the cause of the problem is that we use this code in the
file dwarf2read.c:
...
static char *
scan_partial_symbols (char *info_ptr, struct objfile *objfile,
CORE_ADDR *lowpc, CORE_ADDR *highpc,
const struct comp_unit_head *cu_header,
const char *namespace)
{
...
struct partial_die_info pdi;
...
switch (pdi.tag)
{
case DW_TAG_subprogram:
if (pdi.has_pc_info)
{
if (pdi.lowpc < *lowpc)
{
*lowpc = pdi.lowpc;
}
if (pdi.highpc > *highpc)
{
*highpc = pdi.highpc;
}
if (!pdi.is_declaration)
{
add_partial_symbol (&pdi, objfile, cu_header, namespace);
}
}
break;
...
In our case, section "faraway" based after ".text" and so
addresses of the functions d and main "belongs" to the "a.c"
compilation unit. But it false!
We need to correct this problem. I think that we must search through
the "ranges" table and get proper ranges from there.
Best regards,
Konstantin Kostyuhin
--yrj/dFKFPuw6o+aM--
Technical Details
Message-ID:
<mailman.682.1090301457.1960.bug-gdb@gnu.org>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!newsfeed.stanford.edu!shelby.stanford.edu!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: f5053,683af0c8ae4eee3d,start X-Google-Attributes: gidf5053,public X-Google-Language: RUSSIAN,KOI8R Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!newsfeed.stanford.edu!shelby.stanford.edu!not-for-mail From: Konstantin Kostyuhin <kost@niisi.msk.ru> Newsgroups: gnu.gdb.bug Subject: BUG REPORT Date: Mon, 19 Jul 2004 13:52:33 +0400 Lines: 127 Approved: bug-gdb@gnu.org Message-ID: <mailman.682.1090301457.1960.bug-gdb@gnu.org> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="yrj/dFKFPuw6o+aM" X-Trace: news.Stanford.EDU 1090301289 17247 199.232.76.165 (20 Jul 2004 05:28:09 GMT) X-Complaints-To: news@news.stanford.edu To: bug-gdb@gnu.org Envelope-to: bug-gdb@gnu.org Content-Disposition: inline User-Agent: Mutt/1.4.1i X-Scanned-By: milter-spamc/0.13.216 (aa19 [172.16.0.19]); Mon, 19 Jul 2004 13:52:35 +0400 X-Mailman-Approved-At: Tue, 20 Jul 2004 01:30:56 -0400 X-BeenThere: bug-gdb@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GDB, the GNU debugger" <bug-gdb.gnu.org> List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-gdb>, <mailto:bug-gdb-request@gnu.org?subject=unsubscribe> List-Archive: <http://lists.gnu.org/pipermail/bug-gdb> List-Post: <mailto:bug-gdb@gnu.org> List-Help: <mailto:bug-gdb-request@gnu.org?subject=help> List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-gdb>, <mailto:bug-gdb-request@gnu.org?subject=subscribe>