Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Mathieu Lacage <Mathieu.Lacage@sophia.inria.fr>
To: John Zoidberg <the.real.doctor.zoidberg@gmail.com>
Cc: Andrew STUBBS <andrew.stubbs@st.com>, gdb@sourceware.org
Subject: Re: Log every call and exit in embedded system
Date: Tue, 27 Mar 2007 11:56:00 -0000	[thread overview]
Message-ID: <1174996577.3988.22.camel@garfield.inria.fr> (raw)
In-Reply-To: <adbca6b50703270407qf1be45cr29c39df513c779fe@mail.gmail.com>

On Tue, 2007-03-27 at 12:07 +0100, John Zoidberg wrote:

> Your tool seems very interesting, it's unfortunate it's not ready for
> embedded systems.
> On the documentation you mention malloc, but some embedded systems
> don't have the code for malloc. Moreover, no embedded system uses
> glibc, it uses newlib, uclib, and others... this means that the code
> that is linked may not have the support for it (i.e. there are missing
> functions).
> There is the issue of the target code (the part that is linked to the
> application) must be compiled with the corresponding GCC (for the
> target system).
> And besides all this, there is the issue of where to log the
> information or how to send it.

The way I have implemented this is that I store in a circular buffer
(one per user thread) the address of the function. Then, I have another
thread (the manager thread) which reads data from every circular buffer
and writes it in a global log file. It also stores in this global log
file the memory map of your program whenever it changes because of a
dlopen. The thread stuff is really an optimization to avoid as much as
possible locking from the user program if I can avoid it: you could
write into the log file directly from the __cyg_* functions.

And then, there is a post-processing tool which reads the binary log and
generates a human-readable output based on the program memory map, the
symbol addresses and the debugging information found in the binaries.

There is some platform-specific code to make sure that I am notified
upon every memory map change (I place an int3 breakpoint in the r_debug
data structure to get link map changes through a unix signal). You could
avoid this problem by simply scanning the link map all the time whenever
you write a new symbol in the log file.


Mathieu
-- 


  reply	other threads:[~2007-03-27 11:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-24 20:05 John Zoidberg
2007-03-24 22:20 ` Daniel Jacobowitz
2007-03-26 10:04 ` Andrew STUBBS
2007-03-26 10:23   ` mathieu lacage
2007-03-27 11:07     ` John Zoidberg
2007-03-27 11:56       ` Mathieu Lacage [this message]
2007-03-26 21:33 ` Michael Snyder
2007-03-27  9:56   ` John Zoidberg

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=1174996577.3988.22.camel@garfield.inria.fr \
    --to=mathieu.lacage@sophia.inria.fr \
    --cc=andrew.stubbs@st.com \
    --cc=gdb@sourceware.org \
    --cc=the.real.doctor.zoidberg@gmail.com \
    /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