aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog1263
-rw-r--r--gdb/MAINTAINERS19
-rw-r--r--gdb/Makefile.in154
-rw-r--r--gdb/ada-exp.y102
-rw-r--r--gdb/ada-lang.c2406
-rw-r--r--gdb/ada-lang.h20
-rw-r--r--gdb/ada-lex.l36
-rw-r--r--gdb/ada-typeprint.c6
-rw-r--r--gdb/ada-valprint.c6
-rw-r--r--gdb/aix-thread.c10
-rw-r--r--gdb/alphanbsd-tdep.c2
-rw-r--r--gdb/amd64-nat.h7
-rw-r--r--gdb/amd64bsd-nat.c24
-rw-r--r--gdb/amd64fbsd-nat.c16
-rw-r--r--gdb/amd64nbsd-nat.c4
-rw-r--r--gdb/amd64obsd-nat.c4
-rw-r--r--gdb/breakpoint.c3
-rw-r--r--gdb/bsd-kvm.c2
-rw-r--r--gdb/config.in3
-rw-r--r--gdb/config/alpha/alpha-linux.mh4
-rw-r--r--gdb/config/arm/linux.mh4
-rw-r--r--gdb/config/djgpp/fnchange.lst2
-rw-r--r--gdb/config/frv/tm-frv.h9
-rw-r--r--gdb/config/i386/fbsd.mh6
-rw-r--r--gdb/config/i386/fbsd64.mh7
-rw-r--r--gdb/config/i386/linux.mh4
-rw-r--r--gdb/config/i386/linux64.mh2
-rw-r--r--gdb/config/i386/nbsd64.mh3
-rw-r--r--gdb/config/i386/nbsdaout.mh7
-rw-r--r--gdb/config/i386/nbsdelf.mh4
-rw-r--r--gdb/config/i386/nm-fbsd.h71
-rw-r--r--gdb/config/i386/nm-fbsd64.h (renamed from gdb/i386bsd-nat.h)17
-rw-r--r--gdb/config/i386/nm-i386.h14
-rw-r--r--gdb/config/i386/nm-linux.h2
-rw-r--r--gdb/config/i386/nm-nbsdaout.h (renamed from gdb/config/m32r/nm-linux.h)18
-rw-r--r--gdb/config/i386/nm-obsd.h65
-rw-r--r--gdb/config/i386/obsd.mh3
-rw-r--r--gdb/config/i386/obsd64.mh3
-rw-r--r--gdb/config/i386/obsdaout.mh5
-rw-r--r--gdb/config/ia64/linux.mh4
-rw-r--r--gdb/config/ia64/nm-linux.h8
-rw-r--r--gdb/config/m32r/linux.mh8
-rw-r--r--gdb/config/m32r/linux.mt6
-rw-r--r--gdb/config/m68k/linux.mh4
-rw-r--r--gdb/config/m88k/obsd.mh3
-rw-r--r--gdb/config/mips/linux.mh2
-rw-r--r--gdb/config/nm-linux.h2
-rw-r--r--gdb/config/nm-lynx.h2
-rw-r--r--gdb/config/pa/hpux1020.mh2
-rw-r--r--gdb/config/pa/hpux11.mh2
-rw-r--r--gdb/config/pa/hpux11w.mh2
-rw-r--r--gdb/config/pa/linux.mh4
-rw-r--r--gdb/config/powerpc/linux.mh4
-rw-r--r--gdb/config/powerpc/nbsd.mh2
-rw-r--r--gdb/config/powerpc/ppc64-linux.mh4
-rw-r--r--gdb/config/s390/s390.mh2
-rw-r--r--gdb/config/sparc/fbsd.mh2
-rw-r--r--gdb/config/sparc/linux.mh6
-rw-r--r--gdb/config/sparc/linux64.mh6
-rw-r--r--gdb/config/sparc/nbsd64.mh4
-rw-r--r--gdb/config/sparc/nbsd64.mt2
-rw-r--r--gdb/config/sparc/nbsdaout.mh8
-rw-r--r--gdb/config/sparc/nbsdelf.mh4
-rw-r--r--gdb/config/sparc/obsd.mt2
-rw-r--r--gdb/config/sparc/obsd64.mt2
-rw-r--r--gdb/config/vax/nbsdaout.mh3
-rw-r--r--gdb/config/vax/nbsdelf.mh4
-rw-r--r--gdb/config/vax/obsd.mh4
-rwxr-xr-xgdb/configure1237
-rw-r--r--gdb/configure.in119
-rw-r--r--gdb/configure.tgt13
-rw-r--r--gdb/corelow.c10
-rw-r--r--gdb/cris-tdep.c726
-rw-r--r--gdb/defs.h18
-rw-r--r--gdb/doc/ChangeLog132
-rw-r--r--gdb/doc/gdb.texinfo551
-rw-r--r--gdb/doc/gdbint.texinfo269
-rw-r--r--gdb/doc/stabs.texinfo30
-rw-r--r--gdb/dwarf2read.c1382
-rw-r--r--gdb/event-top.c4
-rw-r--r--gdb/exec.c2
-rw-r--r--gdb/fbsd-nat.h43
-rw-r--r--gdb/fbsd-proc.c (renamed from gdb/fbsd-nat.c)38
-rw-r--r--gdb/fork-child.c203
-rw-r--r--gdb/frv-tdep.c21
-rwxr-xr-xgdb/gdb_indent.sh1
-rw-r--r--gdb/gdb_thread_db.h2
-rw-r--r--gdb/gdbcmd.h8
-rw-r--r--gdb/gdbserver/ChangeLog29
-rw-r--r--gdb/gdbserver/Makefile.in5
-rwxr-xr-xgdb/gdbserver/configure23
-rw-r--r--gdb/gdbserver/configure.in7
-rw-r--r--gdb/gdbserver/linux-i386-low.c38
-rw-r--r--gdb/gdbserver/linux-low.c52
-rw-r--r--gdb/gdbserver/linux-x86-64-low.c43
-rw-r--r--gdb/gdbserver/proc-service.c107
-rw-r--r--gdb/gdbserver/remote-utils.c54
-rw-r--r--gdb/gdbserver/thread-db.c26
-rw-r--r--gdb/gdbtypes.h11
-rw-r--r--gdb/gnu-nat.c2
-rw-r--r--gdb/go32-nat.c2
-rw-r--r--gdb/hppa-tdep.c5
-rw-r--r--gdb/hppah-nat.c16
-rw-r--r--gdb/hpux-thread.c46
-rw-r--r--gdb/i386-nat.c22
-rw-r--r--gdb/i386-tdep.c12
-rw-r--r--gdb/i386bsd-nat.c24
-rw-r--r--gdb/i386fbsd-nat.c28
-rw-r--r--gdb/i386gnu-nat.c23
-rw-r--r--gdb/i386nbsd-nat.c5
-rw-r--r--gdb/ia64-linux-nat.c27
-rw-r--r--gdb/inf-child.c20
-rw-r--r--gdb/inf-ptrace.c286
-rw-r--r--gdb/infcall.c2
-rw-r--r--gdb/infptrace.c26
-rw-r--r--gdb/infrun.c96
-rw-r--r--gdb/inftarg.c152
-rw-r--r--gdb/infttrace.c17
-rw-r--r--gdb/jv-exp.y17
-rw-r--r--gdb/language.c2
-rw-r--r--gdb/lin-lwp.c1971
-rw-r--r--gdb/linux-nat.c2611
-rw-r--r--gdb/linux-proc.c737
-rw-r--r--gdb/m32r-linux-nat.c235
-rw-r--r--gdb/m32r-linux-tdep.c336
-rw-r--r--gdb/m32r-tdep.c193
-rw-r--r--gdb/m32r-tdep.h52
-rw-r--r--gdb/m88kbsd-nat.c25
-rw-r--r--gdb/maint.c4
-rw-r--r--gdb/minsyms.c10
-rw-r--r--gdb/mips-tdep.c1378
-rw-r--r--gdb/monitor.c2
-rw-r--r--gdb/nto-procfs.c2
-rw-r--r--gdb/objfiles.c4
-rw-r--r--gdb/ppc-bdm.c2
-rw-r--r--gdb/procfs.c10
-rw-r--r--gdb/regcache.c4
-rw-r--r--gdb/remote-e7000.c2
-rw-r--r--gdb/remote-m32r-sdi.c17
-rw-r--r--gdb/remote-mips.c2
-rw-r--r--gdb/remote-rdi.c2
-rw-r--r--gdb/remote-rdp.c2
-rw-r--r--gdb/remote-sds.c2
-rw-r--r--gdb/remote-sim.c2
-rw-r--r--gdb/remote-st.c2
-rw-r--r--gdb/remote-vx.c4
-rw-r--r--gdb/remote.c123
-rw-r--r--gdb/rs6000-nat.c8
-rw-r--r--gdb/rs6000-tdep.c42
-rw-r--r--gdb/sh-tdep.c427
-rw-r--r--gdb/sh-tdep.h20
-rw-r--r--gdb/sol-thread.c20
-rw-r--r--gdb/solib-sunos.c54
-rw-r--r--gdb/source.c12
-rw-r--r--gdb/sparc-linux-tdep.c75
-rw-r--r--gdb/sparc-nat.c15
-rw-r--r--gdb/sparc-nat.h7
-rw-r--r--gdb/sparc64-linux-tdep.c36
-rw-r--r--gdb/sparc64nbsd-nat.c4
-rw-r--r--gdb/sparc64nbsd-tdep.c6
-rw-r--r--gdb/sparc64obsd-tdep.c7
-rw-r--r--gdb/sparcnbsd-nat.c5
-rw-r--r--gdb/symfile.c4
-rw-r--r--gdb/symtab.c85
-rw-r--r--gdb/target.c303
-rw-r--r--gdb/target.h42
-rw-r--r--gdb/testsuite/ChangeLog96
-rw-r--r--gdb/testsuite/Makefile.in1
-rw-r--r--gdb/testsuite/config/gdbserver.exp2
-rwxr-xr-xgdb/testsuite/configure8
-rw-r--r--gdb/testsuite/configure.in4
-rw-r--r--gdb/testsuite/gdb.asm/asm-source.exp3
-rw-r--r--gdb/testsuite/gdb.asm/m32r-linux.inc34
-rw-r--r--gdb/testsuite/gdb.base/bigcore.c74
-rw-r--r--gdb/testsuite/gdb.base/bigcore.exp132
-rw-r--r--gdb/testsuite/gdb.base/constvars.exp28
-rw-r--r--gdb/testsuite/gdb.base/overlays.exp7
-rw-r--r--gdb/testsuite/gdb.base/sigstep.exp12
-rw-r--r--gdb/testsuite/gdb.base/volatile.exp22
-rw-r--r--gdb/testsuite/gdb.dwarf2/Makefile.in38
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-basic.S201
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-basic.exp53
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-intercu.S236
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-intercu.exp53
-rw-r--r--gdb/testsuite/gdb.dwarf2/file1.txt8
-rw-r--r--gdb/testsuite/gdb.dwarf2/main.c26
-rw-r--r--gdb/testsuite/gdb.java/jprint.exp80
-rw-r--r--gdb/testsuite/gdb.java/jprint.java62
-rw-r--r--gdb/testsuite/gdb.mi/gdb701.c2
-rw-r--r--gdb/testsuite/gdb.threads/bp_in_thread.exp7
-rw-r--r--gdb/testsuite/gdb.threads/pthread_cond_wait.exp7
-rw-r--r--gdb/testsuite/gdb.threads/watchthreads.c66
-rw-r--r--gdb/testsuite/gdb.threads/watchthreads.exp13
-rw-r--r--gdb/thread-db.c6
-rw-r--r--gdb/top.c4
-rw-r--r--gdb/tui/tui-wingeneral.c4
-rw-r--r--gdb/utils.c15
-rw-r--r--gdb/uw-thread.c34
-rw-r--r--gdb/v850ice.c2
-rw-r--r--gdb/valarith.c5
-rw-r--r--gdb/vaxbsd-nat.c17
-rw-r--r--gdb/version.in2
-rw-r--r--gdb/win32-nat.c87
-rw-r--r--gdb/wince.c82
-rw-r--r--gdb/xstormy16-tdep.c1039
205 files changed, 9678 insertions, 12279 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5ddba9e..7043f68 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,1266 +1,3 @@
-2004-10-15 Joel Brobecker <brobecker@gnat.com>
-
- * dwarf2read.c (set_cu_language): Set language to Ada for
- DW_LANG_Ada83 and DW_LANG_Ada95.
-
-2004-10-15 Michael Chastain <mec.gnu@mindspring.com>
-
- From Andreas Schwab <schwab@suse.de>:
- * Makefile.in (.y.c, .l.c.): Fix the substitutions for
- for xmalloc and xrealloc.
-
-2004-10-15 Andrew Cagney <cagney@gnu.org>
-
- * ada-exp.y, ada-lex.l: Use xmalloc and xrealloc through out.
- * inf-ptrace.c: Include "gdb_wait.h" instead of <wait.h>.
- * Makefile.in (.y.c, .l.c): Don't replace xmalloc with xxmalloc.
- Update dependencies.
-
-2004-10-15 Paul Hilfinger <Hilfinger@gnat.com>
-
- * ada-lang.c (ada_lookup_symbol): Correct comment.
- (ada_evaluate_subexp): Change error message for
- OP_FUNCALL case so as not to indicate an internal error.
-
-2004-10-15 Joel Brobecker <brobecker@gnat.com>
-
- Committed by Paul Hilfinger.
- * ada-lang.c (ada_template_to_fixed_record_type_1): Detect bogus
- type sizes in XVE/XVU types, and emit a warning when that happens,
- instead of rounding up the size of the resulting type.
- Some minor reformatting.
- (ada_is_aligner_type): Do not consider a type as an aligner type
- if there is a corresponding XVS type as well.
- (ada_evaluate_subexp): For TERNOP_SLICE, handle cases where we
- have several levels of pointer indirection to the array.
-
-2004-10-15 Jerome Guitton <guitton@gnat.com>
-
- Committed by Paul Hilfinger.
- * ada-lang.c (check_size): New function.
- (coerce_unspec_val_to_type): call check_size to make sure
- that the object size is reasonable.
- (ada_evaluate_subexp): in UNOP_IND: Ditto. In TERNOP_SLICE:
- Implements the case when we get a reference when we evaluate
- the expression of one of the bounds of the slice.
- (ada_value_struct_elt): when a packed array field is
- a reference, use ada_coerce_ref to dereference it; use
- ada_value_ind only if it is a pointer.
-
-2004-10-15 Joel Brobecker <brobecker@gnat.com>
-
- * mips-tdep.c (mips32_scan_prologue): Move the implementation up
- a bit to avoid the necessity of an advance declaration. Remove
- declaration.
- (set_reg_offset): Move implemenation up.
- (mips16_get_imm): Likewise.
- (mips16_scan_prologue): Likewise.
- (reset_saved_regs): Likewise.
- (mips32_scan_prologue): Likewise.
-
-2004-10-14 Joel Brobecker <brobecker@gnat.com>
-
- * mips-tdep.c (mips32_scan_prologue): Add advance declaration.
- Remove sp as a parameter, compute it internally instead. Move
- prologue scanning limit from heuristic_proc_desc to here.
- (mips16_scan_prologue): Likewise.
- (mips_insn16_frame_cache): Replace call to heuristic_proc_desc
- by call to mips16_scan_prologue.
- (mips_insn32_frame_cache): Replace call to heuristic_proc_desc
- by call to mips32_scan_prologue.
- (heuristic_proc_desc): Remove code that's no longer necessary.
- Update calls to mips16_scan_prologue and mips32_scan_prologue.
- (mips_skip_prologue): Update calls to mips16_scan_prologue
- and mips32_scan_prologue.
-
-2004-10-14 Joel Brobecker <brobecker@gnat.com>
-
- * mips-tdep.c (mips16_scan_prologue): Merge code from
- mips16_skip_prologue. Now return the address of the first
- instruction past the function prologue.
- (mips16_skip_prologue): Remove, no longer necessary.
- (mips_skip_prologue): Replace call to mips16_skip_prologue
- by call to mips16_scan_prologue.
-
-2004-10-14 Joel Brobecker <brobecker@gnat.com>
-
- * mips-tdep.c (mips32_scan_prologue): Merge code from
- mips32_skip_prologue. Now return the address of the first
- instruction past the function prologue.
- (mips32_skip_prologue): Remove. No longer necessary.
- (mips16_skip_prologue): Add parameter end_pc instead of
- computing it.
- (mips_skip_prologue): Compute the upper limit for the
- prologue scanning. Update call to mips16_skip_prologue.
- Replace call to mips32_skip_prologue by call to
- mips32_scan_prologue.
-
-2004-10-14 Mark Kettenis <kettenis@gnu.org>
-
- * hppa-tdep.c (hppa_frame_cache): Add support for OpenBSD and
- NetBSD system call stubs that store %rp in the ERP slot of the
- stack frame.
-
- * source.c: Always define O_BINARY to 0 if not defined already.
- (openp): Unconditionally use O_BINARY.
-
- * top.c (gdb_readline): Always accept "\r\n" as a line-ending.
- * event-top.c (gdb_readline2): Likewise.
-
-2004-10-14 Orjan Friberg <orjanf@axis.com>
-
- * cris-tdep.c (_initialize_cris_tdep): Re-add call to
- deprecated_add_core_fns which was removed by mistake.
-
-2004-10-13 Kevin Buettner <kevinb@redhat.com>
-
- * ia64-linux-nat.c (fill_gregset, fill_fpregset): Replace
- references to deprecated_registers[] with equivalent code.
-
-2004-10-13 Kevin Buettner <kevinb@redhat.com>
-
- * rs6000-tdep.c (rs6000_push_dummy_call): Replace references to
- ``deprecated_registers'' with equivalent code. Use gdb_assert()
- instead of explicit test and print statement.
-
-2004-10-12 Mark Kettenis <kettenis@gnu.org>
-
- * sparc-nat.c: Include "inf-ptrace.h".
- (sparc_target): New function.
- * sparc-nat.h: Update copyright year.
- (sparc_target): New prototype.
- * sparcnbsd-nat.c: Don't include "gdbcore.h", include "target.h".
- (_initialize_sparcnbsd_nat): Construct and add target vector.
- * sparc64nbsd-nat.c: Include "target.h".
- (_initialize_sparc64nbsd_nat): Construct and add target vector.
- * Makefile.in (sparc-nat.o, sparcnbsd-nat.o, sparc64nbsd-nat.o):
- Update dependencies.
- * config/sparc/nbsd64.mh (NATDEPFILES): Remove infptrace.o and
- inftarg.o, add inf-ptrace.o.
- * config/sparc/nbsdaout.mh (NATDEPFILES): Remove infptrace.o and
- inftarg.o, add inf-ptrace.o and bsd-kvm.o.
- (NAT_FILE): Set to nm-bsd.h.
- (LOADLIBES): New variable.
- * config/sparc/nbsdelf.mh (NATDEPFILES): Remove infptrace.o and
- infarg.o, add inf-ptrace.o.
- * config/sparc/nm-nbsdaout.h: Remove file.
- * config/sparc/fbsd.mh (NATDEPFILES): Add inf-ptrace.o.
- * config/sparc/linux.mh (NATDEPFILES): Add inf-ptrace.o.
- * config/sparc/linux64.mh (NATDEPFILES): Add inf-ptrace.o.
-
- * defs.h [!FOPEN_RB]: Include "fopen-bin.h" instead of
- "fopen-same.h". Update comment.
-
-2004-10-11 Mark Kettenis <kettenis@gnu.org>
-
- * i386gnu-nat.c: Include "gdb_string.h".
- (fetch_fpregs): Use i387_supply_fxsave to fill the floating-point
- registers when the floating-point state isn't initialized.
- * Makefile.in (i386gnu-nat.o): Update dependencies.
-
-2004-10-11 David Anderson <davea@sgi.com>
-
- * regcache.c (regcache_raw_read): Comment was missing "to".
- Extraneous ' removed.
- * gdb_thread_db.h (struct td_thrinfo): ti_lid field
- comment now describes use.
-
-2004-10-11 Orjan Friberg <orjanf@axis.com>
-
- * cris-tdep.c (cris_sigtramp_start, cris_rt_sigtramp_start)
- (cris_sigcontext_addr, cris_sigtramp_frame_unwind_cache)
- (cris_sigtramp_frame_this_id, cris_sigtramp_frame_prev_register)
- (cris_sigtramp_frame_sniffer): New functions.
- (cris_gdbarch_init): Hook in signal trampoline unwinder.
- (cris_dwarf2_reg_to_regnum, cris_dwarf2_frame_init_reg): New functions.
- (cris_gdbarch_init): Hook in Dwarf-2 unwinder.
- (struct gdbarch_tdep, set_cris_dwarf2_cfi, cris_dump_tdep)
- (cris_gdbarch_init, _initialize_cris_tdep): Add CRIS Dwarf-2 CFI usage
- command.
- (cris_version_update): Remove, replace with ...
- (set_cris_version): New function.
- (struct gdbarch_tdep, cris_mode, cris_mode_update)
- (cris_cannot_store_register, cris_dump_tdep, cris_gdbarch_init)
- (_initialize_cris_tdep): Remove CRIS mode command.
- (cris_fpless_backtrace, _initialize_cris_tdep): Remove
- cris-fpless-backtrace command.
- (cris_scan_prologue): Fix prologue scanning limit.
- (cris_register_type): Update to reflect actual registers.
- (cris_register_bytes_ok) Remove.
- (cris_gdbarch_init): Remove support for CRIS v8 and v9.
- Remove set_gdbarch_deprecated_register_size,
- set_gdbarch_deprecated_register_byte, set_gdbarch_register_bytes_ok.
-
-2004-10-10 Andrew Cagney <cagney@gnu.org>
-
- * ada-lang.c (lim_warning): Add ATTR_FORMAT prototype and FIXME
- comment.
-
-2004-10-10 Joel Brobecker <brobecker@gnat.com>
-
- * mips-tdep.c (mips16_scan_prologue): Remove redundant code.
-
-2004-10-10 Joel Brobecker <brobecker@gnat.com>
-
- * mips-tdep.c (mips16_scan_prologue): Renames
- mips16_heuristic_proc_desc. Update comment.
- (mips32_scan_prologue): Renames mips32_heuristic_proc_desc.
- (heuristic_proc_desc): Update calls to the 2 functions above.
-
-2004-10-10 Joel Brobecker <brobecker@gnat.com>
-
- * mips-tdep.c (mips_insn16_frame_cache): Remove unused variables.
- Update comments. Also immediately return empty cache when the start
- address of our function could not be found.
- (mips_insn32_frame_cache): Likewise.
-
-2004-10-10 Joel Brobecker <brobecker@gnat.com>
-
- * mips-tdep.c (mips16_decode_reg_save): Delete, no longer used.
- (mips_insn16_frame_cache): Pass frame cache in call to
- heuristic_proc_desc. Move some code to mips16_heuristic_proc_desc.
- Remove code that became redundant as a consequence.
- (mips32_heuristic_proc_desc): No longer compute a fake
- procedure descriptor. Compute the full frame cache instead.
- Some minor comment reformatting.
-
-2004-10-10 Jim Blandy <jimb@redhat.com>
-
- * MAINTAINERS (generic symtabs, dwarf readers, elf reader, stabs
- reader, tracing bytecode stuff): Remove self.
-
-2004-10-10 Mark Kettenis <kettenis@gnu.org>
-
- * sparc64-linux-tdep.c: Update copyright year. Don't include
- "solib-svr4.h".
- (sparc64_linux_svr4_fetch_link_map_offsets): Remove function.
- (sparc64_linux_init_abi): Don't set solib_svr4_link_map_offsets.
- * Makefile.in (sparc64-linux-tdep.o): Update dependencies.
-
- * sparc-linux-tdep.c: Update copyright year.
- (sparc_linux_sigtramp_start): Change first argument from CORE_ADDR
- to struct frame_info *. Use safe_frame_unwind_memory instead of
- deprecated_read_memory_nobpt.
- (sparc32_linux_sigtramp_start, sparc32_linux_rt_sigtramp_start):
- Change argumen from CORE_ADDR to struct frame_info *. Adjust for
- changed signature of sparc_linux_sigtramp_start.
- (sparc32_linux_pc_in_sigtramp): Remove function.
- (sparc32_linux_sigtramp_p): New function.
- (sparc32_linux_sigtramp_frame_sniffer): Use
- sparc32_linux_sigtramp_p instead of sparc32_linux_pc_in_sigtramp.
-
- * sparc-linux-tdep.c (sparc32_linux_svr4_fetch_link_map_offsets):
- Remove function.
- (sparc32_linux_init_abi): Don't set solib_svr4_link_map_offsets.
-
- * ada-lang.c (lim_warning): Re-implement as a varargs function.
- (decode_packed_array_type, value_subscript_packed)
- (ada_evaluate_subexp, to_fixed_range_type): Remove redundant
- argument in call to lim_warning.
-
- * configure.in: Really disable the TUI if an enhanced curses
- library isn't found.
- * configure: Regenerate.
-
-2004-10-09 Mark Kettenis <kettenis@gnu.org>
-
- * config/i386/nbsdaout.mh (NAT_FILE): Set to solib.h.
- * config/i386/nbsdelf.mh (NAT_FILE): Set to solib.h.
- * config/i386/nm-nbsdaout.h: Remove file.
- * config/i386/nm-fbsd.h (link_object, lo_name, lo_library)
- (lo_unused, lo_major, lo_minor, lo_next, link_map, lm_addr)
- (lm_name, lm_next, lm_lop, lm_lob, lm_rwt, lm_ld, lm_lpd)
- (link_dynamic_2, ld_loaded, ld_need, ld_rules, ld_got, ld_plt)
- (ld_rel, ld_hash, ld_stab, ld_stab_hash, ld_buckets, ld_symbols)
- (ld_symb_size, ld_text, ld_plt_sz, rtc_symb, rtc_sp, rtc_next)
- (ld_debug, ldd_version, ldd_in_debugger, ldd_sym_loaded)
- (ldd_bp_addr, ldd_bp_inst, ldd_cp, link_dynamic, ld_version)
- (ldd, ld_un, ld_2): Remove defines.
- * config/i386/nm-obsd.h: Likewise.
-
-2004-10-09 Paul Hilfinger <hilfingr@nile.gnat.com>
-
- * ada-lex.l: Remove useless rule whose right-context clause
- causes unreferenced static function warning for yyrealloc.
- (ada_flex_use): Remove the artificial reference to yyrealloc.
-
-2004-10-08 Andrew Cagney <cagney@gnu.org>
-
- * target.h (struct target_ops): Rename to_xfer_memory to
- deprecated_xfer_memory.
- * target.c: Update.
- (deprecated_debug_xfer_memory): Rename debug_to_xfer_memory.
- * wince.c: Update.
- * win32-nat.c: Update.
- * v850ice.c: Update.
- * uw-thread.c: Update.
- * thread-db.c: Update.
- * sol-thread.c: Update.
- * remote.c: Update.
- * remote-vx.c: Update.
- * remote-st.c: Update.
- * remote-sim.c: Update.
- * remote-sds.c: Update.
- * remote-rdp.c: Update.
- * remote-rdi.c: Update.
- * remote-mips.c: Update.
- * remote-m32r-sdi.c: Update.
- * remote-e7000.c: Update.
- * procfs.c: Update.
- * ppc-bdm.c: Update.
- * nto-procfs.c: Update.
- * monitor.c: Update.
- * linux-nat.c: Update.
- * inftarg.c: Update.
- * hpux-thread.c: Update.
- * go32-nat.c: Update.
- * gnu-nat.c: Update.
- * exec.c: Update.
- * corelow.c: Update.
- * bsd-kvm.c: Update.
- * aix-thread.c: Update.
-
-2004-10-08 Andrew Cagney <cagney@gnu.org>
-
- * target.c (debug_target): Move to near start of file.
- (target_stopped_data_address_p): Re-org logic, add casts.
-
-2004-10-02 Mark Kettenis <kettenis@gnu.org>
-
- * solib-sunos.c [HAVE_STRUCT_SO_MAP_WITH_SOM_MEMBERS] (link_map)
- (lm_addr, lm_name, lm_next, link_dynamic_2, ld_loaded, rtc_symb)
- (rtc_sp, rtc_next, ld_debug, ldd_in_debugger, ldd_bp_addr)
- (ldd_bp_inst, ldd_cp, link_dynamic, ld_version, ldd, ld_un, ld_2):
- New defines.
-
-2004-10-08 Jeff Johnston <jjohnstn@redhat.com>
-
- * target.h (to_stopped_data_address): Change prototype to
- take a CORE_ADDR pointer and return an int.
- * target.c (update_current_target): Change to_stopped_data_address
- to match new prototype.
- (debug_to_stopped_data_address): Change appropriately.
- * breakpoint.c (bpstat_stop_status): Change call to
- target_stopped_data_address to use new prototype.
- * frv-tdep.c (frv_have_stopped_data_address): New function.
- (frv_stopped_data_address): Change to new prototype and
- functionality.
- * ia64-linux-nat.c (ia64_stopped_data_address): Change to new
- prototype and functionality.
- (ia64_stopped_by_watchpoint): New function.
- * i386-nat.c (i386_stopped_data_address): Change to new
- prototype and functionality.
- (i386_stopped_by_watchpoint): New function.
- * remote.c (remote_stopped_data_address): Change to new prototype
- and functionality.
- * remote-m32r-sdi.c (m32r_stopped_data_address): Ditto.
- * config/frv/tm-frv.h (frv_stopped_data_address): Change prototype.
- (STOPPED_BY_WATCHPOINT): Change to use frv_have_stopped_data_address.
- * config/i386/nm-i386.h (STOPPED_BY_WATCHPOINT): Change to use
- new i386_stopped_by_watchpoint function.
- (i386_stopped_by_watchpoint): New prototype.
- (i386_stoppped_data_address): Change to new prototype.
- * config/ia64/nm-linux.h (STOPPED_BY_WATCHPOINT): Change to use
- new ia64_stopped_by_watchpoint function.
- (ia64_stopped_by_watchpoint): New prototype.
- (ia64_stopped_data_address): Ditto.
-
-2004-10-08 Paul Hilfinger <Hilfinger@gnat.com>
-
- * ada-typeprint.c (ada_print_type): Use int_string for printing
- modulus of modular type.
- * ada-lang.h (ada_modulus): Change return type to unsigned.
- * ada-lang.c (ada_language_arch_info): Correct type of
- string_char_type.
- (ada_modulus): Return unsigned result.
- (ada_lookup_symbol): Remove user disambiguation and modify comment
- accordingly.
-
-2004-10-08 Eric Botcazou <ebotcazou@act-europe.fr>
-
- Committed by Paul Hilfinger.
- * ada-lang.c (decode_packed_array): On big-endian targets,
- left-justify the value if it comes with a modular type.
-
-2004-10-08 Joel Brobecker <brobecker@gnat.com>
-
- Committed by Paul Hilfinger.
- * ada-lang.c (template_to_static_fixed_type): Fix a small typo.
- (is_name_suffix): Add support for "___JM" suffixes.
- (ada_check_typedef): Renames ada_completed_type.
- Update all users of CHECK_TYPEDEF, check_typedef, and
- ada_complete_type to call ada_check_typedef.
- * ada-typeprint.c: Likewise.
- * ada-valprint.c: Likewise.
-
-2004-10-08 Corinna Vinschen <vinschen@redhat.com>
-
- * infcall.c (call_function_by_hand): Use correct VALUE_TYPE macro.
-
-2004-10-08 Nick Roberts <nickrob@snap.net.nz>
-
- * MAINTAINERS: Update e-mail address.
-
-2004-10-07 Daniel Jacobowitz <dan@debian.org>
-
- From Maciej W. Rozycki <macro@mips.com>:
- * mips-tdep.c (mips32_next_pc): Check the register's contents,
- not its number for BLEZ/BLEZL and BGTZ/BGTZL.
-
-2004-10-07 Kei Sakamoto <sakamoto.kei@renesas.com>
-
- * m32r-tdep.c (decode_prologue): Support functions written
- in assembler language. Recognize trap instructions as the
- end of prologue.
- (m32r_frame_unwind_cache): Ditto.
- (m32r_skip_prologue): Extend search limit. Quit analyzing
- prologue if pc's location is not readable.
-
-2004-10-06 Paul N. Hilfinger <Hilfinger@gnat.com>
-
- * Makefile.in (.l.c): Do conversions of names of alloc and free
- functions that are done for .y.c files, plus special one
- for yy_flex_realloc. Also, correct missing-file tests here.
- * ada-lex.l (malloc, free): Remove macros.
- (resize_tempbuf): Use "realloc"; rely on sed changes to convert to
- xrealloc.
- (ada_flex_use): Dummy definition to remove warnings about unused
- functions.
- * ada-exp.y (dummy_string_to_ada_operator): Temporary definition
- to suppress warning.
-
-2004-10-06 Corinna Vinschen <vinschen@redhat.com>
-
- * sh-tdep.c (sh_return_value_nofpu): New function, implementing
- RETURN_VALUE.
- (sh_return_value_fpu): Ditto for CPUs with FPU.
- (sh_gdbarch_init): Remove STORE_RETURN_VALUE, EXTRACT_RETURN_VALUE,
- RETURN_VALUE_ON_STACK and USE_STRUCT_CONVENTION throughout.
- Install sh_return_value_nofpu resp. sh_return_value_fpu as
- RETURN_VALUE functions.
-
-2004-10-06 Corinna Vinschen <vinschen@redhat.com>
-
- * sh-tdep.c (sh_pseudo_register_read): Add PSEUDO_BANK_REGNUM handling.
- (sh_pseudo_register_write): Ditto.
-
-2004-10-06 Corinna Vinschen <vinschen@redhat.com>
-
- * sh-tdep.c (IS_MACL_STS): New define.
- (IS_MOVI20): Ditto.
- (IS_MACL_LDS): Ditto.
- (sh_analyze_prologue): Recognize STS.L MACL,@-r15 and MOVI20
- instructions in prologue.
- (sh_in_function_epilogue_p): Recognize LDS.L @r15+,MACL and MOVI20
- instructions in epilogue.
-
-2004-10-06 Corinna Vinschen <vinschen@redhat.com>
-
- * sh-tdep.c (SH_NUM_REGS): Define as 67.
- (sh_sh_register_name): Add eight empty register names.
- (sh_sh3_register_name): Ditto.
- (sh_sh3e_register_name): Ditto.
- (sh_sh2e_register_name): Ditto.
- (sh_sh2a_register_name): New function, defining SH2A register set.
- (sh_sh2a_nofpu_register_name): New function, defining SH2A register set
- in nofpu case.
- (sh_sh_dsp_register_name): Add eight empty register names.
- (sh_sh3_dsp_register_name): Ditto.
- (sh_sh4_register_name): Ditto.
- (sh_sh4_nofpu_register_name): Ditto.
- (sh_sh4al_dsp_register_name): Ditto.
- (sh2a_show_regs): New function.
- (sh2a_nofpu_show_regs): New function.
- (sh_sh2a_register_type): New function.
- (do_bank_register_info): New function.
- (sh_print_pseudo_register): Call do_bank_register_info.
- Call sh_print_pseudo_register for valid "bank" register.
- (sh_sh2a_register_sim_regno): New function.
- (sh_gdbarch_init): Add bfd_mach_sh2a and bfd_mach_sh2a_nofpu handling.
- Increment pseudo register count by one for all sh variants with
- pseudo registers to accomodate pseudo bank register.
- * sh-tdep.h: Add register numbers for R0_BANK0_REGNUM, MACHB_REGNUM,
- IVNB_REGNUM, PRB_REGNUM, GBRB_REGNUM, MACLB_REGNUM, BANK_REGNUM,
- IBCR_REGNUM, IBNR_REGNUM, TBR_REGNUM and PSEUDO_BANK_REGNUM.
- Increment pseudo register numbers.
-
-2004-10-06 Corinna Vinschen <vinschen@redhat.com>
-
- * dwarf2read.c (read_subroutine_type): Call make_function_type
- instead of lookup_function_type.
-
-2004-10-05 Jim Blandy <jimb@redhat.com>
-
- * linux-nat.c (_initialize_linux_nat): Rename child_ops.
- (Previous change missed some uses.)
-
-2004-10-05 Andrew Cagney <cagney@gnu.org>
-
- * target.h (deprecated_child_ops): Rename child_ops.
- * wince.c: Update copyright. Rename child_ops.
- * win32-nat.c: Rename child_ops.
- * target.c: Rename child_ops.
- * rs6000-nat.c: Rename child_ops.
- * linux-nat.c: Rename child_ops.
- * infttrace.c: Rename child_ops.
- * inftarg.c: Rename child_ops.
- * infptrace.c: Rename child_ops.
- * hppah-nat.c: Update copyright. Rename child_ops.
- * hpux-thread.c: Update copyright. Rename child_ops.
-
-2004-10-05 Daniel Jacobowitz <dan@debian.org>
-
- * remote.c (remote_xfer_partial): Handle TARGET_OBJECT_MEMORY.
-
-2004-10-05 Andrew Cagney <cagney@gnu.org>
-
- * version.in: Bump to version 6.2.50_YYYY-MM-DD-cvs.
-
-2004-10-05 Daniel Jacobowitz <dan@debian.org>
-
- * dwarf2read.c (REF_HASH_SIZE): Move earlier.
- (die_ref_table): Remove.
- (struct dwarf2_cu): Add DIES, DEPENDENCIES, and DIE_REF_TABLE.
- (struct dwarf2_per_cu_data): Add PSYMTAB. Add a comment describing
- the usage of this type.
- (struct dwarf2_per_objfile): Update comment for ALL_COMP_UNITS.
- (struct dwarf2_pinfo, PST_PRIVATE, DWARF_INFO_OFFSET): Remove.
- (struct dwarf2_queue_item, dwarf2_queue, dwarf2_queue_tail): New.
- (dwarf2_create_include_psymtab): Update comment.
- (find_partial_die): Remove third argument. Remove unreachable call
- to error ().
- (dwarf2_find_containing_comp_unit): Update comments. Change one
- assertion to an error. Remove an unreachable error.
- (dwarf2_find_comp_unit): Update comments.
- (type_at_offset): Remove dead code.
- (make_cleanup_free_die_list, dwarf2_empty_hash_tables): Remove.
- (store_in_ref_table): Add CU argument.
- (follow_die_ref): Take DIE, attribute, and CU arguments. Handle
- inter-compilation-unit references.
- (load_full_comp_unit, process_full_comp_unit): New functions, based
- on psymtab_to_symtab_1.
- (psymtab_to_symtab_1): Use them.
- (dwarf2_add_dependence): New function.
- (dwarf2_build_psymtabs_hard): Set the psymtab in per_cu. Always create
- a per_cu structure, and save it in READ_PSYMTAB_PRIVATE.
- (partial_die_parent_scope, guess_structure_name): Update for changes
- to find_partial_die.
- (dwarf2_psymtab_to_symtab): Initialize dwarf2_per_objfile here.
- (queue_comp_unit, process_queue, dwarf2_release_queue): New.
- (read_comp_unit): Don't call dwarf2_empty_hash_tables.
- (read_die_and_children): Update call to store_in_ref_table.
- (do_free_die_list_cleanup): Remove.
- (fixup_partial_die): Update for changes to find_partial_die.
- (read_full_die): Handle queueing absolute references.
- (read_attribute_value): Use DW_ADDR for all DW_FORM_ref* forms.
- (dwarf2_attr, die_specification, die_type)
- (die_containing_type, dwarf2_extension): Update calls to
- follow_die_ref.
- (dump_die): Update DW_FORM_ref* handling.
- (dwarf2_get_ref_die_offset): Likewise.
- (free_one_comp_unit): Release the dies list.
- (dwarf2_mark_helper): New function.
- (dwarf2_mark): Use it.
-
-2004-10-05 Mark Kettenis <kettenis@jive.nl>
-
- * procfs.c (procfs_xfer_partial): Use WRITEBUF instead of READBUF
- when writing to memory.
-
-2004-10-05 Kei Sakamoto <sakamoto.kei@renesas.com>
-
- * m32r-tdep.c (m32r_use_struct_convention): Delete function.
- (m32r_extract_struct_value_address): Delete function.
- (m32r_return_value): New function.
- (m32r_gdbarch_init): Instead of store_return_value,
- extract_return_value, deprecated_extract_struct_value_address
- and deprecated_use_struct_convention, set return_value.
-
-2004-10-03 Daniel Jacobowitz <dan@debian.org>
-
- * dwarf2read.c (read_subrange_type): Add comment for variable
- sized arrays.
-
-2004-10-03 Paul Hilfinger <hilfingr@nile.gnat.com>
-
- * Makefile.in (.l.c): Modify rule for compatibility with recent
- versions of flex, and remove most command-line options.
- * ada-lex.l: Add %options line in place of -I -i and -s command-line
- options.
-
-2004-10-02 Paul N. Hilfinger <Hilfinger@gnat.com>
-
- Turn on initial Ada support (mainly expression evaluation).
-
- * Makefile.in (SFILES): Remove ada-tasks.c.
- (HFILES_NO_SRCDIR): Add ada-lang.h.
- (COMMON_OBS): Add ada-lang.o, ada-typeprint.o, ada-valprint.o.
- (YYOBJ): Add ada-exp.o.
- (rule .l.c): Generalize to not mention ada.
- * symtab.c: Include ada-lang.h.
- (symbol_natural_name, symbol_demangled_name)
- (symbol_search_name): Add Ada case.
-
-2004-10-01 Andrew Cagney <cagney@gnu.org>
-
- * Makefile.in (COMMON_OBS): Add inf-child.o.
- * config/vax/obsd.mh (NATDEPFILES): Remove inf-child.o.
- * config/vax/nbsdelf.mh (NATDEPFILES): Remove inf-child.o.
- * config/vax/nbsdaout.mh (NATDEPFILES): Remove inf-child.o.
- * config/powerpc/nbsd.mh (NATDEPFILES): Remove inf-child.o.
- * config/m88k/obsd.mh (NATDEPFILES): Remove inf-child.o.
- * config/i386/obsdaout.mh (NATDEPFILES): Remove inf-child.o.
- * config/i386/obsd64.mh (NATDEPFILES): Remove inf-child.o.
- * config/i386/obsd.mh (NATDEPFILES): Remove inf-child.o.
- * config/i386/nbsdelf.mh (NATDEPFILES): Remove inf-child.o.
- * config/i386/nbsdaout.mh (NATDEPFILES): Remove inf-child.o.
- * config/i386/nbsd64.mh (NATDEPFILES): Remove inf-child.o.
- * config/i386/fbsd64.mh (NATDEPFILES): Remove inf-child.o.
- * config/i386/fbsd.mh (NATDEPFILES): Remove inf-child.o.
-
- * target.c (xfer_using_stratum): Change return type to LONGEST.
- On each iteration offset, readbuf and writebuf.
- * inf-ptrace.c (inf_ptrace_xfer_partial): Simplify computation of
- partial_length, and read/modify/write predicate, update comments.
- Pass buffer.word to ptrace write.
-
-2004-10-01 Paul N. Hilfinger <Hilfinger@gnat.com>
-
- * symfile.c (init_filename_language_table): Add extensions for
- Ada.
- * defs.h (enum language): Add language_ada.
- * gdbtypes.h (TYPE_FLAG_FIXED_INSTANCE): Define.
- * ada-lang.c: Strip code that is conditionalized out by GNAT_GDB.
- (add_symbols_from_enclosing_procs): Make a no-op for now.
- (ada_unqualified_name,add_angle_brackets,function_name_from_pc)
- (extended_canonical_line_spec, find_sal_from_funcs_and_line)
- (find_line_in_linetable, find_next_line_in_linetable)
- (read_all_symtabs, is_plausible_func_for_line)
- (adjust_pc_past_prologue, error_breakpoint_runtime_sym_not_found)
- (is_runtime_sym_defined, check_size): Remove declaration.
- (function_name_from_pc, ada_translate_error_message)
- (ada_lookup_minimal_symbol): Remove definition.
- (ada_add_block_symbols): Remove useless label.
- * ada-lang.h (ada_maybe_exception_partial_symbol): Remove
- useless declaration.
- (ada_is_exception_sym): Likewise.
-
-2004-09-30 Kei Sakamoto <sakamoto.kei@renesas.com>
-
- Add m32r-linux support.
- * configure.tgt: Add m32r*-*-linux*.
- * Makefile.in (ALLDEPFILES): Add m32r-tdep.c, m32r-linux-nat.c
- and m32r-linux-tdep.c.
- (m32r-linux-nat.o, m32r-linux-tdep.o): New dependencies.
- * m32r-tdep.c: Move some definitions to m32r-tdep.h.
- * config/djgpp/fnchange.lst: Add m32r-linux-nat.c and
- m32r-linux-tdep.c.
- * m32r-tdep.h, m32r-linux-nat.c, m32r-linux-tdep.c,
- config/m32r/linux.mh, config/m32r/linux.mt,
- config/m32r/nm-linux.h: New files.
-
-2004-09-30 Joel Brobecker <brobecker@gnat.com>
-
- * mips-tdep.c (mips32_decode_reg_save): Remove, unused.
- (mips32_fetch_instruction): Remove, unused.
-
-2004-09-30 Joel Brobecker <brobecker@gnat.com>
-
- * mips-tdep.c (mips_insn16_frame_cache): Remove dead code or
- conditions that will always be true.
-
-2004-09-30 Mark Kettenis <kettenis@gnu.org>
-
- * vaxbsd-nat.c: Include "target,h" and "inf-ptrace.h".
- (vaxbsd_fetch_inferior_registers): Rename from
- fetch_inferior_registers. Make static.
- (vaxbsd_store_inferior_registers): Rename from
- store_inferior_registers. Make static.
- (_initialize_vaxbsd_nat): Construct and add target vector.
- * config/vax/nbsdaout.mh (NATDEPFILES): Remove infptrace.o and
- inftarg.o. Add inf-child.o and inf-ptrace.o.
- * config/vax/nbsdelf.mh (NATDEPFILES): Remove infptrace.o and
- inftarg.o. Add inf-child.o and inf-ptrace.o.
- (NAT_FILE): Remove.
- * config/vax/obsd.mh (NATDEPFILES): Remove infptrace.o and
- inftarg.o. Add inf-child.o and inf-ptrace.o.
- (NAT_FILE): Remove.
- * Makefile.in (vaxbsd-nat.o): Update dependencies.
-
- * m88kbsd-nat.c: Include "target.h" and "inf-ptrace.h".
- (m88kbsd_fetch_inferior_registers): Rename from
- fetch_inferior_registers. Make static.
- (m88kbsd_store_inferior_registers): Rename from
- store_inferior_registers. Make static.
- (_initialize_m88kbsd_nat): New prototype and function.
- * config/m88k/obsd.mh (NATDEPFILES): Remove infptrace.o and
- inftarg.o. Add inf-child.o and inf-ptrace.o.
- (NAT_FILE): Remove.
- * Makefile.in (m88kbsd-nat.o): Update dependencies.
-
-2004-09-30 Andrew Cagney <cagney@gnu.org>
-
- * target.c (target_xfer_partial): New function.
- (target_read_memory_partial, target_write_memory_partial)
- (default_xfer_partial, target_read_partial, target_write_partial)
- (xfer_using_stratum): Use.
- (debug_to_xfer_partial): Delete function.
- (setup_target_debug): Do not override to_xfer_partial.
-
-2004-09-30 Mark Kettenis <kettenis@chello.nl>
-
- * fork-child.c: Update copyright year. Fix coding style.
-
-2004-09-29 Mark Kettenis <kettenis@gnu.org>
-
- * defs.h (msavestring, mstrsave): Remove prototypes.
- * utils.c (msavestring, mstrsave): Remove functions.
- * objfiles.c (allocate_objfile): Use xstrdup instead of mstrsave.
- * solib-sunos.c (allocate_rt_common_objfile): Use xstrdup instead
- of mstrsave.
- * source.c (find_and_open_source): Use xstrdup instead of
- mstrsave.
-
-2004-09-30 Andrew Cagney <cagney@gnu.org>
-
- * inf-ptrace.c (inf_ptrace_target): Do not set to_xfer_memory.
- (inf_ptrace_xfer_memory): Delete.
- * target.c (target_xfer_partial_p, xfer_using_stratum): New.
- (target_read_memory, target_write_memory): Use xfer_using_stratum
- when target_xfer_partial_p.
- (debug_target): Move to start of file.
- (target_read_memory_partial, target_write_memory_partial): Use
- to_xfer_partial when target_xfer_partial_p.
-
- * inf-ptrace.c (inf_ptrace_xfer_partial): Replace call to
- inf_ptrace_xfer_memory with equivalent code.
- * inftarg.c (child_xfer_partial): When performing a write, pass
- writebuf to child_xfer_memory.
-
- * target.c (target_read_string): Use target_read_memory instead of
- target_xfer_memory.
-
-2004-09-29 Andrew Cagney <cagney@gnu.org>
-
- * infptrace.c (kill_inferior): Fix typo, in previous inline. Pass
- the address of status.
-
- * infptrace.c (ptrace_wait): Mention problem with HPUX.
- (kill_inferior): Inline ptrace_wait call.
- * linux-nat.c (kill_inferior): Inline ptrace_wait call.
- * inftarg.c (child_wait): Inline ptrace_wait call.
-
- * target.h (struct target_ops): Delete field to_post_wait.
- (target_post_wait): Delete macro.
- (child_post_wait): Delete declaration.
- * target.c (update_current_target, update_current_target)
- (debug_to_post_wait, setup_target_debug): Delete functions and
- references.
- * infttrace.c (ptrace_wait): Delete call to target_post_wait.
- * inftarg.c (child_post_wait): Delete.
- (init_child_ops): Do not set to_post_wait.
- * infptrace.c (ptrace_wait): Delete call to target_post_wait.
- * inf-ptrace.c (inf_ptrace_wait): Delete call to target_post_wait.
- * inf-child.c (inf_child_post_wait): Delete.
- (inf_child_target): Do not set to_post_wait.
- * inf-ptrace.c (inf_ptrace_post_wait): Delete.
- (inf_ptrace_target): Do not set to_post_wait.
-
- * wince.c (child_ops): Delete.
- * win32-nat.c (child_ops): Delete.
-
- * inftarg.c (inftarg_set_find_memory_regions)
- (inftarg_set_make_corefile_notes): Delete functions.
- (_initialize_linux_nat): Inline calls.
-
- * target.h (child_ops): Declare.
- * inftarg.c (child_ops): Move from here ...
- * target.c (child_ops): ... to here.
- * wince.c (child_ops): Delete extern declaration.
- * win32-nat.c (child_ops): Delete extern declaration.
- * linux-nat.c (child_ops): Delete extern declaration.
- * hpux-thread.c (child_ops): Delete extern declaration.
-
-2004-09-28 Mark Kettenis <kettenis@gnu.org>
-
- * configure.tgt: Set default OS/ABI for OpenBSD ELF targets.
-
-2004-09-28 Mark Kettenis <kettenis@gnu.org>
-
- * configure.in: Only set host_makefile_frag when building a native
- debugger.
- * configure: Regenerate.
-
- * alphanbsd-tdep.c (_initialize_alphanbsd_tdep): Register OS/ABI
- for OpenBSD ELF.
-
-2004-09-28 Andrew Cagney <cagney@gnu.org>
-
- Problem identified by Paul Hilfinger.
- * Makefile.in (ada_lex_c): Define.
- (ada-lex.o): Delete rule.
-
- * linux-proc.c: Delete file.
- * Makefile.in: Update.
- * config/sparc/linux64.mh (NATDEPFILES):
- * config/sparc/linux.mh (NATDEPFILES): Update.
- * config/s390/s390.mh (NATDEPFILES): Update.
- * config/powerpc/ppc64-linux.mh (NATDEPFILES): Update.
- * config/powerpc/linux.mh (NATDEPFILES): Update.
- * config/pa/linux.mh (NATDEPFILES): Update.
- * config/mips/linux.mh (NATDEPFILES): Update.
- * config/m68k/linux.mh (NATDEPFILES): Update.
- * config/ia64/linux.mh (NATDEPFILES): Update.
- * config/i386/linux64.mh (NATDEPFILES): Update.
- * config/i386/linux.mh (NATDEPFILES): Update.
- * config/arm/linux.mh (NATDEPFILES): Update.
- * config/alpha/alpha-linux.mh (NATDEPFILES): Update.
- * linux-nat.c: Update copyright. Include <sys/param.h>,
- <sys/procfs.h>, "elf-bfd.h", "gregset.h", <ctype.h>,
- "gdbthread.h", "gdb_stat.h", <fcntl.h>.
- (O_LARGEFILE): Possibly define.
- (_initialize_linux_nat, linux_proc_pending_signals)
- (add_line_to_sigset, linux_proc_xfer_memory)
- (linux_nat_info_proc_cmd, linux_nat_make_corefile_notes)
- (linux_nat_do_registers, linux_nat_corefile_thread_callback)
- (struct linux_corefile_thread_data)
- (linux_nat_do_thread_registers, linux_nat_find_memory_regions)
- (child_pid_to_exec_file): Insert code previously in linux-proc.c.
-
-2004-09-16 Andrew Cagney <cagney@gnu.org>
-
- * lin-lwp.c: Delete file.
- * linux-nat.c: Include "gdb_assert.h", "gdb_string.h", <unistd.h>,
- <sys/syscall.h>, "gdbthread.h", "gdbcmd.h", "regcache.h".
- (status_to_str, init_lwp_list, add_lwp, delete_lwp)
- (find_lwp_pid, iterate_over_lwps, lin_lwp_attach_lwp)
- (linux_nat_attach, detach_callback, linux_nat_detach)
- (resume_callback, resume_clear_callback, linux_nat_resume)
- (kill_lwp, linux_nat_handle_extended, wait_lwp, stop_callback)
- (stop_wait_callback, linux_nat_has_pending, flush_callback)
- (status_callback, running_callback, count_events_callback)
- (select_singlestep_lwp_callback, select_event_lwp_callback)
- (cancel_breakpoints_callback, select_event_lwp, resumed_callback)
- (child_wait, stop_and_resume_callback, linux_nat_wait)
- (kill_callback, kill_wait_callback, linux_nat_kill)
- (linux_nat_create_inferior, linux_nat_mourn_inferior)
- (linux_nat_xfer_memory, linux_nat_thread_alive)
- (linux_nat_pid_to_str, init_linux_nat_ops, sigchld_handler)
- (_initialize_linux_nat): New functions.
- * Makefile.in: Update all dependencies.
- * config/sparc/linux64.mh (NATDEPFILES): Remove lin-lwp.o.
- * config/sparc/linux.mh (NATDEPFILES): Remove lin-lwp.o.
- * config/s390/s390.mh (NATDEPFILES): Remove lin-lwp.o.
- * config/powerpc/ppc64-linux.mh (NATDEPFILES): Remove lin-lwp.o.
- * config/powerpc/linux.mh (NATDEPFILES): Remove lin-lwp.o.
- * config/pa/linux.mh (NATDEPFILES): Remove lin-lwp.o.
- * config/mips/linux.mh (NATDEPFILES): Remove lin-lwp.o.
- * config/m68k/linux.mh (NATDEPFILES): Remove lin-lwp.o.
- * config/ia64/linux.mh (NATDEPFILES): Remove lin-lwp.o.
- * config/i386/linux64.mh (NATDEPFILES): Remove lin-lwp.o.
- * config/i386/linux.mh (NATDEPFILES): Remove lin-lwp.o.
- * config/arm/linux.mh (NATDEPFILES): Remove lin-lwp.o.
- * config/alpha/alpha-linux.mh (NATDEPFILES): Remove lin-lwp.o.
-
-2004-09-27 Mark Kettenis <kettenis@gnu.org>
-
- * config/i386/fbsd64.mh, config/i386/nbsd64.mh,
- config/i386/obsd64.mh (NAT_FILE): Remove variable.
-
- * configure.in: Don't comment out NATDEPFILES in the generated
- Makefile if NAT_FILE is unset.
- * configure: Regenerate.
-
-2004-09-27 Andrew Cagney <cagney@gnu.org>
-
- * infrun.c (check_for_old_step_resume_breakpoint): Delete.
- (insert_step_resume_breakpoint): Delete.
- (insert_step_resume_breakpoint_at_frame): New function.
- (insert_step_resume_breakpoint_at_sal): New function.
- (handle_inferior_event, step_into_function)
- (insert_step_resume_breakpoint): Simplify by using same.
-
- * gdb_indent.sh (types): Add caddr_t to list of predefined types.
-
-2004-09-26 Mark Kettenis <kettenis@gnu.org>
-
- * fbsd-proc.c: Remove file.
- * Makefile.in (fbsd-proc.o): Remove dependency.
-
- * i386fbsd-nat.c (_initialize_i386fbsd_nat): Group target related
- code together.
-
- * config/i386/nm-fbsd64.h: Remove file.
- * config/i386/fbsd64.mh (NAT_FILE): Set to config/nm-nbsd.h.
-
-2004-09-26 Mark Kettenis <kettenis@gnu.org>
-
- * amd64-nat.h: Update copyright year.
- (amd64bsd_target): New prototype.
- * amd64bsd-nat.c: Include "target.h" and "inf-ptrace.h".
- (amd64bsd_target): New function.
- (amd64bsd_fetch_inferior_registers): Rename from
- fetch_inferior_registers. Make static.
- (amd64bsd_store_inferior_registers): Rename from
- store_inferior_registers. Make static.
- * amd64fbsd-nat.c: Include "target.h" and "fbsd-nat.h".
- (_initialize_amd64fbsd_nat): Construct and add target vector.
- * amd64nbsd-nat.o: Include "target.h".
- (_initialize_amd64nbsd_nat): Construct and add target vector.
- * amd64obsd-nat.c: Include "target.h".
- (_initialize_amd64obsd_nat): Construct and add target vector.
- * config/i386/nm-fbsd64.h (CHILD_PID_TO_EXEC_FILE): Remove define.
- * config/i386/fbsd64.mh (NATDEPFILES): Remove infptrace.o,
- inftarg.o and fbsd-proc.o. Add inf-child.o, inf-ptrace.o and
- fbsd-nat.o.
- * config/i386/nbsd64.mh, config/i386/obsd64.mh (NATDEPFILES):
- Remove infptrace.o and inftarg.o. Add inf-child.o and
- inf-ptrace.o.
- * Makefile.in (amd64bsd-nat.o, amd64fbsd-nat.o, amd64nbsd-nat.o)
- (amd64obsd-nat.o): Update dependencies.
-
-2004-09-25 Mark Kettenis <kettenis@gnu.org>
-
- * config/i386/fbsd.mh (NATDEPFILES): Remove infptrace.o.
- * config/i386/nbsdaout.mh (NATDEPFILES): Remove infptrace.o.
- * config/i386/nbsdelf.mh (NATDEPFILES): Remove infptrace.o.
- * config/i386/obsd.mh (NATDEPFILES): Remove infptrace.o.
- * config/i386/obsdaout.mh (NATDEPFILES): Remove infptrace.o.
-
- * inf-ptrace.c (inf_ptrace_attach): Remove redundant parenthesis.
- Inline attach call.
- (inf_ptrace_detach): Inline detach call.
-
- * configure.in: Check for waddstr instead of mvwaddstr when
- searching for curses library. Check for wborder.
- * configure, config.in: Regenerate.
- * tui/tui-wingeneral.c (box_win): Use box if wborder isn't
- available.
-
- * inf-ptrace.c (inf_ptrace_xfer_memory): Fix gdb_indent.sh wart.
-
-2004-09-24 Robert Picco <Robert.Picco@hp.com>
-
- Committed by Andrew Cagney.
- * remote.c (set_remote_protocol_p_packet_cmd, remote_protocol_p)
- (show_remote_protocol_p_packet_cmd): New. Implement 'p' packet.
- configuration.
- (fetch_register_using_p): Implement 'p' packet. Based on code by
- Fernando Nasser.
- (remote_fetch_registers): Call fetch_register_using_p.
- (init_all_packet_configs, show_remote_cmd)
- (_initialize_remote): Add p-packet.
-
-2004-09-24 Mark Kettenis <kettenis@gnu.org>
-
- * inf-ptrace.c (inf_ptrace_kill_inferior): Call ptrace directly
- instead of call_ptrace. Call wait directly instead of
- ptrace_wait.
- (inf_ptrace_me): Call ptrace directly instead of call_ptrace.
- (inf_ptrace_wait): Inline ptrace_wait call.
-
-2004-09-24 Paul Hilfinger <hilfingr@nile.gnat.com>
-
- * Makefile.in (.y.c): Revert previous change. ../ylwrap was
- rolled back instead.
-
-2004-09-24 Paul Hilfinger <hilfingr@nile.gnat.com>
-
- * Makefile.in (.y.c): Modify $(YLWRAP) invocation to use
- the new argument order.
-
-2004-09-23 Corinna Vinschen <vinschen@redhat.com>
-
- * MAINTAINERS: Remove "broken" from XStormy16 entry.
- * xstormy16-tdep.c: Convert XStormy16 target to latest GDB methods.
- (struct gdbarch_tdep): Remove.
- (struct xstormy16_frame_cache): New frame cache structure.
- (xstormy16_register_byte, xstormy16_register_raw_size)
- (xstormy16_reg_virtual_type, xstormy16_register_type)
- (xstormy16_push_arguments, xstormy16_push_return_address)
- (xstormy16_pop_frame, xstormy16_store_struct_return)
- (xstormy16_store_return_value, xstormy16_extract_struct_value_address)
- (xstormy16_frame_saved_register, xstormy16_get_saved_register)
- (xstormy16_scan_prologue, xstormy16_frame_init_saved_regs)
- (xstormy16_frame_saved_pc, xstormy16_init_extra_frame_info)
- (xstormy16_frame_chain, xstormy16_frame_chain_valid,
- (xstormy16_saved_pc_after_call, xstormy16_save_dummy_frame_to): Remove.
- (xstormy16_use_struct_convention): Drop gcc_p parameter.
- (xstormy16_extract_return_value, xstormy16_store_return_value):
- Regcachify. Drop useless struct convention handling.
- (xstormy16_register_type, xstormy16_return_value)
- (xstormy16_push_dummy_call, xstormy16_analyze_prologue)
- (xstormy16_alloc_frame_cache, xstormy16_frame_cache)
- (xstormy16_frame_prev_register, xstormy16_frame_this_id)
- (xstormy16_frame_base_address, xstormy16_frame_sniffer)
- (xstormy16_unwind_sp, xstormy16_unwind_pc)
- (xstormy16_unwind_dummy_id) : New functions.
- (xstormy16_skip_prologue): Call xstormy16_analyze_prologue instead
- of xstormy16_scan_prologue.
- (xstormy16_frame_unwind): New frame_unwind structure.
- (xstormy16_frame_base): New frame_base structure.
- (xstormy16_gdbarch_init): Accomodate all of the above changes.
- Reshuffle for better readability. Also add dwarf2_frame_sniffer.
-
-2004-09-22 Mark Kettenis <kettenis@gnu.org>
-
- * language.c (language_gdbarch_post_init): Fix off-by one error.
-
-2004-09-21 Daniel Jacobowitz <dan@debian.org>
-
- * dwarf2read.c (struct dwarf2_per_cu_data): New field type_hash.
- (struct dwarf2_offset_and_type): New.
- (set_die_type, reset_die_and_siblings_types, get_die_type)
- (offset_and_type_hash, offset_and_type_eq): New functions.
- (read_structure_type, read_enumeration_type, read_array_type)
- (read_namespace, read_tag_pointer_type, read_tag_ptr_to_member_type)
- (read_tag_reference_type, read_tag_const_type)
- (read_tag_volatile_type, read_tag_string_type, read_subroutine_type)
- (read_typedef, read_base_type, read_subrange_type): Use
- set_die_type.
-
-2004-09-20 Daniel Jacobowitz <dan@debian.org>
-
- * Makefile.in (dwarf2read.o): Update dependencies.
- * dwarf2read.c: Include "command.h" and "gdbcmd.h".
- (struct dwarf2_per_objfile): Add all_comp_units, n_comp_units,
- and read_in_chain.
- (struct dwarf2_cu): Add read_in_chain, per_cu, last_used,
- mark, and has_form_ref_addr.
- (struct dwarf2_per_cu_data): New.
- (dwarf2_max_cache_age): New.
- (dwarf2_build_psymtabs_hard): Free cached compilation units
- after loading. Create and manage the list of compilation units.
- Remove unnecessary NULL initialization. Fix indentation.
- (psymtab_to_symtab_1): Initialize all of CU.
- (dwarf2_read_abbrevs): Set has_form_ref_addr.
- (find_partial_die): Use dwarf2_find_containing_comp_unit
- and load_comp_unit.
- (free_stack_comp_unit): Update comments. Clear the per-cu
- pointer. Handle aging.
- (dwarf2_find_containing_comp_unit, free_cached_comp_units)
- (age_cached_comp_units, free_one_cached_comp_unit)
- (dwarf2_mark, dwarf2_clear_marks, create_all_comp_units)
- (load_comp_unit, dwarf2_find_comp_unit, free_one_comp_unit)
- (set_dwarf2_cmdlist, show_dwarf2_cmdlist, set_dwarf2_cmd)
- (show_dwarf2_cmd): New.
- (_initialize_dwarf2_read): Provide "maint set dwarf2 max-cache-age"
- and "maint show dwarf2 max-cache-age".
- * gdbcmd.h (maintenance_set_cmdlist, maintenance_show_cmdlist): New
- externs.
- * maint.c (maintenance_set_cmdlist, maintenance_show_cmdlist): Make
- global.
-
-2004-09-20 Jeff Johnston <jjohnstn@redhat.com>
-
- * dwarf2read.c (typename_concat): Change prototype to accept obstack
- and dwarf2_cu struct pointer as arguments. Change function to use
- obstack if provided and use dwarf2_cu to determine language-specific
- separator.
- (partial_die_parent_scope): Change comment to include java. Use
- new version of typename_concat instead of obconcat.
- (partial_die_full_name): Use typename_concat.
- (read_namespace): Ditto.
- (read_enumeration_type): Use typename_concat instead of obconcat.
- (new_symbol): Ditto.
- (add_partial_symbol): Enhance tests for C++ to also test for Java.
- (guess_structure_name): Ditto.
- (read_subroutine_type): Ditto.
- (read_structure_type): Ditto.
- (is_vtable_name): Add Java support.
- (determine_class_name): Switch to new typename_concat call.
- (determine_prefix): Switch to new typename_concat call.
- * jv-exp.y (FuncStart): New pattern.
- (MethodInvocation): Add support for simple function calls. Change
- warning message for other forms of inferior call currently not
- supported.
- * valarith.c (value_subscript): Treat an array with upper-bound
- of -1 as unknown size.
-
-2004-09-20 Daniel Jacobowitz <dan@debian.org>
-
- * symtab.c (lookup_partial_symtab): Use psymtab_to_fullname.
- (lookup_partial_symtab): Use symtab_to_fullname.
-
-2004-09-19 Jim Blandy <jimb@redhat.com>
-
- * minsyms.c (lookup_minimal_symbol): Doc fix.
-
-2004-09-20 Andrew Cagney <cagney@gnu.org>
-
- * config/nm-lynx.h (DEPRECATED_CHILD_RESUME): Deprecate
- CHILD_RESUME.
- * config/i386/nm-linux.h (DEPRECATED_CHILD_RESUME): Ditto.
- * config/nm-linux.h (DEPRECATED_KILL_INFERIOR): Deprecate
- KILL_INFERIOR.
- * infptrace.c: Update.
-
-2004-09-19 Daniel Jacobowitz <dan@debian.org>
-
- * symtab.c (output_source_filename): Mark first argument as const.
- (sources_info): Use symtab_to_fullname and psymtab_to_fullname
- for "info sources" output.
-
-2004-09-20 Mark Kettenis <kettenis@gnu.org>
-
- * config/i386/nm-fbsd.h, config/i386/nm-obsd.h: Don't include
- <machine/vmparam.h>.
- (KERNEL_U_ADDR, REGISTER_U_ADDR): Remove defines.
- (register_u_addr): Remove prototype.
-
-2004-09-19 Mark Kettenis <kettenis@gnu.org>
-
- * i386bsd-nat.c: Include "i386bsd-nat.h" and "inf-ptrace.h".
- (i386bsd_fetch_inferior_registers): Rename from
- fetch_inferior_registers. Make static.
- (i386bsd_store_inferior_registers): Rename from
- store_inferior_registers. Make static.
- (i386bsd_target): New function.
- * i386bsd-nat.h: New file.
- * i386fbsd-nat.c: Include "target.h", "fbsd-nat.h" and
- "i386bsd-nat.h".
- (i386fbsd_resume): Rename from child_resume. Make static.
- (_initialize_i386fbsd_nat): Construct and add target vector.
- * i386nbsd-nat.c: Include "target.h" and "i386bsd-nat.h".
- (_initialize_i386nbsd_nat): Construct and add target vector.
- * config/i386/nm-fbsd.h: (CHILD_RESUME, CHILD_PID_TO_EXEC_FILE):
- Remove defines.
- * config/i386/fbsd.mh (NATDEPFILES): Add inf-child.o, inf-ptrace.o
- and fbsd-nat.o. Remove inftarg.o and fbsd-proc.o.
- * config/i386/nbsdaout.mh (NATDEPFILES): Add inf-child.o,
- inf-ptrace.o, i386bsd-nat.o and bsd-kvm.o. Remove inftarg.o.
- (LOADLIBES): New variable.
- * config/i386/nbsdelf.mh (NATDEPFILES): Add inf-child.o and
- inf-ptrace.o. Remove inftarg.o.
- * config/i386/obsd.mh (NATDEPFILES): Add inf-child.o and
- inf-ptrace.o. Remove inftarg.o.
- * config/i386/obsdaout.mh (NATDEPFILES): Add inf-child.o,
- inf-ptrace.o, i386nbsd-nat.o and bsd-kvm.o. Remove inftarg.o.
- (LOADLIBES): New variable.
- * Makefile.in (i386bsd_nat_h): New variable.
- (i386bsd-nat.o, i386fbsd-nat.o, i386nbsd-nat.o): Update
- dependencies.
-
- * sparc64nbsd-tdep.c: Include "objfiles.h".
- (sparc64nbsd_init_abi): Set in_solib_call_trampoline and
- skip_trampoline_code. Set solib_svr4_fetch_link_map_offsets to
- svr4_lp64_fetch_link_map_offsets.
- * sparc64obsd-tdep.c: Include "objfiles.h". Don't include
- "nbsd-tdep.h".
- (sparc64obsd_init_abi): Set in_solib_call_trampoline and
- skip_trampoline_code. Set solib_svr4_fetch_link_map_offsets to
- svr4_lp64_fetch_link_map_offsets.
- * Makefile.in (sparc64nbsd-tdep.o, sparc64obsd-tdep.o): Update
- dependencies.
-
- * fbsd-nat.c: New files with cleaned up contents of fbsd-proc.c.
- * fbsd-nat.h: New file.
- * Makefile.in (ALLDEPFILES): Add fbsd-nat.c.
- (fbsd_nat_h): New variable.
- (fbsd-nat.o): New dependency.
-
- * config/sparc/nbsd64.mt, config/sparc/obsd.mt,
- config/sparc/obsd64.mt (DEPRECATED_TM_FILE): Set to solib.h.
-
- * inf-child.c (inf_child_post_wait): Remove stray whitespace in
- comment.
-
-2004-09-18 Paul N. Hilfinger <hilfinger@gnat.com>
-
- * ada-exp.y (type_int): New function to add layer of abstraction
- around references to expression types.
- (type_long): Ditto.
- (type_long_long): Ditto.
- (type_float): Ditto.
- (type_double): Ditto.
- (type_long_double): Ditto.
- (type_char): Ditto.
- (type_system_address): Ditto.
- (simple_exp): Use type_* functions in place of builtin_*
- variables.
- (exp): Ditto.
- (write_var_from_name): Ditto.
- (write_object_renaming): Ditto.
- * ada-lang.c (ada_create_fundamental_type): Remove redundant
- declaration.
- (build_ada_types): Remove, replacing with...
- (ada_language_arch_info): New function to initialize primitive
- type vector in language_arch_info.
- (ada_array_length): Remove use of builtin_type_ada_int.
- (value_pos_atr): Ditto.
- (ada_evaluate_subexp): Ditto.
- (builtin_type_ada_int, builtin_type_ada_short, builtin_type_ada_long,
- builtin_type_ada_long_long, builtin_type_ada_char,
- builtin_type_ada_float, builtin_type_ada_double,
- builtin_type_ada_long_double, builtin_type_ada_natural,
- builtin_type_ada_positive, builtin_type_ada_system_address): Remove.
- (ada_builtin_types): Remove.
- (ada_language_defn): Remove entries for la_builtin_type_vector and
- string_char_type and use ada_language_arch_info.
- (_initialize_ada_language): Do type-vector initialization along
- the lines of c-lang.c.
- (ada_create_fundamental_type): Break up line.
- (ada_dump_symtab): Remove unused function.
- (enum ada_primitive_types): Define.
- * ada-lang.h (builtin_type_ada_int, builtin_type_ada_short,
- builtin_type_ada_long,builtin_type_ada_long_long,builtin_type_ada_char,
- builtin_type_ada_float, builtin_type_ada_double,
- builtin_type_ada_long_double, builtin_type_ada_natural,
- builtin_type_ada_positive, builtin_type_ada_system_address): Remove.
- * ada-lex.l: Use type_* functions in place of builtin_* variables.
- (processInt): Ditto.
- (processReal): Ditto.
- (name_lookup): Ditto.
- * ada-typeprint.c (print_range): Use builtin_type_int, not
- builtin_type_ada_int.
-
-2004-09-18 Mark Kettenis <kettenis@gnu.org>
-
- * i386-tdep.c (i386_register_name): Rename regno to regnum.
-
- * config/pa/hpux1020.mh (MH_CFLAGS): Remove -D__HP_CURSES.
- * config/pa/hpux11.mh (MH_CFLAGS): Likewise.
- * config/pa/hpux11w.mh (MH_CFLAGS): Likewise.
- * configure.in: Improve checks for curses library by checking for
- mvwaddstr instead of initscr. Drop HP curses in favour of
- standard curses on HP-UX.
- * configure: Regenerated.
-
-2004-09-18 Paul N. Hilfinger <hilfinger@gnat.com>
-
- * ada-lang.c: (ada_main_name, ada_value_slice_ptr, ada_value_slice,
- ada_breakpoint_rewrite, ada_template_to_fixed_record_type_1):
- Minor formatting changes.
- (empty_array): Slight rewrite for formatting.
- (emit_char,parse,ada_language_defn,build_ada_types,
- ada_is_exception_sym, _initialize_ada_language): Move
- definitions around.
- (ada_dump_symtab): Remove unused definition.
- (ada_maybe_exception_partial_symbol): Remove unused definition.
-
-2004-09-16 Andrew Cagney <cagney@gnu.org>
-
- * inf-child.c: Include "gdb_string.h".
- (inf_child_core_file_to_sym_file): Delete.
- (inf_child_target): Set to_fetch_registers and to_store_registers.
- * inf-ptrace.c: Include "gdb_string.h".
- * Makefile.in: Update all dependencies.
-
- * Makefile.in (gnu-v3-abi.o): Add explict rule to avoid -Werror
- problem.
-
-2004-09-14 Joel Brobecker <brobecker@gnat.com>
-
- * mips-tdep.c (mips_insn32_frame_cache): Pass frame cache in
- call to heuristic_proc_desc. Remove code that became redundant
- as a consequence.
- (read_next_frame_reg): Remove special case for SP_REGNUM.
- (set_reg_offset): Fix small typo.
- (reset_saved_regs): New procedure.
- (mips32_heuristic_proc_desc): No longer compute a fake
- procedure descriptor. Compute the full frame cache instead.
- Some minor comment reformatting.
-
2004-09-14 Andrew Cagney <cagney@gnu.org>
* MAINTAINERS: Add Michael Chastain as the backup gdb.threads
diff --git a/gdb/MAINTAINERS b/gdb/MAINTAINERS
index 30a305f..e24a577 100644
--- a/gdb/MAINTAINERS
+++ b/gdb/MAINTAINERS
@@ -150,7 +150,7 @@ maintainer works with the native maintainer when resolving API issues.
x86-64 --target=x86_64-linux-gnu ,-Werror
Maintenance only
- xstormy16 --target=xstormy16-elf
+ xstormy16 --target=xstormy16-elf broken
Corinna Vinschen vinschen@redhat.com
z8k Deleted.
@@ -217,17 +217,22 @@ event loop Elena Zannoni ezannoni@redhat.com
For the part of top.c related to the event loop,
send questions to ezannoni@redhat.com
-generic symtabs Elena Zannoni ezannoni@redhat.com
- dwarf readers Elena Zannoni ezannoni@redhat.com
- elf reader Elena Zannoni ezannoni@redhat.com
- stabs reader Elena Zannoni ezannoni@redhat.com
+generic symtabs Jim Blandy jimb@redhat.com
+ Elena Zannoni ezannoni@redhat.com
+ dwarf readers Jim Blandy jimb@redhat.com
+ Elena Zannoni ezannoni@redhat.com
+ elf reader Jim Blandy jimb@redhat.com
+ Elena Zannoni ezannoni@redhat.com
+ stabs reader Jim Blandy jimb@redhat.com
+ Elena Zannoni ezannoni@redhat.com
coff reader Philippe De Muyter phdm@macqel.be
xcoff reader Any maintainer can modify this; please send tricky
ones to Kevin Buettner <kevinb@redhat.com>
HP/UX readers Any [past] maintainer can modify this.
Please send tricky ones to the symtabs maintainers.
-tracing bytecode stuff (Global Maintainers)
+tracing bytecode stuff Jim Blandy jimb@redhat.com
+ (Global Maintainers)
tracing Michael Snyder msnyder@redhat.com
threads Michael Snyder msnyder@redhat.com
Mark Kettenis kettenis@gnu.org
@@ -381,7 +386,7 @@ Hans-Peter Nilsson hp@bitrange.com
David O'Brien obrien@freebsd.org
Alexandre Oliva aoliva@redhat.com
Tom Rix trix@redhat.com
-Nick Roberts nickrob@snap.net.nz
+Nick Roberts nick@nick.uklinux.net
Bob Rossi bob_rossi@cox.net
Theodore A. Roth troth@openavr.org
Ian Roxborough irox@redhat.com
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 3546113..7ad1e9b 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -510,7 +510,7 @@ TARGET_FLAGS_TO_PASS = \
# Links made at configuration time should not be specified here, since
# SFILES is used in building the distribution archive.
-SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c \
+SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \
ax-general.c ax-gdb.c \
bcache.c \
bfd-target.c \
@@ -625,7 +625,6 @@ nm_h = @nm_h@
#
ada_lang_h = ada-lang.h $(value_h) $(gdbtypes_h) $(breakpoint_h)
-ada_lex_c = ada-lex.c $(gdb_string_h)
alphabsd_tdep_h = alphabsd-tdep.h
alpha_tdep_h = alpha-tdep.h
amd64_nat_h = amd64-nat.h
@@ -656,7 +655,7 @@ cp_support_h = cp-support.h $(symtab_h)
dcache_h = dcache.h
defs_h = defs.h $(config_h) $(ansidecl_h) $(gdb_locale_h) $(gdb_signals_h) \
$(libiberty_h) $(bfd_h) $(ui_file_h) $(xm_h) $(nm_h) $(tm_h) \
- $(fopen_bin_h) $(gdbarch_h)
+ $(fopen_same_h) $(gdbarch_h)
dictionary_h = dictionary.h
disasm_h = disasm.h
doublest_h = doublest.h $(floatformat_h)
@@ -669,7 +668,6 @@ event_loop_h = event-loop.h
event_top_h = event-top.h
exec_h = exec.h $(target_h)
expression_h = expression.h $(symtab_h) $(doublest_h)
-fbsd_nat_h = fbsd-nat.h
f_lang_h = f-lang.h
frame_base_h = frame-base.h
frame_h = frame.h
@@ -700,7 +698,6 @@ glibc_tdep_h = glibc-tdep.h
gnu_nat_h = gnu-nat.h
gregset_h = gregset.h
hppa_tdep_h = hppa-tdep.h
-i386bsd_nat_h = i386bsd-nat.h
i386_linux_tdep_h = i386-linux-tdep.h
i386_tdep_h = i386-tdep.h
i387_tdep_h = i387-tdep.h
@@ -720,7 +717,6 @@ libunwind_frame_h = libunwind-frame.h $(libunwind_h)
linespec_h = linespec.h
linux_nat_h = linux-nat.h $(target_h)
m2_lang_h = m2-lang.h
-m32r_tdep_h = m32r-tdep.h
m68k_tdep_h = m68k-tdep.h
m88k_tdep_h = m88k-tdep.h
macroexp_h = macroexp.h
@@ -848,7 +844,7 @@ HFILES_NO_SRCDIR = bcache.h buildsym.h call-cmds.h coff-solib.h defs.h \
symfile.h symfile-mem.h stabsread.h target.h terminal.h typeprint.h \
xcoffsolib.h \
macrotab.h macroexp.h macroscope.h \
- ada-lang.h c-lang.h f-lang.h \
+ c-lang.h f-lang.h \
jv-lang.h \
m2-lang.h p-lang.h \
complaints.h valprint.h \
@@ -895,7 +891,6 @@ COMMON_OBS = $(DEPFILES) $(YYOBJ) \
infcall.o \
infcmd.o infrun.o \
expprint.o environ.o stack.o thread.o \
- inf-child.o \
interps.o \
main.o \
macrotab.o macrocmd.o macroexp.o macroscope.o \
@@ -910,7 +905,7 @@ COMMON_OBS = $(DEPFILES) $(YYOBJ) \
dbxread.o coffread.o coff-pe-read.o elfread.o \
dwarfread.o dwarf2read.o mipsread.o stabsread.o corefile.o \
dwarf2expr.o dwarf2loc.o dwarf2-frame.o \
- ada-lang.o c-lang.o f-lang.o objc-lang.o \
+ c-lang.o f-lang.o objc-lang.o \
ui-out.o cli-out.o \
varobj.o wrapper.o \
jv-lang.o jv-valprint.o jv-typeprint.o \
@@ -918,8 +913,8 @@ COMMON_OBS = $(DEPFILES) $(YYOBJ) \
scm-exp.o scm-lang.o scm-valprint.o \
sentinel-frame.o \
complaints.o typeprint.o \
- ada-typeprint.o c-typeprint.o f-typeprint.o m2-typeprint.o \
- ada-valprint.o c-valprint.o cp-valprint.o f-valprint.o m2-valprint.o \
+ c-typeprint.o f-typeprint.o m2-typeprint.o \
+ c-valprint.o cp-valprint.o f-valprint.o m2-valprint.o \
nlmread.o serial.o mdebugread.o top.o utils.o \
ui-file.o \
user-regs.o \
@@ -943,7 +938,6 @@ YYFILES = c-exp.c \
f-exp.c m2-exp.c p-exp.c
YYOBJ = c-exp.o \
objc-exp.o \
- ada-exp.o \
jv-exp.o \
f-exp.o m2-exp.o p-exp.o
@@ -1364,9 +1358,7 @@ ALLDEPFILES = \
bsd-kvm.c \
coff-solib.c \
core-regset.c core-aout.c corelow.c \
- dcache.c exec.c \
- fbsd-nat.c \
- fork-child.c \
+ dcache.c exec.c fork-child.c \
glibc-tdep.c \
go32-nat.c h8300-tdep.c \
hppa-tdep.c hppa-hpux-tdep.c \
@@ -1385,8 +1377,6 @@ ALLDEPFILES = \
libunwind-frame.c \
lynx-nat.c m3-nat.c \
m68hc11-tdep.c \
- m32r-tdep.c \
- m32r-linux-nat.c m32r-linux-tdep.c \
m68k-tdep.c \
m68kbsd-nat.c m68kbsd-tdep.c \
m88k-tdep.c m88kbsd-nat.c \
@@ -1442,14 +1432,6 @@ main.o: main.c
$(CC) -c $(INTERNAL_CFLAGS) $(TARGET_SYSTEM_ROOT_DEFINE) \
-DBINDIR=\"$(bindir)\" $(srcdir)/main.c
-# FIXME: cagney/2004-09-16: "gnu-v3-abi.c", with a GCC 3.4 compiler,
-# gets a "assignment from incompatible pointer type" warning. The
-# return types - "enum gnu_v3_dtor_kinds" vs "enum ctor_kinds" -
-# conflict.
-gnu-v3-abi.o: $(srcdir)/gnu-v3-abi.c
- $(CC) -c $(INTERNAL_WARN_CFLAGS) $(NO_WERROR_CFLAGS) \
- $(srcdir)/gnu-v3-abi.c
-
# FIXME: cagney/2003-08-10: "monitor.c" gets -Wformat-nonliteral
# errors. It turns out that that is the least of monitor.c's
# problems. The function print_vsprintf appears to be using
@@ -1575,31 +1557,21 @@ po/$(PACKAGE).pot: force
-e '/extern.*realloc/d' \
-e '/extern.*free/d' \
-e '/include.*malloc.h/d' \
- -e 's/\([^x]\)malloc/\1xmalloc/g' \
- -e 's/\([^x]\)realloc/\1xrealloc/g' \
+ -e 's/malloc/xmalloc/g' \
+ -e 's/realloc/xrealloc/g' \
-e '/^#line.*y.tab.c/d' \
< $@.tmp > $@.new
-rm $@.tmp
mv $@.new ./$*.c
.l.c:
- if [ "$(FLEX)" ] && $(FLEX) --version >/dev/null 2>&1; then \
- $(FLEX) -o$@ $< && \
- rm -f $@.new && \
- sed -e '/extern.*malloc/d' \
- -e '/extern.*realloc/d' \
- -e '/extern.*free/d' \
- -e '/include.*malloc.h/d' \
- -e 's/\([^x]\)malloc/\1xmalloc/g' \
- -e 's/\([^x]\)realloc/\1xrealloc/g' \
- -e 's/yy_flex_xrealloc/yyxrealloc/g' \
- < $@ > $@.new && \
- rm -f $@ && \
- mv $@.new $@; \
- elif [ -f $@ ]; then \
- echo "Warning: $*.c older than $*.l and flex not available."; \
- else \
- echo "$@ missing and flex not available."; \
+ @if [ "$(FLEX)" ] && $(FLEX) --version >/dev/null 2>&1; then \
+ echo $(FLEX) -Isit $< ">" $@; \
+ $(FLEX) -Isit $< > $@; \
+ elif [ ! -f $@ -a ! -f $< ]; then \
+ echo "ada-lex.c missing and flex not available."; \
false; \
+ elif [ ! -f $@ ]; then \
+ echo "Warning: $*.c older than $*.l and flex not available."; \
fi
.PRECIOUS: ada-exp.c ada-lex.c
@@ -1626,6 +1598,7 @@ ada-lang.o: ada-lang.c $(defs_h) $(gdb_string_h) $(demangle_h) \
$(gdbcore_h) $(hashtab_h) $(gdb_obstack_h) $(ada_lang_h) \
$(completer_h) $(gdb_stat_h) $(ui_out_h) $(block_h) $(infcall_h) \
$(dictionary_h)
+ada-lex.o: ada-lex.c $(gdb_string_h)
ada-typeprint.o: ada-typeprint.c $(defs_h) $(gdb_obstack_h) $(bfd_h) \
$(symtab_h) $(gdbtypes_h) $(expression_h) $(value_h) $(gdbcore_h) \
$(target_h) $(command_h) $(gdbcmd_h) $(language_h) $(demangle_h) \
@@ -1661,11 +1634,9 @@ alpha-tdep.o: alpha-tdep.c $(defs_h) $(doublest_h) $(frame_h) \
$(regcache_h) $(reggroups_h) $(arch_utils_h) $(osabi_h) $(block_h) \
$(infcall_h) $(elf_bfd_h) $(alpha_tdep_h)
amd64bsd-nat.o: amd64bsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
- $(target_h) $(gdb_assert_h) $(amd64_tdep_h) $(amd64_nat_h) \
- $(inf_ptrace_h)
+ $(gdb_assert_h) $(amd64_tdep_h) $(amd64_nat_h)
amd64fbsd-nat.o: amd64fbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
- $(target_h) $(gdb_assert_h) $(fbsd_nat_h) $(amd64_tdep_h) \
- $(amd64_nat_h) $(bsd_kvm_h)
+ $(gdb_assert_h) $(amd64_tdep_h) $(amd64_nat_h) $(bsd_kvm_h)
amd64fbsd-tdep.o: amd64fbsd-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) \
$(gdbcore_h) $(regcache_h) $(osabi_h) $(gdb_string_h) \
$(amd64_tdep_h) $(solib_svr4_h)
@@ -1678,14 +1649,13 @@ amd64-linux-tdep.o: amd64-linux-tdep.c $(defs_h) $(frame_h) $(gdbcore_h) \
$(solib_svr4_h)
amd64-nat.o: amd64-nat.c $(defs_h) $(gdbarch_h) $(regcache_h) \
$(gdb_assert_h) $(gdb_string_h) $(i386_tdep_h) $(amd64_tdep_h)
-amd64nbsd-nat.o: amd64nbsd-nat.c $(defs_h) $(target_h) $(gdb_assert_h) \
- $(amd64_tdep_h) $(amd64_nat_h)
+amd64nbsd-nat.o: amd64nbsd-nat.c $(defs_h) $(gdb_assert_h) $(amd64_tdep_h) \
+ $(amd64_nat_h)
amd64nbsd-tdep.o: amd64nbsd-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) \
$(gdbcore_h) $(osabi_h) $(symtab_h) $(gdb_assert_h) $(amd64_tdep_h) \
$(nbsd_tdep_h) $(solib_svr4_h)
amd64obsd-nat.o: amd64obsd-nat.c $(defs_h) $(gdbcore_h) $(regcache_h) \
- $(target_h) $(gdb_assert_h) $(amd64_tdep_h) $(amd64_nat_h) \
- $(bsd_kvm_h)
+ $(gdb_assert_h) $(amd64_tdep_h) $(amd64_nat_h) $(bsd_kvm_h)
amd64obsd-tdep.o: amd64obsd-tdep.c $(defs_h) $(frame_h) $(gdbcore_h) \
$(symtab_h) $(objfiles_h) $(osabi_h) $(regset_h) $(target_h) \
$(gdb_assert_h) $(gdb_string_h) $(amd64_tdep_h) $(i387_tdep_h) \
@@ -1866,8 +1836,7 @@ dwarf2read.o: dwarf2read.c $(defs_h) $(bfd_h) $(symtab_h) $(gdbtypes_h) \
$(objfiles_h) $(elf_dwarf2_h) $(buildsym_h) $(demangle_h) \
$(expression_h) $(filenames_h) $(macrotab_h) $(language_h) \
$(complaints_h) $(bcache_h) $(dwarf2expr_h) $(dwarf2loc_h) \
- $(cp_support_h) $(hashtab_h) $(command_h) $(gdbcmd_h) \
- $(gdb_string_h) $(gdb_assert_h)
+ $(cp_support_h) $(hashtab_h) $(gdb_string_h) $(gdb_assert_h)
dwarfread.o: dwarfread.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(objfiles_h) \
$(elf_dwarf_h) $(buildsym_h) $(demangle_h) $(expression_h) \
$(language_h) $(complaints_h) $(gdb_string_h)
@@ -1891,9 +1860,8 @@ exec.o: exec.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) $(gdbcmd_h) \
expprint.o: expprint.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \
$(value_h) $(language_h) $(parser_defs_h) $(user_regs_h) $(target_h) \
$(gdb_string_h) $(block_h)
-fbsd-nat.o: fbsd-nat.c $(defs_h) $(gdbcore_h) $(inferior_h) $(regcache_h) \
- $(regset_h) $(gdb_assert_h) $(gdb_string_h) $(elf_bfd_h) \
- $(fbsd_nat_h)
+fbsd-proc.o: fbsd-proc.c $(defs_h) $(gdbcore_h) $(inferior_h) $(regcache_h) \
+ $(regset_h) $(gdb_assert_h) $(gdb_string_h) $(elf_bfd_h)
f-exp.o: f-exp.c $(defs_h) $(gdb_string_h) $(expression_h) $(value_h) \
$(parser_defs_h) $(language_h) $(f_lang_h) $(bfd_h) $(symfile_h) \
$(objfiles_h) $(block_h)
@@ -1992,20 +1960,18 @@ hpread.o: hpread.c $(defs_h) $(bfd_h) $(gdb_string_h) $(hp_symtab_h) \
hpux-thread.o: hpux-thread.c $(defs_h) $(gdbthread_h) $(target_h) \
$(inferior_h) $(regcache_h) $(gdb_stat_h) $(gdbcore_h)
i386bsd-nat.o: i386bsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
- $(gdb_assert_h) $(i386_tdep_h) $(i387_tdep_h) $(i386bsd_nat_h) \
- $(inf_ptrace_h)
+ $(gdb_assert_h) $(i386_tdep_h) $(i387_tdep_h)
i386bsd-tdep.o: i386bsd-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) \
$(gdbcore_h) $(regcache_h) $(osabi_h) $(gdb_string_h) $(i386_tdep_h)
i386-cygwin-tdep.o: i386-cygwin-tdep.c $(defs_h) $(osabi_h) $(gdb_string_h) \
$(i386_tdep_h)
i386fbsd-nat.o: i386fbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
- $(target_h) $(fbsd_nat_h) $(i386_tdep_h) $(i386bsd_nat_h) \
- $(bsd_kvm_h)
+ $(i386_tdep_h) $(bsd_kvm_h)
i386fbsd-tdep.o: i386fbsd-tdep.c $(defs_h) $(arch_utils_h) $(osabi_h) \
$(i386_tdep_h) $(i387_tdep_h) $(solib_svr4_h)
i386gnu-nat.o: i386gnu-nat.c $(defs_h) $(inferior_h) $(floatformat_h) \
- $(regcache_h) $(gdb_assert_h) $(gdb_string_h) $(i386_tdep_h) \
- $(gnu_nat_h) $(i387_tdep_h) $(gregset_h)
+ $(regcache_h) $(gdb_assert_h) $(i386_tdep_h) $(gnu_nat_h) \
+ $(i387_tdep_h) $(gregset_h)
i386gnu-tdep.o: i386gnu-tdep.c $(defs_h) $(osabi_h) $(i386_tdep_h)
i386-linux-nat.o: i386-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \
$(regcache_h) $(linux_nat_h) $(gdb_assert_h) $(gdb_string_h) \
@@ -2019,7 +1985,7 @@ i386ly-tdep.o: i386ly-tdep.c $(defs_h) $(gdbcore_h) $(inferior_h) \
$(regcache_h) $(target_h) $(osabi_h) $(i386_tdep_h)
i386-nat.o: i386-nat.c $(defs_h) $(breakpoint_h) $(command_h) $(gdbcmd_h)
i386nbsd-nat.o: i386nbsd-nat.c $(defs_h) $(gdbcore_h) $(regcache_h) \
- $(target_h) $(i386_tdep_h) $(i386bsd_nat_h) $(bsd_kvm_h)
+ $(i386_tdep_h) $(bsd_kvm_h)
i386nbsd-tdep.o: i386nbsd-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) \
$(gdbcore_h) $(regcache_h) $(regset_h) $(osabi_h) $(symtab_h) \
$(gdb_assert_h) $(gdb_string_h) $(i386_tdep_h) $(i387_tdep_h) \
@@ -2069,7 +2035,7 @@ infcall.o: infcall.c $(defs_h) $(breakpoint_h) $(target_h) $(regcache_h) \
$(objfiles_h) $(gdbcmd_h) $(command_h) $(gdb_string_h) $(infcall_h) \
$(dummy_frame_h)
inf-child.o: inf-child.c $(defs_h) $(regcache_h) $(memattr_h) $(symtab_h) \
- $(target_h) $(inferior_h) $(gdb_string_h)
+ $(target_h) $(inferior_h)
infcmd.o: infcmd.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \
$(frame_h) $(inferior_h) $(environ_h) $(value_h) $(gdbcmd_h) \
$(symfile_h) $(gdbcore_h) $(target_h) $(language_h) $(symfile_h) \
@@ -2083,7 +2049,7 @@ inflow.o: inflow.c $(defs_h) $(frame_h) $(inferior_h) $(command_h) \
$(inflow_h)
inf-ptrace.o: inf-ptrace.c $(defs_h) $(observer_h) $(gdb_ptrace_h) \
$(inflow_h) $(inferior_h) $(regcache_h) $(command_h) $(gdbcore_h) \
- $(inf_child_h) $(gdbcmd_h) $(gdb_string_h) $(gdb_wait_h)
+ $(inf_child_h) $(gdbcmd_h)
infptrace.o: infptrace.c $(defs_h) $(command_h) $(frame_h) $(gdbcore_h) \
$(inferior_h) $(regcache_h) $(target_h) $(gdb_assert_h) \
$(gdb_wait_h) $(gdb_string_h) $(gdb_dirent_h) $(gdb_ptrace_h)
@@ -2130,10 +2096,14 @@ linespec.o: linespec.c $(defs_h) $(symtab_h) $(frame_h) $(command_h) \
$(symfile_h) $(objfiles_h) $(source_h) $(demangle_h) $(value_h) \
$(completer_h) $(cp_abi_h) $(parser_defs_h) $(block_h) \
$(objc_lang_h) $(linespec_h)
-linux-nat.o: linux-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdb_string_h) \
- $(gdb_wait_h) $(gdb_assert_h) $(linux_nat_h) $(gdbthread_h) \
- $(gdbcmd_h) $(regcache_h) $(elf_bfd_h) $(gregset_h) $(gdbcore_h) \
- $(gdbthread_h) $(gdb_stat_h)
+lin-lwp.o: lin-lwp.c $(defs_h) $(gdb_assert_h) $(gdb_string_h) $(gdb_wait_h) \
+ $(gdbthread_h) $(inferior_h) $(target_h) $(regcache_h) $(gdbcmd_h) \
+ $(linux_nat_h)
+linux-nat.o: linux-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdb_wait_h) \
+ $(linux_nat_h)
+linux-proc.o: linux-proc.c $(defs_h) $(inferior_h) $(gdb_stat_h) \
+ $(regcache_h) $(gregset_h) $(gdbcore_h) $(gdbthread_h) $(elf_bfd_h) \
+ $(cli_decode_h) $(gdb_string_h) $(linux_nat_h)
lynx-nat.o: lynx-nat.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \
$(gdbcore_h) $(regcache_h)
m2-exp.o: m2-exp.c $(defs_h) $(gdb_string_h) $(expression_h) $(language_h) \
@@ -2146,13 +2116,6 @@ m2-typeprint.o: m2-typeprint.c $(defs_h) $(bfd_h) $(symtab_h) $(gdbtypes_h) \
$(expression_h) $(value_h) $(gdbcore_h) $(target_h) $(m2_lang_h)
m2-valprint.o: m2-valprint.c $(defs_h) $(symtab_h) $(gdbtypes_h) \
$(m2_lang_h)
-m32r-linux-nat.o: m32r-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \
- $(regcache_h) $(linux_nat_h) $(gdb_assert_h) $(gdb_string_h) \
- $(gregset_h) $(m32r_tdep_h)
-m32r-linux-tdep.o: m32r-linux-tdep.c $(defs_h) $(gdbcore_h) $(frame_h) \
- $(value_h) $(regcache_h) $(inferior_h) $(osabi_h) $(reggroups_h) \
- $(gdb_string_h) $(glibc_tdep_h) $(solib_svr4_h) $(trad_frame_h) \
- $(frame_unwind_h) $(m32r_tdep_h)
m32r-rom.o: m32r-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \
$(serial_h) $(symtab_h) $(command_h) $(gdbcmd_h) $(symfile_h) \
$(gdb_string_h) $(objfiles_h) $(inferior_h) $(regcache_h)
@@ -2161,7 +2124,7 @@ m32r-tdep.o: m32r-tdep.c $(defs_h) $(frame_h) $(frame_unwind_h) \
$(frame_base_h) $(symtab_h) $(gdbtypes_h) $(gdbcmd_h) $(gdbcore_h) \
$(gdb_string_h) $(value_h) $(inferior_h) $(symfile_h) $(objfiles_h) \
$(language_h) $(arch_utils_h) $(regcache_h) $(trad_frame_h) \
- $(dis_asm_h) $(gdb_assert_h) $(m32r_tdep_h)
+ $(dis_asm_h) $(gdb_assert_h)
m68hc11-tdep.o: m68hc11-tdep.c $(defs_h) $(frame_h) $(frame_unwind_h) \
$(frame_base_h) $(dwarf2_frame_h) $(trad_frame_h) $(symtab_h) \
$(gdbtypes_h) $(gdbcmd_h) $(gdbcore_h) $(gdb_string_h) $(value_h) \
@@ -2188,7 +2151,7 @@ m68k-tdep.o: m68k-tdep.c $(defs_h) $(dwarf2_frame_h) $(frame_h) \
$(inferior_h) $(regcache_h) $(arch_utils_h) $(osabi_h) $(dis_asm_h) \
$(m68k_tdep_h) $(gregset_h)
m88kbsd-nat.o: m88kbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
- $(target_h) $(m88k_tdep_h) $(inf_ptrace_h)
+ $(m88k_tdep_h)
m88k-tdep.o: m88k-tdep.c $(defs_h) $(arch_utils_h) $(dis_asm_h) $(frame_h) \
$(frame_base_h) $(frame_unwind_h) $(gdbcore_h) $(gdbtypes_h) \
$(regcache_h) $(regset_h) $(symtab_h) $(trad_frame_h) $(value_h) \
@@ -2531,18 +2494,18 @@ sparc64fbsd-tdep.o: sparc64fbsd-tdep.c $(defs_h) $(frame_h) \
sparc64-linux-nat.o: sparc64-linux-nat.c $(defs_h) $(sparc64_tdep_h) \
$(sparc_nat_h)
sparc64-linux-tdep.o: sparc64-linux-tdep.c $(defs_h) $(gdbarch_h) $(osabi_h) \
- $(sparc64_tdep_h)
+ $(solib_svr4_h) $(sparc64_tdep_h)
sparc64-nat.o: sparc64-nat.c $(defs_h) $(gdbarch_h) $(sparc64_tdep_h) \
$(sparc_nat_h)
-sparc64nbsd-nat.o: sparc64nbsd-nat.c $(defs_h) $(regcache_h) $(target_h) \
+sparc64nbsd-nat.o: sparc64nbsd-nat.c $(defs_h) $(regcache_h) \
$(sparc64_tdep_h) $(sparc_nat_h) $(bsd_kvm_h)
sparc64nbsd-tdep.o: sparc64nbsd-tdep.c $(defs_h) $(frame_h) \
$(frame_unwind_h) $(gdbcore_h) $(osabi_h) $(regcache_h) $(regset_h) \
- $(symtab_h) $(objfiles_h) $(solib_svr4_h) $(trad_frame_h) \
- $(gdb_assert_h) $(gdb_string_h) $(sparc64_tdep_h) $(nbsd_tdep_h)
+ $(symtab_h) $(solib_svr4_h) $(trad_frame_h) $(gdb_assert_h) \
+ $(gdb_string_h) $(sparc64_tdep_h) $(nbsd_tdep_h)
sparc64obsd-tdep.o: sparc64obsd-tdep.c $(defs_h) $(frame_h) \
- $(frame_unwind_h) $(osabi_h) $(regset_h) $(symtab_h) $(objfiles_h) \
- $(solib_svr4_h) $(trad_frame_h) $(gdb_assert_h) $(sparc64_tdep_h)
+ $(frame_unwind_h) $(osabi_h) $(regset_h) $(symtab_h) $(solib_svr4_h) \
+ $(trad_frame_h) $(gdb_assert_h) $(sparc64_tdep_h) $(nbsd_tdep_h)
sparc64-sol2-tdep.o: sparc64-sol2-tdep.c $(defs_h) $(frame_h) \
$(frame_unwind_h) $(gdbarch_h) $(symtab_h) $(objfiles_h) $(osabi_h) \
$(trad_frame_h) $(gdb_assert_h) $(sparc64_tdep_h) $(solib_svr4_h)
@@ -2557,8 +2520,8 @@ sparc-linux-tdep.o: sparc-linux-tdep.c $(defs_h) $(floatformat_h) $(frame_h) \
$(gdb_string_h) $(sparc_tdep_h)
sparc-nat.o: sparc-nat.c $(defs_h) $(inferior_h) $(regcache_h) $(target_h) \
$(gdb_assert_h) $(gdb_string_h) $(gdb_wait_h) $(sparc_tdep_h) \
- $(sparc_nat_h) $(inf_ptrace_h)
-sparcnbsd-nat.o: sparcnbsd-nat.c $(defs_h) $(regcache_h) $(target_h) \
+ $(sparc_nat_h)
+sparcnbsd-nat.o: sparcnbsd-nat.c $(defs_h) $(gdbcore_h) $(regcache_h) \
$(sparc_tdep_h) $(sparc_nat_h) $(bsd_kvm_h)
sparcnbsd-tdep.o: sparcnbsd-tdep.c $(defs_h) $(floatformat_h) $(frame_h) \
$(frame_unwind_h) $(gdbcore_h) $(osabi_h) $(regcache_h) $(regset_h) \
@@ -2609,9 +2572,8 @@ symtab.o: symtab.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(gdbcore_h) \
$(frame_h) $(target_h) $(value_h) $(symfile_h) $(objfiles_h) \
$(gdbcmd_h) $(call_cmds_h) $(gdb_regex_h) $(expression_h) \
$(language_h) $(demangle_h) $(inferior_h) $(linespec_h) $(source_h) \
- $(filenames_h) $(objc_lang_h) $(ada_lang_h) $(hashtab_h) \
- $(gdb_obstack_h) $(block_h) $(dictionary_h) $(gdb_string_h) \
- $(gdb_stat_h) $(cp_abi_h)
+ $(filenames_h) $(objc_lang_h) $(hashtab_h) $(gdb_obstack_h) \
+ $(block_h) $(dictionary_h) $(gdb_string_h) $(gdb_stat_h) $(cp_abi_h)
target.o: target.c $(defs_h) $(gdb_string_h) $(target_h) $(gdbcmd_h) \
$(symtab_h) $(inferior_h) $(bfd_h) $(symfile_h) $(objfiles_h) \
$(gdb_wait_h) $(dcache_h) $(regcache_h) $(gdb_assert_h) $(gdbcore_h)
@@ -2677,8 +2639,8 @@ values.o: values.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \
$(gdb_assert_h) $(regcache_h) $(block_h)
varobj.o: varobj.c $(defs_h) $(value_h) $(expression_h) $(frame_h) \
$(language_h) $(wrapper_h) $(gdbcmd_h) $(gdb_string_h) $(varobj_h)
-vaxbsd-nat.o: vaxbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) $(target_h) \
- $(vax_tdep_h) $(inf_ptrace_h) $(bsd_kvm_h)
+vaxbsd-nat.o: vaxbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
+ $(vax_tdep_h) $(bsd_kvm_h)
vax-nat.o: vax-nat.c $(defs_h) $(inferior_h) $(gdb_assert_h) $(vax_tdep_h)
vaxnbsd-tdep.o: vaxnbsd-tdep.c $(defs_h) $(arch_utils_h) $(osabi_h) \
$(vax_tdep_h) $(solib_svr4_h) $(gdb_string_h)
@@ -2703,11 +2665,9 @@ xcoffread.o: xcoffread.c $(defs_h) $(bfd_h) $(gdb_string_h) $(gdb_stat_h) \
$(complaints_h) $(gdb_stabs_h) $(aout_stab_gnu_h)
xcoffsolib.o: xcoffsolib.c $(defs_h) $(bfd_h) $(xcoffsolib_h) $(inferior_h) \
$(gdbcmd_h) $(symfile_h) $(frame_h) $(gdb_regex_h)
-xstormy16-tdep.o: xstormy16-tdep.c $(defs_h) $(frame_h) $(frame_base_h) \
- $(frame_unwind_h) $(dwarf2_frame_h) $(symtab_h) $(gdbtypes_h) \
- $(gdbcmd_h) $(gdbcore_h) $(value_h) $(dis_asm_h) $(inferior_h) \
- $(gdb_string_h) $(gdb_assert_h) $(arch_utils_h) $(floatformat_h) \
- $(regcache_h) $(doublest_h) $(osabi_h) $(objfiles_h)
+xstormy16-tdep.o: xstormy16-tdep.c $(defs_h) $(value_h) $(inferior_h) \
+ $(arch_utils_h) $(regcache_h) $(gdbcore_h) $(objfiles_h) \
+ $(dis_asm_h)
#
# gdb/cli/ dependencies
diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y
index bb9e41c..9e91817 100644
--- a/gdb/ada-exp.y
+++ b/gdb/ada-exp.y
@@ -126,22 +126,6 @@ static void write_object_renaming (struct block *, struct symbol *, int);
static void write_var_from_name (struct block *, struct name_info);
static LONGEST convert_char_literal (struct type *, LONGEST);
-
-static struct type *type_int (void);
-
-static struct type *type_long (void);
-
-static struct type *type_long_long (void);
-
-static struct type *type_float (void);
-
-static struct type *type_double (void);
-
-static struct type *type_long_double (void);
-
-static struct type *type_char (void);
-
-static struct type *type_system_address (void);
%}
%union
@@ -442,17 +426,17 @@ simple_exp : simple_exp TICK_ACCESS
| simple_exp TICK_ADDRESS
{ write_exp_elt_opcode (UNOP_ADDR);
write_exp_elt_opcode (UNOP_CAST);
- write_exp_elt_type (type_system_address ());
+ write_exp_elt_type (builtin_type_ada_system_address);
write_exp_elt_opcode (UNOP_CAST);
}
| simple_exp TICK_FIRST tick_arglist
- { write_int ($3, type_int ());
+ { write_int ($3, builtin_type_int);
write_exp_elt_opcode (OP_ATR_FIRST); }
| simple_exp TICK_LAST tick_arglist
- { write_int ($3, type_int ());
+ { write_int ($3, builtin_type_int);
write_exp_elt_opcode (OP_ATR_LAST); }
| simple_exp TICK_LENGTH tick_arglist
- { write_int ($3, type_int ());
+ { write_int ($3, builtin_type_int);
write_exp_elt_opcode (OP_ATR_LENGTH); }
| simple_exp TICK_SIZE
{ write_exp_elt_opcode (OP_ATR_SIZE); }
@@ -465,13 +449,13 @@ simple_exp : simple_exp TICK_ACCESS
| opt_type_prefix TICK_POS '(' exp ')'
{ write_exp_elt_opcode (OP_ATR_POS); }
| type_prefix TICK_FIRST tick_arglist
- { write_int ($3, type_int ());
+ { write_int ($3, builtin_type_int);
write_exp_elt_opcode (OP_ATR_FIRST); }
| type_prefix TICK_LAST tick_arglist
- { write_int ($3, type_int ());
+ { write_int ($3, builtin_type_int);
write_exp_elt_opcode (OP_ATR_LAST); }
| type_prefix TICK_LENGTH tick_arglist
- { write_int ($3, type_int ());
+ { write_int ($3, builtin_type_int);
write_exp_elt_opcode (OP_ATR_LENGTH); }
| type_prefix TICK_VAL '(' exp ')'
{ write_exp_elt_opcode (OP_ATR_VAL); }
@@ -521,7 +505,7 @@ exp : FLOAT
;
exp : NULL_PTR
- { write_int (0, type_int ()); }
+ { write_int (0, builtin_type_int); }
;
exp : STRING
@@ -682,8 +666,8 @@ write_var_from_name (struct block *orig_left_context,
if (name.msym != NULL)
{
write_exp_msymbol (name.msym,
- lookup_function_type (type_int ()),
- type_int ());
+ lookup_function_type (builtin_type_int),
+ builtin_type_int);
}
else if (name.sym == NULL)
{
@@ -795,7 +779,7 @@ write_object_renaming (struct block *orig_left_context,
goto BadEncoding;
suffix = next;
write_exp_elt_opcode (OP_LONG);
- write_exp_elt_type (type_int ());
+ write_exp_elt_type (builtin_type_ada_int);
write_exp_elt_longcst ((LONGEST) val);
write_exp_elt_opcode (OP_LONG);
}
@@ -852,7 +836,7 @@ write_object_renaming (struct block *orig_left_context,
if (end == NULL)
end = suffix + strlen (suffix);
field_name.length = end - suffix;
- field_name.ptr = xmalloc (end - suffix + 1);
+ field_name.ptr = (char *) malloc (end - suffix + 1);
strncpy (field_name.ptr, suffix, end - suffix);
field_name.ptr[end - suffix] = '\000';
suffix = end;
@@ -895,70 +879,8 @@ convert_char_literal (struct type *type, LONGEST val)
return val;
}
-static struct type *
-type_int (void)
-{
- return builtin_type (current_gdbarch)->builtin_int;
-}
-
-static struct type *
-type_long (void)
-{
- return builtin_type (current_gdbarch)->builtin_long;
-}
-
-static struct type *
-type_long_long (void)
-{
- return builtin_type (current_gdbarch)->builtin_long_long;
-}
-
-static struct type *
-type_float (void)
-{
- return builtin_type (current_gdbarch)->builtin_float;
-}
-
-static struct type *
-type_double (void)
-{
- return builtin_type (current_gdbarch)->builtin_double;
-}
-
-static struct type *
-type_long_double (void)
-{
- return builtin_type (current_gdbarch)->builtin_long_double;
-}
-
-static struct type *
-type_char (void)
-{
- return language_string_char_type (current_language, current_gdbarch);
-}
-
-static struct type *
-type_system_address (void)
-{
- struct type *type
- = language_lookup_primitive_type_by_name (current_language,
- current_gdbarch,
- "system__address");
- return type != NULL ? type : lookup_pointer_type (builtin_type_void);
-}
-
void
_initialize_ada_exp (void)
{
obstack_init (&temp_parse_space);
}
-
-/* FIXME: hilfingr/2004-10-05: Hack to remove warning. The function
- string_to_operator is supposed to be used for cases where one
- calls an operator function with prefix notation, as in
- "+" (a, b), but at some point, this code seems to have gone
- missing. */
-
-struct stoken (*dummy_string_to_ada_operator) (struct stoken)
- = string_to_operator;
-
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 275e3a0..51c5fb7 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -19,6 +19,18 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+/* Sections of code marked
+
+ #ifdef GNAT_GDB
+ ...
+ #endif
+
+ indicate sections that are used in sources distributed by
+ ACT, Inc., but not yet integrated into the public tree (where
+ GNAT_GDB is not defined). They are retained here nevertheless
+ to minimize the problems of maintaining different versions
+ of the source and to make the full source available. */
+
#include "defs.h"
#include <stdio.h>
#include "gdb_string.h"
@@ -63,8 +75,27 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define TRUNCATION_TOWARDS_ZERO ((-5 / 2) == -2)
#endif
+#ifdef GNAT_GDB
+/* A structure that contains a vector of strings.
+ The main purpose of this type is to group the vector and its
+ associated parameters in one structure. This makes it easier
+ to handle and pass around. */
+
+struct string_vector
+{
+ char **array; /* The vector itself. */
+ int index; /* Index of the next available element in the array. */
+ size_t size; /* The number of entries allocated in the array. */
+};
+static struct string_vector xnew_string_vector (int initial_size);
+static void string_vector_append (struct string_vector *sv, char *str);
+#endif /* GNAT_GDB */
+
+static const char *ada_unqualified_name (const char *decoded_name);
+static char *add_angle_brackets (const char *str);
static void extract_string (CORE_ADDR addr, char *buf);
+static char *function_name_from_pc (CORE_ADDR pc);
static struct type *ada_create_fundamental_type (struct objfile *, int);
@@ -153,11 +184,16 @@ static int discrete_type_p (struct type *);
static struct type *ada_lookup_struct_elt_type (struct type *, char *,
int, int, int *);
+static char *extended_canonical_line_spec (struct symtab_and_line,
+ const char *);
+
static struct value *evaluate_subexp (struct type *, struct expression *,
int *, enum noside);
static struct value *evaluate_subexp_type (struct expression *, int *);
+static struct type *ada_create_fundamental_type (struct objfile *, int);
+
static int is_dynamic_field (struct type *, int);
static struct type *to_fixed_variant_branch_type (struct type *, char *,
@@ -194,6 +230,19 @@ static int is_name_suffix (const char *);
static int wild_match (const char *, int, const char *);
+static struct symtabs_and_lines
+find_sal_from_funcs_and_line (const char *, int,
+ struct ada_symbol_info *, int);
+
+static int find_line_in_linetable (struct linetable *, int,
+ struct ada_symbol_info *, int, int *);
+
+static int find_next_line_in_linetable (struct linetable *, int, int, int);
+
+static void read_all_symtabs (const char *);
+
+static int is_plausible_func_for_line (struct symbol *, int);
+
static struct value *ada_coerce_ref (struct value *);
static LONGEST pos_atr (struct value *);
@@ -219,6 +268,8 @@ static struct value *ada_to_fixed_value_create (struct type *, CORE_ADDR,
static struct value *ada_to_fixed_value (struct value *);
+static void adjust_pc_past_prologue (CORE_ADDR *);
+
static int ada_resolve_function (struct ada_symbol_info *, int,
struct value **, int, const char *,
struct type *);
@@ -227,10 +278,9 @@ static struct value *ada_coerce_to_simple_array (struct value *);
static int ada_is_direct_array_type (struct type *);
-static void ada_language_arch_info (struct gdbarch *,
- struct language_arch_info *);
+static void error_breakpoint_runtime_sym_not_found (const char *err_desc);
-static void check_size (const struct type *);
+static int is_runtime_sym_defined (const char *name, int allow_tramp);
@@ -293,6 +343,69 @@ static struct obstack symbol_list_obstack;
/* Utilities */
+#ifdef GNAT_GDB
+
+/* Create a new empty string_vector struct with an initial size of
+ INITIAL_SIZE. */
+
+static struct string_vector
+xnew_string_vector (int initial_size)
+{
+ struct string_vector result;
+
+ result.array = (char **) xmalloc ((initial_size + 1) * sizeof (char *));
+ result.index = 0;
+ result.size = initial_size;
+
+ return result;
+}
+
+/* Add STR at the end of the given string vector SV. If SV is already
+ full, its size is automatically increased (doubled). */
+
+static void
+string_vector_append (struct string_vector *sv, char *str)
+{
+ if (sv->index >= sv->size)
+ GROW_VECT (sv->array, sv->size, sv->size * 2);
+
+ sv->array[sv->index] = str;
+ sv->index++;
+}
+
+/* Given DECODED_NAME a string holding a symbol name in its
+ decoded form (ie using the Ada dotted notation), returns
+ its unqualified name. */
+
+static const char *
+ada_unqualified_name (const char *decoded_name)
+{
+ const char *result = strrchr (decoded_name, '.');
+
+ if (result != NULL)
+ result++; /* Skip the dot... */
+ else
+ result = decoded_name;
+
+ return result;
+}
+
+/* Return a string starting with '<', followed by STR, and '>'.
+ The result is good until the next call. */
+
+static char *
+add_angle_brackets (const char *str)
+{
+ static char *result = NULL;
+
+ xfree (result);
+ result = (char *) xmalloc ((strlen (str) + 3) * sizeof (char));
+
+ sprintf (result, "<%s>", str);
+ return result;
+}
+
+#endif /* GNAT_GDB */
static char *
ada_get_gdb_completer_word_break_characters (void)
@@ -319,6 +432,20 @@ extract_string (CORE_ADDR addr, char *buf)
while (buf[char_index - 1] != '\000');
}
+/* Return the name of the function owning the instruction located at PC.
+ Return NULL if no such function could be found. */
+
+static char *
+function_name_from_pc (CORE_ADDR pc)
+{
+ char *func_name;
+
+ if (!find_pc_partial_function (pc, &func_name, NULL, NULL))
+ return NULL;
+
+ return func_name;
+}
+
/* Assuming *OLD_VECT points to an array of *SIZE objects of size
ELEMENT_SIZE, grow it to contain at least MIN_SIZE objects,
updating *OLD_VECT and *SIZE as necessary. */
@@ -430,7 +557,7 @@ value_from_contents_and_address (struct type *type, char *valaddr,
static struct value *
coerce_unspec_val_to_type (struct value *val, struct type *type)
{
- type = ada_check_typedef (type);
+ CHECK_TYPEDEF (type);
if (VALUE_TYPE (val) == type)
return val;
else
@@ -439,7 +566,8 @@ coerce_unspec_val_to_type (struct value *val, struct type *type)
/* Make sure that the object size is not unreasonable before
trying to allocate some memory for it. */
- check_size (type);
+ if (TYPE_LENGTH (type) > varsize_limit)
+ error ("object size is larger than varsize-limit");
result = allocate_value (type);
VALUE_LVAL (result) = VALUE_LVAL (val);
@@ -478,36 +606,23 @@ cond_offset_target (CORE_ADDR address, long offset)
with exactly one argument rather than ...), unless the limit on the
number of warnings has passed during the evaluation of the current
expression. */
-
-/* FIXME: cagney/2004-10-10: This function is mimicking the behavior
- provided by "complaint". */
-static void lim_warning (const char *format, ...) ATTR_FORMAT (printf, 1, 2);
-
static void
-lim_warning (const char *format, ...)
+lim_warning (const char *format, long arg)
{
- va_list args;
- va_start (args, format);
-
warnings_issued += 1;
if (warnings_issued <= warning_limit)
- vwarning (format, args);
-
- va_end (args);
+ warning (format, arg);
}
-/* Issue an error if the size of an object of type T is unreasonable,
- i.e. if it would be a bad idea to allocate a value of this type in
- GDB. */
-
-static void
-check_size (const struct type *type)
+static const char *
+ada_translate_error_message (const char *string)
{
- if (TYPE_LENGTH (type) > varsize_limit)
- error ("object size is larger than varsize-limit");
+ if (strcmp (string, "Invalid cast.") == 0)
+ return "Invalid type conversion.";
+ else
+ return string;
}
-
/* Note: would have used MAX_OF_TYPE and MIN_OF_TYPE macros from
gdbtypes.h, but some of the necessary definitions in that file
seem to have gone missing. */
@@ -638,7 +753,6 @@ ada_main_name (void)
struct minimal_symbol *msym;
CORE_ADDR main_program_name_addr;
static char main_program_name[1024];
-
/* For Ada, the name of the main procedure is stored in a specific
string constant, generated by the binder. Look for that symbol,
extract its address, and then read that string. If we didn't find
@@ -1100,11 +1214,11 @@ desc_base_type (struct type *type)
{
if (type == NULL)
return NULL;
- type = ada_check_typedef (type);
+ CHECK_TYPEDEF (type);
if (type != NULL
&& (TYPE_CODE (type) == TYPE_CODE_PTR
|| TYPE_CODE (type) == TYPE_CODE_REF))
- return ada_check_typedef (TYPE_TARGET_TYPE (type));
+ return check_typedef (TYPE_TARGET_TYPE (type));
else
return type;
}
@@ -1182,13 +1296,13 @@ desc_bounds_type (struct type *type)
return NULL;
r = lookup_struct_elt_type (type, "BOUNDS", 1);
if (r != NULL)
- return ada_check_typedef (r);
+ return check_typedef (r);
}
else if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
{
r = lookup_struct_elt_type (type, "P_BOUNDS", 1);
if (r != NULL)
- return ada_check_typedef (TYPE_TARGET_TYPE (ada_check_typedef (r)));
+ return check_typedef (TYPE_TARGET_TYPE (check_typedef (r)));
}
return NULL;
}
@@ -1199,7 +1313,7 @@ desc_bounds_type (struct type *type)
static struct value *
desc_bounds (struct value *arr)
{
- struct type *type = ada_check_typedef (VALUE_TYPE (arr));
+ struct type *type = check_typedef (VALUE_TYPE (arr));
if (is_thin_pntr (type))
{
struct type *bounds_type =
@@ -1249,7 +1363,7 @@ fat_pntr_bounds_bitsize (struct type *type)
if (TYPE_FIELD_BITSIZE (type, 1) > 0)
return TYPE_FIELD_BITSIZE (type, 1);
else
- return 8 * TYPE_LENGTH (ada_check_typedef (TYPE_FIELD_TYPE (type, 1)));
+ return 8 * TYPE_LENGTH (check_typedef (TYPE_FIELD_TYPE (type, 1)));
}
/* If TYPE is the type of an array descriptor (fat or thin pointer) or a
@@ -1384,7 +1498,7 @@ ada_is_direct_array_type (struct type *type)
{
if (type == NULL)
return 0;
- type = ada_check_typedef (type);
+ CHECK_TYPEDEF (type);
return (TYPE_CODE (type) == TYPE_CODE_ARRAY
|| ada_is_array_descriptor_type (type));
}
@@ -1396,7 +1510,7 @@ ada_is_simple_array_type (struct type *type)
{
if (type == NULL)
return 0;
- type = ada_check_typedef (type);
+ CHECK_TYPEDEF (type);
return (TYPE_CODE (type) == TYPE_CODE_ARRAY
|| (TYPE_CODE (type) == TYPE_CODE_PTR
&& TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ARRAY));
@@ -1411,7 +1525,7 @@ ada_is_array_descriptor_type (struct type *type)
if (type == NULL)
return 0;
- type = ada_check_typedef (type);
+ CHECK_TYPEDEF (type);
return
data_type != NULL
&& ((TYPE_CODE (data_type) == TYPE_CODE_PTR
@@ -1456,7 +1570,7 @@ ada_type_of_array (struct value *arr, int bounds)
if (!bounds)
return
- ada_check_typedef (TYPE_TARGET_TYPE (desc_data_type (VALUE_TYPE (arr))));
+ check_typedef (TYPE_TARGET_TYPE (desc_data_type (VALUE_TYPE (arr))));
else
{
struct type *elt_type;
@@ -1468,7 +1582,7 @@ ada_type_of_array (struct value *arr, int bounds)
arity = ada_array_arity (VALUE_TYPE (arr));
if (elt_type == NULL || arity == 0)
- return ada_check_typedef (VALUE_TYPE (arr));
+ return check_typedef (VALUE_TYPE (arr));
descriptor = desc_bounds (arr);
if (value_as_long (descriptor) == 0)
@@ -1556,7 +1670,7 @@ ada_is_packed_array_type (struct type *type)
if (type == NULL)
return 0;
type = desc_base_type (type);
- type = ada_check_typedef (type);
+ CHECK_TYPEDEF (type);
return
ada_type_name (type) != NULL
&& strstr (ada_type_name (type), "___XP") != NULL;
@@ -1578,12 +1692,12 @@ packed_array_type (struct type *type, long *elt_bits)
struct type *new_type;
LONGEST low_bound, high_bound;
- type = ada_check_typedef (type);
+ CHECK_TYPEDEF (type);
if (TYPE_CODE (type) != TYPE_CODE_ARRAY)
return type;
new_type = alloc_type (TYPE_OBJFILE (type));
- new_elt_type = packed_array_type (ada_check_typedef (TYPE_TARGET_TYPE (type)),
+ new_elt_type = packed_array_type (check_typedef (TYPE_TARGET_TYPE (type)),
elt_bits);
create_array_type (new_type, new_elt_type, TYPE_FIELD_TYPE (type, 0));
TYPE_FIELD_BITSIZE (new_type, 0) = *elt_bits;
@@ -1612,7 +1726,7 @@ decode_packed_array_type (struct type *type)
{
struct symbol *sym;
struct block **blocks;
- const char *raw_name = ada_type_name (ada_check_typedef (type));
+ const char *raw_name = ada_type_name (check_typedef (type));
char *name = (char *) alloca (strlen (raw_name) + 1);
char *tail = strstr (raw_name, "___XP");
struct type *shadow_type;
@@ -1627,21 +1741,22 @@ decode_packed_array_type (struct type *type)
sym = standard_lookup (name, get_selected_block (0), VAR_DOMAIN);
if (sym == NULL || SYMBOL_TYPE (sym) == NULL)
{
- lim_warning ("could not find bounds information on packed array");
+ lim_warning ("could not find bounds information on packed array", 0);
return NULL;
}
shadow_type = SYMBOL_TYPE (sym);
if (TYPE_CODE (shadow_type) != TYPE_CODE_ARRAY)
{
- lim_warning ("could not understand bounds information on packed array");
+ lim_warning ("could not understand bounds information on packed array",
+ 0);
return NULL;
}
if (sscanf (tail + sizeof ("___XP") - 1, "%ld", &bits) != 1)
{
lim_warning
- ("could not understand bit size information on packed array");
+ ("could not understand bit size information on packed array", 0);
return NULL;
}
@@ -1669,31 +1784,6 @@ decode_packed_array (struct value *arr)
error ("can't unpack array");
return NULL;
}
-
- if (BITS_BIG_ENDIAN && ada_is_modular_type (VALUE_TYPE (arr)))
- {
- /* This is a (right-justified) modular type representing a packed
- array with no wrapper. In order to interpret the value through
- the (left-justified) packed array type we just built, we must
- first left-justify it. */
- int bit_size, bit_pos;
- ULONGEST mod;
-
- mod = ada_modulus (VALUE_TYPE (arr)) - 1;
- bit_size = 0;
- while (mod > 0)
- {
- bit_size += 1;
- mod >>= 1;
- }
- bit_pos = HOST_CHAR_BIT * TYPE_LENGTH (VALUE_TYPE (arr)) - bit_size;
- arr = ada_value_primitive_packed_val (arr, NULL,
- bit_pos / HOST_CHAR_BIT,
- bit_pos % HOST_CHAR_BIT,
- bit_size,
- type);
- }
-
return coerce_unspec_val_to_type (arr, type);
}
@@ -1712,7 +1802,7 @@ value_subscript_packed (struct value *arr, int arity, struct value **ind)
bits = 0;
elt_total_bit_offset = 0;
- elt_type = ada_check_typedef (VALUE_TYPE (arr));
+ elt_type = check_typedef (VALUE_TYPE (arr));
for (i = 0; i < arity; i += 1)
{
if (TYPE_CODE (elt_type) != TYPE_CODE_ARRAY
@@ -1727,7 +1817,7 @@ value_subscript_packed (struct value *arr, int arity, struct value **ind)
if (get_discrete_bounds (range_type, &lowerbound, &upperbound) < 0)
{
- lim_warning ("don't know bounds of array");
+ lim_warning ("don't know bounds of array", 0);
lowerbound = upperbound = 0;
}
@@ -1736,7 +1826,7 @@ value_subscript_packed (struct value *arr, int arity, struct value **ind)
lim_warning ("packed array index %ld out of bounds", (long) idx);
bits = TYPE_FIELD_BITSIZE (elt_type, 0);
elt_total_bit_offset += (idx - lowerbound) * bits;
- elt_type = ada_check_typedef (TYPE_TARGET_TYPE (elt_type));
+ elt_type = check_typedef (TYPE_TARGET_TYPE (elt_type));
}
}
elt_off = elt_total_bit_offset / HOST_CHAR_BIT;
@@ -1799,7 +1889,7 @@ ada_value_primitive_packed_val (struct value *obj, char *valaddr, long offset,
the indices move. */
int delta = BITS_BIG_ENDIAN ? -1 : 1;
- type = ada_check_typedef (type);
+ CHECK_TYPEDEF (type);
if (obj == NULL)
{
@@ -2057,7 +2147,7 @@ ada_value_subscript (struct value *arr, int arity, struct value **ind)
elt = ada_coerce_to_simple_array (arr);
- elt_type = ada_check_typedef (VALUE_TYPE (elt));
+ elt_type = check_typedef (VALUE_TYPE (elt));
if (TYPE_CODE (elt_type) == TYPE_CODE_ARRAY
&& TYPE_FIELD_BITSIZE (elt_type, 0) > 0)
return value_subscript_packed (elt, arity, ind);
@@ -2106,16 +2196,16 @@ ada_value_ptr_subscript (struct value *arr, struct type *type, int arity,
the Ada slice of HIGH-LOW+1 elements starting at index LOW. The lower
bound of this array is LOW, as per Ada rules. */
static struct value *
-ada_value_slice_ptr (struct value *array_ptr, struct type *type,
+ada_value_slice_ptr (struct value *array_ptr, struct type *type,
int low, int high)
{
- CORE_ADDR base = value_as_address (array_ptr)
+ CORE_ADDR base = value_as_address (array_ptr)
+ ((low - TYPE_LOW_BOUND (TYPE_INDEX_TYPE (type)))
* TYPE_LENGTH (TYPE_TARGET_TYPE (type)));
- struct type *index_type =
- create_range_type (NULL, TYPE_TARGET_TYPE (TYPE_INDEX_TYPE (type)),
+ struct type *index_type =
+ create_range_type (NULL, TYPE_TARGET_TYPE (TYPE_INDEX_TYPE (type)),
low, high);
- struct type *slice_type =
+ struct type *slice_type =
create_array_type (NULL, TYPE_TARGET_TYPE (type), index_type);
return value_from_pointer (lookup_reference_type (slice_type), base);
}
@@ -2125,11 +2215,11 @@ static struct value *
ada_value_slice (struct value *array, int low, int high)
{
struct type *type = VALUE_TYPE (array);
- struct type *index_type =
+ struct type *index_type =
create_range_type (NULL, TYPE_INDEX_TYPE (type), low, high);
- struct type *slice_type =
+ struct type *slice_type =
create_array_type (NULL, TYPE_TARGET_TYPE (type), index_type);
- return value_cast (slice_type, value_slice (array, low, high - low + 1));
+ return value_cast (slice_type, value_slice (array, low, high-low+1));
}
/* If type is a record type in the form of a standard GNAT array
@@ -2154,7 +2244,7 @@ ada_array_arity (struct type *type)
while (TYPE_CODE (type) == TYPE_CODE_ARRAY)
{
arity += 1;
- type = ada_check_typedef (TYPE_TARGET_TYPE (type));
+ type = check_typedef (TYPE_TARGET_TYPE (type));
}
return arity;
@@ -2187,7 +2277,7 @@ ada_array_element_type (struct type *type, int nindices)
p_array_type = TYPE_TARGET_TYPE (p_array_type);
while (k > 0 && p_array_type != NULL)
{
- p_array_type = ada_check_typedef (TYPE_TARGET_TYPE (p_array_type));
+ p_array_type = check_typedef (TYPE_TARGET_TYPE (p_array_type));
k -= 1;
}
return p_array_type;
@@ -2334,7 +2424,7 @@ ada_array_bound (struct value *arr, int n, int which)
struct value *
ada_array_length (struct value *arr, int n)
{
- struct type *arr_type = ada_check_typedef (VALUE_TYPE (arr));
+ struct type *arr_type = check_typedef (VALUE_TYPE (arr));
if (ada_is_packed_array_type (arr_type))
return ada_array_length (decode_packed_array (arr), n);
@@ -2349,7 +2439,7 @@ ada_array_length (struct value *arr, int n)
}
else
return
- value_from_longest (builtin_type_int,
+ value_from_longest (builtin_type_ada_int,
value_as_long (desc_one_bound (desc_bounds (arr),
n, 1))
- value_as_long (desc_one_bound (desc_bounds (arr),
@@ -2362,7 +2452,7 @@ ada_array_length (struct value *arr, int n)
static struct value *
empty_array (struct type *arr_type, int low)
{
- struct type *index_type =
+ struct type *index_type =
create_range_type (NULL, TYPE_TARGET_TYPE (TYPE_INDEX_TYPE (arr_type)),
low, low - 1);
struct type *elt_type = ada_array_element_type (arr_type, 1);
@@ -2782,8 +2872,8 @@ resolve_subexp (struct expression **expp, int *pos, int deprocedure_p,
static int
ada_type_match (struct type *ftype, struct type *atype, int may_deref)
{
- ftype = ada_check_typedef (ftype);
- atype = ada_check_typedef (atype);
+ CHECK_TYPEDEF (ftype);
+ CHECK_TYPEDEF (atype);
if (TYPE_CODE (ftype) == TYPE_CODE_REF)
ftype = TYPE_TARGET_TYPE (ftype);
@@ -2862,8 +2952,8 @@ ada_args_match (struct symbol *func, struct value **actuals, int n_actuals)
return 0;
else
{
- struct type *ftype = ada_check_typedef (TYPE_FIELD_TYPE (func_type, i));
- struct type *atype = ada_check_typedef (VALUE_TYPE (actuals[i]));
+ struct type *ftype = check_typedef (TYPE_FIELD_TYPE (func_type, i));
+ struct type *atype = check_typedef (VALUE_TYPE (actuals[i]));
if (!ada_type_match (ftype, atype, 1))
return 0;
@@ -2936,7 +3026,7 @@ ada_resolve_function (struct ada_symbol_info syms[],
{
for (k = 0; k < nsyms; k += 1)
{
- struct type *type = ada_check_typedef (SYMBOL_TYPE (syms[k].sym));
+ struct type *type = check_typedef (SYMBOL_TYPE (syms[k].sym));
if (ada_args_match (syms[k].sym, args, nargs)
&& return_match (type, return_type))
@@ -3335,9 +3425,9 @@ static int
possible_user_operator_p (enum exp_opcode op, struct value *args[])
{
struct type *type0 =
- (args[0] == NULL) ? NULL : ada_check_typedef (VALUE_TYPE (args[0]));
+ (args[0] == NULL) ? NULL : check_typedef (VALUE_TYPE (args[0]));
struct type *type1 =
- (args[1] == NULL) ? NULL : ada_check_typedef (VALUE_TYPE (args[1]));
+ (args[1] == NULL) ? NULL : check_typedef (VALUE_TYPE (args[1]));
if (type0 == NULL)
return 0;
@@ -3468,7 +3558,7 @@ ensure_lval (struct value *val, CORE_ADDR *sp)
{
if (! VALUE_LVAL (val))
{
- int len = TYPE_LENGTH (ada_check_typedef (VALUE_TYPE (val)));
+ int len = TYPE_LENGTH (check_typedef (VALUE_TYPE (val)));
/* The following is taken from the structure-return code in
call_function_by_hand. FIXME: Therefore, some refactoring seems
@@ -3509,14 +3599,14 @@ static struct value *
convert_actual (struct value *actual, struct type *formal_type0,
CORE_ADDR *sp)
{
- struct type *actual_type = ada_check_typedef (VALUE_TYPE (actual));
- struct type *formal_type = ada_check_typedef (formal_type0);
+ struct type *actual_type = check_typedef (VALUE_TYPE (actual));
+ struct type *formal_type = check_typedef (formal_type0);
struct type *formal_target =
TYPE_CODE (formal_type) == TYPE_CODE_PTR
- ? ada_check_typedef (TYPE_TARGET_TYPE (formal_type)) : formal_type;
+ ? check_typedef (TYPE_TARGET_TYPE (formal_type)) : formal_type;
struct type *actual_target =
TYPE_CODE (actual_type) == TYPE_CODE_PTR
- ? ada_check_typedef (TYPE_TARGET_TYPE (actual_type)) : actual_type;
+ ? check_typedef (TYPE_TARGET_TYPE (actual_type)) : actual_type;
if (ada_is_array_descriptor_type (formal_target)
&& TYPE_CODE (actual_target) == TYPE_CODE_ARRAY)
@@ -3531,7 +3621,7 @@ convert_actual (struct value *actual, struct type *formal_type0,
if (VALUE_LVAL (actual) != lval_memory)
{
struct value *val;
- actual_type = ada_check_typedef (VALUE_TYPE (actual));
+ actual_type = check_typedef (VALUE_TYPE (actual));
val = allocate_value (actual_type);
memcpy ((char *) VALUE_CONTENTS_RAW (val),
(char *) VALUE_CONTENTS (actual),
@@ -3563,7 +3653,7 @@ make_array_descriptor (struct type *type, struct value *arr, CORE_ADDR *sp)
struct value *bounds = allocate_value (bounds_type);
int i;
- for (i = ada_array_arity (ada_check_typedef (VALUE_TYPE (arr))); i > 0; i -= 1)
+ for (i = ada_array_arity (check_typedef (VALUE_TYPE (arr))); i > 0; i -= 1)
{
modify_general_field (VALUE_CONTENTS (bounds),
value_as_long (ada_array_bound (arr, i, 0)),
@@ -3619,14 +3709,112 @@ ada_convert_actuals (struct value *func, int nargs, struct value *args[],
convert_actual (args[i], TYPE_FIELD_TYPE (VALUE_TYPE (func), i), sp);
}
-/* Dummy definitions for an experimental caching module that is not
- * used in the public sources. */
+ /* Experimental Symbol Cache Module */
+
+/* This module may well have been OBE, due to improvements in the
+ symbol-table module. So until proven otherwise, it is disabled in
+ the submitted public code, and may be removed from all sources
+ in the future. */
+
+#ifdef GNAT_GDB
+
+/* This section implements a simple, fixed-sized hash table for those
+ Ada-mode symbols that get looked up in the course of executing the user's
+ commands. The size is fixed on the grounds that there are not
+ likely to be all that many symbols looked up during any given
+ session, regardless of the size of the symbol table. If we decide
+ to go to a resizable table, let's just use the stuff from libiberty
+ instead. */
+
+#define HASH_SIZE 1009
+
+struct cache_entry
+{
+ const char *name;
+ domain_enum namespace;
+ struct symbol *sym;
+ struct symtab *symtab;
+ struct block *block;
+ struct cache_entry *next;
+};
+
+static struct obstack cache_space;
+
+static struct cache_entry *cache[HASH_SIZE];
+
+/* Clear all entries from the symbol cache. */
+
+void
+clear_ada_sym_cache (void)
+{
+ obstack_free (&cache_space, NULL);
+ obstack_init (&cache_space);
+ memset (cache, '\000', sizeof (cache));
+}
+
+static struct cache_entry **
+find_entry (const char *name, domain_enum namespace)
+{
+ int h = msymbol_hash (name) % HASH_SIZE;
+ struct cache_entry **e;
+ for (e = &cache[h]; *e != NULL; e = &(*e)->next)
+ {
+ if (namespace == (*e)->namespace && strcmp (name, (*e)->name) == 0)
+ return e;
+ }
+ return NULL;
+}
+
+/* Return (in SYM) the last cached definition for global or static symbol NAME
+ in namespace DOMAIN. Returns 1 if entry found, 0 otherwise.
+ If SYMTAB is non-NULL, store the symbol
+ table in which the symbol was found there, or NULL if not found.
+ *BLOCK is set to the block in which NAME is found. */
static int
lookup_cached_symbol (const char *name, domain_enum namespace,
struct symbol **sym, struct block **block,
struct symtab **symtab)
{
+ struct cache_entry **e = find_entry (name, namespace);
+ if (e == NULL)
+ return 0;
+ if (sym != NULL)
+ *sym = (*e)->sym;
+ if (block != NULL)
+ *block = (*e)->block;
+ if (symtab != NULL)
+ *symtab = (*e)->symtab;
+ return 1;
+}
+
+/* Set the cached definition of NAME in DOMAIN to SYM in block
+ BLOCK and symbol table SYMTAB. */
+
+static void
+cache_symbol (const char *name, domain_enum namespace, struct symbol *sym,
+ struct block *block, struct symtab *symtab)
+{
+ int h = msymbol_hash (name) % HASH_SIZE;
+ char *copy;
+ struct cache_entry *e =
+ (struct cache_entry *) obstack_alloc (&cache_space, sizeof (*e));
+ e->next = cache[h];
+ cache[h] = e;
+ e->name = copy = obstack_alloc (&cache_space, strlen (name) + 1);
+ strcpy (copy, name);
+ e->sym = sym;
+ e->namespace = namespace;
+ e->symtab = symtab;
+ e->block = block;
+}
+
+#else
+static int
+lookup_cached_symbol (const char *name, domain_enum namespace,
+ struct symbol **sym, struct block **block,
+ struct symtab **symtab)
+{
return 0;
}
@@ -3635,6 +3823,7 @@ cache_symbol (const char *name, domain_enum namespace, struct symbol *sym,
struct block *block, struct symtab *symtab)
{
}
+#endif /* GNAT_GDB */
/* Symbol Lookup */
@@ -3744,7 +3933,7 @@ add_defn_to_vec (struct obstack *obstackp,
struct ada_symbol_info *prevDefns = defns_collected (obstackp, 0);
if (SYMBOL_TYPE (sym) != NULL)
- SYMBOL_TYPE (sym) = ada_check_typedef (SYMBOL_TYPE (sym));
+ CHECK_TYPEDEF (SYMBOL_TYPE (sym));
for (i = num_defns_collected (obstackp) - 1; i >= 0; i -= 1)
{
if (lesseq_defined_than (sym, prevDefns[i].sym))
@@ -4016,6 +4205,16 @@ ada_lookup_simple_minsym (const char *name)
return NULL;
}
+/* Return up minimal symbol for NAME, folded and encoded according to
+ Ada conventions, or NULL if none. The last two arguments are ignored. */
+
+static struct minimal_symbol *
+ada_lookup_minimal_symbol (const char *name, const char *sfile,
+ struct objfile *objf)
+{
+ return ada_lookup_simple_minsym (ada_encode (name));
+}
+
/* For all subprograms that statically enclose the subprogram of the
selected frame, add symbols matching identifier NAME in DOMAIN
and their blocks to the list of data in OBSTACKP, as for
@@ -4027,6 +4226,72 @@ add_symbols_from_enclosing_procs (struct obstack *obstackp,
const char *name, domain_enum namespace,
int wild_match)
{
+#ifdef HAVE_ADD_SYMBOLS_FROM_ENCLOSING_PROCS
+ /* Use a heuristic to find the frames of enclosing subprograms: treat the
+ pointer-sized value at location 0 from the local-variable base of a
+ frame as a static link, and then search up the call stack for a
+ frame with that same local-variable base. */
+ static struct symbol static_link_sym;
+ static struct symbol *static_link;
+ struct value *target_link_val;
+
+ struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
+ struct frame_info *frame;
+
+ if (!target_has_stack)
+ return;
+
+ if (static_link == NULL)
+ {
+ /* Initialize the local variable symbol that stands for the
+ static link (when there is one). */
+ static_link = &static_link_sym;
+ SYMBOL_LINKAGE_NAME (static_link) = "";
+ SYMBOL_LANGUAGE (static_link) = language_unknown;
+ SYMBOL_CLASS (static_link) = LOC_LOCAL;
+ SYMBOL_DOMAIN (static_link) = VAR_DOMAIN;
+ SYMBOL_TYPE (static_link) = lookup_pointer_type (builtin_type_void);
+ SYMBOL_VALUE (static_link) =
+ -(long) TYPE_LENGTH (SYMBOL_TYPE (static_link));
+ }
+
+ frame = get_selected_frame ();
+ if (frame == NULL || inside_main_func (get_frame_address_in_block (frame)))
+ return;
+
+ target_link_val = read_var_value (static_link, frame);
+ while (target_link_val != NULL
+ && num_defns_collected (obstackp) == 0
+ && frame_relative_level (frame) <= MAX_ENCLOSING_FRAME_LEVELS)
+ {
+ CORE_ADDR target_link = value_as_address (target_link_val);
+
+ frame = get_prev_frame (frame);
+ if (frame == NULL)
+ break;
+
+ if (get_frame_locals_address (frame) == target_link)
+ {
+ struct block *block;
+
+ QUIT;
+
+ block = get_frame_block (frame, 0);
+ while (block != NULL && block_function (block) != NULL
+ && num_defns_collected (obstackp) == 0)
+ {
+ QUIT;
+
+ ada_add_block_symbols (obstackp, block, name, namespace,
+ NULL, NULL, wild_match);
+
+ block = BLOCK_SUPERBLOCK (block);
+ }
+ }
+ }
+
+ do_cleanups (old_chain);
+#endif
}
/* FIXME: The next two routines belong in symtab.c */
@@ -4485,10 +4750,11 @@ done:
/* Return a symbol in DOMAIN matching NAME, in BLOCK0 and enclosing
scope and in global scopes, or NULL if none. NAME is folded and
encoded first. Otherwise, the result is as for ada_lookup_symbol_list,
- choosing the first symbol if there are multiple choices.
- *IS_A_FIELD_OF_THIS is set to 0 and *SYMTAB is set to the symbol
- table in which the symbol was found (in both cases, these
- assignments occur only if the pointers are non-null). */
+ but is disambiguated by user query if needed. *IS_A_FIELD_OF_THIS is
+ set to 0 and *SYMTAB is set to the symbol table in which the symbol
+ was found (in both cases, these assignments occur only if the
+ pointers are non-null). */
+
struct symbol *
ada_lookup_symbol (const char *name, const struct block *block0,
@@ -4503,6 +4769,8 @@ ada_lookup_symbol (const char *name, const struct block *block0,
if (n_candidates == 0)
return NULL;
+ else if (n_candidates != 1)
+ user_select_syms (candidates, n_candidates, 1);
if (is_a_field_of_this != NULL)
*is_a_field_of_this = 0;
@@ -4557,7 +4825,7 @@ ada_lookup_symbol_nonlocal (const char *name,
(__[0-9]+)?\.[0-9]+ [nested subprogram suffix, on platforms such
as GNU/Linux]
___[0-9]+ [nested subprogram suffix, on platforms such as HP/UX]
- (X[nb]*)?((\$|__)[0-9](_?[0-9]+)|___(JM|LJM|X([FDBUP].*|R[^T]?)))?$
+ (X[nb]*)?((\$|__)[0-9](_?[0-9]+)|___(LJM|X([FDBUP].*|R[^T]?)))?$
*/
static int
@@ -4620,13 +4888,6 @@ is_name_suffix (const char *str)
return 0;
if (str[2] == '_')
{
- if (strcmp (str + 3, "JM") == 0)
- return 1;
- /* FIXME: brobecker/2004-09-30: GNAT will soon stop using
- the LJM suffix in favor of the JM one. But we will
- still accept LJM as a valid suffix for a reasonable
- amount of time, just to allow ourselves to debug programs
- compiled using an older version of GNAT. */
if (strcmp (str + 3, "LJM") == 0)
return 1;
if (str[3] != 'X')
@@ -4913,6 +5174,7 @@ ada_add_block_symbols (struct obstack *obstackp,
}
}
}
+ end_loop2:;
}
/* NOTE: This really shouldn't be needed for _ada_ symbols.
@@ -4926,6 +5188,1393 @@ ada_add_block_symbols (struct obstack *obstackp,
}
}
+#ifdef GNAT_GDB
+
+ /* Symbol Completion */
+
+/* If SYM_NAME is a completion candidate for TEXT, return this symbol
+ name in a form that's appropriate for the completion. The result
+ does not need to be deallocated, but is only good until the next call.
+
+ TEXT_LEN is equal to the length of TEXT.
+ Perform a wild match if WILD_MATCH is set.
+ ENCODED should be set if TEXT represents the start of a symbol name
+ in its encoded form. */
+
+static const char *
+symbol_completion_match (const char *sym_name,
+ const char *text, int text_len,
+ int wild_match, int encoded)
+{
+ char *result;
+ const int verbatim_match = (text[0] == '<');
+ int match = 0;
+
+ if (verbatim_match)
+ {
+ /* Strip the leading angle bracket. */
+ text = text + 1;
+ text_len--;
+ }
+
+ /* First, test against the fully qualified name of the symbol. */
+
+ if (strncmp (sym_name, text, text_len) == 0)
+ match = 1;
+
+ if (match && !encoded)
+ {
+ /* One needed check before declaring a positive match is to verify
+ that iff we are doing a verbatim match, the decoded version
+ of the symbol name starts with '<'. Otherwise, this symbol name
+ is not a suitable completion. */
+ const char *sym_name_copy = sym_name;
+ int has_angle_bracket;
+
+ sym_name = ada_decode (sym_name);
+ has_angle_bracket = (sym_name[0] == '<');
+ match = (has_angle_bracket == verbatim_match);
+ sym_name = sym_name_copy;
+ }
+
+ if (match && !verbatim_match)
+ {
+ /* When doing non-verbatim match, another check that needs to
+ be done is to verify that the potentially matching symbol name
+ does not include capital letters, because the ada-mode would
+ not be able to understand these symbol names without the
+ angle bracket notation. */
+ const char *tmp;
+
+ for (tmp = sym_name; *tmp != '\0' && !isupper (*tmp); tmp++);
+ if (*tmp != '\0')
+ match = 0;
+ }
+
+ /* Second: Try wild matching... */
+
+ if (!match && wild_match)
+ {
+ /* Since we are doing wild matching, this means that TEXT
+ may represent an unqualified symbol name. We therefore must
+ also compare TEXT against the unqualified name of the symbol. */
+ sym_name = ada_unqualified_name (ada_decode (sym_name));
+
+ if (strncmp (sym_name, text, text_len) == 0)
+ match = 1;
+ }
+
+ /* Finally: If we found a mach, prepare the result to return. */
+
+ if (!match)
+ return NULL;
+
+ if (verbatim_match)
+ sym_name = add_angle_brackets (sym_name);
+
+ if (!encoded)
+ sym_name = ada_decode (sym_name);
+
+ return sym_name;
+}
+
+/* A companion function to ada_make_symbol_completion_list().
+ Check if SYM_NAME represents a symbol which name would be suitable
+ to complete TEXT (TEXT_LEN is the length of TEXT), in which case
+ it is appended at the end of the given string vector SV.
+
+ ORIG_TEXT is the string original string from the user command
+ that needs to be completed. WORD is the entire command on which
+ completion should be performed. These two parameters are used to
+ determine which part of the symbol name should be added to the
+ completion vector.
+ if WILD_MATCH is set, then wild matching is performed.
+ ENCODED should be set if TEXT represents a symbol name in its
+ encoded formed (in which case the completion should also be
+ encoded). */
+
+static void
+symbol_completion_add (struct string_vector *sv,
+ const char *sym_name,
+ const char *text, int text_len,
+ const char *orig_text, const char *word,
+ int wild_match, int encoded)
+{
+ const char *match = symbol_completion_match (sym_name, text, text_len,
+ wild_match, encoded);
+ char *completion;
+
+ if (match == NULL)
+ return;
+
+ /* We found a match, so add the appropriate completion to the given
+ string vector. */
+
+ if (word == orig_text)
+ {
+ completion = xmalloc (strlen (match) + 5);
+ strcpy (completion, match);
+ }
+ else if (word > orig_text)
+ {
+ /* Return some portion of sym_name. */
+ completion = xmalloc (strlen (match) + 5);
+ strcpy (completion, match + (word - orig_text));
+ }
+ else
+ {
+ /* Return some of ORIG_TEXT plus sym_name. */
+ completion = xmalloc (strlen (match) + (orig_text - word) + 5);
+ strncpy (completion, word, orig_text - word);
+ completion[orig_text - word] = '\0';
+ strcat (completion, match);
+ }
+
+ string_vector_append (sv, completion);
+}
+
+/* Return a list of possible symbol names completing TEXT0. The list
+ is NULL terminated. WORD is the entire command on which completion
+ is made. */
+
+char **
+ada_make_symbol_completion_list (const char *text0, const char *word)
+{
+ /* Note: This function is almost a copy of make_symbol_completion_list(),
+ except it has been adapted for Ada. It is somewhat of a shame to
+ duplicate so much code, but we don't really have the infrastructure
+ yet to develop a language-aware version of he symbol completer... */
+ char *text;
+ int text_len;
+ int wild_match;
+ int encoded;
+ struct string_vector result = xnew_string_vector (128);
+ struct symbol *sym;
+ struct symtab *s;
+ struct partial_symtab *ps;
+ struct minimal_symbol *msymbol;
+ struct objfile *objfile;
+ struct block *b, *surrounding_static_block = 0;
+ int i;
+ struct dict_iterator iter;
+
+ if (text0[0] == '<')
+ {
+ text = xstrdup (text0);
+ make_cleanup (xfree, text);
+ text_len = strlen (text);
+ wild_match = 0;
+ encoded = 1;
+ }
+ else
+ {
+ text = xstrdup (ada_encode (text0));
+ make_cleanup (xfree, text);
+ text_len = strlen (text);
+ for (i = 0; i < text_len; i++)
+ text[i] = tolower (text[i]);
+
+ /* FIXME: brobecker/2003-09-17: When we get rid of ADA_RETAIN_DOTS,
+ we can restrict the wild_match check to searching "__" only. */
+ wild_match = (strstr (text0, "__") == NULL
+ && strchr (text0, '.') == NULL);
+ encoded = (strstr (text0, "__") != NULL);
+ }
+
+ /* First, look at the partial symtab symbols. */
+ ALL_PSYMTABS (objfile, ps)
+ {
+ struct partial_symbol **psym;
+
+ /* If the psymtab's been read in we'll get it when we search
+ through the blockvector. */
+ if (ps->readin)
+ continue;
+
+ for (psym = objfile->global_psymbols.list + ps->globals_offset;
+ psym < (objfile->global_psymbols.list + ps->globals_offset
+ + ps->n_global_syms); psym++)
+ {
+ QUIT;
+ symbol_completion_add (&result, SYMBOL_LINKAGE_NAME (*psym),
+ text, text_len, text0, word,
+ wild_match, encoded);
+ }
+
+ for (psym = objfile->static_psymbols.list + ps->statics_offset;
+ psym < (objfile->static_psymbols.list + ps->statics_offset
+ + ps->n_static_syms); psym++)
+ {
+ QUIT;
+ symbol_completion_add (&result, SYMBOL_LINKAGE_NAME (*psym),
+ text, text_len, text0, word,
+ wild_match, encoded);
+ }
+ }
+
+ /* At this point scan through the misc symbol vectors and add each
+ symbol you find to the list. Eventually we want to ignore
+ anything that isn't a text symbol (everything else will be
+ handled by the psymtab code above). */
+
+ ALL_MSYMBOLS (objfile, msymbol)
+ {
+ QUIT;
+ symbol_completion_add (&result, SYMBOL_LINKAGE_NAME (msymbol),
+ text, text_len, text0, word, wild_match, encoded);
+ }
+
+ /* Search upwards from currently selected frame (so that we can
+ complete on local vars. */
+
+ for (b = get_selected_block (0); b != NULL; b = BLOCK_SUPERBLOCK (b))
+ {
+ if (!BLOCK_SUPERBLOCK (b))
+ surrounding_static_block = b; /* For elmin of dups */
+
+ ALL_BLOCK_SYMBOLS (b, iter, sym)
+ {
+ symbol_completion_add (&result, SYMBOL_LINKAGE_NAME (sym),
+ text, text_len, text0, word,
+ wild_match, encoded);
+ }
+ }
+
+ /* Go through the symtabs and check the externs and statics for
+ symbols which match. */
+
+ ALL_SYMTABS (objfile, s)
+ {
+ QUIT;
+ b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK);
+ ALL_BLOCK_SYMBOLS (b, iter, sym)
+ {
+ symbol_completion_add (&result, SYMBOL_LINKAGE_NAME (sym),
+ text, text_len, text0, word,
+ wild_match, encoded);
+ }
+ }
+
+ ALL_SYMTABS (objfile, s)
+ {
+ QUIT;
+ b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK);
+ /* Don't do this block twice. */
+ if (b == surrounding_static_block)
+ continue;
+ ALL_BLOCK_SYMBOLS (b, iter, sym)
+ {
+ symbol_completion_add (&result, SYMBOL_LINKAGE_NAME (sym),
+ text, text_len, text0, word,
+ wild_match, encoded);
+ }
+ }
+
+ /* Append the closing NULL entry. */
+ string_vector_append (&result, NULL);
+
+ return (result.array);
+}
+
+#endif /* GNAT_GDB */
+
+#ifdef GNAT_GDB
+ /* Breakpoint-related */
+
+/* Assuming that LINE is pointing at the beginning of an argument to
+ 'break', return a pointer to the delimiter for the initial segment
+ of that name. This is the first ':', ' ', or end of LINE. */
+
+char *
+ada_start_decode_line_1 (char *line)
+{
+ /* NOTE: strpbrk would be more elegant, but I am reluctant to be
+ the first to use such a library function in GDB code. */
+ char *p;
+ for (p = line; *p != '\000' && *p != ' ' && *p != ':'; p += 1)
+ ;
+ return p;
+}
+
+/* *SPEC points to a function and line number spec (as in a break
+ command), following any initial file name specification.
+
+ Return all symbol table/line specfications (sals) consistent with the
+ information in *SPEC and FILE_TABLE in the following sense:
+ + FILE_TABLE is null, or the sal refers to a line in the file
+ named by FILE_TABLE.
+ + If *SPEC points to an argument with a trailing ':LINENUM',
+ then the sal refers to that line (or one following it as closely as
+ possible).
+ + If *SPEC does not start with '*', the sal is in a function with
+ that name.
+
+ Returns with 0 elements if no matching non-minimal symbols found.
+
+ If *SPEC begins with a function name of the form <NAME>, then NAME
+ is taken as a literal name; otherwise the function name is subject
+ to the usual encoding.
+
+ *SPEC is updated to point after the function/line number specification.
+
+ FUNFIRSTLINE is non-zero if we desire the first line of real code
+ in each function.
+
+ If CANONICAL is non-NULL, and if any of the sals require a
+ 'canonical line spec', then *CANONICAL is set to point to an array
+ of strings, corresponding to and equal in length to the returned
+ list of sals, such that (*CANONICAL)[i] is non-null and contains a
+ canonical line spec for the ith returned sal, if needed. If no
+ canonical line specs are required and CANONICAL is non-null,
+ *CANONICAL is set to NULL.
+
+ A 'canonical line spec' is simply a name (in the format of the
+ breakpoint command) that uniquely identifies a breakpoint position,
+ with no further contextual information or user selection. It is
+ needed whenever the file name, function name, and line number
+ information supplied is insufficient for this unique
+ identification. Currently overloaded functions, the name '*',
+ or static functions without a filename yield a canonical line spec.
+ The array and the line spec strings are allocated on the heap; it
+ is the caller's responsibility to free them. */
+
+struct symtabs_and_lines
+ada_finish_decode_line_1 (char **spec, struct symtab *file_table,
+ int funfirstline, char ***canonical)
+{
+ struct ada_symbol_info *symbols;
+ const struct block *block;
+ int n_matches, i, line_num;
+ struct symtabs_and_lines selected;
+ struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
+ char *name;
+ int is_quoted;
+
+ int len;
+ char *lower_name;
+ char *unquoted_name;
+
+ if (file_table == NULL)
+ block = block_static_block (get_selected_block (0));
+ else
+ block = BLOCKVECTOR_BLOCK (BLOCKVECTOR (file_table), STATIC_BLOCK);
+
+ if (canonical != NULL)
+ *canonical = (char **) NULL;
+
+ is_quoted = (**spec && strchr (get_gdb_completer_quote_characters (),
+ **spec) != NULL);
+
+ name = *spec;
+ if (**spec == '*')
+ *spec += 1;
+ else
+ {
+ if (is_quoted)
+ *spec = skip_quoted (*spec);
+ while (**spec != '\000'
+ && !strchr (ada_completer_word_break_characters, **spec))
+ *spec += 1;
+ }
+ len = *spec - name;
+
+ line_num = -1;
+ if (file_table != NULL && (*spec)[0] == ':' && isdigit ((*spec)[1]))
+ {
+ line_num = strtol (*spec + 1, spec, 10);
+ while (**spec == ' ' || **spec == '\t')
+ *spec += 1;
+ }
+
+ if (name[0] == '*')
+ {
+ if (line_num == -1)
+ error ("Wild-card function with no line number or file name.");
+
+ return ada_sals_for_line (file_table->filename, line_num,
+ funfirstline, canonical, 0);
+ }
+
+ if (name[0] == '\'')
+ {
+ name += 1;
+ len -= 2;
+ }
+
+ if (name[0] == '<')
+ {
+ unquoted_name = (char *) alloca (len - 1);
+ memcpy (unquoted_name, name + 1, len - 2);
+ unquoted_name[len - 2] = '\000';
+ lower_name = NULL;
+ }
+ else
+ {
+ unquoted_name = (char *) alloca (len + 1);
+ memcpy (unquoted_name, name, len);
+ unquoted_name[len] = '\000';
+ lower_name = (char *) alloca (len + 1);
+ for (i = 0; i < len; i += 1)
+ lower_name[i] = tolower (name[i]);
+ lower_name[len] = '\000';
+ }
+
+ n_matches = 0;
+ if (lower_name != NULL)
+ n_matches = ada_lookup_symbol_list (ada_encode (lower_name), block,
+ VAR_DOMAIN, &symbols);
+ if (n_matches == 0)
+ n_matches = ada_lookup_symbol_list (unquoted_name, block,
+ VAR_DOMAIN, &symbols);
+ if (n_matches == 0 && line_num >= 0)
+ error ("No line number information found for %s.", unquoted_name);
+ else if (n_matches == 0)
+ {
+#ifdef HPPA_COMPILER_BUG
+ /* FIXME: See comment in symtab.c::decode_line_1 */
+#undef volatile
+ volatile struct symtab_and_line val;
+#define volatile /*nothing */
+#else
+ struct symtab_and_line val;
+#endif
+ struct minimal_symbol *msymbol;
+
+ init_sal (&val);
+
+ msymbol = NULL;
+ if (lower_name != NULL)
+ msymbol = ada_lookup_simple_minsym (ada_encode (lower_name));
+ if (msymbol == NULL)
+ msymbol = ada_lookup_simple_minsym (unquoted_name);
+ if (msymbol != NULL)
+ {
+ val.pc = SYMBOL_VALUE_ADDRESS (msymbol);
+ val.section = SYMBOL_BFD_SECTION (msymbol);
+ if (funfirstline)
+ {
+ val.pc = gdbarch_convert_from_func_ptr_addr (current_gdbarch,
+ val.pc,
+ &current_target);
+ SKIP_PROLOGUE (val.pc);
+ }
+ selected.sals = (struct symtab_and_line *)
+ xmalloc (sizeof (struct symtab_and_line));
+ selected.sals[0] = val;
+ selected.nelts = 1;
+ return selected;
+ }
+
+ if (!have_full_symbols ()
+ && !have_partial_symbols () && !have_minimal_symbols ())
+ error ("No symbol table is loaded. Use the \"file\" command.");
+
+ error ("Function \"%s\" not defined.", unquoted_name);
+ return selected; /* for lint */
+ }
+
+ if (line_num >= 0)
+ {
+ struct symtabs_and_lines best_sal =
+ find_sal_from_funcs_and_line (file_table->filename, line_num,
+ symbols, n_matches);
+ if (funfirstline)
+ adjust_pc_past_prologue (&best_sal.sals[0].pc);
+ return best_sal;
+ }
+ else
+ {
+ selected.nelts = user_select_syms (symbols, n_matches, n_matches);
+ }
+
+ selected.sals = (struct symtab_and_line *)
+ xmalloc (sizeof (struct symtab_and_line) * selected.nelts);
+ memset (selected.sals, 0, selected.nelts * sizeof (selected.sals[i]));
+ make_cleanup (xfree, selected.sals);
+
+ i = 0;
+ while (i < selected.nelts)
+ {
+ if (SYMBOL_CLASS (symbols[i].sym) == LOC_BLOCK)
+ selected.sals[i]
+ = find_function_start_sal (symbols[i].sym, funfirstline);
+ else if (SYMBOL_LINE (symbols[i].sym) != 0)
+ {
+ selected.sals[i].symtab =
+ symbols[i].symtab
+ ? symbols[i].symtab : symtab_for_sym (symbols[i].sym);
+ selected.sals[i].line = SYMBOL_LINE (symbols[i].sym);
+ }
+ else if (line_num >= 0)
+ {
+ /* Ignore this choice */
+ symbols[i] = symbols[selected.nelts - 1];
+ selected.nelts -= 1;
+ continue;
+ }
+ else
+ error ("Line number not known for symbol \"%s\"", unquoted_name);
+ i += 1;
+ }
+
+ if (canonical != NULL && (line_num >= 0 || n_matches > 1))
+ {
+ *canonical = (char **) xmalloc (sizeof (char *) * selected.nelts);
+ for (i = 0; i < selected.nelts; i += 1)
+ (*canonical)[i] =
+ extended_canonical_line_spec (selected.sals[i],
+ SYMBOL_PRINT_NAME (symbols[i].sym));
+ }
+
+ discard_cleanups (old_chain);
+ return selected;
+}
+
+/* The (single) sal corresponding to line LINE_NUM in a symbol table
+ with file name FILENAME that occurs in one of the functions listed
+ in the symbol fields of SYMBOLS[0 .. NSYMS-1]. */
+
+static struct symtabs_and_lines
+find_sal_from_funcs_and_line (const char *filename, int line_num,
+ struct ada_symbol_info *symbols, int nsyms)
+{
+ struct symtabs_and_lines sals;
+ int best_index, best;
+ struct linetable *best_linetable;
+ struct objfile *objfile;
+ struct symtab *s;
+ struct symtab *best_symtab;
+
+ read_all_symtabs (filename);
+
+ best_index = 0;
+ best_linetable = NULL;
+ best_symtab = NULL;
+ best = 0;
+ ALL_SYMTABS (objfile, s)
+ {
+ struct linetable *l;
+ int ind, exact;
+
+ QUIT;
+
+ if (strcmp (filename, s->filename) != 0)
+ continue;
+ l = LINETABLE (s);
+ ind = find_line_in_linetable (l, line_num, symbols, nsyms, &exact);
+ if (ind >= 0)
+ {
+ if (exact)
+ {
+ best_index = ind;
+ best_linetable = l;
+ best_symtab = s;
+ goto done;
+ }
+ if (best == 0 || l->item[ind].line < best)
+ {
+ best = l->item[ind].line;
+ best_index = ind;
+ best_linetable = l;
+ best_symtab = s;
+ }
+ }
+ }
+
+ if (best == 0)
+ error ("Line number not found in designated function.");
+
+done:
+
+ sals.nelts = 1;
+ sals.sals = (struct symtab_and_line *) xmalloc (sizeof (sals.sals[0]));
+
+ init_sal (&sals.sals[0]);
+
+ sals.sals[0].line = best_linetable->item[best_index].line;
+ sals.sals[0].pc = best_linetable->item[best_index].pc;
+ sals.sals[0].symtab = best_symtab;
+
+ return sals;
+}
+
+/* Return the index in LINETABLE of the best match for LINE_NUM whose
+ pc falls within one of the functions denoted by the symbol fields
+ of SYMBOLS[0..NSYMS-1]. Set *EXACTP to 1 if the match is exact,
+ and 0 otherwise. */
+
+static int
+find_line_in_linetable (struct linetable *linetable, int line_num,
+ struct ada_symbol_info *symbols, int nsyms,
+ int *exactp)
+{
+ int i, len, best_index, best;
+
+ if (line_num <= 0 || linetable == NULL)
+ return -1;
+
+ len = linetable->nitems;
+ for (i = 0, best_index = -1, best = 0; i < len; i += 1)
+ {
+ int k;
+ struct linetable_entry *item = &(linetable->item[i]);
+
+ for (k = 0; k < nsyms; k += 1)
+ {
+ if (symbols[k].sym != NULL
+ && SYMBOL_CLASS (symbols[k].sym) == LOC_BLOCK
+ && item->pc >= BLOCK_START (SYMBOL_BLOCK_VALUE (symbols[k].sym))
+ && item->pc < BLOCK_END (SYMBOL_BLOCK_VALUE (symbols[k].sym)))
+ goto candidate;
+ }
+ continue;
+
+ candidate:
+
+ if (item->line == line_num)
+ {
+ *exactp = 1;
+ return i;
+ }
+
+ if (item->line > line_num && (best == 0 || item->line < best))
+ {
+ best = item->line;
+ best_index = i;
+ }
+ }
+
+ *exactp = 0;
+ return best_index;
+}
+
+/* Find the smallest k >= LINE_NUM such that k is a line number in
+ LINETABLE, and k falls strictly within a named function that begins at
+ or before LINE_NUM. Return -1 if there is no such k. */
+
+static int
+nearest_line_number_in_linetable (struct linetable *linetable, int line_num)
+{
+ int i, len, best;
+
+ if (line_num <= 0 || linetable == NULL || linetable->nitems == 0)
+ return -1;
+ len = linetable->nitems;
+
+ i = 0;
+ best = INT_MAX;
+ while (i < len)
+ {
+ struct linetable_entry *item = &(linetable->item[i]);
+
+ if (item->line >= line_num && item->line < best)
+ {
+ char *func_name;
+ CORE_ADDR start, end;
+
+ func_name = NULL;
+ find_pc_partial_function (item->pc, &func_name, &start, &end);
+
+ if (func_name != NULL && item->pc < end)
+ {
+ if (item->line == line_num)
+ return line_num;
+ else
+ {
+ struct symbol *sym =
+ standard_lookup (func_name, NULL, VAR_DOMAIN);
+ if (is_plausible_func_for_line (sym, line_num))
+ best = item->line;
+ else
+ {
+ do
+ i += 1;
+ while (i < len && linetable->item[i].pc < end);
+ continue;
+ }
+ }
+ }
+ }
+
+ i += 1;
+ }
+
+ return (best == INT_MAX) ? -1 : best;
+}
+
+
+/* Return the next higher index, k, into LINETABLE such that k > IND,
+ entry k in LINETABLE has a line number equal to LINE_NUM, k
+ corresponds to a PC that is in a function different from that
+ corresponding to IND, and falls strictly within a named function
+ that begins at a line at or preceding STARTING_LINE.
+ Return -1 if there is no such k.
+ IND == -1 corresponds to no function. */
+
+static int
+find_next_line_in_linetable (struct linetable *linetable, int line_num,
+ int starting_line, int ind)
+{
+ int i, len;
+
+ if (line_num <= 0 || linetable == NULL || ind >= linetable->nitems)
+ return -1;
+ len = linetable->nitems;
+
+ if (ind >= 0)
+ {
+ CORE_ADDR start, end;
+
+ if (find_pc_partial_function (linetable->item[ind].pc,
+ (char **) NULL, &start, &end))
+ {
+ while (ind < len && linetable->item[ind].pc < end)
+ ind += 1;
+ }
+ else
+ ind += 1;
+ }
+ else
+ ind = 0;
+
+ i = ind;
+ while (i < len)
+ {
+ struct linetable_entry *item = &(linetable->item[i]);
+
+ if (item->line >= line_num)
+ {
+ char *func_name;
+ CORE_ADDR start, end;
+
+ func_name = NULL;
+ find_pc_partial_function (item->pc, &func_name, &start, &end);
+
+ if (func_name != NULL && item->pc < end)
+ {
+ if (item->line == line_num)
+ {
+ struct symbol *sym =
+ standard_lookup (func_name, NULL, VAR_DOMAIN);
+ if (is_plausible_func_for_line (sym, starting_line))
+ return i;
+ else
+ {
+ while ((i + 1) < len && linetable->item[i + 1].pc < end)
+ i += 1;
+ }
+ }
+ }
+ }
+ i += 1;
+ }
+
+ return -1;
+}
+
+/* True iff function symbol SYM starts somewhere at or before line #
+ LINE_NUM. */
+
+static int
+is_plausible_func_for_line (struct symbol *sym, int line_num)
+{
+ struct symtab_and_line start_sal;
+
+ if (sym == NULL)
+ return 0;
+
+ start_sal = find_function_start_sal (sym, 0);
+
+ return (start_sal.line != 0 && line_num >= start_sal.line);
+}
+
+/* Read in all symbol tables corresponding to partial symbol tables
+ with file name FILENAME. */
+
+static void
+read_all_symtabs (const char *filename)
+{
+ struct partial_symtab *ps;
+ struct objfile *objfile;
+
+ ALL_PSYMTABS (objfile, ps)
+ {
+ QUIT;
+
+ if (strcmp (filename, ps->filename) == 0)
+ PSYMTAB_TO_SYMTAB (ps);
+ }
+}
+
+/* All sals corresponding to line LINE_NUM in a symbol table from file
+ FILENAME, as filtered by the user. Filter out any lines that
+ reside in functions with "suppressed" names (not corresponding to
+ explicit Ada functions), if there is at least one in a function
+ with a non-suppressed name. If CANONICAL is not null, set
+ it to a corresponding array of canonical line specs.
+ If ONE_LOCATION_ONLY is set and several matches are found for
+ the given location, then automatically select the first match found
+ instead of asking the user which instance should be returned. */
+
+struct symtabs_and_lines
+ada_sals_for_line (const char *filename, int line_num,
+ int funfirstline, char ***canonical, int one_location_only)
+{
+ struct symtabs_and_lines result;
+ struct objfile *objfile;
+ struct symtab *s;
+ struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
+ size_t len;
+
+ read_all_symtabs (filename);
+
+ result.sals =
+ (struct symtab_and_line *) xmalloc (4 * sizeof (result.sals[0]));
+ result.nelts = 0;
+ len = 4;
+ make_cleanup (free_current_contents, &result.sals);
+
+ ALL_SYMTABS (objfile, s)
+ {
+ int ind, target_line_num;
+
+ QUIT;
+
+ if (strcmp (s->filename, filename) != 0)
+ continue;
+
+ target_line_num =
+ nearest_line_number_in_linetable (LINETABLE (s), line_num);
+ if (target_line_num == -1)
+ continue;
+
+ ind = -1;
+ while (1)
+ {
+ ind =
+ find_next_line_in_linetable (LINETABLE (s),
+ target_line_num, line_num, ind);
+
+ if (ind < 0)
+ break;
+
+ GROW_VECT (result.sals, len, result.nelts + 1);
+ init_sal (&result.sals[result.nelts]);
+ result.sals[result.nelts].line = line_num;
+ result.sals[result.nelts].pc = LINETABLE (s)->item[ind].pc;
+ result.sals[result.nelts].symtab = s;
+
+ if (funfirstline)
+ adjust_pc_past_prologue (&result.sals[result.nelts].pc);
+
+ result.nelts += 1;
+ }
+ }
+
+ if (canonical != NULL || result.nelts > 1)
+ {
+ int k, j, n;
+ char **func_names = (char **) alloca (result.nelts * sizeof (char *));
+ int first_choice = (result.nelts > 1) ? 2 : 1;
+ int *choices = (int *) alloca (result.nelts * sizeof (int));
+
+ for (k = 0; k < result.nelts; k += 1)
+ {
+ find_pc_partial_function (result.sals[k].pc, &func_names[k],
+ (CORE_ADDR *) NULL, (CORE_ADDR *) NULL);
+ if (func_names[k] == NULL)
+ error ("Could not find function for one or more breakpoints.");
+ }
+
+ /* Remove suppressed names, unless all are suppressed. */
+ for (j = 0; j < result.nelts; j += 1)
+ if (!is_suppressed_name (func_names[j]))
+ {
+ /* At least one name is unsuppressed, so remove all
+ suppressed names. */
+ for (k = n = 0; k < result.nelts; k += 1)
+ if (!is_suppressed_name (func_names[k]))
+ {
+ func_names[n] = func_names[k];
+ result.sals[n] = result.sals[k];
+ n += 1;
+ }
+ result.nelts = n;
+ break;
+ }
+
+ if (result.nelts > 1)
+ {
+ if (one_location_only)
+ {
+ /* Automatically select the first of all possible choices. */
+ n = 1;
+ choices[0] = 0;
+ }
+ else
+ {
+ printf_unfiltered ("[0] cancel\n");
+ if (result.nelts > 1)
+ printf_unfiltered ("[1] all\n");
+ for (k = 0; k < result.nelts; k += 1)
+ printf_unfiltered ("[%d] %s\n", k + first_choice,
+ ada_decode (func_names[k]));
+
+ n = get_selections (choices, result.nelts, result.nelts,
+ result.nelts > 1, "instance-choice");
+ }
+
+ for (k = 0; k < n; k += 1)
+ {
+ result.sals[k] = result.sals[choices[k]];
+ func_names[k] = func_names[choices[k]];
+ }
+ result.nelts = n;
+ }
+
+ if (canonical != NULL && result.nelts == 0)
+ *canonical = NULL;
+ else if (canonical != NULL)
+ {
+ *canonical = (char **) xmalloc (result.nelts * sizeof (char **));
+ make_cleanup (xfree, *canonical);
+ for (k = 0; k < result.nelts; k += 1)
+ {
+ (*canonical)[k] =
+ extended_canonical_line_spec (result.sals[k], func_names[k]);
+ if ((*canonical)[k] == NULL)
+ error ("Could not locate one or more breakpoints.");
+ make_cleanup (xfree, (*canonical)[k]);
+ }
+ }
+ }
+
+ if (result.nelts == 0)
+ {
+ do_cleanups (old_chain);
+ result.sals = NULL;
+ }
+ else
+ discard_cleanups (old_chain);
+ return result;
+}
+
+
+/* A canonical line specification of the form FILE:NAME:LINENUM for
+ symbol table and line data SAL. NULL if insufficient
+ information. The caller is responsible for releasing any space
+ allocated. */
+
+static char *
+extended_canonical_line_spec (struct symtab_and_line sal, const char *name)
+{
+ char *r;
+
+ if (sal.symtab == NULL || sal.symtab->filename == NULL || sal.line <= 0)
+ return NULL;
+
+ r = (char *) xmalloc (strlen (name) + strlen (sal.symtab->filename)
+ + sizeof (sal.line) * 3 + 3);
+ sprintf (r, "%s:'%s':%d", sal.symtab->filename, name, sal.line);
+ return r;
+}
+
+/* Return type of Ada breakpoint associated with bp_stat:
+ 0 if not an Ada-specific breakpoint, 1 for break on specific exception,
+ 2 for break on unhandled exception, 3 for assert. */
+
+static int
+ada_exception_breakpoint_type (bpstat bs)
+{
+ return ((!bs || !bs->breakpoint_at) ? 0
+ : bs->breakpoint_at->break_on_exception);
+}
+
+/* True iff FRAME is very likely to be that of a function that is
+ part of the runtime system. This is all very heuristic, but is
+ intended to be used as advice as to what frames are uninteresting
+ to most users. */
+
+static int
+is_known_support_routine (struct frame_info *frame)
+{
+ struct frame_info *next_frame = get_next_frame (frame);
+ /* If frame is not innermost, that normally means that frame->pc
+ points to *after* the call instruction, and we want to get the line
+ containing the call, never the next line. But if the next frame is
+ a signal_handler_caller or a dummy frame, then the next frame was
+ not entered as the result of a call, and we want to get the line
+ containing frame->pc. */
+ const int pc_is_after_call =
+ next_frame != NULL
+ && get_frame_type (next_frame) != SIGTRAMP_FRAME
+ && get_frame_type (next_frame) != DUMMY_FRAME;
+ struct symtab_and_line sal
+ = find_pc_line (get_frame_pc (frame), pc_is_after_call);
+ char *func_name;
+ int i;
+ struct stat st;
+
+ /* The heuristic:
+ 1. The symtab is null (indicating no debugging symbols)
+ 2. The symtab's filename does not exist.
+ 3. The object file's name is one of the standard libraries.
+ 4. The symtab's file name has the form of an Ada library source file.
+ 5. The function at frame's PC has a GNAT-compiler-generated name. */
+
+ if (sal.symtab == NULL)
+ return 1;
+
+ /* On some systems (e.g. VxWorks), the kernel contains debugging
+ symbols; in this case, the filename referenced by these symbols
+ does not exists. */
+
+ if (stat (sal.symtab->filename, &st))
+ return 1;
+
+ for (i = 0; known_runtime_file_name_patterns[i] != NULL; i += 1)
+ {
+ re_comp (known_runtime_file_name_patterns[i]);
+ if (re_exec (sal.symtab->filename))
+ return 1;
+ }
+ if (sal.symtab->objfile != NULL)
+ {
+ for (i = 0; known_runtime_file_name_patterns[i] != NULL; i += 1)
+ {
+ re_comp (known_runtime_file_name_patterns[i]);
+ if (re_exec (sal.symtab->objfile->name))
+ return 1;
+ }
+ }
+
+ /* If the frame PC points after the call instruction, then we need to
+ decrement it in order to search for the function associated to this
+ PC. Otherwise, if the associated call was the last instruction of
+ the function, we might either find the wrong function or even fail
+ during the function name lookup. */
+ if (pc_is_after_call)
+ func_name = function_name_from_pc (get_frame_pc (frame) - 1);
+ else
+ func_name = function_name_from_pc (get_frame_pc (frame));
+
+ if (func_name == NULL)
+ return 1;
+
+ for (i = 0; known_auxiliary_function_name_patterns[i] != NULL; i += 1)
+ {
+ re_comp (known_auxiliary_function_name_patterns[i]);
+ if (re_exec (func_name))
+ return 1;
+ }
+
+ return 0;
+}
+
+/* Find the first frame that contains debugging information and that is not
+ part of the Ada run-time, starting from FI and moving upward. */
+
+void
+ada_find_printable_frame (struct frame_info *fi)
+{
+ for (; fi != NULL; fi = get_prev_frame (fi))
+ {
+ if (!is_known_support_routine (fi))
+ {
+ select_frame (fi);
+ break;
+ }
+ }
+
+}
+
+/* Name found for exception associated with last bpstat sent to
+ ada_adjust_exception_stop. Set to the null string if that bpstat
+ did not correspond to an Ada exception or no name could be found. */
+
+static char last_exception_name[256];
+
+/* If BS indicates a stop in an Ada exception, try to go up to a frame
+ that will be meaningful to the user, and save the name of the last
+ exception (truncated, if necessary) in last_exception_name. */
+
+void
+ada_adjust_exception_stop (bpstat bs)
+{
+ CORE_ADDR addr;
+ struct frame_info *fi;
+ int frame_level;
+ char *selected_frame_func;
+
+ addr = 0;
+ last_exception_name[0] = '\0';
+ fi = get_selected_frame ();
+ selected_frame_func = function_name_from_pc (get_frame_pc (fi));
+
+ switch (ada_exception_breakpoint_type (bs))
+ {
+ default:
+ return;
+ case 1:
+ break;
+ case 2:
+ /* Unhandled exceptions. Select the frame corresponding to
+ ada.exceptions.process_raise_exception. This frame is at
+ least 2 levels up, so we simply skip the first 2 frames
+ without checking the name of their associated function. */
+ for (frame_level = 0; frame_level < 2; frame_level += 1)
+ if (fi != NULL)
+ fi = get_prev_frame (fi);
+ while (fi != NULL)
+ {
+ const char *func_name = function_name_from_pc (get_frame_pc (fi));
+ if (func_name != NULL
+ && strcmp (func_name, process_raise_exception_name) == 0)
+ break; /* We found the frame we were looking for... */
+ fi = get_prev_frame (fi);
+ }
+ if (fi == NULL)
+ break;
+ select_frame (fi);
+ break;
+ }
+
+ addr = parse_and_eval_address ("e.full_name");
+
+ if (addr != 0)
+ read_memory (addr, last_exception_name, sizeof (last_exception_name) - 1);
+ last_exception_name[sizeof (last_exception_name) - 1] = '\0';
+ ada_find_printable_frame (get_selected_frame ());
+}
+
+/* Output Ada exception name (if any) associated with last call to
+ ada_adjust_exception_stop. */
+
+void
+ada_print_exception_stop (bpstat bs)
+{
+ if (last_exception_name[0] != '\000')
+ {
+ ui_out_text (uiout, last_exception_name);
+ ui_out_text (uiout, " at ");
+ }
+}
+
+/* Parses the CONDITION string associated with a breakpoint exception
+ to get the name of the exception on which the breakpoint has been
+ set. The returned string needs to be deallocated after use. */
+
+static char *
+exception_name_from_cond (const char *condition)
+{
+ char *start, *end, *exception_name;
+ int exception_name_len;
+
+ start = strrchr (condition, '&') + 1;
+ end = strchr (start, ')') - 1;
+ exception_name_len = end - start + 1;
+
+ exception_name =
+ (char *) xmalloc ((exception_name_len + 1) * sizeof (char));
+ sprintf (exception_name, "%.*s", exception_name_len, start);
+
+ return exception_name;
+}
+
+/* Print Ada-specific exception information about B, other than task
+ clause. Return non-zero iff B was an Ada exception breakpoint. */
+
+int
+ada_print_exception_breakpoint_nontask (struct breakpoint *b)
+{
+ if (b->break_on_exception == 1)
+ {
+ if (b->cond_string) /* the breakpoint is on a specific exception. */
+ {
+ char *exception_name = exception_name_from_cond (b->cond_string);
+
+ make_cleanup (xfree, exception_name);
+
+ ui_out_text (uiout, "on ");
+ if (ui_out_is_mi_like_p (uiout))
+ ui_out_field_string (uiout, "exception", exception_name);
+ else
+ {
+ ui_out_text (uiout, "exception ");
+ ui_out_text (uiout, exception_name);
+ ui_out_text (uiout, " ");
+ }
+ }
+ else
+ ui_out_text (uiout, "on all exceptions");
+ }
+ else if (b->break_on_exception == 2)
+ ui_out_text (uiout, "on unhandled exception");
+ else if (b->break_on_exception == 3)
+ ui_out_text (uiout, "on assert failure");
+ else
+ return 0;
+ return 1;
+}
+
+/* Print task identifier for breakpoint B, if it is an Ada-specific
+ breakpoint with non-zero tasking information. */
+
+void
+ada_print_exception_breakpoint_task (struct breakpoint *b)
+{
+ if (b->task != 0)
+ {
+ ui_out_text (uiout, " task ");
+ ui_out_field_int (uiout, "task", b->task);
+ }
+}
+
+int
+ada_is_exception_sym (struct symbol *sym)
+{
+ char *type_name = type_name_no_tag (SYMBOL_TYPE (sym));
+
+ return (SYMBOL_CLASS (sym) != LOC_TYPEDEF
+ && SYMBOL_CLASS (sym) != LOC_BLOCK
+ && SYMBOL_CLASS (sym) != LOC_CONST
+ && type_name != NULL && strcmp (type_name, "exception") == 0);
+}
+
+int
+ada_maybe_exception_partial_symbol (struct partial_symbol *sym)
+{
+ return (SYMBOL_CLASS (sym) != LOC_TYPEDEF
+ && SYMBOL_CLASS (sym) != LOC_BLOCK
+ && SYMBOL_CLASS (sym) != LOC_CONST);
+}
+
+/* Cause the appropriate error if no appropriate runtime symbol is
+ found to set a breakpoint, using ERR_DESC to describe the
+ breakpoint. */
+
+static void
+error_breakpoint_runtime_sym_not_found (const char *err_desc)
+{
+ /* If we are not debugging an Ada program, we can not put exception
+ breakpoints! */
+
+ if (ada_update_initial_language (language_unknown, NULL) != language_ada)
+ error ("Unable to break on %s. Is this an Ada main program?", err_desc);
+
+ /* If the symbol does not exist, then check that the program is
+ already started, to make sure that shared libraries have been
+ loaded. If it is not started, this may mean that the symbol is
+ in a shared library. */
+
+ if (ptid_get_pid (inferior_ptid) == 0)
+ error ("Unable to break on %s. Try to start the program first.",
+ err_desc);
+
+ /* At this point, we know that we are debugging an Ada program and
+ that the inferior has been started, but we still are not able to
+ find the run-time symbols. That can mean that we are in
+ configurable run time mode, or that a-except as been optimized
+ out by the linker... In any case, at this point it is not worth
+ supporting this feature. */
+
+ error ("Cannot break on %s in this configuration.", err_desc);
+}
+
+/* Test if NAME is currently defined, and that either ALLOW_TRAMP or
+ the symbol is not a shared-library trampoline. Return the result of
+ the test. */
+
+static int
+is_runtime_sym_defined (const char *name, int allow_tramp)
+{
+ struct minimal_symbol *msym;
+
+ msym = lookup_minimal_symbol (name, NULL, NULL);
+ return (msym != NULL && msym->type != mst_unknown
+ && (allow_tramp || msym->type != mst_solib_trampoline));
+}
+
+/* If ARG points to an Ada exception or assert breakpoint, rewrite
+ into equivalent form. Return resulting argument string. Set
+ *BREAK_ON_EXCEPTIONP to 1 for ordinary break on exception, 2 for
+ break on unhandled, 3 for assert, 0 otherwise. */
+
+char *
+ada_breakpoint_rewrite (char *arg, int *break_on_exceptionp)
+{
+ if (arg == NULL)
+ return arg;
+ *break_on_exceptionp = 0;
+ if (current_language->la_language == language_ada
+ && strncmp (arg, "exception", 9) == 0
+ && (arg[9] == ' ' || arg[9] == '\t' || arg[9] == '\0'))
+ {
+ char *tok, *end_tok;
+ int toklen;
+ int has_exception_propagation =
+ is_runtime_sym_defined (raise_sym_name, 1);
+
+ *break_on_exceptionp = 1;
+
+ tok = arg + 9;
+ while (*tok == ' ' || *tok == '\t')
+ tok += 1;
+
+ end_tok = tok;
+
+ while (*end_tok != ' ' && *end_tok != '\t' && *end_tok != '\000')
+ end_tok += 1;
+
+ toklen = end_tok - tok;
+
+ arg = (char *) xmalloc (sizeof (longest_exception_template) + toklen);
+ make_cleanup (xfree, arg);
+ if (toklen == 0)
+ {
+ if (has_exception_propagation)
+ sprintf (arg, "'%s'", raise_sym_name);
+ else
+ error_breakpoint_runtime_sym_not_found ("exception");
+ }
+ else if (strncmp (tok, "unhandled", toklen) == 0)
+ {
+ if (is_runtime_sym_defined (raise_unhandled_sym_name, 1))
+ sprintf (arg, "'%s'", raise_unhandled_sym_name);
+ else
+ error_breakpoint_runtime_sym_not_found ("exception");
+
+ *break_on_exceptionp = 2;
+ }
+ else
+ {
+ if (is_runtime_sym_defined (raise_sym_name, 0))
+ sprintf (arg, "'%s' if long_integer(e) = long_integer(&%.*s)",
+ raise_sym_name, toklen, tok);
+ else
+ error_breakpoint_runtime_sym_not_found ("specific exception");
+ }
+ }
+ else if (current_language->la_language == language_ada
+ && strncmp (arg, "assert", 6) == 0
+ && (arg[6] == ' ' || arg[6] == '\t' || arg[6] == '\0'))
+ {
+ char *tok = arg + 6;
+
+ if (!is_runtime_sym_defined (raise_assert_sym_name, 1))
+ error_breakpoint_runtime_sym_not_found ("failed assertion");
+
+ *break_on_exceptionp = 3;
+
+ arg =
+ (char *) xmalloc (sizeof (raise_assert_sym_name) + strlen (tok) + 2);
+ make_cleanup (xfree, arg);
+ sprintf (arg, "'%s'%s", raise_assert_sym_name, tok);
+ }
+ return arg;
+}
+#endif
+
/* Field Access */
/* True if field number FIELD_NUM in struct or union type TYPE is supposed
@@ -5069,14 +6718,14 @@ ada_parent_type (struct type *type)
{
int i;
- type = ada_check_typedef (type);
+ CHECK_TYPEDEF (type);
if (type == NULL || TYPE_CODE (type) != TYPE_CODE_STRUCT)
return NULL;
for (i = 0; i < TYPE_NFIELDS (type); i += 1)
if (ada_is_parent_field (type, i))
- return ada_check_typedef (TYPE_FIELD_TYPE (type, i));
+ return check_typedef (TYPE_FIELD_TYPE (type, i));
return NULL;
}
@@ -5088,7 +6737,7 @@ ada_parent_type (struct type *type)
int
ada_is_parent_field (struct type *type, int field_num)
{
- const char *name = TYPE_FIELD_NAME (ada_check_typedef (type), field_num);
+ const char *name = TYPE_FIELD_NAME (check_typedef (type), field_num);
return (name != NULL
&& (strncmp (name, "PARENT", 6) == 0
|| strncmp (name, "_parent", 7) == 0));
@@ -5305,7 +6954,7 @@ ada_value_primitive_field (struct value *arg1, int offset, int fieldno,
{
struct type *type;
- arg_type = ada_check_typedef (arg_type);
+ CHECK_TYPEDEF (arg_type);
type = TYPE_FIELD_TYPE (arg_type, fieldno);
/* Handle packed fields. */
@@ -5337,7 +6986,7 @@ find_struct_field (char *name, struct type *type, int offset,
{
int i;
- type = ada_check_typedef (type);
+ CHECK_TYPEDEF (type);
*field_type_p = NULL;
*byte_offset_p = *bit_offset_p = *bit_size_p = 0;
@@ -5369,7 +7018,7 @@ find_struct_field (char *name, struct type *type, int offset,
else if (ada_is_variant_part (type, i))
{
int j;
- struct type *field_type = ada_check_typedef (TYPE_FIELD_TYPE (type, i));
+ struct type *field_type = check_typedef (TYPE_FIELD_TYPE (type, i));
for (j = TYPE_NFIELDS (field_type) - 1; j >= 0; j -= 1)
{
@@ -5398,7 +7047,7 @@ ada_search_struct_field (char *name, struct value *arg, int offset,
struct type *type)
{
int i;
- type = ada_check_typedef (type);
+ CHECK_TYPEDEF (type);
for (i = TYPE_NFIELDS (type) - 1; i >= 0; i -= 1)
{
@@ -5423,7 +7072,7 @@ ada_search_struct_field (char *name, struct value *arg, int offset,
else if (ada_is_variant_part (type, i))
{
int j;
- struct type *field_type = ada_check_typedef (TYPE_FIELD_TYPE (type, i));
+ struct type *field_type = check_typedef (TYPE_FIELD_TYPE (type, i));
int var_offset = offset + TYPE_FIELD_BITPOS (type, i) / 8;
for (j = TYPE_NFIELDS (field_type) - 1; j >= 0; j -= 1)
@@ -5464,7 +7113,7 @@ ada_value_struct_elt (struct value *arg, char *name, char *err)
struct value *v;
v = NULL;
- t1 = t = ada_check_typedef (VALUE_TYPE (arg));
+ t1 = t = check_typedef (VALUE_TYPE (arg));
if (TYPE_CODE (t) == TYPE_CODE_REF)
{
t1 = TYPE_TARGET_TYPE (t);
@@ -5475,7 +7124,7 @@ ada_value_struct_elt (struct value *arg, char *name, char *err)
else
error ("Bad value type in a %s.", err);
}
- t1 = ada_check_typedef (t1);
+ CHECK_TYPEDEF (t1);
if (TYPE_CODE (t1) == TYPE_CODE_PTR)
{
COERCE_REF (arg);
@@ -5493,7 +7142,7 @@ ada_value_struct_elt (struct value *arg, char *name, char *err)
else
error ("Bad value type in a %s.", err);
}
- t1 = ada_check_typedef (t1);
+ CHECK_TYPEDEF (t1);
if (TYPE_CODE (t1) == TYPE_CODE_PTR)
{
arg = value_ind (arg);
@@ -5532,10 +7181,7 @@ ada_value_struct_elt (struct value *arg, char *name, char *err)
{
if (bit_size != 0)
{
- if (TYPE_CODE (t) == TYPE_CODE_REF)
- arg = ada_coerce_ref (arg);
- else
- arg = ada_value_ind (arg);
+ arg = ada_value_ind (arg);
v = ada_value_primitive_packed_val (arg, NULL, byte_offset,
bit_offset, bit_size,
field_type);
@@ -5581,7 +7227,7 @@ ada_lookup_struct_elt_type (struct type *type, char *name, int refok,
if (refok && type != NULL)
while (1)
{
- type = ada_check_typedef (type);
+ CHECK_TYPEDEF (type);
if (TYPE_CODE (type) != TYPE_CODE_PTR
&& TYPE_CODE (type) != TYPE_CODE_REF)
break;
@@ -5622,7 +7268,7 @@ ada_lookup_struct_elt_type (struct type *type, char *name, int refok,
{
if (dispp != NULL)
*dispp += TYPE_FIELD_BITPOS (type, i) / 8;
- return ada_check_typedef (TYPE_FIELD_TYPE (type, i));
+ return check_typedef (TYPE_FIELD_TYPE (type, i));
}
else if (ada_is_wrapper_field (type, i))
@@ -5641,7 +7287,7 @@ ada_lookup_struct_elt_type (struct type *type, char *name, int refok,
else if (ada_is_variant_part (type, i))
{
int j;
- struct type *field_type = ada_check_typedef (TYPE_FIELD_TYPE (type, i));
+ struct type *field_type = check_typedef (TYPE_FIELD_TYPE (type, i));
for (j = TYPE_NFIELDS (field_type) - 1; j >= 0; j -= 1)
{
@@ -5950,7 +7596,7 @@ ada_find_parallel_type (struct type *type, const char *suffix)
static struct type *
dynamic_template_type (struct type *type)
{
- type = ada_check_typedef (type);
+ CHECK_TYPEDEF (type);
if (type == NULL || TYPE_CODE (type) != TYPE_CODE_STRUCT
|| ada_type_name (type) == NULL)
@@ -6074,8 +7720,9 @@ ada_template_to_fixed_record_type_1 (struct type *type, char *valaddr,
for (f = 0; f < nfields; f += 1)
{
- off = align_value (off, field_alignment (type, f))
- + TYPE_FIELD_BITPOS (type, f);
+ off =
+ align_value (off,
+ field_alignment (type, f)) + TYPE_FIELD_BITPOS (type, f);
TYPE_FIELD_BITPOS (rtype, f) = off;
TYPE_FIELD_BITSIZE (rtype, f) = 0;
@@ -6159,23 +7806,7 @@ ada_template_to_fixed_record_type_1 (struct type *type, char *valaddr,
}
}
- /* According to exp_dbug.ads, the size of TYPE for variable-size records
- should contain the alignment of that record, which should be a strictly
- positive value. If null or negative, then something is wrong, most
- probably in the debug info. In that case, we don't round up the size
- of the resulting type. If this record is not part of another structure,
- the current RTYPE length might be good enough for our purposes. */
- if (TYPE_LENGTH (type) <= 0)
- {
- warning ("Invalid type size for `%s' detected: %d.",
- TYPE_NAME (rtype) ? TYPE_NAME (rtype) : "<unnamed>",
- TYPE_LENGTH (type));
- }
- else
- {
- TYPE_LENGTH (rtype) = align_value (TYPE_LENGTH (rtype),
- TYPE_LENGTH (type));
- }
+ TYPE_LENGTH (rtype) = align_value (TYPE_LENGTH (rtype), TYPE_LENGTH (type));
value_free_to_mark (mark);
if (TYPE_LENGTH (rtype) > varsize_limit)
@@ -6218,7 +7849,7 @@ template_to_static_fixed_type (struct type *type0)
for (f = 0; f < nfields; f += 1)
{
- struct type *field_type = ada_check_typedef (TYPE_FIELD_TYPE (type0, f));
+ struct type *field_type = CHECK_TYPEDEF (TYPE_FIELD_TYPE (type0, f));
struct type *new_type;
if (is_dynamic_field (type0, f))
@@ -6424,7 +8055,7 @@ to_fixed_array_type (struct type *type0, struct value *dval,
index_type_desc = ada_find_parallel_type (type0, "___XA");
if (index_type_desc == NULL)
{
- struct type *elt_type0 = ada_check_typedef (TYPE_TARGET_TYPE (type0));
+ struct type *elt_type0 = check_typedef (TYPE_TARGET_TYPE (type0));
/* NOTE: elt_type---the fixed version of elt_type0---should never
depend on the contents of the array in properly constructed
debugging data. */
@@ -6448,7 +8079,7 @@ to_fixed_array_type (struct type *type0, struct value *dval,
/* NOTE: result---the fixed version of elt_type0---should never
depend on the contents of the array in properly constructed
debugging data. */
- result = ada_to_fixed_type (ada_check_typedef (elt_type0), 0, 0, dval);
+ result = ada_to_fixed_type (check_typedef (elt_type0), 0, 0, dval);
for (i = TYPE_NFIELDS (index_type_desc) - 1; i >= 0; i -= 1)
{
struct type *range_type =
@@ -6476,7 +8107,7 @@ struct type *
ada_to_fixed_type (struct type *type, char *valaddr,
CORE_ADDR address, struct value *dval)
{
- type = ada_check_typedef (type);
+ CHECK_TYPEDEF (type);
switch (TYPE_CODE (type))
{
default:
@@ -6519,7 +8150,7 @@ to_static_fixed_type (struct type *type0)
if (TYPE_FLAGS (type0) & TYPE_FLAG_FIXED_INSTANCE)
return type0;
- type0 = ada_check_typedef (type0);
+ CHECK_TYPEDEF (type0);
switch (TYPE_CODE (type0))
{
@@ -6547,7 +8178,7 @@ static_unwrap_type (struct type *type)
{
if (ada_is_aligner_type (type))
{
- struct type *type1 = TYPE_FIELD_TYPE (ada_check_typedef (type), 0);
+ struct type *type1 = TYPE_FIELD_TYPE (check_typedef (type), 0);
if (ada_type_name (type1) == NULL)
TYPE_NAME (type1) = ada_type_name (type);
@@ -6578,7 +8209,7 @@ static_unwrap_type (struct type *type)
exists, otherwise TYPE. */
struct type *
-ada_check_typedef (struct type *type)
+ada_completed_type (struct type *type)
{
CHECK_TYPEDEF (type);
if (type == NULL || TYPE_CODE (type) != TYPE_CODE_ENUM
@@ -6622,6 +8253,24 @@ ada_to_fixed_value (struct value *val)
val);
}
+/* If the PC is pointing inside a function prologue, then re-adjust it
+ past this prologue. */
+
+static void
+adjust_pc_past_prologue (CORE_ADDR *pc)
+{
+ struct symbol *func_sym = find_pc_function (*pc);
+
+ if (func_sym)
+ {
+ const struct symtab_and_line sal =
+ find_function_start_sal (func_sym, 1);
+
+ if (*pc <= sal.pc)
+ *pc = sal.pc;
+ }
+}
+
/* A value representing VAL, but with a standard (static-sized) type
chosen to approximate the real type of VAL as well as possible, but
without consulting any runtime values. For Ada dynamic-sized
@@ -6699,7 +8348,7 @@ pos_atr (struct value *arg)
static struct value *
value_pos_atr (struct value *arg)
{
- return value_from_longest (builtin_type_int, pos_atr (arg));
+ return value_from_longest (builtin_type_ada_int, pos_atr (arg));
}
/* Evaluate the TYPE'VAL attribute applied to ARG. */
@@ -6749,7 +8398,7 @@ ada_is_character_type (struct type *type)
int
ada_is_string_type (struct type *type)
{
- type = ada_check_typedef (type);
+ CHECK_TYPEDEF (type);
if (type != NULL
&& TYPE_CODE (type) != TYPE_CODE_PTR
&& (ada_is_simple_array_type (type)
@@ -6772,14 +8421,7 @@ ada_is_string_type (struct type *type)
int
ada_is_aligner_type (struct type *type)
{
- type = ada_check_typedef (type);
-
- /* If we can find a parallel XVS type, then the XVS type should
- be used instead of this type. And hence, this is not an aligner
- type. */
- if (ada_find_parallel_type (type, "___XVS") != NULL)
- return 0;
-
+ CHECK_TYPEDEF (type);
return (TYPE_CODE (type) == TYPE_CODE_STRUCT
&& TYPE_NFIELDS (type) == 1
&& strcmp (TYPE_FIELD_NAME (type, 0), "F") == 0);
@@ -6934,12 +8576,12 @@ evaluate_subexp_type (struct expression *exp, int *pos)
static struct value *
unwrap_value (struct value *val)
{
- struct type *type = ada_check_typedef (VALUE_TYPE (val));
+ struct type *type = check_typedef (VALUE_TYPE (val));
if (ada_is_aligner_type (type))
{
struct value *v = value_struct_elt (&val, NULL, "F",
NULL, "internal structure");
- struct type *val_type = ada_check_typedef (VALUE_TYPE (v));
+ struct type *val_type = check_typedef (VALUE_TYPE (v));
if (ada_type_name (val_type) == NULL)
TYPE_NAME (val_type) = ada_type_name (type);
@@ -6948,7 +8590,7 @@ unwrap_value (struct value *val)
else
{
struct type *raw_real_type =
- ada_check_typedef (ada_get_base_type (type));
+ ada_completed_type (ada_get_base_type (type));
if (type == raw_real_type)
return val;
@@ -7000,8 +8642,8 @@ coerce_for_assign (struct type *type, struct value *val)
if (type == type2)
return val;
- type2 = ada_check_typedef (type2);
- type = ada_check_typedef (type);
+ CHECK_TYPEDEF (type2);
+ CHECK_TYPEDEF (type);
if (TYPE_CODE (type2) == TYPE_CODE_PTR
&& TYPE_CODE (type) == TYPE_CODE_ARRAY)
@@ -7031,8 +8673,8 @@ ada_value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
COERCE_REF (arg1);
COERCE_REF (arg2);
- type1 = base_type (ada_check_typedef (VALUE_TYPE (arg1)));
- type2 = base_type (ada_check_typedef (VALUE_TYPE (arg2)));
+ type1 = base_type (check_typedef (VALUE_TYPE (arg1)));
+ type2 = base_type (check_typedef (VALUE_TYPE (arg2)));
if (TYPE_CODE (type1) != TYPE_CODE_INT
|| TYPE_CODE (type2) != TYPE_CODE_INT)
@@ -7143,7 +8785,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
arg1 = evaluate_subexp (type, exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
- if (type != ada_check_typedef (VALUE_TYPE (arg1)))
+ if (type != check_typedef (VALUE_TYPE (arg1)))
{
if (ada_is_fixed_point_type (type))
arg1 = cast_to_fixed (type, arg1);
@@ -7320,20 +8962,20 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
&& VALUE_LVAL (argvec[0]) == lval_memory))
argvec[0] = value_addr (argvec[0]);
- type = ada_check_typedef (VALUE_TYPE (argvec[0]));
+ type = check_typedef (VALUE_TYPE (argvec[0]));
if (TYPE_CODE (type) == TYPE_CODE_PTR)
{
- switch (TYPE_CODE (ada_check_typedef (TYPE_TARGET_TYPE (type))))
+ switch (TYPE_CODE (check_typedef (TYPE_TARGET_TYPE (type))))
{
case TYPE_CODE_FUNC:
- type = ada_check_typedef (TYPE_TARGET_TYPE (type));
+ type = check_typedef (TYPE_TARGET_TYPE (type));
break;
case TYPE_CODE_ARRAY:
break;
case TYPE_CODE_STRUCT:
if (noside != EVAL_AVOID_SIDE_EFFECTS)
argvec[0] = ada_value_ind (argvec[0]);
- type = ada_check_typedef (TYPE_TARGET_TYPE (type));
+ type = check_typedef (TYPE_TARGET_TYPE (type));
break;
default:
error ("cannot subscript or call something of type `%s'",
@@ -7392,8 +9034,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
nargs, argvec + 1));
default:
- error ("Attempt to index or call something other than an "
- "array or function");
+ error ("Internal error in evaluate_subexp");
}
case TERNOP_SLICE:
@@ -7401,15 +9042,9 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
struct value *array = evaluate_subexp (NULL_TYPE, exp, pos, noside);
struct value *low_bound_val =
evaluate_subexp (NULL_TYPE, exp, pos, noside);
- struct value *high_bound_val =
- evaluate_subexp (NULL_TYPE, exp, pos, noside);
- LONGEST low_bound;
- LONGEST high_bound;
- COERCE_REF (low_bound_val);
- COERCE_REF (high_bound_val);
- low_bound = pos_atr (low_bound_val);
- high_bound = pos_atr (high_bound_val);
-
+ LONGEST low_bound = pos_atr (low_bound_val);
+ LONGEST high_bound
+ = pos_atr (evaluate_subexp (NULL_TYPE, exp, pos, noside));
if (noside == EVAL_SKIP)
goto nosideret;
@@ -7431,26 +9066,12 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
array = value_addr (array);
if (noside == EVAL_AVOID_SIDE_EFFECTS
- && ada_is_array_descriptor_type (ada_check_typedef
- (VALUE_TYPE (array))))
+ && ada_is_array_descriptor_type (check_typedef
+ (VALUE_TYPE (array))))
return empty_array (ada_type_of_array (array, 0), low_bound);
array = ada_coerce_to_simple_array_ptr (array);
- /* If we have more than one level of pointer indirection,
- dereference the value until we get only one level. */
- while (TYPE_CODE (VALUE_TYPE (array)) == TYPE_CODE_PTR
- && (TYPE_CODE (TYPE_TARGET_TYPE (VALUE_TYPE (array)))
- == TYPE_CODE_PTR))
- array = value_ind (array);
-
- /* Make sure we really do have an array type before going further,
- to avoid a SEGV when trying to get the index type or the target
- type later down the road if the debug info generated by
- the compiler is incorrect or incomplete. */
- if (!ada_is_simple_array_type (VALUE_TYPE (array)))
- error ("cannot take slice of non-array");
-
if (TYPE_CODE (VALUE_TYPE (array)) == TYPE_CODE_PTR)
{
if (high_bound < low_bound || noside == EVAL_AVOID_SIDE_EFFECTS)
@@ -7462,8 +9083,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
to_fixed_array_type (TYPE_TARGET_TYPE (VALUE_TYPE (array)),
NULL, 1);
return ada_value_slice_ptr (array, arr_type0,
- (int) low_bound,
- (int) high_bound);
+ (int) low_bound, (int) high_bound);
}
}
else if (noside == EVAL_AVOID_SIDE_EFFECTS)
@@ -7486,7 +9106,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
{
default:
lim_warning ("Membership test incompletely implemented; "
- "always returns true");
+ "always returns true", 0);
return value_from_longest (builtin_type_int, (LONGEST) 1);
case TYPE_CODE_RANGE:
@@ -7704,7 +9324,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
if (noside == EVAL_SKIP)
goto nosideret;
else if (noside == EVAL_AVOID_SIDE_EFFECTS)
- return value_zero (builtin_type_int, not_lval);
+ return value_zero (builtin_type_ada_int, not_lval);
else
return value_pos_atr (arg1);
@@ -7713,9 +9333,9 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
if (noside == EVAL_SKIP)
goto nosideret;
else if (noside == EVAL_AVOID_SIDE_EFFECTS)
- return value_zero (builtin_type_int, not_lval);
+ return value_zero (builtin_type_ada_int, not_lval);
else
- return value_from_longest (builtin_type_int,
+ return value_from_longest (builtin_type_ada_int,
TARGET_CHAR_BIT
* TYPE_LENGTH (VALUE_TYPE (arg1)));
@@ -7758,11 +9378,11 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
case UNOP_IND:
if (expect_type && TYPE_CODE (expect_type) == TYPE_CODE_PTR)
- expect_type = TYPE_TARGET_TYPE (ada_check_typedef (expect_type));
+ expect_type = TYPE_TARGET_TYPE (check_typedef (expect_type));
arg1 = evaluate_subexp (expect_type, exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
- type = ada_check_typedef (VALUE_TYPE (arg1));
+ type = check_typedef (VALUE_TYPE (arg1));
if (noside == EVAL_AVOID_SIDE_EFFECTS)
{
if (ada_is_array_descriptor_type (type))
@@ -7777,13 +9397,11 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
|| TYPE_CODE (type) == TYPE_CODE_REF
/* In C you can dereference an array to get the 1st elt. */
|| TYPE_CODE (type) == TYPE_CODE_ARRAY)
- {
- type = to_static_fixed_type
- (ada_aligned_type
- (ada_check_typedef (TYPE_TARGET_TYPE (type))));
- check_size (type);
- return value_zero (type, lval_memory);
- }
+ return
+ value_zero
+ (to_static_fixed_type
+ (ada_aligned_type (check_typedef (TYPE_TARGET_TYPE (type)))),
+ lval_memory);
else if (TYPE_CODE (type) == TYPE_CODE_INT)
/* GDB allows dereferencing an int. */
return value_zero (builtin_type_int, lval_memory);
@@ -7791,7 +9409,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
error ("Attempt to take contents of a non-pointer value.");
}
arg1 = ada_coerce_ref (arg1); /* FIXME: What is this for?? */
- type = ada_check_typedef (VALUE_TYPE (arg1));
+ type = check_typedef (VALUE_TYPE (arg1));
if (ada_is_array_descriptor_type (type))
/* GDB allows dereferencing GNAT array descriptors. */
@@ -8150,7 +9768,7 @@ to_fixed_range_type (char *name, struct value *dval, struct objfile *objfile)
L = get_int_var_value (name_buf, &ok);
if (!ok)
{
- lim_warning ("Unknown lower bound, using 1.");
+ lim_warning ("Unknown lower bound, using 1.", 1);
L = 1;
}
}
@@ -8206,10 +9824,10 @@ ada_is_modular_type (struct type *type)
/* Assuming ada_is_modular_type (TYPE), the modulus of TYPE. */
-ULONGEST
+LONGEST
ada_modulus (struct type * type)
{
- return (ULONGEST) TYPE_HIGH_BOUND (type) + 1;
+ return TYPE_HIGH_BOUND (type) + 1;
}
/* Operators */
@@ -8470,7 +10088,179 @@ static const struct op_print ada_op_print_tab[] = {
{NULL, 0, 0, 0}
};
- /* Fundamental Ada Types */
+ /* Assorted Types and Interfaces */
+
+struct type *builtin_type_ada_int;
+struct type *builtin_type_ada_short;
+struct type *builtin_type_ada_long;
+struct type *builtin_type_ada_long_long;
+struct type *builtin_type_ada_char;
+struct type *builtin_type_ada_float;
+struct type *builtin_type_ada_double;
+struct type *builtin_type_ada_long_double;
+struct type *builtin_type_ada_natural;
+struct type *builtin_type_ada_positive;
+struct type *builtin_type_ada_system_address;
+
+struct type **const (ada_builtin_types[]) =
+{
+ &builtin_type_ada_int,
+ &builtin_type_ada_long,
+ &builtin_type_ada_short,
+ &builtin_type_ada_char,
+ &builtin_type_ada_float,
+ &builtin_type_ada_double,
+ &builtin_type_ada_long_long,
+ &builtin_type_ada_long_double,
+ &builtin_type_ada_natural, &builtin_type_ada_positive,
+ /* The following types are carried over from C for convenience. */
+&builtin_type_int,
+ &builtin_type_long,
+ &builtin_type_short,
+ &builtin_type_char,
+ &builtin_type_float,
+ &builtin_type_double,
+ &builtin_type_long_long,
+ &builtin_type_void,
+ &builtin_type_signed_char,
+ &builtin_type_unsigned_char,
+ &builtin_type_unsigned_short,
+ &builtin_type_unsigned_int,
+ &builtin_type_unsigned_long,
+ &builtin_type_unsigned_long_long,
+ &builtin_type_long_double,
+ &builtin_type_complex, &builtin_type_double_complex, 0};
+
+/* Not really used, but needed in the ada_language_defn. */
+
+static void
+emit_char (int c, struct ui_file *stream, int quoter)
+{
+ ada_emit_char (c, stream, quoter, 1);
+}
+
+static int
+parse (void)
+{
+ warnings_issued = 0;
+ return ada_parse ();
+}
+
+static const struct exp_descriptor ada_exp_descriptor = {
+ ada_print_subexp,
+ ada_operator_length,
+ ada_op_name,
+ ada_dump_subexp_body,
+ ada_evaluate_subexp
+};
+
+const struct language_defn ada_language_defn = {
+ "ada", /* Language name */
+ language_ada,
+ ada_builtin_types,
+ range_check_off,
+ type_check_off,
+ case_sensitive_on, /* Yes, Ada is case-insensitive, but
+ that's not quite what this means. */
+#ifdef GNAT_GDB
+ ada_lookup_symbol,
+ ada_lookup_minimal_symbol,
+#endif /* GNAT_GDB */
+ array_row_major,
+ &ada_exp_descriptor,
+ parse,
+ ada_error,
+ resolve,
+ ada_printchar, /* Print a character constant */
+ ada_printstr, /* Function to print string constant */
+ emit_char, /* Function to print single char (not used) */
+ ada_create_fundamental_type, /* Create fundamental type in this language */
+ ada_print_type, /* Print a type using appropriate syntax */
+ ada_val_print, /* Print a value using appropriate syntax */
+ ada_value_print, /* Print a top-level value */
+ NULL, /* Language specific skip_trampoline */
+ NULL, /* value_of_this */
+ ada_lookup_symbol_nonlocal, /* Looking up non-local symbols. */
+ basic_lookup_transparent_type, /* lookup_transparent_type */
+ ada_la_decode, /* Language specific symbol demangler */
+ NULL, /* Language specific class_name_from_physname */
+ ada_op_print_tab, /* expression operators for printing */
+ 0, /* c-style arrays */
+ 1, /* String lower bound */
+ &builtin_type_ada_char,
+ ada_get_gdb_completer_word_break_characters,
+#ifdef GNAT_GDB
+ ada_translate_error_message, /* Substitute Ada-specific terminology
+ in errors and warnings. */
+#endif /* GNAT_GDB */
+ LANG_MAGIC
+};
+
+static void
+build_ada_types (struct gdbarch *current_gdbarch)
+{
+ builtin_type_ada_int =
+ init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
+ 0, "integer", (struct objfile *) NULL);
+ builtin_type_ada_long =
+ init_type (TYPE_CODE_INT, TARGET_LONG_BIT / TARGET_CHAR_BIT,
+ 0, "long_integer", (struct objfile *) NULL);
+ builtin_type_ada_short =
+ init_type (TYPE_CODE_INT, TARGET_SHORT_BIT / TARGET_CHAR_BIT,
+ 0, "short_integer", (struct objfile *) NULL);
+ builtin_type_ada_char =
+ init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
+ 0, "character", (struct objfile *) NULL);
+ builtin_type_ada_float =
+ init_type (TYPE_CODE_FLT, TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
+ 0, "float", (struct objfile *) NULL);
+ builtin_type_ada_double =
+ init_type (TYPE_CODE_FLT, TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
+ 0, "long_float", (struct objfile *) NULL);
+ builtin_type_ada_long_long =
+ init_type (TYPE_CODE_INT, TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
+ 0, "long_long_integer", (struct objfile *) NULL);
+ builtin_type_ada_long_double =
+ init_type (TYPE_CODE_FLT, TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
+ 0, "long_long_float", (struct objfile *) NULL);
+ builtin_type_ada_natural =
+ init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
+ 0, "natural", (struct objfile *) NULL);
+ builtin_type_ada_positive =
+ init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
+ 0, "positive", (struct objfile *) NULL);
+
+
+ builtin_type_ada_system_address =
+ lookup_pointer_type (init_type (TYPE_CODE_VOID, 1, 0, "void",
+ (struct objfile *) NULL));
+ TYPE_NAME (builtin_type_ada_system_address) = "system__address";
+}
+
+void
+_initialize_ada_language (void)
+{
+
+ build_ada_types (current_gdbarch);
+ gdbarch_data_register_post_init (build_ada_types);
+ add_language (&ada_language_defn);
+
+ varsize_limit = 65536;
+#ifdef GNAT_GDB
+ add_setshow_uinteger_cmd ("varsize-limit", class_support,
+ &varsize_limit, "\
+Set the maximum number of bytes allowed in a dynamic-sized object.", "\
+Show the maximum number of bytes allowed in a dynamic-sized object.",
+ NULL, NULL, &setlist, &showlist);
+ obstack_init (&cache_space);
+#endif /* GNAT_GDB */
+
+ obstack_init (&symbol_list_obstack);
+
+ decoded_names_store = htab_create_alloc
+ (256, htab_hash_string, (int (*)(const void *, const void *)) streq,
+ NULL, xcalloc, xfree);
+}
/* Create a fundamental Ada type using default reasonable for the current
target machine.
@@ -8553,9 +10343,7 @@ ada_create_fundamental_type (struct objfile *objfile, int typeid)
0, "integer", objfile);
break;
case FT_SIGNED_INTEGER:
- type = init_type (TYPE_CODE_INT, TARGET_INT_BIT /
- TARGET_CHAR_BIT,
- 0, "integer", objfile); /* FIXME -fnf */
+ type = init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT, 0, "integer", objfile); /* FIXME -fnf */
break;
case FT_UNSIGNED_INTEGER:
type = init_type (TYPE_CODE_INT,
@@ -8611,140 +10399,22 @@ ada_create_fundamental_type (struct objfile *objfile, int typeid)
return (type);
}
-enum ada_primitive_types {
- ada_primitive_type_int,
- ada_primitive_type_long,
- ada_primitive_type_short,
- ada_primitive_type_char,
- ada_primitive_type_float,
- ada_primitive_type_double,
- ada_primitive_type_void,
- ada_primitive_type_long_long,
- ada_primitive_type_long_double,
- ada_primitive_type_natural,
- ada_primitive_type_positive,
- ada_primitive_type_system_address,
- nr_ada_primitive_types
-};
-
-static void
-ada_language_arch_info (struct gdbarch *current_gdbarch,
- struct language_arch_info *lai)
-{
- const struct builtin_type *builtin = builtin_type (current_gdbarch);
- lai->primitive_type_vector
- = GDBARCH_OBSTACK_CALLOC (current_gdbarch, nr_ada_primitive_types + 1,
- struct type *);
- lai->primitive_type_vector [ada_primitive_type_int] =
- init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
- 0, "integer", (struct objfile *) NULL);
- lai->primitive_type_vector [ada_primitive_type_long] =
- init_type (TYPE_CODE_INT, TARGET_LONG_BIT / TARGET_CHAR_BIT,
- 0, "long_integer", (struct objfile *) NULL);
- lai->primitive_type_vector [ada_primitive_type_short] =
- init_type (TYPE_CODE_INT, TARGET_SHORT_BIT / TARGET_CHAR_BIT,
- 0, "short_integer", (struct objfile *) NULL);
- lai->string_char_type =
- lai->primitive_type_vector [ada_primitive_type_char] =
- init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
- 0, "character", (struct objfile *) NULL);
- lai->primitive_type_vector [ada_primitive_type_float] =
- init_type (TYPE_CODE_FLT, TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
- 0, "float", (struct objfile *) NULL);
- lai->primitive_type_vector [ada_primitive_type_double] =
- init_type (TYPE_CODE_FLT, TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
- 0, "long_float", (struct objfile *) NULL);
- lai->primitive_type_vector [ada_primitive_type_long_long] =
- init_type (TYPE_CODE_INT, TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
- 0, "long_long_integer", (struct objfile *) NULL);
- lai->primitive_type_vector [ada_primitive_type_long_double] =
- init_type (TYPE_CODE_FLT, TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
- 0, "long_long_float", (struct objfile *) NULL);
- lai->primitive_type_vector [ada_primitive_type_natural] =
- init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
- 0, "natural", (struct objfile *) NULL);
- lai->primitive_type_vector [ada_primitive_type_positive] =
- init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
- 0, "positive", (struct objfile *) NULL);
- lai->primitive_type_vector [ada_primitive_type_void] = builtin->builtin_void;
-
- lai->primitive_type_vector [ada_primitive_type_system_address] =
- lookup_pointer_type (init_type (TYPE_CODE_VOID, 1, 0, "void",
- (struct objfile *) NULL));
- TYPE_NAME (lai->primitive_type_vector [ada_primitive_type_system_address])
- = "system__address";
-}
-
- /* Language vector */
-
-/* Not really used, but needed in the ada_language_defn. */
-
-static void
-emit_char (int c, struct ui_file *stream, int quoter)
-{
- ada_emit_char (c, stream, quoter, 1);
-}
-
-static int
-parse (void)
-{
- warnings_issued = 0;
- return ada_parse ();
-}
-
-static const struct exp_descriptor ada_exp_descriptor = {
- ada_print_subexp,
- ada_operator_length,
- ada_op_name,
- ada_dump_subexp_body,
- ada_evaluate_subexp
-};
-
-const struct language_defn ada_language_defn = {
- "ada", /* Language name */
- language_ada,
- NULL,
- range_check_off,
- type_check_off,
- case_sensitive_on, /* Yes, Ada is case-insensitive, but
- that's not quite what this means. */
- array_row_major,
- &ada_exp_descriptor,
- parse,
- ada_error,
- resolve,
- ada_printchar, /* Print a character constant */
- ada_printstr, /* Function to print string constant */
- emit_char, /* Function to print single char (not used) */
- ada_create_fundamental_type, /* Create fundamental type in this language */
- ada_print_type, /* Print a type using appropriate syntax */
- ada_val_print, /* Print a value using appropriate syntax */
- ada_value_print, /* Print a top-level value */
- NULL, /* Language specific skip_trampoline */
- NULL, /* value_of_this */
- ada_lookup_symbol_nonlocal, /* Looking up non-local symbols. */
- basic_lookup_transparent_type, /* lookup_transparent_type */
- ada_la_decode, /* Language specific symbol demangler */
- NULL, /* Language specific class_name_from_physname */
- ada_op_print_tab, /* expression operators for printing */
- 0, /* c-style arrays */
- 1, /* String lower bound */
- NULL,
- ada_get_gdb_completer_word_break_characters,
- ada_language_arch_info,
- LANG_MAGIC
-};
-
void
-_initialize_ada_language (void)
+ada_dump_symtab (struct symtab *s)
{
- add_language (&ada_language_defn);
-
- varsize_limit = 65536;
-
- obstack_init (&symbol_list_obstack);
-
- decoded_names_store = htab_create_alloc
- (256, htab_hash_string, (int (*)(const void *, const void *)) streq,
- NULL, xcalloc, xfree);
+ int i;
+ fprintf (stderr, "New symtab: [\n");
+ fprintf (stderr, " Name: %s/%s;\n",
+ s->dirname ? s->dirname : "?", s->filename ? s->filename : "?");
+ fprintf (stderr, " Format: %s;\n", s->debugformat);
+ if (s->linetable != NULL)
+ {
+ fprintf (stderr, " Line table (section %d):\n", s->block_line_section);
+ for (i = 0; i < s->linetable->nitems; i += 1)
+ {
+ struct linetable_entry *e = s->linetable->item + i;
+ fprintf (stderr, " %4ld: %8lx\n", (long) e->line, (long) e->pc);
+ }
+ }
+ fprintf (stderr, "]\n");
}
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index 18a662a..12eaf4b 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -160,6 +160,18 @@ struct task_entry
int stack_per;
};
+extern struct type *builtin_type_ada_int;
+extern struct type *builtin_type_ada_short;
+extern struct type *builtin_type_ada_long;
+extern struct type *builtin_type_ada_long_long;
+extern struct type *builtin_type_ada_char;
+extern struct type *builtin_type_ada_float;
+extern struct type *builtin_type_ada_double;
+extern struct type *builtin_type_ada_long_double;
+extern struct type *builtin_type_ada_natural;
+extern struct type *builtin_type_ada_positive;
+extern struct type *builtin_type_ada_system_address;
+
/* The maximum number of tasks known to the Ada runtime. */
extern const int MAX_NUMBER_OF_KNOWN_TASKS;
@@ -367,7 +379,7 @@ extern int ada_prefer_type (struct type *, struct type *);
extern struct type *ada_get_base_type (struct type *);
-extern struct type *ada_check_typedef (struct type *);
+extern struct type *ada_completed_type (struct type *);
extern char *ada_encode (const char *);
@@ -375,7 +387,7 @@ extern const char *ada_enum_name (const char *);
extern int ada_is_modular_type (struct type *);
-extern ULONGEST ada_modulus (struct type *);
+extern LONGEST ada_modulus (struct type *);
extern struct value *ada_value_ind (struct value *);
@@ -413,6 +425,10 @@ extern int ada_print_exception_breakpoint_nontask (struct breakpoint *);
extern void ada_print_exception_breakpoint_task (struct breakpoint *);
+extern int ada_maybe_exception_partial_symbol (struct partial_symbol *sym);
+
+extern int ada_is_exception_sym (struct symbol *sym);
+
extern void ada_find_printable_frame (struct frame_info *fi);
extern void ada_reset_thread_registers (void);
diff --git a/gdb/ada-lex.l b/gdb/ada-lex.l
index 6aa3b7d..21dba2c 100644
--- a/gdb/ada-lex.l
+++ b/gdb/ada-lex.l
@@ -26,6 +26,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* each successive token and places a semantic value into yylval */
/* (ada-lval), defined by the parser. */
+/* Run flex with (at least) the -i option (case-insensitive), and the -I */
+/* option (interactive---no unnecessary lookahead). */
+
DIG [0-9]
NUM10 ({DIG}({DIG}|_)*)
HEXDIG [0-9a-f]
@@ -42,6 +45,8 @@ EXP (e[+-]{NUM10})
POSEXP (e"+"?{NUM10})
%{
+#define malloc xmalloc
+#define free xfree
#define NUMERAL_WIDTH 256
#define LONGEST_SIGN ((ULONGEST) 1 << (sizeof(LONGEST) * HOST_CHAR_BIT - 1))
@@ -84,8 +89,6 @@ static int find_dot_all (const char *);
%}
-%option case-insensitive interactive nodefault
-
%s IN_STRING BEFORE_QUAL_QUOTE
%%
@@ -141,19 +144,21 @@ static int find_dot_all (const char *);
}
<INITIAL>"'"({GRAPHIC}|\")"'" {
- yylval.typed_val.type = type_char ();
+ yylval.typed_val.type = builtin_type_ada_char;
yylval.typed_val.val = yytext[1];
return CHARLIT;
}
<INITIAL>"'[\""{HEXDIG}{2}"\"]'" {
int v;
- yylval.typed_val.type = type_char ();
+ yylval.typed_val.type = builtin_type_ada_char;
sscanf (yytext+3, "%2x", &v);
yylval.typed_val.val = v;
return CHARLIT;
}
+\"{OPER}\"/{WHITE}*"(" { return processId (yytext, yyleng); }
+
<INITIAL>\" {
tempbuf_len = 0;
BEGIN IN_STRING;
@@ -345,7 +350,7 @@ resize_tempbuf (unsigned int n)
if (tempbufsize < n)
{
tempbufsize = (n+63) & ~63;
- tempbuf = xrealloc (tempbuf, tempbufsize);
+ tempbuf = (char *) xrealloc (tempbuf, tempbufsize);
}
}
@@ -473,9 +478,9 @@ processInt (const char *base0, const char *num0, const char *exp0)
}
if ((result >> (TARGET_INT_BIT-1)) == 0)
- yylval.typed_val.type = type_int ();
+ yylval.typed_val.type = builtin_type_ada_int;
else if ((result >> (TARGET_LONG_BIT-1)) == 0)
- yylval.typed_val.type = type_long ();
+ yylval.typed_val.type = builtin_type_ada_long;
else if (((result >> (TARGET_LONG_BIT-1)) >> 1) == 0)
{
/* We have a number representable as an unsigned integer quantity.
@@ -495,7 +500,7 @@ processInt (const char *base0, const char *num0, const char *exp0)
return INT;
}
else
- yylval.typed_val.type = type_long_long ();
+ yylval.typed_val.type = builtin_type_ada_long_long;
yylval.typed_val.val = (LONGEST) result;
return INT;
@@ -522,11 +527,11 @@ processReal (const char *num0)
yylval.typed_val_float.dval = temp;
}
- yylval.typed_val_float.type = type_float ();
+ yylval.typed_val_float.type = builtin_type_ada_float;
if (sizeof(DOUBLEST) >= TARGET_DOUBLE_BIT / TARGET_CHAR_BIT)
- yylval.typed_val_float.type = type_double ();
+ yylval.typed_val_float.type = builtin_type_ada_double;
if (sizeof(DOUBLEST) >= TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT)
- yylval.typed_val_float.type = type_long_double ();
+ yylval.typed_val_float.type = builtin_type_ada_long_double;
return FLOAT;
}
@@ -740,7 +745,7 @@ name_lookup (char *name0, char *err_name, int *token_type, int depth)
current_gdbarch,
name);
if (type == NULL && strcmp ("system__address", name) == 0)
- type = type_system_address ();
+ type = builtin_type_ada_system_address;
if (type != NULL)
{
/* First check to see if we have a regular definition of this
@@ -919,10 +924,3 @@ yywrap(void)
{
return 1;
}
-
-/* Dummy definition to suppress warnings about unused static definitions. */
-typedef void (*dummy_function) ();
-dummy_function ada_flex_use[] =
-{
- (dummy_function) yyunput
-};
diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c
index 8311d63..fb9c690 100644
--- a/gdb/ada-typeprint.c
+++ b/gdb/ada-typeprint.c
@@ -149,7 +149,7 @@ print_range (struct type *type, struct ui_file *stream)
case TYPE_CODE_ENUM:
break;
default:
- target_type = builtin_type_int;
+ target_type = builtin_type_ada_int;
break;
}
@@ -754,7 +754,7 @@ void
ada_print_type (struct type *type0, char *varstring, struct ui_file *stream,
int show, int level)
{
- struct type *type = ada_check_typedef (ada_get_base_type (type0));
+ struct type *type = ada_completed_type (ada_get_base_type (type0));
char *type_name = decoded_type_name (type);
int is_var_decl = (varstring != NULL && varstring[0] != '\0');
@@ -768,7 +768,7 @@ ada_print_type (struct type *type0, char *varstring, struct ui_file *stream,
}
if (show > 0)
- type = ada_check_typedef (type);
+ CHECK_TYPEDEF (type);
if (is_var_decl && TYPE_CODE (type) != TYPE_CODE_FUNC)
fprintf_filtered (stream, "%.*s: ",
diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
index 82e6825..3617d76 100644
--- a/gdb/ada-valprint.c
+++ b/gdb/ada-valprint.c
@@ -367,7 +367,7 @@ ada_print_scalar (struct type *type, LONGEST val, struct ui_file *stream)
unsigned int i;
unsigned len;
- type = ada_check_typedef (type);
+ CHECK_TYPEDEF (type);
switch (TYPE_CODE (type))
{
@@ -599,7 +599,7 @@ ada_val_print_1 (struct type *type, char *valaddr0, int embedded_offset,
LONGEST val;
char *valaddr = valaddr0 + embedded_offset;
- type = ada_check_typedef (type);
+ CHECK_TYPEDEF (type);
if (ada_is_array_descriptor_type (type) || ada_is_packed_array_type (type))
{
@@ -960,7 +960,7 @@ static void
print_record (struct type *type, char *valaddr, struct ui_file *stream,
int format, int recurse, enum val_prettyprint pretty)
{
- type = ada_check_typedef (type);
+ CHECK_TYPEDEF (type);
fprintf_filtered (stream, "(");
diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c
index 63687d7..11a4471 100644
--- a/gdb/aix-thread.c
+++ b/gdb/aix-thread.c
@@ -105,8 +105,8 @@ struct pd_thread {
static struct target_ops aix_thread_ops;
-/* Copy of the target over which ops is pushed. This is more
- convenient than a pointer to deprecated_child_ops or core_ops,
+/* Copy of the target over which ops is pushed.
+ This is more convenient than a pointer to child_ops or core_ops,
because they lack current_target's default callbacks. */
static struct target_ops base_target;
@@ -1604,8 +1604,8 @@ aix_thread_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
struct cleanup *cleanup = save_inferior_ptid ();
inferior_ptid = pid_to_ptid (PIDGET (inferior_ptid));
- n = base_target.deprecated_xfer_memory (memaddr, myaddr, len,
- write, attrib, &base_target);
+ n = base_target.to_xfer_memory (memaddr, myaddr, len,
+ write, attrib, &base_target);
do_cleanups (cleanup);
return n;
@@ -1736,7 +1736,7 @@ init_aix_thread_ops (void)
aix_thread_ops.to_wait = aix_thread_wait;
aix_thread_ops.to_fetch_registers = aix_thread_fetch_registers;
aix_thread_ops.to_store_registers = aix_thread_store_registers;
- aix_thread_ops.deprecated_xfer_memory = aix_thread_xfer_memory;
+ aix_thread_ops.to_xfer_memory = aix_thread_xfer_memory;
/* No need for aix_thread_ops.to_create_inferior, because we activate thread
debugging when the inferior reaches pd_brk_addr. */
aix_thread_ops.to_kill = aix_thread_kill;
diff --git a/gdb/alphanbsd-tdep.c b/gdb/alphanbsd-tdep.c
index ad00f98..299ed3a 100644
--- a/gdb/alphanbsd-tdep.c
+++ b/gdb/alphanbsd-tdep.c
@@ -226,8 +226,6 @@ _initialize_alphanbsd_tdep (void)
{
gdbarch_register_osabi (bfd_arch_alpha, 0, GDB_OSABI_NETBSD_ELF,
alphanbsd_init_abi);
- gdbarch_register_osabi (bfd_arch_alpha, 0, GDB_OSABI_OPENBSD_ELF,
- alphanbsd_init_abi);
deprecated_add_core_fns (&alphanbsd_core_fns);
deprecated_add_core_fns (&alphanbsd_elfcore_fns);
diff --git a/gdb/amd64-nat.h b/gdb/amd64-nat.h
index 0b8caf2..edf6df8 100644
--- a/gdb/amd64-nat.h
+++ b/gdb/amd64-nat.h
@@ -1,6 +1,6 @@
/* Native-dependent code for AMD64.
- Copyright 2003, 2004 Free Software Foundation, Inc.
+ Copyright 2003 Free Software Foundation, Inc.
This file is part of GDB.
@@ -50,9 +50,4 @@ extern void amd64_supply_native_gregset (struct regcache *regcache,
extern void amd64_collect_native_gregset (const struct regcache *regcache,
void *gregs, int regnum);
-/* Create a prototype *BSD/amd64 target. The client can override it
- with local methods. */
-
-extern struct target_ops *amd64bsd_target (void);
-
#endif /* amd64-nat.h */
diff --git a/gdb/amd64bsd-nat.c b/gdb/amd64bsd-nat.c
index 4393553..b30885a 100644
--- a/gdb/amd64bsd-nat.c
+++ b/gdb/amd64bsd-nat.c
@@ -22,7 +22,6 @@
#include "defs.h"
#include "inferior.h"
#include "regcache.h"
-#include "target.h"
/* We include <signal.h> to make sure `struct fxsave64' is defined on
NetBSD, since NetBSD's <machine/reg.h> needs it. */
@@ -34,14 +33,13 @@
#include "amd64-tdep.h"
#include "amd64-nat.h"
-#include "inf-ptrace.h"
/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this
for all registers (including the floating-point registers). */
-static void
-amd64bsd_fetch_inferior_registers (int regnum)
+void
+fetch_inferior_registers (int regnum)
{
if (regnum == -1 || amd64_native_gregset_supplies_p (regnum))
{
@@ -71,8 +69,8 @@ amd64bsd_fetch_inferior_registers (int regnum)
/* Store register REGNUM back into the inferior. If REGNUM is -1, do
this for all registers (including the floating-point registers). */
-static void
-amd64bsd_store_inferior_registers (int regnum)
+void
+store_inferior_registers (int regnum)
{
if (regnum == -1 || amd64_native_gregset_supplies_p (regnum))
{
@@ -107,17 +105,3 @@ amd64bsd_store_inferior_registers (int regnum)
perror_with_name ("Couldn't write floating point status");
}
}
-
-/* Create a prototype *BSD/amd64 target. The client can override it
- with local methods. */
-
-struct target_ops *
-amd64bsd_target (void)
-{
- struct target_ops *t;
-
- t = inf_ptrace_target ();
- t->to_fetch_registers = amd64bsd_fetch_inferior_registers;
- t->to_store_registers = amd64bsd_store_inferior_registers;
- return t;
-}
diff --git a/gdb/amd64fbsd-nat.c b/gdb/amd64fbsd-nat.c
index b778761..caeaee9 100644
--- a/gdb/amd64fbsd-nat.c
+++ b/gdb/amd64fbsd-nat.c
@@ -22,7 +22,6 @@
#include "defs.h"
#include "inferior.h"
#include "regcache.h"
-#include "target.h"
#include "gdb_assert.h"
#include <signal.h>
@@ -32,7 +31,6 @@
#include <sys/sysctl.h>
#include <machine/reg.h>
-#include "fbsd-nat.h"
#include "amd64-tdep.h"
#include "amd64-nat.h"
@@ -140,22 +138,11 @@ void _initialize_amd64fbsd_nat (void);
void
_initialize_amd64fbsd_nat (void)
{
- struct target_ops *t;
int offset;
amd64_native_gregset32_reg_offset = amd64fbsd32_r_reg_offset;
amd64_native_gregset64_reg_offset = amd64fbsd64_r_reg_offset;
- /* Add some extra features to the common *BSD/i386 target. */
- t = amd64bsd_target ();
- t->to_pid_to_exec_file = fbsd_pid_to_exec_file;
- t->to_find_memory_regions = fbsd_find_memory_regions;
- t->to_make_corefile_notes = fbsd_make_corefile_notes;
- add_target (t);
-
- /* Support debugging kernel virtual memory images. */
- bsd_kvm_add_target (amd64fbsd_supply_pcb);
-
/* To support the recognition of signal handlers, i386bsd-tdep.c
hardcodes some constants. Inclusion of this file means that we
are compiling a native debugger, which means that we can use the
@@ -232,4 +219,7 @@ Please report this to <bug-gdb@gnu.org>.",
amd64fbsd_sigtramp_end_addr = ps_strings;
}
}
+
+ /* Support debugging kernel virtual memory images. */
+ bsd_kvm_add_target (amd64fbsd_supply_pcb);
}
diff --git a/gdb/amd64nbsd-nat.c b/gdb/amd64nbsd-nat.c
index 911f99e..df7ceb9 100644
--- a/gdb/amd64nbsd-nat.c
+++ b/gdb/amd64nbsd-nat.c
@@ -20,7 +20,6 @@
Boston, MA 02111-1307, USA. */
#include "defs.h"
-#include "target.h"
#include "gdb_assert.h"
@@ -66,7 +65,4 @@ _initialize_amd64nbsd_nat (void)
amd64_native_gregset32_reg_offset = amd64nbsd32_r_reg_offset;
amd64_native_gregset32_num_regs = ARRAY_SIZE (amd64nbsd32_r_reg_offset);
amd64_native_gregset64_reg_offset = amd64nbsd_r_reg_offset;
-
- /* We've got nothing to add to the common *BSD/amd64 target. */
- add_target (amd64bsd_target ());
}
diff --git a/gdb/amd64obsd-nat.c b/gdb/amd64obsd-nat.c
index 6f8a601..0f9b5ef 100644
--- a/gdb/amd64obsd-nat.c
+++ b/gdb/amd64obsd-nat.c
@@ -22,7 +22,6 @@
#include "defs.h"
#include "gdbcore.h"
#include "regcache.h"
-#include "target.h"
#include "gdb_assert.h"
@@ -139,9 +138,6 @@ _initialize_amd64obsd_nat (void)
amd64_native_gregset32_num_regs = ARRAY_SIZE (amd64obsd32_r_reg_offset);
amd64_native_gregset64_reg_offset = amd64obsd_r_reg_offset;
- /* We've got nothing to add to the common *BSD/amd64 target. */
- add_target (amd64bsd_target ());
-
/* Support debugging kernel virtual memory images. */
bsd_kvm_add_target (amd64obsd_supply_pcb);
}
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index eac34b8..7e9e669 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -2741,7 +2741,8 @@ bpstat_stop_status (CORE_ADDR bp_addr, ptid_t ptid, int stopped_by_watchpoint)
struct value *v;
int found = 0;
- if (!target_stopped_data_address (&current_target, &addr))
+ addr = target_stopped_data_address ();
+ if (addr == 0)
continue;
for (v = b->val_chain; v; v = v->next)
{
diff --git a/gdb/bsd-kvm.c b/gdb/bsd-kvm.c
index 300379d..64869e5 100644
--- a/gdb/bsd-kvm.c
+++ b/gdb/bsd-kvm.c
@@ -285,7 +285,7 @@ Optionally specify the filename of a core dump.";
bsd_kvm_ops.to_open = bsd_kvm_open;
bsd_kvm_ops.to_close = bsd_kvm_close;
bsd_kvm_ops.to_fetch_registers = bsd_kvm_fetch_registers;
- bsd_kvm_ops.deprecated_xfer_memory = bsd_kvm_xfer_memory;
+ bsd_kvm_ops.to_xfer_memory = bsd_kvm_xfer_memory;
bsd_kvm_ops.to_stratum = process_stratum;
bsd_kvm_ops.to_has_memory = 1;
bsd_kvm_ops.to_has_stack = 1;
diff --git a/gdb/config.in b/gdb/config.in
index ed44c99..e97479f 100644
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -263,9 +263,6 @@
/* Define if you have the ttrace function. */
#undef HAVE_TTRACE
-/* Define if you have the wborder function. */
-#undef HAVE_WBORDER
-
/* Define if you have the <argz.h> header file. */
#undef HAVE_ARGZ_H
diff --git a/gdb/config/alpha/alpha-linux.mh b/gdb/config/alpha/alpha-linux.mh
index 4983441..d3cbff7 100644
--- a/gdb/config/alpha/alpha-linux.mh
+++ b/gdb/config/alpha/alpha-linux.mh
@@ -1,7 +1,7 @@
# Host: Little-endian Alpha running Linux
NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o corelow.o alpha-nat.o \
- fork-child.o proc-service.o thread-db.o gcore.o \
+NATDEPFILES= infptrace.o inftarg.o corelow.o alpha-nat.o linux-proc.o \
+ fork-child.o proc-service.o thread-db.o lin-lwp.o gcore.o \
linux-nat.o
# The dynamically loaded libthread_db needs access to symbols in the
diff --git a/gdb/config/arm/linux.mh b/gdb/config/arm/linux.mh
index 386f681..af5b546 100644
--- a/gdb/config/arm/linux.mh
+++ b/gdb/config/arm/linux.mh
@@ -2,8 +2,8 @@
NAT_FILE= nm-linux.h
NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o \
- core-regset.o arm-linux-nat.o gcore.o \
- proc-service.o thread-db.o linux-nat.o
+ core-regset.o arm-linux-nat.o linux-proc.o gcore.o \
+ proc-service.o thread-db.o lin-lwp.o linux-nat.o
LOADLIBES= -ldl -rdynamic
diff --git a/gdb/config/djgpp/fnchange.lst b/gdb/config/djgpp/fnchange.lst
index a63c9d6..4337b72 100644
--- a/gdb/config/djgpp/fnchange.lst
+++ b/gdb/config/djgpp/fnchange.lst
@@ -138,8 +138,6 @@
@V@/gdb/ia64-linux-nat.c @V@/gdb/ia64lx-tdep.c
@V@/gdb/jv-exp.tab.c @V@/gdb/jv-exp_tab.c
@V@/gdb/m2-exp.tab.c @V@/gdb/m2-exp_tab.c
-@V@/gdb/m32r-linux-nat.c @V@/gdb/m32rlnxnat.c
-@V@/gdb/m32r-linux-tdep.c @V@/gdb/m32rlnxtdep.c
@V@/gdb/m68klinux-nat.c @V@/gdb/m68kl-nat.c
@V@/gdb/m68klinux-tdep.c @V@/gdb/m68kl-tdep.c
@V@/gdb/m68kbsd-nat.c @V@/gdb/m68bsd-nat.c
diff --git a/gdb/config/frv/tm-frv.h b/gdb/config/frv/tm-frv.h
index 4374872..b8f677d 100644
--- a/gdb/config/frv/tm-frv.h
+++ b/gdb/config/frv/tm-frv.h
@@ -1,5 +1,5 @@
/* Target definitions for the Fujitsu FR-V, for GDB, the GNU Debugger.
- Copyright 2000, 2004 Free Software Foundation, Inc.
+ Copyright 2000 Free Software Foundation, Inc.
This file is part of GDB.
@@ -33,11 +33,10 @@ extern int frv_check_watch_resources (int type, int cnt, int ot);
#define STOPPED_BY_WATCHPOINT(W) \
((W).kind == TARGET_WAITKIND_STOPPED \
&& (W).value.sig == TARGET_SIGNAL_TRAP \
- && frv_have_stopped_data_address())
-extern int frv_have_stopped_data_address(void);
+ && (frv_stopped_data_address() != ((CORE_ADDR)0)))
+extern CORE_ADDR frv_stopped_data_address(void);
/* Use these macros for watchpoint insertion/deletion. */
-#define target_stopped_data_address(target, x) frv_stopped_data_address(x)
-extern int frv_stopped_data_address(CORE_ADDR *addr_p);
+#define target_stopped_data_address() frv_stopped_data_address()
#include "solib.h" /* Include support for shared libraries. */
diff --git a/gdb/config/i386/fbsd.mh b/gdb/config/i386/fbsd.mh
index 291e121..6f539f7 100644
--- a/gdb/config/i386/fbsd.mh
+++ b/gdb/config/i386/fbsd.mh
@@ -1,7 +1,7 @@
# Host: FreeBSD/i386
-NATDEPFILES= fork-child.o inf-ptrace.o \
- fbsd-nat.o i386-nat.o i386bsd-nat.o i386fbsd-nat.o \
- gcore.o bsd-kvm.o
+NATDEPFILES= fork-child.o infptrace.o inftarg.o \
+ i386-nat.o i386bsd-nat.o i386fbsd-nat.o \
+ gcore.o fbsd-proc.o bsd-kvm.o
NAT_FILE= nm-fbsd.h
LOADLIBES= -lkvm
diff --git a/gdb/config/i386/fbsd64.mh b/gdb/config/i386/fbsd64.mh
index f5817f1..d2dae25 100644
--- a/gdb/config/i386/fbsd64.mh
+++ b/gdb/config/i386/fbsd64.mh
@@ -1,6 +1,7 @@
# Host: FreeBSD/amd64
-NATDEPFILES= fork-child.o inf-ptrace.o \
- fbsd-nat.o amd64-nat.o amd64bsd-nat.o amd64fbsd-nat.o \
- gcore.o bsd-kvm.o
+NATDEPFILES= fork-child.o infptrace.o inftarg.o \
+ amd64-nat.o amd64bsd-nat.o amd64fbsd-nat.o \
+ gcore.o fbsd-proc.o bsd-kvm.o
+NAT_FILE= nm-fbsd64.h
LOADLIBES= -lkvm
diff --git a/gdb/config/i386/linux.mh b/gdb/config/i386/linux.mh
index bfe29c1..3714e0c 100644
--- a/gdb/config/i386/linux.mh
+++ b/gdb/config/i386/linux.mh
@@ -1,9 +1,9 @@
# Host: Intel 386 running GNU/Linux.
NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o \
+NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o linux-proc.o \
core-aout.o i386-nat.o i386-linux-nat.o \
- proc-service.o thread-db.o gcore.o \
+ proc-service.o thread-db.o lin-lwp.o linux-proc.o gcore.o \
linux-nat.o
# The dynamically loaded libthread_db needs access to symbols in the
diff --git a/gdb/config/i386/linux64.mh b/gdb/config/i386/linux64.mh
index e9117cf..1622f18 100644
--- a/gdb/config/i386/linux64.mh
+++ b/gdb/config/i386/linux64.mh
@@ -1,7 +1,7 @@
# Host: GNU/Linux x86-64
NATDEPFILES= infptrace.o inftarg.o fork-child.o \
i386-nat.o amd64-nat.o amd64-linux-nat.o linux-nat.o \
- proc-service.o thread-db.o gcore.o
+ proc-service.o thread-db.o lin-lwp.o linux-proc.o gcore.o
NAT_FILE= nm-linux64.h
# The dynamically loaded libthread_db needs access to symbols in the
diff --git a/gdb/config/i386/nbsd64.mh b/gdb/config/i386/nbsd64.mh
index aec2905..32f82a2 100644
--- a/gdb/config/i386/nbsd64.mh
+++ b/gdb/config/i386/nbsd64.mh
@@ -1,3 +1,4 @@
# Host: NetBSD/amd64
-NATDEPFILES= fork-child.o inf-ptrace.o \
+NATDEPFILES= fork-child.o infptrace.o inftarg.o \
amd64-nat.o amd64bsd-nat.o amd64nbsd-nat.o
+NAT_FILE= config/nm-nbsd.h
diff --git a/gdb/config/i386/nbsdaout.mh b/gdb/config/i386/nbsdaout.mh
index 1614c4d..d9b94f0 100644
--- a/gdb/config/i386/nbsdaout.mh
+++ b/gdb/config/i386/nbsdaout.mh
@@ -1,7 +1,4 @@
# Host: NetBSD/i386 a.out
-NATDEPFILES= fork-child.o inf-ptrace.o \
- i386bsd-nat.o i386nbsd-nat.o bsd-kvm.o \
+NATDEPFILES= fork-child.o infptrace.o inftarg.o i386bsd-nat.o \
solib.o solib-sunos.o
-NAT_FILE= solib.h
-
-LOADLIBES= -lkvm
+NAT_FILE= nm-nbsdaout.h
diff --git a/gdb/config/i386/nbsdelf.mh b/gdb/config/i386/nbsdelf.mh
index e49a49a..4f9a6fd 100644
--- a/gdb/config/i386/nbsdelf.mh
+++ b/gdb/config/i386/nbsdelf.mh
@@ -1,6 +1,6 @@
# Host: NetBSD/i386 ELF
-NATDEPFILES= fork-child.o inf-ptrace.o \
+NATDEPFILES= fork-child.o infptrace.o inftarg.o \
i386bsd-nat.o i386nbsd-nat.o bsd-kvm.o
-NAT_FILE= solib.h
+NAT_FILE= config/nm-nbsd.h
LOADLIBES= -lkvm
diff --git a/gdb/config/i386/nm-fbsd.h b/gdb/config/i386/nm-fbsd.h
index 4c0aa36..4c5683b 100644
--- a/gdb/config/i386/nm-fbsd.h
+++ b/gdb/config/i386/nm-fbsd.h
@@ -54,6 +54,12 @@ extern unsigned long i386bsd_dr_get_status (void);
/* Get generic BSD native definitions. */
#include "config/nm-bsd.h"
+
+/* Override child_resume in `infptrace.c' to work around a kernel bug. */
+#define CHILD_RESUME
+
+/* Override child_pid_to_exec_file in 'inftarg.c'. */
+#define CHILD_PID_TO_EXEC_FILE
/* Support for the user struct. */
@@ -62,10 +68,75 @@ extern unsigned long i386bsd_dr_get_status (void);
#define KERNEL_U_SIZE kernel_u_size ()
extern int kernel_u_size (void);
+
+/* This is the amount to subtract from u.u_ar0
+ to get the offset in the core file of the register values. */
+
+#include <machine/vmparam.h>
+#define KERNEL_U_ADDR USRSTACK
+
+#define REGISTER_U_ADDR(addr, blockend, regno) \
+ (addr) = register_u_addr ((blockend), (regno))
+extern CORE_ADDR register_u_addr (CORE_ADDR blockend, int regno);
/* Shared library support. */
#include "solib.h"
+/* Make structure definitions match up with those expected in
+ `solib-sunos.c'. */
+
+#define link_object sod
+#define lo_name sod_name
+#define lo_library sod_library
+#define lo_unused sod_reserved
+#define lo_major sod_major
+#define lo_minor sod_minor
+#define lo_next sod_next
+
+#define link_map so_map
+#define lm_addr som_addr
+#define lm_name som_path
+#define lm_next som_next
+#define lm_lop som_sod
+#define lm_lob som_sodbase
+#define lm_rwt som_write
+#define lm_ld som_dynamic
+#define lm_lpd som_spd
+
+#define link_dynamic_2 section_dispatch_table
+#define ld_loaded sdt_loaded
+#define ld_need sdt_sods
+#define ld_rules sdt_filler1
+#define ld_got sdt_got
+#define ld_plt sdt_plt
+#define ld_rel sdt_rel
+#define ld_hash sdt_hash
+#define ld_stab sdt_nzlist
+#define ld_stab_hash sdt_filler2
+#define ld_buckets sdt_buckets
+#define ld_symbols sdt_strings
+#define ld_symb_size sdt_str_sz
+#define ld_text sdt_text_sz
+#define ld_plt_sz sdt_plt_sz
+
+#define rtc_symb rt_symbol
+#define rtc_sp rt_sp
+#define rtc_next rt_next
+
+#define ld_debug so_debug
+#define ldd_version dd_version
+#define ldd_in_debugger dd_in_debugger
+#define ldd_sym_loaded dd_sym_loaded
+#define ldd_bp_addr dd_bpt_addr
+#define ldd_bp_inst dd_bpt_shadow
+#define ldd_cp dd_cc
+
+#define link_dynamic _dynamic
+#define ld_version d_version
+#define ldd d_debug
+#define ld_un d_un
+#define ld_2 d_sdt
+
#endif /* nm-fbsd.h */
diff --git a/gdb/i386bsd-nat.h b/gdb/config/i386/nm-fbsd64.h
index a0764ff..061e77e 100644
--- a/gdb/i386bsd-nat.h
+++ b/gdb/config/i386/nm-fbsd64.h
@@ -1,6 +1,6 @@
-/* Native-dependent code for modern i386 BSD's.
+/* Native-dependent definitions for FreeBSD/amd64.
- Copyright 2004 Free Software Foundation, Inc.
+ Copyright 2003, 2004 Free Software Foundation, Inc.
This file is part of GDB.
@@ -19,12 +19,13 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#ifndef I386BSD_NAT_H
-#define I386BSD_NAT_H
+#ifndef NM_FBSD64_H
+#define NM_FBSD64_H
-/* Create a prototype *BSD/i386 target. The client can override it
- with local methods. */
+/* Get generic BSD native definitions. */
+#include "config/nm-bsd.h"
-extern struct target_ops *i386bsd_target (void);
+/* Override child_pid_to_exec_file in 'inftarg.c'. */
+#define CHILD_PID_TO_EXEC_FILE
-#endif /* i386bsd-nat.h */
+#endif /* nm-fbsd64.h */
diff --git a/gdb/config/i386/nm-i386.h b/gdb/config/i386/nm-i386.h
index 265c8e0..2692cae 100644
--- a/gdb/config/i386/nm-i386.h
+++ b/gdb/config/i386/nm-i386.h
@@ -47,10 +47,10 @@ extern int i386_region_ok_for_watchpoint (CORE_ADDR addr, int len);
triggered. */
extern int i386_stopped_by_hwbp (void);
-/* If the inferior has some break/watchpoint that triggered, set
- the address associated with that break/watchpoint and return
- true. Otherwise, return false. */
-extern int i386_stopped_data_address (CORE_ADDR *);
+/* If the inferior has some break/watchpoint that triggered, return
+ the address associated with that break/watchpoint. Otherwise,
+ return zero. */
+extern CORE_ADDR i386_stopped_data_address (void);
/* Insert a hardware-assisted breakpoint at address ADDR. SHADOW is
unused. Return 0 on success, EBUSY on failure. */
@@ -91,11 +91,9 @@ extern int i386_remove_hw_breakpoint (CORE_ADDR addr, void *shadow);
#define HAVE_CONTINUABLE_WATCHPOINT 1
-extern int i386_stopped_by_watchpoint (void);
+#define STOPPED_BY_WATCHPOINT(W) (i386_stopped_data_address () != 0)
-#define STOPPED_BY_WATCHPOINT(W) (i386_stopped_by_watchpoint () != 0)
-
-#define target_stopped_data_address(target, x) i386_stopped_data_address(x)
+#define target_stopped_data_address() i386_stopped_data_address ()
/* Use these macros for watchpoint insertion/removal. */
diff --git a/gdb/config/i386/nm-linux.h b/gdb/config/i386/nm-linux.h
index 40c3e05..1df875f 100644
--- a/gdb/config/i386/nm-linux.h
+++ b/gdb/config/i386/nm-linux.h
@@ -80,7 +80,7 @@ extern int cannot_store_register (int regno);
#endif
/* Override child_resume in `infptrace.c'. */
-#define DEPRECATED_CHILD_RESUME
+#define CHILD_RESUME
/* `linux-nat.c' and `i386-nat.c' have their own versions of
child_post_startup_inferior. Define this to use the copy in
diff --git a/gdb/config/m32r/nm-linux.h b/gdb/config/i386/nm-nbsdaout.h
index ecfeeba..81866ff 100644
--- a/gdb/config/m32r/nm-linux.h
+++ b/gdb/config/i386/nm-nbsdaout.h
@@ -1,5 +1,7 @@
-/* Definitions to make GDB run on an M32R based machine under GNU/Linux.
- Copyright 2004 Free Software Foundation, Inc.
+/* Native-dependent definitions for NetBSD/i386 a.out.
+
+ Copyright 1986, 1987, 1989, 1992, 1994, 1996, 2000, 2004
+ Free Software Foundation, Inc.
This file is part of GDB.
@@ -18,12 +20,12 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#ifndef NM_M32R_LINUX_H
-#define NM_M32R_LINUX_H
+#ifndef NM_NBSDAOUT_H
+#define NM_NBSDAOUT_H
-#include "config/nm-linux.h"
+#include "config/nm-nbsd.h"
-/* Override copies of {fetch,store}_inferior_registers in infptrace.c. */
-#define FETCH_INFERIOR_REGISTERS
+/* Get generic NetBSD a.out native definitions. */
+#include "config/nm-nbsdaout.h"
-#endif /* NM_M32R_LINUX_H */
+#endif /* nm-nbsdaout.h */
diff --git a/gdb/config/i386/nm-obsd.h b/gdb/config/i386/nm-obsd.h
index 571fb59..7fd32ca 100644
--- a/gdb/config/i386/nm-obsd.h
+++ b/gdb/config/i386/nm-obsd.h
@@ -31,10 +31,75 @@
#define KERNEL_U_SIZE kernel_u_size ()
extern int kernel_u_size (void);
+
+/* This is the amount to subtract from u.u_ar0
+ to get the offset in the core file of the register values. */
+
+#include <machine/vmparam.h>
+#define KERNEL_U_ADDR USRSTACK
+
+#define REGISTER_U_ADDR(addr, blockend, regno) \
+ (addr) = register_u_addr ((blockend), (regno))
+extern CORE_ADDR register_u_addr (CORE_ADDR blockend, int regno);
/* Shared library support. */
#include "solib.h"
+/* Make structure definitions match up with those expected in
+ `solib-sunos.c'. */
+
+#define link_object sod
+#define lo_name sod_name
+#define lo_library sod_library
+#define lo_unused sod_reserved
+#define lo_major sod_major
+#define lo_minor sod_minor
+#define lo_next sod_next
+
+#define link_map so_map
+#define lm_addr som_addr
+#define lm_name som_path
+#define lm_next som_next
+#define lm_lop som_sod
+#define lm_lob som_sodbase
+#define lm_rwt som_write
+#define lm_ld som_dynamic
+#define lm_lpd som_spd
+
+#define link_dynamic_2 section_dispatch_table
+#define ld_loaded sdt_loaded
+#define ld_need sdt_sods
+#define ld_rules sdt_filler1
+#define ld_got sdt_got
+#define ld_plt sdt_plt
+#define ld_rel sdt_rel
+#define ld_hash sdt_hash
+#define ld_stab sdt_nzlist
+#define ld_stab_hash sdt_filler2
+#define ld_buckets sdt_buckets
+#define ld_symbols sdt_strings
+#define ld_symb_size sdt_str_sz
+#define ld_text sdt_text_sz
+#define ld_plt_sz sdt_plt_sz
+
+#define rtc_symb rt_symbol
+#define rtc_sp rt_sp
+#define rtc_next rt_next
+
+#define ld_debug so_debug
+#define ldd_version dd_version
+#define ldd_in_debugger dd_in_debugger
+#define ldd_sym_loaded dd_sym_loaded
+#define ldd_bp_addr dd_bpt_addr
+#define ldd_bp_inst dd_bpt_shadow
+#define ldd_cp dd_cc
+
+#define link_dynamic _dynamic
+#define ld_version d_version
+#define ldd d_debug
+#define ld_un d_un
+#define ld_2 d_sdt
+
#endif /* nm-obsd.h */
diff --git a/gdb/config/i386/obsd.mh b/gdb/config/i386/obsd.mh
index f5b4b2d..5e5781c 100644
--- a/gdb/config/i386/obsd.mh
+++ b/gdb/config/i386/obsd.mh
@@ -1,6 +1,7 @@
# Host: OpenBSD/i386 ELF
-NATDEPFILES= fork-child.o inf-ptrace.o \
+NATDEPFILES= fork-child.o infptrace.o inftarg.o \
i386bsd-nat.o i386obsd-nat.o i386nbsd-nat.o bsd-kvm.o
NAT_FILE= nm-obsd.h
LOADLIBES= -lkvm
+
diff --git a/gdb/config/i386/obsd64.mh b/gdb/config/i386/obsd64.mh
index 5c9899c..14d341c 100644
--- a/gdb/config/i386/obsd64.mh
+++ b/gdb/config/i386/obsd64.mh
@@ -1,5 +1,6 @@
# Host: OpenBSD/amd64
-NATDEPFILES= fork-child.o inf-ptrace.o \
+NATDEPFILES= fork-child.o infptrace.o inftarg.o \
amd64-nat.o amd64bsd-nat.o amd64obsd-nat.o bsd-kvm.o
+NAT_FILE= config/nm-nbsd.h
LOADLIBES= -lkvm
diff --git a/gdb/config/i386/obsdaout.mh b/gdb/config/i386/obsdaout.mh
index 4124c79..7b6850f 100644
--- a/gdb/config/i386/obsdaout.mh
+++ b/gdb/config/i386/obsdaout.mh
@@ -1,7 +1,4 @@
# Host: OpenBSD/i386 a.out
-NATDEPFILES= fork-child.o inf-ptrace.o \
- i386bsd-nat.o i386nbsd-nat.o i386obsd-nat.o bsd-kvm.o \
+NATDEPFILES= fork-child.o infptrace.o inftarg.o i386bsd-nat.o i386obsd-nat.o \
solib.o solib-sunos.o
NAT_FILE= nm-obsd.h
-
-LOADLIBES= -lkvm
diff --git a/gdb/config/ia64/linux.mh b/gdb/config/ia64/linux.mh
index 5ad3145..71fed10 100644
--- a/gdb/config/ia64/linux.mh
+++ b/gdb/config/ia64/linux.mh
@@ -2,7 +2,7 @@
NAT_FILE= nm-linux.h
NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o gcore.o \
- core-aout.o core-regset.o ia64-linux-nat.o \
- proc-service.o thread-db.o linux-nat.o
+ core-aout.o core-regset.o ia64-linux-nat.o linux-proc.o \
+ proc-service.o thread-db.o lin-lwp.o linux-nat.o
LOADLIBES = -ldl -rdynamic
diff --git a/gdb/config/ia64/nm-linux.h b/gdb/config/ia64/nm-linux.h
index fb8675f..1a5539a 100644
--- a/gdb/config/ia64/nm-linux.h
+++ b/gdb/config/ia64/nm-linux.h
@@ -58,12 +58,8 @@ extern int ia64_cannot_store_register (int regno);
#define HAVE_STEPPABLE_WATCHPOINT 1
#define STOPPED_BY_WATCHPOINT(W) \
- ia64_linux_stopped_by_watchpoint ()
-extern int ia64_linux_stopped_by_watchpoint ();
-
-#define target_stopped_data_address(target, x) \
- ia64_linux_stopped_data_address(x)
-extern int ia64_linux_stopped_data_address (CORE_ADDR *addr_p);
+ ia64_linux_stopped_by_watchpoint (inferior_ptid)
+extern CORE_ADDR ia64_linux_stopped_by_watchpoint (ptid_t ptid);
#define target_insert_watchpoint(addr, len, type) \
ia64_linux_insert_watchpoint (inferior_ptid, addr, len, type)
diff --git a/gdb/config/m32r/linux.mh b/gdb/config/m32r/linux.mh
deleted file mode 100644
index bfa8cf6..0000000
--- a/gdb/config/m32r/linux.mh
+++ /dev/null
@@ -1,8 +0,0 @@
-# Host: M32R based machine running GNU/Linux
-
-NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o \
- m32r-linux-nat.o gcore.o proc-service.o thread-db.o \
- linux-nat.o
-
-LOADLIBES= -ldl -rdynamic
diff --git a/gdb/config/m32r/linux.mt b/gdb/config/m32r/linux.mt
deleted file mode 100644
index 09e5630..0000000
--- a/gdb/config/m32r/linux.mt
+++ /dev/null
@@ -1,6 +0,0 @@
-# Target: Renesas M32R running GNU/Linux
-TDEPFILES= m32r-tdep.o m32r-linux-tdep.o remote-m32r-sdi.o glibc-tdep.o solib.o solib-svr4.o solib-legacy.o
-DEPRECATED_TM_FILE= config/tm-linux.h
-
-SIM_OBS = remote-sim.o
-SIM = ../sim/m32r/libsim.a
diff --git a/gdb/config/m68k/linux.mh b/gdb/config/m68k/linux.mh
index 9e3e898..69dce24 100644
--- a/gdb/config/m68k/linux.mh
+++ b/gdb/config/m68k/linux.mh
@@ -2,8 +2,8 @@
NAT_FILE= nm-linux.h
NATDEPFILES= infptrace.o inftarg.o fork-child.o \
- corelow.o core-aout.o m68klinux-nat.o gcore.o \
- proc-service.o thread-db.o linux-nat.o
+ corelow.o core-aout.o m68klinux-nat.o linux-proc.o gcore.o \
+ proc-service.o thread-db.o lin-lwp.o linux-nat.o
# The dynamically loaded libthread_db needs access to symbols in the
# gdb executable.
diff --git a/gdb/config/m88k/obsd.mh b/gdb/config/m88k/obsd.mh
index 02ef16a..e9281bc 100644
--- a/gdb/config/m88k/obsd.mh
+++ b/gdb/config/m88k/obsd.mh
@@ -1,2 +1,3 @@
# Host: OpenBSD/m88k
-NATDEPFILES= fork-child.o inf-child.o m88kbsd-nat.o
+NATDEPFILES= m88kbsd-nat.o fork-child.o infptrace.o inftarg.o
+NAT_FILE= config/nm-bsd.h
diff --git a/gdb/config/mips/linux.mh b/gdb/config/mips/linux.mh
index 44bac25..3fbc3e9 100644
--- a/gdb/config/mips/linux.mh
+++ b/gdb/config/mips/linux.mh
@@ -1,7 +1,7 @@
# Host: Linux/MIPS
NAT_FILE= nm-linux.h
NATDEPFILES= infptrace.o inftarg.o fork-child.o mips-linux-nat.o \
- thread-db.o proc-service.o gcore.o \
+ thread-db.o lin-lwp.o proc-service.o linux-proc.o gcore.o \
linux-nat.o
LOADLIBES = -ldl -rdynamic
diff --git a/gdb/config/nm-linux.h b/gdb/config/nm-linux.h
index fc784e3..870e40d 100644
--- a/gdb/config/nm-linux.h
+++ b/gdb/config/nm-linux.h
@@ -68,7 +68,7 @@ extern void lin_thread_get_thread_signals (sigset_t *mask);
#define CHILD_POST_STARTUP_INFERIOR
#define CHILD_POST_ATTACH
#define CHILD_FOLLOW_FORK
-#define DEPRECATED_KILL_INFERIOR
+#define KILL_INFERIOR
#define NATIVE_XFER_AUXV procfs_xfer_auxv
#include "auxv.h" /* Declares it. */
diff --git a/gdb/config/nm-lynx.h b/gdb/config/nm-lynx.h
index d4ff5a4..4a55a13 100644
--- a/gdb/config/nm-lynx.h
+++ b/gdb/config/nm-lynx.h
@@ -64,7 +64,7 @@ struct target_waitstatus;
/* Override child_resume in infptrace.c */
-#define DEPRECATED_CHILD_RESUME
+#define CHILD_RESUME
/* Override child_thread_alive in intarg.c */
diff --git a/gdb/config/pa/hpux1020.mh b/gdb/config/pa/hpux1020.mh
index ac25383..9a727eb 100644
--- a/gdb/config/pa/hpux1020.mh
+++ b/gdb/config/pa/hpux1020.mh
@@ -4,7 +4,7 @@
# stop GDB hanging on HP/UX. For some reason vfork() hangs yet fork()
# doesn't ....
-MH_CFLAGS = -Dvfork=fork
+MH_CFLAGS = -D__HP_CURSES -Dvfork=fork
NAT_FILE= nm-hppah.h
NATDEPFILES= hppah-nat.o corelow.o core-aout.o inftarg.o fork-child.o infptrace.o somread.o hpread.o somsolib.o
diff --git a/gdb/config/pa/hpux11.mh b/gdb/config/pa/hpux11.mh
index 1ad2a4e..b5466ff 100644
--- a/gdb/config/pa/hpux11.mh
+++ b/gdb/config/pa/hpux11.mh
@@ -4,7 +4,7 @@
# stop GDB hanging on HP/UX. For some reason vfork() hangs yet fork()
# doesn't ....
-MH_CFLAGS = -Dvfork=fork
+MH_CFLAGS = -D__HP_CURSES -Dvfork=fork
NAT_FILE= nm-hppah11.h
NATDEPFILES= hppah-nat.o corelow.o core-aout.o inftarg.o fork-child.o infttrace.o somread.o hpread.o somsolib.o
diff --git a/gdb/config/pa/hpux11w.mh b/gdb/config/pa/hpux11w.mh
index 51c9f2c..c59f3fc 100644
--- a/gdb/config/pa/hpux11w.mh
+++ b/gdb/config/pa/hpux11w.mh
@@ -4,7 +4,7 @@
# stop GDB hanging on HP/UX. For some reason vfork() hangs yet fork()
# doesn't ....
-MH_CFLAGS = -Dvfork=fork
+MH_CFLAGS = -D__HP_CURSES -Dvfork=fork
NAT_FILE= nm-hppah11.h
NATDEPFILES= hppah-nat.o corelow.o core-aout.o inftarg.o fork-child.o infttrace.o hpread.o pa64solib.o solib.o
diff --git a/gdb/config/pa/linux.mh b/gdb/config/pa/linux.mh
index bc5a001..596857c 100644
--- a/gdb/config/pa/linux.mh
+++ b/gdb/config/pa/linux.mh
@@ -2,7 +2,7 @@
XDEPFILES=
NAT_FILE= nm-linux.h
NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o gcore.o \
- core-regset.o hppa-linux-nat.o \
- proc-service.o thread-db.o linux-nat.o
+ core-regset.o hppa-linux-nat.o linux-proc.o \
+ proc-service.o thread-db.o lin-lwp.o linux-nat.o
LOADLIBES = -ldl -rdynamic
diff --git a/gdb/config/powerpc/linux.mh b/gdb/config/powerpc/linux.mh
index a7be199..450a777 100644
--- a/gdb/config/powerpc/linux.mh
+++ b/gdb/config/powerpc/linux.mh
@@ -3,8 +3,8 @@
XM_CLIBS=
NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o \
- ppc-linux-nat.o proc-service.o thread-db.o \
+NATDEPFILES= infptrace.o inftarg.o fork-child.o linux-proc.o \
+ ppc-linux-nat.o proc-service.o thread-db.o lin-lwp.o \
gcore.o linux-nat.o
LOADLIBES = -ldl -rdynamic
diff --git a/gdb/config/powerpc/nbsd.mh b/gdb/config/powerpc/nbsd.mh
index 5556886..4e7388b 100644
--- a/gdb/config/powerpc/nbsd.mh
+++ b/gdb/config/powerpc/nbsd.mh
@@ -1,5 +1,5 @@
# Host: PowerPC, running NetBSD
-NATDEPFILES= fork-child.o inf-ptrace.o infptrace.o ppcnbsd-nat.o bsd-kvm.o
+NATDEPFILES= fork-child.o inf-child.o inf-ptrace.o infptrace.o ppcnbsd-nat.o bsd-kvm.o
NAT_FILE= config/nm-nbsd.h
LOADLIBES= -lkvm
diff --git a/gdb/config/powerpc/ppc64-linux.mh b/gdb/config/powerpc/ppc64-linux.mh
index 2c42fc7..b22408a 100644
--- a/gdb/config/powerpc/ppc64-linux.mh
+++ b/gdb/config/powerpc/ppc64-linux.mh
@@ -3,8 +3,8 @@
XM_CLIBS=
NAT_FILE= nm-ppc64-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o \
- ppc-linux-nat.o proc-service.o thread-db.o \
+NATDEPFILES= infptrace.o inftarg.o fork-child.o linux-proc.o \
+ ppc-linux-nat.o proc-service.o thread-db.o lin-lwp.o \
gcore.o linux-nat.o
# The PowerPC has severe limitations on TOC size, and uses them even
diff --git a/gdb/config/s390/s390.mh b/gdb/config/s390/s390.mh
index 2b5f190..3db7bd9 100644
--- a/gdb/config/s390/s390.mh
+++ b/gdb/config/s390/s390.mh
@@ -1,5 +1,5 @@
# Host: S390, running Linux
NAT_FILE= nm-linux.h
NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o s390-nat.o \
- gcore.o thread-db.o proc-service.o linux-nat.o
+ linux-proc.o gcore.o thread-db.o lin-lwp.o proc-service.o linux-nat.o
LOADLIBES = -ldl -rdynamic
diff --git a/gdb/config/sparc/fbsd.mh b/gdb/config/sparc/fbsd.mh
index ec9a31a..fb491a5 100644
--- a/gdb/config/sparc/fbsd.mh
+++ b/gdb/config/sparc/fbsd.mh
@@ -1,5 +1,5 @@
# Host: FreeBSD/sparc64
NATDEPFILES= sparc64fbsd-nat.o sparc64-nat.o sparc-nat.o \
- fork-child.o inf-ptrace.o infptrace.o inftarg.o \
+ fork-child.o infptrace.o inftarg.o \
solib.o solib-svr4.o solib-legacy.o
NAT_FILE= nm-fbsd.h
diff --git a/gdb/config/sparc/linux.mh b/gdb/config/sparc/linux.mh
index abd3ed8..ed68cc7 100644
--- a/gdb/config/sparc/linux.mh
+++ b/gdb/config/sparc/linux.mh
@@ -1,10 +1,10 @@
# Host: GNU/Linux SPARC
NAT_FILE= nm-linux.h
NATDEPFILES= sparc-nat.o sparc-sol2-nat.o \
- corelow.o core-regset.o fork-child.o inf-ptrace.o \
+ corelow.o core-regset.o fork-child.o \
infptrace.o inftarg.o \
- proc-service.o thread-db.o \
- gcore.o linux-nat.o
+ proc-service.o thread-db.o lin-lwp.o \
+ linux-proc.o gcore.o linux-nat.o
# The dynamically loaded libthread_db needs access to symbols in the
# gdb executable.
diff --git a/gdb/config/sparc/linux64.mh b/gdb/config/sparc/linux64.mh
index 05a63b0..c1472de 100644
--- a/gdb/config/sparc/linux64.mh
+++ b/gdb/config/sparc/linux64.mh
@@ -2,9 +2,9 @@
NAT_FILE= nm-linux.h
NATDEPFILES= sparc-nat.o sparc64-nat.o sparc-sol2-nat.o sparc64-linux-nat.o \
corelow.o core-regset.o \
- fork-child.o inf-ptrace.o infptrace.o inftarg.o \
- proc-service.o thread-db.o \
- gcore.o linux-nat.o
+ fork-child.o infptrace.o inftarg.o \
+ proc-service.o thread-db.o lin-lwp.o \
+ linux-proc.o gcore.o linux-nat.o
# The dynamically loaded libthread_db needs access to symbols in the
# gdb executable.
diff --git a/gdb/config/sparc/nbsd64.mh b/gdb/config/sparc/nbsd64.mh
index 95d4166..9ac8cf4 100644
--- a/gdb/config/sparc/nbsd64.mh
+++ b/gdb/config/sparc/nbsd64.mh
@@ -1,6 +1,6 @@
# Host: NetBSD/sparc64
-NATDEPFILES= fork-child.o inf-ptrace.o \
- sparc64nbsd-nat.o sparc-nat.o bsd-kvm.o
+NATDEPFILES= sparc64nbsd-nat.o sparc-nat.o bsd-kvm.o \
+ fork-child.o infptrace.o inftarg.o
NAT_FILE= nm-nbsd.h
LOADLIBES= -lkvm
diff --git a/gdb/config/sparc/nbsd64.mt b/gdb/config/sparc/nbsd64.mt
index 9264edd..6d8eb1b 100644
--- a/gdb/config/sparc/nbsd64.mt
+++ b/gdb/config/sparc/nbsd64.mt
@@ -2,4 +2,4 @@
TDEPFILES= sparc64-tdep.o sparc64nbsd-tdep.o \
sparc-tdep.o sparcnbsd-tdep.o nbsd-tdep.o \
corelow.o solib.o solib-svr4.o
-DEPRECATED_TM_FILE= solib.h
+DEPRECATED_TM_FILE= tm-nbsd.h
diff --git a/gdb/config/sparc/nbsdaout.mh b/gdb/config/sparc/nbsdaout.mh
index cd0067d..8944e60 100644
--- a/gdb/config/sparc/nbsdaout.mh
+++ b/gdb/config/sparc/nbsdaout.mh
@@ -1,6 +1,4 @@
# Host: NetBSD/sparc a.out
-NATDEPFILES= fork-child.o inf-ptrace.o \
- sparc-nat.o sparcnbsd-nat.o bsd-kvm.o solib-sunos.o
-NAT_FILE= nm-nbsd.h
-
-LOADLIBES= -lkvm
+NATDEPFILES= sparc-nat.o sparcnbsd-nat.o \
+ fork-child.o infptrace.o inftarg.o solib-sunos.o
+NAT_FILE= nm-nbsdaout.h
diff --git a/gdb/config/sparc/nbsdelf.mh b/gdb/config/sparc/nbsdelf.mh
index d258fcc..611a6a4 100644
--- a/gdb/config/sparc/nbsdelf.mh
+++ b/gdb/config/sparc/nbsdelf.mh
@@ -1,6 +1,6 @@
# Host: NetBSD/sparc ELF
-NATDEPFILES= fork-child.o inf-ptrace.o \
- sparc-nat.o sparcnbsd-nat.o bsd-kvm.o
+NATDEPFILES= sparc-nat.o sparcnbsd-nat.o bsd-kvm.o \
+ fork-child.o infptrace.o inftarg.o
NAT_FILE= nm-nbsd.h
LOADLIBES= -lkvm
diff --git a/gdb/config/sparc/obsd.mt b/gdb/config/sparc/obsd.mt
index a24b7e9..0dffffc 100644
--- a/gdb/config/sparc/obsd.mt
+++ b/gdb/config/sparc/obsd.mt
@@ -1,4 +1,4 @@
# Target: OpenBSD/sparc
TDEPFILES= sparc-tdep.o sparcnbsd-tdep.o sparcobsd-tdep.o nbsd-tdep.o \
corelow.o solib.o solib-svr4.o
-DEPRECATED_TM_FILE= solib.h
+DEPRECATED_TM_FILE= tm-nbsd.h
diff --git a/gdb/config/sparc/obsd64.mt b/gdb/config/sparc/obsd64.mt
index 8514db1..8f5ef80 100644
--- a/gdb/config/sparc/obsd64.mt
+++ b/gdb/config/sparc/obsd64.mt
@@ -2,4 +2,4 @@
TDEPFILES= sparc64-tdep.o sparc64nbsd-tdep.o sparc64obsd-tdep.o \
sparc-tdep.o sparcnbsd-tdep.o sparcobsd-tdep.o nbsd-tdep.o \
corelow.o solib.o solib-svr4.o
-DEPRECATED_TM_FILE= solib.h
+DEPRECATED_TM_FILE= tm-nbsd.h
diff --git a/gdb/config/vax/nbsdaout.mh b/gdb/config/vax/nbsdaout.mh
index faf42b5..6887135 100644
--- a/gdb/config/vax/nbsdaout.mh
+++ b/gdb/config/vax/nbsdaout.mh
@@ -1,6 +1,5 @@
# Host: NetBSD/vax a.out
-NATDEPFILES= fork-child.o inf-ptrace.o \
- vaxbsd-nat.o bsd-kvm.o \
+NATDEPFILES= vaxbsd-nat.o bsd-kvm.o fork-child.o infptrace.o inftarg.o \
solib.o solib-sunos.o
NAT_FILE= nm-nbsdaout.h
diff --git a/gdb/config/vax/nbsdelf.mh b/gdb/config/vax/nbsdelf.mh
index dd9441b..06dda18 100644
--- a/gdb/config/vax/nbsdelf.mh
+++ b/gdb/config/vax/nbsdelf.mh
@@ -1,5 +1,5 @@
# Host: NetBSD/vax ELF
-NATDEPFILES= fork-child.o inf-ptrace.o \
- vaxbsd-nat.o bsd-kvm.o
+NATDEPFILES= vaxbsd-nat.o bsd-kvm.o fork-child.o infptrace.o inftarg.o
+NAT_FILE= config/nm-nbsd.h
LOADLIBES= -lkvm
diff --git a/gdb/config/vax/obsd.mh b/gdb/config/vax/obsd.mh
index d4d444f..416f2c6 100644
--- a/gdb/config/vax/obsd.mh
+++ b/gdb/config/vax/obsd.mh
@@ -1,5 +1,5 @@
# Host: OpenBSD/vax
-NATDEPFILES= fork-child.o inf-ptrace.o \
- vaxbsd-nat.o bsd-kvm.o
+NATDEPFILES= vaxbsd-nat.o bsd-kvm.o fork-child.o infptrace.o inftarg.o
+NAT_FILE= config/nm-bsd.h
LOADLIBES= -lkvm
diff --git a/gdb/configure b/gdb/configure
index be9c105..349fdfd 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -3094,6 +3094,21 @@ else
enable_tui=yes
fi
+if test x"$enable_tui" = xyes; then
+ if test -d $srcdir/tui; then
+ if test "$ac_cv_search_initscr" != no -a "$ac_cv_search_wborder" != no; then
+ CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_TUI_OBS)"
+ CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_TUI_DEPS)"
+ CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_TUI_SRCS)"
+ CONFIG_INITS="$CONFIG_INITS \$(SUBDIR_TUI_INITS)"
+ ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_TUI_CFLAGS)"
+ CONFIG_ALL="${CONFIG_ALL} all-tui"
+ CONFIG_CLEAN="${CONFIG_CLEAN} clean-tui"
+ CONFIG_INSTALL="${CONFIG_INSTALL} install-tui"
+ CONFIG_UNINSTALL="${CONFIG_UNINSTALL} uninstall-tui"
+ fi
+ fi
+fi
# Enable gdbtk.
# Check whether --enable-gdbtk or --disable-gdbtk was given.
@@ -3135,17 +3150,17 @@ else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3139: checking for $ac_hdr" >&5
+echo "configure:3154: checking for $ac_hdr" >&5
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 3144 "configure"
+#line 3159 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3149: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3164: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -3175,17 +3190,17 @@ done
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3179: checking for $ac_hdr" >&5
+echo "configure:3194: checking for $ac_hdr" >&5
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 3184 "configure"
+#line 3199 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3189: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3204: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -3223,17 +3238,17 @@ if test x"$enable_libunwind" = xyes; then
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3227: checking for $ac_hdr" >&5
+echo "configure:3242: checking for $ac_hdr" >&5
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 3232 "configure"
+#line 3247 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3237: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3252: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -3263,17 +3278,17 @@ done
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3267: checking for $ac_hdr" >&5
+echo "configure:3282: checking for $ac_hdr" >&5
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 3272 "configure"
+#line 3287 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3277: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3292: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -3326,12 +3341,12 @@ fi
for ac_func in monstartup _mcleanup
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3330: checking for $ac_func" >&5
+echo "configure:3345: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3335 "configure"
+#line 3350 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3354,7 +3369,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3358: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3373: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -3379,12 +3394,12 @@ fi
done
echo $ac_n "checking for _etext""... $ac_c" 1>&6
-echo "configure:3383: checking for _etext" >&5
+echo "configure:3398: checking for _etext" >&5
if eval "test \"`echo '$''{'ac_cv_var__etext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3388 "configure"
+#line 3403 "configure"
#include "confdefs.h"
#include <stdlib.h>
extern char _etext;
@@ -3393,7 +3408,7 @@ int main() {
free (&_etext);
; return 0; }
EOF
-if { (eval echo configure:3397: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3412: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_var__etext=yes
else
@@ -3421,19 +3436,19 @@ if test "$enable_profiling" = yes ; then
CFLAGS="$CFLAGS $PROFILE_CFLAGS"
echo $ac_n "checking whether $CC supports -pg""... $ac_c" 1>&6
-echo "configure:3425: checking whether $CC supports -pg" >&5
+echo "configure:3440: checking whether $CC supports -pg" >&5
if eval "test \"`echo '$''{'ac_cv_cc_supports_pg'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3430 "configure"
+#line 3445 "configure"
#include "confdefs.h"
int main() {
int x;
; return 0; }
EOF
-if { (eval echo configure:3437: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3452: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_cc_supports_pg=yes
else
@@ -3463,7 +3478,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3467: checking for $ac_word" >&5
+echo "configure:3482: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3504,7 +3519,7 @@ done
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:3508: checking for a BSD compatible install" >&5
+echo "configure:3523: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -3557,7 +3572,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:3561: checking whether ln -s works" >&5
+echo "configure:3576: checking whether ln -s works" >&5
if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3580,7 +3595,7 @@ fi
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3584: checking for $ac_word" >&5
+echo "configure:3599: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3612,7 +3627,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3616: checking for $ac_word" >&5
+echo "configure:3631: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3646,7 +3661,7 @@ test -n "$YACC" || YACC="yacc"
# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
set dummy ${ac_tool_prefix}ar; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3650: checking for $ac_word" >&5
+echo "configure:3665: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3678,7 +3693,7 @@ fi
# Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
set dummy ${ac_tool_prefix}dlltool; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3682: checking for $ac_word" >&5
+echo "configure:3697: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3710,7 +3725,7 @@ fi
# Extract the first word of "${ac_tool_prefix}windres", so it can be a program name with args.
set dummy ${ac_tool_prefix}windres; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3714: checking for $ac_word" >&5
+echo "configure:3729: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3744,7 +3759,7 @@ fi
# Extract the first word of "${ac_tool_prefix}mig", so it can be a program name with args.
set dummy ${ac_tool_prefix}mig; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3748: checking for $ac_word" >&5
+echo "configure:3763: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_MIG'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3780,7 +3795,7 @@ fi
# We might need to link with -lm; most simulators need it.
echo $ac_n "checking for main in -lm""... $ac_c" 1>&6
-echo "configure:3784: checking for main in -lm" >&5
+echo "configure:3799: checking for main in -lm" >&5
ac_lib_var=`echo m'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -3788,14 +3803,14 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lm $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3792 "configure"
+#line 3807 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:3799: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3814: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -3828,12 +3843,12 @@ fi
# libw that some versions of the GNU linker cannot hanle (GNU ld 2.9.1
# is known to have this problem). Therefore we avoid libw if we can.
echo $ac_n "checking for wctype""... $ac_c" 1>&6
-echo "configure:3832: checking for wctype" >&5
+echo "configure:3847: checking for wctype" >&5
if eval "test \"`echo '$''{'ac_cv_func_wctype'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3837 "configure"
+#line 3852 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char wctype(); below. */
@@ -3856,7 +3871,7 @@ wctype();
; return 0; }
EOF
-if { (eval echo configure:3860: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3875: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_wctype=yes"
else
@@ -3874,7 +3889,7 @@ if eval "test \"`echo '$ac_cv_func_'wctype`\" = yes"; then
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for wctype in -lw""... $ac_c" 1>&6
-echo "configure:3878: checking for wctype in -lw" >&5
+echo "configure:3893: checking for wctype in -lw" >&5
ac_lib_var=`echo w'_'wctype | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -3882,7 +3897,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lw $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3886 "configure"
+#line 3901 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -3893,7 +3908,7 @@ int main() {
wctype()
; return 0; }
EOF
-if { (eval echo configure:3897: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3912: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -3926,14 +3941,14 @@ fi
# Some systems (e.g. Solaris) have `gethostbyname' in libnsl.
echo $ac_n "checking for library containing gethostbyname""... $ac_c" 1>&6
-echo "configure:3930: checking for library containing gethostbyname" >&5
+echo "configure:3945: checking for library containing gethostbyname" >&5
if eval "test \"`echo '$''{'ac_cv_search_gethostbyname'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_func_search_save_LIBS="$LIBS"
ac_cv_search_gethostbyname="no"
cat > conftest.$ac_ext <<EOF
-#line 3937 "configure"
+#line 3952 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -3944,7 +3959,7 @@ int main() {
gethostbyname()
; return 0; }
EOF
-if { (eval echo configure:3948: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3963: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_search_gethostbyname="none required"
else
@@ -3955,7 +3970,7 @@ rm -f conftest*
test "$ac_cv_search_gethostbyname" = "no" && for i in nsl; do
LIBS="-l$i $ac_func_search_save_LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3959 "configure"
+#line 3974 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -3966,7 +3981,7 @@ int main() {
gethostbyname()
; return 0; }
EOF
-if { (eval echo configure:3970: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3985: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_search_gethostbyname="-l$i"
break
@@ -3990,14 +4005,14 @@ fi
# Some systems (e.g. Solaris) have `socketpair' in libsocket.
echo $ac_n "checking for library containing socketpair""... $ac_c" 1>&6
-echo "configure:3994: checking for library containing socketpair" >&5
+echo "configure:4009: checking for library containing socketpair" >&5
if eval "test \"`echo '$''{'ac_cv_search_socketpair'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_func_search_save_LIBS="$LIBS"
ac_cv_search_socketpair="no"
cat > conftest.$ac_ext <<EOF
-#line 4001 "configure"
+#line 4016 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -4008,7 +4023,7 @@ int main() {
socketpair()
; return 0; }
EOF
-if { (eval echo configure:4012: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4027: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_search_socketpair="none required"
else
@@ -4019,7 +4034,7 @@ rm -f conftest*
test "$ac_cv_search_socketpair" = "no" && for i in socket; do
LIBS="-l$i $ac_func_search_save_LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4023 "configure"
+#line 4038 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -4030,7 +4045,7 @@ int main() {
socketpair()
; return 0; }
EOF
-if { (eval echo configure:4034: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4049: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_search_socketpair="-l$i"
break
@@ -4051,60 +4066,67 @@ else :
fi
-# For the TUI, we need enhanced curses functionality.
-#
-# FIXME: kettenis/20040905: We prefer ncurses over the vendor-supplied
-# curses library because the latter might not provide all the
-# functionality we need. However, this leads to problems on systems
-# where the linker searches /usr/local/lib, but the compiler doesn't
-# search /usr/local/include, if ncurses is installed in /usr/local. A
-# default installation of ncurses on alpha*-dec-osf* will lead to such
-# a situation.
+# Since GDB uses Readline, we need termcap functionality, so we need
+# to find a library that provides that. When GDB is configured with
+# the TUI, we need full curses functionality.
-echo $ac_n "checking for library containing waddstr""... $ac_c" 1>&6
-echo "configure:4066: checking for library containing waddstr" >&5
-if eval "test \"`echo '$''{'ac_cv_search_waddstr'+set}'`\" = set"; then
+case $host_os in
+ cygwin*)
+ if test -d $srcdir/libtermcap; then
+ LIBS="../libtermcap/libtermcap.a $LIBS"
+ ac_cv_search_tgetent="../libtermcap/libtermcap.a"
+ fi ;;
+ go32* | *djgpp*)
+ ac_cv_search_tgetent="none required"
+ ;;
+ aix*)
+ # Readline prefers curses over termcap on AIX.
+ # ??? Why?
+
+echo $ac_n "checking for library containing tgetent""... $ac_c" 1>&6
+echo "configure:4088: checking for library containing tgetent" >&5
+if eval "test \"`echo '$''{'ac_cv_search_tgetent'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_func_search_save_LIBS="$LIBS"
-ac_cv_search_waddstr="no"
+ac_cv_search_tgetent="no"
cat > conftest.$ac_ext <<EOF
-#line 4073 "configure"
+#line 4095 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
-char waddstr();
+char tgetent();
int main() {
-waddstr()
+tgetent()
; return 0; }
EOF
-if { (eval echo configure:4084: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4106: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
- ac_cv_search_waddstr="none required"
+ ac_cv_search_tgetent="none required"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
fi
rm -f conftest*
-test "$ac_cv_search_waddstr" = "no" && for i in ncurses cursesX curses; do
+test "$ac_cv_search_tgetent" = "no" && for i in tinfo ncurses curses termcap; do
LIBS="-l$i $ac_func_search_save_LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4095 "configure"
+#line 4117 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
-char waddstr();
+char tgetent();
int main() {
-waddstr()
+tgetent()
; return 0; }
EOF
-if { (eval echo configure:4106: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4128: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
- ac_cv_search_waddstr="-l$i"
+ ac_cv_search_tgetent="-l$i"
break
else
echo "configure: failed program was:" >&5
@@ -4115,40 +4137,28 @@ done
LIBS="$ac_func_search_save_LIBS"
fi
-echo "$ac_t""$ac_cv_search_waddstr" 1>&6
-if test "$ac_cv_search_waddstr" != "no"; then
- test "$ac_cv_search_waddstr" = "none required" || LIBS="$ac_cv_search_waddstr $LIBS"
+echo "$ac_t""$ac_cv_search_tgetent" 1>&6
+if test "$ac_cv_search_tgetent" != "no"; then
+ test "$ac_cv_search_tgetent" = "none required" || LIBS="$ac_cv_search_tgetent $LIBS"
else :
fi
-
-# Since GDB uses Readline, we need termcap functionality. In many
-# cases this will be provided by the curses library, but some systems
-# have a seperate termcap library, or no curses library at all.
-
-case $host_os in
- cygwin*)
- if test -d $srcdir/libtermcap; then
- LIBS="../libtermcap/libtermcap.a $LIBS"
- ac_cv_search_tgetent="../libtermcap/libtermcap.a"
- fi ;;
- go32* | *djgpp*)
- ac_cv_search_tgetent="none required"
;;
esac
-# These are the libraries checked by Readline.
+# Note: We used to check for libtermlib and libterminfo too, but
+# Readline doesn't, so I think we're safe with leaving them out.
echo $ac_n "checking for library containing tgetent""... $ac_c" 1>&6
-echo "configure:4145: checking for library containing tgetent" >&5
+echo "configure:4155: checking for library containing tgetent" >&5
if eval "test \"`echo '$''{'ac_cv_search_tgetent'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_func_search_save_LIBS="$LIBS"
ac_cv_search_tgetent="no"
cat > conftest.$ac_ext <<EOF
-#line 4152 "configure"
+#line 4162 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -4159,7 +4169,7 @@ int main() {
tgetent()
; return 0; }
EOF
-if { (eval echo configure:4163: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4173: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_search_tgetent="none required"
else
@@ -4167,10 +4177,10 @@ else
cat conftest.$ac_ext >&5
fi
rm -f conftest*
-test "$ac_cv_search_tgetent" = "no" && for i in termcap tinfo curses ncurses; do
+test "$ac_cv_search_tgetent" = "no" && for i in termcap tinfo ncurses Hcurses curses; do
LIBS="-l$i $ac_func_search_save_LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4174 "configure"
+#line 4184 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -4181,7 +4191,7 @@ int main() {
tgetent()
; return 0; }
EOF
-if { (eval echo configure:4185: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4195: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_search_tgetent="-l$i"
break
@@ -4206,6 +4216,152 @@ if test "$ac_cv_search_tgetent" = no; then
{ echo "configure: error: no termcap library found" 1>&2; exit 1; }
fi
+# FIXME: kettenis/20030102: We seem to prefer HP curses (Hcurses) over
+# Xcurses on HP-UX; see the `-D__HP_CURSES' in the relevant host
+# Makefile fragments. That's why we need to have `Hcurses' before
+# `curses'. I don't see why we should use HP curses if a more
+# standard curses is available, except that according to HP's
+# documentation one needs to compile `-D_XOPEN_SOURCE_EXTENDED' on
+# HP-UX 10.10 and 10.20.
+
+# FIXME: ncurses does not work on native alphaev68-dec-osf5.1,
+# and probably other platforms. AC_SEARCH_LIBS finds the library
+# in a place such as /usr/local/lib/libncurses.a, but does not
+# do anything to look for the matching include files.
+# -- chastain 2004-05-01
+
+
+echo $ac_n "checking for library containing initscr""... $ac_c" 1>&6
+echo "configure:4236: checking for library containing initscr" >&5
+if eval "test \"`echo '$''{'ac_cv_search_initscr'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_func_search_save_LIBS="$LIBS"
+ac_cv_search_initscr="no"
+cat > conftest.$ac_ext <<EOF
+#line 4243 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char initscr();
+
+int main() {
+initscr()
+; return 0; }
+EOF
+if { (eval echo configure:4254: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ ac_cv_search_initscr="none required"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+test "$ac_cv_search_initscr" = "no" && for i in ncurses Hcurses cursesX curses pdcurses; do
+LIBS="-l$i $ac_func_search_save_LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 4265 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char initscr();
+
+int main() {
+initscr()
+; return 0; }
+EOF
+if { (eval echo configure:4276: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ ac_cv_search_initscr="-l$i"
+break
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+done
+LIBS="$ac_func_search_save_LIBS"
+fi
+
+echo "$ac_t""$ac_cv_search_initscr" 1>&6
+if test "$ac_cv_search_initscr" != "no"; then
+ test "$ac_cv_search_initscr" = "none required" || LIBS="$ac_cv_search_initscr $LIBS"
+
+else :
+ echo "configure: warning: no curses library found" 1>&2
+fi
+
+# Check whether the wborder function is provided by the curses
+# library detected above. In certain implementations such as
+# the HP/UX Hcurses for instance, this function is provided by an
+# additional library. So if we did not find this function inside
+# the curses library, try some alternate libraries we know might
+# provide it.
+
+echo $ac_n "checking for library containing wborder""... $ac_c" 1>&6
+echo "configure:4305: checking for library containing wborder" >&5
+if eval "test \"`echo '$''{'ac_cv_search_wborder'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_func_search_save_LIBS="$LIBS"
+ac_cv_search_wborder="no"
+cat > conftest.$ac_ext <<EOF
+#line 4312 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char wborder();
+
+int main() {
+wborder()
+; return 0; }
+EOF
+if { (eval echo configure:4323: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ ac_cv_search_wborder="none required"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+test "$ac_cv_search_wborder" = "no" && for i in cur_colr; do
+LIBS="-l$i $ac_func_search_save_LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 4334 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char wborder();
+
+int main() {
+wborder()
+; return 0; }
+EOF
+if { (eval echo configure:4345: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ ac_cv_search_wborder="-l$i"
+break
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+done
+LIBS="$ac_func_search_save_LIBS"
+fi
+
+echo "$ac_t""$ac_cv_search_wborder" 1>&6
+if test "$ac_cv_search_wborder" != "no"; then
+ test "$ac_cv_search_wborder" = "none required" || LIBS="$ac_cv_search_wborder $LIBS"
+
+else :
+ echo "configure: warning: wborder function not found, tui will be disabled" 1>&2
+fi
+
# ------------------------- #
# Checks for header files. #
# ------------------------- #
@@ -4215,12 +4371,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
-echo "configure:4219: checking for $ac_hdr that defines DIR" >&5
+echo "configure:4375: checking for $ac_hdr that defines DIR" >&5
if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4224 "configure"
+#line 4380 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <$ac_hdr>
@@ -4228,7 +4384,7 @@ int main() {
DIR *dirp = 0;
; return 0; }
EOF
-if { (eval echo configure:4232: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4388: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_header_dirent_$ac_safe=yes"
else
@@ -4253,7 +4409,7 @@ done
# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
if test $ac_header_dirent = dirent.h; then
echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
-echo "configure:4257: checking for opendir in -ldir" >&5
+echo "configure:4413: checking for opendir in -ldir" >&5
ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -4261,7 +4417,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldir $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4265 "configure"
+#line 4421 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -4272,7 +4428,7 @@ int main() {
opendir()
; return 0; }
EOF
-if { (eval echo configure:4276: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4432: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -4294,7 +4450,7 @@ fi
else
echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:4298: checking for opendir in -lx" >&5
+echo "configure:4454: checking for opendir in -lx" >&5
ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -4302,7 +4458,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lx $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4306 "configure"
+#line 4462 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -4313,7 +4469,7 @@ int main() {
opendir()
; return 0; }
EOF
-if { (eval echo configure:4317: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4473: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -4336,12 +4492,12 @@ fi
fi
echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6
-echo "configure:4340: checking whether stat file-mode macros are broken" >&5
+echo "configure:4496: checking whether stat file-mode macros are broken" >&5
if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4345 "configure"
+#line 4501 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
@@ -4392,12 +4548,12 @@ EOF
fi
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:4396: checking for ANSI C header files" >&5
+echo "configure:4552: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4401 "configure"
+#line 4557 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -4405,7 +4561,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4409: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4565: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4422,7 +4578,7 @@ rm -f conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 4426 "configure"
+#line 4582 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -4440,7 +4596,7 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 4444 "configure"
+#line 4600 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -4461,7 +4617,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
-#line 4465 "configure"
+#line 4621 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -4472,7 +4628,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
-if { (eval echo configure:4476: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4632: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@@ -4499,17 +4655,17 @@ for ac_hdr in link.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4503: checking for $ac_hdr" >&5
+echo "configure:4659: checking for $ac_hdr" >&5
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 4508 "configure"
+#line 4664 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4513: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4669: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4539,17 +4695,17 @@ for ac_hdr in machine/reg.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4543: checking for $ac_hdr" >&5
+echo "configure:4699: checking for $ac_hdr" >&5
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 4548 "configure"
+#line 4704 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4553: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4709: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4579,17 +4735,17 @@ for ac_hdr in nlist.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4583: checking for $ac_hdr" >&5
+echo "configure:4739: checking for $ac_hdr" >&5
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 4588 "configure"
+#line 4744 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4593: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4749: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4619,17 +4775,17 @@ for ac_hdr in poll.h sys/poll.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4623: checking for $ac_hdr" >&5
+echo "configure:4779: checking for $ac_hdr" >&5
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 4628 "configure"
+#line 4784 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4633: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4789: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4659,17 +4815,17 @@ for ac_hdr in proc_service.h thread_db.h gnu/libc-version.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4663: checking for $ac_hdr" >&5
+echo "configure:4819: checking for $ac_hdr" >&5
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 4668 "configure"
+#line 4824 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4673: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4829: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4699,17 +4855,17 @@ for ac_hdr in stddef.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4703: checking for $ac_hdr" >&5
+echo "configure:4859: checking for $ac_hdr" >&5
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 4708 "configure"
+#line 4864 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4713: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4869: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4739,17 +4895,17 @@ for ac_hdr in stdlib.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4743: checking for $ac_hdr" >&5
+echo "configure:4899: checking for $ac_hdr" >&5
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 4748 "configure"
+#line 4904 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4753: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4909: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4779,17 +4935,17 @@ for ac_hdr in stdint.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4783: checking for $ac_hdr" >&5
+echo "configure:4939: checking for $ac_hdr" >&5
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 4788 "configure"
+#line 4944 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4793: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4949: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4819,17 +4975,17 @@ for ac_hdr in string.h memory.h strings.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4823: checking for $ac_hdr" >&5
+echo "configure:4979: checking for $ac_hdr" >&5
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 4828 "configure"
+#line 4984 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4833: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4989: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4859,17 +5015,17 @@ for ac_hdr in sys/fault.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4863: checking for $ac_hdr" >&5
+echo "configure:5019: checking for $ac_hdr" >&5
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 4868 "configure"
+#line 5024 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4873: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5029: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4899,17 +5055,17 @@ for ac_hdr in sys/file.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4903: checking for $ac_hdr" >&5
+echo "configure:5059: checking for $ac_hdr" >&5
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 4908 "configure"
+#line 5064 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4913: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5069: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4939,17 +5095,17 @@ for ac_hdr in sys/filio.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4943: checking for $ac_hdr" >&5
+echo "configure:5099: checking for $ac_hdr" >&5
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 4948 "configure"
+#line 5104 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4953: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5109: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4979,17 +5135,17 @@ for ac_hdr in sys/ioctl.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4983: checking for $ac_hdr" >&5
+echo "configure:5139: checking for $ac_hdr" >&5
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 4988 "configure"
+#line 5144 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4993: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5149: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -5019,17 +5175,17 @@ for ac_hdr in sys/param.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5023: checking for $ac_hdr" >&5
+echo "configure:5179: checking for $ac_hdr" >&5
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 5028 "configure"
+#line 5184 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5033: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5189: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -5059,17 +5215,17 @@ for ac_hdr in sys/proc.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5063: checking for $ac_hdr" >&5
+echo "configure:5219: checking for $ac_hdr" >&5
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 5068 "configure"
+#line 5224 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5073: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5229: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -5099,17 +5255,17 @@ for ac_hdr in sys/procfs.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5103: checking for $ac_hdr" >&5
+echo "configure:5259: checking for $ac_hdr" >&5
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 5108 "configure"
+#line 5264 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5113: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5269: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -5139,17 +5295,17 @@ for ac_hdr in sys/ptrace.h ptrace.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5143: checking for $ac_hdr" >&5
+echo "configure:5299: checking for $ac_hdr" >&5
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 5148 "configure"
+#line 5304 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5153: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5309: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -5179,17 +5335,17 @@ for ac_hdr in sys/reg.h sys/debugreg.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5183: checking for $ac_hdr" >&5
+echo "configure:5339: checking for $ac_hdr" >&5
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 5188 "configure"
+#line 5344 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5193: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5349: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -5219,17 +5375,17 @@ for ac_hdr in sys/select.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5223: checking for $ac_hdr" >&5
+echo "configure:5379: checking for $ac_hdr" >&5
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 5228 "configure"
+#line 5384 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5233: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5389: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -5259,17 +5415,17 @@ for ac_hdr in sys/syscall.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5263: checking for $ac_hdr" >&5
+echo "configure:5419: checking for $ac_hdr" >&5
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 5268 "configure"
+#line 5424 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5273: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5429: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -5299,17 +5455,17 @@ for ac_hdr in sys/types.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5303: checking for $ac_hdr" >&5
+echo "configure:5459: checking for $ac_hdr" >&5
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 5308 "configure"
+#line 5464 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5313: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5469: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -5339,17 +5495,17 @@ for ac_hdr in sys/user.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5343: checking for $ac_hdr" >&5
+echo "configure:5499: checking for $ac_hdr" >&5
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 5348 "configure"
+#line 5504 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5353: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5509: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -5379,17 +5535,17 @@ for ac_hdr in sys/wait.h wait.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5383: checking for $ac_hdr" >&5
+echo "configure:5539: checking for $ac_hdr" >&5
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 5388 "configure"
+#line 5544 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5393: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5549: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -5419,17 +5575,17 @@ for ac_hdr in termios.h termio.h sgtty.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5423: checking for $ac_hdr" >&5
+echo "configure:5579: checking for $ac_hdr" >&5
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 5428 "configure"
+#line 5584 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5433: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5589: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -5459,17 +5615,17 @@ for ac_hdr in unistd.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5463: checking for $ac_hdr" >&5
+echo "configure:5619: checking for $ac_hdr" >&5
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 5468 "configure"
+#line 5624 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5473: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5629: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -5512,17 +5668,17 @@ for ac_hdr in curses.h cursesX.h ncurses.h ncurses/ncurses.h term.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5516: checking for $ac_hdr" >&5
+echo "configure:5672: checking for $ac_hdr" >&5
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 5521 "configure"
+#line 5677 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5526: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5682: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -5555,17 +5711,17 @@ for ac_hdr in ctype.h time.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5559: checking for $ac_hdr" >&5
+echo "configure:5715: checking for $ac_hdr" >&5
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 5564 "configure"
+#line 5720 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5569: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5725: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -5593,12 +5749,12 @@ done
echo $ac_n "checking for member st_blocks in struct stat""... $ac_c" 1>&6
-echo "configure:5597: checking for member st_blocks in struct stat" >&5
+echo "configure:5753: checking for member st_blocks in struct stat" >&5
if eval "test \"`echo '$''{'gdb_cv_have_struct_stat_with_st_blocks_member'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5602 "configure"
+#line 5758 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
@@ -5606,7 +5762,7 @@ int main() {
struct stat st; (void) st.st_blocks;
; return 0; }
EOF
-if { (eval echo configure:5610: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5766: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
gdb_cv_have_struct_stat_with_st_blocks_member=yes
else
@@ -5634,12 +5790,12 @@ for ac_func in getopt
do
ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
echo $ac_n "checking whether $ac_func is declared""... $ac_c" 1>&6
-echo "configure:5638: checking whether $ac_func is declared" >&5
+echo "configure:5794: checking whether $ac_func is declared" >&5
if eval "test \"`echo '$''{'gcc_cv_have_decl_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5643 "configure"
+#line 5799 "configure"
#include "confdefs.h"
#undef $ac_tr_decl
#define $ac_tr_decl 1
@@ -5651,7 +5807,7 @@ char *(*pfn) = (char *(*)) $ac_func ;
#endif
; return 0; }
EOF
-if { (eval echo configure:5655: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5811: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
eval "gcc_cv_have_decl_$ac_func=yes"
else
@@ -5688,12 +5844,12 @@ fi
# ------------------ #
echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:5692: checking return type of signal handlers" >&5
+echo "configure:5848: checking return type of signal handlers" >&5
if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5697 "configure"
+#line 5853 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
@@ -5710,7 +5866,7 @@ int main() {
int i;
; return 0; }
EOF
-if { (eval echo configure:5714: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5870: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_type_signal=void
else
@@ -5734,12 +5890,12 @@ EOF
# ------------------------------------- #
echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:5738: checking for working const" >&5
+echo "configure:5894: checking for working const" >&5
if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5743 "configure"
+#line 5899 "configure"
#include "confdefs.h"
int main() {
@@ -5788,7 +5944,7 @@ ccp = (char const *const *) p;
; return 0; }
EOF
-if { (eval echo configure:5792: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5948: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
@@ -5809,21 +5965,21 @@ EOF
fi
echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:5813: checking for inline" >&5
+echo "configure:5969: checking for inline" >&5
if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_c_inline=no
for ac_kw in inline __inline__ __inline; do
cat > conftest.$ac_ext <<EOF
-#line 5820 "configure"
+#line 5976 "configure"
#include "confdefs.h"
int main() {
} $ac_kw foo() {
; return 0; }
EOF
-if { (eval echo configure:5827: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5983: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_inline=$ac_kw; break
else
@@ -5856,19 +6012,19 @@ esac
# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
# for constant arguments. Useless!
echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
-echo "configure:5860: checking for working alloca.h" >&5
+echo "configure:6016: checking for working alloca.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5865 "configure"
+#line 6021 "configure"
#include "confdefs.h"
#include <alloca.h>
int main() {
char *p = alloca(2 * sizeof(int));
; return 0; }
EOF
-if { (eval echo configure:5872: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6028: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_header_alloca_h=yes
else
@@ -5889,12 +6045,12 @@ EOF
fi
echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:5893: checking for alloca" >&5
+echo "configure:6049: checking for alloca" >&5
if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5898 "configure"
+#line 6054 "configure"
#include "confdefs.h"
#ifdef __GNUC__
@@ -5922,7 +6078,7 @@ int main() {
char *p = (char *) alloca(1);
; return 0; }
EOF
-if { (eval echo configure:5926: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6082: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_func_alloca_works=yes
else
@@ -5954,12 +6110,12 @@ EOF
echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:5958: checking whether alloca needs Cray hooks" >&5
+echo "configure:6114: checking whether alloca needs Cray hooks" >&5
if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5963 "configure"
+#line 6119 "configure"
#include "confdefs.h"
#if defined(CRAY) && ! defined(CRAY2)
webecray
@@ -5984,12 +6140,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6
if test $ac_cv_os_cray = yes; then
for ac_func in _getb67 GETB67 getb67; do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5988: checking for $ac_func" >&5
+echo "configure:6144: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5993 "configure"
+#line 6149 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -6012,7 +6168,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:6016: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6172: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -6039,7 +6195,7 @@ done
fi
echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:6043: checking stack direction for C alloca" >&5
+echo "configure:6199: checking stack direction for C alloca" >&5
if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -6047,7 +6203,7 @@ else
ac_cv_c_stack_direction=0
else
cat > conftest.$ac_ext <<EOF
-#line 6051 "configure"
+#line 6207 "configure"
#include "confdefs.h"
find_stack_direction ()
{
@@ -6066,7 +6222,7 @@ main ()
exit (find_stack_direction() < 0);
}
EOF
-if { (eval echo configure:6070: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6226: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_c_stack_direction=1
else
@@ -6091,17 +6247,17 @@ for ac_hdr in unistd.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:6095: checking for $ac_hdr" >&5
+echo "configure:6251: checking for $ac_hdr" >&5
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 6100 "configure"
+#line 6256 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6105: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6261: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -6130,12 +6286,12 @@ done
for ac_func in getpagesize
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6134: checking for $ac_func" >&5
+echo "configure:6290: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6139 "configure"
+#line 6295 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -6158,7 +6314,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:6162: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -6183,7 +6339,7 @@ fi
done
echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:6187: checking for working mmap" >&5
+echo "configure:6343: checking for working mmap" >&5
if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -6191,7 +6347,7 @@ else
ac_cv_func_mmap_fixed_mapped=no
else
cat > conftest.$ac_ext <<EOF
-#line 6195 "configure"
+#line 6351 "configure"
#include "confdefs.h"
/* Thanks to Mike Haertel and Jim Avera for this test.
@@ -6331,7 +6487,7 @@ main()
}
EOF
-if { (eval echo configure:6335: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6491: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_mmap_fixed_mapped=yes
else
@@ -6354,12 +6510,12 @@ EOF
fi
echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:6358: checking for pid_t" >&5
+echo "configure:6514: checking for pid_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6363 "configure"
+#line 6519 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -6388,17 +6544,17 @@ fi
ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for vfork.h""... $ac_c" 1>&6
-echo "configure:6392: checking for vfork.h" >&5
+echo "configure:6548: checking for vfork.h" >&5
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 6397 "configure"
+#line 6553 "configure"
#include "confdefs.h"
#include <vfork.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6402: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6558: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -6423,18 +6579,18 @@ else
fi
echo $ac_n "checking for working vfork""... $ac_c" 1>&6
-echo "configure:6427: checking for working vfork" >&5
+echo "configure:6583: checking for working vfork" >&5
if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
echo $ac_n "checking for vfork""... $ac_c" 1>&6
-echo "configure:6433: checking for vfork" >&5
+echo "configure:6589: checking for vfork" >&5
if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6438 "configure"
+#line 6594 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char vfork(); below. */
@@ -6457,7 +6613,7 @@ vfork();
; return 0; }
EOF
-if { (eval echo configure:6461: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6617: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_vfork=yes"
else
@@ -6479,7 +6635,7 @@ fi
ac_cv_func_vfork_works=$ac_cv_func_vfork
else
cat > conftest.$ac_ext <<EOF
-#line 6483 "configure"
+#line 6639 "configure"
#include "confdefs.h"
/* Thanks to Paul Eggert for this test. */
#include <stdio.h>
@@ -6574,7 +6730,7 @@ main() {
}
}
EOF
-if { (eval echo configure:6578: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6734: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_vfork_works=yes
else
@@ -6599,12 +6755,12 @@ fi
for ac_func in canonicalize_file_name realpath
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6603: checking for $ac_func" >&5
+echo "configure:6759: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6608 "configure"
+#line 6764 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -6627,7 +6783,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:6631: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6787: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -6654,12 +6810,12 @@ done
for ac_func in poll
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6658: checking for $ac_func" >&5
+echo "configure:6814: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6663 "configure"
+#line 6819 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -6682,7 +6838,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:6686: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6842: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -6709,12 +6865,12 @@ done
for ac_func in pread64
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6713: checking for $ac_func" >&5
+echo "configure:6869: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6718 "configure"
+#line 6874 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -6737,7 +6893,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:6741: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6897: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -6764,12 +6920,12 @@ done
for ac_func in sbrk
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6768: checking for $ac_func" >&5
+echo "configure:6924: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6773 "configure"
+#line 6929 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -6792,7 +6948,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:6796: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6952: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -6819,12 +6975,12 @@ done
for ac_func in setpgid setpgrp
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6823: checking for $ac_func" >&5
+echo "configure:6979: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6828 "configure"
+#line 6984 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -6847,7 +7003,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:6851: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7007: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -6874,12 +7030,12 @@ done
for ac_func in sigaction sigprocmask sigsetmask
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6878: checking for $ac_func" >&5
+echo "configure:7034: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6883 "configure"
+#line 7039 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -6902,7 +7058,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:6906: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7062: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -6929,12 +7085,12 @@ done
for ac_func in socketpair
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6933: checking for $ac_func" >&5
+echo "configure:7089: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6938 "configure"
+#line 7094 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -6957,7 +7113,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:6961: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7117: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -6984,12 +7140,12 @@ done
for ac_func in syscall
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6988: checking for $ac_func" >&5
+echo "configure:7144: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6993 "configure"
+#line 7149 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -7012,7 +7168,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:7016: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7172: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -7039,67 +7195,12 @@ done
for ac_func in ttrace
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:7043: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 7048 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:7071: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
-for ac_func in wborder
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:7098: checking for $ac_func" >&5
+echo "configure:7199: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 7103 "configure"
+#line 7204 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -7122,7 +7223,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:7126: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7227: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -7165,12 +7266,12 @@ for ac_func in ptrace
do
ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
echo $ac_n "checking whether $ac_func is declared""... $ac_c" 1>&6
-echo "configure:7169: checking whether $ac_func is declared" >&5
+echo "configure:7270: checking whether $ac_func is declared" >&5
if eval "test \"`echo '$''{'gcc_cv_have_decl_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 7174 "configure"
+#line 7275 "configure"
#include "confdefs.h"
#undef $ac_tr_decl
#define $ac_tr_decl 1
@@ -7182,7 +7283,7 @@ char *(*pfn) = (char *(*)) $ac_func ;
#endif
; return 0; }
EOF
-if { (eval echo configure:7186: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7287: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
eval "gcc_cv_have_decl_$ac_func=yes"
else
@@ -7218,19 +7319,19 @@ fi
# Check return type.
echo $ac_n "checking return type of ptrace""... $ac_c" 1>&6
-echo "configure:7222: checking return type of ptrace" >&5
+echo "configure:7323: checking return type of ptrace" >&5
if eval "test \"`echo '$''{'gdb_cv_func_ptrace_ret'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 7227 "configure"
+#line 7328 "configure"
#include "confdefs.h"
$gdb_ptrace_headers
int main() {
extern int ptrace ();
; return 0; }
EOF
-if { (eval echo configure:7234: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7335: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
gdb_cv_func_ptrace_ret='int'
else
@@ -7249,7 +7350,7 @@ EOF
# Check argument types.
echo $ac_n "checking types of arguments for ptrace""... $ac_c" 1>&6
-echo "configure:7253: checking types of arguments for ptrace" >&5
+echo "configure:7354: checking types of arguments for ptrace" >&5
if eval "test \"`echo '$''{'gdb_cv_func_ptrace_args'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -7259,7 +7360,7 @@ for gdb_arg1 in 'int' 'long'; do
for gdb_arg3 in 'int *' 'caddr_t' 'int' 'long'; do
for gdb_arg4 in 'int' 'long'; do
cat > conftest.$ac_ext <<EOF
-#line 7263 "configure"
+#line 7364 "configure"
#include "confdefs.h"
$gdb_ptrace_headers
int main() {
@@ -7269,7 +7370,7 @@ extern $gdb_cv_func_ptrace_ret
; return 0; }
EOF
-if { (eval echo configure:7273: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7374: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
gdb_cv_func_ptrace_args="$gdb_arg1,$gdb_arg2,$gdb_arg3,$gdb_arg4";
break 4;
@@ -7280,7 +7381,7 @@ fi
rm -f conftest*
for gdb_arg5 in 'int *' 'int' 'long'; do
cat > conftest.$ac_ext <<EOF
-#line 7284 "configure"
+#line 7385 "configure"
#include "confdefs.h"
$gdb_ptrace_headers
int main() {
@@ -7290,7 +7391,7 @@ extern $gdb_cv_func_ptrace_ret
; return 0; }
EOF
-if { (eval echo configure:7294: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7395: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
gdb_cv_func_ptrace_args="$gdb_arg1,$gdb_arg2,$gdb_arg3,$gdb_arg4,$gdb_arg5";
@@ -7328,7 +7429,7 @@ fi
if test "$cross_compiling" = no; then
echo $ac_n "checking whether setpgrp takes no argument""... $ac_c" 1>&6
-echo "configure:7332: checking whether setpgrp takes no argument" >&5
+echo "configure:7433: checking whether setpgrp takes no argument" >&5
if eval "test \"`echo '$''{'ac_cv_func_setpgrp_void'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -7336,7 +7437,7 @@ else
{ echo "configure: error: cannot check setpgrp if cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 7340 "configure"
+#line 7441 "configure"
#include "confdefs.h"
#ifdef HAVE_UNISTD_H
@@ -7356,7 +7457,7 @@ main()
}
EOF
-if { (eval echo configure:7360: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7461: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_setpgrp_void=no
else
@@ -7381,12 +7482,12 @@ fi
else
echo $ac_n "checking whether setpgrp takes no argument""... $ac_c" 1>&6
-echo "configure:7385: checking whether setpgrp takes no argument" >&5
+echo "configure:7486: checking whether setpgrp takes no argument" >&5
if eval "test \"`echo '$''{'ac_cv_func_setpgrp_void'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 7390 "configure"
+#line 7491 "configure"
#include "confdefs.h"
#include <unistd.h>
@@ -7400,7 +7501,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:7404: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7505: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_func_setpgrp_void=no
else
@@ -7424,12 +7525,12 @@ fi
# Check if sigsetjmp is available. Using AC_CHECK_FUNCS won't do
# since sigsetjmp might only be defined as a macro.
echo $ac_n "checking for sigsetjmp""... $ac_c" 1>&6
-echo "configure:7428: checking for sigsetjmp" >&5
+echo "configure:7529: checking for sigsetjmp" >&5
if eval "test \"`echo '$''{'gdb_cv_func_sigsetjmp'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 7433 "configure"
+#line 7534 "configure"
#include "confdefs.h"
#include <setjmp.h>
@@ -7438,7 +7539,7 @@ int main() {
sigjmp_buf env; while (! sigsetjmp (env, 1)) siglongjmp (env, 1);
; return 0; }
EOF
-if { (eval echo configure:7442: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7543: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
gdb_cv_func_sigsetjmp=yes
else
@@ -7464,12 +7565,12 @@ gdb_use_included_regex=yes
# However, if the system regex is GNU regex, then default to *not*
# using the included regex.
echo $ac_n "checking for GNU regex""... $ac_c" 1>&6
-echo "configure:7468: checking for GNU regex" >&5
+echo "configure:7569: checking for GNU regex" >&5
if eval "test \"`echo '$''{'gdb_cv_have_gnu_regex'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 7473 "configure"
+#line 7574 "configure"
#include "confdefs.h"
#include <gnu-versions.h>
int main() {
@@ -7479,7 +7580,7 @@ int main() {
#endif
; return 0; }
EOF
-if { (eval echo configure:7483: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7584: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
gdb_cv_have_gnu_regex=yes
else
@@ -7513,12 +7614,12 @@ fi
# See if <sys/proc.h> defines `struct thread' with a td_pcb member.
echo $ac_n "checking for td_pcb in struct thread""... $ac_c" 1>&6
-echo "configure:7517: checking for td_pcb in struct thread" >&5
+echo "configure:7618: checking for td_pcb in struct thread" >&5
if eval "test \"`echo '$''{'gdb_cv_struct_thread_td_pcb'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 7522 "configure"
+#line 7623 "configure"
#include "confdefs.h"
#include <sys/param.h>
#include <sys/proc.h>
@@ -7526,7 +7627,7 @@ int main() {
struct thread td; td.td_pcb;
; return 0; }
EOF
-if { (eval echo configure:7530: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7631: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
gdb_cv_struct_thread_td_pcb=yes
else
@@ -7548,12 +7649,12 @@ fi
# See if <sys/lwp.h> defines `struct lwp`.
echo $ac_n "checking for struct lwp""... $ac_c" 1>&6
-echo "configure:7552: checking for struct lwp" >&5
+echo "configure:7653: checking for struct lwp" >&5
if eval "test \"`echo '$''{'gdb_cv_struct_lwp'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 7557 "configure"
+#line 7658 "configure"
#include "confdefs.h"
#include <sys/param.h>
#include <sys/lwp.h>
@@ -7561,7 +7662,7 @@ int main() {
struct lwp l;
; return 0; }
EOF
-if { (eval echo configure:7565: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7666: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
gdb_cv_struct_lwp=yes
else
@@ -7583,12 +7684,12 @@ fi
# See if <machine/reg.h> degines `struct reg'.
echo $ac_n "checking for struct reg in machine/reg.h""... $ac_c" 1>&6
-echo "configure:7587: checking for struct reg in machine/reg.h" >&5
+echo "configure:7688: checking for struct reg in machine/reg.h" >&5
if eval "test \"`echo '$''{'gdb_cv_struct_reg'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 7592 "configure"
+#line 7693 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <machine/reg.h>
@@ -7596,7 +7697,7 @@ int main() {
struct reg r;
; return 0; }
EOF
-if { (eval echo configure:7600: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7701: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
gdb_cv_struct_reg=yes
else
@@ -7619,19 +7720,19 @@ fi
# See if <machine/reg.h> supports the %fs and %gs i386 segment registers.
# Older i386 BSD's don't have the r_fs and r_gs members of `struct reg'.
echo $ac_n "checking for r_fs in struct reg""... $ac_c" 1>&6
-echo "configure:7623: checking for r_fs in struct reg" >&5
+echo "configure:7724: checking for r_fs in struct reg" >&5
if eval "test \"`echo '$''{'gdb_cv_struct_reg_r_fs'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 7628 "configure"
+#line 7729 "configure"
#include "confdefs.h"
#include <machine/reg.h>
int main() {
struct reg r; r.r_fs;
; return 0; }
EOF
-if { (eval echo configure:7635: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7736: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
gdb_cv_struct_reg_r_fs=yes
else
@@ -7651,19 +7752,19 @@ EOF
fi
echo $ac_n "checking for r_gs in struct reg""... $ac_c" 1>&6
-echo "configure:7655: checking for r_gs in struct reg" >&5
+echo "configure:7756: checking for r_gs in struct reg" >&5
if eval "test \"`echo '$''{'gdb_cv_struct_reg_r_gs'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 7660 "configure"
+#line 7761 "configure"
#include "confdefs.h"
#include <machine/reg.h>
int main() {
struct reg r; r.r_gs;
; return 0; }
EOF
-if { (eval echo configure:7667: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7768: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
gdb_cv_struct_reg_r_gs=yes
else
@@ -7685,19 +7786,19 @@ fi
# See if <sys/ptrace.h> provides the PTRACE_GETREGS request.
echo $ac_n "checking for PTRACE_GETREGS""... $ac_c" 1>&6
-echo "configure:7689: checking for PTRACE_GETREGS" >&5
+echo "configure:7790: checking for PTRACE_GETREGS" >&5
if eval "test \"`echo '$''{'gdb_cv_have_ptrace_getregs'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 7694 "configure"
+#line 7795 "configure"
#include "confdefs.h"
#include <sys/ptrace.h>
int main() {
PTRACE_GETREGS;
; return 0; }
EOF
-if { (eval echo configure:7701: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7802: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
gdb_cv_have_ptrace_getregs=yes
else
@@ -7719,19 +7820,19 @@ fi
# See if <sys/ptrace.h> provides the PTRACE_GETFPXREGS request.
echo $ac_n "checking for PTRACE_GETFPXREGS""... $ac_c" 1>&6
-echo "configure:7723: checking for PTRACE_GETFPXREGS" >&5
+echo "configure:7824: checking for PTRACE_GETFPXREGS" >&5
if eval "test \"`echo '$''{'gdb_cv_have_ptrace_getfpxregs'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 7728 "configure"
+#line 7829 "configure"
#include "confdefs.h"
#include <sys/ptrace.h>
int main() {
PTRACE_GETFPXREGS;
; return 0; }
EOF
-if { (eval echo configure:7735: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7836: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
gdb_cv_have_ptrace_getfpxregs=yes
else
@@ -7753,12 +7854,12 @@ fi
# See if <sys/ptrace.h> provides the PT_GETDBREGS request.
echo $ac_n "checking for PT_GETDBREGS""... $ac_c" 1>&6
-echo "configure:7757: checking for PT_GETDBREGS" >&5
+echo "configure:7858: checking for PT_GETDBREGS" >&5
if eval "test \"`echo '$''{'gdb_cv_have_pt_getdbregs'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 7762 "configure"
+#line 7863 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/ptrace.h>
@@ -7766,7 +7867,7 @@ int main() {
PT_GETDBREGS;
; return 0; }
EOF
-if { (eval echo configure:7770: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7871: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
gdb_cv_have_pt_getdbregs=yes
else
@@ -7788,12 +7889,12 @@ fi
# See if <sys/ptrace.h> provides the PT_GETXMMREGS request.
echo $ac_n "checking for PT_GETXMMREGS""... $ac_c" 1>&6
-echo "configure:7792: checking for PT_GETXMMREGS" >&5
+echo "configure:7893: checking for PT_GETXMMREGS" >&5
if eval "test \"`echo '$''{'gdb_cv_have_pt_getxmmregs'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 7797 "configure"
+#line 7898 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/ptrace.h>
@@ -7801,7 +7902,7 @@ int main() {
PT_GETXMMREGS;
; return 0; }
EOF
-if { (eval echo configure:7805: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7906: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
gdb_cv_have_pt_getxmmregs=yes
else
@@ -7824,19 +7925,19 @@ fi
# See if stdint.h provides the uintptr_t type.
# Autoconf 2.5X has an improved AC_CHECK_TYPE which will simplify this.
echo $ac_n "checking for uintptr_t in stdint.h""... $ac_c" 1>&6
-echo "configure:7828: checking for uintptr_t in stdint.h" >&5
+echo "configure:7929: checking for uintptr_t in stdint.h" >&5
if eval "test \"`echo '$''{'gdb_cv_have_uintptr_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 7833 "configure"
+#line 7934 "configure"
#include "confdefs.h"
#include <stdint.h>
int main() {
uintptr_t foo = 0;
; return 0; }
EOF
-if { (eval echo configure:7840: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7941: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
gdb_cv_have_uintptr_t=yes
else
@@ -7857,12 +7958,12 @@ EOF
fi
echo $ac_n "checking whether malloc must be declared""... $ac_c" 1>&6
-echo "configure:7861: checking whether malloc must be declared" >&5
+echo "configure:7962: checking whether malloc must be declared" >&5
if eval "test \"`echo '$''{'bfd_cv_decl_needed_malloc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 7866 "configure"
+#line 7967 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -7883,7 +7984,7 @@ int main() {
char *(*pfn) = (char *(*)) malloc
; return 0; }
EOF
-if { (eval echo configure:7887: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7988: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_decl_needed_malloc=no
else
@@ -7904,12 +8005,12 @@ EOF
fi
echo $ac_n "checking whether realloc must be declared""... $ac_c" 1>&6
-echo "configure:7908: checking whether realloc must be declared" >&5
+echo "configure:8009: checking whether realloc must be declared" >&5
if eval "test \"`echo '$''{'bfd_cv_decl_needed_realloc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 7913 "configure"
+#line 8014 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -7930,7 +8031,7 @@ int main() {
char *(*pfn) = (char *(*)) realloc
; return 0; }
EOF
-if { (eval echo configure:7934: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8035: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_decl_needed_realloc=no
else
@@ -7951,12 +8052,12 @@ EOF
fi
echo $ac_n "checking whether free must be declared""... $ac_c" 1>&6
-echo "configure:7955: checking whether free must be declared" >&5
+echo "configure:8056: checking whether free must be declared" >&5
if eval "test \"`echo '$''{'bfd_cv_decl_needed_free'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 7960 "configure"
+#line 8061 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -7977,7 +8078,7 @@ int main() {
char *(*pfn) = (char *(*)) free
; return 0; }
EOF
-if { (eval echo configure:7981: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8082: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_decl_needed_free=no
else
@@ -7998,12 +8099,12 @@ EOF
fi
echo $ac_n "checking whether strerror must be declared""... $ac_c" 1>&6
-echo "configure:8002: checking whether strerror must be declared" >&5
+echo "configure:8103: checking whether strerror must be declared" >&5
if eval "test \"`echo '$''{'bfd_cv_decl_needed_strerror'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8007 "configure"
+#line 8108 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -8024,7 +8125,7 @@ int main() {
char *(*pfn) = (char *(*)) strerror
; return 0; }
EOF
-if { (eval echo configure:8028: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8129: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_decl_needed_strerror=no
else
@@ -8045,12 +8146,12 @@ EOF
fi
echo $ac_n "checking whether strdup must be declared""... $ac_c" 1>&6
-echo "configure:8049: checking whether strdup must be declared" >&5
+echo "configure:8150: checking whether strdup must be declared" >&5
if eval "test \"`echo '$''{'bfd_cv_decl_needed_strdup'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8054 "configure"
+#line 8155 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -8071,7 +8172,7 @@ int main() {
char *(*pfn) = (char *(*)) strdup
; return 0; }
EOF
-if { (eval echo configure:8075: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8176: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_decl_needed_strdup=no
else
@@ -8092,12 +8193,12 @@ EOF
fi
echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6
-echo "configure:8096: checking whether strstr must be declared" >&5
+echo "configure:8197: checking whether strstr must be declared" >&5
if eval "test \"`echo '$''{'bfd_cv_decl_needed_strstr'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8101 "configure"
+#line 8202 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -8118,7 +8219,7 @@ int main() {
char *(*pfn) = (char *(*)) strstr
; return 0; }
EOF
-if { (eval echo configure:8122: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8223: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_decl_needed_strstr=no
else
@@ -8139,12 +8240,12 @@ EOF
fi
echo $ac_n "checking whether canonicalize_file_name must be declared""... $ac_c" 1>&6
-echo "configure:8143: checking whether canonicalize_file_name must be declared" >&5
+echo "configure:8244: checking whether canonicalize_file_name must be declared" >&5
if eval "test \"`echo '$''{'bfd_cv_decl_needed_canonicalize_file_name'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8148 "configure"
+#line 8249 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -8165,7 +8266,7 @@ int main() {
char *(*pfn) = (char *(*)) canonicalize_file_name
; return 0; }
EOF
-if { (eval echo configure:8169: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8270: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_decl_needed_canonicalize_file_name=no
else
@@ -8191,9 +8292,9 @@ fi
# could be expunged. --jsm 1999-03-22
echo $ac_n "checking for HPUX save_state structure""... $ac_c" 1>&6
-echo "configure:8195: checking for HPUX save_state structure" >&5
+echo "configure:8296: checking for HPUX save_state structure" >&5
cat > conftest.$ac_ext <<EOF
-#line 8197 "configure"
+#line 8298 "configure"
#include "confdefs.h"
#include <machine/save_state.h>
EOF
@@ -8208,7 +8309,7 @@ fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 8212 "configure"
+#line 8313 "configure"
#include "confdefs.h"
#include <machine/save_state.h>
EOF
@@ -8285,12 +8386,12 @@ fi
if test "$ac_cv_header_sys_procfs_h" = yes; then
echo $ac_n "checking for pstatus_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:8289: checking for pstatus_t in sys/procfs.h" >&5
+echo "configure:8390: checking for pstatus_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8294 "configure"
+#line 8395 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -8299,7 +8400,7 @@ int main() {
pstatus_t avar
; return 0; }
EOF
-if { (eval echo configure:8303: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8404: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_pstatus_t=yes
else
@@ -8321,12 +8422,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus_t" 1>&6
echo $ac_n "checking for prrun_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:8325: checking for prrun_t in sys/procfs.h" >&5
+echo "configure:8426: checking for prrun_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prrun_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8330 "configure"
+#line 8431 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -8335,7 +8436,7 @@ int main() {
prrun_t avar
; return 0; }
EOF
-if { (eval echo configure:8339: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8440: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_prrun_t=yes
else
@@ -8357,12 +8458,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_prrun_t" 1>&6
echo $ac_n "checking for gregset_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:8361: checking for gregset_t in sys/procfs.h" >&5
+echo "configure:8462: checking for gregset_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_gregset_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8366 "configure"
+#line 8467 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -8371,7 +8472,7 @@ int main() {
gregset_t avar
; return 0; }
EOF
-if { (eval echo configure:8375: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8476: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_gregset_t=yes
else
@@ -8393,12 +8494,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_gregset_t" 1>&6
echo $ac_n "checking for fpregset_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:8397: checking for fpregset_t in sys/procfs.h" >&5
+echo "configure:8498: checking for fpregset_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_fpregset_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8402 "configure"
+#line 8503 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -8407,7 +8508,7 @@ int main() {
fpregset_t avar
; return 0; }
EOF
-if { (eval echo configure:8411: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8512: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_fpregset_t=yes
else
@@ -8429,12 +8530,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_fpregset_t" 1>&6
echo $ac_n "checking for prgregset_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:8433: checking for prgregset_t in sys/procfs.h" >&5
+echo "configure:8534: checking for prgregset_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prgregset_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8438 "configure"
+#line 8539 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -8443,7 +8544,7 @@ int main() {
prgregset_t avar
; return 0; }
EOF
-if { (eval echo configure:8447: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8548: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_prgregset_t=yes
else
@@ -8465,12 +8566,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_prgregset_t" 1>&6
echo $ac_n "checking for prfpregset_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:8469: checking for prfpregset_t in sys/procfs.h" >&5
+echo "configure:8570: checking for prfpregset_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prfpregset_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8474 "configure"
+#line 8575 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -8479,7 +8580,7 @@ int main() {
prfpregset_t avar
; return 0; }
EOF
-if { (eval echo configure:8483: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8584: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_prfpregset_t=yes
else
@@ -8501,12 +8602,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_prfpregset_t" 1>&6
echo $ac_n "checking for prgregset32_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:8505: checking for prgregset32_t in sys/procfs.h" >&5
+echo "configure:8606: checking for prgregset32_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prgregset32_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8510 "configure"
+#line 8611 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -8515,7 +8616,7 @@ int main() {
prgregset32_t avar
; return 0; }
EOF
-if { (eval echo configure:8519: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8620: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_prgregset32_t=yes
else
@@ -8537,12 +8638,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_prgregset32_t" 1>&6
echo $ac_n "checking for prfpregset32_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:8541: checking for prfpregset32_t in sys/procfs.h" >&5
+echo "configure:8642: checking for prfpregset32_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prfpregset32_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8546 "configure"
+#line 8647 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -8551,7 +8652,7 @@ int main() {
prfpregset32_t avar
; return 0; }
EOF
-if { (eval echo configure:8555: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8656: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_prfpregset32_t=yes
else
@@ -8573,12 +8674,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_prfpregset32_t" 1>&6
echo $ac_n "checking for lwpid_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:8577: checking for lwpid_t in sys/procfs.h" >&5
+echo "configure:8678: checking for lwpid_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpid_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8582 "configure"
+#line 8683 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -8587,7 +8688,7 @@ int main() {
lwpid_t avar
; return 0; }
EOF
-if { (eval echo configure:8591: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8692: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_lwpid_t=yes
else
@@ -8609,12 +8710,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpid_t" 1>&6
echo $ac_n "checking for psaddr_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:8613: checking for psaddr_t in sys/procfs.h" >&5
+echo "configure:8714: checking for psaddr_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psaddr_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8618 "configure"
+#line 8719 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -8623,7 +8724,7 @@ int main() {
psaddr_t avar
; return 0; }
EOF
-if { (eval echo configure:8627: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8728: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_psaddr_t=yes
else
@@ -8645,12 +8746,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_psaddr_t" 1>&6
echo $ac_n "checking for prsysent_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:8649: checking for prsysent_t in sys/procfs.h" >&5
+echo "configure:8750: checking for prsysent_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prsysent_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8654 "configure"
+#line 8755 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -8659,7 +8760,7 @@ int main() {
prsysent_t avar
; return 0; }
EOF
-if { (eval echo configure:8663: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8764: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_prsysent_t=yes
else
@@ -8681,12 +8782,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_prsysent_t" 1>&6
echo $ac_n "checking for pr_sigset_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:8685: checking for pr_sigset_t in sys/procfs.h" >&5
+echo "configure:8786: checking for pr_sigset_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pr_sigset_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8690 "configure"
+#line 8791 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -8695,7 +8796,7 @@ int main() {
pr_sigset_t avar
; return 0; }
EOF
-if { (eval echo configure:8699: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8800: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_pr_sigset_t=yes
else
@@ -8717,12 +8818,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_pr_sigset_t" 1>&6
echo $ac_n "checking for pr_sigaction64_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:8721: checking for pr_sigaction64_t in sys/procfs.h" >&5
+echo "configure:8822: checking for pr_sigaction64_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pr_sigaction64_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8726 "configure"
+#line 8827 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -8731,7 +8832,7 @@ int main() {
pr_sigaction64_t avar
; return 0; }
EOF
-if { (eval echo configure:8735: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8836: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_pr_sigaction64_t=yes
else
@@ -8753,12 +8854,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_pr_sigaction64_t" 1>&6
echo $ac_n "checking for pr_siginfo64_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:8757: checking for pr_siginfo64_t in sys/procfs.h" >&5
+echo "configure:8858: checking for pr_siginfo64_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pr_siginfo64_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8762 "configure"
+#line 8863 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -8767,7 +8868,7 @@ int main() {
pr_siginfo64_t avar
; return 0; }
EOF
-if { (eval echo configure:8771: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8872: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_pr_siginfo64_t=yes
else
@@ -8794,7 +8895,7 @@ EOF
if test $bfd_cv_have_sys_procfs_type_prfpregset_t = yes; then
echo $ac_n "checking whether prfpregset_t type is broken""... $ac_c" 1>&6
-echo "configure:8798: checking whether prfpregset_t type is broken" >&5
+echo "configure:8899: checking whether prfpregset_t type is broken" >&5
if eval "test \"`echo '$''{'gdb_cv_prfpregset_t_broken'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8802,7 +8903,7 @@ else
gdb_cv_prfpregset_t_broken=yes
else
cat > conftest.$ac_ext <<EOF
-#line 8806 "configure"
+#line 8907 "configure"
#include "confdefs.h"
#include <sys/procfs.h>
int main ()
@@ -8812,7 +8913,7 @@ else
return 0;
}
EOF
-if { (eval echo configure:8816: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8917: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
gdb_cv_prfpregset_t_broken=no
else
@@ -8837,12 +8938,12 @@ EOF
echo $ac_n "checking for PIOCSET ioctl entry in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:8841: checking for PIOCSET ioctl entry in sys/procfs.h" >&5
+echo "configure:8942: checking for PIOCSET ioctl entry in sys/procfs.h" >&5
if eval "test \"`echo '$''{'gdb_cv_have_procfs_piocset'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8846 "configure"
+#line 8947 "configure"
#include "confdefs.h"
#include <unistd.h>
#include <sys/types.h>
@@ -8855,7 +8956,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:8859: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8960: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
gdb_cv_have_procfs_piocset=yes
else
@@ -8879,19 +8980,19 @@ fi
if test ${host} = ${target} ; then
echo $ac_n "checking for member l_addr in struct link_map""... $ac_c" 1>&6
-echo "configure:8883: checking for member l_addr in struct link_map" >&5
+echo "configure:8984: checking for member l_addr in struct link_map" >&5
if eval "test \"`echo '$''{'gdb_cv_have_struct_link_map_with_l_members'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8888 "configure"
+#line 8989 "configure"
#include "confdefs.h"
#include <link.h>
int main() {
struct link_map lm; (void) lm.l_addr;
; return 0; }
EOF
-if { (eval echo configure:8895: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8996: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
gdb_cv_have_struct_link_map_with_l_members=yes
else
@@ -8913,12 +9014,12 @@ EOF
echo $ac_n "checking for member lm_addr in struct link_map""... $ac_c" 1>&6
-echo "configure:8917: checking for member lm_addr in struct link_map" >&5
+echo "configure:9018: checking for member lm_addr in struct link_map" >&5
if eval "test \"`echo '$''{'gdb_cv_have_struct_link_map_with_lm_members'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8922 "configure"
+#line 9023 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <link.h>
@@ -8926,7 +9027,7 @@ int main() {
struct link_map lm; (void) lm.lm_addr;
; return 0; }
EOF
-if { (eval echo configure:8930: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9031: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
gdb_cv_have_struct_link_map_with_lm_members=yes
else
@@ -8948,12 +9049,12 @@ EOF
echo $ac_n "checking for member som_addr in struct so_map""... $ac_c" 1>&6
-echo "configure:8952: checking for member som_addr in struct so_map" >&5
+echo "configure:9053: checking for member som_addr in struct so_map" >&5
if eval "test \"`echo '$''{'gdb_cv_have_struct_so_map_with_som_members'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8957 "configure"
+#line 9058 "configure"
#include "confdefs.h"
#include <sys/types.h>
#ifdef HAVE_NLIST_H
@@ -8964,7 +9065,7 @@ int main() {
struct so_map lm; (void) lm.som_addr;
; return 0; }
EOF
-if { (eval echo configure:8968: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9069: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
gdb_cv_have_struct_so_map_with_som_members=yes
else
@@ -8986,12 +9087,12 @@ EOF
echo $ac_n "checking for struct link_map32 in sys/link.h""... $ac_c" 1>&6
-echo "configure:8990: checking for struct link_map32 in sys/link.h" >&5
+echo "configure:9091: checking for struct link_map32 in sys/link.h" >&5
if eval "test \"`echo '$''{'gdb_cv_have_struct_link_map32'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8995 "configure"
+#line 9096 "configure"
#include "confdefs.h"
#define _SYSCALL32
#include <sys/link.h>
@@ -8999,7 +9100,7 @@ int main() {
struct link_map32 l;
; return 0; }
EOF
-if { (eval echo configure:9003: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9104: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
gdb_cv_have_struct_link_map32=yes
else
@@ -9026,12 +9127,12 @@ fi
echo $ac_n "checking for long long support in compiler""... $ac_c" 1>&6
-echo "configure:9030: checking for long long support in compiler" >&5
+echo "configure:9131: checking for long long support in compiler" >&5
if eval "test \"`echo '$''{'gdb_cv_c_long_long'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9035 "configure"
+#line 9136 "configure"
#include "confdefs.h"
int main() {
@@ -9041,7 +9142,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:9045: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9146: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
gdb_cv_c_long_long=yes
else
@@ -9063,7 +9164,7 @@ fi
echo $ac_n "checking for long long support in printf""... $ac_c" 1>&6
-echo "configure:9067: checking for long long support in printf" >&5
+echo "configure:9168: checking for long long support in printf" >&5
if eval "test \"`echo '$''{'gdb_cv_printf_has_long_long'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -9071,7 +9172,7 @@ else
gdb_cv_printf_has_long_long=no
else
cat > conftest.$ac_ext <<EOF
-#line 9075 "configure"
+#line 9176 "configure"
#include "confdefs.h"
int main () {
@@ -9085,7 +9186,7 @@ int main () {
return (strcmp ("0x0123456789abcdef", buf));
}
EOF
-if { (eval echo configure:9089: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9190: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
gdb_cv_printf_has_long_long=yes
else
@@ -9109,19 +9210,19 @@ echo "$ac_t""$gdb_cv_printf_has_long_long" 1>&6
echo $ac_n "checking for long double support in compiler""... $ac_c" 1>&6
-echo "configure:9113: checking for long double support in compiler" >&5
+echo "configure:9214: checking for long double support in compiler" >&5
if eval "test \"`echo '$''{'ac_cv_c_long_double'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9118 "configure"
+#line 9219 "configure"
#include "confdefs.h"
int main() {
long double foo;
; return 0; }
EOF
-if { (eval echo configure:9125: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9226: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_long_double=yes
else
@@ -9143,7 +9244,7 @@ fi
echo $ac_n "checking for long double support in printf""... $ac_c" 1>&6
-echo "configure:9147: checking for long double support in printf" >&5
+echo "configure:9248: checking for long double support in printf" >&5
if eval "test \"`echo '$''{'gdb_cv_printf_has_long_double'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -9151,7 +9252,7 @@ else
gdb_cv_printf_has_long_double=no
else
cat > conftest.$ac_ext <<EOF
-#line 9155 "configure"
+#line 9256 "configure"
#include "confdefs.h"
int main () {
@@ -9161,7 +9262,7 @@ int main () {
return (strncmp ("3.14159", buf, 7));
}
EOF
-if { (eval echo configure:9165: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9266: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
gdb_cv_printf_has_long_double=yes
else
@@ -9185,7 +9286,7 @@ echo "$ac_t""$gdb_cv_printf_has_long_double" 1>&6
echo $ac_n "checking for long double support in scanf""... $ac_c" 1>&6
-echo "configure:9189: checking for long double support in scanf" >&5
+echo "configure:9290: checking for long double support in scanf" >&5
if eval "test \"`echo '$''{'gdb_cv_scanf_has_long_double'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -9193,7 +9294,7 @@ else
gdb_cv_scanf_has_long_double=no
else
cat > conftest.$ac_ext <<EOF
-#line 9197 "configure"
+#line 9298 "configure"
#include "confdefs.h"
int main () {
@@ -9203,7 +9304,7 @@ int main () {
return !(f > 3.14159 && f < 3.14160);
}
EOF
-if { (eval echo configure:9207: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9308: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
gdb_cv_scanf_has_long_double=yes
else
@@ -9228,7 +9329,7 @@ echo "$ac_t""$gdb_cv_scanf_has_long_double" 1>&6
case ${host_os} in
aix*)
echo $ac_n "checking for -bbigtoc option""... $ac_c" 1>&6
-echo "configure:9232: checking for -bbigtoc option" >&5
+echo "configure:9333: checking for -bbigtoc option" >&5
if eval "test \"`echo '$''{'gdb_cv_bigtoc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -9242,14 +9343,14 @@ else
LDFLAGS=$LDFLAGS\ $gdb_cv_bigtoc
cat > conftest.$ac_ext <<EOF
-#line 9246 "configure"
+#line 9347 "configure"
#include "confdefs.h"
int main() {
int i;
; return 0; }
EOF
-if { (eval echo configure:9253: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9354: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
:
else
echo "configure: failed program was:" >&5
@@ -9273,7 +9374,7 @@ if test ${build} = ${host} -a ${host} = ${target} ; then
case ${host_os} in
hpux*)
echo $ac_n "checking for HPUX/OSF thread support""... $ac_c" 1>&6
-echo "configure:9277: checking for HPUX/OSF thread support" >&5
+echo "configure:9378: checking for HPUX/OSF thread support" >&5
if test -f /usr/include/dce/cma_config.h ; then
if test "$GCC" = "yes" ; then
echo "$ac_t""yes" 1>&6
@@ -9296,7 +9397,7 @@ EOF
# because version 0 (present on Solaris 2.4 or earlier) doesn't have
# the same API.
echo $ac_n "checking for Solaris thread debugging library""... $ac_c" 1>&6
-echo "configure:9300: checking for Solaris thread debugging library" >&5
+echo "configure:9401: checking for Solaris thread debugging library" >&5
if test -f /usr/lib/libthread_db.so.1 ; then
echo "$ac_t""yes" 1>&6
cat >> confdefs.h <<\EOF
@@ -9306,7 +9407,7 @@ EOF
CONFIG_OBS="${CONFIG_OBS} sol-thread.o"
CONFIG_SRCS="${CONFIG_SRCS} sol-thread.c"
echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:9310: checking for dlopen in -ldl" >&5
+echo "configure:9411: checking for dlopen in -ldl" >&5
ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -9314,7 +9415,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 9318 "configure"
+#line 9419 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -9325,7 +9426,7 @@ int main() {
dlopen()
; return 0; }
EOF
-if { (eval echo configure:9329: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9430: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -9357,17 +9458,17 @@ fi
# all symbols visible in the dynamic symbol table.
hold_ldflags=$LDFLAGS
echo $ac_n "checking for the ld -export-dynamic flag""... $ac_c" 1>&6
-echo "configure:9361: checking for the ld -export-dynamic flag" >&5
+echo "configure:9462: checking for the ld -export-dynamic flag" >&5
LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
cat > conftest.$ac_ext <<EOF
-#line 9364 "configure"
+#line 9465 "configure"
#include "confdefs.h"
int main() {
int i;
; return 0; }
EOF
-if { (eval echo configure:9371: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9472: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
found=yes
else
@@ -9386,13 +9487,13 @@ rm -f conftest*
# Sun randomly tweaked the prototypes in <proc_service.h>
# at one point.
echo $ac_n "checking if <proc_service.h> is old""... $ac_c" 1>&6
-echo "configure:9390: checking if <proc_service.h> is old" >&5
+echo "configure:9491: checking if <proc_service.h> is old" >&5
if eval "test \"`echo '$''{'gdb_cv_proc_service_is_old'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9396 "configure"
+#line 9497 "configure"
#include "confdefs.h"
#include <proc_service.h>
@@ -9403,7 +9504,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:9407: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9508: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
gdb_cv_proc_service_is_old=no
else
@@ -9429,12 +9530,12 @@ EOF
;;
aix*)
echo $ac_n "checking for AiX thread debugging library""... $ac_c" 1>&6
-echo "configure:9433: checking for AiX thread debugging library" >&5
+echo "configure:9534: checking for AiX thread debugging library" >&5
if eval "test \"`echo '$''{'gdb_cv_have_aix_thread_debug'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9438 "configure"
+#line 9539 "configure"
#include "confdefs.h"
#include <sys/pthdebug.h>
int main() {
@@ -9443,7 +9544,7 @@ int main() {
#endif
; return 0; }
EOF
-if { (eval echo configure:9447: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9548: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
gdb_cv_have_aix_thread_debug=yes
else
@@ -9468,19 +9569,19 @@ fi
if test "x$ac_cv_header_thread_db_h" = "xyes"; then
echo $ac_n "checking whether <thread_db.h> has TD_NOTALLOC""... $ac_c" 1>&6
-echo "configure:9472: checking whether <thread_db.h> has TD_NOTALLOC" >&5
+echo "configure:9573: checking whether <thread_db.h> has TD_NOTALLOC" >&5
if eval "test \"`echo '$''{'gdb_cv_thread_db_h_has_td_notalloc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9477 "configure"
+#line 9578 "configure"
#include "confdefs.h"
#include <thread_db.h>
int main() {
int i = TD_NOTALLOC;
; return 0; }
EOF
-if { (eval echo configure:9484: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9585: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
gdb_cv_thread_db_h_has_td_notalloc=yes
else
@@ -9505,19 +9606,19 @@ fi
if test "x$ac_cv_header_sys_syscall_h" = "xyes"; then
echo $ac_n "checking whether <sys/syscall.h> has __NR_tkill""... $ac_c" 1>&6
-echo "configure:9509: checking whether <sys/syscall.h> has __NR_tkill" >&5
+echo "configure:9610: checking whether <sys/syscall.h> has __NR_tkill" >&5
if eval "test \"`echo '$''{'gdb_cv_sys_syscall_h_has_tkill'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9514 "configure"
+#line 9615 "configure"
#include "confdefs.h"
#include <sys/syscall.h>
int main() {
int i = __NR_tkill;
; return 0; }
EOF
-if { (eval echo configure:9521: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9622: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
gdb_cv_sys_syscall_h_has_tkill=yes
else
@@ -9629,7 +9730,7 @@ WERROR_CFLAGS=""
if test "x${build_warnings}" != x -a "x$GCC" = xyes
then
echo $ac_n "checking compiler warning flags""... $ac_c" 1>&6
-echo "configure:9633: checking compiler warning flags" >&5
+echo "configure:9734: checking compiler warning flags" >&5
# Separate out the -Werror flag as some files just cannot be
# compiled with it enabled.
for w in ${build_warnings}; do
@@ -9639,14 +9740,14 @@ echo "configure:9633: checking compiler warning flags" >&5
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $w"
cat > conftest.$ac_ext <<EOF
-#line 9643 "configure"
+#line 9744 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:9650: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9751: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
WARN_CFLAGS="${WARN_CFLAGS} $w"
else
@@ -9664,12 +9765,12 @@ fi
# In the Cygwin environment, we need some additional flags.
echo $ac_n "checking for cygwin""... $ac_c" 1>&6
-echo "configure:9668: checking for cygwin" >&5
+echo "configure:9769: checking for cygwin" >&5
if eval "test \"`echo '$''{'gdb_cv_os_cygwin'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9673 "configure"
+#line 9774 "configure"
#include "confdefs.h"
#if defined (__CYGWIN__) || defined (__CYGWIN32__)
@@ -9754,7 +9855,7 @@ if test "${with_tclconfig+set}" = set; then
fi
echo $ac_n "checking for Tcl configuration""... $ac_c" 1>&6
-echo "configure:9758: checking for Tcl configuration" >&5
+echo "configure:9859: checking for Tcl configuration" >&5
if eval "test \"`echo '$''{'ac_cv_c_tclconfig'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -9863,7 +9964,7 @@ if test "${with_tkconfig+set}" = set; then
fi
echo $ac_n "checking for Tk configuration""... $ac_c" 1>&6
-echo "configure:9867: checking for Tk configuration" >&5
+echo "configure:9968: checking for Tk configuration" >&5
if eval "test \"`echo '$''{'ac_cv_c_tkconfig'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -9965,7 +10066,7 @@ fi
no_tcl=true
echo $ac_n "checking for Tcl private headers. dir=${configdir}""... $ac_c" 1>&6
-echo "configure:9969: checking for Tcl private headers. dir=${configdir}" >&5
+echo "configure:10070: checking for Tcl private headers. dir=${configdir}" >&5
# Check whether --with-tclinclude or --without-tclinclude was given.
if test "${with_tclinclude+set}" = set; then
withval="$with_tclinclude"
@@ -10031,17 +10132,17 @@ fi
if test x"${ac_cv_c_tclh}" = x ; then
ac_safe=`echo "tclInt.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for tclInt.h""... $ac_c" 1>&6
-echo "configure:10035: checking for tclInt.h" >&5
+echo "configure:10136: checking for tclInt.h" >&5
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 10040 "configure"
+#line 10141 "configure"
#include "confdefs.h"
#include <tclInt.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10045: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:10146: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -10101,7 +10202,7 @@ fi
#
no_tk=true
echo $ac_n "checking for Tk private headers""... $ac_c" 1>&6
-echo "configure:10105: checking for Tk private headers" >&5
+echo "configure:10206: checking for Tk private headers" >&5
# Check whether --with-tkinclude or --without-tkinclude was given.
if test "${with_tkinclude+set}" = set; then
withval="$with_tkinclude"
@@ -10167,17 +10268,17 @@ fi
if test x"${ac_cv_c_tkh}" = x ; then
ac_safe=`echo "tk.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for tk.h""... $ac_c" 1>&6
-echo "configure:10171: checking for tk.h" >&5
+echo "configure:10272: checking for tk.h" >&5
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 10176 "configure"
+#line 10277 "configure"
#include "confdefs.h"
#include <tk.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10181: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:10282: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -10223,7 +10324,7 @@ fi
echo $ac_n "checking for Itcl private headers. srcdir=${srcdir}""... $ac_c" 1>&6
-echo "configure:10227: checking for Itcl private headers. srcdir=${srcdir}" >&5
+echo "configure:10328: checking for Itcl private headers. srcdir=${srcdir}" >&5
if test x"${ac_cv_c_itclh}" = x ; then
for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ${srcdir}/../itcl/itcl; do
if test -f $i/generic/itcl.h ; then
@@ -10246,7 +10347,7 @@ fi
echo $ac_n "checking for Itk private headers. srcdir=${srcdir}""... $ac_c" 1>&6
-echo "configure:10250: checking for Itk private headers. srcdir=${srcdir}" >&5
+echo "configure:10351: checking for Itk private headers. srcdir=${srcdir}" >&5
if test x"${ac_cv_c_itkh}" = x ; then
for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ${srcdir}/../itcl/itk; do
if test -f $i/generic/itk.h ; then
@@ -10294,7 +10395,7 @@ if test "${with_itclconfig+set}" = set; then
fi
echo $ac_n "checking for Itcl configuration""... $ac_c" 1>&6
-echo "configure:10298: checking for Itcl configuration" >&5
+echo "configure:10399: checking for Itcl configuration" >&5
if eval "test \"`echo '$''{'ac_cv_c_itclconfig'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -10397,7 +10498,7 @@ if test "${with_itkconfig+set}" = set; then
fi
echo $ac_n "checking for Itk configuration""... $ac_c" 1>&6
-echo "configure:10401: checking for Itk configuration" >&5
+echo "configure:10502: checking for Itk configuration" >&5
if eval "test \"`echo '$''{'ac_cv_c_itkconfig'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -10539,7 +10640,7 @@ fi
# Uses ac_ vars as temps to allow command line to override cache and checks.
# --without-x overrides everything else, but does not touch the cache.
echo $ac_n "checking for X""... $ac_c" 1>&6
-echo "configure:10543: checking for X" >&5
+echo "configure:10644: checking for X" >&5
# Check whether --with-x or --without-x was given.
if test "${with_x+set}" = set; then
@@ -10601,12 +10702,12 @@ if test "$ac_x_includes" = NO; then
# First, try using that file with no special directory specified.
cat > conftest.$ac_ext <<EOF
-#line 10605 "configure"
+#line 10706 "configure"
#include "confdefs.h"
#include <$x_direct_test_include>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10610: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:10711: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -10675,14 +10776,14 @@ if test "$ac_x_libraries" = NO; then
ac_save_LIBS="$LIBS"
LIBS="-l$x_direct_test_library $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 10679 "configure"
+#line 10780 "configure"
#include "confdefs.h"
int main() {
${x_direct_test_function}()
; return 0; }
EOF
-if { (eval echo configure:10686: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10787: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
LIBS="$ac_save_LIBS"
# We can link X programs with no special library path.
@@ -10769,26 +10870,7 @@ else
fi
-# Check whether we should enable the TUI, but only do so if we really
-# can.
-if test x"$enable_tui" = xyes; then
- if test -d $srcdir/tui; then
- if test "$ac_cv_search_waddstr" != no; then
- CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_TUI_OBS)"
- CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_TUI_DEPS)"
- CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_TUI_SRCS)"
- CONFIG_INITS="$CONFIG_INITS \$(SUBDIR_TUI_INITS)"
- ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_TUI_CFLAGS)"
- CONFIG_ALL="${CONFIG_ALL} all-tui"
- CONFIG_CLEAN="${CONFIG_CLEAN} clean-tui"
- CONFIG_INSTALL="${CONFIG_INSTALL} install-tui"
- CONFIG_UNINSTALL="${CONFIG_UNINSTALL} uninstall-tui"
- else
- echo "configure: warning: no enhanced curses library found; disabling TUI" 1>&2
- fi
- fi
-fi
-
+
# Unlike the sim directory, whether a simulator is linked is controlled by
# presence of a SIM= and a SIM_OBS= definition in the target '.mt' file.
# This code just checks for a few cases where we'd like to ignore those
@@ -10862,19 +10944,22 @@ fi
frags=
-if test "${target}" = "${host}"; then
- host_makefile_frag=${srcdir}/config/${gdb_host_cpu}/${gdb_host}.mh
- if test ! -f ${host_makefile_frag}; then
- { echo "configure: error: "*** Gdb does not support native target ${host}"" 1>&2; exit 1; }
- fi
- frags="$frags $host_makefile_frag"
-else
- host_makefile_frag=/dev/null
+host_makefile_frag=${srcdir}/config/${gdb_host_cpu}/${gdb_host}.mh
+if test ! -f ${host_makefile_frag}; then
+ # When building a native debuger the .mh file containing things
+ # like NATDEPFILES is needed. Cross debuggers don't need .mh
+ # since it no longer contains anything useful.
+ if test "${target}" = "${host}"; then
+ { echo "configure: error: "*** Gdb does not support native target ${host}"" 1>&2; exit 1; }
+ else
+ host_makefile_frag=/dev/null
+ fi
fi
+frags="$frags $host_makefile_frag"
target_makefile_frag=${srcdir}/config/${gdb_target_cpu}/${gdb_target}.mt
if test ! -f ${target_makefile_frag}; then
- { echo "configure: error: "*** Gdb does not support target ${target}"" 1>&2; exit 1; }
+{ echo "configure: error: "*** Gdb does not support target ${target}"" 1>&2; exit 1; }
fi
frags="$frags $target_makefile_frag"
@@ -10924,7 +11009,7 @@ fi
# We only build gdbserver automatically if host and target are the same.
if test "x$target" = "x$host"; then
echo $ac_n "checking whether gdbserver is supported on this host""... $ac_c" 1>&6
-echo "configure:10928: checking whether gdbserver is supported on this host" >&5
+echo "configure:11013: checking whether gdbserver is supported on this host" >&5
if test "x$build_gdbserver" = xyes; then
configdirs="$configdirs gdbserver"
echo "$ac_t""yes" 1>&6
@@ -10997,12 +11082,12 @@ fi
echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:11001: checking for Cygwin environment" >&5
+echo "configure:11086: checking for Cygwin environment" >&5
if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 11006 "configure"
+#line 11091 "configure"
#include "confdefs.h"
int main() {
@@ -11013,7 +11098,7 @@ int main() {
return __CYGWIN__;
; return 0; }
EOF
-if { (eval echo configure:11017: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:11102: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_cygwin=yes
else
@@ -11030,19 +11115,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6
CYGWIN=
test "$ac_cv_cygwin" = yes && CYGWIN=yes
echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
-echo "configure:11034: checking for mingw32 environment" >&5
+echo "configure:11119: checking for mingw32 environment" >&5
if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 11039 "configure"
+#line 11124 "configure"
#include "confdefs.h"
int main() {
return __MINGW32__;
; return 0; }
EOF
-if { (eval echo configure:11046: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:11131: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_mingw32=yes
else
@@ -11061,7 +11146,7 @@ test "$ac_cv_mingw32" = yes && MINGW32=yes
echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:11065: checking for executable suffix" >&5
+echo "configure:11150: checking for executable suffix" >&5
if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -11071,10 +11156,10 @@ else
rm -f conftest*
echo 'int main () { return 0; }' > conftest.$ac_ext
ac_cv_exeext=
- if { (eval echo configure:11075: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ if { (eval echo configure:11160: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
for file in conftest.*; do
case $file in
- *.c | *.C | *.o | *.obj | *.ilk | *.pdb) ;;
+ *.c | *.o | *.obj | *.ilk | *.pdb) ;;
*) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
esac
done
@@ -11113,7 +11198,7 @@ fi
echo $ac_n "checking for iconv""... $ac_c" 1>&6
-echo "configure:11117: checking for iconv" >&5
+echo "configure:11202: checking for iconv" >&5
if eval "test \"`echo '$''{'am_cv_func_iconv'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -11121,7 +11206,7 @@ else
am_cv_func_iconv="no, consider installing GNU libiconv"
am_cv_lib_iconv=no
cat > conftest.$ac_ext <<EOF
-#line 11125 "configure"
+#line 11210 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <iconv.h>
@@ -11131,7 +11216,7 @@ iconv_t cd = iconv_open("","");
iconv_close(cd);
; return 0; }
EOF
-if { (eval echo configure:11135: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11220: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
am_cv_func_iconv=yes
else
@@ -11143,7 +11228,7 @@ rm -f conftest*
am_save_LIBS="$LIBS"
LIBS="$LIBS -liconv"
cat > conftest.$ac_ext <<EOF
-#line 11147 "configure"
+#line 11232 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <iconv.h>
@@ -11153,7 +11238,7 @@ iconv_t cd = iconv_open("","");
iconv_close(cd);
; return 0; }
EOF
-if { (eval echo configure:11157: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11242: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
am_cv_lib_iconv=yes
am_cv_func_iconv=yes
@@ -11174,13 +11259,13 @@ echo "$ac_t""$am_cv_func_iconv" 1>&6
EOF
echo $ac_n "checking for iconv declaration""... $ac_c" 1>&6
-echo "configure:11178: checking for iconv declaration" >&5
+echo "configure:11263: checking for iconv declaration" >&5
if eval "test \"`echo '$''{'am_cv_proto_iconv'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 11184 "configure"
+#line 11269 "configure"
#include "confdefs.h"
#include <stdlib.h>
@@ -11199,7 +11284,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:11203: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:11288: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
am_cv_proto_iconv_arg1=""
else
@@ -11761,6 +11846,14 @@ nativefile=$nativefile
EOF
cat >> $CONFIG_STATUS <<\EOF
+if test "${nativefile}" = ""; then
+ < Makefile \
+ sed -e '/^NATDEPFILES[ ]*=.*\\$/,/[^\\]$/s/^/# /' \
+ -e '/^NATDEPFILES[ ]*=/s/^/# /' \
+ | sed -e '/^\(NATDEPFILES[ ]*[+]=[ ]*\)/s//# \1/' \
+ > Makefile.tem
+mv -f Makefile.tem Makefile
+fi
sed -e '/^DEPRECATED_TM_FILE[ ]*=/s,^DEPRECATED_TM_FILE[ ]*=[ ]*,&config/'"${gdb_target_cpu}"'/,
/^XM_FILE[ ]*=/s,^XM_FILE[ ]*=[ ]*,&config/'"${gdb_host_cpu}"'/,
diff --git a/gdb/configure.in b/gdb/configure.in
index fad4362..81be74b 100644
--- a/gdb/configure.in
+++ b/gdb/configure.in
@@ -193,6 +193,21 @@ AC_ARG_ENABLE(tui,
*)
AC_MSG_ERROR([bad value $enableval for --enable-tui]) ;;
esac],enable_tui=yes)
+if test x"$enable_tui" = xyes; then
+ if test -d $srcdir/tui; then
+ if test "$ac_cv_search_initscr" != no -a "$ac_cv_search_wborder" != no; then
+ CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_TUI_OBS)"
+ CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_TUI_DEPS)"
+ CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_TUI_SRCS)"
+ CONFIG_INITS="$CONFIG_INITS \$(SUBDIR_TUI_INITS)"
+ ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_TUI_CFLAGS)"
+ CONFIG_ALL="${CONFIG_ALL} all-tui"
+ CONFIG_CLEAN="${CONFIG_CLEAN} clean-tui"
+ CONFIG_INSTALL="${CONFIG_INSTALL} install-tui"
+ CONFIG_UNINSTALL="${CONFIG_UNINSTALL} uninstall-tui"
+ fi
+ fi
+fi
# Enable gdbtk.
AC_ARG_ENABLE(gdbtk,
@@ -317,20 +332,9 @@ AC_SEARCH_LIBS(gethostbyname, nsl)
# Some systems (e.g. Solaris) have `socketpair' in libsocket.
AC_SEARCH_LIBS(socketpair, socket)
-# For the TUI, we need enhanced curses functionality.
-#
-# FIXME: kettenis/20040905: We prefer ncurses over the vendor-supplied
-# curses library because the latter might not provide all the
-# functionality we need. However, this leads to problems on systems
-# where the linker searches /usr/local/lib, but the compiler doesn't
-# search /usr/local/include, if ncurses is installed in /usr/local. A
-# default installation of ncurses on alpha*-dec-osf* will lead to such
-# a situation.
-AC_SEARCH_LIBS(waddstr, [ncurses cursesX curses])
-
-# Since GDB uses Readline, we need termcap functionality. In many
-# cases this will be provided by the curses library, but some systems
-# have a seperate termcap library, or no curses library at all.
+# Since GDB uses Readline, we need termcap functionality, so we need
+# to find a library that provides that. When GDB is configured with
+# the TUI, we need full curses functionality.
case $host_os in
cygwin*)
@@ -341,15 +345,47 @@ case $host_os in
go32* | *djgpp*)
ac_cv_search_tgetent="none required"
;;
+ aix*)
+ # Readline prefers curses over termcap on AIX.
+ # ??? Why?
+ AC_SEARCH_LIBS(tgetent, [tinfo ncurses curses termcap])
+ ;;
esac
-# These are the libraries checked by Readline.
-AC_SEARCH_LIBS(tgetent, [termcap tinfo curses ncurses])
+# Note: We used to check for libtermlib and libterminfo too, but
+# Readline doesn't, so I think we're safe with leaving them out.
+AC_SEARCH_LIBS(tgetent, [termcap tinfo ncurses Hcurses curses])
if test "$ac_cv_search_tgetent" = no; then
AC_MSG_ERROR([no termcap library found])
fi
+# FIXME: kettenis/20030102: We seem to prefer HP curses (Hcurses) over
+# Xcurses on HP-UX; see the `-D__HP_CURSES' in the relevant host
+# Makefile fragments. That's why we need to have `Hcurses' before
+# `curses'. I don't see why we should use HP curses if a more
+# standard curses is available, except that according to HP's
+# documentation one needs to compile `-D_XOPEN_SOURCE_EXTENDED' on
+# HP-UX 10.10 and 10.20.
+
+# FIXME: ncurses does not work on native alphaev68-dec-osf5.1,
+# and probably other platforms. AC_SEARCH_LIBS finds the library
+# in a place such as /usr/local/lib/libncurses.a, but does not
+# do anything to look for the matching include files.
+# -- chastain 2004-05-01
+
+AC_SEARCH_LIBS(initscr, [ncurses Hcurses cursesX curses pdcurses], [],
+ [AC_MSG_WARN([no curses library found])])
+
+# Check whether the wborder function is provided by the curses
+# library detected above. In certain implementations such as
+# the HP/UX Hcurses for instance, this function is provided by an
+# additional library. So if we did not find this function inside
+# the curses library, try some alternate libraries we know might
+# provide it.
+AC_SEARCH_LIBS(wborder, [cur_colr], [],
+ [AC_MSG_WARN([wborder function not found, tui will be disabled])])
+
# ------------------------- #
# Checks for header files. #
# ------------------------- #
@@ -448,7 +484,6 @@ AC_CHECK_FUNCS(sigaction sigprocmask sigsetmask)
AC_CHECK_FUNCS(socketpair)
AC_CHECK_FUNCS(syscall)
AC_CHECK_FUNCS(ttrace)
-AC_CHECK_FUNCS(wborder)
# Check the return and argument types of ptrace. No canned test for
# this, so roll our own.
@@ -1345,26 +1380,7 @@ AC_SUBST(GDBTK_SRC_DIR)
AC_PATH_X
-# Check whether we should enable the TUI, but only do so if we really
-# can.
-if test x"$enable_tui" = xyes; then
- if test -d $srcdir/tui; then
- if test "$ac_cv_search_waddstr" != no; then
- CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_TUI_OBS)"
- CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_TUI_DEPS)"
- CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_TUI_SRCS)"
- CONFIG_INITS="$CONFIG_INITS \$(SUBDIR_TUI_INITS)"
- ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_TUI_CFLAGS)"
- CONFIG_ALL="${CONFIG_ALL} all-tui"
- CONFIG_CLEAN="${CONFIG_CLEAN} clean-tui"
- CONFIG_INSTALL="${CONFIG_INSTALL} install-tui"
- CONFIG_UNINSTALL="${CONFIG_UNINSTALL} uninstall-tui"
- else
- AC_MSG_WARN([no enhanced curses library found; disabling TUI])
- fi
- fi
-fi
-
+
# Unlike the sim directory, whether a simulator is linked is controlled by
# presence of a SIM= and a SIM_OBS= definition in the target '.mt' file.
# This code just checks for a few cases where we'd like to ignore those
@@ -1422,19 +1438,22 @@ fi
AC_SUBST(target_subdir)
frags=
-if test "${target}" = "${host}"; then
- host_makefile_frag=${srcdir}/config/${gdb_host_cpu}/${gdb_host}.mh
- if test ! -f ${host_makefile_frag}; then
- AC_MSG_ERROR("*** Gdb does not support native target ${host}")
- fi
- frags="$frags $host_makefile_frag"
-else
- host_makefile_frag=/dev/null
+host_makefile_frag=${srcdir}/config/${gdb_host_cpu}/${gdb_host}.mh
+if test ! -f ${host_makefile_frag}; then
+ # When building a native debuger the .mh file containing things
+ # like NATDEPFILES is needed. Cross debuggers don't need .mh
+ # since it no longer contains anything useful.
+ if test "${target}" = "${host}"; then
+ AC_MSG_ERROR("*** Gdb does not support native target ${host}")
+ else
+ host_makefile_frag=/dev/null
+ fi
fi
+frags="$frags $host_makefile_frag"
target_makefile_frag=${srcdir}/config/${gdb_target_cpu}/${gdb_target}.mt
if test ! -f ${target_makefile_frag}; then
- AC_MSG_ERROR("*** Gdb does not support target ${target}")
+AC_MSG_ERROR("*** Gdb does not support target ${target}")
fi
frags="$frags $target_makefile_frag"
@@ -1561,6 +1580,14 @@ AC_OUTPUT(Makefile .gdbinit:gdbinit.in,
dnl Autoconf doesn't provide a mechanism for modifying definitions
dnl provided by makefile fragments.
dnl
+if test "${nativefile}" = ""; then
+ < Makefile \
+ sed -e '/^NATDEPFILES[[ ]]*=.*\\$/,/[[^\\]]$/s/^/# /' \
+ -e '/^NATDEPFILES[[ ]]*=/s/^/# /' \
+ | sed -e '/^\(NATDEPFILES[[ ]]*[[+]]=[[ ]]*\)/s//# \1/' \
+ > Makefile.tem
+mv -f Makefile.tem Makefile
+fi
changequote(,)dnl
sed -e '/^DEPRECATED_TM_FILE[ ]*=/s,^DEPRECATED_TM_FILE[ ]*=[ ]*,&config/'"${gdb_target_cpu}"'/,
diff --git a/gdb/configure.tgt b/gdb/configure.tgt
index 0b1f627..a7c14d8 100644
--- a/gdb/configure.tgt
+++ b/gdb/configure.tgt
@@ -106,8 +106,7 @@ ia64-*-linux*) gdb_target=linux
;;
ia64*-*-*) gdb_target=ia64 ;;
-m32r*-*-linux*) gdb_target=linux ;;
-m32r*-*-*) gdb_target=m32r ;;
+m32r-*-*) gdb_target=m32r ;;
m68hc11*-*-*|m6811*-*-*) gdb_target=m68hc11 ;;
@@ -188,7 +187,9 @@ sparc-*-netbsd* | sparc-*-knetbsd*-gnu)
sparc64-*-netbsd* | sparc64-*-knetbsd*-gnu)
gdb_target=nbsd64 ;;
sparc-*-openbsd*) gdb_target=obsd ;;
-sparc64-*-openbsd*) gdb_target=obsd64 ;;
+sparc64-*-openbsd*) gdb_target=obsd64
+ gdb_osabi=GDB_OSABI_OPENBSD_ELF
+ ;;
sparc-*-solaris2.[0-6] | sparc-*-solaris2.[0-6].*)
gdb_target=sol2
;;
@@ -219,7 +220,9 @@ x86_64-*-linux*) gdb_target=linux64
;;
x86_64-*-netbsd* | x86_64-*-knetbsd*-gnu)
gdb_target=nbsd64 ;;
-x86_64-*-openbsd*) gdb_target=obsd64 ;;
+x86_64-*-openbsd*) gdb_target=obsd64
+ gdb_osabi=GDB_OSABI_OPENBSD_ELF
+ ;;
esac
@@ -228,8 +231,6 @@ esac
case "${target}" in
*-*-linux*) gdb_osabi=GDB_OSABI_LINUX ;;
*-*-nto*) gdb_osabi=GDB_OSABI_QNXNTO ;;
-m68*-*-openbsd* | m88*-*-openbsd* | vax-*-openbsd*) ;;
-*-*-openbsd*) gdb_osabi=GDB_OSABI_OPENBSD_ELF ;;
*-*-solaris*) gdb_osabi=GDB_OSABI_SOLARIS ;;
*-*-*-gnu*) ;; # prevent non-GNU kernels to match the Hurd rule below
*-*-gnu*) gdb_osabi=GDB_OSABI_HURD ;;
diff --git a/gdb/corelow.c b/gdb/corelow.c
index f91ec59..a9d2132 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -538,11 +538,11 @@ core_xfer_partial (struct target_ops *ops, enum target_object object,
{
case TARGET_OBJECT_MEMORY:
if (readbuf)
- return (*ops->deprecated_xfer_memory) (offset, readbuf, len,
- 0/*write*/, NULL, ops);
+ return (*ops->to_xfer_memory) (offset, readbuf, len, 0/*write*/,
+ NULL, ops);
if (writebuf)
- return (*ops->deprecated_xfer_memory) (offset, readbuf, len,
- 1/*write*/, NULL, ops);
+ return (*ops->to_xfer_memory) (offset, readbuf, len, 1/*write*/,
+ NULL, ops);
return -1;
case TARGET_OBJECT_AUXV:
@@ -655,7 +655,7 @@ init_core_ops (void)
core_ops.to_detach = core_detach;
core_ops.to_fetch_registers = get_core_registers;
core_ops.to_xfer_partial = core_xfer_partial;
- core_ops.deprecated_xfer_memory = xfer_memory;
+ core_ops.to_xfer_memory = xfer_memory;
core_ops.to_files_info = core_files_info;
core_ops.to_insert_breakpoint = ignore;
core_ops.to_remove_breakpoint = ignore;
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index 64f1e5f..1cb0d52 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -42,11 +42,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* To get entry_point_address. */
#include "objfiles.h"
-#include "solib.h" /* Support for shared libraries. */
+#include "solib.h" /* Support for shared libraries. */
#include "solib-svr4.h" /* For struct link_map_offsets. */
#include "gdb_string.h"
#include "dis-asm.h"
+
enum cris_num_regs
{
/* There are no floating point registers. Used in gdbserver low-linux.c. */
@@ -107,19 +108,32 @@ extern const struct cris_spec_reg cris_spec_regs[];
/* CRIS version, set via the user command 'set cris-version'. Affects
register names and sizes.*/
-static unsigned int usr_cmd_cris_version;
+static int usr_cmd_cris_version;
/* Indicates whether to trust the above variable. */
static int usr_cmd_cris_version_valid = 0;
-/* Whether to make use of Dwarf-2 CFI (default on). */
-static int usr_cmd_cris_dwarf2_cfi = 1;
+/* CRIS mode, set via the user command 'set cris-mode'. Affects availability
+ of some registers. */
+static const char *usr_cmd_cris_mode;
+
+/* Indicates whether to trust the above variable. */
+static int usr_cmd_cris_mode_valid = 0;
+
+static const char CRIS_MODE_USER[] = "CRIS_MODE_USER";
+static const char CRIS_MODE_SUPERVISOR[] = "CRIS_MODE_SUPERVISOR";
+static const char *cris_mode_enums[] =
+{
+ CRIS_MODE_USER,
+ CRIS_MODE_SUPERVISOR,
+ 0
+};
/* CRIS architecture specific information. */
struct gdbarch_tdep
{
- unsigned int cris_version;
- int cris_dwarf2_cfi;
+ int cris_version;
+ const char *cris_mode;
};
/* Functions for accessing target dependent data. */
@@ -130,121 +144,10 @@ cris_version (void)
return (gdbarch_tdep (current_gdbarch)->cris_version);
}
-/* Sigtramp identification code copied from i386-linux-tdep.c. */
-
-#define SIGTRAMP_INSN0 0x9c5f /* movu.w 0xXX, $r9 */
-#define SIGTRAMP_OFFSET0 0
-#define SIGTRAMP_INSN1 0xe93d /* break 13 */
-#define SIGTRAMP_OFFSET1 4
-
-static const unsigned short sigtramp_code[] =
-{
- SIGTRAMP_INSN0, 0x0077, /* movu.w $0x77, $r9 */
- SIGTRAMP_INSN1 /* break 13 */
-};
-
-#define SIGTRAMP_LEN (sizeof sigtramp_code)
-
-/* Note: same length as normal sigtramp code. */
-
-static const unsigned short rt_sigtramp_code[] =
-{
- SIGTRAMP_INSN0, 0x00ad, /* movu.w $0xad, $r9 */
- SIGTRAMP_INSN1 /* break 13 */
-};
-
-/* If PC is in a sigtramp routine, return the address of the start of
- the routine. Otherwise, return 0. */
-
-static CORE_ADDR
-cris_sigtramp_start (struct frame_info *next_frame)
-{
- CORE_ADDR pc = frame_pc_unwind (next_frame);
- unsigned short buf[SIGTRAMP_LEN];
-
- if (!safe_frame_unwind_memory (next_frame, pc, buf, SIGTRAMP_LEN))
- return 0;
-
- if (buf[0] != SIGTRAMP_INSN0)
- {
- if (buf[0] != SIGTRAMP_INSN1)
- return 0;
-
- pc -= SIGTRAMP_OFFSET1;
- if (!safe_frame_unwind_memory (next_frame, pc, buf, SIGTRAMP_LEN))
- return 0;
- }
-
- if (memcmp (buf, sigtramp_code, SIGTRAMP_LEN) != 0)
- return 0;
-
- return pc;
-}
-
-/* If PC is in a RT sigtramp routine, return the address of the start of
- the routine. Otherwise, return 0. */
-
-static CORE_ADDR
-cris_rt_sigtramp_start (struct frame_info *next_frame)
-{
- CORE_ADDR pc = frame_pc_unwind (next_frame);
- unsigned short buf[SIGTRAMP_LEN];
-
- if (!safe_frame_unwind_memory (next_frame, pc, buf, SIGTRAMP_LEN))
- return 0;
-
- if (buf[0] != SIGTRAMP_INSN0)
- {
- if (buf[0] != SIGTRAMP_INSN1)
- return 0;
-
- pc -= SIGTRAMP_OFFSET1;
- if (!safe_frame_unwind_memory (next_frame, pc, buf, SIGTRAMP_LEN))
- return 0;
- }
-
- if (memcmp (buf, rt_sigtramp_code, SIGTRAMP_LEN) != 0)
- return 0;
-
- return pc;
-}
-
-/* Assuming NEXT_FRAME is a frame following a GNU/Linux sigtramp
- routine, return the address of the associated sigcontext structure. */
-
-static CORE_ADDR
-cris_sigcontext_addr (struct frame_info *next_frame)
+static const char *
+cris_mode (void)
{
- CORE_ADDR pc;
- CORE_ADDR sp;
- char buf[4];
-
- frame_unwind_register (next_frame, SP_REGNUM, buf);
- sp = extract_unsigned_integer (buf, 4);
-
- /* Look for normal sigtramp frame first. */
- pc = cris_sigtramp_start (next_frame);
- if (pc)
- {
- /* struct signal_frame (arch/cris/kernel/signal.c) contains
- struct sigcontext as its first member, meaning the SP points to
- it already. */
- return sp;
- }
-
- pc = cris_rt_sigtramp_start (next_frame);
- if (pc)
- {
- /* struct rt_signal_frame (arch/cris/kernel/signal.c) contains
- a struct ucontext, which in turn contains a struct sigcontext.
- Magic digging:
- 4 + 4 + 128 to struct ucontext, then
- 4 + 4 + 12 to struct sigcontext. */
- return (sp + 156);
- }
-
- error ("Couldn't recognize signal trampoline.");
- return 0;
+ return (gdbarch_tdep (current_gdbarch)->cris_mode);
}
struct cris_unwind_cache
@@ -270,111 +173,6 @@ struct cris_unwind_cache
struct trad_frame_saved_reg *saved_regs;
};
-static struct cris_unwind_cache *
-cris_sigtramp_frame_unwind_cache (struct frame_info *next_frame,
- void **this_cache)
-{
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
- struct cris_unwind_cache *info;
- CORE_ADDR pc;
- CORE_ADDR sp;
- CORE_ADDR addr;
- char buf[4];
- int i;
-
- if ((*this_cache))
- return (*this_cache);
-
- info = FRAME_OBSTACK_ZALLOC (struct cris_unwind_cache);
- (*this_cache) = info;
- info->saved_regs = trad_frame_alloc_saved_regs (next_frame);
-
- /* Zero all fields. */
- info->prev_sp = 0;
- info->base = 0;
- info->size = 0;
- info->sp_offset = 0;
- info->r8_offset = 0;
- info->uses_frame = 0;
- info->return_pc = 0;
- info->leaf_function = 0;
-
- frame_unwind_register (next_frame, SP_REGNUM, buf);
- info->base = extract_unsigned_integer (buf, 4);
-
- addr = cris_sigcontext_addr (next_frame);
-
- /* Layout of the sigcontext struct:
- struct sigcontext {
- struct pt_regs regs;
- unsigned long oldmask;
- unsigned long usp;
- }; */
-
- /* R0 to R13 are stored in reverse order at offset (2 * 4) in
- struct pt_regs. */
- for (i = 0; i <= 13; i++)
- info->saved_regs[i].addr = addr + ((15 - i) * 4);
-
- info->saved_regs[MOF_REGNUM].addr = addr + (16 * 4);
- info->saved_regs[DCCR_REGNUM].addr = addr + (17 * 4);
- info->saved_regs[SRP_REGNUM].addr = addr + (18 * 4);
- /* Note: IRP is off by 2 at this point. There's no point in correcting it
- though since that will mean that the backtrace will show a PC different
- from what is shown when stopped. */
- info->saved_regs[IRP_REGNUM].addr = addr + (19 * 4);
- info->saved_regs[PC_REGNUM] = info->saved_regs[IRP_REGNUM];
- info->saved_regs[SP_REGNUM].addr = addr + (24 * 4);
-
- return info;
-}
-
-static void
-cris_sigtramp_frame_this_id (struct frame_info *next_frame, void **this_cache,
- struct frame_id *this_id)
-{
- struct cris_unwind_cache *cache =
- cris_sigtramp_frame_unwind_cache (next_frame, this_cache);
- (*this_id) = frame_id_build (cache->base, frame_pc_unwind (next_frame));
-}
-
-/* Forward declaration. */
-
-static void cris_frame_prev_register (struct frame_info *next_frame,
- void **this_prologue_cache,
- int regnum, int *optimizedp,
- enum lval_type *lvalp, CORE_ADDR *addrp,
- int *realnump, void *bufferp);
-static void
-cris_sigtramp_frame_prev_register (struct frame_info *next_frame,
- void **this_cache,
- int regnum, int *optimizedp,
- enum lval_type *lvalp, CORE_ADDR *addrp,
- int *realnump, void *valuep)
-{
- /* Make sure we've initialized the cache. */
- cris_sigtramp_frame_unwind_cache (next_frame, this_cache);
- cris_frame_prev_register (next_frame, this_cache, regnum,
- optimizedp, lvalp, addrp, realnump, valuep);
-}
-
-static const struct frame_unwind cris_sigtramp_frame_unwind =
-{
- SIGTRAMP_FRAME,
- cris_sigtramp_frame_this_id,
- cris_sigtramp_frame_prev_register
-};
-
-static const struct frame_unwind *
-cris_sigtramp_frame_sniffer (struct frame_info *next_frame)
-{
- if (cris_sigtramp_start (next_frame)
- || cris_rt_sigtramp_start (next_frame))
- return &cris_sigtramp_frame_unwind;
-
- return NULL;
-}
-
/* The instruction environment needed to find single-step breakpoints. */
typedef
struct instruction_environment
@@ -547,11 +345,11 @@ static struct gdbarch *cris_gdbarch_init (struct gdbarch_info,
static void cris_dump_tdep (struct gdbarch *, struct ui_file *);
-static void set_cris_version (char *ignore_args, int from_tty,
- struct cmd_list_element *c);
+static void cris_version_update (char *ignore_args, int from_tty,
+ struct cmd_list_element *c);
-static void set_cris_dwarf2_cfi (char *ignore_args, int from_tty,
- struct cmd_list_element *c);
+static void cris_mode_update (char *ignore_args, int from_tty,
+ struct cmd_list_element *c);
static CORE_ADDR cris_scan_prologue (CORE_ADDR pc,
struct frame_info *next_frame,
@@ -564,8 +362,9 @@ static CORE_ADDR cris_unwind_sp (struct gdbarch *gdbarch,
struct frame_info *next_frame);
/* When arguments must be pushed onto the stack, they go on in reverse
- order. The below implements a FILO (stack) to do this.
- Copied from d10v-tdep.c. */
+ order. The below implements a FILO (stack) to do this. */
+
+/* Borrowed from d10v-tdep.c. */
struct stack_item
{
@@ -600,7 +399,7 @@ pop_stack_item (struct stack_item *si)
the saved registers of frame described by FRAME_INFO. This
includes special registers such as pc and fp saved in special ways
in the stack frame. sp is even more special: the address we return
- for it IS the sp for the next frame. */
+ for it IS the sp for the next frame. */
struct cris_unwind_cache *
cris_frame_unwind_cache (struct frame_info *next_frame,
@@ -732,7 +531,7 @@ cris_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct stack_item *si = NULL;
- /* Push the return address. */
+ /* Push the return address. */
regcache_cooked_write_unsigned (regcache, SRP_REGNUM, bp_addr);
/* Are we returning a value using a structure return or a normal value
@@ -968,7 +767,7 @@ cris_scan_prologue (CORE_ADDR pc, struct frame_info *next_frame,
limit = next_frame ? frame_pc_unwind (next_frame) : pc + 64;
/* Find the prologue instructions. */
- while (pc > 0 && pc < limit)
+ while (pc < limit)
{
insn = read_memory_unsigned_integer (pc, 2);
pc += 2;
@@ -1370,8 +1169,13 @@ cris_cannot_store_register (int regno)
/* Writing has no effect. */
return 1;
- /* IBR, BAR, BRP and IRP are read-only in user mode. Let the debug
- agent decide whether they are writable. */
+ else if (cris_mode () == CRIS_MODE_USER)
+ {
+ if (regno == IBR_REGNUM || regno == BAR_REGNUM || regno == BRP_REGNUM
+ || regno == IRP_REGNUM)
+ /* Read-only in user mode. */
+ return 1;
+ }
return 0;
}
@@ -1398,7 +1202,7 @@ cris_register_offset (int regno)
}
else
{
- /* Invalid register. */
+ /* Invalid register. */
return -1;
}
}
@@ -1409,21 +1213,33 @@ cris_register_offset (int regno)
static struct type *
cris_register_type (struct gdbarch *gdbarch, int regno)
{
- if (regno == PC_REGNUM)
- return builtin_type_void_func_ptr;
- else if (regno == SP_REGNUM || regno == CRIS_FP_REGNUM)
- return builtin_type_void_data_ptr;
- else if ((regno >= 0 && regno < SP_REGNUM)
- || (regno >= MOF_REGNUM && regno <= USP_REGNUM))
- /* Note: R8 taken care of previous clause. */
- return builtin_type_uint32;
- else if (regno >= P4_REGNUM && regno <= CCR_REGNUM)
- return builtin_type_uint16;
- else if (regno >= P0_REGNUM && regno <= VR_REGNUM)
- return builtin_type_uint8;
+ if (regno == SP_REGNUM || regno == PC_REGNUM
+ || (regno > P8_REGNUM && regno < USP_REGNUM))
+ {
+ /* SP, PC, IBR, IRP, SRP, BAR, DCCR, BRP */
+ return lookup_pointer_type (builtin_type_void);
+ }
+ else if (regno == P8_REGNUM || regno == USP_REGNUM
+ || (regno >= 0 && regno < SP_REGNUM))
+ {
+ /* R0 - R13, P8, P15 */
+ return builtin_type_unsigned_long;
+ }
+ else if (regno > P3_REGNUM && regno < P8_REGNUM)
+ {
+ /* P4, CCR, DCR0, DCR1 */
+ return builtin_type_unsigned_short;
+ }
+ else if (regno > PC_REGNUM && regno < P4_REGNUM)
+ {
+ /* P0, P1, P2, P3 */
+ return builtin_type_unsigned_char;
+ }
else
- /* Invalid (unimplemented) register. */
- return builtin_type_int0;
+ {
+ /* Invalid register. */
+ return builtin_type_void;
+ }
}
/* Stores a function return value of type type, where valbuf is the address
@@ -1501,49 +1317,10 @@ cris_register_name (int regno)
}
}
-/* Convert DWARF register number REG to the appropriate register
- number used by GDB. */
-
static int
-cris_dwarf2_reg_to_regnum (int reg)
+cris_register_bytes_ok (long bytes)
{
- /* We need to re-map a couple of registers (SRP is 16 in Dwarf-2 register
- numbering, MOF is 18).
- Adapted from gcc/config/cris/cris.h. */
- static int cris_dwarf_regmap[] = {
- 0, 1, 2, 3,
- 4, 5, 6, 7,
- 8, 9, 10, 11,
- 12, 13, 14, 15,
- 27, -1, -1, -1,
- -1, -1, -1, 23,
- -1, -1, -1, 27,
- -1, -1, -1, -1
- };
- int regnum = -1;
-
- if (reg >= 0 && reg < ARRAY_SIZE (cris_dwarf_regmap))
- regnum = cris_dwarf_regmap[reg];
-
- if (regnum == -1)
- warning ("Unmapped DWARF Register #%d encountered\n", reg);
-
- return regnum;
-}
-
-/* DWARF-2 frame support. */
-
-static void
-cris_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
- struct dwarf2_frame_state_reg *reg)
-{
- /* The return address column. */
- if (regnum == PC_REGNUM)
- reg->how = DWARF2_FRAME_REG_RA;
-
- /* The call frame address. */
- else if (regnum == SP_REGNUM)
- reg->how = DWARF2_FRAME_REG_CFA;
+ return (bytes == deprecated_register_bytes ());
}
/* Extract from an array regbuf containing the raw register state a function
@@ -1819,7 +1596,6 @@ cris_software_single_step (enum target_signal ignore, int insert_breakpoints)
if (status == -1)
{
/* Could not find a target. FIXME: Should do something. */
- warning ("cris_software_single_step: unable to find step target");
}
else
{
@@ -3536,7 +3312,7 @@ cris_delayed_get_disassembler (bfd_vma addr, struct disassemble_info *info)
disassembler, even when there is no BFD. Does something like
"gdb; target remote; disassmeble *0x123" work? */
gdb_assert (exec_bfd != NULL);
- print_insn = cris_get_disassembler (exec_bfd);
+ print_insn = cris_get_disassembler (exec_bfd);
gdb_assert (print_insn != NULL);
return print_insn (addr, info);
}
@@ -3647,38 +3423,230 @@ cris_linux_svr4_fetch_link_map_offsets (void)
return lmp;
}
+static void
+cris_fpless_backtrace (char *noargs, int from_tty)
+{
+ /* Points at the instruction after the jsr (except when in innermost frame
+ where it points at the original pc). */
+ CORE_ADDR pc = 0;
+
+ /* Temporary variable, used for parsing from the start of the function that
+ the pc is in, up to the pc. */
+ CORE_ADDR tmp_pc = 0;
+ CORE_ADDR sp = 0;
+
+ /* Information about current frame. */
+ struct symtab_and_line sal;
+ char* func_name;
+
+ /* Present instruction. */
+ unsigned short insn;
+
+ /* Next instruction, lookahead. */
+ unsigned short insn_next;
+
+ /* This is to store the offset between sp at start of function and until we
+ reach push srp (if any). */
+ int sp_add_later = 0;
+ int push_srp_found = 0;
+
+ int val = 0;
+
+ /* Frame counter. */
+ int frame = 0;
+
+ /* For the innermost frame, we want to look at srp in case it's a leaf
+ function (since there's no push srp in that case). */
+ int innermost_frame = 1;
+
+ deprecated_read_register_gen (PC_REGNUM, (char *) &pc);
+ deprecated_read_register_gen (SP_REGNUM, (char *) &sp);
+
+ /* We make an explicit return when we can't find an outer frame. */
+ while (1)
+ {
+ /* Get file name and line number. */
+ sal = find_pc_line (pc, 0);
+
+ /* Get function name. */
+ find_pc_partial_function (pc, &func_name, (CORE_ADDR *) NULL,
+ (CORE_ADDR *) NULL);
+
+ /* Print information about current frame. */
+ printf_unfiltered ("#%i 0x%08lx in %s", frame++, pc, func_name);
+ if (sal.symtab)
+ {
+ printf_unfiltered (" at %s:%i", sal.symtab->filename, sal.line);
+ }
+ printf_unfiltered ("\n");
+
+ /* Get the start address of this function. */
+ tmp_pc = get_pc_function_start (pc);
+
+ /* Mini parser, only meant to find push sp and sub ...,sp from the start
+ of the function, up to the pc. */
+ while (tmp_pc < pc)
+ {
+ insn = read_memory_unsigned_integer (tmp_pc, sizeof (short));
+ tmp_pc += sizeof (short);
+ if (insn == 0xE1FC)
+ {
+ /* push <reg> 32 bit instruction */
+ insn_next = read_memory_unsigned_integer (tmp_pc,
+ sizeof (short));
+ tmp_pc += sizeof (short);
+
+ /* Recognize srp. */
+ if (insn_next == 0xBE7E)
+ {
+ /* For subsequent (not this one though) push or sub which
+ affects sp, adjust sp immediately. */
+ push_srp_found = 1;
+
+ /* Note: this will break if we ever encounter a
+ push vr (1 byte) or push ccr (2 bytes). */
+ sp_add_later += 4;
+ }
+ else
+ {
+ /* Some other register was pushed. */
+ if (push_srp_found)
+ {
+ sp += 4;
+ }
+ else
+ {
+ sp_add_later += 4;
+ }
+ }
+ }
+ else if (cris_get_operand2 (insn) == SP_REGNUM
+ && cris_get_mode (insn) == 0x0000
+ && cris_get_opcode (insn) == 0x000A)
+ {
+ /* subq <val>,sp */
+ val = cris_get_quick_value (insn);
+
+ if (push_srp_found)
+ {
+ sp += val;
+ }
+ else
+ {
+ sp_add_later += val;
+ }
+
+ }
+ else if (cris_get_operand2 (insn) == SP_REGNUM
+ /* Autoincrement addressing mode. */
+ && cris_get_mode (insn) == 0x0003
+ /* Opcode. */
+ && ((insn) & 0x03E0) >> 5 == 0x0004)
+ {
+ /* subu <val>,sp */
+ val = get_data_from_address (&insn, tmp_pc);
+
+ if (push_srp_found)
+ {
+ sp += val;
+ }
+ else
+ {
+ sp_add_later += val;
+ }
+ }
+ else if (cris_get_operand2 (insn) == SP_REGNUM
+ && ((insn & 0x0F00) >> 8) == 0x0001
+ && (cris_get_signed_offset (insn) < 0))
+ {
+ /* Immediate byte offset addressing prefix word with sp as base
+ register. Used for CRIS v8 i.e. ETRAX 100 and newer if <val>
+ is between 64 and 128.
+ movem r<regsave>,[sp=sp-<val>] */
+ val = -cris_get_signed_offset (insn);
+ insn_next = read_memory_unsigned_integer (tmp_pc,
+ sizeof (short));
+ tmp_pc += sizeof (short);
+
+ if (cris_get_mode (insn_next) == PREFIX_ASSIGN_MODE
+ && cris_get_opcode (insn_next) == 0x000F
+ && cris_get_size (insn_next) == 0x0003
+ && cris_get_operand1 (insn_next) == SP_REGNUM)
+ {
+ if (push_srp_found)
+ {
+ sp += val;
+ }
+ else
+ {
+ sp_add_later += val;
+ }
+ }
+ }
+ }
+
+ if (push_srp_found)
+ {
+ /* Reset flag. */
+ push_srp_found = 0;
+
+ /* sp should now point at where srp is stored on the stack. Update
+ the pc to the srp. */
+ pc = read_memory_unsigned_integer (sp, 4);
+ }
+ else if (innermost_frame)
+ {
+ /* We couldn't find a push srp in the prologue, so this must be
+ a leaf function, and thus we use the srp register directly.
+ This should happen at most once, for the innermost function. */
+ deprecated_read_register_gen (SRP_REGNUM, (char *) &pc);
+ }
+ else
+ {
+ /* Couldn't find an outer frame. */
+ return;
+ }
+
+ /* Reset flag. (In case the innermost frame wasn't a leaf, we don't
+ want to look at the srp register later either). */
+ innermost_frame = 0;
+
+ /* Now, add the offset for everything up to, and including push srp,
+ that was held back during the prologue parsing. */
+ sp += sp_add_later;
+ sp_add_later = 0;
+ }
+}
+
extern initialize_file_ftype _initialize_cris_tdep; /* -Wmissing-prototypes */
void
_initialize_cris_tdep (void)
{
- static struct cmd_list_element *cris_set_cmdlist;
- static struct cmd_list_element *cris_show_cmdlist;
-
struct cmd_list_element *c;
gdbarch_register (bfd_arch_cris, cris_gdbarch_init, cris_dump_tdep);
/* CRIS-specific user-commands. */
- add_setshow_uinteger_cmd ("cris-version", class_support,
- &usr_cmd_cris_version,
- "Set the current CRIS version.",
- "Show the current CRIS version.",
- "Set if autodetection fails.",
- "Current CRIS version is %s.",
- set_cris_version, NULL,
- &setlist, &showlist);
+ c = add_set_cmd ("cris-version", class_support, var_integer,
+ (char *) &usr_cmd_cris_version,
+ "Set the current CRIS version.", &setlist);
+ set_cmd_sfunc (c, cris_version_update);
+ deprecated_add_show_from_set (c, &showlist);
+
+ c = add_set_enum_cmd ("cris-mode", class_support, cris_mode_enums,
+ &usr_cmd_cris_mode,
+ "Set the current CRIS mode.", &setlist);
+ set_cmd_sfunc (c, cris_mode_update);
+ deprecated_add_show_from_set (c, &showlist);
+
+ c = add_cmd ("cris-fpless-backtrace", class_support, cris_fpless_backtrace,
+ "Display call chain using the subroutine return pointer.\n"
+ "Note that this displays the address after the jump to the "
+ "subroutine.", &cmdlist);
- add_setshow_boolean_cmd ("cris-dwarf2-cfi", class_support,
- &usr_cmd_cris_dwarf2_cfi,
- "Set the usage of Dwarf-2 CFI for CRIS.",
- "Show the usage of Dwarf-2 CFI for CRIS.",
- "Set to \"off\" if using gcc-cris < R59.",
- "Usage of Dwarf-2 CFI for CRIS is %d.",
- set_cris_dwarf2_cfi, NULL,
- &setlist, &showlist);
-
deprecated_add_core_fns (&cris_elf_core_fns);
+
}
/* Prints out all target specific values. */
@@ -3691,37 +3659,65 @@ cris_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
{
fprintf_unfiltered (file, "cris_dump_tdep: tdep->cris_version = %i\n",
tdep->cris_version);
- fprintf_unfiltered (file, "cris_dump_tdep: tdep->cris_dwarf2_cfi = %i\n",
- tdep->cris_dwarf2_cfi);
+ fprintf_unfiltered (file, "cris_dump_tdep: tdep->cris_mode = %s\n",
+ tdep->cris_mode);
}
}
static void
-set_cris_version (char *ignore_args, int from_tty,
- struct cmd_list_element *c)
+cris_version_update (char *ignore_args, int from_tty,
+ struct cmd_list_element *c)
{
struct gdbarch_info info;
- usr_cmd_cris_version_valid = 1;
+ /* NOTE: cagney/2002-03-17: The deprecated_add_show_from_set()
+ function clones the set command passed as a parameter. The clone
+ operation will include (BUG?) any ``set'' command callback, if
+ present. Commands like ``info set'' call all the ``show''
+ command callbacks. Unfortunately, for ``show'' commands cloned
+ from ``set'', this includes callbacks belonging to ``set''
+ commands. Making this worse, this only occures if
+ deprecated_add_show_from_set() is called after add_cmd_sfunc()
+ (BUG?). */
+
+ /* From here on, trust the user's CRIS version setting. */
+ if (cmd_type (c) == set_cmd)
+ {
+ usr_cmd_cris_version_valid = 1;
- /* Update the current architecture, if needed. */
- gdbarch_info_init (&info);
- if (!gdbarch_update_p (info))
- internal_error (__FILE__, __LINE__,
- "cris_gdbarch_update: failed to update architecture.");
+ /* Update the current architecture, if needed. */
+ gdbarch_info_init (&info);
+ if (!gdbarch_update_p (info))
+ internal_error (__FILE__, __LINE__, "cris_gdbarch_update: failed to update architecture.");
+ }
}
static void
-set_cris_dwarf2_cfi (char *ignore_args, int from_tty,
- struct cmd_list_element *c)
+cris_mode_update (char *ignore_args, int from_tty,
+ struct cmd_list_element *c)
{
struct gdbarch_info info;
-
- /* Update the current architecture, if needed. */
- gdbarch_info_init (&info);
- if (!gdbarch_update_p (info))
- internal_error (__FILE__, __LINE__,
- "cris_gdbarch_update: failed to update architecture.");
+
+ /* NOTE: cagney/2002-03-17: The deprecated_add_show_from_set()
+ function clones the set command passed as a parameter. The clone
+ operation will include (BUG?) any ``set'' command callback, if
+ present. Commands like ``info set'' call all the ``show''
+ command callbacks. Unfortunately, for ``show'' commands cloned
+ from ``set'', this includes callbacks belonging to ``set''
+ commands. Making this worse, this only occures if
+ deprecated_add_show_from_set() is called after add_cmd_sfunc()
+ (BUG?). */
+
+ /* From here on, trust the user's CRIS mode setting. */
+ if (cmd_type (c) == set_cmd)
+ {
+ usr_cmd_cris_mode_valid = 1;
+
+ /* Update the current architecture, if needed. */
+ gdbarch_info_init (&info);
+ if (!gdbarch_update_p (info))
+ internal_error (__FILE__, __LINE__, "cris_gdbarch_update: failed to update architecture.");
+ }
}
static struct gdbarch *
@@ -3730,6 +3726,8 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
struct gdbarch *gdbarch;
struct gdbarch_tdep *tdep;
int cris_version;
+ const char *cris_mode;
+ int register_bytes;
if (usr_cmd_cris_version_valid)
{
@@ -3742,8 +3740,26 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
cris_version = 10;
}
+ if (usr_cmd_cris_mode_valid)
+ {
+ /* Trust the user's CRIS mode setting. */
+ cris_mode = usr_cmd_cris_mode;
+ }
+ else if (cris_version == 10)
+ {
+ /* Assume CRIS version 10 is in user mode. */
+ cris_mode = CRIS_MODE_USER;
+ }
+ else
+ {
+ /* Strictly speaking, older CRIS version don't have a supervisor mode,
+ but we regard its only mode as supervisor mode. */
+ cris_mode = CRIS_MODE_SUPERVISOR;
+ }
+
/* Make the current settings visible to the user. */
usr_cmd_cris_version = cris_version;
+ usr_cmd_cris_mode = cris_mode;
/* Find a candidate among the list of pre-declared architectures. Both
CRIS version and ABI must match. */
@@ -3751,10 +3767,8 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
arches != NULL;
arches = gdbarch_list_lookup_by_info (arches->next, &info))
{
- if ((gdbarch_tdep (arches->gdbarch)->cris_version
- == usr_cmd_cris_version)
- && (gdbarch_tdep (arches->gdbarch)->cris_dwarf2_cfi
- == usr_cmd_cris_dwarf2_cfi))
+ if ((gdbarch_tdep (arches->gdbarch)->cris_version == cris_version)
+ && (gdbarch_tdep (arches->gdbarch)->cris_mode == cris_mode))
return arches->gdbarch;
}
@@ -3762,8 +3776,8 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep = (struct gdbarch_tdep *) xmalloc (sizeof (struct gdbarch_tdep));
gdbarch = gdbarch_alloc (&info, tdep);
- tdep->cris_version = usr_cmd_cris_version;
- tdep->cris_dwarf2_cfi = usr_cmd_cris_dwarf2_cfi;
+ tdep->cris_version = cris_version;
+ tdep->cris_mode = cris_mode;
/* INIT shall ensure that the INFO.BYTE_ORDER is non-zero. */
switch (info.byte_order)
@@ -3790,11 +3804,16 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_sp_regnum (gdbarch, 14);
set_gdbarch_pc_regnum (gdbarch, 15);
set_gdbarch_register_name (gdbarch, cris_register_name);
-
+
+ /* Length of ordinary registers used in push_word and a few other
+ places. register_size() is the real way to know how big a
+ register is. */
+ set_gdbarch_deprecated_register_size (gdbarch, 4);
set_gdbarch_double_bit (gdbarch, 64);
/* The default definition of a long double is 2 * TARGET_DOUBLE_BIT,
which means we have to set this explicitly. */
set_gdbarch_long_double_bit (gdbarch, 64);
+ set_gdbarch_register_bytes_ok (gdbarch, cris_register_bytes_ok);
set_gdbarch_cannot_store_register (gdbarch, cris_cannot_store_register);
set_gdbarch_cannot_fetch_register (gdbarch, cris_cannot_fetch_register);
@@ -3808,23 +3827,33 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
case 1:
case 2:
case 3:
+ /* Support for these may be added later. */
+ internal_error (__FILE__, __LINE__, "cris_gdbarch_init: unsupported CRIS version");
+ break;
+
case 8:
case 9:
- /* Old versions; not supported. */
- internal_error (__FILE__, __LINE__,
- "cris_gdbarch_init: unsupported CRIS version");
+ /* CRIS v8 and v9, a.k.a. ETRAX 100. General registers R0 - R15
+ (32 bits), special registers P0 - P1 (8 bits), P4 - P5 (16 bits),
+ and P8 - P14 (32 bits). */
+ register_bytes = (16 * 4) + (2 * 1) + (2 * 2) + (7 * 4);
break;
case 10:
case 11:
/* CRIS v10 and v11, a.k.a. ETRAX 100LX. In addition to ETRAX 100,
P7 (32 bits), and P15 (32 bits) have been implemented. */
+ register_bytes = (16 * 4) + (2 * 1) + (2 * 2) + (9 * 4);
break;
default:
internal_error (__FILE__, __LINE__, "cris_gdbarch_init: unknown CRIS version");
}
+ /* Returns the register offset for the first byte of register regno's space
+ in the saved register state. */
+ set_gdbarch_deprecated_register_byte (gdbarch, cris_register_offset);
+
set_gdbarch_register_type (gdbarch, cris_register_type);
/* Dummy frame functions. */
@@ -3844,16 +3873,9 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_unwind_sp (gdbarch, cris_unwind_sp);
set_gdbarch_unwind_dummy_id (gdbarch, cris_unwind_dummy_id);
- if (tdep->cris_dwarf2_cfi == 1)
- {
- /* Hook in the Dwarf-2 frame sniffer. */
- set_gdbarch_dwarf2_reg_to_regnum (gdbarch, cris_dwarf2_reg_to_regnum);
- dwarf2_frame_set_init_reg (gdbarch, cris_dwarf2_frame_init_reg);
- frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
- }
-
- frame_unwind_append_sniffer (gdbarch, cris_sigtramp_frame_sniffer);
-
+ /* FIXME: Hook in the DWARF CFI frame unwinder.
+ frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
+ */
frame_unwind_append_sniffer (gdbarch, cris_frame_sniffer);
frame_base_set_default (gdbarch, &cris_frame_base);
diff --git a/gdb/defs.h b/gdb/defs.h
index fd96665..63477de 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -197,7 +197,6 @@ enum language
language_asm, /* Assembly language */
language_scm, /* Scheme / Guile */
language_pascal, /* Pascal */
- language_ada, /* Ada */
language_minimal, /* All other languages, minimal support only */
nr_languages
};
@@ -804,16 +803,11 @@ typedef struct ptid ptid_t;
#include "tm.h"
#endif
-/* Assume that fopen accepts the letter "b" in the mode string.
- Support for is demanded by ISO C90, and should be supported on all
- platforms that claim to have a standards conforming C library. On
- true POSIX systems it will be ignored and have no effect. There
- may still be systems without a standards conforming C library where
- an ISO C90 compiler (GCC) is available. Known examples are SunOS
- 4.x and 4.3BSD. This assumption means these systems are no longer
- supported. */
+/* If the xm.h file did not define the mode string used to open the
+ files, assume that binary files are opened the same way as text
+ files */
#ifndef FOPEN_RB
-# include "fopen-bin.h"
+#include "fopen-same.h"
#endif
/* Defaults for system-wide constants (if not defined by xm.h, we fake it).
@@ -858,6 +852,10 @@ extern int longest_to_int (LONGEST);
extern char *savestring (const char *, size_t);
+extern char *msavestring (void *, const char *, size_t);
+
+extern char *mstrsave (void *, const char *);
+
/* xmalloc(), xrealloc() and xcalloc() have already been declared in
"libiberty.h". */
extern void xfree (void *);
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index c46594b..2d3035e 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,55 +1,3 @@
-2004-10-12 Andrew Cagney <cagney@gnu.org>
-
- * gdbint.texinfo (Versions and Branches): New chapter.
- (Releasing GDB): Delete "Versions and Branches" section.
- (Top): Add "Versions and Branches".
-
-2004-10-08 Eli Zaretskii <eliz@gnu.org>
-
- * gdb.texinfo (Editing, History): Add cross-references to the
- included Readline and History user documentation. Remove
- references to the symbol have-readline-appendices which is unused
- and undefined.
- (History): Fix indexing.
-
-2004-10-08 Jeff Johnston <jjohnstn@redhat.com>
-
- * gdbint.texinfo (target_stopped_data_address): Update to
- new prototype.
- (i386_stopped_data_address): Update prototype and description.
- (i386_stopped_by_watchpoint): New function and description.
-
-2004-10-03 Paul N. Hilfinger <hilfinger@gnat.com>
-
- * gdb.texinfo (Filenames): Add Ada suffixes.
- (Ada) New section.
-
-2004-09-27 Andrew Cagney <cagney@gnu.org>
- Robert Picco <Robert.Picco@hp.com>
-
- * gdb.texinfo (Packets): Document the "p" packet.
-
-2004-09-21 Jason Molenda (jmolenda@apple.com)
-
- * gdb.texinfo (Paths and Names of the Source Files): Document the
- meaning of values in the 'desc' field of a SO stab.
-
-2004-09-20 Daniel Jacobowitz <dan@debian.org>
-
- * gdb.texinfo (Maintenance Commands): Document "maint set dwarf2
- max-cache-age" and "maint show dwarf2 max-cache-age".
-
-2004-09-16 Eli Zaretskii <eliz@gnu.org>
-
- * gdb.texinfo (Set Breaks): Add index entry for setting
- breakpoints on overloaded C++ functions that are not members of
- any classes. Add an example and an index entry for setting
- breakpoints on all program functions.
- (Character Sets, Macros, Overlay Commands)
- (Non-debug DLL symbols, GDB/MI Output Syntax)
- (Annotations Overview, Maintenance Commands, File-I/O Overview):
- Use "(@value{GDBP})" instead of a literal "(gdb)".
-
2004-09-12 Andrew Cagney <cagney@gnu.org>
* gdbint.texinfo (Native Debugging): Delete description of
@@ -411,7 +359,7 @@
(Coding): Add -Wunused-label to list of -Werror warnings.
2004-01-08 Jason Molenda <jmolenda@apple.com>
- Eli Zaretskii <eliz@gnu.org>
+ Eli Zaretskii <eliz@is.elta.co.il>
* gdb.texinfo: Update copyright.
(Objective-C): "methodName" typeo fixed. Add @code/@var markup
@@ -1169,7 +1117,7 @@
2002-09-20 Kevin Buettner <kevinb@redhat.com>
- From Eli Zaretskii <eliz@gnu.org>:
+ From Eli Zaretskii <eliz@is.elta.co.il>:
* gdb.texinfo (Character Sets): Use @smallexample instead of
@example. Use GNU/Linux instead of Linux.
@@ -1440,14 +1388,14 @@
* gdbint.texinfo (Target Architecture Definition): Delete
definition of HAVE_REGISTER_WINDOWS.
-2002-04-19 Eli Zaretskii <eliz@gnu.org>
+2002-04-19 Eli Zaretskii <eliz@is.elta.co.il>
* gdbint.texinfo (Releasing GDB, Coding): Fix typos. Reported by
"Theodore A. Roth" <troth@verinet.com>.
2002-04-15 Don Howard <dhoward@redhat.com>
- From Eli Zaretskii <eliz@gnu.org>
+ From Eli Zaretskii <eliz@is.elta.co.il>
* gdb.texinfo (show max-user-call-depth): Correct formatting.
Provide a better explaination of this feature.
@@ -1551,7 +1499,7 @@
'_ovly_debug_event', which allows GDB to keep better track
of overlays.
-2002-02-03 Eli Zaretskii <eliz@gnu.org>
+2002-02-03 Eli Zaretskii <eliz@is.elta.co.il>
* gdb.texinfo (Memory Region Attributes): Fix the wording.
Suggested by Dmitry Sivachenko.
@@ -1576,7 +1524,7 @@
* gdbint.texinfo (Target Architecture Definition): Delete
description of TARGET_BYTE_ORDER_DEFAULT.
-2002-01-27 Eli Zaretskii <eliz@gnu.org>
+2002-01-27 Eli Zaretskii <eliz@is.elta.co.il>
* gdb.texinfo: Fix typos and markup. From Dmitry Sivachenko
<mitya@cavia.pp.ru>.
@@ -1634,7 +1582,7 @@ Tue Jan 22 11:57:38 2002 Andrew Cagney <cagney@redhat.com>
* gdbint.texinfo (Target Architecture Definition): Remove
definition of IEEE_FLOAT.
-2002-01-20 Eli Zaretskii <eliz@gnu.org>
+2002-01-20 Eli Zaretskii <eliz@is.elta.co.il>
* gdb.texinfo: Beautify copyright years; fix a typo.
(DJGPP Native): Fix overfull hboxes in examples. From Brian Youmans
@@ -1660,7 +1608,7 @@ Tue Jan 22 11:57:38 2002 Andrew Cagney <cagney@redhat.com>
* fdl.texi: Remove next/prev from @node.
-2002-01-17 Eli Zaretskii <eliz@gnu.org>
+2002-01-17 Eli Zaretskii <eliz@is.elta.co.il>
* gdb.texinfo: @include fdl.texi. Fixes for overfull hboxes and
for monstrous @multitable (from Brian Youmans).
@@ -1692,7 +1640,7 @@ Tue Jan 22 11:57:38 2002 Andrew Cagney <cagney@redhat.com>
* gdb.texinfo (--pid): Document new command line option (attach).
-2002-01-07 Eli Zaretskii <eliz@gnu.org>
+2002-01-07 Eli Zaretskii <eliz@is.elta.co.il>
* gdb.texinfo (Tracepoints): Clarify that tracepoints need support
in the stub.
@@ -1716,7 +1664,7 @@ Tue Jan 22 11:57:38 2002 Andrew Cagney <cagney@redhat.com>
* gdb.texinfo (Free Software): New section ``Free Software Needs
Free Documentation''.
-2001-12-30 Eli Zaretskii <eliz@gnu.org>
+2001-12-30 Eli Zaretskii <eliz@is.elta.co.il>
* stabs.texinfo:
* gdb.texinfo:
@@ -1763,7 +1711,7 @@ Tue Jan 22 11:57:38 2002 Andrew Cagney <cagney@redhat.com>
* gdb.texinfo (Options): Eliminate attempt to explain .gdbinit/gdb.ini
use since it is described in the referenced section.
- From Eli Zaretskii <eliz@gnu.org>
+ From Eli Zaretskii <eliz@is.elta.co.il>
* gdb.texinfo (Command Files): Reword to make gdb.ini requirement
clearer when using DJGPP.
@@ -1877,7 +1825,7 @@ Wed Aug 15 10:47:28 2001 Christopher Faylor <cgf@cygnus.com>
* gdbint.texinfo (libgdb): Rewrite.
-2001-07-26 Eli Zaretskii <eliz@gnu.org>
+2001-07-26 Eli Zaretskii <eliz@is.elta.co.il>
* Makefile.in (gdbgui.dvi, gdb-gui, gdbgui.info): Targets deleted.
@@ -1891,7 +1839,7 @@ Wed Aug 15 10:47:28 2001 Christopher Faylor <cgf@cygnus.com>
* gdbint.texinfo (Host Definition): Remove description of
NEED_POSIX_SETPGID.
-2001-07-23 Eli Zaretskii <eliz@gnu.org>
+2001-07-23 Eli Zaretskii <eliz@is.elta.co.il>
* gdb.tex (DJGPP Native): New node, with descriptions of
DJGPP-specific commands.
@@ -1930,7 +1878,7 @@ Wed Aug 15 10:47:28 2001 Christopher Faylor <cgf@cygnus.com>
EXTRACT_STRUCT_VALUE_ADDRESS and EXTRACT_STRUCT_VALUE_ADDRESS_P.
The latter has been changed to a true predicate.
-2001-06-17 Eli Zaretskii <eliz@gnu.org>
+2001-06-17 Eli Zaretskii <eliz@is.elta.co.il>
* annotate.texi: Add @noindent where needed. From Dmitry
Sivachenko <dima@Chg.RU>.
@@ -1949,7 +1897,7 @@ Wed Aug 15 10:47:28 2001 Christopher Faylor <cgf@cygnus.com>
* gdb.texinfo (Protocol): Add doc for new packet "qSymbol:".
-2001-06-13 Eli Zaretskii <eliz@gnu.org>
+2001-06-13 Eli Zaretskii <eliz@is.elta.co.il>
* gdb.texinfo (Signals): Clarify the default setting of signal
handling.
@@ -1963,20 +1911,20 @@ Wed Aug 15 10:47:28 2001 Christopher Faylor <cgf@cygnus.com>
* Makefile.in (GDBvn.texi): Set GDBVN from ../version.in.
-2001-05-10 Eli Zaretskii <eliz@gnu.org>
+2001-05-10 Eli Zaretskii <eliz@is.elta.co.il>
* gdbint.texinfo (Clean Design and Portable Implementation):
Renamed from "Clean Design".
(Clean Design and Portable Implementation): Document portable
methods of handling file names, and the associated macros.
-2001-04-02 Eli Zaretskii <eliz@gnu.org>
+2001-04-02 Eli Zaretskii <eliz@is.elta.co.il>
* gdb.texinfo (Tracepoint Actions): Mention the "info scope"
command and provide a cross-reference to its description.
(Symbols): Note that "info scope" is useful for trace experiments.
-2001-04-01 Eli Zaretskii <eliz@gnu.org>
+2001-04-01 Eli Zaretskii <eliz@is.elta.co.il>
* gdb.texinfo (Symbols): Document "info scope".
(Tracepoints): New chapter.
@@ -1988,7 +1936,7 @@ Wed Aug 15 10:47:28 2001 Christopher Faylor <cgf@cygnus.com>
* stabs.texinfo: Change Permissions to GFDL. Update Copyright.
-2001-03-26 Eli Zaretskii <eliz@gnu.org>
+2001-03-26 Eli Zaretskii <eliz@is.elta.co.il>
* gdb.texinfo: Change Permissions to GFDL. Update Copyright.
@@ -2003,7 +1951,7 @@ Wed Aug 15 10:47:28 2001 Christopher Faylor <cgf@cygnus.com>
a cross-reference to its description.
(Symbols): Document "info symbol".
-2001-03-21 Eli Zaretskii <eliz@gnu.org>
+2001-03-21 Eli Zaretskii <eliz@is.elta.co.il>
* gdbint.texinfo (Algorithms): New section "Watchpoints" and new
subsection "x86 Watchpoints".
@@ -2022,11 +1970,11 @@ Wed Aug 15 10:47:28 2001 Christopher Faylor <cgf@cygnus.com>
* Makefile.in, all-cfg.texi, annotate.texi, gdb.texinfo,
gdbint.texinfo, refcard.tex: Update/correct copyright notices.
-2001-02-21 Eli Zaretskii <eliz@gnu.org>
+2001-02-21 Eli Zaretskii <eliz@is.elta.co.il>
* gdb.texinfo (Signals): Document "ignore", "noignore", and "all".
-2001-02-11 Eli Zaretskii <eliz@gnu.org>
+2001-02-11 Eli Zaretskii <eliz@is.elta.co.il>
* gdb.texinfo (Environment): Document that `path' does not change
the value of PATH in GDB's own environment (it did in the past,
@@ -2045,7 +1993,7 @@ Wed Aug 15 10:47:28 2001 Christopher Faylor <cgf@cygnus.com>
* gdbint.texinfo (POP_FRAME): Document use by return_command.
-2000-12-25 Eli Zaretskii <eliz@gnu.org>
+2000-12-25 Eli Zaretskii <eliz@is.elta.co.il>
* refcard.tex: Version and copyright fixed. From Phil Edwards
<pedwards@disaster.jaj.com>.
@@ -2060,7 +2008,7 @@ Mon Nov 20 21:29:35 2000 Andrew Cagney <cagney@b1.cygnus.com>
* gdbint.texinfo (Coding): Update current value of
--enable-build-warnings. Mention --enable-gdb-build-warnings.
-2000-11-19 Eli Zaretskii <eliz@gnu.org>
+2000-11-19 Eli Zaretskii <eliz@is.elta.co.il>
* gdb.texinfo (Continuing and Stepping): Fixed markup and typos,
as suggested by Dmitry Sivachenko <dima@Chg.RU>.
@@ -2069,12 +2017,12 @@ Mon Nov 20 21:29:35 2000 Andrew Cagney <cagney@b1.cygnus.com>
* gdb.texinfo: Document new 'set step-mode' command.
-2000-10-16 Eli Zaretskii <eliz@gnu.org>
+2000-10-16 Eli Zaretskii <eliz@is.elta.co.il>
* gdb.texinfo (Contributors, MIPS Embedded): Minor spelling
changes from Dmitry Sivachenko <dima@Chg.RU>.
-2000-09-26 Eli Zaretskii <eliz@gnu.org>
+2000-09-26 Eli Zaretskii <eliz@is.elta.co.il>
* gdb.texinfo (Hooks): Document the new post-hook functionality.
From Steven Johnson <sbjohnson@ozemail.com.au>.
@@ -2083,7 +2031,7 @@ Mon Nov 20 21:29:35 2000 Andrew Cagney <cagney@b1.cygnus.com>
* gdbint.texinfo (Overall Structure): Spelling fix.
-2000-08-10 Eli Zaretskii <eliz@gnu.org>
+2000-08-10 Eli Zaretskii <eliz@is.elta.co.il>
* gdbint.texinfo (Target Architecture Definition): Document that
REGISTER_CONVERT_TO_VIRTUAL should only be called on a register
@@ -2099,12 +2047,12 @@ Mon Nov 20 21:29:35 2000 Andrew Cagney <cagney@b1.cygnus.com>
* stabs.texinfo: Fix spelling errors.
(String Field): FILE-NUMBER starts from 0, not 1.
-2000-07-05 Eli Zaretskii <eliz@gnu.org>
+2000-07-05 Eli Zaretskii <eliz@is.elta.co.il>
* refcard.tex: Remove \centerline from the blurb. Patch from
Brian Youmans.
-2000-06-25 Eli Zaretskii <eliz@gnu.org>
+2000-06-25 Eli Zaretskii <eliz@is.elta.co.il>
* Makefile.in (install-info): Support installation from outside of
the source directory. Reported by Mark Harig
@@ -2123,7 +2071,7 @@ Fri May 26 15:55:33 2000 Andrew Cagney <cagney@b1.cygnus.com>
(gdb.texinfo, gdbint.texinfo, stabs.texinfo): When TeX insert the
@contents at the start.
-2000-05-24 Eli Zaretskii <eliz@gnu.org>
+2000-05-24 Eli Zaretskii <eliz@is.elta.co.il>
* gdb.texinfo: Remove duplicate @syncodeindex. From Brian
Youmans.
@@ -2142,7 +2090,7 @@ Tue May 23 22:57:41 2000 Andrew Cagney <cagney@b1.cygnus.com>
* configure: Regenerate.
-2000-05-17 Eli Zaretskii <eliz@gnu.org>
+2000-05-17 Eli Zaretskii <eliz@is.elta.co.il>
* Makefile.in (install-info): Run install-info on installed Info
files.
@@ -2152,7 +2100,7 @@ Fri May 12 20:18:04 2000 Andrew Cagney <cagney@b1.cygnus.com>
* gdb.texinfo: Add Stan Shebs, et.al. as authors. Mention
Andrew Cagney.
-2000-05-09 Eli Zaretskii <eliz@gnu.org>
+2000-05-09 Eli Zaretskii <eliz@is.elta.co.il>
* gdb.texinfo: Proofreading changes from Brian Youmans.
@@ -2161,7 +2109,7 @@ Fri May 12 20:18:04 2000 Andrew Cagney <cagney@b1.cygnus.com>
* gdb.texinfo (Command Files): Mention -x, use @enumerate for
startup sequence, minor edits.
-2000-05-01 Eli Zaretskii <eliz@gnu.org>
+2000-05-01 Eli Zaretskii <eliz@is.elta.co.il>
* annotate.texi: Remove "@syncodeindex fn cp", it causes grief in
TeX.
@@ -2175,7 +2123,7 @@ Sat Apr 29 17:01:04 2000 Andrew Cagney <cagney@b1.cygnus.com>
* gdbint.texinfo (Hints): Do not use @value{GDBN in @nodes.
-2000-04-23 Eli Zaretskii <eliz@gnu.org>
+2000-04-23 Eli Zaretskii <eliz@is.elta.co.il>
* Makefile.in (GDBMI_DIR): New variable.
(SET_TEXINPUTS): Add $(GDBMI_DIR).
@@ -2194,19 +2142,19 @@ Sat Apr 29 17:01:04 2000 Andrew Cagney <cagney@b1.cygnus.com>
* gdb.texinfo (Files): Update description of add-symbol-file
command.
-2000-04-17 Eli Zaretskii <eliz@gnu.org>
+2000-04-17 Eli Zaretskii <eliz@is.elta.co.il>
* gdb.texinfo (Porting GDB): Don't use @value in the node name, it
prevents the build (and is generally a Bad Idea).
-2000-04-17 Eli Zaretskii <eliz@gnu.org>
+2000-04-17 Eli Zaretskii <eliz@is.elta.co.il>
* gdb.texinfo (Protocol): Prevent makeinfo from complaining about
a comma inside @var.
(Command Files): Index markup changes from Dmitry Sivachenko
<dima@Chg.RU>.
-2000-04-16 Eli Zaretskii <eliz@gnu.org>
+2000-04-16 Eli Zaretskii <eliz@is.elta.co.il>
* Makefile.in (LN_S): Define.
(gdb-cfg.texi, gdb.dvi, links2roff, inc-hist.texinfo): Don't
@@ -2318,7 +2266,7 @@ Fri Mar 24 17:56:48 2000 Andrew Cagney <cagney@b1.cygnus.com>
<dima@Chg.RU>, also clarification of allowed content for
string constants.
-2000-03-16 Eli Zaretskii <eliz@gnu.org>
+2000-03-16 Eli Zaretskii <eliz@is.elta.co.il>
* gdb.texinfo (main menu): Add Annotations.
(File Options): Add @cindex entries for each command-line option.
@@ -2407,7 +2355,7 @@ Thu Oct 14 21:17:17 1999 Andrew Cagney <cagney@b1.cygnus.com>
* gdb.texinfo: Fix uses of @multitable.
- From Eli Zaretskii <eliz@gnu.org>:
+ From Eli Zaretskii <eliz@is.elta.co.il>:
* gdb.texinfo: Include details specific to DOS host, clarify
some confusing language, fix @ref/@xref/@pxref usages, add
comments about using with optimization, add more indexing,
@@ -2464,7 +2412,7 @@ Wed Aug 25 10:47:03 1999 Andrew Cagney <cagney@b1.cygnus.com>
* gdbint.texinfo (Breakpoint Handling): Add missing words.
-1999-08-10 Eli Zaretskii <eliz@gnu.org>
+1999-08-10 Eli Zaretskii <eliz@is.elta.co.il>
* gdb.texinfo (Set Watchpoints): Explain some subtleties about
watch, awatch, and rwatch. Explain why the latter two cannot be
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 6af8d37..0f4f277 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -2590,19 +2590,10 @@ an @code{fo} followed by zero or more @code{o}s. There is an implicit
@code{.*} leading and trailing the regular expression you supply, so to
match only functions that begin with @code{foo}, use @code{^foo}.
-@cindex non-member C@t{++} functions, set breakpoint in
When debugging C@t{++} programs, @code{rbreak} is useful for setting
breakpoints on overloaded functions that are not members of any special
classes.
-@cindex set breakpoints on all functions
-The @code{rbreak} command can be used to set breakpoints in
-@strong{all} the functions in a program, like this:
-
-@smallexample
-(@value{GDBP}) rbreak .
-@end smallexample
-
@kindex info breakpoints
@cindex @code{$_} and @code{info breakpoints}
@item info breakpoints @r{[}@var{n}@r{]}
@@ -6309,7 +6300,7 @@ $ gdb -nw charset-test
GNU gdb 2001-12-19-cvs
Copyright 2001 Free Software Foundation, Inc.
@dots{}
-(@value{GDBP})
+(gdb)
@end smallexample
We can use the @code{show charset} command to see what character sets
@@ -6317,18 +6308,18 @@ We can use the @code{show charset} command to see what character sets
strings:
@smallexample
-(@value{GDBP}) show charset
+(gdb) show charset
The current host and target character set is `ISO-8859-1'.
-(@value{GDBP})
+(gdb)
@end smallexample
For the sake of printing this manual, let's use @sc{ascii} as our
initial character set:
@smallexample
-(@value{GDBP}) set charset ASCII
-(@value{GDBP}) show charset
+(gdb) set charset ASCII
+(gdb) show charset
The current host and target character set is `ASCII'.
-(@value{GDBP})
+(gdb)
@end smallexample
Let's assume that @sc{ascii} is indeed the correct character set for our
@@ -6338,20 +6329,20 @@ them properly. Since our current target character set is also
@sc{ascii}, the contents of @code{ascii_hello} print legibly:
@smallexample
-(@value{GDBP}) print ascii_hello
+(gdb) print ascii_hello
$1 = 0x401698 "Hello, world!\n"
-(@value{GDBP}) print ascii_hello[0]
+(gdb) print ascii_hello[0]
$2 = 72 'H'
-(@value{GDBP})
+(gdb)
@end smallexample
@value{GDBN} uses the target character set for character and string
literals you use in expressions:
@smallexample
-(@value{GDBP}) print '+'
+(gdb) print '+'
$3 = 43 '+'
-(@value{GDBP})
+(gdb)
@end smallexample
The @sc{ascii} character set uses the number 43 to encode the @samp{+}
@@ -6362,20 +6353,20 @@ target program uses. If we print @code{ibm1047_hello} while our target
character set is still @sc{ascii}, we get jibberish:
@smallexample
-(@value{GDBP}) print ibm1047_hello
+(gdb) print ibm1047_hello
$4 = 0x4016a8 "\310\205\223\223\226k@@\246\226\231\223\204Z%"
-(@value{GDBP}) print ibm1047_hello[0]
+(gdb) print ibm1047_hello[0]
$5 = 200 '\310'
-(@value{GDBP})
+(gdb)
@end smallexample
If we invoke the @code{set target-charset} followed by @key{TAB}@key{TAB},
@value{GDBN} tells us the character sets it supports:
@smallexample
-(@value{GDBP}) set target-charset
+(gdb) set target-charset
ASCII EBCDIC-US IBM1047 ISO-8859-1
-(@value{GDBP}) set target-charset
+(gdb) set target-charset
@end smallexample
We can select @sc{ibm1047} as our target character set, and examine the
@@ -6385,28 +6376,28 @@ target character set, @sc{ibm1047}, to the host character set,
@sc{ascii}, and they display correctly:
@smallexample
-(@value{GDBP}) set target-charset IBM1047
-(@value{GDBP}) show charset
+(gdb) set target-charset IBM1047
+(gdb) show charset
The current host character set is `ASCII'.
The current target character set is `IBM1047'.
-(@value{GDBP}) print ascii_hello
+(gdb) print ascii_hello
$6 = 0x401698 "\110\145%%?\054\040\167?\162%\144\041\012"
-(@value{GDBP}) print ascii_hello[0]
+(gdb) print ascii_hello[0]
$7 = 72 '\110'
-(@value{GDBP}) print ibm1047_hello
+(gdb) print ibm1047_hello
$8 = 0x4016a8 "Hello, world!\n"
-(@value{GDBP}) print ibm1047_hello[0]
+(gdb) print ibm1047_hello[0]
$9 = 200 'H'
-(@value{GDBP})
+(gdb)
@end smallexample
As above, @value{GDBN} uses the target character set for character and
string literals you use in expressions:
@smallexample
-(@value{GDBP}) print '+'
+(gdb) print '+'
$10 = 78 '+'
-(@value{GDBP})
+(gdb)
@end smallexample
The @sc{ibm1047} character set uses the number 78 to encode the @samp{+}
@@ -6547,7 +6538,7 @@ $ gdb -nw sample
GNU gdb 2002-05-06-cvs
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, @dots{}
-(@value{GDBP})
+(gdb)
@end smallexample
We can expand macros and examine their definitions, even when the
@@ -6555,7 +6546,7 @@ program is not running. @value{GDBN} uses the current listing position
to decide which macro definitions are in scope:
@smallexample
-(@value{GDBP}) list main
+(gdb) list main
3
4 #define M 42
5 #define ADD(x) (M + x)
@@ -6566,18 +6557,18 @@ to decide which macro definitions are in scope:
10 printf ("Hello, world!\n");
11 #undef N
12 printf ("We're so creative.\n");
-(@value{GDBP}) info macro ADD
+(gdb) info macro ADD
Defined at /home/jimb/gdb/macros/play/sample.c:5
#define ADD(x) (M + x)
-(@value{GDBP}) info macro Q
+(gdb) info macro Q
Defined at /home/jimb/gdb/macros/play/sample.h:1
included at /home/jimb/gdb/macros/play/sample.c:2
#define Q <
-(@value{GDBP}) macro expand ADD(1)
+(gdb) macro expand ADD(1)
expands to: (42 + 1)
-(@value{GDBP}) macro expand-once ADD(1)
+(gdb) macro expand-once ADD(1)
expands to: once (M + 1)
-(@value{GDBP})
+(gdb)
@end smallexample
In the example above, note that @command{macro expand-once} expands only
@@ -6589,27 +6580,27 @@ Once the program is running, GDB uses the macro definitions in force at
the source line of the current stack frame:
@smallexample
-(@value{GDBP}) break main
+(gdb) break main
Breakpoint 1 at 0x8048370: file sample.c, line 10.
-(@value{GDBP}) run
+(gdb) run
Starting program: /home/jimb/gdb/macros/play/sample
Breakpoint 1, main () at sample.c:10
10 printf ("Hello, world!\n");
-(@value{GDBP})
+(gdb)
@end smallexample
At line 10, the definition of the macro @code{N} at line 9 is in force:
@smallexample
-(@value{GDBP}) info macro N
+(gdb) info macro N
Defined at /home/jimb/gdb/macros/play/sample.c:9
#define N 28
-(@value{GDBP}) macro expand N Q M
+(gdb) macro expand N Q M
expands to: 28 < 42
-(@value{GDBP}) print N Q M
+(gdb) print N Q M
$1 = 1
-(@value{GDBP})
+(gdb)
@end smallexample
As we step over directives that remove @code{N}'s definition, and then
@@ -6617,23 +6608,23 @@ give it a new definition, @value{GDBN} finds the definition (or lack
thereof) in force at each point:
@smallexample
-(@value{GDBP}) next
+(gdb) next
Hello, world!
12 printf ("We're so creative.\n");
-(@value{GDBP}) info macro N
+(gdb) info macro N
The symbol `N' has no definition as a C/C++ preprocessor macro
at /home/jimb/gdb/macros/play/sample.c:12
-(@value{GDBP}) next
+(gdb) next
We're so creative.
14 printf ("Goodbye, world!\n");
-(@value{GDBP}) info macro N
+(gdb) info macro N
Defined at /home/jimb/gdb/macros/play/sample.c:13
#define N 1729
-(@value{GDBP}) macro expand N Q M
+(gdb) macro expand N Q M
expands to: 1729 < 42
-(@value{GDBP}) print N Q M
+(gdb) print N Q M
$2 = 0
-(@value{GDBP})
+(gdb)
@end smallexample
@@ -7489,7 +7480,7 @@ Normally, when @value{GDBN} prints a code address, it includes the name
of the function the address falls in:
@smallexample
-(@value{GDBP}) print main
+(gdb) print main
$3 = @{int ()@} 0x11a0 <main>
@end smallexample
@noindent
@@ -7499,9 +7490,9 @@ asterisks around them. For example, if @code{foo} is a function in an
unmapped overlay, @value{GDBN} prints it this way:
@smallexample
-(@value{GDBP}) overlay list
+(gdb) overlay list
No sections are mapped.
-(@value{GDBP}) print foo
+(gdb) print foo
$5 = @{int (int)@} 0x100000 <*foo*>
@end smallexample
@noindent
@@ -7509,10 +7500,10 @@ When @code{foo}'s overlay is mapped, @value{GDBN} prints the function's
name normally:
@smallexample
-(@value{GDBP}) overlay list
+(gdb) overlay list
Section .ov.foo.text, loaded at 0x100000 - 0x100034,
mapped at 0x1016 - 0x104a
-(@value{GDBP}) print foo
+(gdb) print foo
$6 = @{int (int)@} 0x1016 <foo>
@end smallexample
@@ -7717,11 +7708,6 @@ If a source file name ends in one of the following extensions, then
@value{GDBN} infers that its language is the one indicated.
@table @file
-@item .ada
-@itemx .ads
-@itemx .adb
-@itemx .a
-Ada source file.
@item .c
C source file
@@ -8010,7 +7996,7 @@ being set automatically by @value{GDBN}.
@node Support
@section Supported languages
-@value{GDBN} supports C, C@t{++}, Objective-C, Fortran, Java, assembly, Modula-2, and Ada.
+@value{GDBN} supports C, C@t{++}, Objective-C, Fortran, Java, assembly, and Modula-2.
@c This is false ...
Some @value{GDBN} features may be used in expressions regardless of the
language you use: the @value{GDBN} @code{@@} and @code{::} operators,
@@ -8030,7 +8016,6 @@ language reference or tutorial.
* C:: C and C@t{++}
* Objective-C:: Objective-C
* Modula-2:: Modula-2
-* Ada:: Ada
@end menu
@node C
@@ -8646,7 +8631,7 @@ the description of an object. However, this command may only work
with certain Objective-C libraries that have a particular hook
function, @code{_NSPrintForDebugger}, defined.
-@node Modula-2, Ada, Objective-C, Support
+@node Modula-2, , Objective-C, Support
@subsection Modula-2
@cindex Modula-2, @value{GDBN} support
@@ -9089,341 +9074,6 @@ address can be specified by an integral constant, the construct
In @value{GDBN} scripts, the Modula-2 inequality operator @code{#} is
interpreted as the beginning of a comment. Use @code{<>} instead.
-@node Ada
-@subsection Ada
-@cindex Ada
-
-The extensions made to @value{GDBN} for Ada only support
-output from the @sc{gnu} Ada (GNAT) compiler.
-Other Ada compilers are not currently supported, and
-attempting to debug executables produced by them is most likely
-to be difficult.
-
-
-@cindex expressions in Ada
-@menu
-* Ada Mode Intro:: General remarks on the Ada syntax
- and semantics supported by Ada mode
- in @value{GDBN}.
-* Omissions from Ada:: Restrictions on the Ada expression syntax.
-* Additions to Ada:: Extensions of the Ada expression syntax.
-* Stopping Before Main Program:: Debugging the program during elaboration.
-* Ada Glitches:: Known peculiarities of Ada mode.
-@end menu
-
-@node Ada Mode Intro
-@subsubsection Introduction
-@cindex Ada mode, general
-
-The Ada mode of @value{GDBN} supports a fairly large subset of Ada expression
-syntax, with some extensions.
-The philosophy behind the design of this subset is
-
-@itemize @bullet
-@item
-That @value{GDBN} should provide basic literals and access to operations for
-arithmetic, dereferencing, field selection, indexing, and subprogram calls,
-leaving more sophisticated computations to subprograms written into the
-program (which therefore may be called from @value{GDBN}).
-
-@item
-That type safety and strict adherence to Ada language restrictions
-are not particularly important to the @value{GDBN} user.
-
-@item
-That brevity is important to the @value{GDBN} user.
-@end itemize
-
-Thus, for brevity, the debugger acts as if there were
-implicit @code{with} and @code{use} clauses in effect for all user-written
-packages, making it unnecessary to fully qualify most names with
-their packages, regardless of context. Where this causes ambiguity,
-@value{GDBN} asks the user's intent.
-
-The debugger will start in Ada mode if it detects an Ada main program.
-As for other languages, it will enter Ada mode when stopped in a program that
-was translated from an Ada source file.
-
-While in Ada mode, you may use `@t{--}' for comments. This is useful
-mostly for documenting command files. The standard @value{GDBN} comment
-(@samp{#}) still works at the beginning of a line in Ada mode, but not in the
-middle (to allow based literals).
-
-The debugger supports limited overloading. Given a subprogram call in which
-the function symbol has multiple definitions, it will use the number of
-actual parameters and some information about their types to attempt to narrow
-the set of definitions. It also makes very limited use of context, preferring
-procedures to functions in the context of the @code{call} command, and
-functions to procedures elsewhere.
-
-@node Omissions from Ada
-@subsubsection Omissions from Ada
-@cindex Ada, omissions from
-
-Here are the notable omissions from the subset:
-
-@itemize @bullet
-@item
-Only a subset of the attributes are supported:
-
-@itemize @minus
-@item
-@t{'First}, @t{'Last}, and @t{'Length}
- on array objects (not on types and subtypes).
-
-@item
-@t{'Min} and @t{'Max}.
-
-@item
-@t{'Pos} and @t{'Val}.
-
-@item
-@t{'Tag}.
-
-@item
-@t{'Range} on array objects (not subtypes), but only as the right
-operand of the membership (@code{in}) operator.
-
-@item
-@t{'Access}, @t{'Unchecked_Access}, and
-@t{'Unrestricted_Access} (a GNAT extension).
-
-@item
-@t{'Address}.
-@end itemize
-
-@item
-The names in
-@code{Characters.Latin_1} are not available and
-concatenation is not implemented. Thus, escape characters in strings are
-not currently available.
-
-@item
-Equality tests (@samp{=} and @samp{/=}) on arrays test for bitwise
-equality of representations. They will generally work correctly
-for strings and arrays whose elements have integer or enumeration types.
-They may not work correctly for arrays whose element
-types have user-defined equality, for arrays of real values
-(in particular, IEEE-conformant floating point, because of negative
-zeroes and NaNs), and for arrays whose elements contain unused bits with
-indeterminate values.
-
-@item
-The other component-by-component array operations (@code{and}, @code{or},
-@code{xor}, @code{not}, and relational tests other than equality)
-are not implemented.
-
-@item
-There are no record or array aggregates.
-
-@item
-Calls to dispatching subprograms are not implemented.
-
-@item
-The overloading algorithm is much more limited (i.e., less selective)
-than that of real Ada. It makes only limited use of the context in which a subexpression
-appears to resolve its meaning, and it is much looser in its rules for allowing
-type matches. As a result, some function calls will be ambiguous, and the user
-will be asked to choose the proper resolution.
-
-@item
-The @code{new} operator is not implemented.
-
-@item
-Entry calls are not implemented.
-
-@item
-Aside from printing, arithmetic operations on the native VAX floating-point
-formats are not supported.
-
-@item
-It is not possible to slice a packed array.
-@end itemize
-
-@node Additions to Ada
-@subsubsection Additions to Ada
-@cindex Ada, deviations from
-
-As it does for other languages, @value{GDBN} makes certain generic
-extensions to Ada (@pxref{Expressions}):
-
-@itemize @bullet
-@item
-If the expression @var{E} is a variable residing in memory
-(typically a local variable or array element) and @var{N} is
-a positive integer, then @code{@var{E}@@@var{N}} displays the values of
-@var{E} and the @var{N}-1 adjacent variables following it in memory as an array.
-In Ada, this operator is generally not necessary, since its prime use
-is in displaying parts of an array, and slicing will usually do this in Ada.
-However, there are occasional uses when debugging programs
-in which certain debugging information has been optimized away.
-
-@item
-@code{@var{B}::@var{var}} means ``the variable named @var{var} that appears
-in function or file @var{B}.'' When @var{B} is a file name, you must typically
-surround it in single quotes.
-
-@item
-The expression @code{@{@var{type}@} @var{addr}} means ``the variable of type
-@var{type} that appears at address @var{addr}.''
-
-@item
-A name starting with @samp{$} is a convenience variable
-(@pxref{Convenience Vars}) or a machine register (@pxref{Registers}).
-@end itemize
-
-In addition, @value{GDBN} provides a few other shortcuts and outright additions specific
-to Ada:
-
-@itemize @bullet
-@item
-The assignment statement is allowed as an expression, returning
-its right-hand operand as its value. Thus, you may enter
-
-@smallexample
-set x := y + 3
-print A(tmp := y + 1)
-@end smallexample
-
-@item
-The semicolon is allowed as an ``operator,'' returning as its value
-the value of its right-hand operand.
-This allows, for example,
-complex conditional breaks:
-
-@smallexample
-break f
-condition 1 (report(i); k += 1; A(k) > 100)
-@end smallexample
-
-@item
-Rather than use catenation and symbolic character names to introduce special
-characters into strings, one may instead use a special bracket notation,
-which is also used to print strings. A sequence of characters of the form
-@samp{["@var{XX}"]} within a string or character literal denotes the
-(single) character whose numeric encoding is @var{XX} in hexadecimal. The
-sequence of characters @samp{["""]} also denotes a single quotation mark
-in strings. For example,
-@smallexample
- "One line.["0a"]Next line.["0a"]"
-@end smallexample
-@noindent
-contains an ASCII newline character (@code{Ada.Characters.Latin_1.LF}) after each
-period.
-
-@item
-The subtype used as a prefix for the attributes @t{'Pos}, @t{'Min}, and
-@t{'Max} is optional (and is ignored in any case). For example, it is valid
-to write
-
-@smallexample
-print 'max(x, y)
-@end smallexample
-
-@item
-When printing arrays, @value{GDBN} uses positional notation when the
-array has a lower bound of 1, and uses a modified named notation otherwise.
-For example, a one-dimensional array of three integers with a lower bound of 3 might print as
-
-@smallexample
-(3 => 10, 17, 1)
-@end smallexample
-
-@noindent
-That is, in contrast to valid Ada, only the first component has a @code{=>}
-clause.
-
-@item
-You may abbreviate attributes in expressions with any unique,
-multi-character subsequence of
-their names (an exact match gets preference).
-For example, you may use @t{a'len}, @t{a'gth}, or @t{a'lh}
-in place of @t{a'length}.
-
-@item
-@cindex quoting Ada internal identifiers
-Since Ada is case-insensitive, the debugger normally maps identifiers you type
-to lower case. The GNAT compiler uses upper-case characters for
-some of its internal identifiers, which are normally of no interest to users.
-For the rare occasions when you actually have to look at them,
-enclose them in angle brackets to avoid the lower-case mapping.
-For example,
-@smallexample
-@value{GDBP} print <JMPBUF_SAVE>[0]
-@end smallexample
-
-@item
-Printing an object of class-wide type or dereferencing an
-access-to-class-wide value will display all the components of the object's
-specific type (as indicated by its run-time tag). Likewise, component
-selection on such a value will operate on the specific type of the
-object.
-
-@end itemize
-
-@node Stopping Before Main Program
-@subsubsection Stopping at the Very Beginning
-
-@cindex breakpointing Ada elaboration code
-It is sometimes necessary to debug the program during elaboration, and
-before reaching the main procedure.
-As defined in the Ada Reference
-Manual, the elaboration code is invoked from a procedure called
-@code{adainit}. To run your program up to the beginning of
-elaboration, simply use the following two commands:
-@code{tbreak adainit} and @code{run}.
-
-@node Ada Glitches
-@subsubsection Known Peculiarities of Ada Mode
-@cindex Ada, problems
-
-Besides the omissions listed previously (@pxref{Omissions from Ada}),
-we know of several problems with and limitations of Ada mode in
-@value{GDBN},
-some of which will be fixed with planned future releases of the debugger
-and the GNU Ada compiler.
-
-@itemize @bullet
-@item
-Currently, the debugger
-has insufficient information to determine whether certain pointers represent
-pointers to objects or the objects themselves.
-Thus, the user may have to tack an extra @code{.all} after an expression
-to get it printed properly.
-
-@item
-Static constants that the compiler chooses not to materialize as objects in
-storage are invisible to the debugger.
-
-@item
-Named parameter associations in function argument lists are ignored (the
-argument lists are treated as positional).
-
-@item
-Many useful library packages are currently invisible to the debugger.
-
-@item
-Fixed-point arithmetic, conversions, input, and output is carried out using
-floating-point arithmetic, and may give results that only approximate those on
-the host machine.
-
-@item
-The type of the @t{'Address} attribute may not be @code{System.Address}.
-
-@item
-The GNAT compiler never generates the prefix @code{Standard} for any of
-the standard symbols defined by the Ada language. @value{GDBN} knows about
-this: it will strip the prefix from names when you use it, and will never
-look for a name you have so qualified among local symbols, nor match against
-symbols in other packages or subprograms. If you have
-defined entities anywhere in your program other than parameters and
-local variables whose simple names match names in @code{Standard},
-GNAT's lack of qualification here can cause confusion. When this happens,
-you can usually resolve the confusion
-by qualifying the problematic names with package
-@code{Standard} explicitly.
-@end itemize
-
@node Unsupported languages
@section Unsupported languages
@@ -12106,7 +11756,7 @@ some confusion. If in doubt, try the @code{info functions} and
@pxref{Symbols}). Here's an example:
@smallexample
-(@value{GDBP}) info function CreateFileA
+(gdb) info function CreateFileA
All functions matching regular expression "CreateFileA":
Non-debugging symbols:
@@ -12115,7 +11765,7 @@ Non-debugging symbols:
@end smallexample
@smallexample
-(@value{GDBP}) info function !
+(gdb) info function !
All functions matching regular expression "!":
Non-debugging symbols:
@@ -12142,28 +11792,28 @@ type information in the command. Here's an example of the type of
problem:
@smallexample
-(@value{GDBP}) print 'cygwin1!__argv'
+(gdb) print 'cygwin1!__argv'
$1 = 268572168
@end smallexample
@smallexample
-(@value{GDBP}) x 'cygwin1!__argv'
+(gdb) x 'cygwin1!__argv'
0x10021610: "\230y\""
@end smallexample
And two possible solutions:
@smallexample
-(@value{GDBP}) print ((char **)'cygwin1!__argv')[0]
+(gdb) print ((char **)'cygwin1!__argv')[0]
$2 = 0x22fd98 "/cygdrive/c/mydirectory/myprogram"
@end smallexample
@smallexample
-(@value{GDBP}) x/2x &'cygwin1!__argv'
+(gdb) x/2x &'cygwin1!__argv'
0x610c0aa8 <cygwin1!__argv>: 0x10021608 0x00000000
-(@value{GDBP}) x/x 0x10021608
+(gdb) x/x 0x10021608
0x10021608: 0x0022fd98
-(@value{GDBP}) x/s 0x0022fd98
+(gdb) x/s 0x0022fd98
0x22fd98: "/cygdrive/c/mydirectory/myprogram"
@end smallexample
@@ -12174,7 +11824,7 @@ function's frame set-up code. You can work around this by using ``*&''
to set the breakpoint at a raw memory address:
@smallexample
-(@value{GDBP}) break *&'python22!PyOS_Readline'
+(gdb) break *&'python22!PyOS_Readline'
Breakpoint 1 at 0x1e04eff0
@end smallexample
@@ -13383,7 +13033,7 @@ Prints a line of the form: @samp{Gdb's prompt is: @var{your-prompt}}
@cindex readline
@cindex command line editing
-@value{GDBN} reads its input commands via the @dfn{Readline} interface. This
+@value{GDBN} reads its input commands via the @dfn{readline} interface. This
@sc{gnu} library provides consistent behavior for programs which provide a
command line interface to the user. Advantages are @sc{gnu} Emacs-style
or @dfn{vi}-style inline editing of commands, @code{csh}-like history
@@ -13408,26 +13058,14 @@ Disable command line editing.
Show whether command line editing is enabled.
@end table
-@xref{Command Line Editing}, for more details about the Readline
-interface. Users unfamiliar with @sc{gnu} Emacs or @code{vi} are
-encouraged to read that chapter.
-
@node History
@section Command history
-@cindex command history
@value{GDBN} can keep track of the commands you type during your
debugging sessions, so that you can be certain of precisely what
happened. Use these commands to manage the @value{GDBN} command
history facility.
-@value{GDBN} uses the @sc{gnu} History library, a part of the Readline
-package, to provide the history facility. @xref{Using History
-Interactively}, for the detailed description of the History library.
-
-Here is the description of @value{GDBN} commands related to command
-history.
-
@table @code
@cindex history substitution
@cindex history file
@@ -13460,10 +13098,12 @@ This defaults to the value of the environment variable
@code{HISTSIZE}, or to 256 if this variable is not set.
@end table
+@cindex history expansion
History expansion assigns special meaning to the character @kbd{!}.
-@xref{Event Designators}, for more details.
+@ifset have-readline-appendices
+@xref{Event Designators}.
+@end ifset
-@cindex history expansion, turn on/off
Since @kbd{!} is also the logical not operator in C, history expansion
is off by default. If you decide to enable history expansion with the
@code{set history expansion on} command, you may sometimes need to
@@ -13477,12 +13117,19 @@ The commands to control history expansion are:
@table @code
@item set history expansion on
@itemx set history expansion
-@kindex set history expansion
+@cindex history expansion
Enable history expansion. History expansion is off by default.
@item set history expansion off
Disable history expansion.
+The readline code comes with more complete documentation of
+editing and history expansion features. Users unfamiliar with @sc{gnu} Emacs
+or @code{vi} may wish to read it.
+@ifset have-readline-appendices
+@xref{Command Line Editing}.
+@end ifset
+
@c @group
@kindex show history
@item show history
@@ -15021,7 +14668,7 @@ corresponding output for that command will also be prefixed by that same
@table @code
@item @var{output} @expansion{}
-@code{( @var{out-of-band-record} )* [ @var{result-record} ] "(@value{GDBP})" @var{nl}}
+@code{( @var{out-of-band-record} )* [ @var{result-record} ] "(gdb)" @var{nl}}
@item @var{result-record} @expansion{}
@code{ [ @var{token} ] "^" @var{result-class} ( "," @var{result} )* @var{nl}}
@@ -18884,7 +18531,7 @@ for details.
This GDB was configured as "i386-pc-linux-gnu"
^Z^Zpre-prompt
-(@value{GDBP})
+(gdb)
^Z^Zprompt
@kbd{quit}
@@ -19806,13 +19453,13 @@ either quit @value{GDBN} or create a core file of the current
@value{GDBN} session.
@smallexample
-(@value{GDBP}) @kbd{maint internal-error testing, 1, 2}
+(gdb) @kbd{maint internal-error testing, 1, 2}
@dots{}/maint.c:121: internal-error: testing, 1, 2
A problem internal to GDB has been detected. Further
debugging may prove unreliable.
Quit this debugging session? (y or n) @kbd{n}
Create a core file? (y or n) @kbd{n}
-(@value{GDBP})
+(gdb)
@end smallexample
Takes an optional parameter that is used as the text of the error or
@@ -19824,18 +19471,18 @@ warning message.
Prints the contents of @value{GDBN}'s internal dummy-frame stack.
@smallexample
-(@value{GDBP}) @kbd{b add}
+(gdb) @kbd{b add}
@dots{}
-(@value{GDBP}) @kbd{print add(2,3)}
+(gdb) @kbd{print add(2,3)}
Breakpoint 2, add (a=2, b=3) at @dots{}
58 return (a + b);
The program being debugged stopped while in a function called from GDB.
@dots{}
-(@value{GDBP}) @kbd{maint print dummy-frames}
+(gdb) @kbd{maint print dummy-frames}
0x1a57c80: pc=0x01014068 fp=0x0200bddc sp=0x0200bdd6
top=0x0200bdd4 id=@{stack=0x200bddc,code=0x101405c@}
call_lo=0x01014000 call_hi=0x01014001
-(@value{GDBP})
+(gdb)
@end smallexample
Takes an optional file parameter.
@@ -19866,7 +19513,7 @@ Print @value{GDBN}'s internal register group data structures.
Takes an optional file parameter.
@smallexample
-(@value{GDBP}) @kbd{maint print reggroups}
+(gdb) @kbd{maint print reggroups}
Group Type
general user
float user
@@ -19895,19 +19542,6 @@ data in a @file{gmon.out} file, be sure to move it to a safe location.
Configuring with @samp{--enable-profiling} arranges for @value{GDBN} to be
compiled with the @samp{-pg} compiler option.
-@kindex maint set dwarf2 max-cache-age
-@kindex maint show dwarf2 max-cache-age
-@item maint set dwarf2 max-cache-age
-@itemx maint show dwarf2 max-cache-age
-Control the DWARF 2 compilation unit cache.
-
-In object files with inter-compilation-unit references, such as those
-produced by the GCC option @samp{-feliminate-dwarf2-dups}, the DWARF 2
-reader needs to frequently refer to previously read compilation units.
-This setting controls how long a compilation unit will remain in the cache
-if it is not referenced. Setting it to zero disables caching, which will
-slow down @value{GDBN} startup but reduce memory consumption.
-
@end table
@@ -20307,20 +19941,17 @@ Reserved for future use.
@item @code{O} --- reserved
-@item @code{p}@var{hex number of register} --- read register packet
+Reserved for future use.
+
+@item @code{p}@var{n@dots{}} --- read reg @strong{(reserved)}
@cindex @code{p} packet
-@xref{read registers packet}, for a description of how the returned
-register value is encoded.
+@xref{write register packet}.
Reply:
@table @samp
-@item @var{XX@dots{}}
-the register's value
-@item E@var{NN}
-for an error
-@item
-Indicating an unrecognized @var{query}.
+@item @var{r@dots{}.}
+The hex encoded value of the register in target byte order.
@end table
@item @code{P}@var{n@dots{}}@code{=}@var{r@dots{}} --- write register
@@ -21070,7 +20701,7 @@ previous activity (continue, step). No additional continue or step
request from @value{GDBN} is required.
@smallexample
-(@value{GDBP}) continue
+(gdb) continue
<- target requests 'system call X'
target is stopped, @value{GDBN} executes system call
-> GDB returns result
diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo
index 3c27769..bff7d15 100644
--- a/gdb/doc/gdbint.texinfo
+++ b/gdb/doc/gdbint.texinfo
@@ -84,7 +84,6 @@ as the mechanisms that adapt @value{GDBN} to specific hosts and targets.
* Support Libraries::
* Coding::
* Porting GDB::
-* Versions and Branches::
* Releasing GDB::
* Testsuite::
* Hints::
@@ -477,10 +476,9 @@ no other code touches these values, the implementations of the above
two macros can use them for their internal purposes.
@findex target_stopped_data_address
-@item target_stopped_data_address (@var{addr_p})
-If the inferior has some watchpoint that triggered, place the address
-associated with the watchpoint at the location pointed to by
-@var{addr_p} and return non-zero. Otherwise, return zero.
+@item target_stopped_data_address ()
+If the inferior has some watchpoint that triggered, return the address
+associated with that watchpoint. Otherwise, return zero.
@findex HAVE_STEPPABLE_WATCHPOINT
@item HAVE_STEPPABLE_WATCHPOINT
@@ -600,25 +598,15 @@ less than 4, the number of debug registers available to x86
processors.
@findex i386_stopped_data_address
-@item i386_stopped_data_address (@var{addr_p})
-The target function
-@code{target_stopped_data_address} is set to call this function.
-This
+@item i386_stopped_data_address (void)
+The macros @code{STOPPED_BY_WATCHPOINT} and
+@code{target_stopped_data_address} are set to call this function. The
+argument passed to @code{STOPPED_BY_WATCHPOINT} is ignored. This
function examines the breakpoint condition bits in the DR6 Debug
Status register, as returned by the @code{I386_DR_LOW_GET_STATUS}
macro, and returns the address associated with the first bit that is
set in DR6.
-@findex i386_stopped_by_watchpoint
-@item i386_stopped_by_watchpoint (void)
-The macro @code{STOPPED_BY_WATCHPOINT}
-is set to call this function. The
-argument passed to @code{STOPPED_BY_WATCHPOINT} is ignored. This
-function examines the breakpoint condition bits in the DR6 Debug
-Status register, as returned by the @code{I386_DR_LOW_GET_STATUS}
-macro, and returns true if any bit is set. Otherwise, false is
-returned.
-
@findex i386_insert_watchpoint
@findex i386_remove_watchpoint
@item i386_insert_watchpoint (@var{addr}, @var{len}, @var{type})
@@ -666,7 +654,7 @@ register.
@item i386_stopped_by_hwbp (void)
This function returns non-zero if the inferior has some watchpoint or
hardware breakpoint that triggered. It works like
-@code{i386_stopped_data_address}, except that it doesn't record the
+@code{i386_stopped_data_address}, except that it doesn't return the
address whose watchpoint triggered.
@findex i386_cleanup_dregs
@@ -5380,198 +5368,109 @@ target-dependent @file{.h} and @file{.c} files used for your
configuration.
@end itemize
-@node Versions and Branches
-@chapter Versions and Branches
+@node Releasing GDB
-@section Versions
+@chapter Releasing @value{GDBN}
+@cindex making a new release of gdb
-@value{GDBN}'s version is determined by the file
-@file{gdb/version.in} and takes one of the following forms:
+@section Versions and Branches
-@table @asis
-@item @var{major}.@var{minor}
-@itemx @var{major}.@var{minor}.@var{patchlevel}
-an official release (e.g., 6.0 or 6.0.1)
-@item @var{major}.@var{minor}.@var{patchlevel}_@var{YYYY}@var{MM}@var{DD}
-a snapshot (e.g., 6.0.50_20020630)
-@item @var{major}.@var{minor}.@var{patchlevel}_@var{YYYY}-@var{MM}-@var{DD}-cvs
-a @sc{cvs} check out (e.g., 6.0.90_2004-02-30-cvs)
-@item @var{major}.@var{minor}.@var{patchlevel}_@var{YYYY}@var{MM}@var{DD} (@var{vendor})
-a vendor specific release of @value{GDBN}, that while based on@*
-@var{major}.@var{minor}.@var{patchlevel}_@var{YYYY}@var{MM}@var{DD},
-may contain additional changes
-@end table
+@subsection Version Identifiers
-@value{GDBN}'s mainline uses the @var{major} and @var{minor} version
-numbers from the most recent release branch, with a @var{patchlevel}
-of 50. As each new release branch is created, the mainline
-@var{major} and @var{minor} version numbers are accordingly updated.
+@value{GDBN}'s version is determined by the file @file{gdb/version.in}.
-@value{GDBN}'s release branch uses a similar, but slightly more
-complicated scheme. When the branch is first cut, the mainline's
-@var{patchlevel} is changed to .90. As draft releases are drawn from
-the branch, the @var{patchlevel} is incremented. Once the first
-release (@var{major}.@var{minor}) has been made, the version prefix is
-updated to @var{major}.@var{minor}.0.90. Follow on releases have an
-incremented @var{patchlevel}.
+@value{GDBN}'s mainline uses ISO dates to differentiate between
+versions. The CVS repository uses @var{YYYY}-@var{MM}-@var{DD}-cvs
+while the corresponding snapshot uses @var{YYYYMMDD}.
-If the previous @value{GDBN} version is 6.1 and the current version is
-6.2, then, substituting 6 for @var{major} and 1 or 2 for @var{minor},
-here's an illustration of a typical sequence:
+@value{GDBN}'s release branch uses a slightly more complicated scheme.
+When the branch is first cut, the mainline version identifier is
+prefixed with the @var{major}.@var{minor} from of the previous release
+series but with .90 appended. As draft releases are drawn from the
+branch, the minor minor number (.90) is incremented. Once the first
+release (@var{M}.@var{N}) has been made, the version prefix is updated
+to @var{M}.@var{N}.0.90 (dot zero, dot ninety). Follow on releases have
+an incremented minor minor version number (.0).
-@smallexample
- <HEAD>
- |
-6.1.50_2002-03-02-cvs
- |
- +---------------------------.
- | <gdb_6_2-branch>
- | |
-6.2.50_2002-03-03-cvs 6.1.90 (draft #1)
- | |
-6.2.50_2002-03-04-cvs 6.1.90_2002-03-04-cvs
- | |
-6.2.50_2002-03-05-cvs 6.1.91 (draft #2)
- | |
-6.2.50_2002-03-06-cvs 6.1.91_2002-03-06-cvs
- | |
-6.2.50_2002-03-07-cvs 6.2 (release)
- | |
-6.2.50_2002-03-08-cvs 6.2.0.90_2002-03-08-cvs
- | |
-6.2.50_2002-03-09-cvs 6.2.1 (update)
- | |
-6.2.50_2002-03-10-cvs <branch closed>
- |
-6.2.50_2002-03-11-cvs
- |
- +---------------------------.
- | <gdb_6_3-branch>
- | |
-6.3.50_2002-03-12-cvs 6.2.90 (draft #1)
- | |
-@end smallexample
+Using 5.1 (previous) and 5.2 (current), the example below illustrates a
+typical sequence of version identifiers:
-@section Release Branches
-@cindex Release Branches
-
-@value{GDBN} draws a release series (6.2, 6.2.1, @dots{}) from a
-single release branch, and identifies that branch using the @sc{cvs}
-branch tags:
-
-@smallexample
-gdb_@var{major}_@var{minor}-@var{YYYY}@var{MM}@var{DD}-branchpoint
-gdb_@var{major}_@var{minor}-branch
-gdb_@var{major}_@var{minor}-@var{YYYY}@var{MM}@var{DD}-release
-@end smallexample
+@table @asis
+@item 5.1.1
+final release from previous branch
+@item 2002-03-03-cvs
+main-line the day the branch is cut
+@item 5.1.90-2002-03-03-cvs
+corresponding branch version
+@item 5.1.91
+first draft release candidate
+@item 5.1.91-2002-03-17-cvs
+updated branch version
+@item 5.1.92
+second draft release candidate
+@item 5.1.92-2002-03-31-cvs
+updated branch version
+@item 5.1.93
+final release candidate (see below)
+@item 5.2
+official release
+@item 5.2.0.90-2002-04-07-cvs
+updated CVS branch version
+@item 5.2.1
+second official release
+@end table
-@emph{Pragmatics: To help identify the date at which a branch or
-release is made, both the branchpoint and release tags include the
-date that they are cut (@var{YYYY}@var{MM}@var{DD}) in the tag. The
-branch tag, denoting the head of the branch, does not need this.}
+Notes:
-@section Vendor Branches
-@cindex vendor branches
+@itemize @bullet
+@item
+Minor minor minor draft release candidates such as 5.2.0.91 have been
+omitted from the example. Such release candidates are, typically, never
+made.
+@item
+For 5.1.93 the bziped tar ball @file{gdb-5.1.93.tar.bz2} is just the
+official @file{gdb-5.2.tar} renamed and compressed.
+@end itemize
To avoid version conflicts, vendors are expected to modify the file
@file{gdb/version.in} to include a vendor unique alphabetic identifier
(an official @value{GDBN} release never uses alphabetic characters in
-its version identifer). E.g., @samp{6.2widgit2}, or @samp{6.2 (Widgit
-Inc Patch 2)}.
+its version identifer).
-@section Experimental Branches
-@cindex experimental branches
+Since @value{GDBN} does not make minor minor minor releases (e.g.,
+5.1.0.1) the conflict between that and a minor minor draft release
+identifier (e.g., 5.1.0.90) is avoided.
-@subsection Guidelines
-@value{GDBN} permits the creation of branches, cut from the @sc{cvs}
-repository, for experimental development. Branches make it possible
-for developers to share preliminary work, and maintainers to examine
-significant new developments.
+@subsection Branches
-The following are a set of guidelines for creating such branches:
+@value{GDBN} draws a release series (5.2, 5.2.1, @dots{}) from a single
+release branch (gdb_5_2-branch). Since minor minor minor releases
+(5.1.0.1) are not made, the need to branch the release branch is avoided
+(it also turns out that the effort required for such a a branch and
+release is significantly greater than the effort needed to create a new
+release from the head of the release branch).
-@table @emph
-
-@item a branch has an owner
-The owner can set further policy for a branch, but may not change the
-ground rules. In particular, they can set a policy for commits (be it
-adding more reviewers or deciding who can commit).
-
-@item all commits are posted
-All changes committed to a branch shall also be posted to
-@email{gdb-patches@@sources.redhat.com, the @value{GDBN} patches
-mailing list}. While commentary on such changes are encouraged, people
-should remember that the changes only apply to a branch.
-
-@item all commits are covered by an assignment
-This ensures that all changes belong to the Free Software Foundation,
-and avoids the possibility that the branch may become contaminated.
-
-@item a branch is focused
-A focused branch has a single objective or goal, and does not contain
-unnecessary or irrelevant changes. Cleanups, where identified, being
-be pushed into the mainline as soon as possible.
-
-@item a branch tracks mainline
-This keeps the level of divergence under control. It also keeps the
-pressure on developers to push cleanups and other stuff into the
-mainline.
-
-@item a branch shall contain the entire @value{GDBN} module
-The @value{GDBN} module @code{gdb} should be specified when creating a
-branch (branches of individual files should be avoided). @xref{Tags}.
-
-@item a branch shall be branded using @file{version.in}
-The file @file{gdb/version.in} shall be modified so that it identifies
-the branch @var{owner} and branch @var{name}, e.g.,
-@samp{6.2.50_20030303_owner_name} or @samp{6.2 (Owner Name)}.
-
-@end table
-
-@subsection Tags
-@anchor{Tags}
-
-To simplify the identification of @value{GDBN} branches, the following
-branch tagging convention is strongly recommended:
+Releases 5.0 and 5.1 used branch and release tags of the form:
-@table @code
-
-@item @var{owner}_@var{name}-@var{YYYYMMDD}-branchpoint
-@itemx @var{owner}_@var{name}-@var{YYYYMMDD}-branch
-The branch point and corresponding branch tag. @var{YYYYMMDD} is the
-date that the branch was created. A branch is created using the
-sequence: @anchor{experimental branch tags}
@smallexample
-cvs rtag @var{owner}_@var{name}-@var{YYYYMMDD}-branchpoint gdb
-cvs rtag -b -r @var{owner}_@var{name}-@var{YYYYMMDD}-branchpoint \
- @var{owner}_@var{name}-@var{YYYYMMDD}-branch gdb
+gdb_N_M-YYYY-MM-DD-branchpoint
+gdb_N_M-YYYY-MM-DD-branch
+gdb_M_N-YYYY-MM-DD-release
@end smallexample
-@item @var{owner}_@var{name}-@var{yyyymmdd}-mergepoint
-The tagged point, on the mainline, that was used when merging the branch
-on @var{yyyymmdd}. To merge in all changes since the branch was cut,
-use a command sequence like:
+Release 5.2 is trialing the branch and release tags:
+
@smallexample
-cvs rtag @var{owner}_@var{name}-@var{yyyymmdd}-mergepoint gdb
-cvs update \
- -j@var{owner}_@var{name}-@var{YYYYMMDD}-branchpoint
- -j@var{owner}_@var{name}-@var{yyyymmdd}-mergepoint
+gdb_N_M-YYYY-MM-DD-branchpoint
+gdb_N_M-branch
+gdb_M_N-YYYY-MM-DD-release
@end smallexample
-@noindent
-Similar sequences can be used to just merge in changes since the last
-merge.
-@end table
+@emph{Pragmatics: The branchpoint and release tags need to identify when
+a branch and release are made. The branch tag, denoting the head of the
+branch, does not have this criteria.}
-@noindent
-For further information on @sc{cvs}, see
-@uref{http://www.gnu.org/software/cvs/, Concurrent Versions System}.
-
-@node Releasing GDB
-
-@chapter Releasing @value{GDBN}
-@cindex making a new release of gdb
@section Branch Commit Policy
diff --git a/gdb/doc/stabs.texinfo b/gdb/doc/stabs.texinfo
index 4b019d3..a00bc80 100644
--- a/gdb/doc/stabs.texinfo
+++ b/gdb/doc/stabs.texinfo
@@ -422,33 +422,9 @@ file. This information is contained in a symbol of stab type
value of the symbol is the start address of the portion of the
text section corresponding to that file.
-Some compilers use the desc field to indicate the language of the
-source file. Sun's compilers started this usage, and the first
-constants are derived from their documentation. Languages added
-by gcc/gdb start at 0x32 to avoid conflict with languages Sun may
-add in the future. A desc field with a value 0 indicates that no
-language has been specified via this mechanism.
-
-@table @asis
-@item @code{N_SO_AS} (0x1)
-Assembly language
-@item @code{N_SO_C} (0x2)
-K&R traditional C
-@item @code{N_SO_ANSI_C} (0x3)
-ANSI C
-@item @code{N_SO_CC} (0x4)
-C++
-@item @code{N_SO_FORTRAN} (0x5)
-Fortran
-@item @code{N_SO_PASCAL} (0x6)
-Pascal
-@item @code{N_SO_FORTRAN90} (0x7)
-Fortran90
-@item @code{N_SO_OBJC} (0x32)
-Objective-C
-@item @code{N_SO_OBJCPLUS} (0x33)
-Objective-C++
-@end table
+With the Sun Solaris2 compiler, the desc field contains a
+source-language code.
+@c Do the debuggers use it? What are the codes? -djm
Some compilers (for example, GCC2 and SunOS4 @file{/bin/cc}) also
include the directory in which the source was compiled, in a second
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 420bea0..49a003f 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -45,8 +45,6 @@
#include "dwarf2loc.h"
#include "cp-support.h"
#include "hashtab.h"
-#include "command.h"
-#include "gdbcmd.h"
#include <fcntl.h>
#include "gdb_string.h"
@@ -168,17 +166,6 @@ struct dwarf2_per_objfile
char *macinfo_buffer;
char *ranges_buffer;
char *loc_buffer;
-
- /* A list of all the compilation units. This is used to locate
- the target compilation unit of a particular reference. */
- struct dwarf2_per_cu_data **all_comp_units;
-
- /* The number of compilation units in ALL_COMP_UNITS. */
- int n_comp_units;
-
- /* A chain of compilation units that are currently read in, so that
- they can be freed later. */
- struct dwarf2_per_cu_data *read_in_chain;
};
static struct dwarf2_per_objfile *dwarf2_per_objfile;
@@ -257,11 +244,6 @@ struct comp_unit_head
int base_known;
};
-/* Fixed size for the DIE hash table. */
-#ifndef REF_HASH_SIZE
-#define REF_HASH_SIZE 1021
-#endif
-
/* Internal state when decoding a particular compilation unit. */
struct dwarf2_cu
{
@@ -317,36 +299,6 @@ struct dwarf2_cu
unit, including partial DIEs. */
struct obstack comp_unit_obstack;
- /* When multiple dwarf2_cu structures are living in memory, this field
- chains them all together, so that they can be released efficiently.
- We will probably also want a generation counter so that most-recently-used
- compilation units are cached... */
- struct dwarf2_per_cu_data *read_in_chain;
-
- /* Backchain to our per_cu entry if the tree has been built. */
- struct dwarf2_per_cu_data *per_cu;
-
- /* How many compilation units ago was this CU last referenced? */
- int last_used;
-
- /* A hash table of die offsets for following references. */
- struct die_info *die_ref_table[REF_HASH_SIZE];
-
- /* Full DIEs if read in. */
- struct die_info *dies;
-
- /* A set of pointers to dwarf2_per_cu_data objects for compilation
- units referenced by this one. Only set during full symbol processing;
- partial symbol tables do not have dependencies. */
- htab_t dependencies;
-
- /* Mark used when releasing cached dies. */
- unsigned int mark : 1;
-
- /* This flag will be set if this compilation unit might include
- inter-compilation-unit references. */
- unsigned int has_form_ref_addr : 1;
-
/* This flag will be set if this compilation unit includes any
DW_TAG_namespace DIEs. If we know that there are explicit
DIEs for namespaces, we don't need to try to infer them
@@ -354,37 +306,6 @@ struct dwarf2_cu
unsigned int has_namespace_info : 1;
};
-/* Persistent data held for a compilation unit, even when not
- processing it. We put a pointer to this structure in the
- read_symtab_private field of the psymtab. If we encounter
- inter-compilation-unit references, we also maintain a sorted
- list of all compilation units. */
-
-struct dwarf2_per_cu_data
-{
- /* The start offset and length of this compilation unit. 2**31-1
- bytes should suffice to store the length of any compilation unit
- - if it doesn't, GDB will fall over anyway. */
- unsigned long offset;
- unsigned long length : 31;
-
- /* Flag indicating this compilation unit will be read in before
- any of the current compilation units are processed. */
- unsigned long queued : 1;
-
- /* Set iff currently read in. */
- struct dwarf2_cu *cu;
-
- /* If full symbols for this CU have been read in, then this field
- holds a map of DIE offsets to types. It isn't always possible
- to reconstruct this information later, so we have to preserve
- it. */
- htab_t type_hash;
-
- /* The partial symbol table associated with this compilation unit. */
- struct partial_symtab *psymtab;
-};
-
/* The line number information for a compilation unit (found in the
.debug_line section) begins with a "statement program header",
which contains the following information. */
@@ -574,6 +495,13 @@ struct dwarf_block
#define ATTR_ALLOC_CHUNK 4
#endif
+/* A hash table of die offsets for following references. */
+#ifndef REF_HASH_SIZE
+#define REF_HASH_SIZE 1021
+#endif
+
+static struct die_info *die_ref_table[REF_HASH_SIZE];
+
/* Allocate fields for structs, unions and enums in this size. */
#ifndef DW_FIELD_ALLOC_CHUNK
#define DW_FIELD_ALLOC_CHUNK 4
@@ -591,6 +519,19 @@ static int isreg; /* Object lives in register.
decode_locdesc's return value is
the register number. */
+/* We put a pointer to this structure in the read_symtab_private field
+ of the psymtab. */
+
+struct dwarf2_pinfo
+ {
+ /* Offset in .debug_info for this compilation unit. */
+
+ unsigned long dwarf_info_offset;
+ };
+
+#define PST_PRIVATE(p) ((struct dwarf2_pinfo *)(p)->read_symtab_private)
+#define DWARF_INFO_OFFSET(p) (PST_PRIVATE(p)->dwarf_info_offset)
+
/* FIXME: We might want to set this from BFD via bfd_arch_bits_per_byte,
but this would require a corresponding change in unpack_field_as_long
and friends. */
@@ -644,24 +585,6 @@ struct field_info
int nfnfields;
};
-/* One item on the queue of compilation units to read in full symbols
- for. */
-struct dwarf2_queue_item
-{
- struct dwarf2_per_cu_data *per_cu;
- struct dwarf2_queue_item *next;
-};
-
-/* The current queue. */
-static struct dwarf2_queue_item *dwarf2_queue, *dwarf2_queue_tail;
-
-/* Loaded secondary compilation units are kept in memory until they
- have not been referenced for the processing of this many
- compilation units. Set this to zero to disable caching. Cache
- sizes of up to at least twenty will improve startup time for
- typical inter-CU-reference binaries, at an obvious memory cost. */
-static int dwarf2_max_cache_age = 5;
-
/* Various complaints about symbol reading that don't abort the process */
static void
@@ -769,7 +692,8 @@ static char *read_partial_die (struct partial_die_info *,
bfd *, char *, struct dwarf2_cu *);
static struct partial_die_info *find_partial_die (unsigned long,
- struct dwarf2_cu *);
+ struct dwarf2_cu *,
+ struct dwarf2_cu **);
static void fixup_partial_die (struct partial_die_info *,
struct dwarf2_cu *);
@@ -857,14 +781,17 @@ static struct type *die_type (struct die_info *, struct dwarf2_cu *);
static struct type *die_containing_type (struct die_info *,
struct dwarf2_cu *);
+#if 0
+static struct type *type_at_offset (unsigned int, struct objfile *);
+#endif
+
static struct type *tag_type_to_type (struct die_info *, struct dwarf2_cu *);
static void read_type_die (struct die_info *, struct dwarf2_cu *);
static char *determine_prefix (struct die_info *die, struct dwarf2_cu *);
-static char *typename_concat (struct obstack *, const char *prefix, const char *suffix,
- struct dwarf2_cu *);
+static char *typename_concat (const char *prefix, const char *suffix);
static void read_typedef (struct die_info *, struct dwarf2_cu *);
@@ -953,6 +880,8 @@ static struct die_info *read_die_and_siblings (char *info_ptr, bfd *abfd,
static void free_die_list (struct die_info *);
+static struct cleanup *make_cleanup_free_die_list (struct die_info *);
+
static void process_die (struct die_info *, struct dwarf2_cu *);
static char *dwarf2_linkage_name (struct die_info *, struct dwarf2_cu *);
@@ -986,17 +915,16 @@ static void dump_die (struct die_info *);
static void dump_die_list (struct die_info *);
-static void store_in_ref_table (unsigned int, struct die_info *,
- struct dwarf2_cu *);
+static void store_in_ref_table (unsigned int, struct die_info *);
+
+static void dwarf2_empty_hash_tables (void);
static unsigned int dwarf2_get_ref_die_offset (struct attribute *,
struct dwarf2_cu *);
static int dwarf2_get_attr_constant_value (struct attribute *, int);
-static struct die_info *follow_die_ref (struct die_info *,
- struct attribute *,
- struct dwarf2_cu *);
+static struct die_info *follow_die_ref (unsigned int);
static struct type *dwarf2_fundamental_type (struct objfile *, int,
struct dwarf2_cu *);
@@ -1036,39 +964,6 @@ static hashval_t partial_die_hash (const void *item);
static int partial_die_eq (const void *item_lhs, const void *item_rhs);
-static struct dwarf2_per_cu_data *dwarf2_find_containing_comp_unit
- (unsigned long offset, struct objfile *objfile);
-
-static struct dwarf2_per_cu_data *dwarf2_find_comp_unit
- (unsigned long offset, struct objfile *objfile);
-
-static void free_one_comp_unit (void *);
-
-static void free_cached_comp_units (void *);
-
-static void age_cached_comp_units (void);
-
-static void free_one_cached_comp_unit (void *);
-
-static void set_die_type (struct die_info *, struct type *,
- struct dwarf2_cu *);
-
-static void reset_die_and_siblings_types (struct die_info *,
- struct dwarf2_cu *);
-
-static void create_all_comp_units (struct objfile *);
-
-static struct dwarf2_cu *load_full_comp_unit (struct dwarf2_per_cu_data *);
-
-static void process_full_comp_unit (struct dwarf2_per_cu_data *);
-
-static void dwarf2_add_dependence (struct dwarf2_cu *,
- struct dwarf2_per_cu_data *);
-
-static void dwarf2_mark (struct dwarf2_cu *);
-
-static void dwarf2_clear_marks (struct dwarf2_per_cu_data *);
-
/* Try to locate the sections we need for DWARF 2 debugging
information and return true if we have enough to do something. */
@@ -1349,7 +1244,9 @@ dwarf2_create_include_psymtab (char *name, struct partial_symtab *pst,
/* No private part is necessary for include psymtabs. This property
can be used to differentiate between such include psymtabs and
- the regular ones. */
+ the regular ones. If it ever happens that a regular psymtab can
+ legitimally have a NULL private part, then we'll have to add a
+ dedicated field for that in the dwarf2_pinfo structure. */
subpst->read_symtab_private = NULL;
}
@@ -1393,17 +1290,10 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile, int mainline)
char *beg_of_comp_unit;
struct partial_die_info comp_unit_die;
struct partial_symtab *pst;
- struct cleanup *back_to;
CORE_ADDR lowpc, highpc, baseaddr;
info_ptr = dwarf2_per_objfile->info_buffer;
- /* Any cached compilation units will be linked by the per-objfile
- read_in_chain. Make sure to free them when we're done. */
- back_to = make_cleanup (free_cached_comp_units, NULL);
-
- create_all_comp_units (objfile);
-
/* Since the objects we're extracting from .debug_info vary in
length, only the individual functions to extract them (like
read_comp_unit_head and load_partial_die) can really know whether
@@ -1444,12 +1334,12 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile, int mainline)
cu.list_in_scope = &file_symbols;
+ cu.partial_dies = NULL;
+
/* Read the abbrevs for this compilation unit into a table */
dwarf2_read_abbrevs (abfd, &cu);
make_cleanup (dwarf2_free_abbrev_table, &cu);
- this_cu = dwarf2_find_comp_unit (cu.header.offset, objfile);
-
/* Read the compilation unit die */
abbrev = peek_die_abbrev (info_ptr, &bytes_read, &cu);
info_ptr = read_partial_die (&comp_unit_die, abbrev, bytes_read,
@@ -1465,35 +1355,17 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile, int mainline)
objfile->global_psymbols.next,
objfile->static_psymbols.next);
- if (comp_unit_die.dirname)
- pst->dirname = xstrdup (comp_unit_die.dirname);
-
- pst->read_symtab_private = (char *) this_cu;
+ if (comp_unit_die.dirname)
+ pst->dirname = xstrdup (comp_unit_die.dirname);
+ pst->read_symtab_private = (char *)
+ obstack_alloc (&objfile->objfile_obstack, sizeof (struct dwarf2_pinfo));
+ DWARF_INFO_OFFSET (pst) = beg_of_comp_unit - dwarf2_per_objfile->info_buffer;
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
/* Store the function that reads in the rest of the symbol table */
pst->read_symtab = dwarf2_psymtab_to_symtab;
- /* If this compilation unit was already read in, free the
- cached copy in order to read it in again. This is
- necessary because we skipped some symbols when we first
- read in the compilation unit (see load_partial_dies).
- This problem could be avoided, but the benefit is
- unclear. */
- if (this_cu->cu != NULL)
- free_one_cached_comp_unit (this_cu->cu);
-
- cu.per_cu = this_cu;
-
- /* Note that this is a pointer to our stack frame, being
- added to a global data structure. It will be cleaned up
- in free_stack_comp_unit when we finish with this
- compilation unit. */
- this_cu->cu = &cu;
-
- this_cu->psymtab = pst;
-
/* Check if comp unit has_children.
If so, read the rest of the partial symbols from this comp unit.
If not, there's no more debug_info for this comp unit. */
@@ -1547,122 +1419,6 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile, int mainline)
do_cleanups (back_to_inner);
}
- do_cleanups (back_to);
-}
-
-/* Load the DIEs for a secondary CU into memory. */
-
-static void
-load_comp_unit (struct dwarf2_per_cu_data *this_cu, struct objfile *objfile)
-{
- bfd *abfd = objfile->obfd;
- char *info_ptr, *beg_of_comp_unit;
- struct partial_die_info comp_unit_die;
- struct dwarf2_cu *cu;
- struct abbrev_info *abbrev;
- unsigned int bytes_read;
- struct cleanup *back_to;
-
- info_ptr = dwarf2_per_objfile->info_buffer + this_cu->offset;
- beg_of_comp_unit = info_ptr;
-
- cu = xmalloc (sizeof (struct dwarf2_cu));
- memset (cu, 0, sizeof (struct dwarf2_cu));
-
- obstack_init (&cu->comp_unit_obstack);
-
- cu->objfile = objfile;
- info_ptr = partial_read_comp_unit_head (&cu->header, info_ptr, abfd);
-
- /* Complete the cu_header. */
- cu->header.offset = beg_of_comp_unit - dwarf2_per_objfile->info_buffer;
- cu->header.first_die_ptr = info_ptr;
- cu->header.cu_head_ptr = beg_of_comp_unit;
-
- /* Read the abbrevs for this compilation unit into a table. */
- dwarf2_read_abbrevs (abfd, cu);
- back_to = make_cleanup (dwarf2_free_abbrev_table, cu);
-
- /* Read the compilation unit die. */
- abbrev = peek_die_abbrev (info_ptr, &bytes_read, cu);
- info_ptr = read_partial_die (&comp_unit_die, abbrev, bytes_read,
- abfd, info_ptr, cu);
-
- /* Set the language we're debugging. */
- set_cu_language (comp_unit_die.language, cu);
-
- /* Link this compilation unit into the compilation unit tree. */
- this_cu->cu = cu;
- cu->per_cu = this_cu;
-
- /* Check if comp unit has_children.
- If so, read the rest of the partial symbols from this comp unit.
- If not, there's no more debug_info for this comp unit. */
- if (comp_unit_die.has_children)
- load_partial_dies (abfd, info_ptr, 0, cu);
-
- do_cleanups (back_to);
-}
-
-/* Create a list of all compilation units in OBJFILE. We do this only
- if an inter-comp-unit reference is found; presumably if there is one,
- there will be many, and one will occur early in the .debug_info section.
- So there's no point in building this list incrementally. */
-
-static void
-create_all_comp_units (struct objfile *objfile)
-{
- int n_allocated;
- int n_comp_units;
- struct dwarf2_per_cu_data **all_comp_units;
- char *info_ptr = dwarf2_per_objfile->info_buffer;
-
- n_comp_units = 0;
- n_allocated = 10;
- all_comp_units = xmalloc (n_allocated
- * sizeof (struct dwarf2_per_cu_data *));
-
- while (info_ptr < dwarf2_per_objfile->info_buffer + dwarf2_per_objfile->info_size)
- {
- struct comp_unit_head cu_header;
- char *beg_of_comp_unit;
- struct dwarf2_per_cu_data *this_cu;
- unsigned long offset;
- int bytes_read;
-
- offset = info_ptr - dwarf2_per_objfile->info_buffer;
-
- /* Read just enough information to find out where the next
- compilation unit is. */
- cu_header.length = read_initial_length (objfile->obfd, info_ptr,
- &cu_header, &bytes_read);
-
- /* Save the compilation unit for later lookup. */
- this_cu = obstack_alloc (&objfile->objfile_obstack,
- sizeof (struct dwarf2_per_cu_data));
- memset (this_cu, 0, sizeof (*this_cu));
- this_cu->offset = offset;
- this_cu->length = cu_header.length + cu_header.initial_length_size;
-
- if (n_comp_units == n_allocated)
- {
- n_allocated *= 2;
- all_comp_units = xrealloc (all_comp_units,
- n_allocated
- * sizeof (struct dwarf2_per_cu_data *));
- }
- all_comp_units[n_comp_units++] = this_cu;
-
- info_ptr = info_ptr + this_cu->length;
- }
-
- dwarf2_per_objfile->all_comp_units
- = obstack_alloc (&objfile->objfile_obstack,
- n_comp_units * sizeof (struct dwarf2_per_cu_data *));
- memcpy (dwarf2_per_objfile->all_comp_units, all_comp_units,
- n_comp_units * sizeof (struct dwarf2_per_cu_data *));
- xfree (all_comp_units);
- dwarf2_per_objfile->n_comp_units = n_comp_units;
}
/* Process all loaded DIEs for compilation unit CU, starting at FIRST_DIE.
@@ -1755,8 +1511,7 @@ scan_partial_symbols (struct partial_die_info *first_die, CORE_ADDR *lowpc,
/* Functions used to compute the fully scoped name of a partial DIE.
Normally, this is simple. For C++, the parent DIE's fully scoped
- name is concatenated with "::" and the partial DIE's name. For
- Java, the same thing occurs except that "." is used instead of "::".
+ name is concatenated with "::" and the partial DIE's name.
Enumerators are an exception; they use the scope of their parent
enumeration type, i.e. the name of the enumeration type is not
prepended to the enumerator.
@@ -1782,13 +1537,15 @@ partial_die_parent_scope (struct partial_die_info *pdi,
{
char *grandparent_scope;
struct partial_die_info *parent, *real_pdi;
+ struct dwarf2_cu *spec_cu;
/* We need to look at our parent DIE; if we have a DW_AT_specification,
then this means the parent of the specification DIE. */
real_pdi = pdi;
+ spec_cu = cu;
while (real_pdi->has_specification)
- real_pdi = find_partial_die (real_pdi->spec_offset, cu);
+ real_pdi = find_partial_die (real_pdi->spec_offset, spec_cu, &spec_cu);
parent = real_pdi->die_parent;
if (parent == NULL)
@@ -1799,7 +1556,7 @@ partial_die_parent_scope (struct partial_die_info *pdi,
fixup_partial_die (parent, cu);
- grandparent_scope = partial_die_parent_scope (parent, cu);
+ grandparent_scope = partial_die_parent_scope (parent, spec_cu);
if (parent->tag == DW_TAG_namespace
|| parent->tag == DW_TAG_structure_type
@@ -1809,8 +1566,8 @@ partial_die_parent_scope (struct partial_die_info *pdi,
if (grandparent_scope == NULL)
parent->scope = parent->name;
else
- parent->scope = typename_concat (&cu->comp_unit_obstack, grandparent_scope,
- parent->name, cu);
+ parent->scope = obconcat (&cu->comp_unit_obstack, grandparent_scope,
+ "::", parent->name);
}
else if (parent->tag == DW_TAG_enumeration_type)
/* Enumerators should not get the name of the enumeration as a prefix. */
@@ -1842,7 +1599,7 @@ partial_die_full_name (struct partial_die_info *pdi,
if (parent_scope == NULL)
return NULL;
else
- return typename_concat (NULL, parent_scope, pdi->name, cu);
+ return concat (parent_scope, "::", pdi->name, NULL);
}
static void
@@ -1960,16 +1717,14 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
return;
add_psymbol_to_list (actual_name, strlen (actual_name),
STRUCT_DOMAIN, LOC_TYPEDEF,
- (cu->language == language_cplus
- || cu->language == language_java)
+ cu->language == language_cplus
? &objfile->global_psymbols
: &objfile->static_psymbols,
0, (CORE_ADDR) 0, cu->language, objfile);
- if (cu->language == language_cplus
- || cu->language == language_java)
+ if (cu->language == language_cplus)
{
- /* For C++ and Java, these implicitly act as typedefs as well. */
+ /* For C++, these implicitly act as typedefs as well. */
add_psymbol_to_list (actual_name, strlen (actual_name),
VAR_DOMAIN, LOC_TYPEDEF,
&objfile->global_psymbols,
@@ -1979,8 +1734,7 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
case DW_TAG_enumerator:
add_psymbol_to_list (actual_name, strlen (actual_name),
VAR_DOMAIN, LOC_CONST,
- (cu->language == language_cplus
- || cu->language == language_java)
+ cu->language == language_cplus
? &objfile->global_psymbols
: &objfile->static_psymbols,
0, (CORE_ADDR) 0, cu->language, objfile);
@@ -2060,8 +1814,7 @@ static void
guess_structure_name (struct partial_die_info *struct_pdi,
struct dwarf2_cu *cu)
{
- if ((cu->language == language_cplus
- || cu->language == language_java)
+ if (cu->language == language_cplus
&& cu->has_namespace_info == 0
&& struct_pdi->has_children)
{
@@ -2073,14 +1826,16 @@ guess_structure_name (struct partial_die_info *struct_pdi,
struct partial_die_info *child_pdi = struct_pdi->die_child;
struct partial_die_info *real_pdi;
+ struct dwarf2_cu *spec_cu;
/* If this DIE (this DIE's specification, if any) has a parent, then
we should not do this. We'll prepend the parent's fully qualified
name when we create the partial symbol. */
real_pdi = struct_pdi;
+ spec_cu = cu;
while (real_pdi->has_specification)
- real_pdi = find_partial_die (real_pdi->spec_offset, cu);
+ real_pdi = find_partial_die (real_pdi->spec_offset, spec_cu, &spec_cu);
if (real_pdi->die_parent != NULL)
return;
@@ -2321,10 +2076,6 @@ dwarf2_psymtab_to_symtab (struct partial_symtab *pst)
gdb_flush (gdb_stdout);
}
- /* Restore our global data. */
- dwarf2_per_objfile = objfile_data (pst->objfile,
- dwarf2_objfile_data_key);
-
psymtab_to_symtab_1 (pst);
/* Finish up the debug error message. */
@@ -2334,104 +2085,21 @@ dwarf2_psymtab_to_symtab (struct partial_symtab *pst)
}
}
-/* Add PER_CU to the queue. */
-
-static void
-queue_comp_unit (struct dwarf2_per_cu_data *per_cu)
-{
- struct dwarf2_queue_item *item;
-
- per_cu->queued = 1;
- item = xmalloc (sizeof (*item));
- item->per_cu = per_cu;
- item->next = NULL;
-
- if (dwarf2_queue == NULL)
- dwarf2_queue = item;
- else
- dwarf2_queue_tail->next = item;
-
- dwarf2_queue_tail = item;
-}
-
-/* Process the queue. */
-
-static void
-process_queue (struct objfile *objfile)
-{
- struct dwarf2_queue_item *item, *next_item;
-
- /* Initially, there is just one item on the queue. Load its DIEs,
- and the DIEs of any other compilation units it requires,
- transitively. */
-
- for (item = dwarf2_queue; item != NULL; item = item->next)
- {
- /* Read in this compilation unit. This may add new items to
- the end of the queue. */
- load_full_comp_unit (item->per_cu);
-
- item->per_cu->cu->read_in_chain = dwarf2_per_objfile->read_in_chain;
- dwarf2_per_objfile->read_in_chain = item->per_cu;
-
- /* If this compilation unit has already had full symbols created,
- reset the TYPE fields in each DIE. */
- if (item->per_cu->psymtab->readin)
- reset_die_and_siblings_types (item->per_cu->cu->dies,
- item->per_cu->cu);
- }
-
- /* Now everything left on the queue needs to be read in. Process
- them, one at a time, removing from the queue as we finish. */
- for (item = dwarf2_queue; item != NULL; dwarf2_queue = item = next_item)
- {
- if (!item->per_cu->psymtab->readin)
- process_full_comp_unit (item->per_cu);
-
- item->per_cu->queued = 0;
- next_item = item->next;
- xfree (item);
- }
-
- dwarf2_queue_tail = NULL;
-}
-
-/* Free all allocated queue entries. This function only releases anything if
- an error was thrown; if the queue was processed then it would have been
- freed as we went along. */
-
-static void
-dwarf2_release_queue (void *dummy)
-{
- struct dwarf2_queue_item *item, *last;
-
- item = dwarf2_queue;
- while (item)
- {
- /* Anything still marked queued is likely to be in an
- inconsistent state, so discard it. */
- if (item->per_cu->queued)
- {
- if (item->per_cu->cu != NULL)
- free_one_cached_comp_unit (item->per_cu->cu);
- item->per_cu->queued = 0;
- }
-
- last = item;
- item = item->next;
- xfree (last);
- }
-
- dwarf2_queue = dwarf2_queue_tail = NULL;
-}
-
-/* Read in full symbols for PST, and anything it depends on. */
-
static void
psymtab_to_symtab_1 (struct partial_symtab *pst)
{
- struct dwarf2_per_cu_data *per_cu;
+ struct objfile *objfile = pst->objfile;
+ bfd *abfd = objfile->obfd;
+ struct dwarf2_cu cu;
+ struct die_info *dies;
+ unsigned long offset;
+ CORE_ADDR lowpc, highpc;
+ struct die_info *child_die;
+ char *info_ptr;
+ struct symtab *symtab;
struct cleanup *back_to;
+ struct attribute *attr;
+ CORE_ADDR baseaddr;
int i;
for (i = 0; i < pst->number_of_dependencies; i++)
@@ -2451,9 +2119,7 @@ psymtab_to_symtab_1 (struct partial_symtab *pst)
psymtab_to_symtab_1 (pst->dependencies[i]);
}
- per_cu = (struct dwarf2_per_cu_data *) pst->read_symtab_private;
-
- if (per_cu == NULL)
+ if (pst->read_symtab_private == NULL)
{
/* It's an include file, no symbols to read for it.
Everything is in the parent symtab. */
@@ -2461,107 +2127,39 @@ psymtab_to_symtab_1 (struct partial_symtab *pst)
return;
}
- back_to = make_cleanup (dwarf2_release_queue, NULL);
-
- queue_comp_unit (per_cu);
-
- process_queue (pst->objfile);
-
- /* Age the cache, releasing compilation units that have not
- been used recently. */
- age_cached_comp_units ();
-
- do_cleanups (back_to);
-}
-
-/* Load the DIEs associated with PST and PER_CU into memory. */
-
-static struct dwarf2_cu *
-load_full_comp_unit (struct dwarf2_per_cu_data *per_cu)
-{
- struct partial_symtab *pst = per_cu->psymtab;
- bfd *abfd = pst->objfile->obfd;
- struct dwarf2_cu *cu;
- unsigned long offset;
- char *info_ptr;
- struct cleanup *back_to, *free_cu_cleanup;
- struct attribute *attr;
- CORE_ADDR baseaddr;
+ dwarf2_per_objfile = objfile_data (pst->objfile, dwarf2_objfile_data_key);
/* Set local variables from the partial symbol table info. */
- offset = per_cu->offset;
+ offset = DWARF_INFO_OFFSET (pst);
info_ptr = dwarf2_per_objfile->info_buffer + offset;
+ baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
+
+ /* We're in the global namespace. */
+ processing_current_prefix = "";
- cu = xmalloc (sizeof (struct dwarf2_cu));
- memset (cu, 0, sizeof (struct dwarf2_cu));
+ obstack_init (&cu.comp_unit_obstack);
+ back_to = make_cleanup (free_stack_comp_unit, &cu);
- /* If an error occurs while loading, release our storage. */
- free_cu_cleanup = make_cleanup (free_one_comp_unit, cu);
+ buildsym_init ();
+ make_cleanup (really_free_pendings, NULL);
- cu->objfile = pst->objfile;
+ cu.objfile = objfile;
/* read in the comp_unit header */
- info_ptr = read_comp_unit_head (&cu->header, info_ptr, abfd);
+ info_ptr = read_comp_unit_head (&cu.header, info_ptr, abfd);
/* Read the abbrevs for this compilation unit */
- dwarf2_read_abbrevs (abfd, cu);
- back_to = make_cleanup (dwarf2_free_abbrev_table, cu);
-
- cu->header.offset = offset;
-
- cu->per_cu = per_cu;
- per_cu->cu = cu;
-
- /* We use this obstack for block values in dwarf_alloc_block. */
- obstack_init (&cu->comp_unit_obstack);
-
- cu->dies = read_comp_unit (info_ptr, abfd, cu);
-
- /* We try not to read any attributes in this function, because not
- all objfiles needed for references have been loaded yet, and symbol
- table processing isn't initialized. But we have to set the CU language,
- or we won't be able to build types correctly. */
- attr = dwarf2_attr (cu->dies, DW_AT_language, cu);
- if (attr)
- set_cu_language (DW_UNSND (attr), cu);
- else
- set_cu_language (language_minimal, cu);
-
- do_cleanups (back_to);
-
- /* We've successfully allocated this compilation unit. Let our caller
- clean it up when finished with it. */
- discard_cleanups (free_cu_cleanup);
-
- return cu;
-}
-
-/* Generate full symbol information for PST and CU, whose DIEs have
- already been loaded into memory. */
-
-static void
-process_full_comp_unit (struct dwarf2_per_cu_data *per_cu)
-{
- struct partial_symtab *pst = per_cu->psymtab;
- struct dwarf2_cu *cu = per_cu->cu;
- struct objfile *objfile = pst->objfile;
- bfd *abfd = objfile->obfd;
- CORE_ADDR lowpc, highpc;
- struct symtab *symtab;
- struct cleanup *back_to;
- struct attribute *attr;
- CORE_ADDR baseaddr;
+ dwarf2_read_abbrevs (abfd, &cu);
+ make_cleanup (dwarf2_free_abbrev_table, &cu);
- baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
+ cu.header.offset = offset;
- /* We're in the global namespace. */
- processing_current_prefix = "";
+ cu.list_in_scope = &file_symbols;
- buildsym_init ();
- back_to = make_cleanup (really_free_pendings, NULL);
+ dies = read_comp_unit (info_ptr, abfd, &cu);
- cu->list_in_scope = &file_symbols;
+ make_cleanup_free_die_list (dies);
/* Find the base address of the compilation unit for range lists and
location lists. It will normally be specified by DW_AT_low_pc.
@@ -2569,32 +2167,32 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu)
DW_AT_entry_pc. It's been removed, but GCC still uses this for
compilation units with discontinuous ranges. */
- cu->header.base_known = 0;
- cu->header.base_address = 0;
+ cu.header.base_known = 0;
+ cu.header.base_address = 0;
- attr = dwarf2_attr (cu->dies, DW_AT_entry_pc, cu);
+ attr = dwarf2_attr (dies, DW_AT_entry_pc, &cu);
if (attr)
{
- cu->header.base_address = DW_ADDR (attr);
- cu->header.base_known = 1;
+ cu.header.base_address = DW_ADDR (attr);
+ cu.header.base_known = 1;
}
else
{
- attr = dwarf2_attr (cu->dies, DW_AT_low_pc, cu);
+ attr = dwarf2_attr (dies, DW_AT_low_pc, &cu);
if (attr)
{
- cu->header.base_address = DW_ADDR (attr);
- cu->header.base_known = 1;
+ cu.header.base_address = DW_ADDR (attr);
+ cu.header.base_known = 1;
}
}
/* Do line number decoding in read_file_scope () */
- process_die (cu->dies, cu);
+ process_die (dies, &cu);
/* Some compilers don't define a DW_AT_high_pc attribute for the
compilation unit. If the DW_AT_high_pc is missing, synthesize
it, by scanning the DIE's below the compilation unit. */
- get_scope_pc_bounds (cu->dies, &lowpc, &highpc, cu);
+ get_scope_pc_bounds (dies, &lowpc, &highpc, &cu);
symtab = end_symtab (highpc + baseaddr, objfile, SECT_OFF_TEXT (objfile));
@@ -2602,9 +2200,9 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu)
If the compilation is from a C file generated by language preprocessors,
do not set the language if it was already deduced by start_subfile. */
if (symtab != NULL
- && !(cu->language == language_c && symtab->language != language_c))
+ && !(cu.language == language_c && symtab->language != language_c))
{
- symtab->language = cu->language;
+ symtab->language = cu.language;
}
pst->symtab = symtab;
pst->readin = 1;
@@ -2876,8 +2474,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
if (name == NULL || !dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu))
return;
- if (cu->language == language_cplus
- || cu->language == language_java)
+ if (cu->language == language_cplus)
{
struct die_info *spec_die = die_specification (die, cu);
@@ -3675,13 +3272,10 @@ static int
is_vtable_name (const char *name, struct dwarf2_cu *cu)
{
static const char vptr[] = "_vptr";
- static const char vtable[] = "vtable";
- /* Look for the C++ and Java forms of the vtable. */
- if ((cu->language == language_java
- && strncmp (name, vtable, sizeof (vtable) - 1) == 0)
- || (strncmp (name, vptr, sizeof (vptr) - 1) == 0
- && is_cplus_marker (name[sizeof (vptr) - 1])))
+ /* C++ and some implementations of Java use this name. */
+ if (strncmp (name, vptr, sizeof (vptr) - 1) == 0
+ && is_cplus_marker (name[sizeof (vptr) - 1]))
return 1;
return 0;
@@ -3722,8 +3316,7 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
attr = dwarf2_attr (die, DW_AT_name, cu);
if (attr && DW_STRING (attr))
{
- if (cu->language == language_cplus
- || cu->language == language_java)
+ if (cu->language == language_cplus)
{
char *new_prefix = determine_class_name (die, cu);
TYPE_TAG_NAME (type) = obsavestring (new_prefix,
@@ -3771,7 +3364,7 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
/* We need to add the type field to the die immediately so we don't
infinitely recurse when dealing with pointers to the structure
type within the structure itself. */
- set_die_type (die, type, cu);
+ die->type = type;
if (die->child != NULL && ! die_is_declaration (die, cu))
{
@@ -3925,9 +3518,11 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu)
if (processing_has_namespace_info)
{
- TYPE_TAG_NAME (type) = typename_concat (&objfile->objfile_obstack,
- processing_current_prefix,
- name, cu);
+ TYPE_TAG_NAME (type) = obconcat (&objfile->objfile_obstack,
+ processing_current_prefix,
+ processing_current_prefix[0] == '\0'
+ ? "" : "::",
+ name);
}
else
{
@@ -3947,11 +3542,11 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu)
TYPE_LENGTH (type) = 0;
}
- set_die_type (die, type, cu);
+ die->type = type;
}
/* Determine the name of the type represented by DIE, which should be
- a named C++ or Java compound type. Return the name in question; the caller
+ a named C++ compound type. Return the name in question; the caller
is responsible for xfree()'ing it. */
static char *
@@ -3998,9 +3593,8 @@ determine_class_name (struct die_info *die, struct dwarf2_cu *cu)
if (new_prefix == NULL)
{
const char *name = dwarf2_name (die, cu);
- new_prefix = typename_concat (NULL, processing_current_prefix,
- name ? name : "<<anonymous>>",
- cu);
+ new_prefix = typename_concat (processing_current_prefix,
+ name ? name : "<<anonymous>>");
}
if (back_to != NULL)
@@ -4113,8 +3707,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
{
index_type = dwarf2_fundamental_type (objfile, FT_INTEGER, cu);
range_type = create_range_type (NULL, index_type, 0, -1);
- set_die_type (die, create_array_type (NULL, element_type, range_type),
- cu);
+ die->type = create_array_type (NULL, element_type, range_type);
return;
}
@@ -4174,7 +3767,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
do_cleanups (back_to);
/* Install the type in the die. */
- set_die_type (die, type, cu);
+ die->type = type;
}
static enum dwarf_array_dim_ordering
@@ -4268,7 +3861,6 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu)
const char *name;
int is_anonymous;
struct die_info *current_die;
- struct cleanup *back_to = make_cleanup (null_cleanup, 0);
name = namespace_name (die, &is_anonymous, cu);
@@ -4280,8 +3872,14 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu)
}
else
{
- char *temp_name = typename_concat (NULL, previous_prefix, name, cu);
- make_cleanup (xfree, temp_name);
+ /* We need temp_name around because processing_current_prefix
+ is a const char *. */
+ char *temp_name = alloca (strlen (previous_prefix)
+ + 2 + strlen(name) + 1);
+ strcpy (temp_name, previous_prefix);
+ strcat (temp_name, "::");
+ strcat (temp_name, name);
+
processing_current_prefix = temp_name;
}
@@ -4301,7 +3899,7 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu)
TYPE_TAG_NAME (type) = TYPE_NAME (type);
new_symbol (die, type, cu);
- set_die_type (die, type, cu);
+ die->type = type;
if (is_anonymous)
cp_add_using_directive (processing_current_prefix,
@@ -4321,7 +3919,6 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu)
}
processing_current_prefix = previous_prefix;
- do_cleanups (back_to);
}
/* Return the name of the namespace represented by DIE. Set
@@ -4408,7 +4005,7 @@ read_tag_pointer_type (struct die_info *die, struct dwarf2_cu *cu)
}
TYPE_LENGTH (type) = byte_size;
- set_die_type (die, type, cu);
+ die->type = type;
}
/* Extract all information from a DW_TAG_ptr_to_member_type DIE and add to
@@ -4432,7 +4029,7 @@ read_tag_ptr_to_member_type (struct die_info *die, struct dwarf2_cu *cu)
domain = die_containing_type (die, cu);
smash_to_member_type (type, domain, to_type);
- set_die_type (die, type, cu);
+ die->type = type;
}
/* Extract all information from a DW_TAG_reference_type DIE and add to
@@ -4460,7 +4057,7 @@ read_tag_reference_type (struct die_info *die, struct dwarf2_cu *cu)
{
TYPE_LENGTH (type) = cu_header->addr_size;
}
- set_die_type (die, type, cu);
+ die->type = type;
}
static void
@@ -4474,8 +4071,7 @@ read_tag_const_type (struct die_info *die, struct dwarf2_cu *cu)
}
base_type = die_type (die, cu);
- set_die_type (die, make_cv_type (1, TYPE_VOLATILE (base_type), base_type, 0),
- cu);
+ die->type = make_cv_type (1, TYPE_VOLATILE (base_type), base_type, 0);
}
static void
@@ -4489,8 +4085,7 @@ read_tag_volatile_type (struct die_info *die, struct dwarf2_cu *cu)
}
base_type = die_type (die, cu);
- set_die_type (die, make_cv_type (TYPE_CONST (base_type), 1, base_type, 0),
- cu);
+ die->type = make_cv_type (TYPE_CONST (base_type), 1, base_type, 0);
}
/* Extract all information from a DW_TAG_string_type DIE and add to
@@ -4542,7 +4137,7 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
char_type = dwarf2_fundamental_type (objfile, FT_CHAR, cu);
type = create_string_type (char_type, range_type);
}
- set_die_type (die, type, cu);
+ die->type = type;
}
/* Handle DIES due to C code like:
@@ -4569,13 +4164,12 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
return;
}
type = die_type (die, cu);
- ftype = make_function_type (type, (struct type **) 0);
+ ftype = lookup_function_type (type);
- /* All functions in C++ and Java have prototypes. */
+ /* All functions in C++ have prototypes. */
attr = dwarf2_attr (die, DW_AT_prototyped, cu);
if ((attr && (DW_UNSND (attr) != 0))
- || cu->language == language_cplus
- || cu->language == language_java)
+ || cu->language == language_cplus)
TYPE_FLAGS (ftype) |= TYPE_FLAG_PROTOTYPED;
if (die->child != NULL)
@@ -4624,7 +4218,7 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
}
}
- set_die_type (die, ftype, cu);
+ die->type = ftype;
}
static void
@@ -4641,9 +4235,7 @@ read_typedef (struct die_info *die, struct dwarf2_cu *cu)
{
name = DW_STRING (attr);
}
- set_die_type (die, init_type (TYPE_CODE_TYPEDEF, 0,
- TYPE_FLAG_TARGET_STUB, name, objfile),
- cu);
+ die->type = init_type (TYPE_CODE_TYPEDEF, 0, TYPE_FLAG_TARGET_STUB, name, objfile);
TYPE_TARGET_TYPE (die->type) = die_type (die, cu);
}
}
@@ -4731,7 +4323,7 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu)
{
type = dwarf_base_type (encoding, size, cu);
}
- set_die_type (die, type, cu);
+ die->type = type;
}
/* Read the given DW_AT_subrange DIE. */
@@ -4766,9 +4358,6 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
low = 1;
}
- /* FIXME: For variable sized arrays either of these could be
- a variable rather than a constant value. We'll allow it,
- but we don't know how to handle it. */
attr = dwarf2_attr (die, DW_AT_lower_bound, cu);
if (attr)
low = dwarf2_get_attr_constant_value (attr, 0);
@@ -4805,7 +4394,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
if (attr)
TYPE_LENGTH (range_type) = DW_UNSND (attr);
- set_die_type (die, range_type, cu);
+ die->type = range_type;
}
@@ -4814,6 +4403,10 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
static struct die_info *
read_comp_unit (char *info_ptr, bfd *abfd, struct dwarf2_cu *cu)
{
+ /* Reset die reference table; we are
+ building new ones now. */
+ dwarf2_empty_hash_tables ();
+
return read_die_and_children (info_ptr, abfd, cu, &info_ptr, NULL);
}
@@ -4834,7 +4427,7 @@ read_die_and_children (char *info_ptr, bfd *abfd,
int has_children;
cur_ptr = read_full_die (&die, abfd, info_ptr, cu, &has_children);
- store_in_ref_table (die->offset, die, cu);
+ store_in_ref_table (die->offset, die);
if (has_children)
{
@@ -4913,6 +4506,19 @@ free_die_list (struct die_info *dies)
}
}
+static void
+do_free_die_list_cleanup (void *dies)
+{
+ free_die_list (dies);
+}
+
+static struct cleanup *
+make_cleanup_free_die_list (struct die_info *dies)
+{
+ return make_cleanup (do_free_die_list_cleanup, dies);
+}
+
+
/* Read the contents of the section at OFFSET and of size SIZE from the
object file specified by OBJFILE into the objfile_obstack and return it. */
@@ -5001,17 +4607,6 @@ dwarf2_read_abbrevs (bfd *abfd, struct dwarf2_cu *cu)
= xrealloc (cur_attrs, (allocated_attrs
* sizeof (struct attr_abbrev)));
}
-
- /* Record whether this compilation unit might have
- inter-compilation-unit references. If we don't know what form
- this attribute will have, then it might potentially be a
- DW_FORM_ref_addr, so we conservatively expect inter-CU
- references. */
-
- if (abbrev_form == DW_FORM_ref_addr
- || abbrev_form == DW_FORM_indirect)
- cu->has_form_ref_addr = 1;
-
cur_attrs[cur_abbrev->num_attrs].name = abbrev_name;
cur_attrs[cur_abbrev->num_attrs++].form = abbrev_form;
abbrev_name = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
@@ -5225,8 +4820,7 @@ load_partial_dies (bfd *abfd, char *info_ptr, int building_psymtab,
else if (building_psymtab)
add_psymbol_to_list (part_die->name, strlen (part_die->name),
VAR_DOMAIN, LOC_CONST,
- (cu->language == language_cplus
- || cu->language == language_java)
+ cu->language == language_cplus
? &cu->objfile->global_psymbols
: &cu->objfile->static_psymbols,
0, (CORE_ADDR) 0, cu->language, cu->objfile);
@@ -5452,25 +5046,20 @@ find_partial_die_in_comp_unit (unsigned long offset, struct dwarf2_cu *cu)
/* Find a partial DIE at OFFSET, which may or may not be in CU. */
static struct partial_die_info *
-find_partial_die (unsigned long offset, struct dwarf2_cu *cu)
+find_partial_die (unsigned long offset, struct dwarf2_cu *cu,
+ struct dwarf2_cu **target_cu)
{
struct dwarf2_per_cu_data *per_cu;
if (offset >= cu->header.offset
&& offset < cu->header.offset + cu->header.length)
- return find_partial_die_in_comp_unit (offset, cu);
-
- per_cu = dwarf2_find_containing_comp_unit (offset, cu->objfile);
-
- if (per_cu->cu == NULL)
{
- load_comp_unit (per_cu, cu->objfile);
- per_cu->cu->read_in_chain = dwarf2_per_objfile->read_in_chain;
- dwarf2_per_objfile->read_in_chain = per_cu;
+ *target_cu = cu;
+ return find_partial_die_in_comp_unit (offset, cu);
}
- per_cu->cu->last_used = 0;
- return find_partial_die_in_comp_unit (offset, per_cu->cu);
+ internal_error (__FILE__, __LINE__,
+ "unsupported inter-compilation-unit reference");
}
/* Adjust PART_DIE before generating a symbol for it. This function
@@ -5486,10 +5075,11 @@ fixup_partial_die (struct partial_die_info *part_die,
if (part_die->name == NULL && part_die->has_specification)
{
struct partial_die_info *spec_die;
+ struct dwarf2_cu *spec_cu;
- spec_die = find_partial_die (part_die->spec_offset, cu);
+ spec_die = find_partial_die (part_die->spec_offset, cu, &spec_cu);
- fixup_partial_die (spec_die, cu);
+ fixup_partial_die (spec_die, spec_cu);
if (spec_die->name)
{
@@ -5563,38 +5153,6 @@ read_full_die (struct die_info **diep, bfd *abfd, char *info_ptr,
{
info_ptr = read_attribute (&die->attrs[i], &abbrev->attrs[i],
abfd, info_ptr, cu);
-
- /* If this attribute is an absolute reference to a different
- compilation unit, make sure that compilation unit is loaded
- also. */
- if (die->attrs[i].form == DW_FORM_ref_addr
- && (DW_ADDR (&die->attrs[i]) < cu->header.offset
- || (DW_ADDR (&die->attrs[i])
- >= cu->header.offset + cu->header.length)))
- {
- struct dwarf2_per_cu_data *per_cu;
- per_cu = dwarf2_find_containing_comp_unit (DW_ADDR (&die->attrs[i]),
- cu->objfile);
-
- /* Mark the dependence relation so that we don't flush PER_CU
- too early. */
- dwarf2_add_dependence (cu, per_cu);
-
- /* If it's already on the queue, we have nothing to do. */
- if (per_cu->queued)
- continue;
-
- /* If the compilation unit is already loaded, just mark it as
- used. */
- if (per_cu->cu != NULL)
- {
- per_cu->cu->last_used = 0;
- continue;
- }
-
- /* Add it to the queue. */
- queue_comp_unit (per_cu);
- }
}
*diep = die;
@@ -5691,24 +5249,23 @@ read_attribute_value (struct attribute *attr, unsigned form,
info_ptr += bytes_read;
break;
case DW_FORM_ref1:
- DW_ADDR (attr) = cu->header.offset + read_1_byte (abfd, info_ptr);
+ DW_UNSND (attr) = read_1_byte (abfd, info_ptr);
info_ptr += 1;
break;
case DW_FORM_ref2:
- DW_ADDR (attr) = cu->header.offset + read_2_bytes (abfd, info_ptr);
+ DW_UNSND (attr) = read_2_bytes (abfd, info_ptr);
info_ptr += 2;
break;
case DW_FORM_ref4:
- DW_ADDR (attr) = cu->header.offset + read_4_bytes (abfd, info_ptr);
+ DW_UNSND (attr) = read_4_bytes (abfd, info_ptr);
info_ptr += 4;
break;
case DW_FORM_ref8:
- DW_ADDR (attr) = cu->header.offset + read_8_bytes (abfd, info_ptr);
+ DW_UNSND (attr) = read_8_bytes (abfd, info_ptr);
info_ptr += 8;
break;
case DW_FORM_ref_udata:
- DW_ADDR (attr) = (cu->header.offset
- + read_unsigned_leb128 (abfd, info_ptr, &bytes_read));
+ DW_UNSND (attr) = read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
info_ptr += bytes_read;
break;
case DW_FORM_indirect:
@@ -6094,8 +5651,6 @@ set_cu_language (unsigned int lang, struct dwarf2_cu *cu)
break;
case DW_LANG_Ada83:
case DW_LANG_Ada95:
- cu->language = language_ada;
- break;
case DW_LANG_Cobol74:
case DW_LANG_Cobol85:
case DW_LANG_Pascal83:
@@ -6118,14 +5673,21 @@ dwarf2_attr (struct die_info *die, unsigned int name, struct dwarf2_cu *cu)
for (i = 0; i < die->num_attrs; ++i)
{
if (die->attrs[i].name == name)
- return &die->attrs[i];
+ {
+ return &die->attrs[i];
+ }
if (die->attrs[i].name == DW_AT_specification
|| die->attrs[i].name == DW_AT_abstract_origin)
spec = &die->attrs[i];
}
-
if (spec)
- return dwarf2_attr (follow_die_ref (die, spec, cu), name, cu);
+ {
+ struct die_info *ref_die =
+ follow_die_ref (dwarf2_get_ref_die_offset (spec, cu));
+
+ if (ref_die)
+ return dwarf2_attr (ref_die, name, cu);
+ }
return NULL;
}
@@ -6167,7 +5729,7 @@ die_specification (struct die_info *die, struct dwarf2_cu *cu)
if (spec_attr == NULL)
return NULL;
else
- return follow_die_ref (die, spec_attr, cu);
+ return follow_die_ref (dwarf2_get_ref_die_offset (spec_attr, cu));
}
/* Free the line_header structure *LH, and any arrays and strings it
@@ -6869,8 +6431,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
read_structure_type, and the correct name is saved in
the type. */
- if (cu->language == language_cplus
- || cu->language == language_java)
+ if (cu->language == language_cplus)
{
struct type *type = SYMBOL_TYPE (sym);
@@ -6887,7 +6448,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
}
{
- /* NOTE: carlton/2003-11-10: C++ and Java class symbols shouldn't
+ /* NOTE: carlton/2003-11-10: C++ class symbols shouldn't
really ever be static objects: otherwise, if you try
to, say, break of a class's method and you're in a file
which doesn't mention that class, it won't work unless
@@ -6898,18 +6459,15 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
struct pending **list_to_add;
list_to_add = (cu->list_in_scope == &file_symbols
- && (cu->language == language_cplus
- || cu->language == language_java)
+ && cu->language == language_cplus
? &global_symbols : cu->list_in_scope);
add_symbol_to_list (sym, list_to_add);
/* The semantics of C++ state that "struct foo { ... }" also
- defines a typedef for "foo". A Java class declaration also
- defines a typedef for the class. Synthesize a typedef symbol
- so that "ptype foo" works as expected. */
- if (cu->language == language_cplus
- || cu->language == language_java)
+ defines a typedef for "foo". Synthesize a typedef symbol so
+ that "ptype foo" works as expected. */
+ if (cu->language == language_cplus)
{
struct symbol *typedef_sym = (struct symbol *)
obstack_alloc (&objfile->objfile_obstack,
@@ -6929,9 +6487,10 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
if (processing_has_namespace_info
&& processing_current_prefix[0] != '\0')
{
- SYMBOL_LINKAGE_NAME (sym) = typename_concat (&objfile->objfile_obstack,
- processing_current_prefix,
- name, cu);
+ SYMBOL_LINKAGE_NAME (sym) = obconcat (&objfile->objfile_obstack,
+ processing_current_prefix,
+ "::",
+ name);
}
SYMBOL_CLASS (sym) = LOC_TYPEDEF;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
@@ -6947,9 +6506,10 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
if (processing_has_namespace_info
&& processing_current_prefix[0] != '\0')
{
- SYMBOL_LINKAGE_NAME (sym) = typename_concat (&objfile->objfile_obstack,
- processing_current_prefix,
- name, cu);
+ SYMBOL_LINKAGE_NAME (sym) = obconcat (&objfile->objfile_obstack,
+ processing_current_prefix,
+ "::",
+ name);
}
attr = dwarf2_attr (die, DW_AT_const_value, cu);
if (attr)
@@ -6963,8 +6523,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
struct pending **list_to_add;
list_to_add = (cu->list_in_scope == &file_symbols
- && (cu->language == language_cplus
- || cu->language == language_java)
+ && cu->language == language_cplus
? &global_symbols : cu->list_in_scope);
add_symbol_to_list (sym, list_to_add);
@@ -7098,6 +6657,7 @@ die_type (struct die_info *die, struct dwarf2_cu *cu)
struct type *type;
struct attribute *type_attr;
struct die_info *type_die;
+ unsigned int ref;
type_attr = dwarf2_attr (die, DW_AT_type, cu);
if (!type_attr)
@@ -7106,8 +6666,16 @@ die_type (struct die_info *die, struct dwarf2_cu *cu)
return dwarf2_fundamental_type (cu->objfile, FT_VOID, cu);
}
else
- type_die = follow_die_ref (die, type_attr, cu);
-
+ {
+ ref = dwarf2_get_ref_die_offset (type_attr, cu);
+ type_die = follow_die_ref (ref);
+ if (!type_die)
+ {
+ error ("Dwarf Error: Cannot find referent at offset %d [in module %s]",
+ ref, cu->objfile->name);
+ return NULL;
+ }
+ }
type = tag_type_to_type (type_die, cu);
if (!type)
{
@@ -7127,11 +6695,19 @@ die_containing_type (struct die_info *die, struct dwarf2_cu *cu)
struct type *type = NULL;
struct attribute *type_attr;
struct die_info *type_die = NULL;
+ unsigned int ref;
type_attr = dwarf2_attr (die, DW_AT_containing_type, cu);
if (type_attr)
{
- type_die = follow_die_ref (die, type_attr, cu);
+ ref = dwarf2_get_ref_die_offset (type_attr, cu);
+ type_die = follow_die_ref (ref);
+ if (!type_die)
+ {
+ error ("Dwarf Error: Cannot find referent at offset %d [in module %s]", ref,
+ cu->objfile->name);
+ return NULL;
+ }
type = tag_type_to_type (type_die, cu);
}
if (!type)
@@ -7144,6 +6720,24 @@ die_containing_type (struct die_info *die, struct dwarf2_cu *cu)
return type;
}
+#if 0
+static struct type *
+type_at_offset (unsigned int offset, struct dwarf2_cu *cu)
+{
+ struct die_info *die;
+ struct type *type;
+
+ die = follow_die_ref (offset);
+ if (!die)
+ {
+ error ("Dwarf Error: Cannot find type referent at offset %d.", offset);
+ return NULL;
+ }
+ type = tag_type_to_type (die, cu);
+ return type;
+}
+#endif
+
static struct type *
tag_type_to_type (struct die_info *die, struct dwarf2_cu *cu)
{
@@ -7238,8 +6832,7 @@ determine_prefix (struct die_info *die, struct dwarf2_cu *cu)
{
struct die_info *parent;
- if (cu->language != language_cplus
- && cu->language != language_java)
+ if (cu->language != language_cplus)
return NULL;
parent = die->parent;
@@ -7263,10 +6856,9 @@ determine_prefix (struct die_info *die, struct dwarf2_cu *cu)
{
int dummy;
char *parent_prefix = determine_prefix (parent, cu);
- char *retval = typename_concat (NULL, parent_prefix,
+ char *retval = typename_concat (parent_prefix,
namespace_name (parent, &dummy,
- cu),
- cu);
+ cu));
xfree (parent_prefix);
return retval;
}
@@ -7299,47 +6891,25 @@ determine_prefix (struct die_info *die, struct dwarf2_cu *cu)
}
}
-/* Return a newly-allocated string formed by concatenating PREFIX and
- SUFFIX with appropriate separator. If PREFIX or SUFFIX is NULL or empty, then
- simply copy the SUFFIX or PREFIX, respectively. If OBS is non-null,
- perform an obconcat, otherwise allocate storage for the result. The CU argument
- is used to determine the language and hence, the appropriate separator. */
-
-#define MAX_SEP_LEN 2 /* sizeof ("::") */
+/* Return a newly-allocated string formed by concatenating PREFIX,
+ "::", and SUFFIX, except that if PREFIX is NULL or the empty
+ string, just return a copy of SUFFIX. */
static char *
-typename_concat (struct obstack *obs, const char *prefix, const char *suffix,
- struct dwarf2_cu *cu)
+typename_concat (const char *prefix, const char *suffix)
{
- char *sep;
-
- if (suffix == NULL || suffix[0] == '\0' || prefix == NULL || prefix[0] == '\0')
- sep = "";
- else if (cu->language == language_java)
- sep = ".";
+ if (prefix == NULL || prefix[0] == '\0')
+ return xstrdup (suffix);
else
- sep = "::";
-
- if (obs == NULL)
{
- char *retval = xmalloc (strlen (prefix) + MAX_SEP_LEN + strlen (suffix) + 1);
- retval[0] = '\0';
-
- if (prefix)
- {
- strcpy (retval, prefix);
- strcat (retval, sep);
- }
- if (suffix)
- strcat (retval, suffix);
-
+ char *retval = xmalloc (strlen (prefix) + 2 + strlen (suffix) + 1);
+
+ strcpy (retval, prefix);
+ strcat (retval, "::");
+ strcat (retval, suffix);
+
return retval;
}
- else
- {
- /* We have an obstack. */
- return obconcat (obs, prefix, sep, suffix);
- }
}
static struct type *
@@ -7497,12 +7067,21 @@ static struct die_info *
dwarf2_extension (struct die_info *die, struct dwarf2_cu *cu)
{
struct attribute *attr;
+ struct die_info *extension_die;
+ unsigned int ref;
attr = dwarf2_attr (die, DW_AT_extension, cu);
if (attr == NULL)
return NULL;
- return follow_die_ref (die, attr, cu);
+ ref = dwarf2_get_ref_die_offset (attr, cu);
+ extension_die = follow_die_ref (ref);
+ if (!extension_die)
+ {
+ error ("Dwarf Error: Cannot find referent at offset %d.", ref);
+ }
+
+ return extension_die;
}
/* Convert a DIE tag into its string name. */
@@ -8339,16 +7918,13 @@ dump_die (struct die_info *die)
case DW_FORM_block1:
fprintf_unfiltered (gdb_stderr, "block: size %d", DW_BLOCK (&die->attrs[i])->size);
break;
- case DW_FORM_ref1:
- case DW_FORM_ref2:
- case DW_FORM_ref4:
- fprintf_unfiltered (gdb_stderr, "constant ref: %ld (adjusted)",
- (long) (DW_ADDR (&die->attrs[i])));
- break;
case DW_FORM_data1:
case DW_FORM_data2:
case DW_FORM_data4:
case DW_FORM_data8:
+ case DW_FORM_ref1:
+ case DW_FORM_ref2:
+ case DW_FORM_ref4:
case DW_FORM_udata:
case DW_FORM_sdata:
fprintf_unfiltered (gdb_stderr, "constant: %ld", DW_UNSND (&die->attrs[i]));
@@ -8392,16 +7968,22 @@ dump_die_list (struct die_info *die)
}
static void
-store_in_ref_table (unsigned int offset, struct die_info *die,
- struct dwarf2_cu *cu)
+store_in_ref_table (unsigned int offset, struct die_info *die)
{
int h;
struct die_info *old;
h = (offset % REF_HASH_SIZE);
- old = cu->die_ref_table[h];
+ old = die_ref_table[h];
die->next_ref = old;
- cu->die_ref_table[h] = die;
+ die_ref_table[h] = die;
+}
+
+
+static void
+dwarf2_empty_hash_tables (void)
+{
+ memset (die_ref_table, 0, sizeof (die_ref_table));
}
static unsigned int
@@ -8412,12 +7994,14 @@ dwarf2_get_ref_die_offset (struct attribute *attr, struct dwarf2_cu *cu)
switch (attr->form)
{
case DW_FORM_ref_addr:
+ result = DW_ADDR (attr);
+ break;
case DW_FORM_ref1:
case DW_FORM_ref2:
case DW_FORM_ref4:
case DW_FORM_ref8:
case DW_FORM_ref_udata:
- result = DW_ADDR (attr);
+ result = cu->header.offset + DW_UNSND (attr);
break;
default:
complaint (&symfile_complaints,
@@ -8450,41 +8034,21 @@ dwarf2_get_attr_constant_value (struct attribute *attr, int default_value)
}
static struct die_info *
-follow_die_ref (struct die_info *src_die, struct attribute *attr,
- struct dwarf2_cu *cu)
+follow_die_ref (unsigned int offset)
{
struct die_info *die;
- unsigned int offset;
int h;
- struct die_info temp_die;
- struct dwarf2_cu *target_cu;
-
- offset = dwarf2_get_ref_die_offset (attr, cu);
-
- if (DW_ADDR (attr) < cu->header.offset
- || DW_ADDR (attr) >= cu->header.offset + cu->header.length)
- {
- struct dwarf2_per_cu_data *per_cu;
- per_cu = dwarf2_find_containing_comp_unit (DW_ADDR (attr),
- cu->objfile);
- target_cu = per_cu->cu;
- }
- else
- target_cu = cu;
h = (offset % REF_HASH_SIZE);
- die = target_cu->die_ref_table[h];
+ die = die_ref_table[h];
while (die)
{
if (die->offset == offset)
- return die;
+ {
+ return die;
+ }
die = die->next_ref;
}
-
- error ("Dwarf Error: Cannot find DIE at 0x%lx referenced from DIE "
- "at 0x%lx [in module %s]",
- (long) src_die->offset, (long) offset, cu->objfile->name);
-
return NULL;
}
@@ -9213,85 +8777,9 @@ dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym,
}
}
-/* Locate the compilation unit from CU's objfile which contains the
- DIE at OFFSET. Raises an error on failure. */
-
-static struct dwarf2_per_cu_data *
-dwarf2_find_containing_comp_unit (unsigned long offset,
- struct objfile *objfile)
-{
- struct dwarf2_per_cu_data *this_cu;
- int low, high;
-
- low = 0;
- high = dwarf2_per_objfile->n_comp_units - 1;
- while (high > low)
- {
- int mid = low + (high - low) / 2;
- if (dwarf2_per_objfile->all_comp_units[mid]->offset >= offset)
- high = mid;
- else
- low = mid + 1;
- }
- gdb_assert (low == high);
- if (dwarf2_per_objfile->all_comp_units[low]->offset > offset)
- {
- if (low == 0)
- error ("Dwarf Error: could not find partial DIE containing "
- "offset 0x%lx [in module %s]",
- (long) offset, bfd_get_filename (objfile->obfd));
-
- gdb_assert (dwarf2_per_objfile->all_comp_units[low-1]->offset <= offset);
- return dwarf2_per_objfile->all_comp_units[low-1];
- }
- else
- {
- this_cu = dwarf2_per_objfile->all_comp_units[low];
- if (low == dwarf2_per_objfile->n_comp_units - 1
- && offset >= this_cu->offset + this_cu->length)
- error ("invalid dwarf2 offset %ld", offset);
- gdb_assert (offset < this_cu->offset + this_cu->length);
- return this_cu;
- }
-}
-
-/* Locate the compilation unit from OBJFILE which is located at exactly
- OFFSET. Raises an error on failure. */
-
-static struct dwarf2_per_cu_data *
-dwarf2_find_comp_unit (unsigned long offset, struct objfile *objfile)
-{
- struct dwarf2_per_cu_data *this_cu;
- this_cu = dwarf2_find_containing_comp_unit (offset, objfile);
- if (this_cu->offset != offset)
- error ("no compilation unit with offset %ld\n", offset);
- return this_cu;
-}
-
-/* Release one cached compilation unit, CU. We unlink it from the tree
- of compilation units, but we don't remove it from the read_in_chain;
- the caller is responsible for that. */
-
-static void
-free_one_comp_unit (void *data)
-{
- struct dwarf2_cu *cu = data;
-
- if (cu->per_cu != NULL)
- cu->per_cu->cu = NULL;
- cu->per_cu = NULL;
-
- obstack_free (&cu->comp_unit_obstack, NULL);
- if (cu->dies)
- free_die_list (cu->dies);
-
- xfree (cu);
-}
-
/* This cleanup function is passed the address of a dwarf2_cu on the stack
- when we're finished with it. We can't free the pointer itself, but be
- sure to unlink it from the cache. Also release any associated storage
- and perform cache maintenance.
+ when we're finished with it. We can't free the pointer itself, but
+ release any associated storage.
Only used during partial symbol parsing. */
@@ -9302,263 +8790,6 @@ free_stack_comp_unit (void *data)
obstack_free (&cu->comp_unit_obstack, NULL);
cu->partial_dies = NULL;
-
- if (cu->per_cu != NULL)
- {
- /* This compilation unit is on the stack in our caller, so we
- should not xfree it. Just unlink it. */
- cu->per_cu->cu = NULL;
- cu->per_cu = NULL;
-
- /* If we had a per-cu pointer, then we may have other compilation
- units loaded, so age them now. */
- age_cached_comp_units ();
- }
-}
-
-/* Free all cached compilation units. */
-
-static void
-free_cached_comp_units (void *data)
-{
- struct dwarf2_per_cu_data *per_cu, **last_chain;
-
- per_cu = dwarf2_per_objfile->read_in_chain;
- last_chain = &dwarf2_per_objfile->read_in_chain;
- while (per_cu != NULL)
- {
- struct dwarf2_per_cu_data *next_cu;
-
- next_cu = per_cu->cu->read_in_chain;
-
- free_one_comp_unit (per_cu->cu);
- *last_chain = next_cu;
-
- per_cu = next_cu;
- }
-}
-
-/* Increase the age counter on each cached compilation unit, and free
- any that are too old. */
-
-static void
-age_cached_comp_units (void)
-{
- struct dwarf2_per_cu_data *per_cu, **last_chain;
-
- dwarf2_clear_marks (dwarf2_per_objfile->read_in_chain);
- per_cu = dwarf2_per_objfile->read_in_chain;
- while (per_cu != NULL)
- {
- per_cu->cu->last_used ++;
- if (per_cu->cu->last_used <= dwarf2_max_cache_age)
- dwarf2_mark (per_cu->cu);
- per_cu = per_cu->cu->read_in_chain;
- }
-
- per_cu = dwarf2_per_objfile->read_in_chain;
- last_chain = &dwarf2_per_objfile->read_in_chain;
- while (per_cu != NULL)
- {
- struct dwarf2_per_cu_data *next_cu;
-
- next_cu = per_cu->cu->read_in_chain;
-
- if (!per_cu->cu->mark)
- {
- free_one_comp_unit (per_cu->cu);
- *last_chain = next_cu;
- }
- else
- last_chain = &per_cu->cu->read_in_chain;
-
- per_cu = next_cu;
- }
-}
-
-/* Remove a single compilation unit from the cache. */
-
-static void
-free_one_cached_comp_unit (void *target_cu)
-{
- struct dwarf2_per_cu_data *per_cu, **last_chain;
-
- per_cu = dwarf2_per_objfile->read_in_chain;
- last_chain = &dwarf2_per_objfile->read_in_chain;
- while (per_cu != NULL)
- {
- struct dwarf2_per_cu_data *next_cu;
-
- next_cu = per_cu->cu->read_in_chain;
-
- if (per_cu->cu == target_cu)
- {
- free_one_comp_unit (per_cu->cu);
- *last_chain = next_cu;
- break;
- }
- else
- last_chain = &per_cu->cu->read_in_chain;
-
- per_cu = next_cu;
- }
-}
-
-/* A pair of DIE offset and GDB type pointer. We store these
- in a hash table separate from the DIEs, and preserve them
- when the DIEs are flushed out of cache. */
-
-struct dwarf2_offset_and_type
-{
- unsigned int offset;
- struct type *type;
-};
-
-/* Hash function for a dwarf2_offset_and_type. */
-
-static hashval_t
-offset_and_type_hash (const void *item)
-{
- const struct dwarf2_offset_and_type *ofs = item;
- return ofs->offset;
-}
-
-/* Equality function for a dwarf2_offset_and_type. */
-
-static int
-offset_and_type_eq (const void *item_lhs, const void *item_rhs)
-{
- const struct dwarf2_offset_and_type *ofs_lhs = item_lhs;
- const struct dwarf2_offset_and_type *ofs_rhs = item_rhs;
- return ofs_lhs->offset == ofs_rhs->offset;
-}
-
-/* Set the type associated with DIE to TYPE. Save it in CU's hash
- table if necessary. */
-
-static void
-set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
-{
- struct dwarf2_offset_and_type **slot, ofs;
-
- die->type = type;
-
- if (cu->per_cu == NULL)
- return;
-
- if (cu->per_cu->type_hash == NULL)
- cu->per_cu->type_hash
- = htab_create_alloc_ex (cu->header.length / 24,
- offset_and_type_hash,
- offset_and_type_eq,
- NULL,
- &cu->objfile->objfile_obstack,
- hashtab_obstack_allocate,
- dummy_obstack_deallocate);
-
- ofs.offset = die->offset;
- ofs.type = type;
- slot = (struct dwarf2_offset_and_type **)
- htab_find_slot_with_hash (cu->per_cu->type_hash, &ofs, ofs.offset, INSERT);
- *slot = obstack_alloc (&cu->objfile->objfile_obstack, sizeof (**slot));
- **slot = ofs;
-}
-
-/* Find the type for DIE in TYPE_HASH, or return NULL if DIE does not
- have a saved type. */
-
-static struct type *
-get_die_type (struct die_info *die, htab_t type_hash)
-{
- struct dwarf2_offset_and_type *slot, ofs;
-
- ofs.offset = die->offset;
- slot = htab_find_with_hash (type_hash, &ofs, ofs.offset);
- if (slot)
- return slot->type;
- else
- return NULL;
-}
-
-/* Restore the types of the DIE tree starting at START_DIE from the hash
- table saved in CU. */
-
-static void
-reset_die_and_siblings_types (struct die_info *start_die, struct dwarf2_cu *cu)
-{
- struct die_info *die;
-
- if (cu->per_cu->type_hash == NULL)
- return;
-
- for (die = start_die; die != NULL; die = die->sibling)
- {
- die->type = get_die_type (die, cu->per_cu->type_hash);
- if (die->child != NULL)
- reset_die_and_siblings_types (die->child, cu);
- }
-}
-
-/* Set the mark field in CU and in every other compilation unit in the
- cache that we must keep because we are keeping CU. */
-
-/* Add a dependence relationship from CU to REF_PER_CU. */
-
-static void
-dwarf2_add_dependence (struct dwarf2_cu *cu,
- struct dwarf2_per_cu_data *ref_per_cu)
-{
- void **slot;
-
- if (cu->dependencies == NULL)
- cu->dependencies
- = htab_create_alloc_ex (5, htab_hash_pointer, htab_eq_pointer,
- NULL, &cu->comp_unit_obstack,
- hashtab_obstack_allocate,
- dummy_obstack_deallocate);
-
- slot = htab_find_slot (cu->dependencies, ref_per_cu, INSERT);
- if (*slot == NULL)
- *slot = ref_per_cu;
-}
-
-/* Set the mark field in CU and in every other compilation unit in the
- cache that we must keep because we are keeping CU. */
-
-static int
-dwarf2_mark_helper (void **slot, void *data)
-{
- struct dwarf2_per_cu_data *per_cu;
-
- per_cu = (struct dwarf2_per_cu_data *) *slot;
- if (per_cu->cu->mark)
- return 1;
- per_cu->cu->mark = 1;
-
- if (per_cu->cu->dependencies != NULL)
- htab_traverse (per_cu->cu->dependencies, dwarf2_mark_helper, NULL);
-
- return 1;
-}
-
-static void
-dwarf2_mark (struct dwarf2_cu *cu)
-{
- if (cu->mark)
- return;
- cu->mark = 1;
- if (cu->dependencies != NULL)
- htab_traverse (cu->dependencies, dwarf2_mark_helper, NULL);
-}
-
-static void
-dwarf2_clear_marks (struct dwarf2_per_cu_data *per_cu)
-{
- while (per_cu)
- {
- per_cu->cu->mark = 0;
- per_cu = per_cu->cu->read_in_chain;
- }
}
/* Allocation function for the libiberty hash table which uses an
@@ -9604,53 +8835,10 @@ partial_die_eq (const void *item_lhs, const void *item_rhs)
return part_die_lhs->offset == part_die_rhs->offset;
}
-static struct cmd_list_element *set_dwarf2_cmdlist;
-static struct cmd_list_element *show_dwarf2_cmdlist;
-
-static void
-set_dwarf2_cmd (char *args, int from_tty)
-{
- help_list (set_dwarf2_cmdlist, "maintenance set dwarf2 ", -1, gdb_stdout);
-}
-
-static void
-show_dwarf2_cmd (char *args, int from_tty)
-{
- cmd_show_list (show_dwarf2_cmdlist, from_tty, "");
-}
-
void _initialize_dwarf2_read (void);
void
_initialize_dwarf2_read (void)
{
dwarf2_objfile_data_key = register_objfile_data ();
-
- add_prefix_cmd ("dwarf2", class_maintenance, set_dwarf2_cmd,
- "Set DWARF 2 specific variables.\n"
- "Configure DWARF 2 variables such as the cache size",
- &set_dwarf2_cmdlist, "maintenance set dwarf2 ",
- 0/*allow-unknown*/, &maintenance_set_cmdlist);
-
- add_prefix_cmd ("dwarf2", class_maintenance, show_dwarf2_cmd,
- "Show DWARF 2 specific variables\n"
- "Show DWARF 2 variables such as the cache size",
- &show_dwarf2_cmdlist, "maintenance show dwarf2 ",
- 0/*allow-unknown*/, &maintenance_show_cmdlist);
-
- add_setshow_zinteger_cmd ("max-cache-age", class_obscure,
- &dwarf2_max_cache_age,
- "Set the upper bound on the age of cached "
- "dwarf2 compilation units.",
- "Show the upper bound on the age of cached "
- "dwarf2 compilation units.",
- "A higher limit means that cached "
- "compilation units will be stored\n"
- "in memory longer, and more total memory will "
- "be used. Zero disables\n"
- "caching, which can slow down startup.",
- "The upper bound on the age of cached "
- "dwarf2 compilation units is %d.",
- NULL, NULL, &set_dwarf2_cmdlist,
- &show_dwarf2_cmdlist);
}
diff --git a/gdb/event-top.c b/gdb/event-top.c
index 39d52fe..01f1f51 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -855,11 +855,15 @@ gdb_readline2 (gdb_client_data client_data)
}
if (c == '\n')
+#ifndef CRLF_SOURCE_FILES
+ break;
+#else
{
if (input_index > 0 && result[input_index - 1] == '\r')
input_index--;
break;
}
+#endif
result[input_index++] = c;
while (input_index >= result_size)
diff --git a/gdb/exec.c b/gdb/exec.c
index f3246ca..7eaa15a 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -699,7 +699,7 @@ Specify the filename of the executable file.";
exec_ops.to_open = exec_open;
exec_ops.to_close = exec_close;
exec_ops.to_attach = find_default_attach;
- exec_ops.deprecated_xfer_memory = xfer_memory;
+ exec_ops.to_xfer_memory = xfer_memory;
exec_ops.to_files_info = exec_files_info;
exec_ops.to_insert_breakpoint = ignore;
exec_ops.to_remove_breakpoint = ignore;
diff --git a/gdb/fbsd-nat.h b/gdb/fbsd-nat.h
deleted file mode 100644
index b59cf66..0000000
--- a/gdb/fbsd-nat.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Native-dependent code for FreeBSD.
-
- Copyright 2004 Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#ifndef FBSD_NAT_H
-#define FBSD_NAT_H
-
-/* Return a the name of file that can be opened to get the symbols for
- the child process identified by PID. */
-
-extern char *fbsd_pid_to_exec_file (int pid);
-
-/* Iterate over all the memory regions in the current inferior,
- calling FUNC for each memory region. OBFD is passed as the last
- argument to FUNC. */
-
-extern int fbsd_find_memory_regions (int (*func) (CORE_ADDR, unsigned long,
- int, int, int, void *),
- void *obfd);
-
-/* Create appropriate note sections for a corefile, returning them in
- allocated memory. */
-
-extern char *fbsd_make_corefile_notes (bfd *obfd, int *note_size);
-
-#endif /* fbsd-nat.h */
diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-proc.c
index b7045d4..f021d27 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-proc.c
@@ -1,6 +1,6 @@
-/* Native-dependent code for FreeBSD.
+/* FreeBSD-specific methods for using the /proc file system.
- Copyright 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright 2002, 2003 Free Software Foundation, Inc.
This file is part of GDB.
@@ -31,13 +31,9 @@
#include <sys/types.h>
#include "elf-bfd.h"
-#include "fbsd-nat.h"
-
-/* Return a the name of file that can be opened to get the symbols for
- the child process identified by PID. */
char *
-fbsd_pid_to_exec_file (int pid)
+child_pid_to_exec_file (int pid)
{
char *path;
char *buf;
@@ -54,8 +50,8 @@ fbsd_pid_to_exec_file (int pid)
}
static int
-fbsd_read_mapping (FILE *mapfile, unsigned long *start, unsigned long *end,
- char *protection)
+read_mapping (FILE *mapfile, unsigned long *start, unsigned long *end,
+ char *protection)
{
/* FreeBSD 5.1-RELEASE uses a 256-byte buffer. */
char buf[256];
@@ -74,11 +70,7 @@ fbsd_read_mapping (FILE *mapfile, unsigned long *start, unsigned long *end,
return (ret != 0 && ret != EOF);
}
-/* Iterate over all the memory regions in the current inferior,
- calling FUNC for each memory region. OBFD is passed as the last
- argument to FUNC. */
-
-int
+static int
fbsd_find_memory_regions (int (*func) (CORE_ADDR, unsigned long,
int, int, int, void *),
void *obfd)
@@ -100,7 +92,7 @@ fbsd_find_memory_regions (int (*func) (CORE_ADDR, unsigned long,
"Reading memory regions from %s\n", mapfilename);
/* Now iterate until end-of-file. */
- while (fbsd_read_mapping (mapfile, &start, &end, &protection[0]))
+ while (read_mapping (mapfile, &start, &end, &protection[0]))
{
size = end - start;
@@ -126,10 +118,7 @@ fbsd_find_memory_regions (int (*func) (CORE_ADDR, unsigned long,
return 0;
}
-/* Create appropriate note sections for a corefile, returning them in
- allocated memory. */
-
-char *
+static char *
fbsd_make_corefile_notes (bfd *obfd, int *note_size)
{
struct gdbarch *gdbarch = current_gdbarch;
@@ -179,3 +168,14 @@ fbsd_make_corefile_notes (bfd *obfd, int *note_size)
make_cleanup (xfree, note_data);
return note_data;
}
+
+
+void
+_initialize_fbsd_proc (void)
+{
+ extern void inftarg_set_find_memory_regions ();
+ extern void inftarg_set_make_corefile_notes ();
+
+ inftarg_set_find_memory_regions (fbsd_find_memory_regions);
+ inftarg_set_make_corefile_notes (fbsd_make_corefile_notes);
+}
diff --git a/gdb/fork-child.c b/gdb/fork-child.c
index 90580ba..e1d32b0 100644
--- a/gdb/fork-child.c
+++ b/gdb/fork-child.c
@@ -1,8 +1,6 @@
/* Fork a Unix child process, and set up to debug it, for GDB.
-
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999,
- 2000, 2001, 2004 Free Software Foundation, Inc.
-
+ Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000,
+ 2001 Free Software Foundation, Inc.
Contributed by Cygnus Support.
This file is part of GDB.
@@ -36,18 +34,19 @@
#include <signal.h>
-/* This just gets used as a default if we can't find SHELL. */
+/* This just gets used as a default if we can't find SHELL */
#ifndef SHELL_FILE
#define SHELL_FILE "/bin/sh"
#endif
extern char **environ;
-/* Break up SCRATCH into an argument vector suitable for passing to
- execvp and store it in ARGV. E.g., on "run a b c d" this routine
- would get as input the string "a b c d", and as output it would
- fill in ARGV with the four arguments "a", "b", "c", "d". */
-
+/* This function breaks up an argument string into an argument
+ * vector suitable for passing to execvp().
+ * E.g., on "run a b c d" this routine would get as input
+ * the string "a b c d", and as output it would fill in argv with
+ * the four arguments "a", "b", "c", "d".
+ */
static void
breakup_args (char *scratch, char **argv)
{
@@ -55,45 +54,49 @@ breakup_args (char *scratch, char **argv)
for (;;)
{
+
/* Scan past leading separators */
while (*cp == ' ' || *cp == '\t' || *cp == '\n')
- cp++;
+ {
+ cp++;
+ }
- /* Break if at end of string. */
+ /* Break if at end of string */
if (*cp == '\0')
break;
- /* Take an arg. */
+ /* Take an arg */
*argv++ = cp;
- /* Scan for next arg separator. */
+ /* Scan for next arg separator */
cp = strchr (cp, ' ');
if (cp == NULL)
cp = strchr (cp, '\t');
if (cp == NULL)
cp = strchr (cp, '\n');
- /* No separators => end of string => break. */
+ /* No separators => end of string => break */
if (cp == NULL)
break;
- /* Replace the separator with a terminator. */
+ /* Replace the separator with a terminator */
*cp++ = '\0';
}
- /* Null-terminate the vector. */
+ /* execv requires a null-terminated arg vector */
*argv = NULL;
+
}
-/* When executing a command under the given shell, return non-zero if
- the '!' character should be escaped when embedded in a quoted
+/* When executing a command under the given shell, return non-zero
+ if the '!' character should be escaped when embedded in a quoted
command-line argument. */
static int
escape_bang_in_quoted_argument (const char *shell_file)
{
const int shell_file_len = strlen (shell_file);
-
+
/* Bang should be escaped only in C Shells. For now, simply check
that the shell name ends with 'csh', which covers at least csh
and tcsh. This should be good enough for now. */
@@ -109,14 +112,14 @@ escape_bang_in_quoted_argument (const char *shell_file)
return 0;
}
-/* Start an inferior Unix child process and sets inferior_ptid to its
- pid. EXEC_FILE is the file to run. ALLARGS is a string containing
- the arguments to the program. ENV is the environment vector to
- pass. SHELL_FILE is the shell file, or NULL if we should pick
- one. */
+/* Start an inferior Unix child process and sets inferior_ptid to its pid.
+ EXEC_FILE is the file to run.
+ ALLARGS is a string containing the arguments to the program.
+ ENV is the environment vector to pass. SHELL_FILE is the shell file,
+ or NULL if we should pick one. Errors reported with error(). */
-/* This function is NOT reentrant. Some of the variables have been
- made static to ensure that they survive the vfork call. */
+/* This function is NOT-REENTRANT. Some of the variables have been
+ made static to ensure that they survive the vfork() call. */
void
fork_inferior (char *exec_file_arg, char *allargs, char **env,
@@ -138,19 +141,20 @@ fork_inferior (char *exec_file_arg, char *allargs, char **env,
int shell = 0;
static char **argv;
- /* If no exec file handed to us, get it from the exec-file command
- -- with a good, common error message if none is specified. */
+ /* If no exec file handed to us, get it from the exec-file command -- with
+ a good, common error message if none is specified. */
exec_file = exec_file_arg;
if (exec_file == 0)
exec_file = get_exec_file (1);
- /* STARTUP_WITH_SHELL is defined in inferior.h. If 0,e we'll just
- do a fork/exec, no shell, so don't bother figuring out what
- shell. */
+ /* STARTUP_WITH_SHELL is defined in inferior.h.
+ * If 0, we'll just do a fork/exec, no shell, so don't
+ * bother figuring out what shell.
+ */
shell_file = shell_file_arg;
if (STARTUP_WITH_SHELL)
{
- /* Figure out what shell to start up the user program under. */
+ /* Figure out what shell to start up the user program under. */
if (shell_file == NULL)
shell_file = getenv ("SHELL");
if (shell_file == NULL)
@@ -158,9 +162,9 @@ fork_inferior (char *exec_file_arg, char *allargs, char **env,
shell = 1;
}
- /* Multiplying the length of exec_file by 4 is to account for the
- fact that it may expand when quoted; it is a worst-case number
- based on every character being '. */
+ /* Multiplying the length of exec_file by 4 is to account for the fact
+ that it may expand when quoted; it is a worst-case number based on
+ every character being '. */
len = 5 + 4 * strlen (exec_file) + 1 + strlen (allargs) + 1 + /*slop */ 12;
/* If desired, concat something onto the front of ALLARGS.
SHELL_COMMAND is the result. */
@@ -174,18 +178,17 @@ fork_inferior (char *exec_file_arg, char *allargs, char **env,
if (!shell)
{
- /* We're going to call execvp. Create argument vector.
- Calculate an upper bound on the length of the vector by
- assuming that every other character is a separate
- argument. */
- int argc = (strlen (allargs) + 1) / 2 + 2;
- argv = (char **) xmalloc (argc * sizeof (*argv));
+ /* We're going to call execvp. Create argv */
+ /* Largest case: every other character is a separate arg */
+ argv = (char **) xmalloc (((strlen (allargs) + 1) / (unsigned) 2 + 2) * sizeof (*argv));
argv[0] = exec_file;
breakup_args (allargs, &argv[1]);
+
}
else
{
- /* We're going to call a shell. */
+
+ /* We're going to call a shell */
/* Now add exec_file, quoting as necessary. */
@@ -195,9 +198,9 @@ fork_inferior (char *exec_file_arg, char *allargs, char **env,
strcat (shell_command, "exec ");
- /* Quoting in this style is said to work with all shells. But
- csh on IRIX 4.0.1 can't deal with it. So we only quote it if
- we need to. */
+ /* Quoting in this style is said to work with all shells. But csh
+ on IRIX 4.0.1 can't deal with it. So we only quote it if we need
+ to. */
p = exec_file;
while (1)
{
@@ -248,29 +251,32 @@ fork_inferior (char *exec_file_arg, char *allargs, char **env,
strcat (shell_command, " ");
strcat (shell_command, allargs);
+
}
- /* On some systems an exec will fail if the executable is open. */
+ /* exec is said to fail if the executable is open. */
close_exec_file ();
/* Retain a copy of our environment variables, since the child will
- replace the value of environ and if we're vforked, we have to
+ replace the value of environ and if we're vforked, we have to
restore it. */
save_our_env = environ;
/* Tell the terminal handling subsystem what tty we plan to run on;
it will just record the information for later. */
+
new_tty_prefork (inferior_io_terminal);
/* It is generally good practice to flush any possible pending stdio
- output prior to doing a fork, to avoid the possibility of both
- the parent and child flushing the same data after the fork. */
+ output prior to doing a fork, to avoid the possibility of both the
+ parent and child flushing the same data after the fork. */
+
gdb_flush (gdb_stdout);
gdb_flush (gdb_stderr);
- /* If there's any initialization of the target layers that must
- happen to prepare to handle the child we're about fork, do it
- now... */
+ /* If there's any initialization of the target layers that must happen
+ to prepare to handle the child we're about fork, do it now...
+ */
if (pre_trace_fun != NULL)
(*pre_trace_fun) ();
@@ -295,9 +301,9 @@ fork_inferior (char *exec_file_arg, char *allargs, char **env,
if (debug_setpgrp == -1)
perror ("setpgrp failed in child");
- /* Ask the tty subsystem to switch to the one we specified
- earlier (or to share the current terminal, if none was
- specified). */
+ /* Ask the tty subsystem to switch to the one we specified earlier
+ (or to share the current terminal, if none was specified). */
+
new_tty ();
/* Changing the signal handlers for the inferior after
@@ -308,15 +314,14 @@ fork_inferior (char *exec_file_arg, char *allargs, char **env,
/* "Trace me, Dr. Memory!" */
(*traceme_fun) ();
-
/* The call above set this process (the "child") as debuggable
- by the original gdb process (the "parent"). Since processes
- (unlike people) can have only one parent, if you are debugging
- gdb itself (and your debugger is thus _already_ the
- controller/parent for this child), code from here on out is
- undebuggable. Indeed, you probably got an error message
- saying "not parent". Sorry; you'll have to use print
- statements! */
+ * by the original gdb process (the "parent"). Since processes
+ * (unlike people) can have only one parent, if you are
+ * debugging gdb itself (and your debugger is thus _already_ the
+ * controller/parent for this child), code from here on out
+ * is undebuggable. Indeed, you probably got an error message
+ * saying "not parent". Sorry--you'll have to use print statements!
+ */
/* There is no execlpe call, so we have to set the environment
for our child in the global variable. If we've vforked, this
@@ -325,17 +330,19 @@ fork_inferior (char *exec_file_arg, char *allargs, char **env,
path to find $SHELL. Rich Pixley says so, and I agree. */
environ = env;
- /* If we decided above to start up with a shell, we exec the
- shell, "-c" says to interpret the next arg as a shell command
- to execute, and this command is "exec <target-program>
- <args>". "-f" means "fast startup" to the c-shell, which
- means don't do .cshrc file. Doing .cshrc may cause fork/exec
- events which will confuse debugger start-up code. */
+ /* If we decided above to start up with a shell,
+ * we exec the shell,
+ * "-c" says to interpret the next arg as a shell command
+ * to execute, and this command is "exec <target-program> <args>".
+ * "-f" means "fast startup" to the c-shell, which means
+ * don't do .cshrc file. Doing .cshrc may cause fork/exec
+ * events which will confuse debugger start-up code.
+ */
if (shell)
{
execlp (shell_file, shell_file, "-c", shell_command, (char *) 0);
- /* If we get here, it's an error. */
+ /* If we get here, it's an error */
fprintf_unfiltered (gdb_stderr, "Cannot exec %s: %s.\n", shell_file,
safe_strerror (errno));
gdb_flush (gdb_stderr);
@@ -343,14 +350,13 @@ fork_inferior (char *exec_file_arg, char *allargs, char **env,
}
else
{
- /* Otherwise, we directly exec the target program with
- execvp. */
+ /* Otherwise, we directly exec the target program with execvp. */
int i;
char *errstring;
execvp (exec_file, argv);
- /* If we get here, it's an error. */
+ /* If we get here, it's an error */
errstring = safe_strerror (errno);
fprintf_unfiltered (gdb_stderr, "Cannot exec %s ", exec_file);
@@ -363,10 +369,9 @@ fork_inferior (char *exec_file_arg, char *allargs, char **env,
i++;
}
fprintf_unfiltered (gdb_stderr, ".\n");
-#if 0
- /* This extra info seems to be useless. */
- fprintf_unfiltered (gdb_stderr, "Got error %s.\n", errstring);
-#endif
+ /* This extra info seems to be useless
+ fprintf_unfiltered (gdb_stderr, "Got error %s.\n", errstring);
+ */
gdb_flush (gdb_stderr);
_exit (0177);
}
@@ -377,21 +382,20 @@ fork_inferior (char *exec_file_arg, char *allargs, char **env,
init_thread_list ();
- /* Needed for wait_for_inferior stuff below. */
- inferior_ptid = pid_to_ptid (pid);
+ inferior_ptid = pid_to_ptid (pid); /* Needed for wait_for_inferior stuff below */
/* Now that we have a child process, make it our target, and
- initialize anything target-vector-specific that needs
- initializing. */
+ initialize anything target-vector-specific that needs initializing. */
+
(*init_trace_fun) (pid);
/* We are now in the child process of interest, having exec'd the
correct program, and are poised at the first instruction of the
new program. */
- /* Allow target dependent code to play with the new process. This
- might be used to have target-specific code initialize a variable
- in the new process prior to executing the first instruction. */
+ /* Allow target dependent code to play with the new process. This might be
+ used to have target-specific code initialize a variable in the new process
+ prior to executing the first instruction. */
TARGET_CREATE_INFERIOR_HOOK (pid);
#ifdef SOLIB_CREATE_INFERIOR_HOOK
@@ -405,16 +409,18 @@ void
startup_inferior (int ntraps)
{
int pending_execs = ntraps;
- int terminal_initted = 0;
+ int terminal_initted;
- /* The process was started by the fork that created it, but it will
- have stopped one instruction after execing the shell. Here we
- must get it up to actual execution of the real program. */
+ /* The process was started by the fork that created it,
+ but it will have stopped one instruction after execing the shell.
+ Here we must get it up to actual execution of the real program. */
clear_proceed_status ();
init_wait_for_inferior ();
+ terminal_initted = 0;
+
if (STARTUP_WITH_SHELL)
inferior_ignoring_startup_exec_events = ntraps;
else
@@ -424,14 +430,13 @@ startup_inferior (int ntraps)
while (1)
{
- /* Make wait_for_inferior be quiet. */
+ /* Make wait_for_inferior be quiet */
stop_soon = STOP_QUIETLY;
wait_for_inferior ();
if (stop_signal != TARGET_SIGNAL_TRAP)
{
- /* Let shell child handle its own signals in its own way.
- FIXME: what if child has exited? Must exit loop
- somehow. */
+ /* Let shell child handle its own signals in its own way */
+ /* FIXME, what if child has exit()ed? Must exit loop somehow */
resume (0, stop_signal);
}
else
@@ -439,10 +444,9 @@ startup_inferior (int ntraps)
/* We handle SIGTRAP, however; it means child did an exec. */
if (!terminal_initted)
{
- /* Now that the child has exec'd we know it has already
- set its process group. On POSIX systems, tcsetpgrp
- will fail with EPERM if we try it before the child's
- setpgid. */
+ /* Now that the child has exec'd we know it has already set its
+ process group. On POSIX systems, tcsetpgrp will fail with
+ EPERM if we try it before the child's setpgid. */
/* Set up the "saved terminal modes" of the inferior
based on what modes we are starting it with. */
@@ -454,10 +458,11 @@ startup_inferior (int ntraps)
terminal_initted = 1;
}
- if (--pending_execs == 0)
+ pending_execs = pending_execs - 1;
+ if (0 == pending_execs)
break;
- resume (0, TARGET_SIGNAL_0); /* Just make it go on. */
+ resume (0, TARGET_SIGNAL_0); /* Just make it go on */
}
}
stop_soon = NO_STOP_QUIETLY;
diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c
index 30e1928..7bc09f0 100644
--- a/gdb/frv-tdep.c
+++ b/gdb/frv-tdep.c
@@ -1293,8 +1293,8 @@ frv_check_watch_resources (int type, int cnt, int ot)
}
-int
-frv_stopped_data_address (CORE_ADDR *addr_p)
+CORE_ADDR
+frv_stopped_data_address (void)
{
CORE_ADDR brr, dbar0, dbar1, dbar2, dbar3;
@@ -1305,24 +1305,15 @@ frv_stopped_data_address (CORE_ADDR *addr_p)
dbar3 = read_register (dbar3_regnum);
if (brr & (1<<11))
- *addr_p = dbar0;
+ return dbar0;
else if (brr & (1<<10))
- *addr_p = dbar1;
+ return dbar1;
else if (brr & (1<<9))
- *addr_p = dbar2;
+ return dbar2;
else if (brr & (1<<8))
- *addr_p = dbar3;
+ return dbar3;
else
return 0;
-
- return 1;
-}
-
-int
-frv_have_stopped_data_address (void)
-{
- CORE_ADDR addr = 0;
- return frv_stopped_data_address (&addr);
}
static CORE_ADDR
diff --git a/gdb/gdb_indent.sh b/gdb/gdb_indent.sh
index 41b95d2..b210161 100755
--- a/gdb/gdb_indent.sh
+++ b/gdb/gdb_indent.sh
@@ -77,7 +77,6 @@ types="\
-T prgregset_t -T fpregset_t -T gregset_t -T sigset_t \
-T td_thrhandle_t -T td_event_msg_t -T td_thr_events_t \
-T td_notify_t -T td_thr_iter_f -T td_thrinfo_t \
--T caddr_t \
`cat *.h | sed -n \
-e 's/^.*[^a-z0-9_]\([a-z0-9_]*_ftype\).*$/-T \1/p' \
-e 's/^.*[^a-z0-9_]\([a-z0-9_]*_func\).*$/-T \1/p' \
diff --git a/gdb/gdb_thread_db.h b/gdb/gdb_thread_db.h
index 0a28534..81dd0a0 100644
--- a/gdb/gdb_thread_db.h
+++ b/gdb/gdb_thread_db.h
@@ -292,7 +292,7 @@ typedef struct td_thrinfo
intptr_t ti_sp; /* Unused. */
short int ti_flags; /* Unused. */
int ti_pri; /* Thread priority. */
- lwpid_t ti_lid; /* Kernel pid for this thread. */
+ lwpid_t ti_lid; /* Unused. */
sigset_t ti_sigmask; /* Signal mask. */
unsigned char ti_traceme; /* Nonzero if event reporting
enabled. */
diff --git a/gdb/gdbcmd.h b/gdb/gdbcmd.h
index 9dabd2c..8c4490e 100644
--- a/gdb/gdbcmd.h
+++ b/gdb/gdbcmd.h
@@ -98,14 +98,6 @@ extern struct cmd_list_element *maintenanceinfolist;
extern struct cmd_list_element *maintenanceprintlist;
-/* Chain containing all defined "maintenance set" subcommands. */
-
-extern struct cmd_list_element *maintenance_set_cmdlist;
-
-/* Chain containing all defined "maintenance show" subcommands. */
-
-extern struct cmd_list_element *maintenance_show_cmdlist;
-
extern struct cmd_list_element *setprintlist;
extern struct cmd_list_element *showprintlist;
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 96df7e5..0095e5f 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,32 +1,3 @@
-2004-10-16 Daniel Jacobowitz <dan@debian.org>
-
- * linux-i386-low.c (ps_get_thread_area): New.
- * linux-x86-64-low.c (ps_get_thread_area): New.
- * linux-low.c: Include <sys/syscall.h>.
- (linux_kill_one_process): Don't kill the first thread here.
- (linux_kill): Kill the first thread here.
- (kill_lwp): New function.
- (send_sigstop, linux_send_signal): Use it.
- * proc-service.c: Clean up #ifdefs.
- (fpregset_info): Delete.
- (ps_lgetregs): Update and enable implementation.
- (ps_lsetregs, ps_lgetfpregs, ps_lsetfpregs): Remove disabled
- implementations.
- * remote-utils.c (struct sym_cache, symbol_cache): New.
- (input_interrupt): Print a clearer message.
- (async_io_enabled): New variable.
- (enable_async_io, disable_async_io): Use it. Update comments.
- (look_up_one_symbol): Use the symbol cache.
- * thread-db.c (thread_db_look_up_symbols): New function.
- (thread_db_init): Update comments. Call thread_db_look_up_symbols.
-
-2004-10-16 Daniel Jacobowitz <dan@debian.org>
-
- * configure.in: Test for -rdynamic.
- * configure: Regenerated.
- * Makefile (INTERNAL_LDFLAGS): New.
- (gdbserver, gdbreplay): Use it.
-
2004-09-02 Andrew Cagney <cagney@gnu.org>
* Makefile.in (TAGS): Replace TM_FILE with DEPRECATED_TM_FILE.
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index 7123761..a5c1f95 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -103,7 +103,6 @@ INTERNAL_CFLAGS = $(WARN_CFLAGS) ${CFLAGS} ${GLOBAL_CFLAGS} \
# LDFLAGS is specifically reserved for setting from the command line
# when running make.
LDFLAGS = @LDFLAGS@
-INTERNAL_LDFLAGS = $(LDFLAGS) @RDYNAMIC@
# Perhaps should come from parent Makefile
VERSION = gdbserver-4.12.3
@@ -172,12 +171,12 @@ clean-info:
gdbserver: $(OBS) ${ADD_DEPS} ${CDEPS}
rm -f gdbserver
- ${CC-LD} $(GLOBAL_CFLAGS) $(INTERNAL_LDFLAGS) -o gdbserver $(OBS) \
+ ${CC-LD} $(GLOBAL_CFLAGS) $(LDFLAGS) -o gdbserver $(OBS) \
$(GDBSERVER_LIBS) $(XM_CLIBS)
gdbreplay: gdbreplay.o
rm -f gdbreplay
- ${CC-LD} $(GLOBAL_CFLAGS) $(INTERNAL_LDFLAGS) -o gdbreplay gdbreplay.o \
+ ${CC-LD} $(GLOBAL_CFLAGS) $(LDFLAGS) -o gdbreplay gdbreplay.o \
$(XM_CLIBS)
# Put the proper machine-specific files first, so M-. on a machine
diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
index 0bcefd6..62d3785 100755
--- a/gdb/gdbserver/configure
+++ b/gdb/gdbserver/configure
@@ -1582,28 +1582,6 @@ rm -f conftest*
else
srv_libs="$srv_cv_thread_db"
fi
- old_LDFLAGS="$LDFLAGS"
- LDFLAGS="$LDFLAGS -rdynamic"
- cat > conftest.$ac_ext <<EOF
-#line 1589 "configure"
-#include "confdefs.h"
-
-int main() {
-
-; return 0; }
-EOF
-if { (eval echo configure:1596: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- RDYNAMIC=-rdynamic
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- RDYNAMIC=
-fi
-rm -f conftest*
-
- LDFLAGS="$old_LDFLAGS"
fi
if test "$srv_linux_thread_db" = "yes"; then
@@ -1771,7 +1749,6 @@ s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
s%@INSTALL_DATA@%$INSTALL_DATA%g
s%@CPP@%$CPP%g
-s%@RDYNAMIC@%$RDYNAMIC%g
s%@GDBSERVER_DEPFILES@%$GDBSERVER_DEPFILES%g
s%@GDBSERVER_LIBS@%$GDBSERVER_LIBS%g
s%@USE_THREAD_DB@%$USE_THREAD_DB%g
diff --git a/gdb/gdbserver/configure.in b/gdb/gdbserver/configure.in
index 027699a..a5a34df 100644
--- a/gdb/gdbserver/configure.in
+++ b/gdb/gdbserver/configure.in
@@ -1,5 +1,5 @@
dnl Autoconf configure script for GDB server.
-dnl Copyright 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+dnl Copyright 2000, 2002 Free Software Foundation, Inc.
dnl
dnl This file is part of GDB.
dnl
@@ -114,11 +114,6 @@ if test "$srv_linux_thread_db" = "yes"; then
else
srv_libs="$srv_cv_thread_db"
fi
- old_LDFLAGS="$LDFLAGS"
- LDFLAGS="$LDFLAGS -rdynamic"
- AC_TRY_LINK([], [], [RDYNAMIC=-rdynamic], [RDYNAMIC=])
- AC_SUBST(RDYNAMIC)
- LDFLAGS="$old_LDFLAGS"
fi
if test "$srv_linux_thread_db" = "yes"; then
diff --git a/gdb/gdbserver/linux-i386-low.c b/gdb/gdbserver/linux-i386-low.c
index d8cc4ec..b79b601 100644
--- a/gdb/gdbserver/linux-i386-low.c
+++ b/gdb/gdbserver/linux-i386-low.c
@@ -1,5 +1,5 @@
/* GNU/Linux/i386 specific low level interface, for the remote server for GDB.
- Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2004
+ Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
This file is part of GDB.
@@ -23,30 +23,10 @@
#include "linux-low.h"
#include "i387-fp.h"
-/* Correct for all GNU/Linux targets (for quite some time). */
-#define GDB_GREGSET_T elf_gregset_t
-#define GDB_FPREGSET_T elf_fpregset_t
-
-#ifndef HAVE_ELF_FPREGSET_T
-/* Make sure we have said types. Not all platforms bring in <linux/elf.h>
- via <sys/procfs.h>. */
-#ifdef HAVE_LINUX_ELF_H
-#include <linux/elf.h>
-#endif
-#endif
-
-#include "../gdb_proc_service.h"
-
-#include <sys/ptrace.h>
-
#ifdef HAVE_SYS_REG_H
#include <sys/reg.h>
#endif
-#ifndef PTRACE_GET_THREAD_AREA
-#define PTRACE_GET_THREAD_AREA 25
-#endif
-
/* This module only supports access to the general purpose registers. */
#define i386_num_regs 16
@@ -63,22 +43,6 @@ static int i386_regmap[] =
DS * 4, ES * 4, FS * 4, GS * 4
};
-/* Called by libthread_db. */
-
-ps_err_e
-ps_get_thread_area (const struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
-{
- unsigned int desc[4];
-
- if (ptrace (PTRACE_GET_THREAD_AREA, lwpid,
- (void *) idx, (unsigned long) &desc) < 0)
- return PS_ERR;
-
- *(int *)base = desc[1];
- return PS_OK;
-}
-
static int
i386_cannot_store_register (int regno)
{
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 9c41fbb..5733180 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -35,7 +35,6 @@
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
-#include <sys/syscall.h>
/* ``all_threads'' is keyed by the LWP ID - it should be the thread ID instead,
however. This requires changing the ID in place when we go from !using_threads
@@ -224,13 +223,6 @@ linux_kill_one_process (struct inferior_list_entry *entry)
struct process_info *process = get_thread_process (thread);
int wstat;
- /* We avoid killing the first thread here, because of a Linux kernel (at
- least 2.6.0-test7 through 2.6.8-rc4) bug; if we kill the parent before
- the children get a chance to be reaped, it will remain a zombie
- forever. */
- if (entry == all_threads.head)
- return;
-
do
{
ptrace (PTRACE_KILL, pid_of (process), 0, 0);
@@ -243,21 +235,7 @@ linux_kill_one_process (struct inferior_list_entry *entry)
static void
linux_kill (void)
{
- struct thread_info *thread = (struct thread_info *) all_threads.head;
- struct process_info *process = get_thread_process (thread);
- int wstat;
-
for_each_inferior (&all_threads, linux_kill_one_process);
-
- /* See the comment in linux_kill_one_process. We did not kill the first
- thread in the list, so do so now. */
- do
- {
- ptrace (PTRACE_KILL, pid_of (process), 0, 0);
-
- /* Make sure it died. The loop is most likely unnecessary. */
- wstat = linux_wait_for_event (thread);
- } while (WIFSTOPPED (wstat));
}
static void
@@ -731,30 +709,6 @@ retry:
return ((unsigned char) WSTOPSIG (w));
}
-/* Send a signal to an LWP. For LinuxThreads, kill is enough; however, if
- thread groups are in use, we need to use tkill. */
-
-static int
-kill_lwp (int lwpid, int signo)
-{
- static int tkill_failed;
-
- errno = 0;
-
-#ifdef SYS_tkill
- if (!tkill_failed)
- {
- int ret = syscall (SYS_tkill, lwpid, signo);
- if (errno != ENOSYS)
- return ret;
- errno = 0;
- tkill_failed = 1;
- }
-#endif
-
- return kill (lwpid, signo);
-}
-
static void
send_sigstop (struct inferior_list_entry *entry)
{
@@ -774,7 +728,7 @@ send_sigstop (struct inferior_list_entry *entry)
if (debug_threads)
fprintf (stderr, "Sending sigstop to process %d\n", process->head.id);
- kill_lwp (process->head.id, SIGSTOP);
+ kill (process->head.id, SIGSTOP);
process->sigstop_sent = 1;
}
@@ -1434,10 +1388,10 @@ linux_send_signal (int signum)
struct process_info *process;
process = get_thread_process (current_inferior);
- kill_lwp (process->lwpid, signum);
+ kill (process->lwpid, signum);
}
else
- kill_lwp (signal_pid, signum);
+ kill (signal_pid, signum);
}
/* Copy LEN bytes from inferior's auxiliary vector starting at OFFSET
diff --git a/gdb/gdbserver/linux-x86-64-low.c b/gdb/gdbserver/linux-x86-64-low.c
index 45f00b0..4ee1ae4 100644
--- a/gdb/gdbserver/linux-x86-64-low.c
+++ b/gdb/gdbserver/linux-x86-64-low.c
@@ -1,6 +1,6 @@
/* GNU/Linux/x86-64 specific low level interface, for the remote server
for GDB.
- Copyright 2002, 2004
+ Copyright 2002
Free Software Foundation, Inc.
This file is part of GDB.
@@ -24,29 +24,10 @@
#include "linux-low.h"
#include "i387-fp.h"
-/* Correct for all GNU/Linux targets (for quite some time). */
-#define GDB_GREGSET_T elf_gregset_t
-#define GDB_FPREGSET_T elf_fpregset_t
-
-#ifndef HAVE_ELF_FPREGSET_T
-/* Make sure we have said types. Not all platforms bring in <linux/elf.h>
- via <sys/procfs.h>. */
-#ifdef HAVE_LINUX_ELF_H
-#include <linux/elf.h>
-#endif
-#endif
-
-#include "../gdb_proc_service.h"
-
#include <sys/reg.h>
#include <sys/procfs.h>
#include <sys/ptrace.h>
-/* This definition comes from prctl.h, but some kernels may not have it. */
-#ifndef PTRACE_ARCH_PRCTL
-#define PTRACE_ARCH_PRCTL 30
-#endif
-
static int x86_64_regmap[] = {
RAX * 8, RBX * 8, RCX * 8, RDX * 8,
RSI * 8, RDI * 8, RBP * 8, RSP * 8,
@@ -58,28 +39,6 @@ static int x86_64_regmap[] = {
#define X86_64_NUM_GREGS (sizeof(x86_64_regmap)/sizeof(int))
-/* Called by libthread_db. */
-
-ps_err_e
-ps_get_thread_area (const struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
-{
- switch (idx)
- {
- case FS:
- if (ptrace (PTRACE_ARCH_PRCTL, lwpid, base, ARCH_GET_FS) == 0)
- return PS_OK;
- break;
- case GS:
- if (ptrace (PTRACE_ARCH_PRCTL, lwpid, base, ARCH_GET_GS) == 0)
- return PS_OK;
- break;
- default:
- return PS_BADADDR;
- }
- return PS_ERR;
-}
-
static void
x86_64_fill_gregset (void *buf)
{
diff --git a/gdb/gdbserver/proc-service.c b/gdb/gdbserver/proc-service.c
index 5b83dec..becf565 100644
--- a/gdb/gdbserver/proc-service.c
+++ b/gdb/gdbserver/proc-service.c
@@ -1,5 +1,5 @@
/* libthread_db helper functions for the remote server for GDB.
- Copyright 2002, 2004
+ Copyright 2002
Free Software Foundation, Inc.
Contributed by MontaVista Software.
@@ -48,11 +48,11 @@ typedef void *gdb_ps_read_buf_t;
typedef const void *gdb_ps_write_buf_t;
typedef size_t gdb_ps_size_t;
-#ifdef HAVE_LINUX_REGSETS
-#define HAVE_REGSETS
-#endif
-
-#ifdef HAVE_REGSETS
+/* FIXME redo this right */
+#if 0
+#ifndef HAVE_LINUX_REGSETS
+#error HAVE_LINUX_REGSETS required!
+#else
static struct regset_info *
gregset_info(void)
{
@@ -67,6 +67,22 @@ gregset_info(void)
return &target_regsets[i];
}
+
+static struct regset_info *
+fpregset_info(void)
+{
+ int i = 0;
+
+ while (target_regsets[i].size != -1)
+ {
+ if (target_regsets[i].type == FP_REGS)
+ break;
+ i++;
+ }
+
+ return &target_regsets[i];
+}
+#endif
#endif
/* Search for the symbol named NAME within the object named OBJ within
@@ -112,8 +128,9 @@ ps_pdwrite (gdb_ps_prochandle_t ph, paddr_t addr,
ps_err_e
ps_lgetregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, prgregset_t gregset)
{
-#ifdef HAVE_REGSETS
+#if 0
struct thread_info *reg_inferior, *save_inferior;
+ void *regcache;
reg_inferior = (struct thread_info *) find_inferior_id (&all_threads,
lwpid);
@@ -123,14 +140,16 @@ ps_lgetregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, prgregset_t gregset)
save_inferior = current_inferior;
current_inferior = reg_inferior;
- the_target->fetch_registers (0);
- gregset_info()->fill_function (gregset);
+ regcache = new_register_cache ();
+ the_target->fetch_registers (0, regcache);
+ gregset_info()->fill_function (gregset, regcache);
+ free_register_cache (regcache);
current_inferior = save_inferior;
return PS_OK;
-#else
- return PS_ERR;
#endif
+ /* FIXME */
+ return PS_ERR;
}
/* Set the general registers of LWP LWPID within the target process PH
@@ -139,7 +158,27 @@ ps_lgetregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, prgregset_t gregset)
ps_err_e
ps_lsetregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, const prgregset_t gregset)
{
- /* Unneeded. */
+#if 0
+ struct thread_info *reg_inferior, *save_inferior;
+ void *regcache;
+
+ reg_inferior = (struct thread_info *) find_inferior_id (&all_threads, lwpid);
+ if (reg_inferior == NULL)
+ return PS_ERR;
+
+ save_inferior = current_inferior;
+ current_inferior = reg_inferior;
+
+ regcache = new_register_cache ();
+ gregset_info()->store_function (gregset, regcache);
+ the_target->store_registers (0, regcache);
+ free_register_cache (regcache);
+
+ current_inferior = save_inferior;
+
+ return PS_OK;
+#endif
+ /* FIXME */
return PS_ERR;
}
@@ -150,7 +189,27 @@ ps_err_e
ps_lgetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid,
gdb_prfpregset_t *fpregset)
{
- /* Unneeded. */
+#if 0
+ struct thread_info *reg_inferior, *save_inferior;
+ void *regcache;
+
+ reg_inferior = (struct thread_info *) find_inferior_id (&all_threads, lwpid);
+ if (reg_inferior == NULL)
+ return PS_ERR;
+
+ save_inferior = current_inferior;
+ current_inferior = reg_inferior;
+
+ regcache = new_register_cache ();
+ the_target->fetch_registers (0, regcache);
+ fpregset_info()->fill_function (fpregset, regcache);
+ free_register_cache (regcache);
+
+ current_inferior = save_inferior;
+
+ return PS_OK;
+#endif
+ /* FIXME */
return PS_ERR;
}
@@ -161,7 +220,27 @@ ps_err_e
ps_lsetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid,
const gdb_prfpregset_t *fpregset)
{
- /* Unneeded. */
+#if 0
+ struct thread_info *reg_inferior, *save_inferior;
+ void *regcache;
+
+ reg_inferior = (struct thread_info *) find_inferior_id (&all_threads, lwpid);
+ if (reg_inferior == NULL)
+ return PS_ERR;
+
+ save_inferior = current_inferior;
+ current_inferior = reg_inferior;
+
+ regcache = new_register_cache ();
+ fpregset_info()->store_function (fpregset, regcache);
+ the_target->store_registers (0, regcache);
+ free_register_cache (regcache);
+
+ current_inferior = save_inferior;
+
+ return PS_OK;
+#endif
+ /* FIXME */
return PS_ERR;
}
diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c
index 0d2bdef..26b267a 100644
--- a/gdb/gdbserver/remote-utils.c
+++ b/gdb/gdbserver/remote-utils.c
@@ -37,17 +37,6 @@
#include <unistd.h>
#include <arpa/inet.h>
-/* A cache entry for a successfully looked-up symbol. */
-struct sym_cache
-{
- const char *name;
- CORE_ADDR addr;
- struct sym_cache *next;
-};
-
-/* The symbol cache. */
-static struct sym_cache *symbol_cache;
-
int remote_debug = 0;
struct ui_file *gdb_stdlog;
@@ -364,14 +353,13 @@ input_interrupt (int unused)
if (select (remote_desc + 1, &readset, 0, 0, &immediate) > 0)
{
int cc;
- char c = 0;
+ char c;
cc = read (remote_desc, &c, 1);
if (cc != 1 || c != '\003')
{
- fprintf (stderr, "input_interrupt, count = %d c = %d ('%c')\n",
- cc, c, c);
+ fprintf (stderr, "input_interrupt, cc = %d c = %d\n", cc, c);
return;
}
@@ -397,33 +385,16 @@ unblock_async_io (void)
sigprocmask (SIG_UNBLOCK, &sigio_set, NULL);
}
-/* Asynchronous I/O support. SIGIO must be enabled when waiting, in order to
- accept Control-C from the client, and must be disabled when talking to
- the client. */
-
-/* Current state of asynchronous I/O. */
-static int async_io_enabled;
-
-/* Enable asynchronous I/O. */
void
enable_async_io (void)
{
- if (async_io_enabled)
- return;
-
signal (SIGIO, input_interrupt);
- async_io_enabled = 1;
}
-/* Disable asynchronous I/O. */
void
disable_async_io (void)
{
- if (!async_io_enabled)
- return;
-
signal (SIGIO, SIG_IGN);
- async_io_enabled = 0;
}
/* Returns next char from remote GDB. -1 if error. */
@@ -721,23 +692,11 @@ decode_M_packet (char *from, CORE_ADDR *mem_addr_ptr, unsigned int *len_ptr,
convert_ascii_to_int (&from[i++], to, *len_ptr);
}
-/* Ask GDB for the address of NAME, and return it in ADDRP if found.
- Returns 1 if the symbol is found, 0 if it is not, -1 on error. */
-
int
look_up_one_symbol (const char *name, CORE_ADDR *addrp)
{
char own_buf[266], *p, *q;
int len;
- struct sym_cache *sym;
-
- /* Check the cache first. */
- for (sym = symbol_cache; sym; sym = sym->next)
- if (strcmp (name, sym->name) == 0)
- {
- *addrp = sym->addr;
- return 1;
- }
/* Send the request. */
strcpy (own_buf, "qSymbol:");
@@ -772,13 +731,6 @@ look_up_one_symbol (const char *name, CORE_ADDR *addrp)
return 0;
decode_address (addrp, p, q - p);
-
- /* Save the symbol in our cache. */
- sym = malloc (sizeof (*sym));
- sym->name = strdup (name);
- sym->addr = *addrp;
- sym->next = symbol_cache;
- symbol_cache = sym;
-
return 1;
}
+
diff --git a/gdb/gdbserver/thread-db.c b/gdb/gdbserver/thread-db.c
index c6e0c2d..f3d57a5 100644
--- a/gdb/gdbserver/thread-db.c
+++ b/gdb/gdbserver/thread-db.c
@@ -312,36 +312,11 @@ thread_db_find_new_threads (void)
error ("Cannot find new threads: %s", thread_db_err_str (err));
}
-/* Cache all future symbols that thread_db might request. We can not
- request symbols at arbitrary states in the remote protocol, only
- when the client tells us that new symbols are available. So when
- we load the thread library, make sure to check the entire list. */
-
-static void
-thread_db_look_up_symbols (void)
-{
- const char **sym_list = td_symbol_list ();
- CORE_ADDR unused;
-
- for (sym_list = td_symbol_list (); *sym_list; sym_list++)
- look_up_one_symbol (*sym_list, &unused);
-}
-
int
thread_db_init ()
{
int err;
- /* FIXME drow/2004-10-16: This is the "overall process ID", which
- GNU/Linux calls tgid, "thread group ID". When we support
- attaching to threads, the original thread may not be the correct
- thread. We would have to get the process ID from /proc for NPTL.
- For LinuxThreads we could do something similar: follow the chain
- of parent processes until we find the highest one we're attached
- to, and use its tgid.
-
- This isn't the only place in gdbserver that assumes that the first
- process in the list is the thread group leader. */
proc_handle.pid = ((struct inferior_list_entry *)current_inferior)->id;
err = td_ta_new (&proc_handle, &thread_agent);
@@ -357,7 +332,6 @@ thread_db_init ()
if (thread_db_enable_reporting () == 0)
return 0;
thread_db_find_new_threads ();
- thread_db_look_up_symbols ();
return 1;
default:
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index eb28de2..4f95e13 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -293,17 +293,6 @@ enum type_code
#define TYPE_ADDRESS_CLASS_ALL(t) (TYPE_INSTANCE_FLAGS(t) \
& TYPE_FLAG_ADDRESS_CLASS_ALL)
-/* The debugging formats (especially STABS) do not contain enough information
- to represent all Ada types---especially those whose size depends on
- dynamic quantities. Therefore, the GNAT Ada compiler includes
- extra information in the form of additional type definitions
- connected by naming conventions. This flag indicates that the
- type is an ordinary (unencoded) GDB type that has been created from
- the necessary run-time information, and does not need further
- interpretation. Optionally marks ordinary, fixed-size GDB type. */
-
-#define TYPE_FLAG_FIXED_INSTANCE (1 << 15)
-
/* Array bound type. */
enum array_bound_type
{
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index c10e6e6..f43d1ba 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -2597,7 +2597,7 @@ init_gnu_ops (void)
gnu_ops.to_fetch_registers = gnu_fetch_registers; /* to_fetch_registers */
gnu_ops.to_store_registers = gnu_store_registers; /* to_store_registers */
gnu_ops.to_prepare_to_store = gnu_prepare_to_store; /* to_prepare_to_store */
- gnu_ops.deprecated_xfer_memory = gnu_xfer_memory;
+ gnu_ops.to_xfer_memory = gnu_xfer_memory; /* to_xfer_memory */
gnu_ops.to_find_memory_regions = gnu_find_memory_regions;
gnu_ops.to_insert_breakpoint = memory_insert_breakpoint;
gnu_ops.to_remove_breakpoint = memory_remove_breakpoint;
diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
index c34db89..ec3b5aa 100644
--- a/gdb/go32-nat.c
+++ b/gdb/go32-nat.c
@@ -861,7 +861,7 @@ init_go32_ops (void)
go32_ops.to_fetch_registers = go32_fetch_registers;
go32_ops.to_store_registers = go32_store_registers;
go32_ops.to_prepare_to_store = go32_prepare_to_store;
- go32_ops.deprecated_xfer_memory = go32_xfer_memory;
+ go32_ops.to_xfer_memory = go32_xfer_memory;
go32_ops.to_files_info = go32_files_info;
go32_ops.to_insert_breakpoint = memory_insert_breakpoint;
go32_ops.to_remove_breakpoint = memory_remove_breakpoint;
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index db15a1b..1209584 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -1660,11 +1660,6 @@ hppa_frame_cache (struct frame_info *next_frame, void **this_cache)
looking_for_rp = 0;
cache->saved_regs[HPPA_RP_REGNUM].addr = -20;
}
- else if (inst == 0x6bc23fd1) /* stw rp,-0x18(sr0,sp) */
- {
- looking_for_rp = 0;
- cache->saved_regs[HPPA_RP_REGNUM].addr = -24;
- }
else if (inst == 0x0fc212c1) /* std rp,-0x10(sr0,sp) */
{
looking_for_rp = 0;
diff --git a/gdb/hppah-nat.c b/gdb/hppah-nat.c
index 3979ece..60e2889 100644
--- a/gdb/hppah-nat.c
+++ b/gdb/hppah-nat.c
@@ -1,7 +1,7 @@
-/* Native support code for HPUX PA-RISC, for GDB the GNU debugger.
-
- Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
- 1996, 1998, 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
+/* Native support code for HPUX PA-RISC.
+ Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
+ 1998, 1999, 2000, 2001
+ Free Software Foundation, Inc.
Contributed by the Center for Software Science at the
University of Utah (pa-gdb-bugs@cs.utah.edu).
@@ -289,10 +289,10 @@ fetch_register (int regno)
to debugger memory starting at MYADDR. Copy to inferior if
WRITE is nonzero.
- Returns the length copied, which is either the LEN argument or
- zero. This xfer function does not do partial moves, since
- deprecated_child_ops doesn't allow memory operations to cross below
- us in the target stack anyway. TARGET is ignored. */
+ Returns the length copied, which is either the LEN argument or zero.
+ This xfer function does not do partial moves, since child_ops
+ doesn't allow memory operations to cross below us in the target stack
+ anyway. TARGET is ignored. */
int
child_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
diff --git a/gdb/hpux-thread.c b/gdb/hpux-thread.c
index e9f6cfb..5664314 100644
--- a/gdb/hpux-thread.c
+++ b/gdb/hpux-thread.c
@@ -1,8 +1,5 @@
-/* Low level interface for debugging HPUX/DCE threads for GDB, the GNU
- debugger.
-
- Copyright 1996, 1998, 1999, 2000, 2001, 2004 Free Software
- Foundation, Inc.
+/* Low level interface for debugging HPUX/DCE threads for GDB, the GNU debugger.
+ Copyright 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of GDB.
@@ -48,6 +45,7 @@
#include "gdbcore.h"
extern int child_suppress_run;
+extern struct target_ops child_ops; /* target vector for inftarg.c */
extern void _initialize_hpux_thread (void);
@@ -136,7 +134,7 @@ find_tcb (ptid_t ptid)
static void
hpux_thread_open (char *arg, int from_tty)
{
- deprecated_child_ops.to_open (arg, from_tty);
+ child_ops.to_open (arg, from_tty);
}
/* Attach to process PID, then initialize for debugging it
@@ -145,7 +143,7 @@ hpux_thread_open (char *arg, int from_tty)
static void
hpux_thread_attach (char *args, int from_tty)
{
- deprecated_child_ops.to_attach (args, from_tty);
+ child_ops.to_attach (args, from_tty);
/* XXX - might want to iterate over all the threads and register them. */
}
@@ -161,7 +159,7 @@ hpux_thread_attach (char *args, int from_tty)
static void
hpux_thread_detach (char *args, int from_tty)
{
- deprecated_child_ops.to_detach (args, from_tty);
+ child_ops.to_detach (args, from_tty);
}
/* Resume execution of process PID. If STEP is nozero, then
@@ -188,7 +186,7 @@ hpux_thread_resume (ptid_t ptid, int step, enum target_signal signo)
}
#endif
- deprecated_child_ops.to_resume (ptid, step, signo);
+ child_ops.to_resume (ptid, step, signo);
cached_thread = 0;
@@ -211,7 +209,7 @@ hpux_thread_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
if (!ptid_equal (ptid, minus_one_ptid))
ptid = main_ptid;
- rtnval = deprecated_child_ops.to_wait (ptid, ourstatus);
+ rtnval = child_ops.to_wait (ptid, ourstatus);
rtnval = find_active_thread ();
@@ -262,7 +260,7 @@ hpux_thread_fetch_registers (int regno)
if (tcb_ptr->state == cma__c_state_running)
{
- deprecated_child_ops.to_fetch_registers (regno);
+ child_ops.to_fetch_registers (regno);
do_cleanups (old_chain);
@@ -283,7 +281,7 @@ hpux_thread_fetch_registers (int regno)
for (regno = first_regno; regno <= last_regno; regno++)
{
if (regmap[regno] == -1)
- deprecated_child_ops.to_fetch_registers (regno);
+ child_ops.to_fetch_registers (regno);
else
{
unsigned char buf[MAX_REGISTER_SIZE];
@@ -324,7 +322,7 @@ hpux_thread_store_registers (int regno)
if (tcb_ptr->state == cma__c_state_running)
{
- deprecated_child_ops.to_store_registers (regno);
+ child_ops.to_store_registers (regno);
do_cleanups (old_chain);
@@ -345,7 +343,7 @@ hpux_thread_store_registers (int regno)
for (regno = first_regno; regno <= last_regno; regno++)
{
if (regmap[regno] == -1)
- deprecated_child_ops.to_store_registers (regno);
+ child_ops.to_store_registers (regno);
else
{
unsigned char buf[MAX_REGISTER_SIZE];
@@ -354,7 +352,7 @@ hpux_thread_store_registers (int regno)
sp = (CORE_ADDR) tcb_ptr->static_ctx.sp - 160;
if (regno == FLAGS_REGNUM)
- deprecated_child_ops.to_store_registers (regno); /* Let lower layer handle this... */
+ child_ops.to_store_registers (regno); /* Let lower layer handle this... */
else if (regno == SP_REGNUM)
{
write_memory ((CORE_ADDR) & tcb_ptr->static_ctx.sp,
@@ -387,7 +385,7 @@ hpux_thread_store_registers (int regno)
static void
hpux_thread_prepare_to_store (void)
{
- deprecated_child_ops.to_prepare_to_store ();
+ child_ops.to_prepare_to_store ();
}
static int
@@ -403,7 +401,7 @@ hpux_thread_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len,
inferior_ptid = main_ptid;
retval =
- deprecated_child_ops.deprecated_xfer_memory (memaddr, myaddr, len, dowrite, attribs, target);
+ child_ops.to_xfer_memory (memaddr, myaddr, len, dowrite, attribs, target);
do_cleanups (old_chain);
@@ -415,19 +413,19 @@ hpux_thread_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len,
static void
hpux_thread_files_info (struct target_ops *ignore)
{
- deprecated_child_ops.to_files_info (ignore);
+ child_ops.to_files_info (ignore);
}
static void
hpux_thread_kill_inferior (void)
{
- deprecated_child_ops.to_kill ();
+ child_ops.to_kill ();
}
static void
hpux_thread_notice_signals (ptid_t ptid)
{
- deprecated_child_ops.to_notice_signals (ptid);
+ child_ops.to_notice_signals (ptid);
}
/* Fork an inferior process, and start debugging it with /proc. */
@@ -436,7 +434,7 @@ static void
hpux_thread_create_inferior (char *exec_file, char *allargs, char **env,
int from_tty)
{
- deprecated_child_ops.to_create_inferior (exec_file, allargs, env, from_tty);
+ child_ops.to_create_inferior (exec_file, allargs, env, from_tty);
if (hpux_thread_active)
{
@@ -500,7 +498,7 @@ quit:
static void
hpux_thread_mourn_inferior (void)
{
- deprecated_child_ops.to_mourn_inferior ();
+ child_ops.to_mourn_inferior ();
}
/* Mark our target-struct as eligible for stray "run" and "attach" commands. */
@@ -520,7 +518,7 @@ hpux_thread_alive (ptid_t ptid)
static void
hpux_thread_stop (void)
{
- deprecated_child_ops.to_stop ();
+ child_ops.to_stop ();
}
/* Convert a pid to printable form. */
@@ -550,7 +548,7 @@ init_hpux_thread_ops (void)
hpux_thread_ops.to_fetch_registers = hpux_thread_fetch_registers;
hpux_thread_ops.to_store_registers = hpux_thread_store_registers;
hpux_thread_ops.to_prepare_to_store = hpux_thread_prepare_to_store;
- hpux_thread_ops.deprecated_xfer_memory = hpux_thread_xfer_memory;
+ hpux_thread_ops.to_xfer_memory = hpux_thread_xfer_memory;
hpux_thread_ops.to_files_info = hpux_thread_files_info;
hpux_thread_ops.to_insert_breakpoint = memory_insert_breakpoint;
hpux_thread_ops.to_remove_breakpoint = memory_remove_breakpoint;
diff --git a/gdb/i386-nat.c b/gdb/i386-nat.c
index 6b5f49b..95b4609 100644
--- a/gdb/i386-nat.c
+++ b/gdb/i386-nat.c
@@ -564,16 +564,14 @@ i386_region_ok_for_watchpoint (CORE_ADDR addr, int len)
return nregs <= DR_NADDR ? 1 : 0;
}
-/* If the inferior has some watchpoint that triggered, set the
- address associated with that watchpoint and return non-zero.
- Otherwise, return zero. */
+/* If the inferior has some watchpoint that triggered, return the
+ address associated with that watchpoint. Otherwise, return zero. */
-int
-i386_stopped_data_address (CORE_ADDR *addr_p)
+CORE_ADDR
+i386_stopped_data_address (void)
{
CORE_ADDR addr = 0;
int i;
- int rc = 0;
dr_status_mirror = I386_DR_LOW_GET_STATUS ();
@@ -588,7 +586,6 @@ i386_stopped_data_address (CORE_ADDR *addr_p)
&& I386_DR_GET_RW_LEN (i) != 0)
{
addr = dr_mirror[i];
- rc = 1;
if (maint_show_dr)
i386_show_dr ("watchpoint_hit", addr, -1, hw_write);
}
@@ -596,16 +593,7 @@ i386_stopped_data_address (CORE_ADDR *addr_p)
if (maint_show_dr && addr == 0)
i386_show_dr ("stopped_data_addr", 0, 0, hw_write);
- if (rc)
- *addr_p = addr;
- return rc;
-}
-
-int
-i386_stopped_by_watchpoint (void)
-{
- CORE_ADDR addr = 0;
- return i386_stopped_data_address (&addr);
+ return addr;
}
/* Return non-zero if the inferior has some break/watchpoint that
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index d5cd111..cc727c8 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -151,16 +151,16 @@ i386_fpc_regnum_p (int regnum)
return (I387_FCTRL_REGNUM <= regnum && regnum < I387_XMM0_REGNUM);
}
-/* Return the name of register REGNUM. */
+/* Return the name of register REG. */
const char *
-i386_register_name (int regnum)
+i386_register_name (int reg)
{
- if (i386_mmx_regnum_p (current_gdbarch, regnum))
- return i386_mmx_names[regnum - I387_MM0_REGNUM];
+ if (i386_mmx_regnum_p (current_gdbarch, reg))
+ return i386_mmx_names[reg - I387_MM0_REGNUM];
- if (regnum >= 0 && regnum < i386_num_register_names)
- return i386_register_names[regnum];
+ if (reg >= 0 && reg < i386_num_register_names)
+ return i386_register_names[reg];
return NULL;
}
diff --git a/gdb/i386bsd-nat.c b/gdb/i386bsd-nat.c
index 349112a..f54d2f0 100644
--- a/gdb/i386bsd-nat.c
+++ b/gdb/i386bsd-nat.c
@@ -33,8 +33,6 @@
#include "i386-tdep.h"
#include "i387-tdep.h"
-#include "i386bsd-nat.h"
-#include "inf-ptrace.h"
/* In older BSD versions we cannot get at some of the segment
@@ -130,8 +128,8 @@ i386bsd_collect_gregset (const struct regcache *regcache,
/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this
for all registers (including the floating point registers). */
-static void
-i386bsd_fetch_inferior_registers (int regnum)
+void
+fetch_inferior_registers (int regnum)
{
if (regnum == -1 || GETREGS_SUPPLIES (regnum))
{
@@ -180,8 +178,8 @@ i386bsd_fetch_inferior_registers (int regnum)
/* Store register REGNUM back into the inferior. If REGNUM is -1, do
this for all registers (including the floating point registers). */
-static void
-i386bsd_store_inferior_registers (int regnum)
+void
+store_inferior_registers (int regnum)
{
if (regnum == -1 || GETREGS_SUPPLIES (regnum))
{
@@ -237,20 +235,6 @@ i386bsd_store_inferior_registers (int regnum)
#endif
}
}
-
-/* Create a prototype *BSD/i386 target. The client can override it
- with local methods. */
-
-struct target_ops *
-i386bsd_target (void)
-{
- struct target_ops *t;
-
- t = inf_ptrace_target ();
- t->to_fetch_registers = i386bsd_fetch_inferior_registers;
- t->to_store_registers = i386bsd_store_inferior_registers;
- return t;
-}
/* Support for debug registers. */
diff --git a/gdb/i386fbsd-nat.c b/gdb/i386fbsd-nat.c
index bf4bd94..ed07711 100644
--- a/gdb/i386fbsd-nat.c
+++ b/gdb/i386fbsd-nat.c
@@ -22,21 +22,19 @@
#include "defs.h"
#include "inferior.h"
#include "regcache.h"
-#include "target.h"
#include <sys/types.h>
#include <sys/ptrace.h>
#include <sys/sysctl.h>
-#include "fbsd-nat.h"
#include "i386-tdep.h"
-#include "i386bsd-nat.h"
-/* Resume execution of the inferior process. If STEP is nonzero,
- single-step it. If SIGNAL is nonzero, give it that signal. */
+/* Resume execution of the inferior process.
+ If STEP is nonzero, single-step it.
+ If SIGNAL is nonzero, give it that signal. */
-static void
-i386fbsd_resume (ptid_t ptid, int step, enum target_signal signal)
+void
+child_resume (ptid_t ptid, int step, enum target_signal signal)
{
pid_t pid = ptid_get_pid (ptid);
int request = PT_STEP;
@@ -121,19 +119,6 @@ void _initialize_i386fbsd_nat (void);
void
_initialize_i386fbsd_nat (void)
{
- struct target_ops *t;
-
- /* Add some extra features to the common *BSD/i386 target. */
- t = i386bsd_target ();
- t->to_resume = i386fbsd_resume;
- t->to_pid_to_exec_file = fbsd_pid_to_exec_file;
- t->to_find_memory_regions = fbsd_find_memory_regions;
- t->to_make_corefile_notes = fbsd_make_corefile_notes;
- add_target (t);
-
- /* Support debugging kernel virtual memory images. */
- bsd_kvm_add_target (i386fbsd_supply_pcb);
-
/* FreeBSD provides a kern.ps_strings sysctl that we can use to
locate the sigtramp. That way we can still recognize a sigtramp
if its location is changed in a new kernel. Of course this is
@@ -156,4 +141,7 @@ _initialize_i386fbsd_nat (void)
}
}
#endif
+
+ /* Support debugging kernel virtual memory images. */
+ bsd_kvm_add_target (i386fbsd_supply_pcb);
}
diff --git a/gdb/i386gnu-nat.c b/gdb/i386gnu-nat.c
index 023fbb7..f694eba 100644
--- a/gdb/i386gnu-nat.c
+++ b/gdb/i386gnu-nat.c
@@ -28,7 +28,6 @@
#include "gdb_assert.h"
#include <errno.h>
#include <stdio.h>
-#include "gdb_string.h"
#include <mach.h>
#include <mach_error.h>
@@ -61,9 +60,8 @@ static int reg_offset[] =
#define REG_ADDR(state, regnum) ((char *)(state) + reg_offset[regnum])
-/* Get the whole floating-point state of THREAD and record the values
- of the corresponding (pseudo) registers. */
-
+/* Get the whole floating-point state of THREAD and record the
+ values of the corresponding (pseudo) registers. */
static void
fetch_fpregs (struct proc *thread)
{
@@ -81,15 +79,18 @@ fetch_fpregs (struct proc *thread)
}
if (!state.initialized)
+ /* The floating-point state isn't initialized. */
{
- /* The floating-point state isn't initialized. */
- i387_supply_fsave (current_regcache, -1, NULL);
- }
- else
- {
- /* Supply the floating-point registers. */
- i387_supply_fsave (current_regcache, -1, state.hw_state);
+ int i;
+
+ for (i = FP0_REGNUM; i <= FOP_REGNUM; i++)
+ regcache_raw_supply (current_regcache, i, NULL);
+
+ return;
}
+
+ /* Supply the floating-point registers. */
+ i387_supply_fsave (current_regcache, -1, state.hw_state);
}
#ifdef HAVE_SYS_PROCFS_H
diff --git a/gdb/i386nbsd-nat.c b/gdb/i386nbsd-nat.c
index 22af011..92da7e1 100644
--- a/gdb/i386nbsd-nat.c
+++ b/gdb/i386nbsd-nat.c
@@ -22,10 +22,8 @@
#include "defs.h"
#include "gdbcore.h"
#include "regcache.h"
-#include "target.h"
#include "i386-tdep.h"
-#include "i386bsd-nat.h"
/* Support for debugging kernel virtual memory images. */
@@ -79,9 +77,6 @@ void _initialize_i386nbsd_nat (void);
void
_initialize_i386nbsd_nat (void)
{
- /* We've got nothing to add to the common *BSD/i386 target. */
- add_target (i386bsd_target ());
-
/* Support debugging kernel virtual memory images. */
bsd_kvm_add_target (i386nbsd_supply_pcb);
}
diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c
index 285567c..09daf24 100644
--- a/gdb/ia64-linux-nat.c
+++ b/gdb/ia64-linux-nat.c
@@ -418,7 +418,8 @@ fill_gregset (gregset_t *gregsetp, int regno)
#define COPY_REG(_idx_,_regi_) \
if ((regno == -1) || regno == _regi_) \
- regcache_raw_collect (current_regcache, _regi_, regp + _idx_)
+ memcpy (regp + _idx_, &deprecated_registers[DEPRECATED_REGISTER_BYTE (_regi_)], \
+ register_size (current_gdbarch, _regi_))
for (regi = IA64_GR0_REGNUM; regi <= IA64_GR31_REGNUM; regi++)
{
@@ -475,12 +476,17 @@ void
fill_fpregset (fpregset_t *fpregsetp, int regno)
{
int regi;
+ char *to;
+ char *from;
for (regi = IA64_FR0_REGNUM; regi <= IA64_FR127_REGNUM; regi++)
{
if ((regno == -1) || (regno == regi))
- regcache_raw_collect (current_regcache, regi,
- &((*fpregsetp)[regi - IA64_FR0_REGNUM]));
+ {
+ from = (char *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (regi)];
+ to = (char *) &((*fpregsetp)[regi - IA64_FR0_REGNUM]);
+ memcpy (to, from, register_size (current_gdbarch, regi));
+ }
}
}
@@ -630,13 +636,12 @@ ia64_linux_remove_watchpoint (ptid_t ptid, CORE_ADDR addr, int len)
return -1;
}
-int
-ia64_linux_stopped_data_address (CORE_ADDR *addr_p)
+CORE_ADDR
+ia64_linux_stopped_by_watchpoint (ptid_t ptid)
{
CORE_ADDR psr;
int tid;
struct siginfo siginfo;
- ptid_t ptid = inferior_ptid;
tid = TIDGET(ptid);
if (tid == 0)
@@ -654,15 +659,7 @@ ia64_linux_stopped_data_address (CORE_ADDR *addr_p)
for the next instruction */
write_register_pid (IA64_PSR_REGNUM, psr, ptid);
- *addr_p = (CORE_ADDR)siginfo.si_addr;
- return 1;
-}
-
-int
-ia64_linux_stopped_by_watchpoint (void)
-{
- CORE_ADDR addr;
- return ia64_linux_stopped_data_address (&addr);
+ return (CORE_ADDR) siginfo.si_addr;
}
LONGEST
diff --git a/gdb/inf-child.c b/gdb/inf-child.c
index ebc6c62..f729611 100644
--- a/gdb/inf-child.c
+++ b/gdb/inf-child.c
@@ -27,7 +27,6 @@
#include "symtab.h"
#include "target.h"
#include "inferior.h"
-#include "gdb_string.h"
/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this
for all registers. */
@@ -52,6 +51,14 @@ inf_child_store_inferior_registers (int regnum)
{
}
+void
+inf_child_post_wait (ptid_t ptid, int wait_status)
+{
+ /* This version of Unix doesn't require a meaningful "post wait"
+ operation.
+ */
+}
+
static void
inf_child_post_attach (int pid)
{
@@ -181,6 +188,14 @@ inf_child_pid_to_exec_file (int pid)
return NULL;
}
+static char *
+inf_child_core_file_to_sym_file (char *core)
+{
+ /* The target stratum for a running executable need not support this
+ operation. */
+ return NULL;
+}
+
struct target_ops *
inf_child_target (void)
{
@@ -190,8 +205,7 @@ inf_child_target (void)
t->to_doc = "Unix child process (started by the \"run\" command).";
t->to_open = inf_child_open;
t->to_post_attach = inf_child_post_attach;
- t->to_fetch_registers = inf_child_fetch_inferior_registers;
- t->to_store_registers = inf_child_store_inferior_registers;
+ t->to_post_wait = inf_child_post_wait;
t->to_prepare_to_store = inf_child_prepare_to_store;
t->to_insert_breakpoint = memory_insert_breakpoint;
t->to_remove_breakpoint = memory_remove_breakpoint;
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index 283a22d..f79f786 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -30,9 +30,8 @@
#include "gdbcore.h"
#include "inf-child.h"
#include "gdbcmd.h"
-#include "gdb_string.h"
-#include "gdb_wait.h"
+#include <sys/wait.h>
#include <signal.h>
/* HACK: Save the ptrace ops returned by ptrace_target. */
@@ -55,8 +54,8 @@ inf_ptrace_kill_inferior (void)
The kill call causes problems under hpux10, so it's been removed;
if this causes problems we'll deal with them as they arise. */
- ptrace (PT_KILL, pid, (PTRACE_TYPE_ARG3) 0, 0);
- wait (&status);
+ call_ptrace (PT_KILL, pid, (PTRACE_TYPE_ARG3) 0, 0);
+ ptrace_wait (null_ptid, &status);
target_mourn_inferior ();
}
@@ -95,6 +94,145 @@ inf_ptrace_resume (ptid_t ptid, int step, enum target_signal signal)
perror_with_name ("ptrace");
}
+/* Set an upper limit on alloca. */
+#define GDB_MAX_ALLOCA 0x1000
+
+/* NOTE! I tried using PTRACE_READDATA, etc., to read and write memory
+ in the NEW_SUN_PTRACE case. It ought to be straightforward. But
+ it appears that writing did not write the data that I specified. I
+ cannot understand where it got the data that it actually did
+ write. */
+
+/* Copy LEN bytes to or from inferior's memory starting at MEMADDR to
+ debugger memory starting at MYADDR. Copy to inferior if WRITE is
+ nonzero. TARGET is ignored.
+
+ Returns the length copied, which is either the LEN argument or
+ zero. This xfer function does not do partial moves, since
+ ptrace_ops_hack doesn't allow memory operations to cross below us in the
+ target stack anyway. */
+
+int
+inf_ptrace_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+ struct mem_attrib *attrib, struct target_ops *target)
+{
+ int i;
+ /* Round starting address down to longword boundary. */
+ CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (PTRACE_TYPE_RET);
+ /* Round ending address up; get number of longwords that makes. */
+ int count = ((((memaddr + len) - addr) + sizeof (PTRACE_TYPE_RET) - 1)
+ / sizeof (PTRACE_TYPE_RET));
+ int alloc = count * sizeof (PTRACE_TYPE_RET);
+ PTRACE_TYPE_RET *buffer;
+ struct cleanup *old_chain = NULL;
+
+#ifdef PT_IO
+ /* OpenBSD 3.1, NetBSD 1.6 and FreeBSD 5.0 have a new PT_IO request
+ that promises to be much more efficient in reading and writing
+ data in the traced process's address space. */
+
+ {
+ struct ptrace_io_desc piod;
+
+ /* NOTE: We assume that there are no distinct address spaces for
+ instruction and data. */
+ piod.piod_op = write ? PIOD_WRITE_D : PIOD_READ_D;
+ piod.piod_offs = (void *) memaddr;
+ piod.piod_addr = myaddr;
+ piod.piod_len = len;
+
+ if (ptrace (PT_IO, PIDGET (inferior_ptid), (caddr_t) & piod, 0) == -1)
+ {
+ /* If the PT_IO request is somehow not supported, fallback on
+ using PT_WRITE_D/PT_READ_D. Otherwise we will return zero
+ to indicate failure. */
+ if (errno != EINVAL)
+ return 0;
+ }
+ else
+ {
+ /* Return the actual number of bytes read or written. */
+ return piod.piod_len;
+ }
+ }
+#endif
+
+ /* Allocate buffer of that many longwords. */
+ if (len < GDB_MAX_ALLOCA)
+ {
+ buffer = (PTRACE_TYPE_RET *) alloca (alloc);
+ }
+ else
+ {
+ buffer = (PTRACE_TYPE_RET *) xmalloc (alloc);
+ old_chain = make_cleanup (xfree, buffer);
+ }
+
+ if (write)
+ {
+ /* Fill start and end extra bytes of buffer with existing memory
+ data. */
+ if (addr != memaddr || len < (int) sizeof (PTRACE_TYPE_RET))
+ {
+ /* Need part of initial word -- fetch it. */
+ buffer[0] = ptrace (PT_READ_I, PIDGET (inferior_ptid),
+ (PTRACE_TYPE_ARG3) addr, 0);
+ }
+
+ if (count > 1) /* FIXME, avoid if even boundary. */
+ {
+ buffer[count - 1] =
+ ptrace (PT_READ_I, PIDGET (inferior_ptid),
+ ((PTRACE_TYPE_ARG3)
+ (addr + (count - 1) * sizeof (PTRACE_TYPE_RET))), 0);
+ }
+
+ /* Copy data to be written over corresponding part of buffer. */
+ memcpy ((char *) buffer + (memaddr & (sizeof (PTRACE_TYPE_RET) - 1)),
+ myaddr, len);
+
+ /* Write the entire buffer. */
+ for (i = 0; i < count; i++, addr += sizeof (PTRACE_TYPE_RET))
+ {
+ errno = 0;
+ ptrace (PT_WRITE_D, PIDGET (inferior_ptid),
+ (PTRACE_TYPE_ARG3) addr, buffer[i]);
+ if (errno)
+ {
+ /* Using the appropriate one (I or D) is necessary for
+ Gould NP1, at least. */
+ errno = 0;
+ ptrace (PT_WRITE_I, PIDGET (inferior_ptid),
+ (PTRACE_TYPE_ARG3) addr, buffer[i]);
+ }
+ if (errno)
+ return 0;
+ }
+ }
+ else
+ {
+ /* Read all the longwords. */
+ for (i = 0; i < count; i++, addr += sizeof (PTRACE_TYPE_RET))
+ {
+ errno = 0;
+ buffer[i] = ptrace (PT_READ_I, PIDGET (inferior_ptid),
+ (PTRACE_TYPE_ARG3) addr, 0);
+ if (errno)
+ return 0;
+ QUIT;
+ }
+
+ /* Copy appropriate bytes out of the buffer. */
+ memcpy (myaddr,
+ (char *) buffer + (memaddr & (sizeof (PTRACE_TYPE_RET) - 1)),
+ len);
+ }
+
+ if (old_chain != NULL)
+ do_cleanups (old_chain);
+ return len;
+}
+
/* Wait for child to do something. Return pid of child, or -1 in case
of error; store status through argument pointer OURSTATUS. */
@@ -116,7 +254,7 @@ inf_ptrace_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
attached process. */
set_sigio_trap ();
- pid = wait (&status);
+ pid = ptrace_wait (inferior_ptid, &status);
save_errno = errno;
@@ -159,6 +297,14 @@ inf_ptrace_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
return pid_to_ptid (pid);
}
+void
+inf_ptrace_post_wait (ptid_t ptid, int wait_status)
+{
+ /* This version of Unix doesn't require a meaningful "post wait"
+ operation.
+ */
+}
+
/* Check to see if the given thread is alive.
FIXME: Is kill() ever the right way to do this? I doubt it, but
@@ -188,7 +334,7 @@ inf_ptrace_attach (char *args, int from_tty)
dummy = args;
pid = strtol (args, &dummy, 0);
/* Some targets don't set errno on errors, grrr! */
- if (pid == 0 && args == dummy)
+ if ((pid == 0) && (args == dummy))
error ("Illegal process-id: %s\n", args);
if (pid == getpid ()) /* Trying to masturbate? */
@@ -208,15 +354,7 @@ inf_ptrace_attach (char *args, int from_tty)
gdb_flush (gdb_stdout);
}
-#ifdef PT_ATTACH
- errno = 0;
- ptrace (PT_ATTACH, pid, (PTRACE_TYPE_ARG3) 0, 0);
- if (errno != 0)
- perror_with_name ("ptrace");
- attach_flag = 1;
-#else
- error ("This system does not support attaching to a process");
-#endif
+ attach (pid);
inferior_ptid = pid_to_ptid (pid);
push_target (ptrace_ops_hack);
@@ -239,7 +377,7 @@ inf_ptrace_post_attach (int pid)
static void
inf_ptrace_detach (char *args, int from_tty)
{
- int sig = 0;
+ int siggnal = 0;
int pid = PIDGET (inferior_ptid);
if (from_tty)
@@ -252,17 +390,9 @@ inf_ptrace_detach (char *args, int from_tty)
gdb_flush (gdb_stdout);
}
if (args)
- sig = atoi (args);
+ siggnal = atoi (args);
-#ifdef PT_DETACH
- errno = 0;
- ptrace (PT_DETACH, pid, (PTRACE_TYPE_ARG3) 1, sig);
- if (errno != 0)
- perror_with_name ("ptrace");
- attach_flag = 0;
-#else
- error ("This system does not support detaching from a process");
-#endif
+ detach (siggnal);
inferior_ptid = null_ptid;
unpush_target (ptrace_ops_hack);
@@ -302,7 +432,7 @@ static void
inf_ptrace_me (void)
{
/* "Trace me, Dr. Memory!" */
- ptrace (0, 0, (PTRACE_TYPE_ARG3) 0, 0);
+ call_ptrace (0, 0, (PTRACE_TYPE_ARG3) 0, 0);
}
/* Stub function which causes the GDB that runs it, to start ptrace-ing
@@ -480,99 +610,13 @@ inf_ptrace_xfer_partial (struct target_ops *ops, enum target_object object,
switch (object)
{
case TARGET_OBJECT_MEMORY:
-#ifdef PT_IO
- /* OpenBSD 3.1, NetBSD 1.6 and FreeBSD 5.0 have a new PT_IO
- request that promises to be much more efficient in reading
- and writing data in the traced process's address space. */
- {
- struct ptrace_io_desc piod;
-
- /* NOTE: We assume that there are no distinct address spaces
- for instruction and data. */
- piod.piod_op = writebuf ? PIOD_WRITE_D : PIOD_READ_D;
- piod.piod_addr = writebuf ? (void *) writebuf : readbuf;
- piod.piod_offs = (void *) (long) offset;
- piod.piod_len = len;
-
- errno = 0;
- if (ptrace (PT_IO, PIDGET (inferior_ptid), (caddr_t) &piod, 0) == 0)
- /* Return the actual number of bytes read or written. */
- return piod.piod_len;
- /* If the PT_IO request is somehow not supported, fallback on
- using PT_WRITE_D/PT_READ_D. Otherwise we will return zero
- to indicate failure. */
- if (errno != EINVAL)
- return 0;
- }
-#endif
- {
- union
- {
- PTRACE_TYPE_RET word;
- unsigned char byte[sizeof (PTRACE_TYPE_RET)];
- } buffer;
- ULONGEST rounded_offset;
- LONGEST partial_len;
-
- /* Round the start offset down to the next long word
- boundary. */
- rounded_offset = offset & -(ULONGEST) sizeof (PTRACE_TYPE_RET);
-
- /* Since ptrace will transfer a single word starting at that
- rounded_offset the partial_len needs to be adjusted down to
- that (remember this function only does a single transfer).
- Should the required length be even less, adjust it down
- again. */
- partial_len = (rounded_offset + sizeof (PTRACE_TYPE_RET)) - offset;
- if (partial_len > len)
- partial_len = len;
-
- if (writebuf)
- {
- /* If OFFSET:PARTIAL_LEN is smaller than
- ROUNDED_OFFSET:WORDSIZE then a read/modify write will
- be needed. Read in the entire word. */
- if (rounded_offset < offset
- || (offset + partial_len
- < rounded_offset + sizeof (PTRACE_TYPE_RET)))
- /* Need part of initial word -- fetch it. */
- buffer.word = ptrace (PT_READ_I, PIDGET (inferior_ptid),
- (PTRACE_TYPE_ARG3) (long) rounded_offset,
- 0);
-
- /* Copy data to be written over corresponding part of
- buffer. */
- memcpy (buffer.byte + (offset - rounded_offset), writebuf, partial_len);
-
- errno = 0;
- ptrace (PT_WRITE_D, PIDGET (inferior_ptid),
- (PTRACE_TYPE_ARG3) (long) rounded_offset,
- buffer.word);
- if (errno)
- {
- /* Using the appropriate one (I or D) is necessary for
- Gould NP1, at least. */
- errno = 0;
- ptrace (PT_WRITE_I, PIDGET (inferior_ptid),
- (PTRACE_TYPE_ARG3) (long) rounded_offset,
- buffer.word);
- if (errno)
- return 0;
- }
- }
- if (readbuf)
- {
- errno = 0;
- buffer.word = ptrace (PT_READ_I, PIDGET (inferior_ptid),
- (PTRACE_TYPE_ARG3) (long) rounded_offset, 0);
- if (errno)
- return 0;
- /* Copy appropriate bytes out of the buffer. */
- memcpy (readbuf, buffer.byte + (offset - rounded_offset),
- partial_len);
- }
- return partial_len;
- }
+ if (readbuf)
+ return inf_ptrace_xfer_memory (offset, readbuf, len, 0 /*write */ ,
+ NULL, ops);
+ if (writebuf)
+ return inf_ptrace_xfer_memory (offset, readbuf, len, 1 /*write */ ,
+ NULL, ops);
+ return -1;
case TARGET_OBJECT_UNWIND_TABLE:
return -1;
@@ -604,7 +648,9 @@ inf_ptrace_target (void)
t->to_detach = inf_ptrace_detach;
t->to_resume = inf_ptrace_resume;
t->to_wait = inf_ptrace_wait;
+ t->to_post_wait = inf_ptrace_post_wait;
t->to_prepare_to_store = inf_ptrace_prepare_to_store;
+ t->to_xfer_memory = inf_ptrace_xfer_memory;
t->to_xfer_partial = inf_ptrace_xfer_partial;
t->to_files_info = inf_ptrace_files_info;
t->to_kill = inf_ptrace_kill_inferior;
diff --git a/gdb/infcall.c b/gdb/infcall.c
index ec4f11a..53bcffd 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -307,7 +307,7 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
CORE_ADDR funaddr;
int using_gcc; /* Set to version of gcc in use, or zero if not gcc */
CORE_ADDR real_pc;
- struct type *ftype = check_typedef (VALUE_TYPE (function));
+ struct type *ftype = check_typedef (SYMBOL_TYPE (function));
CORE_ADDR bp_addr;
struct regcache *caller_regcache;
struct cleanup *caller_regcache_cleanup;
diff --git a/gdb/infptrace.c b/gdb/infptrace.c
index ec4ad16..fb7736c 100644
--- a/gdb/infptrace.c
+++ b/gdb/infptrace.c
@@ -138,24 +138,17 @@ call_ptrace (int request, int pid, PTRACE_ARG3_TYPE addr, int data)
/* Wait for a process to finish, possibly running a target-specific
hook before returning. */
-/* NOTE: cagney: 2004-09-29: Dependant on the native configuration,
- "hppah-nat.c" may either call this or infttrace.c's implementation
- of ptrace_wait. See "hppahpux.mh". */
-
int
ptrace_wait (ptid_t ptid, int *status)
{
int wstate;
wstate = wait (status);
+ target_post_wait (pid_to_ptid (wstate), *status);
return wstate;
}
-#ifndef DEPRECATED_KILL_INFERIOR
-/* NOTE: cagney/2004-09-12: Instead of definining this macro, code
- should call inf_ptrace_target to get a basic ptrace target and then
- locally update any necessary methods. See ppcnbsd-nat.c. */
-
+#ifndef KILL_INFERIOR
void
kill_inferior (void)
{
@@ -174,15 +167,12 @@ kill_inferior (void)
The kill call causes problems under hpux10, so it's been removed;
if this causes problems we'll deal with them as they arise. */
ptrace (PT_KILL, pid, (PTRACE_TYPE_ARG3) 0, 0);
- wait (&status);
+ ptrace_wait (null_ptid, &status);
target_mourn_inferior ();
}
-#endif /* DEPRECATED_KILL_INFERIOR */
+#endif /* KILL_INFERIOR */
-#ifndef DEPRECATED_CHILD_RESUME
-/* NOTE: cagney/2004-09-12: Instead of definining this macro, code
- should call inf_ptrace_target to get a basic ptrace target and then
- locally update any necessary methods. See ppcnbsd-nat.c. */
+#ifndef CHILD_RESUME
/* Resume execution of the inferior process.
If STEP is nonzero, single-step it.
@@ -221,7 +211,7 @@ child_resume (ptid_t ptid, int step, enum target_signal signal)
if (errno != 0)
perror_with_name ("ptrace");
}
-#endif /* DEPRECATED_CHILD_RESUME */
+#endif /* CHILD_RESUME */
/* Start debugging the process whose number is PID. */
@@ -403,8 +393,8 @@ store_inferior_registers (int regnum)
Returns the length copied, which is either the LEN argument or
zero. This xfer function does not do partial moves, since
- deprecated_child_ops doesn't allow memory operations to cross below
- us in the target stack anyway. */
+ child_ops doesn't allow memory operations to cross below us in the
+ target stack anyway. */
int
child_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 7cf9953..cc302c2 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -935,9 +935,9 @@ void init_execution_control_state (struct execution_control_state *ecs);
void handle_inferior_event (struct execution_control_state *ecs);
static void step_into_function (struct execution_control_state *ecs);
-static void insert_step_resume_breakpoint_at_frame (struct frame_info *step_frame);
-static void insert_step_resume_breakpoint_at_sal (struct symtab_and_line sr_sal,
- struct frame_id sr_id);
+static void insert_step_resume_breakpoint (struct frame_info *step_frame,
+ struct execution_control_state
+ *ecs);
static void stop_stepping (struct execution_control_state *ecs);
static void prepare_to_wait (struct execution_control_state *ecs);
static void keep_going (struct execution_control_state *ecs);
@@ -1081,6 +1081,18 @@ init_execution_control_state (struct execution_control_state *ecs)
ecs->wp = &(ecs->ws);
}
+/* Call this function before setting step_resume_breakpoint, as a
+ sanity check. There should never be more than one step-resume
+ breakpoint per thread, so we should never be setting a new
+ step_resume_breakpoint when one is already active. */
+static void
+check_for_old_step_resume_breakpoint (void)
+{
+ if (step_resume_breakpoint)
+ warning
+ ("GDB bug: infrun.c (wait_for_inferior): dropping old step_resume breakpoint");
+}
+
/* Return the cached copy of the last pid/waitstatus returned by
target_wait()/deprecated_target_wait_hook(). The data is actually
cached by handle_inferior_event(), which gets called immediately
@@ -1935,7 +1947,7 @@ process_event_stop_test:
code paths as single-step - set a breakpoint at the
signal return address and then, once hit, step off that
breakpoint. */
- insert_step_resume_breakpoint_at_frame (get_current_frame ());
+ insert_step_resume_breakpoint (get_current_frame (), ecs);
ecs->step_after_step_resume_breakpoint = 1;
}
else if (step_range_end != 0
@@ -1953,7 +1965,7 @@ process_event_stop_test:
Note that this is only needed for a signal delivered
while in the single-step range. Nested signals aren't a
problem as they eventually all return. */
- insert_step_resume_breakpoint_at_frame (get_current_frame ());
+ insert_step_resume_breakpoint (get_current_frame (), ecs);
}
keep_going (ecs);
return;
@@ -2261,7 +2273,11 @@ process_event_stop_test:
init_sal (&sr_sal);
sr_sal.pc = pc_after_resolver;
- insert_step_resume_breakpoint_at_sal (sr_sal, null_frame_id);
+ check_for_old_step_resume_breakpoint ();
+ step_resume_breakpoint =
+ set_momentary_breakpoint (sr_sal, null_frame_id, bp_step_resume);
+ if (breakpoints_inserted)
+ insert_breakpoints ();
}
keep_going (ecs);
@@ -2319,7 +2335,8 @@ process_event_stop_test:
/* We're doing a "next", set a breakpoint at callee's return
address (the address at which the caller will
resume). */
- insert_step_resume_breakpoint_at_frame (get_prev_frame (get_current_frame ()));
+ insert_step_resume_breakpoint (get_prev_frame
+ (get_current_frame ()), ecs);
keep_going (ecs);
return;
}
@@ -2329,7 +2346,8 @@ process_event_stop_test:
/* We're doing a "next", set a breakpoint at callee's return
address (the address at which the caller will
resume). */
- insert_step_resume_breakpoint_at_frame (get_prev_frame (get_current_frame ()));
+ insert_step_resume_breakpoint (get_prev_frame
+ (get_current_frame ()), ecs);
keep_going (ecs);
return;
}
@@ -2351,7 +2369,12 @@ process_event_stop_test:
init_sal (&sr_sal);
sr_sal.pc = ecs->stop_func_start;
- insert_step_resume_breakpoint_at_sal (sr_sal, null_frame_id);
+ check_for_old_step_resume_breakpoint ();
+ step_resume_breakpoint =
+ set_momentary_breakpoint (sr_sal, null_frame_id, bp_step_resume);
+ if (breakpoints_inserted)
+ insert_breakpoints ();
+
keep_going (ecs);
return;
}
@@ -2386,7 +2409,8 @@ process_event_stop_test:
/* Set a breakpoint at callee's return address (the address at
which the caller will resume). */
- insert_step_resume_breakpoint_at_frame (get_prev_frame (get_current_frame ()));
+ insert_step_resume_breakpoint (get_prev_frame (get_current_frame ()),
+ ecs);
keep_going (ecs);
return;
}
@@ -2407,11 +2431,14 @@ process_event_stop_test:
init_sal (&sr_sal); /* initialize to zeroes */
sr_sal.pc = real_stop_pc;
sr_sal.section = find_pc_overlay (sr_sal.pc);
-
- /* Do not specify what the fp should be when we stop since
- on some machines the prologue is where the new fp value
- is established. */
- insert_step_resume_breakpoint_at_sal (sr_sal, null_frame_id);
+ /* Do not specify what the fp should be when we stop
+ since on some machines the prologue
+ is where the new fp value is established. */
+ check_for_old_step_resume_breakpoint ();
+ step_resume_breakpoint =
+ set_momentary_breakpoint (sr_sal, null_frame_id, bp_step_resume);
+ if (breakpoints_inserted)
+ insert_breakpoints ();
/* Restart without fiddling with the step ranges or
other state. */
@@ -2446,7 +2473,8 @@ process_event_stop_test:
{
/* Set a breakpoint at callee's return address (the address
at which the caller will resume). */
- insert_step_resume_breakpoint_at_frame (get_prev_frame (get_current_frame ()));
+ insert_step_resume_breakpoint (get_prev_frame
+ (get_current_frame ()), ecs);
keep_going (ecs);
return;
}
@@ -2617,11 +2645,14 @@ step_into_function (struct execution_control_state *ecs)
init_sal (&sr_sal); /* initialize to zeroes */
sr_sal.pc = ecs->stop_func_start;
sr_sal.section = find_pc_overlay (ecs->stop_func_start);
-
/* Do not specify what the fp should be when we stop since on
some machines the prologue is where the new fp value is
established. */
- insert_step_resume_breakpoint_at_sal (sr_sal, null_frame_id);
+ check_for_old_step_resume_breakpoint ();
+ step_resume_breakpoint =
+ set_momentary_breakpoint (sr_sal, null_frame_id, bp_step_resume);
+ if (breakpoints_inserted)
+ insert_breakpoints ();
/* And make sure stepping stops right away then. */
step_range_end = step_range_start;
@@ -2629,23 +2660,6 @@ step_into_function (struct execution_control_state *ecs)
keep_going (ecs);
}
-/* Insert a "step resume breakpoint" at SR_SAL with frame ID SR_ID.
- This is used to both functions and to skip over code. */
-
-static void
-insert_step_resume_breakpoint_at_sal (struct symtab_and_line sr_sal,
- struct frame_id sr_id)
-{
- /* There should never be more than one step-resume breakpoint per
- thread, so we should never be setting a new
- step_resume_breakpoint when one is already active. */
- gdb_assert (step_resume_breakpoint == NULL);
- step_resume_breakpoint = set_momentary_breakpoint (sr_sal, sr_id,
- bp_step_resume);
- if (breakpoints_inserted)
- insert_breakpoints ();
-}
-
/* Insert a "step resume breakpoint" at RETURN_FRAME.pc. This is used
to skip a function (next, skip-no-debug) or signal. It's assumed
that the function/signal handler being skipped eventually returns
@@ -2661,7 +2675,8 @@ insert_step_resume_breakpoint_at_sal (struct symtab_and_line sr_sal,
the interrupted function at RETURN_FRAME.pc. */
static void
-insert_step_resume_breakpoint_at_frame (struct frame_info *return_frame)
+insert_step_resume_breakpoint (struct frame_info *return_frame,
+ struct execution_control_state *ecs)
{
struct symtab_and_line sr_sal;
@@ -2670,7 +2685,14 @@ insert_step_resume_breakpoint_at_frame (struct frame_info *return_frame)
sr_sal.pc = ADDR_BITS_REMOVE (get_frame_pc (return_frame));
sr_sal.section = find_pc_overlay (sr_sal.pc);
- insert_step_resume_breakpoint_at_sal (sr_sal, get_frame_id (return_frame));
+ check_for_old_step_resume_breakpoint ();
+
+ step_resume_breakpoint
+ = set_momentary_breakpoint (sr_sal, get_frame_id (return_frame),
+ bp_step_resume);
+
+ if (breakpoints_inserted)
+ insert_breakpoints ();
}
static void
diff --git a/gdb/inftarg.c b/gdb/inftarg.c
index e9ace23..68efdac 100644
--- a/gdb/inftarg.c
+++ b/gdb/inftarg.c
@@ -53,6 +53,10 @@ static void child_prepare_to_store (void);
static ptid_t child_wait (ptid_t, struct target_waitstatus *);
#endif /* CHILD_WAIT */
+#if !defined(CHILD_POST_WAIT)
+void child_post_wait (ptid_t, int);
+#endif
+
static void child_open (char *, int);
static void child_files_info (struct target_ops *);
@@ -85,6 +89,8 @@ static void init_child_ops (void);
extern char **environ;
+struct target_ops child_ops;
+
int child_suppress_run = 0; /* Non-zero if inftarg should pretend not to
be a runnable target. Used by targets
that can sit atop inftarg, such as HPUX
@@ -113,7 +119,7 @@ child_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
attached process. */
set_sigio_trap ();
- pid = wait (&status);
+ pid = ptrace_wait (inferior_ptid, &status);
save_errno = errno;
@@ -155,6 +161,17 @@ child_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
}
#endif /* CHILD_WAIT */
+#if !defined(CHILD_POST_WAIT)
+void
+child_post_wait (ptid_t ptid, int wait_status)
+{
+ /* This version of Unix doesn't require a meaningful "post wait"
+ operation.
+ */
+}
+#endif
+
+
#ifndef CHILD_THREAD_ALIVE
/* Check to see if the given thread is alive.
@@ -210,7 +227,7 @@ child_attach (char *args, int from_tty)
attach (pid);
inferior_ptid = pid_to_ptid (pid);
- push_target (&deprecated_child_ops);
+ push_target (&child_ops);
}
#if !defined(CHILD_POST_ATTACH)
@@ -251,7 +268,7 @@ child_detach (char *args, int from_tty)
detach (siggnal);
inferior_ptid = null_ptid;
- unpush_target (&deprecated_child_ops);
+ unpush_target (&child_ops);
}
/* Get ready to modify the registers array. On machines which store
@@ -299,7 +316,7 @@ ptrace_me (void)
static void
ptrace_him (int pid)
{
- push_target (&deprecated_child_ops);
+ push_target (&child_ops);
/* On some targets, there must be some explicit synchronization
between the parent and child processes after the debugger
@@ -462,7 +479,7 @@ child_has_exited (int pid, int wait_status, int *exit_status)
static void
child_mourn_inferior (void)
{
- unpush_target (&deprecated_child_ops);
+ unpush_target (&child_ops);
generic_mourn_inferior ();
}
@@ -540,7 +557,7 @@ child_xfer_partial (struct target_ops *ops, enum target_object object,
return child_xfer_memory (offset, readbuf, len, 0/*write*/,
NULL, ops);
if (writebuf)
- return child_xfer_memory (offset, (void *) writebuf, len, 1/*write*/,
+ return child_xfer_memory (offset, readbuf, len, 1/*write*/,
NULL, ops);
return -1;
@@ -581,57 +598,76 @@ child_pid_to_str (ptid_t ptid)
static void
init_child_ops (void)
{
- deprecated_child_ops.to_shortname = "child";
- deprecated_child_ops.to_longname = "Unix child process";
- deprecated_child_ops.to_doc = "Unix child process (started by the \"run\" command).";
- deprecated_child_ops.to_open = child_open;
- deprecated_child_ops.to_attach = child_attach;
- deprecated_child_ops.to_post_attach = child_post_attach;
- deprecated_child_ops.to_detach = child_detach;
- deprecated_child_ops.to_resume = child_resume;
- deprecated_child_ops.to_wait = child_wait;
- deprecated_child_ops.to_fetch_registers = fetch_inferior_registers;
- deprecated_child_ops.to_store_registers = store_inferior_registers;
- deprecated_child_ops.to_prepare_to_store = child_prepare_to_store;
- deprecated_child_ops.deprecated_xfer_memory = child_xfer_memory;
- deprecated_child_ops.to_xfer_partial = child_xfer_partial;
- deprecated_child_ops.to_files_info = child_files_info;
- deprecated_child_ops.to_insert_breakpoint = memory_insert_breakpoint;
- deprecated_child_ops.to_remove_breakpoint = memory_remove_breakpoint;
- deprecated_child_ops.to_terminal_init = terminal_init_inferior;
- deprecated_child_ops.to_terminal_inferior = terminal_inferior;
- deprecated_child_ops.to_terminal_ours_for_output = terminal_ours_for_output;
- deprecated_child_ops.to_terminal_save_ours = terminal_save_ours;
- deprecated_child_ops.to_terminal_ours = terminal_ours;
- deprecated_child_ops.to_terminal_info = child_terminal_info;
- deprecated_child_ops.to_kill = kill_inferior;
- deprecated_child_ops.to_create_inferior = child_create_inferior;
- deprecated_child_ops.to_post_startup_inferior = child_post_startup_inferior;
- deprecated_child_ops.to_acknowledge_created_inferior = child_acknowledge_created_inferior;
- deprecated_child_ops.to_insert_fork_catchpoint = child_insert_fork_catchpoint;
- deprecated_child_ops.to_remove_fork_catchpoint = child_remove_fork_catchpoint;
- deprecated_child_ops.to_insert_vfork_catchpoint = child_insert_vfork_catchpoint;
- deprecated_child_ops.to_remove_vfork_catchpoint = child_remove_vfork_catchpoint;
- deprecated_child_ops.to_follow_fork = child_follow_fork;
- deprecated_child_ops.to_insert_exec_catchpoint = child_insert_exec_catchpoint;
- deprecated_child_ops.to_remove_exec_catchpoint = child_remove_exec_catchpoint;
- deprecated_child_ops.to_reported_exec_events_per_exec_call = child_reported_exec_events_per_exec_call;
- deprecated_child_ops.to_has_exited = child_has_exited;
- deprecated_child_ops.to_mourn_inferior = child_mourn_inferior;
- deprecated_child_ops.to_can_run = child_can_run;
- deprecated_child_ops.to_thread_alive = child_thread_alive;
- deprecated_child_ops.to_pid_to_str = child_pid_to_str;
- deprecated_child_ops.to_stop = child_stop;
- deprecated_child_ops.to_enable_exception_callback = child_enable_exception_callback;
- deprecated_child_ops.to_get_current_exception_event = child_get_current_exception_event;
- deprecated_child_ops.to_pid_to_exec_file = child_pid_to_exec_file;
- deprecated_child_ops.to_stratum = process_stratum;
- deprecated_child_ops.to_has_all_memory = 1;
- deprecated_child_ops.to_has_memory = 1;
- deprecated_child_ops.to_has_stack = 1;
- deprecated_child_ops.to_has_registers = 1;
- deprecated_child_ops.to_has_execution = 1;
- deprecated_child_ops.to_magic = OPS_MAGIC;
+ child_ops.to_shortname = "child";
+ child_ops.to_longname = "Unix child process";
+ child_ops.to_doc = "Unix child process (started by the \"run\" command).";
+ child_ops.to_open = child_open;
+ child_ops.to_attach = child_attach;
+ child_ops.to_post_attach = child_post_attach;
+ child_ops.to_detach = child_detach;
+ child_ops.to_resume = child_resume;
+ child_ops.to_wait = child_wait;
+ child_ops.to_post_wait = child_post_wait;
+ child_ops.to_fetch_registers = fetch_inferior_registers;
+ child_ops.to_store_registers = store_inferior_registers;
+ child_ops.to_prepare_to_store = child_prepare_to_store;
+ child_ops.to_xfer_memory = child_xfer_memory;
+ child_ops.to_xfer_partial = child_xfer_partial;
+ child_ops.to_files_info = child_files_info;
+ child_ops.to_insert_breakpoint = memory_insert_breakpoint;
+ child_ops.to_remove_breakpoint = memory_remove_breakpoint;
+ child_ops.to_terminal_init = terminal_init_inferior;
+ child_ops.to_terminal_inferior = terminal_inferior;
+ child_ops.to_terminal_ours_for_output = terminal_ours_for_output;
+ child_ops.to_terminal_save_ours = terminal_save_ours;
+ child_ops.to_terminal_ours = terminal_ours;
+ child_ops.to_terminal_info = child_terminal_info;
+ child_ops.to_kill = kill_inferior;
+ child_ops.to_create_inferior = child_create_inferior;
+ child_ops.to_post_startup_inferior = child_post_startup_inferior;
+ child_ops.to_acknowledge_created_inferior = child_acknowledge_created_inferior;
+ child_ops.to_insert_fork_catchpoint = child_insert_fork_catchpoint;
+ child_ops.to_remove_fork_catchpoint = child_remove_fork_catchpoint;
+ child_ops.to_insert_vfork_catchpoint = child_insert_vfork_catchpoint;
+ child_ops.to_remove_vfork_catchpoint = child_remove_vfork_catchpoint;
+ child_ops.to_follow_fork = child_follow_fork;
+ child_ops.to_insert_exec_catchpoint = child_insert_exec_catchpoint;
+ child_ops.to_remove_exec_catchpoint = child_remove_exec_catchpoint;
+ child_ops.to_reported_exec_events_per_exec_call = child_reported_exec_events_per_exec_call;
+ child_ops.to_has_exited = child_has_exited;
+ child_ops.to_mourn_inferior = child_mourn_inferior;
+ child_ops.to_can_run = child_can_run;
+ child_ops.to_thread_alive = child_thread_alive;
+ child_ops.to_pid_to_str = child_pid_to_str;
+ child_ops.to_stop = child_stop;
+ child_ops.to_enable_exception_callback = child_enable_exception_callback;
+ child_ops.to_get_current_exception_event = child_get_current_exception_event;
+ child_ops.to_pid_to_exec_file = child_pid_to_exec_file;
+ child_ops.to_stratum = process_stratum;
+ child_ops.to_has_all_memory = 1;
+ child_ops.to_has_memory = 1;
+ child_ops.to_has_stack = 1;
+ child_ops.to_has_registers = 1;
+ child_ops.to_has_execution = 1;
+ child_ops.to_magic = OPS_MAGIC;
+}
+
+/* Take over the 'find_mapped_memory' vector from inftarg.c. */
+extern void
+inftarg_set_find_memory_regions (int (*func) (int (*) (CORE_ADDR,
+ unsigned long,
+ int, int, int,
+ void *),
+ void *))
+{
+ child_ops.to_find_memory_regions = func;
+}
+
+/* Take over the 'make_corefile_notes' vector from inftarg.c. */
+extern void
+inftarg_set_make_corefile_notes (char * (*func) (bfd *, int *))
+{
+ child_ops.to_make_corefile_notes = func;
}
void
@@ -656,5 +692,5 @@ _initialize_inftarg (void)
#endif
init_child_ops ();
- add_target (&deprecated_child_ops);
+ add_target (&child_ops);
}
diff --git a/gdb/infttrace.c b/gdb/infttrace.c
index 4171651..fcb4d02 100644
--- a/gdb/infttrace.c
+++ b/gdb/infttrace.c
@@ -2888,6 +2888,9 @@ ptrace_wait (ptid_t ptid, int *status)
*status = _SIGTRAP;
}
+ target_post_wait (pid_to_ptid (tsp.tts_pid), *status);
+
+
#ifdef THREAD_DEBUG
if (debug_on)
printf ("Done waiting, pid is %d, tid %d\n", real_pid, real_tid);
@@ -3839,7 +3842,7 @@ kill_inferior (void)
}
-#ifndef DEPRECATED_CHILD_RESUME
+#ifndef CHILD_RESUME
/* Sanity check a thread about to be continued.
*/
@@ -4250,7 +4253,7 @@ threads_continue_one_with_signal (lwpid_t gdb_tid, int signal)
}
#endif
-#ifndef DEPRECATED_CHILD_RESUME
+#ifndef CHILD_RESUME
/* Resume execution of the inferior process.
@@ -4551,7 +4554,7 @@ child_resume (ptid_t ptid, int step, enum target_signal signal)
#endif
}
-#endif /* DEPRECATED_CHILD_RESUME */
+#endif /* CHILD_RESUME */
/*
* Like it says.
@@ -4815,10 +4818,10 @@ _initialize_kernel_u_addr (void)
to debugger memory starting at MYADDR. Copy to inferior if
WRITE is nonzero. TARGET is ignored.
- Returns the length copied, which is either the LEN argument or
- zero. This xfer function does not do partial moves, since
- deprecated_child_ops doesn't allow memory operations to cross below
- us in the target stack anyway. */
+ Returns the length copied, which is either the LEN argument or zero.
+ This xfer function does not do partial moves, since child_ops
+ doesn't allow memory operations to cross below us in the target stack
+ anyway. */
int
child_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
diff --git a/gdb/jv-exp.y b/gdb/jv-exp.y
index a3d1210..41da7d0 100644
--- a/gdb/jv-exp.y
+++ b/gdb/jv-exp.y
@@ -446,22 +446,13 @@ FieldAccess:
/*| SUPER '.' SimpleName { FIXME } */
;
-FuncStart:
- Name '('
- { push_expression_name ($1); }
-;
-
MethodInvocation:
- FuncStart
- { start_arglist(); }
- ArgumentList_opt ')'
- { write_exp_elt_opcode (OP_FUNCALL);
- write_exp_elt_longcst ((LONGEST) end_arglist ());
- write_exp_elt_opcode (OP_FUNCALL); }
+ Name '(' ArgumentList_opt ')'
+ { error (_("Method invocation not implemented")); }
| Primary '.' SimpleName '(' ArgumentList_opt ')'
- { error (_("Form of method invocation not implemented")); }
+ { error (_("Method invocation not implemented")); }
| SUPER '.' SimpleName '(' ArgumentList_opt ')'
- { error (_("Form of method invocation not implemented")); }
+ { error (_("Method invocation not implemented")); }
;
ArrayAccess:
diff --git a/gdb/language.c b/gdb/language.c
index cdf35ea..d705062 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -1286,7 +1286,7 @@ language_gdbarch_post_init (struct gdbarch *gdbarch)
int i;
l = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct language_gdbarch);
- for (i = 0; i < languages_size; i++)
+ for (i = 0; i <= languages_size; i++)
{
if (languages[i] != NULL
&& languages[i]->la_language_arch_info != NULL)
diff --git a/gdb/lin-lwp.c b/gdb/lin-lwp.c
new file mode 100644
index 0000000..5971630
--- /dev/null
+++ b/gdb/lin-lwp.c
@@ -0,0 +1,1971 @@
+/* Multi-threaded debugging support for GNU/Linux (LWP layer).
+ Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include "defs.h"
+
+#include "gdb_assert.h"
+#include "gdb_string.h"
+#include <errno.h>
+#include <signal.h>
+#ifdef HAVE_TKILL_SYSCALL
+#include <unistd.h>
+#include <sys/syscall.h>
+#endif
+#include <sys/ptrace.h>
+#include "gdb_wait.h"
+
+#include "gdbthread.h"
+#include "inferior.h"
+#include "target.h"
+#include "regcache.h"
+#include "gdbcmd.h"
+
+static int debug_lin_lwp;
+extern char *strsignal (int sig);
+
+#include "linux-nat.h"
+
+/* On GNU/Linux there are no real LWP's. The closest thing to LWP's
+ are processes sharing the same VM space. A multi-threaded process
+ is basically a group of such processes. However, such a grouping
+ is almost entirely a user-space issue; the kernel doesn't enforce
+ such a grouping at all (this might change in the future). In
+ general, we'll rely on the threads library (i.e. the GNU/Linux
+ Threads library) to provide such a grouping.
+
+ It is perfectly well possible to write a multi-threaded application
+ without the assistance of a threads library, by using the clone
+ system call directly. This module should be able to give some
+ rudimentary support for debugging such applications if developers
+ specify the CLONE_PTRACE flag in the clone system call, and are
+ using the Linux kernel 2.4 or above.
+
+ Note that there are some peculiarities in GNU/Linux that affect
+ this code:
+
+ - In general one should specify the __WCLONE flag to waitpid in
+ order to make it report events for any of the cloned processes
+ (and leave it out for the initial process). However, if a cloned
+ process has exited the exit status is only reported if the
+ __WCLONE flag is absent. Linux kernel 2.4 has a __WALL flag, but
+ we cannot use it since GDB must work on older systems too.
+
+ - When a traced, cloned process exits and is waited for by the
+ debugger, the kernel reassigns it to the original parent and
+ keeps it around as a "zombie". Somehow, the GNU/Linux Threads
+ library doesn't notice this, which leads to the "zombie problem":
+ When debugged a multi-threaded process that spawns a lot of
+ threads will run out of processes, even if the threads exit,
+ because the "zombies" stay around. */
+
+/* List of known LWPs. */
+static struct lwp_info *lwp_list;
+
+/* Number of LWPs in the list. */
+static int num_lwps;
+
+/* Non-zero if we're running in "threaded" mode. */
+static int threaded;
+
+
+#define GET_LWP(ptid) ptid_get_lwp (ptid)
+#define GET_PID(ptid) ptid_get_pid (ptid)
+#define is_lwp(ptid) (GET_LWP (ptid) != 0)
+#define BUILD_LWP(lwp, pid) ptid_build (pid, lwp, 0)
+
+/* If the last reported event was a SIGTRAP, this variable is set to
+ the process id of the LWP/thread that got it. */
+ptid_t trap_ptid;
+
+
+/* This module's target-specific operations. */
+static struct target_ops lin_lwp_ops;
+
+/* The standard child operations. */
+extern struct target_ops child_ops;
+
+/* Since we cannot wait (in lin_lwp_wait) for the initial process and
+ any cloned processes with a single call to waitpid, we have to use
+ the WNOHANG flag and call waitpid in a loop. To optimize
+ things a bit we use `sigsuspend' to wake us up when a process has
+ something to report (it will send us a SIGCHLD if it has). To make
+ this work we have to juggle with the signal mask. We save the
+ original signal mask such that we can restore it before creating a
+ new process in order to avoid blocking certain signals in the
+ inferior. We then block SIGCHLD during the waitpid/sigsuspend
+ loop. */
+
+/* Original signal mask. */
+static sigset_t normal_mask;
+
+/* Signal mask for use with sigsuspend in lin_lwp_wait, initialized in
+ _initialize_lin_lwp. */
+static sigset_t suspend_mask;
+
+/* Signals to block to make that sigsuspend work. */
+static sigset_t blocked_mask;
+
+
+/* Prototypes for local functions. */
+static int stop_wait_callback (struct lwp_info *lp, void *data);
+static int lin_lwp_thread_alive (ptid_t ptid);
+
+/* Convert wait status STATUS to a string. Used for printing debug
+ messages only. */
+
+static char *
+status_to_str (int status)
+{
+ static char buf[64];
+
+ if (WIFSTOPPED (status))
+ snprintf (buf, sizeof (buf), "%s (stopped)",
+ strsignal (WSTOPSIG (status)));
+ else if (WIFSIGNALED (status))
+ snprintf (buf, sizeof (buf), "%s (terminated)",
+ strsignal (WSTOPSIG (status)));
+ else
+ snprintf (buf, sizeof (buf), "%d (exited)", WEXITSTATUS (status));
+
+ return buf;
+}
+
+/* Initialize the list of LWPs. Note that this module, contrary to
+ what GDB's generic threads layer does for its thread list,
+ re-initializes the LWP lists whenever we mourn or detach (which
+ doesn't involve mourning) the inferior. */
+
+static void
+init_lwp_list (void)
+{
+ struct lwp_info *lp, *lpnext;
+
+ for (lp = lwp_list; lp; lp = lpnext)
+ {
+ lpnext = lp->next;
+ xfree (lp);
+ }
+
+ lwp_list = NULL;
+ num_lwps = 0;
+ threaded = 0;
+}
+
+/* Add the LWP specified by PID to the list. If this causes the
+ number of LWPs to become larger than one, go into "threaded" mode.
+ Return a pointer to the structure describing the new LWP. */
+
+static struct lwp_info *
+add_lwp (ptid_t ptid)
+{
+ struct lwp_info *lp;
+
+ gdb_assert (is_lwp (ptid));
+
+ lp = (struct lwp_info *) xmalloc (sizeof (struct lwp_info));
+
+ memset (lp, 0, sizeof (struct lwp_info));
+
+ lp->waitstatus.kind = TARGET_WAITKIND_IGNORE;
+
+ lp->ptid = ptid;
+
+ lp->next = lwp_list;
+ lwp_list = lp;
+ if (++num_lwps > 1)
+ threaded = 1;
+
+ return lp;
+}
+
+/* Remove the LWP specified by PID from the list. */
+
+static void
+delete_lwp (ptid_t ptid)
+{
+ struct lwp_info *lp, *lpprev;
+
+ lpprev = NULL;
+
+ for (lp = lwp_list; lp; lpprev = lp, lp = lp->next)
+ if (ptid_equal (lp->ptid, ptid))
+ break;
+
+ if (!lp)
+ return;
+
+ /* We don't go back to "non-threaded" mode if the number of threads
+ becomes less than two. */
+ num_lwps--;
+
+ if (lpprev)
+ lpprev->next = lp->next;
+ else
+ lwp_list = lp->next;
+
+ xfree (lp);
+}
+
+/* Return a pointer to the structure describing the LWP corresponding
+ to PID. If no corresponding LWP could be found, return NULL. */
+
+static struct lwp_info *
+find_lwp_pid (ptid_t ptid)
+{
+ struct lwp_info *lp;
+ int lwp;
+
+ if (is_lwp (ptid))
+ lwp = GET_LWP (ptid);
+ else
+ lwp = GET_PID (ptid);
+
+ for (lp = lwp_list; lp; lp = lp->next)
+ if (lwp == GET_LWP (lp->ptid))
+ return lp;
+
+ return NULL;
+}
+
+/* Call CALLBACK with its second argument set to DATA for every LWP in
+ the list. If CALLBACK returns 1 for a particular LWP, return a
+ pointer to the structure describing that LWP immediately.
+ Otherwise return NULL. */
+
+struct lwp_info *
+iterate_over_lwps (int (*callback) (struct lwp_info *, void *), void *data)
+{
+ struct lwp_info *lp, *lpnext;
+
+ for (lp = lwp_list; lp; lp = lpnext)
+ {
+ lpnext = lp->next;
+ if ((*callback) (lp, data))
+ return lp;
+ }
+
+ return NULL;
+}
+
+
+#if 0
+static void
+lin_lwp_open (char *args, int from_tty)
+{
+ push_target (&lin_lwp_ops);
+}
+#endif
+
+/* Attach to the LWP specified by PID. If VERBOSE is non-zero, print
+ a message telling the user that a new LWP has been added to the
+ process. */
+
+void
+lin_lwp_attach_lwp (ptid_t ptid, int verbose)
+{
+ struct lwp_info *lp, *found_lp;
+
+ gdb_assert (is_lwp (ptid));
+
+ /* Make sure SIGCHLD is blocked. We don't want SIGCHLD events
+ to interrupt either the ptrace() or waitpid() calls below. */
+ if (!sigismember (&blocked_mask, SIGCHLD))
+ {
+ sigaddset (&blocked_mask, SIGCHLD);
+ sigprocmask (SIG_BLOCK, &blocked_mask, NULL);
+ }
+
+ if (verbose)
+ printf_filtered ("[New %s]\n", target_pid_to_str (ptid));
+
+ found_lp = lp = find_lwp_pid (ptid);
+ if (lp == NULL)
+ lp = add_lwp (ptid);
+
+ /* We assume that we're already attached to any LWP that has an id
+ equal to the overall process id, and to any LWP that is already
+ in our list of LWPs. If we're not seeing exit events from threads
+ and we've had PID wraparound since we last tried to stop all threads,
+ this assumption might be wrong; fortunately, this is very unlikely
+ to happen. */
+ if (GET_LWP (ptid) != GET_PID (ptid) && found_lp == NULL)
+ {
+ pid_t pid;
+ int status;
+
+ if (ptrace (PTRACE_ATTACH, GET_LWP (ptid), 0, 0) < 0)
+ error ("Can't attach %s: %s", target_pid_to_str (ptid),
+ safe_strerror (errno));
+
+ if (debug_lin_lwp)
+ fprintf_unfiltered (gdb_stdlog,
+ "LLAL: PTRACE_ATTACH %s, 0, 0 (OK)\n",
+ target_pid_to_str (ptid));
+
+ pid = waitpid (GET_LWP (ptid), &status, 0);
+ if (pid == -1 && errno == ECHILD)
+ {
+ /* Try again with __WCLONE to check cloned processes. */
+ pid = waitpid (GET_LWP (ptid), &status, __WCLONE);
+ lp->cloned = 1;
+ }
+
+ gdb_assert (pid == GET_LWP (ptid)
+ && WIFSTOPPED (status) && WSTOPSIG (status));
+
+ child_post_attach (pid);
+
+ lp->stopped = 1;
+
+ if (debug_lin_lwp)
+ {
+ fprintf_unfiltered (gdb_stdlog,
+ "LLAL: waitpid %s received %s\n",
+ target_pid_to_str (ptid),
+ status_to_str (status));
+ }
+ }
+ else
+ {
+ /* We assume that the LWP representing the original process
+ is already stopped. Mark it as stopped in the data structure
+ that the lin-lwp layer uses to keep track of threads. Note
+ that this won't have already been done since the main thread
+ will have, we assume, been stopped by an attach from a
+ different layer. */
+ lp->stopped = 1;
+ }
+}
+
+static void
+lin_lwp_attach (char *args, int from_tty)
+{
+ struct lwp_info *lp;
+ pid_t pid;
+ int status;
+
+ /* FIXME: We should probably accept a list of process id's, and
+ attach all of them. */
+ child_ops.to_attach (args, from_tty);
+
+ /* Add the initial process as the first LWP to the list. */
+ lp = add_lwp (BUILD_LWP (GET_PID (inferior_ptid), GET_PID (inferior_ptid)));
+
+ /* Make sure the initial process is stopped. The user-level threads
+ layer might want to poke around in the inferior, and that won't
+ work if things haven't stabilized yet. */
+ pid = waitpid (GET_PID (inferior_ptid), &status, 0);
+ if (pid == -1 && errno == ECHILD)
+ {
+ warning ("%s is a cloned process", target_pid_to_str (inferior_ptid));
+
+ /* Try again with __WCLONE to check cloned processes. */
+ pid = waitpid (GET_PID (inferior_ptid), &status, __WCLONE);
+ lp->cloned = 1;
+ }
+
+ gdb_assert (pid == GET_PID (inferior_ptid)
+ && WIFSTOPPED (status) && WSTOPSIG (status) == SIGSTOP);
+
+ lp->stopped = 1;
+
+ /* Fake the SIGSTOP that core GDB expects. */
+ lp->status = W_STOPCODE (SIGSTOP);
+ lp->resumed = 1;
+ if (debug_lin_lwp)
+ {
+ fprintf_unfiltered (gdb_stdlog,
+ "LLA: waitpid %ld, faking SIGSTOP\n", (long) pid);
+ }
+}
+
+static int
+detach_callback (struct lwp_info *lp, void *data)
+{
+ gdb_assert (lp->status == 0 || WIFSTOPPED (lp->status));
+
+ if (debug_lin_lwp && lp->status)
+ fprintf_unfiltered (gdb_stdlog, "DC: Pending %s for %s on detach.\n",
+ strsignal (WSTOPSIG (lp->status)),
+ target_pid_to_str (lp->ptid));
+
+ while (lp->signalled && lp->stopped)
+ {
+ errno = 0;
+ if (ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0,
+ WSTOPSIG (lp->status)) < 0)
+ error ("Can't continue %s: %s", target_pid_to_str (lp->ptid),
+ safe_strerror (errno));
+
+ if (debug_lin_lwp)
+ fprintf_unfiltered (gdb_stdlog,
+ "DC: PTRACE_CONTINUE (%s, 0, %s) (OK)\n",
+ target_pid_to_str (lp->ptid),
+ status_to_str (lp->status));
+
+ lp->stopped = 0;
+ lp->signalled = 0;
+ lp->status = 0;
+ /* FIXME drow/2003-08-26: There was a call to stop_wait_callback
+ here. But since lp->signalled was cleared above,
+ stop_wait_callback didn't do anything; the process was left
+ running. Shouldn't we be waiting for it to stop?
+ I've removed the call, since stop_wait_callback now does do
+ something when called with lp->signalled == 0. */
+
+ gdb_assert (lp->status == 0 || WIFSTOPPED (lp->status));
+ }
+
+ /* We don't actually detach from the LWP that has an id equal to the
+ overall process id just yet. */
+ if (GET_LWP (lp->ptid) != GET_PID (lp->ptid))
+ {
+ errno = 0;
+ if (ptrace (PTRACE_DETACH, GET_LWP (lp->ptid), 0,
+ WSTOPSIG (lp->status)) < 0)
+ error ("Can't detach %s: %s", target_pid_to_str (lp->ptid),
+ safe_strerror (errno));
+
+ if (debug_lin_lwp)
+ fprintf_unfiltered (gdb_stdlog,
+ "PTRACE_DETACH (%s, %s, 0) (OK)\n",
+ target_pid_to_str (lp->ptid),
+ strsignal (WSTOPSIG (lp->status)));
+
+ delete_lwp (lp->ptid);
+ }
+
+ return 0;
+}
+
+static void
+lin_lwp_detach (char *args, int from_tty)
+{
+ iterate_over_lwps (detach_callback, NULL);
+
+ /* Only the initial process should be left right now. */
+ gdb_assert (num_lwps == 1);
+
+ trap_ptid = null_ptid;
+
+ /* Destroy LWP info; it's no longer valid. */
+ init_lwp_list ();
+
+ /* Restore the original signal mask. */
+ sigprocmask (SIG_SETMASK, &normal_mask, NULL);
+ sigemptyset (&blocked_mask);
+
+ inferior_ptid = pid_to_ptid (GET_PID (inferior_ptid));
+ child_ops.to_detach (args, from_tty);
+}
+
+
+/* Resume LP. */
+
+static int
+resume_callback (struct lwp_info *lp, void *data)
+{
+ if (lp->stopped && lp->status == 0)
+ {
+ struct thread_info *tp;
+
+ child_resume (pid_to_ptid (GET_LWP (lp->ptid)), 0, TARGET_SIGNAL_0);
+ if (debug_lin_lwp)
+ fprintf_unfiltered (gdb_stdlog,
+ "RC: PTRACE_CONT %s, 0, 0 (resume sibling)\n",
+ target_pid_to_str (lp->ptid));
+ lp->stopped = 0;
+ lp->step = 0;
+ }
+
+ return 0;
+}
+
+static int
+resume_clear_callback (struct lwp_info *lp, void *data)
+{
+ lp->resumed = 0;
+ return 0;
+}
+
+static int
+resume_set_callback (struct lwp_info *lp, void *data)
+{
+ lp->resumed = 1;
+ return 0;
+}
+
+static void
+lin_lwp_resume (ptid_t ptid, int step, enum target_signal signo)
+{
+ struct lwp_info *lp;
+ int resume_all;
+
+ /* A specific PTID means `step only this process id'. */
+ resume_all = (PIDGET (ptid) == -1);
+
+ if (resume_all)
+ iterate_over_lwps (resume_set_callback, NULL);
+ else
+ iterate_over_lwps (resume_clear_callback, NULL);
+
+ /* If PID is -1, it's the current inferior that should be
+ handled specially. */
+ if (PIDGET (ptid) == -1)
+ ptid = inferior_ptid;
+
+ lp = find_lwp_pid (ptid);
+ if (lp)
+ {
+ ptid = pid_to_ptid (GET_LWP (lp->ptid));
+
+ /* Remember if we're stepping. */
+ lp->step = step;
+
+ /* Mark this LWP as resumed. */
+ lp->resumed = 1;
+
+ /* If we have a pending wait status for this thread, there is no
+ point in resuming the process. */
+ if (lp->status)
+ {
+ /* FIXME: What should we do if we are supposed to continue
+ this thread with a signal? */
+ gdb_assert (signo == TARGET_SIGNAL_0);
+ return;
+ }
+
+ /* Mark LWP as not stopped to prevent it from being continued by
+ resume_callback. */
+ lp->stopped = 0;
+ }
+
+ if (resume_all)
+ iterate_over_lwps (resume_callback, NULL);
+
+ child_resume (ptid, step, signo);
+ if (debug_lin_lwp)
+ fprintf_unfiltered (gdb_stdlog,
+ "LLR: %s %s, %s (resume event thread)\n",
+ step ? "PTRACE_SINGLESTEP" : "PTRACE_CONT",
+ target_pid_to_str (ptid),
+ signo ? strsignal (signo) : "0");
+}
+
+
+/* Issue kill to specified lwp. */
+
+static int tkill_failed;
+
+static int
+kill_lwp (int lwpid, int signo)
+{
+ errno = 0;
+
+/* Use tkill, if possible, in case we are using nptl threads. If tkill
+ fails, then we are not using nptl threads and we should be using kill. */
+
+#ifdef HAVE_TKILL_SYSCALL
+ if (!tkill_failed)
+ {
+ int ret = syscall (__NR_tkill, lwpid, signo);
+ if (errno != ENOSYS)
+ return ret;
+ errno = 0;
+ tkill_failed = 1;
+ }
+#endif
+
+ return kill (lwpid, signo);
+}
+
+/* Handle a GNU/Linux extended wait response. Most of the work we
+ just pass off to linux_handle_extended_wait, but if it reports a
+ clone event we need to add the new LWP to our list (and not report
+ the trap to higher layers). This function returns non-zero if
+ the event should be ignored and we should wait again. */
+
+static int
+lin_lwp_handle_extended (struct lwp_info *lp, int status)
+{
+ linux_handle_extended_wait (GET_LWP (lp->ptid), status,
+ &lp->waitstatus);
+
+ /* TARGET_WAITKIND_SPURIOUS is used to indicate clone events. */
+ if (lp->waitstatus.kind == TARGET_WAITKIND_SPURIOUS)
+ {
+ struct lwp_info *new_lp;
+ new_lp = add_lwp (BUILD_LWP (lp->waitstatus.value.related_pid,
+ GET_PID (inferior_ptid)));
+ new_lp->cloned = 1;
+ new_lp->stopped = 1;
+
+ lp->waitstatus.kind = TARGET_WAITKIND_IGNORE;
+
+ if (debug_lin_lwp)
+ fprintf_unfiltered (gdb_stdlog,
+ "LLHE: Got clone event from LWP %ld, resuming\n",
+ GET_LWP (lp->ptid));
+ ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
+
+ return 1;
+ }
+
+ return 0;
+}
+
+/* Wait for LP to stop. Returns the wait status, or 0 if the LWP has
+ exited. */
+
+static int
+wait_lwp (struct lwp_info *lp)
+{
+ pid_t pid;
+ int status;
+ int thread_dead = 0;
+
+ gdb_assert (!lp->stopped);
+ gdb_assert (lp->status == 0);
+
+ pid = waitpid (GET_LWP (lp->ptid), &status, 0);
+ if (pid == -1 && errno == ECHILD)
+ {
+ pid = waitpid (GET_LWP (lp->ptid), &status, __WCLONE);
+ if (pid == -1 && errno == ECHILD)
+ {
+ /* The thread has previously exited. We need to delete it
+ now because, for some vendor 2.4 kernels with NPTL
+ support backported, there won't be an exit event unless
+ it is the main thread. 2.6 kernels will report an exit
+ event for each thread that exits, as expected. */
+ thread_dead = 1;
+ if (debug_lin_lwp)
+ fprintf_unfiltered (gdb_stdlog, "WL: %s vanished.\n",
+ target_pid_to_str (lp->ptid));
+ }
+ }
+
+ if (!thread_dead)
+ {
+ gdb_assert (pid == GET_LWP (lp->ptid));
+
+ if (debug_lin_lwp)
+ {
+ fprintf_unfiltered (gdb_stdlog,
+ "WL: waitpid %s received %s\n",
+ target_pid_to_str (lp->ptid),
+ status_to_str (status));
+ }
+ }
+
+ /* Check if the thread has exited. */
+ if (WIFEXITED (status) || WIFSIGNALED (status))
+ {
+ thread_dead = 1;
+ if (debug_lin_lwp)
+ fprintf_unfiltered (gdb_stdlog, "WL: %s exited.\n",
+ target_pid_to_str (lp->ptid));
+ }
+
+ if (thread_dead)
+ {
+ if (in_thread_list (lp->ptid))
+ {
+ /* Core GDB cannot deal with us deleting the current thread. */
+ if (!ptid_equal (lp->ptid, inferior_ptid))
+ delete_thread (lp->ptid);
+ printf_unfiltered ("[%s exited]\n",
+ target_pid_to_str (lp->ptid));
+ }
+
+ delete_lwp (lp->ptid);
+ return 0;
+ }
+
+ gdb_assert (WIFSTOPPED (status));
+
+ /* Handle GNU/Linux's extended waitstatus for trace events. */
+ if (WIFSTOPPED (status) && WSTOPSIG (status) == SIGTRAP && status >> 16 != 0)
+ {
+ if (debug_lin_lwp)
+ fprintf_unfiltered (gdb_stdlog,
+ "WL: Handling extended status 0x%06x\n",
+ status);
+ if (lin_lwp_handle_extended (lp, status))
+ return wait_lwp (lp);
+ }
+
+ return status;
+}
+
+/* Send a SIGSTOP to LP. */
+
+static int
+stop_callback (struct lwp_info *lp, void *data)
+{
+ if (!lp->stopped && !lp->signalled)
+ {
+ int ret;
+
+ if (debug_lin_lwp)
+ {
+ fprintf_unfiltered (gdb_stdlog,
+ "SC: kill %s **<SIGSTOP>**\n",
+ target_pid_to_str (lp->ptid));
+ }
+ errno = 0;
+ ret = kill_lwp (GET_LWP (lp->ptid), SIGSTOP);
+ if (debug_lin_lwp)
+ {
+ fprintf_unfiltered (gdb_stdlog,
+ "SC: lwp kill %d %s\n",
+ ret,
+ errno ? safe_strerror (errno) : "ERRNO-OK");
+ }
+
+ lp->signalled = 1;
+ gdb_assert (lp->status == 0);
+ }
+
+ return 0;
+}
+
+/* Wait until LP is stopped. If DATA is non-null it is interpreted as
+ a pointer to a set of signals to be flushed immediately. */
+
+static int
+stop_wait_callback (struct lwp_info *lp, void *data)
+{
+ sigset_t *flush_mask = data;
+
+ if (!lp->stopped)
+ {
+ int status;
+
+ status = wait_lwp (lp);
+ if (status == 0)
+ return 0;
+
+ /* Ignore any signals in FLUSH_MASK. */
+ if (flush_mask && sigismember (flush_mask, WSTOPSIG (status)))
+ {
+ if (!lp->signalled)
+ {
+ lp->stopped = 1;
+ return 0;
+ }
+
+ errno = 0;
+ ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
+ if (debug_lin_lwp)
+ fprintf_unfiltered (gdb_stdlog,
+ "PTRACE_CONT %s, 0, 0 (%s)\n",
+ target_pid_to_str (lp->ptid),
+ errno ? safe_strerror (errno) : "OK");
+
+ return stop_wait_callback (lp, flush_mask);
+ }
+
+ if (WSTOPSIG (status) != SIGSTOP)
+ {
+ if (WSTOPSIG (status) == SIGTRAP)
+ {
+ /* If a LWP other than the LWP that we're reporting an
+ event for has hit a GDB breakpoint (as opposed to
+ some random trap signal), then just arrange for it to
+ hit it again later. We don't keep the SIGTRAP status
+ and don't forward the SIGTRAP signal to the LWP. We
+ will handle the current event, eventually we will
+ resume all LWPs, and this one will get its breakpoint
+ trap again.
+
+ If we do not do this, then we run the risk that the
+ user will delete or disable the breakpoint, but the
+ thread will have already tripped on it. */
+
+ /* Now resume this LWP and get the SIGSTOP event. */
+ errno = 0;
+ ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
+ if (debug_lin_lwp)
+ {
+ fprintf_unfiltered (gdb_stdlog,
+ "PTRACE_CONT %s, 0, 0 (%s)\n",
+ target_pid_to_str (lp->ptid),
+ errno ? safe_strerror (errno) : "OK");
+
+ fprintf_unfiltered (gdb_stdlog,
+ "SWC: Candidate SIGTRAP event in %s\n",
+ target_pid_to_str (lp->ptid));
+ }
+ /* Hold the SIGTRAP for handling by lin_lwp_wait. */
+ stop_wait_callback (lp, data);
+ /* If there's another event, throw it back into the queue. */
+ if (lp->status)
+ {
+ if (debug_lin_lwp)
+ {
+ fprintf_unfiltered (gdb_stdlog,
+ "SWC: kill %s, %s\n",
+ target_pid_to_str (lp->ptid),
+ status_to_str ((int) status));
+ }
+ kill_lwp (GET_LWP (lp->ptid), WSTOPSIG (lp->status));
+ }
+ /* Save the sigtrap event. */
+ lp->status = status;
+ return 0;
+ }
+ else
+ {
+ /* The thread was stopped with a signal other than
+ SIGSTOP, and didn't accidentally trip a breakpoint. */
+
+ if (debug_lin_lwp)
+ {
+ fprintf_unfiltered (gdb_stdlog,
+ "SWC: Pending event %s in %s\n",
+ status_to_str ((int) status),
+ target_pid_to_str (lp->ptid));
+ }
+ /* Now resume this LWP and get the SIGSTOP event. */
+ errno = 0;
+ ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
+ if (debug_lin_lwp)
+ fprintf_unfiltered (gdb_stdlog,
+ "SWC: PTRACE_CONT %s, 0, 0 (%s)\n",
+ target_pid_to_str (lp->ptid),
+ errno ? safe_strerror (errno) : "OK");
+
+ /* Hold this event/waitstatus while we check to see if
+ there are any more (we still want to get that SIGSTOP). */
+ stop_wait_callback (lp, data);
+ /* If the lp->status field is still empty, use it to hold
+ this event. If not, then this event must be returned
+ to the event queue of the LWP. */
+ if (lp->status == 0)
+ lp->status = status;
+ else
+ {
+ if (debug_lin_lwp)
+ {
+ fprintf_unfiltered (gdb_stdlog,
+ "SWC: kill %s, %s\n",
+ target_pid_to_str (lp->ptid),
+ status_to_str ((int) status));
+ }
+ kill_lwp (GET_LWP (lp->ptid), WSTOPSIG (status));
+ }
+ return 0;
+ }
+ }
+ else
+ {
+ /* We caught the SIGSTOP that we intended to catch, so
+ there's no SIGSTOP pending. */
+ lp->stopped = 1;
+ lp->signalled = 0;
+ }
+ }
+
+ return 0;
+}
+
+/* Check whether PID has any pending signals in FLUSH_MASK. If so set
+ the appropriate bits in PENDING, and return 1 - otherwise return 0. */
+
+static int
+lin_lwp_has_pending (int pid, sigset_t *pending, sigset_t *flush_mask)
+{
+ sigset_t blocked, ignored;
+ int i;
+
+ linux_proc_pending_signals (pid, pending, &blocked, &ignored);
+
+ if (!flush_mask)
+ return 0;
+
+ for (i = 1; i < NSIG; i++)
+ if (sigismember (pending, i))
+ if (!sigismember (flush_mask, i)
+ || sigismember (&blocked, i)
+ || sigismember (&ignored, i))
+ sigdelset (pending, i);
+
+ if (sigisemptyset (pending))
+ return 0;
+
+ return 1;
+}
+
+/* DATA is interpreted as a mask of signals to flush. If LP has
+ signals pending, and they are all in the flush mask, then arrange
+ to flush them. LP should be stopped, as should all other threads
+ it might share a signal queue with. */
+
+static int
+flush_callback (struct lwp_info *lp, void *data)
+{
+ sigset_t *flush_mask = data;
+ sigset_t pending, intersection, blocked, ignored;
+ int pid, status;
+
+ /* Normally, when an LWP exits, it is removed from the LWP list. The
+ last LWP isn't removed till later, however. So if there is only
+ one LWP on the list, make sure it's alive. */
+ if (lwp_list == lp && lp->next == NULL)
+ if (!lin_lwp_thread_alive (lp->ptid))
+ return 0;
+
+ /* Just because the LWP is stopped doesn't mean that new signals
+ can't arrive from outside, so this function must be careful of
+ race conditions. However, because all threads are stopped, we
+ can assume that the pending mask will not shrink unless we resume
+ the LWP, and that it will then get another signal. We can't
+ control which one, however. */
+
+ if (lp->status)
+ {
+ if (debug_lin_lwp)
+ printf_unfiltered ("FC: LP has pending status %06x\n", lp->status);
+ if (WIFSTOPPED (lp->status) && sigismember (flush_mask, WSTOPSIG (lp->status)))
+ lp->status = 0;
+ }
+
+ while (lin_lwp_has_pending (GET_LWP (lp->ptid), &pending, flush_mask))
+ {
+ int ret;
+
+ errno = 0;
+ ret = ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
+ if (debug_lin_lwp)
+ fprintf_unfiltered (gdb_stderr,
+ "FC: Sent PTRACE_CONT, ret %d %d\n", ret, errno);
+
+ lp->stopped = 0;
+ stop_wait_callback (lp, flush_mask);
+ if (debug_lin_lwp)
+ fprintf_unfiltered (gdb_stderr,
+ "FC: Wait finished; saved status is %d\n",
+ lp->status);
+ }
+
+ return 0;
+}
+
+/* Return non-zero if LP has a wait status pending. */
+
+static int
+status_callback (struct lwp_info *lp, void *data)
+{
+ /* Only report a pending wait status if we pretend that this has
+ indeed been resumed. */
+ return (lp->status != 0 && lp->resumed);
+}
+
+/* Return non-zero if LP isn't stopped. */
+
+static int
+running_callback (struct lwp_info *lp, void *data)
+{
+ return (lp->stopped == 0 || (lp->status != 0 && lp->resumed));
+}
+
+/* Count the LWP's that have had events. */
+
+static int
+count_events_callback (struct lwp_info *lp, void *data)
+{
+ int *count = data;
+
+ gdb_assert (count != NULL);
+
+ /* Count only LWPs that have a SIGTRAP event pending. */
+ if (lp->status != 0
+ && WIFSTOPPED (lp->status) && WSTOPSIG (lp->status) == SIGTRAP)
+ (*count)++;
+
+ return 0;
+}
+
+/* Select the LWP (if any) that is currently being single-stepped. */
+
+static int
+select_singlestep_lwp_callback (struct lwp_info *lp, void *data)
+{
+ if (lp->step && lp->status != 0)
+ return 1;
+ else
+ return 0;
+}
+
+/* Select the Nth LWP that has had a SIGTRAP event. */
+
+static int
+select_event_lwp_callback (struct lwp_info *lp, void *data)
+{
+ int *selector = data;
+
+ gdb_assert (selector != NULL);
+
+ /* Select only LWPs that have a SIGTRAP event pending. */
+ if (lp->status != 0
+ && WIFSTOPPED (lp->status) && WSTOPSIG (lp->status) == SIGTRAP)
+ if ((*selector)-- == 0)
+ return 1;
+
+ return 0;
+}
+
+static int
+cancel_breakpoints_callback (struct lwp_info *lp, void *data)
+{
+ struct lwp_info *event_lp = data;
+
+ /* Leave the LWP that has been elected to receive a SIGTRAP alone. */
+ if (lp == event_lp)
+ return 0;
+
+ /* If a LWP other than the LWP that we're reporting an event for has
+ hit a GDB breakpoint (as opposed to some random trap signal),
+ then just arrange for it to hit it again later. We don't keep
+ the SIGTRAP status and don't forward the SIGTRAP signal to the
+ LWP. We will handle the current event, eventually we will resume
+ all LWPs, and this one will get its breakpoint trap again.
+
+ If we do not do this, then we run the risk that the user will
+ delete or disable the breakpoint, but the LWP will have already
+ tripped on it. */
+
+ if (lp->status != 0
+ && WIFSTOPPED (lp->status) && WSTOPSIG (lp->status) == SIGTRAP
+ && breakpoint_inserted_here_p (read_pc_pid (lp->ptid) -
+ DECR_PC_AFTER_BREAK))
+ {
+ if (debug_lin_lwp)
+ fprintf_unfiltered (gdb_stdlog,
+ "CBC: Push back breakpoint for %s\n",
+ target_pid_to_str (lp->ptid));
+
+ /* Back up the PC if necessary. */
+ if (DECR_PC_AFTER_BREAK)
+ write_pc_pid (read_pc_pid (lp->ptid) - DECR_PC_AFTER_BREAK, lp->ptid);
+
+ /* Throw away the SIGTRAP. */
+ lp->status = 0;
+ }
+
+ return 0;
+}
+
+/* Select one LWP out of those that have events pending. */
+
+static void
+select_event_lwp (struct lwp_info **orig_lp, int *status)
+{
+ int num_events = 0;
+ int random_selector;
+ struct lwp_info *event_lp;
+
+ /* Record the wait status for the origional LWP. */
+ (*orig_lp)->status = *status;
+
+ /* Give preference to any LWP that is being single-stepped. */
+ event_lp = iterate_over_lwps (select_singlestep_lwp_callback, NULL);
+ if (event_lp != NULL)
+ {
+ if (debug_lin_lwp)
+ fprintf_unfiltered (gdb_stdlog,
+ "SEL: Select single-step %s\n",
+ target_pid_to_str (event_lp->ptid));
+ }
+ else
+ {
+ /* No single-stepping LWP. Select one at random, out of those
+ which have had SIGTRAP events. */
+
+ /* First see how many SIGTRAP events we have. */
+ iterate_over_lwps (count_events_callback, &num_events);
+
+ /* Now randomly pick a LWP out of those that have had a SIGTRAP. */
+ random_selector = (int)
+ ((num_events * (double) rand ()) / (RAND_MAX + 1.0));
+
+ if (debug_lin_lwp && num_events > 1)
+ fprintf_unfiltered (gdb_stdlog,
+ "SEL: Found %d SIGTRAP events, selecting #%d\n",
+ num_events, random_selector);
+
+ event_lp = iterate_over_lwps (select_event_lwp_callback,
+ &random_selector);
+ }
+
+ if (event_lp != NULL)
+ {
+ /* Switch the event LWP. */
+ *orig_lp = event_lp;
+ *status = event_lp->status;
+ }
+
+ /* Flush the wait status for the event LWP. */
+ (*orig_lp)->status = 0;
+}
+
+/* Return non-zero if LP has been resumed. */
+
+static int
+resumed_callback (struct lwp_info *lp, void *data)
+{
+ return lp->resumed;
+}
+
+#ifdef CHILD_WAIT
+
+/* We need to override child_wait to support attaching to cloned
+ processes, since a normal wait (as done by the default version)
+ ignores those processes. */
+
+/* Wait for child PTID to do something. Return id of the child,
+ minus_one_ptid in case of error; store status into *OURSTATUS. */
+
+ptid_t
+child_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
+{
+ int save_errno;
+ int status;
+ pid_t pid;
+
+ ourstatus->kind = TARGET_WAITKIND_IGNORE;
+
+ do
+ {
+ set_sigint_trap (); /* Causes SIGINT to be passed on to the
+ attached process. */
+ set_sigio_trap ();
+
+ pid = waitpid (GET_PID (ptid), &status, 0);
+ if (pid == -1 && errno == ECHILD)
+ /* Try again with __WCLONE to check cloned processes. */
+ pid = waitpid (GET_PID (ptid), &status, __WCLONE);
+
+ if (debug_lin_lwp)
+ {
+ fprintf_unfiltered (gdb_stdlog,
+ "CW: waitpid %ld received %s\n",
+ (long) pid, status_to_str (status));
+ }
+
+ save_errno = errno;
+
+ /* Make sure we don't report an event for the exit of the
+ original program, if we've detached from it. */
+ if (pid != -1 && !WIFSTOPPED (status) && pid != GET_PID (inferior_ptid))
+ {
+ pid = -1;
+ save_errno = EINTR;
+ }
+
+ /* Check for stop events reported by a process we didn't already
+ know about - in this case, anything other than inferior_ptid.
+
+ If we're expecting to receive stopped processes after fork,
+ vfork, and clone events, then we'll just add the new one to
+ our list and go back to waiting for the event to be reported
+ - the stopped process might be returned from waitpid before
+ or after the event is. If we want to handle debugging of
+ CLONE_PTRACE processes we need to do more here, i.e. switch
+ to multi-threaded mode. */
+ if (pid != -1 && WIFSTOPPED (status) && WSTOPSIG (status) == SIGSTOP
+ && pid != GET_PID (inferior_ptid))
+ {
+ linux_record_stopped_pid (pid);
+ pid = -1;
+ save_errno = EINTR;
+ }
+
+ /* Handle GNU/Linux's extended waitstatus for trace events. */
+ if (pid != -1 && WIFSTOPPED (status) && WSTOPSIG (status) == SIGTRAP
+ && status >> 16 != 0)
+ {
+ linux_handle_extended_wait (pid, status, ourstatus);
+
+ /* If we see a clone event, detach the child, and don't
+ report the event. It would be nice to offer some way to
+ switch into a non-thread-db based threaded mode at this
+ point. */
+ if (ourstatus->kind == TARGET_WAITKIND_SPURIOUS)
+ {
+ ptrace (PTRACE_DETACH, ourstatus->value.related_pid, 0, 0);
+ ourstatus->kind = TARGET_WAITKIND_IGNORE;
+ ptrace (PTRACE_CONT, pid, 0, 0);
+ pid = -1;
+ save_errno = EINTR;
+ }
+ }
+
+ clear_sigio_trap ();
+ clear_sigint_trap ();
+ }
+ while (pid == -1 && save_errno == EINTR);
+
+ if (pid == -1)
+ {
+ warning ("Child process unexpectedly missing: %s",
+ safe_strerror (errno));
+
+ /* Claim it exited with unknown signal. */
+ ourstatus->kind = TARGET_WAITKIND_SIGNALLED;
+ ourstatus->value.sig = TARGET_SIGNAL_UNKNOWN;
+ return minus_one_ptid;
+ }
+
+ if (ourstatus->kind == TARGET_WAITKIND_IGNORE)
+ store_waitstatus (ourstatus, status);
+
+ return pid_to_ptid (pid);
+}
+
+#endif
+
+/* Stop an active thread, verify it still exists, then resume it. */
+
+static int
+stop_and_resume_callback (struct lwp_info *lp, void *data)
+{
+ struct lwp_info *ptr;
+
+ if (!lp->stopped && !lp->signalled)
+ {
+ stop_callback (lp, NULL);
+ stop_wait_callback (lp, NULL);
+ /* Resume if the lwp still exists. */
+ for (ptr = lwp_list; ptr; ptr = ptr->next)
+ if (lp == ptr)
+ {
+ resume_callback (lp, NULL);
+ resume_set_callback (lp, NULL);
+ }
+ }
+ return 0;
+}
+
+static ptid_t
+lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
+{
+ struct lwp_info *lp = NULL;
+ int options = 0;
+ int status = 0;
+ pid_t pid = PIDGET (ptid);
+ sigset_t flush_mask;
+
+ sigemptyset (&flush_mask);
+
+ /* Make sure SIGCHLD is blocked. */
+ if (!sigismember (&blocked_mask, SIGCHLD))
+ {
+ sigaddset (&blocked_mask, SIGCHLD);
+ sigprocmask (SIG_BLOCK, &blocked_mask, NULL);
+ }
+
+retry:
+
+ /* Make sure there is at least one LWP that has been resumed, at
+ least if there are any LWPs at all. */
+ gdb_assert (num_lwps == 0 || iterate_over_lwps (resumed_callback, NULL));
+
+ /* First check if there is a LWP with a wait status pending. */
+ if (pid == -1)
+ {
+ /* Any LWP that's been resumed will do. */
+ lp = iterate_over_lwps (status_callback, NULL);
+ if (lp)
+ {
+ status = lp->status;
+ lp->status = 0;
+
+ if (debug_lin_lwp && status)
+ fprintf_unfiltered (gdb_stdlog,
+ "LLW: Using pending wait status %s for %s.\n",
+ status_to_str (status),
+ target_pid_to_str (lp->ptid));
+ }
+
+ /* But if we don't fine one, we'll have to wait, and check both
+ cloned and uncloned processes. We start with the cloned
+ processes. */
+ options = __WCLONE | WNOHANG;
+ }
+ else if (is_lwp (ptid))
+ {
+ if (debug_lin_lwp)
+ fprintf_unfiltered (gdb_stdlog,
+ "LLW: Waiting for specific LWP %s.\n",
+ target_pid_to_str (ptid));
+
+ /* We have a specific LWP to check. */
+ lp = find_lwp_pid (ptid);
+ gdb_assert (lp);
+ status = lp->status;
+ lp->status = 0;
+
+ if (debug_lin_lwp && status)
+ fprintf_unfiltered (gdb_stdlog,
+ "LLW: Using pending wait status %s for %s.\n",
+ status_to_str (status),
+ target_pid_to_str (lp->ptid));
+
+ /* If we have to wait, take into account whether PID is a cloned
+ process or not. And we have to convert it to something that
+ the layer beneath us can understand. */
+ options = lp->cloned ? __WCLONE : 0;
+ pid = GET_LWP (ptid);
+ }
+
+ if (status && lp->signalled)
+ {
+ /* A pending SIGSTOP may interfere with the normal stream of
+ events. In a typical case where interference is a problem,
+ we have a SIGSTOP signal pending for LWP A while
+ single-stepping it, encounter an event in LWP B, and take the
+ pending SIGSTOP while trying to stop LWP A. After processing
+ the event in LWP B, LWP A is continued, and we'll never see
+ the SIGTRAP associated with the last time we were
+ single-stepping LWP A. */
+
+ /* Resume the thread. It should halt immediately returning the
+ pending SIGSTOP. */
+ registers_changed ();
+ child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step,
+ TARGET_SIGNAL_0);
+ if (debug_lin_lwp)
+ fprintf_unfiltered (gdb_stdlog,
+ "LLW: %s %s, 0, 0 (expect SIGSTOP)\n",
+ lp->step ? "PTRACE_SINGLESTEP" : "PTRACE_CONT",
+ target_pid_to_str (lp->ptid));
+ lp->stopped = 0;
+ gdb_assert (lp->resumed);
+
+ /* This should catch the pending SIGSTOP. */
+ stop_wait_callback (lp, NULL);
+ }
+
+ set_sigint_trap (); /* Causes SIGINT to be passed on to the
+ attached process. */
+ set_sigio_trap ();
+
+ while (status == 0)
+ {
+ pid_t lwpid;
+
+ lwpid = waitpid (pid, &status, options);
+ if (lwpid > 0)
+ {
+ gdb_assert (pid == -1 || lwpid == pid);
+
+ if (debug_lin_lwp)
+ {
+ fprintf_unfiltered (gdb_stdlog,
+ "LLW: waitpid %ld received %s\n",
+ (long) lwpid, status_to_str (status));
+ }
+
+ lp = find_lwp_pid (pid_to_ptid (lwpid));
+
+ /* Check for stop events reported by a process we didn't
+ already know about - anything not already in our LWP
+ list.
+
+ If we're expecting to receive stopped processes after
+ fork, vfork, and clone events, then we'll just add the
+ new one to our list and go back to waiting for the event
+ to be reported - the stopped process might be returned
+ from waitpid before or after the event is. */
+ if (WIFSTOPPED (status) && !lp)
+ {
+ linux_record_stopped_pid (lwpid);
+ status = 0;
+ continue;
+ }
+
+ /* Make sure we don't report an event for the exit of an LWP not in
+ our list, i.e. not part of the current process. This can happen
+ if we detach from a program we original forked and then it
+ exits. */
+ if (!WIFSTOPPED (status) && !lp)
+ {
+ status = 0;
+ continue;
+ }
+
+ /* NOTE drow/2003-06-17: This code seems to be meant for debugging
+ CLONE_PTRACE processes which do not use the thread library -
+ otherwise we wouldn't find the new LWP this way. That doesn't
+ currently work, and the following code is currently unreachable
+ due to the two blocks above. If it's fixed some day, this code
+ should be broken out into a function so that we can also pick up
+ LWPs from the new interface. */
+ if (!lp)
+ {
+ lp = add_lwp (BUILD_LWP (lwpid, GET_PID (inferior_ptid)));
+ if (options & __WCLONE)
+ lp->cloned = 1;
+
+ if (threaded)
+ {
+ gdb_assert (WIFSTOPPED (status)
+ && WSTOPSIG (status) == SIGSTOP);
+ lp->signalled = 1;
+
+ if (!in_thread_list (inferior_ptid))
+ {
+ inferior_ptid = BUILD_LWP (GET_PID (inferior_ptid),
+ GET_PID (inferior_ptid));
+ add_thread (inferior_ptid);
+ }
+
+ add_thread (lp->ptid);
+ printf_unfiltered ("[New %s]\n",
+ target_pid_to_str (lp->ptid));
+ }
+ }
+
+ /* Handle GNU/Linux's extended waitstatus for trace events. */
+ if (WIFSTOPPED (status) && WSTOPSIG (status) == SIGTRAP && status >> 16 != 0)
+ {
+ if (debug_lin_lwp)
+ fprintf_unfiltered (gdb_stdlog,
+ "LLW: Handling extended status 0x%06x\n",
+ status);
+ if (lin_lwp_handle_extended (lp, status))
+ {
+ status = 0;
+ continue;
+ }
+ }
+
+ /* Check if the thread has exited. */
+ if ((WIFEXITED (status) || WIFSIGNALED (status)) && num_lwps > 1)
+ {
+ if (in_thread_list (lp->ptid))
+ {
+ /* Core GDB cannot deal with us deleting the current
+ thread. */
+ if (!ptid_equal (lp->ptid, inferior_ptid))
+ delete_thread (lp->ptid);
+ printf_unfiltered ("[%s exited]\n",
+ target_pid_to_str (lp->ptid));
+ }
+
+ /* If this is the main thread, we must stop all threads and
+ verify if they are still alive. This is because in the nptl
+ thread model, there is no signal issued for exiting LWPs
+ other than the main thread. We only get the main thread
+ exit signal once all child threads have already exited.
+ If we stop all the threads and use the stop_wait_callback
+ to check if they have exited we can determine whether this
+ signal should be ignored or whether it means the end of the
+ debugged application, regardless of which threading model
+ is being used. */
+ if (GET_PID (lp->ptid) == GET_LWP (lp->ptid))
+ {
+ lp->stopped = 1;
+ iterate_over_lwps (stop_and_resume_callback, NULL);
+ }
+
+ if (debug_lin_lwp)
+ fprintf_unfiltered (gdb_stdlog,
+ "LLW: %s exited.\n",
+ target_pid_to_str (lp->ptid));
+
+ delete_lwp (lp->ptid);
+
+ /* If there is at least one more LWP, then the exit signal
+ was not the end of the debugged application and should be
+ ignored. */
+ if (num_lwps > 0)
+ {
+ /* Make sure there is at least one thread running. */
+ gdb_assert (iterate_over_lwps (running_callback, NULL));
+
+ /* Discard the event. */
+ status = 0;
+ continue;
+ }
+ }
+
+ /* Check if the current LWP has previously exited. In the nptl
+ thread model, LWPs other than the main thread do not issue
+ signals when they exit so we must check whenever the thread
+ has stopped. A similar check is made in stop_wait_callback(). */
+ if (num_lwps > 1 && !lin_lwp_thread_alive (lp->ptid))
+ {
+ if (in_thread_list (lp->ptid))
+ {
+ /* Core GDB cannot deal with us deleting the current
+ thread. */
+ if (!ptid_equal (lp->ptid, inferior_ptid))
+ delete_thread (lp->ptid);
+ printf_unfiltered ("[%s exited]\n",
+ target_pid_to_str (lp->ptid));
+ }
+ if (debug_lin_lwp)
+ fprintf_unfiltered (gdb_stdlog,
+ "LLW: %s exited.\n",
+ target_pid_to_str (lp->ptid));
+
+ delete_lwp (lp->ptid);
+
+ /* Make sure there is at least one thread running. */
+ gdb_assert (iterate_over_lwps (running_callback, NULL));
+
+ /* Discard the event. */
+ status = 0;
+ continue;
+ }
+
+ /* Make sure we don't report a SIGSTOP that we sent
+ ourselves in an attempt to stop an LWP. */
+ if (lp->signalled
+ && WIFSTOPPED (status) && WSTOPSIG (status) == SIGSTOP)
+ {
+ if (debug_lin_lwp)
+ fprintf_unfiltered (gdb_stdlog,
+ "LLW: Delayed SIGSTOP caught for %s.\n",
+ target_pid_to_str (lp->ptid));
+
+ /* This is a delayed SIGSTOP. */
+ lp->signalled = 0;
+
+ registers_changed ();
+ child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step,
+ TARGET_SIGNAL_0);
+ if (debug_lin_lwp)
+ fprintf_unfiltered (gdb_stdlog,
+ "LLW: %s %s, 0, 0 (discard SIGSTOP)\n",
+ lp->step ?
+ "PTRACE_SINGLESTEP" : "PTRACE_CONT",
+ target_pid_to_str (lp->ptid));
+
+ lp->stopped = 0;
+ gdb_assert (lp->resumed);
+
+ /* Discard the event. */
+ status = 0;
+ continue;
+ }
+
+ break;
+ }
+
+ if (pid == -1)
+ {
+ /* Alternate between checking cloned and uncloned processes. */
+ options ^= __WCLONE;
+
+ /* And suspend every time we have checked both. */
+ if (options & __WCLONE)
+ sigsuspend (&suspend_mask);
+ }
+
+ /* We shouldn't end up here unless we want to try again. */
+ gdb_assert (status == 0);
+ }
+
+ clear_sigio_trap ();
+ clear_sigint_trap ();
+
+ gdb_assert (lp);
+
+ /* Don't report signals that GDB isn't interested in, such as
+ signals that are neither printed nor stopped upon. Stopping all
+ threads can be a bit time-consuming so if we want decent
+ performance with heavily multi-threaded programs, especially when
+ they're using a high frequency timer, we'd better avoid it if we
+ can. */
+
+ if (WIFSTOPPED (status))
+ {
+ int signo = target_signal_from_host (WSTOPSIG (status));
+
+ if (signal_stop_state (signo) == 0
+ && signal_print_state (signo) == 0
+ && signal_pass_state (signo) == 1)
+ {
+ /* FIMXE: kettenis/2001-06-06: Should we resume all threads
+ here? It is not clear we should. GDB may not expect
+ other threads to run. On the other hand, not resuming
+ newly attached threads may cause an unwanted delay in
+ getting them running. */
+ registers_changed ();
+ child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step, signo);
+ if (debug_lin_lwp)
+ fprintf_unfiltered (gdb_stdlog,
+ "LLW: %s %s, %s (preempt 'handle')\n",
+ lp->step ?
+ "PTRACE_SINGLESTEP" : "PTRACE_CONT",
+ target_pid_to_str (lp->ptid),
+ signo ? strsignal (signo) : "0");
+ lp->stopped = 0;
+ status = 0;
+ goto retry;
+ }
+
+ if (signo == TARGET_SIGNAL_INT && signal_pass_state (signo) == 0)
+ {
+ /* If ^C/BREAK is typed at the tty/console, SIGINT gets
+ forwarded to the entire process group, that is, all LWP's
+ will receive it. Since we only want to report it once,
+ we try to flush it from all LWPs except this one. */
+ sigaddset (&flush_mask, SIGINT);
+ }
+ }
+
+ /* This LWP is stopped now. */
+ lp->stopped = 1;
+
+ if (debug_lin_lwp)
+ fprintf_unfiltered (gdb_stdlog, "LLW: Candidate event %s in %s.\n",
+ status_to_str (status), target_pid_to_str (lp->ptid));
+
+ /* Now stop all other LWP's ... */
+ iterate_over_lwps (stop_callback, NULL);
+
+ /* ... and wait until all of them have reported back that they're no
+ longer running. */
+ iterate_over_lwps (stop_wait_callback, &flush_mask);
+ iterate_over_lwps (flush_callback, &flush_mask);
+
+ /* If we're not waiting for a specific LWP, choose an event LWP from
+ among those that have had events. Giving equal priority to all
+ LWPs that have had events helps prevent starvation. */
+ if (pid == -1)
+ select_event_lwp (&lp, &status);
+
+ /* Now that we've selected our final event LWP, cancel any
+ breakpoints in other LWPs that have hit a GDB breakpoint. See
+ the comment in cancel_breakpoints_callback to find out why. */
+ iterate_over_lwps (cancel_breakpoints_callback, lp);
+
+ /* If we're not running in "threaded" mode, we'll report the bare
+ process id. */
+
+ if (WIFSTOPPED (status) && WSTOPSIG (status) == SIGTRAP)
+ {
+ trap_ptid = (threaded ? lp->ptid : pid_to_ptid (GET_LWP (lp->ptid)));
+ if (debug_lin_lwp)
+ fprintf_unfiltered (gdb_stdlog,
+ "LLW: trap_ptid is %s.\n",
+ target_pid_to_str (trap_ptid));
+ }
+ else
+ trap_ptid = null_ptid;
+
+ if (lp->waitstatus.kind != TARGET_WAITKIND_IGNORE)
+ {
+ *ourstatus = lp->waitstatus;
+ lp->waitstatus.kind = TARGET_WAITKIND_IGNORE;
+ }
+ else
+ store_waitstatus (ourstatus, status);
+
+ return (threaded ? lp->ptid : pid_to_ptid (GET_LWP (lp->ptid)));
+}
+
+static int
+kill_callback (struct lwp_info *lp, void *data)
+{
+ errno = 0;
+ ptrace (PTRACE_KILL, GET_LWP (lp->ptid), 0, 0);
+ if (debug_lin_lwp)
+ fprintf_unfiltered (gdb_stdlog,
+ "KC: PTRACE_KILL %s, 0, 0 (%s)\n",
+ target_pid_to_str (lp->ptid),
+ errno ? safe_strerror (errno) : "OK");
+
+ return 0;
+}
+
+static int
+kill_wait_callback (struct lwp_info *lp, void *data)
+{
+ pid_t pid;
+
+ /* We must make sure that there are no pending events (delayed
+ SIGSTOPs, pending SIGTRAPs, etc.) to make sure the current
+ program doesn't interfere with any following debugging session. */
+
+ /* For cloned processes we must check both with __WCLONE and
+ without, since the exit status of a cloned process isn't reported
+ with __WCLONE. */
+ if (lp->cloned)
+ {
+ do
+ {
+ pid = waitpid (GET_LWP (lp->ptid), NULL, __WCLONE);
+ if (pid != (pid_t) -1 && debug_lin_lwp)
+ {
+ fprintf_unfiltered (gdb_stdlog,
+ "KWC: wait %s received unknown.\n",
+ target_pid_to_str (lp->ptid));
+ }
+ }
+ while (pid == GET_LWP (lp->ptid));
+
+ gdb_assert (pid == -1 && errno == ECHILD);
+ }
+
+ do
+ {
+ pid = waitpid (GET_LWP (lp->ptid), NULL, 0);
+ if (pid != (pid_t) -1 && debug_lin_lwp)
+ {
+ fprintf_unfiltered (gdb_stdlog,
+ "KWC: wait %s received unk.\n",
+ target_pid_to_str (lp->ptid));
+ }
+ }
+ while (pid == GET_LWP (lp->ptid));
+
+ gdb_assert (pid == -1 && errno == ECHILD);
+ return 0;
+}
+
+static void
+lin_lwp_kill (void)
+{
+ /* Kill all LWP's ... */
+ iterate_over_lwps (kill_callback, NULL);
+
+ /* ... and wait until we've flushed all events. */
+ iterate_over_lwps (kill_wait_callback, NULL);
+
+ target_mourn_inferior ();
+}
+
+static void
+lin_lwp_create_inferior (char *exec_file, char *allargs, char **env,
+ int from_tty)
+{
+ child_ops.to_create_inferior (exec_file, allargs, env, from_tty);
+}
+
+static void
+lin_lwp_mourn_inferior (void)
+{
+ trap_ptid = null_ptid;
+
+ /* Destroy LWP info; it's no longer valid. */
+ init_lwp_list ();
+
+ /* Restore the original signal mask. */
+ sigprocmask (SIG_SETMASK, &normal_mask, NULL);
+ sigemptyset (&blocked_mask);
+
+ child_ops.to_mourn_inferior ();
+}
+
+static int
+lin_lwp_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+ struct mem_attrib *attrib, struct target_ops *target)
+{
+ struct cleanup *old_chain = save_inferior_ptid ();
+ int xfer;
+
+ if (is_lwp (inferior_ptid))
+ inferior_ptid = pid_to_ptid (GET_LWP (inferior_ptid));
+
+ xfer = linux_proc_xfer_memory (memaddr, myaddr, len, write, attrib, target);
+ if (xfer == 0)
+ xfer = child_xfer_memory (memaddr, myaddr, len, write, attrib, target);
+
+ do_cleanups (old_chain);
+ return xfer;
+}
+
+static int
+lin_lwp_thread_alive (ptid_t ptid)
+{
+ gdb_assert (is_lwp (ptid));
+
+ errno = 0;
+ ptrace (PTRACE_PEEKUSER, GET_LWP (ptid), 0, 0);
+ if (debug_lin_lwp)
+ fprintf_unfiltered (gdb_stdlog,
+ "LLTA: PTRACE_PEEKUSER %s, 0, 0 (%s)\n",
+ target_pid_to_str (ptid),
+ errno ? safe_strerror (errno) : "OK");
+ if (errno)
+ return 0;
+
+ return 1;
+}
+
+static char *
+lin_lwp_pid_to_str (ptid_t ptid)
+{
+ static char buf[64];
+
+ if (is_lwp (ptid))
+ {
+ snprintf (buf, sizeof (buf), "LWP %ld", GET_LWP (ptid));
+ return buf;
+ }
+
+ return normal_pid_to_str (ptid);
+}
+
+static void
+init_lin_lwp_ops (void)
+{
+#if 0
+ lin_lwp_ops.to_open = lin_lwp_open;
+#endif
+ lin_lwp_ops.to_shortname = "lwp-layer";
+ lin_lwp_ops.to_longname = "lwp-layer";
+ lin_lwp_ops.to_doc = "Low level threads support (LWP layer)";
+ lin_lwp_ops.to_attach = lin_lwp_attach;
+ lin_lwp_ops.to_detach = lin_lwp_detach;
+ lin_lwp_ops.to_resume = lin_lwp_resume;
+ lin_lwp_ops.to_wait = lin_lwp_wait;
+ /* fetch_inferior_registers and store_inferior_registers will
+ honor the LWP id, so we can use them directly. */
+ lin_lwp_ops.to_fetch_registers = fetch_inferior_registers;
+ lin_lwp_ops.to_store_registers = store_inferior_registers;
+ lin_lwp_ops.to_xfer_memory = lin_lwp_xfer_memory;
+ lin_lwp_ops.to_kill = lin_lwp_kill;
+ lin_lwp_ops.to_create_inferior = lin_lwp_create_inferior;
+ lin_lwp_ops.to_mourn_inferior = lin_lwp_mourn_inferior;
+ lin_lwp_ops.to_thread_alive = lin_lwp_thread_alive;
+ lin_lwp_ops.to_pid_to_str = lin_lwp_pid_to_str;
+ lin_lwp_ops.to_post_startup_inferior = child_post_startup_inferior;
+ lin_lwp_ops.to_post_attach = child_post_attach;
+ lin_lwp_ops.to_insert_fork_catchpoint = child_insert_fork_catchpoint;
+ lin_lwp_ops.to_insert_vfork_catchpoint = child_insert_vfork_catchpoint;
+ lin_lwp_ops.to_insert_exec_catchpoint = child_insert_exec_catchpoint;
+
+ lin_lwp_ops.to_stratum = thread_stratum;
+ lin_lwp_ops.to_has_thread_control = tc_schedlock;
+ lin_lwp_ops.to_magic = OPS_MAGIC;
+}
+
+static void
+sigchld_handler (int signo)
+{
+ /* Do nothing. The only reason for this handler is that it allows
+ us to use sigsuspend in lin_lwp_wait above to wait for the
+ arrival of a SIGCHLD. */
+}
+
+void
+_initialize_lin_lwp (void)
+{
+ struct sigaction action;
+
+ extern void thread_db_init (struct target_ops *);
+
+ init_lin_lwp_ops ();
+ add_target (&lin_lwp_ops);
+ thread_db_init (&lin_lwp_ops);
+
+ /* Save the original signal mask. */
+ sigprocmask (SIG_SETMASK, NULL, &normal_mask);
+
+ action.sa_handler = sigchld_handler;
+ sigemptyset (&action.sa_mask);
+ action.sa_flags = 0;
+ sigaction (SIGCHLD, &action, NULL);
+
+ /* Make sure we don't block SIGCHLD during a sigsuspend. */
+ sigprocmask (SIG_SETMASK, NULL, &suspend_mask);
+ sigdelset (&suspend_mask, SIGCHLD);
+
+ sigemptyset (&blocked_mask);
+
+ deprecated_add_show_from_set
+ (add_set_cmd ("lin-lwp", no_class, var_zinteger,
+ (char *) &debug_lin_lwp,
+ "Set debugging of GNU/Linux lwp module.\n\
+Enables printf debugging output.\n", &setdebuglist), &showdebuglist);
+}
+
+
+/* FIXME: kettenis/2000-08-26: The stuff on this page is specific to
+ the GNU/Linux Threads library and therefore doesn't really belong
+ here. */
+
+/* Read variable NAME in the target and return its value if found.
+ Otherwise return zero. It is assumed that the type of the variable
+ is `int'. */
+
+static int
+get_signo (const char *name)
+{
+ struct minimal_symbol *ms;
+ int signo;
+
+ ms = lookup_minimal_symbol (name, NULL, NULL);
+ if (ms == NULL)
+ return 0;
+
+ if (target_read_memory (SYMBOL_VALUE_ADDRESS (ms), (char *) &signo,
+ sizeof (signo)) != 0)
+ return 0;
+
+ return signo;
+}
+
+/* Return the set of signals used by the threads library in *SET. */
+
+void
+lin_thread_get_thread_signals (sigset_t *set)
+{
+ struct sigaction action;
+ int restart, cancel;
+
+ sigemptyset (set);
+
+ restart = get_signo ("__pthread_sig_restart");
+ if (restart == 0)
+ return;
+
+ cancel = get_signo ("__pthread_sig_cancel");
+ if (cancel == 0)
+ return;
+
+ sigaddset (set, restart);
+ sigaddset (set, cancel);
+
+ /* The GNU/Linux Threads library makes terminating threads send a
+ special "cancel" signal instead of SIGCHLD. Make sure we catch
+ those (to prevent them from terminating GDB itself, which is
+ likely to be their default action) and treat them the same way as
+ SIGCHLD. */
+
+ action.sa_handler = sigchld_handler;
+ sigemptyset (&action.sa_mask);
+ action.sa_flags = 0;
+ sigaction (cancel, &action, NULL);
+
+ /* We block the "cancel" signal throughout this code ... */
+ sigaddset (&blocked_mask, cancel);
+ sigprocmask (SIG_BLOCK, &blocked_mask, NULL);
+
+ /* ... except during a sigsuspend. */
+ sigdelset (&suspend_mask, cancel);
+}
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 9c40f77..15b6704 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -1,6 +1,5 @@
/* GNU/Linux native-dependent code common to multiple platforms.
-
- Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GDB.
@@ -22,31 +21,11 @@
#include "defs.h"
#include "inferior.h"
#include "target.h"
-#include "gdb_string.h"
+
#include "gdb_wait.h"
-#include "gdb_assert.h"
-#ifdef HAVE_TKILL_SYSCALL
-#include <unistd.h>
-#include <sys/syscall.h>
-#endif
#include <sys/ptrace.h>
+
#include "linux-nat.h"
-#include "gdbthread.h"
-#include "gdbcmd.h"
-#include "regcache.h"
-#include <sys/param.h> /* for MAXPATHLEN */
-#include <sys/procfs.h> /* for elf_gregset etc. */
-#include "elf-bfd.h" /* for elfcore_write_* */
-#include "gregset.h" /* for gregset */
-#include "gdbcore.h" /* for get_exec_file */
-#include <ctype.h> /* for isdigit */
-#include "gdbthread.h" /* for struct thread_info etc. */
-#include "gdb_stat.h" /* for struct stat */
-#include <fcntl.h> /* for O_RDONLY */
-
-#ifndef O_LARGEFILE
-#define O_LARGEFILE 0
-#endif
/* If the system headers did not provide the constants, hard-code the normal
values. */
@@ -81,7 +60,7 @@
#define __WALL 0x40000000 /* Wait for any child. */
#endif
-static int debug_linux_nat;
+extern struct target_ops child_ops;
static int linux_parent_pid;
@@ -398,7 +377,7 @@ child_follow_fork (int follow_child)
target_detach (NULL, 0);
inferior_ptid = pid_to_ptid (child_pid);
- push_target (&deprecated_child_ops);
+ push_target (&child_ops);
/* Reset breakpoints in the child as appropriate. */
follow_inferior_reset_breakpoints ();
@@ -522,12 +501,12 @@ kill_inferior (void)
|| last.kind == TARGET_WAITKIND_VFORKED)
{
ptrace (PT_KILL, last.value.related_pid, 0, 0);
- wait (&status);
+ ptrace_wait (null_ptid, &status);
}
/* Kill the current process. */
ptrace (PT_KILL, pid, 0, 0);
- ret = wait (&status);
+ ret = ptrace_wait (null_ptid, &status);
/* We might get a SIGCHLD instead of an exit status. This is
aggravated by the first kill above - a child has just died. */
@@ -535,2582 +514,8 @@ kill_inferior (void)
while (ret == pid && WIFSTOPPED (status))
{
ptrace (PT_KILL, pid, 0, 0);
- ret = wait (&status);
- }
-
- target_mourn_inferior ();
-}
-
-/* On GNU/Linux there are no real LWP's. The closest thing to LWP's
- are processes sharing the same VM space. A multi-threaded process
- is basically a group of such processes. However, such a grouping
- is almost entirely a user-space issue; the kernel doesn't enforce
- such a grouping at all (this might change in the future). In
- general, we'll rely on the threads library (i.e. the GNU/Linux
- Threads library) to provide such a grouping.
-
- It is perfectly well possible to write a multi-threaded application
- without the assistance of a threads library, by using the clone
- system call directly. This module should be able to give some
- rudimentary support for debugging such applications if developers
- specify the CLONE_PTRACE flag in the clone system call, and are
- using the Linux kernel 2.4 or above.
-
- Note that there are some peculiarities in GNU/Linux that affect
- this code:
-
- - In general one should specify the __WCLONE flag to waitpid in
- order to make it report events for any of the cloned processes
- (and leave it out for the initial process). However, if a cloned
- process has exited the exit status is only reported if the
- __WCLONE flag is absent. Linux kernel 2.4 has a __WALL flag, but
- we cannot use it since GDB must work on older systems too.
-
- - When a traced, cloned process exits and is waited for by the
- debugger, the kernel reassigns it to the original parent and
- keeps it around as a "zombie". Somehow, the GNU/Linux Threads
- library doesn't notice this, which leads to the "zombie problem":
- When debugged a multi-threaded process that spawns a lot of
- threads will run out of processes, even if the threads exit,
- because the "zombies" stay around. */
-
-/* List of known LWPs. */
-static struct lwp_info *lwp_list;
-
-/* Number of LWPs in the list. */
-static int num_lwps;
-
-/* Non-zero if we're running in "threaded" mode. */
-static int threaded;
-
-
-#define GET_LWP(ptid) ptid_get_lwp (ptid)
-#define GET_PID(ptid) ptid_get_pid (ptid)
-#define is_lwp(ptid) (GET_LWP (ptid) != 0)
-#define BUILD_LWP(lwp, pid) ptid_build (pid, lwp, 0)
-
-/* If the last reported event was a SIGTRAP, this variable is set to
- the process id of the LWP/thread that got it. */
-ptid_t trap_ptid;
-
-
-/* This module's target-specific operations. */
-static struct target_ops linux_nat_ops;
-
-/* Since we cannot wait (in linux_nat_wait) for the initial process and
- any cloned processes with a single call to waitpid, we have to use
- the WNOHANG flag and call waitpid in a loop. To optimize
- things a bit we use `sigsuspend' to wake us up when a process has
- something to report (it will send us a SIGCHLD if it has). To make
- this work we have to juggle with the signal mask. We save the
- original signal mask such that we can restore it before creating a
- new process in order to avoid blocking certain signals in the
- inferior. We then block SIGCHLD during the waitpid/sigsuspend
- loop. */
-
-/* Original signal mask. */
-static sigset_t normal_mask;
-
-/* Signal mask for use with sigsuspend in linux_nat_wait, initialized in
- _initialize_linux_nat. */
-static sigset_t suspend_mask;
-
-/* Signals to block to make that sigsuspend work. */
-static sigset_t blocked_mask;
-
-
-/* Prototypes for local functions. */
-static int stop_wait_callback (struct lwp_info *lp, void *data);
-static int linux_nat_thread_alive (ptid_t ptid);
-
-/* Convert wait status STATUS to a string. Used for printing debug
- messages only. */
-
-static char *
-status_to_str (int status)
-{
- static char buf[64];
-
- if (WIFSTOPPED (status))
- snprintf (buf, sizeof (buf), "%s (stopped)",
- strsignal (WSTOPSIG (status)));
- else if (WIFSIGNALED (status))
- snprintf (buf, sizeof (buf), "%s (terminated)",
- strsignal (WSTOPSIG (status)));
- else
- snprintf (buf, sizeof (buf), "%d (exited)", WEXITSTATUS (status));
-
- return buf;
-}
-
-/* Initialize the list of LWPs. Note that this module, contrary to
- what GDB's generic threads layer does for its thread list,
- re-initializes the LWP lists whenever we mourn or detach (which
- doesn't involve mourning) the inferior. */
-
-static void
-init_lwp_list (void)
-{
- struct lwp_info *lp, *lpnext;
-
- for (lp = lwp_list; lp; lp = lpnext)
- {
- lpnext = lp->next;
- xfree (lp);
- }
-
- lwp_list = NULL;
- num_lwps = 0;
- threaded = 0;
-}
-
-/* Add the LWP specified by PID to the list. If this causes the
- number of LWPs to become larger than one, go into "threaded" mode.
- Return a pointer to the structure describing the new LWP. */
-
-static struct lwp_info *
-add_lwp (ptid_t ptid)
-{
- struct lwp_info *lp;
-
- gdb_assert (is_lwp (ptid));
-
- lp = (struct lwp_info *) xmalloc (sizeof (struct lwp_info));
-
- memset (lp, 0, sizeof (struct lwp_info));
-
- lp->waitstatus.kind = TARGET_WAITKIND_IGNORE;
-
- lp->ptid = ptid;
-
- lp->next = lwp_list;
- lwp_list = lp;
- if (++num_lwps > 1)
- threaded = 1;
-
- return lp;
-}
-
-/* Remove the LWP specified by PID from the list. */
-
-static void
-delete_lwp (ptid_t ptid)
-{
- struct lwp_info *lp, *lpprev;
-
- lpprev = NULL;
-
- for (lp = lwp_list; lp; lpprev = lp, lp = lp->next)
- if (ptid_equal (lp->ptid, ptid))
- break;
-
- if (!lp)
- return;
-
- /* We don't go back to "non-threaded" mode if the number of threads
- becomes less than two. */
- num_lwps--;
-
- if (lpprev)
- lpprev->next = lp->next;
- else
- lwp_list = lp->next;
-
- xfree (lp);
-}
-
-/* Return a pointer to the structure describing the LWP corresponding
- to PID. If no corresponding LWP could be found, return NULL. */
-
-static struct lwp_info *
-find_lwp_pid (ptid_t ptid)
-{
- struct lwp_info *lp;
- int lwp;
-
- if (is_lwp (ptid))
- lwp = GET_LWP (ptid);
- else
- lwp = GET_PID (ptid);
-
- for (lp = lwp_list; lp; lp = lp->next)
- if (lwp == GET_LWP (lp->ptid))
- return lp;
-
- return NULL;
-}
-
-/* Call CALLBACK with its second argument set to DATA for every LWP in
- the list. If CALLBACK returns 1 for a particular LWP, return a
- pointer to the structure describing that LWP immediately.
- Otherwise return NULL. */
-
-struct lwp_info *
-iterate_over_lwps (int (*callback) (struct lwp_info *, void *), void *data)
-{
- struct lwp_info *lp, *lpnext;
-
- for (lp = lwp_list; lp; lp = lpnext)
- {
- lpnext = lp->next;
- if ((*callback) (lp, data))
- return lp;
- }
-
- return NULL;
-}
-
-/* Attach to the LWP specified by PID. If VERBOSE is non-zero, print
- a message telling the user that a new LWP has been added to the
- process. */
-
-void
-lin_lwp_attach_lwp (ptid_t ptid, int verbose)
-{
- struct lwp_info *lp, *found_lp;
-
- gdb_assert (is_lwp (ptid));
-
- /* Make sure SIGCHLD is blocked. We don't want SIGCHLD events
- to interrupt either the ptrace() or waitpid() calls below. */
- if (!sigismember (&blocked_mask, SIGCHLD))
- {
- sigaddset (&blocked_mask, SIGCHLD);
- sigprocmask (SIG_BLOCK, &blocked_mask, NULL);
- }
-
- if (verbose)
- printf_filtered ("[New %s]\n", target_pid_to_str (ptid));
-
- found_lp = lp = find_lwp_pid (ptid);
- if (lp == NULL)
- lp = add_lwp (ptid);
-
- /* We assume that we're already attached to any LWP that has an id
- equal to the overall process id, and to any LWP that is already
- in our list of LWPs. If we're not seeing exit events from threads
- and we've had PID wraparound since we last tried to stop all threads,
- this assumption might be wrong; fortunately, this is very unlikely
- to happen. */
- if (GET_LWP (ptid) != GET_PID (ptid) && found_lp == NULL)
- {
- pid_t pid;
- int status;
-
- if (ptrace (PTRACE_ATTACH, GET_LWP (ptid), 0, 0) < 0)
- error ("Can't attach %s: %s", target_pid_to_str (ptid),
- safe_strerror (errno));
-
- if (debug_linux_nat)
- fprintf_unfiltered (gdb_stdlog,
- "LLAL: PTRACE_ATTACH %s, 0, 0 (OK)\n",
- target_pid_to_str (ptid));
-
- pid = waitpid (GET_LWP (ptid), &status, 0);
- if (pid == -1 && errno == ECHILD)
- {
- /* Try again with __WCLONE to check cloned processes. */
- pid = waitpid (GET_LWP (ptid), &status, __WCLONE);
- lp->cloned = 1;
- }
-
- gdb_assert (pid == GET_LWP (ptid)
- && WIFSTOPPED (status) && WSTOPSIG (status));
-
- child_post_attach (pid);
-
- lp->stopped = 1;
-
- if (debug_linux_nat)
- {
- fprintf_unfiltered (gdb_stdlog,
- "LLAL: waitpid %s received %s\n",
- target_pid_to_str (ptid),
- status_to_str (status));
- }
- }
- else
- {
- /* We assume that the LWP representing the original process is
- already stopped. Mark it as stopped in the data structure
- that the linux ptrace layer uses to keep track of threads.
- Note that this won't have already been done since the main
- thread will have, we assume, been stopped by an attach from a
- different layer. */
- lp->stopped = 1;
- }
-}
-
-static void
-linux_nat_attach (char *args, int from_tty)
-{
- struct lwp_info *lp;
- pid_t pid;
- int status;
-
- /* FIXME: We should probably accept a list of process id's, and
- attach all of them. */
- deprecated_child_ops.to_attach (args, from_tty);
-
- /* Add the initial process as the first LWP to the list. */
- lp = add_lwp (BUILD_LWP (GET_PID (inferior_ptid), GET_PID (inferior_ptid)));
-
- /* Make sure the initial process is stopped. The user-level threads
- layer might want to poke around in the inferior, and that won't
- work if things haven't stabilized yet. */
- pid = waitpid (GET_PID (inferior_ptid), &status, 0);
- if (pid == -1 && errno == ECHILD)
- {
- warning ("%s is a cloned process", target_pid_to_str (inferior_ptid));
-
- /* Try again with __WCLONE to check cloned processes. */
- pid = waitpid (GET_PID (inferior_ptid), &status, __WCLONE);
- lp->cloned = 1;
- }
-
- gdb_assert (pid == GET_PID (inferior_ptid)
- && WIFSTOPPED (status) && WSTOPSIG (status) == SIGSTOP);
-
- lp->stopped = 1;
-
- /* Fake the SIGSTOP that core GDB expects. */
- lp->status = W_STOPCODE (SIGSTOP);
- lp->resumed = 1;
- if (debug_linux_nat)
- {
- fprintf_unfiltered (gdb_stdlog,
- "LLA: waitpid %ld, faking SIGSTOP\n", (long) pid);
- }
-}
-
-static int
-detach_callback (struct lwp_info *lp, void *data)
-{
- gdb_assert (lp->status == 0 || WIFSTOPPED (lp->status));
-
- if (debug_linux_nat && lp->status)
- fprintf_unfiltered (gdb_stdlog, "DC: Pending %s for %s on detach.\n",
- strsignal (WSTOPSIG (lp->status)),
- target_pid_to_str (lp->ptid));
-
- while (lp->signalled && lp->stopped)
- {
- errno = 0;
- if (ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0,
- WSTOPSIG (lp->status)) < 0)
- error ("Can't continue %s: %s", target_pid_to_str (lp->ptid),
- safe_strerror (errno));
-
- if (debug_linux_nat)
- fprintf_unfiltered (gdb_stdlog,
- "DC: PTRACE_CONTINUE (%s, 0, %s) (OK)\n",
- target_pid_to_str (lp->ptid),
- status_to_str (lp->status));
-
- lp->stopped = 0;
- lp->signalled = 0;
- lp->status = 0;
- /* FIXME drow/2003-08-26: There was a call to stop_wait_callback
- here. But since lp->signalled was cleared above,
- stop_wait_callback didn't do anything; the process was left
- running. Shouldn't we be waiting for it to stop?
- I've removed the call, since stop_wait_callback now does do
- something when called with lp->signalled == 0. */
-
- gdb_assert (lp->status == 0 || WIFSTOPPED (lp->status));
- }
-
- /* We don't actually detach from the LWP that has an id equal to the
- overall process id just yet. */
- if (GET_LWP (lp->ptid) != GET_PID (lp->ptid))
- {
- errno = 0;
- if (ptrace (PTRACE_DETACH, GET_LWP (lp->ptid), 0,
- WSTOPSIG (lp->status)) < 0)
- error ("Can't detach %s: %s", target_pid_to_str (lp->ptid),
- safe_strerror (errno));
-
- if (debug_linux_nat)
- fprintf_unfiltered (gdb_stdlog,
- "PTRACE_DETACH (%s, %s, 0) (OK)\n",
- target_pid_to_str (lp->ptid),
- strsignal (WSTOPSIG (lp->status)));
-
- delete_lwp (lp->ptid);
- }
-
- return 0;
-}
-
-static void
-linux_nat_detach (char *args, int from_tty)
-{
- iterate_over_lwps (detach_callback, NULL);
-
- /* Only the initial process should be left right now. */
- gdb_assert (num_lwps == 1);
-
- trap_ptid = null_ptid;
-
- /* Destroy LWP info; it's no longer valid. */
- init_lwp_list ();
-
- /* Restore the original signal mask. */
- sigprocmask (SIG_SETMASK, &normal_mask, NULL);
- sigemptyset (&blocked_mask);
-
- inferior_ptid = pid_to_ptid (GET_PID (inferior_ptid));
- deprecated_child_ops.to_detach (args, from_tty);
-}
-
-/* Resume LP. */
-
-static int
-resume_callback (struct lwp_info *lp, void *data)
-{
- if (lp->stopped && lp->status == 0)
- {
- struct thread_info *tp;
-
- child_resume (pid_to_ptid (GET_LWP (lp->ptid)), 0, TARGET_SIGNAL_0);
- if (debug_linux_nat)
- fprintf_unfiltered (gdb_stdlog,
- "RC: PTRACE_CONT %s, 0, 0 (resume sibling)\n",
- target_pid_to_str (lp->ptid));
- lp->stopped = 0;
- lp->step = 0;
- }
-
- return 0;
-}
-
-static int
-resume_clear_callback (struct lwp_info *lp, void *data)
-{
- lp->resumed = 0;
- return 0;
-}
-
-static int
-resume_set_callback (struct lwp_info *lp, void *data)
-{
- lp->resumed = 1;
- return 0;
-}
-
-static void
-linux_nat_resume (ptid_t ptid, int step, enum target_signal signo)
-{
- struct lwp_info *lp;
- int resume_all;
-
- /* A specific PTID means `step only this process id'. */
- resume_all = (PIDGET (ptid) == -1);
-
- if (resume_all)
- iterate_over_lwps (resume_set_callback, NULL);
- else
- iterate_over_lwps (resume_clear_callback, NULL);
-
- /* If PID is -1, it's the current inferior that should be
- handled specially. */
- if (PIDGET (ptid) == -1)
- ptid = inferior_ptid;
-
- lp = find_lwp_pid (ptid);
- if (lp)
- {
- ptid = pid_to_ptid (GET_LWP (lp->ptid));
-
- /* Remember if we're stepping. */
- lp->step = step;
-
- /* Mark this LWP as resumed. */
- lp->resumed = 1;
-
- /* If we have a pending wait status for this thread, there is no
- point in resuming the process. */
- if (lp->status)
- {
- /* FIXME: What should we do if we are supposed to continue
- this thread with a signal? */
- gdb_assert (signo == TARGET_SIGNAL_0);
- return;
- }
-
- /* Mark LWP as not stopped to prevent it from being continued by
- resume_callback. */
- lp->stopped = 0;
- }
-
- if (resume_all)
- iterate_over_lwps (resume_callback, NULL);
-
- child_resume (ptid, step, signo);
- if (debug_linux_nat)
- fprintf_unfiltered (gdb_stdlog,
- "LLR: %s %s, %s (resume event thread)\n",
- step ? "PTRACE_SINGLESTEP" : "PTRACE_CONT",
- target_pid_to_str (ptid),
- signo ? strsignal (signo) : "0");
-}
-
-/* Issue kill to specified lwp. */
-
-static int tkill_failed;
-
-static int
-kill_lwp (int lwpid, int signo)
-{
- errno = 0;
-
-/* Use tkill, if possible, in case we are using nptl threads. If tkill
- fails, then we are not using nptl threads and we should be using kill. */
-
-#ifdef HAVE_TKILL_SYSCALL
- if (!tkill_failed)
- {
- int ret = syscall (__NR_tkill, lwpid, signo);
- if (errno != ENOSYS)
- return ret;
- errno = 0;
- tkill_failed = 1;
- }
-#endif
-
- return kill (lwpid, signo);
-}
-
-/* Handle a GNU/Linux extended wait response. Most of the work we
- just pass off to linux_handle_extended_wait, but if it reports a
- clone event we need to add the new LWP to our list (and not report
- the trap to higher layers). This function returns non-zero if
- the event should be ignored and we should wait again. */
-
-static int
-linux_nat_handle_extended (struct lwp_info *lp, int status)
-{
- linux_handle_extended_wait (GET_LWP (lp->ptid), status,
- &lp->waitstatus);
-
- /* TARGET_WAITKIND_SPURIOUS is used to indicate clone events. */
- if (lp->waitstatus.kind == TARGET_WAITKIND_SPURIOUS)
- {
- struct lwp_info *new_lp;
- new_lp = add_lwp (BUILD_LWP (lp->waitstatus.value.related_pid,
- GET_PID (inferior_ptid)));
- new_lp->cloned = 1;
- new_lp->stopped = 1;
-
- lp->waitstatus.kind = TARGET_WAITKIND_IGNORE;
-
- if (debug_linux_nat)
- fprintf_unfiltered (gdb_stdlog,
- "LLHE: Got clone event from LWP %ld, resuming\n",
- GET_LWP (lp->ptid));
- ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
-
- return 1;
- }
-
- return 0;
-}
-
-/* Wait for LP to stop. Returns the wait status, or 0 if the LWP has
- exited. */
-
-static int
-wait_lwp (struct lwp_info *lp)
-{
- pid_t pid;
- int status;
- int thread_dead = 0;
-
- gdb_assert (!lp->stopped);
- gdb_assert (lp->status == 0);
-
- pid = waitpid (GET_LWP (lp->ptid), &status, 0);
- if (pid == -1 && errno == ECHILD)
- {
- pid = waitpid (GET_LWP (lp->ptid), &status, __WCLONE);
- if (pid == -1 && errno == ECHILD)
- {
- /* The thread has previously exited. We need to delete it
- now because, for some vendor 2.4 kernels with NPTL
- support backported, there won't be an exit event unless
- it is the main thread. 2.6 kernels will report an exit
- event for each thread that exits, as expected. */
- thread_dead = 1;
- if (debug_linux_nat)
- fprintf_unfiltered (gdb_stdlog, "WL: %s vanished.\n",
- target_pid_to_str (lp->ptid));
- }
- }
-
- if (!thread_dead)
- {
- gdb_assert (pid == GET_LWP (lp->ptid));
-
- if (debug_linux_nat)
- {
- fprintf_unfiltered (gdb_stdlog,
- "WL: waitpid %s received %s\n",
- target_pid_to_str (lp->ptid),
- status_to_str (status));
- }
- }
-
- /* Check if the thread has exited. */
- if (WIFEXITED (status) || WIFSIGNALED (status))
- {
- thread_dead = 1;
- if (debug_linux_nat)
- fprintf_unfiltered (gdb_stdlog, "WL: %s exited.\n",
- target_pid_to_str (lp->ptid));
- }
-
- if (thread_dead)
- {
- if (in_thread_list (lp->ptid))
- {
- /* Core GDB cannot deal with us deleting the current thread. */
- if (!ptid_equal (lp->ptid, inferior_ptid))
- delete_thread (lp->ptid);
- printf_unfiltered ("[%s exited]\n",
- target_pid_to_str (lp->ptid));
- }
-
- delete_lwp (lp->ptid);
- return 0;
- }
-
- gdb_assert (WIFSTOPPED (status));
-
- /* Handle GNU/Linux's extended waitstatus for trace events. */
- if (WIFSTOPPED (status) && WSTOPSIG (status) == SIGTRAP && status >> 16 != 0)
- {
- if (debug_linux_nat)
- fprintf_unfiltered (gdb_stdlog,
- "WL: Handling extended status 0x%06x\n",
- status);
- if (linux_nat_handle_extended (lp, status))
- return wait_lwp (lp);
- }
-
- return status;
-}
-
-/* Send a SIGSTOP to LP. */
-
-static int
-stop_callback (struct lwp_info *lp, void *data)
-{
- if (!lp->stopped && !lp->signalled)
- {
- int ret;
-
- if (debug_linux_nat)
- {
- fprintf_unfiltered (gdb_stdlog,
- "SC: kill %s **<SIGSTOP>**\n",
- target_pid_to_str (lp->ptid));
- }
- errno = 0;
- ret = kill_lwp (GET_LWP (lp->ptid), SIGSTOP);
- if (debug_linux_nat)
- {
- fprintf_unfiltered (gdb_stdlog,
- "SC: lwp kill %d %s\n",
- ret,
- errno ? safe_strerror (errno) : "ERRNO-OK");
- }
-
- lp->signalled = 1;
- gdb_assert (lp->status == 0);
- }
-
- return 0;
-}
-
-/* Wait until LP is stopped. If DATA is non-null it is interpreted as
- a pointer to a set of signals to be flushed immediately. */
-
-static int
-stop_wait_callback (struct lwp_info *lp, void *data)
-{
- sigset_t *flush_mask = data;
-
- if (!lp->stopped)
- {
- int status;
-
- status = wait_lwp (lp);
- if (status == 0)
- return 0;
-
- /* Ignore any signals in FLUSH_MASK. */
- if (flush_mask && sigismember (flush_mask, WSTOPSIG (status)))
- {
- if (!lp->signalled)
- {
- lp->stopped = 1;
- return 0;
- }
-
- errno = 0;
- ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
- if (debug_linux_nat)
- fprintf_unfiltered (gdb_stdlog,
- "PTRACE_CONT %s, 0, 0 (%s)\n",
- target_pid_to_str (lp->ptid),
- errno ? safe_strerror (errno) : "OK");
-
- return stop_wait_callback (lp, flush_mask);
- }
-
- if (WSTOPSIG (status) != SIGSTOP)
- {
- if (WSTOPSIG (status) == SIGTRAP)
- {
- /* If a LWP other than the LWP that we're reporting an
- event for has hit a GDB breakpoint (as opposed to
- some random trap signal), then just arrange for it to
- hit it again later. We don't keep the SIGTRAP status
- and don't forward the SIGTRAP signal to the LWP. We
- will handle the current event, eventually we will
- resume all LWPs, and this one will get its breakpoint
- trap again.
-
- If we do not do this, then we run the risk that the
- user will delete or disable the breakpoint, but the
- thread will have already tripped on it. */
-
- /* Now resume this LWP and get the SIGSTOP event. */
- errno = 0;
- ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
- if (debug_linux_nat)
- {
- fprintf_unfiltered (gdb_stdlog,
- "PTRACE_CONT %s, 0, 0 (%s)\n",
- target_pid_to_str (lp->ptid),
- errno ? safe_strerror (errno) : "OK");
-
- fprintf_unfiltered (gdb_stdlog,
- "SWC: Candidate SIGTRAP event in %s\n",
- target_pid_to_str (lp->ptid));
- }
- /* Hold the SIGTRAP for handling by linux_nat_wait. */
- stop_wait_callback (lp, data);
- /* If there's another event, throw it back into the queue. */
- if (lp->status)
- {
- if (debug_linux_nat)
- {
- fprintf_unfiltered (gdb_stdlog,
- "SWC: kill %s, %s\n",
- target_pid_to_str (lp->ptid),
- status_to_str ((int) status));
- }
- kill_lwp (GET_LWP (lp->ptid), WSTOPSIG (lp->status));
- }
- /* Save the sigtrap event. */
- lp->status = status;
- return 0;
- }
- else
- {
- /* The thread was stopped with a signal other than
- SIGSTOP, and didn't accidentally trip a breakpoint. */
-
- if (debug_linux_nat)
- {
- fprintf_unfiltered (gdb_stdlog,
- "SWC: Pending event %s in %s\n",
- status_to_str ((int) status),
- target_pid_to_str (lp->ptid));
- }
- /* Now resume this LWP and get the SIGSTOP event. */
- errno = 0;
- ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
- if (debug_linux_nat)
- fprintf_unfiltered (gdb_stdlog,
- "SWC: PTRACE_CONT %s, 0, 0 (%s)\n",
- target_pid_to_str (lp->ptid),
- errno ? safe_strerror (errno) : "OK");
-
- /* Hold this event/waitstatus while we check to see if
- there are any more (we still want to get that SIGSTOP). */
- stop_wait_callback (lp, data);
- /* If the lp->status field is still empty, use it to hold
- this event. If not, then this event must be returned
- to the event queue of the LWP. */
- if (lp->status == 0)
- lp->status = status;
- else
- {
- if (debug_linux_nat)
- {
- fprintf_unfiltered (gdb_stdlog,
- "SWC: kill %s, %s\n",
- target_pid_to_str (lp->ptid),
- status_to_str ((int) status));
- }
- kill_lwp (GET_LWP (lp->ptid), WSTOPSIG (status));
- }
- return 0;
- }
- }
- else
- {
- /* We caught the SIGSTOP that we intended to catch, so
- there's no SIGSTOP pending. */
- lp->stopped = 1;
- lp->signalled = 0;
- }
- }
-
- return 0;
-}
-
-/* Check whether PID has any pending signals in FLUSH_MASK. If so set
- the appropriate bits in PENDING, and return 1 - otherwise return 0. */
-
-static int
-linux_nat_has_pending (int pid, sigset_t *pending, sigset_t *flush_mask)
-{
- sigset_t blocked, ignored;
- int i;
-
- linux_proc_pending_signals (pid, pending, &blocked, &ignored);
-
- if (!flush_mask)
- return 0;
-
- for (i = 1; i < NSIG; i++)
- if (sigismember (pending, i))
- if (!sigismember (flush_mask, i)
- || sigismember (&blocked, i)
- || sigismember (&ignored, i))
- sigdelset (pending, i);
-
- if (sigisemptyset (pending))
- return 0;
-
- return 1;
-}
-
-/* DATA is interpreted as a mask of signals to flush. If LP has
- signals pending, and they are all in the flush mask, then arrange
- to flush them. LP should be stopped, as should all other threads
- it might share a signal queue with. */
-
-static int
-flush_callback (struct lwp_info *lp, void *data)
-{
- sigset_t *flush_mask = data;
- sigset_t pending, intersection, blocked, ignored;
- int pid, status;
-
- /* Normally, when an LWP exits, it is removed from the LWP list. The
- last LWP isn't removed till later, however. So if there is only
- one LWP on the list, make sure it's alive. */
- if (lwp_list == lp && lp->next == NULL)
- if (!linux_nat_thread_alive (lp->ptid))
- return 0;
-
- /* Just because the LWP is stopped doesn't mean that new signals
- can't arrive from outside, so this function must be careful of
- race conditions. However, because all threads are stopped, we
- can assume that the pending mask will not shrink unless we resume
- the LWP, and that it will then get another signal. We can't
- control which one, however. */
-
- if (lp->status)
- {
- if (debug_linux_nat)
- printf_unfiltered ("FC: LP has pending status %06x\n", lp->status);
- if (WIFSTOPPED (lp->status) && sigismember (flush_mask, WSTOPSIG (lp->status)))
- lp->status = 0;
- }
-
- while (linux_nat_has_pending (GET_LWP (lp->ptid), &pending, flush_mask))
- {
- int ret;
-
- errno = 0;
- ret = ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
- if (debug_linux_nat)
- fprintf_unfiltered (gdb_stderr,
- "FC: Sent PTRACE_CONT, ret %d %d\n", ret, errno);
-
- lp->stopped = 0;
- stop_wait_callback (lp, flush_mask);
- if (debug_linux_nat)
- fprintf_unfiltered (gdb_stderr,
- "FC: Wait finished; saved status is %d\n",
- lp->status);
- }
-
- return 0;
-}
-
-/* Return non-zero if LP has a wait status pending. */
-
-static int
-status_callback (struct lwp_info *lp, void *data)
-{
- /* Only report a pending wait status if we pretend that this has
- indeed been resumed. */
- return (lp->status != 0 && lp->resumed);
-}
-
-/* Return non-zero if LP isn't stopped. */
-
-static int
-running_callback (struct lwp_info *lp, void *data)
-{
- return (lp->stopped == 0 || (lp->status != 0 && lp->resumed));
-}
-
-/* Count the LWP's that have had events. */
-
-static int
-count_events_callback (struct lwp_info *lp, void *data)
-{
- int *count = data;
-
- gdb_assert (count != NULL);
-
- /* Count only LWPs that have a SIGTRAP event pending. */
- if (lp->status != 0
- && WIFSTOPPED (lp->status) && WSTOPSIG (lp->status) == SIGTRAP)
- (*count)++;
-
- return 0;
-}
-
-/* Select the LWP (if any) that is currently being single-stepped. */
-
-static int
-select_singlestep_lwp_callback (struct lwp_info *lp, void *data)
-{
- if (lp->step && lp->status != 0)
- return 1;
- else
- return 0;
-}
-
-/* Select the Nth LWP that has had a SIGTRAP event. */
-
-static int
-select_event_lwp_callback (struct lwp_info *lp, void *data)
-{
- int *selector = data;
-
- gdb_assert (selector != NULL);
-
- /* Select only LWPs that have a SIGTRAP event pending. */
- if (lp->status != 0
- && WIFSTOPPED (lp->status) && WSTOPSIG (lp->status) == SIGTRAP)
- if ((*selector)-- == 0)
- return 1;
-
- return 0;
-}
-
-static int
-cancel_breakpoints_callback (struct lwp_info *lp, void *data)
-{
- struct lwp_info *event_lp = data;
-
- /* Leave the LWP that has been elected to receive a SIGTRAP alone. */
- if (lp == event_lp)
- return 0;
-
- /* If a LWP other than the LWP that we're reporting an event for has
- hit a GDB breakpoint (as opposed to some random trap signal),
- then just arrange for it to hit it again later. We don't keep
- the SIGTRAP status and don't forward the SIGTRAP signal to the
- LWP. We will handle the current event, eventually we will resume
- all LWPs, and this one will get its breakpoint trap again.
-
- If we do not do this, then we run the risk that the user will
- delete or disable the breakpoint, but the LWP will have already
- tripped on it. */
-
- if (lp->status != 0
- && WIFSTOPPED (lp->status) && WSTOPSIG (lp->status) == SIGTRAP
- && breakpoint_inserted_here_p (read_pc_pid (lp->ptid) -
- DECR_PC_AFTER_BREAK))
- {
- if (debug_linux_nat)
- fprintf_unfiltered (gdb_stdlog,
- "CBC: Push back breakpoint for %s\n",
- target_pid_to_str (lp->ptid));
-
- /* Back up the PC if necessary. */
- if (DECR_PC_AFTER_BREAK)
- write_pc_pid (read_pc_pid (lp->ptid) - DECR_PC_AFTER_BREAK, lp->ptid);
-
- /* Throw away the SIGTRAP. */
- lp->status = 0;
- }
-
- return 0;
-}
-
-/* Select one LWP out of those that have events pending. */
-
-static void
-select_event_lwp (struct lwp_info **orig_lp, int *status)
-{
- int num_events = 0;
- int random_selector;
- struct lwp_info *event_lp;
-
- /* Record the wait status for the origional LWP. */
- (*orig_lp)->status = *status;
-
- /* Give preference to any LWP that is being single-stepped. */
- event_lp = iterate_over_lwps (select_singlestep_lwp_callback, NULL);
- if (event_lp != NULL)
- {
- if (debug_linux_nat)
- fprintf_unfiltered (gdb_stdlog,
- "SEL: Select single-step %s\n",
- target_pid_to_str (event_lp->ptid));
- }
- else
- {
- /* No single-stepping LWP. Select one at random, out of those
- which have had SIGTRAP events. */
-
- /* First see how many SIGTRAP events we have. */
- iterate_over_lwps (count_events_callback, &num_events);
-
- /* Now randomly pick a LWP out of those that have had a SIGTRAP. */
- random_selector = (int)
- ((num_events * (double) rand ()) / (RAND_MAX + 1.0));
-
- if (debug_linux_nat && num_events > 1)
- fprintf_unfiltered (gdb_stdlog,
- "SEL: Found %d SIGTRAP events, selecting #%d\n",
- num_events, random_selector);
-
- event_lp = iterate_over_lwps (select_event_lwp_callback,
- &random_selector);
- }
-
- if (event_lp != NULL)
- {
- /* Switch the event LWP. */
- *orig_lp = event_lp;
- *status = event_lp->status;
- }
-
- /* Flush the wait status for the event LWP. */
- (*orig_lp)->status = 0;
-}
-
-/* Return non-zero if LP has been resumed. */
-
-static int
-resumed_callback (struct lwp_info *lp, void *data)
-{
- return lp->resumed;
-}
-
-#ifdef CHILD_WAIT
-
-/* We need to override child_wait to support attaching to cloned
- processes, since a normal wait (as done by the default version)
- ignores those processes. */
-
-/* Wait for child PTID to do something. Return id of the child,
- minus_one_ptid in case of error; store status into *OURSTATUS. */
-
-ptid_t
-child_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
-{
- int save_errno;
- int status;
- pid_t pid;
-
- ourstatus->kind = TARGET_WAITKIND_IGNORE;
-
- do
- {
- set_sigint_trap (); /* Causes SIGINT to be passed on to the
- attached process. */
- set_sigio_trap ();
-
- pid = waitpid (GET_PID (ptid), &status, 0);
- if (pid == -1 && errno == ECHILD)
- /* Try again with __WCLONE to check cloned processes. */
- pid = waitpid (GET_PID (ptid), &status, __WCLONE);
-
- if (debug_linux_nat)
- {
- fprintf_unfiltered (gdb_stdlog,
- "CW: waitpid %ld received %s\n",
- (long) pid, status_to_str (status));
- }
-
- save_errno = errno;
-
- /* Make sure we don't report an event for the exit of the
- original program, if we've detached from it. */
- if (pid != -1 && !WIFSTOPPED (status) && pid != GET_PID (inferior_ptid))
- {
- pid = -1;
- save_errno = EINTR;
- }
-
- /* Check for stop events reported by a process we didn't already
- know about - in this case, anything other than inferior_ptid.
-
- If we're expecting to receive stopped processes after fork,
- vfork, and clone events, then we'll just add the new one to
- our list and go back to waiting for the event to be reported
- - the stopped process might be returned from waitpid before
- or after the event is. If we want to handle debugging of
- CLONE_PTRACE processes we need to do more here, i.e. switch
- to multi-threaded mode. */
- if (pid != -1 && WIFSTOPPED (status) && WSTOPSIG (status) == SIGSTOP
- && pid != GET_PID (inferior_ptid))
- {
- linux_record_stopped_pid (pid);
- pid = -1;
- save_errno = EINTR;
- }
-
- /* Handle GNU/Linux's extended waitstatus for trace events. */
- if (pid != -1 && WIFSTOPPED (status) && WSTOPSIG (status) == SIGTRAP
- && status >> 16 != 0)
- {
- linux_handle_extended_wait (pid, status, ourstatus);
-
- /* If we see a clone event, detach the child, and don't
- report the event. It would be nice to offer some way to
- switch into a non-thread-db based threaded mode at this
- point. */
- if (ourstatus->kind == TARGET_WAITKIND_SPURIOUS)
- {
- ptrace (PTRACE_DETACH, ourstatus->value.related_pid, 0, 0);
- ourstatus->kind = TARGET_WAITKIND_IGNORE;
- ptrace (PTRACE_CONT, pid, 0, 0);
- pid = -1;
- save_errno = EINTR;
- }
- }
-
- clear_sigio_trap ();
- clear_sigint_trap ();
- }
- while (pid == -1 && save_errno == EINTR);
-
- if (pid == -1)
- {
- warning ("Child process unexpectedly missing: %s",
- safe_strerror (errno));
-
- /* Claim it exited with unknown signal. */
- ourstatus->kind = TARGET_WAITKIND_SIGNALLED;
- ourstatus->value.sig = TARGET_SIGNAL_UNKNOWN;
- return minus_one_ptid;
+ ret = ptrace_wait (null_ptid, &status);
}
- if (ourstatus->kind == TARGET_WAITKIND_IGNORE)
- store_waitstatus (ourstatus, status);
-
- return pid_to_ptid (pid);
-}
-
-#endif
-
-/* Stop an active thread, verify it still exists, then resume it. */
-
-static int
-stop_and_resume_callback (struct lwp_info *lp, void *data)
-{
- struct lwp_info *ptr;
-
- if (!lp->stopped && !lp->signalled)
- {
- stop_callback (lp, NULL);
- stop_wait_callback (lp, NULL);
- /* Resume if the lwp still exists. */
- for (ptr = lwp_list; ptr; ptr = ptr->next)
- if (lp == ptr)
- {
- resume_callback (lp, NULL);
- resume_set_callback (lp, NULL);
- }
- }
- return 0;
-}
-
-static ptid_t
-linux_nat_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
-{
- struct lwp_info *lp = NULL;
- int options = 0;
- int status = 0;
- pid_t pid = PIDGET (ptid);
- sigset_t flush_mask;
-
- sigemptyset (&flush_mask);
-
- /* Make sure SIGCHLD is blocked. */
- if (!sigismember (&blocked_mask, SIGCHLD))
- {
- sigaddset (&blocked_mask, SIGCHLD);
- sigprocmask (SIG_BLOCK, &blocked_mask, NULL);
- }
-
-retry:
-
- /* Make sure there is at least one LWP that has been resumed, at
- least if there are any LWPs at all. */
- gdb_assert (num_lwps == 0 || iterate_over_lwps (resumed_callback, NULL));
-
- /* First check if there is a LWP with a wait status pending. */
- if (pid == -1)
- {
- /* Any LWP that's been resumed will do. */
- lp = iterate_over_lwps (status_callback, NULL);
- if (lp)
- {
- status = lp->status;
- lp->status = 0;
-
- if (debug_linux_nat && status)
- fprintf_unfiltered (gdb_stdlog,
- "LLW: Using pending wait status %s for %s.\n",
- status_to_str (status),
- target_pid_to_str (lp->ptid));
- }
-
- /* But if we don't fine one, we'll have to wait, and check both
- cloned and uncloned processes. We start with the cloned
- processes. */
- options = __WCLONE | WNOHANG;
- }
- else if (is_lwp (ptid))
- {
- if (debug_linux_nat)
- fprintf_unfiltered (gdb_stdlog,
- "LLW: Waiting for specific LWP %s.\n",
- target_pid_to_str (ptid));
-
- /* We have a specific LWP to check. */
- lp = find_lwp_pid (ptid);
- gdb_assert (lp);
- status = lp->status;
- lp->status = 0;
-
- if (debug_linux_nat && status)
- fprintf_unfiltered (gdb_stdlog,
- "LLW: Using pending wait status %s for %s.\n",
- status_to_str (status),
- target_pid_to_str (lp->ptid));
-
- /* If we have to wait, take into account whether PID is a cloned
- process or not. And we have to convert it to something that
- the layer beneath us can understand. */
- options = lp->cloned ? __WCLONE : 0;
- pid = GET_LWP (ptid);
- }
-
- if (status && lp->signalled)
- {
- /* A pending SIGSTOP may interfere with the normal stream of
- events. In a typical case where interference is a problem,
- we have a SIGSTOP signal pending for LWP A while
- single-stepping it, encounter an event in LWP B, and take the
- pending SIGSTOP while trying to stop LWP A. After processing
- the event in LWP B, LWP A is continued, and we'll never see
- the SIGTRAP associated with the last time we were
- single-stepping LWP A. */
-
- /* Resume the thread. It should halt immediately returning the
- pending SIGSTOP. */
- registers_changed ();
- child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step,
- TARGET_SIGNAL_0);
- if (debug_linux_nat)
- fprintf_unfiltered (gdb_stdlog,
- "LLW: %s %s, 0, 0 (expect SIGSTOP)\n",
- lp->step ? "PTRACE_SINGLESTEP" : "PTRACE_CONT",
- target_pid_to_str (lp->ptid));
- lp->stopped = 0;
- gdb_assert (lp->resumed);
-
- /* This should catch the pending SIGSTOP. */
- stop_wait_callback (lp, NULL);
- }
-
- set_sigint_trap (); /* Causes SIGINT to be passed on to the
- attached process. */
- set_sigio_trap ();
-
- while (status == 0)
- {
- pid_t lwpid;
-
- lwpid = waitpid (pid, &status, options);
- if (lwpid > 0)
- {
- gdb_assert (pid == -1 || lwpid == pid);
-
- if (debug_linux_nat)
- {
- fprintf_unfiltered (gdb_stdlog,
- "LLW: waitpid %ld received %s\n",
- (long) lwpid, status_to_str (status));
- }
-
- lp = find_lwp_pid (pid_to_ptid (lwpid));
-
- /* Check for stop events reported by a process we didn't
- already know about - anything not already in our LWP
- list.
-
- If we're expecting to receive stopped processes after
- fork, vfork, and clone events, then we'll just add the
- new one to our list and go back to waiting for the event
- to be reported - the stopped process might be returned
- from waitpid before or after the event is. */
- if (WIFSTOPPED (status) && !lp)
- {
- linux_record_stopped_pid (lwpid);
- status = 0;
- continue;
- }
-
- /* Make sure we don't report an event for the exit of an LWP not in
- our list, i.e. not part of the current process. This can happen
- if we detach from a program we original forked and then it
- exits. */
- if (!WIFSTOPPED (status) && !lp)
- {
- status = 0;
- continue;
- }
-
- /* NOTE drow/2003-06-17: This code seems to be meant for debugging
- CLONE_PTRACE processes which do not use the thread library -
- otherwise we wouldn't find the new LWP this way. That doesn't
- currently work, and the following code is currently unreachable
- due to the two blocks above. If it's fixed some day, this code
- should be broken out into a function so that we can also pick up
- LWPs from the new interface. */
- if (!lp)
- {
- lp = add_lwp (BUILD_LWP (lwpid, GET_PID (inferior_ptid)));
- if (options & __WCLONE)
- lp->cloned = 1;
-
- if (threaded)
- {
- gdb_assert (WIFSTOPPED (status)
- && WSTOPSIG (status) == SIGSTOP);
- lp->signalled = 1;
-
- if (!in_thread_list (inferior_ptid))
- {
- inferior_ptid = BUILD_LWP (GET_PID (inferior_ptid),
- GET_PID (inferior_ptid));
- add_thread (inferior_ptid);
- }
-
- add_thread (lp->ptid);
- printf_unfiltered ("[New %s]\n",
- target_pid_to_str (lp->ptid));
- }
- }
-
- /* Handle GNU/Linux's extended waitstatus for trace events. */
- if (WIFSTOPPED (status) && WSTOPSIG (status) == SIGTRAP && status >> 16 != 0)
- {
- if (debug_linux_nat)
- fprintf_unfiltered (gdb_stdlog,
- "LLW: Handling extended status 0x%06x\n",
- status);
- if (linux_nat_handle_extended (lp, status))
- {
- status = 0;
- continue;
- }
- }
-
- /* Check if the thread has exited. */
- if ((WIFEXITED (status) || WIFSIGNALED (status)) && num_lwps > 1)
- {
- if (in_thread_list (lp->ptid))
- {
- /* Core GDB cannot deal with us deleting the current
- thread. */
- if (!ptid_equal (lp->ptid, inferior_ptid))
- delete_thread (lp->ptid);
- printf_unfiltered ("[%s exited]\n",
- target_pid_to_str (lp->ptid));
- }
-
- /* If this is the main thread, we must stop all threads and
- verify if they are still alive. This is because in the nptl
- thread model, there is no signal issued for exiting LWPs
- other than the main thread. We only get the main thread
- exit signal once all child threads have already exited.
- If we stop all the threads and use the stop_wait_callback
- to check if they have exited we can determine whether this
- signal should be ignored or whether it means the end of the
- debugged application, regardless of which threading model
- is being used. */
- if (GET_PID (lp->ptid) == GET_LWP (lp->ptid))
- {
- lp->stopped = 1;
- iterate_over_lwps (stop_and_resume_callback, NULL);
- }
-
- if (debug_linux_nat)
- fprintf_unfiltered (gdb_stdlog,
- "LLW: %s exited.\n",
- target_pid_to_str (lp->ptid));
-
- delete_lwp (lp->ptid);
-
- /* If there is at least one more LWP, then the exit signal
- was not the end of the debugged application and should be
- ignored. */
- if (num_lwps > 0)
- {
- /* Make sure there is at least one thread running. */
- gdb_assert (iterate_over_lwps (running_callback, NULL));
-
- /* Discard the event. */
- status = 0;
- continue;
- }
- }
-
- /* Check if the current LWP has previously exited. In the nptl
- thread model, LWPs other than the main thread do not issue
- signals when they exit so we must check whenever the thread
- has stopped. A similar check is made in stop_wait_callback(). */
- if (num_lwps > 1 && !linux_nat_thread_alive (lp->ptid))
- {
- if (in_thread_list (lp->ptid))
- {
- /* Core GDB cannot deal with us deleting the current
- thread. */
- if (!ptid_equal (lp->ptid, inferior_ptid))
- delete_thread (lp->ptid);
- printf_unfiltered ("[%s exited]\n",
- target_pid_to_str (lp->ptid));
- }
- if (debug_linux_nat)
- fprintf_unfiltered (gdb_stdlog,
- "LLW: %s exited.\n",
- target_pid_to_str (lp->ptid));
-
- delete_lwp (lp->ptid);
-
- /* Make sure there is at least one thread running. */
- gdb_assert (iterate_over_lwps (running_callback, NULL));
-
- /* Discard the event. */
- status = 0;
- continue;
- }
-
- /* Make sure we don't report a SIGSTOP that we sent
- ourselves in an attempt to stop an LWP. */
- if (lp->signalled
- && WIFSTOPPED (status) && WSTOPSIG (status) == SIGSTOP)
- {
- if (debug_linux_nat)
- fprintf_unfiltered (gdb_stdlog,
- "LLW: Delayed SIGSTOP caught for %s.\n",
- target_pid_to_str (lp->ptid));
-
- /* This is a delayed SIGSTOP. */
- lp->signalled = 0;
-
- registers_changed ();
- child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step,
- TARGET_SIGNAL_0);
- if (debug_linux_nat)
- fprintf_unfiltered (gdb_stdlog,
- "LLW: %s %s, 0, 0 (discard SIGSTOP)\n",
- lp->step ?
- "PTRACE_SINGLESTEP" : "PTRACE_CONT",
- target_pid_to_str (lp->ptid));
-
- lp->stopped = 0;
- gdb_assert (lp->resumed);
-
- /* Discard the event. */
- status = 0;
- continue;
- }
-
- break;
- }
-
- if (pid == -1)
- {
- /* Alternate between checking cloned and uncloned processes. */
- options ^= __WCLONE;
-
- /* And suspend every time we have checked both. */
- if (options & __WCLONE)
- sigsuspend (&suspend_mask);
- }
-
- /* We shouldn't end up here unless we want to try again. */
- gdb_assert (status == 0);
- }
-
- clear_sigio_trap ();
- clear_sigint_trap ();
-
- gdb_assert (lp);
-
- /* Don't report signals that GDB isn't interested in, such as
- signals that are neither printed nor stopped upon. Stopping all
- threads can be a bit time-consuming so if we want decent
- performance with heavily multi-threaded programs, especially when
- they're using a high frequency timer, we'd better avoid it if we
- can. */
-
- if (WIFSTOPPED (status))
- {
- int signo = target_signal_from_host (WSTOPSIG (status));
-
- if (signal_stop_state (signo) == 0
- && signal_print_state (signo) == 0
- && signal_pass_state (signo) == 1)
- {
- /* FIMXE: kettenis/2001-06-06: Should we resume all threads
- here? It is not clear we should. GDB may not expect
- other threads to run. On the other hand, not resuming
- newly attached threads may cause an unwanted delay in
- getting them running. */
- registers_changed ();
- child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step, signo);
- if (debug_linux_nat)
- fprintf_unfiltered (gdb_stdlog,
- "LLW: %s %s, %s (preempt 'handle')\n",
- lp->step ?
- "PTRACE_SINGLESTEP" : "PTRACE_CONT",
- target_pid_to_str (lp->ptid),
- signo ? strsignal (signo) : "0");
- lp->stopped = 0;
- status = 0;
- goto retry;
- }
-
- if (signo == TARGET_SIGNAL_INT && signal_pass_state (signo) == 0)
- {
- /* If ^C/BREAK is typed at the tty/console, SIGINT gets
- forwarded to the entire process group, that is, all LWP's
- will receive it. Since we only want to report it once,
- we try to flush it from all LWPs except this one. */
- sigaddset (&flush_mask, SIGINT);
- }
- }
-
- /* This LWP is stopped now. */
- lp->stopped = 1;
-
- if (debug_linux_nat)
- fprintf_unfiltered (gdb_stdlog, "LLW: Candidate event %s in %s.\n",
- status_to_str (status), target_pid_to_str (lp->ptid));
-
- /* Now stop all other LWP's ... */
- iterate_over_lwps (stop_callback, NULL);
-
- /* ... and wait until all of them have reported back that they're no
- longer running. */
- iterate_over_lwps (stop_wait_callback, &flush_mask);
- iterate_over_lwps (flush_callback, &flush_mask);
-
- /* If we're not waiting for a specific LWP, choose an event LWP from
- among those that have had events. Giving equal priority to all
- LWPs that have had events helps prevent starvation. */
- if (pid == -1)
- select_event_lwp (&lp, &status);
-
- /* Now that we've selected our final event LWP, cancel any
- breakpoints in other LWPs that have hit a GDB breakpoint. See
- the comment in cancel_breakpoints_callback to find out why. */
- iterate_over_lwps (cancel_breakpoints_callback, lp);
-
- /* If we're not running in "threaded" mode, we'll report the bare
- process id. */
-
- if (WIFSTOPPED (status) && WSTOPSIG (status) == SIGTRAP)
- {
- trap_ptid = (threaded ? lp->ptid : pid_to_ptid (GET_LWP (lp->ptid)));
- if (debug_linux_nat)
- fprintf_unfiltered (gdb_stdlog,
- "LLW: trap_ptid is %s.\n",
- target_pid_to_str (trap_ptid));
- }
- else
- trap_ptid = null_ptid;
-
- if (lp->waitstatus.kind != TARGET_WAITKIND_IGNORE)
- {
- *ourstatus = lp->waitstatus;
- lp->waitstatus.kind = TARGET_WAITKIND_IGNORE;
- }
- else
- store_waitstatus (ourstatus, status);
-
- return (threaded ? lp->ptid : pid_to_ptid (GET_LWP (lp->ptid)));
-}
-
-static int
-kill_callback (struct lwp_info *lp, void *data)
-{
- errno = 0;
- ptrace (PTRACE_KILL, GET_LWP (lp->ptid), 0, 0);
- if (debug_linux_nat)
- fprintf_unfiltered (gdb_stdlog,
- "KC: PTRACE_KILL %s, 0, 0 (%s)\n",
- target_pid_to_str (lp->ptid),
- errno ? safe_strerror (errno) : "OK");
-
- return 0;
-}
-
-static int
-kill_wait_callback (struct lwp_info *lp, void *data)
-{
- pid_t pid;
-
- /* We must make sure that there are no pending events (delayed
- SIGSTOPs, pending SIGTRAPs, etc.) to make sure the current
- program doesn't interfere with any following debugging session. */
-
- /* For cloned processes we must check both with __WCLONE and
- without, since the exit status of a cloned process isn't reported
- with __WCLONE. */
- if (lp->cloned)
- {
- do
- {
- pid = waitpid (GET_LWP (lp->ptid), NULL, __WCLONE);
- if (pid != (pid_t) -1 && debug_linux_nat)
- {
- fprintf_unfiltered (gdb_stdlog,
- "KWC: wait %s received unknown.\n",
- target_pid_to_str (lp->ptid));
- }
- }
- while (pid == GET_LWP (lp->ptid));
-
- gdb_assert (pid == -1 && errno == ECHILD);
- }
-
- do
- {
- pid = waitpid (GET_LWP (lp->ptid), NULL, 0);
- if (pid != (pid_t) -1 && debug_linux_nat)
- {
- fprintf_unfiltered (gdb_stdlog,
- "KWC: wait %s received unk.\n",
- target_pid_to_str (lp->ptid));
- }
- }
- while (pid == GET_LWP (lp->ptid));
-
- gdb_assert (pid == -1 && errno == ECHILD);
- return 0;
-}
-
-static void
-linux_nat_kill (void)
-{
- /* Kill all LWP's ... */
- iterate_over_lwps (kill_callback, NULL);
-
- /* ... and wait until we've flushed all events. */
- iterate_over_lwps (kill_wait_callback, NULL);
-
target_mourn_inferior ();
}
-
-static void
-linux_nat_create_inferior (char *exec_file, char *allargs, char **env,
- int from_tty)
-{
- deprecated_child_ops.to_create_inferior (exec_file, allargs, env, from_tty);
-}
-
-static void
-linux_nat_mourn_inferior (void)
-{
- trap_ptid = null_ptid;
-
- /* Destroy LWP info; it's no longer valid. */
- init_lwp_list ();
-
- /* Restore the original signal mask. */
- sigprocmask (SIG_SETMASK, &normal_mask, NULL);
- sigemptyset (&blocked_mask);
-
- deprecated_child_ops.to_mourn_inferior ();
-}
-
-static int
-linux_nat_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
- struct mem_attrib *attrib, struct target_ops *target)
-{
- struct cleanup *old_chain = save_inferior_ptid ();
- int xfer;
-
- if (is_lwp (inferior_ptid))
- inferior_ptid = pid_to_ptid (GET_LWP (inferior_ptid));
-
- xfer = linux_proc_xfer_memory (memaddr, myaddr, len, write, attrib, target);
- if (xfer == 0)
- xfer = child_xfer_memory (memaddr, myaddr, len, write, attrib, target);
-
- do_cleanups (old_chain);
- return xfer;
-}
-
-static int
-linux_nat_thread_alive (ptid_t ptid)
-{
- gdb_assert (is_lwp (ptid));
-
- errno = 0;
- ptrace (PTRACE_PEEKUSER, GET_LWP (ptid), 0, 0);
- if (debug_linux_nat)
- fprintf_unfiltered (gdb_stdlog,
- "LLTA: PTRACE_PEEKUSER %s, 0, 0 (%s)\n",
- target_pid_to_str (ptid),
- errno ? safe_strerror (errno) : "OK");
- if (errno)
- return 0;
-
- return 1;
-}
-
-static char *
-linux_nat_pid_to_str (ptid_t ptid)
-{
- static char buf[64];
-
- if (is_lwp (ptid))
- {
- snprintf (buf, sizeof (buf), "LWP %ld", GET_LWP (ptid));
- return buf;
- }
-
- return normal_pid_to_str (ptid);
-}
-
-static void
-init_linux_nat_ops (void)
-{
-#if 0
- linux_nat_ops.to_open = linux_nat_open;
-#endif
- linux_nat_ops.to_shortname = "lwp-layer";
- linux_nat_ops.to_longname = "lwp-layer";
- linux_nat_ops.to_doc = "Low level threads support (LWP layer)";
- linux_nat_ops.to_attach = linux_nat_attach;
- linux_nat_ops.to_detach = linux_nat_detach;
- linux_nat_ops.to_resume = linux_nat_resume;
- linux_nat_ops.to_wait = linux_nat_wait;
- /* fetch_inferior_registers and store_inferior_registers will
- honor the LWP id, so we can use them directly. */
- linux_nat_ops.to_fetch_registers = fetch_inferior_registers;
- linux_nat_ops.to_store_registers = store_inferior_registers;
- linux_nat_ops.deprecated_xfer_memory = linux_nat_xfer_memory;
- linux_nat_ops.to_kill = linux_nat_kill;
- linux_nat_ops.to_create_inferior = linux_nat_create_inferior;
- linux_nat_ops.to_mourn_inferior = linux_nat_mourn_inferior;
- linux_nat_ops.to_thread_alive = linux_nat_thread_alive;
- linux_nat_ops.to_pid_to_str = linux_nat_pid_to_str;
- linux_nat_ops.to_post_startup_inferior = child_post_startup_inferior;
- linux_nat_ops.to_post_attach = child_post_attach;
- linux_nat_ops.to_insert_fork_catchpoint = child_insert_fork_catchpoint;
- linux_nat_ops.to_insert_vfork_catchpoint = child_insert_vfork_catchpoint;
- linux_nat_ops.to_insert_exec_catchpoint = child_insert_exec_catchpoint;
-
- linux_nat_ops.to_stratum = thread_stratum;
- linux_nat_ops.to_has_thread_control = tc_schedlock;
- linux_nat_ops.to_magic = OPS_MAGIC;
-}
-
-static void
-sigchld_handler (int signo)
-{
- /* Do nothing. The only reason for this handler is that it allows
- us to use sigsuspend in linux_nat_wait above to wait for the
- arrival of a SIGCHLD. */
-}
-
-/* Accepts an integer PID; Returns a string representing a file that
- can be opened to get the symbols for the child process. */
-
-char *
-child_pid_to_exec_file (int pid)
-{
- char *name1, *name2;
-
- name1 = xmalloc (MAXPATHLEN);
- name2 = xmalloc (MAXPATHLEN);
- make_cleanup (xfree, name1);
- make_cleanup (xfree, name2);
- memset (name2, 0, MAXPATHLEN);
-
- sprintf (name1, "/proc/%d/exe", pid);
- if (readlink (name1, name2, MAXPATHLEN) > 0)
- return name2;
- else
- return name1;
-}
-
-/* Service function for corefiles and info proc. */
-
-static int
-read_mapping (FILE *mapfile,
- long long *addr,
- long long *endaddr,
- char *permissions,
- long long *offset,
- char *device, long long *inode, char *filename)
-{
- int ret = fscanf (mapfile, "%llx-%llx %s %llx %s %llx",
- addr, endaddr, permissions, offset, device, inode);
-
- if (ret > 0 && ret != EOF && *inode != 0)
- {
- /* Eat everything up to EOL for the filename. This will prevent
- weird filenames (such as one with embedded whitespace) from
- confusing this code. It also makes this code more robust in
- respect to annotations the kernel may add after the filename.
-
- Note the filename is used for informational purposes
- only. */
- ret += fscanf (mapfile, "%[^\n]\n", filename);
- }
- else
- {
- filename[0] = '\0'; /* no filename */
- fscanf (mapfile, "\n");
- }
- return (ret != 0 && ret != EOF);
-}
-
-/* Fills the "to_find_memory_regions" target vector. Lists the memory
- regions in the inferior for a corefile. */
-
-static int
-linux_nat_find_memory_regions (int (*func) (CORE_ADDR,
- unsigned long,
- int, int, int, void *), void *obfd)
-{
- long long pid = PIDGET (inferior_ptid);
- char mapsfilename[MAXPATHLEN];
- FILE *mapsfile;
- long long addr, endaddr, size, offset, inode;
- char permissions[8], device[8], filename[MAXPATHLEN];
- int read, write, exec;
- int ret;
-
- /* Compose the filename for the /proc memory map, and open it. */
- sprintf (mapsfilename, "/proc/%lld/maps", pid);
- if ((mapsfile = fopen (mapsfilename, "r")) == NULL)
- error ("Could not open %s\n", mapsfilename);
-
- if (info_verbose)
- fprintf_filtered (gdb_stdout,
- "Reading memory regions from %s\n", mapsfilename);
-
- /* Now iterate until end-of-file. */
- while (read_mapping (mapsfile, &addr, &endaddr, &permissions[0],
- &offset, &device[0], &inode, &filename[0]))
- {
- size = endaddr - addr;
-
- /* Get the segment's permissions. */
- read = (strchr (permissions, 'r') != 0);
- write = (strchr (permissions, 'w') != 0);
- exec = (strchr (permissions, 'x') != 0);
-
- if (info_verbose)
- {
- fprintf_filtered (gdb_stdout,
- "Save segment, %lld bytes at 0x%s (%c%c%c)",
- size, paddr_nz (addr),
- read ? 'r' : ' ',
- write ? 'w' : ' ', exec ? 'x' : ' ');
- if (filename && filename[0])
- fprintf_filtered (gdb_stdout, " for %s", filename);
- fprintf_filtered (gdb_stdout, "\n");
- }
-
- /* Invoke the callback function to create the corefile
- segment. */
- func (addr, size, read, write, exec, obfd);
- }
- fclose (mapsfile);
- return 0;
-}
-
-/* Records the thread's register state for the corefile note
- section. */
-
-static char *
-linux_nat_do_thread_registers (bfd *obfd, ptid_t ptid,
- char *note_data, int *note_size)
-{
- gdb_gregset_t gregs;
- gdb_fpregset_t fpregs;
-#ifdef FILL_FPXREGSET
- gdb_fpxregset_t fpxregs;
-#endif
- unsigned long lwp = ptid_get_lwp (ptid);
-
- fill_gregset (&gregs, -1);
- note_data = (char *) elfcore_write_prstatus (obfd,
- note_data,
- note_size,
- lwp,
- stop_signal, &gregs);
-
- fill_fpregset (&fpregs, -1);
- note_data = (char *) elfcore_write_prfpreg (obfd,
- note_data,
- note_size,
- &fpregs, sizeof (fpregs));
-#ifdef FILL_FPXREGSET
- fill_fpxregset (&fpxregs, -1);
- note_data = (char *) elfcore_write_prxfpreg (obfd,
- note_data,
- note_size,
- &fpxregs, sizeof (fpxregs));
-#endif
- return note_data;
-}
-
-struct linux_nat_corefile_thread_data
-{
- bfd *obfd;
- char *note_data;
- int *note_size;
- int num_notes;
-};
-
-/* Called by gdbthread.c once per thread. Records the thread's
- register state for the corefile note section. */
-
-static int
-linux_nat_corefile_thread_callback (struct lwp_info *ti, void *data)
-{
- struct linux_nat_corefile_thread_data *args = data;
- ptid_t saved_ptid = inferior_ptid;
-
- inferior_ptid = ti->ptid;
- registers_changed ();
- target_fetch_registers (-1); /* FIXME should not be necessary;
- fill_gregset should do it automatically. */
- args->note_data = linux_nat_do_thread_registers (args->obfd,
- ti->ptid,
- args->note_data,
- args->note_size);
- args->num_notes++;
- inferior_ptid = saved_ptid;
- registers_changed ();
- target_fetch_registers (-1); /* FIXME should not be necessary;
- fill_gregset should do it automatically. */
- return 0;
-}
-
-/* Records the register state for the corefile note section. */
-
-static char *
-linux_nat_do_registers (bfd *obfd, ptid_t ptid,
- char *note_data, int *note_size)
-{
- registers_changed ();
- target_fetch_registers (-1); /* FIXME should not be necessary;
- fill_gregset should do it automatically. */
- return linux_nat_do_thread_registers (obfd,
- ptid_build (ptid_get_pid (inferior_ptid),
- ptid_get_pid (inferior_ptid),
- 0),
- note_data, note_size);
- return note_data;
-}
-
-/* Fills the "to_make_corefile_note" target vector. Builds the note
- section for a corefile, and returns it in a malloc buffer. */
-
-static char *
-linux_nat_make_corefile_notes (bfd *obfd, int *note_size)
-{
- struct linux_nat_corefile_thread_data thread_args;
- struct cleanup *old_chain;
- char fname[16] = { '\0' };
- char psargs[80] = { '\0' };
- char *note_data = NULL;
- ptid_t current_ptid = inferior_ptid;
- char *auxv;
- int auxv_len;
-
- if (get_exec_file (0))
- {
- strncpy (fname, strrchr (get_exec_file (0), '/') + 1, sizeof (fname));
- strncpy (psargs, get_exec_file (0), sizeof (psargs));
- if (get_inferior_args ())
- {
- strncat (psargs, " ", sizeof (psargs) - strlen (psargs));
- strncat (psargs, get_inferior_args (),
- sizeof (psargs) - strlen (psargs));
- }
- note_data = (char *) elfcore_write_prpsinfo (obfd,
- note_data,
- note_size, fname, psargs);
- }
-
- /* Dump information for threads. */
- thread_args.obfd = obfd;
- thread_args.note_data = note_data;
- thread_args.note_size = note_size;
- thread_args.num_notes = 0;
- iterate_over_lwps (linux_nat_corefile_thread_callback, &thread_args);
- if (thread_args.num_notes == 0)
- {
- /* iterate_over_threads didn't come up with any threads; just
- use inferior_ptid. */
- note_data = linux_nat_do_registers (obfd, inferior_ptid,
- note_data, note_size);
- }
- else
- {
- note_data = thread_args.note_data;
- }
-
- auxv_len = target_auxv_read (&current_target, &auxv);
- if (auxv_len > 0)
- {
- note_data = elfcore_write_note (obfd, note_data, note_size,
- "CORE", NT_AUXV, auxv, auxv_len);
- xfree (auxv);
- }
-
- make_cleanup (xfree, note_data);
- return note_data;
-}
-
-/* Implement the "info proc" command. */
-
-static void
-linux_nat_info_proc_cmd (char *args, int from_tty)
-{
- long long pid = PIDGET (inferior_ptid);
- FILE *procfile;
- char **argv = NULL;
- char buffer[MAXPATHLEN];
- char fname1[MAXPATHLEN], fname2[MAXPATHLEN];
- int cmdline_f = 1;
- int cwd_f = 1;
- int exe_f = 1;
- int mappings_f = 0;
- int environ_f = 0;
- int status_f = 0;
- int stat_f = 0;
- int all = 0;
- struct stat dummy;
-
- if (args)
- {
- /* Break up 'args' into an argv array. */
- if ((argv = buildargv (args)) == NULL)
- nomem (0);
- else
- make_cleanup_freeargv (argv);
- }
- while (argv != NULL && *argv != NULL)
- {
- if (isdigit (argv[0][0]))
- {
- pid = strtoul (argv[0], NULL, 10);
- }
- else if (strncmp (argv[0], "mappings", strlen (argv[0])) == 0)
- {
- mappings_f = 1;
- }
- else if (strcmp (argv[0], "status") == 0)
- {
- status_f = 1;
- }
- else if (strcmp (argv[0], "stat") == 0)
- {
- stat_f = 1;
- }
- else if (strcmp (argv[0], "cmd") == 0)
- {
- cmdline_f = 1;
- }
- else if (strncmp (argv[0], "exe", strlen (argv[0])) == 0)
- {
- exe_f = 1;
- }
- else if (strcmp (argv[0], "cwd") == 0)
- {
- cwd_f = 1;
- }
- else if (strncmp (argv[0], "all", strlen (argv[0])) == 0)
- {
- all = 1;
- }
- else
- {
- /* [...] (future options here) */
- }
- argv++;
- }
- if (pid == 0)
- error ("No current process: you must name one.");
-
- sprintf (fname1, "/proc/%lld", pid);
- if (stat (fname1, &dummy) != 0)
- error ("No /proc directory: '%s'", fname1);
-
- printf_filtered ("process %lld\n", pid);
- if (cmdline_f || all)
- {
- sprintf (fname1, "/proc/%lld/cmdline", pid);
- if ((procfile = fopen (fname1, "r")) > 0)
- {
- fgets (buffer, sizeof (buffer), procfile);
- printf_filtered ("cmdline = '%s'\n", buffer);
- fclose (procfile);
- }
- else
- warning ("unable to open /proc file '%s'", fname1);
- }
- if (cwd_f || all)
- {
- sprintf (fname1, "/proc/%lld/cwd", pid);
- memset (fname2, 0, sizeof (fname2));
- if (readlink (fname1, fname2, sizeof (fname2)) > 0)
- printf_filtered ("cwd = '%s'\n", fname2);
- else
- warning ("unable to read link '%s'", fname1);
- }
- if (exe_f || all)
- {
- sprintf (fname1, "/proc/%lld/exe", pid);
- memset (fname2, 0, sizeof (fname2));
- if (readlink (fname1, fname2, sizeof (fname2)) > 0)
- printf_filtered ("exe = '%s'\n", fname2);
- else
- warning ("unable to read link '%s'", fname1);
- }
- if (mappings_f || all)
- {
- sprintf (fname1, "/proc/%lld/maps", pid);
- if ((procfile = fopen (fname1, "r")) > 0)
- {
- long long addr, endaddr, size, offset, inode;
- char permissions[8], device[8], filename[MAXPATHLEN];
-
- printf_filtered ("Mapped address spaces:\n\n");
- if (TARGET_ADDR_BIT == 32)
- {
- printf_filtered ("\t%10s %10s %10s %10s %7s\n",
- "Start Addr",
- " End Addr",
- " Size", " Offset", "objfile");
- }
- else
- {
- printf_filtered (" %18s %18s %10s %10s %7s\n",
- "Start Addr",
- " End Addr",
- " Size", " Offset", "objfile");
- }
-
- while (read_mapping (procfile, &addr, &endaddr, &permissions[0],
- &offset, &device[0], &inode, &filename[0]))
- {
- size = endaddr - addr;
-
- /* FIXME: carlton/2003-08-27: Maybe the printf_filtered
- calls here (and possibly above) should be abstracted
- out into their own functions? Andrew suggests using
- a generic local_address_string instead to print out
- the addresses; that makes sense to me, too. */
-
- if (TARGET_ADDR_BIT == 32)
- {
- printf_filtered ("\t%#10lx %#10lx %#10x %#10x %7s\n",
- (unsigned long) addr, /* FIXME: pr_addr */
- (unsigned long) endaddr,
- (int) size,
- (unsigned int) offset,
- filename[0] ? filename : "");
- }
- else
- {
- printf_filtered (" %#18lx %#18lx %#10x %#10x %7s\n",
- (unsigned long) addr, /* FIXME: pr_addr */
- (unsigned long) endaddr,
- (int) size,
- (unsigned int) offset,
- filename[0] ? filename : "");
- }
- }
-
- fclose (procfile);
- }
- else
- warning ("unable to open /proc file '%s'", fname1);
- }
- if (status_f || all)
- {
- sprintf (fname1, "/proc/%lld/status", pid);
- if ((procfile = fopen (fname1, "r")) > 0)
- {
- while (fgets (buffer, sizeof (buffer), procfile) != NULL)
- puts_filtered (buffer);
- fclose (procfile);
- }
- else
- warning ("unable to open /proc file '%s'", fname1);
- }
- if (stat_f || all)
- {
- sprintf (fname1, "/proc/%lld/stat", pid);
- if ((procfile = fopen (fname1, "r")) > 0)
- {
- int itmp;
- char ctmp;
-
- if (fscanf (procfile, "%d ", &itmp) > 0)
- printf_filtered ("Process: %d\n", itmp);
- if (fscanf (procfile, "%s ", &buffer[0]) > 0)
- printf_filtered ("Exec file: %s\n", buffer);
- if (fscanf (procfile, "%c ", &ctmp) > 0)
- printf_filtered ("State: %c\n", ctmp);
- if (fscanf (procfile, "%d ", &itmp) > 0)
- printf_filtered ("Parent process: %d\n", itmp);
- if (fscanf (procfile, "%d ", &itmp) > 0)
- printf_filtered ("Process group: %d\n", itmp);
- if (fscanf (procfile, "%d ", &itmp) > 0)
- printf_filtered ("Session id: %d\n", itmp);
- if (fscanf (procfile, "%d ", &itmp) > 0)
- printf_filtered ("TTY: %d\n", itmp);
- if (fscanf (procfile, "%d ", &itmp) > 0)
- printf_filtered ("TTY owner process group: %d\n", itmp);
- if (fscanf (procfile, "%u ", &itmp) > 0)
- printf_filtered ("Flags: 0x%x\n", itmp);
- if (fscanf (procfile, "%u ", &itmp) > 0)
- printf_filtered ("Minor faults (no memory page): %u\n",
- (unsigned int) itmp);
- if (fscanf (procfile, "%u ", &itmp) > 0)
- printf_filtered ("Minor faults, children: %u\n",
- (unsigned int) itmp);
- if (fscanf (procfile, "%u ", &itmp) > 0)
- printf_filtered ("Major faults (memory page faults): %u\n",
- (unsigned int) itmp);
- if (fscanf (procfile, "%u ", &itmp) > 0)
- printf_filtered ("Major faults, children: %u\n",
- (unsigned int) itmp);
- if (fscanf (procfile, "%d ", &itmp) > 0)
- printf_filtered ("utime: %d\n", itmp);
- if (fscanf (procfile, "%d ", &itmp) > 0)
- printf_filtered ("stime: %d\n", itmp);
- if (fscanf (procfile, "%d ", &itmp) > 0)
- printf_filtered ("utime, children: %d\n", itmp);
- if (fscanf (procfile, "%d ", &itmp) > 0)
- printf_filtered ("stime, children: %d\n", itmp);
- if (fscanf (procfile, "%d ", &itmp) > 0)
- printf_filtered ("jiffies remaining in current time slice: %d\n",
- itmp);
- if (fscanf (procfile, "%d ", &itmp) > 0)
- printf_filtered ("'nice' value: %d\n", itmp);
- if (fscanf (procfile, "%u ", &itmp) > 0)
- printf_filtered ("jiffies until next timeout: %u\n",
- (unsigned int) itmp);
- if (fscanf (procfile, "%u ", &itmp) > 0)
- printf_filtered ("jiffies until next SIGALRM: %u\n",
- (unsigned int) itmp);
- if (fscanf (procfile, "%d ", &itmp) > 0)
- printf_filtered ("start time (jiffies since system boot): %d\n",
- itmp);
- if (fscanf (procfile, "%u ", &itmp) > 0)
- printf_filtered ("Virtual memory size: %u\n",
- (unsigned int) itmp);
- if (fscanf (procfile, "%u ", &itmp) > 0)
- printf_filtered ("Resident set size: %u\n", (unsigned int) itmp);
- if (fscanf (procfile, "%u ", &itmp) > 0)
- printf_filtered ("rlim: %u\n", (unsigned int) itmp);
- if (fscanf (procfile, "%u ", &itmp) > 0)
- printf_filtered ("Start of text: 0x%x\n", itmp);
- if (fscanf (procfile, "%u ", &itmp) > 0)
- printf_filtered ("End of text: 0x%x\n", itmp);
- if (fscanf (procfile, "%u ", &itmp) > 0)
- printf_filtered ("Start of stack: 0x%x\n", itmp);
-#if 0 /* Don't know how architecture-dependent the rest is...
- Anyway the signal bitmap info is available from "status". */
- if (fscanf (procfile, "%u ", &itmp) > 0) /* FIXME arch? */
- printf_filtered ("Kernel stack pointer: 0x%x\n", itmp);
- if (fscanf (procfile, "%u ", &itmp) > 0) /* FIXME arch? */
- printf_filtered ("Kernel instr pointer: 0x%x\n", itmp);
- if (fscanf (procfile, "%d ", &itmp) > 0)
- printf_filtered ("Pending signals bitmap: 0x%x\n", itmp);
- if (fscanf (procfile, "%d ", &itmp) > 0)
- printf_filtered ("Blocked signals bitmap: 0x%x\n", itmp);
- if (fscanf (procfile, "%d ", &itmp) > 0)
- printf_filtered ("Ignored signals bitmap: 0x%x\n", itmp);
- if (fscanf (procfile, "%d ", &itmp) > 0)
- printf_filtered ("Catched signals bitmap: 0x%x\n", itmp);
- if (fscanf (procfile, "%u ", &itmp) > 0) /* FIXME arch? */
- printf_filtered ("wchan (system call): 0x%x\n", itmp);
-#endif
- fclose (procfile);
- }
- else
- warning ("unable to open /proc file '%s'", fname1);
- }
-}
-
-int
-linux_proc_xfer_memory (CORE_ADDR addr, char *myaddr, int len, int write,
- struct mem_attrib *attrib, struct target_ops *target)
-{
- int fd, ret;
- char filename[64];
-
- if (write)
- return 0;
-
- /* Don't bother for one word. */
- if (len < 3 * sizeof (long))
- return 0;
-
- /* We could keep this file open and cache it - possibly one per
- thread. That requires some juggling, but is even faster. */
- sprintf (filename, "/proc/%d/mem", PIDGET (inferior_ptid));
- fd = open (filename, O_RDONLY | O_LARGEFILE);
- if (fd == -1)
- return 0;
-
- /* If pread64 is available, use it. It's faster if the kernel
- supports it (only one syscall), and it's 64-bit safe even on
- 32-bit platforms (for instance, SPARC debugging a SPARC64
- application). */
-#ifdef HAVE_PREAD64
- if (pread64 (fd, myaddr, len, addr) != len)
-#else
- if (lseek (fd, addr, SEEK_SET) == -1 || read (fd, myaddr, len) != len)
-#endif
- ret = 0;
- else
- ret = len;
-
- close (fd);
- return ret;
-}
-
-/* Parse LINE as a signal set and add its set bits to SIGS. */
-
-static void
-add_line_to_sigset (const char *line, sigset_t *sigs)
-{
- int len = strlen (line) - 1;
- const char *p;
- int signum;
-
- if (line[len] != '\n')
- error ("Could not parse signal set: %s", line);
-
- p = line;
- signum = len * 4;
- while (len-- > 0)
- {
- int digit;
-
- if (*p >= '0' && *p <= '9')
- digit = *p - '0';
- else if (*p >= 'a' && *p <= 'f')
- digit = *p - 'a' + 10;
- else
- error ("Could not parse signal set: %s", line);
-
- signum -= 4;
-
- if (digit & 1)
- sigaddset (sigs, signum + 1);
- if (digit & 2)
- sigaddset (sigs, signum + 2);
- if (digit & 4)
- sigaddset (sigs, signum + 3);
- if (digit & 8)
- sigaddset (sigs, signum + 4);
-
- p++;
- }
-}
-
-/* Find process PID's pending signals from /proc/pid/status and set
- SIGS to match. */
-
-void
-linux_proc_pending_signals (int pid, sigset_t *pending, sigset_t *blocked, sigset_t *ignored)
-{
- FILE *procfile;
- char buffer[MAXPATHLEN], fname[MAXPATHLEN];
- int signum;
-
- sigemptyset (pending);
- sigemptyset (blocked);
- sigemptyset (ignored);
- sprintf (fname, "/proc/%d/status", pid);
- procfile = fopen (fname, "r");
- if (procfile == NULL)
- error ("Could not open %s", fname);
-
- while (fgets (buffer, MAXPATHLEN, procfile) != NULL)
- {
- /* Normal queued signals are on the SigPnd line in the status
- file. However, 2.6 kernels also have a "shared" pending
- queue for delivering signals to a thread group, so check for
- a ShdPnd line also.
-
- Unfortunately some Red Hat kernels include the shared pending
- queue but not the ShdPnd status field. */
-
- if (strncmp (buffer, "SigPnd:\t", 8) == 0)
- add_line_to_sigset (buffer + 8, pending);
- else if (strncmp (buffer, "ShdPnd:\t", 8) == 0)
- add_line_to_sigset (buffer + 8, pending);
- else if (strncmp (buffer, "SigBlk:\t", 8) == 0)
- add_line_to_sigset (buffer + 8, blocked);
- else if (strncmp (buffer, "SigIgn:\t", 8) == 0)
- add_line_to_sigset (buffer + 8, ignored);
- }
-
- fclose (procfile);
-}
-
-void
-_initialize_linux_nat (void)
-{
- struct sigaction action;
- extern void thread_db_init (struct target_ops *);
-
- deprecated_child_ops.to_find_memory_regions = linux_nat_find_memory_regions;
- deprecated_child_ops.to_make_corefile_notes = linux_nat_make_corefile_notes;
-
- add_info ("proc", linux_nat_info_proc_cmd,
- "Show /proc process information about any running process.\n\
-Specify any process id, or use the program being debugged by default.\n\
-Specify any of the following keywords for detailed info:\n\
- mappings -- list of mapped memory regions.\n\
- stat -- list a bunch of random process info.\n\
- status -- list a different bunch of random process info.\n\
- all -- list all available /proc info.");
-
- init_linux_nat_ops ();
- add_target (&linux_nat_ops);
- thread_db_init (&linux_nat_ops);
-
- /* Save the original signal mask. */
- sigprocmask (SIG_SETMASK, NULL, &normal_mask);
-
- action.sa_handler = sigchld_handler;
- sigemptyset (&action.sa_mask);
- action.sa_flags = 0;
- sigaction (SIGCHLD, &action, NULL);
-
- /* Make sure we don't block SIGCHLD during a sigsuspend. */
- sigprocmask (SIG_SETMASK, NULL, &suspend_mask);
- sigdelset (&suspend_mask, SIGCHLD);
-
- sigemptyset (&blocked_mask);
-
- deprecated_add_show_from_set
- (add_set_cmd ("lin-lwp", no_class, var_zinteger,
- (char *) &debug_linux_nat,
- "Set debugging of GNU/Linux lwp module.\n\
-Enables printf debugging output.\n", &setdebuglist), &showdebuglist);
-}
-
-
-/* FIXME: kettenis/2000-08-26: The stuff on this page is specific to
- the GNU/Linux Threads library and therefore doesn't really belong
- here. */
-
-/* Read variable NAME in the target and return its value if found.
- Otherwise return zero. It is assumed that the type of the variable
- is `int'. */
-
-static int
-get_signo (const char *name)
-{
- struct minimal_symbol *ms;
- int signo;
-
- ms = lookup_minimal_symbol (name, NULL, NULL);
- if (ms == NULL)
- return 0;
-
- if (target_read_memory (SYMBOL_VALUE_ADDRESS (ms), (char *) &signo,
- sizeof (signo)) != 0)
- return 0;
-
- return signo;
-}
-
-/* Return the set of signals used by the threads library in *SET. */
-
-void
-lin_thread_get_thread_signals (sigset_t *set)
-{
- struct sigaction action;
- int restart, cancel;
-
- sigemptyset (set);
-
- restart = get_signo ("__pthread_sig_restart");
- if (restart == 0)
- return;
-
- cancel = get_signo ("__pthread_sig_cancel");
- if (cancel == 0)
- return;
-
- sigaddset (set, restart);
- sigaddset (set, cancel);
-
- /* The GNU/Linux Threads library makes terminating threads send a
- special "cancel" signal instead of SIGCHLD. Make sure we catch
- those (to prevent them from terminating GDB itself, which is
- likely to be their default action) and treat them the same way as
- SIGCHLD. */
-
- action.sa_handler = sigchld_handler;
- sigemptyset (&action.sa_mask);
- action.sa_flags = 0;
- sigaction (cancel, &action, NULL);
-
- /* We block the "cancel" signal throughout this code ... */
- sigaddset (&blocked_mask, cancel);
- sigprocmask (SIG_BLOCK, &blocked_mask, NULL);
-
- /* ... except during a sigsuspend. */
- sigdelset (&suspend_mask, cancel);
-}
diff --git a/gdb/linux-proc.c b/gdb/linux-proc.c
new file mode 100644
index 0000000..0a77459
--- /dev/null
+++ b/gdb/linux-proc.c
@@ -0,0 +1,737 @@
+/* GNU/Linux specific methods for using the /proc file system.
+
+ Copyright 2001, 2002 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include "defs.h"
+#include "inferior.h"
+#include <sys/param.h> /* for MAXPATHLEN */
+#include <sys/procfs.h> /* for elf_gregset etc. */
+#include "gdb_stat.h" /* for struct stat */
+#include <ctype.h> /* for isdigit */
+#include <unistd.h> /* for open, pread64 */
+#include <fcntl.h> /* for O_RDONLY */
+#include "regcache.h" /* for registers_changed */
+#include "gregset.h" /* for gregset */
+#include "gdbcore.h" /* for get_exec_file */
+#include "gdbthread.h" /* for struct thread_info etc. */
+#include "elf-bfd.h" /* for elfcore_write_* */
+#include "cli/cli-decode.h" /* for add_info */
+#include "gdb_string.h"
+
+#include <signal.h>
+
+#include "linux-nat.h"
+
+#ifndef O_LARGEFILE
+#define O_LARGEFILE 0
+#endif
+
+/* Function: child_pid_to_exec_file
+ *
+ * Accepts an integer pid
+ * Returns a string representing a file that can be opened
+ * to get the symbols for the child process.
+ */
+
+char *
+child_pid_to_exec_file (int pid)
+{
+ char *name1, *name2;
+
+ name1 = xmalloc (MAXPATHLEN);
+ name2 = xmalloc (MAXPATHLEN);
+ make_cleanup (xfree, name1);
+ make_cleanup (xfree, name2);
+ memset (name2, 0, MAXPATHLEN);
+
+ sprintf (name1, "/proc/%d/exe", pid);
+ if (readlink (name1, name2, MAXPATHLEN) > 0)
+ return name2;
+ else
+ return name1;
+}
+
+/* Function: read_mappings
+ *
+ * Service function for corefiles and info proc.
+ */
+
+static int
+read_mapping (FILE *mapfile,
+ long long *addr,
+ long long *endaddr,
+ char *permissions,
+ long long *offset,
+ char *device, long long *inode, char *filename)
+{
+ int ret = fscanf (mapfile, "%llx-%llx %s %llx %s %llx",
+ addr, endaddr, permissions, offset, device, inode);
+
+ if (ret > 0 && ret != EOF && *inode != 0)
+ {
+ /* Eat everything up to EOL for the filename. This will prevent
+ weird filenames (such as one with embedded whitespace) from
+ confusing this code. It also makes this code more robust
+ in respect to annotations the kernel may add after the
+ filename.
+
+ Note the filename is used for informational purposes only. */
+ ret += fscanf (mapfile, "%[^\n]\n", filename);
+ }
+ else
+ {
+ filename[0] = '\0'; /* no filename */
+ fscanf (mapfile, "\n");
+ }
+ return (ret != 0 && ret != EOF);
+}
+
+/* Function: linux_find_memory_regions
+ *
+ * Fills the "to_find_memory_regions" target vector.
+ * Lists the memory regions in the inferior for a corefile.
+ */
+
+static int
+linux_find_memory_regions (int (*func) (CORE_ADDR,
+ unsigned long,
+ int, int, int, void *), void *obfd)
+{
+ long long pid = PIDGET (inferior_ptid);
+ char mapsfilename[MAXPATHLEN];
+ FILE *mapsfile;
+ long long addr, endaddr, size, offset, inode;
+ char permissions[8], device[8], filename[MAXPATHLEN];
+ int read, write, exec;
+ int ret;
+
+ /* Compose the filename for the /proc memory map, and open it. */
+ sprintf (mapsfilename, "/proc/%lld/maps", pid);
+ if ((mapsfile = fopen (mapsfilename, "r")) == NULL)
+ error ("Could not open %s\n", mapsfilename);
+
+ if (info_verbose)
+ fprintf_filtered (gdb_stdout,
+ "Reading memory regions from %s\n", mapsfilename);
+
+ /* Now iterate until end-of-file. */
+ while (read_mapping (mapsfile, &addr, &endaddr, &permissions[0],
+ &offset, &device[0], &inode, &filename[0]))
+ {
+ size = endaddr - addr;
+
+ /* Get the segment's permissions. */
+ read = (strchr (permissions, 'r') != 0);
+ write = (strchr (permissions, 'w') != 0);
+ exec = (strchr (permissions, 'x') != 0);
+
+ if (info_verbose)
+ {
+ fprintf_filtered (gdb_stdout,
+ "Save segment, %lld bytes at 0x%s (%c%c%c)",
+ size, paddr_nz (addr),
+ read ? 'r' : ' ',
+ write ? 'w' : ' ', exec ? 'x' : ' ');
+ if (filename && filename[0])
+ fprintf_filtered (gdb_stdout, " for %s", filename);
+ fprintf_filtered (gdb_stdout, "\n");
+ }
+
+ /* Invoke the callback function to create the corefile segment. */
+ func (addr, size, read, write, exec, obfd);
+ }
+ fclose (mapsfile);
+ return 0;
+}
+
+/* Function: linux_do_thread_registers
+ *
+ * Records the thread's register state for the corefile note section.
+ */
+
+static char *
+linux_do_thread_registers (bfd *obfd, ptid_t ptid,
+ char *note_data, int *note_size)
+{
+ gdb_gregset_t gregs;
+ gdb_fpregset_t fpregs;
+#ifdef FILL_FPXREGSET
+ gdb_fpxregset_t fpxregs;
+#endif
+ unsigned long lwp = ptid_get_lwp (ptid);
+
+ fill_gregset (&gregs, -1);
+ note_data = (char *) elfcore_write_prstatus (obfd,
+ note_data,
+ note_size,
+ lwp,
+ stop_signal, &gregs);
+
+ fill_fpregset (&fpregs, -1);
+ note_data = (char *) elfcore_write_prfpreg (obfd,
+ note_data,
+ note_size,
+ &fpregs, sizeof (fpregs));
+#ifdef FILL_FPXREGSET
+ fill_fpxregset (&fpxregs, -1);
+ note_data = (char *) elfcore_write_prxfpreg (obfd,
+ note_data,
+ note_size,
+ &fpxregs, sizeof (fpxregs));
+#endif
+ return note_data;
+}
+
+struct linux_corefile_thread_data
+{
+ bfd *obfd;
+ char *note_data;
+ int *note_size;
+ int num_notes;
+};
+
+/* Function: linux_corefile_thread_callback
+ *
+ * Called by gdbthread.c once per thread.
+ * Records the thread's register state for the corefile note section.
+ */
+
+static int
+linux_corefile_thread_callback (struct lwp_info *ti, void *data)
+{
+ struct linux_corefile_thread_data *args = data;
+ ptid_t saved_ptid = inferior_ptid;
+
+ inferior_ptid = ti->ptid;
+ registers_changed ();
+ target_fetch_registers (-1); /* FIXME should not be necessary;
+ fill_gregset should do it automatically. */
+ args->note_data = linux_do_thread_registers (args->obfd,
+ ti->ptid,
+ args->note_data,
+ args->note_size);
+ args->num_notes++;
+ inferior_ptid = saved_ptid;
+ registers_changed ();
+ target_fetch_registers (-1); /* FIXME should not be necessary;
+ fill_gregset should do it automatically. */
+ return 0;
+}
+
+/* Function: linux_do_registers
+ *
+ * Records the register state for the corefile note section.
+ */
+
+static char *
+linux_do_registers (bfd *obfd, ptid_t ptid,
+ char *note_data, int *note_size)
+{
+ registers_changed ();
+ target_fetch_registers (-1); /* FIXME should not be necessary;
+ fill_gregset should do it automatically. */
+ return linux_do_thread_registers (obfd,
+ ptid_build (ptid_get_pid (inferior_ptid),
+ ptid_get_pid (inferior_ptid),
+ 0),
+ note_data, note_size);
+ return note_data;
+}
+
+/* Function: linux_make_note_section
+ *
+ * Fills the "to_make_corefile_note" target vector.
+ * Builds the note section for a corefile, and returns it
+ * in a malloc buffer.
+ */
+
+static char *
+linux_make_note_section (bfd *obfd, int *note_size)
+{
+ struct linux_corefile_thread_data thread_args;
+ struct cleanup *old_chain;
+ char fname[16] = { '\0' };
+ char psargs[80] = { '\0' };
+ char *note_data = NULL;
+ ptid_t current_ptid = inferior_ptid;
+ char *auxv;
+ int auxv_len;
+
+ if (get_exec_file (0))
+ {
+ strncpy (fname, strrchr (get_exec_file (0), '/') + 1, sizeof (fname));
+ strncpy (psargs, get_exec_file (0), sizeof (psargs));
+ if (get_inferior_args ())
+ {
+ strncat (psargs, " ", sizeof (psargs) - strlen (psargs));
+ strncat (psargs, get_inferior_args (),
+ sizeof (psargs) - strlen (psargs));
+ }
+ note_data = (char *) elfcore_write_prpsinfo (obfd,
+ note_data,
+ note_size, fname, psargs);
+ }
+
+ /* Dump information for threads. */
+ thread_args.obfd = obfd;
+ thread_args.note_data = note_data;
+ thread_args.note_size = note_size;
+ thread_args.num_notes = 0;
+ iterate_over_lwps (linux_corefile_thread_callback, &thread_args);
+ if (thread_args.num_notes == 0)
+ {
+ /* iterate_over_threads didn't come up with any threads;
+ just use inferior_ptid. */
+ note_data = linux_do_registers (obfd, inferior_ptid,
+ note_data, note_size);
+ }
+ else
+ {
+ note_data = thread_args.note_data;
+ }
+
+ auxv_len = target_auxv_read (&current_target, &auxv);
+ if (auxv_len > 0)
+ {
+ note_data = elfcore_write_note (obfd, note_data, note_size,
+ "CORE", NT_AUXV, auxv, auxv_len);
+ xfree (auxv);
+ }
+
+ make_cleanup (xfree, note_data);
+ return note_data;
+}
+
+/*
+ * Function: linux_info_proc_cmd
+ *
+ * Implement the "info proc" command.
+ */
+
+static void
+linux_info_proc_cmd (char *args, int from_tty)
+{
+ long long pid = PIDGET (inferior_ptid);
+ FILE *procfile;
+ char **argv = NULL;
+ char buffer[MAXPATHLEN];
+ char fname1[MAXPATHLEN], fname2[MAXPATHLEN];
+ int cmdline_f = 1;
+ int cwd_f = 1;
+ int exe_f = 1;
+ int mappings_f = 0;
+ int environ_f = 0;
+ int status_f = 0;
+ int stat_f = 0;
+ int all = 0;
+ struct stat dummy;
+
+ if (args)
+ {
+ /* Break up 'args' into an argv array. */
+ if ((argv = buildargv (args)) == NULL)
+ nomem (0);
+ else
+ make_cleanup_freeargv (argv);
+ }
+ while (argv != NULL && *argv != NULL)
+ {
+ if (isdigit (argv[0][0]))
+ {
+ pid = strtoul (argv[0], NULL, 10);
+ }
+ else if (strncmp (argv[0], "mappings", strlen (argv[0])) == 0)
+ {
+ mappings_f = 1;
+ }
+ else if (strcmp (argv[0], "status") == 0)
+ {
+ status_f = 1;
+ }
+ else if (strcmp (argv[0], "stat") == 0)
+ {
+ stat_f = 1;
+ }
+ else if (strcmp (argv[0], "cmd") == 0)
+ {
+ cmdline_f = 1;
+ }
+ else if (strncmp (argv[0], "exe", strlen (argv[0])) == 0)
+ {
+ exe_f = 1;
+ }
+ else if (strcmp (argv[0], "cwd") == 0)
+ {
+ cwd_f = 1;
+ }
+ else if (strncmp (argv[0], "all", strlen (argv[0])) == 0)
+ {
+ all = 1;
+ }
+ else
+ {
+ /* [...] (future options here) */
+ }
+ argv++;
+ }
+ if (pid == 0)
+ error ("No current process: you must name one.");
+
+ sprintf (fname1, "/proc/%lld", pid);
+ if (stat (fname1, &dummy) != 0)
+ error ("No /proc directory: '%s'", fname1);
+
+ printf_filtered ("process %lld\n", pid);
+ if (cmdline_f || all)
+ {
+ sprintf (fname1, "/proc/%lld/cmdline", pid);
+ if ((procfile = fopen (fname1, "r")) > 0)
+ {
+ fgets (buffer, sizeof (buffer), procfile);
+ printf_filtered ("cmdline = '%s'\n", buffer);
+ fclose (procfile);
+ }
+ else
+ warning ("unable to open /proc file '%s'", fname1);
+ }
+ if (cwd_f || all)
+ {
+ sprintf (fname1, "/proc/%lld/cwd", pid);
+ memset (fname2, 0, sizeof (fname2));
+ if (readlink (fname1, fname2, sizeof (fname2)) > 0)
+ printf_filtered ("cwd = '%s'\n", fname2);
+ else
+ warning ("unable to read link '%s'", fname1);
+ }
+ if (exe_f || all)
+ {
+ sprintf (fname1, "/proc/%lld/exe", pid);
+ memset (fname2, 0, sizeof (fname2));
+ if (readlink (fname1, fname2, sizeof (fname2)) > 0)
+ printf_filtered ("exe = '%s'\n", fname2);
+ else
+ warning ("unable to read link '%s'", fname1);
+ }
+ if (mappings_f || all)
+ {
+ sprintf (fname1, "/proc/%lld/maps", pid);
+ if ((procfile = fopen (fname1, "r")) > 0)
+ {
+ long long addr, endaddr, size, offset, inode;
+ char permissions[8], device[8], filename[MAXPATHLEN];
+
+ printf_filtered ("Mapped address spaces:\n\n");
+ if (TARGET_ADDR_BIT == 32)
+ {
+ printf_filtered ("\t%10s %10s %10s %10s %7s\n",
+ "Start Addr",
+ " End Addr",
+ " Size", " Offset", "objfile");
+ }
+ else
+ {
+ printf_filtered (" %18s %18s %10s %10s %7s\n",
+ "Start Addr",
+ " End Addr",
+ " Size", " Offset", "objfile");
+ }
+
+ while (read_mapping (procfile, &addr, &endaddr, &permissions[0],
+ &offset, &device[0], &inode, &filename[0]))
+ {
+ size = endaddr - addr;
+
+ /* FIXME: carlton/2003-08-27: Maybe the printf_filtered
+ calls here (and possibly above) should be abstracted
+ out into their own functions? Andrew suggests using
+ a generic local_address_string instead to print out
+ the addresses; that makes sense to me, too. */
+
+ if (TARGET_ADDR_BIT == 32)
+ {
+ printf_filtered ("\t%#10lx %#10lx %#10x %#10x %7s\n",
+ (unsigned long) addr, /* FIXME: pr_addr */
+ (unsigned long) endaddr,
+ (int) size,
+ (unsigned int) offset,
+ filename[0] ? filename : "");
+ }
+ else
+ {
+ printf_filtered (" %#18lx %#18lx %#10x %#10x %7s\n",
+ (unsigned long) addr, /* FIXME: pr_addr */
+ (unsigned long) endaddr,
+ (int) size,
+ (unsigned int) offset,
+ filename[0] ? filename : "");
+ }
+ }
+
+ fclose (procfile);
+ }
+ else
+ warning ("unable to open /proc file '%s'", fname1);
+ }
+ if (status_f || all)
+ {
+ sprintf (fname1, "/proc/%lld/status", pid);
+ if ((procfile = fopen (fname1, "r")) > 0)
+ {
+ while (fgets (buffer, sizeof (buffer), procfile) != NULL)
+ puts_filtered (buffer);
+ fclose (procfile);
+ }
+ else
+ warning ("unable to open /proc file '%s'", fname1);
+ }
+ if (stat_f || all)
+ {
+ sprintf (fname1, "/proc/%lld/stat", pid);
+ if ((procfile = fopen (fname1, "r")) > 0)
+ {
+ int itmp;
+ char ctmp;
+
+ if (fscanf (procfile, "%d ", &itmp) > 0)
+ printf_filtered ("Process: %d\n", itmp);
+ if (fscanf (procfile, "%s ", &buffer[0]) > 0)
+ printf_filtered ("Exec file: %s\n", buffer);
+ if (fscanf (procfile, "%c ", &ctmp) > 0)
+ printf_filtered ("State: %c\n", ctmp);
+ if (fscanf (procfile, "%d ", &itmp) > 0)
+ printf_filtered ("Parent process: %d\n", itmp);
+ if (fscanf (procfile, "%d ", &itmp) > 0)
+ printf_filtered ("Process group: %d\n", itmp);
+ if (fscanf (procfile, "%d ", &itmp) > 0)
+ printf_filtered ("Session id: %d\n", itmp);
+ if (fscanf (procfile, "%d ", &itmp) > 0)
+ printf_filtered ("TTY: %d\n", itmp);
+ if (fscanf (procfile, "%d ", &itmp) > 0)
+ printf_filtered ("TTY owner process group: %d\n", itmp);
+ if (fscanf (procfile, "%u ", &itmp) > 0)
+ printf_filtered ("Flags: 0x%x\n", itmp);
+ if (fscanf (procfile, "%u ", &itmp) > 0)
+ printf_filtered ("Minor faults (no memory page): %u\n",
+ (unsigned int) itmp);
+ if (fscanf (procfile, "%u ", &itmp) > 0)
+ printf_filtered ("Minor faults, children: %u\n",
+ (unsigned int) itmp);
+ if (fscanf (procfile, "%u ", &itmp) > 0)
+ printf_filtered ("Major faults (memory page faults): %u\n",
+ (unsigned int) itmp);
+ if (fscanf (procfile, "%u ", &itmp) > 0)
+ printf_filtered ("Major faults, children: %u\n",
+ (unsigned int) itmp);
+ if (fscanf (procfile, "%d ", &itmp) > 0)
+ printf_filtered ("utime: %d\n", itmp);
+ if (fscanf (procfile, "%d ", &itmp) > 0)
+ printf_filtered ("stime: %d\n", itmp);
+ if (fscanf (procfile, "%d ", &itmp) > 0)
+ printf_filtered ("utime, children: %d\n", itmp);
+ if (fscanf (procfile, "%d ", &itmp) > 0)
+ printf_filtered ("stime, children: %d\n", itmp);
+ if (fscanf (procfile, "%d ", &itmp) > 0)
+ printf_filtered ("jiffies remaining in current time slice: %d\n",
+ itmp);
+ if (fscanf (procfile, "%d ", &itmp) > 0)
+ printf_filtered ("'nice' value: %d\n", itmp);
+ if (fscanf (procfile, "%u ", &itmp) > 0)
+ printf_filtered ("jiffies until next timeout: %u\n",
+ (unsigned int) itmp);
+ if (fscanf (procfile, "%u ", &itmp) > 0)
+ printf_filtered ("jiffies until next SIGALRM: %u\n",
+ (unsigned int) itmp);
+ if (fscanf (procfile, "%d ", &itmp) > 0)
+ printf_filtered ("start time (jiffies since system boot): %d\n",
+ itmp);
+ if (fscanf (procfile, "%u ", &itmp) > 0)
+ printf_filtered ("Virtual memory size: %u\n",
+ (unsigned int) itmp);
+ if (fscanf (procfile, "%u ", &itmp) > 0)
+ printf_filtered ("Resident set size: %u\n", (unsigned int) itmp);
+ if (fscanf (procfile, "%u ", &itmp) > 0)
+ printf_filtered ("rlim: %u\n", (unsigned int) itmp);
+ if (fscanf (procfile, "%u ", &itmp) > 0)
+ printf_filtered ("Start of text: 0x%x\n", itmp);
+ if (fscanf (procfile, "%u ", &itmp) > 0)
+ printf_filtered ("End of text: 0x%x\n", itmp);
+ if (fscanf (procfile, "%u ", &itmp) > 0)
+ printf_filtered ("Start of stack: 0x%x\n", itmp);
+#if 0 /* Don't know how architecture-dependent the rest is...
+ Anyway the signal bitmap info is available from "status". */
+ if (fscanf (procfile, "%u ", &itmp) > 0) /* FIXME arch? */
+ printf_filtered ("Kernel stack pointer: 0x%x\n", itmp);
+ if (fscanf (procfile, "%u ", &itmp) > 0) /* FIXME arch? */
+ printf_filtered ("Kernel instr pointer: 0x%x\n", itmp);
+ if (fscanf (procfile, "%d ", &itmp) > 0)
+ printf_filtered ("Pending signals bitmap: 0x%x\n", itmp);
+ if (fscanf (procfile, "%d ", &itmp) > 0)
+ printf_filtered ("Blocked signals bitmap: 0x%x\n", itmp);
+ if (fscanf (procfile, "%d ", &itmp) > 0)
+ printf_filtered ("Ignored signals bitmap: 0x%x\n", itmp);
+ if (fscanf (procfile, "%d ", &itmp) > 0)
+ printf_filtered ("Catched signals bitmap: 0x%x\n", itmp);
+ if (fscanf (procfile, "%u ", &itmp) > 0) /* FIXME arch? */
+ printf_filtered ("wchan (system call): 0x%x\n", itmp);
+#endif
+ fclose (procfile);
+ }
+ else
+ warning ("unable to open /proc file '%s'", fname1);
+ }
+}
+
+void
+_initialize_linux_proc (void)
+{
+ extern void inftarg_set_find_memory_regions ();
+ extern void inftarg_set_make_corefile_notes ();
+
+ inftarg_set_find_memory_regions (linux_find_memory_regions);
+ inftarg_set_make_corefile_notes (linux_make_note_section);
+
+ add_info ("proc", linux_info_proc_cmd,
+ "Show /proc process information about any running process.\n\
+Specify any process id, or use the program being debugged by default.\n\
+Specify any of the following keywords for detailed info:\n\
+ mappings -- list of mapped memory regions.\n\
+ stat -- list a bunch of random process info.\n\
+ status -- list a different bunch of random process info.\n\
+ all -- list all available /proc info.");
+}
+
+int
+linux_proc_xfer_memory (CORE_ADDR addr, char *myaddr, int len, int write,
+ struct mem_attrib *attrib, struct target_ops *target)
+{
+ int fd, ret;
+ char filename[64];
+
+ if (write)
+ return 0;
+
+ /* Don't bother for one word. */
+ if (len < 3 * sizeof (long))
+ return 0;
+
+ /* We could keep this file open and cache it - possibly one
+ per thread. That requires some juggling, but is even faster. */
+ sprintf (filename, "/proc/%d/mem", PIDGET (inferior_ptid));
+ fd = open (filename, O_RDONLY | O_LARGEFILE);
+ if (fd == -1)
+ return 0;
+
+ /* If pread64 is available, use it. It's faster if the kernel
+ supports it (only one syscall), and it's 64-bit safe even
+ on 32-bit platforms (for instance, SPARC debugging a SPARC64
+ application). */
+#ifdef HAVE_PREAD64
+ if (pread64 (fd, myaddr, len, addr) != len)
+#else
+ if (lseek (fd, addr, SEEK_SET) == -1 || read (fd, myaddr, len) != len)
+#endif
+ ret = 0;
+ else
+ ret = len;
+
+ close (fd);
+ return ret;
+}
+
+/* Parse LINE as a signal set and add its set bits to SIGS. */
+
+static void
+linux_proc_add_line_to_sigset (const char *line, sigset_t *sigs)
+{
+ int len = strlen (line) - 1;
+ const char *p;
+ int signum;
+
+ if (line[len] != '\n')
+ error ("Could not parse signal set: %s", line);
+
+ p = line;
+ signum = len * 4;
+ while (len-- > 0)
+ {
+ int digit;
+
+ if (*p >= '0' && *p <= '9')
+ digit = *p - '0';
+ else if (*p >= 'a' && *p <= 'f')
+ digit = *p - 'a' + 10;
+ else
+ error ("Could not parse signal set: %s", line);
+
+ signum -= 4;
+
+ if (digit & 1)
+ sigaddset (sigs, signum + 1);
+ if (digit & 2)
+ sigaddset (sigs, signum + 2);
+ if (digit & 4)
+ sigaddset (sigs, signum + 3);
+ if (digit & 8)
+ sigaddset (sigs, signum + 4);
+
+ p++;
+ }
+}
+
+/* Find process PID's pending signals from /proc/pid/status and set SIGS
+ to match. */
+
+void
+linux_proc_pending_signals (int pid, sigset_t *pending, sigset_t *blocked, sigset_t *ignored)
+{
+ FILE *procfile;
+ char buffer[MAXPATHLEN], fname[MAXPATHLEN];
+ int signum;
+
+ sigemptyset (pending);
+ sigemptyset (blocked);
+ sigemptyset (ignored);
+ sprintf (fname, "/proc/%d/status", pid);
+ procfile = fopen (fname, "r");
+ if (procfile == NULL)
+ error ("Could not open %s", fname);
+
+ while (fgets (buffer, MAXPATHLEN, procfile) != NULL)
+ {
+ /* Normal queued signals are on the SigPnd line in the status
+ file. However, 2.6 kernels also have a "shared" pending queue
+ for delivering signals to a thread group, so check for a ShdPnd
+ line also.
+
+ Unfortunately some Red Hat kernels include the shared pending queue
+ but not the ShdPnd status field. */
+
+ if (strncmp (buffer, "SigPnd:\t", 8) == 0)
+ linux_proc_add_line_to_sigset (buffer + 8, pending);
+ else if (strncmp (buffer, "ShdPnd:\t", 8) == 0)
+ linux_proc_add_line_to_sigset (buffer + 8, pending);
+ else if (strncmp (buffer, "SigBlk:\t", 8) == 0)
+ linux_proc_add_line_to_sigset (buffer + 8, blocked);
+ else if (strncmp (buffer, "SigIgn:\t", 8) == 0)
+ linux_proc_add_line_to_sigset (buffer + 8, ignored);
+ }
+
+ fclose (procfile);
+}
diff --git a/gdb/m32r-linux-nat.c b/gdb/m32r-linux-nat.c
deleted file mode 100644
index 7b35087..0000000
--- a/gdb/m32r-linux-nat.c
+++ /dev/null
@@ -1,235 +0,0 @@
-/* Native-dependent code for GNU/Linux m32r.
-
- Copyright 2004 Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include "defs.h"
-#include "inferior.h"
-#include "gdbcore.h"
-#include "regcache.h"
-#include "linux-nat.h"
-
-#include "gdb_assert.h"
-#include "gdb_string.h"
-#include <sys/ptrace.h>
-#include <sys/user.h>
-#include <sys/procfs.h>
-
-/* Prototypes for supply_gregset etc. */
-#include "gregset.h"
-
-#include "m32r-tdep.h"
-
-
-
-
-/* Since EVB register is not available for native debug, we reduce
- the number of registers. */
-#define M32R_LINUX_NUM_REGS (M32R_NUM_REGS - 1)
-
-/* Mapping between the general-purpose registers in `struct user'
- format and GDB's register array layout. */
-static int regmap[] = {
- 4, 5, 6, 7, 0, 1, 2, 8,
- 9, 10, 11, 12, 13, 24, 25, 23,
- 19, 19, 26, 23, 22, 20, 16, 15
-};
-
-#define PSW_REGMAP 19
-#define BBPSW_REGMAP 21
-#define SPU_REGMAP 23
-#define SPI_REGMAP 26
-
-/* Doee apply to the corresponding SET requests as well. */
-#define GETREGS_SUPPLIES(regno) (0 <= (regno) && (regno) <= M32R_LINUX_NUM_REGS)
-
-
-
-/* Transfering the general-purpose registers between GDB, inferiors
- and core files. */
-
-/* Fill GDB's register array with the general-purpose register values
- in *GREGSETP. */
-
-void
-supply_gregset (elf_gregset_t * gregsetp)
-{
- elf_greg_t *regp = (elf_greg_t *) gregsetp;
- int i;
- unsigned long psw, bbpsw;
-
- psw = *(regp + PSW_REGMAP);
- bbpsw = *(regp + BBPSW_REGMAP);
-
- for (i = 0; i < M32R_LINUX_NUM_REGS; i++)
- {
- switch (i)
- {
- case PSW_REGNUM:
- *(regp + regmap[i]) =
- ((0x00c1 & bbpsw) << 8) | ((0xc100 & psw) >> 8);
- break;
- case CBR_REGNUM:
- *(regp + regmap[i]) = ((psw >> 8) & 1);
- break;
- }
-
- if (i != M32R_SP_REGNUM)
- regcache_raw_supply (current_regcache, i, regp + regmap[i]);
- else if (psw & 0x8000)
- regcache_raw_supply (current_regcache, i, regp + SPU_REGMAP);
- else
- regcache_raw_supply (current_regcache, i, regp + SPI_REGMAP);
- }
-}
-
-/* Fetch all general-purpose registers from process/thread TID and
- store their values in GDB's register array. */
-
-static void
-fetch_regs (int tid)
-{
- elf_gregset_t regs;
-
- if (ptrace (PTRACE_GETREGS, tid, 0, (int) &regs) < 0)
- perror_with_name ("Couldn't get registers");
-
- supply_gregset (&regs);
-}
-
-/* Fill register REGNO (if it is a general-purpose register) in
- *GREGSETPS with the value in GDB's register array. If REGNO is -1,
- do this for all registers. */
-
-void
-fill_gregset (elf_gregset_t * gregsetp, int regno)
-{
- elf_greg_t *regp = (elf_greg_t *) gregsetp;
- int i;
- unsigned long psw, bbpsw, tmp;
-
- psw = *(regp + PSW_REGMAP);
- bbpsw = *(regp + BBPSW_REGMAP);
-
- for (i = 0; i < M32R_LINUX_NUM_REGS; i++)
- {
- if (regno != -1 && regno != i)
- continue;
-
- if (i == CBR_REGNUM || i == PSW_REGNUM)
- continue;
-
- if (i == SPU_REGNUM || i == SPI_REGNUM)
- continue;
-
- if (i != M32R_SP_REGNUM)
- regcache_raw_collect (current_regcache, i, regp + regmap[i]);
- else if (psw & 0x8000)
- regcache_raw_collect (current_regcache, i, regp + SPU_REGMAP);
- else
- regcache_raw_collect (current_regcache, i, regp + SPI_REGMAP);
- }
-}
-
-/* Store all valid general-purpose registers in GDB's register array
- into the process/thread specified by TID. */
-
-static void
-store_regs (int tid, int regno)
-{
- elf_gregset_t regs;
-
- if (ptrace (PTRACE_GETREGS, tid, 0, (int) &regs) < 0)
- perror_with_name ("Couldn't get registers");
-
- fill_gregset (&regs, regno);
-
- if (ptrace (PTRACE_SETREGS, tid, 0, (int) &regs) < 0)
- perror_with_name ("Couldn't write registers");
-}
-
-
-
-/* Transfering floating-point registers between GDB, inferiors and cores.
- Since M32R has no floating-point registers, these functions do nothing. */
-
-void
-supply_fpregset (gdb_fpregset_t *fpregs)
-{
-}
-
-void
-fill_fpregset (gdb_fpregset_t *fpregs, int regno)
-{
-}
-
-
-
-/* Transferring arbitrary registers between GDB and inferior. */
-
-/* Fetch register REGNO from the child process. If REGNO is -1, do
- this for all registers (including the floating point and SSE
- registers). */
-
-void
-fetch_inferior_registers (int regno)
-{
- int tid;
-
- /* GNU/Linux LWP ID's are process ID's. */
- tid = TIDGET (inferior_ptid);
- if (tid == 0)
- tid = PIDGET (inferior_ptid); /* Not a threaded program. */
-
- /* Use the PTRACE_GETREGS request whenever possible, since it
- transfers more registers in one system call, and we'll cache the
- results. */
- if (regno == -1 || GETREGS_SUPPLIES (regno))
- {
- fetch_regs (tid);
- return;
- }
-
- internal_error (__FILE__, __LINE__,
- "Got request for bad register number %d.", regno);
-}
-
-/* Store register REGNO back into the child process. If REGNO is -1,
- do this for all registers (including the floating point and SSE
- registers). */
-void
-store_inferior_registers (int regno)
-{
- int tid;
-
- /* GNU/Linux LWP ID's are process ID's. */
- if ((tid = TIDGET (inferior_ptid)) == 0)
- tid = PIDGET (inferior_ptid); /* Not a threaded program. */
-
- /* Use the PTRACE_SETREGS request whenever possible, since it
- transfers more registers in one system call. */
- if (regno == -1 || GETREGS_SUPPLIES (regno))
- {
- store_regs (tid, regno);
- return;
- }
-
- internal_error (__FILE__, __LINE__,
- "Got request to store bad register number %d.", regno);
-}
diff --git a/gdb/m32r-linux-tdep.c b/gdb/m32r-linux-tdep.c
deleted file mode 100644
index d2ca1a9..0000000
--- a/gdb/m32r-linux-tdep.c
+++ /dev/null
@@ -1,336 +0,0 @@
-/* Target-dependent code for GNU/Linux m32r.
-
- Copyright 2004 Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include "defs.h"
-#include "gdbcore.h"
-#include "frame.h"
-#include "value.h"
-#include "regcache.h"
-#include "inferior.h"
-#include "osabi.h"
-#include "reggroups.h"
-
-#include "gdb_string.h"
-
-#include "glibc-tdep.h"
-#include "solib-svr4.h"
-
-#include "trad-frame.h"
-#include "frame-unwind.h"
-
-#include "m32r-tdep.h"
-
-
-/* Recognizing signal handler frames. */
-
-/* GNU/Linux has two flavors of signals. Normal signal handlers, and
- "realtime" (RT) signals. The RT signals can provide additional
- information to the signal handler if the SA_SIGINFO flag is set
- when establishing a signal handler using `sigaction'. It is not
- unlikely that future versions of GNU/Linux will support SA_SIGINFO
- for normal signals too. */
-
-/* When the m32r Linux kernel calls a signal handler and the
- SA_RESTORER flag isn't set, the return address points to a bit of
- code on the stack. This function returns whether the PC appears to
- be within this bit of code.
-
- The instruction sequence for normal signals is
- ldi r7, #__NR_sigreturn
- trap #2
- or 0x67 0x77 0x10 0xf2.
-
- Checking for the code sequence should be somewhat reliable, because
- the effect is to call the system call sigreturn. This is unlikely
- to occur anywhere other than in a signal trampoline.
-
- It kind of sucks that we have to read memory from the process in
- order to identify a signal trampoline, but there doesn't seem to be
- any other way. Therefore we only do the memory reads if no
- function name could be identified, which should be the case since
- the code is on the stack.
-
- Detection of signal trampolines for handlers that set the
- SA_RESTORER flag is in general not possible. Unfortunately this is
- what the GNU C Library has been doing for quite some time now.
- However, as of version 2.1.2, the GNU C Library uses signal
- trampolines (named __restore and __restore_rt) that are identical
- to the ones used by the kernel. Therefore, these trampolines are
- supported too. */
-
-static const unsigned char linux_sigtramp_code[] = {
- 0x67, 0x77, 0x10, 0xf2,
-};
-
-/* If PC is in a sigtramp routine, return the address of the start of
- the routine. Otherwise, return 0. */
-
-static CORE_ADDR
-m32r_linux_sigtramp_start (CORE_ADDR pc, struct frame_info *next_frame)
-{
- unsigned char buf[4];
-
- /* We only recognize a signal trampoline if PC is at the start of
- one of the instructions. We optimize for finding the PC at the
- start of the instruction sequence, as will be the case when the
- trampoline is not the first frame on the stack. We assume that
- in the case where the PC is not at the start of the instruction
- sequence, there will be a few trailing readable bytes on the
- stack. */
-
- if (pc % 2 != 0)
- {
- if (!safe_frame_unwind_memory (next_frame, pc, buf, 2))
- return 0;
-
- if (memcmp (buf, linux_sigtramp_code, 2) == 0)
- pc -= 2;
- else
- return 0;
- }
-
- if (!safe_frame_unwind_memory (next_frame, pc, buf, 4))
- return 0;
-
- if (memcmp (buf, linux_sigtramp_code, 4) != 0)
- return 0;
-
- return pc;
-}
-
-/* This function does the same for RT signals. Here the instruction
- sequence is
- ldi r7, #__NR_rt_sigreturn
- trap #2
- or 0x97 0xf0 0x00 0xad 0x10 0xf2 0xf0 0x00.
-
- The effect is to call the system call rt_sigreturn. */
-
-static const unsigned char linux_rt_sigtramp_code[] = {
- 0x97, 0xf0, 0x00, 0xad, 0x10, 0xf2, 0xf0, 0x00,
-};
-
-/* If PC is in a RT sigtramp routine, return the address of the start
- of the routine. Otherwise, return 0. */
-
-static CORE_ADDR
-m32r_linux_rt_sigtramp_start (CORE_ADDR pc, struct frame_info *next_frame)
-{
- unsigned char buf[4];
-
- /* We only recognize a signal trampoline if PC is at the start of
- one of the instructions. We optimize for finding the PC at the
- start of the instruction sequence, as will be the case when the
- trampoline is not the first frame on the stack. We assume that
- in the case where the PC is not at the start of the instruction
- sequence, there will be a few trailing readable bytes on the
- stack. */
-
- if (pc % 2 != 0)
- return 0;
-
- if (!safe_frame_unwind_memory (next_frame, pc, buf, 4))
- return 0;
-
- if (memcmp (buf, linux_rt_sigtramp_code, 4) == 0)
- {
- if (!safe_frame_unwind_memory (next_frame, pc + 4, buf, 4))
- return 0;
-
- if (memcmp (buf, linux_rt_sigtramp_code + 4, 4) == 0)
- return pc;
- }
- else if (memcmp (buf, linux_rt_sigtramp_code + 4, 4) == 0)
- {
- if (!safe_frame_unwind_memory (next_frame, pc - 4, buf, 4))
- return 0;
-
- if (memcmp (buf, linux_rt_sigtramp_code, 4) == 0)
- return pc - 4;
- }
-
- return 0;
-}
-
-static int
-m32r_linux_pc_in_sigtramp (CORE_ADDR pc, char *name,
- struct frame_info *next_frame)
-{
- /* If we have NAME, we can optimize the search. The trampolines are
- named __restore and __restore_rt. However, they aren't dynamically
- exported from the shared C library, so the trampoline may appear to
- be part of the preceding function. This should always be sigaction,
- __sigaction, or __libc_sigaction (all aliases to the same function). */
- if (name == NULL || strstr (name, "sigaction") != NULL)
- return (m32r_linux_sigtramp_start (pc, next_frame) != 0
- || m32r_linux_rt_sigtramp_start (pc, next_frame) != 0);
-
- return (strcmp ("__restore", name) == 0
- || strcmp ("__restore_rt", name) == 0);
-}
-
-/* From <asm/sigcontext.h>. */
-static int m32r_linux_sc_reg_offset[] = {
- 4 * 4, /* r0 */
- 5 * 4, /* r1 */
- 6 * 4, /* r2 */
- 7 * 4, /* r3 */
- 0 * 4, /* r4 */
- 1 * 4, /* r5 */
- 2 * 4, /* r6 */
- 8 * 4, /* r7 */
- 9 * 4, /* r8 */
- 10 * 4, /* r9 */
- 11 * 4, /* r10 */
- 12 * 4, /* r11 */
- 13 * 4, /* r12 */
- 21 * 4, /* fp */
- 22 * 4, /* lr */
- -1 * 4, /* sp */
- 16 * 4, /* psw */
- -1 * 4, /* cbr */
- 23 * 4, /* spi */
- 20 * 4, /* spu */
- 19 * 4, /* bpc */
- 17 * 4, /* pc */
- 15 * 4, /* accl */
- 14 * 4 /* acch */
-};
-
-struct m32r_frame_cache
-{
- CORE_ADDR base, pc;
- struct trad_frame_saved_reg *saved_regs;
-};
-
-static struct m32r_frame_cache *
-m32r_linux_sigtramp_frame_cache (struct frame_info *next_frame,
- void **this_cache)
-{
- struct m32r_frame_cache *cache;
- CORE_ADDR sigcontext_addr, addr;
- int regnum;
-
- if ((*this_cache) != NULL)
- return (*this_cache);
- cache = FRAME_OBSTACK_ZALLOC (struct m32r_frame_cache);
- (*this_cache) = cache;
- cache->saved_regs = trad_frame_alloc_saved_regs (next_frame);
-
- cache->base = frame_unwind_register_unsigned (next_frame, M32R_SP_REGNUM);
- sigcontext_addr = cache->base + 4;
-
- cache->pc = frame_pc_unwind (next_frame);
- addr = m32r_linux_sigtramp_start (cache->pc, next_frame);
- if (addr == 0)
- {
- /* If this is a RT signal trampoline, adjust SIGCONTEXT_ADDR
- accordingly. */
- addr = m32r_linux_rt_sigtramp_start (cache->pc, next_frame);
- if (addr)
- sigcontext_addr += 128;
- else
- addr = frame_func_unwind (next_frame);
- }
- cache->pc = addr;
-
- cache->saved_regs = trad_frame_alloc_saved_regs (next_frame);
-
- for (regnum = 0; regnum < sizeof (m32r_linux_sc_reg_offset) / 4; regnum++)
- {
- if (m32r_linux_sc_reg_offset[regnum] >= 0)
- cache->saved_regs[regnum].addr =
- sigcontext_addr + m32r_linux_sc_reg_offset[regnum];
- }
-
- return cache;
-}
-
-static void
-m32r_linux_sigtramp_frame_this_id (struct frame_info *next_frame,
- void **this_cache,
- struct frame_id *this_id)
-{
- struct m32r_frame_cache *cache =
- m32r_linux_sigtramp_frame_cache (next_frame, this_cache);
-
- (*this_id) = frame_id_build (cache->base, cache->pc);
-}
-
-static void
-m32r_linux_sigtramp_frame_prev_register (struct frame_info *next_frame,
- void **this_cache,
- int regnum, int *optimizedp,
- enum lval_type *lvalp,
- CORE_ADDR *addrp,
- int *realnump, void *valuep)
-{
- struct m32r_frame_cache *cache =
- m32r_linux_sigtramp_frame_cache (next_frame, this_cache);
-
- trad_frame_get_prev_register (next_frame, cache->saved_regs, regnum,
- optimizedp, lvalp, addrp, realnump, valuep);
-}
-
-static const struct frame_unwind m32r_linux_sigtramp_frame_unwind = {
- SIGTRAMP_FRAME,
- m32r_linux_sigtramp_frame_this_id,
- m32r_linux_sigtramp_frame_prev_register
-};
-
-static const struct frame_unwind *
-m32r_linux_sigtramp_frame_sniffer (struct frame_info *next_frame)
-{
- CORE_ADDR pc = frame_pc_unwind (next_frame);
- char *name;
-
- find_pc_partial_function (pc, &name, NULL, NULL);
- if (m32r_linux_pc_in_sigtramp (pc, name, next_frame))
- return &m32r_linux_sigtramp_frame_unwind;
-
- return NULL;
-}
-
-static void
-m32r_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
-{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-
- /* Since EVB register is not available for native debug, we reduce
- the number of registers. */
- set_gdbarch_num_regs (gdbarch, M32R_NUM_REGS - 1);
-
- frame_unwind_append_sniffer (gdbarch, m32r_linux_sigtramp_frame_sniffer);
-
- /* GNU/Linux uses SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
-}
-
-/* Provide a prototype to silence -Wmissing-prototypes. */
-extern void _initialize_m32r_linux_tdep (void);
-
-void
-_initialize_m32r_linux_tdep (void)
-{
- gdbarch_register_osabi (bfd_arch_m32r, 0, GDB_OSABI_LINUX,
- m32r_linux_init_abi);
-}
diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c
index 0afd261..fd5e9dc 100644
--- a/gdb/m32r-tdep.c
+++ b/gdb/m32r-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for Renesas M32R, for GDB.
- Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
+ Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2003 Free Software
Foundation, Inc.
This file is part of GDB.
@@ -41,7 +41,27 @@
#include "gdb_assert.h"
-#include "m32r-tdep.h"
+struct gdbarch_tdep
+{
+ /* gdbarch target dependent data here. Currently unused for M32R. */
+};
+
+/* m32r register names. */
+
+enum
+{
+ R0_REGNUM = 0,
+ R3_REGNUM = 3,
+ M32R_FP_REGNUM = 13,
+ LR_REGNUM = 14,
+ M32R_SP_REGNUM = 15,
+ PSW_REGNUM = 16,
+ M32R_PC_REGNUM = 21,
+ /* m32r calling convention. */
+ ARG1_REGNUM = R0_REGNUM,
+ ARGN_REGNUM = R3_REGNUM,
+ RET1_REGNUM = R0_REGNUM,
+};
/* Local functions */
@@ -55,6 +75,19 @@ m32r_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp)
return sp & ~3;
}
+/* Should we use DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS instead of
+ EXTRACT_RETURN_VALUE? GCC_P is true if compiled with gcc and TYPE
+ is the type (which is known to be struct, union or array).
+
+ The m32r returns anything less than 8 bytes in size in
+ registers. */
+
+static int
+m32r_use_struct_convention (int gcc_p, struct type *type)
+{
+ return (TYPE_LENGTH (type) > 8);
+}
+
/* BREAKPOINT */
#define M32R_BE_BREAKPOINT32 {0x10, 0xf1, 0x70, 0x00}
@@ -205,12 +238,18 @@ char *m32r_register_names[] = {
"evb"
};
+static int
+m32r_num_regs (void)
+{
+ return (sizeof (m32r_register_names) / sizeof (m32r_register_names[0]));
+}
+
static const char *
m32r_register_name (int reg_nr)
{
if (reg_nr < 0)
return NULL;
- if (reg_nr >= M32R_NUM_REGS)
+ if (reg_nr >= m32r_num_regs ())
return NULL;
return m32r_register_names[reg_nr];
}
@@ -253,56 +292,69 @@ m32r_store_return_value (struct type *type, struct regcache *regcache,
}
}
+/* Extract from an array REGBUF containing the (raw) register state
+ the address in which a function should return its structure value,
+ as a CORE_ADDR (or an expression that can be used as one). */
+
+static CORE_ADDR
+m32r_extract_struct_value_address (struct regcache *regcache)
+{
+ ULONGEST addr;
+ regcache_cooked_read_unsigned (regcache, ARG1_REGNUM, &addr);
+ return addr;
+}
+
+
/* This is required by skip_prologue. The results of decoding a prologue
should be cached because this thrashing is getting nuts. */
-static int
+static void
decode_prologue (CORE_ADDR start_pc, CORE_ADDR scan_limit,
- CORE_ADDR *pl_endptr, unsigned long *framelength)
+ CORE_ADDR *pl_endptr)
{
unsigned long framesize;
int insn;
int op1;
+ int maybe_one_more = 0;
CORE_ADDR after_prologue = 0;
- CORE_ADDR after_push = 0;
CORE_ADDR after_stack_adjust = 0;
CORE_ADDR current_pc;
- LONGEST return_value;
framesize = 0;
after_prologue = 0;
for (current_pc = start_pc; current_pc < scan_limit; current_pc += 2)
{
- /* Check if current pc's location is readable. */
- if (!safe_read_memory_integer (current_pc, 2, &return_value))
- return -1;
-
insn = read_memory_unsigned_integer (current_pc, 2);
- if (insn == 0x0000)
- break;
-
/* If this is a 32 bit instruction, we dont want to examine its
immediate data as though it were an instruction */
if (current_pc & 0x02)
{
+ /* Clear the parallel execution bit from 16 bit instruction */
+ if (maybe_one_more)
+ {
+ /* The last instruction was a branch, usually terminates
+ the series, but if this is a parallel instruction,
+ it may be a stack framing instruction */
+ if (!(insn & 0x8000))
+ {
+ /* nope, we are really done */
+ break;
+ }
+ }
/* decode this instruction further */
insn &= 0x7fff;
}
else
{
+ if (maybe_one_more)
+ break; /* This isnt the one more */
if (insn & 0x8000)
{
if (current_pc == scan_limit)
scan_limit += 2; /* extend the search */
-
current_pc += 2; /* skip the immediate data */
-
- /* Check if current pc's location is readable. */
- if (!safe_read_memory_integer (current_pc, 2, &return_value))
- return -1;
-
if (insn == 0x8faf) /* add3 sp, sp, xxxx */
/* add 16 bit sign-extended offset */
{
@@ -312,8 +364,6 @@ decode_prologue (CORE_ADDR start_pc, CORE_ADDR scan_limit,
else
{
if (((insn >> 8) == 0xe4) /* ld24 r4, xxxxxx; sub sp, r4 */
- && safe_read_memory_integer (current_pc + 2, 2,
- &return_value)
&& read_memory_unsigned_integer (current_pc + 2,
2) == 0x0f24)
/* subtract 24 bit sign-extended negative-offset */
@@ -326,7 +376,7 @@ decode_prologue (CORE_ADDR start_pc, CORE_ADDR scan_limit,
framesize += insn;
}
}
- after_push = current_pc + 2;
+ after_prologue = current_pc;
continue;
}
}
@@ -365,23 +415,17 @@ decode_prologue (CORE_ADDR start_pc, CORE_ADDR scan_limit,
after_prologue = current_pc + 2;
break; /* end of stack adjustments */
}
-
/* Nop looks like a branch, continue explicitly */
if (insn == 0x7000)
{
after_prologue = current_pc + 2;
continue; /* nop occurs between pushes */
}
- /* End of prolog if any of these are trap instructions */
- if ((insn & 0xfff0) == 0x10f0)
- {
- after_prologue = current_pc;
- break;
- }
/* End of prolog if any of these are branch instructions */
if ((op1 == 0x7000) || (op1 == 0xb000) || (op1 == 0xf000))
{
after_prologue = current_pc;
+ maybe_one_more = 1;
continue;
}
/* Some of the branch instructions are mixed with other types */
@@ -391,14 +435,12 @@ decode_prologue (CORE_ADDR start_pc, CORE_ADDR scan_limit,
if ((subop == 0x0ec0) || (subop == 0x0fc0))
{
after_prologue = current_pc;
+ maybe_one_more = 1;
continue; /* jmp , jl */
}
}
}
- if (framelength)
- *framelength = framesize;
-
if (current_pc >= scan_limit)
{
if (pl_endptr)
@@ -410,13 +452,6 @@ decode_prologue (CORE_ADDR start_pc, CORE_ADDR scan_limit,
{
*pl_endptr = after_stack_adjust;
}
- else if (after_push != 0)
- /* We did not find a "mv fp,sp", but we DID find
- a push. Is it safe to use that as the
- end of the prologue? I just don't know. */
- {
- *pl_endptr = after_push;
- }
else
/* We reached the end of the loop without finding the end
of the prologue. No way to win -- we should report failure.
@@ -424,29 +459,25 @@ decode_prologue (CORE_ADDR start_pc, CORE_ADDR scan_limit,
GDB will set a breakpoint at the start of the function (etc.) */
*pl_endptr = start_pc;
}
- return 0;
+ return;
}
-
if (after_prologue == 0)
after_prologue = current_pc;
if (pl_endptr)
*pl_endptr = after_prologue;
-
- return 0;
} /* decode_prologue */
/* Function: skip_prologue
Find end of function prologue */
-#define DEFAULT_SEARCH_LIMIT 128
+#define DEFAULT_SEARCH_LIMIT 44
CORE_ADDR
m32r_skip_prologue (CORE_ADDR pc)
{
CORE_ADDR func_addr, func_end;
struct symtab_and_line sal;
- LONGEST return_value;
/* See what the symbol table says */
@@ -468,18 +499,11 @@ m32r_skip_prologue (CORE_ADDR pc)
}
else
func_end = pc + DEFAULT_SEARCH_LIMIT;
-
- /* If pc's location is not readable, just quit. */
- if (!safe_read_memory_integer (pc, 4, &return_value))
- return pc;
-
- /* Find the end of prologue. */
- if (decode_prologue (pc, func_end, &sal.end, NULL) < 0)
- return pc;
-
+ decode_prologue (pc, func_end, &sal.end);
return sal.end;
}
+
struct m32r_unwind_cache
{
/* The previous frame's inner most stack address. Used as this
@@ -508,14 +532,13 @@ static struct m32r_unwind_cache *
m32r_frame_unwind_cache (struct frame_info *next_frame,
void **this_prologue_cache)
{
- CORE_ADDR pc, scan_limit;
+ CORE_ADDR pc;
ULONGEST prev_sp;
ULONGEST this_base;
- unsigned long op, op2;
+ unsigned long op;
int i;
struct m32r_unwind_cache *info;
-
if ((*this_prologue_cache))
return (*this_prologue_cache);
@@ -525,11 +548,10 @@ m32r_frame_unwind_cache (struct frame_info *next_frame,
info->size = 0;
info->sp_offset = 0;
- info->uses_frame = 0;
- scan_limit = frame_pc_unwind (next_frame);
+ info->uses_frame = 0;
for (pc = frame_func_unwind (next_frame);
- pc > 0 && pc < scan_limit; pc += 2)
+ pc > 0 && pc < frame_pc_unwind (next_frame); pc += 2)
{
if ((pc & 2) == 0)
{
@@ -543,19 +565,18 @@ m32r_frame_unwind_cache (struct frame_info *next_frame,
short n = op & 0xffff;
info->sp_offset += n;
}
- else if (((op >> 8) == 0xe4)
- && get_frame_memory_unsigned (next_frame, pc + 2,
+ else if (((op >> 8) == 0xe4) /* ld24 r4, xxxxxx; sub sp, r4 */
+ && get_frame_memory_unsigned (next_frame, pc + 4,
2) == 0x0f24)
{
- /* ld24 r4, xxxxxx; sub sp, r4 */
unsigned long n = op & 0xffffff;
info->sp_offset += n;
- pc += 2; /* skip sub instruction */
+ pc += 2;
}
+ else
+ break;
- if (pc == scan_limit)
- scan_limit += 2; /* extend the search */
- pc += 2; /* skip the immediate data */
+ pc += 2;
continue;
}
}
@@ -580,13 +601,12 @@ m32r_frame_unwind_cache (struct frame_info *next_frame,
/* mv fp, sp */
info->uses_frame = 1;
info->r13_offset = info->sp_offset;
- break; /* end of stack adjustments */
- }
- else if ((op & 0xfff0) == 0x10f0)
- {
- /* end of prologue if this is a trap instruction */
- break; /* end of stack adjustments */
}
+ else if (op == 0x7000)
+ /* nop */
+ continue;
+ else
+ break;
}
info->size = -info->sp_offset;
@@ -787,24 +807,6 @@ m32r_extract_return_value (struct type *type, struct regcache *regcache,
}
}
-enum return_value_convention
-m32r_return_value (struct gdbarch *gdbarch, struct type *valtype,
- struct regcache *regcache, void *readbuf,
- const void *writebuf)
-{
- if (TYPE_LENGTH (valtype) > 8)
- return RETURN_VALUE_STRUCT_CONVENTION;
- else
- {
- if (readbuf != NULL)
- m32r_extract_return_value (valtype, regcache, readbuf);
- if (writebuf != NULL)
- m32r_store_return_value (valtype, regcache, writebuf);
- return RETURN_VALUE_REGISTER_CONVENTION;
- }
-}
-
-
static CORE_ADDR
m32r_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
@@ -919,13 +921,16 @@ m32r_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_write_pc (gdbarch, m32r_write_pc);
set_gdbarch_unwind_sp (gdbarch, m32r_unwind_sp);
- set_gdbarch_num_regs (gdbarch, M32R_NUM_REGS);
+ set_gdbarch_num_regs (gdbarch, m32r_num_regs ());
set_gdbarch_sp_regnum (gdbarch, M32R_SP_REGNUM);
set_gdbarch_register_name (gdbarch, m32r_register_name);
set_gdbarch_register_type (gdbarch, m32r_register_type);
+ set_gdbarch_extract_return_value (gdbarch, m32r_extract_return_value);
set_gdbarch_push_dummy_call (gdbarch, m32r_push_dummy_call);
- set_gdbarch_return_value (gdbarch, m32r_return_value);
+ set_gdbarch_store_return_value (gdbarch, m32r_store_return_value);
+ set_gdbarch_deprecated_extract_struct_value_address (gdbarch, m32r_extract_struct_value_address);
+ set_gdbarch_deprecated_use_struct_convention (gdbarch, m32r_use_struct_convention);
set_gdbarch_skip_prologue (gdbarch, m32r_skip_prologue);
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
diff --git a/gdb/m32r-tdep.h b/gdb/m32r-tdep.h
deleted file mode 100644
index 60da0d6..0000000
--- a/gdb/m32r-tdep.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Target-dependent code for Renesas M32R, for GDB.
-
- Copyright 2004 Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#ifndef M32R_TDEP_H
-#define M32R_TDEP_H
-
-struct gdbarch_tdep
-{
- /* gdbarch target dependent data here. Currently unused for M32R. */
-};
-
-/* m32r register names. */
-
-enum m32r_regnum
-{
- R0_REGNUM = 0,
- R3_REGNUM = 3,
- M32R_FP_REGNUM = 13,
- LR_REGNUM = 14,
- M32R_SP_REGNUM = 15,
- PSW_REGNUM = 16,
- CBR_REGNUM = 17,
- SPU_REGNUM = 18,
- SPI_REGNUM = 19,
- M32R_PC_REGNUM = 21,
- /* m32r calling convention. */
- ARG1_REGNUM = R0_REGNUM,
- ARGN_REGNUM = R3_REGNUM,
- RET1_REGNUM = R0_REGNUM,
-};
-
-#define M32R_NUM_REGS 25
-
-#endif /* m32r-tdep.h */
diff --git a/gdb/m88kbsd-nat.c b/gdb/m88kbsd-nat.c
index 472eb76..7553c19 100644
--- a/gdb/m88kbsd-nat.c
+++ b/gdb/m88kbsd-nat.c
@@ -22,14 +22,12 @@
#include "defs.h"
#include "inferior.h"
#include "regcache.h"
-#include "target.h"
#include <sys/types.h>
#include <sys/ptrace.h>
#include <machine/reg.h>
#include "m88k-tdep.h"
-#include "inf-ptrace.h"
/* Supply the general-purpose registers stored in GREGS to REGCACHE. */
@@ -64,8 +62,8 @@ m88kbsd_collect_gregset (const struct regcache *regcache,
/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this
for all registers. */
-static void
-m88kbsd_fetch_inferior_registers (int regnum)
+void
+fetch_inferior_registers (int regnum)
{
struct reg regs;
@@ -79,8 +77,8 @@ m88kbsd_fetch_inferior_registers (int regnum)
/* Store register REGNUM back into the inferior. If REGNUM is -1, do
this for all registers. */
-static void
-m88kbsd_store_inferior_registers (int regnum)
+void
+store_inferior_registers (int regnum)
{
struct reg regs;
@@ -94,18 +92,3 @@ m88kbsd_store_inferior_registers (int regnum)
(PTRACE_TYPE_ARG3) &regs, 0) == -1)
perror_with_name ("Couldn't write registers");
}
-
-
-/* Provide a prototype to silence -Wmissing-prototypes. */
-void _initialize_m88kbsd_nat (void);
-
-void
-_initialize_m88kbsd_nat (void)
-{
- struct target_ops *t;
-
- t = inf_ptrace_target ();
- t->to_fetch_registers = m88kbsd_fetch_inferior_registers;
- t->to_store_registers = m88kbsd_store_inferior_registers;
- add_target (t);
-}
diff --git a/gdb/maint.c b/gdb/maint.c
index 6b4b067..0ee3533 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -609,8 +609,8 @@ maintenance_do_deprecate (char *text, int deprecate)
/* Maintenance set/show framework. */
-struct cmd_list_element *maintenance_set_cmdlist;
-struct cmd_list_element *maintenance_show_cmdlist;
+static struct cmd_list_element *maintenance_set_cmdlist;
+static struct cmd_list_element *maintenance_show_cmdlist;
static void
maintenance_set_cmd (char *args, int from_tty)
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index 635d0cc..3aeda7d 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -145,15 +145,7 @@ add_minsym_to_demangled_hash_table (struct minimal_symbol *sym,
Note: One instance where there may be duplicate minimal symbols with
the same name is when the symbol tables for a shared library and the
symbol tables for an executable contain global symbols with the same
- names (the dynamic linker deals with the duplication).
-
- It's also possible to have minimal symbols with different mangled
- names, but identical demangled names. For example, the GNU C++ v3
- ABI requires the generation of two (or perhaps three) copies of
- constructor functions --- "in-charge", "not-in-charge", and
- "allocate" copies; destructors may be duplicated as well.
- Obviously, there must be distinct mangled names for each of these,
- but the demangled names are all the same: S::S or S::~S. */
+ names (the dynamic linker deals with the duplication). */
struct minimal_symbol *
lookup_minimal_symbol (const char *name, const char *sfile,
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 4f249b8..2b40fdd 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -945,6 +945,63 @@ after_prologue (CORE_ADDR pc)
return 0;
}
+/* Decode a MIPS32 instruction that saves a register in the stack, and
+ set the appropriate bit in the general register mask or float register mask
+ to indicate which register is saved. This is a helper function
+ for mips_find_saved_regs. */
+
+static void
+mips32_decode_reg_save (t_inst inst, unsigned long *gen_mask,
+ unsigned long *float_mask)
+{
+ int reg;
+
+ if ((inst & 0xffe00000) == 0xafa00000 /* sw reg,n($sp) */
+ || (inst & 0xffe00000) == 0xafc00000 /* sw reg,n($r30) */
+ || (inst & 0xffe00000) == 0xffa00000) /* sd reg,n($sp) */
+ {
+ /* It might be possible to use the instruction to
+ find the offset, rather than the code below which
+ is based on things being in a certain order in the
+ frame, but figuring out what the instruction's offset
+ is relative to might be a little tricky. */
+ reg = (inst & 0x001f0000) >> 16;
+ *gen_mask |= (1 << reg);
+ }
+ else if ((inst & 0xffe00000) == 0xe7a00000 /* swc1 freg,n($sp) */
+ || (inst & 0xffe00000) == 0xe7c00000 /* swc1 freg,n($r30) */
+ || (inst & 0xffe00000) == 0xf7a00000) /* sdc1 freg,n($sp) */
+
+ {
+ reg = ((inst & 0x001f0000) >> 16);
+ *float_mask |= (1 << reg);
+ }
+}
+
+/* Decode a MIPS16 instruction that saves a register in the stack, and
+ set the appropriate bit in the general register or float register mask
+ to indicate which register is saved. This is a helper function
+ for mips_find_saved_regs. */
+
+static void
+mips16_decode_reg_save (t_inst inst, unsigned long *gen_mask)
+{
+ if ((inst & 0xf800) == 0xd000) /* sw reg,n($sp) */
+ {
+ int reg = mips16_to_32_reg[(inst & 0x700) >> 8];
+ *gen_mask |= (1 << reg);
+ }
+ else if ((inst & 0xff00) == 0xf900) /* sd reg,n($sp) */
+ {
+ int reg = mips16_to_32_reg[(inst & 0xe0) >> 5];
+ *gen_mask |= (1 << reg);
+ }
+ else if ((inst & 0xff00) == 0x6200 /* sw $ra,n($sp) */
+ || (inst & 0xff00) == 0xfa00) /* sd $ra,n($sp) */
+ *gen_mask |= (1 << RA_REGNUM);
+}
+
+
/* Fetch and return instruction from the specified location. If the PC
is odd, assume it's a MIPS16 instruction; otherwise MIPS32. */
@@ -983,6 +1040,20 @@ mips16_fetch_instruction (CORE_ADDR addr)
return extract_unsigned_integer (buf, instlen);
}
+static ULONGEST
+mips32_fetch_instruction (CORE_ADDR addr)
+{
+ char buf[MIPS_INSTLEN];
+ int instlen;
+ int status;
+ instlen = MIPS_INSTLEN;
+ status = deprecated_read_memory_nobpt (addr, buf, instlen);
+ if (status)
+ memory_error (status, addr);
+ return extract_unsigned_integer (buf, instlen);
+}
+
+
/* These the fields of 32 bit mips instructions */
#define mips32_op(x) (x >> 26)
#define itype_op(x) (x >> 26)
@@ -1143,7 +1214,7 @@ mips32_next_pc (CORE_ADDR pc)
pc += 8;
break;
case 6: /* BLEZ, BLEZL */
- if (read_signed_register (itype_rs (inst)) <= 0)
+ if (read_signed_register (itype_rs (inst) <= 0))
pc += mips32_relative_offset (inst) + 4;
else
pc += 8;
@@ -1151,7 +1222,7 @@ mips32_next_pc (CORE_ADDR pc)
case 7:
default:
greater_branch: /* BGTZ, BGTZL */
- if (read_signed_register (itype_rs (inst)) > 0)
+ if (read_signed_register (itype_rs (inst) > 0))
pc += mips32_relative_offset (inst) + 4;
else
pc += 8;
@@ -1710,293 +1781,196 @@ mips_mdebug_frame_base_sniffer (struct frame_info *next_frame)
return NULL;
}
-/* Set a register's saved stack address in temp_saved_regs. If an
- address has already been set for this register, do nothing; this
- way we will only recognize the first save of a given register in a
- function prologue.
-
- For simplicity, save the address in both [0 .. NUM_REGS) and
- [NUM_REGS .. 2*NUM_REGS). Strictly speaking, only the second range
- is used as it is only second range (the ABI instead of ISA
- registers) that comes into play when finding saved registers in a
- frame. */
-
-static void
-set_reg_offset (struct mips_frame_cache *this_cache, int regnum,
- CORE_ADDR offset)
-{
- if (this_cache != NULL
- && this_cache->saved_regs[regnum].addr == -1)
- {
- this_cache->saved_regs[regnum + 0 * NUM_REGS].addr = offset;
- this_cache->saved_regs[regnum + 1 * NUM_REGS].addr = offset;
- }
-}
-
-
-/* Fetch the immediate value from a MIPS16 instruction.
- If the previous instruction was an EXTEND, use it to extend
- the upper bits of the immediate value. This is a helper function
- for mips16_scan_prologue. */
+/* Heuristic unwinder for 16-bit MIPS instruction set (aka MIPS16).
+ Procedures that use the 32-bit instruction set are handled by the
+ mips_insn32 unwinder. */
-static int
-mips16_get_imm (unsigned short prev_inst, /* previous instruction */
- unsigned short inst, /* current instruction */
- int nbits, /* number of bits in imm field */
- int scale, /* scale factor to be applied to imm */
- int is_signed) /* is the imm field signed? */
+static struct mips_frame_cache *
+mips_insn16_frame_cache (struct frame_info *next_frame, void **this_cache)
{
- int offset;
-
- if ((prev_inst & 0xf800) == 0xf000) /* prev instruction was EXTEND? */
- {
- offset = ((prev_inst & 0x1f) << 11) | (prev_inst & 0x7e0);
- if (offset & 0x8000) /* check for negative extend */
- offset = 0 - (0x10000 - (offset & 0xffff));
- return offset | (inst & 0x1f);
- }
- else
- {
- int max_imm = 1 << nbits;
- int mask = max_imm - 1;
- int sign_bit = max_imm >> 1;
-
- offset = inst & mask;
- if (is_signed && (offset & sign_bit))
- offset = 0 - (max_imm - offset);
- return offset * scale;
- }
-}
-
-
-/* Analyze the function prologue from START_PC to LIMIT_PC. Builds
- the associated FRAME_CACHE if not null.
- Return the address of the first instruction past the prologue. */
+ mips_extra_func_info_t proc_desc;
+ struct mips_frame_cache *cache;
+ struct gdbarch *gdbarch = get_frame_arch (next_frame);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ /* r0 bit means kernel trap */
+ int kernel_trap;
+ /* What registers have been saved? Bitmasks. */
+ unsigned long gen_mask, float_mask;
-static CORE_ADDR
-mips16_scan_prologue (CORE_ADDR start_pc, CORE_ADDR limit_pc,
- struct frame_info *next_frame,
- struct mips_frame_cache *this_cache)
-{
- CORE_ADDR cur_pc;
- CORE_ADDR frame_addr = 0; /* Value of $r17, used as frame pointer */
- CORE_ADDR sp;
- long frame_offset = 0; /* Size of stack frame. */
- long frame_adjust = 0; /* Offset of FP from SP. */
- int frame_reg = MIPS_SP_REGNUM;
- unsigned short prev_inst = 0; /* saved copy of previous instruction */
- unsigned inst = 0; /* current instruction */
- unsigned entry_inst = 0; /* the entry instruction */
- int reg, offset;
+ if ((*this_cache) != NULL)
+ return (*this_cache);
+ cache = FRAME_OBSTACK_ZALLOC (struct mips_frame_cache);
+ (*this_cache) = cache;
+ cache->saved_regs = trad_frame_alloc_saved_regs (next_frame);
- int extend_bytes = 0;
- int prev_extend_bytes;
- CORE_ADDR end_prologue_addr = 0;
+ /* Synthesize a proc descriptor. */
+ {
+ const CORE_ADDR pc = frame_pc_unwind (next_frame);
+ CORE_ADDR start_addr;
- /* Can be called when there's no process, and hence when there's no
- NEXT_FRAME. */
- if (next_frame != NULL)
- sp = read_next_frame_reg (next_frame, NUM_REGS + MIPS_SP_REGNUM);
- else
- sp = 0;
+ find_pc_partial_function (pc, NULL, &start_addr, NULL);
+ if (start_addr == 0)
+ start_addr = heuristic_proc_start (pc);
- if (limit_pc > start_pc + 200)
- limit_pc = start_pc + 200;
+#ifdef NOT_YET
+ proc_desc = heuristic_proc_desc (start_addr, pc, next_frame, *this_cache);
+#else
+ proc_desc = heuristic_proc_desc (start_addr, pc, next_frame, NULL);
+#endif
+ }
+
+ /* Extract the frame's base. */
+ cache->base = (frame_unwind_register_signed (next_frame, NUM_REGS + PROC_FRAME_REG (proc_desc))
+ + PROC_FRAME_OFFSET (proc_desc) - PROC_FRAME_ADJUST (proc_desc));
- for (cur_pc = start_pc; cur_pc < limit_pc; cur_pc += MIPS16_INSTLEN)
+ kernel_trap = PROC_REG_MASK (proc_desc) & 1;
+ gen_mask = kernel_trap ? 0xFFFFFFFF : PROC_REG_MASK (proc_desc);
+ float_mask = kernel_trap ? 0xFFFFFFFF : PROC_FREG_MASK (proc_desc);
+
+ /* In any frame other than the innermost or a frame interrupted by a
+ signal, we assume that all registers have been saved. This
+ assumes that all register saves in a function happen before the
+ first function call. */
+ if (in_prologue (frame_pc_unwind (next_frame), PROC_LOW_ADDR (proc_desc))
+ /* Not sure exactly what kernel_trap means, but if it means the
+ kernel saves the registers without a prologue doing it, we
+ better not examine the prologue to see whether registers
+ have been saved yet. */
+ && !kernel_trap)
{
- /* Save the previous instruction. If it's an EXTEND, we'll extract
- the immediate offset extension from it in mips16_get_imm. */
- prev_inst = inst;
+ /* We need to figure out whether the registers that the
+ proc_desc claims are saved have been saved yet. */
- /* Fetch and decode the instruction. */
- inst = (unsigned short) mips_fetch_instruction (cur_pc);
+ CORE_ADDR addr;
- /* Normally we ignore extend instructions. However, if it is
- not followed by a valid prologue instruction, then this
- instruction is not part of the prologue either. We must
- remember in this case to adjust the end_prologue_addr back
- over the extend. */
- if ((inst & 0xf800) == 0xf000) /* extend */
- {
- extend_bytes = MIPS16_INSTLEN;
- continue;
- }
+ /* Bitmasks; set if we have found a save for the register. */
+ unsigned long gen_save_found = 0;
+ unsigned long float_save_found = 0;
+ int mips16;
- prev_extend_bytes = extend_bytes;
- extend_bytes = 0;
+ /* If the address is odd, assume this is MIPS16 code. */
+ addr = PROC_LOW_ADDR (proc_desc);
+ mips16 = pc_is_mips16 (addr);
- if ((inst & 0xff00) == 0x6300 /* addiu sp */
- || (inst & 0xff00) == 0xfb00) /* daddiu sp */
+ /* Scan through this function's instructions preceding the
+ current PC, and look for those that save registers. */
+ while (addr < frame_pc_unwind (next_frame))
{
- offset = mips16_get_imm (prev_inst, inst, 8, 8, 1);
- if (offset < 0) /* negative stack adjustment? */
- frame_offset -= offset;
+ if (mips16)
+ {
+ mips16_decode_reg_save (mips16_fetch_instruction (addr),
+ &gen_save_found);
+ addr += MIPS16_INSTLEN;
+ }
else
- /* Exit loop if a positive stack adjustment is found, which
- usually means that the stack cleanup code in the function
- epilogue is reached. */
- break;
- }
- else if ((inst & 0xf800) == 0xd000) /* sw reg,n($sp) */
- {
- offset = mips16_get_imm (prev_inst, inst, 8, 4, 0);
- reg = mips16_to_32_reg[(inst & 0x700) >> 8];
- set_reg_offset (this_cache, reg, sp + offset);
- }
- else if ((inst & 0xff00) == 0xf900) /* sd reg,n($sp) */
- {
- offset = mips16_get_imm (prev_inst, inst, 5, 8, 0);
- reg = mips16_to_32_reg[(inst & 0xe0) >> 5];
- set_reg_offset (this_cache, reg, sp + offset);
- }
- else if ((inst & 0xff00) == 0x6200) /* sw $ra,n($sp) */
- {
- offset = mips16_get_imm (prev_inst, inst, 8, 4, 0);
- set_reg_offset (this_cache, RA_REGNUM, sp + offset);
- }
- else if ((inst & 0xff00) == 0xfa00) /* sd $ra,n($sp) */
- {
- offset = mips16_get_imm (prev_inst, inst, 8, 8, 0);
- set_reg_offset (this_cache, RA_REGNUM, sp + offset);
- }
- else if (inst == 0x673d) /* move $s1, $sp */
- {
- frame_addr = sp;
- frame_reg = 17;
- }
- else if ((inst & 0xff00) == 0x0100) /* addiu $s1,sp,n */
- {
- offset = mips16_get_imm (prev_inst, inst, 8, 4, 0);
- frame_addr = sp + offset;
- frame_reg = 17;
- frame_adjust = offset;
- }
- else if ((inst & 0xFF00) == 0xd900) /* sw reg,offset($s1) */
- {
- offset = mips16_get_imm (prev_inst, inst, 5, 4, 0);
- reg = mips16_to_32_reg[(inst & 0xe0) >> 5];
- set_reg_offset (this_cache, reg, frame_addr + offset);
- }
- else if ((inst & 0xFF00) == 0x7900) /* sd reg,offset($s1) */
- {
- offset = mips16_get_imm (prev_inst, inst, 5, 8, 0);
- reg = mips16_to_32_reg[(inst & 0xe0) >> 5];
- set_reg_offset (this_cache, reg, frame_addr + offset);
+ {
+ mips32_decode_reg_save (mips32_fetch_instruction (addr),
+ &gen_save_found, &float_save_found);
+ addr += MIPS_INSTLEN;
+ }
}
- else if ((inst & 0xf81f) == 0xe809
- && (inst & 0x700) != 0x700) /* entry */
- entry_inst = inst; /* save for later processing */
- else if ((inst & 0xf800) == 0x1800) /* jal(x) */
- cur_pc += MIPS16_INSTLEN; /* 32-bit instruction */
- else if ((inst & 0xff1c) == 0x6704) /* move reg,$a0-$a3 */
- {
- /* This instruction is part of the prologue, but we don't
- need to do anything special to handle it. */
- }
- else
- {
- /* This instruction is not an instruction typically found
- in a prologue, so we must have reached the end of the
- prologue. */
- if (end_prologue_addr == 0)
- end_prologue_addr = cur_pc - prev_extend_bytes;
- }
+ gen_mask = gen_save_found;
+ float_mask = float_save_found;
}
- /* The entry instruction is typically the first instruction in a function,
- and it stores registers at offsets relative to the value of the old SP
- (before the prologue). But the value of the sp parameter to this
- function is the new SP (after the prologue has been executed). So we
- can't calculate those offsets until we've seen the entire prologue,
- and can calculate what the old SP must have been. */
- if (entry_inst != 0)
- {
- int areg_count = (entry_inst >> 8) & 7;
- int sreg_count = (entry_inst >> 6) & 3;
-
- /* The entry instruction always subtracts 32 from the SP. */
- frame_offset += 32;
-
- /* Now we can calculate what the SP must have been at the
- start of the function prologue. */
- sp += frame_offset;
-
- /* Check if a0-a3 were saved in the caller's argument save area. */
- for (reg = 4, offset = 0; reg < areg_count + 4; reg++)
+ /* Fill in the offsets for the registers which gen_mask says were
+ saved. */
+ {
+ CORE_ADDR reg_position = (cache->base
+ + PROC_REG_OFFSET (proc_desc));
+ int ireg;
+ for (ireg = MIPS_NUMREGS - 1; gen_mask; --ireg, gen_mask <<= 1)
+ if (gen_mask & 0x80000000)
{
- set_reg_offset (this_cache, reg, sp + offset);
- offset += mips_abi_regsize (current_gdbarch);
+ cache->saved_regs[NUM_REGS + ireg].addr = reg_position;
+ reg_position -= mips_abi_regsize (gdbarch);
}
+ }
- /* Check if the ra register was pushed on the stack. */
- offset = -4;
- if (entry_inst & 0x20)
+ /* The MIPS16 entry instruction saves $s0 and $s1 in the reverse
+ order of that normally used by gcc. Therefore, we have to fetch
+ the first instruction of the function, and if it's an entry
+ instruction that saves $s0 or $s1, correct their saved addresses. */
+ if (pc_is_mips16 (PROC_LOW_ADDR (proc_desc)))
+ {
+ ULONGEST inst = mips16_fetch_instruction (PROC_LOW_ADDR (proc_desc));
+ if ((inst & 0xf81f) == 0xe809 && (inst & 0x700) != 0x700)
+ /* entry */
{
- set_reg_offset (this_cache, RA_REGNUM, sp + offset);
- offset -= mips_abi_regsize (current_gdbarch);
- }
+ int reg;
+ int sreg_count = (inst >> 6) & 3;
- /* Check if the s0 and s1 registers were pushed on the stack. */
- for (reg = 16; reg < sreg_count + 16; reg++)
- {
- set_reg_offset (this_cache, reg, sp + offset);
- offset -= mips_abi_regsize (current_gdbarch);
- }
- }
+ /* Check if the ra register was pushed on the stack. */
+ CORE_ADDR reg_position = (cache->base
+ + PROC_REG_OFFSET (proc_desc));
+ if (inst & 0x20)
+ reg_position -= mips_abi_regsize (gdbarch);
- if (this_cache != NULL)
- {
- this_cache->base =
- (frame_unwind_register_signed (next_frame, NUM_REGS + frame_reg)
- + frame_offset - frame_adjust);
- /* FIXME: brobecker/2004-10-10: Just as in the mips32 case, we should
- be able to get rid of the assignment below, evetually. But it's
- still needed for now. */
- this_cache->saved_regs[NUM_REGS + mips_regnum (current_gdbarch)->pc]
- = this_cache->saved_regs[NUM_REGS + RA_REGNUM];
+ /* Check if the s0 and s1 registers were pushed on the
+ stack. */
+ /* NOTE: cagney/2004-02-08: Huh? This is doing no such
+ check. */
+ for (reg = 16; reg < sreg_count + 16; reg++)
+ {
+ cache->saved_regs[NUM_REGS + reg].addr = reg_position;
+ reg_position -= mips_abi_regsize (gdbarch);
+ }
+ }
}
- /* If we didn't reach the end of the prologue when scanning the function
- instructions, then set end_prologue_addr to the address of the
- instruction immediately after the last one we scanned. */
- if (end_prologue_addr == 0)
- end_prologue_addr = cur_pc;
-
- return end_prologue_addr;
-}
-
-/* Heuristic unwinder for 16-bit MIPS instruction set (aka MIPS16).
- Procedures that use the 32-bit instruction set are handled by the
- mips_insn32 unwinder. */
-
-static struct mips_frame_cache *
-mips_insn16_frame_cache (struct frame_info *next_frame, void **this_cache)
-{
- struct mips_frame_cache *cache;
+ /* Fill in the offsets for the registers which float_mask says were
+ saved. */
+ {
+ CORE_ADDR reg_position = (cache->base
+ + PROC_FREG_OFFSET (proc_desc));
+ int ireg;
+ /* Fill in the offsets for the float registers which float_mask
+ says were saved. */
+ for (ireg = MIPS_NUMREGS - 1; float_mask; --ireg, float_mask <<= 1)
+ if (float_mask & 0x80000000)
+ {
+ if (mips_abi_regsize (gdbarch) == 4
+ && TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+ {
+ /* On a big endian 32 bit ABI, floating point registers
+ are paired to form doubles such that the most
+ significant part is in $f[N+1] and the least
+ significant in $f[N] vis: $f[N+1] ||| $f[N]. The
+ registers are also spilled as a pair and stored as a
+ double.
- if ((*this_cache) != NULL)
- return (*this_cache);
- cache = FRAME_OBSTACK_ZALLOC (struct mips_frame_cache);
- (*this_cache) = cache;
- cache->saved_regs = trad_frame_alloc_saved_regs (next_frame);
+ When little-endian the least significant part is
+ stored first leading to the memory order $f[N] and
+ then $f[N+1].
- /* Analyze the function prologue. */
- {
- const CORE_ADDR pc = frame_pc_unwind (next_frame);
- CORE_ADDR start_addr;
+ Unfortunately, when big-endian the most significant
+ part of the double is stored first, and the least
+ significant is stored second. This leads to the
+ registers being ordered in memory as firt $f[N+1] and
+ then $f[N].
- find_pc_partial_function (pc, NULL, &start_addr, NULL);
- if (start_addr == 0)
- start_addr = heuristic_proc_start (pc);
- /* We can't analyze the prologue if we couldn't find the begining
- of the function. */
- if (start_addr == 0)
- return cache;
+ For the big-endian case make certain that the
+ addresses point at the correct (swapped) locations
+ $f[N] and $f[N+1] pair (keep in mind that
+ reg_position is decremented each time through the
+ loop). */
+ if ((ireg & 1))
+ cache->saved_regs[NUM_REGS + mips_regnum (current_gdbarch)->fp0 + ireg]
+ .addr = reg_position - mips_abi_regsize (gdbarch);
+ else
+ cache->saved_regs[NUM_REGS + mips_regnum (current_gdbarch)->fp0 + ireg]
+ .addr = reg_position + mips_abi_regsize (gdbarch);
+ }
+ else
+ cache->saved_regs[NUM_REGS + mips_regnum (current_gdbarch)->fp0 + ireg]
+ .addr = reg_position;
+ reg_position -= mips_abi_regsize (gdbarch);
+ }
- mips16_scan_prologue (start_addr, pc, next_frame, *this_cache);
+ cache->saved_regs[NUM_REGS + mips_regnum (current_gdbarch)->pc]
+ = cache->saved_regs[NUM_REGS + RA_REGNUM];
}
-
+
/* SP_REGNUM, contains the value and not the address. */
trad_frame_set_value (cache->saved_regs, NUM_REGS + MIPS_SP_REGNUM, cache->base);
@@ -2067,223 +2041,6 @@ mips_insn16_frame_base_sniffer (struct frame_info *next_frame)
return NULL;
}
-/* Mark all the registers as unset in the saved_regs array
- of THIS_CACHE. Do nothing if THIS_CACHE is null. */
-
-void
-reset_saved_regs (struct mips_frame_cache *this_cache)
-{
- if (this_cache == NULL || this_cache->saved_regs == NULL)
- return;
-
- {
- const int num_regs = NUM_REGS;
- int i;
-
- for (i = 0; i < num_regs; i++)
- {
- this_cache->saved_regs[i].addr = -1;
- }
- }
-}
-
-/* Analyze the function prologue from START_PC to LIMIT_PC. Builds
- the associated FRAME_CACHE if not null.
- Return the address of the first instruction past the prologue. */
-
-static CORE_ADDR
-mips32_scan_prologue (CORE_ADDR start_pc, CORE_ADDR limit_pc,
- struct frame_info *next_frame,
- struct mips_frame_cache *this_cache)
-{
- CORE_ADDR cur_pc;
- CORE_ADDR frame_addr = 0; /* Value of $r30. Used by gcc for frame-pointer */
- CORE_ADDR sp;
- long frame_offset;
- int frame_reg = MIPS_SP_REGNUM;
-
- CORE_ADDR end_prologue_addr = 0;
- int seen_sp_adjust = 0;
- int load_immediate_bytes = 0;
-
- /* Can be called when there's no process, and hence when there's no
- NEXT_FRAME. */
- if (next_frame != NULL)
- sp = read_next_frame_reg (next_frame, NUM_REGS + MIPS_SP_REGNUM);
- else
- sp = 0;
-
- if (limit_pc > start_pc + 200)
- limit_pc = start_pc + 200;
-
-restart:
-
- frame_offset = 0;
- for (cur_pc = start_pc; cur_pc < limit_pc; cur_pc += MIPS_INSTLEN)
- {
- unsigned long inst, high_word, low_word;
- int reg;
-
- /* Fetch the instruction. */
- inst = (unsigned long) mips_fetch_instruction (cur_pc);
-
- /* Save some code by pre-extracting some useful fields. */
- high_word = (inst >> 16) & 0xffff;
- low_word = inst & 0xffff;
- reg = high_word & 0x1f;
-
- if (high_word == 0x27bd /* addiu $sp,$sp,-i */
- || high_word == 0x23bd /* addi $sp,$sp,-i */
- || high_word == 0x67bd) /* daddiu $sp,$sp,-i */
- {
- if (low_word & 0x8000) /* negative stack adjustment? */
- frame_offset += 0x10000 - low_word;
- else
- /* Exit loop if a positive stack adjustment is found, which
- usually means that the stack cleanup code in the function
- epilogue is reached. */
- break;
- seen_sp_adjust = 1;
- }
- else if ((high_word & 0xFFE0) == 0xafa0) /* sw reg,offset($sp) */
- {
- set_reg_offset (this_cache, reg, sp + low_word);
- }
- else if ((high_word & 0xFFE0) == 0xffa0) /* sd reg,offset($sp) */
- {
- /* Irix 6.2 N32 ABI uses sd instructions for saving $gp and $ra. */
- set_reg_offset (this_cache, reg, sp + low_word);
- }
- else if (high_word == 0x27be) /* addiu $30,$sp,size */
- {
- /* Old gcc frame, r30 is virtual frame pointer. */
- if ((long) low_word != frame_offset)
- frame_addr = sp + low_word;
- else if (frame_reg == MIPS_SP_REGNUM)
- {
- unsigned alloca_adjust;
-
- frame_reg = 30;
- frame_addr = read_next_frame_reg (next_frame, NUM_REGS + 30);
- alloca_adjust = (unsigned) (frame_addr - (sp + low_word));
- if (alloca_adjust > 0)
- {
- /* FP > SP + frame_size. This may be because of
- an alloca or somethings similar. Fix sp to
- "pre-alloca" value, and try again. */
- sp += alloca_adjust;
- /* Need to reset the status of all registers. Otherwise,
- we will hit a guard that prevents the new address
- for each register to be recomputed during the second
- pass. */
- reset_saved_regs (this_cache);
- goto restart;
- }
- }
- }
- /* move $30,$sp. With different versions of gas this will be either
- `addu $30,$sp,$zero' or `or $30,$sp,$zero' or `daddu 30,sp,$0'.
- Accept any one of these. */
- else if (inst == 0x03A0F021 || inst == 0x03a0f025 || inst == 0x03a0f02d)
- {
- /* New gcc frame, virtual frame pointer is at r30 + frame_size. */
- if (frame_reg == MIPS_SP_REGNUM)
- {
- unsigned alloca_adjust;
-
- frame_reg = 30;
- frame_addr = read_next_frame_reg (next_frame, NUM_REGS + 30);
- alloca_adjust = (unsigned) (frame_addr - sp);
- if (alloca_adjust > 0)
- {
- /* FP > SP + frame_size. This may be because of
- an alloca or somethings similar. Fix sp to
- "pre-alloca" value, and try again. */
- sp = frame_addr;
- /* Need to reset the status of all registers. Otherwise,
- we will hit a guard that prevents the new address
- for each register to be recomputed during the second
- pass. */
- reset_saved_regs (this_cache);
- goto restart;
- }
- }
- }
- else if ((high_word & 0xFFE0) == 0xafc0) /* sw reg,offset($30) */
- {
- set_reg_offset (this_cache, reg, frame_addr + low_word);
- }
- else if ((high_word & 0xFFE0) == 0xE7A0 /* swc1 freg,n($sp) */
- || (high_word & 0xF3E0) == 0xA3C0 /* sx reg,n($s8) */
- || (inst & 0xFF9F07FF) == 0x00800021 /* move reg,$a0-$a3 */
- || high_word == 0x3c1c /* lui $gp,n */
- || high_word == 0x279c /* addiu $gp,$gp,n */
- || inst == 0x0399e021 /* addu $gp,$gp,$t9 */
- || inst == 0x033ce021 /* addu $gp,$t9,$gp */
- )
- {
- /* These instructions are part of the prologue, but we don't
- need to do anything special to handle them. */
- }
- /* The instructions below load $at or $t0 with an immediate
- value in preparation for a stack adjustment via
- subu $sp,$sp,[$at,$t0]. These instructions could also
- initialize a local variable, so we accept them only before
- a stack adjustment instruction was seen. */
- else if (!seen_sp_adjust
- && (high_word == 0x3c01 /* lui $at,n */
- || high_word == 0x3c08 /* lui $t0,n */
- || high_word == 0x3421 /* ori $at,$at,n */
- || high_word == 0x3508 /* ori $t0,$t0,n */
- || high_word == 0x3401 /* ori $at,$zero,n */
- || high_word == 0x3408 /* ori $t0,$zero,n */
- ))
- {
- load_immediate_bytes += MIPS_INSTLEN; /* FIXME!! */
- }
- else
- {
- /* This instruction is not an instruction typically found
- in a prologue, so we must have reached the end of the
- prologue. */
- /* FIXME: brobecker/2004-10-10: Can't we just break out of this
- loop now? Why would we need to continue scanning the function
- instructions? */
- if (end_prologue_addr == 0)
- end_prologue_addr = cur_pc;
- }
- }
-
- if (this_cache != NULL)
- {
- this_cache->base =
- (frame_unwind_register_signed (next_frame, NUM_REGS + frame_reg)
- + frame_offset);
- /* FIXME: brobecker/2004-09-15: We should be able to get rid of
- this assignment below, eventually. But it's still needed
- for now. */
- this_cache->saved_regs[NUM_REGS + mips_regnum (current_gdbarch)->pc]
- = this_cache->saved_regs[NUM_REGS + RA_REGNUM];
- }
-
- /* If we didn't reach the end of the prologue when scanning the function
- instructions, then set end_prologue_addr to the address of the
- instruction immediately after the last one we scanned. */
- /* brobecker/2004-10-10: I don't think this would ever happen, but
- we may as well be careful and do our best if we have a null
- end_prologue_addr. */
- if (end_prologue_addr == 0)
- end_prologue_addr = cur_pc;
-
- /* In a frameless function, we might have incorrectly
- skipped some load immediate instructions. Undo the skipping
- if the load immediate was not followed by a stack adjustment. */
- if (load_immediate_bytes && !seen_sp_adjust)
- end_prologue_addr -= load_immediate_bytes;
-
- return end_prologue_addr;
-}
-
/* Heuristic unwinder for procedures using 32-bit instructions (covers
both 32-bit and 64-bit MIPS ISAs). Procedures using 16-bit
instructions (a.k.a. MIPS16) are handled by the mips_insn16
@@ -2292,16 +2049,22 @@ restart:
static struct mips_frame_cache *
mips_insn32_frame_cache (struct frame_info *next_frame, void **this_cache)
{
+ mips_extra_func_info_t proc_desc;
struct mips_frame_cache *cache;
+ struct gdbarch *gdbarch = get_frame_arch (next_frame);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ /* r0 bit means kernel trap */
+ int kernel_trap;
+ /* What registers have been saved? Bitmasks. */
+ unsigned long gen_mask, float_mask;
if ((*this_cache) != NULL)
return (*this_cache);
-
cache = FRAME_OBSTACK_ZALLOC (struct mips_frame_cache);
(*this_cache) = cache;
cache->saved_regs = trad_frame_alloc_saved_regs (next_frame);
- /* Analyze the function prologue. */
+ /* Synthesize a proc descriptor. */
{
const CORE_ADDR pc = frame_pc_unwind (next_frame);
CORE_ADDR start_addr;
@@ -2309,14 +2072,131 @@ mips_insn32_frame_cache (struct frame_info *next_frame, void **this_cache)
find_pc_partial_function (pc, NULL, &start_addr, NULL);
if (start_addr == 0)
start_addr = heuristic_proc_start (pc);
- /* We can't analyze the prologue if we couldn't find the begining
- of the function. */
- if (start_addr == 0)
- return cache;
- mips32_scan_prologue (start_addr, pc, next_frame, *this_cache);
+#ifdef NOT_YET
+ proc_desc = heuristic_proc_desc (start_addr, pc, next_frame, *this_cache);
+#else
+ proc_desc = heuristic_proc_desc (start_addr, pc, next_frame, NULL);
+#endif
}
+ if (proc_desc == NULL)
+ /* I'm not sure how/whether this can happen. Normally when we
+ can't find a proc_desc, we "synthesize" one using
+ heuristic_proc_desc and set the saved_regs right away. */
+ return cache;
+
+ /* Extract the frame's base. */
+ cache->base = (frame_unwind_register_signed (next_frame, NUM_REGS + PROC_FRAME_REG (proc_desc))
+ + PROC_FRAME_OFFSET (proc_desc) - PROC_FRAME_ADJUST (proc_desc));
+
+ kernel_trap = PROC_REG_MASK (proc_desc) & 1;
+ gen_mask = kernel_trap ? 0xFFFFFFFF : PROC_REG_MASK (proc_desc);
+ float_mask = kernel_trap ? 0xFFFFFFFF : PROC_FREG_MASK (proc_desc);
+
+ /* In any frame other than the innermost or a frame interrupted by a
+ signal, we assume that all registers have been saved. This
+ assumes that all register saves in a function happen before the
+ first function call. */
+ if (in_prologue (frame_pc_unwind (next_frame), PROC_LOW_ADDR (proc_desc))
+ /* Not sure exactly what kernel_trap means, but if it means the
+ kernel saves the registers without a prologue doing it, we
+ better not examine the prologue to see whether registers
+ have been saved yet. */
+ && !kernel_trap)
+ {
+ /* We need to figure out whether the registers that the
+ proc_desc claims are saved have been saved yet. */
+
+ CORE_ADDR addr;
+
+ /* Bitmasks; set if we have found a save for the register. */
+ unsigned long gen_save_found = 0;
+ unsigned long float_save_found = 0;
+
+ addr = PROC_LOW_ADDR (proc_desc);
+
+ /* Scan through this function's instructions preceding the
+ current PC, and look for those that save registers. */
+ while (addr < frame_pc_unwind (next_frame))
+ {
+ mips32_decode_reg_save (mips32_fetch_instruction (addr),
+ &gen_save_found, &float_save_found);
+ addr += MIPS_INSTLEN;
+ }
+ gen_mask = gen_save_found;
+ float_mask = float_save_found;
+ }
+
+ /* Fill in the offsets for the registers which gen_mask says were
+ saved. */
+ {
+ CORE_ADDR reg_position = (cache->base
+ + PROC_REG_OFFSET (proc_desc));
+ int ireg;
+ for (ireg = MIPS_NUMREGS - 1; gen_mask; --ireg, gen_mask <<= 1)
+ if (gen_mask & 0x80000000)
+ {
+ cache->saved_regs[NUM_REGS + ireg].addr = reg_position;
+ reg_position -= mips_abi_regsize (gdbarch);
+ }
+ }
+
+ /* Fill in the offsets for the registers which float_mask says were
+ saved. */
+ {
+ CORE_ADDR reg_position = (cache->base + PROC_FREG_OFFSET (proc_desc));
+ int ireg;
+
+ /* Fill in the offsets for the float registers which float_mask
+ says were saved. */
+ for (ireg = MIPS_NUMREGS - 1; float_mask; --ireg, float_mask <<= 1)
+ if (float_mask & 0x80000000)
+ {
+ const int regno =
+ NUM_REGS + mips_regnum (current_gdbarch)->fp0 + ireg;
+
+ if (mips_abi_regsize (gdbarch) == 4
+ && TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+ {
+ /* On a big endian 32 bit ABI, floating point registers
+ are paired to form doubles such that the most
+ significant part is in $f[N+1] and the least
+ significant in $f[N] vis: $f[N+1] ||| $f[N]. The
+ registers are also spilled as a pair and stored as a
+ double.
+
+ When little-endian the least significant part is
+ stored first leading to the memory order $f[N] and
+ then $f[N+1].
+
+ Unfortunately, when big-endian the most significant
+ part of the double is stored first, and the least
+ significant is stored second. This leads to the
+ registers being ordered in memory as firt $f[N+1] and
+ then $f[N].
+
+ For the big-endian case make certain that the
+ addresses point at the correct (swapped) locations
+ $f[N] and $f[N+1] pair (keep in mind that
+ reg_position is decremented each time through the
+ loop). */
+ if ((ireg & 1))
+ cache->saved_regs[regno].addr =
+ reg_position - mips_abi_regsize (gdbarch);
+ else
+ cache->saved_regs[regno].addr =
+ reg_position + mips_abi_regsize (gdbarch);
+ }
+ else
+ cache->saved_regs[regno].addr = reg_position;
+ reg_position -= mips_abi_regsize (gdbarch);
+ }
+
+ cache->saved_regs[NUM_REGS + mips_regnum (current_gdbarch)->pc]
+ = cache->saved_regs[NUM_REGS + RA_REGNUM];
+ }
+
/* SP_REGNUM, contains the value and not the address. */
trad_frame_set_value (cache->saved_regs, NUM_REGS + MIPS_SP_REGNUM, cache->base);
@@ -2493,6 +2373,12 @@ read_next_frame_reg (struct frame_info *fi, int regno)
regcache_cooked_read_signed (current_regcache, regno, &val);
return val;
}
+ else if ((regno % NUM_REGS) == MIPS_SP_REGNUM)
+ /* MIPS_SP_REGNUM is special, its value is stored in saved_regs.
+ In fact, it is so special that it can even only be fetched
+ using a raw register number! Once this code as been converted
+ to frame-unwind the problem goes away. */
+ return frame_unwind_register_signed (fi, regno % NUM_REGS);
else
return frame_unwind_register_signed (fi, regno);
@@ -2554,6 +2440,30 @@ mips_software_single_step (enum target_signal sig, int insert_breakpoints_p)
static struct mips_extra_func_info temp_proc_desc;
+/* Set a register's saved stack address in temp_saved_regs. If an
+ address has already been set for this register, do nothing; this
+ way we will only recognize the first save of a given register in a
+ function prologue.
+
+ For simplicity, save the address in both [0 .. NUM_REGS) and
+ [NUM_REGS .. 2*NUM_REGS). Strictly speaking, only the second range
+ is used as it is only second range (the ABI instead of ISA
+ registers) that comes into play when finding saved registers in a
+ frame. */
+
+static void
+set_reg_offset (struct mips_frame_cache *this_cache, int regnum,
+ CORE_ADDR offset)
+{
+ if (this_cache != NULL
+ && this_cache->saved_regs[regnum].addr == 0)
+ {
+ this_cache->saved_regs[regnum + 0 * NUM_REGS].addr = offset;
+ this_cache->saved_regs[regnum + 1 * NUM_REGS].addr = offset;
+ }
+}
+
+
/* Test whether the PC points to the return instruction at the
end of a function. */
@@ -2667,24 +2577,313 @@ heuristic-fence-post' command.\n", paddr_nz (pc), paddr_nz (pc));
return start_pc;
}
+/* Fetch the immediate value from a MIPS16 instruction.
+ If the previous instruction was an EXTEND, use it to extend
+ the upper bits of the immediate value. This is a helper function
+ for mips16_heuristic_proc_desc. */
+
+static int
+mips16_get_imm (unsigned short prev_inst, /* previous instruction */
+ unsigned short inst, /* current instruction */
+ int nbits, /* number of bits in imm field */
+ int scale, /* scale factor to be applied to imm */
+ int is_signed) /* is the imm field signed? */
+{
+ int offset;
+
+ if ((prev_inst & 0xf800) == 0xf000) /* prev instruction was EXTEND? */
+ {
+ offset = ((prev_inst & 0x1f) << 11) | (prev_inst & 0x7e0);
+ if (offset & 0x8000) /* check for negative extend */
+ offset = 0 - (0x10000 - (offset & 0xffff));
+ return offset | (inst & 0x1f);
+ }
+ else
+ {
+ int max_imm = 1 << nbits;
+ int mask = max_imm - 1;
+ int sign_bit = max_imm >> 1;
+
+ offset = inst & mask;
+ if (is_signed && (offset & sign_bit))
+ offset = 0 - (max_imm - offset);
+ return offset * scale;
+ }
+}
+
+
+/* Fill in values in temp_proc_desc based on the MIPS16 instruction
+ stream from start_pc to limit_pc. */
+
+static void
+mips16_heuristic_proc_desc (CORE_ADDR start_pc, CORE_ADDR limit_pc,
+ CORE_ADDR sp,
+ struct frame_info *next_frame,
+ struct mips_frame_cache *this_cache)
+{
+ CORE_ADDR cur_pc;
+ CORE_ADDR frame_addr = 0; /* Value of $r17, used as frame pointer */
+ unsigned short prev_inst = 0; /* saved copy of previous instruction */
+ unsigned inst = 0; /* current instruction */
+ unsigned entry_inst = 0; /* the entry instruction */
+ int reg, offset;
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+
+ PROC_FRAME_OFFSET (&temp_proc_desc) = 0; /* size of stack frame */
+ PROC_FRAME_ADJUST (&temp_proc_desc) = 0; /* offset of FP from SP */
+
+ for (cur_pc = start_pc; cur_pc < limit_pc; cur_pc += MIPS16_INSTLEN)
+ {
+ /* Save the previous instruction. If it's an EXTEND, we'll extract
+ the immediate offset extension from it in mips16_get_imm. */
+ prev_inst = inst;
+
+ /* Fetch and decode the instruction. */
+ inst = (unsigned short) mips_fetch_instruction (cur_pc);
+ if ((inst & 0xff00) == 0x6300 /* addiu sp */
+ || (inst & 0xff00) == 0xfb00) /* daddiu sp */
+ {
+ offset = mips16_get_imm (prev_inst, inst, 8, 8, 1);
+ if (offset < 0) /* negative stack adjustment? */
+ PROC_FRAME_OFFSET (&temp_proc_desc) -= offset;
+ else
+ /* Exit loop if a positive stack adjustment is found, which
+ usually means that the stack cleanup code in the function
+ epilogue is reached. */
+ break;
+ }
+ else if ((inst & 0xf800) == 0xd000) /* sw reg,n($sp) */
+ {
+ offset = mips16_get_imm (prev_inst, inst, 8, 4, 0);
+ reg = mips16_to_32_reg[(inst & 0x700) >> 8];
+ PROC_REG_MASK (&temp_proc_desc) |= (1 << reg);
+ set_reg_offset (this_cache, reg, sp + offset);
+ }
+ else if ((inst & 0xff00) == 0xf900) /* sd reg,n($sp) */
+ {
+ offset = mips16_get_imm (prev_inst, inst, 5, 8, 0);
+ reg = mips16_to_32_reg[(inst & 0xe0) >> 5];
+ PROC_REG_MASK (&temp_proc_desc) |= (1 << reg);
+ set_reg_offset (this_cache, reg, sp + offset);
+ }
+ else if ((inst & 0xff00) == 0x6200) /* sw $ra,n($sp) */
+ {
+ offset = mips16_get_imm (prev_inst, inst, 8, 4, 0);
+ PROC_REG_MASK (&temp_proc_desc) |= (1 << RA_REGNUM);
+ set_reg_offset (this_cache, RA_REGNUM, sp + offset);
+ }
+ else if ((inst & 0xff00) == 0xfa00) /* sd $ra,n($sp) */
+ {
+ offset = mips16_get_imm (prev_inst, inst, 8, 8, 0);
+ PROC_REG_MASK (&temp_proc_desc) |= (1 << RA_REGNUM);
+ set_reg_offset (this_cache, RA_REGNUM, sp + offset);
+ }
+ else if (inst == 0x673d) /* move $s1, $sp */
+ {
+ frame_addr = sp;
+ PROC_FRAME_REG (&temp_proc_desc) = 17;
+ }
+ else if ((inst & 0xff00) == 0x0100) /* addiu $s1,sp,n */
+ {
+ offset = mips16_get_imm (prev_inst, inst, 8, 4, 0);
+ frame_addr = sp + offset;
+ PROC_FRAME_REG (&temp_proc_desc) = 17;
+ PROC_FRAME_ADJUST (&temp_proc_desc) = offset;
+ }
+ else if ((inst & 0xFF00) == 0xd900) /* sw reg,offset($s1) */
+ {
+ offset = mips16_get_imm (prev_inst, inst, 5, 4, 0);
+ reg = mips16_to_32_reg[(inst & 0xe0) >> 5];
+ PROC_REG_MASK (&temp_proc_desc) |= 1 << reg;
+ set_reg_offset (this_cache, reg, frame_addr + offset);
+ }
+ else if ((inst & 0xFF00) == 0x7900) /* sd reg,offset($s1) */
+ {
+ offset = mips16_get_imm (prev_inst, inst, 5, 8, 0);
+ reg = mips16_to_32_reg[(inst & 0xe0) >> 5];
+ PROC_REG_MASK (&temp_proc_desc) |= 1 << reg;
+ set_reg_offset (this_cache, reg, frame_addr + offset);
+ }
+ else if ((inst & 0xf81f) == 0xe809 && (inst & 0x700) != 0x700) /* entry */
+ entry_inst = inst; /* save for later processing */
+ else if ((inst & 0xf800) == 0x1800) /* jal(x) */
+ cur_pc += MIPS16_INSTLEN; /* 32-bit instruction */
+ }
+
+ /* The entry instruction is typically the first instruction in a function,
+ and it stores registers at offsets relative to the value of the old SP
+ (before the prologue). But the value of the sp parameter to this
+ function is the new SP (after the prologue has been executed). So we
+ can't calculate those offsets until we've seen the entire prologue,
+ and can calculate what the old SP must have been. */
+ if (entry_inst != 0)
+ {
+ int areg_count = (entry_inst >> 8) & 7;
+ int sreg_count = (entry_inst >> 6) & 3;
+
+ /* The entry instruction always subtracts 32 from the SP. */
+ PROC_FRAME_OFFSET (&temp_proc_desc) += 32;
+
+ /* Now we can calculate what the SP must have been at the
+ start of the function prologue. */
+ sp += PROC_FRAME_OFFSET (&temp_proc_desc);
+
+ /* Check if a0-a3 were saved in the caller's argument save area. */
+ for (reg = 4, offset = 0; reg < areg_count + 4; reg++)
+ {
+ PROC_REG_MASK (&temp_proc_desc) |= 1 << reg;
+ set_reg_offset (this_cache, reg, sp + offset);
+ offset += mips_abi_regsize (current_gdbarch);
+ }
+
+ /* Check if the ra register was pushed on the stack. */
+ offset = -4;
+ if (entry_inst & 0x20)
+ {
+ PROC_REG_MASK (&temp_proc_desc) |= 1 << RA_REGNUM;
+ set_reg_offset (this_cache, RA_REGNUM, sp + offset);
+ offset -= mips_abi_regsize (current_gdbarch);
+ }
+
+ /* Check if the s0 and s1 registers were pushed on the stack. */
+ for (reg = 16; reg < sreg_count + 16; reg++)
+ {
+ PROC_REG_MASK (&temp_proc_desc) |= 1 << reg;
+ set_reg_offset (this_cache, reg, sp + offset);
+ offset -= mips_abi_regsize (current_gdbarch);
+ }
+ }
+}
+
+static void
+mips32_heuristic_proc_desc (CORE_ADDR start_pc, CORE_ADDR limit_pc,
+ CORE_ADDR sp, struct frame_info *next_frame,
+ struct mips_frame_cache *this_cache)
+{
+ CORE_ADDR cur_pc;
+ CORE_ADDR frame_addr = 0; /* Value of $r30. Used by gcc for frame-pointer */
+restart:
+ PROC_FRAME_OFFSET (&temp_proc_desc) = 0;
+ PROC_FRAME_ADJUST (&temp_proc_desc) = 0; /* offset of FP from SP */
+ for (cur_pc = start_pc; cur_pc < limit_pc; cur_pc += MIPS_INSTLEN)
+ {
+ unsigned long inst, high_word, low_word;
+ int reg;
+
+ /* Fetch the instruction. */
+ inst = (unsigned long) mips_fetch_instruction (cur_pc);
+
+ /* Save some code by pre-extracting some useful fields. */
+ high_word = (inst >> 16) & 0xffff;
+ low_word = inst & 0xffff;
+ reg = high_word & 0x1f;
+
+ if (high_word == 0x27bd /* addiu $sp,$sp,-i */
+ || high_word == 0x23bd /* addi $sp,$sp,-i */
+ || high_word == 0x67bd) /* daddiu $sp,$sp,-i */
+ {
+ if (low_word & 0x8000) /* negative stack adjustment? */
+ PROC_FRAME_OFFSET (&temp_proc_desc) += 0x10000 - low_word;
+ else
+ /* Exit loop if a positive stack adjustment is found, which
+ usually means that the stack cleanup code in the function
+ epilogue is reached. */
+ break;
+ }
+ else if ((high_word & 0xFFE0) == 0xafa0) /* sw reg,offset($sp) */
+ {
+ PROC_REG_MASK (&temp_proc_desc) |= 1 << reg;
+ set_reg_offset (this_cache, reg, sp + low_word);
+ }
+ else if ((high_word & 0xFFE0) == 0xffa0) /* sd reg,offset($sp) */
+ {
+ /* Irix 6.2 N32 ABI uses sd instructions for saving $gp and
+ $ra. */
+ PROC_REG_MASK (&temp_proc_desc) |= 1 << reg;
+ set_reg_offset (this_cache, reg, sp + low_word);
+ }
+ else if (high_word == 0x27be) /* addiu $30,$sp,size */
+ {
+ /* Old gcc frame, r30 is virtual frame pointer. */
+ if ((long) low_word != PROC_FRAME_OFFSET (&temp_proc_desc))
+ frame_addr = sp + low_word;
+ else if (PROC_FRAME_REG (&temp_proc_desc) == MIPS_SP_REGNUM)
+ {
+ unsigned alloca_adjust;
+ PROC_FRAME_REG (&temp_proc_desc) = 30;
+ frame_addr = read_next_frame_reg (next_frame, NUM_REGS + 30);
+ alloca_adjust = (unsigned) (frame_addr - (sp + low_word));
+ if (alloca_adjust > 0)
+ {
+ /* FP > SP + frame_size. This may be because
+ * of an alloca or somethings similar.
+ * Fix sp to "pre-alloca" value, and try again.
+ */
+ sp += alloca_adjust;
+ goto restart;
+ }
+ }
+ }
+ /* move $30,$sp. With different versions of gas this will be either
+ `addu $30,$sp,$zero' or `or $30,$sp,$zero' or `daddu 30,sp,$0'.
+ Accept any one of these. */
+ else if (inst == 0x03A0F021 || inst == 0x03a0f025 || inst == 0x03a0f02d)
+ {
+ /* New gcc frame, virtual frame pointer is at r30 + frame_size. */
+ if (PROC_FRAME_REG (&temp_proc_desc) == MIPS_SP_REGNUM)
+ {
+ unsigned alloca_adjust;
+ PROC_FRAME_REG (&temp_proc_desc) = 30;
+ frame_addr = read_next_frame_reg (next_frame, NUM_REGS + 30);
+ alloca_adjust = (unsigned) (frame_addr - sp);
+ if (alloca_adjust > 0)
+ {
+ /* FP > SP + frame_size. This may be because
+ * of an alloca or somethings similar.
+ * Fix sp to "pre-alloca" value, and try again.
+ */
+ sp += alloca_adjust;
+ goto restart;
+ }
+ }
+ }
+ else if ((high_word & 0xFFE0) == 0xafc0) /* sw reg,offset($30) */
+ {
+ PROC_REG_MASK (&temp_proc_desc) |= 1 << reg;
+ set_reg_offset (this_cache, reg, frame_addr + low_word);
+ }
+ }
+}
+
static mips_extra_func_info_t
heuristic_proc_desc (CORE_ADDR start_pc, CORE_ADDR limit_pc,
struct frame_info *next_frame,
struct mips_frame_cache *this_cache)
{
+ CORE_ADDR sp;
+
+ /* Can be called when there's no process, and hence when there's no
+ NEXT_FRAME. */
+ if (next_frame != NULL)
+ sp = read_next_frame_reg (next_frame, NUM_REGS + MIPS_SP_REGNUM);
+ else
+ sp = 0;
+
if (start_pc == 0)
return NULL;
-
memset (&temp_proc_desc, '\0', sizeof (temp_proc_desc));
PROC_LOW_ADDR (&temp_proc_desc) = start_pc;
PROC_FRAME_REG (&temp_proc_desc) = MIPS_SP_REGNUM;
PROC_PC_REG (&temp_proc_desc) = RA_REGNUM;
+ if (start_pc + 200 < limit_pc)
+ limit_pc = start_pc + 200;
if (pc_is_mips16 (start_pc))
- mips16_scan_prologue (start_pc, limit_pc, next_frame, this_cache);
+ mips16_heuristic_proc_desc (start_pc, limit_pc, sp,
+ next_frame, this_cache);
else
- mips32_scan_prologue (start_pc, limit_pc, next_frame, this_cache);
-
+ mips32_heuristic_proc_desc (start_pc, limit_pc, sp,
+ next_frame, this_cache);
return &temp_proc_desc;
}
@@ -4975,6 +5174,199 @@ mips_step_skips_delay (CORE_ADDR pc)
extract_unsigned_integer (buf, MIPS_INSTLEN));
}
+/* Skip the PC past function prologue instructions (32-bit version).
+ This is a helper function for mips_skip_prologue. */
+
+static CORE_ADDR
+mips32_skip_prologue (CORE_ADDR pc)
+{
+ t_inst inst;
+ CORE_ADDR end_pc;
+ int seen_sp_adjust = 0;
+ int load_immediate_bytes = 0;
+
+ /* Find an upper bound on the prologue. */
+ end_pc = skip_prologue_using_sal (pc);
+ if (end_pc == 0)
+ end_pc = pc + 100; /* Magic. */
+
+ /* Skip the typical prologue instructions. These are the stack adjustment
+ instruction and the instructions that save registers on the stack
+ or in the gcc frame. */
+ for (; pc < end_pc; pc += MIPS_INSTLEN)
+ {
+ unsigned long high_word;
+
+ inst = mips_fetch_instruction (pc);
+ high_word = (inst >> 16) & 0xffff;
+
+ if (high_word == 0x27bd /* addiu $sp,$sp,offset */
+ || high_word == 0x67bd) /* daddiu $sp,$sp,offset */
+ seen_sp_adjust = 1;
+ else if (inst == 0x03a1e823 || /* subu $sp,$sp,$at */
+ inst == 0x03a8e823) /* subu $sp,$sp,$t0 */
+ seen_sp_adjust = 1;
+ else if (((inst & 0xFFE00000) == 0xAFA00000 /* sw reg,n($sp) */
+ || (inst & 0xFFE00000) == 0xFFA00000) /* sd reg,n($sp) */
+ && (inst & 0x001F0000)) /* reg != $zero */
+ continue;
+
+ else if ((inst & 0xFFE00000) == 0xE7A00000) /* swc1 freg,n($sp) */
+ continue;
+ else if ((inst & 0xF3E00000) == 0xA3C00000 && (inst & 0x001F0000))
+ /* sx reg,n($s8) */
+ continue; /* reg != $zero */
+
+ /* move $s8,$sp. With different versions of gas this will be either
+ `addu $s8,$sp,$zero' or `or $s8,$sp,$zero' or `daddu s8,sp,$0'.
+ Accept any one of these. */
+ else if (inst == 0x03A0F021 || inst == 0x03a0f025 || inst == 0x03a0f02d)
+ continue;
+
+ else if ((inst & 0xFF9F07FF) == 0x00800021) /* move reg,$a0-$a3 */
+ continue;
+ else if (high_word == 0x3c1c) /* lui $gp,n */
+ continue;
+ else if (high_word == 0x279c) /* addiu $gp,$gp,n */
+ continue;
+ else if (inst == 0x0399e021 /* addu $gp,$gp,$t9 */
+ || inst == 0x033ce021) /* addu $gp,$t9,$gp */
+ continue;
+ /* The following instructions load $at or $t0 with an immediate
+ value in preparation for a stack adjustment via
+ subu $sp,$sp,[$at,$t0]. These instructions could also initialize
+ a local variable, so we accept them only before a stack adjustment
+ instruction was seen. */
+ else if (!seen_sp_adjust)
+ {
+ if (high_word == 0x3c01 || /* lui $at,n */
+ high_word == 0x3c08) /* lui $t0,n */
+ {
+ load_immediate_bytes += MIPS_INSTLEN; /* FIXME!! */
+ continue;
+ }
+ else if (high_word == 0x3421 || /* ori $at,$at,n */
+ high_word == 0x3508 || /* ori $t0,$t0,n */
+ high_word == 0x3401 || /* ori $at,$zero,n */
+ high_word == 0x3408) /* ori $t0,$zero,n */
+ {
+ load_immediate_bytes += MIPS_INSTLEN; /* FIXME!! */
+ continue;
+ }
+ else
+ break;
+ }
+ else
+ break;
+ }
+
+ /* In a frameless function, we might have incorrectly
+ skipped some load immediate instructions. Undo the skipping
+ if the load immediate was not followed by a stack adjustment. */
+ if (load_immediate_bytes && !seen_sp_adjust)
+ pc -= load_immediate_bytes;
+ return pc;
+}
+
+/* Skip the PC past function prologue instructions (16-bit version).
+ This is a helper function for mips_skip_prologue. */
+
+static CORE_ADDR
+mips16_skip_prologue (CORE_ADDR pc)
+{
+ CORE_ADDR end_pc;
+ int extend_bytes = 0;
+ int prev_extend_bytes;
+
+ /* Table of instructions likely to be found in a function prologue. */
+ static struct
+ {
+ unsigned short inst;
+ unsigned short mask;
+ }
+ table[] =
+ {
+ {
+ 0x6300, 0xff00}
+ , /* addiu $sp,offset */
+ {
+ 0xfb00, 0xff00}
+ , /* daddiu $sp,offset */
+ {
+ 0xd000, 0xf800}
+ , /* sw reg,n($sp) */
+ {
+ 0xf900, 0xff00}
+ , /* sd reg,n($sp) */
+ {
+ 0x6200, 0xff00}
+ , /* sw $ra,n($sp) */
+ {
+ 0xfa00, 0xff00}
+ , /* sd $ra,n($sp) */
+ {
+ 0x673d, 0xffff}
+ , /* move $s1,sp */
+ {
+ 0xd980, 0xff80}
+ , /* sw $a0-$a3,n($s1) */
+ {
+ 0x6704, 0xff1c}
+ , /* move reg,$a0-$a3 */
+ {
+ 0xe809, 0xf81f}
+ , /* entry pseudo-op */
+ {
+ 0x0100, 0xff00}
+ , /* addiu $s1,$sp,n */
+ {
+ 0, 0} /* end of table marker */
+ };
+
+ /* Find an upper bound on the prologue. */
+ end_pc = skip_prologue_using_sal (pc);
+ if (end_pc == 0)
+ end_pc = pc + 100; /* Magic. */
+
+ /* Skip the typical prologue instructions. These are the stack adjustment
+ instruction and the instructions that save registers on the stack
+ or in the gcc frame. */
+ for (; pc < end_pc; pc += MIPS16_INSTLEN)
+ {
+ unsigned short inst;
+ int i;
+
+ inst = mips_fetch_instruction (pc);
+
+ /* Normally we ignore an extend instruction. However, if it is
+ not followed by a valid prologue instruction, we must adjust
+ the pc back over the extend so that it won't be considered
+ part of the prologue. */
+ if ((inst & 0xf800) == 0xf000) /* extend */
+ {
+ extend_bytes = MIPS16_INSTLEN;
+ continue;
+ }
+ prev_extend_bytes = extend_bytes;
+ extend_bytes = 0;
+
+ /* Check for other valid prologue instructions besides extend. */
+ for (i = 0; table[i].mask != 0; i++)
+ if ((inst & table[i].mask) == table[i].inst) /* found, get out */
+ break;
+ if (table[i].mask != 0) /* it was in table? */
+ continue; /* ignore it */
+ else
+ /* non-prologue */
+ {
+ /* Return the current pc, adjusted backwards by 2 if
+ the previous instruction was an extend. */
+ return pc - prev_extend_bytes;
+ }
+ }
+ return pc;
+}
+
/* To skip prologues, I use this predicate. Returns either PC itself
if the code at PC does not look like a function prologue; otherwise
returns an address that (if we're lucky) follows the prologue. If
@@ -4992,7 +5384,6 @@ mips_skip_prologue (CORE_ADDR pc)
is greater. */
CORE_ADDR post_prologue_pc = after_prologue (pc);
- CORE_ADDR limit_pc;
if (post_prologue_pc != 0)
return max (pc, post_prologue_pc);
@@ -5000,17 +5391,10 @@ mips_skip_prologue (CORE_ADDR pc)
/* Can't determine prologue from the symbol table, need to examine
instructions. */
- /* Find an upper limit on the function prologue using the debug
- information. If the debug information could not be used to provide
- that bound, then use an arbitrary large number as the upper bound. */
- limit_pc = skip_prologue_using_sal (pc);
- if (limit_pc == 0)
- limit_pc = pc + 100; /* Magic. */
-
if (pc_is_mips16 (pc))
- return mips16_scan_prologue (pc, limit_pc, NULL, NULL);
+ return mips16_skip_prologue (pc);
else
- return mips32_scan_prologue (pc, limit_pc, NULL, NULL);
+ return mips32_skip_prologue (pc);
}
/* Root of all "set mips "/"show mips " commands. This will eventually be
diff --git a/gdb/monitor.c b/gdb/monitor.c
index 5e50713..0fb44a1 100644
--- a/gdb/monitor.c
+++ b/gdb/monitor.c
@@ -2256,7 +2256,7 @@ init_base_monitor_ops (void)
monitor_ops.to_fetch_registers = monitor_fetch_registers;
monitor_ops.to_store_registers = monitor_store_registers;
monitor_ops.to_prepare_to_store = monitor_prepare_to_store;
- monitor_ops.deprecated_xfer_memory = monitor_xfer_memory;
+ monitor_ops.to_xfer_memory = monitor_xfer_memory;
monitor_ops.to_files_info = monitor_files_info;
monitor_ops.to_insert_breakpoint = monitor_insert_breakpoint;
monitor_ops.to_remove_breakpoint = monitor_remove_breakpoint;
diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
index 227d4e3..9101566 100644
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -1272,7 +1272,7 @@ init_procfs_ops (void)
procfs_ops.to_fetch_registers = procfs_fetch_registers;
procfs_ops.to_store_registers = procfs_store_registers;
procfs_ops.to_prepare_to_store = procfs_prepare_to_store;
- procfs_ops.deprecated_xfer_memory = procfs_xfer_memory;
+ procfs_ops.to_xfer_memory = procfs_xfer_memory;
procfs_ops.to_files_info = procfs_files_info;
procfs_ops.to_insert_breakpoint = procfs_insert_breakpoint;
procfs_ops.to_remove_breakpoint = procfs_remove_breakpoint;
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 3c4e0b4..69f61d4 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -184,7 +184,7 @@ allocate_objfile (bfd *abfd, int flags)
}
if (abfd != NULL)
{
- objfile->name = xstrdup (bfd_get_filename (abfd));
+ objfile->name = mstrsave (objfile->md, bfd_get_filename (abfd));
objfile->mtime = bfd_get_mtime (abfd);
/* Build section table. */
@@ -197,7 +197,7 @@ allocate_objfile (bfd *abfd, int flags)
}
else
{
- objfile->name = xstrdup ("<<anonymous objfile>>");
+ objfile->name = mstrsave (objfile->md, "<<anonymous objfile>>");
}
/* Initialize the section indexes for this objfile, so that we can
diff --git a/gdb/ppc-bdm.c b/gdb/ppc-bdm.c
index 16d2532..e7eefca 100644
--- a/gdb/ppc-bdm.c
+++ b/gdb/ppc-bdm.c
@@ -325,7 +325,7 @@ a wiggler, specify wiggler and then the port it is connected to\n\
bdm_ppc_ops.to_fetch_registers = bdm_ppc_fetch_registers;
bdm_ppc_ops.to_store_registers = bdm_ppc_store_registers;
bdm_ppc_ops.to_prepare_to_store = ocd_prepare_to_store;
- bdm_ppc_ops.deprecated_xfer_memory = ocd_xfer_memory;
+ bdm_ppc_ops.to_xfer_memory = ocd_xfer_memory;
bdm_ppc_ops.to_files_info = ocd_files_info;
bdm_ppc_ops.to_insert_breakpoint = ocd_insert_breakpoint;
bdm_ppc_ops.to_remove_breakpoint = ocd_remove_breakpoint;
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 7e31a7f..0a1f152 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -172,7 +172,7 @@ init_procfs_ops (void)
procfs_ops.to_fetch_registers = procfs_fetch_registers;
procfs_ops.to_store_registers = procfs_store_registers;
procfs_ops.to_xfer_partial = procfs_xfer_partial;
- procfs_ops.deprecated_xfer_memory = procfs_xfer_memory;
+ procfs_ops.to_xfer_memory = procfs_xfer_memory;
procfs_ops.to_insert_breakpoint = memory_insert_breakpoint;
procfs_ops.to_remove_breakpoint = memory_remove_breakpoint;
procfs_ops.to_notice_signals = procfs_notice_signals;
@@ -4326,11 +4326,11 @@ procfs_xfer_partial (struct target_ops *ops, enum target_object object,
{
case TARGET_OBJECT_MEMORY:
if (readbuf)
- return (*ops->deprecated_xfer_memory) (offset, readbuf, len,
- 0/*write*/, NULL, ops);
+ return (*ops->to_xfer_memory) (offset, readbuf, len, 0/*write*/,
+ NULL, ops);
if (writebuf)
- return (*ops->deprecated_xfer_memory) (offset, writebuf, len,
- 1/*write*/, NULL, ops);
+ return (*ops->to_xfer_memory) (offset, readbuf, len, 1/*write*/,
+ NULL, ops);
return -1;
#ifdef NEW_PROC_API
diff --git a/gdb/regcache.c b/gdb/regcache.c
index f34da79..12721c3 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -616,8 +616,8 @@ regcache_raw_read (struct regcache *regcache, int regnum, void *buf)
target_fetch_registers (regnum);
#if 0
/* FIXME: cagney/2004-08-07: At present a number of targets
- forget (or didn't know that they needed) to set this leading to
- panics. Also is the problem that targets need to indicate
+ forget (or didn't know that they needed) set this leading to
+ panics. Also is the problem that target's need to indicate
that a register is in one of the possible states: valid,
undefined, unknown. The last of which isn't yet
possible. */
diff --git a/gdb/remote-e7000.c b/gdb/remote-e7000.c
index 405a6b5..965ea97 100644
--- a/gdb/remote-e7000.c
+++ b/gdb/remote-e7000.c
@@ -2150,7 +2150,7 @@ target e7000 foobar";
e7000_ops.to_fetch_registers = e7000_fetch_register;
e7000_ops.to_store_registers = e7000_store_register;
e7000_ops.to_prepare_to_store = e7000_prepare_to_store;
- e7000_ops.deprecated_xfer_memory = e7000_xfer_inferior_memory;
+ e7000_ops.to_xfer_memory = e7000_xfer_inferior_memory;
e7000_ops.to_files_info = e7000_files_info;
e7000_ops.to_insert_breakpoint = e7000_insert_breakpoint;
e7000_ops.to_remove_breakpoint = e7000_remove_breakpoint;
diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c
index cca045e..a2fc046 100644
--- a/gdb/remote-m32r-sdi.c
+++ b/gdb/remote-m32r-sdi.c
@@ -1450,23 +1450,16 @@ m32r_remove_watchpoint (CORE_ADDR addr, int len, int type)
return 0;
}
-int
-m32r_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p)
+CORE_ADDR
+m32r_stopped_data_address (void)
{
- int rc = 0;
- if (hit_watchpoint_addr != 0x00000000)
- {
- *addr_p = hit_watchpoint_addr;
- rc = 1;
- }
- return rc;
+ return hit_watchpoint_addr;
}
int
m32r_stopped_by_watchpoint (void)
{
- CORE_ADDR addr;
- return m32r_stopped_data_address (&current_target, &addr);
+ return (hit_watchpoint_addr != 0x00000000);
}
@@ -1575,7 +1568,7 @@ init_m32r_ops (void)
m32r_ops.to_fetch_registers = m32r_fetch_register;
m32r_ops.to_store_registers = m32r_store_register;
m32r_ops.to_prepare_to_store = m32r_prepare_to_store;
- m32r_ops.deprecated_xfer_memory = m32r_xfer_memory;
+ m32r_ops.to_xfer_memory = m32r_xfer_memory;
m32r_ops.to_files_info = m32r_files_info;
m32r_ops.to_insert_breakpoint = m32r_insert_breakpoint;
m32r_ops.to_remove_breakpoint = m32r_remove_breakpoint;
diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c
index 175a4f9..b7dc35e 100644
--- a/gdb/remote-mips.c
+++ b/gdb/remote-mips.c
@@ -3306,7 +3306,7 @@ _initialize_remote_mips (void)
mips_ops.to_fetch_registers = mips_fetch_registers;
mips_ops.to_store_registers = mips_store_registers;
mips_ops.to_prepare_to_store = mips_prepare_to_store;
- mips_ops.deprecated_xfer_memory = mips_xfer_memory;
+ mips_ops.to_xfer_memory = mips_xfer_memory;
mips_ops.to_files_info = mips_files_info;
mips_ops.to_insert_breakpoint = mips_insert_breakpoint;
mips_ops.to_remove_breakpoint = mips_remove_breakpoint;
diff --git a/gdb/remote-rdi.c b/gdb/remote-rdi.c
index 2571b78..1c14a03 100644
--- a/gdb/remote-rdi.c
+++ b/gdb/remote-rdi.c
@@ -895,7 +895,7 @@ Specify the serial device it is connected to (e.g. /dev/ttya).";
arm_rdi_ops.to_fetch_registers = arm_rdi_fetch_registers;
arm_rdi_ops.to_store_registers = arm_rdi_store_registers;
arm_rdi_ops.to_prepare_to_store = arm_rdi_prepare_to_store;
- arm_rdi_ops.deprecated_xfer_memory = arm_rdi_xfer_memory;
+ arm_rdi_ops.to_xfer_memory = arm_rdi_xfer_memory;
arm_rdi_ops.to_files_info = arm_rdi_files_info;
arm_rdi_ops.to_insert_breakpoint = arm_rdi_insert_breakpoint;
arm_rdi_ops.to_remove_breakpoint = arm_rdi_remove_breakpoint;
diff --git a/gdb/remote-rdp.c b/gdb/remote-rdp.c
index d480d53..2068311 100644
--- a/gdb/remote-rdp.c
+++ b/gdb/remote-rdp.c
@@ -1405,7 +1405,7 @@ init_remote_rdp_ops (void)
remote_rdp_ops.to_fetch_registers = remote_rdp_fetch_register;
remote_rdp_ops.to_store_registers = remote_rdp_store_register;
remote_rdp_ops.to_prepare_to_store = remote_rdp_prepare_to_store;
- remote_rdp_ops.deprecated_xfer_memory = remote_rdp_xfer_inferior_memory;
+ remote_rdp_ops.to_xfer_memory = remote_rdp_xfer_inferior_memory;
remote_rdp_ops.to_files_info = remote_rdp_files_info;
remote_rdp_ops.to_insert_breakpoint = remote_rdp_insert_breakpoint;
remote_rdp_ops.to_remove_breakpoint = remote_rdp_remove_breakpoint;
diff --git a/gdb/remote-sds.c b/gdb/remote-sds.c
index 0bf1c01..5b4b389 100644
--- a/gdb/remote-sds.c
+++ b/gdb/remote-sds.c
@@ -1061,7 +1061,7 @@ Specify the serial device it is connected to (e.g. /dev/ttya).";
sds_ops.to_fetch_registers = sds_fetch_registers;
sds_ops.to_store_registers = sds_store_registers;
sds_ops.to_prepare_to_store = sds_prepare_to_store;
- sds_ops.deprecated_xfer_memory = sds_xfer_memory;
+ sds_ops.to_xfer_memory = sds_xfer_memory;
sds_ops.to_files_info = sds_files_info;
sds_ops.to_insert_breakpoint = sds_insert_breakpoint;
sds_ops.to_remove_breakpoint = sds_remove_breakpoint;
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index 9e377ae..7a5c7b0 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -863,7 +863,7 @@ init_gdbsim_ops (void)
gdbsim_ops.to_fetch_registers = gdbsim_fetch_register;
gdbsim_ops.to_store_registers = gdbsim_store_register;
gdbsim_ops.to_prepare_to_store = gdbsim_prepare_to_store;
- gdbsim_ops.deprecated_xfer_memory = gdbsim_xfer_inferior_memory;
+ gdbsim_ops.to_xfer_memory = gdbsim_xfer_inferior_memory;
gdbsim_ops.to_files_info = gdbsim_files_info;
gdbsim_ops.to_insert_breakpoint = gdbsim_insert_breakpoint;
gdbsim_ops.to_remove_breakpoint = gdbsim_remove_breakpoint;
diff --git a/gdb/remote-st.c b/gdb/remote-st.c
index a71998c..eba847f 100644
--- a/gdb/remote-st.c
+++ b/gdb/remote-st.c
@@ -775,7 +775,7 @@ the speed to connect at in bits per second.";
st2000_ops.to_fetch_registers = st2000_fetch_register;
st2000_ops.to_store_registers = st2000_store_register;
st2000_ops.to_prepare_to_store = st2000_prepare_to_store;
- st2000_ops.deprecated_xfer_memory = st2000_xfer_inferior_memory;
+ st2000_ops.to_xfer_memory = st2000_xfer_inferior_memory;
st2000_ops.to_files_info = st2000_files_info;
st2000_ops.to_insert_breakpoint = st2000_insert_breakpoint;
st2000_ops.to_remove_breakpoint = st2000_remove_breakpoint; /* Breakpoints */
diff --git a/gdb/remote-vx.c b/gdb/remote-vx.c
index 76baff5..de5cc03 100644
--- a/gdb/remote-vx.c
+++ b/gdb/remote-vx.c
@@ -1343,7 +1343,7 @@ Specify the name of the machine to connect to.";
vx_ops.to_open = vx_open;
vx_ops.to_close = vx_close;
vx_ops.to_attach = vx_attach;
- vx_ops.deprecated_xfer_memory = vx_xfer_memory;
+ vx_ops.to_xfer_memory = vx_xfer_memory;
vx_ops.to_files_info = vx_files_info;
vx_ops.to_load = vx_load_command;
vx_ops.to_lookup_symbol = vx_lookup_symbol;
@@ -1368,7 +1368,7 @@ init_vx_run_ops (void)
vx_run_ops.to_fetch_registers = vx_read_register;
vx_run_ops.to_store_registers = vx_write_register;
vx_run_ops.to_prepare_to_store = vx_prepare_to_store;
- vx_run_ops.deprecated_xfer_memory = vx_xfer_memory;
+ vx_run_ops.to_xfer_memory = vx_xfer_memory;
vx_run_ops.to_files_info = vx_run_files_info;
vx_run_ops.to_insert_breakpoint = vx_insert_breakpoint;
vx_run_ops.to_remove_breakpoint = vx_remove_breakpoint;
diff --git a/gdb/remote.c b/gdb/remote.c
index c389c4a..497f972 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -961,23 +961,6 @@ show_remote_protocol_qPart_auxv_packet_cmd (char *args, int from_tty,
show_packet_config_cmd (&remote_protocol_qPart_auxv);
}
-static struct packet_config remote_protocol_p;
-
-static void
-set_remote_protocol_p_packet_cmd (char *args, int from_tty,
- struct cmd_list_element *c)
-{
- update_packet_config (&remote_protocol_p);
-}
-
-static void
-show_remote_protocol_p_packet_cmd (char *args, int from_tty,
- struct cmd_list_element *c)
-{
- show_packet_config_cmd (&remote_protocol_p);
-}
-
-
/* Tokens for use by the asynchronous signal handlers for SIGINT */
static void *sigint_remote_twice_token;
@@ -2058,7 +2041,6 @@ init_all_packet_configs (void)
{
int i;
update_packet_config (&remote_protocol_P);
- update_packet_config (&remote_protocol_p);
update_packet_config (&remote_protocol_qSymbol);
update_packet_config (&remote_protocol_vcont);
for (i = 0; i < NR_Z_PACKET_TYPES; i++)
@@ -3168,36 +3150,6 @@ static int register_bytes_found;
/* Read the remote registers into the block REGS. */
/* Currently we just read all the registers, so we don't use regnum. */
-static int
-fetch_register_using_p (int regnum)
-{
- struct remote_state *rs = get_remote_state ();
- char *buf = alloca (rs->remote_packet_size), *p;
- char regp[MAX_REGISTER_SIZE];
- int i;
-
- buf[0] = 'p';
- bin2hex((char *) &regnum, &buf[1], sizeof(regnum));
- buf[9] = 0;
- remote_send (buf, rs->remote_packet_size);
- if (buf[0] != 0 && buf[0] != 'E') {
- p = buf;
- i = 0;
- while (p[0] != 0) {
- if (p[1] == 0) {
- error("fetch_register_using_p: early buf termination");
- return 0;
- }
- regp[i++] = fromhex (p[0]) * 16 + fromhex (p[1]);
- p += 2;
- }
- regcache_raw_supply (current_regcache, regnum, regp);
- return 1;
- }
-
- return 0;
-}
-
static void
remote_fetch_registers (int regnum)
{
@@ -3218,31 +3170,6 @@ remote_fetch_registers (int regnum)
"Attempt to fetch a non G-packet register when this "
"remote.c does not support the p-packet.");
}
- switch (remote_protocol_p.support)
- {
- case PACKET_DISABLE:
- break;
- case PACKET_ENABLE:
- if (fetch_register_using_p (regnum))
- return;
- else
- error ("Protocol error: p packet not recognized by stub");
- case PACKET_SUPPORT_UNKNOWN:
- if (fetch_register_using_p (regnum))
- {
- /* The stub recognized the 'p' packet. Remember this. */
- remote_protocol_p.support = PACKET_ENABLE;
- return;
- }
- else
- {
- /* The stub does not support the 'P' packet. Use 'G'
- instead, and don't try using 'P' in the future (it
- will just waste our time). */
- remote_protocol_p.support = PACKET_DISABLE;
- break;
- }
- }
sprintf (buf, "g");
remote_send (buf, (rs->remote_packet_size));
@@ -4624,18 +4551,13 @@ remote_stopped_by_watchpoint (void)
extern int stepped_after_stopped_by_watchpoint;
-static int
-remote_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p)
+static CORE_ADDR
+remote_stopped_data_address (void)
{
- int rc = 0;
if (remote_stopped_by_watchpoint ()
|| stepped_after_stopped_by_watchpoint)
- {
- *addr_p = remote_watch_data_address;
- rc = 1;
- }
-
- return rc;
+ return remote_watch_data_address;
+ return (CORE_ADDR)0;
}
@@ -4869,31 +4791,6 @@ remote_xfer_partial (struct target_ops *ops, enum target_object object,
char *p2 = &buf2[0];
char query_type;
- /* Handle memory using remote_xfer_memory. */
- if (object == TARGET_OBJECT_MEMORY)
- {
- int xfered;
- errno = 0;
-
- if (writebuf != NULL)
- {
- void *buffer = xmalloc (len);
- struct cleanup *cleanup = make_cleanup (xfree, buffer);
- memcpy (buffer, writebuf, len);
- xfered = remote_xfer_memory (offset, buffer, len, 1, NULL, ops);
- do_cleanups (cleanup);
- }
- else
- xfered = remote_xfer_memory (offset, readbuf, len, 0, NULL, ops);
-
- if (xfered > 0)
- return xfered;
- else if (xfered == 0 && errno == 0)
- return 0;
- else
- return -1;
- }
-
/* Only handle reads. */
if (writebuf != NULL || readbuf == NULL)
return -1;
@@ -5247,7 +5144,7 @@ Specify the serial device it is connected to\n\
remote_ops.to_fetch_registers = remote_fetch_registers;
remote_ops.to_store_registers = remote_store_registers;
remote_ops.to_prepare_to_store = remote_prepare_to_store;
- remote_ops.deprecated_xfer_memory = remote_xfer_memory;
+ remote_ops.to_xfer_memory = remote_xfer_memory;
remote_ops.to_files_info = remote_files_info;
remote_ops.to_insert_breakpoint = remote_insert_breakpoint;
remote_ops.to_remove_breakpoint = remote_remove_breakpoint;
@@ -5367,7 +5264,7 @@ Specify the serial device it is connected to (e.g. /dev/ttya).";
remote_async_ops.to_fetch_registers = remote_fetch_registers;
remote_async_ops.to_store_registers = remote_store_registers;
remote_async_ops.to_prepare_to_store = remote_prepare_to_store;
- remote_async_ops.deprecated_xfer_memory = remote_xfer_memory;
+ remote_async_ops.to_xfer_memory = remote_xfer_memory;
remote_async_ops.to_files_info = remote_files_info;
remote_async_ops.to_insert_breakpoint = remote_insert_breakpoint;
remote_async_ops.to_remove_breakpoint = remote_remove_breakpoint;
@@ -5435,7 +5332,6 @@ show_remote_cmd (char *args, int from_tty)
remote_show_cmdlist for a list of sub commands to show. */
show_remote_protocol_Z_packet_cmd (args, from_tty, NULL);
show_remote_protocol_P_packet_cmd (args, from_tty, NULL);
- show_remote_protocol_p_packet_cmd (args, from_tty, NULL);
show_remote_protocol_qSymbol_packet_cmd (args, from_tty, NULL);
show_remote_protocol_vcont_packet_cmd (args, from_tty, NULL);
show_remote_protocol_binary_download_cmd (args, from_tty, NULL);
@@ -5632,13 +5528,6 @@ in a memory packet.\n",
&remote_set_cmdlist, &remote_show_cmdlist,
1);
- add_packet_config_cmd (&remote_protocol_p,
- "p", "fetch-register",
- set_remote_protocol_p_packet_cmd,
- show_remote_protocol_p_packet_cmd,
- &remote_set_cmdlist, &remote_show_cmdlist,
- 1);
-
add_packet_config_cmd (&remote_protocol_Z[Z_PACKET_SOFTWARE_BP],
"Z0", "software-breakpoint",
set_remote_protocol_Z_software_bp_packet_cmd,
diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c
index df36076..59067c6 100644
--- a/gdb/rs6000-nat.c
+++ b/gdb/rs6000-nat.c
@@ -442,10 +442,10 @@ read_word (CORE_ADDR from, int *to, int arch64)
to debugger memory starting at MYADDR. Copy to inferior if
WRITE is nonzero.
- Returns the length copied, which is either the LEN argument or
- zero. This xfer function does not do partial moves, since
- deprecated_child_ops doesn't allow memory operations to cross below
- us in the target stack anyway. */
+ Returns the length copied, which is either the LEN argument or zero.
+ This xfer function does not do partial moves, since child_ops
+ doesn't allow memory operations to cross below us in the target stack
+ anyway. */
int
child_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len,
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 37988a3..36741c5 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -1478,11 +1478,14 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
There are 13 fpr's reserved for passing parameters. At this point
there is no way we would run out of them. */
- gdb_assert (len <= 8);
-
- regcache_cooked_write (regcache,
- tdep->ppc_fp0_regnum + 1 + f_argno,
- VALUE_CONTENTS (arg));
+ if (len > 8)
+ printf_unfiltered ("Fatal Error: a floating point parameter "
+ "#%d with a size > 8 is found!\n", argno);
+
+ memcpy (&deprecated_registers[DEPRECATED_REGISTER_BYTE
+ (tdep->ppc_fp0_regnum + 1 + f_argno)],
+ VALUE_CONTENTS (arg),
+ len);
++f_argno;
}
@@ -1492,15 +1495,12 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Argument takes more than one register. */
while (argbytes < len)
{
- char word[MAX_REGISTER_SIZE];
- memset (word, 0, reg_size);
- memcpy (word,
+ memset (&deprecated_registers[DEPRECATED_REGISTER_BYTE (ii + 3)], 0,
+ reg_size);
+ memcpy (&deprecated_registers[DEPRECATED_REGISTER_BYTE (ii + 3)],
((char *) VALUE_CONTENTS (arg)) + argbytes,
(len - argbytes) > reg_size
? reg_size : len - argbytes);
- regcache_cooked_write (regcache,
- tdep->ppc_gp0_regnum + 3 + ii,
- word);
++ii, argbytes += reg_size;
if (ii >= 8)
@@ -1513,11 +1513,9 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{
/* Argument can fit in one register. No problem. */
int adj = TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? reg_size - len : 0;
- char word[MAX_REGISTER_SIZE];
-
- memset (word, 0, reg_size);
- memcpy (word, VALUE_CONTENTS (arg), len);
- regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 3 +ii, word);
+ memset (&deprecated_registers[DEPRECATED_REGISTER_BYTE (ii + 3)], 0, reg_size);
+ memcpy ((char *)&deprecated_registers[DEPRECATED_REGISTER_BYTE (ii + 3)] + adj,
+ VALUE_CONTENTS (arg), len);
}
++argno;
}
@@ -1594,11 +1592,15 @@ ran_out_of_registers_for_arguments:
if (TYPE_CODE (type) == TYPE_CODE_FLT && f_argno < 13)
{
- gdb_assert (len <= 8);
+ if (len > 8)
+ printf_unfiltered ("Fatal Error: a floating point parameter"
+ " #%d with a size > 8 is found!\n", argno);
- regcache_cooked_write (regcache,
- tdep->ppc_fp0_regnum + 1 + f_argno,
- VALUE_CONTENTS (arg));
+ memcpy (&(deprecated_registers
+ [DEPRECATED_REGISTER_BYTE
+ (tdep->ppc_fp0_regnum + 1 + f_argno)]),
+ VALUE_CONTENTS (arg),
+ len);
++f_argno;
}
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index 48e994d..03ef25c 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -56,7 +56,7 @@
static void (*sh_show_regs) (void);
-#define SH_NUM_REGS 67
+#define SH_NUM_REGS 59
struct sh_frame_cache
{
@@ -86,7 +86,6 @@ sh_sh_register_name (int reg_nr)
"", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
};
if (reg_nr < 0)
return NULL;
@@ -108,7 +107,6 @@ sh_sh3_register_name (int reg_nr)
"ssr", "spc",
"r0b0", "r1b0", "r2b0", "r3b0", "r4b0", "r5b0", "r6b0", "r7b0",
"r0b1", "r1b1", "r2b1", "r3b1", "r4b1", "r5b1", "r6b1", "r7b1"
- "", "", "", "", "", "", "", "",
};
if (reg_nr < 0)
return NULL;
@@ -130,7 +128,6 @@ sh_sh3e_register_name (int reg_nr)
"ssr", "spc",
"r0b0", "r1b0", "r2b0", "r3b0", "r4b0", "r5b0", "r6b0", "r7b0",
"r0b1", "r1b1", "r2b1", "r3b1", "r4b1", "r5b1", "r6b1", "r7b1",
- "", "", "", "", "", "", "", "",
};
if (reg_nr < 0)
return NULL;
@@ -152,87 +149,6 @@ sh_sh2e_register_name (int reg_nr)
"", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- };
- if (reg_nr < 0)
- return NULL;
- if (reg_nr >= (sizeof (register_names) / sizeof (*register_names)))
- return NULL;
- return register_names[reg_nr];
-}
-
-static const char *
-sh_sh2a_register_name (int reg_nr)
-{
- static char *register_names[] = {
- /* general registers 0-15 */
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
- /* 16 - 22 */
- "pc", "pr", "gbr", "vbr", "mach", "macl", "sr",
- /* 23, 24 */
- "fpul", "fpscr",
- /* floating point registers 25 - 40 */
- "fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7",
- "fr8", "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15",
- /* 41, 42 */
- "", "",
- /* 43 - 62. Banked registers. The bank number used is determined by
- the bank register (63). */
- "r0b", "r1b", "r2b", "r3b", "r4b", "r5b", "r6b", "r7b",
- "r8b", "r9b", "r10b", "r11b", "r12b", "r13b", "r14b",
- "machb", "ivnb", "prb", "gbrb", "maclb",
- /* 63: register bank number, not a real register but used to
- communicate the register bank currently get/set. This register
- is hidden to the user, who manipulates it using the pseudo
- register called "bank" (67). See below. */
- "",
- /* 64 - 66 */
- "ibcr", "ibnr", "tbr",
- /* 67: register bank number, the user visible pseudo register. */
- "bank",
- /* double precision (pseudo) 68 - 75 */
- "dr0", "dr2", "dr4", "dr6", "dr8", "dr10", "dr12", "dr14",
- };
- if (reg_nr < 0)
- return NULL;
- if (reg_nr >= (sizeof (register_names) / sizeof (*register_names)))
- return NULL;
- return register_names[reg_nr];
-}
-
-static const char *
-sh_sh2a_nofpu_register_name (int reg_nr)
-{
- static char *register_names[] = {
- /* general registers 0-15 */
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
- /* 16 - 22 */
- "pc", "pr", "gbr", "vbr", "mach", "macl", "sr",
- /* 23, 24 */
- "", "",
- /* floating point registers 25 - 40 */
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- /* 41, 42 */
- "", "",
- /* 43 - 62. Banked registers. The bank number used is determined by
- the bank register (63). */
- "r0b", "r1b", "r2b", "r3b", "r4b", "r5b", "r6b", "r7b",
- "r8b", "r9b", "r10b", "r11b", "r12b", "r13b", "r14b",
- "machb", "ivnb", "prb", "gbrb", "maclb",
- /* 63: register bank number, not a real register but used to
- communicate the register bank currently get/set. This register
- is hidden to the user, who manipulates it using the pseudo
- register called "bank" (67). See below. */
- "",
- /* 64 - 66 */
- "ibcr", "ibnr", "tbr",
- /* 67: register bank number, the user visible pseudo register. */
- "bank",
- /* double precision (pseudo) 68 - 75 */
- "", "", "", "", "", "", "", "",
};
if (reg_nr < 0)
return NULL;
@@ -254,7 +170,6 @@ sh_sh_dsp_register_name (int reg_nr)
"", "",
"rs", "re", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
};
if (reg_nr < 0)
return NULL;
@@ -277,7 +192,6 @@ sh_sh3_dsp_register_name (int reg_nr)
"rs", "re", "", "", "", "", "", "",
"r0b", "r1b", "r2b", "r3b", "r4b", "r5b", "r6b", "r7b",
"", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
};
if (reg_nr < 0)
return NULL;
@@ -306,9 +220,6 @@ sh_sh4_register_name (int reg_nr)
"r0b0", "r1b0", "r2b0", "r3b0", "r4b0", "r5b0", "r6b0", "r7b0",
/* bank 1 51 - 58 */
"r0b1", "r1b1", "r2b1", "r3b1", "r4b1", "r5b1", "r6b1", "r7b1",
- "", "", "", "", "", "", "", "",
- /* pseudo bank register. */
- "",
/* double precision (pseudo) 59 - 66 */
"dr0", "dr2", "dr4", "dr6", "dr8", "dr10", "dr12", "dr14",
/* vectors (pseudo) 67 - 70 */
@@ -343,9 +254,6 @@ sh_sh4_nofpu_register_name (int reg_nr)
"r0b0", "r1b0", "r2b0", "r3b0", "r4b0", "r5b0", "r6b0", "r7b0",
/* bank 1 51 - 58 */
"r0b1", "r1b1", "r2b1", "r3b1", "r4b1", "r5b1", "r6b1", "r7b1",
- "", "", "", "", "", "", "", "",
- /* pseudo bank register. */
- "",
/* double precision (pseudo) 59 - 66 -- not for nofpu target */
"", "", "", "", "", "", "", "",
/* vectors (pseudo) 67 - 70 -- not for nofpu target */
@@ -372,7 +280,6 @@ sh_sh4al_dsp_register_name (int reg_nr)
"rs", "re", "", "", "", "", "", "",
"r0b", "r1b", "r2b", "r3b", "r4b", "r5b", "r6b", "r7b",
"", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
};
if (reg_nr < 0)
return NULL;
@@ -411,10 +318,6 @@ sh_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
r15-4-->r15, PR-->(r15) */
#define IS_STS(x) ((x) == 0x4f22)
-/* STS.L MACL,@-r15 0100111100010010
- r15-4-->r15, MACL-->(r15) */
-#define IS_MACL_STS(x) ((x) == 0x4f12)
-
/* MOV.L Rm,@-r15 00101111mmmm0110
r15-4-->r15, Rm-->(R15) */
#define IS_PUSH(x) (((x) & 0xff0f) == 0x2f06)
@@ -462,8 +365,6 @@ sh_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
#define IS_MOVW_PCREL_TO_REG(x) (((x) & 0xf000) == 0x9000)
/* MOV.L @(disp*4,PC),Rn 1101nnnndddddddd */
#define IS_MOVL_PCREL_TO_REG(x) (((x) & 0xf000) == 0xd000)
-/* MOVI20 #imm20,Rn 0000nnnniiii0000 */
-#define IS_MOVI20(x) (((x) & 0xf00f) == 0x0000)
/* SUB Rn,R15 00111111nnnn1000 */
#define IS_SUB_REG_FROM_SP(x) (((x) & 0xff0f) == 0x3f08)
@@ -473,7 +374,6 @@ sh_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
#define IS_RESTORE_FP(x) ((x) == 0x6ef6)
#define IS_RTS(x) ((x) == 0x000b)
#define IS_LDS(x) ((x) == 0x4f26)
-#define IS_MACL_LDS(x) ((x) == 0x4f16)
#define IS_MOV_FP_SP(x) ((x) == 0x6fe3)
#define IS_ADD_REG_TO_FP(x) (((x) & 0xff0f) == 0x3e0c)
#define IS_ADD_IMM_FP(x) (((x) & 0xff00) == 0x7e00)
@@ -515,11 +415,6 @@ sh_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc,
cache->saved_regs[PR_REGNUM] = cache->sp_offset;
cache->sp_offset += 4;
}
- else if (IS_MACL_STS (inst))
- {
- cache->saved_regs[MACL_REGNUM] = cache->sp_offset;
- cache->sp_offset += 4;
- }
else if (IS_MOV_R3 (inst))
{
r3_val = ((inst & 0xff) ^ 0x80) - 0x80;
@@ -565,25 +460,6 @@ sh_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc,
}
}
}
- else if (IS_MOVI20 (inst))
- {
- if (sav_reg < 0)
- {
- reg = GET_TARGET_REG (inst);
- if (reg < 14)
- {
- sav_reg = reg;
- sav_offset = GET_SOURCE_REG (inst) << 16;
- /* MOVI20 is a 32 bit instruction! */
- pc += 2;
- sav_offset |= read_memory_unsigned_integer (pc, 2);
- /* Now sav_offset contains an unsigned 20 bit value.
- It must still get sign extended. */
- if (sav_offset & 0x00080000)
- sav_offset |= 0xfff00000;
- }
- }
- }
else if (IS_SUB_REG_FROM_SP (inst))
{
reg = GET_SOURCE_REG (inst);
@@ -1281,34 +1157,6 @@ sh3e_sh4_store_return_value (struct type *type, struct regcache *regcache,
sh_default_store_return_value (type, regcache, valbuf);
}
-static enum return_value_convention
-sh_return_value_nofpu (struct gdbarch *gdbarch, struct type *type,
- struct regcache *regcache,
- void *readbuf, const void *writebuf)
-{
- if (sh_use_struct_convention (0, type))
- return RETURN_VALUE_STRUCT_CONVENTION;
- if (writebuf)
- sh_default_store_return_value (type, regcache, writebuf);
- else if (readbuf)
- sh_default_extract_return_value (type, regcache, readbuf);
- return RETURN_VALUE_REGISTER_CONVENTION;
-}
-
-static enum return_value_convention
-sh_return_value_fpu (struct gdbarch *gdbarch, struct type *type,
- struct regcache *regcache,
- void *readbuf, const void *writebuf)
-{
- if (sh_use_struct_convention (0, type))
- return RETURN_VALUE_STRUCT_CONVENTION;
- if (writebuf)
- sh3e_sh4_store_return_value (type, regcache, writebuf);
- else if (readbuf)
- sh3e_sh4_extract_return_value (type, regcache, readbuf);
- return RETURN_VALUE_REGISTER_CONVENTION;
-}
-
/* Print the registers in a form similar to the E7000 */
static void
@@ -1403,141 +1251,6 @@ sh2e_show_regs (void)
}
static void
-sh2a_show_regs (void)
-{
- int pr = read_register (FPSCR_REGNUM) & 0x80000;
- printf_filtered ("PC=%s SR=%08lx PR=%08lx MACH=%08lx MACHL=%08lx\n",
- paddr (read_register (PC_REGNUM)),
- (long) read_register (SR_REGNUM),
- (long) read_register (PR_REGNUM),
- (long) read_register (MACH_REGNUM),
- (long) read_register (MACL_REGNUM));
-
- printf_filtered ("GBR=%08lx VBR=%08lx TBR=%08lx",
- (long) read_register (GBR_REGNUM),
- (long) read_register (VBR_REGNUM),
- (long) read_register (TBR_REGNUM));
- printf_filtered (" FPUL=%08lx FPSCR=%08lx\n",
- (long) read_register (FPUL_REGNUM),
- (long) read_register (FPSCR_REGNUM));
-
- printf_filtered ("R0-R7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
- (long) read_register (0), (long) read_register (1),
- (long) read_register (2), (long) read_register (3),
- (long) read_register (4), (long) read_register (5),
- (long) read_register (6), (long) read_register (7));
- printf_filtered ("R8-R15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
- (long) read_register (8), (long) read_register (9),
- (long) read_register (10), (long) read_register (11),
- (long) read_register (12), (long) read_register (13),
- (long) read_register (14), (long) read_register (15));
-
- printf_filtered ((pr
- ? "DR0-DR6 %08lx%08lx %08lx%08lx %08lx%08lx %08lx%08lx\n"
- :
- "FP0-FP7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n"),
- (long) read_register (FP0_REGNUM + 0),
- (long) read_register (FP0_REGNUM + 1),
- (long) read_register (FP0_REGNUM + 2),
- (long) read_register (FP0_REGNUM + 3),
- (long) read_register (FP0_REGNUM + 4),
- (long) read_register (FP0_REGNUM + 5),
- (long) read_register (FP0_REGNUM + 6),
- (long) read_register (FP0_REGNUM + 7));
- printf_filtered ((pr ?
- "DR8-DR14 %08lx%08lx %08lx%08lx %08lx%08lx %08lx%08lx\n" :
- "FP8-FP15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n"),
- (long) read_register (FP0_REGNUM + 8),
- (long) read_register (FP0_REGNUM + 9),
- (long) read_register (FP0_REGNUM + 10),
- (long) read_register (FP0_REGNUM + 11),
- (long) read_register (FP0_REGNUM + 12),
- (long) read_register (FP0_REGNUM + 13),
- (long) read_register (FP0_REGNUM + 14),
- (long) read_register (FP0_REGNUM + 15));
- printf_filtered ("BANK=%-3d\n", (int) read_register (BANK_REGNUM));
- printf_filtered ("R0b - R7b %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
- (long) read_register (R0_BANK0_REGNUM + 0),
- (long) read_register (R0_BANK0_REGNUM + 1),
- (long) read_register (R0_BANK0_REGNUM + 2),
- (long) read_register (R0_BANK0_REGNUM + 3),
- (long) read_register (R0_BANK0_REGNUM + 4),
- (long) read_register (R0_BANK0_REGNUM + 5),
- (long) read_register (R0_BANK0_REGNUM + 6),
- (long) read_register (R0_BANK0_REGNUM + 7));
- printf_filtered ("R8b - R14b %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
- (long) read_register (R0_BANK0_REGNUM + 8),
- (long) read_register (R0_BANK0_REGNUM + 9),
- (long) read_register (R0_BANK0_REGNUM + 10),
- (long) read_register (R0_BANK0_REGNUM + 11),
- (long) read_register (R0_BANK0_REGNUM + 12),
- (long) read_register (R0_BANK0_REGNUM + 13),
- (long) read_register (R0_BANK0_REGNUM + 14));
- printf_filtered ("MACHb=%08lx IVNb=%08lx PRb=%08lx GBRb=%08lx MACLb=%08lx\n",
- (long) read_register (R0_BANK0_REGNUM + 15),
- (long) read_register (R0_BANK0_REGNUM + 16),
- (long) read_register (R0_BANK0_REGNUM + 17),
- (long) read_register (R0_BANK0_REGNUM + 18),
- (long) read_register (R0_BANK0_REGNUM + 19));
-}
-
-static void
-sh2a_nofpu_show_regs (void)
-{
- int pr = read_register (FPSCR_REGNUM) & 0x80000;
- printf_filtered ("PC=%s SR=%08lx PR=%08lx MACH=%08lx MACHL=%08lx\n",
- paddr (read_register (PC_REGNUM)),
- (long) read_register (SR_REGNUM),
- (long) read_register (PR_REGNUM),
- (long) read_register (MACH_REGNUM),
- (long) read_register (MACL_REGNUM));
-
- printf_filtered ("GBR=%08lx VBR=%08lx TBR=%08lx",
- (long) read_register (GBR_REGNUM),
- (long) read_register (VBR_REGNUM),
- (long) read_register (TBR_REGNUM));
- printf_filtered (" FPUL=%08lx FPSCR=%08lx\n",
- (long) read_register (FPUL_REGNUM),
- (long) read_register (FPSCR_REGNUM));
-
- printf_filtered ("R0-R7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
- (long) read_register (0), (long) read_register (1),
- (long) read_register (2), (long) read_register (3),
- (long) read_register (4), (long) read_register (5),
- (long) read_register (6), (long) read_register (7));
- printf_filtered ("R8-R15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
- (long) read_register (8), (long) read_register (9),
- (long) read_register (10), (long) read_register (11),
- (long) read_register (12), (long) read_register (13),
- (long) read_register (14), (long) read_register (15));
-
- printf_filtered ("BANK=%-3d\n", (int) read_register (BANK_REGNUM));
- printf_filtered ("R0b - R7b %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
- (long) read_register (R0_BANK0_REGNUM + 0),
- (long) read_register (R0_BANK0_REGNUM + 1),
- (long) read_register (R0_BANK0_REGNUM + 2),
- (long) read_register (R0_BANK0_REGNUM + 3),
- (long) read_register (R0_BANK0_REGNUM + 4),
- (long) read_register (R0_BANK0_REGNUM + 5),
- (long) read_register (R0_BANK0_REGNUM + 6),
- (long) read_register (R0_BANK0_REGNUM + 7));
- printf_filtered ("R8b - R14b %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
- (long) read_register (R0_BANK0_REGNUM + 8),
- (long) read_register (R0_BANK0_REGNUM + 9),
- (long) read_register (R0_BANK0_REGNUM + 10),
- (long) read_register (R0_BANK0_REGNUM + 11),
- (long) read_register (R0_BANK0_REGNUM + 12),
- (long) read_register (R0_BANK0_REGNUM + 13),
- (long) read_register (R0_BANK0_REGNUM + 14));
- printf_filtered ("MACHb=%08lx IVNb=%08lx PRb=%08lx GBRb=%08lx MACLb=%08lx\n",
- (long) read_register (R0_BANK0_REGNUM + 15),
- (long) read_register (R0_BANK0_REGNUM + 16),
- (long) read_register (R0_BANK0_REGNUM + 17),
- (long) read_register (R0_BANK0_REGNUM + 18),
- (long) read_register (R0_BANK0_REGNUM + 19));
-}
-
-static void
sh3e_show_regs (void)
{
printf_filtered ("PC=%s SR=%08lx PR=%08lx MACH=%08lx MACHL=%08lx\n",
@@ -1758,18 +1471,6 @@ sh_show_regs_command (char *args, int from_tty)
(*sh_show_regs) ();
}
-static struct type *
-sh_sh2a_register_type (struct gdbarch *gdbarch, int reg_nr)
-{
- if ((reg_nr >= FP0_REGNUM
- && (reg_nr <= FP_LAST_REGNUM)) || (reg_nr == FPUL_REGNUM))
- return builtin_type_float;
- else if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM)
- return builtin_type_double;
- else
- return builtin_type_int;
-}
-
/* Return the GDB type object for the "standard" data type
of data in register N. */
static struct type *
@@ -1894,9 +1595,6 @@ sh_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
int base_regnum, portion;
char temp_buffer[MAX_REGISTER_SIZE];
- if (reg_nr == PSEUDO_BANK_REGNUM)
- regcache_raw_read (regcache, BANK_REGNUM, buffer);
- else
if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM)
{
base_regnum = dr_reg_base_num (reg_nr);
@@ -1933,19 +1631,7 @@ sh_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
int base_regnum, portion;
char temp_buffer[MAX_REGISTER_SIZE];
- if (reg_nr == PSEUDO_BANK_REGNUM)
- {
- /* When the bank register is written to, the whole register bank
- is switched and all values in the bank registers must be read
- from the target/sim again. We're just invalidating the regcache
- so that a re-read happens next time it's necessary. */
- int bregnum;
-
- regcache_raw_write (regcache, BANK_REGNUM, buffer);
- for (bregnum = R0_BANK0_REGNUM; bregnum < MACLB_REGNUM; ++bregnum)
- set_register_cached (bregnum, 0);
- }
- else if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM)
+ if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM)
{
base_regnum = dr_reg_base_num (reg_nr);
@@ -1999,12 +1685,6 @@ do_dr_register_info (struct gdbarch *gdbarch, struct ui_file *file,
(int) read_register (first_fp_reg_num),
(int) read_register (first_fp_reg_num + 1));
}
-static void
-do_bank_register_info (struct gdbarch *gdbarch, struct ui_file *file)
-{
- fprintf_filtered (file, "bank %d\n",
- (int) read_register (BANK_REGNUM));
-}
static void
sh_print_pseudo_register (struct gdbarch *gdbarch, struct ui_file *file,
@@ -2013,8 +1693,6 @@ sh_print_pseudo_register (struct gdbarch *gdbarch, struct ui_file *file,
if (regnum < NUM_REGS || regnum >= NUM_REGS + NUM_PSEUDO_REGS)
internal_error (__FILE__, __LINE__,
"Invalid pseudo register number %d\n", regnum);
- else if (regnum == PSEUDO_BANK_REGNUM)
- do_bank_register_info (gdbarch, file);
else if (regnum >= DR0_REGNUM && regnum <= DR_LAST_REGNUM)
do_dr_register_info (gdbarch, file, regnum);
else if (regnum >= FV0_REGNUM && regnum <= FV_LAST_REGNUM)
@@ -2137,11 +1815,6 @@ sh_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file,
sh_do_register (gdbarch, file, regnum); /* All other regs */
}
- if (regnum == PSEUDO_BANK_REGNUM
- && REGISTER_NAME (regnum)
- && *REGISTER_NAME (regnum))
- sh_print_pseudo_register (gdbarch, file, regnum++);
-
if (fpregs)
while (regnum < NUM_REGS + NUM_PSEUDO_REGS)
{
@@ -2210,35 +1883,6 @@ sh_dsp_register_sim_regno (int nr)
return nr;
}
-static int
-sh_sh2a_register_sim_regno (int nr)
-{
- switch (nr)
- {
- case TBR_REGNUM:
- return SIM_SH_TBR_REGNUM;
- case IBNR_REGNUM:
- return SIM_SH_IBNR_REGNUM;
- case IBCR_REGNUM:
- return SIM_SH_IBCR_REGNUM;
- case BANK_REGNUM:
- return SIM_SH_BANK_REGNUM;
- case MACLB_REGNUM:
- return SIM_SH_BANK_MACL_REGNUM;
- case GBRB_REGNUM:
- return SIM_SH_BANK_GBR_REGNUM;
- case PRB_REGNUM:
- return SIM_SH_BANK_PR_REGNUM;
- case IVNB_REGNUM:
- return SIM_SH_BANK_IVN_REGNUM;
- case MACHB_REGNUM:
- return SIM_SH_BANK_MACH_REGNUM;
- default:
- break;
- }
- return legacy_register_sim_regno (nr);
-}
-
static struct sh_frame_cache *
sh_alloc_frame_cache (void)
{
@@ -2463,16 +2107,8 @@ sh_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc)
else if (!IS_RESTORE_FP (read_memory_unsigned_integer (addr + 2, 2)))
return 0;
- inst = read_memory_unsigned_integer (addr - 2, 2);
-
- /* Step over possible lds.l @r15+,macl. */
- if (IS_MACL_LDS (inst))
- {
- addr -= 2;
- inst = read_memory_unsigned_integer (addr - 2, 2);
- }
-
/* Step over possible lds.l @r15+,pr. */
+ inst = read_memory_unsigned_integer (addr - 2, 2);
if (IS_LDS (inst))
{
addr -= 2;
@@ -2495,14 +2131,6 @@ sh_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc)
inst = read_memory_unsigned_integer (addr - 2, 2);
}
- /* On SH2a check if the previous instruction was perhaps a MOVI20.
- That's allowed for the epilogue. */
- if ((gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_sh2a
- || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_sh2a_nofpu)
- && addr > func_addr + 6
- && IS_MOVI20 (read_memory_unsigned_integer (addr - 4, 2)))
- addr -= 4;
-
if (pc >= addr)
return 1;
}
@@ -2522,12 +2150,6 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
case bfd_mach_sh2e:
sh_show_regs = sh2e_show_regs;
break;
- case bfd_mach_sh2a:
- sh_show_regs = sh2a_show_regs;
- break;
- case bfd_mach_sh2a_nofpu:
- sh_show_regs = sh2a_nofpu_show_regs;
- break;
case bfd_mach_sh_dsp:
sh_show_regs = sh_dsp_show_regs;
break;
@@ -2592,15 +2214,16 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_print_registers_info (gdbarch, sh_print_registers_info);
set_gdbarch_breakpoint_from_pc (gdbarch, sh_breakpoint_from_pc);
+ set_gdbarch_deprecated_use_struct_convention (gdbarch, sh_use_struct_convention);
set_gdbarch_print_insn (gdbarch, gdb_print_insn_sh);
set_gdbarch_register_sim_regno (gdbarch, legacy_register_sim_regno);
set_gdbarch_write_pc (gdbarch, generic_target_write_pc);
- set_gdbarch_return_value (gdbarch, sh_return_value_nofpu);
- set_gdbarch_deprecated_extract_struct_value_address (gdbarch,
- sh_extract_struct_value_address);
+ set_gdbarch_store_return_value (gdbarch, sh_default_store_return_value);
+ set_gdbarch_extract_return_value (gdbarch, sh_default_extract_return_value);
+ set_gdbarch_deprecated_extract_struct_value_address (gdbarch, sh_extract_struct_value_address);
set_gdbarch_skip_prologue (gdbarch, sh_skip_prologue);
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
@@ -2634,32 +2257,12 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_register_name (gdbarch, sh_sh2e_register_name);
set_gdbarch_register_type (gdbarch, sh_sh3e_register_type);
set_gdbarch_fp0_regnum (gdbarch, 25);
- set_gdbarch_return_value (gdbarch, sh_return_value_fpu);
+ set_gdbarch_store_return_value (gdbarch, sh3e_sh4_store_return_value);
+ set_gdbarch_extract_return_value (gdbarch,
+ sh3e_sh4_extract_return_value);
set_gdbarch_push_dummy_call (gdbarch, sh_push_dummy_call_fpu);
break;
- case bfd_mach_sh2a:
- set_gdbarch_register_name (gdbarch, sh_sh2a_register_name);
- set_gdbarch_register_type (gdbarch, sh_sh2a_register_type);
- set_gdbarch_register_sim_regno (gdbarch, sh_sh2a_register_sim_regno);
-
- set_gdbarch_fp0_regnum (gdbarch, 25);
- set_gdbarch_num_pseudo_regs (gdbarch, 9);
- set_gdbarch_pseudo_register_read (gdbarch, sh_pseudo_register_read);
- set_gdbarch_pseudo_register_write (gdbarch, sh_pseudo_register_write);
- set_gdbarch_return_value (gdbarch, sh_return_value_fpu);
- set_gdbarch_push_dummy_call (gdbarch, sh_push_dummy_call_fpu);
- break;
-
- case bfd_mach_sh2a_nofpu:
- set_gdbarch_register_name (gdbarch, sh_sh2a_nofpu_register_name);
- set_gdbarch_register_sim_regno (gdbarch, sh_sh2a_register_sim_regno);
-
- set_gdbarch_num_pseudo_regs (gdbarch, 1);
- set_gdbarch_pseudo_register_read (gdbarch, sh_pseudo_register_read);
- set_gdbarch_pseudo_register_write (gdbarch, sh_pseudo_register_write);
- break;
-
case bfd_mach_sh_dsp:
set_gdbarch_register_name (gdbarch, sh_sh_dsp_register_name);
set_gdbarch_register_sim_regno (gdbarch, sh_dsp_register_sim_regno);
@@ -2676,7 +2279,9 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_register_name (gdbarch, sh_sh3e_register_name);
set_gdbarch_register_type (gdbarch, sh_sh3e_register_type);
set_gdbarch_fp0_regnum (gdbarch, 25);
- set_gdbarch_return_value (gdbarch, sh_return_value_fpu);
+ set_gdbarch_store_return_value (gdbarch, sh3e_sh4_store_return_value);
+ set_gdbarch_extract_return_value (gdbarch,
+ sh3e_sh4_extract_return_value);
set_gdbarch_push_dummy_call (gdbarch, sh_push_dummy_call_fpu);
break;
@@ -2690,10 +2295,12 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_register_name (gdbarch, sh_sh4_register_name);
set_gdbarch_register_type (gdbarch, sh_sh4_register_type);
set_gdbarch_fp0_regnum (gdbarch, 25);
- set_gdbarch_num_pseudo_regs (gdbarch, 13);
+ set_gdbarch_num_pseudo_regs (gdbarch, 12);
set_gdbarch_pseudo_register_read (gdbarch, sh_pseudo_register_read);
set_gdbarch_pseudo_register_write (gdbarch, sh_pseudo_register_write);
- set_gdbarch_return_value (gdbarch, sh_return_value_fpu);
+ set_gdbarch_store_return_value (gdbarch, sh3e_sh4_store_return_value);
+ set_gdbarch_extract_return_value (gdbarch,
+ sh3e_sh4_extract_return_value);
set_gdbarch_push_dummy_call (gdbarch, sh_push_dummy_call_fpu);
break;
diff --git a/gdb/sh-tdep.h b/gdb/sh-tdep.h
index 9321b59..a2ef760 100644
--- a/gdb/sh-tdep.h
+++ b/gdb/sh-tdep.h
@@ -64,23 +64,11 @@ enum
RE_REGNUM = 44,
DSP_R0_BANK_REGNUM = 51,
DSP_R7_BANK_REGNUM = 58,
- /* sh2a register */
- R0_BANK0_REGNUM = 43,
- MACHB_REGNUM = 58,
- IVNB_REGNUM = 59,
- PRB_REGNUM = 60,
- GBRB_REGNUM = 61,
- MACLB_REGNUM = 62,
- BANK_REGNUM = 63,
- IBCR_REGNUM = 64,
- IBNR_REGNUM = 65,
- TBR_REGNUM = 66,
- PSEUDO_BANK_REGNUM = 67,
/* Floating point pseudo registers */
- DR0_REGNUM = 68,
- DR_LAST_REGNUM = 75,
- FV0_REGNUM = 76,
- FV_LAST_REGNUM = 79
+ DR0_REGNUM = 59,
+ DR_LAST_REGNUM = 66,
+ FV0_REGNUM = 67,
+ FV_LAST_REGNUM = 70
};
extern gdbarch_init_ftype sh64_gdbarch_init;
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
index 820317b..393f976 100644
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -680,11 +680,11 @@ sol_thread_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int dowrite,
}
if (target_has_execution)
- retval = procfs_ops.deprecated_xfer_memory (memaddr, myaddr, len,
- dowrite, attrib, target);
+ retval = procfs_ops.to_xfer_memory (memaddr, myaddr, len,
+ dowrite, attrib, target);
else
- retval = orig_core_ops.deprecated_xfer_memory (memaddr, myaddr, len,
- dowrite, attrib, target);
+ retval = orig_core_ops.to_xfer_memory (memaddr, myaddr, len,
+ dowrite, attrib, target);
do_cleanups (old_chain);
@@ -1014,11 +1014,11 @@ rw_common (int dowrite, const struct ps_prochandle *ph, gdb_ps_addr_t addr,
/* FIXME: passing 0 as attrib argument. */
if (target_has_execution)
- cc = procfs_ops.deprecated_xfer_memory (addr, buf, size,
- dowrite, 0, &procfs_ops);
+ cc = procfs_ops.to_xfer_memory (addr, buf, size,
+ dowrite, 0, &procfs_ops);
else
- cc = orig_core_ops.deprecated_xfer_memory (addr, buf, size,
- dowrite, 0, &core_ops);
+ cc = orig_core_ops.to_xfer_memory (addr, buf, size,
+ dowrite, 0, &core_ops);
if (cc < 0)
{
@@ -1541,7 +1541,7 @@ init_sol_thread_ops (void)
sol_thread_ops.to_fetch_registers = sol_thread_fetch_registers;
sol_thread_ops.to_store_registers = sol_thread_store_registers;
sol_thread_ops.to_prepare_to_store = sol_thread_prepare_to_store;
- sol_thread_ops.deprecated_xfer_memory = sol_thread_xfer_memory;
+ sol_thread_ops.to_xfer_memory = sol_thread_xfer_memory;
sol_thread_ops.to_xfer_partial = sol_thread_xfer_partial;
sol_thread_ops.to_files_info = sol_thread_files_info;
sol_thread_ops.to_insert_breakpoint = memory_insert_breakpoint;
@@ -1584,7 +1584,7 @@ init_sol_core_ops (void)
sol_core_ops.to_attach = sol_thread_attach;
sol_core_ops.to_detach = sol_core_detach;
sol_core_ops.to_fetch_registers = sol_thread_fetch_registers;
- sol_core_ops.deprecated_xfer_memory = sol_thread_xfer_memory;
+ sol_core_ops.to_xfer_memory = sol_thread_xfer_memory;
sol_core_ops.to_xfer_partial = sol_thread_xfer_partial;
sol_core_ops.to_files_info = sol_core_files_info;
sol_core_ops.to_insert_breakpoint = ignore;
diff --git a/gdb/solib-sunos.c b/gdb/solib-sunos.c
index 5237636..872c8ac 100644
--- a/gdb/solib-sunos.c
+++ b/gdb/solib-sunos.c
@@ -1,7 +1,7 @@
/* Handle SunOS shared libraries for GDB, the GNU Debugger.
-
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999,
- 2000, 2001, 2004 Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000,
+ 2001, 2004
+ Free Software Foundation, Inc.
This file is part of GDB.
@@ -28,7 +28,7 @@
#include <sys/param.h>
#include <fcntl.h>
-/* SunOS shared libs need the nlist structure. */
+ /* SunOS shared libs need the nlist structure. */
#include <a.out.h>
#include <link.h>
@@ -42,50 +42,6 @@
#include "bcache.h"
#include "regcache.h"
-/* The shared library implementation found on BSD a.out systems is
- very similar to the SunOS implementation. However, the data
- structures defined in <link.h> are named very differently. Make up
- for those differences here. */
-
-#ifdef HAVE_STRUCT_SO_MAP_WITH_SOM_MEMBERS
-
-/* FIXME: Temporary until the equivalent defines have been removed
- from all nm-*bsd*.h files. */
-#ifndef link_dynamic
-
-/* Map `struct link_map' and its members. */
-#define link_map so_map
-#define lm_addr som_addr
-#define lm_name som_path
-#define lm_next som_next
-
-/* Map `struct link_dynamic_2' and its members. */
-#define link_dynamic_2 section_dispatch_table
-#define ld_loaded sdt_loaded
-
-/* Map `struct rtc_symb' and its members. */
-#define rtc_symb rt_symbol
-#define rtc_sp rt_sp
-#define rtc_next rt_next
-
-/* Map `struct ld_debug' and its members. */
-#define ld_debug so_debug
-#define ldd_in_debugger dd_in_debugger
-#define ldd_bp_addr dd_bpt_addr
-#define ldd_bp_inst dd_bpt_shadow
-#define ldd_cp dd_cc
-
-/* Map `struct link_dynamic' and its members. */
-#define link_dynamic _dynamic
-#define ld_version d_version
-#define ldd d_debug
-#define ld_un d_un
-#define ld_2 d_sdt
-
-#endif
-
-#endif
-
/* Link map info to include in an allocated so_list entry */
struct lm_info
@@ -190,7 +146,7 @@ allocate_rt_common_objfile (void)
objfile->psymbol_cache = bcache_xmalloc ();
objfile->macro_cache = bcache_xmalloc ();
obstack_init (&objfile->objfile_obstack);
- objfile->name = xstrdup ("rt_common");
+ objfile->name = mstrsave (objfile->md, "rt_common");
/* Add this file onto the tail of the linked list of other such files. */
diff --git a/gdb/source.c b/gdb/source.c
index f0dc554..b1e9c3874 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -46,16 +46,16 @@
#include "ui-out.h"
#include "readline/readline.h"
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
#ifdef CRLF_SOURCE_FILES
/* Define CRLF_SOURCE_FILES in an xm-*.h file if source files on the
host use \r\n rather than just \n. Defining CRLF_SOURCE_FILES is
much faster than defining LSEEK_NOT_LINEAR. */
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
#define OPEN_MODE (O_RDONLY | O_BINARY)
#define FDOPEN_MODE FOPEN_RB
@@ -674,7 +674,9 @@ openp (const char *path, int opts, const char *string,
if (!path)
path = ".";
+#if defined(_WIN32) || defined(__CYGWIN__)
mode |= O_BINARY;
+#endif
if ((opts & OPF_TRY_CWD_FIRST) || IS_ABSOLUTE_PATH (string))
{
@@ -887,7 +889,7 @@ find_and_open_source (struct objfile *objfile,
{
char *tmp_fullname;
tmp_fullname = *fullname;
- *fullname = xstrdup (tmp_fullname);
+ *fullname = mstrsave (objfile->md, *fullname);
xfree (tmp_fullname);
}
return result;
diff --git a/gdb/sparc-linux-tdep.c b/gdb/sparc-linux-tdep.c
index 4c33e6d..95f9237 100644
--- a/gdb/sparc-linux-tdep.c
+++ b/gdb/sparc-linux-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for GNU/Linux SPARC.
- Copyright 2003, 2004 Free Software Foundation, Inc.
+ Copyright 2003 Free Software Foundation, Inc.
This file is part of GDB.
@@ -83,12 +83,10 @@
Otherwise, return 0. */
CORE_ADDR
-sparc_linux_sigtramp_start (struct frame_info *next_frame,
- ULONGEST insn0, ULONGEST insn1)
+sparc_linux_sigtramp_start (CORE_ADDR pc, ULONGEST insn0, ULONGEST insn1)
{
- CORE_ADDR pc = frame_pc_unwind (next_frame);
ULONGEST word0, word1;
- unsigned char buf[8]; /* Two instructions. */
+ char buf[8]; /* Two instructions. */
/* We only recognize a signal trampoline if PC is at the start of
one of the instructions. We optimize for finding the PC at the
@@ -98,7 +96,7 @@ sparc_linux_sigtramp_start (struct frame_info *next_frame,
sequence, there will be a few trailing readable bytes on the
stack. */
- if (!safe_frame_unwind_memory (next_frame, pc, buf, sizeof buf))
+ if (deprecated_read_memory_nobpt (pc, buf, sizeof buf) != 0)
return 0;
word0 = extract_unsigned_integer (buf, 4);
@@ -108,7 +106,7 @@ sparc_linux_sigtramp_start (struct frame_info *next_frame,
return 0;
pc -= 4;
- if (!safe_frame_unwind_memory (next_frame, pc, buf, sizeof buf))
+ if (deprecated_read_memory_nobpt (pc, buf, sizeof buf) != 0)
return 0;
word0 = extract_unsigned_integer (buf, 4);
@@ -122,35 +120,30 @@ sparc_linux_sigtramp_start (struct frame_info *next_frame,
}
static CORE_ADDR
-sparc32_linux_sigtramp_start (struct frame_info *next_frame)
+sparc32_linux_sigtramp_start (CORE_ADDR pc)
{
- return sparc_linux_sigtramp_start (next_frame, LINUX32_SIGTRAMP_INSN0,
+ return sparc_linux_sigtramp_start (pc, LINUX32_SIGTRAMP_INSN0,
LINUX32_SIGTRAMP_INSN1);
}
static CORE_ADDR
-sparc32_linux_rt_sigtramp_start (struct frame_info *next_frame)
+sparc32_linux_rt_sigtramp_start (CORE_ADDR pc)
{
- return sparc_linux_sigtramp_start (next_frame, LINUX32_RT_SIGTRAMP_INSN0,
+ return sparc_linux_sigtramp_start (pc, LINUX32_RT_SIGTRAMP_INSN0,
LINUX32_RT_SIGTRAMP_INSN1);
}
static int
-sparc32_linux_sigtramp_p (struct frame_info *next_frame)
+sparc32_linux_pc_in_sigtramp (CORE_ADDR pc, char *name)
{
- CORE_ADDR pc = frame_pc_unwind (next_frame);
- char *name;
-
- find_pc_partial_function (pc, &name, NULL, NULL);
-
/* If we have NAME, we can optimize the search. The trampolines are
named __restore and __restore_rt. However, they aren't dynamically
exported from the shared C library, so the trampoline may appear to
be part of the preceding function. This should always be sigaction,
__sigaction, or __libc_sigaction (all aliases to the same function). */
if (name == NULL || strstr (name, "sigaction") != NULL)
- return (sparc32_linux_sigtramp_start (next_frame) != 0
- || sparc32_linux_rt_sigtramp_start (next_frame) != 0);
+ return (sparc32_linux_sigtramp_start (pc) != 0
+ || sparc32_linux_rt_sigtramp_start (pc) != 0);
return (strcmp ("__restore", name) == 0
|| strcmp ("__restore_rt", name) == 0);
@@ -177,12 +170,13 @@ sparc32_linux_sigtramp_frame_cache (struct frame_info *next_frame,
regnum = SPARC_O1_REGNUM;
sigcontext_addr = frame_unwind_register_unsigned (next_frame, regnum);
- addr = sparc32_linux_sigtramp_start (next_frame);
+ cache->pc = frame_pc_unwind (next_frame);
+ addr = sparc32_linux_sigtramp_start (cache->pc);
if (addr == 0)
{
/* If this is a RT signal trampoline, adjust SIGCONTEXT_ADDR
accordingly. */
- addr = sparc32_linux_rt_sigtramp_start (next_frame);
+ addr = sparc32_linux_rt_sigtramp_start (cache->pc);
if (addr)
sigcontext_addr += 128;
else
@@ -245,13 +239,47 @@ static const struct frame_unwind sparc32_linux_sigtramp_frame_unwind =
static const struct frame_unwind *
sparc32_linux_sigtramp_frame_sniffer (struct frame_info *next_frame)
{
- if (sparc32_linux_sigtramp_p (next_frame))
+ CORE_ADDR pc = frame_pc_unwind (next_frame);
+ char *name;
+
+ find_pc_partial_function (pc, &name, NULL, NULL);
+ if (sparc32_linux_pc_in_sigtramp (pc, name))
return &sparc32_linux_sigtramp_frame_unwind;
return NULL;
}
+static struct link_map_offsets *
+sparc32_linux_svr4_fetch_link_map_offsets (void)
+{
+ static struct link_map_offsets lmo;
+ static struct link_map_offsets *lmp = NULL;
+
+ if (lmp == NULL)
+ {
+ lmp = &lmo;
+
+ /* Everything we need is in the first 8 bytes. */
+ lmo.r_debug_size = 8;
+ lmo.r_map_offset = 4;
+ lmo.r_map_size = 4;
+
+ /* Everything we need is in the first 20 bytes. */
+ lmo.link_map_size = 20;
+ lmo.l_addr_offset = 0;
+ lmo.l_addr_size = 4;
+ lmo.l_name_offset = 4;
+ lmo.l_name_size = 4;
+ lmo.l_next_offset = 12;
+ lmo.l_next_size = 4;
+ lmo.l_prev_offset = 16;
+ lmo.l_prev_size = 4;
+ }
+
+ return lmp;
+}
+
static void
sparc32_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
@@ -266,6 +294,9 @@ sparc32_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_long_double_format (gdbarch, &floatformat_ieee_double_big);
frame_unwind_append_sniffer (gdbarch, sparc32_linux_sigtramp_frame_sniffer);
+
+ set_solib_svr4_fetch_link_map_offsets
+ (gdbarch, sparc32_linux_svr4_fetch_link_map_offsets);
}
/* Provide a prototype to silence -Wmissing-prototypes. */
diff --git a/gdb/sparc-nat.c b/gdb/sparc-nat.c
index a3836ce..858e278 100644
--- a/gdb/sparc-nat.c
+++ b/gdb/sparc-nat.c
@@ -35,7 +35,6 @@
#include "sparc-tdep.h"
#include "sparc-nat.h"
-#include "inf-ptrace.h"
/* With some trickery we can use the code in this file for most (if
not all) ptrace(2) based SPARC systems, which includes SunOS 4,
@@ -305,20 +304,6 @@ sparc_xfer_wcookie (struct target_ops *ops, enum target_object object,
memcpy (readbuf, buf + offset, len);
return len;
}
-
-/* Create a prototype generic SPARC target. The client can override
- it with local methods. */
-
-struct target_ops *
-sparc_target (void)
-{
- struct target_ops *t;
-
- t = inf_ptrace_target ();
- t->to_fetch_registers = fetch_inferior_registers;
- t->to_store_registers = store_inferior_registers;
- return t;
-}
/* Provide a prototype to silence -Wmissing-prototypes. */
diff --git a/gdb/sparc-nat.h b/gdb/sparc-nat.h
index 25ecc63..8f99b1e 100644
--- a/gdb/sparc-nat.h
+++ b/gdb/sparc-nat.h
@@ -1,6 +1,6 @@
/* Native-dependent code for SPARC.
- Copyright 2003, 2004 Free Software Foundation, Inc.
+ Copyright 2003 Free Software Foundation, Inc.
This file is part of GDB.
@@ -37,9 +37,4 @@ extern int (*sparc_fpregset_supplies_p) (int);
extern int sparc32_gregset_supplies_p (int regnum);
extern int sparc32_fpregset_supplies_p (int regnum);
-/* Create a prototype generic SPARC target. The client can override
- it with local methods. */
-
-extern struct target_ops *sparc_target (void);
-
#endif /* sparc-nat.h */
diff --git a/gdb/sparc64-linux-tdep.c b/gdb/sparc64-linux-tdep.c
index 7f86e0a..cd78557 100644
--- a/gdb/sparc64-linux-tdep.c
+++ b/gdb/sparc64-linux-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for GNU/Linux UltraSPARC.
- Copyright 2003, 2004 Free Software Foundation, Inc.
+ Copyright 2003 Free Software Foundation, Inc.
This file is part of GDB.
@@ -22,9 +22,40 @@
#include "defs.h"
#include "gdbarch.h"
#include "osabi.h"
+#include "solib-svr4.h"
#include "sparc64-tdep.h"
+static struct link_map_offsets *
+sparc64_linux_svr4_fetch_link_map_offsets (void)
+{
+ static struct link_map_offsets lmo;
+ static struct link_map_offsets *lmp = NULL;
+
+ if (lmp == NULL)
+ {
+ lmp = &lmo;
+
+ /* Everything we need is in the first 16 bytes. */
+ lmo.r_debug_size = 16;
+ lmo.r_map_offset = 8;
+ lmo.r_map_size = 8;
+
+ /* Everything we need is in the first 40 bytes. */
+ lmo.link_map_size = 40;
+ lmo.l_addr_offset = 0;
+ lmo.l_addr_size = 8;
+ lmo.l_name_offset = 8;
+ lmo.l_name_size = 8;
+ lmo.l_next_offset = 24;
+ lmo.l_next_size = 8;
+ lmo.l_prev_offset = 32;
+ lmo.l_prev_size = 8;
+ }
+
+ return lmp;
+}
+
static void
sparc64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
@@ -35,6 +66,9 @@ sparc64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* ... but doesn't have kernel-assisted single-stepping support. */
set_gdbarch_software_single_step (gdbarch, sparc_software_single_step);
+
+ set_solib_svr4_fetch_link_map_offsets
+ (gdbarch, sparc64_linux_svr4_fetch_link_map_offsets);
}
/* Provide a prototype to silence -Wmissing-prototypes. */
diff --git a/gdb/sparc64nbsd-nat.c b/gdb/sparc64nbsd-nat.c
index fe9e006..7d554cf 100644
--- a/gdb/sparc64nbsd-nat.c
+++ b/gdb/sparc64nbsd-nat.c
@@ -21,7 +21,6 @@
#include "defs.h"
#include "regcache.h"
-#include "target.h"
#include "sparc64-tdep.h"
#include "sparc-nat.h"
@@ -170,9 +169,6 @@ _initialize_sparc64nbsd_nat (void)
sparc_gregset_supplies_p = sparc64nbsd_gregset_supplies_p;
sparc_fpregset_supplies_p = sparc64nbsd_fpregset_supplies_p;
- /* We've got nothing to add to the generic SPARC target. */
- add_target (sparc_target ());
-
/* Support debugging kernel virtual memory images. */
bsd_kvm_add_target (sparc64nbsd_supply_pcb);
}
diff --git a/gdb/sparc64nbsd-tdep.c b/gdb/sparc64nbsd-tdep.c
index aa665da..35ad232 100644
--- a/gdb/sparc64nbsd-tdep.c
+++ b/gdb/sparc64nbsd-tdep.c
@@ -28,7 +28,6 @@
#include "regcache.h"
#include "regset.h"
#include "symtab.h"
-#include "objfiles.h"
#include "solib-svr4.h"
#include "trad-frame.h"
@@ -237,11 +236,8 @@ sparc64nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
sparc64_init_abi (info, gdbarch);
- /* NetBSD/sparc64 has SVR4-style shared libraries... */
- set_gdbarch_in_solib_call_trampoline (gdbarch, in_plt_section);
- set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_lp64_fetch_link_map_offsets);
+ (gdbarch, nbsd_lp64_solib_svr4_fetch_link_map_offsets);
}
diff --git a/gdb/sparc64obsd-tdep.c b/gdb/sparc64obsd-tdep.c
index fdd5e81..5f8cb3b 100644
--- a/gdb/sparc64obsd-tdep.c
+++ b/gdb/sparc64obsd-tdep.c
@@ -25,13 +25,13 @@
#include "osabi.h"
#include "regset.h"
#include "symtab.h"
-#include "objfiles.h"
#include "solib-svr4.h"
#include "trad-frame.h"
#include "gdb_assert.h"
#include "sparc64-tdep.h"
+#include "nbsd-tdep.h"
/* OpenBSD uses the traditional NetBSD core file format, even for
ports that use ELF. The core files don't use multiple register
@@ -201,11 +201,8 @@ sparc64obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
sparc64_init_abi (info, gdbarch);
- /* OpenBSD/sparc64 has SVR4-style shared libraries... */
- set_gdbarch_in_solib_call_trampoline (gdbarch, in_plt_section);
- set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_lp64_fetch_link_map_offsets);
+ (gdbarch, nbsd_lp64_solib_svr4_fetch_link_map_offsets);
}
diff --git a/gdb/sparcnbsd-nat.c b/gdb/sparcnbsd-nat.c
index 4b0eb12..fa663f2 100644
--- a/gdb/sparcnbsd-nat.c
+++ b/gdb/sparcnbsd-nat.c
@@ -20,8 +20,8 @@
Boston, MA 02111-1307, USA. */
#include "defs.h"
+#include "gdbcore.h"
#include "regcache.h"
-#include "target.h"
#include "sparc-tdep.h"
#include "sparc-nat.h"
@@ -66,9 +66,6 @@ _initialize_sparcnbsd_nat (void)
{
sparc_gregset = &sparc32nbsd_gregset;
- /* We've got nothing to add to the generic SPARC target. */
- add_target (sparc_target ());
-
/* Support debugging kernel virtual memory images. */
bsd_kvm_add_target (sparc32nbsd_supply_pcb);
}
diff --git a/gdb/symfile.c b/gdb/symfile.c
index ee9336d..14e8ccd 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -2185,10 +2185,6 @@ init_filename_language_table (void)
add_filename_language (".pas", language_pascal);
add_filename_language (".p", language_pascal);
add_filename_language (".pp", language_pascal);
- add_filename_language (".adb", language_ada);
- add_filename_language (".ads", language_ada);
- add_filename_language (".a", language_ada);
- add_filename_language (".ada", language_ada);
}
}
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 8ed6d9e..46325db 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -41,7 +41,6 @@
#include "source.h"
#include "filenames.h" /* for FILENAME_CMP */
#include "objc-lang.h"
-#include "ada-lang.h"
#include "hashtab.h"
@@ -70,7 +69,7 @@ static void variables_info (char *, int);
static void sources_info (char *, int);
-static void output_source_filename (const char *, int *);
+static void output_source_filename (char *, int *);
static int find_line_common (struct linetable *, int, int *);
@@ -273,7 +272,8 @@ lookup_partial_symtab (const char *name)
this symtab and use its absolute path. */
if (full_path != NULL)
{
- psymtab_to_fullname (pst);
+ if (pst->fullname == NULL)
+ source_full_path_of (pst->filename, &pst->fullname);
if (pst->fullname != NULL
&& FILENAME_CMP (full_path, pst->fullname) == 0)
{
@@ -284,7 +284,8 @@ lookup_partial_symtab (const char *name)
if (real_path != NULL)
{
char *rp = NULL;
- psymtab_to_fullname (pst);
+ if (pst->fullname == NULL)
+ source_full_path_of (pst->filename, &pst->fullname);
if (pst->fullname != NULL)
{
rp = gdb_realpath (pst->fullname);
@@ -635,24 +636,17 @@ symbol_init_demangled_name (struct general_symbol_info *gsymbol,
char *
symbol_natural_name (const struct general_symbol_info *gsymbol)
{
- switch (gsymbol->language)
+ if ((gsymbol->language == language_cplus
+ || gsymbol->language == language_java
+ || gsymbol->language == language_objc)
+ && (gsymbol->language_specific.cplus_specific.demangled_name != NULL))
{
- case language_cplus:
- case language_java:
- case language_objc:
- if (gsymbol->language_specific.cplus_specific.demangled_name != NULL)
- return gsymbol->language_specific.cplus_specific.demangled_name;
- break;
- case language_ada:
- if (gsymbol->language_specific.cplus_specific.demangled_name != NULL)
- return gsymbol->language_specific.cplus_specific.demangled_name;
- else
- return ada_decode_symbol (gsymbol);
- break;
- default:
- break;
+ return gsymbol->language_specific.cplus_specific.demangled_name;
+ }
+ else
+ {
+ return gsymbol->name;
}
- return gsymbol->name;
}
/* Return the demangled name for a symbol based on the language for
@@ -660,24 +654,13 @@ symbol_natural_name (const struct general_symbol_info *gsymbol)
char *
symbol_demangled_name (struct general_symbol_info *gsymbol)
{
- switch (gsymbol->language)
- {
- case language_cplus:
- case language_java:
- case language_objc:
- if (gsymbol->language_specific.cplus_specific.demangled_name != NULL)
- return gsymbol->language_specific.cplus_specific.demangled_name;
- break;
- case language_ada:
- if (gsymbol->language_specific.cplus_specific.demangled_name != NULL)
- return gsymbol->language_specific.cplus_specific.demangled_name;
- else
- return ada_decode_symbol (gsymbol);
- break;
- default:
- break;
- }
- return NULL;
+ if (gsymbol->language == language_cplus
+ || gsymbol->language == language_java
+ || gsymbol->language == language_objc)
+ return gsymbol->language_specific.cplus_specific.demangled_name;
+
+ else
+ return NULL;
}
/* Return the search name of a symbol---generally the demangled or
@@ -685,10 +668,7 @@ symbol_demangled_name (struct general_symbol_info *gsymbol)
If there is no distinct demangled name, then returns the same value
(same pointer) as SYMBOL_LINKAGE_NAME. */
char *symbol_search_name (const struct general_symbol_info *gsymbol) {
- if (gsymbol->language == language_ada)
- return gsymbol->name;
- else
- return symbol_natural_name (gsymbol);
+ return symbol_natural_name (gsymbol);
}
/* Initialize the structure fields to zero values. */
@@ -1020,7 +1000,7 @@ lookup_symbol (const char *name, const struct block *block,
modified_name = name;
- /* If we are using C++ or Java, demangle the name before doing a lookup, so
+ /* If we are using C++ language, demangle the name before doing a lookup, so
we can always binary search. */
if (current_language->la_language == language_cplus)
{
@@ -1032,17 +1012,6 @@ lookup_symbol (const char *name, const struct block *block,
needtofreename = 1;
}
}
- else if (current_language->la_language == language_java)
- {
- demangled_name = cplus_demangle (name,
- DMGL_ANSI | DMGL_PARAMS | DMGL_JAVA);
- if (demangled_name)
- {
- mangled_name = name;
- modified_name = demangled_name;
- needtofreename = 1;
- }
- }
if (case_sensitivity == case_sensitive_off)
{
@@ -2653,7 +2622,7 @@ filename_seen (const char *file, int add, int *first)
NAME is the name to print and *FIRST is nonzero if this is the first
name printed. Set *FIRST to zero. */
static void
-output_source_filename (const char *name, int *first)
+output_source_filename (char *name, int *first)
{
/* Since a single source file can result in several partial symbol
tables, we need to avoid printing it more than once. Note: if
@@ -2702,8 +2671,7 @@ sources_info (char *ignore, int from_tty)
first = 1;
ALL_SYMTABS (objfile, s)
{
- const char *fullname = symtab_to_fullname (s);
- output_source_filename (fullname ? fullname : s->filename, &first);
+ output_source_filename (s->filename, &first);
}
printf_filtered ("\n\n");
@@ -2714,8 +2682,7 @@ sources_info (char *ignore, int from_tty)
{
if (!ps->readin)
{
- const char *fullname = psymtab_to_fullname (ps);
- output_source_filename (fullname ? fullname : ps->filename, &first);
+ output_source_filename (ps->filename, &first);
}
}
printf_filtered ("\n");
diff --git a/gdb/target.c b/gdb/target.c
index 81389a7..0e76e71e 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -86,8 +86,6 @@ static int target_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len,
static void init_dummy_target (void);
-static struct target_ops debug_target;
-
static void debug_to_open (char *, int);
static void debug_to_close (int);
@@ -108,9 +106,8 @@ static void debug_to_store_registers (int);
static void debug_to_prepare_to_store (void);
-static int deprecated_debug_xfer_memory (CORE_ADDR, char *, int, int,
- struct mem_attrib *,
- struct target_ops *);
+static int debug_to_xfer_memory (CORE_ADDR, char *, int, int,
+ struct mem_attrib *, struct target_ops *);
static void debug_to_files_info (struct target_ops *);
@@ -130,7 +127,7 @@ static int debug_to_remove_watchpoint (CORE_ADDR, int, int);
static int debug_to_stopped_by_watchpoint (void);
-static int debug_to_stopped_data_address (struct target_ops *, CORE_ADDR *);
+static CORE_ADDR debug_to_stopped_data_address (void);
static int debug_to_region_size_ok_for_hw_watchpoint (int);
@@ -162,12 +159,6 @@ static int debug_to_thread_alive (ptid_t);
static void debug_to_stop (void);
-/* NOTE: cagney/2004-09-29: Many targets reference this variable in
- wierd and mysterious ways. Putting the variable here lets those
- wierd and mysterious ways keep building while they are being
- converted to the inferior inheritance structure. */
-struct target_ops deprecated_child_ops;
-
/* Pointer to array of target architecture structures; the size of the
array; the current index into the array; the allocated size of the
array. */
@@ -388,10 +379,11 @@ update_current_target (void)
INHERIT (to_disconnect, t);
INHERIT (to_resume, t);
INHERIT (to_wait, t);
+ INHERIT (to_post_wait, t);
INHERIT (to_fetch_registers, t);
INHERIT (to_store_registers, t);
INHERIT (to_prepare_to_store, t);
- INHERIT (deprecated_xfer_memory, t);
+ INHERIT (to_xfer_memory, t);
INHERIT (to_files_info, t);
INHERIT (to_insert_breakpoint, t);
INHERIT (to_remove_breakpoint, t);
@@ -489,6 +481,9 @@ update_current_target (void)
de_fault (to_wait,
(ptid_t (*) (ptid_t, struct target_waitstatus *))
noprocess);
+ de_fault (to_post_wait,
+ (void (*) (ptid_t, int))
+ target_ignore);
de_fault (to_fetch_registers,
(void (*) (int))
target_ignore);
@@ -498,7 +493,7 @@ update_current_target (void)
de_fault (to_prepare_to_store,
(void (*) (void))
noprocess);
- de_fault (deprecated_xfer_memory,
+ de_fault (to_xfer_memory,
(int (*) (CORE_ADDR, char *, int, int, struct mem_attrib *, struct target_ops *))
nomemory);
de_fault (to_files_info,
@@ -527,7 +522,7 @@ update_current_target (void)
(int (*) (void))
return_zero);
de_fault (to_stopped_data_address,
- (int (*) (struct target_ops *, CORE_ADDR *))
+ (CORE_ADDR (*) (void))
return_zero);
de_fault (to_region_size_ok_for_hw_watchpoint,
default_region_size_ok_for_hw_watchpoint);
@@ -784,7 +779,7 @@ target_read_string (CORE_ADDR memaddr, char **string, int len, int *errnop)
tlen = MIN (len, 4 - (memaddr & 3));
offset = memaddr & 3;
- errcode = target_read_memory (memaddr & ~3, buf, 4);
+ errcode = target_xfer_memory (memaddr & ~3, buf, 4, 0);
if (errcode != 0)
{
/* The transfer request might have crossed the boundary to an
@@ -792,7 +787,7 @@ target_read_string (CORE_ADDR memaddr, char **string, int len, int *errnop)
a single byte. */
tlen = 1;
offset = 0;
- errcode = target_read_memory (memaddr, buf, 1);
+ errcode = target_xfer_memory (memaddr, buf, 1, 0);
if (errcode != 0)
goto done;
}
@@ -843,147 +838,6 @@ target_section_by_addr (struct target_ops *target, CORE_ADDR addr)
return NULL;
}
-/* Return non-zero when the target vector has supplied an xfer_partial
- method and it, rather than xfer_memory, should be used. */
-static int
-target_xfer_partial_p (void)
-{
- return (target_stack != NULL
- && target_stack->to_xfer_partial != default_xfer_partial);
-}
-
-static LONGEST
-target_xfer_partial (struct target_ops *ops,
- enum target_object object, const char *annex,
- void *readbuf, const void *writebuf,
- ULONGEST offset, LONGEST len)
-{
- LONGEST retval;
-
- gdb_assert (ops->to_xfer_partial != NULL);
- retval = ops->to_xfer_partial (ops, object, annex, readbuf, writebuf,
- offset, len);
- if (targetdebug)
- {
- const unsigned char *myaddr = NULL;
-
- fprintf_unfiltered (gdb_stdlog,
- "%s:target_xfer_partial (%d, %s, 0x%lx, 0x%lx, 0x%s, %s) = %s",
- ops->to_shortname,
- (int) object,
- (annex ? annex : "(null)"),
- (long) readbuf, (long) writebuf,
- paddr_nz (offset), paddr_d (len), paddr_d (retval));
-
- if (readbuf)
- myaddr = readbuf;
- if (writebuf)
- myaddr = writebuf;
- if (retval > 0 && myaddr != NULL)
- {
- int i;
-
- fputs_unfiltered (", bytes =", gdb_stdlog);
- for (i = 0; i < retval; i++)
- {
- if ((((long) &(myaddr[i])) & 0xf) == 0)
- {
- if (targetdebug < 2 && i > 0)
- {
- fprintf_unfiltered (gdb_stdlog, " ...");
- break;
- }
- fprintf_unfiltered (gdb_stdlog, "\n");
- }
-
- fprintf_unfiltered (gdb_stdlog, " %02x", myaddr[i] & 0xff);
- }
- }
-
- fputc_unfiltered ('\n', gdb_stdlog);
- }
- return retval;
-}
-
-/* Attempt a transfer all LEN bytes starting at OFFSET between the
- inferior's KIND:ANNEX space and GDB's READBUF/WRITEBUF buffer. If
- the transfer succeeds, return zero, otherwize the host ERRNO is
- returned.
-
- The inferior is formed from several layers. In the case of
- corefiles, inf-corefile is layered above inf-exec and a request for
- text (corefiles do not include text pages) will be first sent to
- the core-stratum, fail, and then sent to the object-file where it
- will succeed.
-
- NOTE: cagney/2004-09-30:
-
- The old code tried to use four separate mechanisms for mapping an
- object:offset:len tuple onto an inferior and its address space: the
- target stack; the inferior's TO_SECTIONS; solib's SO_LIST;
- overlays.
-
- This is stupid.
-
- The code below is instead using a single mechanism (currently
- strata). If that mechanism proves insufficient then re-factor it
- implementing another singluar mechanism (for instance, a generic
- object:annex onto inferior:object:annex say). */
-
-static LONGEST
-xfer_using_stratum (enum target_object object, const char *annex,
- ULONGEST offset, LONGEST len, void *readbuf,
- const void *writebuf)
-{
- LONGEST xfered;
- struct target_ops *target;
-
- /* Always successful. */
- if (len == 0)
- return 0;
- /* Never successful. */
- if (target_stack == NULL)
- return EIO;
-
- target = target_stack;
- while (1)
- {
- xfered = target_xfer_partial (target, object, annex,
- readbuf, writebuf, offset, len);
- if (xfered > 0)
- {
- /* The partial xfer succeeded, update the counts, check that
- the xfer hasn't finished and if it hasn't set things up
- for the next round. */
- len -= xfered;
- if (len <= 0)
- return 0;
- offset += xfered;
- if (readbuf != NULL)
- readbuf = (bfd_byte *) readbuf + xfered;
- if (writebuf != NULL)
- writebuf = (bfd_byte *) writebuf + xfered;
- target = target_stack;
- }
- else if (xfered < 0)
- {
- /* Something totally screwed up, abandon the attempt to
- xfer. */
- if (errno)
- return errno;
- else
- return EIO;
- }
- else
- {
- /* This "stratum" didn't work, try the next one down. */
- target = target->beneath;
- if (target == NULL)
- return EIO;
- }
- }
-}
-
/* Read LEN bytes of target memory at address MEMADDR, placing the results in
GDB's memory at MYADDR. Returns either 0 for success or an errno value
if any error occurs.
@@ -997,38 +851,15 @@ xfer_using_stratum (enum target_object object, const char *annex,
int
target_read_memory (CORE_ADDR memaddr, char *myaddr, int len)
{
- if (target_xfer_partial_p ())
- return xfer_using_stratum (TARGET_OBJECT_MEMORY, NULL,
- memaddr, len, myaddr, NULL);
- else
- return target_xfer_memory (memaddr, myaddr, len, 0);
+ return target_xfer_memory (memaddr, myaddr, len, 0);
}
int
target_write_memory (CORE_ADDR memaddr, char *myaddr, int len)
{
- if (target_xfer_partial_p ())
- return xfer_using_stratum (TARGET_OBJECT_MEMORY, NULL,
- memaddr, len, NULL, myaddr);
- else
- return target_xfer_memory (memaddr, myaddr, len, 1);
+ return target_xfer_memory (memaddr, myaddr, len, 1);
}
-#ifndef target_stopped_data_address_p
-int
-target_stopped_data_address_p (struct target_ops *target)
-{
- if (target->to_stopped_data_address
- == (int (*) (struct target_ops *, CORE_ADDR *)) return_zero)
- return 0;
- if (target->to_stopped_data_address == debug_to_stopped_data_address
- && (debug_target.to_stopped_data_address
- == (int (*) (struct target_ops *, CORE_ADDR *)) return_zero))
- return 0;
- return 1;
-}
-#endif
-
static int trust_readonly = 0;
/* Move memory to or from the targets. The top target gets priority;
@@ -1048,8 +879,8 @@ do_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
if (len == 0)
return 0;
- /* deprecated_xfer_memory is not guaranteed to set errno, even when
- it returns 0. */
+ /* to_xfer_memory is not guaranteed to set errno, even when it returns
+ 0. */
errno = 0;
if (!write && trust_readonly)
@@ -1066,7 +897,7 @@ do_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
}
/* The quick case is that the top target can handle the transfer. */
- res = current_target.deprecated_xfer_memory
+ res = current_target.to_xfer_memory
(memaddr, myaddr, len, write, attrib, &current_target);
/* If res <= 0 then we call it again in the loop. Ah well. */
@@ -1077,7 +908,7 @@ do_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
if (!t->to_has_memory)
continue;
- res = t->deprecated_xfer_memory (memaddr, myaddr, len, write, attrib, t);
+ res = t->to_xfer_memory (memaddr, myaddr, len, write, attrib, t);
if (res > 0)
break; /* Handled all or part of xfer */
if (t->to_has_all_memory)
@@ -1232,21 +1063,13 @@ target_xfer_memory_partial (CORE_ADDR memaddr, char *myaddr, int len,
int
target_read_memory_partial (CORE_ADDR memaddr, char *buf, int len, int *err)
{
- if (target_xfer_partial_p ())
- return target_xfer_partial (target_stack, TARGET_OBJECT_MEMORY, NULL,
- buf, NULL, memaddr, len);
- else
- return target_xfer_memory_partial (memaddr, buf, len, 0, err);
+ return target_xfer_memory_partial (memaddr, buf, len, 0, err);
}
int
target_write_memory_partial (CORE_ADDR memaddr, char *buf, int len, int *err)
{
- if (target_xfer_partial_p ())
- return target_xfer_partial (target_stack, TARGET_OBJECT_MEMORY, NULL,
- NULL, buf, memaddr, len);
- else
- return target_xfer_memory_partial (memaddr, buf, len, 1, err);
+ return target_xfer_memory_partial (memaddr, buf, len, 1, err);
}
/* More generic transfers. */
@@ -1257,9 +1080,9 @@ default_xfer_partial (struct target_ops *ops, enum target_object object,
const void *writebuf, ULONGEST offset, LONGEST len)
{
if (object == TARGET_OBJECT_MEMORY
- && ops->deprecated_xfer_memory != NULL)
- /* If available, fall back to the target's
- "deprecated_xfer_memory" method. */
+ && ops->to_xfer_memory != NULL)
+ /* If available, fall back to the target's "to_xfer_memory"
+ method. */
{
int xfered = -1;
errno = 0;
@@ -1268,25 +1091,25 @@ default_xfer_partial (struct target_ops *ops, enum target_object object,
void *buffer = xmalloc (len);
struct cleanup *cleanup = make_cleanup (xfree, buffer);
memcpy (buffer, writebuf, len);
- xfered = ops->deprecated_xfer_memory (offset, buffer, len,
- 1/*write*/, NULL, ops);
+ xfered = ops->to_xfer_memory (offset, buffer, len, 1/*write*/, NULL,
+ ops);
do_cleanups (cleanup);
}
if (readbuf != NULL)
- xfered = ops->deprecated_xfer_memory (offset, readbuf, len, 0/*read*/,
- NULL, ops);
+ xfered = ops->to_xfer_memory (offset, readbuf, len, 0/*read*/, NULL,
+ ops);
if (xfered > 0)
return xfered;
else if (xfered == 0 && errno == 0)
- /* "deprecated_xfer_memory" uses 0, cross checked against
- ERRNO as one indication of an error. */
+ /* "to_xfer_memory" uses 0, cross checked against ERRNO as one
+ indication of an error. */
return 0;
else
return -1;
}
else if (ops->beneath != NULL)
- return target_xfer_partial (ops->beneath, object, annex,
- readbuf, writebuf, offset, len);
+ return ops->beneath->to_xfer_partial (ops->beneath, object, annex,
+ readbuf, writebuf, offset, len);
else
return -1;
}
@@ -1303,7 +1126,8 @@ target_read_partial (struct target_ops *ops,
const char *annex, void *buf,
ULONGEST offset, LONGEST len)
{
- return target_xfer_partial (ops, object, annex, buf, NULL, offset, len);
+ gdb_assert (ops->to_xfer_partial != NULL);
+ return ops->to_xfer_partial (ops, object, annex, buf, NULL, offset, len);
}
LONGEST
@@ -1312,7 +1136,8 @@ target_write_partial (struct target_ops *ops,
const char *annex, const void *buf,
ULONGEST offset, LONGEST len)
{
- return target_xfer_partial (ops, object, annex, NULL, buf, offset, len);
+ gdb_assert (ops->to_xfer_partial != NULL);
+ return ops->to_xfer_partial (ops, object, annex, NULL, buf, offset, len);
}
/* Wrappers to perform the full transfer. */
@@ -1796,6 +1621,9 @@ init_dummy_target (void)
dummy_target.to_magic = OPS_MAGIC;
}
+
+static struct target_ops debug_target;
+
static void
debug_to_open (char *args, int from_tty)
{
@@ -1913,6 +1741,15 @@ debug_to_wait (ptid_t ptid, struct target_waitstatus *status)
}
static void
+debug_to_post_wait (ptid_t ptid, int status)
+{
+ debug_target.to_post_wait (ptid, status);
+
+ fprintf_unfiltered (gdb_stdlog, "target_post_wait (%d, %d)\n",
+ PIDGET (ptid), status);
+}
+
+static void
debug_print_register (const char * func, int regno)
{
fprintf_unfiltered (gdb_stdlog, "%s ", func);
@@ -1965,14 +1802,14 @@ debug_to_prepare_to_store (void)
}
static int
-deprecated_debug_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len,
- int write, struct mem_attrib *attrib,
- struct target_ops *target)
+debug_to_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+ struct mem_attrib *attrib,
+ struct target_ops *target)
{
int retval;
- retval = debug_target.deprecated_xfer_memory (memaddr, myaddr, len, write,
- attrib, target);
+ retval = debug_target.to_xfer_memory (memaddr, myaddr, len, write,
+ attrib, target);
fprintf_unfiltered (gdb_stdlog,
"target_xfer_memory (0x%x, xxx, %d, %s, xxx) = %d",
@@ -2084,17 +1921,16 @@ debug_to_stopped_by_watchpoint (void)
return retval;
}
-static int
-debug_to_stopped_data_address (struct target_ops *target, CORE_ADDR *addr)
+static CORE_ADDR
+debug_to_stopped_data_address (void)
{
- int retval;
+ CORE_ADDR retval;
- retval = debug_target.to_stopped_data_address (target, addr);
+ retval = debug_target.to_stopped_data_address ();
fprintf_unfiltered (gdb_stdlog,
- "target_stopped_data_address ([0x%lx]) = %ld\n",
- (unsigned long)*addr,
- (unsigned long)retval);
+ "target_stopped_data_address () = 0x%lx\n",
+ (unsigned long) retval);
return retval;
}
@@ -2431,6 +2267,25 @@ debug_to_stop (void)
fprintf_unfiltered (gdb_stdlog, "target_stop ()\n");
}
+static LONGEST
+debug_to_xfer_partial (struct target_ops *ops, enum target_object object,
+ const char *annex, void *readbuf, const void *writebuf,
+ ULONGEST offset, LONGEST len)
+{
+ LONGEST retval;
+
+ retval = debug_target.to_xfer_partial (&debug_target, object, annex,
+ readbuf, writebuf, offset, len);
+
+ fprintf_unfiltered (gdb_stdlog,
+ "target_xfer_partial (%d, %s, 0x%lx, 0x%lx, 0x%s, %s) = %s\n",
+ (int) object, (annex ? annex : "(null)"),
+ (long) readbuf, (long) writebuf, paddr_nz (offset),
+ paddr_d (len), paddr_d (retval));
+
+ return retval;
+}
+
static void
debug_to_rcmd (char *command,
struct ui_file *outbuf)
@@ -2485,10 +2340,11 @@ setup_target_debug (void)
current_target.to_disconnect = debug_to_disconnect;
current_target.to_resume = debug_to_resume;
current_target.to_wait = debug_to_wait;
+ current_target.to_post_wait = debug_to_post_wait;
current_target.to_fetch_registers = debug_to_fetch_registers;
current_target.to_store_registers = debug_to_store_registers;
current_target.to_prepare_to_store = debug_to_prepare_to_store;
- current_target.deprecated_xfer_memory = deprecated_debug_xfer_memory;
+ current_target.to_xfer_memory = debug_to_xfer_memory;
current_target.to_files_info = debug_to_files_info;
current_target.to_insert_breakpoint = debug_to_insert_breakpoint;
current_target.to_remove_breakpoint = debug_to_remove_breakpoint;
@@ -2527,6 +2383,7 @@ setup_target_debug (void)
current_target.to_thread_alive = debug_to_thread_alive;
current_target.to_find_new_threads = debug_to_find_new_threads;
current_target.to_stop = debug_to_stop;
+ current_target.to_xfer_partial = debug_to_xfer_partial;
current_target.to_rcmd = debug_to_rcmd;
current_target.to_enable_exception_callback = debug_to_enable_exception_callback;
current_target.to_get_current_exception_event = debug_to_get_current_exception_event;
diff --git a/gdb/target.h b/gdb/target.h
index 84c284b..92becca 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -304,6 +304,7 @@ struct target_ops
void (*to_disconnect) (char *, int);
void (*to_resume) (ptid_t, int, enum target_signal);
ptid_t (*to_wait) (ptid_t, struct target_waitstatus *);
+ void (*to_post_wait) (ptid_t, int);
void (*to_fetch_registers) (int);
void (*to_store_registers) (int);
void (*to_prepare_to_store) (void);
@@ -324,15 +325,12 @@ struct target_ops
negative (call its absolute value N) means that we cannot
transfer right at MEMADDR, but we could transfer at least
- something at MEMADDR + N.
+ something at MEMADDR + N. */
- NOTE: cagney/2004-10-01: This has been entirely superseeded by
- to_xfer_partial and inferior inheritance. */
-
- int (*deprecated_xfer_memory) (CORE_ADDR memaddr, char *myaddr,
- int len, int write,
- struct mem_attrib *attrib,
- struct target_ops *target);
+ int (*to_xfer_memory) (CORE_ADDR memaddr, char *myaddr,
+ int len, int write,
+ struct mem_attrib *attrib,
+ struct target_ops *target);
void (*to_files_info) (struct target_ops *);
int (*to_insert_breakpoint) (CORE_ADDR, char *);
@@ -344,7 +342,7 @@ struct target_ops
int (*to_insert_watchpoint) (CORE_ADDR, int, int);
int (*to_stopped_by_watchpoint) (void);
int to_have_continuable_watchpoint;
- int (*to_stopped_data_address) (struct target_ops *, CORE_ADDR *);
+ CORE_ADDR (*to_stopped_data_address) (void);
int (*to_region_size_ok_for_hw_watchpoint) (int);
void (*to_terminal_init) (void);
void (*to_terminal_inferior) (void);
@@ -509,6 +507,19 @@ extern void target_disconnect (char *, int);
#define target_wait(ptid, status) \
(*current_target.to_wait) (ptid, status)
+/* The target_wait operation waits for a process event to occur, and
+ thereby stop the process.
+
+ On some targets, certain events may happen in sequences. gdb's
+ correct response to any single event of such a sequence may require
+ knowledge of what earlier events in the sequence have been seen.
+
+ This operation provides a target-specific hook that allows the
+ necessary bookkeeping to be performed to track such sequences. */
+
+#define target_post_wait(ptid, status) \
+ (*current_target.to_post_wait) (ptid, status)
+
/* Fetch at least register REGNO, or all regs if regno == -1. No result. */
#define target_fetch_registers(regno) \
@@ -567,6 +578,8 @@ extern char *child_core_file_to_sym_file (char *);
extern void child_post_attach (int);
#endif
+extern void child_post_wait (ptid_t, int);
+
extern void child_post_startup_inferior (ptid_t);
extern void child_acknowledge_created_inferior (int);
@@ -1070,14 +1083,9 @@ extern void (*deprecated_target_new_objfile_hook) (struct objfile *);
(*current_target.to_remove_hw_breakpoint) (addr, save)
#endif
-extern int target_stopped_data_address_p (struct target_ops *);
-
#ifndef target_stopped_data_address
-#define target_stopped_data_address(target, x) \
- (*target.to_stopped_data_address) (target, x)
-#else
-/* Horrible hack to get around existing macros :-(. */
-#define target_stopped_data_address_p(CURRENT_TARGET) (1)
+#define target_stopped_data_address() \
+ (*current_target.to_stopped_data_address) ()
#endif
/* This will only be defined by a target that supports catching vfork events,
@@ -1229,6 +1237,4 @@ extern void push_remote_target (char *name, int from_tty);
/* Blank target vector entries are initialized to target_ignore. */
void target_ignore (void);
-extern struct target_ops deprecated_child_ops;
-
#endif /* !defined (TARGET_H) */
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 7ba5c69..aa6abb4 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,99 +1,3 @@
-2004-10-14 Andrew Cagney <cagney@gnu.org>
-
- * gdb.mi/gdb701.c (main): Return 0.
-
-2004-10-13 Daniel Jacobowitz <dan@debian.org>
-
- * gdb.dwarf2/dw2-intercu.S, gdb.dwarf2/dw2-intercu.exp: New files.
-
-2004-10-12 Jeff Johnston <jjohnstn@redhat.com>
-
- * gdb.threads/schedlock.c: Add comment markers to use to find
- line numbers.
- * gdb.threads/schedlock.exp: Adjust regex to handle the new
- comments.
- * gdb.threads/watchthreads.exp: Use gdb_get_line_number to find
- breakpoint lines.
-
-2004-10-12 Daniel Jacobowitz <dan@debian.org>
-
- * gdb.dwarf2/dw2-basic.exp: Run on Hurd also.
-
-2004-10-12 Daniel Jacobowitz <dan@debian.org>
-
- * configure.in: Add gdb.dwarf2.
- * configure: Regenerated.
- * Makefile.in: Add gdb.dwarf2.
- * gdb.dwarf2/Makefile.in, gdb.dwarf2/dw2-basic.S,
- gdb.dwarf2/dw2-basic.exp, gdb.dwarf2/main.c,
- gdb.dwarf2/file1.txt: New files.
-
-2004-10-11 Orjan Friberg <orjanf@axis.com>
-
- * gdb.threads/bp_in_thread.exp: Use runto_main and "continue" instead
- of "run", since the latter doesn't work with remote targets. Adjust
- the breakpoint numbering accordingly.
- * gdb.threads/pthread_cond_wait.exp: Ditto.
-
-2004-10-08 Michael Chastain <mec.gnu@mindspring.com>
-
- * gdb.base/overlays.exp: Update copyright years.
-
-2004-10-08 Kei Sakamoto <sakamoto.kei@renesas.com>
-
- * gdb.base/overlays.exp: Disable if target is Linux.
-
-2004-10-06 Felix Lee <felix+log1@specifixinc.com>
-
- * config/gdbserver.exp (gdb_load): Use right filename on remote.
-
-2004-10-05 Kei Sakamoto <sakamoto.kei@renesas.com>
-
- * gdb.asm/asm-source.exp: Add m32r-linux target.
- * gdb.asm/m32r-linux.inc: New file.
-
-2004-09-24 Andrew Cagney <cagney@redhat.com>
- David Anderson <anderson@redhat.com>
-
- * gdb.base/bigcore.exp (extract_heap): If the expect "file size"
- command fails, assume things will work.
- * gdb.base/bigcore.c: Include <sys/stat.h> and <fcntl.h>.
- (_GNU_SOURCE): Define.
- (print_unsigned, print_hex): Change parameter to "long long".
- (print_byte_count): New function, use to print byte counts.
- (large_off_t, large_lseek, O_LARGEFILE): Define dependant on
- O_LARGEFILE.
- (main): Compute an upper bound on a corefile in max_core_size.
- Limit memory chunk size to max_core_size. Limit total memory
- allocated to max_core_size.
-
-2004-09-23 Andrew Cagney <cagney@gnu.org>
-
- * gdb.base/bigcore.exp: Replace the code that creates a corefile
- from a separate process with code that creates a corefile by
- making the inferior dump core.
-
-2004-09-23 Mark Kettenis <kettenis@gnu.org>
-
- * gdb.base/sigstep.exp: Avoid comments withing gdb_test_multiple
- block.
-
-2004-09-23 Michael Chastain <mec.gnu@mindspring.com>
-
- * gdb.base/constvars.exp (local_compiler_xfail_check_2):
- New proc. Accept both gcc 3.x.x and gcc 4.x.x.
- * gdb.base/volatile.exp (local_compiler_xfail_check_2):
- Likewise.
-
-2004-09-20 Jeff Johnston <jjohnstn@redhat.com>
-
- * gdb.java/jprint.exp: New test case for java inferior call.
- * gdb.java/jprint.java: Ditto.
-
-2004-09-15 Joel Brobecker <brobecker@gnat.com>
-
- * gdb.base/bigcore.exp: Deactivate on IRIX targets.
-
2004-09-14 Michael Chastain <mec.gnu@mindspring.com>
* gdb.threads/killed.c: Include <stdlib.h>.
diff --git a/gdb/testsuite/Makefile.in b/gdb/testsuite/Makefile.in
index 5aa8262..d9be89c 100644
--- a/gdb/testsuite/Makefile.in
+++ b/gdb/testsuite/Makefile.in
@@ -36,7 +36,6 @@ EXEEXT = @EXEEXT@
SUBDIRS = @subdirs@
RPATH_ENVVAR = @RPATH_ENVVAR@
ALL_SUBDIRS = gdb.ada gdb.arch gdb.asm gdb.base gdb.cp gdb.disasm \
- gdb.dwarf2 \
gdb.fortran gdb.java gdb.mi gdb.objc gdb.threads gdb.trace \
$(SUBDIRS)
diff --git a/gdb/testsuite/config/gdbserver.exp b/gdb/testsuite/config/gdbserver.exp
index 6dc6b23..ed812f8 100644
--- a/gdb/testsuite/config/gdbserver.exp
+++ b/gdb/testsuite/config/gdbserver.exp
@@ -207,7 +207,7 @@ proc gdb_load { arg } {
}
}
- set res [gdbserver_gdb_load $server_exec]
+ set res [gdbserver_gdb_load $host_exec]
set protocol [lindex $res 0]
set gdbport [lindex $res 1]
diff --git a/gdb/testsuite/configure b/gdb/testsuite/configure
index 43a843f..271e11d 100755
--- a/gdb/testsuite/configure
+++ b/gdb/testsuite/configure
@@ -1052,8 +1052,8 @@ ac_given_srcdir=$srcdir
trap 'rm -fr `echo "Makefile \
gdb.ada/Makefile gdb.ada/gnat_ada.gpr:gdb.ada/gnat_ada.gin \
gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile \
- gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile \
- gdb.fortran/Makefile gdb.java/Makefile gdb.mi/Makefile \
+ gdb.cp/Makefile gdb.disasm/Makefile gdb.fortran/Makefile \
+ gdb.java/Makefile gdb.mi/Makefile \
gdb.objc/Makefile gdb.threads/Makefile gdb.trace/Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF
cat >> $CONFIG_STATUS <<EOF
@@ -1149,8 +1149,8 @@ cat >> $CONFIG_STATUS <<EOF
CONFIG_FILES=\${CONFIG_FILES-"Makefile \
gdb.ada/Makefile gdb.ada/gnat_ada.gpr:gdb.ada/gnat_ada.gin \
gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile \
- gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile \
- gdb.fortran/Makefile gdb.java/Makefile gdb.mi/Makefile \
+ gdb.cp/Makefile gdb.disasm/Makefile gdb.fortran/Makefile \
+ gdb.java/Makefile gdb.mi/Makefile \
gdb.objc/Makefile gdb.threads/Makefile gdb.trace/Makefile"}
EOF
cat >> $CONFIG_STATUS <<\EOF
diff --git a/gdb/testsuite/configure.in b/gdb/testsuite/configure.in
index 02c0a04..8b90e04 100644
--- a/gdb/testsuite/configure.in
+++ b/gdb/testsuite/configure.in
@@ -121,6 +121,6 @@ AC_CONFIG_SUBDIRS($configdirs)
AC_OUTPUT([Makefile \
gdb.ada/Makefile gdb.ada/gnat_ada.gpr:gdb.ada/gnat_ada.gin \
gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile \
- gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile \
- gdb.fortran/Makefile gdb.java/Makefile gdb.mi/Makefile \
+ gdb.cp/Makefile gdb.disasm/Makefile gdb.fortran/Makefile \
+ gdb.java/Makefile gdb.mi/Makefile \
gdb.objc/Makefile gdb.threads/Makefile gdb.trace/Makefile])
diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp
index fcd0ae0..e2c9e8a 100644
--- a/gdb/testsuite/gdb.asm/asm-source.exp
+++ b/gdb/testsuite/gdb.asm/asm-source.exp
@@ -71,9 +71,6 @@ switch -glob -- [istarget] {
"i\[3456\]86-*-*" {
set asm-arch i386
}
- "m32r*-linux*" {
- set asm-arch m32r-linux
- }
"m32r*-*" {
set asm-arch m32r
append link-flags "--whole-archive -lgloss --no-whole-archive"
diff --git a/gdb/testsuite/gdb.asm/m32r-linux.inc b/gdb/testsuite/gdb.asm/m32r-linux.inc
deleted file mode 100644
index 64d6504..0000000
--- a/gdb/testsuite/gdb.asm/m32r-linux.inc
+++ /dev/null
@@ -1,34 +0,0 @@
- comment "subroutine prologue"
- .macro gdbasm_enter
- push fp -> push lr
- addi sp,#-4 -> mv fp,sp
- .endm
-
- comment "subroutine epilogue"
- .macro gdbasm_leave
- addi sp,#4 -> pop lr
- pop fp -> jmp lr
- .endm
-
- .macro gdbasm_call subr
- bl \subr
- .endm
-
- .macro gdbasm_several_nops
- nop
- nop
- nop
- nop
- .endm
-
- comment "exit (0)"
- .macro gdbasm_exit0
- ldi r0,#1 -> ldi r1,#0
- ldi r2,#0 -> ldi r3,#0
- trap #0 -> nop
- .endm
-
- comment "crt0 startup"
- .macro gdbasm_startup
- ldi fp,#0
- .endm
diff --git a/gdb/testsuite/gdb.base/bigcore.c b/gdb/testsuite/gdb.base/bigcore.c
index 9215b5a..2a8bb07 100644
--- a/gdb/testsuite/gdb.base/bigcore.c
+++ b/gdb/testsuite/gdb.base/bigcore.c
@@ -19,14 +19,9 @@
Please email any bugs, comments, and/or additions to this file to:
bug-gdb@prep.ai.mit.edu */
-/* Get 64-bit stuff if on a GNU system. */
-#define _GNU_SOURCE
-
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
-#include <sys/stat.h>
-#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
@@ -48,7 +43,7 @@ print_char (char c)
}
static void
-print_unsigned (unsigned long long u)
+print_unsigned (unsigned long u)
{
if (u >= 10)
print_unsigned (u / 10);
@@ -56,7 +51,7 @@ print_unsigned (unsigned long long u)
}
static void
-print_hex (unsigned long long u)
+print_hex (unsigned long u)
{
if (u >= 16)
print_hex (u / 16);
@@ -77,16 +72,6 @@ print_address (const void *a)
print_hex ((unsigned long) a);
}
-static void
-print_byte_count (unsigned long long u)
-{
- print_unsigned (u);
- print_string (" (");
- print_string ("0x");
- print_hex (u);
- print_string (") bytes");
-}
-
/* Print the current values of RESOURCE. */
static void
@@ -137,20 +122,10 @@ static struct list heap = { &dummy, &dummy };
static unsigned long bytes_allocated;
-#ifdef O_LARGEFILE
-#define large_off_t off64_t
-#define large_lseek lseek64
-#else
-#define large_off_t off_t
-#define O_LARGEFILE 0
-#define large_lseek lseek
-#endif
-
int
main ()
{
size_t max_chunk_size;
- large_off_t max_core_size;
/* Try to expand all the resource limits beyond the point of sanity
- we're after the biggest possible core file. */
@@ -169,46 +144,14 @@ main ()
maximize_rlimit (RLIMIT_AS, "stack");
#endif
- print_string ("Maximize allocation limits ...\n");
-
- /* Compute the largest possible corefile size. No point in trying
- to create a corefile larger than the largest file supported by
- the file system. What about 64-bit lseek64? */
- {
- int fd;
- large_off_t tmp;
- unlink ("bigcore.corefile");
- fd = open ("bigcore.corefile", O_RDWR | O_CREAT | O_TRUNC | O_LARGEFILE);
- for (tmp = 1; tmp > 0; tmp <<= 1)
- {
- if (large_lseek (fd, tmp, SEEK_SET) > 0)
- max_core_size = tmp;
- }
- close (fd);
- }
-
/* Compute an initial chunk size. The math is dodgy but it works
- for the moment. Perhaphs there's a constant around somewhere.
- Limit this to max_core_size bytes - no point in trying to
- allocate more than can be written to the corefile. */
+ for the moment. Perhaphs there's a constant around somewhere. */
{
size_t tmp;
- for (tmp = 1; tmp > 0 && tmp < max_core_size; tmp <<= 1)
+ for (tmp = 1; tmp > 0; tmp <<= 1)
max_chunk_size = tmp;
}
- print_string (" core: ");
- print_byte_count (max_core_size);
- print_string ("\n");
- print_string (" chunk: ");
- print_byte_count (max_chunk_size);
- print_string ("\n");
- print_string (" large? ");
- if (O_LARGEFILE)
- print_string ("yes\n");
- else
- print_string ("no\n");
-
/* Allocate as much memory as possible creating a linked list of
each section. The linking ensures that some, but not all, the
memory is allocated. NB: Some kernels handle this efficiently -
@@ -230,10 +173,9 @@ main ()
{
unsigned long count = 0;
print_string (" ");
- print_byte_count (chunk_size);
- print_string (" ... ");
- while (bytes_allocated + (1 + count) * chunk_size
- < max_core_size)
+ print_unsigned (chunk_size);
+ print_string (" bytes ... ");
+ while (1)
{
struct list *chunk = malloc (chunk_size);
if (chunk == NULL)
@@ -252,7 +194,7 @@ main ()
bytes_allocated += chunk_size * count;
}
print_string ("Total of ");
- print_byte_count (bytes_allocated);
+ print_unsigned (bytes_allocated);
print_string (" bytes ");
print_unsigned (chunks_allocated);
print_string (" chunks\n");
diff --git a/gdb/testsuite/gdb.base/bigcore.exp b/gdb/testsuite/gdb.base/bigcore.exp
index af3098c..b720136 100644
--- a/gdb/testsuite/gdb.base/bigcore.exp
+++ b/gdb/testsuite/gdb.base/bigcore.exp
@@ -49,13 +49,6 @@ if { [istarget "*-*-*bsd*"]
return
}
-# This testcase causes too much stress (in terms of memory usage)
-# on certain systems...
-if { [istarget "*-*-*irix*"] } {
- untested "Testcase too stressful for this system"
- return
-}
-
set testfile "bigcore"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
@@ -65,6 +58,36 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
+# Create a core file named "TESTFILE.corefile" rather than just
+# "core", to avoid problems with sys admin types that like to
+# regularly prune all files named "core" from the system.
+
+# Some systems append "core" to the name of the program; others append
+# the name of the program to "core"; still others (like Linux, as of
+# May 2003) create cores named "core.PID". In the latter case, we
+# could have many core files lying around, and it may be difficult to
+# tell which one is ours, so let's run the program in a subdirectory.
+
+set found 0
+set coredir "${objdir}/${subdir}/coredir.[getpid]"
+file mkdir $coredir
+catch "system \"(cd ${coredir}; ${binfile}; true) >/dev/null 2>&1\""
+set names [glob -nocomplain -directory $coredir *core*]
+if {[llength $names] == 1} {
+ set file [file join $coredir [lindex $names 0]]
+ remote_exec build "mv $file $corefile"
+ set found 1
+}
+
+# Try to clean up after ourselves.
+remote_file build delete [file join $coredir coremmap.data]
+remote_exec build "rmdir $coredir"
+
+if { $found == 0 } {
+ warning "can't generate a core file - core tests suppressed - check ulimit -c"
+ return 0
+}
+
# Run GDB on the bigcore program up-to where it will dump core.
gdb_exit
@@ -83,6 +106,28 @@ gdb_test "tbreak $print_core_line"
gdb_test continue ".*print_string.*"
gdb_test next ".*0 = 0.*"
+# Check that the corefile is plausibly large enough. We're trying to
+# detect the case where the operating system has truncated the file
+# just before signed wraparound. TCL, unfortunately, has a similar
+# problem - so use catch. It can handle the "bad" size but not necessarily
+# the "good" one. And we must use GDB for the comparison, similarly.
+
+if {[catch {file size $corefile} core_size] == 0} {
+ set core_ok 0
+ gdb_test_multiple "print bytes_allocated < $core_size" "check core size" {
+ -re " = 1\r\n$gdb_prompt $" {
+ pass "check core size"
+ set core_ok 1
+ }
+ -re " = 0\r\n$gdb_prompt $" {
+ xfail "check core size (system does not support large corefiles)"
+ }
+ }
+ if {$core_ok == 0} {
+ return 0
+ }
+}
+
# Traverse part of bigcore's linked list of memory chunks (forward or
# backward), saving each chunk's address.
@@ -118,79 +163,6 @@ proc extract_heap { dir } {
set next_heap [extract_heap next]
set prev_heap [extract_heap prev]
-# Now create a core dump
-
-# Rename the core file to "TESTFILE.corefile" rather than just "core",
-# to avoid problems with sys admin types that like to regularly prune
-# all files named "core" from the system.
-
-# Some systems append "core" to the name of the program; others append
-# the name of the program to "core"; still others (like Linux, as of
-# May 2003) create cores named "core.PID".
-
-# Save the process ID. Some systems dump the core into core.PID.
-set test "grab pid"
-gdb_test_multiple "info program" $test {
- -re "child process (\[0-9\]+).*$gdb_prompt $" {
- set inferior_pid $expect_out(1,string)
- pass $test
- }
- -re "$gdb_prompt $" {
- set inferior_pid unknown
- pass $test
- }
-}
-
-# Dump core using SIGABRT
-set oldtimeout $timeout
-set timeout 600
-gdb_test "signal SIGABRT" "Program terminated with signal SIGABRT, .*"
-
-# Find the corefile
-set file ""
-foreach pat [list core.${inferior_pid} ${testfile}.core core] {
- set names [glob -nocomplain $pat]
- if {[llength $names] == 1} {
- set file [lindex $names 0]
- remote_exec build "mv $file $corefile"
- break
- }
-}
-
-if { $file == "" } {
- untested "Can't generate a core file"
- return 0
-}
-
-# Check that the corefile is plausibly large enough. We're trying to
-# detect the case where the operating system has truncated the file
-# just before signed wraparound. TCL, unfortunately, has a similar
-# problem - so use catch. It can handle the "bad" size but not
-# necessarily the "good" one. And we must use GDB for the comparison,
-# similarly.
-
-if {[catch {file size $corefile} core_size] == 0} {
- set core_ok 0
- gdb_test_multiple "print bytes_allocated < $core_size" "check core size" {
- -re " = 1\r\n$gdb_prompt $" {
- pass "check core size"
- set core_ok 1
- }
- }
-} {
- # Probably failed due to the TCL build having problems with very
- # large values. Since GDB uses a 64-bit off_t (when possible) it
- # shouldn't have this problem. Assume that things are going to
- # work. Without this assumption the test is skiped on systems
- # (such as i386 GNU/Linux with patched kernel) which do pass.
- pass "check core size"
- set core_ok 1
-}
-if {! $core_ok} {
- untested "check core size (system does not support large corefiles)"
- return 0
-}
-
# Now load up that core file
set test "load corefile"
diff --git a/gdb/testsuite/gdb.base/constvars.exp b/gdb/testsuite/gdb.base/constvars.exp
index 25f7434..6873286 100644
--- a/gdb/testsuite/gdb.base/constvars.exp
+++ b/gdb/testsuite/gdb.base/constvars.exp
@@ -15,6 +15,9 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@prep.ai.mit.edu
+
# written by Elena Zannoni (elz@apollo.hp.com)
#
# This file is part of the gdb testsuite
@@ -65,9 +68,6 @@ if ![runto_main] then {
get_debug_format
-# Many tests xfail with gcc 2 -gstabs+.
-# TODO: check out the hp side of this.
-
proc local_compiler_xfail_check { } {
if { [test_compiler_info gcc-2-*] } then {
if { ![test_debug_format "HP"] \
@@ -82,16 +82,6 @@ proc local_compiler_xfail_check { } {
}
}
-# A few tests still xfail with gcc 3 -gstabs+ and gcc 4 -gstabs+.
-
-proc local_compiler_xfail_check_2 { } {
- if { [test_compiler_info gcc-3-*] || [test_compiler_info gcc-4-*] } {
- if { [test_debug_format "stabs" ] } {
- setup_xfail "*-*-*"
- }
- }
-}
-
send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $"
send_gdb "cont\n"
@@ -128,8 +118,10 @@ send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $"
# test function parameters
local_compiler_xfail_check
-local_compiler_xfail_check_2
-
+if { [test_compiler_info gcc-3-*] && [test_debug_format "stabs"] } then {
+ # With stabs, even GCC 3 does not get the const char arguments correct.
+ setup_xfail "*-*-*"
+}
send_gdb "ptype qux1\n"
gdb_expect {
-re "type = int \\(const char, const char, const char \\*, char \\* const\\).*$gdb_prompt $" {
@@ -281,7 +273,11 @@ proc do_constvar_tests {} {
gdb_test "ptype locust" "type = double \\* const"
local_compiler_xfail_check
- local_compiler_xfail_check_2
+ if { [test_compiler_info gcc-3-*] && [test_debug_format "stabs"] } then {
+ # With stabs, even GCC 3 does not get the constant structure member
+ # correct.
+ setup_xfail "*-*-*"
+ }
gdb_test "ptype crass" "type = struct crass \{\[\r\n\]+\[\ \t\]+char \\* const ptr;\[\r\n\]+\}"
local_compiler_xfail_check
gdb_test "ptype crisp" "type = struct crisp \{\[\r\n\]+\[\ \t\]+char \\* const \\*ptr;\[\r\n\]+\}"
diff --git a/gdb/testsuite/gdb.base/overlays.exp b/gdb/testsuite/gdb.base/overlays.exp
index 671eab5..37bfbaa 100644
--- a/gdb/testsuite/gdb.base/overlays.exp
+++ b/gdb/testsuite/gdb.base/overlays.exp
@@ -1,4 +1,4 @@
-# Copyright 1997, 1998, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright 1997, 1998, 2001, 2002, 2003 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -39,11 +39,6 @@ if [istarget "d10v-*-*"] then {
return
}
-if [istarget "*-*-linux*"] then {
- verbose "Skipping overlay test -- Linux doesn't support overlayed programs."
- return
-}
-
set testfile "overlays"
set binfile ${objdir}/${subdir}/${testfile}
set srcfile ${testfile}.c
diff --git a/gdb/testsuite/gdb.base/sigstep.exp b/gdb/testsuite/gdb.base/sigstep.exp
index 81f8eed..55de445 100644
--- a/gdb/testsuite/gdb.base/sigstep.exp
+++ b/gdb/testsuite/gdb.base/sigstep.exp
@@ -211,12 +211,12 @@ proc skip_to_handler { i } {
set prefix "$i to handler"
# Run around to the done
- # You can add more patterns to this if you need them.
set test "$prefix; resync"
gdb_test_multiple "continue" "$test" {
-re "done = 0.*$gdb_prompt " {
pass "$test"
}
+ # other patterns can go here
}
# Advance to the infinite loop
@@ -252,12 +252,12 @@ proc skip_to_handler_entry { i } {
set prefix "$i to handler entry"
# Run around to the done
- # You can add more patterns to this if you need them.
set test "$prefix; resync"
gdb_test_multiple "continue" "$test" {
-re "done = 0.*$gdb_prompt " {
pass "$test"
}
+ # other patterns can go here
}
# Advance to the infinite loop
@@ -285,12 +285,12 @@ proc skip_over_handler { i } {
set prefix "$i over handler"
# Run around to the done
- # You can add more patterns to this if you need them.
set test "$prefix; resync"
gdb_test_multiple "continue" "$test" {
-re "done = 0.*$gdb_prompt " {
pass "$test"
}
+ # other patterns can go here
}
# Advance to the infinite loop
@@ -316,12 +316,12 @@ proc breakpoint_to_handler { i } {
set prefix "$i on breakpoint, to handler"
# Run around to the done
- # You can add more patterns to this if you need them.
set test "$prefix; resync"
gdb_test_multiple "continue" "$test" {
-re "done = 0.*$gdb_prompt " {
pass "$test"
}
+ # other patterns can go here
}
gdb_test "break $infinite_loop" "" "$prefix; break infinite loop"
@@ -361,12 +361,12 @@ proc breakpoint_to_handler_entry { i } {
set prefix "$i on breakpoint, to handler entry"
# Run around to the done
- # You can add more patterns to this if you need them.
set test "$prefix; resync"
gdb_test_multiple "continue" "$test" {
-re "done = 0.*$gdb_prompt " {
pass "$test"
}
+ # other patterns can go here
}
gdb_test "break $infinite_loop" "" "$prefix; break infinite loop"
@@ -398,12 +398,12 @@ proc breakpoint_over_handler { i } {
set prefix "$i on breakpoint, skip handler"
# Run around to the done
- # You can add more patterns to this if you need them.
set test "$prefix; resync"
gdb_test_multiple "continue" "$test" {
-re "done = 0.*$gdb_prompt " {
pass "$test"
}
+ # other patterns can go here
}
gdb_test "break $infinite_loop" "" "$prefix; break infinite loop"
diff --git a/gdb/testsuite/gdb.base/volatile.exp b/gdb/testsuite/gdb.base/volatile.exp
index b6623f8..c12e3d8 100644
--- a/gdb/testsuite/gdb.base/volatile.exp
+++ b/gdb/testsuite/gdb.base/volatile.exp
@@ -14,6 +14,9 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@prep.ai.mit.edu
+
# Written by Satish Pai <pai@apollo.hp.com> 1997-07-07
# In the spirit of constvars.exp: added volatile, const-volatile stuff.
@@ -71,9 +74,6 @@ if ![runto_main] then {
get_debug_format
-# Many tests xfail with gcc 2 -gstabs+.
-# TODO: check out the hp side of this.
-
proc local_compiler_xfail_check { } {
if { [test_compiler_info gcc-2-*] } then {
if { ![test_debug_format "HP"] \
@@ -88,16 +88,6 @@ proc local_compiler_xfail_check { } {
}
}
-# A few tests still xfail with gcc 3 -gstabs+ and gcc 4 -gstabs+.
-
-proc local_compiler_xfail_check_2 { } {
- if { [test_compiler_info gcc-3-*] || [test_compiler_info gcc-4-*] } {
- if { [test_debug_format "stabs" ] } {
- setup_xfail "*-*-*"
- }
- }
-}
-
send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $"
send_gdb "cont\n"
@@ -258,7 +248,11 @@ gdb_test "ptype vendor" "type = const volatile unsigned char \\* const volatile.
# test function parameters
local_compiler_xfail_check
-local_compiler_xfail_check_2
+if { [test_compiler_info gcc-3-*] && [test_debug_format "stabs"] } then {
+ # For reasons unknown, GCC 3 with stabs mangles several cv-qualified
+ # arguments to this function.
+ setup_xfail "*-*-*"
+}
send_gdb "ptype qux2\n"
gdb_expect {
-re "type = int \\(volatile unsigned char, const volatile int, volatile short( int)?, volatile long( int)? \\*, float \\* volatile, const volatile signed char \\* const volatile\\).*$gdb_prompt $" {
diff --git a/gdb/testsuite/gdb.dwarf2/Makefile.in b/gdb/testsuite/gdb.dwarf2/Makefile.in
deleted file mode 100644
index c338e02..0000000
--- a/gdb/testsuite/gdb.dwarf2/Makefile.in
+++ /dev/null
@@ -1,38 +0,0 @@
-# Makefile for regression testing the GNU debugger.
-# Copyright 1992, 1993, 1994, 1995, 1996, 1999, 2001, 2003, 2004
-# Free Software Foundation, Inc.
-
-# This file is part of GDB.
-
-# GDB is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# GDB is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-VPATH = @srcdir@
-srcdir = @srcdir@
-
-EXECUTABLES = *.x
-
-all info install-info dvi install uninstall installcheck check:
- @echo "Nothing to be done for $@..."
-
-clean mostlyclean:
- -rm -f *~ *.o a.out *.x *.ci *.tmp
- -rm -f core core.coremaker coremaker.core corefile
- -rm -f $(EXECUTABLES)
-
-distclean maintainer-clean realclean: clean
- -rm -f *~ core
- -rm -f Makefile config.status config.log
- -rm -f *-init.exp
- -rm -fr *.log summary detail *.plog *.sum *.psum site.*
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-basic.S b/gdb/testsuite/gdb.dwarf2/dw2-basic.S
deleted file mode 100644
index 1e98a4d..0000000
--- a/gdb/testsuite/gdb.dwarf2/dw2-basic.S
+++ /dev/null
@@ -1,201 +0,0 @@
-/* This testcase is part of GDB, the GNU debugger.
-
- Copyright 2004 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- USA. */
-
-/* Test a minimal file containing DWARF-2 information. This test also
- serves as a skeleton for other DWARF-2 tests. Most other tests will
- not be this extensively itemized and commented... */
-
-/* Dummy function to provide debug information for. */
-
- .text
-.Lbegin_text1:
- .globl func_cu1
- .type func_cu1, %function
-func_cu1:
-.Lbegin_func_cu1:
- .int 0
-.Lend_func_cu1:
- .size func_cu1, .-func_cu1
-.Lend_text1:
-
-/* Debug information */
-
- .section .debug_info
-.Lcu1_begin:
- /* CU header */
- .int .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
-.Lcu1_start:
- .short 2 /* DWARF Version */
- .int .Labbrev1_begin /* Offset into abbrev section */
- .byte 4 /* Pointer size */
-
- /* CU die */
- .uleb128 1 /* Abbrev: DW_TAG_compile_unit */
- .int .Lline1_begin /* DW_AT_stmt_list */
- .int .Lend_text1 /* DW_AT_high_pc */
- .int .Lbegin_text1 /* DW_AT_low_pc */
- .ascii "file1.txt\0" /* DW_AT_name */
- .ascii "GNU C 3.3.3\0" /* DW_AT_producer */
- .byte 1 /* DW_AT_language (C) */
-
- /* func_cu1 */
- .uleb128 2 /* Abbrev: DW_TAG_subprogram */
- .byte 1 /* DW_AT_external */
- .byte 1 /* DW_AT_decl_file */
- .byte 2 /* DW_AT_decl_line */
- .ascii "func_cu1\0" /* DW_AT_name */
- .int .Ltype_int-.Lcu1_begin /* DW_AT_type */
- .int .Lbegin_func_cu1 /* DW_AT_low_pc */
- .int .Lend_func_cu1 /* DW_AT_high_pc */
- .byte 1 /* DW_AT_frame_base: length */
- .byte 0x55 /* DW_AT_frame_base: DW_OP_reg5 */
-
-.Ltype_int:
- .uleb128 3 /* Abbrev: DW_TAG_base_type */
- .ascii "int\0" /* DW_AT_name */
- .byte 4 /* DW_AT_byte_size */
- .byte 5 /* DW_AT_encoding */
-
- .byte 0 /* End of children of CU */
-
-.Lcu1_end:
-
-/* Abbrev table */
- .section .debug_abbrev
-.Labbrev1_begin:
- .uleb128 1 /* Abbrev code */
- .uleb128 0x11 /* DW_TAG_compile_unit */
- .byte 1 /* has_children */
- .uleb128 0x10 /* DW_AT_stmt_list */
- .uleb128 0x6 /* DW_FORM_data4 */
- .uleb128 0x12 /* DW_AT_high_pc */
- .uleb128 0x1 /* DW_FORM_addr */
- .uleb128 0x11 /* DW_AT_low_pc */
- .uleb128 0x1 /* DW_FORM_addr */
- .uleb128 0x3 /* DW_AT_name */
- .uleb128 0x8 /* DW_FORM_string */
- .uleb128 0x25 /* DW_AT_producer */
- .uleb128 0x8 /* DW_FORM_string */
- .uleb128 0x13 /* DW_AT_language */
- .uleb128 0xb /* DW_FORM_data1 */
- .byte 0x0 /* Terminator */
- .byte 0x0 /* Terminator */
-
- .uleb128 2 /* Abbrev code */
- .uleb128 0x2e /* DW_TAG_subprogram */
- .byte 0 /* has_children */
- .uleb128 0x3f /* DW_AT_external */
- .uleb128 0xc /* DW_FORM_flag */
- .uleb128 0x3a /* DW_AT_decl_file */
- .uleb128 0xb /* DW_FORM_data1 */
- .uleb128 0x3b /* DW_AT_decl_line */
- .uleb128 0xb /* DW_FORM_data1 */
- .uleb128 0x3 /* DW_AT_name */
- .uleb128 0x8 /* DW_FORM_string */
- .uleb128 0x49 /* DW_AT_type */
- .uleb128 0x13 /* DW_FORM_ref4 */
- .uleb128 0x11 /* DW_AT_low_pc */
- .uleb128 0x1 /* DW_FORM_addr */
- .uleb128 0x12 /* DW_AT_high_pc */
- .uleb128 0x1 /* DW_FORM_addr */
- .uleb128 0x40 /* DW_AT_frame_base */
- .uleb128 0xa /* DW_FORM_block1 */
- .byte 0x0 /* Terminator */
- .byte 0x0 /* Terminator */
-
- .uleb128 3 /* Abbrev code */
- .uleb128 0x24 /* DW_TAG_base_type */
- .byte 0 /* has_children */
- .uleb128 0x3 /* DW_AT_name */
- .uleb128 0x8 /* DW_FORM_string */
- .uleb128 0xb /* DW_AT_byte_size */
- .uleb128 0xb /* DW_FORM_data1 */
- .uleb128 0x3e /* DW_AT_encoding */
- .uleb128 0xb /* DW_FORM_data1 */
- .byte 0x0 /* Terminator */
- .byte 0x0 /* Terminator */
-
- .byte 0x0 /* Terminator */
- .byte 0x0 /* Terminator */
-
-/* Line table */
- .section .debug_line
-.Lline1_begin:
- .int .Lline1_end - .Lline1_start /* Initial length */
-.Lline1_start:
- .short 2 /* Version */
- .int .Lline1_lines - .Lline1_hdr /* header_length */
-.Lline1_hdr:
- .byte 1 /* Minimum insn length */
- .byte 1 /* default_is_stmt */
- .byte 1 /* line_base */
- .byte 1 /* line_range */
- .byte 0x10 /* opcode_base */
-
- /* Standard lengths */
- .byte 0
- .byte 1
- .byte 1
- .byte 1
- .byte 1
- .byte 0
- .byte 0
- .byte 0
- .byte 1
- .byte 0
- .byte 0
- .byte 1
- .byte 0
- .byte 0
- .byte 0
-
- /* Include directories */
- .byte 0
-
- /* File names */
- .ascii "file1.txt\0"
- .uleb128 0
- .uleb128 0
- .uleb128 0
-
- .byte 0
-
-.Lline1_lines:
- .byte 0 /* DW_LNE_set_address */
- .uleb128 5
- .byte 2
- .int .Lbegin_func_cu1
-
- .byte 3 /* DW_LNS_advance_line */
- .sleb128 3 /* ... to 4 */
-
- .byte 1 /* DW_LNS_copy */
-
- .byte 1 /* DW_LNS_copy (second time as an end-of-prologue marker) */
-
- .byte 0 /* DW_LNE_set_address */
- .uleb128 5
- .byte 2
- .int .Lend_func_cu1
-
- .byte 0 /* DW_LNE_end_of_sequence */
- .uleb128 1
- .byte 1
-
-.Lline1_end:
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-basic.exp b/gdb/testsuite/gdb.dwarf2/dw2-basic.exp
deleted file mode 100644
index 7e0611e..0000000
--- a/gdb/testsuite/gdb.dwarf2/dw2-basic.exp
+++ /dev/null
@@ -1,53 +0,0 @@
-# Copyright 2004
-# Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-# Minimal DWARF-2 unit test
-
-# This test can only be run on targets which support DWARF-2 and use gas.
-# For now pick a sampling of likely targets.
-if {![istarget *-*-linux*]
- && ![istarget *-*-gnu*]
- && ![istarget *-*-elf*]
- && ![istarget arm-*-eabi*]
- && ![istarget powerpc-*-eabi*]} {
- return 0
-}
-
-set testfile "dw2-basic"
-set srcfile ${testfile}.S
-set binfile ${objdir}/${subdir}/${testfile}.x
-
-if { [gdb_compile "${srcdir}/${subdir}/main.c" "main.o" object {debug}] != "" } {
- return -1
-}
-
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${testfile}.o" object {nodebug}] != "" } {
- return -1
-}
-
-if { [gdb_compile "${testfile}.o main.o" "${binfile}" executable {debug}] != "" } {
- return -1
-}
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
-gdb_test "set listsize 1" ""
-gdb_test "list func_cu1" "4\tFile 1 Line 4"
-gdb_test "ptype func_cu1" "type = int \\(\\)"
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-intercu.S b/gdb/testsuite/gdb.dwarf2/dw2-intercu.S
deleted file mode 100644
index b612f85..0000000
--- a/gdb/testsuite/gdb.dwarf2/dw2-intercu.S
+++ /dev/null
@@ -1,236 +0,0 @@
-/* This testcase is part of GDB, the GNU debugger.
-
- Copyright 2004 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- USA. */
-
-/* Test a minimal file containing DWARF-2 information. This test also
- serves as a skeleton for other DWARF-2 tests. Most other tests will
- not be this extensively itemized and commented... */
-
-/* Dummy function to provide debug information for. */
-
- .text
-.Lbegin_text1:
- .globl func_cu1
- .type func_cu1, %function
-func_cu1:
-.Lbegin_func_cu1:
- .int 0
-.Lend_func_cu1:
- .size func_cu1, .-func_cu1
-.Lend_text1:
-
-/* Debug information */
-
- .section .debug_info
-.Lcu1_begin:
- /* CU header */
- .int .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
-.Lcu1_start:
- .short 2 /* DWARF Version */
- .int .Labbrev1_begin /* Offset into abbrev section */
- .byte 4 /* Pointer size */
-
- /* CU die */
- .uleb128 1 /* Abbrev: DW_TAG_compile_unit */
- .int .Lline1_begin /* DW_AT_stmt_list */
- .int .Lend_text1 /* DW_AT_high_pc */
- .int .Lbegin_text1 /* DW_AT_low_pc */
- .ascii "file1.txt\0" /* DW_AT_name */
- .ascii "GNU C 3.3.3\0" /* DW_AT_producer */
- .byte 1 /* DW_AT_language (C) */
-
- /* func_cu1 */
- .uleb128 2 /* Abbrev: DW_TAG_subprogram */
- .byte 1 /* DW_AT_external */
- .byte 1 /* DW_AT_decl_file */
- .byte 2 /* DW_AT_decl_line */
- .ascii "func_cu1\0" /* DW_AT_name */
- .int .Ltype_int /* DW_AT_type */
- .int .Lbegin_func_cu1 /* DW_AT_low_pc */
- .int .Lend_func_cu1 /* DW_AT_high_pc */
- .byte 1 /* DW_AT_frame_base: length */
- .byte 0x55 /* DW_AT_frame_base: DW_OP_reg5 */
-
- .byte 0 /* End of children of CU */
-
-.Lcu1_end:
-
- /* Second compilation unit. */
-.Lcu2_begin:
- /* CU header */
- .int .Lcu2_end - .Lcu2_start /* Length of Compilation Unit */
-.Lcu2_start:
- .short 2 /* DWARF Version */
- .int .Labbrev2_begin /* Offset into abbrev section */
- .byte 4 /* Pointer size */
-
- /* CU die */
- .uleb128 1 /* Abbrev: DW_TAG_compile_unit */
- .ascii "file1.txt\0" /* DW_AT_name */
- .ascii "GNU C 3.3.3\0" /* DW_AT_producer */
- .byte 1 /* DW_AT_language (C) */
-
-.Ltype_int:
- .uleb128 2 /* Abbrev: DW_TAG_base_type */
- .ascii "int\0" /* DW_AT_name */
- .byte 4 /* DW_AT_byte_size */
- .byte 5 /* DW_AT_encoding */
-
- .byte 0 /* End of children of CU */
-
-.Lcu2_end:
-
-/* Abbrev table */
- .section .debug_abbrev
-.Labbrev1_begin:
- .uleb128 1 /* Abbrev code */
- .uleb128 0x11 /* DW_TAG_compile_unit */
- .byte 1 /* has_children */
- .uleb128 0x10 /* DW_AT_stmt_list */
- .uleb128 0x6 /* DW_FORM_data4 */
- .uleb128 0x12 /* DW_AT_high_pc */
- .uleb128 0x1 /* DW_FORM_addr */
- .uleb128 0x11 /* DW_AT_low_pc */
- .uleb128 0x1 /* DW_FORM_addr */
- .uleb128 0x3 /* DW_AT_name */
- .uleb128 0x8 /* DW_FORM_string */
- .uleb128 0x25 /* DW_AT_producer */
- .uleb128 0x8 /* DW_FORM_string */
- .uleb128 0x13 /* DW_AT_language */
- .uleb128 0xb /* DW_FORM_data1 */
- .byte 0x0 /* Terminator */
- .byte 0x0 /* Terminator */
-
- .uleb128 2 /* Abbrev code */
- .uleb128 0x2e /* DW_TAG_subprogram */
- .byte 0 /* has_children */
- .uleb128 0x3f /* DW_AT_external */
- .uleb128 0xc /* DW_FORM_flag */
- .uleb128 0x3a /* DW_AT_decl_file */
- .uleb128 0xb /* DW_FORM_data1 */
- .uleb128 0x3b /* DW_AT_decl_line */
- .uleb128 0xb /* DW_FORM_data1 */
- .uleb128 0x3 /* DW_AT_name */
- .uleb128 0x8 /* DW_FORM_string */
- .uleb128 0x49 /* DW_AT_type */
- .uleb128 0x10 /* DW_FORM_ref_addr */
- .uleb128 0x11 /* DW_AT_low_pc */
- .uleb128 0x1 /* DW_FORM_addr */
- .uleb128 0x12 /* DW_AT_high_pc */
- .uleb128 0x1 /* DW_FORM_addr */
- .uleb128 0x40 /* DW_AT_frame_base */
- .uleb128 0xa /* DW_FORM_block1 */
- .byte 0x0 /* Terminator */
- .byte 0x0 /* Terminator */
-
- .byte 0x0 /* Terminator */
- .byte 0x0 /* Terminator */
-
-.Labbrev2_begin:
- .uleb128 1 /* Abbrev code */
- .uleb128 0x11 /* DW_TAG_compile_unit */
- .byte 1 /* has_children */
- .uleb128 0x3 /* DW_AT_name */
- .uleb128 0x8 /* DW_FORM_string */
- .uleb128 0x25 /* DW_AT_producer */
- .uleb128 0x8 /* DW_FORM_string */
- .uleb128 0x13 /* DW_AT_language */
- .uleb128 0xb /* DW_FORM_data1 */
- .byte 0x0 /* Terminator */
- .byte 0x0 /* Terminator */
-
- .uleb128 2 /* Abbrev code */
- .uleb128 0x24 /* DW_TAG_base_type */
- .byte 0 /* has_children */
- .uleb128 0x3 /* DW_AT_name */
- .uleb128 0x8 /* DW_FORM_string */
- .uleb128 0xb /* DW_AT_byte_size */
- .uleb128 0xb /* DW_FORM_data1 */
- .uleb128 0x3e /* DW_AT_encoding */
- .uleb128 0xb /* DW_FORM_data1 */
- .byte 0x0 /* Terminator */
- .byte 0x0 /* Terminator */
-
- .byte 0x0 /* Terminator */
- .byte 0x0 /* Terminator */
-
-/* Line table */
- .section .debug_line
-.Lline1_begin:
- .int .Lline1_end - .Lline1_start /* Initial length */
-.Lline1_start:
- .short 2 /* Version */
- .int .Lline1_lines - .Lline1_hdr /* header_length */
-.Lline1_hdr:
- .byte 1 /* Minimum insn length */
- .byte 1 /* default_is_stmt */
- .byte 1 /* line_base */
- .byte 1 /* line_range */
- .byte 0x10 /* opcode_base */
-
- /* Standard lengths */
- .byte 0
- .byte 1
- .byte 1
- .byte 1
- .byte 1
- .byte 0
- .byte 0
- .byte 0
- .byte 1
- .byte 0
- .byte 0
- .byte 1
- .byte 0
- .byte 0
- .byte 0
-
- /* Include directories */
- .byte 0
-
- /* File names */
- .ascii "file1.txt\0"
- .uleb128 0
- .uleb128 0
- .uleb128 0
-
- .byte 0
-
-.Lline1_lines:
- .byte 0 /* DW_LNE_set_address */
- .uleb128 5
- .byte 2
- .int .Lbegin_func_cu1
-
- .byte 3 /* DW_LNS_advance_line */
- .sleb128 3 /* ... to 4 */
-
- .byte 1 /* DW_LNS_copy */
-
- .byte 1 /* DW_LNS_copy (second time as an end-of-prologue marker) */
-
- .byte 0 /* DW_LNE_set_address */
- .uleb128 5
- .byte 2
- .int .Lend_func_cu1
-
- .byte 0 /* DW_LNE_end_of_sequence */
- .uleb128 1
- .byte 1
-
-.Lline1_end:
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-intercu.exp b/gdb/testsuite/gdb.dwarf2/dw2-intercu.exp
deleted file mode 100644
index d9a0cfd..0000000
--- a/gdb/testsuite/gdb.dwarf2/dw2-intercu.exp
+++ /dev/null
@@ -1,53 +0,0 @@
-# Copyright 2004
-# Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-# Minimal DWARF-2 unit test
-
-# This test can only be run on targets which support DWARF-2 and use gas.
-# For now pick a sampling of likely targets.
-if {![istarget *-*-linux*]
- && ![istarget *-*-gnu*]
- && ![istarget *-*-elf*]
- && ![istarget arm-*-eabi*]
- && ![istarget powerpc-*-eabi*]} {
- return 0
-}
-
-set testfile "dw2-intercu"
-set srcfile ${testfile}.S
-set binfile ${objdir}/${subdir}/${testfile}.x
-
-if { [gdb_compile "${srcdir}/${subdir}/main.c" "main.o" object {debug}] != "" } {
- return -1
-}
-
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${testfile}.o" object {nodebug}] != "" } {
- return -1
-}
-
-if { [gdb_compile "${testfile}.o main.o" "${binfile}" executable {debug}] != "" } {
- return -1
-}
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
-gdb_test "set listsize 1" ""
-gdb_test "list func_cu1" "4\tFile 1 Line 4"
-gdb_test "ptype func_cu1" "type = int \\(\\)"
diff --git a/gdb/testsuite/gdb.dwarf2/file1.txt b/gdb/testsuite/gdb.dwarf2/file1.txt
deleted file mode 100644
index b745e3a..0000000
--- a/gdb/testsuite/gdb.dwarf2/file1.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-File 1 Line 1
-File 1 Line 2
-File 1 Line 3
-File 1 Line 4
-File 1 Line 5
-File 1 Line 6
-File 1 Line 7
-File 1 Line 8
diff --git a/gdb/testsuite/gdb.dwarf2/main.c b/gdb/testsuite/gdb.dwarf2/main.c
deleted file mode 100644
index 87442ac..0000000
--- a/gdb/testsuite/gdb.dwarf2/main.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/* This testcase is part of GDB, the GNU debugger.
-
- Copyright 2004 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- USA. */
-
-/* Dummy main function. */
-
-int
-main()
-{
- return 0;
-}
diff --git a/gdb/testsuite/gdb.java/jprint.exp b/gdb/testsuite/gdb.java/jprint.exp
deleted file mode 100644
index 0268f87..0000000
--- a/gdb/testsuite/gdb.java/jprint.exp
+++ /dev/null
@@ -1,80 +0,0 @@
-# Copyright 2004 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-# This file was written by Jeff Johnston. (jjohnstn@redhat.com)
-#
-
-if $tracelevel then {
- strace $tracelevel
-}
-
-load_lib "java.exp"
-
-set testfile "jprint"
-set srcfile ${srcdir}/$subdir/${testfile}.java
-set binfile ${objdir}/${subdir}/${testfile}
-if { [compile_java_from_source ${srcfile} ${binfile} "-g"] != "" } {
- untested "Couldn't compile ${srcfile}"
- return -1
-}
-
-# Set the current language to java. This counts as a test. If it
-# fails, then we skip the other tests.
-
-proc set_lang_java {} {
- global gdb_prompt
- global binfile objdir subdir
-
- verbose "loading file '$binfile'"
- gdb_load $binfile
-
- send_gdb "set language java\n"
- gdb_expect {
- -re ".*$gdb_prompt $" {}
- timeout { fail "set language java (timeout)" ; return 0 }
- }
-
- return [gdb_test "show language" ".* source language is \"java\".*" \
- "set language to \"java\""]
-}
-
-set prms_id 0
-set bug_id 0
-
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-
-gdb_test "set print sevenbit-strings" ".*"
-
-if ![set_lang_java] then {
- # Ref PR gdb:java/1565. Don't use the simpler "break jmisc.main".
- # As of 2004-02-24 it wasn't working and is being tested separatly.
- runto "\'${testfile}.main(java.lang.String\[\])\'"
-
- gdb_test "p jvclass.addprint(4,5,6)" "sum is 15\r\n.*" "unambiguous static call"
-
- gdb_test "next" ""
- gdb_test "next" ""
-
- gdb_test "p x.print(44)" "x is 44\r\n.*" "single argument print call"
- gdb_test "p x.print(22,33)" "y is 33\r\n.*" "double argument print call"
- gdb_test "call x.dothat(55)" "new value is 58\r\n.*= 62.*" "virtual fn call"
- gdb_test "p x.addprint(1,2,3)" "sum is 6\r\n.*" "inherited static call"
- gdb_test "call x.addk(44)" "adding k gives 121\r\n.*= 121.*" "inherited virtual fn call"
-}
diff --git a/gdb/testsuite/gdb.java/jprint.java b/gdb/testsuite/gdb.java/jprint.java
deleted file mode 100644
index f17607e..0000000
--- a/gdb/testsuite/gdb.java/jprint.java
+++ /dev/null
@@ -1,62 +0,0 @@
-// jprint.java test program.
-//
-// Copyright 2004
-// Free Software Foundation, Inc.
-//
-// Written by Jeff Johnston <jjohnstn@redhat.com>
-// Contributed by Red Hat
-//
-// This file is part of GDB.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330,
-// Boston, MA 02111-1307, USA.
-
-class jvclass {
- public static int k;
- static {
- k = 77;
- }
- public static void addprint (int x, int y, int z) {
- int sum = x + y + z;
- System.out.println ("sum is " + sum);
- }
-
- public int addk (int x) {
- int sum = x + k;
- System.out.println ("adding k gives " + sum);
- return sum;
- }
-}
-
-public class jprint extends jvclass {
- public int dothat (int x) {
- int y = x + 3;
- System.out.println ("new value is " + y);
- return y + 4;
- }
- public static void print (int x) {
- System.out.println("x is " + x);
- }
- public static void print (int x, int y) {
- System.out.println("y is " + y);
- }
- public static void main(String[] args) {
- jprint x = new jprint ();
- x.print (44);
- print (k, 33);
- }
-}
-
-
diff --git a/gdb/testsuite/gdb.mi/gdb701.c b/gdb/testsuite/gdb.mi/gdb701.c
index b1e72d2..16e5c29 100644
--- a/gdb/testsuite/gdb.mi/gdb701.c
+++ b/gdb/testsuite/gdb.mi/gdb701.c
@@ -11,5 +11,5 @@ int
main (int argc, char *argv[])
{
Foo *foo = 0;
- return 0;
+ exit (0);
}
diff --git a/gdb/testsuite/gdb.threads/bp_in_thread.exp b/gdb/testsuite/gdb.threads/bp_in_thread.exp
index 91c3283..e9dfadb 100644
--- a/gdb/testsuite/gdb.threads/bp_in_thread.exp
+++ b/gdb/testsuite/gdb.threads/bp_in_thread.exp
@@ -35,16 +35,15 @@ gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
-runto_main
gdb_test "break noreturn" \
- "Breakpoint 2 at .*: file .*${srcfile}, line .*" \
+ "Breakpoint 1 at .*: file .*${srcfile}, line .*" \
"breakpoint on noreturn"
# Run the program and make sure GDB reports that we stopped after
# hitting breakpoint 1 in noreturn().
-gdb_test "continue" \
- ".*Breakpoint 2, noreturn ().*" \
+gdb_test "run" \
+ ".*Breakpoint 1, noreturn ().*" \
"run to noreturn"
diff --git a/gdb/testsuite/gdb.threads/pthread_cond_wait.exp b/gdb/testsuite/gdb.threads/pthread_cond_wait.exp
index 91b695f..72ae03a 100644
--- a/gdb/testsuite/gdb.threads/pthread_cond_wait.exp
+++ b/gdb/testsuite/gdb.threads/pthread_cond_wait.exp
@@ -36,14 +36,13 @@ gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
-runto_main
gdb_test "break break_me" \
- "Breakpoint 2 at .*: file .*${srcfile}, line .*" \
+ "Breakpoint 1 at .*: file .*${srcfile}, line .*" \
"breakpoint on break_me"
-gdb_test "continue" \
- ".*Breakpoint 2, break_me ().*" \
+gdb_test "run" \
+ ".*Breakpoint 1, break_me ().*" \
"run to break_me"
#
diff --git a/gdb/testsuite/gdb.threads/watchthreads.c b/gdb/testsuite/gdb.threads/watchthreads.c
deleted file mode 100644
index e19fe07..0000000
--- a/gdb/testsuite/gdb.threads/watchthreads.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* This testcase is part of GDB, the GNU debugger.
-
- Copyright 2002, 2003, 2004 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
- This file is copied from schedlock.c. */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <pthread.h>
-
-void *thread_function(void *arg); /* Pointer to function executed by each thread */
-
-#define NUM 5
-
-unsigned int args[NUM+1];
-
-int main() {
- int res;
- pthread_t threads[NUM];
- void *thread_result;
- long i;
-
- for (i = 0; i < NUM; i++)
- {
- args[i] = 1; /* Init value. */
- res = pthread_create(&threads[i],
- NULL,
- thread_function,
- (void *) i);
- }
-
- args[i] = 1;
- thread_function ((void *) i);
-
- exit(EXIT_SUCCESS);
-}
-
-void *thread_function(void *arg) {
- int my_number = (long) arg;
- int *myp = (int *) &args[my_number];
-
- /* Don't run forever. Run just short of it :) */
- while (*myp > 0)
- {
- (*myp) ++; /* Loop increment. */
- }
-
- pthread_exit(NULL);
-}
-
diff --git a/gdb/testsuite/gdb.threads/watchthreads.exp b/gdb/testsuite/gdb.threads/watchthreads.exp
index 0bb940f..d6e89d9 100644
--- a/gdb/testsuite/gdb.threads/watchthreads.exp
+++ b/gdb/testsuite/gdb.threads/watchthreads.exp
@@ -31,7 +31,7 @@ if [target_info exists gdb,no_hardware_watchpoints] {
return 0;
}
-set testfile "watchthreads"
+set testfile "schedlock"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
@@ -60,20 +60,17 @@ set args_1 0
gdb_test "watch args\[0\]" "Hardware watchpoint 2: args\\\[0\\\]"
gdb_test "watch args\[1\]" "Hardware watchpoint 3: args\\\[1\\\]"
-set init_line [expr [gdb_get_line_number "Init value"]+1]
-set inc_line [gdb_get_line_number "Loop increment"]
-
# Loop and continue to allow both watchpoints to be triggered.
for {set i 0} {$i < 30} {incr i} {
set test_flag 0
gdb_test_multiple "continue" "threaded watch loop" {
- -re "Hardware watchpoint 2: args\\\[0\\\].*Old value = 0.*New value = 1.*main \\\(\\\) at .*watchthreads.c:$init_line.*$gdb_prompt $"
+ -re "Hardware watchpoint 2: args\\\[0\\\].*Old value = 0.*New value = 1.*main \\\(\\\) at .*schedlock.c:21.*$gdb_prompt $"
{ set args_0 1; set test_flag 1 }
- -re "Hardware watchpoint 3: args\\\[1\\\].*Old value = 0.*New value = 1.*main \\\(\\\) at .*watchthreads.c:$init_line.*$gdb_prompt $"
+ -re "Hardware watchpoint 3: args\\\[1\\\].*Old value = 0.*New value = 1.*main \\\(\\\) at .*schedlock.c:21.*$gdb_prompt $"
{ set args_1 1; set test_flag 1 }
- -re "Hardware watchpoint 2: args\\\[0\\\].*Old value = $args_0.*New value = [expr $args_0+1].*in thread_function \\\(arg=0x0\\\) at .*watchthreads.c:$inc_line.*$gdb_prompt $"
+ -re "Hardware watchpoint 2: args\\\[0\\\].*Old value = $args_0.*New value = [expr $args_0+1].*in thread_function \\\(arg=0x0\\\) at .*schedlock.c:42.*$gdb_prompt $"
{ set args_0 [expr $args_0+1]; set test_flag 1 }
- -re "Hardware watchpoint 3: args\\\[1\\\].*Old value = $args_1.*New value = [expr $args_1+1].*in thread_function \\\(arg=0x1\\\) at .*watchthreads.c:$inc_line.*$gdb_prompt $"
+ -re "Hardware watchpoint 3: args\\\[1\\\].*Old value = $args_1.*New value = [expr $args_1+1].*in thread_function \\\(arg=0x1\\\) at .*schedlock.c:42.*$gdb_prompt $"
{ set args_1 [expr $args_1+1]; set test_flag 1 }
}
# If we fail above, don't bother continuing loop
diff --git a/gdb/thread-db.c b/gdb/thread-db.c
index 65d9fd5..8bf5292 100644
--- a/gdb/thread-db.c
+++ b/gdb/thread-db.c
@@ -987,8 +987,8 @@ thread_db_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
}
xfer =
- target_beneath->deprecated_xfer_memory (memaddr, myaddr, len, write,
- attrib, target);
+ target_beneath->to_xfer_memory (memaddr, myaddr, len, write, attrib,
+ target);
do_cleanups (old_chain);
return xfer;
@@ -1339,7 +1339,7 @@ init_thread_db_ops (void)
thread_db_ops.to_wait = thread_db_wait;
thread_db_ops.to_fetch_registers = thread_db_fetch_registers;
thread_db_ops.to_store_registers = thread_db_store_registers;
- thread_db_ops.deprecated_xfer_memory = thread_db_xfer_memory;
+ thread_db_ops.to_xfer_memory = thread_db_xfer_memory;
thread_db_ops.to_kill = thread_db_kill;
thread_db_ops.to_create_inferior = thread_db_create_inferior;
thread_db_ops.to_post_startup_inferior = thread_db_post_startup_inferior;
diff --git a/gdb/top.c b/gdb/top.c
index 618dc86..e586efd 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -932,11 +932,15 @@ gdb_readline (char *prompt_arg)
}
if (c == '\n')
+#ifndef CRLF_SOURCE_FILES
+ break;
+#else
{
if (input_index > 0 && result[input_index - 1] == '\r')
input_index--;
break;
}
+#endif
result[input_index++] = c;
while (input_index >= result_size)
diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c
index c99f978..3dc62d5 100644
--- a/gdb/tui/tui-wingeneral.c
+++ b/gdb/tui/tui-wingeneral.c
@@ -94,14 +94,10 @@ box_win (struct tui_gen_win_info * win_info, int highlight_flag)
attrs = tui_border_attrs;
wattron (win, attrs);
-#ifdef HAVE_WBORDER
wborder (win, tui_border_vline, tui_border_vline,
tui_border_hline, tui_border_hline,
tui_border_ulcorner, tui_border_urcorner,
tui_border_llcorner, tui_border_lrcorner);
-#else
- box (win, tui_border_vline, tui_border_hline);
-#endif
if (win_info->title)
mvwaddstr (win, 0, 3, win_info->title);
wattroff (win, attrs);
diff --git a/gdb/utils.c b/gdb/utils.c
index e30808c..1c7b738 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -1168,6 +1168,21 @@ savestring (const char *ptr, size_t size)
return p;
}
+char *
+msavestring (void *md, const char *ptr, size_t size)
+{
+ char *p = (char *) xmalloc (size + 1);
+ memcpy (p, ptr, size);
+ p[size] = 0;
+ return p;
+}
+
+char *
+mstrsave (void *md, const char *ptr)
+{
+ return (msavestring (md, ptr, strlen (ptr)));
+}
+
void
print_spaces (int n, struct ui_file *file)
{
diff --git a/gdb/uw-thread.c b/gdb/uw-thread.c
index a7b6bc2..c37e0ff 100644
--- a/gdb/uw-thread.c
+++ b/gdb/uw-thread.c
@@ -332,9 +332,8 @@ dbgstate (int state)
static int
read_thr_debug (struct thread_debug *debugp)
{
- return base_ops.deprecated_xfer_memory (thr_debug_addr, (char *)debugp,
- sizeof (*debugp), 0, NULL,
- &base_ops);
+ return base_ops.to_xfer_memory (thr_debug_addr, (char *)debugp,
+ sizeof (*debugp), 0, NULL, &base_ops);
}
/* Read into MAP the contents of the thread map at inferior process address
@@ -343,9 +342,8 @@ read_thr_debug (struct thread_debug *debugp)
static int
read_map (CORE_ADDR mapp, struct thread_map *map)
{
- return base_ops.deprecated_xfer_memory ((CORE_ADDR)THR_MAP (mapp),
- (char *)map, sizeof (*map),
- 0, NULL, &base_ops);
+ return base_ops.to_xfer_memory ((CORE_ADDR)THR_MAP (mapp), (char *)map,
+ sizeof (*map), 0, NULL, &base_ops);
}
/* Read into LWP the contents of the lwp decriptor at inferior process address
@@ -354,8 +352,8 @@ read_map (CORE_ADDR mapp, struct thread_map *map)
static int
read_lwp (CORE_ADDR lwpp, __lwp_desc_t *lwp)
{
- return base_ops.deprecated_xfer_memory (lwpp, (char *)lwp,
- sizeof (*lwp), 0, NULL, &base_ops);
+ return base_ops.to_xfer_memory (lwpp, (char *)lwp,
+ sizeof (*lwp), 0, NULL, &base_ops);
}
/* Iterate through all user threads, applying FUNC(<map>, <lwp>, DATA) until
@@ -377,9 +375,8 @@ thread_iter (int (*func)(iter_t *, void *), void *data)
if (!read_thr_debug (&debug))
return 0;
- if (!base_ops.deprecated_xfer_memory ((CORE_ADDR)debug.thr_map,
- (char *)&mapp, sizeof (mapp), 0, NULL,
- &base_ops))
+ if (!base_ops.to_xfer_memory ((CORE_ADDR)debug.thr_map, (char *)&mapp,
+ sizeof (mapp), 0, NULL, &base_ops))
return 0;
if (!mapp)
return 0;
@@ -636,12 +633,11 @@ libthread_stub (ptid_t ptid)
/* Retrieve stub args. */
sp = read_register_pid (SP_REGNUM, ptid);
- if (!base_ops.deprecated_xfer_memory (sp + SP_ARG0, (char *)&mapp,
- sizeof (mapp), 0, NULL, &base_ops))
+ if (!base_ops.to_xfer_memory (sp + SP_ARG0, (char *)&mapp,
+ sizeof (mapp), 0, NULL, &base_ops))
goto err;
- if (!base_ops.deprecated_xfer_memory (sp + SP_ARG0 + sizeof (mapp),
- (char *)&change, sizeof (change), 0,
- NULL, &base_ops))
+ if (!base_ops.to_xfer_memory (sp + SP_ARG0 + sizeof (mapp), (char *)&change,
+ sizeof (change), 0, NULL, &base_ops))
goto err;
/* create_inferior() may not have finished yet, so notice the main
@@ -957,7 +953,7 @@ libthread_init (void)
if (!(thr_debug_addr = SYMBOL_VALUE_ADDRESS (ms)))
return;
- /* Initialize base_ops.deprecated_xfer_memory(). */
+ /* Initialize base_ops.to_xfer_memory(). */
base_ops = current_target;
/* Load _thr_debug's current contents. */
@@ -988,8 +984,8 @@ libthread_init (void)
/* Activate the stub function. */
onp = (CORE_ADDR)&((struct thread_debug *)thr_debug_addr)->thr_debug_on;
- if (!base_ops.deprecated_xfer_memory ((CORE_ADDR)onp, (char *)&one,
- sizeof (one), 1, NULL, &base_ops))
+ if (!base_ops.to_xfer_memory ((CORE_ADDR)onp, (char *)&one,
+ sizeof (one), 1, NULL, &base_ops))
{
delete_breakpoint (b);
goto err;
diff --git a/gdb/v850ice.c b/gdb/v850ice.c
index 93746ff..21daeea 100644
--- a/gdb/v850ice.c
+++ b/gdb/v850ice.c
@@ -899,7 +899,7 @@ init_850ice_ops (void)
v850ice_ops.to_fetch_registers = v850ice_fetch_registers;
v850ice_ops.to_store_registers = v850ice_store_registers;
v850ice_ops.to_prepare_to_store = v850ice_prepare_to_store;
- v850ice_ops.deprecated_xfer_memory = v850ice_xfer_memory;
+ v850ice_ops.to_xfer_memory = v850ice_xfer_memory;
v850ice_ops.to_files_info = v850ice_files_info;
v850ice_ops.to_insert_breakpoint = v850ice_insert_breakpoint;
v850ice_ops.to_remove_breakpoint = v850ice_remove_breakpoint;
diff --git a/gdb/valarith.c b/gdb/valarith.c
index f88701f..7858f91 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -202,10 +202,7 @@ value_subscript (struct value *array, struct value *idx)
LONGEST index = value_as_long (idx);
if (index >= lowerbound && index <= upperbound)
return value_subscripted_rvalue (array, idx, lowerbound);
- /* Emit warning unless we have an array of unknown size.
- An array of unknown size has lowerbound 0 and upperbound -1. */
- if (upperbound > -1)
- warning ("array or string index out of range");
+ warning ("array or string index out of range");
/* fall doing C stuff */
c_style = 1;
}
diff --git a/gdb/vaxbsd-nat.c b/gdb/vaxbsd-nat.c
index bd505be..b00e93d 100644
--- a/gdb/vaxbsd-nat.c
+++ b/gdb/vaxbsd-nat.c
@@ -22,14 +22,12 @@
#include "defs.h"
#include "inferior.h"
#include "regcache.h"
-#include "target.h"
#include <sys/types.h>
#include <sys/ptrace.h>
#include <machine/reg.h>
#include "vax-tdep.h"
-#include "inf-ptrace.h"
/* Supply the general-purpose registers stored in GREGS to REGCACHE. */
@@ -64,8 +62,8 @@ vaxbsd_collect_gregset (const struct regcache *regcache,
/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this
for all registers. */
-static void
-vaxbsd_fetch_inferior_registers (int regnum)
+void
+fetch_inferior_registers (int regnum)
{
struct reg regs;
@@ -79,8 +77,8 @@ vaxbsd_fetch_inferior_registers (int regnum)
/* Store register REGNUM back into the inferior. If REGNUM is -1, do
this for all registers. */
-static void
-vaxbsd_store_inferior_registers (int regnum)
+void
+store_inferior_registers (int regnum)
{
struct reg regs;
@@ -135,13 +133,6 @@ void _initialize_vaxbsd_nat (void);
void
_initialize_vaxbsd_nat (void)
{
- struct target_ops *t;
-
- t = inf_ptrace_target ();
- t->to_fetch_registers = vaxbsd_fetch_inferior_registers;
- t->to_store_registers = vaxbsd_store_inferior_registers;
- add_target (t);
-
/* Support debugging kernel virtual memory images. */
bsd_kvm_add_target (vaxbsd_supply_pcb);
}
diff --git a/gdb/version.in b/gdb/version.in
index bf4a552..bcce9d2 100644
--- a/gdb/version.in
+++ b/gdb/version.in
@@ -1 +1 @@
-6.2.50_2004-10-18-cvs
+2004-09-15-cvs
diff --git a/gdb/win32-nat.c b/gdb/win32-nat.c
index 9845d46..601f28b 100644
--- a/gdb/win32-nat.c
+++ b/gdb/win32-nat.c
@@ -86,6 +86,9 @@ static int debug_registers_used;
#define DEBUG_MEM(x) if (debug_memory) printf_unfiltered x
#define DEBUG_EXCEPT(x) if (debug_exceptions) printf_unfiltered x
+/* Forward declaration */
+extern struct target_ops child_ops;
+
static void child_stop (void);
static int win32_child_thread_alive (ptid_t);
void child_kill_inferior (void);
@@ -1439,7 +1442,7 @@ do_initial_child_stuff (DWORD pid)
dr[i] = 0;
current_event.dwProcessId = pid;
memset (&current_event, 0, sizeof (current_event));
- push_target (&deprecated_child_ops);
+ push_target (&child_ops);
child_init_thread_list ();
disable_breakpoints_in_shlibs (1);
child_clear_solibs ();
@@ -1651,7 +1654,7 @@ child_detach (char *args, int from_tty)
gdb_flush (gdb_stdout);
}
inferior_ptid = null_ptid;
- unpush_target (&deprecated_child_ops);
+ unpush_target (&child_ops);
}
char *
@@ -1901,7 +1904,7 @@ child_mourn_inferior (void)
{
(void) child_continue (DBG_CONTINUE, -1);
i386_cleanup_dregs();
- unpush_target (&deprecated_child_ops);
+ unpush_target (&child_ops);
generic_mourn_inferior ();
}
@@ -2065,46 +2068,48 @@ child_close (int x)
PIDGET (inferior_ptid)));
}
+struct target_ops child_ops;
+
static void
init_child_ops (void)
{
- deprecated_child_ops.to_shortname = "child";
- deprecated_child_ops.to_longname = "Win32 child process";
- deprecated_child_ops.to_doc = "Win32 child process (started by the \"run\" command).";
- deprecated_child_ops.to_open = child_open;
- deprecated_child_ops.to_close = child_close;
- deprecated_child_ops.to_attach = child_attach;
- deprecated_child_ops.to_detach = child_detach;
- deprecated_child_ops.to_resume = child_resume;
- deprecated_child_ops.to_wait = child_wait;
- deprecated_child_ops.to_fetch_registers = child_fetch_inferior_registers;
- deprecated_child_ops.to_store_registers = child_store_inferior_registers;
- deprecated_child_ops.to_prepare_to_store = child_prepare_to_store;
- deprecated_child_ops.deprecated_xfer_memory = child_xfer_memory;
- deprecated_child_ops.to_files_info = child_files_info;
- deprecated_child_ops.to_insert_breakpoint = memory_insert_breakpoint;
- deprecated_child_ops.to_remove_breakpoint = memory_remove_breakpoint;
- deprecated_child_ops.to_terminal_init = terminal_init_inferior;
- deprecated_child_ops.to_terminal_inferior = terminal_inferior;
- deprecated_child_ops.to_terminal_ours_for_output = terminal_ours_for_output;
- deprecated_child_ops.to_terminal_ours = terminal_ours;
- deprecated_child_ops.to_terminal_save_ours = terminal_save_ours;
- deprecated_child_ops.to_terminal_info = child_terminal_info;
- deprecated_child_ops.to_kill = child_kill_inferior;
- deprecated_child_ops.to_create_inferior = child_create_inferior;
- deprecated_child_ops.to_mourn_inferior = child_mourn_inferior;
- deprecated_child_ops.to_can_run = child_can_run;
- deprecated_child_ops.to_thread_alive = win32_child_thread_alive;
- deprecated_child_ops.to_pid_to_str = cygwin_pid_to_str;
- deprecated_child_ops.to_stop = child_stop;
- deprecated_child_ops.to_stratum = process_stratum;
- deprecated_child_ops.to_has_all_memory = 1;
- deprecated_child_ops.to_has_memory = 1;
- deprecated_child_ops.to_has_stack = 1;
- deprecated_child_ops.to_has_registers = 1;
- deprecated_child_ops.to_has_execution = 1;
- deprecated_child_ops.to_magic = OPS_MAGIC;
- deprecated_child_ops.to_pid_to_exec_file = child_pid_to_exec_file;
+ child_ops.to_shortname = "child";
+ child_ops.to_longname = "Win32 child process";
+ child_ops.to_doc = "Win32 child process (started by the \"run\" command).";
+ child_ops.to_open = child_open;
+ child_ops.to_close = child_close;
+ child_ops.to_attach = child_attach;
+ child_ops.to_detach = child_detach;
+ child_ops.to_resume = child_resume;
+ child_ops.to_wait = child_wait;
+ child_ops.to_fetch_registers = child_fetch_inferior_registers;
+ child_ops.to_store_registers = child_store_inferior_registers;
+ child_ops.to_prepare_to_store = child_prepare_to_store;
+ child_ops.to_xfer_memory = child_xfer_memory;
+ child_ops.to_files_info = child_files_info;
+ child_ops.to_insert_breakpoint = memory_insert_breakpoint;
+ child_ops.to_remove_breakpoint = memory_remove_breakpoint;
+ child_ops.to_terminal_init = terminal_init_inferior;
+ child_ops.to_terminal_inferior = terminal_inferior;
+ child_ops.to_terminal_ours_for_output = terminal_ours_for_output;
+ child_ops.to_terminal_ours = terminal_ours;
+ child_ops.to_terminal_save_ours = terminal_save_ours;
+ child_ops.to_terminal_info = child_terminal_info;
+ child_ops.to_kill = child_kill_inferior;
+ child_ops.to_create_inferior = child_create_inferior;
+ child_ops.to_mourn_inferior = child_mourn_inferior;
+ child_ops.to_can_run = child_can_run;
+ child_ops.to_thread_alive = win32_child_thread_alive;
+ child_ops.to_pid_to_str = cygwin_pid_to_str;
+ child_ops.to_stop = child_stop;
+ child_ops.to_stratum = process_stratum;
+ child_ops.to_has_all_memory = 1;
+ child_ops.to_has_memory = 1;
+ child_ops.to_has_stack = 1;
+ child_ops.to_has_registers = 1;
+ child_ops.to_has_execution = 1;
+ child_ops.to_magic = OPS_MAGIC;
+ child_ops.to_pid_to_exec_file = child_pid_to_exec_file;
}
void
@@ -2180,7 +2185,7 @@ _initialize_win32_nat (void)
"Display selectors infos.",
&info_w32_cmdlist);
- add_target (&deprecated_child_ops);
+ add_target (&child_ops);
}
/* Hardware watchpoint support, adapted from go32-nat.c code. */
diff --git a/gdb/wince.c b/gdb/wince.c
index 0397bd4..a9dafee 100644
--- a/gdb/wince.c
+++ b/gdb/wince.c
@@ -1,6 +1,5 @@
/* Target-vector operations for controlling Windows CE child processes, for GDB.
-
- Copyright 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
Contributed by Cygnus Solutions, A Red Hat Company.
This file is part of GDB.
@@ -127,6 +126,9 @@ upload_options[3] =
static char *remote_upload = NULL; /* Set by set remoteupload */
static int remote_add_host = 0;
+/* Forward declaration */
+extern struct target_ops child_ops;
+
static int win32_child_thread_alive (ptid_t);
void child_kill_inferior (void);
@@ -1763,7 +1765,7 @@ child_create_inferior (char *exec_file, char *args, char **env,
memset (&current_event, 0, sizeof (current_event));
current_event.dwThreadId = pi.dwThreadId;
inferior_ptid = pid_to_ptid (current_event.dwThreadId);
- push_target (&deprecated_child_ops);
+ push_target (&child_ops);
child_init_thread_list ();
child_add_thread (pi.dwThreadId, pi.hThread);
init_wait_for_inferior ();
@@ -1784,7 +1786,7 @@ static void
child_mourn_inferior (void)
{
(void) child_continue (DBG_CONTINUE, -1);
- unpush_target (&deprecated_child_ops);
+ unpush_target (&child_ops);
stop_stub ();
CeRapiUninit ();
connection_initialized = 0;
@@ -1886,43 +1888,45 @@ child_load (char *file, int from_tty)
upload_to_device (file, file);
}
+struct target_ops child_ops;
+
static void
init_child_ops (void)
{
- memset (&deprecated_child_ops, 0, sizeof (deprecated_child_ops));
- deprecated_child_ops.to_shortname = (char *) "child";
- deprecated_child_ops.to_longname = (char *) "Windows CE process";
- deprecated_child_ops.to_doc = (char *) "Windows CE process (started by the \"run\" command).";
- deprecated_child_ops.to_open = child_open;
- deprecated_child_ops.to_close = child_close;
- deprecated_child_ops.to_resume = child_resume;
- deprecated_child_ops.to_wait = child_wait;
- deprecated_child_ops.to_fetch_registers = child_fetch_inferior_registers;
- deprecated_child_ops.to_store_registers = child_store_inferior_registers;
- deprecated_child_ops.to_prepare_to_store = child_prepare_to_store;
- deprecated_child_ops.deprecated_xfer_memory = child_xfer_memory;
- deprecated_child_ops.to_files_info = child_files_info;
- deprecated_child_ops.to_insert_breakpoint = memory_insert_breakpoint;
- deprecated_child_ops.to_remove_breakpoint = memory_remove_breakpoint;
- deprecated_child_ops.to_terminal_init = terminal_init_inferior;
- deprecated_child_ops.to_terminal_inferior = terminal_inferior;
- deprecated_child_ops.to_terminal_ours_for_output = terminal_ours_for_output;
- deprecated_child_ops.to_terminal_ours = terminal_ours;
- deprecated_child_ops.to_terminal_save_ours = terminal_save_ours;
- deprecated_child_ops.to_terminal_info = child_terminal_info;
- deprecated_child_ops.to_kill = child_kill_inferior;
- deprecated_child_ops.to_load = child_load;
- deprecated_child_ops.to_create_inferior = child_create_inferior;
- deprecated_child_ops.to_mourn_inferior = child_mourn_inferior;
- deprecated_child_ops.to_can_run = child_can_run;
- deprecated_child_ops.to_thread_alive = win32_child_thread_alive;
- deprecated_child_ops.to_stratum = process_stratum;
- deprecated_child_ops.to_has_all_memory = 1;
- deprecated_child_ops.to_has_memory = 1;
- deprecated_child_ops.to_has_stack = 1;
- deprecated_child_ops.to_has_registers = 1;
- deprecated_child_ops.to_has_execution = 1;
- deprecated_child_ops.to_magic = OPS_MAGIC;
+ memset (&child_ops, 0, sizeof (child_ops));
+ child_ops.to_shortname = (char *) "child";
+ child_ops.to_longname = (char *) "Windows CE process";
+ child_ops.to_doc = (char *) "Windows CE process (started by the \"run\" command).";
+ child_ops.to_open = child_open;
+ child_ops.to_close = child_close;
+ child_ops.to_resume = child_resume;
+ child_ops.to_wait = child_wait;
+ child_ops.to_fetch_registers = child_fetch_inferior_registers;
+ child_ops.to_store_registers = child_store_inferior_registers;
+ child_ops.to_prepare_to_store = child_prepare_to_store;
+ child_ops.to_xfer_memory = child_xfer_memory;
+ child_ops.to_files_info = child_files_info;
+ child_ops.to_insert_breakpoint = memory_insert_breakpoint;
+ child_ops.to_remove_breakpoint = memory_remove_breakpoint;
+ child_ops.to_terminal_init = terminal_init_inferior;
+ child_ops.to_terminal_inferior = terminal_inferior;
+ child_ops.to_terminal_ours_for_output = terminal_ours_for_output;
+ child_ops.to_terminal_ours = terminal_ours;
+ child_ops.to_terminal_save_ours = terminal_save_ours;
+ child_ops.to_terminal_info = child_terminal_info;
+ child_ops.to_kill = child_kill_inferior;
+ child_ops.to_load = child_load;
+ child_ops.to_create_inferior = child_create_inferior;
+ child_ops.to_mourn_inferior = child_mourn_inferior;
+ child_ops.to_can_run = child_can_run;
+ child_ops.to_thread_alive = win32_child_thread_alive;
+ child_ops.to_stratum = process_stratum;
+ child_ops.to_has_all_memory = 1;
+ child_ops.to_has_memory = 1;
+ child_ops.to_has_stack = 1;
+ child_ops.to_has_registers = 1;
+ child_ops.to_has_execution = 1;
+ child_ops.to_magic = OPS_MAGIC;
}
@@ -2019,7 +2023,7 @@ debugging over a network.", &setlist),
&setlist),
&showlist);
- add_target (&deprecated_child_ops);
+ add_target (&child_ops);
}
/* Determine if the thread referenced by "pid" is alive
diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c
index 28f5d002..771a48e 100644
--- a/gdb/xstormy16-tdep.c
+++ b/gdb/xstormy16-tdep.c
@@ -20,25 +20,25 @@
Boston, MA 02111-1307, USA. */
#include "defs.h"
-#include "frame.h"
-#include "frame-base.h"
-#include "frame-unwind.h"
-#include "dwarf2-frame.h"
-#include "symtab.h"
-#include "gdbtypes.h"
-#include "gdbcmd.h"
-#include "gdbcore.h"
#include "value.h"
-#include "dis-asm.h"
#include "inferior.h"
-#include "gdb_string.h"
-#include "gdb_assert.h"
#include "arch-utils.h"
-#include "floatformat.h"
#include "regcache.h"
-#include "doublest.h"
-#include "osabi.h"
+#include "gdbcore.h"
#include "objfiles.h"
+#include "dis-asm.h"
+
+struct gdbarch_tdep
+{
+ /* gdbarch target dependent data here. Currently unused for Xstormy16. */
+};
+
+/* Extra info which is saved in each frame_info. */
+struct frame_extra_info
+{
+ int framesize;
+ int frameless_p;
+};
enum gdb_regnum
{
@@ -69,20 +69,6 @@ enum gdb_regnum
E_NUM_REGS
};
-/* Use an invalid address value as 'not available' marker. */
-enum { REG_UNAVAIL = (CORE_ADDR) -1 };
-
-struct xstormy16_frame_cache
-{
- /* Base address. */
- CORE_ADDR base;
- CORE_ADDR pc;
- LONGEST framesize;
- int uses_fp;
- CORE_ADDR saved_regs[E_NUM_REGS];
- CORE_ADDR saved_sp;
-};
-
/* Size of instructions, registers, etc. */
enum
{
@@ -101,8 +87,15 @@ enum
E_MAX_RETTYPE_SIZE_IN_REGS = E_MAX_RETTYPE_SIZE (E_R2_REGNUM)
};
+
+/* Size of all registers as a whole. */
+enum
+{
+ E_ALL_REGS_SIZE = (E_NUM_REGS - 1) * xstormy16_reg_size + xstormy16_pc_size
+};
+
/* Function: xstormy16_register_name
- Returns the name of the standard Xstormy16 register N. */
+ Returns the name of the standard Xstormy16 register N. */
static const char *
xstormy16_register_name (int regnum)
@@ -113,7 +106,8 @@ xstormy16_register_name (int regnum)
"psw", "sp", "pc"
};
- if (regnum < 0 || regnum >= E_NUM_REGS)
+ if (regnum < 0 ||
+ regnum >= sizeof (register_names) / sizeof (register_names[0]))
internal_error (__FILE__, __LINE__,
"xstormy16_register_name: illegal register number %d",
regnum);
@@ -122,18 +116,172 @@ xstormy16_register_name (int regnum)
}
+/* Function: xstormy16_register_byte
+ Returns the byte position in the register cache for register N. */
+
+static int
+xstormy16_register_byte (int regnum)
+{
+ if (regnum < 0 || regnum >= E_NUM_REGS)
+ internal_error (__FILE__, __LINE__,
+ "xstormy16_register_byte: illegal register number %d",
+ regnum);
+ else
+ /* All registers occupy 2 bytes in the regcache except for PC
+ which is the last one. Therefore the byte position is still
+ simply a multiple of 2. */
+ return regnum * xstormy16_reg_size;
+}
+
+/* Function: xstormy16_register_raw_size
+ Returns the number of bytes occupied by the register on the target. */
+
+static int
+xstormy16_register_raw_size (int regnum)
+{
+ if (regnum < 0 || regnum >= E_NUM_REGS)
+ internal_error (__FILE__, __LINE__,
+ "xstormy16_register_raw_size: illegal register number %d",
+ regnum);
+ /* Only the PC has 4 Byte, all other registers 2 Byte. */
+ else if (regnum == E_PC_REGNUM)
+ return xstormy16_pc_size;
+ else
+ return xstormy16_reg_size;
+}
+
+/* Function: xstormy16_reg_virtual_type
+ Returns the default type for register N. */
+
static struct type *
-xstormy16_register_type (struct gdbarch *gdbarch, int regnum)
+xstormy16_reg_virtual_type (int regnum)
{
- if (regnum == E_PC_REGNUM)
+ if (regnum < 0 || regnum >= E_NUM_REGS)
+ internal_error (__FILE__, __LINE__,
+ "xstormy16_register_virtual_type: illegal register number %d",
+ regnum);
+ else if (regnum == E_PC_REGNUM)
return builtin_type_uint32;
else
return builtin_type_uint16;
}
+/* Function: xstormy16_get_saved_register
+ Find a register's saved value on the call stack.
+
+ Find register number REGNUM relative to FRAME and put its (raw,
+ target format) contents in *RAW_BUFFER.
+
+ Set *OPTIMIZED if the variable was optimized out (and thus can't be
+ fetched). Note that this is never set to anything other than zero
+ in this implementation.
+
+ Set *LVAL to lval_memory, lval_register, or not_lval, depending on
+ whether the value was fetched from memory, from a register, or in a
+ strange and non-modifiable way (e.g. a frame pointer which was
+ calculated rather than fetched). We will use not_lval for values
+ fetched from generic dummy frames.
+
+ Set *ADDRP to the address, either in memory or as a
+ DEPRECATED_REGISTER_BYTE offset into the registers array. If the
+ value is stored in a dummy frame, set *ADDRP to zero.
+
+ The argument RAW_BUFFER must point to aligned memory.
+
+ The GET_SAVED_REGISTER architecture interface is entirely
+ redundant. New architectures should implement per-frame unwinders
+ (ref "frame-unwind.h"). */
+
+static void
+xstormy16_get_saved_register (char *raw_buffer, int *optimized,
+ CORE_ADDR *addrp,
+ struct frame_info *frame, int regnum,
+ enum lval_type *lval)
+{
+ if (!target_has_registers)
+ error ("No registers.");
+
+ /* Normal systems don't optimize out things with register numbers. */
+ if (optimized != NULL)
+ *optimized = 0;
+
+ if (addrp) /* default assumption: not found in memory */
+ *addrp = 0;
+
+ /* Note: since the current frame's registers could only have been
+ saved by frames INTERIOR TO the current frame, we skip examining
+ the current frame itself: otherwise, we would be getting the
+ previous frame's registers which were saved by the current frame. */
+
+ if (frame != NULL)
+ {
+ for (frame = get_next_frame (frame);
+ get_frame_type (frame) != SENTINEL_FRAME;
+ frame = get_next_frame (frame))
+ {
+ if (get_frame_type (frame) == DUMMY_FRAME)
+ {
+ if (lval) /* found it in a CALL_DUMMY frame */
+ *lval = not_lval;
+ if (raw_buffer)
+ {
+ LONGEST val;
+ /* FIXME: cagney/2002-06-26: This should be via the
+ gdbarch_register_read() method so that it, on the
+ fly, constructs either a raw or pseudo register
+ from the raw register cache. */
+ val = deprecated_read_register_dummy (get_frame_pc (frame),
+ get_frame_base (frame),
+ regnum);
+ store_unsigned_integer (raw_buffer,
+ register_size (current_gdbarch, regnum),
+ val);
+ }
+ return;
+ }
+
+ DEPRECATED_FRAME_INIT_SAVED_REGS (frame);
+ if (deprecated_get_frame_saved_regs (frame) != NULL
+ && deprecated_get_frame_saved_regs (frame)[regnum] != 0)
+ {
+ if (lval) /* found it saved on the stack */
+ *lval = lval_memory;
+ if (regnum == SP_REGNUM)
+ {
+ if (raw_buffer) /* SP register treated specially */
+ /* NOTE: cagney/2003-05-09: In-line store_address()
+ with it's body - store_unsigned_integer(). */
+ store_unsigned_integer (raw_buffer,
+ register_size (current_gdbarch, regnum),
+ deprecated_get_frame_saved_regs (frame)[regnum]);
+ }
+ else
+ {
+ if (addrp) /* any other register */
+ *addrp = deprecated_get_frame_saved_regs (frame)[regnum];
+ if (raw_buffer)
+ read_memory (deprecated_get_frame_saved_regs (frame)[regnum], raw_buffer,
+ register_size (current_gdbarch, regnum));
+ }
+ return;
+ }
+ }
+ }
+
+ /* If we get thru the loop to this point, it means the register was
+ not saved in any frame. Return the actual live-register value. */
+
+ if (lval) /* found it in a live register */
+ *lval = lval_register;
+ if (addrp)
+ *addrp = DEPRECATED_REGISTER_BYTE (regnum);
+ if (raw_buffer)
+ deprecated_read_register_gen (regnum, raw_buffer);
+}
+
/* Function: xstormy16_type_is_scalar
Makes the decision if a given type is a scalar types. Scalar
- types are returned in the registers r2-r7 as they fit. */
+ types are returned in the registers r2-r7 as they fit. */
static int
xstormy16_type_is_scalar (struct type *t)
@@ -143,117 +291,66 @@ xstormy16_type_is_scalar (struct type *t)
&& TYPE_CODE(t) != TYPE_CODE_ARRAY);
}
-/* Function: xstormy16_use_struct_convention
- Returns non-zero if the given struct type will be returned using
- a special convention, rather than the normal function return method.
- 7sed in the contexts of the "return" command, and of
- target function calls from the debugger. */
-
-static int
-xstormy16_use_struct_convention (struct type *type)
-{
- return !xstormy16_type_is_scalar (type)
- || TYPE_LENGTH (type) > E_MAX_RETTYPE_SIZE_IN_REGS;
-}
-
/* Function: xstormy16_extract_return_value
- Find a function's return value in the appropriate registers (in
- regbuf), and copy it into valbuf. */
+ Copy the function's return value into VALBUF.
+ This function is called only in the context of "target function calls",
+ ie. when the debugger forces a function to be called in the child, and
+ when the debugger forces a function to return prematurely via the
+ "return" command. */
static void
-xstormy16_extract_return_value (struct type *type, struct regcache *regcache,
- void *valbuf)
+xstormy16_extract_return_value (struct type *type, char *regbuf, char *valbuf)
{
- int len = TYPE_LENGTH (type);
- int i, regnum = E_1ST_ARG_REGNUM;
-
- for (i = 0; i < len; i += xstormy16_reg_size)
- regcache_raw_read (regcache, regnum++, (char *) valbuf + i);
-}
+ CORE_ADDR return_buffer;
+ int offset = 0;
-/* Function: xstormy16_store_return_value
- Copy the function return value from VALBUF into the
- proper location for a function return.
- Called only in the context of the "return" command. */
-
-static void
-xstormy16_store_return_value (struct type *type, struct regcache *regcache,
- const void *valbuf)
-{
- if (TYPE_LENGTH (type) == 1)
- {
- /* Add leading zeros to the value. */
- char buf[xstormy16_reg_size];
- memset (buf, 0, xstormy16_reg_size);
- memcpy (buf, valbuf, 1);
- regcache_raw_write (regcache, E_1ST_ARG_REGNUM, buf);
+ if (xstormy16_type_is_scalar (type)
+ && TYPE_LENGTH (type) <= E_MAX_RETTYPE_SIZE_IN_REGS)
+ {
+ /* Scalar return values of <= 12 bytes are returned in
+ E_1ST_ARG_REGNUM to E_LST_ARG_REGNUM. */
+ memcpy (valbuf,
+ &regbuf[DEPRECATED_REGISTER_BYTE (E_1ST_ARG_REGNUM)] + offset,
+ TYPE_LENGTH (type));
}
else
{
- int len = TYPE_LENGTH (type);
- int i, regnum = E_1ST_ARG_REGNUM;
+ /* Aggregates and return values > 12 bytes are returned in memory,
+ pointed to by R2. */
+ return_buffer =
+ extract_unsigned_integer (regbuf + DEPRECATED_REGISTER_BYTE (E_PTR_RET_REGNUM),
+ register_size (current_gdbarch, E_PTR_RET_REGNUM));
- for (i = 0; i < len; i += xstormy16_reg_size)
- regcache_raw_write (regcache, regnum++, (char *) valbuf + i);
+ read_memory (return_buffer, valbuf, TYPE_LENGTH (type));
}
}
-static enum return_value_convention
-xstormy16_return_value (struct gdbarch *gdbarch, struct type *type,
- struct regcache *regcache,
- void *readbuf, const void *writebuf)
-{
- if (xstormy16_use_struct_convention (type))
- return RETURN_VALUE_STRUCT_CONVENTION;
- if (writebuf)
- xstormy16_store_return_value (type, regcache, writebuf);
- else if (readbuf)
- xstormy16_extract_return_value (type, regcache, readbuf);
- return RETURN_VALUE_REGISTER_CONVENTION;
-}
-
-static CORE_ADDR
-xstormy16_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr)
-{
- if (addr & 1)
- ++addr;
- return addr;
-}
-
-/* Function: xstormy16_push_dummy_call
+/* Function: xstormy16_push_arguments
Setup the function arguments for GDB to call a function in the inferior.
Called only in the context of a target function call from the debugger.
- Returns the value of the SP register after the args are pushed. */
+ Returns the value of the SP register after the args are pushed.
+*/
static CORE_ADDR
-xstormy16_push_dummy_call (struct gdbarch *gdbarch,
- struct value *function,
- struct regcache *regcache,
- CORE_ADDR bp_addr, int nargs,
- struct value **args,
- CORE_ADDR sp, int struct_return,
- CORE_ADDR struct_addr)
+xstormy16_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
+ int struct_return, CORE_ADDR struct_addr)
{
CORE_ADDR stack_dest = sp;
int argreg = E_1ST_ARG_REGNUM;
int i, j;
int typelen, slacklen;
char *val;
- char buf[xstormy16_pc_size];
/* If struct_return is true, then the struct return address will
consume one argument-passing register. */
if (struct_return)
- {
- regcache_cooked_write_unsigned (regcache, E_PTR_RET_REGNUM, struct_addr);
- argreg++;
- }
+ argreg++;
/* Arguments are passed in R2-R7 as they fit. If an argument doesn't
fit in the remaining registers we're switching over to the stack.
No argument is put on stack partially and as soon as we switched
over to stack no further argument is put in a register even if it
- would fit in the remaining unused registers. */
+ would fit in the remaining unused registers. */
for (i = 0; i < nargs && argreg <= E_LST_ARG_REGNUM; i++)
{
typelen = TYPE_LENGTH (VALUE_ENCLOSING_TYPE (args[i]));
@@ -263,7 +360,7 @@ xstormy16_push_dummy_call (struct gdbarch *gdbarch,
/* Put argument into registers wordwise. */
val = VALUE_CONTENTS (args[i]);
for (j = 0; j < typelen; j += xstormy16_reg_size)
- regcache_cooked_write_unsigned (regcache, argreg++,
+ write_register (argreg++,
extract_unsigned_integer (val + j,
typelen - j ==
1 ? 1 :
@@ -271,10 +368,11 @@ xstormy16_push_dummy_call (struct gdbarch *gdbarch,
}
/* Align SP */
- stack_dest = xstormy16_frame_align (gdbarch, stack_dest);
+ if (stack_dest & 1)
+ ++stack_dest;
/* Loop backwards through remaining arguments and push them on the stack,
- wordaligned. */
+ wordaligned. */
for (j = nargs - 1; j >= i; j--)
{
typelen = TYPE_LENGTH (VALUE_ENCLOSING_TYPE (args[j]));
@@ -288,16 +386,154 @@ xstormy16_push_dummy_call (struct gdbarch *gdbarch,
stack_dest += typelen + slacklen;
}
- store_unsigned_integer (buf, xstormy16_pc_size, bp_addr);
- write_memory (stack_dest, buf, xstormy16_pc_size);
- stack_dest += xstormy16_pc_size;
+ /* And that should do it. Return the new stack pointer. */
+ return stack_dest;
+}
+
+/* Function: xstormy16_push_return_address (pc)
+ Setup the return address for GDB to call a function in the inferior.
+ Called only in the context of a target function call from the debugger.
+ Returns the value of the SP register when the operation is finished
+ (which may or may not be the same as before).
+*/
+
+static CORE_ADDR
+xstormy16_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
+{
+ unsigned char buf[xstormy16_pc_size];
+
+ store_unsigned_integer (buf, xstormy16_pc_size, entry_point_address ());
+ write_memory (sp, buf, xstormy16_pc_size);
+ return sp + xstormy16_pc_size;
+}
+
+/* Function: xstormy16_pop_frame
+ Destroy the innermost (Top-Of-Stack) stack frame, restoring the
+ machine state that was in effect before the frame was created.
+ Used in the contexts of the "return" command, and of
+ target function calls from the debugger.
+*/
+
+static void
+xstormy16_pop_frame (void)
+{
+ struct frame_info *fi = get_current_frame ();
+ int i;
+
+ if (fi == NULL)
+ return; /* paranoia */
+
+ if (deprecated_pc_in_call_dummy (get_frame_pc (fi)))
+ {
+ deprecated_pop_dummy_frame ();
+ }
+ else
+ {
+ /* Restore the saved regs. */
+ for (i = 0; i < NUM_REGS; i++)
+ if (deprecated_get_frame_saved_regs (fi)[i])
+ {
+ if (i == SP_REGNUM)
+ write_register (i, deprecated_get_frame_saved_regs (fi)[i]);
+ else if (i == E_PC_REGNUM)
+ write_register (i, read_memory_integer (deprecated_get_frame_saved_regs (fi)[i],
+ xstormy16_pc_size));
+ else
+ write_register (i, read_memory_integer (deprecated_get_frame_saved_regs (fi)[i],
+ xstormy16_reg_size));
+ }
+ /* Restore the PC */
+ write_register (PC_REGNUM, DEPRECATED_FRAME_SAVED_PC (fi));
+ flush_cached_frames ();
+ }
+ return;
+}
+
+/* Function: xstormy16_store_struct_return
+ Copy the (struct) function return value to its destined location.
+ Called only in the context of a target function call from the debugger.
+*/
+
+static void
+xstormy16_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
+{
+ write_register (E_PTR_RET_REGNUM, addr);
+}
+
+/* Function: xstormy16_store_return_value
+ Copy the function return value from VALBUF into the
+ proper location for a function return.
+ Called only in the context of the "return" command.
+*/
+
+static void
+xstormy16_store_return_value (struct type *type, char *valbuf)
+{
+ CORE_ADDR return_buffer;
+ char buf[xstormy16_reg_size];
+
+ if (xstormy16_type_is_scalar (type) && TYPE_LENGTH (type) == 1)
+ {
+ /* Add leading zeros to the value. */
+ memset (buf, 0, xstormy16_reg_size);
+ memcpy (buf, valbuf, 1);
+ deprecated_write_register_gen (E_1ST_ARG_REGNUM, buf);
+ }
+ else if (xstormy16_type_is_scalar (type) &&
+ TYPE_LENGTH (type) <= E_MAX_RETTYPE_SIZE_IN_REGS)
+ deprecated_write_register_bytes (DEPRECATED_REGISTER_BYTE (E_1ST_ARG_REGNUM),
+ valbuf, TYPE_LENGTH (type));
+ else
+ {
+ return_buffer = read_register (E_PTR_RET_REGNUM);
+ write_memory (return_buffer, valbuf, TYPE_LENGTH (type));
+ }
+}
+
+/* Function: xstormy16_extract_struct_value_address
+ Returns the address in which a function should return a struct value.
+ Used in the contexts of the "return" command, and of
+ target function calls from the debugger.
+*/
- /* Update stack pointer. */
- regcache_cooked_write_unsigned (regcache, E_SP_REGNUM, stack_dest);
+static CORE_ADDR
+xstormy16_extract_struct_value_address (struct regcache *regcache)
+{
+ /* FIXME: cagney/2004-01-17: Does the ABI guarantee that the return
+ address regster is preserved across function calls? Probably
+ not, making this function wrong. */
+ ULONGEST val;
+ regcache_raw_read_unsigned (regcache, E_PTR_RET_REGNUM, &val);
+ return val;
+}
- /* Return the new stack pointer minus the return address slot since
- that's what DWARF2/GCC uses as the frame's CFA. */
- return stack_dest - xstormy16_pc_size;
+/* Function: xstormy16_use_struct_convention
+ Returns non-zero if the given struct type will be returned using
+ a special convention, rather than the normal function return method.
+ 7sed in the contexts of the "return" command, and of
+ target function calls from the debugger.
+*/
+
+static int
+xstormy16_use_struct_convention (int gcc_p, struct type *type)
+{
+ return !xstormy16_type_is_scalar (type)
+ || TYPE_LENGTH (type) > E_MAX_RETTYPE_SIZE_IN_REGS;
+}
+
+/* Function: frame_saved_register
+ Returns the value that regnum had in frame fi
+ (saved in fi or in one of its children).
+*/
+
+static CORE_ADDR
+xstormy16_frame_saved_register (struct frame_info *fi, int regnum)
+{
+ int size = xstormy16_register_raw_size (regnum);
+ char *buf = (char *) alloca (size);
+
+ xstormy16_get_saved_register (buf, NULL, NULL, fi, regnum, NULL);
+ return (CORE_ADDR) extract_unsigned_integer (buf, size);
}
/* Function: xstormy16_scan_prologue
@@ -305,25 +541,36 @@ xstormy16_push_dummy_call (struct gdbarch *gdbarch,
Decide when we must have reached the end of the function prologue.
If a frame_info pointer is provided, fill in its saved_regs etc.
- Returns the address of the first instruction after the prologue. */
+ Returns the address of the first instruction after the prologue.
+*/
static CORE_ADDR
-xstormy16_analyze_prologue (CORE_ADDR start_addr, CORE_ADDR end_addr,
- struct xstormy16_frame_cache *cache,
- struct frame_info *next_frame)
+xstormy16_scan_prologue (CORE_ADDR start_addr, CORE_ADDR end_addr,
+ struct frame_info *fi, int *frameless)
{
+ CORE_ADDR sp = 0, fp = 0;
CORE_ADDR next_addr;
ULONGEST inst, inst2;
LONGEST offset;
int regnum;
- /* Initialize framesize with size of PC put on stack by CALLF inst. */
- cache->saved_regs[E_PC_REGNUM] = 0;
- cache->framesize = xstormy16_pc_size;
-
- if (start_addr >= end_addr)
- return end_addr;
-
+ if (frameless)
+ *frameless = 1;
+ if (fi)
+ {
+ /* In a call dummy, don't touch the frame. */
+ if (deprecated_pc_in_call_dummy (get_frame_pc (fi)))
+ return start_addr;
+
+ /* Grab the frame-relative values of SP and FP, needed below.
+ The frame_saved_register function will find them on the
+ stack or in the registers as appropriate. */
+ sp = xstormy16_frame_saved_register (fi, E_SP_REGNUM);
+ fp = xstormy16_frame_saved_register (fi, E_FP_REGNUM);
+
+ /* Initialize framesize with size of PC put on stack by CALLF inst. */
+ get_frame_extra_info (fi)->framesize = xstormy16_pc_size;
+ }
for (next_addr = start_addr;
next_addr < end_addr; next_addr += xstormy16_inst_size)
{
@@ -333,33 +580,42 @@ xstormy16_analyze_prologue (CORE_ADDR start_addr, CORE_ADDR end_addr,
if (inst >= 0x0082 && inst <= 0x008d) /* push r2 .. push r13 */
{
- regnum = inst & 0x000f;
- cache->saved_regs[regnum] = cache->framesize;
- cache->framesize += xstormy16_reg_size;
+ if (fi)
+ {
+ regnum = inst & 0x000f;
+ deprecated_get_frame_saved_regs (fi)[regnum] = get_frame_extra_info (fi)->framesize;
+ get_frame_extra_info (fi)->framesize += xstormy16_reg_size;
+ }
}
/* optional stack allocation for args and local vars <= 4 byte */
else if (inst == 0x301f || inst == 0x303f) /* inc r15, #0x1/#0x3 */
{
- cache->framesize += ((inst & 0x0030) >> 4) + 1;
+ if (fi) /* Record the frame size. */
+ get_frame_extra_info (fi)->framesize += ((inst & 0x0030) >> 4) + 1;
}
/* optional stack allocation for args and local vars > 4 && < 16 byte */
else if ((inst & 0xff0f) == 0x510f) /* 51Hf add r15, #0xH */
{
- cache->framesize += (inst & 0x00f0) >> 4;
+ if (fi) /* Record the frame size. */
+ get_frame_extra_info (fi)->framesize += (inst & 0x00f0) >> 4;
}
/* optional stack allocation for args and local vars >= 16 byte */
else if (inst == 0x314f && inst2 >= 0x0010) /* 314f HHHH add r15, #0xH */
{
- cache->framesize += inst2;
+ if (fi) /* Record the frame size. */
+ get_frame_extra_info (fi)->framesize += inst2;
next_addr += xstormy16_inst_size;
}
else if (inst == 0x46fd) /* mov r13, r15 */
{
- cache->uses_fp = 1;
+ if (fi) /* Record that the frame pointer is in use. */
+ get_frame_extra_info (fi)->frameless_p = 0;
+ if (frameless)
+ *frameless = 0;
}
/* optional copying of args in r2-r7 to r10-r13 */
@@ -374,21 +630,83 @@ xstormy16_analyze_prologue (CORE_ADDR start_addr, CORE_ADDR end_addr,
/* 73DS HHHH mov.w (rD, 0xHHHH), r(S-8) */
else if ((inst & 0xfed8) == 0x72d8 && (inst & 0x0007) >= 2)
{
- regnum = inst & 0x0007;
- /* Only 12 of 16 bits of the argument are used for the
- signed offset. */
- offset = (LONGEST) (inst2 & 0x0fff);
- if (offset & 0x0800)
- offset -= 0x1000;
-
- cache->saved_regs[regnum] = cache->framesize + offset;
+ if (fi)
+ {
+ regnum = inst & 0x0007;
+ /* Only 12 of 16 bits of the argument are used for the
+ signed offset. */
+ offset = (LONGEST) (inst2 & 0x0fff);
+ if (offset & 0x0800)
+ offset -= 0x1000;
+
+ deprecated_get_frame_saved_regs (fi)[regnum] = get_frame_extra_info (fi)->framesize + offset;
+ }
+ next_addr += xstormy16_inst_size;
+ }
+
+#if 0
+ /* 2001-08-10: Not part of the prologue anymore due to change in
+ ABI. r8 and r9 are not used for argument passing anymore. */
+
+ /* optional copying of r8, r9 to stack */
+ /* 46S7; 73Df HHHH mov.w r7,rS; mov.w (rD, 0xHHHH), r7 D=8,9; S=13,15 */
+ /* 46S7; 72df HHHH mov.w r7,rS; mov.b (rD, 0xHHHH), r7 D=8,9; S=13,15 */
+ else if ((inst & 0xffef) == 0x4687 && (inst2 & 0xfedf) == 0x72df)
+ {
+ next_addr += xstormy16_inst_size;
+ if (fi)
+ {
+ regnum = (inst & 0x00f0) >> 4;
+ inst = inst2;
+ inst2 = read_memory_unsigned_integer (next_addr
+ + xstormy16_inst_size,
+ xstormy16_inst_size);
+ /* Only 12 of 16 bits of the argument are used for the
+ signed offset. */
+ offset = (LONGEST) (inst2 & 0x0fff);
+ if (offset & 0x0800)
+ offset -= 0x1000;
+
+ fi->saved_regs[regnum] = fi->extra_info->framesize + offset;
+ }
next_addr += xstormy16_inst_size;
}
+#endif
else /* Not a prologue instruction. */
break;
}
+ if (fi)
+ {
+ /* Special handling for the "saved" address of the SP:
+ The SP is of course never saved on the stack at all, so
+ by convention what we put here is simply the previous
+ _value_ of the SP (as opposed to an address where the
+ previous value would have been pushed). */
+ if (get_frame_extra_info (fi)->frameless_p)
+ {
+ deprecated_get_frame_saved_regs (fi)[E_SP_REGNUM] = sp - get_frame_extra_info (fi)->framesize;
+ deprecated_update_frame_base_hack (fi, sp);
+ }
+ else
+ {
+ deprecated_get_frame_saved_regs (fi)[E_SP_REGNUM] = fp - get_frame_extra_info (fi)->framesize;
+ deprecated_update_frame_base_hack (fi, fp);
+ }
+
+ /* So far only offsets to the beginning of the frame are
+ saved in the saved_regs. Now we now the relation between
+ sp, fp and framesize. We know the beginning of the frame
+ so we can translate the register offsets to real addresses. */
+ for (regnum = 0; regnum < E_SP_REGNUM; ++regnum)
+ if (deprecated_get_frame_saved_regs (fi)[regnum])
+ deprecated_get_frame_saved_regs (fi)[regnum] += deprecated_get_frame_saved_regs (fi)[E_SP_REGNUM];
+
+ /* Save address of PC on stack. */
+ deprecated_get_frame_saved_regs (fi)[E_PC_REGNUM] = deprecated_get_frame_saved_regs (fi)[E_SP_REGNUM];
+ }
+
return next_addr;
}
@@ -412,12 +730,12 @@ xstormy16_skip_prologue (CORE_ADDR pc)
{
struct symtab_and_line sal;
struct symbol *sym;
- struct xstormy16_frame_cache cache;
/* Don't trust line number debug info in frameless functions. */
- CORE_ADDR plg_end = xstormy16_analyze_prologue (func_addr, func_end,
- &cache, NULL);
- if (!cache.uses_fp)
+ int frameless = 1;
+ CORE_ADDR plg_end = xstormy16_scan_prologue (func_addr, func_end,
+ NULL, &frameless);
+ if (frameless)
return plg_end;
/* Found a function. */
@@ -447,7 +765,7 @@ xstormy16_skip_prologue (CORE_ADDR pc)
static int
xstormy16_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc)
{
- CORE_ADDR func_addr = 0, func_end = 0;
+ CORE_ADDR addr, func_addr = 0, func_end = 0;
if (find_pc_partial_function (pc, NULL, &func_addr, &func_end))
{
@@ -486,6 +804,151 @@ xstormy16_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc)
return 0;
}
+/* Function: xstormy16_frame_init_saved_regs
+ Set up the 'saved_regs' array.
+ This is a data structure containing the addresses on the stack
+ where each register has been saved, for each stack frame.
+ Registers that have not been saved will have zero here.
+ The stack register is special: rather than the address where the
+ stack register has been saved, saved_regs[SP_REGNUM] will have the
+ actual value of the previous frame's stack register.
+
+ This function may be called in any context where the saved register
+ values may be needed (backtrace, frame_info, frame_register). On
+ many targets, it is called directly by init_extra_frame_info, in
+ part because the information may be needed immediately by
+ frame_chain. */
+
+static void
+xstormy16_frame_init_saved_regs (struct frame_info *fi)
+{
+ CORE_ADDR func_addr, func_end;
+
+ if (!deprecated_get_frame_saved_regs (fi))
+ {
+ frame_saved_regs_zalloc (fi);
+
+ /* Find the beginning of this function, so we can analyze its
+ prologue. */
+ if (find_pc_partial_function (get_frame_pc (fi), NULL, &func_addr, &func_end))
+ xstormy16_scan_prologue (func_addr, get_frame_pc (fi), fi, NULL);
+ /* Else we're out of luck (can't debug completely stripped code).
+ FIXME. */
+ }
+}
+
+/* Function: xstormy16_frame_saved_pc
+ Returns the return address for the selected frame.
+ Called by frame_info, legacy_frame_chain_valid, and sometimes by
+ get_prev_frame. */
+
+static CORE_ADDR
+xstormy16_frame_saved_pc (struct frame_info *fi)
+{
+ CORE_ADDR saved_pc;
+
+ if (deprecated_pc_in_call_dummy (get_frame_pc (fi)))
+ {
+ saved_pc = deprecated_read_register_dummy (get_frame_pc (fi),
+ get_frame_base (fi),
+ E_PC_REGNUM);
+ }
+ else
+ {
+ saved_pc = read_memory_unsigned_integer (deprecated_get_frame_saved_regs (fi)[E_PC_REGNUM],
+ xstormy16_pc_size);
+ }
+
+ return saved_pc;
+}
+
+/* Function: xstormy16_init_extra_frame_info
+ This is the constructor function for the frame_info struct,
+ called whenever a new frame_info is created (from create_new_frame,
+ and from get_prev_frame).
+*/
+
+static void
+xstormy16_init_extra_frame_info (int fromleaf, struct frame_info *fi)
+{
+ if (!get_frame_extra_info (fi))
+ {
+ frame_extra_info_zalloc (fi, sizeof (struct frame_extra_info));
+ get_frame_extra_info (fi)->framesize = 0;
+ get_frame_extra_info (fi)->frameless_p = 1; /* Default frameless, detect framed */
+
+ /* By default, the fi->frame is set to the value of the FP reg by gdb.
+ This may not always be right; we may be in a frameless function,
+ or we may be in the prologue, before the FP has been set up.
+ Unfortunately, we can't make this determination without first
+ calling scan_prologue, and we can't do that unles we know the
+ get_frame_pc (fi). */
+
+ if (!get_frame_pc (fi))
+ {
+ /* Sometimes we are called from get_prev_frame without
+ the PC being set up first. Long history, don't ask.
+ Fortunately this will never happen from the outermost
+ frame, so we should be able to get the saved pc from
+ the next frame. */
+ if (get_next_frame (fi))
+ deprecated_update_frame_pc_hack (fi, xstormy16_frame_saved_pc (get_next_frame (fi)));
+ }
+
+ /* Take care of the saved_regs right here (non-lazy). */
+ xstormy16_frame_init_saved_regs (fi);
+ }
+}
+
+/* Function: xstormy16_frame_chain
+ Returns a pointer to the stack frame of the calling function.
+ Called only from get_prev_frame. Needed for backtrace, "up", etc.
+*/
+
+static CORE_ADDR
+xstormy16_frame_chain (struct frame_info *fi)
+{
+ if (deprecated_pc_in_call_dummy (get_frame_pc (fi)))
+ {
+ /* Call dummy's frame is the same as caller's. */
+ return get_frame_base (fi);
+ }
+ else
+ {
+ /* Return computed offset from this frame's fp. */
+ return get_frame_base (fi) - get_frame_extra_info (fi)->framesize;
+ }
+}
+
+static int
+xstormy16_frame_chain_valid (CORE_ADDR chain, struct frame_info *thisframe)
+{
+ return chain < 0x8000 && DEPRECATED_FRAME_SAVED_PC (thisframe) >= 0x8000 &&
+ (get_frame_extra_info (thisframe)->frameless_p ||
+ get_frame_base (thisframe) - get_frame_extra_info (thisframe)->framesize == chain);
+}
+
+/* Function: xstormy16_saved_pc_after_call Returns the previous PC
+ immediately after a function call. This function is meant to
+ bypass the regular frame_register() mechanism, ie. it is meant to
+ work even if the frame isn't complete. Called by
+ step_over_function, and sometimes by get_prev_frame. */
+
+static CORE_ADDR
+xstormy16_saved_pc_after_call (struct frame_info *ignore)
+{
+ CORE_ADDR sp, pc, tmp;
+
+ sp = read_register (E_SP_REGNUM) - xstormy16_pc_size;
+ pc = read_memory_integer (sp, xstormy16_pc_size);
+
+ /* Skip over jump table entry if necessary. */
+ if ((tmp = SKIP_TRAMPOLINE_CODE (pc)))
+ pc = tmp;
+
+ return pc;
+}
+
const static unsigned char *
xstormy16_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
{
@@ -550,6 +1013,7 @@ xstormy16_find_jmp_table_entry (CORE_ADDR faddr)
for (addr = osect->addr;
addr < osect->endaddr; addr += 2 * xstormy16_inst_size)
{
+ int status;
LONGEST inst, inst2, faddr2;
char buf[2 * xstormy16_inst_size];
@@ -570,7 +1034,7 @@ xstormy16_find_jmp_table_entry (CORE_ADDR faddr)
static CORE_ADDR
xstormy16_skip_trampoline_code (CORE_ADDR pc)
{
- CORE_ADDR tmp = xstormy16_resolve_jmp_table_entry (pc);
+ int tmp = xstormy16_resolve_jmp_table_entry (pc);
if (tmp && tmp != pc)
return tmp;
@@ -583,13 +1047,6 @@ xstormy16_in_solib_call_trampoline (CORE_ADDR pc, char *name)
return xstormy16_skip_trampoline_code (pc) != 0;
}
-/* Function pointers are 16 bit. The address space is 24 bit, using
- 32 bit addresses. Pointers to functions on the XStormy16 are implemented
- by using 16 bit pointers, which are either direct pointers in case the
- function begins below 0x10000, or indirect pointers into a jump table.
- The next two functions convert 16 bit pointers into 24 (32) bit addresses
- and vice versa. */
-
static CORE_ADDR
xstormy16_pointer_to_address (struct type *type, const void *buf)
{
@@ -620,164 +1077,20 @@ xstormy16_address_to_pointer (struct type *type, void *buf, CORE_ADDR addr)
store_unsigned_integer (buf, TYPE_LENGTH (type), addr);
}
-static struct xstormy16_frame_cache *
-xstormy16_alloc_frame_cache (void)
-{
- struct xstormy16_frame_cache *cache;
- int i;
-
- cache = FRAME_OBSTACK_ZALLOC (struct xstormy16_frame_cache);
-
- cache->base = 0;
- cache->saved_sp = 0;
- cache->pc = 0;
- cache->uses_fp = 0;
- cache->framesize = 0;
- for (i = 0; i < E_NUM_REGS; ++i)
- cache->saved_regs[i] = REG_UNAVAIL;
-
- return cache;
-}
-
-static struct xstormy16_frame_cache *
-xstormy16_frame_cache (struct frame_info *next_frame, void **this_cache)
-{
- struct xstormy16_frame_cache *cache;
- CORE_ADDR current_pc;
- int i;
-
- if (*this_cache)
- return *this_cache;
-
- cache = xstormy16_alloc_frame_cache ();
- *this_cache = cache;
-
- cache->base = frame_unwind_register_unsigned (next_frame, E_FP_REGNUM);
- if (cache->base == 0)
- return cache;
-
- cache->pc = frame_func_unwind (next_frame);
- current_pc = frame_pc_unwind (next_frame);
- if (cache->pc)
- xstormy16_analyze_prologue (cache->pc, current_pc, cache, next_frame);
-
- if (!cache->uses_fp)
- cache->base = frame_unwind_register_unsigned (next_frame, E_SP_REGNUM);
-
- cache->saved_sp = cache->base - cache->framesize;
-
- for (i = 0; i < E_NUM_REGS; ++i)
- if (cache->saved_regs[i] != REG_UNAVAIL)
- cache->saved_regs[i] += cache->saved_sp;
-
- return cache;
-}
-
-static void
-xstormy16_frame_prev_register (struct frame_info *next_frame, void **this_cache,
- int regnum, int *optimizedp,
- enum lval_type *lvalp, CORE_ADDR *addrp,
- int *realnump, void *valuep)
-{
- struct xstormy16_frame_cache *cache = xstormy16_frame_cache (next_frame,
- this_cache);
- gdb_assert (regnum >= 0);
-
- if (regnum == E_SP_REGNUM && cache->saved_sp)
- {
- *optimizedp = 0;
- *lvalp = not_lval;
- *addrp = 0;
- *realnump = -1;
- if (valuep)
- {
- /* Store the value. */
- store_unsigned_integer (valuep, xstormy16_reg_size, cache->saved_sp);
- }
- return;
- }
-
- if (regnum < E_NUM_REGS && cache->saved_regs[regnum] != REG_UNAVAIL)
- {
- *optimizedp = 0;
- *lvalp = lval_memory;
- *addrp = cache->saved_regs[regnum];
- *realnump = -1;
- if (valuep)
- {
- /* Read the value in from memory. */
- read_memory (*addrp, valuep,
- register_size (current_gdbarch, regnum));
- }
- return;
- }
-
- frame_register_unwind (next_frame, regnum,
- optimizedp, lvalp, addrp, realnump, valuep);
-}
-
-static void
-xstormy16_frame_this_id (struct frame_info *next_frame, void **this_cache,
- struct frame_id *this_id)
-{
- struct xstormy16_frame_cache *cache = xstormy16_frame_cache (next_frame,
- this_cache);
-
- /* This marks the outermost frame. */
- if (cache->base == 0)
- return;
-
- *this_id = frame_id_build (cache->saved_sp, cache->pc);
-}
-
-static CORE_ADDR
-xstormy16_frame_base_address (struct frame_info *next_frame, void **this_cache)
-{
- struct xstormy16_frame_cache *cache = xstormy16_frame_cache (next_frame,
- this_cache);
- return cache->base;
-}
-
-static const struct frame_unwind xstormy16_frame_unwind = {
- NORMAL_FRAME,
- xstormy16_frame_this_id,
- xstormy16_frame_prev_register
-};
-
-static const struct frame_base xstormy16_frame_base = {
- &xstormy16_frame_unwind,
- xstormy16_frame_base_address,
- xstormy16_frame_base_address,
- xstormy16_frame_base_address
-};
-
-static const struct frame_unwind *
-xstormy16_frame_sniffer (struct frame_info *next_frame)
-{
- return &xstormy16_frame_unwind;
-}
-
static CORE_ADDR
-xstormy16_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
+xstormy16_stack_align (CORE_ADDR addr)
{
- return frame_unwind_register_unsigned (next_frame, E_SP_REGNUM);
-}
-
-static CORE_ADDR
-xstormy16_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
- return frame_unwind_register_unsigned (next_frame, E_PC_REGNUM);
+ if (addr & 1)
+ ++addr;
+ return addr;
}
-static struct frame_id
-xstormy16_unwind_dummy_id (struct gdbarch *gdbarch,
- struct frame_info *next_frame)
+static void
+xstormy16_save_dummy_frame_tos (CORE_ADDR sp)
{
- return frame_id_build (xstormy16_unwind_sp (gdbarch, next_frame),
- frame_pc_unwind (next_frame));
+ generic_save_dummy_frame_tos (sp - xstormy16_pc_size);
}
-
/* Function: xstormy16_gdbarch_init
Initializer function for the xstormy16 gdbarch vector.
Called by gdbarch. Sets up the gdbarch vector(s) for this target. */
@@ -785,6 +1098,7 @@ xstormy16_unwind_dummy_id (struct gdbarch *gdbarch,
static struct gdbarch *
xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
+ struct gdbarch_tdep *tdep = NULL;
struct gdbarch *gdbarch;
/* find a candidate among the list of pre-declared architectures. */
@@ -792,68 +1106,91 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
if (arches != NULL)
return (arches->gdbarch);
- gdbarch = gdbarch_alloc (&info, NULL);
+#if 0
+ tdep = (struct gdbarch_tdep *) xmalloc (sizeof (struct gdbarch_tdep));
+#endif
+
+ gdbarch = gdbarch_alloc (&info, 0);
+
+ /* NOTE: cagney/2002-12-06: This can be deleted when this arch is
+ ready to unwind the PC first (see frame.c:get_prev_frame()). */
+ set_gdbarch_deprecated_init_frame_pc (gdbarch, deprecated_init_frame_pc_default);
/*
- * Basic register fields and methods, datatype sizes and stuff.
+ * Basic register fields and methods.
*/
set_gdbarch_num_regs (gdbarch, E_NUM_REGS);
set_gdbarch_num_pseudo_regs (gdbarch, 0);
set_gdbarch_sp_regnum (gdbarch, E_SP_REGNUM);
+ set_gdbarch_deprecated_fp_regnum (gdbarch, E_FP_REGNUM);
set_gdbarch_pc_regnum (gdbarch, E_PC_REGNUM);
set_gdbarch_register_name (gdbarch, xstormy16_register_name);
- set_gdbarch_register_type (gdbarch, xstormy16_register_type);
+ set_gdbarch_deprecated_register_size (gdbarch, xstormy16_reg_size);
+ set_gdbarch_deprecated_register_byte (gdbarch, xstormy16_register_byte);
+ set_gdbarch_deprecated_register_raw_size (gdbarch, xstormy16_register_raw_size);
+ set_gdbarch_deprecated_register_virtual_size (gdbarch, xstormy16_register_raw_size);
+ set_gdbarch_deprecated_register_virtual_type (gdbarch, xstormy16_reg_virtual_type);
- set_gdbarch_char_signed (gdbarch, 0);
- set_gdbarch_short_bit (gdbarch, 2 * TARGET_CHAR_BIT);
- set_gdbarch_int_bit (gdbarch, 2 * TARGET_CHAR_BIT);
- set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT);
- set_gdbarch_long_long_bit (gdbarch, 8 * TARGET_CHAR_BIT);
+ /*
+ * Frame Info
+ */
+ set_gdbarch_deprecated_init_extra_frame_info (gdbarch,
+ xstormy16_init_extra_frame_info);
+ set_gdbarch_deprecated_frame_init_saved_regs (gdbarch,
+ xstormy16_frame_init_saved_regs);
+ set_gdbarch_deprecated_frame_chain (gdbarch, xstormy16_frame_chain);
+ set_gdbarch_deprecated_get_saved_register (gdbarch, xstormy16_get_saved_register);
+ set_gdbarch_deprecated_saved_pc_after_call (gdbarch, xstormy16_saved_pc_after_call);
+ set_gdbarch_deprecated_frame_saved_pc (gdbarch, xstormy16_frame_saved_pc);
+ set_gdbarch_skip_prologue (gdbarch, xstormy16_skip_prologue);
+ set_gdbarch_deprecated_frame_chain_valid (gdbarch, xstormy16_frame_chain_valid);
- set_gdbarch_float_bit (gdbarch, 4 * TARGET_CHAR_BIT);
- set_gdbarch_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
- set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
+ set_gdbarch_in_function_epilogue_p (gdbarch,
+ xstormy16_in_function_epilogue_p);
+
+ /*
+ * Miscelany
+ */
+ /* Stack grows up. */
+ set_gdbarch_inner_than (gdbarch, core_addr_greaterthan);
+ /*
+ * Call Dummies
+ *
+ * These values and methods are used when gdb calls a target function. */
+ set_gdbarch_deprecated_push_return_address (gdbarch, xstormy16_push_return_address);
+ set_gdbarch_deprecated_extract_return_value (gdbarch, xstormy16_extract_return_value);
+ set_gdbarch_deprecated_push_arguments (gdbarch, xstormy16_push_arguments);
+ set_gdbarch_deprecated_pop_frame (gdbarch, xstormy16_pop_frame);
+ set_gdbarch_deprecated_store_struct_return (gdbarch, xstormy16_store_struct_return);
+ set_gdbarch_deprecated_store_return_value (gdbarch, xstormy16_store_return_value);
+ set_gdbarch_deprecated_extract_struct_value_address (gdbarch, xstormy16_extract_struct_value_address);
+ set_gdbarch_deprecated_use_struct_convention (gdbarch, xstormy16_use_struct_convention);
+ set_gdbarch_breakpoint_from_pc (gdbarch, xstormy16_breakpoint_from_pc);
+
+ set_gdbarch_char_signed (gdbarch, 0);
+ set_gdbarch_int_bit (gdbarch, 2 * TARGET_CHAR_BIT);
set_gdbarch_ptr_bit (gdbarch, 2 * TARGET_CHAR_BIT);
set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
+ set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
set_gdbarch_address_to_pointer (gdbarch, xstormy16_address_to_pointer);
set_gdbarch_pointer_to_address (gdbarch, xstormy16_pointer_to_address);
- set_gdbarch_write_pc (gdbarch, generic_target_write_pc);
-
- /* Stack grows up. */
- set_gdbarch_inner_than (gdbarch, core_addr_greaterthan);
-
- /*
- * Frame Info
- */
- set_gdbarch_unwind_sp (gdbarch, xstormy16_unwind_sp);
- set_gdbarch_unwind_pc (gdbarch, xstormy16_unwind_pc);
- set_gdbarch_unwind_dummy_id (gdbarch, xstormy16_unwind_dummy_id);
- set_gdbarch_frame_align (gdbarch, xstormy16_frame_align);
- frame_base_set_default (gdbarch, &xstormy16_frame_base);
-
- set_gdbarch_skip_prologue (gdbarch, xstormy16_skip_prologue);
- set_gdbarch_in_function_epilogue_p (gdbarch,
- xstormy16_in_function_epilogue_p);
+ set_gdbarch_deprecated_stack_align (gdbarch, xstormy16_stack_align);
- /* These values and methods are used when gdb calls a target function. */
- set_gdbarch_push_dummy_call (gdbarch, xstormy16_push_dummy_call);
- set_gdbarch_breakpoint_from_pc (gdbarch, xstormy16_breakpoint_from_pc);
- set_gdbarch_return_value (gdbarch, xstormy16_return_value);
+ set_gdbarch_deprecated_save_dummy_frame_tos (gdbarch, xstormy16_save_dummy_frame_tos);
set_gdbarch_skip_trampoline_code (gdbarch, xstormy16_skip_trampoline_code);
+
set_gdbarch_in_solib_call_trampoline (gdbarch,
xstormy16_in_solib_call_trampoline);
- set_gdbarch_print_insn (gdbarch, print_insn_xstormy16);
+ /* Should be using push_dummy_call. */
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp);
- gdbarch_init_osabi (info, gdbarch);
-
- frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
- frame_unwind_append_sniffer (gdbarch, xstormy16_frame_sniffer);
+ set_gdbarch_print_insn (gdbarch, print_insn_xstormy16);
return gdbarch;
}