Virgin import of gdb-5.0
This commit is contained in:
parent
f2489878f0
commit
6bb613ded9
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/vendor/gdb/dist/; revision=64234
153
contrib/gdb/gdb/CONTRIBUTE
Normal file
153
contrib/gdb/gdb/CONTRIBUTE
Normal file
@ -0,0 +1,153 @@
|
||||
|
||||
Contributing to GDB
|
||||
|
||||
GDB is a collaborative project and one which wants to encourage new
|
||||
development. You may wish to fix GDB bugs, improve testing, port GDB
|
||||
to a new platform, update documentation, add new GDB features, and the
|
||||
like. To help with this, there is a lot of documentation
|
||||
available.. In addition to the user guide and internals manual
|
||||
included in the GDB distribution, the GDB web pages also contain much
|
||||
information.
|
||||
|
||||
You may also want to submit your change so that can be considered for
|
||||
conclusion in a future version of GDB (see below). Regardless, we
|
||||
encourage you to distribute the change yourself.
|
||||
|
||||
If you don't feel up to hacking GDB, there are still plenty of ways to
|
||||
help! You can answer questions on the mailing lists, write
|
||||
documentation, find bugs, create a GDB related website (contribute to
|
||||
the official GDB web site), or create a GDB related software
|
||||
package. We welcome all of the above and feel free to ask on the GDB
|
||||
mailing lists if you are looking for feedback or for people to review
|
||||
a work in progress.
|
||||
|
||||
Ref: http://sourceware.cygnus.com/gdb
|
||||
|
||||
Finally, there are certain legal requirements and style issues which
|
||||
all contributors need to be aware of.
|
||||
|
||||
o Coding Standards
|
||||
|
||||
All contributions must conform to the GNU Coding Standard.
|
||||
http://www.gnu.ai.mit.edu/prep/standards_toc.html
|
||||
Submissions which do not conform to the standards will be
|
||||
returned with a request to reformat the changes.
|
||||
|
||||
For GDB, that standard is more tightly defined. GDB's
|
||||
coding standard is determined by the output of
|
||||
gnu-indent.
|
||||
|
||||
This situation came about because, by the start of '99,
|
||||
GDB's coding style was so bad an inconsistent that it was
|
||||
decided to restart things from scratch.
|
||||
|
||||
|
||||
o Copyright Assignment
|
||||
|
||||
There are certain legal requirements
|
||||
|
||||
Before we can accept code contributions from you, we need a
|
||||
copyright assignment form filled out.
|
||||
|
||||
If you've developed some addition or patch to GDB that you
|
||||
would like to contribute, you should fill out a copyright
|
||||
assignment form and send it in to the FSF. We are unable to
|
||||
use code from you until this is on-file at the FSF, so get
|
||||
that paperwork in! This form covers one batch of changes.
|
||||
Ref: http://gcc.gnu.org/fsf-forms/assignment-instructions.html
|
||||
|
||||
If you think you're going to be doing continuing work on GDB, it
|
||||
would be easier to use a different form, which arranges to
|
||||
assign the copyright for all your future changes to GDB. It is
|
||||
called assign.future. Please note that if you switch
|
||||
employers, the new employer will need to fill out the
|
||||
disclaim.future form; there is no need to fill out the
|
||||
assign.future form again.
|
||||
Ref: http://gcc.gnu.org/fsf-forms/assign.future
|
||||
Ref: http://gcc.gnu.org/fsf-forms/disclaim.future
|
||||
|
||||
There are several other forms you can fill out for different
|
||||
circumstances (e.g. to contribute an entirely new program, to
|
||||
contribute significant changes to a manual, etc.)
|
||||
Ref: http://gcc.gnu.org/fsf-forms/copyrights.html
|
||||
|
||||
Small changes can be accepted without a copyright assignment
|
||||
form on file.
|
||||
|
||||
This is pretty confusing! If you are unsure of what is
|
||||
necessary, just ask the GDB mailing list and we'll figure out
|
||||
what is best for you.
|
||||
|
||||
Note: Many of these forms have a place for "name of
|
||||
program". Insert the name of one program in that place -- in
|
||||
this case, "GDB".
|
||||
|
||||
|
||||
o Submitting Patches
|
||||
|
||||
Every patch must have several pieces of information before we
|
||||
can properly evaluate it.
|
||||
|
||||
A description of the bug and how your patch fixes this
|
||||
bug. A reference to a testsuite failure is very helpful. For
|
||||
new features a description of the feature and your
|
||||
implementation.
|
||||
|
||||
A ChangeLog entry as plaintext (separate from the patch); see
|
||||
the various ChangeLog files for format and content. Note that,
|
||||
unlike some other projects, we do require ChangeLogs also for
|
||||
documentation (i.e., .texi files).
|
||||
|
||||
The patch itself. If you are accessing the CVS repository at:
|
||||
Cygnus, use "cvs update; cvs diff -c3p"; else, use "diff -c3p
|
||||
OLD NEW" or "diff -up OLD NEW". If your version of diff does
|
||||
not support these options, then get the latest version of GNU
|
||||
diff.
|
||||
|
||||
We accept patches as plain text (preferred for the compilers
|
||||
themselves), MIME attachments (preferred for the web pages),
|
||||
or as uuencoded gzipped text.
|
||||
|
||||
When you have all these pieces, bundle them up in a mail
|
||||
message and send it to gdb-patches@sourceware.cygnus.com. All
|
||||
patches and related discussion should be sent to the
|
||||
gdb-patches mailinglist. For further information on the GDB
|
||||
CVS repository, see the Anonymous read-only CVS access and
|
||||
Read-write CVS access page.
|
||||
|
||||
--
|
||||
|
||||
Supplemental information for GDB:
|
||||
|
||||
o Please try to run the relevant testsuite before and after
|
||||
committing a patch
|
||||
|
||||
If the contributor doesn't do it then the maintainer will. A
|
||||
contributor might include before/after test results in their
|
||||
contribution.
|
||||
|
||||
|
||||
o For bug fixes, please try to include a way of
|
||||
demonstrating that the patch actually fixes something.
|
||||
|
||||
The best way of doing this is to ensure that the
|
||||
testsuite contains one or more test cases that
|
||||
fail without the fix but pass with the fix.
|
||||
|
||||
People are encouraged to submit patches that extend
|
||||
the testsuite.
|
||||
|
||||
|
||||
o Please read your patch before submitting it.
|
||||
|
||||
A patch containing several unrelated changes or
|
||||
arbitrary reformats will be returned with a request
|
||||
to re-formatting / split it.
|
||||
|
||||
|
||||
o If ``gdb/configure.in'' is modified then you don't
|
||||
need to include patches to the regenerated file
|
||||
``configure''.
|
||||
|
||||
The maintainer will re-generate those files
|
||||
using autoconf (2.13 as of 2000-02-29).
|
@ -3,21 +3,22 @@
|
||||
|
||||
Written by Rob Savoye of Cygnus Support
|
||||
|
||||
This file is part of GDB.
|
||||
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 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.
|
||||
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. */
|
||||
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. */
|
||||
|
||||
#include "defs.h"
|
||||
#include "gdbcore.h"
|
||||
@ -92,61 +93,62 @@ static char *abug_regnames[NUM_REGS] =
|
||||
|
||||
static struct target_ops abug_ops;
|
||||
|
||||
static char *abug_inits[] = {"\r", NULL};
|
||||
static char *abug_inits[] =
|
||||
{"\r", NULL};
|
||||
|
||||
static struct monitor_ops abug_cmds ;
|
||||
|
||||
static void
|
||||
init_abug_cmds(void)
|
||||
{
|
||||
abug_cmds.flags = MO_CLR_BREAK_USES_ADDR;
|
||||
abug_cmds.init = abug_inits; /* Init strings */
|
||||
abug_cmds.cont = "g\r"; /* continue command */
|
||||
abug_cmds.step = "t\r"; /* single step */
|
||||
abug_cmds.stop = NULL; /* interrupt command */
|
||||
abug_cmds.set_break = "br %x\r"; /* set a breakpoint */
|
||||
abug_cmds.clr_break = "nobr %x\r"; /* clear a breakpoint */
|
||||
abug_cmds.clr_all_break = "nobr\r"; /* clear all breakpoints */
|
||||
abug_cmds.fill = "bf %x:%x %x;b\r"; /* fill (start count val) */
|
||||
abug_cmds.setmem.cmdb = "ms %x %02x\r"; /* setmem.cmdb (addr, value) */
|
||||
abug_cmds.setmem.cmdw = "ms %x %04x\r"; /* setmem.cmdw (addr, value) */
|
||||
abug_cmds.setmem.cmdl = "ms %x %08x\r"; /* setmem.cmdl (addr, value) */
|
||||
abug_cmds.setmem.cmdll = NULL; /* setmem.cmdll (addr, value) */
|
||||
abug_cmds.setmem.resp_delim = NULL; /* setreg.resp_delim */
|
||||
abug_cmds.setmem.term = NULL; /* setreg.term */
|
||||
abug_cmds.setmem.term_cmd = NULL; /* setreg.term_cmd */
|
||||
abug_cmds.getmem.cmdb = "md %x:%x;b\r"; /* getmem.cmdb (addr, len) */
|
||||
abug_cmds.getmem.cmdw = "md %x:%x;b\r"; /* getmem.cmdw (addr, len) */
|
||||
abug_cmds.getmem.cmdl = "md %x:%x;b\r"; /* getmem.cmdl (addr, len) */
|
||||
abug_cmds.getmem.cmdll = NULL; /* getmem.cmdll (addr, len) */
|
||||
abug_cmds.getmem.resp_delim = " "; /* getmem.resp_delim */
|
||||
abug_cmds.getmem.term = NULL; /* getmem.term */
|
||||
abug_cmds.getmem.term_cmd = NULL; /* getmem.term_cmd */
|
||||
abug_cmds.setreg.cmd = "rm %s %x\r"; /* setreg.cmd (name, value) */
|
||||
abug_cmds.setreg.resp_delim = "="; /* setreg.resp_delim */
|
||||
abug_cmds.setreg.term = "? "; /* setreg.term */
|
||||
abug_cmds.setreg.term_cmd = ".\r" ; /* setreg.term_cmd */
|
||||
abug_cmds.getreg.cmd = "rm %s\r"; /* getreg.cmd (name) */
|
||||
abug_cmds.getreg.resp_delim = "="; /* getreg.resp_delim */
|
||||
abug_cmds.getreg.term = "? "; /* getreg.term */
|
||||
abug_cmds.getreg.term_cmd = ".\r" ; /* getreg.term_cmd */
|
||||
abug_cmds.dump_registers = "rd\r"; /* dump_registers */
|
||||
abug_cmds.register_pattern = "\\(\\w+\\) +=\\([0-9a-fA-F]+\\b\\)"; /* register_pattern */
|
||||
abug_cmds.supply_register = abug_supply_register; /* supply_register */
|
||||
abug_cmds.load_routine = NULL; /* load_routine (defaults to SRECs) */
|
||||
abug_cmds.load = "lo 0\r"; /* download command */
|
||||
abug_cmds.loadresp = "\n"; /* load response */
|
||||
abug_cmds.prompt = "135Bug>"; /* monitor command prompt */
|
||||
abug_cmds.line_term = "\r"; /* end-of-line terminator */
|
||||
abug_cmds.cmd_end = NULL; /* optional command terminator */
|
||||
abug_cmds.target = &abug_ops; /* target operations */
|
||||
abug_cmds.stopbits = SERIAL_1_STOPBITS; /* number of stop bits */
|
||||
abug_cmds.regnames = abug_regnames; /* registers names */
|
||||
abug_cmds.magic = MONITOR_OPS_MAGIC ; /* magic */
|
||||
};
|
||||
static struct monitor_ops abug_cmds;
|
||||
|
||||
static void
|
||||
abug_open(args, from_tty)
|
||||
init_abug_cmds (void)
|
||||
{
|
||||
abug_cmds.flags = MO_CLR_BREAK_USES_ADDR;
|
||||
abug_cmds.init = abug_inits; /* Init strings */
|
||||
abug_cmds.cont = "g\r"; /* continue command */
|
||||
abug_cmds.step = "t\r"; /* single step */
|
||||
abug_cmds.stop = NULL; /* interrupt command */
|
||||
abug_cmds.set_break = "br %x\r"; /* set a breakpoint */
|
||||
abug_cmds.clr_break = "nobr %x\r"; /* clear a breakpoint */
|
||||
abug_cmds.clr_all_break = "nobr\r"; /* clear all breakpoints */
|
||||
abug_cmds.fill = "bf %x:%x %x;b\r"; /* fill (start count val) */
|
||||
abug_cmds.setmem.cmdb = "ms %x %02x\r"; /* setmem.cmdb (addr, value) */
|
||||
abug_cmds.setmem.cmdw = "ms %x %04x\r"; /* setmem.cmdw (addr, value) */
|
||||
abug_cmds.setmem.cmdl = "ms %x %08x\r"; /* setmem.cmdl (addr, value) */
|
||||
abug_cmds.setmem.cmdll = NULL; /* setmem.cmdll (addr, value) */
|
||||
abug_cmds.setmem.resp_delim = NULL; /* setreg.resp_delim */
|
||||
abug_cmds.setmem.term = NULL; /* setreg.term */
|
||||
abug_cmds.setmem.term_cmd = NULL; /* setreg.term_cmd */
|
||||
abug_cmds.getmem.cmdb = "md %x:%x;b\r"; /* getmem.cmdb (addr, len) */
|
||||
abug_cmds.getmem.cmdw = "md %x:%x;b\r"; /* getmem.cmdw (addr, len) */
|
||||
abug_cmds.getmem.cmdl = "md %x:%x;b\r"; /* getmem.cmdl (addr, len) */
|
||||
abug_cmds.getmem.cmdll = NULL; /* getmem.cmdll (addr, len) */
|
||||
abug_cmds.getmem.resp_delim = " "; /* getmem.resp_delim */
|
||||
abug_cmds.getmem.term = NULL; /* getmem.term */
|
||||
abug_cmds.getmem.term_cmd = NULL; /* getmem.term_cmd */
|
||||
abug_cmds.setreg.cmd = "rm %s %x\r"; /* setreg.cmd (name, value) */
|
||||
abug_cmds.setreg.resp_delim = "="; /* setreg.resp_delim */
|
||||
abug_cmds.setreg.term = "? "; /* setreg.term */
|
||||
abug_cmds.setreg.term_cmd = ".\r"; /* setreg.term_cmd */
|
||||
abug_cmds.getreg.cmd = "rm %s\r"; /* getreg.cmd (name) */
|
||||
abug_cmds.getreg.resp_delim = "="; /* getreg.resp_delim */
|
||||
abug_cmds.getreg.term = "? "; /* getreg.term */
|
||||
abug_cmds.getreg.term_cmd = ".\r"; /* getreg.term_cmd */
|
||||
abug_cmds.dump_registers = "rd\r"; /* dump_registers */
|
||||
abug_cmds.register_pattern = "\\(\\w+\\) +=\\([0-9a-fA-F]+\\b\\)"; /* register_pattern */
|
||||
abug_cmds.supply_register = abug_supply_register; /* supply_register */
|
||||
abug_cmds.load_routine = NULL; /* load_routine (defaults to SRECs) */
|
||||
abug_cmds.load = "lo 0\r"; /* download command */
|
||||
abug_cmds.loadresp = "\n"; /* load response */
|
||||
abug_cmds.prompt = "135Bug>"; /* monitor command prompt */
|
||||
abug_cmds.line_term = "\r"; /* end-of-line terminator */
|
||||
abug_cmds.cmd_end = NULL; /* optional command terminator */
|
||||
abug_cmds.target = &abug_ops; /* target operations */
|
||||
abug_cmds.stopbits = SERIAL_1_STOPBITS; /* number of stop bits */
|
||||
abug_cmds.regnames = abug_regnames; /* registers names */
|
||||
abug_cmds.magic = MONITOR_OPS_MAGIC; /* magic */
|
||||
};
|
||||
|
||||
static void
|
||||
abug_open (args, from_tty)
|
||||
char *args;
|
||||
int from_tty;
|
||||
{
|
||||
@ -156,7 +158,7 @@ abug_open(args, from_tty)
|
||||
void
|
||||
_initialize_abug_rom ()
|
||||
{
|
||||
init_abug_cmds() ;
|
||||
init_abug_cmds ();
|
||||
init_monitor_ops (&abug_ops);
|
||||
|
||||
abug_ops.to_shortname = "abug";
|
||||
|
@ -1,16 +1,5 @@
|
||||
|
||||
/* Whether malloc must be declared even if <stdlib.h> is included. */
|
||||
#undef NEED_DECLARATION_MALLOC
|
||||
|
||||
/* Whether realloc must be declared even if <stdlib.h> is included. */
|
||||
#undef NEED_DECLARATION_REALLOC
|
||||
|
||||
/* Whether free must be declared even if <stdlib.h> is included. */
|
||||
#undef NEED_DECLARATION_FREE
|
||||
|
||||
/* Whether strerror must be declared even if <string.h> is included. */
|
||||
#undef NEED_DECLARATION_STRERROR
|
||||
@TOP@
|
||||
/* Define if compiling on Solaris 7. */
|
||||
#undef _MSE_INT_H
|
||||
|
||||
/* Define if pstatus_t type is available */
|
||||
#undef HAVE_PSTATUS_T
|
||||
@ -24,13 +13,28 @@
|
||||
/* Define if gregset_t type is available. */
|
||||
#undef HAVE_GREGSET_T
|
||||
|
||||
/* Define if <sys/procfs.h> has prgregset_t. */
|
||||
#undef HAVE_PRGREGSET_T
|
||||
|
||||
/* Define if <sys/procfs.h> has prfpregset_t. */
|
||||
#undef HAVE_PRFPREGSET_T
|
||||
|
||||
/* Define if <sys/procfs.h> has lwpid_t. */
|
||||
#undef HAVE_LWPID_T
|
||||
|
||||
/* Define if <sys/procfs.h> has psaddr_t. */
|
||||
#undef HAVE_PSADDR_T
|
||||
|
||||
/* Define if the prfpregset_t type is broken. */
|
||||
#undef PRFPREGSET_T_BROKEN
|
||||
|
||||
/* Define if you want to use new multi-fd /proc interface
|
||||
(replaces HAVE_MULTIPLE_PROC_FDS as well as other macros). */
|
||||
#undef NEW_PROC_API
|
||||
|
||||
/* Define if ioctl argument PIOCSET is available. */
|
||||
#undef HAVE_PROCFS_PIOCSET
|
||||
|
||||
/* /proc PID entries are directories containing the files
|
||||
ctl as map status */
|
||||
#undef HAVE_MULTIPLE_PROC_FDS
|
||||
|
||||
/* Define if the `long long' type works. */
|
||||
#undef CC_HAS_LONG_LONG
|
||||
|
||||
@ -88,8 +92,17 @@
|
||||
name, as a C string. */
|
||||
#undef TARGET_CPU_DEFAULT
|
||||
|
||||
/* Define if the simulator is being linked in. */
|
||||
#undef WITH_SIM
|
||||
|
||||
/* Set to true if the save_state_t structure is present */
|
||||
#define HAVE_STRUCT_SAVE_STATE_T 0
|
||||
#undef HAVE_STRUCT_SAVE_STATE_T
|
||||
|
||||
/* Set to true if the save_state_t structure has the ss_wide member */
|
||||
#define HAVE_STRUCT_MEMBER_SS_WIDE 0
|
||||
#undef HAVE_STRUCT_MEMBER_SS_WIDE
|
||||
|
||||
/* Define if <sys/ptrace.h> defines the PTRACE_GETREGS request. */
|
||||
#undef HAVE_PTRACE_GETREGS
|
||||
|
||||
/* Define if <sys/ptrace.h> defines the PTRACE_GETXFPREGS request. */
|
||||
#undef HAVE_PTRACE_GETXFPREGS
|
||||
|
@ -1,21 +1,22 @@
|
||||
/* Low level Alpha interface, for GDB when running native.
|
||||
Copyright 1993, 1995, 1996, 1998 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
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 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.
|
||||
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. */
|
||||
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. */
|
||||
|
||||
#include "defs.h"
|
||||
#include "inferior.h"
|
||||
@ -23,10 +24,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#include "target.h"
|
||||
#include <sys/ptrace.h>
|
||||
#ifdef __linux__
|
||||
# include <asm/reg.h>
|
||||
# include <alpha/ptrace.h>
|
||||
#include <asm/reg.h>
|
||||
#include <alpha/ptrace.h>
|
||||
#else
|
||||
# include <machine/reg.h>
|
||||
#include <machine/reg.h>
|
||||
#endif
|
||||
#include <sys/user.h>
|
||||
|
||||
@ -62,13 +63,13 @@ get_longjmp_target (pc)
|
||||
CORE_ADDR jb_addr;
|
||||
char raw_buffer[MAX_REGISTER_RAW_SIZE];
|
||||
|
||||
jb_addr = read_register(A0_REGNUM);
|
||||
jb_addr = read_register (A0_REGNUM);
|
||||
|
||||
if (target_read_memory(jb_addr + JB_PC * JB_ELEMENT_SIZE, raw_buffer,
|
||||
sizeof(CORE_ADDR)))
|
||||
if (target_read_memory (jb_addr + JB_PC * JB_ELEMENT_SIZE, raw_buffer,
|
||||
sizeof (CORE_ADDR)))
|
||||
return 0;
|
||||
|
||||
*pc = extract_address (raw_buffer, sizeof(CORE_ADDR));
|
||||
*pc = extract_address (raw_buffer, sizeof (CORE_ADDR));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -78,11 +79,11 @@ get_longjmp_target (pc)
|
||||
CORE_REG_SECT points to the register values themselves, read into memory.
|
||||
CORE_REG_SIZE is the size of that area.
|
||||
WHICH says which set of registers we are handling (0 = int, 2 = float
|
||||
on machines where they are discontiguous).
|
||||
on machines where they are discontiguous).
|
||||
REG_ADDR is the offset from u.u_ar0 to the register values relative to
|
||||
core_reg_sect. This is used with old-fashioned core files to
|
||||
locate the registers in a large upage-plus-stack ".reg" section.
|
||||
Original upage address X is at location core_reg_sect+x+reg_addr.
|
||||
core_reg_sect. This is used with old-fashioned core files to
|
||||
locate the registers in a large upage-plus-stack ".reg" section.
|
||||
Original upage address X is at location core_reg_sect+x+reg_addr.
|
||||
*/
|
||||
|
||||
static void
|
||||
@ -101,17 +102,18 @@ fetch_osf_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
|
||||
static int core_reg_mapping[NUM_REGS] =
|
||||
{
|
||||
#define EFL (EF_SIZE / 8)
|
||||
EF_V0, EF_T0, EF_T1, EF_T2, EF_T3, EF_T4, EF_T5, EF_T6,
|
||||
EF_T7, EF_S0, EF_S1, EF_S2, EF_S3, EF_S4, EF_S5, EF_S6,
|
||||
EF_A0, EF_A1, EF_A2, EF_A3, EF_A4, EF_A5, EF_T8, EF_T9,
|
||||
EF_T10, EF_T11, EF_RA, EF_T12, EF_AT, EF_GP, EF_SP, -1,
|
||||
EFL+0, EFL+1, EFL+2, EFL+3, EFL+4, EFL+5, EFL+6, EFL+7,
|
||||
EFL+8, EFL+9, EFL+10, EFL+11, EFL+12, EFL+13, EFL+14, EFL+15,
|
||||
EFL+16, EFL+17, EFL+18, EFL+19, EFL+20, EFL+21, EFL+22, EFL+23,
|
||||
EFL+24, EFL+25, EFL+26, EFL+27, EFL+28, EFL+29, EFL+30, EFL+31,
|
||||
EF_PC, -1
|
||||
EF_V0, EF_T0, EF_T1, EF_T2, EF_T3, EF_T4, EF_T5, EF_T6,
|
||||
EF_T7, EF_S0, EF_S1, EF_S2, EF_S3, EF_S4, EF_S5, EF_S6,
|
||||
EF_A0, EF_A1, EF_A2, EF_A3, EF_A4, EF_A5, EF_T8, EF_T9,
|
||||
EF_T10, EF_T11, EF_RA, EF_T12, EF_AT, EF_GP, EF_SP, -1,
|
||||
EFL + 0, EFL + 1, EFL + 2, EFL + 3, EFL + 4, EFL + 5, EFL + 6, EFL + 7,
|
||||
EFL + 8, EFL + 9, EFL + 10, EFL + 11, EFL + 12, EFL + 13, EFL + 14, EFL + 15,
|
||||
EFL + 16, EFL + 17, EFL + 18, EFL + 19, EFL + 20, EFL + 21, EFL + 22, EFL + 23,
|
||||
EFL + 24, EFL + 25, EFL + 26, EFL + 27, EFL + 28, EFL + 29, EFL + 30, EFL + 31,
|
||||
EF_PC, -1
|
||||
};
|
||||
static char zerobuf[MAX_REGISTER_RAW_SIZE] = {0};
|
||||
static char zerobuf[MAX_REGISTER_RAW_SIZE] =
|
||||
{0};
|
||||
|
||||
for (regno = 0; regno < NUM_REGS; regno++)
|
||||
{
|
||||
@ -144,7 +146,7 @@ fetch_elf_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
|
||||
int which;
|
||||
CORE_ADDR reg_addr;
|
||||
{
|
||||
if (core_reg_size < 32*8)
|
||||
if (core_reg_size < 32 * 8)
|
||||
{
|
||||
error ("Core file register section too small (%u bytes).", core_reg_size);
|
||||
return;
|
||||
@ -153,15 +155,15 @@ fetch_elf_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
|
||||
if (which == 2)
|
||||
{
|
||||
/* The FPU Registers. */
|
||||
memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)], core_reg_sect, 31*8);
|
||||
memset (®isters[REGISTER_BYTE (FP0_REGNUM+31)], 0, 8);
|
||||
memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)], core_reg_sect, 31 * 8);
|
||||
memset (®isters[REGISTER_BYTE (FP0_REGNUM + 31)], 0, 8);
|
||||
memset (®ister_valid[FP0_REGNUM], 1, 32);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The General Registers. */
|
||||
memcpy (®isters[REGISTER_BYTE (V0_REGNUM)], core_reg_sect, 31*8);
|
||||
memcpy (®isters[REGISTER_BYTE (PC_REGNUM)], core_reg_sect+31*8, 8);
|
||||
memcpy (®isters[REGISTER_BYTE (V0_REGNUM)], core_reg_sect, 31 * 8);
|
||||
memcpy (®isters[REGISTER_BYTE (PC_REGNUM)], core_reg_sect + 31 * 8, 8);
|
||||
memset (®isters[REGISTER_BYTE (ZERO_REGNUM)], 0, 8);
|
||||
memset (®ister_valid[V0_REGNUM], 1, 32);
|
||||
register_valid[PC_REGNUM] = 1;
|
||||
@ -201,18 +203,19 @@ kernel_u_size ()
|
||||
* See the comment in m68k-tdep.c regarding the utility of these functions.
|
||||
*/
|
||||
|
||||
void
|
||||
void
|
||||
supply_gregset (gregsetp)
|
||||
gregset_t *gregsetp;
|
||||
{
|
||||
register int regi;
|
||||
register long *regp = ALPHA_REGSET_BASE (gregsetp);
|
||||
static char zerobuf[MAX_REGISTER_RAW_SIZE] = {0};
|
||||
static char zerobuf[MAX_REGISTER_RAW_SIZE] =
|
||||
{0};
|
||||
|
||||
for (regi = 0; regi < 31; regi++)
|
||||
supply_register (regi, (char *)(regp + regi));
|
||||
supply_register (regi, (char *) (regp + regi));
|
||||
|
||||
supply_register (PC_REGNUM, (char *)(regp + 31));
|
||||
supply_register (PC_REGNUM, (char *) (regp + 31));
|
||||
|
||||
/* Fill inaccessible registers with zero. */
|
||||
supply_register (ZERO_REGNUM, zerobuf);
|
||||
@ -248,7 +251,7 @@ supply_fpregset (fpregsetp)
|
||||
register long *regp = ALPHA_REGSET_BASE (fpregsetp);
|
||||
|
||||
for (regi = 0; regi < 32; regi++)
|
||||
supply_register (regi + FP0_REGNUM, (char *)(regp + regi));
|
||||
supply_register (regi + FP0_REGNUM, (char *) (regp + regi));
|
||||
}
|
||||
|
||||
void
|
||||
@ -269,24 +272,28 @@ fill_fpregset (fpregsetp, regno)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Register that we are able to handle alpha core file formats. */
|
||||
|
||||
static struct core_fns alpha_osf_core_fns =
|
||||
{
|
||||
/* This really is bfd_target_unknown_flavour. */
|
||||
|
||||
bfd_target_unknown_flavour,
|
||||
fetch_osf_core_registers,
|
||||
NULL
|
||||
bfd_target_unknown_flavour, /* core_flavour */
|
||||
default_check_format, /* check_format */
|
||||
default_core_sniffer, /* core_sniffer */
|
||||
fetch_osf_core_registers, /* core_read_registers */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
static struct core_fns alpha_elf_core_fns =
|
||||
{
|
||||
bfd_target_elf_flavour,
|
||||
fetch_elf_core_registers,
|
||||
NULL
|
||||
bfd_target_elf_flavour, /* core_flavour */
|
||||
default_check_format, /* check_format */
|
||||
default_core_sniffer, /* core_sniffer */
|
||||
fetch_elf_core_registers, /* core_read_registers */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
void
|
||||
|
@ -1,16 +1,16 @@
|
||||
.text
|
||||
.global _convert_from_extended
|
||||
|
||||
_convert_from_extended:
|
||||
|
||||
ldfe f0,[a1]
|
||||
stfd f0,[a2]
|
||||
movs pc,lr
|
||||
|
||||
.global _convert_to_extended
|
||||
|
||||
_convert_to_extended:
|
||||
|
||||
ldfd f0,[a1]
|
||||
stfe f0,[a2]
|
||||
movs pc,lr
|
||||
/* OBSOLETE .text */
|
||||
/* OBSOLETE .global _convert_from_extended */
|
||||
/* OBSOLETE */
|
||||
/* OBSOLETE _convert_from_extended: */
|
||||
/* OBSOLETE */
|
||||
/* OBSOLETE ldfe f0,[a1] */
|
||||
/* OBSOLETE stfd f0,[a2] */
|
||||
/* OBSOLETE movs pc,lr */
|
||||
/* OBSOLETE */
|
||||
/* OBSOLETE .global _convert_to_extended */
|
||||
/* OBSOLETE */
|
||||
/* OBSOLETE _convert_to_extended: */
|
||||
/* OBSOLETE */
|
||||
/* OBSOLETE ldfd f0,[a1] */
|
||||
/* OBSOLETE stfe f0,[a2] */
|
||||
/* OBSOLETE movs pc,lr */
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,52 +1,52 @@
|
||||
|
||||
/* A Bison parser, made from c-exp.y
|
||||
by GNU Bison version 1.25
|
||||
by GNU Bison version 1.27
|
||||
*/
|
||||
|
||||
#define YYBISON 1 /* Identify Bison output. */
|
||||
|
||||
#define INT 258
|
||||
#define FLOAT 259
|
||||
#define STRING 260
|
||||
#define NAME 261
|
||||
#define TYPENAME 262
|
||||
#define NAME_OR_INT 263
|
||||
#define STRUCT 264
|
||||
#define CLASS 265
|
||||
#define UNION 266
|
||||
#define ENUM 267
|
||||
#define SIZEOF 268
|
||||
#define UNSIGNED 269
|
||||
#define COLONCOLON 270
|
||||
#define TEMPLATE 271
|
||||
#define ERROR 272
|
||||
#define SIGNED_KEYWORD 273
|
||||
#define LONG 274
|
||||
#define SHORT 275
|
||||
#define INT_KEYWORD 276
|
||||
#define CONST_KEYWORD 277
|
||||
#define VOLATILE_KEYWORD 278
|
||||
#define DOUBLE_KEYWORD 279
|
||||
#define VARIABLE 280
|
||||
#define ASSIGN_MODIFY 281
|
||||
#define THIS 282
|
||||
#define TRUEKEYWORD 283
|
||||
#define FALSEKEYWORD 284
|
||||
#define ABOVE_COMMA 285
|
||||
#define OROR 286
|
||||
#define ANDAND 287
|
||||
#define EQUAL 288
|
||||
#define NOTEQUAL 289
|
||||
#define LEQ 290
|
||||
#define GEQ 291
|
||||
#define LSH 292
|
||||
#define RSH 293
|
||||
#define UNARY 294
|
||||
#define INCREMENT 295
|
||||
#define DECREMENT 296
|
||||
#define ARROW 297
|
||||
#define BLOCKNAME 298
|
||||
#define FILENAME 299
|
||||
#define INT 257
|
||||
#define FLOAT 258
|
||||
#define STRING 259
|
||||
#define NAME 260
|
||||
#define TYPENAME 261
|
||||
#define NAME_OR_INT 262
|
||||
#define STRUCT 263
|
||||
#define CLASS 264
|
||||
#define UNION 265
|
||||
#define ENUM 266
|
||||
#define SIZEOF 267
|
||||
#define UNSIGNED 268
|
||||
#define COLONCOLON 269
|
||||
#define TEMPLATE 270
|
||||
#define ERROR 271
|
||||
#define SIGNED_KEYWORD 272
|
||||
#define LONG 273
|
||||
#define SHORT 274
|
||||
#define INT_KEYWORD 275
|
||||
#define CONST_KEYWORD 276
|
||||
#define VOLATILE_KEYWORD 277
|
||||
#define DOUBLE_KEYWORD 278
|
||||
#define VARIABLE 279
|
||||
#define ASSIGN_MODIFY 280
|
||||
#define THIS 281
|
||||
#define TRUEKEYWORD 282
|
||||
#define FALSEKEYWORD 283
|
||||
#define ABOVE_COMMA 284
|
||||
#define OROR 285
|
||||
#define ANDAND 286
|
||||
#define EQUAL 287
|
||||
#define NOTEQUAL 288
|
||||
#define LEQ 289
|
||||
#define GEQ 290
|
||||
#define LSH 291
|
||||
#define RSH 292
|
||||
#define UNARY 293
|
||||
#define INCREMENT 294
|
||||
#define DECREMENT 295
|
||||
#define ARROW 296
|
||||
#define BLOCKNAME 297
|
||||
#define FILENAME 298
|
||||
|
||||
#line 38 "c-exp.y"
|
||||
|
||||
@ -170,7 +170,7 @@ parse_number PARAMS ((char *, int, int, YYSTYPE *));
|
||||
#define YYFLAG -32768
|
||||
#define YYNTBASE 69
|
||||
|
||||
#define YYTRANSLATE(x) ((unsigned)(x) <= 299 ? yytranslate[x] : 91)
|
||||
#define YYTRANSLATE(x) ((unsigned)(x) <= 298 ? yytranslate[x] : 91)
|
||||
|
||||
static const char yytranslate[] = { 0,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
@ -198,11 +198,11 @@ static const char yytranslate[] = { 0,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
|
||||
6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
||||
16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
|
||||
26, 27, 28, 29, 31, 34, 35, 39, 40, 43,
|
||||
44, 45, 46, 53, 54, 55, 56, 60, 61
|
||||
2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
|
||||
7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
|
||||
17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
|
||||
27, 28, 29, 31, 34, 35, 39, 40, 43, 44,
|
||||
45, 46, 53, 54, 55, 56, 60, 61
|
||||
};
|
||||
|
||||
#if YYDEBUG != 0
|
||||
@ -558,7 +558,8 @@ static const short yycheck[] = { 0,
|
||||
56, 57, 58, 59
|
||||
};
|
||||
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
|
||||
#line 3 "/stone/jimb/main-98r2/share/bison.simple"
|
||||
#line 3 "/usr/lib/bison.simple"
|
||||
/* This file comes from bison-1.27. */
|
||||
|
||||
/* Skeleton output parser for bison,
|
||||
Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
|
||||
@ -575,45 +576,65 @@ static const short yycheck[] = { 0,
|
||||
|
||||
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. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* As a special exception, when this file is copied by Bison into a
|
||||
Bison output file, you may use that output file without restriction.
|
||||
This special exception was added by the Free Software Foundation
|
||||
in version 1.24 of Bison. */
|
||||
|
||||
#ifndef alloca
|
||||
#ifdef __GNUC__
|
||||
#define alloca __builtin_alloca
|
||||
#else /* not GNU C. */
|
||||
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
|
||||
#include <alloca.h>
|
||||
#else /* not sparc */
|
||||
#if defined (MSDOS) && !defined (__TURBOC__)
|
||||
#else /* not MSDOS, or __TURBOC__ */
|
||||
#if defined(_AIX)
|
||||
#pragma alloca
|
||||
#else /* not MSDOS, __TURBOC__, or _AIX */
|
||||
#ifdef __hpux
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
void *alloca (unsigned int);
|
||||
};
|
||||
#else /* not __cplusplus */
|
||||
void *alloca ();
|
||||
#endif /* not __cplusplus */
|
||||
#endif /* __hpux */
|
||||
#endif /* not _AIX */
|
||||
#endif /* not MSDOS, or __TURBOC__ */
|
||||
#endif /* not sparc. */
|
||||
#endif /* not GNU C. */
|
||||
#endif /* alloca not defined. */
|
||||
|
||||
/* This is the parser code that is written into each bison parser
|
||||
when the %semantic_parser declaration is not specified in the grammar.
|
||||
It was written by Richard Stallman by simplifying the hairy parser
|
||||
used when %semantic_parser is specified. */
|
||||
|
||||
#ifndef YYSTACK_USE_ALLOCA
|
||||
#ifdef alloca
|
||||
#define YYSTACK_USE_ALLOCA
|
||||
#else /* alloca not defined */
|
||||
#ifdef __GNUC__
|
||||
#define YYSTACK_USE_ALLOCA
|
||||
#define alloca __builtin_alloca
|
||||
#else /* not GNU C. */
|
||||
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
|
||||
#define YYSTACK_USE_ALLOCA
|
||||
#include <alloca.h>
|
||||
#else /* not sparc */
|
||||
/* We think this test detects Watcom and Microsoft C. */
|
||||
/* This used to test MSDOS, but that is a bad idea
|
||||
since that symbol is in the user namespace. */
|
||||
#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
|
||||
#if 0 /* No need for xmalloc.h, which pollutes the namespace;
|
||||
instead, just don't use alloca. */
|
||||
#endif
|
||||
#else /* not MSDOS, or __TURBOC__ */
|
||||
#if defined(_AIX)
|
||||
/* I don't know what this was needed for, but it pollutes the namespace.
|
||||
So I turned it off. rms, 2 May 1997. */
|
||||
#pragma alloca
|
||||
#define YYSTACK_USE_ALLOCA
|
||||
#else /* not MSDOS, or __TURBOC__, or _AIX */
|
||||
#if 0
|
||||
#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
|
||||
and on HPUX 10. Eventually we can turn this on. */
|
||||
#define YYSTACK_USE_ALLOCA
|
||||
#define alloca __builtin_alloca
|
||||
#endif /* __hpux */
|
||||
#endif
|
||||
#endif /* not _AIX */
|
||||
#endif /* not MSDOS, or __TURBOC__ */
|
||||
#endif /* not sparc */
|
||||
#endif /* not GNU C */
|
||||
#endif /* alloca not defined */
|
||||
#endif /* YYSTACK_USE_ALLOCA not defined */
|
||||
|
||||
#ifdef YYSTACK_USE_ALLOCA
|
||||
#define YYSTACK_ALLOC alloca
|
||||
#else
|
||||
#define YYSTACK_ALLOC xmalloc
|
||||
#endif
|
||||
|
||||
/* Note: there must be only one dollar sign in this file.
|
||||
It is replaced by the list of actions, each action
|
||||
as one case of the switch. */
|
||||
@ -622,8 +643,8 @@ void *alloca ();
|
||||
#define yyclearin (yychar = YYEMPTY)
|
||||
#define YYEMPTY -2
|
||||
#define YYEOF 0
|
||||
#define YYACCEPT return(0)
|
||||
#define YYABORT return(1)
|
||||
#define YYACCEPT goto yyacceptlab
|
||||
#define YYABORT goto yyabortlab
|
||||
#define YYERROR goto yyerrlab1
|
||||
/* Like YYERROR except do call yyerror.
|
||||
This remains here temporarily to ease the
|
||||
@ -704,12 +725,12 @@ int yydebug; /* nonzero means print parse trace */
|
||||
#ifndef YYMAXDEPTH
|
||||
#define YYMAXDEPTH 10000
|
||||
#endif
|
||||
|
||||
/* Prevent warning if -Wstrict-prototypes. */
|
||||
#ifdef __GNUC__
|
||||
int yyparse (void);
|
||||
#endif
|
||||
|
||||
/* Define __yy_memcpy. Note that the size argument
|
||||
should be passed with type unsigned int, because that is what the non-GCC
|
||||
definitions require. With GCC, __builtin_memcpy takes an arg
|
||||
of type size_t, but it can handle unsigned int. */
|
||||
|
||||
#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
|
||||
#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
|
||||
#else /* not GNU C or C++ */
|
||||
@ -721,7 +742,7 @@ static void
|
||||
__yy_memcpy (to, from, count)
|
||||
char *to;
|
||||
char *from;
|
||||
int count;
|
||||
unsigned int count;
|
||||
{
|
||||
register char *f = from;
|
||||
register char *t = to;
|
||||
@ -736,10 +757,10 @@ __yy_memcpy (to, from, count)
|
||||
/* This is the most reliable way to avoid incompatibilities
|
||||
in available built-in functions on various systems. */
|
||||
static void
|
||||
__yy_memcpy (char *to, char *from, int count)
|
||||
__yy_memcpy (char *to, char *from, unsigned int count)
|
||||
{
|
||||
register char *f = from;
|
||||
register char *t = to;
|
||||
register char *f = from;
|
||||
register int i = count;
|
||||
|
||||
while (i-- > 0)
|
||||
@ -749,7 +770,7 @@ __yy_memcpy (char *to, char *from, int count)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#line 196 "/stone/jimb/main-98r2/share/bison.simple"
|
||||
#line 216 "/usr/lib/bison.simple"
|
||||
|
||||
/* The user can define YYPARSE_PARAM as the name of an argument to be passed
|
||||
into yyparse. The argument should have type void *.
|
||||
@ -770,6 +791,15 @@ __yy_memcpy (char *to, char *from, int count)
|
||||
#define YYPARSE_PARAM_DECL
|
||||
#endif /* not YYPARSE_PARAM */
|
||||
|
||||
/* Prevent warning if -Wstrict-prototypes. */
|
||||
#ifdef __GNUC__
|
||||
#ifdef YYPARSE_PARAM
|
||||
int yyparse (void *);
|
||||
#else
|
||||
int yyparse (void);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int
|
||||
yyparse(YYPARSE_PARAM_ARG)
|
||||
YYPARSE_PARAM_DECL
|
||||
@ -798,6 +828,7 @@ yyparse(YYPARSE_PARAM_ARG)
|
||||
#endif
|
||||
|
||||
int yystacksize = YYINITDEPTH;
|
||||
int yyfree_stacks = 0;
|
||||
|
||||
#ifdef YYPURE
|
||||
int yychar;
|
||||
@ -882,18 +913,32 @@ yyparse(YYPARSE_PARAM_ARG)
|
||||
if (yystacksize >= YYMAXDEPTH)
|
||||
{
|
||||
yyerror("parser stack overflow");
|
||||
if (yyfree_stacks)
|
||||
{
|
||||
free (yyss);
|
||||
free (yyvs);
|
||||
#ifdef YYLSP_NEEDED
|
||||
free (yyls);
|
||||
#endif
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
yystacksize *= 2;
|
||||
if (yystacksize > YYMAXDEPTH)
|
||||
yystacksize = YYMAXDEPTH;
|
||||
yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
|
||||
__yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp));
|
||||
yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
|
||||
__yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp));
|
||||
#ifndef YYSTACK_USE_ALLOCA
|
||||
yyfree_stacks = 1;
|
||||
#endif
|
||||
yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
|
||||
__yy_memcpy ((char *)yyss, (char *)yyss1,
|
||||
size * (unsigned int) sizeof (*yyssp));
|
||||
yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
|
||||
__yy_memcpy ((char *)yyvs, (char *)yyvs1,
|
||||
size * (unsigned int) sizeof (*yyvsp));
|
||||
#ifdef YYLSP_NEEDED
|
||||
yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
|
||||
__yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp));
|
||||
yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
|
||||
__yy_memcpy ((char *)yyls, (char *)yyls1,
|
||||
size * (unsigned int) sizeof (*yylsp));
|
||||
#endif
|
||||
#endif /* no yyoverflow */
|
||||
|
||||
@ -1767,7 +1812,7 @@ case 131:
|
||||
break;}
|
||||
}
|
||||
/* the action file gets copied in in place of this dollarsign */
|
||||
#line 498 "/stone/jimb/main-98r2/share/bison.simple"
|
||||
#line 542 "/usr/lib/bison.simple"
|
||||
|
||||
yyvsp -= yylen;
|
||||
yyssp -= yylen;
|
||||
@ -1962,6 +2007,30 @@ case 131:
|
||||
|
||||
yystate = yyn;
|
||||
goto yynewstate;
|
||||
|
||||
yyacceptlab:
|
||||
/* YYACCEPT comes here. */
|
||||
if (yyfree_stacks)
|
||||
{
|
||||
free (yyss);
|
||||
free (yyvs);
|
||||
#ifdef YYLSP_NEEDED
|
||||
free (yyls);
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
|
||||
yyabortlab:
|
||||
/* YYABORT comes here. */
|
||||
if (yyfree_stacks)
|
||||
{
|
||||
free (yyss);
|
||||
free (yyvs);
|
||||
#ifdef YYLSP_NEEDED
|
||||
free (yyls);
|
||||
#endif
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
#line 911 "c-exp.y"
|
||||
|
||||
|
@ -1,21 +1,22 @@
|
||||
/* Machine independent support for Solaris 2 core files for GDB.
|
||||
Copyright 1994 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
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 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.
|
||||
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. */
|
||||
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. */
|
||||
|
||||
|
||||
/* Solaris comes with two flavours of core files, cores generated by
|
||||
@ -62,15 +63,15 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
|
||||
{
|
||||
#define gregs ((struct regs *)core_reg_sect)
|
||||
/* G0 *always* holds 0. */
|
||||
*(int *)®isters[REGISTER_BYTE (0)] = 0;
|
||||
*(int *) ®isters[REGISTER_BYTE (0)] = 0;
|
||||
|
||||
/* The globals and output registers. */
|
||||
memcpy (®isters[REGISTER_BYTE (G1_REGNUM)], &gregs->r_g1,
|
||||
memcpy (®isters[REGISTER_BYTE (G1_REGNUM)], &gregs->r_g1,
|
||||
15 * REGISTER_RAW_SIZE (G1_REGNUM));
|
||||
*(int *)®isters[REGISTER_BYTE (PS_REGNUM)] = gregs->r_ps;
|
||||
*(int *)®isters[REGISTER_BYTE (PC_REGNUM)] = gregs->r_pc;
|
||||
*(int *)®isters[REGISTER_BYTE (NPC_REGNUM)] = gregs->r_npc;
|
||||
*(int *)®isters[REGISTER_BYTE (Y_REGNUM)] = gregs->r_y;
|
||||
*(int *) ®isters[REGISTER_BYTE (PS_REGNUM)] = gregs->r_ps;
|
||||
*(int *) ®isters[REGISTER_BYTE (PC_REGNUM)] = gregs->r_pc;
|
||||
*(int *) ®isters[REGISTER_BYTE (NPC_REGNUM)] = gregs->r_npc;
|
||||
*(int *) ®isters[REGISTER_BYTE (Y_REGNUM)] = gregs->r_y;
|
||||
|
||||
/* My best guess at where to get the locals and input
|
||||
registers is exactly where they usually are, right above
|
||||
@ -80,9 +81,9 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
|
||||
{
|
||||
int sp;
|
||||
|
||||
sp = *(int *)®isters[REGISTER_BYTE (SP_REGNUM)];
|
||||
sp = *(int *) ®isters[REGISTER_BYTE (SP_REGNUM)];
|
||||
if (0 != target_read_memory (sp,
|
||||
®isters[REGISTER_BYTE (L0_REGNUM)],
|
||||
®isters[REGISTER_BYTE (L0_REGNUM)],
|
||||
16 * REGISTER_RAW_SIZE (L0_REGNUM)))
|
||||
{
|
||||
warning ("couldn't read input and local registers from core file\n");
|
||||
@ -115,15 +116,17 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Register that we are able to handle solaris core file formats. */
|
||||
|
||||
static struct core_fns solaris_core_fns =
|
||||
{
|
||||
bfd_target_elf_flavour,
|
||||
fetch_core_registers,
|
||||
NULL
|
||||
bfd_target_elf_flavour, /* core_flavour */
|
||||
default_check_format, /* check_format */
|
||||
default_core_sniffer, /* core_sniffer */
|
||||
fetch_core_registers, /* core_read_registers */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
void
|
||||
|
@ -1,46 +1,46 @@
|
||||
|
||||
/* A Bison parser, made from f-exp.y
|
||||
by GNU Bison version 1.25
|
||||
by GNU Bison version 1.27
|
||||
*/
|
||||
|
||||
#define YYBISON 1 /* Identify Bison output. */
|
||||
|
||||
#define INT 258
|
||||
#define FLOAT 259
|
||||
#define STRING_LITERAL 260
|
||||
#define BOOLEAN_LITERAL 261
|
||||
#define NAME 262
|
||||
#define TYPENAME 263
|
||||
#define NAME_OR_INT 264
|
||||
#define SIZEOF 265
|
||||
#define ERROR 266
|
||||
#define INT_KEYWORD 267
|
||||
#define INT_S2_KEYWORD 268
|
||||
#define LOGICAL_S1_KEYWORD 269
|
||||
#define LOGICAL_S2_KEYWORD 270
|
||||
#define LOGICAL_KEYWORD 271
|
||||
#define REAL_KEYWORD 272
|
||||
#define REAL_S8_KEYWORD 273
|
||||
#define REAL_S16_KEYWORD 274
|
||||
#define COMPLEX_S8_KEYWORD 275
|
||||
#define COMPLEX_S16_KEYWORD 276
|
||||
#define COMPLEX_S32_KEYWORD 277
|
||||
#define BOOL_AND 278
|
||||
#define BOOL_OR 279
|
||||
#define BOOL_NOT 280
|
||||
#define CHARACTER 281
|
||||
#define VARIABLE 282
|
||||
#define ASSIGN_MODIFY 283
|
||||
#define ABOVE_COMMA 284
|
||||
#define EQUAL 285
|
||||
#define NOTEQUAL 286
|
||||
#define LESSTHAN 287
|
||||
#define GREATERTHAN 288
|
||||
#define LEQ 289
|
||||
#define GEQ 290
|
||||
#define LSH 291
|
||||
#define RSH 292
|
||||
#define UNARY 293
|
||||
#define INT 257
|
||||
#define FLOAT 258
|
||||
#define STRING_LITERAL 259
|
||||
#define BOOLEAN_LITERAL 260
|
||||
#define NAME 261
|
||||
#define TYPENAME 262
|
||||
#define NAME_OR_INT 263
|
||||
#define SIZEOF 264
|
||||
#define ERROR 265
|
||||
#define INT_KEYWORD 266
|
||||
#define INT_S2_KEYWORD 267
|
||||
#define LOGICAL_S1_KEYWORD 268
|
||||
#define LOGICAL_S2_KEYWORD 269
|
||||
#define LOGICAL_KEYWORD 270
|
||||
#define REAL_KEYWORD 271
|
||||
#define REAL_S8_KEYWORD 272
|
||||
#define REAL_S16_KEYWORD 273
|
||||
#define COMPLEX_S8_KEYWORD 274
|
||||
#define COMPLEX_S16_KEYWORD 275
|
||||
#define COMPLEX_S32_KEYWORD 276
|
||||
#define BOOL_AND 277
|
||||
#define BOOL_OR 278
|
||||
#define BOOL_NOT 279
|
||||
#define CHARACTER 280
|
||||
#define VARIABLE 281
|
||||
#define ASSIGN_MODIFY 282
|
||||
#define ABOVE_COMMA 283
|
||||
#define EQUAL 284
|
||||
#define NOTEQUAL 285
|
||||
#define LESSTHAN 286
|
||||
#define GREATERTHAN 287
|
||||
#define LEQ 288
|
||||
#define GEQ 289
|
||||
#define LSH 290
|
||||
#define RSH 291
|
||||
#define UNARY 292
|
||||
|
||||
#line 43 "f-exp.y"
|
||||
|
||||
@ -157,7 +157,7 @@ static int parse_number PARAMS ((char *, int, int, YYSTYPE *));
|
||||
#define YYFLAG -32768
|
||||
#define YYNTBASE 55
|
||||
|
||||
#define YYTRANSLATE(x) ((unsigned)(x) <= 293 ? yytranslate[x] : 71)
|
||||
#define YYTRANSLATE(x) ((unsigned)(x) <= 292 ? yytranslate[x] : 71)
|
||||
|
||||
static const char yytranslate[] = { 0,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
@ -185,11 +185,11 @@ static const char yytranslate[] = { 0,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
|
||||
6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
||||
16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
|
||||
26, 27, 28, 30, 36, 37, 38, 39, 40, 41,
|
||||
42, 43, 50
|
||||
2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
|
||||
7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
|
||||
17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
|
||||
27, 28, 30, 36, 37, 38, 39, 40, 41, 42,
|
||||
43, 50
|
||||
};
|
||||
|
||||
#if YYDEBUG != 0
|
||||
@ -433,7 +433,8 @@ static const short yycheck[] = { 0,
|
||||
44, 45, 46, 47, 48, 49, -1, 51
|
||||
};
|
||||
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
|
||||
#line 3 "/stone/jimb/main-98r2/share/bison.simple"
|
||||
#line 3 "/usr/lib/bison.simple"
|
||||
/* This file comes from bison-1.27. */
|
||||
|
||||
/* Skeleton output parser for bison,
|
||||
Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
|
||||
@ -450,45 +451,65 @@ static const short yycheck[] = { 0,
|
||||
|
||||
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. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* As a special exception, when this file is copied by Bison into a
|
||||
Bison output file, you may use that output file without restriction.
|
||||
This special exception was added by the Free Software Foundation
|
||||
in version 1.24 of Bison. */
|
||||
|
||||
#ifndef alloca
|
||||
#ifdef __GNUC__
|
||||
#define alloca __builtin_alloca
|
||||
#else /* not GNU C. */
|
||||
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
|
||||
#include <alloca.h>
|
||||
#else /* not sparc */
|
||||
#if defined (MSDOS) && !defined (__TURBOC__)
|
||||
#else /* not MSDOS, or __TURBOC__ */
|
||||
#if defined(_AIX)
|
||||
#pragma alloca
|
||||
#else /* not MSDOS, __TURBOC__, or _AIX */
|
||||
#ifdef __hpux
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
void *alloca (unsigned int);
|
||||
};
|
||||
#else /* not __cplusplus */
|
||||
void *alloca ();
|
||||
#endif /* not __cplusplus */
|
||||
#endif /* __hpux */
|
||||
#endif /* not _AIX */
|
||||
#endif /* not MSDOS, or __TURBOC__ */
|
||||
#endif /* not sparc. */
|
||||
#endif /* not GNU C. */
|
||||
#endif /* alloca not defined. */
|
||||
|
||||
/* This is the parser code that is written into each bison parser
|
||||
when the %semantic_parser declaration is not specified in the grammar.
|
||||
It was written by Richard Stallman by simplifying the hairy parser
|
||||
used when %semantic_parser is specified. */
|
||||
|
||||
#ifndef YYSTACK_USE_ALLOCA
|
||||
#ifdef alloca
|
||||
#define YYSTACK_USE_ALLOCA
|
||||
#else /* alloca not defined */
|
||||
#ifdef __GNUC__
|
||||
#define YYSTACK_USE_ALLOCA
|
||||
#define alloca __builtin_alloca
|
||||
#else /* not GNU C. */
|
||||
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
|
||||
#define YYSTACK_USE_ALLOCA
|
||||
#include <alloca.h>
|
||||
#else /* not sparc */
|
||||
/* We think this test detects Watcom and Microsoft C. */
|
||||
/* This used to test MSDOS, but that is a bad idea
|
||||
since that symbol is in the user namespace. */
|
||||
#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
|
||||
#if 0 /* No need for xmalloc.h, which pollutes the namespace;
|
||||
instead, just don't use alloca. */
|
||||
#endif
|
||||
#else /* not MSDOS, or __TURBOC__ */
|
||||
#if defined(_AIX)
|
||||
/* I don't know what this was needed for, but it pollutes the namespace.
|
||||
So I turned it off. rms, 2 May 1997. */
|
||||
#pragma alloca
|
||||
#define YYSTACK_USE_ALLOCA
|
||||
#else /* not MSDOS, or __TURBOC__, or _AIX */
|
||||
#if 0
|
||||
#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
|
||||
and on HPUX 10. Eventually we can turn this on. */
|
||||
#define YYSTACK_USE_ALLOCA
|
||||
#define alloca __builtin_alloca
|
||||
#endif /* __hpux */
|
||||
#endif
|
||||
#endif /* not _AIX */
|
||||
#endif /* not MSDOS, or __TURBOC__ */
|
||||
#endif /* not sparc */
|
||||
#endif /* not GNU C */
|
||||
#endif /* alloca not defined */
|
||||
#endif /* YYSTACK_USE_ALLOCA not defined */
|
||||
|
||||
#ifdef YYSTACK_USE_ALLOCA
|
||||
#define YYSTACK_ALLOC alloca
|
||||
#else
|
||||
#define YYSTACK_ALLOC xmalloc
|
||||
#endif
|
||||
|
||||
/* Note: there must be only one dollar sign in this file.
|
||||
It is replaced by the list of actions, each action
|
||||
as one case of the switch. */
|
||||
@ -497,8 +518,8 @@ void *alloca ();
|
||||
#define yyclearin (yychar = YYEMPTY)
|
||||
#define YYEMPTY -2
|
||||
#define YYEOF 0
|
||||
#define YYACCEPT return(0)
|
||||
#define YYABORT return(1)
|
||||
#define YYACCEPT goto yyacceptlab
|
||||
#define YYABORT goto yyabortlab
|
||||
#define YYERROR goto yyerrlab1
|
||||
/* Like YYERROR except do call yyerror.
|
||||
This remains here temporarily to ease the
|
||||
@ -579,12 +600,12 @@ int yydebug; /* nonzero means print parse trace */
|
||||
#ifndef YYMAXDEPTH
|
||||
#define YYMAXDEPTH 10000
|
||||
#endif
|
||||
|
||||
/* Prevent warning if -Wstrict-prototypes. */
|
||||
#ifdef __GNUC__
|
||||
int yyparse (void);
|
||||
#endif
|
||||
|
||||
/* Define __yy_memcpy. Note that the size argument
|
||||
should be passed with type unsigned int, because that is what the non-GCC
|
||||
definitions require. With GCC, __builtin_memcpy takes an arg
|
||||
of type size_t, but it can handle unsigned int. */
|
||||
|
||||
#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
|
||||
#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
|
||||
#else /* not GNU C or C++ */
|
||||
@ -596,7 +617,7 @@ static void
|
||||
__yy_memcpy (to, from, count)
|
||||
char *to;
|
||||
char *from;
|
||||
int count;
|
||||
unsigned int count;
|
||||
{
|
||||
register char *f = from;
|
||||
register char *t = to;
|
||||
@ -611,10 +632,10 @@ __yy_memcpy (to, from, count)
|
||||
/* This is the most reliable way to avoid incompatibilities
|
||||
in available built-in functions on various systems. */
|
||||
static void
|
||||
__yy_memcpy (char *to, char *from, int count)
|
||||
__yy_memcpy (char *to, char *from, unsigned int count)
|
||||
{
|
||||
register char *f = from;
|
||||
register char *t = to;
|
||||
register char *f = from;
|
||||
register int i = count;
|
||||
|
||||
while (i-- > 0)
|
||||
@ -624,7 +645,7 @@ __yy_memcpy (char *to, char *from, int count)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#line 196 "/stone/jimb/main-98r2/share/bison.simple"
|
||||
#line 216 "/usr/lib/bison.simple"
|
||||
|
||||
/* The user can define YYPARSE_PARAM as the name of an argument to be passed
|
||||
into yyparse. The argument should have type void *.
|
||||
@ -645,6 +666,15 @@ __yy_memcpy (char *to, char *from, int count)
|
||||
#define YYPARSE_PARAM_DECL
|
||||
#endif /* not YYPARSE_PARAM */
|
||||
|
||||
/* Prevent warning if -Wstrict-prototypes. */
|
||||
#ifdef __GNUC__
|
||||
#ifdef YYPARSE_PARAM
|
||||
int yyparse (void *);
|
||||
#else
|
||||
int yyparse (void);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int
|
||||
yyparse(YYPARSE_PARAM_ARG)
|
||||
YYPARSE_PARAM_DECL
|
||||
@ -673,6 +703,7 @@ yyparse(YYPARSE_PARAM_ARG)
|
||||
#endif
|
||||
|
||||
int yystacksize = YYINITDEPTH;
|
||||
int yyfree_stacks = 0;
|
||||
|
||||
#ifdef YYPURE
|
||||
int yychar;
|
||||
@ -757,18 +788,32 @@ yyparse(YYPARSE_PARAM_ARG)
|
||||
if (yystacksize >= YYMAXDEPTH)
|
||||
{
|
||||
yyerror("parser stack overflow");
|
||||
if (yyfree_stacks)
|
||||
{
|
||||
free (yyss);
|
||||
free (yyvs);
|
||||
#ifdef YYLSP_NEEDED
|
||||
free (yyls);
|
||||
#endif
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
yystacksize *= 2;
|
||||
if (yystacksize > YYMAXDEPTH)
|
||||
yystacksize = YYMAXDEPTH;
|
||||
yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
|
||||
__yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp));
|
||||
yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
|
||||
__yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp));
|
||||
#ifndef YYSTACK_USE_ALLOCA
|
||||
yyfree_stacks = 1;
|
||||
#endif
|
||||
yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
|
||||
__yy_memcpy ((char *)yyss, (char *)yyss1,
|
||||
size * (unsigned int) sizeof (*yyssp));
|
||||
yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
|
||||
__yy_memcpy ((char *)yyvs, (char *)yyvs1,
|
||||
size * (unsigned int) sizeof (*yyvsp));
|
||||
#ifdef YYLSP_NEEDED
|
||||
yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
|
||||
__yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp));
|
||||
yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
|
||||
__yy_memcpy ((char *)yyls, (char *)yyls1,
|
||||
size * (unsigned int) sizeof (*yylsp));
|
||||
#endif
|
||||
#endif /* no yyoverflow */
|
||||
|
||||
@ -1336,7 +1381,7 @@ case 82:
|
||||
break;}
|
||||
}
|
||||
/* the action file gets copied in in place of this dollarsign */
|
||||
#line 498 "/stone/jimb/main-98r2/share/bison.simple"
|
||||
#line 542 "/usr/lib/bison.simple"
|
||||
|
||||
yyvsp -= yylen;
|
||||
yyssp -= yylen;
|
||||
@ -1531,6 +1576,30 @@ case 82:
|
||||
|
||||
yystate = yyn;
|
||||
goto yynewstate;
|
||||
|
||||
yyacceptlab:
|
||||
/* YYACCEPT comes here. */
|
||||
if (yyfree_stacks)
|
||||
{
|
||||
free (yyss);
|
||||
free (yyvs);
|
||||
#ifdef YYLSP_NEEDED
|
||||
free (yyls);
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
|
||||
yyabortlab:
|
||||
/* YYABORT comes here. */
|
||||
if (yyfree_stacks)
|
||||
{
|
||||
free (yyss);
|
||||
free (yyvs);
|
||||
#ifdef YYLSP_NEEDED
|
||||
free (yyls);
|
||||
#endif
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
#line 624 "f-exp.y"
|
||||
|
||||
|
@ -1,21 +1,22 @@
|
||||
/* Target-dependent code for the Fujitsu FR30.
|
||||
Copyright 1999, Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
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 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.
|
||||
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. */
|
||||
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. */
|
||||
|
||||
#include "defs.h"
|
||||
#include "frame.h"
|
||||
@ -28,6 +29,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#include "gdbcore.h"
|
||||
#include "symfile.h"
|
||||
|
||||
/* An expression that tells us whether the function invocation represented
|
||||
by FI does not have a frame on the stack associated with it. */
|
||||
int
|
||||
fr30_frameless_function_invocation (fi)
|
||||
struct frame_info *fi;
|
||||
{
|
||||
int frameless;
|
||||
CORE_ADDR func_start, after_prologue;
|
||||
func_start = (get_pc_function_start ((fi)->pc) +
|
||||
FUNCTION_START_OFFSET);
|
||||
after_prologue = func_start;
|
||||
after_prologue = SKIP_PROLOGUE (after_prologue);
|
||||
frameless = (after_prologue == func_start);
|
||||
return frameless;
|
||||
}
|
||||
|
||||
/* Function: pop_frame
|
||||
This routine gets called when either the user uses the `return'
|
||||
command, or the call dummy breakpoint gets hit. */
|
||||
@ -35,32 +52,75 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
void
|
||||
fr30_pop_frame ()
|
||||
{
|
||||
struct frame_info *frame = get_current_frame();
|
||||
struct frame_info *frame = get_current_frame ();
|
||||
int regnum;
|
||||
CORE_ADDR sp = read_register(SP_REGNUM);
|
||||
CORE_ADDR sp = read_register (SP_REGNUM);
|
||||
|
||||
if (PC_IN_CALL_DUMMY(frame->pc, frame->frame, frame->frame))
|
||||
if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
|
||||
generic_pop_dummy_frame ();
|
||||
else
|
||||
{
|
||||
write_register (PC_REGNUM, FRAME_SAVED_PC (frame));
|
||||
|
||||
for (regnum = 0; regnum < NUM_REGS; regnum++)
|
||||
if (frame->fsr.regs[regnum] != 0) {
|
||||
write_register (regnum,
|
||||
read_memory_unsigned_integer (frame->fsr.regs[regnum],
|
||||
REGISTER_RAW_SIZE(regnum)));
|
||||
}
|
||||
if (frame->fsr.regs[regnum] != 0)
|
||||
{
|
||||
write_register (regnum,
|
||||
read_memory_unsigned_integer (frame->fsr.regs[regnum],
|
||||
REGISTER_RAW_SIZE (regnum)));
|
||||
}
|
||||
write_register (SP_REGNUM, sp + frame->framesize);
|
||||
}
|
||||
flush_cached_frames ();
|
||||
}
|
||||
|
||||
|
||||
/* Function: fr30_store_return_value
|
||||
Put a value where a caller expects to see it. Used by the 'return'
|
||||
command. */
|
||||
void
|
||||
fr30_store_return_value (struct type *type,
|
||||
char *valbuf)
|
||||
{
|
||||
/* Here's how the FR30 returns values (gleaned from gcc/config/
|
||||
fr30/fr30.h):
|
||||
|
||||
If the return value is 32 bits long or less, it goes in r4.
|
||||
|
||||
If the return value is 64 bits long or less, it goes in r4 (most
|
||||
significant word) and r5 (least significant word.
|
||||
|
||||
If the function returns a structure, of any size, the caller
|
||||
passes the function an invisible first argument where the callee
|
||||
should store the value. But GDB doesn't let you do that anyway.
|
||||
|
||||
If you're returning a value smaller than a word, it's not really
|
||||
necessary to zero the upper bytes of the register; the caller is
|
||||
supposed to ignore them. However, the FR30 typically keeps its
|
||||
values extended to the full register width, so we should emulate
|
||||
that. */
|
||||
|
||||
/* The FR30 is big-endian, so if we return a small value (like a
|
||||
short or a char), we need to position it correctly within the
|
||||
register. We round the size up to a register boundary, and then
|
||||
adjust the offset so as to place the value at the right end. */
|
||||
int value_size = TYPE_LENGTH (type);
|
||||
int returned_size = (value_size + FR30_REGSIZE - 1) & ~(FR30_REGSIZE - 1);
|
||||
int offset = (REGISTER_BYTE (RETVAL_REG)
|
||||
+ (returned_size - value_size));
|
||||
char *zeros = alloca (returned_size);
|
||||
memset (zeros, 0, returned_size);
|
||||
|
||||
write_register_bytes (REGISTER_BYTE (RETVAL_REG), zeros, returned_size);
|
||||
write_register_bytes (offset, valbuf, value_size);
|
||||
}
|
||||
|
||||
|
||||
/* Function: skip_prologue
|
||||
Return the address of the first code past the prologue of the function. */
|
||||
|
||||
CORE_ADDR
|
||||
fr30_skip_prologue(CORE_ADDR pc)
|
||||
fr30_skip_prologue (CORE_ADDR pc)
|
||||
{
|
||||
CORE_ADDR func_addr, func_end;
|
||||
|
||||
@ -72,8 +132,9 @@ fr30_skip_prologue(CORE_ADDR pc)
|
||||
|
||||
sal = find_pc_line (func_addr, 0);
|
||||
|
||||
if (sal.line != 0 && sal.end < func_end) {
|
||||
return sal.end;
|
||||
if (sal.line != 0 && sal.end < func_end)
|
||||
{
|
||||
return sal.end;
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,96 +156,99 @@ fr30_skip_prologue(CORE_ADDR pc)
|
||||
is passed in as a secret first argument (always in FIRST_ARGREG).
|
||||
|
||||
Stack space for the args has NOT been allocated: that job is up to us.
|
||||
*/
|
||||
*/
|
||||
|
||||
CORE_ADDR
|
||||
fr30_push_arguments(nargs, args, sp, struct_return, struct_addr)
|
||||
int nargs;
|
||||
value_ptr * args;
|
||||
CORE_ADDR sp;
|
||||
int struct_return;
|
||||
CORE_ADDR struct_addr;
|
||||
fr30_push_arguments (nargs, args, sp, struct_return, struct_addr)
|
||||
int nargs;
|
||||
value_ptr *args;
|
||||
CORE_ADDR sp;
|
||||
int struct_return;
|
||||
CORE_ADDR struct_addr;
|
||||
{
|
||||
int argreg;
|
||||
int argnum;
|
||||
int stack_offset;
|
||||
struct stack_arg {
|
||||
struct stack_arg
|
||||
{
|
||||
char *val;
|
||||
int len;
|
||||
int offset;
|
||||
};
|
||||
struct stack_arg *stack_args =
|
||||
(struct stack_arg*)alloca (nargs * sizeof (struct stack_arg));
|
||||
(struct stack_arg *) alloca (nargs * sizeof (struct stack_arg));
|
||||
int nstack_args = 0;
|
||||
|
||||
argreg = FIRST_ARGREG;
|
||||
|
||||
/* the struct_return pointer occupies the first parameter-passing reg */
|
||||
if (struct_return)
|
||||
write_register (argreg++, struct_addr);
|
||||
write_register (argreg++, struct_addr);
|
||||
|
||||
stack_offset = 0;
|
||||
|
||||
/* Process args from left to right. Store as many as allowed in
|
||||
registers, save the rest to be pushed on the stack */
|
||||
for(argnum = 0; argnum < nargs; argnum++)
|
||||
registers, save the rest to be pushed on the stack */
|
||||
for (argnum = 0; argnum < nargs; argnum++)
|
||||
{
|
||||
char * val;
|
||||
value_ptr arg = args[argnum];
|
||||
struct type * arg_type = check_typedef (VALUE_TYPE (arg));
|
||||
struct type * target_type = TYPE_TARGET_TYPE (arg_type);
|
||||
int len = TYPE_LENGTH (arg_type);
|
||||
char *val;
|
||||
value_ptr arg = args[argnum];
|
||||
struct type *arg_type = check_typedef (VALUE_TYPE (arg));
|
||||
struct type *target_type = TYPE_TARGET_TYPE (arg_type);
|
||||
int len = TYPE_LENGTH (arg_type);
|
||||
enum type_code typecode = TYPE_CODE (arg_type);
|
||||
CORE_ADDR regval;
|
||||
CORE_ADDR regval;
|
||||
int newarg;
|
||||
|
||||
val = (char *) VALUE_CONTENTS (arg);
|
||||
|
||||
{
|
||||
/* Copy the argument to general registers or the stack in
|
||||
register-sized pieces. Large arguments are split between
|
||||
registers and stack. */
|
||||
while (len > 0)
|
||||
{
|
||||
if (argreg <= LAST_ARGREG)
|
||||
{
|
||||
int partial_len = len < REGISTER_SIZE ? len : REGISTER_SIZE;
|
||||
regval = extract_address (val, partial_len);
|
||||
|
||||
/* It's a simple argument being passed in a general
|
||||
register. */
|
||||
write_register (argreg, regval);
|
||||
argreg++;
|
||||
len -= partial_len;
|
||||
val += partial_len;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* keep for later pushing */
|
||||
stack_args[nstack_args].val = val;
|
||||
stack_args[nstack_args++].len = len;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* now do the real stack pushing, process args right to left */
|
||||
while(nstack_args--)
|
||||
{
|
||||
sp -= stack_args[nstack_args].len;
|
||||
write_memory(sp, stack_args[nstack_args].val,
|
||||
stack_args[nstack_args].len);
|
||||
/* Copy the argument to general registers or the stack in
|
||||
register-sized pieces. Large arguments are split between
|
||||
registers and stack. */
|
||||
while (len > 0)
|
||||
{
|
||||
if (argreg <= LAST_ARGREG)
|
||||
{
|
||||
int partial_len = len < REGISTER_SIZE ? len : REGISTER_SIZE;
|
||||
regval = extract_address (val, partial_len);
|
||||
|
||||
/* It's a simple argument being passed in a general
|
||||
register. */
|
||||
write_register (argreg, regval);
|
||||
argreg++;
|
||||
len -= partial_len;
|
||||
val += partial_len;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* keep for later pushing */
|
||||
stack_args[nstack_args].val = val;
|
||||
stack_args[nstack_args++].len = len;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* now do the real stack pushing, process args right to left */
|
||||
while (nstack_args--)
|
||||
{
|
||||
sp -= stack_args[nstack_args].len;
|
||||
write_memory (sp, stack_args[nstack_args].val,
|
||||
stack_args[nstack_args].len);
|
||||
}
|
||||
|
||||
/* Return adjusted stack pointer. */
|
||||
return sp;
|
||||
}
|
||||
|
||||
_initialize_fr30_tdep()
|
||||
{
|
||||
extern int print_insn_fr30(bfd_vma, disassemble_info *);
|
||||
void _initialize_fr30_tdep PARAMS ((void));
|
||||
|
||||
tm_print_insn = print_insn_fr30;
|
||||
void
|
||||
_initialize_fr30_tdep ()
|
||||
{
|
||||
extern int print_insn_fr30 (bfd_vma, disassemble_info *);
|
||||
tm_print_insn = print_insn_fr30;
|
||||
}
|
||||
|
||||
/* Function: check_prologue_cache
|
||||
@ -193,23 +257,23 @@ _initialize_fr30_tdep()
|
||||
return non-zero. Otherwise do not copy anything and return zero.
|
||||
|
||||
The information saved in the cache includes:
|
||||
* the frame register number;
|
||||
* the size of the stack frame;
|
||||
* the offsets of saved regs (relative to the old SP); and
|
||||
* the offset from the stack pointer to the frame pointer
|
||||
* the frame register number;
|
||||
* the size of the stack frame;
|
||||
* the offsets of saved regs (relative to the old SP); and
|
||||
* the offset from the stack pointer to the frame pointer
|
||||
|
||||
The cache contains only one entry, since this is adequate
|
||||
for the typical sequence of prologue scan requests we get.
|
||||
When performing a backtrace, GDB will usually ask to scan
|
||||
the same function twice in a row (once to get the frame chain,
|
||||
and once to fill in the extra frame information).
|
||||
*/
|
||||
*/
|
||||
|
||||
static struct frame_info prologue_cache;
|
||||
|
||||
static int
|
||||
check_prologue_cache (fi)
|
||||
struct frame_info * fi;
|
||||
struct frame_info *fi;
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -229,22 +293,23 @@ check_prologue_cache (fi)
|
||||
|
||||
/* Function: save_prologue_cache
|
||||
Copy the prologue information from fi to the prologue cache.
|
||||
*/
|
||||
*/
|
||||
|
||||
static void
|
||||
save_prologue_cache (fi)
|
||||
struct frame_info * fi;
|
||||
struct frame_info *fi;
|
||||
{
|
||||
int i;
|
||||
|
||||
prologue_cache.pc = fi->pc;
|
||||
prologue_cache.framereg = fi->framereg;
|
||||
prologue_cache.framesize = fi->framesize;
|
||||
prologue_cache.pc = fi->pc;
|
||||
prologue_cache.framereg = fi->framereg;
|
||||
prologue_cache.framesize = fi->framesize;
|
||||
prologue_cache.frameoffset = fi->frameoffset;
|
||||
|
||||
for (i = 0; i <= NUM_REGS; i++) {
|
||||
prologue_cache.fsr.regs[i] = fi->fsr.regs[i];
|
||||
}
|
||||
|
||||
for (i = 0; i <= NUM_REGS; i++)
|
||||
{
|
||||
prologue_cache.fsr.regs[i] = fi->fsr.regs[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -259,7 +324,7 @@ save_prologue_cache (fi)
|
||||
|
||||
static void
|
||||
fr30_scan_prologue (fi)
|
||||
struct frame_info * fi;
|
||||
struct frame_info *fi;
|
||||
{
|
||||
int sp_offset, fp_offset;
|
||||
CORE_ADDR prologue_start, prologue_end, current_pc;
|
||||
@ -269,8 +334,8 @@ fr30_scan_prologue (fi)
|
||||
return;
|
||||
|
||||
/* Assume there is no frame until proven otherwise. */
|
||||
fi->framereg = SP_REGNUM;
|
||||
fi->framesize = 0;
|
||||
fi->framereg = SP_REGNUM;
|
||||
fi->framesize = 0;
|
||||
fi->frameoffset = 0;
|
||||
|
||||
/* Find the function prologue. If we can't find the function in
|
||||
@ -281,10 +346,10 @@ fr30_scan_prologue (fi)
|
||||
in the function and the first source line. */
|
||||
struct symtab_and_line sal = find_pc_line (prologue_start, 0);
|
||||
|
||||
if (sal.line == 0) /* no line info, use current PC */
|
||||
if (sal.line == 0) /* no line info, use current PC */
|
||||
prologue_end = fi->pc;
|
||||
else if (sal.end < prologue_end) /* next line begins after fn end */
|
||||
prologue_end = sal.end; /* (probably means no prologue) */
|
||||
prologue_end = sal.end; /* (probably means no prologue) */
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -303,14 +368,14 @@ fr30_scan_prologue (fi)
|
||||
|
||||
insn = read_memory_unsigned_integer (current_pc, 2);
|
||||
|
||||
if ((insn & 0xfe00) == 0x8e00) /* stm0 or stm1 */
|
||||
if ((insn & 0xfe00) == 0x8e00) /* stm0 or stm1 */
|
||||
{
|
||||
int reg, mask = insn & 0xff;
|
||||
|
||||
/* scan in one sweep - create virtual 16-bit mask from either insn's mask */
|
||||
if((insn & 0x0100) == 0)
|
||||
if ((insn & 0x0100) == 0)
|
||||
{
|
||||
mask <<= 8; /* stm0 - move to upper byte in virtual mask */
|
||||
mask <<= 8; /* stm0 - move to upper byte in virtual mask */
|
||||
}
|
||||
|
||||
/* Calculate offsets of saved registers (to be turned later into addresses). */
|
||||
@ -321,53 +386,53 @@ fr30_scan_prologue (fi)
|
||||
fi->fsr.regs[reg] = sp_offset;
|
||||
}
|
||||
}
|
||||
else if((insn & 0xfff0) == 0x1700) /* st rx,@-r15 */
|
||||
{
|
||||
else if ((insn & 0xfff0) == 0x1700) /* st rx,@-r15 */
|
||||
{
|
||||
int reg = insn & 0xf;
|
||||
|
||||
sp_offset -= 4;
|
||||
fi->fsr.regs[reg] = sp_offset;
|
||||
}
|
||||
else if((insn & 0xff00) == 0x0f00) /* enter */
|
||||
{
|
||||
else if ((insn & 0xff00) == 0x0f00) /* enter */
|
||||
{
|
||||
fp_offset = fi->fsr.regs[FP_REGNUM] = sp_offset - 4;
|
||||
sp_offset -= 4 * (insn & 0xff);
|
||||
fi->framereg = FP_REGNUM;
|
||||
}
|
||||
else if(insn == 0x1781) /* st rp,@-sp */
|
||||
else if (insn == 0x1781) /* st rp,@-sp */
|
||||
{
|
||||
sp_offset -= 4;
|
||||
fi->fsr.regs[RP_REGNUM] = sp_offset;
|
||||
sp_offset -= 4;
|
||||
fi->fsr.regs[RP_REGNUM] = sp_offset;
|
||||
}
|
||||
else if(insn == 0x170e) /* st fp,@-sp */
|
||||
else if (insn == 0x170e) /* st fp,@-sp */
|
||||
{
|
||||
sp_offset -= 4;
|
||||
fi->fsr.regs[FP_REGNUM] = sp_offset;
|
||||
sp_offset -= 4;
|
||||
fi->fsr.regs[FP_REGNUM] = sp_offset;
|
||||
}
|
||||
else if(insn == 0x8bfe) /* mov sp,fp */
|
||||
else if (insn == 0x8bfe) /* mov sp,fp */
|
||||
{
|
||||
fi->framereg = FP_REGNUM;
|
||||
}
|
||||
else if((insn & 0xff00) == 0xa300) /* addsp xx */
|
||||
else if ((insn & 0xff00) == 0xa300) /* addsp xx */
|
||||
{
|
||||
sp_offset += 4 * (signed char)(insn & 0xff);
|
||||
sp_offset += 4 * (signed char) (insn & 0xff);
|
||||
}
|
||||
else if((insn & 0xff0f) == 0x9b00 && /* ldi:20 xx,r0 */
|
||||
read_memory_unsigned_integer(current_pc+4, 2)
|
||||
== 0xac0f) /* sub r0,sp */
|
||||
else if ((insn & 0xff0f) == 0x9b00 && /* ldi:20 xx,r0 */
|
||||
read_memory_unsigned_integer (current_pc + 4, 2)
|
||||
== 0xac0f) /* sub r0,sp */
|
||||
{
|
||||
/* large stack adjustment */
|
||||
sp_offset -= (((insn & 0xf0) << 12) | read_memory_unsigned_integer(current_pc+2, 2));
|
||||
sp_offset -= (((insn & 0xf0) << 12) | read_memory_unsigned_integer (current_pc + 2, 2));
|
||||
current_pc += 4;
|
||||
}
|
||||
else if(insn == 0x9f80 && /* ldi:32 xx,r0 */
|
||||
read_memory_unsigned_integer(current_pc+6, 2)
|
||||
== 0xac0f) /* sub r0,sp */
|
||||
else if (insn == 0x9f80 && /* ldi:32 xx,r0 */
|
||||
read_memory_unsigned_integer (current_pc + 6, 2)
|
||||
== 0xac0f) /* sub r0,sp */
|
||||
{
|
||||
/* large stack adjustment */
|
||||
sp_offset -=
|
||||
(read_memory_unsigned_integer(current_pc+2, 2) << 16 |
|
||||
read_memory_unsigned_integer(current_pc+4, 2));
|
||||
(read_memory_unsigned_integer (current_pc + 2, 2) << 16 |
|
||||
read_memory_unsigned_integer (current_pc + 4, 2));
|
||||
current_pc += 6;
|
||||
}
|
||||
}
|
||||
@ -377,7 +442,7 @@ fr30_scan_prologue (fi)
|
||||
[new FP] - [new SP]. */
|
||||
fi->framesize = -sp_offset;
|
||||
fi->frameoffset = fp_offset - sp_offset;
|
||||
|
||||
|
||||
save_prologue_cache (fi);
|
||||
}
|
||||
|
||||
@ -396,7 +461,7 @@ fr30_scan_prologue (fi)
|
||||
|
||||
void
|
||||
fr30_init_extra_frame_info (fi)
|
||||
struct frame_info * fi;
|
||||
struct frame_info *fi;
|
||||
{
|
||||
int reg;
|
||||
|
||||
@ -408,28 +473,29 @@ fr30_init_extra_frame_info (fi)
|
||||
if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
|
||||
{
|
||||
/* We need to setup fi->frame here because run_stack_dummy gets it wrong
|
||||
by assuming it's always FP. */
|
||||
fi->frame = generic_read_register_dummy (fi->pc, fi->frame, SP_REGNUM);
|
||||
fi->framesize = 0;
|
||||
by assuming it's always FP. */
|
||||
fi->frame = generic_read_register_dummy (fi->pc, fi->frame, SP_REGNUM);
|
||||
fi->framesize = 0;
|
||||
fi->frameoffset = 0;
|
||||
return;
|
||||
}
|
||||
fr30_scan_prologue (fi);
|
||||
fr30_scan_prologue (fi);
|
||||
|
||||
if (!fi->next) /* this is the innermost frame? */
|
||||
fi->frame = read_register (fi->framereg);
|
||||
else /* not the innermost frame */
|
||||
/* If we have an FP, the callee saved it. */
|
||||
if (fi->framereg == FP_REGNUM)
|
||||
if (fi->next->fsr.regs[fi->framereg] != 0)
|
||||
fi->frame = read_memory_integer (fi->next->fsr.regs[fi->framereg],
|
||||
4);
|
||||
/* Calculate actual addresses of saved registers using offsets determined
|
||||
by fr30_scan_prologue. */
|
||||
for (reg = 0; reg < NUM_REGS; reg++)
|
||||
if (fi->fsr.regs[reg] != 0) {
|
||||
fi->fsr.regs[reg] += fi->frame + fi->framesize - fi->frameoffset;
|
||||
}
|
||||
if (!fi->next) /* this is the innermost frame? */
|
||||
fi->frame = read_register (fi->framereg);
|
||||
else
|
||||
/* not the innermost frame */
|
||||
/* If we have an FP, the callee saved it. */ if (fi->framereg == FP_REGNUM)
|
||||
if (fi->next->fsr.regs[fi->framereg] != 0)
|
||||
fi->frame = read_memory_integer (fi->next->fsr.regs[fi->framereg],
|
||||
4);
|
||||
/* Calculate actual addresses of saved registers using offsets determined
|
||||
by fr30_scan_prologue. */
|
||||
for (reg = 0; reg < NUM_REGS; reg++)
|
||||
if (fi->fsr.regs[reg] != 0)
|
||||
{
|
||||
fi->fsr.regs[reg] += fi->frame + fi->framesize - fi->frameoffset;
|
||||
}
|
||||
}
|
||||
|
||||
/* Function: find_callers_reg
|
||||
@ -449,8 +515,8 @@ fr30_find_callers_reg (fi, regnum)
|
||||
if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
|
||||
return generic_read_register_dummy (fi->pc, fi->frame, regnum);
|
||||
else if (fi->fsr.regs[regnum] != 0)
|
||||
return read_memory_unsigned_integer (fi->fsr.regs[regnum],
|
||||
REGISTER_RAW_SIZE(regnum));
|
||||
return read_memory_unsigned_integer (fi->fsr.regs[regnum],
|
||||
REGISTER_RAW_SIZE (regnum));
|
||||
|
||||
return read_register (regnum);
|
||||
}
|
||||
@ -466,7 +532,7 @@ fr30_find_callers_reg (fi, regnum)
|
||||
|
||||
CORE_ADDR
|
||||
fr30_frame_chain (fi)
|
||||
struct frame_info * fi;
|
||||
struct frame_info *fi;
|
||||
{
|
||||
CORE_ADDR fn_start, callers_pc, fp;
|
||||
struct frame_info caller_fi;
|
||||
@ -474,17 +540,17 @@ fr30_frame_chain (fi)
|
||||
|
||||
/* is this a dummy frame? */
|
||||
if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
|
||||
return fi->frame; /* dummy frame same as caller's frame */
|
||||
return fi->frame; /* dummy frame same as caller's frame */
|
||||
|
||||
/* is caller-of-this a dummy frame? */
|
||||
callers_pc = FRAME_SAVED_PC(fi); /* find out who called us: */
|
||||
callers_pc = FRAME_SAVED_PC (fi); /* find out who called us: */
|
||||
fp = fr30_find_callers_reg (fi, FP_REGNUM);
|
||||
if (PC_IN_CALL_DUMMY (callers_pc, fp, fp))
|
||||
return fp; /* dummy frame's frame may bear no relation to ours */
|
||||
if (PC_IN_CALL_DUMMY (callers_pc, fp, fp))
|
||||
return fp; /* dummy frame's frame may bear no relation to ours */
|
||||
|
||||
if (find_pc_partial_function (fi->pc, 0, &fn_start, 0))
|
||||
if (fn_start == entry_point_address ())
|
||||
return 0; /* in _start fn, don't chain further */
|
||||
return 0; /* in _start fn, don't chain further */
|
||||
|
||||
framereg = fi->framereg;
|
||||
|
||||
@ -493,9 +559,9 @@ fr30_frame_chain (fi)
|
||||
if (fn_start == entry_point_address ())
|
||||
return 0;
|
||||
|
||||
memset (& caller_fi, 0, sizeof (caller_fi));
|
||||
memset (&caller_fi, 0, sizeof (caller_fi));
|
||||
caller_fi.pc = callers_pc;
|
||||
fr30_scan_prologue (& caller_fi);
|
||||
fr30_scan_prologue (&caller_fi);
|
||||
framereg = caller_fi.framereg;
|
||||
|
||||
/* If the caller used a frame register, return its value.
|
||||
@ -517,8 +583,8 @@ CORE_ADDR
|
||||
fr30_frame_saved_pc (fi)
|
||||
struct frame_info *fi;
|
||||
{
|
||||
if (PC_IN_CALL_DUMMY(fi->pc, fi->frame, fi->frame))
|
||||
return generic_read_register_dummy(fi->pc, fi->frame, PC_REGNUM);
|
||||
if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
|
||||
return generic_read_register_dummy (fi->pc, fi->frame, PC_REGNUM);
|
||||
else
|
||||
return fr30_find_callers_reg (fi, RP_REGNUM);
|
||||
}
|
||||
@ -526,9 +592,9 @@ fr30_frame_saved_pc (fi)
|
||||
/* Function: fix_call_dummy
|
||||
Pokes the callee function's address into the CALL_DUMMY assembly stub.
|
||||
Assumes that the CALL_DUMMY looks like this:
|
||||
jarl <offset24>, r31
|
||||
trap
|
||||
*/
|
||||
jarl <offset24>, r31
|
||||
trap
|
||||
*/
|
||||
|
||||
int
|
||||
fr30_fix_call_dummy (dummy, sp, fun, nargs, args, type, gcc_p)
|
||||
@ -546,7 +612,7 @@ fr30_fix_call_dummy (dummy, sp, fun, nargs, args, type, gcc_p)
|
||||
offset24 &= 0x3fffff;
|
||||
offset24 |= 0xff800000; /* jarl <offset24>, r31 */
|
||||
|
||||
store_unsigned_integer ((unsigned int *)&dummy[2], 2, offset24 & 0xffff);
|
||||
store_unsigned_integer ((unsigned int *)&dummy[0], 2, offset24 >> 16);
|
||||
store_unsigned_integer ((unsigned int *) &dummy[2], 2, offset24 & 0xffff);
|
||||
store_unsigned_integer ((unsigned int *) &dummy[0], 2, offset24 >> 16);
|
||||
return 0;
|
||||
}
|
||||
|
@ -43,7 +43,6 @@
|
||||
* It should use the same privilege level it runs at. It should
|
||||
* install it as an interrupt gate so that interrupts are masked
|
||||
* while the handler runs.
|
||||
* Also, need to assign exceptionHook and oldExceptionHook.
|
||||
*
|
||||
* Because gdb will sometimes write to the stack area to execute function
|
||||
* calls, this program cannot rely on using the supervisor stack so it
|
||||
@ -97,14 +96,10 @@
|
||||
*
|
||||
* external low-level support routines
|
||||
*/
|
||||
typedef void (*ExceptionHook)(int); /* pointer to function with int parm */
|
||||
typedef void (*Function)(); /* pointer to a function */
|
||||
|
||||
extern void putDebugChar(); /* write a single character */
|
||||
extern int getDebugChar(); /* read and return a single char */
|
||||
|
||||
extern Function exceptionHandler(); /* assign an exception handler */
|
||||
extern ExceptionHook exceptionHook; /* hook variable for errors/exceptions */
|
||||
extern void exceptionHandler(); /* assign an exception handler */
|
||||
|
||||
/************************************************************************/
|
||||
/* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/
|
||||
@ -116,8 +111,6 @@ static char initialized; /* boolean flag. != 0 means we've been initialized */
|
||||
int remote_debug;
|
||||
/* debug > 0 prints ill-formed commands in valid packets & checksum errors */
|
||||
|
||||
void waitabit();
|
||||
|
||||
static const char hexchars[]="0123456789abcdef";
|
||||
|
||||
/* Number of registers. */
|
||||
@ -140,14 +133,6 @@ int registers[NUMREGS];
|
||||
int remcomStack[STACKSIZE/sizeof(int)];
|
||||
static int* stackPtr = &remcomStack[STACKSIZE/sizeof(int) - 1];
|
||||
|
||||
/*
|
||||
* In many cases, the system will want to continue exception processing
|
||||
* when a continue command is given.
|
||||
* oldExceptionHook is a function to invoke in this case.
|
||||
*/
|
||||
|
||||
static ExceptionHook oldExceptionHook;
|
||||
|
||||
/*************************** ASSEMBLY CODE MACROS *************************/
|
||||
/* */
|
||||
|
||||
@ -458,65 +443,85 @@ char ch;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
static char remcomInBuffer[BUFMAX];
|
||||
static char remcomOutBuffer[BUFMAX];
|
||||
|
||||
/* scan for the sequence $<data>#<checksum> */
|
||||
void getpacket(buffer)
|
||||
char * buffer;
|
||||
|
||||
unsigned char *
|
||||
getpacket ()
|
||||
{
|
||||
unsigned char *buffer = &remcomInBuffer[0];
|
||||
unsigned char checksum;
|
||||
unsigned char xmitcsum;
|
||||
int i;
|
||||
int count;
|
||||
int count;
|
||||
char ch;
|
||||
|
||||
do {
|
||||
/* wait around for the start character, ignore all other characters */
|
||||
while ((ch = (getDebugChar() & 0x7f)) != '$');
|
||||
checksum = 0;
|
||||
xmitcsum = -1;
|
||||
while (1)
|
||||
{
|
||||
/* wait around for the start character, ignore all other characters */
|
||||
while ((ch = getDebugChar ()) != '$')
|
||||
;
|
||||
|
||||
count = 0;
|
||||
retry:
|
||||
checksum = 0;
|
||||
xmitcsum = -1;
|
||||
count = 0;
|
||||
|
||||
/* now, read until a # or end of buffer is found */
|
||||
while (count < BUFMAX) {
|
||||
ch = getDebugChar() & 0x7f;
|
||||
if (ch == '#') break;
|
||||
checksum = checksum + ch;
|
||||
buffer[count] = ch;
|
||||
count = count + 1;
|
||||
}
|
||||
buffer[count] = 0;
|
||||
/* now, read until a # or end of buffer is found */
|
||||
while (count < BUFMAX)
|
||||
{
|
||||
ch = getDebugChar ();
|
||||
if (ch == '$')
|
||||
goto retry;
|
||||
if (ch == '#')
|
||||
break;
|
||||
checksum = checksum + ch;
|
||||
buffer[count] = ch;
|
||||
count = count + 1;
|
||||
}
|
||||
buffer[count] = 0;
|
||||
|
||||
if (ch == '#') {
|
||||
xmitcsum = hex(getDebugChar() & 0x7f) << 4;
|
||||
xmitcsum += hex(getDebugChar() & 0x7f);
|
||||
if ((remote_debug ) && (checksum != xmitcsum)) {
|
||||
fprintf (stderr ,"bad checksum. My count = 0x%x, sent=0x%x. buf=%s\n",
|
||||
checksum,xmitcsum,buffer);
|
||||
}
|
||||
if (ch == '#')
|
||||
{
|
||||
ch = getDebugChar ();
|
||||
xmitcsum = hex (ch) << 4;
|
||||
ch = getDebugChar ();
|
||||
xmitcsum += hex (ch);
|
||||
|
||||
if (checksum != xmitcsum) putDebugChar('-'); /* failed checksum */
|
||||
else {
|
||||
putDebugChar('+'); /* successful transfer */
|
||||
/* if a sequence char is present, reply the sequence ID */
|
||||
if (buffer[2] == ':') {
|
||||
putDebugChar( buffer[0] );
|
||||
putDebugChar( buffer[1] );
|
||||
/* remove sequence chars from buffer */
|
||||
count = strlen(buffer);
|
||||
for (i=3; i <= count; i++) buffer[i-3] = buffer[i];
|
||||
}
|
||||
}
|
||||
if (checksum != xmitcsum)
|
||||
{
|
||||
if (remote_debug)
|
||||
{
|
||||
fprintf (stderr,
|
||||
"bad checksum. My count = 0x%x, sent=0x%x. buf=%s\n",
|
||||
checksum, xmitcsum, buffer);
|
||||
}
|
||||
putDebugChar ('-'); /* failed checksum */
|
||||
}
|
||||
else
|
||||
{
|
||||
putDebugChar ('+'); /* successful transfer */
|
||||
|
||||
/* if a sequence char is present, reply the sequence ID */
|
||||
if (buffer[2] == ':')
|
||||
{
|
||||
putDebugChar (buffer[0]);
|
||||
putDebugChar (buffer[1]);
|
||||
|
||||
return &buffer[3];
|
||||
}
|
||||
|
||||
return &buffer[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (checksum != xmitcsum);
|
||||
|
||||
}
|
||||
|
||||
/* send the packet in buffer. */
|
||||
|
||||
|
||||
void putpacket(buffer)
|
||||
char * buffer;
|
||||
unsigned char *buffer;
|
||||
{
|
||||
unsigned char checksum;
|
||||
int count;
|
||||
@ -538,15 +543,10 @@ char * buffer;
|
||||
putDebugChar(hexchars[checksum >> 4]);
|
||||
putDebugChar(hexchars[checksum % 16]);
|
||||
|
||||
} while ((getDebugChar() & 0x7f) != '+');
|
||||
} while (getDebugChar() != '+');
|
||||
|
||||
}
|
||||
|
||||
char remcomInBuffer[BUFMAX];
|
||||
char remcomOutBuffer[BUFMAX];
|
||||
static short error;
|
||||
|
||||
|
||||
void debug_error(format, parm)
|
||||
char * format;
|
||||
char * parm;
|
||||
@ -700,7 +700,7 @@ int hexToInt(char **ptr, int *intValue)
|
||||
*/
|
||||
void handle_exception(int exceptionVector)
|
||||
{
|
||||
int sigval;
|
||||
int sigval, stepping;
|
||||
int addr, length;
|
||||
char * ptr;
|
||||
int newPC;
|
||||
@ -721,11 +721,13 @@ void handle_exception(int exceptionVector)
|
||||
|
||||
putpacket(remcomOutBuffer);
|
||||
|
||||
stepping = 0;
|
||||
|
||||
while (1==1) {
|
||||
error = 0;
|
||||
remcomOutBuffer[0] = 0;
|
||||
getpacket(remcomInBuffer);
|
||||
switch (remcomInBuffer[0]) {
|
||||
ptr = getpacket();
|
||||
|
||||
switch (*ptr++) {
|
||||
case '?' : remcomOutBuffer[0] = 'S';
|
||||
remcomOutBuffer[1] = hexchars[sigval >> 4];
|
||||
remcomOutBuffer[2] = hexchars[sigval % 16];
|
||||
@ -737,14 +739,13 @@ void handle_exception(int exceptionVector)
|
||||
mem2hex((char*) registers, remcomOutBuffer, NUMREGBYTES, 0);
|
||||
break;
|
||||
case 'G' : /* set the value of the CPU registers - return OK */
|
||||
hex2mem(&remcomInBuffer[1], (char*) registers, NUMREGBYTES, 0);
|
||||
hex2mem(ptr, (char*) registers, NUMREGBYTES, 0);
|
||||
strcpy(remcomOutBuffer,"OK");
|
||||
break;
|
||||
case 'P' : /* set the value of a single CPU register - return OK */
|
||||
{
|
||||
int regno;
|
||||
|
||||
ptr = &remcomInBuffer[1];
|
||||
if (hexToInt (&ptr, ®no) && *ptr++ == '=')
|
||||
if (regno >= 0 && regno < NUMREGS)
|
||||
{
|
||||
@ -760,7 +761,6 @@ void handle_exception(int exceptionVector)
|
||||
/* mAA..AA,LLLL Read LLLL bytes at address AA..AA */
|
||||
case 'm' :
|
||||
/* TRY TO READ %x,%x. IF SUCCEED, SET PTR = 0 */
|
||||
ptr = &remcomInBuffer[1];
|
||||
if (hexToInt(&ptr,&addr))
|
||||
if (*(ptr++) == ',')
|
||||
if (hexToInt(&ptr,&length))
|
||||
@ -777,14 +777,12 @@ void handle_exception(int exceptionVector)
|
||||
if (ptr)
|
||||
{
|
||||
strcpy(remcomOutBuffer,"E01");
|
||||
debug_error("malformed read memory command: %s",remcomInBuffer);
|
||||
}
|
||||
break;
|
||||
|
||||
/* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */
|
||||
case 'M' :
|
||||
/* TRY TO READ '%x,%x:'. IF SUCCEED, SET PTR = 0 */
|
||||
ptr = &remcomInBuffer[1];
|
||||
if (hexToInt(&ptr,&addr))
|
||||
if (*(ptr++) == ',')
|
||||
if (hexToInt(&ptr,&length))
|
||||
@ -805,16 +803,15 @@ void handle_exception(int exceptionVector)
|
||||
if (ptr)
|
||||
{
|
||||
strcpy(remcomOutBuffer,"E02");
|
||||
debug_error("malformed write memory command: %s",remcomInBuffer);
|
||||
}
|
||||
break;
|
||||
|
||||
/* cAA..AA Continue at address AA..AA(optional) */
|
||||
/* sAA..AA Step one instruction from AA..AA(optional) */
|
||||
case 'c' :
|
||||
case 's' :
|
||||
stepping = 1;
|
||||
case 'c' :
|
||||
/* try to read optional parameter, pc unchanged if no parm */
|
||||
ptr = &remcomInBuffer[1];
|
||||
if (hexToInt(&ptr,&addr))
|
||||
registers[ PC ] = addr;
|
||||
|
||||
@ -824,27 +821,9 @@ void handle_exception(int exceptionVector)
|
||||
registers[ PS ] &= 0xfffffeff;
|
||||
|
||||
/* set the trace bit if we're stepping */
|
||||
if (remcomInBuffer[0] == 's') registers[ PS ] |= 0x100;
|
||||
|
||||
/*
|
||||
* If we found a match for the PC AND we are not returning
|
||||
* as a result of a breakpoint (33),
|
||||
* trace exception (9), nmi (31), jmp to
|
||||
* the old exception handler as if this code never ran.
|
||||
*/
|
||||
#if 0
|
||||
/* Don't really think we need this, except maybe for protection
|
||||
exceptions. */
|
||||
/*
|
||||
* invoke the previous handler.
|
||||
*/
|
||||
if (oldExceptionHook)
|
||||
(*oldExceptionHook) (frame->exceptionVector);
|
||||
newPC = registers[ PC ]; /* pc may have changed */
|
||||
#endif /* 0 */
|
||||
if (stepping) registers[ PS ] |= 0x100;
|
||||
|
||||
_returnFromException(); /* this is a jump */
|
||||
|
||||
break;
|
||||
|
||||
/* kill the program */
|
||||
@ -887,18 +866,7 @@ int exception;
|
||||
exceptionHandler (14, _catchException14);
|
||||
exceptionHandler (16, _catchException16);
|
||||
|
||||
if (exceptionHook != remcomHandler)
|
||||
{
|
||||
oldExceptionHook = exceptionHook;
|
||||
exceptionHook = remcomHandler;
|
||||
}
|
||||
|
||||
/* In case GDB is started before us, ack any packets (presumably
|
||||
"$?#xx") sitting there. */
|
||||
putDebugChar ('+');
|
||||
|
||||
initialized = 1;
|
||||
|
||||
}
|
||||
|
||||
/* This function will generate a breakpoint exception. It is used at the
|
||||
@ -909,19 +877,5 @@ int exception;
|
||||
void breakpoint()
|
||||
{
|
||||
if (initialized)
|
||||
#if 0
|
||||
handle_exception(3);
|
||||
#else
|
||||
BREAKPOINT();
|
||||
#endif
|
||||
waitabit();
|
||||
}
|
||||
|
||||
int waitlimit = 1000000;
|
||||
|
||||
void
|
||||
waitabit()
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < waitlimit; i++) ;
|
||||
}
|
||||
|
@ -1,27 +1,30 @@
|
||||
/* Main loop for the standalone kernel debugger, for GDB, the GNU Debugger.
|
||||
Copyright 1989, 1991, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
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 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.
|
||||
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. */
|
||||
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. */
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
static char *args[] = {"kdb", "kdb-symbols", 0};
|
||||
static char *args[] =
|
||||
{"kdb", "kdb-symbols", 0};
|
||||
|
||||
static char *environment[] = {0};
|
||||
static char *environment[] =
|
||||
{0};
|
||||
|
||||
char **environ;
|
||||
|
||||
|
@ -1,56 +1,56 @@
|
||||
|
||||
/* A Bison parser, made from m2-exp.y
|
||||
by GNU Bison version 1.25
|
||||
by GNU Bison version 1.27
|
||||
*/
|
||||
|
||||
#define YYBISON 1 /* Identify Bison output. */
|
||||
|
||||
#define INT 258
|
||||
#define HEX 259
|
||||
#define ERROR 260
|
||||
#define UINT 261
|
||||
#define M2_TRUE 262
|
||||
#define M2_FALSE 263
|
||||
#define CHAR 264
|
||||
#define FLOAT 265
|
||||
#define STRING 266
|
||||
#define NAME 267
|
||||
#define BLOCKNAME 268
|
||||
#define IDENT 269
|
||||
#define VARNAME 270
|
||||
#define TYPENAME 271
|
||||
#define SIZE 272
|
||||
#define CAP 273
|
||||
#define ORD 274
|
||||
#define HIGH 275
|
||||
#define ABS 276
|
||||
#define MIN_FUNC 277
|
||||
#define MAX_FUNC 278
|
||||
#define FLOAT_FUNC 279
|
||||
#define VAL 280
|
||||
#define CHR 281
|
||||
#define ODD 282
|
||||
#define TRUNC 283
|
||||
#define INC 284
|
||||
#define DEC 285
|
||||
#define INCL 286
|
||||
#define EXCL 287
|
||||
#define COLONCOLON 288
|
||||
#define INTERNAL_VAR 289
|
||||
#define ABOVE_COMMA 290
|
||||
#define ASSIGN 291
|
||||
#define LEQ 292
|
||||
#define GEQ 293
|
||||
#define NOTEQUAL 294
|
||||
#define IN 295
|
||||
#define OROR 296
|
||||
#define LOGICAL_AND 297
|
||||
#define DIV 298
|
||||
#define MOD 299
|
||||
#define UNARY 300
|
||||
#define DOT 301
|
||||
#define NOT 302
|
||||
#define QID 303
|
||||
#define INT 257
|
||||
#define HEX 258
|
||||
#define ERROR 259
|
||||
#define UINT 260
|
||||
#define M2_TRUE 261
|
||||
#define M2_FALSE 262
|
||||
#define CHAR 263
|
||||
#define FLOAT 264
|
||||
#define STRING 265
|
||||
#define NAME 266
|
||||
#define BLOCKNAME 267
|
||||
#define IDENT 268
|
||||
#define VARNAME 269
|
||||
#define TYPENAME 270
|
||||
#define SIZE 271
|
||||
#define CAP 272
|
||||
#define ORD 273
|
||||
#define HIGH 274
|
||||
#define ABS 275
|
||||
#define MIN_FUNC 276
|
||||
#define MAX_FUNC 277
|
||||
#define FLOAT_FUNC 278
|
||||
#define VAL 279
|
||||
#define CHR 280
|
||||
#define ODD 281
|
||||
#define TRUNC 282
|
||||
#define INC 283
|
||||
#define DEC 284
|
||||
#define INCL 285
|
||||
#define EXCL 286
|
||||
#define COLONCOLON 287
|
||||
#define INTERNAL_VAR 288
|
||||
#define ABOVE_COMMA 289
|
||||
#define ASSIGN 290
|
||||
#define LEQ 291
|
||||
#define GEQ 292
|
||||
#define NOTEQUAL 293
|
||||
#define IN 294
|
||||
#define OROR 295
|
||||
#define LOGICAL_AND 296
|
||||
#define DIV 297
|
||||
#define MOD 298
|
||||
#define UNARY 299
|
||||
#define DOT 300
|
||||
#define NOT 301
|
||||
#define QID 302
|
||||
|
||||
#line 40 "m2-exp.y"
|
||||
|
||||
@ -174,7 +174,7 @@ typedef union
|
||||
#define YYFLAG -32768
|
||||
#define YYNTBASE 68
|
||||
|
||||
#define YYTRANSLATE(x) ((unsigned)(x) <= 303 ? yytranslate[x] : 82)
|
||||
#define YYTRANSLATE(x) ((unsigned)(x) <= 302 ? yytranslate[x] : 82)
|
||||
|
||||
static const char yytranslate[] = { 0,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
@ -202,12 +202,12 @@ static const char yytranslate[] = { 0,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
|
||||
6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
||||
16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
|
||||
26, 27, 28, 29, 30, 31, 32, 33, 34, 36,
|
||||
37, 40, 41, 43, 45, 46, 47, 54, 55, 56,
|
||||
58, 61, 63
|
||||
2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
|
||||
7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
|
||||
17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
|
||||
27, 28, 29, 30, 31, 32, 33, 34, 36, 37,
|
||||
40, 41, 43, 45, 46, 47, 54, 55, 56, 58,
|
||||
61, 63
|
||||
};
|
||||
|
||||
#if YYDEBUG != 0
|
||||
@ -540,7 +540,8 @@ static const short yycheck[] = { 0,
|
||||
55, -1, 57, 58, 59, 60
|
||||
};
|
||||
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
|
||||
#line 3 "/stone/jimb/main-98r2/share/bison.simple"
|
||||
#line 3 "/usr/lib/bison.simple"
|
||||
/* This file comes from bison-1.27. */
|
||||
|
||||
/* Skeleton output parser for bison,
|
||||
Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
|
||||
@ -557,45 +558,65 @@ static const short yycheck[] = { 0,
|
||||
|
||||
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. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* As a special exception, when this file is copied by Bison into a
|
||||
Bison output file, you may use that output file without restriction.
|
||||
This special exception was added by the Free Software Foundation
|
||||
in version 1.24 of Bison. */
|
||||
|
||||
#ifndef alloca
|
||||
#ifdef __GNUC__
|
||||
#define alloca __builtin_alloca
|
||||
#else /* not GNU C. */
|
||||
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
|
||||
#include <alloca.h>
|
||||
#else /* not sparc */
|
||||
#if defined (MSDOS) && !defined (__TURBOC__)
|
||||
#else /* not MSDOS, or __TURBOC__ */
|
||||
#if defined(_AIX)
|
||||
#pragma alloca
|
||||
#else /* not MSDOS, __TURBOC__, or _AIX */
|
||||
#ifdef __hpux
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
void *alloca (unsigned int);
|
||||
};
|
||||
#else /* not __cplusplus */
|
||||
void *alloca ();
|
||||
#endif /* not __cplusplus */
|
||||
#endif /* __hpux */
|
||||
#endif /* not _AIX */
|
||||
#endif /* not MSDOS, or __TURBOC__ */
|
||||
#endif /* not sparc. */
|
||||
#endif /* not GNU C. */
|
||||
#endif /* alloca not defined. */
|
||||
|
||||
/* This is the parser code that is written into each bison parser
|
||||
when the %semantic_parser declaration is not specified in the grammar.
|
||||
It was written by Richard Stallman by simplifying the hairy parser
|
||||
used when %semantic_parser is specified. */
|
||||
|
||||
#ifndef YYSTACK_USE_ALLOCA
|
||||
#ifdef alloca
|
||||
#define YYSTACK_USE_ALLOCA
|
||||
#else /* alloca not defined */
|
||||
#ifdef __GNUC__
|
||||
#define YYSTACK_USE_ALLOCA
|
||||
#define alloca __builtin_alloca
|
||||
#else /* not GNU C. */
|
||||
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
|
||||
#define YYSTACK_USE_ALLOCA
|
||||
#include <alloca.h>
|
||||
#else /* not sparc */
|
||||
/* We think this test detects Watcom and Microsoft C. */
|
||||
/* This used to test MSDOS, but that is a bad idea
|
||||
since that symbol is in the user namespace. */
|
||||
#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
|
||||
#if 0 /* No need for xmalloc.h, which pollutes the namespace;
|
||||
instead, just don't use alloca. */
|
||||
#endif
|
||||
#else /* not MSDOS, or __TURBOC__ */
|
||||
#if defined(_AIX)
|
||||
/* I don't know what this was needed for, but it pollutes the namespace.
|
||||
So I turned it off. rms, 2 May 1997. */
|
||||
#pragma alloca
|
||||
#define YYSTACK_USE_ALLOCA
|
||||
#else /* not MSDOS, or __TURBOC__, or _AIX */
|
||||
#if 0
|
||||
#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
|
||||
and on HPUX 10. Eventually we can turn this on. */
|
||||
#define YYSTACK_USE_ALLOCA
|
||||
#define alloca __builtin_alloca
|
||||
#endif /* __hpux */
|
||||
#endif
|
||||
#endif /* not _AIX */
|
||||
#endif /* not MSDOS, or __TURBOC__ */
|
||||
#endif /* not sparc */
|
||||
#endif /* not GNU C */
|
||||
#endif /* alloca not defined */
|
||||
#endif /* YYSTACK_USE_ALLOCA not defined */
|
||||
|
||||
#ifdef YYSTACK_USE_ALLOCA
|
||||
#define YYSTACK_ALLOC alloca
|
||||
#else
|
||||
#define YYSTACK_ALLOC xmalloc
|
||||
#endif
|
||||
|
||||
/* Note: there must be only one dollar sign in this file.
|
||||
It is replaced by the list of actions, each action
|
||||
as one case of the switch. */
|
||||
@ -604,8 +625,8 @@ void *alloca ();
|
||||
#define yyclearin (yychar = YYEMPTY)
|
||||
#define YYEMPTY -2
|
||||
#define YYEOF 0
|
||||
#define YYACCEPT return(0)
|
||||
#define YYABORT return(1)
|
||||
#define YYACCEPT goto yyacceptlab
|
||||
#define YYABORT goto yyabortlab
|
||||
#define YYERROR goto yyerrlab1
|
||||
/* Like YYERROR except do call yyerror.
|
||||
This remains here temporarily to ease the
|
||||
@ -686,12 +707,12 @@ int yydebug; /* nonzero means print parse trace */
|
||||
#ifndef YYMAXDEPTH
|
||||
#define YYMAXDEPTH 10000
|
||||
#endif
|
||||
|
||||
/* Prevent warning if -Wstrict-prototypes. */
|
||||
#ifdef __GNUC__
|
||||
int yyparse (void);
|
||||
#endif
|
||||
|
||||
/* Define __yy_memcpy. Note that the size argument
|
||||
should be passed with type unsigned int, because that is what the non-GCC
|
||||
definitions require. With GCC, __builtin_memcpy takes an arg
|
||||
of type size_t, but it can handle unsigned int. */
|
||||
|
||||
#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
|
||||
#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
|
||||
#else /* not GNU C or C++ */
|
||||
@ -703,7 +724,7 @@ static void
|
||||
__yy_memcpy (to, from, count)
|
||||
char *to;
|
||||
char *from;
|
||||
int count;
|
||||
unsigned int count;
|
||||
{
|
||||
register char *f = from;
|
||||
register char *t = to;
|
||||
@ -718,10 +739,10 @@ __yy_memcpy (to, from, count)
|
||||
/* This is the most reliable way to avoid incompatibilities
|
||||
in available built-in functions on various systems. */
|
||||
static void
|
||||
__yy_memcpy (char *to, char *from, int count)
|
||||
__yy_memcpy (char *to, char *from, unsigned int count)
|
||||
{
|
||||
register char *f = from;
|
||||
register char *t = to;
|
||||
register char *f = from;
|
||||
register int i = count;
|
||||
|
||||
while (i-- > 0)
|
||||
@ -731,7 +752,7 @@ __yy_memcpy (char *to, char *from, int count)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#line 196 "/stone/jimb/main-98r2/share/bison.simple"
|
||||
#line 216 "/usr/lib/bison.simple"
|
||||
|
||||
/* The user can define YYPARSE_PARAM as the name of an argument to be passed
|
||||
into yyparse. The argument should have type void *.
|
||||
@ -752,6 +773,15 @@ __yy_memcpy (char *to, char *from, int count)
|
||||
#define YYPARSE_PARAM_DECL
|
||||
#endif /* not YYPARSE_PARAM */
|
||||
|
||||
/* Prevent warning if -Wstrict-prototypes. */
|
||||
#ifdef __GNUC__
|
||||
#ifdef YYPARSE_PARAM
|
||||
int yyparse (void *);
|
||||
#else
|
||||
int yyparse (void);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int
|
||||
yyparse(YYPARSE_PARAM_ARG)
|
||||
YYPARSE_PARAM_DECL
|
||||
@ -780,6 +810,7 @@ yyparse(YYPARSE_PARAM_ARG)
|
||||
#endif
|
||||
|
||||
int yystacksize = YYINITDEPTH;
|
||||
int yyfree_stacks = 0;
|
||||
|
||||
#ifdef YYPURE
|
||||
int yychar;
|
||||
@ -864,18 +895,32 @@ yyparse(YYPARSE_PARAM_ARG)
|
||||
if (yystacksize >= YYMAXDEPTH)
|
||||
{
|
||||
yyerror("parser stack overflow");
|
||||
if (yyfree_stacks)
|
||||
{
|
||||
free (yyss);
|
||||
free (yyvs);
|
||||
#ifdef YYLSP_NEEDED
|
||||
free (yyls);
|
||||
#endif
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
yystacksize *= 2;
|
||||
if (yystacksize > YYMAXDEPTH)
|
||||
yystacksize = YYMAXDEPTH;
|
||||
yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
|
||||
__yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp));
|
||||
yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
|
||||
__yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp));
|
||||
#ifndef YYSTACK_USE_ALLOCA
|
||||
yyfree_stacks = 1;
|
||||
#endif
|
||||
yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
|
||||
__yy_memcpy ((char *)yyss, (char *)yyss1,
|
||||
size * (unsigned int) sizeof (*yyssp));
|
||||
yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
|
||||
__yy_memcpy ((char *)yyvs, (char *)yyvs1,
|
||||
size * (unsigned int) sizeof (*yyvsp));
|
||||
#ifdef YYLSP_NEEDED
|
||||
yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
|
||||
__yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp));
|
||||
yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
|
||||
__yy_memcpy ((char *)yyls, (char *)yyls1,
|
||||
size * (unsigned int) sizeof (*yylsp));
|
||||
#endif
|
||||
#endif /* no yyoverflow */
|
||||
|
||||
@ -1439,7 +1484,7 @@ case 79:
|
||||
break;}
|
||||
}
|
||||
/* the action file gets copied in in place of this dollarsign */
|
||||
#line 498 "/stone/jimb/main-98r2/share/bison.simple"
|
||||
#line 542 "/usr/lib/bison.simple"
|
||||
|
||||
yyvsp -= yylen;
|
||||
yyssp -= yylen;
|
||||
@ -1634,6 +1679,30 @@ case 79:
|
||||
|
||||
yystate = yyn;
|
||||
goto yynewstate;
|
||||
|
||||
yyacceptlab:
|
||||
/* YYACCEPT comes here. */
|
||||
if (yyfree_stacks)
|
||||
{
|
||||
free (yyss);
|
||||
free (yyvs);
|
||||
#ifdef YYLSP_NEEDED
|
||||
free (yyls);
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
|
||||
yyabortlab:
|
||||
/* YYABORT comes here. */
|
||||
if (yyfree_stacks)
|
||||
{
|
||||
free (yyss);
|
||||
free (yyvs);
|
||||
#ifdef YYLSP_NEEDED
|
||||
free (yyls);
|
||||
#endif
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
#line 644 "m2-exp.y"
|
||||
|
||||
@ -2045,6 +2114,10 @@ yylex ()
|
||||
case LOC_LABEL:
|
||||
case LOC_UNRESOLVED:
|
||||
error("internal: Unforseen case in m2lex()");
|
||||
|
||||
default:
|
||||
error ("unhandled token in m2lex()");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,23 +1,24 @@
|
||||
/* Definitions for remote debugging interface for ROM monitors.
|
||||
Copyright 1990, 1991, 1992, 1996 Free Software Foundation, Inc.
|
||||
Contributed by Cygnus Support. Written by Rob Savoye for Cygnus.
|
||||
|
||||
Copyright 1990, 1991, 1992, 1996 Free Software Foundation, Inc.
|
||||
Contributed by Cygnus Support. Written by Rob Savoye for Cygnus.
|
||||
|
||||
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.
|
||||
*/
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "serial.h"
|
||||
|
||||
@ -52,67 +53,70 @@
|
||||
will also be ignored if TERM is NULL. */
|
||||
|
||||
struct memrw_cmd
|
||||
{
|
||||
char *cmdb; /* Command to send for byte read/write */
|
||||
char *cmdw; /* Command for word (16 bit) read/write */
|
||||
char *cmdl; /* Command for long (32 bit) read/write */
|
||||
char *cmdll; /* Command for long long (64 bit) read/write */
|
||||
char *resp_delim; /* String just prior to the desired value */
|
||||
char *term; /* Terminating string to search for */
|
||||
char *term_cmd; /* String to get out of sub-mode (if necessary) */
|
||||
};
|
||||
{
|
||||
char *cmdb; /* Command to send for byte read/write */
|
||||
char *cmdw; /* Command for word (16 bit) read/write */
|
||||
char *cmdl; /* Command for long (32 bit) read/write */
|
||||
char *cmdll; /* Command for long long (64 bit) read/write */
|
||||
char *resp_delim; /* String just prior to the desired value */
|
||||
char *term; /* Terminating string to search for */
|
||||
char *term_cmd; /* String to get out of sub-mode (if necessary) */
|
||||
};
|
||||
|
||||
struct regrw_cmd
|
||||
{
|
||||
char *cmd; /* Command to send for reg read/write */
|
||||
char *resp_delim; /* String (actually a regexp if getmem) just
|
||||
{
|
||||
char *cmd; /* Command to send for reg read/write */
|
||||
char *resp_delim; /* String (actually a regexp if getmem) just
|
||||
prior to the desired value */
|
||||
char *term; /* Terminating string to search for */
|
||||
char *term_cmd; /* String to get out of sub-mode (if necessary) */
|
||||
};
|
||||
char *term; /* Terminating string to search for */
|
||||
char *term_cmd; /* String to get out of sub-mode (if necessary) */
|
||||
};
|
||||
|
||||
struct monitor_ops
|
||||
{
|
||||
int flags; /* See below */
|
||||
char **init; /* List of init commands. NULL terminated. */
|
||||
char *cont; /* continue command */
|
||||
char *step; /* single step */
|
||||
char *stop; /* Interrupt program string */
|
||||
char *set_break; /* set a breakpoint */
|
||||
char *clr_break; /* clear a breakpoint */
|
||||
char *clr_all_break; /* Clear all breakpoints */
|
||||
char *fill; /* Memory fill cmd (addr len val) */
|
||||
struct memrw_cmd setmem; /* set memory to a value */
|
||||
struct memrw_cmd getmem; /* display memory */
|
||||
struct regrw_cmd setreg; /* set a register */
|
||||
struct regrw_cmd getreg; /* get a register */
|
||||
/* Some commands can dump a bunch of registers
|
||||
at once. This comes as a set of REG=VAL
|
||||
pairs. This should be called for each pair
|
||||
of registers that we can parse to supply
|
||||
GDB with the value of a register. */
|
||||
char *dump_registers; /* Command to dump all regs at once */
|
||||
char *register_pattern; /* Pattern that picks out register from reg dump */
|
||||
void (*supply_register) PARAMS ((char *name, int namelen,
|
||||
char *val, int vallen));
|
||||
void (*load_routine) PARAMS ((serial_t desc, char *file,
|
||||
int hashmark)); /* Download routine */
|
||||
int (*dumpregs) PARAMS((void)) ; /* routine to dump all registers */
|
||||
int (*continue_hook) PARAMS((void)) ; /* Emit the continue command */
|
||||
int (*wait_filter) PARAMS((char * buf, /* Maybe contains registers */
|
||||
int bufmax ,
|
||||
int * response_length,
|
||||
struct target_waitstatus * status)) ;
|
||||
char *load; /* load command */
|
||||
char *loadresp; /* Response to load command */
|
||||
char *prompt; /* monitor command prompt */
|
||||
char *line_term; /* end-of-command delimitor */
|
||||
char *cmd_end; /* optional command terminator */
|
||||
struct target_ops *target; /* target operations */
|
||||
int stopbits; /* number of stop bits */
|
||||
char **regnames; /* array of register names in ascii */
|
||||
int magic; /* Check value */
|
||||
};
|
||||
{
|
||||
int flags; /* See below */
|
||||
char **init; /* List of init commands. NULL terminated. */
|
||||
char *cont; /* continue command */
|
||||
char *step; /* single step */
|
||||
char *stop; /* Interrupt program string */
|
||||
char *set_break; /* set a breakpoint. If NULL, monitor implementation
|
||||
sets its own to_insert_breakpoint method. */
|
||||
char *clr_break; /* clear a breakpoint */
|
||||
char *clr_all_break; /* Clear all breakpoints */
|
||||
char *fill; /* Memory fill cmd (addr len val) */
|
||||
struct memrw_cmd setmem; /* set memory to a value */
|
||||
struct memrw_cmd getmem; /* display memory */
|
||||
struct regrw_cmd setreg; /* set a register */
|
||||
struct regrw_cmd getreg; /* get a register */
|
||||
/* Some commands can dump a bunch of registers
|
||||
at once. This comes as a set of REG=VAL
|
||||
pairs. This should be called for each pair
|
||||
of registers that we can parse to supply
|
||||
GDB with the value of a register. */
|
||||
char *dump_registers; /* Command to dump all regs at once */
|
||||
char *register_pattern; /* Pattern that picks out register from reg dump */
|
||||
void (*supply_register) PARAMS ((char *name, int namelen,
|
||||
char *val, int vallen));
|
||||
void (*load_routine) PARAMS ((serial_t desc, char *file,
|
||||
int hashmark)); /* Download routine */
|
||||
int (*dumpregs) PARAMS ((void)); /* routine to dump all registers */
|
||||
int (*continue_hook) PARAMS ((void)); /* Emit the continue command */
|
||||
int (*wait_filter) PARAMS ((char *buf, /* Maybe contains registers */
|
||||
int bufmax,
|
||||
int *response_length,
|
||||
struct target_waitstatus * status));
|
||||
char *load; /* load command */
|
||||
char *loadresp; /* Response to load command */
|
||||
char *prompt; /* monitor command prompt */
|
||||
char *line_term; /* end-of-command delimitor */
|
||||
char *cmd_end; /* optional command terminator */
|
||||
struct target_ops *target; /* target operations */
|
||||
int stopbits; /* number of stop bits */
|
||||
char **regnames; /* array of register names in ascii */
|
||||
int num_breakpoints; /* If set_break != NULL, number of supported
|
||||
breakpoints */
|
||||
int magic; /* Check value */
|
||||
};
|
||||
|
||||
/* The monitor ops magic number, used to detect if an ops structure doesn't
|
||||
have the right number of entries filled in. */
|
||||
@ -214,8 +218,8 @@ struct monitor_ops
|
||||
#define MO_PRINT_PROGRAM_OUTPUT 0x200000
|
||||
|
||||
/* Some dump bytes commands align the first data with the preceeding
|
||||
16 byte boundary. Some print blanks and start at the exactly the
|
||||
requested boundary. */
|
||||
16 byte boundary. Some print blanks and start at the exactly the
|
||||
requested boundary. */
|
||||
|
||||
#define MO_EXACT_DUMPADDR 0x400000
|
||||
|
||||
@ -224,24 +228,25 @@ requested boundary. */
|
||||
the memory editing mode. You only need to worry about this
|
||||
if you are doing memory downloading.
|
||||
This engages a new write function registered with dcache.
|
||||
*/
|
||||
*/
|
||||
#define MO_HAS_BLOCKWRITES 0x800000
|
||||
|
||||
#define SREC_SIZE 160
|
||||
|
||||
extern void monitor_open PARAMS ((char *args, struct monitor_ops *ops,
|
||||
extern void monitor_open PARAMS ((char *args, struct monitor_ops * ops,
|
||||
int from_tty));
|
||||
extern void monitor_close PARAMS ((int quitting));
|
||||
extern char *monitor_supply_register PARAMS ((int regno, char *valstr));
|
||||
extern int monitor_expect PARAMS ((char *prompt, char *buf, int buflen));
|
||||
extern int monitor_expect_prompt PARAMS ((char *buf, int buflen));
|
||||
extern void monitor_printf PARAMS ((char *, ...))
|
||||
ATTR_FORMAT(printf, 1, 2);
|
||||
extern void monitor_printf_noecho PARAMS ((char *, ...))
|
||||
ATTR_FORMAT(printf, 1, 2);
|
||||
extern void monitor_write PARAMS ((char *buf, int buflen));
|
||||
extern int monitor_readchar PARAMS ((void));
|
||||
extern char *monitor_get_dev_name PARAMS ((void));
|
||||
extern void init_monitor_ops PARAMS ((struct target_ops *));
|
||||
extern int monitor_dump_reg_block PARAMS((char * dump_cmd)) ;
|
||||
extern void flush_monitor_dcache PARAMS ((void));
|
||||
extern void monitor_printf
|
||||
PARAMS ((char *,...))
|
||||
ATTR_FORMAT (printf, 1, 2);
|
||||
extern void monitor_printf_noecho PARAMS ((char *,...))
|
||||
ATTR_FORMAT (printf, 1, 2);
|
||||
extern void monitor_write PARAMS ((char *buf, int buflen));
|
||||
extern int monitor_readchar PARAMS ((void));
|
||||
extern char *monitor_get_dev_name PARAMS ((void));
|
||||
extern void init_monitor_ops PARAMS ((struct target_ops *));
|
||||
extern int monitor_dump_reg_block PARAMS ((char *dump_cmd));
|
||||
extern void flush_monitor_dcache PARAMS ((void));
|
||||
|
@ -1,21 +1,22 @@
|
||||
/* Handle OSF/1 shared libraries for GDB, the GNU Debugger.
|
||||
Copyright 1993, 94, 95, 96, 98, 1999 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 file is part of GDB.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
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. */
|
||||
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. */
|
||||
|
||||
/* FIXME: Most of this code could be merged with solib.c by using
|
||||
next_link_map_member and xfer_link_map_member in solib.c. */
|
||||
@ -35,12 +36,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#include "command.h"
|
||||
#include "target.h"
|
||||
#include "frame.h"
|
||||
#include "gnu-regex.h"
|
||||
#include "gdb_regex.h"
|
||||
#include "inferior.h"
|
||||
#include "language.h"
|
||||
#include "gdbcmd.h"
|
||||
|
||||
#define MAX_PATH_SIZE 1024 /* FIXME: Should be dynamic */
|
||||
#define MAX_PATH_SIZE 1024 /* FIXME: Should be dynamic */
|
||||
|
||||
/* When handling shared libraries, GDB has to find out the pathnames
|
||||
of all shared libraries that are currently loaded (to read in their
|
||||
@ -50,16 +51,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
Under OSF/1 there are two possibilities to get at this information:
|
||||
1) Peek around in the runtime loader structures.
|
||||
These are not documented, and they are not defined in the system
|
||||
header files. The definitions below were obtained by experimentation,
|
||||
but they seem stable enough.
|
||||
These are not documented, and they are not defined in the system
|
||||
header files. The definitions below were obtained by experimentation,
|
||||
but they seem stable enough.
|
||||
2) Use the undocumented libxproc.a library, which contains the
|
||||
equivalent ldr_* routines.
|
||||
This approach is somewhat cleaner, but it requires that the GDB
|
||||
executable is dynamically linked. In addition it requires a
|
||||
NAT_CLIBS= -lxproc -Wl,-expect_unresolved,ldr_process_context
|
||||
linker specification for GDB and all applications that are using
|
||||
libgdb.
|
||||
equivalent ldr_* routines.
|
||||
This approach is somewhat cleaner, but it requires that the GDB
|
||||
executable is dynamically linked. In addition it requires a
|
||||
NAT_CLIBS= -lxproc -Wl,-expect_unresolved,ldr_process_context
|
||||
linker specification for GDB and all applications that are using
|
||||
libgdb.
|
||||
We will use the peeking approach until it becomes unwieldy. */
|
||||
|
||||
#ifndef USE_LDR_ROUTINES
|
||||
@ -68,37 +69,40 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#define RLD_CONTEXT_ADDRESS 0x3ffc0000000
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CORE_ADDR next;
|
||||
CORE_ADDR previous;
|
||||
CORE_ADDR unknown1;
|
||||
char *module_name;
|
||||
CORE_ADDR modinfo_addr;
|
||||
long module_id;
|
||||
CORE_ADDR unknown2;
|
||||
CORE_ADDR unknown3;
|
||||
long region_count;
|
||||
CORE_ADDR regioninfo_addr;
|
||||
} ldr_module_info_t;
|
||||
{
|
||||
CORE_ADDR next;
|
||||
CORE_ADDR previous;
|
||||
CORE_ADDR unknown1;
|
||||
char *module_name;
|
||||
CORE_ADDR modinfo_addr;
|
||||
long module_id;
|
||||
CORE_ADDR unknown2;
|
||||
CORE_ADDR unknown3;
|
||||
long region_count;
|
||||
CORE_ADDR regioninfo_addr;
|
||||
}
|
||||
ldr_module_info_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
long unknown1;
|
||||
CORE_ADDR regionname_addr;
|
||||
long protection;
|
||||
CORE_ADDR vaddr;
|
||||
CORE_ADDR mapaddr;
|
||||
long size;
|
||||
long unknown2[5];
|
||||
} ldr_region_info_t;
|
||||
{
|
||||
long unknown1;
|
||||
CORE_ADDR regionname_addr;
|
||||
long protection;
|
||||
CORE_ADDR vaddr;
|
||||
CORE_ADDR mapaddr;
|
||||
long size;
|
||||
long unknown2[5];
|
||||
}
|
||||
ldr_region_info_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CORE_ADDR unknown1;
|
||||
CORE_ADDR unknown2;
|
||||
CORE_ADDR head;
|
||||
CORE_ADDR tail;
|
||||
} ldr_context_t;
|
||||
{
|
||||
CORE_ADDR unknown1;
|
||||
CORE_ADDR unknown2;
|
||||
CORE_ADDR head;
|
||||
CORE_ADDR tail;
|
||||
}
|
||||
ldr_context_t;
|
||||
|
||||
static ldr_context_t ldr_context;
|
||||
|
||||
@ -125,7 +129,7 @@ ldr_read_memory (memaddr, myaddr, len, readstring)
|
||||
{
|
||||
target_read_string (memaddr, &buffer, len, &result);
|
||||
if (result == 0)
|
||||
strcpy (myaddr, buffer);
|
||||
strcpy (myaddr, buffer);
|
||||
free (buffer);
|
||||
}
|
||||
else
|
||||
@ -141,34 +145,36 @@ ldr_read_memory (memaddr, myaddr, len, readstring)
|
||||
/* Define our own link_map structure.
|
||||
This will help to share code with solib.c. */
|
||||
|
||||
struct link_map {
|
||||
CORE_ADDR l_offset; /* prelink to load address offset */
|
||||
char *l_name; /* full name of loaded object */
|
||||
struct link_map
|
||||
{
|
||||
CORE_ADDR l_offset; /* prelink to load address offset */
|
||||
char *l_name; /* full name of loaded object */
|
||||
ldr_module_info_t module_info; /* corresponding module info */
|
||||
};
|
||||
|
||||
#define LM_OFFSET(so) ((so) -> lm.l_offset)
|
||||
#define LM_NAME(so) ((so) -> lm.l_name)
|
||||
|
||||
struct so_list {
|
||||
struct so_list *next; /* next structure in linked list */
|
||||
struct link_map lm; /* copy of link map from inferior */
|
||||
struct link_map *lmaddr; /* addr in inferior lm was read from */
|
||||
CORE_ADDR lmend; /* upper addr bound of mapped object */
|
||||
char so_name[MAX_PATH_SIZE]; /* shared object lib name (FIXME) */
|
||||
char symbols_loaded; /* flag: symbols read in yet? */
|
||||
char from_tty; /* flag: print msgs? */
|
||||
struct objfile *objfile; /* objfile for loaded lib */
|
||||
struct section_table *sections;
|
||||
struct section_table *sections_end;
|
||||
struct section_table *textsection;
|
||||
bfd *abfd;
|
||||
};
|
||||
struct so_list
|
||||
{
|
||||
struct so_list *next; /* next structure in linked list */
|
||||
struct link_map lm; /* copy of link map from inferior */
|
||||
struct link_map *lmaddr; /* addr in inferior lm was read from */
|
||||
CORE_ADDR lmend; /* upper addr bound of mapped object */
|
||||
char so_name[MAX_PATH_SIZE]; /* shared object lib name (FIXME) */
|
||||
char symbols_loaded; /* flag: symbols read in yet? */
|
||||
char from_tty; /* flag: print msgs? */
|
||||
struct objfile *objfile; /* objfile for loaded lib */
|
||||
struct section_table *sections;
|
||||
struct section_table *sections_end;
|
||||
struct section_table *textsection;
|
||||
bfd *abfd;
|
||||
};
|
||||
|
||||
static struct so_list *so_list_head; /* List of known shared objects */
|
||||
|
||||
extern int
|
||||
fdmatch PARAMS ((int, int)); /* In libiberty */
|
||||
fdmatch PARAMS ((int, int)); /* In libiberty */
|
||||
|
||||
/* Local function prototypes */
|
||||
|
||||
@ -182,13 +188,13 @@ static int
|
||||
symbol_add_stub PARAMS ((char *));
|
||||
|
||||
static struct so_list *
|
||||
find_solib PARAMS ((struct so_list *));
|
||||
find_solib PARAMS ((struct so_list *));
|
||||
|
||||
static struct link_map *
|
||||
first_link_map_member PARAMS ((void));
|
||||
first_link_map_member PARAMS ((void));
|
||||
|
||||
static struct link_map *
|
||||
next_link_map_member PARAMS ((struct so_list *));
|
||||
next_link_map_member PARAMS ((struct so_list *));
|
||||
|
||||
static void
|
||||
xfer_link_map_member PARAMS ((struct so_list *, struct link_map *));
|
||||
@ -198,29 +204,29 @@ solib_map_sections PARAMS ((char *));
|
||||
|
||||
/*
|
||||
|
||||
LOCAL FUNCTION
|
||||
LOCAL FUNCTION
|
||||
|
||||
solib_map_sections -- open bfd and build sections for shared lib
|
||||
solib_map_sections -- open bfd and build sections for shared lib
|
||||
|
||||
SYNOPSIS
|
||||
SYNOPSIS
|
||||
|
||||
static int solib_map_sections (struct so_list *so)
|
||||
static int solib_map_sections (struct so_list *so)
|
||||
|
||||
DESCRIPTION
|
||||
DESCRIPTION
|
||||
|
||||
Given a pointer to one of the shared objects in our list
|
||||
of mapped objects, use the recorded name to open a bfd
|
||||
descriptor for the object, build a section table, and then
|
||||
relocate all the section addresses by the base address at
|
||||
which the shared object was mapped.
|
||||
Given a pointer to one of the shared objects in our list
|
||||
of mapped objects, use the recorded name to open a bfd
|
||||
descriptor for the object, build a section table, and then
|
||||
relocate all the section addresses by the base address at
|
||||
which the shared object was mapped.
|
||||
|
||||
FIXMES
|
||||
FIXMES
|
||||
|
||||
In most (all?) cases the shared object file name recorded in the
|
||||
dynamic linkage tables will be a fully qualified pathname. For
|
||||
cases where it isn't, do we really mimic the systems search
|
||||
mechanism correctly in the below code (particularly the tilde
|
||||
expansion stuff?).
|
||||
In most (all?) cases the shared object file name recorded in the
|
||||
dynamic linkage tables will be a fully qualified pathname. For
|
||||
cases where it isn't, do we really mimic the systems search
|
||||
mechanism correctly in the below code (particularly the tilde
|
||||
expansion stuff?).
|
||||
*/
|
||||
|
||||
static int
|
||||
@ -234,10 +240,10 @@ solib_map_sections (arg)
|
||||
struct section_table *p;
|
||||
struct cleanup *old_chain;
|
||||
bfd *abfd;
|
||||
|
||||
filename = tilde_expand (so -> so_name);
|
||||
|
||||
filename = tilde_expand (so->so_name);
|
||||
old_chain = make_cleanup (free, filename);
|
||||
|
||||
|
||||
scratch_chan = openp (getenv ("PATH"), 1, filename, O_RDONLY, 0,
|
||||
&scratch_pathname);
|
||||
if (scratch_chan < 0)
|
||||
@ -259,31 +265,31 @@ solib_map_sections (arg)
|
||||
scratch_pathname, bfd_errmsg (bfd_get_error ()));
|
||||
}
|
||||
/* Leave bfd open, core_xfer_memory and "info files" need it. */
|
||||
so -> abfd = abfd;
|
||||
abfd -> cacheable = true;
|
||||
so->abfd = abfd;
|
||||
abfd->cacheable = true;
|
||||
|
||||
if (!bfd_check_format (abfd, bfd_object))
|
||||
{
|
||||
error ("\"%s\": not in executable format: %s.",
|
||||
scratch_pathname, bfd_errmsg (bfd_get_error ()));
|
||||
}
|
||||
if (build_section_table (abfd, &so -> sections, &so -> sections_end))
|
||||
if (build_section_table (abfd, &so->sections, &so->sections_end))
|
||||
{
|
||||
error ("Can't find the file sections in `%s': %s",
|
||||
error ("Can't find the file sections in `%s': %s",
|
||||
bfd_get_filename (exec_bfd), bfd_errmsg (bfd_get_error ()));
|
||||
}
|
||||
|
||||
for (p = so -> sections; p < so -> sections_end; p++)
|
||||
for (p = so->sections; p < so->sections_end; p++)
|
||||
{
|
||||
/* Relocate the section binding addresses as recorded in the shared
|
||||
object's file by the offset to get the address to which the
|
||||
object was actually mapped. */
|
||||
p -> addr += LM_OFFSET (so);
|
||||
p -> endaddr += LM_OFFSET (so);
|
||||
so -> lmend = (CORE_ADDR) max (p -> endaddr, so -> lmend);
|
||||
if (STREQ (p -> the_bfd_section -> name, ".text"))
|
||||
object's file by the offset to get the address to which the
|
||||
object was actually mapped. */
|
||||
p->addr += LM_OFFSET (so);
|
||||
p->endaddr += LM_OFFSET (so);
|
||||
so->lmend = (CORE_ADDR) max (p->endaddr, so->lmend);
|
||||
if (STREQ (p->the_bfd_section->name, ".text"))
|
||||
{
|
||||
so -> textsection = p;
|
||||
so->textsection = p;
|
||||
}
|
||||
}
|
||||
|
||||
@ -295,20 +301,20 @@ solib_map_sections (arg)
|
||||
|
||||
/*
|
||||
|
||||
LOCAL FUNCTION
|
||||
LOCAL FUNCTION
|
||||
|
||||
first_link_map_member -- locate first member in dynamic linker's map
|
||||
first_link_map_member -- locate first member in dynamic linker's map
|
||||
|
||||
SYNOPSIS
|
||||
SYNOPSIS
|
||||
|
||||
static struct link_map *first_link_map_member (void)
|
||||
static struct link_map *first_link_map_member (void)
|
||||
|
||||
DESCRIPTION
|
||||
DESCRIPTION
|
||||
|
||||
Read in a copy of the first member in the inferior's dynamic
|
||||
link map from the inferior's dynamic linker structures, and return
|
||||
a pointer to the copy in our address space.
|
||||
*/
|
||||
Read in a copy of the first member in the inferior's dynamic
|
||||
link map from the inferior's dynamic linker structures, and return
|
||||
a pointer to the copy in our address space.
|
||||
*/
|
||||
|
||||
static struct link_map *
|
||||
first_link_map_member ()
|
||||
@ -324,11 +330,11 @@ first_link_map_member ()
|
||||
ldr_set_core_reader (ldr_read_memory);
|
||||
ldr_xdetach (fake_ldr_process);
|
||||
if (ldr_xattach (fake_ldr_process) != 0
|
||||
|| ldr_next_module(fake_ldr_process, &mod_id) != 0
|
||||
|| ldr_next_module (fake_ldr_process, &mod_id) != 0
|
||||
|| mod_id == LDR_NULL_MODULE
|
||||
|| ldr_inq_module(fake_ldr_process, mod_id,
|
||||
&first_lm.module_info, sizeof(ldr_module_info_t),
|
||||
&retsize) != 0)
|
||||
|| ldr_inq_module (fake_ldr_process, mod_id,
|
||||
&first_lm.module_info, sizeof (ldr_module_info_t),
|
||||
&retsize) != 0)
|
||||
return lm;
|
||||
#else
|
||||
CORE_ADDR ldr_context_addr;
|
||||
@ -363,11 +369,11 @@ next_link_map_member (so_list_ptr)
|
||||
ldr_module_t mod_id = so_list_ptr->lm.module_info.lmi_modid;
|
||||
size_t retsize;
|
||||
|
||||
if (ldr_next_module(fake_ldr_process, &mod_id) != 0
|
||||
if (ldr_next_module (fake_ldr_process, &mod_id) != 0
|
||||
|| mod_id == LDR_NULL_MODULE
|
||||
|| ldr_inq_module(fake_ldr_process, mod_id,
|
||||
&next_lm.module_info, sizeof(ldr_module_info_t),
|
||||
&retsize) != 0)
|
||||
|| ldr_inq_module (fake_ldr_process, mod_id,
|
||||
&next_lm.module_info, sizeof (ldr_module_info_t),
|
||||
&retsize) != 0)
|
||||
return lm;
|
||||
|
||||
lm = &next_lm;
|
||||
@ -440,7 +446,7 @@ xfer_link_map_member (so_list_ptr, lm)
|
||||
&retsize) != 0)
|
||||
break;
|
||||
region_offset = (CORE_ADDR) region_info.lri_mapaddr
|
||||
- (CORE_ADDR) region_info.lri_vaddr;
|
||||
- (CORE_ADDR) region_info.lri_vaddr;
|
||||
if (i == 0)
|
||||
LM_OFFSET (so_list_ptr) = region_offset;
|
||||
else if (LM_OFFSET (so_list_ptr) != region_offset)
|
||||
@ -465,7 +471,7 @@ xfer_link_map_member (so_list_ptr, lm)
|
||||
CORE_ADDR region_offset;
|
||||
|
||||
if (target_read_memory (lm->module_info.regioninfo_addr
|
||||
+ i * sizeof (region_info),
|
||||
+ i * sizeof (region_info),
|
||||
(char *) ®ion_info,
|
||||
sizeof (region_info)) != 0)
|
||||
break;
|
||||
@ -482,7 +488,7 @@ xfer_link_map_member (so_list_ptr, lm)
|
||||
else
|
||||
region_name = "??";
|
||||
warning ("cannot handle shared library relocation for %s (%s)",
|
||||
so_list_ptr->so_name, region_name);
|
||||
so_list_ptr->so_name, region_name);
|
||||
free (buffer);
|
||||
}
|
||||
}
|
||||
@ -496,25 +502,25 @@ xfer_link_map_member (so_list_ptr, lm)
|
||||
|
||||
/*
|
||||
|
||||
LOCAL FUNCTION
|
||||
LOCAL FUNCTION
|
||||
|
||||
find_solib -- step through list of shared objects
|
||||
find_solib -- step through list of shared objects
|
||||
|
||||
SYNOPSIS
|
||||
SYNOPSIS
|
||||
|
||||
struct so_list *find_solib (struct so_list *so_list_ptr)
|
||||
struct so_list *find_solib (struct so_list *so_list_ptr)
|
||||
|
||||
DESCRIPTION
|
||||
DESCRIPTION
|
||||
|
||||
This module contains the routine which finds the names of any
|
||||
loaded "images" in the current process. The argument in must be
|
||||
NULL on the first call, and then the returned value must be passed
|
||||
in on subsequent calls. This provides the capability to "step" down
|
||||
the list of loaded objects. On the last object, a NULL value is
|
||||
returned.
|
||||
This module contains the routine which finds the names of any
|
||||
loaded "images" in the current process. The argument in must be
|
||||
NULL on the first call, and then the returned value must be passed
|
||||
in on subsequent calls. This provides the capability to "step" down
|
||||
the list of loaded objects. On the last object, a NULL value is
|
||||
returned.
|
||||
|
||||
The arg and return value are "struct link_map" pointers, as defined
|
||||
in <link.h>.
|
||||
The arg and return value are "struct link_map" pointers, as defined
|
||||
in <link.h>.
|
||||
*/
|
||||
|
||||
static struct so_list *
|
||||
@ -524,7 +530,7 @@ find_solib (so_list_ptr)
|
||||
struct so_list *so_list_next = NULL;
|
||||
struct link_map *lm = NULL;
|
||||
struct so_list *new;
|
||||
|
||||
|
||||
if (so_list_ptr == NULL)
|
||||
{
|
||||
/* We are setting up for a new scan through the loaded images. */
|
||||
@ -537,27 +543,27 @@ find_solib (so_list_ptr)
|
||||
else
|
||||
{
|
||||
/* We have been called before, and are in the process of walking
|
||||
the shared library list. Advance to the next shared object. */
|
||||
the shared library list. Advance to the next shared object. */
|
||||
lm = next_link_map_member (so_list_ptr);
|
||||
so_list_next = so_list_ptr -> next;
|
||||
so_list_next = so_list_ptr->next;
|
||||
}
|
||||
if ((so_list_next == NULL) && (lm != NULL))
|
||||
{
|
||||
/* Get next link map structure from inferior image and build a local
|
||||
abbreviated load_map structure */
|
||||
abbreviated load_map structure */
|
||||
new = (struct so_list *) xmalloc (sizeof (struct so_list));
|
||||
memset ((char *) new, 0, sizeof (struct so_list));
|
||||
new -> lmaddr = lm;
|
||||
new->lmaddr = lm;
|
||||
/* Add the new node as the next node in the list, or as the root
|
||||
node if this is the first one. */
|
||||
node if this is the first one. */
|
||||
if (so_list_ptr != NULL)
|
||||
{
|
||||
so_list_ptr -> next = new;
|
||||
so_list_ptr->next = new;
|
||||
}
|
||||
else
|
||||
{
|
||||
so_list_head = new;
|
||||
}
|
||||
}
|
||||
so_list_next = new;
|
||||
xfer_link_map_member (new, lm);
|
||||
}
|
||||
@ -570,54 +576,56 @@ static int
|
||||
symbol_add_stub (arg)
|
||||
char *arg;
|
||||
{
|
||||
register struct so_list *so = (struct so_list *) arg; /* catch_errs bogon */
|
||||
register struct so_list *so = (struct so_list *) arg; /* catch_errs bogon */
|
||||
CORE_ADDR text_addr = 0;
|
||||
struct section_addr_info section_addrs;
|
||||
|
||||
if (so -> textsection)
|
||||
text_addr = so -> textsection -> addr;
|
||||
else if (so -> abfd != NULL)
|
||||
memset (§ion_addrs, 0, sizeof (section_addrs));
|
||||
if (so->textsection)
|
||||
text_addr = so->textsection->addr;
|
||||
else if (so->abfd != NULL)
|
||||
{
|
||||
asection *lowest_sect;
|
||||
|
||||
/* If we didn't find a mapped non zero sized .text section, set up
|
||||
text_addr so that the relocation in symbol_file_add does no harm. */
|
||||
text_addr so that the relocation in symbol_file_add does no harm. */
|
||||
|
||||
lowest_sect = bfd_get_section_by_name (so -> abfd, ".text");
|
||||
lowest_sect = bfd_get_section_by_name (so->abfd, ".text");
|
||||
if (lowest_sect == NULL)
|
||||
bfd_map_over_sections (so -> abfd, find_lowest_section,
|
||||
bfd_map_over_sections (so->abfd, find_lowest_section,
|
||||
(PTR) &lowest_sect);
|
||||
if (lowest_sect)
|
||||
text_addr = bfd_section_vma (so -> abfd, lowest_sect) + LM_OFFSET (so);
|
||||
text_addr = bfd_section_vma (so->abfd, lowest_sect) + LM_OFFSET (so);
|
||||
}
|
||||
|
||||
so -> objfile = symbol_file_add (so -> so_name, so -> from_tty,
|
||||
text_addr,
|
||||
0, 0, 0, 0, 1);
|
||||
|
||||
section_addrs.text_addr = text_addr;
|
||||
so->objfile = symbol_file_add (so->so_name, so->from_tty,
|
||||
§ion_addrs, 0, OBJF_SHARED);
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
GLOBAL FUNCTION
|
||||
GLOBAL FUNCTION
|
||||
|
||||
solib_add -- add a shared library file to the symtab and section list
|
||||
solib_add -- add a shared library file to the symtab and section list
|
||||
|
||||
SYNOPSIS
|
||||
SYNOPSIS
|
||||
|
||||
void solib_add (char *arg_string, int from_tty,
|
||||
struct target_ops *target)
|
||||
void solib_add (char *arg_string, int from_tty,
|
||||
struct target_ops *target)
|
||||
|
||||
DESCRIPTION
|
||||
DESCRIPTION
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
void
|
||||
solib_add (arg_string, from_tty, target)
|
||||
char *arg_string;
|
||||
int from_tty;
|
||||
struct target_ops *target;
|
||||
{
|
||||
register struct so_list *so = NULL; /* link map state variable */
|
||||
{
|
||||
register struct so_list *so = NULL; /* link map state variable */
|
||||
|
||||
/* Last shared library that we read. */
|
||||
struct so_list *so_last = NULL;
|
||||
@ -625,13 +633,13 @@ solib_add (arg_string, from_tty, target)
|
||||
char *re_err;
|
||||
int count;
|
||||
int old;
|
||||
|
||||
|
||||
if ((re_err = re_comp (arg_string ? arg_string : ".")) != NULL)
|
||||
{
|
||||
error ("Invalid regexp: %s", re_err);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* Add the shared library sections to the section table of the
|
||||
specified target, if any. */
|
||||
if (target)
|
||||
@ -641,72 +649,44 @@ solib_add (arg_string, from_tty, target)
|
||||
count = 0;
|
||||
while ((so = find_solib (so)) != NULL)
|
||||
{
|
||||
if (so -> so_name[0])
|
||||
if (so->so_name[0])
|
||||
{
|
||||
count += so -> sections_end - so -> sections;
|
||||
count += so->sections_end - so->sections;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (count)
|
||||
{
|
||||
int update_coreops;
|
||||
|
||||
/* We must update the to_sections field in the core_ops structure
|
||||
here, otherwise we dereference a potential dangling pointer
|
||||
for each call to target_read/write_memory within this routine. */
|
||||
update_coreops = core_ops.to_sections == target->to_sections;
|
||||
|
||||
/* Reallocate the target's section table including the new size. */
|
||||
if (target -> to_sections)
|
||||
{
|
||||
old = target -> to_sections_end - target -> to_sections;
|
||||
target -> to_sections = (struct section_table *)
|
||||
xrealloc ((char *)target -> to_sections,
|
||||
(sizeof (struct section_table)) * (count + old));
|
||||
}
|
||||
else
|
||||
{
|
||||
old = 0;
|
||||
target -> to_sections = (struct section_table *)
|
||||
xmalloc ((sizeof (struct section_table)) * count);
|
||||
}
|
||||
target -> to_sections_end = target -> to_sections + (count + old);
|
||||
|
||||
/* Update the to_sections field in the core_ops structure
|
||||
if needed. */
|
||||
if (update_coreops)
|
||||
{
|
||||
core_ops.to_sections = target->to_sections;
|
||||
core_ops.to_sections_end = target->to_sections_end;
|
||||
}
|
||||
|
||||
/* Add these section table entries to the target's table. */
|
||||
|
||||
old = target_resize_to_sections (target, count);
|
||||
|
||||
while ((so = find_solib (so)) != NULL)
|
||||
{
|
||||
if (so -> so_name[0])
|
||||
if (so->so_name[0])
|
||||
{
|
||||
count = so -> sections_end - so -> sections;
|
||||
memcpy ((char *) (target -> to_sections + old),
|
||||
so -> sections,
|
||||
count = so->sections_end - so->sections;
|
||||
memcpy ((char *) (target->to_sections + old),
|
||||
so->sections,
|
||||
(sizeof (struct section_table)) * count);
|
||||
old += count;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Now add the symbol files. */
|
||||
so = NULL;
|
||||
while ((so = find_solib (so)) != NULL)
|
||||
{
|
||||
if (so -> so_name[0] && re_exec (so -> so_name))
|
||||
if (so->so_name[0] && re_exec (so->so_name))
|
||||
{
|
||||
so -> from_tty = from_tty;
|
||||
if (so -> symbols_loaded)
|
||||
so->from_tty = from_tty;
|
||||
if (so->symbols_loaded)
|
||||
{
|
||||
if (from_tty)
|
||||
{
|
||||
printf_unfiltered ("Symbols already loaded for %s\n", so -> so_name);
|
||||
printf_unfiltered ("Symbols already loaded for %s\n", so->so_name);
|
||||
}
|
||||
}
|
||||
else if (catch_errors
|
||||
@ -715,7 +695,7 @@ solib_add (arg_string, from_tty, target)
|
||||
RETURN_MASK_ALL))
|
||||
{
|
||||
so_last = so;
|
||||
so -> symbols_loaded = 1;
|
||||
so->symbols_loaded = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -728,99 +708,99 @@ solib_add (arg_string, from_tty, target)
|
||||
|
||||
/*
|
||||
|
||||
LOCAL FUNCTION
|
||||
LOCAL FUNCTION
|
||||
|
||||
info_sharedlibrary_command -- code for "info sharedlibrary"
|
||||
info_sharedlibrary_command -- code for "info sharedlibrary"
|
||||
|
||||
SYNOPSIS
|
||||
SYNOPSIS
|
||||
|
||||
static void info_sharedlibrary_command ()
|
||||
static void info_sharedlibrary_command ()
|
||||
|
||||
DESCRIPTION
|
||||
DESCRIPTION
|
||||
|
||||
Walk through the shared library list and print information
|
||||
about each attached library.
|
||||
*/
|
||||
Walk through the shared library list and print information
|
||||
about each attached library.
|
||||
*/
|
||||
|
||||
static void
|
||||
info_sharedlibrary_command (ignore, from_tty)
|
||||
char *ignore;
|
||||
int from_tty;
|
||||
{
|
||||
register struct so_list *so = NULL; /* link map state variable */
|
||||
register struct so_list *so = NULL; /* link map state variable */
|
||||
int header_done = 0;
|
||||
|
||||
|
||||
if (exec_bfd == NULL)
|
||||
{
|
||||
printf_unfiltered ("No exec file.\n");
|
||||
printf_unfiltered ("No executable file.\n");
|
||||
return;
|
||||
}
|
||||
while ((so = find_solib (so)) != NULL)
|
||||
{
|
||||
if (so -> so_name[0])
|
||||
if (so->so_name[0])
|
||||
{
|
||||
unsigned long txt_start = 0;
|
||||
unsigned long txt_end = 0;
|
||||
|
||||
if (!header_done)
|
||||
{
|
||||
printf_unfiltered("%-20s%-20s%-12s%s\n", "From", "To", "Syms Read",
|
||||
"Shared Object Library");
|
||||
printf_unfiltered ("%-20s%-20s%-12s%s\n", "From", "To", "Syms Read",
|
||||
"Shared Object Library");
|
||||
header_done++;
|
||||
}
|
||||
if (so -> textsection)
|
||||
if (so->textsection)
|
||||
{
|
||||
txt_start = (unsigned long) so -> textsection -> addr;
|
||||
txt_end = (unsigned long) so -> textsection -> endaddr;
|
||||
txt_start = (unsigned long) so->textsection->addr;
|
||||
txt_end = (unsigned long) so->textsection->endaddr;
|
||||
}
|
||||
printf_unfiltered ("%-20s", local_hex_string_custom (txt_start, "08l"));
|
||||
printf_unfiltered ("%-20s", local_hex_string_custom (txt_end, "08l"));
|
||||
printf_unfiltered ("%-12s", so -> symbols_loaded ? "Yes" : "No");
|
||||
printf_unfiltered ("%s\n", so -> so_name);
|
||||
printf_unfiltered ("%-12s", so->symbols_loaded ? "Yes" : "No");
|
||||
printf_unfiltered ("%s\n", so->so_name);
|
||||
}
|
||||
}
|
||||
if (so_list_head == NULL)
|
||||
{
|
||||
printf_unfiltered ("No shared libraries loaded at this time.\n");
|
||||
printf_unfiltered ("No shared libraries loaded at this time.\n");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
GLOBAL FUNCTION
|
||||
GLOBAL FUNCTION
|
||||
|
||||
solib_address -- check to see if an address is in a shared lib
|
||||
solib_address -- check to see if an address is in a shared lib
|
||||
|
||||
SYNOPSIS
|
||||
SYNOPSIS
|
||||
|
||||
char *solib_address (CORE_ADDR address)
|
||||
char *solib_address (CORE_ADDR address)
|
||||
|
||||
DESCRIPTION
|
||||
DESCRIPTION
|
||||
|
||||
Provides a hook for other gdb routines to discover whether or
|
||||
not a particular address is within the mapped address space of
|
||||
a shared library. Any address between the base mapping address
|
||||
and the first address beyond the end of the last mapping, is
|
||||
considered to be within the shared library address space, for
|
||||
our purposes.
|
||||
Provides a hook for other gdb routines to discover whether or
|
||||
not a particular address is within the mapped address space of
|
||||
a shared library. Any address between the base mapping address
|
||||
and the first address beyond the end of the last mapping, is
|
||||
considered to be within the shared library address space, for
|
||||
our purposes.
|
||||
|
||||
For example, this routine is called at one point to disable
|
||||
breakpoints which are in shared libraries that are not currently
|
||||
mapped in.
|
||||
For example, this routine is called at one point to disable
|
||||
breakpoints which are in shared libraries that are not currently
|
||||
mapped in.
|
||||
*/
|
||||
|
||||
char *
|
||||
solib_address (address)
|
||||
CORE_ADDR address;
|
||||
{
|
||||
register struct so_list *so = 0; /* link map state variable */
|
||||
|
||||
register struct so_list *so = 0; /* link map state variable */
|
||||
|
||||
while ((so = find_solib (so)) != NULL)
|
||||
{
|
||||
if (so -> so_name[0] && so -> textsection)
|
||||
if (so->so_name[0] && so->textsection)
|
||||
{
|
||||
if ((address >= (CORE_ADDR) so -> textsection -> addr) &&
|
||||
(address < (CORE_ADDR) so -> textsection -> endaddr))
|
||||
if ((address >= (CORE_ADDR) so->textsection->addr) &&
|
||||
(address < (CORE_ADDR) so->textsection->endaddr))
|
||||
return (so->so_name);
|
||||
}
|
||||
}
|
||||
@ -829,24 +809,24 @@ solib_address (address)
|
||||
|
||||
/* Called by free_all_symtabs */
|
||||
|
||||
void
|
||||
clear_solib()
|
||||
void
|
||||
clear_solib ()
|
||||
{
|
||||
struct so_list *next;
|
||||
char *bfd_filename;
|
||||
|
||||
|
||||
disable_breakpoints_in_shlibs (1);
|
||||
|
||||
while (so_list_head)
|
||||
{
|
||||
if (so_list_head -> sections)
|
||||
if (so_list_head->sections)
|
||||
{
|
||||
free ((PTR)so_list_head -> sections);
|
||||
free ((PTR) so_list_head->sections);
|
||||
}
|
||||
if (so_list_head -> abfd)
|
||||
if (so_list_head->abfd)
|
||||
{
|
||||
bfd_filename = bfd_get_filename (so_list_head -> abfd);
|
||||
if (!bfd_close (so_list_head -> abfd))
|
||||
bfd_filename = bfd_get_filename (so_list_head->abfd);
|
||||
if (!bfd_close (so_list_head->abfd))
|
||||
warning ("cannot close \"%s\": %s",
|
||||
bfd_filename, bfd_errmsg (bfd_get_error ()));
|
||||
}
|
||||
@ -854,52 +834,52 @@ clear_solib()
|
||||
/* This happens for the executable on SVR4. */
|
||||
bfd_filename = NULL;
|
||||
|
||||
next = so_list_head -> next;
|
||||
next = so_list_head->next;
|
||||
if (bfd_filename)
|
||||
free ((PTR)bfd_filename);
|
||||
free ((PTR)so_list_head);
|
||||
free ((PTR) bfd_filename);
|
||||
free ((PTR) so_list_head);
|
||||
so_list_head = next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
GLOBAL FUNCTION
|
||||
|
||||
solib_create_inferior_hook -- shared library startup support
|
||||
|
||||
SYNOPSIS
|
||||
|
||||
void solib_create_inferior_hook()
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
When gdb starts up the inferior, it nurses it along (through the
|
||||
shell) until it is ready to execute it's first instruction. At this
|
||||
point, this function gets called via expansion of the macro
|
||||
SOLIB_CREATE_INFERIOR_HOOK.
|
||||
For a statically bound executable, this first instruction is the
|
||||
one at "_start", or a similar text label. No further processing is
|
||||
needed in that case.
|
||||
For a dynamically bound executable, this first instruction is somewhere
|
||||
in the rld, and the actual user executable is not yet mapped in.
|
||||
We continue the inferior again, rld then maps in the actual user
|
||||
executable and any needed shared libraries and then sends
|
||||
itself a SIGTRAP.
|
||||
At that point we discover the names of all shared libraries and
|
||||
read their symbols in.
|
||||
GLOBAL FUNCTION
|
||||
|
||||
FIXME
|
||||
solib_create_inferior_hook -- shared library startup support
|
||||
|
||||
This code does not properly handle hitting breakpoints which the
|
||||
user might have set in the rld itself. Proper handling would have
|
||||
to check if the SIGTRAP happened due to a kill call.
|
||||
SYNOPSIS
|
||||
|
||||
Also, what if child has exit()ed? Must exit loop somehow.
|
||||
*/
|
||||
void solib_create_inferior_hook()
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
When gdb starts up the inferior, it nurses it along (through the
|
||||
shell) until it is ready to execute it's first instruction. At this
|
||||
point, this function gets called via expansion of the macro
|
||||
SOLIB_CREATE_INFERIOR_HOOK.
|
||||
For a statically bound executable, this first instruction is the
|
||||
one at "_start", or a similar text label. No further processing is
|
||||
needed in that case.
|
||||
For a dynamically bound executable, this first instruction is somewhere
|
||||
in the rld, and the actual user executable is not yet mapped in.
|
||||
We continue the inferior again, rld then maps in the actual user
|
||||
executable and any needed shared libraries and then sends
|
||||
itself a SIGTRAP.
|
||||
At that point we discover the names of all shared libraries and
|
||||
read their symbols in.
|
||||
|
||||
FIXME
|
||||
|
||||
This code does not properly handle hitting breakpoints which the
|
||||
user might have set in the rld itself. Proper handling would have
|
||||
to check if the SIGTRAP happened due to a kill call.
|
||||
|
||||
Also, what if child has exit()ed? Must exit loop somehow.
|
||||
*/
|
||||
|
||||
void
|
||||
solib_create_inferior_hook()
|
||||
solib_create_inferior_hook ()
|
||||
{
|
||||
|
||||
/* Nothing to do for statically bound executables. */
|
||||
@ -913,7 +893,7 @@ solib_create_inferior_hook()
|
||||
which point all of the libraries will have been mapped in and we
|
||||
can go groveling around in the rld structures to find
|
||||
out what we need to know about them. */
|
||||
|
||||
|
||||
clear_proceed_status ();
|
||||
stop_soon_quietly = 1;
|
||||
stop_signal = TARGET_SIGNAL_0;
|
||||
@ -925,11 +905,11 @@ solib_create_inferior_hook()
|
||||
while (stop_signal != TARGET_SIGNAL_TRAP);
|
||||
|
||||
/* solib_add will call reinit_frame_cache.
|
||||
But we are stopped in the runtime loader and we do not have symbols
|
||||
for the runtime loader. So heuristic_proc_start will be called
|
||||
and will put out an annoying warning.
|
||||
Delaying the resetting of stop_soon_quietly until after symbol loading
|
||||
suppresses the warning. */
|
||||
But we are stopped in the runtime loader and we do not have symbols
|
||||
for the runtime loader. So heuristic_proc_start will be called
|
||||
and will put out an annoying warning.
|
||||
Delaying the resetting of stop_soon_quietly until after symbol loading
|
||||
suppresses the warning. */
|
||||
if (auto_solib_add)
|
||||
solib_add ((char *) 0, 0, (struct target_ops *) 0);
|
||||
stop_soon_quietly = 0;
|
||||
@ -938,33 +918,33 @@ solib_create_inferior_hook()
|
||||
|
||||
/*
|
||||
|
||||
LOCAL FUNCTION
|
||||
LOCAL FUNCTION
|
||||
|
||||
sharedlibrary_command -- handle command to explicitly add library
|
||||
sharedlibrary_command -- handle command to explicitly add library
|
||||
|
||||
SYNOPSIS
|
||||
SYNOPSIS
|
||||
|
||||
static void sharedlibrary_command (char *args, int from_tty)
|
||||
static void sharedlibrary_command (char *args, int from_tty)
|
||||
|
||||
DESCRIPTION
|
||||
DESCRIPTION
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
static void
|
||||
sharedlibrary_command (args, from_tty)
|
||||
char *args;
|
||||
int from_tty;
|
||||
char *args;
|
||||
int from_tty;
|
||||
{
|
||||
dont_repeat ();
|
||||
solib_add (args, from_tty, (struct target_ops *) 0);
|
||||
}
|
||||
|
||||
void
|
||||
_initialize_solib()
|
||||
_initialize_solib ()
|
||||
{
|
||||
add_com ("sharedlibrary", class_files, sharedlibrary_command,
|
||||
"Load shared object library symbols for files matching REGEXP.");
|
||||
add_info ("sharedlibrary", info_sharedlibrary_command,
|
||||
add_info ("sharedlibrary", info_sharedlibrary_command,
|
||||
"Status of loaded shared object libraries.");
|
||||
|
||||
add_show_from_set
|
||||
|
@ -4,21 +4,22 @@
|
||||
|
||||
Written by Stu Grossman of Cygnus Support
|
||||
|
||||
This file is part of GDB.
|
||||
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 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.
|
||||
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. */
|
||||
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. */
|
||||
|
||||
#include "defs.h"
|
||||
#include "gdbcore.h"
|
||||
@ -26,8 +27,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#include "monitor.h"
|
||||
#include "serial.h"
|
||||
|
||||
static void ppcbug_open PARAMS ((char *args, int from_tty));
|
||||
|
||||
static void
|
||||
ppcbug_supply_register (regname, regnamelen, val, vallen)
|
||||
char *regname;
|
||||
@ -35,7 +34,7 @@ ppcbug_supply_register (regname, regnamelen, val, vallen)
|
||||
char *val;
|
||||
int vallen;
|
||||
{
|
||||
int regno = 0, base = 0;
|
||||
int regno = 0;
|
||||
|
||||
if (regnamelen < 2 || regnamelen > 4)
|
||||
return;
|
||||
@ -107,18 +106,18 @@ ppcbug_supply_register (regname, regnamelen, val, vallen)
|
||||
|
||||
static char *ppcbug_regnames[NUM_REGS] =
|
||||
{
|
||||
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
|
||||
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
|
||||
"r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
|
||||
"r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
|
||||
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
|
||||
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
|
||||
"r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
|
||||
"r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
|
||||
|
||||
"fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7",
|
||||
"fr8", "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15",
|
||||
"fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7",
|
||||
"fr8", "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15",
|
||||
"fr16", "fr17", "fr18", "fr19", "fr20", "fr21", "fr22", "fr23",
|
||||
"fr24", "fr25", "fr26", "fr27", "fr28", "fr29", "fr30", "fr31",
|
||||
|
||||
/* pc ps cnd lr cnt xer mq */
|
||||
"ip", "msr", "cr", "spr8", "spr9", "spr1", "spr0"
|
||||
"ip", "msr", "cr", "spr8", "spr9", "spr1", "spr0"
|
||||
};
|
||||
|
||||
/*
|
||||
@ -130,65 +129,66 @@ static char *ppcbug_regnames[NUM_REGS] =
|
||||
static struct target_ops ppcbug_ops0;
|
||||
static struct target_ops ppcbug_ops1;
|
||||
|
||||
static char *ppcbug_inits[] = {"\r", NULL};
|
||||
static char *ppcbug_inits[] =
|
||||
{"\r", NULL};
|
||||
|
||||
static void
|
||||
init_ppc_cmds (char * LOAD_CMD,
|
||||
struct monitor_ops * OPS,
|
||||
struct target_ops * targops)
|
||||
init_ppc_cmds (char *LOAD_CMD,
|
||||
struct monitor_ops *OPS,
|
||||
struct target_ops *targops)
|
||||
{
|
||||
OPS->flags = MO_CLR_BREAK_USES_ADDR | MO_HANDLE_NL;
|
||||
OPS->init = ppcbug_inits; /* Init strings */
|
||||
OPS->cont = "g\r"; /* continue command */
|
||||
OPS->step = "t\r"; /* single step */
|
||||
OPS->stop = NULL; /* interrupt command */
|
||||
OPS->set_break = "br %x\r"; /* set a breakpoint */
|
||||
OPS->clr_break = "nobr %x\r"; /* clear a breakpoint */
|
||||
OPS->flags = MO_CLR_BREAK_USES_ADDR | MO_HANDLE_NL;
|
||||
OPS->init = ppcbug_inits; /* Init strings */
|
||||
OPS->cont = "g\r"; /* continue command */
|
||||
OPS->step = "t\r"; /* single step */
|
||||
OPS->stop = NULL; /* interrupt command */
|
||||
OPS->set_break = "br %x\r"; /* set a breakpoint */
|
||||
OPS->clr_break = "nobr %x\r"; /* clear a breakpoint */
|
||||
OPS->clr_all_break = "nobr\r"; /* clear all breakpoints */
|
||||
OPS->fill = "bf %x:%x %x;b\r"; /* fill (start count val) */
|
||||
OPS->setmem.cmdb = "ms %x %02x\r"; /* setmem.cmdb (addr, value) */
|
||||
OPS->setmem.cmdw = "ms %x %04x\r"; /* setmem.cmdw (addr, value) */
|
||||
OPS->setmem.cmdl = "ms %x %08x\r"; /* setmem.cmdl (addr, value) */
|
||||
OPS->setmem.cmdll = NULL; /* setmem.cmdll (addr, value) */
|
||||
OPS->setmem.resp_delim = NULL; /* setreg.resp_delim */
|
||||
OPS->setmem.term = NULL; /* setreg.term */
|
||||
OPS->setmem.term_cmd = NULL; /* setreg.term_cmd */
|
||||
OPS->getmem.cmdb = "md %x:%x;b\r"; /* getmem.cmdb (addr, len) */
|
||||
OPS->getmem.cmdw = "md %x:%x;b\r"; /* getmem.cmdw (addr, len) */
|
||||
OPS->getmem.cmdl = "md %x:%x;b\r"; /* getmem.cmdl (addr, len) */
|
||||
OPS->getmem.cmdll = NULL; /* getmem.cmdll (addr, len) */
|
||||
OPS->getmem.resp_delim = " "; /* getmem.resp_delim */
|
||||
OPS->getmem.term = NULL; /* getmem.term */
|
||||
OPS->getmem.term_cmd = NULL; /* getmem.term_cmd */
|
||||
OPS->setreg.cmd = "rs %s %x\r"; /* setreg.cmd (name, value) */
|
||||
OPS->setreg.resp_delim = NULL; /* setreg.resp_delim */
|
||||
OPS->setreg.term = NULL; /* setreg.term */
|
||||
OPS->setreg.term_cmd = NULL ; /* setreg.term_cmd */
|
||||
OPS->getreg.cmd = "rs %s\r"; /* getreg.cmd (name) */
|
||||
OPS->getreg.resp_delim = "="; /* getreg.resp_delim */
|
||||
OPS->getreg.term = NULL; /* getreg.term */
|
||||
OPS->getreg.term_cmd = NULL ; /* getreg.term_cmd */
|
||||
OPS->register_pattern = "\\(\\w+\\) +=\\([0-9a-fA-F]+\\b\\)"; /* register_pattern */
|
||||
OPS->supply_register = ppcbug_supply_register; /* supply_register */
|
||||
OPS->dump_registers = "rd\r"; /* dump all registers */
|
||||
OPS->load_routine = NULL; /* load_routine (defaults to SRECs) */
|
||||
OPS->load = LOAD_CMD; /* download command */
|
||||
OPS->loadresp = NULL; /* load response */
|
||||
OPS->prompt = "PPC1-Bug>"; /* monitor command prompt */
|
||||
OPS->line_term = "\r"; /* end-of-line terminator */
|
||||
OPS->cmd_end = NULL; /* optional command terminator */
|
||||
OPS->target = targops ; /* target operations */
|
||||
OPS->stopbits = SERIAL_1_STOPBITS; /* number of stop bits */
|
||||
OPS->regnames = ppcbug_regnames; /* registers names */
|
||||
OPS->magic = MONITOR_OPS_MAGIC; /* magic */
|
||||
OPS->fill = "bf %x:%x %x;b\r"; /* fill (start count val) */
|
||||
OPS->setmem.cmdb = "ms %x %02x\r"; /* setmem.cmdb (addr, value) */
|
||||
OPS->setmem.cmdw = "ms %x %04x\r"; /* setmem.cmdw (addr, value) */
|
||||
OPS->setmem.cmdl = "ms %x %08x\r"; /* setmem.cmdl (addr, value) */
|
||||
OPS->setmem.cmdll = NULL; /* setmem.cmdll (addr, value) */
|
||||
OPS->setmem.resp_delim = NULL; /* setreg.resp_delim */
|
||||
OPS->setmem.term = NULL; /* setreg.term */
|
||||
OPS->setmem.term_cmd = NULL; /* setreg.term_cmd */
|
||||
OPS->getmem.cmdb = "md %x:%x;b\r"; /* getmem.cmdb (addr, len) */
|
||||
OPS->getmem.cmdw = "md %x:%x;b\r"; /* getmem.cmdw (addr, len) */
|
||||
OPS->getmem.cmdl = "md %x:%x;b\r"; /* getmem.cmdl (addr, len) */
|
||||
OPS->getmem.cmdll = NULL; /* getmem.cmdll (addr, len) */
|
||||
OPS->getmem.resp_delim = " "; /* getmem.resp_delim */
|
||||
OPS->getmem.term = NULL; /* getmem.term */
|
||||
OPS->getmem.term_cmd = NULL; /* getmem.term_cmd */
|
||||
OPS->setreg.cmd = "rs %s %x\r"; /* setreg.cmd (name, value) */
|
||||
OPS->setreg.resp_delim = NULL; /* setreg.resp_delim */
|
||||
OPS->setreg.term = NULL; /* setreg.term */
|
||||
OPS->setreg.term_cmd = NULL; /* setreg.term_cmd */
|
||||
OPS->getreg.cmd = "rs %s\r"; /* getreg.cmd (name) */
|
||||
OPS->getreg.resp_delim = "="; /* getreg.resp_delim */
|
||||
OPS->getreg.term = NULL; /* getreg.term */
|
||||
OPS->getreg.term_cmd = NULL; /* getreg.term_cmd */
|
||||
OPS->register_pattern = "\\(\\w+\\) +=\\([0-9a-fA-F]+\\b\\)"; /* register_pattern */
|
||||
OPS->supply_register = ppcbug_supply_register; /* supply_register */
|
||||
OPS->dump_registers = "rd\r"; /* dump all registers */
|
||||
OPS->load_routine = NULL; /* load_routine (defaults to SRECs) */
|
||||
OPS->load = LOAD_CMD; /* download command */
|
||||
OPS->loadresp = NULL; /* load response */
|
||||
OPS->prompt = "PPC1-Bug>"; /* monitor command prompt */
|
||||
OPS->line_term = "\r"; /* end-of-line terminator */
|
||||
OPS->cmd_end = NULL; /* optional command terminator */
|
||||
OPS->target = targops; /* target operations */
|
||||
OPS->stopbits = SERIAL_1_STOPBITS; /* number of stop bits */
|
||||
OPS->regnames = ppcbug_regnames; /* registers names */
|
||||
OPS->magic = MONITOR_OPS_MAGIC; /* magic */
|
||||
}
|
||||
|
||||
|
||||
static struct monitor_ops ppcbug_cmds0 ;
|
||||
static struct monitor_ops ppcbug_cmds1 ;
|
||||
static struct monitor_ops ppcbug_cmds0;
|
||||
static struct monitor_ops ppcbug_cmds1;
|
||||
|
||||
static void
|
||||
ppcbug_open0(args, from_tty)
|
||||
ppcbug_open0 (args, from_tty)
|
||||
char *args;
|
||||
int from_tty;
|
||||
{
|
||||
@ -196,7 +196,7 @@ ppcbug_open0(args, from_tty)
|
||||
}
|
||||
|
||||
static void
|
||||
ppcbug_open1(args, from_tty)
|
||||
ppcbug_open1 (args, from_tty)
|
||||
char *args;
|
||||
int from_tty;
|
||||
{
|
||||
@ -206,8 +206,8 @@ ppcbug_open1(args, from_tty)
|
||||
void
|
||||
_initialize_ppcbug_rom ()
|
||||
{
|
||||
init_ppc_cmds("lo 0\r", &ppcbug_cmds0, &ppcbug_ops0) ;
|
||||
init_ppc_cmds("lo 1\r", &ppcbug_cmds1, &ppcbug_ops1);
|
||||
init_ppc_cmds ("lo 0\r", &ppcbug_cmds0, &ppcbug_ops0);
|
||||
init_ppc_cmds ("lo 1\r", &ppcbug_cmds1, &ppcbug_ops1);
|
||||
init_monitor_ops (&ppcbug_ops0);
|
||||
|
||||
ppcbug_ops0.to_shortname = "ppcbug";
|
||||
|
10388
contrib/gdb/gdb/procfs.c
10388
contrib/gdb/gdb/procfs.c
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -15,7 +15,8 @@
|
||||
|
||||
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.
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
*/
|
||||
@ -37,25 +38,20 @@
|
||||
|
||||
#include "defs.h"
|
||||
#include "inferior.h"
|
||||
#include "wait.h"
|
||||
#include "gdb_wait.h"
|
||||
#include "value.h"
|
||||
#include "callback.h"
|
||||
#include "command.h"
|
||||
#ifdef ANSI_PROTOTYPES
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
#include <fcntl.h>
|
||||
#include "symfile.h"
|
||||
#include "remote-utils.h"
|
||||
#include "gdb_string.h"
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include "gdbcore.h"
|
||||
|
||||
#ifdef HAVE_TIME_H
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
extern struct target_ops remote_rdp_ops;
|
||||
static serial_t io;
|
||||
@ -168,7 +164,7 @@ ds;
|
||||
|
||||
static int timeout = 2;
|
||||
|
||||
static char * commandline = NULL;
|
||||
static char *commandline = NULL;
|
||||
|
||||
static int
|
||||
remote_rdp_xfer_inferior_memory PARAMS ((CORE_ADDR memaddr,
|
||||
@ -186,7 +182,7 @@ get_byte ()
|
||||
int c = SERIAL_READCHAR (io, timeout);
|
||||
|
||||
if (remote_debug)
|
||||
printf ("[%02x]\n", c);
|
||||
fprintf_unfiltered (gdb_stdlog, "[%02x]\n", c);
|
||||
|
||||
if (c == SERIAL_TIMEOUT)
|
||||
{
|
||||
@ -220,7 +216,7 @@ put_byte (val)
|
||||
char val;
|
||||
{
|
||||
if (remote_debug)
|
||||
printf ("(%02x)\n", val);
|
||||
fprintf_unfiltered (gdb_stdlog, "(%02x)\n", val);
|
||||
SERIAL_WRITE (io, &val, 1);
|
||||
}
|
||||
|
||||
@ -236,7 +232,7 @@ put_word (val)
|
||||
b[3] = val >> 24;
|
||||
|
||||
if (remote_debug)
|
||||
printf ("(%04x)", val);
|
||||
fprintf_unfiltered (gdb_stdlog, "(%04x)", val);
|
||||
|
||||
SERIAL_WRITE (io, b, 4);
|
||||
}
|
||||
@ -278,9 +274,9 @@ rdp_init (cold, tty)
|
||||
printf_unfiltered ("Trying to connect at %d baud.\n", baudtry);
|
||||
|
||||
/*
|
||||
** It seems necessary to reset an EmbeddedICE to get it going.
|
||||
** This has the side benefit of displaying the startup banner.
|
||||
*/
|
||||
** It seems necessary to reset an EmbeddedICE to get it going.
|
||||
** This has the side benefit of displaying the startup banner.
|
||||
*/
|
||||
if (cold)
|
||||
{
|
||||
put_byte (RDP_RESET);
|
||||
@ -308,13 +304,13 @@ rdp_init (cold, tty)
|
||||
|
||||
put_byte (RDP_OPEN);
|
||||
|
||||
put_byte (type | RDP_OPEN_TYPE_RETURN_SEX );
|
||||
put_byte (type | RDP_OPEN_TYPE_RETURN_SEX);
|
||||
put_word (0);
|
||||
|
||||
while (!sync && (restype = SERIAL_READCHAR (io, 1)) > 0)
|
||||
{
|
||||
if (remote_debug)
|
||||
printf_unfiltered ("[%02x]\n", restype);
|
||||
fprintf_unfiltered (gdb_stdlog, "[%02x]\n", restype);
|
||||
|
||||
switch (restype)
|
||||
{
|
||||
@ -349,7 +345,7 @@ rdp_init (cold, tty)
|
||||
int resval = SERIAL_READCHAR (io, 1);
|
||||
|
||||
if (remote_debug)
|
||||
printf_unfiltered ("[%02x]\n", resval);
|
||||
fprintf_unfiltered (gdb_stdlog, "[%02x]\n", resval);
|
||||
|
||||
switch (resval)
|
||||
{
|
||||
@ -378,23 +374,13 @@ rdp_init (cold, tty)
|
||||
}
|
||||
|
||||
|
||||
#ifdef ANSI_PROTOTYPES
|
||||
void
|
||||
send_rdp (char *template,...)
|
||||
#else
|
||||
void
|
||||
send_rdp (char *template, va_alist)
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
char buf[200];
|
||||
char *dst = buf;
|
||||
va_list alist;
|
||||
#ifdef ANSI_PROTOTYPES
|
||||
va_start (alist, template);
|
||||
#else
|
||||
va_start (alist);
|
||||
#endif
|
||||
|
||||
while (*template)
|
||||
{
|
||||
@ -494,7 +480,7 @@ send_rdp (char *template, va_alist)
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
va_end (args);
|
||||
va_end (alist);
|
||||
|
||||
if (dst != buf)
|
||||
abort ();
|
||||
@ -723,14 +709,14 @@ rdp_execute_start ()
|
||||
|
||||
static void
|
||||
rdp_set_command_line (command, args)
|
||||
char * command;
|
||||
char * args;
|
||||
char *command;
|
||||
char *args;
|
||||
{
|
||||
/*
|
||||
** We could use RDP_INFO_SET_CMDLINE to send this, but EmbeddedICE systems
|
||||
** don't implement that, and get all confused at the unexpected text.
|
||||
** Instead, just keep a copy, and send it when the target does a SWI_GetEnv
|
||||
*/
|
||||
** We could use RDP_INFO_SET_CMDLINE to send this, but EmbeddedICE systems
|
||||
** don't implement that, and get all confused at the unexpected text.
|
||||
** Instead, just keep a copy, and send it when the target does a SWI_GetEnv
|
||||
*/
|
||||
|
||||
if (commandline != NULL)
|
||||
free (commandline);
|
||||
@ -748,22 +734,22 @@ static void
|
||||
rdp_catch_vectors ()
|
||||
{
|
||||
/*
|
||||
** We want the target monitor to intercept the abort vectors
|
||||
** i.e. stop the program if any of these are used.
|
||||
*/
|
||||
** We want the target monitor to intercept the abort vectors
|
||||
** i.e. stop the program if any of these are used.
|
||||
*/
|
||||
send_rdp ("bww-SZ", RDP_INFO, RDP_INFO_VECTOR_CATCH,
|
||||
/*
|
||||
** Specify a bitmask including
|
||||
** the reset vector
|
||||
** the undefined instruction vector
|
||||
** the prefetch abort vector
|
||||
** the data abort vector
|
||||
** the address exception vector
|
||||
*/
|
||||
(1<<0)|(1<<1)|(1<<3)|(1<<4)|(1<<5)
|
||||
);
|
||||
/*
|
||||
** Specify a bitmask including
|
||||
** the reset vector
|
||||
** the undefined instruction vector
|
||||
** the prefetch abort vector
|
||||
** the data abort vector
|
||||
** the address exception vector
|
||||
*/
|
||||
(1 << 0) | (1 << 1) | (1 << 3) | (1 << 4) | (1 << 5)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#define a_byte 1
|
||||
@ -817,18 +803,18 @@ argsin;
|
||||
|
||||
static int translate_open_mode[] =
|
||||
{
|
||||
O_RDONLY, /* "r" */
|
||||
O_RDONLY+O_BINARY, /* "rb" */
|
||||
O_RDWR, /* "r+" */
|
||||
O_RDWR +O_BINARY, /* "r+b" */
|
||||
O_WRONLY +O_CREAT+O_TRUNC, /* "w" */
|
||||
O_WRONLY+O_BINARY+O_CREAT+O_TRUNC, /* "wb" */
|
||||
O_RDWR +O_CREAT+O_TRUNC, /* "w+" */
|
||||
O_RDWR +O_BINARY+O_CREAT+O_TRUNC, /* "w+b" */
|
||||
O_WRONLY +O_APPEND+O_CREAT,/* "a" */
|
||||
O_WRONLY+O_BINARY+O_APPEND+O_CREAT,/* "ab" */
|
||||
O_RDWR +O_APPEND+O_CREAT,/* "a+" */
|
||||
O_RDWR +O_BINARY+O_APPEND+O_CREAT /* "a+b" */
|
||||
O_RDONLY, /* "r" */
|
||||
O_RDONLY + O_BINARY, /* "rb" */
|
||||
O_RDWR, /* "r+" */
|
||||
O_RDWR + O_BINARY, /* "r+b" */
|
||||
O_WRONLY + O_CREAT + O_TRUNC, /* "w" */
|
||||
O_WRONLY + O_BINARY + O_CREAT + O_TRUNC, /* "wb" */
|
||||
O_RDWR + O_CREAT + O_TRUNC, /* "w+" */
|
||||
O_RDWR + O_BINARY + O_CREAT + O_TRUNC, /* "w+b" */
|
||||
O_WRONLY + O_APPEND + O_CREAT, /* "a" */
|
||||
O_WRONLY + O_BINARY + O_APPEND + O_CREAT, /* "ab" */
|
||||
O_RDWR + O_APPEND + O_CREAT, /* "a+" */
|
||||
O_RDWR + O_BINARY + O_APPEND + O_CREAT /* "a+b" */
|
||||
};
|
||||
|
||||
static int
|
||||
@ -861,18 +847,18 @@ exec_swi (swi, args)
|
||||
args->n = callback->time (callback, NULL);
|
||||
return 1;
|
||||
|
||||
case SWI_Clock :
|
||||
/* return number of centi-seconds... */
|
||||
args->n =
|
||||
case SWI_Clock:
|
||||
/* return number of centi-seconds... */
|
||||
args->n =
|
||||
#ifdef CLOCKS_PER_SEC
|
||||
(CLOCKS_PER_SEC >= 100)
|
||||
? (clock() / (CLOCKS_PER_SEC / 100))
|
||||
: ((clock() * 100) / CLOCKS_PER_SEC) ;
|
||||
(CLOCKS_PER_SEC >= 100)
|
||||
? (clock () / (CLOCKS_PER_SEC / 100))
|
||||
: ((clock () * 100) / CLOCKS_PER_SEC);
|
||||
#else
|
||||
/* presume unix... clock() returns microseconds */
|
||||
clock() / 10000 ;
|
||||
/* presume unix... clock() returns microseconds */
|
||||
clock () / 10000;
|
||||
#endif
|
||||
return 1 ;
|
||||
return 1;
|
||||
|
||||
case SWI_Remove:
|
||||
args->n = callback->unlink (callback, args->s);
|
||||
@ -882,19 +868,19 @@ exec_swi (swi, args)
|
||||
return 1;
|
||||
|
||||
case SWI_Open:
|
||||
/* Now we need to decode the Demon open mode */
|
||||
i = translate_open_mode[args[1].n];
|
||||
/* Now we need to decode the Demon open mode */
|
||||
i = translate_open_mode[args[1].n];
|
||||
|
||||
/* Filename ":tt" is special: it denotes stdin/out */
|
||||
if (strcmp(args->s,":tt")==0)
|
||||
{
|
||||
if (i == O_RDONLY ) /* opening tty "r" */
|
||||
args->n = 0 /* stdin */ ;
|
||||
else
|
||||
args->n = 1 /* stdout */ ;
|
||||
}
|
||||
else
|
||||
args->n = callback->open (callback, args->s, i);
|
||||
/* Filename ":tt" is special: it denotes stdin/out */
|
||||
if (strcmp (args->s, ":tt") == 0)
|
||||
{
|
||||
if (i == O_RDONLY) /* opening tty "r" */
|
||||
args->n = 0 /* stdin */ ;
|
||||
else
|
||||
args->n = 1 /* stdout */ ;
|
||||
}
|
||||
else
|
||||
args->n = callback->open (callback, args->s, i);
|
||||
return 1;
|
||||
|
||||
case SWI_Close:
|
||||
@ -913,7 +899,7 @@ exec_swi (swi, args)
|
||||
int done = callback->read (callback, args[0].n, copy, args[2].n);
|
||||
if (done > 0)
|
||||
remote_rdp_xfer_inferior_memory (args[1].n, copy, done, 1, 0);
|
||||
args->n = args[2].n-done;
|
||||
args->n = args[2].n - done;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -941,15 +927,15 @@ exec_swi (swi, args)
|
||||
if (len > 255)
|
||||
{
|
||||
len = 255;
|
||||
commandline [255]='\0';
|
||||
commandline[255] = '\0';
|
||||
}
|
||||
remote_rdp_xfer_inferior_memory (args[0].n,
|
||||
commandline, len+1, 1, 0);
|
||||
commandline, len + 1, 1, 0);
|
||||
}
|
||||
else
|
||||
remote_rdp_xfer_inferior_memory (args[0].n, "", 1, 1, 0);
|
||||
return 1;
|
||||
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
@ -1177,32 +1163,32 @@ remote_rdp_open (args, from_tty)
|
||||
rdp_info ();
|
||||
|
||||
/* Need to set up the vector interception state */
|
||||
rdp_catch_vectors();
|
||||
rdp_catch_vectors ();
|
||||
|
||||
/*
|
||||
** If it's an EmbeddedICE, we need to set the processor config.
|
||||
** Assume we can always have ARM7TDI...
|
||||
*/
|
||||
send_rdp ("bw-SB", RDP_INFO, RDP_INFO_ICEBREAKER, & not_icebreaker);
|
||||
** If it's an EmbeddedICE, we need to set the processor config.
|
||||
** Assume we can always have ARM7TDI...
|
||||
*/
|
||||
send_rdp ("bw-SB", RDP_INFO, RDP_INFO_ICEBREAKER, ¬_icebreaker);
|
||||
if (!not_icebreaker)
|
||||
{
|
||||
const char * CPU = "ARM7TDI";
|
||||
const char *CPU = "ARM7TDI";
|
||||
int ICEversion;
|
||||
int len = strlen (CPU);
|
||||
|
||||
|
||||
send_rdp ("bbbbw-p-SWZ",
|
||||
RDP_SELECT_CONFIG,
|
||||
RDI_ConfigCPU, /* Aspect: set the CPU */
|
||||
len, /* The number of bytes in the name */
|
||||
RDI_MatchAny, /* We'll take whatever we get */
|
||||
0, /* We'll take whatever version's there */
|
||||
CPU,len,
|
||||
& ICEversion);
|
||||
CPU, len,
|
||||
&ICEversion);
|
||||
}
|
||||
|
||||
/* command line initialised on 'run'*/
|
||||
/* command line initialised on 'run' */
|
||||
|
||||
push_target (& remote_rdp_ops);
|
||||
push_target (&remote_rdp_ops);
|
||||
|
||||
callback->init (callback);
|
||||
flush_cached_frames ();
|
||||
@ -1386,18 +1372,18 @@ remote_rdp_files_info (target)
|
||||
|
||||
static void
|
||||
remote_rdp_create_inferior (exec_file, allargs, env)
|
||||
char * exec_file;
|
||||
char * allargs;
|
||||
char ** env;
|
||||
char *exec_file;
|
||||
char *allargs;
|
||||
char **env;
|
||||
{
|
||||
CORE_ADDR entry_point;
|
||||
|
||||
if (exec_file == 0 || exec_bfd == 0)
|
||||
error ("No executable file specified.");
|
||||
error ("No executable file specified.");
|
||||
|
||||
entry_point = (CORE_ADDR) bfd_get_start_address (exec_bfd);
|
||||
|
||||
remote_rdp_kill ();
|
||||
remote_rdp_kill ();
|
||||
remove_breakpoints ();
|
||||
init_wait_for_inferior ();
|
||||
|
||||
@ -1405,12 +1391,12 @@ remote_rdp_create_inferior (exec_file, allargs, env)
|
||||
rdp_set_command_line (exec_file, allargs);
|
||||
|
||||
inferior_pid = 42;
|
||||
insert_breakpoints (); /* Needed to get correct instruction in cache */
|
||||
insert_breakpoints (); /* Needed to get correct instruction in cache */
|
||||
|
||||
/*
|
||||
** RDP targets don't provide any facility to set the top of memory,
|
||||
** so we don't bother to look for MEMSIZE in the environment.
|
||||
*/
|
||||
** RDP targets don't provide any facility to set the top of memory,
|
||||
** so we don't bother to look for MEMSIZE in the environment.
|
||||
*/
|
||||
|
||||
/* Let's go! */
|
||||
proceed (entry_point, TARGET_SIGNAL_DEFAULT, 0);
|
||||
@ -1418,56 +1404,56 @@ remote_rdp_create_inferior (exec_file, allargs, env)
|
||||
|
||||
/* Accept any stray run/attach commands */
|
||||
static int
|
||||
remote_rdp_can_run()
|
||||
remote_rdp_can_run ()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Attach doesn't need to do anything */
|
||||
static void
|
||||
remote_rdp_attach(args, from_tty)
|
||||
char * args;
|
||||
remote_rdp_attach (args, from_tty)
|
||||
char *args;
|
||||
int from_tty;
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Define the target subroutine names */
|
||||
|
||||
struct target_ops remote_rdp_ops ;
|
||||
struct target_ops remote_rdp_ops;
|
||||
|
||||
static void
|
||||
init_remote_rdp_ops(void)
|
||||
static void
|
||||
init_remote_rdp_ops (void)
|
||||
{
|
||||
remote_rdp_ops.to_shortname = "rdp";
|
||||
remote_rdp_ops.to_longname = "Remote Target using the RDProtocol";
|
||||
remote_rdp_ops.to_doc = "Use a remote ARM system which uses the ARM Remote Debugging Protocol";
|
||||
remote_rdp_ops.to_open = remote_rdp_open;
|
||||
remote_rdp_ops.to_close = remote_rdp_close;
|
||||
remote_rdp_ops.to_attach = remote_rdp_attach;
|
||||
remote_rdp_ops.to_shortname = "rdp";
|
||||
remote_rdp_ops.to_longname = "Remote Target using the RDProtocol";
|
||||
remote_rdp_ops.to_doc = "Use a remote ARM system which uses the ARM Remote Debugging Protocol";
|
||||
remote_rdp_ops.to_open = remote_rdp_open;
|
||||
remote_rdp_ops.to_close = remote_rdp_close;
|
||||
remote_rdp_ops.to_attach = remote_rdp_attach;
|
||||
remote_rdp_ops.to_post_attach = NULL;
|
||||
remote_rdp_ops.to_require_attach = NULL;
|
||||
remote_rdp_ops.to_detach = NULL;
|
||||
remote_rdp_ops.to_require_detach = NULL;
|
||||
remote_rdp_ops.to_resume = remote_rdp_resume;
|
||||
remote_rdp_ops.to_wait = remote_rdp_wait;
|
||||
remote_rdp_ops.to_post_wait = NULL;
|
||||
remote_rdp_ops.to_fetch_registers = remote_rdp_fetch_register;
|
||||
remote_rdp_ops.to_store_registers = remote_rdp_store_register;
|
||||
remote_rdp_ops.to_prepare_to_store = remote_rdp_prepare_to_store;
|
||||
remote_rdp_ops.to_xfer_memory = remote_rdp_xfer_inferior_memory;
|
||||
remote_rdp_ops.to_files_info = remote_rdp_files_info;
|
||||
remote_rdp_ops.to_insert_breakpoint = remote_rdp_insert_breakpoint;
|
||||
remote_rdp_ops.to_remove_breakpoint = remote_rdp_remove_breakpoint;
|
||||
remote_rdp_ops.to_terminal_init = NULL;
|
||||
remote_rdp_ops.to_terminal_inferior = NULL;
|
||||
remote_rdp_ops.to_terminal_ours_for_output = NULL;
|
||||
remote_rdp_ops.to_terminal_ours = NULL;
|
||||
remote_rdp_ops.to_terminal_info = NULL;
|
||||
remote_rdp_ops.to_kill = remote_rdp_kill;
|
||||
remote_rdp_ops.to_load = generic_load;
|
||||
remote_rdp_ops.to_lookup_symbol = NULL;
|
||||
remote_rdp_ops.to_create_inferior = remote_rdp_create_inferior;
|
||||
remote_rdp_ops.to_detach = NULL;
|
||||
remote_rdp_ops.to_require_detach = NULL;
|
||||
remote_rdp_ops.to_resume = remote_rdp_resume;
|
||||
remote_rdp_ops.to_wait = remote_rdp_wait;
|
||||
remote_rdp_ops.to_post_wait = NULL;
|
||||
remote_rdp_ops.to_fetch_registers = remote_rdp_fetch_register;
|
||||
remote_rdp_ops.to_store_registers = remote_rdp_store_register;
|
||||
remote_rdp_ops.to_prepare_to_store = remote_rdp_prepare_to_store;
|
||||
remote_rdp_ops.to_xfer_memory = remote_rdp_xfer_inferior_memory;
|
||||
remote_rdp_ops.to_files_info = remote_rdp_files_info;
|
||||
remote_rdp_ops.to_insert_breakpoint = remote_rdp_insert_breakpoint;
|
||||
remote_rdp_ops.to_remove_breakpoint = remote_rdp_remove_breakpoint;
|
||||
remote_rdp_ops.to_terminal_init = NULL;
|
||||
remote_rdp_ops.to_terminal_inferior = NULL;
|
||||
remote_rdp_ops.to_terminal_ours_for_output = NULL;
|
||||
remote_rdp_ops.to_terminal_ours = NULL;
|
||||
remote_rdp_ops.to_terminal_info = NULL;
|
||||
remote_rdp_ops.to_kill = remote_rdp_kill;
|
||||
remote_rdp_ops.to_load = generic_load;
|
||||
remote_rdp_ops.to_lookup_symbol = NULL;
|
||||
remote_rdp_ops.to_create_inferior = remote_rdp_create_inferior;
|
||||
remote_rdp_ops.to_post_startup_inferior = NULL;
|
||||
remote_rdp_ops.to_acknowledge_created_inferior = NULL;
|
||||
remote_rdp_ops.to_clone_and_follow_inferior = NULL;
|
||||
@ -1485,28 +1471,28 @@ init_remote_rdp_ops(void)
|
||||
remote_rdp_ops.to_has_execd = NULL;
|
||||
remote_rdp_ops.to_reported_exec_events_per_exec_call = NULL;
|
||||
remote_rdp_ops.to_has_exited = NULL;
|
||||
remote_rdp_ops.to_mourn_inferior = generic_mourn_inferior;
|
||||
remote_rdp_ops.to_can_run = remote_rdp_can_run;
|
||||
remote_rdp_ops.to_notice_signals = 0;
|
||||
remote_rdp_ops.to_thread_alive = 0;
|
||||
remote_rdp_ops.to_stop = 0;
|
||||
remote_rdp_ops.to_mourn_inferior = generic_mourn_inferior;
|
||||
remote_rdp_ops.to_can_run = remote_rdp_can_run;
|
||||
remote_rdp_ops.to_notice_signals = 0;
|
||||
remote_rdp_ops.to_thread_alive = 0;
|
||||
remote_rdp_ops.to_stop = 0;
|
||||
remote_rdp_ops.to_pid_to_exec_file = NULL;
|
||||
remote_rdp_ops.to_core_file_to_sym_file = NULL;
|
||||
remote_rdp_ops.to_stratum = process_stratum;
|
||||
remote_rdp_ops.DONT_USE = NULL;
|
||||
remote_rdp_ops.to_has_all_memory = 1;
|
||||
remote_rdp_ops.to_has_memory = 1;
|
||||
remote_rdp_ops.to_has_stack = 1;
|
||||
remote_rdp_ops.to_has_registers = 1;
|
||||
remote_rdp_ops.to_has_execution = 1;
|
||||
remote_rdp_ops.to_sections = NULL;
|
||||
remote_rdp_ops.to_sections_end = NULL;
|
||||
remote_rdp_ops.to_magic = OPS_MAGIC;
|
||||
remote_rdp_ops.to_core_file_to_sym_file = NULL;
|
||||
remote_rdp_ops.to_stratum = process_stratum;
|
||||
remote_rdp_ops.DONT_USE = NULL;
|
||||
remote_rdp_ops.to_has_all_memory = 1;
|
||||
remote_rdp_ops.to_has_memory = 1;
|
||||
remote_rdp_ops.to_has_stack = 1;
|
||||
remote_rdp_ops.to_has_registers = 1;
|
||||
remote_rdp_ops.to_has_execution = 1;
|
||||
remote_rdp_ops.to_sections = NULL;
|
||||
remote_rdp_ops.to_sections_end = NULL;
|
||||
remote_rdp_ops.to_magic = OPS_MAGIC;
|
||||
}
|
||||
|
||||
void
|
||||
_initialize_remote_rdp ()
|
||||
{
|
||||
init_remote_rdp_ops() ;
|
||||
init_remote_rdp_ops ();
|
||||
add_target (&remote_rdp_ops);
|
||||
}
|
||||
|
@ -1,27 +1,28 @@
|
||||
/* Generic remote debugging interface for simulators.
|
||||
Copyright 1993, 1994, 1996, 1997 Free Software Foundation, Inc.
|
||||
Copyright 1993, 1994, 1996, 1997, 2000 Free Software Foundation, Inc.
|
||||
Contributed by Cygnus Support.
|
||||
Steve Chamberlain (sac@cygnus.com).
|
||||
|
||||
This file is part of GDB.
|
||||
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 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.
|
||||
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. */
|
||||
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. */
|
||||
|
||||
#include "defs.h"
|
||||
#include "inferior.h"
|
||||
#include "wait.h"
|
||||
#include "gdb_wait.h"
|
||||
#include "value.h"
|
||||
#include "gdb_string.h"
|
||||
#include <ctype.h>
|
||||
@ -39,6 +40,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Prototypes */
|
||||
|
||||
extern void _initialize_remote_sim PARAMS ((void));
|
||||
|
||||
extern int (*ui_loop_hook) PARAMS ((int signo));
|
||||
|
||||
static void dump_mem PARAMS ((char *buf, int len));
|
||||
|
||||
static void init_callbacks PARAMS ((void));
|
||||
@ -56,13 +61,13 @@ static void gdb_os_flush_stderr PARAMS ((host_callback *));
|
||||
static int gdb_os_poll_quit PARAMS ((host_callback *));
|
||||
|
||||
/* printf_filtered is depreciated */
|
||||
static void gdb_os_printf_filtered PARAMS ((host_callback *, const char *, ...));
|
||||
static void gdb_os_printf_filtered PARAMS ((host_callback *, const char *,...));
|
||||
|
||||
static void gdb_os_vprintf_filtered PARAMS ((host_callback *, const char *, va_list));
|
||||
|
||||
static void gdb_os_evprintf_filtered PARAMS ((host_callback *, const char *, va_list));
|
||||
|
||||
static void gdb_os_error PARAMS ((host_callback *, const char *, ...));
|
||||
static void gdb_os_error PARAMS ((host_callback *, const char *,...));
|
||||
|
||||
static void gdbsim_fetch_register PARAMS ((int regno));
|
||||
|
||||
@ -82,16 +87,16 @@ static void gdbsim_detach PARAMS ((char *args, int from_tty));
|
||||
|
||||
static void gdbsim_resume PARAMS ((int pid, int step, enum target_signal siggnal));
|
||||
|
||||
static int gdbsim_wait PARAMS ((int pid, struct target_waitstatus *status));
|
||||
static int gdbsim_wait PARAMS ((int pid, struct target_waitstatus * status));
|
||||
|
||||
static void gdbsim_prepare_to_store PARAMS ((void));
|
||||
|
||||
static int gdbsim_xfer_inferior_memory PARAMS ((CORE_ADDR memaddr,
|
||||
char *myaddr, int len,
|
||||
int write,
|
||||
struct target_ops *target));
|
||||
struct target_ops * target));
|
||||
|
||||
static void gdbsim_files_info PARAMS ((struct target_ops *target));
|
||||
static void gdbsim_files_info PARAMS ((struct target_ops * target));
|
||||
|
||||
static void gdbsim_mourn_inferior PARAMS ((void));
|
||||
|
||||
@ -126,7 +131,7 @@ dump_mem (buf, len)
|
||||
{
|
||||
long l[2];
|
||||
memcpy (l, buf, len);
|
||||
printf_filtered ("\t0x%x", l[0]);
|
||||
printf_filtered ("\t0x%lx", l[0]);
|
||||
printf_filtered (len == 8 ? " 0x%x\n" : "\n", l[1]);
|
||||
}
|
||||
else
|
||||
@ -148,7 +153,7 @@ static int callbacks_initialized = 0;
|
||||
static void
|
||||
init_callbacks ()
|
||||
{
|
||||
if (! callbacks_initialized)
|
||||
if (!callbacks_initialized)
|
||||
{
|
||||
gdb_callback = default_callback;
|
||||
gdb_callback.init (&gdb_callback);
|
||||
@ -180,7 +185,7 @@ end_callbacks ()
|
||||
|
||||
/* GDB version of os_write_stdout callback. */
|
||||
|
||||
static int
|
||||
static int
|
||||
gdb_os_write_stdout (p, buf, len)
|
||||
host_callback *p;
|
||||
const char *buf;
|
||||
@ -189,15 +194,7 @@ gdb_os_write_stdout (p, buf, len)
|
||||
int i;
|
||||
char b[2];
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
b[0] = buf[i];
|
||||
b[1] = 0;
|
||||
if (target_output_hook)
|
||||
target_output_hook (b);
|
||||
else
|
||||
fputs_filtered (b, gdb_stdout);
|
||||
}
|
||||
ui_file_write (gdb_stdtarg, buf, len);
|
||||
return len;
|
||||
}
|
||||
|
||||
@ -207,12 +204,12 @@ static void
|
||||
gdb_os_flush_stdout (p)
|
||||
host_callback *p;
|
||||
{
|
||||
gdb_flush (gdb_stdout);
|
||||
gdb_flush (gdb_stdtarg);
|
||||
}
|
||||
|
||||
/* GDB version of os_write_stderr callback. */
|
||||
|
||||
static int
|
||||
static int
|
||||
gdb_os_write_stderr (p, buf, len)
|
||||
host_callback *p;
|
||||
const char *buf;
|
||||
@ -221,14 +218,11 @@ gdb_os_write_stderr (p, buf, len)
|
||||
int i;
|
||||
char b[2];
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
b[0] = buf[i];
|
||||
b[1] = 0;
|
||||
if (target_output_hook)
|
||||
target_output_hook (b);
|
||||
else
|
||||
fputs_filtered (b, gdb_stderr);
|
||||
fputs_unfiltered (b, gdb_stdtarg);
|
||||
}
|
||||
return len;
|
||||
}
|
||||
@ -244,25 +238,11 @@ gdb_os_flush_stderr (p)
|
||||
|
||||
/* GDB version of printf_filtered callback. */
|
||||
|
||||
/* VARARGS */
|
||||
static void
|
||||
#ifdef ANSI_PROTOTYPES
|
||||
gdb_os_printf_filtered (host_callback *p, const char *format, ...)
|
||||
#else
|
||||
gdb_os_printf_filtered (p, va_alist)
|
||||
host_callback *p;
|
||||
va_dcl
|
||||
#endif
|
||||
gdb_os_printf_filtered (host_callback * p, const char *format,...)
|
||||
{
|
||||
va_list args;
|
||||
#ifdef ANSI_PROTOTYPES
|
||||
va_start (args, format);
|
||||
#else
|
||||
char *format;
|
||||
|
||||
va_start (args);
|
||||
format = va_arg (args, char *);
|
||||
#endif
|
||||
|
||||
vfprintf_filtered (gdb_stdout, format, args);
|
||||
|
||||
@ -271,93 +251,72 @@ gdb_os_printf_filtered (p, va_alist)
|
||||
|
||||
/* GDB version of error vprintf_filtered. */
|
||||
|
||||
/* VARARGS */
|
||||
static void
|
||||
#ifdef ANSI_PROTOTYPES
|
||||
gdb_os_vprintf_filtered (host_callback *p, const char *format, va_list ap)
|
||||
#else
|
||||
gdb_os_vprintf_filtered (p, format, ap)
|
||||
host_callback *p;
|
||||
char *format;
|
||||
va_list ap;
|
||||
#endif
|
||||
gdb_os_vprintf_filtered (host_callback * p, const char *format, va_list ap)
|
||||
{
|
||||
vfprintf_filtered (gdb_stdout, format, ap);
|
||||
}
|
||||
|
||||
/* GDB version of error evprintf_filtered. */
|
||||
|
||||
/* VARARGS */
|
||||
static void
|
||||
#ifdef ANSI_PROTOTYPES
|
||||
gdb_os_evprintf_filtered (host_callback *p, const char *format, va_list ap)
|
||||
#else
|
||||
gdb_os_evprintf_filtered (p, format, ap)
|
||||
host_callback *p;
|
||||
char *format;
|
||||
va_list ap;
|
||||
#endif
|
||||
gdb_os_evprintf_filtered (host_callback * p, const char *format, va_list ap)
|
||||
{
|
||||
vfprintf_filtered (gdb_stderr, format, ap);
|
||||
}
|
||||
|
||||
/* GDB version of error callback. */
|
||||
|
||||
/* VARARGS */
|
||||
static void
|
||||
#ifdef ANSI_PROTOTYPES
|
||||
gdb_os_error (host_callback *p, const char *format, ...)
|
||||
#else
|
||||
gdb_os_error (p, va_alist)
|
||||
host_callback *p;
|
||||
va_dcl
|
||||
#endif
|
||||
gdb_os_error (host_callback * p, const char *format,...)
|
||||
{
|
||||
if (error_hook)
|
||||
(*error_hook) ();
|
||||
else
|
||||
else
|
||||
{
|
||||
va_list args;
|
||||
#ifdef ANSI_PROTOTYPES
|
||||
va_start (args, format);
|
||||
#else
|
||||
char *format;
|
||||
|
||||
va_start (args);
|
||||
format = va_arg (args, char *);
|
||||
#endif
|
||||
|
||||
error_begin ();
|
||||
vfprintf_filtered (gdb_stderr, format, args);
|
||||
fprintf_filtered (gdb_stderr, "\n");
|
||||
verror (format, args);
|
||||
va_end (args);
|
||||
return_to_top_level (RETURN_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef REGISTER_SIM_REGNO
|
||||
#define REGISTER_SIM_REGNO(N) (N)
|
||||
#endif
|
||||
|
||||
static void
|
||||
gdbsim_fetch_register (regno)
|
||||
int regno;
|
||||
{
|
||||
static int warn_user = 1;
|
||||
if (regno == -1)
|
||||
if (regno == -1)
|
||||
{
|
||||
for (regno = 0; regno < NUM_REGS; regno++)
|
||||
gdbsim_fetch_register (regno);
|
||||
}
|
||||
else if (REGISTER_NAME (regno) != NULL && *REGISTER_NAME (regno) != '\0')
|
||||
else if (REGISTER_NAME (regno) != NULL
|
||||
&& *REGISTER_NAME (regno) != '\0')
|
||||
{
|
||||
char buf[MAX_REGISTER_RAW_SIZE];
|
||||
int nr_bytes = sim_fetch_register (gdbsim_desc, regno, buf, REGISTER_RAW_SIZE (regno));
|
||||
int nr_bytes;
|
||||
if (REGISTER_SIM_REGNO (regno) >= 0)
|
||||
nr_bytes = sim_fetch_register (gdbsim_desc,
|
||||
REGISTER_SIM_REGNO (regno),
|
||||
buf, REGISTER_RAW_SIZE (regno));
|
||||
else
|
||||
nr_bytes = 0;
|
||||
if (nr_bytes == 0)
|
||||
/* register not applicable, supply zero's */
|
||||
memset (buf, 0, MAX_REGISTER_RAW_SIZE);
|
||||
else if (nr_bytes > 0 && nr_bytes != REGISTER_RAW_SIZE (regno)
|
||||
&& warn_user)
|
||||
{
|
||||
printf_unfiltered ("Size of register %s (%d) incorrect (%d instead of %d))",
|
||||
REGISTER_NAME (regno), regno,
|
||||
nr_bytes, REGISTER_RAW_SIZE (regno));
|
||||
fprintf_unfiltered (gdb_stderr,
|
||||
"Size of register %s (%d/%d) incorrect (%d instead of %d))",
|
||||
REGISTER_NAME (regno),
|
||||
regno, REGISTER_SIM_REGNO (regno),
|
||||
nr_bytes, REGISTER_RAW_SIZE (regno));
|
||||
warn_user = 0;
|
||||
}
|
||||
supply_register (regno, buf);
|
||||
@ -375,19 +334,23 @@ static void
|
||||
gdbsim_store_register (regno)
|
||||
int regno;
|
||||
{
|
||||
if (regno == -1)
|
||||
if (regno == -1)
|
||||
{
|
||||
for (regno = 0; regno < NUM_REGS; regno++)
|
||||
gdbsim_store_register (regno);
|
||||
}
|
||||
else if (REGISTER_NAME (regno) != NULL && *REGISTER_NAME (regno) != '\0')
|
||||
else if (REGISTER_NAME (regno) != NULL
|
||||
&& *REGISTER_NAME (regno) != '\0'
|
||||
&& REGISTER_SIM_REGNO (regno) >= 0)
|
||||
{
|
||||
char tmp[MAX_REGISTER_RAW_SIZE];
|
||||
int nr_bytes;
|
||||
read_register_gen (regno, tmp);
|
||||
nr_bytes = sim_store_register (gdbsim_desc, regno, tmp, REGISTER_RAW_SIZE (regno));
|
||||
nr_bytes = sim_store_register (gdbsim_desc,
|
||||
REGISTER_SIM_REGNO (regno),
|
||||
tmp, REGISTER_RAW_SIZE (regno));
|
||||
if (nr_bytes > 0 && nr_bytes != REGISTER_RAW_SIZE (regno))
|
||||
fatal ("Register size different to expected");
|
||||
internal_error ("Register size different to expected");
|
||||
if (sr_get_debug ())
|
||||
{
|
||||
printf_filtered ("gdbsim_store_register: %d", regno);
|
||||
@ -453,44 +416,44 @@ gdbsim_create_inferior (exec_file, args, env)
|
||||
char **env;
|
||||
{
|
||||
int len;
|
||||
char *arg_buf,**argv;
|
||||
char *arg_buf, **argv;
|
||||
|
||||
if (exec_file == 0 || exec_bfd == 0)
|
||||
warning ("No executable file specified.");
|
||||
if (! program_loaded)
|
||||
if (!program_loaded)
|
||||
warning ("No program loaded.");
|
||||
|
||||
if (sr_get_debug ())
|
||||
printf_filtered ("gdbsim_create_inferior: exec_file \"%s\", args \"%s\"\n",
|
||||
(exec_file ? exec_file: "(NULL)"),
|
||||
(exec_file ? exec_file : "(NULL)"),
|
||||
args);
|
||||
|
||||
gdbsim_kill ();
|
||||
gdbsim_kill ();
|
||||
remove_breakpoints ();
|
||||
init_wait_for_inferior ();
|
||||
|
||||
if (exec_file != NULL)
|
||||
{
|
||||
len = strlen (exec_file) + 1 + strlen (args) + 1 + /*slop*/ 10;
|
||||
len = strlen (exec_file) + 1 + strlen (args) + 1 + /*slop */ 10;
|
||||
arg_buf = (char *) alloca (len);
|
||||
arg_buf[0] = '\0';
|
||||
strcat (arg_buf, exec_file);
|
||||
strcat (arg_buf, " ");
|
||||
strcat (arg_buf, args);
|
||||
argv = buildargv (arg_buf);
|
||||
make_cleanup ((make_cleanup_func) freeargv, argv);
|
||||
make_cleanup_freeargv (argv);
|
||||
}
|
||||
else
|
||||
argv = NULL;
|
||||
sim_create_inferior (gdbsim_desc, exec_bfd, argv, env);
|
||||
|
||||
inferior_pid = 42;
|
||||
insert_breakpoints (); /* Needed to get correct instruction in cache */
|
||||
insert_breakpoints (); /* Needed to get correct instruction in cache */
|
||||
|
||||
clear_proceed_status ();
|
||||
|
||||
/* NB: Entry point already set by sim_create_inferior. */
|
||||
proceed ((CORE_ADDR)-1, TARGET_SIGNAL_DEFAULT, 0);
|
||||
proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
|
||||
}
|
||||
|
||||
/* The open routine takes the rest of the parameters from the command,
|
||||
@ -519,13 +482,13 @@ gdbsim_open (args, from_tty)
|
||||
if (gdbsim_desc != NULL)
|
||||
unpush_target (&gdbsim_ops);
|
||||
|
||||
len = (7 + 1 /* gdbsim */
|
||||
len = (7 + 1 /* gdbsim */
|
||||
+ strlen (" -E little")
|
||||
+ strlen (" --architecture=xxxxxxxxxx")
|
||||
+ (args ? strlen (args) : 0)
|
||||
+ 50) /* slack */;
|
||||
+ 50) /* slack */ ;
|
||||
arg_buf = (char *) alloca (len);
|
||||
strcpy (arg_buf, "gdbsim"); /* 7 */
|
||||
strcpy (arg_buf, "gdbsim"); /* 7 */
|
||||
/* Specify the byte order for the target when it is both selectable
|
||||
and explicitly specified by the user (not auto detected). */
|
||||
if (TARGET_BYTE_ORDER_SELECTABLE_P
|
||||
@ -540,7 +503,7 @@ gdbsim_open (args, from_tty)
|
||||
strcat (arg_buf, " -E little");
|
||||
break;
|
||||
default:
|
||||
fatal ("Value of TARGET_BYTE_ORDER unknown");
|
||||
internal_error ("Value of TARGET_BYTE_ORDER unknown");
|
||||
}
|
||||
}
|
||||
/* Specify the architecture of the target when it has been
|
||||
@ -553,13 +516,13 @@ gdbsim_open (args, from_tty)
|
||||
/* finally, any explicit args */
|
||||
if (args)
|
||||
{
|
||||
strcat (arg_buf, " "); /* 1 */
|
||||
strcat (arg_buf, " "); /* 1 */
|
||||
strcat (arg_buf, args);
|
||||
}
|
||||
argv = buildargv (arg_buf);
|
||||
if (argv == NULL)
|
||||
error ("Insufficient memory available to allocate simulator arg list.");
|
||||
make_cleanup ((make_cleanup_func) freeargv, argv);
|
||||
make_cleanup_freeargv (argv);
|
||||
|
||||
init_callbacks ();
|
||||
gdbsim_desc = sim_open (SIM_OPEN_DEBUG, &gdb_callback, exec_bfd, argv);
|
||||
@ -597,6 +560,7 @@ gdbsim_close (quitting)
|
||||
}
|
||||
|
||||
end_callbacks ();
|
||||
generic_mourn_inferior ();
|
||||
}
|
||||
|
||||
/* Takes a program previously attached to and detaches it.
|
||||
@ -609,7 +573,7 @@ gdbsim_close (quitting)
|
||||
Use this when you want to detach and do something else with your gdb. */
|
||||
|
||||
static void
|
||||
gdbsim_detach (args,from_tty)
|
||||
gdbsim_detach (args, from_tty)
|
||||
char *args;
|
||||
int from_tty;
|
||||
{
|
||||
@ -620,7 +584,7 @@ gdbsim_detach (args,from_tty)
|
||||
if (from_tty)
|
||||
printf_filtered ("Ending simulator %s debugging\n", target_shortname);
|
||||
}
|
||||
|
||||
|
||||
/* Resume execution of the target process. STEP says whether to single-step
|
||||
or to run free; SIGGNAL is the signal value (e.g. SIGINT) to be given
|
||||
to the target, or zero for no signal. */
|
||||
@ -644,7 +608,7 @@ gdbsim_resume (pid, step, siggnal)
|
||||
}
|
||||
|
||||
/* Notify the simulator of an asynchronous request to stop.
|
||||
|
||||
|
||||
The simulator shall ensure that the stop request is eventually
|
||||
delivered to the simulator. If the call is made while the
|
||||
simulator is not running then the stop request is processed when
|
||||
@ -655,7 +619,7 @@ gdbsim_resume (pid, step, siggnal)
|
||||
static void
|
||||
gdbsim_stop ()
|
||||
{
|
||||
if (! sim_stop (gdbsim_desc))
|
||||
if (!sim_stop (gdbsim_desc))
|
||||
{
|
||||
quit ();
|
||||
}
|
||||
@ -668,10 +632,13 @@ static int
|
||||
gdb_os_poll_quit (p)
|
||||
host_callback *p;
|
||||
{
|
||||
if (ui_loop_hook != NULL)
|
||||
ui_loop_hook (0);
|
||||
|
||||
notice_quit ();
|
||||
if (quit_flag) /* gdb's idea of quit */
|
||||
if (quit_flag) /* gdb's idea of quit */
|
||||
{
|
||||
quit_flag = 0; /* we've stolen it */
|
||||
quit_flag = 0; /* we've stolen it */
|
||||
return 1;
|
||||
}
|
||||
else if (immediate_quit)
|
||||
@ -748,7 +715,7 @@ gdbsim_wait (pid, status)
|
||||
case sim_signalled:
|
||||
status->kind = TARGET_WAITKIND_SIGNALLED;
|
||||
/* The signal in sigrc is a host signal. That probably
|
||||
should be fixed. */
|
||||
should be fixed. */
|
||||
status->value.sig = target_signal_from_host (sigrc);
|
||||
break;
|
||||
case sim_running:
|
||||
@ -778,29 +745,32 @@ gdbsim_xfer_inferior_memory (memaddr, myaddr, len, write, target)
|
||||
char *myaddr;
|
||||
int len;
|
||||
int write;
|
||||
struct target_ops *target; /* ignored */
|
||||
struct target_ops *target; /* ignored */
|
||||
{
|
||||
if (! program_loaded)
|
||||
if (!program_loaded)
|
||||
error ("No program loaded.");
|
||||
|
||||
if (sr_get_debug ())
|
||||
{
|
||||
printf_filtered ("gdbsim_xfer_inferior_memory: myaddr 0x%x, memaddr 0x%x, len %d, write %d\n",
|
||||
myaddr, memaddr, len, write);
|
||||
/* FIXME: Send to something other than STDOUT? */
|
||||
printf_filtered ("gdbsim_xfer_inferior_memory: myaddr 0x");
|
||||
gdb_print_host_address (myaddr, gdb_stdout);
|
||||
printf_filtered (", memaddr 0x%s, len %d, write %d\n",
|
||||
paddr_nz (memaddr), len, write);
|
||||
if (sr_get_debug () && write)
|
||||
dump_mem(myaddr, len);
|
||||
dump_mem (myaddr, len);
|
||||
}
|
||||
|
||||
if (write)
|
||||
{
|
||||
len = sim_write (gdbsim_desc, memaddr, myaddr, len);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
len = sim_read (gdbsim_desc, memaddr, myaddr, len);
|
||||
if (sr_get_debug () && len > 0)
|
||||
dump_mem(myaddr, len);
|
||||
}
|
||||
dump_mem (myaddr, len);
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
@ -827,8 +797,8 @@ gdbsim_files_info (target)
|
||||
/* Clear the simulator's notion of what the break points are. */
|
||||
|
||||
static void
|
||||
gdbsim_mourn_inferior ()
|
||||
{
|
||||
gdbsim_mourn_inferior ()
|
||||
{
|
||||
if (sr_get_debug ())
|
||||
printf_filtered ("gdbsim_mourn_inferior:\n");
|
||||
|
||||
@ -913,45 +883,45 @@ simulator_command (args, from_tty)
|
||||
|
||||
/* Invalidate the register cache, in case the simulator command does
|
||||
something funny. */
|
||||
registers_changed ();
|
||||
registers_changed ();
|
||||
}
|
||||
|
||||
/* Define the target subroutine names */
|
||||
|
||||
struct target_ops gdbsim_ops ;
|
||||
struct target_ops gdbsim_ops;
|
||||
|
||||
static void
|
||||
init_gdbsim_ops(void)
|
||||
static void
|
||||
init_gdbsim_ops (void)
|
||||
{
|
||||
gdbsim_ops.to_shortname = "sim";
|
||||
gdbsim_ops.to_longname = "simulator";
|
||||
gdbsim_ops.to_doc = "Use the compiled-in simulator.";
|
||||
gdbsim_ops.to_open = gdbsim_open;
|
||||
gdbsim_ops.to_close = gdbsim_close;
|
||||
gdbsim_ops.to_attach = NULL;
|
||||
gdbsim_ops.to_post_attach = NULL;
|
||||
gdbsim_ops.to_require_attach = NULL;
|
||||
gdbsim_ops.to_detach = gdbsim_detach;
|
||||
gdbsim_ops.to_require_detach = NULL;
|
||||
gdbsim_ops.to_resume = gdbsim_resume;
|
||||
gdbsim_ops.to_wait = gdbsim_wait;
|
||||
gdbsim_ops.to_post_wait = NULL;
|
||||
gdbsim_ops.to_fetch_registers = gdbsim_fetch_register;
|
||||
gdbsim_ops.to_store_registers = gdbsim_store_register;
|
||||
gdbsim_ops.to_prepare_to_store = gdbsim_prepare_to_store;
|
||||
gdbsim_ops.to_xfer_memory = gdbsim_xfer_inferior_memory;
|
||||
gdbsim_ops.to_files_info = gdbsim_files_info;
|
||||
gdbsim_ops.to_insert_breakpoint = gdbsim_insert_breakpoint;
|
||||
gdbsim_ops.to_remove_breakpoint = gdbsim_remove_breakpoint;
|
||||
gdbsim_ops.to_terminal_init = NULL;
|
||||
gdbsim_ops.to_terminal_inferior = NULL;
|
||||
gdbsim_ops.to_terminal_ours_for_output = NULL;
|
||||
gdbsim_ops.to_terminal_ours = NULL;
|
||||
gdbsim_ops.to_terminal_info = NULL;
|
||||
gdbsim_ops.to_kill = gdbsim_kill;
|
||||
gdbsim_ops.to_load = gdbsim_load;
|
||||
gdbsim_ops.to_lookup_symbol = NULL;
|
||||
gdbsim_ops.to_create_inferior = gdbsim_create_inferior;
|
||||
gdbsim_ops.to_shortname = "sim";
|
||||
gdbsim_ops.to_longname = "simulator";
|
||||
gdbsim_ops.to_doc = "Use the compiled-in simulator.";
|
||||
gdbsim_ops.to_open = gdbsim_open;
|
||||
gdbsim_ops.to_close = gdbsim_close;
|
||||
gdbsim_ops.to_attach = NULL;
|
||||
gdbsim_ops.to_post_attach = NULL;
|
||||
gdbsim_ops.to_require_attach = NULL;
|
||||
gdbsim_ops.to_detach = gdbsim_detach;
|
||||
gdbsim_ops.to_require_detach = NULL;
|
||||
gdbsim_ops.to_resume = gdbsim_resume;
|
||||
gdbsim_ops.to_wait = gdbsim_wait;
|
||||
gdbsim_ops.to_post_wait = NULL;
|
||||
gdbsim_ops.to_fetch_registers = gdbsim_fetch_register;
|
||||
gdbsim_ops.to_store_registers = gdbsim_store_register;
|
||||
gdbsim_ops.to_prepare_to_store = gdbsim_prepare_to_store;
|
||||
gdbsim_ops.to_xfer_memory = gdbsim_xfer_inferior_memory;
|
||||
gdbsim_ops.to_files_info = gdbsim_files_info;
|
||||
gdbsim_ops.to_insert_breakpoint = gdbsim_insert_breakpoint;
|
||||
gdbsim_ops.to_remove_breakpoint = gdbsim_remove_breakpoint;
|
||||
gdbsim_ops.to_terminal_init = NULL;
|
||||
gdbsim_ops.to_terminal_inferior = NULL;
|
||||
gdbsim_ops.to_terminal_ours_for_output = NULL;
|
||||
gdbsim_ops.to_terminal_ours = NULL;
|
||||
gdbsim_ops.to_terminal_info = NULL;
|
||||
gdbsim_ops.to_kill = gdbsim_kill;
|
||||
gdbsim_ops.to_load = gdbsim_load;
|
||||
gdbsim_ops.to_lookup_symbol = NULL;
|
||||
gdbsim_ops.to_create_inferior = gdbsim_create_inferior;
|
||||
gdbsim_ops.to_post_startup_inferior = NULL;
|
||||
gdbsim_ops.to_acknowledge_created_inferior = NULL;
|
||||
gdbsim_ops.to_clone_and_follow_inferior = NULL;
|
||||
@ -969,23 +939,23 @@ init_gdbsim_ops(void)
|
||||
gdbsim_ops.to_has_execd = NULL;
|
||||
gdbsim_ops.to_reported_exec_events_per_exec_call = NULL;
|
||||
gdbsim_ops.to_has_exited = NULL;
|
||||
gdbsim_ops.to_mourn_inferior = gdbsim_mourn_inferior;
|
||||
gdbsim_ops.to_can_run = 0;
|
||||
gdbsim_ops.to_notice_signals = 0;
|
||||
gdbsim_ops.to_thread_alive = 0;
|
||||
gdbsim_ops.to_stop = gdbsim_stop;
|
||||
gdbsim_ops.to_pid_to_exec_file = NULL;
|
||||
gdbsim_ops.to_core_file_to_sym_file = NULL;
|
||||
gdbsim_ops.to_stratum = process_stratum;
|
||||
gdbsim_ops.DONT_USE = NULL;
|
||||
gdbsim_ops.to_has_all_memory = 1;
|
||||
gdbsim_ops.to_has_memory = 1;
|
||||
gdbsim_ops.to_has_stack = 1;
|
||||
gdbsim_ops.to_has_registers = 1;
|
||||
gdbsim_ops.to_has_execution = 1;
|
||||
gdbsim_ops.to_sections = NULL;
|
||||
gdbsim_ops.to_sections_end = NULL;
|
||||
gdbsim_ops.to_magic = OPS_MAGIC;
|
||||
gdbsim_ops.to_mourn_inferior = gdbsim_mourn_inferior;
|
||||
gdbsim_ops.to_can_run = 0;
|
||||
gdbsim_ops.to_notice_signals = 0;
|
||||
gdbsim_ops.to_thread_alive = 0;
|
||||
gdbsim_ops.to_stop = gdbsim_stop;
|
||||
gdbsim_ops.to_pid_to_exec_file = NULL;
|
||||
gdbsim_ops.to_core_file_to_sym_file = NULL;
|
||||
gdbsim_ops.to_stratum = process_stratum;
|
||||
gdbsim_ops.DONT_USE = NULL;
|
||||
gdbsim_ops.to_has_all_memory = 1;
|
||||
gdbsim_ops.to_has_memory = 1;
|
||||
gdbsim_ops.to_has_stack = 1;
|
||||
gdbsim_ops.to_has_registers = 1;
|
||||
gdbsim_ops.to_has_execution = 1;
|
||||
gdbsim_ops.to_sections = NULL;
|
||||
gdbsim_ops.to_sections_end = NULL;
|
||||
gdbsim_ops.to_magic = OPS_MAGIC;
|
||||
|
||||
#ifdef TARGET_REDEFINE_DEFAULT_OPS
|
||||
TARGET_REDEFINE_DEFAULT_OPS (&gdbsim_ops);
|
||||
@ -995,9 +965,9 @@ init_gdbsim_ops(void)
|
||||
void
|
||||
_initialize_remote_sim ()
|
||||
{
|
||||
init_gdbsim_ops() ;
|
||||
init_gdbsim_ops ();
|
||||
add_target (&gdbsim_ops);
|
||||
|
||||
add_com ("sim <command>", class_obscure, simulator_command,
|
||||
"Send a command to the simulator.");
|
||||
"Send a command to the simulator.");
|
||||
}
|
||||
|
@ -2,27 +2,28 @@
|
||||
Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
|
||||
Contributed by Cygnus Support. Written by Jim Kingdon for Cygnus.
|
||||
|
||||
This file is part of GDB.
|
||||
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 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.
|
||||
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. */
|
||||
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. */
|
||||
|
||||
/* This file was derived from remote-eb.c, which did a similar job, but for
|
||||
an AMD-29K running EBMON. That file was in turn derived from remote.c
|
||||
as mentioned in the following comment (left in for comic relief):
|
||||
|
||||
"This is like remote.c but is for an esoteric situation--
|
||||
"This is like remote.c but is for an esoteric situation--
|
||||
having an a29k board in a PC hooked up to a unix machine with
|
||||
a serial line, and running ctty com1 on the PC, through which
|
||||
the unix machine can run ebmon. Not to mention that the PC
|
||||
@ -37,22 +38,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#include "defs.h"
|
||||
#include "gdbcore.h"
|
||||
#include "target.h"
|
||||
#include "wait.h"
|
||||
#ifdef ANSI_PROTOTYPES
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
#include "gdb_wait.h"
|
||||
#include <signal.h>
|
||||
#include "gdb_string.h"
|
||||
#include <sys/types.h>
|
||||
#include "serial.h"
|
||||
|
||||
extern struct target_ops st2000_ops; /* Forward declaration */
|
||||
extern struct target_ops st2000_ops; /* Forward declaration */
|
||||
|
||||
static void st2000_close();
|
||||
static void st2000_fetch_register();
|
||||
static void st2000_store_register();
|
||||
static void st2000_close ();
|
||||
static void st2000_fetch_register ();
|
||||
static void st2000_store_register ();
|
||||
|
||||
#define LOG_FILE "st2000.log"
|
||||
#if defined (LOG_FILE)
|
||||
@ -70,44 +66,33 @@ static serial_t st2000_desc;
|
||||
/* Send data to stdebug. Works just like printf. */
|
||||
|
||||
static void
|
||||
#ifdef ANSI_PROTOTYPES
|
||||
printf_stdebug(char *pattern, ...)
|
||||
#else
|
||||
printf_stdebug(va_alist)
|
||||
va_dcl
|
||||
#endif
|
||||
printf_stdebug (char *pattern,...)
|
||||
{
|
||||
va_list args;
|
||||
char buf[200];
|
||||
|
||||
#ifdef ANSI_PROTOTYPES
|
||||
va_start(args, pattern);
|
||||
#else
|
||||
char *pattern;
|
||||
va_start(args);
|
||||
pattern = va_arg(args, char *);
|
||||
#endif
|
||||
va_start (args, pattern);
|
||||
|
||||
vsprintf(buf, pattern, args);
|
||||
va_end(args);
|
||||
vsprintf (buf, pattern, args);
|
||||
va_end (args);
|
||||
|
||||
if (SERIAL_WRITE(st2000_desc, buf, strlen(buf)))
|
||||
fprintf(stderr, "SERIAL_WRITE failed: %s\n", safe_strerror(errno));
|
||||
if (SERIAL_WRITE (st2000_desc, buf, strlen (buf)))
|
||||
fprintf (stderr, "SERIAL_WRITE failed: %s\n", safe_strerror (errno));
|
||||
}
|
||||
|
||||
/* Read a character from the remote system, doing all the fancy timeout
|
||||
stuff. */
|
||||
|
||||
static int
|
||||
readchar(timeout)
|
||||
readchar (timeout)
|
||||
int timeout;
|
||||
{
|
||||
int c;
|
||||
|
||||
c = SERIAL_READCHAR(st2000_desc, timeout);
|
||||
c = SERIAL_READCHAR (st2000_desc, timeout);
|
||||
|
||||
#ifdef LOG_FILE
|
||||
putc(c & 0x7f, log_file);
|
||||
putc (c & 0x7f, log_file);
|
||||
#endif
|
||||
|
||||
if (c >= 0)
|
||||
@ -118,17 +103,17 @@ readchar(timeout)
|
||||
if (timeout == 0)
|
||||
return c; /* Polls shouldn't generate timeout errors */
|
||||
|
||||
error("Timeout reading from remote system.");
|
||||
error ("Timeout reading from remote system.");
|
||||
}
|
||||
|
||||
perror_with_name("remote-st2000");
|
||||
perror_with_name ("remote-st2000");
|
||||
}
|
||||
|
||||
/* Scan input from the remote system, until STRING is found. If DISCARD is
|
||||
non-zero, then discard non-matching input, else print it out.
|
||||
Let the user break out immediately. */
|
||||
static void
|
||||
expect(string, discard)
|
||||
expect (string, discard)
|
||||
char *string;
|
||||
int discard;
|
||||
{
|
||||
@ -138,7 +123,7 @@ expect(string, discard)
|
||||
immediate_quit = 1;
|
||||
while (1)
|
||||
{
|
||||
c = readchar(timeout);
|
||||
c = readchar (timeout);
|
||||
if (c == *p++)
|
||||
{
|
||||
if (*p == '\0')
|
||||
@ -151,9 +136,9 @@ expect(string, discard)
|
||||
{
|
||||
if (!discard)
|
||||
{
|
||||
fwrite(string, 1, (p - 1) - string, stdout);
|
||||
putchar((char)c);
|
||||
fflush(stdout);
|
||||
fwrite (string, 1, (p - 1) - string, stdout);
|
||||
putchar ((char) c);
|
||||
fflush (stdout);
|
||||
}
|
||||
p = string;
|
||||
}
|
||||
@ -175,13 +160,13 @@ expect(string, discard)
|
||||
necessary to prevent getting into states from which we can't
|
||||
recover. */
|
||||
static void
|
||||
expect_prompt(discard)
|
||||
expect_prompt (discard)
|
||||
int discard;
|
||||
{
|
||||
#if defined (LOG_FILE)
|
||||
/* This is a convenient place to do this. The idea is to do it often
|
||||
enough that we never lose much data if we terminate abnormally. */
|
||||
fflush(log_file);
|
||||
fflush (log_file);
|
||||
#endif
|
||||
expect ("dbug> ", discard);
|
||||
}
|
||||
@ -189,13 +174,13 @@ expect_prompt(discard)
|
||||
/* Get a hex digit from the remote system & return its value.
|
||||
If ignore_space is nonzero, ignore spaces (not newline, tab, etc). */
|
||||
static int
|
||||
get_hex_digit(ignore_space)
|
||||
get_hex_digit (ignore_space)
|
||||
int ignore_space;
|
||||
{
|
||||
int ch;
|
||||
while (1)
|
||||
{
|
||||
ch = readchar(timeout);
|
||||
ch = readchar (timeout);
|
||||
if (ch >= '0' && ch <= '9')
|
||||
return ch - '0';
|
||||
else if (ch >= 'A' && ch <= 'F')
|
||||
@ -206,8 +191,8 @@ get_hex_digit(ignore_space)
|
||||
;
|
||||
else
|
||||
{
|
||||
expect_prompt(1);
|
||||
error("Invalid hex digit from remote system.");
|
||||
expect_prompt (1);
|
||||
error ("Invalid hex digit from remote system.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -238,7 +223,7 @@ get_hex_regs (n, regno)
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
int j;
|
||||
|
||||
|
||||
val = 0;
|
||||
for (j = 0; j < 8; j++)
|
||||
val = (val << 4) + get_hex_digit (j == 0);
|
||||
@ -257,10 +242,10 @@ st2000_create_inferior (execfile, args, env)
|
||||
int entry_pt;
|
||||
|
||||
if (args && *args)
|
||||
error("Can't pass arguments to remote STDEBUG process");
|
||||
error ("Can't pass arguments to remote STDEBUG process");
|
||||
|
||||
if (execfile == 0 || exec_bfd == 0)
|
||||
error("No executable file specified");
|
||||
error ("No executable file specified");
|
||||
|
||||
entry_pt = (int) bfd_get_start_address (exec_bfd);
|
||||
|
||||
@ -281,7 +266,7 @@ st2000_create_inferior (execfile, args, env)
|
||||
|
||||
/* insert_step_breakpoint (); FIXME, do we need this? */
|
||||
/* Let 'er rip... */
|
||||
proceed ((CORE_ADDR)entry_pt, TARGET_SIGNAL_DEFAULT, 0);
|
||||
proceed ((CORE_ADDR) entry_pt, TARGET_SIGNAL_DEFAULT, 0);
|
||||
}
|
||||
|
||||
/* Open a connection to a remote debugger.
|
||||
@ -291,33 +276,33 @@ static int baudrate = 9600;
|
||||
static char dev_name[100];
|
||||
|
||||
static void
|
||||
st2000_open(args, from_tty)
|
||||
st2000_open (args, from_tty)
|
||||
char *args;
|
||||
int from_tty;
|
||||
{
|
||||
int n;
|
||||
char junk[100];
|
||||
|
||||
target_preopen(from_tty);
|
||||
|
||||
n = sscanf(args, " %s %d %s", dev_name, &baudrate, junk);
|
||||
target_preopen (from_tty);
|
||||
|
||||
n = sscanf (args, " %s %d %s", dev_name, &baudrate, junk);
|
||||
|
||||
if (n != 2)
|
||||
error("Bad arguments. Usage: target st2000 <device> <speed>\n\
|
||||
error ("Bad arguments. Usage: target st2000 <device> <speed>\n\
|
||||
or target st2000 <host> <port>\n");
|
||||
|
||||
st2000_close(0);
|
||||
st2000_close (0);
|
||||
|
||||
st2000_desc = SERIAL_OPEN(dev_name);
|
||||
st2000_desc = SERIAL_OPEN (dev_name);
|
||||
|
||||
if (!st2000_desc)
|
||||
perror_with_name(dev_name);
|
||||
perror_with_name (dev_name);
|
||||
|
||||
SERIAL_SETBAUDRATE(st2000_desc, baudrate);
|
||||
SERIAL_SETBAUDRATE (st2000_desc, baudrate);
|
||||
|
||||
SERIAL_RAW(st2000_desc);
|
||||
SERIAL_RAW (st2000_desc);
|
||||
|
||||
push_target(&st2000_ops);
|
||||
push_target (&st2000_ops);
|
||||
|
||||
#if defined (LOG_FILE)
|
||||
log_file = fopen (LOG_FILE, "w");
|
||||
@ -326,13 +311,13 @@ or target st2000 <host> <port>\n");
|
||||
#endif
|
||||
|
||||
/* Hello? Are you there? */
|
||||
printf_stdebug("\003"); /* ^C wakes up dbug */
|
||||
|
||||
expect_prompt(1);
|
||||
printf_stdebug ("\003"); /* ^C wakes up dbug */
|
||||
|
||||
expect_prompt (1);
|
||||
|
||||
if (from_tty)
|
||||
printf("Remote %s connected to %s\n", target_shortname,
|
||||
dev_name);
|
||||
printf ("Remote %s connected to %s\n", target_shortname,
|
||||
dev_name);
|
||||
}
|
||||
|
||||
/* Close out all files and local state before this target loses control. */
|
||||
@ -341,15 +326,16 @@ static void
|
||||
st2000_close (quitting)
|
||||
int quitting;
|
||||
{
|
||||
SERIAL_CLOSE(st2000_desc);
|
||||
SERIAL_CLOSE (st2000_desc);
|
||||
|
||||
#if defined (LOG_FILE)
|
||||
if (log_file) {
|
||||
if (ferror(log_file))
|
||||
fprintf(stderr, "Error writing log file.\n");
|
||||
if (fclose(log_file) != 0)
|
||||
fprintf(stderr, "Error closing log file.\n");
|
||||
}
|
||||
if (log_file)
|
||||
{
|
||||
if (ferror (log_file))
|
||||
fprintf (stderr, "Error writing log file.\n");
|
||||
if (fclose (log_file) != 0)
|
||||
fprintf (stderr, "Error closing log file.\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -360,11 +346,11 @@ static void
|
||||
st2000_detach (from_tty)
|
||||
int from_tty;
|
||||
{
|
||||
pop_target(); /* calls st2000_close to do the real work */
|
||||
pop_target (); /* calls st2000_close to do the real work */
|
||||
if (from_tty)
|
||||
printf ("Ending remote %s debugging\n", target_shortname);
|
||||
}
|
||||
|
||||
|
||||
/* Tell the remote machine to resume. */
|
||||
|
||||
static void
|
||||
@ -398,9 +384,9 @@ st2000_wait (status)
|
||||
status->kind = TARGET_WAITKIND_EXITED;
|
||||
status->value.integer = 0;
|
||||
|
||||
timeout = 0; /* Don't time out -- user program is running. */
|
||||
timeout = 0; /* Don't time out -- user program is running. */
|
||||
|
||||
expect_prompt(0); /* Wait for prompt, outputting extraneous text */
|
||||
expect_prompt (0); /* Wait for prompt, outputting extraneous text */
|
||||
|
||||
status->kind = TARGET_WAITKIND_STOPPED;
|
||||
status->value.sig = TARGET_SIGNAL_TRAP;
|
||||
@ -425,7 +411,7 @@ get_reg_name (regno)
|
||||
b = buf;
|
||||
|
||||
for (p = REGISTER_NAME (regno); *p; p++)
|
||||
*b++ = toupper(*p);
|
||||
*b++ = toupper (*p);
|
||||
*b = '\000';
|
||||
|
||||
return buf;
|
||||
@ -442,7 +428,7 @@ st2000_fetch_registers ()
|
||||
very often... I'll clean it up later. */
|
||||
|
||||
for (regno = 0; regno <= PC_REGNUM; regno++)
|
||||
st2000_fetch_register(regno);
|
||||
st2000_fetch_register (regno);
|
||||
}
|
||||
|
||||
/* Fetch register REGNO, or all registers if REGNO is -1.
|
||||
@ -473,7 +459,7 @@ st2000_store_registers ()
|
||||
int regno;
|
||||
|
||||
for (regno = 0; regno <= PC_REGNUM; regno++)
|
||||
st2000_store_register(regno);
|
||||
st2000_store_register (regno);
|
||||
|
||||
registers_changed ();
|
||||
}
|
||||
@ -535,7 +521,7 @@ st2000_write_inferior_memory (memaddr, myaddr, len)
|
||||
/* Read LEN bytes from inferior memory at MEMADDR. Put the result
|
||||
at debugger address MYADDR. Returns length moved. */
|
||||
static int
|
||||
st2000_read_inferior_memory(memaddr, myaddr, len)
|
||||
st2000_read_inferior_memory (memaddr, myaddr, len)
|
||||
CORE_ADDR memaddr;
|
||||
char *myaddr;
|
||||
int len;
|
||||
@ -560,11 +546,12 @@ st2000_read_inferior_memory(memaddr, myaddr, len)
|
||||
st2000_read_bytes (CORE_ADDR_MAX - 3, foo, 4)
|
||||
doesn't need to work. Detect it and give up if there's an attempt
|
||||
to do that. */
|
||||
if (((memaddr - 1) + len) < memaddr) {
|
||||
errno = EIO;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (((memaddr - 1) + len) < memaddr)
|
||||
{
|
||||
errno = EIO;
|
||||
return 0;
|
||||
}
|
||||
|
||||
startaddr = memaddr;
|
||||
count = 0;
|
||||
while (count < len)
|
||||
@ -595,7 +582,7 @@ st2000_xfer_inferior_memory (memaddr, myaddr, len, write, target)
|
||||
char *myaddr;
|
||||
int len;
|
||||
int write;
|
||||
struct target_ops *target; /* ignored */
|
||||
struct target_ops *target; /* ignored */
|
||||
{
|
||||
if (write)
|
||||
return st2000_write_inferior_memory (memaddr, myaddr, len);
|
||||
@ -608,7 +595,7 @@ st2000_kill (args, from_tty)
|
||||
char *args;
|
||||
int from_tty;
|
||||
{
|
||||
return; /* Ignore attempts to kill target system */
|
||||
return; /* Ignore attempts to kill target system */
|
||||
}
|
||||
|
||||
/* Clean up when a program exits.
|
||||
@ -627,7 +614,8 @@ st2000_mourn_inferior ()
|
||||
|
||||
#define MAX_STDEBUG_BREAKPOINTS 16
|
||||
|
||||
static CORE_ADDR breakaddr[MAX_STDEBUG_BREAKPOINTS] = {0};
|
||||
static CORE_ADDR breakaddr[MAX_STDEBUG_BREAKPOINTS] =
|
||||
{0};
|
||||
|
||||
static int
|
||||
st2000_insert_breakpoint (addr, shadow)
|
||||
@ -646,12 +634,12 @@ st2000_insert_breakpoint (addr, shadow)
|
||||
breakaddr[i] = addr;
|
||||
|
||||
st2000_read_inferior_memory (bp_addr, shadow, bp_size);
|
||||
printf_stdebug("BR %x H\r", addr);
|
||||
expect_prompt(1);
|
||||
printf_stdebug ("BR %x H\r", addr);
|
||||
expect_prompt (1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
fprintf(stderr, "Too many breakpoints (> 16) for STDBUG\n");
|
||||
fprintf (stderr, "Too many breakpoints (> 16) for STDBUG\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -667,12 +655,12 @@ st2000_remove_breakpoint (addr, shadow)
|
||||
{
|
||||
breakaddr[i] = 0;
|
||||
|
||||
printf_stdebug("CB %d\r", i);
|
||||
expect_prompt(1);
|
||||
printf_stdebug ("CB %d\r", i);
|
||||
expect_prompt (1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
fprintf(stderr, "Can't find breakpoint associated with 0x%x\n", addr);
|
||||
fprintf (stderr, "Can't find breakpoint associated with 0x%x\n", addr);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -682,29 +670,29 @@ st2000_remove_breakpoint (addr, shadow)
|
||||
|
||||
static void
|
||||
st2000_command (args, fromtty)
|
||||
char *args;
|
||||
int fromtty;
|
||||
char *args;
|
||||
int fromtty;
|
||||
{
|
||||
if (!st2000_desc)
|
||||
error("st2000 target not open.");
|
||||
|
||||
error ("st2000 target not open.");
|
||||
|
||||
if (!args)
|
||||
error("Missing command.");
|
||||
|
||||
printf_stdebug("%s\r", args);
|
||||
expect_prompt(0);
|
||||
error ("Missing command.");
|
||||
|
||||
printf_stdebug ("%s\r", args);
|
||||
expect_prompt (0);
|
||||
}
|
||||
|
||||
/* Connect the user directly to STDBUG. This command acts just like the
|
||||
'cu' or 'tip' command. Use <CR>~. or <CR>~^D to break out. */
|
||||
|
||||
/*static struct ttystate ttystate;*/
|
||||
/*static struct ttystate ttystate; */
|
||||
|
||||
static void
|
||||
cleanup_tty()
|
||||
cleanup_tty ()
|
||||
{
|
||||
printf("\r\n[Exiting connect mode]\r\n");
|
||||
/* SERIAL_RESTORE(0, &ttystate);*/
|
||||
printf ("\r\n[Exiting connect mode]\r\n");
|
||||
/* SERIAL_RESTORE(0, &ttystate); */
|
||||
}
|
||||
|
||||
#if 0
|
||||
@ -712,50 +700,50 @@ cleanup_tty()
|
||||
|
||||
static void
|
||||
connect_command (args, fromtty)
|
||||
char *args;
|
||||
int fromtty;
|
||||
char *args;
|
||||
int fromtty;
|
||||
{
|
||||
fd_set readfds;
|
||||
int numfds;
|
||||
int c;
|
||||
char cur_esc = 0;
|
||||
|
||||
dont_repeat();
|
||||
dont_repeat ();
|
||||
|
||||
if (st2000_desc < 0)
|
||||
error("st2000 target not open.");
|
||||
|
||||
error ("st2000 target not open.");
|
||||
|
||||
if (args)
|
||||
fprintf("This command takes no args. They have been ignored.\n");
|
||||
|
||||
printf("[Entering connect mode. Use ~. or ~^D to escape]\n");
|
||||
fprintf ("This command takes no args. They have been ignored.\n");
|
||||
|
||||
serial_raw(0, &ttystate);
|
||||
printf ("[Entering connect mode. Use ~. or ~^D to escape]\n");
|
||||
|
||||
make_cleanup(cleanup_tty, 0);
|
||||
serial_raw (0, &ttystate);
|
||||
|
||||
FD_ZERO(&readfds);
|
||||
make_cleanup (cleanup_tty, 0);
|
||||
|
||||
FD_ZERO (&readfds);
|
||||
|
||||
while (1)
|
||||
{
|
||||
do
|
||||
{
|
||||
FD_SET(0, &readfds);
|
||||
FD_SET(st2000_desc, &readfds);
|
||||
numfds = select(sizeof(readfds)*8, &readfds, 0, 0, 0);
|
||||
FD_SET (0, &readfds);
|
||||
FD_SET (DEPRECATED_SERIAL_FD (st2000_desc), &readfds);
|
||||
numfds = select (sizeof (readfds) * 8, &readfds, 0, 0, 0);
|
||||
}
|
||||
while (numfds == 0);
|
||||
|
||||
if (numfds < 0)
|
||||
perror_with_name("select");
|
||||
perror_with_name ("select");
|
||||
|
||||
if (FD_ISSET(0, &readfds))
|
||||
if (FD_ISSET (0, &readfds))
|
||||
{ /* tty input, send to stdebug */
|
||||
c = getchar();
|
||||
c = getchar ();
|
||||
if (c < 0)
|
||||
perror_with_name("connect");
|
||||
perror_with_name ("connect");
|
||||
|
||||
printf_stdebug("%c", c);
|
||||
printf_stdebug ("%c", c);
|
||||
switch (cur_esc)
|
||||
{
|
||||
case 0:
|
||||
@ -776,16 +764,16 @@ connect_command (args, fromtty)
|
||||
}
|
||||
}
|
||||
|
||||
if (FD_ISSET(st2000_desc, &readfds))
|
||||
if (FD_ISSET (DEPRECATED_SERIAL_FD (st2000_desc), &readfds))
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
c = readchar(0);
|
||||
c = readchar (0);
|
||||
if (c < 0)
|
||||
break;
|
||||
putchar(c);
|
||||
putchar (c);
|
||||
}
|
||||
fflush(stdout);
|
||||
fflush (stdout);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -793,43 +781,43 @@ connect_command (args, fromtty)
|
||||
|
||||
/* Define the target subroutine names */
|
||||
|
||||
struct target_ops st2000_ops ;
|
||||
struct target_ops st2000_ops;
|
||||
|
||||
static void
|
||||
init_st2000_ops(void)
|
||||
static void
|
||||
init_st2000_ops (void)
|
||||
{
|
||||
st2000_ops.to_shortname = "st2000";
|
||||
st2000_ops.to_longname = "Remote serial Tandem ST2000 target";
|
||||
st2000_ops.to_doc = "Use a remote computer running STDEBUG connected by a serial line;\n\
|
||||
st2000_ops.to_shortname = "st2000";
|
||||
st2000_ops.to_longname = "Remote serial Tandem ST2000 target";
|
||||
st2000_ops.to_doc = "Use a remote computer running STDEBUG connected by a serial line;\n\
|
||||
or a network connection.\n\
|
||||
Arguments are the name of the device for the serial line,\n\
|
||||
the speed to connect at in bits per second." ;
|
||||
st2000_ops.to_open = st2000_open;
|
||||
st2000_ops.to_close = st2000_close;
|
||||
st2000_ops.to_attach = 0;
|
||||
the speed to connect at in bits per second.";
|
||||
st2000_ops.to_open = st2000_open;
|
||||
st2000_ops.to_close = st2000_close;
|
||||
st2000_ops.to_attach = 0;
|
||||
st2000_run_ops.to_post_attach = NULL;
|
||||
st2000_ops.to_require_attach = NULL;
|
||||
st2000_ops.to_detach = st2000_detach;
|
||||
st2000_ops.to_detach = st2000_detach;
|
||||
st2000_ops.to_require_detach = NULL;
|
||||
st2000_ops.to_resume = st2000_resume;
|
||||
st2000_ops.to_wait = st2000_wait;
|
||||
st2000_ops.to_resume = st2000_resume;
|
||||
st2000_ops.to_wait = st2000_wait;
|
||||
st2000_ops.to_post_wait = NULL;
|
||||
st2000_ops.to_fetch_registers = st2000_fetch_register;
|
||||
st2000_ops.to_store_registers = st2000_store_register;
|
||||
st2000_ops.to_prepare_to_store = st2000_prepare_to_store;
|
||||
st2000_ops.to_xfer_memory = st2000_xfer_inferior_memory;
|
||||
st2000_ops.to_files_info = st2000_files_info;
|
||||
st2000_ops.to_insert_breakpoint = st2000_insert_breakpoint;
|
||||
st2000_ops.to_remove_breakpoint = st2000_remove_breakpoint; /* Breakpoints */
|
||||
st2000_ops.to_terminal_init = 0;
|
||||
st2000_ops.to_terminal_inferior = 0;
|
||||
st2000_ops.to_terminal_ours_for_output = 0;
|
||||
st2000_ops.to_terminal_ours = 0;
|
||||
st2000_ops.to_terminal_info = 0; /* Terminal handling */
|
||||
st2000_ops.to_kill = st2000_kill;
|
||||
st2000_ops.to_load = 0; /* load */
|
||||
st2000_ops.to_lookup_symbol = 0; /* lookup_symbol */
|
||||
st2000_ops.to_create_inferior = st2000_create_inferior;
|
||||
st2000_ops.to_fetch_registers = st2000_fetch_register;
|
||||
st2000_ops.to_store_registers = st2000_store_register;
|
||||
st2000_ops.to_prepare_to_store = st2000_prepare_to_store;
|
||||
st2000_ops.to_xfer_memory = st2000_xfer_inferior_memory;
|
||||
st2000_ops.to_files_info = st2000_files_info;
|
||||
st2000_ops.to_insert_breakpoint = st2000_insert_breakpoint;
|
||||
st2000_ops.to_remove_breakpoint = st2000_remove_breakpoint; /* Breakpoints */
|
||||
st2000_ops.to_terminal_init = 0;
|
||||
st2000_ops.to_terminal_inferior = 0;
|
||||
st2000_ops.to_terminal_ours_for_output = 0;
|
||||
st2000_ops.to_terminal_ours = 0;
|
||||
st2000_ops.to_terminal_info = 0; /* Terminal handling */
|
||||
st2000_ops.to_kill = st2000_kill;
|
||||
st2000_ops.to_load = 0; /* load */
|
||||
st2000_ops.to_lookup_symbol = 0; /* lookup_symbol */
|
||||
st2000_ops.to_create_inferior = st2000_create_inferior;
|
||||
st2000_ops.to_post_startup_inferior = NULL;
|
||||
st2000_ops.to_acknowledge_created_inferior = NULL;
|
||||
st2000_ops.to_clone_and_follow_inferior = NULL;
|
||||
@ -847,29 +835,29 @@ the speed to connect at in bits per second." ;
|
||||
st2000_run_ops.to_has_execd = NULL;
|
||||
st2000_run_ops.to_reported_exec_events_per_exec_call = NULL;
|
||||
st2000_run_ops.to_has_exited = NULL;
|
||||
st2000_ops.to_mourn_inferior = st2000_mourn_inferior;
|
||||
st2000_ops.to_can_run = 0; /* can_run */
|
||||
st2000_ops.to_notice_signals = 0; /* notice_signals */
|
||||
st2000_ops.to_thread_alive = 0; /* thread alive */
|
||||
st2000_ops.to_stop = 0; /* to_stop */
|
||||
st2000_ops.to_mourn_inferior = st2000_mourn_inferior;
|
||||
st2000_ops.to_can_run = 0; /* can_run */
|
||||
st2000_ops.to_notice_signals = 0; /* notice_signals */
|
||||
st2000_ops.to_thread_alive = 0; /* thread alive */
|
||||
st2000_ops.to_stop = 0; /* to_stop */
|
||||
st2000_ops.to_pid_to_exec_file = NULL;
|
||||
st2000_run_ops.to_core_file_to_sym_file = NULL;
|
||||
st2000_ops.to_stratum = process_stratum;
|
||||
st2000_ops.DONT_USE = 0; /* next */
|
||||
st2000_ops.to_has_all_memory = 1;
|
||||
st2000_ops.to_has_memory = 1;
|
||||
st2000_ops.to_has_stack = 1;
|
||||
st2000_ops.to_has_registers = 1;
|
||||
st2000_ops.to_has_execution = 1; /* all mem, mem, stack, regs, exec */
|
||||
st2000_ops.to_sections = 0;
|
||||
st2000_ops.to_sections_end = 0; /* Section pointers */
|
||||
st2000_ops.to_magic = OPS_MAGIC; /* Always the last thing */
|
||||
} ;
|
||||
st2000_ops.to_stratum = process_stratum;
|
||||
st2000_ops.DONT_USE = 0; /* next */
|
||||
st2000_ops.to_has_all_memory = 1;
|
||||
st2000_ops.to_has_memory = 1;
|
||||
st2000_ops.to_has_stack = 1;
|
||||
st2000_ops.to_has_registers = 1;
|
||||
st2000_ops.to_has_execution = 1; /* all mem, mem, stack, regs, exec */
|
||||
st2000_ops.to_sections = 0;
|
||||
st2000_ops.to_sections_end = 0; /* Section pointers */
|
||||
st2000_ops.to_magic = OPS_MAGIC; /* Always the last thing */
|
||||
};
|
||||
|
||||
void
|
||||
_initialize_remote_st2000 ()
|
||||
{
|
||||
init_st2000_ops() ;
|
||||
init_st2000_ops ();
|
||||
add_target (&st2000_ops);
|
||||
add_com ("st2000 <command>", class_obscure, st2000_command,
|
||||
"Send a command to the STDBUG monitor.");
|
||||
|
@ -1,25 +1,26 @@
|
||||
/* S-record download support for GDB, the GNU debugger.
|
||||
Copyright 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
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 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.
|
||||
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. */
|
||||
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. */
|
||||
|
||||
void load_srec PARAMS ((serial_t desc, const char *file, bfd_vma load_offset,
|
||||
int maxrecsize, int flags, int hashmark,
|
||||
int (*waitack)(void)));
|
||||
int (*waitack) (void)));
|
||||
|
||||
/* S-record capability flags */
|
||||
|
||||
@ -33,4 +34,4 @@ void load_srec PARAMS ((serial_t desc, const char *file, bfd_vma load_offset,
|
||||
| ((SREC_2_BYTE_ADDR | SREC_3_BYTE_ADDR | SREC_4_BYTE_ADDR) \
|
||||
<< SREC_TERM_SHIFT))
|
||||
|
||||
#define SREC_BINARY 0x00000040 /* Supports binary form of S-records */
|
||||
#define SREC_BINARY 0x00000040 /* Supports binary form of S-records */
|
||||
|
@ -1,21 +1,22 @@
|
||||
/* Interface to bare machine for GDB running as kernel debugger.
|
||||
Copyright (C) 1986, 1989, 1991 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
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 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.
|
||||
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. */
|
||||
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. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/ioctl.h>
|
||||
@ -33,19 +34,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#include "symtab.h"
|
||||
#include "frame.h"
|
||||
#include "inferior.h"
|
||||
#include "wait.h"
|
||||
|
||||
#include "gdb_wait.h"
|
||||
|
||||
|
||||
/* Random system calls, mostly no-ops to prevent link problems */
|
||||
|
||||
ioctl (desc, code, arg)
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
int (* signal ()) ()
|
||||
{}
|
||||
int (*signal ()) ()
|
||||
{
|
||||
}
|
||||
|
||||
kill ()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
getpid ()
|
||||
{
|
||||
@ -53,10 +57,12 @@ getpid ()
|
||||
}
|
||||
|
||||
sigsetmask ()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
chdir ()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
char *
|
||||
getcwd (buf, len)
|
||||
@ -92,7 +98,7 @@ exit ()
|
||||
char[] name of the file, ending with a null.
|
||||
padding to multiple of 4 boundary.
|
||||
char[] file contents. The length can be deduced from what was
|
||||
specified before. There is no terminating null here.
|
||||
specified before. There is no terminating null here.
|
||||
|
||||
If the int at the front is zero, it means there are no more files.
|
||||
|
||||
@ -141,14 +147,14 @@ open (filename, modes)
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (next = files_start; * (int *) next; next += * (int *) next)
|
||||
for (next = files_start; *(int *) next; next += *(int *) next)
|
||||
{
|
||||
if (!STRCMP (next + 4, filename))
|
||||
{
|
||||
sourcebeg = next + 4 + strlen (next + 4) + 1;
|
||||
sourcebeg = (char *) (((int) sourcebeg + 3) & (-4));
|
||||
sourceptr = sourcebeg;
|
||||
sourcesize = next + * (int *) next - sourceptr;
|
||||
sourcesize = next + *(int *) next - sourceptr;
|
||||
sourceleft = sourcesize;
|
||||
return sourcedesc;
|
||||
}
|
||||
@ -324,10 +330,12 @@ fflush (ign)
|
||||
/* Entries into core and inflow, needed only to make things link ok. */
|
||||
|
||||
exec_file_command ()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
core_file_command ()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
char *
|
||||
get_exec_file (err)
|
||||
@ -350,19 +358,24 @@ kill_command ()
|
||||
}
|
||||
|
||||
terminal_inferior ()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
terminal_ours ()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
terminal_init_inferior ()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
write_inferior_register ()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
read_inferior_register ()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
read_memory (memaddr, myaddr, len)
|
||||
CORE_ADDR memaddr;
|
||||
@ -417,16 +430,20 @@ vfork ()
|
||||
and these definitions are so it will link without errors. */
|
||||
|
||||
ptrace ()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
setpgrp ()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
execle ()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
_exit ()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
/* Malloc calls these. */
|
||||
|
||||
@ -564,7 +581,8 @@ wait (w)
|
||||
#define HEAP_SIZE 400000
|
||||
#endif
|
||||
|
||||
char heap[HEAP_SIZE] = {0};
|
||||
char heap[HEAP_SIZE] =
|
||||
{0};
|
||||
|
||||
#ifndef STACK_SIZE
|
||||
#define STACK_SIZE 100000
|
||||
@ -583,11 +601,12 @@ _initialize_standalone ()
|
||||
|
||||
/* Find the end of the data on files. */
|
||||
|
||||
for (next = files_start; * (int *) next; next += * (int *) next) {}
|
||||
for (next = files_start; *(int *) next; next += *(int *) next)
|
||||
{
|
||||
}
|
||||
|
||||
/* That is where free storage starts for sbrk to give out. */
|
||||
next_free = next;
|
||||
|
||||
memory_limit = heap + sizeof heap;
|
||||
}
|
||||
|
||||
|
@ -1,21 +1,22 @@
|
||||
/* Program to stuff files into a specially prepared space in kdb.
|
||||
Copyright (C) 1986, 1989, 1991 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
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 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.
|
||||
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. */
|
||||
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. */
|
||||
|
||||
/* Written 13-Mar-86 by David Bridgham. */
|
||||
|
||||
@ -38,11 +39,12 @@ main (argc, argv)
|
||||
struct stat stat_buf;
|
||||
int size, pad;
|
||||
char buf[1024];
|
||||
static char zeros[4] = {0};
|
||||
static char zeros[4] =
|
||||
{0};
|
||||
|
||||
if (argc < 4)
|
||||
err("Not enough arguments\nUsage: %s -o kdb file1 file2 ...\n",
|
||||
argv[0]);
|
||||
err ("Not enough arguments\nUsage: %s -o kdb file1 file2 ...\n",
|
||||
argv[0]);
|
||||
|
||||
outfile = 0;
|
||||
for (i = 1; i < argc; i++)
|
||||
@ -51,7 +53,7 @@ main (argc, argv)
|
||||
outfile = argv[++i];
|
||||
}
|
||||
if (outfile == 0)
|
||||
err("Output file not specified\n");
|
||||
err ("Output file not specified\n");
|
||||
|
||||
offset = get_offset (outfile, "_heap");
|
||||
|
||||
@ -111,7 +113,7 @@ get_offset (file, sym_name)
|
||||
err ("File %s not an a.out file\n", file);
|
||||
|
||||
/* read in symbol table */
|
||||
if ((symbol_table = (struct nlist *)malloc (file_hdr.a_syms)) == 0)
|
||||
if ((symbol_table = (struct nlist *) malloc (file_hdr.a_syms)) == 0)
|
||||
err ("Couldn't allocate space for symbol table\n");
|
||||
if (lseek (f, N_SYMOFF (file_hdr), 0) == -1)
|
||||
err ("lseek error: %s\n", strerror (errno));
|
||||
@ -122,7 +124,7 @@ get_offset (file, sym_name)
|
||||
/* read in string table */
|
||||
if (read (f, &size, 4) == -1)
|
||||
err ("reading string table size: %s\n", strerror (errno));
|
||||
if ((strings = (char *)malloc (size)) == 0)
|
||||
if ((strings = (char *) malloc (size)) == 0)
|
||||
err ("Couldn't allocate memory for string table\n");
|
||||
if (read (f, strings, size - 4) == -1)
|
||||
err ("reading string table: %s\n", strerror (errno));
|
||||
@ -147,15 +149,17 @@ find_symbol (sym_name, symbol_table, length, strings)
|
||||
|
||||
/* Find symbol in question */
|
||||
for (sym = symbol_table;
|
||||
sym != (struct nlist *)((char *)symbol_table + length);
|
||||
sym != (struct nlist *) ((char *) symbol_table + length);
|
||||
sym++)
|
||||
{
|
||||
if ((sym->n_type & N_TYPE) != N_DATA) continue;
|
||||
if (sym->n_un.n_strx == 0) continue;
|
||||
if (STREQ (sym_name, strings + sym->n_un.n_strx - 4))
|
||||
return sym->n_value;
|
||||
}
|
||||
err ("Data symbol %s not found in %s\n", sym_name, file);
|
||||
{
|
||||
if ((sym->n_type & N_TYPE) != N_DATA)
|
||||
continue;
|
||||
if (sym->n_un.n_strx == 0)
|
||||
continue;
|
||||
if (STREQ (sym_name, strings + sym->n_un.n_strx - 4))
|
||||
return sym->n_value;
|
||||
}
|
||||
err ("Data symbol %s not found in %s\n", sym_name, file);
|
||||
}
|
||||
|
||||
/* VARARGS */
|
||||
|
Loading…
Reference in New Issue
Block a user