81783d0
infcall.c <unwind_on_signal_p>:
81783d0
Revert the change of: gdb-6.8-inlining.patch
81783d0
causing: FAIL: gdb.base/unwindonsignal.exp: unwindonsignal, stack unwound
81783d0
81783d0
resume() -> target_resume() move of clear_inline_frame_state() is for:
81783d0
gdb.mi/mi-nsmoribund.exp
81783d0
8dadf56
Index: gdb-6.8.50.20090302/gdb/testsuite/gdb.opt/inline-bt.c
407ebe9
===================================================================
3ce5394
--- gdb-6.8.50.20090302.orig/gdb/testsuite/gdb.opt/inline-bt.c	2009-03-25 22:33:02.000000000 +0100
3ce5394
+++ gdb-6.8.50.20090302/gdb/testsuite/gdb.opt/inline-bt.c	2009-03-25 22:34:02.000000000 +0100
407ebe9
@@ -13,10 +13,16 @@
407ebe9
    You should have received a copy of the GNU General Public License
407ebe9
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
407ebe9
 
407ebe9
-int x, y;
407ebe9
+/* VOLATILE forces all the inlining to happen as otherwise the whole program
407ebe9
+   gets optimized by CSE to just simple assignments of the results.  */
407ebe9
+volatile int x, y;
407ebe9
 volatile int result;
407ebe9
 
407ebe9
-void bar(void);
407ebe9
+inline void bar(void)
407ebe9
+{
407ebe9
+  x += y; /* set breakpoint 1 here */
407ebe9
+}
407ebe9
+
407ebe9
 
407ebe9
 inline int func1(void)
407ebe9
 {
8dadf56
Index: gdb-6.8.50.20090302/gdb/testsuite/gdb.opt/inline-bt.exp
407ebe9
===================================================================
3ce5394
--- gdb-6.8.50.20090302.orig/gdb/testsuite/gdb.opt/inline-bt.exp	2009-03-25 22:33:02.000000000 +0100
3ce5394
+++ gdb-6.8.50.20090302/gdb/testsuite/gdb.opt/inline-bt.exp	2009-03-25 22:34:02.000000000 +0100
407ebe9
@@ -41,18 +41,19 @@ if { [skip_inline_frame_tests] } {
407ebe9
     return
407ebe9
 }
407ebe9
 
407ebe9
-set line1 [gdb_get_line_number "set breakpoint 1 here" ${fullsrcfile2}]
407ebe9
-gdb_breakpoint $srcfile2:$line1
407ebe9
+set line1 [gdb_get_line_number "set breakpoint 1 here" ${srcfile}]
407ebe9
+gdb_breakpoint $srcfile:$line1
407ebe9
 
407ebe9
 gdb_test "continue" ".*set breakpoint 1 here.*" "continue to bar (1)"
407ebe9
 gdb_test "backtrace" "#0  bar.*#1  .*main.*" "backtrace from bar (1)"
407ebe9
-gdb_test "info frame" ".*called by frame.*" "bar not inlined"
407ebe9
+gdb_test "info frame" ".*inlined into frame.*" "bar inlined"
407ebe9
 
407ebe9
-gdb_test "continue" ".*set breakpoint 1 here.*" "continue to bar (2)"
407ebe9
-gdb_test "backtrace" "#0  bar.*#1  .*func1.*#2  .*main.*" \
407ebe9
-    "backtrace from bar (2)"
407ebe9
-gdb_test "up" "#1  .*func1.*" "up from bar (2)"
407ebe9
-gdb_test "info frame" ".*inlined into frame.*" "func1 inlined (2)"
407ebe9
+# gcc-4.3.1 omits the line number information for (2).
407ebe9
+#gdb_test "continue" ".*set breakpoint 1 here.*" "continue to bar (2)"
407ebe9
+#gdb_test "backtrace" "#0  bar.*#1  .*func1.*#2  .*main.*" \
407ebe9
+#    "backtrace from bar (2)"
407ebe9
+#gdb_test "up" "#1  .*func1.*" "up from bar (2)"
407ebe9
+#gdb_test "info frame" ".*inlined into frame.*" "func1 inlined (2)"
407ebe9
 
407ebe9
 gdb_test "continue" ".*set breakpoint 1 here.*" "continue to bar (3)"
407ebe9
 gdb_test "backtrace" "#0  bar.*#1  .*func1.*#2  .*func2.*#3  .*main.*" \
8dadf56
Index: gdb-6.8.50.20090302/gdb/testsuite/gdb.opt/inline-cmds.c
407ebe9
===================================================================
3ce5394
--- gdb-6.8.50.20090302.orig/gdb/testsuite/gdb.opt/inline-cmds.c	2009-03-25 22:33:02.000000000 +0100
3ce5394
+++ gdb-6.8.50.20090302/gdb/testsuite/gdb.opt/inline-cmds.c	2009-03-25 22:34:02.000000000 +0100
407ebe9
@@ -13,13 +13,19 @@
407ebe9
    You should have received a copy of the GNU General Public License
407ebe9
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
407ebe9
 
407ebe9
-int x, y;
407ebe9
+/* VOLATILE forces all the inlining to happen as otherwise the whole program
407ebe9
+   gets optimized by CSE to just simple assignments of the results.  */
407ebe9
+volatile int x, y;
407ebe9
 volatile int result;
407ebe9
 
407ebe9
-void bar(void);
407ebe9
 void marker(void);
407ebe9
 void noinline(void);
407ebe9
 
407ebe9
+inline void bar(void)
407ebe9
+{
407ebe9
+  x += y; /* set breakpoint 1 here */
407ebe9
+}
407ebe9
+
407ebe9
 inline int func1(void)
407ebe9
 {
407ebe9
   bar ();
8dadf56
Index: gdb-6.8.50.20090302/gdb/testsuite/gdb.opt/inline-cmds.exp
407ebe9
===================================================================
3ce5394
--- gdb-6.8.50.20090302.orig/gdb/testsuite/gdb.opt/inline-cmds.exp	2009-03-25 22:33:02.000000000 +0100
3ce5394
+++ gdb-6.8.50.20090302/gdb/testsuite/gdb.opt/inline-cmds.exp	2009-03-25 22:34:02.000000000 +0100
ec0fcb6
@@ -45,28 +45,28 @@ if { [skip_inline_frame_tests] } {
407ebe9
 
407ebe9
 # First, check that the things we expected to be inlined really were,
407ebe9
 # and those that shouldn't be weren't.
407ebe9
-set line1 [gdb_get_line_number "set breakpoint 1 here" ${fullsrcfile2}]
407ebe9
+set line1 [gdb_get_line_number "set breakpoint 1 here" ${srcfile2}]
407ebe9
 gdb_breakpoint $srcfile2:$line1
407ebe9
-set line2 [gdb_get_line_number "set breakpoint 2 here" ${fullsrcfile2}]
407ebe9
+set line2 [gdb_get_line_number "set breakpoint 2 here" ${srcfile2}]
407ebe9
 gdb_breakpoint $srcfile2:$line2
407ebe9
 
ec0fcb6
-gdb_test "continue" ".*set breakpoint 1 here.*" "continue to bar (1)"
ec0fcb6
+gdb_test "continue" "set breakpoint 1 here.*" "continue to bar (1)"
ec0fcb6
 gdb_test "backtrace" "#0  bar.*#1  .*func1.*#2  .*main.*" \
ec0fcb6
     "backtrace from bar (1)"
ec0fcb6
 gdb_test "up" "#1  .*func1.*" "up from bar (1)"
ec0fcb6
-gdb_test "info frame" ".*inlined into frame.*" "func1 inlined (1)"
ec0fcb6
+gdb_test "info frame" "inlined into frame.*" "func1 inlined (1)"
ec0fcb6
 
ec0fcb6
-gdb_test "continue" ".*set breakpoint 1 here.*" "continue to bar (2)"
ec0fcb6
+gdb_test "continue" "set breakpoint 1 here.*" "continue to bar (2)"
ec0fcb6
 gdb_test "backtrace" "#0  bar.*#1  .*func1.*#2  .*func2.*#3  .*main.*" \
ec0fcb6
     "backtrace from bar (2)"
ec0fcb6
 gdb_test "up" "#1  .*func1.*" "up from bar (2)"
ec0fcb6
-gdb_test "info frame" ".*inlined into frame.*" "func1 inlined (2)"
ec0fcb6
+gdb_test "info frame" "inlined into frame.*" "func1 inlined (2)"
ec0fcb6
 gdb_test "up" "#2  .*func2.*" "up from func1 (2)"
ec0fcb6
-gdb_test "info frame" ".*inlined into frame.*" "func2 inlined (2)"
ec0fcb6
+gdb_test "info frame" "inlined into frame.*" "func2 inlined (2)"
407ebe9
 
ec0fcb6
-gdb_test "continue" ".*set breakpoint 2 here.*" "continue to marker"
ec0fcb6
+gdb_test "continue" "set breakpoint 2 here.*" "continue to marker"
407ebe9
 gdb_test "backtrace" "#0  marker.*#1  .*main.*" "backtrace from marker"
407ebe9
-gdb_test "info frame" ".*called by frame.*" "marker not inlined"
ec0fcb6
+gdb_test "info frame" "\n called by frame.*" "marker not inlined"
407ebe9
 
407ebe9
 # Next, check that we can next over inlined functions.  We should not end up
407ebe9
 # inside any of them.
ec0fcb6
@@ -201,7 +201,7 @@ set line3 [gdb_get_line_number "set brea
ec0fcb6
 gdb_breakpoint $line3
ec0fcb6
 gdb_continue_to_breakpoint "consecutive func1"
ec0fcb6
 
ec0fcb6
-gdb_test "next" ".*func1 .*first call.*" "next to first func1"
ec0fcb6
+gdb_test "next" "func1 .*first call.*" "next to first func1"
ec0fcb6
 set msg "next to second func1"
ec0fcb6
 gdb_test_multiple "next" $msg {
ec0fcb6
     -re ".*func1 .*second call.*$gdb_prompt $" {
ec0fcb6
@@ -224,16 +224,16 @@ set line4 [gdb_get_line_number "set brea
ec0fcb6
 gdb_breakpoint $line4
ec0fcb6
 gdb_continue_to_breakpoint "func1 then func3"
ec0fcb6
 
ec0fcb6
-gdb_test "next" ".*func1 \\\(\\\);" "next to func1 before func3"
ec0fcb6
-gdb_test "next" ".*func3 \\\(\\\);" "next to func3"
ec0fcb6
+gdb_test "next" "func1 \\\(\\\);" "next to func1 before func3"
ec0fcb6
+gdb_test "next" "func3 \\\(\\\);" "next to func3"
ec0fcb6
 
ec0fcb6
 # Test finishing out of one thing and into another.
ec0fcb6
 set line5 [gdb_get_line_number "set breakpoint 5 here"]
ec0fcb6
 gdb_breakpoint $line5
ec0fcb6
 gdb_continue_to_breakpoint "finish into func1"
ec0fcb6
 
ec0fcb6
-gdb_test "next" ".*marker \\\(\\\);" "next to finish marker"
ec0fcb6
-gdb_test "step" ".*set breakpoint 2 here.*" "step into finish marker"
ec0fcb6
+gdb_test "next" "marker \\\(\\\);" "next to finish marker"
ec0fcb6
+gdb_test "step" "set breakpoint 2 here.*" "step into finish marker"
ec0fcb6
 gdb_test "finish" "func1 \\\(\\\);" "finish from marker to func1"
ec0fcb6
 
ec0fcb6
 gdb_test "step" "bar \\\(\\\);" "step into func1 for finish"
ec0fcb6
@@ -268,12 +268,12 @@ gdb_test "step" "noinline \\\(\\\) at .*
ec0fcb6
 gdb_test "bt" "#0  noinline.*#1  .*outer_inline1.*#2  .*outer_inline2.*#3  main.*" "backtrace at noinline from outer_inline1"
ec0fcb6
 gdb_test "step" "inlined_fn \\\(\\\) at .*" "enter inlined_fn from noinline"
ec0fcb6
 gdb_test "bt" "#0  inlined_fn.*#1  noinline.*#2  .*outer_inline1.*#3  .*outer_inline2.*#4  main.*" "backtrace at inlined_fn from noinline"
ec0fcb6
-gdb_test "info frame" ".*inlined into frame.*" "inlined_fn from noinline inlined"
ec0fcb6
-gdb_test "up" "#1  noinline.*" "up to noinline"
ec0fcb6
-gdb_test "info frame" ".*\n called by frame.*" "noinline from outer_inline1 not inlined"
ec0fcb6
-gdb_test "up" "#2  .*outer_inline1.*" "up to outer_inline1"
ec0fcb6
-gdb_test "info frame" ".*inlined into frame.*" "outer_inline1 inlined"
ec0fcb6
-gdb_test "up" "#3  .*outer_inline2.*" "up to outer_inline2"
ec0fcb6
-gdb_test "info frame" ".*inlined into frame.*" "outer_inline2 inlined"
ec0fcb6
-gdb_test "up" "#4  main.*" "up from outer_inline2"
ec0fcb6
-gdb_test "info frame" ".*\n caller of frame.*" "main not inlined"
ec0fcb6
+gdb_test "info frame" "inlined into frame.*" "inlined_fn from noinline inlined"
ec0fcb6
+gdb_test "fini" "" "up to noinline"
ec0fcb6
+gdb_test "info frame" "\n called by frame.*" "noinline from outer_inline1 not inlined"
ec0fcb6
+gdb_test "fini" "" "up to outer_inline1"
ec0fcb6
+gdb_test "info frame" "inlined into frame.*" "outer_inline1 inlined"
ec0fcb6
+gdb_test "fini" "" "up to outer_inline2"
ec0fcb6
+gdb_test "info frame" "inlined into frame.*" "outer_inline2 inlined"
ec0fcb6
+gdb_test "fini" "" "up from outer_inline2"
ec0fcb6
+gdb_test "info frame" " in main \[^\n\]*\n source language.*" "main not inlined"
8dadf56
Index: gdb-6.8.50.20090302/gdb/testsuite/gdb.opt/inline-locals.c
407ebe9
===================================================================
3ce5394
--- gdb-6.8.50.20090302.orig/gdb/testsuite/gdb.opt/inline-locals.c	2009-03-25 22:33:02.000000000 +0100
3ce5394
+++ gdb-6.8.50.20090302/gdb/testsuite/gdb.opt/inline-locals.c	2009-03-25 22:34:02.000000000 +0100
407ebe9
@@ -13,11 +13,16 @@
407ebe9
    You should have received a copy of the GNU General Public License
407ebe9
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
407ebe9
 
407ebe9
-int x, y;
407ebe9
+/* VOLATILE forces all the inlining to happen as otherwise the whole program
407ebe9
+   gets optimized by CSE to just simple assignments of the results.  */
407ebe9
+volatile int x, y;
407ebe9
 volatile int result;
407ebe9
 volatile int *array_p;
407ebe9
 
407ebe9
-void bar(void);
407ebe9
+inline void bar(void)
407ebe9
+{
407ebe9
+  x += y; /* set breakpoint 1 here */
407ebe9
+}
407ebe9
 
407ebe9
 inline int func1(int arg1)
407ebe9
 {
8dadf56
Index: gdb-6.8.50.20090302/gdb/testsuite/gdb.opt/inline-locals.exp
407ebe9
===================================================================
3ce5394
--- gdb-6.8.50.20090302.orig/gdb/testsuite/gdb.opt/inline-locals.exp	2009-03-25 22:33:02.000000000 +0100
3ce5394
+++ gdb-6.8.50.20090302/gdb/testsuite/gdb.opt/inline-locals.exp	2009-03-25 22:34:02.000000000 +0100
407ebe9
@@ -43,8 +43,8 @@ if { [skip_inline_var_tests] } {
407ebe9
 
407ebe9
 set no_frames [skip_inline_frame_tests]
407ebe9
 
407ebe9
-set line1 [gdb_get_line_number "set breakpoint 1 here" ${fullsrcfile2}]
407ebe9
-gdb_breakpoint $srcfile2:$line1
407ebe9
+set line1 [gdb_get_line_number "set breakpoint 1 here" ${srcfile}]
407ebe9
+gdb_breakpoint $srcfile:$line1
407ebe9
 
407ebe9
 gdb_test "continue" ".*set breakpoint 1 here.*" "continue to bar (1)"
407ebe9
 
407ebe9
@@ -77,6 +77,9 @@ if { ! $no_frames } {
407ebe9
 
407ebe9
 # Make sure that locals on the stack are found.  This is an array to
407ebe9
 # prevent it from living in a register.
407ebe9
+if [test_compiler_info "gcc-4-3-*"] {
407ebe9
+    setup_kfail *-*-* "gcc/debug.optimization"
407ebe9
+}
407ebe9
 gdb_test "print array\[0\]" "\\\$$decimal = 0" "print local (2)"
407ebe9
 
407ebe9
 if { ! $no_frames } {
407ebe9
@@ -115,4 +118,7 @@ if { ! $no_frames } {
407ebe9
     gdb_test "info locals" ".*arg2 = 184.*" "info locals above bar (3b)"
407ebe9
 }
407ebe9
 
407ebe9
+if [test_compiler_info "gcc-4-3-*"] {
407ebe9
+    setup_kfail *-*-* "gcc/debug.optimization"
407ebe9
+}
407ebe9
 gdb_test "print array\[0\]" "\\\$$decimal = 184" "print local (3)"
8dadf56
Index: gdb-6.8.50.20090302/gdb/frame.c
407ebe9
===================================================================
3ce5394
--- gdb-6.8.50.20090302.orig/gdb/frame.c	2009-03-25 22:33:02.000000000 +0100
3ce5394
+++ gdb-6.8.50.20090302/gdb/frame.c	2009-03-25 22:34:02.000000000 +0100
407ebe9
@@ -269,7 +269,7 @@ fprint_frame (struct ui_file *file, stru
407ebe9
 static struct frame_info *
407ebe9
 skip_inlined_frames (struct frame_info *frame)
407ebe9
 {
407ebe9
-  while (get_frame_type (frame) == INLINE_FRAME)
407ebe9
+  while (frame && get_frame_type (frame) == INLINE_FRAME)
407ebe9
     frame = get_prev_frame (frame);
407ebe9
 
407ebe9
   return frame;
1592379
@@ -1670,6 +1670,7 @@ get_frame_address_in_block (struct frame
ec0fcb6
 {
ec0fcb6
   /* A draft address.  */
ec0fcb6
   CORE_ADDR pc = get_frame_pc (this_frame);
ec0fcb6
+  struct thread_info *tp = inferior_thread ();
ec0fcb6
 
ec0fcb6
   struct frame_info *next_frame = this_frame->next;
ec0fcb6
 
1592379
@@ -1712,6 +1713,9 @@ get_frame_address_in_block (struct frame
ec0fcb6
      while in an inlined function, then the code address of the
ec0fcb6
      "calling" normal function should not be adjusted either.  */
ec0fcb6
 
ec0fcb6
+  if (tp->current_pc_is_notcurrent)
ec0fcb6
+    return pc - 1;
ec0fcb6
+
ec0fcb6
   while (get_frame_type (next_frame) == INLINE_FRAME)
ec0fcb6
     next_frame = next_frame->next;
ec0fcb6
 
1592379
@@ -1743,7 +1747,7 @@ find_frame_sal (struct frame_info *frame
ec0fcb6
 	sym = inline_skipped_symbol (inferior_ptid);
ec0fcb6
 
ec0fcb6
       init_sal (sal);
ec0fcb6
-      if (SYMBOL_LINE (sym) != 0)
ec0fcb6
+      if (sym != NULL && SYMBOL_LINE (sym) != 0)
ec0fcb6
 	{
ec0fcb6
 	  sal->symtab = SYMBOL_SYMTAB (sym);
ec0fcb6
 	  sal->line = SYMBOL_LINE (sym);
8dadf56
Index: gdb-6.8.50.20090302/gdb/breakpoint.c
407ebe9
===================================================================
3ce5394
--- gdb-6.8.50.20090302.orig/gdb/breakpoint.c	2009-03-25 22:33:02.000000000 +0100
3ce5394
+++ gdb-6.8.50.20090302/gdb/breakpoint.c	2009-03-25 22:34:02.000000000 +0100
407ebe9
@@ -57,6 +57,7 @@
407ebe9
 #include "top.h"
407ebe9
 #include "wrapper.h"
407ebe9
 #include "valprint.h"
407ebe9
+#include "inline-frame.h"
407ebe9
 
407ebe9
 #include "mi/mi-common.h"
407ebe9
 
1592379
@@ -2902,10 +2903,24 @@ bpstat_check_breakpoint_conditions (bpst
ec0fcb6
   const struct bp_location *bl = bs->breakpoint_at;
ec0fcb6
   struct breakpoint *b = bl->owner;
ec0fcb6
 
ec0fcb6
-  if (frame_id_p (b->frame_id)
ec0fcb6
-      && !frame_id_eq (b->frame_id, get_stack_frame_id (get_current_frame ())))
ec0fcb6
-    bs->stop = 0;
ec0fcb6
-  else if (bs->stop)
ec0fcb6
+  if (frame_id_p (b->frame_id))
ec0fcb6
+    {
ec0fcb6
+      struct frame_info *b_frame, *frame;
ec0fcb6
+      struct frame_id b_frame_id, current_frame_id;
ec0fcb6
+
ec0fcb6
+      b_frame = frame_find_by_id (b->frame_id);
ec0fcb6
+
ec0fcb6
+      /* get_stack_frame_id normalizes the id to the real non-inlined function
ec0fcb6
+	 by skip_inlined_frames.  */
ec0fcb6
+      b_frame_id = get_stack_frame_id (b_frame);
ec0fcb6
+      current_frame_id = get_stack_frame_id (get_current_frame ());
ec0fcb6
+
ec0fcb6
+      /* Completely different (inlining notwithstanding) frames?  */
ec0fcb6
+      if (!frame_id_eq (b_frame_id, current_frame_id))
ec0fcb6
+	bs->stop = 0;
ec0fcb6
+    }
ec0fcb6
+
ec0fcb6
+  if (bs->stop)
ec0fcb6
     {
ec0fcb6
       int value_is_zero = 0;
ec0fcb6
       
1592379
@@ -3044,6 +3059,12 @@ bpstat_stop_status (CORE_ADDR bp_addr, p
407ebe9
 	    bs->print = 0;
407ebe9
 	  }
407ebe9
 	bs->commands = copy_command_lines (bs->commands);
407ebe9
+
407ebe9
+	/* Display the innermost inlined frame at a breakpont as it gives to
407ebe9
+	   most of the available information.  */
407ebe9
+	if (b->type != bp_until && b->type != bp_finish)
407ebe9
+	  while (inline_skipped_frames (ptid))
407ebe9
+	    step_into_inline_frame (ptid);
407ebe9
       }
407ebe9
 
407ebe9
     /* Print nothing for this entry if we dont stop or if we dont print.  */
3ce5394
@@ -5169,9 +5190,9 @@ set_momentary_breakpoint (struct symtab_
ec0fcb6
 {
ec0fcb6
   struct breakpoint *b;
ec0fcb6
 
ec0fcb6
-  /* If FRAME_ID is valid, it should be a real frame, not an inlined
ec0fcb6
-     one.  */
ec0fcb6
-  gdb_assert (!frame_id_inlined_p (frame_id));
ec0fcb6
+  /* We can be returning even into an inline frame.  While finish_command will
ec0fcb6
+     shortcut the case of returning _from_ an inline frame we still may be
ec0fcb6
+     returning from non-inlined frame _to_ an inlined frame.  */
ec0fcb6
 
ec0fcb6
   b = set_raw_breakpoint (sal, type);
ec0fcb6
   b->enable_state = bp_enabled;
8dadf56
Index: gdb-6.8.50.20090302/gdb/inline-frame.c
407ebe9
===================================================================
3ce5394
--- gdb-6.8.50.20090302.orig/gdb/inline-frame.c	2009-03-25 22:33:02.000000000 +0100
3ce5394
+++ gdb-6.8.50.20090302/gdb/inline-frame.c	2009-03-25 22:34:02.000000000 +0100
407ebe9
@@ -183,6 +183,12 @@ inline_frame_sniffer (const struct frame
407ebe9
   if (frame_block == NULL)
407ebe9
     return 0;
407ebe9
 
407ebe9
+  /* For >=2 inlined functions SKIPPED_SYMBOL needs to be different after each
407ebe9
+     step_into_inline_frame call.  But skip_inline_frames is called only once
407ebe9
+     and thus SKIPPED_SYMBOL needs to be calculated by INLINE_FRAME_SNIFFER.  */
407ebe9
+  if (state)
407ebe9
+    state->skipped_symbol = NULL;
407ebe9
+
407ebe9
   /* Calculate DEPTH, the number of inlined functions at this
407ebe9
      location.  */
407ebe9
   depth = 0;
407ebe9
@@ -192,6 +198,10 @@ inline_frame_sniffer (const struct frame
407ebe9
       if (block_inlined_p (cur_block))
407ebe9
 	depth++;
407ebe9
 
407ebe9
+      if (state && depth == state->skipped_frames
407ebe9
+	  && state->skipped_symbol == NULL)
407ebe9
+	state->skipped_symbol = BLOCK_FUNCTION (cur_block);
407ebe9
+
407ebe9
       cur_block = BLOCK_SUPERBLOCK (cur_block);
407ebe9
     }
407ebe9
 
407ebe9
@@ -275,7 +285,6 @@ skip_inline_frames (ptid_t ptid)
407ebe9
 {
407ebe9
   CORE_ADDR this_pc;
407ebe9
   struct block *frame_block, *cur_block;
407ebe9
-  struct symbol *last_sym = NULL;
407ebe9
   int skip_count = 0;
407ebe9
   struct inline_state *state;
407ebe9
 
407ebe9
@@ -296,10 +305,7 @@ skip_inline_frames (ptid_t ptid)
407ebe9
 		 of BLOCK_START.  */
407ebe9
 	      if (BLOCK_START (cur_block) == this_pc
407ebe9
 		  || block_starting_point_at (this_pc, cur_block))
407ebe9
-		{
407ebe9
-		  skip_count++;
407ebe9
-		  last_sym = BLOCK_FUNCTION (cur_block);
407ebe9
-		}
407ebe9
+		skip_count++;
407ebe9
 	      else
407ebe9
 		break;
407ebe9
 	    }
407ebe9
@@ -311,7 +317,6 @@ skip_inline_frames (ptid_t ptid)
407ebe9
   state = allocate_inline_frame_state (ptid);
407ebe9
   state->skipped_frames = skip_count;
407ebe9
   state->saved_pc = this_pc;
407ebe9
-  state->skipped_symbol = last_sym;
407ebe9
 
407ebe9
   if (skip_count != 0)
407ebe9
     reinit_frame_cache ();
ec0fcb6
@@ -329,6 +334,23 @@ step_into_inline_frame (ptid_t ptid)
ec0fcb6
   reinit_frame_cache ();
ec0fcb6
 }
ec0fcb6
 
ec0fcb6
+/* Step out of an inlined function by hiding it.  */
ec0fcb6
+
ec0fcb6
+void
ec0fcb6
+step_out_of_inline_frame (ptid_t ptid)
ec0fcb6
+{
ec0fcb6
+  struct inline_state *state = find_inline_frame_state (ptid);
ec0fcb6
+
ec0fcb6
+  gdb_assert (state != NULL);
ec0fcb6
+
ec0fcb6
+  /* Simulate the caller adjustment.  */
ec0fcb6
+  if (state->skipped_frames == 0)
ec0fcb6
+    state->saved_pc--;
ec0fcb6
+
ec0fcb6
+  state->skipped_frames++;
ec0fcb6
+  reinit_frame_cache ();
ec0fcb6
+}
ec0fcb6
+
ec0fcb6
 /* Return the number of hidden functions inlined into the current
ec0fcb6
    frame.  */
ec0fcb6
 
8dadf56
Index: gdb-6.8.50.20090302/gdb/testsuite/gdb.opt/inline-markers.c
407ebe9
===================================================================
3ce5394
--- gdb-6.8.50.20090302.orig/gdb/testsuite/gdb.opt/inline-markers.c	2009-03-25 22:33:02.000000000 +0100
3ce5394
+++ gdb-6.8.50.20090302/gdb/testsuite/gdb.opt/inline-markers.c	2009-03-25 22:34:02.000000000 +0100
407ebe9
@@ -15,11 +15,6 @@
407ebe9
 
407ebe9
 extern int x, y;
407ebe9
 
407ebe9
-void bar(void)
407ebe9
-{
407ebe9
-  x += y; /* set breakpoint 1 here */
407ebe9
-}
407ebe9
-
407ebe9
 void marker(void)
407ebe9
 {
407ebe9
   x += y; /* set breakpoint 2 here */
8dadf56
Index: gdb-6.8.50.20090302/gdb/gdbthread.h
ec0fcb6
===================================================================
3ce5394
--- gdb-6.8.50.20090302.orig/gdb/gdbthread.h	2009-03-25 22:33:02.000000000 +0100
3ce5394
+++ gdb-6.8.50.20090302/gdb/gdbthread.h	2009-03-25 22:34:02.000000000 +0100
ec0fcb6
@@ -180,6 +180,12 @@ struct thread_info
ec0fcb6
 
ec0fcb6
   /* Private data used by the target vector implementation.  */
ec0fcb6
   struct private_thread_info *private;
ec0fcb6
+
ec0fcb6
+  /* Nonzero if the current frame PC should be unwound as the caller.  It is
ec0fcb6
+     used to keep the backtrace upper levels existing after finish_command into
ec0fcb6
+     an inlined frame if the current inlined function/block was ending at the
ec0fcb6
+     current PC.  */
ec0fcb6
+  int current_pc_is_notcurrent;
ec0fcb6
 };
ec0fcb6
 
ec0fcb6
 /* Create an empty thread list, or empty the existing one.  */
8dadf56
Index: gdb-6.8.50.20090302/gdb/infcmd.c
ec0fcb6
===================================================================
3ce5394
--- gdb-6.8.50.20090302.orig/gdb/infcmd.c	2009-03-25 22:33:02.000000000 +0100
3ce5394
+++ gdb-6.8.50.20090302/gdb/infcmd.c	2009-03-25 22:34:02.000000000 +0100
1592379
@@ -1391,11 +1391,11 @@ finish_command_continuation (void *arg)
ec0fcb6
       struct type *value_type;
ec0fcb6
 
ec0fcb6
       value_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (a->function));
ec0fcb6
-      if (!value_type)
ec0fcb6
+      if (!SYMBOL_INLINED (a->function) && !value_type)
ec0fcb6
 	internal_error (__FILE__, __LINE__,
ec0fcb6
 			_("finish_command: function has no target type"));
ec0fcb6
 
ec0fcb6
-      if (TYPE_CODE (value_type) != TYPE_CODE_VOID)
ec0fcb6
+      if (value_type && TYPE_CODE (value_type) != TYPE_CODE_VOID)
ec0fcb6
 	print_return_value (SYMBOL_TYPE (a->function), value_type);
ec0fcb6
     }
ec0fcb6
 
1592379
@@ -1499,6 +1499,16 @@ finish_forward (struct symbol *function,
ec0fcb6
 
ec0fcb6
   old_chain = make_cleanup_delete_breakpoint (breakpoint);
ec0fcb6
 
ec0fcb6
+  /* We should _always_ set CURRENT_PC_IS_NOTCURRENT here to always see the
ec0fcb6
+     calling line with the message `Value returned is ...'.  Currently it is
ec0fcb6
+     seen only if at least one instruction is on that source line after the
ec0fcb6
+     call instruction.  We would also need to hook step_once and only clear
ec0fcb6
+     CURRENT_PC_IS_NOTCURRENT on the first step.  But it would be a change of
ec0fcb6
+     general non-inlining behavior against upstream.  */
ec0fcb6
+
ec0fcb6
+  if (get_frame_type (frame) == INLINE_FRAME)
ec0fcb6
+    tp->current_pc_is_notcurrent = 1;
ec0fcb6
+
ec0fcb6
   tp->proceed_to_finish = 1;    /* We want stop_registers, please...  */
ec0fcb6
   make_cleanup_restore_integer (&suppress_stop_observer);
ec0fcb6
   suppress_stop_observer = 1;
1592379
@@ -1522,7 +1532,9 @@ finish_forward (struct symbol *function,
ec0fcb6
 static void
ec0fcb6
 finish_command (char *arg, int from_tty)
ec0fcb6
 {
ec0fcb6
-  struct frame_info *frame;
ec0fcb6
+  /* FIXME: Rename `current_frame' to `frame' upon a merge.  */
ec0fcb6
+  struct frame_info *current_frame, *prev_frame;
ec0fcb6
+  CORE_ADDR frame_pc;
ec0fcb6
   struct symbol *function;
ec0fcb6
 
ec0fcb6
   int async_exec = 0;
1592379
@@ -1553,46 +1565,63 @@ finish_command (char *arg, int from_tty)
ec0fcb6
   if (!target_has_execution)
ec0fcb6
     error (_("The program is not running."));
ec0fcb6
 
ec0fcb6
-  frame = get_prev_frame (get_selected_frame (_("No selected frame.")));
ec0fcb6
-  if (frame == 0)
ec0fcb6
+  current_frame = get_selected_frame (_("No selected frame."));
ec0fcb6
+  frame_pc = get_frame_pc (current_frame);
ec0fcb6
+  prev_frame = get_prev_frame (current_frame);
ec0fcb6
+  if (prev_frame == 0)
ec0fcb6
     error (_("\"finish\" not meaningful in the outermost frame."));
ec0fcb6
 
ec0fcb6
-  clear_proceed_status ();
ec0fcb6
-
ec0fcb6
   /* Finishing from an inline frame is completely different.  We don't
ec0fcb6
      try to show the "return value" - no way to locate it.  So we do
ec0fcb6
      not need a completion.  */
ec0fcb6
-  if (get_frame_type (get_selected_frame (_("No selected frame.")))
ec0fcb6
-      == INLINE_FRAME)
ec0fcb6
+  if (get_frame_type (current_frame) == INLINE_FRAME)
ec0fcb6
     {
ec0fcb6
       struct thread_info *tp = inferior_thread ();
ec0fcb6
-
ec0fcb6
-      /* Claim we are stepping in the calling frame.  An empty step
ec0fcb6
-	 range means that we will stop once we aren't in a function
ec0fcb6
-	 called by that frame.  We don't use the magic "1" value for
ec0fcb6
-	 step_range_end, because then infrun will think this is nexti,
ec0fcb6
-	 and not step over the rest of this inlined function call.  */
ec0fcb6
       struct symtab_and_line empty_sal;
ec0fcb6
-      init_sal (&empty_sal);
ec0fcb6
-      set_step_info (tp, frame, empty_sal);
ec0fcb6
-      tp->step_range_start = tp->step_range_end = get_frame_pc (frame);
ec0fcb6
-      tp->step_over_calls = STEP_OVER_ALL;
ec0fcb6
+      struct block *frame_block;
ec0fcb6
 
ec0fcb6
       /* Print info on the selected frame, including level number but not
ec0fcb6
 	 source.  */
ec0fcb6
       if (from_tty)
ec0fcb6
 	{
ec0fcb6
 	  printf_filtered (_("Run till exit from "));
ec0fcb6
-	  print_stack_frame (get_selected_frame (NULL), 1, LOCATION);
ec0fcb6
+	  print_stack_frame (current_frame, 1, LOCATION);
ec0fcb6
 	}
ec0fcb6
 
ec0fcb6
+      /* Even just a single stepi would get us out of the caller function PC
ec0fcb6
+	 range.  */
ec0fcb6
+
ec0fcb6
+      frame_block = get_frame_block (current_frame, NULL);
ec0fcb6
+
ec0fcb6
+      /* FRAME_BLOCK must be initialized and also the frame printing above must
ec0fcb6
+         be done still with the original CURRENT_PC_IS_NOTCURRENT setting.  */
ec0fcb6
+      clear_proceed_status ();
ec0fcb6
+
ec0fcb6
+      if (frame_block && BLOCK_END (frame_block) == frame_pc)
ec0fcb6
+	{
ec0fcb6
+	  step_out_of_inline_frame (tp->ptid);
ec0fcb6
+	  tp->current_pc_is_notcurrent = 1;
ec0fcb6
+	  normal_stop ();
ec0fcb6
+	  return;
ec0fcb6
+	}
ec0fcb6
+
ec0fcb6
+      /* Claim we are stepping in the calling frame.  An empty step
ec0fcb6
+	 range means that we will stop once we aren't in a function
ec0fcb6
+	 called by that frame.  We don't use the magic "1" value for
ec0fcb6
+	 step_range_end, because then infrun will think this is nexti,
ec0fcb6
+	 and not step over the rest of this inlined function call.  */
ec0fcb6
+      init_sal (&empty_sal);
ec0fcb6
+      set_step_info (tp, prev_frame, empty_sal);
ec0fcb6
+      tp->step_range_start = tp->step_range_end = get_frame_pc (prev_frame);
ec0fcb6
+      tp->step_over_calls = STEP_OVER_ALL;
ec0fcb6
+
ec0fcb6
       proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
ec0fcb6
       return;
ec0fcb6
     }
ec0fcb6
 
ec0fcb6
   /* Find the function we will return from.  */
ec0fcb6
 
ec0fcb6
-  function = find_pc_function (get_frame_pc (get_selected_frame (NULL)));
ec0fcb6
+  function = find_pc_function (frame_pc);
ec0fcb6
 
ec0fcb6
   /* Print info on the selected frame, including level number but not
ec0fcb6
      source.  */
1592379
@@ -1606,10 +1635,14 @@ finish_command (char *arg, int from_tty)
ec0fcb6
       print_stack_frame (get_selected_frame (NULL), 1, LOCATION);
ec0fcb6
     }
ec0fcb6
 
ec0fcb6
+  /* Frames printing above must be done still with the original
ec0fcb6
+     CURRENT_PC_IS_NOTCURRENT setting.  */
ec0fcb6
+  clear_proceed_status ();
ec0fcb6
+
ec0fcb6
   if (execution_direction == EXEC_REVERSE)
ec0fcb6
     finish_backward (function);
ec0fcb6
   else
ec0fcb6
-    finish_forward (function, frame);
ec0fcb6
+    finish_forward (function, prev_frame);
ec0fcb6
 }
ec0fcb6
 
ec0fcb6
 
8dadf56
Index: gdb-6.8.50.20090302/gdb/infrun.c
ec0fcb6
===================================================================
3ce5394
--- gdb-6.8.50.20090302.orig/gdb/infrun.c	2009-03-25 22:33:02.000000000 +0100
3ce5394
+++ gdb-6.8.50.20090302/gdb/infrun.c	2009-03-25 22:34:02.000000000 +0100
1592379
@@ -1152,8 +1152,6 @@ a command like `return' or `jump' to con
81783d0
 	    step = 0;
81783d0
 	}
81783d0
 
81783d0
-      clear_inline_frame_state (resume_ptid);
81783d0
-
81783d0
       if (debug_displaced
81783d0
           && use_displaced_stepping (gdbarch)
81783d0
           && tp->trap_expected)
1592379
@@ -1205,6 +1203,8 @@ clear_proceed_status_thread (struct thre
ec0fcb6
 
ec0fcb6
   /* Discard any remaining commands or status from previous stop.  */
ec0fcb6
   bpstat_clear (&tp->stop_bpstat);
ec0fcb6
+
ec0fcb6
+  tp->current_pc_is_notcurrent = 0;
ec0fcb6
 }
ec0fcb6
 
ec0fcb6
 static int
8dadf56
Index: gdb-6.8.50.20090302/gdb/target.c
1592379
===================================================================
3ce5394
--- gdb-6.8.50.20090302.orig/gdb/target.c	2009-03-25 22:26:51.000000000 +0100
3ce5394
+++ gdb-6.8.50.20090302/gdb/target.c	2009-03-25 22:34:02.000000000 +0100
81783d0
@@ -41,6 +41,7 @@
81783d0
 #include "target-descriptions.h"
81783d0
 #include "gdbthread.h"
81783d0
 #include "solib.h"
81783d0
+#include "inline-frame.h"
81783d0
 
81783d0
 static void target_info (char *, int);
81783d0
 
1592379
@@ -1925,6 +1926,7 @@ target_resume (ptid_t ptid, int step, en
81783d0
 {
1592379
   struct target_ops *t;
1592379
 
81783d0
+  clear_inline_frame_state (ptid);
81783d0
   dcache_invalidate (target_dcache);
1592379
 
1592379
   for (t = current_target.beneath; t != NULL; t = t->beneath)
8dadf56
Index: gdb-6.8.50.20090302/gdb/inline-frame.h
ec0fcb6
===================================================================
3ce5394
--- gdb-6.8.50.20090302.orig/gdb/inline-frame.h	2009-03-25 22:33:02.000000000 +0100
3ce5394
+++ gdb-6.8.50.20090302/gdb/inline-frame.h	2009-03-25 22:34:02.000000000 +0100
ec0fcb6
@@ -43,6 +43,10 @@ void clear_inline_frame_state (ptid_t pt
ec0fcb6
 
ec0fcb6
 void step_into_inline_frame (ptid_t ptid);
ec0fcb6
 
ec0fcb6
+/* Step out of an inlined function by hiding it.  */
ec0fcb6
+
ec0fcb6
+void step_out_of_inline_frame (ptid_t ptid);
ec0fcb6
+
ec0fcb6
 /* Return the number of hidden functions inlined into the current
ec0fcb6
    frame.  */
ec0fcb6
 
8dadf56
Index: gdb-6.8.50.20090302/gdb/infcall.c
1592379
===================================================================
3ce5394
--- gdb-6.8.50.20090302.orig/gdb/infcall.c	2009-03-25 22:33:02.000000000 +0100
3ce5394
+++ gdb-6.8.50.20090302/gdb/infcall.c	2009-03-25 22:34:02.000000000 +0100
1592379
@@ -898,8 +898,15 @@ The program being debugged exited while 
81783d0
 
81783d0
 	  if (unwind_on_signal_p)
81783d0
 	    {
81783d0
-	      /* The user wants the context restored.  Calling error will
81783d0
-	         run inf_status_cleanup, which does all the work.  */
81783d0
+	      /* The user wants the context restored. */
81783d0
+
81783d0
+	      /* We must get back to the frame we were before the
81783d0
+		 dummy call.  */
81783d0
+	      dummy_frame_pop (dummy_id);
81783d0
+
81783d0
+	      /* We also need to restore inferior status to that before the
81783d0
+		 dummy call.  */
81783d0
+	      restore_inferior_status (inf_status);
81783d0
 
81783d0
 	      /* FIXME: Insert a bunch of wrap_here; name can be very
81783d0
 		 long if it's a C++ name with arguments and stuff.  */
8dadf56
Index: gdb-6.8.50.20090302/gdb/dwarf2read.c
8dadf56
===================================================================
3ce5394
--- gdb-6.8.50.20090302.orig/gdb/dwarf2read.c	2009-03-25 22:33:44.000000000 +0100
3ce5394
+++ gdb-6.8.50.20090302/gdb/dwarf2read.c	2009-03-25 22:34:11.000000000 +0100
3ce5394
@@ -3471,6 +3471,7 @@ read_func_scope (struct die_info *die, s
3ce5394
   unsigned die_children;
8dadf56
   struct attribute *call_line, *call_file;
8dadf56
   int inlined_func = (die->tag == DW_TAG_inlined_subroutine);
8dadf56
+  struct type *type;
8dadf56
 
8dadf56
   if (inlined_func)
8dadf56
     {
3ce5394
@@ -3513,7 +3514,10 @@ read_func_scope (struct die_info *die, s
8dadf56
   add_to_cu_func_list (name, lowpc, highpc, cu);
8dadf56
 
8dadf56
   new = push_context (0, lowpc);
8dadf56
-  new->name = new_symbol (die, read_type_die (die, cu), cu);
8dadf56
+  type = read_type_die (die, cu);
8dadf56
+  gdb_assert (type != NULL);
8dadf56
+  new->name = new_symbol (die, type, cu);
8dadf56
+  gdb_assert (TYPE_CODE (SYMBOL_TYPE (new->name)) == TYPE_CODE_FUNC);
8dadf56
 
8dadf56
   /* If there is a location expression for DW_AT_frame_base, record
8dadf56
      it.  */
3ce5394
@@ -8751,6 +8755,7 @@ read_type_die (struct die_info *die, str
8dadf56
       break;
8dadf56
     case DW_TAG_subprogram:
8dadf56
     case DW_TAG_subroutine_type:
8dadf56
+    case DW_TAG_inlined_subroutine:
8dadf56
       this_type = read_subroutine_type (die, cu);
8dadf56
       break;
8dadf56
     case DW_TAG_array_type: