This is the mail archive of the gdb-prs@sources.redhat.com 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]

gdb/535: GDB will not open symbol files if there is a space in the filename or path



>Number:         535
>Category:       gdb
>Synopsis:       GDB will not open symbol files if there is a space in the filename or path
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon May 06 15:58:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     craig@triscend.com
>Release:        unknown-1.0
>Organization:
>Environment:
Windows 2000/Cygwin
>Description:
symfile.c (generic_load()): assumes that there are no spaces in the path or filename for the symbol file to be loaded. This may not be the case, and indeed with eCos on Windows, it is installed into "C:\Program Files\", which causes an instant problem when trying to load symbol files.
>How-To-Repeat:

>Fix:
The attached patch, searches the path for the symbol file, and if a space is found it checks to see if a numeric value follows, if a numeric value follows the space it is used as the load address parameter, if no numeric value follows the space we assume it is just a space in the path or filename and continue looking for a numeric value.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="symfile.c.pat"
Content-Disposition: inline; filename="symfile.c.pat"

Index: gdb/symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.60
diff -c -p -r1.60 symfile.c
*** gdb/symfile.c	25 Apr 2002 16:29:27 -0000	1.60
--- gdb/symfile.c	6 May 2002 22:49:43 -0000
*************** generic_load (char *args, int from_tty)
*** 1334,1351 ****
    filename = xmalloc (strlen (args) + 1);
    old_cleanups = make_cleanup (xfree, filename);
    strcpy (filename, args);
!   offptr = strchr (filename, ' ');
!   if (offptr != NULL)
!     {
        char *endptr;
  
        cbdata.load_offset = strtoul (offptr, &endptr, 0);
!       if (offptr == endptr)
! 	error ("Invalid download offset:%s\n", offptr);
!       *offptr = '\0';
!     }
!   else
!     cbdata.load_offset = 0;
  
    /* Open the file for loading. */
    loadfile_bfd = bfd_openr (filename, gnutarget);
--- 1334,1359 ----
    filename = xmalloc (strlen (args) + 1);
    old_cleanups = make_cleanup (xfree, filename);
    strcpy (filename, args);
!   cbdata.load_offset = 0;
!   offptr = filename ;
!   while( ( offptr = strchr( offptr, ' ' ) ) != NULL )
!   {
        char *endptr;
  
        cbdata.load_offset = strtoul (offptr, &endptr, 0);
!       /*
!        * If we detected a value we need to exit the loop
!        * otherwise it could be a space in the file name,
!        * so continue and look for another space.
!        */
!       if (offptr != endptr)
!       {
!         *offptr = '\0';
!         break ;
!       }
! 
!       offptr++ ;
!   }
  
    /* Open the file for loading. */
    loadfile_bfd = bfd_openr (filename, gnutarget);


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