summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog11
-rw-r--r--doc/ChangeLog4
-rw-r--r--doc/SystemTap_Tapset_Reference/tapsets.tmpl8
-rw-r--r--elaborate.cxx3
-rw-r--r--main.cxx4
-rw-r--r--runtime/ChangeLog4
-rw-r--r--runtime/sduprobes.h144
-rw-r--r--tapset/ChangeLog3
-rw-r--r--tapset/scsi.stp44
-rw-r--r--tapsets.cxx227
-rw-r--r--testsuite/ChangeLog5
-rw-r--r--testsuite/systemtap.base/static_uprobes.exp39
-rw-r--r--testsuite/systemtap.base/static_uprobes.stp15
-rw-r--r--testsuite/systemtap.syscall/ChangeLog5
-rw-r--r--testsuite/systemtap.syscall/forkwait.c2
15 files changed, 377 insertions, 141 deletions
diff --git a/ChangeLog b/ChangeLog
index fde0f158..2875ed6d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2008-11-27 Frank Ch. Eigler <fche@elastic.org>
+
+ PR 7036
+ From Wenji Huang <wenji.huang@oracle.com>:
+ * elaborate.cxx (print_error): Don't suppress if listings_mode.
+ * main.cxx (main): Suppress "pass N failed" if listings_mode.
+
+2008-11-26 Stan Cox <scox@redhat.com>
+
+ * tapsets.cxx (dwarf_builder::build): Support debuginfo static uprobes.
+
2008-11-26 Frank Ch. Eigler <fche@elastic.org>
* translate.cxx (emit_module_exit): Add another synchronize_sched.
diff --git a/doc/ChangeLog b/doc/ChangeLog
index e2ad1d80..9f992132 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,5 +1,9 @@
2008-11-26 Will Cohen <wcohen@redhat.com>
+ * SystemTap_Tapset_Reference/tapsets.tmpl: Add scsi.
+
+2008-11-26 Will Cohen <wcohen@redhat.com>
+
* SystemTap_Tapset_Reference/tapsets.am: Correct location for html/man.
* SystemTap_Tapset_Reference/tapsets.in: Regenerate.
diff --git a/doc/SystemTap_Tapset_Reference/tapsets.tmpl b/doc/SystemTap_Tapset_Reference/tapsets.tmpl
index 6c3abd0f..00dcd92f 100644
--- a/doc/SystemTap_Tapset_Reference/tapsets.tmpl
+++ b/doc/SystemTap_Tapset_Reference/tapsets.tmpl
@@ -150,6 +150,14 @@ This is common among
!Itapset/ioscheduler.stp
</chapter>
+ <chapter id="scsi.stp">
+ <title>SCSI Tapset</title>
+ <para>
+ This family of probe points is used to probe the SCSI activities.
+ It contains the following probe points:
+ </para>
+!Itapset/scsi.stp
+ </chapter>
<chapter id="networking.stp">
<title>Networking Tapset</title>
diff --git a/elaborate.cxx b/elaborate.cxx
index 7cbac31f..0dd80626 100644
--- a/elaborate.cxx
+++ b/elaborate.cxx
@@ -1446,9 +1446,6 @@ systemtap_session::print_error (const semantic_error& e)
string message_str[2];
string align_semantic_error (" ");
- // NB: we don't print error messages during listing mode.
- if (listing_mode) return;
-
// We generate two messages. The second one ([1]) is printed
// without token compression, for purposes of duplicate elimination.
// This way, the same message that may be generated once with a
diff --git a/main.cxx b/main.cxx
index 0cc47804..91c20ddb 100644
--- a/main.cxx
+++ b/main.cxx
@@ -939,7 +939,7 @@ main (int argc, char * const argv [])
<< endl;
}
- if (rc)
+ if (rc && !s.listing_mode)
cerr << "Pass 1: parse failed. "
<< "Try again with another '--vp 1' option."
<< endl;
@@ -967,7 +967,7 @@ main (int argc, char * const argv [])
<< TIMESPRINT
<< endl;
- if (rc)
+ if (rc && !s.listing_mode)
cerr << "Pass 2: analysis failed. "
<< "Try again with another '--vp 01' option."
<< endl;
diff --git a/runtime/ChangeLog b/runtime/ChangeLog
index 93ee18d2..51d8d933 100644
--- a/runtime/ChangeLog
+++ b/runtime/ChangeLog
@@ -1,3 +1,7 @@
+2008-11-26 Stan Cox <scox@redhat.com>
+
+ * sduprobes.h (STAP_PROBE1): Add USE_STAP_DEBUGINFO_PROBE.
+
2008-11-26 Frank Ch. Eigler <fche@elastic.org>
PR 4886.
diff --git a/runtime/sduprobes.h b/runtime/sduprobes.h
index b2c32e43..934f19e0 100644
--- a/runtime/sduprobes.h
+++ b/runtime/sduprobes.h
@@ -6,51 +6,137 @@
// Public License (GPL); either version 2, or (at your option) any
// later version.
-#include <stdlib.h>
#include <string.h>
extern int _stap_probe_sentinel;
-#define STAP_PROBE_START() \
- char *stap_sdt = getenv("SYSTEMTAP_SDT"); \
- if (stap_sdt != NULL) \
+#define STAP_PROBE_START() \
+ char *stap_sdt = getenv("SYSTEMTAP_SDT"); \
+ if (stap_sdt != NULL) \
_stap_probe_start ()
-#define STAP_PROBE_STRUCT(probe,argc) \
-struct _probe_ ## probe \
-{ \
- char probe_name [strlen(#probe)+1]; \
- int arg_count; \
-}; \
-static volatile struct _probe_ ## probe _probe_ ## probe __attribute__ ((section (".probes"))) = {#probe,argc};
-#define STAP_PROBE(provider,probe) \
-STAP_PROBE_STRUCT(probe,0) \
- if (__builtin_expect(_stap_probe_sentinel, 0)) \
- _stap_probe_0 (_probe_ ## probe.probe_name);
+#if _LP64
+#define STAP_PROBE_STRUCT_ARG \
+ __uint64_t probe_arg;
+#else
+#define STAP_PROBE_STRUCT_ARG \
+ long probe_arg __attribute__ ((aligned(8)));
+#endif
+#define STAP_PROBE_STRUCT(probe,type,argc) \
+struct _probe_ ## probe \
+{ \
+ char probe_name [strlen(#probe)+1]; \
+ int probe_type; \
+ STAP_PROBE_STRUCT_ARG \
+}; \
+ static volatile struct _probe_ ## probe _probe_ ## probe __attribute__ ((section (".probes"))) = {#probe,type,argc};
+
+#ifndef USE_STAP_DEBUGINFO_PROBE
+#define STAP_PROBE(provider,probe) \
+ STAP_PROBE_STRUCT(probe,0,0) \
+ if (__builtin_expect(_stap_probe_sentinel, 0))\
+ _stap_probe_0 (_probe_ ## probe.probe_name);
+#else
+#define STAP_PROBE(provider,probe) \
+_probe_ ## probe: \
+ asm volatile ("nop"); \
+ STAP_PROBE_STRUCT(probe,1,(size_t)&& _probe_ ## probe)
+#endif
-#define STAP_PROBE1(provider,probe,arg1) \
-STAP_PROBE_STRUCT(probe,1) \
- if (__builtin_expect(_stap_probe_sentinel, 0)) \
- _stap_probe_1 (_probe_ ## probe.probe_name,(size_t)arg1);
+#ifndef USE_STAP_DEBUGINFO_PROBE
+#define STAP_PROBE1(provider,probe,arg1) \
+ STAP_PROBE_STRUCT(probe,0,1) \
+ if (__builtin_expect(_stap_probe_sentinel, 0))\
+ _stap_probe_1 (_probe_ ## probe.probe_name,(size_t)arg1);
+#else
+#define STAP_PROBE1(provider,probe,parm1) \
+_probe_ ## probe: \
+ asm volatile ("nop"); \
+ volatile typeof(parm1) arg1 = parm1; \
+ STAP_PROBE_STRUCT(probe,1,(size_t)&& _probe_ ## probe) \
+ asm volatile ("# %0" :: "r"(arg1)); \
+ asm volatile ("# %0" :: "m" ((_probe_ ## probe.probe_type)));
+#endif
-#define STAP_PROBE2(provider,probe,arg1,arg2) \
-STAP_PROBE_STRUCT(probe,2) \
+
+#ifndef USE_STAP_DEBUGINFO_PROBE
+#define STAP_PROBE2(provider,probe,arg1,arg2) \
+ STAP_PROBE_STRUCT(probe,0,2) \
if (__builtin_expect(_stap_probe_sentinel, 0)) \
- _stap_probe_2 (_probe_ ## probe.probe_name,(size_t)arg1,(size_t)arg2);
+ _stap_probe_2 (_probe_ ## probe.probe_name,(size_t)arg1,(size_t)arg2);
+#else
+#define STAP_PROBE2(provider,probe,parm1,parm2) \
+_probe_ ## probe: \
+ asm volatile ("nop"); \
+ volatile typeof(parm1) arg1 = parm1; \
+ volatile typeof(parm2) arg2 = parm2; \
+ STAP_PROBE_STRUCT(probe,1,(size_t)&& _probe_ ## probe)\
+ asm volatile ("# %0" :: "r"(arg1)); \
+ asm volatile ("# %0" :: "r"(arg2)); \
+ asm volatile ("# %0" :: "m" ((_probe_ ## probe.probe_type)));
+#endif
+#ifndef USE_STAP_DEBUGINFO_PROBE
#define STAP_PROBE3(provider,probe,arg1,arg2,arg3) \
-STAP_PROBE_STRUCT(probe,3) \
+ STAP_PROBE_STRUCT(probe,0,3) \
if (__builtin_expect(_stap_probe_sentinel, 0)) \
- _stap_probe_3 (_probe_ ## probe.probe_name,(size_t)arg1,(size_t)arg2,(size_t)arg3);
+ _stap_probe_3 (_probe_ ## probe.probe_name,(size_t)arg1,(size_t)arg2,(size_t)arg3);
+#else
+#define STAP_PROBE3(provider,probe,parm1,parm2,parm3) \
+_probe_ ## probe: \
+ asm volatile ("nop"); \
+ volatile typeof(parm1) arg1 = parm1; \
+ volatile typeof(parm2) arg2 = parm2; \
+ volatile typeof(parm3) arg3 = parm3; \
+ STAP_PROBE_STRUCT(probe,1,(size_t)&& _probe_ ## probe) \
+ asm volatile ("# %0" :: "r"(arg1)); \
+ asm volatile ("# %0" :: "r"(arg2)); \
+ asm volatile ("# %0" :: "r"(arg3)); \
+ asm volatile ("# %0" :: "m" ((_probe_ ## probe.probe_type)));
+#endif
+#ifndef USE_STAP_DEBUGINFO_PROBE
#define STAP_PROBE4(provider,probe,arg1,arg2,arg3,arg4) \
-STAP_PROBE_STRUCT(probe,4) \
+ STAP_PROBE_STRUCT(probe,0,4) \
if (__builtin_expect(_stap_probe_sentinel, 0)) \
- _stap_probe_4 (_probe_ ## probe.probe_name,(size_t)arg1,(size_t)arg2,(size_t)arg3,(size_t)arg4);
+ _stap_probe_4 (_probe_ ## probe.probe_name,(size_t)arg1,(size_t)arg2,(size_t)arg3,(size_t)arg4);
+#else
+#define STAP_PROBE4(provider,probe,parm1,parm2,parm3) \
+_probe_ ## probe: \
+ asm volatile ("nop"); \
+ volatile typeof(parm1) arg1 = parm1; \
+ volatile typeof(parm2) arg2 = parm2; \
+ volatile typeof(parm3) arg3 = parm3; \
+ volatile typeof(parm4) arg4 = parm4; \
+ STAP_PROBE_STRUCT(probe,1,(size_t)&& _probe_ ## probe) \
+ asm volatile ("# %0" :: "r"(arg1)); \
+ asm volatile ("# %0" :: "r"(arg2)); \
+ asm volatile ("# %0" :: "r"(arg3)); \
+ asm volatile ("# %0" :: "r"(arg4)); \
+ asm volatile ("# %0" :: "m" ((_probe_ ## probe.probe_type)));
+#endif
+#ifndef USE_STAP_DEBUGINFO_PROBE
#define STAP_PROBE5(provider,probe,arg1,arg2,arg3,arg4,arg5) \
-STAP_PROBE_STRUCT(probe,5) \
- if (__builtin_expect(_stap_probe_sentinel, 0)) \
- _stap_probe_5 (_probe_ ## probe.probe_name,(size_t)arg1,(size_t)arg2,(size_t)arg3,(size_t)arg4,(size_t)arg5);
+ STAP_PROBE_STRUCT(probe,0,5) \
+ if (__builtin_expect(_stap_probe_sentinel, 0))\
+ _stap_probe_5 (_probe_ ## probe.probe_name,(size_t)arg1,(size_t)arg2,(size_t)arg3,(size_t)arg4,(size_t)arg5);
+#else
+#define STAP_PROBE5(provider,probe,parm1,parm2,parm3,parm4,parm5) \
+_probe_ ## probe: \
+ asm volatile ("nop"); \
+ volatile typeof(parm1) arg1 = parm1; \
+ volatile typeof(parm2) arg2 = parm2; \
+ volatile typeof(parm3) arg3 = parm3; \
+ volatile typeof(parm4) arg4 = parm4; \
+ volatile typeof(parm5) arg5 = parm5; \
+ STAP_PROBE_STRUCT(probe,1,(size_t)&& _probe_ ## probe) \
+ asm volatile ("# %0" :: "r"(arg1)); \
+ asm volatile ("# %0" :: "r"(arg2)); \
+ asm volatile ("# %0" :: "r"(arg3)); \
+ asm volatile ("# %0" :: "r"(arg4)); \
+ asm volatile ("# %0" :: "r"(arg5)); \
+ asm volatile ("# %0" :: "m" ((_probe_ ## probe.probe_type)));
+#endif
diff --git a/tapset/ChangeLog b/tapset/ChangeLog
index 75e49f75..3ed69cbc 100644
--- a/tapset/ChangeLog
+++ b/tapset/ChangeLog
@@ -1,4 +1,7 @@
2008-11-26 Will Cohen <wcohen@redhat.com>
+ * scsi.stp: Add kernel-doc notation.
+
+2008-11-26 Will Cohen <wcohen@redhat.com>
* process.stp: Add kernel-doc notation.
diff --git a/tapset/scsi.stp b/tapset/scsi.stp
index ed96b430..76b9a114 100644
--- a/tapset/scsi.stp
+++ b/tapset/scsi.stp
@@ -15,7 +15,13 @@
#include <linux/blkdev.h>
%}
-/* mid-layer prepare a IO request */
+/**
+ * probe scsi.ioentry - Prepares a SCSI mid-layer request
+ * @disk_major: The major number of the disk (-1 if no information)
+ * @disk_minor: The minor number of the disk (-1 if no information)
+ * @device_state: The current state of the device.
+ */
+/* FIXME describe the device_state */
probe scsi.ioentry
= module("scsi_mod").function("scsi_prep_fn@drivers/scsi/scsi_lib.c")?,
kernel.function("scsi_prep_fn@drivers/scsi/scsi_lib.c")?
@@ -31,7 +37,19 @@ probe scsi.ioentry
req_addr = $req
}
-/* Dispatch a command to the low-level driver. */
+/**
+ * probe scsi.iodispatching - SCSI mid-layer dispatched low-level SCSI command
+ * @host_no: The host number
+ * @channel: The channel number
+ * @lun: The lun number
+ * @dev_id: The scsi device id
+ * @device_state: The current state of the device.
+ * @data_direction: The data_direction specifies whether this command is from/to
+ * the device. 0 (DMA_BIDIRECTIONAL), 1 (DMA_TO_DEVICE),
+ * 2 (DMA_FROM_DEVICE), 3 (DMA_NONE)
+ * @request_buffer: The request buffer address
+ * @req_bufflen: The request buffer length
+ */
probe scsi.iodispatching
= module("scsi_mod").function("scsi_dispatch_cmd@drivers/scsi/scsi.c")?,
kernel.function("scsi_dispatch_cmd@drivers/scsi/scsi.c")?
@@ -53,7 +71,16 @@ probe scsi.iodispatching
req_addr = $cmd->request
}
-/* I/O is done by low-level driver*/
+/**
+ * probe scsi.iodone - SCSI command completed by low level driver and enqueued into the done queue.
+ * @host_no: The host number
+ * @channel: The channel number
+ * @lun: The lun number
+ * @dev_id: The scsi device id
+ * @device_state: The current state of the device
+ * @data_direction: The data_direction specifies whether this command is
+ * from/to the device.
+ */
probe scsi.iodone
= module("scsi_mod").function("scsi_done@drivers/scsi/scsi.c")?,
kernel.function("scsi_done@drivers/scsi/scsi.c")?
@@ -69,6 +96,17 @@ probe scsi.iodone
scsi_timer_pending = scsi_timer_pending($cmd);
}
+/**
+ * probe scsi.iocompleted - SCSI mid-layer running the completion processing for block device I/O requests
+ * @host_no: The host number
+ * @channel: The channel number
+ * @lun: The lun number
+ * @dev_id: The scsi device id
+ * @device_state: The current state of the device
+ * @data_direction: The data_direction specifies whether this command is from/to
+ * the device
+ * @goodbytes: The bytes completed.
+ */
/* mid-layer processes the completed IO */
probe scsi.iocompleted
= module("scsi_mod").function("scsi_io_completion@drivers/scsi/scsi_lib.c")?,
diff --git a/tapsets.cxx b/tapsets.cxx
index 82d5b81f..d6be0c2d 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -49,6 +49,7 @@ extern "C" {
#include <glob.h>
#include <fnmatch.h>
#include <stdio.h>
+#include <sys/types.h>
#include "loc2c.h"
#define __STDC_FORMAT_MACROS
@@ -5214,46 +5215,6 @@ dwarf_builder::build(systemtap_session & sess,
if (! sess.module_cache)
sess.module_cache = new module_cache ();
- if (((probe_point::component*)(location->components[1]))->functor == TOK_MARK)
- {
- // Generate: _probe_string = user_string($probe);
- block *b = ((block*)(base->body));
- assignment *as = new assignment;
- symbol* lsym = new symbol;
- lsym->type = pe_string;
- lsym->name = "_probe_string";
- lsym->tok = base->body->tok;
- as->left = lsym;
- as->op = "=";
- functioncall *fc = new functioncall;
- fc->function = "user_string";
- fc->tok = base->body->tok;
- target_symbol* rsym = new target_symbol;
- rsym->base_name = "$probe";
- rsym->tok = base->body->tok;
- fc->args.push_back(rsym);
- as->right = fc;
- expr_statement* es = new expr_statement;
- es->value = as;
-
- // Generate: if (_probe_string != mark("label")) next;
- if_statement *is = new if_statement;
- is->thenblock = new next_statement;
- is->elseblock = NULL;
- is->tok = base->body->tok;
- comparison *be = new comparison;
- be->op = "!=";
- be->tok = base->body->tok;
- be->left = lsym;
- be->right = new literal_string(location->components[1]->arg->tok->content);;
- is->condition = be;
-
- b->statements.insert(b->statements.begin(),(statement*) is);
- b->statements.insert(b->statements.begin(),(statement*) es);
-
- location->components[0]->arg = new literal_string(sess.cmd);
- ((literal_map_t&)parameters)[location->components[0]->functor] = location->components[0]->arg;
- }
string module_name;
if (has_null_param (parameters, TOK_KERNEL)
@@ -5286,62 +5247,144 @@ dwarf_builder::build(systemtap_session & sess,
}
if (((probe_point::component*)(location->components[1]))->functor == TOK_MARK)
+ {
+ enum probe_types
{
- Dwarf_Addr bias;
- Elf* elf = (dwarf_getelf (dwfl_module_getdwarf (dw->module, &bias))
- ?: dwfl_module_getelf (dw->module, &bias));
- size_t shstrndx;
+ no_debuginfo = 0,
+ use_debuginfo = 1
+ };
- Elf_Scn *probe_scn = NULL;
- dwfl_assert ("getshstrndx", elf_getshstrndx (elf, &shstrndx));
- int argc = 0;
- // Find the .probes section where the static probe label and arg count are stored
- while ((probe_scn = elf_nextscn (elf, probe_scn)))
- {
- GElf_Shdr shdr_mem;
- GElf_Shdr *shdr = gelf_getshdr (probe_scn, &shdr_mem);
- assert (shdr != NULL);
-
- if (strcmp (elf_strptr (elf, shstrndx, shdr->sh_name), ".probes") != 0)
- continue;
- Elf_Data *pdata = elf_getdata (probe_scn, NULL);
- assert (pdata != NULL);
- size_t probe_scn_offset = 0;
- while (probe_scn_offset < pdata->d_size)
- {
- char *probe_name = (char*)pdata->d_buf + probe_scn_offset;
- probe_scn_offset += strlen(probe_name);
- probe_scn_offset += 4 - (probe_scn_offset % 4);
- argc = *(((char*)pdata->d_buf + probe_scn_offset));
- probe_scn_offset += sizeof(int);
- if (strcmp (location->components[1]->arg->tok->content.c_str(), probe_name) == 0)
- break;
- }
- }
+ location->components[0]->arg = new literal_string(sess.cmd);
+ ((literal_map_t&)parameters)[location->components[0]->functor] = location->components[0]->arg;
+ Dwarf_Addr bias;
+ Elf* elf = (dwarf_getelf (dwfl_module_getdwarf (dw->module, &bias))
+ ?: dwfl_module_getelf (dw->module, &bias));
+ size_t shstrndx;
+
+ Elf_Scn *probe_scn = NULL;
+ dwfl_assert ("getshstrndx", elf_getshstrndx (elf, &shstrndx));
+ __uint64_t probe_arg = 0;
+ int probe_type = no_debuginfo;
+ // Find the .probes section where the static probe label and arg are stored
+ while ((probe_scn = elf_nextscn (elf, probe_scn)))
+ {
+ GElf_Shdr shdr_mem;
+ GElf_Shdr *shdr = gelf_getshdr (probe_scn, &shdr_mem);
+ assert (shdr != NULL);
- Dwarf *dwarf = dwfl_module_getdwarf(dw->module, &dw->module_bias);
- Dwarf_Off off;
- size_t cuhl;
- Dwarf_Off noff = 0;
- const char *probe_cudie = "";
- // Find where the probe instrumentation landing points are defined
- while (dwarf_nextcu (dwarf, off = noff, &noff, &cuhl, NULL, NULL, NULL) == 0)
- {
- Dwarf_Die cudie_mem;
- Dwarf_Die *cudie = dwarf_offdie (dwarf, off + cuhl, &cudie_mem);
- if (cudie == NULL)
- continue;
- if (strncmp (dwarf_diename(&cudie_mem), "sduprobes", 9) == 0)
- probe_cudie = dwarf_diename(&cudie_mem);
- }
- location->components[1]->functor = TOK_STATEMENT;
- string argc_str = string(1,'0' + argc);
- location->components[1]->arg = new literal_string("_stap_probe_" + (argc_str)
- + "@sduprobes.c+1");
- ((literal_map_t&)parameters)[TOK_STATEMENT] = location->components[1]->arg;
- dw->module = 0;
- }
+ if (strcmp (elf_strptr (elf, shstrndx, shdr->sh_name), ".probes") != 0)
+ continue;
+ Elf_Data *pdata = elf_getdata (probe_scn, NULL);
+ assert (pdata != NULL);
+ size_t probe_scn_offset = 0;
+ while (probe_scn_offset < pdata->d_size)
+ {
+ char *probe_name = (char*)pdata->d_buf + probe_scn_offset;
+ probe_scn_offset += strlen(probe_name);
+ probe_scn_offset += sizeof(int) - (probe_scn_offset % sizeof(int));
+ probe_type = *(((char*)pdata->d_buf + probe_scn_offset));
+ probe_scn_offset += sizeof(int);
+ probe_arg = *((__uint32_t*)((char*)pdata->d_buf + probe_scn_offset));
+ probe_arg <<= 32;
+ probe_arg |= *((__uint32_t*)((char*)pdata->d_buf + probe_scn_offset + 4));
+ if (strcmp (location->components[1]->arg->tok->content.c_str(), probe_name) == 0)
+ break;
+ probe_scn_offset += sizeof(__uint64_t);
+ probe_scn_offset += sizeof(__uint64_t)*2 - (probe_scn_offset % (sizeof(__uint64_t)*2));
+ }
+ }
+ if (probe_type == no_debuginfo)
+ {
+ // Many probe labels correspond to _stap_probe_N
+ // Generate: _probe_string = user_string($probe);
+ block *b = ((block*)(base->body));
+ assignment *as = new assignment;
+ symbol* lsym = new symbol;
+ lsym->type = pe_string;
+ lsym->name = "_probe_string";
+ lsym->tok = base->body->tok;
+ as->left = lsym;
+ as->op = "=";
+ functioncall *fc = new functioncall;
+ fc->function = "user_string";
+ fc->tok = base->body->tok;
+ target_symbol* rsym = new target_symbol;
+ rsym->base_name = "$probe";
+ rsym->tok = base->body->tok;
+ fc->args.push_back(rsym);
+ as->right = fc;
+ expr_statement* es = new expr_statement;
+ es->value = as;
+
+ // Generate: if (_probe_string != mark("label")) next;
+ if_statement *is = new if_statement;
+ is->thenblock = new next_statement;
+ is->elseblock = NULL;
+ is->tok = base->body->tok;
+ comparison *be = new comparison;
+ be->op = "!=";
+ be->tok = base->body->tok;
+ be->left = lsym;
+ be->right = new literal_string(location->components[1]->arg->tok->content);;
+ is->condition = be;
+
+ b->statements.insert(b->statements.begin(),(statement*) is);
+ b->statements.insert(b->statements.begin(),(statement*) es);
+ }
+
+ Dwarf *dwarf = dwfl_module_getdwarf(dw->module, &dw->module_bias);
+ Dwarf_Off off;
+ size_t cuhl;
+ Dwarf_Off noff = 0;
+ const char *probe_cudie = "";
+ const char *probe_file = "@sduprobes.c";
+ int probe_line;
+ // Find where the probe instrumentation landing points are defined
+ while (dwarf_nextcu (dwarf, off = noff, &noff, &cuhl, NULL, NULL, NULL) == 0)
+ {
+ Dwarf_Die cudie_mem;
+ Dwarf_Die *cudie = dwarf_offdie (dwarf, off + cuhl, &cudie_mem);
+ if (cudie == NULL)
+ continue;
+ if (probe_type == no_debuginfo)
+ {
+ if (strncmp (dwarf_diename(&cudie_mem), "sduprobes", 9) == 0)
+ {
+ probe_cudie = dwarf_diename(&cudie_mem);
+ break;
+ }
+ }
+ else
+ {
+ Dwarf_Line *dwarf_line = dwarf_getsrc_die (cudie, probe_arg);
+ if (dwarf_line == NULL)
+ continue;
+ dwarf_lineno (dwarf_line, &probe_line);
+ probe_file = dwarf_diename(&cudie_mem);
+ break;
+ }
+ }
+ location->components[1]->functor = TOK_STATEMENT;
+ if (probe_type == no_debuginfo)
+ {
+ string probe_arg_str = string(1,'0' + probe_arg);
+ location->components[1]->arg
+ = new literal_string("_stap_probe_"
+ + (probe_arg_str)
+ + probe_file + "+1");
+ }
+ else
+ {
+ char *pline;
+ if (asprintf (&pline, "*@%s:%d", probe_file, probe_line + 1) < 0)
+ return;
+ location->components[1]->arg = new literal_string(pline);
+ }
+ ((literal_map_t&)parameters)[TOK_STATEMENT] = location->components[1]->arg;
+ dw->module = 0;
+ }
+
dwarf_query q(sess, base, location, *dw, parameters, finished_results);
diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog
index 24f0cbdd..df7a24f9 100644
--- a/testsuite/ChangeLog
+++ b/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2008-11-26 Stan Cox <scox@redhat.com>
+
+ * systemtap.base/static_uprobes.exp: Check debuginfo static uprobes.
+ * systemtap.base/static_uprobes.stp: Check debuginfo static uprobes.
+
2008-11-21 Frank Ch. Eigler <fche@elastic.org>
PR5689.
diff --git a/testsuite/systemtap.base/static_uprobes.exp b/testsuite/systemtap.base/static_uprobes.exp
index 75e8fd21..2e1c41e1 100644
--- a/testsuite/systemtap.base/static_uprobes.exp
+++ b/testsuite/systemtap.base/static_uprobes.exp
@@ -55,7 +55,6 @@ if { $res != "" } {
}
set ok 0
-set env(SYSTEMTAP_SDT) 1
spawn stap -c $sup_exepath $srcdir/$subdir/static_uprobes.stp
expect {
-timeout 180
@@ -65,6 +64,42 @@ expect {
timeout { fail "$test (timeout)" }
eof { }
}
+
+# Now do a debuginfo style probe of the above test
+
+set fp [open "[pwd]/static_uprobes.sh" "w"]
+puts $fp "
+ed $sup_srcpath <<HERE
+1a
+#define USE_STAP_DEBUGINFO_PROBE 1
+.
+w
+q
+HERE
+"
+close $fp
+spawn sh [pwd]/static_uprobes.sh
+
+set sup_flags "additional_flags=-iquote$env(SYSTEMTAP_RUNTIME) additional_flags=-g additional_flags=$env(SYSTEMTAP_RUNTIME)/sduprobes.c"
+set res [target_compile $sup_srcpath $sup_exepath executable $sup_flags]
+if { $res != "" } {
+ verbose "target_compile failed: $res" 2
+ fail "unable to compile $sup_srcpath"
+ return
+} else {
+ pass "compiling $sup_srcpath"
+}
+
+spawn stap -c $sup_exepath $srcdir/$subdir/static_uprobes.stp
+expect {
+ -timeout 180
+ -re {In label1 probe} { incr ok; exp_continue }
+ -re {In label2 probe 0x2} { incr ok; exp_continue }
+ -re {In label3 probe 0x3 0x[0-9a-f][0-9a-f]} { incr ok; exp_continue }
+ timeout { fail "$test (timeout)" }
+ eof { }
+}
+
wait
-if {$ok == 3} { pass "$test" } { fail "$test (Got $ok Expected 3)" }
+if {$ok == 6} { pass "$test" } { fail "$test (Got $ok Expected 3)" }
diff --git a/testsuite/systemtap.base/static_uprobes.stp b/testsuite/systemtap.base/static_uprobes.stp
index 25e64a37..b9de197e 100644
--- a/testsuite/systemtap.base/static_uprobes.stp
+++ b/testsuite/systemtap.base/static_uprobes.stp
@@ -1,17 +1,14 @@
-probe process("tstlabel.x").mark("label1")
+probe process("static_uprobes.x").mark("label1")
{
- probe_str=user_string($probe)
- printf("In %s probe\n", probe_str)
+ printf("In label1 probe\n")
}
-probe process("tstlabel.x").mark("label2")
+probe process("static_uprobes.x").mark("label2")
{
- probe_str=user_string($probe)
- printf("In %s probe %#x\n", probe_str, $arg1)
+ printf("In label2 probe %#x\n", $arg1)
}
-probe process("tstlabel.x").mark("label3")
+probe process("static_uprobes.x").mark("label3")
{
- probe_str=user_string($probe)
- printf("In %s probe %#x %#x\n", probe_str, $arg1, $arg2)
+ printf("In label3 probe %#x %#x\n", $arg1, $arg2)
}
diff --git a/testsuite/systemtap.syscall/ChangeLog b/testsuite/systemtap.syscall/ChangeLog
index 7cb97dff..e3a1f8de 100644
--- a/testsuite/systemtap.syscall/ChangeLog
+++ b/testsuite/systemtap.syscall/ChangeLog
@@ -1,3 +1,8 @@
+2008-11-27 Mark Wielaard <mjw@redhat.com>
+
+ * forkwait.c: clone (CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD)
+ is just fork ().
+
2008-10-04 Mark Wielaard <mjw@redhat.com>
* access.c: sys_access() calls through to sys_faccessat().
diff --git a/testsuite/systemtap.syscall/forkwait.c b/testsuite/systemtap.syscall/forkwait.c
index ffc98708..bf7516f6 100644
--- a/testsuite/systemtap.syscall/forkwait.c
+++ b/testsuite/systemtap.syscall/forkwait.c
@@ -12,7 +12,7 @@ int main ()
int status;
child = fork();
- // clone (CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD) = NNNN
+ // fork () = NNNN
if (!child) {
int i = 0xfffff;
while (i > 0) i--;