public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-tromey-ambiguous-linespec: use immediately-enclosing block, not linkage block, when uniquifying this should work better when one function is inlined multiple times into another function
@ 2011-08-01 14:43 tromey
  0 siblings, 0 replies; only message in thread
From: tromey @ 2011-08-01 14:43 UTC (permalink / raw)
  To: archer-commits

The branch, archer-tromey-ambiguous-linespec has been updated
       via  2b3ef167d511e1874e37fc6311b49014838713ec (commit)
       via  4a8903151014230999b83552b2fbd0223c7f2601 (commit)
      from  22222f4f6c22a5d4b2ed7336f7ecc2ef898a110e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 2b3ef167d511e1874e37fc6311b49014838713ec
Author: Tom Tromey <tromey@redhat.com>
Date:   Mon Aug 1 08:19:47 2011 -0600

    use immediately-enclosing block, not linkage block, when uniquifying
    this should work better when one function is inlined multiple times
    into another function

commit 4a8903151014230999b83552b2fbd0223c7f2601
Author: Tom Tromey <tromey@redhat.com>
Date:   Sat Jul 30 19:47:41 2011 -0600

    use blocks, not minimal symbols, when uniquifying

-----------------------------------------------------------------------

Summary of changes:
 gdb/block.c  |   14 ++++++++++++++
 gdb/block.h  |    2 ++
 gdb/symtab.c |   11 +++++++----
 3 files changed, 23 insertions(+), 4 deletions(-)

First 500 lines of diff:
diff --git a/gdb/block.c b/gdb/block.c
index 776ae53..7803c5f 100644
--- a/gdb/block.c
+++ b/gdb/block.c
@@ -80,6 +80,20 @@ block_linkage_function (const struct block *bl)
   return BLOCK_FUNCTION (bl);
 }
 
+/* Return the symbol for the function which contains a specified
+   block, described by a struct block BL.  The return value will be
+   the closest enclosing function, which might be an inline
+   function.  */
+
+struct symbol *
+block_containing_function (const struct block *bl)
+{
+  while (BLOCK_FUNCTION (bl) == NULL && BLOCK_SUPERBLOCK (bl) != NULL)
+    bl = BLOCK_SUPERBLOCK (bl);
+
+  return BLOCK_FUNCTION (bl);
+}
+
 /* Return one if BL represents an inlined function.  */
 
 int
diff --git a/gdb/block.h b/gdb/block.h
index 923013c..3e9d909 100644
--- a/gdb/block.h
+++ b/gdb/block.h
@@ -131,6 +131,8 @@ struct blockvector
 
 extern struct symbol *block_linkage_function (const struct block *);
 
+extern struct symbol *block_containing_function (const struct block *);
+
 extern int block_inlined_p (const struct block *block);
 
 extern int contained_in (const struct block *, const struct block *);
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 7681c7b..229a1d8 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -2325,7 +2325,7 @@ find_pcs_for_symtab_line (struct symtab *symtab, int line)
 {
   VEC (CORE_ADDR) *result = NULL;
   int start = 0, ix;
-  struct minimal_symbol *previous_function = NULL;
+  struct symbol *previous_function = NULL;
 
   /* First, collect all the PCs that are at this line.  */
   while (1)
@@ -2351,10 +2351,13 @@ find_pcs_for_symtab_line (struct symtab *symtab, int line)
      function should only appear a single time.  */
   for (ix = 0; ix < VEC_length (CORE_ADDR, result); )
     {
-      struct minimal_symbol *sym;
+      struct symbol *sym;
+      struct block *block;
+
+      block = block_for_pc (VEC_index (CORE_ADDR, result, ix));
+      sym = block ? block_containing_function (block) : NULL;
 
-      sym = lookup_minimal_symbol_by_pc (VEC_index (CORE_ADDR, result, ix));
-      if (sym == previous_function)
+      if (sym == NULL || sym == previous_function)
 	VEC_ordered_remove (CORE_ADDR, result, ix);
       else
 	{


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-08-01 14:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-01 14:43 [SCM] archer-tromey-ambiguous-linespec: use immediately-enclosing block, not linkage block, when uniquifying this should work better when one function is inlined multiple times into another function tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).