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/6871] uprobes $context values often wrong


------- Additional Comments From jkenisto at us dot ibm dot com  2008-09-10 23:27 -------
Here's some evidence that it's NOT a uprobes problem.  I noticed it while
testing my version of uprobes that's modified to work with the new utrace.  This
was on i386.

Here's a program to probe:
----- probeme.c -----
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>

#define noinline __attribute__((noinline))

noinline static int add(int n1, int n2)
{
	asm volatile("");
	return n1 + n2;
}

main()
{
	int n1, n2;
	fprintf(stderr, "pid=%d vaddr=%p\n",  getpid(), add);

	while (scanf("%d %d", &n1, &n2) == 2) {
		printf("%d + %d = %d\n", n1, n2, add(n1, n2));
	}
	exit(0);
}
-----
The following script reports incorrect values:
----- ustap4.stp -----
probe process("/home/jimk/.../probeme").function("add") {
	printf("%d + %d\n", $n1, $n2)
}
-----
... while the following script reports correct values:
----- ustap5.stp -----
probe process("/home/jimk/.../probeme").function("add") {
	printf("%d + %d\n", int_arg(1), int_arg(2))
}
-----
Similarly, if I recompile probeme.c with -mregparm=3, $n1 and $n2 yield
incorrect values, but int_arg(1) and int_arg(2) yield correct values if I stick
a "regparm(3)" call in front of the printf in the script.

-- 


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

------- 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]