summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Smith <dsmith@redhat.com>2008-07-15 11:09:32 -0500
committerDavid Smith <dsmith@redhat.com>2008-07-15 11:09:32 -0500
commita7a68293cc9147b915017ce72f2fdf630fda826c (patch)
tree259b02e1f64a56b981a11ee5392827a7b1fd932f
parent233614952872b4561accc79d9d7ef2c66f52dce4 (diff)
downloadsystemtap-steved-a7a68293cc9147b915017ce72f2fdf630fda826c.tar.gz
systemtap-steved-a7a68293cc9147b915017ce72f2fdf630fda826c.tar.xz
systemtap-steved-a7a68293cc9147b915017ce72f2fdf630fda826c.zip
Changed method of getting the value of $syscall.
2008-07-14 David Smith <dsmith@redhat.com> * tapsets.cxx (utrace_var_expanding_copy_visitor::visit_target_symbol): Synthesize a function to get the value of $syscall. 2008-07-14 David Smith <dsmith@redhat.com> * i686/registers.stp: Removed syscall_nr function. * x86_64/registers.stp: Ditto.
-rw-r--r--ChangeLog6
-rw-r--r--tapset/ChangeLog5
-rw-r--r--tapset/i686/registers.stp4
-rw-r--r--tapset/x86_64/registers.stp4
-rw-r--r--tapsets.cxx26
5 files changed, 34 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 16036ff0..56d98046 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-07-14 David Smith <dsmith@redhat.com>
+
+ * tapsets.cxx
+ (utrace_var_expanding_copy_visitor::visit_target_symbol):
+ Synthesize a function to get the value of $syscall.
+
2008-07-14 <brolley@redhat.com>
* Makefile.am (bin_SCRIPTS): Add stap-client, stap-server, stap-serverd.
diff --git a/tapset/ChangeLog b/tapset/ChangeLog
index 4560494e..71f0edd1 100644
--- a/tapset/ChangeLog
+++ b/tapset/ChangeLog
@@ -1,3 +1,8 @@
+2008-07-14 David Smith <dsmith@redhat.com>
+
+ * i686/registers.stp: Removed syscall_nr function.
+ * x86_64/registers.stp: Ditto.
+
2008-07-10 Josh Stone <joshua.i.stone@intel.com>
* vfs.stp (__address_inode): Correct access to the mapping field.
diff --git a/tapset/i686/registers.stp b/tapset/i686/registers.stp
index c4c84814..b9eaba5b 100644
--- a/tapset/i686/registers.stp
+++ b/tapset/i686/registers.stp
@@ -206,7 +206,3 @@ function regparm(n:long) %{
} else
CONTEXT->regparm = _STP_REGPARM | (int) THIS->n;
%}
-
-function syscall_nr:long() {
- return register("orig_ax")
-}
diff --git a/tapset/x86_64/registers.stp b/tapset/x86_64/registers.stp
index 99c39e18..dd5eefb0 100644
--- a/tapset/x86_64/registers.stp
+++ b/tapset/x86_64/registers.stp
@@ -245,7 +245,3 @@ function regparm(n:long) %{
} else
CONTEXT->regparm = _STP_REGPARM | (int) THIS->n;
%}
-
-function syscall_nr:long() {
- return _stp_register("orig_ax", 1)
-}
diff --git a/tapsets.cxx b/tapsets.cxx
index 21c9fb54..2f9dd2d0 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -5355,11 +5355,15 @@ struct utrace_var_expanding_copy_visitor: public var_expanding_copy_visitor
string probe_name;
enum utrace_derived_probe_flags flags;
bool target_symbol_seen;
+ static bool syscall_function_added;
void visit_target_symbol (target_symbol* e);
};
+bool utrace_var_expanding_copy_visitor::syscall_function_added = false;
+
+
utrace_derived_probe::utrace_derived_probe (systemtap_session &s,
probe* p, probe_point* l,
bool hp, string &pn, int64_t pd,
@@ -5426,11 +5430,27 @@ utrace_var_expanding_copy_visitor::visit_target_symbol (target_symbol* e)
// Remember that we've seen a target variable.
target_symbol_seen = true;
- // We're going to substitute a synthesized 'syscall_nr' function
- // call for the '$syscall' reference.
+ // Synthesize a function to grab the syscall .
+ if (! syscall_function_added)
+ {
+ functiondecl *fdecl = new functiondecl;
+ fdecl->tok = e->tok;
+ embeddedcode *ec = new embeddedcode;
+ ec->tok = e->tok;
+ ec->code = string("THIS->__retvalue = __stp_user_syscall_nr(CONTEXT->regs); /* pure */");
+
+ fdecl->name = string("_syscall_nr_get");
+ fdecl->body = ec;
+ fdecl->type = pe_long;
+ sess.functions.push_back(fdecl);
+ syscall_function_added = true;
+ }
+
+ // We're going to substitute a synthesized '_syscall_nr_get'
+ // function call for the '$syscall' reference.
functioncall* n = new functioncall;
n->tok = e->tok;
- n->function = "syscall_nr";
+ n->function = "_syscall_nr_get";
n->referent = 0; // NB: must not resolve yet, to ensure inclusion in session
provide <functioncall*> (this, n);