This is sources Bugzilla
Bugzilla Version 2.17.5
Bugzilla Bug 5470
  stap segfaults on parseko/probepoint08.stp Last modified: 2007-12-12 16:18:19
     Query page      Enter new bug
Bug#: 5470   Hardware:   Reporter: Martin Hunt <hunt@redhat.com>
Host: Target: Build:
Product:     Add CC:
Component:   Version:   CC:
Status: RESOLVED   Priority:  
Resolution: FIXED   Severity:  
Assigned To: Wenji Huang <wenji.huang@oracle.com>   Target Milestone:  
Summary:
Keywords:

Attachment Description Type Created Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 5470 depends on: Show dependency tree
Show dependency graph
Bug 5470 blocks:

Additional Comments:


Leave as RESOLVED FIXED
Reopen bug
Mark bug as VERIFIED

View Bug Activity   |   Format For Printing


Description:   Last confirmed: 0000-00-00 00:00 Opened: 2007-12-11 19:06
stap from CVS on Fedora 8 x86_64

> stap probepoint08.stp
Segmentation fault

------- Additional Comment #1 From Wenji Huang 2007-12-12 02:52 -------
> stap from CVS on Fedora 8 x86_64
> 
> > stap probepoint08.stp
> Segmentation fault

I can also reproduce it. Seems that stap can't handle the unexpected end of file
well.

Created a short patch for it. Please review it.

--- src/parse.cxx       2007-12-12 09:07:12.000000000 -0500
+++ src.new/parse.cxx   2007-12-12 09:00:36.000000000 -0500
@@ -1343,14 +1343,14 @@ parser::parse_probe_point ()
         {
           next ();
           t = peek ();
-          if (! (t->type == tok_operator && t->content == "("))
+          if (t && ! (t->type == tok_operator && t->content == "("))
             throw parse_error ("expected '('");
           next ();

           pl->condition = parse_expression ();

           t = peek ();
-          if (! (t->type == tok_operator && t->content == ")"))
+          if (t && ! (t->type == tok_operator && t->content == ")"))
             throw parse_error ("expected ')'");
           next ();

------- Additional Comment #2 From Frank Ch. Eigler 2007-12-12 03:42 -------
Nice patch, thanks.

------- Additional Comment #3 From Masami Hiramatsu 2007-12-12 14:47 -------
(In reply to comment #1)
> > stap from CVS on Fedora 8 x86_64
> > 
> > > stap probepoint08.stp
> > Segmentation fault
> 
> I can also reproduce it. Seems that stap can't handle the unexpected end of file
> well.
> 
> Created a short patch for it. Please review it.

This patch will report "expected '('" error, 
but I think 'unexpected eof' error is better.


------- Additional Comment #4 From Frank Ch. Eigler 2007-12-12 15:00 -------
(In reply to comment #3)
> This patch will report "expected '('" error, 
> but I think 'unexpected eof' error is better.

The complete message should already say something like
"encountered EOF, expected '('".

------- Additional Comment #5 From Masami Hiramatsu 2007-12-12 15:20 -------
(In reply to comment #4)
> The complete message should already say something like
> "encountered EOF, expected '('".

Sure, I just mentioned about the consistency of error messages.
(comparing the output of 'probe p if' and 'probe p { if'.)

Anyway, it's trivial.
Now the segmentation fault bug was fixed. Thank you Wenji.

------- Additional Comment #6 From Masami Hiramatsu 2007-12-12 15:25 -------
Sorry, I was misunderstanding your patch.
It causes 'unexpecetd eof' correctly.


------- Additional Comment #7 From Martin Hunt 2007-12-12 16:18 -------
Works for me.  I also checked in testsuite changes to detect stap crashing and
mark those tests as failed.

     Query page      Enter new bug
Actions: New | Query | bug # | Reports | Requests   New Account | Log In