Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Searching for pattern in memory from GDB?
@ 2002-04-08 11:41 James Nordby
  2002-04-08 11:47 ` Daniel Jacobowitz
  2002-04-11 14:45 ` Michael Snyder
  0 siblings, 2 replies; 4+ messages in thread
From: James Nordby @ 2002-04-08 11:41 UTC (permalink / raw)
  To: gdb


Hi,

I'm trying to put together a fast, internal-circular-buffer-type tracing
package.  I want to get able to extract the traces from either a running
program or a core file, but our binaries are normally sent out stripped.
I thought if I put a word or two with a particular pattern at the
beginning
of the trace buffer, I could look for that with gdb and use gdb to
format
the rest of the buffer.

Do you know of any way to say 'search for pattern in <BSS,heap> space'
in gdb?

If not, can you think of any other way to find a buffer in a stripped
binary?

Thanks,
Jim

P.S. - Please respond to my e-mail addr as well as the list...


^ permalink raw reply	[flat|nested] 4+ messages in thread
* Re: Searching for pattern in memory from GDB?
@ 2002-04-08 12:12 Michael Elizabeth Chastain
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Elizabeth Chastain @ 2002-04-08 12:12 UTC (permalink / raw)
  To: drow, jnordby; +Cc: gdb

You can build your executable file with symbols, then strip the symbols
and ship it.  Then run gdb on the unstripped executable and the core
dump from the stripped executable.

You could do this:

  static char signpost [64];
  sprintf (signpost, "\nFOO_BUFFER_ADDRESS=0x%p\n", foo_buffer_address);

Then when you get the core dump, you can do:

  strings -a core | grep FOO_BUFFER_ADDRESS

If your target operating system(s) support mmap at a fixed address,
then you can mmap to that address.  Obviously that is not portable but
if it works, it works.  That would make it exceptionally easy to attach
to a running process.

Hope this helps,

Michael C


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-04-11 21:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-08 11:41 Searching for pattern in memory from GDB? James Nordby
2002-04-08 11:47 ` Daniel Jacobowitz
2002-04-11 14:45 ` Michael Snyder
2002-04-08 12:12 Michael Elizabeth Chastain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox