From: Jeff Law Date: Sat, 12 Aug 1995 22:50:04 +0000 (+0000) Subject: * configure.in: Recognize aix4 specially as some aspects X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=65eaea2742c1b7b1625e618603436cc3af71074e;p=binutils-gdb.git * configure.in: Recognize aix4 specially as some aspects of aix4 need different handling than aix3. * configure: Updated. * config/powerpc/{aix4.mh,aix4.mt,tm-ppc-aix4.h}: New files specific to aix4 support on the power pc. * config/powerpc/tm-ppc-aix.h (DONT_RELOCATE_SYMFILE_OBJFILE): Do not defined. The aix4 specific target files will do that. * config/rs6000/{aix4,mh,aix4,mt,tm-rs6000-aix4.h}: New files specific to aix4 support on the rs6000. * config/rs6000/tm-rs6000.h (CONVERT_FROM_FUNC_PTR_ADDR): Don't do the conversion if the pointer is not a magic aix function pointer. * rs6000-tdep.c: Include objfiles.h and symtab.h. (is_magic_function_pointer): New function. * rs6000-tdep.c (skip_prologue): Refine check for frameless functions. Handle b .+4 emitted by aix4 compilers. Only allow one load of a minimal toc pointer. Handle aix4 compiler's code for alloca. * rs6000-tdep.c (find_toc_address): Report an error if no toc was found rather than possibly core dumping. * partial-stab.h: Handle extra field generated by the aix4 compiler for enumerations. * stabsread.c (read_enum_type): Likewise. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index fd4e6803632..b961d2f85ef 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,33 @@ +Sat Aug 12 15:34:54 1995 Jeffrey A. Law + + * configure.in: Recognize aix4 specially as some aspects + of aix4 need different handling than aix3. + * configure: Updated. + * config/powerpc/{aix4.mh,aix4.mt,tm-ppc-aix4.h}: New files + specific to aix4 support on the power pc. + * config/powerpc/tm-ppc-aix.h (DONT_RELOCATE_SYMFILE_OBJFILE): Do + not defined. The aix4 specific target files will do that. + * config/rs6000/{aix4,mh,aix4,mt,tm-rs6000-aix4.h}: New files + specific to aix4 support on the rs6000. + + * config/rs6000/tm-rs6000.h (CONVERT_FROM_FUNC_PTR_ADDR): Don't + do the conversion if the pointer is not a magic aix function + pointer. + * rs6000-tdep.c: Include objfiles.h and symtab.h. + (is_magic_function_pointer): New function. + + * rs6000-tdep.c (skip_prologue): Refine check for frameless + functions. Handle b .+4 emitted by aix4 compilers. Only + allow one load of a minimal toc pointer. Handle aix4 compiler's + code for alloca. + + * rs6000-tdep.c (find_toc_address): Report an error if no toc was + found rather than possibly core dumping. + + * partial-satb.h: Handle extra field generated by the aix4 compiler + for enumerations. + * stabsread.c (read_enum_type): Likewise. + Sat Aug 12 03:18:04 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) * rs6000-tdep.c (extract_return_value): Fix returning of values diff --git a/gdb/config/powerpc/.Sanitize b/gdb/config/powerpc/.Sanitize index 0c242d66a57..b38d3dab6c3 100644 --- a/gdb/config/powerpc/.Sanitize +++ b/gdb/config/powerpc/.Sanitize @@ -23,12 +23,15 @@ Things-to-keep: aix.mh aix.mt +aix4.mh +aix4.mt gdbserve.mt nm-aix.h ppc-eabi.mt ppc-nw.mt ppcle-eabi.mt tm-ppc-aix.h +tm-ppc-aix4.h tm-ppc-eabi.h tm-ppc-nw.h tm-ppcle-eabi.h diff --git a/gdb/config/powerpc/aix4.mh b/gdb/config/powerpc/aix4.mh new file mode 100644 index 00000000000..aaec41560a6 --- /dev/null +++ b/gdb/config/powerpc/aix4.mh @@ -0,0 +1,24 @@ +# Host: IBM PowerPC running AIX4 + +XM_FILE= xm-aix.h +XDEPFILES= + +NAT_FILE= nm-aix.h +NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o rs6000-nat.o xcoffread.o + +# When compiled with cc, for debugging, this argument should be passed. +# We have no idea who our current compiler is though, so we skip it. +# MH_CFLAGS = -bnodelcsect + +# Because of shared libraries, we risk ending up with *two* +# incompatible versions of malloc if we use GNU malloc ... +MMALLOC = +MMALLOC_DISABLE = -DNO_MMALLOC + +# A bug in the AIX 3.2 libc.a results in unresolved references for .scalb and +# .finite because we call ldexp via floatformat. Circumvent by adding -lm. +XM_CLIBS= -lm + +# Rumor has it that libtermcap is "not really functional", and that +# -lcurses is better. +TERMCAP= -lcurses diff --git a/gdb/config/powerpc/aix4.mt b/gdb/config/powerpc/aix4.mt new file mode 100644 index 00000000000..29bed5f7be5 --- /dev/null +++ b/gdb/config/powerpc/aix4.mt @@ -0,0 +1,3 @@ +# Target: PowerPC running AIX4 +TDEPFILES= rs6000-tdep.o xcoffsolib.o +TM_FILE= tm-ppc-aix4.h diff --git a/gdb/config/powerpc/tm-ppc-aix.h b/gdb/config/powerpc/tm-ppc-aix.h index d4853e6fced..5dfb3c47644 100644 --- a/gdb/config/powerpc/tm-ppc-aix.h +++ b/gdb/config/powerpc/tm-ppc-aix.h @@ -20,9 +20,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef TM_PPC_AIX_H #define TM_PPC_AIX_H -/* The main executable doesn't need relocation in aix4. */ -#define DONT_RELOCATE_SYMFILE_OBJFILE - /* Use generic RS6000 definitions. */ #include "rs6000/tm-rs6000.h" diff --git a/gdb/config/powerpc/tm-ppc-aix4.h b/gdb/config/powerpc/tm-ppc-aix4.h new file mode 100644 index 00000000000..efe4ba1b202 --- /dev/null +++ b/gdb/config/powerpc/tm-ppc-aix4.h @@ -0,0 +1,32 @@ +/* Macro definitions for Power PC running AIX4. + Copyright 1995 Free Software Foundation, Inc. + +This file is part of GDB. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#ifndef TM_PPC_AIX4_H +#define TM_PPC_AIX4_H + +/* The main executable doesn't need relocation in aix4. Otherwise + it looks just like any other AIX system. */ +#define DONT_RELOCATE_SYMFILE_OBJFILE + +/* Use generic RS6000 definitions. */ +#include "rs6000/tm-rs6000.h" + +#define GDB_TARGET_POWERPC + +#endif /* TM_PPC_AIX4_H */ diff --git a/gdb/config/rs6000/.Sanitize b/gdb/config/rs6000/.Sanitize index 915bef5743f..26a1e74bce3 100644 --- a/gdb/config/rs6000/.Sanitize +++ b/gdb/config/rs6000/.Sanitize @@ -21,6 +21,8 @@ Do-first: Things-to-keep: +aix4.mh +aix4.mt nm-rs6000.h nm-rs6000ly.h rs6000.mh @@ -29,6 +31,7 @@ rs6000.mt rs6000lynx.mt tm-rs6000.h tm-rs6000ly.h +tm-rs6000-aix4.h xm-rs6000.h xm-rs6000ly.h diff --git a/gdb/config/rs6000/aix4.mh b/gdb/config/rs6000/aix4.mh new file mode 100644 index 00000000000..bb639f580b4 --- /dev/null +++ b/gdb/config/rs6000/aix4.mh @@ -0,0 +1,24 @@ +# Host: IBM RS/6000 running AIX4 + +XM_FILE= xm-rs6000.h +XDEPFILES= + +NAT_FILE= nm-rs6000.h +NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o rs6000-nat.o xcoffread.o + +# When compiled with cc, for debugging, this argument should be passed. +# We have no idea who our current compiler is though, so we skip it. +# MH_CFLAGS = -bnodelcsect + +# Because of shared libraries, we risk ending up with *two* +# incompatible versions of malloc if we use GNU malloc ... +MMALLOC = +MMALLOC_DISABLE = -DNO_MMALLOC + +# A bug in the AIX 3.2 libc.a results in unresolved references for .scalb and +# .finite because we call ldexp via floatformat. Circumvent by adding -lm. +XM_CLIBS= -lm + +# Rumor has it that libtermcap is "not really functional", and that +# -lcurses is better. +TERMCAP= -lcurses diff --git a/gdb/config/rs6000/aix4.mt b/gdb/config/rs6000/aix4.mt new file mode 100644 index 00000000000..85ba54719e8 --- /dev/null +++ b/gdb/config/rs6000/aix4.mt @@ -0,0 +1,3 @@ +# Target: IBM RS/6000 running AIX4 +TDEPFILES= rs6000-tdep.o xcoffsolib.o +TM_FILE= tm-rs6000-aix4.h diff --git a/gdb/config/rs6000/tm-rs6000-aix4.h b/gdb/config/rs6000/tm-rs6000-aix4.h new file mode 100644 index 00000000000..04f3344e602 --- /dev/null +++ b/gdb/config/rs6000/tm-rs6000-aix4.h @@ -0,0 +1,29 @@ +/* Macro definitions for RS/6000 running AIX4. + Copyright 1995 Free Software Foundation, Inc. + +This file is part of GDB. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#ifndef TM_RS6000_AIX4_H +#define TM_RS6000_AIX4_H + +/* The main executable doesn't need relocation in aix4. */ +#define DONT_RELOCATE_SYMFILE_OBJFILE + +/* Use generic RS6000 definitions. */ +#include "rs6000/tm-rs6000.h" + +#endif /* TM_RS6000_AIX4_H */ diff --git a/gdb/configure b/gdb/configure index 0158056d2dd..65b76b32f72 100755 --- a/gdb/configure +++ b/gdb/configure @@ -2139,6 +2139,7 @@ pn-*-*) gdb_target=pn ;; powerpc-*-netware*) gdb_target=ppc-nw configdirs="${configdirs} nlm" ;; +powerpc-*-aix4*) gdb_target=aix4 ;; powerpc-*-aix*) gdb_target=aix ;; powerpc-*-eabi*) gdb_target=ppc-eabi ;; powerpcle-*-eabi*) gdb_target=ppcle-eabi ;; @@ -2146,6 +2147,7 @@ powerpcle-*-eabi*) gdb_target=ppcle-eabi ;; pyramid-*-*) gdb_target=pyramid ;; rs6000-*-lynxos*) gdb_target=rs6000lynx ;; +rs6000-*-aix4*) gdb_target=aix4 ;; rs6000-*-*) gdb_target=rs6000 ;; sparc-*-aout*) gdb_target=sparc-em ;; diff --git a/gdb/configure.in b/gdb/configure.in index 627b2d53979..b740931c15d 100644 --- a/gdb/configure.in +++ b/gdb/configure.in @@ -379,6 +379,7 @@ pn-*-*) gdb_target=pn ;; powerpc-*-netware*) gdb_target=ppc-nw configdirs="${configdirs} nlm" ;; +powerpc-*-aix4*) gdb_target=aix4 ;; powerpc-*-aix*) gdb_target=aix ;; powerpc-*-eabi*) gdb_target=ppc-eabi ;; powerpcle-*-eabi*) gdb_target=ppcle-eabi ;; @@ -386,6 +387,7 @@ powerpcle-*-eabi*) gdb_target=ppcle-eabi ;; pyramid-*-*) gdb_target=pyramid ;; rs6000-*-lynxos*) gdb_target=rs6000lynx ;; +rs6000-*-aix4*) gdb_target=aix4 ;; rs6000-*-*) gdb_target=rs6000 ;; sparc-*-aout*) gdb_target=sparc-em ;; diff --git a/gdb/partial-stab.h b/gdb/partial-stab.h index 255f4a13bc5..ac2149d9751 100644 --- a/gdb/partial-stab.h +++ b/gdb/partial-stab.h @@ -484,6 +484,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ if (*p++ == 'e') { + /* The aix4 compiler emits extra crud before the members. */ + if (*p == '-') + { + /* Skip over the type (?). */ + while (*p != ':') + p++; + + /* Skip over the colon. */ + p++; + } + /* We have found an enumerated type. */ /* According to comments in read_enum_type a comma could end it instead of a semicolon. diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index a6456450d97..faade77349c 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -24,6 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "symtab.h" #include "target.h" #include "gdbcore.h" +#include "symfile.h" +#include "objfiles.h" #include "xcoffsolib.h" @@ -214,6 +216,7 @@ skip_prologue (pc, fdata) int cr_reg = 0; int reg; int framep = 0; + int minimal_toc_loaded = 0; static struct rs6000_framedata zero_frame; *fdata = zero_frame; @@ -262,10 +265,12 @@ skip_prologue (pc, fdata) } else if ((op & 0xffff0000) == 0x3c000000) { /* addis 0,0,NUM, used for >= 32k frames */ fdata->offset = (op & 0x0000ffff) << 16; + fdata->frameless = 0; continue; } else if ((op & 0xffff0000) == 0x60000000) { /* ori 0,0,NUM, 2nd half of >= 32k frames */ fdata->offset |= (op & 0x0000ffff); + fdata->frameless = 0; continue; } else if ((op & 0xffff0000) == lr_reg) { /* st Rx,NUM(r1) where Rx == lr */ @@ -282,6 +287,9 @@ skip_prologue (pc, fdata) } else if (op == 0x48000005) { /* bl .+4 used in -mrelocatable */ continue; + } else if (op == 0x48000004) { /* b .+4 (xlc) */ + break; + } else if (((op & 0xffff0000) == 0x801e0000 || /* lwz 0,NUM(r30), used in V.4 -mrelocatable */ op == 0x7fc0f214) && /* add r30,r0,r30, used in V.4 -mrelocatable */ lr_reg == 0x901e0000) { @@ -293,6 +301,7 @@ skip_prologue (pc, fdata) } else if ((op & 0xfc000000) == 0x48000000) { /* bl foo, to save fprs??? */ + fdata->frameless = 0; /* Don't skip over the subroutine call if it is not within the first three instructions of the prologue. */ if ((pc - orig_pc) > 8) @@ -312,16 +321,20 @@ skip_prologue (pc, fdata) /* update stack pointer */ } else if ((op & 0xffff0000) == 0x94210000) { /* stu r1,NUM(r1) */ + fdata->frameless = 0; fdata->offset = SIGNED_SHORT (op); offset = fdata->offset; continue; } else if (op == 0x7c21016e) { /* stwux 1,1,0 */ + fdata->frameless = 0; offset = fdata->offset; continue; /* Load up minimal toc pointer */ - } else if ((op >> 22) == 0x20f) { /* l r31,... or l r30,... */ + } else if ((op >> 22) == 0x20f + && ! minimal_toc_loaded) { /* l r31,... or l r30,... */ + minimal_toc_loaded = 1; continue; /* store parameters in stack */ @@ -340,10 +353,18 @@ skip_prologue (pc, fdata) /* Set up frame pointer */ } else if (op == 0x603f0000 /* oril r31, r1, 0x0 */ || op == 0x7c3f0b78) { /* mr r31, r1 */ + fdata->frameless = 0; framep = 1; fdata->alloca_reg = 31; continue; + /* Another way to set up the frame pointer. */ + } else if ((op & 0xfc1fffff) == 0x38010000) { /* addi rX, r1, 0x0 */ + fdata->frameless = 0; + framep = 1; + fdata->alloca_reg = (op & ~0x38010000) >> 21; + continue; + } else { break; } @@ -376,7 +397,6 @@ skip_prologue (pc, fdata) } #endif /* 0 */ - fdata->frameless = (pc == orig_pc); fdata->offset = - fdata->offset; return pc; } @@ -1194,15 +1214,34 @@ find_toc_address (pc) { int ii, toc_entry, tocbase = 0; + toc_entry = -1; for (ii=0; ii < loadinfotextindex; ++ii) if (pc > loadinfo[ii].textorg && loadinfo[ii].textorg > tocbase) { toc_entry = ii; tocbase = loadinfo[ii].textorg; } + if (toc_entry == -1) + error ("Unable to find TOC entry for pc 0x%x\n", pc); return loadinfo[toc_entry].dataorg + loadinfo[toc_entry].toc_offset; } +/* Return nonzero if ADDR (a function pointer) is in the data space and + is therefore a special function pointer. */ + +int +is_magic_function_pointer (addr) + CORE_ADDR addr; +{ + struct obj_section *s; + + s = find_pc_section (addr); + if (s && s->the_bfd_section->flags & SEC_CODE) + return 0; + else + return 1; +} + #ifdef GDB_TARGET_POWERPC int gdb_print_insn_powerpc (memaddr, info) diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 413069296e6..9c703e6eadc 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -3073,6 +3073,18 @@ read_enum_type (pp, type, objfile) return error_type (pp); } + /* The aix4 compiler emits an extra field before the enum members; + my guess is it's a type of some sort. Just ignore it. */ + if (**pp == '-') + { + /* Skip over the type. */ + while (**pp != ':') + (*pp)++; + + /* Skip over the colon. */ + (*pp)++; + } + /* Read the value-names and their values. The input syntax is NAME:VALUE,NAME:VALUE, and so on. A semicolon or comma instead of a NAME means the end. */