From: Karim Yaghmour <karim@opersys.com>
To: Werner Almesberger <wa@almesberger.net>
Cc: linux-kernel@vger.kernel.org, LTT-Dev <ltt-dev@shafik.org>
Subject: Re: [RFC/FYI] reliable markers (hooks/probes/taps/...)
Date: Sat, 05 Apr 2003 12:10:07 -0500 [thread overview]
Message-ID: <3E8F0DEF.C50FB29C@opersys.com> (raw)
In-Reply-To: 20030404224652.A19288@almesberger.net
Werner Almesberger wrote:
>
> I wrote:
> > Here's a pretty light-weight approach I call "reliable markers":
>
> Turns out that the memory clobber didn't make them particularly
> reliable. Here's a better version. Usage:
>
> MARKER(label_name,var...);
>
> Where var... is an optional comma-separated list of arguments or
> variables that may be accessed (read or modified) while at this
> breakpoint.
>
> (This is just for demonstration. For serious use, one would generate
> a markers.h that can handle more than just four arguments.)
Very interesting.
We've already got a small program that does this for LTT statements
which we plan to use in the future: genevent.
http://www.listserv.shafik.org/pipermail/ltt-dev/2003-January/000408.html
genevent is pretty much straight forward. You type:
$ ./genevent default.event
$ ls default*
-rw-rw-r-- 1 karim karim 392 Apr 5 11:58 default.c
-rw-rw-r-- 1 karim karim 6892 Apr 5 11:56 default.event
-rw-rw-r-- 1 karim karim 18328 Apr 5 11:58 default.h
The default.event file contains declarations about each event. Here's
an example:
//TRACE_EV_SYSCALL_ENTRY
event(TRACE_EV_SYSCALL_ENTRY, "Entry in a given system call",
field(syscall_id, "Syscall entry number in entry.S", uint(1)),
field(address, "Address from which call was made", uint(4))
);
And genevent creates the following entries in the default.h for it:
/**** structure and trace function for event: TRACE_EV_SYSCALL_ENTRY ****/
__attribute__((packed)) struct TRACE_EV_SYSCALL_ENTRY_default_1{
uint8_t syscall_id; /* Syscall entry number in entry.S */
uint32_t address; /* Address from which call was made */
};
static inline void trace_default_TRACE_EV_SYSCALL_ENTRY(uint8_t syscall_id, uint32_t address){
int bufLength = sizeof(struct TRACE_EV_SYSCALL_ENTRY_default_1);
char buff[bufLength];
struct TRACE_EV_SYSCALL_ENTRY_default_1 * __1 = (struct TRACE_EV_SYSCALL_ENTRY_default_1 *)buff;
//initialize structs
__1->syscall_id = syscall_id;
__1->address = address;
//call trace function
trace_new(facility_default, TRACE_EV_SYSCALL_ENTRY, bufLength, buff);
};
Also, genevent automatically generates an enum for all the events
described in the .event file:
enum default_event {
TRACE_EV_START,
TRACE_EV_SYSCALL_ENTRY,
TRACE_EV_SYSCALL_EXIT,
TRACE_EV_TRAP_ENTRY,
...
Obviously the word "trace" is used throughout, but it can easily be
replaced by "marker" if this mechanism were generalized.
The intent is to have a .event file in every directory where there are
traced events in files (which are the equivalent of "markers" in your
scheme). During the build, the various headers would be created and
all the code would be generated on the fly.
Of course this is just a begining. We're open to suggestions and
contributions.
Cheers,
Karim
===================================================
Karim Yaghmour
karim@opersys.com
Embedded and Real-Time Linux Expert
===================================================
next prev parent reply other threads:[~2003-04-05 17:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-03 10:07 [RFC/FYI] reliable markers (hooks/probes/taps/...) Werner Almesberger
2003-04-05 1:46 ` Werner Almesberger
2003-04-05 17:10 ` Karim Yaghmour [this message]
2003-04-05 22:02 ` Werner Almesberger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3E8F0DEF.C50FB29C@opersys.com \
--to=karim@opersys.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ltt-dev@shafik.org \
--cc=wa@almesberger.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox