* x86 hardware breakpoint question
@ 2001-11-04 14:28 Steven Bauer
2001-11-05 6:38 ` Eli Zaretskii
2001-11-05 8:25 ` Quality Quorum
0 siblings, 2 replies; 12+ messages in thread
From: Steven Bauer @ 2001-11-04 14:28 UTC (permalink / raw)
To: gdb
Quick question, does gdb support hardware breakpoints on
x86 architectures? I have been trying to get them to work keep
getting an unknown error.
(gdb) hbreak *0x80485d9
....
warning: Cannot insert breakpoint 3:
Error accessing memory address 0x80485d9: Unknown error 4294967295.
One other question, is there any way to have breakpoints enabled
when an exec occurs. What I would like to do is continue through the
exec getting the sigtrap if the new process is loaded, delete old
breakpoints, load the symbols for the new process, and eventually
reset breakpoints once main is hit. The reason I want this is that
the exec could fail, in which case I want the original breakpoints to
still be in place. If I remove all the breakpoints before the
exec, continue, and the exec fails, I miss all the functions I
originally had breakpoints set for.
Thanks,
Steve
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: x86 hardware breakpoint question
2001-11-04 14:28 x86 hardware breakpoint question Steven Bauer
@ 2001-11-05 6:38 ` Eli Zaretskii
2001-11-05 23:28 ` Pierre Muller
2001-11-05 8:25 ` Quality Quorum
1 sibling, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2001-11-05 6:38 UTC (permalink / raw)
To: bauer; +Cc: gdb
> Date: Thu, 15 Nov 2001 12:59:27 -0500
> From: Steven Bauer <bauer@atlas.lcs.mit.edu>
>
> Quick question, does gdb support hardware breakpoints on
> x86 architectures?
Current GDB snapshots and the pretest of GDB 5.1 should support
them. What version do you use and on what platform?
> I have been trying to get them to work keep
> getting an unknown error.
>
> (gdb) hbreak *0x80485d9
>
> ....
>
> warning: Cannot insert breakpoint 3:
> Error accessing memory address 0x80485d9: Unknown error 4294967295.
What is at the address *0x80485d9?
(The unknown error simply says that the error code is -1, which means
GDB couldn't insert the breakpoint.)
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: x86 hardware breakpoint question
2001-11-04 14:28 x86 hardware breakpoint question Steven Bauer
2001-11-05 6:38 ` Eli Zaretskii
@ 2001-11-05 8:25 ` Quality Quorum
1 sibling, 0 replies; 12+ messages in thread
From: Quality Quorum @ 2001-11-05 8:25 UTC (permalink / raw)
To: Steven Bauer; +Cc: gdb
On Thu, 15 Nov 2001, Steven Bauer wrote:
> Quick question, does gdb support hardware breakpoints on
> x86 architectures? I have been trying to get them to work keep
> getting an unknown error.
>
> (gdb) hbreak *0x80485d9
>
> ....
>
> warning: Cannot insert breakpoint 3:
> Error accessing memory address 0x80485d9: Unknown error 4294967295.
>
>
> One other question, is there any way to have breakpoints enabled
> when an exec occurs. What I would like to do is continue through the
> exec getting the sigtrap if the new process is loaded, delete old
> breakpoints, load the symbols for the new process, and eventually
> reset breakpoints once main is hit. The reason I want this is that
> the exec could fail, in which case I want the original breakpoints to
> still be in place. If I remove all the breakpoints before the
> exec, continue, and the exec fails, I miss all the functions I
> originally had breakpoints set for.
First, it has to be supported be stub, current stub does not do it.
Plus, there are few things to be improved on the gdb side.
>
> Thanks,
> Steve
>
>
>
>
Thanks,
Aleksey
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: x86 hardware breakpoint question
2001-11-05 6:38 ` Eli Zaretskii
@ 2001-11-05 23:28 ` Pierre Muller
2001-11-06 12:54 ` Eli Zaretskii
0 siblings, 1 reply; 12+ messages in thread
From: Pierre Muller @ 2001-11-05 23:28 UTC (permalink / raw)
To: Eli Zaretskii, bauer; +Cc: gdb
At 20:26 15/11/2001 , Eli Zaretskii a écrit:
> > Date: Thu, 15 Nov 2001 12:59:27 -0500
> > From: Steven Bauer <bauer@atlas.lcs.mit.edu>
> >
> > Quick question, does gdb support hardware breakpoints on
> > x86 architectures?
>
>Current GDB snapshots and the pretest of GDB 5.1 should support
>them. What version do you use and on what platform?
But this depends on the TARGET OS:
cygwin that completely relies on win32 API calls does not support
hardware breakpoint (nor watchpoints)
because there is no API call to set a hardware trap.
Pierre Muller
Institut Charles Sadron
6,rue Boussingault
F 67083 STRASBOURG CEDEX (France)
mailto:muller@ics.u-strasbg.fr
Phone : (33)-3-88-41-40-07 Fax : (33)-3-88-41-40-99
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: x86 hardware breakpoint question
2001-11-05 23:28 ` Pierre Muller
@ 2001-11-06 12:54 ` Eli Zaretskii
2001-11-06 14:35 ` Christopher Faylor
0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2001-11-06 12:54 UTC (permalink / raw)
To: muller; +Cc: gdb, dj
> Date: Fri, 16 Nov 2001 14:07:07 +0100
> From: Pierre Muller <muller@cerbere.u-strasbg.fr>
> Cc: gdb@sourceware.cygnus.com
>
> At 20:26 15/11/2001 , Eli Zaretskii a \x7fcrit:
> > > Date: Thu, 15 Nov 2001 12:59:27 -0500
> > > From: Steven Bauer <bauer@atlas.lcs.mit.edu>
> > >
> > > Quick question, does gdb support hardware breakpoints on
> > > x86 architectures?
> >
> >Current GDB snapshots and the pretest of GDB 5.1 should support
> >them. What version do you use and on what platform?
> But this depends on the TARGET OS:
Well, I did ask about the platform ;-)
> cygwin that completely relies on win32 API calls does not support
> hardware breakpoint (nor watchpoints)
> because there is no API call to set a hardware trap.
I think this is just because no one implemented Cygwin support for the
new facilities on i386-nat.c. When this was discussed a few months
ago, someone, I think DJ Delorie, posted a list of Win32 API entries
that support hardware watchpoints and breakpoints.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: x86 hardware breakpoint question
2001-11-06 12:54 ` Eli Zaretskii
@ 2001-11-06 14:35 ` Christopher Faylor
2001-11-06 15:15 ` muller
2001-11-06 15:58 ` DJ Delorie
0 siblings, 2 replies; 12+ messages in thread
From: Christopher Faylor @ 2001-11-06 14:35 UTC (permalink / raw)
To: gdb
On Fri, Nov 16, 2001 at 06:47:52PM +0200, Eli Zaretskii wrote:
>> cygwin that completely relies on win32 API calls does not support
>> hardware breakpoint (nor watchpoints)
>> because there is no API call to set a hardware trap.
>
>I think this is just because no one implemented Cygwin support for the
>new facilities on i386-nat.c. When this was discussed a few months
>ago, someone, I think DJ Delorie, posted a list of Win32 API entries
>that support hardware watchpoints and breakpoints.
I can't find this, Eli. Can you provide any clues on what to look for?
I'd like to have hardware brekpoints into cygwin if I can.
cgf
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: x86 hardware breakpoint question
2001-11-06 14:35 ` Christopher Faylor
@ 2001-11-06 15:15 ` muller
2001-11-06 15:58 ` DJ Delorie
1 sibling, 0 replies; 12+ messages in thread
From: muller @ 2001-11-06 15:15 UTC (permalink / raw)
To: Christopher Faylor, gdb
At 15:54 16/11/01 -0500, Christopher Faylor wrote:
>On Fri, Nov 16, 2001 at 06:47:52PM +0200, Eli Zaretskii wrote:
>>> cygwin that completely relies on win32 API calls does not support
>>> hardware breakpoint (nor watchpoints)
>>> because there is no API call to set a hardware trap.
>>
>>I think this is just because no one implemented Cygwin support for the
>>new facilities on i386-nat.c. When this was discussed a few months
>>ago, someone, I think DJ Delorie, posted a list of Win32 API entries
>>that support hardware watchpoints and breakpoints.
>
>I can't find this, Eli. Can you provide any clues on what to look for?
>I'd like to have hardware brekpoints into cygwin if I can.
I had pseudo-hardware watchpoints working using the page protection
mechanisms available with the VirtualXXX functions.
I am trying to get up to date my old code that added
"hardware" watchpoints with VirtualProtectEx.
As soon as this works correctly again, I will send
a patch, even if my code is far from optimal,
because otherwise it will again get lost in
confilcts with future changes...
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: x86 hardware breakpoint question
2001-11-06 14:35 ` Christopher Faylor
2001-11-06 15:15 ` muller
@ 2001-11-06 15:58 ` DJ Delorie
2001-11-06 17:12 ` muller
1 sibling, 1 reply; 12+ messages in thread
From: DJ Delorie @ 2001-11-06 15:58 UTC (permalink / raw)
To: cgf; +Cc: gdb
> I can't find this, Eli. Can you provide any clues on what to look for?
> I'd like to have hardware brekpoints into cygwin if I can.
SetThreadContext can set the hardware debug registers.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: x86 hardware breakpoint question
2001-11-06 15:58 ` DJ Delorie
@ 2001-11-06 17:12 ` muller
2001-11-06 18:13 ` DJ Delorie
0 siblings, 1 reply; 12+ messages in thread
From: muller @ 2001-11-06 17:12 UTC (permalink / raw)
To: DJ Delorie, cgf; +Cc: gdb
At 17:32 16/11/01 -0500, DJ Delorie wrote:
>
>> I can't find this, Eli. Can you provide any clues on what to look for?
>> I'd like to have hardware brekpoints into cygwin if I can.
>
>SetThreadContext can set the hardware debug registers.
Did you try this out already ?
Because one of the problems that I got with my code
that uses VirtualProtectEx is that I can't change the
single step bit inside a system DLL (under win95 at least).
This forced me to add some complicated code,
that goes up the frame and sets a breakpoint at the first not
system DLL return address.
Outside system DLL I can single step over an
instruction that triggered the page protection
(momentantly disabling that protection) if
the address triggering the page protection is
not a watched address.
So I am surprised to hear that win32
lets you set debug registers, but if that works, great!
Are the debug registers process wide or
thread specific in that case ?
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: x86 hardware breakpoint question
2001-11-06 17:12 ` muller
@ 2001-11-06 18:13 ` DJ Delorie
2001-11-06 19:34 ` Christopher Faylor
0 siblings, 1 reply; 12+ messages in thread
From: DJ Delorie @ 2001-11-06 18:13 UTC (permalink / raw)
To: muller; +Cc: cgf, gdb
> So I am surprised to hear that win32
> lets you set debug registers, but if that works, great!
I don't know if it works, I just looked it up in the documentation.
> Are the debug registers process wide or
> thread specific in that case ?
Well, it is Set*Thread*Context.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: x86 hardware breakpoint question
2001-11-06 18:13 ` DJ Delorie
@ 2001-11-06 19:34 ` Christopher Faylor
2001-11-07 18:38 ` muller
0 siblings, 1 reply; 12+ messages in thread
From: Christopher Faylor @ 2001-11-06 19:34 UTC (permalink / raw)
To: gdb
On Fri, Nov 16, 2001 at 05:57:04PM -0500, DJ Delorie wrote:
>
>> So I am surprised to hear that win32
>> lets you set debug registers, but if that works, great!
>
>I don't know if it works, I just looked it up in the documentation.
>
>> Are the debug registers process wide or
>> thread specific in that case ?
>
>Well, it is Set*Thread*Context.
Which is, conveniently enough, what gdb is already using. :-)
Did you find specific documentation on the hardware registers, though?
I see this in the system header:
BYTE ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION];
but I don't see any description about how to use them.
cgf
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: x86 hardware breakpoint question
2001-11-06 19:34 ` Christopher Faylor
@ 2001-11-07 18:38 ` muller
0 siblings, 0 replies; 12+ messages in thread
From: muller @ 2001-11-07 18:38 UTC (permalink / raw)
To: Christopher Faylor, gdb
At 20:10 16/11/01 -0500, Christopher Faylor wrote:
>On Fri, Nov 16, 2001 at 05:57:04PM -0500, DJ Delorie wrote:
>>
>>> So I am surprised to hear that win32
>>> lets you set debug registers, but if that works, great!
>>
>>I don't know if it works, I just looked it up in the documentation.
>>
>>> Are the debug registers process wide or
>>> thread specific in that case ?
>>
>>Well, it is Set*Thread*Context.
>
>Which is, conveniently enough, what gdb is already using. :-)
>
>Did you find specific documentation on the hardware registers, though?
>
>I see this in the system header:
>
> BYTE ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION];
>
>but I don't see any description about how to use them.
No, these are for xmme registers of Pentium III
or possibly other registers of other kind of i386 compatible regs.
The debug registers are DR0-3 DR6 and DR7.
DR0 to 3 are the four linear addresses watchpoints
and DR6 and DR7 are used for indicating type and size of
the different breakpoints.
I think that DJ expects that we can directly write
the values of the DR registers using SetThreadContext.
This needs to be tested.
ContextFlags field of context structure must contain
CONTEXT_DEBUG_REGISTERS which isn't yet included into
CONTEXT_DEBUG used in win32-nat code.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2001-11-17 22:50 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-04 14:28 x86 hardware breakpoint question Steven Bauer
2001-11-05 6:38 ` Eli Zaretskii
2001-11-05 23:28 ` Pierre Muller
2001-11-06 12:54 ` Eli Zaretskii
2001-11-06 14:35 ` Christopher Faylor
2001-11-06 15:15 ` muller
2001-11-06 15:58 ` DJ Delorie
2001-11-06 17:12 ` muller
2001-11-06 18:13 ` DJ Delorie
2001-11-06 19:34 ` Christopher Faylor
2001-11-07 18:38 ` muller
2001-11-05 8:25 ` Quality Quorum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox