/* SystemTap probe support for GDB.
- Copyright (C) 2012-2013 Free Software Foundation, Inc.
+ Copyright (C) 2012-2015 Free Software Foundation, Inc.
This file is part of GDB.
#include "gdbcmd.h"
#include "filenames.h"
#include "value.h"
-#include "exceptions.h"
#include "ax.h"
#include "ax-gdb.h"
#include "complaints.h"
/* Forward declaration. */
-static const struct probe_ops stap_probe_ops;
+extern const struct probe_ops stap_probe_ops;
/* Should we display debug information for the probe's argument expression
parsing? */
The relationship is:
- STAP_ARG_BITNESS_UNDEFINED: The user hasn't specified the bitness.
+ - STAP_ARG_BITNESS_8BIT_UNSIGNED: argument string starts with `1@'.
+ - STAP_ARG_BITNESS_8BIT_SIGNED: argument string starts with `-1@'.
+ - STAP_ARG_BITNESS_16BIT_UNSIGNED: argument string starts with `2@'.
+ - STAP_ARG_BITNESS_16BIT_SIGNED: argument string starts with `-2@'.
- STAP_ARG_BITNESS_32BIT_UNSIGNED: argument string starts with `4@'.
- STAP_ARG_BITNESS_32BIT_SIGNED: argument string starts with `-4@'.
- STAP_ARG_BITNESS_64BIT_UNSIGNED: argument string starts with `8@'.
enum stap_arg_bitness
{
STAP_ARG_BITNESS_UNDEFINED,
+ STAP_ARG_BITNESS_8BIT_UNSIGNED,
+ STAP_ARG_BITNESS_8BIT_SIGNED,
+ STAP_ARG_BITNESS_16BIT_UNSIGNED,
+ STAP_ARG_BITNESS_16BIT_SIGNED,
STAP_ARG_BITNESS_32BIT_UNSIGNED,
STAP_ARG_BITNESS_32BIT_SIGNED,
STAP_ARG_BITNESS_64BIT_UNSIGNED,
struct probe p;
/* If the probe has a semaphore associated, then this is the value of
- it. */
+ it, relative to SECT_OFF_DATA. */
CORE_ADDR sem_addr;
+ /* One if the arguments have been parsed. */
unsigned int args_parsed : 1;
+
union
{
const char *text;
break;
default:
- internal_error (__FILE__, __LINE__,
- _("Invalid opcode in expression `%s' for SystemTap"
- "probe"), *s);
+ error (_("Invalid opcode in expression `%s' for SystemTap"
+ "probe"), *s);
}
return op;
static struct type *
stap_get_expected_argument_type (struct gdbarch *gdbarch,
- enum stap_arg_bitness b)
+ enum stap_arg_bitness b,
+ const struct stap_probe *probe)
{
switch (b)
{
else
return builtin_type (gdbarch)->builtin_uint64;
+ case STAP_ARG_BITNESS_8BIT_UNSIGNED:
+ return builtin_type (gdbarch)->builtin_uint8;
+
+ case STAP_ARG_BITNESS_8BIT_SIGNED:
+ return builtin_type (gdbarch)->builtin_int8;
+
+ case STAP_ARG_BITNESS_16BIT_UNSIGNED:
+ return builtin_type (gdbarch)->builtin_uint16;
+
+ case STAP_ARG_BITNESS_16BIT_SIGNED:
+ return builtin_type (gdbarch)->builtin_int16;
+
case STAP_ARG_BITNESS_32BIT_SIGNED:
return builtin_type (gdbarch)->builtin_int32;
return builtin_type (gdbarch)->builtin_uint64;
default:
- internal_error (__FILE__, __LINE__,
- _("Undefined bitness for probe."));
+ error (_("Undefined bitness for probe '%s'."),
+ probe->p.name);
break;
}
}
}
for (p = prefixes; *p != NULL; ++p)
- {
- if (strncasecmp (s, *p, strlen (*p)) == 0)
- {
- if (r != NULL)
- *r = *p;
+ if (strncasecmp (s, *p, strlen (*p)) == 0)
+ {
+ if (r != NULL)
+ *r = *p;
- return 1;
- }
- }
+ return 1;
+ }
return 0;
}
/* Simple flag to indicate whether we have seen a minus signal before
certain number. */
int got_minus = 0;
-
/* Flags to indicate whether this register access is being displaced and/or
indirected. */
int disp_p = 0, indirect_p = 0;
struct gdbarch *gdbarch = p->gdbarch;
-
/* Needed to generate the register name as a part of an expression. */
struct stoken str;
-
/* Variables used to extract the register name from the probe's
argument. */
const char *start;
p->arg = endp;
/* Generating the expression for the displacement. */
- write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (builtin_type (gdbarch)->builtin_long);
- write_exp_elt_longcst (displacement);
- write_exp_elt_opcode (OP_LONG);
+ write_exp_elt_opcode (&p->pstate, OP_LONG);
+ write_exp_elt_type (&p->pstate, builtin_type (gdbarch)->builtin_long);
+ write_exp_elt_longcst (&p->pstate, displacement);
+ write_exp_elt_opcode (&p->pstate, OP_LONG);
if (got_minus)
- write_exp_elt_opcode (UNOP_NEG);
+ write_exp_elt_opcode (&p->pstate, UNOP_NEG);
}
/* Getting rid of register indirection prefix. */
error (_("Invalid register name `%s' on expression `%s'."),
regname, p->saved_arg);
- write_exp_elt_opcode (OP_REGISTER);
+ write_exp_elt_opcode (&p->pstate, OP_REGISTER);
str.ptr = regname;
str.length = len;
- write_exp_string (str);
- write_exp_elt_opcode (OP_REGISTER);
+ write_exp_string (&p->pstate, str);
+ write_exp_elt_opcode (&p->pstate, OP_REGISTER);
if (indirect_p)
{
if (disp_p)
- write_exp_elt_opcode (BINOP_ADD);
+ write_exp_elt_opcode (&p->pstate, BINOP_ADD);
/* Casting to the expected type. */
- write_exp_elt_opcode (UNOP_CAST);
- write_exp_elt_type (lookup_pointer_type (p->arg_type));
- write_exp_elt_opcode (UNOP_CAST);
+ write_exp_elt_opcode (&p->pstate, UNOP_CAST);
+ write_exp_elt_type (&p->pstate, lookup_pointer_type (p->arg_type));
+ write_exp_elt_opcode (&p->pstate, UNOP_CAST);
- write_exp_elt_opcode (UNOP_IND);
+ write_exp_elt_opcode (&p->pstate, UNOP_IND);
}
/* Getting rid of the register name suffix. */
/* We first try to parse this token as a "special token". */
if (gdbarch_stap_parse_special_token_p (gdbarch))
- {
- int ret = gdbarch_stap_parse_special_token (gdbarch, p);
-
- if (ret)
- {
- /* If the return value of the above function is not zero,
- it means it successfully parsed the special token.
+ if (gdbarch_stap_parse_special_token (gdbarch, p) != 0)
+ {
+ /* If the return value of the above function is not zero,
+ it means it successfully parsed the special token.
- If it is NULL, we try to parse it using our method. */
- return;
- }
- }
+ If it is NULL, we try to parse it using our method. */
+ return;
+ }
if (*p->arg == '-' || *p->arg == '~' || *p->arg == '+')
{
char c = *p->arg;
- int number;
-
/* We use this variable to do a lookahead. */
const char *tmp = p->arg;
+ int has_digit = 0;
+ /* Skipping signal. */
++tmp;
/* This is an unary operation. Here is a list of allowed tokens
if (p->inside_paren_p)
tmp = skip_spaces_const (tmp);
- if (isdigit (*tmp))
+ while (isdigit (*tmp))
{
- char *endp;
-
- number = strtol (tmp, &endp, 10);
- tmp = endp;
+ /* We skip the digit here because we are only interested in
+ knowing what kind of unary operation this is. The digit
+ will be handled by one of the functions that will be
+ called below ('stap_parse_argument_conditionally' or
+ 'stap_parse_register_operand'). */
+ ++tmp;
+ has_digit = 1;
}
- if (!stap_is_register_indirection_prefix (gdbarch, tmp, NULL))
- {
- /* This is not a displacement. We skip the operator, and deal
- with it later. */
- ++p->arg;
- stap_parse_argument_conditionally (p);
- if (c == '-')
- write_exp_elt_opcode (UNOP_NEG);
- else if (c == '~')
- write_exp_elt_opcode (UNOP_COMPLEMENT);
- }
- else
+ if (has_digit && stap_is_register_indirection_prefix (gdbarch, tmp,
+ NULL))
{
/* If we are here, it means it is a displacement. The only
operations allowed here are `-' and `+'. */
stap_parse_register_operand (p);
}
+ else
+ {
+ /* This is not a displacement. We skip the operator, and
+ deal with it when the recursion returns. */
+ ++p->arg;
+ stap_parse_argument_conditionally (p);
+ if (c == '-')
+ write_exp_elt_opcode (&p->pstate, UNOP_NEG);
+ else if (c == '~')
+ write_exp_elt_opcode (&p->pstate, UNOP_COMPLEMENT);
+ }
}
else if (isdigit (*p->arg))
{
const char *int_suffix;
/* We are dealing with a numeric constant. */
- write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (builtin_type (gdbarch)->builtin_long);
- write_exp_elt_longcst (number);
- write_exp_elt_opcode (OP_LONG);
+ write_exp_elt_opcode (&p->pstate, OP_LONG);
+ write_exp_elt_type (&p->pstate,
+ builtin_type (gdbarch)->builtin_long);
+ write_exp_elt_longcst (&p->pstate, number);
+ write_exp_elt_opcode (&p->pstate, OP_LONG);
p->arg = tmp;
number = strtol (p->arg, &endp, 10);
p->arg = endp;
- write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (builtin_type (gdbarch)->builtin_long);
- write_exp_elt_longcst (number);
- write_exp_elt_opcode (OP_LONG);
+ write_exp_elt_opcode (&p->pstate, OP_LONG);
+ write_exp_elt_type (&p->pstate, builtin_type (gdbarch)->builtin_long);
+ write_exp_elt_longcst (&p->pstate, number);
+ write_exp_elt_opcode (&p->pstate, OP_LONG);
if (stap_check_integer_suffix (gdbarch, p->arg, &int_suffix))
p->arg += strlen (int_suffix);
static void
stap_parse_argument_conditionally (struct stap_parse_info *p)
{
+ gdb_assert (gdbarch_stap_is_single_operand_p (p->gdbarch));
+
if (*p->arg == '-' || *p->arg == '~' || *p->arg == '+' /* Unary. */
|| isdigit (*p->arg)
|| gdbarch_stap_is_single_operand (p->gdbarch, p->arg))
parse them depending on the precedence of the operators
we find. */
+ gdb_assert (p->arg != NULL);
+
if (p->inside_paren_p)
p->arg = skip_spaces_const (p->arg);
This loop shall continue until we run out of characters in the input,
or until we find a close-parenthesis, which means that we've reached
the end of a sub-expression. */
- while (p->arg && *p->arg && *p->arg != ')' && !isspace (*p->arg))
+ while (*p->arg != '\0' && *p->arg != ')' && !isspace (*p->arg))
{
const char *tmp_exp_buf;
enum exp_opcode opcode;
/* While we still have operators, try to parse another
right-side, but using the current right-side as a left-side. */
- while (*p->arg && stap_is_operator (p->arg))
+ while (*p->arg != '\0' && stap_is_operator (p->arg))
{
enum exp_opcode lookahead_opcode;
enum stap_operand_prec lookahead_prec;
stap_parse_argument_1 (p, 1, lookahead_prec);
}
- write_exp_elt_opcode (opcode);
+ write_exp_elt_opcode (&p->pstate, opcode);
}
}
struct cleanup *back_to;
/* We need to initialize the expression buffer, in order to begin
- our parsing efforts. The language here does not matter, since we
- are using our own parser. */
- initialize_expout (10, current_language, gdbarch);
- back_to = make_cleanup (free_current_contents, &expout);
+ our parsing efforts. We use language_c here because we may need
+ to do pointer arithmetics. */
+ initialize_expout (&p.pstate, 10, language_def (language_c), gdbarch);
+ back_to = make_cleanup (free_current_contents, &p.pstate.expout);
p.saved_arg = *arg;
p.arg = *arg;
gdb_assert (p.inside_paren_p == 0);
/* Casting the final expression to the appropriate type. */
- write_exp_elt_opcode (UNOP_CAST);
- write_exp_elt_type (atype);
- write_exp_elt_opcode (UNOP_CAST);
+ write_exp_elt_opcode (&p.pstate, UNOP_CAST);
+ write_exp_elt_type (&p.pstate, atype);
+ write_exp_elt_opcode (&p.pstate, UNOP_CAST);
- reallocate_expout ();
+ reallocate_expout (&p.pstate);
p.arg = skip_spaces_const (p.arg);
*arg = p.arg;
- return expout;
+ /* We can safely return EXPOUT here. */
+ return p.pstate.expout;
}
/* Function which parses an argument string from PROBE, correctly splitting
probe->args_parsed = 1;
probe->args_u.vec = NULL;
- if (!cur || !*cur || *cur == ':')
+ if (cur == NULL || *cur == '\0' || *cur == ':')
return;
- while (*cur)
+ while (*cur != '\0')
{
struct stap_probe_arg arg;
enum stap_arg_bitness b;
N@OP
- Where `N' can be [+,-][4,8]. This is not mandatory, so
+ Where `N' can be [+,-][1,2,4,8]. This is not mandatory, so
we check it here. If we don't find it, go to the next
state. */
- if ((*cur == '-' && cur[1] && cur[2] != '@')
- && cur[1] != '@')
- arg.bitness = STAP_ARG_BITNESS_UNDEFINED;
- else
+ if ((cur[0] == '-' && isdigit (cur[1]) && cur[2] == '@')
+ || (isdigit (cur[0]) && cur[1] == '@'))
{
if (*cur == '-')
{
got_minus = 1;
}
- if (*cur == '4')
- b = (got_minus ? STAP_ARG_BITNESS_32BIT_SIGNED
- : STAP_ARG_BITNESS_32BIT_UNSIGNED);
- else if (*cur == '8')
- b = (got_minus ? STAP_ARG_BITNESS_64BIT_SIGNED
- : STAP_ARG_BITNESS_64BIT_UNSIGNED);
- else
+ /* Defining the bitness. */
+ switch (*cur)
{
- /* We have an error, because we don't expect anything
- except 4 and 8. */
- complaint (&symfile_complaints,
- _("unrecognized bitness `%c' for probe `%s'"),
- *cur, probe->p.name);
- return;
+ case '1':
+ b = (got_minus ? STAP_ARG_BITNESS_8BIT_SIGNED
+ : STAP_ARG_BITNESS_8BIT_UNSIGNED);
+ break;
+
+ case '2':
+ b = (got_minus ? STAP_ARG_BITNESS_16BIT_SIGNED
+ : STAP_ARG_BITNESS_16BIT_UNSIGNED);
+ break;
+
+ case '4':
+ b = (got_minus ? STAP_ARG_BITNESS_32BIT_SIGNED
+ : STAP_ARG_BITNESS_32BIT_UNSIGNED);
+ break;
+
+ case '8':
+ b = (got_minus ? STAP_ARG_BITNESS_64BIT_SIGNED
+ : STAP_ARG_BITNESS_64BIT_UNSIGNED);
+ break;
+
+ default:
+ {
+ /* We have an error, because we don't expect anything
+ except 1, 2, 4 and 8. */
+ warning (_("unrecognized bitness %s%c' for probe `%s'"),
+ got_minus ? "`-" : "`", *cur, probe->p.name);
+ return;
+ }
}
arg.bitness = b;
- arg.atype = stap_get_expected_argument_type (gdbarch, b);
/* Discard the number and the `@' sign. */
cur += 2;
}
+ else
+ arg.bitness = STAP_ARG_BITNESS_UNDEFINED;
+
+ arg.atype = stap_get_expected_argument_type (gdbarch, arg.bitness,
+ probe);
expr = stap_parse_argument (&cur, arg.atype, gdbarch);
}
}
+/* Implementation of the get_probe_address method. */
+
+static CORE_ADDR
+stap_get_probe_address (struct probe *probe, struct objfile *objfile)
+{
+ return probe->address + ANOFFSET (objfile->section_offsets,
+ SECT_OFF_DATA (objfile));
+}
+
/* Given PROBE, returns the number of arguments present in that probe's
argument string. */
return ret;
}
+/* Return argument N of probe PROBE.
+
+ If the probe's arguments have not been parsed yet, parse them. If
+ there are no arguments, throw an exception (error). Otherwise,
+ return the requested argument. */
+
static struct stap_probe_arg *
stap_get_arg (struct stap_probe *probe, unsigned n, struct gdbarch *gdbarch)
{
if (!probe->args_parsed)
stap_parse_probe_arguments (probe, gdbarch);
+ gdb_assert (probe->args_parsed);
+ if (probe->args_u.vec == NULL)
+ internal_error (__FILE__, __LINE__,
+ _("Probe '%s' apparently does not have arguments, but \n"
+ "GDB is requesting its argument number %u anyway. "
+ "This should not happen. Please report this bug."),
+ probe->p.name, n);
+
return VEC_index (stap_probe_arg_s, probe->args_u.vec, n);
}
stap_can_evaluate_probe_arguments (struct probe *probe_generic)
{
struct stap_probe *stap_probe = (struct stap_probe *) probe_generic;
- struct gdbarch *gdbarch = get_objfile_arch (stap_probe->p.objfile);
+ struct gdbarch *gdbarch = stap_probe->p.arch;
/* For SystemTap probes, we have to guarantee that the method
stap_is_single_operand is defined on gdbarch. If it is not, then it
}
/* Destroy (free) the data related to PROBE. PROBE memory itself is not feed
- as it is allocated from OBJFILE_OBSTACK. */
+ as it is allocated on an obstack. */
static void
stap_probe_destroy (struct probe *probe_generic)
\f
-/* This is called to compute the value of one of the $_probe_arg*
- convenience variables. */
-
-static struct value *
-compute_probe_arg (struct gdbarch *arch, struct internalvar *ivar,
- void *data)
-{
- struct frame_info *frame = get_selected_frame (_("No frame selected"));
- CORE_ADDR pc = get_frame_pc (frame);
- int sel = (int) (uintptr_t) data;
- struct probe *pc_probe;
- const struct sym_probe_fns *pc_probe_fns;
- unsigned n_args;
-
- /* SEL == -1 means "_probe_argc". */
- gdb_assert (sel >= -1);
-
- pc_probe = find_probe_by_pc (pc);
- if (pc_probe == NULL)
- error (_("No SystemTap probe at PC %s"), core_addr_to_string (pc));
-
- n_args = get_probe_argument_count (pc_probe, frame);
- if (sel == -1)
- return value_from_longest (builtin_type (arch)->builtin_int, n_args);
-
- if (sel >= n_args)
- error (_("Invalid probe argument %d -- probe has %u arguments available"),
- sel, n_args);
-
- return evaluate_probe_argument (pc_probe, sel, frame);
-}
-
-/* This is called to compile one of the $_probe_arg* convenience
- variables into an agent expression. */
-
-static void
-compile_probe_arg (struct internalvar *ivar, struct agent_expr *expr,
- struct axs_value *value, void *data)
-{
- CORE_ADDR pc = expr->scope;
- int sel = (int) (uintptr_t) data;
- struct probe *pc_probe;
- const struct sym_probe_fns *pc_probe_fns;
- int n_args;
- struct frame_info *frame = get_selected_frame (NULL);
-
- /* SEL == -1 means "_probe_argc". */
- gdb_assert (sel >= -1);
-
- pc_probe = find_probe_by_pc (pc);
- if (pc_probe == NULL)
- error (_("No SystemTap probe at PC %s"), core_addr_to_string (pc));
-
- n_args = get_probe_argument_count (pc_probe, frame);
-
- if (sel == -1)
- {
- value->kind = axs_rvalue;
- value->type = builtin_type (expr->gdbarch)->builtin_int;
- ax_const_l (expr, n_args);
- return;
- }
-
- gdb_assert (sel >= 0);
- if (sel >= n_args)
- error (_("Invalid probe argument %d -- probe has %d arguments available"),
- sel, n_args);
-
- pc_probe->pops->compile_to_ax (pc_probe, expr, value, sel);
-}
-
-\f
-
/* Set or clear a SystemTap semaphore. ADDRESS is the semaphore's
address. SET is zero if the semaphore should be cleared, or one
if it should be set. This is a helper function for `stap_semaphore_down'
the probes, but that is too rare to care. */
static void
-stap_set_semaphore (struct probe *probe_generic, struct gdbarch *gdbarch)
+stap_set_semaphore (struct probe *probe_generic, struct objfile *objfile,
+ struct gdbarch *gdbarch)
{
struct stap_probe *probe = (struct stap_probe *) probe_generic;
+ CORE_ADDR addr;
gdb_assert (probe_generic->pops == &stap_probe_ops);
- stap_modify_semaphore (probe->sem_addr, 1, gdbarch);
+ addr = (probe->sem_addr
+ + ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile)));
+ stap_modify_semaphore (addr, 1, gdbarch);
}
/* Clear a SystemTap semaphore. SEM is the semaphore's address. */
static void
-stap_clear_semaphore (struct probe *probe_generic, struct gdbarch *gdbarch)
+stap_clear_semaphore (struct probe *probe_generic, struct objfile *objfile,
+ struct gdbarch *gdbarch)
{
struct stap_probe *probe = (struct stap_probe *) probe_generic;
+ CORE_ADDR addr;
gdb_assert (probe_generic->pops == &stap_probe_ops);
- stap_modify_semaphore (probe->sem_addr, 0, gdbarch);
+ addr = (probe->sem_addr
+ + ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile)));
+ stap_modify_semaphore (addr, 0, gdbarch);
}
-/* Implementation of `$_probe_arg*' set of variables. */
-
-static const struct internalvar_funcs probe_funcs =
-{
- compute_probe_arg,
- compile_probe_arg,
- NULL
-};
-
/* Helper function that parses the information contained in a
SystemTap's probe. Basically, the information consists in:
const char *probe_args = NULL;
struct stap_probe *ret;
- ret = obstack_alloc (&objfile->objfile_obstack, sizeof (*ret));
+ ret = XOBNEW (&objfile->per_bfd->storage_obstack, struct stap_probe);
ret->p.pops = &stap_probe_ops;
- ret->p.objfile = objfile;
+ ret->p.arch = gdbarch;
/* Provider and the name of the probe. */
ret->p.provider = (char *) &el->data[3 * size];
ret->p.name = memchr (ret->p.provider, '\0',
(char *) el->data + el->size - ret->p.provider);
/* Making sure there is a name. */
- if (!ret->p.name)
+ if (ret->p.name == NULL)
{
complaint (&symfile_complaints, _("corrupt probe name when "
"reading `%s'"),
/* Semaphore address. */
ret->sem_addr = extract_typed_address (&el->data[2 * size], ptr_type);
- ret->p.address += (ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT (objfile))
- + base - base_ref);
- if (ret->sem_addr)
- ret->sem_addr += (ANOFFSET (objfile->section_offsets,
- SECT_OFF_DATA (objfile))
- + base - base_ref);
+ ret->p.address += base - base_ref;
+ if (ret->sem_addr != 0)
+ ret->sem_addr += base - base_ref;
/* Arguments. We can only extract the argument format if there is a valid
name for this probe. */
if (probe_args != NULL)
++probe_args;
- if (probe_args == NULL || (memchr (probe_args, '\0',
- (char *) el->data + el->size - ret->p.name)
- != el->data + el->size - 1))
+ if (probe_args == NULL
+ || (memchr (probe_args, '\0', (char *) el->data + el->size - ret->p.name)
+ != el->data + el->size - 1))
{
complaint (&symfile_complaints, _("corrupt probe argument when "
"reading `%s'"),
bfd_map_over_sections (obfd, get_stap_base_address_1, (void *) &ret);
- if (!ret)
+ if (ret == NULL)
{
complaint (&symfile_complaints, _("could not obtain base address for "
"SystemTap section on objfile `%s'."),
return 0;
}
- if (base)
+ if (base != NULL)
*base = ret->vma;
return 1;
return;
}
- if (!elf_tdata (obfd)->sdt_note_head)
+ if (elf_tdata (obfd)->sdt_note_head == NULL)
{
/* There isn't any probe here. */
return;
}
/* Parsing each probe's information. */
- for (iter = elf_tdata (obfd)->sdt_note_head; iter; iter = iter->next)
+ for (iter = elf_tdata (obfd)->sdt_note_head;
+ iter != NULL;
+ iter = iter->next)
{
/* We first have to handle all the information about the
probe which is present in the section. */
}
}
-static void
-stap_relocate (struct probe *probe_generic, CORE_ADDR delta)
-{
- struct stap_probe *probe = (struct stap_probe *) probe_generic;
-
- gdb_assert (probe_generic->pops == &stap_probe_ops);
+/* Implementation of the type_name method. */
- probe->p.address += delta;
- if (probe->sem_addr)
- probe->sem_addr += delta;
+static const char *
+stap_type_name (struct probe *probe)
+{
+ gdb_assert (probe->pops == &stap_probe_ops);
+ return "stap";
}
static int
gdb_assert (probe_generic->pops == &stap_probe_ops);
- gdbarch = get_objfile_arch (probe->p.objfile);
+ gdbarch = probe->p.arch;
- if (probe->sem_addr)
+ if (probe->sem_addr != 0)
val = print_core_address (gdbarch, probe->sem_addr);
VEC_safe_push (const_char_ptr, *ret, val);
/* SystemTap probe_ops. */
-static const struct probe_ops stap_probe_ops =
+const struct probe_ops stap_probe_ops =
{
stap_probe_is_linespec,
stap_get_probes,
- stap_relocate,
+ stap_get_probe_address,
stap_get_probe_argument_count,
stap_can_evaluate_probe_arguments,
stap_evaluate_probe_argument,
stap_set_semaphore,
stap_clear_semaphore,
stap_probe_destroy,
+ stap_type_name,
stap_gen_info_probes_table_header,
stap_gen_info_probes_table_values,
+ NULL, /* enable_probe */
+ NULL /* disable_probe */
};
/* Implementation of the `info probes stap' command. */
show_stapexpressiondebug,
&setdebuglist, &showdebuglist);
- create_internalvar_type_lazy ("_probe_argc", &probe_funcs,
- (void *) (uintptr_t) -1);
- create_internalvar_type_lazy ("_probe_arg0", &probe_funcs,
- (void *) (uintptr_t) 0);
- create_internalvar_type_lazy ("_probe_arg1", &probe_funcs,
- (void *) (uintptr_t) 1);
- create_internalvar_type_lazy ("_probe_arg2", &probe_funcs,
- (void *) (uintptr_t) 2);
- create_internalvar_type_lazy ("_probe_arg3", &probe_funcs,
- (void *) (uintptr_t) 3);
- create_internalvar_type_lazy ("_probe_arg4", &probe_funcs,
- (void *) (uintptr_t) 4);
- create_internalvar_type_lazy ("_probe_arg5", &probe_funcs,
- (void *) (uintptr_t) 5);
- create_internalvar_type_lazy ("_probe_arg6", &probe_funcs,
- (void *) (uintptr_t) 6);
- create_internalvar_type_lazy ("_probe_arg7", &probe_funcs,
- (void *) (uintptr_t) 7);
- create_internalvar_type_lazy ("_probe_arg8", &probe_funcs,
- (void *) (uintptr_t) 8);
- create_internalvar_type_lazy ("_probe_arg9", &probe_funcs,
- (void *) (uintptr_t) 9);
- create_internalvar_type_lazy ("_probe_arg10", &probe_funcs,
- (void *) (uintptr_t) 10);
- create_internalvar_type_lazy ("_probe_arg11", &probe_funcs,
- (void *) (uintptr_t) 11);
-
add_cmd ("stap", class_info, info_probes_stap_command,
_("\
Show information about SystemTap static probes.\n\