Skip to content

Commit

Permalink
Make stack trace use dctx->mem to store stack trace data
Browse files Browse the repository at this point in the history
The stack trace implementation was using an offset into the dctx->buf
memory space to store the stack trace data.  Now that we have a generic
scratch memory area that can be referenced as dctx->mem, the stack
trace implementation has been adjusted to make use of that.

This patch also contains a tiny fix to the tst.stack_fbt.x script to
use /bin/bash because it depends on bash specific features.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
  • Loading branch information
kvanhees committed Aug 27, 2021
1 parent 1e19a7a commit 55902ec
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 10 deletions.
3 changes: 1 addition & 2 deletions bpf/get_bvar.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ extern struct bpf_map_def probes;
extern struct bpf_map_def state;

extern uint64_t STBSZ;
extern uint64_t STKOFF;
extern uint64_t STKSIZ;
extern uint64_t BOOTTM;

Expand Down Expand Up @@ -60,7 +59,7 @@ noinline uint64_t dt_get_bvar(dt_dctx_t *dctx, uint32_t id)
case DIF_VAR_USTACKDEPTH: {
uint32_t bufsiz = (uint32_t) (uint64_t) (&STKSIZ);
uint64_t flags = 0 & BPF_F_SKIP_FIELD_MASK;
char *buf = ((char *) dctx->buf) + ((uint64_t) &STKOFF);
char *buf = dctx->mem;
uint64_t stacksize;

if (id == DIF_VAR_USTACKDEPTH)
Expand Down
5 changes: 2 additions & 3 deletions libdtrace/dt_bpf.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ extern "C" {
#define DT_CONST_ARGC 4
#define DT_CONST_STBSZ 5
#define DT_CONST_STRSZ 6
#define DT_CONST_STKOFF 7
#define DT_CONST_STKSIZ 8
#define DT_CONST_BOOTTM 9
#define DT_CONST_STKSIZ 7
#define DT_CONST_BOOTTM 8

extern int perf_event_open(struct perf_event_attr *attr, pid_t pid, int cpu,
int group_fd, unsigned long flags);
Expand Down
3 changes: 0 additions & 3 deletions libdtrace/dt_cc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2352,9 +2352,6 @@ dt_link_construct(dtrace_hdl_t *dtp, const dt_probe_t *prp, dtrace_difo_t *dp,
nrp->dofr_data =
dtp->dt_options[DTRACEOPT_STRSIZE];
continue;
case DT_CONST_STKOFF:
nrp->dofr_data = roundup(dtp->dt_maxreclen, 8);
continue;
case DT_CONST_STKSIZ:
nrp->dofr_data = sizeof(uint64_t)
* dtp->dt_options[DTRACEOPT_MAXFRAMES];
Expand Down
1 change: 0 additions & 1 deletion libdtrace/dt_dlibs.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ static const dt_ident_t dt_bpf_symbols[] = {
DT_BPF_SYMBOL_ID(ARGC, DT_IDENT_SCALAR, DT_CONST_ARGC),
DT_BPF_SYMBOL_ID(STBSZ, DT_IDENT_SCALAR, DT_CONST_STBSZ),
DT_BPF_SYMBOL_ID(STRSZ, DT_IDENT_SCALAR, DT_CONST_STRSZ),
DT_BPF_SYMBOL_ID(STKOFF, DT_IDENT_SCALAR, DT_CONST_STKOFF),
DT_BPF_SYMBOL_ID(STKSIZ, DT_IDENT_SCALAR, DT_CONST_STKSIZ),
DT_BPF_SYMBOL_ID(BOOTTM, DT_IDENT_SCALAR, DT_CONST_BOOTTM),
/* End-of-list marker */
Expand Down
2 changes: 1 addition & 1 deletion test/unittest/stack/tst.stack_fbt.x
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

read MAJOR MINOR <<< `uname -r | awk -F. '{print $1, $2}'`
Expand Down

0 comments on commit 55902ec

Please sign in to comment.