diff mbox

[v8,5/7] Support software single step on ARM in GDBServer

Message ID 86a8oiyegx.fsf@gmail.com
State New
Headers show

Commit Message

Yao Qi Jan. 6, 2016, 2:22 p.m. UTC
Antoine Tremblay <antoine.tremblay@ericsson.com> writes:

Hi Antoine,

> --- a/gdb/gdbserver/linux-aarch32-low.h
> +++ b/gdb/gdbserver/linux-aarch32-low.h
> @@ -15,6 +15,27 @@
>     You should have received a copy of the GNU General Public License
>     along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
>  
> +/* Correct in either endianness.  */
> +#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.  */
> +#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
> +

This change causes GDBserver build errors on both ARM and AArch64, which
are shown in the commit log of the patch below.

Comments

Antoine Tremblay Jan. 6, 2016, 2:36 p.m. UTC | #1
On 01/06/2016 09:22 AM, Yao Qi wrote:
> Antoine Tremblay <antoine.tremblay@ericsson.com> writes:
>
> Hi Antoine,
>
>> --- a/gdb/gdbserver/linux-aarch32-low.h
>> +++ b/gdb/gdbserver/linux-aarch32-low.h
>> @@ -15,6 +15,27 @@
>>      You should have received a copy of the GNU General Public License
>>      along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
>>
>> +/* Correct in either endianness.  */
>> +#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.  */
>> +#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
>> +
>
> This change causes GDBserver build errors on both ARM and AArch64, which
> are shown in the commit log of the patch below.
>

Strange I did not see those at all with arm-linux-gnueabihf-gcc 
(Ubuntu/Linaro 4.8.2-16ubuntu4) 4.8.2

Ideas on why you see those and I would not ?

Looking forward to your follow up patches about the issues revealed...

Thanks,
Antoine
Yao Qi Jan. 6, 2016, 2:56 p.m. UTC | #2
Antoine Tremblay <antoine.tremblay@ericsson.com> writes:

> Strange I did not see those at all with arm-linux-gnueabihf-gcc
> (Ubuntu/Linaro 4.8.2-16ubuntu4) 4.8.2
>
> Ideas on why you see those and I would not ?

My cross gcc (aarch64-none-linux-gnu-gcc and
arm-none-linux-gnueabihf-gcc) is 6.0.0.
Antoine Tremblay Jan. 6, 2016, 2:58 p.m. UTC | #3
On 01/06/2016 09:56 AM, Yao Qi wrote:
> Antoine Tremblay <antoine.tremblay@ericsson.com> writes:
>
>> Strange I did not see those at all with arm-linux-gnueabihf-gcc
>> (Ubuntu/Linaro 4.8.2-16ubuntu4) 4.8.2
>>
>> Ideas on why you see those and I would not ?
>
> My cross gcc (aarch64-none-linux-gnu-gcc and
> arm-none-linux-gnueabihf-gcc) is 6.0.0.
>

OK, thanks for the fix, I'll get this gcc too.
diff mbox

Patch

diff --git a/gdb/gdbserver/linux-aarch32-low.c b/gdb/gdbserver/linux-aarch32-low.c
index 74deca3..ed66e08 100644
--- a/gdb/gdbserver/linux-aarch32-low.c
+++ b/gdb/gdbserver/linux-aarch32-low.c
@@ -27,6 +27,27 @@ 
 #include <elf.h>
 #endif
 
+/* Correct in either endianness.  */
+#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.  */
+#define arm_eabi_breakpoint 0xe7f001f0UL
+
+#if (defined __ARM_EABI__ || defined __aarch64__)
+static const unsigned long arm_breakpoint = arm_eabi_breakpoint;
+#else
+static const unsigned long arm_breakpoint = arm_abi_breakpoint;
+#endif
+
+#define arm_breakpoint_len 4
+static const unsigned short thumb_breakpoint = 0xde01;
+#define thumb_breakpoint_len 2
+const unsigned short thumb2_breakpoint[] = { 0xf7f0, 0xa000 };
+#define thumb2_breakpoint_len 4
+
 /* Some older versions of GNU/Linux and Android do not define
    the following macros.  */
 #ifndef NT_ARM_VFP
diff --git a/gdb/gdbserver/linux-aarch32-low.h b/gdb/gdbserver/linux-aarch32-low.h
index c8f6646..5c68454 100644
--- a/gdb/gdbserver/linux-aarch32-low.h
+++ b/gdb/gdbserver/linux-aarch32-low.h
@@ -15,26 +15,7 @@ 
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-/* Correct in either endianness.  */
-#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.  */
-#define arm_eabi_breakpoint 0xe7f001f0UL
-
-#if (defined __ARM_EABI__ || defined __aarch64__)
-static const unsigned long arm_breakpoint = arm_eabi_breakpoint;
-#else
-static const unsigned long arm_breakpoint = arm_abi_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
+extern const unsigned short thumb2_breakpoint[];
 
 extern struct regs_info regs_info_aarch32;