Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Antoine Tremblay <antoine.tremblay@ericsson.com>
To: <gdb-patches@sourceware.org>
Cc: Antoine Tremblay <antoine.tremblay@ericsson.com>
Subject: [PATCH v3 4/5] Refactor the breakpoint definitions in linux-arm-low.c.
Date: Tue, 20 Oct 2015 16:49:00 -0000	[thread overview]
Message-ID: <1445359685-2589-5-git-send-email-antoine.tremblay@ericsson.com> (raw)
In-Reply-To: <1445359685-2589-1-git-send-email-antoine.tremblay@ericsson.com>

Before arm_breakpoint_from_pc would use an #ifdef to return the right
arm_breakpoint from the abi or eabi breakpoint type.

arm_breakpoint_at would also check for the arm_breakpoint ||
arm_eabi_breakpoint.

Thus the selected arm_breakpoint would be what arm_breakpoint_from_pc returned
and arm_breakpoint was arm_abi_breakpoint.

This patch makes it more clear by naming those for what they are : 2 separate
entities: arm_abi_breakpoint and arm_eabi_breakpoint and set the current used
one as arm_breakpoint.

This allows a cleaner arm_breakpoint_from_pc as it just returns arm_breakpoint
rather than having the #ifdef in that function.

Any other reference to the arm_breakpoint can now also be clear of #ifdefs...

No regressions on Ubuntu 14.04 on ARMv7 and x86.
With gdbserver-{native,extended} / { -marm -mthumb }

gdb/gdbserver/ChangeLog:
	* linux-arm-low.c: Refactor breakpoint definitions.
	(arm_breakpoint_at): Adjust for arm_abi_breakpoint.
	(arm_breakpoint_from_pc): Adjust for arm_breakpoint.
---
 gdb/gdbserver/linux-arm-low.c | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c
index 9b0975f..62e88f0 100644
--- a/gdb/gdbserver/linux-arm-low.c
+++ b/gdb/gdbserver/linux-arm-low.c
@@ -244,18 +244,25 @@ arm_set_pc (struct regcache *regcache, CORE_ADDR pc)
 }
 
 /* Correct in either endianness.  */
-static const unsigned long arm_breakpoint = 0xef9f0001;
-#define arm_breakpoint_len 4
-static const unsigned short thumb_breakpoint = 0xde01;
-#define thumb_breakpoint_len 2
-static const unsigned short thumb2_breakpoint[] = { 0xf7f0, 0xa000 };
-#define thumb2_breakpoint_len 4
+#define arm_abi_breakpoint 0xef9f0001UL
 
 /* For new EABI binaries.  We recognize it regardless of which ABI
    is used for gdbserver, so single threaded debugging should work
    OK, but for multi-threaded debugging we only insert the current
    ABI's breakpoint instruction.  For now at least.  */
-static const unsigned long arm_eabi_breakpoint = 0xe7f001f0;
+#define arm_eabi_breakpoint 0xe7f001f0UL
+
+#ifndef __ARM_EABI__
+static const unsigned long arm_breakpoint = arm_abi_breakpoint;
+#else
+static const unsigned long arm_breakpoint = arm_eabi_breakpoint;
+#endif
+
+#define arm_breakpoint_len 4
+static const unsigned short thumb_breakpoint = 0xde01;
+#define thumb_breakpoint_len 2
+static const unsigned short thumb2_breakpoint[] = { 0xf7f0, 0xa000 };
+#define thumb2_breakpoint_len 4
 
 static int
 arm_breakpoint_at (CORE_ADDR where)
@@ -287,7 +294,7 @@ arm_breakpoint_at (CORE_ADDR where)
       unsigned long insn;
 
       (*the_target->read_memory) (where, (unsigned char *) &insn, 4);
-      if (insn == arm_breakpoint)
+      if (insn == arm_abi_breakpoint)
 	return 1;
 
       if (insn == arm_eabi_breakpoint)
@@ -982,11 +989,7 @@ arm_sw_breakpoint_from_kind (int kind , int *size)
 	return (gdb_byte *) &thumb2_breakpoint;
       case ARM_BP_KIND_ARM:
 	*size = arm_breakpoint_len;
-#ifndef __ARM_EABI__
 	return (const gdb_byte *) &arm_breakpoint;
-#else
-	return (const gdb_byte *) &arm_eabi_breakpoint;
-#endif
       default:
        return NULL;
     }
-- 
1.9.1


  parent reply	other threads:[~2015-10-20 16:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-20 16:48 [PATCH v3 0/5] Software breakpoints support for ARM linux in GDBServer Antoine Tremblay
2015-10-20 16:48 ` [PATCH v3 1/5] Add the target_ops needed for software breakpoints " Antoine Tremblay
2015-10-21 11:22   ` Pedro Alves
2015-10-20 16:48 ` [PATCH v3 5/5] Support software breakpoints for ARM linux " Antoine Tremblay
2015-10-21 13:12   ` Pedro Alves
2015-10-20 16:49 ` Antoine Tremblay [this message]
2015-10-21 13:04   ` [PATCH v3 4/5] Refactor the breakpoint definitions in linux-arm-low.c Pedro Alves
2015-10-20 16:49 ` [PATCH v3 2/5] Support breakpoint kinds for software breakpoints in GDBServer Antoine Tremblay
2015-10-21 11:49   ` Pedro Alves
2015-10-21 14:19     ` Antoine Tremblay
2015-10-21 14:23       ` Pedro Alves
2015-10-21 14:41         ` Antoine Tremblay
2015-10-22 15:17   ` Ulrich Weigand
2015-10-22 15:54     ` Antoine Tremblay
2015-10-20 16:55 ` [PATCH v3 3/5] Implement breakpoint_kind_from_pc and sw_breakpoint_from_kind for ARM " Antoine Tremblay
2015-10-21 12:04   ` Pedro Alves
2015-10-21 13:34 ` [PATCH v3 0/5] Software breakpoints support for ARM linux " Pedro Alves
2015-10-21 18:44   ` Yao Qi
2015-10-21 19:31     ` Antoine Tremblay

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=1445359685-2589-5-git-send-email-antoine.tremblay@ericsson.com \
    --to=antoine.tremblay@ericsson.com \
    --cc=gdb-patches@sourceware.org \
    /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