This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug translator/6529] New: error() from nested function can be lost


In some cases, when a script function calls error(), the error() call
has no apparent effect.

For example, when the following script is invoked with an argument
of 2, the call to error() in report2() is lost.
----- nest.stp -----
/* Usage: stap nest.stp n -- where n = 0, 1, or 2 */
global flag

function report1() {
	if (flag == 1)
		error("error in report1")
	return report2()
}

function report2() {
	error("error in report2")
	return 2
}

probe begin {
	flag = $1
	if (flag == 0)
		error("error in begin")
	printf("report1 returns %d\n", report1())
}

probe timer.sec(2) {
	error("timed out")
}
-----
$ stap nest.stp 0		// This works.
ERROR: error in begin
WARNING: Number of errors: 1, skipped probes: 0
$ stap nest.stp 1		// This works.
ERROR: error in report1
WARNING: Number of errors: 1, skipped probes: 0
$ stap nest.stp 2		// Fails.  Expected "error in report2".
report1 returns 0
ERROR: timed out
WARNING: Number of errors: 1, skipped probes: 0

I see the same results on both i386 and x86_64.

It appears that the effect of the error() call is cancelled by the
statement
	c->last_error = "";
following the call to report2().  The bug seems NOT to occur if
a) the function that calls error() returns no value; or
b) the function that calls error() is called directly from a
probe handler.

This bug breaks reporting of bogus register names by [u_]register()
in tapset/x86_64/registers.stp.

-- 
           Summary: error() from nested function can be lost
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: translator
        AssignedTo: systemtap at sources dot redhat dot com
        ReportedBy: jkenisto at us dot ibm dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=6529

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]