BZ 6701 - Improve error messages (patch)

Rajan Arora rarora@redhat.com
Tue Sep 30 21:46:00 GMT 2008


Hi:

 This is a proposed patch for the Bugzilla bug 6701 
(http://sources.redhat.com/bugzilla/show_bug.cgi?id=6701) to improve 
error/warning messages with source context. After application of the 
patch, error/warning messages should be followed by a handy ``source: " 
line and an ascii `^' character in the following line pointing at the 
exact column. Hence, displaying the line and column where the error was 
encountered and in case of some parse errors, the last source line 
visited. Improvements have been made by adding a ``print_error_source'' 
method to the systemtap_session struct which does the actual work of 
displaying the error causing line and col once it has been encountered. 
New error messages look something like this:

# stap -ve 'probe begin { log("hello world") exit () }'
Pass 1: parsed user script and 45 library script(s) in 150usr/10sys/172real ms.
semantic error: unresolved arity-0 function: identifier 'exxit' at <input>:1:34
        source: probe begin { log("hello world") exxit () }
                                                 ^


Changes have been made to testsuite/systemtap.base/warnings.exp so it 
recognizes the ``source: " lines and those with the `^' character. A 
test script has also been added to the testuite/parseko directory. The 
following patch file may be applied to have a feel of how it looks and 
any suggestions/comments are welcome. Since, this is my first patch, I 
hope I can improve this with some feedback from the group.

best,
-Rajan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 6701-e.patch
Type: text/x-patch
Size: 7145 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/systemtap/attachments/20080930/d491e3db/attachment.bin>


More information about the Systemtap mailing list