-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A call to dt_cg_trace(dlp, drp, 1, 666, foo); will trace the value of reg FOO into /sys/kernel/debug/tracing/trace_pipe when dtrace is compiled with debugging=yes. '666' above is a counter value which is also logged in the resulting trace output, to distinguish trace calls from each other. A call to dt_cg_trace(dlp, drp, 0, 666, foo); will trace the immediate value of FOO at codegen time. Under debugging=no this call has no effect and is compiled out. Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
- Loading branch information
1 parent
60082bf
commit bee8e53
Showing
5 changed files
with
60 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#ifdef DEBUGGING | ||
// SPDX-License-Identifier: GPL-2.0 | ||
/* | ||
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. | ||
*/ | ||
#include <linux/bpf.h> | ||
#include <stdint.h> | ||
#include <bpf-helpers.h> | ||
|
||
#ifndef noinline | ||
# define noinline __attribute__((noinline)) | ||
#endif | ||
|
||
noinline void dt_trace_ptr(uint64_t counter, uint64_t ptr) | ||
{ | ||
/* | ||
* Can't use a straight string constant: DTrace cannot yet process | ||
* rodata relocs. | ||
*/ | ||
char fmt[] = "debug: %d: %lx\n"; | ||
bpf_trace_printk(fmt, 16, counter, ptr); | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters