Re: [fusil] [PATCH] itrace tool

[ Thread Index | Date Index | More lists.tuxfamily.org/fusil Archives ]


Victor Stinner <victor.stinner@xxxxxxxxxxxxx> wrote:

> > Here is a tool which I have been using to debug libc startup code
> > where I didn't find gdb very helpful.
> 
> Wow. Are you debugging the libc??

I'm porting glibc to Google Native Client (NaCl) [1].

> > It single steps the process and prints each instruction pointer address.  
> > To go faster, it allows a number of syscalls to run before 
> > starting single-stepping. 
>
> With no option, your script "skip" all syscalls (just print a
> counter). Is it the expected behaviour?

Yes.  The use case was that I run it once to see how many syscalls it
does before segfaulting, and then run it again with the syscall limit.
Obviously this could be automated.  Initially I just changed strace.py
directly; itrace.py is a tidied up version of those changes.

> I don't think that this script would be reused by anyone else, but
> who knows? So I pushed it into examples/itrace.py with your email as
> the documentation.

Thanks.

> > It's possible to pipe the addresses through addr2line to get a very
> > simple tracing debugger. :-)
> 
> Yeah, but it would be easier to integrate addr2line (or anything else) 
> directly into python-ptrace. A friend told me that he wrote an ELF parser in 
> Python. We can maybe reuse it... or libbfd, or elfsh, or ...

Well, strictly speaking piping through addr2line is easier because I
have already done it. :-)  It's easier than looking up the addresses by
hand in the disassembly from objdump -d, which is what I was doing
before. :-)

> Note about itrace.py: it's a little strange to reuse the strace.py *program* 
> (instead of a Python *library*). But it works, so, it's ok ;-)

Yeah.  I had hoped to print the syscalls properly but I will need to
read the code more to work out how.  I usually avoid implementation
inheritance but inheriting from Application seemed to be necessary to
reuse the code.

Cheers,
Mark

[1] http://lackingrhoticity.blogspot.com/2009/01/what-does-nacl-mean-for-plash.html



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/