From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9338 invoked by alias); 18 Nov 2004 21:32:36 -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 9261 invoked from network); 18 Nov 2004 21:32:33 -0000 Received: from unknown (HELO sccrmhc12.comcast.net) (204.127.202.56) by sourceware.org with SMTP; 18 Nov 2004 21:32:33 -0000 Received: from [10.0.1.2] (h000393256f12.ne.client2.attbi.com[24.61.199.96]) by comcast.net (sccrmhc12) with SMTP id <2004111821323201200aev9je>; Thu, 18 Nov 2004 21:32:33 +0000 User-Agent: Microsoft-Entourage/11.1.0.040913 Date: Thu, 18 Nov 2004 21:32:00 -0000 Subject: [patch - sort of] for 6.3 "int err;" not initialized in symfile.c/"load_section_callback (...)" From: Paul Schlie To: Message-ID: Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit X-SW-Source: 2004-11/txt/msg00382.txt.bz2 Hi, sorry, not exactly a patch, but it might help someone keep their hair a little longer... In symfile.c within "load_section_callback (...)", "int err;" is not initialized and may not be set by "target_write_memory_partial (...)", so therefore may appear to fail, although all is well; which was a minor pain discovering. (causing an apparent failure when loading remote memory) symfile.c: ... /* Callback service function for generic_load (bfd_map_over_sections). */ static void load_section_callback (bfd *abfd, asection *asec, void *data) { struct load_section_data *args = data; if (bfd_get_section_flags (abfd, asec) & SEC_LOAD) { bfd_size_type size = bfd_get_section_size (asec); if (size > 0) { char *buffer; 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; if (download_write_size > 0 && size > download_write_size) block_size = download_write_size; else block_size = size; buffer = xmalloc (size); old_chain = make_cleanup (xfree, buffer); /* Is this really necessary? I guess it gives the user something to look at during a long download. */ ui_out_message (uiout, 0, "Loading section %s, size 0x%s lma 0x%s\n", sect_name, paddr_nz (size), paddr_nz (lma)); bfd_get_section_contents (abfd, asec, buffer, 0, size); sent = 0; do { int len; bfd_size_type this_transfer = size - sent; if (this_transfer >= block_size) this_transfer = block_size; len = target_write_memory_partial (lma, buffer, this_transfer, &err); if (err) break; ... ---