[binutils-gdb] Make skip without argument skip the current inline function

Bernd Edlinger edlinger@sourceware.org
Tue Jan 14 20:22:00 GMT 2020


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=717c684dd1afe36293a256aa2bce4b3af56402c5

commit 717c684dd1afe36293a256aa2bce4b3af56402c5
Author: Bernd Edlinger <bernd.edlinger@hotmail.de>
Date:   Wed Dec 25 16:35:32 2019 +0100

    Make skip without argument skip the current inline function
    
    Previously always the outermost function block was used, but
    since skip is now able to skip over inline functions it is more
    natural to skip the inline function that the program is currently
    executing.
    
    gdb:
    2020-01-14  Bernd Edlinger  <bernd.edlinger@hotmail.de>
    
    	* skip.c (skip_function_command): Make skip w/o arguments use the
    	name of the inlined function if pc is inside any inlined function.
    
    gdb/testsuite:
    2020-01-14  Bernd Edlinger  <bernd.edlinger@hotmail.de>
    
    	* gdb.base/skip-inline.exp: Extend test.

Diff:
---
 gdb/ChangeLog                          |  5 +++++
 gdb/skip.c                             | 17 +++++++----------
 gdb/testsuite/ChangeLog                |  4 ++++
 gdb/testsuite/gdb.base/skip-inline.exp | 14 ++++++++++++++
 4 files changed, 30 insertions(+), 10 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 545cfb3..3f9a6ca 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2020-01-14  Bernd Edlinger  <bernd.edlinger@hotmail.de>
+
+	* skip.c (skip_function_command): Make skip w/o arguments use the
+	name of the inlined function if pc is inside any inlined function.
+
 2020-01-14  Luis Machado  <luis.machado@linaro.org>
 
 	* inf-ptrace.c (inf_ptrace_target::resume): Update comments.
diff --git a/gdb/skip.c b/gdb/skip.c
index 05be42a..419dd7a 100644
--- a/gdb/skip.c
+++ b/gdb/skip.c
@@ -209,18 +209,15 @@ skip_function_command (const char *arg, int from_tty)
   /* Default to the current function if no argument is given.  */
   if (arg == NULL)
     {
+      frame_info *fi = get_selected_frame (_("No default function now."));
+      struct symbol *sym = get_frame_function (fi);
       const char *name = NULL;
-      CORE_ADDR pc;
 
-      if (!last_displayed_sal_is_valid ())
-	error (_("No default function now."));
-
-      pc = get_last_displayed_addr ();
-      if (!find_pc_partial_function (pc, &name, NULL, NULL))
-	{
-	  error (_("No function found containing current program point %s."),
-		  paddress (get_current_arch (), pc));
-	}
+      if (sym != NULL)
+	name = sym->print_name ();
+      else
+	error (_("No function found containing current program point %s."),
+	       paddress (get_current_arch (), get_frame_pc (fi)));
       skip_function (name);
       return;
     }
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 6491d4d..4c1e604 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2020-01-14  Bernd Edlinger  <bernd.edlinger@hotmail.de>
+
+	* gdb.base/skip-inline.exp: Extend test.
+
 2020-01-13  Andrew Burgess  <andrew.burgess@embecosm.com>
 
 	* gdb.dwarf2/dw2-bad-elf-other.S: New file.
diff --git a/gdb/testsuite/gdb.base/skip-inline.exp b/gdb/testsuite/gdb.base/skip-inline.exp
index 89319ad..ff85f3b 100644
--- a/gdb/testsuite/gdb.base/skip-inline.exp
+++ b/gdb/testsuite/gdb.base/skip-inline.exp
@@ -76,3 +76,17 @@ with_test_prefix "triple step" {
     gdb_test "step 3" ".*" "step over baz, again"
     gdb_test "bt" "\\s*\\#0\\s+main.*" "again back to main"
 }
+
+if ![runto_main] {
+    fail "can't run to main"
+    return
+}
+
+gdb_test "skip delete" ".*" "skip delete"
+
+with_test_prefix "skip current frame" {
+    gdb_test "bt" "\\s*\\#0\\s+main.*" "in the main"
+    gdb_test "step" ".*" "step into foo"
+    gdb_test "bt" "\\s*\\#0\\s+foo.*" "in the foo"
+    gdb_test "skip" "Function foo will be skipped when stepping\." "skip"
+}



More information about the Gdb-cvs mailing list