This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] [ia64] Fixup breakpoints errors handling
On Mon, 07 Sep 2009 20:32:59 +0200, Joel Brobecker wrote:
> On Sat, 05 Sep 2009 21:00:26 +0200, Jan Kratochvil wrote:
> > found out the code could already for example internal_error on uninitialized
> > memory after failed target_read_memory.
[...]
> > * ia64-tdep.c (ia64_memory_insert_breakpoint)
> > (ia64_memory_remove_breakpoint): Return immediately if any of memory
> > reads fail. Do not combine the VAL values.
>
> The patch is OK. I'm just curious as to which internal_error was
> triggered? Was it the one inside that function, or did it happen
> elsewhere?
I have not seen any such internal_error being triggered.
Still target_read_memory comment says:
If an error occurs, no guarantee is made about the contents of the
data at MYADDR.
Therefore:
val = target_read_memory (addr, bundle, BUNDLE_LEN);
...
instr_breakpoint = slotN_contents (bundle, slotnum);
if (instr_breakpoint == IA64_BREAKPOINT)
internal_error (__FILE__, __LINE__,
can induce the internal_error if either
(1) target_read_memory would just put random pattern to BUNDLE while failing
with the bad luck of matching IA64_BREAKPOINT.
or
(2) the autovariable BUNDLE would get randomly initialized to a random
pattern with the bad luck of matching IA64_BREAKPOINT while failing
target_read_memory would not touch the uninitialized content.
I do not think it could happen in the real world.
I will check it in with the other patch.
Thanks,
Jan