Bug 13934 - hand-written assembly SDT probes fail to parse
Summary: hand-written assembly SDT probes fail to parse
Status: RESOLVED FIXED
Alias: None
Product: systemtap
Classification: Unclassified
Component: translator (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-01 18:26 UTC by Mark Wielaard
Modified: 2012-07-18 22:15 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Wielaard 2012-04-01 18:26:48 UTC
FAIL: sdt_misc asm (0) asm

spawn /usr/local/install/systemtap/bin/stap -c /usr/local/build/systemtap-obj/te
stsuite/sdt_asm.x /home/mark/src/systemtap/testsuite/systemtap.base/sdt_asm.stp 
/usr/local/build/systemtap-obj/testsuite/sdt_asm.x
WARNING: cannot find module /usr/local/build/systemtap-obj/testsuite/sdt_asm.x d
ebuginfo: No DWARF information found
semantic error: while resolving probe point: identifier 'process' at /home/mark/
src/systemtap/testsuite/systemtap.base/sdt_asm.stp:1:7
        source: probe process(@1).mark("a") 
                      ^

semantic error: no match

This is caused by:

commit 272c9036cb73f3763e3a8a550a48ac59799fcbe6
Author: Wade Farnsworth <wade_farnsworth@mentor.com>
Date:   Wed Mar 28 07:46:16 2012 -0700

    PR13475: Fix ARM SDT_V3 operand parsing
    
    * Include regular expressions to parse ARM operands
    * Add ARM register data
    * Allow for whitespace in ARM operands containing []'s
    
    Signed-off-by: Wade Farnsworth <wade_farnsworth@mentor.com>
Comment 1 Mark Wielaard 2012-04-01 18:28:28 UTC
Some more analysis:
http://sourceware.org/ml/systemtap/2012-q2/msg00001.html
Comment 2 Josh Stone 2012-04-01 19:33:49 UTC
(In reply to comment #1)
> Some more analysis:
> http://sourceware.org/ml/systemtap/2012-q2/msg00001.html

> For compiler-generated code, each argument will be of the form N@OP.
> For hand-written assembly, or for inline assembly in C or C++, the initial
> N@ may be missing. If N is present, it describes the size of the argument.
> [...] If N is omitted, the argument size is the natural size of the operand;
> usually this is the size of the register or the word size of the machine.
> In this case, the signedness is ambiguous.

Ugh, I didn't realize SDTv3 exempted assembly from N@OP, but indeed that's how it plays out -- _SDT_ARGFMT is only defined in the !__ASSEMBLY__ case.  That certainly complicates things... :(
Comment 3 Frank Ch. Eigler 2012-04-02 03:30:28 UTC
One possible solution is to detect the absence of @'s in the sdt-v3 operand string, and infer that this was an assembler invocation.  Then back down to ' ' based tokenization (and make the spaced-out arm operand unusable).
Comment 4 Josh Stone 2012-07-18 22:15:10 UTC
(In reply to comment #3)
> One possible solution is to detect the absence of @'s in the sdt-v3 operand
> string, and infer that this was an assembler invocation.  Then back down to ' '
> based tokenization (and make the spaced-out arm operand unusable).

commit e9a90eeef4d09e69fa8de9b9285dfd4bf1e22c7f