binutils/stabs.c fixes
Steve deRosier
sderosier@vari-lite.com
Tue Jan 23 10:19:00 GMT 2001
Mark,
Thanks for the patch, but I'm not sure if it fixes things. Two things:
1. No big deal, but patch fails on the first chunk (the copyright
statement), so I just fixed that by hand. Everything else seemed to patch
just fine.
2. I think it is now reading the stuff just fine (which the patch
addresses), but now objcopy is segfaulting. I've managed to track it down
to where it is happening, but not why. Perhaps someone here can help.
The command is:
m68k-coff-objcopy --debugging -O ieee cs.coff.x cs.x
it segfaults in ieee.c ieee_start_compilation_unit line 4943 during the call
to strrchr.
if (info->filename != NULL)
{
if (! ieee_finish_compilation_unit (info))
return false;
}
4940 info->filename = filename;
modname = strrchr (filename, '/');
/* We could have a mixed forward/back slash case. */
4943 backslash = strrchr (modname, '\\');
When I ran it through gdb, it doesn't show line 4940; perhaps it has been
optimized out or moved later. I also can't seem to get it to show me the
global info (complains 'No symbol "info" in current context.') I am
probably just doing something wrong here since I am a gdb novice.
The segfault actually occurs in strrchr, but I can't seem to get the source
of this displayed. gdb gives:
Error while reading shared library symbols:
"/usr/platform/SUNW,Ultra-4/lib/libc_psr.so.1": can't read symbols: File
format not recognized.
So I disassembled:
(gdb) disassemble strrchr
Dump of assembler code for function strrchr:
0xef75774c <strrchr>: sll %o1, 0x18, %o2
0xef757750 <strrchr+4>: clr %o5
0xef757754 <strrchr+8>: sra %o2, 0x18, %o4
0xef757758 <strrchr+12>: ldsb [ %o0 ], %o3
0xef75775c <strrchr+16>: cmp %o3, %o4
0xef757760 <strrchr+20>: be,a 0xef757768 <strrchr+28>
0xef757764 <strrchr+24>: mov %o0, %o5
0xef757768 <strrchr+28>: ldsb [ %o0 ], %o1
0xef75776c <strrchr+32>: inc %o0
0xef757770 <strrchr+36>: tst %o1
0xef757774 <strrchr+40>: bne,a 0xef75775c <strrchr+16>
0xef757778 <strrchr+44>: ldsb [ %o0 ], %o3
0xef75777c <strrchr+48>: retl
0xef757780 <strrchr+52>: add %g0, %o5, %o0
End of assembler dump.
Of course since I am not familiar with SPARC assembly (and I don't really
feel like learning another assembly right now; I think IAPX, m68k and a
little MIPS is enough for now!), this doesn't really tell me much.
I hope that I am not giving too much irrelevant info, but I figured erring
on the side of too much was better.
- Steve
--
Steve deRosier
Embedded Software Engineer
Vari-Lite International, Inc.
----------
>From: "Mark E." <snowball3@bigfoot.com>
>To: binutils@sources.redhat.com
>Subject: binutils/stabs.c fixes
>Date: Sat, Jan 20, 2001, 11:21 PM
>
> Hi guys,
> I was reading through archive and noticed there was another bug in
> binutils/stabs.c that needed to be fixed. This patch incorporates Ian's
> suggested fix. But since gcc has no way to generate N_WARNING stabs it seems,
> the patch should probably first be tested by the person who reported the bug.
>
> Thanks,
> Mark
>
> binutils/ChangeLog:
>
> 2001-01-21 Mark Elbrecht <snowball3@bigfoot.com>
>
> * stabs.c: Update copyright. Include "filenames.h".
> * stabs.c (parse_stab): Use IS_ABSOLUTE_PATH. Ignore N_WARNING stabs.
>
> Index: stabs.c
> ===================================================================
> RCS file: /cvs/src/src/binutils/stabs.c,v
> retrieving revision 1.6
> diff -c -p -r1.6 stabs.c
> *** stabs.c 2000/07/10 14:51:04 1.6
> --- stabs.c 2001/01/21 04:36:27
> ***************
> *** 1,5 ****
> /* stabs.c -- Parse stabs debugging information
> ! Copyright (C) 1995, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
> Written by Ian Lance Taylor <ian@cygnus.com>.
>
> This file is part of GNU Binutils.
> --- 1,6 ----
> /* stabs.c -- Parse stabs debugging information
> ! Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000,
> ! 2001 Free Software Foundation, Inc.
> Written by Ian Lance Taylor <ian@cygnus.com>.
>
> This file is part of GNU Binutils.
> ***************
> *** 33,38 ****
> --- 34,40 ----
> #include "demangle.h"
> #include "debug.h"
> #include "budbg.h"
> + #include "filenames.h"
>
> /* Meaningless definition needs by aout64.h. FIXME. */
> #define BYTES_IN_WORD 4
> ***************
> *** 40,53 ****
> #include "aout/aout64.h"
> #include "aout/stab_gnu.h"
>
> - #ifndef DIR_SEPARATOR
> - #ifdef _WIN32
> - #define DIR_SEPARATOR '\\'
> - #else
> - #define DIR_SEPARATOR '/'
> - #endif
> - #endif
> -
> /* The number of predefined XCOFF types. */
>
> #define XCOFF_TYPE_COUNT 34
> --- 42,47 ----
> *************** parse_stab (dhandle, handle, type, desc,
> *** 568,579 ****
>
> f = info->so_string;
>
> ! if ( (string[0] == '/')
> ! || (string[0] == DIR_SEPARATOR)
> ! || ( (DIR_SEPARATOR == '\\')
> ! && (string[1] == ':')
> ! && ( (string[2] == DIR_SEPARATOR)
> ! || (string[2] == '/'))))
> info->so_string = xstrdup (string);
> else
> info->so_string = concat (info->so_string, string,
> --- 562,568 ----
>
> f = info->so_string;
>
> ! if (IS_ABSOLUTE_PATH (string))
> info->so_string = xstrdup (string);
> else
> info->so_string = concat (info->so_string, string,
> *************** parse_stab (dhandle, handle, type, desc,
> *** 706,711 ****
> --- 695,701 ----
> case N_OBJ:
> case N_ENDM:
> case N_MAIN:
> + case N_WARNING:
> break;
> }
>
More information about the Binutils
mailing list