Re: [RFC]: patch 1 for Sun C compiled target programs

Mark Kettenis
2004-07-10T21:06:12Z

Date: Mon, 21 Jun 2004 15:09:19 +0200
From: Michael Mueller <m.mueller99@kay-mueller.de>

>
> I'll try to get this fixed before the 6.2 release. Thanks for giving
> me a bit more ammunition for getting this change accepted by the rest
> of the crowd.

Sounds promising. I filed PR gdb/1682 to remind you guys :-)

Can you test the attached patch for me? I don't have access to a
machine with a Sun compiler. This patch should fix your problems
while keeping the current behaviour with GCC.

Thanks,

Mark

Index: dbxread.c
===================================================================
RCS file: /cvs/src/src/gdb/dbxread.c,v
retrieving revision 1.69
diff -u -p -r1.69 dbxread.c
--- dbxread.c 1 Jul 2004 20:25:53 -0000 1.69
+++ dbxread.c 10 Jul 2004 20:58:09 -0000
@@ -2659,6 +2659,7 @@ process_one_symbol (int type, int desc,
/* This holds the address of the start of a function, without the system
peculiarities of function_start_offset. */
static CORE_ADDR last_function_start;
+ static int last_function_desc;

/* If this is nonzero, we've seen an N_SLINE since the start of the
current function. We use this to tell us to move the first sline
@@ -2736,6 +2737,7 @@ process_one_symbol (int type, int desc,
valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
valu = SMASH_TEXT_ADDRESS (valu);
last_function_start = valu;
+ last_function_desc = desc;

goto define_a_symbol;

@@ -2928,11 +2930,12 @@ process_one_symbol (int type, int desc,
/* Relocate for dynamic loading and for ELF acc fn-relative syms. */
valu += function_start_offset;

- /* If this is the first SLINE note in the function, record it at
- the start of the function instead of at the listed location. */
if (within_function && sline_found_in_function == 0)
{
- record_line (current_subfile, desc, last_function_start);
+ if (last_function_desc != 0)
+ record_line (current_subfile, desc, last_function_start);
+ else
+ record_line (current_subfile, desc, valu);
sline_found_in_function = 1;
}
else