This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] Don't mangle nested functions
- From: Daniel Jacobowitz <drow at false dot org>
- To: gdb-patches at sourceware dot org
- Date: Fri, 25 Aug 2006 12:43:32 -0400
- Subject: [commit] Don't mangle nested functions
I was working on a GCC debugging output bug this morning, in which
GCC didn't output information for a nested function. When testing the fix I
discovered GDB couldn't print the arguments for the nested function.
That's because we had a tree of blocks that looked like this:
GLOBAL_BLOCK
STATIC_BLOCK
outer_function
inner_function
This is how the debug information represents it, which is correct - it's
the lexical ordering. But the inner function is actually a function,
and is not part of the block range of the inner function. So when some
cleanup code truncated it to fit in the outer block, it no longer covered
any of the code of the nested function!
Restricting the over-eager cleanup to not modify function blocks fixed
the bug; tested on x86_64-pc-linux-gnu and committed. I may have to come
back to this code for my DW_AT_ranges patch...
--
Daniel Jacobowitz
CodeSourcery
2006-08-25 Daniel Jacobowitz <dan@codesourcery.com>
* buildsym.c (finish_block): Don't adjust the boundaries of
nested functions.
Index: buildsym.c
===================================================================
RCS file: /cvs/src/src/gdb/buildsym.c,v
retrieving revision 1.42
diff -u -p -r1.42 buildsym.c
--- buildsym.c 17 Dec 2005 22:33:59 -0000 1.42
+++ buildsym.c 25 Aug 2006 16:16:25 -0000
@@ -400,9 +400,14 @@ finish_block (struct symbol *symbol, str
#if 1
/* Check to be sure the blocks are nested as we receive
them. If the compiler/assembler/linker work, this just
- burns a small amount of time. */
- if (BLOCK_START (pblock->block) < BLOCK_START (block) ||
- BLOCK_END (pblock->block) > BLOCK_END (block))
+ burns a small amount of time.
+
+ Skip blocks which correspond to a function; they're not
+ physically nested inside this other blocks, only
+ lexically nested. */
+ if (BLOCK_FUNCTION (pblock->block) == NULL
+ && (BLOCK_START (pblock->block) < BLOCK_START (block)
+ || BLOCK_END (pblock->block) > BLOCK_END (block)))
{
if (symbol)
{