From: James Wilson <wilson@wilson.cygnus.com>
To: Michael Snyder <msnyder@cygnus.com>
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: gdb patch for 64-bit enum values on 64-bit hosts (ia64-linux)
Date: Mon, 19 Jun 2000 16:41:00 -0000 [thread overview]
Message-ID: <200006192341.QAA22716@wilson.cygnus.com> (raw)
In-Reply-To: <394828E5.6AFC@cygnus.com>
I updated my gdb and gcc source trees, and tried to run the gdb testsuite
with your gdb.base/exprs.{c,exp} patch. Unfortunately, gdb won't work for
me now. I don't know what the problem is, and it could take a while to
figure out. Perhaps gdb is broken, or perhaps gcc is broken, or perhaps I
need a kernel/glibc/whatever upgrade.
I did run your new tests on a 32-bit machine (ia32-linux) and got lots of
failures as I expected. Does the gdb testsuite have any support for host
specific tests? We can't expect 64-bit tests to work on 32-bit hosts.
Jim
From innadadadavida@yahoo.com Mon Jun 19 16:50:00 2000
From: Bob <innadadadavida@yahoo.com>
To: gdb-patches@sourceware.cygnus.com
Subject: unprotected references to partial symtab (core dump fix)
Date: Mon, 19 Jun 2000 16:50:00 -0000
Message-id: <20000619214200.12541.qmail@web5205.mail.yahoo.com>
X-SW-Source: 2000-06/msg00231.html
Content-length: 3969
This problem is reported against gdb 4.18 but remains in the 5.0 source
(which I haven't yet built successfully...)
Most references to "pst" in gdb/partial-stab.h are protected by "if (pst)"
equivalents, but two aren't. (A third instance has been fixed in 5.0.)
*** partial-stab.h-ORIG Sun Jun 28 14:36:50 1998
--- partial-stab.h Fri Jun 16 14:53:39 2000
***************
*** 592,596 ****
the partial symbol table. */
if (textlow_not_set
! || (CUR_SYMBOL_VALUE < pst->textlow
&& CUR_SYMBOL_VALUE
!= ANOFFSET (section_offsets, SECT_OFF_TEXT)))
--- 592,596 ----
the partial symbol table. */
if (textlow_not_set
! || (pst && CUR_SYMBOL_VALUE < pst->textlow
&& CUR_SYMBOL_VALUE
!= ANOFFSET (section_offsets, SECT_OFF_TEXT)))
***************
*** 638,642 ****
the partial symbol table. */
if (textlow_not_set
! || (CUR_SYMBOL_VALUE < pst->textlow
&& CUR_SYMBOL_VALUE
!= ANOFFSET (section_offsets, SECT_OFF_TEXT)))
--- 638,642 ----
the partial symbol table. */
if (textlow_not_set
! || (pst && CUR_SYMBOL_VALUE < pst->textlow
&& CUR_SYMBOL_VALUE
!= ANOFFSET (section_offsets, SECT_OFF_TEXT)))
GNU gdb 4.18
Copyright 1998 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 "sparc-sun-solaris2.5.1".
#0 0xa11b8 in read_dbx_symtab (section_offsets=0x2c5868, objfile=0x264750,
text_addr=223256, text_size=817312) at partial-stab.h:593
#1 0x9f488 in dbx_symfile_read (objfile=0x264750, section_offsets=0x2c5868,
mainline=0)
at dbxread.c:583
#2 0xa33c8 in elfstab_build_psymtabs (objfile=0x264750,
section_offsets=0x2c5868,
mainline=0, staboffset=3378038, stabsize=2509536, stabstroffset=2460208,
stabstrsize=3378037) at dbxread.c:2630
#3 0xa6cec in elf_symfile_read (objfile=0x264750, section_offsets=0x2c5868,
mainline=0)
at elfread.c:664
#4 0x62100 in syms_from_objfile (objfile=0x264750, addr=4013948928,
mainline=0, verbo=0)
at symfile.c:598
#5 0x62330 in symbol_file_add (
name=0x280b34 "", from_tty=0,
addr=4014172184, mainline=0, mapped=0, readnow=0, user_loaded=0,
is_solib=1)
at symfile.c:743
#6 0x78f5c in symbol_add_stub (arg=0x280b10) at solib.c:1040
#7 0xd6b84 in catch_errors (func=0x78e88 <symbol_add_stub>, args=0x280b10,
errstring=0x151198 "Error while reading shared library symbols:\n",
mask=3)
at top.c:558
#8 0x791d0 in solib_add (
arg_string=0x280b34 "", from_tty=0,
target=0x78c00) at solib.c:1176
#9 0x69bf4 in wait_for_inferior () at infrun.c:2082
#10 0x68d94 in proceed (addr=0, siggnal=TARGET_SIGNAL_0, step=0) at
infrun.c:922
#11 0x7da68 in procfs_create_inferior (exec_file=0x1b7638 "",
allargs=0x1dee08 "", env=0x1bed68)
at procfs.c:5522
#12 0x8a3d4 in sol_thread_create_inferior (exec_file=0x1b7638 "",
allargs=0x1dee08 "", env=0x1bed68)
at sol-thread.c:831
#13 0x8cd54 in find_default_create_inferior (
exec_file=0x1b7638 "",
allargs=0x1dee08 "", env=0x1bed68)
at target.c:1080
#14 0x66ef8 in run_command (args=0x1b5cda "",
from_tty=1) at infcmd.c:259
#15 0xd7914 in execute_command (p=0x1b5cff "b", from_tty=1) at top.c:1268
#16 0xd7b00 in command_loop () at top.c:1365
#17 0xdf40c in main (argc=3, argv=0xeffff714) at main.c:635
__________________________________________________
Do You Yahoo!?
Send instant messages with Yahoo! Messenger.
http://im.yahoo.com/
From wilson@wilson.cygnus.com Mon Jun 19 18:06:00 2000
From: James Wilson <wilson@wilson.cygnus.com>
To: Jim Blandy <jimb@cygnus.com>
Cc: gdb-patches@sourceware.cygnus.com, wilson@cygnus.com
Subject: Re: gdb patch for 64-bit enum values on 64-bit hosts (ia64-linux)
Date: Mon, 19 Jun 2000 18:06:00 -0000
Message-id: <200006200106.SAA22809@wilson.cygnus.com>
References: <npk8frhmkp.fsf@zwingli.cygnus.com>
X-SW-Source: 2000-06/msg00232.html
Content-length: 14760
In dwarf2read.c:read_array_type, I see two ifs that appear to handle
DW_FORM_udata, DW_FORM_data1, DW_FORM_data2, and DW_FORM_data4, but
not DW_FORM_data8, apparently assuming that DW_UNSND can't handle the
latter. With your change, this is no longer true on platforms with
64-bit longs.
I can trigger this problem with the following testcase.
char array[0x100000001];
main()
{
}
If I compile this with gcc -g, load it into gdb, and say "ptype array",
I get a complaint about an ignored array bound, and gdb says the array has
length two.
Making this work requires changing some internal types to use long, and
hence the result ends up changing a lot of files not just dwarf2read.c.
With the following patch, gdb reports the correct array size. Unfortunately,
I can't use "ptype array", I had to use "info variables". "ptype array"
tries to read the variable value, which requires allocating 4GB+1 bytes of
memory, which I don't have, so I get an internal out-of-memory error.
This has not been tested against the gdb testsuite. I am currently unable
to run the gdb testsuite. I need gdb to work, so I will be investigating
this problem, though I expect it will take some time.
2000-06-19 James E. Wilson <wilson@cygnus.com>
* c-typeprint.c (c_type_print_varspec_suffix): Use %ld for TYPE_LENGTH.
* ch-valprint.c (chill_val_print): Likewise.
* f-typeprint.c (print_equivalent_f77_float_type, f_type_print_base):
Likewise.
* gdbtypes.c (recursive_dump_type): Likewise.
* symmisc.c (print_symbol): Likewise.
* tracepoint.c (scope_info): Likewise.
* c-typeprint.c (c_type_print_base): Use %ld for TYPE_FIELD_BITPOS.
* ch-typeprint.c (chill_type_print_base, chill_type_print_base):
Likewise.
* gdbtypes.c (recursive_dump_type): Likewise.
* dwarf2read.c (read_array_type): Change type of low and high to long.
Accept DW_FORM_data8 attributes.
* gdbtypes.c (create_range_type): Change type of low_bound and
high_bound to long.
* gdbtypes.h (struct type): Change type of length and bitpos fields to
long.
(create_range_type): Change prototype to use long.
Index: c-typeprint.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/c-typeprint.c,v
retrieving revision 2.42
diff -p -r2.42 c-typeprint.c
*** c-typeprint.c 2000/02/04 19:48:52 2.42
--- c-typeprint.c 2000/06/20 00:50:45
*************** c_type_print_varspec_suffix (type, strea
*** 591,597 ****
fprintf_filtered (stream, "[");
if (TYPE_LENGTH (type) >= 0 && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0
&& TYPE_ARRAY_UPPER_BOUND_TYPE (type) != BOUND_CANNOT_BE_DETERMINED)
! fprintf_filtered (stream, "%d",
(TYPE_LENGTH (type)
/ TYPE_LENGTH (TYPE_TARGET_TYPE (type))));
fprintf_filtered (stream, "]");
--- 591,597 ----
fprintf_filtered (stream, "[");
if (TYPE_LENGTH (type) >= 0 && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0
&& TYPE_ARRAY_UPPER_BOUND_TYPE (type) != BOUND_CANNOT_BE_DETERMINED)
! fprintf_filtered (stream, "%ld",
(TYPE_LENGTH (type)
/ TYPE_LENGTH (TYPE_TARGET_TYPE (type))));
fprintf_filtered (stream, "]");
*************** c_type_print_base (type, stream, show, l
*** 1146,1152 ****
fputs_filtered (TYPE_FIELD_NAME (type, i), stream);
if (lastval != TYPE_FIELD_BITPOS (type, i))
{
! fprintf_filtered (stream, " = %d", TYPE_FIELD_BITPOS (type, i));
lastval = TYPE_FIELD_BITPOS (type, i);
}
lastval++;
--- 1146,1152 ----
fputs_filtered (TYPE_FIELD_NAME (type, i), stream);
if (lastval != TYPE_FIELD_BITPOS (type, i))
{
! fprintf_filtered (stream, " = %ld", TYPE_FIELD_BITPOS (type, i));
lastval = TYPE_FIELD_BITPOS (type, i);
}
lastval++;
Index: ch-typeprint.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/ch-typeprint.c,v
retrieving revision 2.24
diff -p -r2.24 ch-typeprint.c
*** ch-typeprint.c 2000/02/01 03:09:00 2.24
--- ch-typeprint.c 2000/06/20 00:50:45
*************** chill_type_print_base (type, stream, sho
*** 146,152 ****
break;
case TYPE_CODE_BITSTRING:
! fprintf_filtered (stream, "BOOLS (%d)",
TYPE_FIELD_BITPOS (TYPE_FIELD_TYPE (type, 0), 1) + 1);
break;
--- 146,152 ----
break;
case TYPE_CODE_BITSTRING:
! fprintf_filtered (stream, "BOOLS (%ld)",
TYPE_FIELD_BITPOS (TYPE_FIELD_TYPE (type, 0), 1) + 1);
break;
*************** chill_type_print_base (type, stream, sho
*** 311,317 ****
fputs_filtered (TYPE_FIELD_NAME (type, i), stream);
if (lastval != TYPE_FIELD_BITPOS (type, i))
{
! fprintf_filtered (stream, " = %d", TYPE_FIELD_BITPOS (type, i));
lastval = TYPE_FIELD_BITPOS (type, i);
}
lastval++;
--- 311,317 ----
fputs_filtered (TYPE_FIELD_NAME (type, i), stream);
if (lastval != TYPE_FIELD_BITPOS (type, i))
{
! fprintf_filtered (stream, " = %ld", TYPE_FIELD_BITPOS (type, i));
lastval = TYPE_FIELD_BITPOS (type, i);
}
lastval++;
Index: ch-valprint.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/ch-valprint.c,v
retrieving revision 2.42
diff -p -r2.42 ch-valprint.c
*** ch-valprint.c 2000/02/01 03:09:00 2.42
--- ch-valprint.c 2000/06/20 00:50:45
*************** chill_val_print (type, valaddr, embedded
*** 427,433 ****
if (length > TYPE_LENGTH (type) - 2)
{
fprintf_filtered (stream,
! "<dynamic length %ld > static length %d> *invalid*",
length, TYPE_LENGTH (type));
/* Don't print the string; doing so might produce a
--- 427,433 ----
if (length > TYPE_LENGTH (type) - 2)
{
fprintf_filtered (stream,
! "<dynamic length %ld > static length %ld> *invalid*",
length, TYPE_LENGTH (type));
/* Don't print the string; doing so might produce a
Index: dwarf2read.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/dwarf2read.c,v
retrieving revision 2.46
diff -p -r2.46 dwarf2read.c
*** dwarf2read.c 2000/06/19 22:19:53 2.46
--- dwarf2read.c 2000/06/20 00:50:45
*************** read_array_type (die, objfile)
*** 2415,2421 ****
{
if (child_die->tag == DW_TAG_subrange_type)
{
! unsigned int low, high;
/* Default bounds to an array with unspecified length. */
low = 0;
--- 2415,2421 ----
{
if (child_die->tag == DW_TAG_subrange_type)
{
! unsigned long int low, high;
/* Default bounds to an array with unspecified length. */
low = 0;
*************** read_array_type (die, objfile)
*** 2437,2443 ****
else if (attr->form == DW_FORM_udata
|| attr->form == DW_FORM_data1
|| attr->form == DW_FORM_data2
! || attr->form == DW_FORM_data4)
{
low = DW_UNSND (attr);
}
--- 2437,2444 ----
else if (attr->form == DW_FORM_udata
|| attr->form == DW_FORM_data1
|| attr->form == DW_FORM_data2
! || attr->form == DW_FORM_data4
! || attr->form == DW_FORM_data8)
{
low = DW_UNSND (attr);
}
*************** read_array_type (die, objfile)
*** 2463,2469 ****
else if (attr->form == DW_FORM_udata
|| attr->form == DW_FORM_data1
|| attr->form == DW_FORM_data2
! || attr->form == DW_FORM_data4)
{
high = DW_UNSND (attr);
}
--- 2464,2471 ----
else if (attr->form == DW_FORM_udata
|| attr->form == DW_FORM_data1
|| attr->form == DW_FORM_data2
! || attr->form == DW_FORM_data4
! || attr->form == DW_FORM_data8)
{
high = DW_UNSND (attr);
}
Index: f-typeprint.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/f-typeprint.c,v
retrieving revision 2.14
diff -p -r2.14 f-typeprint.c
*** f-typeprint.c 2000/02/01 03:09:00 2.14
--- f-typeprint.c 2000/06/20 00:50:45
*************** print_equivalent_f77_float_type (type, s
*** 320,326 ****
appropriate real. XLC stupidly outputs -12 as a type
for real when it really should be outputting -18 */
! fprintf_filtered (stream, "real*%d", TYPE_LENGTH (type));
}
/* Print the name of the type (or the ultimate pointer target,
--- 320,326 ----
appropriate real. XLC stupidly outputs -12 as a type
for real when it really should be outputting -18 */
! fprintf_filtered (stream, "real*%ld", TYPE_LENGTH (type));
}
/* Print the name of the type (or the ultimate pointer target,
*************** f_type_print_base (type, stream, show, l
*** 420,426 ****
break;
case TYPE_CODE_COMPLEX:
! fprintf_filtered (stream, "complex*%d", TYPE_LENGTH (type));
break;
case TYPE_CODE_FLT:
--- 420,426 ----
break;
case TYPE_CODE_COMPLEX:
! fprintf_filtered (stream, "complex*%ld", TYPE_LENGTH (type));
break;
case TYPE_CODE_FLT:
Index: gdbtypes.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/gdbtypes.c,v
retrieving revision 2.109
diff -p -r2.109 gdbtypes.c
*** gdbtypes.c 2000/05/28 01:25:29 2.109
--- gdbtypes.c 2000/06/20 00:50:45
*************** struct type *
*** 450,457 ****
create_range_type (result_type, index_type, low_bound, high_bound)
struct type *result_type;
struct type *index_type;
! int low_bound;
! int high_bound;
{
if (result_type == NULL)
{
--- 450,457 ----
create_range_type (result_type, index_type, low_bound, high_bound)
struct type *result_type;
struct type *index_type;
! long low_bound;
! long high_bound;
{
if (result_type == NULL)
{
*************** recursive_dump_type (type, spaces)
*** 2798,2804 ****
break;
}
puts_filtered ("\n");
! printfi_filtered (spaces, "length %d\n", TYPE_LENGTH (type));
printfi_filtered (spaces, "objfile ");
gdb_print_host_address (TYPE_OBJFILE (type), gdb_stdout);
printf_filtered ("\n");
--- 2798,2804 ----
break;
}
puts_filtered ("\n");
! printfi_filtered (spaces, "length %ld\n", TYPE_LENGTH (type));
printfi_filtered (spaces, "objfile ");
gdb_print_host_address (TYPE_OBJFILE (type), gdb_stdout);
printf_filtered ("\n");
*************** recursive_dump_type (type, spaces)
*** 2831,2837 ****
for (idx = 0; idx < TYPE_NFIELDS (type); idx++)
{
printfi_filtered (spaces + 2,
! "[%d] bitpos %d bitsize %d type ",
idx, TYPE_FIELD_BITPOS (type, idx),
TYPE_FIELD_BITSIZE (type, idx));
gdb_print_host_address (TYPE_FIELD_TYPE (type, idx), gdb_stdout);
--- 2831,2837 ----
for (idx = 0; idx < TYPE_NFIELDS (type); idx++)
{
printfi_filtered (spaces + 2,
! "[%d] bitpos %ld bitsize %d type ",
idx, TYPE_FIELD_BITPOS (type, idx),
TYPE_FIELD_BITSIZE (type, idx));
gdb_print_host_address (TYPE_FIELD_TYPE (type, idx), gdb_stdout);
Index: gdbtypes.h
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/gdbtypes.h,v
retrieving revision 2.83
diff -p -r2.83 gdbtypes.h
*** gdbtypes.h 2000/05/28 01:25:29 2.83
--- gdbtypes.h 2000/06/20 00:50:45
*************** struct type
*** 241,247 ****
TARGET_CHAR_BIT)--the other choice would be to make it
consistently in units of HOST_CHAR_BIT. */
! unsigned length;
/* FIXME, these should probably be restricted to a Fortran-specific
field in some fashion. */
--- 241,247 ----
TARGET_CHAR_BIT)--the other choice would be to make it
consistently in units of HOST_CHAR_BIT. */
! unsigned long length;
/* FIXME, these should probably be restricted to a Fortran-specific
field in some fashion. */
*************** struct type
*** 333,339 ****
of this argument.
For a range bound or enum value, this is the value itself. */
! int bitpos;
/* For a static field, if TYPE_FIELD_STATIC_HAS_ADDR then physaddr
is the location (in the target) of the static field.
--- 333,339 ----
of this argument.
For a range bound or enum value, this is the value itself. */
! long bitpos;
/* For a static field, if TYPE_FIELD_STATIC_HAS_ADDR then physaddr
is the location (in the target) of the static field.
*************** extern struct type *make_function_type (
*** 983,990 ****
extern struct type *lookup_function_type (struct type *);
! extern struct type *create_range_type (struct type *, struct type *, int,
! int);
extern struct type *create_array_type (struct type *, struct type *,
struct type *);
--- 983,990 ----
extern struct type *lookup_function_type (struct type *);
! extern struct type *create_range_type (struct type *, struct type *, long,
! long);
extern struct type *create_array_type (struct type *, struct type *,
struct type *);
Index: symmisc.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/symmisc.c,v
retrieving revision 1.87
diff -p -r1.87 symmisc.c
*** symmisc.c 2000/05/28 01:25:35 1.87
--- symmisc.c 2000/06/20 00:50:45
*************** print_symbol (args)
*** 623,629 ****
{
unsigned i;
struct type *type = check_typedef (SYMBOL_TYPE (symbol));
! fprintf_filtered (outfile, "const %u hex bytes:",
TYPE_LENGTH (type));
for (i = 0; i < TYPE_LENGTH (type); i++)
fprintf_filtered (outfile, " %02x",
--- 623,629 ----
{
unsigned i;
struct type *type = check_typedef (SYMBOL_TYPE (symbol));
! fprintf_filtered (outfile, "const %lu hex bytes:",
TYPE_LENGTH (type));
for (i = 0; i < TYPE_LENGTH (type); i++)
fprintf_filtered (outfile, " %02x",
Index: tracepoint.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/tracepoint.c,v
retrieving revision 2.58
diff -p -r2.58 tracepoint.c
*** tracepoint.c 2000/06/04 00:35:17 2.58
--- tracepoint.c 2000/06/20 00:50:45
*************** scope_info (args, from_tty)
*** 2519,2525 ****
continue;
}
if (SYMBOL_TYPE (sym))
! printf_filtered (", length %d.\n",
TYPE_LENGTH (check_typedef (SYMBOL_TYPE (sym))));
}
if (BLOCK_FUNCTION (block))
--- 2519,2525 ----
continue;
}
if (SYMBOL_TYPE (sym))
! printf_filtered (", length %ld.\n",
TYPE_LENGTH (check_typedef (SYMBOL_TYPE (sym))));
}
if (BLOCK_FUNCTION (block))
From ac131313@cygnus.com Mon Jun 19 18:18:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: Alan Modra <alan@linuxcare.com.au>
Cc: BINUTILS Patches <binutils@sourceware.cygnus.com>, GDB Patches <gdb-patches@sourceware.cygnus.com>
Subject: Re: [rfc] For mips, sign-extended ecoff offsets
Date: Mon, 19 Jun 2000 18:18:00 -0000
Message-id: <394EC637.24300B87@cygnus.com>
References: <Pine.LNX.4.21.0006200100160.12273-100000@front.linuxcare.com.au>
X-SW-Source: 2000-06/msg00233.html
Content-length: 12020
Alan Modra wrote:
>
> On Mon, 19 Jun 2000, Andrew Cagney wrote:
>
> > The attatched patch changes the MIPS ELF32 backend so that it is more
> > likely to return a sign-extended offset. At present the ELF backend
> > returns sign-extended symbol table values but not sign extended debug
> > information.
>
> Hi Andrew,
> Would it be better to just change ecoff_swap_sym_in? It seems like
> this would achieve what you want, and not risk breaking quite so much.
> I'm worried about what happens if things like PDR.adr get changed from
> 0xa0000000 to 0xffffffffa0000000.
Thats why I'm asking :-) Remember though, on the MIPS platform, if
``PDR.adr'' is an address then, the canonical form of the value
``0xa0000000'' obtained from an elf32 binary is 0xffffffffa00000000.
GDB and BFD have, for too many years, been bribed and cajoled into
perpetuated the lie that MIPS doesn't sign extend addresses. GDB's now
decided to come clean on this matter (and purge an amazing amount of
bogus code :-).
Any way I've attached a revised patch. I wasn't ruthless enough the
first time.... With this revision the linker appears to work :-)
Testing is continuing.
I guess the question for BFD people is, is this the correct approach to
fixing this bug?
Andrew
Mon Jun 19 20:53:14 2000 Andrew Cagney <cagney@b1.cygnus.com>
* ecoffswap.h (ecoff_get_off, ecoff_put_off): Add ECOFF_SIGNED_32
and ECOF_SIGNED_64 to list ways to extract an offset.
* elf64-mips.c (ECOFF_SIGNED_64): Define instead of ECOFF_64.
* elf32-mips.c (ECOFF_SIGNED_32): Define instead of ECOFF_32.
Index: ecoffswap.h
===================================================================
RCS file: /cvs/cvsfiles/devo/bfd/ecoffswap.h,v
retrieving revision 1.19
diff -p -r1.19 ecoffswap.h
*** ecoffswap.h 1996/03/12 22:41:13 1.19
--- ecoffswap.h 2000/06/20 01:02:48
*************** Foundation, Inc., 59 Temple Place - Suit
*** 27,36 ****
on them in gdb by naming the including source file; e.g.,
'coff-mips.c':ecoff_swap_hdr_in.
! Before including this header file, one of ECOFF_32 or ECOFF_64 must
! be defined. These are checked when swapping information that
! depends upon the target size. This code works for 32 bit and 64
! bit ECOFF, but may need to be generalized in the future.
Some header file which defines the external forms of these
structures must also be included before including this header file.
--- 27,37 ----
on them in gdb by naming the including source file; e.g.,
'coff-mips.c':ecoff_swap_hdr_in.
! Before including this header file, one of ECOFF_32, ECOFF_64,
! ECOF_SIGNED_32 or ECOFF_SIGNED_64 must be defined. These are
! checked when swapping information that depends upon the target
! size. This code works for 32 bit and 64 bit ECOFF, but may need to
! be generalized in the future.
Some header file which defines the external forms of these
structures must also be included before including this header file.
*************** Foundation, Inc., 59 Temple Place - Suit
*** 50,55 ****
--- 51,64 ----
#define ecoff_get_off bfd_h_get_64
#define ecoff_put_off bfd_h_put_64
#endif
+ #ifdef ECOFF_SIGNED_32
+ #define ecoff_get_off bfd_h_get_signed_32
+ #define ecoff_put_off bfd_h_put_signed_32
+ #endif
+ #ifdef ECOFF_SIGNED_64
+ #define ecoff_get_off bfd_h_get_signed_64
+ #define ecoff_put_off bfd_h_put_signed_64
+ #endif
/* ECOFF auxiliary information swapping routines. These are the same
for all ECOFF targets, so they are defined in ecofflink.c. */
*************** ecoff_swap_fdr_in (abfd, ext_copy, inter
*** 185,191 ****
intern->adr = ecoff_get_off (abfd, (bfd_byte *)ext->f_adr);
intern->rss = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_rss);
! #ifdef ECOFF_64
if (intern->rss == 0xffffffff)
intern->rss = -1;
#endif
--- 194,200 ----
intern->adr = ecoff_get_off (abfd, (bfd_byte *)ext->f_adr);
intern->rss = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_rss);
! #if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
if (intern->rss == 0xffffffff)
intern->rss = -1;
#endif
*************** ecoff_swap_fdr_in (abfd, ext_copy, inter
*** 197,207 ****
intern->cline = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_cline);
intern->ioptBase = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_ioptBase);
intern->copt = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_copt);
! #ifdef ECOFF_32
intern->ipdFirst = bfd_h_get_16 (abfd, (bfd_byte *)ext->f_ipdFirst);
intern->cpd = bfd_h_get_16 (abfd, (bfd_byte *)ext->f_cpd);
#endif
! #ifdef ECOFF_64
intern->ipdFirst = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_ipdFirst);
intern->cpd = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_cpd);
#endif
--- 206,216 ----
intern->cline = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_cline);
intern->ioptBase = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_ioptBase);
intern->copt = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_copt);
! #if defined (ECOFF_32) || defined (ECOFF_SIGNED_32)
intern->ipdFirst = bfd_h_get_16 (abfd, (bfd_byte *)ext->f_ipdFirst);
intern->cpd = bfd_h_get_16 (abfd, (bfd_byte *)ext->f_cpd);
#endif
! #if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
intern->ipdFirst = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_ipdFirst);
intern->cpd = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_cpd);
#endif
*************** ecoff_swap_fdr_out (abfd, intern_copy, e
*** 262,272 ****
bfd_h_put_32 (abfd, intern->cline, (bfd_byte *)ext->f_cline);
bfd_h_put_32 (abfd, intern->ioptBase, (bfd_byte *)ext->f_ioptBase);
bfd_h_put_32 (abfd, intern->copt, (bfd_byte *)ext->f_copt);
! #ifdef ECOFF_32
bfd_h_put_16 (abfd, intern->ipdFirst, (bfd_byte *)ext->f_ipdFirst);
bfd_h_put_16 (abfd, intern->cpd, (bfd_byte *)ext->f_cpd);
#endif
! #ifdef ECOFF_64
bfd_h_put_32 (abfd, intern->ipdFirst, (bfd_byte *)ext->f_ipdFirst);
bfd_h_put_32 (abfd, intern->cpd, (bfd_byte *)ext->f_cpd);
#endif
--- 271,281 ----
bfd_h_put_32 (abfd, intern->cline, (bfd_byte *)ext->f_cline);
bfd_h_put_32 (abfd, intern->ioptBase, (bfd_byte *)ext->f_ioptBase);
bfd_h_put_32 (abfd, intern->copt, (bfd_byte *)ext->f_copt);
! #if defined (ECOFF_32) || defined (ECOFF_SIGNED_32)
bfd_h_put_16 (abfd, intern->ipdFirst, (bfd_byte *)ext->f_ipdFirst);
bfd_h_put_16 (abfd, intern->cpd, (bfd_byte *)ext->f_cpd);
#endif
! #if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
bfd_h_put_32 (abfd, intern->ipdFirst, (bfd_byte *)ext->f_ipdFirst);
bfd_h_put_32 (abfd, intern->cpd, (bfd_byte *)ext->f_cpd);
#endif
*************** ecoff_swap_pdr_in (abfd, ext_copy, inter
*** 341,347 ****
intern->lnHigh = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_lnHigh);
intern->cbLineOffset = ecoff_get_off (abfd, (bfd_byte *)ext->p_cbLineOffset);
! #ifdef ECOFF_64
intern->gp_prologue = bfd_h_get_8 (abfd, (bfd_byte *) ext->p_gp_prologue);
if (bfd_header_big_endian (abfd))
{
--- 350,356 ----
intern->lnHigh = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_lnHigh);
intern->cbLineOffset = ecoff_get_off (abfd, (bfd_byte *)ext->p_cbLineOffset);
! #if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
intern->gp_prologue = bfd_h_get_8 (abfd, (bfd_byte *) ext->p_gp_prologue);
if (bfd_header_big_endian (abfd))
{
*************** ecoff_swap_pdr_out (abfd, intern_copy, e
*** 400,406 ****
bfd_h_put_32 (abfd, intern->lnHigh, (bfd_byte *)ext->p_lnHigh);
ecoff_put_off (abfd, intern->cbLineOffset, (bfd_byte *)ext->p_cbLineOffset);
! #ifdef ECOFF_64
bfd_h_put_8 (abfd, intern->gp_prologue, (bfd_byte *) ext->p_gp_prologue);
if (bfd_header_big_endian (abfd))
{
--- 409,415 ----
bfd_h_put_32 (abfd, intern->lnHigh, (bfd_byte *)ext->p_lnHigh);
ecoff_put_off (abfd, intern->cbLineOffset, (bfd_byte *)ext->p_cbLineOffset);
! #if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
bfd_h_put_8 (abfd, intern->gp_prologue, (bfd_byte *) ext->p_gp_prologue);
if (bfd_header_big_endian (abfd))
{
*************** ecoff_swap_ext_in (abfd, ext_copy, inter
*** 629,638 ****
}
intern->reserved = 0;
! #ifdef ECOFF_32
intern->ifd = bfd_h_get_signed_16 (abfd, (bfd_byte *)ext->es_ifd);
#endif
! #ifdef ECOFF_64
intern->ifd = bfd_h_get_signed_32 (abfd, (bfd_byte *)ext->es_ifd);
#endif
--- 638,647 ----
}
intern->reserved = 0;
! #if defined (ECOFF_32) || defined (ECOFF_SIGNED_32)
intern->ifd = bfd_h_get_signed_16 (abfd, (bfd_byte *)ext->es_ifd);
#endif
! #if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
intern->ifd = bfd_h_get_signed_32 (abfd, (bfd_byte *)ext->es_ifd);
#endif
*************** ecoff_swap_ext_out (abfd, intern_copy, e
*** 663,669 ****
| (intern->cobol_main ? EXT_BITS1_COBOL_MAIN_BIG : 0)
| (intern->weakext ? EXT_BITS1_WEAKEXT_BIG : 0));
ext->es_bits2[0] = 0;
! #ifdef ECOFF_64
ext->es_bits2[1] = 0;
ext->es_bits2[2] = 0;
#endif
--- 672,678 ----
| (intern->cobol_main ? EXT_BITS1_COBOL_MAIN_BIG : 0)
| (intern->weakext ? EXT_BITS1_WEAKEXT_BIG : 0));
ext->es_bits2[0] = 0;
! #if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
ext->es_bits2[1] = 0;
ext->es_bits2[2] = 0;
#endif
*************** ecoff_swap_ext_out (abfd, intern_copy, e
*** 672,687 ****
| (intern->cobol_main ? EXT_BITS1_COBOL_MAIN_LITTLE : 0)
| (intern->weakext ? EXT_BITS1_WEAKEXT_LITTLE : 0));
ext->es_bits2[0] = 0;
! #ifdef ECOFF_64
ext->es_bits2[1] = 0;
ext->es_bits2[2] = 0;
#endif
}
! #ifdef ECOFF_32
bfd_h_put_signed_16 (abfd, intern->ifd, (bfd_byte *)ext->es_ifd);
#endif
! #ifdef ECOFF_64
bfd_h_put_signed_32 (abfd, intern->ifd, (bfd_byte *)ext->es_ifd);
#endif
--- 681,696 ----
| (intern->cobol_main ? EXT_BITS1_COBOL_MAIN_LITTLE : 0)
| (intern->weakext ? EXT_BITS1_WEAKEXT_LITTLE : 0));
ext->es_bits2[0] = 0;
! #if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
ext->es_bits2[1] = 0;
ext->es_bits2[2] = 0;
#endif
}
! #if defined (ECOFF_32) || defined (ECOFF_SIGNED_32)
bfd_h_put_signed_16 (abfd, intern->ifd, (bfd_byte *)ext->es_ifd);
#endif
! #if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
bfd_h_put_signed_32 (abfd, intern->ifd, (bfd_byte *)ext->es_ifd);
#endif
Index: elf32-mips.c
===================================================================
RCS file: /cvs/cvsfiles/devo/bfd/elf32-mips.c,v
retrieving revision 1.176
diff -p -r1.176 elf32-mips.c
*** elf32-mips.c 2000/05/29 16:45:57 1.176
--- elf32-mips.c 2000/06/20 01:03:07
*************** Foundation, Inc., 59 Temple Place - Suit
*** 40,46 ****
#include "coff/internal.h"
#include "coff/ecoff.h"
#include "coff/mips.h"
! #define ECOFF_32
#include "ecoffswap.h"
/* This structure is used to hold .got information when linking. It
--- 40,46 ----
#include "coff/internal.h"
#include "coff/ecoff.h"
#include "coff/mips.h"
! #define ECOFF_SIGNED_32
#include "ecoffswap.h"
/* This structure is used to hold .got information when linking. It
Index: elf64-mips.c
===================================================================
RCS file: /cvs/cvsfiles/devo/bfd/elf64-mips.c,v
retrieving revision 1.18
diff -p -r1.18 elf64-mips.c
*** elf64-mips.c 1999/12/10 10:49:53 1.18
--- elf64-mips.c 2000/06/20 01:03:09
*************** Foundation, Inc., 59 Temple Place - Suit
*** 45,51 ****
#include "coff/ecoff.h"
/* The 64 bit versions of the mdebug data structures are in alpha.h. */
#include "coff/alpha.h"
! #define ECOFF_64
#include "ecoffswap.h"
static void mips_elf64_swap_reloc_in
--- 45,51 ----
#include "coff/ecoff.h"
/* The 64 bit versions of the mdebug data structures are in alpha.h. */
#include "coff/alpha.h"
! #define ECOFF_SIGNED_64
#include "ecoffswap.h"
static void mips_elf64_swap_reloc_in
From ac131313@cygnus.com Mon Jun 19 18:29:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: GDB Patches <gdb-patches@sourceware.cygnus.com>
Subject: [Fwd: [rfc] For mips, sign-extended ecoff offsets]
Date: Mon, 19 Jun 2000 18:29:00 -0000
Message-id: <394EC8C8.C90112BF@cygnus.com>
X-SW-Source: 2000-06/msg00234.html
Content-length: 1250
Something for the symtab maintainers - perhaphs an internal sanity check
is possible?
Somewhere in gdb is code that merges the various pieces of symbolic
information. In the case below I was seeing:
o gdb read in a symbol with a
sign extended value (asymbol)
o gdb read in the same symbol
but not sign extended (ecoff_swap_sym_in)
o something
o gdb ``maint print msymtab'' with
the bad value.
If anyone knows where that ``something'' which is doing a merge is,
could I suggest a sanity check to ensure that the merged symbols
actually have the same address.
enjoy,
Andrew
PS: I'm still not sure where that ``something'' is :-)
> Hello,
>
> The attatched patch changes the MIPS ELF32 backend so that it is more
> likely to return a sign-extended offset. At present the ELF backend
> returns sign-extended symbol table values but not sign extended debug
> information.
>
> For instance, an asymbol might contain 0xfffffffa0100124 yet the value
> returned by ecoff_swap_sym_in() is 0xa0100124.
>
> Preliminary tests with GDB suggest this improves things significantly.
> Next question is, what damage is this likely to do to BFD and the
> linker.
>
> Andrew
>
> PS: This will hurt GDB more than it can hurt BFD :-)
From ulfc@calypso.engr.sgi.com Mon Jun 19 18:47:00 2000
From: Ulf Carlsson <ulfc@calypso.engr.sgi.com>
To: Andrew Cagney <ac131313@cygnus.com>
Cc: Alan Modra <alan@linuxcare.com.au>, BINUTILS Patches <binutils@sourceware.cygnus.com>, GDB Patches <gdb-patches@sourceware.cygnus.com>
Subject: Re: [rfc] For mips, sign-extended ecoff offsets
Date: Mon, 19 Jun 2000 18:47:00 -0000
Message-id: <14670.52424.697477.308492@calypso.engr.sgi.com>
References: <Pine.LNX.4.21.0006200100160.12273-100000@front.linuxcare.com.au> <394EC637.24300B87@cygnus.com>
X-SW-Source: 2000-06/msg00235.html
Content-length: 1305
Hi Andrew,
> > > The attatched patch changes the MIPS ELF32 backend so that it is more
> > > likely to return a sign-extended offset. At present the ELF backend
> > > returns sign-extended symbol table values but not sign extended debug
> > > information.
> >
> > Hi Andrew,
> > Would it be better to just change ecoff_swap_sym_in? It seems like
> > this would achieve what you want, and not risk breaking quite so much.
> > I'm worried about what happens if things like PDR.adr get changed from
> > 0xa0000000 to 0xffffffffa0000000.
>
> Thats why I'm asking :-) Remember though, on the MIPS platform, if
> ``PDR.adr'' is an address then, the canonical form of the value
> ``0xa0000000'' obtained from an elf32 binary is 0xffffffffa00000000.
> GDB and BFD have, for too many years, been bribed and cajoled into
> perpetuated the lie that MIPS doesn't sign extend addresses. GDB's now
> decided to come clean on this matter (and purge an amazing amount of
> bogus code :-).
On a 64-bit MIPS processor 32-bit addresses are of course sign
extended, but this shouldn't concern the 32-bit BFD backend for MIPS
in any way. Whether we sign extend the addresses or not shouldn't
make any difference except in our internal representation of the
bfd_vma. I may be wrong though!
Ulf
From alan@linuxcare.com.au Mon Jun 19 18:50:00 2000
From: Alan Modra <alan@linuxcare.com.au>
To: Andrew Cagney <ac131313@cygnus.com>
Cc: BINUTILS Patches <binutils@sourceware.cygnus.com>, GDB Patches <gdb-patches@sourceware.cygnus.com>
Subject: Re: [rfc] For mips, sign-extended ecoff offsets
Date: Mon, 19 Jun 2000 18:50:00 -0000
Message-id: <Pine.LNX.4.21.0006201128050.12273-100000@front.linuxcare.com.au>
References: <394EC637.24300B87@cygnus.com>
X-SW-Source: 2000-06/msg00236.html
Content-length: 1270
On Tue, 20 Jun 2000, Andrew Cagney wrote:
> > I'm worried about what happens if things like PDR.adr get changed from
> > 0xa0000000 to 0xffffffffa0000000.
>
> Thats why I'm asking :-) Remember though, on the MIPS platform, if
> ``PDR.adr'' is an address then, the canonical form of the value
> ``0xa0000000'' obtained from an elf32 binary is 0xffffffffa00000000.
> GDB and BFD have, for too many years, been bribed and cajoled into
> perpetuated the lie that MIPS doesn't sign extend addresses. GDB's now
> decided to come clean on this matter (and purge an amazing amount of
> bogus code :-).
Well, it's the likelihood of other "bogus code" existing in binutils that
assumes addresses are _not_ sign extended that worries me. If you work to
the "You break it, you fix it" rule, then you may be taking on quite a bit
of work :-)
> Any way I've attached a revised patch. I wasn't ruthless enough the
> first time.... With this revision the linker appears to work :-)
> Testing is continuing.
There's an ECOF_ typo still in a comment.
> I guess the question for BFD people is, is this the correct approach to
> fixing this bug?
I'd like to hear Ian's comments on this before you check it in.
Regards, Alan Modra
--
Linuxcare. Support for the Revolution.
next prev parent reply other threads:[~2000-06-19 16:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200006090053.RAA14301@ada.cygnus.com.cygnus.com>
[not found] ` <14664.971.753679.67153@kwikemart.cygnus.com>
2000-06-14 17:52 ` Michael Snyder
2000-06-15 20:05 ` Elena Zannoni
2000-06-19 16:41 ` James Wilson [this message]
[not found] ` <npk8frhmkp.fsf@zwingli.cygnus.com>
2001-09-05 0:16 ` Michael Snyder
2001-09-05 0:16 ` Michael Snyder
[not found] <200006200213.TAA22932@wilson.cygnus.com>
[not found] ` <395013E2.D78A2EE2@cygnus.com>
2000-06-20 20:39 ` Michael Snyder
[not found] <200006200106.SAA22809@wilson.cygnus.com>
2000-06-19 19:03 ` Andrew Cagney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200006192341.QAA22716@wilson.cygnus.com \
--to=wilson@wilson.cygnus.com \
--cc=gdb-patches@sourceware.cygnus.com \
--cc=msnyder@cygnus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox