This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

server/2052: load command reports failure even when no error occurs


>Number:         2052
>Category:       server
>Synopsis:       load command reports failure even when no error occurs
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Dec 19 20:28:01 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Eric Norum
>Release:        gdb-6.3 and current CVS trunk
>Organization:
>Environment:
Linux host, Darwin host, Remote target
>Description:
Start gdb, connect to remote server, attempt to download image:
(gdb) load
Loading section .text, size 0x19cd0 lma 0x40000
Memory access error while loading section .text.

The problem is that gdb/symfile.c load_section_callback() does not clear the error code before attempting to download.  Some paths through the remote server communication do not modify the error code so when control returns to load_section_callback the err variable has the same garbage value.
>How-To-Repeat:

>Fix:
Initialize 'err' to 0:

--- gdb-6.3-orig/gdb/symfile.c  2004-10-01 05:23:09.000000000 -0500
+++ gdb-6.3/gdb/symfile.c       2005-12-02 14:27:13.000000000 -0600
@@ -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;
>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]