public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Jim Ingham <jingham@apple.com>
To: Xinan Tang <xinan@TidalNetworks.net>
Cc: gdb@sources.redhat.com
Subject: Re: breakpoint instruction isn't shown in disassemble or examine (x) commands?
Date: Thu, 30 Sep 2004 17:56:00 -0000	[thread overview]
Message-ID: <0470AA52-130A-11D9-85DF-000A958F4C44@apple.com> (raw)
In-Reply-To: <52BBA75459915749B68F93B604B636CD0D421E@neptune.TidalNetworks.net>

"debug target" should show you all the reads & writes to a simulator.  
If you are connecting to the target with gdb's remote protocol, you can 
also use

(gdb) set debug remote on

to watch the gdb remote protocol communications.

Do:

(gdb) help set debug

to see what sorts of debugging options are available for your gdb.

Jim

On Sep 30, 2004, at 10:42 AM, Xinan Tang wrote:

> Hi
>
>   If an ISA simulator is used, how could we do the same way as to the 
> remote target in order to keep track of communication between GDB and 
> the inferior ISA?
>
> Thanks
>
> --Xinan
>
>
> -----Original Message-----
> From: gdb-owner@sources.redhat.com on behalf of Jim Ingham
> Sent: Thu 9/30/2004 10:30 AM
> To: gdb@sources.redhat.com
> Subject: Re: breakpoint instruction isn't shown in disassemble or 
> examine (x) commands?
>
> gdb will always hide the breakpoint trap from you, and show you the
> instruction that is actually going to be run when you get to that pc
> instead.  This is on purpose, it would be very confusing, and not at
> all helpful, for folks to see trap instructions showing up in their
> disassembly.
>
> Is there some reason, other than curiosity, the leads you to want to
> see the trap there?
>
> If you are just curious, try running gdb with:
>
> (gdb) set debug target 1
>
> You can see gdb copy out the actual instruction and lay down the traps,
> and lots of other things you may or may not want to know about...
>
> Jim
>
> On Sep 29, 2004, at 11:36 PM, gdb-digest-help@sources.redhat.com wrote:
>
> >
> >
> > Hi,
> >
> > I am trying to understand the inner workings of a debugger and I 
> found
> > a gdb behaviour that puzzles me.
> >
> > I understand that if I set a software breakpoint (as opposed to
> > an hw breakpoint), gdb will insert an architecture-dependent
> > instruction
> > in the .text section that will cause an exception, that will be 
> handled
> > by gdb.
> >
> > I am using gdb 6.1.1 on FreeBSD i386, so looking at the gdb source,
> > the i386 has the breakpoint instruction 0xcc.
> >
> > I tought of doing something like (in various incantations):
> >
> > (gdb) disassemble foo
> > (gdb) break foo
> > (gdb) disassemble foo
> >
> > and was expecting of seeing the 0xcc instruction in the output of
> > the second disassemble command; instead the output is the same
> > as the first disassemble. Same results with the x command.
> > It seems that gdb wants to "protect" me from seing that the 
> executable
> > is changed?
> >
> > Finally I came up with a function that scans the .text section of
> > the same program (a sort of very naive debugger detector)
> > and hex dumps it. I ran the same program with and without
> > breakpoint and my scan function works as expected: when the 
> breakpoint
> > is
> > set I see it in the hex dump.
> >
> > So somehow I have my sanity back, but the question remains: how
> > can I see the breakpoint instruction from gdb itself?
> >
> > thanks
> > marco
> > --
> > panic("The moon has moved again.");
> >
>
>
>

       reply	other threads:[~2004-09-30 17:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <52BBA75459915749B68F93B604B636CD0D421E@neptune.TidalNetworks.net>
2004-09-30 17:56 ` Jim Ingham [this message]
     [not found] <1096526181.3491.ezmlm@sources.redhat.com>
2004-09-30 17:30 ` Jim Ingham
2004-09-30 19:39   ` Marco Molteni
2004-09-29 23:05 Marco Molteni
2004-09-30 14:49 ` Eli Zaretskii
2004-09-30 19:36   ` Marco Molteni

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=0470AA52-130A-11D9-85DF-000A958F4C44@apple.com \
    --to=jingham@apple.com \
    --cc=gdb@sources.redhat.com \
    --cc=xinan@TidalNetworks.net \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).