942cd23
Implement `b <funcname>' for <funcname> with concete inlined instances by
942cd23
a multiple-PC breakpoint.
942cd23
407ebe9
Index: gdb-6.8.50.20081128/gdb/ada-lang.c
407ebe9
===================================================================
407ebe9
--- gdb-6.8.50.20081128.orig/gdb/ada-lang.c	2008-11-25 00:21:15.000000000 +0100
407ebe9
+++ gdb-6.8.50.20081128/gdb/ada-lang.c	2008-12-06 21:39:56.000000000 +0100
407ebe9
@@ -4614,7 +4614,7 @@ remove_irrelevant_renamings (struct ada_
942cd23
   if (current_block == NULL)
942cd23
     return nsyms;
942cd23
 
942cd23
-  current_function = block_linkage_function (current_block);
942cd23
+  current_function = block_function (current_block);
942cd23
   if (current_function == NULL)
942cd23
     return nsyms;
942cd23
 
407ebe9
@@ -6625,7 +6625,7 @@ ada_find_renaming_symbol (const char *na
942cd23
 static struct symbol *
942cd23
 find_old_style_renaming_symbol (const char *name, struct block *block)
942cd23
 {
942cd23
-  const struct symbol *function_sym = block_linkage_function (block);
942cd23
+  const struct symbol *function_sym = block_function (block);
942cd23
   char *rename;
942cd23
 
942cd23
   if (function_sym != NULL)
407ebe9
Index: gdb-6.8.50.20081128/gdb/block.c
407ebe9
===================================================================
407ebe9
--- gdb-6.8.50.20081128.orig/gdb/block.c	2008-12-06 14:06:16.000000000 +0100
407ebe9
+++ gdb-6.8.50.20081128/gdb/block.c	2008-12-06 21:40:29.000000000 +0100
407ebe9
@@ -75,6 +75,19 @@ block_linkage_function (const struct blo
942cd23
   return BLOCK_FUNCTION (bl);
942cd23
 }
942cd23
 
942cd23
+/* Return the symbol for the function which contains a specified
942cd23
+   lexical block, described by a struct block BL.  Inlined functions
942cd23
+   can be returned.  */
942cd23
+
942cd23
+struct symbol *
942cd23
+block_function (const struct block *bl)
942cd23
+{
942cd23
+  while (BLOCK_FUNCTION (bl) == NULL && BLOCK_SUPERBLOCK (bl) != NULL)
942cd23
+    bl = BLOCK_SUPERBLOCK (bl);
942cd23
+
942cd23
+  return BLOCK_FUNCTION (bl);
942cd23
+}
942cd23
+
407ebe9
 /* Return one if BL represents an inlined function.  */
942cd23
 
942cd23
 int
407ebe9
Index: gdb-6.8.50.20081128/gdb/block.h
407ebe9
===================================================================
407ebe9
--- gdb-6.8.50.20081128.orig/gdb/block.h	2008-12-06 14:06:16.000000000 +0100
407ebe9
+++ gdb-6.8.50.20081128/gdb/block.h	2008-12-06 21:39:56.000000000 +0100
407ebe9
@@ -133,6 +133,7 @@ struct blockvector
942cd23
 enum { GLOBAL_BLOCK = 0, STATIC_BLOCK = 1, FIRST_LOCAL_BLOCK = 2 };
942cd23
 
942cd23
 extern struct symbol *block_linkage_function (const struct block *);
942cd23
+extern struct symbol *block_function (const struct block *bl);
942cd23
 
942cd23
 extern int block_inlined_p (const struct block *block);
942cd23
 
407ebe9
Index: gdb-6.8.50.20081128/gdb/blockframe.c
407ebe9
===================================================================
407ebe9
--- gdb-6.8.50.20081128.orig/gdb/blockframe.c	2008-12-06 14:06:16.000000000 +0100
407ebe9
+++ gdb-6.8.50.20081128/gdb/blockframe.c	2008-12-06 21:39:56.000000000 +0100
407ebe9
@@ -143,7 +143,7 @@ find_pc_sect_function (CORE_ADDR pc, str
942cd23
   struct block *b = block_for_pc_sect (pc, section);
942cd23
   if (b == 0)
942cd23
     return 0;
942cd23
-  return block_linkage_function (b);
942cd23
+  return block_function (b);
942cd23
 }
942cd23
 
942cd23
 /* Return the function containing pc value PC.
407ebe9
Index: gdb-6.8.50.20081128/gdb/breakpoint.c
407ebe9
===================================================================
407ebe9
--- gdb-6.8.50.20081128.orig/gdb/breakpoint.c	2008-12-06 14:06:17.000000000 +0100
407ebe9
+++ gdb-6.8.50.20081128/gdb/breakpoint.c	2008-12-06 21:39:56.000000000 +0100
407ebe9
@@ -5712,7 +5712,7 @@ resolve_sal_pc (struct symtab_and_line *
942cd23
       bv = blockvector_for_pc_sect (sal->pc, 0, &b, sal->symtab);
942cd23
       if (bv != NULL)
942cd23
 	{
942cd23
-	  sym = block_linkage_function (b);
942cd23
+	  sym = block_function (b);
942cd23
 	  if (sym != NULL)
942cd23
 	    {
942cd23
 	      fixup_symbol_section (sym, sal->symtab->objfile);
407ebe9
Index: gdb-6.8.50.20081128/gdb/testsuite/gdb.opt/inline-cmds.exp
407ebe9
===================================================================
407ebe9
--- gdb-6.8.50.20081128.orig/gdb/testsuite/gdb.opt/inline-cmds.exp	2008-12-06 21:37:27.000000000 +0100
407ebe9
+++ gdb-6.8.50.20081128/gdb/testsuite/gdb.opt/inline-cmds.exp	2008-12-06 21:41:37.000000000 +0100
407ebe9
@@ -45,8 +45,10 @@ if { [skip_inline_frame_tests] } {
942cd23
 
942cd23
 # First, check that the things we expected to be inlined really were,
942cd23
 # and those that shouldn't be weren't.
407ebe9
-set line1 [gdb_get_line_number "set breakpoint 1 here" ${srcfile2}]
407ebe9
-gdb_breakpoint $srcfile2:$line1
942cd23
+# We test also inlining by the function name, otherwise we would use:
407ebe9
+#   set line1 [gdb_get_line_number "set breakpoint 1 here" ${srcfile2}]
407ebe9
+#   gdb_breakpoint $srcfile2:$line1
942cd23
+gdb_breakpoint "bar"
407ebe9
 set line2 [gdb_get_line_number "set breakpoint 2 here" ${srcfile2}]
407ebe9
 gdb_breakpoint $srcfile2:$line2
942cd23