public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Report "No hardware breakpoint support" correctly
@ 2014-07-14 14:55 Edjunior Barbosa Machado
  2014-07-14 15:54 ` Ulrich Weigand
  2014-07-14 16:13 ` Joel Brobecker
  0 siblings, 2 replies; 4+ messages in thread
From: Edjunior Barbosa Machado @ 2014-07-14 14:55 UTC (permalink / raw)
  To: gdb-patches; +Cc: uweigand

Hi,

when trying to set a hardware breakpoint on Power server processors, gdb
currently reports "Hardware breakpoints used exceeds limit." when in fact
hbreaks are not supported. With this patch, gdb will report "No hardware
breakpoint support in the target.", which seems to be more appropriate in this
case.
This also fixes the several unexpected failures in
gdb.base/watchpoint-reuse-slot.exp testcase, that didn't detect that hbreaks
are not supported in this target.
Ok?

Thanks and regards,
--
Edjunior

gdb/
2014-07-14  Edjunior Barbosa Machado  <emachado@linux.vnet.ibm.com>

	* gdb/ppc-linux-nat.c (ppc_linux_can_use_hw_breakpoint): Report no
	hardware breakpoint support correctly.

---
 gdb/ppc-linux-nat.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index fcfd452..4c5d878 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -1473,6 +1473,9 @@ ppc_linux_can_use_hw_breakpoint (struct target_ops *self,
     }
   else if (type == bp_hardware_breakpoint)
     {
+      if (total_hw_bp == 0)
+	/* No hardware breakpoint support. */
+	return 0;
       if (cnt > total_hw_bp)
 	return -1;
     }
-- 
1.8.4.2

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

* Re: [PATCH] Report "No hardware breakpoint support" correctly
  2014-07-14 14:55 [PATCH] Report "No hardware breakpoint support" correctly Edjunior Barbosa Machado
@ 2014-07-14 15:54 ` Ulrich Weigand
  2014-07-14 16:13 ` Joel Brobecker
  1 sibling, 0 replies; 4+ messages in thread
From: Ulrich Weigand @ 2014-07-14 15:54 UTC (permalink / raw)
  To: Edjunior Barbosa Machado; +Cc: gdb-patches

Edjunior Barbosa Machado wrote:

> 	* gdb/ppc-linux-nat.c (ppc_linux_can_use_hw_breakpoint): Report no
> 	hardware breakpoint support correctly.

This is OK, thanks!

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  Ulrich.Weigand@de.ibm.com

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

* Re: [PATCH] Report "No hardware breakpoint support" correctly
  2014-07-14 14:55 [PATCH] Report "No hardware breakpoint support" correctly Edjunior Barbosa Machado
  2014-07-14 15:54 ` Ulrich Weigand
@ 2014-07-14 16:13 ` Joel Brobecker
  2014-07-15  8:12   ` Edjunior Barbosa Machado
  1 sibling, 1 reply; 4+ messages in thread
From: Joel Brobecker @ 2014-07-14 16:13 UTC (permalink / raw)
  To: Edjunior Barbosa Machado; +Cc: gdb-patches, uweigand

> gdb/
> 2014-07-14  Edjunior Barbosa Machado  <emachado@linux.vnet.ibm.com>
> 
> 	* gdb/ppc-linux-nat.c (ppc_linux_can_use_hw_breakpoint): Report no
> 	hardware breakpoint support correctly.

Just one itty bitty tiny little nit:

> ---
>  gdb/ppc-linux-nat.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
> index fcfd452..4c5d878 100644
> --- a/gdb/ppc-linux-nat.c
> +++ b/gdb/ppc-linux-nat.c
> @@ -1473,6 +1473,9 @@ ppc_linux_can_use_hw_breakpoint (struct target_ops *self,
>      }
>    else if (type == bp_hardware_breakpoint)
>      {
> +      if (total_hw_bp == 0)
> +	/* No hardware breakpoint support. */
> +	return 0;

Can you nest the contents of the if block inside curly braces.
We've decided a while ago that a comment looks visually like
a statement, and thus that comment + statement looks the same
as 2 statements, and thus normally requires curly braces...

Thanks!
-- 
Joel

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

* Re: [PATCH] Report "No hardware breakpoint support" correctly
  2014-07-14 16:13 ` Joel Brobecker
@ 2014-07-15  8:12   ` Edjunior Barbosa Machado
  0 siblings, 0 replies; 4+ messages in thread
From: Edjunior Barbosa Machado @ 2014-07-15  8:12 UTC (permalink / raw)
  To: brobecker; +Cc: gdb-patches, uweigand

Thanks Uli and Joel for the feedback. I've just committed the patch below,
following Joel's suggestion:

	https://sourceware.org/ml/gdb-cvs/2014-07/msg00035.html

Thanks and regards,
--
Edjunior

gdb/
2014-07-14  Edjunior Barbosa Machado  <emachado@linux.vnet.ibm.com>

	* ppc-linux-nat.c (ppc_linux_can_use_hw_breakpoint): Report no hardware
	breakpoint support correctly.

---
 gdb/ppc-linux-nat.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index fcfd452..6e8994e 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -1473,6 +1473,11 @@ ppc_linux_can_use_hw_breakpoint (struct target_ops *self,
     }
   else if (type == bp_hardware_breakpoint)
     {
+      if (total_hw_bp == 0)
+	{
+	  /* No hardware breakpoint support. */
+	  return 0;
+	}
       if (cnt > total_hw_bp)
 	return -1;
     }
-- 
1.8.4.2

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

end of thread, other threads:[~2014-07-14 23:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-14 14:55 [PATCH] Report "No hardware breakpoint support" correctly Edjunior Barbosa Machado
2014-07-14 15:54 ` Ulrich Weigand
2014-07-14 16:13 ` Joel Brobecker
2014-07-15  8:12   ` Edjunior Barbosa Machado

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