Re: [patch] ia64: Fix breakpoints memory shadow

Joel Brobecker
2008-10-29T21:02:52Z

Hi Jan,

> 2008-10-28 Jan Kratochvil <jan.kratochvil@redhat.com>
>
> Fix automatic restoration of breakpoints memory for ia64.
> * ia64-tdep.c (ia64_memory_insert_breakpoint): New comment part for
> SHADOW_CONTENTS content. Remova variable instr. New variable cleanup.
> Force automatic breakpoints restoration. PLACED_SIZE and SHADOW_LEN
> are now set larger, to BUNDLE_LEN - 2.
> (ia64_memory_remove_breakpoint): Rename variables bundle to bundle_mem
> and instr to instr_saved. New variables bundle_saved and
> instr_breakpoint. Comment new reasons why we need to disable automatic
> restoration of breakpoints. Assert PLACED_SIZE and SHADOW_LEN. New
> check of the original memory content.
> (ia64_breakpoint_from_pc): Array breakpoint extended to BUNDLE_LEN.
> Sanity check the PCPTR parameter SLOTNUM value. New #if check on
> BREAKPOINT_MAX vs. BUNDLE_LEN. Increase LENPTR to BUNDLE_LEN - 2.

I understand the overall idea, but I don't understand the logic behind
saving BUNDLE_LEN - 2 bytes (14 bytes, then) of the bundle at bundle
address + slotnum. It looks like this introduces extra complexity.

Instead, would it be possible to save the entire bundle, when
inserting the breakpoint? When comes time to remove it, we would
only need to read the whole bundle, extract the original insn from
our saved bundle, and then push it back into the target bundle.

> +# We need to start the inferior to place the breakpoints in the memory at all.
> +if { [gdb_start_cmd] < 0 } {
> + untested start
> + return -1
> +}
> +gdb_test "" "main \\(\\) at .*" "start"

Why not use runto_main here?

--
Joel