public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Re: breakpoint insert API (was: A patch for ia32 hardware watchpoint.)
@ 2000-03-13  1:50 Stephane.Bihan
  2000-03-14 14:47 ` J.T. Conklin
  2000-04-01  0:00 ` Stephane.Bihan
  0 siblings, 2 replies; 34+ messages in thread
From: Stephane.Bihan @ 2000-03-13  1:50 UTC (permalink / raw)
  To: Todd Whitesel; +Cc: GDB, jtc

> > One issue that I'm not sure how to address is that there are several
> > places breakpoints are inserted where a breakpoint has not been
> > constructed.  Most of these occur in tdep code which implements single
> > step with breakpoints on processors without a trace mode.
>
> Aiee! Such code is evil and must be destroyed.

It seems to me that this single_step function is actually not in use.
I don't know about WindRiver, but here we have two targets: an ISS and a
remote target that use the generic breakpoint functions before stepping.
I don't mind to remove this code.

>
> One important value of the full breakpoint machinery is that it can help
> avoid the same location being patched twice. Any time we patch the same
> instruction twice, we must un-patch it in exactly reverse order or else
> we leave a breakpoint instruction sitting in the code -- Not Good.
>
> So I would have to argue that the singlestep logic must either happen at a
> really low level (this guarantees it will patch last and un-patch first) or
> must go through the real breakpoint logic which can do duplicate detection.
>

----------------------------------------------------------------
Stephane Bihan
ARC Cores Ltd            http://www.arccores.com

^ permalink raw reply	[flat|nested] 34+ messages in thread
* Re: breakpoint insert API (was: A patch for ia32 hardware watchpoint.)
@ 2000-03-15  9:07 Stephane.Bihan
  2000-04-01  0:00 ` Stephane.Bihan
  0 siblings, 1 reply; 34+ messages in thread
From: Stephane.Bihan @ 2000-03-15  9:07 UTC (permalink / raw)
  To: jtc; +Cc: gdb

>
> Stephane> I also use the breakpoint structure as an extern variable. I
> Stephane> needed it to implement the set_hw_breakpoint routine for the
> Stephane> remote protocol.  I think it's not the nicer way to do but
> Stephane> ....
>
> Can you explain?  I don't see any use of struct breakpoint in the
> current arc-tdep.c, nor do I see a set_hw_breakpoint function?

The version at FSF is a very old version out of date.
I am currently extending gdb for ARC to support user extensions.

>
> >> Since you say you can remove the single step code, I assume that the
> >> ISS target and remote protocol agents can perform the single step by
> >> themselves?  If so, it would be advantageous to disable GDB's single
> >> step support.  GDB would then issue a single "step" command instead of
> >> "insert breakpoint(s)", "continue", and "remove breakpoint(s)".  The
> >> latency of a step should be greatly improved.
>
> Stephane> I will implement this for the remote target only since the
> Stephane> hardware supports single-stepping.  I'm not sure if this
> Stephane> feasible in the ISS - Yuri?
>
> Stephane> If not feasible I won't disable the GDB's single step
> Stephane> support (thus enabling a call to single_step()) but I will
> Stephane> implement a single_step call to gdbstub in remote_resume().
>
> If your ISS target cannot support single step, but the remote protocol
> can, perhaps the best thing is to make software single step a target
> specific option.

By creating a target specific command?
The single step mechanism is a not a step-over-calls mechanism.

>
> I don't think that the arc is the only processor that would benefit
> from such a change.  For example, the sparclet ROM monitor supports a
> single step command, but I do not know if it is ever issued because
> the SPARC target uses software single step.  Perhaps it inserts the
> trap instructions needed for single step and issues the monitor step
> command?
>
> I do not think it's possible for any change to remote_resume() to be
> the right solution.
>
You're right, I've tried and if does not work.
Thanks for your explanations anyway.

Stephane.

----------------------------------------------------------------
Stephane Bihan
ARC Cores Ltd            http://www.arccores.com

^ permalink raw reply	[flat|nested] 34+ messages in thread
* Re: breakpoint insert API (was: A patch for ia32 hardware watchpoint.)
@ 2000-03-15  4:21 Stephane.Bihan
  2000-03-15  7:51 ` J.T. Conklin
  2000-04-01  0:00 ` Stephane.Bihan
  0 siblings, 2 replies; 34+ messages in thread
From: Stephane.Bihan @ 2000-03-15  4:21 UTC (permalink / raw)
  To: jtc; +Cc: Yuri Karlsbrun, gdb

> >>>>> "Stephane" == Stephane Bihan <Stephane.Bihan@arccores.com> writes:
>
> jtc> One issue that I'm not sure how to address is that there are several
> jtc> places breakpoints are inserted where a breakpoint has not been
> jtc> constructed.  Most of these occur in tdep code which implements single
> jtc> step with breakpoints on processors without a trace mode.
>
> Todd> Aiee! Such code is evil and must be destroyed.
>
> Stephane> It seems to me that this single_step function is actually
> Stephane> not in use.  I don't know about WindRiver, but here we have
> Stephane> two targets: an ISS and a remote target that use the generic
> Stephane> breakpoint functions before stepping.  I don't mind to
> Stephane> remove this code.
>
> I assume you are refering to the ARC port?

yes. But I was actually wrong in my last email, the single step function in
arc-tdep is
used, I was thinking to another function, sorry.
What do you mean by breakpoint without a trace mode?

>
> I see three GDB ports that do single step in software: arc, rs6000,
> and sparc.  The arc and sparc ports, insert breakpoints with target-
> _insert_breakpoint().  The rs6000 port by reading and writing memory
> directly.  Of the two methods, I prefer target_insert_breakpoint().
>
> However, if the breakpoint insert/remove API was changed to require a
> struct breakpoint pointer, we couldn't call target_insert_breakpoint()
> in the foo_single_step() functions without creating a real breakpoint
> object to pass through that first pointer.

I don't know what are the foo_single_step functions.

I also use the breakpoint structure as an extern variable. I needed
it to implement the set_hw_breakpoint routine for the remote protocol.
I think it's not the nicer way to do but ....

> Another reason we might want a real breakpoint for this is that when
> my memory region attribute code is complete we'll be able to say that
> breakpoints in a region should be done with hardware breakpoints.
> A user can debug his/her own code in read-only memory by using hbreak,
> but there is no way to tell GDB to use hardware breakpoints for step,
> next, continue, finish, until, etc.  One thing that surprised me was
> that the single step code used multiple breakpoints.  That would put a
> lot of pressure on hardware breakpoint registers.  I suspect that GDB
> has all the information in order to insert a single breakpoint (by
> evaluating which way a conditional branch will go, etc.).
>

What would be a "real breakpoint"? a pointer to the breakpoint structure?

>
> Since you say you can remove the single step code, I assume that the
> ISS target and remote protocol agents can perform the single step by
> themselves?  If so, it would be advantageous to disable GDB's single
> step support.  GDB would then issue a single "step" command instead of
> "insert breakpoint(s)", "continue", and "remove breakpoint(s)".  The
> latency of a step should be greatly improved.

I will implement this for the remote target only since the hardware supports
single-stepping.
I'm not sure if this feasible in the ISS - Yuri?

If not feasible I won't disable the GDB's single step support (thus enabling a
call to single_step())
but I will implement a single_step call to gdbstub in remote_resume().

Stephane.

----------------------------------------------------------------
Stephane Bihan
ARC Cores Ltd            http://www.arccores.com





^ permalink raw reply	[flat|nested] 34+ messages in thread
* Re: A patch for ia32 hardware watchpoint.
@ 2000-03-08  0:46 Todd Whitesel
  2000-03-09 11:28 ` breakpoint insert API (was: A patch for ia32 hardware watchpoint.) J.T. Conklin
  0 siblings, 1 reply; 34+ messages in thread
From: Todd Whitesel @ 2000-03-08  0:46 UTC (permalink / raw)
  To: jtc; +Cc: H . J . Lu, gdb-patches, GDB

> I was planning to propose that the breakpoint pointer itself be passed
> to the target_{insert,remove}_{break,watch}point() functions, so this
> is as good of time as any.  

I say Just Do It. I am sitting on some local code here that tracks
breakpoints added to the target by a third party, and I ended up needing
the breakpoint shadow field to be available to those functions.

In my code I have functions called "target_better_{insert,remove}_breakpoint"
which take a struct breakpoint * and a CORE_ADDR although the CORE_ADDR is
only needed in a couple cases that show up in the overlay support (IIRC).
Previous users of the regular target_[a-z]*_breakpoint functions have been
changed to use the new ones, and I hack the target stack interface (don't
ask) in order to get the information down to where I need it. If the real
target interface passed the breakpoint pointer down, presto, no more hack.

As far as I'm concerned, passing the breakpoint pointer is the right way
to go; we should get away from the assumption that a target side breakpoint
is an address with some #define'd size, and push that stuff into a default
implementation that can be invoked easily by people writing new target
support.

> The reason I want this is so that GDB's target code can record target-
> specific info about the breakpoint.  For example, if the target gives
> the break/watchpoint an ID, the insert function can record it in the
> breakpoint so it is available for use in the delete function.  Right
> now, my WDB target code inserts a record into a data structure which
> maps WDB's breakpoint IDs with the thread+address when a breakpoint is 
> inserted.  The remove code searches for any breakpoint that matches the
> thread+address and removes that ID.  

I'm doing much the same (except it's more complicated for historical
reasons) to handle WTX breakpoints.

Actually I ended up having a bunch of functions to search the breakpoint
list for a given ID and {delete,insert,remove} it. Since other host programs
can delete my breakpoints, I had to be able to react appropriately when the
removal message showed up.

> Also, while many target vectors report error reasons through errno, 
> it leaves a bad taste in my mouth.  Perhaps this is because we have
> to map target errors into UNIX/POSIX errnos, and there isn't always
> a clean mapping.

Yeah. This is about as bad as crunching target events through unix
signals, something that only ever made sense on ptrace() targets
which couldn't do any better. "But the code lives on"

-- 
Todd Whitesel
toddpw @ windriver.com

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

end of thread, other threads:[~2000-04-01  0:00 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-03-13  1:50 breakpoint insert API (was: A patch for ia32 hardware watchpoint.) Stephane.Bihan
2000-03-14 14:47 ` J.T. Conklin
2000-04-01  0:00   ` J.T. Conklin
2000-04-01  0:00 ` Stephane.Bihan
  -- strict thread matches above, loose matches on Subject: below --
2000-03-15  9:07 Stephane.Bihan
2000-04-01  0:00 ` Stephane.Bihan
2000-03-15  4:21 Stephane.Bihan
2000-03-15  7:51 ` J.T. Conklin
2000-04-01  0:00   ` J.T. Conklin
2000-04-01  0:00 ` Stephane.Bihan
2000-03-08  0:46 A patch for ia32 hardware watchpoint Todd Whitesel
2000-03-09 11:28 ` breakpoint insert API (was: A patch for ia32 hardware watchpoint.) J.T. Conklin
2000-03-09 15:15   ` Jim Kingdon
2000-04-01  0:00     ` Jim Kingdon
2000-03-09 15:33   ` Andrew Cagney
2000-03-09 17:28     ` Todd Whitesel
2000-03-14 15:15       ` J.T. Conklin
2000-03-14 15:31         ` Todd Whitesel
2000-04-01  0:00           ` Todd Whitesel
2000-04-01  0:00         ` J.T. Conklin
2000-04-01  0:00       ` Todd Whitesel
2000-03-14 14:10     ` J.T. Conklin
2000-03-21  2:50       ` Andrew Cagney
2000-04-01  0:00         ` Andrew Cagney
2000-04-01  0:00       ` J.T. Conklin
2000-04-01  0:00     ` Andrew Cagney
2000-03-09 17:33   ` Todd Whitesel
2000-03-14 14:56     ` J.T. Conklin
2000-03-21  3:11       ` Andrew Cagney
2000-03-21  6:10         ` Richard Earnshaw
2000-04-01  0:00           ` Richard Earnshaw
2000-04-01  0:00         ` Andrew Cagney
2000-04-01  0:00       ` J.T. Conklin
2000-04-01  0:00     ` Todd Whitesel
2000-04-01  0:00   ` J.T. Conklin

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).