* [RFC/TileGX] fix longjmp bug
@ 2013-03-01 9:58 Jiong Wang
2013-03-01 10:31 ` Pedro Alves
0 siblings, 1 reply; 4+ messages in thread
From: Jiong Wang @ 2013-03-01 9:58 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 268 bytes --]
tilegx is lack of get_longjmp_target support.
this patch fix this. please review.
thanks.
gdb/ChangeLog:
* tilegx-tdep.c (tilegx_get_longjmp_target): New function.
(tilegx_gdbarch_init): Install it.
--
Regards,
Jiong. Wang
Tilera Corporation.
[-- Attachment #2: fix-longjmp.patch --]
[-- Type: text/x-patch, Size: 1681 bytes --]
---
gdb/tilegx-tdep.c | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c
index 2c4e349..d9a8ed2 100644
--- a/gdb/tilegx-tdep.c
+++ b/gdb/tilegx-tdep.c
@@ -785,6 +785,28 @@ tilegx_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc)
return 0;
}
+/* This is the implementation of gdbarch method get_longjmp_target. */
+
+static int
+tilegx_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
+{
+ struct gdbarch *gdbarch = get_frame_arch (frame);
+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
+ CORE_ADDR jb_addr;
+ char buf[8];
+
+ jb_addr = get_frame_register_unsigned (frame, TILEGX_R0_REGNUM);
+
+ /* TileGX jmp_buf contains 32 elements of type __uint_reg_t which
+ is size of 8bytes, the return address is stored in the 25th slot. */
+ if (target_read_memory (jb_addr + 25 * 8, buf, 8))
+ return 0;
+
+ *pc = extract_unsigned_integer (buf, 8, byte_order);
+
+ return 1;
+}
+
/* by assigning the 'faultnum' reg in kernel pt_regs with this value,
kernel do_signal will not check r0. see tilegx kernel/signal.c
for details. */
@@ -1030,6 +1052,7 @@ tilegx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* These values and methods are used when gdb calls a target function. */
set_gdbarch_push_dummy_call (gdbarch, tilegx_push_dummy_call);
+ set_gdbarch_get_longjmp_target (gdbarch, tilegx_get_longjmp_target);
set_gdbarch_write_pc (gdbarch, tilegx_write_pc);
set_gdbarch_breakpoint_from_pc (gdbarch, tilegx_breakpoint_from_pc);
set_gdbarch_return_value (gdbarch, tilegx_return_value);
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [RFC/TileGX] fix longjmp bug
2013-03-01 9:58 [RFC/TileGX] fix longjmp bug Jiong Wang
@ 2013-03-01 10:31 ` Pedro Alves
2013-03-01 10:33 ` Jiong Wang
2013-03-01 13:13 ` char buf[] -> gdb_byte[] (was: Re: [RFC/TileGX] fix longjmp bug) Pedro Alves
0 siblings, 2 replies; 4+ messages in thread
From: Pedro Alves @ 2013-03-01 10:31 UTC (permalink / raw)
To: Jiong Wang; +Cc: gdb-patches
Thanks.
> gdb/ChangeLog:
>
> * tilegx-tdep.c (tilegx_get_longjmp_target): New function.
> (tilegx_gdbarch_init): Install it.
>
OK with the issues pointed out below fixed.
> +/* This is the implementation of gdbarch method get_longjmp_target. */
> +
> +static int
> +tilegx_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
> +{
> + struct gdbarch *gdbarch = get_frame_arch (frame);
> + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
> + CORE_ADDR jb_addr;
> + char buf[8];
s/char/gdb_byte/.
> +
> + jb_addr = get_frame_register_unsigned (frame, TILEGX_R0_REGNUM);
> +
> + /* TileGX jmp_buf contains 32 elements of type __uint_reg_t which
> + is size of 8bytes, the return address is stored in the 25th slot. */
Grammar:
/* TileGX's jmp_buf contains 32 elements of type __uint_reg_t which
has a size of 8 bytes. The return address is stored in the 25th
slot. */
> + if (target_read_memory (jb_addr + 25 * 8, buf, 8))
should be single space ---------------^
OK with these issues fixed.
--
Pedro Alves
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [RFC/TileGX] fix longjmp bug
2013-03-01 10:31 ` Pedro Alves
@ 2013-03-01 10:33 ` Jiong Wang
2013-03-01 13:13 ` char buf[] -> gdb_byte[] (was: Re: [RFC/TileGX] fix longjmp bug) Pedro Alves
1 sibling, 0 replies; 4+ messages in thread
From: Jiong Wang @ 2013-03-01 10:33 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
On 03/01/2013 06:31 PM, Pedro Alves wrote:
> Thanks.
>
>> gdb/ChangeLog:
>>
>> * tilegx-tdep.c (tilegx_get_longjmp_target): New function.
>> (tilegx_gdbarch_init): Install it.
>>
> OK with the issues pointed out below fixed.
>
>> +/* This is the implementation of gdbarch method get_longjmp_target. */
>> +
>> +static int
>> +tilegx_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
>> +{
>> + struct gdbarch *gdbarch = get_frame_arch (frame);
>> + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
>> + CORE_ADDR jb_addr;
>> + char buf[8];
> s/char/gdb_byte/.
>
>> +
>> + jb_addr = get_frame_register_unsigned (frame, TILEGX_R0_REGNUM);
>> +
>> + /* TileGX jmp_buf contains 32 elements of type __uint_reg_t which
>> + is size of 8bytes, the return address is stored in the 25th slot. */
> Grammar:
>
> /* TileGX's jmp_buf contains 32 elements of type __uint_reg_t which
> has a size of 8 bytes. The return address is stored in the 25th
> slot. */
>
>> + if (target_read_memory (jb_addr + 25 * 8, buf, 8))
> should be single space ---------------^
>
> OK with these issues fixed.
thanks for review !
--
Regards,
Jiong. Wang
Tilera Corporation.
^ permalink raw reply [flat|nested] 4+ messages in thread* char buf[] -> gdb_byte[] (was: Re: [RFC/TileGX] fix longjmp bug)
2013-03-01 10:31 ` Pedro Alves
2013-03-01 10:33 ` Jiong Wang
@ 2013-03-01 13:13 ` Pedro Alves
1 sibling, 0 replies; 4+ messages in thread
From: Pedro Alves @ 2013-03-01 13:13 UTC (permalink / raw)
Cc: Jiong Wang, gdb-patches
On 03/01/2013 10:31 AM, Pedro Alves wrote:
>> > +/* This is the implementation of gdbarch method get_longjmp_target. */
>> > +
>> > +static int
>> > +tilegx_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
>> > +{
>> > + struct gdbarch *gdbarch = get_frame_arch (frame);
>> > + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
>> > + CORE_ADDR jb_addr;
>> > + char buf[8];
> s/char/gdb_byte/.
>
BTW, clearly this was a copy paste from some other port.
I'm going through the tree grepping for "char buf[" and
fixing all I find.
--
Pedro Alves
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-03-01 13:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-01 9:58 [RFC/TileGX] fix longjmp bug Jiong Wang
2013-03-01 10:31 ` Pedro Alves
2013-03-01 10:33 ` Jiong Wang
2013-03-01 13:13 ` char buf[] -> gdb_byte[] (was: Re: [RFC/TileGX] fix longjmp bug) Pedro Alves
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox