[patch] gdbarch_syscall_pc_increment
Yao Qi
yao@codesourcery.com
Thu Dec 13 01:33:00 GMT 2012
On 12/12/2012 11:42 PM, Aleksandar Ristovski wrote:
>
> This is generic for a given OS that happens to increment instruction
> pointer to allow user code to e.g. set errno.
>
> I provided only arm implementation, but other target cpus would need the
> same if they implement software single stepping.
>
> Increment is cpu specific for a given architecture.
>
'software single step' is implemented differently in the backend of each
port and your 'syscall_pc_increment' depends on the arch as well, so a
gdbarch hook is not needed here.
'gdbarch' stands for a certain general architecture, such as arm, mips,
and etc. 'gdbarch_tdep' contains the details of the cpus under this
architecture.
>
>> >
>> >If I understand your problem correctly, you have to define your own
>> >function 'arm_neutrino_syscall_next_pc' in your file
>> >arm-neutrino-tdep.c, and install it on function pointer
>> >'syscall_next_pc' (in 'struct gdbarch_tdep' in arm-tdep.h) in
>> >'arm_neutrino_init_abi'. Please have a look on how 'syscall_next_pc' is
>> >set in arm-linux-tdep.c. Then you can compute the pc for your own os in
>> >'arm_neutrino_syscall_next_pc'. Hope it helps.
>
> No, the destination is not a single address as we do not know the
> outcome of the syscall. It may come back with the instruction pointer of
> the next instruction after 'svc' but also 4 bytes later (4 bytes in our
> case, some other kernel may implement it differently).
You may need a specified field in 'struct gdbarch_tdep', for example,
/* Do a post fix of a software single step. */
void (*software_single_step_fixup) (struct frame_info *frame);
In arm_software_single_step,
@@ -5242,6 +5242,31 @@ arm_software_single_step (struct frame_i
next_pc = arm_get_next_pc (frame, get_frame_pc (frame));
arm_insert_single_step_breakpoint (gdbarch, aspace, next_pc);
+ tdep = gdbarch_tdep (gdbarch);
+ if (tdep->software_single_step_fixup)
+ tdep->software_single_step_fixup (frame);
+
and you need to initialize field 'software_single_step_fixup' somewhere,
and do what you need in it.
b.t.w, I don't see how 'set_gdbarch_syscall_pc_increment' is called in
your patch.
--
Yao (é½å°§)
More information about the Gdb-patches
mailing list