x32: Fix gdb.trace/mi-trace-frame-collected.exp
authorPedro Alves <palves@redhat.com>
Fri, 19 Aug 2016 11:07:46 +0000 (12:07 +0100)
committerPedro Alves <palves@redhat.com>
Fri, 19 Aug 2016 11:13:47 +0000 (12:13 +0100)
gdb.trace/mi-trace-frame-collected.exp has a couple failures on x32:

 FAIL: gdb.trace/mi-trace-frame-collected.exp: live: -trace-frame-collected (register)
 FAIL: gdb.trace/mi-trace-frame-collected.exp: tfile: -trace-frame-collected (register)

gdb.log:

 -trace-frame-collected
 ^done,explicit-variables=[{name="gdb_char_test",value="0 '\\000'"}],computed-expressions=[],registers=[{number="16",value="0x4004dc"},{number="204",value="0x4004dc"}],tvars
 =[],memory=[{address="0x00601060",length="1"}]
 (gdb)
 FAIL: gdb.trace/mi-trace-frame-collected.exp: live: -trace-frame-collected (register)
[...]
 -trace-frame-collected
 ^done,explicit-variables=[{name="gdb_char_test",value="0 '\\000'"}],computed-expressions=[],registers=[{number="16",value="0x4004dc"},{number="204",value="0x4004dc"}],tvars
 =[],memory=[{address="0x00601060",length="1"}]
 (gdb)
 FAIL: gdb.trace/mi-trace-frame-collected.exp: tfile: -trace-frame-collected (register)

This test only collects the PC, and thus expects to only see one
register in the output of -trace-frame-collected.  However, while on
the 64-bit ABI gdb only exposes 64-bit $pc/$rip (register 16 above),
on x32, GDB exposes 32-bit $eip as well, as a pseudo-register
(register 204 above).  Thus, collecting $pc/$rip automatically always
collects $eip as well.

gdb/testsuite/ChangeLog:
2016-08-19  Pedro Alves  <palves@redhat.com>

* gdb.trace/mi-trace-frame-collected.exp
(test_trace_frame_collected): On x32, expect two registers.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.trace/mi-trace-frame-collected.exp

index fda02f009caf2f88b5ccf40a0c649c5b3b213057..ff892a5f7c41d1e9d11e01e5a77fa427b466d8f0 100644 (file)
@@ -1,3 +1,8 @@
+2016-08-19  Pedro Alves  <palves@redhat.com>
+
+       * gdb.trace/mi-trace-frame-collected.exp
+       (test_trace_frame_collected): On x32, expect two registers.
+
 2016-08-18  Carl Love  <cel@us.ibm.com>
 
        * gdb.arch/powerpc-power.s: Add new Power9 instruction tests
index a69c329a54ed34a13beab13fc4e5f53de937b2a7..567954a3605be511366d8ea40683104b8fbcf636 100644 (file)
@@ -95,15 +95,25 @@ proc test_trace_frame_collected { data_source } {
 
        # Test MI command '-trace-frame-collected' dumps only
        # collected registers.
+
+       # While the tracepoint has no explicit action that causes
+       # collection of registers other than the PC, some
+       # architectures manage to collect or guess more than that.
        if { [istarget "s390*-*-*"] } {
-           # Only PC is collected, but on s390 PC is a pseudo-register -
-           # collecting it also collects the underlying PSWA register.
+           # On s390 PC is a pseudo-register - collecting it also
+           # collects the underlying PSWA register.
            if { "$data_source" != "tfile" } {
                set reg_pattern "$reg_pattern,$reg_pattern"
            } else {
                # For tfile, PSWM and CC are also guessed.
                set reg_pattern "$reg_pattern,$reg_pattern,$reg_pattern,$reg_pattern"
            }
+       } elseif {[is_amd64_regs_target] && [is_ilp32_target]} {
+           # x32.  While on the 64-bit ABI gdb only exposes 64-bit
+           # $pc/$rip, on x32, GDB exposes 32-bit $eip as well, as a
+           # pseudo-register.  Thus, collecting $pc/$rip
+           # automatically always collects $eip as well.
+           set reg_pattern "$reg_pattern,$reg_pattern"
        }
 
        mi_gdb_test "-trace-frame-collected" \