This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: Hitachi djprobe mechanism
- From: mathieu lacage <Mathieu dot Lacage at sophia dot inria dot fr>
- To: mathieu lacage <Mathieu dot Lacage at sophia dot inria dot fr>
- Cc: systemtap at sources dot redhat dot com
- Date: Mon, 07 Nov 2005 11:04:40 +0100
- Subject: Re: Hitachi djprobe mechanism
- References: <20051008232357.847DC180E25@magilla.sf.frob.com> <43621B0D.70204@sophia.inria.fr>
hi,
I was interested enough that I hacked together the attached patch (I
used gcc svn HEAD and binutils cvs HEAD). It seems to work nicely with
-O0 but it seems to break on the simple testcase below with -O2/-O3 on
x86. i.e., it reports a bb boundary at 0x11 and I cannot see why there
would be a bb boundary there.
Also, I noticed that if you want to use this code for djprobe insertion
location verification, you will need to parse the resulting binary
anyway to detect the call sites which are not really bb boundaries and
are thus not reported by the patch as bb boundaries but which are
forbidden boundary locations for djprobe insertion.
I will do a lot more testing in a few days but I thought it might be
useful to send an early report.
regards,
Mathieu
#include <stdio.h>
static int foo (void)
{
if (3) {
int i = 0;
while (i < 100) {
printf ("test\n");
i++;
}
}
return 8;
}
int main (int argc, char *argv[])
{
foo ();
return 0;
}
Here, I get the following list of basic blocks with the debugging
information:
ad: 0x0
ad: 0x11
ad: 0x20
ad: 0x32
while the assembly output does not seem to contain any jump to 0x11:
00000000 <main>:
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl 0xfffffffc(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 53 push %ebx
e: 31 db xor %ebx,%ebx
10: 51 push %ecx
11: 83 ec 10 sub $0x10,%esp
14: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
1a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
20: c7 04 24 00 00 00 00 movl $0x0,(%esp)
27: 43 inc %ebx
28: e8 fc ff ff ff call 29 <main+0x29>
2d: 83 fb 64 cmp $0x64,%ebx
30: 75 ee jne 20 <main+0x20>
32: 83 c4 10 add $0x10,%esp
35: 31 c0 xor %eax,%eax
37: 59 pop %ecx
38: 5b pop %ebx
39: 5d pop %ebp
3a: 8d 61 fc lea 0xfffffffc(%ecx),%esp
3d: c3 ret
Richard Henderson has done some work in both gcc and the assembler to
emit
DWARF basic block markers. The compiler knows what the jump targets
are in
code it generates. For inline assembly, the assembler supports
emitting a