Skip to content

Commit

Permalink
Add support for built-in variable ucaller
Browse files Browse the repository at this point in the history
Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
  • Loading branch information
euloh authored and kvanhees committed Jun 18, 2021
1 parent b86caa0 commit 865f5fc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 5 additions & 1 deletion bpf/get_bvar.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,14 @@ noinline uint64_t dt_get_bvar(dt_dctx_t *dctx, uint32_t id)
*/
return stacksize / sizeof(uint64_t);
}
case DIF_VAR_CALLER: {
case DIF_VAR_CALLER:
case DIF_VAR_UCALLER: {
uint64_t flags = 0 & BPF_F_SKIP_FIELD_MASK;
uint64_t buf[2];

if (id == DIF_VAR_UCALLER)
flags |= BPF_F_USER_STACK;

if (bpf_get_stack(dctx->ctx, buf, sizeof(buf), flags) < 0)
return 0;
return buf[1];
Expand Down
1 change: 0 additions & 1 deletion test/unittest/variables/bvar/tst.ucaller.d
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
/* @@xfail: dtv2 */

/*
* ASSERTION: The 'ucaller' variable can be accessed and is not -1.
Expand Down

0 comments on commit 865f5fc

Please sign in to comment.