From: Jan Kiszka <jan.kiszka@domain.hid>
To: rpm@xenomai.org
Cc: xenomai-core <xenomai@xenomai.org>
Subject: [Xenomai-core] Less invasive usystrace (was: [ANNOUNCE] Xenomai and I-pipe patch series)
Date: Tue, 05 Jun 2007 20:17:31 +0200 [thread overview]
Message-ID: <4665A8BB.4020605@domain.hid> (raw)
In-Reply-To: <1181036642.32137.79.camel@domain.hid>
[-- Attachment #1: Type: text/plain, Size: 2589 bytes --]
Philippe Gerum wrote:
>>> (*) You could avoid passing the function name in the systrace calls, by
>>> relying on the value of __FUNCTION__, with a small hack to trimm the
>>> __wrap_ prefix when needed. Making tracepoints less hairy would ease my
>>> pain reading this stuff.
>> OK, but let's not spend brain cycles on this until we know if and how we
>> can separate the entry/exit tracing from the traced service. If we could
>> leave existing lib code untouched, I would be happier as well.
>>
>
> It does matter because it reduce visual clutter, and that's a
> prerequisite for merging, that's why I'm suggesting it.
> We already have an automated instrumentation tool for the simulator, but
> I'm not sure automatically inserted tracepoints would always be relevant
> in all cases.
Doesn't it rely on a patched gcc? Here is a suggestion for an
instrumentation procedure based on standard tools:
lib.h:
------
int my_lib_func(int arg1, const char *arg2);
lib.c:
------
int my_lib_func(int arg1, const char *arg2)
{
return 13;
}
main.c:
-------
#include <stdio.h>
#include "lib.h"
main()
{
printf("my_lib_func = %d\n",
my_lib_func(1, "hello"));
}
So far, so ordinary. Now we add entry/exit tracing for my_lib_func:
trace.c
-------
#include <stdio.h>
#include "lib.h"
int __trace_my_lib_func(int arg1, const char *arg2)
{
int ret;
printf("entry: arg1 = %d, arg2 = %s\n", arg1, arg2);
ret = my_lib_func(arg1, arg2);
printf("exit: ret = %d\n", ret);
return ret;
}
Makefile:
---------
ifneq (,$(TRACE))
TRACELIB=trace.o
endif
main: main.c lib.o
lib.o: lib.c $(TRACELIB)
gcc -c -o $@ $<
ifneq (,$(TRACE))
ld -r -o $@.tmp $@ $(TRACELIB)
objcopy --redefine-sym my_lib_func=__orig_my_lib_func \
--redefine-sym __trace_my_lib_func=my_lib_func $@.tmp $@
rm -f $@.tmp
endif
clean:
rm -f *.o main
Build with "make TRACE=1" to get the traced variant, or call "make" for
non-traced mode.
This means we have a switch in the build process, we don't need to touch
the library sources. We only have to add a __trace_xxx() version for
every xxx() that can even use original headers to call into the original
service. Converting the Makefile stuff into something more handy for
autotools shouldn't be tricky.
There is just one no-go: functions with variable argument lists.
Fortunately, the only one that comes into my mind right now,
[rtdm_]ioctl(), has a single well-known "unknown" argument and needs to
be unrolled unconditionally anyway.
What do you think?
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]
next prev parent reply other threads:[~2007-06-05 18:17 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-28 11:31 [Xenomai-core] [ANNOUNCE] Xenomai and I-pipe patch series, LTTng bits Jan Kiszka
2007-05-31 16:52 ` Philippe Gerum
2007-05-31 20:39 ` Jan Kiszka
2007-05-31 22:43 ` Philippe Gerum
2007-05-31 22:47 ` Philippe Gerum
2007-06-01 6:55 ` Jan Kiszka
2007-06-02 11:49 ` ROSSIER Daniel
2007-06-05 8:27 ` Philippe Gerum
2007-06-05 9:14 ` Jan Kiszka
2007-06-05 9:44 ` Philippe Gerum
2007-06-05 18:17 ` Jan Kiszka [this message]
2007-06-05 18:34 ` [Xenomai-core] Less invasive usystrace Jan Kiszka
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=4665A8BB.4020605@domain.hid \
--to=jan.kiszka@domain.hid \
--cc=rpm@xenomai.org \
--cc=xenomai@xenomai.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.