]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
btrace: Add support for IRET events.
authorFelix Willgerodt <felix.willgerodt@intel.com>
Tue, 27 Jun 2023 09:18:21 +0000 (11:18 +0200)
committerFelix Willgerodt <felix.willgerodt@intel.com>
Tue, 24 Sep 2024 12:22:29 +0000 (14:22 +0200)
This is similar to the previous events that we added.

Approved-By: Markus Metzger <markus.t.metzger@intel.com>
gdb/btrace.c
gdb/testsuite/gdb.btrace/event-tracing-gap.exp
gdb/testsuite/gdb.btrace/event-tracing.exp

index e72bea4a41278e11e174b3f9a95a4b1fed6e624a..317516c8ce1df8fbb416d9713b92d59ce988dcd2 100644 (file)
@@ -1428,6 +1428,20 @@ handle_pt_insn_events (struct btrace_thread_info *btinfo,
            handle_pt_aux_insn (btinfo, aux_string, pc);
            break;
          }
+
+       case ptev_iret:
+         {
+           std::string aux_string = std::string (_("iret"));
+
+           if (event.ip_suppressed == 0)
+             {
+               pc = event.variant.iret.ip;
+               aux_string += std::string (": ip = ") + hex_string (*pc);
+             }
+
+           handle_pt_aux_insn (btinfo, aux_string, pc);
+           break;
+         }
 #endif /* defined (LIBIPT_VERSION >= 0x201) */
        }
     }
index 13bf45da6e4e42dd5d0760b1b37b9064613440f1..d33e8e803ce0dfd13f09982b96021412dcb899c1 100644 (file)
@@ -61,12 +61,15 @@ gdb_continue_to_breakpoint "break at bp_2" ".*$srcfile:$bp_2.*"
 # gdb_test_sequence and check only for events that we can control.
 gdb_test_sequence "record function-call-history" "function-call-history" {
     "\[0-9\]+\tmain"
+    "\\\[iret(: ip = $hex)?\\\]"
     "\[0-9\]+\t\\\[non-contiguous\\\]"
     "\[0-9\]+\tsquare"
     "\\\[interrupt: vector = 0x3 \\\(#bp\\\)(, ip = 0x\[0-9a-fA-F\]+)?\\\]"
+    "\\\[iret(: ip = $hex)?\\\]"
     "\[0-9\]+\t\\\[non-contiguous\\\]"
     "\[0-9\]+\tmain"
     "\[0-9\]+\tsquare"
     "\\\[interrupt: vector = 0x3 \\\(#bp\\\)(, ip = 0x\[0-9a-fA-F\]+)?\\\]"
+    "\\\[iret(: ip = $hex)?\\\]"
     "\[0-9\]+\tmain"
 }
index 4e6e785a54492099b4be0d04ada7cba9b92a5608..1a5eee005eafc872b78613e181320e44b31fc00a 100644 (file)
@@ -34,10 +34,11 @@ gdb_test_no_output "record btrace pt"
 
 gdb_test "continue" "Program received signal SIGSEGV, Segmentation fault.*"
 
-# Test printing of at least one INTERRUPT event.
+# Test printing of at least one INTERRUPT and one IRET event.
 # This uses test_sequence to avoid random events failing the tests.
 gdb_test_sequence "record function-call-history" "function-call-history" {
     "\[0-9\]+\tmain"
+    "\t  \\\[iret(: ip = $hex)?\\\]"
     "\t  \\\[interrupt: vector = 0xe \\\(#pf\\\)(, cr2 = 0x0)?(, ip = 0x\[0-9a-fA-F\]+)?\\\]"
 }