ctfdwdiff: Simple shell script for testing the CTF encoder/decoder

First it gets a file with DWARF info, converts that to CTF and adds
a ".SUNW_ctf" ELF section to the file with DWARF info. Double debugging
foo! Pay for one, take two!

For tcp_input.o for instance, the result is:

[acme@doppio pahole]$ cat /tmp/tcp_input.o.diff
--- /tmp/tcp_input.o.ctf.c	2009-03-19 19:48:23.000000000 -0300
+++ /tmp/tcp_input.o.dwarf.c	2009-03-19 19:48:23.000000000 -0300
@@ -1811,7 +1811,7 @@

 	/* XXX 6 bytes hole, try to pack */

-	void (*call)(const struct marker *, void *);	  /* 24  8 */
+	void (*call)(const struct marker *, void *, ...); /* 24  8 */
 	struct marker_probe_closure single;		  /* 32 16 */
 	struct marker_probe_closure * multi;		  /* 48  8 */
 	const char  *               tp_name;		  /* 56  8 */
[acme@doppio pahole]$

Now back to figuring out how to encode a VARARGS marker in CTF...

Ah, to use the script just do:

./ctfdwdiff foo.o

Some will crash, but we're working hard for fuller customer
satisfaction.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2009-03-19 19:50:09 -03:00
parent dcef613288
commit 82d5dbe637
1 changed files with 8 additions and 0 deletions

8
ctfdwdiff Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
obj=$1
pahole -Z $obj
pahole -F ctf $obj > /tmp/$obj.ctf.c
pahole -F dwarf $obj > /tmp/$obj.dwarf.c
diff -u /tmp/$obj.ctf.c /tmp/$obj.dwarf.c > /tmp/$obj.diff
vim /tmp/$obj.diff