This is the mail archive of the gdb-patches@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]

Re: [PATCH RFA] linespec.c: fix no_symtab_msg declaration



Factoring out strings like that is ridiculous.  I've committed a
change that removes no_symtab_msg altogether, and simply writes out
the string where it is used.

Thanks for finding the problem.

There was talk a while back about teaching the linker to use debugging
info to find the types of symbols, and actually type-check the link.
Wow.  That would have caught this problem at compile-time.


Kevin Buettner <kevinb@cygnus.com> writes:

> 
> The declaration of no_symtab_msg needs to be changed in order to avoid
> a crasher on startup....
> 
> (top-gdb) r
> Starting program: /saguaro1/sourceware-solib/bld-linux-ocotillo/gdb/gdb 
> During symbol reading...inner block (0x40000000-0x40000476) not inside outer block (0x400041f0-0x400071fa)...block at 0x40000022 out of order...
> GNU gdb 5.0
> Copyright 2000 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you are
> welcome to change it and/or distribute copies of it under certain conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" for details.
> This GDB was configured as "i686-pc-linux-gnu".
> Setting up the environment for debugging gdb.
> .gdbinit:5: Error in sourced command file:
> During symbol reading, 
> inner block (0x4007f000-0x4007f005) not inside outer block (0x400976a0-0x40097805).
> During symbol reading, block at 0x4007f063 out of order.
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x400c49d1 in vfprintf () at vfprintf.c:1565
> Line number 1565 out of range; vfprintf.c has 21 lines.
> (top-gdb) bt 8
> #0  0x400c49d1 in vfprintf () at vfprintf.c:1565
> #1  0x400d3581 in _IO_vasprintf (result_ptr=0xbffff488, 
>     format=0x73206f4e <Address 0x73206f4e out of bounds>, args=0xbffff4e0)
>     at vasprintf.c:58
> #2  0x80c45f8 in vfprintf_maybe_filtered (stream=0x81e88c0, 
>     format=0x73206f4e <Address 0x73206f4e out of bounds>, args=0xbffff4e0, 
>     filter=1) at ../../src/gdb/utils.c:1955
> #3  0x80c4662 in vfprintf_filtered (stream=0x81e88c0, 
>     format=0x73206f4e <Address 0x73206f4e out of bounds>, args=0xbffff4e0)
>     at ../../src/gdb/utils.c:1970
> #4  0x80c3320 in verror (string=0x73206f4e <Address 0x73206f4e out of bounds>, 
>     args=0xbffff4e0) at ../../src/gdb/utils.c:621
> #5  0x80c3370 in error_stream (stream=0x73206f4e) at ../../src/gdb/utils.c:636
> During symbol reading, Live range symbol not found 2.
> #6  0x808ab56 in decode_line_1 (argptr=0xbffff63c, funfirstline=1, 
>     default_symtab=0x0, default_line=0, canonical=0xbffff628)
>     at ../../src/gdb/linespec.c:1262
> #7  0x80d138a in parse_breakpoint_sals (address=0xbffff63c, sals=0xbffff62c, 
>     addr_string=0xbffff628) at ../../src/gdb/breakpoint.c:4590
> (More stack frames follow...)
> 
> The problem here is that no_symtab_msg was declared/defined as an
> array in symtab.c, but declared as a pointer variable in linespec.c. 
> As a result, the uses of no_symtab_msg in linespec.c were fetching the
> array contents and using it as a string pointer.
> 
> It would probably be a good idea to move the extern declarations to a
> header file, but since I'm not the maintainer of the files in
> question, I chose to make the minimal changes needed to avoid the
> crasher.
> 
> Okay to commit?
> 
> 	* linespec.c (no_symtab_msg): Make declaration match definition.
> 
> Index: linespec.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/linespec.c,v
> retrieving revision 1.1
> diff -u -p -r1.1 linespec.c
> --- linespec.c	2000/11/10 23:02:56	1.1
> +++ linespec.c	2000/11/19 03:58:41
> @@ -37,7 +37,7 @@ extern char *find_template_name_end (cha
>  
>  extern char *operator_chars (char *, char **);
>  
> -extern char *no_symtab_msg;
> +extern char no_symtab_msg[];
>  
>  /* Prototypes for local functions */
>  
> 
> 

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