* Uninitialised Variable in symfile.c
@ 2005-05-16 4:49 Steven Johnson
2005-05-16 10:21 ` Daniel Jacobowitz
0 siblings, 1 reply; 2+ messages in thread
From: Steven Johnson @ 2005-05-16 4:49 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 1041 bytes --]
There is a codepath is "load_section_callback" where the variable "err"
will not end up being assigned a value, and hence will default to
whatever happened to be on the stack at its location. And in my case,
it was defaulting to a vlaue which signaled an error, when none had occured.
This causes the following problem:
When attempting a "load" to a remote target, "load" fails after first
packet is successfuly transfered to the target with:
Loading section .text, size 0xdc220 lma 0x0
Sending packet: $X0,400:.....
[$][O][K][#][9][a]Packet received: OK
remote:target_xfer_partial (2, (null), 0x0, 0x40ed9008, 0x0, 1024) =
1024, bytes = 48 00 40 00 41 50 50 20 ...
Memory access error while loading section .text.
The call to "target_write_memory_partial" will not set "err" if it uses
"target_xfer_partial" to do the memory transfer, as
"target_xfer_partial" does not take "err" as a parameter.
The attached patch fixes this, by simply defaulting "err" to 0, the OK
state.
This is the subject of PR# 1944
Steven Johnson
[-- Attachment #2: gdb-6.3-load-remote-target-bug.patch --]
[-- Type: text/x-patch, Size: 469 bytes --]
diff -Naur gdb-6.3/gdb/symfile.c gdb-6.3-modified/gdb/symfile.c
--- gdb-6.3/gdb/symfile.c 2004-09-30 23:23:09.000000000 -1100
+++ gdb-6.3-modified/gdb/symfile.c 2005-05-14 21:01:18.959321653 -1100
@@ -1405,7 +1405,7 @@
struct cleanup *old_chain;
CORE_ADDR lma = bfd_section_lma (abfd, asec) + args->load_offset;
bfd_size_type block_size;
- int err;
+ int err = 0;
const char *sect_name = bfd_get_section_name (abfd, asec);
bfd_size_type sent;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Uninitialised Variable in symfile.c
2005-05-16 4:49 Uninitialised Variable in symfile.c Steven Johnson
@ 2005-05-16 10:21 ` Daniel Jacobowitz
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Jacobowitz @ 2005-05-16 10:21 UTC (permalink / raw)
To: Steven Johnson; +Cc: gdb-patches
On Mon, May 16, 2005 at 10:24:18AM -1100, Steven Johnson wrote:
> There is a codepath is "load_section_callback" where the variable "err"
> will not end up being assigned a value, and hence will default to
> whatever happened to be on the stack at its location. And in my case,
> it was defaulting to a vlaue which signaled an error, when none had occured.
This is already fixed in CVS, several months ago.
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-05-16 1:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-16 4:49 Uninitialised Variable in symfile.c Steven Johnson
2005-05-16 10:21 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox