public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Hardware breakpoint limitation issue during the gdb regression test
@ 2012-08-08  8:55 Terry Guo
  2012-08-08 16:40 ` Liang Cheng
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Terry Guo @ 2012-08-08  8:55 UTC (permalink / raw)
  To: gdb

Hi,

I managed to run gdb "make check" on a real arm cortex-m3 board.
During this regression test, I saw many failures are caused by "Cannot
insert hardware breakpoint 8" and "You may have requested too many
hardware breakpoints/watchpoints". It's true that my arm board only
supports limited number breakpoints. So how to workaround this
limitation for regression test? Thanks.

BR,
Terry

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

* Re: Hardware breakpoint limitation issue during the gdb regression test
  2012-08-08  8:55 Hardware breakpoint limitation issue during the gdb regression test Terry Guo
@ 2012-08-08 16:40 ` Liang Cheng
  2012-08-09  0:03 ` Luis Gustavo
  2012-08-09  3:48 ` Yao Qi
  2 siblings, 0 replies; 8+ messages in thread
From: Liang Cheng @ 2012-08-08 16:40 UTC (permalink / raw)
  To: Terry Guo; +Cc: gdb

I believe for ARM, only one hardware breakpoint is allowed.
You may search through the gdb mail list.

Liang

On Wed, Aug 8, 2012 at 3:55 AM, Terry Guo <flameroc@gmail.com> wrote:
> Hi,
>
> I managed to run gdb "make check" on a real arm cortex-m3 board.
> During this regression test, I saw many failures are caused by "Cannot
> insert hardware breakpoint 8" and "You may have requested too many
> hardware breakpoints/watchpoints". It's true that my arm board only
> supports limited number breakpoints. So how to workaround this
> limitation for regression test? Thanks.
>
> BR,
> Terry

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

* Re: Hardware breakpoint limitation issue during the gdb regression test
  2012-08-08  8:55 Hardware breakpoint limitation issue during the gdb regression test Terry Guo
  2012-08-08 16:40 ` Liang Cheng
@ 2012-08-09  0:03 ` Luis Gustavo
  2012-08-09  3:48 ` Yao Qi
  2 siblings, 0 replies; 8+ messages in thread
From: Luis Gustavo @ 2012-08-09  0:03 UTC (permalink / raw)
  To: Terry Guo; +Cc: gdb

On 08/08/2012 05:55 AM, Terry Guo wrote:
> Hi,
>
> I managed to run gdb "make check" on a real arm cortex-m3 board.
> During this regression test, I saw many failures are caused by "Cannot
> insert hardware breakpoint 8" and "You may have requested too many
> hardware breakpoints/watchpoints". It's true that my arm board only
> supports limited number breakpoints. So how to workaround this
> limitation for regression test? Thanks.
>
> BR,
> Terry
>

You may want to turn these off:

set breakpoint auto-hw on/off
set can-use-hw-watchpoints 1/0

Luis

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

* Re: Hardware breakpoint limitation issue during the gdb regression test
  2012-08-08  8:55 Hardware breakpoint limitation issue during the gdb regression test Terry Guo
  2012-08-08 16:40 ` Liang Cheng
  2012-08-09  0:03 ` Luis Gustavo
@ 2012-08-09  3:48 ` Yao Qi
  2012-08-09  9:12   ` Terry Guo
  2 siblings, 1 reply; 8+ messages in thread
From: Yao Qi @ 2012-08-09  3:48 UTC (permalink / raw)
  To: gdb-patches; +Cc: Terry Guo, gdb

On Wednesday, August 08, 2012 04:55:44 PM Terry Guo wrote:
> I managed to run gdb "make check" on a real arm cortex-m3 board.
> During this regression test, I saw many failures are caused by "Cannot
> insert hardware breakpoint 8" and "You may have requested too many
> hardware breakpoints/watchpoints". It's true that my arm board only
> supports limited number breakpoints. So how to workaround this
> limitation for regression test? Thanks.

You don't have to workaround this limitation.  x86 also has a limited number 
of hardware breakpoints and processor with unlimited hw breakpoints doesn't 
exist at all :)  If testsuite works for x86, it should work for your 
configuration.

As you provide quite few information, I can't tell where the problem is.  In 
testsuite, it is regarded that target "arm*-*-*" supports both hardware 
breakpoint and watchpoint (see skip_hw_breakpoint_tests and 
skip_hw_watchpoint_tests in testsuite/lib/gdb.exp), so all hw watch/break 
tests are run on your board.

You have to check whether your stub is able to handle hardware 
breakpoint/watchpoint packets, and insert them correctly.

-- 
Yao (齐尧)

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

* Re: Hardware breakpoint limitation issue during the gdb regression test
  2012-08-09  3:48 ` Yao Qi
@ 2012-08-09  9:12   ` Terry Guo
  2012-08-09 10:30     ` Mark Kettenis
  0 siblings, 1 reply; 8+ messages in thread
From: Terry Guo @ 2012-08-09  9:12 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb

On Thu, Aug 9, 2012 at 11:47 AM, Yao Qi <yao@codesourcery.com> wrote:
> On Wednesday, August 08, 2012 04:55:44 PM Terry Guo wrote:
>> I managed to run gdb "make check" on a real arm cortex-m3 board.
>> During this regression test, I saw many failures are caused by "Cannot
>> insert hardware breakpoint 8" and "You may have requested too many
>> hardware breakpoints/watchpoints". It's true that my arm board only
>> supports limited number breakpoints. So how to workaround this
>> limitation for regression test? Thanks.
>
> You don't have to workaround this limitation.  x86 also has a limited number
> of hardware breakpoints and processor with unlimited hw breakpoints doesn't
> exist at all :)  If testsuite works for x86, it should work for your
> configuration.
>
> As you provide quite few information, I can't tell where the problem is.  In
> testsuite, it is regarded that target "arm*-*-*" supports both hardware
> breakpoint and watchpoint (see skip_hw_breakpoint_tests and
> skip_hw_watchpoint_tests in testsuite/lib/gdb.exp), so all hw watch/break
> tests are run on your board.
>
> You have to check whether your stub is able to handle hardware
> breakpoint/watchpoint packets, and insert them correctly.
>
> --

Thanks for help. Here are more information. I am trying to run tests
in break.exp on my cortex-m3 board. The test process is:

1) start target gdb and load binary file.
2) set 8 different breakpoints.
3) then connect to my board and load binary file to board.
4) then use gdb command "continue" to start to run the binary. At this
point, I will get error messages like:

-----GDB output---------
(gdb) continue
Continuing.
Note: automatically using hardware breakpoints for read-only addresses.
Warning:
Cannot insert hardware breakpoint 2.
Could not insert hardware breakpoints:
You may have requested too many hardware breakpoints/watchpoints.

(gdb) break 46
Breakpoint 9 at 0x180: file
/home/terguo01/work/gcc-arm-none-eabi-4_8-2012q3-20120803/src/gdb/gdb/testsuite/gdb.base/break.c,
line 46.
(gdb) continue
Continuing.
Warning:
Cannot insert hardware breakpoint 9.
Cannot insert hardware breakpoint 2.
Could not insert hardware breakpoints:
You may have requested too many hardware breakpoints/watchpoints.
------------------------------------------------------------------------------------------------------

For me, it seems many tests in gdb regression test tend to set around
8 or 9 break points. And I always end with this error on "cannot
insert hardware breakpoint".  Such tests can work on x86, I think it
is because x86 can support more breakpoints than arm. I do need a way
to make these tests can run on arm board. Please help.

BR,
Terry

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

* Re: Hardware breakpoint limitation issue during the gdb regression test
  2012-08-09  9:12   ` Terry Guo
@ 2012-08-09 10:30     ` Mark Kettenis
  2012-08-09 10:42       ` Jan Kratochvil
  0 siblings, 1 reply; 8+ messages in thread
From: Mark Kettenis @ 2012-08-09 10:30 UTC (permalink / raw)
  To: flameroc; +Cc: yao, gdb

> Date: Thu, 9 Aug 2012 17:11:40 +0800
> From: Terry Guo <flameroc@gmail.com>
> 
> On Thu, Aug 9, 2012 at 11:47 AM, Yao Qi <yao@codesourcery.com> wrote:
> > On Wednesday, August 08, 2012 04:55:44 PM Terry Guo wrote:
> >> I managed to run gdb "make check" on a real arm cortex-m3 board.
> >> During this regression test, I saw many failures are caused by "Cannot
> >> insert hardware breakpoint 8" and "You may have requested too many
> >> hardware breakpoints/watchpoints". It's true that my arm board only
> >> supports limited number breakpoints. So how to workaround this
> >> limitation for regression test? Thanks.
> >
> > You don't have to workaround this limitation.  x86 also has a limited number
> > of hardware breakpoints and processor with unlimited hw breakpoints doesn't
> > exist at all :)  If testsuite works for x86, it should work for your
> > configuration.
> >
> > As you provide quite few information, I can't tell where the problem is.  In
> > testsuite, it is regarded that target "arm*-*-*" supports both hardware
> > breakpoint and watchpoint (see skip_hw_breakpoint_tests and
> > skip_hw_watchpoint_tests in testsuite/lib/gdb.exp), so all hw watch/break
> > tests are run on your board.
> >
> > You have to check whether your stub is able to handle hardware
> > breakpoint/watchpoint packets, and insert them correctly.
> >
> > --
> 
> Thanks for help. Here are more information. I am trying to run tests
> in break.exp on my cortex-m3 board. The test process is:
> 
> 1) start target gdb and load binary file.
> 2) set 8 different breakpoints.
> 3) then connect to my board and load binary file to board.
> 4) then use gdb command "continue" to start to run the binary. At this
> point, I will get error messages like:
> 
> -----GDB output---------
> (gdb) continue
> Continuing.
> Note: automatically using hardware breakpoints for read-only addresses.
> Warning:
> Cannot insert hardware breakpoint 2.
> Could not insert hardware breakpoints:
> You may have requested too many hardware breakpoints/watchpoints.
> 
> (gdb) break 46
> Breakpoint 9 at 0x180: file
> /home/terguo01/work/gcc-arm-none-eabi-4_8-2012q3-20120803/src/gdb/gdb/testsuite/gdb.base/break.c,
> line 46.
> (gdb) continue
> Continuing.
> Warning:
> Cannot insert hardware breakpoint 9.
> Cannot insert hardware breakpoint 2.
> Could not insert hardware breakpoints:
> You may have requested too many hardware breakpoints/watchpoints.
> ------------------------------------------------------------------------------------------------------
> 
> For me, it seems many tests in gdb regression test tend to set around
> 8 or 9 break points. And I always end with this error on "cannot
> insert hardware breakpoint".  Such tests can work on x86, I think it
> is because x86 can support more breakpoints than arm. I do need a way
> to make these tests can run on arm board. Please help.

No, x86 has even less hardware breakpoints (4).  But it will fall back
to using software breakpoints.  Your ARM target isn't doing that,
probably because:

  Note: automatically using hardware breakpoints for read-only addresses.

I think you either have to accept the failures you get or find a way
to make your binaries not read-only.

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

* Re: Hardware breakpoint limitation issue during the gdb regression test
  2012-08-09 10:30     ` Mark Kettenis
@ 2012-08-09 10:42       ` Jan Kratochvil
  2012-08-09 16:00         ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Jan Kratochvil @ 2012-08-09 10:42 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: flameroc, yao, gdb

On Thu, 09 Aug 2012 12:30:27 +0200, Mark Kettenis wrote:
> No, x86 has even less hardware breakpoints (4).  But it will fall back
> to using software breakpoints.

It will not.

But in fact it is better this way as even suggested by Markus Metzger as if
GDB drops to using software watchpoints the debugging just "locks up" and user
does not know why.

(gdb) start
(gdb) l 1,1
1	long v1, v2, v3, v4, v5;
(gdb) watch v1
Hardware watchpoint 2: v1
(gdb) watch v2
Hardware watchpoint 3: v2
(gdb) watch v3
Hardware watchpoint 4: v3
(gdb) watch v4
Hardware watchpoint 5: v4
(gdb) watch v5
Hardware watchpoint 6: v5
(gdb) info breakpoints 
Num     Type           Disp Enb Address            What
2       hw watchpoint  keep y                      v1
3       hw watchpoint  keep y                      v2
4       hw watchpoint  keep y                      v3
5       hw watchpoint  keep y                      v4
6       hw watchpoint  keep y                      v5
(gdb) c
Continuing.
Warning:
Could not insert hardware watchpoint 5.
Could not insert hardware breakpoints:
You may have requested too many hardware breakpoints/watchpoints.


It is more a bug that in this case no error message is given:

(gdb) l 2,2
2	long a[5];
(gdb) watch a
Watchpoint 2: a


Regards,
Jan

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

* Re: Hardware breakpoint limitation issue during the gdb regression test
  2012-08-09 10:42       ` Jan Kratochvil
@ 2012-08-09 16:00         ` Eli Zaretskii
  0 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2012-08-09 16:00 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: mark.kettenis, flameroc, yao, gdb

> Date: Thu, 9 Aug 2012 12:42:09 +0200
> From: Jan Kratochvil <jan.kratochvil@redhat.com>
> Cc: flameroc@gmail.com, yao@codesourcery.com, gdb@sourceware.org
> 
> On Thu, 09 Aug 2012 12:30:27 +0200, Mark Kettenis wrote:
> > No, x86 has even less hardware breakpoints (4).  But it will fall back
> > to using software breakpoints.
> 
> It will not.

Right, it cannot do that, because whether a hardware break/watchpoint
can or cannot be inserted is only known when we resume the debuggee.

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

end of thread, other threads:[~2012-08-09 16:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-08  8:55 Hardware breakpoint limitation issue during the gdb regression test Terry Guo
2012-08-08 16:40 ` Liang Cheng
2012-08-09  0:03 ` Luis Gustavo
2012-08-09  3:48 ` Yao Qi
2012-08-09  9:12   ` Terry Guo
2012-08-09 10:30     ` Mark Kettenis
2012-08-09 10:42       ` Jan Kratochvil
2012-08-09 16:00         ` Eli Zaretskii

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