This is sources Bugzilla
Bugzilla Version 2.17.5
Bugzilla Bug 10102
  optional probe points should silently accept "probe point mismatch" errors Last modified: 2009-06-10 15:05:33
     Query page      Enter new bug
Bug#: 10102   Hardware:   Reporter: Frank Ch. Eigler <fche@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
PR10102.patch patch to suspend the error patch 2009-04-27 10:00 Edit | Diff
PR10102-cont.patch patch for user space target patch 2009-05-04 08:16 Edit | Diff
PR10102-final.patch Updated patch patch 2009-05-05 07:32 Edit | Diff
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 10102 depends on: Show dependency tree
Show dependency graph
Bug 10102 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: 2009-04-24 17:31
The following script should pass:

    probe foobar ? , never  { }

with the foobar part silently skipped (since it's optional).

------- Additional Comment #1 From Wenji Huang 2009-04-27 10:00 -------
Created an attachment (id=3909)
patch to suspend the error

Simple example:

$stap -p2 -e 'probe foobar ?, foobar1 !,  never  { }'
WARNING: side-effect-free probe 'probe_1390': keyword at <input>:1:1
 source: probe foobar ?, foobar1 !,  never  { }
	 ^
# probes
never /* <- foobar?,foobar1!,never */

------- Additional Comment #2 From Frank Ch. Eigler 2009-04-27 13:41 -------
If it's that simple, great!
Could you commit please, with a test case?

------- Additional Comment #3 From Wenji Huang 2009-04-28 08:39 -------
See commit ed82b7c902d6a2e26452ec51c9cdb9665dbf9e97

------- Additional Comment #4 From Mark Wielaard 2009-04-29 09:28 -------
Thanks for that. I see a slightly different variant of this that seems a bit
harder to solve (at least, I didn't immediately see how it could be solved,
maybe someone else does see an easy solution):

$ stap -e 'probe process("/does/not/exist").function("main") ?, never { log
("process does exist"); }'
semantic error: libdwfl failure (missing process /does/not/exist i686
debuginfo): No such file or directory while resolving probe point
process("/does/not/exist").function("main")?

This probably needs a similar change in setup_user(), but we don't have the
probe location at that point, and setup_user() is called in a couple of
different situations (not all of which can silently fail).

------- Additional Comment #5 From Wenji Huang 2009-05-04 08:16 -------
Created an attachment (id=3922)
patch for user space target

With the 2nd part patch, the example output:

$stap -p2 -e 'probe
process("/do/not/exist").function("main")?,process("/not/exist").function("main")!,
begin { log("process does exist"); }'
# functions
log:unknown (msg:string)
# probes
begin /* <-
process("/do/not/exist").function("main")?,process("/not/exist").function("main")!,begin
*/

$ stap -p2 -e 'probe process("./stap").function("no such")?, begin {
log("process does exist"); }'
# functions
log:unknown (msg:string)
# probes
begin /* <- process("./stap").function("no such")?,begin */

------- Additional Comment #6 From Frank Ch. Eigler 2009-05-04 15:05 -------
Wenji, it seems to me that putting the try/catch one level higher --
perhaps into derive_probes() itself around the find_and_build() call --
would accomplish this for other probe types too.

------- Additional Comment #7 From Wenji Huang 2009-05-05 07:32 -------
Created an attachment (id=3923)
Updated patch

This patch will tolerate the failure for optional probe in derive_probe as
Frank mentioned in comment #6. Seems all the probe types can be covered.

$ stap -p2 -ue 'probe foo?, process("/do/not/exist").function("main") !,
kernel.mark("no such mark") ?, kernel.trace("no trace") !, process.foo ?,
kernel.statement("no statement") !, module("no mod").function("*") ?, begin {}'

# probes
begin /* <- foo?,process("/do/not/exist").function("main")!,kernel.mark("no
such mark")?,kernel.trace("no trace")!,process.foo?,kernel.statement("no
statement")!,module("no mod").function("*")?,begin */

------- Additional Comment #8 From Frank Ch. Eigler 2009-05-06 00:21 -------
Right, that last one looks almost 100% right; you can commit it.

I'd follow up with a bit of cleanup that fixes the bug that
loc->optional can get its old_loc_opt value forgotten in case
of an exception.  Plus I'd prefer to avoid replicating the
find_and_build call and instead put the if(optional) check
into a catch() block:  try { ... } catch (...) {  if(!optional) throw; ... }

------- Additional Comment #9 From Frank Ch. Eigler 2009-06-10 15:05 -------
done, thanks

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