This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] i386-tdep.c, check target_read_memory for error.
- From: Michael Snyder <msnyder at vmware dot com>
- To: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>, Mark Kettenis <mark dot kettenis at xs4all dot nl>
- Date: Sun, 06 Mar 2011 10:42:34 -0800
- Subject: Re: [RFA] i386-tdep.c, check target_read_memory for error.
- References: <4D715BB0.8030506@vmware.com> <20110306141515.GA1895@host1.jankratochvil.net>
Jan Kratochvil wrote:
On Fri, 04 Mar 2011 22:37:52 +0100, Michael Snyder wrote:
Call error if target_read_memory fails.
[...]
- target_read_memory (pc, &op, 1);
+ if (target_read_memory (pc, &op, 1))
+ error (_("Couldn't read memory at pc (%s)"),
+ paddress (gdbarch, pc));
There is the function `read_memory' for such purpose.
I don't understand the objection. target_read_memory may fail and
return an error code. Coverity reports that the return value is checked
in 78 out of 97 calling instances. So what's wrong with checking it now?