From: Stan Shebs Date: Tue, 12 Dec 1995 02:35:27 +0000 (+0000) Subject: * configure.in (powerpc-*-macos*): New target configuration. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c148ab3c6d9bde57c23eb2d64184f89677ea110b;p=binutils-gdb.git * configure.in (powerpc-*-macos*): New target configuration. * configure: Update. * config/powerpc/macos.mh, config/powerpc/macos.mt, config/powerpc/nm-macos.h, config/powerpc/tm-macos.h, mac-nat.c: New files, native PowerMac debugging support. * Makefile.in (mac-nat.o): Add build rule. * mpw-config.in (enable_cflags): Add support. (m68k-apple-macos, powerpc-apple-macos): Fix natdepfiles to list object file instead of source file. * mpw-make.sed (@ENABLE_CFLAGS@): Don't edit out, replace with value of variable. (install, install-only): Edit MPW-specific installation into place of Unix shell code. * mac-gdb.r: Fix version resources to use symbolic version strings. (cfrg): New resource, code fragment for PowerMac. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 27a33894c55..d5427876e15 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,25 @@ +Mon Dec 11 18:19:16 1995 Stan Shebs + + * configure.in (powerpc-*-macos*): New target configuration. + * configure: Update. + * config/powerpc/macos.mh, config/powerpc/macos.mt, + config/powerpc/nm-macos.h, config/powerpc/tm-macos.h, mac-nat.c: + New files, native PowerMac debugging support. + * Makefile.in (mac-nat.o): Add build rule. + * mpw-config.in (enable_cflags): Add support. + (m68k-apple-macos, powerpc-apple-macos): Fix natdepfiles to + list object file instead of source file. + * mpw-make.sed (@ENABLE_CFLAGS@): Don't edit out, replace with + value of variable. + (install, install-only): Edit MPW-specific installation into + place of Unix shell code. + * mac-gdb.r: Fix version resources to use symbolic version strings. + (cfrg): New resource, code fragment for PowerMac. + +start-sanitize-gm + mpw-config.in (mips-gm-magic): New configuration. +end-sanitize-gm + Mon Dec 11 14:13:03 1995 Fred Fish * dbxread.c (process_one_symbol): When looking at the next diff --git a/gdb/config/powerpc/macos.mh b/gdb/config/powerpc/macos.mh new file mode 100644 index 00000000000..63b064878cd --- /dev/null +++ b/gdb/config/powerpc/macos.mh @@ -0,0 +1,4 @@ +# Host: PowerMac (PowerPC running MacOS) + +NATDEPFILES= mac-nat.o +NAT_FILE= nm-macos.h diff --git a/gdb/config/powerpc/macos.mt b/gdb/config/powerpc/macos.mt new file mode 100644 index 00000000000..07ad0d2208f --- /dev/null +++ b/gdb/config/powerpc/macos.mt @@ -0,0 +1,3 @@ +# Target: PowerMac (PowerPC running MacOS) +TDEPFILES= rs6000-tdep.o xcoffread.o +TM_FILE= tm-macos.h diff --git a/gdb/config/powerpc/nm-macos.h b/gdb/config/powerpc/nm-macos.h new file mode 100644 index 00000000000..a1a3d9e6c3d --- /dev/null +++ b/gdb/config/powerpc/nm-macos.h @@ -0,0 +1,20 @@ +/* PowerMac native-dependent macros for GDB, the GNU debugger. + Copyright (C) 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +/* Nothing needed, at least so far. */ diff --git a/gdb/config/powerpc/tm-macos.h b/gdb/config/powerpc/tm-macos.h new file mode 100644 index 00000000000..b29d285b4ab --- /dev/null +++ b/gdb/config/powerpc/tm-macos.h @@ -0,0 +1,26 @@ +/* Macro definitions for Power PC running MacOS. + Copyright (C) 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. */ + +/* Use generic RS6000 definitions. */ +#include "rs6000/tm-rs6000.h" + +#define GDB_TARGET_POWERPC + +/* This is no use to us. */ +#undef PC_LOAD_SEGMENT diff --git a/gdb/configure b/gdb/configure index 5b7258282db..801897936d5 100755 --- a/gdb/configure +++ b/gdb/configure @@ -2453,6 +2453,7 @@ ns32k-utek-sysv*) gdb_target=merlin ;; ns32k-utek-*) gdb_target=umax ;; pn-*-*) gdb_target=pn ;; +powerpc-*-macos*) gdb_target=macos ;; powerpc-*-netware*) gdb_target=ppc-nw configdirs="${configdirs} nlm" ;; diff --git a/gdb/configure.in b/gdb/configure.in index df2a5aa4087..0a30ba013e2 100644 --- a/gdb/configure.in +++ b/gdb/configure.in @@ -469,6 +469,7 @@ ns32k-utek-sysv*) gdb_target=merlin ;; ns32k-utek-*) gdb_target=umax ;; pn-*-*) gdb_target=pn ;; +powerpc-*-macos*) gdb_target=macos ;; powerpc-*-netware*) gdb_target=ppc-nw configdirs="${configdirs} nlm" ;; diff --git a/gdb/mac-gdb.r b/gdb/mac-gdb.r index da007deb3a2..3736ddef944 100644 --- a/gdb/mac-gdb.r +++ b/gdb/mac-gdb.r @@ -5,13 +5,45 @@ #include "mac-defs.h" +/* Version resources. */ + resource 'vers' (1) { - 0x02, 0x00, release, 0x00, + 0, + 0, + 0, + 0, verUS, - "4.12.3", - "4.12.3, Copyright \251 1994 Free Software Foundation, Inc." + VERSION_STRING, + VERSION_STRING " (C) 1986-95 FSF, Inc." +}; + +resource 'vers' (2, purgeable) { + 0, + 0, + 0, + 0, + verUs, + VERSION_STRING, + "GDB " VERSION_STRING " for MPW" +}; + +#ifdef WANT_CFRG + +#include "CodeFragmentTypes.r" + +resource 'cfrg' (0) { + { + kPowerPC, + kFullLib, + kNoVersionNum, kNoVersionNum, + 0, 0, + kIsApp, kOnDiskFlat, kZeroOffset, kWholeFork, + PROG_NAME + } }; +#endif /* WANT_CFRG */ + #ifdef Macgdb /* Exclude the following from SIOWgdb which uses SIOW.r. */ resource 'MBAR' (128) { diff --git a/gdb/mac-nat.c b/gdb/mac-nat.c new file mode 100644 index 00000000000..bdf6c6df2c4 --- /dev/null +++ b/gdb/mac-nat.c @@ -0,0 +1,384 @@ +/* Target-vector operations for controlling Mac applications, for GDB. + Copyright (C) 1995 Free Software Foundation, Inc. + Written by Stan Shebs. Contributed by Cygnus Support. + +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 eve nthe 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +/* Note that because all the available Mac compilers are ANSI or very + close, and this is a native-only file, the code may be purely ANSI. */ + +#include "defs.h" +#include "frame.h" /* required by inferior.h */ +#include "inferior.h" +#include "target.h" +#include "wait.h" +#include "gdbcore.h" +#include "command.h" +#include +#include +#include +#include "buildsym.h" +#include "gdb_string.h" +#include "thread.h" +#include "gdbcmd.h" + +#include + +/* We call the functions "child_..." rather than "mac_..." so no one + is tempted to try to link this with other native-only code. */ + +/* Forward declaration */ + +extern struct target_ops child_ops; + +static void +child_fetch_inferior_registers (int r) +{ + if (r < 0) + { + for (r = 0; r < NUM_REGS; r++) + child_fetch_inferior_registers (r); + } + else + { + supply_register (r, 0); + } +} + +static void +child_store_inferior_registers (int r) +{ + if (r < 0) + { + for (r = 0; r < NUM_REGS; r++) + child_store_inferior_registers (r); + } + else + { + read_register_gen (r, 0); + } +} + +static int +child_wait (int pid, struct target_waitstatus *ourstatus) +{ +} + +/* Attach to process PID, then initialize for debugging it. */ + +static void +child_attach (args, from_tty) + char *args; + int from_tty; +{ + ProcessSerialNumber psn; + ProcessInfoRec inforec; + Str31 name; + FSSpecPtr fsspec; + OSType code; + int pid; + char *exec_file; + + if (!args) + error_no_arg ("process-id to attach"); + + pid = atoi (args); + + psn.highLongOfPSN = 0; + psn.lowLongOfPSN = pid; + + inforec.processInfoLength = sizeof(ProcessInfoRec); + inforec.processName = name; + inforec.processAppSpec = fsspec; + + if (GetProcessInformation (&psn, &inforec) == noErr) + { + if (from_tty) + { + exec_file = (char *) get_exec_file (0); + + if (exec_file) + printf_unfiltered ("Attaching to program `%s', %s\n", exec_file, + target_pid_to_str (pid)); + else + printf_unfiltered ("Attaching to %s\n", target_pid_to_str (pid)); + + gdb_flush (gdb_stdout); + } + /* Do we need to do anything special? */ + attach_flag = 1; + inferior_pid = pid; + push_target (&child_ops); + } +} + +static void +child_detach (args, from_tty) + char *args; + int from_tty; +{ + char *exec_file; + + if (from_tty) + { + exec_file = get_exec_file (0); + if (exec_file == 0) + exec_file = ""; + printf_unfiltered ("Detaching from program: %s %s\n", exec_file, + target_pid_to_str (inferior_pid)); + gdb_flush (gdb_stdout); + } + inferior_pid = 0; + unpush_target (&child_ops); +} + +/* Print status information about what we're accessing. */ + +static void +child_files_info (ignore) + struct target_ops *ignore; +{ + printf_unfiltered ("\tUsing the running image of %s %s.\n", + attach_flag ? "attached" : "child", target_pid_to_str (inferior_pid)); +} + +/* ARGSUSED */ +static void +child_open (arg, from_tty) + char *arg; + int from_tty; +{ + error ("Use the \"run\" command to start a Mac application."); +} + +/* Start an inferior Mac program and sets inferior_pid to its pid. + EXEC_FILE is the file to run. + ALLARGS is a string containing the arguments to the program. + ENV is the environment vector to pass. Errors reported with error(). */ + +static void +child_create_inferior (exec_file, allargs, env) + char *exec_file; + char *allargs; + char **env; +{ + LaunchParamBlockRec launchparms; + FSSpec fsspec; + OSErr launch_err; + + if (!exec_file) + { + error ("No executable specified, use `target exec'.\n"); + } + + launchparms.launchBlockID = extendedBlock; + launchparms.launchEPBLength = extendedBlockLen; + launchparms.launchFileFlags = 0; + launchparms.launchControlFlags = launchContinue | launchNoFileFlags; + fsspec.vRefNum = 0; + fsspec.parID = 0; + strcpy(fsspec.name + 1, exec_file); + fsspec.name[0] = strlen(exec_file); + launchparms.launchAppSpec = &fsspec; + launchparms.launchAppParameters = nil; + + launch_err = LaunchApplication (&launchparms); + + if (launch_err == 999 /*memFullErr*/) + { + error ("Not enough memory to launch %s\n", exec_file); + } + else if (launch_err != noErr) + { + error ("Error launching %s, code %d\n", exec_file, launch_err); + } + + inferior_pid = launchparms.launchProcessSN.lowLongOfPSN; + /* FIXME be sure that high long of PSN is 0 */ + + push_target (&child_ops); + init_wait_for_inferior (); + clear_proceed_status (); + +/* proceed ((CORE_ADDR) - 1, TARGET_SIGNAL_0, 0); */ +} + +static void +child_mourn_inferior () +{ + unpush_target (&child_ops); + generic_mourn_inferior (); +} + +void +child_stop () +{ +} + +int +child_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, + int write, struct target_ops *target) +{ + int i; + + for (i = 0; i < len; ++i) + { + if (write) + { + ((char *) memaddr)[i] = myaddr[i]; + } + else + { + myaddr[i] = ((char *) memaddr)[i]; + } + } + return len; +} + +void +child_kill_inferior (void) +{ +} + +void +child_resume (int pid, int step, enum target_signal signal) +{ +} + +static void +child_prepare_to_store () +{ + /* Do nothing, since we can store individual regs */ +} + +static int +child_can_run () +{ + return 1; +} + +static void +child_close () +{ +} + +static void +info_proc (args, from_tty) + char *args; + int from_tty; +{ + ProcessSerialNumber psn; + ProcessInfoRec inforec; + Str31 name; + FSSpecPtr fsspec; + OSType code; + + /* Eventually use args, but not right now. */ + + psn.highLongOfPSN = 0; + psn.lowLongOfPSN = kNoProcess; + + inforec.processInfoLength = sizeof(ProcessInfoRec); + inforec.processName = name; + inforec.processAppSpec = fsspec; + + printf_filtered ("Process Name Sgnt Type PSN Loc Size FreeMem Time\n"); + + while (GetNextProcess (&psn) == noErr) + { + if (GetProcessInformation (&psn, &inforec) == noErr) + { + name[name[0] + 1] = '\0'; + printf_filtered ("%-32.32s", name + 1); + code = inforec.processSignature; + printf_filtered (" %c%c%c%c", + (code >> 24) & 0xff, + (code >> 16) & 0xff, + (code >> 8) & 0xff, + (code >> 0) & 0xff); + code = inforec.processType; + printf_filtered (" %c%c%c%c", + (code >> 24) & 0xff, + (code >> 16) & 0xff, + (code >> 8) & 0xff, + (code >> 0) & 0xff); + if (psn.highLongOfPSN == 0) + printf_filtered (" %9d", psn.lowLongOfPSN); + else + printf_filtered (" %9d,%9d\n", + psn.highLongOfPSN, psn.lowLongOfPSN); + printf_filtered (" 0x%x", inforec.processLocation); + printf_filtered (" %9d", inforec.processSize); + printf_filtered (" %9d", inforec.processFreeMem); + printf_filtered (" %9d", inforec.processActiveTime); + printf_filtered ("\n"); + } + } +} + +struct target_ops child_ops = +{ + "mac", /* to_shortname */ + "MacOS application", /* to_longname */ + "MacOS application (started by the \"run\" command).", /* to_doc */ + child_open, /* to_open */ + child_close, /* to_close */ + child_attach, /* to_attach */ + child_detach, /* to_detach */ + child_resume, /* to_resume */ + child_wait, /* to_wait */ + child_fetch_inferior_registers,/* to_fetch_registers */ + child_store_inferior_registers,/* to_store_registers */ + child_prepare_to_store, /* to_prepare_to_store */ + child_xfer_memory, /* to_xfer_memory */ + child_files_info, /* to_files_info */ + memory_insert_breakpoint, /* to_insert_breakpoint */ + memory_remove_breakpoint, /* to_remove_breakpoint */ + 0, /* to_terminal_init */ + 0, /* to_terminal_inferior */ + 0, /* to_terminal_ours_for_output */ + 0, /* to_terminal_ours */ + 0, /* to_terminal_info */ + child_kill_inferior, /* to_kill */ + 0, /* to_load */ + 0, /* to_lookup_symbol */ + child_create_inferior, /* to_create_inferior */ + child_mourn_inferior, /* to_mourn_inferior */ + child_can_run, /* to_can_run */ + 0, /* to_notice_signals */ + 0, /* to_thread_alive */ + child_stop, /* to_stop */ + process_stratum, /* to_stratum */ + 0, /* to_next */ + 1, /* to_has_all_memory */ + 1, /* to_has_memory */ + 1, /* to_has_stack */ + 1, /* to_has_registers */ + 1, /* to_has_execution */ + 0, /* to_sections */ + 0, /* to_sections_end */ + OPS_MAGIC /* to_magic */ +}; + +void +_initialize_mac_nat () +{ + add_target (&child_ops); + + add_info ("proc", info_proc, + "Show information about processes."); +} diff --git a/gdb/mpw-config.in b/gdb/mpw-config.in index 8261a3d668b..a969eabcf65 100644 --- a/gdb/mpw-config.in +++ b/gdb/mpw-config.in @@ -12,6 +12,8 @@ End If Set xdepfiles '"{o}"mac-xdep.c.o' +Set enable_cflags "" + # Make a copy of this file and give it a different name, so it # won't be confused with GDB's serial.h. @@ -34,11 +36,24 @@ Else If "{target_canonical}" =~ /i386-unknown-go32/ Set tdepfiles '"{o}"i386-tdep.c.o' Else If "{target_canonical}" =~ /mips-idt-ecoff/ - forward-include "{srcdir}"config:mips:tm-idt.h tm.h + forward-include "{srcdir}"config:mips:tm-embed.h tm.h forward-include "{srcdir}"config:mips:tm-bigmips.h 'mips/tm-bigmips.h' forward-include "{srcdir}"config:mips:tm-mips.h 'mips/tm-mips.h' Set tdepfiles '"{o}"mips-tdep.c.o "{o}"remote-mips.c.o' +# start-sanitize-gm +Else If "{target_canonical}" =~ /mips-gm-magic/ + forward-include "{srcdir}"config:mips:tm-embed.h tm.h + forward-include "{srcdir}"config:mips:tm-bigmips.h 'mips/tm-bigmips.h' + forward-include "{srcdir}"config:mips:tm-mips.h 'mips/tm-mips.h' + Set tdepfiles '"{o}"mips-tdep.c.o "{o}"remote-mips.c.o "{o}"magic.c.o' + If {host_cc} =~ /gcc/ + Set enable_cflags '-DGENERAL_MAGIC' + Else + Set enable_cflags '-d GENERAL_MAGIC' + End If +# end-sanitize-gm + Else If "{target_canonical}" =~ /sh-hitachi-hms/ forward-include "{srcdir}"config:sh:tm-sh.h tm.h Set tdepfiles '"{o}"sh-tdep.c.o' @@ -47,11 +62,11 @@ End If If "{target_canonical}" =~ /m68k-apple-macos/ forward-include "{srcdir}"config:m68k:nm-macos.h nm.h - Set natdepfiles '"{o}"mac-nat.c' + Set natdepfiles '"{o}"mac-nat.c.o' Else If "{target_canonical}" =~ /powerpc-apple-macos/ forward-include "{srcdir}"config:powerpc:nm-macos.h nm.h - Set natdepfiles '"{o}"mac-nat.c' + Set natdepfiles '"{o}"mac-nat.c.o' Else forward-include "{srcdir}"config:nm-empty.h nm.h @@ -70,6 +85,7 @@ Echo "XM_CDEPS = " >> "{o}"mk.tmp Echo "TM_CDEPS = " >> "{o}"mk.tmp Echo "NAT_CDEPS = " >> "{o}"mk.tmp Echo "SIOW_LIB = " {siow_lib} >> "{o}"mk.tmp +Echo "ENABLE_CFLAGS = " {enable_cflags} >> "{o}"mk.tmp Echo '# End from mpw-config.in' >> "{o}"mk.tmp Echo '/* config.h. Generated by mpw-configure. */' > "{o}"config.new diff --git a/gdb/mpw-make.sed b/gdb/mpw-make.sed index 5373cfb5a0f..dfba2c7a305 100644 --- a/gdb/mpw-make.sed +++ b/gdb/mpw-make.sed @@ -6,7 +6,8 @@ /^host_makefile_frag@$/d /^target_makefile_frag@$/d -/@ENABLE_CFLAGS@/s/@ENABLE_CFLAGS@//g +/@ENABLE_CFLAGS@/s/@ENABLE_CFLAGS@/{ENABLE_CFLAGS}/g +/^ENABLE_CFLAGS=/s/^/#/ # Edit all the symbolic definitions pointing to various libraries and such. @@ -132,6 +133,16 @@ readline_headers =\ {MAKEPEF} gdb{PROG_EXT} -o gdb {MAKEPEF_TOOL_FLAGS} {MAKEPEF_FLAGS}\ {REZ} "{s}"mac-gdb.r -o gdb -append -d PROG_NAME='"'gdb'"' -d VERSION_STRING='"'{version}'"'\ +/^install \\Option-f /,/^$/c\ +install \\Option-f all install-only\ +\ +install-only \\Option-f \ + Duplicate -y gdb "{bindir}"gdb\ + If "`Exists SiowGDB`" != ""\ + Duplicate -y SiowGDB "{bindir}"SiowGDB\ + End If\ + + # Don't do any recursive subdir stuff. / subdir_do/s/{MAKE}/null-command/ @@ -145,6 +156,3 @@ SIOWgdb \\Option-f {OBS} {TSOBS} {ADD_DEPS} {CDEPS} "{o}"init.c.o\ {MAKEPEF} SIOWgdb{PROG_EXT} -o SIOWgdb -ft 'APPL' -fc 'gdb ' {MAKEPEF_FLAGS} \ {REZ} -o SIOWgdb {RIncludes}siow.r -append -d __kPrefSize=5000 -d __kMinSize=2000 -d APPNAME='"'SIOWgdb'"' \ {REZ} "{s}"mac-gdb.r -o SIOWgdb -append -d VERSION_STRING='"'{version}'"'\ - - -