* configure.in: Check for unistd.h.
* configure: Regenerated. * command.c, cp-valprint.c, fork-child.c, i386-tdep.c, i386b-nat.c, inflow.c, main.c, maint.c, objfiles.c, solib.c, source.c, stack.c, symfile.c, top.c, utils.c: Include strings.h and/or unistd.h to bring prototypes into scope.
This commit is contained in:
parent
f641906be5
commit
1a49497348
18 changed files with 564 additions and 319 deletions
|
@ -1,3 +1,24 @@
|
||||||
|
Mon Jul 31 14:32:30 1995 J.T. Conklin <jtc@rtl.cygnus.com>
|
||||||
|
|
||||||
|
* configure.in: Check for unistd.h.
|
||||||
|
* configure: Regenerated.
|
||||||
|
|
||||||
|
* command.c, cp-valprint.c, fork-child.c, i386-tdep.c,
|
||||||
|
i386b-nat.c, inflow.c, main.c, maint.c, objfiles.c, solib.c,
|
||||||
|
source.c, stack.c, symfile.c, top.c, utils.c: Include strings.h
|
||||||
|
and/or unistd.h to bring prototypes into scope.
|
||||||
|
|
||||||
|
Sun Jul 30 01:40:11 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
|
||||||
|
|
||||||
|
* rs6000-tdep.c (frame_saved_pc): Check for signal handler caller
|
||||||
|
before trying to determine the start of the function.
|
||||||
|
(skip_prologue): Skip subroutine call which might save the
|
||||||
|
floating point registers only if it is within the first three
|
||||||
|
instructions.
|
||||||
|
Reinstate setting of alloca_reg if setup of a gcc frame pointer
|
||||||
|
is found.
|
||||||
|
(frame_get_cache_fsr): Use new fields in rs6000_framedata.
|
||||||
|
|
||||||
Sat Jul 29 14:43:35 1995 Stan Shebs <shebs@andros.cygnus.com>
|
Sat Jul 29 14:43:35 1995 Stan Shebs <shebs@andros.cygnus.com>
|
||||||
|
|
||||||
* sparclite: Removed subdirectory. aload and eload are now in
|
* sparclite: Removed subdirectory. aload and eload are now in
|
||||||
|
|
|
@ -21,6 +21,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#include "value.h"
|
#include "value.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Prototypes for local functions */
|
/* Prototypes for local functions */
|
||||||
|
|
||||||
|
|
54
gdb/configure
vendored
54
gdb/configure
vendored
|
@ -847,6 +847,42 @@ test "$program_suffix" != NONE &&
|
||||||
test "$program_transform_name" = "" && program_transform_name="s,x,x,"
|
test "$program_transform_name" = "" && program_transform_name="s,x,x,"
|
||||||
|
|
||||||
|
|
||||||
|
for ac_hdr in unistd.h
|
||||||
|
do
|
||||||
|
ac_safe=`echo "$ac_hdr" | tr './\055' '___'`
|
||||||
|
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
|
||||||
|
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
|
||||||
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
|
else
|
||||||
|
cat > conftest.$ac_ext <<EOF
|
||||||
|
#line 859 "configure"
|
||||||
|
#include "confdefs.h"
|
||||||
|
#include <$ac_hdr>
|
||||||
|
EOF
|
||||||
|
eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||||
|
ac_err=`grep -v '^ *+' conftest.out`
|
||||||
|
if test -z "$ac_err"; then
|
||||||
|
rm -rf conftest*
|
||||||
|
eval "ac_cv_header_$ac_safe=yes"
|
||||||
|
else
|
||||||
|
echo "$ac_err" >&5
|
||||||
|
rm -rf conftest*
|
||||||
|
eval "ac_cv_header_$ac_safe=no"
|
||||||
|
fi
|
||||||
|
rm -f conftest*
|
||||||
|
fi
|
||||||
|
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
|
||||||
|
echo "$ac_t""yes" 1>&6
|
||||||
|
ac_tr_hdr=HAVE_`echo $ac_hdr | tr '[a-z]./\055' '[A-Z]___'`
|
||||||
|
cat >> confdefs.h <<EOF
|
||||||
|
#define $ac_tr_hdr 1
|
||||||
|
EOF
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "$ac_t""no" 1>&6
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
ENABLE_CFLAGS=
|
ENABLE_CFLAGS=
|
||||||
ENABLE_CLIBS=
|
ENABLE_CLIBS=
|
||||||
|
@ -943,7 +979,7 @@ test -z "$x_direct_test_library" && x_direct_test_library=Xt
|
||||||
test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc
|
test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc
|
||||||
test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h
|
test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 945 "configure"
|
#line 983 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
#include <$x_direct_test_include>
|
#include <$x_direct_test_include>
|
||||||
EOF
|
EOF
|
||||||
|
@ -1006,7 +1042,7 @@ rm -f conftest*
|
||||||
ac_save_LIBS="$LIBS"
|
ac_save_LIBS="$LIBS"
|
||||||
LIBS="-l$x_direct_test_library $LIBS"
|
LIBS="-l$x_direct_test_library $LIBS"
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 1008 "configure"
|
#line 1046 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
|
|
||||||
int main() { return 0; }
|
int main() { return 0; }
|
||||||
|
@ -1124,7 +1160,7 @@ else
|
||||||
ac_save_LIBS="$LIBS"
|
ac_save_LIBS="$LIBS"
|
||||||
LIBS="-lICE $LIBS"
|
LIBS="-lICE $LIBS"
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 1126 "configure"
|
#line 1164 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
|
|
||||||
int main() { return 0; }
|
int main() { return 0; }
|
||||||
|
@ -1167,7 +1203,7 @@ else
|
||||||
ac_save_LIBS="$LIBS"
|
ac_save_LIBS="$LIBS"
|
||||||
LIBS="-ldnet $LIBS"
|
LIBS="-ldnet $LIBS"
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 1169 "configure"
|
#line 1207 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
|
|
||||||
int main() { return 0; }
|
int main() { return 0; }
|
||||||
|
@ -1201,7 +1237,7 @@ else
|
||||||
ac_save_LIBS="$LIBS"
|
ac_save_LIBS="$LIBS"
|
||||||
LIBS="-ldnet_stub $LIBS"
|
LIBS="-ldnet_stub $LIBS"
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 1203 "configure"
|
#line 1241 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
|
|
||||||
int main() { return 0; }
|
int main() { return 0; }
|
||||||
|
@ -1240,7 +1276,7 @@ else
|
||||||
ac_save_LIBS="$LIBS"
|
ac_save_LIBS="$LIBS"
|
||||||
LIBS="-lnsl $LIBS"
|
LIBS="-lnsl $LIBS"
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 1242 "configure"
|
#line 1280 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
|
|
||||||
int main() { return 0; }
|
int main() { return 0; }
|
||||||
|
@ -1278,7 +1314,7 @@ else
|
||||||
ac_save_LIBS="$LIBS"
|
ac_save_LIBS="$LIBS"
|
||||||
LIBS="-lsocket $LIBS"
|
LIBS="-lsocket $LIBS"
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 1280 "configure"
|
#line 1318 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
|
|
||||||
int main() { return 0; }
|
int main() { return 0; }
|
||||||
|
@ -1335,7 +1371,7 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 1337 "configure"
|
#line 1375 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
#include <tk.h>
|
#include <tk.h>
|
||||||
EOF
|
EOF
|
||||||
|
@ -1437,7 +1473,7 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 1439 "configure"
|
#line 1477 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
#include <tclInt.h>
|
#include <tclInt.h>
|
||||||
EOF
|
EOF
|
||||||
|
|
|
@ -15,6 +15,7 @@ AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..)
|
||||||
AC_CANONICAL_SYSTEM
|
AC_CANONICAL_SYSTEM
|
||||||
AC_ARG_PROGRAM
|
AC_ARG_PROGRAM
|
||||||
|
|
||||||
|
AC_CHECK_HEADERS(unistd.h)
|
||||||
|
|
||||||
dnl Handle optional features that can be enabled.
|
dnl Handle optional features that can be enabled.
|
||||||
ENABLE_CFLAGS=
|
ENABLE_CFLAGS=
|
||||||
|
|
|
@ -28,6 +28,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#include "gdbcmd.h"
|
#include "gdbcmd.h"
|
||||||
#include "demangle.h"
|
#include "demangle.h"
|
||||||
#include "annotate.h"
|
#include "annotate.h"
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
int vtblprint; /* Controls printing of vtbl's */
|
int vtblprint; /* Controls printing of vtbl's */
|
||||||
int objectprint; /* Controls looking up an object's derived type
|
int objectprint; /* Controls looking up an object's derived type
|
||||||
|
|
|
@ -29,6 +29,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include "frame.h"
|
#include "frame.h"
|
||||||
#include "inferior.h"
|
#include "inferior.h"
|
||||||
|
@ -25,22 +26,15 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#include "floatformat.h"
|
#include "floatformat.h"
|
||||||
#include "symtab.h"
|
#include "symtab.h"
|
||||||
|
|
||||||
static long
|
static long i386_get_frame_setup PARAMS ((int));
|
||||||
i386_get_frame_setup PARAMS ((int));
|
|
||||||
|
|
||||||
static void
|
static void i386_follow_jump PARAMS ((void));
|
||||||
i386_follow_jump PARAMS ((void));
|
|
||||||
|
|
||||||
static void
|
static void codestream_read PARAMS ((unsigned char *, int));
|
||||||
codestream_read PARAMS ((unsigned char *, int));
|
|
||||||
|
|
||||||
static void
|
static void codestream_seek PARAMS ((int));
|
||||||
codestream_seek PARAMS ((int));
|
|
||||||
|
|
||||||
static unsigned char
|
static unsigned char codestream_fill PARAMS ((int));
|
||||||
codestream_fill PARAMS ((int));
|
|
||||||
|
|
||||||
/* helper functions for tm-i386.h */
|
|
||||||
|
|
||||||
/* Stdio style buffering was used to minimize calls to ptrace, but this
|
/* Stdio style buffering was used to minimize calls to ptrace, but this
|
||||||
buffering did not take into account that the code section being accessed
|
buffering did not take into account that the code section being accessed
|
||||||
|
@ -432,7 +426,12 @@ i386_frame_find_saved_regs (fip, fsrp)
|
||||||
op = codestream_get ();
|
op = codestream_get ();
|
||||||
if (op < 0x50 || op > 0x57)
|
if (op < 0x50 || op > 0x57)
|
||||||
break;
|
break;
|
||||||
|
#ifdef I386_REGNO_TO_SYMMETRY
|
||||||
|
/* Dynix uses different internal numbering. Ick. */
|
||||||
|
fsrp->regs[I386_REGNO_TO_SYMMETRY(op - 0x50)] = adr;
|
||||||
|
#else
|
||||||
fsrp->regs[op - 0x50] = adr;
|
fsrp->regs[op - 0x50] = adr;
|
||||||
|
#endif
|
||||||
adr -= 4;
|
adr -= 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -545,16 +544,14 @@ i386_push_dummy_frame ()
|
||||||
void
|
void
|
||||||
i386_pop_frame ()
|
i386_pop_frame ()
|
||||||
{
|
{
|
||||||
FRAME frame = get_current_frame ();
|
struct frame_info *frame = get_current_frame ();
|
||||||
CORE_ADDR fp;
|
CORE_ADDR fp;
|
||||||
int regnum;
|
int regnum;
|
||||||
struct frame_saved_regs fsr;
|
struct frame_saved_regs fsr;
|
||||||
struct frame_info *fi;
|
|
||||||
char regbuf[MAX_REGISTER_RAW_SIZE];
|
char regbuf[MAX_REGISTER_RAW_SIZE];
|
||||||
|
|
||||||
fi = get_frame_info (frame);
|
fp = FRAME_FP (frame);
|
||||||
fp = fi->frame;
|
get_frame_saved_regs (frame, &fsr);
|
||||||
get_frame_saved_regs (fi, &fsr);
|
|
||||||
for (regnum = 0; regnum < NUM_REGS; regnum++)
|
for (regnum = 0; regnum < NUM_REGS; regnum++)
|
||||||
{
|
{
|
||||||
CORE_ADDR adr;
|
CORE_ADDR adr;
|
||||||
|
@ -570,8 +567,6 @@ i386_pop_frame ()
|
||||||
write_register (PC_REGNUM, read_memory_integer (fp + 4, 4));
|
write_register (PC_REGNUM, read_memory_integer (fp + 4, 4));
|
||||||
write_register (SP_REGNUM, fp + 8);
|
write_register (SP_REGNUM, fp + 8);
|
||||||
flush_cached_frames ();
|
flush_cached_frames ();
|
||||||
set_current_frame ( create_new_frame (read_register (FP_REGNUM),
|
|
||||||
read_pc ()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef GET_LONGJMP_TARGET
|
#ifdef GET_LONGJMP_TARGET
|
||||||
|
@ -639,13 +634,12 @@ i386_extract_return_value(type, regbuf, valbuf)
|
||||||
|
|
||||||
CORE_ADDR
|
CORE_ADDR
|
||||||
i386v4_sigtramp_saved_pc (frame)
|
i386v4_sigtramp_saved_pc (frame)
|
||||||
FRAME frame;
|
struct frame_info *frame;
|
||||||
{
|
{
|
||||||
CORE_ADDR saved_pc_offset = 4;
|
CORE_ADDR saved_pc_offset = 4;
|
||||||
char *name = NULL;
|
char *name = NULL;
|
||||||
|
|
||||||
find_pc_partial_function (frame->pc, &name,
|
find_pc_partial_function (frame->pc, &name, NULL, NULL);
|
||||||
(CORE_ADDR *)NULL,(CORE_ADDR *)NULL);
|
|
||||||
if (name)
|
if (name)
|
||||||
{
|
{
|
||||||
if (STREQ (name, "_sigreturn"))
|
if (STREQ (name, "_sigreturn"))
|
||||||
|
@ -661,3 +655,9 @@ i386v4_sigtramp_saved_pc (frame)
|
||||||
return read_memory_integer (read_register (SP_REGNUM) + saved_pc_offset, 4);
|
return read_memory_integer (read_register (SP_REGNUM) + saved_pc_offset, 4);
|
||||||
}
|
}
|
||||||
#endif /* I386V4_SIGTRAMP_SAVED_PC */
|
#endif /* I386V4_SIGTRAMP_SAVED_PC */
|
||||||
|
|
||||||
|
void
|
||||||
|
_initialize_i386_tdep ()
|
||||||
|
{
|
||||||
|
tm_print_insn = print_insn_i386;
|
||||||
|
}
|
||||||
|
|
|
@ -72,6 +72,7 @@ i386_register_u_addr (blockend, regnum)
|
||||||
|
|
||||||
|
|
||||||
#ifdef FLOAT_INFO
|
#ifdef FLOAT_INFO
|
||||||
|
#include "language.h" /* for local_hex_string */
|
||||||
#include "floatformat.h"
|
#include "floatformat.h"
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
@ -115,7 +116,7 @@ struct env387
|
||||||
unsigned char regs[8][10];
|
unsigned char regs[8][10];
|
||||||
};
|
};
|
||||||
|
|
||||||
static
|
static void
|
||||||
print_387_status (status, ep)
|
print_387_status (status, ep)
|
||||||
unsigned short status;
|
unsigned short status;
|
||||||
struct env387 *ep;
|
struct env387 *ep;
|
||||||
|
@ -124,7 +125,6 @@ print_387_status (status, ep)
|
||||||
int bothstatus;
|
int bothstatus;
|
||||||
int top;
|
int top;
|
||||||
int fpreg;
|
int fpreg;
|
||||||
unsigned char *p;
|
|
||||||
|
|
||||||
bothstatus = ((status != 0) && (ep->status != 0));
|
bothstatus = ((status != 0) && (ep->status != 0));
|
||||||
if (status != 0)
|
if (status != 0)
|
||||||
|
|
21
gdb/inflow.c
21
gdb/inflow.c
|
@ -1,5 +1,5 @@
|
||||||
/* Low level interface to ptrace, for GDB when running under Unix.
|
/* Low level interface to ptrace, for GDB when running under Unix.
|
||||||
Copyright 1986, 1987, 1989, 1991, 1992 Free Software Foundation, Inc.
|
Copyright 1986, 1987, 1989, 1991, 1992, 1995 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GDB.
|
This file is part of GDB.
|
||||||
|
|
||||||
|
@ -27,10 +27,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#include "target.h"
|
#include "target.h"
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#if !defined (HAVE_TERMIOS) && !defined (HAVE_TERMIO) && !defined (HAVE_SGTTY) && !defined (__GO32__)
|
#if !defined (HAVE_TERMIOS) && !defined (HAVE_TERMIO) && !defined (HAVE_SGTTY) && !defined (__GO32__) && !defined(WIN32)
|
||||||
#define HAVE_SGTTY
|
#define HAVE_SGTTY
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -483,7 +484,7 @@ new_tty ()
|
||||||
|
|
||||||
if (inferior_thisrun_terminal == 0)
|
if (inferior_thisrun_terminal == 0)
|
||||||
return;
|
return;
|
||||||
#if !defined(__GO32__)
|
#if !defined(__GO32__) && !defined(WIN32)
|
||||||
#ifdef TIOCNOTTY
|
#ifdef TIOCNOTTY
|
||||||
/* Disconnect the child process from our controlling terminal. On some
|
/* Disconnect the child process from our controlling terminal. On some
|
||||||
systems (SVR4 for example), this may cause a SIGTTOU, so temporarily
|
systems (SVR4 for example), this may cause a SIGTTOU, so temporarily
|
||||||
|
@ -522,7 +523,7 @@ new_tty ()
|
||||||
{ close (2); dup (tty); }
|
{ close (2); dup (tty); }
|
||||||
if (tty > 2)
|
if (tty > 2)
|
||||||
close(tty);
|
close(tty);
|
||||||
#endif /* !go32 */
|
#endif /* !go32 && !win32*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Kill the inferior process. Make us have no inferior. */
|
/* Kill the inferior process. Make us have no inferior. */
|
||||||
|
@ -533,7 +534,11 @@ kill_command (arg, from_tty)
|
||||||
char *arg;
|
char *arg;
|
||||||
int from_tty;
|
int from_tty;
|
||||||
{
|
{
|
||||||
if (!target_has_execution)
|
/* FIXME: This should not really be inferior_pid (or target_has_execution).
|
||||||
|
It should be a distinct flag that indicates that a target is active, cuz
|
||||||
|
some targets don't have processes! */
|
||||||
|
|
||||||
|
if (inferior_pid == 0)
|
||||||
error ("The program is not being run.");
|
error ("The program is not being run.");
|
||||||
if (!query ("Kill the program being debugged? "))
|
if (!query ("Kill the program being debugged? "))
|
||||||
error ("Not confirmed.");
|
error ("Not confirmed.");
|
||||||
|
@ -568,13 +573,19 @@ static void (*osig)();
|
||||||
void
|
void
|
||||||
set_sigint_trap()
|
set_sigint_trap()
|
||||||
{
|
{
|
||||||
|
if (attach_flag || inferior_thisrun_terminal)
|
||||||
|
{
|
||||||
osig = (void (*) ()) signal (SIGINT, pass_signal);
|
osig = (void (*) ()) signal (SIGINT, pass_signal);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
clear_sigint_trap()
|
clear_sigint_trap()
|
||||||
{
|
{
|
||||||
|
if (attach_flag || inferior_thisrun_terminal)
|
||||||
|
{
|
||||||
signal (SIGINT, osig);
|
signal (SIGINT, osig);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined (SIGIO) && defined (FASYNC) && defined (FD_SET) && defined (F_SETOWN)
|
#if defined (SIGIO) && defined (FASYNC) && defined (FD_SET) && defined (F_SETOWN)
|
||||||
|
|
49
gdb/main.c
49
gdb/main.c
|
@ -1,5 +1,5 @@
|
||||||
/* Top level stuff for GDB, the GNU debugger.
|
/* Top level stuff for GDB, the GNU debugger.
|
||||||
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994
|
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GDB.
|
This file is part of GDB.
|
||||||
|
@ -32,8 +32,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
/* R_OK lives in either unistd.h or sys/file.h. */
|
#ifdef HAVE_UNISTD_H
|
||||||
#ifdef USG
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
#ifndef NO_SYS_FILE
|
#ifndef NO_SYS_FILE
|
||||||
|
@ -104,15 +103,13 @@ main (argc, argv)
|
||||||
|
|
||||||
long time_at_startup = get_run_time ();
|
long time_at_startup = get_run_time ();
|
||||||
|
|
||||||
/* start-sanitize-mpw */
|
START_PROGRESS (argv[0], 0);
|
||||||
|
|
||||||
#ifdef MPW
|
#ifdef MPW
|
||||||
/* Drop into MacsBug, but only if the executable is specially named. */
|
|
||||||
if (strcmp(argv[0], "DEBUGGDB") == 0)
|
|
||||||
DebugStr("\pat start of GDB main");
|
|
||||||
/* Do all Mac-specific setup. */
|
/* Do all Mac-specific setup. */
|
||||||
mac_init ();
|
mac_init ();
|
||||||
#endif /* MPW */
|
#endif /* MPW */
|
||||||
/* end-sanitize-mpw */
|
|
||||||
/* This needs to happen before the first use of malloc. */
|
/* This needs to happen before the first use of malloc. */
|
||||||
init_malloc ((PTR) NULL);
|
init_malloc ((PTR) NULL);
|
||||||
|
|
||||||
|
@ -143,6 +140,7 @@ main (argc, argv)
|
||||||
current_directory = gdb_dirbuf;
|
current_directory = gdb_dirbuf;
|
||||||
|
|
||||||
/* Parse arguments and options. */
|
/* Parse arguments and options. */
|
||||||
|
#ifndef WIN32
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
/* When var field is 0, use flag field to record the equivalent
|
/* When var field is 0, use flag field to record the equivalent
|
||||||
|
@ -233,6 +231,8 @@ main (argc, argv)
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
annotation_level = 1;
|
annotation_level = 1;
|
||||||
|
/* We have probably been invoked from emacs. Disable window interface. */
|
||||||
|
use_windows = 0;
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
symarg = optarg;
|
symarg = optarg;
|
||||||
|
@ -319,6 +319,7 @@ main (argc, argv)
|
||||||
quiet = 1;
|
quiet = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
gdb_init ();
|
gdb_init ();
|
||||||
|
|
||||||
/* Do these (and anything which might call wrap_here or *_filtered)
|
/* Do these (and anything which might call wrap_here or *_filtered)
|
||||||
|
@ -344,12 +345,6 @@ main (argc, argv)
|
||||||
|
|
||||||
/* But don't use *_filtered here. We don't want to prompt for continue
|
/* But don't use *_filtered here. We don't want to prompt for continue
|
||||||
no matter how small the screen or how much we're going to print. */
|
no matter how small the screen or how much we're going to print. */
|
||||||
/* start-sanitize-mpw */
|
|
||||||
/* For reasons too ugly to describe... */
|
|
||||||
#ifdef MPW_C
|
|
||||||
fputs_unfiltered ("This is the GNU debugger.\n", gdb_stdout);
|
|
||||||
#else
|
|
||||||
/* end-sanitize-mpw */
|
|
||||||
fputs_unfiltered ("\
|
fputs_unfiltered ("\
|
||||||
This is the GNU debugger. Usage:\n\
|
This is the GNU debugger. Usage:\n\
|
||||||
gdb [options] [executable-file [core-file or process-id]]\n\
|
gdb [options] [executable-file [core-file or process-id]]\n\
|
||||||
|
@ -358,24 +353,27 @@ Options:\n\
|
||||||
--quiet Do not print version number on startup.\n\
|
--quiet Do not print version number on startup.\n\
|
||||||
--fullname Output information used by emacs-GDB interface.\n\
|
--fullname Output information used by emacs-GDB interface.\n\
|
||||||
--epoch Output information used by epoch emacs-GDB interface.\n\
|
--epoch Output information used by epoch emacs-GDB interface.\n\
|
||||||
|
", gdb_stdout);
|
||||||
|
fputs_unfiltered ("\
|
||||||
--batch Exit after processing options.\n\
|
--batch Exit after processing options.\n\
|
||||||
--nx Do not read .gdbinit file.\n\
|
--nx Do not read .gdbinit file.\n\
|
||||||
--tty=TTY Use TTY for input/output by the program being debugged.\n\
|
--tty=TTY Use TTY for input/output by the program being debugged.\n\
|
||||||
--cd=DIR Change current directory to DIR.\n\
|
--cd=DIR Change current directory to DIR.\n\
|
||||||
--directory=DIR Search for source files in DIR.\n\
|
--directory=DIR Search for source files in DIR.\n\
|
||||||
|
", gdb_stdout);
|
||||||
|
fputs_unfiltered ("\
|
||||||
--command=FILE Execute GDB commands from FILE.\n\
|
--command=FILE Execute GDB commands from FILE.\n\
|
||||||
--symbols=SYMFILE Read symbols from SYMFILE.\n\
|
--symbols=SYMFILE Read symbols from SYMFILE.\n\
|
||||||
--exec=EXECFILE Use EXECFILE as the executable.\n\
|
--exec=EXECFILE Use EXECFILE as the executable.\n\
|
||||||
--se=FILE Use FILE as symbol file and executable file.\n\
|
--se=FILE Use FILE as symbol file and executable file.\n\
|
||||||
|
", gdb_stdout);
|
||||||
|
fputs_unfiltered ("\
|
||||||
--core=COREFILE Analyze the core dump COREFILE.\n\
|
--core=COREFILE Analyze the core dump COREFILE.\n\
|
||||||
-b BAUDRATE Set serial port baud rate used for remote debugging.\n\
|
-b BAUDRATE Set serial port baud rate used for remote debugging.\n\
|
||||||
--mapped Use mapped symbol files if supported on this system.\n\
|
--mapped Use mapped symbol files if supported on this system.\n\
|
||||||
--readnow Fully read symbol files on first access.\n\
|
--readnow Fully read symbol files on first access.\n\
|
||||||
--nw Do not use a window interface.\n\
|
--nw Do not use a window interface.\n\
|
||||||
", gdb_stdout);
|
", gdb_stdout);
|
||||||
/* start-sanitize-mpw */
|
|
||||||
#endif /* MPW_C */
|
|
||||||
/* end-sanitize-mpw */
|
|
||||||
#ifdef ADDITIONAL_OPTION_HELP
|
#ifdef ADDITIONAL_OPTION_HELP
|
||||||
fputs_unfiltered (ADDITIONAL_OPTION_HELP, gdb_stdout);
|
fputs_unfiltered (ADDITIONAL_OPTION_HELP, gdb_stdout);
|
||||||
#endif
|
#endif
|
||||||
|
@ -398,6 +396,8 @@ GDB manual (available as on-line info or a printed manual).\n", gdb_stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
error_pre_print = "\n\n";
|
error_pre_print = "\n\n";
|
||||||
|
quit_pre_print = error_pre_print;
|
||||||
|
|
||||||
/* We may get more than one warning, don't double space all of them... */
|
/* We may get more than one warning, don't double space all of them... */
|
||||||
warning_pre_print = "\nwarning: ";
|
warning_pre_print = "\nwarning: ";
|
||||||
|
|
||||||
|
@ -478,6 +478,7 @@ GDB manual (available as on-line info or a printed manual).\n", gdb_stdout);
|
||||||
if (!quiet)
|
if (!quiet)
|
||||||
printf_filtered ("\n");
|
printf_filtered ("\n");
|
||||||
error_pre_print = "\n";
|
error_pre_print = "\n";
|
||||||
|
quit_pre_print = error_pre_print;
|
||||||
warning_pre_print = "\nwarning: ";
|
warning_pre_print = "\nwarning: ";
|
||||||
|
|
||||||
if (corearg != NULL)
|
if (corearg != NULL)
|
||||||
|
@ -497,7 +498,8 @@ GDB manual (available as on-line info or a printed manual).\n", gdb_stdout);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Error messages should no longer be distinguished with extra output. */
|
/* Error messages should no longer be distinguished with extra output. */
|
||||||
error_pre_print = 0;
|
error_pre_print = NULL;
|
||||||
|
quit_pre_print = NULL;
|
||||||
warning_pre_print = "warning: ";
|
warning_pre_print = "warning: ";
|
||||||
|
|
||||||
/* Read the .gdbinit file in the current directory, *if* it isn't
|
/* Read the .gdbinit file in the current directory, *if* it isn't
|
||||||
|
@ -541,6 +543,8 @@ GDB manual (available as on-line info or a printed manual).\n", gdb_stdout);
|
||||||
BEFORE_MAIN_LOOP_HOOK;
|
BEFORE_MAIN_LOOP_HOOK;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
END_PROGRESS (argv[0]);
|
||||||
|
|
||||||
/* Show time and/or space usage. */
|
/* Show time and/or space usage. */
|
||||||
|
|
||||||
if (display_time)
|
if (display_time)
|
||||||
|
@ -560,8 +564,10 @@ GDB manual (available as on-line info or a printed manual).\n", gdb_stdout);
|
||||||
(long) (lim - (char *) &environ));
|
(long) (lim - (char *) &environ));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The command loop. */
|
/* The default command loop.
|
||||||
|
The WIN32 Gui calls this main to set up gdb's state, and
|
||||||
|
has its own command loop. */
|
||||||
|
#if !defined (WIN32)
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
if (!SET_TOP_LEVEL ())
|
if (!SET_TOP_LEVEL ())
|
||||||
|
@ -577,7 +583,10 @@ GDB manual (available as on-line info or a printed manual).\n", gdb_stdout);
|
||||||
quit_command ((char *)0, instream == stdin);
|
quit_command ((char *)0, instream == stdin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No exit -- exit is through quit_command. */
|
/* No exit -- exit is through quit_command. */
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -33,6 +33,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#include "expression.h" /* For language.h */
|
#include "expression.h" /* For language.h */
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static void maintenance_command PARAMS ((char *, int));
|
static void maintenance_command PARAMS ((char *, int));
|
||||||
|
|
||||||
static void maintenance_dump_me PARAMS ((char *, int));
|
static void maintenance_dump_me PARAMS ((char *, int));
|
||||||
|
|
|
@ -33,6 +33,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <obstack.h>
|
#include <obstack.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
/* Prototypes for local functions */
|
/* Prototypes for local functions */
|
||||||
|
|
||||||
|
|
204
gdb/solib.c
204
gdb/solib.c
|
@ -1,5 +1,6 @@
|
||||||
/* Handle SunOS and SVR4 shared libraries for GDB, the GNU Debugger.
|
/* Handle SunOS and SVR4 shared libraries for GDB, the GNU Debugger.
|
||||||
Copyright 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
|
Copyright 1990, 1991, 1992, 1993, 1994, 1995
|
||||||
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GDB.
|
This file is part of GDB.
|
||||||
|
|
||||||
|
@ -23,20 +24,19 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <link.h>
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#ifndef SVR4_SHARED_LIBS
|
#ifndef SVR4_SHARED_LIBS
|
||||||
/* SunOS shared libs need the nlist structure. */
|
/* SunOS shared libs need the nlist structure. */
|
||||||
#include <a.out.h>
|
#include <a.out.h>
|
||||||
#else
|
#else
|
||||||
#include "libelf.h"
|
#include "elf/external.h"
|
||||||
#ifndef DT_MIPS_RLD_MAP
|
|
||||||
#include "elf/mips.h"
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <link.h>
|
||||||
|
|
||||||
#include "symtab.h"
|
#include "symtab.h"
|
||||||
#include "bfd.h"
|
#include "bfd.h"
|
||||||
#include "symfile.h"
|
#include "symfile.h"
|
||||||
|
@ -48,6 +48,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#include "regex.h"
|
#include "regex.h"
|
||||||
#include "inferior.h"
|
#include "inferior.h"
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
|
#include "gdbcmd.h"
|
||||||
|
|
||||||
#define MAX_PATH_SIZE 256 /* FIXME: Should be dynamic */
|
#define MAX_PATH_SIZE 256 /* FIXME: Should be dynamic */
|
||||||
|
|
||||||
|
@ -79,12 +80,29 @@ static char *bkpt_names[] = {
|
||||||
#ifndef SVR4_SHARED_LIBS
|
#ifndef SVR4_SHARED_LIBS
|
||||||
static char *debug_base_symbols[] = {
|
static char *debug_base_symbols[] = {
|
||||||
"_DYNAMIC",
|
"_DYNAMIC",
|
||||||
|
"_DYNAMIC__MGC",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static char *main_name_list[] = {
|
||||||
|
"main_$main",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
/* local data declarations */
|
/* local data declarations */
|
||||||
|
|
||||||
|
/* If true, then shared library symbols will be added automatically
|
||||||
|
when the inferior is created. This is almost always what users
|
||||||
|
will want to have happen; but for very large programs, the startup
|
||||||
|
time will be excessive, and so if this is a problem, the user can
|
||||||
|
clear this flag and then add the shared library symbols as needed.
|
||||||
|
Note that there is a potential for confusion, since if the shared
|
||||||
|
library symbols are not loaded, commands like "info fun" will *not*
|
||||||
|
report all the functions that are actually present. */
|
||||||
|
|
||||||
|
int auto_solib_add_at_startup = 1;
|
||||||
|
|
||||||
#ifndef SVR4_SHARED_LIBS
|
#ifndef SVR4_SHARED_LIBS
|
||||||
|
|
||||||
#define LM_ADDR(so) ((so) -> lm.lm_addr)
|
#define LM_ADDR(so) ((so) -> lm.lm_addr)
|
||||||
|
@ -172,7 +190,10 @@ elf_locate_base PARAMS ((void));
|
||||||
#else
|
#else
|
||||||
|
|
||||||
static void
|
static void
|
||||||
solib_add_common_symbols PARAMS ((struct rtc_symb *, struct objfile *));
|
allocate_rt_common_objfile PARAMS ((void));
|
||||||
|
|
||||||
|
static void
|
||||||
|
solib_add_common_symbols PARAMS ((struct rtc_symb *));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -270,26 +291,50 @@ solib_map_sections (so)
|
||||||
do_cleanups (old_chain);
|
do_cleanups (old_chain);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read all dynamically loaded common symbol definitions from the inferior
|
|
||||||
and add them to the minimal symbol table for the shared library objfile. */
|
|
||||||
|
|
||||||
#ifndef SVR4_SHARED_LIBS
|
#ifndef SVR4_SHARED_LIBS
|
||||||
|
|
||||||
/* In GDB 4.9 this routine was a real performance hog. According to
|
/* Allocate the runtime common object file. */
|
||||||
some gprof data which mtranle@paris.IntelliCorp.COM (Minh Tran-Le)
|
|
||||||
sent, almost all the time spend in solib_add (up to 20 minutes with
|
|
||||||
35 shared libraries) was spent here, with 5/6 in
|
|
||||||
lookup_minimal_symbol and 1/6 in read_memory.
|
|
||||||
|
|
||||||
To fix this, we moved the call to special_symbol_handling out of the
|
|
||||||
loop in solib_add, so this only gets called once, rather than once
|
|
||||||
for every shared library, and also removed the call to lookup_minimal_symbol
|
|
||||||
in this routine. */
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
solib_add_common_symbols (rtc_symp, objfile)
|
allocate_rt_common_objfile ()
|
||||||
struct rtc_symb *rtc_symp;
|
{
|
||||||
struct objfile *objfile;
|
struct objfile *objfile;
|
||||||
|
struct objfile *last_one;
|
||||||
|
|
||||||
|
objfile = (struct objfile *) xmalloc (sizeof (struct objfile));
|
||||||
|
memset (objfile, 0, sizeof (struct objfile));
|
||||||
|
objfile -> md = NULL;
|
||||||
|
obstack_specify_allocation (&objfile -> psymbol_obstack, 0, 0, xmalloc,
|
||||||
|
free);
|
||||||
|
obstack_specify_allocation (&objfile -> symbol_obstack, 0, 0, xmalloc,
|
||||||
|
free);
|
||||||
|
obstack_specify_allocation (&objfile -> type_obstack, 0, 0, xmalloc,
|
||||||
|
free);
|
||||||
|
objfile -> name = mstrsave (objfile -> md, "rt_common");
|
||||||
|
|
||||||
|
/* Add this file onto the tail of the linked list of other such files. */
|
||||||
|
|
||||||
|
objfile -> next = NULL;
|
||||||
|
if (object_files == NULL)
|
||||||
|
object_files = objfile;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (last_one = object_files;
|
||||||
|
last_one -> next;
|
||||||
|
last_one = last_one -> next);
|
||||||
|
last_one -> next = objfile;
|
||||||
|
}
|
||||||
|
|
||||||
|
rt_common_objfile = objfile;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Read all dynamically loaded common symbol definitions from the inferior
|
||||||
|
and put them into the minimal symbol table for the runtime common
|
||||||
|
objfile. */
|
||||||
|
|
||||||
|
static void
|
||||||
|
solib_add_common_symbols (rtc_symp)
|
||||||
|
struct rtc_symb *rtc_symp;
|
||||||
{
|
{
|
||||||
struct rtc_symb inferior_rtc_symb;
|
struct rtc_symb inferior_rtc_symb;
|
||||||
struct nlist inferior_rtc_nlist;
|
struct nlist inferior_rtc_nlist;
|
||||||
|
@ -297,6 +342,17 @@ solib_add_common_symbols (rtc_symp, objfile)
|
||||||
char *name;
|
char *name;
|
||||||
char *origname;
|
char *origname;
|
||||||
|
|
||||||
|
/* Remove any runtime common symbols from previous runs. */
|
||||||
|
|
||||||
|
if (rt_common_objfile != NULL && rt_common_objfile -> minimal_symbol_count)
|
||||||
|
{
|
||||||
|
obstack_free (&rt_common_objfile -> symbol_obstack, 0);
|
||||||
|
obstack_specify_allocation (&rt_common_objfile -> symbol_obstack, 0, 0,
|
||||||
|
xmalloc, free);
|
||||||
|
rt_common_objfile -> minimal_symbol_count = 0;
|
||||||
|
rt_common_objfile -> msymbols = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
init_minimal_symbol_collection ();
|
init_minimal_symbol_collection ();
|
||||||
make_cleanup (discard_minimal_symbols, 0);
|
make_cleanup (discard_minimal_symbols, 0);
|
||||||
|
|
||||||
|
@ -318,38 +374,23 @@ solib_add_common_symbols (rtc_symp, objfile)
|
||||||
origname = name = xmalloc (len);
|
origname = name = xmalloc (len);
|
||||||
read_memory ((CORE_ADDR) inferior_rtc_nlist.n_un.n_name, name, len);
|
read_memory ((CORE_ADDR) inferior_rtc_nlist.n_un.n_name, name, len);
|
||||||
|
|
||||||
/* Don't enter the symbol twice if the target is re-run. */
|
/* Allocate the runtime common objfile if necessary. */
|
||||||
|
if (rt_common_objfile == NULL)
|
||||||
|
allocate_rt_common_objfile ();
|
||||||
|
|
||||||
if (name[0] == bfd_get_symbol_leading_char (objfile->obfd))
|
|
||||||
{
|
|
||||||
name++;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* I think this is unnecessary, GDB can probably deal with
|
|
||||||
duplicate minimal symbols, more or less. And the duplication
|
|
||||||
which used to happen because this was called for each shared
|
|
||||||
library is gone now that we are just called once. */
|
|
||||||
/* FIXME: Do we really want to exclude symbols which happen
|
|
||||||
to match symbols for other locations in the inferior's
|
|
||||||
address space, even when they are in different linkage units? */
|
|
||||||
if (lookup_minimal_symbol (name, (struct objfile *) NULL) == NULL)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
name = obsavestring (name, strlen (name),
|
name = obsavestring (name, strlen (name),
|
||||||
&objfile -> symbol_obstack);
|
&rt_common_objfile -> symbol_obstack);
|
||||||
prim_record_minimal_symbol (name, inferior_rtc_nlist.n_value,
|
prim_record_minimal_symbol (name, inferior_rtc_nlist.n_value,
|
||||||
mst_bss, objfile);
|
mst_bss, rt_common_objfile);
|
||||||
}
|
|
||||||
free (origname);
|
free (origname);
|
||||||
}
|
}
|
||||||
rtc_symp = inferior_rtc_symb.rtc_next;
|
rtc_symp = inferior_rtc_symb.rtc_next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Install any minimal symbols that have been collected as the current
|
/* Install any minimal symbols that have been collected as the current
|
||||||
minimal symbols for this objfile. */
|
minimal symbols for the runtime common objfile. */
|
||||||
|
|
||||||
install_minimal_symbols (objfile);
|
install_minimal_symbols (rt_common_objfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* SVR4_SHARED_LIBS */
|
#endif /* SVR4_SHARED_LIBS */
|
||||||
|
@ -501,6 +542,8 @@ look_for_base (fd, baseaddr)
|
||||||
}
|
}
|
||||||
if (!bfd_check_format (interp_bfd, bfd_object))
|
if (!bfd_check_format (interp_bfd, bfd_object))
|
||||||
{
|
{
|
||||||
|
/* FIXME-leak: on failure, might not free all memory associated with
|
||||||
|
interp_bfd. */
|
||||||
bfd_close (interp_bfd);
|
bfd_close (interp_bfd);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
@ -518,6 +561,8 @@ look_for_base (fd, baseaddr)
|
||||||
}
|
}
|
||||||
if (address == 0)
|
if (address == 0)
|
||||||
{
|
{
|
||||||
|
/* FIXME-leak: on failure, might not free all memory associated with
|
||||||
|
interp_bfd. */
|
||||||
bfd_close (interp_bfd);
|
bfd_close (interp_bfd);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
@ -535,6 +580,8 @@ look_for_base (fd, baseaddr)
|
||||||
address += baseaddr;
|
address += baseaddr;
|
||||||
}
|
}
|
||||||
debug_base = address;
|
debug_base = address;
|
||||||
|
/* FIXME-leak: on failure, might not free all memory associated with
|
||||||
|
interp_bfd. */
|
||||||
bfd_close (interp_bfd);
|
bfd_close (interp_bfd);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
@ -567,20 +614,20 @@ DESCRIPTION
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
elf_locate_base ()
|
elf_locate_base ()
|
||||||
{
|
{
|
||||||
struct elf_internal_shdr *dyninfo_sect;
|
sec_ptr dyninfo_sect;
|
||||||
int dyninfo_sect_size;
|
int dyninfo_sect_size;
|
||||||
CORE_ADDR dyninfo_addr;
|
CORE_ADDR dyninfo_addr;
|
||||||
char *buf;
|
char *buf;
|
||||||
char *bufend;
|
char *bufend;
|
||||||
|
|
||||||
/* Find the start address of the .dynamic section. */
|
/* Find the start address of the .dynamic section. */
|
||||||
dyninfo_sect = bfd_elf_find_section (exec_bfd, ".dynamic");
|
dyninfo_sect = bfd_get_section_by_name (exec_bfd, ".dynamic");
|
||||||
if (dyninfo_sect == NULL)
|
if (dyninfo_sect == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
dyninfo_addr = dyninfo_sect->sh_addr;
|
dyninfo_addr = bfd_section_vma (exec_bfd, dyninfo_sect);
|
||||||
|
|
||||||
/* Read in .dynamic section, silently ignore errors. */
|
/* Read in .dynamic section, silently ignore errors. */
|
||||||
dyninfo_sect_size = dyninfo_sect->sh_size;
|
dyninfo_sect_size = bfd_section_size (exec_bfd, dyninfo_sect);
|
||||||
buf = alloca (dyninfo_sect_size);
|
buf = alloca (dyninfo_sect_size);
|
||||||
if (target_read_memory (dyninfo_addr, buf, dyninfo_sect_size))
|
if (target_read_memory (dyninfo_addr, buf, dyninfo_sect_size))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -606,6 +653,7 @@ elf_locate_base ()
|
||||||
dyn_ptr = bfd_h_get_32 (exec_bfd, (bfd_byte *) x_dynp->d_un.d_ptr);
|
dyn_ptr = bfd_h_get_32 (exec_bfd, (bfd_byte *) x_dynp->d_un.d_ptr);
|
||||||
return dyn_ptr;
|
return dyn_ptr;
|
||||||
}
|
}
|
||||||
|
#ifdef DT_MIPS_RLD_MAP
|
||||||
else if (dyn_tag == DT_MIPS_RLD_MAP)
|
else if (dyn_tag == DT_MIPS_RLD_MAP)
|
||||||
{
|
{
|
||||||
char pbuf[TARGET_PTR_BIT / HOST_CHAR_BIT];
|
char pbuf[TARGET_PTR_BIT / HOST_CHAR_BIT];
|
||||||
|
@ -617,6 +665,7 @@ elf_locate_base ()
|
||||||
return 0;
|
return 0;
|
||||||
return extract_unsigned_integer (pbuf, sizeof (pbuf));
|
return extract_unsigned_integer (pbuf, sizeof (pbuf));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* DT_DEBUG entry not found. */
|
/* DT_DEBUG entry not found. */
|
||||||
|
@ -678,7 +727,7 @@ locate_base ()
|
||||||
|
|
||||||
for (symbolp = debug_base_symbols; *symbolp != NULL; symbolp++)
|
for (symbolp = debug_base_symbols; *symbolp != NULL; symbolp++)
|
||||||
{
|
{
|
||||||
msymbol = lookup_minimal_symbol (*symbolp, symfile_objfile);
|
msymbol = lookup_minimal_symbol (*symbolp, NULL, symfile_objfile);
|
||||||
if ((msymbol != NULL) && (SYMBOL_VALUE_ADDRESS (msymbol) != 0))
|
if ((msymbol != NULL) && (SYMBOL_VALUE_ADDRESS (msymbol) != 0))
|
||||||
{
|
{
|
||||||
address = SYMBOL_VALUE_ADDRESS (msymbol);
|
address = SYMBOL_VALUE_ADDRESS (msymbol);
|
||||||
|
@ -887,6 +936,23 @@ symbol_add_stub (arg)
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This function will check the so name to see if matches the main list.
|
||||||
|
In some system the main object is in the list, which we want to exclude */
|
||||||
|
|
||||||
|
static int match_main (soname)
|
||||||
|
char *soname;
|
||||||
|
{
|
||||||
|
char **mainp;
|
||||||
|
|
||||||
|
for (mainp = main_name_list; *mainp != NULL; mainp++)
|
||||||
|
{
|
||||||
|
if (strcmp (soname, *mainp) == 0)
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
GLOBAL FUNCTION
|
GLOBAL FUNCTION
|
||||||
|
@ -931,7 +997,7 @@ solib_add (arg_string, from_tty, target)
|
||||||
count = 0;
|
count = 0;
|
||||||
while ((so = find_solib (so)) != NULL)
|
while ((so = find_solib (so)) != NULL)
|
||||||
{
|
{
|
||||||
if (so -> so_name[0])
|
if (so -> so_name[0] && !match_main (so -> so_name))
|
||||||
{
|
{
|
||||||
count += so -> sections_end - so -> sections;
|
count += so -> sections_end - so -> sections;
|
||||||
}
|
}
|
||||||
|
@ -973,7 +1039,8 @@ solib_add (arg_string, from_tty, target)
|
||||||
/* Now add the symbol files. */
|
/* Now add the symbol files. */
|
||||||
while ((so = find_solib (so)) != NULL)
|
while ((so = find_solib (so)) != NULL)
|
||||||
{
|
{
|
||||||
if (so -> so_name[0] && re_exec (so -> so_name))
|
if (so -> so_name[0] && re_exec (so -> so_name) &&
|
||||||
|
!match_main (so -> so_name))
|
||||||
{
|
{
|
||||||
so -> from_tty = from_tty;
|
so -> from_tty = from_tty;
|
||||||
if (so -> symbols_loaded)
|
if (so -> symbols_loaded)
|
||||||
|
@ -999,16 +1066,6 @@ solib_add (arg_string, from_tty, target)
|
||||||
if (so_last)
|
if (so_last)
|
||||||
reinit_frame_cache ();
|
reinit_frame_cache ();
|
||||||
|
|
||||||
/* Calling this once at the end means that we put all the minimal
|
|
||||||
symbols for commons into the objfile for the last shared library.
|
|
||||||
Since they are in common, this should not be a problem. If we
|
|
||||||
delete the objfile with the minimal symbols, we can put all the
|
|
||||||
symbols into a new objfile (and will on the next call to solib_add).
|
|
||||||
|
|
||||||
An alternate approach would be to create an objfile just for
|
|
||||||
common minsyms, thus not needing any objfile argument to
|
|
||||||
solib_add_common_symbols. */
|
|
||||||
|
|
||||||
if (so_last)
|
if (so_last)
|
||||||
special_symbol_handling (so_last);
|
special_symbol_handling (so_last);
|
||||||
}
|
}
|
||||||
|
@ -1131,7 +1188,9 @@ clear_solib()
|
||||||
if (so_list_head -> abfd)
|
if (so_list_head -> abfd)
|
||||||
{
|
{
|
||||||
bfd_filename = bfd_get_filename (so_list_head -> abfd);
|
bfd_filename = bfd_get_filename (so_list_head -> abfd);
|
||||||
bfd_close (so_list_head -> abfd);
|
if (!bfd_close (so_list_head -> abfd))
|
||||||
|
warning ("cannot close \"%s\": %s",
|
||||||
|
bfd_filename, bfd_errmsg (bfd_get_error ()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
/* This happens for the executable on SVR4. */
|
/* This happens for the executable on SVR4. */
|
||||||
|
@ -1303,7 +1362,7 @@ enable_break ()
|
||||||
breakpoint_addr = 0;
|
breakpoint_addr = 0;
|
||||||
for (bkpt_namep = bkpt_names; *bkpt_namep != NULL; bkpt_namep++)
|
for (bkpt_namep = bkpt_names; *bkpt_namep != NULL; bkpt_namep++)
|
||||||
{
|
{
|
||||||
msymbol = lookup_minimal_symbol (*bkpt_namep, symfile_objfile);
|
msymbol = lookup_minimal_symbol (*bkpt_namep, NULL, symfile_objfile);
|
||||||
if ((msymbol != NULL) && (SYMBOL_VALUE_ADDRESS (msymbol) != 0))
|
if ((msymbol != NULL) && (SYMBOL_VALUE_ADDRESS (msymbol) != 0))
|
||||||
{
|
{
|
||||||
bkpt_addr = SYMBOL_VALUE_ADDRESS (msymbol);
|
bkpt_addr = SYMBOL_VALUE_ADDRESS (msymbol);
|
||||||
|
@ -1444,6 +1503,7 @@ solib_create_inferior_hook()
|
||||||
warning ("shared library handler failed to disable breakpoint");
|
warning ("shared library handler failed to disable breakpoint");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (auto_solib_add_at_startup)
|
||||||
solib_add ((char *) 0, 0, (struct target_ops *) 0);
|
solib_add ((char *) 0, 0, (struct target_ops *) 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1463,9 +1523,9 @@ DESCRIPTION
|
||||||
way, we are called to do any system specific symbol handling that
|
way, we are called to do any system specific symbol handling that
|
||||||
is needed.
|
is needed.
|
||||||
|
|
||||||
For Suns, this consists of grunging around in the dynamic linkers
|
For SunOS4, this consists of grunging around in the dynamic
|
||||||
structures to find symbol definitions for "common" symbols and
|
linkers structures to find symbol definitions for "common" symbols
|
||||||
adding them to the minimal symbol table for the corresponding
|
and adding them to the minimal symbol table for the runtime common
|
||||||
objfile.
|
objfile.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
@ -1508,7 +1568,7 @@ struct so_list *so;
|
||||||
|
|
||||||
if (debug_copy.ldd_cp)
|
if (debug_copy.ldd_cp)
|
||||||
{
|
{
|
||||||
solib_add_common_symbols (debug_copy.ldd_cp, so -> objfile);
|
solib_add_common_symbols (debug_copy.ldd_cp);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* !SVR4_SHARED_LIBS */
|
#endif /* !SVR4_SHARED_LIBS */
|
||||||
|
@ -1546,4 +1606,14 @@ _initialize_solib()
|
||||||
"Load shared object library symbols for files matching REGEXP.");
|
"Load shared object library symbols for files matching REGEXP.");
|
||||||
add_info ("sharedlibrary", info_sharedlibrary_command,
|
add_info ("sharedlibrary", info_sharedlibrary_command,
|
||||||
"Status of loaded shared object libraries.");
|
"Status of loaded shared object libraries.");
|
||||||
|
|
||||||
|
add_show_from_set
|
||||||
|
(add_set_cmd ("auto-solib-add", class_support, var_zinteger,
|
||||||
|
(char *) &auto_solib_add_at_startup,
|
||||||
|
"Set autoloading of shared library symbols at startup.\n\
|
||||||
|
If nonzero, symbols from all shared object libraries will be loaded\n\
|
||||||
|
automatically when the inferior begins execution. Otherwise, symbols\n\
|
||||||
|
must be loaded manually, using `sharedlibrary'.",
|
||||||
|
&setlist),
|
||||||
|
&showlist);
|
||||||
}
|
}
|
||||||
|
|
46
gdb/source.c
46
gdb/source.c
|
@ -31,6 +31,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
#include "gdbcore.h"
|
#include "gdbcore.h"
|
||||||
#include "regex.h"
|
#include "regex.h"
|
||||||
#include "symfile.h"
|
#include "symfile.h"
|
||||||
|
@ -38,10 +41,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#include "annotate.h"
|
#include "annotate.h"
|
||||||
#include "gdbtypes.h"
|
#include "gdbtypes.h"
|
||||||
|
|
||||||
#ifndef DIRNAME_SEPARATOR
|
|
||||||
#define DIRNAME_SEPARATOR ':'
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Prototypes for local functions. */
|
/* Prototypes for local functions. */
|
||||||
|
|
||||||
static int open_source_file PARAMS ((struct symtab *));
|
static int open_source_file PARAMS ((struct symtab *));
|
||||||
|
@ -248,7 +247,7 @@ directory_command (dirname, from_tty)
|
||||||
/* FIXME, this goes to "delete dir"... */
|
/* FIXME, this goes to "delete dir"... */
|
||||||
if (dirname == 0)
|
if (dirname == 0)
|
||||||
{
|
{
|
||||||
if (query ("Reinitialize source path to empty? ", ""))
|
if (query ("Reinitialize source path to empty? "))
|
||||||
{
|
{
|
||||||
free (source_path);
|
free (source_path);
|
||||||
init_source_path ();
|
init_source_path ();
|
||||||
|
@ -307,7 +306,7 @@ mod_path (dirname, which_path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p[-1] == '/')
|
if (SLASH_P (p[-1]))
|
||||||
/* Sigh. "foo/" => "foo" */
|
/* Sigh. "foo/" => "foo" */
|
||||||
--p;
|
--p;
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
|
@ -320,7 +319,7 @@ mod_path (dirname, which_path)
|
||||||
name = current_directory;
|
name = current_directory;
|
||||||
goto append;
|
goto append;
|
||||||
}
|
}
|
||||||
else if (p[-2] == '/')
|
else if (SLASH_P (p[-2]))
|
||||||
{
|
{
|
||||||
if (p - name == 2)
|
if (p - name == 2)
|
||||||
{
|
{
|
||||||
|
@ -342,8 +341,8 @@ mod_path (dirname, which_path)
|
||||||
|
|
||||||
if (name[0] == '~')
|
if (name[0] == '~')
|
||||||
name = tilde_expand (name);
|
name = tilde_expand (name);
|
||||||
else if (name[0] != '/' && name[0] != '$')
|
else if (!SLASH_P (name[0]) && name[0] != '$')
|
||||||
name = concat (current_directory, "/", name, NULL);
|
name = concat (current_directory, SLASH_STRING, name, NULL);
|
||||||
else
|
else
|
||||||
name = savestring (name, p - name);
|
name = savestring (name, p - name);
|
||||||
make_cleanup (free, name);
|
make_cleanup (free, name);
|
||||||
|
@ -365,7 +364,7 @@ mod_path (dirname, which_path)
|
||||||
fprintf_unfiltered (gdb_stderr, "Warning: ");
|
fprintf_unfiltered (gdb_stderr, "Warning: ");
|
||||||
print_sys_errmsg (name, save_errno);
|
print_sys_errmsg (name, save_errno);
|
||||||
}
|
}
|
||||||
else if ((st.st_mode & S_IFMT) != S_IFDIR)
|
else if (!S_ISDIR(st.st_mode))
|
||||||
warning ("%s is not a directory.", name);
|
warning ("%s is not a directory.", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -490,16 +489,20 @@ openp (path, try_cwd_first, string, mode, prot, filename_opened)
|
||||||
if (!path)
|
if (!path)
|
||||||
path = ".";
|
path = ".";
|
||||||
|
|
||||||
if (try_cwd_first || string[0] == '/')
|
if (try_cwd_first || SLASH_P (string[0]))
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
filename = string;
|
filename = string;
|
||||||
fd = open (filename, mode, prot);
|
fd = open (filename, mode, prot);
|
||||||
if (fd >= 0 || string[0] == '/' || strchr (string, '/'))
|
if (fd >= 0)
|
||||||
|
goto done;
|
||||||
|
for (i = 0; string[i]; i++)
|
||||||
|
if (SLASH_P(string[0]))
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ./foo => foo */
|
/* ./foo => foo */
|
||||||
while (string[0] == '.' && string[1] == '/')
|
while (string[0] == '.' && SLASH_P (string[1]))
|
||||||
string += 2;
|
string += 2;
|
||||||
|
|
||||||
alloclen = strlen (path) + strlen (string) + 2;
|
alloclen = strlen (path) + strlen (string) + 2;
|
||||||
|
@ -533,10 +536,10 @@ openp (path, try_cwd_first, string, mode, prot, filename_opened)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove trailing slashes */
|
/* Remove trailing slashes */
|
||||||
while (len > 0 && filename[len-1] == '/')
|
while (len > 0 && SLASH_P (filename[len-1]))
|
||||||
filename[--len] = 0;
|
filename[--len] = 0;
|
||||||
|
|
||||||
strcat (filename+len, "/");
|
strcat (filename+len, SLASH_STRING);
|
||||||
strcat (filename, string);
|
strcat (filename, string);
|
||||||
|
|
||||||
fd = open (filename, mode);
|
fd = open (filename, mode);
|
||||||
|
@ -548,18 +551,19 @@ openp (path, try_cwd_first, string, mode, prot, filename_opened)
|
||||||
{
|
{
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
*filename_opened = (char *) 0;
|
*filename_opened = (char *) 0;
|
||||||
else if (filename[0] == '/')
|
else if (ROOTED_P (filename))
|
||||||
*filename_opened = savestring (filename, strlen (filename));
|
*filename_opened = savestring (filename, strlen (filename));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Beware the // my son, the Emacs barfs, the botch that catch... */
|
/* Beware the // my son, the Emacs barfs, the botch that catch... */
|
||||||
|
|
||||||
*filename_opened = concat (current_directory,
|
*filename_opened = concat (current_directory,
|
||||||
'/' == current_directory[strlen(current_directory)-1]? "": "/",
|
SLASH_CHAR
|
||||||
|
== current_directory[strlen(current_directory)-1]
|
||||||
|
? "": SLASH_STRING,
|
||||||
filename, NULL);
|
filename, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* start-sanitize-mpw */
|
|
||||||
#ifdef MPW
|
#ifdef MPW
|
||||||
/* This is a debugging hack that can go away when all combinations
|
/* This is a debugging hack that can go away when all combinations
|
||||||
of Mac and Unix names are handled reasonably. */
|
of Mac and Unix names are handled reasonably. */
|
||||||
|
@ -575,8 +579,7 @@ openp (path, try_cwd_first, string, mode, prot, filename_opened)
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* MPW */
|
||||||
/* end-sanitize-mpw */
|
|
||||||
|
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
@ -633,7 +636,6 @@ open_source_file (s)
|
||||||
if (p != s->filename)
|
if (p != s->filename)
|
||||||
result = openp (path, 0, p, O_RDONLY, 0, &s->fullname);
|
result = openp (path, 0, p, O_RDONLY, 0, &s->fullname);
|
||||||
}
|
}
|
||||||
/* start-sanitize-mpw */
|
|
||||||
#ifdef MPW
|
#ifdef MPW
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
{
|
{
|
||||||
|
@ -650,7 +652,7 @@ open_source_file (s)
|
||||||
result = openp (path, 0, p, O_RDONLY, 0, &s->fullname);
|
result = openp (path, 0, p, O_RDONLY, 0, &s->fullname);
|
||||||
}
|
}
|
||||||
#endif /* MPW */
|
#endif /* MPW */
|
||||||
/* end-sanitize-mpw */
|
|
||||||
if (result >= 0)
|
if (result >= 0)
|
||||||
{
|
{
|
||||||
fullname = s->fullname;
|
fullname = s->fullname;
|
||||||
|
|
288
gdb/stack.c
288
gdb/stack.c
|
@ -1,5 +1,6 @@
|
||||||
/* Print and select stack frames for GDB, the GNU debugger.
|
/* Print and select stack frames for GDB, the GNU debugger.
|
||||||
Copyright 1986, 1987, 1989, 1991, 1992, 1993 Free Software Foundation, Inc.
|
Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994
|
||||||
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GDB.
|
This file is part of GDB.
|
||||||
|
|
||||||
|
@ -17,6 +18,7 @@ You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include "value.h"
|
#include "value.h"
|
||||||
#include "symtab.h"
|
#include "symtab.h"
|
||||||
|
@ -30,61 +32,47 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#include "breakpoint.h"
|
#include "breakpoint.h"
|
||||||
#include "demangle.h"
|
#include "demangle.h"
|
||||||
#include "inferior.h"
|
#include "inferior.h"
|
||||||
|
#include "annotate.h"
|
||||||
|
|
||||||
static void
|
static void return_command PARAMS ((char *, int));
|
||||||
return_command PARAMS ((char *, int));
|
|
||||||
|
|
||||||
static void
|
static void down_command PARAMS ((char *, int));
|
||||||
down_command PARAMS ((char *, int));
|
|
||||||
|
|
||||||
static void
|
static void down_silently_command PARAMS ((char *, int));
|
||||||
down_silently_command PARAMS ((char *, int));
|
|
||||||
|
|
||||||
static void
|
static void up_command PARAMS ((char *, int));
|
||||||
up_command PARAMS ((char *, int));
|
|
||||||
|
|
||||||
static void
|
static void up_silently_command PARAMS ((char *, int));
|
||||||
up_silently_command PARAMS ((char *, int));
|
|
||||||
|
|
||||||
static void
|
static void frame_command PARAMS ((char *, int));
|
||||||
frame_command PARAMS ((char *, int));
|
|
||||||
|
|
||||||
static void
|
static void select_frame_command PARAMS ((char *, int));
|
||||||
select_frame_command PARAMS ((char *, int));
|
|
||||||
|
|
||||||
static void
|
static void args_info PARAMS ((char *, int));
|
||||||
args_info PARAMS ((char *, int));
|
|
||||||
|
|
||||||
static void
|
static void print_frame_arg_vars PARAMS ((struct frame_info *, GDB_FILE *));
|
||||||
print_frame_arg_vars PARAMS ((FRAME, GDB_FILE *));
|
|
||||||
|
|
||||||
static void
|
static void catch_info PARAMS ((char *, int));
|
||||||
catch_info PARAMS ((char *, int));
|
|
||||||
|
|
||||||
static void
|
static void locals_info PARAMS ((char *, int));
|
||||||
locals_info PARAMS ((char *, int));
|
|
||||||
|
|
||||||
static void
|
static void print_frame_label_vars PARAMS ((struct frame_info *, int,
|
||||||
print_frame_label_vars PARAMS ((FRAME, int, GDB_FILE *));
|
GDB_FILE *));
|
||||||
|
|
||||||
static void
|
static void print_frame_local_vars PARAMS ((struct frame_info *, GDB_FILE *));
|
||||||
print_frame_local_vars PARAMS ((FRAME, GDB_FILE *));
|
|
||||||
|
|
||||||
static int
|
static int print_block_frame_labels PARAMS ((struct block *, int *,
|
||||||
print_block_frame_labels PARAMS ((struct block *, int *, GDB_FILE *));
|
GDB_FILE *));
|
||||||
|
|
||||||
static int
|
static int print_block_frame_locals PARAMS ((struct block *,
|
||||||
print_block_frame_locals PARAMS ((struct block *, FRAME, GDB_FILE *));
|
struct frame_info *,
|
||||||
|
GDB_FILE *));
|
||||||
|
|
||||||
static void
|
static void backtrace_command PARAMS ((char *, int));
|
||||||
backtrace_command PARAMS ((char *, int));
|
|
||||||
|
|
||||||
static FRAME
|
static struct frame_info *parse_frame_specification PARAMS ((char *));
|
||||||
parse_frame_specification PARAMS ((char *));
|
|
||||||
|
|
||||||
static void
|
|
||||||
frame_info PARAMS ((char *, int));
|
|
||||||
|
|
||||||
|
static void frame_info PARAMS ((char *, int));
|
||||||
|
|
||||||
extern int addressprint; /* Print addresses, or stay symbolic only? */
|
extern int addressprint; /* Print addresses, or stay symbolic only? */
|
||||||
extern int info_verbose; /* Verbosity of symbol reading msgs */
|
extern int info_verbose; /* Verbosity of symbol reading msgs */
|
||||||
|
@ -93,7 +81,7 @@ extern int lines_to_list; /* # of lines "list" command shows by default */
|
||||||
/* The "selected" stack frame is used by default for local and arg access.
|
/* The "selected" stack frame is used by default for local and arg access.
|
||||||
May be zero, for no selected frame. */
|
May be zero, for no selected frame. */
|
||||||
|
|
||||||
FRAME selected_frame;
|
struct frame_info *selected_frame;
|
||||||
|
|
||||||
/* Level of the selected frame:
|
/* Level of the selected frame:
|
||||||
0 for innermost, 1 for its caller, ...
|
0 for innermost, 1 for its caller, ...
|
||||||
|
@ -125,11 +113,12 @@ print_stack_frame_stub (args)
|
||||||
char *args;
|
char *args;
|
||||||
{
|
{
|
||||||
struct print_stack_frame_args *p = (struct print_stack_frame_args *)args;
|
struct print_stack_frame_args *p = (struct print_stack_frame_args *)args;
|
||||||
|
|
||||||
print_frame_info (p->fi, p->level, p->source, p->args);
|
print_frame_info (p->fi, p->level, p->source, p->args);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print a stack frame briefly. FRAME should be the frame id
|
/* Print a stack frame briefly. FRAME_INFI should be the frame info
|
||||||
and LEVEL should be its level in the stack (or -1 for level not defined).
|
and LEVEL should be its level in the stack (or -1 for level not defined).
|
||||||
This prints the level, the function executing, the arguments,
|
This prints the level, the function executing, the arguments,
|
||||||
and the file name and line number.
|
and the file name and line number.
|
||||||
|
@ -140,14 +129,14 @@ print_stack_frame_stub (args)
|
||||||
If SOURCE is -1, print ONLY the source line. */
|
If SOURCE is -1, print ONLY the source line. */
|
||||||
|
|
||||||
void
|
void
|
||||||
print_stack_frame (frame, level, source)
|
print_stack_frame (fi, level, source)
|
||||||
FRAME frame;
|
struct frame_info *fi;
|
||||||
int level;
|
int level;
|
||||||
int source;
|
int source;
|
||||||
{
|
{
|
||||||
struct print_stack_frame_args args;
|
struct print_stack_frame_args args;
|
||||||
|
|
||||||
args.fi = get_frame_info (frame);
|
args.fi = fi;
|
||||||
args.level = level;
|
args.level = level;
|
||||||
args.source = source;
|
args.source = source;
|
||||||
args.args = 1;
|
args.args = 1;
|
||||||
|
@ -163,17 +152,22 @@ struct print_args_args {
|
||||||
static int print_args_stub PARAMS ((char *));
|
static int print_args_stub PARAMS ((char *));
|
||||||
|
|
||||||
/* Pass the args the way catch_errors wants them. */
|
/* Pass the args the way catch_errors wants them. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
print_args_stub (args)
|
print_args_stub (args)
|
||||||
char *args;
|
char *args;
|
||||||
{
|
{
|
||||||
int numargs;
|
int numargs;
|
||||||
struct print_args_args *p = (struct print_args_args *)args;
|
struct print_args_args *p = (struct print_args_args *)args;
|
||||||
|
|
||||||
FRAME_NUM_ARGS (numargs, (p->fi));
|
FRAME_NUM_ARGS (numargs, (p->fi));
|
||||||
print_frame_args (p->func, p->fi, numargs, gdb_stdout);
|
print_frame_args (p->func, p->fi, numargs, gdb_stdout);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* LEVEL is the level of the frame, or -1 if it is the innermost frame
|
||||||
|
but we don't want to print the level. */
|
||||||
|
|
||||||
void
|
void
|
||||||
print_frame_info (fi, level, source, args)
|
print_frame_info (fi, level, source, args)
|
||||||
struct frame_info *fi;
|
struct frame_info *fi;
|
||||||
|
@ -185,10 +179,11 @@ print_frame_info (fi, level, source, args)
|
||||||
struct symbol *func;
|
struct symbol *func;
|
||||||
register char *funname = 0;
|
register char *funname = 0;
|
||||||
enum language funlang = language_unknown;
|
enum language funlang = language_unknown;
|
||||||
|
|
||||||
|
#if 0
|
||||||
char buf[MAX_REGISTER_RAW_SIZE];
|
char buf[MAX_REGISTER_RAW_SIZE];
|
||||||
CORE_ADDR sp;
|
CORE_ADDR sp;
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* On the 68k, this spends too much time in m68k_find_saved_regs. */
|
/* On the 68k, this spends too much time in m68k_find_saved_regs. */
|
||||||
|
|
||||||
/* Get the value of SP_REGNUM relative to the frame. */
|
/* Get the value of SP_REGNUM relative to the frame. */
|
||||||
|
@ -205,20 +200,28 @@ print_frame_info (fi, level, source, args)
|
||||||
if (frame_in_dummy (fi))
|
if (frame_in_dummy (fi))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
annotate_frame_begin (level == -1 ? 0 : level, fi->pc);
|
||||||
|
|
||||||
/* Do this regardless of SOURCE because we don't have any source
|
/* Do this regardless of SOURCE because we don't have any source
|
||||||
to list for this frame. */
|
to list for this frame. */
|
||||||
if (level >= 0)
|
if (level >= 0)
|
||||||
printf_filtered ("#%-2d ", level);
|
printf_filtered ("#%-2d ", level);
|
||||||
|
annotate_function_call ();
|
||||||
printf_filtered ("<function called from gdb>\n");
|
printf_filtered ("<function called from gdb>\n");
|
||||||
|
annotate_frame_end ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (fi->signal_handler_caller)
|
if (fi->signal_handler_caller)
|
||||||
{
|
{
|
||||||
|
annotate_frame_begin (level == -1 ? 0 : level, fi->pc);
|
||||||
|
|
||||||
/* Do this regardless of SOURCE because we don't have any source
|
/* Do this regardless of SOURCE because we don't have any source
|
||||||
to list for this frame. */
|
to list for this frame. */
|
||||||
if (level >= 0)
|
if (level >= 0)
|
||||||
printf_filtered ("#%-2d ", level);
|
printf_filtered ("#%-2d ", level);
|
||||||
|
annotate_signal_handler_caller ();
|
||||||
printf_filtered ("<signal handler called>\n");
|
printf_filtered ("<signal handler called>\n");
|
||||||
|
annotate_frame_end ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,17 +293,23 @@ print_frame_info (fi, level, source, args)
|
||||||
|
|
||||||
if (source >= 0 || !sal.symtab)
|
if (source >= 0 || !sal.symtab)
|
||||||
{
|
{
|
||||||
|
annotate_frame_begin (level == -1 ? 0 : level, fi->pc);
|
||||||
|
|
||||||
if (level >= 0)
|
if (level >= 0)
|
||||||
printf_filtered ("#%-2d ", level);
|
printf_filtered ("#%-2d ", level);
|
||||||
if (addressprint)
|
if (addressprint)
|
||||||
if (fi->pc != sal.pc || !sal.symtab)
|
if (fi->pc != sal.pc || !sal.symtab)
|
||||||
{
|
{
|
||||||
|
annotate_frame_address ();
|
||||||
print_address_numeric (fi->pc, 1, gdb_stdout);
|
print_address_numeric (fi->pc, 1, gdb_stdout);
|
||||||
|
annotate_frame_address_end ();
|
||||||
printf_filtered (" in ");
|
printf_filtered (" in ");
|
||||||
}
|
}
|
||||||
|
annotate_frame_function_name ();
|
||||||
fprintf_symbol_filtered (gdb_stdout, funname ? funname : "??", funlang,
|
fprintf_symbol_filtered (gdb_stdout, funname ? funname : "??", funlang,
|
||||||
DMGL_ANSI);
|
DMGL_ANSI);
|
||||||
wrap_here (" ");
|
wrap_here (" ");
|
||||||
|
annotate_frame_args ();
|
||||||
fputs_filtered (" (", gdb_stdout);
|
fputs_filtered (" (", gdb_stdout);
|
||||||
if (args)
|
if (args)
|
||||||
{
|
{
|
||||||
|
@ -312,15 +321,25 @@ print_frame_info (fi, level, source, args)
|
||||||
printf_filtered (")");
|
printf_filtered (")");
|
||||||
if (sal.symtab && sal.symtab->filename)
|
if (sal.symtab && sal.symtab->filename)
|
||||||
{
|
{
|
||||||
|
annotate_frame_source_begin ();
|
||||||
wrap_here (" ");
|
wrap_here (" ");
|
||||||
printf_filtered (" at %s:%d", sal.symtab->filename, sal.line);
|
printf_filtered (" at ");
|
||||||
|
annotate_frame_source_file ();
|
||||||
|
printf_filtered ("%s", sal.symtab->filename);
|
||||||
|
annotate_frame_source_file_end ();
|
||||||
|
printf_filtered (":");
|
||||||
|
annotate_frame_source_line ();
|
||||||
|
printf_filtered ("%d", sal.line);
|
||||||
|
annotate_frame_source_end ();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PC_LOAD_SEGMENT
|
#ifdef PC_LOAD_SEGMENT
|
||||||
/* If we couldn't print out function name but if can figure out what
|
/* If we couldn't print out function name but if can figure out what
|
||||||
load segment this pc value is from, at least print out some info
|
load segment this pc value is from, at least print out some info
|
||||||
about its load segment. */
|
about its load segment. */
|
||||||
if (!funname) {
|
if (!funname)
|
||||||
|
{
|
||||||
|
annotate_frame_where ();
|
||||||
wrap_here (" ");
|
wrap_here (" ");
|
||||||
printf_filtered (" from %s", PC_LOAD_SEGMENT (fi->pc));
|
printf_filtered (" from %s", PC_LOAD_SEGMENT (fi->pc));
|
||||||
}
|
}
|
||||||
|
@ -342,6 +361,9 @@ print_frame_info (fi, level, source, args)
|
||||||
print_address_numeric (fi->pc, 1, gdb_stdout);
|
print_address_numeric (fi->pc, 1, gdb_stdout);
|
||||||
printf_filtered ("\t");
|
printf_filtered ("\t");
|
||||||
}
|
}
|
||||||
|
if (print_frame_info_listing_hook)
|
||||||
|
print_frame_info_listing_hook (sal.symtab, sal.line, sal.line + 1, 0);
|
||||||
|
else
|
||||||
print_source_lines (sal.symtab, sal.line, sal.line + 1, 0);
|
print_source_lines (sal.symtab, sal.line, sal.line + 1, 0);
|
||||||
}
|
}
|
||||||
current_source_line = max (sal.line - lines_to_list/2, 1);
|
current_source_line = max (sal.line - lines_to_list/2, 1);
|
||||||
|
@ -349,15 +371,16 @@ print_frame_info (fi, level, source, args)
|
||||||
if (source != 0)
|
if (source != 0)
|
||||||
set_default_breakpoint (1, fi->pc, sal.symtab, sal.line);
|
set_default_breakpoint (1, fi->pc, sal.symtab, sal.line);
|
||||||
|
|
||||||
|
annotate_frame_end ();
|
||||||
|
|
||||||
gdb_flush (gdb_stdout);
|
gdb_flush (gdb_stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Read a frame specification in whatever the appropriate format is.
|
||||||
* Read a frame specification in whatever the appropriate format is.
|
Call error() if the specification is in any way invalid (i.e.
|
||||||
* Call error() if the specification is in any way invalid (i.e.
|
this function never returns NULL). */
|
||||||
* this function never returns NULL).
|
|
||||||
*/
|
static struct frame_info *
|
||||||
static FRAME
|
|
||||||
parse_frame_specification (frame_exp)
|
parse_frame_specification (frame_exp)
|
||||||
char *frame_exp;
|
char *frame_exp;
|
||||||
{
|
{
|
||||||
|
@ -403,8 +426,9 @@ parse_frame_specification (frame_exp)
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
int level = args[0];
|
int level = args[0];
|
||||||
FRAME fid = find_relative_frame (get_current_frame (), &level);
|
struct frame_info *fid =
|
||||||
FRAME tfid;
|
find_relative_frame (get_current_frame (), &level);
|
||||||
|
struct frame_info *tfid;
|
||||||
|
|
||||||
if (level == 0)
|
if (level == 0)
|
||||||
/* find_relative_frame was successful */
|
/* find_relative_frame was successful */
|
||||||
|
@ -430,13 +454,13 @@ parse_frame_specification (frame_exp)
|
||||||
(s)he gets. Still, give the highest one that matches. */
|
(s)he gets. Still, give the highest one that matches. */
|
||||||
|
|
||||||
for (fid = get_current_frame ();
|
for (fid = get_current_frame ();
|
||||||
fid && FRAME_FP (fid) != args[0];
|
fid && fid->frame != args[0];
|
||||||
fid = get_prev_frame (fid))
|
fid = get_prev_frame (fid))
|
||||||
;
|
;
|
||||||
|
|
||||||
if (fid)
|
if (fid)
|
||||||
while ((tfid = get_prev_frame (fid)) &&
|
while ((tfid = get_prev_frame (fid)) &&
|
||||||
(FRAME_FP (tfid) == args[0]))
|
(tfid->frame == args[0]))
|
||||||
fid = tfid;
|
fid = tfid;
|
||||||
|
|
||||||
/* We couldn't identify the frame as an existing frame, but
|
/* We couldn't identify the frame as an existing frame, but
|
||||||
|
@ -476,30 +500,28 @@ frame_info (addr_exp, from_tty)
|
||||||
char *addr_exp;
|
char *addr_exp;
|
||||||
int from_tty;
|
int from_tty;
|
||||||
{
|
{
|
||||||
FRAME frame;
|
|
||||||
struct frame_info *fi;
|
struct frame_info *fi;
|
||||||
struct frame_saved_regs fsr;
|
struct frame_saved_regs fsr;
|
||||||
struct symtab_and_line sal;
|
struct symtab_and_line sal;
|
||||||
struct symbol *func;
|
struct symbol *func;
|
||||||
struct symtab *s;
|
struct symtab *s;
|
||||||
FRAME calling_frame;
|
struct frame_info *calling_frame_info;
|
||||||
int i, count;
|
int i, count, numregs;
|
||||||
char *funname = 0;
|
char *funname = 0;
|
||||||
enum language funlang = language_unknown;
|
enum language funlang = language_unknown;
|
||||||
|
|
||||||
if (!target_has_stack)
|
if (!target_has_stack)
|
||||||
error ("No stack.");
|
error ("No stack.");
|
||||||
|
|
||||||
frame = parse_frame_specification (addr_exp);
|
fi = parse_frame_specification (addr_exp);
|
||||||
if (!frame)
|
if (fi == NULL)
|
||||||
error ("Invalid frame specified.");
|
error ("Invalid frame specified.");
|
||||||
|
|
||||||
fi = get_frame_info (frame);
|
|
||||||
sal = find_pc_line (fi->pc,
|
sal = find_pc_line (fi->pc,
|
||||||
fi->next != NULL
|
fi->next != NULL
|
||||||
&& !fi->next->signal_handler_caller
|
&& !fi->next->signal_handler_caller
|
||||||
&& !frame_in_dummy (fi->next));
|
&& !frame_in_dummy (fi->next));
|
||||||
func = get_frame_function (frame);
|
func = get_frame_function (fi);
|
||||||
s = find_pc_symtab(fi->pc);
|
s = find_pc_symtab(fi->pc);
|
||||||
if (func)
|
if (func)
|
||||||
{
|
{
|
||||||
|
@ -515,22 +537,21 @@ frame_info (addr_exp, from_tty)
|
||||||
funlang = SYMBOL_LANGUAGE (msymbol);
|
funlang = SYMBOL_LANGUAGE (msymbol);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
calling_frame = get_prev_frame (frame);
|
calling_frame_info = get_prev_frame (fi);
|
||||||
|
|
||||||
if (!addr_exp && selected_frame_level >= 0)
|
if (!addr_exp && selected_frame_level >= 0)
|
||||||
{
|
{
|
||||||
printf_filtered ("Stack level %d, frame at ", selected_frame_level);
|
printf_filtered ("Stack level %d, frame at ", selected_frame_level);
|
||||||
print_address_numeric (FRAME_FP(frame), 1, gdb_stdout);
|
print_address_numeric (fi->frame, 1, gdb_stdout);
|
||||||
printf_filtered (":\n");
|
printf_filtered (":\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf_filtered ("Stack frame at ");
|
printf_filtered ("Stack frame at ");
|
||||||
print_address_numeric (FRAME_FP(frame), 1, gdb_stdout);
|
print_address_numeric (fi->frame, 1, gdb_stdout);
|
||||||
printf_filtered (":\n");
|
printf_filtered (":\n");
|
||||||
}
|
}
|
||||||
printf_filtered (" %s = ",
|
printf_filtered (" %s = ", reg_names[PC_REGNUM]);
|
||||||
reg_names[PC_REGNUM]);
|
|
||||||
print_address_numeric (fi->pc, 1, gdb_stdout);
|
print_address_numeric (fi->pc, 1, gdb_stdout);
|
||||||
|
|
||||||
wrap_here (" ");
|
wrap_here (" ");
|
||||||
|
@ -546,7 +567,7 @@ frame_info (addr_exp, from_tty)
|
||||||
puts_filtered ("; ");
|
puts_filtered ("; ");
|
||||||
wrap_here (" ");
|
wrap_here (" ");
|
||||||
printf_filtered ("saved %s ", reg_names[PC_REGNUM]);
|
printf_filtered ("saved %s ", reg_names[PC_REGNUM]);
|
||||||
print_address_numeric (FRAME_SAVED_PC (frame), 1, gdb_stdout);
|
print_address_numeric (FRAME_SAVED_PC (fi), 1, gdb_stdout);
|
||||||
printf_filtered ("\n");
|
printf_filtered ("\n");
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -558,12 +579,12 @@ frame_info (addr_exp, from_tty)
|
||||||
printf_filtered (" (FRAMELESS),");
|
printf_filtered (" (FRAMELESS),");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (calling_frame)
|
if (calling_frame_info)
|
||||||
{
|
{
|
||||||
printf_filtered (" called by frame at ");
|
printf_filtered (" called by frame at ");
|
||||||
print_address_numeric (FRAME_FP (calling_frame), 1, gdb_stdout);
|
print_address_numeric (calling_frame_info->frame, 1, gdb_stdout);
|
||||||
}
|
}
|
||||||
if (fi->next && calling_frame)
|
if (fi->next && calling_frame_info)
|
||||||
puts_filtered (",");
|
puts_filtered (",");
|
||||||
wrap_here (" ");
|
wrap_here (" ");
|
||||||
if (fi->next)
|
if (fi->next)
|
||||||
|
@ -571,7 +592,7 @@ frame_info (addr_exp, from_tty)
|
||||||
printf_filtered (" caller of frame at ");
|
printf_filtered (" caller of frame at ");
|
||||||
print_address_numeric (fi->next->frame, 1, gdb_stdout);
|
print_address_numeric (fi->next->frame, 1, gdb_stdout);
|
||||||
}
|
}
|
||||||
if (fi->next || calling_frame)
|
if (fi->next || calling_frame_info)
|
||||||
puts_filtered ("\n");
|
puts_filtered ("\n");
|
||||||
if (s)
|
if (s)
|
||||||
printf_filtered (" source language %s.\n", language_str (s->language));
|
printf_filtered (" source language %s.\n", language_str (s->language));
|
||||||
|
@ -629,7 +650,8 @@ frame_info (addr_exp, from_tty)
|
||||||
print_address_numeric (fsr.regs[SP_REGNUM], 1, gdb_stdout);
|
print_address_numeric (fsr.regs[SP_REGNUM], 1, gdb_stdout);
|
||||||
printf_filtered ("\n");
|
printf_filtered ("\n");
|
||||||
count = 0;
|
count = 0;
|
||||||
for (i = 0; i < NUM_REGS; i++)
|
numregs = ARCH_NUM_REGS;
|
||||||
|
for (i = 0; i < numregs; i++)
|
||||||
if (fsr.regs[i] && i != SP_REGNUM)
|
if (fsr.regs[i] && i != SP_REGNUM)
|
||||||
{
|
{
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
|
@ -644,6 +666,10 @@ frame_info (addr_exp, from_tty)
|
||||||
if (count)
|
if (count)
|
||||||
puts_filtered ("\n");
|
puts_filtered ("\n");
|
||||||
#else /* Have FRAME_FIND_SAVED_REGS. */
|
#else /* Have FRAME_FIND_SAVED_REGS. */
|
||||||
|
/* We could get some information about saved registers by calling
|
||||||
|
get_saved_register on each register. Which info goes with which frame
|
||||||
|
is necessarily lost, however, and I suspect that the users don't care
|
||||||
|
whether they get the info. */
|
||||||
puts_filtered ("\n");
|
puts_filtered ("\n");
|
||||||
#endif /* Have FRAME_FIND_SAVED_REGS. */
|
#endif /* Have FRAME_FIND_SAVED_REGS. */
|
||||||
}
|
}
|
||||||
|
@ -688,9 +714,8 @@ backtrace_command (count_exp, from_tty)
|
||||||
{
|
{
|
||||||
struct frame_info *fi;
|
struct frame_info *fi;
|
||||||
register int count;
|
register int count;
|
||||||
register FRAME frame;
|
|
||||||
register int i;
|
register int i;
|
||||||
register FRAME trailing;
|
register struct frame_info *trailing;
|
||||||
register int trailing_level;
|
register int trailing_level;
|
||||||
|
|
||||||
if (!target_has_stack)
|
if (!target_has_stack)
|
||||||
|
@ -707,7 +732,7 @@ backtrace_command (count_exp, from_tty)
|
||||||
count = parse_and_eval_address (count_exp);
|
count = parse_and_eval_address (count_exp);
|
||||||
if (count < 0)
|
if (count < 0)
|
||||||
{
|
{
|
||||||
FRAME current;
|
struct frame_info *current;
|
||||||
|
|
||||||
count = -count;
|
count = -count;
|
||||||
|
|
||||||
|
@ -744,24 +769,22 @@ backtrace_command (count_exp, from_tty)
|
||||||
if people have strong opinions against reading symbols for
|
if people have strong opinions against reading symbols for
|
||||||
backtrace this may have to be an option. */
|
backtrace this may have to be an option. */
|
||||||
i = count;
|
i = count;
|
||||||
for (frame = trailing;
|
for (fi = trailing;
|
||||||
frame != NULL && i--;
|
fi != NULL && i--;
|
||||||
frame = get_prev_frame (frame))
|
fi = get_prev_frame (fi))
|
||||||
{
|
{
|
||||||
QUIT;
|
QUIT;
|
||||||
fi = get_frame_info (frame);
|
|
||||||
ps = find_pc_psymtab (fi->pc);
|
ps = find_pc_psymtab (fi->pc);
|
||||||
if (ps)
|
if (ps)
|
||||||
PSYMTAB_TO_SYMTAB (ps); /* Force syms to come in */
|
PSYMTAB_TO_SYMTAB (ps); /* Force syms to come in */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0, frame = trailing;
|
for (i = 0, fi = trailing;
|
||||||
frame && count--;
|
fi && count--;
|
||||||
i++, frame = get_prev_frame (frame))
|
i++, fi = get_prev_frame (fi))
|
||||||
{
|
{
|
||||||
QUIT;
|
QUIT;
|
||||||
fi = get_frame_info (frame);
|
|
||||||
|
|
||||||
/* Don't use print_stack_frame; if an error() occurs it probably
|
/* Don't use print_stack_frame; if an error() occurs it probably
|
||||||
means further attempts to backtrace would fail (on the other
|
means further attempts to backtrace would fail (on the other
|
||||||
|
@ -771,7 +794,7 @@ backtrace_command (count_exp, from_tty)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we've stopped before the end, mention that. */
|
/* If we've stopped before the end, mention that. */
|
||||||
if (frame && from_tty)
|
if (fi && from_tty)
|
||||||
printf_filtered ("(More stack frames follow...)\n");
|
printf_filtered ("(More stack frames follow...)\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -779,9 +802,9 @@ backtrace_command (count_exp, from_tty)
|
||||||
Return 1 if any variables were printed; 0 otherwise. */
|
Return 1 if any variables were printed; 0 otherwise. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
print_block_frame_locals (b, frame, stream)
|
print_block_frame_locals (b, fi, stream)
|
||||||
struct block *b;
|
struct block *b;
|
||||||
register FRAME frame;
|
register struct frame_info *fi;
|
||||||
register GDB_FILE *stream;
|
register GDB_FILE *stream;
|
||||||
{
|
{
|
||||||
int nsyms;
|
int nsyms;
|
||||||
|
@ -803,7 +826,7 @@ print_block_frame_locals (b, frame, stream)
|
||||||
values_printed = 1;
|
values_printed = 1;
|
||||||
fputs_filtered (SYMBOL_SOURCE_NAME (sym), stream);
|
fputs_filtered (SYMBOL_SOURCE_NAME (sym), stream);
|
||||||
fputs_filtered (" = ", stream);
|
fputs_filtered (" = ", stream);
|
||||||
print_variable_value (sym, frame, stream);
|
print_variable_value (sym, fi, stream);
|
||||||
fprintf_filtered (stream, "\n");
|
fprintf_filtered (stream, "\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -866,11 +889,11 @@ print_block_frame_labels (b, have_default, stream)
|
||||||
on the function running in FRAME. */
|
on the function running in FRAME. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_frame_local_vars (frame, stream)
|
print_frame_local_vars (fi, stream)
|
||||||
register FRAME frame;
|
register struct frame_info *fi;
|
||||||
register GDB_FILE *stream;
|
register GDB_FILE *stream;
|
||||||
{
|
{
|
||||||
register struct block *block = get_frame_block (frame);
|
register struct block *block = get_frame_block (fi);
|
||||||
register int values_printed = 0;
|
register int values_printed = 0;
|
||||||
|
|
||||||
if (block == 0)
|
if (block == 0)
|
||||||
|
@ -881,7 +904,7 @@ print_frame_local_vars (frame, stream)
|
||||||
|
|
||||||
while (block != 0)
|
while (block != 0)
|
||||||
{
|
{
|
||||||
if (print_block_frame_locals (block, frame, stream))
|
if (print_block_frame_locals (block, fi, stream))
|
||||||
values_printed = 1;
|
values_printed = 1;
|
||||||
/* After handling the function's top-level block, stop.
|
/* After handling the function's top-level block, stop.
|
||||||
Don't continue to its superblock, the block of
|
Don't continue to its superblock, the block of
|
||||||
|
@ -900,17 +923,16 @@ print_frame_local_vars (frame, stream)
|
||||||
/* Same, but print labels. */
|
/* Same, but print labels. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_frame_label_vars (frame, this_level_only, stream)
|
print_frame_label_vars (fi, this_level_only, stream)
|
||||||
register FRAME frame;
|
register struct frame_info *fi;
|
||||||
int this_level_only;
|
int this_level_only;
|
||||||
register GDB_FILE *stream;
|
register GDB_FILE *stream;
|
||||||
{
|
{
|
||||||
register struct blockvector *bl;
|
register struct blockvector *bl;
|
||||||
register struct block *block = get_frame_block (frame);
|
register struct block *block = get_frame_block (fi);
|
||||||
register int values_printed = 0;
|
register int values_printed = 0;
|
||||||
int index, have_default = 0;
|
int index, have_default = 0;
|
||||||
char *blocks_printed;
|
char *blocks_printed;
|
||||||
struct frame_info *fi = get_frame_info (frame);
|
|
||||||
CORE_ADDR pc = fi->pc;
|
CORE_ADDR pc = fi->pc;
|
||||||
|
|
||||||
if (block == 0)
|
if (block == 0)
|
||||||
|
@ -992,11 +1014,11 @@ catch_info (ignore, from_tty)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_frame_arg_vars (frame, stream)
|
print_frame_arg_vars (fi, stream)
|
||||||
register FRAME frame;
|
register struct frame_info *fi;
|
||||||
register GDB_FILE *stream;
|
register GDB_FILE *stream;
|
||||||
{
|
{
|
||||||
struct symbol *func = get_frame_function (frame);
|
struct symbol *func = get_frame_function (fi);
|
||||||
register struct block *b;
|
register struct block *b;
|
||||||
int nsyms;
|
int nsyms;
|
||||||
register int i;
|
register int i;
|
||||||
|
@ -1040,7 +1062,7 @@ print_frame_arg_vars (frame, stream)
|
||||||
|
|
||||||
sym2 = lookup_symbol (SYMBOL_NAME (sym),
|
sym2 = lookup_symbol (SYMBOL_NAME (sym),
|
||||||
b, VAR_NAMESPACE, (int *)NULL, (struct symtab **)NULL);
|
b, VAR_NAMESPACE, (int *)NULL, (struct symtab **)NULL);
|
||||||
print_variable_value (sym2, frame, stream);
|
print_variable_value (sym2, fi, stream);
|
||||||
fprintf_filtered (stream, "\n");
|
fprintf_filtered (stream, "\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1066,24 +1088,24 @@ args_info (ignore, from_tty)
|
||||||
print_frame_arg_vars (selected_frame, gdb_stdout);
|
print_frame_arg_vars (selected_frame, gdb_stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Select frame FRAME, and note that its stack level is LEVEL.
|
/* Select frame FI, and note that its stack level is LEVEL.
|
||||||
LEVEL may be -1 if an actual level number is not known. */
|
LEVEL may be -1 if an actual level number is not known. */
|
||||||
|
|
||||||
void
|
void
|
||||||
select_frame (frame, level)
|
select_frame (fi, level)
|
||||||
FRAME frame;
|
struct frame_info *fi;
|
||||||
int level;
|
int level;
|
||||||
{
|
{
|
||||||
register struct symtab *s;
|
register struct symtab *s;
|
||||||
|
|
||||||
selected_frame = frame;
|
selected_frame = fi;
|
||||||
selected_frame_level = level;
|
selected_frame_level = level;
|
||||||
|
|
||||||
/* Ensure that symbols for this frame are read in. Also, determine the
|
/* Ensure that symbols for this frame are read in. Also, determine the
|
||||||
source language of this frame, and switch to it if desired. */
|
source language of this frame, and switch to it if desired. */
|
||||||
if (frame)
|
if (fi)
|
||||||
{
|
{
|
||||||
s = find_pc_symtab (get_frame_info (frame)->pc);
|
s = find_pc_symtab (fi->pc);
|
||||||
if (s
|
if (s
|
||||||
&& s->language != current_language->la_language
|
&& s->language != current_language->la_language
|
||||||
&& s->language != language_unknown
|
&& s->language != language_unknown
|
||||||
|
@ -1098,10 +1120,10 @@ select_frame (frame, level)
|
||||||
|
|
||||||
void
|
void
|
||||||
record_selected_frame (frameaddrp, levelp)
|
record_selected_frame (frameaddrp, levelp)
|
||||||
FRAME_ADDR *frameaddrp;
|
CORE_ADDR *frameaddrp;
|
||||||
int *levelp;
|
int *levelp;
|
||||||
{
|
{
|
||||||
*frameaddrp = selected_frame ? FRAME_FP (selected_frame) : 0;
|
*frameaddrp = selected_frame ? selected_frame->frame : 0;
|
||||||
*levelp = selected_frame_level;
|
*levelp = selected_frame_level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1128,13 +1150,13 @@ get_selected_block ()
|
||||||
but the final value of *LEVEL_OFFSET_PTR is nonzero and indicates
|
but the final value of *LEVEL_OFFSET_PTR is nonzero and indicates
|
||||||
how much farther the original request asked to go. */
|
how much farther the original request asked to go. */
|
||||||
|
|
||||||
FRAME
|
struct frame_info *
|
||||||
find_relative_frame (frame, level_offset_ptr)
|
find_relative_frame (frame, level_offset_ptr)
|
||||||
register FRAME frame;
|
register struct frame_info *frame;
|
||||||
register int* level_offset_ptr;
|
register int *level_offset_ptr;
|
||||||
{
|
{
|
||||||
register FRAME prev;
|
register struct frame_info *prev;
|
||||||
register FRAME frame1;
|
register struct frame_info *frame1;
|
||||||
|
|
||||||
/* Going up is simple: just do get_prev_frame enough times
|
/* Going up is simple: just do get_prev_frame enough times
|
||||||
or until initial frame is reached. */
|
or until initial frame is reached. */
|
||||||
|
@ -1172,7 +1194,7 @@ select_frame_command (level_exp, from_tty)
|
||||||
char *level_exp;
|
char *level_exp;
|
||||||
int from_tty;
|
int from_tty;
|
||||||
{
|
{
|
||||||
register FRAME frame, frame1;
|
register struct frame_info *frame, *frame1;
|
||||||
unsigned int level = 0;
|
unsigned int level = 0;
|
||||||
|
|
||||||
if (!target_has_stack)
|
if (!target_has_stack)
|
||||||
|
@ -1218,7 +1240,7 @@ up_silently_command (count_exp, from_tty)
|
||||||
char *count_exp;
|
char *count_exp;
|
||||||
int from_tty;
|
int from_tty;
|
||||||
{
|
{
|
||||||
register FRAME frame;
|
register struct frame_info *fi;
|
||||||
int count = 1, count1;
|
int count = 1, count1;
|
||||||
if (count_exp)
|
if (count_exp)
|
||||||
count = parse_and_eval_address (count_exp);
|
count = parse_and_eval_address (count_exp);
|
||||||
|
@ -1227,10 +1249,10 @@ up_silently_command (count_exp, from_tty)
|
||||||
if (target_has_stack == 0 || selected_frame == 0)
|
if (target_has_stack == 0 || selected_frame == 0)
|
||||||
error ("No stack.");
|
error ("No stack.");
|
||||||
|
|
||||||
frame = find_relative_frame (selected_frame, &count1);
|
fi = find_relative_frame (selected_frame, &count1);
|
||||||
if (count1 != 0 && count_exp == 0)
|
if (count1 != 0 && count_exp == 0)
|
||||||
error ("Initial frame selected; you cannot go up.");
|
error ("Initial frame selected; you cannot go up.");
|
||||||
select_frame (frame, selected_frame_level + count - count1);
|
select_frame (fi, selected_frame_level + count - count1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1251,7 +1273,7 @@ down_silently_command (count_exp, from_tty)
|
||||||
char *count_exp;
|
char *count_exp;
|
||||||
int from_tty;
|
int from_tty;
|
||||||
{
|
{
|
||||||
register FRAME frame;
|
register struct frame_info *frame;
|
||||||
int count = -1, count1;
|
int count = -1, count1;
|
||||||
if (count_exp)
|
if (count_exp)
|
||||||
count = - parse_and_eval_address (count_exp);
|
count = - parse_and_eval_address (count_exp);
|
||||||
|
@ -1291,23 +1313,32 @@ return_command (retval_exp, from_tty)
|
||||||
int from_tty;
|
int from_tty;
|
||||||
{
|
{
|
||||||
struct symbol *thisfun;
|
struct symbol *thisfun;
|
||||||
FRAME_ADDR selected_frame_addr;
|
CORE_ADDR selected_frame_addr;
|
||||||
CORE_ADDR selected_frame_pc;
|
CORE_ADDR selected_frame_pc;
|
||||||
FRAME frame;
|
struct frame_info *frame;
|
||||||
value_ptr return_value = NULL;
|
value_ptr return_value = NULL;
|
||||||
|
|
||||||
if (selected_frame == NULL)
|
if (selected_frame == NULL)
|
||||||
error ("No selected frame.");
|
error ("No selected frame.");
|
||||||
thisfun = get_frame_function (selected_frame);
|
thisfun = get_frame_function (selected_frame);
|
||||||
selected_frame_addr = FRAME_FP (selected_frame);
|
selected_frame_addr = FRAME_FP (selected_frame);
|
||||||
selected_frame_pc = (get_frame_info (selected_frame))->pc;
|
selected_frame_pc = selected_frame->pc;
|
||||||
|
|
||||||
/* Compute the return value (if any -- possibly getting errors here). */
|
/* Compute the return value (if any -- possibly getting errors here). */
|
||||||
|
|
||||||
if (retval_exp)
|
if (retval_exp)
|
||||||
{
|
{
|
||||||
|
struct type *return_type = NULL;
|
||||||
|
|
||||||
return_value = parse_and_eval (retval_exp);
|
return_value = parse_and_eval (retval_exp);
|
||||||
|
|
||||||
|
/* Cast return value to the return type of the function. */
|
||||||
|
if (thisfun != NULL)
|
||||||
|
return_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (thisfun));
|
||||||
|
if (return_type == NULL)
|
||||||
|
return_type = builtin_type_int;
|
||||||
|
return_value = value_cast (return_type, return_value);
|
||||||
|
|
||||||
/* Make sure we have fully evaluated it, since
|
/* Make sure we have fully evaluated it, since
|
||||||
it might live in the stack frame we're about to pop. */
|
it might live in the stack frame we're about to pop. */
|
||||||
if (VALUE_LAZY (return_value))
|
if (VALUE_LAZY (return_value))
|
||||||
|
@ -1336,8 +1367,8 @@ return_command (retval_exp, from_tty)
|
||||||
a POP_FRAME. The pc comparison makes this work even if the
|
a POP_FRAME. The pc comparison makes this work even if the
|
||||||
selected frame shares its fp with another frame. */
|
selected frame shares its fp with another frame. */
|
||||||
|
|
||||||
while ( selected_frame_addr != FRAME_FP (frame = get_current_frame())
|
while (selected_frame_addr != (frame = get_current_frame())->frame
|
||||||
|| selected_frame_pc != (get_frame_info (frame))->pc )
|
|| selected_frame_pc != frame->pc)
|
||||||
POP_FRAME;
|
POP_FRAME;
|
||||||
|
|
||||||
/* Then pop that frame. */
|
/* Then pop that frame. */
|
||||||
|
@ -1357,18 +1388,17 @@ return_command (retval_exp, from_tty)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Gets the language of the current frame. */
|
/* Gets the language of the current frame. */
|
||||||
|
|
||||||
enum language
|
enum language
|
||||||
get_frame_language()
|
get_frame_language()
|
||||||
{
|
{
|
||||||
register struct symtab *s;
|
register struct symtab *s;
|
||||||
FRAME fr;
|
|
||||||
enum language flang; /* The language of the current frame */
|
enum language flang; /* The language of the current frame */
|
||||||
|
|
||||||
fr = get_frame_info(selected_frame);
|
if (selected_frame)
|
||||||
if(fr)
|
|
||||||
{
|
{
|
||||||
s = find_pc_symtab(fr->pc);
|
s = find_pc_symtab(selected_frame->pc);
|
||||||
if(s)
|
if (s)
|
||||||
flang = s->language;
|
flang = s->language;
|
||||||
else
|
else
|
||||||
flang = language_unknown;
|
flang = language_unknown;
|
||||||
|
|
|
@ -42,6 +42,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef O_BINARY
|
#ifndef O_BINARY
|
||||||
#define O_BINARY 0
|
#define O_BINARY 0
|
||||||
|
@ -312,9 +315,14 @@ entry_point_address()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remember the lowest-addressed loadable section we've seen.
|
/* Remember the lowest-addressed loadable section we've seen.
|
||||||
This function is called via bfd_map_over_sections. */
|
This function is called via bfd_map_over_sections.
|
||||||
|
|
||||||
|
In case of equal vmas, the section with the largest size becomes the
|
||||||
|
lowest-addressed loadable section.
|
||||||
|
|
||||||
|
If the vmas and sizes are equal, the last section is considered the
|
||||||
|
lowest-addressed loadable section. */
|
||||||
|
|
||||||
#if 0 /* Not used yet */
|
|
||||||
static void
|
static void
|
||||||
find_lowest_section (abfd, sect, obj)
|
find_lowest_section (abfd, sect, obj)
|
||||||
bfd *abfd;
|
bfd *abfd;
|
||||||
|
@ -327,10 +335,13 @@ find_lowest_section (abfd, sect, obj)
|
||||||
return;
|
return;
|
||||||
if (!*lowest)
|
if (!*lowest)
|
||||||
*lowest = sect; /* First loadable section */
|
*lowest = sect; /* First loadable section */
|
||||||
else if (bfd_section_vma (abfd, *lowest) >= bfd_section_vma (abfd, sect))
|
else if (bfd_section_vma (abfd, *lowest) > bfd_section_vma (abfd, sect))
|
||||||
*lowest = sect; /* A lower loadable section */
|
*lowest = sect; /* A lower loadable section */
|
||||||
|
else if (bfd_section_vma (abfd, *lowest) == bfd_section_vma (abfd, sect)
|
||||||
|
&& (bfd_section_size (abfd, (*lowest))
|
||||||
|
<= bfd_section_size (abfd, sect)))
|
||||||
|
*lowest = sect;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Process a symbol file, as either the main file or as a dynamically
|
/* Process a symbol file, as either the main file or as a dynamically
|
||||||
loaded file.
|
loaded file.
|
||||||
|
@ -387,8 +398,7 @@ syms_from_objfile (objfile, addr, mainline, verbo)
|
||||||
/* Convert addr into an offset rather than an absolute address.
|
/* Convert addr into an offset rather than an absolute address.
|
||||||
We find the lowest address of a loaded segment in the objfile,
|
We find the lowest address of a loaded segment in the objfile,
|
||||||
and assume that <addr> is where that got loaded. Due to historical
|
and assume that <addr> is where that got loaded. Due to historical
|
||||||
precedent, we warn if that doesn't happen to be the ".text"
|
precedent, we warn if that doesn't happen to be a text segment. */
|
||||||
segment. */
|
|
||||||
|
|
||||||
if (mainline)
|
if (mainline)
|
||||||
{
|
{
|
||||||
|
@ -397,18 +407,15 @@ syms_from_objfile (objfile, addr, mainline, verbo)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lowest_sect = bfd_get_section_by_name (objfile->obfd, ".text");
|
lowest_sect = bfd_get_section_by_name (objfile->obfd, ".text");
|
||||||
#if 0
|
if (lowest_sect == NULL)
|
||||||
lowest_sect = 0;
|
|
||||||
bfd_map_over_sections (objfile->obfd, find_lowest_section,
|
bfd_map_over_sections (objfile->obfd, find_lowest_section,
|
||||||
(PTR) &lowest_sect);
|
(PTR) &lowest_sect);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (lowest_sect == 0)
|
if (lowest_sect == NULL)
|
||||||
warning ("no loadable sections found in added symbol-file %s",
|
warning ("no loadable sections found in added symbol-file %s",
|
||||||
objfile->name);
|
objfile->name);
|
||||||
else if (0 == bfd_get_section_name (objfile->obfd, lowest_sect)
|
else if ((bfd_get_section_flags (objfile->obfd, lowest_sect) & SEC_CODE)
|
||||||
|| !STREQ (".text",
|
== 0)
|
||||||
bfd_get_section_name (objfile->obfd, lowest_sect)))
|
|
||||||
/* FIXME-32x64--assumes bfd_vma fits in long. */
|
/* FIXME-32x64--assumes bfd_vma fits in long. */
|
||||||
warning ("Lowest section in %s is %s at 0x%lx",
|
warning ("Lowest section in %s is %s at 0x%lx",
|
||||||
objfile->name,
|
objfile->name,
|
||||||
|
@ -794,6 +801,9 @@ symfile_bfd_open (name)
|
||||||
|
|
||||||
if (!bfd_check_format (sym_bfd, bfd_object))
|
if (!bfd_check_format (sym_bfd, bfd_object))
|
||||||
{
|
{
|
||||||
|
/* FIXME: should be checking for errors from bfd_close (for one thing,
|
||||||
|
on error it does not free all the storage associated with the
|
||||||
|
bfd). */
|
||||||
bfd_close (sym_bfd); /* This also closes desc */
|
bfd_close (sym_bfd); /* This also closes desc */
|
||||||
make_cleanup (free, name);
|
make_cleanup (free, name);
|
||||||
error ("\"%s\": can't read symbols: %s.", name,
|
error ("\"%s\": can't read symbols: %s.", name,
|
||||||
|
@ -885,6 +895,9 @@ generic_load (filename, from_tty)
|
||||||
perror_with_name (filename);
|
perror_with_name (filename);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
/* FIXME: should be checking for errors from bfd_close (for one thing,
|
||||||
|
on error it does not free all the storage associated with the
|
||||||
|
bfd). */
|
||||||
old_cleanups = make_cleanup (bfd_close, loadfile_bfd);
|
old_cleanups = make_cleanup (bfd_close, loadfile_bfd);
|
||||||
|
|
||||||
if (!bfd_check_format (loadfile_bfd, bfd_object))
|
if (!bfd_check_format (loadfile_bfd, bfd_object))
|
||||||
|
@ -1107,7 +1120,8 @@ reread_symbols ()
|
||||||
BFD without closing the descriptor. */
|
BFD without closing the descriptor. */
|
||||||
obfd_filename = bfd_get_filename (objfile->obfd);
|
obfd_filename = bfd_get_filename (objfile->obfd);
|
||||||
if (!bfd_close (objfile->obfd))
|
if (!bfd_close (objfile->obfd))
|
||||||
error ("Can't close BFD for %s.", objfile->name);
|
error ("Can't close BFD for %s: %s", objfile->name,
|
||||||
|
bfd_errmsg (bfd_get_error ()));
|
||||||
objfile->obfd = bfd_openr (obfd_filename, gnutarget);
|
objfile->obfd = bfd_openr (obfd_filename, gnutarget);
|
||||||
if (objfile->obfd == NULL)
|
if (objfile->obfd == NULL)
|
||||||
error ("Can't open %s to read symbols.", objfile->name);
|
error ("Can't open %s to read symbols.", objfile->name);
|
||||||
|
@ -1239,7 +1253,7 @@ deduce_language_from_filename (filename)
|
||||||
else if (STREQ (c, ".c"))
|
else if (STREQ (c, ".c"))
|
||||||
return language_c;
|
return language_c;
|
||||||
else if (STREQ (c, ".cc") || STREQ (c, ".C") || STREQ (c, ".cxx")
|
else if (STREQ (c, ".cc") || STREQ (c, ".C") || STREQ (c, ".cxx")
|
||||||
|| STREQ (c, ".cpp") || STREQ (c, ".cp"))
|
|| STREQ (c, ".cpp") || STREQ (c, ".cp") || STREQ (c, ".c++"))
|
||||||
return language_cplus;
|
return language_cplus;
|
||||||
else if (STREQ (c, ".ch") || STREQ (c, ".c186") || STREQ (c, ".c286"))
|
else if (STREQ (c, ".ch") || STREQ (c, ".c186") || STREQ (c, ".c286"))
|
||||||
return language_chill;
|
return language_chill;
|
||||||
|
@ -1650,6 +1664,39 @@ add_psymbol_addr_to_list (name, namelength, namespace, class, list, val,
|
||||||
|
|
||||||
#endif /* !INLINE_ADD_PSYMBOL */
|
#endif /* !INLINE_ADD_PSYMBOL */
|
||||||
|
|
||||||
|
/* Initialize storage for partial symbols. */
|
||||||
|
|
||||||
|
void
|
||||||
|
init_psymbol_list (objfile, total_symbols)
|
||||||
|
struct objfile *objfile;
|
||||||
|
int total_symbols;
|
||||||
|
{
|
||||||
|
/* Free any previously allocated psymbol lists. */
|
||||||
|
|
||||||
|
if (objfile -> global_psymbols.list)
|
||||||
|
{
|
||||||
|
mfree (objfile -> md, (PTR)objfile -> global_psymbols.list);
|
||||||
|
}
|
||||||
|
if (objfile -> static_psymbols.list)
|
||||||
|
{
|
||||||
|
mfree (objfile -> md, (PTR)objfile -> static_psymbols.list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Current best guess is that approximately a twentieth
|
||||||
|
of the total symbols (in a debugging file) are global or static
|
||||||
|
oriented symbols */
|
||||||
|
|
||||||
|
objfile -> global_psymbols.size = total_symbols / 10;
|
||||||
|
objfile -> static_psymbols.size = total_symbols / 10;
|
||||||
|
objfile -> global_psymbols.next =
|
||||||
|
objfile -> global_psymbols.list = (struct partial_symbol *)
|
||||||
|
xmmalloc (objfile -> md, objfile -> global_psymbols.size
|
||||||
|
* sizeof (struct partial_symbol));
|
||||||
|
objfile -> static_psymbols.next =
|
||||||
|
objfile -> static_psymbols.list = (struct partial_symbol *)
|
||||||
|
xmmalloc (objfile -> md, objfile -> static_psymbols.size
|
||||||
|
* sizeof (struct partial_symbol));
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_initialize_symfile ()
|
_initialize_symfile ()
|
||||||
|
|
|
@ -43,8 +43,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#undef savestring
|
#undef savestring
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#ifdef USG
|
#ifdef HAVE_UNISTD_H
|
||||||
/* What is this for? X_OK? */
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
13
gdb/utils.c
13
gdb/utils.c
|
@ -30,6 +30,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#endif
|
#endif
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "signals.h"
|
#include "signals.h"
|
||||||
#include "gdbcmd.h"
|
#include "gdbcmd.h"
|
||||||
|
@ -304,27 +307,31 @@ error_begin ()
|
||||||
NORETURN void
|
NORETURN void
|
||||||
error (char *string, ...)
|
error (char *string, ...)
|
||||||
#else
|
#else
|
||||||
|
void
|
||||||
error (va_alist)
|
error (va_alist)
|
||||||
va_dcl
|
va_dcl
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifdef ANSI_PROTOTYPES
|
|
||||||
va_list args;
|
va_list args;
|
||||||
|
#ifdef ANSI_PROTOTYPES
|
||||||
va_start (args, string);
|
va_start (args, string);
|
||||||
#else
|
#else
|
||||||
va_start (args);
|
va_start (args);
|
||||||
#endif
|
#endif
|
||||||
if (error_hook)
|
if (error_hook)
|
||||||
error_hook();
|
(*error_hook) ();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char *string1;
|
|
||||||
error_begin ();
|
error_begin ();
|
||||||
#ifdef ANSI_PROTOTYPES
|
#ifdef ANSI_PROTOTYPES
|
||||||
vfprintf_filtered (gdb_stderr, string, args);
|
vfprintf_filtered (gdb_stderr, string, args);
|
||||||
#else
|
#else
|
||||||
|
{
|
||||||
|
char *string1;
|
||||||
|
|
||||||
string1 = va_arg (args, char *);
|
string1 = va_arg (args, char *);
|
||||||
vfprintf_filtered (gdb_stderr, string1, args);
|
vfprintf_filtered (gdb_stderr, string1, args);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
fprintf_filtered (gdb_stderr, "\n");
|
fprintf_filtered (gdb_stderr, "\n");
|
||||||
va_end (args);
|
va_end (args);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue