diff options
author | Sergio Durigan Junior <sergiodj@redhat.com> | 2014-05-02 17:50:45 -0300 |
---|---|---|
committer | Sergio Durigan Junior <sergiodj@redhat.com> | 2014-05-02 17:50:45 -0300 |
commit | 30a1e6cc7750ce016ea70afa795c0764d07d21ae (patch) | |
tree | 7e7d20c63ee98ec3df746dc350a259e95402741d /gdb/testsuite/gdb.arch | |
parent | f33da99a5410692ddf1302435e27b1bfc21d0b11 (diff) | |
download | gdb-30a1e6cc7750ce016ea70afa795c0764d07d21ae.zip gdb-30a1e6cc7750ce016ea70afa795c0764d07d21ae.tar.gz gdb-30a1e6cc7750ce016ea70afa795c0764d07d21ae.tar.bz2 |
Extend recognized types of SDT probe's arguments
This commit is actually an update to make the parser in
gdb/stap-probe.c be aware of all the possible prefixes that a probe
argument can have. According to the section "Argument Format" in:
<https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation>
The bitness of the arguments can be 8, 16, 32 or 64 bits, signed or
unsigned. Currently GDB recognizes only 32 and 64-bit arguments.
This commit extends this. It also provides a testcase, only for
x86_64 systems.
gdb/
2014-05-02 Sergio Durigan Junior <sergiodj@redhat.com>
* stap-probe.c (enum stap_arg_bitness): New enums to represent 8
and 16-bit signed and unsigned arguments. Update comment.
(stap_parse_probe_arguments): Extend code to handle such
arguments. Use warning instead of complaint to notify about
unrecognized bitness.
gdb/testsuite/
2014-05-02 Sergio Durigan Junior <sergiodj@redhat.com>
* gdb.arch/amd64-stap-optional-prefix.S (main): Add several
probes to test for bitness recognition.
* gdb.arch/amd64-stap-optional-prefix.exp
(test_probe_value_without_reg): New procedure.
Add code to test for different kinds of bitness.
Diffstat (limited to 'gdb/testsuite/gdb.arch')
-rw-r--r-- | gdb/testsuite/gdb.arch/amd64-stap-optional-prefix.S | 10 | ||||
-rw-r--r-- | gdb/testsuite/gdb.arch/amd64-stap-optional-prefix.exp | 34 |
2 files changed, 44 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.arch/amd64-stap-optional-prefix.S b/gdb/testsuite/gdb.arch/amd64-stap-optional-prefix.S index 66689cb..3cdb4c2 100644 --- a/gdb/testsuite/gdb.arch/amd64-stap-optional-prefix.S +++ b/gdb/testsuite/gdb.arch/amd64-stap-optional-prefix.S @@ -28,5 +28,15 @@ main: STAP_PROBE1(probe, foo_prefix, 8@(%rsp)) STAP_PROBE1(probe, bar_prefix, 8@-8(%rbp)) mov %rbp,%rsp + STAP_PROBE1(probe, uint8_probe, 1@$8) + STAP_PROBE1(probe, int8_probe, -1@$-8) + STAP_PROBE1(probe, uint16_probe, 2@$16) + STAP_PROBE1(probe, int16_probe, -2@$-16) + STAP_PROBE1(probe, uint32_probe, 4@$32) + STAP_PROBE1(probe, int32_probe, -4@$-32) + STAP_PROBE1(probe, uint64_probe, 8@$64) + STAP_PROBE1(probe, int64_probe, -8@$-64) + STAP_PROBE1(probe, fail_probe, -7@$16) + STAP_PROBE1(probe, fail2_probe, 23-@$16) xor %rax,%rax ret diff --git a/gdb/testsuite/gdb.arch/amd64-stap-optional-prefix.exp b/gdb/testsuite/gdb.arch/amd64-stap-optional-prefix.exp index cc9d6c3..b7f1505 100644 --- a/gdb/testsuite/gdb.arch/amd64-stap-optional-prefix.exp +++ b/gdb/testsuite/gdb.arch/amd64-stap-optional-prefix.exp @@ -43,6 +43,11 @@ proc test_probe_value { value reg_val } { gdb_test "print \$_probe_arg0 == *((unsigned int *) (${reg_val}))" "= 1" } +proc test_probe_value_without_reg { value } { + gdb_test "print \$_probe_argc" "= 1" + gdb_test "print \$_probe_arg0" "= $value" +} + if { ![runto_main] } { return -1 } @@ -55,3 +60,32 @@ foreach probe_name [list "foo" "bar" "foo_prefix" "bar_prefix"] \ test_probe_value $probe_val $probe_reg_val } } + +# Testing normal probes, with several prefixes. + +set normal_probes_names { } + +foreach bit [list 8 16 32 64] { + lappend normal_probes_names "uint${bit}_probe" + lappend normal_probes_names "int${bit}_probe" +} + +foreach probe_name $normal_probes_names \ + probe_val [list 8 -8 16 -16 32 -32 64 -64] { + with_test_prefix $probe_name { + goto_probe $probe_name + test_probe_value_without_reg $probe_val + } +} + +# Testing the fail probes. + +with_test_prefix "fail_probe" { + goto_probe "fail_probe" + gdb_test "print \$_probe_arg0" "warning: unrecognized bitness `-7' for probe `fail_probe'\r\nInvalid probe argument 0 -- probe has 0 arguments available" +} + +with_test_prefix "fail2_probe" { + goto_probe "fail2_probe" + gdb_test "print \$_probe_arg0" "Unknown numeric token on expression `23-@\\\$16'." +} |