Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@redhat.com>
To: gdb@sources.redhat.com
Cc: jnordby@caspiannetworks.com
Subject: Re: Searching for pattern in memory from GDB?
Date: Thu, 11 Apr 2002 14:45:00 -0000	[thread overview]
Message-ID: <3CB5FE36.2DF1449F@redhat.com> (raw)
In-Reply-To: <3CB1E451.CFCA2BE2@caspiannetworks.com>

James Nordby wrote:
> 
> 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?

Or, you could just write a gdb macro, something like

define search
  set $start = (char *) $arg0
  set $end = (char *) $arg1
  set $pattern = (int) $arg2
  set $p = $start
  while $p < $end
    if (*(int *) $p) == $pattern
      printf "pattern 0x%x found at 0x$x\n", $pattern, $p
    end
    set $p++
  end
end


  parent reply	other threads:[~2002-04-11 21:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-08 11:41 James Nordby
2002-04-08 11:47 ` Daniel Jacobowitz
2002-04-11 14:45 ` Michael Snyder [this message]
2002-04-08 12:12 Michael Elizabeth Chastain

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=3CB5FE36.2DF1449F@redhat.com \
    --to=msnyder@redhat.com \
    --cc=gdb@sources.redhat.com \
    --cc=jnordby@caspiannetworks.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