From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29988 invoked by alias); 15 May 2005 23:21:11 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 29929 invoked from network); 15 May 2005 23:21:04 -0000 Received: from unknown (HELO steven) (202.80.36.173) by sourceware.org with SMTP; 15 May 2005 23:21:04 -0000 Received: from neurizon.net (localhost [127.0.0.1]) by steven (Postfix) with ESMTP id 1757C1294DD for ; Mon, 16 May 2005 10:24:19 -1100 (GMT+11) Message-ID: <42890F82.8010005@neurizon.net> Date: Mon, 16 May 2005 04:49:00 -0000 From: Steven Johnson User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.6) Gecko/20040115 MIME-Version: 1.0 To: gdb-patches@sources.redhat.com Subject: Uninitialised Variable in symfile.c Content-Type: multipart/mixed; boundary="------------030201090300060305040403" X-SW-Source: 2005-05/txt/msg00396.txt.bz2 This is a multi-part message in MIME format. --------------030201090300060305040403 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1041 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 --------------030201090300060305040403 Content-Type: text/x-patch; name="gdb-6.3-load-remote-target-bug.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="gdb-6.3-load-remote-target-bug.patch" Content-length: 469 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; --------------030201090300060305040403--