This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] handle nested functions in block.c:contained_in


Thanks for the explanation of the issues...

> contained_in must want something like:
> 
>   if (BLOCK_FUNCTION (a) != NULL && !block_inlined_p (a))
>     return 0;

This seemed right indeed, and here is a patch that implements it.
I also removed a variable that became unused.

I'll try to build a testcase shortly. I know that nested functions
in C are a GCC extension - but I was wondering if we might prefer it
over an Ada testcase for instance...

2009-08-28  Joel Brobecker  <brobecker@adacore.com>

        * block.c (contained_in): Return zero for nested functions.
        * blockframe.c (block_innermost_frame): Delete unreferenced local
        variable.

Tested on x86_64-linux.
OK to checkin?

Thanks,
-- 
Joel
commit 7dba76f0d9b0b09b267daec52efe08ccfbcc4ca5
Author: Joel Brobecker <brobecker@adacore.com>
Date:   Fri Aug 28 15:47:32 2009 -0400

        * block.c (contained_in): Return zero for nested functions.
        * blockframe.c (block_innermost_frame): Delete unreferenced local variable.

diff --git a/gdb/block.c b/gdb/block.c
index 1889ecd..97ea67a 100644
--- a/gdb/block.c
+++ b/gdb/block.c
@@ -52,6 +52,10 @@ contained_in (const struct block *a, const struct block *b)
     {
       if (a == b)
 	return 1;
+      /* If A is a function block, then A cannot be contained in B,
+         except if A was inlined.  */
+      if (BLOCK_FUNCTION (a) != NULL && !block_inlined_p (a))
+        return 0;
       a = BLOCK_SUPERBLOCK (a);
     }
   while (a != NULL);
diff --git a/gdb/blockframe.c b/gdb/blockframe.c
index 41a3502..0960837 100644
--- a/gdb/blockframe.c
+++ b/gdb/blockframe.c
@@ -363,7 +363,6 @@ block_innermost_frame (struct block *block)
   struct frame_info *frame;
   CORE_ADDR start;
   CORE_ADDR end;
-  CORE_ADDR calling_pc;
 
   if (block == NULL)
     return NULL;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]