This file is not part of GDB 5.2.1, but was off the vendor branch.
This commit is contained in:
parent
7c909649fa
commit
f2d7e86a8a
File diff suppressed because it is too large
Load Diff
@ -1,114 +0,0 @@
|
||||
Please feel free to add, edit, delete this file.
|
||||
Please do not make ChangeLog entries.
|
||||
|
||||
COPYING, COPYING.LIB, README
|
||||
http://gnu.org.
|
||||
|
||||
Makefile.in; configure; configure.in
|
||||
Please notify the following of any committed patches.
|
||||
binutils@sources.redhat.com
|
||||
gdb-patches@sources.redhat.com
|
||||
|
||||
bfd/; binutils/; gas/; gprof/; ld/; opcodes/; BFD's part of include/
|
||||
binutils: http://sources.redhat.com/binutils/
|
||||
Patches to binutils@sources.redhat.com.
|
||||
Please notify the following of any interface changes:
|
||||
gdb-patches@sources.redhat.com
|
||||
|
||||
cgen/; cgen parts of opcodes/, sim/ & include/
|
||||
cgen: http://sources.redhat.com/cgen/
|
||||
Patches to cgen@sources.redhat.com
|
||||
May need separate opcodes/ or sim/ approval for
|
||||
commits of regenerated files there.
|
||||
|
||||
config.guess; config.sub; dejagnu/config.guess;
|
||||
readline/support/config.sub; readline/support/config.guess
|
||||
config: http://savannah.gnu.org/projects/config
|
||||
Patches to config-patches@gnu.org.
|
||||
Changes need to be done in tandem with the official CONFIG
|
||||
sources or submitted to the master file maintainer and brought
|
||||
in via a merge.
|
||||
Please notify the following of any committed patches:
|
||||
binutils@sources.redhat.com
|
||||
gdb-patches@sources.redhat.com
|
||||
|
||||
dejagnu/
|
||||
Notify http://dejagnu.sourceforge.net/ of generic changes.
|
||||
Generic patches to gdb-patches@sources.redhat.com;
|
||||
Other dependents of dejagnu include sid@, binutils@, gcc@, etc.
|
||||
|
||||
gdb/; mmalloc/; readline/; sim/; GDB's part of include/ & dejagnu/
|
||||
gdb: http://sources.redhat.com/gdb/
|
||||
Patches to gdb-patches@sources.redhat.com.
|
||||
See also gdb/MAINTAINERS, sim/MAINTAINERS, mmalloc/MAINTAINERS.
|
||||
|
||||
include/
|
||||
See binutils/, gdb/, sid/, gcc/, libiberty/ etc.
|
||||
|
||||
libiberty/; libiberty's part of include/
|
||||
gcc: http://gcc.gnu.org
|
||||
Changes need to be done in tandem with the official GCC
|
||||
sources or submitted to the master file maintainer and brought
|
||||
in via a merge. Note: approved patches in gcc's libiberty
|
||||
are automatically approved in this libiberty also; feel free
|
||||
to merge them yourself if needed sooner than the next merge.
|
||||
Otherwise, changes are automatically merged, usually within
|
||||
a day.
|
||||
|
||||
ltconfig; ltmain.sh
|
||||
libtool: http://gnu.org
|
||||
Changes need to be done in tandem with the official LIBTOOL
|
||||
sources or submitted to the master file maintainer and brought
|
||||
in via a merge.
|
||||
|
||||
mkinstalldirs; move-if-change
|
||||
autoconf: http://gnu.org
|
||||
Patches to autoconf-patches@gnu.org.
|
||||
Changes need to be done in tandem with the official AUTOCONF
|
||||
sources or submitted to the master file maintainer and brought
|
||||
in via a merge.
|
||||
|
||||
symlink-tree
|
||||
gcc: http://gcc.gnu.org
|
||||
See libiberty.
|
||||
|
||||
newlib/; libgloss/
|
||||
http://sources.redhat.com/newlib/
|
||||
Patches to newlib@sources.redhat.com.
|
||||
|
||||
sid/; SID's part of cgen/ & dejagnu/
|
||||
sid: http://sources.redhat.com/sid/
|
||||
Patches to sid@sources.redhat.com
|
||||
|
||||
texinfo/texinfo.tex
|
||||
texinfo: http://ftp.gnu.org.
|
||||
Latest version can be found on ftp://ftp.gnu.org and can be
|
||||
imported at any (reasonable) time.
|
||||
Please not use GCC's texinfo. Please do not import texinfo.
|
||||
|
||||
tcl/; tix/; itcl/; tk/; libgui/
|
||||
insight: http://sources.redhat.com/insight/
|
||||
Contact insight@sources.redhat.com.
|
||||
|
||||
winsup/
|
||||
cygwin: http://sources.redhat.com/cygwin
|
||||
Patches to cygwin-patches@sources.redhat.com.
|
||||
General discussion cygwin@sources.redhat.com.
|
||||
See also winsup/MAINTAINERS.
|
||||
|
||||
expect/; config-ml.in; mpw-README; mpw-build.in; mpw-config.in;
|
||||
mpw-configure; mpw-install; setup.com; missing; makefile.vms; utils/;
|
||||
config/; config.if; makefile.vms; missing; ylwrap; mkdep; etc/;
|
||||
install-sh; intl/
|
||||
Ask DJ Delorie <dj@redhat.com> after reading the libiberty entry.
|
||||
|
||||
modules file
|
||||
Obviously changes to this file should not go through
|
||||
overseers@sources.redhat.com. If you understand the file
|
||||
format (or can cut-and-paste existing entries), modify it. If
|
||||
it scares you, get someone who does understand it to help you.
|
||||
Be prepared to fix it if you do break it.
|
||||
|
||||
/* Local variables: */
|
||||
/* change-log-default-name: "/dev/null" */
|
||||
/* End: */
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,27 +0,0 @@
|
||||
/* Native support for Sun 386i, for GDB, the GNU debugger.
|
||||
Copyright (C) 1986, 1987, 1989, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Do implement the attach and detach commands. */
|
||||
|
||||
#define ATTACH_DETACH
|
||||
|
||||
/* Override copies of {fetch,store}_inferior_registers in infptrace.c. */
|
||||
#define FETCH_INFERIOR_REGISTERS
|
||||
|
||||
#define CHILD_PREPARE_TO_STORE() read_register_bytes (0, NULL, REGISTER_BYTES)
|
@ -1,5 +0,0 @@
|
||||
# Host: Sun 386i
|
||||
XDEPFILES=
|
||||
XM_FILE= xm-sun386.h
|
||||
NAT_FILE= nm-sun386.h
|
||||
NATDEPFILES= infptrace.o inftarg.o fork-child.o sun386-nat.o
|
@ -1,3 +0,0 @@
|
||||
# Target: Sun 386i target configuration file.
|
||||
TDEPFILES= i386-tdep.o solib.o
|
||||
TM_FILE= tm-sun386.h
|
@ -1,205 +0,0 @@
|
||||
/* Parameters for a Sun 386i target machine, for GDB, the GNU debugger.
|
||||
Copyright 1986, 1987, 1991, 1992, 1993 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#if !defined (TM_SUN386_H)
|
||||
#define TM_SUN386_H 1
|
||||
|
||||
#include "i386/tm-i386.h"
|
||||
|
||||
#ifndef sun386
|
||||
#define sun386
|
||||
#endif
|
||||
#define GDB_TARGET_IS_SUN386 1
|
||||
#define SUNOS4
|
||||
#define USE_MACHINE_REG_H
|
||||
|
||||
/* Perhaps some day this will work even without the following #define */
|
||||
#define COFF_ENCAPSULATE
|
||||
|
||||
#ifdef COFF_ENCAPSULATE
|
||||
/* Avoid conflicts between our include files and <sys/exec.h>
|
||||
(maybe not needed anymore). */
|
||||
#define _EXEC_
|
||||
#endif
|
||||
|
||||
/* sun386 ptrace seems unable to change the frame pointer */
|
||||
#define PTRACE_FP_BUG
|
||||
|
||||
/* Address of end of stack space. */
|
||||
|
||||
#define STACK_END_ADDR 0xfc000000
|
||||
|
||||
/* Number of machine registers */
|
||||
|
||||
#undef NUM_REGS
|
||||
#define NUM_REGS 35
|
||||
|
||||
/* Initializer for an array of names of registers. There should be NUM_REGS
|
||||
strings in this initializer. The order of the first 8 registers must match
|
||||
the compiler's numbering scheme (which is the same as the 386 scheme) also,
|
||||
this table must match regmap in i386-pinsn.c. */
|
||||
|
||||
#undef REGISTER_NAMES
|
||||
#define REGISTER_NAMES { "gs", "fs", "es", "ds", \
|
||||
"edi", "esi", "ebp", "esp", \
|
||||
"ebx", "edx", "ecx", "eax", \
|
||||
"retaddr", "trapnum", "errcode", "ip", \
|
||||
"cs", "ps", "sp", "ss", \
|
||||
"fst0", "fst1", "fst2", "fst3", \
|
||||
"fst4", "fst5", "fst6", "fst7", \
|
||||
"fctrl", "fstat", "ftag", "fip", \
|
||||
"fcs", "fopoff", "fopsel" \
|
||||
}
|
||||
|
||||
/* Register numbers of various important registers.
|
||||
Note that some of these values are "real" register numbers,
|
||||
and correspond to the general registers of the machine,
|
||||
and some are "phony" register numbers which are too large
|
||||
to be actual register numbers as far as the user is concerned
|
||||
but do serve to get the desired values when passed to read_register. */
|
||||
|
||||
#undef FP_REGNUM
|
||||
#define FP_REGNUM 6 /* (ebp) Contains address of executing stack frame */
|
||||
#undef SP_REGNUM
|
||||
#define SP_REGNUM 18 /* (usp) Contains address of top of stack */
|
||||
#undef PS_REGNUM
|
||||
#define PS_REGNUM 17 /* (ps) Contains processor status */
|
||||
#undef PC_REGNUM
|
||||
#define PC_REGNUM 15 /* (eip) Contains program counter */
|
||||
#undef FP0_REGNUM
|
||||
#define FP0_REGNUM 20 /* Floating point register 0 */
|
||||
#undef FPC_REGNUM
|
||||
#define FPC_REGNUM 28 /* 80387 control register */
|
||||
|
||||
/* Total amount of space needed to store our copies of the machine's
|
||||
register state, the array `registers'. */
|
||||
|
||||
#undef REGISTER_BYTES
|
||||
#define REGISTER_BYTES (20*4+8*10+7*4)
|
||||
|
||||
/* Index within `registers' of the first byte of the space for
|
||||
register N. */
|
||||
|
||||
#undef REGISTER_BYTE
|
||||
#define REGISTER_BYTE(N) \
|
||||
((N) >= FPC_REGNUM ? (((N) - FPC_REGNUM) * 4) + 160 \
|
||||
: (N) >= FP0_REGNUM ? (((N) - FP0_REGNUM) * 10) + 80 \
|
||||
: (N) * 4)
|
||||
|
||||
/* Number of bytes of storage in the actual machine representation
|
||||
for register N. */
|
||||
|
||||
#undef REGISTER_RAW_SIZE
|
||||
#define REGISTER_RAW_SIZE(N) (((unsigned)((N) - FP0_REGNUM)) < 8 ? 10 : 4)
|
||||
|
||||
/* Number of bytes of storage in the program's representation
|
||||
for register N. */
|
||||
|
||||
#undef REGISTER_VIRTUAL_SIZE
|
||||
#define REGISTER_VIRTUAL_SIZE(N) (((unsigned)((N) - FP0_REGNUM)) < 8 ? 8 : 4)
|
||||
|
||||
/* Nonzero if register N requires conversion
|
||||
from raw format to virtual format. */
|
||||
|
||||
#undef REGISTER_CONVERTIBLE
|
||||
#define REGISTER_CONVERTIBLE(N) (((unsigned)((N) - FP0_REGNUM)) < 8)
|
||||
|
||||
/* Convert data from raw format for register REGNUM in buffer FROM
|
||||
to virtual format with type TYPE in buffer TO. */
|
||||
|
||||
#undef REGISTER_CONVERT_TO_VIRTUAL
|
||||
#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \
|
||||
{ \
|
||||
double val; \
|
||||
i387_to_double ((FROM), (char *)&val); \
|
||||
store_floating ((TO), TYPE_LENGTH (TYPE), val); \
|
||||
}
|
||||
extern void
|
||||
i387_to_double PARAMS ((char *, char *));
|
||||
|
||||
/* Convert data from virtual format with type TYPE in buffer FROM
|
||||
to raw format for register REGNUM in buffer TO. */
|
||||
|
||||
#undef REGISTER_CONVERT_TO_RAW
|
||||
#define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \
|
||||
{ \
|
||||
double val = extract_floating ((FROM), TYPE_LENGTH (TYPE)); \
|
||||
double_to_i387((char *)&val, (TO)); \
|
||||
}
|
||||
extern void
|
||||
double_to_i387 PARAMS ((char *, char *));
|
||||
|
||||
/* Return the GDB type object for the "standard" data type
|
||||
of data in register N. */
|
||||
|
||||
#undef REGISTER_VIRTUAL_TYPE
|
||||
#define REGISTER_VIRTUAL_TYPE(N) \
|
||||
(((unsigned)((N) - FP0_REGNUM)) < 8 ? builtin_type_double : builtin_type_int)
|
||||
|
||||
/* Extract from an array REGBUF containing the (raw) register state
|
||||
a function return value of type TYPE, and copy that, in virtual format,
|
||||
into VALBUF. */
|
||||
|
||||
#undef EXTRACT_RETURN_VALUE
|
||||
#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
|
||||
memcpy (VALBUF, REGBUF + REGISTER_BYTE (TYPE_CODE (TYPE) == TYPE_CODE_FLT ? FP0_REGNUM : 11), TYPE_LENGTH (TYPE))
|
||||
|
||||
/* Write into appropriate registers a function return value
|
||||
of type TYPE, given in virtual format. */
|
||||
|
||||
#undef STORE_RETURN_VALUE
|
||||
#define STORE_RETURN_VALUE(TYPE,VALBUF) \
|
||||
write_register_bytes (REGISTER_BYTE (TYPE_CODE (TYPE) == TYPE_CODE_FLT ? FP0_REGNUM : 11), VALBUF, TYPE_LENGTH (TYPE))
|
||||
|
||||
/* Describe the pointer in each stack frame to the previous stack frame
|
||||
(its caller). */
|
||||
|
||||
/* FRAME_CHAIN takes a frame's nominal address
|
||||
and produces the frame's chain-pointer. */
|
||||
|
||||
#undef FRAME_CHAIN
|
||||
#define FRAME_CHAIN(thisframe) \
|
||||
(!inside_entry_file ((thisframe)->pc) ? \
|
||||
read_memory_integer ((thisframe)->frame, 4) :\
|
||||
0)
|
||||
|
||||
/* Define other aspects of the stack frame. */
|
||||
|
||||
/* A macro that tells us whether the function invocation represented
|
||||
by FI does not have a frame on the stack associated with it. If it
|
||||
does not, FRAMELESS is set to 1, else 0. */
|
||||
|
||||
#undef FRAMELESS_FUNCTION_INVOCATION
|
||||
#define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) \
|
||||
{ (FRAMELESS) = frameless_look_for_prologue (FI); }
|
||||
|
||||
#undef FRAME_SAVED_PC
|
||||
#define FRAME_SAVED_PC(FRAME) (read_memory_integer ((FRAME)->frame + 4, 4))
|
||||
|
||||
/* Insert the specified number of args and function address
|
||||
into a call sequence of the above form stored at DUMMYNAME. */
|
||||
|
||||
#undef FIX_CALL_DUMMY
|
||||
#define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \
|
||||
{ \
|
||||
*(int *)((char *)(dummyname) + 1) = (int)(fun) - (pc) - 5; \
|
||||
}
|
||||
|
||||
#endif /* !defined (TM_SUN386_H) */
|
||||
|
@ -1,24 +0,0 @@
|
||||
/* Host-dependent definitions for Intel 386 running LynxOS.
|
||||
Copyright 1993 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define HOST_BYTE_ORDER LITTLE_ENDIAN
|
||||
|
||||
/* Get generic LynxOS host definitions. */
|
||||
|
||||
#include "xm-lynx.h"
|
@ -1,36 +0,0 @@
|
||||
/* Native support for GNU/Linux, for GDB, the GNU debugger.
|
||||
Copyright (C) 1986, 1987, 1989, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef XM_LINUX_H
|
||||
#define XM_LINUX_H
|
||||
|
||||
#define HOST_BYTE_ORDER LITTLE_ENDIAN
|
||||
|
||||
#define HAVE_TERMIOS
|
||||
|
||||
/* This is the amount to subtract from u.u_ar0
|
||||
to get the offset in the core file of the register values. */
|
||||
#define KERNEL_U_ADDR 0x0
|
||||
|
||||
#define NEED_POSIX_SETPGID
|
||||
|
||||
/* Need R_OK etc, but USG isn't defined. */
|
||||
#include <unistd.h>
|
||||
|
||||
#endif /* #ifndef XM_LINUX_H */
|
@ -1,20 +0,0 @@
|
||||
/* Host support for Sun 386i, for GDB, the GNU debugger.
|
||||
Copyright (C) 1986, 1987, 1989, 1992, 1996 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define HOST_BYTE_ORDER LITTLE_ENDIAN
|
@ -1,35 +0,0 @@
|
||||
/* Definitions for hosting on WIN32, built with Microsoft Visual C/C++, for GDB.
|
||||
Copyright 1996, 1998 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "i386/xm-cygwin.h"
|
||||
|
||||
#undef PRINTF_HAS_LONG_LONG
|
||||
#undef HAVE_UNISTD_H
|
||||
#undef HAVE_TERMIO_H
|
||||
#undef HAVE_TERMIOS_H
|
||||
#undef HAVE_SGTTY_H
|
||||
#undef HAVE_SBRK
|
||||
#define CANT_FORK
|
||||
|
||||
#define MALLOC_INCOMPATIBLE
|
||||
|
||||
#include <malloc.h>
|
||||
|
||||
#define SIGQUIT 3
|
||||
#define SIGTRAP 5
|
@ -1,878 +0,0 @@
|
||||
\input texinfo @c -*-texinfo-*-
|
||||
@c %**start of header
|
||||
@setfilename libgdb.info
|
||||
@settitle Libgdb
|
||||
@setchapternewpage off
|
||||
@c %**end of header
|
||||
|
||||
@ifinfo
|
||||
This file documents libgdb, the GNU symbolic debugger in a library.
|
||||
|
||||
This is Edition 0.3, Oct 1993, of @cite{Libgdb}.
|
||||
Copyright 1993 Cygnus Support
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
are preserved on all copies.
|
||||
|
||||
@ignore
|
||||
Permission is granted to process this file through TeX and print the
|
||||
results, provided the printed document carries copying permission
|
||||
notice identical to this one except for the removal of this paragraph
|
||||
(this paragraph not being relevant to the printed manual).
|
||||
|
||||
@end ignore
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided also that the
|
||||
entire resulting derived work is distributed under the terms of a
|
||||
permission notice identical to this one.
|
||||
|
||||
Permission is granted to copy and distribute translations of this manual
|
||||
into another language, under the above conditions for modified versions.
|
||||
@end ifinfo
|
||||
|
||||
@c This title page illustrates only one of the
|
||||
@c two methods of forming a title page.
|
||||
|
||||
@titlepage
|
||||
@title Libgdb
|
||||
@subtitle Version 0.3
|
||||
@subtitle Oct 1993
|
||||
@author Thomas Lord
|
||||
|
||||
@c The following two commands
|
||||
@c start the copyright page.
|
||||
@page
|
||||
@vskip 0pt plus 1filll
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
are preserved on all copies.
|
||||
|
||||
Copyright @copyright{} 1993 Cygnus Support
|
||||
@end titlepage
|
||||
|
||||
@ifinfo
|
||||
@node Top, Overview, (dir), (dir)
|
||||
|
||||
This info file documents libgdb: an API for GDB, the GNU symbolic debugger.
|
||||
|
||||
@menu
|
||||
* Overview:: The basics of libgdb and this document.
|
||||
* Interpreter:: Libgdb is an Interpreter-Based Server.
|
||||
* Top Level:: You Provide the Top Level for the Libgdb
|
||||
Command Interpreter .
|
||||
* I/O:: How the Server's I/O Can be Used.
|
||||
* Invoking:: Invoking the Interpreter, Executing
|
||||
Commands.
|
||||
* Defining Commands:: How New Commands are Created.
|
||||
* Variables:: How Builtin Variables are Defined.
|
||||
* Asynchronous:: Scheduling Asynchronous Computations.
|
||||
* Commands:: Debugger Commands for Libgdb Applications
|
||||
@end menu
|
||||
|
||||
@end ifinfo
|
||||
@node Overview, Interpreter, top, top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Overview
|
||||
@cindex overview
|
||||
@cindex definitions
|
||||
|
||||
@heading Function and Purpose
|
||||
|
||||
Libgdb is a package which provides an API to the functionality of GDB,
|
||||
the GNU symbolic debugger. It is specifically intended to support the
|
||||
development of a symbolic debugger with a graphic interface.
|
||||
|
||||
|
||||
@heading This Document
|
||||
|
||||
This document is a specification of the libgdb API. It is written in
|
||||
the form of a programmer's manual. So the goal of this document is to
|
||||
explain what functions make up the API, and how they can be used in a
|
||||
running application.
|
||||
|
||||
|
||||
@heading Terminology
|
||||
|
||||
In this document, @dfn{libgdb} refers to a library containing the
|
||||
functions defined herein, @dfn{application} refers to any program built
|
||||
with that library.
|
||||
|
||||
|
||||
@heading Dependencies
|
||||
|
||||
Programs which are linked with libgdb must be linked with libbfd,
|
||||
libopcodes, libiberty, and libmmalloc.
|
||||
|
||||
@heading Acknowledgments
|
||||
|
||||
Essential contributions to this design were made by Stu Grossman, Jim
|
||||
Kingdon, and Rich Pixley.
|
||||
|
||||
@node Interpreter, Top Level, Overview, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Libgdb is an Interpreter Based Server
|
||||
@cindex interpreter
|
||||
@cindex server
|
||||
|
||||
To understand libgdb, it is necessary to understand how the library is
|
||||
structured. Historically, GDB is written as a small interpreter for a
|
||||
simple command language. The commands of the language perform useful
|
||||
debugging functions.
|
||||
|
||||
Libgdb is built from GDB by turning the interpreter into a debugging
|
||||
server. The server reads debugging commands from any source and
|
||||
interprets them, directing the output arbitrarily.
|
||||
|
||||
In addition to changing GDB from a tty-based program to a server, a
|
||||
number of new GDB commands have been added to make the server more
|
||||
useful for a program with a graphic interface.
|
||||
|
||||
Finally, libgdb includes provisions for asynchronous processing within
|
||||
the application.
|
||||
|
||||
Most operations that can be carried out with libgdb involve the GDB
|
||||
command interpreter. The usual mode of operation is that the operation
|
||||
is expressed as a string of GDB commands, which the interpreter is then
|
||||
invoked to carry out. The output from commands executed in this manner
|
||||
can be redirected in a variety of useful ways for further processing by
|
||||
the application.
|
||||
|
||||
The command interpreter provides an extensive system of hooks so an
|
||||
application can monitor any aspect of the debugging library's state. An
|
||||
application can set its own breakpoints and attach commands and
|
||||
conditions to those. It is possible to attach hooks to any debugger
|
||||
command; the hooks are invoked whenever that command is about to be
|
||||
invoked. By means of these, the displays of a graphical interface can
|
||||
be kept fully up to date at all times.
|
||||
|
||||
We show you how to define new primitives in the command language. By
|
||||
defining new primitives and using them in breakpoint scripts and command
|
||||
hooks, an application can schedule the execution of arbitrary C-code at
|
||||
almost any point of interest in the operation of libgdb.
|
||||
|
||||
We show you how to define new GDB convenience variables for which your
|
||||
code computes a value on demand. Referring to such variables in a
|
||||
breakpoint condition is a convenient way to conditionalize breakpoints
|
||||
in novel ways.
|
||||
|
||||
To summarize: in libgdb, the gdb command language is turned into a
|
||||
debugging server. The server takes commands as input, and the server's
|
||||
output is redirectable. An application uses libgdb by formatting
|
||||
debugging commands and invoking the interpreter. The application might
|
||||
maintain breakpoints, watchpoints and many kinds of hooks. An application
|
||||
can define new primitives for the interpreter.
|
||||
|
||||
@node Top Level, I/O, Interpreter, Top
|
||||
@chapter You Provide the Top Level for the Libgdb Command Interpreter
|
||||
@cindex {top level}
|
||||
|
||||
When you use libgdb, your code is providing a @dfn{top level} for the
|
||||
command language interpreter. The top level is significant because it
|
||||
provides commands for the the interpreter to execute. In addition, the
|
||||
top level is responsible for handling some kinds of errors, and
|
||||
performing certain cleanup operations on behalf of the interpreter.
|
||||
|
||||
@heading Initialization
|
||||
|
||||
Before calling any other libgdb functions, call this:
|
||||
|
||||
@deftypefun void gdb_init (void)
|
||||
Perform one-time initialization for libgdb.
|
||||
@end deftypefun
|
||||
|
||||
An application may wish to evaluate specific gdb commands as part of its
|
||||
own initialization. The details of how this can be accomplished are
|
||||
explained below.
|
||||
|
||||
@heading The Top-Level Loop
|
||||
|
||||
There is a strong presumption in libgdb that the application has
|
||||
the form of a loop. Here is what such a loop might look like:
|
||||
|
||||
@example
|
||||
while (gdb_still_going ())
|
||||
@{
|
||||
if (!GDB_TOP_LEVEL ())
|
||||
@{
|
||||
char * command;
|
||||
gdb_start_top_loop ();
|
||||
command = process_events ();
|
||||
gdb_execute_command (command);
|
||||
gdb_finish_top_loop ();
|
||||
@}
|
||||
@}
|
||||
@end example
|
||||
|
||||
The function @code{gdb_still_going} returns 1 until the gdb command
|
||||
`quit' is run.
|
||||
|
||||
The macro @code{GDB_TOP_LEVEL} invokes setjmp to set the top level error
|
||||
handler. When a command results in an error, the interpreter exits with
|
||||
a longjmp. There is nothing special libgdb requires of the top level
|
||||
error handler other than it be present and that it restart the top level
|
||||
loop. Errors are explained in detail in a later chapter.
|
||||
|
||||
Each time through the top level loop two important things happen: a
|
||||
debugger command is constructed on the basis of user input, and the
|
||||
interpreter is invoked to execute that command. In the sample code, the
|
||||
call to the imaginary function @code{process_events} represents the
|
||||
point at which a graphical interface should read input events until
|
||||
ready to execute a debugger command. The call to
|
||||
@code{gdb_execute_command} invokes the command interpreter (what happens
|
||||
to the output from the command will be explained later).
|
||||
|
||||
Libgdb manages some resources using the top-level loop. The primary
|
||||
reason for this is error-handling: even if a command terminates with an
|
||||
error, it may already have allocated resources which need to be freed.
|
||||
The freeing of such resources takes place at the top-level, regardless
|
||||
of how the the command exits. The calls to @code{gdb_start_top_loop}
|
||||
and @code{gdb_finish_top_loop} let libgdb know when it is safe to
|
||||
perform operations associated with these resources.
|
||||
|
||||
@heading Breakpoint Commands
|
||||
|
||||
Breakpoint commands are scripts of GDB operations associated with
|
||||
particular breakpoints. When a breakpoint is reached, its associated
|
||||
commands are executed.
|
||||
|
||||
Breakpoint commands are invoked by the libgdb function
|
||||
@code{gdb_finish_top_loop}.
|
||||
|
||||
Notice that if control returns to the top-level error handler, the
|
||||
execution of breakpoint commands is bypassed. This can happen as a
|
||||
result of errors during either @code{gdb_execute_command} or
|
||||
@code{gdb_finish_top_loop}.
|
||||
|
||||
@heading Application Initialization
|
||||
|
||||
Sometimes it is inconvenient to execute commands via a command loop for
|
||||
example, the commands an application uses to initialize itself. An
|
||||
alternative to @code{execute_command} is @code{execute_catching_errors}.
|
||||
When @code{execute_catching_errors} is used, no top level error handler
|
||||
need be in effect, and it is not necessary to call
|
||||
@code{gdb_start_top_loop} or @code{gdb_finish_top_loop}.
|
||||
|
||||
|
||||
@heading Cleanup
|
||||
|
||||
The debugger command ``quit'' performs all necessary cleanup for libgdb.
|
||||
After it has done so, it changes the return value of
|
||||
@code{gdb_still_going} to 0 and returns to the top level error handler.
|
||||
|
||||
|
||||
@node I/O, Invoking, Top Level, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter How the Server's I/O Can be Used
|
||||
@cindex I/O
|
||||
|
||||
In the last chapter it was pointed out that a libgdb application is
|
||||
responsible for providing commands for the interpreter to execute.
|
||||
However some commands require further input (for example, the ``quit''
|
||||
command might ask for confirmation). Almost all commands produce output
|
||||
of some kind. The purpose of this section is to explain how libgdb
|
||||
performs its I/O, and how an application can take advantage of
|
||||
this.
|
||||
|
||||
|
||||
@heading I/O Vectors
|
||||
|
||||
Libgdb has no fixed strategy for I/O. Instead, all operations are
|
||||
performed by functions called via structures of function pointers.
|
||||
Applications supply theses structures and can change them at any
|
||||
time.
|
||||
|
||||
@deftp Type {struct gdb_input_vector}
|
||||
@deftpx Type {struct gdb_output_vector}
|
||||
These structures contain a set of function pointers. Each function
|
||||
determines how a particular type of i/o is performed. The details of
|
||||
these strucutres are explained below.
|
||||
|
||||
The application allocates these structures, initializes them to all bits
|
||||
zero, fills in the function pointers, and then registers names for them
|
||||
them with libgdb.
|
||||
@end deftp
|
||||
|
||||
@deftypefun void gdb_name_input_vector (@var{name}, @var{vec})
|
||||
@deftypefunx void gdb_remove_input_vector (@var{name}, @var{vec})
|
||||
@deftypefunx void gdb_name_output_vector (@var{name}, @var{vec})
|
||||
@deftypefunx void gdb_remove_input_vector (@var{name}, @var{vec})
|
||||
@example
|
||||
char * @var{name};
|
||||
struct gdb_output_vector * @var{vec};
|
||||
@end example
|
||||
These functions are used to give and remove names to i/o vectors. Note
|
||||
that if a name is used twice, the most recent definition applies.
|
||||
@end deftypefun
|
||||
|
||||
|
||||
|
||||
@subheading Output
|
||||
|
||||
An output vector is a structure with at least these fields:
|
||||
|
||||
@example
|
||||
struct gdb_output_vector
|
||||
@{
|
||||
/* output */
|
||||
void (*put_string) (struct gdb_output_vector *, char * str);
|
||||
@}
|
||||
@end example
|
||||
|
||||
Use the function @code{memset} or something equivalent to initialize an
|
||||
output vector to all bits zero. Then fill in the function pointer with
|
||||
your function.
|
||||
|
||||
A debugger command can produce three kinds of output: error messages
|
||||
(such as when trying to delete a non-existent breakpoint), informational
|
||||
messages (such as the notification printed when a breakpoint is hit),
|
||||
and the output specifically requested by a command (for example, the
|
||||
value printed by the ``print'' command). At any given time, then,
|
||||
libgdb has three output vectors. These are called the @dfn{error},
|
||||
@dfn{info}, @dfn{value} vector respectively.
|
||||
|
||||
@subheading Input
|
||||
|
||||
@example
|
||||
struct gdb_input_vector
|
||||
@{
|
||||
int (*query) (struct gdb_input_vector *,
|
||||
char * prompt,
|
||||
int quit_allowed);
|
||||
int * (*selection) (struct gdb_input_vector *,
|
||||
char * prompt,
|
||||
char ** choices);
|
||||
char * (*read_string) (struct gdb_input_vector *,
|
||||
char * prompt);
|
||||
char ** (*read_strings) (struct gdb_input_vector *,
|
||||
char * prompt);
|
||||
@}
|
||||
@end example
|
||||
|
||||
Use the function @code{memset} or something equivalent to initialize an
|
||||
input vector to all bits zero. Then fill in the function pointers with
|
||||
your functions.
|
||||
|
||||
There are four kinds of input requests explicitly made by libgdb.
|
||||
|
||||
A @dfn{query} is a yes or no question. The user can respond to a query
|
||||
with an affirmative or negative answer, or by telling gdb to abort the
|
||||
command (in some cases an abort is not permitted). Query should return
|
||||
'y' or 'n' or 0 to abort.
|
||||
|
||||
A @dfn{selection} is a list of options from which the user selects a subset.
|
||||
Selections should return a NULL terminated array of integers, which are
|
||||
indexes into the array of choices. It can return NULL instead to abort
|
||||
the command. The array returned by this function will be passed to
|
||||
@code{free} by libgdb.
|
||||
|
||||
A @dfn{read_string} asks the user to supply an arbitrary string. It may
|
||||
return NULL to abort the command. The string returned by @code{read_string}
|
||||
should be allocated by @code{malloc}; it will be freed by libgdb.
|
||||
|
||||
A @dfn{read_strings} asks the user to supply multiple lines of input
|
||||
(for example, the body of a command created using `define'). It, too,
|
||||
may return NULL to abort. The array and the strings returned by this
|
||||
function will be freed by libgdb.
|
||||
|
||||
@heading I/O Redirection from the Application Top-Level
|
||||
|
||||
@deftypefun struct gdb_io_vecs gdb_set_io (struct gdb_io_vecs *)
|
||||
@example
|
||||
|
||||
struct gdb_io_vecs
|
||||
@{
|
||||
struct gdb_input_vector * input;
|
||||
struct gdb_output_vector * error;
|
||||
struct gdb_output_vector * info;
|
||||
struct gdb_output_vector * value;
|
||||
@}
|
||||
@end example
|
||||
|
||||
This establishes a new set of i/o vectors, and returns the old setting.
|
||||
Any of the pointers in this structure may be NULL, indicating that the
|
||||
current value should be used.
|
||||
|
||||
This function is useful for setting up i/o vectors before any libgdb
|
||||
commands have been invoked (hence before any input or output has taken
|
||||
place).
|
||||
@end deftypefun
|
||||
|
||||
It is explained in a later chapter how to redirect output temporarily.
|
||||
(@xref{Invoking}.)
|
||||
|
||||
@heading I/O Redirection in Debugger Commands
|
||||
|
||||
A libgdb application creates input and output vectors and assigns them names.
|
||||
Which input and output vectors are used by libgdb is established by
|
||||
executing these debugger commands:
|
||||
|
||||
@defun {set input-vector} name
|
||||
@defunx {set error-output-vector} name
|
||||
@defunx {set info-output-vector} name
|
||||
@defunx {set value-output-vector} name
|
||||
Choose an I/O vector by name.
|
||||
@end defun
|
||||
|
||||
|
||||
A few debugger commands are for use only within commands defined using
|
||||
the debugger command `define' (they have no effect at other times).
|
||||
These commands exist so that an application can maintain hooks which
|
||||
redirect output without affecting the global I/O vectors.
|
||||
|
||||
@defun with-input-vector name
|
||||
@defunx with-error-output-vector name
|
||||
@defunx with-info-output-vector name
|
||||
@defunx with-value-output-vector name
|
||||
Set an I/O vector, but only temporarily. The setting has effect only
|
||||
within the command definition in which it occurs.
|
||||
@end defun
|
||||
|
||||
|
||||
@heading Initial Conditions
|
||||
|
||||
When libgdb is initialized, a set of default I/O vectors is put in
|
||||
place. The default vectors are called @code{default-input-vector},
|
||||
@code{default-output-vector}, &c.
|
||||
|
||||
The default query function always returns `y'. Other input functions
|
||||
always abort. The default output functions discard output silently.
|
||||
|
||||
|
||||
@node Invoking, Defining Commands, I/O, Top
|
||||
@chapter Invoking the Interpreter, Executing Commands
|
||||
@cindex {executing commands}
|
||||
@cindex {invoking the interpreter}
|
||||
|
||||
This section introduces the libgdb functions which invoke the command
|
||||
interpreter.
|
||||
|
||||
@deftypefun void gdb_execute_command (@var{command})
|
||||
@example
|
||||
char * @var{command};
|
||||
@end example
|
||||
Interpret the argument debugger command. An error handler must be set
|
||||
when this function is called. (@xref{Top Level}.)
|
||||
@end deftypefun
|
||||
|
||||
It is possible to override the current I/O vectors for the duration of a
|
||||
single command:
|
||||
|
||||
@deftypefun void gdb_execute_with_io (@var{command}, @var{vecs})
|
||||
@example
|
||||
char * @var{command};
|
||||
struct gdb_io_vecs * @var{vecs};
|
||||
|
||||
struct gdb_io_vecs
|
||||
@{
|
||||
struct gdb_input_vector * input;
|
||||
struct gdb_output_vector * error;
|
||||
struct gdb_output_vector * info;
|
||||
struct gdb_output_vector * value;
|
||||
@}
|
||||
@end example
|
||||
|
||||
Execute @var{command}, temporarily using the i/o vectors in @var{vecs}.
|
||||
|
||||
Any of the vectors may be NULL, indicating that the current value should
|
||||
be used. An error handler must be in place when this function is used.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun {struct gdb_str_output} gdb_execute_for_strings (@var{cmd})
|
||||
@example
|
||||
char * cmd;
|
||||
@end example
|
||||
@deftypefunx {struct gdb_str_output} gdb_execute_for_strings2 (@var{cmd}, @var{input})
|
||||
@example
|
||||
char * cmd;
|
||||
struct gdb_input_vector * input;
|
||||
@end example
|
||||
@page
|
||||
@example
|
||||
struct gdb_str_output
|
||||
@{
|
||||
char * error;
|
||||
char * info;
|
||||
char * value;
|
||||
@};
|
||||
@end example
|
||||
|
||||
Execute @var{cmd}, collecting its output as strings. If no error
|
||||
occurs, all three strings will be present in the structure, the
|
||||
empty-string rather than NULL standing for no output of a particular
|
||||
kind.
|
||||
|
||||
If the command aborts with an error, then the @code{value} field will be
|
||||
NULL, though the other two strings will be present.
|
||||
|
||||
In all cases, the strings returned are allocated by malloc and should be
|
||||
freed by the caller.
|
||||
|
||||
The first form listed uses the current input vector, but overrides the
|
||||
current output vector. The second form additionally allows the input
|
||||
vector to be overridden.
|
||||
|
||||
This function does not require that an error handler be installed.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void execute_catching_errors (@var{command})
|
||||
@example
|
||||
char * @var{command};
|
||||
@end example
|
||||
Like @code{execute_command} except that no error handler is required.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void execute_with_text (@var{command}, @var{text})
|
||||
@example
|
||||
char * @var{command};
|
||||
char ** @var{text};
|
||||
@end example
|
||||
Like @code{execute_catching_errors}, except that the input vector is
|
||||
overridden. The new input vector handles only calls to @code{query} (by
|
||||
returning 'y') and calls to @code{read_strings} by returning a copy of
|
||||
@var{text} and the strings it points to.
|
||||
|
||||
This form of execute_command is useful for commands like @code{define},
|
||||
@code{document}, and @code{commands}.
|
||||
@end deftypefun
|
||||
|
||||
|
||||
|
||||
@node Defining Commands, Variables, Invoking, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter How New Commands are Created
|
||||
@cindex {commands, defining}
|
||||
|
||||
Applications are, of course, free to take advantage of the existing GDB
|
||||
macro definition capability (the @code{define} and @code{document}
|
||||
functions).
|
||||
|
||||
In addition, an application can add new primitives to the GDB command
|
||||
language.
|
||||
|
||||
@deftypefun void gdb_define_app_command (@var{name}, @var{fn}, @var{doc})
|
||||
@example
|
||||
char * @var{name};
|
||||
gdb_cmd_fn @var{fn};
|
||||
char * @var{doc};
|
||||
|
||||
typedef void (*gdb_cmd_fn) (char * args);
|
||||
@end example
|
||||
|
||||
Create a new command call @var{name}. The new command is in the
|
||||
@code{application} help class. When invoked, the command-line arguments
|
||||
to the command are passed as a single string.
|
||||
|
||||
Calling this function twice with the same name replaces an earlier
|
||||
definition, but application commands can not replace builtin commands of
|
||||
the same name.
|
||||
|
||||
The documentation string of the command is set to a copy the string
|
||||
@var{doc}.
|
||||
@end deftypefun
|
||||
|
||||
@node Variables, Asynchronous, Defining Commands, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter How Builtin Variables are Defined
|
||||
@cindex {variables, defining}
|
||||
|
||||
Convenience variables provide a way for values maintained by libgdb to
|
||||
be referenced in expressions (e.g. @code{$bpnum}). Libgdb includes a
|
||||
means by which the application can define new, integer valued
|
||||
convenience variables:
|
||||
@page
|
||||
@deftypefun void gdb_define_int_var (@var{name}, @var{fn}, @var{fn_arg})
|
||||
@example
|
||||
char * @var{name};
|
||||
int (*@var{fn}) (void *);
|
||||
void * @var{fn_arg};
|
||||
@end example
|
||||
This function defines (or undefines) a convenience variable called @var{name}.
|
||||
If @var{fn} is NULL, the variable becomes undefined. Otherwise,
|
||||
@var{fn} is a function which, when passed @var{fn_arg} returns the value
|
||||
of the newly defined variable.
|
||||
|
||||
No libgdb functions should be called by @var{fn}.
|
||||
@end deftypefun
|
||||
|
||||
One use for this function is to create breakpoint conditions computed in
|
||||
novel ways. This is done by defining a convenience variable and
|
||||
referring to that variable in a breakpoint condition expression.
|
||||
|
||||
|
||||
@node Asynchronous, Commands, Variables, Top
|
||||
@chapter Scheduling Asynchronous Computations
|
||||
@cindex asynchronous
|
||||
|
||||
|
||||
A running libgdb function can take a long time. Libgdb includes a hook
|
||||
so that an application can run intermittently during long debugger
|
||||
operations.
|
||||
|
||||
@deftypefun void gdb_set_poll_fn (@var{fn}, @var{fn_arg})
|
||||
@example
|
||||
void (*@var{fn})(void * fn_arg, int (*gdb_poll)());
|
||||
void * @var{fn_arg};
|
||||
@end example
|
||||
Arrange to call @var{fn} periodically during lengthy debugger operations.
|
||||
If @var{fn} is NULL, polling is turned off. @var{fn} should take two
|
||||
arguments: an opaque pointer passed as @var{fn_arg} to
|
||||
@code{gdb_set_poll_fn}, and a function pointer. The function pointer
|
||||
passed to @var{fn} is provided by libgdb and points to a function that
|
||||
returns 0 when the poll function should return. That is, when
|
||||
@code{(*gdb_poll)()} returns 0, libgdb is ready to continue @var{fn}
|
||||
should return quickly.
|
||||
|
||||
It is possible that @code{(*gdb_poll)()} will return 0 the first time it
|
||||
is called, so it is reasonable for an application to do minimal processing
|
||||
before checking whether to return.
|
||||
|
||||
No libgdb functions should be called from an application's poll function,
|
||||
with one exception: @code{gdb_request_quit}.
|
||||
@end deftypefun
|
||||
|
||||
|
||||
@deftypefun void gdb_request_quit (void)
|
||||
This function, if called from a poll function, requests that the
|
||||
currently executing libgdb command be interrupted as soon as possible,
|
||||
and that control be returned to the top-level via an error.
|
||||
|
||||
The quit is not immediate. It will not occur until at least after the
|
||||
application's poll function returns.
|
||||
@end deftypefun
|
||||
|
||||
@node Commands, Top, Asynchronous, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Debugger Commands for Libgdb Applications
|
||||
|
||||
The debugger commands available to libgdb applications are the same commands
|
||||
available interactively via GDB. This section is an overview of the
|
||||
commands newly created as part of libgdb.
|
||||
|
||||
This section is not by any means a complete reference to the GDB command
|
||||
language. See the GDB manual for such a reference.
|
||||
|
||||
@menu
|
||||
* Command Hooks:: Setting Hooks to Execute With Debugger Commands.
|
||||
* View Commands:: View Commands Mirror Show Commands
|
||||
* Breakpoints:: The Application Can Have Its Own Breakpoints
|
||||
@end menu
|
||||
|
||||
@node Command Hooks, View Commands, Commands, Commands
|
||||
@comment node-name, next, previous, up
|
||||
@section Setting Hooks to Execute With Debugger Commands.
|
||||
|
||||
Debugger commands support hooks. A command hook is executed just before
|
||||
the interpreter invokes the hooked command.
|
||||
|
||||
There are two hooks allowed for every command. By convention, one hook
|
||||
is for use by users, the other is for use by the application.
|
||||
|
||||
A user hook is created for a command XYZZY by using
|
||||
@code{define-command} to create a command called @code{hook-XYZZY}.
|
||||
|
||||
An application hook is created for a command XYZZY by using
|
||||
@code{define-command} to create a command called @code{apphook-XYZZY}.
|
||||
|
||||
Application hooks are useful for interfaces which wish to continuously
|
||||
monitor certain aspects of debugger state. The application can set a
|
||||
hook on all commands that might modify the watched state. When the hook
|
||||
is executed, it can use i/o redirection to notify parts of the
|
||||
application that previous data may be out of date. After the top-level loop
|
||||
resumes, the application can recompute any values that may have changed.
|
||||
(@xref{I/O}.)
|
||||
|
||||
@node View Commands, Breakpoints, Command Hooks, Commands
|
||||
@comment node-name, next, previous, up
|
||||
@section View Commands Mirror Show Commands
|
||||
|
||||
The GDB command language contains many @code{set} and @code{show}
|
||||
commands. These commands are used to modify or examine parameters to
|
||||
the debugger.
|
||||
|
||||
It is difficult to get the current state of a parameter from the
|
||||
@code{show} command because @code{show} is very verbose.
|
||||
|
||||
@example
|
||||
(gdb) show check type
|
||||
Type checking is "auto; currently off".
|
||||
(gdb) show width
|
||||
Number of characters gdb thinks are in a line is 80.
|
||||
@end example
|
||||
|
||||
For every @code{show} command, libgdb includes a @code{view} command.
|
||||
@code{view} is like @code{show} without the verbose commentary:
|
||||
|
||||
@example
|
||||
(gdb) view check type
|
||||
auto; currently off
|
||||
(gdb) view width
|
||||
80
|
||||
@end example
|
||||
|
||||
(The precise format of the ouput from @code{view} is subject to change.
|
||||
In particular, @code{view} may one-day print values which can be used as
|
||||
arguments to the corresponding @code{set} command.)
|
||||
|
||||
@node Breakpoints, Structured Output, View Commands, Commands
|
||||
@comment node-name, next, previous, up
|
||||
@section The Application Can Have Its Own Breakpoints
|
||||
|
||||
The GDB breakpoint commands were written with a strong presumption that
|
||||
all breakpoints are managed by a human user. Therefore, the command
|
||||
language contains commands like `delete' which affect all breakpoints
|
||||
without discrimination.
|
||||
|
||||
In libgdb, there is added support for breakpoints and watchpoints which
|
||||
are set by the application and which should not be affected by ordinary,
|
||||
indiscriminate commands. These are called @dfn{protected} breakpoints.
|
||||
|
||||
@deffn {Debugger Command} break-protected ...
|
||||
@deffnx {Debugger Command} watch-protected ...
|
||||
These work like @code{break} and @code{watch} except that the resulting
|
||||
breakpoint is given a negative number. Negative numbered breakpoints do
|
||||
not appear in the output of @code{info breakpoints} but do in that of
|
||||
@code{info all-breakpoints}. Negative numbered breakpoints are not
|
||||
affected by commands which ordinarily affect `all' breakpoints (e.g.
|
||||
@code{delete} with no arguments).
|
||||
|
||||
Note that libgdb itself creates protected breakpoints, so programs
|
||||
should not rely on being able to allocate particular protected
|
||||
breakpoint numbers for themselves.
|
||||
@end deffn
|
||||
|
||||
More than one breakpoint may be set at a given location. Libgdb adds
|
||||
the concept of @dfn{priority} to breakpoints. A priority is an integer,
|
||||
assigned to each breakpoint. When a breakpoint is reached, the
|
||||
conditions of all breakpoints at the same location are evaluated in
|
||||
order of ascending priority. When breakpoint commands are executed,
|
||||
they are also executed in ascending priority (until all have been
|
||||
executed, an error occurs, or one set of commands continues the
|
||||
target).
|
||||
|
||||
@deffn {Debugger Command} priority n bplist
|
||||
Set the priority for breakpoints @var{bplist} to @var{n}.
|
||||
By default, breakpoints are assigned a priority of zero.
|
||||
@end deffn
|
||||
|
||||
@node Structured Output, Commands, Breakpoints, Commands
|
||||
@comment node-name, next, previous, up
|
||||
@section Structured Output, The @code{Explain} Command
|
||||
|
||||
(This section may be subject to considerable revision.)
|
||||
|
||||
When GDB prints a the value of an expression, the printed representation
|
||||
contains information that can be usefully fed back into future commands
|
||||
and expressions. For example,
|
||||
|
||||
@example
|
||||
(gdb) print foo
|
||||
$16 = @{v = 0x38ae0, v_length = 40@}
|
||||
@end example
|
||||
|
||||
On the basis of this output, a user knows, for example, that
|
||||
@code{$16.v} refers to a pointer valued @code{0x38ae0}
|
||||
|
||||
A new output command helps to make information like this available to
|
||||
the application.
|
||||
|
||||
@deffn {Debugger Command} explain expression
|
||||
@deffnx {Debugger Command} explain /format expression
|
||||
Print the value of @var{expression} in the manner of the @code{print}
|
||||
command, but embed that output in a list syntax containing information
|
||||
about the structure of the output.
|
||||
@end deffn
|
||||
|
||||
As an example, @code{explain argv} might produce this output:
|
||||
|
||||
@example
|
||||
(exp-attribute
|
||||
((expression "$19")
|
||||
(type "char **")
|
||||
(address "48560")
|
||||
(deref-expression "*$19"))
|
||||
"$19 = 0x3800\n")
|
||||
@end example
|
||||
|
||||
The syntax of output from @code{explain} is:
|
||||
|
||||
@example
|
||||
<explanation> := <quoted-string>
|
||||
| (exp-concat <explanation> <explanation>*)
|
||||
| (exp-attribute <property-list> <explanation>)
|
||||
|
||||
<property-list> := ( <property-pair>* )
|
||||
|
||||
<property-pair> := ( <property-name> <quoted-string> )
|
||||
@end example
|
||||
|
||||
The string-concatenation of all of the @code{<quoted-string>} (except
|
||||
those in property lists) yields the output generated by the equivalent
|
||||
@code{print} command. Quoted strings may contain quotes and backslashes
|
||||
if they are escaped by backslash. "\n" in a quoted string stands for
|
||||
newline; unescaped newlines do not occur within the strings output by
|
||||
@code{explain}.
|
||||
|
||||
Property names are made up of alphabetic characters, dashes, and
|
||||
underscores.
|
||||
|
||||
The set of properties is open-ended. As GDB acquires support for new
|
||||
source languages and other new capabilities, new property types may be
|
||||
added to the output of this command. Future commands may offer
|
||||
applications some selectivity concerning which properties are reported.
|
||||
|
||||
The initial set of properties defined includes:
|
||||
|
||||
@itemize @bullet
|
||||
@item @code{expression}
|
||||
|
||||
This is an expression, such as @code{$42} or @code{$42.x}. The
|
||||
expression can be used to refer to the value printed in the attributed
|
||||
part of the string.
|
||||
|
||||
@item @code{type}
|
||||
|
||||
This is a user-readable name for the type of the attributed value.
|
||||
|
||||
@item @code{address}
|
||||
|
||||
If the value is stored in a target register, this is a register number.
|
||||
If the value is stored in a GDB convenience variable, this is an integer
|
||||
that is unique among all the convenience variables. Otherwise, this is
|
||||
the address in the target where the value is stored.
|
||||
|
||||
@item @code{deref-expression}
|
||||
|
||||
If the attributed value is a pointer type, this is an expression that
|
||||
refers to the dereferenced value.
|
||||
@end itemize
|
||||
|
||||
Here is a larger example, using the same object passed to @code{print}
|
||||
in an earlier example of this section.
|
||||
|
||||
@example
|
||||
(gdb) explain foo
|
||||
(exp-attribute
|
||||
( (expression "$16")
|
||||
(type "struct bytecode_vector")
|
||||
(address 14336) )
|
||||
(exp-concat
|
||||
"$16 = @{"
|
||||
(exp-attribute
|
||||
( (expression "$16.v")
|
||||
(type "char *")
|
||||
(address 14336)
|
||||
(deref-expression "*$16.v") )
|
||||
"v = 0x38ae0")
|
||||
(exp-attribute
|
||||
( (expression "$16.v_length")
|
||||
(type "int")
|
||||
(address 14340) )
|
||||
", v_length = 40")
|
||||
"@}\n"))
|
||||
@end example
|
||||
|
||||
It is undefined how libgdb will indent these lines of output or
|
||||
where newlines will be included.
|
||||
|
||||
@bye
|
File diff suppressed because it is too large
Load Diff
@ -1,451 +0,0 @@
|
||||
/* Low level interface to ptrace, for the remote server for GDB.
|
||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "defs.h"
|
||||
#include <sys/wait.h>
|
||||
#include "frame.h"
|
||||
#include "inferior.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/dir.h>
|
||||
#include <sys/user.h>
|
||||
#include <signal.h>
|
||||
#include <sys/ioctl.h>
|
||||
#if 0
|
||||
#include <sgtty.h>
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
|
||||
/***************Begin MY defs*********************/
|
||||
int quit_flag = 0;
|
||||
char registers[REGISTER_BYTES];
|
||||
|
||||
/* Index within `registers' of the first byte of the space for
|
||||
register N. */
|
||||
|
||||
|
||||
char buf2[MAX_REGISTER_RAW_SIZE];
|
||||
/***************End MY defs*********************/
|
||||
|
||||
#include <sys/ptrace.h>
|
||||
|
||||
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1)
|
||||
#include <sys/reg.h>
|
||||
#endif
|
||||
|
||||
extern char **environ;
|
||||
extern int errno;
|
||||
extern int inferior_pid;
|
||||
void quit (), perror_with_name ();
|
||||
int query ();
|
||||
|
||||
/* Start an inferior process and returns its pid.
|
||||
ALLARGS is a vector of program-name and args.
|
||||
ENV is the environment vector to pass. */
|
||||
|
||||
int
|
||||
create_inferior (program, allargs)
|
||||
char *program;
|
||||
char **allargs;
|
||||
{
|
||||
int pid;
|
||||
|
||||
pid = fork ();
|
||||
if (pid < 0)
|
||||
perror_with_name ("fork");
|
||||
|
||||
if (pid == 0)
|
||||
{
|
||||
ptrace (PTRACE_TRACEME, 0, 0, 0);
|
||||
|
||||
execv (program, allargs);
|
||||
|
||||
fprintf (stderr, "Cannot exec %s: %s.\n", program,
|
||||
errno < sys_nerr ? sys_errlist[errno] : "unknown error");
|
||||
fflush (stderr);
|
||||
_exit (0177);
|
||||
}
|
||||
|
||||
return pid;
|
||||
}
|
||||
|
||||
/* Kill the inferior process. Make us have no inferior. */
|
||||
|
||||
void
|
||||
kill_inferior ()
|
||||
{
|
||||
if (inferior_pid == 0)
|
||||
return;
|
||||
ptrace (PTRACE_KILL, inferior_pid, 0, 0);
|
||||
wait (0);
|
||||
/*************inferior_died ();****VK**************/
|
||||
}
|
||||
|
||||
/* Return nonzero if the given thread is still alive. */
|
||||
int
|
||||
mythread_alive (pid)
|
||||
int pid;
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Wait for process, returns status */
|
||||
|
||||
unsigned char
|
||||
mywait (status)
|
||||
char *status;
|
||||
{
|
||||
int pid;
|
||||
union wait w;
|
||||
|
||||
pid = wait (&w);
|
||||
if (pid != inferior_pid)
|
||||
perror_with_name ("wait");
|
||||
|
||||
if (WIFEXITED (w))
|
||||
{
|
||||
fprintf (stderr, "\nChild exited with retcode = %x \n", WEXITSTATUS (w));
|
||||
*status = 'W';
|
||||
return ((unsigned char) WEXITSTATUS (w));
|
||||
}
|
||||
else if (!WIFSTOPPED (w))
|
||||
{
|
||||
fprintf (stderr, "\nChild terminated with signal = %x \n", WTERMSIG (w));
|
||||
*status = 'X';
|
||||
return ((unsigned char) WTERMSIG (w));
|
||||
}
|
||||
|
||||
fetch_inferior_registers (0);
|
||||
|
||||
*status = 'T';
|
||||
return ((unsigned char) WSTOPSIG (w));
|
||||
}
|
||||
|
||||
/* Resume execution of the inferior process.
|
||||
If STEP is nonzero, single-step it.
|
||||
If SIGNAL is nonzero, give it that signal. */
|
||||
|
||||
void
|
||||
myresume (step, signal)
|
||||
int step;
|
||||
int signal;
|
||||
{
|
||||
errno = 0;
|
||||
ptrace (step ? PTRACE_SINGLESTEP : PTRACE_CONT, inferior_pid, 1, signal);
|
||||
if (errno)
|
||||
perror_with_name ("ptrace");
|
||||
}
|
||||
|
||||
|
||||
#if !defined (offsetof)
|
||||
#define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER)
|
||||
#endif
|
||||
|
||||
/* U_REGS_OFFSET is the offset of the registers within the u area. */
|
||||
#if !defined (U_REGS_OFFSET)
|
||||
#define U_REGS_OFFSET \
|
||||
ptrace (PT_READ_U, inferior_pid, \
|
||||
(PTRACE_ARG3_TYPE) (offsetof (struct user, u_ar0)), 0) \
|
||||
- KERNEL_U_ADDR
|
||||
#endif
|
||||
|
||||
#ifndef TARGET_M68K
|
||||
/* this table must line up with REGISTER_NAMES in tm-i386v.h */
|
||||
/* symbols like 'EAX' come from <sys/reg.h> */
|
||||
static int regmap[] =
|
||||
{
|
||||
EAX, ECX, EDX, EBX,
|
||||
UESP, EBP, ESI, EDI,
|
||||
EIP, EFL, CS, SS,
|
||||
DS, ES, FS, GS,
|
||||
};
|
||||
|
||||
int
|
||||
i386_register_u_addr (blockend, regnum)
|
||||
int blockend;
|
||||
int regnum;
|
||||
{
|
||||
#if 0
|
||||
/* this will be needed if fp registers are reinstated */
|
||||
/* for now, you can look at them with 'info float'
|
||||
* sys5 wont let you change them with ptrace anyway
|
||||
*/
|
||||
if (regnum >= FP0_REGNUM && regnum <= FP7_REGNUM)
|
||||
{
|
||||
int ubase, fpstate;
|
||||
struct user u;
|
||||
ubase = blockend + 4 * (SS + 1) - KSTKSZ;
|
||||
fpstate = ubase + ((char *)&u.u_fpstate - (char *)&u);
|
||||
return (fpstate + 0x1c + 10 * (regnum - FP0_REGNUM));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
return (blockend + 4 * regmap[regnum]);
|
||||
|
||||
}
|
||||
#else /* TARGET_M68K */
|
||||
/* This table must line up with REGISTER_NAMES in tm-m68k.h */
|
||||
static int regmap[] =
|
||||
{
|
||||
#ifdef PT_D0
|
||||
PT_D0, PT_D1, PT_D2, PT_D3, PT_D4, PT_D5, PT_D6, PT_D7,
|
||||
PT_A0, PT_A1, PT_A2, PT_A3, PT_A4, PT_A5, PT_A6, PT_USP,
|
||||
PT_SR, PT_PC,
|
||||
#else
|
||||
14, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15,
|
||||
17, 18,
|
||||
#endif
|
||||
#ifdef PT_FP0
|
||||
PT_FP0, PT_FP1, PT_FP2, PT_FP3, PT_FP4, PT_FP5, PT_FP6, PT_FP7,
|
||||
PT_FPCR, PT_FPSR, PT_FPIAR
|
||||
#else
|
||||
21, 24, 27, 30, 33, 36, 39, 42, 45, 46, 47
|
||||
#endif
|
||||
};
|
||||
|
||||
/* BLOCKEND is the value of u.u_ar0, and points to the place where GS
|
||||
is stored. */
|
||||
|
||||
int
|
||||
m68k_linux_register_u_addr (blockend, regnum)
|
||||
int blockend;
|
||||
int regnum;
|
||||
{
|
||||
return (blockend + 4 * regmap[regnum]);
|
||||
}
|
||||
#endif
|
||||
|
||||
CORE_ADDR
|
||||
register_addr (regno, blockend)
|
||||
int regno;
|
||||
CORE_ADDR blockend;
|
||||
{
|
||||
CORE_ADDR addr;
|
||||
|
||||
if (regno < 0 || regno >= ARCH_NUM_REGS)
|
||||
error ("Invalid register number %d.", regno);
|
||||
|
||||
REGISTER_U_ADDR (addr, blockend, regno);
|
||||
|
||||
return addr;
|
||||
}
|
||||
|
||||
/* Fetch one register. */
|
||||
|
||||
static void
|
||||
fetch_register (regno)
|
||||
int regno;
|
||||
{
|
||||
register unsigned int regaddr;
|
||||
register int i;
|
||||
|
||||
/* Offset of registers within the u area. */
|
||||
unsigned int offset;
|
||||
|
||||
offset = U_REGS_OFFSET;
|
||||
|
||||
regaddr = register_addr (regno, offset);
|
||||
for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int))
|
||||
{
|
||||
errno = 0;
|
||||
*(int *) ®isters[ regno * 4 + i] = ptrace (PTRACE_PEEKUSR, inferior_pid,
|
||||
(PTRACE_ARG3_TYPE) regaddr, 0);
|
||||
regaddr += sizeof (int);
|
||||
if (errno != 0)
|
||||
{
|
||||
/* Warning, not error, in case we are attached; sometimes the
|
||||
kernel doesn't let us at the registers. */
|
||||
char *err = strerror (errno);
|
||||
char *msg = alloca (strlen (err) + 128);
|
||||
sprintf (msg, "reading register %d: %s", regno, err);
|
||||
error (msg);
|
||||
goto error_exit;
|
||||
}
|
||||
}
|
||||
error_exit:;
|
||||
}
|
||||
|
||||
/* Fetch all registers, or just one, from the child process. */
|
||||
|
||||
void
|
||||
fetch_inferior_registers (regno)
|
||||
int regno;
|
||||
{
|
||||
if (regno == -1 || regno == 0)
|
||||
for (regno = 0; regno < NUM_REGS-NUM_FREGS; regno++)
|
||||
fetch_register (regno);
|
||||
else
|
||||
fetch_register (regno);
|
||||
}
|
||||
|
||||
/* Store our register values back into the inferior.
|
||||
If REGNO is -1, do this for all registers.
|
||||
Otherwise, REGNO specifies which register (so we can save time). */
|
||||
|
||||
void
|
||||
store_inferior_registers (regno)
|
||||
int regno;
|
||||
{
|
||||
register unsigned int regaddr;
|
||||
register int i;
|
||||
unsigned int offset = U_REGS_OFFSET;
|
||||
|
||||
if (regno >= 0)
|
||||
{
|
||||
#if 0
|
||||
if (CANNOT_STORE_REGISTER (regno))
|
||||
return;
|
||||
#endif
|
||||
regaddr = register_addr (regno, offset);
|
||||
errno = 0;
|
||||
#if 0
|
||||
if (regno == PCOQ_HEAD_REGNUM || regno == PCOQ_TAIL_REGNUM)
|
||||
{
|
||||
scratch = *(int *) ®isters[REGISTER_BYTE (regno)] | 0x3;
|
||||
ptrace (PT_WUREGS, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
|
||||
scratch, 0);
|
||||
if (errno != 0)
|
||||
{
|
||||
/* Error, even if attached. Failing to write these two
|
||||
registers is pretty serious. */
|
||||
sprintf (buf, "writing register number %d", regno);
|
||||
perror_with_name (buf);
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof(int))
|
||||
{
|
||||
errno = 0;
|
||||
ptrace (PTRACE_POKEUSR, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
|
||||
*(int *) ®isters[REGISTER_BYTE (regno) + i]);
|
||||
if (errno != 0)
|
||||
{
|
||||
/* Warning, not error, in case we are attached; sometimes the
|
||||
kernel doesn't let us at the registers. */
|
||||
char *err = strerror (errno);
|
||||
char *msg = alloca (strlen (err) + 128);
|
||||
sprintf (msg, "writing register %d: %s",
|
||||
regno, err);
|
||||
error (msg);
|
||||
return;
|
||||
}
|
||||
regaddr += sizeof(int);
|
||||
}
|
||||
}
|
||||
else
|
||||
for (regno = 0; regno < NUM_REGS-NUM_FREGS; regno++)
|
||||
store_inferior_registers (regno);
|
||||
}
|
||||
|
||||
/* NOTE! I tried using PTRACE_READDATA, etc., to read and write memory
|
||||
in the NEW_SUN_PTRACE case.
|
||||
It ought to be straightforward. But it appears that writing did
|
||||
not write the data that I specified. I cannot understand where
|
||||
it got the data that it actually did write. */
|
||||
|
||||
/* Copy LEN bytes from inferior's memory starting at MEMADDR
|
||||
to debugger memory starting at MYADDR. */
|
||||
|
||||
void
|
||||
read_inferior_memory (memaddr, myaddr, len)
|
||||
CORE_ADDR memaddr;
|
||||
char *myaddr;
|
||||
int len;
|
||||
{
|
||||
register int i;
|
||||
/* Round starting address down to longword boundary. */
|
||||
register CORE_ADDR addr = memaddr & -sizeof (int);
|
||||
/* Round ending address up; get number of longwords that makes. */
|
||||
register int count
|
||||
= (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
|
||||
/* Allocate buffer of that many longwords. */
|
||||
register int *buffer = (int *) alloca (count * sizeof (int));
|
||||
|
||||
/* Read all the longwords */
|
||||
for (i = 0; i < count; i++, addr += sizeof (int))
|
||||
{
|
||||
buffer[i] = ptrace (PTRACE_PEEKTEXT, inferior_pid, addr, 0);
|
||||
}
|
||||
|
||||
/* Copy appropriate bytes out of the buffer. */
|
||||
memcpy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len);
|
||||
}
|
||||
|
||||
/* Copy LEN bytes of data from debugger memory at MYADDR
|
||||
to inferior's memory at MEMADDR.
|
||||
On failure (cannot write the inferior)
|
||||
returns the value of errno. */
|
||||
|
||||
int
|
||||
write_inferior_memory (memaddr, myaddr, len)
|
||||
CORE_ADDR memaddr;
|
||||
char *myaddr;
|
||||
int len;
|
||||
{
|
||||
register int i;
|
||||
/* Round starting address down to longword boundary. */
|
||||
register CORE_ADDR addr = memaddr & -sizeof (int);
|
||||
/* Round ending address up; get number of longwords that makes. */
|
||||
register int count
|
||||
= (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
|
||||
/* Allocate buffer of that many longwords. */
|
||||
register int *buffer = (int *) alloca (count * sizeof (int));
|
||||
extern int errno;
|
||||
|
||||
/* Fill start and end extra bytes of buffer with existing memory data. */
|
||||
|
||||
buffer[0] = ptrace (PTRACE_PEEKTEXT, inferior_pid, addr, 0);
|
||||
|
||||
if (count > 1)
|
||||
{
|
||||
buffer[count - 1]
|
||||
= ptrace (PTRACE_PEEKTEXT, inferior_pid,
|
||||
addr + (count - 1) * sizeof (int), 0);
|
||||
}
|
||||
|
||||
/* Copy data to be written over corresponding part of buffer */
|
||||
|
||||
memcpy ((char *) buffer + (memaddr & (sizeof (int) - 1)), myaddr, len);
|
||||
|
||||
/* Write the entire buffer. */
|
||||
|
||||
for (i = 0; i < count; i++, addr += sizeof (int))
|
||||
{
|
||||
errno = 0;
|
||||
ptrace (PTRACE_POKETEXT, inferior_pid, addr, buffer[i]);
|
||||
if (errno)
|
||||
return errno;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
initialize ()
|
||||
{
|
||||
inferior_pid = 0;
|
||||
}
|
||||
|
||||
int
|
||||
have_inferior_p ()
|
||||
{
|
||||
return inferior_pid != 0;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,576 +0,0 @@
|
||||
/* Definitions for data structures and routines for the regular
|
||||
expression library, version 0.12.
|
||||
Copyright (C) 1985,89,90,91,92,93,95,96,97,98 Free Software Foundation, Inc.
|
||||
|
||||
NOTE: The canonical source of this file is maintained with the
|
||||
GNU C Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu.
|
||||
|
||||
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, 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. */
|
||||
|
||||
#ifndef _REGEX_H
|
||||
#define _REGEX_H 1
|
||||
|
||||
/* Allow the use in C++ code. */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* POSIX says that <sys/types.h> must be included (by the caller) before
|
||||
<regex.h>. */
|
||||
|
||||
#if !defined _POSIX_C_SOURCE && !defined _POSIX_SOURCE && defined VMS
|
||||
/* VMS doesn't have `size_t' in <sys/types.h>, even though POSIX says it
|
||||
should be there. */
|
||||
# include <stddef.h>
|
||||
#endif
|
||||
|
||||
/* GDB LOCAL: define _REGEX_RE_COMP to get BSD style re_comp and re_exec */
|
||||
#ifndef _REGEX_RE_COMP
|
||||
#define _REGEX_RE_COMP
|
||||
#endif
|
||||
|
||||
/* The following two types have to be signed and unsigned integer type
|
||||
wide enough to hold a value of a pointer. For most ANSI compilers
|
||||
ptrdiff_t and size_t should be likely OK. Still size of these two
|
||||
types is 2 for Microsoft C. Ugh... */
|
||||
typedef long int s_reg_t;
|
||||
typedef unsigned long int active_reg_t;
|
||||
|
||||
/* The following bits are used to determine the regexp syntax we
|
||||
recognize. The set/not-set meanings are chosen so that Emacs syntax
|
||||
remains the value 0. The bits are given in alphabetical order, and
|
||||
the definitions shifted by one from the previous bit; thus, when we
|
||||
add or remove a bit, only one other definition need change. */
|
||||
typedef unsigned long int reg_syntax_t;
|
||||
|
||||
/* If this bit is not set, then \ inside a bracket expression is literal.
|
||||
If set, then such a \ quotes the following character. */
|
||||
#define RE_BACKSLASH_ESCAPE_IN_LISTS ((unsigned long int) 1)
|
||||
|
||||
/* If this bit is not set, then + and ? are operators, and \+ and \? are
|
||||
literals.
|
||||
If set, then \+ and \? are operators and + and ? are literals. */
|
||||
#define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1)
|
||||
|
||||
/* If this bit is set, then character classes are supported. They are:
|
||||
[:alpha:], [:upper:], [:lower:], [:digit:], [:alnum:], [:xdigit:],
|
||||
[:space:], [:print:], [:punct:], [:graph:], and [:cntrl:].
|
||||
If not set, then character classes are not supported. */
|
||||
#define RE_CHAR_CLASSES (RE_BK_PLUS_QM << 1)
|
||||
|
||||
/* If this bit is set, then ^ and $ are always anchors (outside bracket
|
||||
expressions, of course).
|
||||
If this bit is not set, then it depends:
|
||||
^ is an anchor if it is at the beginning of a regular
|
||||
expression or after an open-group or an alternation operator;
|
||||
$ is an anchor if it is at the end of a regular expression, or
|
||||
before a close-group or an alternation operator.
|
||||
|
||||
This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because
|
||||
POSIX draft 11.2 says that * etc. in leading positions is undefined.
|
||||
We already implemented a previous draft which made those constructs
|
||||
invalid, though, so we haven't changed the code back. */
|
||||
#define RE_CONTEXT_INDEP_ANCHORS (RE_CHAR_CLASSES << 1)
|
||||
|
||||
/* If this bit is set, then special characters are always special
|
||||
regardless of where they are in the pattern.
|
||||
If this bit is not set, then special characters are special only in
|
||||
some contexts; otherwise they are ordinary. Specifically,
|
||||
* + ? and intervals are only special when not after the beginning,
|
||||
open-group, or alternation operator. */
|
||||
#define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1)
|
||||
|
||||
/* If this bit is set, then *, +, ?, and { cannot be first in an re or
|
||||
immediately after an alternation or begin-group operator. */
|
||||
#define RE_CONTEXT_INVALID_OPS (RE_CONTEXT_INDEP_OPS << 1)
|
||||
|
||||
/* If this bit is set, then . matches newline.
|
||||
If not set, then it doesn't. */
|
||||
#define RE_DOT_NEWLINE (RE_CONTEXT_INVALID_OPS << 1)
|
||||
|
||||
/* If this bit is set, then . doesn't match NUL.
|
||||
If not set, then it does. */
|
||||
#define RE_DOT_NOT_NULL (RE_DOT_NEWLINE << 1)
|
||||
|
||||
/* If this bit is set, nonmatching lists [^...] do not match newline.
|
||||
If not set, they do. */
|
||||
#define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1)
|
||||
|
||||
/* If this bit is set, either \{...\} or {...} defines an
|
||||
interval, depending on RE_NO_BK_BRACES.
|
||||
If not set, \{, \}, {, and } are literals. */
|
||||
#define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1)
|
||||
|
||||
/* If this bit is set, +, ? and | aren't recognized as operators.
|
||||
If not set, they are. */
|
||||
#define RE_LIMITED_OPS (RE_INTERVALS << 1)
|
||||
|
||||
/* If this bit is set, newline is an alternation operator.
|
||||
If not set, newline is literal. */
|
||||
#define RE_NEWLINE_ALT (RE_LIMITED_OPS << 1)
|
||||
|
||||
/* If this bit is set, then `{...}' defines an interval, and \{ and \}
|
||||
are literals.
|
||||
If not set, then `\{...\}' defines an interval. */
|
||||
#define RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1)
|
||||
|
||||
/* If this bit is set, (...) defines a group, and \( and \) are literals.
|
||||
If not set, \(...\) defines a group, and ( and ) are literals. */
|
||||
#define RE_NO_BK_PARENS (RE_NO_BK_BRACES << 1)
|
||||
|
||||
/* If this bit is set, then \<digit> matches <digit>.
|
||||
If not set, then \<digit> is a back-reference. */
|
||||
#define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1)
|
||||
|
||||
/* If this bit is set, then | is an alternation operator, and \| is literal.
|
||||
If not set, then \| is an alternation operator, and | is literal. */
|
||||
#define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1)
|
||||
|
||||
/* If this bit is set, then an ending range point collating higher
|
||||
than the starting range point, as in [z-a], is invalid.
|
||||
If not set, then when ending range point collates higher than the
|
||||
starting range point, the range is ignored. */
|
||||
#define RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1)
|
||||
|
||||
/* If this bit is set, then an unmatched ) is ordinary.
|
||||
If not set, then an unmatched ) is invalid. */
|
||||
#define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1)
|
||||
|
||||
/* If this bit is set, succeed as soon as we match the whole pattern,
|
||||
without further backtracking. */
|
||||
#define RE_NO_POSIX_BACKTRACKING (RE_UNMATCHED_RIGHT_PAREN_ORD << 1)
|
||||
|
||||
/* If this bit is set, do not process the GNU regex operators.
|
||||
If not set, then the GNU regex operators are recognized. */
|
||||
#define RE_NO_GNU_OPS (RE_NO_POSIX_BACKTRACKING << 1)
|
||||
|
||||
/* If this bit is set, turn on internal regex debugging.
|
||||
If not set, and debugging was on, turn it off.
|
||||
This only works if regex.c is compiled -DDEBUG.
|
||||
We define this bit always, so that all that's needed to turn on
|
||||
debugging is to recompile regex.c; the calling code can always have
|
||||
this bit set, and it won't affect anything in the normal case. */
|
||||
#define RE_DEBUG (RE_NO_GNU_OPS << 1)
|
||||
|
||||
/* This global variable defines the particular regexp syntax to use (for
|
||||
some interfaces). When a regexp is compiled, the syntax used is
|
||||
stored in the pattern buffer, so changing this does not affect
|
||||
already-compiled regexps. */
|
||||
extern reg_syntax_t re_syntax_options;
|
||||
|
||||
/* Define combinations of the above bits for the standard possibilities.
|
||||
(The [[[ comments delimit what gets put into the Texinfo file, so
|
||||
don't delete them!) */
|
||||
/* [[[begin syntaxes]]] */
|
||||
#define RE_SYNTAX_EMACS 0
|
||||
|
||||
#define RE_SYNTAX_AWK \
|
||||
(RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \
|
||||
| RE_NO_BK_PARENS | RE_NO_BK_REFS \
|
||||
| RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \
|
||||
| RE_DOT_NEWLINE | RE_CONTEXT_INDEP_ANCHORS \
|
||||
| RE_UNMATCHED_RIGHT_PAREN_ORD | RE_NO_GNU_OPS)
|
||||
|
||||
#define RE_SYNTAX_GNU_AWK \
|
||||
((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DEBUG) \
|
||||
& ~(RE_DOT_NOT_NULL | RE_INTERVALS | RE_CONTEXT_INDEP_OPS))
|
||||
|
||||
#define RE_SYNTAX_POSIX_AWK \
|
||||
(RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS \
|
||||
| RE_INTERVALS | RE_NO_GNU_OPS)
|
||||
|
||||
#define RE_SYNTAX_GREP \
|
||||
(RE_BK_PLUS_QM | RE_CHAR_CLASSES \
|
||||
| RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS \
|
||||
| RE_NEWLINE_ALT)
|
||||
|
||||
#define RE_SYNTAX_EGREP \
|
||||
(RE_CHAR_CLASSES | RE_CONTEXT_INDEP_ANCHORS \
|
||||
| RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE \
|
||||
| RE_NEWLINE_ALT | RE_NO_BK_PARENS \
|
||||
| RE_NO_BK_VBAR)
|
||||
|
||||
#define RE_SYNTAX_POSIX_EGREP \
|
||||
(RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES)
|
||||
|
||||
/* P1003.2/D11.2, section 4.20.7.1, lines 5078ff. */
|
||||
#define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC
|
||||
|
||||
#define RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC
|
||||
|
||||
/* Syntax bits common to both basic and extended POSIX regex syntax. */
|
||||
#define _RE_SYNTAX_POSIX_COMMON \
|
||||
(RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \
|
||||
| RE_INTERVALS | RE_NO_EMPTY_RANGES)
|
||||
|
||||
#define RE_SYNTAX_POSIX_BASIC \
|
||||
(_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM)
|
||||
|
||||
/* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes
|
||||
RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this
|
||||
isn't minimal, since other operators, such as \`, aren't disabled. */
|
||||
#define RE_SYNTAX_POSIX_MINIMAL_BASIC \
|
||||
(_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS)
|
||||
|
||||
#define RE_SYNTAX_POSIX_EXTENDED \
|
||||
(_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
|
||||
| RE_CONTEXT_INDEP_OPS | RE_NO_BK_BRACES \
|
||||
| RE_NO_BK_PARENS | RE_NO_BK_VBAR \
|
||||
| RE_UNMATCHED_RIGHT_PAREN_ORD)
|
||||
|
||||
/* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INVALID_OPS
|
||||
replaces RE_CONTEXT_INDEP_OPS and RE_NO_BK_REFS is added. */
|
||||
#define RE_SYNTAX_POSIX_MINIMAL_EXTENDED \
|
||||
(_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
|
||||
| RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES \
|
||||
| RE_NO_BK_PARENS | RE_NO_BK_REFS \
|
||||
| RE_NO_BK_VBAR | RE_UNMATCHED_RIGHT_PAREN_ORD)
|
||||
/* [[[end syntaxes]]] */
|
||||
|
||||
/* Maximum number of duplicates an interval can allow. Some systems
|
||||
(erroneously) define this in other header files, but we want our
|
||||
value, so remove any previous define. */
|
||||
#ifdef RE_DUP_MAX
|
||||
# undef RE_DUP_MAX
|
||||
#endif
|
||||
/* If sizeof(int) == 2, then ((1 << 15) - 1) overflows. */
|
||||
#define RE_DUP_MAX (0x7fff)
|
||||
|
||||
|
||||
/* POSIX `cflags' bits (i.e., information for `regcomp'). */
|
||||
|
||||
/* If this bit is set, then use extended regular expression syntax.
|
||||
If not set, then use basic regular expression syntax. */
|
||||
#define REG_EXTENDED 1
|
||||
|
||||
/* If this bit is set, then ignore case when matching.
|
||||
If not set, then case is significant. */
|
||||
#define REG_ICASE (REG_EXTENDED << 1)
|
||||
|
||||
/* If this bit is set, then anchors do not match at newline
|
||||
characters in the string.
|
||||
If not set, then anchors do match at newlines. */
|
||||
#define REG_NEWLINE (REG_ICASE << 1)
|
||||
|
||||
/* If this bit is set, then report only success or fail in regexec.
|
||||
If not set, then returns differ between not matching and errors. */
|
||||
#define REG_NOSUB (REG_NEWLINE << 1)
|
||||
|
||||
|
||||
/* POSIX `eflags' bits (i.e., information for regexec). */
|
||||
|
||||
/* If this bit is set, then the beginning-of-line operator doesn't match
|
||||
the beginning of the string (presumably because it's not the
|
||||
beginning of a line).
|
||||
If not set, then the beginning-of-line operator does match the
|
||||
beginning of the string. */
|
||||
#define REG_NOTBOL 1
|
||||
|
||||
/* Like REG_NOTBOL, except for the end-of-line. */
|
||||
#define REG_NOTEOL (1 << 1)
|
||||
|
||||
|
||||
/* If any error codes are removed, changed, or added, update the
|
||||
`re_error_msg' table in regex.c. */
|
||||
typedef enum
|
||||
{
|
||||
#if (_XOPEN_SOURCE - 0) == 500
|
||||
REG_NOSYS = -1, /* This will never happen for this implementation. */
|
||||
#endif
|
||||
|
||||
REG_NOERROR = 0, /* Success. */
|
||||
REG_NOMATCH, /* Didn't find a match (for regexec). */
|
||||
|
||||
/* POSIX regcomp return error codes. (In the order listed in the
|
||||
standard.) */
|
||||
REG_BADPAT, /* Invalid pattern. */
|
||||
REG_ECOLLATE, /* Not implemented. */
|
||||
REG_ECTYPE, /* Invalid character class name. */
|
||||
REG_EESCAPE, /* Trailing backslash. */
|
||||
REG_ESUBREG, /* Invalid back reference. */
|
||||
REG_EBRACK, /* Unmatched left bracket. */
|
||||
REG_EPAREN, /* Parenthesis imbalance. */
|
||||
REG_EBRACE, /* Unmatched \{. */
|
||||
REG_BADBR, /* Invalid contents of \{\}. */
|
||||
REG_ERANGE, /* Invalid range end. */
|
||||
REG_ESPACE, /* Ran out of memory. */
|
||||
REG_BADRPT, /* No preceding re for repetition op. */
|
||||
|
||||
/* Error codes we've added. */
|
||||
REG_EEND, /* Premature end. */
|
||||
REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */
|
||||
REG_ERPAREN /* Unmatched ) or \); not returned from regcomp. */
|
||||
} reg_errcode_t;
|
||||
|
||||
/* This data structure represents a compiled pattern. Before calling
|
||||
the pattern compiler, the fields `buffer', `allocated', `fastmap',
|
||||
`translate', and `no_sub' can be set. After the pattern has been
|
||||
compiled, the `re_nsub' field is available. All other fields are
|
||||
private to the regex routines. */
|
||||
|
||||
#ifndef RE_TRANSLATE_TYPE
|
||||
# define RE_TRANSLATE_TYPE char *
|
||||
#endif
|
||||
|
||||
struct re_pattern_buffer
|
||||
{
|
||||
/* [[[begin pattern_buffer]]] */
|
||||
/* Space that holds the compiled pattern. It is declared as
|
||||
`unsigned char *' because its elements are
|
||||
sometimes used as array indexes. */
|
||||
unsigned char *buffer;
|
||||
|
||||
/* Number of bytes to which `buffer' points. */
|
||||
unsigned long int allocated;
|
||||
|
||||
/* Number of bytes actually used in `buffer'. */
|
||||
unsigned long int used;
|
||||
|
||||
/* Syntax setting with which the pattern was compiled. */
|
||||
reg_syntax_t syntax;
|
||||
|
||||
/* Pointer to a fastmap, if any, otherwise zero. re_search uses
|
||||
the fastmap, if there is one, to skip over impossible
|
||||
starting points for matches. */
|
||||
char *fastmap;
|
||||
|
||||
/* Either a translate table to apply to all characters before
|
||||
comparing them, or zero for no translation. The translation
|
||||
is applied to a pattern when it is compiled and to a string
|
||||
when it is matched. */
|
||||
RE_TRANSLATE_TYPE translate;
|
||||
|
||||
/* Number of subexpressions found by the compiler. */
|
||||
size_t re_nsub;
|
||||
|
||||
/* Zero if this pattern cannot match the empty string, one else.
|
||||
Well, in truth it's used only in `re_search_2', to see
|
||||
whether or not we should use the fastmap, so we don't set
|
||||
this absolutely perfectly; see `re_compile_fastmap' (the
|
||||
`duplicate' case). */
|
||||
unsigned can_be_null : 1;
|
||||
|
||||
/* If REGS_UNALLOCATED, allocate space in the `regs' structure
|
||||
for `max (RE_NREGS, re_nsub + 1)' groups.
|
||||
If REGS_REALLOCATE, reallocate space if necessary.
|
||||
If REGS_FIXED, use what's there. */
|
||||
#define REGS_UNALLOCATED 0
|
||||
#define REGS_REALLOCATE 1
|
||||
#define REGS_FIXED 2
|
||||
unsigned regs_allocated : 2;
|
||||
|
||||
/* Set to zero when `regex_compile' compiles a pattern; set to one
|
||||
by `re_compile_fastmap' if it updates the fastmap. */
|
||||
unsigned fastmap_accurate : 1;
|
||||
|
||||
/* If set, `re_match_2' does not return information about
|
||||
subexpressions. */
|
||||
unsigned no_sub : 1;
|
||||
|
||||
/* If set, a beginning-of-line anchor doesn't match at the
|
||||
beginning of the string. */
|
||||
unsigned not_bol : 1;
|
||||
|
||||
/* Similarly for an end-of-line anchor. */
|
||||
unsigned not_eol : 1;
|
||||
|
||||
/* If true, an anchor at a newline matches. */
|
||||
unsigned newline_anchor : 1;
|
||||
|
||||
/* [[[end pattern_buffer]]] */
|
||||
};
|
||||
|
||||
typedef struct re_pattern_buffer regex_t;
|
||||
|
||||
/* Type for byte offsets within the string. POSIX mandates this. */
|
||||
typedef int regoff_t;
|
||||
|
||||
|
||||
/* This is the structure we store register match data in. See
|
||||
regex.texinfo for a full description of what registers match. */
|
||||
struct re_registers
|
||||
{
|
||||
unsigned num_regs;
|
||||
regoff_t *start;
|
||||
regoff_t *end;
|
||||
};
|
||||
|
||||
|
||||
/* If `regs_allocated' is REGS_UNALLOCATED in the pattern buffer,
|
||||
`re_match_2' returns information about at least this many registers
|
||||
the first time a `regs' structure is passed. */
|
||||
#ifndef RE_NREGS
|
||||
# define RE_NREGS 30
|
||||
#endif
|
||||
|
||||
|
||||
/* POSIX specification for registers. Aside from the different names than
|
||||
`re_registers', POSIX uses an array of structures, instead of a
|
||||
structure of arrays. */
|
||||
typedef struct
|
||||
{
|
||||
regoff_t rm_so; /* Byte offset from string's start to substring's start. */
|
||||
regoff_t rm_eo; /* Byte offset from string's start to substring's end. */
|
||||
} regmatch_t;
|
||||
|
||||
/* Declarations for routines. */
|
||||
|
||||
/* To avoid duplicating every routine declaration -- once with a
|
||||
prototype (if we are ANSI), and once without (if we aren't) -- we
|
||||
use the following macro to declare argument types. This
|
||||
unfortunately clutters up the declarations a bit, but I think it's
|
||||
worth it. */
|
||||
|
||||
#if __STDC__
|
||||
|
||||
# define _RE_ARGS(args) args
|
||||
|
||||
#else /* not __STDC__ */
|
||||
|
||||
# define _RE_ARGS(args) ()
|
||||
|
||||
#endif /* not __STDC__ */
|
||||
|
||||
/* Sets the current default syntax to SYNTAX, and return the old syntax.
|
||||
You can also simply assign to the `re_syntax_options' variable. */
|
||||
extern reg_syntax_t __re_set_syntax _RE_ARGS ((reg_syntax_t syntax));
|
||||
extern reg_syntax_t re_set_syntax _RE_ARGS ((reg_syntax_t syntax));
|
||||
|
||||
/* Compile the regular expression PATTERN, with length LENGTH
|
||||
and syntax given by the global `re_syntax_options', into the buffer
|
||||
BUFFER. Return NULL if successful, and an error string if not. */
|
||||
extern const char *__re_compile_pattern
|
||||
_RE_ARGS ((const char *pattern, size_t length,
|
||||
struct re_pattern_buffer *buffer));
|
||||
extern const char *re_compile_pattern
|
||||
_RE_ARGS ((const char *pattern, size_t length,
|
||||
struct re_pattern_buffer *buffer));
|
||||
|
||||
|
||||
/* Compile a fastmap for the compiled pattern in BUFFER; used to
|
||||
accelerate searches. Return 0 if successful and -2 if was an
|
||||
internal error. */
|
||||
extern int __re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *buffer));
|
||||
extern int re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *buffer));
|
||||
|
||||
|
||||
/* Search in the string STRING (with length LENGTH) for the pattern
|
||||
compiled into BUFFER. Start searching at position START, for RANGE
|
||||
characters. Return the starting position of the match, -1 for no
|
||||
match, or -2 for an internal error. Also return register
|
||||
information in REGS (if REGS and BUFFER->no_sub are nonzero). */
|
||||
extern int __re_search
|
||||
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,
|
||||
int length, int start, int range, struct re_registers *regs));
|
||||
extern int re_search
|
||||
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,
|
||||
int length, int start, int range, struct re_registers *regs));
|
||||
|
||||
|
||||
/* Like `re_search', but search in the concatenation of STRING1 and
|
||||
STRING2. Also, stop searching at index START + STOP. */
|
||||
extern int __re_search_2
|
||||
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
|
||||
int length1, const char *string2, int length2,
|
||||
int start, int range, struct re_registers *regs, int stop));
|
||||
extern int re_search_2
|
||||
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
|
||||
int length1, const char *string2, int length2,
|
||||
int start, int range, struct re_registers *regs, int stop));
|
||||
|
||||
|
||||
/* Like `re_search', but return how many characters in STRING the regexp
|
||||
in BUFFER matched, starting at position START. */
|
||||
extern int __re_match
|
||||
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,
|
||||
int length, int start, struct re_registers *regs));
|
||||
extern int re_match
|
||||
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,
|
||||
int length, int start, struct re_registers *regs));
|
||||
|
||||
|
||||
/* Relates to `re_match' as `re_search_2' relates to `re_search'. */
|
||||
extern int __re_match_2
|
||||
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
|
||||
int length1, const char *string2, int length2,
|
||||
int start, struct re_registers *regs, int stop));
|
||||
extern int re_match_2
|
||||
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
|
||||
int length1, const char *string2, int length2,
|
||||
int start, struct re_registers *regs, int stop));
|
||||
|
||||
|
||||
/* Set REGS to hold NUM_REGS registers, storing them in STARTS and
|
||||
ENDS. Subsequent matches using BUFFER and REGS will use this memory
|
||||
for recording register information. STARTS and ENDS must be
|
||||
allocated with malloc, and must each be at least `NUM_REGS * sizeof
|
||||
(regoff_t)' bytes long.
|
||||
|
||||
If NUM_REGS == 0, then subsequent matches should allocate their own
|
||||
register data.
|
||||
|
||||
Unless this function is called, the first search or match using
|
||||
PATTERN_BUFFER will allocate its own register data, without
|
||||
freeing the old data. */
|
||||
extern void __re_set_registers
|
||||
_RE_ARGS ((struct re_pattern_buffer *buffer, struct re_registers *regs,
|
||||
unsigned num_regs, regoff_t *starts, regoff_t *ends));
|
||||
extern void re_set_registers
|
||||
_RE_ARGS ((struct re_pattern_buffer *buffer, struct re_registers *regs,
|
||||
unsigned num_regs, regoff_t *starts, regoff_t *ends));
|
||||
|
||||
#ifdef _REGEX_RE_COMP
|
||||
# ifndef _CRAY
|
||||
/* 4.2 bsd compatibility. */
|
||||
extern char *re_comp _RE_ARGS ((const char *));
|
||||
extern int re_exec _RE_ARGS ((const char *));
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* POSIX compatibility. */
|
||||
extern int __regcomp _RE_ARGS ((regex_t *__preg, const char *__pattern,
|
||||
int __cflags));
|
||||
extern int regcomp _RE_ARGS ((regex_t *__preg, const char *__pattern,
|
||||
int __cflags));
|
||||
|
||||
extern int __regexec _RE_ARGS ((const regex_t *__preg,
|
||||
const char *__string, size_t __nmatch,
|
||||
regmatch_t __pmatch[], int __eflags));
|
||||
extern int regexec _RE_ARGS ((const regex_t *__preg,
|
||||
const char *__string, size_t __nmatch,
|
||||
regmatch_t __pmatch[], int __eflags));
|
||||
|
||||
extern size_t __regerror _RE_ARGS ((int __errcode, const regex_t *__preg,
|
||||
char *__errbuf, size_t __errbuf_size));
|
||||
extern size_t regerror _RE_ARGS ((int __errcode, const regex_t *__preg,
|
||||
char *__errbuf, size_t __errbuf_size));
|
||||
|
||||
extern void __regfree _RE_ARGS ((regex_t *__preg));
|
||||
extern void regfree _RE_ARGS ((regex_t *__preg));
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* C++ */
|
||||
|
||||
#endif /* regex.h */
|
||||
|
||||
/*
|
||||
Local variables:
|
||||
make-backup-files: t
|
||||
version-control: t
|
||||
trim-versions-without-asking: nil
|
||||
End:
|
||||
*/
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,150 +0,0 @@
|
||||
/* hpread.h
|
||||
* Common include file for:
|
||||
* hp_symtab_read.c
|
||||
* hp_psymtab_read.c
|
||||
*/
|
||||
|
||||
/* Copyright 1993, 1996 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Written by the Center for Software Science at the University of Utah
|
||||
and by Cygnus Support. */
|
||||
|
||||
#include "defs.h"
|
||||
#include "bfd.h"
|
||||
#include "gdb_string.h"
|
||||
#include "hp-symtab.h"
|
||||
#include "syms.h"
|
||||
#include "symtab.h"
|
||||
#include "symfile.h"
|
||||
#include "objfiles.h"
|
||||
#include "buildsym.h"
|
||||
#include "complaints.h"
|
||||
#include "gdb-stabs.h"
|
||||
#include "gdbtypes.h"
|
||||
#include "demangle.h"
|
||||
|
||||
/* Private information attached to an objfile which we use to find
|
||||
and internalize the HP C debug symbols within that objfile. */
|
||||
|
||||
struct hpread_symfile_info
|
||||
{
|
||||
/* The contents of each of the debug sections (there are 4 of them). */
|
||||
char *gntt;
|
||||
char *lntt;
|
||||
char *slt;
|
||||
char *vt;
|
||||
|
||||
/* We keep the size of the $VT$ section for range checking. */
|
||||
unsigned int vt_size;
|
||||
|
||||
/* Some routines still need to know the number of symbols in the
|
||||
main debug sections ($LNTT$ and $GNTT$). */
|
||||
unsigned int lntt_symcount;
|
||||
unsigned int gntt_symcount;
|
||||
|
||||
/* To keep track of all the types we've processed. */
|
||||
struct type **type_vector;
|
||||
int type_vector_length;
|
||||
|
||||
/* Keeps track of the beginning of a range of source lines. */
|
||||
sltpointer sl_index;
|
||||
|
||||
/* Some state variables we'll need. */
|
||||
int within_function;
|
||||
|
||||
/* Keep track of the current function's address. We may need to look
|
||||
up something based on this address. */
|
||||
unsigned int current_function_value;
|
||||
};
|
||||
|
||||
/* Accessor macros to get at the fields. */
|
||||
#define HPUX_SYMFILE_INFO(o) \
|
||||
((struct hpread_symfile_info *)((o)->sym_private))
|
||||
#define GNTT(o) (HPUX_SYMFILE_INFO(o)->gntt)
|
||||
#define LNTT(o) (HPUX_SYMFILE_INFO(o)->lntt)
|
||||
#define SLT(o) (HPUX_SYMFILE_INFO(o)->slt)
|
||||
#define VT(o) (HPUX_SYMFILE_INFO(o)->vt)
|
||||
#define VT_SIZE(o) (HPUX_SYMFILE_INFO(o)->vt_size)
|
||||
#define LNTT_SYMCOUNT(o) (HPUX_SYMFILE_INFO(o)->lntt_symcount)
|
||||
#define GNTT_SYMCOUNT(o) (HPUX_SYMFILE_INFO(o)->gntt_symcount)
|
||||
#define TYPE_VECTOR(o) (HPUX_SYMFILE_INFO(o)->type_vector)
|
||||
#define TYPE_VECTOR_LENGTH(o) (HPUX_SYMFILE_INFO(o)->type_vector_length)
|
||||
#define SL_INDEX(o) (HPUX_SYMFILE_INFO(o)->sl_index)
|
||||
#define WITHIN_FUNCTION(o) (HPUX_SYMFILE_INFO(o)->within_function)
|
||||
#define CURRENT_FUNCTION_VALUE(o) (HPUX_SYMFILE_INFO(o)->current_function_value)
|
||||
|
||||
/* Given the native debug symbol SYM, set NAMEP to the name associated
|
||||
with the debug symbol. Note we may be called with a debug symbol which
|
||||
has no associated name, in that case we return an empty string.
|
||||
|
||||
Also note we "know" that the name for any symbol is always in the
|
||||
same place. Hence we don't have to conditionalize on the symbol type. */
|
||||
#define SET_NAMESTRING(SYM, NAMEP, OBJFILE) \
|
||||
if (! hpread_has_name ((SYM)->dblock.kind)) \
|
||||
*NAMEP = ""; \
|
||||
else if (((unsigned)(SYM)->dsfile.name) >= VT_SIZE (OBJFILE)) \
|
||||
{ \
|
||||
complain (&string_table_offset_complaint, (char *) symnum); \
|
||||
*NAMEP = ""; \
|
||||
} \
|
||||
else \
|
||||
*NAMEP = (SYM)->dsfile.name + VT (OBJFILE)
|
||||
|
||||
/* We put a pointer to this structure in the read_symtab_private field
|
||||
of the psymtab. */
|
||||
|
||||
struct symloc
|
||||
{
|
||||
/* The offset within the file symbol table of first local symbol for
|
||||
this file. */
|
||||
|
||||
int ldsymoff;
|
||||
|
||||
/* Length (in bytes) of the section of the symbol table devoted to
|
||||
this file's symbols (actually, the section bracketed may contain
|
||||
more than just this file's symbols). If ldsymlen is 0, the only
|
||||
reason for this thing's existence is the dependency list.
|
||||
Nothing else will happen when it is read in. */
|
||||
|
||||
int ldsymlen;
|
||||
};
|
||||
|
||||
#define LDSYMOFF(p) (((struct symloc *)((p)->read_symtab_private))->ldsymoff)
|
||||
#define LDSYMLEN(p) (((struct symloc *)((p)->read_symtab_private))->ldsymlen)
|
||||
#define SYMLOC(p) ((struct symloc *)((p)->read_symtab_private))
|
||||
|
||||
/* FIXME: Shouldn't this stuff be in a .h file somewhere? */
|
||||
/* Nonzero means give verbose info on gdb action. */
|
||||
extern int info_verbose;
|
||||
|
||||
/* Complaints about the symbols we have encountered. */
|
||||
extern struct complaint string_table_offset_complaint;
|
||||
extern struct complaint lbrac_unmatched_complaint;
|
||||
extern struct complaint lbrac_mismatch_complaint;
|
||||
|
||||
extern union sltentry *hpread_get_slt
|
||||
PARAMS ((int, struct objfile *));
|
||||
|
||||
extern union dnttentry *hpread_get_lntt
|
||||
PARAMS ((int, struct objfile *));
|
||||
|
||||
int hpread_has_name
|
||||
PARAMS ((enum dntt_entry_type));
|
||||
|
||||
/* end of hpread.h */
|
File diff suppressed because it is too large
Load Diff
@ -1,27 +0,0 @@
|
||||
/* Signal handler definitions for GDB, the GNU Debugger.
|
||||
Copyright (C) 1986, 1989 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
|
||||
/* This file is almost the same as including <signal.h> except that it
|
||||
eliminates certain signal names when job control is not supported,
|
||||
(or, on some systems, when job control is there but doesn't work
|
||||
the way GDB expects it to work). */
|
||||
/* This has been superceded by the job_control variable in serial.h. */
|
||||
|
||||
#include <signal.h>
|
Loading…
Reference in New Issue
Block a user