+2009-02-18 Stan Cox <scox@redhat.com>
+
+ * tapsets.cxx (dwarf_builder::build): If not found in .probes, use .label
+ * includes/sys/sdt.h (STAP_PROBE): Always create .probes section.
+ * dtrace: Use basename of -s if no -o given.
+
2009-02-18 Josh Stone <jistone@redhat.com>
* loc2c.c (c_translate_argument): Create a dummy location to start
if (len(new_args) > 0):
self.arglist[this_probe] = ('%s arg%d' % (new_args, c))
if (len(new_args) == 0):
- self.h.write ('#define %s STAP_PROBE(provider,%s)\n' % (this_probe_canon, this_probe))
+ self.h.write ('#define %s() STAP_PROBE(provider,%s)\n' % (this_probe_canon, this_probe))
elif (c == 0):
self.h.write ('#define %s(arg1) STAP_PROBE%d(provider,%s,arg1)\n' % (this_probe_canon, c+1, this_probe))
elif (c == 1):
if (filename == ""):
if (s_filename != ""):
(filename,ext) = os.path.splitext(s_filename)
+ filename = os.path.basename(filename)
if (build_header):
filename = filename + ".h"
elif (build_source):
// Public License (GPL); either version 2, or (at your option) any
// later version.
+#ifndef _SYS_SDT_H
+#define _SYS_SDT_H 1
+
#include <string.h>
#if _LP64
#define STAP_SENTINEL 0x31425250
-// g++ 4.3.2 doesn't emit DW_TAG_label
-#ifdef __cplusplus
#define STAP_PROBE_STRUCT(probe,argc) \
struct _probe_ ## probe \
{ \
__attribute__ ((section (".probes"))) \
= #probe; \
static volatile struct _probe_ ## probe _probe_ ## probe __attribute__ ((section (".probes"))) = {STAP_SENTINEL,(size_t)& probe ## _ ## probe_name[0],argc};
-#else
-#define STAP_PROBE_STRUCT(probe,argc)
-#endif
-#ifdef __cplusplus
#define STAP_LABEL_REF(probe) \
if (__builtin_expect(_probe_ ## probe.probe_type < 0, 0)) \
goto STAP_LABEL(probe,__LINE__);
-#else
-#define STAP_LABEL_REF(probe) \
- volatile static int sentinel_ ## probe = 0; \
- if (__builtin_expect(sentinel_ ## probe < 0, 0)) \
- goto STAP_LABEL(probe,__LINE__);
-#endif
#define STAP_CONCAT(a,b) a ## b
#define STAP_LABEL(p,n) \
STAP_PROBE8(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8)
#define DTRACE_PROBE9(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9) \
STAP_PROBE9(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9)
+
+#endif /* sys/sdt.h */
Elf* elf = dwfl_module_getelf (dw->module, &bias);
size_t shstrndx;
Elf_Scn *probe_scn = NULL;
+ bool probe_found = false;
dwfl_assert ("getshstrndx", elf_getshstrndx (elf, &shstrndx));
GElf_Shdr *shdr = NULL;
probe_scn_offset += sizeof(__uint64_t) - (probe_scn_offset % sizeof(__uint64_t));
probe_arg = *((__uint64_t*)((char*)pdata->d_buf + probe_scn_offset));
if (strcmp (location->components[1]->arg->tok->content.c_str(), probe_name.c_str()) == 0)
- break;
+ {
+ probe_found = true;
+ break;
+ }
if (probe_scn_offset % (sizeof(__uint64_t)*2))
probe_scn_offset = (probe_scn_offset + sizeof(__uint64_t)*2) - (probe_scn_offset % (sizeof(__uint64_t)*2));
}
location->components[1]->arg = new literal_number((int)probe_arg);
((literal_map_t&)parameters)[TOK_STATEMENT] = location->components[1]->arg;
}
- else if (probe_type == dwarf_no_probes)
+
+ if (probe_type == dwarf_no_probes || ! probe_found)
{
location->components[1]->functor = TOK_FUNCTION;
location->components[1]->arg = new literal_string("*");
+2009-02-18 Stan Cox <scox@redhat.com>
+
+ * systemtap.base/static_uprobes.exp: Also test without .probes section.
+
2009-02-18 David Smith <dsmith@redhat.com>
* systemtap.base/static_uprobes.exp: Handles errors from running
'dtrace' python script better.
-
* systemtap.base/labels.exp: Better cleanup.
2009-02-17 Frank Ch. Eigler <fche@elastic.org>
# Compile a C program to use as the user-space probing target
set sup_srcpath "[pwd]/static_uprobes.c"
set sup_exepath "[pwd]/static_uprobes.x"
+set supcplus_exepath "[pwd]/static_uprobes_cplus.x"
set fp [open $sup_srcpath "w"]
puts $fp "
#include <stdlib.h>
spawn mv $sup_srcpath "[pwd]/static_uprobes.cc"
set sup_srcpath "[pwd]/static_uprobes.cc"
set sup_flags "$sup_flags c++"
-set res [target_compile $sup_srcpath $sup_exepath executable $sup_flags]
+set res [target_compile $sup_srcpath $supcplus_exepath executable $sup_flags]
if { $res != "" } {
verbose "target_compile failed: $res" 2
fail "compiling $sup_srcpath -g"
set ok 0
+spawn objcopy -R .probes $supcplus_exepath $sup_exepath
verbose -log "spawn stap -c $sup_exepath $sup_stppath"
spawn stap -c $sup_exepath $sup_stppath
expect {
wait
if {$ok == 4} { pass "$test" } { fail "$test ($ok)" }
-catch {exec rm -f $sup_srcpath $sup_exepath $sup_hpath $sup_stppath}
+catch {exec rm -f $sup_srcpath $sup_exepath $supcplus_exepath $sup_hpath $sup_stppath}