From 00d5c772722ec736123d5957a59942627ebe3ec9 Mon Sep 17 00:00:00 2001 From: bde Date: Sun, 29 Jun 1997 18:12:14 +0000 Subject: Removed most unused files (about 8M total). --- contrib/gdb/gdb/ChangeLog-93 | 7597 ------------------------------- contrib/gdb/gdb/ChangeLog-94 | 5705 ----------------------- contrib/gdb/gdb/ChangeLog-95 | 4882 -------------------- contrib/gdb/gdb/acconfig.h | 9 - contrib/gdb/gdb/alpha-nat.c | 243 - contrib/gdb/gdb/alpha-tdep.c | 1274 ------ contrib/gdb/gdb/arm-convert.s | 16 - contrib/gdb/gdb/arm-tdep.c | 826 ---- contrib/gdb/gdb/arm-xdep.c | 276 -- contrib/gdb/gdb/coff-solib.c | 131 - contrib/gdb/gdb/coff-solib.h | 60 - contrib/gdb/gdb/config/nm-empty.h | 2 - contrib/gdb/gdb/config/nm-gnu.h | 46 - contrib/gdb/gdb/config/nm-lynx.h | 83 - contrib/gdb/gdb/config/nm-m3.h | 123 - contrib/gdb/gdb/config/nm-nbsd.h | 86 - contrib/gdb/gdb/config/nm-sysv4.h | 34 - contrib/gdb/gdb/config/tm-lynx.h | 34 - contrib/gdb/gdb/config/tm-nbsd.h | 19 - contrib/gdb/gdb/config/tm-sunos.h | 31 - contrib/gdb/gdb/config/tm-sysv4.h | 45 - contrib/gdb/gdb/config/xm-aix4.h | 96 - contrib/gdb/gdb/config/xm-lynx.h | 22 - contrib/gdb/gdb/config/xm-mpw.h | 81 - contrib/gdb/gdb/config/xm-nbsd.h | 37 - contrib/gdb/gdb/config/xm-sysv4.h | 36 - contrib/gdb/gdb/core-regset.c | 130 - contrib/gdb/gdb/core-sol2.c | 133 - contrib/gdb/gdb/cpu32bug-rom.c | 171 - contrib/gdb/gdb/cxux-nat.c | 523 --- contrib/gdb/gdb/gnu-nat.c | 2814 ------------ contrib/gdb/gdb/gnu-nat.h | 91 - contrib/gdb/gdb/go32-xdep.c | 35 - contrib/gdb/gdb/i386-stub.c | 915 ---- contrib/gdb/gdb/i386aix-nat.c | 360 -- contrib/gdb/gdb/i386gnu-nat.c | 348 -- contrib/gdb/gdb/i386ly-tdep.c | 42 - contrib/gdb/gdb/i386m3-nat.c | 421 -- contrib/gdb/gdb/i386mach-nat.c | 163 - contrib/gdb/gdb/i386v-nat.c | 371 -- contrib/gdb/gdb/i386v4-nat.c | 163 - contrib/gdb/gdb/irix4-nat.c | 192 - contrib/gdb/gdb/irix5-nat.c | 1067 ----- contrib/gdb/gdb/isi-xdep.c | 20 - contrib/gdb/gdb/kdb-start.c | 35 - contrib/gdb/gdb/lynx-nat.c | 838 ---- contrib/gdb/gdb/m3-nat.c | 4640 ------------------- contrib/gdb/gdb/m68k-stub.c | 1014 ----- contrib/gdb/gdb/m68k-tdep.c | 514 --- contrib/gdb/gdb/m68knbsd-nat.c | 86 - contrib/gdb/gdb/m88k-nat.c | 285 -- contrib/gdb/gdb/m88k-tdep.c | 616 --- contrib/gdb/gdb/minimon.h | 562 --- contrib/gdb/gdb/mon960-rom.c | 270 -- contrib/gdb/gdb/monitor.c | 1541 ------- contrib/gdb/gdb/monitor.h | 177 - contrib/gdb/gdb/mpw-config.in | 82 - contrib/gdb/gdb/mpw-make.sed | 167 - contrib/gdb/gdb/news-xdep.c | 65 - contrib/gdb/gdb/nindy-tdep.c | 73 - contrib/gdb/gdb/ns32k-tdep.c | 27 - contrib/gdb/gdb/ns32km3-nat.c | 181 - contrib/gdb/gdb/op50-rom.c | 146 - contrib/gdb/gdb/osfsolib.c | 955 ---- contrib/gdb/gdb/ppcbug-rom.c | 233 - contrib/gdb/gdb/procfs.c | 3815 ---------------- contrib/gdb/gdb/ptx4-nat.c | 209 - contrib/gdb/gdb/pyr-tdep.c | 452 -- contrib/gdb/gdb/pyr-xdep.c | 370 -- contrib/gdb/gdb/remote-adapt.c | 1359 ------ contrib/gdb/gdb/remote-array.c | 1465 ------ contrib/gdb/gdb/remote-bug.c | 1053 ----- contrib/gdb/gdb/remote-e7000.c | 2066 --------- contrib/gdb/gdb/remote-eb.c | 1009 ---- contrib/gdb/gdb/remote-es.c | 2152 --------- contrib/gdb/gdb/remote-est.c | 174 - contrib/gdb/gdb/remote-hms.c | 1463 ------ contrib/gdb/gdb/remote-mips.c | 2997 ------------ contrib/gdb/gdb/remote-mm.c | 1627 ------- contrib/gdb/gdb/remote-nindy.c | 820 ---- contrib/gdb/gdb/remote-nrom.c | 332 -- contrib/gdb/gdb/remote-os9k.c | 1230 ----- contrib/gdb/gdb/remote-pa.c | 1540 ------- contrib/gdb/gdb/remote-rdp.c | 1247 ----- contrib/gdb/gdb/remote-sim.c | 468 -- contrib/gdb/gdb/remote-st.c | 847 ---- contrib/gdb/gdb/remote-udi.c | 1689 ------- contrib/gdb/gdb/remote-vx.c | 1488 ------ contrib/gdb/gdb/remote-vx29k.c | 188 - contrib/gdb/gdb/remote-vx68.c | 158 - contrib/gdb/gdb/remote-vx960.c | 163 - contrib/gdb/gdb/remote-vxmips.c | 201 - contrib/gdb/gdb/remote-vxsparc.c | 196 - contrib/gdb/gdb/ser-e7kpc.c | 420 -- contrib/gdb/gdb/ser-go32.c | 957 ---- contrib/gdb/gdb/ser-mac.c | 361 -- contrib/gdb/gdb/somread.c | 470 -- contrib/gdb/gdb/somsolib.c | 820 ---- contrib/gdb/gdb/somsolib.h | 51 - contrib/gdb/gdb/srec.h | 35 - contrib/gdb/gdb/standalone.c | 593 --- contrib/gdb/gdb/stop-gdb.c | 110 - contrib/gdb/gdb/stuff.c | 174 - contrib/gdb/gdb/symm-nat.c | 846 ---- contrib/gdb/gdb/symm-tdep.c | 93 - contrib/gdb/gdb/umax-xdep.c | 133 - contrib/gdb/gdb/xcoffread.c | 2767 ----------- contrib/gdb/gdb/xcoffsolib.c | 211 - contrib/gdb/gdb/xmodem.c | 284 -- contrib/gdb/gdb/xmodem.h | 29 - contrib/gdb/readline/doc/ChangeLog | 12 - contrib/gdb/readline/doc/Makefile.in | 94 - contrib/gdb/readline/doc/configure.in | 8 - contrib/gdb/readline/doc/hist.texinfo | 106 - contrib/gdb/readline/doc/hstech.texinfo | 311 -- contrib/gdb/readline/doc/hsuser.texinfo | 153 - contrib/gdb/readline/doc/inc-hist.texi | 159 - contrib/gdb/readline/doc/rlman.texinfo | 103 - contrib/gdb/readline/doc/rltech.texinfo | 1012 ---- contrib/gdb/readline/doc/rluser.texinfo | 566 --- 120 files changed, 83916 deletions(-) delete mode 100644 contrib/gdb/gdb/ChangeLog-93 delete mode 100644 contrib/gdb/gdb/ChangeLog-94 delete mode 100644 contrib/gdb/gdb/ChangeLog-95 delete mode 100644 contrib/gdb/gdb/acconfig.h delete mode 100644 contrib/gdb/gdb/alpha-nat.c delete mode 100644 contrib/gdb/gdb/alpha-tdep.c delete mode 100644 contrib/gdb/gdb/arm-convert.s delete mode 100644 contrib/gdb/gdb/arm-tdep.c delete mode 100644 contrib/gdb/gdb/arm-xdep.c delete mode 100644 contrib/gdb/gdb/coff-solib.c delete mode 100644 contrib/gdb/gdb/coff-solib.h delete mode 100644 contrib/gdb/gdb/config/nm-empty.h delete mode 100644 contrib/gdb/gdb/config/nm-gnu.h delete mode 100644 contrib/gdb/gdb/config/nm-lynx.h delete mode 100644 contrib/gdb/gdb/config/nm-m3.h delete mode 100644 contrib/gdb/gdb/config/nm-nbsd.h delete mode 100644 contrib/gdb/gdb/config/nm-sysv4.h delete mode 100644 contrib/gdb/gdb/config/tm-lynx.h delete mode 100644 contrib/gdb/gdb/config/tm-nbsd.h delete mode 100644 contrib/gdb/gdb/config/tm-sunos.h delete mode 100644 contrib/gdb/gdb/config/tm-sysv4.h delete mode 100644 contrib/gdb/gdb/config/xm-aix4.h delete mode 100644 contrib/gdb/gdb/config/xm-lynx.h delete mode 100644 contrib/gdb/gdb/config/xm-mpw.h delete mode 100644 contrib/gdb/gdb/config/xm-nbsd.h delete mode 100644 contrib/gdb/gdb/config/xm-sysv4.h delete mode 100644 contrib/gdb/gdb/core-regset.c delete mode 100644 contrib/gdb/gdb/core-sol2.c delete mode 100644 contrib/gdb/gdb/cpu32bug-rom.c delete mode 100644 contrib/gdb/gdb/cxux-nat.c delete mode 100644 contrib/gdb/gdb/gnu-nat.c delete mode 100644 contrib/gdb/gdb/gnu-nat.h delete mode 100644 contrib/gdb/gdb/go32-xdep.c delete mode 100644 contrib/gdb/gdb/i386-stub.c delete mode 100644 contrib/gdb/gdb/i386aix-nat.c delete mode 100644 contrib/gdb/gdb/i386gnu-nat.c delete mode 100644 contrib/gdb/gdb/i386ly-tdep.c delete mode 100644 contrib/gdb/gdb/i386m3-nat.c delete mode 100644 contrib/gdb/gdb/i386mach-nat.c delete mode 100644 contrib/gdb/gdb/i386v-nat.c delete mode 100644 contrib/gdb/gdb/i386v4-nat.c delete mode 100644 contrib/gdb/gdb/irix4-nat.c delete mode 100644 contrib/gdb/gdb/irix5-nat.c delete mode 100644 contrib/gdb/gdb/isi-xdep.c delete mode 100644 contrib/gdb/gdb/kdb-start.c delete mode 100644 contrib/gdb/gdb/lynx-nat.c delete mode 100644 contrib/gdb/gdb/m3-nat.c delete mode 100644 contrib/gdb/gdb/m68k-stub.c delete mode 100644 contrib/gdb/gdb/m68k-tdep.c delete mode 100644 contrib/gdb/gdb/m68knbsd-nat.c delete mode 100644 contrib/gdb/gdb/m88k-nat.c delete mode 100644 contrib/gdb/gdb/m88k-tdep.c delete mode 100644 contrib/gdb/gdb/minimon.h delete mode 100644 contrib/gdb/gdb/mon960-rom.c delete mode 100644 contrib/gdb/gdb/monitor.c delete mode 100644 contrib/gdb/gdb/monitor.h delete mode 100644 contrib/gdb/gdb/mpw-config.in delete mode 100644 contrib/gdb/gdb/mpw-make.sed delete mode 100644 contrib/gdb/gdb/news-xdep.c delete mode 100644 contrib/gdb/gdb/nindy-tdep.c delete mode 100644 contrib/gdb/gdb/ns32k-tdep.c delete mode 100644 contrib/gdb/gdb/ns32km3-nat.c delete mode 100644 contrib/gdb/gdb/op50-rom.c delete mode 100644 contrib/gdb/gdb/osfsolib.c delete mode 100644 contrib/gdb/gdb/ppcbug-rom.c delete mode 100644 contrib/gdb/gdb/procfs.c delete mode 100644 contrib/gdb/gdb/ptx4-nat.c delete mode 100644 contrib/gdb/gdb/pyr-tdep.c delete mode 100644 contrib/gdb/gdb/pyr-xdep.c delete mode 100644 contrib/gdb/gdb/remote-adapt.c delete mode 100644 contrib/gdb/gdb/remote-array.c delete mode 100644 contrib/gdb/gdb/remote-bug.c delete mode 100644 contrib/gdb/gdb/remote-e7000.c delete mode 100644 contrib/gdb/gdb/remote-eb.c delete mode 100644 contrib/gdb/gdb/remote-es.c delete mode 100644 contrib/gdb/gdb/remote-est.c delete mode 100644 contrib/gdb/gdb/remote-hms.c delete mode 100644 contrib/gdb/gdb/remote-mips.c delete mode 100644 contrib/gdb/gdb/remote-mm.c delete mode 100644 contrib/gdb/gdb/remote-nindy.c delete mode 100644 contrib/gdb/gdb/remote-nrom.c delete mode 100644 contrib/gdb/gdb/remote-os9k.c delete mode 100644 contrib/gdb/gdb/remote-pa.c delete mode 100644 contrib/gdb/gdb/remote-rdp.c delete mode 100644 contrib/gdb/gdb/remote-sim.c delete mode 100644 contrib/gdb/gdb/remote-st.c delete mode 100644 contrib/gdb/gdb/remote-udi.c delete mode 100644 contrib/gdb/gdb/remote-vx.c delete mode 100644 contrib/gdb/gdb/remote-vx29k.c delete mode 100644 contrib/gdb/gdb/remote-vx68.c delete mode 100644 contrib/gdb/gdb/remote-vx960.c delete mode 100644 contrib/gdb/gdb/remote-vxmips.c delete mode 100644 contrib/gdb/gdb/remote-vxsparc.c delete mode 100644 contrib/gdb/gdb/ser-e7kpc.c delete mode 100644 contrib/gdb/gdb/ser-go32.c delete mode 100644 contrib/gdb/gdb/ser-mac.c delete mode 100644 contrib/gdb/gdb/somread.c delete mode 100644 contrib/gdb/gdb/somsolib.c delete mode 100644 contrib/gdb/gdb/somsolib.h delete mode 100644 contrib/gdb/gdb/srec.h delete mode 100644 contrib/gdb/gdb/standalone.c delete mode 100644 contrib/gdb/gdb/stop-gdb.c delete mode 100644 contrib/gdb/gdb/stuff.c delete mode 100644 contrib/gdb/gdb/symm-nat.c delete mode 100644 contrib/gdb/gdb/symm-tdep.c delete mode 100644 contrib/gdb/gdb/umax-xdep.c delete mode 100644 contrib/gdb/gdb/xcoffread.c delete mode 100644 contrib/gdb/gdb/xcoffsolib.c delete mode 100644 contrib/gdb/gdb/xmodem.c delete mode 100644 contrib/gdb/gdb/xmodem.h delete mode 100644 contrib/gdb/readline/doc/ChangeLog delete mode 100644 contrib/gdb/readline/doc/Makefile.in delete mode 100644 contrib/gdb/readline/doc/configure.in delete mode 100644 contrib/gdb/readline/doc/hist.texinfo delete mode 100644 contrib/gdb/readline/doc/hstech.texinfo delete mode 100644 contrib/gdb/readline/doc/hsuser.texinfo delete mode 100644 contrib/gdb/readline/doc/inc-hist.texi delete mode 100644 contrib/gdb/readline/doc/rlman.texinfo delete mode 100644 contrib/gdb/readline/doc/rltech.texinfo delete mode 100644 contrib/gdb/readline/doc/rluser.texinfo (limited to 'contrib/gdb') diff --git a/contrib/gdb/gdb/ChangeLog-93 b/contrib/gdb/gdb/ChangeLog-93 deleted file mode 100644 index 463154d..0000000 --- a/contrib/gdb/gdb/ChangeLog-93 +++ /dev/null @@ -1,7597 +0,0 @@ -Fri Dec 31 14:33:49 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * nindy-share/nindy.c: Fix order of arguments to store_unsigned_integer - (second and third arguments were reversed). - (say): Use varargs. - -Fri Dec 31 12:13:47 1993 Jim Kingdon (kingdon@deneb.cygnus.com) - - * remote-mips.c: Add timeout parameter to mips_request and - mips_receive_packet. - (callers): pass in mips_receive_wait except mips_initialize (where - we use it to clean up the kludge where we had been changing - mips_receive_wait temporarily) and mips_wait (where we pass in - -1 for no timeout). - -Fri Dec 31 14:33:49 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * stack.c (print_block_frame_locals): Also print LOC_BASEREG variables. - -Fri Dec 31 06:55:38 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * symtab.c (find_methods): Call fprintf_symbol_filtered with DMGL_ANSI. - -Thu Dec 30 10:16:54 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * values.c (unpack_long): Fix garbled error message. - - * remote-mips.c (mips_error): New function. - * remote-mips.c: Use it instead of error() most places. - * remote-mips.c (mips_receive_packet): New arg throw_error. - (mips_initialize): Use it not catch_errors. - * defs.h: Declare error_pre_print and warning_pre_print here... - * main.c: ...not here. - - * breakpoint.c (breakpoint_chain): Make static. - * breakpoint.c, breakpoint.h (frame_in_dummy): New function. - * stack.c (print_frame_info): Use it. - -Thu Dec 30 07:41:36 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * exec.c (add_to_section_table): Check for SEC_ALLOC instead of - SEC_LOAD to handle .bss segments properly. - -Thu Dec 30 10:16:54 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * infrun.c (wait_for_inferior): Enable code which assumes that if - we jump into the prologue from another function, then it was a - subroutine call. #if 0 AT_FUNCTION_START; the above code should - take care of this case. - -Wed Dec 29 12:32:08 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * valprint.c (val_print_string): Change chunksize from 200 - to 8. - - * symfile.c (generic_load): If no arguments, get file name - from get_exec_file. - - * c-exp.y: Revert Kung's change. "..." is not a type, and the - change caused "p (...)0" to dump core. - * gdbtypes.c (check_stub_method): Don't pass "..." to - parse_and_eval_type. This should fix the bug which Kung was - trying to fix. - - * stabsread.c (define_symbol): If we choose not to combine - two symbols, don't just ignore the second (LOC_REGISTER) one. - * printcmd.c (print_frame_args): If we have a LOC_ARG and a - LOC_REGISTER, use the LOC_ARG not the LOC_REGISTER. - -Tue Dec 28 15:08:00 1993 Fred Fish (fnf@deneb.cygnus.com) - - * solib.c (DEBUG_BASE): Remove macro and all references. - * solib.c (debug_base_symbols): Add array of symbols to lookup. - * solib.c (IGNORE_FIRST_LINK_MAP_ENTRY): Add macro. - * solib.c (look_for_base, locate_base): Use debug_base_symbols. - * solib.c (find_solib): Use IGNORE_FIRST_LINK_MAP_ENTRY. - -Tue Dec 28 12:06:57 1993 Kung Hsu (kung@cirdan.cygnus.com) - - * c-exp.y : fix grammar to parse ellipsis (...) - -Mon Dec 27 18:42:14 1993 Kung Hsu (kung@cirdan.cygnus.com) - - * stabsread.c (read_type): fix problem when reading static member - of a class. caused by change to allow :: inside template - instantiated name. - -Mon Dec 27 11:07:05 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * gdbtypes.h: Expand on comments for TYPE_CODE_BITSTRING and - TYPE_CODE_STRING a bit. - - * m68k-tdep.c (m68k_skip_prologue, m68k_find_saved_regs): - Allow pea %fp; move.l %sp, %fp instead of link instruction to - set up the new frame. - - * main.c (init_main): Change "set remotedebug" back to var_zinteger - from var_boolean. - - * c-exp.y (yylex): Don't try to deal with nested types. - - * cp-valprint.c (cplus_print_value): Call check_stub_type on - TYPE_BASECLASS (type, i) before we look at its name. - - * dbxread.c: Move default definition of GCC_COMPILED_FLAG_SYMBOL - from here . . . - * symtab.h: . . . to here. - * dbxread.c (record_minimal_symbol): Move check for gcc{,2}_compiled. - and __gnu_compiled* from here . . . - * minsyms.c (prim_record_minimal_symbol_and_info): . . . to here. - * minsyms.c (prim_record_minimal_symbol): Call - prim_record_minimal_symbol_and_info rather than duplicating code. - * minsyms.c, symtab.h (prim_record_minimal_symbol{,_and_info}), - coffread.c (record_minimal_symbol), - xcoffread.c (RECORD_MINIMAL_SYMBOL), callers: Add objfile parameter. - -Sun Dec 26 20:44:02 1993 Jeffrey A. Law (law@snake.cs.utah.edu) - - * dbxread.c (process_one_symbol): Handle stabs-in-som just like - stabs-in-elf. - (pastab_build_psymtabs): Likewise. - - * hppa-tdep.c: Change all comments to reference %r3 or frame - pointer rather than %r4. - (frame_chain, skip_prologue, dig_rp_from_stack): Handle %r3 as the - frame pointer. - - * config/pa/tm-hppa.h (FP_REGNUM): Define as %r3. - (FIND_FRAME_SAVED_REGS): Handle %r3 as frame pointer. - (CALL_DUMMY): Likewise. - -Sun Dec 26 16:59:39 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * exec.c (exec_file_command): If error occurs after we have opened - exec_bfd but before we call push_target, make sure to close exec_bfd. - - * infrun.c (wait_for_inferior): Remove confusing and inaccurate - stuff about subroutine calls, return, etc., from comment which - says "We've wandered out of the step range.". - -Sun Dec 26 09:18:10 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * infrun.c (wait_for_inferior): When checking whether the line has - changed, check the symtab as well. - -Sun Dec 26 09:18:10 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * gdbtypes.c (force_to_range_type): Use switch statement. - complain() not warning() if the TYPE_CODE isn't one we know how to - deal with gracefully. Use builtin_type_int not - lookup_fundamental_type (the objfile we passed to - lookup_fundamental_type was sometimes NULL). - - * valops.c (call_function_by_hand, push_word), defs.h (push_word), - convex-xdep.c, m88k-nat.c, i386m3-nat.c, mips-tdep.c, mipsm3-nat.c, - ns32km3-nat.c, remote-bug.c, m88k-tdep.c, remote-hms.c, remote-mips.c, - config/gould/tm-np1.h, hppa-tdep.c (hppa_fix_call_dummy), remote-vx.c: - Use REGISTER_SIZE, unsigned LONGEST, and - {store,extract}_unsigned_integer, instead of sizeof - (REGISTER_TYPE) and REGISTER_TYPE. - * All tm.h files: Change REGISTER_TYPE to REGISTER_SIZE. - * hppa-tdep.c (pa_print_fp_reg): Remove unused variable val. - - * Makefile.in (ALLDEPFILES): Remove i386ly-nat.c and m68kly-nat.c. - Add lynx-nat.c. - -Sat Dec 25 20:05:41 1993 Jeffrey A. Law (law@snake.cs.utah.edu) - - * hppa-tdep.c (init_extra_frame_info): Correctly adjust the base - of the current frame when "fromleaf" is true. Do not adjust the - frame base of the innermost frame if it is a leaf function. - -Sat Dec 25 13:39:21 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * stabsread.c (define_symbol): Only combine a p/r pair into a - LOC_REGPARM if REG_STRUCT_HAS_ADDR. - -Sat Dec 25 09:50:29 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * valops.c (value_struct_elt): Check for (value)-1 return from - search_struct_method. - -Sat Dec 25 09:50:29 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * defs.h: Move definitions of TARGET_*_BIT after include of tm.h. - The old way (using #undef in tm.h) was ugly and asking for - trouble, because it makes it possible for some file to use the - wrong definition. Move definition of HOST_CHAR_BIT after definition - of TARGET_CHAR_BIT. - * config/alpha/tm-alpha.h, config/h8300/tm-h8300.h, - config/h8500/tm-h8500.h, config/z8k/tm-z8k.h: Don't undef TARGET_*_BIT - before defining them. - - * mdebugread.c: Change the builtin_type_* in this file to - mdebug_type_* and make them static. Use TYPE_CODE_ERROR for - complex and float decimal. - - * printcmd.c (disassemble_command): Call wrap_here between printing - address and printing instruction. - -Fri Dec 24 14:23:57 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * stabsread.c (read_type): Don't fall through 'S' case (the case it - was falling though happened to do the right thing ("break;") but that - is hardly a good thing to assume). - -Tue Dec 21 13:32:02 1993 Per Bothner (bothner@kalessin.cygnus.com) - - * ch-exp.y (match_dollar_tokens): Fix off-by-one bug. - * ch-lang.c (chill_is_varying_struct), ch-lang.h: New function. - * ch-lang.c (chill_printstr): Use double quotes, not single quotes. - * ch-typeprint.c (chill_type_print_base): Handle TYPE_CODE_BITSTRING. - Improve printing of TYPE_CODE_STRING, TYPE_CODE_SET, and - TYPE_CODE_STRUCT (including checking chill_is_varying_struct). - Print TYPE_DUMMY_RANGE by printing its TYPE_TARGET_TYPE. - Handle TYPE_CODE_ENUM. - * ch-valprint.c (chill_val_print): Handle TYPE_CODE_BITSTRING. - For TYPE_CODE_STRING, never print address. Handle VARYING strings. - * gdbtypes.c (force_to_range_type): New. - * gdbtypes.c (create_set_type): Make work, following Chill layout. - * gdbtypes.h (TYPE_LOW_BOUND, TYPE_HIGH_BOUND, TYPE_DUMMY_RANGE): New. - * stabsread.c (read_type): Distinguish string and bitstring from - char-array and set. - * valarith.c (value_subscript), valops.c (value_coerce_array): - Handle STRINGs as well as ARRAYs. - * valarith.c (value_bit_index): Fix think. Use new macros. - - -Fri Dec 17 10:45:32 1993 Kung Hsu (kung@cirdan.cygnus.com) - - * symtab (decode_line_1): fix a bug when position char is not - set correctly. - * c-valprint (c_val_print): handle vtbl printing when vtbl is not - set up yet. - -Thu Dec 16 16:46:01 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * mips-tdep.c (read_next_frame_reg): If SIGFRAME_REG_SIZE is not - defined, define it as 4. - -Thu Dec 16 13:08:01 1993 Jeffrey A. Law (law@snake.cs.utah.edu) - - * config/m68k/nm-hp300bsd.h: Correctly identify 4.3BSD vs 4.4BSD. - - * config/m68k/tm-hp300bsd.h (REMOTE_BPT_VECTOR): Define. - - * config/m68k/tm-m68k.h (REMOTE_BPT_VECTOR): Allow targets to - override. - (REMOTE_BREAKPOINT): Likewise. - -Thu Dec 16 09:14:58 1993 Jeff Law (law@snake.cs.utah.edu) - - * hpread.c (read_hp_function_type): Correctly handle - pass-by-value structures > 64bits in size. - (process_one_debug_symbol): Likewise. - -Mon Dec 13 20:17:39 1993 Per Bothner (bothner@kalessin.cygnus.com) - - Implement support for Chill POWERSETs. - * ch-exp.y (operand_2): Implement 'Element IN PowerSet'. - * ch-typeprint.c (chill_type_print_base): Handle POWERSETs. - * ch-valprint.c (chill_val_print): Handle TYPE_CODE_SET. - * eval.c (evaluate_subexp): Implement BINOP_IN. - * expression.h (enum exp_opcode): Added BINOP_IN. - * gdbtypes.c (create_set_type), gdbtypes.h: New function. - * stabsread.c (read_type): If 'S', create a set type. - * valarith.c (value_bit_index, value_in), value.h: New functions, - for indexing in SETs. - -Mon Dec 13 06:42:37 1993 Jeffrey A. Law (law@snake.cs.utah.edu) - - * paread.c (pa_symfile_init): Check for the existance of stabs - after DBX_TEXT_SECT has been initialized. - -Tue Nov 23 17:29:28 1993 Steve Chamberlain (sac@jonny.cygnus.com) - - * config/h8300/tm-h8300.h (BREAKPOINT): Insn changed to sleep. - (DECP_PC_AFTER_BREAK): Now is 0. - * config/h8500/tm-h8500.h (REGISTER_BYTES, REGISTER_BYTE, - REGISTER_NAMES): update to new view. (INIT_EXTRA_FRAME_INFO): No - extra frame info now. - * config/sh/sh.h (NOP): Define NOP insn. - * config/z8k/tm-z8k.h (BIG): is now sim_z8001_mode. - * config/z8k/z8ksim.mt (TDEPFILES): Add remote-sim.o to list. - * ser-go32.c: Lint. (strncasecmp): Removed, now in libiberty. - (go32_readchar): Special handling for faster polling. (async - structure): Volatile. - * h8300-tdep.c (print_register_hook): Allocate and use the right - number bytes for the raw register. - * h8500-tdep.c (regoff, frame_find_saved_reg, examine_prologue): - deleted. (h8500_register_size, h8500_register_virtual_type, ): - Use new way of counting registers. - * remote-e7000.c (echo_index): deleted. (expect): Better handling - of user interrupts. (expect_prompt): Remove never used log file - support. (want, want_nopc): Add support for H8/300H. - (fetch_regs_from_dump): Treat \r and \n as whitespace. - (e7000_drain): Send an "end" command before waiting for output to - stop. (e7000_wait): Cope with H8/300H, better handling of user - interrupts. (why_stop, expect_n, sub2_from_pc): New function. - * remote-utils.c (gr_load_image): call fflush and QUIT more regularly. - * utils.c (notice_quit): New function for polling for user interrupts. - -Fri Dec 10 15:53:56 1993 Per Bothner (bothner@kalessin.cygnus.com) - - * stabsread.c (read_array_type): Allow negative array bounds, - without interpreting that to mean "adjustable." - * ch-valprint.c (chill_val_print): Handle RANGE types. - * ch-typeprint.c (chill_type_print_base): Handle BOOL. - Handle variant records. Handle RANGE types. - -Tue Dec 7 15:41:32 1993 Ian Lance Taylor (ian@cygnus.com) - - * config/mips/idt.mt: Use tm-idt.h instead of tm-bigmips.h. - * config/mips/idtl.mt: Use tm-idtl.h instead of tm-mips.h. - * config/mips/tm-idt.h, config/mips/tm-idtl.h: New files; use - different BREAKPOINT value for IDT. - - * mipsread.c: Include bfd.h and coff/sym.h. - -Mon Dec 6 16:34:10 1993 K. Richard Pixley (rich@cygnus.com) - - * ser-unix.c (set_tty_state): set the rest of the terminal state - pieces. - -Mon Dec 6 12:01:37 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * configure.in: Recognize mips* for all mips targets. - (mips*el-*-elf*, mips*-*-elf*): New targets; use idt and idtl. - - Added Irix 5 support. - * configure.in (mips-sgi-irix5*): New host and target. Use irix5 - for both. - * config/mips/irix5.mh, config/mips/irix5.mt, - config/mips/xm-irix5.h, config/mips/nm-irix5.h, - config/mips/tm-irix5.h, irix5-nat.c: New files for Irix 5 support. - * mdebugread.c: New file, split out of mipsread.c. Added - elfmdebug_build_psymtabs routine. Added some checks on external - symbols. Changed code to keep ecoff_debug_info and - ecoff_debug_swap structs in the psymtab and in global pointers - rather than retrieving them from the bfd. Also changed to keep - the pending list with the psymtab rather than the objfile (each - psymtab for a single objfile points to the same pending list). - * mipsread.c: Bulk of file moved into mdebugread.c, leaving just - the sym_fns. - * Makefile.in (SFILES): Added mdebugread.c. - (OBS): Added mdebugread.o. - (mdebugread.o): New target. - * symfile.h: Declare mdebug_build_psymtabs and - elfmdebug_build_psymtabs. - * elfread.c (struct elfinfo): Added mdebugsect field. - (elf_locate_sections): Remember location of .mdebug section. - (elf_symfile_read): Call elfmdebug_build_psymtabs on .mdebug - section. - * infrun.c (AT_FUNCTION_START): Set to 0 if not already defined. - (wait_for_inferior): Use AT_FUNCTION_START if it is defined to see - if PC is at the start of a function. - * mips-tdep.c (read_next_frame_reg): Use SIGFRAME_REG_SIZE, and - give it a default definition. - (mips_skip_prologue): Skip instructions which initialize $gp - register. - (in_sigtramp): New procedure, moved in from mipsread.c. - * config/mips/tm-mips.h: Declare in_sigtramp. - - * serial.h (serial_fdopen): Make parameter const to match - function definition. - -Fri Dec 3 14:20:43 1993 Stu Grossman (grossman at cygnus.com) - - * config/mips/irix4.mh: Enable ser-tcp.o. - -Tue Nov 30 15:24:24 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * Makefile.in (check): Do not use subdir_do, so that - TARGET_FLAGS_TO_PASS is used correctly. - -Mon Nov 29 16:10:38 1993 Stu Grossman (grossman at cygnus.com) - - * i386-nlmstub.c: Undo I/O redirection changes by Tom Lord. - These definitely won't work under Netware. - -Mon Nov 29 15:34:58 1993 Kung Hsu (kung@cirdan.cygnus.com) - - * stabsread.c(read_struct_field): Fix the check when getting to - member functions. - -Mon Nov 29 16:48:16 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - gcc -Wall -O lint: - * mips-tdep.c (heuristic_proc_desc): Initialize reg30 to avoid - warning. Unnest comment. - (init_extra_frame_info): Remove unused variable mask. - (MASK): Fully parenthesize. - (mips_push_dummy_frame): Remove unused variable val. - (mips_skip_prologue): Remove unused variables f and b. - -Mon Nov 29 12:23:25 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * mipsread.c (parse_symbol, parse_partial_symbols): Do not create - (partial) symbols for opaque struct definitions. - -Mon Nov 29 11:36:57 1993 Stu Grossman (grossman at cygnus.com) - - * i386ly-tdep.c (i386lynx_saved_pc_after_call): Change call_inst - to unsigned char to avoid domain warning for some values. - -Mon Nov 22 23:42:59 1993 Steve Chamberlain (sac@jonny.cygnus.com) - - * remote-e7000.c (e7000_wait): Cope with H8/300 register dump. - * config/h8300/h8300hms.mt: Add remote-e7000. - -Mon Nov 22 11:03:45 1993 Fred Fish (fnf@cygnus.com) - - Merged changes from kev@spuds.geg.mot.com (Kevin A. Buettner): - * gdb/config/m88k/delta88.mh (NATDEPFILES): Added corelow.o and - coredep.o to this list. - * gdb/m88k-nat.c (m88k_register_u_addr): Avoid error when passed - the number for an M88110 extended register by just returning the - address of r0. - -Sat Nov 20 09:20:51 1993 Fred Fish (fnf@rtl.cygnus.com) - - * go32-xdep.c (re_comp, re_exec): Remove stubs now that gdb - always uses it's own version of regex. - -Fri Nov 19 18:23:19 1993 Kung Hsu (kung@cirdan.cygnus.com) - - * valops.c(value_struct_elt_for_reference): enhance search operator in - c++. - * symtab.c(decode_line_1): same as above. - -Fri Nov 19 15:08:47 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * symtab.c (decode_line_1): Add comment about use of - return_to_top_level directly instead of error. Add comment saying - that the '' should not be needed--that the completer should be fixed. - -Fri Nov 19 11:00:33 1993 Kung Hsu (kung@cirdan.cygnus.com) - - * symtab.c(decode_line_1): fix the inconsistency of setting - breakpoint with '' or without them. The '' is needed when you - want name completion. - -Thu Nov 18 08:25:50 1993 Fred Fish (fnf@cygnus.com) - - * valprint.c (val_print_string): When looking for a null - terminator compare current bufsize to fetchlimit to determine - when to stop, instead of computing buffer+fetchlimit which - may overflow for very large limits (like "unlimited"). - -Wed Nov 17 18:23:09 1993 Kung Hsu (kung@cirdan.cygnus.com) - - * eval.c(evaluate_subexp): to use unified search so type conversion - operator works in calling method. - * valarith.c(value_x_binop, value_x_unop): same as above. - * valops.c(search_struct_method): same as above. - -Wed Nov 17 18:47:34 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * mipsread.c: Change use of ECOFF information to correspond to - changes in bfd/libecoff.h. - (mipscoff_symfile_offsets): Made static. - -Wed Nov 17 09:43:31 1993 Kung Hsu (kung@cirdan.cygnus.com) - - * valops.c (typecmp): improve prototype matching when calling - a method. Make 'p (*(ostream *) &cout) << "lll" ' to work. - * eval.c(evalute_subexp): fix operator search problem when call - like p x.'operator+'(i). - -Tue Nov 16 17:15:03 1993 Stu Grossman (grossman at cygnus.com) - - * i386ly-nat.c, i386lynx-nat.c, m68kly-nat.c: Remove. Move - common code into lynx-nat.c. - * lynx-nat.c: New module. Contains portable code for Lynx native - stuff (mostly ptrace related). - * config/i386/i386lynx.mh (NATDEPFILES): i386ly-nat.o -> lynx-nat.o - * config/m68k/m68klynx.mh (NATDEPFILES): i386ly-nat.o -> lynx-nat.o - - * config/nm-lynx.h, config/tm-lynx.h: New files to contain - non-architecture specific native and target defs. - * config/i386/nm-i386lynx.h, config/i386/tm-i386lynx.h, - config/m68k/nm-m68klynx.h, config/m68k/tm-m68klynx.h: Move all - (arch) portable stuff into ../{tm nm}-lynx.h. - -Tue Nov 16 13:33:47 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * symtab.c (gdb_mangle_name): Only assume that the physname is - the entire mangled name if it looks like the mangled name of a - constructor. Needed for testsuite to work with GCC 2.4.5. - - * a68v-nat.c: Replace with new version from Troy Rollo. The - version I am replacing appears to be an old copy of sun3-nat.c. - * dstread.c (dst_symfile_read): Replace sort_all_symtab_syms call - with loop. - - * Makefile.in (TAGS): Depend on TAGFILES_{NO,WITH}_SRCDIR. - - * Makefile.in: (HFILES,TAGFILES): Split into _WITH_SRCDIR and - _NO_SRCDIR versions. - (TAGS): Only add srcdir to TAGFILES_NO_SRCDIR. - (This is part of a long saga involving me putting srcdir on - everything (perhaps for now-obsolete reasons, I forget), Rich - removing the srcdir from everything, Stu putting it back some - places for Sun make, and me just now getting around to fixing - `make TAGS' again). - -Mon Nov 15 12:29:10 1993 Kung Hsu (kung@cirdan.cygnus.com) - - * stack.c(print_frame_info): print demangled function name - ansi style. - -Mon Nov 15 14:32:29 1993 Steve Chamberlain (sac@jonny.cygnus.com) - - * remote-e7000.c: New file to cope with the Hitachi E7000 ICE. - * remote-utils.c, remote-utils.h (gr_load_image): New function to - download to target. - * h8300-tdep.c, h8500-tdep.c, remote-z8k.c, sh-tdep.c z8k-tdep.c - (sim_load): delete. - * remote-sim.c (gdbsim_load): Use gr_load_image, rather than - sim_load. - * config/sh/sh.mt: Add remote-e7000 - -Mon Nov 15 11:38:25 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config/i386/linux.mh: Remove XM_CLIBS, TERMLIB, SYSV_DEFINE, and - REGEX. - * config/i386/xm-linux.h: Don't include xm-i386v.h. Define - HOST_BYTE_ORDER ourselves. Define HAVE_TERMIOS not HAVE_TERMIO. - Define NEED_POSIX_SETPGID. Include unistd.h. - -Mon Nov 15 12:29:10 1993 Kung Hsu (kung@cirdan.cygnus.com) - - * symtab.c(gdb_mangle_name): fix the problem with constructor - name mangling. - -Mon Nov 15 11:38:25 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * gdbtypes.h: Add TYPE_FLAG_TARGET_STUB. - * gdbtypes.c (check_stub_type): On TYPE_FLAG_TARGET_STUB, do - what cleanup_undefined_types does for arrays, except we clear - TYPE_FLAG_TARGET_STUB if we fix up the type. - * stabsread.c (cleanup_undefined_types): Add comments about how - doing arrays here is no longer the clean way to do it. - (read_array_type): Set TYPE_FLAG_TARGET_STUB as well as calling - add_undefined_type. - * c-typeprint.c, ch-typeprint.c: Move call to check_stub_type - outside switch so it happens for all type codes. - * cp-valprint.c (cp_print_value_fields): Recurse to val_print, - instead of c_val_print, so that check_stub_type gets called. - - * gdbtypes.h, gdbtypes.c, m2-lang.c, ch-lang.c, c-lang.c: Remove - TYPE_FLAG_SIGNED. It was inconsistently set, never checked - (except in recursive_dump_type), and is pointless. - -Mon Nov 15 00:40:38 1993 Jeffrey A. Law (law@snake.cs.utah.edu) - - * paread.c (pa_symfile_init): Look for the $TEXT$ section rather - than the .text section. - -Sun Nov 14 00:28:13 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * stabsread.c: Remove #if 0'd dbx_class_complaint. We now handle - this (more or less) gracefully, and complain() was never a good - way of dealing with this. - - * stabsread.c (read_type): Skip the colon when reading a - cross-reference. Only complain, not error_type, on unrecognized - cross-reference types. error_type, not dump core, if the colon is - missing. - -Fri Nov 12 16:23:08 1993 Stu Grossman (grossman at cygnus.com) - - * config/m68k/tm-sun3.h: Disable use of alternate breakpoint insn - when doing remote stuff. - -Fri Nov 12 16:22:39 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * c-exp.y (yylex): Call lookup_symtab not lookup_partial_symtab. - - * partial-stab.h: Ignore ':' symbol descriptors. Same case as - Kung's stabsread.c change. - -Fri Nov 12 11:18:02 1993 Kung Hsu (kung@cirdan.cygnus.com) - - * stabsread.c (patch_block_stabs, define_symbol, read_type): in - g++ template instantiation, nested class can be part of the - params, and '::' can gets into symbol or type names. This is - to fix the problem. - - * gdbtypes.c (lookup_struct_elt_type): Handle type ref or pointer - to struct/union case. - -Fri Nov 12 10:39:31 1993 Stu Grossman (grossman at cygnus.com) - - * coff-solib.c (coff_solib_add): Cast result of alloca(). - * m68k-tdep.c (m68k_saved_pc_after_call): Get rid of - GDB_TARGET_IS_SUN3. Use more general SYSCALL_TRAP macro. - * config/m68k/m68klynx.mh (NATDEPFILES): Remove exec.o (it's - already in TDEPFILES). - * config/m68k/tm-m68k.h (SAVED_PC_AFTER_CALL): Use - m68k_saved_pc_after_call. - * Remove all Sun3 specific stuff. - * (FIX_CALL_DUMMY): Cast arg to bfd_putb32 to unsigned char *. - * config/m68k/tm-m68klynx.h: Define SYSCALL_TRAP as trap #10. - Disable REMOTE_BREAKPOINT mechanism. - * config/m68k/tm-sun3.h: Get rid of GDB_TARGET_IS_SUN3. - * Protect from multiple includion. - * Move Sun3 specific stuff from tm-m68k.h to here. - * Define SYSCALL_TRAP as trap #0. - * Remove def of SAVED_PC_AFTER_CALL (now in tm-m68k.h). - * gdbserver/low-lynx.c: Redo all register store/fetch stuff to - make it portable for 386 and 68k. - -Fri Nov 12 09:53:26 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * mips-tdep.c (init_extra_frame_info): Check to see whether the - registers mentioned in the proc_desc have been saved. This - generalizes mips_in_lenient_prologue in the sense that we keep - searching until we've found saves for all the registers, not just - look for a "lenient prologue" pattern. - * mips-tdep.c: #if 0 lenient prologue code. - - * mips-tdep.c (heuristic_proc_desc): Don't assume a host short - is 16 bits. - -Thu Nov 11 19:58:05 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config/i386/i386sol2.mh: Comment out corelow.o. - - * printcmd.c (address_info): Use filtered, not unfiltered functions. - We should be able to deal with a QUIT here. - -Thu Nov 11 15:22:20 1993 Jeffrey A. Law (law@snake.cs.utah.edu) - - * printcmd.c (address_info): Use fprintf_symbol_filtered - to print the symbol name. - - * stabsread.c (define_symbol): Handle cfront lossage for - struct/union/enums and typedefs. - - * partial-stab.h (case N_BINCL): Update psymtab_language - as appropriate when changing subfiles. - (case N_SOL): Update psymtab_language as appropriate when - changing subfiles. Add typedef for structs, unions, and enums - when processing C++ files. - -Thu Nov 11 13:18:47 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * README: Remove information on languages and just cite the (newly - updated) information in doc/gdb.texinfo instead. - - * delta68-nat.c: Fix typos (add missing ");" and stuct -> struct). - -Wed Nov 10 09:31:10 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * dbxread.c (process_one_symbol, N_RBRAC): Don't clear - within_function just because local_symbols is NULL. It appears - that this bug has existed since the 10 Apr 89 change which started - clearing within_function here. - - * config/m68k/tm-m68k.h: Clean up CALL_DUMMY comment. - * config/m68k/{tm-hp300bsd.h,tm-hp300hpux.h,tm-m68k-em.h, - tm-monitor.h,tm-sun3.h,tm-vx68.h}, config/sparc/tm-sparc.h: - Define BELIEVE_PCC_PROMOTION. - * dbxread.c: Remove BELIEVE_PCC_PROMOTION define. The code which - used this was moved to stabsread.c a long time ago. - - * dstread.c (dst_sym_fns): Update for flavours. - * symfile.c (find_sym_fns): Add kludge for apollo like for rs/6000. - * dstread.c (dst_symfile_offsets): Set objfile->num_sections. - - gcc -Wall lint: - * thread.c: Include "gdbcmd.h" and . - * Makefile.in: Update dependency. - * thread.c (thread_command): Remove unused variable p. - * values.c (unpack_double): Use len instead of TYPE_LENGTH (type). - * valprint.c (print_floating): Correctly check sign bit now that - we are using unsigned arithmetic. - * symtab.c (find_pc_line_range): Remove unused variables exact_match, - ind, and l. - -Tue Nov 9 17:42:25 1993 Kung Hsu (kung@cirdan.cygnus.com) - - * valarith.c (value_x_binop): fix search operator in class bug - * valarith.c (value_x_unop): fix search operator in class bug - -Tue Nov 9 19:20:17 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Makefile.in (init.c): Add udi2go32.o to list of files that we - should not try to search for _initialize_* functions. - - * remote-udi.c (udi_wait): Change UDIGdb_StdoutReady back to - UDIStdoutReady. It accidentally got changed on 24 Oct 93 when - stdout was changed to gdb_stdout. Likewise for UDIGetStdout, - UDIStderrReady, and UDIGetStderr. - -Tue Nov 9 12:48:06 1993 Tom Lord (lord@cygnus.com) - - * remote-hms.c (hms_wait): fixed too many arguments to putc_unfiltered. - -Tue Nov 9 12:20:46 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * utils.c (quit): Also call gdb_flush on standard output and error. - - * .gdbinit: Remove "source /.gdbinit". It causes a spurious error - if /.gdbinit doesn't exist (and I know of no convention of putting - something in /.gdbinit). - -Mon Nov 8 18:17:11 1993 Kung Hsu (kung@cirdan.cygnus.com) - - * cp-valprint.c (cp_print_value_fields): change output from to - -Mon Nov 08 17:05:30 1993 Jeffrey Wheat (cassidy@cygnus.com) - - * Makefile.in: Change RUNTEST_FLAGS back to RUNTESTFLAGS - Change RUNTEST = runtest to test for existance of - a runtest in the source tree first. - -Mon Nov 8 10:42:03 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Makefile.in: Remove unused variable GCC. Remove "#CC=cc" line - which doesn't really relate to anything. - - * Makefile.in (CC_FOR_TARGET): Test for existence of gcc/xgcc, not - for existence of gcc/Makefile. - - * inflow.c (terminal_init_inferior), infptrace.c (child_resume): - Add comments about use of Lynx PIDGET and how we will want to - clean it up. - - * stabsread.c: Remove long_kludge_name code (it was already #if 0). - * stabsread.c (read_one_struct_field): Clean up comments to reflect - Kung's change of 5 Nov 93. - * stabsread.c (read_one_struct_field): Don't give up on unknown - visibility character, just shove it in fip->list->visibility. - (read_baseclasses): Don't give up on unknown virtual or visibility - characters, just assume a reasonable default, complain, and keep - going. - (attach_fields_to_type): Complain on unrecognized visibility. - One result of all this is that '9' (VISIBILITY_IGNORE) can be used - in a stab as well as being something which GDB uses internally. - -Mon Nov 8 07:57:30 1993 Doug Evans (dje@canuck.cygnus.com) - - * configure.in: Remove h8300h, we have multilib now. - -Mon Nov 8 06:11:24 1993 D. V. Henkel-Wallace (gumby@cirdan.cygnus.com) - - * configure.in: Add unixware as a configuration alias for x86 - sysv4 - - * config/i386/i386nw.mt: add i387-tdep.o, exec.o to TDEPFILES - -Sun Nov 7 23:49:21 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * symtab.c (decode_line_1, decode_line_2): Do not adjust pc by - FUNCTION_START_OFFSET if funfirstline is not set. - -Fri Nov 5 17:19:30 1993 Kung Hsu (kung@cirdan.cygnus.com) - - * gdbtypes.h : add a field 'ignore_field_bits in cplus_specific, - and macros to handle the bits. - * stabsread.c (read_one_struct_field): add VISIBILITY_IGNORE, and - for field of length 0, set this bit on. - * cp-valprint.c (cp_print_value_fields): for VISIBILITY_IGNORE - field, print . - -Fri Nov 5 14:43:46 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Version 4.11.2. - -Fri Nov 5 09:49:22 1993 Stu Grossman (grossman at cygnus.com) - - * inflow.c (terminal_init_inferior): Temporarily use Lynx PIDGET - macro to set process groups. - * infptrace.c (child_resume): Temporarily use Lynx PIDGET to - specify resumption of all threads. - * infrun.c (wait_for_inferior): Fix handling of thread-specific - breakpoints for systems where DECR_PC_AFTER_BREAK > 0 (ie: backup - PC by the right amount when continuing the thread). - * thread.c (thread_apply_command): Add the `thread apply' - command to apply a given GDB command to a list of threads. - -Fri Nov 5 05:58:03 1993 Jim Kingdon (kingdon@cygnus.com) - - * Makefile.in (init.c): Don't call sed if filename is empty. - -Thu Nov 4 08:27:24 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * dbxread.c (unknown_symchar_complaint): Make message refer to - "symbol descriptor" not "symbol type character" for consistency - with stabs.texinfo terminology. - - * stabsread.c (read_struct_fields): Accept either '$' or '.' as - the character which introduces a cpp_abbrev or anonymous type. - - * c-lang.c (c_printstr): Print "" to stream (like all the other - output from this function), not gdb_stdout. - - * dbxread.c (process_one_symbol): Do relocate 'S' symbols by - the text offset (revert 12 Oct 93 change). - - * configure.in: Make hppa*-*-hiux* use hppahpux, - not non-existent hppahiux. - -Wed Nov 3 16:24:09 1993 Kung Hsu (kung@cirdan.cygnus.com) - - * values.c (value_fn_field): when physical name not found, do not - error, but return null. - * valops.c (value_struct_elt): when name and args match does not - mean it is the one, some times a typedef class can have the same - member method and args. This probably will not happen with new - version of g++, but it does happen in old g++ and cause gdb error. - -Wed Nov 3 09:20:18 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - Merge changes for dos x udi: - * Makefile.in (udi2go32.o): add rule to build this file - * 29k-share/udi/udi2go32.c: new file - * config/a29k/a29k-udi.mt: add udi2go32.o - * 29k-share/udi/{udr.c, udip2soc.c}: #ifdef out the entire file - if __GO32__ is defined. What a hack. - -Wed Nov 3 09:20:18 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * remote.c (putpkt, getpkt): Don't call interrupt_query. - - * findvar.c (value_of_register): Rename val to reg_val to avoid - name conflict with some (e.g. tm-m68k.h) REGISTER_CONVERT_TO_VIRTUAL. - - * main.c: Add variables source_line_number, source_file_name, - source_error, source_error_allocated, and source_pre_error. - (command_line_input): If source_file_name set, increment - source_line_number and set error_pre_print with them. - (source_command): Set source_* and make a cleanup so they get - set back. - -Tue Nov 2 16:28:34 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * stack.c (down_silently_command): Add comment about PR 1913. - - * breakpoint.c (insert_breakpoints, delete_breakpoint): Call - target_terminal_ours_for_output before attempting output. - - * fork-child.c (fork_inferior): Fix comment so that it suggests - "set shell" rather than having "set env SHELL" affect GDB's - operation. - -Tue Nov 2 15:03:08 1993 Tom Lord (lord@rtl.cygnus.com) - - * utils.c (vfprintf_unfiltered): don't use maybe_filtered - since it involves a fixed size buffer. - -Tue Nov 2 13:42:30 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * findvar.c (value_of_register, value_from_register), - hppa-tdep.c (pa_print_fp_reg), infcmd.c (do_registers_info), - valops.c (value_assign): Use REGISTER_CONVERT_TO_* only if - REGISTER_CONVERTIBLE is defined, otherwise just copy the content. - Pass desired type to REGISTER_CONVERT_TO_*. - - * config/m68k/tm-m68k.h, config/i960/tm-i960.h (REGISTER_CONVERT_*): - Pass length of desired type to store/extract_floating. - * config/i386/tm-arm.h, config/i386/tm-i386aix.h, - config/i386/tm-sun386.h, config/i386/tm-symmetry.h, - config/m88k/tm-m88k.h config/rs6000/tm-rs6000.h (REGISTER_CONVERT_*): - Use extract_floating and store_floating with length of desired type. - * config/m68k/tm-news.h (STORE,EXTRACT_RETURN_VALUE): Add type - parameter to REGISTER_CONVERT_*. - - * config/a29k/tm-a29k.h, config/convex/tm-convex.h, - config/gould/tm-np1.h, config/gould/tm-pn.h, config/h8300/tm-h8300.h, - config/h8500/tm-h8500.h, config/i386/tm-i386v.h, - config/mips/tm-mips.h, config/ns32k/tm-merlin.h, - config/ns32k/tm-umax.h, config/pa/tm-hppa.h, config/pyr/tm-pyr.h, - config/sh/tm-sh.h, config/sparc/tm-sparc.h, config/tahoe/tm-tahoe.h, - config/vax/tm-vax.h, config/z8k/tm-z8k.h (REGISTER_CONVERTIBLE, - REGISTER_CONVERT_TO_RAW, REGISTER_CONVERT_TO_VIRTUAL): Remove - versions for which REGISTER_CONVERTIBLE is always false. - * z8k-tdep.c (register_convert_to_virtual, register_convert_to_raw): - Remove, no longer used. - - * alpha-tdep.c (alpha_register_convert_to_raw, - alpha_register_convert_to_virtual): New routines to handle - the different raw formats in alpha floating point registers. - * config/alpha/tm-alpha.h (REGISTER_CONVERTIBLE, - REGISTER_CONVERT_TO_VIRTUAL, REGISTER_CONVERT_TO_RAW): Use them. - -Tue Nov 2 12:45:23 1993 Stan Shebs (shebs@rtl.cygnus.com) - - * gdbserver/configure.in: Recognize *-*-lynxos* instead of - *-*-lynx*, recognize sparc-*-lynxos*. - * gdbserver/Makefile.in (install, install_only): Add. - * gdbserver/gdbserver.1: New file, man page for gdbserver. - -Tue Nov 2 03:01:01 1993 Jeff Law (law@snake.cs.utah.edu) - - * hpread.c: Include and . Change include - of "libhppa.h" to "som.h". - (BYTES_IN_WORD): Define. - (hppa_sym_fns): "hppa" is 4 characters, not 5. - -Mon Nov 1 09:40:21 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * symtab.c, symtab.h, source.c: Change find_line_pc_range to take - a struct symtab_and_line argument, rather than a symtab and a line. - Re-write it to be based on the address rather than bogusly adding - one to the line number and hoping that has something to do with the - end of the line. - - * config/m88k/m88k.mh (NATDEPFILES): Remove exec.o. - - * paread.c (pa_symtab_read): Change comments to say ignoring - labels really should be handled by the assembler/compiler. - - * Makefile.in: Add -O to CXXFLAGS. - - * TODO: Expand comments on fast watchpoints. - -Sun Oct 31 19:45:06 1993 Jeffrey A. Law (law@snake.cs.utah.edu) - - * paread.c (pa_symtab_read): Also filter out local symbols - starting with "L$". - -Sun Oct 31 09:28:46 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * symfile.h (sym_fns), symfile.c (find_sym_fns), xcoffread.c, - coffread.c, dbxread.c, elfread.c, mipsread.c, nlmread.c, paread.c: - Change from using bfd target name to using the flavour. - - * objfiles.h, infcmd.c, symfile.c: Add comments about how various - objfiles get created and when we should blow them away. - -Sat Oct 30 08:32:53 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * symfile.c (reread_symbols): When re-reading symbols, do all the - right operations ourself, rather than calling symbol_file_command. - If we re-read something, call clear_symtab_users not just - breakpoint_re_set. - * objfiles.h, objfiles.c (build_objfile_section_table): No longer - static. - * symfile.c (clear_symtab_users): Call clear_pc_function_cache. - * coffread.c, dbxread.c, elfread.c, mipsread.c, nlmread.c, paread.c - (*_symfile_offsets): Set objfile->num_sections. - * remote.c (remote_wait), symfile.c (syms_from_objfile): - Don't muck with objfile->num_sections now that all the symbol - readers set it. - * elfread.c: Clean up obsolete comment about handling only DWARF. - * paread.c: Remove comment about how we should use an "ordinary" - file format with an hppa suffix. There is nothing ordinary about SOM. - - * config/i386/{i386m3.mh,i386mk.mh}, config/mips/mipsm3.mh, - config/ns32k/ns32km3.mh: Change MMALLOC_LIB to MMALLOC. - * TODO: Update Mach stuff. - -Fri Oct 29 16:30:36 1993 Stan Shebs (shebs@rtl.cygnus.com) - - LynxOS support: - * configure.in: Change *-*-lynx* to *-*-lynxos*, add - sparc-*-lynxos*. - * Makefile.in (ALLDEPFILES): Add m68kly-nat.c, sparcly-nat.c. - Rename i386lynx-nat.[co] to i386ly-nat.[co]. - (ALLCONFIG): Add config/{m68k,sparc}/{m68k,sparc}lynx.m[ht]. - (m68kly-nat.o, sparcly-nat.o): Add rules. - * i386ly-tdep.c: Cosmetics. - * i386lynx-nat.c: Removed. - * i386ly-nat.c: New file, was i386lynx-nat.c. - * m68kly-nat.c: New file. - * sparcly-nat.c: New file. - * config/xm-lynx.h: New file, cpu-independent host info. - * config/i386/i386lynx.mh: Changes for consistency. - * config/i386/i386lynx.mt: Ditto. - * config/i386/tm-i386lynx.h: Ditto. - * config/i386/nm-i386lynx.h: Ditto. - * config/i386/xm-i386lynx.h: Include config/xm-lynx.h. - * config/m68k/m68klynx.mh, config/m68k/m68klynx.mt, - config/m68k/tm-m68klynx.h, config/m68k/nm-m68klynx.h, - config/m68k/xm-m68klynx.h: New files, M68K LynxOS support. - * config/sparc/sparclynx.mh, config/sparc/sparclynx.mt, - config/sparc/tm-sparclynx.h, config/sparc/nm-sparclynx.h, - config/sparc/xm-sparclynx.h: New files, Sparc LynxOS support. - -Fri Oct 29 08:11:29 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * defs.h, findvar.c (extract_floating, store_floating): New functions. - * Move SWAP_TARGET_AND_HOST from defs.h to findvar.c because it is - now used only by extract_floating and store_floating. - * valprint.c (print_floating): Use unsigned arithmetic. Use - extract_unsigned_integer instead of SWAP_TARGET_AND_HOST. - Change sizeof (float) to 4 and sizeof (double) to 8 (those are always - the relevant sizes for this code, which is in #ifdef IEEE_FLOAT). - * values.c (unpack_long, unpack_double, value_from_double), - valarith.c (value_binop), stabsread.c (define_symbol): - Use extract_floating and store_floating instead of - SWAP_TARGET_AND_HOST. - * config/m68k/tm-m68k.h, config/i960/tm-i960.h (REGISTER_CONVERT_*): - Use extract_floating and store_floating. - * config/m88k/tm-m88k.h: Add comments (it should be doing the same). - * i386-tdep.c (i386_extract_return_value), - * remote-nindy.c (nindy_store_registers): Use store_floating. - -Fri Oct 29 09:31:38 1993 Steve Chamberlain (sac@rtl.cygnus.com) - - * remote-sim.c (gdbsim_store_register): Change var name so - it compiles with non-ANSI compilers. - -Fri Oct 29 08:11:29 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * TODO: Add idea for "disassemble" with source. - -Fri Oct 29 00:41:01 1993 Fred Fish (fnf@cygnus.com) - - * Makefile.in (VERSION): Bump to 4.11.1 after release and cvs - tagging. - -Thu Oct 28 09:14:42 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * TODO: Add section on Mach. Stop calling it a "bug list". - Remove John's name and email address. Remove item on "always" - ("hook-stop" takes care of this). Remove item on executables with - no symbols (this works on some machines, at least). Remove item - about calling error() during symbol reading (I think all the important - ones have been cleaned up). Revise items about signals and remote - systems. Remove section on ^Z requiring several continues to make - it go (this now works. Perhaps the item is based on confusion over - programs (like GDB itself) which catch SIGTSTP and then re-send - themselves the signal. PR 2575 might contain relevant info). - -Thu Oct 28 16:55:34 1993 Fred Fish (fnf@cygnus.com) - - * NEWS: Note improvements in C++ support, preliminary thread - implementation, and LynxOS native and target support for 386. - -Thu Oct 28 16:55:34 1993 Fred Fish (fnf@cygnus.com) - - * README: Add note from Peter Schauer about OSF/1 shared - libraries. Add note from Pace Willisson about configuring on BSDI - BSD/386 release 1.0. Update gdb references to gdb 4.11. - -Thu Oct 28 09:14:42 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * NEWS: Add notes about Alpha and "set remotedebug" for UDI. - - * valops.c (value_assign): Change bitfield code to use a buffer of - the correct size, rather than an int. - -Wed Oct 27 13:43:07 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config/i386/{i386m3.mt,i386m3.mh}, - config/mips/{mipsm3.mt,mipsm3.mh}, - config/ns32k/{ns32km3.mt,ns32km3.mh}: Use correct names for TM_FILE - and XM_FILE. Replace host files *mach3-xdep.o with native - files *m3-nat.o. Replace host file os-mach3.o with native - file m3-nat.o. - - * remote-udi.c: Remove LOG_FILE stuff; superceded by "set remotedebug". - * remote-mon.c: Remove commented out "set remotedebug" command. - * remote-nindy.c: Clean up comment about wanting alternative to - options specified on the GDB command line. - - * fork-child.c (fork_inferior): Set inferior_pid before calling - init_trace_fun. Move the code which gets us through the shell - to new function startup_inferior. - * inferior.h: Declare startup_inferior. - * procfs.c (procfs_init_inferior), inftarg.c (ptrace_him): - Call startup_inferior. - * m3-nat.c (m3_trace_him): Call intercept_exec_calls. - * config/nm-m3.h: Don't define STARTUP_INFERIOR. - * config/i386/tm-i386m3.h, config/ns32k/tm-ns32k.h, - config/mips/tm-mipsm3.h: Don't define START_INFERIOR_TRAPS_EXPECTED. - - * m68k-stub.c: Change vector 13 from SIGFPE to SIGBUS. - -Tue Oct 26 22:05:03 1993 Jim Kingdon (kingdon@deneb.cygnus.com) - - * mips-tdep.c (mips_pop_frame): If proc_desc is NULL, don't dump core. - -Tue Oct 26 15:07:29 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - gcc -Wall lint: - * nlmread.c: Include stabsread.h. - * Makefile.in: Update dependencies. - - * remote.c: Change PBUFSIZ back to 400. John's 28 Feb 1992 change - to increase it broke the ability to write large chunks of memory - with m68k-stub and i386-stub. Now we only use more than 400 on - machines where we need that much to write the registers. - * remote.c (remote_write_bytes): Eliminate possible abort(). The - check for when to abort was off by a few bytes and besides which, - it is handled by MAXBUFBYTES, which the caller uses. - * m68k-stub.c: Add comments about trap #1 and trap #8 instructions. - -Tue Oct 26 08:36:07 1993 Doug Evans (dje@canuck.cygnus.com) - - * remote-sim.h (SIM_ADDR): New type (same as CORE_ADDR). - (sim_set_pc): Update prototype. - (sim_read, sim_write): Ditto, and use unsigned char *buf. - (sim_fetch_register, sim_store_register): Use unsigned char *buf. - (sim_info): Pass printf function as argument, add verbose argument. - (sim_stop_reason): Renamed from sim_stop_signal, fix prototype. - * remote-sim.c (gdbsim_wait): Update call to sim_stop_reason. - (gdbsim_files_info): Update call to sim_info. - -Tue Oct 26 10:41:29 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * valops.c (value_assign): Call reinit_frame_cache when assigning - to a register. - -Mon Oct 25 11:08:59 1993 Stu Grossman (grossman at cygnus.com) - - * infrun.c (wait_for_inferior): Fix PC out of objfile bounds - check to just use stop_func_name == 0. - * remote-udi.c (store_register): Invalidate NPC/PC_REGNUM after - changing PC. - -Mon Oct 25 14:57:45 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * gdbserver/{low-lynx.c,low-sparc.c,low-sun3.c}, standalone.c, - m3-nat.c, i386m3-nat.c, mipsm3-nat.c, ns32km3-nat.c: bcopy -> memcpy. - - gcc -Wall lint: - * breakpoint.c: Include thread.h. - * coffread.c: Include stabsread.h. - * Makefile.in: Update dependencies. - * breakpoint.c (mention): Add bp_call_dummy to switch. - * symmisc.c (dump_symtab): Use %d not %ld for line number. - -Sun Oct 24 18:29:32 1993 Tom Lord (lord@rtl.cygnus.com) - - * every non-obsolete file except utils.c: - Change the stream argument to _filtered to GDB_FILE *. - Change all references to stdout/stderr to gdb_stdout/gdb_stderr. - Replace all calls to stdio output functions with - calls to corresponding _unfiltered functions. - Replaced calls to fopen for output to gdb_fopen. - Added sufficient goo to utils.c and defs.h to make the above - work. - - The net effect is that stdio output functions are only directly - used in utils.c. Elsewhere, the _unfiltered and _filtered - functions and GDB_FILE type are used. - - In the near future, GDB_FILE will stop being equivalant to - FILE. - - The semantics of some commands has changed in a very subtle way: - called in the right context, they may cause new occurences of - prompt_for_continue() behavior. - - Please respect this change by not reintroducing stdio output - dependencies in the main body of gdb code. All output from - commands should go to a GDB_FILE. - -Sun Oct 24 20:16:38 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * parse.c, parser-defs.h (write_exp_msymbol): New function to write - the appropriate expression for a minimal symbol. Taken from c-exp.y - and m2-exp.y but handles mst_file_*. - * c-exp.y, m2-exp.y: Use it. - -Sun Oct 24 09:31:05 1993 Fred Fish (fnf@lisa.cygnus.com) - - * elfread.c (elf_symtab_read): Use bfd convention that both - initialized and uninitialized data sections have the SEC_ALLOC - flag bit set, but only initialized sections have SEC_LOAD set. - SEC_DATA is ignored since it only gets set for initialized - data. - -Sat Oct 23 14:48:18 1993 Doug Evans (dje@canuck.cygnus.com) - - * remote-sim.h (sim_stop): New enum. - (sim_stop_signal): Change prototype, result is enum sim_stop. - * remote-sim.c (gdbsim_wait): Update call to sim_stop_signal. - -Fri Oct 22 07:49:54 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * stabsread.c (define_symbol): Skip the whole thing about "pcc - promotion" on little-endian machines. - - * remote-vx.c (vx_wait): Rename pid parameter to pid_to_wait_for. - Some compilers (legitimately) don't like variables in the - function's outermost block whose name is the the same as the name of - a parameter. - - Merge Apollo patches from Troy Rollo (troy@cbme.unsw.edu.au): - * dst.h, dstread.c, config/m68k/{apollo68b.mt,tm-apollo68b.h}: - New files. - * config/m68k/nm-apollo68b.h: Add more defines. - * configure.in: Recognize apollo target, not just host. - - * configure.in: Add * to end of all OS names. - -Fri Oct 22 06:14:01 1993 Fred Fish (fnf@cygnus.com) - - * Makefile.in (ALLPARAM): Add config/m88k/xm-delta88v4.h - -Thu Oct 21 12:23:12 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Makefile.in (init.c): Generate using the source, not munch. This - cleans up all kinds of hassles (which nm to use in munch, etc). The - new formatting conventions (mostly already followed) are that - the name of the _initialize_* routines must start in column zero, - and must not be inside #if. - * munch: Removed. - * Makefile.in: Remove references to munch. - * serial.c, remote.c, infptrace.c, maint.c, convex-tdep.c, - alpha-tdep.c, hp300ux-nat.c, hppab-nat.c, osfsolib.c, remote-es.c, - procfs.c, remote-udi.c, ser-go32.c, ultra3-xdep.c, sh-tdep.c, - i960-tdep.c, hppa-tdep.c, h8500-tdep.c, dpx2-nat.c, delta68-nat.c, - z8k-tdep.c: Make sure the above conventions are followed. Make - sure they are all declared as returning void. Clean up - miscellaneous comments and such. - - * sh-tdep.c (sim_load): Add function. - -Thu Oct 21 15:58:48 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) - - * remote-mips.c (mips_wait): add pid argument. - -Thu Oct 21 12:23:12 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Makefile.in (c-exp.tab.o): Remove notice about shift/reduce conflicts - which no longer occur. - - gcc -Wall lint: - * findvar.c (symbol_read_needs_frame), corelow.c (ignore), - inflow.c (gdb_has_a_terminal): Make sure to return a value. - * regex.h: Declare re_set_syntax. - * printcmd.c: Include valprint.h. - * infcmd.c, exec.c, maint.c, core.c: Include language.h. - * maint.c: Include expression.h. - * infrun.c, fork-child.c, corelow.c, inflow.c: Include thread.h. - * inftarg.c: Include command.h. - * coredep.c: Include value.h. - * c-exp.y, m2-exp.y, ch-exp.y: Include bfd.h, symfile.h and objfiles.h. - * ch-typeprint.c: Include typeprint.h. - * ch-valprint.c: Include c-lang.h. - * nlmread.c: Include buildsym.h. - * environ.c: Include gdbcore.h. Only include defs.h once. - (set_in_environ): Cast const char * to char * when passing to - set_gnutarget. - * Makefile.in: Update dependencies to reflect all these new includes. - Remove unused variables: - * printcmd.c (printf_command): args_to_vprintf. - * coffread.c (coff_symfile_init): strsection. - Move variables to within the #ifdefs where they are used: - * symtab.c (gdb_mangle_name): opname. - * inftarg.c (child_attach): pid and exec_file. - * inftarg.c (child_detach): siggnal. - * objfiles.c (allocate_objfile): mapto, md, and fd. - * objfiles.c (free_objfile): mmfd. - * infrun.c (wait_for_inferior): Include BPSTAT_WHAT_LAST in switch. - * infrun.c (wait_for_inferior): Remove unused same_pid label. - * inferior.h: Declare set_sigint_trap and clear_sigint_trap. - * parser-defs.h: Declare write_exp_elt_block. - * stabsread.h: Declare elfstab_offset_sections and - coffstab_build_psymtabs. - -Thu Oct 21 12:05:08 1993 Ken Raeburn (raeburn@cygnus.com) - - Patch from Jeff Law: - * paread.c: Fix references to "hppa" that should now be "som". - -Thu Oct 21 12:23:12 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * symtab.c (decode_line_1): Don't use SYMBOL_LINE for functions. - -Thu Oct 21 02:59:07 1993 Stu Grossman (grossman at cygnus.com) - - * remote-udi.c (udi_store_registers, store_register): Use - UDI29KPC address space when modifying PC. It seems that you can't - modify the PC directly (at least in the isstip simulator). - -Wed Oct 20 11:35:43 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * target.h: Put remote_debug declaration back here. Add baud_rate. - * remote.c, remote-udi.c, remote-utils.h: Let target.h take care of - declaring these. Those random externs all over are error prone. - * Move "set remotebaud" from remote-utils.c to main.c to it applies - to remote.c as well. - - * xcoffread.c (xcoff_symfile_read), coffread.c (coff_symfile_read): - Sort symtabs for this objfile only, not for all objfiles. - * symfile.c, symfile.h (sort_all_symtab_syms): Remove; no longer used. - - * mipsread.c (parse_symbol): In third-eye, a function has a block - within it which represents the whole function. Create only one - GDB block for both. - -Wed Oct 20 17:47:42 1993 Stu Grossman (grossman at cygnus.com) - - * main.c: Make baud_rate and remote_debug be global variables, - remove #include "remote-utils.h". This makes it possible to build - GDB without remote-utils.c. Also, move setting of remote_debug - into main, so that all remote*.c files can use it (not just the - serial line ones). And, make baud_rate be an int. - * remote-udi.c: Change kiodebug to remote_debug. - * remote-utils.c: Move setting of baud rate and debug into main.c. - * remote-utils.h: Redefine sr_{get set}_debug and sr_{get set}_baud - to use baud_rate and remote_debug globals for compatibility. - * remote.c: Use remote_debug and baud_rate globals directly, - instead of sr_ functions, so that we don't need to load - remote-utils.c. - * config/a29k/a29k-udi.mt: Define REMOTE_O as null so that we don't - get the default remote* modules. - -Wed Oct 20 11:35:43 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * stabsread.c (define_symbol): When combining a LOC_ARG and a - LOC_REGISTER, use the type from the LOC_REGISTER, not from the - LOC_ARG. - -Wed Oct 20 14:34:38 1993 K. Richard Pixley (rich@sendai.cygnus.com) - - * config/i386/xm-go32.h: define some signals if they aren't - already defined. - -Wed Oct 20 11:35:43 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Makefile.in (INTERNAL_LDFLAGS): New macro. The new part is - that we use CFLAGS and PROFILE_CFLAGS to link. - (gdb, rapp, kdb): Use INTERNAL_LDFLAGS instead of - LDFLAGS and/or GLOBAL_CFLAGS. - -Wed Oct 20 09:29:55 1993 Stu Grossman (grossman at cygnus.com) - - * Makefile.in: Add $(srcdir) to all refs to 29k-share - directories. - -Tue Oct 19 17:23:34 1993 Fred Fish (fnf@deneb.cygnus.com) - - * Makefile.in (ALLCONFIG): Add config/i386/{i386m3.mh, i386m3.mt, - i386/i386mk.mh i386/i386mk.mt}, config/mips/{mipsm3.mh, - mipsm3.mt}, config/ns32k/{ns32km3.mh, ns32m3.mt} - * Makefile.in (remote_utils_h): Add remote-sim.h - * Makefile.in (NONSRC): Add i386-nlmstub.c - * Makefile.in (HFILES): Add coff-solib.h - -Tue Oct 19 14:15:40 1993 Kung Hsu (kung@cirdan.cygnus.com) - - * values.c (value_virtual_fn_field): Fix the offset calculation - when calling virtual functions. (gdb.t22/virtfunc.exp). - * eval.c (evaluate_subexp): same as above. - -Tue Oct 19 10:43:16 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config/rs6000/rs6000.mh (TERMCAP): Define to -lcurses. - - * Makefile.in: Define CXXFLAGS. - -Tue Oct 19 09:28:52 1993 Stu Grossman (grossman@cygnus.com) - - * sparclite/Makefile.in: Fixup so that this works with Sun make - and VPATH. - -Tue Oct 19 10:43:16 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * breakpoint.h (struct bpstat_what): Don't use bitfields. - - * typeprint.c: Add "class CLASS-NAME" to docstring for ptype. - -Tue Oct 19 06:17:10 1993 Fred Fish (fnf@cirdan.cygnus.com) - - * Makefile.in (ALLPARAM): Add config/m88k/{nm-delta88v4.h, - tm-delta88v4.h, xm-dgux.h}. - * Makefile.in (ALLCONFIG): Add config/m88k/{delta88v4.mh, - delta88v4.mt}. - - * README: Remove comment about SunOS 5.x programs leaving - coredumps. Info from Sun is that this was not in customer - releases. - -Mon Oct 18 10:28:08 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * hppa-tdep.c (restore_pc_queue): Call target_terminal_ours after - done stepping the inferior. - - * c-exp.y: Remove never-used (because of shift/reduce conflicts) - rules for pointers to members. - * Makefile.in: Remove notice about expected shift/reduce conflicts. - - * buildsym.c (finish_block): If we pop the context stack and it is - not empty, complain () instead of abort (). - -Sun Oct 17 19:42:31 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * parse.c, parser-defs.h (follow_types): New function. - * c-exp.y (ptype : typebase abs_decl): Use it. - * c-exp.y (ptype): Add support for type qualifiers after the - typebase. The typebase rule already has support for them before - the typebase. - * Makefile.in: Change the expected number of shift/reduce - conflicts to 6. This is OK--the 2 new conflicts are basically the - same as one of the old ones. - -Sun Oct 17 13:04:49 1993 Fred Fish (fnf@cygnus.com) - - * Makefile.in (VERSION): Bump to 4.10.3. - -Sun Oct 17 09:18:57 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * infrun.c (wait_for_inferior): Clean up comments which were at - the top of the file, making them more concise and moving them with - the code (Sorry, Randy, but these stream-of-consciousness comments - really have to go). Switch the order of the "&&", which makes - things clearer and turns out to be an improvement with respect to - side effects and speed. - -Sun Oct 17 02:06:01 1993 Stu Grossman (grossman at cygnus.com) - - * procfs.c: Handle process exits more elegantly by trapping on - entry to _exit. Also, cleanup procinfo list when process dies of - it's own accord (as opposed to being killed). - -Sat Oct 16 20:47:30 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config/m88k/xm-dgux.h: Define NO_PTRACE_H. - - * corelow.c (add_to_thread_list): Need a cast to go from PTR to - asection *. - - * infrun.c: Add comment about signals. - - * fork-child.c (fork_inferior): Remove CREATE_INFERIOR_HOOK again. - Stu reinstated it (accidently I assume). - -Sat Oct 16 15:27:10 1993 Stu Grossman (grossman at cygnus.com) - - * procfs.c (procfs_wait): Losing Unixware can't do poll on /proc - files. Use PIOCWSTOP instead. - * corelow.c (add_to_thread_list): Fix arg to match prototype. - - * procfs.c (procfs_set_sproc_trap): Don't use this if sproc - isn't available. - * (procfs_notice_signals): Fix prototype. - -Fri Oct 15 22:46:07 1993 Stu Grossman (grossman at cygnus.com) - - * breakpoint.c (breakpoint_thread_match break_command_1): - Thread-specific breakpoint support. - * breakpoint.h (struct breakpoint): Add thread id field. - * fork-child.c (fork_inferior): Move call to init_thread_list() - back a bit so that init_trace_fun can do thread functions. - * hppa-tdep.c (restore_pc_queue): Add pid to call to target_wait. - * hppab-nat.c (child_resume): Handle default pid. - * hppah-nat.c (child_resume): Handle default pid. - * i386lynx-nat.c (child_wait): New arg pid. - * inflow.c (kill_command): Reset thread list. - * infptrace.c (child_resume): Handle default pid. - * infrun.c: Thread-specific breakpoint support. - * inftarg.c (child_wait): Add pid arg. - * osfsolib.c (solib_create_inferior_hook): Add pid to call to - target_resume. - * procfs.c: Multi-thread support. - * remote-bug.c (bug_wait): Add pid arg. - * remote-hms.c (hms_wait): Add pid arg. - * remote-mips.c (mips_wait): Add pid arg. - * remote-mon.c (monitor_wait): Add pid arg. - * remote-nindy.c (nindy_wait): Add pid arg. - * remote-sim.c (gdbsim_wait): Add pid arg. - * remote-udi.c (udi_wait): Add pid arg. - * remote-vx.c (vx_wait): Add pid arg. - * remote-z8k.c (sim_wait): Add pid arg. - * remote.c (remote_wait): Add pid arg. - * solib.c (solib_create_inferior_hook): Add pid to call to - target_resume. - * target.h (struct target_ops): Add pid arg to to_wait and - to_notice_signals. - * thread.c (valid_thread_id): New func to validate thread #s. - * (pid_to_thread_id): New func to do the obvious. - * thread.h: Prototypes for above. - - * coff-solib.c (coff_solib_add): Use nameoffset field to locate - filename. - -Fri Oct 15 21:29:40 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * h8300-tdep.c, h8500-tdep.c: Define sim_load only, but not - sim_kill, sim_open, or sim_set_args. - - * stack.c (print_stack_frame): Put catch_errors around - print_frame_info so (for example) error printing source doesn't - cause auto-displays to get skipped in normal_stop. - - * findvar.c (value_from_register): When preparing to cast a value - from REGISTER_VIRTUAL_TYPE to type, copy the REGISTER_VIRTUAL_SIZE; - the old code didn't copy the whole thing. - * valops.c (value_assign): Add comment. - -Fri Oct 15 12:57:30 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * mipsread.c (upgrade_type): Replace bitsize sanity checks and - complaint by a comment explaining why they were useless. - -Fri Oct 15 14:30:30 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Move comments on bypassing call dummy breakpoint from stack.c - to breakpoint.h. - -Fri Oct 15 11:52:56 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * symtab.c (lookup_partial_symtab): If filename is not found and - contains no slashes, try again and compare without leading path - components. - * symtab.c (lookup_symtab_1): Replace open coded version of - lookup_partial_symtab with a function call. - -Thu Oct 14 20:34:15 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * fork-child.c (fork_inferior), remote-eb.c (eb_create_inferior), - remote-mon.c (monitor_create_inferior), remote-nindy.c - (nindy_create_inferior), remote-st.c (st2000_create_inferior), - remote-vx.c (vx_create_inferior): Remove CREATE_INFERIOR_HOOK; it - is replaced by init_trace_fun. - * config/convex/xm-convex.h, convex-xdep.c: Add comments explaining - how to do without CREATE_INFERIOR_HOOK for whoever fixes the Convex - port. - - * Makefile.in: Add Mach files to ALLDEPFILES, etc. - * m3-nat.c: Clean up more hair--message(), cprocs. - * configure.in: Recognize Mach targets and hosts. - * config/ns32k/tm-umax.h: Add some #ifndef's so tm-ns32km3.h can - include this file. - * Mach headers in config/*/tm-*.h: Fix includes to match correct - locations of files. - -Thu Oct 14 21:35:55 1993 Rob Savoye (rob@darkstar.cygnus.com) - - * remote-mon.c (general_open): Set dev_name. Minor tweaking to get - it working again. - * config/m68k/tm-monitor.h: Remove floating point register names - as there aren't any on any of the monitors that use this code. - -Wed Oct 13 11:47:23 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * inflow.c: Pass pointer to process group, not process group itself, - to TIOCSPGRP ioctl. - - * inflow.c (terminal_ours_1): Don't print warning on failure to - set process group. - - * printcmd.c (printf_command): Instead of using makeva* and - calling vprintf, just make the appropriate calls to printf. - * printcmd.c, config/pa/xm-pa.h, config/mips/xm-makeva.h, - config/alpha/xm-alpha.h, config/m88k/xm-m88k.h: Remove all - traces of makeva*. My apologies to everyone (including me!) - who spent so much time getting it to work on various machines, - but look at the bright side, at least you won't have to do it - again in the future. - - * printcmd.c (printf_command): Make a cleanup for val_args (fixes - a memory leak). - -Tue Oct 12 22:54:41 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config/mips/xm-mips.h: Remove comment about HAVE_SGTTY vs. usleep. - -Tue Oct 12 12:01:29 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) - - * configure.in: only configure gdbserver for native environments - -Tue Oct 12 08:59:15 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * stabsread.c (read_type): Treat a negative type number at the start - of a type as a type reference, not as a definition of a type with - "50=" omitted. This makes things work on the RS/6000 again (the - 14 Sep 1993 change broke it). - - * inflow.c: Use 0 (standard input) not scb->fd. - (terminal_ours_1): If printing warning, don't claim it happened in - terminal_inferior. - - * blockframe.c (get_prev_frame_info): Don't error() if there are no - frames; just return NULL. - - * xcoffsolib.h, xcoffexec.c: Undo the part of Fred's bfd->abfd - change which involved structure elements. It was unnecessary and - was not consistently done. - - * stabsread.h, stabsread.c, dbxread.c (common_block*, copy_pending): - Move common block handling from dbxread.c to stabsread.c. - Use the name from the BCOMM instead of the ECOMM. - Allocate things on the symbol_obstack. - * xcoffread.c (process_xcoff_symbol): Process C_BCOMM, C_ECOMM, - and C_ECOML. On unrecognized storage classes, go ahead and call - define_symbol (after the complaint). - - * dbxread.c (process_one_symbol): Don't relocate 'S' symbols by - the text offset. - -Tue Oct 12 12:33:09 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * osfsolib.c (solib_create_inferior_hook): Reset stop_soon_quietly - after shared library symbol reading to get rid of warning from - heuristic_proc_start. - -Tue Oct 12 12:01:29 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) - - * remote-sim.c: fix unterminated character string - -Tue Oct 12 08:59:15 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * stabsread.c: Fix comment about gcc 2.3.3 stab for long long int. - -Mon Oct 11 14:27:25 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * m3-nat.c, config/nm-m3.h: Add a target_ops struct and other - various things to try to get this to work. - - * symtab.h: Fix comments re headers, sharing blockvectors, etc. - -Mon Oct 11 11:46:06 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) - - * config/i960/vxworks960.mt (REMOTE_O): add dcache.o and remote-utils.o - -Mon Oct 11 02:48:57 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * mipsread.c (parse_partial_symbols): Do not add undefined - symbols to the partial symbol table. - * alpha-tdep.c (init_extra_frame_info): Remove kludge for gcc, - gcc has to be compatible with the native tools. - * alpha-tdep.c (alpha_push_arguments): Rename NUM_ARG_REGS to - ALPHA_NUM_ARG_REGS and move its definition to tm-alpha.h. - * config/alpha/tm-alpha.h (FRAME_ARGS_ADDRESS): Change it to the - way the native tools define it, update comment. - -Fri Oct 8 15:54:06 1993 Fred Fish (fnf@deneb.cygnus.com) - - * osfsolib.c, remote-sim.c, remote.c, solib.c, xcoffexec.c, - xcoffsolib.h: Use 'abfd' for bfd variables instead of 'bfd'. - Sun cc doesn't like variable names that match their typedef'd type. - -Fri Oct 8 14:56:21 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * inflow.c: Remove unused includes of sys/param.h and sys/types.h. - - * inflow.c, ser-unix.c, ser-go32.c, ser-tcp.c, serial.h, - terminal.h, fork-child.c, main.c, utils.c: Move all the process - group stuff back to inflow.c and terminal.h; that's a better place - for it and fixes problems with trying to get/set the process group - of a tty we're doing remote debugging on. - * terminal.h: Skip the redefines and includes if HAVE_TERMIOS. - - * findvar.c, value.h (symbol_read_needs_frame): New function. - * c-exp.y, m2-exp.y: Call it instead of having our own switch on - the symbol's class. - * valops.c (value_of_variable): Use symbol_read_needs_frame to - decide whether we care about finding a frame. - -Fri Oct 8 02:34:21 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * blockframe.c (get_frame_block): Do not adjust pc if the frame - function was interrupted by a signal. - -Thu Oct 7 19:20:11 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config/h8300/tm-h8300.h: Don't define sr_get_debug. - * remote-sim.c: Include remote-utils.h. - * target.h: Add comment about target_has_execution. - -Thu Oct 7 16:14:19 1993 Steve Chamberlain (sac@phydeaux.cygnus.com) - - * h8300-tdep.c (sim_load, sim_kill, sim_open, sim_set_args): - New functions. - * infrun.c (normal_stop): Don't try and set the pc in the current - frame coredump if there isn't one. - * remote-sim.c (gdbsim_store_register): Don't - SWAP_TARGET_AND_HOST, sim_store_register takes bytes in raw order. - (gdbsim_wait): Set status with WSETSTOP. - * config/h8300/tm-h8300.h (sr_get_debug): Define - -Thu Oct 7 12:56:57 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - New Mach stuff: - * config/i386/i386mach.c: Explain this is for the old (probably - non-functional and/or obsolete) Mach stuff. - * m3-nat.c, config/nm-m3.h, - i386m3-nat.c, mipsm3-nat.c, ns32km3-nat.c, - config/i386/{i386m3.mh,i386m3.mt,tm-i386m3.h,xm-i386m3.h}, - config/i386/{i386mk.mh,i386mk.mt,tm-i386mk.h,xm-i386mk.h}, - config/mips/{mipsm3.mh,mipsm3.mt,tm-mipsm3.h,xm-mipsm3.h}, - config/ns32k/{ns32km3.mh,ns32km3.mt,tm-ns32km3.h,xm-ns32km3.h}: - New files. - - * blockframe.c (find_pc_partial_function): If we call - PSYMTAB_TO_SYMTAB, call target_terminal_ours_for_output first. - This is needed now that wait_for_inferior passes in endaddr. - * infrun.c: Move call to target_terminal_inferior from proceed - to resume. - -Thu Oct 7 09:22:04 1993 Stu Grossman (grossman at cygnus.com) - - * blockframe.c (find_pc_partial_function): Fix handling for PCs - beyond the end of the last function in an objfile. - * coff-solib.c (coff_solib_add): Use BFD to get fields from .lib - section. - * infrun.c (wait_for_inferior): Modify test for subroutine entry - to include pc out of bounds of the previous function. - * remote.c (remote_wait): Use strtoul for parsing 'N' message. - Add code to relocate symfile_objfile->sections. - -Thu Oct 7 06:22:43 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config/sparc/sun4os4.mh: Add comment saying why we don't use - -lresolv. - -Thu Oct 7 09:29:11 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * breakpoint.c, breakpoint.h (breakpoint_init_inferior): New function - that clears the `inserted' flag for all breakpoints and deletes - any breakpoints which should go away between runs of programs. - * inflow.c (generic_mourn_inferior), infrun.c (init_wait_for_inferior), - remote-es.c (es1800_load), comments in exec.c and corelow.c: - Use it instead of mark_breakpoints_out. - * breakpoint.c (mark_breakpoints_out): Update comment, tm-rs6000.h - uses it in a completely different context. - * breakpoint.c (breakpoint_re_set_one): Add bp_call_dummy case. - -Thu Oct 7 09:29:11 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * Makefile.in (REGEX, REGEX1): Always use our own version of - regex.c to be consistent across hosts. - * source.c (_initialize_source): Initialize regex to use grep - style syntax as an approximation to POSIX basic regex syntax. - -Wed Oct 6 12:43:47 1993 Jeffrey A Law (law@snake.cs.utah.edu) - Jim Kingdon (kingdon@lioth.cygnus.com) - - * hppa-tdep.c (frame_chain): Rework so that it correctly - handles boundaries where code with a frame pointer calls code - without a frame pointer. - (dig_fp_from_stack): New function. - -Wed Oct 6 12:43:47 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * breakpoint.c (delete_breakpoint): Don't insert a disabled breakpoint. - - * README: Add Alpha notes from Schauer. - -Tue Oct 5 15:26:04 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Makefile.in (install, uninstall): Remove $$n.1 stuff; I don't - understand what it is trying to do, but I suspect it's not doing - it. - - * config/ns32k/merlin.mh: Add comment about M_INSTALL. - * config/m88k/{delta88.mh,delta88v4.mh}: Remove M_INSTALL and - M_UNINSTALL; it tries to install a non-existent file gdb.z. - * Makefile.in: Remove M_INSTALL stuff; the above were the only uses. - - * stabsread.c (read_range_type): Remove comment which recommends - distinguishing float from complex by the name. - -Tue Oct 5 12:17:40 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - Jim Kingdon (kingdon@cygnus.com) - Stu Grossman (grossman@cygnus.com) - - Changes to support alpha OSF/1 in native mode. - * alpha-nat.c, alpha-tdep.c, config/alpha/alpha-osf1.mt, - config/alpha/nm-alpha.h, config/alpha/tm-alpha.h, osfsolib.c: - New files. - * Makefile.in: Add new files and dependencies. - * configure.in: Add alpha target. - * config/alpha/alpha-osf1.mh (NATDEPFILES): Add osfsolib.o - * config/alpha/alpha-osf1.mh (MH_CFLAGS): Remove, we can handle - shared libraries now. - * config/alpha/xm-alpha.h: Cleanup, get MAKEVA_* defines right. - - * defs.h (CORE_ADDR): Make its type overridable via CORE_ADDR_TYPE, - provide `unsigned int' default. - * breakpoint.c (breakpoint_auto_delete): Delete only if we really - stopped for the breakpoint. - * stabsread.c, stabsread.h (define_symbol): Change valu parameter - to a CORE_ADDR. - * stabsread.c (read_range_type): Handle the case where the lower - bound overflows and the upper doesn't and the range is legal. - * infrun.c (resume): Do not step a breakpoint instruction if - CANNOT_STEP_BREAKPOINT is defined. - - * inferior.h (CALL_DUMMY_LOCATION): New variant AT_ENTRY_POINT. - Now that we have the bp_call_dummy breakpoint the call dummy code - is no longer needed. PUSH_DUMMY_FRAME, PUSH_ARGUMENTS and - FIX_CALL_DUMMY can be used to set up everything for the dummy. - The breakpoint for the dummy is set at the entry point and thats it. - * blockframe.c (inside_entry_file, inside_entry_func): Do not stop - backtraces if pc is in the call dummy at the entry point. - * infcmd.c (run_stack_dummy): Handle AT_ENTRY_POINT case. Use - the expected breakpoint pc when setting up the frame for - set_momentary_breakpoint. - * symfile.c (entry_point_address): New function for AT_ENTRY_POINT - support. - * valops.c (call_function_by_hand): Handle AT_ENTRY_POINT case. - -Tue Oct 5 11:37:02 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * configure.in: Recognize hppa*-*-hiux* (currently synonym for hpux). - Change other hppa host entries to use -*- not -hp-. - -Mon Oct 4 19:16:14 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * i386-nlmstub.c: New file; debugging stub for i386 NetWare. Must - be compiled with NetWare header files and turned into an NLM with - nlmconv. - -Mon Oct 4 11:02:11 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * minsyms.c (lookup_minimal_symbol_by_pc): Don't use mst_abs symbols. - - * dbxread.c (process_one_symbol): Make n_opt_found static. - - * Rename i386lynx-tdep.c to i386ly-tdep.c for 14 character file names. - * Makefile.in, config/i386/i386lynx.mt: Change accordingly. - - * values.c (record_latest_value): Fetch lazy values and set VALUE_LVAL - to not_lval. - -Sun Oct 3 15:54:51 1993 Stan Shebs (shebs@rtl.cygnus.com) - - * objfiles.h (objfile): New slot sym_stab_info, use by most - stab-reading formats. - * gdb-stabs.h (DBX_SYMFILE_INFO): Access sym_stab_info instead of - sym_private. - * coffread.c (coff_symfile_init): Alloc struct for sym_stab_info. - * dbxread.c, elfread.c, paread.c: Change sym_private references to - sym_stab_info references. - -Sat Oct 2 19:28:35 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * mipsread.c, objfiles.c, utils.c: Use PTR not void *. RISC/OS - 4.02 lacks void *. - * elfread.c: Use void * not PTR inside PARAMS. - - * config/mips/news-mips.mh: Remove coredep.o; mips-nat.o does it. - * config/mips/news-mips.mh: Define NAT_FILE not NM_FILE. - * config/mips/nm-news-mips.h: Include mips/nm-mips.h not nm-mips.h. - -Sat Oct 2 16:05:22 1993 Stu Grossman (grossman at cygnus.com) - - * Makefile.in, coff-solib.c, coff-solib.h, i386lynx.mt, - tm-i386lynx.h: Add support for SVR3 COFF shared libraries. - -Sat Oct 2 15:50:41 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * m88k-nat.c (store_inferior_registers): When writing all registers, - don't try to write EXIP_REGNUM or ENIP_REGNUM (not needed for this - case, and they cause trouble). - - * TODO: Don't suggest doing fast watchpoints by stepping a line - at a time. That would be really hairy and still not fast enough. - Do suggest debug registers and page table diddling. - -Fri Oct 1 14:54:46 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * printcmd.c (do_examine): Make meaning of 'h', 'w', and 'g' not - depend on builtin_type_*. Instead, it is always 2, 4, and 8 bytes - like the documentation says. - * printcmd.c (decode_format) [CC_HAS_LONG_LONG]: Remove 'l' as - synonym for 'g'. This was never documented, it shouldn't depend on - CC_HAS_LONG_LONG, and I don't see what's wrong with 'g'. - -Fri Oct 1 10:06:35 1993 Kung Hsu (kung@cirdan.cygnus.com) - - * symtab.c: fix a bug in testsuite (virtfunc.exp) - -Thu Sep 30 11:30:56 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * m88k-nat.c (fill_gregset): Fix typo (R_SFIP -> R_FIP). - - * c-typeprint.c (c_type_print_base, TYPE_FN_FIELD_STUB code): - If demangled name lacks a colon, don't dump core. - - * blockframe.c (find_pc_partial_function): If pst->readin is - set, don't try to get symbols from pst. - - * inflow.c (generic_mourn_inferior): Call reinit_frame_cache - instead of doing it ourself. - * blockframe.c (reinit_frame_cache): Use code which was in - generic_mourn_inferior so we can use this function even when - we have switched targets. - * corelow.c (core_detach): Call reinit_frame_cache. - * target.c (target_detach): Don't call generic_mourn_inferior - (revert yesterday's change, now handled by core_detach). - * objfiles.c (free_objfile): Detach any core file if we call - SOLIB_CLEAR. #include target.h. - - * fork-child.c (fork_inferior): Don't call target_terminal_init - and target_terminal_inferior until we are sure that the inferior - has called gdb_setpgid. This fixes PR 2900 (Schauer tracked it - down and was able to reliably reproduce it by putting a sleep() - before the gdb_setpgid()). - -Thu Sep 30 12:00:49 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * c-exp.y, m2-exp.y: Change type of address for msymbol to - builtin_type_long. - * infptrace.c (fetch_register, store_inferior_register, - child_xfer_memory): Use PTRACE_XFER_TYPE for the type of ptrace - transfers. Provide an `int' default for PTRACE_XFER_TYPE. - -Thu Sep 30 11:30:56 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * defs.h (TARGET_*_BIT): Don't use host information (sizeof) in - picking defaults. - - * cp-valprint.c (cp_is_vtbl_ptr_type): Continue to accept old form. - -Thu Sep 30 11:25:55 1993 Kung Hsu (kung@cygnus.com) - - * cp-valprint.c (cp_is_vtbl_ptr_type): - change vtable field name to __vtbl (pr2695). - - * symtab.c (gdb_mangle_name): fix a bug, to get mangled name right. - -Wed Sep 29 18:34:22 1993 Stu Grossman (grossman at cygnus.com) - - * Makefile.in: Add deps for i386lynx-nat.o and i386lynx-tdep.o to - keep non-gnu makes happy. - -Wed Sep 29 17:20:54 1993 Jeff Law (law@snake.cs.utah.edu) - - * hpread.c (read_hpux_symtab): When a K_END is found for a - K_MODULE, clear the have_module and have_name flags. - -Wed Sep 29 10:52:19 1993 Kung Hsu (kung@cygnus.com) - - * c-valprint.c: to fix virtual table print bug (pr2695). - -Wed Sep 29 10:52:19 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * target.c (target_detach): Call generic_mourn_inferior. - * inflow.c (generic_mourn_inferior): Call flush_cached_frames. - -Tue Sep 28 23:08:59 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * dbxread.c, coffread.c, elfread.c: A few changes to comments. - -Tue Sep 28 18:39:37 1993 Stan Shebs (shebs@rtl.cygnus.com) - - * configure.in: Rename ...-lynx* to ...-lynxos*. - Add m68*-*-lynxos* configuration. - * dbxread.c (coffstab_build_psymtabs): New function, - interfaces coffread.c to dbxread functions. - * coffread.c (coff_symfile_info): Expand to include - dbx_symfile_info slots. - (coff_symfile_init): Init coff_symfile_info struct. - (coff_locate_sections): New functions, finds the stab and stabstr - sections. - (coff_symfile_read): Call coffstab_build_psymtabs if a stab - section is present. - (coff_section_offsets): Replace fake version with real offsets. - -Tue Sep 28 18:00:50 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * infcmd.c (run_stack_dummy): Set the frame in the bp_call_dummy - breakpoint. - -Tue Sep 28 17:53:26 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * config/nm-sysv4.h: Include solib.h. Define SVR4_SHARED_LIBS. - * config/tm-sysv4.h: Don't include solib.h. - * config/xm-sysv4.h: Don't define SVR4_SHARED_LIBS. - * config/i386/i386v4.mt (TDEPFILES): Move solib.o from here... - * config/i386/i386v4.mh (NATDEPFILES): ...to here. - * config/i386/nm-i386v4.h: Include nm-sysv4.h. - * config/m68k/amix.mt (TDEPFILES): Move solib.o from here... - * config/m68k/amix.mh (NATDEPFILES): ...to here. - -Tue Sep 28 09:45:38 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * symmisc.c (print_symbol): Use %02x not %2x for LOC_CONST_BYTES. - - Clean up problems with targets and hosts that have 64 bit longs - and pointers and 32 bit ints. - * breakpoint.c, buildsym.c, c-lang.c, c-valprint.c, ch-lang.c, - ch-valprint.c, core.c, cp-valprint.c, dbxread.c, exec.c, - expprint.c, gdbtypes.c, infcmd.c, language.c, language.h, - m2-lang.c, maint.c, mips-tdep.c, mipsread.c, partial-stab.h, - printcmd.c, remote-vx.c, solib.c, source.c, stack.c, symfile.c, - symmisc.c, symtab.c, valops.c, valprint.c, xcoffexec.c: - Change all printf formats from %x to %lx if outputting an address. - Change la_*_format to use long format. - local_hex_string, local_hex_string_custom now take an unsigned long - argument, change all callers. - * coffread.c (read_coff_symtab): Remove superfluous cast for - complaint output. - * dbxread.c (end_psymtab): Cast MSYMBOL_INFO to long, not int. - * findvar.c, value.h (write_register): Change val to LONGEST. - * gdbtypes.h (struct type): Change `bitsize' to long as - TYPE_FIELD_STATIC_PHYSNAME uses this field as a pointer. - * inferior.h (struct inferior_status): Change type of stop_pc to - CORE_ADDR. - * language.h (local_octal_string, local_octal_string_custom): - Remove prototype, the functions are neither defined nor used. - * mipsread.c (parse_symbol): Use temporary variable for bitsize as - f->bitsize is a long now. - * objfiles.c (add_to_objfile_sections, build_objfile_section_table): - Use unsigned long casts instead of int for abusing sections_end - pointer as integer. - * stack.c (parse_frame_specification): Change type of `args' to - CORE_ADDR for SETUP_ARBITRARY_FRAME. - - * printcmd.c (make_vasize): Allow redefinition via MAKEVA_SIZE. - * mipsread.c (parse_type): Alpha cc now supports the t->continued - bit, update algorithm to match the way the compiler uses it. - -Tue Sep 28 12:05:11 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * utils.c (fprintfi_filtered): Fix comments. - -Mon Sep 27 18:10:08 1993 Stu Grossman (grossman at cygnus.com) - - * coffread.c (read_coff_symtab): Don't call getfilename if there - are no auxents. - -Mon Sep 27 10:22:37 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * symtab.c (find_pc_line): Fix comments. - - * remote-udi.c (udi_mourn): Don't pop target. - -Fri Sep 24 17:25:41 1993 Stu Grossman (grossman at cygnus.com) - - * corelow.c: Add multi thread/process support for core files with - .reg/XXX pseudo-sections. - * i386lynx-nat.c thread.h thread.c: Remove unnecessary core file - support. - -Thu Sep 23 10:49:37 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * remote-udi.c (download): Skip zero length sections. - - * valops.c (search_struct_method, value_struct_elt): - Use (value)-1, not -1, for error. - - * infcmd.c (step_1), infrun.c (wait_for_inferior): Add comments - about SHIFT_INST_REGS. - - * exec.c (exec_file_command): Set text_end based on all code readonly - sections, not just ".text". - - * defs.h, infcmd.c, config/z8k/tm-z8k.h, config/m88k/tm-m88k.h, - config/sh/tm-sh.h, config/h8300/tm-h8300.h, config/h8500/tm-h8500.h, - z8k-tdep.c: Remove all references to ADDR_BITS_SET. - * config/m88k/tm-m88k.h: Define TARGET_WRITE_PC. - - * config/m88k/tm-m88k.h, m88k-tdep.c: Add call function stuff. - -Thu Sep 23 00:13:06 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * config/mips/tm-mips.h (STORE_STRUCT_RETURN): Define as noop as - the pushing of the struct return address is already handled in - mips_push_arguments. - * mips-tdep.c (reinit_frame_cache_sfunc): Fix typo in prototype - declaration. - * mipsread.c (parse_symbol, parse_type, upgrade_type): Add more - sanity checks for corrupt symbol entries to avoid core dumps - reported by benson@odi.com. Obviously Ultrix 4.3A cc now has - the same problems as the OSF/1 alpha cc. - * mipsread.c (parse_lines): Iterate over the range of the compressed - line number entries, the old iteration sometimes failed to stop - and wrote past the end of the LINETABLE. Add sanity check to avoid - the same problem in case the line number info is corrupt. - * mipsread.c (parse_procedure): Adjust pdr for alpha __sigtramp. - * mipsread.c (parse_external, parse_partial_symbols): Ignore stNil - symbols that are produced for statics in .o files and stLocal symbols - that are produced for every section in OSF/1 dynamically linked - executables. - * mipsread.c (psymtab_to_symtab_1): Put out `undefined symbols' - warning only under `verbose on' as there are many undefined symbols - in a dynamically linked executable. - -Wed Sep 22 10:28:06 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config/i960/nindy960.mt: Don't define REMOTE_O; REMOTE_O was - intended only for VxWorks. Remove dcache.o from TDEPFILES now - that we pick it up from the default REMOTE_O. - - * breakpoint.c (bpstat_what): Initialize retval.call_dummy and - retval.step_resume. - - * mips-tdep.c (mips_frame_chain): If frame size zero, return zero. - * rs6000-tdep.c: Add comment about framelessness. - - * remote-nindy.c: Declare ninMemGet and ninMemPut. - -Wed Sep 22 08:02:57 1993 Stu Grossman (grossman at cygnus.com) - - * Makefile.in: Add i386lynx-tdep to the right places. - (TARDIRS): Add gdbserver. - - * exec.c (print_section_info): Print entry point. - * i386lynx-nat.c (i386lynx_saved_pc_after_call): Move into - i386lynx-tdep.c. Add core file support. - * i386lynx-tdep.c: New module for Lynx/386 target dependant code. - * maint.c: Add `maint info sections' command to print info about all - sections that BFD knows about for exec and core files. - * sparc-tdep.c (sparc_push_dummy_frame): Update stack pointer - before putting frame on the stack. Consolidate writes to reduce - traffic for remote debugging. - * config/i386/i386lynx.mh (NATDEPFILES): Remove exec.o. - * config/i386/i386lynx.mt (TDEPFILES): Add exec.o, i386lynx-tdep.o. - * config/i386/nm-i386lynx.h: Add target_pid_to_str(). - * config/i386/tm-i386lynx.h: Remove target_pid_to_str(). - * sparclite/Makefile.in: Add deps to keep Sun make happy. - -Tue Sep 21 17:48:14 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * breakpoint.h, breakpoint.c (bpstat_stop_status): Add new argument - not_a_breakpoint. - * infrun.c (wait_for_inferior): Pass it. Also consolidate the - test of whether we are stepping into a CURRENTLY_STEPPING macro. - -Tue Sep 21 17:22:34 1993 K. Richard Pixley (rich@sendai.cygnus.com) - - * breakpoint.c (bpstat_stop_status), - infcmd.c (step_1), - infrun.c (wait_for_inferior): collapse SHIFT_INST_REGS ifdef - and insert macro. - - * m88k-tdep.c: include ieee-float.h. new global target_is_m88110. - new const struct ext_format_m88110 for float format. - (pic_prologue_code): add braces. - (next_insn): remove unused variable buf. - (frame_find_saved_regs): remove unused variables next_addr, - saved_regs, regnum. - (frame_locals_address): remove unused variables frame, ap. - (frame_args_address): remove unused variables frame, ap. - (push_parameters): add some breaks and a default case. - - * remote-bug.c: remove redundant includes of value.h, target.h, - serial.h. - (bug_open): corrected typo, sr_multi_scan -> gr_multi_scan. - (bug_fetch_register): special case sfip register for m88110. - remove flag bit masking of pc registers. This should be handled - by the ADDR_BITS_* macros. - (bug_store_register): special case sfip register for m88110. - Corrected sprint format for extended registers. - - * config/m88k/tm-m88k.h: white space and comment changes. include - ieee-float.h. expanded to cope with m88110 extended registers. - (R0_REGNUM, XFP_REGNUM, X0_REGNUM): new macros. - (SHIFT_INST_REGS): becomes a real macro. - -Tue Sep 21 17:48:14 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * breakpoint.c (breakpoint_1): Support bp_call_dummy. - -Tue Sep 21 17:06:19 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * elfread.c (record_minimal_symbol_and_info): Guess the section to - use from the type. - * objfiles.c: Include gdb-stabs.h for SECT_* macros. - (objfile_relocate): Relocate textlow and texthigh in psymtabs. - Relocate partial symbols. Check that minimal SYMBOL_SECTION is - nonnegative before using it. - * symtab.h: Adjust section field comment. - - * remote.c (interrupt_query): New function. - (remote_interrupt_twice): Call interrupt_query. - (putpkt, getpkt): If quit_flag is set, call interrupt_query. - (remote_wait): Don't bother with objfile_relocate if the addresses - haven't changed. - (remote_fetch_registers): If we see a packet that doesn't start - with a hex character, fetch a new one. - -Tue Sep 21 11:44:00 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * remote.c, remote-utils.c: Use SERIAL_FLUSH_INPUT after opening it. - - * printcmd.c (print_scalar_formatted): When truncating value we are - going to print as unsigned, handle it generally for any length - less than sizeof (LONGEST), rather than special-casing sizeof (char), - sizeof (short), and sizeof (long). Clarify comment on what this - is for. - - * symfile.c (deduce_language_from_filename): Accept .cxx for C++. - * buildsym.c (start_subfile): Use deduce_language_from_filename - rather than checking for .C or .cc ourself. - -Mon Sep 20 14:53:11 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * defs.h: Declare argument of re_comp as const char *. - - * remote.c, remote-mips.c: Use sr_get_debug not remote_debug. - - * README: Say using bfd from another release doesn't generally work. - -Sat Sep 18 10:13:18 1993 Jim Kingdon (kingdon@poseidon.cygnus.com) - - * mipsread.c (parse_type): Don't complain() if we guessed struct - and it was a union, or vice versa. - - * defs.h (make_cleanup): Change PTR to void * when inside PARAMS. - - Some of the following is in #ifdef CALL_DUMMY_BREAKPOINT_OFFSET. - * breakpoint.h (enum bptype): Add bp_call_dummy. - (struct bpstat_what): Add call_dummy field. - * infrun.c (wait_for_inferior): Deal with it. - * breakpoint.c (bpstat_what): Deal with call dummy breakpoint. - * infcmd.c (run_stack_dummy): Set the call dummy breakpoint. - * config/sparc/tm-sparc.h: Define CALL_DUMMY_BREAKPOINT_OFFSET. - - * remote-sim.h: New file. - * remote-sim.c: Add remote debug feature. Rename stuff to distinguish - interface to simulator from gdb-specific stuff. Other changes. - * remote-sp64sim.c: Renamed to remote-sim.c. - Use sr_get_debug instead of our own sim_verbose/simif_snoop. - Use gnutarget in call to bfd_openr. - Rename simif_* to gdbsim_*. - * config/sparc/sp64sim.mt: Change remote-sp64sim.c to remote-sim.c. - -Fri Sep 17 04:41:17 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * findvar.c (extract_signed_integer): Cast *p to LONGEST before doing - the xor and subtract. Otherwise it will not sign extend if the type - of LONGEST is larger than int. - * cp-valprint.c (cp_print_class_method): Inhibit core dump if - domain is an undefined cross reference. - * valops.c (call_function_by_hand): Set real_pc to correct - value if CALL_DUMMY_LOCATION != ON_STACK. - -Thu Sep 16 20:37:06 1993 Jim Kingdon (kingdon@cirdan.cygnus.com) - - * config/a29k/tm-a29k.h (FRAME_CHAIN): If rsize is zero, return zero. - -Thu Sep 16 13:16:22 1993 Stu Grossman (grossman at cygnus.com) - - * infrun.c (wait_for_inferior): Allow user to single step within - a stack dummy. - -Thu Sep 16 12:34:01 1993 Jim Kingdon (kingdon@cirdan.cygnus.com) - - * dbxread.c (copy_pending): Deal with END NULL. - (process_one_symbol): Add comments about what common_block NULL means. - -Wed Sep 15 14:50:26 1993 Jim Kingdon (kingdon@cirdan.cygnus.com) - - * remote-udi.c, remote-adapt.c, remote-mm.c: Move processor_type - to tm-a29k.h and a29k-tdep.c and make it an enum. - * a29k-tdep.c (a29k_get_processor_type): New function. Fix many - aspects of how we detected the processor type. - * remote-udi.c, remote-adapt.c, remote-mm.c (*_open): Call it - rather than figuring out the type ourselves. - -Thu Sep 16 12:12:59 1993 Stu Grossman (grossman at cygnus.com) - - * sparc-stub.c (_trap_low): Do restore/save sequence after - setting sp to ensure that we load the previous window from the - right place on the stack. - -Thu Sep 16 00:36:32 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * mipsread.c: Many changes for alpha ecoff format: - Correct sizeof(int) == sizeof(long) assumptions. - Replace stParsed hack by putting the parsed types on the pending chain. - Replace mips specific ecoff mapping by ECOFF_REG_TO_REGNUM macro, - provide default for cross debugging. - Swapping the symbol back is no longer needed as the symbol is not - modified anymore. - Add new alpha basic types, handle btTypedef, handle stStaticProc - external symbols . - Update and clean up cross_ref for alpha cc cross ref variations. - Allocate types on the type_obstack to inhibit storage leaks. - * config/mips/tm-mips.h (ECOFF_REG_TO_REGNUM): Define. - * gdbtypes.c (recursive_dump_type): Dump TYPE_TAG_NAME if it is set. - -Tue Sep 14 09:12:17 1993 Jim Kingdon (kingdon@cirdan.cygnus.com) - - * stabsread.c (read_type): Process "s" (size) type attribute. - If type is defined to another type, copy the type. - -Tue Sep 14 18:37:17 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * config/i386/i386v4.mh (NATDEPFILES): Move exec.o from here... - * config/i386/i386v4.mt (TDEPFILES): ...to here. - -Tue Sep 14 12:21:49 1993 K. Richard Pixley (rich@sendai.cygnus.com) - - * Makefile.in (remote_utils_h): add serial.h and target.h. - (main.o, remote-es.o, remote-nindy.o, remote.o): remove target.h - (already in remote_utils_h). - (remote-utils.o): new rule. - - * remote-utils.h: include serial.h. - - * serial.h: ifdef protect from multiple inclusion. - - * remote.c, remote-nindy.c, remote-mon.c, remote-es.c: include - remote-utils.h. - - * remote.c (remote_open), remote-nindy.c (nindy_open, - nindy_files_info), remote-mon.c (general_open), remote-es.c - (es1800_open): use remote-utils facilities for baud rate. - -Tue Sep 14 09:12:17 1993 Jim Kingdon (kingdon@cirdan.cygnus.com) - - * paread.c, coffread.c, elfread.c, dwarfread.c: - Include and before libbfd.h. - - * paread.c: Define BYTES_IN_WORD before including aout/aout64.h. - - * Makefile.in (a29k-tdep.o): Depend on $(defs_h). - * config/a29k/tm-a29k.h (SAVED_PC_AFTER_CALL): Use gr122 not lr0 - if this is a transparent procedure. - -Mon Sep 13 16:06:43 1993 Jim Kingdon (kingdon@cirdan.cygnus.com) - - * remote.c: Define remote_debug to 0 and #if 0 baud_rate. Temporary - hack so this file compiles again. - - * remote-utils.c (gr_multi_scan): Cast return value from alloca. - (gr_multi_scan): #if 0 never-reached return(-1). - - * remote-udi.c (udi_wait): Return inferior_pid not 0. - -Mon Sep 13 14:14:35 1993 K. Richard Pixley (rich@sendai.cygnus.com) - - Collect some remote things into remote-utils. - * remote-utils.[ch]: new files of functions collected from several - different remote targets. - * Makefile.in (REMOTE_O): add remote-utils.o. - (dcache_h, remote_utils_h): new macros. - (HFILES): add $(remote_utils_h). - (ALLDEPFILES): add $(remote_utils_h). - (dcache.o): new rule. - (main.o, remote-bug.o): also depend on $(remote_utils_h). - * target.h (remote_debug): extern moved to remote-utils.h. - * target.c (find_default_run_target, find_core_target): initialize - runable. - (remote_debug): moved to remote-utils.c. - (_initialize_targets): move declaration of user variable - remotedebug to remote-utils.c. - * remote-bug.c: include remote-utils.h rather than dcache.h. - (bug_close, bug_write, bug_write_cr, desc, bug_dcache, timeout, - dev_name, check_open, is_open, readchar, readchar_nofail, - pollchar, expect, expect_prompt, get_hex_digit, get_hex_byte, - get_hex_word, bug_kill, bug_detach, bug_create_inferior, - multi-scan, bug_prepare_to_store, bug_fetch_word, - bug_store_word, bug_files_info, bug_mourn, bug_com, bug_device, - bug_speed): removed and replaced with facilities from - remote-utils.[ch]. - (bug_read_inferior_memory): renamed to bug_read_memory. - (bug_write_inferior_memory): renamed to bug_write_memory. - (bug_xfer_inferior_memory): renamed to bug_xfer_memory. - (get_word): comment out this unused function for now. - (bug_settings, cpu_check_strings): new statics. - (bug_open): rewritten to use gr_open. - (_initialize_remote_bug): remove declarations of commands bug, - device, speed. - * main.c: include remote-utils.h. - (baud_rate): removed to remote-utils.c. - (main): handle baud rate settings using new facilities from - remote-utils. - * defs.h (baud_rate): removed extern. - - m88110 support via bug-197 monitor. - * remote-bug.c (get_reg_name, bug_fetch_register, - bug_store_register): added m88110 extended register support. - (wait_strings): added bug-197 prompt. - (bug_wait): cope with bug-197 prompt. - (start_load): cope with either bug-197 or bug-187 prompt. - -Mon Sep 13 12:53:09 1993 Jim Kingdon (kingdon@cirdan.cygnus.com) - - * inferior.h, infrun.c, thread.c, infcmd.c: Remove all uses of - pc_changed. If it was ever set to a non-zero value, it was before - GDB 2.8. It doesn't seem to have any useful function. - - * defs.h: Don't define NORETURN (see comment). - -Sat Sep 11 10:46:09 1993 Jim Kingdon (kingdon@poseidon.cygnus.com) - - * m88k-nat.c (fill_gregset): Set r31 and sfip. - -Thu Sep 9 10:18:29 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * remote-udi.c (udi_wait, case UDIStdinNeeded): Use a loop calling - getchar() (terminated only on '\n') instead of scanf. Send the - '\n' which terminates it to the remote system. - - More gcc lint: - * exec.c (ignore): Return 0. - * stack.c (return_command): Fetch lazy value directly, not via - VALUE_CONTENTS, to avoid "value computed is not used". - * inflow.c (new_tty): Move osigttou inside #if. - - * remote.c (remote_fetch_registers): If remote reply is short, just - note that fact and keep going (reading extra registers as all bits 0). - (remote_store_registers): Send number of registers that were found - by remote_fetch_registers. - * m68k-tdep.c, config/m68k/tm-m68k.h, config/m68k/tm-*.h: Remove - HAVE_68881. Define CANNOT_STORE_REGISTER if ptrace() can't write - floating registers. - * config/m68k/{tm-m68k-nofp.h,m68k-nofp.mt,tm-m68k-fp.h,m68k-fp.mt}: - Remove, replaced by {tm-m68k-em.h,m68k-em.mt}. - * Makefile.in, configure.in: Change accordingly. - -Thu Sep 9 04:59:03 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * mipsread.c (cross_ref): Allow SGI extended symbol types as cross - reference targets. - * symmisc.c (print_symbol): Use TYPE_TAG_NAME not TYPE_NAME to avoid - printing of identities. - -Wed Sep 8 19:18:27 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * breakpoint.c (breakpoint_1): Deal with step resume breakpoint. - -Wed Sep 8 13:01:10 1993 K. Richard Pixley (rich@cygnus.com) - - Gcc lint. - * config/m88k/tm-m88k.h (frame_find_saved_regs): prototype. - * config/h8300/tm-h8300.h (NUM_REGS): rewrite to avoid nested comment. - * blockframe.c (get_prev_frame_info): initialize address. - * breakpoint.c (bpstat_copy): initialize retval. - (bpstat_stop_status): initialize value_is_zero. - (bpstat_what): initialize bs_class. - (breakpoint_1, mention): add do-nothing case for bp_step_resume. - (break_command_1): initialize cond_end, addr_end, & - canonical_strings_chain. - (enable_breakpoint): initialize save_selected_frame. - * buildsym.c (end_symtab): initialize symtab & linetablesize. - * c-exp.y (parse_number): initialize i. - * c-typeprint.c (c_type_print_varspec_prefix): include - TYPE_CODE_BITSTRING in switch statements and do nothing. - * c-valprint.c (c_val_print): removed unused variable c. - * ch-valprint.c (chill_val_print): removed unused variable eltlen. - * cp-valprint.c (cp_print_class_method): initialize f & j. - * eval.c (evaluate_subexp): initialize pc2, arg1, arg2. - * expprint.c (print_subexp): initialize myprec, assoc, & tempstr. - * findvar.c (value_from_register): initialize first_addr. - * gdbtypes.c (lookup_struct_elt_type): localize use of temporary - variable typename. - * infcmd.c (run_stack_dummy): return zero rather than simple - return. - * infrun.c (wait_for_inferior): initialize stop_sp, prologue_pc. - remove symtab, appears unused. - (restore_selected_frame): return 1. - * mipsread.c (psymtab_to_symtab_1): initialize first_off. - (fixup_sigtramp): initialize b0. - * printcmd.c (do_examine): initialize val_type. - (print_frame_args): initialize b. - * ser-tcp.c (tcp_restore): comment out declaration. Appears - unused. - * ser-unix.c (hardwire_restore): comment out declaration. Appears - unused. - (hardwire_send_break): moved variable status into ifdef - HAVE_SGTTY. - (wait_for): moved variable numfds into ifdef HAVE_SGTTY. - * serial.h: comment change only. - * stabsread.c (rs6000_builtin_type): initialize rettype. - (read_range_type): initialize nbits. - * stack.c (print_frame_info): remove unused variable numargs. - (parse_frame_specification): remove unused variables arg1, arg2, - arg3. - (return_command): initialize return_value. - * symfile.c (cashier_psymtab): initialize pprev. - * symtab.c (find_pc_psymbol): initialize best. - (lookup_symbol): initialize s. - (make_symbol_completion_list): initialize quote_pos. - * thread.c: include command.h. - (thread_info): static declaration removed; unused. - (info_threads_command): fix == vs = typo. - * typeprint.c (whatis_exp): initialize old_chain. - * valprint.c (val_print_string): remove unused variable - first_addr_err. Initialize old_chain. - (_initialize_valprint): white space comment change. - * values.c (show_values): rewrite if statement to avoid empty - body. - (vb_match): remove unused variable fieldtype_target_type. - -Wed Sep 8 10:21:33 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Makefile.in (mipsread.o): Depend on $(bfd_h). - -Tue Sep 7 13:06:44 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * gdbserver/Makefile.in (TAGS): config files are in - $(srcdir)/../config, not $(srcdir)/config. - - * config/pa/tm-hppa.h: Declare target_read_pc and target_write_pc. - (STORE_RETURN_VALUE): Pass the correct offset of the return - register to write_register_bytes. - * hppa-tdep.c: Use target_write_pc if PCOQ_TAIL_REGNUM was not saved. - -Tue Sep 7 14:30:34 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * remote.c (remote_wait): Don't call error. Instead, call warning - inside a loop. User can ^C to get out. - - * config/m68k/tm-m68k.h (FIX_CALL_DUMMY): Changed name of swapping - routine to match BFD name change. - * config/z8k/tm-z8k.h (FIX_CALL_DUMMY): Likewise. - -Mon Sep 6 15:01:57 1993 Jeffrey Wheat (cassidy@cygnus.com) - - * elfread.c: change elf32_symbol_type to elf_symbol_type - -Mon Sep 6 15:43:25 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * remote.c (remote_wait): Added 'W' and 'N' responses. - -Fri Sep 3 08:57:10 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * main.c, utils.c: Add comments about immediate_quit. - - * elfread.c (elf_symtab_read): Don't add symbols starting with ".L" - to minimal symbols. - - * target.c (pop_target): Don't try to deal with the stack becoming - empty. Shouldn't happen and the code that tried was broken. - - * dcache.c: Cast return value from xmalloc. - - * remote.c: Move setting of immediate_quit from remote_open to - remote_start_dummy and set it back to zero when done. - -Thu Sep 2 00:07:36 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * m88k-tdep.c: Remove a bunch of unused #includes. - - * language.h: Add comment about current_language. - - * mips-tdep.c (_initialize_mips_tdep): Change heuristic-fence-post - from var_uinteger to var_zinteger. - - * configure.in: Fix typo (delta88r4 -> delta88v4). - - * config/m88k/xm-delta88.h: Don't include sys/siginfo.h. It was - to make this work on SVR4 before SVR4 had its own configuration, - and it breaks SVR3. - - * config/m88k/tm-delta88v4.h: Define FRAME_CHAIN_VALID_ALTERNATE. - - * config/m88k/delta88v4.h (NATDEPFILES): Remove infptrace.o inftarg.o. - - * config/m88k/xm-dgux.h: Renamed from config/m88k/xm-m88k.h. - * config/m88k/m88k.mh: Use xm-dgux.h. - * config/m88k/xm-m88k.h: New file, with HOST_BYTE_ORDER, - MAKEVA_END and MAKEVA_ARG. - * config/m88k/xm-*.h: Include m88k/xm-m88k.h. - * printcmd.c: Remove __INT_VARARGS_H code; now in xm-m88k.h. - -Wed Sep 1 19:31:28 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * remote-udi.c (udi_wait): Call `warning' not `error'. - - * symtab.c (COMPLETION_LIST_ADD_SYMBOL): If the symbol has a - demangling, don't put the mangled form in the completion list. - - * symtab.c, symfile.c, c-exp.y, ch-exp.y, m2-exp.y, buildsym.c, - symfile.h, stabsread.c, minsyms.c, solib.c, nlmread.c, dwarfread.c - partial-stab.h, symmisc.c, gdbtypes.c: Lint. Remove (or put - inside #if) unused variables and labels. Fix unclosed comment. - Deal with enumeration values unhandled in switch statements. Make - sure non-void functions return values. Include appropriate - headers. - * dbxread.c (elfstab_build_psymtabs): Don't check for unsigned - value < 0. - -Wed Sep 1 14:36:00 1993 K. Richard Pixley (rich@sendai.cygnus.com) - - * i960-tdep.c, ns32k-pinsn.c, remote-adapt.c, xcoffread.c: - index -> strchr. - -Wed Sep 1 11:35:49 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * remote.c: Add comment explaining why dcache is disabled. - (remote_fetch_word, remote_store_word): Make static and #if 0. - They are not called from anywhere. - -Wed Sep 1 14:41:28 1993 K. Richard Pixley (rich@sendai.cygnus.com) - - * arm-tdep.c, convex-tdep.c, convex-xdep.c, dbxread.c, - h8300-tdep.c, h8500-tdep.c, i960-pinsn.c, i960-tdep.c, - infptrace.c, m88k-tdep.c, mips-tdep.c, regex.c, remote-vx.c, - rs6000-tdep.c, xcoffexec.c, xcoffread.c, z8k-tdep.c, - config/arm/tm-arm.h, config/convex/tm-convex.h, - config/gould/tm-np1.h, config/gould/tm-pn.h, - config/m68k/tm-isi.h, config/ns32k/tm-umax.h, - config/pa/tm-hppa.h, config/pyr/tm-pyr.h, - config/rs6000/tm-rs6000.h, config/tahoe/tm-tahoe.h, - config/vax/tm-vax.h: bzero -> memset. - - * regex.c: bcmp -> memcmp. - -Wed Sep 1 11:35:49 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * symtab.c (find_pc_line, find_line_common), - symtab.h (struct linetable), xcoffread.c (arrange_linetable): - Revise comments re linetable sorting. - * buildsym.c (compare_line_numbers): Sort by pc, not by line. - * coffread.c: Tell end_symtab to sort the line table. - - * coffread.c: Re-work a lot of the coff-specific stuff to use stuff - in buildsym.c. This includes coff_finish_block, coff_context_stack, - coff_local_symbols, coff_file_symbols, coff_global_symbols, - coff_end_symtab and coff_add_symbol_to_list. - (read_enum_type): Deal with it now that we have a "struct pending" - not a "struct coff_pending". - - * buildsym.c (end_symtab): Don't realloc subfile->linetable. - -Wed Sep 1 13:12:43 1993 K. Richard Pixley (rich@sendai.cygnus.com) - - * a68v-nat.c, altos-xdep.c, convex-tdep.c, convex-xdep.c, - findvar.c, hppab-nat.c, hppah-nat.c, i386mach-nat.c, - irix4-nat.c, m68k-tdep.c, m88k-tdep.c, mipsread.c, regex.c, - remote-bug.c, remote-hms.c, rs6000-nat.c, rs6000-tdep.c, - sparc-nat.c, stabsread.c, sun3-nat.c, sun386-nat.c, symfile.c, - umax-xdep.c, xcoffread.c, 29k-share/udi/udip2soc.c, - 29k-share/udi/udr.c, config/a29k/tm-a29k.h, config/arm/tm-arm.h, - config/convex/tm-convex.h, config/gould/tm-np1.h, - config/gould/tm-pn.h, config/h8300/tm-h8300.h, - config/h8500/tm-h8500.h, config/i386/tm-i386aix.h, - config/i386/tm-sun386.h, config/i386/tm-symmetry.h, - config/i960/tm-i960.h, config/m68k/tm-news.h, - config/m88k/tm-m88k.h, config/mips/tm-mips.h, - config/ns32k/tm-merlin.h, config/ns32k/tm-umax.h, - config/pa/tm-hppa.h, config/pyr/tm-pyr.h, - config/rs6000/tm-rs6000.h, config/sh/tm-sh.h, - config/tahoe/tm-tahoe.h, config/vax/tm-vax.h, - config/z8k/tm-z8k.h, nindy-share/nindy.c: bcopy -> memcpy. - -Wed Sep 1 05:05:53 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * mipsread.c (parse_partial_symbols): Use language from FDR if it - is unambigous. Patch from ptf@delcam.co.uk (Paul Flinders). - * mipsread.c (ecoff_symfile_info): New struct to hold the global - pending_list. - * mipsread.c (mipscoff_symfile_init, parse_partial_symbols): - Allocate the global pending list and link it to the objfile. - * mipsread.c (is_pending_symbol, add_pending): Use global pending - list from objfile. Allocate pending list entries from the - psymbol_obstack. - * mipsread.c (free_pending): Remove. The pending list is now - freed when the psymbol_obstack is freed. - * mipsread.c (psymtab_to_symtab1): Remove pending list allocation, - the global pending list is used now. - * mipsread.c (parse_partial_symbols): Skip only the first - file indirect entry when building the dependency list. - -Tue Aug 31 15:01:27 1993 K. Richard Pixley (rich@sendai.cygnus.com) - - Break dcache code out of remote.c. - * dcache.h: white space changes only. - * dcache.c: add user settable variable to set whether data caching - is in use. - * remote.c: include dcache.h. removed data caching code which is - now in dcache.c. Compile in data caching again. (data caching - is currently off by default.) - (remote_read_bytes, remote_write_bytes): change second arg to - unsigned char. - (remote_dcache): new static variable. - * Makefile.in (REMOTE_O): add dcache.o. - * config/m88k/m88k.mt (TDEPFILES): removed dcache.o. - - Break dcache code out of remote-nindy.c. - * remote-nindy.c: removed dcache code. Changed callers to use new - conventions. include dcache.h. - (nindy_dcache): new static variable. - * config/i960/nindy960.mt (TDEPFILES): added dcache.o. - - Break dcache code out of remote-bug.c into dcache.[hc]. - * Makefile.in (dcache_h): new macro. - (HFILES): added $(dcache_h). - (ALLDEPFILES): added dcache.c. - (dcache.o): new rule. - (remote-bug.o): now depends on $(dcache_h). - * remote-bug.c: include dcache.h. remove externs for insque and - remque, add extern for bcopy. Prototype bug_close, - bug_clear_breakpoints, bug_write_cr. dcache code moved to - dcache.[hc]. Changed dcache calling convention to include an - initial DCACHE argument. - (bug_dcache): new static variable. - (bug_read_inferior_memory): change second arg to - unsigned char. - * dcache.[ch]: new files. - * config/m88k/m88k.mt (TDEPFILES): add dcache.o. - -Tue Aug 31 10:33:13 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * c-typeprint.c (c_print_type_base): Treat show = 0 just like - show < 0. The only case where we had been distinguishing is that - show = 0 used to print "struct " or "enum " instead of - "struct {...}" or "enum {...}" which seems clearly wrong. - -Mon Aug 30 17:51:32 1993 K. Richard Pixley (rich@sendai.cygnus.com) - - * configure.in: recognize m88110 as an m88k. - -Mon Aug 30 16:07:59 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * valops.c (call_function_by_hand): If we discard cleanups, call - bpstat_clear (&inf_status.stop_bpstat). - -Mon Aug 30 12:47:46 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * stabsread.h, dbxread.c (end_psymtab): Return NULL if the psymtab - was empty and thrown away. - * mipsread.c (parse_partial_symbols): Do not add empty psymtabs to - dependency list, skip self dependencies. - * mipsread.c (parse_fdr): Removed, obsolete. - * mipsread.c (parse_lines): Check for cbLine being zero, not - cbLineOffset. - * mipsread.c (struct symloc): Add pst_language. - * mipsread.c (parse_partial_symbols): Set up proper language for - header files, save it in pst_language for psymtab_to_symtab_1. - * mipsread.c (psymtab_to_symtab_1): Use pst_language. - -Mon Aug 30 10:48:06 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * configure.in: Fix typo m88*-motorola-svr4* -> sysv4*. - -Fri Aug 27 17:09:19 1993 Ken Raeburn (raeburn@cambridge.cygnus.com) - - * paread.c: Include som.h instead of libhppa.h. (From Utah.) - -Fri Aug 27 09:30:40 1993 Jim Kingdon (kingdon@deneb.cygnus.com) - - * symmisc.c (dump_symtab): Use catch_errors around print_symbol. - Change calling sequence of print_symbol to fit catch_errors. - - * mips-tdep.c: Call reinit_frame_cache every time the user does - "set heuristic-fence-post". - - * gdbserver/low-sun3.c: New file. - * gdbserver/Makefile.in, config/m68k/sun3.mh: Change accordingly. - - * Rename files for 14-character limits: - gdbserver/remote-gutils.c -> gdbserver/utils.c - gdbserver/remote-inflow.c -> gdbserver/low-lynx.c - gdbserver/remote-inflow-sparc.c -> gdbserver/low-sparc.c - gdbserver/remote-server.c -> gdbserver/server.c - remote-monitor.c -> remote-mon.c - * Makefile.in, gdbserver/Makefile.in, gdbserver/configure.in, - config/m68k/monitor.mt, config/i386/i386lynx.mh, - config/sparc/sun4os4.mh: Change accordingly. - * gdbserver/Makefile.in: Remove more junk inherited from gdb Makefile. - -Thu Aug 26 14:32:51 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * infcmd.c, inferior.h (run_stack_dummy): If we stop somewhere - besides the dummy, return 1 rather than calling error(). - Let caller print the error message. Remove name argument. - * valops.c (call_function_by_hand): Deal with changes to calling - sequence of run_stack_dummy. Discard restore_inferior_status cleanup - if run_stack_dummy returns 1. - - * Version 4.10.2. - - * config/mips/tm-mips.h (EXTRACT_STRUCT_VALUE_ADDRESS): - Get struct return address from v0, not a0. - - * infrun.c (restore_inferior_status): Use catch_errors when - restoring selected frame. - -Wed Aug 25 21:52:25 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * infrun.c (save_inferior_status, restore_inferior_status): - Save and restore the registers too. - * inferior.h (struct inferior_status): Add "registers". - -Tue Aug 24 00:36:17 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * dbxread.c (end_psymtab): Clean up comment. - - * frame.h, symtab.h, findvar.c (read_var_value): Change basereg - support to use LOC_BASEREG rather than SYMBOL_BASEREG_VALID. - * dwarfread.c: Use LOC_BASEREG where appropriate. - * Various: Support LOC_BASEREG and LOC_BASEREG_ARG. - - * coffread.c (init_lineno, init_stringtab): Don't check whether - xmalloc returned NULL. - - * config/vax/xm-vaxult.h: Define NO_PTRACE_H. - - * target.c, target.h: Add "set remotedebug" command. - * remote-bug.c, remote.c, remote-mips.c: Remove "set remotedebug" and - "set m88ksnoop" options and use generic "set remotedebug" instead. - * NEWS: Describe this change. - -Mon Aug 23 20:26:22 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * buildsym.h: Remove declaration of dbxread.c functions. - * stabsread.h: Group together dbxread.c functions. - Move elfstab_build_psymtabs here from symfile.h. - Declare pastab_build_psymtabs. - * elfread.c, paread.c: Include stabsread.h (for stabsread_new_init - declaration, etc). - -Mon Aug 23 17:16:23 1993 K. Richard Pixley (rich@sendai.cygnus.com) - - * remote-bug.c: rename quiet to bug88k_snoop. - (double_scan, multi_scan): generalize double_scan into a scan - for multiple patterns. Rename to multi_scan. - (bug_wait, bug_write_inferior_memory): adapt to use the new - multi_scan in order to catch and represent target bus errors. - (bug_scan): currently unused, so comment out. - (bug_quiet): removed. Replaced with a standard user settable boolean. - - * m88k-tdep.c: remove include of sys/dir.h. Appears unnecessary - and isn't available on solaris. - -Mon Aug 23 14:56:42 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config/m88k/{delta88v4.mt,delta88v4.mh}: New files - * config/m88k/delta88.mh: Fix comment. - * config/m88k/tm-delta88.h: Remove unused BCS define. - * config/m88k/{tm-delta88v4.h,xm-delta88v4.h,nm-delta88v4.h}: - New files. - * configure.in: Recognize m88*-motorola-sysv4*. - * m88k-nat.c: Always include sys/types.h; don't depend on USG. - -Mon Aug 23 12:57:42 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * mipsread.c (parse_symbol, parse_type, cross_ref): Pass name of - symbol as an argument and use it in complaints. - * symmisc.c (dump_psymtab): Dump filenames of dependencies. - -Mon Aug 23 1993 Sean Fagan (sef@cygnus.com) - and Jim Kingdon (kingdon@cygnus.com) - - Add NetBSD support: - * configure.in: Recognize netbsd. - -Sun Aug 22 22:50:32 1993 Jeff Law (law@snake.cs.utah.edu) - - * hpread.c (get_textlow): Don't go past a K_END when looking for a - K_FUNCTION. Avoids losing on source files with no functions. - -Fri Aug 20 14:01:39 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * remote-nindy.c: Remove unused include of sys/ioctl.h. - - * frame.h, symtab.h: Revise comments regarding baseregs. - -Fri Aug 20 15:07:05 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * mipsread.c (parse_partial_symbols, psymtab_to_symtab_1): - Set language for psymtab and symtab. - * mipsread.c (new_symbol): Set language and initialize demangled - name for symbol. - * symmisc.c (print_symbol): Use SYMBOL_SOURCE_NAME when printing - the symbol type. - * symtab.c (decode_line_1): Inhibit coredumps with cfront executables. - -Fri Aug 20 14:01:39 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Move KERNEL_U_ADDR from xm-hp300bsd.h to nm-hp300bsd.h and make - it conditionalized on 4.3 vs. 4.4. - * config/m68k/nm-hp300bsd.h: Move REGISTER_U_ADDR out of 4.3 and - 4.4 sections; it was identical and now works for 4.4. - - * mips-tdep.c (is_delayed): Use INSN*BRANCH* not ANY_DELAY. - - * printcmd.c (MAKEVA_END): Update this version to use "aligner". - -Thu Aug 19 22:08:09 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * config/vax/tm-vax.h (BELIEVE_PCC_PROMOTION): Define. - * mipsread.c (parse_symbol, parse_type, cross_ref): Handle corrupt - file indirect entries with complaints instead of core dumps. Remove - complaint for stTypedef within aggregates. - -Thu Aug 19 17:58:39 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * coffread.c (process_coff_symbol): Ignore tagnames like .0fake. - - * coffread.c (coff_read_enum_type): #if 0 out code which changes - enum {FALSE, TRUE} into boolean. - - * config/m68k/delta68.m{t,h}: Use nm-delta68.h, etc. not - non-existent files nm-delta.h, etc. - * config/m68k/tm-delta68.h: Define CANNOT_STORE_REGISTER. - * delta68-nat.c: Add "[0]" in offsetof argument. - * delta68-nat.c (_initialize_kernel_u_addr): Don't try to set up - nl with initializer, just assign to it. Check n_scnum field on - return. - -Wed Aug 18 21:42:52 1993 Jeff Law (law@snake.cs.utah.edu) - - * hpread.c (read_hpux_symtab): Call SET_NAMESTRING for K_MODULE - debug symbols. - -Wed Aug 18 12:03:00 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * printcmd.c (print_address), values.c (value_as_pointer): Don't - use ADDR_BITS_REMOVE. - * defs.h: Try to clarify comment about ADDR_BITS_REMOVE. - - * blockframe.c (block_innermost_frame): Uncomment. - Return NULL if passed NULL. - * frame.h: Declare it. - * expression.h (union exp_element): Add field block. - * parse.c (write_exp_elt_block): New function. - * expression.h (OP_VAR_VALUE): Now takes additional struct block *. - * *-exp.y: Write block for OP_VAR_VALUE. - * eval.c, expprint.c, parse.c: Deal with block for OP_VAR_VALUE. - * valops.c, value.h (value_of_variable), callers: - Add second argument, for block. - - * main.c (gdb_readline): If we read some characters followed by EOF, - return them rather than returning NULL. - -Tue Aug 17 11:14:25 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * mips-tdep.c: Remove unused #ifndef NUMERIC_REG_NAMES and add comment. - -Tue Aug 17 15:10:04 1993 K. Richard Pixley (rich@sendai.cygnus.com) - - * config/m88k/tm-m88k.h: Fix typo in comment. - (FP_REGNUM): define in terms of SP_REGNUM - rather than by absolute number. Also clearly comment that this - is a convenient lie in order to decrease future confusion. - (ACTUAL_FP_REGNUM): new macro for FP. - (FRAME_CHAIN_VALID): removed. Standard default works fine. - * m88k-tdep.c (frame_chain_valid): redundant, so removed. - (NEXT_PROLOGUE_INSN): removed unused fourth arg, fixed all - callers. - (read_next_frame_reg): declare static. - (examine_prologue): removed unused variabel insn2, rename insn1 - to insn, rewrote comment about finding fp, sp, etc. set frame_fp - based on ACTUAL_FP_REGNUM rather than FP_REGNUM which is - actually a scammed alias for SP_REGNUM on m88k. - - * frame.h: fixed typo in comment. - -Tue Aug 17 11:14:25 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * 29k-share/udi/udiphcfg.h: Always include udiphunix.h not udiphdos.h. - - * complaints.c (complain): fflush (stdout) after output. - -Tue Aug 17 01:43:55 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * blockframe.c, frame.h (sigtramp_saved_pc): New routine to fetch - the saved pc from sigcontext on the stack for BSD signal handling. - * config/i386/tm-i386bsd.h (SIGTRAMP_START, SIGTRAMP_END, FRAME_CHAIN, - FRAMELESS_FUNCTION_INVOCATION, FRAME_SAVED_PC, SIGCONTEXT_PC_OFFSET): - Define to make backtracing through sigtramp work. - * config/vax/tm-vax.h (SIGTRAMP_START, SIGTRAMP_END, TARGET_UPAGES, - FRAME_SAVED_PC, SIGCONTEXT_PC_OFFSET): Ditto. - -Mon Aug 16 13:52:14 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * main.c (cd_command): If current_directory on entry is "/", then - don't append an extra slash. - Don't assume that /../.. means /. - - * target.c (target_xfer_memory): Clear errno before calling - to_xfer_memory. - - * stack.c (frame_info, print_frame_info): Add comment about using - the starting source line number on a line boundary if backtracing - through sigtramp. - -Mon Aug 16 09:52:33 1993 Jeff Law (law@snake.cs.utah.edu) - - * hpread.c: Add U Utah contribution notice. Add TODO list. - (hp_type_lookup): Use TYPE_NAME and TYPE_TAG_NAME. - (process_one_debug_symbol): Likewise. - -Mon Aug 16 02:56:01 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * blockframe.c (create_new_frame, get_prev_frame_info): - Use the function name when calling IN_SIGTRAMP. - * config/m68k/tm-m68k.h (SIG_PC_FP_OFFSET, SIG_SP_FP_OFFSET): - Define for correct handling of bachtraces through _sigtramp. - * m68k-tdep.c (m68k_find_saved_regs): Adjust saved sp for fake - sigtramp frames. - * mipsread.c (parse_type): Handle corrupt TIR info with complaint - instead of core dump. - * mipsread.c (parse_partial_symbols): Put static symbols into the - mimimal symbol table, use proper mst_types for all minimal symbols. - * stack.c (frame_info, print_frame_info): Use the starting source - line number on a line boundary if backtracing through sigtramp. - -Fri Aug 13 14:37:05 1993 K. Richard Pixley (rich@sendai.cygnus.com) - - * remote-bug.c: include gdbcmd.h. - (sleep, remque, insque): forward decls added. - (bug_fetch_registers, bug_store_registers): forward decls - removed. - (bug_read_inferior_memory, bug_write_inferior_memory): forward - decls added. - (srec_frame, srec_max_retries, srec_bytes, srec_echo_pace, - srec_sleep, srec_noise): new static variables for user settable - options. Mostly these are for debugging and tuning. I don't - expect them to stay user settable options for long. - (timeout): change default to 4 seconds. - (check_open): declare funtion static, force return value. - (readchar_nofail): if timeout, then say so if not being quiet. - (pollchar, double_scan, bug_scan, bug_srec_write_cr, - start_load): new functions. - (bug_wait): rewritten to use double scan. - (expect): while (1) -> for (;;) - (get_hex_digit): rewrite if condition to avoid gcc complaints. - (bug_load, bug_create_inferior, bug_open, bug_store_register): - removed unused variables. - (bug_load): replaced DELTA macro with user settable srec_frame - variable. Other minor lint. - (find_end_of_word, is_baudrate_right, set_rate, not_bug_wait, - gethex, timed_read, translate_addr, bug_before_main_loop): - unsused and removed. - (bug_resume): add missing first arg, pid. - (get_reg_name): use ip rather than cr04. - (bug_write, bug_write_cr, but_clear_breakpoints, bug_quiet): - declare type, args, and explicitly return. - (bug_store_register): straighten out the ip vs cr04 confusion. - (bug_write_inferior_memory): rewrite to cope with errors while - downloading s-records. - (bug_read_inferior_memory): declare static. - (bug_clear_breakpoints): expect nobr before prompt. - (_initialize_remote_bug): add initializations for srec-bytes, - srec-max-retries, srec-frame, srec-noise, srec-sleep, - srec-echo-pace. - - * Makefile.in (remote-bug.o): new rule. - (ALLDEPFILES): added remote-bug.c - - * remote-hms.c (hms_wait): use -1 for timeout's which means block - forever rather than 99999. - - * ser-unix.c (get_tty_state): if a descriptor is not a tty, then - simply save encode this fact as the process group and return - success rather than an error. - (set_tty_state): if process group is -1, do not reset the - process group. - (hardwire_reachar): comment change. - - * serial.h: comment change. - - * config/m88k/tm-m88k.h: comment change to remove embedded - comment. - (SKIP_PROLOGUE): skip_prologue returns a value which is expected - to reset the pc argument. So reset it. - -Fri Aug 13 10:15:24 1993 Fred Fish (fnf@deneb.cygnus.com) - - * Makefile.in (VERSION): Bump to 4.10.1 after release and cvs - tagging. - -Thu Aug 12 20:40:14 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * gdbserver/Makefile.in: Use GDBSERVER_LIBS and - GDBSERVER_DEPFILES. Also remove much (but not all that could be - removed) crud inherited from gdb Makefile.in. - * config/i386/i386lynx.mh, config/sparc/sun4os4.mh: Define GDBSERVER_*. - * gdbserver/README: Say it works on Sun and change configuration - instructions slightly. - -Wed Aug 11 18:56:59 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) - - * config/i386/i386v4.mh: use -lsocket and -lnsl, for remote - targets that use BSD style network connections - -Wed Aug 11 17:54:24 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * remote-{monitor,bug}.c: Make bug_ops not static (forward declaration - of statics doesn't work with SunOS4 /bin/cc). - Rename the occurrence in remote-monitor.c to monitor_bug_ops. - -Tue Aug 10 13:07:14 1993 Jim Kingdon (kingdon@deneb.cygnus.com) - - * blockframe.c (find_pc_partial_function), - mips-tdep.c (find_proc_desc): Deal with "pathological" case. - -Tue Aug 10 14:50:30 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * utils.c (wrap_here): Allow indent to be NULL. - (fputs_filtered): Don't check for null wrap_indent (wrap_here now - guarantees that it isn't, and anyway we were only checking one out - of the two places we dereferenced it). - - * objfiles.h (struct objfile): Clean up comments for - {obj,sym}_private to clarify what they are private to. - -Mon Aug 9 16:45:00 1993 Stan Shebs (shebs@rtl.cygnus.com) - - * stabsread.c, buildsym.c (hashname): Moved function to - buildsym.c, as suggested in the sources. - -Mon Aug 9 09:53:45 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * remote-udi.c: Make udi_ops extern rather than trying forward - declaration of a static variable. - - * hppab-nat.c: Define ptrace to call_ptrace and pass the 5th arg - there, rather than using an ANSI C specific macro. - - * 29k-share/udi/udr.c: Include fcntl.h not sys/fcntl.h. Also put - sys/types.h near the top (just on general principles). - - * environ.c (set_in_environ): Remove G960BASE and G960BIN; they are - no longer used. - - * gdbcore.h: New variable gnutarget. - * core.c: Add commands to set and show it. - * Callers to bfd_*open*: Pass gnutarget instead of NULL as target. - * environ.c (set_in_environ): For GNUTARGET, use set_gnutarget not - putenv. - - * symtab.c (decode_line_1): Give error on unmatched single quote. - -Sun Aug 8 13:59:49 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * ser-unix.c (hardwire_send_break) [HAVE_SGTTY]: Use select not usleep. - - * remote.c: Add comments about 'd', 'r', and unrecognized requests. - - * inflow.c (terminal_init_inferior): Don't muck with tty state if - gdb_has_a_terminal() is false. - -Sun Aug 8 10:07:47 1993 Fred Fish (fnf@cygnus.com) - - * dwarfread.c (record_minimal_symbol): Remove prototype and - function. - * dwarfread.c (add_partial_symbol): Remove code to add minimal - symbols and remove comment about limitations. Experiments show - that now that gdb handles the ELF symtab better for creating - minimal symbols, that no additional information is added by - examining the DWARF information, and in fact, given the - limitations, the DWARF code was actually making things worse. - -Sat Aug 7 10:59:03 1993 Fred Fish (fnf@deneb.cygnus.com) - - * elfread.c (elf_symtab_read): Properly sort out the bss symbols - from the data symbols and give them the correct minimal_symbol_type. - Add file static symbols to the minimal symbol table, not just - global symbols. Add absolute symbols as well (like _edata, _end). - Redo stabs-in-elf special symbol handling now that file static - symbols are entered into the into the minimal symbol table. - * dwarfread.c (add_partial_symbol): Add comment about limitations - of DWARF symbols for distinquishing data from bss when adding - minimal symbols. Add file local symbols to minimal symbols. - -Thu Aug 5 08:58:58 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * ser-go32.c: Define job_control variable. - -Thu Aug 5 15:56:13 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) - - * configure.in: z8k-coff is the same as z8k-sim - -Thu Aug 5 08:58:58 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * 29k-share/udi/udip2soc.c: Include sys/types.h before sys/file.h. - - * config/i386/tm-i386bsd.h (NUM_REGS): There are only 10, not 11. - - * inflow.c: Put all uses of F_GETFL and F_SETFL in #ifdef F_GETFL. - - * 29k-share/udi/udip2soc.c: Include fcntl.h not sys/fcntl.h. - -Wed Aug 4 18:32:12 1993 Fred Fish (fnf@cygnus.com) - - * inflow.c (pass_signal): Signal handlers take one int arg; - supply an unused one to make it type compatible as an arg to - signal(). - -Tue Aug 3 18:34:14 1993 Ian Lance Taylor (ian@cygnus.com) - - * config/mips/tm-mips.h: Include bfd.h before coff/sym.h. - -Tue Aug 3 15:34:57 1993 Fred Fish (fnf@cygnus.com) - - * Makefile.in (ALLCONFIG): Add config/i386/i386nw.mt, - config/m68k/delta68.mh, config/m68k/delta68.mt, - config/m68k/dpx2.mh, config/m68k/dpx2.mt, config/mips/riscos.mh, - config/mips/news-mips.mh. - * Makefile.in (ALLPARAM): Add config/i386/nm-symmetry.h, - config/i386/tm-i386nw.h, config/m68k/nm-delta68.h, - config/m68k/tm-delta68.h, config/m68k/xm-delta68.h, - config/m68k/nm-dpx2.h, config/m68k/tm-dpx2.h, - config/m68k/xm-dpx2.h, config/mips/xm-makeva.h. - * Makefile.in (ALLDEPFILES): Add dpx2-nat.c. - -Tue Aug 3 12:02:09 1993 Ian Lance Taylor (ian@cygnus.com) - - * mipsread.c: Updated for BFD ECOFF changes. Now gets the - swapping routines and external structure sizes via the - ecoff_backend information. No longer includes coff/mips.h. - -Tue Aug 3 10:58:04 1993 Fred Fish (fnf@cygnus.com) - - * Makefile.in (SFILES): Add thread.c - -Tue Aug 3 10:21:58 1993 Doug Evans (dje@canuck.cygnus.com) - - * remote-sp64sim.c (simif_create_inferior): Add FIXME regarding - sim_set_args return code. - -Mon Aug 2 16:35:31 1993 K. Richard Pixley (rich@sendai.cygnus.com) - - * Makefile.in (VERSION): bumped to 4.9.4. - - * remote-monitor.c: updated copyright. - (bug_ops, monitor_desc): now static. - (monitor_desc): in several places, check and/or set to NULL. - - * remote-hms.c (hms_files_info): Add the appropriate items where - missing in the printf call. - - * remote-bug.c: new file for m88k bug support. - - * config/m88k/m88k.mt (TDEPFILES): added remote-bug.o. - -Mon Aug 2 14:22:09 1993 Steve Chamberlain (sac@phydeaux.cygnus.com) - - * h8300-tdep.c: Use new variable h8300hmode. - -Mon Aug 2 12:06:00 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * valops.c (typecmp): If we are passing a non-reference to a function - which takes a reference, pass the address. - (value_arg_coerce): Don't use COERCE_ENUM; we don't want to dereference - references here. - - * thread.c (thread_switch): Define as static. - (add_thread): Cast return value from xmalloc. - - * gdbtypes.c (fill_in_vptr_fieldno): Call check_stub_type. - * gdbtypes.{c,h}: Improve comments on vptr_fieldno. - -Mon Aug 2 11:58:52 1993 Fred Fish (fnf@deneb.cygnus.com) - - * README: Elaborate on gdb C++ support and cfront support. - -Mon Aug 2 11:30:57 1993 Stu Grossman (grossman at cygnus.com) - - * i386lynx-nat.c, thread.c, thread.h: Update copyrights. - -Mon Aug 2 12:06:00 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Makefile.in (ALLDEPFILES): Add i386lynx-nat.c. - -Mon Aug 2 08:42:50 1993 Stu Grossman (grossman at cygnus.com) - - * gdbserver/remote-inflow.c (create_inferior): Fix comments, and - error msg. Setup seperate process group for child. - * (write_inferior_memory): Sleep for 1 second and retry on ptrace - failure. - -Sun Aug 1 22:58:18 1993 Stu Grossman (grossman at cygnus.com) - - * config/i386/i386lynx.mh (NATDEPFILES): Drop coredep (for now). - * config/i386/nm-i386bsd.h: Protect from multiple inclusion. - * config/i386/nm-i386lynx.h: Lotsa new host porting stuff. - * config/i386/tm-i386lynx.h: Define SAVED_PC_AFTER_CALL and - target_pid_to_str. - - * Makefile.in (CLIBS): Reorder to make Lynx ld happy. - * (HFILES): New file thread.h. - * (OBS): New file thread.c. - * configure.in: Host config for Lynx/386. - * fork-child.c (fork_inferior): Call init_thread_list(). - * infrun.c (resume): Add pid to invocation of target_resume(). - * (wait_for_inferior): Pay attention to pid from target_wait(). - Multi-threading code now uses this to determine what to do. - * inftarg.c (child_wait): Conditionalize based on CHILD_WAIT macro. - Use target_pid_to_str() macro throughout when printing pid. - * inferior.h (child_resume): Add pid to prototype. - * hppab-nat.c hppah-nat.c infptrace.c (child_resume): Pass in pid as - argument, instead of using inferior_pid. - * procfs.c (procfs_resume): Pass in pid as argument. Ignored for - now. Use target_pid_to_str() macro throughout for printing process id. - * remote-adapt.c (adapt_resume): Pass in pid as argument. - * remote-eb.c (eb_resume): Pass in pid as argument. - * remote-es.c (es1800_resume): Pass in pid as argument. - * remote-hms.c (hms_resume): Pass in pid as argument. - * remote-mips.c (mips_resume): Pass in pid as argument. - * remote-mm.c (mm_resume): Pass in pid as argument. - * remote-monitor.c (monitor_resume): Pass in pid as argument. - * remote-nindy.c (nindy_resume): Pass in pid as argument. - * remote-sa.sparc.c (remote_resume): Pass in pid as argument. - * remote-sim.c (rem_resume): Pass in pid as argument. - * remote-sp64sim.c (simif_resume): Pass in pid as argument. - * remote-st.c (st2000_resume): Pass in pid as argument. - * remote-udi.c (udi_resume): Pass in pid as argument. - * remote-vx.c (vx_resume): Pass in pid as argument. - * remote-z8k.c (rem_resume): Pass in pid as argument. - * remote.c (remote_resume): Pass in pid as argument. - * solib.c (solid_create_inferior_hook): Pass inferior_pid to - target_resume(). - * target.c (normal_pid_to_str): New routine to print out process - ID normally. - * target.h (struct target_ops): Add pid to prototype at - to_resume(). (target_resume): Add pid argument. - * (target_pid_to_str): Default definition for normal type pids. - * thread.h, thread.c: New modules for multi thread/process control. - -Sun Aug 1 13:02:42 1993 John Gilmore (gnu@cygnus.com) - - * README: Say that bug-gdb is also the place to send requests - for help with GDB. - -Sun Aug 1 09:42:13 1993 Fred Fish (fnf@cygnus.com) - - * Makefile.in (make-proto-gdb-1): Use -f opt on rm of Makefile. - * h8500-tdep.c: Add parens around a few macro args. - -Fri Jul 30 15:43:49 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * TODO: Remove items about unix-to-unix/rapp debugging (now we - have gdbserver), moving xm files to subdirectory, ptype yylval, - and file-local symbols. - - * gdbtypes.h: Improve comments about C++ methods. - -Fri Jul 30 14:16:32 1993 Fred Fish (fnf@deneb.cygnus.com) - - * c-exp.y: Add missing 5th arg for one call to lookup_symbol, cast - NULL in all other calls to correct pointer types. - -Fri Jul 30 15:43:49 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - From Jeffrey Law: - * tm-hppa.h (TARGET_WRITE_PC): Define. - * hppa-tdep.c (hppa_fix_call_dummy): If in a syscall, - then return the address of the dummy itself rather than - the address of $$dyncall. - (target_write_pc): New function to store a new PC. - -Fri Jul 30 12:51:27 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - and Jim Kingdon (kingdon@cygnus.com) - - * breakpoint.c (breakpoint_re_set_one): Always reparse breakpoint - conditions, they might contain symbol table references. - -Fri Jul 30 12:51:27 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * mipsread.c (parse_symbol): Handle opaque struct definitions and - type naming for stTypedef symbols. - -Fri Jul 30 14:44:21 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * c-exp.y (yylex): Detect C++ nested types. - -Fri Jul 30 11:07:37 1993 Doug Evans (dje@canuck.cygnus.com) - - * sp64-tdep.c (sparc64_frame_chain, sparc64_frame_saved_pc): Deleted. - (dump_ccreg, sparc_print_register_hook): New fns. - * remote-sim.h: New file. - * remote-sp64sim.h (sim_*): External fns. (simif_*): Internal fns. - - * config/sparc/sp64.mt: New file. - * config/sparc/tm-sp64.h (FRAME_CHAIN, FRAME_SAVED_PC): Deleted. - (PRINT_REGISTER_HOOK): Call new fn sparc_print_register_hook. - -Fri Jul 30 10:15:01 1993 Fred Fish (fnf@deneb.cygnus.com) - - * Makefile.in (ALLCONFIG): Add config/i386/ptx.mh - -Fri Jul 30 08:58:01 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - From J. Law: - * infcmd.c (read_pc): Remove PA specific code. - * tm-hppa.h (TARGET_READ_PC): Define. - * hppa-tdep.c (target_read_pc): New function. - - * symtab.c (gdb_mangle_name): Deal with it if type lacks a name. - -Fri Jul 30 07:36:53 1993 Fred Fish (fnf@deneb.cygnus.com) - - * NEWS: Add note that DEC alpha support is host only, not native. - * README: Emphasize that C++ support works best with GNU C++ and - stabs debugging format. - * delta68-nat.c: Add missing FSF copyright. - -Fri Jul 30 08:58:01 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * paread.c (pa_symtab_read): Put file-local symbols in minimal symbols. - * hppa-tdep.c (frame_chain_valid): Check that our function has the - same address as _start, not that it must be the same symbol. - -Fri Jul 30 00:18:40 1993 Fred Fish (fnf@deneb.cygnus.com) - - * Makefile.in (ALLDEPFILES): Add delta68-nat.c - * Makefile.in (delta68-nat.o): Add dependency. - -Thu Jul 29 12:09:46 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * value.h (COERCE_ENUM): Use COERCE_REF to coerce refs; value_ind - was adequate in gdb 3.5 but not now. - - * valops.c (typecmp): An array in t2 matches a pointer in t1. - - * valops.c (typecmp): When comparing type1& to type2, compare - type1 and type2 as leniently as if we were comparing type1 to - type2. - - * cp-valprint.c (cplus_print_value): Don't dump core if the - baseclass doesn't have a name. - * values.c (vb_match): New function, which finds the virtual - base class pointer even if the types are nameless. - (baseclass_{addr,offset}): Use it. - - * hppa-tdep.c: Make "maintenance print unwind" command from old - "unwind" command. - - * remote-udi.c: Remove udi_timer, call to siginterrupt, and associated - obsolete junk which apparently had been copied from the - pre-serial.h remote.c, but which is no longer used. - -Thu Jul 29 12:36:20 1993 Fred Fish (fnf@deneb.cygnus.com) - - * Makefile.in (NONSRC): Need 29k-share/README, not - 29k-share/udi/README. - -Thu Jul 29 12:09:46 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * paread.c (pa_symfile_init): If error reading string table, don't - use errno in cases where it hasn't been set. - - * ser-unix.c (gdb_setpgid): Pass our pid, not 0, to setpgid. - - * remote-monitor.c (_initialize_monitor): Comment out use of - connect_command, since connect_command itself is commented out. - - * remote-monitor.c (generic_open): Parse arguments the same way - as remote.c. - - * hppa-tdep.c (pc_in_linker_stub): Fix unclosed comments. - -Wed Jul 28 13:19:34 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config/mips/xm-mips.h: Define HAVE_TERMIOS. - - * dbxread.c (record_minimal_symbol): Don't put gcc_compiled or - __gnu_compiled* symbols into the minimal symbols. - -Wed Jul 28 08:26:58 1993 Ian Lance Taylor (ian@cygnus.com) - - * remote-mips.c (_initialize_remote_mips): Added "timeout" and - "retransmit-timeout" variables to set mips_receive_wait and - mips_retransmit_wait, respectively. - -Wed Jul 28 03:58:58 1993 (pes@regent.e-technik.tu-muenchen.de) - - * symmisc.c (dump_msymbols): Handle new mst_file_* types. - -Tue Jul 27 12:07:38 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * remote-udi.c: Remove old comment about download not implemented. - - * serial.h, ser-{unix,go32,tcp}.c: Add flush_input and send_break. - * nindy-share/*, remote-nindy.c: Extensive hacking to make it - conform to GDB conventions like using memcpy not bcopy, serial.h, - etc. This is to make it host on Solaris, AIX, etc. - * Makefile.in: Reflect removed nindy-share files. - * config/i960/nindy960.mt (TDEPFILES): Remove ttybreak.o. - - * stack.c (print_frame_info): Revise comment about `pathological' - case (there was a wrong FIXME about text labels; also asm() can - trigger this as well as versions of ar which truncate .o names). - - * buildsym.c (start_subfile): If a .c file includes a .C file, set - the language of both of them to C++. - - * config/sparc/xm-sun4os4.h: Define MEM_FNS_DECLARED and include - . - Include rather than declaring malloc functions ourself. - - * ser-unix.c (set_tty_state): Don't ignore errors setting process - group. - * inflow.c (terminal_inferior): If attach_flag set, ignore errors - from set_tty_state. - - * fork-child.c (fork_inferior): Only quote exec file if needed. - - * mipsread.c (parse_symbol): Remove 21 Jul 93 change with - stTypedef inside an stBlock. - -Tue Jul 27 12:36:49 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * breakpoint.c (breakpoint_1): Walk the breakpoint chain to decide if - we have breakpoints or watchpoints as we might have to ignore internal - breakpoints. - - Fix gdb core dumps after `file newfile' commands. - * symtab.h, symfile.c (clear_symtab_users): New routine which - unconditionally clears symtab users. clear_symtab_users_once - commented out as it was a noop anyway. - * objfiles.c (free_objfile): Don't call clear_symtab_users_once. - * objfiles.c (free_all_objfiles), symfile.c (new_symfile_objfile), - xcoffexec.c (exec_close): Call clear_symtab_users if necessary. - * symfile.c (syms_from_objfile): Install cleanups for errors during - symbol reading. - * coffread.c, dbxread.c, mipsread.c, xcoffread.c (*_symfile_read): - Lint cleanup code, call do_cleanups explicitly. - * symfile.c (symbol_file_add): Call new_symfile_objfile and - reinit_frame_cache _after_ the new symbols are read in. - -Tue Jul 27 01:57:01 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * mipsread.c (parse_type): Do not set tag name for compiler - generated fake tag names. - -Mon Jul 26 17:31:49 1993 K. Richard Pixley (rich@rtl.cygnus.com) - - * config/m88k/m88k.mt (TDEPFILES): add exec.o. - -Mon Jul 26 13:17:36 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * hppa-tdep.c: Remove all uses of use_unwind and `set use_unwind' - command. Now we use unwind info by default if we can find it. - - * config/sparc: Move VARIABLES_INSIDE_BLOCK and SUN_FIXED_LBRAC_BUG - to tm-sparc.h so they are shared between Solaris and SunOS4. - * dbxread.c (process_one_symbol): Deal with SunOS4 acc N_STSYM and - N_GSYM functions. - - * config/pa/tm-hppa.h (REGISTER_NAMES): Use "fr" rather than "fp" - for floating point registers. - - * mipsread.c (parse_symbol): Put stStaticProc symbols in minimal - symbols as mst_file_text. - - * hppa-tdep.c (pc_in_linker_stub): Return 0 if can't read memory. - - * stabsread.c (rs6000_builtin_type): Make logical types be - TYPE_CODE_BOOL. - -Sun Jul 25 23:41:48 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * breakpoint.{c,h} (struct breakpoint): Replace symtab field with - source_file field. - -Fri Jul 23 09:57:25 1993 Jim Kingdon (kingdon@deneb.cygnus.com) - - * remote.c: Don't error() on errors xferring memory. - * target.h: Clean up comments about *xfer_memory. - - * exec.c, corelow.c (target_ops struct): Don't allow - {insert,remove}_breakpoints to be defaulted to - memory_{insert_remove}_breakpoint. - - * demangle.c: Make it so `help set dem' tells you how to get the - list of demangling styles. - -Thu Jul 22 15:41:09 1993 Jim Kingdon (kingdon@deneb.cygnus.com) - - * Makefile.in: Use REMOTE_O macro not remote.o. - * config/i960/{nindy960,vxworks960}: Don't use remote.o. - -Thu Jul 22 12:43:25 1993 Ian Lance Taylor (ian@cygnus.com) - - * coredep.c: If NEED_SYS_CORE_H defined, include - (can't include it in nm-*.h file because it causes conflicts with - a.out symbol definitions). - * hp300ux-nat.c (fetch_core_registers): Commented out; obsolete. - * config/m68k/hp300hpux.mh (NATDEPFILES): Added coredep.o and - corelow.o. - * config/m68k/nm-hp300hpux.h (NEED_SYS_CORE_H): Defined. - (REGISTER_U_ADDR): Defined. - * config/m68k/xm-hp300hpux.h (HAVE_TERMIOS): Define instead of - HAVE_TERMIO. - * config/pa/xm-hppah.h: Likewise. - -Wed Jul 21 11:37:30 1993 Jim Kingdon (kingdon@deneb.cygnus.com) - - * mipsread.c (parse_symbol): when stTypedef and friends occur within - an stBlock, skip over the fields of the inner one. - - * mips-tdep.c (init_extra_frame_info): If in lenient prologue, call - heuristic_proc_desc rather than just assuming registers not saved. - - * Makefile.in (regex.o): Add dependency. - - * hppa{b,h}-nat.c: Warning, not error, if can't access registers. - - * config/pa/hppa{b,h}.h: Define ATTACH_DETACH. - -Wed Jul 21 03:07:30 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * config/mips/xm-makeva.h: New file implements va_list alignment - restrictions for mips hosts. - * config/mips/{xm-irix3.h, xm-mips.h, xm-news-mips.h, xm-riscos.h}: - Use it. - -Wed Jul 21 00:11:05 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * mips-tdep.c (init_extra_frame_info): Do not check for - mips_in_lenient_prologue if it is a dummy frame. - * mipsread.c (fixup_sigtramp): Initialize pdr.adr, it is used by - mips_in_lenient_prologue. - -Tue Jul 20 14:14:59 1993 Jeff Law (law@snake.cs.utah.edu) - - * hpread.c (read_hp_array_type): Handle "char foo[]". - -Tue Jul 20 12:53:47 1993 Jim Kingdon (kingdon@deneb.cygnus.com) - - * mips-tdep.c (heuristic_proc_start): First time we print the - warning, elaborate. - (_initialize_mips_tdep): Improve docstring for `set heur'. - - * config/rs6000/tm-rs6000.h: Remove call to insert_step_breakpoint. - - * symtab.c (find_line_symtab): New function, to deal with multiple - symtabs with the same name. - (find_line_pc{,_range}): Use it. - (find_pc_symtab): Add comment about overlapping symtabs. - -Mon Jul 19 21:29:14 1993 Fred Fish (fnf@deneb.cygnus.com) - - * Makefile.in (SFILES): Add nlmread.c. - * Makefile.in (OBS): Add nlmread.o. - * Makefile.in (nlmread.o): Add new target. - * configure.in (i[34]86-*-netware): New configuration. - * nlmread.c, config/i386/{i386nw.mt, tm-i386nw.h}: New files - for NLM/NetWare support. - -Mon Jul 19 11:48:57 1993 Jim Kingdon (kingdon@deneb.cygnus.com) - - * symtab.h (enum minimal_symbol_type): Add mst_file_*. - * partial-stab.h [DBXREAD_ONLY]: Record statics in miminal symbols. - * dbxread.c (record_minimal_symbol): Deal with statics. - * minsyms.c (lookup_minimal_symbol): Prefer externals to statics. - - * config/i386/xm-i386sco.h: Define HAVE_TERMIOS. - - * printcmd.c, config/pa/xm-pa.h, config/alpha/xm-alpha.h: Make it so - arg_bytes field of makeva_list is always aligned. - * config/pa/xm-pa.h: Make arglist_address a char *. - - * ser-unix.c: Don't try to use job control with termio. - -Sun Jul 18 23:11:28 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - and Jim Kingdon (kingdon@cygnus.com) - - Make breakpoint_re_set_one work with overloaded member functions, - `b 123' and `b foo' if foo is a static function. - * symtab.c (decode_line_1, decode_line_2): New argument `canonical' - to return canonical line specs if requested by the caller. - * breakpoint.c, source.c, symtab.c, symtab.h: Change prototypes and - callers accordingly. - * symtab.c (build_canonical_line_spec): New helper function which - constructs the canonical line spec. - * breakpoint.c (break_command_1): Use canonical line spec instead - of command string as addr_string if necessary. - * source.c (line_info): Fix storage leak. - -Sun Jul 18 15:22:45 1993 Jim Kingdon (kingdon@rtl.cygnus.com) - - * infptrace.c: Split out define of PT_KILL; Sequent defines PT_KILL - but not the others. - * symm-tdep.c: Remove exec_file_command. - [_SEQUENT_] (ptx_coff_regno_to_gdb, register_addr): New functions. - A few miscellaneous cleanups. - * symm-nat.c: Renamed from symm-xdep.c. - * All symmetry dependent files: Many changes. - - * mips-tdep.c (mips_skip_prologue): New argument lenient. - Use read_memory_nobpt. - (is_delayed, mips_in_lenient_prologue): New functions. - (init_extra_frame_info): If in the prologue, don't use saved registers. - * config/mips/tm-mips.h: Declare mips_skip_prologue. - - * partial-stab.h (N_SO): Add the text offset to valu before, not after, - passing it to END_PSYMTAB. - -Fri Jul 16 18:48:52 1993 Jim Kingdon (kingdon@rtl.cygnus.com) - - * symtab.c (find_pc_symtab): Call warning, not printf directly. - - * solib.c (solib_add): Use x{re,m}alloc, not {re,m}alloc. - -Fri Jul 16 09:56:42 1993 Ian Lance Taylor (ian@cygnus.com) - - * mipsread.c: No longer need to undefine ZMAGIC. - -Thu Jul 15 18:03:37 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * m88k-pinsn.c: Moved code into opcodes/m88k-dis.c. - (print_insn): Now just calls print_insn_m88k. - -Thu Jul 15 14:54:05 1993 Doug Evans (dje@canuck.cygnus.com) - - * h8300-tdep.c (examine_prologue): Make prototype match definition. - -Thu Jul 15 08:34:49 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * NEWS: Mention that remote.c now has a `load' operation. - - * hppa-tdep.c (pc_in_linker_stub): New function. - (find_proc_framesize): Return 0 for linker stubs. - (rp_saved): Tell the caller where rp is saved. - (frame_chain_valid): Return 1 for linker stubs. - (frame_saved_pc): Use return value from rp_saved. - - * stack.c (print_frame_info): When checking PC_IN_CALL_DUMMY, - pass the sp relative to the frame in question, not the sp in the - innermost frame. - -Wed Jul 14 17:37:03 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * mipsread.c (parse_procedure): Take as argument the symtab to look - the name up in. Look it up with mylookup_symbol, not lookup_symbol. - (psymtab_to_symtab_1): For stabs, pass the symtab to parse_procedure. - - * mipsread.c (mylookup_symbol): Use strcmp, not STREQ, as we have - already checked the first characters. - - Changes from Jeffrey Law: - * printcmd.c (makeva_list): Use MAKEVA_EXTRA_INFO to define - machine dependent fields in the makeva_list structure. - (makeva_size): Allocate extra space to handle gaps made by - alignment restrictions. - * config/pa/xm-pa.h (MAKEVA_EXTRA_INFO): Define. - (MAKEVA_START): Initialize arglist_address field. - (MAKEVA_ARG): Always store arguments on natural alignment - boundaries. Set arglist_address to the address right after - the args. - (MAKEVA_END): Simply return the value stored in arglist_address. - -Wed Jul 14 13:51:54 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * ch-valprint.c (chill_val_print, case TYPE_CODE_STRING): Print - address, not addr. - - * hppah-nat.c (store_inferior_registers): Don't print i in cases - where we aren't using it. - - * a29k-tdep.c (get_saved_register): Fix typo. - -Wed Jul 14 09:45:52 1993 Doug Evans (dje@canuck.cygnus.com) - - * configure.in: Recognize h8300h (variant of h8300). - -Wed Jul 14 09:45:52 1993 Doug Evans (dje@canuck.cygnus.com) - - * configure.in: Recognize sparc64-*-*. - -Tue Jul 13 14:03:48 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * stabsread.c (define_symbol): Make the caddr_t hack apply to `function - returning foo' as well as `pointer to foo'. - - * remote.c [REMOTE_BREAKPOINT]: Use for breakpoint insn if defined. - * config/m68k/tm-m68k.h: Define it. - * mem-break.c, breakpoint.c: Improve comments. - -Tue Jul 13 13:35:31 1993 Frederic Pierresteguy (F.Pierresteguy@frcl.bull.fr) - - * config/m68k/tm-dpx2.h: Replace "tm-68k.h" with "m68k/tm-m68k.h". - * config/m68k/xm-dpx2.h: Define HAVE_TERMIOS not HAVE_TERMIO. - -Tue Jul 13 11:50:38 1993 Doug Evans (dje@canuck.cygnus.com) - - * gdbcore.h (read_memory_integer, read_memory_unsigned_integer): - Make prototype match definition. - -Tue Jul 13 11:15:15 1993 Fred Fish (fnf@cygnus.com) - - * elfread.c: Remove notice about file still being under - construction. - * Makefile.in (ultra3-xdep.o, umax-xdep.o): Add missing ')'. - -Mon Jul 12 17:46:35 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * a29k-tdep.c (read_register_stack): Make val static. - -Mon Jul 12 14:10:48 1993 Doug Evans (dje@canuck.cygnus.com) - - * config/h8300/tm-h8300.h (REGISTER_CONVERTIBLE): Change value to 0. - (REGISTER_CONVERT_TO_VIRTUAL, REGISTER_CONVERT_TO_RAW): Move def'n to - usual spot. - -Mon Jul 12 11:29:44 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * c-valprint.c (c_val_print): Fix thinko with unspecified length - arrays. - - * hppa-tdep.c (find_proc_framesize): If there is a frame pointer, - use it. - -Sun Jul 11 19:35:05 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * symtab.c (decode_line_1): Use end of block to figure out whether - val.end is in the same function, not minimal symbols. - - * source.c (line_info): Add a few more wrap_here's. - - * i386-tdep.c (i386_follow_jump): Do byteswapping where needed and - don't make assumptions about sizes of host data types. - - * blockframe.c, symtab.h (find_pc_partial_function): New arg endaddr. - * infrun.c, breakpoint.c, printcmd.c: Change callers. - * printcmd.c (containing_function_bounds): Remove. - * printcmd.c (disassemble_command): Use find_pc_partial_function, - not containing_function_bounds. - * infcmd.c (step_1): Use find_pc_partial_function rather than - trying to roll our own. Move check for a pc between SIGTRAMP_START and - SIGTRAMP_END in find_pc_partial_function, not step_1. - - * sparc-tdep.c (sparc_frame_chain, frame_saved_pc): - Keep unswapped value in array of char, not REGISTER_TYPE. - Use REGISTER_RAW_SIZE not sizeof (REGISTER_TYPE). - (sparc_extract_struct_value_address): Use TARGET_PTR_BIT not - sizeof (CORE_ADDR). - -Thu Jul 1 15:50:05 1993 Frederic Pierresteguy (F.Pierresteguy@frcl.bull.fr) - - * configure.in (m68*-bull-sysv*): added support for Bull dpx2. - * config/m68k/{t,x,n}m-dpx2.h, dpx2-nat.c: New files. - * config/m68k/dpx2.m{h,t}: New files. - -Thu Jul 1 15:46:10 1993 Jeff Law (law@snake.cs.utah.edu) - - * hpread.c: Run through gnu-indent. - -Sun Jul 11 12:32:08 1993 Doug Evans (dje@canuck.cygnus.com) - - * config/sparc/tm-sparc.h (PRINT_REGISTER_HOOK): Fix typo, add - more parens around macro arg. - -Sat Jul 10 09:54:17 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * infrun.c: Remove step_resume_{duplicate,shadow}. Replace - step_resume_break_address with step_resume_breakpoint (now local - to wait_for_inferior). - ({insert,remove}_step_breakpoint): Remove. - (wait_for_inferior): Set step resume break with - set_momentary_breakpoint. Test hitting it with bpstat_stop_status - and bpstat_what (stop_step_resume_break removed). - * breakpoint.{h,c}, infrun.c: Return value from bpstat_what now struct - which includes previous return value as main_action, and a step_resume - bit. - * breakpoint.c (delete_breakpoint): If breakpoint was inserted, and - there is another breakpoint there, insert it. - * infrun.c (wait_for_inferior): Rearrange the spaghetti a bit. Use - a few more gotos. - Various: Clean up and add comments. - - * infrun.c [TDESC]: Remove remaining tdesc code (see ChangeLog - for Wed Nov 13 16:45:13 1991). - -Fri Jul 9 12:36:46 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * values.c, value.h (modify_field), callers: Make fieldval a LONGEST. - - * h8300-tdep.c (NEXT_PROLOGUE_INSN): Make pword1 an INSN_WORD * - not short *. - - * findvar.c, defs.h - ({extract,store}_{signed_integer,unsigned_integer,address}): - New routines to replace SWAP_TARGET_AND_HOST. - All over: All uses of SWAP_TARGET_AND_HOST on integers replaced. - - * config/sparc/tm-sparc.h: Add comment suggesting that removing - ins and locals from the registers array might clean things up. - - * utils.c: Clean up comments about wrap buffer and wrap_here. - * printcmd.c (printf_command): Call wrap_here before vprintf. - - * mipsread.c (cross_ref): Set the name to unknown for "struct *" case. - Patch from ptf@delcam.co.uk (Paul Flinders). - - * a29k-tdep.c, findvar.c (get_saved_register): Fix byteswapping sins. - -Fri Jul 9 09:47:02 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * defs.h, remote-eb.c (TM_FILE_OVERRIDE): Remove it. - * mips-tdep.c (init_extra_frame_info): Set proper fci->frame if pc - is at the start of the dummy code. - -Thu Jul 8 14:48:54 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * sparc-tdep.c (sparc_push_dummy_frame): Skip all the do_save_insn - stuff, just write the sp and fp. - (sparc_pop_frame): Skip the do_restore_insn; we already restore - the sp with the other out registers. - - * hppa-tdep.c (hppa_push_arguments): Allocate enough space for - arguments. - - * hppa-tdep.c: Change _initialize_hppab_tdep to _initialize_hppa_tdep. - -Thu Jul 8 14:47:00 1993 Doug Evans (dje@canuck.cygnus.com) - - * sparc-tdep.c (sparc_frame_chain): Handle sizeof (CORE_ADDR) - != sizeof (REGISTER_TYPE). - (frame_saved_pc): Ditto. - -Thu Jul 8 08:22:05 1993 Doug Evans (dje@canuck.cygnus.com) - - * config/h8300/tm-h8300.h: (REGISTER_TYPES): Adjust for h8/300h. - (REGISTER_RAW_SIZE): Ditto. - (REGISTER_VIRTUAL_TYPE): Use builtin_type_unsigned_long for regs - on the h8/300h (ints may still be 16 bits). - (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, - EXTRACT_STRUCT_VALUE_ADDRESS): Add FIXME's for h8/300h. Some - thought needed here. - - * h8300-tdep.c (print_insn): Call print_insn_h8300h if h8/300h. - (examine_prologue): reg_save_depth is 4 if h8/300h. - - * findvar.c (read_register): Provide some support for 64 bit regs. - (write_register): Ditto. - -Wed Jul 7 14:30:00 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config/mips/nm-riscos.h: machine/machparam.h is always the right - place to look for BSD43_NBPG, not machine/vmparam.h - - * infcmd.c (run_stack_dummy): New argument name. - Change error message in (another) attempt to make it comprehensible. - * valops.c (call_function_by_hand): Pass name to run_stack_dummy. - * symtab.h: Declare demangle and asm_demangle since macros use them. - - * eval.c (evaluate_subexp): Add comment about calling a member - function of a variable in a register. - - * expression.h: Clean up comment about string in STRUCT_STRUCT etc. - - * config/{rs6000/tm-rs6000.h,sparc/tm-sparc.h,pyr/tm-pyr.h}, - inferior.h (PC_IN_CALL_DUMMY) [ON_STACK]: Add comments about stack - frame tops and bottoms. - - * frame.h, blockframe.c, stack.c, a29k-tdep.c, - config/gould/tmp-{pn,np1}.h, - config/{sparc/tm-sparc.h,pyr/tm-pyr.h,vax/tm-vax.h}: Remove field - next_frame from struct frame_info. It has no purpose beyond - ->next->frame and is an artifact from GDB 2.8. - -Tue Jul 6 11:51:18 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Makefile.in: Remove gdb before creating a new one. - Update init.c atomically. - - * Makefile.in (ALLPARAM): Add config/{alpha/xm-alpha.h,pa/xm-pa.h}. - (ALLCONFIG): Add config/alpha/alpha-osf1.mh. - - * infcmd.c (_initialize_infcmd): In docstring for "continue", - describe argument as setting ignore count. - -Sun Jul 4 15:04:47 1993 Doug Evans (dje@cygnus.com) - - * h8300-tdep.c (examine_prologue): Fix call to - read_memory_unsigned_integer. - -Fri Jul 2 18:22:54 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config/mips/{x,n}m-irix{3,4}.h: Make some definitions here - rather than including xm-bigmips.h. - - * eval.c (evaluate_subexp): Improve error messages for OP_TYPE and - default cases. - - * Makefile.in (distclean): Remove y.tab.h. - -Fri Jul 2 14:55:48 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * exec.c (exec_file_command): Remove Mar 28 hack as BFD handles - file updates properly now. - * mipsread.c (mips_coff_new_init): Force reevaluation of sigtramp - addresses if switching to a new symbol file. - * dbxread.c (process_one_symbol): Avoid dereferencing NULL - symbols that might be returned from define_symbol. - -Fri Jul 2 13:33:12 1993 Steve Chamberlain (sac@phydeaux.cygnus.com) - - New target macros for getting at the pc, sp and fp. - * infcmd.c (read_pc, write_pc): Modify to use new macros. - (read_sp, write_sp, read_fp, write_fp): New functions. - * blockframe.c (reinit_frame_cache, get_prev_frame_info): - Use new functions. - * breakpoint.c (bpstat_alloc): ditto. - * infrun.c (wait_for_inferior): ditto. - * stack.c (print_frame_info): ditto. - * valops (call_function_by_hand): ditto. - * corelow.c (core_open): ditto. - * h8500-tdep.c: (target_read_sp, target_write_sp, target_read_pc, - target_write_pc, target_read_fp, target_write_fp): New functions. - * inferior.h (read_sp, write_sp, read_fp, write_fp): Prototypes. - - * config/alpha/xm-alpha.h: Add MAKEVA_END. - * config/h8500/tm-h8500.h: Define new macros. - -Fri Jul 2 13:51:04 1993 Ian Lance Taylor (ian@cygnus.com) - - * configure.in (mipos-*-riscos*): New host and target; use riscos. - * config/mips/nm-riscos.h: If BSD43_NBPG is not defined by - vmparam.h, include machparam.h. - (KERNEL_U_ADDR): Define to be BSD43_UADDR. - -Fri Jul 2 13:39:48 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * c-exp.y (yylex): Give error if unmatched single quote. - - * configure.in, config/m68k/*delta68*, delta68-nat.c: New port. - - * Remove unused STACK_END_ADDR in the following files (in other - files it is used for something): tm-mips.h, tm-sun2.h, tm-news.h, - tm-a29k, tm-i386v.h, tm-hppa.h, tm-nindy960.h, tm-amix.h, - tm-hp300hpux.h, tm-isi.h. - -Thu Jul 1 09:51:27 1993 Jim Kingdon (kingdon@cygnus.com) - - * config/mips/nm-riscos.h: Define NBPG and UPAGES. - config/mips/xm-riscos.h: Include . - - * ser-unix.c (hardwire_noflush_set_tty_state): Use an assignment, - not an initializer, to copy the structure. - - * gdbtypes.h (struct type): Add field tag_name. - * gdbtypes.c (type_name_no_tag), c-typeprint.c (c_type_print_base): - Use it. - * {coff,dwarf,mips,stabs}read.c: Set it. - - * xm-sysv4.h: Undefine HAVE_TERMIO. - - * config/mips/nm-riscos.h: Remove unmatched #endif. - Define FETCH_INFERIOR_REGISTERS. - * config/mips/riscos.mh: Don't include coredep.o; mips-nat.o is enough. - Fix misspelling of NAT_FILE. - * mips-nat.c (fetch_core_registers): If KERNEL_U_ADDR is not defined, - we can still process "modern" core files. - - * ser-unix.c (hardwire_print_tty_state) [HAVE_TERMIOS]: Don't - print c_line. - (_initialize_ser_hardwire): Just check whether _POSIX_JOB_CONTROL - is defined; don't care what it is defined to. - -Wed Jun 30 20:06:46 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config/vax/xm-vaxult2.h: Define FD_SET and FD_ZERO. - -Tue Jun 29 11:02:58 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * inftarg.c: Remove unused include of terminal.h. - * signals.h: Don't undefine signals anymore. - * main.c: Use job_control from serial.h. - * fork-child.c (fork_inferior): Use gdb_setpgid. - * serial.h, ser-unix.c, ser-go32.c: Provide gdb_setpgid. - * utils.c (quit): Use current_target->to_terminal_ours to figure - out whether we care about lack of job control, rather than __GO32__. - * utils.c: Include serial.h not terminal.h - (quit): Use job_control not TIOCGPGRP. - * terminal.h: Don't undefine TIOCGPGRP. - * serial.h, ser-unix.c, ser-go32.c, ser-tcp.c: Add SERIAL_FLUSH_OUTPUT. - * utils.c (quit): Use it. - * serial.h: Add SERIAL_UN_FDOPEN. - * utils.c (quit): Use it. - * ser-unix.c: Add process group to ttystate. - [HAVE_SGTTY]: Add tchars, ltchars, and lmode to ttystate. - * inflow.c: Include serial.h not terminal.h. - Use serial.h stuff to replace most of the maze of #ifdef's. - * inflow.c, main.c, inferior.h: make gdb_has_a_terminal a function. - * serial.h: Document SERIAL_SET_TTY_STATE as being immediate. - * ser-unix.c: Use TIOCSETN not TIOCSETP so it is true. - * serial.h, ser-unix.c, ser-go32.c, ser-tcp.c: - Add SERIAL_PRINT_TTY_STATE, SERIAL_NOFLUSH_SET_TTY_STATE, and - SERIAL_SET_PROCESS_GROUP. - * inflow.c: Use them. - * config/xm-svr4.h, config/rs6000/xm-rs6000.h, config/sparc/sun4os4.h: - Define HAVE_TERMIOS. - * Various: Remove all use of TIOC*_BROKEN. - -Wed Jun 30 12:20:51 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * config/m68k/tm-sun3.h (BELIEVE_PCC_PROMOTION_TYPE): Define. - -Tue Jun 29 13:44:41 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * target.h (target_detach): Turn macro into function. - * target.c (target_detach): Define it, do deferred register stores - before calling the real target function. - -Tue Jun 29 13:15:42 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - and Jim Kingdon (kingdon@cygnus.com) - - * symtab.h (BLOCK_SHOULD_SORT): Do not sort blocks corresponding to - a function to avoid printing of function arguments in wrong order - due to sorting. - * symfile.c (compare_symbols): Remove code for sorting arguments - as blocks containing arguments are no longer sorted. - * symtab.c (lookup_block_symbol): Update comment accordingly. - -Tue Jun 29 11:02:58 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config/pa/tm-hppa.h: Remove unused ARGS_GROW_DOC. - (REG_STRUCT_HAS_ADDR): Add comment. - - * infrun.c (wait_for_inferior): Use find_pc_line not find_pc_symtab - to check whether there is line number information. - -Tue Jun 29 08:29:17 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * remote-udi.c: Fix docstring so that it compiles. - - * remote-mips.c, remote-nindy.c: move bfd.h before symfile.h - (for file_ptr). - -Tue Jun 29 09:11:27 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * dbxread.c (process_one_symbol): If we find a LOC_BLOCK where we - don't expect it, change it to LOC_STATIC so at least we don't coredump. - - * c-typeprint.c (c_type_print_base): Don't error() on invalid type. - - * symtab.h: Add comments about line numbers. - * source.c (identify_source_line): Fix off by one bug with line. - -Mon Jun 28 19:00:21 1993 Jeff Law (law@snake.cs.utah.edu) - - * hpread.c: Do not include libhppax. Instead include libhppa.h - and hpux-symtab.h. Misc indention fixes. - (find_unwind_entry): Add PARAM prototype. - (read_hpux_symtab): More fixes for names and sizes of structs, - unions, enums, typedefs, and tagdefs. - (read_hp_enum_type, read_hp_struct_type): Likewise. - (read_hp_set_type, read_hp_subrange_type): Likewise. - (hp_type_lookup, process_one_debug_symbol): Likewise. - (process_one_debug_symbol): Search forward from the K_FUNCTION for - the first K_BEGIN when setting the line number associated with a - function. Avoid unnecessary calls to savestring. - (hp_alloc_type): Initialize TYPE_CPLUS_SPECIFIC here. Remove - most cases where we set it elsewhere. - (hppa_sym_fns): Use "hppa" instead of hppax since hpread.c and - paread.c use the same BFD backend now. All references changed. - (hpux_symfile_init): Allocate space to hold the debugging section - contents on the symbol obstack. - -Mon Jun 28 10:09:08 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * printcmd.c (makeva*): New interface, for making a va_list. - (printf_command): Use it. - * config/m88k/xm-delta88.h: Remove VPRINTF define, not needed. - * config/pa/xm-pa.h: New file. - * config/pa/xm-hppa{b,h}.h: Include it. - - * xcoffread.c: Remove obsolete NO_TYPEDEFS comment. - -Sun Jun 27 08:54:55 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * valprint.c (val_print_type_code_int): Fix off by one error with - eliminating leading zeroes for large little endian integers. - -Sun Jun 27 08:58:56 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config/mips/riscos.mh (CC): Use -systype sysv. - - * ser-unix.c: Move #include of to HAVE_SGTTY section. - - * Makefile.in (ALLPARAM): Add config/mips/{x,n}-{news-mips,riscos}.h. - -Fri Jun 25 11:22:28 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config/m68k/tm-m68k.h: Remove obsolete comment about duplicating - CALL_DUMMY between different 68k machines. - -Fri Jun 25 17:02:45 1993 Stu Grossman (grossman at cygnus.com) - - * gdbserver/Makefile.in: Add dependancies on server.h. - * gdbserver/remote-gutils.c: Remove lots of unused functions and - variables. - * gdbserver/remote-inflow.c: Remove lots of unused variables and - #includes. Also, use PTRACE_* symbols instead of constants. - (mywait): Surround calls to wait() with enable/disable_async_io() - so that we can be interrupted from GDB while waiting for the - child. Also, handle child exit more gracefully. - * gdbserver/remote-server.c: Remove lots of unused variables. - Move all extern defs into server.h. Redo main loop so that - failure from getpkt() causes communications to be re-established. - Fix 'k' command so that it restarts the child. - * gdbserver/remote-utils.c: Remove lots of unloved vars and - subrs. Move many extern decls into server.h. (remote_open): For - tcp, seperate usage of proto fd from connected fd. Close proto - fd after getting connection. (putpkt/getpkt): Pay attention to - errors when reading/writing. Report these to the caller. New - routines input_interrupt/enable_async_io/disable_async_io to make - it possible to get an I/O interrupt when data arrives from the - comm link. - * serial.h: New file to contain common defs for all remote files. - -Fri Jun 25 17:02:45 1993 Stu Grossman (grossman at cygnus.com) - - * remote.c: Add arg names to prototypes, in a modest effort at - clarification. Also add prototypes for some new functions. - * (remote_wait): Better error reporting for 'T' responses. - * ser-go32.c (strncasecmp): Make str1 & str2 be const. - * (dos_async_init): Make usage message reflect requested port #. - * ser-tcp.c (tcp_open): Terminate hostname properly to prevent - random hostname lookup failures. Add nicer message for unknown - host error. (wait_for): Wake up in case of exceptions. Also, - restart select() if we got EINTR. - * ser-unix.c (wait_for): Restart select() if we got EINTR. - * serial.c: (serial_close): Clean up code. - -Fri Jun 25 11:22:28 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config/m68k/tm-m68k.h: Remove obsolete comment about duplicating - CALL_DUMMY between different 68k machines. - -Fri Jun 25 11:22:28 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Makefile.in (*.tab.c): Use ./c-exp.tab.c not just c-exp.tab.c. - Make comment explaining this comprehensible. - (TAGFILES): Include ALLDEPFILES. - (ALLDEPFILES): udi2soc.c and udr.c are in 29k-share/udi, not - 29k-share/udi/udi. - (update-alldeps): Remove; obsolete. - - * remote.c: Move comments regarding packets to top of file with the - rest of the protocol comments. - Fix incorrect description of 'T' response. - - * README (Reporting Bugs): Refer people to the GDB manual. - - * c-valprint.c (c_val_print): Handle TYPE_CODE_BOOLEAN. - * stabsread.c: Type -16 is 4 bytes. - - * remote-udi.c: Improve docstring. - -Fri Jun 25 11:16:31 1993 Fred Fish (fnf@cygnus.com) - - * elfread.c (elf_symfile_read): Call bfd_elf_find_section, not - bfd_elf32_find_section, to track bfd changes. - -Fri Jun 25 11:22:28 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config/mips/riscos.mh (REGEX{,1}, MUNCH_DEFINE, MH_CFLAGS): Define. - * config/mips/xm-riscos.h: Define USG. - -Thu Jun 24 14:52:45 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * main.c (filename_completer): Don't complete to files ending in ~. - - * NEWS: Mention filename completion and "info line" enhancements. - - * main.c (symbol_completion_function): On "info t foo", return NULL, - don't error(). - - * main.c (symbol_completion_function): Don't use readline word - breaking. Use new calling convention for c->completer and - complete_on_cmdlist. - * command.h (struct command): Change arguments; now the text passed - to completer does not have any word breaking done. New arg word. - * symtab.{c,h} (make_symbol_completion_list): Do word breaking. Take - word argument. - * {main.c,gdbcmd.h} ({filename,noop}_completer): Take word argument. - * command.{c,h} (complete_on_cmdlist): Take word argument. - - * command.c (lookup_cmd_1): Doc fix. - -Thu Jun 24 13:26:04 1993 K. Richard Pixley (rich@sendai.cygnus.com) - - * Makefile.in (OP_INCLUDE): define. - (OPCODE_CFLAGS): use OP_INCLUDE. - - * config/i386/ncr3000.mh, config/i386/i386v4.mh, - config/i386/i386sol2.mh, config/m68k/hp300hpux.mh, - config/m68k/amix.mh, config/mips/irix[34].mh, - config/m88k/delta88.mh, config/sparc/sun4sol2.mh (ALLOCA, - ALLOCA1): macros removed. - - * config/mips/decstation.mh, config/rs6000/rs6000.mh - (MMALLOC_LIB): renamed to MMALLOC. - -Wed Jun 23 00:25:58 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * partial-stab.h: Consolidate case statements for N_LSYM and N_FUN. - * dbxread.c: Change comment regarding acc. - -Wed Jun 23 16:33:36 1993 Jeff Law (law@snake.cs.utah.edu) - - * hpread.c: Document a few functions, misc cleanups. Update - copyright to reflect the first "release" of this file. - (struct hpux_symfile_info): Delete unneeded fields. Keep pointers - to the contents of the debug sections rather than offsets within - the file itself. Corresponding changes to the accessor macros. - (sl_symbol_size, slt_symbuf): Delete unneeded global variables. - (slt_symbuf_start, slt_symbuf_end, lntt_symbuf): Likewise. - (lntt_symbuf_start, lntt_symbuf_end, gntt_symbuf): Likewise. - (gntt_symbuf_start, gntt_symbuf_end): Likewise. - (fill_slt_symbuf, fill_lntt_symbuf): Delete unneeded functions. - (fill_gntt_symbuf): Likewise. - (get_lntt, get_gntt, get_slt): Simplify. - (hpux_symfile_init): Read and store the contents of the debugging - sections. Do error checking on memory allocation and BFD calls. - (read_hpux_symtab): Delete KERNELDEBUG crud. Ignore debug symbols - which are not needed for building partial symbol tables. Handle - K_CONST, K_TYPEDEF, and K_TAGDEF just like K_SVAR and K_DVAR. - (read_ofile_symtab): Delete useless processing_gcc_compilation stuff. - (read_hp_struct_type): Initialize TYPE_CPLUS_SPECIFIC. - (read_hp_set_type, read_hp_array_type): Likewise. - (read_hp_subrange_type, hp_type_lookup): Likewise. - -Wed Jun 23 15:04:54 1993 K. Richard Pixley (rich@sendai.cygnus.com) - - Makefile overhaul dropping autodepend features. - * Makefile.in: many comment changes. forced consistent use of $() - for makefile variables references. dropped leading ./ in file - references. Drop $(srcdir)/ prefix on all dependencies. - Inserted contents of alldeps.mak and depend. - (INCLUDE_CFLAGS): defined as new macro for getting libiberty's - include directory into the compilation line. - (GDB_CFLAGS): new macro to take up the semantic previously held - by INCLUDE_CFLAGS. - (LIBIBERTY): dropped ancient subdir macro. I last removed this - macro in feb of '92. How does it keep coming back? - (MMALLOC_LIB): renamed to MMALLOC. - (BFD_SRC_DIR): renamed to BFD_SRC. - (BFD_OBJ_DIR): renamed to BFD_DIR. - (BFD_LIB): renamed to BFD. - (BFD_INCLUDES): renamed to BFD_CFLAGS. - (READLINE_DIR): now represents object directory. - (RL_LIB): renamed to READLINE. - (READLINE_SRC, READLINE_CFLAGS, OPCODES, OPCODES_CFLAGS): new - macros. - (INTERNAL_CFLAGS): added GDB_CFLAGS, OPCODES_CFLAGS, - READLINE_CFLAGS, BFD_CFLAGS. Dropped USER_CFLAGS. - (LDFLAGS): removed default assignment. - (TEXIDIR, INCLUDE_DEP, MMALLOC_DIR, MMALLOC_DEP, BFD_DEP, - READLINE_DEP, LIBIBERTY_DIR, TESTS, depend, STAGESTUFF): unused, so removed. - (ALLOCA1, ALLOCA): removed all references. alloca is now in - libiberty. - (VERSION): unilaterally and arbitrarily bumped to 4.9.3. - (SFILES, NONSRC, HFILES, ALLDEPFILES, ALLPARAM, ALLCONFIG): - removed all $(srcdir) prefixes. - (getopt_h, ieee-float_h, bfd_h, wait_h, dis-asm_h): new macros - for potential dependencies. commented out by default. - (readline_headers, udiheaders): convenient abbreviations. - (gdbcore_h, frame_h, symtab_h, gdbtypes_h, expression_h, - value_h, breakpoint_h, command_h, gdbcmd_h, defs_h, inferior_h): - new macros used for header file dependencies. - (install-info, clean-info): collapse into the info rule. - (install): now depends on all. - (install-only): new target for installing without depending on - all. - (uninstall): new target. - (config-check, config-check-hosts, config-check-targets): added - fixme comments. - (ch-exp.tab.c, m2-exp.tab.c): added artificial dependencies in - order to force parallel makes into keeping these rules separate. - * configure.in: omit cat'ing depend file onto generated Makefile. - * alldeps.mak, depend: removed. - - * inferior.h: remove redundant include of symtab.h which is - included in value.h via breakpoint.h. - - * alloca.c: removed. alloca is now in libiberty. - - * config/m88k/delta88.mh, config/ns32k/merlin.mh (M_UNINSTALL): - new macro to undo what M_INSTALL does. - -Wed Jun 23 00:25:58 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config/ns32k/{merlin.mh,xm-merlin.h}: Be consistent about name - of gdb-sh. - - * dbxread.c (copy_pending): Change name and function of begi argument - to endi, since that is what the caller needs. - - * Makefile.in (TAGFILES): Don't include YYFILES. - - * Makefile.in (HFILES): Include monitor.h. - - * Makefile.in: Include text that used to be in alldeps.mak. - Remove config/mips/{bigmips.mh,xm-bigmips} from it. - * Makefile.in, configure.in: Remove all traces of alldeps.mak. - - * main.c (main): Print help message on stdout not stderr - per standards.texi. - New option --version per standards.texi. - In help message, show long options with "--" not "-". - Don't try to print help message or version until after we have - called initialize_all_files. - -Tue Jun 22 11:03:13 1993 Jeff Law (law@snake.cs.utah.edu) - - * hpread.c: Delete useless #if 1 statements. - (hp_type_translate): Use T_LONG, T_UNS_LONG, and T_DOUBLE instead - of magic integers. Fix handling for T_UNS_INT. Abort if the type - passed in is not an "immediate" type. - (read_hp_enum_type): Properly compute the size of the type. - (read_hp_array_type): Likewise. - (hp_type_lookup): Prefix the names of structs, unions and enums - with "struct", "union", and "enum" as appropriate. - -Tue Jun 22 03:15:38 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * solib.c (solib_add_common_symbols): Don't call lookup_minimal_symbol. - (solib_add): Call special_symbol_handling once, not once per library. - - * procfs.c (procfs_resume): Don't pass a SIGTSTP whose action - is SIG_DFL. - - * procfs.c (procfs_resume): Skip the unnecessary PRSVADDR on all - systems, not just Solaris. - - * stabsread.c: Include . - -Mon Jun 21 16:09:46 1993 Jim Kingdon (kingdon@cygnus.com) - - * fork-child.c (fork_inferior): Quote exec_file so it can contain - funky characters. - -Mon Jun 21 16:56:47 1993 Fred Fish (fnf@cygnus.com) - - * Makefile.in (INCLUDE_CFLAGS): Add BFD_INCLUDES for now, since - bfd.h is included by target.h, which most of gdb includes. - * depend: Hand remove BFD_INCLUDES from ${CC} lines, now that - it's in INCLUDE_CFLAGS. - -Mon Jun 21 16:09:46 1993 Jim Kingdon (kingdon@cygnus.com) - - * config/i386/*aix*, i386aix-nat.c: New files. - * configure.in: Use them. - * alldeps.mak: List them. - * coffread.c (decode_base_type): Deal with anonymous enum type. - * i387-tdep.c (print_387_status_word): Add comment re "top". - * i386-tdep.c [I386_AIX_TARGET] (i386_extract_return_value): New func. - * dbxread.c: Use SEEK_SET and SEEK_CUR, not L_*. Define them if and - only if not defined by a header file. - * mipsread.c: Don't define L_SET or L_INCR. - -Mon Jun 21 15:10:07 1993 Fred Fish (fnf@cygnus.com) - - * Makefile.in (BFD_INCLUDES): Bfd.h is now back in bfd build dir. - * depend: Hand updated to match. - -Mon Jun 21 10:13:42 1993 Jeff Law (law@snake.cs.utah.edu) - - * hpread.c: Include "demangle.h". - (process_one_debug_symbol): Set the SYMBOL_LANGUAGE and - SYMBOL_INIT_DEMANGLED_NAME for the current symbol. Adjust - SYMBOL_VALUE for local variables in the stack by the size of the - current function's stack (found in unwind descriptor). Keep - better track of the current unwind descriptor. - -Sun Jun 20 13:11:11 1993 Jim Kingdon (kingdon@cygnus.com) - - * stabsread.c (read_struct_fields): Don't call read_cpp_abbrev on $_. - (read_cpp_abbrev): Don't complain specially for $_. Also return 0 if - we don't recognize the abbrev. - -Sun Jun 20 00:24:41 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * solib.c (solib_add_common_symbols): Add comment about performance. - -Fri Jun 18 12:37:36 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config/mips/{{x,n}m-riscos.h,riscos.mh}: New files. - * configure.in (mips-*-sysv*): Use riscos for host, bigmips for target. - - * config/mips/{{x,n}m-news-mips.h,news-mips.mh}: New files. - * config/mips/{bigmips.mh,xm-bigmips.h}: Remove. - * configure.in (mips-sony-*): Use news-mips for host. - - * buildsym.h: Doc fix for processing_acc_compilation. - -Thu Jun 17 19:57:08 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * printcmd.c (print_formatted): Don't use tab in wrap_here arg. - -Thu Jun 17 17:29:30 1993 Jim Kingdon (kingdon@lisa.cygnus.com) - - * Makefile.in (INTERNAL_CFLAGS): Include ../include as well as - ${srcdir}/../include. - - * config/m88k/xm-delta88.h: Comment out unused defines which conflict - with system headers. - * printcmd.c (printf_command): Cast second arg to vprintf to PTR. - Use VPRINTF macro if defined. - * config/m88k/xm-delta88.h: Define VPRINTF. Include . - Define TIOC{GETC,GLTC}_BROKEN. - * m88k-nat.c: Uncomment include of . - * main.c: Rename initialize_{main,cmd_lists,history} to init_* to - make things easier on munch (apparently this matters on - the delta88 with svr3). - -Thu Jun 17 16:53:56 1993 david d `zoo' zuhn (zoo@cygnus.com) - - * Makefile.in: canonicalize install.sh; for use within - this directory (and subdirs) - -Tue Jun 15 17:01:23 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * Makefile.in: remove parentdir support; use INSTALL_XFORM - -Thu Jun 17 15:08:35 1993 Steve Chamberlain (sac@phydeaux.cygnus.com) - - * configure.in (alpha-*-osf*), config/alpha/alpha-osf.mh: New - host. - * sh-tdep.c (frame_find_saved_regs): Use NUM_REGS rather than hard - wired (and wrong) constant. - * values.c (unpack_long): Add case to unpack when target object is - sizeof(int). - * config/sh/tm-sh.h (REGISTER_NAMES): Know about the news ones the - simulator defines. - -Wed Jun 16 16:08:18 1993 K. Richard Pixley (rich@sendai.cygnus.com) - - * NEWS: tracking user visible changes starting with - vxworks-timeout. - - * remote-vx.c (_initialize_vx): rename user settable option from - rpcTimeout to vxworks-timeout. - -Wed Jun 16 14:34:10 1993 Jeff Law (law@snake.cs.utah.edu) - - * hpread.c (hp_type_translate): Fix promotion bugs from - char to short and short to int. - -Wed Jun 16 12:21:49 1993 Fred Fish (fnf@cygnus.com) - - * Makefile.in (depend): More makefile diddling. - * alldeps.mak, depend: Update to latest automatically built - versions. - - * Makefile.in (depend): Bfd.h keeps moving, keep up with it. - * alldeps.mak, depend: Update to latest automatically built - versions. - -Tue Jun 15 12:26:05 1993 K. Richard Pixley (rich@sendai.cygnus.com) - - * remote-vx.c: include gdbcmd.h for setlist. - (_initialize_vx): make rpcTimeout user settable. - -Mon Jun 14 09:23:51 1993 Jim Kingdon (kingdon@cygnus.com) - - * main.c, gdbcmd.h: Add function filename_completer. - * main.c, symfile.c, source.c, exec.c, core.c: Use it for - "directory", "source", "cd", "symbol-file" "add-symbol-file", - "load", "file", "exec-file", "core-file" commands. - (But '/' is a word break, limiting usefulness; see comments). - - * source.c (mod_path): Warning not error if can't find directory. - - * isi-xdep.c: New file. - * config/m68k/isi.mh (XDEPFILES): Add isi-xdep.o - -Sun Jun 13 09:17:48 1993 Jim Kingdon (kingdon@cygnus.com) - - * config/m68k/xm-news.h: Include . - - * m88k-tdep.c (IEEE_isNAN): Remove. - config/m88k/tm-m88k.h (INVALID_FLOAT): Return 0. This was the same - broken isNAN as on the mips. - - * valprint.c (_initialize_valprint): Use c->function.sfunc not just - c->function. - - * dbxread.c (process_one_symbol): If SUN_FIXED_LBRAC_BUG is not - defined, don't worry about Sun's silly LBRAC bug. - * config/m68k/tm-sun3.h: Define SUN_FIXED_LBRAC_BUG to 0. - - * dbxread.c (process_one_symbol): If there's a symbol before an - N_SO, don't error(). - (case N_BCOMM): complain () not error (). - - * defs.h, main.c (catch_errors): Add return_mask arg. - stack.c (print_frame_info): Pass RETURN_MASK_ERROR. - other callers: Pass RETURN_MASK_ALL. - (return_to_top_level), callers: Add return_reason arg. - * utils.c (quit): - Use return_to_top_level (RETURN_QUIT) instead of error (). - * main.c (main), tm-nindy960.h (ADDITIONAL_OPTION_HANDLER): - Use SET_TOP_LEVEL not setjmp (to_top_level). - * remote-nindy.c: Use catch_errors not setjmp (to_top_level). - -Sat Jun 12 14:40:54 1993 Jim Kingdon (kingdon@cygnus.com) - - * solib.c (solib_create_inferior_hook) [SVR4_SHARED_LIBS]: - Don't try to get the debug base yet. - - * dbxread.c (process_one_symbol): Set n_opt_found based on whether - a non-gcc N_OPT symbol is found. Make SUN_FIXED_LBRAC_BUG a macro - which returns 0 or 1 to say whether to do it. - * config/sparc/sun4{sol2,os4}.h - (SUN_FIXED_LBRAC_BUG,VARIABLES_INSIDE_BLOCK): Use n_opt_found so - the right thing happens for both acc and SunOS4 /bin/cc. - - * valprint.c (print_hex_chars): Use local_hex_format_{pre,suf}fix. - * printcmd.c (print_scalar_formatted): Use val_print_type_code_int. - - * mips-tdep.c: Remove isa_NAN; it assumed sizeof(host int) == 4 and - probably contained byte-order sins too. - config/mips/tm-mips.h (INVALID_FLOAT): Define to 0 like most machines. - The IEEE_FLOAT code in print_floating takes care of it. - -Sat Jun 12 14:47:04 1993 Fred Fish (fnf@cygnus.com) - - * Makefile.in (VERSION): Bump to 4.9.2. - * c-valprint.c (c_val_print): For array of chars printed with - string syntax, don't print the address of the array. From - bothner@cygnus.com. - * c-exp.y (yylex): Recognize '.' as indicating a floating point - number regardless of the radix. From wilson@cygnus.com. - * valprint.c (set_input_radix_1, set_output_radix_1): New - prototypes and functions that do the actual radix setting work. - * valprint.c (set_radix, set_output_radix, set_input_radix): - Rewrite to use set_input_radix_1 and set_output_radix_1. - * valprint.c (initialize_valprint): Enable commands to - independently set and show input and output radices. - * valprint.c (show_radix): New prototype and function that - handles separate input and output radices. - -Fri Jun 11 18:39:38 1993 Ken Raeburn (raeburn@cygnus.com) - - Patches from Jeff Law, law@cs.utah.edu: - * hppa-pinsn.c: Now uses disassembler from opcode library, - this contains only the stub function print_insn. - -Fri Jun 11 15:19:59 1993 K. Richard Pixley (rich@cygnus.com) - - * main.c (main): back to two periods for elipse. - (print_gdb_version): revised format for configuration info. - -Fri Jun 11 10:24:35 1993 Fred Fish (fnf@cygnus.com) - - * defs.h (INT_MAX): Cast unsigned shift result to int. - -Fri Jun 11 10:17:41 1993 Jim Kingdon (kingdon@cygnus.com) - - * dbxread.c (process_one_symbol): Rather than having - BLOCK_ADDRESS_FUNCTION_RELATIVE a macro, make it a variable which - is true if we are doing stabs-in-elf, false otherwise. - config/sparc/tm-sun4sol2.h: Don't define it. - -Fri Jun 11 13:33:40 1993 Ian Lance Taylor (ian@cygnus.com) - - * remote-mips.c (mips_send_packet): Don't print garbage character - in debugging info. - (mips_request): Don't check that remote pid is 0, because - sometimes it isn't. - (mips_fetch_registers): Pass a pointer to SWAP_TARGET_AND_HOST, - not an integer. - -Fri Jun 11 10:17:41 1993 Jim Kingdon (kingdon@cygnus.com) - - * stack.c (print_frame_info): Use catch_errors around print_frame_args. - - * Makefile.in (install): Don't depend on gdb. - - * Rename remote-es1800.c to remote-es.c - and remote-st2000.c to remote-st.c for 14-char filenames. - config/m68k/{es1800,st2000}: Use the new names. - - * mips-tdep.c (isa_NAN): Don't return true on -0. - -Fri Jun 11 10:24:35 1993 Fred Fish (fnf@cygnus.com) - - * defs.h (INT_MAX): Cast unsigned shift result to int. - -Thu Jun 10 13:26:41 1993 Fred Fish (fnf@cygnus.com) - - * elfread.c (elf_symtab_read): Add bfd section address to bfd - symbols, now that they are section relative. - * solib.c (bfd_lookup_symbol): Ditto. - -Thu Jun 10 11:27:34 1993 Jeff Law (law@snake.cs.utah.edu) - - * hpread.c (read_hp_function_type): Adjust SYMBOL_VALUE for - arguments in the stack by the size of the current function's stack - (found in the unwind descriptor). - (process_one_debug_symbol): Likewise. Keep track of the current - function's unwind descriptor. - -Thu Jun 10 10:56:56 1993 Jim Kingdon (kingdon@cygnus.com) - - * Makefile.in (depend): Add bfd -I's for paread.c and xcoffexec.c - depend: Updated accordingly. - -Wed Jun 9 16:08:44 1993 Jim Kingdon (kingdon@cygnus.com) - - * Makefile.in (*.tab.c): Use mv for atomic update. - - * Makefile.in ({dist,real}clean): Also remove nm.h. - (realclean): Also remove ${TESTS}, y.output, yacc.{acts,tmp}. - (distclean): Don't rebuild *.tab.c or TAGS. - -Wed Jun 9 12:56:58 1993 K. Richard Pixley (rich@cygnus.com) - - * Makefile.in (version.c): add host and target names to version.c. - * main.c (main): print three periods for the elipse. - (print_gdb_version): also print configuration. - - * udi/udiids.h, udi/udip2soc.c, udi/udiphcfg.h, udi/udiphunix.h, - udi/udiproc.h, udi/udipt29k.h, udi/udiptcfg.h, udi/udisoc.h, - udi/udr.c: Change AMD copyrights to FSF copyleft '93. - - * remote-eb.c (get_hex_regs, eb_fetch_registers), remote-adapt.c - (get_hex_regs, adapt_fetch_registers): cast args to - supply_register to avoid gcc warning. - - * config/a29k/a29k.mt (TDEPFILES): drop minimon support. It - doesn't compile on solaris and is now obsolete. - - * config/sparc/sun4os4.mh (XM_CLIBS): remove -lresolv. This - breaks stock sunos installations. - -Wed Jun 9 06:14:33 1993 Jim Kingdon (kingdon@cygnus.com) - - * m68k-stub.c: Add comment about frame cache. - - * target.h (target_store_registers): Doc fix re error handling. - - * findvar.c (write_register): Call SWAP_TARGET_AND_HOST regardless - of register_valid[regno]. - -Tue Jun 8 14:42:10 1993 Jim Kingdon (kingdon@rtl.cygnus.com) - - * symtab.h, dwarfread.c: Doc fix re dependencies. - -Tue Jun 8 17:54:09 1993 Rob Savoye (rob@rtl.cygnus.com) - - * serial.c (serial_close): If scb is NULL, don't try to close - it. - * configure.in: Add support for rom68k and bug boot monitors. - -Tue Jun 8 17:39:12 1993 Steve Chamberlain (sac@phydeaux.cygnus.com) - - * coffread.c (init_stringtab): Fix bug where sizeof(long) != 4. - * gdbcore.h, core.c (read_memory_unsigned_integer): New function. - * findvar.c (read_register, write_register): Fix thinko where - sizeof(host long) != sizeof(target int). - * h8300-tdep.c: Use new read_memory_unsigned_integer call. - * sh-tdep.c (_initialize_sh_tdep): Add memory_size command. - -Tue Jun 8 14:42:10 1993 Jim Kingdon (kingdon@rtl.cygnus.com) - - * Move config/m68k/tm-m68k.h (FRAME_FIND_SAVED_REGS) to - m68k-tdep.c (m68k_find_saved_regs). Don't duplicate code between - 68881 and non-68881 cases. Check for a pair of movel instructions. - -Tue Jun 8 14:52:55 1993 K. Richard Pixley (rich@sendai.cygnus.com) - - First cut at sparc-vxworks targetting. - * config/sparc/tm-vxsparc.h, config/sparc/vxsparc.mt: new files. - * configure.in: sparc-vxworks gdb_target now vxsparc. - - * remote-eb.c, remote.c: symfile.h requires bfd.h so include it. - -Tue Jun 8 14:42:10 1993 Jim Kingdon (kingdon@rtl.cygnus.com) - - * config/m68k/xm-news.h: add "extern int errno". - -Tue Jun 8 13:45:07 1993 K. Richard Pixley (rich@sendai.cygnus.com) - - * remove-vx.c (vx_read_register, vx_write_register): collapse - ifdef I80960 else (assumes) m68k into parameterizable macros - VX_NUM_REGS and VX_SIZE_FPREGS. - * config/m68k/tm-vx68.h, config/i960/tm-vx960.h (VX_NUM_REGS, - VX_SIZE_FPREGS): new definitions. - -Tue Jun 8 11:08:29 1993 Jim Kingdon (kingdon@cygnus.com) - - * symfile.{c,h} (generic_load): New function. - remote{,-nindy,-eb,-mips}.c: Use it. - -Mon Jun 7 20:07:30 1993 Stu Grossman (grossman@cygnus.com) - - * Makefile.in (depend): More sed gubbish to deal with - ../bfd/bfd.h being generated during the build. - * depend: Re-done with corrected makefile. - -Mon Jun 7 16:32:05 1993 Fred Fish (fnf@cygnus.com) - - * Makefile.in (BFD_SRC_DIR): Renamed def and usages from BFD_DIR. - * Makefile.in (BFD_OBJ_DIR): New definition for the bfd build - directory to find automatically generated header files and library. - * Makefile.in (BFD_LIB): Use BFD_OBJ_DIR. - * Makefile.in (LINTFLAGS): Include BFD_OBJ_DIR. - * Makefile.in (saber_gdb): Include BFD_OBJ_DIR. - * Makefile.in (depend): Include BFD_OBJ_DIR in gcc args. - * Makefile.in (paread.o, xcoffexec.o): Remove, now in depend. - * depend, alldeps.mak: Rebuild after Makefile.in changes. - -Fri Jun 4 10:18:51 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * configure.in: change lynx support to CPU-*-lynxos* - - * Makefile.in (subdir_do): change test from existence of directory - to existence of Makefile (the directory may exist but not be configured) - -Thu Jun 3 01:18:51 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * config/sparc/xm-sun4sol2.h: define MEM_FNS_DECLARED - -Fri Jun 4 10:43:33 1993 Ian Lance Taylor (ian@cygnus.com) - - * configure.in (mips-idt-ecoffl*): New target; use idtl. - (mips-idt-ecoff*): Added trailing '*'. - * config/mips/idtl.mt: New file; like idt.mt, but little endian. - -Thu Jun 3 17:36:56 1993 Stu Grossman (grossman@cygnus.com) - - * ser-go32.c: Clean up lots of compilation nits. - -Thu Jun 3 14:44:57 1993 Stu Grossman (grossman@cygnus.com) - - * Patches from Jeffrey Law . - * hppab-nat.c: Eliminate unnecessary ifdefs for - FETCH_INFERIOR_REGISTERS, CANNOT_FETCH_REGISTER, and - CANNOT_STORE_REGISTER. - (fetch_register): Delete code to handle CANNOT_FETCH_REGISTER. - * hppa-pinsn.c: Support 'I', 'J', and 'K' in output - templates for 1.1 FP computational instructions. - -Thu Jun 3 03:34:49 1993 Stu Grossman (grossman@cygnus.com) - - * Makefile.in: Remove ser-tcp.[co]. (Use XDEPFILES instead.) - * alldeps.mak, depend: Rebuild to account for ser-tcp. - * config/sparc/sun4os4.mh: Add ser-tcp to XDEPFILES. - * gdbserver/Makefile.in (gdbserver): Use -lbsd. - * gdbserver/remote-inflow{-sparc}.c (create_inferior): Don't use a - shell when running the child, as args have been expanded by the - time we get here. Simplify calling convention. - * gdbserver/remote-server.c (main): Use new calling convention - for create_inferior, remove defunct code for coalescing argv. - Remove extra calls to mywait(), as we no longer have to wade - through a shell. - - * target.c (target_read_memory_partial): Don't deref errnoptr - when checking for null pointer. - -Wed Jun 2 19:58:46 1993 John Gilmore (gnu@cygnus.com) - - * remote-es1800.c: Fix typo. - -Tue Jun 1 21:22:39 1993 Fred Fish (fnf@cygnus.com) - - * target.c (target_read_memory_partial): Like target_read_memory, - but does partial reads, such as reads that bump into the end of - the address space. - * target.h (target_read_memory_partial): Add prototype. - * valprint.c (PRINT_MAX_DEFAULT): New define, initial value 200. - * valprint.c (val_print_string): Complete rewrite to fix bug with - bumping into end of memory, avoiding unnecessarily long reads, and - fixing bug when print_max is set to 0 (unlimited print length). - * valprint.c (_initialize_valprint): Use PRINT_MAX_DEFAULT to - initialize print_max. - -Tue Jun 1 18:11:35 1993 Rob Savoye (rob at darkstar.cygnus.com) - - * configure.in: Add support for rom68k and bug boot monitors. - -Mon May 31 10:37:04 1993 Jim Kingdon (kingdon@cygnus.com) - - * printcmd.c (print_scalar_formatted): Print integers bigger than - LONGEST in hex no matter how big, and no matter what the format - and size. - - * stabsread.c (read_type): Skip type attributes if present. - - * stabsread.c (read_huge_number): Don't accept '0' + radix as part - of number, just through '0' + radix - 1. - -Sun May 30 15:35:21 1993 Fred Fish (fnf@cygnus.com) - - * Makefile.in (SER_HARDWIRE): Temporarily comment out ser-tcp.o. - - * {dbxread.c, dwarfread.c} (read_ofile_symtab): Rewrite to take - single parameter, the pointer to the partial symtab, rather than - a bunch of args that are derived from the partial symtab. Change - prototypes and callers to match. - - * dbxread.c (read_ofile_symtab): Remove "#if 1" around code to - set demangling style automatically. - * defs.h (CPLUS_MARKER): Clarify comment that this is only for - GNU C++, not C++ in general. - * symtab.h (general_symbol_info): Simplify by eliminating one - structure level for the language dependent info. - -Sat May 29 15:59:29 1993 Fred Fish (fnf@cygnus.com) - - * c-typeprint.c (c_type_print_base): Avoid dereferencing NULL - names for TYPE_CODE_STRUCT and TYPE_CODE_UNION types. - TYPE_CODE_ENUM was already testing for this. - -Fri May 28 17:18:05 1993 Stu Grossman (grossman@cygnus.com) - - * Makefile.in: Add new file ser-tcp.c. - * defs.h (memcmp): Add decl for memcmp to #ifndef MEM_FNS_DECLARED. - * findvar.c (write_register): See if we are writing back the same - value that's already in the register. If so, don't bother. - * remote.c (putpkt, getpkt): Improve handling of communication - problems. - * ser-go32.c: Prototype it to death. Update serial_ops and add - dummy routines where appropriate. - * ser-tcp.c: New module to implement serial I/O via TCP - connections. - * ser-unix.c: Clean up getting/setting of tty state. Get rid of - SERIAL_RESTORE, add SERIAL_{GET|SET}_TTY_STATE interfaces. - * serial.c: Add start of support for connect command. - (serial_open): Distinguish between tcp and local devices. - * serial.h (struct serial_ops): Get rid of restore, add - get_tty_state and set_tty_state. Define protoypes and macros for - this mess. - * gdbserver/remote-utils.c: Add tcp support. (readchar): Do - some real buffering. Handle error conditions gracefully. - * gdbserver/remote-inflow-sparc.c: Update to remote-inflow.c - (Lynx), remove lots of cruft. - -Fri May 28 17:24:51 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * printcmd.c (print_address_symbolic): turn this into an assigment - instead of an initialization (many compilers don't accept - structure initialization). - -Thu May 27 16:56:25 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * xcoffread.c (read_xcoff_symtab): If several program csects in one - source file, give them all the name of the source file, rather than - the 2nd and subsequent ones having NULL names. - -Thu May 27 06:16:56 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * printcmd.c (print_address_symbolic): Append source filename and - linenumber of the symbol if print symbol-filename is on. - (initialize_printcmd): `set print symbol-filename'. - -Wed May 26 13:46:16 1993 Stu Grossman (grossman@cygnus.com) - - * configure.in: Add config for Lynx target. Configure gdbserver - only for Lynx. Re-do selective configuration of sparclite. - - * gdbserver/{remote-gutils.c remote-server.c Makefile.in - configure.in remote-inflow.c remote-utils.c}: New files to - support GDB remote server. Currently only works for Lynx. - -Wed May 26 10:28:14 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * stabsread.c (define_symbol, case 't'): Only set the name if it - is not a pointer type. - - * stabsread.c (define_symbol): Clean up logic; move the read_type - calls to inside the switch statement (this improves the error - handling). - - * mipsread.c (parse_symbol, parse_partial_symbols): Deal with Fortran - common blocks. - -Tue May 25 20:44:24 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * printcmd.c (print_formatted, case 'i'): Pass a tab to wrap_here. - - * source.c (line_info): Change "pc" to "address" in messages and - use print_address for addresses. - - * source.c (line_info): If we don't find a symtab, print more useful - output, including the symbolic address. - - * source.c (line_info): If --fullname, display the source. - (identify_source_line), callers: Take pc as argument, rather than - assuming innermost frame (emacs doesn't use this, so no one ever - noticed). - * symtab.h: Declare frame_file_full_name. - * main.c: Don't. - -Tue May 25 15:30:43 1993 Brendan Kehoe (brendan@lisa.cygnus.com) - - * breakpoint.c (catch_command_1): Fix typo in error msg. - -Tue May 25 16:05:55 1993 Ken Raeburn (raeburn@cambridge.cygnus.com) - - * elfread.c (elf_symfile_read): Update ELF structure and routine - names to specify 32-bit versions. - (elf_symtab_read): Retrieve size field directly from symbol, - instead of using old kludge. - - * mips-pinsn.c (print_insn): Cast address to bfd_vma before - calling opcodes library. - * z8k-tdep.c (print_insn): Likewise. - -Tue May 25 13:06:28 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * stabsread.c: Remove all uses of error(). Make error_type and - read_type_number static. - (define_symbol): Don't try to deal with a missing symbol - descriptor which isn't followed by digit, '(', or '-'. - * stabsread.h: Don't declare read_type_number here. - * gdbtypes.h: Don't declare error_type here. - * xcoffread.c: Remove NO_TYPEDEFS code. - -Tue May 25 09:33:16 1993 Ian Lance Taylor (ian@cygnus.com) - - * mips-tdep.c: Removed #include of many header files, and #define - of MIPSMAGIC; no longer used. - -Tue May 25 09:36:13 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Many places: replace "the inferior" in messages with "the program" - or "the program being debugged". - * inflow.c (try_writing_regs): Remove; it's been #if 0'd forever - and I'm getting sick of maintaining it. - - * config/i386/linux.mh: Don't use \ newline; the awk scripts don't - support it. - - * config/i386/go32.mh: Define SER_HARDWIRE. - * Makefile.in: Define SER_HARDWIRE. - (DEPFILES): Use it. - (alldeps.mak): Add SER_HARDWIRE. - Remove all references to ser-hardwire.{c,o}. - * configure.in: Remove all ser_hardwire and gdb_serial_driver stuff. - -Mon May 24 23:50:05 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * sparc-nat.c (store_inferior_registers): Fill in all members of - inferior_fp_registers by reading them from the inferior before - modifying and writing them back. - Fixes unexplainable inferior FP exceptions after calls to the inferior - or setting of floating point registers. - * mips-tdep.c (mips_skip_prologue): Skip move of argument register - to register which is generated by gcc-2.4. - -Tue May 25 00:42:39 1993 Ken Raeburn (raeburn@cygnus.com) - - * hppa-pinsn.c: Define OLD_TABLE before including opcode/hppa.h. - -Mon May 24 13:55:14 1993 Stu Grossman (grossman@cygnus.com) - - * config/i386/{i386lynx.mh i386lynx.mt nm-i386lynx.h tm-i386lynx.h - xm-i386lynx.h}: New configuration for Lynx. - -Mon May 24 10:01:10 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * mipsread.c (parse_symbol): Deal with scVar and scVarRegister. - * symtab.h: Comment that LOC_REGPARM_ADDR can be call by reference. - - * c-typeprint.c (c_type_print_base): Don't print typedef'd names - as struct, union, or enum tags. - -Mon May 24 01:10:01 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * symmisc.c (dump_msymbols): Avoid gdb coredump with stripped - executable. - -Sat May 22 10:03:09 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * infrun.c (wait_for_inferior), - infcmd.c (program_info, signal_command): Use symbolic signal names. - - * inftarg.c (child_wait): Deal with EINTR and include message from - strerror if printing an error message. - - * main.c (command_line_input): Use STOP_SIGNAL not SIGTSTP. - - * stabsread.c: Remove most uses of lookup_fundamental_type. - (define_symbol): Use read_type for type of enum constant, - not just read_type_number. Also don't call error(). - (define_symbol): For unrecognized constant type, one complaint (the - one from error_type) is enough. Don't make our own in addition. - (define_symbol): Don't treat an N_FUN 'R' as a prototype. - * gdbtypes.h: Doc fixes. - -Sat May 22 03:33:07 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - Fix stack unwinding through _sigtramp on Irix. These patches are from - Paul Flinders . - * mipsread.c (fixup_sigtramp): Find _sigtramp on Irix even when the - executable uses sigvec. - * mips-tdep.c (read_next_frame_reg): Allow tm-file to override - sigcontext offsets. - * config/mips/tm-irix3.h: Add sigcontext offsets for Irix. - -Sat May 22 00:39:01 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * infrun.c (wait_for_inferior): Clear stop_signal if it should not - be passed to the inferior to make "handle nopass nostop" work. - -Sat May 22 00:21:41 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * config/mips/tm-irix3.h: Clean up, use tm-bigmips.h and redefine - the necessary bits. - * findvar.c (value_from_register): Fix uninitialized first_addr - which caused problems with assignment of doubles to register variables - on some targets. - * mipsread.c: Remove TM_FILE_OVERRIDE, include tm.h and provide the - missing mips definitions if necessary. - - Fix handling of double register variables for mips targets and big - endian hosts. These patches are from Paul Flinders . - * config/mips/tm-mips.h: Increase MAX_REGISTER_{RAW,VIRTUAL}_SIZE to - 8 bytes for doubles. - * config/mips/tm-mips.h (REGISTER_CONVERT_TO_TYPE): New macro for - conversion of type held in multiple registers to host format. - * config/mips/tm-mips.h (REGISTER_CONVERT_FROM_TYPE): New macro, - companion to REGISTER_CONVERT_TO_TYPE. - * config/mips/tm-mips.h (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE): - Convert to function calls. - * config/mips/tm-mips.h (FIX_CALL_DUMMY): New code for big endian - mips targets. - * mips-tdep.c (mips_print_register): Raw buffer now needs just - MAX_REGISTER_RAW_SIZE bytes. - * mips-tdep.c (mips_print_register): Use REGISTER_CONVERT_TO_TYPE - (if defined) for doubles. - * mips-tdep.c: (mips_extract_return_value, mips_store_return_value): - New functions, take care of REGISTER_CONVERT_TO/FROM_TYPE. - * valops.c (value_assign): Use REGISTER_CONVERT_TO_TYPE if - defined. - * findvar.c (value_from_register): Use REGISTER_CONVERT_TO_TYPE if - defined. - -Fri May 21 09:04:25 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * configure.in: Add i[34]86-*-isc*. - - * stabsread.c: Make sure all complain() pass the address of the struct. - - * xcoffread.c: Make sure all struct complaints are static not auto. - - * Makefile.in: Add rule for xcoffexec.o like that for paread.o. - - * xcoffread.c (process_xcoff_symbol, case C_LSYM): Use define_symbol. - -Wed May 19 12:33:59 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config/i386/linux.mh: Re-enable coredumps now that they should work. - -Wed May 19 15:44:20 1993 K. Richard Pixley (rich@cygnus.com) - - * config/m68k/tm-m68k.h (FRAME_CHAIN): add missing close paren. - -Wed May 19 15:33:57 1993 Stu Grossman (grossman@cygnus.com) - - * config/pa/nm-hppab.h: Comment PTRACE_ARG3_TYPE. - -Wed May 19 12:33:59 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Makefile.in (INSTALLED_LIBS): New variable. - -Tue May 18 14:08:50 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * main.c (quit_command): In the "quit anyway?" message, tell the user - whether we are planning to detach or kill the program. - - * config/vax/vaxbsd.mh: Add "NAT_FILE= nm-vax.h". - * config/vax/xm-vaxbsd.h: Use not - - * infcmd.c (read_pc): Doc fix. - - * printcmd.c (print_address_symbolic): Use %u not %d for offset. - - * blockframe.c (get_prev_frame_info): If pc in sigtramp, set - signal_handler_caller. - * tm-68k.h (FRAME_{CHAIN,SAVED_PC}): Deal with sigtramp. - * tm-hp300bsd.h: Define SIGTRAMP_{START,END} not IN_SIGTRAMP. - * inferior.h (IN_SIGTRAMP): Definition moved from infrun.c. - Use SIGTRAMP_START if defined. - * infcmd.c (step_1): Use SIGTRAMP_{START,END} if needed. - * infrun.c (wait_for_inferior): Check IN_SIGTRAMP before SKIP_PROLOGUE. - - * infptrace.c: Remove unused KERNEL_U_ADDR_HPUX code. - - * infcmd.c (step_1): Fix poorly worded error message. - - * config/{i386/linux.mh,m68k/isi.mh} (NATDEPFILES): - Comment out corelow.c because core dumps are broken on these machines. - - * Makefile.in (depend): Put "${srcdir}" in generated dependencies - if srcdir is not ".". - Also put in -I${BFD_DIR} or -I${READLINE_DIR} for files which need it. - (INCLUDE_CFLAGS): Remove BFD_DIR and READLINE_DIR. - * depend: Update to latest automatically built version. - -Tue May 18 08:10:45 1993 Fred Fish (fnf@cygnus.com) - - * ChangeLog, ChangeLog-92: Split ChangeLog at 1993. - * Makefile.in (NONSRC): Add ChangeLog-92 - -Tue May 18 08:03:37 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * findvar.c ({read,write}_register): Use REGISTER_RAW_SIZE - not typo RAW_REGISTER_SIZE. - - * frame.h, inferior.h: Doc fixes. - -Mon May 17 15:43:03 1993 Stu Grossman (grossman@cygnus.com) - - * findvar.c (write_register): Add sanity check for register size. - (read_register): Fixup sanity check for register size to be - consistent with write_register(). - -Mon May 17 07:36:20 1993 Ian Lance Taylor (ian@cygnus.com) - - * sparclite/Makefile.in: Add dummy info, install and install-info - targets. - -Thu May 13 07:30:22 1993 Ian Lance Taylor (ian@cygnus.com) - - * remote-nindy.c: Removed declaration of coffstrip. - * nindy-share/nindy.c: #if 0 coffstrip routine; no longer used. - -Wed May 12 00:35:19 1993 Fred Fish (fnf@cygnus.com) - - * Makefile.in (VERSION): Bump to 4.9.1 after release and cvs - tagging. - - * Makefile.in (VERSION): GDB 4.9 release. - -Tue May 11 08:04:41 1993 Fred Fish (fnf@cygnus.com) - - * README: Update known bugs to include the Solaris bug that - leaves core dumps in the current directory when restarting the - inferior with "run". Expand on the testsuite information. - - * Makefile.in (VERSION): Bump to 4.8.96 for what should hopefully - be the last 4.9 prerelease test archive. - -Mon May 10 22:13:23 1993 Jim Kingdon (kingdon@cygnus.com) - - * config/m68k/xm-hp300bsd.h: Include to avoid INT_MAX - redefined warnings. - -Mon May 10 20:00:43 1993 Fred Fish (fnf@cygnus.com) - - * README, NEWS: Update for gdb 4.9 release. - -Mon May 10 19:38:34 1993 John Gilmore (gnu@cygnus.com) - - * ch-exp.y (MAX, MIN): Rename to MAX_TOKEN, MIN_TOKEN. - * target.c (MIN): #undef before defining. - -Mon May 10 16:03:03 1993 Jim Kingdon (kingdon@cygnus.com) - - Patch from Jeffrey Law: - * gdb/config/pa/nm-hppab.h (PTRACE_ARG3_TYPE): Define as caddr_t. - -Mon May 10 15:28:27 1993 Ian Lance Taylor (ian@cygnus.com) - - * hppa-tdep.c (hppa_push_arguments): Allocate correct amount of - memory. - -Mon May 10 13:14:46 1993 Fred Fish (fnf@cygnus.com) - - * ch-exp.y (start): Apply work-around to avoid bison warning. - -Sun May 9 07:25:02 1993 Fred Fish (fnf@cygnus.com) - - * Makefile.in (BISON): Remove double quotes around BISON - definition when bison is used. - - * configure.in (hppa*-hp-bsd): Change to hppa*-hp-bsd* - * configure.in (hppa*-hp-hpux): Change to hppa*-hp-hpux* - * configure.in (m68*-hp-bsd): Change to m68*-hp-bsd* - * configure.in (m68*-hp-hpux): Change to m68*-hp-hpux* - * configure.in (hppa*-*-bsd): Change to hppa*-*-bsd* - * configure.in (hppa*-*-hpux): Change to hppa*-*-hpux* - * configure.in (m68*-hp-bsd): Change to m68*-hp-bsd* - * configure.in (m68*-hp-hpux): Change to m68*-hp-hpux* - - * Makefile.in (VERSION): Bump to 4.8.6. - -Sat May 8 12:36:03 1993 Fred Fish (fnf@cygnus.com) - - * config/pa/xm-hppah.h (MALLOC_INCOMPATIBLE): Define it, and - include declarations for malloc/realloc/free. Both malloc and - realloc return 'void *' for non-ANSI compilations. - -Sat May 8 01:39:30 1993 (pes@regent.e-technik.tu-muenchen.de) - - * coffread.c (read_coff_symtab): Don't fclose stream as it is no - longer opened twice. - -Thu May 6 21:08:55 1993 Jim Kingdon (kingdon@cygnus.com) - - * solib.c (clear_solib): Don't close bfd if it is NULL. - -Thu May 6 20:55:35 1993 Fred Fish (fnf@cygnus.com) - - * core.c (dis_asm_read_memory): Cast second arg of - target_read_memory to "char *". - * breakpoint.c (watchpoint_check): Change arg type from PTR to - "char *", to match other functions called by catch_errors(). - -Thu May 6 15:47:45 1993 Stu Grossman (grossman@cygnus.com) - - * More patches from Jeffrey Law (law@cs.utah.edu). - * gdb/config/nm-hppab.h (PTRACE_ARG3_TYPE): Define as caddr_t. - * gdb/config/pa/tm-hppah.h (millicode_start, millicode_end): - Delete unnecessary declarations. - -Thu May 6 15:15:46 1993 Stu Grossman (grossman@cygnus.com) - - * ser-unix.c (wait_for): Use VTIME to do timeouts instead of - poll() for termio{s}. - -Thu May 6 10:03:41 1993 Jim Kingdon (kingdon@cygnus.com) - - * i386-tdep.c (i386_frame_num_args): Always return -1. - -Wed May 5 15:16:33 1993 Stu Grossman (grossman@cygnus.com) - - * Patches from Jeffrey Law . - * gdb/hppa-tdep.c: Declare frame_saved_pc. - (frameless_function_invocation): New function. - (frame_saved_pc, init_extra_frame_info): Use - frameless_function_invocation. - * gdb/config/pa/tm-hppa.h (SAVED_PC_AFTER_CALL): Use saved_pc_after - call instead of just grabbing the value currently in %r2. - (FRAMELESS_FUNCTION_INVOCATION): Use frameless_function_invocation. - * gdb/config/pa/tm-hppah.h (SAVED_PC_AFTER_CALL): Delete private - definition and use the common one in tm-hppa.h. - * gdb/hppa-tdep.c (frame_chain_valid): If "use_unwind" is true, then - use unwind descriptors to determine if the frame chain is valid. - * gdb/hppa-tdep.c (find_dummy_frame_regs): Rework so that - it does not assume %r4 is the frame pointer. - * gdb/hppa-pinsn.c (print_insn): Handle 'r' and 'R' for break, rsm, - and ssm instructions. - * gdb/hppa-tdep.c (extract_5r_store, extract_5R_store): New - helper functions for print_insn. - * gdb/hppa-tdep.c (gcc_p, hpux_cc_p): Delete unused functions. - * gdb/config/pa/tm-hppa.h (ABOUT_TO_RETURN): Handle a return - which nullifies the following instruction. - -Tue May 4 12:11:38 1993 Jim Kingdon (kingdon@cygnus.com) - - * infptrace.c [FIVE_ARG_PTRACE]: Define ptrace to call_ptrace and - pass the 5th arg there, rather than using an ANSI C-specific macro. - - * Makefile.in (depend): Don't include ${CC} command for *.tab.c. - -Tue May 4 19:33:12 1993 Fred Fish (fnf@cygnus.com) - - * Makefile.in (VERSION): Bump to 4.8.5 - * Makefile.in (INCLUDE_CFLAGS): Add BFD_DIR and READLINE_DIR - directories to include search path. - * Makefile.in (CLIBS, CDEPS, ADD_FILES, ADD_DEPS): Clean up - whitespace. - * Makefile.in (depend): For gcc -MM line, use INTERNAL_CFLAGS - * Makefile.in (main.o, dbxread.o, coffread.o, mipsread.o, - elfread.o, dwarfread.o, stabsread.o, xcoffread.o, xcoffexec.o, - xdr_ld.o, xdr_rdb.o, nindy.o, Onindy.o, ttybreak.o, ttyflush.o, - udr.o, udip2soc.o): Remove explicit rules, use the ones that - are automatically generated in "depend". - * Makefile.in (paread.o): Document why a dependency doesn't get - automatically generated in "depend" and leave this explicit rule - in for now (FIXME). - * depend: Update to latest automatically generated version. - -Tue May 4 12:11:38 1993 Jim Kingdon (kingdon@cygnus.com) - - * xcoffread.c: Doc fix. - - * Makefile.in (depend): Include $(CC) command in generated output. - -Mon May 3 22:51:05 1993 Fred Fish (fnf@cygnus.com) - - * Makefile.in (NONSRC): Remove ${srcdir}/putenv.c. - * Makefile.in (SFILES): Add ${srcdir}/putenv.c. - * depend: Update to latest automatically built version. - -Mon May 3 19:20:20 1993 Stu Grossman (grossman@cygnus.com) - - * sparclite/Makefile.in: Create default target that does nothing - in order to force user to build by hand. - - * sparclite/Makefile: Remove. It's not necessary anymore. - - * ser-unix.c (wait_for): New routine to handle read timeouts, - etc. Uses poll() if HAVE_TERMIO[S] is defined, select() otherwise. - -Mon May 3 13:52:08 1993 Ian Lance Taylor (ian@cygnus.com) - - * mips-pinsn.c (print_insn): Return value. - -Sun May 2 11:43:57 1993 Fred Fish (fnf@cygnus.com) - - * Makefile.in (SFILES): Remove ser-hardwire.c; it is a link made - at configuration time and doesn't belong in the distribution archive. - - * Makefile.in (NONSRC): Add 29k-share/README. - * Makefile.in (HFILES): Add 29k-share/udi/udiids.h. - - * defs.h (UINT_MAX, LONG_MAX, INT_MAX, INT_MIN): Replace hex - constants with slightly more portable definitions (still depends - on 2's complement arithmetic though). - * config/i386/nm-linux.h: Define NO_SYS_REG_H for no . - * i386v-nat.c (sys/reg.h): Conditionalize include on - NO_SYS_REG_H. Linux doesn't have . - * ser-unix.c (termio.h): Include like other files that - include termio.h, not which may not exist (on - linux for example). - -Sat May 1 16:05:24 1993 Fred Fish (fnf@cygnus.com) - - * valprint.c (print_longest): Change format parameter from a - 'char' to an 'int'. We can't have 'char' parameters with the - current coding style, where we mix prototypes with pre-ANSI - style declarations. - * value.h (print_longest): Change format parameter in prototype - from a 'char' to an 'int'. - -Sat May 1 02:47:20 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * config/mips/tm-mips.h (STAB_REG_TO_REGNUM): Match it with the gcc - definition. - * config/mips/tm-irix3.h (STAB_REG_TO_REGNUM): Add. - * irix4-nat.c (fill_fpregset): Fix bug with indexing into fpregsetp. - -Fri Apr 30 17:45:32 1993 Stu Grossman (grossman@cygnus.com) - - * The following patches are from Jeffrey Law . - * config/pa/hppabsd.mh: Add more files to NATDEPFILES. - * config/pa/xm-hppa[bh].h: Define FIVE_ARG_PTRACE. - * hppab-nat.c: Delete WANT_NATIVE_TARGET ifdefs. - ptrace needs 5 arguments, #define ptrace to always - pass zero as the 5th argument. - -Fri Apr 30 15:54:13 1993 Steve Chamberlain (sac@thepub.cygnus.com) - - * configure.in: Match z8k-*-sim for z8000. - * config/h8500/tm-h8500.h, h8500-tdep.c: Lint. - * remote-hms.c: Update to use new serial protocol. - -Fri Apr 30 16:50:38 1993 K. Richard Pixley (rich@rtl.cygnus.com) - - * mips-tdep.c: remove include of sys/dir.h. Doesn't seem - necessary and Solaris doesn't have it. - - * Makefile.in (clean-info, install, install-info, info, dvi, - check, all): do not echo recursion lines. - - * 29k-share/udip2soc.c (UDIConnect): replace union wait with int. - - * config/sparc/sun4sol2.mh (XM_CLIBS): add -lsocket which is - required target ports which use sockets (like a29k-udi). - - * remote-udi.c (udi_wait): Use SIGURG, as Solaris doesn't have SIGLOST. - -Fri Apr 30 11:05:42 1993 Jim Kingdon (kingdon@cygnus.com) - - * ser-unix.c [USE_{TERMIO,ALARM}_TIMEOUT]: New code to deal with - systems lacking select(). - - * Makefile.in (TAGS): Doc fix. Deal with empty DEPFILES. - -Fri Apr 30 10:06:46 1993 Fred Fish (fnf@cygnus.com) - - * alldeps.mak, depend: Update with latest automatically built - versions. - -Thu Apr 29 12:03:23 1993 Fred Fish (fnf@cygnus.com) - - * Makefile.in (SFILES): Add ser-unix.c and ser-go32.c. - - * Makefile.in (make-proto-testsuite.dir): New target to make - prototype testsuite tree. - - * Makefile.in (VERSION): Bump to 4.8.4. - -Thu Apr 29 08:46:22 1993 Jim Kingdon (kingdon@cygnus.com) - - * stabsread.c (define_symbol): If unrecognized constant type, - complain() not error(). - -Thu Apr 29 00:03:59 1993 Fred Fish (fnf@cygnus.com) - - * infptrace.c: Add missing close paren to test for - FIVE_ARG_PTRACE defined. - - * defs.h (CC_HAS_LONG_LONG): Set up to define CC_HAS_LONG_LONG - when compiling with gcc, but disable it for now. See comment. - * defs.h (LONGEST): Define as either "long" or "long long" - based on CC_HAS_LONG_LONG. - * defs.h (longest_to_int): Use CC_HAS_LONG_LONG to control - how longest_to_int is defined. - * c-valprint.c (c_val_print): Call print_longest. - * expprint.c (dump_expression): Use PRINTF_HAS_LONG_LONG - instead of LONG_LONG. - * {printcmd.c, gdbtypes.h} (LONG_LONG): Replace usages with - CC_HAS_LONG_LONG. - * printcmd.c (print_scalar_formatted): Call print_longest - and let it figure out what to do for PRINTF_HAS_LONG_LONG. - * typeprint.c (print_type_scalar): Call print_longest and let - it figure out what to do for PRINTF_HAS_LONG_LONG. - * valprint.c (val_print_type_code_int): Call print_longest - and let it figure out what to do for PRINTF_HAS_LONG_LONG. - * stabsread.c (LONG_LONG): Replace usages with CC_HAS_LONG_LONG. - * value.h (struct value): Replace usage of LONG_LONG with - CC_HAS_LONG_LONG. - * value.h (print_longest): Add prototype. - * values.c (LONG_LONG): Replace usages with CC_HAS_LONG_LONG. - * values.c (unpack_double): Collapse code that was unnecessarily - dependent on CC_HAS_LONG_LONG. Use LONGEST instead of direct types. - * values.c (value_from_longest): Remove dependency on - CC_HAS_LONG_LONG and just use LONGEST. - * solib.c (solib_map_sections): Use bfd_get_filename - to access filename field. - * solib.c (clear_solib): Save filename and free it later, after - bfd_close, since bfd_close may reference it. Use bfd_get_filename - to access the field. - * config/convex/xm-convex.h (LONG_LONG): Replace with - CC_HAS_LONG_LONG. Add define for PRINTF_HAS_LONG_LONG. - * doc/gdbint.texinfo (LONG_LONG): Replace with CC_HAS_LONG_LONG. - Add PRINTF_HAS_LONG_LONG references. - -Wed Apr 28 06:11:38 1993 Jim Kingdon (kingdon@cygnus.com) - - * inflow.c (kill_command), infcmd.c (attach_command), - remote.c (remote_interrupt_twice): In messages for the user, call it - "the program" or "the program being debugged" not "the inferior". - - * hp300ux-nat.c: Cast second arg to supply_register calls. - (_initialize_kernel_u_addr, getpagesize): New functions. - (store_inferior_register_1): Change arg name from value to val. - (fetch_core_registers): Make arg core_reg_size unsigned. - Pass 5 args to ptrace. - * config/m68k/xm-hp300hpux.h: Define FIVE_ARG_PTRACE. - Remove KERNEL_U_ADDR stuff. - * infptrace.c [FIVE_ARG_PTRACE]: Pass 5th arg to ptrace. - * config/m68k/hp300hpux.m{t,h}: - Move exec.o from NATDEPFILES to TDEPFILES - * config/m68k/hp300hpux.mt: Mention GAS requirement. Remove - hp-include stuff. Add m68k-tdep.o to TDEPFILES. - -Wed Apr 28 13:27:54 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * ch-exp.y (yylex): Don't STREQ with simplename if it is NULL. - -Wed Apr 28 06:11:38 1993 Jim Kingdon (kingdon@cygnus.com) - - * config/sparc/xm-sun4os4.h [__STDC__]: Don't use MALLOC_INCOMPATIBLE. - -Wed Apr 28 11:39:18 1993 Roland H. Pesch (pesch@fowanton.cygnus.com) - - * doc/gdb.texinfo: make node "Shell Commands" unconditional; - describe `set demangle-style arm' (not cfront); - mention can type `q' to discard output, when gdb pages - -Wed Apr 28 11:32:39 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * valops.c (search_struct_field): Fix gdb core dump with incomplete - stabs info. - -Wed Apr 28 06:11:38 1993 Jim Kingdon (kingdon@cygnus.com) - - * remote.c: Change timeout to 2. - (remote_open): Use unpush_target not remote_close. - (remote_resume): If siggnal != 0, give warning not error(). - (remote_wait, remote_interrupt, remote_interrupt_twice): - If we get two interrupts, let the user get out if they want. - (remote_{kill,mourn}): New functions. - i386-stub.c (handle_exception, case 'k'): Don't BREAKPOINT. - -Wed Apr 28 09:20:55 1993 Ian Lance Taylor (ian@rtl.cygnus.com) - - * config/sparc/sun4sol2.mh (XM_CLIBS): Define to be -lnsl. - -Wed Apr 28 06:11:38 1993 Jim Kingdon (kingdon@cygnus.com) - - * Remote targets (mourn): Call unpush_target. - - * config/sparc/xm-sun4os4.h: Declare free() to return int. - Remove twisted use of PARAMS. - - * config/rs6000/xm-rs6000.h: Don't define MALLOC_INCOMPATIBLE now - that ansidecl.h assumes ANSI on AIX. - -Tue Apr 27 10:01:33 1993 Jim Kingdon (kingdon@cygnus.com) - - * README: Move most stuff about hacking GDB to doc/gdbint.texinfo. - (Known bugs): Remove AIX bugs, revise SPARC struct bug description. - -Tue Apr 27 13:44:19 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * expprint.c (print_subexp): Fix bug with OP_SCOPE operator output. - -Tue Apr 27 10:01:33 1993 Jim Kingdon (kingdon@cygnus.com) - - * remote-vx.c (net_connect): Allow numeric IP address for host. - -Mon Apr 26 17:59:38 1993 Steve Chamberlain (sac@thepub.cygnus.com) - - * config/sh/sh.mt, config/sh/tm-sh.h, sh-tdep.c: New files. - -Mon Apr 26 07:13:32 1993 Jim Kingdon (kingdon@cygnus.com) - - * rs6000-tdep.c (branch_dest): Deal with stepping through system call. - - * symtab.h, xcoffread.c: Revise linetable sorting comments. - -Sun Apr 25 02:32:16 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * valops.c (value_cast): A cast might also change the object - representation in C++. - * dbxread.c (end_psymtab): Copy subpst read_symtab function from pst - to get the proper read_symtab function when called from mipsread.c. - * mipsread.c (mipscoff_psymtab_to_symtab, psymtab_to_symtab_1): - Set cur_bfd in psymtab_to_symtab_1 as CURBFD(pst) is invalid - for dummy psymtabs, inhibit processing of dummy psymtabs. - -Sat Apr 24 19:59:54 1993 Jim Kingdon (kingdon@cygnus.com) - - * Changes from (or inspired by) AMD: - * remote-udi.c (udi_attach): Assignments to Space and Offset were - switched, fix it. - (udi_wait): Make error message (UDIGetStdout) match error. - (udi_wait): Handle UDIStdinNeeded. - * command.c [CANT_FORK]: Use system(). - * utils.c (prompt_for_continue): Allow quit with 'q'. - - * solib.c (solib_add): Don't call special_symbol_handling if there - were errors in symbol_add_stub. Also set so->from_tty before - calling symbol_add_stub. - -Fri Apr 23 16:17:00 1993 Stu Grossman (grossman@cygnus.com) - - * Merge in HPPA/BSD patches from Utah: - * defs.h: Add const to 2nd arg of psignal prototype. - * hppah-tdep.c: Renamed to hppa-tdep.c 'cuz it's common code with - BSD now. - * hppab-core.c: Deleted. No longer useful. - * hppab-nat.c: #include more files. Use PT_WUREGS, not - PT_WRITE_U. - * hppab-tdep.c: Deleted. Supplanted by hppa-tdep.c. - * config/pa/hppabsd.mh (NATDEPFILES): Remove hppab-core.o. - * config/pa/hppabsd.mt (TDEPFILES): hppab-tdep.o => hppa-tdep.o - * config/pa/hppahpux.mt (TDEPFILES): hppab-tdep.o => hppa-tdep.o - * config/pa/xm-hppab.h: #define SET_STACK_LIMIT_HUGE. - -Fri Apr 23 10:34:02 1993 Stu Grossman (grossman@cygnus.com) - - * Fix two bugs found by deja-gnu. One is the incorrect reporting - of the PC being in a stack dummy when looking at a core file - without symbols. The other is the incorrect passing of char - arguments during expression evaluation (ie: p foo('a','b') would - mess up the passing of it's args because it wasn't coercing the - char's to ints). - * hppah-tdep.c: Rename global functions to have consistent hppa_ - prefix. Make more functions static. Drop hp_ prefix from static - functions. (hppa_push_arguments): Call value_arg_coerce to cast - char to int args if necessary. (hppa_fix_call_dummy): Create - this routine from FIX_CALL_DUMMY macro in tm-hppa.h. - * inferior.h (PC_IN_CALL_DUMMY): Check for frame_address being - valid (ie: != 0) before doing comparison against PC. - * valops.c (call_function_by_hand): Adjust call to FIX_CALL_DUMMY - to reflect new arguments. - * config/pa/tm-hppa.h (POP_FRAME, PUSH_ARGUMENTS): Use new hppa_ - prefix for func name. (FIX_CALL_DUMMY): Move code into - hppah-tdep.c. - - * testsuite/gdb.t16/gdbme.c, testsuite/gdb.t17/gdbme.c: Add calls - to malloc() so that we can test GDB eval of dynamically created - arrays (like char strings in `print "foo"'). - -Fri Apr 23 01:28:14 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * printcmd.c (print_address_symbolic): Search symtabs as well as the - minimal symbols for a nearby symbol. - -Thu Apr 22 19:44:21 1993 John Gilmore (gnu@cacophony.cygnus.com) - - * coffread.c: Comment changes around minimal symbol recording. - -Thu Apr 22 16:24:36 1993 K. Richard Pixley (rich@rtl.cygnus.com) - - * command.c: comment changes only. - - * mips-tdep.c (heuristic_fence_post): new static variable. - (heuristic_proc_start): use heuristic_fence_post, print better - warnings, but only if not stop_soon_quietly. - (_initialize_mips_tdep): add_set_cmd for heuristic-fence-post. - -Thu Apr 22 14:50:05 1993 Jim Kingdon (kingdon@cygnus.com) - - * symtab.h: Fix LOC_REF_ARG comment. - -Wed Apr 22 20:21:30 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - and Jim Kingdon (kingdon@cygnus.com) - - * stabsread.c (define_symbol): Combine a 'p', 'r' arg pair to a - LOC_REGPARM symbol. - * config/sparc/tm-sparc.h (REG_STRUCT_HAS_ADDR): Revise comments. - symfile.c (compare_symbols): Don't check first character; STRCMP - does that. - - * stabsread.c (define_symbol): Generate a LOC_REGPARM_ADDR for - structures that are passed by address in a register. - * symtab.h (enum address_class): Add LOC_REGPARM_ADDR. - * findvar.c (read_var_value), - printcmd.c (address_info, print_frame_args), - stack.c (print_frame_arg_vars), symmisc.c (print_{,partial_}symbol), - * symtab.c (lookup_block_symbol): Deal with it. - -Thu Apr 22 09:07:24 1993 Jim Kingdon (kingdon@cygnus.com) - - * objfiles.h (obj_section), objfiles.c (build_objfile_section_table): - Add objfile field. - * objfiles.c (find_pc_section): Return a struct obj_section *. - * sparc-tdep.c (in_solib_trampoline): Deal with find_pc_section return. - * symfile.c (syms_from_objfile) [IBM6000_TARGET]: - Don't use obj_section hack. - * xcoffexec (vmap_symtab): Relocate obj_sections. - * printcmd.c (containing_function_bounds): Use find_pc_section. - - * symtab.h: Clean up SYMBOL_VALUE comments. - -Wed Apr 21 14:29:57 1993 Jim Kingdon (kingdon@cygnus.com) - - * stack.c (print_frame_arg_vars), printcmd.c (print_frame_args): - Expand comments about LOC_ARG/LOC_LOCAL pairs. - - * coffread.c (read_coff_symtab): Use rewind before fseek. - -Wed Apr 21 14:24:19 1993 Per Bothner (bothner@cygnus.com) - - * ch-exp.y: Removed unused structure_primitive_value and FIXME_23. - * Makefile.in: Add $(YFLAGS) when using $(YACC). - * Makefile.in: Remove message to expect conflicts and unused - rules in ch-exp.y, since there no longer are any such. - -Wed Apr 21 13:27:50 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * stabs.texinfo: fixed bad xrefs (un-initialized statics) - -Tue Apr 20 08:55:11 1993 Jim Kingdon (kingdon@cygnus.com) - - * xcoffexec.c (xcoff_relocate_core): If no exec file, error() - rather than dumping core. - - * Makefile.in: Add ${srcdir}/ to all source files. - (alldeps.mak): Add "${srcdir}/" to files when generating alldeps.mak. - (TAGS): Deal with srcdir and new config directory scheme. - createtags: Remove. - Makefile.in (NONSRC): Remove createtags. - alldeps.mak: Updated. - - * rs6000-tdep.c: Delete unused function print_frame. - - * frame.h (struct frame_info): Doc fix for next_frame. - New field signal_handler_caller. - blockframe.c (create_new_frame, get_prev_frame_info), - config/rs6000/tm-rs6000.h (INIT_EXTRA_FRAME_INFO): Set it (needs - INIT_FRAME_PC_FIRST). - stack.c (print_frame_info), rs6000-tdep.c (rs6000_frame_chain): - Check it. - -Mon Apr 19 22:52:33 1993 Stu Grossman (grossman@cygnus.com) - - * irix4-nat.c (fetch_core_registers): Special version of this for - Irix 4.x, which stores regs a bit differently from other /proc - based systems. - * procfs.c, core-svr4.c: Move fetch_core_registers from procfs.c - to new file core-svr4.c. - * config/i386/i386sol2.mh, config/i386/i386v4.mh, config/m68k/amix.mh, - config/i386/ncr3000.mh, config/sparc/sun4sol2.mh: Add core-svr4.o - to NATDEPFILES. - * config/mips/irix4.mh: Add corelow.o to NATDEPFILES. - -Mon Apr 19 11:13:34 1993 Jim Kingdon (kingdon@cygnus.com) - - * i387-tdep.c: Remove unused #includes. - - * configure.in: Match i[34]86-*-sysv3.2 not i[34]86-*-sysv32. - - * config/i386/nm-i386v.h: Define NO_PTRACE_H. - -Sun Apr 18 10:39:35 1993 Jim Kingdon (kingdon@cygnus.com) - - * xcoffread.c: Nuke NO_DEFINE_SYMBOL code. There is no going back. - - * stabsread.c (define_symbol): 'R' is synonym for 'P', not 'r'. - xcoffread.c (process_xcoff_symbol, case C_RPSYM): - Don't muck with SYMBOL_CLASS. - -Fri Apr 16 17:38:33 1993 Stu Grossman (grossman@cygnus.com) - - * munch: Don't use head command. It doesn't exist everywhere. - -Fri Apr 16 15:07:57 1993 Fred Fish (fnf@cygnus.com) - - * inflow.c (new_tty): Remove spurious 'o' character at end - of #endif line. - -Fri Apr 16 12:27:11 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * mips-tdep.c (mips_skip_prologue): Always skip the typical prologue - instructions and nothing more. - * mipsread.c (add_line): Add comment why we have to combine line number - entries for the same line number. - -Fri Apr 16 09:42:03 1993 Jim Kingdon (kingdon@cygnus.com) - - * symtab.{c,h}: Doc fixes (remove symseg references, last relevant - in gdb 2.8!). - -Thu Apr 15 21:16:58 1993 Fred Fish (fnf@cygnus.com) - - * depend, alldeps.mak: Update, now that gcc -MM bug is fixed. - -Thu Apr 15 12:38:39 1993 Jim Kingdon (kingdon@cygnus.com) - - * source.c (select_source_symtab): Clean up comment. Also, if - we have a current_source_symtab, and s is NULL, return without - doing anything. - xcoffread.c (xcoff_symfile_read): Don't call select_source_symtab. - breakpoint.c (breakpoint_re_set): Don't call select_source_symtab. - -Thu Apr 15 02:37:48 1993 John Gilmore (gnu@cacophony.cygnus.com) - - * dbxread.c (unknown_symchar_complaint): Add new complaint. - * stabsread.h: Declare it. - * partial-stab.h: Use it. - - * utils.c (malloc_botch): Don't forward-declare if NO_MMALLOC. - -Wed Apr 14 17:12:51 1993 Jim Kingdon (kingdon@cygnus.com) - - * stack.c (print_frame_info): Print specially if dummy frame. - - * breakpoint.c: Add comments regarding within_scope future direction. - - * Version 4.8.3. - - * xcoffread.c (record_include_{begin,end}): Change fatal to complain. - -Wed Apr 14 14:03:18 1993 Per Bothner (bothner@cygnus.com) - - * ch-exp.y: Fix thinko that broke parsing of FALSE. - -Wed Apr 14 12:49:29 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * stabsread.c (read_member_functions): Initialize domain for stubbed - member functions to avoid gdb core dumps when printing pointers - to member functions. - * cp-valprint.c (cp_print_class_method): Check for stubbed member - functions. - -Tue Apr 13 08:28:26 1993 Jim Kingdon (kingdon@cygnus.com) - - * expprint.c (print_subexp): If opcode not found in op_print_tab, - stop with an error(). - eval.c (evaluate_subexp): Change error message. - - * objfiles.c (build_objfile_section_table): Cast return value - from obstack_finish. - -Mon Apr 12 10:53:50 1993 Jim Kingdon (kingdon@cygnus.com) - - * config/rs6000/tm-rs6000.h, rs6000-tdep.c: Move FRAME_CHAIN - to rs6000_frame_chain and deal with it if we're in a signal handler. - (FRAME_SAVED_PC): Use rs6000_frame_chain. - - * breakpoint.c (within_scope): New function. - (enable_breakpoint, watchpoint_check): Use it. - - * source.c (openp): Handle "exec-file ./ls" correctly. - - * breakpoint.c (breakpoint_1): Use wrap_here before "at". - -Sat Apr 10 01:32:43 1993 Per Bothner (bothner@rtl.cygnus.com) - - * ch-exp.y: Clean up lexing of identifiers and - reserved words. (E.g. don't recognize FALSEXXX as the - keyword FALSE followed by the identifier XXX.) - Also, convert identifiers to lower case. - -Fri Apr 9 15:53:19 1993 Stu Grossman (grossman@cygnus.com) - - * remote-mips.c, remote-monitor.c, remote-st2000.c: Convert to - new serial interface. - -Fri Apr 9 15:01:12 1993 Stu Grossman (grossman@cygnus.com) - - * remote.c (remote_open): Use SERIAL_OPEN instead of serial_open. - (putpkt, getpkt): Use new return codes for SERIAL_READCHAR. - * ser-go32.c: Return -1 on most failures, 0 on most successes, - and use new return codes for go32_readchar(). - * ser-unix.c: Ditto. Also, move error handling up to caller for - SERIAL_SETBAUDRATE(). - * serial.c (serial_open): Internal call, not SERIAL_OPEN to get - to specific routine. - (serial_close): New routine to wrap around device close routine. - serial.h: Clean & document return values more clearly. - -Fri Apr 9 10:20:55 1993 Jim Kingdon (kingdon@cygnus.com) - - * rs6000-pinsn.c (print_operand): Deal with no operand instructions. - - * rs6000-pinsn.c (print_operand, case LI): Print condition register - operand in decimal rather than wrong textual versions. - - * printcmd.c (_initialize_printcmd): Clean up docstring for "x" - (mention 't', remove false thing about 'g' only good with 'f'). - - * breakpoint.h: move "struct breakpoint" and friends to top of - file so that bpstat_find_breakpoint prototype works. - - * solib.c (struct so_list): Add bfd field. - (solib_map_sections): Leave bfd open and scratch_pathname allocated. - Put the bfd in bfd field of the so_list. - (clear_solib): Free bfd name and close_bfd on the bfd. - -Fri Apr 9 00:45:41 1993 Per Bothner (bothner@rtl.cygnus.com) - - * valarith.c (value_subscript): Add COERCE_REF. - * ch-exp.y (operand_5): We can generalize the 2nd operand - of a string repetition ot 'literal' without ambiguity. - -Thu Apr 8 10:15:10 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * breakpoint.h (struct bpstat): Remove momentary field. - Remove bpstat_momentary_breakpoint. This was always kludgy - and is no longer used. - - * breakpoint.h: Add enum bpstat_what. - breakpoint.h (struct bpstat), breakpoint.c (bpstat_stop_status): - stop and print fields of bpstat now per-breakpoint, not just - one for the whole chain. - breakpoint.{c,h} (bpstat_what): New function. - breakpoint.h: Remove bpstat_stop and bpstat_should_print. - infrun.c: Replace switch (stop_bpstat->breakpoint_at->type) - with call to bpstat_what. - README: Remove watchpoint/breakpoint bug from known bugs. - - * breakpoint.h: Prototype bpstat_find_breakpoint. - -Thu Apr 8 16:01:21 1993 Fred Fish (fnf@cygnus.com) - - * symtab.c (find_methods, gdb_mangle_name): Note that functions - are g++ specific. - * symtab.h (VTBL_FNADDR_OFFSET, OPNAME_PREFIX_P, VTBL_PREFIX_P, - DESTRUCTOR_PREFIX_P): Note that macros are g++ specific. - -Thu Apr 8 12:45:32 1993 Ian Lance Taylor (ian@cygnus.com) - - * i960-pinsn.c (tabent): Copied struct definition from - opcodes/i960-dis.c. - -Thu Apr 8 10:34:37 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * symtab.h (DESTRUCTOR_PREFIX_P): New macro to check if physname - is a C++ destructor. - * symtab.c (gdb_mangle_name): Use it. - * symtab.c (find_methods): Do not add destructors to choice list - for constructors. - * symtab.c (decode_line_1): Make breakpoints on destructors work - for gcc-2.x again. - -Wed Apr 7 18:43:09 1993 Stu Grossman (grossman@cygnus.com) - - * ser-go32.c: Make it use serial port name. - * go32-xdep.c: Put in def for strlwr, needed by dir.o in go32 libc. - - * infcmd.c (read_pc): Make sure that we read PC_REGNUM when not - in a system call! - -Wed Apr 7 15:52:11 1993 Stu Grossman (grossman@cygnus.com) - - * configure.in: Only configure sparclite subdir when target_cpu - is sparclite. - -Wed Apr 7 10:11:22 1993 Jim Kingdon (kingdon@cygnus.com) - - * xcoffread.c (struct coff_symbol): Change c_sclass to unsigned char. - Remove FIXME comment regarding this. - - * symfile.h: Change NULL->'\0' in comment (that wasn't a typo). - - * xcoffread.c (read_xcoff_symtab): Use E_SYMNMLEN. - -Tue Apr 6 22:30:58 1993 K. Richard Pixley (rich@cygnus.com) - - Add section table to objfile struct. Use it for find_pc_section. - * objfiles.c (add_to_objfile_sections, - build_objfile_section_table, find_pc_section): new functions. - (allocate_objfile): build section table. - * objfiles.h (struct obj_section): new structure. - (struct objfile): add section table. - (find_pc_section): new prototype. - * solib.[ch] (find_pc_section_from_so_list): removed. - * sparc-tdep.c: include objfiles.h for find_pc_section. include - symfile.h for objfiles.h. - (in_solib_trampoline): adjusted for new find_pc_section - prototype. Removed BAD_RICH_HACK ifdefs. - * symfile.c (syms_from_objfile): offset objfile sections. - (find_pc_section): removed. Also removed BAD_RICH_HACK ifdefs. - * symfile.h (find_pc_section): prototype removed. Also fixed - comment typo NUL -> NULL. - * target.[ch] (find_pc_section_from_targets): removed. - * config/sparc/tm-sun4sol2.h (BAD_RICHH_HACK): removed. - -Tue Apr 6 21:41:13 1993 Stu Grossman (grossman@cygnus.com) - - * ser-go32.c: Format. (go32_open): Use proper return value. - - * configure.in: Undo conditional configdirs hack for sparclite. - -Tue Apr 6 17:07:37 1993 Jim Wilson (wilson@sphagnum.cygnus.com) - - * symtab.c (list_symbols): When call break_command, pass both - filename and function name not just function name. - -Tue Apr 6 15:00:09 1993 Fred Fish (fnf@cygnus.com) - - (Changes and new files to make "none" a full fledged configuration) - * config/none/{nm-none.h, tm-none.h, xm-none.h}: New files. - Currently only tm-none.h has any meaningful contents. - * config/none/none.mh (NAT_FILE): Use nm-none.h - * config/none/none.mh (XM_FILE): Use xm-none.h - * config/none/none.mt (TM_FILE): Use tm-none.h - * Makefile.in (depend): Remove comment about parse errors in - valops.c, it now parses correctly and generates a correct depend - line. Remove line that touches xm.h, tm.h, and nm.h; they are - now linked to config/none/{xm-none.h, tm-none.h, nm-none.h}. - -Tue Apr 6 09:54:29 1993 Jim Kingdon (kingdon@cygnus.com) - - * values.c (USE_STRUCT_RETURN): Only use gcc wierdness for gcc1. - - * xcoffread.c (read_xcoff_symtab): Deal correctly with symbols of - exactly 8 characters. - -Tue Apr 6 10:31:26 1993 Stu Grossman (grossman@cygnus.com) - - * configure.in: Sparclite uses sparc config dir. Also has it's - own tm- & .mt files now. Also add sparclite to configdirs. - * go32-xdep.c: Dummy routines for sigsetmask & strlwr. - * config/i386/go32.mh: Nullify def of TERMCAP. - * config/i386/xm-go32.h: Get rid of redef of EIO. - * config/sparc/{sparclite.mh tm-sparclite.h}: New sparclite - specific configs. Very similar to sun4os4, but without solib. - * sparclite/{Makefile.in configure.in}: First cut at making this - dir configgable. - -Tue Apr 6 03:10:44 1993 Stu Grossman (grossman@cygnus.com) - - * ser-go32.c: First cut at adapting to new serial interface. - -Mon Apr 5 22:29:43 1993 Stu Grossman (grossman@cygnus.com) - - * Makefile.in (SFILES OBS): Add serial.[co] & ser-hardwire.[co]. - These implement a new serial line interface for talking to remote - targets. - * configure.in: Link ser-hardwire.c to ser-unix.c for all hosts, - EXCEPT go32, which gets ser-go32.c. - * remote.c: Use new serial interface. More remote-xxx's to be - converted later. - * ser-bsd.c, ser-termios.c: Removed. - * serial.c: New. Implements common operations for all serial - types. - * ser-unix.c: New. Unix specific serial operations for various - flavors of Unix (Posix, SysV, BSD). - * serial.h: Generic serial interface defs. - * config/i386/go32.mh, config/i386/i386bsd.h, - config/m68k/apollo68b.mh, config/sparc/sun4os4.mh: Remove - ser-bsd.o from XDEPFILES. All the magic is now handled in - configure.in. - -Mon Apr 5 20:48:54 1993 Stu Grossman (grossman@cygnus.com) - - * config/h8500/tm-h8500.h: Clean up brain damage found by GCC. - -Fri Apr 2 08:23:14 1993 Jim Kingdon (kingdon@cygnus.com) - - * xcoffread.c (xcoff_symfile_offsets): Use 0 not addr for offsets. - - * rs6000-tdep.c (frameless_function_invocation): Don't even think - about framelessness except on the innermost frame. - - * xcoffexec.c: Call fatal() not abort(). - - * stabsread.c (patch_block_stabs): If stab & no symbol, make - a LOC_OPTIMIZED_OUT symbol. - symtab.h (enum address_class): Add LOC_OPTIMIZED_OUT. - findvar.c (read_var_value), printcmd.c (address_info), - symmisc.c (print_{,partial_}symbol), c-exp.y (variable), - m2-exp.y (yylex): Deal with it. - ch-exp.y (yylex): Deal with it. - -Thu Apr 1 18:43:02 1993 Stu Grossman (grossman@cygnus.com) - - * findvar.c (value_from_register): H8500 specific, check to see - if we are looking at short pointer. If so, skip crock. - * h8500-tdep.c (h8500_frame_chain): Mask down value from - read_memory_integer() to avoid getting messed up by sign extension. - -Thu Apr 1 16:44:41 1993 K. Richard Pixley (rich@rtl.cygnus.com) - - * sparc-tdep.c (in_solib_trampoline), symfile.c (find_pc_section): - ifdef protect using BAD_RICH_HACK. This should be removed soon. - * config/sparc/tm-sun4sol2.h (BAD_RICH_HACK): define. - -Thu Apr 1 09:01:38 1993 Jim Kingdon (kingdon@cygnus.com) - - * i960-pinsn.c, a29k-pinsn.c: Much abridged, just use libopcodes.a. - - * core.c (dis_asm_print_address): New function. - - * core.c (dis_asm_read_memory): Reinstate 4th arg. The prototype - has been fixed. - -Thu Apr 1 09:34:43 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * breakpoint.c (bpstat_print, bpstat_stop_status): Change to walk the - entire breakpoint chain and print only the first entry that needs to - be printed and needs to be stopped for. Fixes problems with printing - of multiple breakpoints with different conditions. - * breakpoint.c (print_it_done): Renamed from print_it_noop as it - effectively stops printing of the breakpoint chain. - * breakpoint.c (print_it_noop): New routine to print nothing - for this breakpoint entry and dont stop printing. - * breakpoint.c (breakpoint_re_set_one): mention the reevaluated - watchpoint only if it is enabled. - * mipsread.c (parse_procedure): Correct incorrect setjmp procedure - descriptor from the library to make backtraces through setjmp work. - * mipsread.c (fixup_sigtramp): Correct pcreg and fregoffset for - sigtramp. - * mips-tdep.c (read_next_frame_reg): Provide correct values for - all registers saved within sigtramp, cleanup. - -Wed Mar 31 12:52:12 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * sparc-pinsn.c: Much abridged, just calls version in libopcodes.a. - -Wed Mar 31 21:23:41 1993 K. Richard Pixley (rich@rtl.cygnus.com) - - * core.c (dis_asm_read_memory): drop fourth arg which conflicts - with prototype in ../include/dis-asm.h. - -Wed Mar 31 12:52:12 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * core.c (dis_asm_{read_memory,memory_error}): New functions. - m68k-pinsn.c, h8500-tdep.c, i386-pinsn.c, mips-pinsn.c, z8k-tdep.c: - Use read_memory_func interface to disassembler. - -Tue Mar 30 15:46:14 1993 K. Richard Pixley (rich@rtl.cygnus.com) - - Teach sparc solaris to next over shared library functions. - * solib.[hc] (find_pc_section_from_so_list): new function and - prototype. - * sparc-tdep.c (in_solib_trampoline): new function. - * symfile.[hc] (find_pc_section): new function and prototypes. - * target.[hc] (find_pc_section_from_targets): new function and - prototypes. - * config/sparc/tm-sun4sol2.h (IN_SOLIB_TRAMPOLINE): redefine to - in_solib_trampoline. - -Tue Mar 30 08:06:24 1993 Jim Kingdon (kingdon@cygnus.com) - - * infrun.c (wait_for_inferior): Revise comment. - - * command.c (do_setshow_command): Use %u with var_{u,z}integer. - - * command.{c,h}: New var_type var_integer. - main.c: Use it for history_size. - - * rs6000-tdep.c, xcoffexec.c, config/rs6000/xm-rs6000.h, breakpoint.c: - Lint and byte-order fixups. - - * breakpoint.c (print_it_normal): Return 0 after hitting watchpoint. - - * breakpoint.h (bpstat): New field print_it. - breakpoint.c (bpstat_print): Use it. - (print_it_normal): New function (from old bpstat_print code). - (bpstat_{alloc,stop_status}): Set print_it field. - - * breakpoint.c (bpstat_stop_status): Use catch_errors when - evaluating watchpoint condition, via new function watchpoint_check. - Also stop if watchpoint disabled due to leaving its block. - - * findvar.c [REG_STRUCT_HAS_ADDR]: Add comment. - -Tue Mar 30 00:14:38 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * mips-pinsn.c: Add missing include of dis-asm.h. - -Mon Mar 29 15:03:25 1993 Fred Fish (fnf@cygnus.com) - - * Makefile.in (clean, distclean, realclean): Recursively apply - to subdirs first, rather than last. This avoids, for example, - Makefile being removed in a parent directory before the recursive - make is run. - - * alldeps.mak, depend: Update for below changes. - - * config/m68k/tm-m68k.h: Renamed from config/m68k/tm-68k.h. - * m68k/{tm-3b1.h, tm-altos.h, tm-amix.h, tm-es1800.h, - tm-hp300bsd.h, tm-hp300hpux.h, tm-isi.h, tm-news.h, tm-os68k.h, - tm-st2000.h, tm-sun2.h, tm-sun3.h, tm-vx68.h}: Include tm-m68k.h - instead of tm-68k.h. - * Makefile.in (HFILES): tm-68k.h renamed to tm-m68k.h. - * README, a29k-pinsn.c, m68k-pinsn.c, m68k-stub.c, remote-vx.c, - m68k/{altos.mh, altos.mt, apollo68b.mh, nm-apollo68b.h, - nm-hp300bsd.h, config/m68k/xm-apollo68b.h}: Map '68k' to 'm68k'. - * a29k/tm-a29k.h, doc/gdbint.texinfo: Account for renaming of - tm-68k.h to tm-m68k.h. - * m68k/m68k-fp.mt (TM_FILE): tm-68k-fp.h renamed to tm-m68k-fp.h. - * m68k/m68k-nofp.mt (TM_FILE): tm-68k-nofp.h renamed to - tm-m68k-nofp.h. - - * config/a29k/tm-a29k.h: Renamed from config/a29k/tm-29k.h. - * a29k-pinsn.c: Renamed from am29k-pinsn.c. - * a29k-tdep.c: Renamed from am29k-tdep.c. - * remote-eb.c, config/a29k/tm-ultra3.h: Include renamed tm-a29k.h. - * remote-monitor.c, remote-st2000.c, config/a29k/{nm-ultra3.h, - tm-a29k.h, xm-ultra3.h}, config/romp/rtbsd.mh, doc/gdbinv-s.texi, - testsuite/gdb.t15/funcargs.exp, testsuite/gdb.t17/callfuncs.exp: - Map '29k' to 'a29k'. - * config/a29k/{a29k-kern.mt, a29k-udi.mt, a29k.mt, ultra3.mt} - (TDEPFILES): Use renamed a29k-pinsn.o and a29k-tdep.o. - * config/a29k/{a29k-udi.mt, a29k.mt} (TM_FILE): Use renamed - tm-a29k.h. - * config/a29k/a29k-udi.mt (MT_CFLAGS): Remove TARGET_AM29K - define that does not appear anywhere else in the gdb source tree. - * doc/gdbinit.texinfo: Document renaming of tm-29k.h to tm-a29k.h. - -Mon Mar 29 13:55:29 1993 Jim Kingdon (kingdon@cygnus.com) - - * breakpoint.c: Add comments regarding breakpoint_re_set. - - * xcoffread.c (sort_syms, compare_symbols): Remove. - (xcoff_symfile_read): Use sort_all_symtab_syms from symfile.c - not our own sort_syms (it is identical). - - * xcoffread.c: Nuke NAMES_HAVE_DOT define (not used). - -Sun Mar 28 11:24:37 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * breakpoint.c (breakpoint_re_set_one): Fix storage leak. - * breakpoint.c (enable_breakpoint): Don't enable watchpoint if it - went out of scope. - * exec.c (exec_close): Fix storage leak. - * exec.c (exec_file_command): Make sure that bfd doesn't realign the - output sections when patching an executable. - * mips-nat.c (store_inferior_registers): Use REGISTER_PTRACE_ADDR - when writing all registers. - * mips-tdep.c (mips_push_dummy_frame): Save floating point registers - at the right offset in the dummy frame. - * mipsread.c (psymtab_to_symtab_1): Do not complain for stProc, - stStaticProc and stEnd symbols as they are generated by gcc-2.x. - * mipsread.c (mipscoff_new_init): Initialize stabsread and buildsym. - -Fri Mar 26 15:25:05 1993 John Gilmore (gnu@cygnus.com) - - * Makefile.in (TARFILES): Avoid trailing backslash. - -Fri Mar 26 11:29:30 1993 Jim Kingdon (kingdon@cygnus.com) - - * breakpoint.{c,h}: Add exp_string to struct breakpoint and use - it in breakpoint_re_set. - * breakpoint.c (watch_command, enable_breakpoint): Fetch lazy values. - - * rs6000-tdep.c (single_step): Misc cleanups (CORE_ADDR not int, - don't use sizeof(int) for target stuff, etc). - -Thu Mar 25 15:03:53 1993 Fred Fish (fnf@cygnus.com) - - * alldeps.mak, configure.in, i860-break.h, i860-opcode.h, - i860-pinsn.c, i860-tdep.c, config/i860/*: Remove incomplete i860 - support that can't be integrated anyway due to lack of clear - authorship. - -Thu Mar 25 12:26:50 1993 Stu Grossman (grossman@cygnus.com) - - * findvar.c (read_register, write_register): Make these capable - of reading/writing registers that are shorter than REGISTER_TYPE. - * (value_from_register): Install H8500 specific code to return - proper value when register is being used as a pointer. - * h8500-tdep.c: Remove extra defines of NUM_REGS. - (h8500_skip_prologue): Use correct lengths for LINK instructions. - (FRAME_CHAIN): Change name to h8500_frame_chain. Rewrite code to - chain frames properly by combining frame pointer with T reg. - (init_extra_frame_info): Delete. It's now a macro. - (frame_args_address): Don't add PTR_SIZE. Stack args are already - offset by the correct amount off of the frame pointer. - (register_byte): Delete. It's now a macro. - (register_raw_size, register_virtual_size): Delete. Replaced by - common routine h8500_register_size, cuz there's no difference - between the raw & virtual sizes on this machine. - (register_convert_to_raw, register_convert_to_virtual): Delete, - cuz there's no difference between the raw & virtual forms. - Replaced by memcpy in tm file. - (register_virtual_type): Rename to h8500_register_virtual_type. - Get rid of pointer pseudo-regs, use _REGNUM with all reg names. - (_initialize_h8500_tdep): Get rid of crock to ensure that GDB & - emulator have same reg offsets. This is all handled in the - simulator code now. - (h8500_trapped_internalvar): New routine to detect references to - convenience vars acting as pointer pseudo-regs. - (h8500_value_trapped_internalvar): Conjure up value of pointer - pseudo-regs. - (h8500_set_trapped_internalvar): Convert set value in real - register references. - infcmd.c (read_pc, write_pc): Add h8500 specific code to handle - code segment register. - infrun.c (proceed): Simplify. Call write_pc instead of doing it - by hand. - (wait_for_inferior): Add h8500 specific code to add stack segment - when reading SP register. - remote-sim.c (fetch_register): Spacing. - tm-h8500.h: #define GDB_TARGET_IS_H8500 to make it easier to - detect cruft. Redo all register manipulation stuff. Get rid of - pointer pseudo-regs. (INIT_EXTRA_FRAME_INFO): Adds stack segment - to frame pointer. (IS_TRAPPED_INTERNALVAL, - VALUE_OF_TRAPPED_INTERNALVAR, SET_TRAPPED_INTERNALVAR): Use these - to create internal vars for pointer pseudo-regs. - -Thu Mar 25 10:10:28 1993 Fred Fish (fnf@cygnus.com) - - * Makefile.in: Numerous small changes to macro definitions - and rules for building gdb distribution tree. Many macros - eliminated or merged, and rules simplified. - * alldeps.mak: Update. - * depend: Update. - -Wed Mar 24 13:52:29 1993 david d `zoo' zuhn (zoo at poseidon.cygnus.com) - - * Makefile.in: recurse through SUBDIRS for dvi target too - -Wed Mar 24 08:48:30 1993 Jim Kingdon (kingdon@cygnus.com) - - * Clean up xcoff relocation. - objfiles.h (struct objfiles): Add section_offsets, num_sections. - symfile.c (syms_from_objfile), xcoffread.c (xcoff_symfile_offsets): - Set them. - symtab.h (struct general_symbol_info): Add section field. - minsyms.c (prim_record_minimal_symbol{,_and_info}): Set it. - xcoffread.c: Set section for symbols and msymbols. - (struct symtab): Add block_line_section field. - buildsym.c (end_symtab): Set it. - (end_symtab and callers): Add section parameter. - objfiles.c (objfile_relocate): New funciton. - xcoffexec.c (vmap_symtab): Use it. - xcoffsolib.h (struct vmap): Remove unused fields. - config/rs6000/tm-rs6000.h, stack.c, xcoffexec.c: Remove - CORE_NEEDS_RELOCATION, symtab_relocated. - config/rs6000/tm-rs6000.h: Remove use of loadinfotext. - rs6000-tdep.c: Make loadinfotext static. - breakpoint.c (fixup_breakpoints): Doc fix. - symtab.h (struct symtab), config/rs6000/tm-rs6000.h, buildsym.c - (end_symtab): primary field replaces nonreloc. - -Tue Mar 23 00:10:53 1993 John Gilmore (gnu@cygnus.com) - - * symtab.h (struct linetable_entry): Remove confusing comment. - -Tue Mar 23 00:01:23 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * Makefile.in: add installcheck target - -Mon Mar 22 16:17:58 1993 Fred Fish (fnf@cygnus.com) - - * config/{a29k, arm, convex, gould, h8300, i386, i860, i960, m68k, - m88k, mips, none, ns32k, pa, pyr, romp, rs6000, sparc, tahoe, vax, - z8k}: New directories to hold cpu specific configuration files. - Naming follows gcc convention. - * config/{*.mt, *.mh}: All target and host makefile fragment - config files moved to an appropriate config/ subdirectory. - * nm-*, xm-*, tm-*: All native, host, and target files, which - get linked to nm.h, xm.h, and tm.h respectively by configure, - moved to appropriate config/ subdirectory. - * nm-sysv4.h, xm-sysv4.h, tm-sysv4.h, tm-sunos.h, nm-trash.h: - Native, host, and target files that are common across more than - one cpu architecture and included by one of the configured - native, host, or target files, get moved to config directory. - * Makefile.in (INCLUDE_CFLAGS): Add -I${srcdir}/config to - pick up native, host, or target include files moved to one of - the config subdirectories, and that are included by other files. - * Makefile.in (alldeps.mak): Modify to account for new config - directory structure. - * alldeps.mak, depend: Update for new config directory structure. - * config/*/[ntx]m-*.h: Modify all files that include other - [ntx]m-*.h files to use path relative to gdb/config. I.E. - "a29k/tm-ultra3.h" includes "a29k/tm-29k.h" rather than just - "tm-29k.h". - * remote-eb.c (tm-29k.h): Include a29k/tm-29k.h. - * mipsread.c (tm-mips.h): Include mips/tm-mips.h. - * i860-pinsn.c (tm-i860.h): Include i860/tm-i860.h. - * configure.in: Default gdb_host_cpu to host_cpu, and remap - the ones where the default is not unique or different than the - config subdirectory name. Similarly, handle gdb_target_cpu. - Modify configure.in as appropriate to make use of gdb_host_cpu - and gdb_target_cpu to find makefile fragments and make links. - -Mon Mar 22 12:36:24 1993 Ian Lance Taylor (ian@cygnus.com) - - * mipsread.c (compare_blocks): Sort blocks with the same start - address by decreasing ending address. - -Mon Mar 22 20:36:04 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * mipsread.c (parse_procedure): Save cur_fdr accross call to - lookup_symbol as it might get clobbered by the call. - - * mipsread.c (parse_partial_symbols): Use ADD_PSYMBOL_ADDR_TO_LIST. - The previous code did not initialize the language field for the psymtab - entry. - -Sat Mar 20 00:33:39 1993 John Gilmore (gnu@cygnus.com) - - * c-exp.y (parse_number): Avoid shift warning. - * serial.h (struct ttystate): Declare empty one on DOS. - -Fri Mar 19 12:59:50 1993 Stu Grossman (grossman@cygnus.com) - - * xm-sun4os4.h: Return type of free() should be void, not int. - - * vx-share/vxWorks.h: Remove #def of NULL. - -Fri Mar 19 11:28:18 1993 Jim Kingdon (kingdon@cygnus.com) - - * tm-rs6000.h: Nuke no-op STAB_REG_TO_REGNUM. - -Fri Mar 19 07:40:09 1993 Steve Chamberlain (sac@cygnus.com) - - * z8k-tdep.c (print_insn): Include the new dis-asm header file. - -Thu Mar 18 14:26:57 1993 Per Bothner (bothner@rtl.cygnus.com) - - * ieee-float.c: Moved to ../libiberty. - * ieee-float.h: Moved to ../include. - * Makefile.in: Update accordingly. - * i386-pinsn.c (print_insn), m68k-pinsn.c (print_insn): - Convert to stubs that call disassemblers in ../opcodes/*-dis.c. - * m68k-tdep.c: Removed definition of ext_format ext_format_68881; - it is now in ../opcodes/m68881-ext.c. - * mips-tdep.c (mips_skip_prologue): Try to skip more of the - prologue (some callers _do_ care). - * mips-pinsn.c (print_insn), z8k-tdep.c (print_insn): Convert to - new interface of ../opcodes/*-dis.c. - * ch-exp.y: Add #include . - -Thu Mar 18 11:57:49 1993 Jim Kingdon (kingdon@cygnus.com) - - * xcoffexec.c (exec_close): Don't close exec_bfd twice. - - * xcoffread.c (enter_line_range): endaddr is exclusive, not inclusive. - -Wed Mar 17 09:46:31 1993 Jim Kingdon (kingdon@cygnus.com) - - * xcoffread.c (arrange_linetable): Use x{m,re}alloc not {m,re}alloc. - -Wed Mar 17 11:28:11 1993 Steve Chamberlain (sac@thepub.cygnus.com) - - * z8k-tdep.c (extract_return_value, write_return_value, - store_struct_return): New functions from macros in tm-z8k.h. - -Wed Mar 17 11:23:06 1993 Fred Fish (fnf@cygnus.com) - - * valops.c (value_arg_coerce): Apply temporary patch to - fix problem with coercion of array and function types when - passed as arguments to C functions, pending a more complete - review of when and how coercion should be done, depending - upon context and language. - -Wed Mar 17 09:46:31 1993 Jim Kingdon (kingdon@cygnus.com) - - * xcoffread.c (MIN_TBTABSIZ): Change to 12. - - * xcoffread.c (xcoff_symfile_read): Only read stringtab and - debugsec if there are a non-zero number of symbols. - -Tue Mar 16 18:08:45 1993 John Gilmore (gnu@cygnus.com) - - * command.c (show_user): Avoid fprintf_filtered botch (AGAIN!). - -Tue Mar 16 15:18:17 1993 Jim Kingdon (kingdon@cygnus.com) - - * xcoffexec.c (add_vmap): Wrap symbol read in catch_errors. - - * xcoffread.c (read_symbol_lineno): Look to end of symbols for .bf, - not just 50 symbols. - (symtbl_num_syms): New variable. - (read_xcoff_symtab): Set it. - (read_symbol_nvalue): Check for bad symno. - (read_symbol_{lineno,nvalue}, callers): Don't pass symtable; it's - always symtbl. - -Tue Mar 16 10:09:05 1993 Stu Grossman (grossman@cygnus.com) - - * config/rs6000.mh: Get rid of -Dfd_set=int crock. - This is defined in defs.h if necessary. - * vx-share/vxWorks.h: Remove #defs of min and max. - * vx-share/xdr_ld.c, vx-share/xdr_ptrace.c, - vx-share/xdr_rdb.c: include defs.h. - -Fri Mar 12 09:33:23 1993 Jim Kingdon (kingdon@cygnus.com) - - * xcoffread.c (retrieve_tracebackinfo): Move assignment out - of while condition. - - * xcoffread.c (enter_line_range): complain() on bad endoffset. - xcoffread.c: Doc fixes. - -Tue Mar 9 09:56:12 1993 Jim Kingdon (kingdon@cygnus.com) - - * tm-rs6000.h (CORE_NEEDS_RELOCATION): Just call xcoff_relocate_core. - xcoffexec.c (xcoff_relocate_core): New function. - (text_adjustment): Removed. - (add_vmap): Return the vmap. - rs6000-tdep.c (add_text_to_loadinfo): No longer static. - -Fri Mar 5 05:22:46 1993 Jim Kingdon (kingdon@cygnus.com) - - * xcoffsolib.h: Add objfile member to struct vmap. - xcoff{exec,solib}.c: Use it, not lookup_objfile_bfd. - xcoffexec.c (add_vmap): Allocate objfiles here. - -Sun Mar 14 02:54:15 1993 John Gilmore (gnu@cygnus.com) - - Support 68000 series without floating point. - - * configure.in (m68000-*-{aout,elf,coff}): New configs. - * tm-68k-nofp.h: New file, lacks 68881 support. - * config/m68k-nofp.mt: New file. - -Sun Mar 14 02:30:08 1993 John Gilmore (gnu@cygnus.com) - - Remove a few remaining underscore/no-underscore remnants from - config files. - - * config/{m68k-un.mt, sparc-un.mt}: Remove. - * config/m68k-noun.mt: Rename to m68k-fp.mt. - * config/sparc-noun.mt: Rename to sparc-em.mt. - * tm-68k-noun.h, tm-spc-noun.h: Remove. - * tm-68k-un.h: Rename to tm-68k-fp.h. - * tm-spc-un.h: Rename to tm-spc-em.h. - * tm-sun4sol2.h: Cleanup. - * configure.in (m68k-*, sparc-* targets): Corresponding changes. - -Sat Mar 13 14:58:22 1993 John Gilmore (gnu@cygnus.com) - - * symmisc.c (std_in, std_out, std_err): Move initializations - to runtime code, in case they aren't constant. - -Fri Mar 12 16:23:54 1993 K. Richard Pixley (rich@cygnus.com) - - * symtab.c (find_pc_symtab): some object file formats, notably - mips, have holes in the address ranges of symtabs. Change - this algorithm from first hit to tightest fit. - - * mips-tdep.c (heuristic_proc_start): if we walk the pc into the - fence post without finding the enclosing function, then print a - warning. - -Thu Mar 11 09:33:01 1993 Fred Fish (fnf@cygnus.com) - - * utils.c (fputs_demangled, fprint_symbol): Remove. - * utils.c (fprintf_symbol_filtered): New function which combines - the functionality of fputs_demangled and fprint_symbol. Uses a - caller provided language parameter to select the appropriate - demangler, and caller provided args to pass to the demangler. - * defs.h (enum language): Move further up in file so enum can - be used in prototypes. - * defs.h (fputs_demangled, fprint_symbol): Remove prototypes. - * defs.h (fprintf_symbol_filtered): Add prototype. - * c-typeprint.c (cp_type_print_method_args): Replace calls to - fputs_demangled with call to fprintf_symbol_filtered. - * cp-valprint.c (demangle.h): Include - * cp-valprint.c (cp_print_value_fields): Replace calls to - fprint_symbol with calls to fprintf_symbol_filtered. - * printcmd.c (print_frame_args): Replace call to fprint_symbol - with call to fprintf_symbol_filtered. - * stack.c (print_frame_info): Remove obsolete code so we don't - have to update fputs_demangled usage in it. - * stack.c (print_frame_info, frame_info): Add language variable - to pass to fprintf_symbol_demangled and initialize it from the - symbol's language. Replace calls to fputs_demangled with calls - to fprintf_symbol_filtered. - * symtab.c (find_methods): Replace call to fputs_demangled with - call to fprintf_symbol_filtered. - * ch-valprint.c (demangle.h): Include. - * ch-valprint.c (chill_print_value_fields): Replace call to - fprint_symbol with call to new fprintf_symbol_filtered. - -Wed Mar 10 17:37:11 1993 Fred Fish (fnf@cygnus.com) - - * Makefile.in (VERSION): Bump version to 4.8.2. - - * main.c (source_command): Require an explicit pathname of file - to source, since previous behavior of defaulting to gdb init file - was troublesome and undocumented. - * printcmd.c (disassemble_command): Add missing '{}' pair to - else with two statements. Bug reported by Stephane Tsacas - . - * symtab.c (find_pc_line): Don't complain about zero length or - negative length line numbers for the moment, since we may not own - the terminal when called, such as when single stepping. (FIXME) - * language.h (CAST_IS_CONVERSION): True if current language is - C++ as well as C. Fix from Peter Schauer. - * environ.c (get_in_environ, set_in_environ, unset_in_environ): - Use STREQN macro rather than bare '!strncmp()'. - * environ.c (unset_in_environ): Avoid use of memcpy on - overlapping memory regions, as suggested by Paul Eggert - . - * c-exp.y (%union struct): Remove unused ulval as suggested - by Paul Eggert . - -Mon Mar 8 19:03:06 1993 Fred Fish (fnf@cygnus.com) - - * main.c (gdbinit): Make static. - * main.c (inhibit_gdbinit): Move to file scope. - * main.c (main): Remove local inhibit_gdbinit. - * main.c (source_command): Don't source '.gdbinit' file by - default if gdb has been told to ignore it. - -Sun Mar 7 21:58:53 1993 Ian Lance Taylor (ian@cygnus.com) - - * Makefile.in (MAKEOVERRIDES): Define to be empty for GNU Make - 3.63. - -Fri Mar 5 17:39:45 1993 John Gilmore (gnu@cacophony.cygnus.com) - - * printcmd.c (print_address_symbolic): Only print if offset - is shorter than max_symbolic_offset. - (initialize_printcmd): `set print max-symbolic-offset'. - - * am29k-tdep.c (TAGWORD_ZERO_MASK): New #define. - (examine_tag): Use it. - (read_register_stack): Only look in the local registers for a - memory address if it's between rfb and rsp; go to memory otherwise. - (initialize_29k): Fix call_scratch_address doc. Remove reginv_com. - (reginv_com): Remove ancient kludge command. - -Fri Mar 5 17:16:26 1993 K. Richard Pixley (rich@rtl.cygnus.com) - - * tm-irix3.h (ZERO_REGNUM): copy this macro from tm-mips.h so that - irix4 will again compile. - - * tm-mips.h (GDB_TARGET_IS_MIPS): no longer used, now removed. - - * configure.in: accept mips-sgi-irix4* for irix4. - -Fri Mar 5 07:49:48 1993 Steve Chamberlain (sac@lisa.cygnus.com) - - * z8k-tdep.c (print_register_hook): Lint. - -Thu Mar 4 17:42:03 1993 John Gilmore (gnu@cygnus.com) - - Lint fixes from Paul Eggert (eggert@twinsun.com): - - * command.c (do_setshow_command): var_uintegers are unsigned. - * sparc-tdep.c (save_insn_opcodes, restore_insn_opcodes): - unsigned, since they use hex values with the high bit set. - -Thu Mar 4 08:22:55 1993 Fred Fish (fnf@cygnus.com) - - Fixes submitted by Karl Berry (karl@nermal.hq.ileaf.com): - * m88k-pinsn.c (sprint_address): Use SYMBOL_NAME macro to - access symbol name. - * m88k-nat-c (SXIP_OFFSET, SNIP_OFFSET, SFIP_OFFSET): Enclose - macro definitions in parenthesis. - - * dbxread.c (dbx_symfile_init): Catch the case where there is - no string table, but the only way we find out is by reading zero - bytes from EOF. - -Wed Mar 3 15:51:28 1993 Fred Fish (fnf@cygnus.com) - - * dbxread.c (dbx_symfile_init): Make size of the string table - size field a define (DBX_STRINGTAB_SIZE_SIZE). Ensure that the - offset to the string table is nonzero and handle the nonexistant - string table case, should it occur. Ensure that the string table - size read from the file is reasonable, with a minimum lower bound - of DBX_STRINGTAB_SIZE_SIZE instead of zero. - -Wed Mar 3 07:23:03 1993 Ian Lance Taylor (ian@cygnus.com) - - * Makefile.in: Changes to build testsuite correctly. - (FLAGS_TO_PASS): Added CXX and CXXFLAGS. - (CC_FOR_TARGET, CXX, CXX_FOR_TARGET): New variables. - (TARGET_FLAGS_TO_PASS): New variable. - (SUBDIRS): Added testsuite. - (all): Build testsuite using TARGET_FLAGS_TO_PASS, so that - testsuite is compiled with CC_FOR_TARGET rather than CC. - -Tue Mar 2 17:57:56 1993 Fred Fish (fnf@cygnus.com) - - * dbxread.c (dbx_symfile_init): Fix for nonexistant string table, - reported by mycroft@gnu.ai.mit.edu. - - (Ultrix 2.2 support from Michael Rendell ) - * configure.in (vax-*-ultrix2*): New triplet. - * config/vaxult2.mh: New file. - * xm-vaxult2.h: New file. - - * c-exp.y (parse_number): Change high_bit to unsigned. - * demangle.c: Change all references to cfront to ARM, since the - actual algorithm is the one specified in the Annotated Reference - Manual. This was confusing users into thinking that full cfront - support was implemented. - * dwarfread.c (CFRONT_PRODUCER): Remove, was never really used. - * eval.c (evaluate_subexp): For STRUCTOP_PTR pass the arg type - directly to lookup_struct_elt_type, which will do the - dereferencing itself. - * gdbtypes.c (lookup_struct_elt_type): Expand comments. Fix - NULL dereferencing bug for unnamed structs, comment out - questionable code. - -Mon Mar 1 17:54:41 1993 John Gilmore (gnu@cygnus.com) - - * coffread.c (process_coff_symbol): Change PCC argument correction - so that it only happens on big-endian targets; so that it only - happens if the short or char argument is aligned on an int - boundary; and so that it changes the location, rather than the - type, of the argument. These changes tend to parallel similar - (old) changes in stabsread.c. - - * coffread.c (coff_read_enum_type): Use the specified size for - enums, don't assume that they are int-sized. - - * c-valprint.c (c_val_print): Don't assume enums are the same as - ints. - - * coredep.c: Handle NO_PTRACE_H in coredep.c. Fix by Michael - Rendell, . - -Mon Mar 1 09:25:57 1993 Fred Fish (fnf@cygnus.com) - - * language.h (local_decimal_format_custom): Add prototype. - * language.c (local_decimal_format_custom): Add function, bug - reported by Robert R. Henry (rrh@tera.com). - -Fri Feb 26 18:33:18 1993 John Gilmore (gnu@cacophony.cygnus.com) - - * xcoffexec.c (vmap_ldinfo): Fix "/" for '/' typo, reported - by Josef Leherbauer, joe@takeFive.co.at. - -Wed Feb 24 19:17:11 1993 John Gilmore (gnu@cacophony.cygnus.com) - - * symfile.c (syms_from_objfile), tm-29k.h, tm-3b1.h, tm-68k-un.h, - tm-altos.h, tm-arm.h, tm-convex.h, tm-es1800.h, tm-h8300.h, - tm-hp300bsd.h, tm-hp300hpux.h, tm-hppa.h, tm-i386bsd.h, - tm-i386v.h, tm-i960.h, tm-irix3.h, tm-isi.h, tm-linux.h, - tm-m88k.h, tm-merlin.h, tm-mips.h, tm-news.h, tm-np1.h, tm-pn.h, - tm-pyr.h, tm-rs6000.h, tm-spc-un.h, tm-sun386.h, tm-sunos.h, - tm-symmetry.h, tm-sysv4.h, tm-tahoe.h, tm-umax.h, tm-vax.h, - tm-vx68.h, tm-z8k.h: Remove remnants of NAMES_HAVE_UNDERSCORE. - -Wed Feb 24 07:41:15 1993 Fred Fish (fnf@cygnus.com) - - * symtab.h (SYMBOL_INIT_DEMANGLED_NAME): Initialize contents - of demangled name fields to NULL if no demangling exists for - a symbol. SYMBOL_INIT_LANGUAGE_SPECIFIC does this for new - symbols if their language is known at the time they are created, - but sometimes the language is not known until later. - - * ch-typeprint.c (chill_print_type_base): Name changed to - chill_type_print_base to match pattern for C and C++ names. - * ch-typeprint.c (chill_print_type): Change "char" to "CHAR" - to be consistent with other usages. - * ch-typeprint.c (chill_type_print_base): Add support for - printing Chill STRUCT types. - * ch-valprint.c: Include values.h. - * ch-valprint.c (chill_print_value_fields): New function and - prototype for printing Chill STRUCT values. - * ch-valprint.c (chill_val_print): Fix call to val_print_string - that was being called with two args instead of three. - * ch-valprint.c (chill_val_print): Call chill_print_value_fields - to print Chill STRUCT values. - -Tue Feb 23 18:58:11 1993 Mike Werner (mtw@poseidon.cygnus.com) - - * configure.in: added testsuite to configdirs. - -Tue Feb 23 11:46:11 1993 Mike Stump (mrs@cygnus.com) - - * doc/stabs.texi: The `this' pointer is now known by the name - `this' instead of `$t'. - -Tue Feb 23 11:21:33 1993 Fred Fish (fnf@cygnus.com) - - * dwarfread.c (read_tag_string_type): Rewrite to allow forward - references of TAG_string_type DIEs in user defined types. - * ch-lang.c (chill_create_fundamental_type): Track compiler - change that now emits debugging info with the type long for Chill - longs. - -Mon Feb 22 15:21:54 1993 Ian Lance Taylor (ian@cygnus.com) - - * remote-mips.c: New file; implements MIPS remote debugging - protocol. - * config/idt.mt: New file; uses remote-mips.c - * configure.in (mips-idt-ecoff): New target; uses idt.mt. - - * mips-tdep.c (mips_fpu): New variable; controls use of MIPS - floating point coprocessor. - (mips_push_dummy_frame): If not mips_fpu, don't save floating - point registers. - (mips_pop_frame): If not mips_fpu, don't restore floating point - registers. - (_initialize_mips_tdep): New function; let the user reset mips_fpu - variable. - * tm-mips.h (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE): If not - mips_fpu, don't use fp0 as floating point return register. - (FIX_CALL_DUMMY): If not mips_fpu, don't save floating point - registers. - -Mon Feb 22 07:54:03 1993 Mike Werner (mtw@poseidon.cygnus.com) - - * gdb/testsuite: made modifications to testcases, etc., to allow - them to work properly given the reorganization of deja-gnu and the - relocation of the testcases from deja-gnu to a "tool" subdirectory. - -Sun Feb 21 10:55:55 1993 Mike Werner (mtw@poseidon.cygnus.com) - - * gdb/testsuite: Initial creation of gdb/testsuite. - Migrated dejagnu testcases and support files for testing nm to - gdb/testsuite from deja-gnu. These files were moved "as is" - with no modifications. This migration is part of a major overhaul - of dejagnu. The modifications to these testcases, etc., which - will allow them to work with the new version of dejagnu will be - made in a future update. - -Fri Feb 19 18:36:55 1993 John Gilmore (gnu@cygnus.com) - - * NEWS: Add reminders for next release. - -Fri Feb 19 10:01:39 1993 Ian Lance Taylor (ian@cygnus.com) - - * mipsread.c (parse_lines): Correct check for files compiled with - -g1. - -Fri Feb 19 05:56:15 1993 John Gilmore (gnu@cygnus.com) - - * Makefile.in (VERSION): 4.8.1 to distinguish local versions. - -Fri Feb 19 01:32:58 1993 John Gilmore (gnu@cygnus.com) - - * Makefile.in (VERSION): GDB-4.8 release! - * README, NEWS: Update for release. - -Thu Feb 18 22:44:40 1993 Stu Grossman (grossman@cygnus.com) - - * am29k-pinsn.c (print_insn): Minor nits with const. - * am29k-tdep.c: More minor nits with arg types for - supply_register, NULL vs. 0, read_register_gen, & reginv_com. - -Thu Feb 18 22:38:03 1993 John Gilmore (gnu@cygnus.com) - - * gcc.patch: Update for a different GCC (G++) bug. - * main.c (print_gdb_version): Update copyright year to 1993. - * nm-hp300bsd.h: Decide whether this is BSD 4.3 or 4.4, - conditionalize this file on it. FIXME, right way is to split - these into two config files. - (ATTACH_DETACH): Define for BSD 4.4 - (PTRACE_ARG_TYPE): caddr_t for BSD 4.4, unset for 4.3. - (U_REGS_OFFSET): Revise for 4.4. - (REGISTER_U_ADDR): Separate for 4.4, but it doesn't work yet. - * xm-hp300bsd.h: Move definitions of UINT_MAX, INT_MAX, INT_MIN, - LONG_MAX into this file to avoid cpp "redefinition" warnings. - -Thu Feb 18 16:13:28 1993 K. Richard Pixley (rich@rtl.cygnus.com) - - * nm-hp300bsd.h (PTRACE_ARG3_TYPE): FSF's hp300's have int* not - caddr_t. - -Thu Feb 18 04:10:06 1993 John Gilmore (gnu@cygnus.com) - - * c-lang.c (c_printstr): Bugfix for length==0 case. - - * c-lang.c (c_printstr): If a C string ends in a null, don't - print the null. - -Thu Feb 18 02:39:21 1993 Stu Grossman (grossman at cygnus.com) - - * defs.h (STRCMP): Make it work for unsigned chars. - -Thu Feb 18 01:56:06 1993 John Gilmore (gnu@cygnus.com) - - * nm-hp300bsd.h (ATTACH_DETACH, PTRACE_ATTACH, PTRACE_DETACH): define. - * config/hp300bsd.mh (REGEX, REGEX1): Define. - * m68k-pinsn.c (BREAK_UP_BIG_DECL, AND_OTHER_PART): #if __GNUC__, - define to kludge the large opcode table into two smaller tables, - since GCC take exponential space to build the table. Lint. - (NOPCODES): Remove, use "numopcodes" from opcode/m68k.h instead. - -Wed Feb 17 19:24:40 1993 John Gilmore (gnu@cygnus.com) - - * Makefile.in (VERSION): Roll to 4.7.9. - * xm-hp300bsd.h: Define PSIGNAL_IN_SIGNAL_H and put a compatible - definition here, to handle both BSD 4.3 and 4.4 systems. - * mipsread.c (ZMAGIC): #undef to avoid duplicate define. - * remote.c (alarm): Move declaration to global level, before - first reference to it. - * tm-i386bsd.h (NUM_REGS): There are only eleven, not twelve. - * dbxread.c (process_one_symbol): Cast to unsigned char, not int. - -Wed Feb 17 13:40:29 1993 K. Richard Pixley (rich@cygnus.com) - - * remote.c (readchar): forward declare alarm which otherwise looks - like an undeclared variable to gcc. - - * dbxread.c (process_one_symbol): cast enum value N_SO into int - when comparing against an int. Avoids superfluous warning from - vax ultrix 4.2 cc. - - * inflow.c (set_sigint_trap): add cast to assignment from signal. - Avoids superfluous warnings from some systems and/or compilers - (like vax ultrix 4.2.) - - * language.c (struct op_print unk_op_print_tab): use the enum - values rather naked zeros as initializers. Avoids warnings from - ultrix type compilers. - -Tue Feb 16 00:53:20 1993 John Gilmore (gnu@cygnus.com) - - * Makefile.in (VERSION): Roll to 4.7.6. - (SFILES_SUBDIR): Add 29k-share/udi_soc. - (SFILES_SUBSUBDIR): Move 29k-share/udi files to this macro. - (alldeps.mak): Make ALLDEPFILES_SUBSUBDIR for files in sub sub dirs. - (ALLDEPFILES_SUBSUBDIR): Depend on this for deeper dep files. - (HFILES): Remove all nm-* except nm-trash.h. Add ns32k-opcode.h. - (depend): Fix bug where nm-files in config files weren't noticed. - (make-proto-gdb-1): Avoid changing directories while building new - prototype. Build SFILES_SUBSUBDIR with longer symlinks. - -Mon Feb 15 20:48:09 1993 John Gilmore (gnu@cygnus.com) - - * remote.c: Improve error recovery. Allow user to break out - of initial connection attempt with INTERRUPT. Treat a timeout - while waiting for remote packet like a retry, unless the remote - side is actively running user code. Fix a few long printf_filtered's. - - * xcoffread.c (read_xcoff_symtab): Don't use null symbol name for - trampoline symbols. - - * buildsym.c (start_subfile): Allow null file name. - -Fri Feb 12 15:46:49 1993 K. Richard Pixley (rich@cygnus.com) - - * xcoffread.c (process_xcoff_symbol, read_symbol_lineno): complain - expects a pointer to complaint rather than a complaint - structure. - (process_linenos): free the previously allocated subfile name, - then allocate the new one from the heap. - -Fri Feb 12 08:06:05 1993 Steve Chamberlain (sac@thepub.cygnus.com) - - * h8300-tdep.c, tm-h8300.h: turn off some experimental features - -Thu Feb 11 00:59:07 1993 John Gilmore (gnu@cygnus.com) - - * stabsread.c (dbx_lookup_type): Handle negative type numbers. - Previously, would bogusly index off the bottom of type_vector. - (rs6000_builtin_type): Accept type number as argument. - (read_type, case '-'): Handle negatives like any other type number. - - * symfile.c (deduce_language_from_filename): Handle null name. - - * mips-tdep.c (isa_NAN): Fix byte order dependency. - Reported by Nobuyuki Hikichi , - fixed by sato@sm.sony.co.jp. - - * xcoffread.c (parmsym): Don't use an initializer to set up - this struct symbol. Set it up in initialize_xcoffread. - (read_xcoff_symtab, xcoff_symfile_read): Surround code that only - works on real rs/6000 target with #ifndef FAKING_RS6000. - -Wed Feb 10 23:42:37 1993 John Gilmore (gnu@cygnus.com) - - * stabsread.c (rs6000_builtin_type): Move function from - xcoffread.c:builtin_type. - * xcoffread.c (builtin_type): Move to stabsread. Remove - IBM6000_HOST dependency. Move misplaced comments. - (various): Change printf's to complaints. - (patch_block_stabs, process_xcoff_symbol case C_DECL): Add - objfile argument to read_type calls under #if 0. - (process_xcoff_symbol case C_RSYM): Fix typo in #ifdef. - * xcoffexec.c (map_vmap): Don't allocate an objfile for the exec_file. - * Makefile.in: xcoffread.o is not built by default. - * xm-rs6000.h (IBM6000_HOST): Remove. - * config/rs6000.mh (NATDEPFILES): xcoffread.o is native only. - * doc/gdbint.texinfo: Eliminate IBM6000_HOST, document - IBM6000_TARGET. - -Wed Feb 10 18:31:20 1993 Stu Grossman (grossman at cygnus.com) - - * findvar.c (read_var_value): If REG_STRUCT_HAS_ADDR, then set - VALUE_LVAL to be lval_memory so that we don't try to modify wild - register numbers when user tries to modify elements in structs - passed as arguments. - * inflow.c (child_terminal_info): Move banner outside of system - specific #ifdefs. - * tm-hppa.h (REG_STRUCT_HAS_ADDR): Define this for HPPA, which - passes struct/union arguments by address. - -Wed Feb 10 15:34:46 1993 Ian Lance Taylor (ian@cygnus.com) - - * Based on patch from Kean Johnston : - * nm-i386sco4.h: New file. Like nm-i386sco.h, but define - ATTACH_DETACH, PTRACE_ATTACH and PTRACE_DETACH. - * config/i386sco4.mh (NAT_FILE): Use nm-i386sco4.h. - -Tue Feb 9 20:07:18 1993 John Gilmore (gnu@cygnus.com) - - * remote-udi.c (FREEZE_MODE): Fix && for & typo. Found and - fixed by Lynn D. Shumaker, shumaker@saifr00.cfsat.honeywell.com. - -Tue Feb 9 08:18:07 1993 Ian Lance Taylor (ian@cygnus.com) - - * config/i386sco4.mh (MUNCH_DEFINE): Pass -p to nm to avoid bug in - cc debugging output. - -Tue Feb 9 00:19:28 1993 John Gilmore (gnu@cygnus.com) - - * stabsread.c (define_symbol): Complain about unrecognized names - that begin with CPLUS_MARKER (often '$'), but don't die. Fix - suggested by gb@cs.purdue.edu (Gerald Baumgartner). - (read_cpp_abbrev): Don't use the class name as part of the - vtable pointer member name (_vptr$) in $vf abbrevs or unrecognized - abbrevs. Inspired by Mike Tiemann. - (read_tilde_fields): Comment. Remove ancient dead code. - Remove erroneous but non-dead code. Simplify. Add complaints. - (in general): Remove extraneous (parentheses) in return - statements. - -Fri Feb 5 14:01:22 1993 John Gilmore (gnu@cygnus.com) - - * coffread.c (coff_lookup_type): Fix fencepost error reported - by Art Berggreen, . - - Fix long file name bug reported on SCO Open Desktop 2.0 by Ulf Lunde - and Dag H. Wanvik : - - * coffread.c (getfilename): Eliminate COFF_NO_LONG_FILE_NAMES - test, which is apparently left over from when we used native - include files and couldn't depend on the member names being there. - * tm-3b1.h, tm-altos.h, tm-i386v.h: Don't set it. - -Thu Feb 4 12:23:15 1993 Ian Lance Taylor (ian@cygnus.com) - - * mipsread.c: Major overhaul to use new BFD symbol table reading - routines. Now swaps information as it is needed, rather than - swapping everything when the file is read. - -Thu Feb 4 01:52:36 1993 John Gilmore (gnu@cygnus.com) - - * Makefile.in (TARDIRS): Add sparclite demo dir. - (*.tab.c): Change dependency on Makefile to depend on - Makefile.in, otherwise it always rebuilds after configuring. - Force output *.tab.c file into current directory even in "make" - versions that rewrite dependent file names used in command lines. - - * TODO: Remove some things we did. - * am29k-opcode.h, convx-opcode: Remove; now in ../include/opcode. - * os68k-xdep.c: Remove; useless file (os68k is a target only). - * convex-pinsn.c: Use ../include/opcode/convex.h. Add CONST. - * symtab.h: Eliminate unnamed unions and structs. - -Wed Feb 3 14:48:08 1993 John Gilmore (gnu@cygnus.com) - - * Makefile.in (VERSION): Roll to 4.7.5. - -Tue Feb 2 20:47:42 1993 John Gilmore (gnu@cygnus.com) - - * breakpoint.c (breakpoint_re_set_one): Handle watchpoints when - re-evaluating symbol pointers. - -Tue Feb 2 16:10:31 1993 Fred Fish (fnf@cygnus.com) - - * c-exp.y (lcurly, rcurly): New nonterminals. - * c-exp.y (exp): Use lcurly and rcurly for arrays and UNOP_MEMVAL - constructs. - * parse.c (free_funcalls): Moved prototype from parser-defs.h, - made function static. - * parse.c (struct funcall): Moved struct def from parser-defs.h. - * parse.c (funcall_chain): Moved from parser-defs.h, made static. - * parse.c (start_arglist): - * parser-defs.h (free_funcalls): Moved prototype to parse.c. - * parser-defs.h (struct funcall): Moved struct def to parse.c. - * parser-defs.h (funcall_chain): Moved to parse.c. - * printcmd.c (print_frame_nameless_args): Fix prototype. - * tm-mips.h (setup_arbitrary_frame): Fix prototype. - * tm-sparc.h (setup_arbitrary_frame): Fix prototype. - * valops.c (typecmp): Moved prototype from values.h. - * value.h (typecmp): Moved prototype to valops.c, made static. - * ch-exp.y (yylex): Change way control sequences are disabled. - -Tue Feb 2 16:11:43 1993 John Gilmore (gnu@cygnus.com) - - * tm-mips.h, tm-sparc.h: Fix thinko in SETUP_ARBITRARY_FRAME. - -Tue Feb 2 15:30:33 1993 Ian Lance Taylor (ian@cygnus.com) - - * mipsread.c (upgrade_type): Build array types correctly, using - create_range_type and create_array_type. - -Tue Feb 2 00:19:08 1993 John Gilmore (gnu@cygnus.com) - - * remote-nindy.c: Cleanup. - - * infrun.c (wait_for_inferior): When rolling back the PC after - a breakpoint, call write_pc so that NPC gets rolled back as well - (for the 29K). - - * blockframe.c (inside_entry_file, inside_main_func, - inside_entry_func): PC of zero is always "bottom of stack". - - * printcmd.c (print_frame_args, print_frame_nameless_args): - Let print_frame_nameless_args decide whether there are any, - laying groundwork for possibly later printing 29K args for - functions where we have tag words but no symbols. - -Mon Feb 1 18:09:58 1993 Roland H. Pesch (pesch@fowanton.cygnus.com) - - * Makefile.in: fix GDB doc targets for new doc subdir structure - -Mon Feb 1 17:56:47 1993 John Gilmore (gnu@cygnus.com) - - * stack.c (parse_frame_specification): Parse as many arguments - as there are (up to MAXARGS). Pass all of them in argc, argv - format to SETUP_ARBITRARY_FRAME. Put the burden of checking how - many there were, onto SETUP_ARBITRARY_FRAME. - * tm-mips.h, tm-sparc.h: Corresponding changes. - * mips-tdep.c, sparc-tdep.c: Ditto. - -Mon Feb 1 17:19:37 1993 John Gilmore (gnu@cygnus.com) - - * hp300ux-nat.c: Update copyrights. - * mipsread.c (parse_partial_symbols): Complain about block - indexes that go backwards. Fix from Peter Schauer. - * symfile.c (syms_from_objfile, symbol_file_add): Allow a - symbol-file that has no linkage symbols to be read. - * tm-rs6000.h, xm-rs6000.h: (SIGWINCH_HANDLER and friends): Move - from tm- file to xm-file, since they're host dependent. - * valarith.c (value_binop): Typo. - -Mon Feb 1 16:16:59 1993 Stu Grossman (grossman at cygnus.com) - - * sparclite/aload.c: Add copyleft. - * sparclite/crt0.s: Add comment at beginning. - -Mon Feb 1 14:36:11 1993 Steve Chamberlain (sac@thepub.cygnus.com) - - * remote-z8k.c, z8k-tdep.c: support for the Z8001 and Z8002. - * parse.c (std_regs): Only declare if NO_STD_REGS is defined. - -Sun Jan 31 04:32:48 1993 Michael Tiemann (tiemann@rtl.cygnus.com) - - * values.c (value_headof): Fix typo in which VTBL and ARG were - being confused for one another. - - * valops.c (typecmp): Now static. - - * gdbtypes.c (fill_in_vptr_fieldno): Don't ignore the first - baseclass--we don't always inherit its virtual function table - pointer. - - * eval.c (evaluate_subexp): In OP_FUNCALL case, adjust `this' - pointer correctly in case value_struct_elt moves it around. - - * valops.c (typecmp): Now static. Also, now groks references - better. - - * gdbtypes.c (lookup_struct_elt_type): Pass NOERR instead of - zero on recursive call. If NAME is the name of TYPE, return TYPE. - -Sat Jan 30 19:55:52 1993 John Gilmore (gnu@cygnus.com) - - * hppah-nat.c: Eliminate and other unnecessary stuff, - to avoid "too much defining" error from native C compiler (!). - - * Makefile.in (HFILES): Add typeprint.h. - * typeprint.[ch]: Update copyrights. - -Thu Jan 28 19:09:02 1993 John Gilmore (gnu@cygnus.com) - - * Makefile.in: Update to match doc/ subdir changes. - - * config/hp300hpux.mh: No cross-host file needed, just native. - * config/go32.mh: Remove nonexistent "native" support. - - M88K fixes reported by Carl Greco, : - * tm-m88k.h (REGISTER_CONVERT_TO_RAW): Fix typo. - * m88k-tdep.c (next_insn): Lint, cleanup. - (store_parm_word): Lint. - - * README: Fix typo (reported by karl@hq.ileaf.com). - -Wed Jan 27 21:34:21 1993 Fred Fish (fnf@cygnus.com) - - * expression.h (BINOP_CONCAT): Document use for self concatenation - an integral number of times. - * language.c (binop_type_check): Extend BINOP_CONCAT for self - concatenation case. - * valarith.c (value_concat): Rewrite to support self - concatenation an integral number of times. - * Makefile.in (ch-exp.tab.c): Change "expect" message. - * ch-exp.y (FIXME's): Make all FIXME tokens distinct, to - eliminate hundreds of spurious shift/reduce and reduce/reduce - conflicts that mask the 5 real ones. - * ch-exp.y (STRING, CONSTANT, SC): Remove unused tokens. - * ch-exp.y (integer_literal_expression): Remove production, - no longer used. - -Thu Jan 21 09:58:36 1993 Fred Fish (fnf@cygnus.com) - - * eval.c (evaluate_subexp): Fix OP_ARRAY, remove code that - implied that "no side effects" was nonfunctional. - * eval.c (evaluate_subexp): Add BINOP_CONCAT case to deal with - character string and bitstring concatenation. - * expprint.c (dump_expression): Add case for BINOP_CONCAT. - * expression.h (exp_opcode): Add BINOP_CONCAT. - * gdbtypes.h (type_code): Add TYPE_CODE_BITSTRING. - * language.c (string_type): Add function to determine if a type - is a string type. - * language.c (binop_type_check): Add case for BINOP_CONCAT. - * valarith.c (value_concat): New function to concatenate two - values, such as character strings or bitstrings. - * valops.c (value_string): Remove error stub and implement - function body. - * value.h (value_concat): Add prototype. - * ch-exp.y (operand_3): Add actions for SLASH_SLASH (//). - * ch-exp.y (yylex): Recognize SLASH_SLASH. - * ch-lang.c (chill_op_print_tab): Add SLASH_SLASH (//) as - BINOP_CONCAT. - -Tue Jan 19 14:26:15 1993 Fred Fish (fnf@cygnus.com) - - * c-exp.y (exp): Add production to support direct creation - of array constants using the obvious syntax. - * c-valprint.c (c_val_print): Set printed string length. - * dwarfread.c (read_tag_string_type): New prototype and - function that handles TAG_string_type DIEs. - * dwarfread.c (process_dies): Add case for TAG_string_type - that calls new read_tag_string_type function. - * expprint.c (print_subexp): Add support for OP_ARRAY. - * gdbtypes.c (create_range_type, create_array_type): Inherit - objfile from the index type. - * ch-typeprint.c (chill_print_type): Add case for - TYPE_CODE_STRING. - * ch-valprint.c (chill_val_print): Fix case for - TYPE_CODE_STRING. - -Mon Jan 18 11:58:45 1993 Ian Lance Taylor (ian@cygnus.com) - - * mipsread.c (CODE_MASK, MIPS_IS_STAB, MIPS_MARK_STAB, - MIPS_UNMARK_STAB, STABS_SYMBOLS): Removed; now in - include/coff/mips.h. - -Fri Jan 15 20:26:50 1993 Fred Fish (fnf@cygnus.com) - - * c-exp.y (exp:STRING): Convert C strings into array-of-char - constants with an explicit null byte terminator. OP_STRING is - now used for real string types. - * c-lang.c (builtin_type_*): Move declarations to lang.c since - they are used by all languages. - * c-lang.c (_initialize_c_language): Move initializations of - builtin_type_* to lang.c. - * c-typeprint.c (c_type_print_varspec_prefix, - c_type_print_varspec_suffix): TYPE_CODE_PASCAL_ARRAY renamed - to TYPE_CODE_STRING. - * c-valprint.c (c_val_print): Change the way character arrays - are printed as strings to be consistent with the way strings - are printed when pointer-to-char types are dereferenced. - Remove test of print_max before calling val_print_string, which - now does it's own test. - * eval.c (evaluate_subexp): Add case for OP_ARRAY. - * expprint.c (print_subexp, dump_expression): Add case for OP_ARRAY. - * expression.h (enum exp_opcode): Add OP_ARRAY and document. - * gdbtypes.c (builtin_type_*): Add declarations moved from - c-lang.c. - * gdbtypes.c (create_string_type): New function to create real - string types. - * gdbtypes.c (recursive_dump_type): TYPE_CODE_PASCAL_ARRAY - renamed to TYPE_CODE_STRING. - * gdbtypes.c (_initialize_gdbtypes): Add initializations of - builtin_type_* types moved from c-lang.c. - * gdbtypes.h (enum type_code): TYPE_CODE_PASCAL_ARRAY renamed - to TYPE_CODE_STRING. - * gdbtypes.h (builtin_type_string): Add extern declaration. - * gdbtypes.h (create_string_type): Add prototype. - * m2-lang.c (m2_create_fundamental_type): TYPE_CODE_PASCAL_ARRAY - renamed to TYPE_CODE_STRING. - * m88k-tdep.c (pushed_size): TYPE_CODE_PASCAL_ARRAY renamed to - TYPE_CODE_STRING. - * mipsread.c (_initialize_mipsread): TYPE_CODE_PASCAL_ARRAY - renamed to TYPE_CODE_STRING. - * parse.c (length_of_subexp, prefixify_subexp): Add case for - OP_ARRAY. - * printcmd.c (print_formatted): Recognize TYPE_CODE_STRING. - * typeprint.c (print_type_scalar): TYPE_CODE_PASCAL_ARRAY renamed - to TYPE_CODE_STRING. - * valops.c (allocate_space_in_inferior): New function and - prototype, using code ripped out of value_string. - * valops.c (value_string): Rewritten to use new function - allocate_space_in_inferior, but temporarily disabled until some - other support is in place. - * valops.c (value_array): New function to create array constants. - * valprint.c (val_print_string): Add comment to document use, - complete rewrite to fix several small buglets. - * value.h (value_array): Add prototype. - * value.h (val_print_string): Change prototype to match rewrite. - * ch-valprint.c (chill_val_print): Add case for TYPE_CODE_STRING. - * ch-exp.y (match_character_literal): Disable recognition of - control sequence form of character literals and document why. - -Thu Jan 14 15:48:12 1993 Stu Grossman (grossman at cygnus.com) - - * nindy-share/nindy.c: Add comments to #endif's to clarify - grouping. - - * hppa-pinsn.c (print_insn): Use read_memory_integer, instead of - read_memory to get byte order right. - * hppah-tdep.c (find_unwind_info): Don't read in unwind info - anymore. This is done in paread.c now. We expect unwind info - to hang off of objfiles, and search all of the objfiles when until - we find a match. - * (skip_trampoline_code): Cast arg to target_read_memory. - * objfiles.h (struct objfile): Add new field obj_private to hold - per object file private data (unwind info in this case). - * paread.c (read_unwind_info): New routine to read unwind info - for the objfile. This data is hung off of obj_private. - * tm-hppa.h: Define struct obj_unwind_info, to hold pointers to - the unwind info for this objfile. Also define OBJ_UNWIND_INFO to - make this easier to access. - -Wed Jan 13 20:49:59 1993 Fred Fish (fnf@cygnus.com) - - * c-valprint.c (cp_print_class_member): Add extern decl. - * c-valprint.c (c_val_print): Extract code for printing methods - and move it to cp_print_class_method in cp-valprint.c. - * c-valprint.c (c_val_print): Extract code to print strings and - move it to val_print_string in valprint.c. - * cp-valprint.c (cp_print_class_method): New function using - code extracted from c_val_print. - * valprint.c (val_print_string): New function using code - extracted from c_val_print. - * value.h (val_print_string): Add prototype. - * ch-exp.y (CHARACTER_STRING_LITERAL): Set correct token type. - * ch-exp.y (literal): Add action for CHARACTER_STRING_LITERAL. - * ch-exp.y (tempbuf, tempbufsize, tempbufindex, GROWBY_MIN_SIZE, - CHECKBUF, growbuf_by_size): New variables, macros, and support - functions for implementing a dynamically expandable temp buffer. - * ch-exp.y (match_string_literal): New lexer function. - * ch-exp.y (match_bitstring_literal): Dynamic buffer code - removed and replaced with new CHECKBUF macro. - * ch-exp.y (yylex): Call match_string_literal when appropriate. - * ch-valprint.c (ch_val_print): Add code for TYPE_CODE_PTR. - -Sat Jan 9 19:59:33 1993 Stu Grossman (grossman at cygnus.com) - - * Makefile.in: Add info for paread.o. - * config/hppahpux.mh: Add paread.o to NATDEPFILES. - - * blockframe.c (frameless_look_for_prologue): Correct the - comment. - * gdbtypes.h, gdbtypes.c: Use const in decl of - cplus_struct_default, now that pa-gas assembler has been fixed. - * hppah-nat.c: Formatting. - * hppah-tdep.c: Remove lots of useless externs for variables we - don't use. - * (find_unwind_entry): Speed up by using binary search, and a one - entry cache. - * (rp_saved): New routine to see what unwind info says about RP - being saved on the stack frame. - * (frame_saved_pc): Look for prologue to see if we need to - examine the stack for the saved RP or not. - * (init_extra_frame_info): Check for prologue, instead of - framesize to determine if we are frameless or not. - * (frame_chain_valid): Stop backtraces when we run into _start. - * (push_dummy_frame): Reformat to make more readable. - * (find_dummy_frame_regs): ditto. - * (hp_pop_frame): ditto. - * (hp_restore_pc_queue): small cleanup. - * (hp_push_arguments): ditto. - * (pa_do_registers_info): ditto. - * (skip_prologue): New routine created from SKIP_PROLOGUE macro. - * tm-hppa.h: Move contents of SKIP_PROLOGUE into hppah-tdep.c. - * Define FRAME_CHAIN_VALID. - * Turn on BELIEVE_PCC_PROMOTION so that we can access char args - passed to functions. - - * paread.c (pa_symtab_read): Use new bfd conventions for - accessing linker symbol table. - * (pa_symfile_init): Access embedded STAB info via BFD section - mechanism and related macros. - - -Sat Jan 9 19:31:43 1993 Stu Grossman (grossman at cygnus.com) - - * sparc-stub.c: Use a seperate stack for our traps. - * Handle recursive traps. - * Remove all trap init code. This needs to be done by the - environment. - * (set_mem_fault_trap): Call exceptionHandler() to setup this - trap. - * (handle_exception): See if we are at breakinst, if so, then - advance PC sp that users can just step out of breakpoint(). - * (case 'G'): Don't let GDB hack CWP. Also, copy saved regs to - new place if SP has changed. - * (case 's'): Get rid of this, we can't do it yet. - * (case 't'): New command to test any old random feature. - * (case 'r'): New command to reset the system. - * (breakpoint): Add label to breakpoint trap instruction so that - handle_exception() can detect where we are and get past the - breakpoint trivially. - -Thu Jan 7 13:33:06 1993 Ian Lance Taylor (ian@cygnus.com) - - * mips-pinsn.c: Actual work now done by opcodes/mips-dis.c. - -Thu Jan 7 09:21:51 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * configure.in: recognise all sparclite variants - -Wed Jan 6 10:14:51 1993 Steve Chamberlain (sac@thepub.cygnus.com) - - * symfile.c: If O_BINARY isn't defined, set it to 0, call openp for - binary files oring in the right bit. - - * main.c, source.c, state.c, symmisc.c: use macros defined in - fopen-{bin|both} when fopening files. - -Wed Jan 6 08:19:11 1993 Fred Fish (fnf@cygnus.com) - - * defs.h (HOST_CHAR_BIT): New macro, defaults to either CHAR_BIT - from a configuration file (typically including ), or to - TARGET_CHAR_BIT if CHAR_BIT is not defined. - * eval.c (evaluate_subexp): Use new BYTES_TO_EXP_ELEM macro. - * eval.c (evaluate_subexp): Add case for OP_BITSTRING. - * expprint.c (print_subexp): Use new BYTES_TO_EXP_ELEM macro. - * exppritn.c (print_subexp, dump_expression): Add case for - OP_BITSTRING. - * expression.h (OP_BITSTRING): New expression element type for - packed bitstrings. - * expression.h (EXP_ELEM_TO_BYTES, BYTES_TO_EXP_ELEM): New - macros to convert between number of expression elements and bytes - to store that many elements. - * i960-tdep.c (leafproc_return): Use new macros to access - minimal symbol name and address fields. - * m88k-pinsn.c (sprint_address): Use new macros to access - minimal symbol name and address fields. - * nindy-tdep.c (nindy_frame_chain_valid): Use new macro to access - minimal symbol address field. - * parse.c (write_exp_elt, write_exp_string, prefixify_expression, - parse_exp_1): Use new EXP_ELEM_TO_BYTES macro. - * parse.c (write_exp_string, length_of_subexp, prefixify_expression): - Use new BYTES_TO_EXP_ELEM macro. - * parse.c (write_exp_bitstring): New function to write packed - bitstrings into the expression element vector. - * parse.c (length_of_subexp, prefixify_subexp): Add case for - OP_BITSTRING. - * parser-defs.h (struct stoken): Document that it is used for - OP_BITSTRING as well as OP_STRING. - * parser-defs.h (write_exp_bitstring): Add prototype. - * ch-exp.y (BIT_STRING_LITERAL): Change token type to sval. - * ch-exp.y (NUM, PRED, SUCC, ABS, CARD, MAX, MIN, SIZE, UPPER, - LOWER, LENGTH): New tokens for keywords. - * ch-exp.y (chill_value_built_in_routine_call, mode_argument, - upper_lower_argument, length_argument, array_mode_name, - string_mode_name, variant_structure_mode_name): New non-terminals - and productions. - * ch-exp.y (literal): Useful production for BIT_STRING_LITERAL. - * ch-exp.y (match_bitstring_literal): New lexer support function - to recognize bitstring literals. - * ch-exp.y (tokentab6): New token table for 6 character keywords. - * ch-exp.y (tokentab5): Add LOWER, UPPER. - * ch-exp.y (tokentab4): Add PRED, SUCC, CARD, SIZE. - * ch-exp.y (tokentab3): Add NUM, ABS, MIN, MAX. - * ch-exp.y (yylex): Check tokentab6. - * ch-exp.y (yylex): Call match_bitstring_literal. - -Mon Jan 4 16:54:18 1993 Fred Fish (fnf@cygnus.com) - - * xcoffexec.c (vmap_symtab): Use new macros to access minimal - symbol name and value fields. - - * c-exp.y (yylex): Make static, to match prototype and other - -exp.y files. - - * expression.h (exp_opcode): Add BINOP_MOD. - * eval.c (evaluate_subexp): Handle new BINOP_MOD. - * expprint.c (dump_expression): Handle new BINOP_MOD. - * language.c (binop_type_check): Handle new BINOP_MOD. - * main.c (float_handler): Re-enable float handler when hit. - * valarith.c (language.h): Include, need current_language. - * valarith.c (TRUNCATION_TOWARDS_ZERO): Define default macro - for integer divide truncates towards zero for negative results. - * valarith.c (value_x_binop): Handle BINOP_MOD if seen. - * valarith.c (value_binop): Allow arithmetic operations on - TYPE_CODE_CHAR variables. Add case to handle new BINOP_MOD. - * ch-exp.y (operand_4): Add useful actions for MOD and REM. - * ch-exp.y (tokentab3): Add MOD and REM. - * ch-exp.y (yylex): Set innermost_block for symbols found - in local scopes. Return LOCATION_NAME for local symbols. - * ch-lang.c (chill_op_print_tab): Fix MOD entry to use - BINOP_MOD instead of BINOP_REM. Add REM entry, using BINOP_REM. - -Mon Jan 4 07:35:31 1993 Steve Chamberlain (sac@wahini.cygnus.com) - - * command.c (shell_escape, make_command, _initialize_command): - don't create or use fork if CANT_FORK is defined. - * serial.h, ser-go32.c: now compiles, but "the obvious problems of - code written for the IBM PC" remain. - * xm-go32.h: define CANT_FORK - -Sun Jan 3 14:24:56 1993 Steve Chamberlain (sac@thepub.cygnus.com) - - * remote-sim.c: first attempt at general simulator interface - * remote-hms.c: whitespace - * h8300-tdep.c: (h8300_skip_prologue, examine_prologue): - understand new stack layout. (print_register_hook): print ccr - register in a fancy way. - -Sun Jan 3 14:16:10 1993 Fred Fish (fnf@cygnus.com) - - * eval.c (language.h): Include. - * eval.c (evaluate_subexp_with_coercion): Only coerce arrays - to pointer types when the current language is C. It loses for - other languages when the lower index bound is nonzero. - * valarith.c (value_subscript): Take array lower bounds into - account when performing subscripting operations. - * valops.c (value_coerce_array): Add comment describing why - arrays with nonzero lower bounds are dealt with in value_subscript, - rather than in value_coerce_array. - -Sat Jan 2 12:16:41 1993 Fred Fish (fnf@cygnus.com) - - * ch-exp.y (FLOAT_LITERAL): Add token. - * ch-exp.y (literal): Add FLOAT_LITERAL. - * ch-exp.y (match_float_literal): New lexer routine. - * ch-exp.y (convert_float): Remove. - * ch-exp.y (yylex): Call match_float_literal. - * ch-exp.y (yylex): Match single '.' after trying - to match floating point literals. - - * eval.c (evaluate_subexp): Add case MULTI_SUBSCRIPT. - * expprint.c (print_subexp): Rename BINOP_MULTI_SUBSCRIPT to - MULTI_SUBSCRIPT. - * expprint.c (dump_expression): New function for dumping - expression vectors during gdb debugging. - * expression.h (BINOP_MULTI_SUBSCRIPT): Name changed to - MULTI_SUBSCRIPT and moved out of BINOP range. - * expression.h (DUMP_EXPRESSION): New macro that calls - dump_expression if DEBUG_EXPRESSIONS is defined. - * m2-exp.y (BINOP_MULTI_SUBSCRIPT): Changed to MULTI_SUBSCRIPT. - * parse.c (length_of_subexp, prefixify_subexp): Change - BINOP_MULTI_SUBSCRIPT to MULTI_SUBSCRIPT. - * parse.c (parse_exp_1): Call DUMP_EXPRESSION before and after - prefixify'ing the expression. - * printcmd.c (print_command_1): Add comment. - * ch-exp.y (expression_list): Add useful actions. - * ch-exp.y (value_array_element): Add useful actions. - * ch-exp.y (array_primitive_value): Add production. - * ch-exp.y (yylex): Recognize ',' as a token. - -Fri Jan 1 18:22:02 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * Makefile.in: pass prefix and exec_prefix via FLAGS_TO_PASS, - POSIXize the recursive makes (make [variable assignments] target{s}) - -Fri Jan 1 11:56:23 1993 Fred Fish (fnf@cygnus.com) - - * tm-sun4sol2.h (CPLUS_MARKER): Remove, now set in tm-sysv4.h. - * tm-sysv4.h (CPLUS_MARKER): By default, g++ uses '.' as the - CPLUS_MARKER for all SVR4 systems, so follow suit. - * defs.h (strdup_demangled): Remove prototype. - * dwarfread.c (enum_type, synthesize_typedef): Use new macro - SYMBOL_INIT_LANGUAGE_SPECIFIC. - * dwarfread.c (new_symbol): Use SYMBOL_INIT_DEMANGLED_NAME. - * minsyms.c (install_minimal_symbols, prim_record_minimal_symbol, - prim_record_minimal_symbol_and_info): Use new macro - SYMBOL_INIT_LANGUAGE_SPECIFIC. - * minsyms.c (install_minimal_symbols): Use new macro - SYMBOL_INIT_DEMANGLED_NAME. - * stabsread.c (define_symbol): Use new macro - SYMBOL_INIT_DEMANGLED_NAME. - * symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list): - Use new macro SYMBOL_INIT_DEMANGLED_NAME. - * symfile.h (ADD_PSYMBOL_VT_TO_LIST): Use new macro - SYMBOL_INIT_DEMANGLED_NAME. - * symmisc.c (dump_msymbols, dump_symtab, print_partial_symbol): - SYMBOL_DEMANGLED_NAME now tests language itself. - * symtab.c (COMPLETION_LIST_ADD_SYMBOL): SYMBOL_DEMANGLED_NAME - now tests language itself. - * symtab.h (SYMBOL_CPLUS_DEMANGLED_NAME): New macro that does - what SYMBOL_DEMANGLED_NAME used to do, directly access the C++ - mangled name member in the language dependent portion of a symbol. - * symtab.h (SYMBOL_DEMANGLED_NAME): New macro that returns the - mangled name member appropriate for a symbol's language. - * symtab.h (SYMBOL_SOURCE_NAME, SYMBOL_LINKAGE_NAME, - SYMBOL_MATCHES_NAME, SYMBOL_MATCHES_REGEXP): - SYMBOL_DEMANGLED_NAME now tests language itself. - * symtab.h (SYMBOL_INIT_LANGUAGE_SPECIFIC): New macro that - initializes language dependent portion of symbol. - * symtab.h (SYMBOL_INIT_DEMANGLED_NAME): New macro that - demangles and caches the demangled form of symbol names. - * utils.c (fputs_demangled, fprint_symbol): Use current language - to select an appropriate demangling algorithm. - * utils.c (strdup_demangled): Remove, no longer used. - * symtab.h (SYMBOL_CHILL_DEMANGLED_NAME): New macro that directly - access the Chill mangled name member in the language dependent - portion of a symbol. - * ch-lang.c (chill_demangle): New function, simple demangler. - * defs.h (chill_demangle): Add prototype. - * symtab.h (language_dependent_info): Add struct for Chill. - -For older changes see ChangeLog-92 - -Local Variables: -mode: indented-text -left-margin: 8 -fill-column: 74 -version-control: never -End: diff --git a/contrib/gdb/gdb/ChangeLog-94 b/contrib/gdb/gdb/ChangeLog-94 deleted file mode 100644 index a691ace..0000000 --- a/contrib/gdb/gdb/ChangeLog-94 +++ /dev/null @@ -1,5705 +0,0 @@ -Fri Dec 30 17:58:55 1994 Steve Chamberlain (sac@jonny.cygnus.com) - - * config/m68k/tm-est.h: Remove cruft. - - -Thu Dec 29 22:40:00 1994 Jeff Law (law@snake.cs.utah.edu) - - * Allow up to 10 whitespace separated arguments to user defined - commands. - * top.c (struct user_args): Structure for holding arguments to - user defined commands. - (print_command_line): Delete unused "tmp_chain" variable. Clean - up flow control by having cases exit in the same manner. - Before executing a command or evaluating an expression, substitute - the current $arg0..$arg9 values if the command/expression uses them. - (arg_cleanup): New function. - (setup_user_args, locate_arg, insert_args): Likewise. - (execute_user_command): Allow arguments to user defined commands. - - * Allow if/while commands to be used within a breakpoint command - list. - * breakpoint.c (bpstat_do_actions): Call execute_control_command - rather than execute_command (passes entire command structure rather - than just the command line text). - (breakpoint_1): Use "print_command_line" to print a breakpoint - command line (including control structures). - * gdbcmd.h (execute_control_command): Provide extern decl. - (print_command_line): Likewise. - * top.c (execute_control_command): No longer static. - (print_command_line): New function to recursively print a command - line, including control structures. - -Thu Dec 29 18:18:31 1994 Rob Savoye - - * hppa-tdep.c (pa_print_registers): Extract register values stored - in big endian format on big and little endian hosts. - - * array-rom.c: Support for Array Tech LSI33k based RAID disk - controller board. - * configure.in: Recognize "mips*-*-ecoff*" rather than - "mips*-idt-ecoff*" so it'll work for the LSI33k. - - * monitor.[ch], op50-rom.c, rom68k-rom.c, w89k-rom.c: Add support - to monitor config structure for supported baud rates for a target - and variable stop bits. - * monitor.c (monitor_fetch_register): Store register values in big - endian format on any host. - -Wed Dec 28 19:27:22 1994 Jeff Law (law@snake.cs.utah.edu) - - * hppa-tdep.c (hppa_fix_call_dummy): Prefer import stubs over - export stubs and actual shared library functions so that lazy - binding works correctly. Try both __d_plt_call and __gcc_plt_call - trampolines for calling import stubs. - -Wed Dec 28 15:29:02 1994 Stan Shebs - - * a29k-tdep.c (pop_frame): Fix a variable name. - -Wed Dec 28 12:21:39 1994 Jeff Law (law@snake.cs.utah.edu) - - * hppa-tdep.c (push_dummy_frame): Refine code to determine what - space ID to place in the stack & inf_status structure. - (hppa_pop_frame): Don't walk through trampoline code if popping a - call dummy frame. - (hppa_fix_call_dummy): Call the stack dummy directly if the - current PC is in a shared library. - - * hppa-tdep.c (push_dummy_frame): Return type is void. Clear - in_syscall bit in flags. Don't depend on the PC queue registers - when in_syscall is set, they're not valid. - * config/pa/tm-hppa.h (PUSH_DUMMY_FRAME): Pass inf_status down to - push_dummy_frame. - (SR4_REGNUM): Define. - - * hppa-tdep.c: Misc. lint changes. - -Tue Dec 27 12:32:43 1994 Jeff Law (law@snake.cs.utah.edu) - - * breakpoint.c (watchpoint_check): Don't bother restoring the - "selected" frame anymore, it's not necessary. Initialize the - frame cache before trying to find the current frame in the frame - chain. - - * somsolib.c (som_solib_add): Return without loading any shared - libraries if symfile_objfile is NULL. - (som_solib_create_inferior_hook): Likewise. - -Fri Dec 23 17:03:13 1994 Steve Chamberlain (sac@jonny.cygnus.com) - - * remote-est.c: New file supports EST-300 CPU32 background - mode ICE. - * remote-utils.c (sr_com): Call registers_changed. - * configure.in (m68*-*-est*): New configuration. - * config/m68k/tm-est.h: New file. - -Fri Dec 23 16:18:50 1994 Stu Grossman (grossman@cygnus.com) - - * Makefile.in (CLIBS): Put LIBIBERTY last. - -Thu Dec 22 09:27:16 1994 Jim Kingdon - - * ser-tcp.c (tcp_open): Cast to struct sockaddr when passing to - function which expects that. - -Thu Dec 22 13:25:33 1994 J.T. Conklin (jtc@rtl.cygnus.com) - - * nlm/gdbserve.c, nlm/ppc.c, nlm/ppc.h: Don't try to use - ALTERNATE_MEM_FUNCS. - -Wed Dec 21 14:00:26 1994 Rob Savoye - - * monitor.c: Now supports xmodem as a remoteloadprotocol. - -Tue Dec 20 23:01:17 1994 Stu Grossman (grossman@cygnus.com) - - * config/mips/xm-irix4.h, config/mips/xm-irix5.h: #define - _BSD_COMPAT to get reliable signal handling. - -Tue Dec 20 11:44:28 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * sparc-tdep.c, a29k-tdep.c, findvar.c (get_saved_register): - if !target_has_registers, call error(). - - * value.h: Remove obsolete comments about FRAME vs struct - frame_info *. - - -Sun Dec 18 11:52:58 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * sparc-tdep.c (sparc_pop_frame): Remove erroneous extra argument - to write_register. - -Sat Dec 17 13:23:21 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * tm-sparc.c (EXTRA_FRAME_INFO): New field sp_offset. - * sparc-tdep.c (sparc_init_extra_frame_info): Set it. - (examine_prologue, sparc_init_extra_frame_info): Use ->frame plus - ->sp_offset to compute the address something is saved at, not - ->bottom. - - * sparc-tdep.c (get_saved_register): New function. - * tm-sparc.h: Define GET_SAVED_REGISTER; don't define - FRAME_FIND_SAVED_REGS, HAVE_REGISTER_WINDOWS or REGISTER_IN_WINDOW_P. - * stack.c (frame_info): Add comment about what to do if - FRAME_FIND_SAVED_REGS is not defined. - - * sparc-tdep.c (sparc_init_extra_frame_info): Set ->frame field - here. Get it right for flat frames. - * sparc-tdep.c (sparc_frame_chain): Instead of returning - meaningful value for ->frame field, just return dummy value. - This change is needed because the old code didn't deal with mixed - flat and non-flat frames. - - * sparc-tdep.c (sparc_pop_frame): Write SP_REGNUM from - frame->frame, don't go through saved regs for this. - - * sparc-tdep.c: Move guts of skip_prologue to new function - examine_prologue. Check for flat prologue and set is_flat. - Provide the caller with the information about what is saved where - if desired. - (skip_prologue, sparc_frame_find_saved_regs): Call examine_prologue. - - * sparc-tdep.c: Replace union sparc_insn_layout and anonymous - union in isannulled, which won't work on a little-endian host, - with X_* macros. - - * sparc-tdep.c (sparc_frame_saved_pc): If addr == 0, the saved PC - is still in %o7. - - * config/sparc/tm-sparc.h: Define INIT_FRAME_PC and - INIT_FRAME_PC_FIRST. - * blockframe.c (get_prev_frame_info): Modify comments regarding - INIT_FRAME_PC_FIRST and the sparc. - - * sparc-tdep.c (single_step): Use 4 not sizeof (long) for size of - instruction. - -Sat Dec 17 02:33:37 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * c-typeprint.c (c_type_print_base): Use `show' of -1 to print - the return type of methods to avoid infinite loops with anonymous - types. - * valops.c (search_struct_field): Handle anonymous unions. - - * sparc-tdep.c (sunos4_skip_trampoline_code): New function - to correctly handle steps into -g compiled PIC objects in the - main executable. - * config/sparc/tm-sun4os4.h (SKIP_TRAMPOLINE_CODE): - Redefine to use sunos4_skip_trampoline_code. - - * dwarfread.c (DWARF_REG_TO_REGNUM): Provide a default mapping - from DWARF to GDB register numbering. - * dwarfread.c (locval): Use DWARF_REG_TO_REGNUM to map the - register value. - * config/mips/tm-mipsv4.h (DWARF_REG_TO_REGNUM): Define. - -Fri Dec 16 10:56:29 1994 J.T. Conklin - - * Makefile.in (uninstall): transform file names. - -Thu Dec 15 16:55:35 1994 Stan Shebs - - * defs.h: Include progress.h. - (QUIT): Call PROGRESS. - * main.c (main): Call START_PROGRESS and END_PROGRESS, break - usage message into shorter strings. - * source.c: Change long command help strings into concats of - shorter ones, for picky ANSI compilers. - - * top.c (command_loop): For space usage display, show both - absolute size and the change from before command execution. - -Thu Dec 15 16:40:10 1994 Stu Grossman (grossman@cygnus.com) - - * defs.h, main.c (gdb_fputs), top.c: Add stream arg to - fputs_unfiltered_hook. - * defs.h, top.c, utils.c (error): Add error_hook. - -Tue Dec 13 15:15:33 1994 Stan Shebs - - * breakpoint.c, infrun.c, printcmd.c: Change long command help - strings into concats of shorter ones, for picky ANSI compilers. - -Mon Dec 12 17:08:02 1994 Stan Shebs - - Sparc flat register window support. - * sparc-tdep.c (sparc_insn_layout): New union, defines layout of - instructions symbolically (used to be local to skip_prologue). - (sparc_init_extra_frame_info): New function. - (sparc_frame_chain): Add flat cases throughout. - (skip_prologue): Add recognition of flat prologues. - (sparc_frame_find_saved_regs): Add flat cases. - (sparc_pop_frame): Ditto. - * config/sparc/tm-sparc.h (EXTRA_FRAME_INFO): New slots. - (INIT_EXTRA_FRAME_INFO): Call sparc_init_extra_frame_info. - (PRINT_EXTRA_FRAME_INFO): Define. - - -Mon Dec 12 13:06:59 1994 Jim Kingdon - - * f-lang.c: Remove duplicate declaration of - builtin_type_f_integer, and only include it in the f_builtin_types - once. - - * somread.c (som_symfile_read): Just assign to objfile->obj_private, - not OBJ_UNWIND_INFO. Assigning to a cast is a GCC-ism which - the HP compiler doesn't like. - - -Fri Dec 9 15:50:05 1994 Stan Shebs - - * remote.c (remote_wait): Pass string instead of char to strcpy. - -Fri Dec 9 04:43:17 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * gdbserver/low-lynx.c (mywait): Remove debugging printf. - -Thu Dec 8 15:07:29 1994 Jim Kingdon - - * frame.h: Restore pre-Nov 3 comments about FRAME_FP with minor - changes. They are correct, unlike the post-Nov 3 comment - (FRAME_FP doesn't have any machine-independent relationship with - FP_REGNUM or any other such notion of a "frame pointer"). - -Wed Dec 7 14:50:54 1994 Jim Kingdon - - * gdbserver/remote-utils.c (write_ok): Write "OK", not "Ok", to - match stubs and protocol spec. - * gdbserver/remote-utils.c (remote_open): Cast to struct sockaddr - when passing to function which expects that. - - The following changes aren't quite enough to make things work with - LynxOS (apprently kernel problems). - * infrun.c (wait_for_inferior): When resuming new thread, pass pid - not -1 for remote case. - * thread.c (info_threads_command): Give error if !target_has_stack. - * infrun.c (start_remote): Call init_thread_list. - * thread.c (info_threads_command): Don't call kill for remote - debugging target. - * target.c (normal_pid_to_str): Print "thread" not "process" for - remote. - * remote.c, gdbserver/*: Add 'H', 'S', and 'C' requests, 'X' - response, and `thread' part of 'T' response. - * gdbserver/*: If program exits, send packet to GDB before - exiting. Handle termination with a signal the same as exiting - with an exitstatus. - * remote.c: Don't try to kill program after getting an 'X' - response. - * infrun.c (wait_for_inferior): Add comment about kill versus mourn. - -Thu Dec 8 12:37:38 1994 Rob Savoye - - * config/pa/tm-pro.h tm-hppap.h, hppapro.mt: Rename tm-hppap.h to - tm-pro.h. - -Wed Dec 7 18:22:59 1994 Stan Shebs - - * source.c: Various cosmetic changes. - (forward_search_command): Handle very long source lines correctly. - -Wed Dec 7 13:21:47 1994 Rob Savoye - - * hppa-tdep.c: Use GDB_TARGET_IS_PA_ELF so SOM target support will - stop being linked in. - - * config/pa/tm-hppap.h: New file. Set GDB_TARGET_IS_PA_ELF, - otherwise it looks like BSD-ELF. - -Mon Dec 5 21:43:52 1994 Stu Grossman (grossman@cygnus.com) - - * inftarg.c: include to get def of pid_t. - -Fri Dec 2 15:03:07 1994 Stan Shebs - - * solib.c (auto_solib_add_at_startup): New global. - (solib_create_inferior_hook): Call solib_add only if - auto_solib_add_at_startup is nonzero. - (_initialize_solib): New command "set auto-solib-add". - -Fri Dec 2 12:52:04 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * parse.c (msymbol_addr_type): Replaced by - lookup_pointer_type (builtin_type_void). - - * printcmd.c (_initialize_printcmd): Give examine_*_type - a name for `ptype $_'. - -Fri Dec 2 12:52:04 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * printcmd.c (print_formatted): Call val_print_string directly, - rather than via value_print. - -Wed Nov 30 22:27:27 1994 Jeff Law (law@snake.cs.utah.edu) - - * somsolib.c (som_solib_get_got_by_pc): New function. - * somsolib.h (som_solib_get_got_by_pc): Add extern decl. - * hppa-tdep.c (hppa_fix_call_dummy): Handle case where FUN is the - function's export stub or real address in a shared library. - -Tue Nov 29 13:40:25 1994 J.T. Conklin (jtc@rtl.cygnus.com) - - * config/i386/nbsd.mh (REGEX, REGEX1): No longer define. - - * configure.in (i[345]86-*-freebsd*): New configuration. - * config/i386/{fbsd.mh,fbsd.mt,nm-fbsd.h}: New files. - -Tue Nov 29 12:23:25 1994 Stan Shebs (shebs@andros.cygnus.com) - - * top.c (read_next_line): Pass annotation suffix "commands" - instead of "command", matches documentation. - -Mon Nov 28 14:53:21 1994 Stan Shebs (shebs@andros.cygnus.com) - - * config/a29k/tm-a29k.h (setup_arbitrary_frame): Replace - FRAME_ADDR with CORE_ADDR in prototype. - - * top.c (command_line_input): If annotation suffix is NULL, - replace it with an empty string. - (read_next_line): Pass "command" as annotation suffix to - command_line_input. - -Mon Nov 28 11:03:14 1994 J.T. Conklin (jtc@rtl.cygnus.com) - - * config/rs6000/tm-rs6000.h (setpgrp): move defn from here... - * config/rs6000/xm-rs6000.h: ...to here. - - -Fri Nov 25 21:26:02 1994 Jeff Law (law@snake.cs.utah.edu) - - * tm-hppa.h (skip_trampoline_code): Add extern decl. - * hppa-tdep.c (hppa_pop_frame): Silently restart the inferior and - allow it to execute any return path trampoline code. Stop the - inferior and give the user control when the trampoline has - finished executing. - (in_solib_call_trampoline): Handle export stubs which also perform - parameter relocations. - (in_solib_return_trampoline): Likewise. - -Fri Nov 25 13:37:10 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * coffread.c, symfile.h (coff_getfilename): Make it static again. - * xcoffread.c (coff_getfilename): Use a static copy from - coffread.c, modified for accessing the static xcoff strtbl. - -Fri Nov 25 00:51:05 1994 Jeff Law (law@snake.cs.utah.edu) - - * hppa-tdep.c (in_solib_call_trampoline): Recognize calls through - _sr4export and $$dyncall as trampolines. Likewise for long-call - stubs and parameter relocation stubs. - (in_solib_return_trampoline): Recognize a return trampoline for - return value relocation stubs. - - * hpread.c: Include hp-symtab.h instead of hpux-symtab.h. - Various name changes to match those used by hp-symtab.h. - -Thu Nov 24 00:39:27 1994 Jeff Law (law@snake.cs.utah.edu) - - * blockframe.c (find_pc_partial_function): Inhibit mst_trampoline - symbol special handling when INHIBIT_SUNSOLIB_TRANSFER_TABLE_HACK - is defined. - * infrun.c (IN_SOLIB_CALL_TRAMPOLINE): Renamed from - IN_SOLIB_TRAMPOLINE. All callers changed. - (IN_SOLIB_RETURN_TRAMPOLINE): Provide default definition. - (wait_for_inferior): Handle single stepping through trampolines on - return paths from shared libraries. - * config/pa/tm-hppa.h (IN_SOLIB_CALL_TRAMPOLINE): Use - in_solib_call_trampoline. - (IN_SOLIB_RETURN_TRAMPOLINE): Use in_solib_return_trampoline. - (INHIBIT_SUNSOLIB_TRANSFER_TABLE_HACK): Define. - * hppa-tdep.c (in_solib_call_trampoline): New function. - (in_solib_return_trampoline): New function. - -Wed Nov 23 21:43:03 1994 Steve Chamberlain (sac@jonny.cygnus.com) - - * tm-h8300.h (REMOTE_BREAKPOINT): Define. - * h8300-tdep.c (h8300_pop_frame): Remove redundant call. - - * remote-e7000.c (HARD_BREAKPOINTS): Reenable. - (BC_BREAKPOINTS): Disable. - * sh-tdep.c (print_insn): Cope with big and little endian machines. - * sh/sh.mt: Use libsim.a - * sh/tm-sh.h (TARGET_BYTE_ORDER_SELECTABLE): New - (BREAKPOINT): Changed to be byteorder independent. - -Tue Nov 22 19:13:39 1994 Stan Shebs (shebs@andros.cygnus.com) - - Maintenance commands to report time and space usage. - * main.c (display_time, display_space): New globals. - (main): Add argument --statistics to enable reporting, display - time and space after startup is done. - * maint.c (maintenance_time_display, maintenance_space_display): - New commands. - * top.c (command_loop): Display time and space after command - execution. - - * top.c (pre_init_ui_hook): New global. - (gdb_init): If pre_init_ui_hook set, call before all other init. - -Tue Nov 22 10:25:59 1994 Kung Hsu (kung@mexican.cygnus.com) - - * a29k-tdep.c (examine_tag): Fix a bug in stack frame size. - -Sat Nov 19 03:10:51 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * config/i386/i386sol2.mh: Reenable core file support. - - * symfile.c (deduce_language_from_filename): Treat .c++ as a - C++ extension. - - * valops.c (destructor_name_p): Do not compare the template - part for template classes. - -Fri Nov 18 14:55:59 1994 Stan Shebs (shebs@andros.cygnus.com) - - * defs.h, infcmd.c (reg_names): Don't declare as constant. - * remote-mips.c (mips_open): Read and set the processor type. - * mips-tdep.c (mips_set_processor_type): Always return an int. - -Fri Nov 18 10:38:12 1994 J.T. Conklin - - * nlm/alpha.c (strtol): Remove, it is provided by NetWare C library. - * nlm/gdbserve.def (strtol): Add to import list. - * nlm/fake_aio.c: Remove file, no longer used. - - * Makefile.in (LD_FOR_TARGET, NLMCONV_FOR_TARGET): Remove. - * nlm/Makefile.in (gdbserve.O): Link with ${CC_FOR_TARGET}. - (LD_FOR_TARGET): Remove. - -Thu Nov 17 22:09:50 1994 Rob Savoye - - * monitor.h, monitor.c, w89k-rom.c, op50n-rom.c, idp-rom.c: Add - support for two variables used to control the load protocol and - conversion type. - -Thu Nov 17 17:51:12 1994 Stan Shebs (shebs@andros.cygnus.com) - - Support for different MIPS IDT processor models. - * mips-tdep.c (mips_processor_type, tmp_mips_processor_type, - mips_generic_reg_names, mips_r3041_reg_names, - mips_r3051_reg_names, mips_r3081_reg_names, - mips_processor_type_table): New globals. - (mips_do_registers_info): Don't display register if name is empty. - (mips_set_processor_type_command): New command. - (mips_show_processor_type_command): New command. - (mips_set_processor_type): New function. - (mips_read_processor_type): New function. - * config/mips/tm-idt.h (DEFAULT_MIPS_TYPE): New macro. - * config/mips/tm-mips.h (DEFAULT_MIPS_TYPE): New macro. - (NUM_REGS): Increase to account for all CP0 registers. - (REGISTER_NAMES): Add empty names for CP0 registers. - (FIRST_EMBED_REGNUM, LAST_EMBED_REGNUM): Adjust. - (PRID_REGNUM): New macro. - -Wed Nov 16 16:41:52 1994 Stan Shebs (shebs@andros.cygnus.com) - - * README: Add warning about termcap in Ultrix and OSF/1. - -Wed Nov 16 15:28:29 1994 Rob Savoye (rob@cygnus.com) - - - * hppa-tdep.c: Remove including sys/dir.h from a target file. - -Wed Nov 16 10:31:27 1994 J.T. Conklin (jtc@cygnus.com) - - * config/powerpc/gdbserve.mt (TDEPFILES): Remove fake_aio.o. - - * nlm/gdbserve.c: Include before other NetWare headers. - * nlm/ppc.c: Likewise. - - * nlm/ppc.c (strtol): Remove, it is provided by NetWare C Library. - (StopBell): New function (stubbed out). - -Wed Nov 16 00:12:21 1994 Jeff Law (law@snake.cs.utah.edu) - - * hppa-tdep.c (skip_trampoline_code): Handle shared library import - trampolines. - -Tue Nov 15 16:18:52 1994 Kung Hsu (kung@mexican.cygnus.com) - - * c-exp.y (yylex): Fix a bug in template scanning. - -Tue Nov 15 14:25:47 1994 Stan Shebs (shebs@andros.cygnus.com) - - * i386-stub.c, m68k-stub.c, sparc-stub.c, sparcl-stub.c: Mask out - the top bit returned by getDebugChar. - -Tue Nov 15 01:03:56 1994 Rob Savoye (rob@slipknot.cygnus.com) - - * op50-rom.c, w89k-rom.c, monitor.c: Modify to usr two variables - to set remote load type and protocol. - * rom68k-rom.c: Add to_stop in target_ops. - - -Sat Nov 12 21:55:47 1994 Jeff Law (law@snake.cs.utah.edu) - - * somsolib.c: Add TODO list. - (som_solib_add): Immediately return if $SHLIB_INFO$ sections does - not exist or has size zero. Slightly simplify error handling. - Keep an internal list of all the loaded shared libraries and - various tidbits of information about the loaded shared libraries. - Build section tables for each loaded shared library and add those - tables to the core target if necessary. - (som_solib_create_inferior_hook): Force re-reading of shared - libraries at exec time. - (som_sharedlibrary_info_command): New function for dumping - information about the currently loaded shared libraries. - (_initialize_som_solib): New function. - -Sat Nov 12 02:26:50 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * Makefile.in (copying.o, f-exp.tab.o, dpx2-nat.o, dstread.o, - i386aix-nat.o, i386m3-nat.o, irix5-nat.o, lynx-nat.o, m3-nat.o, - mipsm3-nat.o, ns32km3-nat.o, remote-e7000.o, remote-os9k.o): - Add dependencies. - (copying.o, os9kread.o, remote.o): Update dependencies. - - * valarith.c (value_sub): When subtracting pointers, only - check for a match of the pointed to element lengths. - Cast element length to LONGEST to obtain a signed result for - pointer subtractions. - -Fri Nov 11 10:51:07 1994 Jeff Law (law@snake.cs.utah.edu) - - * ch-exp.y (yylex): Fix off-by-one error when converting string to - lowercase. Null terminate new string. - - * hppa-tdep.c (rp_saved): Handle IMPORT stubs too. - - * somsolib.c (som_solib_add): Check the value of __dld_flags, if - it indicates __dld_list is not valid return an error. If it - indicates that libraries were not mapped privately, issue a - warning. - -Thu Nov 10 23:17:45 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * symfile.c (syms_from_objfile): Only call find_lowest_section if - no ".text" section exists. - -Thu Nov 10 15:16:21 1994 Rob Savoye - - * rom68k-rom.c: New file. Replaces the old remote-mon.c and uses - the new generic ROM interface in monitor.c. - * config/m68k/monitor.mt: Use new ROM support. - * monitor.c: Add support for xmodem download protocol. - -Wed Nov 9 18:46:24 1994 Stan Shebs (shebs@andros.cygnus.com) - - * findvar.c (find_saved_register): Fix a frame variable name. - * infcmd.c (finish_command): Ditto. - -Tue Nov 8 13:20:14 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * TODO: Remove "Watchpoints seem not entirely reliable, though - they haven't failed me recently." item--this old (4.6 at least) - item is too vague to be useful (some watchpoint bugs have been - fixed since then). - * TODO: Add explanation of "RPC interface" item. - -Mon Nov 7 22:25:21 1994 Jeff Law (law@snake.cs.utah.edu) - - * hppa-tdep.c (read_unwind_info): Use "text_offset" for linker - stub unwind descriptors too. - - * Enable backtracing from inside a SOM shared library back into - user code. - * hppa-tdep.c (internalize_unwinds): Accept and use new - "text_offset" argument for dynamic relocation of - region_{start,end} fields in the unwind descriptor. - (read_unwind_info): Pass text_offset to internalize unwinds. - -Mon Nov 7 14:34:42 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * m3-nat.c: Remove comments about arbitrary limit in - printf_filtered; that limit is gone. - -Mon Nov 7 00:27:16 1994 Jeff Law (law@snake.cs.utah.edu) - - * Beginnings of SOM shared library support. Breakpoints and - single frame backtracing within the library only. Only works when - using the HPUX 9 dynamic linker. More functionality to be added - soon. - - * somsolib.c, somsolib.h: New files. - * Makefile.in (HFILES_NO_SRCDIR): Add somsolib.h - (ALLDEPFILES): Add somsolib.c. - (somsolib.o): Add some dependencies. - * somread.c (som_symtab_read): Accept multiple section offsets. - All callers changed. Adjust all text symbols with the first - section offset. - * symfile.c (find_lowest_section): Enable this function. Add some - tie-breaking logic when sections have the same vma. - (syms_from_objfile): Use find_lowest_section rather than looking - for ".text" by name. Relax warning to only warn if the lowest - section is not a code section. - * config/pa/{hppabsd.mh, hppahpux.mh} (NATDEPFILES): Add somsolib.o - * config/pa/{nm-hppab.h, nm-hppah.h}: Include somsolib.h. - -Sun Nov 6 12:54:54 1994 Jeff Law (law@snake.cs.utah.edu) - - * partial-stab.h (N_TEXT): Put back GDB_TARGET_IS_HPPA kludge, - it is still needed for GCC-2.6 compiled code. - * TODO (GDB_TARGET_IS_HPPA): Note this kludge can be nuked - sometime after GCC-2.7 has been released. - - * hppa-tdep.c (frame_saved_pc): Mask off low two bits when - retrieving the PC from a signal handler caller. Fix thinko - in Stan's last change ("frame", should have been "frame->next"). - If the next frame is a signal handler caller and it's a system - call which has entered the kernel ((PSW & 0x2) != 0), then the - saved pc is in %r2 instead of %r31. - -Fri Nov 4 23:47:07 1994 Jeff Law (law@snake.cs.utah.edu) - - * hppa-tdep.c (hppa_frame_find_saved_regs): Change "frame" to - "frame_info" throughout. - -Fri Nov 4 16:26:59 1994 Kung Hsu (kung@mexican.cygnus.com) - - * sparcl-stub.c: get rid of defs.h. - -Fri Nov 4 13:11:54 1994 Jim Kingdon - - * gdbserver/Makefile.in (MMALLOC_CFLAGS): Add -I${MMALLOC_DIR}. - Correct definition of MMALLOC_DIR to reflect fact this is - gdb/gdbserver/Makefile.in, not gdb/Makefile.in. - - * gdbserver/server.c (main): After we kill the inferior in - response to a 'k' request, exit. - - * remote.c (remote_kill): Use catch_errors when calling putpkt. - (putpkt): Return int, not void, to match catch_errors calling - convention. - -Fri Nov 4 10:52:38 1994 Stan Shebs (shebs@andros.cygnus.com) - - * rs6000-tdep.c (pop_frame): Correct a variable name. - -Fri Nov 4 05:43:35 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * TODO: Re-write item about SIGINT handling to reflect the fact - that target_stop now exists. - -Thu Nov 3 15:19:17 1994 Stan Shebs (shebs@andros.cygnus.com) - - Replace useless FRAME, FRAME_ADDR types with struct frame_info * - and CORE_ADDR, respectively. - * frame.h (FRAME, FRAME_INFO_ID, FRAME_ADDR): Remove. - * blockframe.c (get_frame_info): Remove. - * a29k-tdep.c, alpha-tdep.c, blockframe.c, breakpoint.c, - breakpoint.h, energize.c, findvar.c, gould-pinsn.c, - h8300-tdep.c, h8500-tdep.c, hppa-tdep.c, i386-tdep.c, i960-tdep.c, - infcmd.c, inferior.h, infrun.c, m68k-tdep.c, m88k-tdep.c, - mips-tdep.c, nindy-tdep.c, printcmd.c, pyr-tdep.c, rs6000-tdep.c, - sh-tdep.c, sparc-tdep.c, stack.c, valops.c, z8k-tdep.c, - config/a29k/tm-a29k.h, config/alpha/tm-alpha.h, - config/gould/tm-pn.h, config/h8300/tm-h8300.h, - config/h8500/tm-h8500.h, config/mips/tm-mips.h, - config/ns32k/tm-merlin.h, config/ns32k/tm-umax.h, - config/pyr/tm-pyr.h, config/sparc/tm-sparc.h): Replace FRAME with - struct frame_info * everywhere, replace FRAME_ADDR with CORE_ADDR, - rename variables consistently (using `frame' or `fi'), remove - calls to get_frame_info and FRAME_INFO_ID, remove comments about - FRAME and FRAME_ADDR cruftiness. - -Thu Nov 3 14:25:24 1994 Stu Grossman (grossman@cygnus.com) - - * corelow.c, exec.c, inftarg.c, m3-nat.c, op50-rom.c, procfs.c, - remote-adapt.c, remote-e7000.c, remote-eb.c, remote-es.c, - remote-hms.c, remote-mips.c, remote-mm.c, remote-mon.c, - remote-nindy.c, remote-os9k.c, remote-pa.c, remote-sim.c, - remote-st.c, remote-udi.c, remote-vx.c, remote-z8k.c, remote.c, - w89k-rom.c, target.c, target.h: Add support for target_stop(). - -Thu Nov 3 01:23:45 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * osfsolib.c (solib_map_sections, first_link_map_member, - next_link_map_member, xfer_link_map_member): Retrieve and use - shared library relocation offset from runtime loader structures. - Use libxproc.a routines to get a working version if - USE_LDR_ROUTINES is defined. - * README: Remove item about shared library relocation for - Alpha OSF/1. - -Wed Nov 2 15:05:39 1994 Kung Hsu (kung@mexican.cygnus.com) - - * c-exp.y (yylex): scan template names, and scan nested class - names. - -Wed Nov 2 11:01:55 1994 J.T. Conklin (jtc@phishhead.cygnus.com) - - * nlm/Makefile.in: install gdbserve.nlm. - - -Tue Nov 1 13:00:46 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * c-valprint.c (c_value_print): Check for plain literal `char' - target type when suppressing `(char *)' output for strings. - -Mon Oct 31 19:19:51 1994 Stan Shebs (shebs@andros.cygnus.com) - - * coffread.c (coff_symfile_init): Remove unused local abfd. - * utils.c [NO_MMALLOC] (mmalloc, mrealloc): Define and use size_t - instead of long, for compatibility with mmalloc.h. - -Sat Oct 29 02:40:40 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * top.c (line_completion_function): Renamed from - symbol_completion_function, takes the line buffer and the - point in the line buffer as additional arguments. - (readline_line_completion_function): New function, interface - between readline and line_completion_function. - (init_main): Use it. - (complete_command): Use line_completion_function instead of - abusing rl_line_buffer. Free completion strings after printing - them. - * symtab.c (completion_list_add_name): Recheck for duplicates - if we intend to add a modified symbol. - - * gdbtypes.h (cplus_struct_type): nfn_fields_total no longer - includes the number of methods from the baseclasses. - * stabsread.c (attach_fn_fields_to_type): No longer add the - number of methods from the baseclasses to TYPE_NFN_FIELDS_TOTAL, - the baseclass type might not have been completely filled in yet. - * symtab.c (total_number_of_methods): New function to compute - the total number of methods for a type, including the methods - from baseclasses. - (decode_line_1): Use it instead of TYPE_NFN_FIELDS_TOTAL to - allocate the symbol array for find_methods. - - * stabsread.c (scan_file_globals): Add default case to minimal - symbol type switch, to avoid gcc -Wall warnings. - - * config/rs6000/tm-rs6000.h (INIT_EXTRA_FRAME_INFO): - Don't test for zero backchain pointer to recognize a signal - handler frame, if read() gets interrupted by a signal, the - backchain will be non zero. - (SIG_FRAME_FP_OFFSET): Move to here from rs6000-tdep.c, - improve comment. - (SIG_FRAME_PC_OFFSET): New definition. - (FRAME_SAVED_PC): Return saved pc from sigcontext if this - is a signal handler frame. - * rs6000-tdep.c (function_frame_info): Do not error out - if we can't access the instructions. - - * config/rs6000/tm-rs6000.h (CONVERT_FROM_FUNC_PTR_ADDR): - New definition to get the function address from a function pointer. - * valops.c (find_function_addr): Use it when calling a user - function through a function pointer. - -Fri Oct 28 16:16:52 1994 Stan Shebs (shebs@andros.cygnus.com) - - * Makefile.in (MMALLOC_DIR): New definition. - (MMALLOC): Use MMALLOC_DIR. - (MMALLOC_CFLAGS): Look in MMALLOC_DIR for mmalloc.h. - (OPCODES): Remove gratuitous "./". - * defs.h (mmalloc.h): Include. - (mmalloc, mrealloc, etc): Remove decls. - (cplus_demangle, cplus_demangle_opname): Remove decls. - -Wed Oct 26 15:41:07 1994 Stu Grossman (grossman@cygnus.com) - - * defs.h, main.c, top.c: Change sense and name of - no_windows variable. Now called use_windows, and defaults to off - (for compatibility). - -Wed Oct 26 12:20:53 1994 Jim Kingdon - - * coffread.c (coff_symtab_read): If we get the address from - target_lookup_symbol, set the section to -2 not SECT_OFF_BSS. - (coff_symtab_read): Set value and section of symbol that - process_coff_symbol returns. - -Tue Oct 25 09:53:04 1994 J.T. Conklin (jtc@phishhead.cygnus.com) - - * config/i386/tm-nbsd.h: Enable longjmp support. - -Sat Oct 22 03:41:13 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * valarith.c (value_binop): Take care of ANSI `value preserving' - rule, which was not addressed by the previous change. - - * rs6000-tdep.c (skip_prologue): Handle `mr r31,r1', which is - generated by gcc-2.6, as a synonym for `oril r31,r1,0'. - - * TODO: Remove item about RS/6000 shared libraries. - -Thu Oct 20 17:35:45 1994 Stu Grossman (grossman@cygnus.com) - - * defs.h, infrun.c (wait_for_inferior), top.c: Call - target_wait_hook to allow GUI to handle blocking for inferior. Call - call_command_hook in execute_command to provide means for wrapping - commands with GUI state change updates. - - * infrun.c (wait_for_inferior): Make sure - through_sigtramp_breakpoint is non-null before deleting. - -Thu Oct 20 10:26:43 1994 J.T. Conklin (jtc@phishhead.cygnus.com) - - * config/powerpc/ppc-nw.mt (TDEPFILES): Removed exec.o. - -Thu Oct 20 06:56:07 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Makefile.in (coffread.o): Depend on target.h. - (remote-vx.o): Depend on gdb-stabs.h objfiles.h symfile.h $(bfd_h). - -Wed Oct 19 22:49:31 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * TODO: Fix typo. - -Wed Oct 19 11:32:15 1994 Jim Kingdon - - * objfiles.c (objfile_relocate): When relocating ->sections, use - objfile not symfile_objfile. - - * symtab.h, minsyms.c (minsyms_sort): New function. - * objfiles.c (objfile_relocate): Call it. - - * remote-vx.c (vx_add_symbols): Call breakpoint_re_set. - - * objfiles.c, objfiles.h (objfile_to_front): New function. - * remote-vx.c (vx_add_symbols): Call it. - - * coffread.c (coff_symtab_read): Handle common symbols the same - way that partial-stab.h does. - -Wed Oct 19 21:06:12 1994 Rob Savoye (rob@cirdan.cygnus.com) - - * hppa-tdep.c: Remove include files a.out.h, ioctl.h, and - machine/psl.h. These are host files. - -Wed Oct 19 15:13:51 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * objfiles.h (struct objfile): Fix comment--minimal_symbol_count - does *not* include the terminating NULL msymbol. - -Tue Oct 18 20:53:29 1994 Rob Savoye - - * monitor.c (monitor_load_srec,monitor_make_srec): Add an asrecord - loader that reads files using BFD and converts it on the fly. - -Mon Oct 17 18:52:06 1994 Rob Savoye - - * monitor.c (set_loadtype_command): Fixed so it doesn't core dump. - * monitor.c (monitor_load): check the load type and load the file - accordingly. Default to gr_load_image(). - * monitor.c (monitor_load_ascii_srec): Load an ascii file in - srecord format by downloading to the monitor. - * w89k-rom.c, op50n-rom.c: set supported load types. - -Mon Oct 17 10:29:08 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Makefile.in (ALLDEPFILES): Remove xcoffexec.c. - * Makefile.in: Remove xcoffexec.o rule. - - * exec.c (exec_file_command): Add comment. - - Fix data and bss relocation for VxWorks 5.1: - * remote-vx.c (vx_add_symbols): New function. - (vx_load_command, add_symbol_stub): Call it instead of - symbol_file_add. - (vx_wait): Remove comment which was wrong to useless. - * remote-vx.c: Reindent much of file. - * coffread.c (cs_to_section, find_targ_sec): New functions. - (process_coff_symbol): Set SYMBOL_SECTION to result - from cs_to_section. - (coff_symtab_read): Call cs_to_section and deal with result - rather than assuming sections are in a certain order. Deal with - BSS. - * coffread.c: Remove text_bfd_scnum variable. - -Sat Oct 15 16:55:48 1994 Stan Shebs (shebs@andros.cygnus.com) - - * corelow.c: Format to standard. - (core_close): Use name instead of bfd_filename. - -Fri Oct 14 10:29:08 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * exec.c (map_vmap): Cast return from xmalloc to its proper type, - not to PTR. - - * symfile.c (reread_symbols): Include bfd_errmsg string in error - message if bfd_close fails. - * exec.c (exec_close), solib.c (clear_solib), corelow.c - (core_close), objfiles.c (free_objfile), irix5-nat.c - (clear_solib), osfsolib.c (clear_solib), remote-utils.c - (gr_load_image): Check for errors from bfd_close. - * solib.c (look_for_base), remote-utils.c (gr_load_image), - remote-udi.c (download), corelow.c (core_open), symfile.c - (symfile_bfd_open), symfile.c (generic_load): Add comment - regarding error from bfd_close. - * remote-udi.c (download), remote-utils.c (gr_load_image): Add - comment about bogus handling of errors from bfd_openr. - * exec.c (exec_close): Add comment regarding memory leak and - dangling reference to vp->name. - -Sat Oct 15 03:43:00 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * eval.c (evaluate_subexp): Make fnptr a LONGEST instead - of using longest_to_int. - - * infcmd.c (run_stack_dummy): Reinstate set_current_frame call, - mips and alpha targets need the real breakpoint pc for - creating the breakpoint frame. - - * stack.c (return_command): Cast return value to the return - type of the function from which we return. - * values.c (set_return_value): Pass VALUE_CONTENTS unmodified - to STORE_RETURN_VALUE. - - * symtab.c (lookup_symbol): Remove search for `static mangled - symbols', the search for `static symbols' already looks for - mangled and demangled symbols via lookup_block_symbol. - - * valarith.c (value_binop): Use ANSI C arithmetic conversions - when performing integral evaluations, implement BINOP_EQUAL and - BINOP_LESS. - (value_equal, value_less): Use value_binop to perform the - comparison if both operands have TYPE_CODE_INT. - - * rs6000-tdep.c (pop_frame): Make sure all registers are valid, - as they are written back later. Handle sp restore for frameless - functions. Use fdata.nosavedpc instead of fdata.frameless to - determine if the pc has been saved. - (function_frame_info): Handle `mr r31,r1', which is generated by - gcc-2.6, as a synonym for `oril r31,r1,0'. - (skip_trampoline_code): Handle shared library trampolines. - * xcoffread.c (read_xcoff_symtabs): Record XMC_GL symbols with - their real name. Enables setting of breakpoints in shared libraries - before the executable is run. - -Fri Oct 14 19:39:47 1994 Rob Savoye - - * monitor.h, remote-mon.c: Hack up to so the old ROM monitor - interface code still works with the new ROM monitor - structures. Fake out a couple of fields. - -Fri Oct 14 14:54:37 1994 Stan Shebs (shebs@andros.cygnus.com) - - * h8500-tdep.c (target_read_sp, target_write_sp, target_read_pc, - target_write_pc, target_read_fp, target_write_fp): Rename to - h8500_read_sp, etc. - (h8500_read_pc, h8500_write_pc): Add pid argument. - * config/h8500/tm-h8500.h (TARGET_READ_SP, TARGET_WRITE_SP, - TARGET_READ_PC, TARGET_WRITE_PC, TARGET_READ_FP, TARGET_WRITE_FP): - Change to match functions above. - -Thu Oct 13 13:24:29 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * NEWS: Add item about if and while. - - * .gdbinit: Restore `end'; it was not excess. Reindent - list-objfiles to make this clear. Comment out all of - list-objfiles because old gdb's choke on it. - -Wed Oct 12 23:19:08 1994 Ian Lance Taylor - - * config/mips/tm-bigmips64.h: Just define TARGET_BYTE_ORDER and - include tm-mips64.h. - -Wed Oct 12 18:02:17 1994 Stan Shebs (shebs@andros.cygnus.com) - - * Makefile.in (ANNOTATE_OBS): New definition. - (COMMON_OBS): Add exec.o. - (annotate.o): Remove extra compile rule. - * config/*/*.mh, config/*/*.mt: Remove exec.o from *DEPFILES lists - everywhere. - - * .gdbinit: Remove excess `end'. - - * exec.c: Merge in RS6000 support from xcoffexec.c. - (symfile.h, objfiles.h, xcoffsolib.h): Include. - (vmap): New global variable. - (exec_close): Close and free objects in vmap chain. - (exec_file_command) [IBM6000_TARGET]: Set up initial vmap. - (bfdsec_to_vmap, map_vmap): Moved here from xcoffexec.c. - (exec_files_info): Print vmap information. - * xcoffexec.c: Remove. - * config/rs6000/rs6000.mt, config/rs6000/rs6000lynx.mt - (TDEPFILES): Use exec.o instead of xcoffexec.o. - * TODO: Remove pertinent items. - -Wed Oct 12 10:08:19 1994 Jeff Law (law@snake.cs.utah.edu) - - * partial-stab.h (N_TEXT): Delete GDB_TARGET_IS_HPPA kludge; they - are no longer needed as of gcc-2.6.0. - -Tue Oct 11 15:51:01 1994 Ian Lance Taylor - - * lynx-nat.c (child_wait): Correct handling of byte reversed SPARC - Lynx wait status. - (fetch_core_registers): Don't try to fetch a register if - regmap maps it to -1. - * sparc-tdep.c (sparc_frame_find_saved_regs): Use FRAME_SAVED_I0 - and FRAME_SAVED_L0 when setting saved_regs_addr. SPARC Lynx - stores the registers in a weird order. - -Sat Oct 8 20:59:13 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * blockframe.c (reinit_frame_cache): Reinstate select_frame call - if inferior_pid is nonzero. - -Sat Oct 8 04:27:21 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - Speed up GDB startup time by not demangling partial symbols. - * symfile.h (ADD_PSYMBOL_VT_TO_LIST), - symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list): - No longer demangle partial symbols. - * symtab.c (lookup_symbol, list_symbols): Handle mangled - variables, e.g. C++ static members, via the minimal symbols. - - Handle reordered functions in an objfile, for Irix 5.2 shared - libraries. - * objfiles.h (OBJF_REORDERED): New bit in the objfile flags, - set if the functions in an objfile are reordered. - * mdebugread.c (parse_partial_symbols): Detect reordered - functions in an objfile. - * symtab.c (find_pc_psymtab, find_pc_symtab): Use expensive - lookup algorithm if the functions in the objfile are reordered. - - * xcoffexec.c (exec_close): If the current target has a copy - of the exec_ops sections, reflect the freeing of the sections - in current_target. - - * valops.c (call_function_by_hand): Use `sizeof dummy1', not - `sizeof dummy', for constructing the call dummy code. - - * config/sparc/tm-sparc.h: Add PARAMS declarations to all - function declarations. - * sparc-tdep.c (sparc_pop_frame): Cast result of - read_memory_integer to CORE_ADDR when passing it to PC_ADJUST. - - * irix5-nat.c (enable_break): Set breakpoint at the entry point - of the executable, to handle the case where main resides in a - shared library. - * irix5-nat.c (solib_create_inferior_hook): Reset stop_soon_quietly - after shared library symbol reading, to get rid of a warning from - heuristic_proc_start if the startup code has no symbolic debug info. - - * breakpoint.h (struct breakpoint): Add new fields language - and input_radix, to enable breakpoint resetting with the - proper language and radix. - * breakpoint.c (set_raw_breakpoint): Initialize them. - (breakpoint_re_set_one): Use them when resetting the breakpoint. - (breakpoint_re_set): Preserve current language and input_radix - across breakpoint_re_set_one calls. - - * symtab.c (decode_line_1): Do not build a canonical line - specification for `*expr' line specifications. - - * breakpoint.h (bpstat_stop_status): Fix prototype declaration. - -Fri Oct 7 08:48:18 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - The point of these changes is to avoid reading the frame pointer - and stack pointer during stepping, to speed things up. - A. Changes to not select a frame until we need a selected frame: - * blockframe.c (flush_cached_frames): Call select_frame (NULL, -1). - * infrun.c (wait_for_inferior): Move call to select_frame back to - normal_stop. This reverts a change of 13 Apr 94 (it says Jeff - Law, but the change was my idea); the only reason for that change - was so we could save and restore the selected frame in - wait_for_inferior, and now that flush_cached frames clears the - selected frame, that should work OK now. - B. Changes to not create a current_frame until we need one: - * blockframe.c (get_current_frame): If current_frame is NULL, try - to create an innermost frame. - * sparc-tdep.c (sparc_pop_frame), infcmd.c (run-stack_dummy), - infrun.c (wait_for_inferior), thread.c (thread_switch), - convex-tdep.c (set_thread_command), a29k-tdep.c (pop_frame), - alpha-tdep.c (alpha_pop_frame), convex-xdep.c (core_file_command), - h8300-tdep.c (h8300_pop_frame), h8500-tdep.c (h8300_pop_frame), - hppa-tdep.c (hppa_pop_frame), i386-tdep.c (i386_pop_frame), - i960-tdep.c (pop_frame), m68k-tdep.c - (m68k_pop_frame), mips-tdep.c (mips_pop_frame), rs6000-tdep.c - (push_dummy_frame, pop_dummy_frame, pop_frame), sh-tdep.c - (pop_frame), config/arm/tm-arm.h (POP_FRAME), - config/convex/tm-convex.h (POP_FRAME), config/gould/tm-pn.h - (POP_FRAME), config/ns32k/tm-merlin.h (POP_FRAME), - config/ns32k/tm-umax.h (POP_FRAME), config/tahoe/tm-tahoe.h - (POP_FRAME), config/vax/tm-vax.h (POP_FRAME): Don't - call create_new_frame. - * corelow.c (core_open), altos-xdep.c (core_file_command), - arm-xdep.c (core_file_command), gould-xdep.c (core_file_command), - m3-nat.c (select_thread), sun386-nat.c (core_file_command), - umax-xdep.c (core_file_command): Don't call create_new_frame; do - call flush_cached_frames. - * blockframe.c (reinit_frame_cache): Don't call create_new_frame - or select_frame. - C. Changes to get rid of stop_frame_address and instead only - fetch the frame pointer when we need it. - * breakpoint.c (bpstat_stop_status): Remove argument - frame_address; use FRAME_FP (get_current_frame ()). - * infrun.c (wait_for_inferior): Don't pass frame pointer to - bpstat_stop_status. - * infrun.c (wait_for_inferior): Use FRAME_FP (get_current_frame - ()) instead of stop_frame_address. - * infrun.c (save_inferior_status, restore_inferior_status), - inferior.h (struct inferior_status): Don't save and restore - stop_frame_address. - * inferior.h, infcmd.c, thread.c (thread_switch), m3-nat.c - (select_thread): Remove stop_frame_address and uses thereof. - D. Same thing for the stack pointer. - * infrun.c (wait_for_inferior): Remove stop_sp and replace - uses thereof with read_sp (). - E. Change to eliminate one nasty little spot where we were - wanting to know the frame pointer from before the current step - (idea from GDB 3.5, which saved my ass, because my other ideas of - how to fix it were very baroque). - * infrun.c: Remove prev_frame_address. - * infrun.c (wait_for_inferior, step_over_function): Use - step_frame_address instead of prev_frame_address. - F. Same basic idea for the stack pointer. - * inferior.h, infcmd.c: New variable step_sp. - * infcmd.c (step_1, until_next_command): Set it. - * infrun.c: Remove prev_sp and replace uses by step_sp. - * infrun.c (wait_for_inferior): If we get out of the step - range, then set step_sp to the current stack pointer before we - start going again. - -Fri Oct 7 12:17:17 1994 Ian Lance Taylor - - * top.c (target_byte_order_auto): New static variable. - (set_endian): Mention that ``auto'' is permitted. - (set_endian_auto): New static function. - (show_endian): Change message based on target_byte_order_auto. - (set_endian_from_file): New function. - (init_main): Add command ``auto'' to endianlist. - * exec.c (exec_file_command): Call set_endian_from_file. - * defs.h (set_endian_from_file): Declare. - -Thu Oct 6 18:10:41 1994 J.T. Conklin (jtc@phishhead.cygnus.com) - - * nlm/i386.c (flush_i_cache): New function, does nothing. - (frame_to_registers, registers_to_frame, set_step_traps, - clear_step_traps, do_status): Make non-static. - -Thu Oct 6 12:26:42 1994 Ian Lance Taylor - - * config/mips/tm-mips.h (GDB_TARGET_IS_MIPS64): If not already - defined, define as 0. - (FIX_CALL_DUMMY): Rewrite to remove presumption that host and - target are similar. - * config/mips/tm-idt.h (TARGET_BYTE_ORDER_SELECTABLE): Define. - * config/mips/tm-idtl.h (TARGET_BYTE_ORDER_SELECTABLE): Define. - * config/mips/tm-idt64.h (TARGET_BYTE_ORDER_SELECTABLE): Define. - (BREAKPOINT): Remove definition. - * config/mips/tm-idtl64.h (TARGET_BYTE_ORDER_SELECTABLE): Define. - (BREAKPOINT): Remove definition. - * config/mips/tm-mips64.h (GDB_TARGET_IS_MIPS64): Define with a - value of 1, rather than without a value. - * config/mips/tm-bigmips64.h (GDB_TARGET_IS_MIPS64): Likewise. - * mips-tdep.c: Rewrite uses of GDB_TARGET_IS_MIPS64 to switch at - run time rather than at compile time. - - * remote-mips.c (break_insn): Remove. - (BREAK_INSN, BREAK_INSN_SIZE): Define. - (mips_insert_breakpoint): Use BREAK_INSN, not break_insn. - (mips_remove_breakpoint): Likewise. - - * defs.h: If TARGET_BYTE_ORDER_SELECTABLE is defined by tm.h, - define TARGET_BYTE_ORDER as target_byte_order, and declare - target_byte_order as an extern int, and define BITS_BIG_ENDIAN as - a test of TARGET_BYTE_ORDER. - * top.c: Several additions if TARGET_BYTE_ORDER_SELECTABLE is - defined: - (endianlist, target_byte_order): New variables. - (set_endian, set_endian_big, set_endian_little): New functions. - (show_endian): New function. - (init_cmd_lists): Initialize endianlist. - (init_main): Add commands ``set endian big'', ``set endian - little'', and ``show endian''. - * a29k-pinsn.c: Rewrite uses of TARGET_BYTE_ORDER and - BITS_BIG_ENDIAN to switch at run time rather than at compile time. - * coffread.c, dwarfread.c, findvar.c, mips-tdep.c: Likewise. - * remote-os9k.c, stabsread.c, valarith.c, valprint.c: Likewise. - * values.c: Likewise. - -Wed Oct 5 11:41:24 1994 J.T. Conklin (jtc@phishhead.cygnus.com) - - * nlm/configure.in: ${gdb_host_cpu} defaults to ${host_cpu}. - - * nlm/Makefile.in: Get rid of NWINCLUDES. - * config/{alpha,powerpc}/gdbserve.mt: Remove NWINCLUDES. - User should now configure with --with-headers. - -Mon Oct 3 07:48:34 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * gdbserver/server.c (main): Silently accept all unrecognized - requests and send back a zero length acknowledge. That is what - *-stub.c do and is what remote.c expects. - -Mon Oct 3 05:11:47 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * corelow.c (core_open): Copy the modified to_sections_end - vector from current_target to core_ops too. - - * gdbserver/server.c (main): Silently accept query requests - and send back a zero length acknowledge. - -Fri Sep 30 17:17:21 1994 J.T. Conklin (jtc@phishhead.cygnus.com) - - * nlm/Makefile.in: Don't define NWINCLUDES. - * config/{alpha,powerpc}/gdbserve.mt: define NWINCLUDES. - -Fri Sep 30 15:59:55 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * gdbserver/low-lynx.c (create_inferior): Pass all 4 args to ptrace. - -Fri Sep 30 06:42:42 1994 Ian Lance Taylor (ian@cygnus.com) - - * lynx-nat.c (child_wait): Use status.w_status, not status, in - arithmetic. status is a `union wait'. - - * config/nm-lynx.h (PTRACE_ARG3_TYPE): Define to int, not char *. - - * lynx-nat.c (child_wait): Pass fourth argument to ptrace. - -Thu Sep 29 08:22:27 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * xcoffread.c (read_xcoff_symtab): Fix comment for yesterday's change. - -Wed Sep 28 17:48:18 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * coffread.c (complete_symtab): If last_source_file is set upon - entry, free it. - -Wed Sep 28 08:59:14 1994 Jim Kingdon (kingdon@cygnus.com) - - * xcoffread.c (read_xcoff_symtab, case C_FILE): - Set main_aux before using it. - - * xcoffexec.c (exec_close): If quitting, don't call clear_symtab_users. - - * xcoffread.c (read_xcoff_symtab): Process XTY_LD symbols we were - ignoring before. But continue to ignore XMC_DS. - -Wed Sep 28 00:35:23 1994 Jeff Law (law@snake.cs.utah.edu) - - * hpread.c (hpread_read_array_type): Do not change the type code - to TYPE_CODE_PTR for "char foo[]". Just make it a zero length - array type. - - * hpread.c (hpread_type_translate): Handle T_UNS_LONG types with - lengths other than 32bits (HP C 9.69 represents an "unsigned char" - as an T_UNS_LONG with length 8). - - * hpread.c (struct hpread_symfile_info): Delete have_module field - and accessor macro. Minor indentation fix. - (hpread_build_psymtabs, case K_MODULE): Only start a new psymtab - and reset state variables have_name & texthigh if pst is NULL. - (hpread_build_psymtabs, case K_SRCFILE): Only reset the name of a - partial symbol table if pst is non-NULL. If pst is NULL, then - start a new psymtab. - (hpread_process_one_debug_symbol, case K_MODULE): Now empty. - (hpread_process_one_debug_symbol, case K_SRCFILE): Simplify and - correct handling of subfiles. - -Mon Sep 26 02:59:00 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * defs.h (misc_command_type): Remove trailing comma from - enumerator list. - -Sun Sep 25 23:19:58 1994 Jeff Law (law@snake.cs.utah.edu) - - * hppa-tdep.c (frame_saved_pc): Fix thinko in code to dig saved pc - out of an interrupt frame. - -Sun Sep 25 12:50:17 1994 Stan Shebs (shebs@andros.cygnus.com) - - * infcmd.c (do_registers_info) [INVALID_FLOAT]: Only use if - defined. - * values.c (unpack_double) [INVALID_FLOAT]: Ditto. - * mips-tdep.c (mips_print_register): Don't test float validity. - * config/a29k/tm-a29k.h, config/alpha/tm-alpha.h, - config/arm/tm-arm.h, config/convex/tm-convex.h, - config/h8300/tm-h8300.h, config/h8500/tm-h8500.h, - config/i386/tm-i386v.h, config/i386/tm-sun386.h, - config/i960/tm-i960.h, config/m68k/tm-m68k.h, - config/m88k/tm-m88k.h, config/mips/tm-mips.h, - config/ns32k/tm-merlin.h, config/ns32k/tm-nbsd.h, - config/ns32k/tm-ns32km3.h, config/ns32k/tm-umax.h, - config/pa/tm-hppa.h, config/pyr/tm-pyr.h, - config/rs6000/tm-rs6000.h, config/sh/tm-sh.h, - config/sparc/tm-sparc.h, config/z8k/tm-z8k.h (INVALID_FLOAT): - Remove definition. - -Sun Sep 25 06:07:37 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * TODO: Remove item about adding general multi-threaded stuff; - this is done. - Remove item about specifying arbitrary locations of stack frames - (this works on some machines). - Remove item about debugging functions without a frame pointer - (this works on some machines). - Remove item about re-writing macros which handle frame chaining and - frameless functions. They have been re-written at least once - since that item was written. - Remove item about gdb catching SIGINT when attached; this is done. - Remove item about having list_command not read symbols--why bother? - -Sat Sep 24 17:40:10 1994 Stan Shebs (shebs@andros.cygnus.com) - - * TODO: Append contents of Projects file. - * Projects: Remove. - -Sat Sep 24 01:47:25 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * corelow.c (add_solib_stub): Remove copying of to_sections, - pass current_target to SOLIB_ADD. The Sep 10 change failed - if SOLIB_ADD errored out, or if SOLIB_ADD was trying to access - target memory. - * corelow.c (core_open): After reading the shared libraries, - copy the modified to_sections vector from current_target to - core_ops, so that core_close can free it later. - * config/rs6000/nm-rs6000.h, rs6000-nat.c (xcoff_relocate_core): - Pass down target parameter from SOLIB_ADD and use it instead of - directly accessing core_ops. - -Fri Sep 23 14:58:49 1994 J.T. Conklin (jtc@rtl.cygnus.com) - - * solib.c: *BSD systems need to be included before - . - - * i386b-nat.c: Add i386_float_info(), etc. - * config/i386/nm-nbsd.h: #define FLOAT_INFO. - - * config/nm-nbsd.h: New file, for generic NetBSD native support. - * config/i386/nm-nbsd.h: Use it. - * config/sparc/nm-nbsd.h: Use it. - * config/ns32k/nm-nbsd.h: Use it. - - * configure.in (i386-*-netbsd): Use config/i386/nbsd.m[ht]. - (ns32k-*-netbsd): Use config/ns32k/nbsd.m[ht]. - * config/i386/{nbsd.mh,nbsd.mt,nm-nbsd.h,tm-nbsd.h,xm-nbsd.h}: - New files, support for NetBSD/i386. - * config/ns32k/{nbsd.mh,nbsd.mh,nm-nbsd.h,tm-nbsd.h,xm-nbsd.h}: - New files, support for NetBSD/ns32k. - -Tue Sep 20 11:34:27 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * .gdbinit: Add list-objfiles command. - - * TODO: Reword item regarding NO_STD_REGS. - - * coffread.c (record_minimal_symbol, coff_read_enum_type, - coff_read_struct_type): Allocate on symbol_obstack, not directly - via malloc/savestring. - -Tue Sep 20 15:42:02 1994 Stan Shebs (shebs@andros.cygnus.com) - - * TODO: Add more items. - * tests: Remove the directory and all of its (obsolete) contents. - -Tue Sep 20 11:34:27 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * coffread.c (init_stringtab): When copying length to stringtab, - use target format, not host format, since that is what the rest of - the code assumes. - -Mon Sep 19 15:48:10 1994 J.T. Conklin (jtc@phishhead.cygnus.com) - - * Makefile.in: Removed prelude.o, i386-nlmstub.o, nlmstub.o, - nlmstub.nlm, and nlmstub targets. Removed NWSOURCE and - NWINCLUDES definitions. - * i386-nlmstub.c: Removed. - -Mon Sep 19 07:48:36 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * dbxread.c (read_dbx_dynamic_symtab): Cast bfd_asymbol_name to - char * (from const char *) before assigning. Don't save string we - pass to record_minimal_symbol (it already saves it). - - -Sat Sep 17 02:26:58 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * cp-valprint.c (static_field_print): New variable, controls - printing of static members. - (_initialize_cp_valprint): New print set subcommand - "static-members". Turn on printing of static members by default. - (cp_print_value_fields): Print static members if necessary. - - * solib.c: Remove inclusion of libelf.h and elf/mips.h. - (elf_locate_base): Use only standard BFD functions to collect - information about the .dynamic section. Check for DT_MIPS_RLD_MAP - tag only if it got defined via the inclusion of . - - * f-exp.y: Write block for OP_VAR_VALUE. - * f-valprint.c (info_common_command): Handle `info common' - without an argument correctly. - - * c-typeprint.c (c_type_print_base): Handle template constructors. - * symtab.c (gdb_mangle_name): Handle template method mangling, - get rid of GCC_MANGLE_BUG code, which only applied to gcc-2.2.2. - -Fri Sep 16 16:06:08 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * gdbtypes.h (TYPE_INDEX_TYPE): New macro. - * ch-typeprint.c, ch-valprint.c: Use TYPE_INDEX_TYPE. - * ch-valprint.c (chill_val_print): Pass index type directly - (instead of its TYPE_TARGET_TYPE) to print_type_scalar. - * stabsread.c (read_type): Don't set TYPE_FLAG_TARGET_STUB - if the index type is a stub. - -Fri Sep 16 17:18:44 1994 Stan Shebs (shebs@andros.cygnus.com) - - * config/i386/{i386aix.mh, i386bsd.mh, i386lynx.mh, i386sco.mh, - i386sco4.mh, i386sol2.mh, i386v.mh, i386v32.mh, i386v4.mh, - ncr3000.mh, ptx.mh, ptx4.mh}, config/m68k/{altos.mh, apollo68v.mh, - delta68.mh, dpx2.mh, hp300bsd.mh, hp300hpux.mh, m68klynx.mh, - m68kv4.mh}, config/m88k/{delta88.mh, delta88v4.mh}, - config/mips/riscos.mh, config/pa/hppahpux.mh, - config/rs6000/rs6000lynx.mh, config/sparc/{sparclynx.mh, - sun4sol2.mh}, config/tahoe/tahoe.mh, config/vax/{vaxbsd.mh, - vaxult.mh, vaxult2.mh} (REGEX, REGEX1, SYSV_DEFINE): No longer - define. - * config/i386/i386sco4.mh (MUNCH_DEFINE): No longer define. - -Fri Sep 16 15:40:34 1994 Stu Grossman (grossman@cygnus.com) - - * defs.h (QUIT): Call interactive_hook to allow GUI to interrupt. - Also, add decl for symtab_to_filename. - * source.c (symtab_to_filename): New. Returns the file - associated with a symtab. - * top.c: Define interactive_hook. Called during QUIT to animate - the GUI. - -Fri Sep 16 00:14:40 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * stabsread.c (read_type): Handle stub types for bitstrings. - * stabsread.c (read_array_type): Check for stub domain type - using TYPE_FLAG_STUB, not its length. - * gdbtypes.c (create_set_type): Handle a stub domain type. - - * ch-exp.y: Get rid of some extra non-terminals, and move - their rules into primitive_value. - * parser-defs.h: Add comment about unary postfix operators. - * ch-lang.c (chill_op_print_tab): Add '->', postfix and prefix. - * expprint.c (print_subexp): Recognize unary postfix operator. - -Wed Sep 14 18:27:42 1994 Jason Molenda (crash@phydeaux.cygnus.com) - - * remote-hms.c: use remote_debug instead of hms_silent toggle. - Add warnings about depreciation of `snoop' cmd. - -Wed Sep 14 18:18:58 1994 Steve Chamberlain (sac@jonny.cygnus.com) - - * remote-hms.c (hms_read_inferior_memory): Cope when - target sends both \r and \n. - -Wed Sep 14 17:14:57 1994 Stan Shebs (shebs@andros.cygnus.com) - - * remote-mips.c (mips_error): Place NORETURN macro correctly. - * TODO: Add item about START_INFERIOR_TRAPS_EXPECTED. - -Wed Sep 14 14:26:21 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * xcoffread.c (read_xcoff_symtab): Fix obsolete comment about - mst_solib_trampoline. - - * f-valprint.c (f_val_print): Change cast of valaddr from - CORE_ADDR * to char **, since that is how it is used. - - * dbxread.c (read_dbx_dynamic_symtab): Save copy of symbol names - using obsavestring, and pass that to prim_record_minimal_symbol. - Having the objfile point to bfd_asymbol_name directly doesn't work - if we save and restore a mapped symbol file. - - -Tue Sep 13 18:23:26 1994 Rob Savoye (rob@darkstar.cygnus.com) - - * w89k-rom.c, op50-rom.c, monitor.c, config/pa/hppapro.mt: New files - to add a generic ROM monitor interface, and support file for the - WinBond W89K and the Oki OP50N PA based target boards. - - -Sun Sep 11 22:34:57 1994 Jeff Law (law@snake.cs.utah.edu) - - * config/pa/tm-hppa.h (REGISTER_NAMES): Use r26-r23 for arg0-arg3. - -Sun Sep 11 04:36:47 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * irix5-nat.c, osfsolib.c, solib.c (solib_add): Simplify last - change by replacing `symbols_added' with `so_last'. - * mdebugread.c (parse_external, parse_partial_symbols): Ignore - global common symbols, they will be resolved by the runtime loader. - * mdebugread.c (parse_symbol, parse_partial_symbols, cross_ref): - Handle scSCommon like scCommon symbols. - -Sat Sep 10 01:43:28 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * corelow.c (add_solib_stub): Copy to_sections changes from - core_ops to current_target after adding the shared libraries. - * partial-stab.h (N_EXCL), dbxread.c (add_old_header_file, - find_corresponding_bincl_psymtab): Change `repeated header not seen' - error to a complaint, simplify complaint. - * procfs.c (signalname, errnoname): Make `name' const. - * symfile.c (reread_symbols): Use filename from old BFD to - reopen the objfile. - * values.c (record_latest_value): Don't record value in the - history chain until we are sure there won't be an error. - -Fri Sep 9 15:52:09 1994 J.T. Conklin (jtc@phishhead.cygnus.com) - - * nlm/Makefile.in: remove MMALLOC, READLINE, TERMCAP, and other - cruft. - - * config/i386/gdbserve.mt: New file, defs for i386 nlm stub. - -Thu Sep 8 17:14:43 1994 Steve Chamberlain (sac@jonny.cygnus.com) - - * remote.c (fromhex): Make error more explicit. - (read_frame): Don't print bad checksum information unless - remote_debugging. Don't use repeat count unless it's > 0. - * remote-e7000.c (expect): When echoing, ignore multiple newlines. - (e7000_insert_breakpoint, e7000_remove_breakpoint, target_ops): - Optionally cope with BC style breakpoints. - (e7000_command): After command send directly to the E7000 mark - registers as changed. - (why_stop, e7000_wait: Understand BC style stop condition. - * sh-tdep.c (sh_skip_prologue): Understand more complicated - sequences. (frame_find_saved_regs): Likewise. - * config/h8500/tm-h8500.h (target_write_pc, TARGET_WRITE_PC): - Handle extra arg. - * config/i386/xm-go32.h (GDBINIT_FILENAME): Set to gdb.ini. - (more work here to come) - * config/sh/tm-sh.h (EXTRA_FRAME_INFO): Add f_offset and leaf_function - fields. - -Thu Sep 8 16:15:34 1994 J.T. Conklin (jtc@rtl.cygnus.com) - - * sparclite/Makefile.in: Assorted stuff needed for eload. - - * sparclite/eload.c: Merge in command line argument parsing and - error message handling improvements orignally made to aload.c. - -Wed Sep 7 23:24:50 1994 Jeff Law (law@snake.cs.utah.edu) - - * defs.h (enum misc_command_type, command_control_type): Enums - for describing the command and control types. - (struct command_line): Add new fields to keep track of the command - type and body associated with the command. - * top.c: Include value.h. Delete whitespace at the end of lines. - (build_command_line, get_command_line): New functions. - (execute_control_command, while_command, if_command): Likewise. - (realloc_body_list, read_next_line): Likewise. - (recurse_read_control_structure): Likewise. - (execute_user_command): Call execute_control_command. - (read_command_lines): Simplify by calling read_next_line, call - read_control_structure for "if" and "while" commands. - (free_command_lines): Free new fields in the command structure. - (define_command): Reset control_level to zero. - (init_main): Install command handlers for "if" and "while" commands. - -Tue Sep 6 16:24:07 1994 Stan Shebs (shebs@andros.cygnus.com) - - * c-typeprint.c (c_type_print_varspec_prefix, - c_type_print_varspec_suffix): Add cases for Fortran type codes. - * eval.c (evaluate_subexp): For OP_ARRAY expressions in Fortran, - call f77_value_literal_string instead. - * f_exp.y: Include , move include of parser-defs.h. - (parse_number): Translate 'd' floats to 'e' so atof() works. - (yylex): Remove unused variables. - * f-lang.c: Include . - (get_bf_for_fcn): Remove unused variable. - * f-typeprint.c (f_type_print_varspec_prefix, - f_type_print_varspec_suffix): Remove unused - variables, add cases to switch statements. - (f_type_print_base): Remove unused variables. - * f-valprint.c (gdbcore.h, command.h): Include. - (f77_get_dynamic_lowerbound, f77_get_dynamic_upperbound): - Call read_memory_integer with correct number of arguments. - (f77_get_dynamic_upperbound): Call f77_get_dynamic_lowerbound - with correct argument type. - (f77_print_array): Removed unused array array_size_array. - (f_val_print): Don't use a CORE_ADDR as a char *. - * valops.c (value_cast): Handle COMPLEX and BOOL types. - (value_assign): Handle Fortran literal string and complex values. - (f77_cast_into_complex, f77_assign_from_literal_string, - f77_assign_from_literal_complex): New functions. - -Mon Sep 5 14:46:41 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * ch-typeprint.c (chill_type_print_base): Make TYPE_CODE_RANGE - case more robust. - -Sun Sep 4 16:06:34 1994 Stan Shebs (shebs@andros.cygnus.com) - - * i960-tdep.c (signal.h): Don't include. - - * cxux-nat.c (target_is_m88110): Remove definition. - - * configure.in (config/nm-empty.h): If cross only, use instead - of config/nm-trash.h. - * config/nm-trash.h: Remove. - * config/nm-empty.h: New file. - * config/i386/nm-m3.h: New file, includes config/nm-m3.h. - * config/mips/nm-m3.h: New file, includes config/nm-m3.h. - * config/m68k/nm-sysv4.h: New file, includes config/nm-sysv4.h. - * config/mips/nm-sysv4.h: New file, includes config/nm-sysv4.h. - * config/sparc/nm-sysv4.h: New file, includes config/nm-sysv4.h. - - -Fri Sep 2 17:35:55 1994 J.T. Conklin (jtc@phishhead.cygnus.com) - - * configure.in: No longer look for nm, tm, and xm headers in - config/
; they are always in config//
. - -Fri Sep 2 16:40:03 1994 Stan Shebs (shebs@andros.cygnus.com) - - * objfiles.c (allocate_objfile): Add the newly-created objfile to - the end of the list of objfiles, instead of at the beginning. - - * xcoffread.c (allocate_include_entry): New function, abstracted - from code in record_include_begin. - (record_include_begin, record_include_end): Call it. - - * blockframe.c (reinit_frame_cache): Test inferior_pid instead of - target_has_stack to decide whether to create a real stack frame - for the cache. - - * coffread.c (process_coff_symbol) [CXUX_TARGET]: Ignore vendor - section. - * config/m88k/tm-cxux.h (CXUX_TARGET): Define. - - * h8300-tdep.c: Include "dis-asm.h" instead of . - -Fri Sep 2 09:51:46 1994 J.T. Conklin (jtc@cygnus.com) - - * config/sparc/tm-nbsd.h: Add #defines to map NetBSD struct and - field names into what is expected by sparc-nat.c. - -Thu Sep 1 17:32:54 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * c-typeprint.c (c_typedef_print): Add missing Chill support. - -Thu Sep 1 15:41:21 1994 Stu Grossman (grossman@cygnus.com) - - * rs6000-pinsn.c (print_insn): Use powerpc disassembler when - doing Power PC. - * config/powerpc/tm-ppc-nw.h: Define GDB_TARGET_POWERPC. - - * config/i386/i386lynx.mh, config/m68k/m68klynx.mh, - config/rs6000/rs6000lynx.mh, config/sparc/sparclynx.mh: Enable - ser-tcp. - - * nlm/Makefile.in: Get rid of NWSOURCE. - * nlm/alpha-io.S (inVti, outVti): Remove extraneous ldha's. - * nlm/gdbserve.o: Add dummy __main routine. - * nlm/gdbserve.def: Turn on debug. - -Thu Sep 1 12:36:39 1994 Jim Kingdon (kingdon@cygnus.com) - - * config/xm-nbsd.h: Don't define SET_STACK_LIMIT_HUGE; it is obsolete. - -Thu Sep 1 11:01:40 1994 J.T. Conklin (jtc@rtl.cygnus.com) - - * config/tm-nbsd.h: New file, support for all NetBSD targets. - * config/xm-nbsd.h: fix typo. - * config/sparc/{nm,tm,xm}-nbsd.h: New files, renamed from - {nm,tm,xm}-sparcnbsd.h to conform to prefered file naming - conventions. - * configure.in: (sparc-*-netbsd): use config/sparc/nbsd.m[ht]. - -Wed Aug 31 14:40:33 1994 Jason Molenda (crash@phydeaux.cygnus.com) - - * remote-udi.c (udi_read_inferior_memory,udi_write_inferior_memory): - change typeo in error msg (`inferrior' -> `inferior'). - -Wed Aug 31 09:17:02 1994 Jim Kingdon (kingdon@cygnus.com) - - * inflow.c (set_sigint_trap, clear_sigint_trap): Check for - attach_flag (this check was performed by the callers). Also check - inferior_thisrun_terminal. - * inftarg.c (child_wait), lynx-nat.c (child_wait), - procfs.c (wait_fd), symm-nat.c (child_wait): Don't check - attach_flag in deciding whether to call set_sigint_trap and - clear_sigint_trap. - - * value.h (struct value): Change literal_data from PTR to char *, - since that is the way it is used. - -Tue Aug 30 21:56:54 1994 Jeff Law (law@snake.cs.utah.edu) - - * somread.c (som_symfile_read): Force unwinds to be re-read after - reading in a new partial symbol table. - -Tue Aug 30 13:14:16 1994 Stan Shebs (shebs@andros.cygnus.com) - - * config/h8500/tm-8500.h (DONT_USE_REMOTE): Remove definition, - an obsolete conditional. - * config/pa/tm-hppa.h (BREAKPOINT) [KERNELDEBUG]: Remove use, - an obsolete conditional. - * config/rs6000/rs6000.mh, config/rs6000/rs6000.mt: Clean up - comments. - -Mon Aug 29 14:39:42 1994 Stan Shebs (shebs@andros.cygnus.com) - - * Makefile.in (ns32k-opcode.h): Remove reference. - (ns32k-pinsn.o): Update dependencies. - * ns32k-opcode.h: Remove file. - * ns32k-pinsn.c (print_insn): Call version in libopcodes, remove - all other code in this file. - -Mon Aug 29 12:04:07 1994 Stu Grossman (grossman@cygnus.com) - - * nlm/configure.in: Stop using cpu.c. Put it in TDEPFILES instead. - * config/alpha/gdbserve.mt (TDEPFILES): Remove alpha-patch.o. - - * nlm/Makefile.in: Add rule for .S.o. - * nlm/aio.h: Protect from multiple inclusions. - * nlm/alpha-io.S: Remove everything we don't need. - * nlm/{alpha-patch.c, alpha-patch.h, alpha-uart.c, alpha-uart.h}: - Remove, no longer needed. - * nlm/alpha.c: Merge in lots of stuff from previous files. - * nlm/alpha.h: Don't #include alpha-patch.h. Make - breakpoint_insn extern. - * Move stuff from alpha-patch.h into here. - - * config/alpha/gdbserve.mt (TDEPFILES): Get rid of alpha-uart.o. - -Mon Aug 29 11:34:34 1994 Jim Kingdon (kingdon@cygnus.com) - - * annotate.c (annotate_starting): Flush output. - -Sat Aug 27 23:32:43 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * symfile.c (symbol_file_add): Move reinit_frame_cache call to - the callers of symbol_file_add. Gets rid of heuristic fence-post - warnings on mips and alpha targets when the PC resides in a shared - library which is not yet read in. - * coff-solib.c (coff_solib_add), cxux-nat.c (add_shared_symbol_files), - irix5-nat.c (solib_add), osfsolib.c (solib_add), - remote-vx.c (vx_open), solib.c (solib_add): - Add call to reinit_frame_cache after all shared libraries are read in. - * remote-udi.c (udi_load), remote-vx.c (vx_load_command), - symfile.c (symbol_file_command, add_symbol_file_command): - Add call to reinit_frame_cache after symbol_file_add. - -Wed Aug 24 17:45:14 1994 J.T. Conklin (jtc@cygnus.com) - - * config/xm-nbsd.h: New file, support for all NetBSD ports. - * config/sparc/{nm-sparcnbsd.h,tm-sparcnbsd.h,xm-sparcnbsd.h, - sparcnbsd.mh,sparcnbsd.mt}: New files, support for NetBSD/sparc. - * configure.in: Add sparc-*-netbsd target. - -Wed Aug 24 13:17:34 1994 Stan Shebs (shebs@andros.cygnus.com) - - * remote-vx.c (vx_attach): Interpret the command argument as an - unsigned long. - -Wed Aug 24 13:08:08 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) - - * configure.in: Change i[34]86 to i[345]86. - * nlm/configure.in: Likewise. - * gdbserver/configure.in: Likewise. - -Wed Aug 24 09:41:09 1994 J.T. Conklin (jtc@cygnus.com) - - * configure.in (i386-*-netware): Automatically configure nlm - subdir. - -Tue Aug 23 17:51:13 1994 J.T. Conklin (jtc@cygnus.com) - - * nlm/gdbserve.c: conditionalize header file inclusion for either - NetWare 4.0 or PIN targets. - * nlm/i386.c: include appropriate header files. - * nlm/prelude.c: define TERMINATE_BY_UNLOAD for NetWare 4.0 - targets. - -Tue Aug 23 16:54:16 1994 Stu Grossman (grossman@cygnus.com) - - * nlm/ppc.c (set_step_traps clear_step_traps): Cleanups. - * nlm/gdbserve.def: Autoload clib. - -Tue Aug 23 12:05:19 1994 Jim Kingdon (kingdon@cygnus.com) - - * breakpoint.c (condition_command): Call breakpoints_changed. - - * gdbtypes.h: Declare f77_create_literal_string_type and - f77_create_literal_complex_type. - * valops.c (f77_value_literal_string, f77_value_substring, - f77_value_literal_complex): Use xmalloc not malloc. - * valops.c (f77_value_literal_string, f77_value_substring): - Make addr char * not CORE_ADDR. - * value.h (struct value): Add new field literal_data of aligner union. - (VALUE_LITERAL_DATA): Use it. - * f-lang.h: Declare find_common_for_function. - * value.h, valops.c: Split VALUE_SUBSTRING_START into memaddr and - myaddr fields of a union. Don't overload it with the frame field - (not sure this is necessary; I'm not sure what lval_* codes - VALUE_SUBSTRING_* can be used with). - -Mon Aug 22 11:45:01 1994 Stan Shebs (shebs@andros.cygnus.com) - - * config/a29k/{a29k-kern.mt,a29k-udi.mt,a29k.mt,ultra3.mh, - ultra3.mt}: Clean up comments, remove no-longer-used definitions. - - * rs6000-nat.c: Include libbfd.h again, needed until reference - to bfd_cache_lookup is cleaned out. - - * config/i386/linux.mh (XM_CLIBS): Add -lm. - -Mon Aug 22 10:42:15 1994 Steve Chamberlain (sac@jonny.cygnus.com) - - Work to reduce the interrupts-off duration when running in DOS. - * ser-go32.c: (dos_async_ready): See if anything is in the buffer. - (dos_async_rx): rewrite to unpack as many characters from the - asynctsr as possible into a local buffer. - -Fri Aug 19 14:55:45 1994 Stan Shebs (shebs@andros.cygnus.com) - - Initial Fortran language support, adapted from work by Farooq Butt - (fmbutt@engage.sps.mot.com). - * Makefile.in: Add Fortran-related files and dependencies. - * defs.h (language_fortran): New language enum. - * language.h (_LANG_fortran): Define. - (MAX_FORTRAN_DIMS): Define. - * expression.h: Reformat to standard. - (MULTI_F77_SUBSCRIPT, OP_F77_UNDETERMINED_ARGLIST, - OP_F77_LITERAL_COMPLEX, OP_F77_SUBSTR): New expression opcodes. - * gdbtypes.h (TYPE_CODE_COMPLEX, TYPE_CODE_LITERAL_COMPLEX, - TYPE_CODE_LITERAL_STRING): New type codes. - (type): New fields upper_bound_type and lower_bound_type. - (TYPE_ARRAY_UPPER_BOUND_TYPE, TYPE_ARRAY_LOWER_BOUND_TYPE, - TYPE_ARRAY_UPPER_BOUND_VALUE, TYPE_ARRAY_LOWER_BOUND_VALUE): New - macros. - (builtin_type_f_character, etc): Declare. - * value.h (VALUE_LITERAL_DATA, VALUE_SUBSTRING_START): Define. - * f-exp.y: New file, Fortran expression grammar. - * f-lang.c: New file, Fortran language support functions. - * f-lang.h: New file, Fortran language support declarations. - * f-typeprint.c: New file, Fortran type printing. - * f-valprint.c: New file, Fortran value printing. - * eval.c (evaluate_subexp): Add code for new expression opcodes, - fix wording of error message. - * gdbtypes.c (f77_create_literal_complex_type, - f77_create_literal_string_type): New functions. - * language.c (set_language_command): Add Fortran info. - (calc_f77_array_dims): New function. - * parse.c (length_of_subexp, prefixify_subexp): Add cases for new - expression opcodes. - * symfile.c (deduce_language_from_filename): Recognize .f and .F - as Fortran source files. - * valops.c (f77_value_literal_string, f77_value_substring, - f77_value_literal_complex): New functions. - -Fri Aug 19 13:35:01 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * c-typeprint.c (c_print_type): Assume demangled arguments - if a '(' is found in varstring, looking for ')' at the end of - varstring did fail with demangled const member functions, which - have a trailing `const'. - * remote.c (get_offsets, putpkt): Change to `char' buffers, - to avoid errors when compiling with DEC c89. - (remote_wait): Cast to `char *' before passing buffer to - fputs_filtered, to avoid errors when compiling with DEC c89. - (remote_wait): Do not return inferior_pid by default, this - statement is never reached, which causes warnings from some - compilers. - * stabsread.c (scan_file_globals): Ignore static minimal symbols. - * symfile.c (load_command): If called with no argument, try - to get the filename from the executable file. - (generic_load): Remove check for NULL filename, it is done - in load_command now. - -Fri Aug 19 10:36:15 1994 Jeff Law (law@snake.cs.utah.edu) - - * Makefile.in (ALLDEPFILES): Add hpread.c. - (hpread.o): Add dependencies. - - * somread.c: Do not include "aout/aout64.h". SOM has nothing to - do with a.out. - (BYTES_IN_WORD): Delete. - (som_symfile_read): Call hpread_build_psymtabs to build any - minimal symbols based on the HP C native debug symbols. - (som_symfile_finish): Call hpread_symfile_finish. - (som_symfile_init): Call hpread_symfile_init. - * config/pa/tm-hppa.h (HPREAD_ADJUST_STACK_ADDRESS): Define. - * hppa-tdep.c (hpread_adjust_stack_address): New function. - - * config/pa/hppabsd.mh (NATDEPFILES): Add hpread.o - * config/pa/hppahpux.mh (NATDEPFILES): Likewise. - * hpread.c: New file. - -Fri Aug 19 00:40:55 1994 Jeff Law (law@snake.cs.utah.edu) - - * hppa-tdep.c (skip_trampoline_code): Revert incorrect change - from June 2, 1994 (what was I thinking?!?). Fix it right this - time. - -Thu Aug 18 17:01:35 1994 J.T. Conklin (jtc@rtl.cygnus.com) - - * nlm/i386.c, nlm/i386.h: New files that contain i386 specific code. - -Thu Aug 18 14:39:46 1994 Stan Shebs (shebs@andros.cygnus.com) - - * README: Grammar improvements, clarifications, updates. - -Wed Aug 17 23:08:53 1994 Stu Grossman (grossman@cygnus.com) - - * Makefile.in (TARGET_FLAGS_TO_PASS): Pass down LD_FOR_TARGET and - NLMCONV_FOR_TARGET. (SUBDIRS): Add nlm target. - * configure.in (powerpc-*-netware*): Automatically configure nlm - subdir. - * nlm/Makefile.in: Add {CC NLMCONV LD}_FOR_TARGET. Remove alpha - specific stuff. Make things more configurable. - * nlm/configure.in: Add powerpc-*-netware* target. Use - gdbserve.mt/cpu.c/cpu.h for target stuff. Get rid of tm/xm/nm.h - files. - * nlm/gdbserve.c: Move Alpha specific stuff into other files. - Remove lots of architecture-specific stuff. - * nlm/gdbserve.def: Add new imports. - * nlm/ppc.c, nlm/ppc.h: New files that contain PowerPC specific code. - * nlm/prelude.c: Don't include libhooks.h, get rid of call to - register library. - * nlm/prelude.o: What was this doing here? - * config/alpha/gdbserve.mt: Defs for alpha nlm stub. - * config/powerpc/gdbserve.mt: Defs for PowerPC nlm stub. - * config/powerpc/ppc-nw.mt: Defs for PowerPC target for GDB. - * config/powerpc/tm-ppc-nw.h: Ditto. - - * nlmstub.def: New file, contains imports for 386 nlm stub. - -Wed Aug 17 23:17:33 1994 Rob Savoye (rob@darkstar.cygnus.com) - - * remote-pa.c: New file for HPPA embedded support. Currently it's - a copy of remote.c. - * config/pa/hppabsd.mt,hppahpux.mt,hppaosf.mt: User remote-pa.c. - -Wed Aug 17 13:19:52 1994 Stan Shebs (shebs@andros.cygnus.com) - - * config/m68k/tm-delta68.h (EXTRACT_RETURN_VALUE, - STORE_RETURN_VALUE): Define to use %a0 for pointers. - -Wed Aug 17 07:43:06 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * remote-mips.c: Remove unused declaration of mips_load. - -Tue Aug 16 16:45:34 1994 Stan Shebs (shebs@andros.cygnus.com) - - * coffread.c: General cleanup, and support for section offsets. - (time.h, sys/types.h, libbfd.h): Don't include. - (cur_src_start_addr, cur_src_end_addr): Rename to - current_source_start_addr, current_source_end_addr. - (nlist_stream_global): Remove. - (nlist_bfd_global): New global variable. - (coff_symfile_read): Remove code that gets and uses fileno() - directly. - (read_coff_symtab, enter_linenos, process_coff_symbol): Add - section_offsets parameter, add text/data section offset to - appropriate symbols' values. - (read_one_sym): Use bfd_read instead of fread. - (init_stringtab, init_lineno): Change first parameter to a bfd, - use bfd routines instead of raw I/O. - -Tue Aug 16 15:24:03 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * symtab.c (decode_line_1): If funfirstline and we get a - non-LOC_BLOCK symbol (e.g. variable or type), then error(). - - * Makefile.in (TARFILES, NONSRC, SFILES_STAND, SFILES_KGDB): - Remove; unused. - (TAGFILES_NO_SRCDIR): Remove ALLPARAM. - (HFILES_NO_SRCDIR): Remove all files in config sub-directory. - (TAGS): Also pass result of find on config sub-directory to etags. - (ALLPARAM): Remove; now unused. - -Sun Aug 14 13:05:26 1994 Fred Fish (fnf@cygnus.com) - - * Makefile.in (VERSION): Bump to 4.13.1 - * NEWS, README: Update to match gdb 4.13 release version. - -Sat Aug 13 08:22:50 1994 Fred Fish (fnf@cygnus.com) - - Harris CX/UX support, from Bob Rusk (rrusk@mail.csd.harris.com). - * cxux-nat.c: Remove dangling #else block. - (m88k_harris_core_register_addr): New function. - - * environ.c (init_environ): If no environment, do nothing. - -Fri Aug 12 19:30:53 1994 Jeff Law (law@snake.cs.utah.edu) - - * hpread.c: Delete rest of TODO list. Do not include "libbfd.h", - , , "demangle.h", , - "expression.h", "language.h", "gdbtypes.h", "demangleh". - Move all global variables into the private symbol table structure - and add accessor macros. Update some comments. - (hpread_build_psymtabs): Delete dbsubc_addr, we don't need it. - (hpread_end_psymtab): New function to end a partial symbol table, - all callers changed (no more bogus sharing with dbxread.c). - -Fri Aug 12 15:52:37 1994 Stu Grossman (grossman@cygnus.com) - - * remote.c (remote_wait): Return inferior_pid instead of 0 for - `W` message. - -Fri Aug 12 11:47:10 1994 J.T. Conklin (jtc@phishhead.cygnus.com) - - * sparclite/aload.c (sys_error, error): Use vfprintf for variable - argument lists. - -Thu Aug 11 04:06:42 1994 Doug Evans (dje@canuck.cygnus.com) - - * defs.h (concat, basename, buildargv, freeargv, strerrno, strsigno, - errno_max, signo_max, strtoerrno, strtosigno): Delete. - Include "libiberty.h" instead. - -Wed Aug 10 13:23:47 1994 Rick Sladkey (jrs@world.std.com) - - * i386v-nat.c (i386_insert_nonaligned_watchpoint): - add additional argument specifying raw address to permit - proper release of debug registers. - (i386_insert_watchpoint, i386_insert_aligned_watchpoint): - change all callers. - -Wed Aug 10 16:13:45 1994 Stu Grossman (grossman@cygnus.com) - - * defs.h, top.c: Use `extern' in declarations of GUI hooks, and - define them in top.c. Add comments to the hooks. - -Wed Aug 10 15:57:43 1994 Doug Evans (dje@canuck.cygnus.com) - - * remote-sim.c (gdbsim_ops): Set `to_insert_breakpoint' and - `to_remove_breakpoint' fields. - -Wed Aug 10 15:46:03 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * infcmd.c (run_command): Remove comment suggesting using - target_has_execution instead of inferior_pid. - -Wed Aug 10 10:33:20 1994 Kung Hsu (kung@mexican.cygnus.com) - - * remote-mips.c (mips_open): add code to handle baud rate. - -Tue Aug 9 09:44:42 1994 Stu Grossman (grossman@cygnus.com) - - * infrun.c (wait_for_inferior): Call target_resume() upon - detection of new processes. - - * procfs.c (create_procinfo): Return pointer to new procinfo - structure. - * (do_detach): Spacing & formatting cleanup. - * (procfs_wait): Move wait_again label to ensure that we really - wait again. On exit from fork, release new child from gdbs' - clutches. - * (procfs_set_sproc_trap): Enable trapping of fork and vfork. - -Mon Aug 08 15:34:13 1994 Jeff Law (law@snake.cs.utah.edu) - - * hpread.c (hpread_process_one_debug_symbol): Fix block scoping - problem (losing localvars on the close-brace instead of after - the close brace). - -Mon Aug 8 15:09:32 1994 J.T. Conklin (jtc@phishhead.cygnus.com) - - * i386-nlmstub.c (handle_exception): Wait until the thread has - been started before killing the NLM by pointing the PC at - _exit(). - -Sat Aug 6 22:27:30 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * config/mips/tm-irix5.h (IN_SIGTRAMP): Redefine for Irix 5, - Irix 5 has a standard _sigtramp signal handler. - * irix5-nat.c (solib_add): Get rid of sigtramp_address handling, - it is not needed for a standard _sigtramp signal handler. - Add shared library sections to the section table of the target - before adding the symbols. - * mips-tdep.c (mips_skip_prologue): Do not skip load immediate - instructions that do not prepare a stack adjustment. - * regex.c (SIGN_EXTEND_CHAR): Update to emacs-19.25 definition, - which does the right thing on machines where `char' is unsigned. - -Fri Aug 5 17:50:59 1994 Stu Grossman (grossman@cygnus.com) - - * remote.c (remote_open): Move setting of inferior_pid prior to - call to remote_start_remote. Also use unique value for pid to - avoid confusion with read_register_pid & friends. - * (remote_wait): Return inferior_pid instead of 0 in all cases. - -Fri Aug 5 12:23:02 1994 Stan Shebs (shebs@andros.cygnus.com) - - * dwarfread.c (bfd.h): Don't include. - -Fri Aug 5 09:08:34 1994 J.T. Conklin (jtc@phishhead.cygnus.com) - - * i386-nlmstub.c (handle_exception): Point the PC at _exit() to - kill the program being debugged. KillMe(), the undocumented - call intended for this purpose, causes the server to hang. - -Thu Aug 4 16:26:06 1994 Steve Chamberlain (sac@jonny.cygnus.com) - - * remote.c (read_frame): Calculate run length encoded checksum - correctly. - * config/sh/stub.c: New file. - -Thu Aug 4 14:34:12 1994 Stu Grossman (grossman@cygnus.com) - - * target.c (find_default_run_target): Make sure to_can_run is set - before calling it. - -Thu Aug 4 11:46:27 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * TODO: Remove note about fast watchpoints and remove obsolete - Mach stuff. - -Thu Aug 4 11:08:03 1994 Stan Shebs (shebs@andros.cygnus.com) - - * config/i386/xm-i386v4.h, config/m68k/xm-m68kv4.h, - config/sparc/xm-sun4sol2.h (NORETURN): Don't define. - * config/m88k/tm-cxux.h (ARCH_NUM_REGS): Undefine before defining. - -Thu Aug 4 10:26:36 1994 Stu Grossman (grossman@rtl.cygnus.com) - - * target.c (add_target): Don't call clean_target on target - vectors anymore. - * (unpush_target): Test for to_close being set before calling. - * (target_xfer_memory, target_info): Check for to_has_memory - before playing with memory. - - * remote.c (remote_open): Set inferior_pid to make kill command - happy. - * inflow.c (kill_command): Revert change of Aug 2. Use - inferior_pid to determine whether to print out "The program is not - being run." message. - -Thu Aug 4 07:55:04 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config/i386/i386m3.mh (NAT_CLIBS): Add -lmachid and -lnetname. - * m3-nat.c, config/nm-m3.h: #if 0 REQUEST_QUIT stuff. - * m3-nat.c: Pass argument to return_to_top_level. - Declare m3_kill_inferior before use. - (port_chain_insert): In "can't happen" case, abort rather than - setting `mid' to large decimal constant (which gcc warns about). - (get_thread_name): Use cast to convert const char * to char *. - (add_mach_specific_commands): #if 0 "thread break" command. - (m3_trace_him): Call push_target. - (mach_really_wait): New argument pid; remove unused - variable pid. - (intercept_exec_calls): Call target_terminal_init and - target_terminal_inferior once the child execs. - * infrun.c (proceed): Pass argument to PREPARE_TO_PROCEED. - -Wed Aug 3 22:41:13 1994 Tom Lord (lord@x1.cygnus.com) - - * procfs.c (procfs_mourn_inferior): don't dereference the - procinfo pointer after it has been freed. - -Wed Aug 3 12:05:13 1994 Stan Shebs (shebs@andros.cygnus.com) - - * breakpoint.c (breakpoint_1): Improve pluralization in display - of breakpoint hit counts. - - * language.h (struct language_defn): Remove unused field - la_longest_float. - (longest_float): Remove, no longer used. - * language.c (unknown_language_defn, auto_language_defn, - local_language_defn): Remove init of la_longest_float field. - * c-lang.c (c_language_defn, cplus_language_defn, - asm_language_defn): Ditto. - * ch-lang.c (chill_language_defn): Ditto. - * m2-lang.c (m2_language_defn): Ditto. - -Tue Aug 2 10:58:34 1994 Stan Shebs (shebs@andros.cygnus.com) - - * defs.h (bfd_read, bfd_seek): Remove declarations. - * os9kread.c, rs6000-nat.c (libbfd.h): Don't include. - -Tue Aug 2 09:50:50 1994 J.T. Conklin (jtc@phishhead.cygnus.com) - - * inflow.c (kill_command): Fix a bug which prevented target - programs to be killed. - -Mon Aug 1 18:48:47 1994 Stan Shebs (shebs@andros.cygnus.com) - - * defs.h: Change two-line declarations to one-line form. - (NORETURN): Define as "volatile" only for older GCCs. - (ATTR_NORETURN): Define for newer GCCs. - * procfs.c (proc_init_failed): Add ATTR_NORETURN to declaration. - -Mon Aug 1 16:43:24 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * breakpoint.c (mention), main.c (fputs_unfiltered): Add comments. - * breakpoint.c (delete_breakpoint, enable_breakpoint, - disable_breakpoint): Don't call breakpoints_changed; it is now - called via the *_breakpoint_hook functions. - * annotate.c (_initialize_annotate, breakpoint_changed): New functions. - -Mon Aug 1 13:38:04 1994 Kung Hsu (kung@mexican.cygnus.com) - - * stabsread.c (read_type): Fix a bug in enum size calculation. - -Mon Aug 1 01:36:13 1994 Jeff Law (law@snake.cs.utah.edu) - - * hppa-tdep.c (compare_unwind_entries): Add "const" to both - argument types to shut up GCC. - - * hppa-tdep.c (saved_pc_after_call): If the saved PC is in a - linker stub, then return the address the stub will return to. - (frame_saved_pc): Correctly restart the search for the saved - pc when a linker stub is encountered. - - * hppa-tdep.c (inst_saves_gr): Handle 16 and 8 bit instruction - register stores emitted by the version 9 HP compilers. - (inst_saves_fr): Relax test for a specific base register (%r1); - this avoids losing with the version 9 HP compilers. - (skip_prologue): Try to skip argument stores emitted by the HP - compilers. It's not perfect, but it's better than before. - -Fri Jul 29 23:20:30 1994 Stu Grossman (grossman@cygnus.com) - - * findvar.c (write_pc write_pc_pid): Remove casts to long when - calling write_register_pid. - * (write_register_pid): Add prototype. - -Fri Jul 29 21:56:23 1994 Steve Chamberlain (sac@jonny.cygnus.com) - - * remote.c (read_frame): Split readchar/checksum calculation into - two parts since evaluation order is undefined. - -Fri Jul 29 13:46:08 1994 Fred Fish (fnf@cygnus.com) - - From Kevin A. Buettner (kev@cujo.geg.mot.com). - * Makefile.in (coredep.o): Add inferior.h as dependency. - * inflow.c: Add F_SETOWN to list of defines to check - around code that uses F_SETOWN. - -Fri Jul 29 09:59:05 1994 J.T. Conklin (jtc@phishhead.cygnus.com) - - * Makefile.in (CC_FOR_TARGET, CXX_FOR_TARGET): If using newlib, - set the -L and -B directory prefixes so we can link with it. - -Thu Jul 28 14:37:36 1994 Stu Grossman (grossman@cygnus.com) - - * Makefile.in (INSTALLED_LIBS, CLIBS, DEPFILES): Add support for - --enable-xxx configure option by adding ENABLE_{CLIBS DEPFILES} - where appropriate. - - * General hackery to support alternate user-interface. - * breakpoint.c (mention, delete_breakpoint, enable_breakpoint, - disable_breakpoint): Call hooks for alternate user-interface. - * defs.h: Add declarations for alternate user-interface hooks. - * main.c (main): Add --nw (and --nowindows) options to disable - the GUI. - * (near call to command_loop): Call command_loop_hook if set. - * (fputs_unfiltered): Call fputs_unfiltered_hook if set. - * stack.c: Call print_frame_info_listing_hook if set. - * top.c (gdb_init): Initialize targets.c and utils.c prior to - other files to make sure that calls to error and warning will - work. Call init_ui_hook after everything else. - * utils.c (query): Call query_hook if set. - * (gdb_flush): Call flush_hook if set. - * Change _initialize_utils to initialize_utils cuz we don't use - automatic initialization of utils.c anymore. - - - * remote.c: Get rid of #ifdef DONT_USE_REMOTE. It's no longer - necessary. - -Thu Jul 28 14:52:01 1994 J.T. Conklin (jtc@phishhead.cygnus.com) - - * Makefile.in (CC_FOR_TARGET, CXX_FOR_TARGET): Use newlib if it is - there and we are using the gcc from the tree. - (LD_FOR_TARGET): Look for ld in ../ld/ld.new. - -Thu Jul 28 10:43:36 1994 Fred Fish (fnf@cygnus.com) - - * Makefile.in (annotate.o): Add dependencies. - -Wed Jul 27 14:34:42 1994 J.T. Conklin (jtc@phishhead.cygnus.com) - - * sparclite/aload.c: Added new -q (quiet) option. - return 0 exit status if file was successfully downloaded. - - * nlm/gdbserve.c: merge in command line argument parsing changes - and bug fixes made to i386-nlmstub.c. - - * i386-nlmstub.c: The returnLength field must be initialized - before portConfig is passed to AIOGetPortConfiguration. - Compare command line arguments with strnicmp(); args are - case insensitive on netware. - -Wed Jul 27 09:24:19 1994 Fred Fish (fnf@cygnus.com) - - * Makefile.in (DISTSTUFF): Add definition. - (diststuff): Add for new distribution support. - (gdb.tar.Z, make-proto-gdb.dir, setup-to-dist, - gdb-$(VERSION).tar.Z, make-proto-gdb-1, make-proto-testsuite.dir): - Remove old distribution building rules, now uses standard - distribution support in parent directory Makefile.in. - -Tue Jul 26 14:15:53 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * target.c (push_target): Cast result from xmalloc. - -Tue Jul 26 18:20:46 1994 Paul Flinders (ptf@smee) - - * elfread.c (elf_symtab_read): Discard compiler labels generated - by the Solaris 2.1/Intel SunPro compiler. - -Mon Jul 25 18:19:24 1994 Stu Grossman (grossman@cygnus.com) - - * target.c (nomemory): Fix prototype and routine to take correct - args. - -Mon Jul 25 15:38:23 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Makefile.in (clean): Remove libgdb-files. - -Mon Jul 25 11:50:57 1994 Stan Shebs (shebs@andros.cygnus.com) - - * coredep.c: Include inferior.h. - -Mon Jul 25 11:36:02 1994 J.T. Conklin (jtc@phishhead.cygnus.com) - - * i386-nlmstub.c: Add support for NODE, PORT and BAUD command - line arguments. - -Sat Jul 23 14:36:09 1994 Stan Shebs (shebs@andros.cygnus.com) - - * symfile.c (deduce_language_from_filename): Recognize .S as asm, - .cp as C++, alphabetize better. - - * breakpoint.c (ignore, condition): Move usage note into body of - help text, so first line can be one-line summary. - -Sat Jul 23 00:58:15 1994 Stu Grossman (grossman@cygnus.com) - - * target.c (unpush_target): Fix handling of removal of top target. - -Fri Jul 22 17:30:39 1994 Stu Grossman (grossman@cygnus.com) - - * Makefile.in: Add stuff to build nlmstub. - * Add rule for annotate.o to keep Sun make happy. - * configure.in: Add config for powerpc/Netware. - - * partial-stab.h (near N_SO): Don't call START_PSYMTAB with null - filename. This speeds up handling of trailing N_SO stabs (they - mark the end of a .o file). - - * target.c, target.h: Change the way pushing and popping of - targets work to support target overlays and inheritance. - * corelow.c, hppa-tdep.c, inflow.c, remote-nindy.c, utils.c: - Fixup references to current_target, due to previous changes. - - * config/i386/tm-i386nw.h: Enable longjmp support. More work is - needed to get the address of longjmp out of the target. - -Tue Jul 19 13:25:06 1994 Stan Shebs (shebs@andros.cygnus.com) - - * main.c: Include . - -Mon Jul 18 15:32:17 1994 Kung Hsu (kung@mexican.cygnus.com) - - * remote-mips.c (mips_readchar): Fix a bug in checking - prompt. - -Mon Jul 18 14:26:35 1994 Stan Shebs (shebs@andros.cygnus.com) - - * solib.c (look_for_base): Don't deref exec_bfd if NULL. - -Sun Jul 17 15:38:36 1994 Fred Fish (fnf@cygnus.com) - - * Makefile.in (VERSION): Bump to 4.12.4. - -Sun Jul 17 12:20:35 1994 Stan Shebs (shebs@andros.cygnus.com) - - Harris CX/UX support, from Bob Rusk (rrusk@mail.csd.harris.com). - * configure.in (m88*-harris-cxux*): New configuration. - * cxux-nat.c, config/m88k/cxux.mh, config/m88k/cxux.mt, - config/m88k/xm-cxux.h, config/m88k/tm-cxux.h, config/m88k/nm-cxux.h: - New files. - * config/m88k/tm-m88k.h: Add comment about Harris OS. - (TARGET_WRITE_PC): Pass pid through to register writers. - - * configure.in (m68*): Put vendor-only-specified host configs - after vendor-and-os-specified configs. - (m68*-atari-sysv4*, m68*-cbm-sysv4*): Replace with m68*-*-sysv4. - - * config/m88k/delta88.mh (MUNCH_DEFINE): Remove. - * config/m88k/delta88.mt, config/m88k/delta88v4.mh: Format - consistently. - -Sat Jul 16 23:39:17 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * elfread.c (elf_symtab_read): Handle error return from - bfd_get_dynamic_symtab_upper_bound gracefully. - -Sat Jul 16 14:43:17 1994 Stan Shebs (shebs@andros.cygnus.com) - - * inferior.h (ARCH_NUM_REGS): New macro, actual number of - registers in use by the inferior. - * coredep.c (fetch_core_registers, register_addr): Use it. - * findvar.c (registers_changed, registers_fetched, - read_register_bytes): Ditto. - * infcmd.c (do_registers_info, registers_info): Ditto. - * infptrace.c (fetch_inferior_registers, - store_inferior_registers): Ditto. - * stack.c (frame_info): Ditto. - - * coredep.c (CORE_REGISTER_ADDR): New macro. - (fetch_core_registers): Use it. - - * breakpoint.c (ignore, condition): Add usage notes to help strings. - * symfile.c (add-symbol-file): Add usage note to help string. - (add_shared_symbol_files_command): New command. - - gcc -Wall lint. - * inferior.h (read_pc_pid): Declare. - * breakpoint.c (watchpoint_check): Cache breakpoint in local - variable b, remove unused variable other_type_used. - * main.c (inferior.h, call-cmds.h): Include. - (gdb_init): Declare. - * remote.c (remote_wait): Return 0 by default. - -Fri Jul 15 16:43:33 1994 Stan Shebs (shebs@andros.cygnus.com) - - Stop printing at null char option, from Oliver Meyer - (omeyer@i3.informatik.rwth-aachen.de). - * valprint.h, valprint.c (stop_print_at_null): New global. - * valprint.c (_initialize_valprint): New print set subcommand - "null-stop". - * c-valprint.c (c_val_print): If stop_print_at_null is on, and - printing a char array, adjust the number of chars to print. - -Fri Jul 15 14:33:40 1994 Stan Shebs (shebs@andros.cygnus.com) - - From Kevin A. Buettner (kev@cujo.geg.mot.com). - * m88k-tdep.c (examine_prologue): Modified to handle prologues for - pic code in addition to prologues where an instruction from the - prologue gets moved into the delay slot of a branch instruction - immediately following the prologue. A table of potential prologue - instructions (prologue_insn_tbl) is now used for picking apart a - function prologue. - (frame_find_saved_regs): Changed the way in which limit gets set - so that the delay slot of branch instructions immediately - following the prologue gets examined. - (pushed_size, store_parm_word, store_parm, push_parameters, - collect_returned_value): Deleted. - -Fri Jul 15 01:06:00 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * infrun.c (wait_for_inferior): Handle stepping into leaf - functions whose prologue consists of gp loading code only. - -Thu Jul 14 14:22:12 1994 Stan Shebs (shebs@andros.cygnus.com) - - * dbxread.c: Don't include libbfd.h. - * dwarfread.c, elfread.c somread.c: Don't include libbfd.h, - , or . - * elfread.c (elf_symfile_read): Use only standard BFD functions to - collect information about the stab and stab string sections. - -Thu Jul 14 13:17:39 1994 Kung Hsu (kung@x1.cygnus.com) - - * stabsread.c (read_huge_number): handle large unsigned number - for stabs generated by os9k C compiler. - -Wed Jul 13 18:58:15 1994 Stan Shebs (shebs@andros.cygnus.com) - - Breakpoint hit counts, from Bob Rusk (rrusk@mail.csd.harris.com). - * breakpoint.h (hit_count): New breakpoint field. - * breakpoint.c (show_breakpoint_hit_counts): New variable. - (clear_breakpoint_hit_counts): New function. - (bpstat_stop_status): Increment the hit count. - (breakpoint_1): Display the hit count. - * infcmd.c (run_command): Reset breakpoint hit counts. - * target.c (generic_mourn_inferior): Don't clear ignore counts if - displaying hit counts. - -Tue Jul 12 12:23:15 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * elfread.c (elf_symfile_read): Unconditionally add dynamic - symbols for all symbol files. Makes skipping over the - trampoline code work when stepping from a function in a shared - library into a function in a different shared library for Irix 5. - Other ELF targets do not have enough information in their - dynamic symbol tables to make this work. - (elf_symtab_read): Relocate mst_solib_trampoline address. - -Mon Jul 11 16:38:49 1994 Stan Shebs (shebs@andros.cygnus.com) - - Atari support, from Uwe Seimet (seimet@chemie.uni-kl.de). - * configure.in (m68*-atari-sysv4*): New configuration. - (m68*-cbm-sysv4*): Use m68kv4 instead of amix. - * m68k-tdep.c (R_PS): Define as R_SR if necessary. - * config/m68k/m68kv4.mh, config/m68k/m68kv4.mt, - config/m68k/tm-m68kv4.h, config/m68k/xm-m68kv4.h: New files. - * config/m68k/amix.mh, config/m68k/amix.mt, - config/m68k/tm-amix.h, config/m68k/xm-amix.h: Removed, superseded - by m68kv4 files. - -Sat Jul 9 16:28:43 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * symtab.c (find_function_start_sal): New function to find - the start of a function from a function symbol. - (decode_line_1, decode_line_2): Use it instead of open coded - partial copies of the code. - (list_symbols): Quote symbol name before passing it to - break_command to enable proper handling of mangled symbols. - -Wed Jul 6 20:22:07 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * ch-exp.y (match_simple_name_string): Don't lower-case here. - * ch-exp.y (yylex): First try name lookup using exact name - typed by user; if that fails, try lower-cased name. - -Wed Jul 06 12:39:07 1994 Jeff Law (law@snake.cs.utah.edu) - - * hpread.c: More cleanups. Delete lots of trailing whitespace. - Remove some items from the TODO list and notes throughout code - for things which need fixing. Add more comments. - Document bogus struct symloc sharing with dbxread.c. Delete more - useless variables. Add more PARAM prototypes. Fixup more - indention problems that have crept in. - (SET_NAMESTRING): Accept new namep and objfile arguments so that - it doesn't depend on the variable names on the procedures it's - used from. - (hpread_symfile_init): Delete incorrect checks for bogus sizes of - the debug sections. - -Wed Jul 6 00:48:57 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * dbxread.c, elfread.c, mipsread.c, nlmread.c, os9kread.c: - Move "no debugging symbols found" test to symfile.c. - * symfile.c (syms_from_objfile, reread_symbols): Add - "no debugging symbols found" test. - * coffread.c (init_stringtab): Handle stripped files with a - stringtab offset of zero gracefully. - * osfsolib.c (solib_create_inferior_hook): Use DYNAMIC flag from - BFD instead of stop_pc heuristic to determine if it is a dynamically - linked object file. - * procfs.c (wait_fd): Handle ENOENT error return from PIOCWSTOP - ioctl, it indicates that the process has exited. - -Mon Jul 04 19:48:03 1994 Jeff Law (law@snake.cs.utah.edu) - - * hpread.c (hpread_symfile_init): Make sure to initialize all the - private data to zero. Not having any HP C debug symbols is not an - error. Just return. - -Mon Jul 4 19:28:56 1994 Jeff Law (law@snake.cs.utah.edu) - - * hppa-tdep.c (read_unwind_info): ELF unwind information is in the - .PARISC.unwind section now. - -Mon Jul 4 17:06:26 1994 Stan Shebs (shebs@andros.cygnus.com) - - * breakpoint.c (mention): Always show breakpoint address if no - source file. - -Sat Jul 2 01:51:33 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * solib.c (bfd_lookup_symbol, look_for_base): Reinstate to reenable - handling of shared libraries for non-ELF executables, but only if - HANDLE_SVR4_EXEC_EMULATORS is defined. - (locate_base): Try to find debug_base in the dynamic linker - for non-ELF executables if HANDLE_SVR4_EXEC_EMULATORS is defined. - * config/sparc/tm-sun4sol2.h (HANDLE_SVR4_EXEC_EMULATORS): - Define to enable handling of shared libraries for a.out executables, - run under Solaris BCP. - -Fri Jul 01 19:50:21 1994 Jeff Law (law@snake.cs.utah.edu) - - * hpread.c: Change contribution notice to the Cygnus/Utah agreed - upon notice. Delete some stuff from the TODO list. Rework - many comments to be clearer. Major cleanups. Consistently - use "hpread_" prefix. Delete unnecessary macros, structures - variables, fiels, functions and #if 0 code. Mark code which - still needs to be cleaned up. PARAMize and make most functions - static. Fix error checking when reading in the debug section - contents. No more minimal symbol table handling in this code! - -Thu Jun 30 13:59:23 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * infrun.c (wait_for_inferior): Print "Program exited normally" - regardless of batch_mode. - * defs.h, top.c (batch_mode): Removed. - -Wed Jun 29 18:53:36 1994 Stan Shebs (shebs@andros.cygnus.com) - - * Makefile.in (dcache_h): Remove redundant definition. - (init.c): Add a comment. - (top.c): Remove explicit compile action. - * breakpoint.c (mention): Share code indicating location of - break/watchpoints, don't print address if addressprint is off. - * breakpoint.c, c-typeprint.c, c-valprint.c, energize.c, symtab.h - (demangle): Remove redundant declarations. - * eval.c: Remove redundant function declarations. - * objfiles.h: Cosmetic and grammatical improvements. - * TODO: Various updates. - - * remote-mips.c: Replace all \r chars with \015. - (mips_receive_header): Display control characters readably. - (mips_xfer_memory): Add a simple progress display. - -Wed Jun 29 13:11:45 1994 Steve Chamberlain (sac@cirdan.cygnus.com) - - * remote-e7000.c (e7000_open): Don't try a tcp open if we're - using go32. - * remote-hms.c (flush): New function. - (expect): Get edge case right. - (hms_read_inferior_memory): Be more tolerant of line noise. - -Tue Jun 28 14:17:03 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * configure.in: Use i386m3.mh and i386m3.mt as names of host and - target files, not non-existent mach3.mh and mach3.mt. - -Wed Jun 29 00:26:17 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * dbxread.c (dbx_symfile_read): Unconditionally add dynamic - symbols for all symbol files. Makes skipping over the - trampoline code work when stepping from a function in a shared - library into a function in a different shared library. - (read_dbx_dynamic_symtab): Relocate mst_solib_trampoline address. - -Tue Jun 28 15:28:01 1994 Stu Grossman (grossman@cygnus.com) - - * dbxread.c, partial-stab.h (near N_SO): SO stabs with blank - names mean end of .o file. - * infrun.c (wait_for_inferior): Clean up multi-thread logic near - top of routine. Handle new thread notification cleanly. - * lynx-nat.c (child_wait): General cleanups, handle new LynxOS - thread notification scheme. - * (child_resume): General cleanups, handle resumption of all - threads properly. - -Mon Jun 27 09:57:23 1994 Steve Chamberlain (sac@cirdan.cygnus.com) - - * ser-go32.c: Rewrite to run under windows. - * ser-e7kpc.c: New file to support the E7000 with the PC ISA - bus interface. - * serial.c (serial_open): Notice device "pc". - * remote-e7000.c: Fix copyright date. - (expect): Compare \n and \r the same. - (e7000_open): Allow pc as a serial port - * sh/sh.mt: Add ser-e7kpc. - * h8300/h8300hms.mt: Add ser-e7kpc. - * main.c (proc_wait): Don't wait if using go32. - -Mon Jun 27 00:35:51 1994 Jeff Law (law@snake.cs.utah.edu) - - * somread.c: Simplify by using stabsect_build_psymtabs. - * dbxread.c (stabsect_build_psymtabs): New argument "text_name" - corresponding to the name of the text section. All references - changed. - (somstab_build_psymtabs): Delete function, no longer needed. - -Sun Jun 26 23:54:08 1994 Jeff Law (law@snake.cs.utah.edu) - - * somread.c: Renamed from paread.c. Changed function names and - comments to reflect that this file deals with SOM (an object file - format), rather than the PA (a cpu). - (Makefile.in): Chaned appropriately. - (config/pa/hppabsd.mh, config/pa/hppahpux.mh): Likewise. - * dbxread.c (somstab_build_psymtabs): Renamed from - pastab_build_psymtabs. - -Fri Jun 24 08:15:42 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * core-sol2.c: New file to handle ELF and BCP core file flavours. - * config/sparc/sun4sol2.mh (NATDEPFILES): Use it instead of - core-svr4. - * Makefile.in: Updated for core-sol2.c. - * README: Add notes about SPARCworks cc under Solaris 2.x, - from Casper H.S. Dik (casper@fwi.uva.nl). - * config/mips/xm-makeva.h: Removed, no longer necessary. - * Makefile.in, config/mips/xm-irix3.h, config/mips/xm-irix5.h, - config/mips/xm-mips.h, config/mips/xm-news-mips.h, - config/mips/xm-riscos.h: Remove references to xm-makeva.h - -Wed Jun 22 17:48:21 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * gdba.el: Put program input and output in a separate buffer. - -Wed Jun 22 16:54:15 1994 Fred Fish (fnf@cygnus.com) - - * energize-patches, main.c (main), top.c (gdb_init, pwd_command), - top.h: Change all occurances of dirbuf to gdb_dirbuf. Collides - with global variable of same name in libnsl.so on UnixWare. - -Wed Jun 22 14:40:52 1994 Kung Hsu (kung@mexican.cygnus.com) - - * symtab.c (decode_line_1): fix a bug in dealing with '<>' - embedded in template name. - -Tue Jun 21 14:06:46 1994 Kung Hsu (kung@mexican.cygnus.com) - - * config/i386/nm-linux.h: change calling convention of - TARGET_CAN_USE_HARDWARE_WATCHPOINT() and - target_insert_watchpoint() and - target_remove_watchpoint(). - - * config/mips/tm-mips64.h: define FORCE_LONG_LONG to force LONGEST - to be long long in gdb. - * config/mips/tm-bigmips.h: ditto. - -Mon Jun 20 23:54:37 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * c-lang.c (asm_language_defn): New definitions for language_asm, - mostly copied from c_language_defn, to avoid warnings when - switching between c and asm stack frames. - -Mon Jun 20 13:51:55 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) - - * mdebugread.c (parse_symbol): Don't call ecoff_swap_tir_in or - ecoff_swap_rndx_in directly; use the debug_swap pointer instead. - (upgrade_type, handle_psymbol_enumerators): Likewise. - (has_opaque_xref, cross_ref): Likewise. - (elfmdebug_build_psymtabs): Call swap->read_debug_info to read - debugging information, rather than doing it here. - * mipsread.c (mipscoff_symfile_read): Call read_debug_info entry - point in ecoff_debug_swap backend structure, rather than calling - ecoff_slurp_symbolic_info directly. - -Fri Jun 17 20:58:58 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * breakpoint.c: Include annotate.h. Call annotate_field rather - than printing annotation directly. - - * main.c: Include string.h. - -Thu Jun 16 14:41:37 1994 Stan Shebs (shebs@andros.cygnus.com) - - * fork-child.c (startup_inferior) [STARTUP_INFERIOR]: If defined, - call it instead of doing normal loop. - * infcmd.c (attach_command): Don't call wait_for_inferior if - running Mach 3. - * infrun.c (proceed) [PREPARE_TO_PROCEED]: If defined, call - hook that can decide whether to step over the next breakpoint. - * utils.c (wrap_here): Abort if wrap_buffer not allocated. - (request_quit) [REQUEST_QUIT]: If defined, call it instead of - doing normal quit. - - * configure.in: Improve sorting/formatting of hosts and targets. - (i[34]86-*-mach3*, i[34]86-*-osf1mk*, mips-*-mach3*, - m88*-*-mach3*, ns32k-*-mach3*): Recognize. - * Makefile.in (stop-gdb): New target. - * stop-gdb.c: New file, utility to get attention of waiting GDBs - in Mach 3. - -Wed Jun 15 00:41:03 1994 Tom Lord (lord@rtl.cygnus.com) - - * top.c (gdb_init): Init current_directory in gdb_init. Probably - the identical initialization can be deleted from main.c, but i - haven't done so just in case. - -Tue Jun 14 17:24:41 1994 Tom Lord (lord@x1.cygnus.com) - - * gdba.el: Added menu windows and slightly improved window - handling to gdba.el. Fixed numerous minor bugs that were causing - emacs and gdb to fall out of sync. - -Tue Jun 14 16:18:44 1994 Kung Hsu (kung@mexican.cygnus.com) - - * breakpoint.c: annotate changes lost at merge, put back in. - -Mon Jun 13 17:28:50 1994 Stan Shebs (shebs@andros.cygnus.com) - - * config/i386/i386sco.mh, i386sco4.mh (XDEPFILES): Remove - i387-tdep.o. - -Sun Jun 12 03:51:52 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * config/m68k/dpx2.mh (NATDEPFILES): Remove duplicate inclusion - of inftarg.o. - * config/m68k/tm-dpx2.h (CANNOT_STORE_REGISTER): Define to inhibit - writing of floating registers, the dpx2 kernel disallows it. - * irix5-nat.c (LM_ADDR): The loaded address of the shared library - is contained in o_praw. - * irix5-nat.c (solib_map_sections): Adjust sections by the - difference between the loaded address and the prelinked address. - * irix5-nat.c (solib_address): Use LM_ADDR for the loaded start - address. - * mdebugread.c (parse_symbol): Do not relocate stEnd/scText - symbols, their value is absolute. - * mdebugread.c (parse_partial_symbols): Handle Irix 5.2 shared - libraries fh->adr fields of zero. Relocate minimal symbol values - upon readin. Relocate non-stabs symbols upon readin. - * mdebugread.c (psymtab_to_symtab_1): Use pst->textlow for the - start address of the outermost block. - * mdebugread.c (parse_lines, parse_procedure): Pass in pst - instead of section_offsets and use relocated pst->textlow for - line number and procedure address relocations. - - From gmo@MicroUnity.com (Guillermo A. Loyola): - * mdebugread.c (parse_symbol, parse_partial_symbols, cross_ref): - Handle SGI Irix5 stIndirect symbol type. - -Fri Jun 10 14:52:56 1994 Kung Hsu (kung@mexican.cygnus.com) - - * breakpoint.c: fix a syntax error native cc does not like. - - * Makefile.in: change sparclite-tdep.c to sparcl-tdep.c. - * sparclite/Makefile.in: ditto. - * sparcl-tdpe.c: change file name because first 8 chars has to be - unique. - * sparcl-stub.c: ditto. - - * sparclite/Makefile.in: fix INCLUDE_CFLAGS to have {srcdir}/../config. - -Fri Jun 10 10:38:15 1994 Jeff Law (law@snake.cs.utah.edu) - - * hppa-tdep.c (target_read_pc, target_write_pc): Accept (and - ignore) a PID argument. - (hppa_pop_frame): Pass a PID to target_write_pc. - * config/pa/tm-hppa.h (TARGET_READ_PC, TARGET_WRITE_PC): Accept - and pass through a PID argument. - (target_read_pc, target_write_pc): Update prototypes. - -Thu Jun 9 18:10:44 1994 Kung Hsu (kung@mexican.cygnus.com) - - * Makefile.in: add new file sparclite-tdep.c. - * sparclite/Makefile.in: add new file sparclite-stub.c. - * sparclite/hw_breakpoint.note: note for SPARClite hardware breapoint - support. - * config/sparc/sparclite.mt: add sparclite-tdep.o. - * config/sparc/tm-sparclite.h: add hardware breakpoints support - defiines and code. - * sparclite-tdep.c: new file, contains hardware breakpoint support - code. - * sparclite-stub.c: new file, stub code that add support hardware - breakpoint support. - * breakpoint.c: add hardware breakpoint support. - * breakpoint.h: add new breakpoint type to support hardware - breakpoint. - * config/mips/nm-irix4.h: change interface for target dependent - code supporting watch point. - * config/pa/nm-hppab.h: change interface for target dependent - code supporting watch point. - -Thu Jun 9 14:59:58 1994 Kung Hsu (kung@mexican.cygnus.com) - - * remote-os9k.c (rombuf_command): fix a bug accepting rombug - output. - * stabsread.c (read_struct_fields): os9k nested structure does not - have terminating ';', instead it just get to ',' and bit position - and length. - -Wed Jun 8 23:20:45 1994 Stu Grossman (grossman@cygnus.com) - - * nlmread.c (nlm_symtab_read): Clean up a bit. - * (nlm_symfile_read): Record bounds of main() so that backtrace - command will know where to stop. - * objfiles.c (objfile_relocate): Relocate entry point/func info - for backtrace as well. - * objfiles.h: Define values for invalid PCs for entry point info. - * symfile.c (init_entry_point_info): Initialize invalid values - with aforementioned macros. - * config/alpha/tm-alphanw.h: Turn on FRAME_CHAIN_VALID_ALTERNATE - to cause backtrace to stop when it gets back to main(). - * config/i386/tm-i386nw.h: Ditto. - -Sat Jun 4 18:17:03 1994 Per Bothner (bothner@kalessin.cygnus.com) - - Fix value_print, which used to be ostensibly language-independent, - but would print pointers and arrays in C syntax. Instead, call - a language-specific function. - * language.h (struct language_defn): New functional field - la_value_print. - (LA_VALUE_PRINT): New macro. - * language.c (unk_lang_value_print): New stub/dummy function. - (unknown_language_defn, auto_language_defn, local_language_defn): - Use it. - * c-valprint.c (c_value_print): New function, with code moved from: - * valprint.c (value_print): ... here. Now just invoke - LA_VALUE_PRINT to do language-specific stuff. - * valprint.c (value_print_array_elements): Make non-static. - * c-lang.c (c_language_defn, cplus_language_defn): Add - c_value_print in the la_value_print field. - * m2-lang.c (m2_language_defn): Likewise. - * ch-lang.c (chill_language_defn): But here use chill_value_print. - * ch-valprint.c (chill_val_print): Print null pointer as NULL. - * ch-valprint.c (chill_value_print): New function, based on - c_value_print, but use Chill "look and feel." - * c-lang.h (c_value_print): New prototype. - * ch-lang.h (chill_value_print): New prototype. - * value.h (value_print_array_elements): New prototype. - - * ch-valprint.c (chill_val_print, case TYPE_CODE_BITSTRING - and case TYPE_CODE_SET): Check that the element type isn't a stub. - -Fri Jun 3 09:15:00 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * main.c: Move entire file except for #ifndef MAIN_OVERRIDE code - to new file top.c. Make things extern instead of static and - similar rearrangements to deal with this. - * top.h: New file. - * utils.c: Move fputs_unfiltered to main.c. Remove - FPUTS_UNFILTERED_OVERRIDE ifndef. - * Makefile.in: Change so that gdb uses main.c, utils.c, and top.c, - and libgdb uses utils.c and top.c. - -Thu Jun 2 23:19:10 1994 Jeff Law (law@snake.cs.utah.edu) - - * hppa-tdep.c (skip_trampoline_code): Fix typo. - -Thu Jun 2 18:09:59 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * ch-valprint.c (chill_val_print_array_elements): New function. - A Chill version of val_print_array_elements, it prints the - array index labels, in additions ot the array element values. - (chill_val_print): Use the new function. - -Thu Jun 2 08:50:00 1994 Stu Grossman (grossman@cygnus.com) - - * configure.in: Add nlm subdir to configdirs for alpha-*-netware - target. - * defs.h (enum language): Add language_asm. - * findvar.c (read_register_bytes read_register_gen - write_register_bytes read_register read_register_pid - write_register write_register_pid supply_register): Move multi- - thread handling down into these routines. Create XXX_pid routines - that allow register references to specify the pid. - * findvar.c infcmd.c (read_pc read_pc_pid write_pc write_pc_pid - read_sp write_sp read_fp write_fp): Move these routines from - infcmd to findvar to centralize the whole mess. - * i386-nlmstub.c: Portability fixes. - * infptrace.c (child_resume): Conditionalize to allow other natives - to override it. Remove PIDGET gubbish, it's no longer necessary. - * infrun.c (wait_for_inferior): Put registers_changed() before - target_wait() to speed up remote debugging. - * Replace code that reads registers from other threads with much - nicer looking new function calls (see changes to findvar.c). - * Don't skip prologues if debugging assembly source. - * lynx-nat.c (child_resume): Lynx now needs it's own version of - child_resume to handle multi-thread debugging properly. - * remote.c: Add O response to get console output from target. - * (readchar): Add timeout parameter. Handle SERIAL_EOF and - SERIAL_ERROR here to simplify callers. - * Change static var timeout to remote_timeout. - * (fromhex): Remove unnecessary return -1 at end of routine. - * (remote_wait): Turn this into a big switch statement. Add - support for O response. - * (putpkt): Remove unnecessary handling of SERIAL_EOF/ERROR. - * (getpkt): Split getpkt into two parts. read_frame deals with - all formatting issues, run-length encoding, and framing. getpkt - now handles error recovery, and frame detection. - * ser-tcp.c (tcp_readchar): Handle EINTR from read(). - * ser-unix.c (hardwire_raw): Set CLOCAL so that we ignore modem - control. (hardwire_readchar): Handle EINTR from read(). - * symfile.c (deduce_language_from_filename): Add support for .s - files. - * config/nm-lynx.h: Define CHILD_WAIT so that lynx-nat.c can - override infptrace's child_wait. - * config/rs6000/rs6000lynx.mh: Use xm-rs6000ly.h & nm-rs6000ly.h - instead of XXXlynx.h. - * config/rs6000/rs6000lynx.mt: Use tm-rs6000ly.h instead of - tm-rs6000lynx.h. - * nlm/gdbserve.c: Portability fixes. - -Tue May 31 20:35:44 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * inftarg.c (child_wait): Call proc_wait, not wait. - (child_mourn_inferior): Call proc_remove_foreign. - * main.c (gdb_init): Call init_proc. - * main.c: Provide dummy versions of init_proc, proc_wait, and - proc_remove_foreign for the gdb case (the libgdb case provides its - own versions of these functions). - * Makefile.in (libgdb-files): Add libproc.a. - -Wed Jun 1 11:08:52 1994 Stan Shebs (shebs@andros.cygnus.com) - - Hardware watchpoints for Linux, from Rick Sladkey - (jrs@world.std.com). - * infrun.c (wait_for_inferior) [HAVE_CONTINUABLE_WATCHPOINT]: Add - new hardware breakpoint recovery method. - * i386v-nat.c (i386_insert_watchpoint, - i386_insert_nonaligned_watchpoint, i386_remove_watchpoint, - i386_stopped_by_watchpoint) [TARGET_CAN_USE_HARWARE_WATCHPOINT]: - New functions to support the 386 hardware debugging registers. - * config/i386/nm-linux.h (TARGET_CAN_USE_HARDWARE_WATCHPOINT, - HAVE_CONTINUABLE_WATCHPOINT, STOPPED_BY_WATCHPOINT, - target_insert_watchpoint, target_remove_watchpoint): Define these - macros to use the hardware debugging functions in i386v-nat.c. - -Wed May 25 17:06:15 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Makefile.in: Replace libgdb.a with libgdb-files. Make "all" - build it. - -Thu May 19 09:56:20 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * target.c, target.h: New variables target_activity_function and - target_activity_fd. - * inflow.c, inferior.h: New functions set_sigio_trap and - clear_sigio_trap. - * inftarg.c (child_wait), procfs.c (wait_fd): Call them. - -Wed May 18 13:01:55 1994 Doug Evans (dje@canuck.cygnus.com) - - * remote-sim.h (sim_verbose): Delete. - Document callbacks needed. - (sim_*): Change result to void where there isn't one. - (sim_open): Clarify argument and error response. - (sim_close): Declare. - (sim_load): Change bfd_handle argument to file name. Clarify result. - (sim_create_inferior): Renamed from sim_set_args. - (sim_set_pc): Delete. - (sim_info): Delete printf_fn argument. - * remote-sim.c (gdbsim_kill): Add comment describing purpose. - (gdbsim_load): Try sim_load first. - (gdbsim_create_inferior): Call sim_create_inferior. - (gdbsim_open): Handle args == NULL. Update call to sim_open. - (gdbsim_close): Call sim_close. - (gdbsim_files_info): Update call to sim_info. - (gdbsim_ops): Realign comments. - - * printcmd.c (decode_format): Allow TARGET_PTR_BIT to be non-constant. - -Tue May 17 16:45:20 1994 Stan Shebs (shebs@andros.cygnus.com) - - * xcoffread.c (read_xcoff_symtab): For C_FILE symbols, only use - the auxent if the symbol's name is ".file". From David Edelsohn - . - -Tue May 17 11:08:22 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * breakpoint.c (breakpoint_1): Fix typo. - - * annotate.c (annotate_field_end): Fix typo. - - * Makefile.in: Move annotate.o from COMMON_OBS to OBS. - - * Makefile.in (TSSTART): Remove; no longer used. - - * utils.c (vfprintf_maybe_filtered, vfprintf_unfiltered): Call - fputs_unfiltered and exit directly, rather than fatal. The latter - calls vfprintf_unfiltered! - - * gdbtypes.h, gdbtypes.c (can_dereference): New function. - * value.h, printcmd.c (print_value_flags): Move from here... - * annotate.c: ...to here, and make it use can_dereference. - -Sat May 14 15:13:52 1994 Stan Shebs (shebs@andros.cygnus.com) - - * inflow.c (job_control, attach_flag, generic_mourn_inferior): - Remove, needed for both native and cross. - * target.c (attach_flag, generic_mourn_inferior): Put here. - * utils.c (job_control): Put here. - (terminal.h): Don't include anymore. - -Sat May 14 09:11:44 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * source.c (find_source_lines): Always use code that was #ifdef - BROKEN_LARGE_ALLOCA. Do the cleanup before returning, rather than - leaving it on the chain. Reindent much of this function. - * config/sparc/{xm-sun4sol2.h,xm-sun4os4.h}, - config/i386/{xm-sun386.h,xm-i386m3.h,xm-i386mach.h}, - config/m68k/{sun3os4.h,xm-news.h,xm-hp300hpux.h}, - config/ns32k/xm-ns32km3.h: Remove all references to - BROKEN_LARGE_ALLOCA; with the above change it is no longer needed. - * main.c, fork-child.c, many config files: Remove all - SET_STACK_LIMIT_HUGE code; with the above changes it should no - longer be needed. - - * symtab.c (lookup_partial_symbol): Use if and abort, not assert. - This avoids __eprintf troubles. - -Fri May 13 08:10:21 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * main.c (main): Surround in #ifndef MAIN_OVERRIDE. Move - initialization code which needs to be called even if we bypass the - command line stuff into gdb_init. - * utils.c (fputs_unfiltered): Surround in #ifndef - FPUTS_UNFILTERED_OVERRIDE. - * Makefile.in (libgdb.a): New target. - - * utils.c: Rearrange I/O stuff a bit so that all output goes - through fputs_unfiltered. Use vasprintf; removes arbitrary limit - which made %s not work with arbitrarily large strings. - * printcmd.c (printf_command): Use printf_filtered, not - printf_unfiltered and printf, now that arbitrary limit is gone. - - gcc -Wall lint: - * breakpoint.c (watchpoint_check): Remove unused variable b. - * stack.c (print_frame_info): Move sp and buf inside #if. - * eval.c (evaluate_subexp): Remove unused variables pp, - mangle_ptr, ptr, and mangle_tstr. - * valarith.c (value_x_binop): Remove unused variables mangle_tstr - and mangle_ptr. - * symtab.c (lookup_symtab): Put variable copy inside #if. - (decode_line_1): Put variable q1 inside #if 0. - * target.h: Declare target_link. - * infrun.c (wait_for_inferior): Remove unused variables signame. - * remote.c (remote_resume): Remove unused variable name. - * c-exp.y (parse_number): Parenthesize operand of shift. - * dbxread.c (record_minimal_symbol): Parenthesize operand of && - (this is a semantic change, the warning seems to have detected a bug). - * dbxread.c (end_psymtab): Move variable p1 inside #if. - * coffread.c: Move variable temptype inside #if. - * ch-typeprint.c (chill_type_print_base): Remove unused variable - name. - * ch-valprint.c: #include typeprint.h and ch-lang.h. - (chill_val_print): Remove unused variable in_range. - (chill_val_print): Remove statement "length > TYPE_LENGTH (type);". - (chill_val_print): Add default case for switch. - * stabsread.h: Declare stabsect_build_psymtabs. - * os9kread.c (read_minimal_symbols): Make this return void. - (os9k_symfile_read): Remove unused variables stb_exist and val. - (os9k_symfile_init): Remove unused variable val. - (fill_sym): Remove unused variable id. - (read_os9k_psymtab): Put variable back_to inside #if 0. Remove - unused variable nsl. - Remove unused variable symfile_bfd. - #if 0 unused variables lbrac_unmatched_complaint and - lbrac_mismatch_complaint. - Remove declaration for non-existent function os9k_next_symbol_text. - - * annotate.c, annotate.h: New files, containing a function for - each annotation which outputs it. - * Move breakpoints_changed from breakpoint.c to annotate.c. - * breakpoint.c, blockframe.c, infrun.c, cp-valprint.c, main.c, - printcmd.c, source.c, stack.c, utils.c, valprint.c: - Use annotate.c functions to output annotations. - * Makefile.in (OBS): Add annotate.o. - -Thu May 12 10:46:27 1994 Jeff Law (law@snake.cs.utah.edu) - - * hppa-tdep.c (read_unwind_info): Make sure elf_unwind_size and - elf_unwind_entries are always initialized. - - * hppa-tdep.c (skip_trampoline_code): Handle argument relocation - stubs which return directly to the caller rather than to the stub - itself. - -Wed May 11 20:11:51 1994 Stan Shebs (shebs@andros.cygnus.com) - - * c-exp.y (yyerror): Display a more informative error message. - * ch-exp.y (yyerror): Ditto, don't use global yychar. - * m2-exp.y (yyerror): Ditto. - -Tue May 10 11:57:53 1994 Stan Shebs (shebs@andros.cygnus.com) - - * inflow.c (job_control): Move definition to front of file. - -Tue May 10 14:42:37 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * maint.c (print_section_table): Rename SEC_SHARED_LIBRARY to - SEC_COFF_SHARED_LIBRARY to match corresponding change in bfd. - -Fri May 6 13:30:22 1994 Stan Shebs (shebs@andros.cygnus.com) - - * Makefile.in (kdb): Remove old init.c creation commands. - * configure.in (sparclite): Match on sparclite*. - * sparclite/aload.c (main): Only change section addresses for - a.out format object files. - -Fri May 6 13:24:04 1994 Steve Chamberlain (sac@cygnus.com) - - * config/i386/go32.mh: Define CC. - -Fri May 6 11:56:54 1994 Stan Shebs (shebs@andros.cygnus.com) - - * gdbserver/Makefile.in: Remove irrelevant definitions and - comments inherited from the gdb Makefile. - (BFD_DIR, BFD, BFD_SRC, BFD_CFLAGS): Add from gdb Makefile. - (VERSION): Update to 4.12.3. - (gdbserver): Remove any existing executable first. - (distclean, realclean): Remove nm.h. - * gdbserver/low-lynx.c: Add Sparc Lynx support. - * gdbserver/low-sparc.c, gdbserver/low-sun3.c (sys/wait.h): - Don't use absolute pathname. - -Thu May 5 12:00:22 1994 Stan Shebs (shebs@andros.cygnus.com) - - * rs6000-nat.c (vmap_ldinfo): Don't fail if fstat returns an - error. - -Wed May 4 06:56:03 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * infrun.c (proceed, normal_stop, wait_for_inferior), breakpoint.c - (print_it_normal): Add annotations for the inferior starting and - stopping, and for all the various messages related to how it - stopped. - - * printcmd.c (do_one_display): Annotate. - * stack.c (print_frame_info): Annotate printing of stack frames. - -Wed May 4 18:15:51 1994 Stu Grossman (grossman@cygnus.com) - - * remote.c (get_offsets): Handle case where stub doesn't support - qOffsets message. - -Wed May 4 15:30:39 1994 Per Bothner (bothner@kalessin.cygnus.com) - - Add partial support for g++ code compiled with -fvtable-thunks. - * c-valprint.c (c_val_print): Add vtblprint support - when using thunks. - * cp-valprint.c (cp_is_vtbl_member): A vtable can be an array of - pointers (if using thunks) as well as array of structs (otherwise). - * cp-valprint.c (vtbl_ptr_name_old, vtbl_ptr_name): Move to global - level, and make the latter non-static (so define_symbol can use it). - * stabsread.c (define_symbol): If the type being defined is a - pointer type named "__vtbl_ptr_type", set the TYPE_NAME to that name. - * symtab.h (VTBL_PREFIX_P): Allow "_VT" as well as "_vt". - * values.c (value_virtual_fn_field): Handle thunks. - * values.c (value_headof): Minor efficiency hack. - * values.c (value_headof): Incomplete thunk support. FIXME. - -Wed May 4 06:56:03 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * valprint.c (print_longest): Clarify comment about use_local. - * printcmd.c, defs.h (print_address_numeric), callers in - symmisc.c, symfile.c, stack.c, source.c, remote.c, infcmd.c, - cp-valprint.c, core.c, ch-valprint.c, c-valprint.c, breakpoint.c, - exec.c: New argument use_local. - * source.c (identify_source_line): Use filtered output. Use - print_address_numeric. - - * core.c (memory_error), symtab.c (cplusplus_hint, decode_line_1), - language.c (type_error, range_error): Use filtered output. - * utils.c (error_begin): Update comment to tell people to use - filtered output. - - * Makefile.in (HFILES_WITH_SRCDIR): List bfd.h. - (HFILES_NO_SRCDIR): List gdbcore.h not gdbcore_h, so as not to get - bfd.h. - -Tue May 3 07:41:33 1994 Jim Kingdon (kingdon@cygnus.com) - - * procfs.c (procfs_wait): Reinstate code which deduces the signal - from the fault, #ifndef FAULTED_USE_SIGINFO. - * config/sparc/tm-sun4sol2.h: Define FAULTED_USE_SIGINFO. - -Fri Apr 29 18:15:04 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * breakpoint.c (breakpoint_1): Annotate each field of the headers. - Explicitly annotate each record. - -Fri Apr 29 15:56:18 1994 Stan Shebs (shebs@andros.cygnus.com) - - * xcoffexec.c: Reformat to standards and lint. - (language.h): Include. - (exec_close): Declare arg "quitting". - (file_command): Declare arg "from_tty". - (map_vmap): Cast xmalloc result to PTR. - * rs6000-nat.c: Reformat to standards and lint. - (exec_one_dummy_insn): Use char array for saved instruction. - (fixup_breakpoints): Declare. - (vmap_ldinfo): Be more informative in fatal error messages. - (xcoff_relocate_symtab): Define to return void. - * xcoffsolib.h: Reformat to standards, improve comments. - * config/rs6000/nm-rs6000.h (xcoff_relocate_symtab): Declare. - -Thu Apr 28 08:40:56 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * utils.c, defs.h (error_begin): New function. - (quit): Print annotation before printing the error message. - * main.c (return_to_top_level): Print annotation before doing the - longjmp. - * symtab.c (decode_line_1): Call error not warning and then - return_to_top_level. Call error_begin and printf_unfiltered - rather calling warning (before calls to return_to_top_level). - * core.c (memory_error): Use error_begin, printf_unfiltered, - print_address_numeric and return_to_top_level instead of error. - Cleans up a FIXME-32x64. - * language.c (type_error, range_error): Call error_begin - not just target_terminal_ours. - - * dbxread.c (stabsect_build_psymtabs): Assign to sym_stab_info - directly, rather than via DBX_SYMFILE_INFO. A cast on the left - side of an assignment is non-portable. - - * utils.c (query): Change syntax of query annotations to be - consistent with other input annotations. - (prompt_for_continue): Likewise for prompt-for-continue annotation. - -Thu Apr 28 01:20:39 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * mdebugread.c (psymtab_to_symtab_1): Do not call sort_blocks - for stabs symtabs. - * mips-tdep.c (mips_skip_prologue): Handle prologues for functions - that have a stack frame size of 32k or larger (from Paul Flinders). - Remove #if 0'd code. - -Wed Apr 27 16:33:51 1994 Stan Shebs (shebs@andros.cygnus.com) - - * lynx-nat.c (CANNOT_STORE_REGISTER): Add a fallback definition - for Lynx platforms that need it. - * config/nm-lynx.h (__LYNXOS): Define if not already defined. - -Wed Apr 27 16:01:37 1994 Jim Kingdon (kingdon@cygnus.com) - - * procfs.c (procfs_wait): Use the signal from the pr_info rather - than trying to deduce it from the fault. - -Wed Apr 27 12:22:46 1994 Steve Chamberlain (sac@cygnus.com) - - * printcmd.c (print_address_symbolic): Initialize name to empty - string to avoid core dump if lookup fails. - * remote-e7000.c (printf_e7000debug): Error if target not open. - -Tue Apr 26 22:45:24 1994 Stu Grossman (grossman at cygnus.com) - - * i386-nlmstub.c: Update to be more in line with PIN stub. - * nlm/gdbserve.c (putDebugChar): Install bug fix from i386-nlmstub. - * (hex2mem): Init ptr. - * General cleanups to use ConsolePrintf, standard prologues, etc... - -Tue Apr 26 10:23:04 1994 Stu Grossman (grossman at cygnus.com) - - * i386-nlmstub.c: More changes to be compatible with remote.c. - - * dbxread.c: Move a bunch of strncmps out of process_one_symbol - into (the far less frequently called) dbx_symfile_read. - - * i386-nlmstub.c: An interim version till we get PIN for the x86. - -Tue Apr 26 09:50:45 1994 Stu Grossman (grossman at cygnus.com) - - * dbxread.c (record_minimal_symbol): Record the section - associated with the symbol to make dynmaic relocation work. - * (dbx_symfile_read, process_one_symbol): Fixes to work around - Solaris brain-damage which don't apply to relocatable object - files. - * (stabsect_build_psymtabs): New routine to read stabs out of an - arbitrarily named section. - * nlmread.c (nlm_symtab_read): Read ALL syms from the NLM, not just - globals. - * (nlm_symfile_read): Call stabsect_build_psymtabs to read the - stabs out of the nlm. - * partial-stabs.h (cases 'f' & 'F'): Fixes to work around Solaris - brain-damage which don't apply to relocatable object files. - * remote.c (putpkt): Improve error reporting and error handling. - * (get_offsets): Temporary kludge to force data & bss sections to - have the same relocation. - * stabsread.c (define_symbol, scan_file_globals): Record section - info in sym. - -Sat Apr 23 19:05:52 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * breakpoint.c (breakpoint_1): Annotate each field of output. Add - FIXME-32x64 comment. - -Fri Apr 22 16:43:54 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * infrun.c (wait_for_inferior): Move call to flush_cached_frames - to after call to target_wait. This means that flush_cached_frames - can call target_terminal_ours if it wants to. - * infrun.c (wait_for_inferior) [HAVE_NONSTEPPABLE_WATCHPOINT]: Add - comment about why the code is dubious. - - * stabsread.c (read_type): Call read_type, not nonexistent - os9k_read_type. - -Fri Apr 22 14:25:36 1994 Kung Hsu (kung@mexican.cygnus.com) - - * remote-os9k.c (rombug_fetch_registers): set trace mode - correctly. - * remote-os9k.c (rombug_read_inferior_memory): cache data in - buffer. - * os9kread,c (read_os9k_psymtab): process file symbol to truncate - extra info. - * os9kread.c (os9k_read_ofile_symtab): proper casting of args - passed to process_one_symbol. - * stabsread.c (read_type): process os9k functio prototype. - -Fri Apr 22 11:27:39 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * solib.c (symbol_add_stub): If so->textsection is NULL, don't - dump core. - -Thu Apr 21 07:45:49 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * utils.c (prompt_for_continue): Annotate prompt. - (query): Annotate query. - * printcmd.c (print_frame_args): Change syntax of argument - annotation to make name and value part of a single group of - annotations, not two separate groups. - * cp-valprint.c (cp_print_value_fields): Likewise for fields. - * valprint.c (val_print_array_elements): Change syntax of - annotation to be more concise. - * main.c, defs.h (command_line_input): New argument tells what - string to include in the annotations. - * symtab.c (decode_line_2), main.c (read_command_lines, - command_loop): Change callers. - - * breakpoint.c (watch_command): Use (CORE_ADDR)0, not NULL, for - target null pointer. - * blockframe.c (find_frame_addr_in_frame_chain): Likewise. - - * printcmd.c (output_command): Annotate things we print here too. - * printcmd.c (print_command_1): Add "value-history-value" annotation. - * Move declaration of print_value_flags from defs.h to value.h. - * main.c (command_line_input): Call wrap_here as well as gdb_flush. - -Thu Apr 21 09:29:37 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * dbxread.c (read_dbx_dynamic_symtab): Reinstall support for sun3, - BFD handles sun3 dynamic relocations now. - * elfread.c (elf_symtab_read, elf_symfile_read): Handle dynamic - symbol table. - -Wed Apr 20 19:41:21 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * printcmd.c (print_command_1): Annotate the top-level expressions - that we print. - (print_frame_args): Annotate each argument. - * printcmd.c, defs.h (print_value_flags): New function. - * cp-valprint.c (cp_print_value_fields): Annotate each field. - * valprint.c (val_print_array_elements): Annotate each array element. - -Wed Apr 20 13:18:41 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * findvar.c (read_var_value): Handle LOC_REPARM_ADDR case correctly, - the register contains a pointer to the type, not the type itself. - -Mon Apr 11 10:44:35 1994 Jim Kingdon (kingdon@deneb.cygnus.com) - - * main.c (main): Accept --annotate=N option and make --fullname - the same as --annotate=1. - (command_line_input): Print annotatation before and after prompt. - * blockframe.c (flush_cached_frames): Print annotation. - * Rename frame_file_full_name to annotation_level and move it from - symtab.h to defs.h. - * source.c (identify_source_line): If annotation_level > 1, - change output format. - * breakpoint.c: Print annotation whenever a breakpoint changes. - * main.c: New variable server_command. - (command_line_input): Parse "server " and set server_command. - (dont_repeat): Check server_command. - -Wed Apr 20 08:37:16 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * xcoffread.c (xcoff_next_symbol_text): Don't return before - updating raw_symbol and symnum. Return a value in the case where - we complained. - - * dstread.c, coffread.c: Don't define pending_blocks; buildsym.c - takes care of it. - * parse.c: Don't define block_found; it is defined in symtab.c. - * parser-defs.h: Add comment regarding block_found. - -Tue Apr 19 09:46:05 1994 Jeffrey A. Law (law@snake.cs.utah.edu) - - * hppa-tdep.c (internalize_unwind_info): Delete unused indexp - argument. - -Mon Apr 18 13:18:56 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * dbxread.c (read_dbx_dynamic_symtab): Relocate BFD symbols by - section vma. Do not read dynamic relocs for sun3 executables to - avoid BFD assertion message. - -Mon Apr 18 10:08:07 1994 Jeffrey A. Law (law@snake.cs.utah.edu) - - * nm-hppab.h (KERNEL_U_ADDR): Define. - (FIVE_ARG_PTRACE): Likewise. - (CANNOT_STORE_REGISTER): Likewise. - * nm-hppah.h (KERNEL_U_ADDR): Define. - (FIVE_ARG_PTRACE): Likewise. - (CANNOT_STORE_REGISTER): Likewise. - (NEED_TEXT_START_END): Likewise. - - * tm-hppah.h (NEED_TEXT_START_END): Delete definition. - * xm-hppah.h (KERNEL_U_ADDR): Delete definition. - (FIVE_ARG_PTRACE): Likewise. - * xm-hppab.h (KERNEL_U_ADDR): Delete definition. - (FIVE_ARG_PTRACE): Likewise. - - * hppa-tdep.c (read_unwind_info): Make static. - (restore_pc_queue): Indirect through the target vector to - reload the register state. - -Sat Apr 16 22:20:51 1994 Jeffrey A. Law (law@snake.cs.utah.edu) - - * paread.c (compare_unwind_entries): Delete function. It's been - moved into hppa-tdep.c. - (read_unwind_info): Likewise. - (pa_symfile_read): No longer call read_unwind_info. The unwind - tables will be read in as they are needed. - - * hppa-tdep.c (compare_unwind_entries): New function. - (read_unwind_info, internalize_unwinds): Likewise. - (find_unwind_entry): Read in unwind information on demand. - -Fri Apr 15 11:53:46 1994 Stan Shebs (shebs@andros.cygnus.com) - - * source.c (DIRNAME_SEPARATOR): New macro, replaces all references - to : in search path processing. - * defs.h (qsort): Rename argument in prototype. - * symtab.h (SAYMBOL_VALUE): Rename value field, avoids bugs in - some compilers. - * breakpoint.c, exec.c, mdebugread.c, mipsread.c, xcoffexec.c - (false): Eliminate usages. - -Fri Apr 15 11:35:19 1994 Steve Chamberlain (sac@cygnus.com) - - * h8500-tdep.c (initialize_h8500_tdep, large_command): - All references to value changed to value_ptrlage_command is now - called big_command. - All references to value changed to value_ptr. - * remote-e7000.c (e7000_wait): Use target_waitstatus and SETSTOP - * remote-hms.c (hms_wait): Timeout after five seconds. - * ser-go32.c (dosasync_read): Poll if timeout < 0. - * config/tm/tm-h8500.h (BEFORE_MAIN_LOOP_HOOK): Deleted. - * config/sh/tm-sh.h (BREAKPOINT): Is now sleep opcode. - -Thu Apr 14 07:01:56 1994 Jeffrey A. Law (law@snake.cs.utah.edu) - - * procfs.c (procfs_wait): Protect watchpoint code with appropriate - #ifdefs. - (procfs_set_watchpoint, procfs_stopped_by_watchpoint): Likewise. - -Wed Apr 13 14:52:46 1994 Jeffrey A. Law (law@snake.cs.utah.edu) - - * breakpoint.h (enum bptype): Add bp_hardware_watchpoint and - bp_watchpoint_scope breakpoints. - (struct breakpoint): Add val_chain and related_breakpoint fields - for use by watchpoints. - - * breakpoint.c (within_scope): Delete. No longer used. - (TARGET_CAN_USE_HARDWARE_WATCHPOINT): Provide default definition. - (target_{remove,insert}_watchpoint): Likewise. - (can_use_hardware_watchpoint): New function. - (remove_breakpoint): New function to remove a single breakpoint - or hardware watchpoint. - (insert_breakpoints): Handle insertion of hardware watchpoints. - Store a copy of the value chain derived from the watchpoint - expression. - (remove_breakpoints): Simplify by using remove_breakpoint. - (delete_breakpoint): Likewise. - (watchpoint_check): Delete the watchpoint and watchpoint scope - breakpoints when the watchpoint goes out of scope. Save & restore - the current frame after checking watchpoints. - (breakpoint_init_inferior): Likewise (restarting the program - makes all local watchpoints go out of scope). - (bpstat_stop_status): Handle hardware watchpoints much like normal - watchpoints. Delete the watchpoint and watchpoint scope breakpoint - when the watchpoint goes out of scope. Remove and reinsert all - breakpoints before returning if we stopped when a hardware watchpoint - fired. - (watch_command): Use a hardware watchpoint when possible. If - watching a local expression, build a scope breakpoint too. - (map_breakpoint_numbers): Also call given function for any - related breakpoints. - (disable_breakpoint): Never disable a scope breakpoint. - (enable_breakpoint): Handle hardware breakpoints much like normal - breakpoints, but recompute the watchpoint_scope breakpoint's - frame and address (if we have an associated scope breakpoint). - (read_memory_nobpt): Handle hardware watchpoints like normal - watchpoints. When necessary handle watchpoint_scope breakpoints. - (print_it_normal, bpstat_what, breakpoint_1, mention): Likewise. - (clear_command, breakpoint_re_set_one, enable_command): Likewise. - (disable_command): Likewise. - - * blockframe.c (find_frame_addr_in_frame_chain): New function. - Extern prototype added to frame.h - - * infrun.c (wait_for_inferior): Set current_frame and select - a frame before checking if we stopped due to a hardare watchpoint - firing. Handle stepping over hardware watchpoints. - (normal_stop): Remove unnecessary call to select_frame. - - * value.h (value_release_to_mark): Declare. - * values.c (value_release_to_mark): New function. - - * procfs.c (procfs_wait): Add cases for hardware watchpoints. - (procfs_set_watchpoint, procfs_stopped_by_watchpoint): New functions. - - * hppab-nat.c (hppa_set_watchpoint): New function. - - * config/pa/nm-hppab.h (STOPPED_BY_WATCHPOINT): Define. - (HAVE_STEPPABLE_WATCHPOINT): Define. - (TARGET_CAN_USE_HARDWARE_WATCHPOINT): Define. - (target_{insert,delete}_watchpoint): Define. - - * config/mips/nm-irix4.h (TARGET_CAN_USE_HARDWARE_WATCHPOINT): Define. - (STOPPED_BY_WATCHPOINT, HAVE_NONSTEPPABLE_WATCHPOINT): Likewise. - (target_{insert,remove}_watchpoint): Likewise. - -Mon Apr 11 19:21:27 1994 Stu Grossman (grossman at cygnus.com) - - * xcoffread.c (read_xcoff_symtab): Ignore symbols of class C_EXT, - smtyp XTY_LD, sclass XMC_DS (external data segment label). They - often have the same names as debug symbols for functions, and - confuse lookup_symbol(). - -Mon Apr 11 10:44:35 1994 Jim Kingdon (kingdon@deneb.cygnus.com) - - * remote.c: Around redefinition of PBUFSIZE, adjust whitespace. - * config/pa/tm-hppa.h (REGISTER_BYTES): Use 4 rather than - REGISTER_RAW_SIZE (1). - Together these changes work around a bug in HP's compiler. Both - seem to be necessary. - -Mon Apr 11 09:18:24 1994 Jeffrey A. Law (law@snake.cs.utah.edu) - - * paread.c (pa_symtab_read): Handle ST_STUB symbols and symbols - with scope SS_EXTERNAL. ST_ENTRY symbols in dynamic executables - are type mst_solib_trampoline. - -Fri Apr 8 17:14:37 1994 Jim Kingdon (kingdon@deneb.cygnus.com) - - * config/m68k/es1800.mt: Change comments. - -Fri Apr 8 17:14:37 1994 Rob Savoye (rob@darkstar.cygnus.com) - - * config/m68k/monitor.mt (TDEPFILES): Don't include remote-es.o. - -Fri Apr 8 15:35:30 1994 Stu Grossman (grossman at cygnus.com) - - * lynx-nat.c: Restore regmap structure for SPARC. It's needed - for core files. - -Fri Apr 8 14:53:35 1994 Jim Kingdon (kingdon@deneb.cygnus.com) - - * values.c (unpack_long): Remove obsolete comment about using a - switch statement. - - * symfile.c (symbol_file_command): Add comments about command syntax. - -Thu Apr 7 17:25:21 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - Jim Kingdon (kingdon@cygnus.com) - - * infrun.c (IN_SOLIB_TRAMPOLINE): Correct comment, trampolines - are in the .plt section. - * minsyms.c (lookup_solib_trampoline_symbol_by_pc, - find_solib_trampoline_target): New functions for handling - stepping into -g compiled shared libraries. - * symtab.h (lookup_solib_trampoline_symbol_by_pc, - find_solib_trampoline_target): Add prototypes. - * config/tm-sunos.h (IN_SOLIB_TRAMPOLINE, SKIP_TRAMPOLINE_CODE): - Define to handle stepping into -g compiled shared libraries. - * config/tm-sysv4.h (SKIP_TRAMPOLINE_CODE): Define to handle - stepping into -g compiled shared libraries. - -Thu Apr 7 17:22:54 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * configure.in: Add mips-*-sysv4* support. - * config/mips/mipsv4.mh, config/mips/mipsv4.mt, - config/mips/tm-mipsv4.h, config/mips/xm-mipsv4.h, mipsv4-nat.c: - New files for MIPS SVR4 support. - * Makefile.in: Update for new mipsv4 files. - * alpha-tdep.c (heuristic_proc_desc, find_proc_desc): Use - read_next_frame_reg to obtain the frame relative stack pointer. - * mips-tdep.c (heuristic_proc_desc): Use read_next_frame_reg to - obtain the frame relative stack pointer. - * mdebugread.c (parse_partial_symbols, psymtab_to_symtab1): - Handle stStatic and stStaticProc symbols in stabs-in-ecoff output - by entering them into the minimal symbol table. - * printcmd.c (print_scalar_formatted): Do not try to unpack to - a long for float formats. - * solib.c: Include "elf/mips.h" only if DT_MIPS_RLD_MAP does not - get defined in . - * solib.c (solib_add): Add shared library sections to the section - table of the target before adding the symbols. - * partial-stab.h: Relocate static and global functions. - * dbxread.c (read_dbx_symtab): Remove unused variable - end_of_text_address. Relocate text_addr when passing it - to end_psymtab. - - For Alpha OSF/1 targets, enable gdb to set breakpoints in shared - library functions before the executable is run. Retrieve dynamic - symbols from stripped executables. - * mipsread.c (read_alphacoff_dynamic_symtab): New function. - * mipsread.c (mipscoff_symfile_read): Use it. Issue warning message - if no debugging symbols were found. - * alpha-tdep.c (alpha_skip_prologue): Silently return the unaltered - pc if memory at the pc is not accessible and GDB_TARGET_HAS_SHARED_LIBS - is defined. - * config/alpha/nm-alpha.h (GDB_TARGET_HAS_SHARED_LIBS): Define, - OSF/1 has shared libraries. - -Thu Apr 7 15:11:11 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * dbxread.c (read_dbx_dynamic_symtab): Adjust for recent changes - to BFD handling of dynamic symbols. - -Tue Apr 5 15:29:25 1994 Jeffrey A. Law (law@snake.cs.utah.edu) - - * hppa-tdep.c (hppa_fix_call_dummy): If FUN is a procedure label, - then gets its real address into FUN and its GOT/DP value into %r19. - - * tm-hppa.h (CALL_DUMMY): Use %r20, not %r19 as a temporary. - - * hppa-tdep.c (frameless_function_invocation): If no unwind - descriptor was found, then assume this was not a frameless - function invocation. - (frame_saved_pc): If the saved PC is in a linker stub, then - return the return address which the linker stub will return to. - - * xm-hppab.h: Never define USG. - * xm-hppah.h: Always define USG. - -Tue Apr 5 12:58:47 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * values.c (unpack_long, value_from_longest), - valarith.c (value_binop): Allow TYPE_CODE_RANGE. - -Fri Apr 1 14:04:34 1994 Jason Merrill (jason@deneb.cygnus.com) - - * symfile.c (deduce_language_from_filename): .cpp is a C++ extension. - -Fri Apr 1 00:44:00 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - For SVR4 targets, enable gdb to set breakpoints in shared - library functions before the executable is run. - * elfread.c (elf_symtab_read): Handle symbols for shared library - functions. - * sparc-tdep.c (in_solib_trampoline): Renamed to in_plt_section - and moved to objfiles.c. - * objfiles.c (in_plt_section): Moved to here from sparc-tdep. - * config/tm-sysv4.h (IN_SOLIB_TRAMPOLINE): Use new in_plt_section. - * config/sparc/tm-sun4sol2.h (IN_SOLIB_TRAMPOLINE): Removed, - the new generic definition from tm-sysv4.h works for Solaris. - -Wed Mar 30 16:14:27 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * elfread.c (elf_symtab_read): Change storage_needed, - number_of_symbols and i to long. Rename get_symtab_upper_bound to - bfd_get_symtab_upper_bound. Check for errors from - bfd_get_symtab_upper_bound and bfd_canonicalize_symtab. - * nlmread.c (nlm_symtab_read): Same changes. - -Wed Mar 30 11:43:29 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * xcoffread.c (xcoff_next_symbol_text): New function. - (read_xcoff_symtab): Set next_symbol_text_func to it. - Move raw_symbol outside of read_xcoff_symtab. - - * remote.c (getpkt): Remove unused "out" label. - -Wed Mar 30 09:15:42 1994 Jeffrey A. Law (law@snake.cs.utah.edu) - - * breakpoint.c (print_it_normal): Allow GDB to notify the user - about more than one watchpoint being triggered. - -Wed Mar 30 08:24:18 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config/m68k/tm-dpx2.h: Include tm-m68k.h not nonexistent tm-68k.h. - -Wed Mar 30 00:31:49 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * blockframe.c (find_pc_partial_function): mst_file_text - symbols do not live in the shared library transfer table. - * ch-exp.y (decode_integer_value, match_character_literal, - match_bitstring_literal): Guard tolower calls with isupper, - tolower on old BSD systems blindly subtracts a constant. - * dbxread.c (read_ofile_symtab): Check for __gnu_compiled_* as - well when determining the producer of the object file. - * mdebugread.c (has_opaque_xref): New function to check for - cross reference to an opaque aggregate. - * mdebugread.c (parse_symbol, parse_partial_symbols): Do not - enter typedefs to opaque aggregates into the symbol tables. - * mdebugread.c (parse_external): Remove skip_procedures argument, - it has always been 1. Remove code that handled stProc symbols, - it was never executed and was wrong, as the index of a - stProc symbol points to the local symbol table and not to the - auxiliary symbol info. Update caller. - * mdebugread.c (parse_partial_symbols): Do not enter external - stProc symbols into the partial symbol table, they are already - entered into the minimal symbol table. - * config/i386/tm-symmetry.h: Clean up, it is now only used for Dynix. - Remove all conditionals and definitions for ptx. - I386_REGNO_TO_SYMMETRY moved to here from symm-tdep.c. - Fix addresses of floating point registers in REGISTER_U_ADDR. - STORE_STRUCT_RETURN now handles cc and gcc conventions. - FRAME_CHAIN, FRAMELESS_FUNCTION_INVOCATION, FRAME_SAVED_PC, - IN_SIGTRAMP, SIGCONTEXT_PC_OFFSET defined to make backtracing through - signal trampoline code work. - * config/i386/xm-symmetry.h: Clean up, it is now only used for Dynix. - Remove all conditionals and definitions for ptx. - Remove KDB definitions. - * symm-nat.c (store_inferior_registers): Fetch registers before - storing them to obtain valid floating point control registers. - Store fpu registers. - * symm-nat.c (print_1167_control_word): Dynix 3.1.1 defines - FPA_PCR_CC_C0 and FPA_PCR_CC_C1, avoid duplicate case value. - * symm-nat.c (fetch_inferior_registers, child_xfer_memory): - Fix typos. - * symm-nat.c (child_resume): Update type of `signal' parameter. - * symm-tdep.c (I386_REGNO_TO_SYMMETRY): Moved to tm-symmetry.h. - -Tue Mar 29 23:01:33 1994 Jeffrey A. Law (law@snake.cs.utah.edu) - - * hppa-tdep.c (hppa_fix_call_dummy): Use an alternate method for - calling import stubs for functions in shared libraries. - -Tue Mar 29 21:14:04 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * ch-exp.y: Implement SIZE(mode_name) and SIZE(expression). - - * ch-lang.c (chill_is_varying_struct): Magic string is - was "" is now "__var_length" (more portable). - -Tue Mar 29 19:41:34 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * remote.c (getpkt): If we get a timeout, actually retry rather - than just giving up the first time it happens. - * remote.c: Document sequence numbers. - (remote_store_registers): Change syntax of 'P' request so that it - never looks like a sequence number. - -Tue Mar 29 16:06:01 1994 Kung Hsu (kung@mexican.cygnus.com) - - * os9kread.c (record_minimal_symbol): add section_offset to - relocate minimal symbol table. - * os9kread.c (read_minimal_symbols): ditto. - * os9kread.c (os9k_symfile_init): increase size of dbg and stb - file names. - * os9kread.c (read_os9k_psymtab): if there's no dbg file, just - return. Also if file addr is 0 leave it 0, not to relocate. - * remote-os9k.c (_initialize_remote_os9k): add 'set remotexon', - 'set remotexoff' and 'set remotelog' commands. - -Tue Mar 29 12:38:45 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * remote.c (remote_store_registers): Add 'P' request to set an - individual register. - (remote_write_bytes, remote_read_bytes): Use %lx, not %x, to print - a target address. - -Sat Mar 26 07:05:18 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config/sparc/tm-sparc.h: Define USE_REGISTER_NOT_ARG. - * stabsread (define_symbol): If USE_REGISTER_NOT_ARG, go back to - combining all 'p' and 'r' pairs into a LOC_REGPARM. - - * command.c (do_setshow_command, case var_string): Never add a - space to the end of the string. - * NEWS: Document this change. - * .gdbinit: Add a space to the "set prompt" command. - -Fri Mar 25 12:40:41 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * m3-nat.c, i386m3-nat.c, config/i386/i386m3.mh: Many minor - changes to make it compile (it doesn't link yet). - - * buildsym.c (start_subfile, patch_subfile_names), demangle.c - (set_demangling_style, set_demangling_command): Use savestring not - strdup. We were not dealing properly with a NULL return from - strdup, and were not declaring strdup (the system header may or - may not have it). - - * valprint.c (val_print): Remove inaccurate comment about what - types can be stub types. - - * config/i386/ptx.mh (XDEPFILES): Add coredep.o. Delete infptrace.o. - * symm-nat.c (child_wait, _initialize_symm_nat, kill_inferior): - Supply alternate version if ATTACH_DETACH is not defined. - * ptx4-nat.c, config/i386/{nm-ptx4.h, ptx4.mh, ptx.mt, ptx4.mt, - tm-ptx.h, tm-ptx4.h, xm-ptx.h, xm-ptx4.h}: New files. - * configure.in: Recognize i[34]86-sequent-sysv4* host. - -Fri Mar 25 10:14:03 1994 Jeffrey A. Law (law@snake.cs.utah.edu) - - * hppa-tdep.c (skip_prologue): Do nothing if not at the beginning - of a function. - (skip_trampoline_code): Rewrite and add support for argument - relocation stubs stubs, import/export stubs, calls through - "_sr4export" and cascaded trampolines. - - * hppa-tdep.c (skip_prologue): Return "pc" not zero - if no unwind descriptor is found. - - * tm-hppa.h (NUM_REGS): Bump to 128 registers. - (REGISTER_NAMES): Add entries for "right-half" of FP registers. - (REGISTER_RAW_SIZE, MAX_REGISTER_RAW_SIZE): Do not treat FP regs - differently. All registers are four bytes. - (REGISTER_BYTES, REGISTER_BYTE): Simplify now that all registers are - the same size. - (REGISTER_VIRTUAL_TYPE): Use builtin_type_float for all FP regs. - - * hppa-tdep.c (pa_print_fp_reg): Update to print even numbered FP - registers as both single and double values (fetching 2nd 32bit half - as necessary). Annotate each register printed with its precision. - - * paread.c (read_unwind_info): Fix off-by-one error. - -Fri Mar 25 08:33:28 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * main.c (complete_command): Deal with it if arg is NULL. - -Thu Mar 24 07:12:09 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config/mips/tm-mips.h (SETUP_ARBITRARY_FRAME): Revise comment - regarding using the PC--using the PC is necessary and all the - FIXME comments in the world won't make it go away. - - * valops.c (value_at, value_at_lazy): Give error if we dereference - a pointer to void. - * gdbtypes.h: Fix comments regarding TYPE_CODE_VOID. - * stabsread.c: Use 1, not 0, for TYPE_LENGTH of void types. - - * stabsread.c (patch_block_stabs): Add comment about what happens - if the definition is in another compilation unit from the stab. - - * dbxread.c (end_psymtab): Add comment about empty psymtabs. - -Wed Mar 23 07:50:33 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * main.c (complete_command): New command, from Rick Sladkey - . - (symbol_completion_function): Don't declare rl_point and - rl_line_buffer; they are now declared in readline.h. - (show_commands): Don't declare history_base; it is declared in - history.h. - * command.c (lookup_cmd): Don't delete trailing whitespace. - Reverts change of 14 May 1989. - -Wed Mar 23 16:14:52 1994 Stu Grossman (grossman at cygnus.com) - - * minsyms.c (prim_record_minimal_symbol): Move section deduction - code from prim_record_minimal_symbol_and_info() to here. Callers - of the latter can legitimately supply a section number of -1. - -Wed Mar 23 07:50:33 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * gdbtypes.h, gdbtypes.c: Add comments regarding whether static - member functions have an element in args for a (nonexistent) this - pointer. - -Tue Mar 22 20:12:53 1994 Jeffrey A. Law (law@snake.cs.utah.edu) - - * config/pa/tm-hppao.h (NO_PC_SPACE_QUEUE_RESTORE): Define. - - * hppa-tdep.c (hppa_pop_frame): Do not restore the PC space - queue if NO_PC_SPACE_QUEUE_RESTORE is defined. - - * stabsread.c (REG_STRUCT_HAS_ADDR): Accept additional argument - for the structure's type. All callers changed. - - * valops.c (call_function_by_hand): Check REG_STRUCT_HAS_ADDR - for each structure argument rather than assuming it's either - true or false for all structure arguments. - - * config/pa/tm-hppa.h (REG_STRUCT_HAS_ADDR): Depend only - on the length structure passed, not the compiler used. - - * config/sparc/tm-sparc.h (REG_STRUCT_HAS_ADDR): Accept additional - argument for the structure's type. - -Tue Mar 22 15:28:33 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * values.c (set_internalvar): Don't set var->value until we are - sure there won't be an error(). - - * remote.c (get_offsets): Reinstate comment which was in - remote_wait about use of SECT_OFF_TEXT and so on. - -Mon Mar 21 13:11:30 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * symmisc.c (maintenance_check_symtabs): New function to check - consistency of psymtabs and symtabs. - * symtab.h (maintenance_check_symtabs): Add prototype. - * maint.c: Add new `maint check-symtabs' command. - * config/i386/tm-i386aix.h, config/i386/tm-sun386.h, - config/i386/tm-symmetry.h (REGISTER_CONVERT_TO_RAW): Fix typo. - * config/i386/tm-symmetry.h: Make comment inside #if 0 a real - comment. - * config/i386/tm-symmetry.h (STORE_STRUCT_RETURN): Cast argument - to write_memory to avoid warnings from gcc. - * config/i386/xm-symmetry.h: Add missing #endif. - * config/i386/nm-symmetry.h (NO_PTRACE_H): Add for Dynix. - * config/i386/symmetry.mt (TDEPFILES): Add i386-tdep.o. - * config/i386/symmetry.mh (NAT_FILE, NATDEPFILES): Add. - -Mon Mar 21 11:50:28 1994 Jeffrey A. Law (law@snake.cs.utah.edu) - - * hppa-tdep.c (hppa_fix_call_dummy): Use value_ptr. - (hppa_push_arguments): Likewise. - -Mon Mar 21 11:02:51 1994 Stu Grossman (grossman at cygnus.com) - - * alpha-tdep.c: Gobs of changes (many imported from mips-tdep) to - improve remote debugging efficiency. Also fixed problems with - doing function calls for programs with no entry points. - * infcmd.c (run_stack_dummy): Use CALL_DUMMY_ADDRESS instead of - entry_point_address. - * inferior.h (PC_IN_CALL_DUMMY): ditto. - * mdebugread.c (parse_symbol, parse_procedure, parse_external, - parse_lines): Pass section_offsets info to these routines so that - we can relocate symbol table entries upon readin. - * (psymtab_to_symtab_1): Set symtab->primary to tell - objfile_relocate to do relocations for our symbols. - * (ecoff_relocate_efi): New routine to relocate adr field of PDRs - (which hang off of the symbol table). - * Use prim_record_minimal_symbols_and_info instead of - prim_record_minimal_symbols to supply section info to make minimal - symbol relocations work. - * minsyms.c (prim_record_minimal_symbols_and_info): If section is - -1, try to deduce it from ms_type. - * objfiles.c (objfile_relocate): Use ALL_OBJFILE_SYMTABS where - appropriate. Handle relocation of MIPS_EFI symbols special. Also, - add code to relocate objfile->sections data structure. - * remote.c (get_offsets): Use new protocol message to acquire - section offsets from the target. - * (remote_wait): Get rid of relocation stuff. That's all handled - by objfile_relocate now. - * config/alpha/alpha-nw.mt (TM_FILE): Use tm-alphanw.h. - * config/alpha/tm-alpha.h: Define CALL_DUMMY_ADDRESS, and - VM_MIN_ADDRESS. - * config/alpha/tm-alphanw.h: DECR_PC_AFTER_BREAK=0, VM_MIN_ADDRESS=0. - -Mon Mar 21 10:09:06 1994 Jeff Law (law@snake.cs.utah.edu) - - * hpread.c (_initialize_hpuxread): Don't call add_symtab_fns if - HPREAD is not defined. - -Sun Mar 20 15:21:57 1994 Doug Evans (dje@cygnus.com) - - * sparc-tdep.c (sparc_frame_find_save_regs): Use REGISTER_RAW_SIZE - instead of 4. - * sp64-tdep.c (target_ptr_bit, set_target_ptr_bit): Deleted, - can no longer set this at run time. - * config/sparc/sp64.mt (SIMFILES): Use remote-sim.o now. - (TM_CLIBS): Define to -lm, the simulator uses the sqrt() function. - * config/sparc/tm-sp64.h (FPS_REGNUM, CPS_REGNUM): Define (so - sparc-tdep.c compiles). - (TARGET_PTR_BIT): Must be a constant now, fix at 64. - -Sat Mar 19 08:51:12 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config/m68k/{cisco.mt,tm-cisco.h}: New files. - * Makefile.in (ALLPARAM, ALLCONFIG): Add them. - * configure.in: Recognize m68*-cisco*-*. - - * Makefile.in (TAGS): Use variables directly, rather than using - find, to locate TM_FILE, XM_FILE, and NAT_FILE. This is faster - and means that these filenames no longer need be unique across all - the config/* directories. - * configure.in: Put the config/*/ into TM_FILE, etc. - - * m68k-stub.c (computeSignal): Return SIGFPE, not SIGURG, for chk - and trapv exceptions. - - * target.h (struct section_table), objfiles.h (struct obj_section): - Change name of field sec_ptr to the_bfd_section. More mnemonic - and avoids the (sort of, for the ptx compiler) name clash with - the name of the typedef. - * exec.c, xcoffexec.c, sparc-tdep.c, rs6000-nat.c, osfsolib.c, - solib.c, irix5-nat.c, objfiles.c, remote.c: Change users. - - * utils.c: Include readline.h. - * Makefile.in (utils.o): Add dependency. - - * remote.c (getpkt): Add support for run-length encoding. - -Fri Mar 18 19:11:15 1994 Steve Chamberlain (sac@jonny.cygnus.com) - - * utils.c (prompt_for_continue): Call readline, not gdb_readline. - -Fri Mar 18 10:25:55 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * dstread.c (record_minimal_symbol): New arg objfile. Pass it to - prim_record_minimal_symbol. - Callers: Pass it. - - * regex.c (EXTEND_BUFFER): Adjust pointers within buffer by - computing their offset from the start of the old buffer and adding - to the new buffer, rather than by assuming we can add the - difference between the old buffer and the new buffer (it might not - fit in an int). Merge in cosmetic differences from emacs regex.c - version of this macro. - -Wed Mar 16 15:28:54 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * Makefile.in (install-only): Fix use of program_transform_name. - -Wed Mar 16 07:18:43 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * printcmd.c: Remove "set print fast-symbolic-addr off" command. - The bug which it worked around was fixed on 25 Feb 94 in coffread.c, - so I'm nuking the command. - * symtab.c (find_addr_symbol): Comment out, no longer used. - - * main.c (main): Don't init_source_path for the -cd argument. Now - that source_path doesn't contain the current_directory from when - GDB started up, init_source_path is no longer useful (and is - harmful because it clobbers a source_path set in $HOME/.gdbinit). - - * TODO: Remove item about line numbers being off. It is useless - and confusing without a reproducible test case (it mentions - proceed(), but I was able to step through proceed without trouble). - -Tue Mar 15 13:39:23 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - For Sunos 4.x targets, enable gdb to set breakpoints in shared - library functions before the executable is run. Retrieve dynamic - symbols from stripped executables. - * symtab.h (minimal_symbol_type): Add mst_solib_trampoline type. - * parse.c (write_exp_msymbol), symmisc.c (dump_msymbols), - symtab.c (list_symbols): Handle mst_solib_trampoline. - * minsyms.c (lookup_minimal_symbol): Handle mst_solib_trampoline - for all targets, remove IBM6000_TARGET dependencies. - * dbxread.c (read_dbx_dynamic_symtab): New function. - * dbxread.c (dbx_symfile_read): Use it. - * dbxread.c (SET_NAMESTRING): Set namestring to - "" instead of "foo" if the string index is - corrupt. - * xcoffread.c (read_xcoff_symtab): Use mst_solib_trampoline instead - of mst_unknown. - * symtab.c (list_symbols): Take from_tty as parameter and pass it - to break_command. Handle mst_file_* minimal symbol types. - * config/i386/tm-i386bsd.h: Give just macro name, not args, to #undef. - -Tue Mar 15 11:40:43 1994 Kung Hsu (kung@mexican.cygnus.com) - - * c-exp.y(yylex): fix potential memory overflow. - -Tue Mar 15 10:33:28 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * environ.c (set_in_environ): Eliminate special handling of PATH and - GNUTARGET. - * putenv.c: Removed, conflicts with system declaration of - putenv on RS/6000 running AIX 3.2.5, and above change makes it - unnecessary. - * Makefile.in: Change accordingly. - * procfs.c (procfs_create_inferior): Change comment accordingly. - -Tue Mar 15 10:05:27 1994 Jim Kingdon (kingdon@cygnus.com) - - * rs6000-tdep.c: Change value to value_ptr. - -Sun Mar 13 17:19:03 1994 Jeff Law (law@snake.cs.utah.edu) - - * hpread.c (read_hpux_symtab: Correctly determine the namespace - and address class of SVAR, DVAR, TYPEDEF, TAGDEF, CONST, and - MEMENUM symbols. Do not include function-scoped variables in - the partial symbol table. - -Sun Mar 13 09:45:51 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * i386m3-nat.c: Include floatformat.h. - (get_i387_state): Use memset not bzero. - - * Version 4.12.3. - - * Makefile.in: Enable commented out getopt_h, bfd_h, etc. Change - ieee-float.h to floatformat.h. - - * valprint.c (val_print_string): Ignore error if the error - happened after a terminating '\0'. - - * c-valprint.c (c_val_print): Never add 1 to return value from - val_print_string; just return what it returns. - - * target.h (enum target_signal): Add TARGET_SIGNAL_FIRST, for - looping through all of the enums. - * infrun.c (signals_info): Use it. - -Fri Mar 11 08:08:50 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * main.c (main): When printing warning about bad baud rate, don't - use warning(); it relies on current_target which isn't set up yet. - - * breakpoint.c (_initialize_breakpoint): Update docstring for - tbreak to match what the code actually does. Don't mention tbreak - in docstrings for "enable once" or "enable breakpoints once". - -Thu Mar 10 08:52:38 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * symfile.h (ADD_PSYMBOL_VT_TO_LIST): Don't put a semicolon after - while (0). That defeats the whole purpose of using do . . . while (0). - * mdebugread.c (parse_partial_symbols): Don't use ?: expression as - list for ADD_PSYMBOL_TO_LIST; the macro takes its address and - using a ?: expression as an lvalue is not portable. - - * stabsread.c (define_symbol): If REG_STRUCT_HAS_ADDR, also - convert a LOC_ARG to a LOC_REF_ARG. Update code which combines - 'p' and 'r' symbol descriptors into a single symbol to look for a - LOC_REF_ARG. - * README, config/sparc/tm-sparc.h: Update comments. - -Wed Mar 9 21:43:24 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * mdebugread.c (parse_type): Do not complain for types with - an `indexNil' aux index, these are simply undefined types. - Remove indexNil check from caller of parse_type. - * mdebugread.c (parse_partial_symbols): Do not enter - stGlobal, scCommon symbols into the minimal symbol table, their - value is the size of the common, not its address. - Handle scInit, scFini, scPData and scXData sections. - Use minimal symbol type mst_file_* for stLabel symbols, instead of - mst_*. - Enter stProc symbols into the global_psymbols list once, not into - the static_psymbols_list. - Get rid of dummy psymtab if it is empty, to allow proper detection - of stripped executables. - * mdebugread.c (cross_ref): Allow cross references to Fortran - common blocks. - -Wed Mar 9 15:23:19 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * stabsread.c (common_block_end, fix_common_block): Stash the - struct pending * in the SYMBOL_TYPE, not the SYMBOL_NAMESPACE, so - as to not assume that a pointer fits in an enum. - -Wed Mar 9 18:56:36 1994 Kung Hsu (kung@mexican.cygnus.com) - - * os9kread.c (fill_sym): check compiler verion number for pre- - UltraC compiler. - * os9kread.c (os9k_process_one_symbol): address of symbol is - relative to section not module. - * stabsread.c (define_symbol): add symbol type 's' as local - symbol for os9k. - * remote-os9k.c: add command 'set monitor_log' to turn on or off - monitor logging. - * remote-os9k.c: fix bug in delete breakpoint, single step trace. - * remote-os9k.c: fix bug in 'set remotebaud' function. - * remote-os9k.c (rombug_link): minimize checking so to improve - speed. - * symfile.c (symbol_file_command): check if failed to link, also make - the command be able to accept more than one filenames. - * target.c (target_link): check if failed to link with rombug. - * config/i386/tm-i386os9k.h : add #define DECR_PC_AFTER_BREAK 0. - -Wed Mar 9 15:23:19 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * remote-es.c (es1800_child_ops): Don't declare it static. - -Tue Mar 8 11:42:39 1994 Jim Kingdon (kingdon@cygnus.com) - - * config/i386/tm-i386v4.h: Give just macro name, not args, to #undef. - -Tue Mar 8 06:56:13 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * dbxread.c: New variable lowest_text_address. - (record_minimal_symbol, read_dbx_symtab): Set it. - (read_dbx_symtab): Use lowest_text_address + text_size instead of - end_of_text_address. - * config/gould/tm-pn.h: Add comment regarding END_OF_TEXT_DEFAULT. - - * dbxread.c (end_psymtab): Remove old and commented out - capping_global and capping_static. Fix comments regarding - N_SO_ADDRESS_MAYBE_MISSING to match the real name of the macro. - - * parser-defs.h: Add "extern" to start of variable declarations so - we don't end up with commons. - * parse.c: Define these variables. - - * irix5-nat.c (find_solib): Cast o_path to CORE_ADDR when using it - as one. - -Mon Mar 7 13:00:50 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * alpha-tdep.c: Change value to value_ptr. - -Sun Mar 6 17:36:53 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * solib.c (elf_locate_base): New function to locate the address - of the dynamic linker's runtime structure in the dynamic info section. - * solib.c (locate_base): Use it instead of iterating over the list - of mapped address segments. - * solib.c (look_for_base, bfd_lookup_symbol): Removed, no longer - necessary. - -Fri Mar 4 09:50:47 1994 Jeffrey A. Law (law@snake.cs.utah.edu) - - * hppa-tdep.c (pc_in_linker_stub): Move decl to beginning of file. - (pc_in_interrupt_handler): New function. Also add PARAM decl. - (find_proc_framesize): Deal with HPUX setting SAVE_SP bit for - signal trampoline and interrupt routines. - (frame_saved_pc): Handle signal trampolines and interrupt routines. - (frame_chain, frame_chain_valid): Likewise. - (hppa_frame_find_saved_regs): Likewise. Also deal with special - saved regs convention for SP. - - * tm-hppa[bho].h: FRAME_FIND_SAVED_PC_IN_SIGTRAMP): Define. - (FRAME_BASE_BEFORE_SIGTRAMP): Define. - (FRAME_FIND_SAVED_REGS_IN_SIGTRAMP): Define. - - * tm-hppah.h (IN_SIGTRAMP): Define. - -Thu Mar 3 12:41:16 1994 Jim Kingdon (kingdon@deneb.cygnus.com) - - * ch-exp.y (match_simple_name_string): Accept '_' as well as an - alphabetic character as the start of a name. - - * sparclite/Makefile.in (all install): Build and install aload. - - * configure.in: Accept i[34]86-*-*sysv32 because that is what - config.guess and config.sub produce. - - * mips-tdep.c: Change value to value_ptr. - -Wed Mar 2 09:17:55 1994 Jim Kingdon (kingdon@deneb.cygnus.com) - - * breakpoint.c, breakpoint.h, c-valprint.c, ch-valprint.c, - cp-valprint.c, eval.c, expprint.c, findvar.c, language.c, - objfiles.h, infcmd.c, printcmd.c, stack.c, typeprint.c, - valarith.c, valops.c, valprint.c, value.h, values.c: Replace - value with value_ptr. This is for the ptx compiler. - * objfiles.h, target.h: Don't declare a "sec_ptr" field using a - "sec_ptr" typedef. - * symm-nat.c: Add a bunch of stuff for symmetry's ptrace stuff. - #if 0 i386_float_info. - * symm-tdep.c (round): Remove. Also remove sgttyb. - * symm-tdep.c: Remove lots of stuff which duplicates stuff from - i386-tdep.c. Remove register_addr and ptx_coff_regno_to_gdb. - * i386-tdep.c (i386_frame_find_saved_regs): Put in - I386_REGNO_TO_SYMMETRY check in case it is needed for Dynix - someday. - * config/i386/nm-symmetry.h: Change KERNEL_U_ADDR. Move - stuff from PTRACE_READ_REGS, PTRACE_WRITE_REGS macros to - symm-nat.c. Define CHILD_WAIT and declare child_wait(). - * config/i386/tm-symmetry.h: Remove call function stuff; stuff in - tm-i386v.h is apparently OK. - * config/i386/xm-symmetry.h [_SEQUENT_]: Define HAVE_TERMIOS not - HAVE_TERMIO. Define MEM_FNS_DECLARED, NEED_POSIX_SETPGID, and - USE_O_NOCTTY. - -Wed Mar 2 11:31:08 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * osfsolib.c (xfer_link_map_member): Update to use new - target_read_string interface. - -Wed Mar 2 09:17:55 1994 Jim Kingdon (kingdon@deneb.cygnus.com) - - * infrun.c (wait_for_inferior): In checking - remove_breakpoints_on_following_step, check - through_sigtramp_breakpoint as well as step_resume_breakpoint. - -Tue Mar 1 16:22:56 1994 Jim Kingdon (kingdon@deneb.cygnus.com) - - * os9kread.c (os9k_process_one_symbol): Rename - VARIABLES_INSIDE_BLOCK to OS9K_VARIABLES_INSIDE_BLOCK. - * symfile.c (symbol_file_command): Check for (CORE_ADDR)-1, not - (CORE_ADDR)0, from target_link, since that is what it uses. - Process name at end, not during parsing (like we did before Kung's - change), so that -readnow and -mapped can appear anywhere. - Make text_relocation a local variable. - * config/i386/i386os9k.mt: Fix comment. - * Makefile.in (ALLDEPFILES): Add remote-os9k.c. - * os9kread.c: Put "comments" after #endif inside /* */. - * stabsread.h: Add os9k_stabs variable. - * stabsread.c (start_stabs), os9kread.c (os9k_process_one_symbol): - Set it. - * stabsread.c (define_symbol): If os9k_stabs, put a 'V' symbol - descriptor in global_symbols not local_symbols. - (read_type): If os9k_stabs, accept 'c', 'i', and 'b' type - descriptors. - (read_type): If os9k_stabs, accept function parameters after 'f' - type descriptor. - (read_array_type): If os9k_stabs, don't expect index type and - expect lower and upper to be separated by ',' not ';'. - (read_enum_type): If os9k_stabs, read a number before the first - enumeration constant. - (os9k_init_type_vector): New function. - (dbx_lookup_type): Call it when starting new type vector. - * config/i386/tm-i386os9k.h: Define BELIEVE_PCC_PROMOTION. - * (os9k_process_one_symbol): Call define_symbol not os9k_define_symbol. - * os9kstab.c: Removed. - * Makefile.in: Update accordingly. - * objfiles.c (objfile_relocate_data): Removed. - * remote-os9k.c (rombug_wait): Call objfile_relocate - not objfile_relocate_data. - * objfiles.h, objfiles.c: Remove find_pc_objfile. - * remote-os9k.c (rombug_wait): Call find_pc_section not - find_pc_objfile. - * main.c (quit_command): Check inferior_pid; revert Kung change. - * remote-os9k.c (rombug_create_inferior): Set inferior_pid. - -Tue Mar 1 14:56:14 1994 Kung Hsu (kung@mexican.cygnus.com) - - * os9kread.c: New file to read os9000 style symbo table. - * os9kstab.c: new file to read os9000 style stabs. - * remote-os9k.c: remote protocol talking to os9000 rombug monitor. - * objfiles.c (find_pc_objfile): new function to search objfile - from pc. - * objfiles.c (objfile_relocate_data): new function to relocate - data symbols in symbol table. - * objfiles.h: Add two aux fields in struct objfile to handle - multiple symbol table files situation like in os9000. - * symfile.c: Change so 'symbol-file' command can handle multiple - files. Also call target_link() to get relocation infos. - * target.c (target_link): new function to get relocation info when - a symbol file is requested to load. - * main.c (quit_command): take out 'inferior_pid != 0' condition, - because in cross mode there's no inferior pid, bit they need to - be detached. - Makefile.in: add os9kread.c os9kstab.c and .o's. - configure.in: add i386os9k target. - config/i386/i386os9k.mt: new add. - config/i386/tm-i386os9k.h: new add. - -Tue Mar 1 13:16:10 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * config/sparc/tm-sun4sol2.h (IN_SIGTRAMP): Handle ucbsigvechandler. - * sparc-tdep.c (sparc_frame_saved_pc): Handle ucbsigvechandler. - -Tue Mar 1 11:54:11 1994 Jim Kingdon (kingdon@deneb.cygnus.com) - - * target.c, target.h (target_read_string): Provide error detection to - caller. Put string in malloc'd space, so caller need not impose - arbitrary limits. - * solib.c (find_solib): Update to use new interface. - * irix5-nat.c (find_solib): Read o_path from inferior - (clear_solib): Free storage for o_path. - * valprint.c (val_print_string): Add comments. - -Mon Feb 28 23:54:39 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * symtab.c (decode_line_1): Handle the case when skip_quoted does not - advance `p'. - -Mon Feb 28 12:40:46 1994 Jim Kingdon (kingdon@deneb.cygnus.com) - - * value.h (struct value): Add modifiable field. - * values.c (allocate_value, record_latest_value, value_copy): Set it. - (record_latest_value): Don't mess with VALUE_LVAL of value. - * valops.c (value_assign): Check it. Reword existing error - message on not_lval. - - * mips-tdep.c (mips_step_skips_delay), config/mips/tm-mips.h - (STEP_SKIPS_DELAY): Added. - * infrun.c (proceed) [STEP_SKIPS_DELAY]: Check for a breakpoint in - the delay slot. - - * valprint.c (val_print_string): If errcode is set, always print - an error, regardless of force_ellipsis. In the non-EIO case, - just print the error message rather than calling error(). Don't - access *(bufptr-1) if bufptr points to the start of the buffer. - When looking for '\0', don't increment bufptr and addr if bufptr - started out already at limit. If an error happens on fetching the - first character, don't print the string. - -Sun Feb 27 21:05:06 1994 Jim Kingdon (kingdon@deneb.cygnus.com) - - * config/m68k/tm-apollo68b.h: Remove HAVE_68881 define; it is - obsolete. - - * i387-tdep.c, i386-tdep.c i386v-nat.c, i386aix-nat.c, - i386m3-nat.c, config/m68k/tm-m68k.h, i960-tdep.c - config/i960/tm-i960.h, remote-nindy.c, config/m88k/tm-m88k.h, - m88k-tdep.c: Use floatformat.h instead of ieee-float.h. - * sparc-tdep.c: Remove now-obsolete ieee-float.h stuff - * findvar.c: Update comment regarding ieee-float.h. - -Sun Feb 27 21:39:48 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * config/i386/tm-i386v4.h (I386V4_SIGTRAMP_SAVED_PC, IN_SIGTRAMP, - FRAME_CHAIN, FRAMELESS_FUNCTION_INVOCATION, FRAME_SAVED_PC): - Define to make backtracing through the various sigtramp handlers - work. - * i386-tdep.c (i386v4_sigtramp_saved_pc): New routine to fetch - the saved pc from ucontext on the stack for SVR4 signal handling. - -Fri Feb 25 09:41:11 1994 Jim Kingdon (kingdon@deneb.cygnus.com) - - * remote.c, remote-mon.c, remote-utils.c, remote-utils.h, - target.h, remote-es.c, remote-nindy.c: Don't set baud rate if - baud_rate is -1. Remove sr_get_baud_rate and sr_set_baud_rate; - just use the global variable itself. When printing baud rate, - don't print a baud rate if baud_rate is -1. - - * coffread.c (read_coff_symtab): Pass mst_file_* to - record_minimal_symbol for C_STAT symbols. Put C_EXT and C_STAT - symbols in the minimal symbols regardless of SDB_TYPE. - -Thu Feb 24 08:30:33 1994 Jim Kingdon (kingdon@deneb.cygnus.com) - - * breakpoint.h (enum bptype): New type bp_through_sigtramp. - (bpstat_what_main_action): New code BPSTAT_WHAT_THROUGH_SIGTRAMP. - * breakpoint.c (bpstat_what): Return BPSTAT_WHAT_THROUGH_SIGTRAMP - if we hit a bp_through_sigtramp breakpoint. Remove kludge which - ignored bs->stop for a bp_step_resume breakpoint. - * infrun.c (wait_for_inferior): Make a through_sigtramp_breakpoint - which performs one (the check_sigtramp2 one) of the functions - which had been handled by the step_resume_breakpoint. For each - use of the step_resume_breakpoint, make it still use the - step_resume_breakpoint, use the through_sigtramp_breakpoint, or - operate on both. - Deal with BPSTAT_WHAT_THROUGH_SIGTRAMP return from bpstat_what. - When setting the frame address of the step resume breakpoint, set - it to the address for frame *before* the call instruction is - executed, not after. - - * mips-tdep.c (mips_print_register): Print integers using - print_scalar_formatted rather than duplicating all the - CC_HAS_LONG_LONG and so on. - (mips_push_dummy_frame): Use read_register_gen rather than using - read_register and then putting it back in target format with - store_unsigned_integer. If registers are more than 4 bytes, give - an error rather than have some registers overwrite other - registers. - #if 0 unused include of opcode/mips.h. - - * symfile.h: Don't declare arguments for coff_getfilename. - - * defs.h: Revert Kung change regarding FORCE_LONG_LONG. - -Thu Feb 24 08:06:52 1994 Jeffrey A. Law (law@snake.cs.utah.edu) - - * configure.in (hppa*-*-osf*): New configuration. - * config/pa/hppaosf.mt: New target makefile fragment. - * config/pa/tm-hppao.h: New target include file. - -Thu Feb 24 04:29:19 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * exec.c (print_section_info): Print entry point for exec_bfd only. - * ser-unix.c (wait_for): Fix typo in HAVE_TERMIO case. - * dwarfread.c: Remove second inclusion of , which - causes problems if has no multiple inclusion protection. - -Wed Feb 23 16:28:55 1994 Jeffrey A. Law (law@cygnus.com) - - * tm-hppa.h (CALL_DUMMY): Add two NOP instructions to the end of - the call dummy to avoid kernel bugs in HPUX, BSD, and OSF1. - (CALL_DUMMY_LENGTH): Changed accordingly. - -Wed Feb 23 16:21:25 1994 Stu Grossman (grossman at cygnus.com) - - * sparc-stub.c (trap_low): Make trap handler work for arbitrary - numbers of register windows. - - * sparclite/hello.c: Add factorial function for testing. - * salib.c: Use macros instead of constants for I/O addresses to - make 931 support easier. - * sparclite.h: Change constraint for LOC to "rJ" to force use of - register in sta/lda instructions. - -Wed Feb 23 10:39:18 1994 Jim Kingdon (kingdon@rtl.cygnus.com) - - * dbxread.c (process_one_symbol): Set - block_address_function_relative for COFF like we do for ELF and SOM. - -Sat Feb 19 03:17:32 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * mdebugread.c (new_psymtab): Pass in section_offsets and set - them in the pst. - * mdebugread.c (handle_psymbol_enumerators): New function to enter - the enumerators of an ecoff enum into the partial symbol table. - * mdebugread.c (parse_partial_symbols): Call it. - * symfile.c (reread_symbols): Initialize objfile->*_psymbols.next. - * symmisc.c (dump_psymtab): Fix typo, clean up output of section - offsets. Cast psymtab->read_symtab to PTR before passing it to - gdb_print_address. - * i386-tdep.c (i386_skip_prologue): Skip over instructions that - set up the global offset table pointer in pic compiled code. - * config/mips/tm-mips.h (FIX_CALL_DUMMY): For big endian targets, - error() on TYPE_CODE_FLT arguments whose size is greater than 8, - swap all other TYPE_CODE_FLT arguments as mips_push_arguments - ensures that floats are promoted to doubles before they are pushed - on the stack. - -Fri Feb 18 23:12:59 1994 Stu Grossman (grossman at cygnus.com) - - * sparclite/Makefile.in, sparclite/salib.c, sparclite/sparclite.h: - Fixup cache_on and flush_i_cache so that they work for both the - 930 and 932 processors. Rewrite most low level funcs (uart - access & cache stuff) to use new ASI access macros in sparclite.h. - Also make it easy to access second serial port. - -Fri Feb 18 22:17:33 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * hp300ux-nat.c: Don't incloude , , or - ; not needed. - -Fri Feb 18 08:26:29 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * stack.c (print_frame_info): In "pathological" case, don't - distrust the line number information. - -Fri Feb 18 16:51:14 1994 Kung Hsu (kung@mexican.cygnus.com) - - * mips-tdep.c (mips_print_register): handle 64 bits register. - * valprint.c (print_longest): fix a bug in printing 64 bits value. - -Fri Feb 18 08:26:29 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Version 4.12.2. - - * Makefile.in (install): Do the sed for program_transform_name - ourselves instead of worrying about INSTALL_XFORM. This enables - users to override INSTALL_PROGRAM in the standard way. - - * Makefile.in (c-exp.tab.o, ch-exp.tab.o, m2-exp.tab.o): Don't - depend on Makefile.in. - - * defs.h, valprint.c: Make longest_to_int a function not a macro. - Only test against INT_MIN if a LONGEST is bigger than an int. - - * README: Change GhostScript to Ghostscript. - -Fri Feb 18 07:30:55 1994 Jim Kingdon (kingdon@cygnus.com) - - * config/rs6000/{tm-rs6000lynx.h,nm-rs6000lynx.h,xm-rs6000lynx.h}: - Rename to tm-rs6000ly.h, nm-rs6000ly.h, xm-rs6000ly.h for 14 - character file names. - * Makefile.in (ALLPARAM): Add these files. - - * config/mips/littlemips64.mt: Rename to mipsel64.mt for 14 - character file names. - * Makefile.in: Add Kung's new mips64 files. - -Thu Feb 17 17:25:47 1994 Kung Hsu (kung@mexican.cygnus.com) - - * configure.in: add mips64-*-elf, mips64-*-ecoff, mips64el-*-elf, - mips64el-*-ecoff and mips64-big-*. - * defs.h: get rid of FORCE_LONG_LONG. - * mips-tdep.c (mips_find_saved_regs): add sd and sdc1 instruction - parsing. Change register size to be MIPS_REGSIZE. - -Thu Feb 17 09:30:22 1994 David J. Mackenzie (djm@thepub.cygnus.com) - - * corelow.c, exec.c, irix5-nat.c, mipsread.c, objfiles.c, - osfsolib.c, rs6000-nat.c, solib.c, symfile.c, utils.c, - xcoffexec.c: Use bfd_get_error and bfd_set_error and new error names. - -Fri Feb 11 21:47:24 1994 Steve Chamberlain (sac@sphagnum.cygnus.com) - - * remote-hms.c (readchar, hms_open, hms_fetch_register): Made more robust. - (remove_commands, add_commands): Add/remove hms-drain when target - is connected. - -Fri Feb 11 16:11:38 1994 Stu Grossman (grossman at cygnus.com) - - * configure.in: Add Lynx/rs6000 support. - * lynx-nat.c: Clean up some Sparc stuff. Clean up ptrace error - messages. Add rs6000 support. Don't try to modify unwritable - registers. - * rs6000-nat.c: Move lots of native dependent stuff (like core - file support) from rs6000-tdep.c & xcoffexec.c to here. - * rs6000-tdep.c: Move native dependent stuff to nat.c. - * xcoffexec.c: Move native dependent stuff to nat.c. - * config/rs6000/nm-rs6000.h: Move defs of SOLIB_* macros to here - from tm file. - * config/rs6000/tm-rs6000.h: Remove defs of SOLIB_* funcs, cuz they're - really native. - * config/rs6000/tm-rs6000lynx.h, config/rs6000/xm-rs6000lynx.h: - New files to support Lynx/rs6000. - -Tue Feb 8 00:32:28 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * README: Remove note about gcc warnings on alpha, these should be - gone now. - * c-exp.y, ch-exp.y, core.c, corelow.c, eval.c, fork-child.c, - m2-exp.y, minsyms.c, nlmread.c, parse.c, putenv.c, regex.c - remote-utils.c, stabsread.c: Include . - * regex.c: Include "defs.h", change re_comp argument to const char *. - * infptrace.c (fetch_register, store_inferior_registers): Change - regaddr to type CORE_ADDR. - * config/alpha/alpha-nw.mt, config/alpha/alpha-osf1.mt (MT_CFLAGS): - Remove, no longer necessary now that we use bfd_vma for a CORE_ADDR. - -Mon Feb 7 09:21:17 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * symtab.h: Always define BYTE_BITFIELD to nothing. - -Mon Feb 7 08:44:17 1994 Jim Kingdon (kingdon@deneb.cygnus.com) - - * config/m68k/{m68k-em.mt,tm-m68k-em.h}: Remove; no longer used. - * configure.in: Remove comment about m68k-em.mt. - * Makefile.in: Remove references. - -Mon Feb 7 08:22:42 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * defs.h [BFD64]: Use BFD_HOST_64_BIT, not nonexistent - BFD_HOST_64_TYPE. - -Sun Feb 6 15:56:09 1994 Jeff Law (law@wild.cs.utah.edu) - - * hpread.c (hpux_symfile_init): Use obj_som_* rather than obj_* to - access BFD private data. Search for the "$TEXT$" space rather - than ".text". - (hppa_sym_fns): Add bfd target flavour to initializer. - -Sun Feb 6 06:55:15 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * target.c (target_preopen): If target_kill doesn't remove the - target from the stack, use pop_target to do it. - - * coffread.c (process_coff_symbol, case C_TPDEF): Don't set name - of TYPE_CODE_PTR or TYPE_CODE_FUNC types. This parallels similar - changes to stabsread.c from summer 1993. - - * remote-udi.c (udi_files_info): If prog_name is NULL, just skip - printing the program, rather than passing NULL to printf. - (udi_detach): Set udi_session_id to -1 so that udi_close doesn't - try to call UDIDisconnect again. Print better message. - (udi_kill): Just call UDIDisconnect ourselves, rather than doing - it via udi_close. - (udi_create_inferior): If udi_session_id is negative, open a new - TIP rather than giving an error. - - * config/mips/mipsm3.mh, config/i386/i386m3.mh, - config/ns32k/ns32km3.mh: Define NAT_FILE. - * config/nm-m3.h: Change guard from _OS_MACH3_H_ and _OS_MACH3_H - (it was inconsistent and namespace-wrong) to NM_M3_H. - * m3-nat.c (mach_really_wait): Change parameter name to ourstatus. - (m3_open): New function. - (m3_ops): Use it. - * TODO: Update Mach section. - - * Makefile.in: Remove "rapp" stuff; it is superseded by gdbserver. - -Sun Feb 6 13:26:21 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * printcmd.c (printf_command): Add missing single-letter - backslash-escape sequences, and improve error message. - -Sun Feb 6 06:55:15 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * corelow.c (solib_add_stub, core_open): Pass address of from_tty - rather than trying to shove an int into a pointer and back out - again. This avoids compiler warnings. - - * defs.h (alloca): Declare as void *, not char *, on hpux. - Don't prototype it, just declare the return type. - -Sun Feb 6 03:25:41 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * config/i386/tm-sun386.h, config/i386/tm-symmetry.h - (REGISTER_CONVERT_TO_RAW): Add missing backslash. - -Sat Feb 5 08:03:41 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * remote-mips.c (mips_fetch_registers): If regno is FP_REGNUM or - ZERO_REGNUM, just read it as zero without talking to the board. - - * config/i386/tm-i386aix.h (REGISTER_CONVERT_TO_RAW): Add missing - backslash. - * i386-tdep.c (i386_extract_return_value): Pass TYPE_LENGTH (type) - to store_floating, not nonexistent variable len. - - * remote-mips.c (mips_insert_breakpoint, mips_remove_breakpoint): - New functions. - (mips_store_word): Change calling convention to return errors, and - to provide old contents if the caller wants it. - (mips_xfer_memory): Deal with errors from mips_store_word. - * config/mips/tm-idt.h, config/mips/tm-idtl.h: Remove BREAKPOINT - define now that remote-mips.c doesn't use BREAKPOINT. - - * remote-mips.c (mips_create_inferior): Call warning if arguments - specified, and then execute "set args" command. Call error, not - mips_error, if executable file not specified. - - * remote-e7000.c: Replace "snoop" command (e7000_noecho) with - remote_debug. - - * config/rs6000/tm-rs6000.h (STORE_STRUCT_RETURN): Don't cast - to unsigned int. - -Sat Feb 5 05:27:05 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * value.h (print_longest): Rename "value" to "val" in prototype - declaration because some compilers don't like arguments whose - names are the same as types. - * remote.c (remote_xfer_memory): Cast "myaddr" to unsigned char * - before passing it to remote_*_bytes. - -Fri Feb 4 15:53:18 1994 Steve Chamberlain (sac@cygnus.com) - - * h8500-tdep.c (saved_pc_after_call): The size of the - pc is memory model dependent. (segmented_command, - unsegmented_command, _initialize_h8500_tdep): New commands to - change memory model. - * remote-e7000.c (_initialize_remote_e7000): Change name of snoop - command. - * remote-hms.c (hms_load): Remove breakpoints when loaded. - (hms_wait): Use new status structure - (hms_open): Push the target here. (hms_before_main_loop): Not - here. (supply_val, hms_fetch_register, hms_store_register): Cope - with H8/500 names too. (hms_fetch_register): Take out REGISTER_TYPE. - * sh-tdep.c (show_regs, initialize_sh_tdep): New command to print - all registers in a compact way. - -Fri Feb 4 07:41:13 1994 Jim Kingdon (kingdon@deneb.cygnus.com) - - * config/rs6000/tm-rs6000.h: Declare rs6000_struct_return_address - as CORE_ADDR to match definition in rs6000-tdep.c. - -Fri Feb 4 01:14:20 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * dwarfread.c (process_dies): Skip nested TAG_compile_unit DIEs. - * dwarfread.c (add_partial_symbol): Do not enter opaque aggregate - definitions into the psymtab. - -Thu Feb 3 12:38:58 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * m68k-stub.c: Treat mc68332 like mc68020 most places. Provide - a special exceptionSize for the 68332. - - * remote-udi.c (udi_attach): If no arguments, print error. - -Thu Feb 3 17:34:05 1994 Fred Fish (fnf@cygnus.com) - - * Makefile.in (VERSION): Bump to 4.12.1 - * NEWS, README: Update to match 4.12 release. - -Thu Feb 3 12:38:58 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * command.c (empty_sfunc): New function. - (add_set_cmd): Use it instead of not_just_help_class_command. - (not_just_help_class_command): Change calling convention back to - what it was before yesterday's change. - - * stabsread.c (read_sun_builtin_type): Skip the semicolon at the end - of the type if present. - -Wed Feb 2 11:16:45 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * printcmd.c (decode_format): Don't blithely set the size for - an address to 'w'. Make it 'g' or 'h', depending on TARGET_PTR_BIT. - - * defs.h: Just typedef CORE_ADDR to bfd_vma. Include bfd.h. - If BFD64, make a LONGEST a BFD_HOST_64_BIT. - * defs.h (longest_to_int): Don't depend on CC_HAS_LONG_LONG; instead - always just check against INT_MIN and INT_MAX (this also fixes things - if sizeof (long) > sizeof (int), e.g. Alpha). - * config/pa/tm-hppa.h, config/i386/sun386.h, config/rs6000/tm-rs6000.h: - Don't define LONGEST or BUILTIN_TYPE_LONGEST. - * gdbtypes.h: Remove BUILTIN_TYPE_LONGEST and - BUILTIN_TYPE_UNSIGNED_LONGEST. - * language.h, c-lang.c, ch-lang.c, m2-lang.c, language.c: Remove - longest_int and longest_unsigned_int. - * value.h (struct value): Just align to LONGEST, rather than worrying - about CC_HAS_LONG_LONG. - * valarith.c (value_binop): Figure out type ourself based on - sizeof (LONGEST) rather than relying on BUILTIN_TYPE_LONGEST. The - point is that we don't depend on CC_HAS_LONG_LONG anymore. - * valprint.c (val_print_type_code_int): Just call - extract_unsigned_integer directly, rather than going through - unpack_long. - * printcmd.c (decode_format): Remove code which would sometimes - change 'g' size to 'w' for integers. print_scalar_formatted handles - printing huge integers well enough, thank you. - - * command.c (add_set_cmd, not_just_help_class_command): Change - to make this the sfunc, not cfunc, since that is how we call it. - * command.h: Comment difference between sfunc and cfunc. - * demangle.c (set_demangling_command): Add third arg since that - is how it is called. - (_initialize_demangler): Use sfunc, not cfunc, for - set_demangling_command, since that is how it is called. - Remove show_demangling_command; it has no effect. - - * command.c (shell_escape): Report errors correctly (with error - message from strerror). - -Wed Feb 2 14:35:41 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * xcoffread.c (read_xcoff_symtab): Change CSECT_LEN to use - x_scnlen.l rather than x_scnlen to match corresponding change in - coff/internal.h. - -Wed Feb 2 11:16:45 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * gdbtypes.h, ch-typeprint.c, ch-valprint.c: - Change comments regarding TYPE_CODE_BOOL. - * language.c (boolean_type): Always return 1 for TYPE_CODE_BOOL, - regardless of the language. - (value_true): Just call value_logical_not regardless of language. - * coffread.c (coff_read_enum_type), stabsread.c (read_enum_type): - Remove #if 0'd code which makes some enums TYPE_CODE_BOOL. - * language.h: Improve comment for la_builtin_type_vector. - * m2-lang.c (_initialize_m2_language): Don't add any fields to - builtin_type_m2_bool. - -Tue Feb 1 17:13:32 1994 Kevin Buettner (kev@cujo.geg.mot.com) - - * config/m88k/{tm-delta88.h,tm-delta88v4.h}, m88k-tdep.c: - Define IN_SIGTRAMP and backtrace correctly through signal handlers. - -Tue Feb 1 22:13:25 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * procfs.c (wait_fd): Handle EINTR error return from PIOCWSTOP ioctl - by restarting the ioctl. - -Tue Feb 1 16:16:25 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * target.h (target_wait): Add comment about calling - return_to_top_level. - -Tue Feb 1 12:21:00 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * coffread.c (read_one_sym): bfd_coff_swap_aux_in now takes - additional arguments. - * xcoffread.c (read_xcoff_symtab, read_symbol_lineno): Likewise. - -Mon Jan 31 16:10:41 1994 Stu Grossman (grossman at cygnus.com) - - * sparc-stub.c: Remove unnecessary #include of memory.h. - -Mon Jan 31 12:12:34 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * mips-tdep.c: Remove code which sets saved_regs from - init_extra_frame_info and put it in new function mips_find_saved_regs. - (READ_FRAME_REG): Remove macro and replace uses with the expansion. - * mips-tdep.c, config/mips/tm-mips.h: When examining ->saved_regs, - check if it is NULL and call mips_find_saved_regs if so. - - * remote-mips.c: Use unfiltered, not filtered, output most places. - - * blockframe.c (get_prev_frame_info): Detect and stop an infinite - backtrace. Revise comments. - -Mon Jan 31 09:40:33 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * mdebugread.c (parse_procedure): Remove _sigtramp kludges for - alpha and irix. The _sigtramp case has to be handled properly - in the tdep files if we have no ecoff debugging info. - * alpha-tdep.c (alpha_frame_saved_pc, alpha_frame_chain), - mips-tdep.c (mips_frame_saved_pc): Handle signal handler frames - without PC_REGNUM kludge. - * mdebugread.c (fixup_sigtramp), mips-tdep.c (read_next_frame_reg): - Clean up handling of mips sigtramp frames, improve comments. - -Sat Jan 29 23:25:57 1994 Jeffrey A. Law (law@snake.cs.utah.edu) - - * paread.c (read_unwind_info): Fix typo. - - * paread.c (pa_symtab_read): Update the "check_strange_names" - filter to match GCC's current output. Filter out section symbols - (which the HP linker sometimes puts in the wrong place). - -Sat Jan 29 07:44:59 1994 Jim Kingdon (kingdon@deneb.cygnus.com) - - * serial.h (SERIAL_SET_TTY_STATE): Comment return value. - - * Makefile.in (TAGS): Just echo one line, rather than the whole thing. - - * Makefile.in: Remove all references to sparcly-nat.c. - - * Makefile.in (HFILES_NO_SRCDIR): Include dcache.h remote-utils.h - remote-sim.h directly, rather than via $(remote_utils_h). This avoids - duplicating serial.h and target.h. - - * Makefile.in: Don't set M_INSTALL and M_UNINSTALL. These variables - are not used anywhere (a 5 Oct 1993 change removed the uses). - - * config/m68k/monitor.mt (TDEPFILE): Add remote-es.o. - * config/m68k/es1800.mt: Add comment. - * remote-es.c: Extensive changes to update to current conventions. - - * ser-unix.c (wait_for, hardwire_readchar) [HAVE_TERMIO, HAVE_TERMIOS]: - If the timeout is too big to fit in c_cc[VTIME], then do multiple reads - to achieve the desired timeout. - * serial.h (serial_t): Add field timeout_remaining. - -Fri Jan 28 08:45:02 1994 Jim Kingdon (kingdon@deneb.cygnus.com) - - * c-exp.y (yylex): Reenable nested type code. - -Fri Jan 28 15:40:33 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * a29k-tdep.c (examine_tag): Add comment regarding argcount. - - * remote-mips.c (mips_ops): Fix docstring. - - * remote-bug.c (bug_ops): Remove spurious newline from docstring. - - * config/m68k/tm-monitor.h: Changes to bring this into accordance - with the old tm-m68k-em.h: - (GDBINIT_FILENAME, DEFAULT_PROMPT): Remove. - (HAVE_68881): Don't undefine; HAVE_68881 is obsolete. - (REGISTER_NAMES): Don't muck with it; what tm-m68k.h has is fine. - Add FIXME regarding GET_LONGJMP_TARGET. - - * remote-udi.c (udi_close, udi_detach, udi_kill): Add comments. - * infptrace.c (kill_inferior): Add comments. - * main.c (quit_command): Call target_close after we kill or - detach. - * remote-udi.c (udi_close): Don't error() if QUITTING. - -Fri Jan 28 11:55:52 1994 Rob Savoye (rob@darkstar.cygnus.com) - - * configure.in: Make m68k-coff and aout add monitor support in - addition to the standard serial support. - -Fri Jan 28 08:45:02 1994 Jim Kingdon (kingdon@deneb.cygnus.com) - - * mdebugread.c (psymtab_to_symtab_1): Don't complain on stLabel with - index indexNil. - -Fri Jan 28 10:40:34 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config/pa/tm-hppa.h: Define macro SMASH_TEXT_ADDRESS. - * elfread.c (record_minimal_symbol_and_info), - dwarfread.c (process_dies), paread.c (pa_symtab_read): Use it. - -Thu Jan 27 15:12:23 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * i386-stub.c: Add ".text" right before "mem_fault:". - - * main.c (baud_rate): Add FIXME comment about printing -1 value. - - * remote-utils.c (usage): Fix message to be accurate and conform - more closely to normal conventions. - - * remote-utils.c (gr_files_info): Have the exec_bfd test control - whether to show information about exec_bfd, and not control whether - to show information about device and speed. - - * remote-utils.c (gr_open): If sr_get_device returns NULL, give - usage message, don't dump core. - - * remote-bug.c (bug_write_memory): Use alloca, not GCC extension - for variable size array. - (bug_fetch_register, bug_store_register): Rename "value" to - "fpreg_buf" because some compilers don't like variables whose - names are the same as types. - (bug_store_register): Use a cast when converting char * to - unsigned char *. - - * symmisc.c (maintenance_print_symbols): Don't refer to the name - of the command in error message (the text was referring to the old - name of the command). - - * symmisc.c (dump_symtab): Fix args to fprintf_filtered. - - * c-typeprint.c (c_type_print_base): Have SHOW == 0 mean to print - full details on structure elements without names. This partially - reverts the changes of 1 Jul 1993 and 31 Aug 1993; I think this aspect - of those changes was accidental. - - * stack.c (parse_frame_specification): If SETUP_ARBITRARY_FRAME is - defined, make it an error to specify a single argument which is not - a frame number. - - * Makefile.in (version.c), main.c (print_gdb_version): Use - host_alias and target_alias, not host_canonical and - target_canonical, to print configuration. - -Wed Jan 26 10:57:21 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * parse.c (write_exp_msymbol): Use new type msymbol_addr_type instead - of builtin_type_long. It is necessary to get a type which is - TARGET_PTR_BIT bits in size; builtin_type_long might not be big enough. - - Fix many sins which will come up in 32 bit x 64 bit GDB, and - various miscellaneous things discovered in the process: - * printcmd.c, defs.h (print_address_numeric): New function. - * c-valprint.c (c_val_print), ch-valprint.c (chill_val_print) - breakpoint.c (describe_other_breakpoints, breakpoint_1, mention), - cp-valprint.c (cplus_print_value), infcmd.c (jump_command), - printcmd.c, stack.c, symfile.c, symmisc.c, valprint.c: - Use it. - * utils.c, defs.h (gdb_print_address): New function. - * expprint (dump_expression), gdbtypes.h: Use it. - * breakpoint.c (describe_other_breakpoints), - symmisc.c (dump_symtab, print_symbol): - Use filtered not unfiltered I/O. - (remove_breakpoints): Remove BREAKPOINT_DEBUG code. Might as well - just run gdb under a debugger for this (and it had problems with - printing addresses, how to print b->shadow, etc.). - * buildsym.c (make_blockvector), core.c (memory_error), - exec.c (print_section_info), maint.c (print_section_table), - mdebugread.c (parse_procedure), solib.c, source.c, symfile.c, - symmisc.c, symtab.c, valops.c, valprint.c, xcoffexec.c: - Add comments saying code is broken. Marked with "FIXME-32x64". - * dbxread.c (process_one_symbol), partial-stab.h (default), - remote-vx.c (vx_run_files_info): - Don't cast int being passed to local_hex_string. - * symmisc.c (print_symbol): Don't cast long being passed to %lx. - * symtab.h (general_symbol_info): Add comment about SYMBOL_VALUE - only being a long. - * symmisc.c (print_symbol): Print "offset" in message for LOC_ARG - and LOC_LOCAL. - * printcmd.c (print_address): Remove #if 0 code with ADDR_BITS_REMOVE. - * source.c: Include regardless of USG. - -Tue Jan 25 12:58:26 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * valops.c (value_assign): Set `type' after coercing toval. - * c-valprint.c (c_val_print), ch-valprint.c (chill_val_print): - Use extract_unsigned_integer to get the address of a reference. - -Tue Jan 25 11:31:53 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * stabsread.c (STABS_CONTINUE, error_type), partial-stab.h: - AIX can use ? instead of \ for continuation. Deal with it. - - * paread.c (read_unwind_info): Just assign to objfile->obj_private, - not OBJ_UNWIND_INFO. Assigning to a cast is a GCC-ism which - the HP compiler in ANSI mode doesn't like. - - * main.c: When defaulting HAVE_SIGSETMASK based on USG, just do it - based on USG, rather than defining HAVE_SIGSETMASK to an - expression containing defined. Having a macro used in #if expand - to an expression containing "defined" is undefined according to - ANSI, and the HP compiler in ANSI mode doesn't do what we wanted - it to. - -Mon Jan 24 20:51:29 1994 John Gilmore (gnu@cygnus.com) - - * sparc-nat.c (fetch_inferior_registers, store_inferior_registers): - Clean up the changes of 11 Jan, as recommended by Peter Schauer. - -Fri Jan 21 19:10:44 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * ch-exp.y (match_string_literal): Allow a zero-length string. - * ch-lang.c (chill_printstr): Don't print zero-length string funny. - -Sat Jan 22 17:08:48 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * i386aix-nat.c (i386_float_info): Reverse order of registers before - passing them to print_387_status. - (print_387_status): Don't subtract top from 7 before using it. - * i387-tdep.c: Remove comment about AIX wanting "top" subtracted - from 7; the above explains it. - -Sat Jan 22 20:25:11 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * mips-tdep.c (init_extra_frame_info): Use frame relative stack - pointer value when fixing up the frame at the start of a function. - -Sat Jan 22 12:29:13 1994 Stu Grossman (grossman at cygnus.com) - - * lynx-nat.c (fetch_core_registers): Load the I & L regs for the - Sparc from the stack. - -Sat Jan 22 08:30:42 1994 Jim Kingdon (kingdon@deneb.cygnus.com) - - * remote-mips.c (mips_initialize): Clear mips_initializing via - cleanup chain, not directly. - - * ser-unix.c (wait_for) [HAVE_TERMIO, HAVE_TERMIOS]: Make a timeout - of -1 mean forever, like in the HAVE_SGTTY case. Warn if we are - munging the timeout due to the limited range of c_cc[VTIME]. - - * fork-child.c, inferior.h (fork_inferior): New argument shell_file. - * procfs.c (procfs_create_inferior), inftarg.c (child_create_inferior), - m3-nat.c (m3_create_inferior): Pass it. - * procfs.c: Remove ptrace function. It was declared in a way which - conflicted with the prototype in unistd.h on Solaris. - -Sat Jan 22 01:37:40 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * sparc-tdep.c (frame_saved_pc): Get the pc from the saved pc - in the sigcontext if it is a signal trampoline frame. - * config/sparc/tm-sun4sol2.h (IN_SIGTRAMP, SIGCONTEXT_PC_OFFSET): - Define for Solaris2. - -Sat Jan 22 00:34:47 1994 Stu Grossman (grossman at cygnus.com) - - * sparc-tdep.c, lynx-nat.c, config/sparc/tm-sparc.h, - config/sparc/tm-sparclynx.h: Move defs of FRAME_SAVED_I0/L0 to - tm-sparc.h so they can be overridden if necessary. - -Fri Jan 21 17:49:28 1994 Stu Grossman (grossman at cygnus.com) - - * lynx-nat.c: Add Sparc support. - * sparcly-nat.c: Remove. It's useless. - * config/sparc/nm-sparclynx.h: Rewrite. - * config/sparc/sparclynx.mh (NATDEPFILES): Replace sparcly-nat.o - with lynx-nat.o - * config/sparc/tm-sparclynx.h: Rewrite. - -Fri Jan 21 19:08:48 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * rs6000-pinsn.c: Use the new disassembler in the opcodes - directory. Old code was discarded, since the new opcode table has - a different format. - -Fri Jan 21 14:28:30 1994 Fred Fish (fnf@cygnus.com) - - * Makefile.in (realclean): Remove info files per make-stds.texi. - -Fri Jan 21 12:47:53 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * dbxread.c (end_psymtab): Only patch psymtab textlow and texthigh - if N_SO_ADDRESS_MAYBE_MISSING is defined. - * config/sparc/tm-sun4sol2.h: Define it. - -Thu Jan 20 15:04:24 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * printcmd.c (print_address_symbolic): Unconditionally use msymbol - if we did not find a symbol. - -Fri Jan 21 08:20:18 1994 Jeffrey A. Law (law@snake.cs.utah.edu) - - * infptrace.c (child_xfer_memory): Only use if CHILD_XFER_MEMORY - is not defined. - - * hppab-nat.c (call_ptrace): Delete redundant function. - (kill_inferior, attach, detach, child_resume): Likewise. - (child_xfer_memory): Likewise. - - * hppah-nat.c (call_ptrace): Delete redundant function. - (kill_inferior, attach, detach, child_resume): Likewise. - - * config/pa/hppabsd.mh (NATDEPFILES): Add infptrace.o. - - * config/pa/hppahpux.mh (NATDEPFILES): Add infptrace.o. - - * config/pa/nm-hppab.h (FETCH_INFERIOR_REGISTERS): Define. - - * config/pa/nm-hppah.h (FETCH_INFERIOR_REGISTERS): define. - (CHILD_XFER_MEMORY): Define. - (PT_*): Define so that generic infptrace.c code can be used. - -Fri Jan 21 09:23:33 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * xcoffread.c (xcoff_symfile_read): Make second parameter a - struct section_offsets *, not a (nonexistent) struct section_offset *. - - * xcoffread.c (read_xcoff_symtab): Make main_aux just a union - internal_xcoff_symtab, not an array of one of them. Change lots of - "main_aux" to "&main_aux" and so on. - - * coffread.c, xcoffread.c: Include - before "symfile.h". - -Thu Jan 20 17:30:55 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * coffread.c (coff_getfilename): Make it not static. - - * xcoffread.c (read_xcoff_symtab): complain() not abort(). - - * xcoffread.c (struct coff_symbol): Rename c_nsyms to c_naux (removes - a completely gratuitous difference between xcoffread.c and coffread.c). - -Wed Jan 19 15:09:44 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * infrun.c (wait_for_inferior): Don't set frame for - step_resume_breakpoint for IN_SIGTRAMP cases. - - * infrun.c (wait_for_inferior), breakpoint.h (struct bpstat_what), - breakpoint.c (bpstat_what): Move step_resume from its own field of - the struct bpstat_what into the main_action. Make it override - other breakpoints. This is a conservative change in the sense - that before the step resume breakpoint was a breakpoint.c - breakpoint, hitting the step resume breakpoint overrode even - calling bpstat_stop_status. - -Wed Jan 19 12:40:25 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * infrun.c (normal_stop): Set stop_pc after popping the dummy frame - in case execution was stopped in the called function. - * stack.c (print_frame_info, frame_info): If backtracing through - a call dummy, handle the starting source line number on a line - boundary like backtracing through sigtramp. - * sparc-tdep.c (sparc_frame_find_saved_regs): Get frame address - for call dummy frame right. Remove old test for dummy frame, - it has been unused at least since gdb-3.5. - * sparc-tdep.c (sparc_push_dummy_frame): Set return address register - of the dummy frame. - -Tue Jan 18 16:16:35 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * infcmd.c (signal_command): Accept 0 as legitimate signal number. - -Tue Jan 18 14:09:25 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * infrun.c (signals_info), target.c (target_signal_from_name): - Use ugly casts to avoid enumvar < enumvar or enumvar++. - -Mon Jan 17 22:00:15 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * ser-unix.c (hardwire_noflush_set_tty_state): Don't muck with ICANON. - * inflow.c (terminal_ours_1): When discussing how to deal with the - tty state, make note of query() as well as readline. - - * infrun.c (_initialize_infrun): Add TARGET_SIGNAL_POLL to list of - signals for which stop and print are cleared by default. - -Mon Jan 17 20:00:51 1994 Jeffrey A. Law (law@snake.cs.utah.edu) - - * config/pa/tm-hppa.h (unwind_table_entry): Use one of the - reserved fields to hold a stub unwind entry type. Fix typo. - (stub_unwind_entry): New structure for raw stub unwind entries. - (stub_unwind_types): The types of stubs we may encounter. - (UNWIND_ENTRY_SIZE, STUB_UNWIND_ENTRY_SIZE): New defines. - * hppa-tdep.c (rp_saved): Use additional information provided - by linker stub unwind descriptors. - (frameless_function_invocation): Likewise. - (frame_chain_valid): Likewise. - * paread.c (compare_unwind_entries): New function for sorting - unwind table entries. - (read_unwind_info): Rewrite to remove dependency on host endianness. - Read in data from the $UNWIND_END$ subspace which contains linker - stub unwind descriptors. Merge that data into the basic unwind - table. - - * hppab-nat.c (_initialize_kernel_u_addr): Delete unwanted functions. - -Mon Jan 17 22:00:15 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * xcoffread.c (read_xcoff_symtab, case C_FILE): Accept the name - from either the symbol name or the auxent. - * coffread.c, symfile.h (coff_getfilename): Renamed from getfilename, - no longer static. - -Mon Jan 17 13:35:01 1994 Fred Fish (fnf@cygnus.com) - - * Makefile.in (ALLPARAM): Change irix5.h to nm-irix5.h. - -Mon Jan 17 12:35:42 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * README: Update notes for alpha port. - -Mon Jan 17 11:15:57 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * i960-tdep.c (i960_fault_to_signal): Return TARGET_SIGNAL_ILL - for operation fault, constraint fault, and type fault. - -Sun Jan 16 12:46:01 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Makefile.in (init.c): Add comment explaining formatting conventions. - - * c-exp.y (parse_number): Assign to temporary between the right - shifts, to work around a bug in the SCO compiler. - - * Makefile.in (ALLCONFIG, ALLPARAM, ALLDEPFILES, HFILES_NO_SRCDIR): - Add various files which were added to GDB recently. - - * xcoffread.c (process_xcoff_symbol): Only change 'V' to 'S' if not - within_function. - - * Makefile.in: Add mostlyclean target. - -Sat Jan 15 10:20:13 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Version 4.11.4. - -Sat Jan 15 18:27:34 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * main.c (show_commands): Make return type of extern - history_get be HIST_ENTRY, rather than struct _hist_entry. - (The latter loses with the upcoming merged readline.) - -Sat Jan 15 10:20:13 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * minsyms.c (prim_record_minimal_symbol_and_info): Make tempstring - const char *, not char *. - - * symtab.h (struct symbol): Make section short, not unsigned short. - - * symtab.c (lookup_symbol): Add comment about QUIT here. - - * utils.c (fputs_unfiltered): Call fputs, not fputs_maybe_filtered. - - * c-exp.y (parse_number): Check for overflow regardless of range - checking. Fix overflow check to use unsigned LONGEST, not - unsigned int. - - * c-exp.y (parse_number): Make it so that integer constants are - builtin_type_long_long if builtin_type_long isn't big enough or if - an "LL" suffix is used. Properly handle "UL" or "LU" suffixes. - - * c-typeprint.c (c_type_print_varspec_suffix, case TYPE_CODE_FUNC): - Print our "()" first, then recurse for the target type. - -Fri Jan 14 21:55:39 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * remote-udi.c (udi_create_inferior): Quote empty execfile argument. - - * gdbserver/low-lynx.c: Include not "/usr/include/wait.h". - -Fri Jan 14 14:17:06 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * utils.c (request_quit): Re-establish signal handler regardless - of USG. - - * config/mips/xm-irix4.h: Define HAVE_TERMIOS. - -Fri Jan 14 21:55:39 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * i960-tdep.c: Include target.h. - -Fri Jan 14 17:12:28 1994 Stan Shebs (shebs@andros.cygnus.com) - - * lynx-nat.c (sys/wait.h): Don't use absolute pathname. - -Fri Jan 14 11:06:10 1994 Jim Kingdon (kingdon@deneb.cygnus.com) - - * lynx-nat.c (child_wait): Fix thinkos in struct target_waitstatus - changes (status -> ourstatus; declare status, etc.). - * config/nm-lynx.h: Fix child_wait prototype and include target.h. - -Fri Jan 14 14:17:06 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Makefile.in (ALLPARAM): Add config/nm-lynx.h. - -Fri Jan 14 11:49:44 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * remote-mips.c (mips_request, mips_wait): Correct prototypes. - -Fri Jan 14 11:37:17 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config/i386/xm-linux.h: Define HAVE_TERMIOS. - -Fri Jan 14 01:04:36 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * config/alpha/tm-alpha.h (CALL_DUMMY): Improve comment. - -Thu Jan 13 10:32:38 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * remote-vx.c (vx_wait): Only call i960_fault_to_signal if I80960 - is defined. Otherwise just report TARGET_SIGNAL_UNKNOWN. - - * mips-tdep.c (mips_push_arguments): Byteswap struct_addr before - writing it. - - Add search to target vector (#if 0'd until after 4.12): - * target.h (to_search, target_search): Add. - * gdbcore.h, core.c (generic_search): Add. - * remote.c (remote_search): Add. - * a29k-tdep.c (init_frame_info): Use target_search to find traceback - tag. - - * printcmd.c (print_address_symbolic): If set print fast-symbolic-addr - is on, call find_pc_function rather than relying just on the minimal - symbols (probably only matters for symbol readers which don't put - statics in the minimal symbols, but changing this strikes me as - not conservative enough). - Initialize name_location in all cases. - If no symbol and no msymbol, don't print anything symbolic. - - * a29k-tdep.c (push_dummy_frame): Add comment about saving lr0. - -Wed Jan 12 20:53:16 1994 John Gilmore (gnu@cygnus.com) - - * printcmd.c (print_address_symbolic): Make it search the - symtabs for variables as well as functions. Add `set print - fast-symbolic-addr' and default it to fast (the old way). - Print line numbers for data items as well as functions. - - * symtab.c (find_addr_symbol): Return the symtab and the symbol - address, if a symbol is found (take two more args pointing to - where to store these results). - - * symtab.h (find_addr_symbol): Add prototype. - -Wed Jan 12 19:32:11 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * objfiles.h: Fix comments to reflect the fact that the phrase - "top of stack" always refers to where the pushing and popping takes - place, regardless of whether it is at the highest or lowest address. - -Wed Jan 12 13:23:37 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * mdebugread.c (parse_symbol): Do not set TYPE_TAG_NAME for - compiler generated tag names. - * mdebugread.c (parse_type): Handle cross references to qualified - aggregate types. - * valops.c (value_struct_elt): Improve error message if the - address of a method is requested from an object instance. - * valops.c (search_struct_method): Make name_matched non-static - to get it initialized correctly. - * config/i386/nm-i386sco.h (CANNOT_STORE_REGISTER): Define to - exclude segment register which are not writable on newer SCO versions. - -Wed Jan 12 14:44:45 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * go32-xdep.c: Remove unused function uerror. - (sigsetmask): Declare return type. Declare argument (to match the - way it is called). Explicitly return 0. - -Wed Jan 12 01:44:25 1994 John Gilmore (gnu@cygnus.com) - - * symtab.h (struct symbol, general_symbol_info, minimal_symbol, - partial_symbol): Shrink the storage sizes of symbols, by making - enums into 1-byte bitfields when compiled __GNUC__, moving all the - enums and small ints to the end of each struct to improve - alignment, and switching the section number from int to unsigned - short. - -Wed Jan 12 00:16:26 1994 John Gilmore (gnu@cygnus.com) - - * symtab.c (find_addr_symbol): New routine that will find the nearest - symbol associated with an address. It does so by exhaustive - search of the symtabs, so it's slow but complete. - -Tue Jan 11 23:57:30 1994 John Gilmore (gnu@cygnus.com) - - * coffread.c (read_coff_symtab): Set PC bounds of _globals_ symtab - to [0,0] rather than [0, end of first source file]. This avoids - problems with other parts of GDB looking for linetables in the - _globals_ symtab. Eliminate variables num_object_files and - first_object_file_end. - -Tue Jan 11 00:53:46 1994 John Gilmore (gnu@cygnus.com) - - * a29k-tdep.c (init_frame_info): Cast null arg to examine_tag. - (pop_frame): Restore PC2 and LR0 from dummy frames. - (push_dummy_frame): Save PC2 and LR0 into dummy frames. - (setup_arbitrary_frame): Handle 3 args and set up real frames. - * config/a29k/tm-a29k.h (FRAME_NUM_ARGS): Update comments. - (DUMMY_FRAME_RSIZE): Add 2 longwords for PC2 and LR0. - (SETUP_ARBITRARY_FRAME): Define. - -Tue Jan 11 06:59:10 1994 Jim Kingdon (kingdon@deneb.cygnus.com) - - * infrun.c, config/mips/tm-irix5.h: Remove #if 0'd AT_FUNCTION_START. - -Tue Jan 11 14:27:03 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * remote-udi.c (udi_resume): Correct prototype. - -Tue Jan 11 11:10:30 1994 Jeffrey A. Law (law@snake.cs.utah.edu) - - * config/pa/tm-hppa.h (FRAME_FIND_SAVED_REGS): Call - hppa_frame_find_saved_regs. - * hppa-tdep.c (dig_fp_from_stack): Delete function. - (prologue_inst_adjust_sp): New function. - (is_branch, inst_saves_gr, inst_saves_fr): New functions. - (skip_prologue): Completely rewrite to use unwind information. - (hppa_frame_find_saved_regs): Likewise. - -Tue Jan 11 06:59:10 1994 Jim Kingdon (kingdon@deneb.cygnus.com) - - * remote-mips.c (mips_wait): Use new function mips_signal_from_protocol - to convert a signal number with appropriate bounds checking. - - * remote-mips.c (mips_wait): Fix typos (0x177 -> 0177, 0x377 -> 0377). - -Tue Jan 11 00:53:46 1994 John Gilmore (gnu@cygnus.com) - - * stack.c (frame_info): If FRAME_FIND_SAVED_REGS isn't defined, - print a newline to end the display anyway. - - * sparc-tdep.c (sparc_pop_frame): Pop the fsr and csr (float and - coprocessor status regs) when popping a frame. This fixes - float exceptions that occur after calling inferior functions. - - * sparc-nat.c (fetch_inferior_registers, store_inferior_registers): - Read and write the fsr (float status register) to/from the child - process along with the float regs. Remove Peter Schauer's change - of May 24 '93, which has higher overhead and doesn't solve the - real problem (which was that FSR wasn't being set). - -Mon Jan 10 23:16:42 1994 John Gilmore (gnu@cygnus.com) - - * a29k-tdep.c (examine_prologue): Don't worry if the ASGEQ - stack overflow check isn't right after the register stack - adjustment instruction. Metaware R2.3u compiler moves other - things in front of it. This fix isn't perfect but is what's - running. - -Mon Jan 10 20:08:23 1994 Jim Kingdon (kingdon@deneb.cygnus.com) - - * c-valprint.c (c_val_print): Treat TYPE_CODE_RANGE like TYPE_CODE_INT. - - * config/alpha/alpha-netware.mt: Rename to alpha-nw.mt for 14 - character filenames. - * configure.in: Change accordingly. - -Mon Jan 10 15:48:36 1994 Tom Lord (lord@rtl.cygnus.com) - - * m68k-stub.c, sparc-stub.c: removed spurious introduction of - _filtered io routines from these two files. - -Fri Jan 7 12:42:45 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * config/i386/tm-i386v.h, config/m68k/tm-m68k.h, config/mips/tm-mips.h, - config/vax/tm-vax.h (CALL_DUMMY_BREAKPOINT_OFFSET): Define. - * mdebugread.c (parse_symbol): Handle enum sh.type produced by - DEC c89. - * mdebugread.c (add_line): Handle zero linenos produced by DEC c89. - -Fri Jan 7 12:55:25 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * utils.c (print_sys_errmsg): Call gdb_flush (gdb_stdout) before - printing to gdb_stderr. - - * remote-udi.c (udi_kill): Don't close the connection, just set - inferior_pid to zero. - (udi_mourn): Call remove_breakpoints. - - * remote-udi.c: Remove obsolete need_artificial_traps comment. - - * i386b-nat.c (sregmap): If sEAX, etc., not defined, use tEAX, etc. - -Thu Jan 6 07:17:53 1994 Jim Kingdon (kingdon@deneb.cygnus.com) - - * symtab.c (lookup_symbol): Don't try adding .c to the name. - - * remote-bug.c: At the start of each section, reset srec_frame - back to 160. - - * target.h: Add TARGET_WAITKIND_LOADED and TARGET_WAITKIND_SPURIOUS. - * target.c (store_waitstatus): Add CHILD_SPECIAL_WAITSTATUS hook. - * infrun.c (wait_for_inferior): Replace SIGTRAP_STOP_AFTER_LOAD with - code which looks for those two waitkinds. Use switch statement. - * config/rs6000/tm-rs6000.h: Replace SIGTRAP_STOP_AFTER_LOAD with - CHILD_SPECIAL_WAITSTATUS. - - * procfs.c (procfs_wait): Fix argument name to match 4 Jan changes. - * Move target_signal_from_host, target_signal_to_host, and - store_waitstatus from inftarg.c to target.c. procfs needs them. - * target.c: Include "wait.h" and . - * target.h, infrun.c (proceed), proceed callers: Pass new code - TARGET_SIGNAL_DEFAULT instead of -1. This avoids problems with - enums being treated as unsigned and is cleaner. - * infrun.c (signals_info): Don't print TARGET_SIGNAL_DEFAULT or - TARGET_SIGNAL_0. - * infcmd.c (signal_command), infrun.c (signals_info): - Don't allow user to specify numeric equivalent of - TARGET_SIGNAL_DEFAULT. - -Tue Jan 4 15:34:36 1994 Stu Grossman (grossman@cygnus.com) - - * config/alpha/alpha-netware.mt: New target support for Alpha - running Netware. - * configure.in: Add alpha-*-netware* target. - -Tue Jan 4 14:51:35 1994 Stan Shebs (shebs@andros.cygnus.com) - - * remote-mips.c (mips_wait): Fix ref to TARGET_WAITKIND_STOPPED. - -Tue Jan 4 09:47:14 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * target.h: Add enum target_waitkind, enum target_signal, and - struct target_waitstatus. Change status argument to target_wait to - be struct target_waitstatus * instead of int *. - * target.h, infrun.c, all targets: Change type of signal arguments - to resume(), proceed(), and target_resume() from int to enum - target_signal. - * All targets (*_wait, *_resume): Change accordingly. - * infcmd.c (program_info, signal_command), throughout infrun.c, - * fork-child.c, solib.c, hppa-tdep.c, osfsolib.c: Use this stuff. - * convex-xdep.c, convex-tdep.c: Add FIXME's (getting the Convex - signal code stuff right with the new signals would be non-trivial). - * inferior.h (stop_signal): Make it enum target_signal not int. - * target.c, target.h (target_signal_to_string, target_signal_to_name, - target_signal_from_name): New functions. - * inftarg.c, target.h (target_signal_to_host, target_signal_from_host, - store_waitstatus): New functions. - * procfs.c (procfs_notice_signals): Use them. - * i960-tdep.c (i960_fault_to_signal): New function, to replace - print_fault. - * config/i960/tm-i960.h: Don't define PRINT_RANDOM_SIGNAL. - - * objfiles.c (build_objfile_section_table): Don't abort() if - objfile->sections is already set. - - * objfiles.c (add_to_objfile_sections): Check SEC_ALLOC not SEC_LOAD - to match recent change to exec.c. - - * Version 4.11.3. - - * main.c (print_gdb_version): Change year to 1994. - - * ChangeLog, ChangeLog-93: Split ChangeLog at 1994. - * Makefile.in (NONSRC): Add ChangeLog-93. - -Mon Jan 3 11:57:29 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * stabsread.c (read_type): Allow defining several type numbers - at once (e.g. "(1,2)=(3,4)="...). - - * stabsread.c (read_enum_type): Use TARGET_INT_BIT not sizeof (int). - - * breakpoint.c (frame_in_dummy): Check PC as well as frame. - -Mon Jan 3 02:47:03 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * mdebugread.c (psymtab_to_symtab_1): Only pass N_STAB symbols - to process_one_symbol. - * symtab.c (find_pc_psymbol): Search global_psymbols as well to - avoid caching a bad endaddr in find_pc_partial_function. - -Sun Jan 2 21:41:17 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config/m68k/tm-sun3.h: Don't define BELIEVE_PCC_PROMOTION. - -Sat Jan 1 04:35:23 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * infrun.c (wait_for_inferior): Do not step or step resume past - the end of a one-line function we just stepped into. - -For older changes see ChangeLog-93 - -Local Variables: -mode: indented-text -left-margin: 8 -fill-column: 74 -version-control: never -End: diff --git a/contrib/gdb/gdb/ChangeLog-95 b/contrib/gdb/gdb/ChangeLog-95 deleted file mode 100644 index cdf4dda..0000000 --- a/contrib/gdb/gdb/ChangeLog-95 +++ /dev/null @@ -1,4882 +0,0 @@ -Fri Dec 29 16:30:58 1995 Stan Shebs - - * symfile.c (find_sym_fns): Add PowerMac to xcoff file recognition - kludge. - - -Fri Dec 22 11:05:59 1995 Michael Meissner - - * configure.in (gdb_host): Add support for DG/UX running on x86 as - a host. - (all x86 targets and hosts): Add support for pentium-pro machines. - - * configure: Rebuild. - - * config/i386/i386dgux.mh: New file for DG/UX running on x86 host. - -Thu Dec 21 19:09:20 1995 Rob Savoye - - * remote-array.c (array_wait): Poll the keyboard along with the - serial port so users can tpye at the target while their - application is running. - -Thu Dec 21 11:58:52 1995 Michael Meissner - - * Makefile.in (ppcbug-rom.o, srec.o): Add dependencies. - - * monitor.c (monitor_debug): Take prefix, and suffix arguments. - Print trailing newline after the suffix. - (monitor_printf{,_noecho}): Change monitor_debug calls. - (monitor_printf): Call monitor_expect instead of trying to do the - expect processing locally so that if there is extra junk, it - doesn't hang things up. - (readchar): If MO_HANDLE_NL is set, handle \r\n pairs and convert - them to a single \r. Use monitor_debug to print out byte read. - - * monitor.h (MO_HANDLE_NL): Add new flag. - - * ppcbug-rom.c (ppcbug_ops{1,2}): Split into two ops, one that - uses lo 0 to load, and the other that uses lo 1. Set flag - MO_HANDLE_NL. - (ppcbug_open{0,1}): Clone and split to handle ppcbug_ops{1,2}. - (_initialize_ppcbug_rom): Set up both ppcbug_open{0,1}. - -Wed Dec 20 10:54:41 1995 Fred Fish - - * defs.h: Delete extraneous whitespace at end of file. - * symfile.h: Move #include of demangle.h outside conditional. - * objfiles.h (struct objstats, OBJSTAT, OBJSTATS): New struct and - macros to hold per-objfile statistics for internal - instrumentation. - (struct objfile): Add OBJSTATS member, which is optional. - * buildsym.h (next_symbol_text_func): Now takes objfile argument. - Also update copyright to 1995. - * dbxread.c (dbx_next_symbol_text): Now takes objfile argument. - (dbx_symfile_init, coffstab_build_psymtabs, elfstab_build_psymtabs, - stabsect_build_psymtabs): Accumulate string table size. - (dbx_next_symbol_text, read_dbx_symtab, read_ofile_symtab): - Accumulate number of stabs symbols read. - * dwarfread.c (new_symbol, symthesize_typedef): - Accumulate number of full symbols created. - * gdbtypes.c (alloc_type): Accumulate number of types. - * maint.c (maintenance_print_statistics): New function. - * mdebugread.c (mdebug_next_symbol_text): Now takes objfile - argument. - * minsyms.c (prim_record_minimal_symbol_and_info): Accumulate - number of minimal symbols read. - * os9kread.c (read_os9k_psymtab): next_symbol_text takes objfile - arg. - * partial-stab.h: next_symbol_text takes objfile arg. - * stabsread.c (error_type, STABS_CONTINUE): Now takes objfile arg - and uses it to call next_symbol_text. - * symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list): - Accumulate number of partial symbols created. - * symfile.h (ADD_PSYMBOL_VT_TO_LIST): Accumulate number of partial - symbols created. - * symmisc.c (print_objfile_statistics): Print the per-objfile - internal instrumentation statistics gathered. - * xcoffread.c (xcoff_next_symbol_text): Now takes objfile argument. - -Fri Dec 15 16:15:55 1995 Ian Lance Taylor - - * top.c (set_endian_from_file): Use new bfd_big_endian macro. - -Fri Dec 15 12:21:10 1995 Raymond Jou - - * mpw-make.sed: Add quotes to RIncludes reference. - -Fri Dec 15 13:18:55 1995 Rob Savoye - - * remote-array.c: Remove bogus setting of baudrate to 4800. Their - hardware has real UARTS now. - -Mon Dec 11 18:19:16 1995 Stan Shebs - - * configure.in (powerpc-*-macos*): New target configuration. - * configure: Update. - * config/powerpc/macos.mh, config/powerpc/macos.mt, - config/powerpc/nm-macos.h, config/powerpc/tm-macos.h, mac-nat.c: - New files, native PowerMac debugging support. - * Makefile.in (mac-nat.o): Add build rule. - * mpw-config.in (enable_cflags): Add support. - (m68k-apple-macos, powerpc-apple-macos): Fix natdepfiles to - list object file instead of source file. - * mpw-make.sed (@ENABLE_CFLAGS@): Don't edit out, replace with - value of variable. - (install, install-only): Edit MPW-specific installation into - place of Unix shell code. - * mac-gdb.r: Fix version resources to use symbolic version strings. - (cfrg): New resource, code fragment for PowerMac. - - -Mon Dec 11 14:13:03 1995 Fred Fish - - * dbxread.c (process_one_symbol): When looking at the next - minimal symbol, check for end of the minimal symbol array - (symbol with NULL pointer for name) before dereferencing it. - -Mon Dec 11 15:56:55 1995 Per Bothner - - * eval.c (evaluate_struct_tuple): Fix thinko. - -Mon Dec 11 06:52:02 1995 Wilfried Moser (Alcatel) - - * ch-typeprint.c (chill_type_print_base): Slightly change of printing - of variant structures. - -Mon Dec 11 00:36:01 1995 Per Bothner - - * valops.c (value_cast): Handle casts to and from TYPE_CODE_CHAR. - * ch-exp.c (match_integer_literal): Fix long long support. - * gdbtypes.c (get_discrete_bounds): Make TYPE_LENGTH (type) == - sizeof (LONGEST) case work OK. - -Fri Dec 8 21:02:24 1995 Fred Fish - - * coffread.c, dbxread.c, dstread.c, objfiles.c, os9kread.c, - symfile.c, symtab.c: Use "obstack.h" rather than . - -Wed Dec 6 16:16:18 1995 Stu Grossman (grossman@cirdan.cygnus.com) - - * remote-mips.c (mips_receive_header): Allow mips_syn_garbage to be - user-settable (via set syn-garbage-limit). Setting it to -1 makes - it unlimited. - -Tue Dec 5 18:33:43 1995 Brendan Kehoe - - * gdbtypes.c (check_stub_method): Make sure we get back a function - string in the demangled name before we try to use it. - -Tue Dec 5 18:08:29 1995 Stu Grossman (grossman@cygnus.com) - - * monitor.c (monitor_expect_regexp): Make static, add prototype. - * (monitor_read_memory_single): Call monitor_expect_regexp with - pointer to getmem_resp_delim_pattern, not entire struct. - -Tue Dec 5 15:51:25 1995 Stan Shebs - - * c-lang.h (c_op_print_tab): Don't declare, some compilers - consider illegal if structure not defined, and only used - in c-lang.c anyway. - -Sun Dec 3 12:31:03 1995 Per Bothner - - * eval.c (evaluate_subexp_standard case): Fix typo. - -Sun Dec 3 11:59:21 1995 Jeffrey A. Law - - * ch-exp.c (parse_named_record_element): Avoid aggregrate - initializations for automatic variables. - - * hppa-tdep.c (hppa_alignof): Fix typo in last change. - -Sat Dec 2 19:32:57 1995 Fred Fish - - * symfile.c (global_psymbols, static_psymbols): Remove, unused. - -Sat Dec 2 03:02:21 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * alpha-tdep.c (heuristic_proc_desc): Add heuristic to - determine the return address register, needed for OSF/1-3.2C. - * config/alpha/tm-alpha.h (T7_REGNUM, T9_REGNUM): Define. - -Fri Dec 1 07:23:57 1995 Michael Meissner - - * ppcbug-rom.c (ppcbug_cmds): Turn on MO_GETMEM_READ_SINGLE - because PPCbug displays the memory as characters as well as hex. - Fix getmem/setmem commands. - - * srec.c (load_srec): Fix off by one typo in last submission. - - * rs6000-tdep.c (push_arguments): Fix typo. - -Thu Nov 30 23:54:17 1995 Per Bothner - - * language.c (lang_bool_type), language.h: New function. - * language.h (LA_BOOL_TYPE): New macro. - * eval.c (evaluate_subexp_standard) Use LA_BOOL_TYPE instead - of builtin_type_int where appropriate, - * valarith.c (value_subscript): Likewise. - - * valops.c (value_slice): Implement (value) bitstring slices. - * valprint.c (val_print): If TYPE_LENGTH is zero, don't automatically - print "" - Chill has zero-length (string) types. - - * gdbtypes.c (check_stub_type): Removed; no longes needed. - * ch-exp.c (expect, parse_call): Tweak error messages. - -Wed Nov 29 13:35:18 1995 Per Bothner - - * scm-valprint.c (scm_isymnames): Remove "#@" prefix. - (scm_scmval_print): Do not print "#@" prefix. - - * gdbtypes.h (enum type_code): Added TYPE_CODE_TYPEDEF. - (check_typedef): New prototype. - (CHECK_TYPEDEF): New macro. - (TYPE_DUMMY_RANGE): Removed. - * gdbtypes.c (get_discrete_bounds): Fix paren error; make more robust. - (create_array_type): Don't force_to_range_type; users of the - array are responsible for handling non-range index types. - (create_set_type): Likewise. - (force_to_range_type): Removed. - (check_typedef): New function handles stub types and typedefs. - (check_stub_type): Just call check_typedef. (To be removed.) - (recursive_dump_type): Handle TYPE_CODE_TYPEDEF. - * ch-lang.c (type_lower_upper): Use get_discrete_bounds. - (evaluate_subexp_chill): Handle string repetition. - Re-arrange to handle EVAL_AVOID_SIDE_EFFECTS better. - * ch-typeprint.c (chill_type_print_base): Handle TYPE_CODE_TYPEDEF. - Pass show=0 in recursive calls various places. - (case TYPE_CODE_ARRAY): Don't require index type to have - TYPE_CODE_RANGE. - (case TYPE_CODE_RANGE): Don't need to support TYPE_DUMMY_RANGE. - * gdbtypes.c, ch-lang.c, ch-typeprint.c (numerous places): - Add check_typedef/CHECK_TYPEDEF as needed. - - * ch-exp.y: Replaced by ... - * ch-exp.c: New file. Use recursive-descent. - Recognize labelled array tuples and powerset ranges. - * Makefile.in: Update for no longer using yacc for ch-exp. - - * c-lang.c: Make various functions non-static. - * c-lang.h: Add bunches of prototypes. - * cp-valprint.c (cp_print_value_fields): Also take address. - (cp_print_value): Likewise. Use baselcass_offset. - * stabsread.c (current_symbol): New static variable. - (type_synonym_name): Remove. - (read_type): If copying, make copy be a TYPE_CODE_TYPEDEF. - (read_array_type): Don't need to handle undefined element type here. - (cleanup_undefined_types): Ditto. - (read_range_type): Look for Chill ranges. - * valops.c (value_assign): Fix case lval_internalvar - don't try - to assign into old value (which might be too small!). - (value_coerce_array): No longer need special VALUE_REPEATED handling. - (value_arg_coerce): Cleaner array->pointer decay mechanism. - (search_struct_field): Use baseclass_offset rather than - baseclass_addr. - (value_slice): Use get_discrete_bounds. - * value.h (COERCE_VARYING_ARRAY): Take type argumnt as well. - * values.c (baseclass_offset): Change parameter interface. - (baseclass_addr): Removed. - * c-typeprint.c, c-valprint.c, ch-valprint.c, values.c, valops.c: - Add check_typedef/CHECK_TYPEDEF as needed. - - * alpha-tdep.c, c-exp.y, h8500-tdep.c, f-exp.y, f-valprint.c, - findvar.c, hppa-tdep.c, infcmd.c, language.c, printcmd.c, - rs6000-tdep.c, symmisc.c, symtab.c, mdebugread.c: - Add check_typedef/CHECK_TYPEDEF as needed. - - * f-typeprint.c, valarith.c, valprint.c, typeprint.c, eval.c: - Add check_typedef/CHECK_TYPEDEF as needed. - * f-typeprint.c: Various cleaning up. - * valarith.c (value_subscript): Also subscript bitstrings (for Chill). - * typeprint.c (print_type_scalar): Also support TYPE_CODE_RANGE. - * eval.c (evaluate_subexp_standard case OP_ARRAY): Implement - support for labelled array tuples and ranges in powerset tuples. - (init_array_element): New function. - - * top.c (command_line_input): Only strip out an initial #-comment. - Looking for internal comments is language-specific (breaks Scheme). - - * expression.h (enum exp_opcode): Add BINOP_RANGE. - * expprint.c (dump_expression): Support BINOP_RANGE. - * eval.c (evaluate_subexp_standard): Handle BINOP_RANGE (as error). - (case MULTI_SUBSCRIPT): Fix broken f77 value->int ad hoc conversion. - * ch-lang.c (chill_op_print_tab): Support BINOP_RANGE. - (evaluate_subexp_chill): Error on BINOP_COMMA. - - * Makefile.in: Clean up so doc stuff stays in doc sub-dir. - -Wed Nov 29 16:39:50 1995 Michael Meissner - - * monitor.c (monitor_debug): New function to print monitor debug - output in printable fashion. - (monitor_printf{,_noecho}): Call monitor_debug instead of - fputs_unfiltered. - - * srec.c (load_srec): When printing srec debug information, do not - print the carriage return directly, instead print \\r followed by - a newline. - -Tue Nov 28 15:25:28 1995 Doug Evans - - * Makefile.in (target_subdir): Define. - (CC_FOR_TARGET, CXX_FOR_TARGET): Use it to find target libraries. - * configure.in (X_CFLAGS): Fix typo. - (target_subdir): Set to "${target_alias}/" if cross. - * configure: Regenerated. - - * dbxread.c (dbx_symfile_read): Set block_address_function_relative - for `pe' format files. - -Tue Nov 28 11:17:47 1995 Fred Fish - - * magic.h: Renamed to gmagic.h to avoid conflict. - * magic.c: Renamed to gmagic.c in sympathy. - * eval.c, gmagic.c, config/tm-magic.h: - Include "gmagic.h" rather than "magic.h". - -Sat Nov 25 02:56:38 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * mdebugread.c (handle_psymbol_enumerators, parse_symbol): - Recognize enums from alpha cc -migrate. - (upgrade_type): Pass correct fd to parse_symbol when parsing - the index type of an array. - (parse_procedure, parse_lines, psymtab_to_symtab_1): Handle - unsorted procedure descriptors from Irix 5.x and Alpha OSF/1-3.x - shared libraries. Use CORE_ADDR instead of `unsigned long' in - procedure descriptor address computations. - - * symtab.c (decode_line_1): Prevent accidental strchr match - of a null character with the terminating null character of - gdb_completer_quote_characters. - (cplusplus_hint): Make sure that only a single quote is printed - in the hint message. - -Fri Nov 24 16:17:01 1995 Jeffrey A Law (law@cygnus.com) - - * top.c (recurse_read_control_structure): Don't make cleanups - here. Callers handle that correctly. - -Tue Nov 21 15:16:34 1995 Fred Fish - - * config/m68k/xm-hp300hpux.h: Define MMAP_BASE_ADDRESS and MMAP_INCREMENT. - Also force HAVE_MMAP to be defined since autoconf is currently broken - for detecting a working mmap under hpux. - * config/pa/xm-hppah.h (MMAP_BASE_ADDRESS): Tweak MMAP_BASE_ADDRESS - to a better value suggested by Jeffrey A Law (law@cygnus.com). - -Tue Nov 21 08:48:58 1995 Fred Fish - - * config/pa/xm-hppah.h: Define MMAP_BASE_ADDRESS and MMAP_INCREMENT. - Also force HAVE_MMAP to be defined since autoconf is currently broken - for detecting a working mmap under hpux. - * objfiles.c (map_to_address): Have gdb print a warning when it - is compiled with HAVE_MMAP but without both MMAP_BASE_ADDRESS and - MMAP_INCREMENT defined (thus making it appear mmap doesn't work). - -Mon Nov 20 14:13:53 1995 Stu Grossman (grossman@cygnus.com) - - * infrun.c (wait_for_inferior): Add support for dynamic function - trampolines. These are pieces of code between the caller and the - callee that figure out the address of the callee's code at run - time. Upon entry, we can't figure out the callee's address, so we - set a breakpoint within the trampoline where the address will be - known, and continue the target. Once we hit the breakpoint, we - break at the callee's address and proceed as usual. - -Mon Nov 20 11:12:34 1995 Fred Fish - - * objfiles.c (allocate_objfile): Change warning message about mapped - symbol tables so that it is obvious that they are not supported on - this particular machine rather than implying they are not supported - at all in this version of gdb. - -Sun Nov 19 05:20:53 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * irix5-nat.c, osfsolib.c (solib_address): Return the name of the - containing solib. - * stack.c (print_frame_info): Use minimal symbol only if - fi->pc is in a known section. - -Sat Nov 18 11:19:35 1995 Roland McGrath - - * solib.c (solib_address): Return the name of the containing solib. - * solib.h (PC_SOLIB): New macro; define using solib_address. - * stack.c (print_frame_info) [PC_SOLIB]: If no function name, try - PC_SOLIB on the PC value. - -Sat Nov 18 04:09:31 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * annotate.c (annotate_source, annotate_frame_begin): Issue - `0x' prefix for the pc value, to remain consistent with previous - GDB versions. - - * blockframe.c (find_pc_partial_function), config/pa/tm-hppa.h: - Remove Sun shared library transfer hack and - INHIBIT_SUNSOLIB_TRANSFER_TABLE_HACK, it is obsoleted by the - mst_solib_trampoline minimal symbols. - - * blockframe.c (inside_main_func): Check main_func_*pc against - INVALID_ENTRY_*PC, not zero. - * symfile.c (init_entry_point_info): Initialize ei.*pc with - INVALID_ENTRY_*PC. - * mipsread.c (mipscoff_symfile_read): If the entry_file bounds - are still unknown after processing the partial symbols, then try - to set them from the minimal symbols. - - * infcmd.c (registers_info): Error out if selected_frame is NULL. - * stack.c (return_command): Select new current frame silently if - not interactive. - - * mipsread.c (read_alphacoff_dynamic_symtab): Ignore additional - DT_MIPS_LOCAL_GOTNO and DT_MIPS_GOTSYM entries. - - * irix5-nat.c (solib_create_inferior_hook): Call solib_add only - if auto_solib_add_at_startup is nonzero. - (_initialize_solib): Add "set auto-solib-add" command. - * osfsolib.c (solib_create_inferior_hook): Call solib_add only - if auto_solib_add_at_startup is nonzero. - (_initialize_solib): Add "set auto-solib-add" command. - -Wed Nov 15 17:12:04 1995 Stan Shebs - - * utils.c: Don't include sys/ioctl.h etc if MPW is host. - -Tue Nov 14 17:16:46 1995 Doug Evans - - * config/arm/tm-arm.h (ADDITIONAL_REGISTER_NAMES): Fix r5. - (FRAME_SAVED_PC): Minor clean up. - -Tue Nov 14 14:51:05 1995 Stu Grossman (grossman@cygnus.com) - - * monitor.c (monitor_load_srec monitor_make_srec): Move all - S-record download code into srec.c. - * srec.c srec.h: New files. Contain S-record loading routines - formerly in monitor.c. - * serial.c serial.h: New routine just like fprintf, but uses - serial_t instead of FILE *. - * sh-tdep.c (frame_find_saved_regs init_extra_frame_info): - Don't add four to saved pc (makes things match manual). Also, fix - bug where we didn't get pc from stack frame correctly. - * config/sh/tm-sh.h (SAVED_PC_AFTER_CALL): Don't add four to - saved pc. Real hardware does this for you. - * sh3-rom.c (sh3_load): New routine. Sets up for download then - calls generic S-record loader. - * config/h8300/h8300.mt, config/h8500/h8500.mt, - config/m68k/monitor.mt, config/pa/hppapro.mt, config/sh/sh.mt: - Add srec.o to TDEPFILES. - -Tue Nov 14 15:57:36 1995 Michael Meissner - - * ppcbug-rom.c: New file to support the Motorola PPCBUG monitor - for PowerPC's. - - * config/powerpc/ppc{,le}-{eabi,sim}.mt (TDEPFILES): Include - ppcbug-rom.o, monitor.o, and srec.o - - * config/i386/linux.mt (XDEPFILES): Include ser-tcp.o. - -Mon Nov 13 13:12:46 1995 Jeffrey A Law (law@cygnus.com) - - * partial-stab.h: Remove GDB_TARGET_IS_HPPA kludge. - -Fri Nov 10 13:08:54 1995 Jeff Law (law@kahlua.cs.utah.edu) - - * terminal.h (HAVE_SGTTY): Fix typo. - -Thu Nov 9 17:34:01 1995 Michael Meissner - - * configure.in (gdb_target): Build in the simulator for all - PowerPC eabi targets, not just eabisim, providing - --enable-sim-powerpc is used, or the host compiler is GCC. - -Thu Nov 9 14:04:05 1995 Raymond Jou (rjou@mexican.cygnus.com) - - * mpw-config.in: Add variable with names of SIOW libraries. - * mpw-make.sed: Add an action to build SIOWgdb. - -Wed Nov 8 19:25:22 1995 Stan Shebs - - * mpw-make.sed: Edit @ENABLE_CFLAGS@ out, mpw-configure can - add back in if necessary. - -Wed Nov 8 15:59:52 1995 James G. Smith - - * config/mips/vr4300.mt: Added simulator to default VR4300 build. - -Tue Nov 7 16:02:25 1995 Stu Grossman (grossman@cygnus.com) - - * remote-mips.c (mips_initialize): Fix brain damage found by - Jamie. Basically had case statement in the wrong place... - * (mips_load): Remove unnecessary `db tty0' command. It's all - handled by mips_initialize now. - -Tue Nov 7 12:59:14 1995 Raymond Jou - - * mac-gdb.r: Added #ifdef Macgdb. - -Tue Nov 7 14:59:51 1995 James G. Smith - - * remote-mips.c (mips_initialize): Updated to talk to VR4300 RISQ - monitor board. - -Mon Nov 6 11:44:11 1995 James G. Smith - - * config/mips/{tm-vr4300.h tm-vr4300el.h} (TARGET_MONITOR_PROMPT): - Change into real strings. - - * remote-sim.c (gdbsim_open): Moved sim_open() call to after - callback initialisation. - -Sun Nov 5 00:07:52 1995 Jason Molenda (crash@phydeaux.cygnus.com) - - * configure.in (AC_CHECK_HEADERS): add stddef.h. - -Fri Nov 3 12:30:43 1995 Fred Fish - - * Makefile.in (COMMON_OBS): Use corefile.o rather than core.o - * core.c: Rename to corefile.c. - * config/pyr/tm-pyr.h, umax-xdep.c, sun386-nat.c, pyr-xdep.c, - Makefile.in (SFILES), gould-xdep.c, coredep.c, armtdep.c, - arm-xdep.c, altos-xdep.c: Change core.c references to corefile.c. - - From Graham Stoney . - * Makefile.in (remote-array.o): Add rule to build. - (ALLDEPFILES): Add remote-array.c - * remote-array.c (baud_rate): Remove unnecessary declaration. - (baudrate): Remove. - (array_files_info): Print global baud_rate not baudrate. - -Sat Nov 4 10:21:58 1995 Stu Grossman (grossman@cygnus.com) - - * Makefile.in (INTERNAL_CFLAGS): Add ENABLE_CFLAGS. - * fork-child.c (fork_inferior): Add call to - TARGET_CREATE_INFERIOR_HOOK to allow target specific code to get - control just before the new process executes it's first instruction. - * remote-mips.c (mips_initialize): Cleanup a bit. Don't try to - receive a packet at first. This speeds up initialization a lot. - Use TARGET_MONITOR_PROMPT instead of "". - (common_breakpoint): Use rresponse instead of rerrflg to inspect - error code. - * symfile.c (syms_from_objfile reread_symbols): Call - TARGET_SYMFILE_POSTREAD to allow target specific code to get - control after reading new symbols. - * target.h: New macros TARGET_SYMFILE_POSTREAD, and - TARGET_CREATE_INFERIOR_HOOK. See above for descriptions. - * config/mips/{irix5.mh nm-irix5.h}: Delete nm-irix5.h. Make - NAT_FILE point directly at ../nm-sysv4.h. - * config/mips/{mipsm3.mh nm-m3.h}: Delete nm-m3.h. Make - NAT_FILE point directly at ../nm-m3.h. - * config/mips/{mipsv4.mh nm-sysv4.h}: Delete nm-sysv4.h. Make - NAT_FILE point directly at ../nm-sysv4.h. - * config/mips/nm-mips.h: Improve comment at top of file. - * config/mips/tm-mips.h (TARGET_MONITOR_PROMPT): Change - definition into a proper string. - -Wed Nov 1 20:18:08 1995 Fred Fish - - * config/i386/tm-i386.h: New file containing generic i*86 target - definitions. - (TARGET_BYTE_ORDER): Moved here from tm-i386v.h. - (IEEE_FLOAT): Moved here from tm-i386v.h. - (START_INFERIOR_TRAPS_EXPECTED): Define default as 2. - (FUNCTION_START_OFFSET): Moved here from tm-i386v.h. - (SKIP_PROLOGUE): Moved here from tm-i386v.h. - (SAVED_PC_AFTER_CALL): Moved here from tm-i386v.h. - (INNER_THAN): Moved here from tm-i386v.h. - (BREAKPOINT): Moved here from tm-i386v.h. - (DECR_PC_AFTER_BREAK): Moved here from tm-i386v.h. - (ABOUT_TO_RETURN): Moved here from tm-i386v.h. - (REGISTER_SIZE): Moved here from tm-i386v.h. - (NUM_REGS): Moved here from tm-i386v.h. - (REGISTER_NAMES): Moved here from tm-i386v.h. - (EXTRACT_STRUCT_VALUE_ADDRESS): Moved here from tm-i386v.h. - (FP_REGNUM): Moved here from tm-i386v.h. - (SP_REGNUM): Moved here from tm-i386v.h. - (PC_REGNUM): Moved here from tm-i386v.h. - (PS_REGNUM): Moved here from tm-i386v.h. - (FP0_REGNUM): Moved here from tm-i386aix.h. - (FPC_REGNUM): Moved here from tm-sun386.h. - (REGISTER_BYTES): Moved here from tm-i386aix.h. - (REGISTER_BYTE): Moved here from tm-i386aix.h. - (REGISTER_RAW_SIZE): Moved here from tm-i386aix.h. - (MAX_REGISTER_RAW_SIZE): Moved here from tm-i386aix.h. - (REGISTER_VIRTUAL_SIZE): Moved here from tm-i386aix.h. - (MAX_REGISTER_VIRTUAL_SIZE): Moved here from tm-i386aix.h. - (EXTRACT_RETURN_VALUE): Moved here from tm-i386aix.h. - (STORE_RETURN_VALUE): Moved here from tm-i386aix.h. - (REGISTER_VIRTUAL_TYPE): Moved here from tm-i386v.h. - (STORE_STRUCT_RETURN): Moved here from tm-i386v.h. - (FRAME_CHAIN): Moved here from tm-i386v4.h. - (FRAMELESS_FUNCTION_INVOCATION): Moved here from tm-i386v4.h. - (FRAME_SAVED_PC): Moved here from tm-i386os9k.h - (FRAME_ARGS_ADDRESS): Moved here from tm-i386v.h. - (FRAME_LOCALS_ADDRESS): Moved here from tm-i386v.h. - (FRAME_NUM_ARGS): Moved here from tm-i386sun.h. - (FRAME_ARGS_SKIP): Moved here from tm-i386v.h. - (FRAME_FIND_SAVED_REGS): Moved here from tm-i386v.h. - (PUSH_DUMMY_FRAME): Moved here from tm-i386v.h. - (POP_FRAME): Moved here from tm-i386v.h. - (CALL_DUMMY, CALL_DUMMY_LENGTH, CALL_DUMMY_START_OFFSET, - CALL_DUMMY_BREAKPOINT_OFFSET, FIX_CALL_DUMMY): Moved here from - tm-i386v.h - (print_387_control_word, print_387_status_word): Declare prototypes. - (struct frame_info, struct frame_saved_regs): Forward decls for - prototypes. - (SP_ARG0): Moved here from tm-i386v.h. - - * config/i386/tm-i386v.h: - (i386/tm-i386.h): Include. - (TARGET_BYTE_ORDER): Remove. - (IEEE_FLOAT): Remove. - (START_INFERIOR_TRAPS_EXPECTED): Undef before redefine to 4. - (FUNCTION_START_OFFSET): Remove. - (SKIP_PROLOGUE): Remove. - (i386_skip_prologue): Remove prototype. - (SAVED_PC_AFTER_CALL): Remove. - (INNER_THAN): Remove. - (BREAKPOINT): Remove. - (DECR_PC_AFTER_BREAK): Remove. - (ABOUT_TO_RETURN): Remove. - (REGISTER_SIZE): Remove. - (NUM_REGS): Undef before redefine to 16 (no FP support). - (REGISTER_NAMES): Undef before redefine. - (FP_REGNUM, SP_REGNUM, PC_REGNUM, PS_REGNUM): Remove. - (REGISTER_BYTES): Undef before redefine. - (REGISTER_BYTE): Undef before redefine. - (REGISTER_RAW_SIZE): Undef before redefine. - (REGISTER_VIRTUAL_SIZE): Undef before redefine. - (MAX_REGISTER_RAW_SIZE): Undef before redefine. - (MAX_REGISTER_VIRTUAL_SIZE): Undef before redefine. - (REGISTER_VIRTUAL_TYPE): Undef before redefine. - (STORE_STRUCT_RETURN): Undef before redefine. - (EXTRACT_RETURN_VALUE): Undef before redefine. - (STORE_RETURN_VALUE): Undef before redefine. - (EXTRACT_STRUCT_VALUE_ADDRESS): Remove. - (FRAME_CHAIN): Undef before redefine. - (FRAMELESS_FUNCTION_INVOCATION): Undef before redefine. - (FRAME_SAVED_PC): Undef before redefine. - (FRAME_ARGS_ADDRESS): Remove. - (FRAME_LOCALS_ADDRESS): Remove. - (FRAME_NUM_ARGS): Undef before redefine. - (FRAME_ARGS_SKIP): Remove. - (FRAME_FIND_SAVED_REGS): Remove. - (PUSH_DUMMY_FRAME): Remove. - (POP_FRAME): Remove. - (CALL_DUMMY): Remove. - (CALL_DUMMY_LENGTH): Remove. - (CALL_DUMMY_START_OFFSET): Remove. - (CALL_DUMMY_BREAKPOINT_OFFSET): Remove - (FIX_CALL_DUMMY): Remove. - (print_387_control_word): Remove. - (print_387_status_word): Remove. - (SP_ARG0): Remove. - - * config/i386/tm-symmetry.h: - (TM_SYMMETRY_H): Enclose file in test for define & define if needed. - (START_INFERIOR_TRAPS_EXPECTED): Move to after inclusion of - tm-i386v4.h or tm-i386v.h, #undef, and #define back to 2. - (DECR_PC_AFTER_BREAK): Move to after inclusion of tm-i386v4.h - or tm-i386v.h, #undef, and #define to 0. - (MAX_REGISTER_RAW_SIZE): Remove. - (FRAME_CHAIN): Remove. - (FRAMELESS_FUNCTION_INVOCATION): Remove. - (FRAME_SAVED_PC): Remove. - (print_387_control_word, print_387_status_word): Remove prototypes. - - * config/i386/tm-ptx.h: - (TM_PTX_H): Enclose file in test for define & define if needed. - (START_INFERIOR_TRAPS_EXPECTED): Move to after inclusion of - tm-i386v4.h or tm-i386v.h, #undef, and #define back to 2. - (DECR_PC_AFTER_BREAK): Move to after inclusion of tm-i386v4.h - or tm-i386v.h, #undef, and #define to 0. - (SDB_REG_TO_REGNUM): Remove obsolete commented out define. - (print_387_control_word, print_387_status_word): Remove prototypes. - - * config/i386/tm-linux.h: - (TM_LINUX_H): Enclose file in test for define & define if needed. - (i386/tm-i386.h): Include instead of tm-i386v.h. - (START_INFERIOR_TRAPS_EXPECTED): Remove. - - * config/i386/tm-i386v4.h: - (TM_I386V4_H): Enclose file in test for define & define if needed. - (i386/tm-i386.h): Include instead of tm-i386v.h. - (START_INFERIOR_TRAPS_EXPECTED): Remove. - (FRAME_CHAIN): Moved to tm-i386.h. - (FRAMELESS_FUNCTION_INVOCATION): Moved to tm-i386.h. - (FRAME_SAVED_PC): Remove. - (sigtramp_saved_pc): Define as i386v4_sigtramp_saved_pc. - (FRAME_NUM_ARGS): Remove. - - * config/i386/tm-i386os9k.h: - (TM_I386OS9K_H): Enclose file in test for define & define if needed. - (i386/tm-i386.h): Include instead of tm-i386v.h. - (START_INFERIOR_TRAPS_EXPECTED): Remove. - (NUM_REGS): Undefine before redefining. - (FRAME_CHAIN): Remove. - (FRAMELESS_FUNCTION_INVOCATION): Remove. - (FRAME_SAVED_PC): Move to tm-i386.h. - - * config/i386/tm-i386nw.h: - (TM_I386NW_H): Enclose file in test for define & define if needed. - (i386/tm-i386.h): Include instead of tm-i386v.h. - (START_INFERIOR_TRAPS_EXPECTED): Remove. - - * config/i386/tm-i386bsd.h: - (TM_I386BSD_H): Enclose file in test for define & define if needed. - (i386/tm-i386.h): Include instead of tm-i386v.h. - (START_INFERIOR_TRAPS_EXPECTED): Remove. - (FRAMELESS_FUNCTION_INVOCATION): Remove. - (FRAME_SAVED_PC): Remove. - - * config/i386/tm-i386aix.h: - (i386/tm-i386.h): Include instead of tm-i386v.h. - (START_INFERIOR_TRAPS_EXPECTED): Remove. - (FP_REGNUM): Remove. - (SP_REGNUM): Remove. - (PC_REGNUM): Remove. - (PS_REGNUM): Remove. - (FP0_REGNUM): Moved to tm-i386.h. - (NUM_REGS): Remove. - (REGISTER_NAMES): Remove. - (REGISTER_BYTES): Moved to tm-i386.h. - (REGISTER_BYTE): Moved to tm-i386.h. - (REGISTER_RAW_SIZE): Moved to tm-i386.h. - (MAX_REGISTER_RAW_SIZE): Moved to tm-i386.h. - (REGISTER_VIRTUAL_SIZE): Moved to tm-i386.h. - (REGISTER_VIRTUAL_TYPE): Removed. - (EXTRACT_RETURN_VALUE): Moved to tm-i386.h. - (STORE_RETURN_VALUE): Moved to tm-i386.h. - - * config/i386/tm-sun386.h: - (TM_SUN386_H): Enclose file in test for define & define if needed. - (i386/tm-i386.h): Include. - (TARGET_BYTE_ORDER): Remove. - (FUNCTION_START_OFFSET): Remove. - (SKIP_PROLOGUE): Remove. - (SAVED_PC_AFTER_CALL): Remove. - (INNER_THAN): Remove. - (BREAKPOINT): Remove. - (DECR_PC_AFTER_BREAK): Remove. - (ABOUT_TO_RETURN): Remove. - (REGISTER_SIZE): Remove. - (NUM_REGS): Undefine before defining. - (REGISTER_NAMES): Undefine before redefining. - (REGISTER_BYTES): Undefine before redefining. - (REGISTER_BYTE): Undefine before defining. - (FP_REGNUM): Undefine before defining. - (PC_REGNUM): Undefine before defining. - (FPC_REGNUM): Undefine before defining. - (REGISTER_RAW_SIZE): Undefine before defining. - (FRAME_CHAIN): Undefine before defining. - (FRAMELESS_FUNCTION_INVOCATION): Undefine before defining. - (FRAME_SAVED_PC): Undefine before defining. - (FRAME_NUM_ARGS): Moved to tm-i386.h. - (MAX_REGISTER_RAW_SIZE): Remove. - (MAX_REGISTER_VIRTUAL_SIZE): Remove. - (STORE_STRUCT_RETURN): Remove. - (EXTRACT_STRUCT_VALUE_ADDRESS): Remove. - (FRAME_ARGS_ADDRESS): Remove. - (FRAME_LOCALS_ADDRESS): Remove. - (FRAME_NUM_ARGS): Undefine before defining. - (FRAME_ARGS_SKIP): Remove. - (FRAME_FIND_SAVED_REGS): Remove. - (PUSH_DUMMY_FRAME): Remove. - (POP_FRAME): Remove. - (CALL_DUMMY, CALL_DUMMY_LENGTH, CALL_DUMMY_START_OFFSET): Remove. - (struct frame_info, struct frame_saved_regs): Remove forward decls - for prototypes. - - * config/i386/tm-i386lynx.h (i386/tm-i386.h): Include instead of - tm-i386v.h. - * config/i386/tm-i386m3.h (i386/tm-i386.h): Include instead of - tm-i386v.h. - - * i386-tdep.c (i386_extract_return_value): Make function visible - for all i386 targets, but only assume floating point values returned - in floating point registers for I386_AIX_TARGET. - - * i386v-nat.c (i386_register_u_addr): Enable code to locate - floating point regs in user struct. - -Wed Nov 1 15:32:57 1995 Fred Fish - - * breakpoint.c (breakpoint_re_set): Fix typo in comment. - * symtab.c (in_prologue): Document func_start and when it is zero - don't call SKIP_PROLOGUE (which typically leads unconditionally to - an error when we try to access a prologue at address 0). - -Tue Oct 31 13:01:15 1995 Fred Fish - - * elfread.c: Include elf-bfd.h rather than libelf.h. - -Tue Oct 31 10:42:42 1995 steve chamberlain - - * win32-nat.c (xlate_exception): Treat a stack overflow like a SEGV. - -Sun Oct 29 11:22:05 1995 Fred Fish - - * monitor.c: Include gnu-regex.h rather than system regex.h. - -Sat Oct 28 23:51:48 1995 steve chamberlain - - * defs.h: Test on name __WIN32__ rather than WIN32. - * inflow.c (new_tty): Likewise - * terminal.h: Likewise. - * utils.c (initialize_utils): Likewise. - * win32-nat.c (child_create_inferiror): Print error code when failing. - * config/i386/win32.mh (XM_CLIBS): Need -lkernel32. - -Sat Oct 28 04:52:36 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * symtab.h (enum address_class): Add LOC_UNRESOLVED for - a location whose address has to be resolved via the minimal - symbol table. - * buildsym.c (finish_block), findvar.c (symbol_read_needs_frame, - read_var_value), printcmd.c (address_info), - symmisc.c (print_symbol, print_partial_symbol): Handle - LOC_UNRESOLVED. - * stabsread.c (scan_file_globals): Change unresolved LOC_STATIC - symbols to LOC_UNRESOLVED. Remove rt_common_objfile lookup - kludge, global common symbols are now handled by LOC_UNRESOLVED. - (scan_file_globals_1): Move code back to scan_file_globals, - delete. - -Fri Oct 27 09:54:07 1995 Stu Grossman (grossman@cygnus.com) - - * breakpoint.c (breakpoint_re_set): #ifdef GET_LONGJMP_TARGET - around calls to create_longjmp_breakpoint. Why install the - breakpoints if we can't find the longjmp target? - * infrun.c (wait_for_inferior): Cleanup comments near call test. - * remote-mips.c: Fixed a bunch of prototypes to avoid char/int - complaint from picky compilers. Add comment to mips_expect. - Replace all instances of sr_get_debug with remote_debug. - * (mips_readchar): Don't jam init string to monitor. - mips_initialize() handles that. - * (mips_receive_header): Print better message when we get too - much garbage. - * (mips_request): Allow caller to pass in buff to allow them to - analyze the returned message. - * (mips_initialize): Re-do initialization to try sending a BREAK, - a ^C, and then a download escape sequence. Cleanup protocol - startup. Eliminate sleeps. Clear breakpoints (if using monitor - breakpoints). Re-init frame. - * (mips_detach): Close down target. - * (mips_wait): Handle return status with registers, or breakpoint stuff. - * (mips_kill): Add ^C handling. - * (mips_insert_breakpoint mips_remove_breakpoint): Call new - breakpoint stuff if enabled. - * (calculate_mask remote_mips_set_watchpoint - remote_mips_remove_watchpoint remote_mips_stopped_by_watchpoint): - Hardware watchpoint/breakpoint stuff. - * (common_breakpoint): Common code for new monitor breakpoint commands. - * (mips_load): Don't use `prompt'. It's a global variable. - * top.c (dont_repeat_command): New command for use in - user-defined commands to suppress auto-repeat (by hittin return key). - * valops.c: Add start of auto function-call abandonment capability. - - -Thu Oct 26 22:02:27 1995 Stan Shebs - - * mpw-config.in: Add support for PowerMac host, add beginnings - of native support. - * mpw-make.sed: Disable subdir recursion, edit out useless rule. - * mac-xdep.c (Values.h): Don't include. - (GestaltEqu.h): Include Gestalt.h instead. - (do_mouse_down): Comment out control tracking, needs to be - updated to use UPP before will work on PowerMac. - * config/xm-mpw.h: New file, all-Mac host support. - * config/m68k/xm-mpw.h: Move most definitions into generic Mac - support. - * config/powerpc/xm-mpw.h: New file, PowerMac host support. - -Thu Oct 26 15:21:32 1995 Brendan Kehoe - - * regex.h: Renamed to gnu-regex.h. - * regex.c: Renamed to gnu-regex.c. - * Makefile.in (POSSLIBS): Refer to gnu-regex.h and gnu-regex.c. - (REGEX, REGEX1): Change to gnu-regex.o instead of regex.o. - (regex.o): Renamed to gnu-regex.o; refer to gnu-regex.c. - (irix5-nat.o, osfsolib.o, gnu-regex.o, solib.o, source.o, symtab.o): - Likewise. - * irix5-nat.c, osfsolib.c, gnu-regex.c, solib.c, source.c, symtab.c): - Include "gnu-regex.h" instead of "regex.h". - * alpha-tdep.c (in_prologue): Rename to alpha_in_prologue, to - avoid conflicts with symtab.h. - -Tue Oct 24 18:30:18 1995 Jason Molenda (crash@phydeaux.cygnus.com) - - * config/pa/hppahpux.mh: Remove hardcoding of X locations. - * Makefile.in: Use X11_CFLAGS, X11_LDFLAGS and X11_LIBS. - * configure.in: Link X statically on Solaris, SunOS and HPUX. - -Tue Oct 24 12:26:14 1995 Stu Grossman (grossman@cygnus.com) - - * monitor.c (monitor_expect_regexp): Same as monitor_expect, but - with the obvious extension. - (monitor_read_memory_single): Use regexp for getmem.resp_delim - because of parsing ambiguities caused by certain monitors. - (monitor_read_memory): Use new regexp stuff to parse - getmem.resp_delim. - * monitor.h (struct memrw_cmd->resp_delim): Document this as a - regexp. - * sh3-rom.c: Finish off table. Use new regexp capability for - getmem commands. - - * infrun.c (wait_for_inferior): Disable questionable code near - the step range test. Replace call detection test with much - simpler (and more efficient) test that doesn't require prologue - examination (as often). - * symtab.c symtab.h (in_prologue): New function that indicates - whether or not we are in a function prologue. This uses the - symbol table, and then falls back to prologue examination if that - fails. It's much more efficient for remote debugging because it - avoids examining memory, which is very slow. This is used in - wait_for_inferior to determine if we've made a function call that - needs to be skipped over (for next/nexti). - * mips-tdep.c (after_prologue): New function, returns the PC - after the prologue. Uses PDRs and the symbol table. - (mips_find_saved_regs): Use in_prologue() to avoid costly - prologue examination if possible. - (mips_skip_prologue): Use after_prologue() if possible to avoid - costly prologue examination. - -Mon Oct 23 16:03:33 1995 James G. Smith - - * configure.in (configdirs): Added support for the VR4300 default - builds (mips64*vr4300*el-*-elf*, mips64*vr4300*-*-elf*). - - * configure: Regenerated. - - * remote-mips.c (mips_load): Updated the prompt spotting code to - make use of the TARGET_MONITOR_PROMPT manifest. - -Sat Oct 21 06:11:49 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * alpha-tdep.c, mips-tdep.c (init_extra_frame_info): - Do not set saved registers from heuristics for a sigtramp frame. - - * dwarfread.c (enum_type): Determine signedness of enum type - from enumerators. - - * mips-tdep.c: Include gdb_string.h, gcc -Wall lint. - - * rs6000-nat.c (xcoff_relocate_core): Fix typo. - - * valops.c (value_repeat): Fix length of memory transfer to - match recent allocate_repeat_value change. - -Thu Oct 19 19:04:35 1995 Per Bothner - - * gdbtypes.c (get_discrete_bounds): Fix typo. - -Thu Oct 19 12:15:37 1995 Stan Shebs - - * defs.h (SEEK_SET, SEEK_CUR): Add default definitions. - * dbxread.c, mdebugread.c, os9kread.c (SEEK_SET, SEEK_CUR): - Remove default definitions. - - * Makefile.in (CC-LD): Rename to CC_LD, so MPW xform works. - (MMALLOC_SRC): Define. - (MMALLOC_CFLAGS): Use. - (ser-mac.o): Add rule. - * dwarfread.c, somread.c, ultra3-nat.c, xcoffread.c: Replace L_SET - with SEEK_SET in all calls to bfd_seek. - * scm-tags.h (scm_tags): Remove excess comma. - - * mpw-config.in: Adapt to work with autoconf'ed configury; - build config.h, add empty definitions to mk.tmp. - (powerpc-apple-macos): Make it work. - * mpw-make.sed: New file, sed commands to translate Unix makefile - into MPW syntax. - * mpw-make.in: Remove. - * mac-gdb.r: New file, was macgdb.r, renamed for consistency - with other tools, now includes cfrg resource. - * macgdb.r: Remove. - * config/m68k/xm-mpw.h: Remove most of contents, replace with - include of include/mpw/mpw.h. - -Tue Oct 17 10:38:53 1995 Jeffrey A Law (law@cygnus.com) - - * hppa-tdep.c (frame_chain): Fix more obscure problems caused - by system calls that core dump processes without saving all - the register state. - - * config/pa/hppahpux.mt (XDEPFILES): Remove bogus definition. - * config/pa/hppapro.mt (XDEPFILES): Likewise. - -Tue Oct 17 08:04:26 1995 Fred Fish - - * NEWS: Fix typo. - -Mon Oct 16 18:24:03 1995 Jim Wilson - - * config/sh/tm-sh.h (REGISTER_VIRTUAL_TYPE): Return builtin_type_float - for FP registers. - (REGISTER_NAMES): Add FP register names. Remove ticks, stalls, cycles, - insts, plr, and tlr. - (NUM_REGS, NUM_REALREGS): Increase from 23 to 41. - (FPUL_REGNUM, FP0_REGNUM): New macros. - -Mon Oct 16 11:27:06 1995 Stu Grossman (grossman@cygnus.com) - - * remote-mips.c: Add support for speedy (about 10x faster) - downloads. - - * remote-array.c: Move baud_rate initialization from - _initialize_array to array_open. It was forcing the baud rate of - all targets to be 4800 baud! Seems like I've fixed this before... - * config/mips/idt.mt (TDEPFILES): Remove remote-array.o. This - has *nothing* to do with IDT!!! - - - * Makefile.in sh3-rom.c config/sh/sh.mt config/sh/tm-sh.h: Add - sh3 monitor support. - * monitor.c: Cleanup regexp compilation stuff to make it easier - to use several regexps. - * monitor.h: Get rid of struct rom_cmd_data. It's no longer used. - * config/m68k/tm-monitor.h: Don't redefine NUM_REGS here. It just - causes GDB to crash. - - * sparcl-tdep.c: Cleanup serial error handling. - -Sun Oct 15 16:19:27 1995 Stan Shebs - - * rs6000-tdep.c: Don't include a.out.h, improve some formatting. - -Fri Oct 13 15:27:49 1995 Stu Grossman (grossman@cygnus.com) - - * dcache.c: Change default value of remotecache to off. It just - screws up too many targets. - * sparcl-stub.c: Add prototypes to many forward decls. - * Create private copies of strlen, strcpy, and memcpy to prevent - chaos when user steps into them. - * (trap_low handle_exception): Clean up DSU support code - (hardware breakpoints). Move lots of stuff from asm-land to - C-land (make it much easier to #ifdef if necessary). Also, use - trap 255 to get into break mode instead of doing a DSU register - write, which may trash the register. - * (putpacket): Don't check return value of putDebugChar. It - returns void... - -Fri Oct 13 14:16:17 1995 steve chamberlain - - * remote-sim.h: Always include callback.h. - (sim_set_callbacks): New declaration. - -Fri Oct 13 10:57:40 1995 Jeffrey A Law (law@cygnus.com) - - * somsolib.c (som_solib_add): Just give a warning if a file - mentioned in the dld_list can't be found. - * config/pa/tm-hppah.h (FRAME_SAVED_PC_IN_SIGTRAMP): Dig out - the PC from the PC queues rather than %r31. - -Thu Oct 12 13:36:15 1995 Jeffrey A Law (law@cygnus.com) - - * corelow.c (core_open): Don't update the to_sections and - to_sections_end fields in core_ops here. It's too late. - * irix5-nat.c (solib_add): Update the to_sections and - to_sections_end fields in core_ops here if needed. - * osfsolib.c (solib_add): Likewise. - * rs6000-nat.c (xcoff_relocate_core): Likewise. - * solib.c (solib_add): Likewise. - * somsolib.c (solib_add): Likewise. - -Wed Oct 11 17:25:59 1995 Fred Fish - - * Makefile.in (VERSION): Bump version to 4.15.1 - -Tue Oct 10 15:26:39 1995 Fred Fish - - * Makefile.in (VERSION): Version 4.15 released. - * README: Updated for version 4.15. - * NEWS: Updated for 4.15 release. - -Tue Oct 10 13:18:50 1995 Fred Fish - - * configure.in: Add AC_PROG_YACC - * configure: Regenerate - * Makefile.in (BISON): Remove macro definition. - (YACC): Set from autoconfig. - (FLAGS_TO_PASS): Remove BISON. - (TARGET_FLAGS_TO_PASS): Remove BISON. - -Tue Oct 10 12:25:11 1995 steve chamberlain - - * win32-nat.c (child_create_inferior): Pass argv correctly. - * Makefile.in (win32-nat.o): Add dependencies. - -Mon Oct 9 14:36:29 1995 steve chamberlain - - * NEWS: Add information about win32 and arm code. - * win32-nat.c: Renamed from win32.c. - * config/i386/win32.mh: Renamed from config/i386/i386win32.mh. - * config/i386/win32.mt: Renamed from config/i386/i386win32.mt. - * config/i386/tm-win32.h: Renamed from config/i386/tm-i386win32.h. - * config/i386/xm-win32.h: Renamed from config/i386/xm-i386win32.h. - * configure.in (i[345]86-*-win32): Updated to cope with filename - changes. - * configure: Regenerated. - -Sun Oct 8 18:01:04 1995 Per Bothner - - * ch-exp.y (yylex): Also look for '$' following '$'. - -Sat Oct 7 22:52:42 1995 Michael Meissner - - * ch-exp.y (yylex): Fix typo. - -Fri Oct 6 11:56:49 1995 Jim Wilson - - * remote-sim.c (gdbsim_open): Put callback initializations here. - (_initalize_remote_sim): Not here. - -Fri Oct 6 17:08:49 1995 Stan Shebs - - * top.c (execute_control_command): Use 0/1 instead of BFD's - true/false. - -Fri Oct 6 14:43:19 1995 Stu Grossman (grossman@cygnus.com) - - * sparcl-stub.c: Include sparclite.h to get access to register - fondling macros. - * (trap_low): Save and restore FP regs if necessary. Also, clean - up save and restore of debug unit regs. - * (hard_trap_info): Add more architecturally defined traps. - * (set_debug_traps): Only set FP disabled trap if FP is disabled. - * (get_in_break_mode): Clean up. Get rid of calls to - set_hw_breakpoint_trap(). Also, use write_asi macro. - * (handle_exception): Clean up `g' and `G' commands. Add `P' - command. - * (hw_breakpoint): Why was this here!? It's gone now... - -Fri Oct 6 11:56:49 1995 Jim Wilson - - * callback.c (fdbad): Fix typo in comment. - (os_close, os_isatty, os_lseek, os_read, os_write): Use if - statements rather than || to get correct return value. - (os_write_stdout): Pass missing first argument to os_write. - * remote-sim.c: Include callback.h. - (_initialize_remote_sim): Call sim_set_callbacks and then - initialize the callbacks. - -Thu Oct 5 17:28:09 1995 Per Bothner - - * values.c (allocate_repeat_value): Allocate an array type, and - a value of that type; use that instead of setting VALUE_REPEATED. - * value.h (struct value): Remove fields repetitions and repeated. - (VALUE_REPEATED, VALUE_REPETITIONS): Removed, no longer used. - * c-valprint.c, ch-valprint.c, eval.c, printcmd.c, valops.c, - value.h, values.c: Simplify, since now VALUE_REPEATED is never - used. - * valprint.c (value_print_array_elemen): Removed never-used - function. - -Thu Oct 5 15:14:36 1995 Per Bothner - - * parse.c (write_dollar_variable): New function. - - * c-exp.y (yylex): Replace code for recognizing '$' - pseudo-variables with a call to write_dollar_variable. - Simplify grammar correspondingly. - * f-exp.y: Likewise. - * m2-exp.y: Likewise. - * ch-exp.y: Likewise. (Remove function match_dollar_tokens.) - * scm-exp.c (scm_lreadr): Call write_dollar_variable to handle '$'. - -Thu Oct 5 13:27:30 1995 steve chamberlain - - * win32.c: New file; support for debugging on windows NT. - * configure.in: (i[345]86-*-win32): New target. - * configure: Regnerated. - * eval.c (evaluate_subexp_standard): Remove unused name. - * serial.c (gdb_string.h): Include. - * source.c (value.h): Include. - * config/i386/i386win32.mh (XDEPFILES): Add win32.o - * config/i386/i386win32.mt: New. - * config/i386/tm-i386win32.h: New. - -Wed Oct 4 18:41:34 1995 Per Bothner - - * expression.h (enum exp_code): Added OP_NAME. - * expprint.c (print_subexp): Add OP_NAME support. - * parse.c (length_of_subexp, prefixify_subexp): Likewise. - * scm-lang.c (scm_unpack, in_eval_c, scm_lookup_name): new function. - * scm-lang.h: Declare builtin_type_scm; other minor tweaks. - * values.c (unpack_long): If type is SCM, call scm_unpack. - * scm-valprint.c (scm_val_print): Use extract_signed_integer, - instead unpack_long - * scm-lang.c: More Scheme expression parsing from here ... - * scm-exp.c: ... to here. New file. - Also, provide for gdb to evaluate simple constants and names.. - * Makefile.in: Note new scm-exp.{c,o}. - -Wed Oct 4 17:23:03 1995 Per Bothner - - * gdbtypes.c (get_discrete_bounds): New function. - (force_to_range_type): Use get_discrete_bounds. - * gdbtypes.h (get_discrete_bounds): Add declaration. - * valarith.c (value_bit_index): Generalize to use get_discrete_bounds. - * ch-valprint.c (chill_val_print): Make (power)sets and bitstring - support use get_discrete_bounds and generally be more robust. - -Tue Oct 3 16:54:56 1995 Stan Shebs - - * remote-nrom.c (nrom_ops): Add value for to_thread_alive, - add comments naming slots. - -Mon Oct 2 21:45:44 1995 Jeff Law (law@hurl) - - * top.c (build_command_line): Demand arguments for if/while - commands. - -Mon Oct 2 13:08:01 1995 Jason Molenda (crash@phydeaux.cygnus.com) - - * Makefile.in (X11_CFLAGS): Set only to @X_INCDIR@. - -Sat Sep 30 16:13:36 1995 Per Bothner - - * scm-lang.c: Moved Scheme value printing code to ... - * scm-valprint.c: ... this new file. - Also major improvements in support for printing SCM values. - * scm-lang.h: New file. - * scm-tags.h: New file. - * Makefile.in: Note new scm-valprint.{c,o}. - -Sat Sep 30 09:35:02 1995 Jason Molenda (crash@phydeaux.cygnus.com) - - * configure.in: X_INCDIR and X_LIBDIR added. - * Makefile.in: @X_INCDIR@ and @X_LIBDIR@ added. - * configure: Regnerated. - -Fri Sep 29 02:10:05 1995 steve chamberlain - - * config/arm/tm-arm.h (FRAME_CHAIN, FRAME_CHAIN_VALID): - Any pc > LOWESTPC is ok. - - * remote-rdp.c (rdp_init): Take out variable baud rate stuff. - (remote_rdp_detatch): Delete. - * breakpoint.c (ctype.h): Don't include twice. - - * Makefile.in (remote-rdp.o): Doesn't need remote-rdp.h - * callback.c (os_printf_filtered): fix protos. - * defs.h (puts_filtered, puts_unfiltered - [v|f|]printf_[un]filtered): Make format arg const. - * remote-rdp.c (rdp_init): Attept to sync at different - baudrates. - * utils.c (puts_filtered, puts_unfiltered - [v|f|]printf_[un]filtered): Define prototypes with - const in the right place. - -Thu Sep 28 17:43:39 1995 Per Bothner - - * defs.h (enum language): Add language_scm. - * expression.h (enum exp_code): Added OP_EXPRSTRING. - * scm-lang.c: Preliminary support for Guile /SCM dialect of Scheme. - * expprint.c (print_subexp): Add OP_EXPRSTRING support. - * parse.c (length_of_subexp, prefixify_subexp): Likewise. - * valops.c (find_function_in_inferior): New function. - (value_allocate_space_in_inferior): New function. - (allocate_space_in_inferior): Redefine using previous function. - * Makefile.in (SFILES): Add scm-lang.c. - (COMMON_OBS): Add scm-lang.o - -Thu Sep 28 14:32:11 1995 steve chamberlain - - * callback.[ch]: New files. - * remote-rdp.c: Support for the ARM RDP monitor. - * Makefile: Update. - * arm-tdep.c (arm_othernames): New. - (_initialize_arm_tdep): install 'othernames' command. - (arm_nullified_insn, shifted_reg_val, arm_get_next_pc): New. - * configure.in: Check for termios.h, termio.h and sgtty.h. - (i[345]86-*-win32*): New host. - * configure: Regenerated. - * inflow.c: Clean up inclusions. - * main.c (main): Check for WINGDB, not WIN32. - * printcmd.c (do_examine): Put QUIT test in loop. - * remote-hms.c (e7000_load): Delete. - (hms_ops): Point to generic_load instead. - * remote-hms.c (hms_ops): Point to generic_load. - * remote-sim.c (sim_callback_write_stdout): Becomes - gdbsim_write_stdout. - (gdbsim_load): Call generic_load. - * remote-utils.c (gr_load_image): Delete. - * ser-unix.c (terminal.h): Include instead of havig - own #if tree. - (hardwire_flush_input): Reset input buffer too. - * source.c (openp): If WIN32 then open file in binary mode. - * terminal.h: Configure IO mechanism using autoconf defines if - available and not overriden. - * utils.c (quit, pollquit, notice_quit): WIN32 check becomes - WINGDB check. - - * config/arm/arm.mt (TDEPFILES): Add remote-rdp.o. - * config/arm/tm-arm.h (TARGET_BYTE_ORDER): becomes - TARGET_BYTE_ORDER_SELECTABLE. - (ADDR_BITS_REMOVE): New. - (ORIGINAL_REGISTER_NAMES, ADDITIONAL_REGISTER_NAMES): New. - (INST_xx): New. - (FRAME_FIND_SAVED_REGS): Pass the right argument. - (arm_get_next_pc): Declare. - -Wed Sep 27 10:14:36 1995 Per Bothner - - * valops.c (search_struct_field): Also allow "else" as a variant - name. - * eval.c (evaluate_struct_tuple): New function. Used to evaluate - structure tuples. Now also handles Chill variant records. - (get_label): New function, used by evaluate_struct_tuple. - (evaluate_subexp_standard case OP_ARRAY): Use evaluate_struct_tuple. - (evaluate_labeled_field_init): Removed. - - * valops.c (search_struct_field): Generalize to work with Chill - variant records. - -Sat Sep 23 01:22:23 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * mdebugread.c (parse_partial_symbols): Reset includes_used - and dependencies_used after finishing the partial symbol table. - - * rs6000-tdep.c (push_dummy_frame): Handle lr_offset of zero - correctly. - - * rs6000-nat.c (xcoff_relocate_core): Don't relocate data - addresses for the main objfile if DONT_RELOCATE_SYMFILE_OBJFILE - is defined. - * xcoffread.c: gcc -Wall lint. Remove traceback table reading - code. The existing code tried to add parameter information for - functions compiled without -g, which cannot be done properly - for optimized code and produced misleading parameter displays. - (ef_complaint, eb_complaint): Make a local static copy to avoid - dependency on coffread.c. - (read_xcoff_symtab, process_xcoff_symbol, scan_xcoff_symtab): - Enter C_EXT/C_HIDEXT symbols into the minimal symbol table only. - (read_xcoff_symtab): Ignore C_STAT section auxiliary entry - symbols. Complain about unmatched .ef and .eb symbols instead of - segfaulting. - (process_xcoff_symbol): Determine value of C_GSYM symbols via - the global_sym_chain mechanism in stabsread.c. - (xcoff_new_init): Call stabsread_new_init and buildsym_new_init. - (init_string_tab): Initialize length field bytes in the strtbl. - (scan_xcoff_symtab): Skip symbols that start with `$' or `.$'. - Set first_fun_line_offset for symbols with two auxents only. - -Wed Sep 20 21:06:35 1995 Jeff Law (law@snake.cs.utah.edu) - - * op50-rom.c (op50n_cmds): Send ".\r" after the interrupt - character. - -Wed Sep 20 13:12:56 1995 Ian Lance Taylor - - * Makefile.in (maintainer-clean): New target, synonym for - realclean. Add GNU standard maintainer-clean echos. - * gdbserver/Makefile.in (maintainer-clean): New target, synonym - for realclean. - * nlm/Makefile.in (maintainer-clean): Likewise. - -Wed Sep 20 08:16:03 1995 steve chamberlain - - * defs.h (xmalloc, xrealloc): Delete, they're declared in libiberty.h. - (GETENV_PROVIDED, FCLOSE_PROVIDED): New. - * doc/gdbint.texinfo (GETENV_PROVIDED, FCLOSE_PROVIDED): Document. - * remote-sim.[ch] (sim_callback_write_stdout): New. - -Tue Sep 19 15:28:58 1995 Per Bothner - - * gdbtypes.c (create_set_type): Set TYPE_LENGTH in bytes, not bits. - * valops.c (value_bitstring): TYPE_LENGTH is bytes, not bits. - - * gdbtypes.c (force_to_range_type): Calculate upper limit of - TYPE_CODE_CHAR depending on TYPE_LENGTH (instead of just using 255). - -Mon Sep 18 01:43:42 1995 Jeff Law (law@snake.cs.utah.edu) - - * somsolib.c (auto_solib_add_at_startup): Delete definition. No - longer needed. - -Sat Sep 16 13:23:36 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * config/mips/tm-mips.h (UNUSED_REGNUM): Define. - * mipsv4-nat.c (supply_gregset): Fill UNUSED_REGNUM register - with zero. - -Thu Sep 14 17:35:24 1995 Stu Grossman (grossman@cygnus.com) - - * remote-sim.c (gdbsim_create_inferior): Back out change that - broke all simulator configurations except the rs6000. - -Thu Sep 14 14:44:59 1995 Jeffrey A. Law - - * monitor.c (monitor_expect): Discard NULL characters. - -Thu Sep 14 14:12:30 1995 Kung Hsu - - * infcmd.c: Add extern declaration for auto_solib_add_at_startup. - -Wed Sep 13 13:33:58 1995 Kung Hsu - - * symfile.c: Move global variable auto_solib_add_at_startup from - solib.c to symfile.c. - * solib.c: ditto. - * symfile.h: Add extern declaration of the above mentioned variable. - * infcmd.c: Take out extern declaration, since it's in symfile.h. - -Thu Sep 14 12:39:35 1995 Stu Grossman (grossman@cygnus.com) - - * coffread.c (coff_symtab_read): Complain about unmatched .ef and - .eb symbols instead of segfaulting. - -Wed Sep 13 13:33:58 1995 Kung Hsu - - * stabsread.c (read_one_struct_field): Use subfile language instead of - global language. Improve efficiency. - -Wed Sep 13 08:45:02 1995 Jeff Law (law@fast.cs.utah.edu) - - * somsolib.c (auto_solib_add_at_startup): Define new global variable. - (som_solib_create_inferior_hook): Don't add libraries if - auto_solib_add_at_startup is zero. - (_initialize_som_solib): Add command to toggle - auto_solib_add_at_startup. - -Tue Sep 12 19:37:24 1995 Jeff Law (law@snake.cs.utah.edu) - - * monitor.c (monitor_make_srec): Fix thinkos in computation - of addr_size. - -Tue Sep 12 15:46:18 1995 Kung Hsu - - * stabsread.c (read_one_struct_field): Add a patch to handle cfront - generated stabs that each field is in full mangled name. - - * stabsread.c: To include language.h and expression.h for the reason - above. - - * infcmd.c (attach_command): Add solibs only when - auto_solib_add_at_startup is set. - -Mon Sep 11 17:22:35 1995 Fred Fish - - * NEWS: Add information about remote target caching. - -Sun Sep 10 15:36:21 1995 Fred Fish - - * defs.h: Only include mmalloc.h if NO_MMALLOC is not - defined. - -Sun Sep 10 10:24:48 1995 Michael Tiemann - - * tm-ppc-eabi.h (PC_IN_CALL_DUMMY): Redefine this to work with the - simulator. FIXME. - - * rs6000-tdep.c (push_dummy_frame): Calculate the correct link - register offset from the current frame (don't assume it is always 8). - (push_dummy_frame): Add comment about having only 4096 bytes of - stack space in the simulator (by default). - - * remote-sim.c (gdbsim_create_inferior): Call - `add_text_to_loadinfo' so that gdb can find TOC entries when - calling functions in the inferior. - -Sun Sep 10 09:00:28 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * sparc-tdep.c (fill_fpregset): Fix incorrect FP_MAX_REGNUM - substitution. - (supply_fpregset): Use FP_MAX_REGNUM. - -Sat Sep 9 08:21:52 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * stabsread.c (read_enum_type): Exit loop for putting pending - enum symbols into the enum type correctly if we had no pending - symbols on entry to read_enum_type. - -Fri Sep 8 12:57:41 1995 Kung Hsu - - * inferior.h: Add extern declaration of inferior_environ. - * solib.c (solib_map_sections): To get inferior's env instead of - gdb's for LD_LIBRARY_PATH, same for PATH. - - * solib.c (solib_map_sections): Copy full path name into so_list - structure so that symbol_file_add can find it. - -Tue Sep 5 17:47:53 1995 Doug Evans - - * config/sparc/tm-sp64.h (REGISTER_RAW_SIZE): Lower 32 fp regs - have size 4. - (REGISTER_VIRTUAL_SIZE): Likewise. - (REGISTER_VIRTUAL_TYPE): Lower 32 fp regs have type float. - Upper 32 fp regs have type double. - * sparc-tdep.c (NUM_SPARC_FPREGS): Replace with - (FP_REGISTER_BYTES): this, and update all uses. - (FP_MAX_REGNUM): Define if not already. - (get_saved_register): Handle new sparc64 fp regs. - (sparc_frame_find_saved_regs): Likewise. - (sparc_print_register_hook): Only print fp regs < 32 as doubles. - Add code to handle long doubles when gdb does. - (_initialize_sparc_tdep): Use print_insn_sparc64 if sparc64. - -Sat Sep 2 06:41:26 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * configure.in: Explicitly `exit 0' for broken shells. - * configure: Rebuilt. - - * symtab.c (list_symbols): Add missing blank after - `' output. - - * valops.c (value_assign): Handle truncation when assigning - to bitfields. Use value_copy to construct the return value - from toval. - * values.c (value_copy): Copy VALUE_FRAME and VALUE_OPTIMIZED_OUT. - -Fri Sep 1 08:25:50 1995 James G. Smith - - * configure (mips64*vr4300*-*-elf): Support added. - * remote-mips.c (mips_readchar): Change to allow build-time prompt - string. - * config/mips/tm-mips.h: Added TARGET_MONITOR_PROMPT. - * config/mips/{vr4300.mt, vr4300el.mt, tm-vr4300.h, - tm-vr4300el.h}: Added. - -Thu Aug 31 12:48:04 1995 Jim Wilson - - * config/sh/sh.mt (SIM): Add -lm. - -Wed Aug 30 18:10:57 1995 Kung Hsu - - * rmote-nindy.c (non_dle, nidy_resume, nindy_wait): Changes to - conform to GNU coding standards. - - * solib.c (match_main): Modify to follow GNU coding conventions. - -Mon Aug 28 17:07:26 1995 Kung Hsu - - * remote.c (remote_wait): Revert 19 July my change which should be - customer specific. - -Sat Aug 26 00:26:11 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * mdebugread.c (parse_symbol): Handle sh.value of zero for enums. - Determine signedness of enum type from enumerators. - (parse_type): Handle btIndirect types, handle fBitfield for - some non-member types. - (upgrade_type): Use TYPE_FLAG_TARGET_STUB for arrays with - unknown length. - (cross_ref): Handle stIndirect forward reference to btTypedef. - - * stabsread.c (read_enum_type): Determine signedness of enum - type from enumerators. - - * top.c (execute_command): Remove trailing whitespace from - command arguments, except for `set' and `complete' commands. - (validate_comname): Allow underscores in user defined command - names. - - * values.c (modify_field): Change `Value does not fit in %d bits' - error to a warning. Exclude sign extension bits of negative field - values from fit check. - -Fri Aug 25 11:31:29 1995 Michael Meissner - - * configure.in (powerpc*-*-eabisim*): Only link in the simulator - if the target is powerpc{,le}-*-eabisim*, since the simulator - needs GCC to build. - * config/powerpc/ppc{,le}-sim.mt: Cloned from ppc{,le}-eabi.mt. - * config/powerpc/ppc{,le}-eabi.mt: Remove simulator support. - * config/powerpc/tm-ppc{,le}-sim.mt: Include tm-ppc{,le}-sim.h. - -Wed Aug 23 16:55:35 1995 Michael Meissner - - * config/powerpc/ppc{,le}-eabi.mt (SIM_OBJS, SIM): Link in the - PowerPC simulator. - -Tue Aug 22 02:00:47 1995 Jeff Law (law@snake.cs.utah.edu) - - * tm-hppa.h (EXTRACT_RETURN_VALUE): Fix for FP values. - - * tm-hppa.h (STORE_RETURN_VALUE): Fix to work with -msoft-float - calling conventions too. Use the TYPE of the return value, not - its length to determine if it should also be copied into the - floating point registers. - - * tm-hppa.h (PROLOGUE_FIRSTLINE_OVERLAP): Delete. Causes more - problems than it fixes. - * hppa-tdep.c (skip_prologue): If we exit the main loop without - finding all the register saves, retry again without looking for - the registers we could not find the first time. - -Mon Aug 21 23:39:56 1995 Jeff Law (law@snake.cs.utah.edu) - - * hppa-tdep.c (frame_chain_valid): Handle systems where "$START$" - calls "main" directly. - (skip_prologue): Always assume arguments were saved into the stack - since GCC will do so without setting the magic Args_Saved bit in - the unwind descriptor. - -Mon Aug 21 11:49:17 1995 Kung Hsu - - * remote-udi.c (udi_wait): Mask off high bits of stop reason. - * remote-udi.c (fetch_register): For unfetchable regs, pretend it's - done. Fix a bug. - -Mon Aug 21 00:45:17 1995 Jeff Law (law@snake.cs.utah.edu) - - * Makefile.in (install): Remove "brokensed" hack, unnecessary now - that we're using autoconf. - (uninstall): Likewise. - - -Sat Aug 19 01:19:34 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * gdbtypes.c (recursive_dump_type): Add dont_print_type_obstack - to inhibit infinite recursion when printing aggregate types. - -Fri Aug 18 17:48:55 1995 steve chamberlain - - * dcache.c (dcache_write_line): Write dirty lines right. - -Fri Aug 18 06:26:56 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * sparc-tdep.c (isbranch): Fix typo which caused wrong - target addresses for annulled branches. - -Wed Aug 16 21:54:39 1995 Jeff Law (law@snake.cs.utah.edu) - - * config/pa/tm-hppa.h (PROLOGUE_FIRSTLINE_OVERLAP): Define. - -Tue Aug 15 07:51:21 1995 steve chamberlain - - * remote.c (remote_write_bytes): Chop up large transfers. - -Mon Aug 14 17:56:36 1995 Stan Shebs - - * gcc.patch: Remove, relevant only to long-ago versions of GCC. - -Mon Aug 14 13:43:01 1995 Kung Hsu - - * config/sparc/tm-sparclite.h: Define FRAME_CHAIN_VALID_ALTERNATE. - * blockframe.c (inside_main_func): If main func addr range not set, - try to set it now. - -Sat Aug 12 15:34:54 1995 Jeffrey A. Law - - * config/powerpc/xm-aix.h (FIVE_ARG_PTRACE): Define. - * config/rs6000/xm-rs6000.h (FIVE_ARG_PTRACE): Likewise. - - * configure.in: Recognize aix4 specially as some aspects - of aix4 need different handling than aix3. - * configure: Updated. - * config/powerpc/{aix4.mh,aix4.mt,tm-ppc-aix4.h}: New files - specific to aix4 support on the power pc. - * config/powerpc/tm-ppc-aix.h (DONT_RELOCATE_SYMFILE_OBJFILE): Do - not defined. The aix4 specific target files will do that. - * config/rs6000/{aix4,mh,aix4,mt,tm-rs6000-aix4.h}: New files - specific to aix4 support on the rs6000. - - * config/rs6000/tm-rs6000.h (CONVERT_FROM_FUNC_PTR_ADDR): Don't - do the conversion if the pointer is not a magic aix function - pointer. - * rs6000-tdep.c: Include objfiles.h and symtab.h. - (is_magic_function_pointer): New function. - - * rs6000-tdep.c (skip_prologue): Refine check for frameless - functions. Handle b .+4 emitted by aix4 compilers. Only - allow one load of a minimal toc pointer. Handle aix4 compiler's - code for alloca. - - * rs6000-tdep.c (find_toc_address): Report an error if no toc was - found rather than possibly core dumping. - - * partial-stab.h: Handle extra field generated by the aix4 compiler - for enumerations. - * stabsread.c (read_enum_type): Likewise. - -Sat Aug 12 03:18:04 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * rs6000-tdep.c (extract_return_value): Fix returning of values - whose length is less than the register size for big endian targets. - -Fri Aug 11 13:04:32 1995 Kung Hsu - - * symtab.c (list_symbols): if break command set breakpoint on - matched symbol. - -Wed Aug 9 18:59:05 1995 Fred Fish - - * defs.h (strchr, strrchr, strstr, strtok, strerror): Enclose in - #ifndefs to protect against previous definitions as macros. - -Wed Aug 9 14:51:36 1995 Kung Hsu - - * xcoffread.c (xcoff_symfile_offset): Revert an unwanted change - that got in accidentally with Aug 1 change. - -Sat Aug 5 09:07:28 1995 steve chamberlain - - * remote-hms.c (hms_cmds): Get reg term right. - * monitor.c (monitor_fetch_register): If we see - a non-hex digit, just stop reading. - * remote.c (remote_wait): Change way $O is handled. - -Wed Aug 9 11:42:36 1995 Jeffrey A. Law - - * configure.in (powerpc-*-aix*): Recognize as a new gdb host - and target. - (powerpc-*-eabi*): Don't set configdirs. - (powerpcle-*-eabi*): Likewise. - * configure: Updated. - * rs6000-nat.c (vmap_ldinfo): Don't relocate data addresses - for the main objfile if DONT_RELOCATE_SYMFILE_OBJFILE is - defined. - * config/powerpc/{aix.mh,aix.mh}: Host and target makefile fragments - for powerpc running aix4. - * config/powerpc/{nm-aix.h, tm-ppc-aix.h, xm-aix.h}: Native, target - and host include files for powerpc running aix4. - -Wed Aug 9 08:11:45 1995 Stan Shebs - - * top.c (target_output_hook): Really make it match defs.h (char * - is not the same as unsigned char *). - -Tue Aug 8 15:13:05 1995 J.T. Conklin - - * Makefile.in (CXX_FOR_TARGET): Don't use ${rootme}/../gcc/xgcc - unless it is present. - -Tue Aug 8 10:50:15 1995 Jeffrey A. Law - - * top.c (target_output_hook): Make declaration match the one - in defs.h. - - * symfile.c (add_psymbol_to_list): Initialize SYMBOL_SECTION. - (add_psymbol_addr_to_list): Likewise. - * symfile.h (ADD_PSYMBOL_VT_TO_LIST): Likewise. - -Mon Aug 7 15:34:29 1995 steve chamberlain - - * top.c (target_output_hook): New definition. - * stack.c (gdb_string.h): Include after defs.h - * defs.h (target_output_hook): New declaration. - * source.c (mod_path): Fix Win32 \ handling. - -Sun Aug 6 22:14:25 1995 Jeff Law (law@snake.cs.utah.edu) - - * hppa-tdep.c (frame_saved_pc): Don't try to dig a return pointer - out of a long branch stub. - -Fri Aug 4 13:37:31 1995 Jeffrey A. Law - - * xcoffread.c (process_linenos): Fix typo in last change. - -Thu Aug 3 22:01:26 1995 Fred Fish - - * ch-exp.y (write_lower_upper_value): Add prototype so bison - generated parser will insert prototype before first func usage. - Bison and byacc order the output sections differently. Also - make function static. - -Thu Aug 3 10:45:37 1995 Fred Fish - - * Update all FSF addresses except those in COPYING* files. - -Thu Aug 3 01:38:45 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * config/alpha/tm-alpha.h (EXTRA_FRAME_INFO): Add pc_reg field. - (SKIP_TRAMPOLINE_CODE): Define. - * alpha-tdep.c (alpha_frame_saved_pc): Use pc_reg field from - frame to find the saved pc register. - (alpha_saved_pc_after_call): Skip over shared library trampoline - before trying to find the saved pc register. - (find_proc_desc): Copy PROC_PC_REG from found proc_desc - to heuristic proc_desc. - (init_extra_frame_info): Initialize pc_reg field in frame. - -Wed Aug 2 18:00:36 1995 Stan Shebs - - * configure.in (m68*-est-*): Use monitor target config. - * configure: Update. - * config/m68k/est.mt, config/m68k/tm-est.h: Delete. - * config/m68k/monitor.mt, config/m68k/tm-monitor.h: Fix comments. - -Tue Aug 1 22:52:53 1995 Fred Fish - - * Makefile.in (VERSION): Bump to 4.14.2 - -Tue Aug 1 16:04:36 1995 Kung Hsu - - * xcoffread.c (process_linenos): The value in include file symbol - should point to line number table. Currently this value is not - set correctly by AIX ld. A fix to get around this bug. - -Tue Aug 1 11:44:53 1995 J.T. Conklin - - * configure.in: Check for working mmap, ansi headers, string.h, - strings.h, and memory.h. - * configure: Regenerated. - - * gdb_stat.h: New file, "portable" . - * gdb_string.h: New file, "portable" . - - * altos-xdep.c, arm-tdep.c, arm-xdep.c, convex-tdep.c, - convex-xdep.c, coredep.c, cxux-nat.c, dbxread.c, exec.c, - gould-xdep.c, hppa-tdep.c, i386aix-nat.c, i386b-nat.c, - i386mach-nat.c, i386v-nat.c, infptrace.c, m88k-nat.c, main.c, - mdebugread.c, objfiles.c, os9kread.c, procfs.c, pyr-xdep.c, - rs6000-nat.c, source.c, standalone.c, stuff.c, sun386-nat.c, - symfile.c, symm-nat.c, symm-tdep.c, symtab.c, top.c, ultra3-nat.c, - ultra3-xdep.c, umax-xdep.c, xcoffread.c: Include "gdb_stat.h" - instead of . - - * alpha-tdep.c, breakpoint.c, buildsym.c, c-typeprint.c, - ch-typeprint.c, coffread.c, command.c, core-sol2.c, core-svr4.c, - core.c, corelow.c, cp-valprint.c, dbxread.c, dcache.c, demangle.c, - dpx2-nat.c, dstread.c, dwarfread.c, elfread.c, environ.c, eval.c, - exec.c, f-lang.c, f-typeprint.c, f-valprint.c, findvar.c, - fork-child.c, gdbtypes.c, hpread.c, i386-tdep.c, infcmd.c, - inflow.c, infptrace.c, infrun.c, irix5-nat.c, language.c, - m2-typeprint.c, main.c, mdebugread.c, minsyms.c, mipsread.c, - monitor.c, nlmread.c, objfiles.c, os9kread.c, osfsolib.c, parse.c, - printcmd.c, procfs.c, regex.c, remote-adapt.c, remote-arc.c, - remote-array.c, remote-bug.c, remote-e7000.c, remote-eb.c, - remote-es.c, remote-hms.c, remote-mm.c, remote-os9k.c, - remote-pa.c, remote-sim.c, remote-st.c, remote-udi.c, - remote-utils.c, remote-vx.c, remote-vx29k.c, remote-vx68.c, - remote-vx960.c, remote-vxmips.c, remote-vxsparc.c, remote.c, - solib.c, somread.c, source.c, stabsread.c, stack.c, symfile.c, - symmisc.c, symtab.c, target.c, top.c, typeprint.c, utils.c, - valarith.c, valops.c, valprint.c, values.c, xcoffread.c: Include - "gdb_string.h" instead of . - - * config/xm-sysv4.h, i386/xm-ptx.h, m68k/xm-sun3os4.h, - sparc/xm-sun4os4.h (HAVE_MMAP): Removed. - - * config/xm-lynx.h, config/i386/xm-ptx.h, - config/m68k/nm-apollo68b.h, config/m68k/xm-hp300hpux.h, - config/mips/xm-irix3.h, config/mips/xm-mips.h, - config/mips/xm-news-mips.h, config/mips/xm-riscos.h, - config/pa/hppah.h, config/rs6000/xm-rs6000.h, - config/sparc/xm-sun4os4.h, config/sparc/xm-sun4sol2.h, - config/vax/xm-vaxbsd.h, config/vax/xm-vaxult.h, - config/vax/xm-vaxult2.h (MEM_FNS_DECLARED): Removed. - * config/mips/xm-irix3.h, config/mips/xm-mips.h, - config/pa/xm-hppah.h (memcpy, memset): Removed declarations. - -Tue Aug 1 02:08:30 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * mips-tdep.c (mips_extract_return_value): Fix returning of - values whose length is less than the register size for big endian - targets. - * alpha-tdep.c (alpha_extract_return_value, - alpha_store_return_value): Use alpha_convert_register_to_* - to handle functions returning "float" correctly. - -Mon Jul 31 19:12:48 1995 Stan Shebs - - * h8500-tdep.c: General linting and cleanup. - (opcodes/h8500-opc.h): Don't include. - (code_size, data_size): Make static. - (frame_locals_address, frame_args_address): Remove. - (h8300_pop_frame): Rename to h8500_pop_frame. - (big_command, medium_command, compact_command, small_command): - Define as regular functions rather than with macro trickery. - (tm_print_insn): Set to correct disassembler function. - * config/h8500/tm-h8500.h: Minor cleanup, add prototypes. - (ABOUT_TO_RETURN): #if 0 out. - (FRAME_ARGS_ADDRESS, FRAME_LOCALS_ADDRESS): Use usual define. - (GDB_TARGET_IS_H8500): Remove duplicate definition. - (regoff): Remove, never used. - * config/h8500/h8500.mt (TDEPFILES): Add monitor.o. - -Mon Jul 31 14:32:30 1995 J.T. Conklin - - * configure.in: Check for unistd.h. - * configure: Regenerated. - - * command.c, cp-valprint.c, fork-child.c, i386-tdep.c, - i386b-nat.c, inflow.c, main.c, maint.c, objfiles.c, solib.c, - source.c, stack.c, symfile.c, top.c, utils.c: Include strings.h - and/or unistd.h to bring prototypes into scope. - -Sun Jul 30 01:40:11 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * rs6000-tdep.c (frame_saved_pc): Check for signal handler caller - before trying to determine the start of the function. - (skip_prologue): Skip subroutine call which might save the - floating point registers only if it is within the first three - instructions. - Reinstate setting of alloca_reg if setup of a gcc frame pointer - is found. - (frame_get_cache_fsr): Use new fields in rs6000_framedata. - -Sat Jul 29 14:43:35 1995 Stan Shebs - - * sparclite: Removed subdirectory. aload and eload are now in - utils/sparclite, low-level library is in libgloss. - * configure.in (sparclite*): Don't configure sparclite subdir. - * configure: Update. - * Makefile.in (TARDIRS): Remove, no longer used. - -Sat Jul 29 01:45:56 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * procfs.c (unconditionally_kill_inferior): Clear current signal - if PROCFS_NEED_CLEAR_CURSIG_FOR_KILL is defined. - * config/alpha/nm-osf3.h (PROCFS_NEED_CLEAR_CURSIG_FOR_KILL): Define. - - * alpha-tdep.c: Move sigtramp handling of saved registers from - read_next_frame_reg to alpha_find_saved_regs, handle saved - floating point registers. - * mips-tdep.c: Move sigtramp handling of saved registers from - read_next_frame_reg to mips_find_saved_regs, handle saved - floating point registers. - * config/mips/tm-irix3.h, config/mips/tm-irix5.h, - config/mips/tm-mipsv4.h (SIGFRAME_FPREGSAVE_OFF): Define. - - * sparc-tdep.c (sparc_pc_adjust): Fix check for `unimp' - instruction to handle functions returning structures with - large sizes properly. - -Fri Jul 28 11:50:17 1995 steve chamberlain - - * configure, configure.in (z8k-*-sim): deleted. - -Thu Jul 27 12:49:28 1995 Jeffrey A. Law - - * lynx-nat.c (child_wait): Handle threads exiting. - -Thu Jul 27 07:47:50 1995 Michael Meissner - - * rs6000-tdep.c (skip_prologue): Don't assume the update stack - instruction is the last in the prologue, since xlc stores the lr - after the stack update. Make sure offset is correct sign for - large frames. - (frame_saved_pc): Move test for signal before frameless. - - * config/rs6000/tm-rs6000.h (DEFAULT_LR_SAVE): Define. - * config/powerpc/tm-ppc-eabi.h (DEFAULT_LR_SAVE): Redefine. - -Thu Jul 27 01:22:08 1995 Jeffrey A. Law - - * hppa-tdep.c (hppa_fix_call_dummy): Rewrite code for calling - into shared libraries. - -Wed Jul 26 23:33:34 1995 Michael Meissner - - * config/rs6000/tm-rs6000.h (rs6000_framedata): Add offsets the - gprs, fprs, lr, and cr is stored at. - (FRAME_FIND_SAVED_REGS): Use new fields in rs6000_framedata. - (function_frame_info): Delete declaration. - (SKIP_PROLOGUE): Skip_prologue is now passed a rs6000_framedata - structure to fill in. - (FRAMELESS_FUNCTION_INVOCATION): Function now longer takes a - second argument. - (FRAME_SAVED_PC): Call frame_saved_pc. - - * rs6000-tdep.c (skip_prologue): Recognize V.4 prologues as well - as AIX style. Fill in rs6000_framedata structure. Remember where - the gprs, fprs, cr, and lr are saved. - (pop_frame): Use skip_prologue, not function_frame_info, and use - new rs6000_framedata fields. - (function_frame_info): Function deleted. - (frameless_function_invocation): Separate frame_saved_pc support - to new function. Recognize V.4 frames. - (frame_saved_pc): New function. - (frame_get_cache_fsr): Use skip_prologue, not function_frame_info. - (frame_initial_stack_address): Ditto. - -Wed Jul 26 01:00:37 1995 Jeff Law (law@snake.cs.utah.edu) - - * remote.c: Add documentation for extended protocol operations - and for thread_alive change from a couple weeks ago. - (extended_remote_ops): Declare and define a new target vector - for the extended remote protocol. - (extended_remote_restart): New function to restart the remote - server & process. - (remote_open): Just a stub routine. - (extended_remote_open): New function to start a remote session - using the extended gdb remote protocol. - (remote_open_1): New function containing code common to both - remote_open and extended_remote_open. - (remote_mourn, extended_remote_mourn, remote_mourn_1): Similarly. - (extended_remote_create_inferior): New function for the extended - remote target. - (initialize_remote): Add the extended_remote_ops target vector. - * gdbserver/server.c (main, case '!'): Set extended_protocol. - (main, case 'k'): If the extended protocol is in use, kill the - inferior then start a new one. - (main, case 'R'): New command to restart the remote server and - inferior process. Only supported when using the extended - protocol. - (main, server loop): If the inferior terminates while using the - extended protocol then start a new one. If getpkt fails when - using the extended protocol then exit. - -Tue Jul 25 11:43:44 1995 Stan Shebs - - * mdebugread.c (psymtab_to_symtab_1): Relocate encoded stab - line numbers using the psymtab's section offsets. - -Tue Jul 25 10:43:27 1995 Michael Meissner - - * config/rs6000/tm-rs6000.h (rs6000_framedata): Rename from - aix_framedata. Change all uses. - * rs6000-tdep.c: Change all aix_framedata -> rs6000_framedata. - -Sat Jul 22 23:44:18 1995 Jeff Law (law@snake.cs.utah.edu) - - * defs.h (ATTR_FORMAT): Disable if ANSI_PROTOTYPES is not defined. - -Fri Jul 21 16:50:28 1995 Jeffrey A. Law - - * lynx-nat.c (child_thread_alive): New function. Somehow I - forgot to check this in with all the other thread_alive changes. - -Thu Jul 20 22:22:34 1995 Jeff Law (law@snake.cs.utah.edu) - - * somread.c (som_symtab_read): Add unsatisfied common symbols to - the minimal symbol table. All common symbols are "unsatisfied" - when -E is passed to the linker. - -Thu Jul 20 15:04:57 1995 Fred Fish - - * top.c (show_endian): Cast first arg of printf_unfiltered to - correct type of "char *". - -Thu Jul 20 14:18:51 1995 Jeffrey A. Law - - * lynx-nat.c (child_wait): A thread_id of zero from wait apparently - means the process is single threaded, so there's no need to add - it to the thread list. Handle case where multi-threaded process - reverts back to a single-threaded process. - - * gdbserver/low-hppabsd.c: Remove error declaration. - * gdbserver/low-sparc.c: Likewise. - * gdbserver/low-sun3.c: Likewise. - * gdbserver/server.h: Remove error and fatal declaration. - * gdbserver/utils.c (error): Update to be compatable with recent - changes in defs.h. - (fatal): Likewise. - -Wed Jul 19 22:42:43 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * config/m68k/tm-m68kv4.h (DWARF_REG_TO_REGNUM): Define to - correctly map floating point registers numbers. - - * dwarfread.c (locval, new_symbol): Handle variables that are - optimized out. - - * mdebugread.c: Replace all uses of builtin_type_* with - mdebug_type_*. Define and initialize mdebug_type_*. - - * serial.h (serial_close): Add additional argument `really_close'. - (SERIAL_CLOSE): Update serial_close call accordingly. - (SERIAL_UN_FDOPEN): Use serial_close to handle refcnt properly. - * serial.c (serial_close): Handle `really_close'. - * serial.h (scb_base): Moved to serial.c, made static. - - * valops.c (value_addr): Don't coerce arrays. - (typecmp): Coerce arrays instead of calling value_addr if necessary. - -Wed Jul 19 18:19:28 1995 Stan Shebs - - From Richard Earnshaw (rearnsha@armltd.co.uk): - * infrun.c (wait_for_inferior): Set the convenience variable - $_exitcode to the termination code of the inferior. - * top.c (quit_command): Accept optional expression to use - as parameter to exit(). - -Wed Jul 19 13:15:32 1995 Kung Hsu - - * remote.c (remote_wait): When getting registers, check endianess and - do conversion if necessary. - -Tue Jul 18 00:41:31 1995 Jeff Law (law@snake.cs.utah.edu) - - * gdbserver/low-hppabsd.c: New file. - * gdbserver/Makefile.in (SFILES): Add low-hppabsd.c. - * config/pa/hppabsd.mh (XDEPFILES): Add ser-tcp.o. - (GDBSERVER_DEPFILES): Add low-hppabsd.o. - * config/pa/hppaosf.mh: Likewise. - -Mon Jul 17 21:35:18 1995 Fred Fish - - * dache.c (struct dcache_block): Change data member from unsigned - char to char, since everything passed in and out of dcache is char - or casted to appropriate type anyway. - (dcache_alloc): Move assignment of db out of test and combine - separate tests into if-else. - (dcache_peek_byte): Change ptr from unsigned char* to char*. - (dcache_peek_byte): Remove now unnecessary cast in read_memory call. - (dcache_peek): Change cast of incoming data arg. - (dcache_poke): Change cast of addr of incoming data arg. - (dcache_info): Mask data passed to printf_filtered to lsbyte only. - (dcache_info): Change printf_filtered arg from "% 2x" to " %2x". - * target.c (debug_to_thread_alive): Change return type to int and - return zero, for type compatibility with other *_thread_alive - funcs. - (cleanup_target): Change cast of ignore function to match type of the - to_thread_alive member. - * defs.h (error_hook): Add ATTR_NORETURN. - * defs.h (NORETURN, ATTR_NORETURN): Switch from volatile to - __attribute__ method with gcc 2.7, to avoid gcc 2.6.3 bug. - * remote.c (remote_wait): Cast first arg to strtol, strchr, and - strncmp to "const char *" from "unsigned char *". - (remote_wait): Cast arg to putpkt and strcpy from "unsigned char *" - to "char *". - (remote_wait): Change printf format for long arg from "%d" to "%ld". - (getpkt): Remove unused variable "bp". - (remote_fetch_word, remote_store_word): Ifdef out apparently unused - functions. - * breakpoint.c (watchpoint_check): Removed unused variables - "saved_level" and "saved_frame". - * valops.c (value_arg_coerce): Add other enum TYPE_CODE_* and - default cases to switch for completeness. - * infrun.c (wait_for_inferior): Enclose "have_waited" label - in #ifdef that matches the one in which it is referenced. - * ser-unix.c (hardwire_noflush_set_tty_state): Enclose otherwise - unused variable "state" in #ifdef that matches one in which it is - referenced. - * eval.c (evaluate_subexp_standard): Remove unused variable "var". - * eval.c (evaluate_subexp_standard): Remove unused variable - "tmp_symbol". - * valarith.c (value_subscript): Remove unused variable - "lowerbound", which is redeclared in a nested scope prior to use. - * printcmd.c (print_frame_nameless_args): Use "%ld" to print long - arg, not "%d". - * {mem-break.c, remote-pa.c, remote.c, saber.suppress}: - Remove unused static var "check_break_insn_size". - * buildsym.c (finish_block): Add other enum LOC_* and default - cases to switch for completeness. - ch-lang.c (type_lower_upper): Removed unused label "retry". - Add other enum TYPE_* and default cases to switch for completeness. - * f-typeprint.c (f_type_print_args): Ifdef out unused function - that may be used someday when Fortran support is complete. - * ch-valprint.c (chill_print_type_scalar): Add other enum - TYPE_* and default cases to switch for completeness. - (chill_val_print): Remove unused local var "high_bound" that - is redeclared in a nested scope prior to use. - (chill_var_print): Use "%ld" to print long arg, not "%d". - * regex.c (re_compile_fastmap, re_match_2): Add remaining enum - types and default to switches for completeness. - * minsyms.c (lookup_minimal_symbol_text): Delete unused variable - "trampoline_symbol". - (prim_record_minimal_symbol_and_info): Return NULL rather than - trash. - * elfread.c (elf_symtab_read): Don't dereference NULL returns from - record_minimal_symbol_and_info. - * f-lang.c (saved_function_list_end): Ifdef out unused variable - that may be used someday. - * f-valprint.c (f_val_print): Remove unused local "straddr". - -Mon Jul 17 13:08:00 1995 Ian Lance Taylor - - * stabsread.h (struct stab_section_list): Define. - (coffstab_build_psymtabs): Remove staboff and stabsize parameters. - Add textaddr, textsize, and stabs parameters. - * gdb-stabs.h (struct dbx_symfile_info): Remove text_sect field. - Add text_addr and text_size fields. - (DBX_TEXT_SECT): Don't define. - (DBX_TEXT_ADDR, DBX_TEXT_SIZE): Define. - * coffread.c: Include . - (struct coff_symfile_info): Remove stabsect and stabindexsect - fields. Add textaddr, textsize, and stabsects fields. - (coff_locate_sections): Record the address of the .text section, - and total the sizes of all sections with names beginning with - ".text". Don't bother to record a .stab.index section (COFF - doesn't use them). Make a linked list of all sections with names - beginning with ".stab". - (coff_symfile_read): Adjust call to coffstab_build_psymtabs for - new parameters. - * dbxread.c (dbx_symfile_read): Use DBX_TEXT_ADDR and - DBX_TEXT_SIZE, rather than getting both from DBX_TEXT_SECT. - (dbx_symfile_init): Set DBX_TEXT_ADDR and DBX_TEXT_SIZE, not - DBX_TEXT_SECT. - (elfstab_build_psymtabs): Likewise. - (stabsect_build_psymtabs): Likewise. - (symbuf_sections, symbuf_left, symbuf_read): New static variables. - (fill_symbuf): If symbuf_sections is not NULL, read symbols from - multiple sections. - (coffstab_build_psymtabs): Remove staboffset and stabsize - parameters. Add textaddr, textsize, and stabsects parameters. - Set DBX_TEXT_ADDR and DBX_TEXT_SIZE, not DBX_TEXT_SECT. Handle - multiple stabs sections. - * os9kread.c (os9k_symfile_read): Use DBX_TEXT_ADDR and - DBX_TEXT_SIZE, rather than getting both from DBX_TEXT_SECT. - (os9k_symfile_init): Set DBX_TEXT_ADDR and DBX_TEXT_SIZE, not - DBX_TEXT_SECT. - - * remote-vx.c (vx_ops, vx_run_ops): Initialize new to_thread_alive - field. - -Sat Jul 15 01:02:53 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * config/alpha/alpha-osf3.mh, config/alpha/nm-osf3.h: New files - for OSF/1-3.x procfs support. - * configure.in (alpha-dec-osf): Use them when configuring - for OSF/1-3.x. - * configure: Updated. - * target.c: Include . - -Fri Jul 14 16:16:56 1995 J.T. Conklin - - * Makefile.in, configure.in: Use one variable, frags, to hold - pathnames of makefile fragments. - * configure: regenerated. - -Fri Jul 14 09:49:47 1995 Jeff Law (law@snake.cs.utah.edu) - - * procfs.c (procfs_ops): Fix typo in last change. - -Thu Jul 13 13:42:38 1995 Jeffrey A. Law - - * inftarg.c (child_thread_alive): New function to see if a - particular thread is still running. - (child_ops): Add child_thread_alive entry. - * remote.c (remote_thread_alive): New function to see if a - particular thread is still alive. - (remote_ops): Add remote_thread_alive. - * target.c (dummy_target): Add dummy entry for thread_alive. - (cleanup_target): de_fault thread_alive too. - (update_current_target): INHERIT thread_alive too. - (debug_to_thread_alive): New function. - (setup_target_debug): Add debug_to_thread_alive. - * target.h (struct target_ops): Add to_thread_alive. - (target_thread_alive): Define. - * thread.c (info_threads_command): Don't call kill; use - target_thread_alive instead. - * config/nm-lynx.h (CHILD_THREAD_ALIVE): Define. - * gdbserver/low-lynx.c (mythread_alive): New function. - (mywait): Don't restart any threads after a new thread notification, - let the generic code handle it. - * gdbserver/low-sparc.c (mythread_alive): Dummy version. - * gdbserver/low-sun3.c (mythread_alive): Likewise. - * gdbserver/server.c (main): Handle thread_alive requests. - * gdbserver/server.h (mythread_alive): Declare. - * corelow.c (core_ops): Add dummy entry for thread_alive. - * exec.c (exec_ops): Likewise. - * m3-nat.c (m3_ops): Likewise. - * monitor.c (monitor_ops): Likewise. - * procfs.c (procfs_ops): Likewise. - * remote-arc.c (arc_ops): Likewise. - * remote-array.c (array_ops): Likewise. - * remote-e7000.c (e7000_ops): Likewise. - * remote-es.c (es1800_ops, es1800_child_ops): Likewise. - * remote-mips.c (mips_ops): Likewise. - * remote-pa.c (remote_hppro_ops): Likewise. - * remote-sim.c (gdbsim_ops): Likewise. - * sparcl-tdep.c (sparclite_ops): Likewise. - -Tue Jul 11 11:15:55 1995 Kung Hsu - - * solib.c: Add _DYNAMIC__MGC base symbol for Mentor Graphics Inc. - * solib.c (match_main): New function for checking name of main. - * solib.c (solib_add): Not to add if solib match main. - -Fri Jul 7 14:41:56 1995 Kung Hsu - - * elfread.c (elf_symtab_read): Fix a bug ignoring compiler - generated internal labels ($LM...). - -Wed Jul 5 11:38:36 1995 Kung Hsu - - * defs.h: if __GO32__ or WIN32 the directory separating symbol should - be '\' not '/'. - - * remote-nindy (nindy_wait): Use infinite timeout reading after - esacpe character. - -Tue Jul 4 10:30:22 1995 Jeffrey A. Law - - * infrun.c (wait_for_inferior): When switching from one thread to - another, save infrun's state for the old thread and load infrun's - previous state for the new thread. - * thread.c (struct thread_info): Add new fields for thread specific - state saved/restored in infrun.c. - (add_thread): Initialize new fields. - (load_infrun_state): New function. - (save_infrun_state): New function. - * thread.h (load_infrun_state): Provide external decl. - (save_infrun_state): Likewise. - - * infrun.c (wait_for_inferior): When we hit a breakpoint for the - wrong thread, make sure to write the fixed PC value into the thread - that stopped. Restart all threads after single stepping over a - breakpoint for a different thread. - * breakpoint.c (set_momentary_breakpoint): Make momentary - breakpoints thread specific in a multi-threaded program. - * lynx-nat.c (child_resume): Add some comments. Correctly - choose between the single and multi-threaded step and continue - ptrace calls. - -Fri Jun 30 16:15:36 1995 Stan Shebs - - * config/h8300/h8300.mt: Renamed from h8300hms.mt. - * config/h8500/h8500.mt: Renamed from h8500hms.mt. - * config/z8k/z8k.mt: Renamed from z8ksim.mt. - * configure, configure.in: Update to reflect renamings. - - * remote-sim.c (sim): New command, passes commands to simulator. - (simulator_command): New function. - (gdbsim_ops): Clean up. - * remote-sim.h (sim_do_command): Declare. - * sh-tdep.c (memory_size): Remove command. - - * Makefile.in (SIM, SIM_OBS): New variables. - (CLIBS, CDEPS): Add value of SIM. - (DEPFILES): Add value of SIM_OBS - - * config/arm/arm.mt, config/h8300/h8300.mt, config/h8500/h8500.mt, - config/sh/sh.mt, config/sparc/sp64sim.mt, config/w65/w65.mt, - config/z8k/z8k.mt: Remove simulator files from TDEPFILES, - define in SIM_OBS and SIM. - config/sparc/sp64sim.mt (SIMFILES): Remove. - - * remote-z8k.c: Remove, was superseded by remote-sim.c - * Makefile.in, mpw-make.in: Remove references to remote-z8k.c. - -Sun Jun 25 15:30:43 1995 Stan Shebs - - * remote.c (remote_read_bytes, remote_write_bytes): Second arg - should be char *, not unsigned char *. - * dcache.h (memxferfunc): Ditto. - * monitor.c (monitor_write_memory, monitor_read_memory_single): - Ditto. - (monitor_make_srec): Let compiler figure size of hextab. - -Sat Jun 24 19:27:37 1995 Jeffrey A. Law - - * lynx-nat.c (child_wait): Don't restart new threads and loop - to the top of child_wait; let the machine independent code in - wait_for_inferior deal with new thread notifications. - -Fri Jun 23 11:51:58 1995 Kung Hsu - - * remote-nindy (nindy_load): Put in target specific load, it's - 20 times faster. - -Thu Jun 22 20:21:59 1995 Stan Shebs - - * utils.c (error): Move local `args' outside conditional, - move local `string1' inside, declare function as void if - non-ANSI compiler, dereference error_hook when calling. - - * mac-xdep.c (stdarg.h): Don't include. - -Thu Jun 22 13:12:33 1995 Kung Hsu - - * remote-nindy.c (nindy_wait): Change timeout in SERIAL_READCHAR. - -Wed Jun 21 13:24:41 1995 Jeff Law (law@snake.cs.utah.edu) - - * hppam3-nat.c: Change HP800_THREAD_STATE to TRACE_FLAVOR and - HP800_THREAD_STATE_COUNT to TRACE_FLAVOR_SIZE. - -Wed Jun 21 05:57:56 1995 Steve Chamberlain - - * monitor.c: Turn on caching. - (monitor_printf): If a ^C was sent, don't expect to see its - echo. - (monitor_open): Enable caching. - (monitor_resume, monitor_load): Flush cache. - (monitor_xfer_memory): Call cache routine. - (monitor_dump_regs): New. - (monitor_fetch_registers): If monitor_dump_regs available - then use it. - (monitor_load): Don't ref exec_bfd if it's NULL. - (monitor_load_srec): Use new monitor_make_srec calling convention. - (monitor_make_srec): Rewrite to cope with two, three and four byte - addresses. - * remote-hms.c (hms_cmds): Initialze end-of-command delim. - * dcache.h, dcache.h: Rewritten. - * remote.c: Reenable caching. - (getpkt): Reduce MAX_TRIES to 3. - (remote_xfer_memory): Use dcache_xfer_memory. - * defs.h (error_hook): New. - * top.c (error_hook): New definition. - * utils.c (error): Use error_hook if initialized. - * sparcl-tdep.c (HAVE_SOCKETS): Don't define if GO32 or WIN32. Use - HAVE_SOCKETS in place of #ifndef GO32. - -Tue Jun 20 22:17:44 1995 Jeff Law (law@snake.cs.utah.edu) - - * config/pa/tm-hppa.h (PSW_*): Define processor status word masks. - (INSTRUCTION_NULLIFIED): Allow specific targets to override. - * config/pa/tm-hppao.h (INSTRUCTION_NULLIFIED): Define to work - around losing mach kernel behavior. - -Tue Jun 20 12:03:36 1995 Stan Shebs - - * monitor.c (monitor_wait): Don't use the watchdog timeout - if its value is 0. - * w89k-rom.c (w89k_open): Define to be static. - - -Sat Jun 17 10:17:16 1995 Jeff Law (law@snake.cs.utah.edu) - - * somsolib.c (som_solib_add): Validate regexp argument. - Don't assume the first entry on dld's library list is the main - program. Don't load the same library more than once and don't - consider the main program a shared library. - (som_solib_sharedlibrary_command): New function - (_initialize_som_solib): Add "sharedlibrary" command. - -Thu Jun 15 14:54:58 1995 Stan Shebs - - * array-rom.c: Remove, no longer used. - - * remote-hms.c (hms_open): Make static. - - * mpw-config.in (MacSerial.h): Copy from version in {CIncludes}, - not {MPW}Interfaces:CIncludes. - * ser-mac.c (mac_baud_rate_table): Fix value for 38400 baud. - -Wed Jun 14 14:27:07 1995 Per Bothner - - * ch-exp.y: Remove lots of unsupported productions and names. - Add support for IF-expressions, ORIF, ANDIF, NUM, and ADDR. - -Tue Jun 13 21:40:11 1995 Per Bothner - - * parser-defs.h (enum precedence): Added PREC_BUILTIN_FUNCTION. - * expression.h (enum exp_opcode): Added UNOP_LOWER, UNOP_UPPER, - UNUP_LENGTH. - * expprint.c (dump_expression): Handle the new exp_opcodes. - (print_subexp): Handle PREC_BUILTIN_FUNCTION. - (print_simple_m2_func): Removed. - (print_subexp): Remove support for Modula2 builtin functions. - * m2-lang.c (m2_op_print_tab): Add support for builtin functions. - * ch-exp.y: Parse LOWER, UPPER, and LENGTH builtins. - (write_lower_upper_value): Convenience function for LOWER and UPPER. - (upper_lower_argument, length_argument): Removed non-terminals. - * ch-lang.c (chill_op_print_tab): Entries for UPPER, LOWER, LENGTH. - (type_lower_upper): New function. Calculate LOWER/UPPER of type. - (value_chill_length): New function. Calcalate LENGTH of ARRAY/STRING. - (evaluate_subexp_chill): Handle UNOP_LOWER, UNOP_UPPER, UNOP_LENGTH. - -Mon Jun 12 12:48:13 1995 Stan Shebs - - Windows support bits from Steve Chamberlain . - * defs.h: Don't declare strchr and friends if WIN32. - (DIRNAME_SEPARATOR): Move here from source.c. - (SLASH_P, SLASH_CHAR, SLASH_STRING, ROOTED_P): New macros, - symbolic definitions for filename bits. - * top.c (cd_command): Use these. - * source.c (mod_path, openp): Ditto. - * terminal.h: Disable termio/sgtty definitions if WIN32. - * findvar.c (registers_changed): Call registers_changed_hook - if it is defined. - -Mon Jun 12 12:22:05 1995 J.T. Conklin - - * Makefile.in (distclean, realclean): Remove config.cache and - config.log. - -Mon Jun 12 00:21:59 1995 Jeff Law (law@snake.cs.utah.edu) - - * somsolib.c: Include gdb-stabs.h. - (som_solib_section_offsets): Use SECT_OFF_XXX rather than 0, 1, - etc. Initialize offsets for RODATA & BSS too. - -Sat Jun 10 17:59:11 1995 Jeff Law (law@snake.cs.utah.edu) - - * hppa-tdep.c (frame_chain): Try to compensate for incomplete - register information in core files when backtracing. - -Fri Jun 9 14:51:38 1995 Stu Grossman (grossman@cygnus.com) - - * remote-nrom.c: Remove everything but download code. More - cleanups. - -Thu Jun 8 15:06:00 1995 Stu Grossman (grossman@cygnus.com) - - * defs.h maint.c monitor.c remote-mips.c remote.c: Add support - for `watchdog' variable. This allows the user to put an upper - limit on the amount of time that GDB will wait for the target to - return from a step or continue operation. This will primarily be - used for the testsuite, where it is difficult to come up with a - reasonable timeout for things like function calls, which can take - as long as three minutes under some circumstances. If the - watchdog timer expires, GDB will generate an error that looks like - `Watchdog has expired.', and will detach from the target. - - * remote-mips.c (mips_open): Setup initial frame from target. - Print it out so that user is told where the program is stopped - when they attach. - - * remote-nrom.c: Loads of cleanups. Use serial code to open - network connections. Use expect() to wait for response to - download command. - - * ser-tcp.c (tcp_open): Retry connection if we get ECONNREFUSED. - - * serial.c serial.h (serial_open serial_fdopen serial_close): - Allow users to open the same device multiple times. They all get - to share the same serial_t. This is about the only way to have - multiple active targets use the same device (for download and - debug). - - * sparcl-tdep.c: Keep #include away from GO32. - - * target.c: Add `targetdebug' variable. If this is non-zero, - then a special target is put at the top of the target stack which - will cause all calls through the target vector to have their args - and results printed out. - -Wed Jun 7 17:40:37 1995 Per Bothner - - * ch-exp.y: Handle "->" . - -Wed Jun 7 17:46:33 1995 Michael Meissner - - * mem-break.c (LITTLE_BREAKPOINT): If BREAKPOINT and - {LITTLE,BIG}_BREAKPOINT are all defined, don't redefine. - (BIG_BREAKPOINT): Ditto. - - * config/rs6000/tm-rs6000.h (BREAKPOINT): Define as either - BIG_BREAKPOINT or LITTLE_BREAKPOINT depending on the target byte - order. - -Wed Jun 7 12:41:42 1995 Jeff Law (law@snake.cs.utah.edu) - - * somsolib.c (som_solib_section_offsets): Handle relative pathnames. - - * hppa-tdep.c (frame_saved_pc): Handle backtracing through signal - handler in dynamically linked executables. - -Tue Jun 6 10:44:25 1995 Michael Meissner - - From Andrew Cagney - * rs6000-tdep.c (single_step): Handle both little and big endian - breakpoints. - (gdb_print_insn_powerpc): Deal with disassembling both little and - big endian PowerPC systems. - (_initialize_rs6000_tdep): Use gdb_print_insn_powerpc to handle - disassembly, rather that assuming big endian order. - - * config/rs6000/tm-rs6000.h (BREAKPOINT): Delete. - (BIG_BREAKPOINT): Define, big endian breakpoint instruction. - (LITTLE_BREAKPOINT): Define, little endian breakpoint instruction. - -Sat Jun 3 01:54:56 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * README: Add note about Unixware 2.x. - - * dbxread.c (process_one_symbol): Check for exact symbol name - match when fixing up N_GSYM and N_STSYM symbols from Sun acc. - - * valprint.c (value_print_array_elements): Use - fprintf_filtered to put out `', - from schwab@issan.informatik.uni-dortmund.de (Andreas Schwab). - - * value.h (struct value): Change `repetitions' field from - `short' to `int' type. - - -Wed May 31 12:04:01 1995 J.T. Conklin - - * nlm/{configure.in, Makefile.in}: Converted to use autoconf. - * nlm/configure: New file, generated with autoconf 2.3. - - * nlm/configure.in: Use sed instead of awk to get the value of - cpufile. Awk is not a utility required by the GNU coding - standards. This change also fixes the rigid whitespace - requirements that were required for awk. - - * sparclite/aload.c: Use a file descriptor instead of a stdio - stream for i/o with target board. - Use #error if HAVE_TERMIOS is not defined. - - * sparclite/{Makefile.in, configure.in}: Converted to use - autoconf. - * sparclite/configure: New file, generated with autoconf 2.3. - -Sun May 28 23:10:07 1995 Jeff Law (law@snake.cs.utah.edu) - - * defs.h: Include either varargs.h or stdarg.h (for va_list). - Fix stupid thinko in last change ("..." -> "va_list"). - - * defs.h (vprintf_filtered declaration): Add PARAMS prototype; - gcc-2.5 chokes on format attributes for unprototyped functions. - (vfprintf_filtered declaration): Likewise. - (vprintf_unfiltered declaration): Likewise. - (vfprintf_unfiltered). Likewise. - -Sat May 27 23:54:17 1995 J.T. Conklin - - * configure.in: Use sed instead of awk to get the values of - hostfile, targetfile and nativefile. Awk is not a utility - required by the GNU coding standards. This change also - fixes the rigid whitespace requirements that were required - for awk. - * configure: regenerated. - -Sat May 27 16:24:04 1995 Angela Marie Thomas - - * sparclite/{Makefile,configure}.in: Add hooks for building with - -lsocket & -lnsl for solaris2. Don't build aload/eload for DOS. - -Thu May 25 12:46:37 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * gdbserver/remote-utils.c (prepare_resume_reply): Add FIXME - comment regarding signal numbering. - -Wed May 24 15:49:47 1995 Steve Chamberlain - - * arm-tdep.c (_initialize_arm_tdep): Use print_insn_little_arm - now. - - * arm-tdep.c (convert_from_extended, convert_to_extended): - New. - * coffread.c (enter_linenos): Return if linetab 0. - * config/arm/arm.mt (TDEPFILES): Add simulator support. - * config/arm/tm-arm.h (FRAME_FIND_SAVED_REGS): Fix prototypes. - -Mon May 22 19:37:21 1995 Rob Savoye - - * config/idt.mt: replace monitor and array-rom with the new - remote-array. - -Mon May 22 15:38:25 1995 Stu Grossman (grossman@cygnus.com) - - * remote-nindy.c: Install Kung patch for PR 6820. I have no idea - what this does... - - * breakpoint.c: Move defaults of watchpoint related macros into - target.h. - * target.h: Macros from breakpoint.c. Conditionalize based on - TARGET_HAS_HARDWARE_WATCHPOINTS. - * i386v-nat.c procfs.c: Use TARGET_HAS_HARDWARE_WATCHPOINTS - instead of TARGET_CAN_USE_HARDWARE_WATCHPOINT to enable watchpoint - code. - * config/i386/nm-linux.h, config/mips/nm-irix4.h, - config/pa/nm-hppab.h, config/sparc/tm-sparclite.h: #define - TARGET_HAS_HARDWARE_WATCHPOINTS to enable watchpoint code. - -Mon May 22 06:47:30 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * breakpoint.c, target.h: Move defaults of watchpoint related - macros back to breakpoint.c. Required to get GDB compiling - on Solaris again. - -Fri May 19 14:49:37 1995 J.T. Conklin - - * defs.h (ATTR_FORMAT): New macro, expands to gcc's format - attribute when compiled by gcc. - * defs.h, language.h, monitor.h: Changed many function - declarations to use ATTR_FORMAT. - - * breakpoint.c (delete_command); source.c (directory_command); - top.c (define_command): Changed call to query() that had too - many arguments. - * printcmd.c (address_info): Changed call to printf_filtered() - that had too many arguments. - -Fri May 19 09:52:07 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * infrun.c (wait_for_inferior): Move assignments to stop_signal - and stop_pc, and STOPPED_BY_WATCHPOINT code, back where they - were--after the switch statement on w.kind. You can't read the - registers of an inferior which has exited. Use a goto in the - STOPPED_BY_WATCHPOINT code. - * infrun.c (wait_for_inferior): Reinstate - HAVE_STEPPABLE_WATCHPOINT and HAVE_CONTINUABLE_WATCHPOINT code. - -Fri May 19 06:15:40 1995 Jim Kingdon - - * utils.c, complaints.c, language.c, monitor.c, remote-array.c, - remote-mips.c, remote-os9k.c, remote-st.c: Conditionalize use of - stdarg rather than varargs on ANSI_PROTOTYPES not __STDC__; it - must match the definition of PARAMS. - -Thu May 18 15:58:46 1995 J.T. Conklin - - * utils.c (fprintf_filtered, fprintf_unfiltered, fprintfi_filtered, - printf_filtered, printf_unfiltered, printfi_filtered, query, warning, - error, fatal, fatal_dump_core): Use stdarg.h macros when compiling - with an ANSI compiler. - * complaints.c (complain): Likewise. - * language.c (type_error, range_error): Likewise. - * monitor.c (monitor_printf, monitor_printf_noecho): Likewise. - * remote-array.c (printf_monitor, debuglogs): Likewise. - * remote-mips.c (mips_error): Likewise. - * remote-os9k.c (printf_monitor): Likewise. - * remote-st.c (printf_stdebug): Likewise. - - * defs.h, complaints.h, language.h, monitor.h: Add prototypes to - match above changes. - - * printcmd.c: Remove uneeded #include . - * remote-e7000.c: Likewise. - - * f-typeprint.c (f_type_print_base): Fix typo found by above - changes. - -Wed May 17 11:21:32 1995 Jim Kingdon - - * Makefile.in (xcoffread.o): Depend on partial-stab.h. - - * xcoffsolib.c (sharedlibrary_command): New command. - * xcoffsolib.c (solib_info): Call xcoff_relocate_symtab. - * xcoffsolib.c: Miscellaneous cleanups. - - * partial-stab.h: Ignore symbol descriptor '-' (for local - variables with negative type numbers) without complaint. - - * rs6000-nat.c (vmap_ldinfo): Use bfd_stat rather than our own - local emulation thereof. Remove unused variable ostart. - -Wed May 17 15:55:53 1995 J.T. Conklin - - * Makefile.in (config.status): changed target so that - config.status --recheck is executed if configure script changes. - - * monitor.c (monitor_printf): Changed format specification in - error message to work with pre-ansi compilers. - (monitor_load_srec): reduced length of s-records from 128 to 32 - bytes so download is more reliable with the rom68k monitor. - - * rom68k-rom.c: Added trailing space to prompt string. - - * config/i386/xm-i386sco.h (HAVE_STRSTR): Removed. - * config/i386/xm-go32.h, mswin/xm.h (SYS_SIGLIST_MISSING): - Removed. - * defs.h, config/{xm-lynx.h, xm-nbsd.h}, - config/i386/{xm-i386bsd.h, xm-linux.h}, - config/m68k/xm-hp300bsd.h, config/mips/xm-irix4.h, - config/ns32k/xm-ns32km3.h, doc/gdbint.texinfo - (PSIGNAL_IN_SIGNAL_H): Removed. - -Tue May 16 13:16:06 1995 J.T. Conklin - - * Makefile.in (Makefile): Added config.status to dependency list. - - * configure.in: Added INIT-CMDS argument to AC_OUTPUT which sets - gdb_host_cpu, gdb_target_cpu and nativefile. - * configure: regenerated. - -Mon May 15 23:50:51 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * mdebugread.c (parse_symbol): Do not relocate stBlock/scText - symbols, their value is the displacement from the procedure address. - * top.c (init_main): Add missing newlines to help strings for - `if' and `while' commands, fix help string for `show commands'. - -Mon May 15 18:37:56 1995 Stu Grossman (grossman@cygnus.com) - - * breakpoint.c: Move defaults of watchpoint related macros into - target.h. Use BP_TEMPFLAG and BP_HARDWAREFLAG instead of - constants. - * infrun.c (wait_for_inferior): Enhance comment near - STOPPED_BY_WATCHPOINT. - * target.h: Macros from breakpoint.c. - -Mon May 15 17:11:38 1995 J.T. Conklin - - * config/i386/{i386sol2.mh, i386v4.mh, ncr3000.mh}, - config/m68k/m68kv4.mh, config/mips/{irix4.mh, irix5.mh, - mipsv4.mh}, config/sparc/sun4so2.mh (INSTALL): Removed, figured - out by autoconf. - * config/apollo68v.mh (RANLIB): Removed, figured out by autoconf. - - * Makefile.in, configure.in: Converted to use autoconf - * aclocal.m4: New file, local autoconf macro definitions. - * configure: New file, generated with autoconf 2.3. - -Mon May 15 14:46:41 1995 Stan Shebs - - * remote.c (remote_kill): Add prototype. - * cpu32bug-rom.c (cpu32bug_open): Properly define as static. - * config/h8300/h8300hms.mt (TDEPFILES): Add monitor.o. - -Mon May 15 12:12:34 1995 Stu Grossman (grossman@cygnus.com) - - * sparclite/salib.c (win_ovf win_unf): Make window size constant - into a variable (__WINSIZE) so that it can be controlled via the - .h file. - * sparclite/sparclite.h: Add SL933 #ifdef to set __WINSIZE to 6 - for the 933 board. - - * infrun.c: Add #ifdef HP_OS_BUG to all references to - trap_expected_after_continue. - * (wait_for_inferior): Fix for remote watchpoints. Don't try to - insert breakpoints while target is running (this only works on - *some* native targets). This may also speed up native watchpoints - considerably. - -Sat May 13 13:55:04 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * dwarfread.c (struct dwfinfo), dbxread.c (struct symloc), - mdebugread.c (struct symloc), hpread.c (struct symloc), - xcoffread.c (struct symloc): Fix inaccurate comment introduced - 20 Apr 1995. - -Sat May 13 13:34:18 1995 Jim Kingdon - - * rs6000-tdep.c (find_toc_address): Revise comment. - * symfile.c, symfile.h (init_psymbol_list): New function; - consolidate duplicated copies from os9kread.c, dbxread.c - and dwarfread.c. - * defs.h: Declare info_verbose. - * xcoffread.c: Extensive changes to support psymtabs. - -Fri May 12 13:48:41 1995 Stu Grossman (grossman@andros.cygnus.com) - - * cpu32bug-rom.c remote-est.c rom68k-rom.c: Update line_term element. - -Fri May 12 06:39:30 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * partial-stab.h: Expand comments. - -Thu May 11 19:01:37 1995 Jeff Law (law@snake.cs.utah.edu) - - * Support debugging using native MACH primitives on hppa*-*-osf*. - * configure.in: hppa*-*-osf* != hppa*-*-bsd* anymore. - * config/pa/hppaosf.mh: New file. - * config/pa/nm-hppao.h: Likewise. - * hppam3-nat.c: Likewise. - * config/pa/tm-hppao.h (PSW_SS): Define for single-stepping. - (MACHINE_CPROC_*_OFFSET): Define. - (TRACE_*): Define. - (START_INFERIOR_TRAPS_EXPECTED): Delete definition. - -Wed May 10 18:59:26 1995 Stu Grossman (grossman@andros.cygnus.com) - - * hppa-tdep.c (read_unwind_info): Cosmetic cleanup. - * (unwind_command): Clean it up and make it print things out - nicer. - * monitor.c: Add ^C handling capability (mostly ripped off from - remote.c). - * (monitor_printf): Make it check the command echo. - * (monitor_printf_noecho): Similar to above, but doesn't check - for echo. - * (monitor_stop): No longer waits for prompt. That is the job of - the caller. This makes things work much better for monitor_wait, - which waits for the prompt itself. - * (monitor_open): Deal with new monitor_stop semantics. Also, - flush input after sending init strings to get rid of junk that may - be output. Also, don't always send \r to remote. Use - monitor_ops->line_term cuz proper character isn't always \r. - * (monitor_fetch_register): Switch to completely different - algorithm to deal with lame-ass monitors which put spaces in the - middle of numbers, and prompt with a space!!!!! - * (monitor_read_memory_single): New routine to be used with - monitors that can only return one byte/short/long at a time. This - is selected via MO_GETMEM_READ_SINGLE. - * (monitor_load_srec): Use monitor_printf_noecho for sending S - records. Most targets don't echo them. - * (monitor.h): Get rid of cmd_delim. Add line_delim. - * op50n-rom.c (op50n_cmds): Fill it up. Make it work. - * w89k-rom.c: Change all eols from \r to \n. Change load_resp to - ^Q to prevent error message. - * config/pa/tm-hppa.h (CALL_DUMMY (for hppro)): Add special - instruction sequence at end to make restore_pc_queue happy. - -Wed May 10 15:59:00 1995 Torbjorn Granlund - - * remote-est.c (est_open): Make static to match prototype. - -Tue May 9 16:58:50 1995 Michael Meissner - - * configure.in: Add little endian PowerPC support. - * config/powerpc/ppcle-eabi.mt: New file for little endian PowerPC - support. - * config/powerpc/tm-ppcle-eabi.h: ditto. - -Mon May 8 12:11:38 1995 J.T. Conklin - - * nlm/configure.in (gdb_host, gdb_host_cpu, gdb_target): Removed. - These variables not used. - - * config/m68k/monitor.mt (TDEPFILES): Added cpu32bug-rom.o. - -Wed May 3 17:54:47 1995 Stan Shebs - - * monitor.c (monitor_command): Don't use PROMPT until monitor - target is known to be open. - (monitor_make_srec): Don't define size of hextab. - -Tue May 2 18:32:24 1995 Stan Shebs - - * configure.in (--enable-netrom): New configuration option. - * Makefile.in (REMOTE_OBS): Rename from REMOTE_O, append - value of NETROM_OBS. - (NETROM_OBS): New variable. - * remote-nrom.c: New file, NetROM target support. - * config/a29k/a29k-udi.mt, config/i960/vxworks960.mt: Use - REMOTE_OBS instead of REMOTE_O. - -Fri Apr 28 23:30:00 1995 Stu Grossman (grossman@cygnus.com) - - * array-rom.c (_initialize_array array_open): Move baud_rate - initialization from _initxxx to array_open to fix bug with - overriding -b command line option. - -Thu Apr 27 20:29:34 1995 Doug Evans - - * Makefile.in (RUNTEST): Fix reference of `srcdir'. - -Wed Apr 26 19:01:08 1995 Steve Chamberlain - - * remote-hms.c: Rewrite to use new monitor conventions. - -Tue Apr 25 11:27:14 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * dbxread.c: Add comment explaining lowest_text_address. - Add comment regarding stringtab_global and psymtabs. - -Sat Apr 22 01:26:29 1995 Jeff Law (law@snake.cs.utah.edu) - - * config/pa/tm-hppa.h (EXTRACT_STRUCT_VALUE_ADDRESS): Fix. - - * config/pa/tm-hppa.h (EXTRACT_RETURN_VALUE): Rewrite to correctly - handle "short", "int" and small structures returned in registers. - -Fri Apr 21 12:57:53 1995 Kung Hsu - - * minsyms.c: add new function lookup_minimal_symbol_text, to look - for text symbol only. - * breakpoint.c (create_longjmp_breakpoint): call - lookup_minimal_symbol_text instead of lookup_minimal_symbol. - * symtab.h: add lookup_minimal_symbol_text prototype. - -Fri Apr 21 12:03:44 1995 Stan Shebs - - * sh-tdep.c (sh-opc.h): Don't include. - (gdbcore.h): Include. - (frame_find_saved_regs): Remove unused local. - -Thu Apr 20 10:12:21 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * dwarfread.c (struct dwfinfo), dbxread.c (struct symloc), - mdebugread.c (struct symloc), hpread.c (struct symloc): Clean - up comments. - -Wed Apr 19 16:58:11 1995 Stu Grossman (grossman@andros.cygnus.com) - - * hppa-tdep.c (deposit_17): New routine to deposit 17 bit - constants into PA instructions. - * Put #ifdefs around all signal handling code. Not generally - needed for embedded boards. - * (hppa_fix_call_dummy): Parameterize offsets into call dummy to - allow different dummys to be used by this code. Use - INSTRUCTION_SIZE instead of REGISTER_SIZE for things. - Conditionalize setup of _sr4export fixup. Improve comments. - * config/pa/tm-hppa.h: Define INSTRUCTION_SIZE. Use a different - call dummy if PA_LEVEL_0 is defined. Better comments for call - dummys. Define offsets for LDIL/LDO instructions which load - function addresses. - * config/pa/tm-pro.h: Get rid of signal handling stuff. Define - PA_LEVEL_0 to disable mucking with space regs and such. - -Mon Apr 17 15:37:08 1995 Stu Grossman (grossman@andros.cygnus.com) - - * cpu32bug-rom.c monitor.h op50-rom.c remote-est.c rom68k-rom.c - w89k-rom.c: Remove loadtypes, loadprotos and baudrates. - * op50-rom.c: Fix copyrights and add load routine to op50n_cmds. - * rom68k-rom.c (_initialize_rom68k): Don't set baud rate. - * w89k-rom.c: Fix copyrights. - -Sun Apr 16 14:00:55 1995 Stu Grossman (grossman@andros.cygnus.com) - - * monitor.c: Move all xmodem stuff into xmodem.[ch]. Remove - unnecessary remoteloadprotocol and remoteloadtype support. - * (expect expect_prompt): Change names to monitor_expect and - monitor_expect_prompt. Make them global. - * (printf_monitor): Change name to monitor_printf. Make global. - * (monitor_read_memory): Flush command echo to avoid parsing - ambiguity with CPU32Bug monitor. - * (monitor_load): Remove remoteloadprotocol and remoteloadtype - support. Call target_ops->load_routine, default to - monitor_load_srec. - * (monitor_load_srec): Remove everything but S-record support. - * monitor.h (monitor_ops): Add load_routine to provide monitor - specific download capability. - * remote-est.c: Clean up copyrights and comments. - * w89k-rom.c: Use new xmodem support. - * xmodem.c xmodem.h: New files to support xmodem downloads. - * rom68k-rom.c remote-est.c: Fix copyrights, add load_routine - entry to monitor_ops. - * cpu32bug-rom.c: New file to support Moto BCC debuggers. - * config/m68k/est.mt (TDEPFILES): Add cpu32bug.o. - * config/pa/hppapro.mt (TDEPFILES): Add xmodem.o. - -Sat Apr 15 18:00:15 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * rem-multi.shar: Removed; superceded by gdbserver. - -Fri Apr 14 12:10:24 1995 Jim Kingdon - - * xcoffread.c (xcoff_sym_fns): Revise comment about merging this - with coffread.c. - - * breakpoint.c (fixup_breakpoints): Removed. - * rs6000-nat.c (vmap_symtab): Don't call fixup_breakpoints. - (vmap_ldinfo, xcoff_relocate_core): Call breakpoint_re_set. - - * coffread.c (coff_symfile_offsets): Allocate SECT_OFF_MAX - sections, not just SECT_OFF_MAX-1. - - * rs6000-nat.c (vmap_symtab), xcoffread.c: Re-do section offsets - to be indexed by SECT_OFF_* instead of xcoff section numbers. - * objfiles.c, remote.c: Remove comments regarding SECT_OFF_*. - * symtab.h: Revise comment about block_line_section. - * rs6000-nat.c (vmap_symtab): Don't relocate objfile->sections. - -Sat Apr 15 14:15:14 1995 Stan Shebs - - * mpw-make.in (init.c): Don't try to do symbolic {o} in sed - command, not allowed by some version of MPW Make. - * ser-mac.c (mac-setbaudrate): Make it actually set baud rates. - -Sat Apr 15 14:05:09 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * alpha-tdep.c (alpha_push_arguments): Fix typo (TYPE_VALUE -> - VALUE_TYPE). Do the cast for TYPE_CODE_BOOL, TYPE_CODE_CHAR, - TYPE_CODE_ENUM, and TYPE_CODE_RANGE as well as TYPE_CODE_INT. - -Sat Apr 15 14:04:32 1995 Per Bothner - - * alpha-tdep.c (alpha_push_arguments): Only cast to long for - TYPE_CODE_INT. - - -Thu Apr 13 16:17:04 1995 Rob Savoye - - * remote-array.c: New file for Array Tech LSI33k based controller - board. - -Thu Apr 13 12:23:31 1995 Kung Hsu - - * a29k-tdep.c (get_longjmp_target): Replace SWAP_TARGET_AND_HOST with - extract_address. - * remote-vxsparc.c: New file, preliminary check in, this configuration - not supported yet. - * remote-vxmips.c: ditto. - -Thu Apr 13 12:10:14 1995 Michael Meissner - - * rs6000-tdep.c (xcoff_add_toc_to_loadinfo): Don't use a prototype - to declare the function. - -Wed Apr 12 16:40:20 1995 Stan Shebs - - * monitor.h (init_monitor_ops): Declare. - * rom68k-rom.c: Clarify some comments. - (rom68k_open): Define as static, to match decl. - -Wed Apr 12 16:36:44 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * gdb.gdb: New file. - * .gdbinit: Move list-objfiles to gdb.gdb. - - * values.c (set_internalvar): Set modifiable flag of newval. - -Wed Apr 12 14:34:31 1995 Jim Kingdon - - * xcoffread.c: Call complain() rather than error() or printing a - warning. - - -Tue Apr 11 16:42:37 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * top.c, utils.c, defs.h: Remove error_hook. It is currently - unused and would need to hook into error_begin()/return_to_top_level(), - instead of error(), if it were to be used. - -Tue Apr 11 13:46:25 1995 Jim Kingdon - - * utils.c, defs.h (warning_begin): Renamed from warning_setup, for - consistency with error_begin. Also print warning_pre_print. - Document it better. - * utils.c (warning): Use it. - * utils.c (error_begin): Doc fix. - * rs6000-nat.c (vmap_ldinfo): If we don't find ldinfo for the - symfile_objfile, nuke it. - -Tue Apr 11 09:35:20 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * printcmd.c (print_address_numeric): Pass use_local to - print_longest, rather than always passing 1. - - * nlm/Makefile.in: Remove comments discussing munch. - - -Mon Apr 10 18:31:57 1995 Stan Shebs - - Merge in support for Mac MPW as a host. - (Old change descriptions retained for informational value.) - - * mpw-config.in (i386-unknown-go32): Change from aout. - (sh-hitachi-hms): New target. - * mpw-make.in (BISON): Use byacc instead of bison. - (VERSION): Bump to 4.14.1. - (*-pinsn.*): Remove mentions everywhere. - (all): Don't build MacGDB. - (gdb, SiowGDB): Depend on Version.r. - (Version.r): Generate from version info. - * main.c (main): Pass program name to START_PROGRESS, END_PROGRESS. - (main) [MPW]: Remove debugging hook. - * mac-xdep.c (debug_openp): New flag. - (mac_init): Set flag if env variable defined. - * ser-mac.c (mac_open): Clarify error message. - (mac_readchar): Call PROGRESS while looping. - (mac_write): Call sleep instead of sec_sleep. - (sec_sleep): Remove. - * source.c (openp) [MPW]: Only print debugging info if debugging. - * utils.c (query) [MPW]: Clarify that behavior is a bug. - - * mpw-make.in (init.c): Use open-brace instead of mpw-open-brace. - - * main.c, source.c: Remove hacks that replace long strings - with shorter ones, now solved portably. - - * config/m68k/xm-mpw.h (spin.h): Include. - (ALMOST_STDC): Only define if MPW_C. - * config/m68k/tm-mac.h: New file, Mac target definitions. - - * mpw-config.in (m68k-apple-macos, ppc-apple-macos, - i386-unknown-aout): New targets. - (mk.tmp): Add *DEPFILES definitions. - * mpw-make.in: Remove gC rules, clean up definitions for other - include files, bump version, fix bogus \ that should be \Option-d. - (init.c): Build correctly. - - * mpw-make.in (HFILES_NO_SRCDIR): Add somsolib.h - (ALLDEPFILES): Add somsolib.c. - (somsolib.o): Add some dependencies. - - * mpw-config.in: Use nm-empty.h if host is not target. - (xdepfiles): Add mac-xdep.c.o. - (xm_file): Remove. - * mpw-make.in: Add Fortran files. - (XDEPFILES): Remove. - - * mpw-config.in (MacSerial.h): Duplicate from standard Serial.h. - * ser-mac.c (MacSerial.h): Include instead of Serial.h. - - * mpw-make.in: Use {s} instead of {srcdir} everywhere. - (bindir, libdir): Remove extra colon. - (source.c): Compile with C instead of gC. - (c-exp.tab.c, ch-exp.tab.c, m2-exp.tab.c): Add {o}. - (install-only): Don't install MacGDB. - * source.c (openp) [MPW]: Add a debugging display. - (open_source_file) [MPW]: Use MPW basename finders. - [MPW_C]: Briefer versions of help for line and list commands. - - * mpw-make.in: Change references from paread.c to somread.c - - * mpw-make.in (VERSION): Update to 4.12.3. - (SiowGDB): New target, GDB using SIOW library. - (init-new.c): New target, attempt to generate init.c from sources. - (main.c.o, top.c.o): Put each in its own segment. - * main.c (main) [MPW]: Always call mac_init. - * utils.c (query) [MPW]: Always return "yes" if in MacGDB, output - an extra newline otherwise. - * mac-xdep.c: More comments in various places, remove junk. - (mac_init): Add tests for MPW and SIOW. - (use_wne, has_color_qd): Renamed. - (use_color_qd): New variable. - (grow_window): Only do console resizing to console window, - call resize_console_window. - (zoom_window): Call resize_console_window. - (resize_console_window, scroll_text): New functions. - (adjust_console_sizes): Always align viewrect to even multiples of - text lines. - (adjust_console_text): Always scroll by whole lines. - (hacked_vfprintf, hacked_puts, hacked_fputc, hacked_putc): Force a - recalculation of scroll positions if a newline was output. - (hacked_fflush): Similarly, for flushing. - (hacked_fgetc): New function, aborts if called in MacGDB. - * ser-mac.c (mac_readchar): Rename starttime to start_time, - remove debugging printf. - (mac_write): Sleep on first 4 writes. - (sec_sleep): New function, works like standard sleep. - * macgdb.r: Adjust positioning and contents of About box. - Set minimum size to 2000K, preferred size to 5000K. - * config/m68k/xm-mpw.h (fgetc): Define as a macro. - - * mpw-make.in (.c.o, .gc.o): Prefix segment names with gdb_. - (top.c.o, annotate.c.o): Add build rules. - * macgdb.r (SysTypes.r): Include. - ('vers'): New resource, version info. - (mFile, mEdit, mDebug): Enable all menu items. - (mDebug): Add key equivalents for continue, step, next. - (wConsole): Add zoom and close boxes to window. - * mac-xdep.c (new_console_window): New function, code taken from - mac_init. - (mac_command_loop): Use GetCaretTime for wait interval, call - do_idle on null events. - (do_idle): New function. - (zoom_window): Implement zooming. - (v_scroll_proc): New function, handles vertical scrolling. - (activate_window): Do activation of console window. - (do_menu_command): Implement items of file, edit, and debug menus. - (do_keyboard_command): Fix command extraction. - (adjust_console_sizes, adjust_console_text): New functions. - (hacked_fprintf, hacked_vfprintf, hacked_fputs, hacked_fputc, - hacked_putc): Don't call draw_console. - * ser-mac.c (mac_open): Add an error message for invalid ports. - (first_mac_write): New global. - (mac_write): Use first_mac_write to sleep on first several writes. - - * mpw-make.in (INCLUDE_CFLAGS): Add readline source dir. - (READLINE_CFLAGS, READLINE_SRC, READLINE_DIR): Uncomment. - (TSOBS): Don't compile inflow.c. - (all, install): Add MacGDB. - * main.c (main): Do Mac-specific init and command loop if a - standalone app, skip full option help message if compiling - with MPW C. - (gdb_readline): If MPW, add a newline after the (gdb) prompt. - * utils.c (_initialize_utils): If MPW, don't try to use termcap to - compute the window size. - * config/m68k/xm-mpw.h (printf, fprintf, fputs, fputc, putc, - fflush): Define as macros that expand into hacked_... versions. - (StandAlone, mac_app): Declare. - * macgdb.r (SIZE): Set the default partition to 4000K. - * mac-xdep.c (readline.h, history.h): Include. - (terminal.h): Don't include. - (mac_app): Define. - (gdb_has_a_terminal): Define Mac-specific version. - (do_keyboard_command): Simplify search for command string. - (readline): Define as gdb_readline. - Add other history/readline stubs to make main gdb link. - (hacked_fprintf, hacked_printf, hacked_vfprintf, hacked_fputs, - hacked_fputc, hacked_fflush): New functions, intercept output to - stdout and stderr, send to console window. - - * mpw-make.in (MacGDB): New target, standalone Mac-hosted gdb. - (XDEPFILES): Define. - (main.c.o): Compile with gC instead of C. - * mac-defs.h: New file, menu etc definitions shared between - C and Rez files. - * macgdb.r: New file, Rez (resource compiler) resource - definitions. - * mac-xdep.c: New file, Mac host interface code. - * config/m68k/xm-mpw.h (PATHNAME_SEPARATOR): Rename to - DIRNAME_SEPARATOR. - (PATHNAME_SEPARATOR_STRING): Remove. - (SIGQUIT, SIGHUP): Define. - (fileno, R_OK): Define. - - * mpw-config.in: New file, MPW configuration fragment. - * mpw-make.in: New file, MPW makefile fragment. - * config/m68k/xm-mpw.h: New file, MPW host definitions. - * ser-mac.c: New file, Mac serial interface. - -Mon Apr 10 16:47:57 1995 Kung Hsu - - * valprint.c (print_longest): Fix a syntax error in #ifdef - PRINTF_HAS_LONG_LONG. - - * config/mips/xm-irix5.h: turn on CC_HAS_LONG_LONG and - PRINTF_HAS_LONG_LONG. - * config/mips/tm-irix5.h: turn on FORCE_LONG_LONG. - -Sat Apr 8 02:47:45 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * mdebugread.c (parse_symbol): Use new variable - nodebug_var_symbol_type as type of variables which don't have any - ecoff debug info associated with them. - (parse_symbol, parse_procedure): Use heuristics to determine if - functions were compiled without debugging info and change their - type to nodebug_function_symbol_type. - (_initialize_mdebugread): Initialize nodebug_*_symbol_type. - - * source.c (line_info): Clear sal.pc for `info line' without - arguments. - -Fri Apr 7 17:43:01 1995 Stu Grossman (grossman@andros.cygnus.com) - - * monitor.c: make_xmodem_packet and print_xmodem_packet go away. - send_xmodem_packet shows up to do the obvious. Lots of fixes to - xmodem downloads including resetting of block number at start of - new transfers, fix for buffer overrun problem, addition of CRC - generation code. - * (monitor_open): loadtype_str and loadproto_str now default to - first entry in monitor_ops->loadtypes. - * (monitor_wait): Lengthen register dump buf, because of verbose - Winbond monitor. - * (monitor_fetch_register): Report unimplemented registers as 0. - * (monitor_read_memory): Only do 16 byte aligned transfers - because of formatting weirdness with the Winbond monitor. Also, - ignore non-hex, non-whitespace formatting between bytes (same - monitor). - * (monitor_load): Clean up logic. - * (monitor_load_srec): Re-do xmodem support. Move lots of it - into send_xmodem_packet. - * (getacknak): Get rid of polls and timeouts. Handle CRC - requests from receiver. - * (monitor_make_srec): Efficiency improvements. Don't call - sprintf to output two digit hex numbers. - * (crcinit, docrc): New, CRC-16 support routines. - * (send_xmodem_packet): New routine to generate either CRC-16 or - checksummed xmodem packets. - - * remote-est.c (est_loadtypes), rom68k-rom.c (rom68k_loadtypes): - Reduce tables down to only the load types supported by each - monitor. - - * w89k-rom.c (w89k_supply_register): Parses output of Winbond - register dumps. - * (w89k_loadtypes, w89k_loadprotos): Reduce to just srec/xmodem. - * (w89k_cmds): Add clear all breakpoints, memory fill, and dump - registers commands. - - * config/pa/tm-hppa.h: Define lots register offsets needed by - w89k-rom.c. - - -Thu Apr 6 17:00:46 1995 Michael Meissner - - * Makefile.in (X11_INCLUDES): Define as empty. - (X11_CFLAGS): Define as including $(X11_INCLUDES). - (X11_LIB_SWITCHES): Define as empty. - (X11_LIBS): Define as -lX11. - - -Wed Apr 5 19:57:38 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * mips-tdep.c (mips_print_register): Remove unused variable - our_type and call to init_type. Fixes memory leak. Reindent function. - - * mips-tdep.c (mips_print_register), findvar.c - (write_register_bytes): Make buffer char[] instead of unsigned - char[]. - -Mon Apr 3 19:28:14 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * top.c, utils.c, main.c, defs.h: Replace error_pre_print with two - variables: error_pre_print (for RETURN_ERROR) and quit_pre_print - (for RETURN_QUIT). Fixes a bug whereby typing ^C (e.g. in "maint - print sym") could output extraneous stuff. - * objfiles.c: Don't declare error_pre_print; defs.h does it. - -Mon Apr 3 13:48:28 1995 Stu Grossman (grossman@andros.cygnus.com) - - * monitor.h: Add MO_GETMEM_NEEDS_RANGE flag. - * monitor.c (monitor_read_memory): Use previously mentioned flag - to send proper format memory examine commands to the w89k monitor. - Also, try to handle bizarre format of memory dump... - - * op50-rom.c w89k-rom.c: Update to new monitor.[ch] conventions. - -Sat Apr 1 03:22:20 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * dbxread.c (process_one_symbol) [SOFUN_ADDRESS_MAYBE_MISSING]: - Handle relocated symbol address. - * partial-stab.h, case N_SO, SOFUN_ADDRESS_MAYBE_MISSING: - Do not relocate a zero address. - -Thu Mar 30 19:46:36 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config/a29k/tm-a29k.h: Nuke obsolete define CONTROL_END_ADDR; it - is nowhere used. - - * stabsread.c (read_range_type): Remove FIXME comment about - type-id (I presume this meant a number followed by = followed by a - type) versus type number; Per fixed it. - -Wed Mar 29 09:56:04 1995 Jason Molenda (crash@phydeaux.cygnus.com) - - * configure.in: sparc-*-sunos5* is same as sparc-*-solaris2*. - -Wed Mar 29 18:30:03 1995 Stan Shebs - - * remote-e7000.c (why_stop): Add new kinds of strings to expect - from the emulator. - (e7000_wait): Add interpretations for more stop reasons, - including warnings for write protect and cycle address errors. - -Wed Mar 29 17:09:29 1995 Stu Grossman (grossman@cygnus.com) - - * monitor.c monitor.h remote-est.c rom68k-rom.c: Add start of - support for interrupting target. - * monitor.c (monitor_open): Send stop command before doing - anything else. - * (monitor_load_srec): Fix record size calculation to prevent end - of segment from getting trashed. - * rom68k-rom.c: Update to latest version of struct monitor_ops. - * config/sparc/tm-sparc.h (FIX_CALL_DUMMY): Fix byte-order - problems. Makes DOS hosted function calling work. - * sparclite/crt0.s: Define _start to make COFF happy. - -Wed Mar 29 09:11:51 1995 Michael Meissner - - * defs.h (atof): Don't provide an external declaration if atof is - a macro. - -Wed Mar 29 00:01:07 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * rs6000-tdep.c (skip_prologue): Skip saving of LR and CR in - the stack frame, fix typos in `st rx,NUM(r1)' and `stu r1,NUM(r1)' - tests. - -Tue Mar 28 17:04:04 1995 Per Bothner - - * gdbtypes.c (create_range_type): If indextype has TYPE_FLAG_STUB - set, set TYPE_FLAG_TARGET_STUB. - (check_stub_type): Recalculate TYPE_LENGTH for range type. - * stabsread.c (read_range_type): If index type number is followed - by '=', back up, call read_type. and assume we have a true range. - * gdbtypes.h (TYPE_FLAG_TARGET_STUB): Update comment. - -Mon Mar 27 22:51:54 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * alpha-nat.c, irix4-nat.c, irix5-nat.c, mipsv4-nat.c, - sparc-tdep.c (supply_gregset, supply_fpregset): Fill inaccessible - registers with zero to handle recent read_register_bytes change. - * irix4-nat.c, irix5-nat.c, mipsv4-nat.c (supply_gregset, - fill_gregset): Fix handling of CAUSE_REGNUM. - * mips-nat.c (store_inferior_registers): Handle unwritable - registers when storing a single register. - * config/mips/tm-irix3.h (CAUSE_REGNUM, BADVADDR_REGNUM): - Fix definitions. - - * mdebugread.c (parse_symbol, psymtab_to_symtab_1): Clear - allocated mips_extra_func_info, if the debug info is corrupt, - the PDR to fill it in might be missing. - -Mon Mar 27 14:43:00 1995 Kung Hsu - - * vx-share/regPacket.h: a new file interfacing with vxworks. - -Sun Mar 26 13:22:47 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * breakpoint.c (bpstat_do_actions): Once we've executed the - commands, set bs->commands to NULL. - -Sat Mar 25 01:16:10 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * buildsym.c (patch_subfile_name): Update last_source_file - with the real source file name. - * dbxread.c (end_psymtab): Handle static functions in the - SOFUN_ADDRESS_MAYBE_MISSING case by passing pst->filename - to lookup_minimal_symbol. - (process_one_symbol): Ignore extra outermost context from - SunPRO cc and acc. - * stabsread.c (define_symbol): Do not complain for SunPRO - static variable encoding if STATIC_TRANSFORM_NAME is defined. - * sparc-tdep.c, config/sparc/tm-sun4sol2.h - (sunpro_static_transform_name): Renamed from - solaris_static_transform_name. - * config/sparc/tm-sun4os4.h (STATIC_TRANSFORM_NAME): - Define to sunpro_static_transform_name for acc 3.0 compiled - executables. - * procfs.c, config/alpha/nm-osf2.h (PROCFS_DONT_TRACE_FAULTS): - Renamed from PROCFS_DONT_TRACE_IFAULT, don't trace any faults - if defined. - * procfs.c (info_proc_siginfo): Cast sip->si_addr to - `unsigned long' and use `lx' format for printing it. - -Fri Mar 24 15:45:42 1995 Stu Grossman (grossman@cygnus.com) - - * configure.in: Move test for m68*-est-* before m68*-*-coff*. - * findvar.c: Move default def of CANNOT_STORE_REGISTER closer to - the beginning of the code. - * (write_register_gen): New routine. Analogous to - read_register_gen. - * (write_register_bytes): Another rewrite! Make it smarter about - not updating regs with the same value. - * monitor.c (printf_monitor readchar): Use stderr instead of - stdout to output debug info. Also cleanup readchar a little. - * (expect): Make sure that excessive responses are null - terminated. - * (monitor_open): Check for magic number in monitor_ops struct. - Allow multiple commands as init strings. Also, clear all - breakpoints. - * (monitor_resume monitor_wait): Send a command to dump all the - regs for those targets which don't do so when waking up after a - continue command. - * (monitor_wait): Handle excessive response output better. - * (monitor_write_memory): Use block fill, word, and long word - commands (if they exist) to write memory more efficiently. - * General cleanups to use flag bits instead of individual flag - words in monitor_ops struct. - * (monitor_command): Return output from command. - * (monitor_load_srec): Allocate buffer only once. Use alloca. - Wait for load response string instead of using a timeout to start - sending S-records. Fix bug where value of srec_frame shrinks. If - hashmark is set, print `-' for retransmissions. General cleanups. - * (monitor_make_srec): Get rid of S-record default type kludge. - * monitor.h: Use seperate struct for memory and register - read/write commands. Memory commands can come in byte, word, - long, and longlong forms. - * (monitor_ops): Change lots of fields. Generalize some stuff. - Put all flags into flags word. Allow init to be a list of commands. - Add command for clearing all breakpoints, block fill, dumping all - registers. - * remote-est.c: Rewrite to use new monitor conventions. - * config/m68k/est.mt (TDEPFILES): Add monitor.o. - * config/m68k/tm-est.h: Set NUM_REGS to 18. - * testsuite/gdb.base/break.exp: Lots of cleanups. Use gdb_test - more thoroughly. - -Thu Mar 23 23:20:00 1995 Jeff Law (law@snake.cs.utah.edu) - - * somsolib.c (som_solib_add): Handle case where a shared library - referenced by a core file has sections without the SEC_ALLOC bit - set (eg stabs sections). - -Thu Mar 23 15:07:08 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * breakpoint.c (bpstat_do_actions): For each element in the bpstat - chain, do all the commands regardless of whether they run the - inferior. - -Wed Mar 22 19:17:06 1995 Doug Evans - - * mem-break.c (LITTLE_BREAKPOINT, BIG_BREAKPOINT): Define as - BREAKPOINT if mono-endian. - (break_insn): Deleted. - (big_break_insn, little_break_insn): Define. - (memory_insert_breakpoint): Handle bi-endian cpus. - (BREAKPOINT_LEN): Define. - (memory_remove_breakpoint): Use it. - (memory_breakpoint_size): Likewise. - -Tue Mar 21 17:03:17 1995 Kung Hsu - - * sparc-stub.c: add nop after 'bg good_wim'. - * sparcl-stub.c: ditto. - -Tue Mar 21 13:34:12 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * infrun.c (handle_command): Don't print TARGET_SIGNAL_0, - TARGET_SIGNAL_UNKNOWN, or TARGET_SIGNAL_DEFAULT. - -Mon Mar 20 10:09:59 1995 Jeff Law (law@snake.cs.utah.edu) - - * hppab-nat.c (store_inferior_registers): Sync with HPUX version. - -Mon Mar 20 07:34:48 1995 Stu Grossman (grossman@cygnus.com) - - * hppah-nat.c (store_inferior_registers): Move check for - CANNOT_STORE_REGISTER to a better place. Fixes ptrace I/O errors - found by test suite during function calls, which attempts to write - unwritable registers. - -Sat Mar 18 02:02:24 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * mdebugread.c (parse_symbol): If finishing a function without - known parameter type info, set that from parameter symbols. - Remove commented-out add_param_to_type support. - -Thu Mar 16 16:38:03 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * xcoffread.c (process_linenos): Make sure filename we pass to - start_subfile will cause deduce_language_from_filename to return - the correct thing. Reindent function to GNU standards. - -Thu Mar 16 15:54:00 1995 J.T. Conklin - - * nlm/gdbserve.c (handle_exception): #if out call to StopBell, - as it is not available on NetWare 3 or PIN. - * nlm/ppc.c (StopBell): Removed. - -Thu Mar 16 12:14:41 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * xcoffread.c (read_xcoff_symtab): When creating a dummy parameter - inferred from the traceback tags, give its type the name - "". - - * stabsread.c (rs6000_builtin_type): Recognize types -31 to -34. - -Wed Mar 15 15:09:29 1995 Stu Grossman (grossman@cygnus.com) - - * findvar.c (read_register_bytes write_register_bytes): Make - these routines much smarter about updating registers from the - target, only doing so when absolutely necessary. This really - speeds up register modification on some remote targets. - - * monitor.c: More cleanups. Get rid of monitor_load_ascii_srec. - BFD makes this unnecessary. Lots of debugging speedups. - * (expect): NULL terminate return string. - * (monitor_open monitor_supply_register parse_register_dump - monitor_wait monitor_fetch_register): Switch to using GNU regexp - library to parse multi-register displays. - * (monitor_read_memory): Read multiple bytes (up to 16) at once. - * (monitor_create_inferior): Call clear_proceed_status to make run - command notice first breakpoint. - * (monitor_load): Clean up. Reset inferior_pid, set pc to start - address and reset symbol table stuff to make loads put things into - a fresh state. - * (monitor_load_srec): Lower sleep time to 1 second. - - * monitor.h (struct monitor_ops): Add register_pattern and - supply_register to monitor_ops. - - * rom68k-rom.c: Add new support for handling register dumps. - * config/m68k/tm-m68k.h: Define D0_REGNUM and A0_REGNUM for register - dump handling. - -Wed Mar 15 15:18:27 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * utils.c, defs.h (putchar_unfiltered, fputc_unfiltered): Make - argument be an int, not a char. Using a prototype followed by an - old-style function definition in a case where an argument is - widened is a GCC-ism not supported by the native AIX compiler. - -Wed Mar 15 12:22:35 1995 J.T. Conklin - - * nlmstub.def: Removed, this was moved to nlm/gdbserve.def - long ago. - - * configure.in (alpha-*-netware*): Removed configuration. - * config/alpha/{alpha-nw.mt, gdbserve.mt, tm-alphanw.h}: Removed. - * nlm/{README-ALPHA-NETWARE, aio.h, alpha-io.S, alpha-regdef.h, - alpha.c, alpha.h, altdebug.h}: Removed. - - * nlm/gdbserve.c (main): Add support for processing BOARD= - argument, deprecate NODE=. - -Wed Mar 15 10:58:26 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * c-exp.y (yylex): Make an empty character constant an error. - -Tue Mar 14 15:00:54 1995 Per Bothner - - * valops.c (value_arg_coerce): Do possible value_coerce_array - before determining type argument to value_cast. - -Tue Mar 14 10:41:41 1995 Kung Hsu - - * remote-es.c: Replace ignore with 0. - -Tue Mar 14 05:52:36 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * valops.c (value_repeat), eval.c (evaluate_subexp_standard): - If VALUE_REPEATED is already set, just error out. - - * valops.c (value_cast, value_slice), parse.c (follow_types): Add - FIXME-type-allocation comments. - - * gdbtypes.h (struct type): Fix comment about what units the - TYPE_LENGTH is in. - -Mon Mar 13 18:27:25 1995 Stan Shebs - - * ch-valprint.c (annotate.h): Include. - * eval.c (evaluate_subexp_standard): Remove unused variable. - (calc_f77_array_dims): Add parens to expression. - * f-exp.y (yylex): Add parens to expression, remove unused label. - * f-lang.h (calc_f77_array_dims): Declare. - * f-valprint.c (f_val_print): Remove unused variables. - -Mon Mar 13 15:25:47 1995 Jim Kingdon - - * alpha-tdep.c (find_proc_desc): If pdr.framereg field is -1, don't - use the PDR, just examine prologues instead. - - -Fri Mar 10 02:49:40 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - Fix problems with infinite recursion when printing a class - that contains a static instance of the class. - * cp-valprint.c (dont_print_vb_obstack): Renamed from - dont_print_obstack, made static. - (dont_print_statmem_obstack): New obstack, controls printing - of static member classes. - (_initialize_cp_valprint): Initialize it. - (cp_print_static_field): New function, handles printing of - static members. - (cp_print_value_fields): New parameter dont_print_statmem to - handle recursive printing of static member classes, use - cp_print_static_field to handle printing of static members. - * c-valprint.c (cp_print_value_fields): Update prototype and - call to include additional dont_print_statmem parameter. - * c-valprint.c, f-valprint.c (dont_print_obstack): Remove unused - extern declaration. - - * alpha-tdep.c, findvar.c, infptrace.c: Include . - - * config/alpha/tm-alpha.h (FRAME_FIND_SAVED_REGS): Call - alpha_find_saved_regs if fi->saved_regs is still NULL. - - * elfread.c (elf_symtab_read): Ensure that the filename field - of a minsym is nonempty. Ignore solib trampoline symbols from - the main symbol table, they might have a bogus value. - - * procfs.c (set_proc_siginfo), config/alpha/alpha-osf2.mh: - Fix typos in comments. - -Thu Mar 9 17:19:47 1995 Jim Kingdon - - * mdebugread.c (parse_symbol, psymtab_to_symtab_1): Initialize - pdr.framereg field of MIPS_EFI_SYMBOL_NAME symbol to -1. That way - we know whether the PDR ever got set. - * mips-tdep.c (find_proc_desc): If pdr.framereg field is -1, don't - use the PDR, just examine prologues instead. - -Wed Mar 8 23:35:10 1995 Jeff Law (law@snake.cs.utah.edu) - - * somsolib.c (som_solib_section_offsets): Get offset of text - section right. - -Wed Mar 8 16:12:21 1995 Stu Grossman (grossman@cygnus.com) - - - * source.c (forward_search_command reverse_search_command): Set - convenience variable $_ to be the line # of the match. - * symtab.c (decode_line_1): Allow convenience variables to be - used in line specs (for breakpoints and such). - -Wed Mar 8 12:51:00 1995 Stan Shebs - - * Makefile.in (VERSION): Bump to 4.14.1. - * NEWS, README: Update for 4.14. - * i386v-nat.c (i386_insert_aligned_watchpoint): Fix declaration. - (i386_insert_nonaligned_watchpoint): Call aligned instead of - generic watchpoint insertion. - -Tue Mar 7 19:26:10 1995 Per Bothner - - * valops.c (value_slice): Do COERCE_VARYING_ARRAY. - -Tue Mar 7 00:23:47 1995 Stu Grossman (grossman@cygnus.com) - - * monitor.c, array-rom.c, monitor.h, rom68k-rom.c: Move target_ops - into monitor.c. - * monitor.c (monitor_create_inferior): Allow run command to start - program. - - * monitor.c (monitor_load): Set PC to start address when done - loading. - - * array-rom.c, monitor.h, rom68k-rom.c: Clean up target_ops. - Remove ref to monitor_create_inferior. - - * monitor.c: More general cleanups. Add prototypes, remove - unused routines. Fix bug with wrong number of args to error(). - - * main.c (main): Don't start up GUI when running under gdb mode - in emacs. - - * Makefile.in: Add rules for monitor.o and rom68k-rom.o to make - Sun make (with VPATH) work... - - * monitor.c, monitor.h, rom68k-rom.c: Serious cleanup to make IDP - (rom68k) target work right. - * array-rom.c, op50-rom.c, w89k-rom.c: Partial updates to new - monitor.c interface. More work needs to be done here. - * config/m68k/tm-monitor.h: Change DECR_PC_AFTER_BREAK to 0 to - match the IDP monitor. Also, set NUM_REGS to 18 cuz there's no - floating-point for this card. - - * serial.h, ser-go32.c, ser-go32-para.c, ser-mac.c, ser-tcp.c, - ser-unix.c: Add SERIAL_SETSTOPBITS to set the number of stopbits - (needed for IDP board?!?!?). - - * defs.h, utils.c, remote-hms.c, remote-pa.c, remote.c: Fix defs - and usage of fputc_unfiltered and putchar_unfiltered. Eliminate - putc_unfiltered (it's superfluous). - - * command.h, command.c, top.c: Add var_enum command type. It's - like var_string but allows only only one of the specified strings. - -Mon Mar 6 15:03:59 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * valops.c (value_cast): Don't use backslash newline--pre-ANSI - compilers (such as SunOS4 /bin/cc) don't generally support it - except in some contexts. - -Fri Mar 3 17:42:48 1995 Per Bothner - - * valops.c (value_cast): Check for cast to array type *before* - we coerce array to pointer (in case arg2 is already array). - - * valops.c (call_function_by_hand): Set using_gcc to 2 if using - gcc2. Needed for REG_STRUCT_HAS_ADDR to work on sparc. - Also check REG_STRUCT_HAS_ADDR for union, array and string types. - - * valops.c (call_function_by_hand): Re-arrange code for pushing - paramaters on the stack so we can do better STACK_ALIGN. - - * valops.c (call_function_by_hand): Call error if the number - of arguments is fewer than parameter types in function type. - -Fri Mar 3 17:13:05 1995 Doug Evans - - * sparc-tdep.c (sparc_extract_struct_value_address): Move - sparc64 support to here. - (sparc64_extract_struct_value_address): Deleted. - (dump_ccreg): Add a prototype so long long arg -> int. - * sparc/tm-sp64.h (USE_STRUCT_CONVENTION): Define. - (EXTRACT_STRUCT_VALUE_ADDRESS): Delete. - -Fri Mar 3 15:12:12 1995 Jeff Law (law@snake.cs.utah.edu) - - * hpread.c (hpread_record_lines): New argument "offset". All - callers changed. Use it to handle dynamic address relocation. - (hpread_build_psymtabs): Adjust texthigh as we read each function - debug symbol. Fix computation of texthigh. - (hpread_read_subrange_type): Work around macro bugs in HP's - compilers. - (hpread_process_one_debug_symbol): Correctly map source lines. - - * somread.c (check_strange_names): Filter names emitted by the HP - compiler when generating PIC code. - - * valops.c (value_struct_elt_for_reference): Work around macro - bugs in HP's compilers. - * c-exp.y (block): Likewise. - -Fri Mar 3 12:27:28 1995 Jim Kingdon - - * rs6000-tdep.c (push_dummy_frame): Fix order of arguments to - store_address. - - * utils.c [_AIX]: Include stddef.h instead of #defining size_t. - -Fri Mar 3 12:33:24 1995 Michael Meissner - - * rs6000-tdep.c (skip_prologue): Skip multiple stores of the saved - registers that GCC emits on the PowerPC by default in addition to - the store multiple instruction used on the Power series. - -Fri Mar 3 00:54:58 1995 Doug Evans - - * sparc-tdep.c (decode_asi): New function. - (sparc_print_register_hook): Pretty print more v9 registers. - * sparc/tm-sp64.h (REGISTER_NAMES): Fix some typos. - -Thu Mar 2 22:20:22 1995 Doug Evans - - * dwarfread.c (struct dieinfo): Use CORE_ADDR for at_{low,high}_pc. - (target_to_host): Change result type to CORE_ADDR. - -Thu Mar 2 15:13:04 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * rs6000-tdep.c: Fix byte-swapping sins. - -Thu Mar 2 16:48:45 1995 Michael Meissner - - * rs6000-tdep.c (branch_dest): Minor code cleanup, don't share - code between branch unconditional and branch conditional cases. - -Wed Mar 1 09:41:26 1995 Doug Evans - - Various changes for sparc64. - * sparc-tdep.c (NUM_SPARC_FPREGS): Define. - (SPARC_INTREG_SIZE): Define. - (*): Use SPARC_INTREG_SIZE instead of REGISTER_RAW_SIZE (intreg) - where appropriate. - (enum branch_type): New value `done_retry'. - (isbranch): Renamed from isannulled. All callers changed. - Support new sparc64 branch insns. - (single_step): Handle done_retry. - (sparc_extract_struct_value_address): Don't assume 4 byte regs. - (get_saved_register): Likewise. - (sparc_push_dummy_frame): Likewise. - (sparc_frame_find_saved_regs): Likewise. - (sparc_pop_frame): Likewise. Don't refer to FPS_REGNUM, CPS_REGNUM, - or PS_REGNUM if not sparc64. sparc64 has 64 fp regs. - (sparc64_extract_struct_value_address): New function. - (dump_ccreg, sparc_print_register_hook): Likewise. - * sp64-tdep.c: Deleted. - * sparc/tm-sp64.h (GDB_TARGET_IS_SPARC64): Define. - (NUM_REGS): Reduce by 2, cle/tle are in the pstate reg. - (CC_HAS_LONG_LONG): Define. - (REGISTER_NAMES): Delete cle/tle and reorganize. - (PS_REGNUM, FPS_REGNUM, CPS_REGNUM): Delete, they're ifdef'd out of - sparc-tdep.c now. - (REGISTER_BYTES): Update. - (REGISTER_CONVERT_TO_VIRTUAL, REGISTER_CONVERT_TO_RAW): Delete. - (EXTRACT_RETURN_VALUE): Delete. Use definition in tm-sparc.h. - (NO_SINGLE_STEP): Likewise. - * sparc/tm-sparc.h (EXTRACT_VALUE_RETURN): Don't assume 4 byte regs. - * sparc/sp64.mt: Move simulator support ... - * sparc/sp64sim.mt: ... to here. - -Wed Mar 1 13:14:42 1995 Kung Hsu - - * remote-vx960.c: new file for target specific register packaging. - * remote-vx68.c: ditto. - * config/i960/vxworks960.mt: add remote-vx960.o. - * config/m68k/vxworks68.mt: add remote-vx68.o. - -Wed Mar 1 13:42:49 1995 Michael Meissner - - * remote.c (remote_wait): Make calls to strtol be type correct by - passing the address of a char * pointer instead of an unsigned - char *. - - * rs6000-tdep.c (push_dummy_frame): Cast sp to char * when calling - write_memory to make things type correct. - -Wed Mar 1 12:17:31 1995 Michael Meissner - - * ch-exp.y, c-exp.y, f-exp.y, m2-exp.y (yy defines): Support the - standard Linux yacc by adding more names to be redefined with a - prefix. - -Tue Feb 28 22:55:47 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * hppa-tdep.c (pa_print_registers), monitor.c: Use - extract_unsigned_integer and friends, not SWAP_TARGET_AND_HOST. - * defs.h, findvar.c: Move SWAP_TARGET_AND_HOST back to findvar.c. - Rename it to SWAP_FLOATING to make it clear it is no longer for - integers. - -Tue Feb 28 14:38:39 1995 Kung Hsu - - * defs.h (SWAP_TARGET_AND_HOST): check endianess at runtime not - compile time. - - - * vx-share/ptrace.h: merge in WRS new ptrace requests. - - * defs.h: fix a syntax error. - - * a29k-tdep.c (get_longjmp_target): add this function, from WRS. - * remote-vx.c: move read_register and write_register out to - target specific files. - * remote-vx29k.c (get_fp_contnets): add this function, from WRS. - - * defs.h: define SWAP_TARGET_AND_HOST macro. - * findvar.c, monitor.c, hppa-tdep.c: remove definition of - SWAP_TARGET_AND_HOST. - -Tue Feb 28 08:31:40 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * alpha-tdep.c (find_proc_desc): Only attempt to set - PROC_LOCALOFF (found_heuristic) if found_heuristic is non-NULL. - -Mon Feb 27 11:56:32 1995 Stan Shebs - - * monitor.c: General gcc -Wall lint cleanup and reformat. - (monitor_command): If no args, send an empty command. - -Thu Feb 23 21:07:25 1995 Stu Grossman (grossman@cygnus.com) - - * monitor.c (monitor_load_ascii_srec): Add a one second sleep - after send LOAD_CMD to prevent loss of first S-record. - -Tue Feb 21 20:48:42 1995 Per Bothner - - * valops.c (call_function_by_hand): Set using_gcc to 2 if gcc-2. - Call error if too few arguments. - If REG_STRUCT_HAS_ADDR (structs passed by invisible reference), - copy and convert to reference *before* we calculate alignment. - Also, make sure structs allocated for return values and invisible - reference don't violate STACK_ALIGN. - -Tue Feb 21 23:29:59 1995 Per Bothner - - * ch-exp.y (expression_conversion): Recognize 'ARRAY () TYPE (EXPR)' - (same as C's '(TYPE[])EXPR') - -Tue Feb 21 11:47:26 1995 Stan Shebs - - * top.c (print_gdb_version): Update the year. - -Sun Feb 19 14:31:57 1995 Jim Kingdon - - * Makefile.in (CC_FOR_TARGET, CXX_FOR_TARGET): Look for newlib in - `..' not in `../..'. - -Sun Feb 19 11:05:28 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * procfs.c (unconditionally_kill_inferior): Don't issue a PIOCKILL - in addition to a PIOCSSIG to kill the inferior. - -Thu Feb 16 15:06:12 1995 Per Bothner - - * parse.c (follow_types): Given (TYPE[]) (i.e. with no length), - create a 0-length array type, and set BOUND_CANNOT_BE_DETERMINED. - * valops.c (value_cast): If a cast like (TYPE[])VALUE (i.e. array - of unknown length) use sizeof(VALUE)/sizeof(TYPE) as the length. - * c-typeprint.c (c_type_print_varspec_suffix): If array length - is 0, print it, but not if upper_bound is BOUND_CANNOT_BE_DETERMINED. - -Thu Feb 16 16:06:50 1995 Michael Meissner - - * dcache.c (insque, remque): Rewrite Linux support. - -Wed Feb 15 12:33:20 1995 Michael Meissner - - * config/powerpc/tm-ppc-eabi.h (TEXT_SEGMENT_BASE): Define as 1. - - * dcache.c (insque, remque): If compiling in standard C on Linux, - protect insque and remque with macros to cast the pointer - arguments to the proper type. - -Tue Feb 14 17:16:41 1995 Stu Grossman (grossman@cygnus.com) - - * annotate.c, breakpoint.c, defs.h, top.c: Replace - enable/disable_breakpoint_hook with modify_breakpoint_hook. - -Tue Feb 14 16:58:07 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * expression.h: Move declaration of evaluate_subexp_with_coercion - from here... - * value.h: ...to here. - * expression.h: Don't include value.h - -Tue Feb 14 11:46:07 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * expression.h: Move include of value.h until after declaration of - enum exp_opcode. - -Sun Feb 12 13:47:30 1995 Stan Shebs - - * remote-e7000.c: Comprehensive cleanup; removal of dead code, - simplify code, declare things, format to standards. - (inferior.h, value.h, command.h, remote-utils.h): Include. - (e7000_login): Rename to e7000_login_command. - (e7000_ftp): Rename to e7000_ftp_command. - (e7000_drain): Rename to e7000_drain_command. - - * irix5-nat.c (string.h): Include near beginning of file. - -Sun Feb 12 12:36:38 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * valops.c (value_arg_coerce): Use VALUE_TYPE not SYMBOL_TYPE on - arg, it is a value not a symbol. - - gcc -Wall lint: - * eval.c: Move declaration of evaluate_subexp_with_coercion from here.. - * expression.h: ..to here. - * expression.h: Include value.h. - * ch-lang.c (evaluate_subexp_chill): Add default case in switch. - -Sun Feb 12 11:03:47 1995 Per Bothner - - * language.h (struct language_defn): New field evaluate_exp. - * c-lang.c (c_language_defn, cplus_language_defn, asm_langauge_defn), - f-lang.c (f_language_defn), language.c (unknown_language_defn, - auto_language_defn, local_language_defn), m2-lang.c (m2_language_defn): - Set evaluate_exp to evaluate_subexp_standard. - * ch-lang.c (evaluate_subexp_chill): New function. Chill-specific - support for MULTI_SUBSCRIPT. - (chill_language_defn): Set evaluate_exp to evaluate_subexp_chill. - * eval.c (enum noside): Move from here .... - * expression.h (enum noside): ... to here. - (evaluate_subexp_standard): New prototype. - * eval.c (evaluate_subexp): Renamed to evaluate_subexp_standard. - Removed lo-longer-needed test for chill_varying_type. - (evaluate_subexp): New. Calls exp->language_defn->evaluate_exp. - - * ch-exp.y (maybe_expression_list): New non-terminal. - (primitive_value): Allow empty parameter list. - -Sun Feb 12 10:02:16 1995 Per Bothner - - * buildsym.c (finish_block): If finishing a function without known - parameter type info, set that from parameter symbols. - * c-typeprint.c (c_type_print_varspec_suffix): For TYPE_CODE_FUNC, - print parameter types, if available. - * ch-typeprint.c (chill_type_print_base): Likewise. - - * gdbtypes.h (struct type): Remove function type field. - (TYPE_FUNCTION_TYPE): Remove macro. We can't as simply re-use - function types now that we're also storing parameter types. - And the payoff is much less. - * gdbtypes.c (make_function_type): Don't use/set TYPE_FUNCTION_TYPE. - (recursive_dump_type): Don't print TYPE_FUNCTION_TYPE. - * dwarfread.c (read_subroutine_type): Don't set TYPE_FUNCTION_TYPE. - - * valops.c (value_arg_coerce): Now takes param_type argument. - (call_function_by_hand): Convert arguments with value_arg_coerce - early, and overwrite original args with converted args. - No longer need multiple calls to value_arg_coerce. - (value_arg_push): Removed. - * hppa-tdep.c (hppa_push_arguments): No longer call value_arg_coerce. - * mips-tdep.c (mips_push_arguments): Likewise. - * alpha-tdep.c (alpha_push_arguments): Likewise. - * rs6000-tdep.c (push_arguments, ran_out_of_registers_for_arguments): - Likewise. - * value.h (value_arg_coerce): Remove declaration. (It's now static.) - - * valops.c (value_cast): Do COERCE_VARYING_ARRAY after COERCE_REF. - - * symtab.c (add_param_to_type): Remove (commented-out) function, - since that functionality has been re-written. - * coffread.c: Remove commented-out add_param_to_type support. - * mdebugread.c (parse_symbol): Likewise. - * stabsread.c (define_symbol): Likewise. - -Sun Feb 12 09:03:47 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * buildsym.c (start_subfile): Set language for f2c like for cfront. - -Thu Feb 9 20:20:11 1995 Rob Savoye - - * op50n-rom.c: Add the control registers. - -Thu Feb 9 15:46:39 1995 Stan Shebs - - * Makefile.in (CLIBS): Add $(LIBIBERTY) before, in addition to - after, any host/target/native libraries. - * dcache.c (insque, remque): Remove declarations. - * gdbtypes.h (type_code): Remove trailing comma. - - From Peter Schauer: - * xcoffread.c (read_xcoff_symtab) [C_HIDEXT]: Move #ifdef - STATIC_NODEBUG_VARS inside case. - -Thu Feb 9 07:43:41 1995 Jim Kingdon - - * config/sparc/tm-sun4sol2.h: Define STATIC_TRANSFORM_NAME. - * partial-stab.h: Call it. - * stabsread.c (define_symbol) [STATIC_TRANSFORM_NAME]: Call - STATIC_TRANSFORM_NAME to get the name and use minimal symbols to - get the address. - * sparc-tdep.c (solaris_static_transform_name): New function. - -Thu Feb 9 12:09:09 1995 Jeff Law (law@snake.cs.utah.edu) - - * somread.c (som_symtab_read): Handle dynamic relocation for both - text and data symbols. - (som_symfile_offsets): If objfile is a shared library, then get - text and data offsets from the shared library structures. - * somsolib.c (som_solib_add): Copy the bfd pointer from the - objfile rather than reopening the file again. - (som_solib_section_offsets): New function. - * somsolib.h (som_solib_section_offsets): Declare. - -Wed Feb 8 20:32:18 1995 Jim Kingdon - - * config/sparc/tm-sun4sol2.h, dbxread.c: Rename - N_SO_ADDRESS_MAYBE_MISSING to SOFUN_ADDRESS_MAYBE_MISSING. - * symtab.h (minimal_symbol) [SOFUN_ADDRESS_MAYBE_MISSING]: Add - filename field. - * elfread.c (record_minimal_symbol_and_info), - minsyms.c, symtab.h (prim_record_minimal_symbol_and_info): Return - newly created symbol. - * elfread.c (elf_symtab_read) [SOFUN_ADDRESS_MAYBE_MISSING]: - Set filename field of minimal symbol. - * symmisc.c (dump_msymbols) [SOFUN_ADDRESS_MAYBE_MISSING]: - Print filename field. - * minsyms.c, symtab.h (lookup_minimal_symbol): New arg sfile. - * symm-tdep.c, somsolib.c, hppa-tdep.c, c-exp.y, f-exp.y, - m2-exp.y, nindy-tdep.c, m3-nat.c, irix5-nat.c, hpread.c, - os9kread.c, breakpoint.c, alpha-tdep.c, valops.c, symtab.c, - printcmd.c, dbxread.c: Change callers to pass NULL for sfile. - * dbxread.c (process_one_symbol) [SOFUN_ADDRESS_MAYBE_MISSING]: - Find address of function from minimal symbols. - * partial-stab.h, case 'f', 'F': Call find_stab_function_addr - instead of getting pst->textlow from the stab. - * minsyms.c (find_stab_function_addr): New function. - -Wed Feb 8 19:19:56 1995 Rob Savoye - - * monitor.c: Fix so all the output shows up in the GUI command - window. - -Mon Feb 6 18:50:59 1995 Stan Shebs - - * i386-tdep.c (_initialize_i386_tdep): Put void decl on separate - line, so init.c generation works correctly. - -Mon Feb 6 14:44:36 1995 Rob Savoye - - * config/mips/idt.mt: Add support for the lsi33k target. - * config/sparc/sun4sol2.mh: Add support for ser-tcp. - * array-rom.c: Finish the rest of the support commands needed by - GDB. - * mips-tdep.c: Add LSI33k register names and processor type. - -Sat Feb 4 13:29:52 1995 Stan Shebs - - * config/m68k/est.mt (TDEPFILES): Remove m68k-pinsn.o. - -Fri Feb 3 16:47:31 1995 Kung Hsu - - * ser-go32-para.c (dos_read): fix syntax errors. - -Fri Feb 3 11:19:20 1995 Stu Grossman (grossman@cygnus.com) - - * core.c (dis_asm_read_memory), defs.h, top.c: Get rid of - dis_asm_read_memory_hook. We can now call the disassemblers - directly and have no need for this hook anymore. - * defs.h, printcmd.c: Make print_insn be static. - - * ser-go32.c (dos_comisr): Make this 8 bit clean. - * (dos_open dos_close): Allow multiple opens to the same device. - Use a ref count to prevent unwanted deallocations. - * sparcl-tdep.c: Put #ifdefs around all socket stuff to make GO32 - happy. - * (sparclite_ops): Switch to download_stratum. - * target.h (enum strata): Move download_stratum before - process_stratum so that executable targets get pushed on top of - download targets. - -Thu Feb 2 19:02:45 1995 Rob Savoye - - * array-rom.c: Remove the non GDB remote protocol config stuff. - - * monitor.c: All reading/writing functions for memory and - registers work. - -Thu Feb 2 16:11:04 1995 Kung Hsu - - * ser-go32-para.c: new file for go32 parallel port communication. - -Thu Feb 2 13:58:40 1995 Stan Shebs - - * Makefile.in (VERSION): Bump to 4.13.2. - -Thu Feb 2 07:27:56 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - Fix compiler warnings: - * remote-e7000.c (printf_e7000debug): Rename to puts_e7000debug - and have the caller do the sprintf. Saves us from varargs hell. - (normal): Define before use. - * remote-e7000.c: Reindent a few things. - -Wed Feb 1 21:16:42 1995 Per Bothner - - * f-typeprint.c (f_type_print_varspec_suffix): Print array index - ranges in reverse order. - * f-valprint.c (f77_create_arrayprint_offset_tbl): Fix calculation. - - * eval.c (evaluate_subscript): Don't call value_subscript, since - it adjusts for lower bound and enforces ranges. - - * expression.h (exp_code): Remove MULTI_F77_SUBSCRIPT, OP_F77_SUBSTR. - * eval.c, parse.c: Removed uses of removed opcodes. - * eval.c (evaluate_subexp): Clean up handling of - OP_UNDETERMINED_ARGLIST (no backtracking, more general). - - * f-valprint.c (f_val_print): Print TYPE_CODE_STRING using - LA_PRINT_STRING, and not val_print_string (which reads from inferior). - - * ch-lang.c (chill_is_varying_struct), ch-lang.h: Remve function - duplicate function made redundant by chill_varying_type. - - Re-write of f77 string and complex number support: - - * language.h (struct language_defn): New fields string_lower_bound - and string_char_type. - * c-lang.c (c_language_defn, cplus_language_defn, asm_language_defn), - language.c (unknown_language_defn, auto_language_defn, - local_language_defn), m2-lang.c (m2_language_defn), f-lang.c - (f_language_defn), ch-lang.c (chill_language_defn): Set new fields. - * gdbtypes.c (create_string_type): Use new string_char_type field. - * valops.c (value_string): Use new string_lower_bound field. - - * defs.h (TARGET_COMPLEX_BIT, TARGET_DOUBLE_COMPLEX_BIT): Removed. - * f-lang.c (f_create_fundamental_type, _initialize_f_language), - m2-lang.c (m2_create_fundamental_type), - gdbtypes.c (_initialize_gdbtypes): Set TYPE_TARGET_TYPE of complex - types. Set their TYPE_CODEs to TYPE_CODE_COMPLEX. - * mdebugread.c (mdebug_type_complex, mdebug_type_double_complex): - Removed. Use builtin_type_complex and builtin_type_double_complex. - - * gdbtypes.h (enum type_code): Removed TYPE_CODE_LITERAL_STRING - and TYPE_CODE_LITERAL_COMPLEX. - * c-typeprint.c, f-typeprint.c, f-valprint.c, eval.c: Removed uses of - TYPE_CODE_LITERAL_STRING and TYPE_CODE_LITERAL_COMPLEX. - * gdbtypes.c, gdbtypes.h (f77_create_literal_complex_type, - f77_create_literal_string_type): Removed. - * value.h (VALUE_LITERAL_DATA, VALUE_SUBSTRING_MEMADDR, - VALUE_SUBSTRING_MYADDR): Removed. - - * expression.h (enum exp_opcode): Rename OP_F77_LITERAL_COMPLEX to - OP_COMPLEX. - * parse.c: Update accordingly. - - * f-valprint.c (f77_print_cmplx): Removed. - (f_val_print case TYPE_CODE_COMPLEX): Re-write to use print_floating. - - * f-exp.y (STRING_LITERAL): Use OP_STRING instead of OP_ARRAY. - * eval.c (evaluate_subexp): For case OP_ARRAY, don't call - f77_value_literal_string. - * valops.c, value.h (f77_value_literal_string, f77_value_substring, - f77_assign_from_literal_string, f77_assign_from_literal_complex): - Removed. - (value_assign): No longer need to handle literal types. - * valops.c (f77_value_literal_complex), value.h: Re-written and - renamed to value_literal_complex. Last arg is now a (complex) type. - * valops.c (f77_cast_into_complex): Re-written and renamed to - cast_into_complex. - * eval.c (evaluate_subexp): Update accordingly. - - * ch-valprint.c (chill_val_print): On TYPE_CODE_STRING, don't - print address for non-'s'-formats. - * ch-typeprint.c, ch-valprint.c: Use chill_varying_type instead - of chill_is_varying_struct. - -Wed Feb 1 13:27:33 1995 Stan Shebs - - gcc -Wall lint. - * alpha-tdep.c (alpha_in_lenient_prologue): Comment out. - (after_prologue): Remove unused local b. - * procfs.c (thread.h): Include. - (pr_flag_table, pr_why_table, faults_table, siginfo_table): Use - nested braces in initializer. - * top.c (initialize_targets, initialize_utils): Declare. - (locate_arg, insert_args): Add parens around tested assignments. - * remote-utils.c (sr_scan_args): Remove decl of strtol. - * remote.c (thread.h): Include. - (remote_wait): Remove unused local p2. - * sparc-tdep.c (fill_gregset, fill_fpregset): Remove decls of - registers array. - - defs.h (stdlib.h): Include. - (exit, perror, atoi, qsort, memcpy, memcmp): Don't declare. - (fclose, atof, malloc, realloc, free, strchr, strrchr, strstr, - strtok, strerror): Don't specify parameter types in declaration. - -Wed Feb 1 12:23:57 1995 Per Bothner - - * ch-exp.y (value_string_element, string_primitive_value, - start_element, left_element, right_element, slice_size, - lower_element, upper_element, first_element): Removed. - (value_string_slice, value_array_slice): Replaced by ... - (slice): New non-terminal, with working slice support. - (primitive_value_lparen, rparen): New non-terminals. - (maybe_tuple_elements): New non-terminal, to allow empty tuples. - (idtokentab): Added "up". - - * value.h (COERCE_VARYING_ARRAY): New macro. - * valarith.c (value_subscript): Use it. - * valops.c (value_cast): Likewise. Also, do nothing if already - correct type, and allow converting from/to range to/from scalar. - - * valops.c, value.h (varying_to_slice, value_slice): New functions. - * eval.c (OP_ARRAY): Add cast for array element. - * expression.h (TERNOP_SLICE, TERNOP_SLICE_COUNT): New exp_opcodes. - * valops.c (chill_varying_type): Moved function frp, here ... - * gdbtypes.c (chill_varying_type), gdbtypes.h: ... to here. - * parse.c (length_of_subexp, prefixify_subexp): Add support - for TERNOP_SLICE, TERNOP_SLICE_COUNT. - * expprint.c (print_subexp, dump_expression): Likewise. - * eval.c (evaluate_subexp): Likewise. - - * eval.c (evaluate_subexp case MULTI_SUBSCRIPT): Don't call - value_x_binop on a Chill varying string. - -Tue Jan 31 13:51:53 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config/m68k/monitor.mt, - config/pa/{hppabsd.mt,hppahpux.mt,hppaosf.mt,hppapro.mt}: Put - depfiles in TDEPFILES not REMOTE_O. - -Tue Jan 31 11:14:44 1995 Steve Chamberlain - - From nigel@algor.co.uk. - * ser-go32.c (dos_close): Don't crash if scb null. - (dos_sendbreak): New function. - (dos_ops): Point to dos_sendbreak. - (dos_info): Calculate COM number correctly. - -Tue Jan 31 09:40:11 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * xcoffread.c (process_xcoff_symbol): Use new variables - func_symbol_type and var_symbol_type as type of functions and - variables which don't have any stabs associated with them. - Reindent most of function. - (_initialize_xcoffread): Initialize *_symbol_type. - - * xcoffread.c (read_xcoff_symtab): Reindent most of function. - Put C_HIDEXT symbols in the minimal symbols, rather than ignoring - them (this part commented out as I didn't quite get it to work). - (cs_to_section, find_targ_sec): New functions, to support above code. - * xcoffread.c (RECORD_MINIMAL_SYMBOL): Only skip '.' if it is - actually present. - -Mon Jan 30 17:34:24 1995 Stu Grossman (grossman@cygnus.com) - * sparcl-tdep.c: Add `sparclite' target for doing serial and udp - downloads to SPARClite demo boards. - -Sun Jan 29 09:43:22 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * remote.c, remote-pa.c: Remove #if 0'd icache code. It has had - no hope of working as is for a long time (in particular, shebs' 27 - Jan 95 change confuses the issue further--target_read_memory and - xfer_core_file do *not* do the same thing in this context). - Revise comment. - -Sat Jan 28 13:40:46 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * elfread.c (elf_symtab_read): Do not test BSF_GLOBAL for - procedure linkage table symbols, it is no longer set due to the - Jan 6 BFD change in bfd/elfcode.h. - -Fri Jan 27 17:08:06 1995 Stan Shebs - - * top.c (use_windows): Clarify comments. - - * convex-tdep.c (xfer_core_file): Comment out. - * config/convex/tm-convex.h (XFER_CORE_FILE): Remove. - * remote.c, remote-pa.c (remote_fetch_word): Change xfer_core_file - references to target_read_memory. - * gdbcore.h (xfer_core_file, core_open, core_detach): Remove - declarations. - * corelow.c (core_open, core_detach): Make static. - - * arm-tdep.c: Make it compile. - (exec_file_command, xfer_core_file): Comment out. - (arm_print_insn): Remove, now in libopcodes. - (skip_prologue): Comment out most of body. - (arm_frame_find_saved_regs): Move here from tm-arm.h. - (_initialize_arm_tdep): Set tm_print_insn. - * config/arm/tm-arm.h: Remove old refs to first_object_file_end. - (XFER_CORE_FILE): Remove. - (FRAME_FIND_SAVED_REGS): Call arm_frame_find_saved_regs. - -Fri Jan 27 08:48:28 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Makefile.in (CHILL_LIB): Define as in testsuite/Makefile.in. - -Thu Jan 26 18:24:41 1995 Jim Kingdon - - * symtab.c (find_pc_line): When subtracting one to get a line - number, make sure not to end up with zero. - - * remote-vx.c: Revert all of Kung's changes of 16 Jan. The - problems with those changes were (a) the file didn't compile, (b) - they changed memset to bzero--memset is correct, (c) they took out - code to deal with boards lacking floating point, (d) who knows - what I didn't discover in a quick read. - -Thu Jan 26 17:32:54 1995 Stu Grossman (grossman@cygnus.com) - - * sparcl-tdep.c: Clean up formatting and indentation. - -Thu Jan 26 10:49:59 1995 Steve Chamberlain - - * remote-hms.c (hms_ops): Change ref of hr_load_image - to gr_load_image. - (dcache_flush, dcache_hit, dcache_value, dcache_fetch, - dcache_poke, dcache_init): Deleted. - (hms_open, hms_resume, hms_fetch_word, hms_store_word): - Use dcache routines provided by remote-util.h - -Thu Jan 26 12:08:31 1995 Michael Meissner - - * configure.in: Add support for powerpc-*-eabi. - - * powerpc/tm-ppc-eabi.h, powerpc/pcc-eabi.mt: New files for - PowerPC support. - -Wed Jan 25 18:13:14 1995 Per Bothner - - * language.h (struct language_defn): New field c_style_arrays. - * language.c (unknown_language_defn, auto_language_defn, - local_language_defn), c-lang.c (c_language_defn, cplus_language_defn, - asm_language_defn): Set c_style_arrays to true. - * m2-lang.c (m2_language_defn), ch-lang.c (chill_language_defn), - f-lang.c (f_language_defn): Set c_style_arrays to false. - * valops.c (value_string): If c_style_array is not set, - allocate string in gdb (not inferior) using allocate_value. - - * value.h (COERCE_ARRAY), valops.c (value_addr, value_arg_coerce): - Only call value_coerce_array if current_language->c_style_arrays. - * values.c: Add #include "language.h". (Needed for COERCE_ARRAY.) - - * valops.c (chill_varying_type): New predicate. - * valops.c (value_cast): Support assigning a fixed string or array - to a variable string/array structure. - - * valarith.c (value_subscripted_rvalue): Extra parameter lowerbound. - Check index>=lowerbound, and then add lowerbound to index here, - instead of in caller. Generalize to arbitrary lval_types. - (value_subscript): Use enhanced value_subscripted_rvalue if - c_style_arrays is false (and index is in range). - - -Wed Jan 25 18:13:14 1995 Per Bothner - - * eval.c (evaluate_subexp case OP_ARRAY): Fix calls to memset: - TYPE_LENGTH is length in bytes, not bits. - -Wed Jan 25 08:19:35 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * infrun.c (proceed): Flush stdout before resuming inferior. - * infcmd.c (step_1), annotate.c (annotate_starting): - Don't bother to flush here. - -Wed Jan 25 01:11:21 1995 Jeff Law (law@snake.cs.utah.edu) - - * hpread.c (hpread_process_one_debug_symbol): Fix lines garbled - by an ill-advised global search and replace. - -Tue Jan 24 12:10:28 1995 Stu Grossman (grossman@cygnus.com) - - * gdbtk.tcl (create_registers_window): Work around a radiobutton - widget bug to make Options|Natural button work. - - * gdbtk.c (gdb_disassemble): Fix problem with source+assembly and - g++ caused by out-of-order pc's. - * gdbtk.tcl (files_command): Remove duplicate file names. Also, - add scrollbar. - -Mon Jan 23 17:21:09 1995 Stu Grossman (grossman@cygnus.com) - - * gdbtk.tcl: Take .gdbtkinit if it exists. Makes gdbtk match the - doc! - -Mon Jan 23 13:11:46 1995 Per Bothner - - Add support for Chill bitstring literals (e.h. H'FF00'). - * ch-exp.y (match_bitstring_literal): Fix for proper endianness. - * expprint.c (print_subexp): Don't call error on OP_BITSTRING, - just print B''. - * gdbtypes.c (create_set_type): Fix bug in length calculation. - * valops.c, value.h (value_bitstring): New function. - * eval.c (evaluate_subexp): Implement support for OP_BITSTRING. - - * ch-typeprint.c (chill_type_print_base): For TYPE_CODE_FUNC, - check that return type is non-void, and print in proper Chill syntax. - -Mon Jan 23 12:20:34 1995 Rob Savoye - - * Makefile.in: Remove references to remote-mon.c. - * remote-mon.c: remove. Replaced by rom68k-rom.c. - * rom68k-rom.c: Support for Rom68k monitor. - -Mon Jan 23 10:50:57 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Makefile.in (CHILL_FOR_TARGET): Update -L argument to point to - gcc/ch/runtime not chillrt, since that is where the chill runtime - lives now. - -Mon Jan 23 00:06:57 1995 Steve Chamberlain - - * remote-hms.c (hms_load): Delete. - (target_ops): Use hr_load_image. - - * remote-e7000.c, remote-z8k.c, remote-nindy.c (target_ops): - Define memory_insert/remove_breakpoint. - * xm-go32.h: Remove redundant SIGs. - -Thu Jan 19 20:26:58 1995 Steve Chamberlain - - * ser-go32.c: Rewritten by nigel@algor.co.uk. - -Fri Jan 20 15:23:55 1995 Per Bothner - - * expression.h (OP_LABELED): New operator, for Chill - labeled structre tuples. - * ch-exp.y (tuple_element, named_record_element, tuple_elements): - New non-terminals, to handle labeled structure tuples. - (tuple): Re-define using tuple_elements. - * eval.c (evaluate_labeled_field_init): New function, to handle - initialization of structure fields, possibly using OP_LABELED. - (evaluate_subexp): Use it. - * expprint.c (print_subexp case): For OP_ARRAY, use Chill syntax - for Chill. Handled OP_LABELED. - * parse.c (length_of_subexp, prefixify_subexp): Handle OP_LABELED. - - * eval.c (evaluate_subexp): Handle Chill Powerset tuples. - * valarith.c (value_bit_index): Just treat bitstring as represented - by an array of bytes. Alignment is handled by compiler. - -Wed Jan 18 19:00:29 1995 Stan Shebs - - * h8300-tdep.c (gdb_print_insn_h8300): Fix typo (&info -> info). - * sh-tdep.c (gdb_print_insn_sh): Ditto. - -Wed Jan 18 11:25:43 1995 Kung Hsu - - * remote-os9k.c (rombug_open): Fix a bug in exception handling - command. - * remote-os9k.c (rombug_write_inferior_memory): reset buffer after - write. - -Tue Jan 17 09:48:38 1995 Jim Kingdon - - * parse.c (_initialize_parse): Improve wording of names of - msym_*_symbol_type. - -Tue Jan 17 14:00:58 1995 Ian Lance Taylor - - * config/mips/tm-mips.h (enum mips_fpu_type): New enum. - (mips_fpu): Change type to enum mips_fpu_type. - (FIX_CALL_DUMMY): Handle mips_fpu == MIPS_FPU_SINGLE. - * mips-tdep.c (mips_fpu): Change type to enum mips_fpu_type. - Don't initialize. - (mips_fpu_string): New static variable. - (mips_push_dummy_frame): Handle mips_fpu == MIPS_FPU_SINGLE. - (mips_pop_frame): Likewise. - (mips_extract_return_value): Likewise. - (mips_store_return_value): Likewise. - (mips_set_fpu_command): New static function. - (mips_show_fpu_command): New static function. - (_initialize_mips_tdep): Change handling of set/show mipsfpu. - -Tue Jan 17 09:48:38 1995 Jim Kingdon - - * a29k-tdep.c (gdb_print_insn_a29k): Fix typo (&info -> info). - - * parse.c (write_exp_msymbol): Use new variables - msym_*_symbol_type as type of msymbol expression. - (_initialize_parse): Initialize them. - -Mon Jan 16 18:11:03 1995 Stan Shebs - - General cleanup and simplication of disassembler interface. - * a29k-pinsn.c, arm-pinsn.c, convex-pinsn.c, gould-pinsn.c, - hppa-pinsn.c, i386-pinsn.c, i960-pinsn.c, m68k-pinsn.c, - m88k-pinsn.c, mips-pinsn.c, ns32k-pinsn.c, pyr-pinsn.c, - rs6000-pinsn.c, sparc-pinsn.c, tahoe-pinsn.c, vax-pinsn.c: Remove. - * gould-tdep.c, ns32k-tdep.c, tahoe-tdep.c, vax-tdep.c: New files, - had been -pinsn.c files. - * Makefile.in (ALLDEPFILES): Remove removed files. - (a29k-pinsn.o, arm-pinsn.o, convex-pinsn.o, gould-pinsn.o, - hppa-pinsn.o, i386-pinsn.o, i960-pinsn.o, m68k-pinsn.o, - m88k-pinsn.o, mips-pinsn.o, ns32k-pinsn.o, pyr-pinsn.o, - rs6000-pinsn.o, sparc-pinsn.o, tahoe-pinsn.o, vax-pinsn.o): - Remove compile actions. - * arm-tdep.o, gould-tdep.o, ns32k-tdep.o, tahoe-tdep.o, - vax-tdep.o: Add compile actions. - * defs.h (tm_print_insn): New global. - * a29k-tdep.c (gdb_print_insn_a29k): New function. - (_initialize_a29k_tdep): Rename from _initialize_29k, - set tm_print_insn. - * alpha-tdep.c (print_insn): Remove. - (_initialize_alpha_tdep): Set tm_print_insn. - * arm-tdep.c (arm_print_insn): New function, was print_insn - in arm-pinsn.c. - * convex-tdep.c (convex_print_insn): New function, was print_insn - in convex-pinsn.c. - * h8300-tdep.c (print_insn): Remove. - (gdb_print_insn_h8300): New function. - (_initialize_h8300_tdep): New function. - * h8500-tdep.c (print_insn): Remove. - (_initialize_h8500_tdep): New function. - * hppa-tdep.c (_initialize_hppa_tdep): Set tm_print_insn. - * i386-tdep.c (_initialize_i386_tdep): New function. - * i960-tdep.c (mem, next_insn): New functions, were in - i960-pinsn.c. - (_initialize_i960_tdep): Set tm_print_insn. - * m68k-tdep.c (_initialize_m68k_tdep): New function. - * m88k-tdep.c (_initialize_m88k_tdep): New function. - * mips-tdep.c (gdb_print_insn_mips): New function. - (_initialize_mips_tdep): Set tm_print_insn. - * pyr-tdep.c (pyr_print_insn): New function, was print_insn - in pyr-pinsn.c. - * rs6000-tdep.c (_initialize_rs6000_tdep): New function. - * sh-tdep.c (print_insn): Remove. - (gdb_print_insn_sh): New function. - (_initialize_sh_tdep): Set tm_print_insn. - * sparc-tdep.c (_initialize_sparc_tdep): New function. - * w65-tdep.c (print_insn): Remove. - (_initialize_w65_tdep): New function. - * z8k-tdep.c (print_insn): Remove. - (gdb_print_insn_z8k): New function. - (_initialize_z8k_tdep): Set tm_print_insn. - * printcmd.c (print_insn): New function, generic disassembler. - * config/*/*.mt (TDEPFILES): Remove refs to *-pinsn.o. - -Mon Jan 16 15:43:29 1995 Kung Hsu - - * Makefile.in: add new files remote-vx29k.c, config/a29k/tm-vx29k.h, - and config/a29k/vx29k.mt. - * configure.in: add new configuration a29k-*-vxworks. - * remote-vx29k.c: new file merged from WRS. - * remote-vx.c: merge changes from WRS. - * config/a29k/vx29k.mt: new file for new configuration. - * config/a29k/tm-vx29k.h: new header file for newconfiguration. - -Sun Jan 15 14:36:19 1995 Steve Chamberlain - - * breakpoint.h (disable_breakpoint, enable_breakpoint): - New declarations. - (enum bpdisp): Change name of 'delete' member to 'del'. - (struct bpstat): Changed name to 'bpstats'. - * breakpoint.c (disable_breakpoint, enable_breakpoint, - breakpoint_chain): Made globally visible. - (bpstat_stop_status): Use new name for bpstat. - (break_command_1, watch_command_1, catch_command_1, - breakpoint_auto_delete, denable_delete_breakpoint): Use 'del' - instead of 'delete'. - (set_breakpoint_sal): New function. - * defs.h (registers_changed_hook): New declaration. - * infcmd.c (run_stack_dummy): 'delete' is now 'del'. - * inflow.c (new_tty): Treat WIN32 in same way as __GO32__ - * main.c (main): Don't scan options when in WIN32 and exit - without entering main loop. - * m2-exp.y (m2_elx): Member 'class' is now 'aclass'. - * symtab.h (struct symbol, struct partial_symbol): Changed name of - member 'class' to 'aclass'. - (SYMBOL_CLASS, PSYMBOL_CLASS): Reflect change. - * top.c (registers_changed_hook): New definition. - * utils.c (quit, notice_quit, initialize_utils): Treate WIN32 - in same way as __GO32__. - * value.h (c_typedef_print): Rename 'new' argument. - - * w65-tdep.c, config/tm-w65.h, config/w65.mt: New files. - * configure.in: Suppprt for w65, - - -Sat Jan 14 11:18:11 1995 Jim Kingdon - - * infcmd.c (signal_command): For "signal 0", pass (CORE_ADDR)-1, - not stop_pc, to proceed. - - * eval.c (evaluate_subexp): Clear expect_type except for C++ and CHILL. - -Fri Jan 13 17:52:57 1995 Jim Kingdon - - * infcmd.c (signal_command): Accept "signal 0"; the change to not - accept it was accidental. "handle 0" and "info signal 0" remain - illegal, though. - -Fri Jan 13 15:19:01 1995 Stan Shebs - - * Makefile.in (all): Don't make libgdb-files. - (libgdb): New action, makes libgdb-files. - -Thu Jan 12 21:23:25 1995 Per Bothner - - * stabsread.c (read_enum_type): When pending enum symbols are - put into the enum type, they must be inserted in "backwards - order, in case we've overflowed a struct pending buffer. - - -Thu Jan 12 09:33:24 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * README: Add note about SPARCworks cc release 3.0 and higher. - - Add procfs support for Alpha OSF/1-2.x. - * config/alpha/nm-osf.h: Renamed from nm-alpha.h, generic - OSF/1 native support. - * config/alpha/alpha-osf1.mh (NAT_FILE): Changed accordingly. - (MUNCH_DEFINE): Removed. - * config/alpha/alpha-osf2.mh, config/alpha/nm-osf2.h: New files - for procfs support. - * configure.in (alpha-dec-osf*): Use alpha-osf2.mh for OSF/1 - release 2.x and higher, else alpha-osf1.mh, as the procfs support - in release 1.x is incomplete. - * Makefile.in (ALLCONFIG): Add config/alpha/alpha-osf2.mh. - * alpha-nat.c (supply_gregset, fill_gregset, supply_fpgregset, - fill_fpgregset): New routines for procfs support. - * inftarg.c (_initialize_inftarg): Don't add ptrace support - if we have an optional procfs and /proc is accessible. - * procfs.c: Include sys/fault.h and sys/syscall.h before - including sys/procfs.h. - (unconditionally_kill_inferior): If PROCFS_NEED_PIOCSSIG_FOR_KILL - is defined, additionally perform a PIOCSSIG to really terminate - the inferior. - (create_procinfo): Always return a result. - (create_procinfo, do_attach): Don't trace T_IFAULT faults if - PROCFS_DONT_TRACE_IFAULT is defined. - (procfs_init_inferior): Use START_INFERIOR_TRAPS_EXPECTED as - argument to startup_inferior if it is defined. - (proc_set_exec_trap): If PIOCSSPCACT is defined, use it instead - of tracing exits from exec system calls. Needed for the user level - loader under Alpha OSF/1. - (do_detach): Clear any pending signal if we want to detach from - a process without a signal. - (set_proc_siginfo): If PROCFS_DONT_PIOCSSIG_CURSIG is defined, - don't issue a PIOCSSIG if pr_cursig already contains the signal we - intend to set. - (info_proc_signals): If PROCFS_SIGPEND_OFFSET is defined, the - pending signals are numbered from 1 instead of 0. - (info_proc_mappings): Increase size of output format for addresses - if BFD_HOST_64_BIT is defined. - (procfs_stop): Renamed from child_stop. - (_initialize_procfs): Don't add procfs support if we have an - optional procfs and /proc is not accessible. - - -Wed Jan 11 17:53:26 1995 Rob Savoye - - * array-rom.c: Add support for most commands. - - * monitor.c: Add GDB remote protocol for the hybrid environment on - the Array board. - -Wed Jan 11 00:44:01 1995 Jeff Law (law@snake.cs.utah.edu) - - * command.c (show_user_1): Use print_command_line to show a user - defined command (including control structures). - - * top.c (init_main): Change documentation for user defined - commands to indicate they may accept up to ten arguments. - -Tue Jan 10 16:22:41 1995 Jim Kingdon - - * mips-tdep.c (mips_skip_prologue): Accept or as well as addu for - `move $s8, $sp' instruction. - -Sun Jan 8 12:45:34 1995 Jim Kingdon - - * target.c, target.h (target_signal_from_command): New function. - * infrun.c (handle_command, signals_info), infcmd.c - (signal_command): Use it. - * infrun.c, infcmd.c: Update docstrings for these commands. - - * target.h (enum target_signal), target.c (signals), target.c - (target_signal_from_host, target_signal_to_host): Add - TARGET_SIGNAL_REALTIME_* and TARGET_SIGNAL_PRIO for lynx. - * config/tm-lynx.h: Define signal numbers for realtime events. - -Sat Jan 7 07:23:53 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * dbxread.c (process_one_symbol): Handle N_FUN symbols - for Sun acc 3.0 under SunOS4. - - Changes to improve handling of runtime common symbols - under SunOS4. - * minsyms.c (get_symbol_leading_char): New routine to determine - the leading symbol character for an objfile. - (prim_record_minimal_symbol_and_info, install_minimal_symbols): - Use it. - * objfiles.h (rt_common_objfile): New global, points to objfile - containing the runtime common minimal symbols. - * objfiles.c (free_objfile): Mark rt_common_objfile as - unallocated before freeing it. - * solib.c (allocate_rt_common_objfile): New routine to allocate - an objfile for the runtime common minimal symbols. - (solib_add_common_symbols): Allocate an objfile for the runtime - common symbols if necessary and put common symbols into it. - Clean up code and comments. - (solib_add, special_symbol_handling): Cleanup comments regarding - runtime common symbols. - * stabsread.c (scan_file_globals_1): New routine, contains - old scan_file_globals code. Checks if there are any unresolved - global symbols before starting the expensive minimal symbol table - search. - (scan_file_globals): Now calls scan_file_globals_1 for the passed - objfile and eventually for the runtime common objfile. Complains - about any unresolved global symbols and removes them from the - global symbol chain to avoid dangling pointers into the symbol - table if the symbol table is reread. - -Thu Jan 5 17:38:29 1995 Stu Grossman (grossman@cygnus.com) - - * Makefile.in (install_only uninstall): Indent for clarity. - - * core.c (dis_asm_read_memory): Add call to - dis_asm_read_memory_hook to provide alternate way for disassembler - to read memory. - - * defs.h: Protect from multiple inclusion. Add decl for - dis_asm_read_memory_hook. - - * top.c: Make window startup be the default. - * Add dis_asm_read_memory_hook. - - -Thu Jan 5 01:16:40 1995 Jeff Law (law@snake.cs.utah.edu) - - * stabsread.c (define_symbol): Handle `a' symbol type used for - reference parameter passed in a register. - - -Wed Jan 4 12:27:29 1995 Kung Hsu - - * defs.h: move include tm.h up, so that the type LONGEST can - also based on the target requirement to determine. In this case - target mips64. - - * remote-os9k.c (rombug_open): catch exception e in rombug. - * remote-os9k.c (rombug_wait): print message before register display - from rombug. - -Wed Jan 4 09:18:27 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * top.c (locate_arg): Call strchr not index. - -Tue Jan 3 16:52:03 1995 Per Bothner - - * ch-exp.y (literal): Recognize NULL. - (tuple): Parse simple unlabelled tuples. - * eval.c (evaluate_subexp case OP_ARRAY): Use expect_type to - evaluate brace-initializer-expressions depending on context. - (evaluate_subexp case UNOP_CAST): Pass the target type as - expected type when evaluating the expression. - - * ch-typeprint.c (chill_type_print_base): Get names of PTR and - BOOL from TYPE_NAME. - * ch-valprint.c (chill_print_type_scalar): New function, to handle - TYPE_CODE_RANGE better than print_type_scalar does. - (chill_val_print_array_elements): Use above new function. - -Mon Jan 2 15:02:51 1995 Stan Shebs - - * remote-udi.c (udi_load): Tell symbol_file_add that the - program being loaded is the main program. - -For older changes see ChangeLog-94 - -Local Variables: -mode: indented-text -left-margin: 8 -fill-column: 74 -version-control: never -End: diff --git a/contrib/gdb/gdb/acconfig.h b/contrib/gdb/gdb/acconfig.h deleted file mode 100644 index bb9b991..0000000 --- a/contrib/gdb/gdb/acconfig.h +++ /dev/null @@ -1,9 +0,0 @@ - -/* Define if fpregset_t type is available. */ -#undef HAVE_FPREGSET_T - -/* Define if gregset_t type is available. */ -#undef HAVE_GREGSET_T - -/* Define if the "%Lg" format works to print long doubles. */ -#undef PRINTF_HAS_LONG_DOUBLE diff --git a/contrib/gdb/gdb/alpha-nat.c b/contrib/gdb/gdb/alpha-nat.c deleted file mode 100644 index b027116..0000000 --- a/contrib/gdb/gdb/alpha-nat.c +++ /dev/null @@ -1,243 +0,0 @@ -/* Low level Alpha interface, for GDB when running native. - Copyright 1993, 1995, 1996 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "defs.h" -#include "inferior.h" -#include "gdbcore.h" -#include "target.h" -#include -#include -#include - -/* Size of elements in jmpbuf */ - -#define JB_ELEMENT_SIZE 8 - -/* The definition for JB_PC in machine/reg.h is wrong. - And we can't get at the correct definition in setjmp.h as it is - not always available (eg. if _POSIX_SOURCE is defined which is the - default). As the defintion is unlikely to change (see comment - in , define the correct value here. */ - -#undef JB_PC -#define JB_PC 2 - -/* Figure out where the longjmp will land. - We expect the first arg to be a pointer to the jmp_buf structure from which - we extract the pc (JB_PC) that we will land at. The pc is copied into PC. - This routine returns true on success. */ - -int -get_longjmp_target (pc) - CORE_ADDR *pc; -{ - CORE_ADDR jb_addr; - char raw_buffer[MAX_REGISTER_RAW_SIZE]; - - jb_addr = read_register(A0_REGNUM); - - if (target_read_memory(jb_addr + JB_PC * JB_ELEMENT_SIZE, raw_buffer, - sizeof(CORE_ADDR))) - return 0; - - *pc = extract_address (raw_buffer, sizeof(CORE_ADDR)); - return 1; -} - -/* Extract the register values out of the core file and store - them where `read_register' will find them. - - CORE_REG_SECT points to the register values themselves, read into memory. - CORE_REG_SIZE is the size of that area. - WHICH says which set of registers we are handling (0 = int, 2 = float - on machines where they are discontiguous). - REG_ADDR is the offset from u.u_ar0 to the register values relative to - core_reg_sect. This is used with old-fashioned core files to - locate the registers in a large upage-plus-stack ".reg" section. - Original upage address X is at location core_reg_sect+x+reg_addr. - */ - -static void -fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr) - char *core_reg_sect; - unsigned core_reg_size; - int which; - unsigned reg_addr; -{ - register int regno; - register int addr; - int bad_reg = -1; - - /* Table to map a gdb regnum to an index in the core register section. - The floating point register values are garbage in OSF/1.2 core files. */ - static int core_reg_mapping[NUM_REGS] = - { -#define EFL (EF_SIZE / 8) - EF_V0, EF_T0, EF_T1, EF_T2, EF_T3, EF_T4, EF_T5, EF_T6, - EF_T7, EF_S0, EF_S1, EF_S2, EF_S3, EF_S4, EF_S5, EF_S6, - EF_A0, EF_A1, EF_A2, EF_A3, EF_A4, EF_A5, EF_T8, EF_T9, - EF_T10, EF_T11, EF_RA, EF_T12, EF_AT, EF_GP, EF_SP, -1, - EFL+0, EFL+1, EFL+2, EFL+3, EFL+4, EFL+5, EFL+6, EFL+7, - EFL+8, EFL+9, EFL+10, EFL+11, EFL+12, EFL+13, EFL+14, EFL+15, - EFL+16, EFL+17, EFL+18, EFL+19, EFL+20, EFL+21, EFL+22, EFL+23, - EFL+24, EFL+25, EFL+26, EFL+27, EFL+28, EFL+29, EFL+30, EFL+31, - EF_PC, -1 - }; - static char zerobuf[MAX_REGISTER_RAW_SIZE] = {0}; - - for (regno = 0; regno < NUM_REGS; regno++) - { - if (CANNOT_FETCH_REGISTER (regno)) - { - supply_register (regno, zerobuf); - continue; - } - addr = 8 * core_reg_mapping[regno]; - if (addr < 0 || addr >= core_reg_size) - { - if (bad_reg < 0) - bad_reg = regno; - } - else - { - supply_register (regno, core_reg_sect + addr); - } - } - if (bad_reg >= 0) - { - error ("Register %s not found in core file.", reg_names[bad_reg]); - } -} - -/* Map gdb internal register number to a ptrace ``address''. - These ``addresses'' are defined in */ - -#define REGISTER_PTRACE_ADDR(regno) \ - (regno < FP0_REGNUM ? GPR_BASE + (regno) \ - : regno == PC_REGNUM ? PC \ - : regno >= FP0_REGNUM ? FPR_BASE + ((regno) - FP0_REGNUM) \ - : 0) - -/* Return the ptrace ``address'' of register REGNO. */ - -unsigned int -register_addr (regno, blockend) - int regno; - int blockend; -{ - return REGISTER_PTRACE_ADDR (regno); -} - -int -kernel_u_size () -{ - return (sizeof (struct user)); -} - -#ifdef USE_PROC_FS -#include - -/* - * See the comment in m68k-tdep.c regarding the utility of these functions. - */ - -void -supply_gregset (gregsetp) - gregset_t *gregsetp; -{ - register int regi; - register long *regp = gregsetp->regs; - static char zerobuf[MAX_REGISTER_RAW_SIZE] = {0}; - - for (regi = 0; regi < 31; regi++) - supply_register (regi, (char *)(regp + regi)); - - supply_register (PC_REGNUM, (char *)(regp + 31)); - - /* Fill inaccessible registers with zero. */ - supply_register (ZERO_REGNUM, zerobuf); - supply_register (FP_REGNUM, zerobuf); -} - -void -fill_gregset (gregsetp, regno) - gregset_t *gregsetp; - int regno; -{ - int regi; - register long *regp = gregsetp->regs; - - for (regi = 0; regi < 31; regi++) - if ((regno == -1) || (regno == regi)) - *(regp + regi) = *(long *) ®isters[REGISTER_BYTE (regi)]; - - if ((regno == -1) || (regno == PC_REGNUM)) - *(regp + 31) = *(long *) ®isters[REGISTER_BYTE (PC_REGNUM)]; -} - -/* - * Now we do the same thing for floating-point registers. - * Again, see the comments in m68k-tdep.c. - */ - -void -supply_fpregset (fpregsetp) - fpregset_t *fpregsetp; -{ - register int regi; - register long *regp = fpregsetp->regs; - - for (regi = 0; regi < 32; regi++) - supply_register (regi + FP0_REGNUM, (char *)(regp + regi)); -} - -void -fill_fpregset (fpregsetp, regno) - fpregset_t *fpregsetp; - int regno; -{ - int regi; - register long *regp = fpregsetp->regs; - - for (regi = FP0_REGNUM; regi < FP0_REGNUM + 32; regi++) - { - if ((regno == -1) || (regno == regi)) - { - *(regp + regi - FP0_REGNUM) = - *(long *) ®isters[REGISTER_BYTE (regi)]; - } - } -} -#endif - - -/* Register that we are able to handle alpha core file formats. */ - -static struct core_fns alpha_core_fns = -{ - bfd_target_aout_flavour, - fetch_core_registers, - NULL -}; - -void -_initialize_core_alpha () -{ - add_core_fns (&alpha_core_fns); -} diff --git a/contrib/gdb/gdb/alpha-tdep.c b/contrib/gdb/gdb/alpha-tdep.c deleted file mode 100644 index 7fbf642..0000000 --- a/contrib/gdb/gdb/alpha-tdep.c +++ /dev/null @@ -1,1274 +0,0 @@ -/* Target-dependent code for the ALPHA architecture, for GDB, the GNU Debugger. - Copyright 1993, 1994, 1995 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "defs.h" -#include "frame.h" -#include "inferior.h" -#include "symtab.h" -#include "value.h" -#include "gdbcmd.h" -#include "gdbcore.h" -#include "dis-asm.h" -#include "symfile.h" -#include "objfiles.h" -#include "gdb_string.h" - -/* FIXME: Some of this code should perhaps be merged with mips-tdep.c. */ - -/* FIXME: Put this declaration in frame.h. */ -extern struct obstack frame_cache_obstack; - - -/* Forward declarations. */ - -static CORE_ADDR read_next_frame_reg PARAMS ((struct frame_info *, int)); - -static CORE_ADDR heuristic_proc_start PARAMS ((CORE_ADDR)); - -static alpha_extra_func_info_t heuristic_proc_desc PARAMS ((CORE_ADDR, - CORE_ADDR, - struct frame_info *)); - -static alpha_extra_func_info_t find_proc_desc PARAMS ((CORE_ADDR, - struct frame_info *)); - -#if 0 -static int alpha_in_lenient_prologue PARAMS ((CORE_ADDR, CORE_ADDR)); -#endif - -static void reinit_frame_cache_sfunc PARAMS ((char *, int, - struct cmd_list_element *)); - -static CORE_ADDR after_prologue PARAMS ((CORE_ADDR pc, - alpha_extra_func_info_t proc_desc)); - -static int alpha_in_prologue PARAMS ((CORE_ADDR pc, - alpha_extra_func_info_t proc_desc)); - -/* Heuristic_proc_start may hunt through the text section for a long - time across a 2400 baud serial line. Allows the user to limit this - search. */ -static unsigned int heuristic_fence_post = 0; - -/* Layout of a stack frame on the alpha: - - | | - pdr members: | 7th ... nth arg, | - | `pushed' by caller. | - | | -----------------|-------------------------------|<-- old_sp == vfp - ^ ^ ^ ^ | | - | | | | | | - | |localoff | Copies of 1st .. 6th | - | | | | | argument if necessary. | - | | | v | | - | | | --- |-------------------------------|<-- FRAME_LOCALS_ADDRESS - | | | | | - | | | | Locals and temporaries. | - | | | | | - | | | |-------------------------------| - | | | | | - |-fregoffset | Saved float registers. | - | | | | F9 | - | | | | . | - | | | | . | - | | | | F2 | - | | v | | - | | -------|-------------------------------| - | | | | - | | | Saved registers. | - | | | S6 | - |-regoffset | . | - | | | . | - | | | S0 | - | | | pdr.pcreg | - | v | | - | ----------|-------------------------------| - | | | - frameoffset | Argument build area, gets | - | | 7th ... nth arg for any | - | | called procedure. | - v | | - -------------|-------------------------------|<-- sp - | | -*/ - -#define PROC_LOW_ADDR(proc) ((proc)->pdr.adr) /* least address */ -#define PROC_HIGH_ADDR(proc) ((proc)->pdr.iline) /* upper address bound */ -#define PROC_DUMMY_FRAME(proc) ((proc)->pdr.iopt) /* frame for CALL_DUMMY */ -#define PROC_FRAME_OFFSET(proc) ((proc)->pdr.frameoffset) -#define PROC_FRAME_REG(proc) ((proc)->pdr.framereg) -#define PROC_REG_MASK(proc) ((proc)->pdr.regmask) -#define PROC_FREG_MASK(proc) ((proc)->pdr.fregmask) -#define PROC_REG_OFFSET(proc) ((proc)->pdr.regoffset) -#define PROC_FREG_OFFSET(proc) ((proc)->pdr.fregoffset) -#define PROC_PC_REG(proc) ((proc)->pdr.pcreg) -#define PROC_LOCALOFF(proc) ((proc)->pdr.localoff) -#define PROC_SYMBOL(proc) (*(struct symbol**)&(proc)->pdr.isym) -#define _PROC_MAGIC_ 0x0F0F0F0F -#define PROC_DESC_IS_DUMMY(proc) ((proc)->pdr.isym == _PROC_MAGIC_) -#define SET_PROC_DESC_IS_DUMMY(proc) ((proc)->pdr.isym = _PROC_MAGIC_) - -struct linked_proc_info -{ - struct alpha_extra_func_info info; - struct linked_proc_info *next; -} *linked_proc_desc_table = NULL; - - -/* Guaranteed to set frame->saved_regs to some values (it never leaves it - NULL). */ - -void -alpha_find_saved_regs (frame) - struct frame_info *frame; -{ - int ireg; - CORE_ADDR reg_position; - unsigned long mask; - alpha_extra_func_info_t proc_desc; - int returnreg; - - frame->saved_regs = (struct frame_saved_regs *) - obstack_alloc (&frame_cache_obstack, sizeof(struct frame_saved_regs)); - memset (frame->saved_regs, 0, sizeof (struct frame_saved_regs)); - - /* If it is the frame for __sigtramp, the saved registers are located - in a sigcontext structure somewhere on the stack. __sigtramp - passes a pointer to the sigcontext structure on the stack. - If the stack layout for __sigtramp changes, or if sigcontext offsets - change, we might have to update this code. */ -#ifndef SIGFRAME_PC_OFF -#define SIGFRAME_PC_OFF (2 * 8) -#define SIGFRAME_REGSAVE_OFF (4 * 8) -#define SIGFRAME_FPREGSAVE_OFF (SIGFRAME_REGSAVE_OFF + 32 * 8 + 8) -#endif - if (frame->signal_handler_caller) - { - CORE_ADDR sigcontext_pointer_addr; - CORE_ADDR sigcontext_addr; - - if (frame->next) - sigcontext_pointer_addr = frame->next->frame; - else - sigcontext_pointer_addr = frame->frame; - sigcontext_addr = read_memory_integer(sigcontext_pointer_addr, 8); - for (ireg = 0; ireg < 32; ireg++) - { - reg_position = sigcontext_addr + SIGFRAME_REGSAVE_OFF + ireg * 8; - frame->saved_regs->regs[ireg] = reg_position; - } - for (ireg = 0; ireg < 32; ireg++) - { - reg_position = sigcontext_addr + SIGFRAME_FPREGSAVE_OFF + ireg * 8; - frame->saved_regs->regs[FP0_REGNUM + ireg] = reg_position; - } - frame->saved_regs->regs[PC_REGNUM] = sigcontext_addr + SIGFRAME_PC_OFF; - return; - } - - proc_desc = frame->proc_desc; - 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; - - /* Fill in the offsets for the registers which gen_mask says - were saved. */ - - reg_position = frame->frame + PROC_REG_OFFSET (proc_desc); - mask = PROC_REG_MASK (proc_desc); - - returnreg = PROC_PC_REG (proc_desc); - - /* Note that RA is always saved first, regardless of its actual - register number. */ - if (mask & (1 << returnreg)) - { - frame->saved_regs->regs[returnreg] = reg_position; - reg_position += 8; - mask &= ~(1 << returnreg); /* Clear bit for RA so we - don't save again later. */ - } - - for (ireg = 0; ireg <= 31 ; ++ireg) - if (mask & (1 << ireg)) - { - frame->saved_regs->regs[ireg] = reg_position; - reg_position += 8; - } - - /* Fill in the offsets for the registers which float_mask says - were saved. */ - - reg_position = frame->frame + PROC_FREG_OFFSET (proc_desc); - mask = PROC_FREG_MASK (proc_desc); - - for (ireg = 0; ireg <= 31 ; ++ireg) - if (mask & (1 << ireg)) - { - frame->saved_regs->regs[FP0_REGNUM+ireg] = reg_position; - reg_position += 8; - } - - frame->saved_regs->regs[PC_REGNUM] = frame->saved_regs->regs[returnreg]; -} - -static CORE_ADDR -read_next_frame_reg(fi, regno) - struct frame_info *fi; - int regno; -{ - for (; fi; fi = fi->next) - { - /* We have to get the saved sp from the sigcontext - if it is a signal handler frame. */ - if (regno == SP_REGNUM && !fi->signal_handler_caller) - return fi->frame; - else - { - if (fi->saved_regs == NULL) - alpha_find_saved_regs (fi); - if (fi->saved_regs->regs[regno]) - return read_memory_integer(fi->saved_regs->regs[regno], 8); - } - } - return read_register(regno); -} - -CORE_ADDR -alpha_frame_saved_pc(frame) - struct frame_info *frame; -{ - alpha_extra_func_info_t proc_desc = frame->proc_desc; - /* We have to get the saved pc from the sigcontext - if it is a signal handler frame. */ - int pcreg = frame->signal_handler_caller ? PC_REGNUM : frame->pc_reg; - - if (proc_desc && PROC_DESC_IS_DUMMY(proc_desc)) - return read_memory_integer(frame->frame - 8, 8); - - return read_next_frame_reg(frame, pcreg); -} - -CORE_ADDR -alpha_saved_pc_after_call (frame) - struct frame_info *frame; -{ - CORE_ADDR pc = frame->pc; - CORE_ADDR tmp; - alpha_extra_func_info_t proc_desc; - int pcreg; - - /* Skip over shared library trampoline if necessary. */ - tmp = SKIP_TRAMPOLINE_CODE (pc); - if (tmp != 0) - pc = tmp; - - proc_desc = find_proc_desc (pc, frame->next); - pcreg = proc_desc ? PROC_PC_REG (proc_desc) : RA_REGNUM; - - return read_register (pcreg); -} - - -static struct alpha_extra_func_info temp_proc_desc; -static struct frame_saved_regs temp_saved_regs; - -/* This fencepost looks highly suspicious to me. Removing it also - seems suspicious as it could affect remote debugging across serial - lines. */ - -static CORE_ADDR -heuristic_proc_start(pc) - CORE_ADDR pc; -{ - CORE_ADDR start_pc = pc; - CORE_ADDR fence = start_pc - heuristic_fence_post; - - if (start_pc == 0) return 0; - - if (heuristic_fence_post == UINT_MAX - || fence < VM_MIN_ADDRESS) - fence = VM_MIN_ADDRESS; - - /* search back for previous return */ - for (start_pc -= 4; ; start_pc -= 4) - if (start_pc < fence) - { - /* It's not clear to me why we reach this point when - stop_soon_quietly, but with this test, at least we - don't print out warnings for every child forked (eg, on - decstation). 22apr93 rich@cygnus.com. */ - if (!stop_soon_quietly) - { - static int blurb_printed = 0; - - if (fence == VM_MIN_ADDRESS) - warning("Hit beginning of text section without finding"); - else - warning("Hit heuristic-fence-post without finding"); - - warning("enclosing function for address 0x%lx", pc); - if (!blurb_printed) - { - printf_filtered ("\ -This warning occurs if you are debugging a function without any symbols\n\ -(for example, in a stripped executable). In that case, you may wish to\n\ -increase the size of the search with the `set heuristic-fence-post' command.\n\ -\n\ -Otherwise, you told GDB there was a function where there isn't one, or\n\ -(more likely) you have encountered a bug in GDB.\n"); - blurb_printed = 1; - } - } - - return 0; - } - else if (ABOUT_TO_RETURN(start_pc)) - break; - - start_pc += 4; /* skip return */ - return start_pc; -} - -static alpha_extra_func_info_t -heuristic_proc_desc(start_pc, limit_pc, next_frame) - CORE_ADDR start_pc, limit_pc; - struct frame_info *next_frame; -{ - CORE_ADDR sp = read_next_frame_reg (next_frame, SP_REGNUM); - CORE_ADDR cur_pc; - int frame_size; - int has_frame_reg = 0; - unsigned long reg_mask = 0; - int pcreg = -1; - - if (start_pc == 0) - return NULL; - memset (&temp_proc_desc, '\0', sizeof(temp_proc_desc)); - memset (&temp_saved_regs, '\0', sizeof(struct frame_saved_regs)); - PROC_LOW_ADDR (&temp_proc_desc) = start_pc; - - if (start_pc + 200 < limit_pc) - limit_pc = start_pc + 200; - frame_size = 0; - for (cur_pc = start_pc; cur_pc < limit_pc; cur_pc += 4) - { - char buf[4]; - unsigned long word; - int status; - - status = read_memory_nobpt (cur_pc, buf, 4); - if (status) - memory_error (status, cur_pc); - word = extract_unsigned_integer (buf, 4); - - if ((word & 0xffff0000) == 0x23de0000) /* lda $sp,n($sp) */ - frame_size += (-word) & 0xffff; - else if ((word & 0xfc1f0000) == 0xb41e0000 /* stq reg,n($sp) */ - && (word & 0xffff0000) != 0xb7fe0000) /* reg != $zero */ - { - int reg = (word & 0x03e00000) >> 21; - reg_mask |= 1 << reg; - temp_saved_regs.regs[reg] = sp + (short)word; - - /* Starting with OSF/1-3.2C, the system libraries are shipped - without local symbols, but they still contain procedure - descriptors without a symbol reference. GDB is currently - unable to find these procedure descriptors and uses - heuristic_proc_desc instead. - As some low level compiler support routines (__div*, __add*) - use a non-standard return address register, we have to - add some heuristics to determine the return address register, - or stepping over these routines will fail. - Usually the return address register is the first register - saved on the stack, but assembler optimization might - rearrange the register saves. - So we recognize only a few registers (t7, t9, ra) within - the procedure prologue as valid return address registers. - - FIXME: Rewriting GDB to access the procedure descriptors, - e.g. via the minimal symbol table, might obviate this hack. */ - if (pcreg == -1 - && cur_pc < (start_pc + 20) - && (reg == T7_REGNUM || reg == T9_REGNUM || reg == RA_REGNUM)) - pcreg = reg; - } - else if (word == 0x47de040f) /* bis sp,sp fp */ - has_frame_reg = 1; - } - if (pcreg == -1) - { - /* If we haven't found a valid return address register yet, - keep searching in the procedure prologue. */ - while (cur_pc < (limit_pc + 20) && cur_pc < (start_pc + 20)) - { - char buf[4]; - unsigned long word; - int status; - - status = read_memory_nobpt (cur_pc, buf, 4); - if (status) - memory_error (status, cur_pc); - cur_pc += 4; - word = extract_unsigned_integer (buf, 4); - - if ((word & 0xfc1f0000) == 0xb41e0000 /* stq reg,n($sp) */ - && (word & 0xffff0000) != 0xb7fe0000) /* reg != $zero */ - { - int reg = (word & 0x03e00000) >> 21; - if (reg == T7_REGNUM || reg == T9_REGNUM || reg == RA_REGNUM) - { - pcreg = reg; - break; - } - } - } - } - - if (has_frame_reg) - PROC_FRAME_REG(&temp_proc_desc) = GCC_FP_REGNUM; - else - PROC_FRAME_REG(&temp_proc_desc) = SP_REGNUM; - PROC_FRAME_OFFSET(&temp_proc_desc) = frame_size; - PROC_REG_MASK(&temp_proc_desc) = reg_mask; - PROC_PC_REG(&temp_proc_desc) = (pcreg == -1) ? RA_REGNUM : pcreg; - PROC_LOCALOFF(&temp_proc_desc) = 0; /* XXX - bogus */ - return &temp_proc_desc; -} - -/* This returns the PC of the first inst after the prologue. If we can't - find the prologue, then return 0. */ - -static CORE_ADDR -after_prologue (pc, proc_desc) - CORE_ADDR pc; - alpha_extra_func_info_t proc_desc; -{ - struct symtab_and_line sal; - CORE_ADDR func_addr, func_end; - - if (!proc_desc) - proc_desc = find_proc_desc (pc, NULL); - - if (proc_desc) - { - /* If function is frameless, then we need to do it the hard way. I - strongly suspect that frameless always means prologueless... */ - if (PROC_FRAME_REG (proc_desc) == SP_REGNUM - && PROC_FRAME_OFFSET (proc_desc) == 0) - return 0; - } - - if (!find_pc_partial_function (pc, NULL, &func_addr, &func_end)) - return 0; /* Unknown */ - - sal = find_pc_line (func_addr, 0); - - if (sal.end < func_end) - return sal.end; - - /* The line after the prologue is after the end of the function. In this - case, tell the caller to find the prologue the hard way. */ - - return 0; -} - -/* Return non-zero if we *might* be in a function prologue. Return zero if we - are definatly *not* in a function prologue. */ - -static int -alpha_in_prologue (pc, proc_desc) - CORE_ADDR pc; - alpha_extra_func_info_t proc_desc; -{ - CORE_ADDR after_prologue_pc; - - after_prologue_pc = after_prologue (pc, proc_desc); - - if (after_prologue_pc == 0 - || pc < after_prologue_pc) - return 1; - else - return 0; -} - -static alpha_extra_func_info_t -find_proc_desc (pc, next_frame) - CORE_ADDR pc; - struct frame_info *next_frame; -{ - alpha_extra_func_info_t proc_desc; - struct block *b; - struct symbol *sym; - CORE_ADDR startaddr; - - /* Try to get the proc_desc from the linked call dummy proc_descs - if the pc is in the call dummy. - This is hairy. In the case of nested dummy calls we have to find the - right proc_desc, but we might not yet know the frame for the dummy - as it will be contained in the proc_desc we are searching for. - So we have to find the proc_desc whose frame is closest to the current - stack pointer. */ - - if (PC_IN_CALL_DUMMY (pc, 0, 0)) - { - struct linked_proc_info *link; - CORE_ADDR sp = read_next_frame_reg (next_frame, SP_REGNUM); - alpha_extra_func_info_t found_proc_desc = NULL; - long min_distance = LONG_MAX; - - for (link = linked_proc_desc_table; link; link = link->next) - { - long distance = (CORE_ADDR) PROC_DUMMY_FRAME (&link->info) - sp; - if (distance > 0 && distance < min_distance) - { - min_distance = distance; - found_proc_desc = &link->info; - } - } - if (found_proc_desc != NULL) - return found_proc_desc; - } - - b = block_for_pc(pc); - - find_pc_partial_function (pc, NULL, &startaddr, NULL); - if (b == NULL) - sym = NULL; - else - { - if (startaddr > BLOCK_START (b)) - /* This is the "pathological" case referred to in a comment in - print_frame_info. It might be better to move this check into - symbol reading. */ - sym = NULL; - else - sym = lookup_symbol (MIPS_EFI_SYMBOL_NAME, b, LABEL_NAMESPACE, - 0, NULL); - } - - /* If we never found a PDR for this function in symbol reading, then - examine prologues to find the information. */ - if (sym && ((mips_extra_func_info_t) SYMBOL_VALUE (sym))->pdr.framereg == -1) - sym = NULL; - - if (sym) - { - /* IF this is the topmost frame AND - * (this proc does not have debugging information OR - * the PC is in the procedure prologue) - * THEN create a "heuristic" proc_desc (by analyzing - * the actual code) to replace the "official" proc_desc. - */ - proc_desc = (alpha_extra_func_info_t)SYMBOL_VALUE(sym); - if (next_frame == NULL) - { - if (PROC_DESC_IS_DUMMY (proc_desc) || alpha_in_prologue (pc, proc_desc)) - { - alpha_extra_func_info_t found_heuristic = - heuristic_proc_desc (PROC_LOW_ADDR (proc_desc), - pc, next_frame); - if (found_heuristic) - { - PROC_LOCALOFF (found_heuristic) = - PROC_LOCALOFF (proc_desc); - PROC_PC_REG (found_heuristic) = PROC_PC_REG (proc_desc); - proc_desc = found_heuristic; - } - } - } - } - else - { - /* Is linked_proc_desc_table really necessary? It only seems to be used - by procedure call dummys. However, the procedures being called ought - to have their own proc_descs, and even if they don't, - heuristic_proc_desc knows how to create them! */ - - register struct linked_proc_info *link; - for (link = linked_proc_desc_table; link; link = link->next) - if (PROC_LOW_ADDR(&link->info) <= pc - && PROC_HIGH_ADDR(&link->info) > pc) - return &link->info; - - if (startaddr == 0) - startaddr = heuristic_proc_start (pc); - - proc_desc = - heuristic_proc_desc (startaddr, pc, next_frame); - } - return proc_desc; -} - -alpha_extra_func_info_t cached_proc_desc; - -CORE_ADDR -alpha_frame_chain(frame) - struct frame_info *frame; -{ - alpha_extra_func_info_t proc_desc; - CORE_ADDR saved_pc = FRAME_SAVED_PC(frame); - - if (saved_pc == 0 || inside_entry_file (saved_pc)) - return 0; - - proc_desc = find_proc_desc(saved_pc, frame); - if (!proc_desc) - return 0; - - cached_proc_desc = proc_desc; - - /* Fetch the frame pointer for a dummy frame from the procedure - descriptor. */ - if (PROC_DESC_IS_DUMMY(proc_desc)) - return (CORE_ADDR) PROC_DUMMY_FRAME(proc_desc); - - /* If no frame pointer and frame size is zero, we must be at end - of stack (or otherwise hosed). If we don't check frame size, - we loop forever if we see a zero size frame. */ - if (PROC_FRAME_REG (proc_desc) == SP_REGNUM - && PROC_FRAME_OFFSET (proc_desc) == 0 - /* The previous frame from a sigtramp frame might be frameless - and have frame size zero. */ - && !frame->signal_handler_caller) - { - /* The alpha __sigtramp routine is frameless and has a frame size - of zero, but we are able to backtrace through it. */ - char *name; - find_pc_partial_function (saved_pc, &name, - (CORE_ADDR *)NULL, (CORE_ADDR *)NULL); - if (IN_SIGTRAMP (saved_pc, name)) - return frame->frame; - else - return 0; - } - else - return read_next_frame_reg(frame, PROC_FRAME_REG(proc_desc)) - + PROC_FRAME_OFFSET(proc_desc); -} - -void -init_extra_frame_info (frame) - struct frame_info *frame; -{ - /* Use proc_desc calculated in frame_chain */ - alpha_extra_func_info_t proc_desc = - frame->next ? cached_proc_desc : find_proc_desc(frame->pc, frame->next); - - frame->saved_regs = NULL; - frame->localoff = 0; - frame->pc_reg = RA_REGNUM; - frame->proc_desc = proc_desc == &temp_proc_desc ? 0 : proc_desc; - if (proc_desc) - { - /* Get the locals offset and the saved pc register from the - procedure descriptor, they are valid even if we are in the - middle of the prologue. */ - frame->localoff = PROC_LOCALOFF(proc_desc); - frame->pc_reg = PROC_PC_REG(proc_desc); - - /* Fixup frame-pointer - only needed for top frame */ - - /* Fetch the frame pointer for a dummy frame from the procedure - descriptor. */ - if (PROC_DESC_IS_DUMMY(proc_desc)) - frame->frame = (CORE_ADDR) PROC_DUMMY_FRAME(proc_desc); - - /* This may not be quite right, if proc has a real frame register. - Get the value of the frame relative sp, procedure might have been - interrupted by a signal at it's very start. */ - else if (frame->pc == PROC_LOW_ADDR (proc_desc) && !PROC_DESC_IS_DUMMY (proc_desc)) - frame->frame = read_next_frame_reg (frame->next, SP_REGNUM); - else - frame->frame = read_next_frame_reg (frame->next, PROC_FRAME_REG (proc_desc)) - + PROC_FRAME_OFFSET (proc_desc); - - if (proc_desc == &temp_proc_desc) - { - char *name; - - /* Do not set the saved registers for a sigtramp frame, - alpha_find_saved_registers will do that for us. - We can't use frame->signal_handler_caller, it is not yet set. */ - find_pc_partial_function (frame->pc, &name, - (CORE_ADDR *)NULL,(CORE_ADDR *)NULL); - if (!IN_SIGTRAMP (frame->pc, name)) - { - frame->saved_regs = (struct frame_saved_regs*) - obstack_alloc (&frame_cache_obstack, - sizeof (struct frame_saved_regs)); - *frame->saved_regs = temp_saved_regs; - frame->saved_regs->regs[PC_REGNUM] - = frame->saved_regs->regs[RA_REGNUM]; - } - } - } -} - -/* ALPHA stack frames are almost impenetrable. When execution stops, - we basically have to look at symbol information for the function - that we stopped in, which tells us *which* register (if any) is - the base of the frame pointer, and what offset from that register - the frame itself is at. - - This presents a problem when trying to examine a stack in memory - (that isn't executing at the moment), using the "frame" command. We - don't have a PC, nor do we have any registers except SP. - - This routine takes two arguments, SP and PC, and tries to make the - cached frames look as if these two arguments defined a frame on the - cache. This allows the rest of info frame to extract the important - arguments without difficulty. */ - -struct frame_info * -setup_arbitrary_frame (argc, argv) - int argc; - CORE_ADDR *argv; -{ - if (argc != 2) - error ("ALPHA frame specifications require two arguments: sp and pc"); - - return create_new_frame (argv[0], argv[1]); -} - -/* The alpha passes the first six arguments in the registers, the rest on - the stack. The register arguments are eventually transferred to the - argument transfer area immediately below the stack by the called function - anyway. So we `push' at least six arguments on the stack, `reload' the - argument registers and then adjust the stack pointer to point past the - sixth argument. This algorithm simplifies the passing of a large struct - which extends from the registers to the stack. - If the called function is returning a structure, the address of the - structure to be returned is passed as a hidden first argument. */ - -CORE_ADDR -alpha_push_arguments (nargs, args, sp, struct_return, struct_addr) - int nargs; - value_ptr *args; - CORE_ADDR sp; - int struct_return; - CORE_ADDR struct_addr; -{ - register i; - int accumulate_size = struct_return ? 8 : 0; - int arg_regs_size = ALPHA_NUM_ARG_REGS * 8; - struct alpha_arg { char *contents; int len; int offset; }; - struct alpha_arg *alpha_args = - (struct alpha_arg*)alloca (nargs * sizeof (struct alpha_arg)); - register struct alpha_arg *m_arg; - char raw_buffer[sizeof (CORE_ADDR)]; - int required_arg_regs; - - for (i = 0, m_arg = alpha_args; i < nargs; i++, m_arg++) - { - value_ptr arg = args[i]; - struct type *arg_type = check_typedef (VALUE_TYPE (arg)); - /* Cast argument to long if necessary as the compiler does it too. */ - switch (TYPE_CODE (arg_type)) - { - case TYPE_CODE_INT: - case TYPE_CODE_BOOL: - case TYPE_CODE_CHAR: - case TYPE_CODE_RANGE: - case TYPE_CODE_ENUM: - if (TYPE_LENGTH (arg_type) < TYPE_LENGTH (builtin_type_long)) - { - arg_type = builtin_type_long; - arg = value_cast (arg_type, arg); - } - break; - default: - break; - } - m_arg->len = TYPE_LENGTH (arg_type); - m_arg->offset = accumulate_size; - accumulate_size = (accumulate_size + m_arg->len + 7) & ~7; - m_arg->contents = VALUE_CONTENTS(arg); - } - - /* Determine required argument register loads, loading an argument register - is expensive as it uses three ptrace calls. */ - required_arg_regs = accumulate_size / 8; - if (required_arg_regs > ALPHA_NUM_ARG_REGS) - required_arg_regs = ALPHA_NUM_ARG_REGS; - - /* Make room for the arguments on the stack. */ - if (accumulate_size < arg_regs_size) - accumulate_size = arg_regs_size; - sp -= accumulate_size; - - /* Keep sp aligned to a multiple of 16 as the compiler does it too. */ - sp &= ~15; - - /* `Push' arguments on the stack. */ - for (i = nargs; m_arg--, --i >= 0; ) - write_memory(sp + m_arg->offset, m_arg->contents, m_arg->len); - if (struct_return) - { - store_address (raw_buffer, sizeof (CORE_ADDR), struct_addr); - write_memory (sp, raw_buffer, sizeof (CORE_ADDR)); - } - - /* Load the argument registers. */ - for (i = 0; i < required_arg_regs; i++) - { - LONGEST val; - - val = read_memory_integer (sp + i * 8, 8); - write_register (A0_REGNUM + i, val); - write_register (FPA0_REGNUM + i, val); - } - - return sp + arg_regs_size; -} - -void -alpha_push_dummy_frame() -{ - int ireg; - struct linked_proc_info *link; - alpha_extra_func_info_t proc_desc; - CORE_ADDR sp = read_register (SP_REGNUM); - CORE_ADDR save_address; - char raw_buffer[MAX_REGISTER_RAW_SIZE]; - unsigned long mask; - - link = (struct linked_proc_info *) xmalloc(sizeof (struct linked_proc_info)); - link->next = linked_proc_desc_table; - linked_proc_desc_table = link; - - proc_desc = &link->info; - - /* - * The registers we must save are all those not preserved across - * procedure calls. - * In addition, we must save the PC and RA. - * - * Dummy frame layout: - * (high memory) - * Saved PC - * Saved F30 - * ... - * Saved F0 - * Saved R29 - * ... - * Saved R0 - * Saved R26 (RA) - * Parameter build area - * (low memory) - */ - -/* MASK(i,j) == (1<>= 1) - if (mask & 1) - { - if (ireg == RA_REGNUM) - continue; - store_address (raw_buffer, 8, read_register (ireg)); - write_memory (save_address, raw_buffer, 8); - save_address += 8; - } - - store_address (raw_buffer, 8, read_register (PC_REGNUM)); - write_memory (sp - 8, raw_buffer, 8); - - /* Save floating point registers. */ - save_address = sp + PROC_FREG_OFFSET(proc_desc); - mask = PROC_FREG_MASK(proc_desc) & 0xffffffffL; - for (ireg = 0; mask; ireg++, mask >>= 1) - if (mask & 1) - { - store_address (raw_buffer, 8, read_register (ireg + FP0_REGNUM)); - write_memory (save_address, raw_buffer, 8); - save_address += 8; - } - - /* Set and save the frame address for the dummy. - This is tricky. The only registers that are suitable for a frame save - are those that are preserved across procedure calls (s0-s6). But if - a read system call is interrupted and then a dummy call is made - (see testsuite/gdb.t17/interrupt.exp) the dummy call hangs till the read - is satisfied. Then it returns with the s0-s6 registers set to the values - on entry to the read system call and our dummy frame pointer would be - destroyed. So we save the dummy frame in the proc_desc and handle the - retrieval of the frame pointer of a dummy specifically. The frame register - is set to the virtual frame (pseudo) register, it's value will always - be read as zero and will help us to catch any errors in the dummy frame - retrieval code. */ - PROC_DUMMY_FRAME(proc_desc) = sp; - PROC_FRAME_REG(proc_desc) = FP_REGNUM; - PROC_FRAME_OFFSET(proc_desc) = 0; - sp += PROC_REG_OFFSET(proc_desc); - write_register (SP_REGNUM, sp); - - PROC_LOW_ADDR(proc_desc) = CALL_DUMMY_ADDRESS (); - PROC_HIGH_ADDR(proc_desc) = PROC_LOW_ADDR(proc_desc) + 4; - - SET_PROC_DESC_IS_DUMMY(proc_desc); - PROC_PC_REG(proc_desc) = RA_REGNUM; -} - -void -alpha_pop_frame() -{ - register int regnum; - struct frame_info *frame = get_current_frame (); - CORE_ADDR new_sp = frame->frame; - - alpha_extra_func_info_t proc_desc = frame->proc_desc; - - write_register (PC_REGNUM, FRAME_SAVED_PC(frame)); - if (frame->saved_regs == NULL) - alpha_find_saved_regs (frame); - if (proc_desc) - { - for (regnum = 32; --regnum >= 0; ) - if (PROC_REG_MASK(proc_desc) & (1 << regnum)) - write_register (regnum, - read_memory_integer (frame->saved_regs->regs[regnum], - 8)); - for (regnum = 32; --regnum >= 0; ) - if (PROC_FREG_MASK(proc_desc) & (1 << regnum)) - write_register (regnum + FP0_REGNUM, - read_memory_integer (frame->saved_regs->regs[regnum + FP0_REGNUM], 8)); - } - write_register (SP_REGNUM, new_sp); - flush_cached_frames (); - - if (proc_desc && PROC_DESC_IS_DUMMY(proc_desc)) - { - struct linked_proc_info *pi_ptr, *prev_ptr; - - for (pi_ptr = linked_proc_desc_table, prev_ptr = NULL; - pi_ptr != NULL; - prev_ptr = pi_ptr, pi_ptr = pi_ptr->next) - { - if (&pi_ptr->info == proc_desc) - break; - } - - if (pi_ptr == NULL) - error ("Can't locate dummy extra frame info\n"); - - if (prev_ptr != NULL) - prev_ptr->next = pi_ptr->next; - else - linked_proc_desc_table = pi_ptr->next; - - free (pi_ptr); - } -} - -/* 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 - LENIENT, then we must skip everything which is involved in setting - up the frame (it's OK to skip more, just so long as we don't skip - anything which might clobber the registers which are being saved. - Currently we must not skip more on the alpha, but we might the lenient - stuff some day. */ - -CORE_ADDR -alpha_skip_prologue (pc, lenient) - CORE_ADDR pc; - int lenient; -{ - unsigned long inst; - int offset; - CORE_ADDR post_prologue_pc; - char buf[4]; - -#ifdef GDB_TARGET_HAS_SHARED_LIBS - /* Silently return the unaltered pc upon memory errors. - This could happen on OSF/1 if decode_line_1 tries to skip the - prologue for quickstarted shared library functions when the - shared library is not yet mapped in. - Reading target memory is slow over serial lines, so we perform - this check only if the target has shared libraries. */ - if (target_read_memory (pc, buf, 4)) - return pc; -#endif - - /* See if we can determine the end of the prologue via the symbol table. - If so, then return either PC, or the PC after the prologue, whichever - is greater. */ - - post_prologue_pc = after_prologue (pc, NULL); - - if (post_prologue_pc != 0) - return max (pc, post_prologue_pc); - - /* Can't determine prologue from the symbol table, need to examine - instructions. */ - - /* 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 (offset = 0; offset < 100; offset += 4) - { - int status; - - status = read_memory_nobpt (pc + offset, buf, 4); - if (status) - memory_error (status, pc + offset); - inst = extract_unsigned_integer (buf, 4); - - /* The alpha has no delay slots. But let's keep the lenient stuff, - we might need it for something else in the future. */ - if (lenient && 0) - continue; - - if ((inst & 0xffff0000) == 0x27bb0000) /* ldah $gp,n($t12) */ - continue; - if ((inst & 0xffff0000) == 0x23bd0000) /* lda $gp,n($gp) */ - continue; - if ((inst & 0xffff0000) == 0x23de0000) /* lda $sp,n($sp) */ - continue; - else if ((inst & 0xfc1f0000) == 0xb41e0000 - && (inst & 0xffff0000) != 0xb7fe0000) - continue; /* stq reg,n($sp) */ - /* reg != $zero */ - else if ((inst & 0xfc1f0000) == 0x9c1e0000 - && (inst & 0xffff0000) != 0x9ffe0000) - continue; /* stt reg,n($sp) */ - /* reg != $zero */ - else if (inst == 0x47de040f) /* bis sp,sp,fp */ - continue; - else - break; - } - return pc + offset; -} - -#if 0 -/* Is address PC in the prologue (loosely defined) for function at - STARTADDR? */ - -static int -alpha_in_lenient_prologue (startaddr, pc) - CORE_ADDR startaddr; - CORE_ADDR pc; -{ - CORE_ADDR end_prologue = alpha_skip_prologue (startaddr, 1); - return pc >= startaddr && pc < end_prologue; -} -#endif - -/* The alpha needs a conversion between register and memory format if - the register is a floating point register and - memory format is float, as the register format must be double - or - memory format is an integer with 4 bytes or less, as the representation - of integers in floating point registers is different. */ -void -alpha_register_convert_to_virtual (regnum, valtype, raw_buffer, virtual_buffer) - int regnum; - struct type *valtype; - char *raw_buffer; - char *virtual_buffer; -{ - if (TYPE_LENGTH (valtype) >= REGISTER_RAW_SIZE (regnum)) - { - memcpy (virtual_buffer, raw_buffer, REGISTER_VIRTUAL_SIZE (regnum)); - return; - } - - if (TYPE_CODE (valtype) == TYPE_CODE_FLT) - { - double d = extract_floating (raw_buffer, REGISTER_RAW_SIZE (regnum)); - store_floating (virtual_buffer, TYPE_LENGTH (valtype), d); - } - else if (TYPE_CODE (valtype) == TYPE_CODE_INT && TYPE_LENGTH (valtype) <= 4) - { - unsigned LONGEST l; - l = extract_unsigned_integer (raw_buffer, REGISTER_RAW_SIZE (regnum)); - l = ((l >> 32) & 0xc0000000) | ((l >> 29) & 0x3fffffff); - store_unsigned_integer (virtual_buffer, TYPE_LENGTH (valtype), l); - } - else - error ("Cannot retrieve value from floating point register"); -} - -void -alpha_register_convert_to_raw (valtype, regnum, virtual_buffer, raw_buffer) - struct type *valtype; - int regnum; - char *virtual_buffer; - char *raw_buffer; -{ - if (TYPE_LENGTH (valtype) >= REGISTER_RAW_SIZE (regnum)) - { - memcpy (raw_buffer, virtual_buffer, REGISTER_RAW_SIZE (regnum)); - return; - } - - if (TYPE_CODE (valtype) == TYPE_CODE_FLT) - { - double d = extract_floating (virtual_buffer, TYPE_LENGTH (valtype)); - store_floating (raw_buffer, REGISTER_RAW_SIZE (regnum), d); - } - else if (TYPE_CODE (valtype) == TYPE_CODE_INT && TYPE_LENGTH (valtype) <= 4) - { - unsigned LONGEST l; - if (TYPE_UNSIGNED (valtype)) - l = extract_unsigned_integer (virtual_buffer, TYPE_LENGTH (valtype)); - else - l = extract_signed_integer (virtual_buffer, TYPE_LENGTH (valtype)); - l = ((l & 0xc0000000) << 32) | ((l & 0x3fffffff) << 29); - store_unsigned_integer (raw_buffer, REGISTER_RAW_SIZE (regnum), l); - } - else - error ("Cannot store value in floating point register"); -} - -/* Given a return value in `regbuf' with a type `valtype', - extract and copy its value into `valbuf'. */ - -void -alpha_extract_return_value (valtype, regbuf, valbuf) - struct type *valtype; - char regbuf[REGISTER_BYTES]; - char *valbuf; -{ - if (TYPE_CODE (valtype) == TYPE_CODE_FLT) - alpha_register_convert_to_virtual (FP0_REGNUM, valtype, - regbuf + REGISTER_BYTE (FP0_REGNUM), - valbuf); - else - memcpy (valbuf, regbuf + REGISTER_BYTE (V0_REGNUM), TYPE_LENGTH (valtype)); -} - -/* Given a return value in `regbuf' with a type `valtype', - write its value into the appropriate register. */ - -void -alpha_store_return_value (valtype, valbuf) - struct type *valtype; - char *valbuf; -{ - char raw_buffer[MAX_REGISTER_RAW_SIZE]; - int regnum = V0_REGNUM; - int length = TYPE_LENGTH (valtype); - - if (TYPE_CODE (valtype) == TYPE_CODE_FLT) - { - regnum = FP0_REGNUM; - length = REGISTER_RAW_SIZE (regnum); - alpha_register_convert_to_raw (valtype, regnum, valbuf, raw_buffer); - } - else - memcpy (raw_buffer, valbuf, length); - - write_register_bytes (REGISTER_BYTE (regnum), raw_buffer, length); -} - -/* Just like reinit_frame_cache, but with the right arguments to be - callable as an sfunc. */ - -static void -reinit_frame_cache_sfunc (args, from_tty, c) - char *args; - int from_tty; - struct cmd_list_element *c; -{ - reinit_frame_cache (); -} - -/* This is the definition of CALL_DUMMY_ADDRESS. It's a heuristic that is used - to find a convenient place in the text segment to stick a breakpoint to - detect the completion of a target function call (ala call_function_by_hand). - */ - -CORE_ADDR -alpha_call_dummy_address () -{ - CORE_ADDR entry; - struct minimal_symbol *sym; - - entry = entry_point_address (); - - if (entry != 0) - return entry; - - sym = lookup_minimal_symbol ("_Prelude", NULL, symfile_objfile); - - if (!sym || MSYMBOL_TYPE (sym) != mst_text) - return 0; - else - return SYMBOL_VALUE_ADDRESS (sym) + 4; -} - -void -_initialize_alpha_tdep () -{ - struct cmd_list_element *c; - - tm_print_insn = print_insn_alpha; - - /* Let the user set the fence post for heuristic_proc_start. */ - - /* We really would like to have both "0" and "unlimited" work, but - command.c doesn't deal with that. So make it a var_zinteger - because the user can always use "999999" or some such for unlimited. */ - c = add_set_cmd ("heuristic-fence-post", class_support, var_zinteger, - (char *) &heuristic_fence_post, - "\ -Set the distance searched for the start of a function.\n\ -If you are debugging a stripped executable, GDB needs to search through the\n\ -program for the start of a function. This command sets the distance of the\n\ -search. The only need to set it is when debugging a stripped executable.", - &setlist); - /* We need to throw away the frame cache when we set this, since it - might change our ability to get backtraces. */ - c->function.sfunc = reinit_frame_cache_sfunc; - add_show_from_set (c, &showlist); -} diff --git a/contrib/gdb/gdb/arm-convert.s b/contrib/gdb/gdb/arm-convert.s deleted file mode 100644 index 416132b..0000000 --- a/contrib/gdb/gdb/arm-convert.s +++ /dev/null @@ -1,16 +0,0 @@ - .text - .global _convert_from_extended - -_convert_from_extended: - - ldfe f0,[a1] - stfd f0,[a2] - movs pc,lr - - .global _convert_to_extended - -_convert_to_extended: - - ldfd f0,[a1] - stfe f0,[a2] - movs pc,lr diff --git a/contrib/gdb/gdb/arm-tdep.c b/contrib/gdb/gdb/arm-tdep.c deleted file mode 100644 index 884e9d8..0000000 --- a/contrib/gdb/gdb/arm-tdep.c +++ /dev/null @@ -1,826 +0,0 @@ -/* Target-dependent code for the Acorn Risc Machine, for GDB, the GNU Debugger. - Copyright 1988, 1989, 1991, 1992, 1993, 1995 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "defs.h" -#include "frame.h" -#include "inferior.h" - -#if 0 -#include "gdbcore.h" -#include -#include -#include -#include -#include -#include - -#define N_TXTADDR(hdr) 0x8000 -#define N_DATADDR(hdr) (hdr.a_text + 0x8000) - -#include /* After a.out.h */ -#include -#include "gdb_stat.h" - -#include -#endif - - -#if 0 -/* Work with core dump and executable files, for GDB. - This code would be in corefile.c if it weren't machine-dependent. */ - -/* Structure to describe the chain of shared libraries used - by the execfile. - e.g. prog shares Xt which shares X11 which shares c. */ - -struct shared_library { - struct exec_header header; - char name[SHLIBLEN]; - CORE_ADDR text_start; /* CORE_ADDR of 1st byte of text, this file */ - long data_offset; /* offset of data section in file */ - int chan; /* file descriptor for the file */ - struct shared_library *shares; /* library this one shares */ -}; -static struct shared_library *shlib = 0; - -/* Hook for `exec_file_command' command to call. */ - -extern void (*exec_file_display_hook) (); - -static CORE_ADDR unshared_text_start; - -/* extended header from exec file (for shared library info) */ - -static struct exec_header exec_header; - -void -exec_file_command (filename, from_tty) - char *filename; - int from_tty; -{ - int val; - - /* Eliminate all traces of old exec file. - Mark text segment as empty. */ - - if (execfile) - free (execfile); - execfile = 0; - data_start = 0; - data_end -= exec_data_start; - text_start = 0; - unshared_text_start = 0; - text_end = 0; - exec_data_start = 0; - exec_data_end = 0; - if (execchan >= 0) - close (execchan); - execchan = -1; - if (shlib) { - close_shared_library(shlib); - shlib = 0; - } - - /* Now open and digest the file the user requested, if any. */ - - if (filename) - { - filename = tilde_expand (filename); - make_cleanup (free, filename); - - execchan = openp (getenv ("PATH"), 1, filename, O_RDONLY, 0, - &execfile); - if (execchan < 0) - perror_with_name (filename); - - { - struct stat st_exec; - -#ifdef HEADER_SEEK_FD - HEADER_SEEK_FD (execchan); -#endif - - val = myread (execchan, &exec_header, sizeof exec_header); - exec_aouthdr = exec_header.a_exec; - - if (val < 0) - perror_with_name (filename); - - text_start = 0x8000; - - /* Look for shared library if needed */ - if (exec_header.a_exec.a_magic & MF_USES_SL) - shlib = open_shared_library(exec_header.a_shlibname, text_start); - - text_offset = N_TXTOFF (exec_aouthdr); - exec_data_offset = N_TXTOFF (exec_aouthdr) + exec_aouthdr.a_text; - - if (shlib) { - unshared_text_start = shared_text_end(shlib) & ~0x7fff; - stack_start = shlib->header.a_exec.a_sldatabase; - stack_end = STACK_END_ADDR; - } else - unshared_text_start = 0x8000; - text_end = unshared_text_start + exec_aouthdr.a_text; - - exec_data_start = unshared_text_start + exec_aouthdr.a_text; - exec_data_end = exec_data_start + exec_aouthdr.a_data; - - data_start = exec_data_start; - data_end += exec_data_start; - - fstat (execchan, &st_exec); - exec_mtime = st_exec.st_mtime; - } - - validate_files (); - } - else if (from_tty) - printf ("No exec file now.\n"); - - /* Tell display code (if any) about the changed file name. */ - if (exec_file_display_hook) - (*exec_file_display_hook) (filename); -} -#endif - -#if 0 -/* Read from the program's memory (except for inferior processes). - This function is misnamed, since it only reads, never writes; and - since it will use the core file and/or executable file as necessary. - - It should be extended to write as well as read, FIXME, for patching files. - - Return 0 if address could be read, EIO if addresss out of bounds. */ - -int -xfer_core_file (memaddr, myaddr, len) - CORE_ADDR memaddr; - char *myaddr; - int len; -{ - register int i; - register int val; - int xferchan; - char **xferfile; - int fileptr; - int returnval = 0; - - while (len > 0) - { - xferfile = 0; - xferchan = 0; - - /* Determine which file the next bunch of addresses reside in, - and where in the file. Set the file's read/write pointer - to point at the proper place for the desired address - and set xferfile and xferchan for the correct file. - - If desired address is nonexistent, leave them zero. - - i is set to the number of bytes that can be handled - along with the next address. - - We put the most likely tests first for efficiency. */ - - /* Note that if there is no core file - data_start and data_end are equal. */ - if (memaddr >= data_start && memaddr < data_end) - { - i = min (len, data_end - memaddr); - fileptr = memaddr - data_start + data_offset; - xferfile = &corefile; - xferchan = corechan; - } - /* Note that if there is no core file - stack_start and stack_end define the shared library data. */ - else if (memaddr >= stack_start && memaddr < stack_end) - { - if (corechan < 0) { - struct shared_library *lib; - for (lib = shlib; lib; lib = lib->shares) - if (memaddr >= lib->header.a_exec.a_sldatabase && - memaddr < lib->header.a_exec.a_sldatabase + - lib->header.a_exec.a_data) - break; - if (lib) { - i = min (len, lib->header.a_exec.a_sldatabase + - lib->header.a_exec.a_data - memaddr); - fileptr = lib->data_offset + memaddr - - lib->header.a_exec.a_sldatabase; - xferfile = execfile; - xferchan = lib->chan; - } - } else { - i = min (len, stack_end - memaddr); - fileptr = memaddr - stack_start + stack_offset; - xferfile = &corefile; - xferchan = corechan; - } - } - else if (corechan < 0 - && memaddr >= exec_data_start && memaddr < exec_data_end) - { - i = min (len, exec_data_end - memaddr); - fileptr = memaddr - exec_data_start + exec_data_offset; - xferfile = &execfile; - xferchan = execchan; - } - else if (memaddr >= text_start && memaddr < text_end) - { - struct shared_library *lib; - for (lib = shlib; lib; lib = lib->shares) - if (memaddr >= lib->text_start && - memaddr < lib->text_start + lib->header.a_exec.a_text) - break; - if (lib) { - i = min (len, lib->header.a_exec.a_text + - lib->text_start - memaddr); - fileptr = memaddr - lib->text_start + text_offset; - xferfile = &execfile; - xferchan = lib->chan; - } else { - i = min (len, text_end - memaddr); - fileptr = memaddr - unshared_text_start + text_offset; - xferfile = &execfile; - xferchan = execchan; - } - } - else if (memaddr < text_start) - { - i = min (len, text_start - memaddr); - } - else if (memaddr >= text_end - && memaddr < (corechan >= 0? data_start : exec_data_start)) - { - i = min (len, data_start - memaddr); - } - else if (corechan >= 0 - && memaddr >= data_end && memaddr < stack_start) - { - i = min (len, stack_start - memaddr); - } - else if (corechan < 0 && memaddr >= exec_data_end) - { - i = min (len, - memaddr); - } - else if (memaddr >= stack_end && stack_end != 0) - { - i = min (len, - memaddr); - } - else - { - /* Address did not classify into one of the known ranges. - This shouldn't happen; we catch the endpoints. */ - fatal ("Internal: Bad case logic in xfer_core_file."); - } - - /* Now we know which file to use. - Set up its pointer and transfer the data. */ - if (xferfile) - { - if (*xferfile == 0) - if (xferfile == &execfile) - error ("No program file to examine."); - else - error ("No core dump file or running program to examine."); - val = lseek (xferchan, fileptr, 0); - if (val < 0) - perror_with_name (*xferfile); - val = myread (xferchan, myaddr, i); - if (val < 0) - perror_with_name (*xferfile); - } - /* If this address is for nonexistent memory, - read zeros if reading, or do nothing if writing. - Actually, we never right. */ - else - { - memset (myaddr, '\0', i); - returnval = EIO; - } - - memaddr += i; - myaddr += i; - len -= i; - } - return returnval; -} -#endif - -/* APCS (ARM procedure call standard) defines the following prologue: - - mov ip, sp - [stmfd sp!, {a1,a2,a3,a4}] - stmfd sp!, {...,fp,ip,lr,pc} - [stfe f7, [sp, #-12]!] - [stfe f6, [sp, #-12]!] - [stfe f5, [sp, #-12]!] - [stfe f4, [sp, #-12]!] - sub fp, ip, #nn // nn == 20 or 4 depending on second ins -*/ - -CORE_ADDR -skip_prologue(pc) -CORE_ADDR pc; -{ - CORE_ADDR skip_pc = pc; -#if 0 - union insn_fmt op; - - op.ins = read_memory_integer(skip_pc, 4); - /* look for the "mov ip,sp" */ - if (op.generic.type != TYPE_ARITHMETIC || - op.arith.opcode != OPCODE_MOV || - op.arith.dest != SPTEMP || - op.arith.operand2 != SP) return pc; - skip_pc += 4; - /* skip the "stmfd sp!,{a1,a2,a3,a4}" if its there */ - op.ins = read_memory_integer(skip_pc, 4); - if (op.generic.type == TYPE_BLOCK_BRANCH && - op.generic.subtype == SUBTYPE_BLOCK && - op.block.mask == 0xf && - op.block.base == SP && - op.block.is_load == 0 && - op.block.writeback == 1 && - op.block.increment == 0 && - op.block.before == 1) skip_pc += 4; - /* skip the "stmfd sp!,{...,fp,ip,lr,pc} */ - op.ins = read_memory_integer(skip_pc, 4); - if (op.generic.type != TYPE_BLOCK_BRANCH || - op.generic.subtype != SUBTYPE_BLOCK || - /* the mask should look like 110110xxxxxx0000 */ - (op.block.mask & 0xd800) != 0xd800 || - op.block.base != SP || - op.block.is_load != 0 || - op.block.writeback != 1 || - op.block.increment != 0 || - op.block.before != 1) return pc; - skip_pc += 4; - /* check for "sub fp,ip,#nn" */ - op.ins = read_memory_integer(skip_pc, 4); - if (op.generic.type != TYPE_ARITHMETIC || - op.arith.opcode != OPCODE_SUB || - op.arith.dest != FP || - op.arith.operand1 != SPTEMP) return pc; -#endif - return skip_pc + 4; -} - -void -arm_frame_find_saved_regs (frame_info, saved_regs_addr) - struct frame_info *frame_info; - struct frame_saved_regs *saved_regs_addr; -{ - register int regnum; - register int frame; - register int next_addr; - register int return_data_save; - register int saved_register_mask; - - memset (saved_regs_addr, '\0', sizeof (*saved_regs_addr)); - frame = frame_info->frame; - return_data_save = read_memory_integer (frame, 4) & 0x03fffffc - 12; - saved_register_mask = read_memory_integer (return_data_save, 4); - next_addr = frame - 12; - for (regnum = 4; regnum < 10; regnum++) - if (saved_register_mask & (1 << regnum)) - { - next_addr -= 4; - saved_regs_addr->regs[regnum] = next_addr; - } - if (read_memory_integer (return_data_save + 4, 4) == 0xed6d7103) - { - next_addr -= 12; - saved_regs_addr->regs[F0_REGNUM + 7] = next_addr; - } - if (read_memory_integer (return_data_save + 8, 4) == 0xed6d6103) - { - next_addr -= 12; - saved_regs_addr->regs[F0_REGNUM + 6] = next_addr; - } - if (read_memory_integer (return_data_save + 12, 4) == 0xed6d5103) - { - next_addr -= 12; - saved_regs_addr->regs[F0_REGNUM + 5] = next_addr; - } - if (read_memory_integer(return_data_save + 16, 4) == 0xed6d4103) - { - next_addr -= 12; - saved_regs_addr->regs[F0_REGNUM + 4] = next_addr; - } - saved_regs_addr->regs[SP_REGNUM] = next_addr; - saved_regs_addr->regs[PC_REGNUM] = frame - 4; - saved_regs_addr->regs[PS_REGNUM] = frame - 4; - saved_regs_addr->regs[FP_REGNUM] = frame - 12; -} - -static void -print_fpu_flags(flags) -int flags; -{ - if (flags & (1 << 0)) fputs("IVO ", stdout); - if (flags & (1 << 1)) fputs("DVZ ", stdout); - if (flags & (1 << 2)) fputs("OFL ", stdout); - if (flags & (1 << 3)) fputs("UFL ", stdout); - if (flags & (1 << 4)) fputs("INX ", stdout); - putchar('\n'); -} - -void -arm_float_info() -{ - register unsigned long status = read_register(FPS_REGNUM); - int type; - - type = (status >> 24) & 127; - printf("%s FPU type %d\n", - (status & (1<<31)) ? "Hardware" : "Software", - type); - fputs("mask: ", stdout); - print_fpu_flags(status >> 16); - fputs("flags: ", stdout); - print_fpu_flags(status); -} - - -static void arm_othernames() -{ - static int toggle; - static char *original[] = ORIGINAL_REGISTER_NAMES; - static char *extra_crispy[] = ADDITIONAL_REGISTER_NAMES; - - memcpy (reg_names, toggle ? extra_crispy : original, sizeof(original)); - toggle = !toggle; -} -void -_initialize_arm_tdep () -{ - tm_print_insn = print_insn_little_arm; - add_com ("othernames", class_obscure, arm_othernames); -} - -/* FIXME: Fill in with the 'right thing', see asm - template in arm-convert.s */ - -void -convert_from_extended (ptr, dbl) -void *ptr; -double *dbl; -{ - *dbl = *(double*)ptr; -} - - -void -convert_to_extended (dbl, ptr) -void *ptr; -double *dbl; -{ - *(double*)ptr = *dbl; -} - - -int -arm_nullified_insn (inst) - unsigned long inst; -{ - unsigned long cond = inst & 0xf0000000; - unsigned long status_reg; - - if (cond == INST_AL || cond == INST_NV) - return 0; - - status_reg = read_register (PS_REGNUM); - - switch (cond) - { - case INST_EQ: - return ((status_reg & FLAG_Z) == 0); - case INST_NE: - return ((status_reg & FLAG_Z) != 0); - case INST_CS: - return ((status_reg & FLAG_C) == 0); - case INST_CC: - return ((status_reg & FLAG_C) != 0); - case INST_MI: - return ((status_reg & FLAG_N) == 0); - case INST_PL: - return ((status_reg & FLAG_N) != 0); - case INST_VS: - return ((status_reg & FLAG_V) == 0); - case INST_VC: - return ((status_reg & FLAG_V) != 0); - case INST_HI: - return ((status_reg & (FLAG_C | FLAG_Z)) != FLAG_C); - case INST_LS: - return (((status_reg & (FLAG_C | FLAG_Z)) ^ FLAG_C) == 0); - case INST_GE: - return (((status_reg & FLAG_N) == 0) != ((status_reg & FLAG_V) == 0)); - case INST_LT: - return (((status_reg & FLAG_N) == 0) == ((status_reg & FLAG_V) == 0)); - case INST_GT: - return (((status_reg & FLAG_Z) != 0) || - (((status_reg & FLAG_N) == 0) != ((status_reg & FLAG_V) == 0))); - case INST_LE: - return (((status_reg & FLAG_Z) == 0) && - (((status_reg & FLAG_N) == 0) == ((status_reg & FLAG_V) == 0))); - } - return 0; -} - - - -/* taken from remote-arm.c .. */ - -#define submask(x) ((1L << ((x) + 1)) - 1) -#define bit(obj,st) (((obj) & (1L << (st))) >> st) -#define bits(obj,st,fn) \ - (((obj) & submask (fn) & ~ submask ((st) - 1)) >> (st)) -#define sbits(obj,st,fn) \ - ((long) (bits(obj,st,fn) | ((long) bit(obj,fn) * ~ submask (fn - st)))) -#define BranchDest(addr,instr) \ - ((CORE_ADDR) (((long) (addr)) + 8 + (sbits (instr, 0, 23) << 2))) -#define ARM_PC_32 1 - -static unsigned long -shifted_reg_val (inst, carry, pc_val) - unsigned long inst; - int carry; - unsigned long pc_val; -{ - unsigned long res, shift; - int rm = bits (inst, 0, 3); - unsigned long shifttype = bits (inst, 5, 6); - - if (bit(inst, 4)) - { - int rs = bits (inst, 8, 11); - shift = (rs == 15 ? pc_val + 8 : read_register (rs)) & 0xFF; - } - else - shift = bits (inst, 7, 11); - - res = (rm == 15 - ? ((pc_val | (ARM_PC_32 ? 0 : read_register (PS_REGNUM))) - + (bit (inst, 4) ? 12 : 8)) - : read_register (rm)); - - switch (shifttype) - { - case 0: /* LSL */ - res = shift >= 32 ? 0 : res << shift; - break; - - case 1: /* LSR */ - res = shift >= 32 ? 0 : res >> shift; - break; - - case 2: /* ASR */ - if (shift >= 32) shift = 31; - res = ((res & 0x80000000L) - ? ~((~res) >> shift) : res >> shift); - break; - - case 3: /* ROR/RRX */ - shift &= 31; - if (shift == 0) - res = (res >> 1) | (carry ? 0x80000000L : 0); - else - res = (res >> shift) | (res << (32-shift)); - break; - } - - return res & 0xffffffff; -} - - -CORE_ADDR -arm_get_next_pc (pc) - CORE_ADDR pc; -{ - unsigned long pc_val = (unsigned long) pc; - unsigned long this_instr = read_memory_integer (pc, 4); - unsigned long status = read_register (PS_REGNUM); - CORE_ADDR nextpc = (CORE_ADDR) (pc_val + 4); /* Default case */ - - if (! arm_nullified_insn (this_instr)) - { - switch (bits(this_instr, 24, 27)) - { - case 0x0: case 0x1: /* data processing */ - case 0x2: case 0x3: - { - unsigned long operand1, operand2, result = 0; - unsigned long rn; - int c; - - if (bits(this_instr, 12, 15) != 15) - break; - - if (bits (this_instr, 22, 25) == 0 - && bits (this_instr, 4, 7) == 9) /* multiply */ - error ("Illegal update to pc in instruction"); - - /* Multiply into PC */ - c = (status & FLAG_C) ? 1 : 0; - rn = bits (this_instr, 16, 19); - operand1 = (rn == 15) ? pc_val + 8 : read_register (rn); - - if (bit (this_instr, 25)) - { - unsigned long immval = bits (this_instr, 0, 7); - unsigned long rotate = 2 * bits (this_instr, 8, 11); - operand2 = ((immval >> rotate) | (immval << (32-rotate)) - & 0xffffffff); - } - else /* operand 2 is a shifted register */ - operand2 = shifted_reg_val (this_instr, c, pc_val); - - switch (bits (this_instr, 21, 24)) - { - case 0x0: /*and*/ - result = operand1 & operand2; - break; - - case 0x1: /*eor*/ - result = operand1 ^ operand2; - break; - - case 0x2: /*sub*/ - result = operand1 - operand2; - break; - - case 0x3: /*rsb*/ - result = operand2 - operand1; - break; - - case 0x4: /*add*/ - result = operand1 + operand2; - break; - - case 0x5: /*adc*/ - result = operand1 + operand2 + c; - break; - - case 0x6: /*sbc*/ - result = operand1 - operand2 + c; - break; - - case 0x7: /*rsc*/ - result = operand2 - operand1 + c; - break; - - case 0x8: case 0x9: case 0xa: case 0xb: /* tst, teq, cmp, cmn */ - result = (unsigned long) nextpc; - break; - - case 0xc: /*orr*/ - result = operand1 | operand2; - break; - - case 0xd: /*mov*/ - /* Always step into a function. */ - result = operand2; - break; - - case 0xe: /*bic*/ - result = operand1 & ~operand2; - break; - - case 0xf: /*mvn*/ - result = ~operand2; - break; - } - nextpc = (CORE_ADDR) ADDR_BITS_REMOVE (result); - - if (nextpc == pc) - error ("Infinite loop detected"); - break; - } - - case 0x4: case 0x5: /* data transfer */ - case 0x6: case 0x7: - if (bit (this_instr, 20)) - { - /* load */ - if (bits (this_instr, 12, 15) == 15) - { - /* rd == pc */ - unsigned long rn; - unsigned long base; - - if (bit (this_instr, 22)) - error ("Illegal update to pc in instruction"); - - /* byte write to PC */ - rn = bits (this_instr, 16, 19); - base = (rn == 15) ? pc_val + 8 : read_register (rn); - if (bit (this_instr, 24)) - { - /* pre-indexed */ - int c = (status & FLAG_C) ? 1 : 0; - unsigned long offset = - (bit (this_instr, 25) - ? shifted_reg_val (this_instr, c, pc_val) - : bits (this_instr, 0, 11)); - - if (bit (this_instr, 23)) - base += offset; - else - base -= offset; - } - nextpc = (CORE_ADDR) read_memory_integer ((CORE_ADDR) base, - 4); - - nextpc = ADDR_BITS_REMOVE (nextpc); - - if (nextpc == pc) - error ("Infinite loop detected"); - } - } - break; - - case 0x8: case 0x9: /* block transfer */ - if (bit (this_instr, 20)) - { - /* LDM */ - if (bit (this_instr, 15)) - { - /* loading pc */ - int offset = 0; - - if (bit (this_instr, 23)) - { - /* up */ - unsigned long reglist = bits (this_instr, 0, 14); - unsigned long regbit; - - for (; reglist != 0; reglist &= ~regbit) - { - regbit = reglist & (-reglist); - offset += 4; - } - - if (bit (this_instr, 24)) /* pre */ - offset += 4; - } - else if (bit (this_instr, 24)) - offset = -4; - - { - unsigned long rn_val = - read_register (bits (this_instr, 16, 19)); - nextpc = - (CORE_ADDR) read_memory_integer ((CORE_ADDR) (rn_val - + offset), - 4); - } - nextpc = ADDR_BITS_REMOVE (nextpc); - if (nextpc == pc) - error ("Infinite loop detected"); - } - } - break; - - case 0xb: /* branch & link */ - case 0xa: /* branch */ - { - nextpc = BranchDest (pc, this_instr); - - nextpc = ADDR_BITS_REMOVE (nextpc); - if (nextpc == pc) - error ("Infinite loop detected"); - break; - } - - case 0xc: case 0xd: - case 0xe: /* coproc ops */ - case 0xf: /* SWI */ - break; - - default: - fprintf (stderr, "Bad bit-field extraction\n"); - return (pc); - } - } - - return nextpc; -} - diff --git a/contrib/gdb/gdb/arm-xdep.c b/contrib/gdb/gdb/arm-xdep.c deleted file mode 100644 index b855ac8..0000000 --- a/contrib/gdb/gdb/arm-xdep.c +++ /dev/null @@ -1,276 +0,0 @@ -/* Acorn Risc Machine host machine support. - Copyright (C) 1988, 1989, 1991 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 "frame.h" -#include "inferior.h" -#include "arm-opcode.h" - -#include -#include -#include -#include -#include -#include - -#define N_TXTADDR(hdr) 0x8000 -#define N_DATADDR(hdr) (hdr.a_text + 0x8000) - -#include "gdbcore.h" - -#include /* After a.out.h */ -#include -#include "gdb_stat.h" - -#include - -void -fetch_inferior_registers (regno) - int regno; /* Original value discarded */ -{ - register unsigned int regaddr; - char buf[MAX_REGISTER_RAW_SIZE]; - register int i; - - struct user u; - unsigned int offset = (char *) &u.u_ar0 - (char *) &u; - offset = ptrace (PT_READ_U, inferior_pid, (PTRACE_ARG3_TYPE) offset, 0) - - KERNEL_U_ADDR; - - registers_fetched (); - - for (regno = 0; regno < 16; regno++) - { - regaddr = offset + regno * 4; - *(int *)&buf[0] = ptrace (PT_READ_U, inferior_pid, - (PTRACE_ARG3_TYPE) regaddr, 0); - if (regno == PC_REGNUM) - *(int *)&buf[0] = GET_PC_PART(*(int *)&buf[0]); - supply_register (regno, buf); - } - *(int *)&buf[0] = ptrace (PT_READ_U, inferior_pid, - (PTRACE_ARG3_TYPE) (offset + PC*4), 0); - supply_register (PS_REGNUM, buf); /* set virtual register ps same as pc */ - - /* read the floating point registers */ - offset = (char *) &u.u_fp_regs - (char *)&u; - *(int *)buf = ptrace (PT_READ_U, inferior_pid, (PTRACE_ARG3_TYPE) offset, 0); - supply_register (FPS_REGNUM, buf); - for (regno = 16; regno < 24; regno++) { - regaddr = offset + 4 + 12 * (regno - 16); - for (i = 0; i < 12; i += sizeof(int)) - *(int *) &buf[i] = ptrace (PT_READ_U, inferior_pid, - (PTRACE_ARG3_TYPE) (regaddr + i), 0); - supply_register (regno, buf); - } -} - -/* Store our register values back into the inferior. - If REGNO is -1, do this for all registers. - Otherwise, REGNO specifies which register (so we can save time). */ - -void -store_inferior_registers (regno) - int regno; -{ - register unsigned int regaddr; - char buf[80]; - - struct user u; - unsigned long value; - unsigned int offset = (char *) &u.u_ar0 - (char *) &u; - offset = ptrace (PT_READ_U, inferior_pid, (PTRACE_ARG3_TYPE) offset, 0) - - KERNEL_U_ADDR; - - if (regno >= 0) { - if (regno >= 16) return; - regaddr = offset + 4 * regno; - errno = 0; - value = read_register(regno); - if (regno == PC_REGNUM) - value = SET_PC_PART(read_register (PS_REGNUM), value); - ptrace (PT_WRITE_U, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, value); - if (errno != 0) - { - sprintf (buf, "writing register number %d", regno); - perror_with_name (buf); - } - } - else for (regno = 0; regno < 15; regno++) - { - regaddr = offset + regno * 4; - errno = 0; - value = read_register(regno); - if (regno == PC_REGNUM) - value = SET_PC_PART(read_register (PS_REGNUM), value); - ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, value); - if (errno != 0) - { - sprintf (buf, "writing all regs, number %d", regno); - perror_with_name (buf); - } - } -} - -/* Work with core dump and executable files, for GDB. - This code would be in corefile.c if it weren't machine-dependent. */ - -/* Structure to describe the chain of shared libraries used - by the execfile. - e.g. prog shares Xt which shares X11 which shares c. */ - -struct shared_library { - struct exec_header header; - char name[SHLIBLEN]; - CORE_ADDR text_start; /* CORE_ADDR of 1st byte of text, this file */ - long data_offset; /* offset of data section in file */ - int chan; /* file descriptor for the file */ - struct shared_library *shares; /* library this one shares */ -}; -static struct shared_library *shlib = 0; - -/* Hook for `exec_file_command' command to call. */ - -extern void (*exec_file_display_hook) (); - -static CORE_ADDR unshared_text_start; - -/* extended header from exec file (for shared library info) */ - -static struct exec_header exec_header; - -void -core_file_command (filename, from_tty) - char *filename; - int from_tty; -{ - int val; - extern char registers[]; - - /* Discard all vestiges of any previous core file - and mark data and stack spaces as empty. */ - - if (corefile) - free (corefile); - corefile = 0; - - if (corechan >= 0) - close (corechan); - corechan = -1; - - data_start = 0; - data_end = 0; - stack_start = STACK_END_ADDR; - stack_end = STACK_END_ADDR; - - /* Now, if a new core file was specified, open it and digest it. */ - - if (filename) - { - filename = tilde_expand (filename); - make_cleanup (free, filename); - - if (have_inferior_p ()) - error ("To look at a core file, you must kill the program with \"kill\"."); - corechan = open (filename, O_RDONLY, 0); - if (corechan < 0) - perror_with_name (filename); - /* 4.2-style (and perhaps also sysV-style) core dump file. */ - { - struct user u; - - unsigned int reg_offset, fp_reg_offset; - - val = myread (corechan, &u, sizeof u); - if (val < 0) - perror_with_name ("Not a core file: reading upage"); - if (val != sizeof u) - error ("Not a core file: could only read %d bytes", val); - - /* We are depending on exec_file_command having been called - previously to set exec_data_start. Since the executable - and the core file share the same text segment, the address - of the data segment will be the same in both. */ - data_start = exec_data_start; - - data_end = data_start + NBPG * u.u_dsize; - stack_start = stack_end - NBPG * u.u_ssize; - data_offset = NBPG * UPAGES; - stack_offset = NBPG * (UPAGES + u.u_dsize); - - /* Some machines put an absolute address in here and some put - the offset in the upage of the regs. */ - reg_offset = (int) u.u_ar0; - if (reg_offset > NBPG * UPAGES) - reg_offset -= KERNEL_U_ADDR; - fp_reg_offset = (char *) &u.u_fp_regs - (char *)&u; - - /* I don't know where to find this info. - So, for now, mark it as not available. */ - N_SET_MAGIC (core_aouthdr, 0); - - /* Read the register values out of the core file and store - them where `read_register' will find them. */ - - { - register int regno; - - for (regno = 0; regno < NUM_REGS; regno++) - { - char buf[MAX_REGISTER_RAW_SIZE]; - - if (regno < 16) - val = lseek (corechan, reg_offset + 4 * regno, 0); - else if (regno < 24) - val = lseek (corechan, fp_reg_offset + 4 + 12*(regno - 24), 0); - else if (regno == 24) - val = lseek (corechan, fp_reg_offset, 0); - else if (regno == 25) - val = lseek (corechan, reg_offset + 4 * PC, 0); - if (val < 0 - || (val = myread (corechan, buf, sizeof buf)) < 0) - { - char * buffer = (char *) alloca (strlen (reg_names[regno]) - + 30); - strcpy (buffer, "Reading register "); - strcat (buffer, reg_names[regno]); - - perror_with_name (buffer); - } - - if (regno == PC_REGNUM) - *(int *)buf = GET_PC_PART(*(int *)buf); - supply_register (regno, buf); - } - } - } - if (filename[0] == '/') - corefile = savestring (filename, strlen (filename)); - else - { - corefile = concat (current_directory, "/", filename, NULL); - } - - flush_cached_frames (); - select_frame (get_current_frame (), 0); - validate_files (); - } - else if (from_tty) - printf ("No core file now.\n"); -} diff --git a/contrib/gdb/gdb/coff-solib.c b/contrib/gdb/gdb/coff-solib.c deleted file mode 100644 index c0cfcf5..0000000 --- a/contrib/gdb/gdb/coff-solib.c +++ /dev/null @@ -1,131 +0,0 @@ -/* Handle COFF SVR3 shared libraries for GDB, the GNU Debugger. - Copyright 1993 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - - -#include "defs.h" - -#include "frame.h" -#include "bfd.h" -#include "gdbcore.h" -#include "symtab.h" - -/* - -GLOBAL FUNCTION - - coff_solib_add -- add a shared library files to the symtab list. We - examine the `.lib' section of the exec file and determine the names of - the shared libraries. - - This function is responsible for discovering those names and - addresses, and saving sufficient information about them to allow - their symbols to be read at a later time. - -SYNOPSIS - - void coff_solib_add (char *arg_string, int from_tty, - struct target_ops *target) - -DESCRIPTION - -*/ - -void -coff_solib_add (arg_string, from_tty, target) - char *arg_string; - int from_tty; - struct target_ops *target; -{ - asection *libsect; - - libsect = bfd_get_section_by_name (exec_bfd, ".lib"); - - if (libsect) - { - int libsize; - unsigned char *lib; - struct libent - { - bfd_byte len[4]; - bfd_byte nameoffset[4]; - }; - - libsize = bfd_section_size (exec_bfd, libsect); - - lib = (unsigned char *) alloca (libsize); - - bfd_get_section_contents (exec_bfd, libsect, lib, 0, libsize); - - while (libsize > 0) - { - struct libent *ent; - struct objfile *objfile; - int len, nameoffset; - char *filename; - - ent = (struct libent *)lib; - - len = bfd_get_32 (exec_bfd, ent->len); - - nameoffset = bfd_get_32 (exec_bfd, ent->nameoffset); - - if (len <= 0) - break; - - filename = (char *)ent + nameoffset * 4; - - objfile = symbol_file_add (filename, from_tty, - 0, /* addr */ - 0, /* not mainline */ - 0, /* not mapped */ - 0); /* Not readnow */ - libsize -= len * 4; - lib += len * 4; - } - - /* Getting new symbols may change our opinion about what is - frameless. */ - reinit_frame_cache (); - } -} - -/* - -GLOBAL FUNCTION - - coff_solib_create_inferior_hook -- shared library startup support - -SYNOPSIS - - void coff_solib_create_inferior_hook() - -DESCRIPTION - - When gdb starts up the inferior, the kernel maps in the shared - libraries. We get here with the target stopped at it's first - instruction, and the libraries already mapped. At this point, this - function gets called via expansion of the macro - SOLIB_CREATE_INFERIOR_HOOK. - */ - -void -coff_solib_create_inferior_hook() -{ - coff_solib_add ((char *) 0, 0, (struct target_ops *) 0); -} diff --git a/contrib/gdb/gdb/coff-solib.h b/contrib/gdb/gdb/coff-solib.h deleted file mode 100644 index d154234..0000000 --- a/contrib/gdb/gdb/coff-solib.h +++ /dev/null @@ -1,60 +0,0 @@ -/* COFF (SVR3) Shared library declarations for GDB, the GNU Debugger. - Copyright (C) 1992 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#ifdef __STDC__ /* Forward decl's for prototypes */ -struct target_ops; -#endif - -/* Called when we free all symtabs, to free the shared library information - as well. */ - -#if 0 -#define CLEAR_SOLIB coff_clear_solib - -extern void -coff_clear_solib PARAMS ((void)); -#endif - -/* Called to add symbols from a shared library to gdb's symbol table. */ - -#define SOLIB_ADD(filename, from_tty, targ) \ - coff_solib_add (filename, from_tty, targ) - -extern void -coff_solib_add PARAMS ((char *, int, struct target_ops *)); - -/* Function to be called when the inferior starts up, to discover the names - of shared libraries that are dynamically linked, the base addresses to - which they are linked, and sufficient information to read in their symbols - at a later time. */ - -#define SOLIB_CREATE_INFERIOR_HOOK(PID) coff_solib_create_inferior_hook() - -extern void -coff_solib_create_inferior_hook PARAMS((void)); /* solib.c */ - -/* If we can't set a breakpoint, and it's in a shared library, just - disable it. */ - -#if 0 -#define DISABLE_UNSETTABLE_BREAK(addr) coff_solib_address(addr) - -extern int -solib_address PARAMS ((CORE_ADDR)); /* solib.c */ -#endif diff --git a/contrib/gdb/gdb/config/nm-empty.h b/contrib/gdb/gdb/config/nm-empty.h deleted file mode 100644 index 7069d8c..0000000 --- a/contrib/gdb/gdb/config/nm-empty.h +++ /dev/null @@ -1,2 +0,0 @@ -/* This is just a dummy file to symlink to when GDB is configured as a - cross-only debugger. */ diff --git a/contrib/gdb/gdb/config/nm-gnu.h b/contrib/gdb/gdb/config/nm-gnu.h deleted file mode 100644 index f59a2dc..0000000 --- a/contrib/gdb/gdb/config/nm-gnu.h +++ /dev/null @@ -1,46 +0,0 @@ -/* Common declarations for the GNU Hurd - - Copyright (C) 1995 Free Software Foundation, Inc. - - Written by Miles Bader - - The GNU Hurd 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. - - The GNU Hurd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#ifndef __NM_GNU_H__ -#define __NM_GNU_H__ - -#include -#include -#include - -#include "solib.h" /* Support for shared libraries. */ - -#undef target_pid_to_str -#define target_pid_to_str(pid) gnu_target_pid_to_str(pid) -extern char *gnu_target_pid_to_str (int pid); - -/* Before storing, we need to read all the registers. */ -#define CHILD_PREPARE_TO_STORE() read_register_bytes (0, NULL, REGISTER_BYTES) - -/* Don't do wait_for_inferior on attach. */ -#define ATTACH_NO_WAIT - -/* Use SVR4 style shared library support */ -#define SVR4_SHARED_LIBS -#define NO_CORE_OPS - -#define MAINTENANCE_CMDS 1 - -#endif /* __NM_GNU_H__ */ diff --git a/contrib/gdb/gdb/config/nm-lynx.h b/contrib/gdb/gdb/config/nm-lynx.h deleted file mode 100644 index 8781a9a..0000000 --- a/contrib/gdb/gdb/config/nm-lynx.h +++ /dev/null @@ -1,83 +0,0 @@ -/* Native-dependent definitions for LynxOS. - Copyright 1993 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#ifndef NM_LYNX_H -#define NM_LYNX_H - -#include -#include -/* sys/kernel.h should define this, but doesn't always, sigh. */ -#ifndef __LYNXOS -#define __LYNXOS -#endif -#include -#include -#include -#include -#include -#include -#include -#include "thread.h" - -/* This is the amount to subtract from u.u_ar0 to get the offset in - the core file of the register values. */ - -#define KERNEL_U_ADDR USRSTACK - -#undef FLOAT_INFO /* No float info yet */ - -/* As of LynxOS 2.2.2 (beta 8/15/94), this is int. Previous versions seem to - have had no prototype, so I'm not sure why GDB used to define this to - char *. */ -#define PTRACE_ARG3_TYPE int - -/* Override copies of {fetch,store}_inferior_registers in infptrace.c. */ - -#define FETCH_INFERIOR_REGISTERS - -/* Thread ID of stopped thread. */ - -#define WIFTID(x) (((union wait *)&x)->w_tid) - -/* Override child_wait in inftarg.c */ - -#define CHILD_WAIT - -/* Override child_resume in infptrace.c */ - -#define CHILD_RESUME - -/* Override child_thread_alive in intarg.c */ - -#define CHILD_THREAD_ALIVE - -#include "target.h" - -extern int child_wait PARAMS ((int pid, struct target_waitstatus *status)); - -/* Lynx needs a special definition of this so that we can - print out the pid and thread number seperatly. */ - -#undef target_pid_to_str - -#define target_pid_to_str(PID) lynx_pid_to_str (PID) - -extern char *lynx_pid_to_str PARAMS ((int pid)); - -#endif /* NM_LYNX_H */ diff --git a/contrib/gdb/gdb/config/nm-m3.h b/contrib/gdb/gdb/config/nm-m3.h deleted file mode 100644 index 6ea5256..0000000 --- a/contrib/gdb/gdb/config/nm-m3.h +++ /dev/null @@ -1,123 +0,0 @@ -/* Mach 3.0 common definitions and global vars. - - Copyright (C) 1992 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#ifndef NM_M3_H -#define NM_M3_H - -#include - -/* Mach3 doesn't declare errno in . */ -extern int errno; - -/* Task port of our debugged inferior. */ - -extern task_t inferior_task; - -/* Thread port of the current thread in the inferior. */ - -extern thread_t current_thread; - -/* If nonzero, we must suspend/abort && resume threads - * when setting or getting the state. - */ -extern int must_suspend_thread; - -#define PREPARE_TO_PROCEED(select_it) mach3_prepare_to_proceed(select_it) - -/* Try to get the privileged host port for authentication to machid - * - * If you can get this, you may debug anything on this host. - * - * If you can't, gdb gives it's own task port as the - * authentication port - */ -#define mach_privileged_host_port() task_by_pid(-1) - -/* - * This is the MIG ID number of the emulator/server bsd_execve() RPC call. - * - * It SHOULD never change, but if it does, gdb `run' - * command won't work until you fix this define. - * - */ -#define MIG_EXEC_SYSCALL_ID 101000 - -/* If our_message_port gets a msg with this ID, - * GDB suspends it's inferior and enters command level. - * (Useful at least if ^C does not work) - */ -#define GDB_MESSAGE_ID_STOP 0x41151 - -/* wait3 WNOHANG is defined in but - * for some reason gdb does not want to include - * that file. - * - * If your system defines WNOHANG differently, this has to be changed. - */ -#define WNOHANG 1 - -/* Before storing, we need to read all the registers. */ - -#define CHILD_PREPARE_TO_STORE() read_register_bytes (0, NULL, REGISTER_BYTES) - -/* Check if the inferior exists */ -#define MACH_ERROR_NO_INFERIOR \ - do if (!MACH_PORT_VALID (inferior_task)) \ - error ("Inferior task does not exist."); while(0) - -/* Error handler for mach calls */ -#define CHK(str,ret) \ - do if (ret != KERN_SUCCESS) \ - error ("Gdb %s [%d] %s : %s\n",__FILE__,__LINE__,str, \ - mach_error_string(ret)); while(0) - -/* This is from POE9 emulator/emul_stack.h - */ -/* - * Top of emulator stack holds link and reply port. - */ -struct emul_stack_top { - struct emul_stack_top *link; - mach_port_t reply_port; -}; - -#define EMULATOR_STACK_SIZE (4096*4) - -#define THREAD_ALLOWED_TO_BREAK(mid) mach_thread_for_breakpoint (mid) - -#define THREAD_PARSE_ID(arg) mach_thread_parse_id (arg) - -#define THREAD_OUTPUT_ID(mid) mach_thread_output_id (mid) - -#define ATTACH_TO_THREAD attach_to_thread - -/* Don't do wait_for_inferior on attach. */ -#define ATTACH_NO_WAIT - -/* Do Mach 3 dependent operations when ^C or a STOP is requested */ -#define DO_QUIT() mach3_quit () - -#if 0 -/* This is bogus. It is NOT OK to quit out of target_wait. */ -/* If in mach_msg() and ^C is typed set immediate_quit */ -#define REQUEST_QUIT() mach3_request_quit () -#endif - -#endif /* NM_M3_H */ diff --git a/contrib/gdb/gdb/config/nm-nbsd.h b/contrib/gdb/gdb/config/nm-nbsd.h deleted file mode 100644 index bc1d6a6..0000000 --- a/contrib/gdb/gdb/config/nm-nbsd.h +++ /dev/null @@ -1,86 +0,0 @@ -/* Native-dependent definitions for NetBSD. - Copyright 1994, 1996 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* This is the amount to subtract from u.u_ar0 - to get the offset in the core file of the register values. */ - -#include - -#define KERNEL_U_ADDR USRSTACK - -#define PTRACE_ARG3_TYPE char* - -#define FETCH_INFERIOR_REGISTERS - -#define ATTACH_DETACH - -#include "solib.h" /* Support for shared libraries. */ - -/* make structure definitions match up with those expected in solib.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 diff --git a/contrib/gdb/gdb/config/nm-sysv4.h b/contrib/gdb/gdb/config/nm-sysv4.h deleted file mode 100644 index e4978d0..0000000 --- a/contrib/gdb/gdb/config/nm-sysv4.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Definitions for running gdb on a host machine running any flavor of SVR4. - Copyright 1991, 1992 Free Software Foundation, Inc. - Written by Fred Fish at Cygnus Support (fnf@cygnus.com). - -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 "solib.h" /* Support for shared libraries. */ - -/* Use SVR4 style shared library support */ - -#define SVR4_SHARED_LIBS - -/* SVR4 has /proc support, so use it instead of ptrace. */ - -#define USE_PROC_FS - -/* SVR4 machines can easily do attach and detach via /proc (procfs.c) - support */ - -#define ATTACH_DETACH diff --git a/contrib/gdb/gdb/config/tm-lynx.h b/contrib/gdb/gdb/config/tm-lynx.h deleted file mode 100644 index 7107241..0000000 --- a/contrib/gdb/gdb/config/tm-lynx.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Macro definitions for LynxOS targets. - Copyright 1993 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#ifndef TM_LYNX_H -#define TM_LYNX_H - -/* Override number of expected traps from sysv. */ -#define START_INFERIOR_TRAPS_EXPECTED 2 - -#include "coff-solib.h" /* COFF shared library support */ - -/* Lynx's signal.h doesn't seem to have any macros for what signal numbers - the real-time events are. */ -#define REALTIME_LO 33 -/* One more than the last one. */ -#define REALTIME_HI 64 - -#endif /* TM_LYNX_H */ diff --git a/contrib/gdb/gdb/config/tm-nbsd.h b/contrib/gdb/gdb/config/tm-nbsd.h deleted file mode 100644 index e295d85..0000000 --- a/contrib/gdb/gdb/config/tm-nbsd.h +++ /dev/null @@ -1,19 +0,0 @@ -/* Target machine sub-description for NetBSD. - This is included by other tm-*.h files to specify NetBSD-specific stuff. - Copyright 1993, 1994 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. */ diff --git a/contrib/gdb/gdb/config/tm-sunos.h b/contrib/gdb/gdb/config/tm-sunos.h deleted file mode 100644 index 26ec3cf..0000000 --- a/contrib/gdb/gdb/config/tm-sunos.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Target machine sub-description for SunOS version 4. - This is included by other tm-*.h files to specify SunOS-specific stuff. - Copyright 1990, 1991, 1992, 1993, 1994 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 "solib.h" /* Support for shared libraries. */ - -/* Return non-zero if we are in a shared library trampoline code stub. */ - -#define IN_SOLIB_CALL_TRAMPOLINE(pc, name) \ - lookup_solib_trampoline_symbol_by_pc (pc) - -/* If PC is in a shared library trampoline code, return the PC - where the function itself actually starts. If not, return 0. */ - -#define SKIP_TRAMPOLINE_CODE(pc) find_solib_trampoline_target (pc) diff --git a/contrib/gdb/gdb/config/tm-sysv4.h b/contrib/gdb/gdb/config/tm-sysv4.h deleted file mode 100644 index 2c08541..0000000 --- a/contrib/gdb/gdb/config/tm-sysv4.h +++ /dev/null @@ -1,45 +0,0 @@ -/* Macro definitions for GDB on all SVR4 target systems. - Copyright 1991, 1992, 1993, 1994 Free Software Foundation, Inc. - Written by Fred Fish at Cygnus Support (fnf@cygnus.com). - -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. */ - -/* For SVR4 shared libraries, each call to a library routine goes through - a small piece of trampoline code in the ".plt" section. - The horribly ugly wait_for_inferior() routine uses this macro to detect - when we have stepped into one of these fragments. - We do not use lookup_solib_trampoline_symbol_by_pc, because - we cannot always find the shared library trampoline symbols - (e.g. on Irix5). */ - -#define IN_SOLIB_CALL_TRAMPOLINE(pc, name) in_plt_section((pc), (name)) -extern int in_plt_section PARAMS ((CORE_ADDR, char *)); - -/* If PC is in a shared library trampoline code, return the PC - where the function itself actually starts. If not, return 0. */ - -#define SKIP_TRAMPOLINE_CODE(pc) find_solib_trampoline_target (pc) - -/* It is unknown which, if any, SVR4 assemblers do not accept dollar signs - in identifiers. The default in G++ is to use dots instead, for all SVR4 - systems, so we make that our default also. FIXME: There should be some - way to get G++ to tell us what CPLUS_MARKER it is using, perhaps by - stashing it in the debugging information as part of the name of an - invented symbol ("gcc_cplus_marker$" for example). */ - -#undef CPLUS_MARKER -#define CPLUS_MARKER '.' diff --git a/contrib/gdb/gdb/config/xm-aix4.h b/contrib/gdb/gdb/config/xm-aix4.h deleted file mode 100644 index 31bb6da..0000000 --- a/contrib/gdb/gdb/config/xm-aix4.h +++ /dev/null @@ -1,96 +0,0 @@ -/* Parameters for hosting on an PowerPC, for GDB, the GNU debugger. - Copyright 1995 Free Software Foundation, Inc. - Contributed by Cygnus Corporation. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* The following text is taken from config/rs6000.mh: - * # The IBM version of /usr/include/rpc/rpc.h has a bug -- it says - * # `extern fd_set svc_fdset;' without ever defining the type fd_set. - * # Unfortunately this occurs in the vx-share code, which is not configured - * # like the rest of GDB (e.g. it doesn't include "defs.h"). - * # We circumvent this bug by #define-ing fd_set here, but undefining it in - * # the xm-rs6000.h file before ordinary modules try to use it. FIXME, IBM! - * MH_CFLAGS='-Dfd_set=int' - * So, here we do the undefine...which has to occur before we include - * below. - */ -#undef fd_set - -#include - -/* Big end is at the low address */ - -#define HOST_BYTE_ORDER BIG_ENDIAN - -/* At least as of AIX 3.2, we have termios. */ -#define HAVE_TERMIOS 1 -/* #define HAVE_TERMIO 1 */ - -#define USG 1 -#define HAVE_SIGSETMASK 1 - -#define FIVE_ARG_PTRACE - -/* AIX declares the mem functions differently than defs.h does. AIX is - right, but defs.h works on more old systems. For now, override it. */ - -#define MEM_FNS_DECLARED 1 - -/* This system requires that we open a terminal with O_NOCTTY for it to - not become our controlling terminal. */ - -#define USE_O_NOCTTY - -/* Brain death inherited from PC's pervades. */ -#undef NULL -#define NULL 0 - -/* The IBM compiler requires this in order to properly compile alloca(). */ -#pragma alloca - -/* There is no vfork. */ - -#define vfork fork - -/* Signal handler for SIGWINCH `window size changed'. */ - -#define SIGWINCH_HANDLER aix_resizewindow -extern void aix_resizewindow (); - -/* `lines_per_page' and `chars_per_line' are local to utils.c. Rectify this. */ - -#define SIGWINCH_HANDLER_BODY \ - \ -/* Respond to SIGWINCH `window size changed' signal, and reset GDB's \ - window settings approproatelt. */ \ - \ -void \ -aix_resizewindow () \ -{ \ - int fd = fileno (stdout); \ - if (isatty (fd)) { \ - int val; \ - \ - val = atoi (termdef (fd, 'l')); \ - if (val > 0) \ - lines_per_page = val; \ - val = atoi (termdef (fd, 'c')); \ - if (val > 0) \ - chars_per_line = val; \ - } \ -} diff --git a/contrib/gdb/gdb/config/xm-lynx.h b/contrib/gdb/gdb/config/xm-lynx.h deleted file mode 100644 index 6f19abd..0000000 --- a/contrib/gdb/gdb/config/xm-lynx.h +++ /dev/null @@ -1,22 +0,0 @@ -/* Host-dependent definitions for any CPU running LynxOS. - Copyright 1993 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* for INT_MIN, to avoid "INT_MIN redefined" warnings from defs.h */ - -#include diff --git a/contrib/gdb/gdb/config/xm-mpw.h b/contrib/gdb/gdb/config/xm-mpw.h deleted file mode 100644 index 0c473d7..0000000 --- a/contrib/gdb/gdb/config/xm-mpw.h +++ /dev/null @@ -1,81 +0,0 @@ -/* Macro definitions for running GDB on Apple Macintoshes. - Copyright (C) 1994, 1995 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "mpw.h" - -#include "fopen-bin.h" - -#include "spin.h" - -#define CANT_FORK - -/* Map these standard functions to versions that can do I/O in a console - window. */ - -#define printf hacked_printf -#define fprintf hacked_fprintf -#define vprintf hacked_vfprintf -#define fputs hacked_fputs -#define fputc hacked_fputc -#undef putc -#define putc hacked_putc -#define fflush hacked_fflush - -#define fgetc hacked_fgetc - -#define POSIX_UTIME - -/* No declaration of strdup in MPW's string.h, oddly enough. */ - -char *strdup (char *s1); - -/* '.' indicates drivers on the Mac, so we need a different filename. */ - -#define GDBINIT_FILENAME "_gdbinit" - -/* Commas are more common to separate dirnames in a path on Macs. */ - -#define DIRNAME_SEPARATOR ',' - -/* This is a real crufty hack. */ - -#define HAVE_TERMIO - -/* Addons to the basic MPW-supported signal list. */ - -#ifndef SIGQUIT -#define SIGQUIT (1<<6) -#endif -#ifndef SIGHUP -#define SIGHUP (1<<7) -#endif - -/* If __STDC__ is on, then this definition will be missing. */ - -#ifndef fileno -#define fileno(p) (p)->_file -#endif - -#ifndef R_OK -#define R_OK 4 -#endif - -extern int StandAlone; - -extern int mac_app; diff --git a/contrib/gdb/gdb/config/xm-nbsd.h b/contrib/gdb/gdb/config/xm-nbsd.h deleted file mode 100644 index 5d52270..0000000 --- a/contrib/gdb/gdb/config/xm-nbsd.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Host-dependent definitions for any CPU running NetBSD. - Copyright 1993, 1994 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. */ - -/* We have to include these files now, so that GDB will not make - competing definitions in defs.h. */ -#include - -#include -#if BYTE_ORDER == BIG_ENDIAN -#define HOST_BYTE_ORDER BIG_ENDIAN -#else -#define HOST_BYTE_ORDER LITTLE_ENDIAN -#endif - -/* NetBSD has termios facilities. */ -#define HAVE_TERMIOS - -#if 0 -#define CC_HAS_LONG_LONG 1 -#define PRINTF_HAS_LONG_LONG 1 -#endif diff --git a/contrib/gdb/gdb/config/xm-sysv4.h b/contrib/gdb/gdb/config/xm-sysv4.h deleted file mode 100644 index 1ffe8fa..0000000 --- a/contrib/gdb/gdb/config/xm-sysv4.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Definitions for running gdb on a host machine running any flavor of SVR4. - Copyright 1991, 1992 Free Software Foundation, Inc. - Written by Fred Fish at Cygnus Support (fnf@cygnus.com). - -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. */ - -/* SVR4 has termios facilities. */ - -#undef HAVE_TERMIO -#define HAVE_TERMIOS - -/* SVR4 is a derivative of System V Release 3 (USG) */ - -#define USG - -/* Use setpgid(0,0) to run inferior in a separate process group */ - -#define NEED_POSIX_SETPGID - -/* We have to include these files now, so that GDB will not make - competing definitions in defs.h. */ -#include diff --git a/contrib/gdb/gdb/core-regset.c b/contrib/gdb/gdb/core-regset.c deleted file mode 100644 index 68b0845..0000000 --- a/contrib/gdb/gdb/core-regset.c +++ /dev/null @@ -1,130 +0,0 @@ -/* Machine independent GDB support for core files on systems using "regsets". - Copyright 1993-1996 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - - -/* N O T E S - -This file is used by most systems that implement /proc. For these systems, -the general registers are laid out the same way in both the core file and -the gregset_p structure. The current exception to this is Irix-4.*, where -the gregset_p structure is split up into two pieces in the core file. - -The general register and floating point register sets are manipulated by -separate ioctl's. This file makes the assumption that if FP0_REGNUM is -defined, then support for the floating point register set is desired, -regardless of whether or not the actual target has floating point hardware. - - */ - -#include "defs.h" - -#include -#ifdef HAVE_SYS_PROCFS_H -#include -#endif -#include -#include -#include "gdb_string.h" - -#include "inferior.h" -#include "target.h" -#include "command.h" -#include "gdbcore.h" - -/* - -GLOBAL FUNCTION - - fetch_core_registers -- fetch current registers from core file - -SYNOPSIS - - void fetch_core_registers (char *core_reg_sect, - unsigned core_reg_size, - int which, unsigned in reg_addr) - -DESCRIPTION - - Read the values of either the general register set (WHICH equals 0) - or the floating point register set (WHICH equals 2) from the core - file data (pointed to by CORE_REG_SECT), and update gdb's idea of - their current values. The CORE_REG_SIZE parameter is ignored. - -NOTES - - Use the indicated sizes to validate the gregset and fpregset - structures. -*/ - -static void -fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr) - char *core_reg_sect; - unsigned core_reg_size; - int which; - unsigned int reg_addr; /* Unused in this version */ -{ -#if defined (HAVE_GREGSET_T) && defined (HAVE_FPREGSET_T) - gregset_t gregset; - fpregset_t fpregset; - - if (which == 0) - { - if (core_reg_size != sizeof (gregset)) - { - warning ("wrong size gregset struct in core file"); - } - else - { - memcpy ((char *) &gregset, core_reg_sect, sizeof (gregset)); - supply_gregset (&gregset); - } - } - else if (which == 2) - { - if (core_reg_size != sizeof (fpregset)) - { - warning ("wrong size fpregset struct in core file"); - } - else - { - memcpy ((char *) &fpregset, core_reg_sect, sizeof (fpregset)); -#if defined (FP0_REGNUM) - supply_fpregset (&fpregset); -#endif - } - } -#endif /* defined(HAVE_GREGSET_T) && defined (HAVE_FPREGSET_T) */ -} - - -/* Register that we are able to handle ELF file formats using standard - procfs "regset" structures. */ - -static struct core_fns regset_core_fns = -{ - bfd_target_elf_flavour, - fetch_core_registers, - NULL -}; - -void -_initialize_core_regset () -{ - add_core_fns (®set_core_fns); -} diff --git a/contrib/gdb/gdb/core-sol2.c b/contrib/gdb/gdb/core-sol2.c deleted file mode 100644 index 5f43002..0000000 --- a/contrib/gdb/gdb/core-sol2.c +++ /dev/null @@ -1,133 +0,0 @@ -/* Machine independent support for Solaris 2 core files for GDB. - Copyright 1994 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. */ - - -/* Solaris comes with two flavours of core files, cores generated by - an ELF executable and cores generated by programs that were - run under BCP (the part of Solaris which allows it to run SunOS4 - a.out files). - This file combines the core register fetching from core-regset.c - and sparc-nat.c to be able to read both flavours. */ - -#include "defs.h" -#undef gregset_t -#undef fpregset_t - -#include -#include -#include -#include -#include -#include "gdb_string.h" - -#include "inferior.h" -#include "target.h" -#include "command.h" -#include "gdbcore.h" - -static void -fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr) - char *core_reg_sect; - unsigned core_reg_size; - int which; - unsigned int reg_addr; /* Unused in this version */ -{ - prgregset_t prgregset; - prfpregset_t prfpregset; - - if (which == 0) - { - if (core_reg_size == sizeof (prgregset)) - { - memcpy ((char *) &prgregset, core_reg_sect, sizeof (prgregset)); - supply_gregset (&prgregset); - } - else if (core_reg_size == sizeof (struct regs)) - { -#define gregs ((struct regs *)core_reg_sect) - /* G0 *always* holds 0. */ - *(int *)®isters[REGISTER_BYTE (0)] = 0; - - /* The globals and output registers. */ - memcpy (®isters[REGISTER_BYTE (G1_REGNUM)], &gregs->r_g1, - 15 * REGISTER_RAW_SIZE (G1_REGNUM)); - *(int *)®isters[REGISTER_BYTE (PS_REGNUM)] = gregs->r_ps; - *(int *)®isters[REGISTER_BYTE (PC_REGNUM)] = gregs->r_pc; - *(int *)®isters[REGISTER_BYTE (NPC_REGNUM)] = gregs->r_npc; - *(int *)®isters[REGISTER_BYTE (Y_REGNUM)] = gregs->r_y; - - /* My best guess at where to get the locals and input - registers is exactly where they usually are, right above - the stack pointer. If the core dump was caused by a bus error - from blowing away the stack pointer (as is possible) then this - won't work, but it's worth the try. */ - { - int sp; - - sp = *(int *)®isters[REGISTER_BYTE (SP_REGNUM)]; - if (0 != target_read_memory (sp, - ®isters[REGISTER_BYTE (L0_REGNUM)], - 16 * REGISTER_RAW_SIZE (L0_REGNUM))) - { - warning ("couldn't read input and local registers from core file\n"); - } - } - } - else - { - warning ("wrong size gregset struct in core file"); - } - } - else if (which == 2) - { - if (core_reg_size == sizeof (prfpregset)) - { - memcpy ((char *) &prfpregset, core_reg_sect, sizeof (prfpregset)); - supply_fpregset (&prfpregset); - } - else if (core_reg_size >= sizeof (struct fpu)) - { -#define fpuregs ((struct fpu *) core_reg_sect) - memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)], &fpuregs->fpu_fr, - sizeof (fpuregs->fpu_fr)); - memcpy (®isters[REGISTER_BYTE (FPS_REGNUM)], &fpuregs->fpu_fsr, - sizeof (FPU_FSR_TYPE)); - } - else - { - warning ("wrong size fpregset struct in core file"); - } - } -} - - -/* Register that we are able to handle solaris core file formats. */ - -static struct core_fns solaris_core_fns = -{ - bfd_target_elf_flavour, - fetch_core_registers, - NULL -}; - -void -_initialize_core_solaris () -{ - add_core_fns (&solaris_core_fns); -} diff --git a/contrib/gdb/gdb/cpu32bug-rom.c b/contrib/gdb/gdb/cpu32bug-rom.c deleted file mode 100644 index 43f76f6..0000000 --- a/contrib/gdb/gdb/cpu32bug-rom.c +++ /dev/null @@ -1,171 +0,0 @@ -/* Remote debugging interface for CPU32Bug Rom monitor for GDB, the GNU debugger. - Copyright 1995 Free Software Foundation, Inc. - - Written by Stu Grossman of Cygnus Support - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without 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 "target.h" -#include "monitor.h" -#include "serial.h" - -static void cpu32bug_open PARAMS ((char *args, int from_tty)); - -static void -cpu32bug_supply_register (regname, regnamelen, val, vallen) - char *regname; - int regnamelen; - char *val; - int vallen; -{ - int regno; - - if (regnamelen != 2) - return; - - switch (regname[0]) - { - case 'S': - if (regname[1] != 'R') - return; - regno = PS_REGNUM; - break; - case 'P': - if (regname[1] != 'C') - return; - regno = PC_REGNUM; - break; - case 'D': - if (regname[1] < '0' || regname[1] > '7') - return; - regno = regname[1] - '0' + D0_REGNUM; - break; - case 'A': - if (regname[1] < '0' || regname[1] > '7') - return; - regno = regname[1] - '0' + A0_REGNUM; - break; - default: - return; - } - - monitor_supply_register (regno, val); -} - -/* - * This array of registers needs to match the indexes used by GDB. The - * whole reason this exists is because the various ROM monitors use - * different names than GDB does, and don't support all the - * registers either. So, typing "info reg sp" becomes an "A7". - */ - -static char *cpu32bug_regnames[NUM_REGS] = -{ - "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7", - "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", - "SR", "PC", -}; - -/* - * Define the monitor command strings. Since these are passed directly - * through to a printf style function, we need can include formatting - * strings. We also need a CR or LF on the end. - */ - -static struct target_ops cpu32bug_ops; - -static char *cpu32bug_inits[] = {"\r", NULL}; - -static struct monitor_ops cpu32bug_cmds = -{ - MO_CLR_BREAK_USES_ADDR, - cpu32bug_inits, /* Init strings */ - "g\r", /* continue command */ - "t\r", /* single step */ - NULL, /* interrupt command */ - "br %x\r", /* set a breakpoint */ - "nobr %x\r", /* clear a breakpoint */ - "nobr\r", /* clear all breakpoints */ - "bf %x:%x %x;b\r", /* fill (start count val) */ - { - "ms %x %02x\r", /* setmem.cmdb (addr, value) */ - "ms %x %04x\r", /* setmem.cmdw (addr, value) */ - "ms %x %08x\r", /* setmem.cmdl (addr, value) */ - NULL, /* setmem.cmdll (addr, value) */ - NULL, /* setreg.resp_delim */ - NULL, /* setreg.term */ - NULL, /* setreg.term_cmd */ - }, - { - "md %x:%x;b\r", /* getmem.cmdb (addr, len) */ - "md %x:%x;b\r", /* getmem.cmdw (addr, len) */ - "md %x:%x;b\r", /* getmem.cmdl (addr, len) */ - NULL, /* getmem.cmdll (addr, len) */ - " ", /* getmem.resp_delim */ - NULL, /* getmem.term */ - NULL, /* getmem.term_cmd */ - }, - { - "rs %s %x\r", /* setreg.cmd (name, value) */ - NULL, /* setreg.resp_delim */ - NULL, /* setreg.term */ - NULL /* setreg.term_cmd */ - }, - { - "rs %s\r", /* getreg.cmd (name) */ - "=", /* getreg.resp_delim */ - NULL, /* getreg.term */ - NULL /* getreg.term_cmd */ - }, - "rd\r", /* dump_registers */ - "\\(\\w+\\) +=\\([0-9a-fA-F]+\\b\\)", /* register_pattern */ - cpu32bug_supply_register, /* supply_register */ - NULL, /* load_routine (defaults to SRECs) */ - "lo\r", /* download command */ - "lo\r\n", /* load response */ - "CPU32Bug>", /* monitor command prompt */ - "\r", /* end-of-line terminator */ - NULL, /* optional command terminator */ - &cpu32bug_ops, /* target operations */ - SERIAL_1_STOPBITS, /* number of stop bits */ - cpu32bug_regnames, /* registers names */ - MONITOR_OPS_MAGIC /* magic */ - }; - -static void -cpu32bug_open(args, from_tty) - char *args; - int from_tty; -{ - monitor_open (args, &cpu32bug_cmds, from_tty); -} - -void -_initialize_cpu32bug_rom () -{ - init_monitor_ops (&cpu32bug_ops); - - cpu32bug_ops.to_shortname = "cpu32bug"; - cpu32bug_ops.to_longname = "CPU32Bug monitor"; - cpu32bug_ops.to_doc = "Debug via the CPU32Bug monitor.\n\ -Specify the serial device it is connected to (e.g. /dev/ttya)."; - cpu32bug_ops.to_open = cpu32bug_open; - - add_target (&cpu32bug_ops); -} diff --git a/contrib/gdb/gdb/cxux-nat.c b/contrib/gdb/gdb/cxux-nat.c deleted file mode 100644 index 2ed1430..0000000 --- a/contrib/gdb/gdb/cxux-nat.c +++ /dev/null @@ -1,523 +0,0 @@ -/* Native support for Motorola 88k running Harris CX/UX. - Copyright 1988, 1990, 1991, 1992, 1993, 1994 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 "frame.h" -#include "inferior.h" - -#include -#include -#include -#include -#include "gdbcore.h" -#include - -#include "bfd.h" -#include "symfile.h" -#include "objfiles.h" -#include "symtab.h" - -#ifndef USER /* added to support BCS ptrace_user */ -#define USER ptrace_user -#endif -#include -#include -#include -#include "gdb_stat.h" - -#include "symtab.h" -#include "setjmp.h" -#include "value.h" - -#include - -/* CX/UX provides them already, but as word offsets instead of char offsets */ -#define SXIP_OFFSET (PT_SXIP * 4) -#define SNIP_OFFSET (PT_SNIP * 4) -#define SFIP_OFFSET (PT_SFIP * 4) -#define PSR_OFFSET (PT_PSR * sizeof(int)) -#define FPSR_OFFSET (PT_FPSR * sizeof(int)) -#define FPCR_OFFSET (PT_FPCR * sizeof(int)) - -#define XREGADDR(r) (((char *)&u.pt_x0-(char *)&u) + \ - ((r)-X0_REGNUM)*sizeof(X_REGISTER_RAW_TYPE)) - -extern int have_symbol_file_p(); - -extern jmp_buf stack_jmp; - -extern int errno; -extern char registers[REGISTER_BYTES]; - -void -fetch_inferior_registers (regno) - int regno; /* Original value discarded */ -{ - register unsigned int regaddr; - char buf[MAX_REGISTER_RAW_SIZE]; - register int i; - - struct USER u; - unsigned int offset; - - offset = (char *) &u.pt_r0 - (char *) &u; - regaddr = offset; /* byte offset to r0;*/ - -/* offset = ptrace (3, inferior_pid, (PTRACE_ARG3_TYPE) offset, 0) - KERNEL_U_ADDR; */ - for (regno = 0; regno < PC_REGNUM; regno++) - { - /*regaddr = register_addr (regno, offset);*/ - /* 88k enhancement */ - - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) - { - *(int *) &buf[i] = ptrace (3, inferior_pid, - (PTRACE_ARG3_TYPE) regaddr, 0); - regaddr += sizeof (int); - } - supply_register (regno, buf); - } - /* now load up registers 32-37; special pc registers */ - *(int *) &buf[0] = ptrace (3, inferior_pid, - (PTRACE_ARG3_TYPE) PSR_OFFSET,0); - supply_register (PSR_REGNUM, buf); - *(int *) &buf[0] = ptrace (3, inferior_pid, - (PTRACE_ARG3_TYPE) FPSR_OFFSET,0); - supply_register (FPSR_REGNUM, buf); - *(int *) &buf[0] = ptrace (3, inferior_pid, - (PTRACE_ARG3_TYPE) FPCR_OFFSET,0); - supply_register (FPCR_REGNUM, buf); - *(int *) &buf[0] = ptrace (3,inferior_pid, - (PTRACE_ARG3_TYPE) SXIP_OFFSET ,0); - supply_register (SXIP_REGNUM, buf); - *(int *) &buf[0] = ptrace (3, inferior_pid, - (PTRACE_ARG3_TYPE) SNIP_OFFSET,0); - supply_register (SNIP_REGNUM, buf); - *(int *) &buf[0] = ptrace (3, inferior_pid, - (PTRACE_ARG3_TYPE) SFIP_OFFSET,0); - supply_register (SFIP_REGNUM, buf); - - if (target_is_m88110) - { - for (regaddr = XREGADDR(X0_REGNUM), regno = X0_REGNUM; - regno < NUM_REGS; - regno++, regaddr += 16) - { - X_REGISTER_RAW_TYPE xval; - - *(int *) &xval.w1 = ptrace (3, inferior_pid, - (PTRACE_ARG3_TYPE) regaddr, 0); - *(int *) &xval.w2 = ptrace (3, inferior_pid, - (PTRACE_ARG3_TYPE) (regaddr+4), 0); - *(int *) &xval.w3 = ptrace (3, inferior_pid, - (PTRACE_ARG3_TYPE) (regaddr+8), 0); - *(int *) &xval.w4 = ptrace (3, inferior_pid, - (PTRACE_ARG3_TYPE) (regaddr+12), 0); - supply_register(regno, (void *)&xval); - } - } -} - -/* Store our register values back into the inferior. - If REGNO is -1, do this for all registers. - Otherwise, REGNO specifies which register (so we can save time). */ - -void -store_inferior_registers (regno) - int regno; -{ - register unsigned int regaddr; - char buf[80]; - - struct USER u; - - unsigned int offset = (char *) &u.pt_r0 - (char *) &u; - - regaddr = offset; - - /* Don't try to deal with EXIP_REGNUM or ENIP_REGNUM, because I think either - svr3 doesn't run on an 88110, or the kernel isolates the different (not - completely sure this is true, but seems to be. */ - if (regno >= 0) - { - /* regaddr = register_addr (regno, offset); */ - if (regno < PC_REGNUM) - { - regaddr = offset + regno * sizeof (int); - errno = 0; - ptrace (6, inferior_pid, - (PTRACE_ARG3_TYPE) regaddr, read_register (regno)); - if (errno != 0) - { - sprintf (buf, "writing register number %d", regno); - perror_with_name (buf); - } - } - else if (regno == PSR_REGNUM) - ptrace (6, inferior_pid, - (PTRACE_ARG3_TYPE) PSR_OFFSET, read_register(regno)); - else if (regno == FPSR_REGNUM) - ptrace (6, inferior_pid, - (PTRACE_ARG3_TYPE) FPSR_OFFSET, read_register(regno)); - else if (regno == FPCR_REGNUM) - ptrace (6, inferior_pid, - (PTRACE_ARG3_TYPE) FPCR_OFFSET, read_register(regno)); - else if (regno == SXIP_REGNUM) - ptrace (6, inferior_pid, - (PTRACE_ARG3_TYPE) SXIP_OFFSET, read_register(regno)); - else if (regno == SNIP_REGNUM) - ptrace (6, inferior_pid, - (PTRACE_ARG3_TYPE) SNIP_OFFSET, read_register(regno)); - else if (regno == SFIP_REGNUM) - ptrace (6, inferior_pid, - (PTRACE_ARG3_TYPE) SFIP_OFFSET, read_register(regno)); - else if (target_is_m88110 && regno < NUM_REGS) - { - X_REGISTER_RAW_TYPE xval; - - read_register_bytes(REGISTER_BYTE(regno), (char *)&xval, - sizeof(X_REGISTER_RAW_TYPE)); - regaddr = XREGADDR(regno); - ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, xval.w1); - ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) regaddr+4, xval.w2); - ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) regaddr+8, xval.w3); - ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) regaddr+12, xval.w4); - } - else - printf_unfiltered ("Bad register number for store_inferior routine\n"); - } - else - { - for (regno = 0; regno < PC_REGNUM; regno++) - { - /* regaddr = register_addr (regno, offset); */ - errno = 0; - regaddr = offset + regno * sizeof (int); - ptrace (6, inferior_pid, - (PTRACE_ARG3_TYPE) regaddr, read_register (regno)); - if (errno != 0) - { - sprintf (buf, "writing register number %d", regno); - perror_with_name (buf); - } - } - ptrace (6, inferior_pid, - (PTRACE_ARG3_TYPE) PSR_OFFSET, read_register(regno)); - ptrace (6, inferior_pid, - (PTRACE_ARG3_TYPE) FPSR_OFFSET,read_register(regno)); - ptrace (6, inferior_pid, - (PTRACE_ARG3_TYPE) FPCR_OFFSET,read_register(regno)); - ptrace (6,inferior_pid, - (PTRACE_ARG3_TYPE) SXIP_OFFSET,read_register(SXIP_REGNUM)); - ptrace (6,inferior_pid, - (PTRACE_ARG3_TYPE) SNIP_OFFSET,read_register(SNIP_REGNUM)); - ptrace (6,inferior_pid, - (PTRACE_ARG3_TYPE) SFIP_OFFSET,read_register(SFIP_REGNUM)); - if (target_is_m88110) - { - for (regno = X0_REGNUM; regno < NUM_REGS; regno++) - { - X_REGISTER_RAW_TYPE xval; - - read_register_bytes(REGISTER_BYTE(regno), (char *)&xval, - sizeof(X_REGISTER_RAW_TYPE)); - regaddr = XREGADDR(regno); - ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, xval.w1); - ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) (regaddr+4), xval.w2); - ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) (regaddr+8), xval.w3); - ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) (regaddr+12), xval.w4); - } - } - } -} - -/* blockend is the address of the end of the user structure */ - -m88k_register_u_addr (blockend, regnum) - int blockend, regnum; -{ - struct USER u; - int ustart = blockend - sizeof (struct USER); - - if (regnum < PSR_REGNUM) - return (ustart + ((int) &u.pt_r0 - (int) &u) + - REGISTER_SIZE * regnum); - else if (regnum == PSR_REGNUM) - return (ustart + ((int) &u.pt_psr) - (int) &u); - else if (regnum == FPSR_REGNUM) - return (ustart + ((int) &u.pt_fpsr) - (int) &u); - else if (regnum == FPCR_REGNUM) - return (ustart + ((int) &u.pt_fpcr) - (int) &u); - else if (regnum == SXIP_REGNUM) - return (ustart + SXIP_OFFSET); - else if (regnum == SNIP_REGNUM) - return (ustart + SNIP_OFFSET); - else if (regnum == SFIP_REGNUM) - return (ustart + SFIP_OFFSET); - else if (target_is_m88110) - return (ustart + ((int) &u.pt_x0 - (int) &u) + /* Must be X register */ - sizeof(u.pt_x0) * (regnum - X0_REGNUM)); - else - return (blockend + REGISTER_SIZE * regnum); -} - -#ifdef USE_PROC_FS - -#include - -/* Given a pointer to a general register set in /proc format (gregset_t *), - unpack the register contents and supply them as gdb's idea of the current - register values. */ - -void -supply_gregset (gregsetp) - gregset_t *gregsetp; -{ - register int regi; - register greg_t *regp = (greg_t *) gregsetp; - - for (regi=0; regi <= SP_REGNUM; regi++) - supply_register (regi, (char *) (regp + regi)); - - supply_register (SXIP_REGNUM, (char *) (regp + R_XIP)); - supply_register (SNIP_REGNUM, (char *) (regp + R_NIP)); - supply_register (SFIP_REGNUM, (char *) (regp + R_FIP)); - supply_register (PSR_REGNUM, (char *) (regp + R_PSR)); - supply_register (FPSR_REGNUM, (char *) (regp + R_FPSR)); - supply_register (FPCR_REGNUM, (char *) (regp + R_FPCR)); -} - -void -fill_gregset (gregsetp, regno) - gregset_t *gregsetp; - int regno; -{ - int regi; - register greg_t *regp = (greg_t *) gregsetp; - extern char registers[]; - - for (regi = 0 ; regi <= R_R31 ; regi++) - if ((regno == -1) || (regno == regi)) - *(regp + regi) = *(int *) ®isters[REGISTER_BYTE(regi)]; - - if ((regno == -1) || (regno == SXIP_REGNUM)) - *(regp + R_XIP) = *(int *) ®isters[REGISTER_BYTE(SXIP_REGNUM)]; - if ((regno == -1) || (regno == SNIP_REGNUM)) - *(regp + R_NIP) = *(int *) ®isters[REGISTER_BYTE(SNIP_REGNUM)]; - if ((regno == -1) || (regno == SFIP_REGNUM)) - *(regp + R_FIP) = *(int *) ®isters[REGISTER_BYTE(SFIP_REGNUM)]; - if ((regno == -1) || (regno == PSR_REGNUM)) - *(regp + R_PSR) = *(int *) ®isters[REGISTER_BYTE(PSR_REGNUM)]; - if ((regno == -1) || (regno == FPSR_REGNUM)) - *(regp + R_FPSR) = *(int *) ®isters[REGISTER_BYTE(FPSR_REGNUM)]; - if ((regno == -1) || (regno == FPCR_REGNUM)) - *(regp + R_FPCR) = *(int *) ®isters[REGISTER_BYTE(FPCR_REGNUM)]; -} - -#endif /* USE_PROC_FS */ - -/* This support adds the equivalent of adb's % command. When - the `add-shared-symbol-files' command is given, this routine scans - the dynamic linker's link map and reads the minimal symbols - from each shared object file listed in the map. */ - -struct link_map { - unsigned long l_addr; /* address at which object is mapped */ - char *l_name; /* full name of loaded object */ - void *l_ld; /* dynamic structure of object */ - struct link_map *l_next; /* next link object */ - struct link_map *l_prev; /* previous link object */ -}; - -#define LINKS_MAP_POINTER "_ld_tail" -#define LIBC_FILE "/usr/lib/libc.so.1" -#define SHARED_OFFSET 0xf0001000 - -#ifndef PATH_MAX -#define PATH_MAX 1023 /* maximum size of path name on OS */ -#endif - -void -add_shared_symbol_files () -{ - void *desc; - struct link_map *ld_map, *lm, lms; - struct minimal_symbol *minsym; - struct objfile *objfile; - char *path_name; - - if (! inferior_pid) - { - warning ("The program has not yet been started."); - return; - } - - objfile = symbol_file_add (LIBC_FILE, 0, 0, 0, 0, 1); - minsym = lookup_minimal_symbol (LINKS_MAP_POINTER, objfile); - - ld_map = (struct link_map *) - read_memory_integer (((int)SYMBOL_VALUE_ADDRESS(minsym) + SHARED_OFFSET), 4); - lm = ld_map; - while (lm) - { - int local_errno = 0; - - read_memory ((CORE_ADDR)lm, (char*)&lms, sizeof (struct link_map)); - if (lms.l_name) - { - if (target_read_string ((CORE_ADDR)lms.l_name, &path_name, - PATH_MAX, &local_errno)) - { - symbol_file_add (path_name, 1, lms.l_addr, 0, 0, 0); - free(path_name); - } - } - /* traverse links in reverse order so that we get the - the symbols the user actually gets. */ - lm = lms.l_prev; - } - - /* Getting new symbols may change our opinion about what is - frameless. */ - reinit_frame_cache (); -} - -#if defined(_ES_MP) - -#include - -unsigned int -m88k_harris_core_register_addr (regno, reg_ptr) - int regno, reg_ptr; -{ - unsigned int word_offset; - - switch (regno) - { - case PSR_REGNUM: - word_offset = R_EPSR; - break; - case FPSR_REGNUM: - word_offset = R_FPSR; - break; - case FPCR_REGNUM: - word_offset = R_FPCR; - break; - case SXIP_REGNUM: - word_offset = R_EXIP; - break; - case SNIP_REGNUM: - word_offset = R_ENIP; - break; - case SFIP_REGNUM: - word_offset = R_EFIP; - break; - default: - if (regno <= FP_REGNUM) - word_offset = regno; - else - word_offset = ((regno - X0_REGNUM) * 4); - } - return (word_offset * 4); -} - -#endif /* _ES_MP */ - -void -_initialize_m88k_nat() -{ -#ifdef _ES_MP - /* Enable 88110 support, as we don't support the 88100 under ES/MP. */ - - target_is_m88110 = 1; -#elif defined(_CX_UX) - /* Determine whether we're running on an 88100 or an 88110. */ - target_is_m88110 = (sinfo(SYSMACHINE,0) == SYS5800); -#endif /* _CX_UX */ -} - -#ifdef _ES_MP -/* Given a pointer to a general register set in /proc format (gregset_t *), - unpack the register contents and supply them as gdb's idea of the current - register values. */ - -void -supply_gregset (gregsetp) - gregset_t *gregsetp; -{ - register int regi; - register greg_t *regp = (greg_t *) gregsetp; - - for (regi = 0 ; regi < R_R31 ; regi++) - { - supply_register (regi, (char *) (regp + regi)); - } - supply_register (PSR_REGNUM, (char *) (regp + R_EPSR)); - supply_register (FPSR_REGNUM, (char *) (regp + R_FPSR)); - supply_register (FPCR_REGNUM, (char *) (regp + R_FPCR)); - supply_register (SXIP_REGNUM, (char *) (regp + R_EXIP)); - supply_register (SNIP_REGNUM, (char *) (regp + R_ENIP)); - supply_register (SFIP_REGNUM, (char *) (regp + R_EFIP)); -} - -/* Given a pointer to a floating point register set in /proc format - (fpregset_t *), unpack the register contents and supply them as gdb's - idea of the current floating point register values. */ - -void -supply_fpregset (fpregsetp) - fpregset_t *fpregsetp; -{ - register int regi; - char *from; - - for (regi = FP0_REGNUM ; regi <= FPLAST_REGNUM ; regi++) - { - from = (char *) &((*fpregsetp)[regi-FP0_REGNUM]); - supply_register (regi, from); - } -} - -#endif /* _ES_MP */ - -#ifdef _CX_UX - -#include - -unsigned int m88k_harris_core_register_addr(int regno, int reg_ptr) -{ - unsigned int word_offset; - - switch (regno) { - case PSR_REGNUM : word_offset = R_PSR; break; - case FPSR_REGNUM : word_offset = R_FPSR; break; - case FPCR_REGNUM : word_offset = R_FPCR; break; - case SXIP_REGNUM : word_offset = R_XIP; break; - case SNIP_REGNUM : word_offset = R_NIP; break; - case SFIP_REGNUM : word_offset = R_FIP; break; - default : - if (regno <= FP_REGNUM) - word_offset = regno; - else - word_offset = ((regno - X0_REGNUM) * 4) + R_X0; - } - return (word_offset * 4); -} - -#endif /* _CX_UX */ diff --git a/contrib/gdb/gdb/gnu-nat.c b/contrib/gdb/gdb/gnu-nat.c deleted file mode 100644 index 2d9cbed..0000000 --- a/contrib/gdb/gdb/gnu-nat.c +++ /dev/null @@ -1,2814 +0,0 @@ -/* Interface GDB to the GNU Hurd - Copyright (C) 1992, 1995, 1996 Free Software Foundation, Inc. - - This file is part of GDB. - - Written by Miles Bader - - Some code and ideas from m3-nat.c by Jukka Virtanen - - 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 -#include -#include -#include -#include -#include -#include - -/* We include this because we don't need the access macros and they conflict - with gdb's definitions (ick). This is very non standard! */ -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include "defs.h" -#include "inferior.h" -#include "symtab.h" -#include "value.h" -#include "language.h" -#include "target.h" -#include "wait.h" -#include "gdbcmd.h" -#include "gdbcore.h" - -#include "gnu-nat.h" - -#include "exc_request_S.h" -#include "notify_S.h" -#include "process_reply_S.h" -#include "msg_reply_S.h" - -#include "exc_request_U.h" -#include "msg_U.h" - -static process_t proc_server = MACH_PORT_NULL; - -/* If we've sent a proc_wait_request to the proc server, the pid of the - process we asked about. We can only ever have one outstanding. */ -int proc_wait_pid = 0; - -/* The number of wait requests we've sent, and expect replies from. */ -int proc_waits_pending = 0; - -int gnu_debug_flag = 0; - -/* Forward decls */ - -extern struct target_ops gnu_ops; - -struct inf *make_inf (); -void inf_clear_wait (struct inf *inf); -void inf_cleanup (struct inf *inf); -void inf_startup (struct inf *inf, int pid, task_t task); -int inf_update_suspends (struct inf *inf); -void inf_set_task (struct inf *inf, task_t port); -void inf_validate_procs (struct inf *inf); -void inf_steal_exc_ports (struct inf *inf); -void inf_restore_exc_ports (struct inf *inf); -int inf_update_procs (struct inf *inf); -struct proc *inf_tid_to_proc (struct inf *inf, int tid); -inline void inf_set_threads_resume_sc (struct inf *inf, struct proc - *run_thread, int run_others); -inline int inf_set_threads_resume_sc_for_signal_thread (struct inf *inf); -inline void inf_suspend (struct inf *inf); -inline void inf_resume (struct inf *inf); -void inf_set_step_thread (struct inf *inf, struct proc *proc); -void inf_detach (struct inf *inf); -void inf_attach (struct inf *inf, int pid); -void inf_signal (struct inf *inf, enum target_signal sig); - -#define inf_debug(_inf, msg, args...) \ - do { struct inf *__inf = (_inf); \ - debug ("{inf %d %p}: " msg, __inf->pid, __inf , ##args); } while (0) - -struct proc *make_proc (struct inf *inf, mach_port_t port, int tid); -struct proc *_proc_free (struct proc *proc); -int proc_update_sc (struct proc *proc); -void proc_abort (struct proc *proc, int force); -thread_state_t proc_get_state (struct proc *proc, int force); -error_t proc_get_exception_port (struct proc *proc, mach_port_t *port); -error_t proc_set_exception_port (struct proc *proc, mach_port_t port); -static mach_port_t _proc_get_exc_port (struct proc *proc); -void proc_steal_exc_port (struct proc *proc, mach_port_t exc_port); -void proc_restore_exc_port (struct proc *proc); -int proc_trace (struct proc *proc, int set); -char *proc_string (struct proc *proc); - -/* Evaluate RPC_EXPR in a scope with the variables MSGPORT and REFPORT bound - to INF's msg port and task port respectively. If it has no msg port, - EIEIO is returned. INF must refer to a running process! */ -#define INF_MSGPORT_RPC(inf, rpc_expr) \ - HURD_MSGPORT_RPC (proc_getmsgport (proc_server, inf->pid, &msgport), \ - (refport = inf->task->port, 0), 0, \ - msgport ? (rpc_expr) : EIEIO) - -/* Like INF_MSGPORT_RPC, but will also resume the signal thread to ensure - there's someone around to deal with the RPC (and resuspend things - afterwards). This effects INF's threads' resume_sc count. */ -#define INF_RESUME_MSGPORT_RPC(inf, rpc_expr) \ - (inf_set_threads_resume_sc_for_signal_thread (inf) \ - ? ({ error_t __e; \ - inf_resume (inf); \ - __e = INF_MSGPORT_RPC (inf, rpc_expr); \ - inf_suspend (inf); \ - __e; }) \ - : EIEIO) - -#define MIG_SERVER_DIED EMIG_SERVER_DIED /* XXX */ - -/* The state passed by an exception message. */ -struct exc_state -{ - int exception; /* The exception code */ - int code, subcode; - mach_port_t handler; /* The real exception port to handle this. */ - mach_port_t reply; /* The reply port from the exception call. */ -}; - -/* The results of the last wait an inf did. */ -struct inf_wait -{ - struct target_waitstatus status; /* The status returned to gdb. */ - struct exc_state exc; /* The exception that caused us to return. */ - struct proc *thread; /* The thread in question. */ - int suppress; /* Something trivial happened. */ -}; - -/* The state of an inferior. */ -struct inf -{ - /* Fields describing the current inferior. */ - - struct proc *task; /* The mach task. */ - struct proc *threads; /* A linked list of all threads in TASK. */ - - /* True if THREADS needn't be validated by querying the task. We assume that - we and the task in question are the only ones frobbing the thread list, - so as long as we don't let any code run, we don't have to worry about - THREADS changing. */ - int threads_up_to_date; - - pid_t pid; /* The real system PID. */ - - struct inf_wait wait; /* What to return from target_wait. */ - - /* One thread proc in INF may be in `single-stepping mode'. This is it. */ - struct proc *step_thread; - - /* The thread we think is the signal thread. */ - struct proc *signal_thread; - - mach_port_t event_port; /* Where we receive various msgs. */ - - /* True if we think at least one thread in the inferior could currently be - running. */ - int running : 1; - - /* True if the process has stopped (in the proc server sense). Note that - since a proc server `stop' leaves the signal thread running, the inf can - be RUNNING && STOPPED... */ - int stopped : 1; - - /* True if the inferior is traced. */ - int traced : 1; - - /* True if we shouldn't try waiting for the inferior, usually because we - can't for some reason. */ - int no_wait : 1; - - /* When starting a new inferior, we don't try to validate threads until all - the proper execs have been done. This is a count of how many execs we - expect to happen. */ - unsigned pending_execs; - - /* Fields describing global state */ - - /* The task suspend count used when gdb has control. This is normally 1 to - make things easier for us, but sometimes (like when attaching to vital - system servers) it may be desirable to let the task continue to run - (pausing individual threads as necessary). */ - int pause_sc; - - /* The initial values used for the run_sc and pause_sc of newly discovered - threads -- see the definition of those fields in struct proc. */ - int default_thread_run_sc; - int default_thread_pause_sc; - - /* True if the process should be traced when started/attached. Newly - started processes *must* be traced at first to exec them properly, but - if this is false, tracing is turned off as soon it has done so. */ - int want_signals; - - /* True if exceptions from the inferior process should be trapped. This - must be on to use breakpoints. */ - int want_exceptions; -}; - -int __proc_pid (struct proc *proc) -{ - return proc->inf->pid; -} - -/* Update PROC's real suspend count to match it's desired one. Returns true - if we think PROC is now in a runnable state. */ -int -proc_update_sc (struct proc *proc) -{ - int running; - int err = 0; - int delta = proc->sc - proc->cur_sc; - - if (delta) - proc_debug (proc, "sc: %d --> %d", proc->cur_sc, proc->sc); - - if (proc->sc == 0 && proc->state_changed) - /* Since PROC may start running, we must write back any state changes. */ - { - assert (proc_is_thread (proc)); - proc_debug (proc, "storing back changed thread state"); - err = thread_set_state (proc->port, THREAD_STATE_FLAVOR, - &proc->state, THREAD_STATE_SIZE); - if (! err) - proc->state_changed = 0; - } - - if (delta > 0) - while (delta-- > 0 && !err) - if (proc_is_task (proc)) - err = task_suspend (proc->port); - else - err = thread_suspend (proc->port); - else - while (delta++ < 0 && !err) - if (proc_is_task (proc)) - err = task_resume (proc->port); - else - err = thread_resume (proc->port); - - if (! err) - proc->cur_sc = proc->sc; - - /* If we got an error, then the task/thread has disappeared. */ - running = !err && proc->sc == 0; - - proc_debug (proc, "is %s", err ? "dead" : running ? "running" : "suspended"); - if (err) - proc_debug (proc, "err = %s", strerror (err)); - - if (running) - { - proc->aborted = 0; - proc->state_valid = proc->state_changed = 0; - proc->fetched_regs = 0; - } - - return running; -} - -/* Thread_abort is called on PROC if needed. PROC must be a thread proc. - If PROC is deemed `precious', then nothing is done unless FORCE is true. - In particular, a thread is precious if it's running (in which case forcing - it includes suspending it first), or if it has an exception pending. */ -void -proc_abort (struct proc *proc, int force) -{ - assert (proc_is_thread (proc)); - - if (! proc->aborted) - { - struct inf *inf = proc->inf; - int running = (proc->cur_sc == 0 && inf->task->cur_sc == 0); - - if (running && force) - { - proc->sc = 1; - inf_update_suspends (proc->inf); - running = 0; - warning ("Stopped %s.", proc_string (proc)); - } - else if (proc == inf->wait.thread && inf->wait.exc.reply && !force) - /* An exception is pending on PROC, which don't mess with. */ - running = 1; - - if (! running) - /* We only abort the thread if it's not actually running. */ - { - thread_abort (proc->port); - proc_debug (proc, "aborted"); - proc->aborted = 1; - } - else - proc_debug (proc, "not aborting"); - } -} - -/* Make sure that the state field in PROC is up to date, and return a pointer - to it, or 0 if something is wrong. If WILL_MODIFY is true, makes sure - that the thread is stopped and aborted first, and sets the state_changed - field in PROC to true. */ -thread_state_t -proc_get_state (struct proc *proc, int will_modify) -{ - int was_aborted = proc->aborted; - - proc_debug (proc, "updating state info%s", - will_modify ? " (with intention to modify)" : ""); - - proc_abort (proc, will_modify); - - if (! was_aborted && proc->aborted) - /* PROC's state may have changed since we last fetched it. */ - proc->state_valid = 0; - - if (! proc->state_valid) - { - mach_msg_type_number_t state_size = THREAD_STATE_SIZE; - error_t err = - thread_get_state (proc->port, THREAD_STATE_FLAVOR, - &proc->state, &state_size); - proc_debug (proc, "getting thread state"); - proc->state_valid = !err; - } - - if (proc->state_valid) - { - if (will_modify) - proc->state_changed = 1; - return &proc->state; - } - else - return 0; -} - -error_t -proc_get_exception_port (struct proc *proc, mach_port_t *port) -{ - if (proc_is_task (proc)) - return task_get_exception_port (proc->port, port); - else - return thread_get_exception_port (proc->port, port); -} - -error_t -proc_set_exception_port (struct proc *proc, mach_port_t port) -{ - proc_debug (proc, "setting exception port: %d", port); - if (proc_is_task (proc)) - return task_set_exception_port (proc->port, port); - else - return thread_set_exception_port (proc->port, port); -} - -/* Get PROC's exception port, cleaning up a bit if proc has died. */ -static mach_port_t -_proc_get_exc_port (struct proc *proc) -{ - mach_port_t exc_port; - error_t err = proc_get_exception_port (proc, &exc_port); - - if (err) - /* PROC must be dead. */ - { - if (proc->exc_port) - mach_port_deallocate (mach_task_self (), proc->exc_port); - proc->exc_port = MACH_PORT_NULL; - if (proc->saved_exc_port) - mach_port_deallocate (mach_task_self (), proc->saved_exc_port); - proc->saved_exc_port = MACH_PORT_NULL; - } - - return exc_port; -} - -/* Replace PROC's exception port with EXC_PORT, unless it's already been - done. Stash away any existing exception port so we can restore it later. */ -void -proc_steal_exc_port (struct proc *proc, mach_port_t exc_port) -{ - mach_port_t cur_exc_port = _proc_get_exc_port (proc); - - if (cur_exc_port) - { - error_t err; - - proc_debug (proc, "inserting exception port: %d", exc_port); - - if (cur_exc_port != exc_port) - /* Put in our exception port. */ - err = proc_set_exception_port (proc, exc_port); - - if (err || cur_exc_port == proc->exc_port) - /* We previously set the exception port, and it's still set. So we - just keep the old saved port which is what the proc set. */ - { - if (cur_exc_port) - mach_port_deallocate (mach_task_self (), cur_exc_port); - } - else - /* Keep a copy of PROC's old exception port so it can be restored. */ - { - if (proc->saved_exc_port) - mach_port_deallocate (mach_task_self (), proc->saved_exc_port); - proc->saved_exc_port = cur_exc_port; - } - - proc_debug (proc, "saved exception port: %d", proc->saved_exc_port); - - if (!err) - proc->exc_port = exc_port; - else - warning ("Error setting exception port for %s: %s", - proc_string (proc), strerror (err)); - } -} - -/* If we previously replaced PROC's exception port, put back what we found - there at the time, unless *our* exception port has since be overwritten, - in which case who knows what's going on. */ -void -proc_restore_exc_port (struct proc *proc) -{ - mach_port_t cur_exc_port = _proc_get_exc_port (proc); - - if (cur_exc_port) - { - error_t err = 0; - - proc_debug (proc, "restoring real exception port"); - - if (proc->exc_port == cur_exc_port) - /* Our's is still there. */ - err = proc_set_exception_port (proc, proc->saved_exc_port); - - if (proc->saved_exc_port) - mach_port_deallocate (mach_task_self (), proc->saved_exc_port); - proc->saved_exc_port = MACH_PORT_NULL; - - if (!err) - proc->exc_port = MACH_PORT_NULL; - else - warning ("Error setting exception port for %s: %s", - proc_string (proc), strerror (err)); - } -} - -/* Turns hardware tracing in PROC on or off when SET is true or fals, - respectively. Returns true on success. */ -int -proc_trace (struct proc *proc, int set) -{ - thread_state_t state = proc_get_state (proc, 1); - - if (! state) - return 0; /* the thread must be dead. */ - - proc_debug (proc, "tracing %s", set ? "on" : "off"); - - if (set) - { - /* XXX We don't get the exception unless the thread has its own - exception port???? */ - if (proc->exc_port == MACH_PORT_NULL) - proc_steal_exc_port (proc, proc->inf->event_port); - THREAD_STATE_SET_TRACED (state); - } - else - THREAD_STATE_CLEAR_TRACED (state); - - return 1; -} - -/* A variable from which to assign new TIDs. */ -static int next_thread_id = 1; - -/* Returns a new proc structure with the given fields. Also adds a - notification for PORT becoming dead to be sent to INF's notify port. */ -struct proc * -make_proc (struct inf *inf, mach_port_t port, int tid) -{ - error_t err; - mach_port_t prev_port = MACH_PORT_NULL; - struct proc *proc = malloc (sizeof (struct proc)); - - proc->port = port; - proc->tid = tid; - proc->inf = inf; - proc->next = 0; - proc->saved_exc_port = MACH_PORT_NULL; - proc->exc_port = MACH_PORT_NULL; - proc->sc = 0; - proc->cur_sc = 0; - proc->run_sc = inf->default_thread_run_sc; - proc->pause_sc = inf->default_thread_pause_sc; - proc->resume_sc = proc->run_sc; - proc->aborted = 0; - proc->state_valid = 0; - proc->state_changed = 0; - - proc_debug (proc, "is new"); - - /* Get notified when things die. */ - err = - mach_port_request_notification (mach_task_self(), port, - MACH_NOTIFY_DEAD_NAME, 1, - inf->event_port, - MACH_MSG_TYPE_MAKE_SEND_ONCE, - &prev_port); - if (err) - warning ("Couldn't request notification for port %d: %s", - port, strerror (err)); - else - { - proc_debug (proc, "notifications to: %d", inf->event_port); - if (prev_port != MACH_PORT_NULL) - mach_port_deallocate (mach_task_self (), prev_port); - } - - if (inf->want_exceptions) - if (proc_is_task (proc)) - /* Make the task exception port point to us. */ - proc_steal_exc_port (proc, inf->event_port); - else - /* Just clear thread exception ports -- they default to the task one. */ - proc_steal_exc_port (proc, MACH_PORT_NULL); - - return proc; -} - -/* Frees PROC and any resources it uses, and returns the value of PROC's next - field. */ -struct proc * -_proc_free (struct proc *proc) -{ - struct inf *inf = proc->inf; - struct proc *next = proc->next; - - proc_debug (proc, "freeing..."); - - if (proc == inf->step_thread) - /* Turn off single stepping. */ - inf_set_step_thread (inf, 0); - if (proc == inf->wait.thread) - inf_clear_wait (inf); - if (proc == inf->signal_thread) - inf->signal_thread = 0; - - if (proc->port != MACH_PORT_NULL) - { - if (proc->exc_port != MACH_PORT_NULL) - /* Restore the original exception port. */ - proc_restore_exc_port (proc); - if (proc->cur_sc != 0) - /* Resume the thread/task. */ - { - proc->sc = 0; - proc_update_sc (proc); - } - mach_port_deallocate (mach_task_self (), proc->port); - } - - free (proc); - return next; -} - -struct inf *make_inf () -{ - struct inf *inf = malloc (sizeof (struct inf)); - - if (!inf) - return 0; - - inf->task = 0; - inf->threads = 0; - inf->threads_up_to_date = 0; - inf->pid = 0; - inf->wait.status.kind = TARGET_WAITKIND_SPURIOUS; - inf->wait.thread = 0; - inf->wait.exc.handler = MACH_PORT_NULL; - inf->wait.exc.reply = MACH_PORT_NULL; - inf->step_thread = 0; - inf->signal_thread = 0; - inf->event_port = MACH_PORT_NULL; - inf->stopped = 0; - inf->running = 0; - inf->traced = 0; - inf->no_wait = 0; - inf->pending_execs = 0; - inf->pause_sc = 1; - inf->default_thread_run_sc = 0; - inf->default_thread_pause_sc = 0; - inf->want_signals = 1; /* By default */ - inf->want_exceptions = 1; /* By default */ - - return inf; -} - -void -inf_clear_wait (struct inf *inf) -{ - inf_debug (inf, "clearing wait"); - inf->wait.status.kind = TARGET_WAITKIND_SPURIOUS; - inf->wait.thread = 0; - inf->wait.suppress = 0; - if (inf->wait.exc.handler != MACH_PORT_NULL) - { - mach_port_deallocate (mach_task_self (), inf->wait.exc.handler); - inf->wait.exc.handler = MACH_PORT_NULL; - } - if (inf->wait.exc.reply != MACH_PORT_NULL) - { - mach_port_deallocate (mach_task_self (), inf->wait.exc.reply); - inf->wait.exc.reply = MACH_PORT_NULL; - } -} - -void -inf_cleanup (struct inf *inf) -{ - inf_debug (inf, "cleanup"); - - inf_clear_wait (inf); - - inf_set_task (inf, MACH_PORT_NULL); - inf->pid = 0; - inf->traced = 0; - inf->no_wait = 0; - inf->stopped = 0; - inf->running = 0; - inf->pending_execs = 0; - - if (inf->event_port) - { - mach_port_destroy (mach_task_self (), inf->event_port); - inf->event_port = MACH_PORT_NULL; - } -} - -void -inf_startup (struct inf *inf, int pid, task_t task) -{ - error_t err; - - inf_debug (inf, "startup: pid = %d, task = %d", pid, task); - - inf_cleanup (inf); - - /* Make the port on which we receive all events. */ - err = mach_port_allocate (mach_task_self (), - MACH_PORT_RIGHT_RECEIVE, &inf->event_port); - if (err) - error ("Error allocating event port: %s", strerror (err)); - - /* Make a send right for it, so we can easily copy it for other people. */ - mach_port_insert_right (mach_task_self (), inf->event_port, - inf->event_port, MACH_MSG_TYPE_MAKE_SEND); - - if (inf->pause_sc) - task_suspend (task); - - inf_set_task (inf, task); - - if (inf->task) - { - inf->pid = pid; - if (inf->pause_sc) - inf->task->sc = inf->task->cur_sc = 1; /* Reflect task_suspend above */ - } -} - -void -inf_set_task (struct inf *inf, mach_port_t port) -{ - struct proc *task = inf->task; - - inf_debug (inf, "setting task: %d", port); - - if (task && task->port != port) - { - inf->task = 0; - inf_validate_procs (inf); /* Trash all the threads. */ - _proc_free (task); /* And the task. */ - } - - if (port != MACH_PORT_NULL) - { - inf->task = make_proc (inf, port, PROC_TID_TASK); - inf->threads_up_to_date = 0; - } -} - -/* Validates INF's stopped field from the actual proc server state. */ -static void -inf_validate_stopped (struct inf *inf) -{ - char *noise; - mach_msg_type_number_t noise_len = 0; - struct procinfo *pi; - mach_msg_type_number_t pi_len = 0; - error_t err = - proc_getprocinfo (proc_server, inf->pid, 0, - (procinfo_t *)&pi, &pi_len, &noise, &noise_len); - - if (! err) - { - inf->stopped = !!(pi->state & PI_STOPPED); - vm_deallocate (mach_task_self (), (vm_address_t)pi, pi_len); - if (noise_len > 0) - vm_deallocate (mach_task_self (), (vm_address_t)noise, noise_len); - } -} - -/* Validates INF's task suspend count. */ -static void -inf_validate_task_sc (struct inf *inf) -{ - struct task_basic_info info; - mach_msg_type_number_t info_len = TASK_BASIC_INFO_COUNT; - error_t err = task_info (inf->task->port, TASK_BASIC_INFO, &info, &info_len); - if (! err) - { - if (inf->task->cur_sc < info.suspend_count) - warning ("Pid %d is suspended; continuing will clear existing suspend count.", inf->pid); - inf->task->cur_sc = info.suspend_count; - } -} - -/* Turns tracing for INF on or off, depending on ON, unless it already is. - If INF is running, the resume_sc count of INF's threads will be modified, - and the signal thread will briefly be run to change the trace state. */ -void -inf_set_traced (struct inf *inf, int on) -{ - if (on != inf->traced) - if (inf->task) - /* Make it take effect immediately. */ - { - error_t (*f)(mach_port_t, mach_port_t, int) = - on ? msg_set_some_exec_flags : msg_clear_some_exec_flags; - error_t err = - INF_RESUME_MSGPORT_RPC (inf, (*f)(msgport, refport, EXEC_TRACED)); - if (err == EIEIO) - warning ("Can't modify tracing state for pid %d: No signal thread", - inf->pid); - else if (err) - warning ("Can't modify tracing state for pid %d: %s", - inf->pid, strerror (err)); - else - inf->traced = on; - } - else - inf->traced = on; -} - -/* Makes all the real suspend count deltas of all the procs in INF match the - desired values. Careful to always do thread/task suspend counts in the - safe order. Returns true if at least one thread is thought to be running.*/ -int -inf_update_suspends (struct inf *inf) -{ - struct proc *task = inf->task; - /* We don't have to update INF->threads even though we're iterating over it - because we'll change a thread only if it already has an existing proc - entry. */ - - inf_debug (inf, "updating suspend counts"); - - if (task) - { - struct proc *thread; - int task_running = (task->sc == 0), thread_running = 0; - - if (task->sc > task->cur_sc) - /* The task is becoming _more_ suspended; do before any threads. */ - task_running = proc_update_sc (task); - - if (inf->pending_execs) - /* When we're waiting for an exec, things may be happening behind our - back, so be conservative. */ - thread_running = 1; - - /* Do all the thread suspend counts. */ - for (thread = inf->threads; thread; thread = thread->next) - thread_running |= proc_update_sc (thread); - - if (task->sc != task->cur_sc) - /* We didn't do the task first, because we wanted to wait for the - threads; do it now. */ - task_running = proc_update_sc (task); - - inf_debug (inf, "%srunning...", - (thread_running && task_running) ? "" : "not "); - - inf->running = thread_running && task_running; - - /* Once any thread has executed some code, we can't depend on the - threads list any more. */ - if (inf->running) - inf->threads_up_to_date = 0; - - return inf->running; - } - - return 0; -} - -/* Converts a GDB pid to a struct proc. */ -struct proc * -inf_tid_to_thread (struct inf *inf, int tid) -{ - struct proc *thread = inf->threads; - while (thread) - if (thread->tid == tid) - return thread; - else - thread = thread->next; - return 0; -} - -/* Converts a thread port to a struct proc. */ -struct proc * -inf_port_to_thread (struct inf *inf, mach_port_t port) -{ - struct proc *thread = inf->threads; - while (thread) - if (thread->port == port) - return thread; - else - thread = thread->next; - return 0; -} - -/* Make INF's list of threads be consistent with reality of TASK. */ -void -inf_validate_procs (struct inf *inf) -{ - int i; - thread_array_t threads; - unsigned num_threads; - struct proc *task = inf->task; - - inf->threads_up_to_date = !inf->running; - - if (task) - { - error_t err = task_threads (task->port, &threads, &num_threads); - inf_debug (inf, "fetching threads"); - if (err) - /* TASK must be dead. */ - { - task->port = MACH_PORT_NULL; - _proc_free (task); - task = inf->task = 0; - } - } - - if (!task) - { - num_threads = 0; - inf_debug (inf, "no task"); - } - - { - unsigned search_start = 0; /* Make things normally linear. */ - /* Which thread in PROCS corresponds to each task thread, & the task. */ - struct proc *matched[num_threads + 1]; - /* The last thread in INF->threads, so we can add to the end. */ - struct proc *last = 0; - /* The current thread we're considering. */ - struct proc *thread = inf->threads; - - bzero (matched, sizeof (matched)); - - while (thread) - { - unsigned left; - - for (i = search_start, left = num_threads; left; i++, left--) - { - if (i >= num_threads) - i -= num_threads; /* I wrapped around. */ - if (thread->port == threads[i]) - /* We already know about this thread. */ - { - matched[i] = thread; - last = thread; - thread = thread->next; - search_start++; - break; - } - } - - if (! left) - { - proc_debug (thread, "died!"); - thread->port = MACH_PORT_NULL; - thread = _proc_free (thread); /* THREAD is dead. */ - (last ? last->next : inf->threads) = thread; - } - } - - for (i = 0; i < num_threads; i++) - if (matched[i]) - /* Throw away the duplicate send right. */ - mach_port_deallocate (mach_task_self (), threads[i]); - else - /* THREADS[I] is a thread we don't know about yet! */ - { - thread = make_proc (inf, threads[i], next_thread_id++); - (last ? last->next : inf->threads) = thread; - last = thread; - proc_debug (thread, "new thread: %d", threads[i]); - add_thread (thread->tid); /* Tell GDB's generic thread code. */ - } - - vm_deallocate(mach_task_self(), - (vm_address_t)threads, (num_threads * sizeof(thread_t))); - } -} - -/* Makes sure that INF's thread list is synced with the actual process. */ -inline int -inf_update_procs (struct inf *inf) -{ - if (! inf->task) - return 0; - if (! inf->threads_up_to_date) - inf_validate_procs (inf); - return !!inf->task; -} - -/* Sets the resume_sc of each thread in inf. That of RUN_THREAD is set to 0, - and others are set to their run_sc if RUN_OTHERS is true, and otherwise - their pause_sc. */ -inline void -inf_set_threads_resume_sc (struct inf *inf, - struct proc *run_thread, int run_others) -{ - struct proc *thread; - inf_update_procs (inf); - for (thread = inf->threads; thread; thread = thread->next) - if (thread == run_thread) - thread->resume_sc = 0; - else if (run_others) - thread->resume_sc = thread->run_sc; - else - thread->resume_sc = thread->pause_sc; -} - -/* Cause INF to continue execution immediately; individual threads may still - be suspended (but their suspend counts will be updated). */ -inline void -inf_resume (struct inf *inf) -{ - struct proc *thread; - - inf_update_procs (inf); - - for (thread = inf->threads; thread; thread = thread->next) - thread->sc = thread->resume_sc; - - if (inf->task) - inf->task->sc = 0; - - inf_update_suspends (inf); -} - -/* Cause INF to stop execution immediately; individual threads may still - be running. */ -inline void -inf_suspend (struct inf *inf) -{ - struct proc *thread; - - inf_update_procs (inf); - - for (thread = inf->threads; thread; thread = thread->next) - thread->sc = thread->pause_sc; - - if (inf->task) - inf->task->sc = inf->pause_sc; - - inf_update_suspends (inf); -} - -/* INF has one thread PROC that is in single-stepping mode. This functions - changes it to be PROC, changing any old step_thread to be a normal one. A - PROC of 0 clears an any existing value. */ -void -inf_set_step_thread (struct inf *inf, struct proc *thread) -{ - assert (!thread || proc_is_thread (thread)); - - if (thread) - inf_debug (inf, "setting step thread: %d/%d", inf->pid, thread->tid); - else - inf_debug (inf, "clearing step thread"); - - if (inf->step_thread != thread) - { - if (inf->step_thread && inf->step_thread->port != MACH_PORT_NULL) - if (! proc_trace (inf->step_thread, 0)) - return; - if (thread && proc_trace (thread, 1)) - inf->step_thread = thread; - else - inf->step_thread = 0; - } -} - -/* Set up the thread resume_sc's so that only the signal thread is running - (plus whatever other thread are set to always run). Returns true if we - did so, or false if we can't find a signal thread. */ -inline int -inf_set_threads_resume_sc_for_signal_thread (struct inf *inf) -{ - if (inf->signal_thread) - { - inf_set_threads_resume_sc (inf, inf->signal_thread, 0); - return 1; - } - else - return 0; -} - -static void -inf_update_signal_thread (struct inf *inf) -{ - /* XXX for now we assume that if there's a msgport, the 2nd thread is - the signal thread. */ - inf->signal_thread = inf->threads ? inf->threads->next : 0; -} - -/* Detachs from INF's inferior task, letting it run once again... */ -void -inf_detach (struct inf *inf) -{ - struct proc *task = inf->task; - - inf_debug (inf, "detaching..."); - - inf_clear_wait (inf); - inf_set_step_thread (inf, 0); - - if (task) - { - struct proc *thread; - - inf_set_traced (inf, 0); - if (inf->stopped) - inf_signal (inf, TARGET_SIGNAL_0); - - proc_restore_exc_port (task); - task->sc = 0; - - for (thread = inf->threads; thread; thread = thread->next) - { - proc_restore_exc_port (thread); - thread->sc = 0; - } - - inf_update_suspends (inf); - } - - inf_cleanup (inf); -} - -/* Attaches INF to the process with process id PID, returning it in a suspended - state suitable for debugging. */ -void -inf_attach (struct inf *inf, int pid) -{ - error_t err; - task_t task; - - inf_debug (inf, "attaching: %d", pid); - - err = proc_pid2task (proc_server, pid, &task); - if (err) - error ("Error getting task for pid %d: %s", pid, strerror (err)); - - if (inf->pid) - inf_detach (inf); - - inf_startup (inf, pid, task); -} - -/* Makes sure that we've got our exception ports entrenched in the process. */ -void inf_steal_exc_ports (struct inf *inf) -{ - struct proc *thread; - - inf_debug (inf, "stealing exception ports"); - - inf_set_step_thread (inf, 0); /* The step thread is special. */ - - proc_steal_exc_port (inf->task, inf->event_port); - for (thread = inf->threads; thread; thread = thread->next) - proc_steal_exc_port (thread, MACH_PORT_NULL); -} - -/* Makes sure the process has its own exception ports. */ -void inf_restore_exc_ports (struct inf *inf) -{ - struct proc *thread; - - inf_debug (inf, "restoring exception ports"); - - inf_set_step_thread (inf, 0); /* The step thread is special. */ - - proc_restore_exc_port (inf->task); - for (thread = inf->threads; thread; thread = thread->next) - proc_restore_exc_port (thread); -} - -/* Deliver signal SIG to INF. If INF is stopped, delivering a signal, even - signal 0, will continue it. INF is assumed to be in a paused state, and - the resume_sc's of INF's threads may be affected. */ -void -inf_signal (struct inf *inf, enum target_signal sig) -{ - error_t err = 0; - int host_sig = target_signal_to_host (sig); - -#define NAME target_signal_to_name (sig) - - if (host_sig >= _NSIG) - /* A mach exception. Exceptions are encoded in the signal space by - putting them after _NSIG; this assumes they're positive (and not - extremely large)! */ - { - struct inf_wait *w = &inf->wait; - if (w->status.kind == TARGET_WAITKIND_STOPPED - && w->status.value.sig == sig - && w->thread && !w->thread->aborted) - /* We're passing through the last exception we received. This is - kind of bogus, because exceptions are per-thread whereas gdb - treats signals as per-process. We just forward the exception to - the correct handler, even it's not for the same thread as TID -- - i.e., we pretend it's global. */ - { - struct exc_state *e = &w->exc; - inf_debug (inf, "passing through exception:" - " task = %d, thread = %d, exc = %d" - ", code = %d, subcode = %d", - w->thread->port, inf->task->port, - e->exception, e->code, e->subcode); - err = - exception_raise_request (e->handler, - e->reply, MACH_MSG_TYPE_MOVE_SEND_ONCE, - w->thread->port, inf->task->port, - e->exception, e->code, e->subcode); - } - else - warning ("Can't forward spontaneous exception (%s).", NAME); - } - else - /* A Unix signal. */ - if (inf->stopped) - /* The process is stopped an expecting a signal. Just send off a - request and let it get handled when we resume everything. */ - { - inf_debug (inf, "sending %s to stopped process", NAME); - err = - INF_MSGPORT_RPC (inf, - msg_sig_post_untraced_request (msgport, - inf->event_port, - MACH_MSG_TYPE_MAKE_SEND_ONCE, - host_sig, - refport)); - if (! err) - /* Posting an untraced signal automatically continues it. - We clear this here rather than when we get the reply - because we'd rather assume it's not stopped when it - actually is, than the reverse. */ - inf->stopped = 0; - } - else - /* It's not expecting it. We have to let just the signal thread - run, and wait for it to get into a reasonable state before we - can continue the rest of the process. When we finally resume the - process the signal we request will be the very first thing that - happens. */ - { - inf_debug (inf, "sending %s to unstopped process (so resuming signal thread)", NAME); - err = - INF_RESUME_MSGPORT_RPC (inf, - msg_sig_post_untraced (msgport, - host_sig, refport)); - } - - if (err == EIEIO) - /* Can't do too much... */ - warning ("Can't deliver signal %s: No signal thread.", NAME); - else if (err) - warning ("Delivering signal %s: %s", NAME, strerror (err)); - -#undef NAME -} - -/* The inferior used for all gdb target ops. */ -struct inf *current_inferior = 0; - -/* The inferior being waited for by gnu_wait. Since GDB is decidely not - multi-threaded, we don't bother to lock this. */ -struct inf *waiting_inf; - -/* Wait for something to happen in the inferior, returning what in STATUS. */ -static int -gnu_wait (int tid, struct target_waitstatus *status) -{ - struct msg { - mach_msg_header_t hdr; - mach_msg_type_t type; - int data[8000]; - } msg; - error_t err; - struct proc *thread; - struct inf *inf = current_inferior; - - waiting_inf = inf; - - inf_debug (inf, "waiting for: %d", tid); - - rewait: - if (proc_wait_pid != inf->pid && !inf->no_wait) - /* Always get information on events from the proc server. */ - { - inf_debug (inf, "requesting wait on pid %d", inf->pid); - - if (proc_wait_pid) - /* The proc server is single-threaded, and only allows a single - outstanding wait request, so we have to cancel the previous one. */ - { - inf_debug (inf, "cancelling previous wait on pid %d", proc_wait_pid); - interrupt_operation (proc_server); - } - - err = - proc_wait_request (proc_server, inf->event_port, inf->pid, WUNTRACED); - if (err) - warning ("wait request failed: %s", strerror (err)); - else - { - inf_debug (inf, "waits pending: %d", proc_waits_pending); - proc_wait_pid = inf->pid; - /* Even if proc_waits_pending was > 0 before, we still won't get - any other replies, because it was either from a different INF, - or a different process attached to INF -- and the event port, - which is the wait reply port, changes when you switch processes.*/ - proc_waits_pending = 1; - } - } - - inf_clear_wait (inf); - - /* What can happen? (1) Dead name notification; (2) Exceptions arrive; - (3) wait reply from the proc server. */ - - inf_debug (inf, "waiting for an event..."); - err = _hurd_intr_rpc_mach_msg (&msg.hdr, MACH_RCV_MSG, 0, - sizeof (struct msg), - inf->event_port, MACH_PORT_NULL); - - /* Re-suspend the task. */ - inf_suspend (inf); - - if (err == EINTR) - inf_debug (inf, "interrupted"); - else if (err) - error ("Couldn't wait for an event: %s", strerror (err)); - else - { - struct { - mach_msg_header_t hdr; - mach_msg_type_t err_type; - kern_return_t err; - char noise[200]; - } reply; - - inf_debug (inf, "event: msgid = %d", msg.hdr.msgh_id); - - /* Handle what we got. */ - if (! notify_server (&msg.hdr, &reply.hdr) - && ! exc_server (&msg.hdr, &reply.hdr) - && ! process_reply_server (&msg.hdr, &reply.hdr) - && ! msg_reply_server (&msg.hdr, &reply.hdr)) - /* Whatever it is, it's something strange. */ - error ("Got a strange event, msg id = %d.", msg.hdr.msgh_id); - - if (reply.err) - error ("Handling event, msgid = %d: %s", - msg.hdr.msgh_id, strerror (reply.err)); - } - - if (inf->pending_execs) - /* We're waiting for the inferior to finish execing. */ - { - struct inf_wait *w = &inf->wait; - enum target_waitkind kind = w->status.kind; - - if (kind == TARGET_WAITKIND_SPURIOUS) - /* Since gdb is actually counting the number of times the inferior - stops, expecting one stop per exec, we only return major events - while execing. */ - w->suppress = 1; - else if (kind == TARGET_WAITKIND_STOPPED - && w->status.value.sig == TARGET_SIGNAL_TRAP) - /* Ah hah! A SIGTRAP from the inferior while starting up probably - means we've succesfully completed an exec! */ - if (--inf->pending_execs == 0) - /* We're done! */ - { - prune_threads (1); /* Get rid of the old shell threads */ - renumber_threads (0); /* Give our threads reasonable names. */ - } - } - - if (inf->wait.suppress) - /* Some totally spurious event happened that we don't consider - worth returning to gdb. Just keep waiting. */ - { - inf_debug (inf, "suppressing return, rewaiting..."); - inf_resume (inf); - goto rewait; - } - - /* Pass back out our results. */ - bcopy (&inf->wait.status, status, sizeof (*status)); - - thread = inf->wait.thread; - if (thread) - tid = thread->tid; - else - thread = inf_tid_to_thread (inf, tid); - - if (!thread || thread->port == MACH_PORT_NULL) - /* TID is dead; try and find a new thread. */ - if (inf_update_procs (inf) && inf->threads) - tid = inf->threads->tid; /* The first available thread. */ - else - tid = -1; - - if (thread && tid >= 0 && status->kind != TARGET_WAITKIND_SPURIOUS - && inf->pause_sc == 0 && thread->pause_sc == 0) - /* If something actually happened to THREAD, make sure we suspend it. */ - { - thread->sc = 1; - inf_update_suspends (inf); - } - - inf_debug (inf, "returning tid = %d, status = %s (%d)", tid, - status->kind == TARGET_WAITKIND_EXITED ? "EXITED" - : status->kind == TARGET_WAITKIND_STOPPED ? "STOPPED" - : status->kind == TARGET_WAITKIND_SIGNALLED ? "SIGNALLED" - : status->kind == TARGET_WAITKIND_LOADED ? "LOADED" - : status->kind == TARGET_WAITKIND_SPURIOUS ? "SPURIOUS" - : "?", - status->value.integer); - - return tid; -} - -/* The rpc handler called by exc_server. */ -error_t -S_exception_raise_request (mach_port_t port, mach_port_t reply_port, - thread_t thread_port, task_t task_port, - int exception, int code, int subcode) -{ - struct inf *inf = waiting_inf; - struct proc *thread = inf_port_to_thread (inf, thread_port); - - inf_debug (waiting_inf, - "thread = %d, task = %d, exc = %d, code = %d, subcode = %d", - thread_port, task_port, exception, code); - - if (!thread) - /* We don't know about thread? */ - { - inf_update_procs (inf); - thread = inf_port_to_thread (inf, thread_port); - if (!thread) - /* Give up, the generating thread is gone. */ - return 0; - } - - mach_port_deallocate (mach_task_self (), thread_port); - mach_port_deallocate (mach_task_self (), task_port); - - if (! thread->aborted) - /* THREAD hasn't been aborted since this exception happened (abortion - clears any exception state), so it must be real. */ - { - /* Store away the details; this will destroy any previous info. */ - inf->wait.thread = thread; - - inf->wait.status.kind = TARGET_WAITKIND_STOPPED; - - if (exception == EXC_BREAKPOINT) - /* GDB likes to get SIGTRAP for breakpoints. */ - { - inf->wait.status.value.sig = TARGET_SIGNAL_TRAP; - mach_port_deallocate (mach_task_self (), reply_port); - } - else - /* Record the exception so that we can forward it later. */ - { - if (thread->exc_port == port) - inf->wait.exc.handler = thread->saved_exc_port; - else - { - inf->wait.exc.handler = inf->task->saved_exc_port; - assert (inf->task->exc_port == port); - } - if (inf->wait.exc.handler != MACH_PORT_NULL) - /* Add a reference to the exception handler. */ - mach_port_mod_refs (mach_task_self (), - inf->wait.exc.handler, MACH_PORT_RIGHT_SEND, - 1); - - inf->wait.exc.exception = exception; - inf->wait.exc.code = code; - inf->wait.exc.subcode = subcode; - inf->wait.exc.reply = reply_port; - - /* Exceptions are encoded in the signal space by putting them after - _NSIG; this assumes they're positive (and not extremely large)! */ - inf->wait.status.value.sig = - target_signal_from_host (_NSIG + exception); - } - } - else - /* A supppressed exception, which ignore. */ - { - inf->wait.suppress = 1; - mach_port_deallocate (mach_task_self (), reply_port); - } - - return 0; -} - -/* Fill in INF's wait field after a task has died without giving us more - detailed information. */ -void -inf_task_died_status (struct inf *inf) -{ - warning ("Pid %d died with unknown exit status, using SIGKILL.", inf->pid); - inf->wait.status.kind = TARGET_WAITKIND_SIGNALLED; - inf->wait.status.value.sig = TARGET_SIGNAL_KILL; -} - -/* Notify server routines. The only real one is dead name notification. */ - -error_t -do_mach_notify_dead_name (mach_port_t notify, mach_port_t dead_port) -{ - struct inf *inf = waiting_inf; - - inf_debug (waiting_inf, "port = %d", dead_port); - - if (inf->task && inf->task->port == dead_port) - { - proc_debug (inf->task, "is dead"); - inf->task->port = MACH_PORT_NULL; - if (proc_wait_pid == inf->pid) - /* We have a wait outstanding on the process, which will return more - detailed information, so delay until we get that. */ - inf->wait.suppress = 1; - else - /* We never waited for the process (maybe it wasn't a child), so just - pretend it got a SIGKILL. */ - inf_task_died_status (inf); - } - else - { - struct proc *thread = inf_port_to_thread (inf, dead_port); - if (thread) - { - proc_debug (thread, "is dead"); - thread->port = MACH_PORT_NULL; - } - } - - mach_port_deallocate (mach_task_self (), dead_port); - inf->threads_up_to_date = 0; /* Just in case */ - - return 0; -} - -static error_t -ill_rpc (char *fun) -{ - warning ("illegal rpc: %s", fun); - return 0; -} - -error_t -do_mach_notify_no_senders (mach_port_t notify, mach_port_mscount_t count) -{ - return ill_rpc (__FUNCTION__); -} - -error_t -do_mach_notify_port_deleted (mach_port_t notify, mach_port_t name) -{ - return ill_rpc (__FUNCTION__); -} - -error_t -do_mach_notify_msg_accepted (mach_port_t notify, mach_port_t name) -{ - return ill_rpc (__FUNCTION__); -} - -error_t -do_mach_notify_port_destroyed (mach_port_t notify, mach_port_t name) -{ - return ill_rpc (__FUNCTION__); -} - -error_t -do_mach_notify_send_once (mach_port_t notify) -{ - return ill_rpc (__FUNCTION__); -} - -/* Process_reply server routines. We only use process_wait_reply. */ - -error_t -S_proc_wait_reply (mach_port_t reply, error_t err, - int status, rusage_t rusage, pid_t pid) -{ - struct inf *inf = waiting_inf; - - inf_debug (inf, "err = %s, pid = %d, status = 0x%x", - err ? strerror (err) : "0", pid, status); - - if (err && proc_wait_pid && (!inf->task || !inf->task->port)) - /* Ack. The task has died, but the task-died notification code didn't - tell anyone because it thought a more detailed reply from the - procserver was forthcoming. However, we now learn that won't - happen... So we have to act like the task just died, and this time, - tell the world. */ - inf_task_died_status (inf); - - if (--proc_waits_pending == 0) - /* PROC_WAIT_PID represents the most recent wait. We will always get - replies in order because the proc server is single threaded. */ - proc_wait_pid = 0; - - inf_debug (inf, "waits pending now: %d", proc_waits_pending); - - if (err) - { - if (err != EINTR) - { - warning ("Can't wait for pid %d: %s", inf->pid, strerror (err)); - inf->no_wait = 1; - - /* Since we can't see the inferior's signals, don't trap them. */ - inf_set_traced (inf, 0); - } - } - else if (pid == inf->pid) - { - store_waitstatus (&inf->wait.status, status); - if (inf->wait.status.kind == TARGET_WAITKIND_STOPPED) - /* The process has sent us a signal, and stopped itself in a sane - state pending our actions. */ - { - inf_debug (inf, "process has stopped itself"); - inf->stopped = 1; - - /* We recheck the task suspend count here because the crash server - messes with it in an unfriendly way, right before `stopping'. */ - inf_validate_task_sc (inf); - } - } - else - inf->wait.suppress = 1; /* Something odd happened. Ignore. */ - - return 0; -} - -error_t -S_proc_setmsgport_reply (mach_port_t reply, error_t err, - mach_port_t old_msg_port) -{ - return ill_rpc (__FUNCTION__); -} - -error_t -S_proc_getmsgport_reply (mach_port_t reply, error_t err, mach_port_t msg_port) -{ - return ill_rpc (__FUNCTION__); -} - -/* Msg_reply server routines. We only use msg_sig_post_untraced_reply. */ - -error_t -S_msg_sig_post_untraced_reply (mach_port_t reply, error_t err) -{ - struct inf *inf = waiting_inf; - - if (err == EBUSY) - /* EBUSY is what we get when the crash server has grabbed control of the - process and doesn't like what signal we tried to send it. Just act - like the process stopped (using a signal of 0 should mean that the - *next* time the user continues, it will pass signal 0, which the crash - server should like). */ - { - inf->wait.status.kind = TARGET_WAITKIND_STOPPED; - inf->wait.status.value.sig = TARGET_SIGNAL_0; - } - else if (err) - warning ("Signal delivery failed: %s", strerror (err)); - - if (err) - /* We only get this reply when we've posted a signal to a process which we - thought was stopped, and which we expected to continue after the signal. - Given that the signal has failed for some reason, it's reasonable to - assume it's still stopped. */ - inf->stopped = 1; - else - inf->wait.suppress = 1; - - return 0; -} - -error_t -S_msg_sig_post_reply (mach_port_t reply, error_t err) -{ - return ill_rpc (__FUNCTION__); -} - -/* Returns the number of messages queued for the receive right PORT. */ -static mach_port_msgcount_t -port_msgs_queued (mach_port_t port) -{ - struct mach_port_status status; - error_t err = - mach_port_get_receive_status (mach_task_self (), port, &status); - - if (err) - return 0; - else - return status.mps_msgcount; -} - -/* Resume execution of the inferior process. - - If STEP is nonzero, single-step it. - If SIGNAL is nonzero, give it that signal. - - TID STEP: - -1 true Single step the current thread allowing other threads to run. - -1 false Continue the current thread allowing other threads to run. - X true Single step the given thread, don't allow any others to run. - X false Continue the given thread, do not allow any others to run. - (Where X, of course, is anything except -1) - - Note that a resume may not `take' if there are pending exceptions/&c - still unprocessed from the last resume we did (any given resume may result - in multiple events returned by wait). -*/ -static void -gnu_resume (int tid, int step, enum target_signal sig) -{ - struct proc *step_thread = 0; - struct inf *inf = current_inferior; - - inf_debug (inf, "tid = %d, step = %d, sig = %d", tid, step, sig); - - if (sig != TARGET_SIGNAL_0 || inf->stopped) - inf_signal (inf, sig); - else if (inf->wait.exc.reply != MACH_PORT_NULL) - /* We received an exception to which we have chosen not to forward, so - abort the faulting thread, which will perhaps retake it. */ - { - proc_abort (inf->wait.thread, 1); - warning ("Aborting %s with unforwarded exception %s.", - proc_string (inf->wait.thread), - target_signal_to_name (inf->wait.status.value.sig)); - } - - if (port_msgs_queued (inf->event_port)) - /* If there are still messages in our event queue, don't bother resuming - the process, as we're just going to stop it right away anyway. */ - return; - - if (tid < 0) - /* Allow all threads to run, except perhaps single-stepping one. */ - { - inf_debug (inf, "running all threads; tid = %d", inferior_pid); - tid = inferior_pid; /* What to step. */ - inf_set_threads_resume_sc (inf, 0, 1); - } - else - /* Just allow a single thread to run. */ - { - struct proc *thread = inf_tid_to_thread (inf, tid); - assert (thread); - - inf_debug (inf, "running one thread: %d/%d", inf->pid, thread->tid); - inf_set_threads_resume_sc (inf, thread, 0); - } - - if (step) - { - step_thread = inf_tid_to_thread (inf, tid); - assert (step_thread); - inf_debug (inf, "stepping thread: %d/%d", inf->pid, step_thread->tid); - } - if (step_thread != inf->step_thread) - inf_set_step_thread (inf, step_thread); - - inf_debug (inf, "here we go..."); - inf_resume (inf); -} - -static void -gnu_kill_inferior () -{ - struct proc *task = current_inferior->task; - if (task) - { - proc_debug (task, "terminating..."); - task_terminate (task->port); - task->port = MACH_PORT_NULL; - inf_validate_procs (current_inferior); /* Clear out the thread list &c */ - } - target_mourn_inferior (); -} - -/* Clean up after the inferior dies. */ - -static void -gnu_mourn_inferior () -{ - inf_debug (current_inferior, "rip"); - inf_detach (current_inferior); - unpush_target (&gnu_ops); - generic_mourn_inferior (); -} - -/* Fork an inferior process, and start debugging it. */ - -/* Set INFERIOR_PID to the first thread available in the child, if any. */ -static void -pick_first_thread () -{ - if (current_inferior->task && current_inferior->threads) - /* The first thread. */ - inferior_pid = current_inferior->threads->tid; - else - /* What may be the next thread. */ - inferior_pid = next_thread_id; -} - -static struct inf * -cur_inf () -{ - if (! current_inferior) - current_inferior = make_inf (); - return current_inferior; -} - -static void -gnu_create_inferior (exec_file, allargs, env) - char *exec_file; - char *allargs; - char **env; -{ - struct inf *inf = cur_inf (); - - void trace_me () - { - /* We're in the child; make this process stop as soon as it execs. */ - inf_debug (inf, "tracing self"); - ptrace (PTRACE_TRACEME, 0, 0, 0); - } - void attach_to_child (int pid) - { - /* Attach to the now stopped child, which is actually a shell... */ - inf_debug (inf, "attaching to child: %d", pid); - - inf_attach (inf, pid); - pick_first_thread (); - - attach_flag = 0; - push_target (&gnu_ops); - - inf->pending_execs = 2; - inf->traced = 1; - - /* Now let the child run again, knowing that it will stop immediately - because of the ptrace. */ - inf_resume (inf); - - startup_inferior (pid, inf->pending_execs); - } - - inf_debug (inf, "creating inferior"); - - fork_inferior (exec_file, allargs, env, trace_me, attach_to_child, NULL); - - inf_update_signal_thread (inf); - inf_set_traced (inf, inf->want_signals); - - /* Execing the process will have trashed our exception ports; steal them - back (or make sure they're restored if the user wants that). */ - if (inf->want_exceptions) - inf_steal_exc_ports (inf); - else - inf_restore_exc_ports (inf); - - /* Here we go! */ - proceed ((CORE_ADDR) -1, 0, 0); -} - -/* Mark our target-struct as eligible for stray "run" and "attach" - commands. */ -static int -gnu_can_run () -{ - return 1; -} - -#ifdef ATTACH_DETACH - -/* Attach to process PID, then initialize for debugging it - and wait for the trace-trap that results from attaching. */ -static void -gnu_attach (args, from_tty) - char *args; - int from_tty; -{ - int pid; - char *exec_file; - struct inf *inf = cur_inf (); - - if (!args) - error_no_arg ("PID to attach"); - - pid = atoi (args); - - if (pid == getpid()) /* Trying to masturbate? */ - error ("I refuse to debug myself!"); - - if (from_tty) - { - exec_file = (char *) get_exec_file (0); - - if (exec_file) - printf_unfiltered ("Attaching to program `%s', pid %d\n", - exec_file, pid); - else - printf_unfiltered ("Attaching to pid %d\n", pid); - - gdb_flush (gdb_stdout); - } - - inf_debug (inf, "attaching to pid: %d", pid); - - inf_attach (inf, pid); - inf_update_procs (inf); - - pick_first_thread (); - - attach_flag = 1; - push_target (&gnu_ops); - - inf_update_signal_thread (inf); - inf_set_traced (inf, inf->want_signals); - - /* If the process was stopped before we attached, make it continue the next - time the user does a continue. */ - inf_validate_stopped (inf); - inf_validate_task_sc (inf); -} - -/* Take a program previously attached to and detaches it. - The program resumes execution and will no longer stop - on signals, etc. We'd better not have left any breakpoints - in the program or it'll die when it hits one. For this - to work, it may be necessary for the process to have been - previously attached. It *might* work if the program was - started via fork. */ -static void -gnu_detach (args, from_tty) - char *args; - int from_tty; -{ - if (from_tty) - { - char *exec_file = get_exec_file (0); - if (exec_file) - printf_unfiltered ("Detaching from program `%s' pid %d\n", - exec_file, current_inferior->pid); - else - printf_unfiltered ("Detaching from pid %d\n", current_inferior->pid); - gdb_flush (gdb_stdout); - } - - inf_detach (current_inferior); - - inferior_pid = 0; - - unpush_target (&gnu_ops); /* Pop out of handling an inferior */ -} -#endif /* ATTACH_DETACH */ - -static void -gnu_terminal_init_inferior () -{ - assert (current_inferior); - terminal_init_inferior_with_pgrp (current_inferior->pid); -} - -/* Get ready to modify the registers array. On machines which store - individual registers, this doesn't need to do anything. On machines - which store all the registers in one fell swoop, this makes sure - that registers contains all the registers from the program being - debugged. */ - -static void -gnu_prepare_to_store () -{ -#ifdef CHILD_PREPARE_TO_STORE - CHILD_PREPARE_TO_STORE (); -#endif -} - -static void -gnu_open (arg, from_tty) - char *arg; - int from_tty; -{ - error ("Use the \"run\" command to start a Unix child process."); -} - -static void -gnu_stop () -{ - error ("to_stop target function not implemented"); -} - -static int -gnu_thread_alive (int tid) -{ - inf_update_procs (current_inferior); - return !!inf_tid_to_thread (current_inferior, tid); -} - -/* - * Read inferior task's LEN bytes from ADDR and copy it to MYADDR - * in gdb's address space. - * - * Return 0 on failure; number of bytes read otherwise. - */ -int -gnu_read_inferior (task, addr, myaddr, length) - task_t task; - CORE_ADDR addr; - char *myaddr; - int length; -{ - error_t err; - vm_address_t low_address = (vm_address_t) trunc_page (addr); - vm_size_t aligned_length = - (vm_size_t) round_page (addr+length) - low_address; - pointer_t copied; - int copy_count; - - /* Get memory from inferior with page aligned addresses */ - err = vm_read (task, low_address, aligned_length, &copied, ©_count); - if (err) - return 0; - - err = hurd_safe_copyin (myaddr, (void*)addr - low_address + copied, length); - if (err) - { - warning ("Read from inferior faulted: %s", strerror (err)); - length = 0; - } - - err = vm_deallocate (mach_task_self (), copied, copy_count); - if (err) - warning ("gnu_read_inferior vm_deallocate failed: %s", strerror (err)); - - return length; -} - -#define CHK_GOTO_OUT(str,ret) \ - do if (ret != KERN_SUCCESS) { errstr = #str; goto out; } while(0) - -struct vm_region_list { - struct vm_region_list *next; - vm_prot_t protection; - vm_address_t start; - vm_size_t length; -}; - -struct obstack region_obstack; - -/* - * Write inferior task's LEN bytes from ADDR and copy it to MYADDR - * in gdb's address space. - */ -int -gnu_write_inferior (task, addr, myaddr, length) - task_t task; - CORE_ADDR addr; - char *myaddr; - int length; -{ - error_t err = 0; - vm_address_t low_address = (vm_address_t) trunc_page (addr); - vm_size_t aligned_length = - (vm_size_t) round_page (addr+length) - low_address; - pointer_t copied; - int copy_count; - int deallocate = 0; - - char *errstr = "Bug in gnu_write_inferior"; - - struct vm_region_list *region_element; - struct vm_region_list *region_head = (struct vm_region_list *)NULL; - - /* Get memory from inferior with page aligned addresses */ - err = vm_read (task, - low_address, - aligned_length, - &copied, - ©_count); - CHK_GOTO_OUT ("gnu_write_inferior vm_read failed", err); - - deallocate++; - - err = hurd_safe_copyout ((void*)addr - low_address + copied, myaddr, length); - CHK_GOTO_OUT ("Write to inferior faulted", err); - - obstack_init (®ion_obstack); - - /* Do writes atomically. - * First check for holes and unwritable memory. - */ - { - vm_size_t remaining_length = aligned_length; - vm_address_t region_address = low_address; - - struct vm_region_list *scan; - - while(region_address < low_address + aligned_length) - { - vm_prot_t protection; - vm_prot_t max_protection; - vm_inherit_t inheritance; - boolean_t shared; - mach_port_t object_name; - vm_offset_t offset; - vm_size_t region_length = remaining_length; - vm_address_t old_address = region_address; - - err = vm_region (task, - ®ion_address, - ®ion_length, - &protection, - &max_protection, - &inheritance, - &shared, - &object_name, - &offset); - CHK_GOTO_OUT ("vm_region failed", err); - - /* Check for holes in memory */ - if (old_address != region_address) - { - warning ("No memory at 0x%x. Nothing written", - old_address); - err = KERN_SUCCESS; - length = 0; - goto out; - } - - if (!(max_protection & VM_PROT_WRITE)) - { - warning ("Memory at address 0x%x is unwritable. Nothing written", - old_address); - err = KERN_SUCCESS; - length = 0; - goto out; - } - - /* Chain the regions for later use */ - region_element = - (struct vm_region_list *) - obstack_alloc (®ion_obstack, sizeof (struct vm_region_list)); - - region_element->protection = protection; - region_element->start = region_address; - region_element->length = region_length; - - /* Chain the regions along with protections */ - region_element->next = region_head; - region_head = region_element; - - region_address += region_length; - remaining_length = remaining_length - region_length; - } - - /* If things fail after this, we give up. - * Somebody is messing up inferior_task's mappings. - */ - - /* Enable writes to the chained vm regions */ - for (scan = region_head; scan; scan = scan->next) - { - boolean_t protection_changed = FALSE; - - if (!(scan->protection & VM_PROT_WRITE)) - { - err = vm_protect (task, - scan->start, - scan->length, - FALSE, - scan->protection | VM_PROT_WRITE); - CHK_GOTO_OUT ("vm_protect: enable write failed", err); - } - } - - err = vm_write (task, - low_address, - copied, - aligned_length); - CHK_GOTO_OUT ("vm_write failed", err); - - /* Set up the original region protections, if they were changed */ - for (scan = region_head; scan; scan = scan->next) - { - boolean_t protection_changed = FALSE; - - if (!(scan->protection & VM_PROT_WRITE)) - { - err = vm_protect (task, - scan->start, - scan->length, - FALSE, - scan->protection); - CHK_GOTO_OUT ("vm_protect: enable write failed", err); - } - } - } - - out: - if (deallocate) - { - obstack_free (®ion_obstack, 0); - - (void) vm_deallocate (mach_task_self (), - copied, - copy_count); - } - - if (err != KERN_SUCCESS) - { - warning ("%s: %s", errstr, mach_error_string (err)); - return 0; - } - - return length; -} - -/* Return 0 on failure, number of bytes handled otherwise. */ -static int -gnu_xfer_memory (memaddr, myaddr, len, write, target) - CORE_ADDR memaddr; - char *myaddr; - int len; - int write; - struct target_ops *target; /* IGNORED */ -{ - int result; - task_t task = - current_inferior - ? (current_inferior->task ? current_inferior->task->port : 0) - : 0; - - if (task == MACH_PORT_NULL) - return 0; - else - { - inf_debug (current_inferior, "%s %p[%d] %s %p", - write ? "writing" : "reading", memaddr, len, - write ? "<--" : "-->", myaddr); - if (write) - return gnu_write_inferior (task, memaddr, myaddr, len); - else - return gnu_read_inferior (task, memaddr, myaddr, len); - } -} - -extern void gnu_store_registers (int regno); -extern void gnu_fetch_registers (int regno); - -struct target_ops gnu_ops = { - "GNU", /* to_shortname */ - "GNU Hurd process", /* to_longname */ - "GNU Hurd process", /* to_doc */ - gnu_open, /* to_open */ - 0, /* to_close */ - gnu_attach, /* to_attach */ - gnu_detach, /* to_detach */ - gnu_resume, /* to_resume */ - gnu_wait, /* to_wait */ - gnu_fetch_registers, /* to_fetch_registers */ - gnu_store_registers, /* to_store_registers */ - gnu_prepare_to_store, /* to_prepare_to_store */ - gnu_xfer_memory, /* to_xfer_memory */ - 0, /* to_files_info */ - memory_insert_breakpoint, /* to_insert_breakpoint */ - memory_remove_breakpoint, /* to_remove_breakpoint */ - gnu_terminal_init_inferior, /* to_terminal_init */ - terminal_inferior, /* to_terminal_inferior */ - terminal_ours_for_output, /* to_terminal_ours_for_output */ - terminal_ours, /* to_terminal_ours */ - child_terminal_info, /* to_terminal_info */ - gnu_kill_inferior, /* to_kill */ - 0, /* to_load */ - 0, /* to_lookup_symbol */ - - gnu_create_inferior, /* to_create_inferior */ - gnu_mourn_inferior, /* to_mourn_inferior */ - gnu_can_run, /* to_can_run */ - 0, /* to_notice_signals */ - gnu_thread_alive, /* to_thread_alive */ - gnu_stop, /* to_stop */ - process_stratum, /* to_stratum */ - 0, /* to_next */ - 1, /* to_has_all_memory */ - 1, /* to_has_memory */ - 1, /* to_has_stack */ - 1, /* to_has_registers */ - 1, /* to_has_execution */ - 0, /* sections */ - 0, /* sections_end */ - OPS_MAGIC /* to_magic */ -}; - -char *proc_string (struct proc *proc) -{ - static char tid_str[80]; - if (proc_is_task (proc)) - sprintf (tid_str, "process %d", proc->inf->pid); - else - sprintf (tid_str, "thread %d.%d", - proc->inf->pid, - pid_to_thread_id (proc->tid)); - return tid_str; -} - -char * -gnu_target_pid_to_str (int tid) -{ - struct inf *inf = current_inferior; - struct proc *thread = inf_tid_to_thread (inf, tid); - - if (thread) - return proc_string (thread); - else - { - static char tid_str[80]; - sprintf (tid_str, "bogus thread id %d", tid); - return tid_str; - } -} - -/* User task commands. */ - -struct cmd_list_element *set_task_cmd_list = 0; -struct cmd_list_element *show_task_cmd_list = 0; - -extern struct cmd_list_element *set_thread_default_cmd_list; -extern struct cmd_list_element *show_thread_default_cmd_list; - -static int -_parse_bool_arg (char *args, char *t_val, char *f_val, char *cmd_prefix) -{ - if (!args || strcmp (args, t_val) == 0) - return 1; - else if (strcmp (args, f_val) == 0) - return 0; - else - error ("Illegal argument for \"%s\" command, should be \"%s\" or \"%s\".", - cmd_prefix, t_val, f_val); -} - -#define parse_bool_arg(args, cmd_prefix) \ - _parse_bool_arg (args, "on", "off", cmd_prefix) - -static void -check_empty (char *args, char *cmd_prefix) -{ - if (args) - error ("Garbage after \"%s\" command: `%s'", cmd_prefix, args); -} - -/* Returns the alive thread named by INFERIOR_PID, or signals an error. */ -static struct proc * -cur_thread () -{ - struct inf *inf = cur_inf (); - struct proc *thread = inf_tid_to_thread (inf, inferior_pid); - if (!thread) - error ("No current thread."); - return thread; -} - -static void -set_task_pause_cmd (char *args, int from_tty) -{ - struct inf *inf = cur_inf (); - int old_sc = inf->pause_sc; - - inf->pause_sc = parse_bool_arg (args, "set task pause"); - - if (old_sc == 0 && inf->pause_sc != 0) - /* If the task is currently unsuspended, immediately suspend it, - otherwise wait until the next time it gets control. */ - inf_suspend (inf); -} - -static void -show_task_pause_cmd (char *args, int from_tty) -{ - struct inf *inf = cur_inf (); - check_empty (args, "show task pause"); - printf_unfiltered ("The inferior task %s suspended while gdb has control.\n", - inf->task - ? (inf->pause_sc == 0 ? "isn't" : "is") - : (inf->pause_sc == 0 ? "won't be" : "will be")); -} - -static void -set_thread_default_pause_cmd (char *args, int from_tty) -{ - struct inf *inf = cur_inf (); - inf->default_thread_pause_sc = - parse_bool_arg (args, "set thread default pause") ? 0 : 1; -} - -static void -show_thread_default_pause_cmd (char *args, int from_tty) -{ - struct inf *inf = cur_inf (); - int sc = inf->default_thread_pause_sc; - check_empty (args, "show thread default pause"); - printf_unfiltered ("New threads %s suspended while gdb has control%s.\n", - sc ? "are" : "aren't", - !sc && inf->pause_sc ? "(but the task is)" : ""); -} - -static void -set_thread_default_run_cmd (char *args, int from_tty) -{ - struct inf *inf = cur_inf (); - inf->default_thread_run_sc = - parse_bool_arg (args, "set thread default run") ? 0 : 1; -} - -static void -show_thread_default_run_cmd (char *args, int from_tty) -{ - struct inf *inf = cur_inf (); - check_empty (args, "show thread default run"); - printf_unfiltered ("New threads %s allowed to run.\n", - inf->default_thread_run_sc == 0 ? "are" : "aren't"); -} - -/* Steal a send right called NAME in the inferior task, and make it PROC's - saved exception port. */ -static void -steal_exc_port (struct proc *proc, mach_port_t name) -{ - error_t err; - mach_port_t port; - mach_msg_type_name_t port_type; - - if (!proc || !proc->inf->task) - error ("No inferior task."); - - err = mach_port_extract_right (proc->inf->task->port, - name, MACH_MSG_TYPE_COPY_SEND, - &port, &port_type); - if (err) - error ("Couldn't extract send right %d from inferior: %s", - name, strerror (err)); - - if (proc->saved_exc_port) - /* Get rid of our reference to the old one. */ - mach_port_deallocate (mach_task_self (), proc->saved_exc_port); - - proc->saved_exc_port = port; - - if (! proc->exc_port) - /* If PROC is a thread, we may not have set its exception port before. - We can't use proc_steal_exc_port because it also sets saved_exc_port. */ - { - proc->exc_port = proc->inf->event_port; - err = proc_set_exception_port (proc, proc->exc_port); - error ("Can't set exception port for %s: %s", - proc_string (proc), strerror (err)); - } -} - -static void -set_task_exc_port_cmd (char *args, int from_tty) -{ - struct inf *inf = cur_inf (); - if (!args) - error ("No argument to \"set task exception-port\" command."); - steal_exc_port (inf->task, parse_and_eval_address (args)); -} - -static void -set_signals_cmd (char *args, int from_tty) -{ - int trace; - struct inf *inf = cur_inf (); - - inf->want_signals = parse_bool_arg (args, "set signals"); - - if (inf->task && inf->want_signals != inf->traced) - /* Make this take effect immediately in a running process. */ - inf_set_traced (inf, inf->want_signals); -} - -static void -show_signals_cmd (char *args, int from_tty) -{ - struct inf *inf = cur_inf (); - check_empty (args, "show signals"); - printf_unfiltered ("The inferior process's signals %s intercepted.\n", - inf->task - ? (inf->traced ? "are" : "aren't") - : (inf->want_signals ? "will be" : "won't be")); -} - -static void -set_stopped_cmd (char *args, int from_tty) -{ - cur_inf ()->stopped = _parse_bool_arg (args, "yes", "no", "set stopped"); -} - -static void -show_stopped_cmd (char *args, int from_tty) -{ - struct inf *inf = cur_inf (); - check_empty (args, "show stopped"); - if (! inf->task) - error ("No current process."); - printf_unfiltered ("The inferior process %s stopped.\n", - inf->stopped ? "is" : "isn't"); -} - -static void -set_sig_thread_cmd (char *args, int from_tty) -{ - int tid; - struct inf *inf = cur_inf (); - - if (!args || (! isdigit (*args) && strcmp (args, "none") != 0)) - error ("Illegal argument to \"set signal-thread\" command.\n" - "Should be an integer thread ID, or `none'."); - - if (strcmp (args, "none") == 0) - inf->signal_thread = 0; - else - { - int tid = thread_id_to_pid (atoi (args)); - if (tid < 0) - error ("Thread ID %s not known. Use the \"info threads\" command to\n" - "see the IDs of currently known threads.", args); - inf->signal_thread = inf_tid_to_thread (inf, tid); - } -} - -static void -show_sig_thread_cmd (char *args, int from_tty) -{ - struct inf *inf = cur_inf (); - check_empty (args, "show signal-thread"); - if (! inf->task) - error ("No current process."); - if (inf->signal_thread) - printf_unfiltered ("The signal thread is %s.\n", - proc_string (inf->signal_thread)); - else - printf_unfiltered ("There is no signal thread.\n"); -} - -static void -set_exceptions_cmd (char *args, int from_tty) -{ - struct inf *inf = cur_inf (); - int val = parse_bool_arg (args, "set exceptions"); - - if (inf->task && inf->want_exceptions != val) - /* Make this take effect immediately in a running process. */ - /* XXX */; - - inf->want_exceptions = val; -} - -static void -show_exceptions_cmd (char *args, int from_tty) -{ - struct inf *inf = cur_inf (); - check_empty (args, "show exceptions"); - printf_unfiltered ("Exceptions in the inferior %s trapped.\n", - inf->task - ? (inf->want_exceptions ? "are" : "aren't") - : (inf->want_exceptions ? "will be" : "won't be")); -} - -static void -set_task_cmd (char *args, int from_tty) -{ - printf_unfiltered ("\"set task\" must be followed by the name of a task property.\n"); -} - -static void -show_task_cmd (char *args, int from_tty) -{ - struct inf *inf = cur_inf (); - - check_empty (args, "show task"); - - show_signals_cmd (0, from_tty); - show_exceptions_cmd (0, from_tty); - show_task_pause_cmd (0, from_tty); - - if (inf->pause_sc == 0) - show_thread_default_pause_cmd (0, from_tty); - show_thread_default_run_cmd (0, from_tty); - - if (inf->task) - { - show_stopped_cmd (0, from_tty); - show_sig_thread_cmd (0, from_tty); - } -} - -static void add_task_commands () -{ - add_cmd ("pause", class_run, set_thread_default_pause_cmd, - "Set whether the new threads are suspended while gdb has control.\n" - "This property normally has no effect because the whole task is\n" - "suspended, however, that may be disabled with \"set task pause off\".\n" - "The default value is \"off\".", - &set_thread_default_cmd_list); - add_cmd ("pause", no_class, show_thread_default_pause_cmd, - "Show whether new threads are suspended while gdb has control.", - &show_thread_default_cmd_list); - add_cmd ("run", class_run, set_thread_default_run_cmd, - "Set whether new threads are allowed to run (once gdb has noticed them).", - &set_thread_default_cmd_list); - add_cmd ("run", no_class, show_thread_default_run_cmd, - "Show whether new threads are allowed to run (once gdb has noticed -them).", - &show_thread_default_cmd_list); - - add_cmd ("signals", class_run, set_signals_cmd, - "Set whether the inferior process's signals will be intercepted.\n" - "Mach exceptions (such as breakpoint traps) are not affected.", - &setlist); - add_alias_cmd ("sigs", "signals", class_run, 1, &setlist); - add_cmd ("signals", no_class, show_signals_cmd, - "Show whether the inferior process's signals will be intercepted.", - &showlist); - add_alias_cmd ("sigs", "signals", no_class, 1, &showlist); - - add_cmd ("signal-thread", class_run, set_sig_thread_cmd, - "Set the thread that gdb thinks is the libc signal thread.\n" - "This thread is run when delivering a signal to a non-stopped process.", - &setlist); - add_alias_cmd ("sigthread", "signal-thread", class_run, 1, &setlist); - add_cmd ("signal-thread", no_class, show_sig_thread_cmd, - "Set the thread that gdb thinks is the libc signal thread.", - &showlist); - add_alias_cmd ("sigthread", "signal-thread", no_class, 1, &showlist); - - add_cmd ("stopped", class_run, set_stopped_cmd, - "Set whether gdb thinks the inferior process is stopped as with SIGSTOP.\n" - "Stopped process will be continued by sending them a signal.", - &setlist); - add_cmd ("stopped", no_class, show_signals_cmd, - "Show whether gdb thinks the inferior process is stopped as with SIGSTOP.", - &showlist); - - add_cmd ("exceptions", class_run, set_exceptions_cmd, - "Set whether exceptions in the inferior process will be trapped.\n" - "When exceptions are turned off, neither breakpoints nor single-stepping\n" - "will work.", - &setlist); - /* Allow `set exc' despite conflict with `set exception-port'. */ - add_alias_cmd ("exc", "exceptions", class_run, 1, &setlist); - add_cmd ("exceptions", no_class, show_exceptions_cmd, - "Show whether exceptions in the inferior process will be trapped.", - &showlist); - - - - add_prefix_cmd ("task", no_class, set_task_cmd, - "Command prefix for setting task attributes.", - &set_task_cmd_list, "set task ", 0, &setlist); - add_prefix_cmd ("task", no_class, show_task_cmd, - "Command prefix for showing task attributes.", - &show_task_cmd_list, "show task ", 0, &showlist); - - add_cmd ("pause", class_run, set_task_pause_cmd, - "Set whether the task is suspended while gdb has control.\n" - "A value of \"on\" takes effect immediately, otherwise nothing\n" - "happens until the next time the program is continued.\n" - "When setting this to \"off\", \"set thread default pause on\"\n" - "can be used to pause individual threads by default instead.", - &set_task_cmd_list); - add_cmd ("pause", no_class, show_task_pause_cmd, - "Show whether the task is suspended while gdb has control.", - &show_task_cmd_list); - - add_cmd ("exception-port", no_class, set_task_exc_port_cmd, - "Set the task exception port to which we forward exceptions.\n" - "The argument should be the value of the send right in the task.", - &set_task_cmd_list); - add_alias_cmd ("excp", "exception-port", no_class, 1, &set_task_cmd_list); - add_alias_cmd ("exc-port", "exception-port", no_class, 1, &set_task_cmd_list); -} - -/* User thread commands. */ - -extern struct cmd_list_element *set_thread_cmd_list; -extern struct cmd_list_element *show_thread_cmd_list; - -static void -set_thread_pause_cmd (char *args, int from_tty) -{ - struct proc *thread = cur_thread (); - int old_sc = thread->pause_sc; - thread->pause_sc = parse_bool_arg (args, "set thread pause"); - if (old_sc == 0 && thread->pause_sc != 0 && thread->inf->pause_sc == 0) - /* If the task is currently unsuspended, immediately suspend it, - otherwise wait until the next time it gets control. */ - inf_suspend (thread->inf); -} - -static void -show_thread_pause_cmd (char *args, int from_tty) -{ - struct proc *thread = cur_thread (); - int sc = thread->pause_sc; - check_empty (args, "show task pause"); - printf_unfiltered ("Thread %s %s suspended while gdb has control%s.\n", - proc_string (thread), - sc ? "is" : "isn't", - !sc && thread->inf->pause_sc ? "(but the task is)" : ""); -} - -static void -set_thread_run_cmd (char *args, int from_tty) -{ - struct proc *thread = cur_thread (); - thread->run_sc = parse_bool_arg (args, "set thread run") ? 0 : 1; -} - -static void -show_thread_run_cmd (char *args, int from_tty) -{ - struct proc *thread = cur_thread (); - check_empty (args, "show thread run"); - printf_unfiltered ("Thread %s allowed to run.", - proc_string (thread), - thread->run_sc == 0 ? "is" : "isn't"); -} - -static void -set_thread_exc_port_cmd (char *args, int from_tty) -{ - struct proc *thread = cur_thread (); - if (!args) - error ("No argument to \"set thread exception-port\" command."); - steal_exc_port (thread, parse_and_eval_address (args)); -} - -static void -set_thread_cmd (char *args, int from_tty) -{ - printf_unfiltered ("\"set thread\" must be followed by the name of a thread property.\n"); -} - -static void -show_thread_cmd (char *args, int from_tty) -{ - check_empty (args, "show thread"); - show_thread_run_cmd (0, from_tty); - show_thread_pause_cmd (0, from_tty); -} - -add_thread_commands () -{ - add_cmd ("pause", class_run, set_thread_pause_cmd, - "Set whether the current thread is suspended while gdb has control.\n" - "A value of \"on\" takes effect immediately, otherwise nothing\n" - "happens until the next time the program is continued. This\n" - "property normally has no effect because the whole task is suspended,\n" - "however, that may be disabled with \"set task pause off\".\n" - "The default value is \"off\".", - &set_thread_cmd_list); - add_cmd ("pause", no_class, show_thread_pause_cmd, - "Show whether the current thread is suspended while gdb has control.", - &show_thread_cmd_list); - - add_cmd ("run", class_run, set_thread_run_cmd, - "Set whether the current thread is allowed to run.", - &set_thread_cmd_list); - add_cmd ("run", no_class, show_thread_run_cmd, - "Show whether the current thread is allowed to run.", - &show_thread_cmd_list); - - add_cmd ("exception-port", no_class, set_thread_exc_port_cmd, - "Set the exception port to which we forward exceptions for the\n" - "current thread, overriding the task exception port.\n" - "The argument should be the value of the send right in the task.", - &set_thread_cmd_list); - add_alias_cmd ("excp", "exception-port", no_class, 1, &set_thread_cmd_list); - add_alias_cmd ("exc-port", "exception-port", no_class, 1, &set_thread_cmd_list); -} - -void -_initialize_gnu_nat () -{ - proc_server = getproc (); - - add_target (&gnu_ops); - - add_task_commands (); - add_thread_commands (); - -#if MAINTENANCE_CMDS - add_set_cmd ("gnu-debug", class_maintenance, - var_boolean, (char *)&gnu_debug_flag, - "Set debugging output for the gnu backend.", &maintenancelist); -#endif -} - -#ifdef FLUSH_INFERIOR_CACHE - -/* When over-writing code on some machines the I-Cache must be flushed - explicitly, because it is not kept coherent by the lazy hardware. - This definitely includes breakpoints, for instance, or else we - end up looping in mysterious Bpt traps */ - -void -flush_inferior_icache(pc, amount) - CORE_ADDR pc; -{ - vm_machine_attribute_val_t flush = MATTR_VAL_ICACHE_FLUSH; - error_t ret; - - ret = vm_machine_attribute (current_inferior->task->port, - pc, - amount, - MATTR_CACHE, - &flush); - if (ret != KERN_SUCCESS) - warning ("Error flushing inferior's cache : %s", strerror (ret)); -} -#endif FLUSH_INFERIOR_CACHE diff --git a/contrib/gdb/gdb/gnu-nat.h b/contrib/gdb/gdb/gnu-nat.h deleted file mode 100644 index 6f29b73..0000000 --- a/contrib/gdb/gdb/gnu-nat.h +++ /dev/null @@ -1,91 +0,0 @@ -/* Common things used by the various *gnu-nat.c files - - Copyright (C) 1995 Free Software Foundation, Inc. - - Written by Miles Bader - - The GNU Hurd 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. - - The GNU Hurd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#ifndef __GNU_NAT_H__ -#define __GNU_NAT_H__ - -#include -#include - -struct inf; - -extern struct inf *current_inferior; - -/* Converts a GDB pid to a struct proc. */ -struct proc *inf_tid_to_thread (struct inf *inf, int tid); - -/* A proc is either a thread, or the task (there can only be one task proc - because it always has the same TID, PROC_TID_TASK). */ -struct proc -{ - thread_t port; /* The task or thread port. */ - int tid; /* The GDB pid (actually a thread id). */ - int num; /* An id number for threads, to print. */ - - mach_port_t saved_exc_port; /* The task/thread's real exception port. */ - mach_port_t exc_port; /* Our replacement, which for. */ - - int sc; /* Desired suspend count. */ - int cur_sc; /* Implemented suspend count. */ - int run_sc; /* Default sc when the program is running. */ - int pause_sc; /* Default sc when gdb has control. */ - int resume_sc; /* Sc resulting form the last resume. */ - - thread_state_data_t state; /* Registers, &c. */ - int state_valid : 1; /* True if STATE is up to date. */ - int state_changed : 1; - - int aborted : 1; /* True if thread_abort has been called. */ - - /* Bit mask of registers fetched by gdb. This is used when we re-fetch - STATE after aborting the thread, to detect that gdb may have out-of-date - information. */ - unsigned long fetched_regs; - - struct inf *inf; /* Where we come from. */ - - struct proc *next; -}; - -/* The task has a thread entry with this TID. */ -#define PROC_TID_TASK (-1) - -#define proc_is_task(proc) ((proc)->tid == PROC_TID_TASK) -#define proc_is_thread(proc) ((proc)->tid != PROC_TID_TASK) - -extern int __proc_pid (struct proc *proc); - -extern thread_state_t proc_get_state (struct proc *proc, int will_modify); - -#define proc_debug(_proc, msg, args...) \ - do { struct proc *__proc = (_proc); \ - debug ("{proc %d/%d %p}: " msg, \ - __proc_pid (__proc), __proc->tid, __proc , ##args); } while (0) - -#if MAINTENANCE_CMDS -extern int gnu_debug_flag; -#define debug(msg, args...) \ - do { if (gnu_debug_flag) \ - fprintf (stderr, "%s: " msg "\r\n", __FUNCTION__ , ##args); } while (0) -#else -#define debug(msg, args...) (void)0 -#endif - -#endif /* __GNU_NAT_H__ */ diff --git a/contrib/gdb/gdb/go32-xdep.c b/contrib/gdb/gdb/go32-xdep.c deleted file mode 100644 index 01c817a..0000000 --- a/contrib/gdb/gdb/go32-xdep.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Host-dependent code for dos running GO32 for GDB, the GNU debugger. - Copyright 1992 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include - -int -sigsetmask (mask) - int mask; -{ - return 0; -} - -void -strlwr (str) - char *str; -{ - for (; *str; str++) - *str = tolower(*str); -} diff --git a/contrib/gdb/gdb/i386-stub.c b/contrib/gdb/gdb/i386-stub.c deleted file mode 100644 index ce53c48..0000000 --- a/contrib/gdb/gdb/i386-stub.c +++ /dev/null @@ -1,915 +0,0 @@ -/**************************************************************************** - - THIS SOFTWARE IS NOT COPYRIGHTED - - HP offers the following for use in the public domain. HP makes no - warranty with regard to the software or it's performance and the - user accepts the software "AS IS" with all faults. - - HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD - TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - -****************************************************************************/ - -/**************************************************************************** - * Header: remcom.c,v 1.34 91/03/09 12:29:49 glenne Exp $ - * - * Module name: remcom.c $ - * Revision: 1.34 $ - * Date: 91/03/09 12:29:49 $ - * Contributor: Lake Stevens Instrument Division$ - * - * Description: low level support for gdb debugger. $ - * - * Considerations: only works on target hardware $ - * - * Written by: Glenn Engel $ - * ModuleState: Experimental $ - * - * NOTES: See Below $ - * - * Modified for 386 by Jim Kingdon, Cygnus Support. - * - * To enable debugger support, two things need to happen. One, a - * call to set_debug_traps() is necessary in order to allow any breakpoints - * or error conditions to be properly intercepted and reported to gdb. - * Two, a breakpoint needs to be generated to begin communication. This - * is most easily accomplished by a call to breakpoint(). Breakpoint() - * simulates a breakpoint by executing a trap #1. - * - * The external function exceptionHandler() is - * used to attach a specific handler to a specific 386 vector number. - * It should use the same privilege level it runs at. It should - * install it as an interrupt gate so that interrupts are masked - * while the handler runs. - * Also, need to assign exceptionHook and oldExceptionHook. - * - * Because gdb will sometimes write to the stack area to execute function - * calls, this program cannot rely on using the supervisor stack so it - * uses it's own stack area reserved in the int array remcomStack. - * - ************* - * - * The following gdb commands are supported: - * - * command function Return value - * - * g return the value of the CPU registers hex data or ENN - * G set the value of the CPU registers OK or ENN - * - * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN - * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN - * - * c Resume at current address SNN ( signal NN) - * cAA..AA Continue at address AA..AA SNN - * - * s Step one instruction SNN - * sAA..AA Step one instruction from AA..AA SNN - * - * k kill - * - * ? What was the last sigval ? SNN (signal NN) - * - * All commands and responses are sent with a packet which includes a - * checksum. A packet consists of - * - * $#. - * - * where - * :: - * :: < two hex digits computed as modulo 256 sum of > - * - * When a packet is received, it is first acknowledged with either '+' or '-'. - * '+' indicates a successful transfer. '-' indicates a failed transfer. - * - * Example: - * - * Host: Reply: - * $m0,10#2a +$00010203040506070809101112131415#42 - * - ****************************************************************************/ - -#include -#include - -/************************************************************************ - * - * external low-level support routines - */ -typedef void (*ExceptionHook)(int); /* pointer to function with int parm */ -typedef void (*Function)(); /* pointer to a function */ - -extern putDebugChar(); /* write a single character */ -extern getDebugChar(); /* read and return a single char */ - -extern Function exceptionHandler(); /* assign an exception handler */ -extern ExceptionHook exceptionHook; /* hook variable for errors/exceptions */ - -/************************************************************************/ -/* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/ -/* at least NUMREGBYTES*2 are needed for register packets */ -#define BUFMAX 400 - -static char initialized; /* boolean flag. != 0 means we've been initialized */ - -int remote_debug; -/* debug > 0 prints ill-formed commands in valid packets & checksum errors */ - -void waitabit(); - -static const char hexchars[]="0123456789abcdef"; - -/* Number of bytes of registers. */ -#define NUMREGBYTES 64 -enum regnames {EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI, - PC /* also known as eip */, - PS /* also known as eflags */, - CS, SS, DS, ES, FS, GS}; - -/* - * these should not be static cuz they can be used outside this module - */ -int registers[NUMREGBYTES/4]; - -#define STACKSIZE 10000 -int remcomStack[STACKSIZE/sizeof(int)]; -static int* stackPtr = &remcomStack[STACKSIZE/sizeof(int) - 1]; - -/* - * In many cases, the system will want to continue exception processing - * when a continue command is given. - * oldExceptionHook is a function to invoke in this case. - */ - -static ExceptionHook oldExceptionHook; - -/*************************** ASSEMBLY CODE MACROS *************************/ -/* */ - -extern void -return_to_prog (); - -/* Restore the program's registers (including the stack pointer, which - means we get the right stack and don't have to worry about popping our - return address and any stack frames and so on) and return. */ -asm(".text"); -asm(".globl _return_to_prog"); -asm("_return_to_prog:"); -asm(" movw _registers+44, %ss"); -asm(" movl _registers+16, %esp"); -asm(" movl _registers+4, %ecx"); -asm(" movl _registers+8, %edx"); -asm(" movl _registers+12, %ebx"); -asm(" movl _registers+20, %ebp"); -asm(" movl _registers+24, %esi"); -asm(" movl _registers+28, %edi"); -asm(" movw _registers+48, %ds"); -asm(" movw _registers+52, %es"); -asm(" movw _registers+56, %fs"); -asm(" movw _registers+60, %gs"); -asm(" movl _registers+36, %eax"); -asm(" pushl %eax"); /* saved eflags */ -asm(" movl _registers+40, %eax"); -asm(" pushl %eax"); /* saved cs */ -asm(" movl _registers+32, %eax"); -asm(" pushl %eax"); /* saved eip */ -asm(" movl _registers, %eax"); -/* use iret to restore pc and flags together so - that trace flag works right. */ -asm(" iret"); - -#define BREAKPOINT() asm(" int $3"); - -/* Put the error code here just in case the user cares. */ -int gdb_i386errcode; -/* Likewise, the vector number here (since GDB only gets the signal - number through the usual means, and that's not very specific). */ -int gdb_i386vector = -1; - -/* GDB stores segment registers in 32-bit words (that's just the way - m-i386v.h is written). So zero the appropriate areas in registers. */ -#define SAVE_REGISTERS1() \ - asm ("movl %eax, _registers"); \ - asm ("movl %ecx, _registers+4"); \ - asm ("movl %edx, _registers+8"); \ - asm ("movl %ebx, _registers+12"); \ - asm ("movl %ebp, _registers+20"); \ - asm ("movl %esi, _registers+24"); \ - asm ("movl %edi, _registers+28"); \ - asm ("movw $0, %ax"); \ - asm ("movw %ds, _registers+48"); \ - asm ("movw %ax, _registers+50"); \ - asm ("movw %es, _registers+52"); \ - asm ("movw %ax, _registers+54"); \ - asm ("movw %fs, _registers+56"); \ - asm ("movw %ax, _registers+58"); \ - asm ("movw %gs, _registers+60"); \ - asm ("movw %ax, _registers+62"); -#define SAVE_ERRCODE() \ - asm ("popl %ebx"); \ - asm ("movl %ebx, _gdb_i386errcode"); -#define SAVE_REGISTERS2() \ - asm ("popl %ebx"); /* old eip */ \ - asm ("movl %ebx, _registers+32"); \ - asm ("popl %ebx"); /* old cs */ \ - asm ("movl %ebx, _registers+40"); \ - asm ("movw %ax, _registers+42"); \ - asm ("popl %ebx"); /* old eflags */ \ - asm ("movl %ebx, _registers+36"); \ - /* Now that we've done the pops, we can save the stack pointer."); */ \ - asm ("movw %ss, _registers+44"); \ - asm ("movw %ax, _registers+46"); \ - asm ("movl %esp, _registers+16"); - -/* See if mem_fault_routine is set, if so just IRET to that address. */ -#define CHECK_FAULT() \ - asm ("cmpl $0, _mem_fault_routine"); \ - asm ("jne mem_fault"); - -asm (".text"); -asm ("mem_fault:"); -/* OK to clobber temp registers; we're just going to end up in set_mem_err. */ -/* Pop error code from the stack and save it. */ -asm (" popl %eax"); -asm (" movl %eax, _gdb_i386errcode"); - -asm (" popl %eax"); /* eip */ -/* We don't want to return there, we want to return to the function - pointed to by mem_fault_routine instead. */ -asm (" movl _mem_fault_routine, %eax"); -asm (" popl %ecx"); /* cs (low 16 bits; junk in hi 16 bits). */ -asm (" popl %edx"); /* eflags */ - -/* Remove this stack frame; when we do the iret, we will be going to - the start of a function, so we want the stack to look just like it - would after a "call" instruction. */ -asm (" leave"); - -/* Push the stuff that iret wants. */ -asm (" pushl %edx"); /* eflags */ -asm (" pushl %ecx"); /* cs */ -asm (" pushl %eax"); /* eip */ - -/* Zero mem_fault_routine. */ -asm (" movl $0, %eax"); -asm (" movl %eax, _mem_fault_routine"); - -asm ("iret"); - -#define CALL_HOOK() asm("call _remcomHandler"); - -/* This function is called when a i386 exception occurs. It saves - * all the cpu regs in the _registers array, munges the stack a bit, - * and invokes an exception handler (remcom_handler). - * - * stack on entry: stack on exit: - * old eflags vector number - * old cs (zero-filled to 32 bits) - * old eip - * - */ -extern void _catchException3(); -asm(".text"); -asm(".globl __catchException3"); -asm("__catchException3:"); -SAVE_REGISTERS1(); -SAVE_REGISTERS2(); -asm ("pushl $3"); -CALL_HOOK(); - -/* Same thing for exception 1. */ -extern void _catchException1(); -asm(".text"); -asm(".globl __catchException1"); -asm("__catchException1:"); -SAVE_REGISTERS1(); -SAVE_REGISTERS2(); -asm ("pushl $1"); -CALL_HOOK(); - -/* Same thing for exception 0. */ -extern void _catchException0(); -asm(".text"); -asm(".globl __catchException0"); -asm("__catchException0:"); -SAVE_REGISTERS1(); -SAVE_REGISTERS2(); -asm ("pushl $0"); -CALL_HOOK(); - -/* Same thing for exception 4. */ -extern void _catchException4(); -asm(".text"); -asm(".globl __catchException4"); -asm("__catchException4:"); -SAVE_REGISTERS1(); -SAVE_REGISTERS2(); -asm ("pushl $4"); -CALL_HOOK(); - -/* Same thing for exception 5. */ -extern void _catchException5(); -asm(".text"); -asm(".globl __catchException5"); -asm("__catchException5:"); -SAVE_REGISTERS1(); -SAVE_REGISTERS2(); -asm ("pushl $5"); -CALL_HOOK(); - -/* Same thing for exception 6. */ -extern void _catchException6(); -asm(".text"); -asm(".globl __catchException6"); -asm("__catchException6:"); -SAVE_REGISTERS1(); -SAVE_REGISTERS2(); -asm ("pushl $6"); -CALL_HOOK(); - -/* Same thing for exception 7. */ -extern void _catchException7(); -asm(".text"); -asm(".globl __catchException7"); -asm("__catchException7:"); -SAVE_REGISTERS1(); -SAVE_REGISTERS2(); -asm ("pushl $7"); -CALL_HOOK(); - -/* Same thing for exception 8. */ -extern void _catchException8(); -asm(".text"); -asm(".globl __catchException8"); -asm("__catchException8:"); -SAVE_REGISTERS1(); -SAVE_ERRCODE(); -SAVE_REGISTERS2(); -asm ("pushl $8"); -CALL_HOOK(); - -/* Same thing for exception 9. */ -extern void _catchException9(); -asm(".text"); -asm(".globl __catchException9"); -asm("__catchException9:"); -SAVE_REGISTERS1(); -SAVE_REGISTERS2(); -asm ("pushl $9"); -CALL_HOOK(); - -/* Same thing for exception 10. */ -extern void _catchException10(); -asm(".text"); -asm(".globl __catchException10"); -asm("__catchException10:"); -SAVE_REGISTERS1(); -SAVE_ERRCODE(); -SAVE_REGISTERS2(); -asm ("pushl $10"); -CALL_HOOK(); - -/* Same thing for exception 12. */ -extern void _catchException12(); -asm(".text"); -asm(".globl __catchException12"); -asm("__catchException12:"); -SAVE_REGISTERS1(); -SAVE_ERRCODE(); -SAVE_REGISTERS2(); -asm ("pushl $12"); -CALL_HOOK(); - -/* Same thing for exception 16. */ -extern void _catchException16(); -asm(".text"); -asm(".globl __catchException16"); -asm("__catchException16:"); -SAVE_REGISTERS1(); -SAVE_REGISTERS2(); -asm ("pushl $16"); -CALL_HOOK(); - -/* For 13, 11, and 14 we have to deal with the CHECK_FAULT stuff. */ - -/* Same thing for exception 13. */ -extern void _catchException13 (); -asm (".text"); -asm (".globl __catchException13"); -asm ("__catchException13:"); -CHECK_FAULT(); -SAVE_REGISTERS1(); -SAVE_ERRCODE(); -SAVE_REGISTERS2(); -asm ("pushl $13"); -CALL_HOOK(); - -/* Same thing for exception 11. */ -extern void _catchException11 (); -asm (".text"); -asm (".globl __catchException11"); -asm ("__catchException11:"); -CHECK_FAULT(); -SAVE_REGISTERS1(); -SAVE_ERRCODE(); -SAVE_REGISTERS2(); -asm ("pushl $11"); -CALL_HOOK(); - -/* Same thing for exception 14. */ -extern void _catchException14 (); -asm (".text"); -asm (".globl __catchException14"); -asm ("__catchException14:"); -CHECK_FAULT(); -SAVE_REGISTERS1(); -SAVE_ERRCODE(); -SAVE_REGISTERS2(); -asm ("pushl $14"); -CALL_HOOK(); - -/* - * remcomHandler is a front end for handle_exception. It moves the - * stack pointer into an area reserved for debugger use. - */ -asm("_remcomHandler:"); -asm(" popl %eax"); /* pop off return address */ -asm(" popl %eax"); /* get the exception number */ -asm(" movl _stackPtr, %esp"); /* move to remcom stack area */ -asm(" pushl %eax"); /* push exception onto stack */ -asm(" call _handle_exception"); /* this never returns */ - -void _returnFromException() -{ - return_to_prog (); -} - -int hex(ch) -char ch; -{ - if ((ch >= 'a') && (ch <= 'f')) return (ch-'a'+10); - if ((ch >= '0') && (ch <= '9')) return (ch-'0'); - if ((ch >= 'A') && (ch <= 'F')) return (ch-'A'+10); - return (-1); -} - - -/* scan for the sequence $# */ -void getpacket(buffer) -char * buffer; -{ - unsigned char checksum; - unsigned char xmitcsum; - int i; - int count; - char ch; - - do { - /* wait around for the start character, ignore all other characters */ - while ((ch = (getDebugChar() & 0x7f)) != '$'); - checksum = 0; - xmitcsum = -1; - - count = 0; - - /* now, read until a # or end of buffer is found */ - while (count < BUFMAX) { - ch = getDebugChar() & 0x7f; - if (ch == '#') break; - checksum = checksum + ch; - buffer[count] = ch; - count = count + 1; - } - buffer[count] = 0; - - if (ch == '#') { - xmitcsum = hex(getDebugChar() & 0x7f) << 4; - xmitcsum += hex(getDebugChar() & 0x7f); - if ((remote_debug ) && (checksum != xmitcsum)) { - fprintf (stderr ,"bad checksum. My count = 0x%x, sent=0x%x. buf=%s\n", - checksum,xmitcsum,buffer); - } - - if (checksum != xmitcsum) putDebugChar('-'); /* failed checksum */ - else { - putDebugChar('+'); /* successful transfer */ - /* if a sequence char is present, reply the sequence ID */ - if (buffer[2] == ':') { - putDebugChar( buffer[0] ); - putDebugChar( buffer[1] ); - /* remove sequence chars from buffer */ - count = strlen(buffer); - for (i=3; i <= count; i++) buffer[i-3] = buffer[i]; - } - } - } - } while (checksum != xmitcsum); - -} - -/* send the packet in buffer. */ - - -void putpacket(buffer) -char * buffer; -{ - unsigned char checksum; - int count; - char ch; - - /* $#. */ - do { - putDebugChar('$'); - checksum = 0; - count = 0; - - while (ch=buffer[count]) { - if (! putDebugChar(ch)) return; - checksum += ch; - count += 1; - } - - putDebugChar('#'); - putDebugChar(hexchars[checksum >> 4]); - putDebugChar(hexchars[checksum % 16]); - - } while ((getDebugChar() & 0x7f) != '+'); - -} - -char remcomInBuffer[BUFMAX]; -char remcomOutBuffer[BUFMAX]; -static short error; - - -void debug_error(format, parm) -char * format; -char * parm; -{ - if (remote_debug) fprintf (stderr,format,parm); -} - -/* Address of a routine to RTE to if we get a memory fault. */ -static void (*volatile mem_fault_routine)() = NULL; - -/* Indicate to caller of mem2hex or hex2mem that there has been an - error. */ -static volatile int mem_err = 0; - -void -set_mem_err () -{ - mem_err = 1; -} - -/* These are separate functions so that they are so short and sweet - that the compiler won't save any registers (if there is a fault - to mem_fault, they won't get restored, so there better not be any - saved). */ -int -get_char (addr) - char *addr; -{ - return *addr; -} - -void -set_char (addr, val) - char *addr; - int val; -{ - *addr = val; -} - -/* convert the memory pointed to by mem into hex, placing result in buf */ -/* return a pointer to the last char put in buf (null) */ -/* If MAY_FAULT is non-zero, then we should set mem_err in response to - a fault; if zero treat a fault like any other fault in the stub. */ -char* mem2hex(mem, buf, count, may_fault) -char* mem; -char* buf; -int count; -int may_fault; -{ - int i; - unsigned char ch; - - if (may_fault) - mem_fault_routine = set_mem_err; - for (i=0;i> 4]; - *buf++ = hexchars[ch % 16]; - } - *buf = 0; - if (may_fault) - mem_fault_routine = NULL; - return(buf); -} - -/* convert the hex array pointed to by buf into binary to be placed in mem */ -/* return a pointer to the character AFTER the last byte written */ -char* hex2mem(buf, mem, count, may_fault) -char* buf; -char* mem; -int count; -int may_fault; -{ - int i; - unsigned char ch; - - if (may_fault) - mem_fault_routine = set_mem_err; - for (i=0;i=0) - { - *intValue = (*intValue <<4) | hexValue; - numChars ++; - } - else - break; - - (*ptr)++; - } - - return (numChars); -} - -/* - * This function does all command procesing for interfacing to gdb. - */ -void handle_exception(int exceptionVector) -{ - int sigval; - int addr, length; - char * ptr; - int newPC; - - gdb_i386vector = exceptionVector; - - if (remote_debug) printf("vector=%d, sr=0x%x, pc=0x%x\n", - exceptionVector, - registers[ PS ], - registers[ PC ]); - - /* reply to host that an exception has occurred */ - sigval = computeSignal( exceptionVector ); - remcomOutBuffer[0] = 'S'; - remcomOutBuffer[1] = hexchars[sigval >> 4]; - remcomOutBuffer[2] = hexchars[sigval % 16]; - remcomOutBuffer[3] = 0; - - putpacket(remcomOutBuffer); - - while (1==1) { - error = 0; - remcomOutBuffer[0] = 0; - getpacket(remcomInBuffer); - switch (remcomInBuffer[0]) { - case '?' : remcomOutBuffer[0] = 'S'; - remcomOutBuffer[1] = hexchars[sigval >> 4]; - remcomOutBuffer[2] = hexchars[sigval % 16]; - remcomOutBuffer[3] = 0; - break; - case 'd' : remote_debug = !(remote_debug); /* toggle debug flag */ - break; - case 'g' : /* return the value of the CPU registers */ - mem2hex((char*) registers, remcomOutBuffer, NUMREGBYTES, 0); - break; - case 'G' : /* set the value of the CPU registers - return OK */ - hex2mem(&remcomInBuffer[1], (char*) registers, NUMREGBYTES, 0); - strcpy(remcomOutBuffer,"OK"); - break; - - /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */ - case 'm' : - /* TRY TO READ %x,%x. IF SUCCEED, SET PTR = 0 */ - ptr = &remcomInBuffer[1]; - if (hexToInt(&ptr,&addr)) - if (*(ptr++) == ',') - if (hexToInt(&ptr,&length)) - { - ptr = 0; - mem_err = 0; - mem2hex((char*) addr, remcomOutBuffer, length, 1); - if (mem_err) { - strcpy (remcomOutBuffer, "E03"); - debug_error ("memory fault"); - } - } - - if (ptr) - { - strcpy(remcomOutBuffer,"E01"); - debug_error("malformed read memory command: %s",remcomInBuffer); - } - break; - - /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */ - case 'M' : - /* TRY TO READ '%x,%x:'. IF SUCCEED, SET PTR = 0 */ - ptr = &remcomInBuffer[1]; - if (hexToInt(&ptr,&addr)) - if (*(ptr++) == ',') - if (hexToInt(&ptr,&length)) - if (*(ptr++) == ':') - { - mem_err = 0; - hex2mem(ptr, (char*) addr, length, 1); - - if (mem_err) { - strcpy (remcomOutBuffer, "E03"); - debug_error ("memory fault"); - } else { - strcpy(remcomOutBuffer,"OK"); - } - - ptr = 0; - } - if (ptr) - { - strcpy(remcomOutBuffer,"E02"); - debug_error("malformed write memory command: %s",remcomInBuffer); - } - break; - - /* cAA..AA Continue at address AA..AA(optional) */ - /* sAA..AA Step one instruction from AA..AA(optional) */ - case 'c' : - case 's' : - /* try to read optional parameter, pc unchanged if no parm */ - ptr = &remcomInBuffer[1]; - if (hexToInt(&ptr,&addr)) - registers[ PC ] = addr; - - newPC = registers[ PC]; - - /* clear the trace bit */ - registers[ PS ] &= 0xfffffeff; - - /* set the trace bit if we're stepping */ - if (remcomInBuffer[0] == 's') registers[ PS ] |= 0x100; - - /* - * If we found a match for the PC AND we are not returning - * as a result of a breakpoint (33), - * trace exception (9), nmi (31), jmp to - * the old exception handler as if this code never ran. - */ -#if 0 - /* Don't really think we need this, except maybe for protection - exceptions. */ - /* - * invoke the previous handler. - */ - if (oldExceptionHook) - (*oldExceptionHook) (frame->exceptionVector); - newPC = registers[ PC ]; /* pc may have changed */ -#endif /* 0 */ - - _returnFromException(); /* this is a jump */ - - break; - - /* kill the program */ - case 'k' : /* do nothing */ -#if 0 - /* Huh? This doesn't look like "nothing". - m68k-stub.c and sparc-stub.c don't have it. */ - BREAKPOINT(); -#endif - break; - } /* switch */ - - /* reply to the request */ - putpacket(remcomOutBuffer); - } -} - -/* this function is used to set up exception handlers for tracing and - breakpoints */ -void set_debug_traps() -{ -extern void remcomHandler(); -int exception; - - stackPtr = &remcomStack[STACKSIZE/sizeof(int) - 1]; - - exceptionHandler (0, _catchException0); - exceptionHandler (1, _catchException1); - exceptionHandler (3, _catchException3); - exceptionHandler (4, _catchException4); - exceptionHandler (5, _catchException5); - exceptionHandler (6, _catchException6); - exceptionHandler (7, _catchException7); - exceptionHandler (8, _catchException8); - exceptionHandler (9, _catchException9); - exceptionHandler (10, _catchException10); - exceptionHandler (11, _catchException11); - exceptionHandler (12, _catchException12); - exceptionHandler (13, _catchException13); - exceptionHandler (14, _catchException14); - exceptionHandler (16, _catchException16); - - if (exceptionHook != remcomHandler) - { - oldExceptionHook = exceptionHook; - exceptionHook = remcomHandler; - } - - /* In case GDB is started before us, ack any packets (presumably - "$?#xx") sitting there. */ - putDebugChar ('+'); - - initialized = 1; - -} - -/* This function will generate a breakpoint exception. It is used at the - beginning of a program to sync up with a debugger and can be used - otherwise as a quick means to stop program execution and "break" into - the debugger. */ - -void breakpoint() -{ - if (initialized) -#if 0 - handle_exception(3); -#else - BREAKPOINT(); -#endif - waitabit(); -} - -int waitlimit = 1000000; - -#if 0 -void -bogon() -{ - waitabit(); -} -#endif - -void -waitabit() -{ - int i; - for (i = 0; i < waitlimit; i++) ; -} diff --git a/contrib/gdb/gdb/i386aix-nat.c b/contrib/gdb/gdb/i386aix-nat.c deleted file mode 100644 index 133109e..0000000 --- a/contrib/gdb/gdb/i386aix-nat.c +++ /dev/null @@ -1,360 +0,0 @@ -/* Intel 386 native support. - Copyright (C) 1988, 1989, 1991, 1992 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "defs.h" -#include "frame.h" -#include "inferior.h" -#include "language.h" -#include "gdbcore.h" - -#ifdef USG -#include -#endif - -#include -#include -#include -#include -#include -#include - -#include -#include "gdb_stat.h" - -#include -#include - -/* Does AIX define this in ? */ -extern int errno; - -#ifndef NO_SYS_REG_H -#include -#endif - -#include "floatformat.h" - -#include "target.h" - - -/* this table must line up with REGISTER_NAMES in tm-i386v.h */ -/* symbols like 'EAX' come from */ -static int regmap[] = -{ - EAX, ECX, EDX, EBX, - USP, EBP, ESI, EDI, - EIP, EFL, CS, SS, - DS, ES, FS, GS, -}; - -/* blockend is the value of u.u_ar0, and points to the - * place where GS is stored - */ - -int -i386_register_u_addr (blockend, regnum) - int blockend; - int regnum; -{ -#if 0 - /* this will be needed if fp registers are reinstated */ - /* for now, you can look at them with 'info float' - * sys5 wont let you change them with ptrace anyway - */ - if (regnum >= FP0_REGNUM && regnum <= FP7_REGNUM) - { - int ubase, fpstate; - struct user u; - ubase = blockend + 4 * (SS + 1) - KSTKSZ; - fpstate = ubase + ((char *)&u.u_fpstate - (char *)&u); - return (fpstate + 0x1c + 10 * (regnum - FP0_REGNUM)); - } - else -#endif - return (blockend + 4 * regmap[regnum]); - -} - -/* The code below only work on the aix ps/2 (i386-ibm-aix) - - * mtranle@paris - Sat Apr 11 10:34:12 1992 - */ - -struct env387 -{ - unsigned short control; - unsigned short r0; - unsigned short status; - unsigned short r1; - unsigned short tag; - unsigned short r2; - unsigned long eip; - unsigned short code_seg; - unsigned short opcode; - unsigned long operand; - unsigned short operand_seg; - unsigned short r3; - unsigned char regs[8][10]; -}; - -static -print_387_status (status, ep) - unsigned short status; - struct env387 *ep; -{ - int i; - int bothstatus; - int top; - int fpreg; - unsigned char *p; - - bothstatus = ((status != 0) && (ep->status != 0)); - if (status != 0) - { - if (bothstatus) - printf_unfiltered ("u: "); - print_387_status_word (status); - } - - if (ep->status != 0) - { - if (bothstatus) - printf_unfiltered ("e: "); - print_387_status_word (ep->status); - } - - print_387_control_word (ep->control); - printf_unfiltered ("last exception: "); - printf_unfiltered ("opcode %s; ", local_hex_string(ep->opcode)); - printf_unfiltered ("pc %s:", local_hex_string(ep->code_seg)); - printf_unfiltered ("%s; ", local_hex_string(ep->eip)); - printf_unfiltered ("operand %s", local_hex_string(ep->operand_seg)); - printf_unfiltered (":%s\n", local_hex_string(ep->operand)); - - top = ((ep->status >> 11) & 7); - - printf_unfiltered ("regno tag msb lsb value\n"); - for (fpreg = 7; fpreg >= 0; fpreg--) - { - double val; - - printf_unfiltered ("%s %d: ", fpreg == top ? "=>" : " ", fpreg); - - switch ((ep->tag >> ((7 - fpreg) * 2)) & 3) - { - case 0: printf_unfiltered ("valid "); break; - case 1: printf_unfiltered ("zero "); break; - case 2: printf_unfiltered ("trap "); break; - case 3: printf_unfiltered ("empty "); break; - } - for (i = 9; i >= 0; i--) - printf_unfiltered ("%02x", ep->regs[fpreg][i]); - - i387_to_double ((char *)ep->regs[fpreg], (char *)&val); - printf_unfiltered (" %#g\n", val); - } -} - -static struct env387 core_env387; - -void -i386_float_info () -{ - struct env387 fps; - int fpsaved = 0; - /* We need to reverse the order of the registers. Apparently AIX stores - the highest-numbered ones first. */ - struct env387 fps_fixed; - int i; - - if (inferior_pid) - { - char buf[10]; - unsigned short status; - - ptrace (PT_READ_FPR, inferior_pid, buf, offsetof(struct env387, status)); - memcpy (&status, buf, sizeof (status)); - fpsaved = status; - } - else - { - if ((fpsaved = core_env387.status) != 0) - memcpy(&fps, &core_env387, sizeof(fps)); - } - - if (fpsaved == 0) - { - printf_unfiltered ("no floating point status saved\n"); - return; - } - - if (inferior_pid) - { - int offset; - for (offset = 0; offset < sizeof(fps); offset += 10) - { - char buf[10]; - ptrace (PT_READ_FPR, inferior_pid, buf, offset); - memcpy ((char *)&fps.control + offset, buf, - MIN(10, sizeof(fps) - offset)); - } - } - fps_fixed = fps; - for (i = 0; i < 8; ++i) - memcpy (fps_fixed.regs[i], fps.regs[7 - i], 10); - print_387_status (0, &fps_fixed); -} - -/* Fetch one register. */ -static void -fetch_register (regno) - int regno; -{ - char buf[MAX_REGISTER_RAW_SIZE]; - if (regno < FP0_REGNUM) - *(int *)buf = ptrace (PT_READ_GPR, inferior_pid, - PT_REG(regmap[regno]), 0, 0); - else - ptrace (PT_READ_FPR, inferior_pid, buf, - (regno - FP0_REGNUM)*10 + offsetof(struct env387, regs)); - supply_register (regno, buf); -} - -void -fetch_inferior_registers (regno) - int regno; -{ - if (regno < 0) - for (regno = 0; regno < NUM_REGS; regno++) - fetch_register (regno); - else - fetch_register (regno); -} - -/* store one register */ -static void -store_register (regno) - int regno; -{ - char buf[80]; - extern char registers[]; - errno = 0; - if (regno < FP0_REGNUM) - ptrace (PT_WRITE_GPR, inferior_pid, PT_REG(regmap[regno]), - *(int *) ®isters[REGISTER_BYTE (regno)], 0); - else - ptrace (PT_WRITE_FPR, inferior_pid, ®isters[REGISTER_BYTE (regno)], - (regno - FP0_REGNUM)*10 + offsetof(struct env387, regs)); - - if (errno != 0) - { - sprintf (buf, "writing register number %d", regno); - perror_with_name (buf); - } -} - -/* Store our register values back into the inferior. - If REGNO is -1, do this for all registers. - Otherwise, REGNO specifies which register (so we can save time). */ -void -store_inferior_registers (regno) - int regno; -{ - if (regno < 0) - for (regno = 0; regno < NUM_REGS; regno++) - store_register (regno); - else - store_register (regno); -} - -#ifndef CD_AX /* defined in sys/i386/coredump.h */ -# define CD_AX 0 -# define CD_BX 1 -# define CD_CX 2 -# define CD_DX 3 -# define CD_SI 4 -# define CD_DI 5 -# define CD_BP 6 -# define CD_SP 7 -# define CD_FL 8 -# define CD_IP 9 -# define CD_CS 10 -# define CD_DS 11 -# define CD_ES 12 -# define CD_FS 13 -# define CD_GS 14 -# define CD_SS 15 -#endif - -/* - * The order here in core_regmap[] has to be the same as in - * regmap[] above. - */ -static int core_regmap[] = -{ - CD_AX, CD_CX, CD_DX, CD_BX, - CD_SP, CD_BP, CD_SI, CD_DI, - CD_IP, CD_FL, CD_CS, CD_SS, - CD_DS, CD_ES, CD_FS, CD_GS, -}; - -static void -fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr) - char *core_reg_sect; - unsigned core_reg_size; - int which; - unsigned int reg_addr; /* ignored */ -{ - - if (which == 0) - { - /* Integer registers */ - -#define cd_regs(n) ((int *)core_reg_sect)[n] -#define regs(n) *((int *) ®isters[REGISTER_BYTE (n)]) - - int i; - for (i = 0; i < FP0_REGNUM; i++) - regs(i) = cd_regs(core_regmap[i]); - } - else if (which == 2) - { - /* Floating point registers */ - - if (core_reg_size >= sizeof (core_env387)) - memcpy (&core_env387, core_reg_sect, core_reg_size); - else - fprintf_unfiltered (gdb_stderr, "Couldn't read float regs from core file\n"); - } -} - - -/* Register that we are able to handle i386aix core file formats. - FIXME: is this really bfd_target_unknown_flavour? */ - -static struct core_fns i386aix_core_fns = -{ - bfd_target_unknown_flavour, - fetch_core_registers, - NULL -}; - -void -_initialize_core_i386aix () -{ - add_core_fns (&i386aix_core_fns); -} diff --git a/contrib/gdb/gdb/i386gnu-nat.c b/contrib/gdb/gdb/i386gnu-nat.c deleted file mode 100644 index 63c3bd0..0000000 --- a/contrib/gdb/gdb/i386gnu-nat.c +++ /dev/null @@ -1,348 +0,0 @@ -/* Low level interface to I386 running the GNU Hurd - Copyright (C) 1992 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "defs.h" -#include "inferior.h" -#include "floatformat.h" - -#include - -#include -#include -#include -#include - -#include "gnu-nat.h" - -/* Hmmm... Should this not be here? - * Now for i386_float_info() target_has_execution - */ -#include - -/* @@@ Should move print_387_status() to i387-tdep.c */ -extern void print_387_control_word (); /* i387-tdep.h */ -extern void print_387_status_word (); - -/* Find offsets to thread states at compile time. - * If your compiler does not grok this, calculate offsets - * offsets yourself and use them (or get a compatible compiler :-) - */ - -#define REG_OFFSET(reg) (int)(&((struct i386_thread_state *)0)->reg) - -/* at reg_offset[i] is the offset to the i386_thread_state - * location where the gdb registers[i] is stored. - */ - -static int reg_offset[] = -{ - REG_OFFSET(eax), REG_OFFSET(ecx), REG_OFFSET(edx), REG_OFFSET(ebx), - REG_OFFSET(uesp), REG_OFFSET(ebp), REG_OFFSET(esi), REG_OFFSET(edi), - REG_OFFSET(eip), REG_OFFSET(efl), REG_OFFSET(cs), REG_OFFSET(ss), - REG_OFFSET(ds), REG_OFFSET(es), REG_OFFSET(fs), REG_OFFSET(gs) -}; - -#define REG_ADDR(state,regnum) ((char *)(state)+reg_offset[regnum]) - -/* Fetch COUNT contiguous registers from thread STATE starting from REGNUM - * Caller knows that the regs handled in one transaction are of same size. - */ -#define FETCH_REGS(state, regnum, count) \ - memcpy (®isters[REGISTER_BYTE (regnum)], \ - REG_ADDR (state, regnum), \ - count * REGISTER_RAW_SIZE (regnum)) - -/* Store COUNT contiguous registers to thread STATE starting from REGNUM */ -#define STORE_REGS(state, regnum, count) \ - memcpy (REG_ADDR (state, regnum), \ - ®isters[REGISTER_BYTE (regnum)], \ - count * REGISTER_RAW_SIZE (regnum)) - -/* - * Fetch inferiors registers for gdb. - * REG specifies which (as gdb views it) register, -1 for all. - */ -void -gnu_fetch_registers (int reg) -{ - thread_state_t state; - struct proc *thread = inf_tid_to_thread (current_inferior, inferior_pid); - - if (!thread) - error ("fetch inferior registers: %d: Invalid thread", inferior_pid); - - state = proc_get_state (thread, 0); - - if (! state) - warning ("Couldn't fetch register %s.", reg_names[reg]); - else if (reg >= 0) - { - proc_debug (thread, "fetching register: %s", reg_names[reg]); - supply_register (reg, REG_ADDR(state, reg)); - thread->fetched_regs |= (1 << reg); - } - else - { - proc_debug (thread, "fetching all registers"); - for (reg = 0; reg < NUM_REGS; reg++) - supply_register (reg, REG_ADDR(state, reg)); - thread->fetched_regs = ~0; - } -} - -/* Store our register values back into the inferior. - * If REG is -1, do this for all registers. - * Otherwise, REG specifies which register - * - * On mach3 all registers are always saved in one call. - */ -void -gnu_store_registers (reg) - int reg; -{ - int was_aborted, was_valid; - thread_state_t state; - thread_state_data_t old_state; - struct proc *thread = inf_tid_to_thread (current_inferior, inferior_pid); - - if (! thread) - error ("store inferior registers: %d: Invalid thread", inferior_pid); - - proc_debug (thread, "storing register %s.", reg_names[reg]); - - was_aborted = thread->aborted; - was_valid = thread->state_valid; - if (! was_aborted && was_valid) - bcopy (&thread->state, &old_state, sizeof (old_state)); - - state = proc_get_state (thread, 1); - - if (! state) - warning ("Couldn't store register %s.", reg_names[reg]); - else - { - if (! was_aborted && was_valid) - /* See which registers have changed after aborting the thread. */ - { - int check_reg; - for (check_reg = 0; check_reg < NUM_REGS; check_reg++) - if ((thread->fetched_regs & (1 << check_reg)) - && bcmp (REG_ADDR (&old_state, check_reg), - REG_ADDR (state, check_reg), - REGISTER_RAW_SIZE (check_reg))) - /* Register CHECK_REG has changed! Ack! */ - { - warning ("Register %s changed after thread was aborted.", - reg_names [check_reg]); - if (reg >= 0 && reg != check_reg) - /* Update gdb's copy of the register. */ - supply_register (check_reg, REG_ADDR (state, check_reg)); - else - warning ("... also writing this register! Suspicious..."); - } - } - - if (reg >= 0) - { - proc_debug (thread, "storing register: %s", reg_names[reg]); - STORE_REGS (state, reg, 1); - } - else - { - proc_debug (thread, "storing all registers"); - for (reg = 0; reg < NUM_REGS; reg++) - STORE_REGS (state, reg, 1); - } - } -} - -/* jtv@hut.fi: I copied and modified this 387 code from - * gdb/i386-xdep.c. Modifications for Mach 3.0. - * - * i387 status dumper. See also i387-tdep.c - */ -struct env387 -{ - unsigned short control; - unsigned short r0; - unsigned short status; - unsigned short r1; - unsigned short tag; - unsigned short r2; - unsigned long eip; - unsigned short code_seg; - unsigned short opcode; - unsigned long operand; - unsigned short operand_seg; - unsigned short r3; - unsigned char regs[8][10]; -}; -/* This routine is machine independent? - * Should move it to i387-tdep.c but you need to export struct env387 - */ -static -print_387_status (status, ep) - unsigned short status; - struct env387 *ep; -{ - int i; - int bothstatus; - int top; - int fpreg; - unsigned char *p; - - bothstatus = ((status != 0) && (ep->status != 0)); - if (status != 0) - { - if (bothstatus) - printf_unfiltered ("u: "); - print_387_status_word (status); - } - - if (ep->status != 0) - { - if (bothstatus) - printf_unfiltered ("e: "); - print_387_status_word (ep->status); - } - - print_387_control_word (ep->control); - printf_unfiltered ("last exception: "); - printf_unfiltered ("opcode %s; ", local_hex_string(ep->opcode)); - printf_unfiltered ("pc %s:", local_hex_string(ep->code_seg)); - printf_unfiltered ("%s; ", local_hex_string(ep->eip)); - printf_unfiltered ("operand %s", local_hex_string(ep->operand_seg)); - printf_unfiltered (":%s\n", local_hex_string(ep->operand)); - - top = (ep->status >> 11) & 7; - - printf_unfiltered ("regno tag msb lsb value\n"); - for (fpreg = 7; fpreg >= 0; fpreg--) - { - double val; - - printf_unfiltered ("%s %d: ", fpreg == top ? "=>" : " ", fpreg); - - switch ((ep->tag >> (fpreg * 2)) & 3) - { - case 0: printf_unfiltered ("valid "); break; - case 1: printf_unfiltered ("zero "); break; - case 2: printf_unfiltered ("trap "); break; - case 3: printf_unfiltered ("empty "); break; - } - for (i = 9; i >= 0; i--) - printf_unfiltered ("%02x", ep->regs[fpreg][i]); - - floatformat_to_double (&floatformat_i387_ext, (char *)ep->regs[fpreg], - &val); - printf_unfiltered (" %g\n", val); - } - if (ep->r0) - printf_unfiltered ("warning: reserved0 is %s\n", local_hex_string(ep->r0)); - if (ep->r1) - printf_unfiltered ("warning: reserved1 is %s\n", local_hex_string(ep->r1)); - if (ep->r2) - printf_unfiltered ("warning: reserved2 is %s\n", local_hex_string(ep->r2)); - if (ep->r3) - printf_unfiltered ("warning: reserved3 is %s\n", local_hex_string(ep->r3)); -} - -/* - * values that go into fp_kind (from ) - */ -#define FP_NO 0 /* no fp chip, no emulator (no fp support) */ -#define FP_SW 1 /* no fp chip, using software emulator */ -#define FP_HW 2 /* chip present bit */ -#define FP_287 2 /* 80287 chip present */ -#define FP_387 3 /* 80387 chip present */ - -typedef struct fpstate { -#if 1 - unsigned char state[FP_STATE_BYTES]; /* "hardware" state */ -#else - struct env387 state; /* Actually this */ -#endif - int status; /* Duplicate status */ -} *fpstate_t; - -/* Mach 3 specific routines. - */ -static int -get_i387_state (fstate) - struct fpstate *fstate; -{ - error_t err; - thread_state_data_t state; - unsigned int fsCnt = i386_FLOAT_STATE_COUNT; - struct i386_float_state *fsp; - struct proc *thread = inf_tid_to_thread (current_inferior, inferior_pid); - - if (!thread) - error ("get_i387_state: Invalid thread"); - - proc_abort (thread, 0); /* Make sure THREAD's in a reasonable state. */ - - err = thread_get_state (thread->port, i386_FLOAT_STATE, state, &fsCnt); - if (err) - { - warning ("Can not get live floating point state: %s", - mach_error_string (err)); - return 0; - } - - fsp = (struct i386_float_state *)state; - /* The 387 chip (also 486 counts) or a software emulator? */ - if (!fsp->initialized || (fsp->fpkind != FP_387 && fsp->fpkind != FP_SW)) - return 0; - - /* Clear the target then copy thread's float state there. - Make a copy of the status word, for some reason? - */ - memset (fstate, 0, sizeof (struct fpstate)); - - fstate->status = fsp->exc_status; - - memcpy (fstate->state, (char *)&fsp->hw_state, FP_STATE_BYTES); - - return 1; -} - -/* - * This is called by "info float" command - */ -void -i386_mach3_float_info() -{ - char buf [sizeof (struct fpstate) + 2 * sizeof (int)]; - int valid = 0; - fpstate_t fps; - - if (target_has_execution) - valid = get_i387_state (buf); - - if (!valid) - { - warning ("no floating point status saved"); - return; - } - - fps = (fpstate_t) buf; - - print_387_status (fps->status, (struct env387 *)fps->state); -} diff --git a/contrib/gdb/gdb/i386ly-tdep.c b/contrib/gdb/gdb/i386ly-tdep.c deleted file mode 100644 index dcb4584..0000000 --- a/contrib/gdb/gdb/i386ly-tdep.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Target-dependent code for Intel 386 running LynxOS. - Copyright 1993 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "defs.h" -#include "inferior.h" -#include "target.h" - -/* Return the PC of the caller from the call frame. Assumes the subr prologue - has already been executed, and the frame pointer setup. If this is the - outermost frame, we check to see if we are in a system call by examining the - previous instruction. If so, then the return PC is actually at SP+4 because - system calls use a different calling sequence. */ - -CORE_ADDR -i386lynx_saved_pc_after_call (frame) - struct frame_info *frame; -{ - char opcode[7]; - static const unsigned char call_inst[] = {0x9a, 0, 0, 0, 0, 8, 0}; /* lcall 0x8,0x0 */ - - read_memory (frame->pc - 7, opcode, 7); - if (memcmp (opcode, call_inst, 7) == 0) - return read_memory_integer (read_register (SP_REGNUM) + 4, 4); - - return read_memory_integer (read_register (SP_REGNUM), 4); -} diff --git a/contrib/gdb/gdb/i386m3-nat.c b/contrib/gdb/gdb/i386m3-nat.c deleted file mode 100644 index bbaa022..0000000 --- a/contrib/gdb/gdb/i386m3-nat.c +++ /dev/null @@ -1,421 +0,0 @@ -/* Low level interface to I386 running mach 3.0. - Copyright (C) 1992 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "defs.h" -#include "inferior.h" -#include "floatformat.h" - -#include - -#include -#include -#include -#include - -/* Hmmm... Should this not be here? - * Now for i386_float_info() target_has_execution - */ -#include - -/* This mess is duplicated in bfd/i386mach3.h - * - * This is an ugly way to hack around the incorrect - * definition of UPAGES in i386/machparam.h. - * - * The definition should specify the size reserved - * for "struct user" in core files in PAGES, - * but instead it gives it in 512-byte core-clicks - * for i386 and i860. - */ -#include -#if UPAGES == 16 -#define UAREA_SIZE ctob(UPAGES) -#elif UPAGES == 2 -#define UAREA_SIZE (NBPG*UPAGES) -#else -FIXME!! UPAGES is neither 2 nor 16 -#endif - -/* @@@ Should move print_387_status() to i387-tdep.c */ -extern void print_387_control_word (); /* i387-tdep.h */ -extern void print_387_status_word (); - -#define private static - - -/* Find offsets to thread states at compile time. - * If your compiler does not grok this, calculate offsets - * offsets yourself and use them (or get a compatible compiler :-) - */ - -#define REG_OFFSET(reg) (int)(&((struct i386_thread_state *)0)->reg) - -/* at reg_offset[i] is the offset to the i386_thread_state - * location where the gdb registers[i] is stored. - */ - -static int reg_offset[] = -{ - REG_OFFSET(eax), REG_OFFSET(ecx), REG_OFFSET(edx), REG_OFFSET(ebx), - REG_OFFSET(uesp), REG_OFFSET(ebp), REG_OFFSET(esi), REG_OFFSET(edi), - REG_OFFSET(eip), REG_OFFSET(efl), REG_OFFSET(cs), REG_OFFSET(ss), - REG_OFFSET(ds), REG_OFFSET(es), REG_OFFSET(fs), REG_OFFSET(gs) -}; - -#define REG_ADDRESS(state,regnum) ((char *)(state)+reg_offset[regnum]) - -/* Fetch COUNT contiguous registers from thread STATE starting from REGNUM - * Caller knows that the regs handled in one transaction are of same size. - */ -#define FETCH_REGS(state, regnum, count) \ - memcpy (®isters[REGISTER_BYTE (regnum)], \ - REG_ADDRESS (state, regnum), \ - count*REGISTER_SIZE) - -/* Store COUNT contiguous registers to thread STATE starting from REGNUM */ -#define STORE_REGS(state, regnum, count) \ - memcpy (REG_ADDRESS (state, regnum), \ - ®isters[REGISTER_BYTE (regnum)], \ - count*REGISTER_SIZE) - -/* - * Fetch inferiors registers for gdb. - * REGNO specifies which (as gdb views it) register, -1 for all. - */ - -void -fetch_inferior_registers (regno) - int regno; -{ - kern_return_t ret; - thread_state_data_t state; - unsigned int stateCnt = i386_THREAD_STATE_COUNT; - int index; - - if (! MACH_PORT_VALID (current_thread)) - error ("fetch inferior registers: Invalid thread"); - - if (must_suspend_thread) - setup_thread (current_thread, 1); - - ret = thread_get_state (current_thread, - i386_THREAD_STATE, - state, - &stateCnt); - - if (ret != KERN_SUCCESS) - warning ("fetch_inferior_registers: %s ", - mach_error_string (ret)); -#if 0 - /* It may be more effective to store validate all of them, - * since we fetched them all anyway - */ - else if (regno != -1) - supply_register (regno, (char *)state+reg_offset[regno]); -#endif - else - { - for (index = 0; index < NUM_REGS; index++) - supply_register (index, (char *)state+reg_offset[index]); - } - - if (must_suspend_thread) - setup_thread (current_thread, 0); -} - -/* Store our register values back into the inferior. - * If REGNO is -1, do this for all registers. - * Otherwise, REGNO specifies which register - * - * On mach3 all registers are always saved in one call. - */ -void -store_inferior_registers (regno) - int regno; -{ - kern_return_t ret; - thread_state_data_t state; - unsigned int stateCnt = i386_THREAD_STATE_COUNT; - register int index; - - if (! MACH_PORT_VALID (current_thread)) - error ("store inferior registers: Invalid thread"); - - if (must_suspend_thread) - setup_thread (current_thread, 1); - - /* Fetch the state of the current thread */ - ret = thread_get_state (current_thread, - i386_THREAD_STATE, - state, - &stateCnt); - - if (ret != KERN_SUCCESS) - { - warning ("store_inferior_registers (get): %s", - mach_error_string (ret)); - if (must_suspend_thread) - setup_thread (current_thread, 0); - return; - } - - /* move gdb's registers to thread's state - * - * Since we save all registers anyway, save the ones - * that gdb thinks are valid (e.g. ignore the regno - * parameter) - */ -#if 0 - if (regno != -1) - STORE_REGS (state, regno, 1); - else -#endif - { - for (index = 0; index < NUM_REGS; index++) - STORE_REGS (state, index, 1); - } - - /* Write gdb's current view of register to the thread - */ - ret = thread_set_state (current_thread, - i386_THREAD_STATE, - state, - i386_THREAD_STATE_COUNT); - - if (ret != KERN_SUCCESS) - warning ("store_inferior_registers (set): %s", - mach_error_string (ret)); - - if (must_suspend_thread) - setup_thread (current_thread, 0); -} - - - -/* Return the address in the core dump or inferior of register REGNO. - * BLOCKEND should be the address of the end of the UPAGES area read - * in memory, but it's not? - * - * Currently our UX server dumps the whole thread state to the - * core file. If your UX does something else, adapt the routine - * below to return the offset to the given register. - * - * Called by core-aout.c(fetch_core_registers) - */ - -unsigned int -register_addr (regno, blockend) - int regno; - int blockend; -{ - unsigned int addr; - - if (regno < 0 || regno >= NUM_REGS) - error ("Invalid register number %d.", regno); - - /* UAREA_SIZE == 8 kB in i386 */ - addr = (unsigned int)REG_ADDRESS (UAREA_SIZE - sizeof(struct i386_thread_state), regno); - - return addr; -} - -/* jtv@hut.fi: I copied and modified this 387 code from - * gdb/i386-xdep.c. Modifications for Mach 3.0. - * - * i387 status dumper. See also i387-tdep.c - */ -struct env387 -{ - unsigned short control; - unsigned short r0; - unsigned short status; - unsigned short r1; - unsigned short tag; - unsigned short r2; - unsigned long eip; - unsigned short code_seg; - unsigned short opcode; - unsigned long operand; - unsigned short operand_seg; - unsigned short r3; - unsigned char regs[8][10]; -}; -/* This routine is machine independent? - * Should move it to i387-tdep.c but you need to export struct env387 - */ -private -print_387_status (status, ep) - unsigned short status; - struct env387 *ep; -{ - int i; - int bothstatus; - int top; - int fpreg; - unsigned char *p; - - bothstatus = ((status != 0) && (ep->status != 0)); - if (status != 0) - { - if (bothstatus) - printf_unfiltered ("u: "); - print_387_status_word (status); - } - - if (ep->status != 0) - { - if (bothstatus) - printf_unfiltered ("e: "); - print_387_status_word (ep->status); - } - - print_387_control_word (ep->control); - printf_unfiltered ("last exception: "); - printf_unfiltered ("opcode %s; ", local_hex_string(ep->opcode)); - printf_unfiltered ("pc %s:", local_hex_string(ep->code_seg)); - printf_unfiltered ("%s; ", local_hex_string(ep->eip)); - printf_unfiltered ("operand %s", local_hex_string(ep->operand_seg)); - printf_unfiltered (":%s\n", local_hex_string(ep->operand)); - - top = (ep->status >> 11) & 7; - - printf_unfiltered ("regno tag msb lsb value\n"); - for (fpreg = 7; fpreg >= 0; fpreg--) - { - double val; - - printf_unfiltered ("%s %d: ", fpreg == top ? "=>" : " ", fpreg); - - switch ((ep->tag >> (fpreg * 2)) & 3) - { - case 0: printf_unfiltered ("valid "); break; - case 1: printf_unfiltered ("zero "); break; - case 2: printf_unfiltered ("trap "); break; - case 3: printf_unfiltered ("empty "); break; - } - for (i = 9; i >= 0; i--) - printf_unfiltered ("%02x", ep->regs[fpreg][i]); - - floatformat_to_double (&floatformat_i387_ext, (char *)ep->regs[fpreg], - &val); - printf_unfiltered (" %g\n", val); - } - if (ep->r0) - printf_unfiltered ("warning: reserved0 is %s\n", local_hex_string(ep->r0)); - if (ep->r1) - printf_unfiltered ("warning: reserved1 is %s\n", local_hex_string(ep->r1)); - if (ep->r2) - printf_unfiltered ("warning: reserved2 is %s\n", local_hex_string(ep->r2)); - if (ep->r3) - printf_unfiltered ("warning: reserved3 is %s\n", local_hex_string(ep->r3)); -} - -/* - * values that go into fp_kind (from ) - */ -#define FP_NO 0 /* no fp chip, no emulator (no fp support) */ -#define FP_SW 1 /* no fp chip, using software emulator */ -#define FP_HW 2 /* chip present bit */ -#define FP_287 2 /* 80287 chip present */ -#define FP_387 3 /* 80387 chip present */ - -typedef struct fpstate { -#if 1 - unsigned char state[FP_STATE_BYTES]; /* "hardware" state */ -#else - struct env387 state; /* Actually this */ -#endif - int status; /* Duplicate status */ -} *fpstate_t; - -/* Mach 3 specific routines. - */ -private boolean_t -get_i387_state (fstate) - struct fpstate *fstate; -{ - kern_return_t ret; - thread_state_data_t state; - unsigned int fsCnt = i386_FLOAT_STATE_COUNT; - struct i386_float_state *fsp; - - ret = thread_get_state (current_thread, - i386_FLOAT_STATE, - state, - &fsCnt); - - if (ret != KERN_SUCCESS) - { - warning ("Can not get live floating point state: %s", - mach_error_string (ret)); - return FALSE; - } - - fsp = (struct i386_float_state *)state; - /* The 387 chip (also 486 counts) or a software emulator? */ - if (!fsp->initialized || (fsp->fpkind != FP_387 && fsp->fpkind != FP_SW)) - return FALSE; - - /* Clear the target then copy thread's float state there. - Make a copy of the status word, for some reason? - */ - memset (fstate, 0, sizeof (struct fpstate)); - - fstate->status = fsp->exc_status; - - memcpy (fstate->state, (char *)&fsp->hw_state, FP_STATE_BYTES); - - return TRUE; -} - -private boolean_t -get_i387_core_state (fstate) - struct fpstate *fstate; -{ - /* Not implemented yet. Core files do not contain float state. */ - return FALSE; -} - -/* - * This is called by "info float" command - */ -void -i386_mach3_float_info() -{ - char buf [sizeof (struct fpstate) + 2 * sizeof (int)]; - boolean_t valid = FALSE; - fpstate_t fps; - - if (target_has_execution) - valid = get_i387_state (buf); -#if 0 - else if (WE HAVE CORE FILE) /* @@@@ Core files not supported */ - valid = get_i387_core_state (buf); -#endif - - if (!valid) - { - warning ("no floating point status saved"); - return; - } - - fps = (fpstate_t) buf; - - print_387_status (fps->status, (struct env387 *)fps->state); -} diff --git a/contrib/gdb/gdb/i386mach-nat.c b/contrib/gdb/gdb/i386mach-nat.c deleted file mode 100644 index 1a5904a..0000000 --- a/contrib/gdb/gdb/i386mach-nat.c +++ /dev/null @@ -1,163 +0,0 @@ -/* Native dependent code for Mach 386's for GDB, the GNU debugger. - Copyright (C) 1986, 1987, 1989, 1991, 1992 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "defs.h" -#include "frame.h" -#include "inferior.h" -#include "gdbcore.h" - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include "gdb_stat.h" -#include - - - -void -fetch_inferior_registers (regno) - int regno; /* Original value discarded */ -{ - struct regs inferior_registers; - struct fp_state inferior_fp_registers; - extern char registers[]; - - registers_fetched (); - - ptrace (PTRACE_GETREGS, inferior_pid, - (PTRACE_ARG3_TYPE) &inferior_registers); - ptrace (PTRACE_GETFPREGS, inferior_pid, - (PTRACE_ARG3_TYPE) &inferior_fp_registers); - - memcpy (registers, &inferior_registers, sizeof inferior_registers); - - memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)], - inferior_fp_registers.f_st, - sizeof inferior_fp_registers.f_st); - memcpy (®isters[REGISTER_BYTE (FPC_REGNUM)], - &inferior_fp_registers.f_ctrl, - sizeof inferior_fp_registers - sizeof inferior_fp_registers.f_st); -} - -/* Store our register values back into the inferior. - If REGNO is -1, do this for all registers. - Otherwise, REGNO specifies which register (so we can save time). */ - -void -store_inferior_registers (regno) - int regno; -{ - struct regs inferior_registers; - struct fp_state inferior_fp_registers; - extern char registers[]; - - memcpy (&inferior_registers, registers, 20 * 4); - - memcpy (inferior_fp_registers.f_st,®isters[REGISTER_BYTE (FP0_REGNUM)], - sizeof inferior_fp_registers.f_st); - memcpy (&inferior_fp_registers.f_ctrl, - ®isters[REGISTER_BYTE (FPC_REGNUM)], - sizeof inferior_fp_registers - sizeof inferior_fp_registers.f_st); - -#ifdef PTRACE_FP_BUG - if (regno == FP_REGNUM || regno == -1) - /* Storing the frame pointer requires a gross hack, in which an - instruction that moves eax into ebp gets single-stepped. */ - { - int stack = inferior_registers.r_reg[SP_REGNUM]; - int stuff = ptrace (PTRACE_PEEKDATA, inferior_pid, - (PTRACE_ARG3_TYPE) stack); - int reg = inferior_registers.r_reg[EAX]; - inferior_registers.r_reg[EAX] = - inferior_registers.r_reg[FP_REGNUM]; - ptrace (PTRACE_SETREGS, inferior_pid, - (PTRACE_ARG3_TYPE) &inferior_registers); - ptrace (PTRACE_POKEDATA, inferior_pid, (PTRACE_ARG3_TYPE) stack, 0xc589); - ptrace (PTRACE_SINGLESTEP, inferior_pid, (PTRACE_ARG3_TYPE) stack, 0); - wait (0); - ptrace (PTRACE_POKEDATA, inferior_pid, (PTRACE_ARG3_TYPE) stack, stuff); - inferior_registers.r_reg[EAX] = reg; - } -#endif - ptrace (PTRACE_SETREGS, inferior_pid, - (PTRACE_ARG3_TYPE) &inferior_registers); - ptrace (PTRACE_SETFPREGS, inferior_pid, - (PTRACE_ARG3_TYPE) &inferior_fp_registers); -} - - - -/* Work with core files, for GDB. */ - -static void -fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr) - char *core_reg_sect; - unsigned core_reg_size; - int which; - unsigned int reg_addr; /* Unused in this version */ -{ - int val; - extern char registers[]; - - switch (which) { - case 0: - case 1: - memcpy (registers, core_reg_sect, core_reg_size); - break; - - case 2: -#ifdef FP0_REGNUM - memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)], - core_reg_sect, - core_reg_size); /* FIXME, probably bogus */ -#endif -#ifdef FPC_REGNUM - memcpy (®isters[REGISTER_BYTE (FPC_REGNUM)], - &corestr.c_fpu.f_fpstatus.f_ctrl, - sizeof corestr.c_fpu.f_fpstatus - - sizeof corestr.c_fpu.f_fpstatus.f_st); -#endif - break; - } -} - - -/* Register that we are able to handle i386mach core file formats. - FIXME: is this really bfd_target_unknown_flavour? */ - -static struct core_fns i386mach_core_fns = -{ - bfd_target_unknown_flavour, - fetch_core_registers, - NULL -}; - -void -_initialize_core_i386mach () -{ - add_core_fns (&i386mach_core_fns); -} diff --git a/contrib/gdb/gdb/i386v-nat.c b/contrib/gdb/gdb/i386v-nat.c deleted file mode 100644 index 38468a9..0000000 --- a/contrib/gdb/gdb/i386v-nat.c +++ /dev/null @@ -1,371 +0,0 @@ -/* Intel 386 native support for SYSV systems (pre-SVR4). - Copyright (C) 1988, 1989, 1991, 1992, 1994, 1996 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "defs.h" -#include "frame.h" -#include "inferior.h" -#include "language.h" -#include "gdbcore.h" - -#ifdef USG -#include -#endif - -#include -#include -#include -#include -#include -#include - -#ifdef TARGET_HAS_HARDWARE_WATCHPOINTS -#include -#endif - -#include -#include "gdb_stat.h" - -#ifndef NO_SYS_REG_H -#include -#endif - -#include "floatformat.h" - -#include "target.h" - - -/* this table must line up with REGISTER_NAMES in tm-i386v.h */ -/* symbols like 'EAX' come from */ -static int regmap[] = -{ - EAX, ECX, EDX, EBX, - UESP, EBP, ESI, EDI, - EIP, EFL, CS, SS, - DS, ES, FS, GS, -}; - -/* blockend is the value of u.u_ar0, and points to the - * place where GS is stored - */ - -int -i386_register_u_addr (blockend, regnum) - int blockend; - int regnum; -{ - struct user u; - int fpstate; - int ubase; - - ubase = blockend; - /* FIXME: Should have better way to test floating point range */ - if (regnum >= FP0_REGNUM && regnum <= (FP0_REGNUM + 7)) - { -#ifdef KSTKSZ /* SCO, and others? */ - ubase += 4 * (SS + 1) - KSTKSZ; - fpstate = ubase + ((char *)&u.u_fps.u_fpstate - (char *)&u); - return (fpstate + 0x1c + 10 * (regnum - FP0_REGNUM)); -#else - fpstate = ubase + ((char *)&u.i387.st_space - (char *)&u); - return (fpstate + 10 * (regnum - FP0_REGNUM)); -#endif - } - else - { - return (ubase + 4 * regmap[regnum]); - } - -} - -int -kernel_u_size () -{ - return (sizeof (struct user)); -} - -#ifdef TARGET_HAS_HARDWARE_WATCHPOINTS - -#if !defined (offsetof) -#define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER) -#endif - -/* Record the value of the debug control register. */ -static int debug_control_mirror; - -/* Record which address associates with which register. */ -static CORE_ADDR address_lookup[DR_LASTADDR - DR_FIRSTADDR + 1]; - -static int -i386_insert_aligned_watchpoint PARAMS ((int, CORE_ADDR, CORE_ADDR, int, - int)); - -static int -i386_insert_nonaligned_watchpoint PARAMS ((int, CORE_ADDR, CORE_ADDR, int, - int)); - -/* Insert a watchpoint. */ - -int -i386_insert_watchpoint (pid, addr, len, rw) - int pid; - CORE_ADDR addr; - int len; - int rw; -{ - return i386_insert_aligned_watchpoint (pid, addr, addr, len, rw); -} - -static int -i386_insert_aligned_watchpoint (pid, waddr, addr, len, rw) - int pid; - CORE_ADDR waddr; - CORE_ADDR addr; - int len; - int rw; -{ - int i; - int read_write_bits, len_bits; - int free_debug_register; - int register_number; - - /* Look for a free debug register. */ - for (i = DR_FIRSTADDR; i <= DR_LASTADDR; i++) - { - if (address_lookup[i - DR_FIRSTADDR] == 0) - break; - } - - /* No more debug registers! */ - if (i > DR_LASTADDR) - return -1; - - read_write_bits = ((rw & 1) ? DR_RW_READ : 0) | ((rw & 2) ? DR_RW_WRITE : 0); - - if (len == 1) - len_bits = DR_LEN_1; - else if (len == 2) - { - if (addr % 2) - return i386_insert_nonaligned_watchpoint (pid, waddr, addr, len, rw); - len_bits = DR_LEN_2; - } - - else if (len == 4) - { - if (addr % 4) - return i386_insert_nonaligned_watchpoint (pid, waddr, addr, len, rw); - len_bits = DR_LEN_4; - } - else - return i386_insert_nonaligned_watchpoint (pid, waddr, addr, len, rw); - - free_debug_register = i; - register_number = free_debug_register - DR_FIRSTADDR; - debug_control_mirror |= - ((read_write_bits | len_bits) - << (DR_CONTROL_SHIFT + DR_CONTROL_SIZE * register_number)); - debug_control_mirror |= - (1 << (DR_LOCAL_ENABLE_SHIFT + DR_ENABLE_SIZE * register_number)); - debug_control_mirror |= DR_LOCAL_SLOWDOWN; - debug_control_mirror &= ~DR_CONTROL_RESERVED; - - ptrace (6, pid, offsetof (struct user, u_debugreg[DR_CONTROL]), - debug_control_mirror); - ptrace (6, pid, offsetof (struct user, u_debugreg[free_debug_register]), - addr); - - /* Record where we came from. */ - address_lookup[register_number] = addr; - return 0; -} - -static int -i386_insert_nonaligned_watchpoint (pid, waddr, addr, len, rw) - int pid; - CORE_ADDR waddr; - CORE_ADDR addr; - int len; - int rw; -{ - int align; - int size; - int rv; - - static int size_try_array[16] = { - 1, 1, 1, 1, /* trying size one */ - 2, 1, 2, 1, /* trying size two */ - 2, 1, 2, 1, /* trying size three */ - 4, 1, 2, 1 /* trying size four */ - }; - - rv = 0; - while (len > 0) - { - align = addr % 4; - /* Four is the maximum length for 386. */ - size = (len > 4) ? 3 : len - 1; - size = size_try_array[size * 4 + align]; - - rv = i386_insert_aligned_watchpoint (pid, waddr, addr, size, rw); - if (rv) - { - i386_remove_watchpoint (pid, waddr, size); - return rv; - } - addr += size; - len -= size; - } - return rv; -} - -/* Remove a watchpoint. */ - -int -i386_remove_watchpoint (pid, addr, len) - int pid; - CORE_ADDR addr; - int len; -{ - int i; - int register_number; - - for (i = DR_FIRSTADDR; i <= DR_LASTADDR; i++) - { - register_number = i - DR_FIRSTADDR; - if (address_lookup[register_number] == addr) - { - debug_control_mirror &= - ~(1 << (DR_LOCAL_ENABLE_SHIFT + DR_ENABLE_SIZE * register_number)); - address_lookup[register_number] = 0; - } - } - ptrace (6, pid, offsetof (struct user, u_debugreg[DR_CONTROL]), - debug_control_mirror); - ptrace (6, pid, offsetof (struct user, u_debugreg[DR_STATUS]), 0); - - return 0; -} - -/* Check if stopped by a watchpoint. */ - -CORE_ADDR -i386_stopped_by_watchpoint (pid) - int pid; -{ - int i; - int status; - - status = ptrace (3, pid, offsetof (struct user, u_debugreg[DR_STATUS]), 0); - ptrace (6, pid, offsetof (struct user, u_debugreg[DR_STATUS]), 0); - - for (i = DR_FIRSTADDR; i <= DR_LASTADDR; i++) - { - if (status & (1 << (i - DR_FIRSTADDR))) - return address_lookup[i - DR_FIRSTADDR]; - } - - return 0; -} - -#endif /* TARGET_HAS_HARDWARE_WATCHPOINTS */ - -#if 0 -/* using FLOAT_INFO as is would be a problem. FLOAT_INFO is called - via a command xxx and eventually calls ptrace without ever having - traversed the target vector. This would be terribly impolite - behaviour for a sun4 hosted remote gdb. - - A fix might be to move this code into the "info registers" command. - rich@cygnus.com 15 Sept 92. */ -i386_float_info () -{ - struct user u; /* just for address computations */ - int i; - /* fpstate defined in */ - struct fpstate *fpstatep; - char buf[sizeof (struct fpstate) + 2 * sizeof (int)]; - unsigned int uaddr; - char fpvalid = 0; - unsigned int rounded_addr; - unsigned int rounded_size; - extern int corechan; - int skip; - - uaddr = (char *)&u.u_fpvalid - (char *)&u; - if (target_has_execution) - { - unsigned int data; - unsigned int mask; - - rounded_addr = uaddr & -sizeof (int); - data = ptrace (3, inferior_pid, (PTRACE_ARG3_TYPE) rounded_addr, 0); - mask = 0xff << ((uaddr - rounded_addr) * 8); - - fpvalid = ((data & mask) != 0); - } -#if 0 - else - { - if (lseek (corechan, uaddr, 0) < 0) - perror ("seek on core file"); - if (myread (corechan, &fpvalid, 1) < 0) - perror ("read on core file"); - - } -#endif /* no core support yet */ - - if (fpvalid == 0) - { - printf_unfiltered ("no floating point status saved\n"); - return; - } - - uaddr = (char *)&U_FPSTATE(u) - (char *)&u; - if (target_has_execution) - { - int *ip; - - rounded_addr = uaddr & -sizeof (int); - rounded_size = (((uaddr + sizeof (struct fpstate)) - uaddr) + - sizeof (int) - 1) / sizeof (int); - skip = uaddr - rounded_addr; - - ip = (int *)buf; - for (i = 0; i < rounded_size; i++) - { - *ip++ = ptrace (3, inferior_pid, (PTRACE_ARG3_TYPE) rounded_addr, 0); - rounded_addr += sizeof (int); - } - } -#if 0 - else - { - if (lseek (corechan, uaddr, 0) < 0) - perror_with_name ("seek on core file"); - if (myread (corechan, buf, sizeof (struct fpstate)) < 0) - perror_with_name ("read from core file"); - skip = 0; - } -#endif /* 0 */ - - fpstatep = (struct fpstate *)(buf + skip); - print_387_status (fpstatep->status, (struct env387 *)fpstatep->state); -} - -#endif /* never */ diff --git a/contrib/gdb/gdb/i386v4-nat.c b/contrib/gdb/gdb/i386v4-nat.c deleted file mode 100644 index 98f7365..0000000 --- a/contrib/gdb/gdb/i386v4-nat.c +++ /dev/null @@ -1,163 +0,0 @@ -/* Native-dependent code for SVR4 Unix running on i386's, for GDB. - Copyright 1988, 1989, 1991, 1992, 1996 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "defs.h" - -#ifdef HAVE_SYS_PROCFS_H - -#include - -/* The /proc interface divides the target machine's register set up into - two different sets, the general register set (gregset) and the floating - point register set (fpregset). For each set, there is an ioctl to get - the current register set and another ioctl to set the current values. - - The actual structure passed through the ioctl interface is, of course, - naturally machine dependent, and is different for each set of registers. - For the i386 for example, the general register set is typically defined - by: - - typedef int gregset_t[19]; (in ) - - #define GS 0 (in ) - #define FS 1 - ... - #define UESP 17 - #define SS 18 - - and the floating point set by: - - typedef struct fpregset - { - union - { - struct fpchip_state // fp extension state // - { - int state[27]; // 287/387 saved state // - int status; // status word saved at exception // - } fpchip_state; - struct fp_emul_space // for emulators // - { - char fp_emul[246]; - char fp_epad[2]; - } fp_emul_space; - int f_fpregs[62]; // union of the above // - } fp_reg_set; - long f_wregs[33]; // saved weitek state // - } fpregset_t; - - These routines provide the packing and unpacking of gregset_t and - fpregset_t formatted data. - - */ - -#ifdef HAVE_GREGSET_T - -/* This is a duplicate of the table in i386-xdep.c. */ - -static int regmap[] = -{ - EAX, ECX, EDX, EBX, - UESP, EBP, ESI, EDI, - EIP, EFL, CS, SS, - DS, ES, FS, GS, -}; - - -/* FIXME: These routine absolutely depends upon (NUM_REGS - NUM_FREGS) - being less than or equal to the number of registers that can be stored - in a gregset_t. Note that with the current scheme there will typically - be more registers actually stored in a gregset_t that what we know - about. This is bogus and should be fixed. */ - -/* Given a pointer to a general register set in /proc format (gregset_t *), - unpack the register contents and supply them as gdb's idea of the current - register values. */ - -void -supply_gregset (gregsetp) - gregset_t *gregsetp; -{ - register int regi; - register greg_t *regp = (greg_t *) gregsetp; - extern int regmap[]; - - for (regi = 0 ; regi < (NUM_REGS - NUM_FREGS) ; regi++) - { - supply_register (regi, (char *) (regp + regmap[regi])); - } -} - -void -fill_gregset (gregsetp, regno) - gregset_t *gregsetp; - int regno; -{ - int regi; - register greg_t *regp = (greg_t *) gregsetp; - extern char registers[]; - extern int regmap[]; - - for (regi = 0 ; regi < (NUM_REGS - NUM_FREGS) ; regi++) - { - if ((regno == -1) || (regno == regi)) - { - *(regp + regmap[regi]) = *(int *) ®isters[REGISTER_BYTE (regi)]; - } - } -} - -#endif /* HAVE_GREGSET_T */ - -#if defined (FP0_REGNUM) && defined (HAVE_FPREGSET_T) - -/* Given a pointer to a floating point register set in /proc format - (fpregset_t *), unpack the register contents and supply them as gdb's - idea of the current floating point register values. */ - -void -supply_fpregset (fpregsetp) - fpregset_t *fpregsetp; -{ - register int regi; - - /* FIXME: see m68k-tdep.c for an example, for the m68k. */ -} - -/* Given a pointer to a floating point register set in /proc format - (fpregset_t *), update the register specified by REGNO from gdb's idea - of the current floating point register set. If REGNO is -1, update - them all. */ - -void -fill_fpregset (fpregsetp, regno) - fpregset_t *fpregsetp; - int regno; -{ - int regi; - char *to; - char *from; - extern char registers[]; - - /* FIXME: see m68k-tdep.c for an example, for the m68k. */ -} - -#endif /* defined (FP0_REGNUM) && defined (HAVE_FPREGSET_T) */ - -#endif /* HAVE_SYS_PROCFS_H */ diff --git a/contrib/gdb/gdb/irix4-nat.c b/contrib/gdb/gdb/irix4-nat.c deleted file mode 100644 index 8cd9b4c..0000000 --- a/contrib/gdb/gdb/irix4-nat.c +++ /dev/null @@ -1,192 +0,0 @@ -/* Native support for the SGI Iris running IRIX version 4, for GDB. - Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1995 - Free Software Foundation, Inc. - Contributed by Alessandro Forin(af@cs.cmu.edu) at CMU - and by Per Bothner(bothner@cs.wisc.edu) at U.Wisconsin. - Implemented for Irix 4.x by Garrett A. Wollman. - -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 -#include -#include /* For JB_XXX. */ - -/* Size of elements in jmpbuf */ - -#define JB_ELEMENT_SIZE 4 - -typedef unsigned int greg_t; /* why isn't this defined? */ - -/* - * See the comment in m68k-tdep.c regarding the utility of these functions. - */ - -void -supply_gregset (gregsetp) - gregset_t *gregsetp; -{ - register int regi; - register greg_t *regp = (greg_t *)(gregsetp->gp_regs); - static char zerobuf[MAX_REGISTER_RAW_SIZE] = {0}; - - /* FIXME: somewhere, there should be a #define for the meaning - of this magic number 32; we should use that. */ - for(regi = 0; regi < 32; regi++) - supply_register (regi, (char *)(regp + regi)); - - supply_register (PC_REGNUM, (char *)&(gregsetp->gp_pc)); - supply_register (HI_REGNUM, (char *)&(gregsetp->gp_mdhi)); - supply_register (LO_REGNUM, (char *)&(gregsetp->gp_mdlo)); - supply_register (CAUSE_REGNUM, (char *)&(gregsetp->gp_cause)); - - /* Fill inaccessible registers with zero. */ - supply_register (BADVADDR_REGNUM, zerobuf); -} - -void -fill_gregset (gregsetp, regno) - gregset_t *gregsetp; - int regno; -{ - int regi; - register greg_t *regp = (greg_t *)(gregsetp->gp_regs); - - /* same FIXME as above wrt 32*/ - for (regi = 0; regi < 32; regi++) - if ((regno == -1) || (regno == regi)) - *(regp + regi) = *(greg_t *) ®isters[REGISTER_BYTE (regi)]; - - if ((regno == -1) || (regno == PC_REGNUM)) - gregsetp->gp_pc = *(greg_t *) ®isters[REGISTER_BYTE (PC_REGNUM)]; - - if ((regno == -1) || (regno == CAUSE_REGNUM)) - gregsetp->gp_cause = *(greg_t *) ®isters[REGISTER_BYTE (CAUSE_REGNUM)]; - - if ((regno == -1) || (regno == HI_REGNUM)) - gregsetp->gp_mdhi = *(greg_t *) ®isters[REGISTER_BYTE (HI_REGNUM)]; - - if ((regno == -1) || (regno == LO_REGNUM)) - gregsetp->gp_mdlo = *(greg_t *) ®isters[REGISTER_BYTE (LO_REGNUM)]; -} - -/* - * Now we do the same thing for floating-point registers. - * We don't bother to condition on FP0_REGNUM since any - * reasonable MIPS configuration has an R3010 in it. - * - * Again, see the comments in m68k-tdep.c. - */ - -void -supply_fpregset (fpregsetp) - fpregset_t *fpregsetp; -{ - register int regi; - static char zerobuf[MAX_REGISTER_RAW_SIZE] = {0}; - - for (regi = 0; regi < 32; regi++) - supply_register (FP0_REGNUM + regi, - (char *)&fpregsetp->fp_r.fp_regs[regi]); - - supply_register (FCRCS_REGNUM, (char *)&fpregsetp->fp_csr); - - /* FIXME: how can we supply FCRIR_REGNUM? SGI doesn't tell us. */ - supply_register (FCRIR_REGNUM, zerobuf); -} - -void -fill_fpregset (fpregsetp, regno) - fpregset_t *fpregsetp; - int regno; -{ - int regi; - char *from, *to; - - for (regi = FP0_REGNUM; regi < FP0_REGNUM + 32; regi++) - { - if ((regno == -1) || (regno == regi)) - { - from = (char *) ®isters[REGISTER_BYTE (regi)]; - to = (char *) &(fpregsetp->fp_r.fp_regs[regi - FP0_REGNUM]); - memcpy(to, from, REGISTER_RAW_SIZE (regi)); - } - } - - if ((regno == -1) || (regno == FCRCS_REGNUM)) - fpregsetp->fp_csr = *(unsigned *) ®isters[REGISTER_BYTE(FCRCS_REGNUM)]; -} - - -/* Figure out where the longjmp will land. - We expect the first arg to be a pointer to the jmp_buf structure from which - we extract the pc (JB_PC) that we will land at. The pc is copied into PC. - This routine returns true on success. */ - -int -get_longjmp_target (pc) - CORE_ADDR *pc; -{ - char buf[TARGET_PTR_BIT / TARGET_CHAR_BIT]; - CORE_ADDR jb_addr; - - jb_addr = read_register (A0_REGNUM); - - if (target_read_memory (jb_addr + JB_PC * JB_ELEMENT_SIZE, buf, - TARGET_PTR_BIT / TARGET_CHAR_BIT)) - return 0; - - *pc = extract_address (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT); - - return 1; -} - -static void -fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr) - char *core_reg_sect; - unsigned core_reg_size; - int which; /* Unused */ - unsigned int reg_addr; /* Unused */ -{ - if (core_reg_size != REGISTER_BYTES) - { - warning ("wrong size gregset struct in core file"); - return; - } - - memcpy ((char *)registers, core_reg_sect, core_reg_size); -} - - -/* Register that we are able to handle irix4 core file formats. - FIXME: is this really bfd_target_unknown_flavour? */ - -static struct core_fns irix4_core_fns = -{ - bfd_target_unknown_flavour, - fetch_core_registers, - NULL -}; - -void -_initialize_core_irix4 () -{ - add_core_fns (&irix4_core_fns); -} diff --git a/contrib/gdb/gdb/irix5-nat.c b/contrib/gdb/gdb/irix5-nat.c deleted file mode 100644 index fc4c8cb..0000000 --- a/contrib/gdb/gdb/irix5-nat.c +++ /dev/null @@ -1,1067 +0,0 @@ -/* Native support for the SGI Iris running IRIX version 5, for GDB. - Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996 - Free Software Foundation, Inc. - Contributed by Alessandro Forin(af@cs.cmu.edu) at CMU - and by Per Bothner(bothner@cs.wisc.edu) at U.Wisconsin. - Implemented for Irix 4.x by Garrett A. Wollman. - Modified for Irix 5.x by Ian Lance Taylor. - -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 "target.h" - -#include "gdb_string.h" -#include -#include -#include /* For JB_XXX. */ - -/* Size of elements in jmpbuf */ - -#define JB_ELEMENT_SIZE 4 - -/* - * See the comment in m68k-tdep.c regarding the utility of these functions. - * - * These definitions are from the MIPS SVR4 ABI, so they may work for - * any MIPS SVR4 target. - */ - -void -supply_gregset (gregsetp) - gregset_t *gregsetp; -{ - register int regi; - register greg_t *regp = &(*gregsetp)[0]; - static char zerobuf[MAX_REGISTER_RAW_SIZE] = {0}; - - for(regi = 0; regi <= CTX_RA; regi++) - supply_register (regi, (char *)(regp + regi)); - - supply_register (PC_REGNUM, (char *)(regp + CTX_EPC)); - supply_register (HI_REGNUM, (char *)(regp + CTX_MDHI)); - supply_register (LO_REGNUM, (char *)(regp + CTX_MDLO)); - supply_register (CAUSE_REGNUM, (char *)(regp + CTX_CAUSE)); - - /* Fill inaccessible registers with zero. */ - supply_register (BADVADDR_REGNUM, zerobuf); -} - -void -fill_gregset (gregsetp, regno) - gregset_t *gregsetp; - int regno; -{ - int regi; - register greg_t *regp = &(*gregsetp)[0]; - - for (regi = 0; regi <= CTX_RA; regi++) - if ((regno == -1) || (regno == regi)) - *(regp + regi) = *(greg_t *) ®isters[REGISTER_BYTE (regi)]; - - if ((regno == -1) || (regno == PC_REGNUM)) - *(regp + CTX_EPC) = *(greg_t *) ®isters[REGISTER_BYTE (PC_REGNUM)]; - - if ((regno == -1) || (regno == CAUSE_REGNUM)) - *(regp + CTX_CAUSE) = *(greg_t *) ®isters[REGISTER_BYTE (CAUSE_REGNUM)]; - - if ((regno == -1) || (regno == HI_REGNUM)) - *(regp + CTX_MDHI) = *(greg_t *) ®isters[REGISTER_BYTE (HI_REGNUM)]; - - if ((regno == -1) || (regno == LO_REGNUM)) - *(regp + CTX_MDLO) = *(greg_t *) ®isters[REGISTER_BYTE (LO_REGNUM)]; -} - -/* - * Now we do the same thing for floating-point registers. - * We don't bother to condition on FP0_REGNUM since any - * reasonable MIPS configuration has an R3010 in it. - * - * Again, see the comments in m68k-tdep.c. - */ - -void -supply_fpregset (fpregsetp) - fpregset_t *fpregsetp; -{ - register int regi; - static char zerobuf[MAX_REGISTER_RAW_SIZE] = {0}; - - for (regi = 0; regi < 32; regi++) - supply_register (FP0_REGNUM + regi, - (char *)&fpregsetp->fp_r.fp_regs[regi]); - - supply_register (FCRCS_REGNUM, (char *)&fpregsetp->fp_csr); - - /* FIXME: how can we supply FCRIR_REGNUM? SGI doesn't tell us. */ - supply_register (FCRIR_REGNUM, zerobuf); -} - -void -fill_fpregset (fpregsetp, regno) - fpregset_t *fpregsetp; - int regno; -{ - int regi; - char *from, *to; - - for (regi = FP0_REGNUM; regi < FP0_REGNUM + 32; regi++) - { - if ((regno == -1) || (regno == regi)) - { - from = (char *) ®isters[REGISTER_BYTE (regi)]; - to = (char *) &(fpregsetp->fp_r.fp_regs[regi - FP0_REGNUM]); - memcpy(to, from, REGISTER_RAW_SIZE (regi)); - } - } - - if ((regno == -1) || (regno == FCRCS_REGNUM)) - fpregsetp->fp_csr = *(unsigned *) ®isters[REGISTER_BYTE(FCRCS_REGNUM)]; -} - - -/* Figure out where the longjmp will land. - We expect the first arg to be a pointer to the jmp_buf structure from which - we extract the pc (JB_PC) that we will land at. The pc is copied into PC. - This routine returns true on success. */ - -int -get_longjmp_target (pc) - CORE_ADDR *pc; -{ - char buf[TARGET_PTR_BIT / TARGET_CHAR_BIT]; - CORE_ADDR jb_addr; - - jb_addr = read_register (A0_REGNUM); - - if (target_read_memory (jb_addr + JB_PC * JB_ELEMENT_SIZE, buf, - TARGET_PTR_BIT / TARGET_CHAR_BIT)) - return 0; - - *pc = extract_address (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT); - - return 1; -} - -static void -fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr) - char *core_reg_sect; - unsigned core_reg_size; - int which; /* Unused */ - unsigned int reg_addr; /* Unused */ -{ - if (core_reg_size != REGISTER_BYTES) - { - warning ("wrong size gregset struct in core file"); - return; - } - - memcpy ((char *)registers, core_reg_sect, core_reg_size); -} - -/* Irix 5 uses what appears to be a unique form of shared library - support. This is a copy of solib.c modified for Irix 5. */ - -#include -#include -#include -#include - -/* includes and , which causes conflicts - with our versions of those files included by tm-mips.h. Prevent - from including them with some appropriate defines. */ -#define __SYM_H__ -#define __SYMCONST_H__ -#include - -#include "symtab.h" -#include "bfd.h" -#include "symfile.h" -#include "objfiles.h" -#include "command.h" -#include "frame.h" -#include "gnu-regex.h" -#include "inferior.h" -#include "language.h" -#include "gdbcmd.h" - -/* The symbol which starts off the list of shared libraries. */ -#define DEBUG_BASE "__rld_obj_head" - -/* How to get the loaded address of a shared library. */ -#define LM_ADDR(so) ((so)->lm.o_praw) - -char shadow_contents[BREAKPOINT_MAX]; /* Stash old bkpt addr contents */ - -struct so_list { - struct so_list *next; /* next structure in linked list */ - struct obj_list ll; - struct obj lm; /* copy of link map from inferior */ - struct obj_list *lladdr; /* addr in inferior lm was read from */ - CORE_ADDR lmend; /* upper addr bound of mapped object */ - char symbols_loaded; /* flag: symbols read in yet? */ - char from_tty; /* flag: print msgs? */ - struct objfile *objfile; /* objfile for loaded lib */ - struct section_table *sections; - struct section_table *sections_end; - struct section_table *textsection; - bfd *abfd; -}; - -static struct so_list *so_list_head; /* List of known shared objects */ -static CORE_ADDR debug_base; /* Base of dynamic linker structures */ -static CORE_ADDR breakpoint_addr; /* Address where end bkpt is set */ - -/* Local function prototypes */ - -static void -sharedlibrary_command PARAMS ((char *, int)); - -static int -enable_break PARAMS ((void)); - -static int -disable_break PARAMS ((void)); - -static void -info_sharedlibrary_command PARAMS ((char *, int)); - -static int -symbol_add_stub PARAMS ((char *)); - -static struct so_list * -find_solib PARAMS ((struct so_list *)); - -static struct obj_list * -first_link_map_member PARAMS ((void)); - -static CORE_ADDR -locate_base PARAMS ((void)); - -static void -solib_map_sections PARAMS ((struct so_list *)); - -/* - -LOCAL FUNCTION - - solib_map_sections -- open bfd and build sections for shared lib - -SYNOPSIS - - static void solib_map_sections (struct so_list *so) - -DESCRIPTION - - Given a pointer to one of the shared objects in our list - of mapped objects, use the recorded name to open a bfd - descriptor for the object, build a section table, and then - relocate all the section addresses by the base address at - which the shared object was mapped. - -FIXMES - - In most (all?) cases the shared object file name recorded in the - dynamic linkage tables will be a fully qualified pathname. For - cases where it isn't, do we really mimic the systems search - mechanism correctly in the below code (particularly the tilde - expansion stuff?). - */ - -static void -solib_map_sections (so) - struct so_list *so; -{ - char *filename; - char *scratch_pathname; - int scratch_chan; - struct section_table *p; - struct cleanup *old_chain; - bfd *abfd; - CORE_ADDR offset; - - filename = tilde_expand (so -> lm.o_path); - old_chain = make_cleanup (free, filename); - - scratch_chan = openp (getenv ("PATH"), 1, filename, O_RDONLY, 0, - &scratch_pathname); - if (scratch_chan < 0) - { - scratch_chan = openp (getenv ("LD_LIBRARY_PATH"), 1, filename, - O_RDONLY, 0, &scratch_pathname); - } - if (scratch_chan < 0) - { - perror_with_name (filename); - } - /* Leave scratch_pathname allocated. abfd->name will point to it. */ - - abfd = bfd_fdopenr (scratch_pathname, gnutarget, scratch_chan); - if (!abfd) - { - close (scratch_chan); - error ("Could not open `%s' as an executable file: %s", - scratch_pathname, bfd_errmsg (bfd_get_error ())); - } - /* Leave bfd open, core_xfer_memory and "info files" need it. */ - so -> abfd = abfd; - abfd -> cacheable = true; - - if (!bfd_check_format (abfd, bfd_object)) - { - error ("\"%s\": not in executable format: %s.", - scratch_pathname, bfd_errmsg (bfd_get_error ())); - } - if (build_section_table (abfd, &so -> sections, &so -> sections_end)) - { - error ("Can't find the file sections in `%s': %s", - bfd_get_filename (exec_bfd), bfd_errmsg (bfd_get_error ())); - } - - /* Irix 5 shared objects are pre-linked to particular addresses - although the dynamic linker may have to relocate them if the - address ranges of the libraries used by the main program clash. - The offset is the difference between the address where the object - is mapped and the binding address of the shared library. */ - offset = (CORE_ADDR) LM_ADDR (so) - so -> lm.o_base_address; - - for (p = so -> sections; p < so -> sections_end; p++) - { - /* Relocate the section binding addresses as recorded in the shared - object's file by the offset to get the address to which the - object was actually mapped. */ - p -> addr += offset; - p -> endaddr += offset; - so -> lmend = (CORE_ADDR) max (p -> endaddr, so -> lmend); - if (STREQ (p -> the_bfd_section -> name, ".text")) - { - so -> textsection = p; - } - } - - /* Free the file names, close the file now. */ - do_cleanups (old_chain); -} - -/* - -LOCAL FUNCTION - - locate_base -- locate the base address of dynamic linker structs - -SYNOPSIS - - CORE_ADDR locate_base (void) - -DESCRIPTION - - For both the SunOS and SVR4 shared library implementations, if the - inferior executable has been linked dynamically, there is a single - address somewhere in the inferior's data space which is the key to - locating all of the dynamic linker's runtime structures. This - address is the value of the symbol defined by the macro DEBUG_BASE. - The job of this function is to find and return that address, or to - return 0 if there is no such address (the executable is statically - linked for example). - - For SunOS, the job is almost trivial, since the dynamic linker and - all of it's structures are statically linked to the executable at - link time. Thus the symbol for the address we are looking for has - already been added to the minimal symbol table for the executable's - objfile at the time the symbol file's symbols were read, and all we - have to do is look it up there. Note that we explicitly do NOT want - to find the copies in the shared library. - - The SVR4 version is much more complicated because the dynamic linker - and it's structures are located in the shared C library, which gets - run as the executable's "interpreter" by the kernel. We have to go - to a lot more work to discover the address of DEBUG_BASE. Because - of this complexity, we cache the value we find and return that value - on subsequent invocations. Note there is no copy in the executable - symbol tables. - - Irix 5 is basically like SunOS. - - Note that we can assume nothing about the process state at the time - we need to find this address. We may be stopped on the first instruc- - tion of the interpreter (C shared library), the first instruction of - the executable itself, or somewhere else entirely (if we attached - to the process for example). - - */ - -static CORE_ADDR -locate_base () -{ - struct minimal_symbol *msymbol; - CORE_ADDR address = 0; - - msymbol = lookup_minimal_symbol (DEBUG_BASE, NULL, symfile_objfile); - if ((msymbol != NULL) && (SYMBOL_VALUE_ADDRESS (msymbol) != 0)) - { - address = SYMBOL_VALUE_ADDRESS (msymbol); - } - return (address); -} - -/* - -LOCAL FUNCTION - - first_link_map_member -- locate first member in dynamic linker's map - -SYNOPSIS - - static struct link_map *first_link_map_member (void) - -DESCRIPTION - - Read in a copy of the first member in the inferior's dynamic - link map from the inferior's dynamic linker structures, and return - a pointer to the copy in our address space. -*/ - -static struct obj_list * -first_link_map_member () -{ - struct obj_list *lm; - struct obj_list s; - - read_memory (debug_base, (char *) &lm, sizeof (struct obj_list *)); - - if (lm == NULL) - return NULL; - - /* The first entry in the list is the object file we are debugging, - so skip it. */ - read_memory ((CORE_ADDR) lm, (char *) &s, sizeof (struct obj_list)); - - return s.next; -} - -/* - -LOCAL FUNCTION - - find_solib -- step through list of shared objects - -SYNOPSIS - - struct so_list *find_solib (struct so_list *so_list_ptr) - -DESCRIPTION - - This module contains the routine which finds the names of any - loaded "images" in the current process. The argument in must be - NULL on the first call, and then the returned value must be passed - in on subsequent calls. This provides the capability to "step" down - the list of loaded objects. On the last object, a NULL value is - returned. - */ - -static struct so_list * -find_solib (so_list_ptr) - struct so_list *so_list_ptr; /* Last lm or NULL for first one */ -{ - struct so_list *so_list_next = NULL; - struct obj_list *lm = NULL; - struct so_list *new; - - if (so_list_ptr == NULL) - { - /* We are setting up for a new scan through the loaded images. */ - if ((so_list_next = so_list_head) == NULL) - { - /* We have not already read in the dynamic linking structures - from the inferior, lookup the address of the base structure. */ - debug_base = locate_base (); - if (debug_base != 0) - { - /* Read the base structure in and find the address of the first - link map list member. */ - lm = first_link_map_member (); - } - } - } - else - { - /* We have been called before, and are in the process of walking - the shared library list. Advance to the next shared object. */ - if ((lm = so_list_ptr->ll.next) == NULL) - { - /* We have hit the end of the list, so check to see if any were - added, but be quiet if we can't read from the target any more. */ - int status = target_read_memory ((CORE_ADDR) so_list_ptr -> lladdr, - (char *) &(so_list_ptr -> ll), - sizeof (struct obj_list)); - if (status == 0) - { - lm = so_list_ptr->ll.next; - } - else - { - lm = NULL; - } - } - so_list_next = so_list_ptr -> next; - } - if ((so_list_next == NULL) && (lm != NULL)) - { - int errcode; - char *buffer; - - /* Get next link map structure from inferior image and build a local - abbreviated load_map structure */ - new = (struct so_list *) xmalloc (sizeof (struct so_list)); - memset ((char *) new, 0, sizeof (struct so_list)); - new -> lladdr = lm; - /* Add the new node as the next node in the list, or as the root - node if this is the first one. */ - if (so_list_ptr != NULL) - { - so_list_ptr -> next = new; - } - else - { - so_list_head = new; - } - so_list_next = new; - read_memory ((CORE_ADDR) lm, (char *) &(new -> ll), - sizeof (struct obj_list)); - read_memory ((CORE_ADDR) new->ll.data, (char *) &(new -> lm), - sizeof (struct obj)); - target_read_string ((CORE_ADDR)new->lm.o_path, &buffer, - INT_MAX, &errcode); - if (errcode != 0) - memory_error (errcode, (CORE_ADDR)new->lm.o_path); - new->lm.o_path = buffer; - solib_map_sections (new); - } - return (so_list_next); -} - -/* A small stub to get us past the arg-passing pinhole of catch_errors. */ - -static int -symbol_add_stub (arg) - char *arg; -{ - register struct so_list *so = (struct so_list *) arg; /* catch_errs bogon */ - - so -> objfile = symbol_file_add (so -> lm.o_path, so -> from_tty, - (unsigned int) so -> textsection -> addr, - 0, 0, 0); - return (1); -} - -/* - -GLOBAL FUNCTION - - solib_add -- add a shared library file to the symtab and section list - -SYNOPSIS - - void solib_add (char *arg_string, int from_tty, - struct target_ops *target) - -DESCRIPTION - -*/ - -void -solib_add (arg_string, from_tty, target) - char *arg_string; - int from_tty; - struct target_ops *target; -{ - register struct so_list *so = NULL; /* link map state variable */ - - /* Last shared library that we read. */ - struct so_list *so_last = NULL; - - char *re_err; - int count; - int old; - - if ((re_err = re_comp (arg_string ? arg_string : ".")) != NULL) - { - error ("Invalid regexp: %s", re_err); - } - - /* Add the shared library sections to the section table of the - specified target, if any. */ - if (target) - { - /* Count how many new section_table entries there are. */ - so = NULL; - count = 0; - while ((so = find_solib (so)) != NULL) - { - if (so -> lm.o_path[0]) - { - count += so -> sections_end - so -> sections; - } - } - - if (count) - { - int update_coreops; - - /* We must update the to_sections field in the core_ops structure - here, otherwise we dereference a potential dangling pointer - for each call to target_read/write_memory within this routine. */ - update_coreops = core_ops.to_sections == target->to_sections; - - /* Reallocate the target's section table including the new size. */ - if (target -> to_sections) - { - old = target -> to_sections_end - target -> to_sections; - target -> to_sections = (struct section_table *) - xrealloc ((char *)target -> to_sections, - (sizeof (struct section_table)) * (count + old)); - } - else - { - old = 0; - target -> to_sections = (struct section_table *) - xmalloc ((sizeof (struct section_table)) * count); - } - target -> to_sections_end = target -> to_sections + (count + old); - - /* Update the to_sections field in the core_ops structure - if needed. */ - if (update_coreops) - { - core_ops.to_sections = target->to_sections; - core_ops.to_sections_end = target->to_sections_end; - } - - /* Add these section table entries to the target's table. */ - while ((so = find_solib (so)) != NULL) - { - if (so -> lm.o_path[0]) - { - count = so -> sections_end - so -> sections; - memcpy ((char *) (target -> to_sections + old), - so -> sections, - (sizeof (struct section_table)) * count); - old += count; - } - } - } - } - - /* Now add the symbol files. */ - while ((so = find_solib (so)) != NULL) - { - if (so -> lm.o_path[0] && re_exec (so -> lm.o_path)) - { - so -> from_tty = from_tty; - if (so -> symbols_loaded) - { - if (from_tty) - { - printf_unfiltered ("Symbols already loaded for %s\n", so -> lm.o_path); - } - } - else if (catch_errors - (symbol_add_stub, (char *) so, - "Error while reading shared library symbols:\n", - RETURN_MASK_ALL)) - { - so_last = so; - so -> symbols_loaded = 1; - } - } - } - - /* Getting new symbols may change our opinion about what is - frameless. */ - if (so_last) - reinit_frame_cache (); -} - -/* - -LOCAL FUNCTION - - info_sharedlibrary_command -- code for "info sharedlibrary" - -SYNOPSIS - - static void info_sharedlibrary_command () - -DESCRIPTION - - Walk through the shared library list and print information - about each attached library. -*/ - -static void -info_sharedlibrary_command (ignore, from_tty) - char *ignore; - int from_tty; -{ - register struct so_list *so = NULL; /* link map state variable */ - int header_done = 0; - - if (exec_bfd == NULL) - { - printf_unfiltered ("No exec file.\n"); - return; - } - while ((so = find_solib (so)) != NULL) - { - if (so -> lm.o_path[0]) - { - if (!header_done) - { - printf_unfiltered("%-12s%-12s%-12s%s\n", "From", "To", "Syms Read", - "Shared Object Library"); - header_done++; - } - printf_unfiltered ("%-12s", - local_hex_string_custom ((unsigned long) LM_ADDR (so), - "08l")); - printf_unfiltered ("%-12s", - local_hex_string_custom ((unsigned long) so -> lmend, - "08l")); - printf_unfiltered ("%-12s", so -> symbols_loaded ? "Yes" : "No"); - printf_unfiltered ("%s\n", so -> lm.o_path); - } - } - if (so_list_head == NULL) - { - printf_unfiltered ("No shared libraries loaded at this time.\n"); - } -} - -/* - -GLOBAL FUNCTION - - solib_address -- check to see if an address is in a shared lib - -SYNOPSIS - - char *solib_address (CORE_ADDR address) - -DESCRIPTION - - Provides a hook for other gdb routines to discover whether or - not a particular address is within the mapped address space of - a shared library. Any address between the base mapping address - and the first address beyond the end of the last mapping, is - considered to be within the shared library address space, for - our purposes. - - For example, this routine is called at one point to disable - breakpoints which are in shared libraries that are not currently - mapped in. - */ - -char * -solib_address (address) - CORE_ADDR address; -{ - register struct so_list *so = 0; /* link map state variable */ - - while ((so = find_solib (so)) != NULL) - { - if (so -> lm.o_path[0]) - { - if ((address >= (CORE_ADDR) LM_ADDR (so)) && - (address < (CORE_ADDR) so -> lmend)) - return (so->lm.o_path); - } - } - return (0); -} - -/* Called by free_all_symtabs */ - -void -clear_solib() -{ - struct so_list *next; - char *bfd_filename; - - while (so_list_head) - { - if (so_list_head -> sections) - { - free ((PTR)so_list_head -> sections); - } - if (so_list_head -> abfd) - { - bfd_filename = bfd_get_filename (so_list_head -> abfd); - if (!bfd_close (so_list_head -> abfd)) - warning ("cannot close \"%s\": %s", - bfd_filename, bfd_errmsg (bfd_get_error ())); - } - else - /* This happens for the executable on SVR4. */ - bfd_filename = NULL; - - next = so_list_head -> next; - if (bfd_filename) - free ((PTR)bfd_filename); - free (so_list_head->lm.o_path); - free ((PTR)so_list_head); - so_list_head = next; - } - debug_base = 0; -} - -/* - -LOCAL FUNCTION - - disable_break -- remove the "mapping changed" breakpoint - -SYNOPSIS - - static int disable_break () - -DESCRIPTION - - Removes the breakpoint that gets hit when the dynamic linker - completes a mapping change. - -*/ - -static int -disable_break () -{ - int status = 1; - - - /* Note that breakpoint address and original contents are in our address - space, so we just need to write the original contents back. */ - - if (memory_remove_breakpoint (breakpoint_addr, shadow_contents) != 0) - { - status = 0; - } - - /* For the SVR4 version, we always know the breakpoint address. For the - SunOS version we don't know it until the above code is executed. - Grumble if we are stopped anywhere besides the breakpoint address. */ - - if (stop_pc != breakpoint_addr) - { - warning ("stopped at unknown breakpoint while handling shared libraries"); - } - - return (status); -} - -/* - -LOCAL FUNCTION - - enable_break -- arrange for dynamic linker to hit breakpoint - -SYNOPSIS - - int enable_break (void) - -DESCRIPTION - - This functions inserts a breakpoint at the entry point of the - main executable, where all shared libraries are mapped in. -*/ - -static int -enable_break () -{ - if (symfile_objfile != NULL - && target_insert_breakpoint (symfile_objfile->ei.entry_point, - shadow_contents) == 0) - { - breakpoint_addr = symfile_objfile->ei.entry_point; - return 1; - } - - return 0; -} - -/* - -GLOBAL FUNCTION - - solib_create_inferior_hook -- shared library startup support - -SYNOPSIS - - void solib_create_inferior_hook() - -DESCRIPTION - - When gdb starts up the inferior, it nurses it along (through the - shell) until it is ready to execute it's first instruction. At this - point, this function gets called via expansion of the macro - SOLIB_CREATE_INFERIOR_HOOK. - - For SunOS executables, this first instruction is typically the - one at "_start", or a similar text label, regardless of whether - the executable is statically or dynamically linked. The runtime - startup code takes care of dynamically linking in any shared - libraries, once gdb allows the inferior to continue. - - For SVR4 executables, this first instruction is either the first - instruction in the dynamic linker (for dynamically linked - executables) or the instruction at "start" for statically linked - executables. For dynamically linked executables, the system - first exec's /lib/libc.so.N, which contains the dynamic linker, - and starts it running. The dynamic linker maps in any needed - shared libraries, maps in the actual user executable, and then - jumps to "start" in the user executable. - - For both SunOS shared libraries, and SVR4 shared libraries, we - can arrange to cooperate with the dynamic linker to discover the - names of shared libraries that are dynamically linked, and the - base addresses to which they are linked. - - This function is responsible for discovering those names and - addresses, and saving sufficient information about them to allow - their symbols to be read at a later time. - -FIXME - - Between enable_break() and disable_break(), this code does not - properly handle hitting breakpoints which the user might have - set in the startup code or in the dynamic linker itself. Proper - handling will probably have to wait until the implementation is - changed to use the "breakpoint handler function" method. - - Also, what if child has exit()ed? Must exit loop somehow. - */ - -void -solib_create_inferior_hook() -{ - if (!enable_break ()) - { - warning ("shared library handler failed to enable breakpoint"); - return; - } - - /* Now run the target. It will eventually hit the breakpoint, at - which point all of the libraries will have been mapped in and we - can go groveling around in the dynamic linker structures to find - out what we need to know about them. */ - - clear_proceed_status (); - stop_soon_quietly = 1; - stop_signal = 0; - do - { - target_resume (-1, 0, stop_signal); - wait_for_inferior (); - } - while (stop_signal != SIGTRAP); - - /* We are now either at the "mapping complete" breakpoint (or somewhere - else, a condition we aren't prepared to deal with anyway), so adjust - the PC as necessary after a breakpoint, disable the breakpoint, and - add any shared libraries that were mapped in. */ - - if (DECR_PC_AFTER_BREAK) - { - stop_pc -= DECR_PC_AFTER_BREAK; - write_register (PC_REGNUM, stop_pc); - } - - if (!disable_break ()) - { - warning ("shared library handler failed to disable breakpoint"); - } - - /* solib_add will call reinit_frame_cache. - But we are stopped in the startup code and we might not have symbols - for the startup code, so heuristic_proc_start could be called - and will put out an annoying warning. - Delaying the resetting of stop_soon_quietly until after symbol loading - suppresses the warning. */ - if (auto_solib_add) - solib_add ((char *) 0, 0, (struct target_ops *) 0); - stop_soon_quietly = 0; -} - -/* - -LOCAL FUNCTION - - sharedlibrary_command -- handle command to explicitly add library - -SYNOPSIS - - static void sharedlibrary_command (char *args, int from_tty) - -DESCRIPTION - -*/ - -static void -sharedlibrary_command (args, from_tty) -char *args; -int from_tty; -{ - dont_repeat (); - solib_add (args, from_tty, (struct target_ops *) 0); -} - -void -_initialize_solib() -{ - add_com ("sharedlibrary", class_files, sharedlibrary_command, - "Load shared object library symbols for files matching REGEXP."); - add_info ("sharedlibrary", info_sharedlibrary_command, - "Status of loaded shared object libraries."); - - add_show_from_set - (add_set_cmd ("auto-solib-add", class_support, var_zinteger, - (char *) &auto_solib_add, - "Set autoloading of shared library symbols.\n\ -If nonzero, symbols from all shared object libraries will be loaded\n\ -automatically when the inferior begins execution or when the dynamic linker\n\ -informs gdb that a new library has been loaded. Otherwise, symbols\n\ -must be loaded manually, using `sharedlibrary'.", - &setlist), - &showlist); -} - - -/* Register that we are able to handle irix5 core file formats. - This really is bfd_target_unknown_flavour */ - -static struct core_fns irix5_core_fns = -{ - bfd_target_unknown_flavour, - fetch_core_registers, - NULL -}; - -void -_initialize_core_irix5 () -{ - add_core_fns (&irix5_core_fns); -} diff --git a/contrib/gdb/gdb/isi-xdep.c b/contrib/gdb/gdb/isi-xdep.c deleted file mode 100644 index 8773c83..0000000 --- a/contrib/gdb/gdb/isi-xdep.c +++ /dev/null @@ -1,20 +0,0 @@ -/* Copyright (C) 1993 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. */ - -#include -int rloc[] = { - R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, FP, SP, PS, PC -}; diff --git a/contrib/gdb/gdb/kdb-start.c b/contrib/gdb/gdb/kdb-start.c deleted file mode 100644 index bec558f..0000000 --- a/contrib/gdb/gdb/kdb-start.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Main loop for the standalone kernel debugger, for GDB, the GNU Debugger. - Copyright 1989, 1991, 1992 Free Software Foundation, Inc. - -This file is part of GDB. - -This 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" - -static char *args[] = {"kdb", "kdb-symbols", 0}; - -static char *environment[] = {0}; - -char **environ; - -start () -{ - INIT_STACK (kdb_stack_beg, kdb_stack_end); - - environ = environment; - - main (2, args, environment); -} diff --git a/contrib/gdb/gdb/lynx-nat.c b/contrib/gdb/gdb/lynx-nat.c deleted file mode 100644 index 78716e0..0000000 --- a/contrib/gdb/gdb/lynx-nat.c +++ /dev/null @@ -1,838 +0,0 @@ -/* Native-dependent code for LynxOS. - Copyright 1993, 1994 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 "frame.h" -#include "inferior.h" -#include "target.h" -#include "gdbcore.h" - -#include -#include -#include - -static unsigned long registers_addr PARAMS ((int pid)); - -#define X(ENTRY)(offsetof(struct econtext, ENTRY)) - -#ifdef I386 -/* Mappings from tm-i386v.h */ - -static int regmap[] = -{ - X(eax), - X(ecx), - X(edx), - X(ebx), - X(esp), /* sp */ - X(ebp), /* fp */ - X(esi), - X(edi), - X(eip), /* pc */ - X(flags), /* ps */ - X(cs), - X(ss), - X(ds), - X(es), - X(ecode), /* Lynx doesn't give us either fs or gs, so */ - X(fault), /* we just substitute these two in the hopes - that they are useful. */ -}; -#endif /* I386 */ - -#ifdef M68K -/* Mappings from tm-m68k.h */ - -static int regmap[] = -{ - X(regs[0]), /* d0 */ - X(regs[1]), /* d1 */ - X(regs[2]), /* d2 */ - X(regs[3]), /* d3 */ - X(regs[4]), /* d4 */ - X(regs[5]), /* d5 */ - X(regs[6]), /* d6 */ - X(regs[7]), /* d7 */ - X(regs[8]), /* a0 */ - X(regs[9]), /* a1 */ - X(regs[10]), /* a2 */ - X(regs[11]), /* a3 */ - X(regs[12]), /* a4 */ - X(regs[13]), /* a5 */ - X(regs[14]), /* fp */ - offsetof (st_t, usp) - offsetof (st_t, ec), /* sp */ - X(status), /* ps */ - X(pc), - - X(fregs[0*3]), /* fp0 */ - X(fregs[1*3]), /* fp1 */ - X(fregs[2*3]), /* fp2 */ - X(fregs[3*3]), /* fp3 */ - X(fregs[4*3]), /* fp4 */ - X(fregs[5*3]), /* fp5 */ - X(fregs[6*3]), /* fp6 */ - X(fregs[7*3]), /* fp7 */ - - X(fcregs[0]), /* fpcontrol */ - X(fcregs[1]), /* fpstatus */ - X(fcregs[2]), /* fpiaddr */ - X(ssw), /* fpcode */ - X(fault), /* fpflags */ -}; -#endif /* M68K */ - -#ifdef SPARC -/* Mappings from tm-sparc.h */ - -#define FX(ENTRY)(offsetof(struct fcontext, ENTRY)) - -static int regmap[] = -{ - -1, /* g0 */ - X(g1), - X(g2), - X(g3), - X(g4), - -1, /* g5->g7 aren't saved by Lynx */ - -1, - -1, - - X(o[0]), - X(o[1]), - X(o[2]), - X(o[3]), - X(o[4]), - X(o[5]), - X(o[6]), /* sp */ - X(o[7]), /* ra */ - - -1,-1,-1,-1,-1,-1,-1,-1, /* l0 -> l7 */ - - -1,-1,-1,-1,-1,-1,-1,-1, /* i0 -> i7 */ - - FX(f.fregs[0]), /* f0 */ - FX(f.fregs[1]), - FX(f.fregs[2]), - FX(f.fregs[3]), - FX(f.fregs[4]), - FX(f.fregs[5]), - FX(f.fregs[6]), - FX(f.fregs[7]), - FX(f.fregs[8]), - FX(f.fregs[9]), - FX(f.fregs[10]), - FX(f.fregs[11]), - FX(f.fregs[12]), - FX(f.fregs[13]), - FX(f.fregs[14]), - FX(f.fregs[15]), - FX(f.fregs[16]), - FX(f.fregs[17]), - FX(f.fregs[18]), - FX(f.fregs[19]), - FX(f.fregs[20]), - FX(f.fregs[21]), - FX(f.fregs[22]), - FX(f.fregs[23]), - FX(f.fregs[24]), - FX(f.fregs[25]), - FX(f.fregs[26]), - FX(f.fregs[27]), - FX(f.fregs[28]), - FX(f.fregs[29]), - FX(f.fregs[30]), - FX(f.fregs[31]), - - X(y), - X(psr), - X(wim), - X(tbr), - X(pc), - X(npc), - FX(fsr), /* fpsr */ - -1, /* cpsr */ -}; -#endif /* SPARC */ - -#ifdef rs6000 - -static int regmap[] = -{ - X(iregs[0]), /* r0 */ - X(iregs[1]), - X(iregs[2]), - X(iregs[3]), - X(iregs[4]), - X(iregs[5]), - X(iregs[6]), - X(iregs[7]), - X(iregs[8]), - X(iregs[9]), - X(iregs[10]), - X(iregs[11]), - X(iregs[12]), - X(iregs[13]), - X(iregs[14]), - X(iregs[15]), - X(iregs[16]), - X(iregs[17]), - X(iregs[18]), - X(iregs[19]), - X(iregs[20]), - X(iregs[21]), - X(iregs[22]), - X(iregs[23]), - X(iregs[24]), - X(iregs[25]), - X(iregs[26]), - X(iregs[27]), - X(iregs[28]), - X(iregs[29]), - X(iregs[30]), - X(iregs[31]), - - X(fregs[0]), /* f0 */ - X(fregs[1]), - X(fregs[2]), - X(fregs[3]), - X(fregs[4]), - X(fregs[5]), - X(fregs[6]), - X(fregs[7]), - X(fregs[8]), - X(fregs[9]), - X(fregs[10]), - X(fregs[11]), - X(fregs[12]), - X(fregs[13]), - X(fregs[14]), - X(fregs[15]), - X(fregs[16]), - X(fregs[17]), - X(fregs[18]), - X(fregs[19]), - X(fregs[20]), - X(fregs[21]), - X(fregs[22]), - X(fregs[23]), - X(fregs[24]), - X(fregs[25]), - X(fregs[26]), - X(fregs[27]), - X(fregs[28]), - X(fregs[29]), - X(fregs[30]), - X(fregs[31]), - - X(srr0), /* IAR (PC) */ - X(srr1), /* MSR (PS) */ - X(cr), /* CR */ - X(lr), /* LR */ - X(ctr), /* CTR */ - X(xer), /* XER */ - X(mq) /* MQ */ -}; - -#endif /* rs6000 */ - -#ifdef SPARC - -/* This routine handles some oddball cases for Sparc registers and LynxOS. - In partucular, it causes refs to G0, g5->7, and all fp regs to return zero. - It also handles knows where to find the I & L regs on the stack. */ - -void -fetch_inferior_registers (regno) - int regno; -{ - int whatregs = 0; - -#define WHATREGS_FLOAT 1 -#define WHATREGS_GEN 2 -#define WHATREGS_STACK 4 - - if (regno == -1) - whatregs = WHATREGS_FLOAT | WHATREGS_GEN | WHATREGS_STACK; - else if (regno >= L0_REGNUM && regno <= I7_REGNUM) - whatregs = WHATREGS_STACK; - else if (regno >= FP0_REGNUM && regno < FP0_REGNUM + 32) - whatregs = WHATREGS_FLOAT; - else - whatregs = WHATREGS_GEN; - - if (whatregs & WHATREGS_GEN) - { - struct econtext ec; /* general regs */ - char buf[MAX_REGISTER_RAW_SIZE]; - int retval; - int i; - - errno = 0; - retval = ptrace (PTRACE_GETREGS, inferior_pid, (PTRACE_ARG3_TYPE) &ec, - 0); - if (errno) - perror_with_name ("ptrace(PTRACE_GETREGS)"); - - memset (buf, 0, REGISTER_RAW_SIZE (G0_REGNUM)); - supply_register (G0_REGNUM, buf); - supply_register (TBR_REGNUM, (char *)&ec.tbr); - - memcpy (®isters[REGISTER_BYTE (G1_REGNUM)], &ec.g1, - 4 * REGISTER_RAW_SIZE (G1_REGNUM)); - for (i = G1_REGNUM; i <= G1_REGNUM + 3; i++) - register_valid[i] = 1; - - supply_register (PS_REGNUM, (char *)&ec.psr); - supply_register (Y_REGNUM, (char *)&ec.y); - supply_register (PC_REGNUM, (char *)&ec.pc); - supply_register (NPC_REGNUM, (char *)&ec.npc); - supply_register (WIM_REGNUM, (char *)&ec.wim); - - memcpy (®isters[REGISTER_BYTE (O0_REGNUM)], ec.o, - 8 * REGISTER_RAW_SIZE (O0_REGNUM)); - for (i = O0_REGNUM; i <= O0_REGNUM + 7; i++) - register_valid[i] = 1; - } - - if (whatregs & WHATREGS_STACK) - { - CORE_ADDR sp; - int i; - - sp = read_register (SP_REGNUM); - - target_xfer_memory (sp + FRAME_SAVED_I0, - ®isters[REGISTER_BYTE(I0_REGNUM)], - 8 * REGISTER_RAW_SIZE (I0_REGNUM), 0); - for (i = I0_REGNUM; i <= I7_REGNUM; i++) - register_valid[i] = 1; - - target_xfer_memory (sp + FRAME_SAVED_L0, - ®isters[REGISTER_BYTE(L0_REGNUM)], - 8 * REGISTER_RAW_SIZE (L0_REGNUM), 0); - for (i = L0_REGNUM; i <= L0_REGNUM + 7; i++) - register_valid[i] = 1; - } - - if (whatregs & WHATREGS_FLOAT) - { - struct fcontext fc; /* fp regs */ - int retval; - int i; - - errno = 0; - retval = ptrace (PTRACE_GETFPREGS, inferior_pid, (PTRACE_ARG3_TYPE) &fc, - 0); - if (errno) - perror_with_name ("ptrace(PTRACE_GETFPREGS)"); - - memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)], fc.f.fregs, - 32 * REGISTER_RAW_SIZE (FP0_REGNUM)); - for (i = FP0_REGNUM; i <= FP0_REGNUM + 31; i++) - register_valid[i] = 1; - - supply_register (FPS_REGNUM, (char *)&fc.fsr); - } -} - -/* This routine handles storing of the I & L regs for the Sparc. The trick - here is that they actually live on the stack. The really tricky part is - that when changing the stack pointer, the I & L regs must be written to - where the new SP points, otherwise the regs will be incorrect when the - process is started up again. We assume that the I & L regs are valid at - this point. */ - -void -store_inferior_registers (regno) - int regno; -{ - int whatregs = 0; - - if (regno == -1) - whatregs = WHATREGS_FLOAT | WHATREGS_GEN | WHATREGS_STACK; - else if (regno >= L0_REGNUM && regno <= I7_REGNUM) - whatregs = WHATREGS_STACK; - else if (regno >= FP0_REGNUM && regno < FP0_REGNUM + 32) - whatregs = WHATREGS_FLOAT; - else if (regno == SP_REGNUM) - whatregs = WHATREGS_STACK | WHATREGS_GEN; - else - whatregs = WHATREGS_GEN; - - if (whatregs & WHATREGS_GEN) - { - struct econtext ec; /* general regs */ - int retval; - - ec.tbr = read_register (TBR_REGNUM); - memcpy (&ec.g1, ®isters[REGISTER_BYTE (G1_REGNUM)], - 4 * REGISTER_RAW_SIZE (G1_REGNUM)); - - ec.psr = read_register (PS_REGNUM); - ec.y = read_register (Y_REGNUM); - ec.pc = read_register (PC_REGNUM); - ec.npc = read_register (NPC_REGNUM); - ec.wim = read_register (WIM_REGNUM); - - memcpy (ec.o, ®isters[REGISTER_BYTE (O0_REGNUM)], - 8 * REGISTER_RAW_SIZE (O0_REGNUM)); - - errno = 0; - retval = ptrace (PTRACE_SETREGS, inferior_pid, (PTRACE_ARG3_TYPE) &ec, - 0); - if (errno) - perror_with_name ("ptrace(PTRACE_SETREGS)"); - } - - if (whatregs & WHATREGS_STACK) - { - int regoffset; - CORE_ADDR sp; - - sp = read_register (SP_REGNUM); - - if (regno == -1 || regno == SP_REGNUM) - { - if (!register_valid[L0_REGNUM+5]) - abort(); - target_xfer_memory (sp + FRAME_SAVED_I0, - ®isters[REGISTER_BYTE (I0_REGNUM)], - 8 * REGISTER_RAW_SIZE (I0_REGNUM), 1); - - target_xfer_memory (sp + FRAME_SAVED_L0, - ®isters[REGISTER_BYTE (L0_REGNUM)], - 8 * REGISTER_RAW_SIZE (L0_REGNUM), 1); - } - else if (regno >= L0_REGNUM && regno <= I7_REGNUM) - { - if (!register_valid[regno]) - abort(); - if (regno >= L0_REGNUM && regno <= L0_REGNUM + 7) - regoffset = REGISTER_BYTE (regno) - REGISTER_BYTE (L0_REGNUM) - + FRAME_SAVED_L0; - else - regoffset = REGISTER_BYTE (regno) - REGISTER_BYTE (I0_REGNUM) - + FRAME_SAVED_I0; - target_xfer_memory (sp + regoffset, ®isters[REGISTER_BYTE (regno)], - REGISTER_RAW_SIZE (regno), 1); - } - } - - if (whatregs & WHATREGS_FLOAT) - { - struct fcontext fc; /* fp regs */ - int retval; - -/* We read fcontext first so that we can get good values for fq_t... */ - errno = 0; - retval = ptrace (PTRACE_GETFPREGS, inferior_pid, (PTRACE_ARG3_TYPE) &fc, - 0); - if (errno) - perror_with_name ("ptrace(PTRACE_GETFPREGS)"); - - memcpy (fc.f.fregs, ®isters[REGISTER_BYTE (FP0_REGNUM)], - 32 * REGISTER_RAW_SIZE (FP0_REGNUM)); - - fc.fsr = read_register (FPS_REGNUM); - - errno = 0; - retval = ptrace (PTRACE_SETFPREGS, inferior_pid, (PTRACE_ARG3_TYPE) &fc, - 0); - if (errno) - perror_with_name ("ptrace(PTRACE_SETFPREGS)"); - } -} -#endif /* SPARC */ - -#if defined (I386) || defined (M68K) || defined (rs6000) - -/* Return the offset relative to the start of the per-thread data to the - saved context block. */ - -static unsigned long -registers_addr(pid) - int pid; -{ - CORE_ADDR stblock; - int ecpoff = offsetof(st_t, ecp); - CORE_ADDR ecp; - - errno = 0; - stblock = (CORE_ADDR) ptrace (PTRACE_THREADUSER, pid, (PTRACE_ARG3_TYPE)0, - 0); - if (errno) - perror_with_name ("ptrace(PTRACE_THREADUSER)"); - - ecp = (CORE_ADDR) ptrace (PTRACE_PEEKTHREAD, pid, (PTRACE_ARG3_TYPE)ecpoff, - 0); - if (errno) - perror_with_name ("ptrace(PTRACE_PEEKTHREAD)"); - - return ecp - stblock; -} - -/* Fetch one or more registers from the inferior. REGNO == -1 to get - them all. We actually fetch more than requested, when convenient, - marking them as valid so we won't fetch them again. */ - -void -fetch_inferior_registers (regno) - int regno; -{ - int reglo, reghi; - int i; - unsigned long ecp; - - if (regno == -1) - { - reglo = 0; - reghi = NUM_REGS - 1; - } - else - reglo = reghi = regno; - - ecp = registers_addr (inferior_pid); - - for (regno = reglo; regno <= reghi; regno++) - { - char buf[MAX_REGISTER_RAW_SIZE]; - int ptrace_fun = PTRACE_PEEKTHREAD; - -#ifdef M68K - ptrace_fun = regno == SP_REGNUM ? PTRACE_PEEKUSP : PTRACE_PEEKTHREAD; -#endif - - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) - { - unsigned int reg; - - errno = 0; - reg = ptrace (ptrace_fun, inferior_pid, - (PTRACE_ARG3_TYPE) (ecp + regmap[regno] + i), 0); - if (errno) - perror_with_name ("ptrace(PTRACE_PEEKUSP)"); - - *(int *)&buf[i] = reg; - } - supply_register (regno, buf); - } -} - -/* Store our register values back into the inferior. - If REGNO is -1, do this for all registers. - Otherwise, REGNO specifies which register (so we can save time). */ - -/* Registers we shouldn't try to store. */ -#if !defined (CANNOT_STORE_REGISTER) -#define CANNOT_STORE_REGISTER(regno) 0 -#endif - -void -store_inferior_registers (regno) - int regno; -{ - int reglo, reghi; - int i; - unsigned long ecp; - - if (regno == -1) - { - reglo = 0; - reghi = NUM_REGS - 1; - } - else - reglo = reghi = regno; - - ecp = registers_addr (inferior_pid); - - for (regno = reglo; regno <= reghi; regno++) - { - int ptrace_fun = PTRACE_POKEUSER; - - if (CANNOT_STORE_REGISTER (regno)) - continue; - -#ifdef M68K - ptrace_fun = regno == SP_REGNUM ? PTRACE_POKEUSP : PTRACE_POKEUSER; -#endif - - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) - { - unsigned int reg; - - reg = *(unsigned int *)®isters[REGISTER_BYTE (regno) + i]; - - errno = 0; - ptrace (ptrace_fun, inferior_pid, - (PTRACE_ARG3_TYPE) (ecp + regmap[regno] + i), reg); - if (errno) - perror_with_name ("ptrace(PTRACE_POKEUSP)"); - } - } -} -#endif /* defined (I386) || defined (M68K) || defined (rs6000) */ - -/* Wait for child to do something. Return pid of child, or -1 in case - of error; store status through argument pointer OURSTATUS. */ - -int -child_wait (pid, ourstatus) - int pid; - struct target_waitstatus *ourstatus; -{ - int save_errno; - int thread; - union wait status; - - while (1) - { - int sig; - - set_sigint_trap(); /* Causes SIGINT to be passed on to the - attached process. */ - pid = wait (&status); - - save_errno = errno; - - clear_sigint_trap(); - - if (pid == -1) - { - if (save_errno == EINTR) - continue; - fprintf_unfiltered (gdb_stderr, "Child process unexpectedly missing: %s.\n", - safe_strerror (save_errno)); - /* Claim it exited with unknown signal. */ - ourstatus->kind = TARGET_WAITKIND_SIGNALLED; - ourstatus->value.sig = TARGET_SIGNAL_UNKNOWN; - return -1; - } - - if (pid != PIDGET (inferior_pid)) /* Some other process?!? */ - continue; - - thread = status.w_tid; /* Get thread id from status */ - - /* Initial thread value can only be acquired via wait, so we have to - resort to this hack. */ - - if (TIDGET (inferior_pid) == 0 && thread != 0) - { - inferior_pid = BUILDPID (inferior_pid, thread); - add_thread (inferior_pid); - } - - pid = BUILDPID (pid, thread); - - /* We've become a single threaded process again. */ - if (thread == 0) - inferior_pid = pid; - - /* Check for thread creation. */ - if (WIFSTOPPED(status) - && WSTOPSIG(status) == SIGTRAP - && !in_thread_list (pid)) - { - int realsig; - - realsig = ptrace (PTRACE_GETTRACESIG, pid, (PTRACE_ARG3_TYPE)0, 0); - - if (realsig == SIGNEWTHREAD) - { - /* It's a new thread notification. Nothing to do here since - the machine independent code in wait_for_inferior will - add the thread to the thread list and restart the thread - when pid != inferior_pid and pid is not in the thread - list. We don't even want to much with realsig -- the - code in wait_for_inferior expects SIGTRAP. */ - ; - } - else - error ("Signal for unknown thread was not SIGNEWTHREAD"); - } - - /* Check for thread termination. */ - else if (WIFSTOPPED(status) - && WSTOPSIG(status) == SIGTRAP - && in_thread_list (pid)) - { - int realsig; - - realsig = ptrace (PTRACE_GETTRACESIG, pid, (PTRACE_ARG3_TYPE)0, 0); - - if (realsig == SIGTHREADEXIT) - { - ptrace (PTRACE_CONT, PIDGET (pid), (PTRACE_ARG3_TYPE)0, 0); - continue; - } - } - -#ifdef SPARC - /* SPARC Lynx uses an byte reversed wait status; we must use the - host macros to access it. These lines just a copy of - store_waitstatus. We can't use CHILD_SPECIAL_WAITSTATUS - because target.c can't include the Lynx . */ - if (WIFEXITED (status)) - { - ourstatus->kind = TARGET_WAITKIND_EXITED; - ourstatus->value.integer = WEXITSTATUS (status); - } - else if (!WIFSTOPPED (status)) - { - ourstatus->kind = TARGET_WAITKIND_SIGNALLED; - ourstatus->value.sig = - target_signal_from_host (WTERMSIG (status)); - } - else - { - ourstatus->kind = TARGET_WAITKIND_STOPPED; - ourstatus->value.sig = - target_signal_from_host (WSTOPSIG (status)); - } -#else - store_waitstatus (ourstatus, status.w_status); -#endif - - return pid; - } -} - -/* Return nonzero if the given thread is still alive. */ -int -child_thread_alive (pid) - int pid; -{ - /* Arggh. Apparently pthread_kill only works for threads within - the process that calls pthread_kill. - - We want to avoid the lynx signal extensions as they simply don't - map well to the generic gdb interface we want to keep. - - All we want to do is determine if a particular thread is alive; - it appears as if we can just make a harmless thread specific - ptrace call to do that. */ - return (ptrace (PTRACE_THREADUSER, pid, 0, 0) != -1); -} - -/* Resume execution of the inferior process. - If STEP is nonzero, single-step it. - If SIGNAL is nonzero, give it that signal. */ - -void -child_resume (pid, step, signal) - int pid; - int step; - enum target_signal signal; -{ - int func; - - errno = 0; - - /* If pid == -1, then we want to step/continue all threads, else - we only want to step/continue a single thread. */ - if (pid == -1) - { - pid = inferior_pid; - func = step ? PTRACE_SINGLESTEP : PTRACE_CONT; - } - else - func = step ? PTRACE_SINGLESTEP_ONE : PTRACE_CONT_ONE; - - - /* An address of (PTRACE_ARG3_TYPE)1 tells ptrace to continue from where - it was. (If GDB wanted it to start some other way, we have already - written a new PC value to the child.) - - If this system does not support PT_STEP, a higher level function will - have called single_step() to transmute the step request into a - continue request (by setting breakpoints on all possible successor - instructions), so we don't have to worry about that here. */ - - ptrace (func, pid, (PTRACE_ARG3_TYPE) 1, target_signal_to_host (signal)); - - if (errno) - perror_with_name ("ptrace"); -} - -/* Convert a Lynx process ID to a string. Returns the string in a static - buffer. */ - -char * -lynx_pid_to_str (pid) - int pid; -{ - static char buf[40]; - - sprintf (buf, "process %d thread %d", PIDGET (pid), TIDGET (pid)); - - return buf; -} - -/* Extract the register values out of the core file and store - them where `read_register' will find them. - - CORE_REG_SECT points to the register values themselves, read into memory. - CORE_REG_SIZE is the size of that area. - WHICH says which set of registers we are handling (0 = int, 2 = float - on machines where they are discontiguous). - REG_ADDR is the offset from u.u_ar0 to the register values relative to - core_reg_sect. This is used with old-fashioned core files to - locate the registers in a large upage-plus-stack ".reg" section. - Original upage address X is at location core_reg_sect+x+reg_addr. - */ - -static void -fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr) - char *core_reg_sect; - unsigned core_reg_size; - int which; - unsigned reg_addr; -{ - struct st_entry s; - unsigned int regno; - - for (regno = 0; regno < NUM_REGS; regno++) - if (regmap[regno] != -1) - supply_register (regno, core_reg_sect + offsetof (st_t, ec) - + regmap[regno]); - -#ifdef SPARC -/* Fetching this register causes all of the I & L regs to be read from the - stack and validated. */ - - fetch_inferior_registers (I0_REGNUM); -#endif -} - - -/* Register that we are able to handle lynx core file formats. - FIXME: is this really bfd_target_unknown_flavour? */ - -static struct core_fns lynx_core_fns = -{ - bfd_target_unknown_flavour, - fetch_core_registers, - NULL -}; - -void -_initialize_core_lynx () -{ - add_core_fns (&lynx_core_fns); -} diff --git a/contrib/gdb/gdb/m3-nat.c b/contrib/gdb/gdb/m3-nat.c deleted file mode 100644 index 1ea1769..0000000 --- a/contrib/gdb/gdb/m3-nat.c +++ /dev/null @@ -1,4640 +0,0 @@ -/* Interface GDB to Mach 3.0 operating systems. - (Most) Mach 3.0 related routines live in this file. - - Copyright (C) 1992 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* - * Author: Jukka Virtanen - * Computing Centre - * Helsinki University of Technology - * Finland - * - * Thanks to my friends who helped with ideas and testing: - * - * Johannes Helander, Antti Louko, Tero Mononen, - * jvh@cs.hut.fi alo@hut.fi tmo@cs.hut.fi - * - * Tero Kivinen and Eamonn McManus - * kivinen@cs.hut.fi emcmanus@gr.osf.org - * - */ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "defs.h" -#include "inferior.h" -#include "symtab.h" -#include "value.h" -#include "language.h" -#include "target.h" -#include "wait.h" -#include "gdbcmd.h" -#include "gdbcore.h" - -#if 0 -#include -#else -#define MACH_TYPE_TASK 1 -#define MACH_TYPE_THREAD 2 -#endif - -/* Included only for signal names and NSIG - * - * note: There are many problems in signal handling with - * gdb in Mach 3.0 in general. - */ -#include -#define SIG_UNKNOWN 0 /* Exception that has no matching unix signal */ - -#include - -/* This is what a cproc looks like. This is here partly because - cthread_internals.h is not a header we can just #include, partly with - an eye towards perhaps getting this to work with cross-debugging - someday. Best solution is if CMU publishes a real interface to this - stuff. */ -#define CPROC_NEXT_OFFSET 0 -#define CPROC_NEXT_SIZE (TARGET_PTR_BIT / HOST_CHAR_BIT) -#define CPROC_INCARNATION_OFFSET (CPROC_NEXT_OFFSET + CPROC_NEXT_SIZE) -#define CPROC_INCARNATION_SIZE (sizeof (cthread_t)) -#define CPROC_LIST_OFFSET (CPROC_INCARNATION_OFFSET + CPROC_INCARNATION_SIZE) -#define CPROC_LIST_SIZE (TARGET_PTR_BIT / HOST_CHAR_BIT) -#define CPROC_WAIT_OFFSET (CPROC_LIST_OFFSET + CPROC_LIST_SIZE) -#define CPROC_WAIT_SIZE (TARGET_PTR_BIT / HOST_CHAR_BIT) -#define CPROC_REPLY_OFFSET (CPROC_WAIT_OFFSET + CPROC_WAIT_SIZE) -#define CPROC_REPLY_SIZE (sizeof (mach_port_t)) -#define CPROC_CONTEXT_OFFSET (CPROC_REPLY_OFFSET + CPROC_REPLY_SIZE) -#define CPROC_CONTEXT_SIZE (TARGET_INT_BIT / HOST_CHAR_BIT) -#define CPROC_LOCK_OFFSET (CPROC_CONTEXT_OFFSET + CPROC_CONTEXT_SIZE) -#define CPROC_LOCK_SIZE (sizeof (spin_lock_t)) -#define CPROC_STATE_OFFSET (CPROC_LOCK_OFFSET + CPROC_LOCK_SIZE) -#define CPROC_STATE_SIZE (TARGET_INT_BIT / HOST_CHAR_BIT) -#define CPROC_WIRED_OFFSET (CPROC_STATE_OFFSET + CPROC_STATE_SIZE) -#define CPROC_WIRED_SIZE (sizeof (mach_port_t)) -#define CPROC_BUSY_OFFSET (CPROC_WIRED_OFFSET + CPROC_WIRED_SIZE) -#define CPROC_BUSY_SIZE (TARGET_INT_BIT / HOST_CHAR_BIT) -#define CPROC_MSG_OFFSET (CPROC_BUSY_OFFSET + CPROC_BUSY_SIZE) -#define CPROC_MSG_SIZE (sizeof (mach_msg_header_t)) -#define CPROC_BASE_OFFSET (CPROC_MSG_OFFSET + CPROC_MSG_SIZE) -#define CPROC_BASE_SIZE (TARGET_INT_BIT / HOST_CHAR_BIT) -#define CPROC_SIZE_OFFSET (CPROC_BASE_OFFSET + CPROC_BASE_SIZE) -#define CPROC_SIZE_SIZE (TARGET_INT_BIT / HOST_CHAR_BIT) -#define CPROC_SIZE (CPROC_SIZE_OFFSET + CPROC_SIZE_SIZE) - -/* Values for the state field in the cproc. */ -#define CPROC_RUNNING 0 -#define CPROC_SWITCHING 1 -#define CPROC_BLOCKED 2 -#define CPROC_CONDWAIT 4 - -/* For cproc and kernel thread mapping */ -typedef struct gdb_thread { - mach_port_t name; - CORE_ADDR sp; - CORE_ADDR pc; - CORE_ADDR fp; - boolean_t in_emulator; - int slotid; - - /* This is for the mthreads list. It points to the cproc list. - Perhaps the two lists should be merged (or perhaps it was a mistake - to make them both use a struct gdb_thread). */ - struct gdb_thread *cproc; - - /* These are for the cproc list, which is linked through the next field - of the struct gdb_thread. */ - char raw_cproc[CPROC_SIZE]; - /* The cthread which is pointed to by the incarnation field from the - cproc. This points to the copy we've read into GDB. */ - cthread_t cthread; - /* Point back to the mthreads list. */ - int reverse_map; - struct gdb_thread *next; -} *gdb_thread_t; - -/* - * Actions for Mach exceptions. - * - * sigmap field maps the exception to corresponding Unix signal. - * - * I do not know how to map the exception to unix signal - * if SIG_UNKNOWN is specified. - */ - -struct exception_list { - char *name; - boolean_t forward; - boolean_t print; - int sigmap; -} exception_map[] = { - {"not_mach3_exception", FALSE, TRUE, SIG_UNKNOWN}, - {"EXC_BAD_ACCESS", FALSE, TRUE, SIGSEGV}, - {"EXC_BAD_INSTRUCTION", FALSE, TRUE, SIGILL}, - {"EXC_ARITHMETIC", FALSE, TRUE, SIGFPE}, - {"EXC_EMULATION", FALSE, TRUE, SIGEMT}, /* ??? */ - {"EXC_SOFTWARE", FALSE, TRUE, SIG_UNKNOWN}, - {"EXC_BREAKPOINT", FALSE, FALSE, SIGTRAP} -}; - -/* Mach exception table size */ -int max_exception = sizeof(exception_map)/sizeof(struct exception_list) - 1; - -#define MAX_EXCEPTION max_exception - -WAITTYPE wait_status; - -/* If you define this, intercepted bsd server calls will be - * dumped while waiting the inferior to EXEC the correct - * program - */ -/* #define DUMP_SYSCALL /* debugging interceptor */ - -/* xx_debug() outputs messages if this is nonzero. - * If > 1, DUMP_SYSCALL will dump message contents. - */ -int debug_level = 0; - -/* "Temporary" debug stuff */ -void -xx_debug (fmt, a,b,c) -char *fmt; -int a,b,c; -{ - if (debug_level) - warning (fmt, a, b, c); -} - -/* This is in libmach.a */ -extern mach_port_t name_server_port; - -/* Set in catch_exception_raise */ -int stop_exception, stop_code, stop_subcode; -int stopped_in_exception; - -/* Thread that was the active thread when we stopped */ -thread_t stop_thread = MACH_PORT_NULL; - -char *hostname = ""; - -/* Set when task is attached or created */ -boolean_t emulator_present = FALSE; - -task_t inferior_task; -thread_t current_thread; - -/* Exception ports for inferior task */ -mach_port_t inferior_exception_port = MACH_PORT_NULL; -mach_port_t inferior_old_exception_port = MACH_PORT_NULL; - -/* task exceptions and notifications */ -mach_port_t inferior_wait_port_set = MACH_PORT_NULL; -mach_port_t our_notify_port = MACH_PORT_NULL; - -/* This is "inferior_wait_port_set" when not single stepping, and - * "singlestepped_thread_port" when we are single stepping. - * - * This is protected by a cleanup function: discard_single_step() - */ -mach_port_t currently_waiting_for = MACH_PORT_NULL; - -/* A port for external messages to gdb. - * External in the meaning that they do not come - * from the inferior_task, but rather from external - * tasks. - * - * As a debugging feature: - * A debugger debugging another debugger can stop the - * inferior debugger by the following command sequence - * (without running external programs) - * - * (top-gdb) set stop_inferior_gdb () - * (top-gdb) continue - */ -mach_port_t our_message_port = MACH_PORT_NULL; - -/* For single stepping */ -mach_port_t thread_exception_port = MACH_PORT_NULL; -mach_port_t thread_saved_exception_port = MACH_PORT_NULL; -mach_port_t singlestepped_thread_port = MACH_PORT_NULL; - -/* For machid calls */ -mach_port_t mid_server = MACH_PORT_NULL; -mach_port_t mid_auth = MACH_PORT_NULL; - -/* If gdb thinks the inferior task is not suspended, it - * must take suspend/abort the threads when it reads the state. - */ -int must_suspend_thread = 0; - -/* When single stepping, we switch the port that mach_really_wait() listens to. - * This cleanup is a guard to prevent the port set from being left to - * the singlestepped_thread_port when error() is called. - * This is nonzero only when we are single stepping. - */ -#define NULL_CLEANUP (struct cleanup *)0 -struct cleanup *cleanup_step = NULL_CLEANUP; - - -extern struct target_ops m3_ops; -static void m3_kill_inferior (); - -#if 0 -#define MACH_TYPE_EXCEPTION_PORT -1 -#endif - -/* Chain of ports to remember requested notifications. */ - -struct port_chain { - struct port_chain *next; - mach_port_t port; - int type; - int mid; /* Now only valid with MACH_TYPE_THREAD and */ - /* MACH_TYPE_THREAD */ -}; -typedef struct port_chain *port_chain_t; - -/* Room for chain nodes comes from pchain_obstack */ -struct obstack pchain_obstack; -struct obstack *port_chain_obstack = &pchain_obstack; - -/* For thread handling */ -struct obstack Cproc_obstack; -struct obstack *cproc_obstack = &Cproc_obstack; - -/* the list of notified ports */ -port_chain_t notify_chain = (port_chain_t) NULL; - -port_chain_t -port_chain_insert (list, name, type) - port_chain_t list; - mach_port_t name; - int type; -{ - kern_return_t ret; - port_chain_t new; - int mid; - - if (! MACH_PORT_VALID (name)) - return list; - - if (type == MACH_TYPE_TASK || type == MACH_TYPE_THREAD) - { - if (! MACH_PORT_VALID (mid_server)) - { - warning ("Machid server port invalid, can not map port 0x%x to MID", - name); - mid = name; - } - else - { - ret = machid_mach_register (mid_server, mid_auth, name, type, &mid); - - if (ret != KERN_SUCCESS) - { - warning ("Can not map name (0x%x) to MID with machid", name); - mid = name; - } - } - } - else - abort (); - - new = (port_chain_t) obstack_alloc (port_chain_obstack, - sizeof (struct port_chain)); - new->next = list; - new->port = name; - new->type = type; - new->mid = mid; - - return new; -} - -port_chain_t -port_chain_delete (list, elem) - port_chain_t list; - mach_port_t elem; -{ - if (list) - if (list->port == elem) - list = list->next; - else - while (list->next) - { - if (list->next->port == elem) - list->next = list->next->next; /* GCd with obstack_free() */ - else - list = list->next; - } - return list; -} - -void -port_chain_destroy (ostack) - struct obstack *ostack; -{ - obstack_free (ostack, 0); - obstack_init (ostack); -} - -port_chain_t -port_chain_member (list, elem) - port_chain_t list; - mach_port_t elem; -{ - while (list) - { - if (list->port == elem) - return list; - list = list->next; - } - return (port_chain_t) NULL; -} - -int -map_port_name_to_mid (name, type) -mach_port_t name; -int type; -{ - port_chain_t elem; - - if (!MACH_PORT_VALID (name)) - return -1; - - elem = port_chain_member (notify_chain, name); - - if (elem && (elem->type == type)) - return elem->mid; - - if (elem) - return -1; - - if (! MACH_PORT_VALID (mid_server)) - { - warning ("Machid server port invalid, can not map port 0x%x to mid", - name); - return -1; - } - else - { - int mid; - kern_return_t ret; - - ret = machid_mach_register (mid_server, mid_auth, name, type, &mid); - - if (ret != KERN_SUCCESS) - { - warning ("Can not map name (0x%x) to mid with machid", name); - return -1; - } - return mid; - } -} - -/* Guard for currently_waiting_for and singlestepped_thread_port */ -static void -discard_single_step (thread) - thread_t thread; -{ - currently_waiting_for = inferior_wait_port_set; - - cleanup_step = NULL_CLEANUP; - if (MACH_PORT_VALID (thread) && MACH_PORT_VALID (singlestepped_thread_port)) - setup_single_step (thread, FALSE); -} - -setup_single_step (thread, start_step) - thread_t thread; - boolean_t start_step; -{ - kern_return_t ret; - - if (! MACH_PORT_VALID (thread)) - error ("Invalid thread supplied to setup_single_step"); - else - { - mach_port_t teport; - - /* Get the current thread exception port */ - ret = thread_get_exception_port (thread, &teport); - CHK ("Getting thread's exception port", ret); - - if (start_step) - { - if (MACH_PORT_VALID (singlestepped_thread_port)) - { - warning ("Singlestepped_thread_port (0x%x) is still valid?", - singlestepped_thread_port); - singlestepped_thread_port = MACH_PORT_NULL; - } - - /* If we are already stepping this thread */ - if (MACH_PORT_VALID (teport) && teport == thread_exception_port) - { - ret = mach_port_deallocate (mach_task_self (), teport); - CHK ("Could not deallocate thread exception port", ret); - } - else - { - ret = thread_set_exception_port (thread, thread_exception_port); - CHK ("Setting exception port for thread", ret); -#if 0 - /* Insert thread exception port to wait port set */ - ret = mach_port_move_member (mach_task_self(), - thread_exception_port, - inferior_wait_port_set); - CHK ("Moving thread exception port to inferior_wait_port_set", - ret); -#endif - thread_saved_exception_port = teport; - } - - thread_trace (thread, TRUE); - - singlestepped_thread_port = thread_exception_port; - currently_waiting_for = singlestepped_thread_port; - cleanup_step = make_cleanup (discard_single_step, thread); - } - else - { - if (! MACH_PORT_VALID (teport)) - error ("Single stepped thread had an invalid exception port?"); - - if (teport != thread_exception_port) - error ("Single stepped thread had an unknown exception port?"); - - ret = mach_port_deallocate (mach_task_self (), teport); - CHK ("Couldn't deallocate thread exception port", ret); -#if 0 - /* Remove thread exception port from wait port set */ - ret = mach_port_move_member (mach_task_self(), - thread_exception_port, - MACH_PORT_NULL); - CHK ("Removing thread exception port from inferior_wait_port_set", - ret); -#endif - /* Restore thread's old exception port */ - ret = thread_set_exception_port (thread, - thread_saved_exception_port); - CHK ("Restoring stepped thread's exception port", ret); - - if (MACH_PORT_VALID (thread_saved_exception_port)) - (void) mach_port_deallocate (mach_task_self (), - thread_saved_exception_port); - - thread_trace (thread, FALSE); - - singlestepped_thread_port = MACH_PORT_NULL; - currently_waiting_for = inferior_wait_port_set; - if (cleanup_step) - discard_cleanups (cleanup_step); - } - } -} - -static -request_notify (name, variant, type) - mach_port_t name; - mach_msg_id_t variant; - int type; -{ - kern_return_t ret; - mach_port_t previous_port_dummy = MACH_PORT_NULL; - - if (! MACH_PORT_VALID (name)) - return; - - if (port_chain_member (notify_chain, name)) - return; - - ret = mach_port_request_notification (mach_task_self(), - name, - variant, - 1, - our_notify_port, - MACH_MSG_TYPE_MAKE_SEND_ONCE, - &previous_port_dummy); - CHK ("Serious: request_notify failed", ret); - - (void) mach_port_deallocate (mach_task_self (), - previous_port_dummy); - - notify_chain = port_chain_insert (notify_chain, name, type); -} - -reverse_msg_bits(msgp, type) - mach_msg_header_t *msgp; - int type; -{ - int rbits,lbits; - rbits = MACH_MSGH_BITS_REMOTE(msgp->msgh_bits); - lbits = type; - msgp->msgh_bits = - (msgp->msgh_bits & ~MACH_MSGH_BITS_PORTS_MASK) | - MACH_MSGH_BITS(lbits,rbits); -} - -/* On the third day He said: - - Let this be global - and then it was global. - - When creating the inferior fork, the - child code in inflow.c sets the name of the - bootstrap_port in its address space to this - variable. - - The name is transferred to our address space - with mach3_read_inferior(). - - Thou shalt not do this with - task_get_bootstrap_port() in this task, since - the name in the inferior task is different than - the one we get. - - For blessed are the meek, as they shall inherit - the address space. - */ -mach_port_t original_server_port_name = MACH_PORT_NULL; - - -/* Called from inferior after FORK but before EXEC */ -static void -m3_trace_me () -{ - kern_return_t ret; - - /* Get the NAME of the bootstrap port in this task - so that GDB can read it */ - ret = task_get_bootstrap_port (mach_task_self (), - &original_server_port_name); - if (ret != KERN_SUCCESS) - abort (); - ret = mach_port_deallocate (mach_task_self (), - original_server_port_name); - if (ret != KERN_SUCCESS) - abort (); - - /* Suspend this task to let the parent change my ports. - Resumed by the debugger */ - ret = task_suspend (mach_task_self ()); - if (ret != KERN_SUCCESS) - abort (); -} - -/* - * Intercept system calls to Unix server. - * After EXEC_COUNTER calls to exec(), return. - * - * Pre-assertion: Child is suspended. (Not verified) - * Post-condition: Child is suspended after EXEC_COUNTER exec() calls. - */ - -void -intercept_exec_calls (exec_counter) - int exec_counter; -{ - int terminal_initted = 0; - - struct syscall_msg_t { - mach_msg_header_t header; - mach_msg_type_t type; - char room[ 2000 ]; /* Enuff space */ - }; - - struct syscall_msg_t syscall_in, syscall_out; - - mach_port_t fake_server; - mach_port_t original_server_send; - mach_port_t original_exec_reply; - mach_port_t exec_reply; - mach_port_t exec_reply_send; - mach_msg_type_name_t acquired; - mach_port_t emulator_server_port_name; - struct task_basic_info info; - mach_msg_type_number_t info_count; - - kern_return_t ret; - - if (exec_counter <= 0) - return; /* We are already set up in the correct program */ - - ret = mach_port_allocate(mach_task_self(), - MACH_PORT_RIGHT_RECEIVE, - &fake_server); - CHK("create inferior_fake_server port failed", ret); - - /* Wait for inferior_task to suspend itself */ - while(1) - { - info_count = sizeof (info); - ret = task_info (inferior_task, - TASK_BASIC_INFO, - (task_info_t)&info, - &info_count); - CHK ("Task info", ret); - - if (info.suspend_count) - break; - - /* Note that the definition of the parameter was undefined - * at the time of this writing, so I just use an `ad hoc' value. - */ - (void) swtch_pri (42); /* Universal Priority Value */ - } - - /* Read the inferior's bootstrap port name */ - if (!mach3_read_inferior (&original_server_port_name, - &original_server_port_name, - sizeof (original_server_port_name))) - error ("Can't read inferior task bootstrap port name"); - - /* @@ BUG: If more than 1 send right GDB will FAIL!!! */ - /* Should get refs, and set them back when restoring */ - /* Steal the original bsd server send right from inferior */ - ret = mach_port_extract_right (inferior_task, - original_server_port_name, - MACH_MSG_TYPE_MOVE_SEND, - &original_server_send, - &acquired); - CHK("mach_port_extract_right (bsd server send)",ret); - - if (acquired != MACH_MSG_TYPE_PORT_SEND) - error("Incorrect right extracted, send right to bsd server excpected"); - - ret = mach_port_insert_right (inferior_task, - original_server_port_name, - fake_server, - MACH_MSG_TYPE_MAKE_SEND); - CHK("mach_port_insert_right (fake server send)",ret); - - xx_debug ("inferior task bsd server ports set up \nfs %x, ospn %x, oss %x\n", - fake_server, - original_server_port_name, original_server_send); - - /* A receive right to the reply generated by unix server exec() request */ - ret = mach_port_allocate(mach_task_self(), - MACH_PORT_RIGHT_RECEIVE, - &exec_reply); - CHK("create intercepted_reply_port port failed", ret); - - /* Pass this send right to Unix server so it replies to us after exec() */ - ret = mach_port_extract_right (mach_task_self (), - exec_reply, - MACH_MSG_TYPE_MAKE_SEND_ONCE, - &exec_reply_send, - &acquired); - CHK("mach_port_extract_right (exec_reply)",ret); - - if (acquired != MACH_MSG_TYPE_PORT_SEND_ONCE) - error("Incorrect right extracted, send once excpected for exec reply"); - - ret = mach_port_move_member(mach_task_self(), - fake_server, - inferior_wait_port_set); - CHK ("Moving fake syscall port to inferior_wait_port_set", ret); - - xx_debug ("syscall fake server set up, resuming inferior\n"); - - ret = task_resume (inferior_task); - CHK("task_resume (startup)", ret); - - /* Read requests from the inferior. - Pass directly through everything else except exec() calls. - */ - while(exec_counter > 0) - { - ret = mach_msg (&syscall_in.header, /* header */ - MACH_RCV_MSG, /* options */ - 0, /* send size */ - sizeof (struct syscall_msg_t), /* receive size */ - inferior_wait_port_set, /* receive_name */ - MACH_MSG_TIMEOUT_NONE, - MACH_PORT_NULL); - CHK("mach_msg (intercepted sycall)", ret); - -#ifdef DUMP_SYSCALL - print_msg (&syscall_in.header); -#endif - - /* ASSERT : msgh_local_port == fake_server */ - - if (notify_server (&syscall_in.header, &syscall_out.header)) - error ("received a notify while intercepting syscalls"); - - if (syscall_in.header.msgh_id == MIG_EXEC_SYSCALL_ID) - { - xx_debug ("Received EXEC SYSCALL, counter = %d\n", exec_counter); - if (exec_counter == 1) - { - original_exec_reply = syscall_in.header.msgh_remote_port; - syscall_in.header.msgh_remote_port = exec_reply_send; - } - - 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. */ - - /* Set up the "saved terminal modes" of the inferior - based on what modes we are starting it with. */ - target_terminal_init (); - - /* Install inferior's terminal modes. */ - target_terminal_inferior (); - - terminal_initted = 1; - } - - exec_counter--; - } - - syscall_in.header.msgh_local_port = syscall_in.header.msgh_remote_port; - syscall_in.header.msgh_remote_port = original_server_send; - - reverse_msg_bits(&syscall_in.header, MACH_MSG_TYPE_COPY_SEND); - - ret = mach_msg_send (&syscall_in.header); - CHK ("Forwarded syscall", ret); - } - - ret = mach_port_move_member(mach_task_self(), - fake_server, - MACH_PORT_NULL); - CHK ("Moving fake syscall out of inferior_wait_port_set", ret); - - ret = mach_port_move_member(mach_task_self(), - exec_reply, - inferior_wait_port_set); - CHK ("Moving exec_reply to inferior_wait_port_set", ret); - - ret = mach_msg (&syscall_in.header, /* header */ - MACH_RCV_MSG, /* options */ - 0, /* send size */ - sizeof (struct syscall_msg_t), /* receive size */ - inferior_wait_port_set, /* receive_name */ - MACH_MSG_TIMEOUT_NONE, - MACH_PORT_NULL); - CHK("mach_msg (exec reply)", ret); - - ret = task_suspend (inferior_task); - CHK ("Suspending inferior after last exec", ret); - - must_suspend_thread = 0; - - xx_debug ("Received exec reply from bsd server, suspended inferior task\n"); - -#ifdef DUMP_SYSCALL - print_msg (&syscall_in.header); -#endif - - /* Message should appear as if it came from the unix server */ - syscall_in.header.msgh_local_port = MACH_PORT_NULL; - - /* and go to the inferior task original reply port */ - syscall_in.header.msgh_remote_port = original_exec_reply; - - reverse_msg_bits(&syscall_in.header, MACH_MSG_TYPE_MOVE_SEND_ONCE); - - ret = mach_msg_send (&syscall_in.header); - CHK ("Forwarding exec reply to inferior", ret); - - /* Garbage collect */ - ret = mach_port_deallocate (inferior_task, - original_server_port_name); - CHK ("deallocating fake server send right", ret); - - ret = mach_port_insert_right (inferior_task, - original_server_port_name, - original_server_send, - MACH_MSG_TYPE_MOVE_SEND); - CHK ("Restoring the original bsd server send right", ret); - - ret = mach_port_destroy (mach_task_self (), - fake_server); - fake_server = MACH_PORT_DEAD; - CHK("mach_port_destroy (fake_server)", ret); - - ret = mach_port_destroy (mach_task_self (), - exec_reply); - exec_reply = MACH_PORT_DEAD; - CHK("mach_port_destroy (exec_reply)", ret); - - xx_debug ("Done with exec call interception\n"); -} - -void -consume_send_rights (thread_list, thread_count) - thread_array_t thread_list; - int thread_count; -{ - int index; - - if (!thread_count) - return; - - for (index = 0; index < thread_count; index++) - { - /* Since thread kill command kills threads, don't check ret */ - (void) mach_port_deallocate (mach_task_self (), - thread_list [ index ]); - } -} - -/* suspend/abort/resume a thread. */ -setup_thread (thread, what) - mach_port_t thread; - int what; -{ - kern_return_t ret; - - if (what) - { - ret = thread_suspend (thread); - CHK ("setup_thread thread_suspend", ret); - - ret = thread_abort (thread); - CHK ("setup_thread thread_abort", ret); - } - else - { - ret = thread_resume (thread); - CHK ("setup_thread thread_resume", ret); - } -} - -int -map_slot_to_mid (slot, threads, thread_count) - int slot; - thread_array_t threads; - int thread_count; -{ - kern_return_t ret; - int deallocate = 0; - int index; - int mid; - - if (! threads) - { - deallocate++; - ret = task_threads (inferior_task, &threads, &thread_count); - CHK ("Can not select a thread from a dead task", ret); - } - - if (slot < 0 || slot >= thread_count) - { - if (deallocate) - { - consume_send_rights (threads, thread_count); - (void) vm_deallocate (mach_task_self(), (vm_address_t)threads, - (thread_count * sizeof(mach_port_t))); - } - if (slot < 0) - error ("invalid slot number"); - else - return -(slot+1); - } - - mid = map_port_name_to_mid (threads [slot], MACH_TYPE_THREAD); - - if (deallocate) - { - consume_send_rights (threads, thread_count); - (void) vm_deallocate (mach_task_self(), (vm_address_t)threads, - (thread_count * sizeof(mach_port_t))); - } - - return mid; -} - -static int -parse_thread_id (arg, thread_count, slots) - char *arg; - int thread_count; - int slots; -{ - kern_return_t ret; - int mid; - int slot; - int index; - - if (arg == 0) - return 0; - - while (*arg && (*arg == ' ' || *arg == '\t')) - arg++; - - if (! *arg) - return 0; - - /* Currently parse MID and @SLOTNUMBER */ - if (*arg != '@') - { - mid = atoi (arg); - if (mid <= 0) - error ("valid thread mid expected"); - return mid; - } - - arg++; - slot = atoi (arg); - - if (slot < 0) - error ("invalid slot number"); - - /* If you want slot numbers to remain slot numbers, set slots. - * - * Well, since 0 is reserved, return the ordinal number - * of the thread rather than the slot number. Awk, this - * counts as a kludge. - */ - if (slots) - return -(slot+1); - - if (thread_count && slot >= thread_count) - return -(slot+1); - - mid = map_slot_to_mid (slot); - - return mid; -} - -/* THREAD_ID 0 is special; it selects the first kernel - * thread from the list (i.e. SLOTNUMBER 0) - * This is used when starting the program with 'run' or when attaching. - * - * If FLAG is 0 the context is not changed, and the registers, frame, etc - * will continue to describe the old thread. - * - * If FLAG is nonzero, really select the thread. - * If FLAG is 2, the THREAD_ID is a slotnumber instead of a mid. - * - */ -kern_return_t -select_thread (task, thread_id, flag) - mach_port_t task; - int thread_id; - int flag; -{ - thread_array_t thread_list; - int thread_count; - kern_return_t ret; - int index; - thread_t new_thread = MACH_PORT_NULL; - - if (thread_id < 0) - error ("Can't select cprocs without kernel thread"); - - ret = task_threads (task, &thread_list, &thread_count); - if (ret != KERN_SUCCESS) - { - warning ("Can not select a thread from a dead task"); - m3_kill_inferior (); - return KERN_FAILURE; - } - - if (thread_count == 0) - { - /* The task can not do anything anymore, but it still - * exists as a container for memory and ports. - */ - registers_changed (); - warning ("Task %d has no threads", - map_port_name_to_mid (task, MACH_TYPE_TASK)); - current_thread = MACH_PORT_NULL; - (void) vm_deallocate(mach_task_self(), - (vm_address_t) thread_list, - (thread_count * sizeof(mach_port_t))); - return KERN_FAILURE; - } - - if (! thread_id || flag == 2) - { - /* First thread or a slotnumber */ - if (! thread_id) - new_thread = thread_list[0]; - else - { - if (thread_id < thread_count) - new_thread = thread_list[ thread_id ]; - else - { - (void) vm_deallocate(mach_task_self(), - (vm_address_t) thread_list, - (thread_count * sizeof(mach_port_t))); - error ("No such thread slot number : %d", thread_id); - } - } - } - else - { - for (index = 0; index < thread_count; index++) - if (thread_id == map_port_name_to_mid (thread_list [index], - MACH_TYPE_THREAD)) - { - new_thread = thread_list [index]; - index = -1; - break; - } - - if (index != -1) - error ("No thread with mid %d", thread_id); - } - - /* Notify when the selected thread dies */ - request_notify (new_thread, MACH_NOTIFY_DEAD_NAME, MACH_TYPE_THREAD); - - ret = vm_deallocate(mach_task_self(), - (vm_address_t) thread_list, - (thread_count * sizeof(mach_port_t))); - CHK ("vm_deallocate", ret); - - if (! flag) - current_thread = new_thread; - else - { -#if 0 - if (MACH_PORT_VALID (current_thread)) - { - /* Store the gdb's view of the thread we are deselecting - * - * @@ I think gdb updates registers immediately when they are - * changed, so don't do this. - */ - ret = thread_abort (current_thread); - CHK ("Could not abort system calls when saving state of old thread", - ret); - target_prepare_to_store (); - target_store_registers (-1); - } -#endif - - registers_changed (); - - current_thread = new_thread; - - ret = thread_abort (current_thread); - CHK ("Could not abort system calls when selecting a thread", ret); - - stop_pc = read_pc(); - flush_cached_frames (); - - select_frame (get_current_frame (), 0); - } - - return KERN_SUCCESS; -} - -/* - * Switch to use thread named NEW_THREAD. - * Return it's MID - */ -int -switch_to_thread (new_thread) - thread_t new_thread; -{ - thread_t saved_thread = current_thread; - int mid; - - mid = map_port_name_to_mid (new_thread, - MACH_TYPE_THREAD); - if (mid == -1) - warning ("Can't map thread name 0x%x to mid", new_thread); - else if (select_thread (inferior_task, mid, 1) != KERN_SUCCESS) - { - if (current_thread) - current_thread = saved_thread; - error ("Could not select thread %d", mid); - } - - return mid; -} - -/* Do this in gdb after doing FORK but before STARTUP_INFERIOR. - * Note that the registers are not yet valid in the inferior task. - */ -static void -m3_trace_him (pid) - int pid; -{ - kern_return_t ret; - - push_target (&m3_ops); - - inferior_task = task_by_pid (pid); - - if (! MACH_PORT_VALID (inferior_task)) - error ("Can not map Unix pid %d to Mach task", pid); - - /* Clean up previous notifications and create new ones */ - setup_notify_port (1); - - /* When notification appears, the inferior task has died */ - request_notify (inferior_task, MACH_NOTIFY_DEAD_NAME, MACH_TYPE_TASK); - - emulator_present = have_emulator_p (inferior_task); - - /* By default, select the first thread, - * If task has no threads, gives a warning - * Does not fetch registers, since they are not yet valid. - */ - select_thread (inferior_task, 0, 0); - - inferior_exception_port = MACH_PORT_NULL; - - setup_exception_port (); - - xx_debug ("Now the debugged task is created\n"); - - /* One trap to exec the shell, one to exec the program being debugged. */ - intercept_exec_calls (2); -} - -setup_exception_port () -{ - kern_return_t ret; - - ret = mach_port_allocate (mach_task_self(), - MACH_PORT_RIGHT_RECEIVE, - &inferior_exception_port); - CHK("mach_port_allocate",ret); - - /* add send right */ - ret = mach_port_insert_right (mach_task_self (), - inferior_exception_port, - inferior_exception_port, - MACH_MSG_TYPE_MAKE_SEND); - CHK("mach_port_insert_right",ret); - - ret = mach_port_move_member (mach_task_self(), - inferior_exception_port, - inferior_wait_port_set); - CHK("mach_port_move_member",ret); - - ret = task_get_special_port (inferior_task, - TASK_EXCEPTION_PORT, - &inferior_old_exception_port); - CHK ("task_get_special_port(old exc)",ret); - - ret = task_set_special_port (inferior_task, - TASK_EXCEPTION_PORT, - inferior_exception_port); - CHK("task_set_special_port",ret); - - ret = mach_port_deallocate (mach_task_self (), - inferior_exception_port); - CHK("mack_port_deallocate",ret); - -#if 0 - /* When notify appears, the inferior_task's exception - * port has been destroyed. - * - * Not used, since the dead_name_notification already - * appears when task dies. - * - */ - request_notify (inferior_exception_port, - MACH_NOTIFY_NO_SENDERS, - MACH_TYPE_EXCEPTION_PORT); -#endif -} - -/* Nonzero if gdb is waiting for a message */ -int mach_really_waiting; - -/* Wait for the inferior to stop for some reason. - - Loop on notifications until inferior_task dies. - - Loop on exceptions until stopped_in_exception comes true. - (e.g. we receive a single step trace trap) - - a message arrives to gdb's message port - - There is no other way to exit this loop. - - Returns the inferior_pid for rest of gdb. - Side effects: Set *OURSTATUS. */ -int -mach_really_wait (pid, ourstatus) - int pid; - struct target_waitstatus *ourstatus; -{ - kern_return_t ret; - int w; - - struct msg { - mach_msg_header_t header; - mach_msg_type_t foo; - int data[8000]; - } in_msg, out_msg; - - /* Either notify (death), exception or message can stop the inferior */ - stopped_in_exception = FALSE; - - while (1) - { - QUIT; - - stop_exception = stop_code = stop_subcode = -1; - stop_thread = MACH_PORT_NULL; - - mach_really_waiting = 1; - ret = mach_msg (&in_msg.header, /* header */ - MACH_RCV_MSG, /* options */ - 0, /* send size */ - sizeof (struct msg), /* receive size */ - currently_waiting_for, /* receive name */ - MACH_MSG_TIMEOUT_NONE, - MACH_PORT_NULL); - mach_really_waiting = 0; - CHK("mach_msg (receive)", ret); - - /* Check if we received a notify of the childs' death */ - if (notify_server (&in_msg.header, &out_msg.header)) - { - /* If inferior_task is null then the inferior has - gone away and we want to return to command level. - Otherwise it was just an informative message and we - need to look to see if there are any more. */ - if (inferior_task != MACH_PORT_NULL) - continue; - else - { - /* Collect Unix exit status for gdb */ - - wait3(&w, WNOHANG, 0); - - /* This mess is here to check that the rest of - * gdb knows that the inferior died. It also - * tries to hack around the fact that Mach 3.0 (mk69) - * unix server (ux28) does not always know what - * has happened to it's children when mach-magic - * is applied on them. - */ - if ((!WIFEXITED(w) && WIFSTOPPED(w)) || - (WIFEXITED(w) && WEXITSTATUS(w) > 0377)) - { - WSETEXIT(w, 0); - warning ("Using exit value 0 for terminated task"); - } - else if (!WIFEXITED(w)) - { - int sig = WTERMSIG(w); - - /* Signals cause problems. Warn the user. */ - if (sig != SIGKILL) /* Bad luck if garbage matches this */ - warning ("The terminating signal stuff may be nonsense"); - else if (sig > NSIG) - { - WSETEXIT(w, 0); - warning ("Using exit value 0 for terminated task"); - } - } - store_waitstatus (ourstatus, w); - return inferior_pid; - } - } - - /* Hmm. Check for exception, as it was not a notification. - exc_server() does an upcall to catch_exception_raise() - if this rpc is an exception. Further actions are decided - there. - */ - if (! exc_server (&in_msg.header, &out_msg.header)) - { - - /* Not an exception, check for message. - * - * Messages don't come from the inferior, or if they - * do they better be asynchronous or it will hang. - */ - if (gdb_message_server (&in_msg.header)) - continue; - - error ("Unrecognized message received in mach_really_wait"); - } - - /* Send the reply of the exception rpc to the suspended task */ - ret = mach_msg_send (&out_msg.header); - CHK ("mach_msg_send (exc reply)", ret); - - if (stopped_in_exception) - { - /* Get unix state. May be changed in mach3_exception_actions() */ - wait3(&w, WNOHANG, 0); - - mach3_exception_actions (&w, FALSE, "Task"); - - store_waitstatus (ourstatus, w); - return inferior_pid; - } - } -} - -/* Called by macro DO_QUIT() in utils.c(quit). - * This is called just before calling error() to return to command level - */ -void -mach3_quit () -{ - int mid; - kern_return_t ret; - - if (mach_really_waiting) - { - ret = task_suspend (inferior_task); - - if (ret != KERN_SUCCESS) - { - warning ("Could not suspend task for interrupt: %s", - mach_error_string (ret)); - mach_really_waiting = 0; - return; - } - } - - must_suspend_thread = 0; - mach_really_waiting = 0; - - mid = map_port_name_to_mid (current_thread, MACH_TYPE_THREAD); - if (mid == -1) - { - warning ("Selecting first existing kernel thread"); - mid = 0; - } - - current_thread = MACH_PORT_NULL; /* Force setup */ - select_thread (inferior_task, mid, 1); - - return; -} - -#if 0 -/* bogus bogus bogus. It is NOT OK to quit out of target_wait. */ - -/* If ^C is typed when we are waiting for a message - * and your Unix server is able to notice that we - * should quit now. - * - * Called by REQUEST_QUIT() from utils.c(request_quit) - */ -void -mach3_request_quit () -{ - if (mach_really_waiting) - immediate_quit = 1; -} -#endif - -/* - * Gdb message server. - * Currently implemented is the STOP message, that causes - * gdb to return to the command level like ^C had been typed from terminal. - */ -int -gdb_message_server (InP) - mach_msg_header_t *InP; -{ - kern_return_t ret; - int mid; - - if (InP->msgh_local_port == our_message_port) - { - /* A message coming to our_message_port. Check validity */ - switch (InP->msgh_id) { - - case GDB_MESSAGE_ID_STOP: - ret = task_suspend (inferior_task); - if (ret != KERN_SUCCESS) - warning ("Could not suspend task for stop message: %s", - mach_error_string (ret)); - - /* QUIT in mach_really_wait() loop. */ - request_quit (0); - break; - - default: - warning ("Invalid message id %d received, ignored.", - InP->msgh_id); - break; - } - - return 1; - } - - /* Message not handled by this server */ - return 0; -} - -/* NOTE: This is not an RPC call. It is a simpleroutine. - * - * This is not called from this gdb code. - * - * It may be called by another debugger to cause this - * debugger to enter command level: - * - * (gdb) set stop_inferior_gdb () - * (gdb) continue - * - * External program "stop-gdb" implements this also. - */ -void -stop_inferior_gdb () -{ - kern_return_t ret; - - /* Code generated by mig, with minor cleanups :-) - * - * simpleroutine stop_inferior_gdb (our_message_port : mach_port_t); - */ - - typedef struct { - mach_msg_header_t Head; - } Request; - - Request Mess; - - register Request *InP = &Mess; - - InP->Head.msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_COPY_SEND, 0); - - /* msgh_size passed as argument */ - InP->Head.msgh_remote_port = our_message_port; - InP->Head.msgh_local_port = MACH_PORT_NULL; - InP->Head.msgh_seqno = 0; - InP->Head.msgh_id = GDB_MESSAGE_ID_STOP; - - ret = mach_msg (&InP->Head, - MACH_SEND_MSG|MACH_MSG_OPTION_NONE, - sizeof(Request), - 0, - MACH_PORT_NULL, - MACH_MSG_TIMEOUT_NONE, - MACH_PORT_NULL); -} - -#ifdef THREAD_ALLOWED_TO_BREAK -/* - * Return 1 if the MID specifies the thread that caused the - * last exception. - * Since catch_exception_raise() selects the thread causing - * the last exception to current_thread, we just check that - * it is selected and the last exception was a breakpoint. - */ -int -mach_thread_for_breakpoint (mid) - int mid; -{ - int cmid = map_port_name_to_mid (current_thread, MACH_TYPE_THREAD); - - if (mid < 0) - { - mid = map_slot_to_mid (-(mid+1), 0, 0); - if (mid < 0) - return 0; /* Don't stop, no such slot */ - } - - if (! mid || cmid == -1) - return 1; /* stop */ - - return cmid == mid && stop_exception == EXC_BREAKPOINT; -} -#endif /* THREAD_ALLOWED_TO_BREAK */ - -#ifdef THREAD_PARSE_ID -/* - * Map a thread id string (MID or a @SLOTNUMBER) - * to a thread-id. - * - * 0 matches all threads. - * Otherwise the meaning is defined only in this file. - * (mach_thread_for_breakpoint uses it) - * - * @@ This allows non-existent MIDs to be specified. - * It now also allows non-existent slots to be - * specified. (Slot numbers stored are negative, - * and the magnitude is one greater than the actual - * slot index. (Since 0 is reserved)) - */ -int -mach_thread_parse_id (arg) - char *arg; -{ - int mid; - if (arg == 0) - error ("thread id excpected"); - mid = parse_thread_id (arg, 0, 1); - - return mid; -} -#endif /* THREAD_PARSE_ID */ - -#ifdef THREAD_OUTPUT_ID -char * -mach_thread_output_id (mid) - int mid; -{ - static char foobar [20]; - - if (mid > 0) - sprintf (foobar, "mid %d", mid); - else if (mid < 0) - sprintf (foobar, "@%d", -(mid+1)); - else - sprintf (foobar, "*any thread*"); - - return foobar; -} -#endif /* THREAD_OUTPUT_ID */ - -/* Called with hook PREPARE_TO_PROCEED() from infrun.c. - * - * If we have switched threads and stopped at breakpoint return 1 otherwise 0. - * - * if SELECT_IT is nonzero, reselect the thread that was active when - * we stopped at a breakpoint. - * - */ - -mach3_prepare_to_proceed (select_it) - int select_it; -{ - if (stop_thread && - stop_thread != current_thread && - stop_exception == EXC_BREAKPOINT) - { - int mid; - - if (! select_it) - return 1; - - mid = switch_to_thread (stop_thread); - - return 1; - } - - return 0; -} - -/* this stuff here is an upcall via libmach/excServer.c - and mach_really_wait which does the actual upcall. - - The code will pass the exception to the inferior if: - - - The task that signaled is not the inferior task - (e.g. when debugging another debugger) - - - The user has explicitely requested to pass on the exceptions. - (e.g to the default unix exception handler, which maps - exceptions to signals, or the user has her own exception handler) - - - If the thread that signaled is being single-stepped and it - has set it's own exception port and the exception is not - EXC_BREAKPOINT. (Maybe this is not desirable?) - */ - -kern_return_t -catch_exception_raise (port, thread, task, exception, code, subcode) - mach_port_t port; - thread_t thread; - task_t task; - int exception, code, subcode; -{ - kern_return_t ret; - boolean_t signal_thread; - int mid = map_port_name_to_mid (thread, MACH_TYPE_THREAD); - - if (! MACH_PORT_VALID (thread)) - { - /* If the exception was sent and thread dies before we - receive it, THREAD will be MACH_PORT_DEAD - */ - - current_thread = thread = MACH_PORT_NULL; - error ("Received exception from nonexistent thread"); - } - - /* Check if the task died in transit. - * @@ Isn't the thread also invalid in such case? - */ - if (! MACH_PORT_VALID (task)) - { - current_thread = thread = MACH_PORT_NULL; - error ("Received exception from nonexistent task"); - } - - if (exception < 0 || exception > MAX_EXCEPTION) - fatal ("catch_exception_raise: unknown exception code %d thread %d", - exception, - mid); - - if (! MACH_PORT_VALID (inferior_task)) - error ("got an exception, but inferior_task is null or dead"); - - stop_exception = exception; - stop_code = code; - stop_subcode = subcode; - stop_thread = thread; - - signal_thread = exception != EXC_BREAKPOINT && - port == singlestepped_thread_port && - MACH_PORT_VALID (thread_saved_exception_port); - - /* If it was not our inferior or if we want to forward - * the exception to the inferior's handler, do it here - * - * Note: If you have forwarded EXC_BREAKPOINT I trust you know why. - */ - if (task != inferior_task || - signal_thread || - exception_map [exception].forward) - { - mach_port_t eport = inferior_old_exception_port; - - if (signal_thread) - { - /* - GDB now forwards the exeption to thread's original handler, - since the user propably knows what he is doing. - Give a message, though. - */ - - mach3_exception_actions ((WAITTYPE *)NULL, TRUE, "Thread"); - eport = thread_saved_exception_port; - } - - /* Send the exception to the original handler */ - ret = exception_raise (eport, - thread, - task, - exception, - code, - subcode); - - (void) mach_port_deallocate (mach_task_self (), task); - (void) mach_port_deallocate (mach_task_self (), thread); - - /* If we come here, we don't want to trace any more, since we - * will never stop for tracing anyway. - */ - discard_single_step (thread); - - /* Do not stop the inferior */ - return ret; - } - - /* Now gdb handles the exception */ - stopped_in_exception = TRUE; - - ret = task_suspend (task); - CHK ("Error suspending inferior after exception", ret); - - must_suspend_thread = 0; - - if (current_thread != thread) - { - if (MACH_PORT_VALID (singlestepped_thread_port)) - /* Cleanup discards single stepping */ - error ("Exception from thread %d while singlestepping thread %d", - mid, - map_port_name_to_mid (current_thread, MACH_TYPE_THREAD)); - - /* Then select the thread that caused the exception */ - if (select_thread (inferior_task, mid, 0) != KERN_SUCCESS) - error ("Could not select thread %d causing exception", mid); - else - warning ("Gdb selected thread %d", mid); - } - - /* If we receive an exception that is not breakpoint - * exception, we interrupt the single step and return to - * debugger. Trace condition is cleared. - */ - if (MACH_PORT_VALID (singlestepped_thread_port)) - { - if (stop_exception != EXC_BREAKPOINT) - warning ("Single step interrupted by exception"); - else if (port == singlestepped_thread_port) - { - /* Single step exception occurred, remove trace bit - * and return to gdb. - */ - if (! MACH_PORT_VALID (current_thread)) - error ("Single stepped thread is not valid"); - - /* Resume threads, but leave the task suspended */ - resume_all_threads (0); - } - else - warning ("Breakpoint while single stepping?"); - - discard_single_step (current_thread); - } - - (void) mach_port_deallocate (mach_task_self (), task); - (void) mach_port_deallocate (mach_task_self (), thread); - - return KERN_SUCCESS; -} - -int -port_valid (port, mask) - mach_port_t port; - int mask; -{ - kern_return_t ret; - mach_port_type_t type; - - ret = mach_port_type (mach_task_self (), - port, - &type); - if (ret != KERN_SUCCESS || (type & mask) != mask) - return 0; - return 1; -} - -/* @@ No vm read cache implemented yet */ -boolean_t vm_read_cache_valid = FALSE; - -/* - * Read inferior task's LEN bytes from ADDR and copy it to MYADDR - * in gdb's address space. - * - * Return 0 on failure; number of bytes read otherwise. - */ -int -mach3_read_inferior (addr, myaddr, length) - CORE_ADDR addr; - char *myaddr; - int length; -{ - kern_return_t ret; - vm_address_t low_address = (vm_address_t) trunc_page (addr); - vm_size_t aligned_length = - (vm_size_t) round_page (addr+length) - low_address; - pointer_t copied_memory; - int copy_count; - - /* Get memory from inferior with page aligned addresses */ - ret = vm_read (inferior_task, - low_address, - aligned_length, - &copied_memory, - ©_count); - if (ret != KERN_SUCCESS) - { - /* the problem is that the inferior might be killed for whatever reason - * before we go to mach_really_wait. This is one place that ought to - * catch many of those errors. - * @@ A better fix would be to make all external events to GDB - * to arrive via a SINGLE port set. (Including user input!) - */ - - if (! port_valid (inferior_task, MACH_PORT_TYPE_SEND)) - { - m3_kill_inferior (); - error ("Inferior killed (task port invalid)"); - } - else - { -#ifdef OSF - extern int errno; - /* valprint.c gives nicer format if this does not - screw it. Eamonn seems to like this, so I enable - it if OSF is defined... - */ - warning ("[read inferior %x failed: %s]", - addr, mach_error_string (ret)); - errno = 0; -#endif - return 0; - } - } - - memcpy (myaddr, (char *)addr - low_address + copied_memory, length); - - ret = vm_deallocate (mach_task_self (), - copied_memory, - copy_count); - CHK("mach3_read_inferior vm_deallocate failed", ret); - - return length; -} - -#ifdef __STDC__ -#define CHK_GOTO_OUT(str,ret) \ - do if (ret != KERN_SUCCESS) { errstr = #str; goto out; } while(0) -#else -#define CHK_GOTO_OUT(str,ret) \ - do if (ret != KERN_SUCCESS) { errstr = str; goto out; } while(0) -#endif - -struct vm_region_list { - struct vm_region_list *next; - vm_prot_t protection; - vm_address_t start; - vm_size_t length; -}; - -struct obstack region_obstack; - -/* - * Write inferior task's LEN bytes from ADDR and copy it to MYADDR - * in gdb's address space. - */ -int -mach3_write_inferior (addr, myaddr, length) - CORE_ADDR addr; - char *myaddr; - int length; -{ - kern_return_t ret; - vm_address_t low_address = (vm_address_t) trunc_page (addr); - vm_size_t aligned_length = - (vm_size_t) round_page (addr+length) - low_address; - pointer_t copied_memory; - int copy_count; - int deallocate = 0; - - char *errstr = "Bug in mach3_write_inferior"; - - struct vm_region_list *region_element; - struct vm_region_list *region_head = (struct vm_region_list *)NULL; - - /* Get memory from inferior with page aligned addresses */ - ret = vm_read (inferior_task, - low_address, - aligned_length, - &copied_memory, - ©_count); - CHK_GOTO_OUT ("mach3_write_inferior vm_read failed", ret); - - deallocate++; - - memcpy ((char *)addr - low_address + copied_memory, myaddr, length); - - obstack_init (®ion_obstack); - - /* Do writes atomically. - * First check for holes and unwritable memory. - */ - { - vm_size_t remaining_length = aligned_length; - vm_address_t region_address = low_address; - - struct vm_region_list *scan; - - while(region_address < low_address + aligned_length) - { - vm_prot_t protection; - vm_prot_t max_protection; - vm_inherit_t inheritance; - boolean_t shared; - mach_port_t object_name; - vm_offset_t offset; - vm_size_t region_length = remaining_length; - vm_address_t old_address = region_address; - - ret = vm_region (inferior_task, - ®ion_address, - ®ion_length, - &protection, - &max_protection, - &inheritance, - &shared, - &object_name, - &offset); - CHK_GOTO_OUT ("vm_region failed", ret); - - /* Check for holes in memory */ - if (old_address != region_address) - { - warning ("No memory at 0x%x. Nothing written", - old_address); - ret = KERN_SUCCESS; - length = 0; - goto out; - } - - if (!(max_protection & VM_PROT_WRITE)) - { - warning ("Memory at address 0x%x is unwritable. Nothing written", - old_address); - ret = KERN_SUCCESS; - length = 0; - goto out; - } - - /* Chain the regions for later use */ - region_element = - (struct vm_region_list *) - obstack_alloc (®ion_obstack, sizeof (struct vm_region_list)); - - region_element->protection = protection; - region_element->start = region_address; - region_element->length = region_length; - - /* Chain the regions along with protections */ - region_element->next = region_head; - region_head = region_element; - - region_address += region_length; - remaining_length = remaining_length - region_length; - } - - /* If things fail after this, we give up. - * Somebody is messing up inferior_task's mappings. - */ - - /* Enable writes to the chained vm regions */ - for (scan = region_head; scan; scan = scan->next) - { - boolean_t protection_changed = FALSE; - - if (!(scan->protection & VM_PROT_WRITE)) - { - ret = vm_protect (inferior_task, - scan->start, - scan->length, - FALSE, - scan->protection | VM_PROT_WRITE); - CHK_GOTO_OUT ("vm_protect: enable write failed", ret); - } - } - - ret = vm_write (inferior_task, - low_address, - copied_memory, - aligned_length); - CHK_GOTO_OUT ("vm_write failed", ret); - - /* Set up the original region protections, if they were changed */ - for (scan = region_head; scan; scan = scan->next) - { - boolean_t protection_changed = FALSE; - - if (!(scan->protection & VM_PROT_WRITE)) - { - ret = vm_protect (inferior_task, - scan->start, - scan->length, - FALSE, - scan->protection); - CHK_GOTO_OUT ("vm_protect: enable write failed", ret); - } - } - } - - out: - if (deallocate) - { - obstack_free (®ion_obstack, 0); - - (void) vm_deallocate (mach_task_self (), - copied_memory, - copy_count); - } - - if (ret != KERN_SUCCESS) - { - warning ("%s %s", errstr, mach_error_string (ret)); - return 0; - } - - return length; -} - -/* Return 0 on failure, number of bytes handled otherwise. */ -static int -m3_xfer_memory (memaddr, myaddr, len, write, target) - CORE_ADDR memaddr; - char *myaddr; - int len; - int write; - struct target_ops *target; /* IGNORED */ -{ - int result; - - if (write) - result = mach3_write_inferior (memaddr, myaddr, len); - else - result = mach3_read_inferior (memaddr, myaddr, len); - - return result; -} - - -static char * -translate_state(state) -int state; -{ - switch (state) { - case TH_STATE_RUNNING: return("R"); - case TH_STATE_STOPPED: return("S"); - case TH_STATE_WAITING: return("W"); - case TH_STATE_UNINTERRUPTIBLE: return("U"); - case TH_STATE_HALTED: return("H"); - default: return("?"); - } -} - -static char * -translate_cstate (state) - int state; -{ - switch (state) - { - case CPROC_RUNNING: return "R"; - case CPROC_SWITCHING: return "S"; - case CPROC_BLOCKED: return "B"; - case CPROC_CONDWAIT: return "C"; - case CPROC_CONDWAIT|CPROC_SWITCHING: return "CS"; - default: return "?"; - } -} - -/* type == MACH_MSG_TYPE_COPY_SEND || type == MACH_MSG_TYPE_MAKE_SEND */ - -mach_port_t /* no mach_port_name_t found in include files. */ -map_inferior_port_name (inferior_name, type) - mach_port_t inferior_name; - mach_msg_type_name_t type; -{ - kern_return_t ret; - mach_msg_type_name_t acquired; - mach_port_t iport; - - ret = mach_port_extract_right (inferior_task, - inferior_name, - type, - &iport, - &acquired); - CHK("mach_port_extract_right (map_inferior_port_name)", ret); - - if (acquired != MACH_MSG_TYPE_PORT_SEND) - error("Incorrect right extracted, (map_inferior_port_name)"); - - ret = mach_port_deallocate (mach_task_self (), - iport); - CHK ("Deallocating mapped port (map_inferior_port_name)", ret); - - return iport; -} - -/* - * Naming convention: - * Always return user defined name if found. - * _K == A kernel thread with no matching CPROC - * _C == A cproc with no current cthread - * _t == A cthread with no user defined name - * - * The digits that follow the _names are the SLOT number of the - * kernel thread if there is such a thing, otherwise just a negation - * of the sequential number of such cprocs. - */ - -static char buf[7]; - -static char * -get_thread_name (one_cproc, id) - gdb_thread_t one_cproc; - int id; -{ - if (one_cproc) - if (one_cproc->cthread == NULL) - { - /* cproc not mapped to any cthread */ - sprintf(buf, "_C%d", id); - } - else if (! one_cproc->cthread->name) - { - /* cproc and cthread, but no name */ - sprintf(buf, "_t%d", id); - } - else - return (char *)(one_cproc->cthread->name); - else - { - if (id < 0) - warning ("Inconsistency in thread name id %d", id); - - /* Kernel thread without cproc */ - sprintf(buf, "_K%d", id); - } - - return buf; -} - -int -fetch_thread_info (task, mthreads_out) - mach_port_t task; - gdb_thread_t *mthreads_out; /* out */ -{ - kern_return_t ret; - thread_array_t th_table; - int th_count; - gdb_thread_t mthreads = NULL; - int index; - - ret = task_threads (task, &th_table, &th_count); - if (ret != KERN_SUCCESS) - { - warning ("Error getting inferior's thread list:%s", - mach_error_string(ret)); - m3_kill_inferior (); - return -1; - } - - mthreads = (gdb_thread_t) - obstack_alloc - (cproc_obstack, - th_count * sizeof (struct gdb_thread)); - - for (index = 0; index < th_count; index++) - { - thread_t saved_thread = MACH_PORT_NULL; - int mid; - - if (must_suspend_thread) - setup_thread (th_table[ index ], 1); - - if (th_table[index] != current_thread) - { - saved_thread = current_thread; - - mid = switch_to_thread (th_table[ index ]); - } - - mthreads[index].name = th_table[index]; - mthreads[index].cproc = NULL; /* map_cprocs_to_kernel_threads() */ - mthreads[index].in_emulator = FALSE; - mthreads[index].slotid = index; - - mthreads[index].sp = read_register (SP_REGNUM); - mthreads[index].fp = read_register (FP_REGNUM); - mthreads[index].pc = read_pc (); - - if (MACH_PORT_VALID (saved_thread)) - mid = switch_to_thread (saved_thread); - - if (must_suspend_thread) - setup_thread (th_table[ index ], 0); - } - - consume_send_rights (th_table, th_count); - ret = vm_deallocate (mach_task_self(), (vm_address_t)th_table, - (th_count * sizeof(mach_port_t))); - if (ret != KERN_SUCCESS) - { - warning ("Error trying to deallocate thread list : %s", - mach_error_string (ret)); - } - - *mthreads_out = mthreads; - - return th_count; -} - - -/* - * Current emulator always saves the USP on top of - * emulator stack below struct emul_stack_top stuff. - */ -CORE_ADDR -fetch_usp_from_emulator_stack (sp) - CORE_ADDR sp; -{ - CORE_ADDR stack_pointer; - - sp = (sp & ~(EMULATOR_STACK_SIZE-1)) + - EMULATOR_STACK_SIZE - sizeof (struct emul_stack_top); - - if (mach3_read_inferior (sp, - &stack_pointer, - sizeof (CORE_ADDR)) != sizeof (CORE_ADDR)) - { - warning ("Can't read user sp from emulator stack address 0x%x", sp); - return 0; - } - - return stack_pointer; -} - -#ifdef MK67 - -/* get_emulation_vector() interface was changed after mk67 */ -#define EMUL_VECTOR_COUNT 400 /* Value does not matter too much */ - -#endif /* MK67 */ - -/* Check if the emulator exists at task's address space. - */ -boolean_t -have_emulator_p (task) - task_t task; -{ - kern_return_t ret; -#ifndef EMUL_VECTOR_COUNT - vm_offset_t *emulation_vector; - int n; -#else - vm_offset_t emulation_vector[ EMUL_VECTOR_COUNT ]; - int n = EMUL_VECTOR_COUNT; -#endif - int i; - int vector_start; - - ret = task_get_emulation_vector (task, - &vector_start, -#ifndef EMUL_VECTOR_COUNT - &emulation_vector, -#else - emulation_vector, -#endif - &n); - CHK("task_get_emulation_vector", ret); - xx_debug ("%d vectors from %d at 0x%08x\n", - n, vector_start, emulation_vector); - - for(i = 0; i < n; i++) - { - vm_offset_t entry = emulation_vector [i]; - - if (EMULATOR_BASE <= entry && entry <= EMULATOR_END) - return TRUE; - else if (entry) - { - static boolean_t informed = FALSE; - if (!informed) - { - warning("Emulation vector address 0x08%x outside emulator space", - entry); - informed = TRUE; - } - } - } - return FALSE; -} - -/* Map cprocs to kernel threads and vice versa. */ - -void -map_cprocs_to_kernel_threads (cprocs, mthreads, thread_count) - gdb_thread_t cprocs; - gdb_thread_t mthreads; - int thread_count; -{ - int index; - gdb_thread_t scan; - boolean_t all_mapped = TRUE; - LONGEST stack_base; - LONGEST stack_size; - - for (scan = cprocs; scan; scan = scan->next) - { - /* Default to: no kernel thread for this cproc */ - scan->reverse_map = -1; - - /* Check if the cproc is found by its stack */ - for (index = 0; index < thread_count; index++) - { - stack_base = - extract_signed_integer (scan->raw_cproc + CPROC_BASE_OFFSET, - CPROC_BASE_SIZE); - stack_size = - extract_signed_integer (scan->raw_cproc + CPROC_SIZE_OFFSET, - CPROC_SIZE_SIZE); - if ((mthreads + index)->sp > stack_base && - (mthreads + index)->sp <= stack_base + stack_size) - { - (mthreads + index)->cproc = scan; - scan->reverse_map = index; - break; - } - } - all_mapped &= (scan->reverse_map != -1); - } - - /* Check for threads that are currently in the emulator. - * If so, they have a different stack, and the still unmapped - * cprocs may well get mapped to these threads. - * - * If: - * - cproc stack does not match any kernel thread stack pointer - * - there is at least one extra kernel thread - * that has no cproc mapped above. - * - some kernel thread stack pointer points to emulator space - * then we find the user stack pointer saved in the emulator - * stack, and try to map that to the cprocs. - * - * Also set in_emulator for kernel threads. - */ - - if (emulator_present) - { - for (index = 0; index < thread_count; index++) - { - CORE_ADDR emul_sp; - CORE_ADDR usp; - - gdb_thread_t mthread = (mthreads+index); - emul_sp = mthread->sp; - - if (mthread->cproc == NULL && - EMULATOR_BASE <= emul_sp && emul_sp <= EMULATOR_END) - { - mthread->in_emulator = emulator_present; - - if (!all_mapped && cprocs) - { - usp = fetch_usp_from_emulator_stack (emul_sp); - - /* @@ Could be more accurate */ - if (! usp) - error ("Zero stack pointer read from emulator?"); - - /* Try to match this stack pointer to the cprocs that - * don't yet have a kernel thread. - */ - for (scan = cprocs; scan; scan = scan->next) - { - - /* Check is this unmapped CPROC stack contains - * the user stack pointer saved in the - * emulator. - */ - if (scan->reverse_map == -1) - { - stack_base = - extract_signed_integer - (scan->raw_cproc + CPROC_BASE_OFFSET, - CPROC_BASE_SIZE); - stack_size = - extract_signed_integer - (scan->raw_cproc + CPROC_SIZE_OFFSET, - CPROC_SIZE_SIZE); - if (usp > stack_base && - usp <= stack_base + stack_size) - { - mthread->cproc = scan; - scan->reverse_map = index; - break; - } - } - } - } - } - } - } -} - -/* - * Format of the thread_list command - * - * slot mid sel name emul ks susp cstate wired address - */ -#define TL_FORMAT "%-2.2s %5d%c %-10.10s %1.1s%s%-5.5s %-2.2s %-5.5s " - -#define TL_HEADER "\n@ MID Name KState CState Where\n" - -void -print_tl_address (stream, pc) - GDB_FILE *stream; - CORE_ADDR pc; -{ - if (! lookup_minimal_symbol_by_pc (pc)) - fprintf_filtered (stream, local_hex_format(), pc); - else - { - extern int addressprint; - extern int asm_demangle; - - int store = addressprint; - addressprint = 0; - print_address_symbolic (pc, stream, asm_demangle, ""); - addressprint = store; - } -} - -/* For thread names, but also for gdb_message_port external name */ -#define MAX_NAME_LEN 50 - -/* Returns the address of variable NAME or 0 if not found */ -CORE_ADDR -lookup_address_of_variable (name) - char *name; -{ - struct symbol *sym; - CORE_ADDR symaddr = 0; - struct minimal_symbol *msymbol; - - sym = lookup_symbol (name, - (struct block *)NULL, - VAR_NAMESPACE, - (int *)NULL, - (struct symtab **)NULL); - - if (sym) - symaddr = SYMBOL_VALUE (sym); - - if (! symaddr) - { - msymbol = lookup_minimal_symbol (name, NULL, NULL); - - if (msymbol && msymbol->type == mst_data) - symaddr = SYMBOL_VALUE_ADDRESS (msymbol); - } - - return symaddr; -} - -static gdb_thread_t -get_cprocs() -{ - gdb_thread_t cproc_head; - gdb_thread_t cproc_copy; - CORE_ADDR their_cprocs; - char *buf[TARGET_PTR_BIT / HOST_CHAR_BIT]; - char *name; - cthread_t cthread; - CORE_ADDR symaddr; - - symaddr = lookup_address_of_variable ("cproc_list"); - - if (! symaddr) - { - /* cproc_list is not in a file compiled with debugging - symbols, but don't give up yet */ - - symaddr = lookup_address_of_variable ("cprocs"); - - if (symaddr) - { - static int informed = 0; - if (!informed) - { - informed++; - warning ("Your program is loaded with an old threads library."); - warning ("GDB does not know the old form of threads"); - warning ("so things may not work."); - } - } - } - - /* Stripped or no -lthreads loaded or "cproc_list" is in wrong segment. */ - if (! symaddr) - return NULL; - - /* Get the address of the first cproc in the task */ - if (!mach3_read_inferior (symaddr, - buf, - TARGET_PTR_BIT / HOST_CHAR_BIT)) - error ("Can't read cproc master list at address (0x%x).", symaddr); - their_cprocs = extract_address (buf, TARGET_PTR_BIT / HOST_CHAR_BIT); - - /* Scan the CPROCs in the task. - CPROCs are chained with LIST field, not NEXT field, which - chains mutexes, condition variables and queues */ - - cproc_head = NULL; - - while (their_cprocs != (CORE_ADDR)0) - { - CORE_ADDR cproc_copy_incarnation; - cproc_copy = (gdb_thread_t) obstack_alloc (cproc_obstack, - sizeof (struct gdb_thread)); - - if (!mach3_read_inferior (their_cprocs, - &cproc_copy->raw_cproc[0], - CPROC_SIZE)) - error("Can't read next cproc at 0x%x.", their_cprocs); - - their_cprocs = - extract_address (cproc_copy->raw_cproc + CPROC_LIST_OFFSET, - CPROC_LIST_SIZE); - cproc_copy_incarnation = - extract_address (cproc_copy->raw_cproc + CPROC_INCARNATION_OFFSET, - CPROC_INCARNATION_SIZE); - - if (cproc_copy_incarnation == (CORE_ADDR)0) - cproc_copy->cthread = NULL; - else - { - /* This CPROC has an attached CTHREAD. Get its name */ - cthread = (cthread_t)obstack_alloc (cproc_obstack, - sizeof(struct cthread)); - - if (!mach3_read_inferior (cproc_copy_incarnation, - cthread, - sizeof(struct cthread))) - error("Can't read next thread at 0x%x.", - cproc_copy_incarnation); - - cproc_copy->cthread = cthread; - - if (cthread->name) - { - name = (char *) obstack_alloc (cproc_obstack, MAX_NAME_LEN); - - if (!mach3_read_inferior(cthread->name, name, MAX_NAME_LEN)) - error("Can't read next thread's name at 0x%x.", cthread->name); - - cthread->name = name; - } - } - - /* insert in front */ - cproc_copy->next = cproc_head; - cproc_head = cproc_copy; - } - return cproc_head; -} - -#ifndef FETCH_CPROC_STATE -/* - * Check if your machine does not grok the way this routine - * fetches the FP,PC and SP of a cproc that is not - * currently attached to any kernel thread (e.g. its cproc.context - * field points to the place in stack where the context - * is saved). - * - * If it doesn't, define your own routine. - */ -#define FETCH_CPROC_STATE(mth) mach3_cproc_state (mth) - -int -mach3_cproc_state (mthread) - gdb_thread_t mthread; -{ - int context; - - if (! mthread || !mthread->cproc) - return -1; - - context = extract_signed_integer - (mthread->cproc->raw_cproc + CPROC_CONTEXT_OFFSET, - CPROC_CONTEXT_SIZE); - if (context == 0) - return -1; - - mthread->sp = context + MACHINE_CPROC_SP_OFFSET; - - if (mach3_read_inferior (context + MACHINE_CPROC_PC_OFFSET, - &mthread->pc, - sizeof (CORE_ADDR)) != sizeof (CORE_ADDR)) - { - warning ("Can't read cproc pc from inferior"); - return -1; - } - - if (mach3_read_inferior (context + MACHINE_CPROC_FP_OFFSET, - &mthread->fp, - sizeof (CORE_ADDR)) != sizeof (CORE_ADDR)) - { - warning ("Can't read cproc fp from inferior"); - return -1; - } - - return 0; -} -#endif /* FETCH_CPROC_STATE */ - - -void -thread_list_command() -{ - thread_basic_info_data_t ths; - int thread_count; - gdb_thread_t cprocs; - gdb_thread_t scan; - int index; - char *name; - char selected; - char *wired; - int infoCnt; - kern_return_t ret; - mach_port_t mid_or_port; - gdb_thread_t their_threads; - gdb_thread_t kthread; - - int neworder = 1; - - char *fmt = "There are %d kernel threads in task %d.\n"; - - int tmid = map_port_name_to_mid (inferior_task, MACH_TYPE_TASK); - - MACH_ERROR_NO_INFERIOR; - - thread_count = fetch_thread_info (inferior_task, - &their_threads); - if (thread_count == -1) - return; - - if (thread_count == 1) - fmt = "There is %d kernel thread in task %d.\n"; - - printf_filtered (fmt, thread_count, tmid); - - puts_filtered (TL_HEADER); - - cprocs = get_cprocs(); - - map_cprocs_to_kernel_threads (cprocs, their_threads, thread_count); - - for (scan = cprocs; scan; scan = scan->next) - { - int mid; - char buf[10]; - char slot[3]; - int cproc_state = - extract_signed_integer - (scan->raw_cproc + CPROC_STATE_OFFSET, CPROC_STATE_SIZE); - - selected = ' '; - - /* a wired cproc? */ - wired = (extract_address (scan->raw_cproc + CPROC_WIRED_OFFSET, - CPROC_WIRED_SIZE) - ? "wired" : ""); - - if (scan->reverse_map != -1) - kthread = (their_threads + scan->reverse_map); - else - kthread = NULL; - - if (kthread) - { - /* These cprocs have a kernel thread */ - - mid = map_port_name_to_mid (kthread->name, MACH_TYPE_THREAD); - - infoCnt = THREAD_BASIC_INFO_COUNT; - - ret = thread_info (kthread->name, - THREAD_BASIC_INFO, - (thread_info_t)&ths, - &infoCnt); - - if (ret != KERN_SUCCESS) - { - warning ("Unable to get basic info on thread %d : %s", - mid, - mach_error_string (ret)); - continue; - } - - /* Who is the first to have more than 100 threads */ - sprintf (slot, "%d", kthread->slotid%100); - - if (kthread->name == current_thread) - selected = '*'; - - if (ths.suspend_count) - sprintf (buf, "%d", ths.suspend_count); - else - buf[0] = '\000'; - -#if 0 - if (ths.flags & TH_FLAGS_SWAPPED) - strcat (buf, "S"); -#endif - - if (ths.flags & TH_FLAGS_IDLE) - strcat (buf, "I"); - - printf_filtered (TL_FORMAT, - slot, - mid, - selected, - get_thread_name (scan, kthread->slotid), - kthread->in_emulator ? "E" : "", - translate_state (ths.run_state), - buf, - translate_cstate (cproc_state), - wired); - print_tl_address (gdb_stdout, kthread->pc); - } - else - { - /* These cprocs don't have a kernel thread. - * find out the calling frame with - * FETCH_CPROC_STATE. - */ - - struct gdb_thread state; - -#if 0 - /* jtv -> emcmanus: why do you want this here? */ - if (scan->incarnation == NULL) - continue; /* EMcM */ -#endif - - printf_filtered (TL_FORMAT, - "-", - -neworder, /* Pseudo MID */ - selected, - get_thread_name (scan, -neworder), - "", - "-", /* kernel state */ - "", - translate_cstate (cproc_state), - ""); - state.cproc = scan; - - if (FETCH_CPROC_STATE (&state) == -1) - puts_filtered ("???"); - else - print_tl_address (gdb_stdout, state.pc); - - neworder++; - } - puts_filtered ("\n"); - } - - /* Scan for kernel threads without cprocs */ - for (index = 0; index < thread_count; index++) - { - if (! their_threads[index].cproc) - { - int mid; - - char buf[10]; - char slot[3]; - - mach_port_t name = their_threads[index].name; - - mid = map_port_name_to_mid (name, MACH_TYPE_THREAD); - - infoCnt = THREAD_BASIC_INFO_COUNT; - - ret = thread_info(name, - THREAD_BASIC_INFO, - (thread_info_t)&ths, - &infoCnt); - - if (ret != KERN_SUCCESS) - { - warning ("Unable to get basic info on thread %d : %s", - mid, - mach_error_string (ret)); - continue; - } - - sprintf (slot, "%d", index%100); - - if (name == current_thread) - selected = '*'; - else - selected = ' '; - - if (ths.suspend_count) - sprintf (buf, "%d", ths.suspend_count); - else - buf[0] = '\000'; - -#if 0 - if (ths.flags & TH_FLAGS_SWAPPED) - strcat (buf, "S"); -#endif - - if (ths.flags & TH_FLAGS_IDLE) - strcat (buf, "I"); - - printf_filtered (TL_FORMAT, - slot, - mid, - selected, - get_thread_name (NULL, index), - their_threads[index].in_emulator ? "E" : "", - translate_state (ths.run_state), - buf, - "", /* No cproc state */ - ""); /* Can't be wired */ - print_tl_address (gdb_stdout, their_threads[index].pc); - puts_filtered ("\n"); - } - } - - obstack_free (cproc_obstack, 0); - obstack_init (cproc_obstack); -} - -void -thread_select_command(args, from_tty) - char *args; - int from_tty; -{ - int mid; - thread_array_t thread_list; - int thread_count; - kern_return_t ret; - int is_slot = 0; - - MACH_ERROR_NO_INFERIOR; - - if (!args) - error_no_arg ("MID or @SLOTNUMBER to specify a thread to select"); - - while (*args == ' ' || *args == '\t') - args++; - - if (*args == '@') - { - is_slot++; - args++; - } - - mid = atoi(args); - - if (mid == 0) - if (!is_slot || *args != '0') /* Rudimentary checks */ - error ("You must select threads by MID or @SLOTNUMBER"); - - if (select_thread (inferior_task, mid, is_slot?2:1) != KERN_SUCCESS) - return; - - if (from_tty) - printf_filtered ("Thread %d selected\n", - is_slot ? map_port_name_to_mid (current_thread, - MACH_TYPE_THREAD) : mid); -} - -thread_trace (thread, set) -mach_port_t thread; -boolean_t set; -{ - int flavor = TRACE_FLAVOR; - unsigned int stateCnt = TRACE_FLAVOR_SIZE; - kern_return_t ret; - thread_state_data_t state; - - if (! MACH_PORT_VALID (thread)) - { - warning ("thread_trace: invalid thread"); - return; - } - - if (must_suspend_thread) - setup_thread (thread, 1); - - ret = thread_get_state(thread, flavor, state, &stateCnt); - CHK ("thread_trace: error reading thread state", ret); - - if (set) - { - TRACE_SET (thread, state); - } - else - { - if (! TRACE_CLEAR (thread, state)) - { - if (must_suspend_thread) - setup_thread (thread, 0); - return; - } - } - - ret = thread_set_state(thread, flavor, state, stateCnt); - CHK ("thread_trace: error writing thread state", ret); - if (must_suspend_thread) - setup_thread (thread, 0); -} - -#ifdef FLUSH_INFERIOR_CACHE - -/* When over-writing code on some machines the I-Cache must be flushed - explicitly, because it is not kept coherent by the lazy hardware. - This definitely includes breakpoints, for instance, or else we - end up looping in mysterious Bpt traps */ - -flush_inferior_icache(pc, amount) - CORE_ADDR pc; -{ - vm_machine_attribute_val_t flush = MATTR_VAL_ICACHE_FLUSH; - kern_return_t ret; - - ret = vm_machine_attribute (inferior_task, - pc, - amount, - MATTR_CACHE, - &flush); - if (ret != KERN_SUCCESS) - warning ("Error flushing inferior's cache : %s", - mach_error_string (ret)); -} -#endif FLUSH_INFERIOR_CACHE - - -static -suspend_all_threads (from_tty) - int from_tty; -{ - kern_return_t ret; - thread_array_t thread_list; - int thread_count, index; - int infoCnt; - thread_basic_info_data_t th_info; - - - ret = task_threads (inferior_task, &thread_list, &thread_count); - if (ret != KERN_SUCCESS) - { - warning ("Could not suspend inferior threads."); - m3_kill_inferior (); - return_to_top_level (RETURN_ERROR); - } - - for (index = 0; index < thread_count; index++) - { - int mid; - - mid = map_port_name_to_mid (thread_list[ index ], - MACH_TYPE_THREAD); - - ret = thread_suspend(thread_list[ index ]); - - if (ret != KERN_SUCCESS) - warning ("Error trying to suspend thread %d : %s", - mid, mach_error_string (ret)); - - if (from_tty) - { - infoCnt = THREAD_BASIC_INFO_COUNT; - ret = thread_info (thread_list[ index ], - THREAD_BASIC_INFO, - (thread_info_t) &th_info, - &infoCnt); - CHK ("suspend can't get thread info", ret); - - warning ("Thread %d suspend count is %d", - mid, th_info.suspend_count); - } - } - - consume_send_rights (thread_list, thread_count); - ret = vm_deallocate(mach_task_self(), - (vm_address_t)thread_list, - (thread_count * sizeof(int))); - CHK ("Error trying to deallocate thread list", ret); -} - -void -thread_suspend_command (args, from_tty) - char *args; - int from_tty; -{ - kern_return_t ret; - int mid; - mach_port_t saved_thread; - int infoCnt; - thread_basic_info_data_t th_info; - - MACH_ERROR_NO_INFERIOR; - - if (!strcasecmp (args, "all")) { - suspend_all_threads (from_tty); - return; - } - - saved_thread = current_thread; - - mid = parse_thread_id (args, 0, 0); - - if (mid < 0) - error ("You can suspend only existing kernel threads with MID or @SLOTNUMBER"); - - if (mid == 0) - mid = map_port_name_to_mid (current_thread, MACH_TYPE_THREAD); - else - if (select_thread (inferior_task, mid, 0) != KERN_SUCCESS) - { - if (current_thread) - current_thread = saved_thread; - error ("Could not select thread %d", mid); - } - - ret = thread_suspend (current_thread); - if (ret != KERN_SUCCESS) - warning ("thread_suspend failed : %s", - mach_error_string (ret)); - - infoCnt = THREAD_BASIC_INFO_COUNT; - ret = thread_info (current_thread, - THREAD_BASIC_INFO, - (thread_info_t) &th_info, - &infoCnt); - CHK ("suspend can't get thread info", ret); - - warning ("Thread %d suspend count is %d", mid, th_info.suspend_count); - - current_thread = saved_thread; -} - -resume_all_threads (from_tty) - int from_tty; -{ - kern_return_t ret; - thread_array_t thread_list; - int thread_count, index; - int mid; - int infoCnt; - thread_basic_info_data_t th_info; - - ret = task_threads (inferior_task, &thread_list, &thread_count); - if (ret != KERN_SUCCESS) - { - m3_kill_inferior (); - error("task_threads", mach_error_string( ret)); - } - - for (index = 0; index < thread_count; index++) - { - infoCnt = THREAD_BASIC_INFO_COUNT; - ret = thread_info (thread_list [ index ], - THREAD_BASIC_INFO, - (thread_info_t) &th_info, - &infoCnt); - CHK ("resume_all can't get thread info", ret); - - mid = map_port_name_to_mid (thread_list[ index ], - MACH_TYPE_THREAD); - - if (! th_info.suspend_count) - { - if (mid != -1 && from_tty) - warning ("Thread %d is not suspended", mid); - continue; - } - - ret = thread_resume (thread_list[ index ]); - - if (ret != KERN_SUCCESS) - warning ("Error trying to resume thread %d : %s", - mid, mach_error_string (ret)); - else if (mid != -1 && from_tty) - warning ("Thread %d suspend count is %d", - mid, --th_info.suspend_count); - } - - consume_send_rights (thread_list, thread_count); - ret = vm_deallocate(mach_task_self(), - (vm_address_t)thread_list, - (thread_count * sizeof(int))); - CHK("Error trying to deallocate thread list", ret); -} - -void -thread_resume_command (args, from_tty) - char *args; - int from_tty; -{ - int mid; - mach_port_t saved_thread; - kern_return_t ret; - thread_basic_info_data_t th_info; - int infoCnt = THREAD_BASIC_INFO_COUNT; - - MACH_ERROR_NO_INFERIOR; - - if (!strcasecmp (args, "all")) { - resume_all_threads (from_tty); - return; - } - - saved_thread = current_thread; - - mid = parse_thread_id (args, 0, 0); - - if (mid < 0) - error ("You can resume only existing kernel threads with MID or @SLOTNUMBER"); - - if (mid == 0) - mid = map_port_name_to_mid (current_thread, MACH_TYPE_THREAD); - else - if (select_thread (inferior_task, mid, 0) != KERN_SUCCESS) - { - if (current_thread) - current_thread = saved_thread; - return_to_top_level (RETURN_ERROR); - } - - ret = thread_info (current_thread, - THREAD_BASIC_INFO, - (thread_info_t) &th_info, - &infoCnt); - CHK ("resume can't get thread info", ret); - - if (! th_info.suspend_count) - { - warning ("Thread %d is not suspended", mid); - goto out; - } - - ret = thread_resume (current_thread); - if (ret != KERN_SUCCESS) - warning ("thread_resume failed : %s", - mach_error_string (ret)); - else - { - th_info.suspend_count--; - warning ("Thread %d suspend count is %d", mid, th_info.suspend_count); - } - - out: - current_thread = saved_thread; -} - -void -thread_kill_command (args, from_tty) - char *args; - int from_tty; -{ - int mid; - kern_return_t ret; - int thread_count; - thread_array_t thread_table; - int index; - mach_port_t thread_to_kill = MACH_PORT_NULL; - - - MACH_ERROR_NO_INFERIOR; - - if (!args) - error_no_arg ("thread mid to kill from the inferior task"); - - mid = parse_thread_id (args, 0, 0); - - if (mid < 0) - error ("You can kill only existing kernel threads with MID or @SLOTNUMBER"); - - if (mid) - { - ret = machid_mach_port (mid_server, mid_auth, mid, &thread_to_kill); - CHK ("thread_kill_command: machid_mach_port map failed", ret); - } - else - mid = map_port_name_to_mid (current_thread, MACH_TYPE_THREAD); - - /* Don't allow gdb to kill *any* thread in the system. Use mkill program for that */ - ret = task_threads (inferior_task, &thread_table, &thread_count); - CHK ("Error getting inferior's thread list", ret); - - if (thread_to_kill == current_thread) - { - ret = thread_terminate (thread_to_kill); - CHK ("Thread could not be terminated", ret); - - if (select_thread (inferior_task, 0, 1) != KERN_SUCCESS) - warning ("Last thread was killed, use \"kill\" command to kill task"); - } - else - for (index = 0; index < thread_count; index++) - if (thread_table [ index ] == thread_to_kill) - { - ret = thread_terminate (thread_to_kill); - CHK ("Thread could not be terminated", ret); - } - - if (thread_count > 1) - consume_send_rights (thread_table, thread_count); - - ret = vm_deallocate (mach_task_self(), (vm_address_t)thread_table, - (thread_count * sizeof(mach_port_t))); - CHK ("Error trying to deallocate thread list", ret); - - warning ("Thread %d killed", mid); -} - - -/* Task specific commands; add more if you like */ - -void -task_resume_command (args, from_tty) - char *args; - int from_tty; -{ - kern_return_t ret; - task_basic_info_data_t ta_info; - int infoCnt = TASK_BASIC_INFO_COUNT; - int mid = map_port_name_to_mid (inferior_task, MACH_TYPE_TASK); - - MACH_ERROR_NO_INFERIOR; - - /* Would be trivial to change, but is it desirable? */ - if (args) - error ("Currently gdb can resume only it's inferior task"); - - ret = task_info (inferior_task, - TASK_BASIC_INFO, - (task_info_t) &ta_info, - &infoCnt); - CHK ("task_resume_command: task_info failed", ret); - - if (ta_info.suspend_count == 0) - error ("Inferior task %d is not suspended", mid); - else if (ta_info.suspend_count == 1 && - from_tty && - !query ("Suspend count is now 1. Do you know what you are doing? ")) - error ("Task not resumed"); - - ret = task_resume (inferior_task); - CHK ("task_resume_command: task_resume", ret); - - if (ta_info.suspend_count == 1) - { - warning ("Inferior task %d is no longer suspended", mid); - must_suspend_thread = 1; - /* @@ This is not complete: Registers change all the time when not - suspended! */ - registers_changed (); - } - else - warning ("Inferior task %d suspend count is now %d", - mid, ta_info.suspend_count-1); -} - - -void -task_suspend_command (args, from_tty) - char *args; - int from_tty; -{ - kern_return_t ret; - task_basic_info_data_t ta_info; - int infoCnt = TASK_BASIC_INFO_COUNT; - int mid = map_port_name_to_mid (inferior_task, MACH_TYPE_TASK); - - MACH_ERROR_NO_INFERIOR; - - /* Would be trivial to change, but is it desirable? */ - if (args) - error ("Currently gdb can suspend only it's inferior task"); - - ret = task_suspend (inferior_task); - CHK ("task_suspend_command: task_suspend", ret); - - must_suspend_thread = 0; - - ret = task_info (inferior_task, - TASK_BASIC_INFO, - (task_info_t) &ta_info, - &infoCnt); - CHK ("task_suspend_command: task_info failed", ret); - - warning ("Inferior task %d suspend count is now %d", - mid, ta_info.suspend_count); -} - -static char * -get_size (bytes) - int bytes; -{ - static char size [ 30 ]; - int zz = bytes/1024; - - if (zz / 1024) - sprintf (size, "%-2.1f M", ((float)bytes)/(1024.0*1024.0)); - else - sprintf (size, "%d K", zz); - - return size; -} - -/* Does this require the target task to be suspended?? I don't think so. */ -void -task_info_command (args, from_tty) - char *args; - int from_tty; -{ - int mid = -5; - mach_port_t task; - kern_return_t ret; - task_basic_info_data_t ta_info; - int infoCnt = TASK_BASIC_INFO_COUNT; - int page_size = round_page(1); - int thread_count = 0; - - if (MACH_PORT_VALID (inferior_task)) - mid = map_port_name_to_mid (inferior_task, - MACH_TYPE_TASK); - - task = inferior_task; - - if (args) - { - int tmid = atoi (args); - - if (tmid <= 0) - error ("Invalid mid %d for task info", tmid); - - if (tmid != mid) - { - mid = tmid; - ret = machid_mach_port (mid_server, mid_auth, tmid, &task); - CHK ("task_info_command: machid_mach_port map failed", ret); - } - } - - if (mid < 0) - error ("You have to give the task MID as an argument"); - - ret = task_info (task, - TASK_BASIC_INFO, - (task_info_t) &ta_info, - &infoCnt); - CHK ("task_info_command: task_info failed", ret); - - printf_filtered ("\nTask info for task %d:\n\n", mid); - printf_filtered (" Suspend count : %d\n", ta_info.suspend_count); - printf_filtered (" Base priority : %d\n", ta_info.base_priority); - printf_filtered (" Virtual size : %s\n", get_size (ta_info.virtual_size)); - printf_filtered (" Resident size : %s\n", get_size (ta_info.resident_size)); - - { - thread_array_t thread_list; - - ret = task_threads (task, &thread_list, &thread_count); - CHK ("task_info_command: task_threads", ret); - - printf_filtered (" Thread count : %d\n", thread_count); - - consume_send_rights (thread_list, thread_count); - ret = vm_deallocate(mach_task_self(), - (vm_address_t)thread_list, - (thread_count * sizeof(int))); - CHK("Error trying to deallocate thread list", ret); - } - if (have_emulator_p (task)) - printf_filtered (" Emulator at : 0x%x..0x%x\n", - EMULATOR_BASE, EMULATOR_END); - else - printf_filtered (" No emulator.\n"); - - if (thread_count && task == inferior_task) - printf_filtered ("\nUse the \"thread list\" command to see the threads\n"); -} - -/* You may either FORWARD the exception to the inferior, or KEEP - * it and return to GDB command level. - * - * exception mid [ forward | keep ] - */ - -static void -exception_command (args, from_tty) - char *args; - int from_tty; -{ - char *scan = args; - int exception; - int len; - - if (!args) - error_no_arg ("exception number action"); - - while (*scan == ' ' || *scan == '\t') scan++; - - if ('0' <= *scan && *scan <= '9') - while ('0' <= *scan && *scan <= '9') - scan++; - else - error ("exception number action"); - - exception = atoi (args); - if (exception <= 0 || exception > MAX_EXCEPTION) - error ("Allowed exception numbers are in range 1..%d", - MAX_EXCEPTION); - - if (*scan != ' ' && *scan != '\t') - error ("exception number must be followed by a space"); - else - while (*scan == ' ' || *scan == '\t') scan++; - - args = scan; - len = 0; - while (*scan) - { - len++; - scan++; - } - - if (!len) - error("exception number action"); - - if (!strncasecmp (args, "forward", len)) - exception_map[ exception ].forward = TRUE; - else if (!strncasecmp (args, "keep", len)) - exception_map[ exception ].forward = FALSE; - else - error ("exception action is either \"keep\" or \"forward\""); -} - -static void -print_exception_info (exception) - int exception; -{ - boolean_t forward = exception_map[ exception ].forward; - - printf_filtered ("%s\t(%d): ", exception_map[ exception ].name, - exception); - if (!forward) - if (exception_map[ exception ].sigmap != SIG_UNKNOWN) - printf_filtered ("keep and handle as signal %d\n", - exception_map[ exception ].sigmap); - else - printf_filtered ("keep and handle as unknown signal %d\n", - exception_map[ exception ].sigmap); - else - printf_filtered ("forward exception to inferior\n"); -} - -void -exception_info (args, from_tty) - char *args; - int from_tty; -{ - int exception; - - if (!args) - for (exception = 1; exception <= MAX_EXCEPTION; exception++) - print_exception_info (exception); - else - { - exception = atoi (args); - - if (exception <= 0 || exception > MAX_EXCEPTION) - error ("Invalid exception number, values from 1 to %d allowed", - MAX_EXCEPTION); - print_exception_info (exception); - } -} - -/* Check for actions for mach exceptions. - */ -mach3_exception_actions (w, force_print_only, who) - WAITTYPE *w; - boolean_t force_print_only; - char *who; -{ - boolean_t force_print = FALSE; - - - if (force_print_only || - exception_map[stop_exception].sigmap == SIG_UNKNOWN) - force_print = TRUE; - else - WSETSTOP (*w, exception_map[stop_exception].sigmap); - - if (exception_map[stop_exception].print || force_print) - { - target_terminal_ours (); - - printf_filtered ("\n%s received %s exception : ", - who, - exception_map[stop_exception].name); - - wrap_here (" "); - - switch(stop_exception) { - case EXC_BAD_ACCESS: - printf_filtered ("referencing address 0x%x : %s\n", - stop_subcode, - mach_error_string (stop_code)); - break; - case EXC_BAD_INSTRUCTION: - printf_filtered - ("illegal or undefined instruction. code %d subcode %d\n", - stop_code, stop_subcode); - break; - case EXC_ARITHMETIC: - printf_filtered ("code %d\n", stop_code); - break; - case EXC_EMULATION: - printf_filtered ("code %d subcode %d\n", stop_code, stop_subcode); - break; - case EXC_SOFTWARE: - printf_filtered ("%s specific, code 0x%x\n", - stop_code < 0xffff ? "hardware" : "os emulation", - stop_code); - break; - case EXC_BREAKPOINT: - printf_filtered ("type %d (machine dependent)\n", - stop_code); - break; - default: - fatal ("Unknown exception"); - } - } -} - -setup_notify_port (create_new) - int create_new; -{ - kern_return_t ret; - - if (MACH_PORT_VALID (our_notify_port)) - { - ret = mach_port_destroy (mach_task_self (), our_notify_port); - CHK ("Could not destroy our_notify_port", ret); - } - - our_notify_port = MACH_PORT_NULL; - notify_chain = (port_chain_t) NULL; - port_chain_destroy (port_chain_obstack); - - if (create_new) - { - ret = mach_port_allocate (mach_task_self(), - MACH_PORT_RIGHT_RECEIVE, - &our_notify_port); - if (ret != KERN_SUCCESS) - fatal("Creating notify port %s", mach_error_string(ret)); - - ret = mach_port_move_member(mach_task_self(), - our_notify_port, - inferior_wait_port_set); - if (ret != KERN_SUCCESS) - fatal("initial move member %s",mach_error_string(ret)); - } -} - -/* - * Register our message port to the net name server - * - * Currently used only by the external stop-gdb program - * since ^C does not work if you would like to enter - * gdb command level while debugging your program. - * - * NOTE: If the message port is sometimes used for other - * purposes also, the NAME must not be a guessable one. - * Then, there should be a way to change it. - */ - -char registered_name[ MAX_NAME_LEN ]; - -void -message_port_info (args, from_tty) - char *args; - int from_tty; -{ - if (registered_name[0]) - printf_filtered ("gdb's message port name: '%s'\n", - registered_name); - else - printf_filtered ("gdb's message port is not currently registered\n"); -} - -void -gdb_register_port (name, port) - char *name; - mach_port_t port; -{ - kern_return_t ret; - static int already_signed = 0; - int len; - - if (! MACH_PORT_VALID (port) || !name || !*name) - { - warning ("Invalid registration request"); - return; - } - - if (! already_signed) - { - ret = mach_port_insert_right (mach_task_self (), - our_message_port, - our_message_port, - MACH_MSG_TYPE_MAKE_SEND); - CHK ("Failed to create a signature to our_message_port", ret); - already_signed = 1; - } - else if (already_signed > 1) - { - ret = netname_check_out (name_server_port, - registered_name, - our_message_port); - CHK ("Failed to check out gdb's message port", ret); - registered_name[0] = '\000'; - already_signed = 1; - } - - ret = netname_check_in (name_server_port, /* Name server port */ - name, /* Name of service */ - our_message_port, /* Signature */ - port); /* Creates a new send right */ - CHK("Failed to check in the port", ret); - - len = 0; - while(len < MAX_NAME_LEN && *(name+len)) - { - registered_name[len] = *(name+len); - len++; - } - registered_name[len] = '\000'; - already_signed = 2; -} - -struct cmd_list_element *cmd_thread_list; -struct cmd_list_element *cmd_task_list; - -/*ARGSUSED*/ -static void -thread_command (arg, from_tty) - char *arg; - int from_tty; -{ - printf_unfiltered ("\"thread\" must be followed by the name of a thread command.\n"); - help_list (cmd_thread_list, "thread ", -1, gdb_stdout); -} - -/*ARGSUSED*/ -static void -task_command (arg, from_tty) - char *arg; - int from_tty; -{ - printf_unfiltered ("\"task\" must be followed by the name of a task command.\n"); - help_list (cmd_task_list, "task ", -1, gdb_stdout); -} - -add_mach_specific_commands () -{ - /* Thread handling commands */ - - /* FIXME: Move our thread support into the generic thread.c stuff so we - can share that code. */ - add_prefix_cmd ("mthread", class_stack, thread_command, - "Generic command for handling Mach threads in the debugged task.", - &cmd_thread_list, "thread ", 0, &cmdlist); - - add_com_alias ("th", "mthread", class_stack, 1); - - add_cmd ("select", class_stack, thread_select_command, - "Select and print MID of the selected thread", - &cmd_thread_list); - add_cmd ("list", class_stack, thread_list_command, - "List info of task's threads. Selected thread is marked with '*'", - &cmd_thread_list); - add_cmd ("suspend", class_run, thread_suspend_command, - "Suspend one or all of the threads in the selected task.", - &cmd_thread_list); - add_cmd ("resume", class_run, thread_resume_command, - "Resume one or all of the threads in the selected task.", - &cmd_thread_list); - add_cmd ("kill", class_run, thread_kill_command, - "Kill the specified thread MID from inferior task.", - &cmd_thread_list); -#if 0 - /* The rest of this support (condition_thread) was not merged. It probably - should not be merged in this form, but instead added to the generic GDB - thread support. */ - add_cmd ("break", class_breakpoint, condition_thread, - "Breakpoint N will only be effective for thread MID or @SLOT\n\ - If MID/@SLOT is omitted allow all threads to break at breakpoint", - &cmd_thread_list); -#endif - /* Thread command shorthands (for backward compatibility) */ - add_alias_cmd ("ts", "mthread select", 0, 0, &cmdlist); - add_alias_cmd ("tl", "mthread list", 0, 0, &cmdlist); - - /* task handling commands */ - - add_prefix_cmd ("task", class_stack, task_command, - "Generic command for handling debugged task.", - &cmd_task_list, "task ", 0, &cmdlist); - - add_com_alias ("ta", "task", class_stack, 1); - - add_cmd ("suspend", class_run, task_suspend_command, - "Suspend the inferior task.", - &cmd_task_list); - add_cmd ("resume", class_run, task_resume_command, - "Resume the inferior task.", - &cmd_task_list); - add_cmd ("info", no_class, task_info_command, - "Print information about the specified task.", - &cmd_task_list); - - /* Print my message port name */ - - add_info ("message-port", message_port_info, - "Returns the name of gdb's message port in the netnameserver"); - - /* Exception commands */ - - add_info ("exceptions", exception_info, - "What debugger does when program gets various exceptions.\n\ -Specify an exception number as argument to print info on that\n\ -exception only."); - - add_com ("exception", class_run, exception_command, - "Specify how to handle an exception.\n\ -Args are exception number followed by \"forward\" or \"keep\".\n\ -`Forward' means forward the exception to the program's normal exception\n\ -handler.\n\ -`Keep' means reenter debugger if this exception happens, and GDB maps\n\ -the exception to some signal (see info exception)\n\ -Normally \"keep\" is used to return to GDB on exception."); -} - -kern_return_t -do_mach_notify_dead_name (notify, name) - mach_port_t notify; - mach_port_t name; -{ - kern_return_t kr = KERN_SUCCESS; - - /* Find the thing that notified */ - port_chain_t element = port_chain_member (notify_chain, name); - - /* Take name of from unreceived dead name notification list */ - notify_chain = port_chain_delete (notify_chain, name); - - if (! element) - error ("Received a dead name notify from unchained port (0x%x)", name); - - switch (element->type) { - - case MACH_TYPE_THREAD: - target_terminal_ours_for_output (); - if (name == current_thread) - { - printf_filtered ("\nCurrent thread %d died", element->mid); - current_thread = MACH_PORT_NULL; - } - else - printf_filtered ("\nThread %d died", element->mid); - - break; - - case MACH_TYPE_TASK: - target_terminal_ours_for_output (); - if (name != inferior_task) - printf_filtered ("Task %d died, but it was not the selected task", - element->mid); - else - { - printf_filtered ("Current task %d died", element->mid); - - mach_port_destroy (mach_task_self(), name); - inferior_task = MACH_PORT_NULL; - - if (notify_chain) - warning ("There were still unreceived dead_name_notifications???"); - - /* Destroy the old notifications */ - setup_notify_port (0); - - } - break; - - default: - error ("Unregistered dead_name 0x%x notification received. Type is %d, mid is 0x%x", - name, element->type, element->mid); - break; - } - - return KERN_SUCCESS; -} - -kern_return_t -do_mach_notify_msg_accepted (notify, name) - mach_port_t notify; - mach_port_t name; -{ - warning ("do_mach_notify_msg_accepted : notify %x, name %x", - notify, name); - return KERN_SUCCESS; -} - -kern_return_t -do_mach_notify_no_senders (notify, mscount) - mach_port_t notify; - mach_port_mscount_t mscount; -{ - warning ("do_mach_notify_no_senders : notify %x, mscount %x", - notify, mscount); - return KERN_SUCCESS; -} - -kern_return_t -do_mach_notify_port_deleted (notify, name) - mach_port_t notify; - mach_port_t name; -{ - warning ("do_mach_notify_port_deleted : notify %x, name %x", - notify, name); - return KERN_SUCCESS; -} - -kern_return_t -do_mach_notify_port_destroyed (notify, rights) - mach_port_t notify; - mach_port_t rights; -{ - warning ("do_mach_notify_port_destroyed : notify %x, rights %x", - notify, rights); - return KERN_SUCCESS; -} - -kern_return_t -do_mach_notify_send_once (notify) - mach_port_t notify; -{ -#ifdef DUMP_SYSCALL - /* MANY of these are generated. */ - warning ("do_mach_notify_send_once : notify %x", - notify); -#endif - return KERN_SUCCESS; -} - -/* Kills the inferior. It's gone when you call this */ -static void -kill_inferior_fast () -{ - WAITTYPE w; - - if (inferior_pid == 0 || inferior_pid == 1) - return; - - /* kill() it, since the Unix server does not otherwise notice when - * killed with task_terminate(). - */ - if (inferior_pid > 0) - kill (inferior_pid, SIGKILL); - - /* It's propably terminate already */ - (void) task_terminate (inferior_task); - - inferior_task = MACH_PORT_NULL; - current_thread = MACH_PORT_NULL; - - wait3 (&w, WNOHANG, 0); - - setup_notify_port (0); -} - -static void -m3_kill_inferior () -{ - kill_inferior_fast (); - target_mourn_inferior (); -} - -/* Clean up after the inferior dies. */ - -static void -m3_mourn_inferior () -{ - unpush_target (&m3_ops); - generic_mourn_inferior (); -} - - -/* Fork an inferior process, and start debugging it. */ - -static void -m3_create_inferior (exec_file, allargs, env) - char *exec_file; - char *allargs; - char **env; -{ - fork_inferior (exec_file, allargs, env, m3_trace_me, m3_trace_him, NULL); - /* We are at the first instruction we care about. */ - /* Pedal to the metal... */ - proceed ((CORE_ADDR) -1, 0, 0); -} - -/* Mark our target-struct as eligible for stray "run" and "attach" - commands. */ -static int -m3_can_run () -{ - return 1; -} - -/* Mach 3.0 does not need ptrace for anything - * Make sure nobody uses it on mach. - */ -ptrace (a,b,c,d) -int a,b,c,d; -{ - error ("Lose, Lose! Somebody called ptrace\n"); -} - -/* Resume execution of the inferior process. - If STEP is nonzero, single-step it. - If SIGNAL is nonzero, give it that signal. */ - -void -m3_resume (pid, step, signal) - int pid; - int step; - enum target_signal signal; -{ - kern_return_t ret; - - if (step) - { - thread_basic_info_data_t th_info; - unsigned int infoCnt = THREAD_BASIC_INFO_COUNT; - - /* There is no point in single stepping when current_thread - * is dead. - */ - if (! MACH_PORT_VALID (current_thread)) - error ("No thread selected; can not single step"); - - /* If current_thread is suspended, tracing it would never return. - */ - ret = thread_info (current_thread, - THREAD_BASIC_INFO, - (thread_info_t) &th_info, - &infoCnt); - CHK ("child_resume: can't get thread info", ret); - - if (th_info.suspend_count) - error ("Can't trace a suspended thread. Use \"thread resume\" command to resume it"); - } - - vm_read_cache_valid = FALSE; - - if (signal && inferior_pid > 0) /* Do not signal, if attached by MID */ - kill (inferior_pid, target_signal_to_host (signal)); - - if (step) - { - suspend_all_threads (0); - - setup_single_step (current_thread, TRUE); - - ret = thread_resume (current_thread); - CHK ("thread_resume", ret); - } - - ret = task_resume (inferior_task); - if (ret == KERN_FAILURE) - warning ("Task was not suspended"); - else - CHK ("Resuming task", ret); - - /* HACK HACK This is needed by the multiserver system HACK HACK */ - while ((ret = task_resume(inferior_task)) == KERN_SUCCESS) - /* make sure it really runs */; - /* HACK HACK This is needed by the multiserver system HACK HACK */ -} - -#ifdef ATTACH_DETACH - -/* Start debugging the process with the given task */ -void -task_attach (tid) - task_t tid; -{ - kern_return_t ret; - inferior_task = tid; - - ret = task_suspend (inferior_task); - CHK("task_attach: task_suspend", ret); - - must_suspend_thread = 0; - - setup_notify_port (1); - - request_notify (inferior_task, MACH_NOTIFY_DEAD_NAME, MACH_TYPE_TASK); - - setup_exception_port (); - - emulator_present = have_emulator_p (inferior_task); - - attach_flag = 1; -} - -/* Well, we can call error also here and leave the - * target stack inconsistent. Sigh. - * Fix this sometime (the only way to fail here is that - * the task has no threads at all, which is rare, but - * possible; or if the target task has died, which is also - * possible, but unlikely, since it has been suspended. - * (Someone must have killed it)) - */ -void -attach_to_thread () -{ - if (select_thread (inferior_task, 0, 1) != KERN_SUCCESS) - error ("Could not select any threads to attach to"); -} - -mid_attach (mid) - int mid; -{ - kern_return_t ret; - - ret = machid_mach_port (mid_server, mid_auth, mid, &inferior_task); - CHK("mid_attach: machid_mach_port", ret); - - task_attach (inferior_task); - - return mid; -} - -/* - * Start debugging the process whose unix process-id is PID. - * A negative "pid" value is legal and signifies a mach_id not a unix pid. - * - * Prevent (possible unwanted) dangerous operations by enabled users - * like "atta 0" or "atta foo" (equal to the previous :-) and - * "atta pidself". Anyway, the latter is allowed by specifying a MID. - */ -static int -m3_do_attach (pid) - int pid; -{ - kern_return_t ret; - - if (pid == 0) - error("MID=0, Debugging the master unix server does not compute"); - - /* Foo. This assumes gdb has a unix pid */ - if (pid == getpid()) - error ("I will debug myself only by mid. (Gdb would suspend itself!)"); - - if (pid < 0) - { - mid_attach (-(pid)); - - /* inferior_pid will be NEGATIVE! */ - inferior_pid = pid; - - return inferior_pid; - } - - inferior_task = task_by_pid (pid); - if (! MACH_PORT_VALID (inferior_task)) - error("Cannot map Unix pid %d to Mach task port", pid); - - task_attach (inferior_task); - - inferior_pid = pid; - - return inferior_pid; -} - -/* Attach to process PID, then initialize for debugging it - and wait for the trace-trap that results from attaching. */ - -static void -m3_attach (args, from_tty) - char *args; - int from_tty; -{ - char *exec_file; - int pid; - - if (!args) - error_no_arg ("process-id to attach"); - - pid = atoi (args); - - if (pid == getpid()) /* Trying to masturbate? */ - error ("I refuse to debug myself!"); - - if (from_tty) - { - exec_file = (char *) get_exec_file (0); - - if (exec_file) - printf_unfiltered ("Attaching to program `%s', %s\n", exec_file, target_pid_to_str (pid)); - else - printf_unfiltered ("Attaching to %s\n", target_pid_to_str (pid)); - - gdb_flush (gdb_stdout); - } - - m3_do_attach (pid); - inferior_pid = pid; - push_target (&m3_ops); -} - -void -deallocate_inferior_ports () -{ - kern_return_t ret; - thread_array_t thread_list; - int thread_count, index; - - if (!MACH_PORT_VALID (inferior_task)) - return; - - ret = task_threads (inferior_task, &thread_list, &thread_count); - if (ret != KERN_SUCCESS) - { - warning ("deallocate_inferior_ports: task_threads", - mach_error_string(ret)); - return; - } - - /* Get rid of send rights to task threads */ - for (index = 0; index < thread_count; index++) - { - int rights; - ret = mach_port_get_refs (mach_task_self (), - thread_list[index], - MACH_PORT_RIGHT_SEND, - &rights); - CHK("deallocate_inferior_ports: get refs", ret); - - if (rights > 0) - { - ret = mach_port_mod_refs (mach_task_self (), - thread_list[index], - MACH_PORT_RIGHT_SEND, - -rights); - CHK("deallocate_inferior_ports: mod refs", ret); - } - } - - ret = mach_port_mod_refs (mach_task_self (), - inferior_exception_port, - MACH_PORT_RIGHT_RECEIVE, - -1); - CHK ("deallocate_inferior_ports: cannot get rid of exception port", ret); - - ret = mach_port_deallocate (mach_task_self (), - inferior_task); - CHK ("deallocate_task_port: deallocating inferior_task", ret); - - current_thread = MACH_PORT_NULL; - inferior_task = MACH_PORT_NULL; -} - -/* Stop debugging the process whose number is PID - and continue it with signal number SIGNAL. - SIGNAL = 0 means just continue it. */ - -static void -m3_do_detach (signal) - int signal; -{ - kern_return_t ret; - - MACH_ERROR_NO_INFERIOR; - - if (current_thread != MACH_PORT_NULL) - { - /* Store the gdb's view of the thread we are deselecting - * before we detach. - * @@ I am really not sure if this is ever needeed. - */ - target_prepare_to_store (); - target_store_registers (-1); - } - - ret = task_set_special_port (inferior_task, - TASK_EXCEPTION_PORT, - inferior_old_exception_port); - CHK ("task_set_special_port", ret); - - /* Discard all requested notifications */ - setup_notify_port (0); - - if (remove_breakpoints ()) - warning ("Could not remove breakpoints when detaching"); - - if (signal && inferior_pid > 0) - kill (inferior_pid, signal); - - /* the task might be dead by now */ - (void) task_resume (inferior_task); - - deallocate_inferior_ports (); - - attach_flag = 0; -} - -/* Take a program previously attached to and detaches it. - The program resumes execution and will no longer stop - on signals, etc. We'd better not have left any breakpoints - in the program or it'll die when it hits one. For this - to work, it may be necessary for the process to have been - previously attached. It *might* work if the program was - started via fork. */ - -static void -m3_detach (args, from_tty) - char *args; - int from_tty; -{ - int siggnal = 0; - - if (from_tty) - { - char *exec_file = get_exec_file (0); - if (exec_file == 0) - exec_file = ""; - printf_unfiltered ("Detaching from program: %s %s\n", - exec_file, target_pid_to_str (inferior_pid)); - gdb_flush (gdb_stdout); - } - if (args) - siggnal = atoi (args); - - m3_do_detach (siggnal); - inferior_pid = 0; - unpush_target (&m3_ops); /* Pop out of handling an inferior */ -} -#endif /* ATTACH_DETACH */ - -/* Get ready to modify the registers array. On machines which store - individual registers, this doesn't need to do anything. On machines - which store all the registers in one fell swoop, this makes sure - that registers contains all the registers from the program being - debugged. */ - -static void -m3_prepare_to_store () -{ -#ifdef CHILD_PREPARE_TO_STORE - CHILD_PREPARE_TO_STORE (); -#endif -} - -/* Print status information about what we're accessing. */ - -static void -m3_files_info (ignore) - struct target_ops *ignore; -{ - /* FIXME: should print MID and all that crap. */ - printf_unfiltered ("\tUsing the running image of %s %s.\n", - attach_flag? "attached": "child", target_pid_to_str (inferior_pid)); -} - -static void -m3_open (arg, from_tty) - char *arg; - int from_tty; -{ - error ("Use the \"run\" command to start a Unix child process."); -} - -#ifdef DUMP_SYSCALL -#ifdef __STDC__ -#define STR(x) #x -#else -#define STR(x) "x" -#endif - -char *bsd1_names[] = { - "execve", - "fork", - "take_signal", - "sigreturn", - "getrusage", - "chdir", - "chroot", - "open", - "creat", - "mknod", - "link", - "symlink", - "unlink", - "access", - "stat", - "readlink", - "chmod", - "chown", - "utimes", - "truncate", - "rename", - "mkdir", - "rmdir", - "xutimes", - "mount", - "umount", - "acct", - "setquota", - "write_short", - "write_long", - "send_short", - "send_long", - "sendto_short", - "sendto_long", - "select", - "task_by_pid", - "recvfrom_short", - "recvfrom_long", - "setgroups", - "setrlimit", - "sigvec", - "sigstack", - "settimeofday", - "adjtime", - "setitimer", - "sethostname", - "bind", - "accept", - "connect", - "setsockopt", - "getsockopt", - "getsockname", - "getpeername", - "init_process", - "table_set", - "table_get", - "pioctl", - "emulator_error", - "readwrite", - "share_wakeup", - 0, - "maprw_request_it", - "maprw_release_it", - "maprw_remap", - "pid_by_task", -}; - -int bsd1_nnames = sizeof(bsd1_names)/sizeof(bsd1_names[0]); - -char* -name_str(name,buf) - -int name; -char *buf; - -{ - switch (name) { - case MACH_MSG_TYPE_BOOLEAN: - return "boolean"; - case MACH_MSG_TYPE_INTEGER_16: - return "short"; - case MACH_MSG_TYPE_INTEGER_32: - return "long"; - case MACH_MSG_TYPE_CHAR: - return "char"; - case MACH_MSG_TYPE_BYTE: - return "byte"; - case MACH_MSG_TYPE_REAL: - return "real"; - case MACH_MSG_TYPE_STRING: - return "string"; - default: - sprintf(buf,"%d",name); - return buf; - } -} - -char * -id_str(id,buf) - -int id; -char *buf; - -{ - char *p; - if (id >= 101000 && id < 101000+bsd1_nnames) { - if (p = bsd1_names[id-101000]) - return p; - } - if (id == 102000) - return "psignal_retry"; - if (id == 100000) - return "syscall"; - sprintf(buf,"%d",id); - return buf; -} - -print_msg(mp) -mach_msg_header_t *mp; -{ - char *fmt_x = "%20s : 0x%08x\n"; - char *fmt_d = "%20s : %10d\n"; - char *fmt_s = "%20s : %s\n"; - char buf[100]; - - puts_filtered ("\n"); -#define pr(fmt,h,x) printf_filtered(fmt,STR(x),(h).x) - pr(fmt_x,(*mp),msgh_bits); - pr(fmt_d,(*mp),msgh_size); - pr(fmt_x,(*mp),msgh_remote_port); - pr(fmt_x,(*mp),msgh_local_port); - pr(fmt_d,(*mp),msgh_kind); - printf_filtered(fmt_s,STR(msgh_id),id_str(mp->msgh_id,buf)); - - if (debug_level > 1) - { - char *p,*ep,*dp; - int plen; - p = (char*)mp; - ep = p+mp->msgh_size; - p += sizeof(*mp); - for(; p < ep; p += plen) { - mach_msg_type_t *tp; - mach_msg_type_long_t *tlp; - int name,size,number; - tp = (mach_msg_type_t*)p; - if (tp->msgt_longform) { - tlp = (mach_msg_type_long_t*)tp; - name = tlp->msgtl_name; - size = tlp->msgtl_size; - number = tlp->msgtl_number; - plen = sizeof(*tlp); - } else { - name = tp->msgt_name; - size = tp->msgt_size; - number = tp->msgt_number; - plen = sizeof(*tp); - } - printf_filtered("name=%-16s size=%2d number=%7d inline=%d long=%d deal=%d\n", - name_str(name,buf),size,number,tp->msgt_inline, - tp->msgt_longform, tp->msgt_deallocate); - dp = p+plen; - if (tp->msgt_inline) { - int l; - l = size*number/8; - l = (l+sizeof(long)-1)&~((sizeof(long))-1); - plen += l; - print_data(dp,size,number); - } else { - plen += sizeof(int*); - } - printf_filtered("plen=%d\n",plen); - } - } -} - -print_data(p,size,number) - -char *p; - -{ - int *ip; - short *sp; - int i; - - switch (size) { - case 8: - for(i = 0; i < number; i++) { - printf_filtered(" %02x",p[i]); - } - break; - case 16: - sp = (short*)p; - for(i = 0; i < number; i++) { - printf_filtered(" %04x",sp[i]); - } - break; - case 32: - ip = (int*)p; - for(i = 0; i < number; i++) { - printf_filtered(" %08x",ip[i]); - } - break; - } - puts_filtered("\n"); -} -#endif DUMP_SYSCALL - -static void -m3_stop () -{ - error ("to_stop target function not implemented"); -} - -struct target_ops m3_ops = { - "mach", /* to_shortname */ - "Mach child process", /* to_longname */ - "Mach child process (started by the \"run\" command).", /* to_doc */ - m3_open, /* to_open */ - 0, /* to_close */ - m3_attach, /* to_attach */ - m3_detach, /* to_detach */ - m3_resume, /* to_resume */ - mach_really_wait, /* to_wait */ - fetch_inferior_registers, /* to_fetch_registers */ - store_inferior_registers, /* to_store_registers */ - m3_prepare_to_store, /* to_prepare_to_store */ - m3_xfer_memory, /* to_xfer_memory */ - m3_files_info, /* to_files_info */ - memory_insert_breakpoint, /* to_insert_breakpoint */ - memory_remove_breakpoint, /* to_remove_breakpoint */ - terminal_init_inferior, /* to_terminal_init */ - terminal_inferior, /* to_terminal_inferior */ - terminal_ours_for_output, /* to_terminal_ours_for_output */ - terminal_ours, /* to_terminal_ours */ - child_terminal_info, /* to_terminal_info */ - m3_kill_inferior, /* to_kill */ - 0, /* to_load */ - 0, /* to_lookup_symbol */ - - m3_create_inferior, /* to_create_inferior */ - m3_mourn_inferior, /* to_mourn_inferior */ - m3_can_run, /* to_can_run */ - 0, /* to_notice_signals */ - 0, /* to_thread_alive */ - m3_stop, /* to_stop */ - process_stratum, /* to_stratum */ - 0, /* to_next */ - 1, /* to_has_all_memory */ - 1, /* to_has_memory */ - 1, /* to_has_stack */ - 1, /* to_has_registers */ - 1, /* to_has_execution */ - 0, /* sections */ - 0, /* sections_end */ - OPS_MAGIC /* to_magic */ -}; - -void -_initialize_m3_nat () -{ - kern_return_t ret; - - add_target (&m3_ops); - - ret = mach_port_allocate(mach_task_self(), - MACH_PORT_RIGHT_PORT_SET, - &inferior_wait_port_set); - if (ret != KERN_SUCCESS) - fatal("initial port set %s",mach_error_string(ret)); - - /* mach_really_wait now waits for this */ - currently_waiting_for = inferior_wait_port_set; - - ret = netname_look_up(name_server_port, hostname, "MachID", &mid_server); - if (ret != KERN_SUCCESS) - { - mid_server = MACH_PORT_NULL; - - warning ("initialize machid: netname_lookup_up(MachID) : %s", - mach_error_string(ret)); - warning ("Some (most?) features disabled..."); - } - - mid_auth = mach_privileged_host_port(); - if (mid_auth == MACH_PORT_NULL) - mid_auth = mach_task_self(); - - obstack_init (port_chain_obstack); - - ret = mach_port_allocate (mach_task_self (), - MACH_PORT_RIGHT_RECEIVE, - &thread_exception_port); - CHK ("Creating thread_exception_port for single stepping", ret); - - ret = mach_port_insert_right (mach_task_self (), - thread_exception_port, - thread_exception_port, - MACH_MSG_TYPE_MAKE_SEND); - CHK ("Inserting send right to thread_exception_port", ret); - - /* Allocate message port */ - ret = mach_port_allocate (mach_task_self (), - MACH_PORT_RIGHT_RECEIVE, - &our_message_port); - if (ret != KERN_SUCCESS) - warning ("Creating message port %s", mach_error_string (ret)); - else - { - char buf[ MAX_NAME_LEN ]; - ret = mach_port_move_member(mach_task_self (), - our_message_port, - inferior_wait_port_set); - if (ret != KERN_SUCCESS) - warning ("message move member %s", mach_error_string (ret)); - - - /* @@@@ No way to change message port name currently */ - /* Foo. This assumes gdb has a unix pid */ - sprintf (buf, "gdb-%d", getpid ()); - gdb_register_port (buf, our_message_port); - } - - /* Heap for thread commands */ - obstack_init (cproc_obstack); - - add_mach_specific_commands (); -} diff --git a/contrib/gdb/gdb/m68k-stub.c b/contrib/gdb/gdb/m68k-stub.c deleted file mode 100644 index 009cba3..0000000 --- a/contrib/gdb/gdb/m68k-stub.c +++ /dev/null @@ -1,1014 +0,0 @@ -/**************************************************************************** - - THIS SOFTWARE IS NOT COPYRIGHTED - - HP offers the following for use in the public domain. HP makes no - warranty with regard to the software or it's performance and the - user accepts the software "AS IS" with all faults. - - HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD - TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - -****************************************************************************/ - -/**************************************************************************** - * Header: remcom.c,v 1.34 91/03/09 12:29:49 glenne Exp $ - * - * Module name: remcom.c $ - * Revision: 1.34 $ - * Date: 91/03/09 12:29:49 $ - * Contributor: Lake Stevens Instrument Division$ - * - * Description: low level support for gdb debugger. $ - * - * Considerations: only works on target hardware $ - * - * Written by: Glenn Engel $ - * ModuleState: Experimental $ - * - * NOTES: See Below $ - * - * To enable debugger support, two things need to happen. One, a - * call to set_debug_traps() is necessary in order to allow any breakpoints - * or error conditions to be properly intercepted and reported to gdb. - * Two, a breakpoint needs to be generated to begin communication. This - * is most easily accomplished by a call to breakpoint(). Breakpoint() - * simulates a breakpoint by executing a trap #1. The breakpoint instruction - * is hardwired to trap #1 because not to do so is a compatibility problem-- - * there either should be a standard breakpoint instruction, or the protocol - * should be extended to provide some means to communicate which breakpoint - * instruction is in use (or have the stub insert the breakpoint). - * - * Some explanation is probably necessary to explain how exceptions are - * handled. When an exception is encountered the 68000 pushes the current - * program counter and status register onto the supervisor stack and then - * transfers execution to a location specified in it's vector table. - * The handlers for the exception vectors are hardwired to jmp to an address - * given by the relation: (exception - 256) * 6. These are decending - * addresses starting from -6, -12, -18, ... By allowing 6 bytes for - * each entry, a jsr, jmp, bsr, ... can be used to enter the exception - * handler. Using a jsr to handle an exception has an added benefit of - * allowing a single handler to service several exceptions and use the - * return address as the key differentiation. The vector number can be - * computed from the return address by [ exception = (addr + 1530) / 6 ]. - * The sole purpose of the routine _catchException is to compute the - * exception number and push it on the stack in place of the return address. - * The external function exceptionHandler() is - * used to attach a specific handler to a specific m68k exception. - * For 68020 machines, the ability to have a return address around just - * so the vector can be determined is not necessary because the '020 pushes an - * extra word onto the stack containing the vector offset - * - * Because gdb will sometimes write to the stack area to execute function - * calls, this program cannot rely on using the supervisor stack so it - * uses it's own stack area reserved in the int array remcomStack. - * - ************* - * - * The following gdb commands are supported: - * - * command function Return value - * - * g return the value of the CPU registers hex data or ENN - * G set the value of the CPU registers OK or ENN - * - * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN - * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN - * - * c Resume at current address SNN ( signal NN) - * cAA..AA Continue at address AA..AA SNN - * - * s Step one instruction SNN - * sAA..AA Step one instruction from AA..AA SNN - * - * k kill - * - * ? What was the last sigval ? SNN (signal NN) - * - * All commands and responses are sent with a packet which includes a - * checksum. A packet consists of - * - * $#. - * - * where - * :: - * :: < two hex digits computed as modulo 256 sum of > - * - * When a packet is received, it is first acknowledged with either '+' or '-'. - * '+' indicates a successful transfer. '-' indicates a failed transfer. - * - * Example: - * - * Host: Reply: - * $m0,10#2a +$00010203040506070809101112131415#42 - * - ****************************************************************************/ - -#include -#include -#include - -/************************************************************************ - * - * external low-level support routines - */ -typedef void (*ExceptionHook)(int); /* pointer to function with int parm */ -typedef void (*Function)(); /* pointer to a function */ - -extern putDebugChar(); /* write a single character */ -extern getDebugChar(); /* read and return a single char */ - -extern Function exceptionHandler(); /* assign an exception handler */ -extern ExceptionHook exceptionHook; /* hook variable for errors/exceptions */ - -/************************/ -/* FORWARD DECLARATIONS */ -/************************/ -static void -initializeRemcomErrorFrame (); - -/************************************************************************/ -/* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/ -/* at least NUMREGBYTES*2 are needed for register packets */ -#define BUFMAX 400 - -static char initialized; /* boolean flag. != 0 means we've been initialized */ - -int remote_debug; -/* debug > 0 prints ill-formed commands in valid packets & checksum errors */ - -static const char hexchars[]="0123456789abcdef"; - -/* there are 180 bytes of registers on a 68020 w/68881 */ -/* many of the fpa registers are 12 byte (96 bit) registers */ -#define NUMREGBYTES 180 -enum regnames {D0,D1,D2,D3,D4,D5,D6,D7, - A0,A1,A2,A3,A4,A5,A6,A7, - PS,PC, - FP0,FP1,FP2,FP3,FP4,FP5,FP6,FP7, - FPCONTROL,FPSTATUS,FPIADDR - }; - - -/* We keep a whole frame cache here. "Why?", I hear you cry, "doesn't - GDB handle that sort of thing?" Well, yes, I believe the only - reason for this cache is to save and restore floating point state - (fsave/frestore). A cleaner way to do this would be to make the - fsave data part of the registers which GDB deals with like any - other registers. This should not be a performance problem if the - ability to read individual registers is added to the protocol. */ - -typedef struct FrameStruct -{ - struct FrameStruct *previous; - int exceptionPC; /* pc value when this frame created */ - int exceptionVector; /* cpu vector causing exception */ - short frameSize; /* size of cpu frame in words */ - short sr; /* for 68000, this not always sr */ - int pc; - short format; - int fsaveHeader; - int morejunk[0]; /* exception frame, fp save... */ -} Frame; - -#define FRAMESIZE 500 -int gdbFrameStack[FRAMESIZE]; -static Frame *lastFrame; - -/* - * these should not be static cuz they can be used outside this module - */ -int registers[NUMREGBYTES/4]; -int superStack; - -#define STACKSIZE 10000 -int remcomStack[STACKSIZE/sizeof(int)]; -static int* stackPtr = &remcomStack[STACKSIZE/sizeof(int) - 1]; - -/* - * In many cases, the system will want to continue exception processing - * when a continue command is given. - * oldExceptionHook is a function to invoke in this case. - */ - -static ExceptionHook oldExceptionHook; - -#ifdef mc68020 -/* the size of the exception stack on the 68020 varies with the type of - * exception. The following table is the number of WORDS used - * for each exception format. - */ -const short exceptionSize[] = { 4,4,6,4,4,4,4,4,29,10,16,46,12,4,4,4 }; -#endif - -#ifdef mc68332 -static const short exceptionSize[] = { 4,4,6,4,4,4,4,4,4,4,4,4,16,4,4,4 }; -#endif - -/************* jump buffer used for setjmp/longjmp **************************/ -jmp_buf remcomEnv; - -/*************************** ASSEMBLY CODE MACROS *************************/ -/* */ - -#ifdef __HAVE_68881__ -/* do an fsave, then remember the address to begin a restore from */ -#define SAVE_FP_REGS() asm(" fsave a0@-"); \ - asm(" fmovemx fp0-fp7,_registers+72"); \ - asm(" fmoveml fpcr/fpsr/fpi,_registers+168"); -#define RESTORE_FP_REGS() \ -asm(" \n\ - fmoveml _registers+168,fpcr/fpsr/fpi \n\ - fmovemx _registers+72,fp0-fp7 \n\ - cmpl #-1,a0@ | skip frestore flag set ? \n\ - beq skip_frestore \n\ - frestore a0@+ \n\ -skip_frestore: \n\ -"); - -#else -#define SAVE_FP_REGS() -#define RESTORE_FP_REGS() -#endif /* __HAVE_68881__ */ - -void return_to_super(); -void return_to_user(); - -asm(" -.text -.globl _return_to_super -_return_to_super: - movel _registers+60,sp /* get new stack pointer */ - movel _lastFrame,a0 /* get last frame info */ - bra return_to_any - -.globl _return_to_user -_return_to_user: - movel _registers+60,a0 /* get usp */ - movel a0,usp /* set usp */ - movel _superStack,sp /* get original stack pointer */ - -return_to_any: - movel _lastFrame,a0 /* get last frame info */ - movel a0@+,_lastFrame /* link in previous frame */ - addql #8,a0 /* skip over pc, vector#*/ - movew a0@+,d0 /* get # of words in cpu frame */ - addw d0,a0 /* point to end of data */ - addw d0,a0 /* point to end of data */ - movel a0,a1 -# -# copy the stack frame - subql #1,d0 -copyUserLoop: - movew a1@-,sp@- - dbf d0,copyUserLoop -"); - RESTORE_FP_REGS() - asm(" moveml _registers,d0-d7/a0-a6"); - asm(" rte"); /* pop and go! */ - -#define DISABLE_INTERRUPTS() asm(" oriw #0x0700,sr"); -#define BREAKPOINT() asm(" trap #1"); - -/* this function is called immediately when a level 7 interrupt occurs */ -/* if the previous interrupt level was 7 then we're already servicing */ -/* this interrupt and an rte is in order to return to the debugger. */ -/* For the 68000, the offset for sr is 6 due to the jsr return address */ -asm(" -.text -.globl __debug_level7 -__debug_level7: - movew d0,sp@-"); -#if defined (mc68020) || defined (mc68332) -asm(" movew sp@(2),d0"); -#else -asm(" movew sp@(6),d0"); -#endif -asm(" andiw #0x700,d0 - cmpiw #0x700,d0 - beq _already7 - movew sp@+,d0 - bra __catchException -_already7: - movew sp@+,d0"); -#if !defined (mc68020) && !defined (mc68332) -asm(" lea sp@(4),sp"); /* pull off 68000 return address */ -#endif -asm(" rte"); - -extern void _catchException (); - -#if defined (mc68020) || defined (mc68332) -/* This function is called when a 68020 exception occurs. It saves - * all the cpu and fpcp regs in the _registers array, creates a frame on a - * linked list of frames which has the cpu and fpcp stack frames needed - * to properly restore the context of these processors, and invokes - * an exception handler (remcom_handler). - * - * stack on entry: stack on exit: - * N bytes of junk exception # MSWord - * Exception Format Word exception # MSWord - * Program counter LSWord - * Program counter MSWord - * Status Register - * - * - */ -asm(" -.text -.globl __catchException -__catchException:"); -DISABLE_INTERRUPTS(); -asm(" - moveml d0-d7/a0-a6,_registers /* save registers */ - movel _lastFrame,a0 /* last frame pointer */ -"); -SAVE_FP_REGS(); -asm(" - lea _registers,a5 /* get address of registers */ - movew sp@,d1 /* get status register */ - movew d1,a5@(66) /* save sr */ - movel sp@(2),a4 /* save pc in a4 for later use */ - movel a4,a5@(68) /* save pc in _regisers[] */ - -# -# figure out how many bytes in the stack frame - movew sp@(6),d0 /* get '020 exception format */ - movew d0,d2 /* make a copy of format word */ - andiw #0xf000,d0 /* mask off format type */ - rolw #5,d0 /* rotate into the low byte *2 */ - lea _exceptionSize,a1 - addw d0,a1 /* index into the table */ - movew a1@,d0 /* get number of words in frame */ - movew d0,d3 /* save it */ - subw d0,a0 /* adjust save pointer */ - subw d0,a0 /* adjust save pointer(bytes) */ - movel a0,a1 /* copy save pointer */ - subql #1,d0 /* predecrement loop counter */ -# -# copy the frame -saveFrameLoop: - movew sp@+,a1@+ - dbf d0,saveFrameLoop -# -# now that the stack has been clenaed, -# save the a7 in use at time of exception - movel sp,_superStack /* save supervisor sp */ - andiw #0x2000,d1 /* were we in supervisor mode ? */ - beq userMode - movel a7,a5@(60) /* save a7 */ - bra a7saveDone -userMode: - movel usp,a1 - movel a1,a5@(60) /* save user stack pointer */ -a7saveDone: - -# -# save size of frame - movew d3,a0@- - -# -# compute exception number - andl #0xfff,d2 /* mask off vector offset */ - lsrw #2,d2 /* divide by 4 to get vect num */ - movel d2,a0@- /* save it */ -# -# save pc causing exception - movel a4,a0@- -# -# save old frame link and set the new value - movel _lastFrame,a1 /* last frame pointer */ - movel a1,a0@- /* save pointer to prev frame */ - movel a0,_lastFrame - - movel d2,sp@- /* push exception num */ - movel _exceptionHook,a0 /* get address of handler */ - jbsr a0@ /* and call it */ - clrl sp@ /* replace exception num parm with frame ptr */ - jbsr __returnFromException /* jbsr, but never returns */ -"); -#else /* mc68000 */ -/* This function is called when an exception occurs. It translates the - * return address found on the stack into an exception vector # which - * is then handled by either handle_exception or a system handler. - * _catchException provides a front end for both. - * - * stack on entry: stack on exit: - * Program counter MSWord exception # MSWord - * Program counter LSWord exception # MSWord - * Status Register - * Return Address MSWord - * Return Address LSWord - */ -asm(" -.text -.globl __catchException -__catchException:"); -DISABLE_INTERRUPTS(); -asm(" - moveml d0-d7/a0-a6,_registers /* save registers */ - movel _lastFrame,a0 /* last frame pointer */ -"); -SAVE_FP_REGS(); -asm(" - lea _registers,a5 /* get address of registers */ - movel sp@+,d2 /* pop return address */ - addl #1530,d2 /* convert return addr to */ - divs #6,d2 /* exception number */ - extl d2 - - moveql #3,d3 /* assume a three word frame */ - - cmpiw #3,d2 /* bus error or address error ? */ - bgt normal /* if >3 then normal error */ - movel sp@+,a0@- /* copy error info to frame buff*/ - movel sp@+,a0@- /* these are never used */ - moveql #7,d3 /* this is a 7 word frame */ - -normal: - movew sp@+,d1 /* pop status register */ - movel sp@+,a4 /* pop program counter */ - movew d1,a5@(66) /* save sr */ - movel a4,a5@(68) /* save pc in _regisers[] */ - movel a4,a0@- /* copy pc to frame buffer */ - movew d1,a0@- /* copy sr to frame buffer */ - - movel sp,_superStack /* save supervisor sp */ - - andiw #0x2000,d1 /* were we in supervisor mode ? */ - beq userMode - movel a7,a5@(60) /* save a7 */ - bra saveDone -userMode: - movel usp,a1 /* save user stack pointer */ - movel a1,a5@(60) /* save user stack pointer */ -saveDone: - - movew d3,a0@- /* push frame size in words */ - movel d2,a0@- /* push vector number */ - movel a4,a0@- /* push exception pc */ - -# -# save old frame link and set the new value - movel _lastFrame,a1 /* last frame pointer */ - movel a1,a0@- /* save pointer to prev frame */ - movel a0,_lastFrame - - movel d2,sp@- /* push exception num */ - movel _exceptionHook,a0 /* get address of handler */ - jbsr a0@ /* and call it */ - clrl sp@ /* replace exception num parm with frame ptr */ - jbsr __returnFromException /* jbsr, but never returns */ -"); -#endif - - -/* - * remcomHandler is a front end for handle_exception. It moves the - * stack pointer into an area reserved for debugger use in case the - * breakpoint happened in supervisor mode. - */ -asm("_remcomHandler:"); -asm(" addl #4,sp"); /* pop off return address */ -asm(" movel sp@+,d0"); /* get the exception number */ -asm(" movel _stackPtr,sp"); /* move to remcom stack area */ -asm(" movel d0,sp@-"); /* push exception onto stack */ -asm(" jbsr _handle_exception"); /* this never returns */ -asm(" rts"); /* return */ - -void _returnFromException( Frame *frame ) -{ - /* if no passed in frame, use the last one */ - if (! frame) - { - frame = lastFrame; - frame->frameSize = 4; - frame->format = 0; - frame->fsaveHeader = -1; /* restore regs, but we dont have fsave info*/ - } - -#if !defined (mc68020) && !defined (mc68332) - /* a 68000 cannot use the internal info pushed onto a bus error - * or address error frame when doing an RTE so don't put this info - * onto the stack or the stack will creep every time this happens. - */ - frame->frameSize=3; -#endif - - /* throw away any frames in the list after this frame */ - lastFrame = frame; - - frame->sr = registers[(int) PS]; - frame->pc = registers[(int) PC]; - - if (registers[(int) PS] & 0x2000) - { - /* return to supervisor mode... */ - return_to_super(); - } - else - { /* return to user mode */ - return_to_user(); - } -} - -int hex(ch) -char ch; -{ - if ((ch >= 'a') && (ch <= 'f')) return (ch-'a'+10); - if ((ch >= '0') && (ch <= '9')) return (ch-'0'); - if ((ch >= 'A') && (ch <= 'F')) return (ch-'A'+10); - return (-1); -} - - -/* scan for the sequence $# */ -void getpacket(buffer) -char * buffer; -{ - unsigned char checksum; - unsigned char xmitcsum; - int i; - int count; - char ch; - - do { - /* wait around for the start character, ignore all other characters */ - while ((ch = (getDebugChar() & 0x7f)) != '$'); - checksum = 0; - xmitcsum = -1; - - count = 0; - - /* now, read until a # or end of buffer is found */ - while (count < BUFMAX) { - ch = getDebugChar() & 0x7f; - if (ch == '#') break; - checksum = checksum + ch; - buffer[count] = ch; - count = count + 1; - } - buffer[count] = 0; - - if (ch == '#') { - xmitcsum = hex(getDebugChar() & 0x7f) << 4; - xmitcsum += hex(getDebugChar() & 0x7f); - if ((remote_debug ) && (checksum != xmitcsum)) { - fprintf (stderr,"bad checksum. My count = 0x%x, sent=0x%x. buf=%s\n", - checksum,xmitcsum,buffer); - } - - if (checksum != xmitcsum) putDebugChar('-'); /* failed checksum */ - else { - putDebugChar('+'); /* successful transfer */ - /* if a sequence char is present, reply the sequence ID */ - if (buffer[2] == ':') { - putDebugChar( buffer[0] ); - putDebugChar( buffer[1] ); - /* remove sequence chars from buffer */ - count = strlen(buffer); - for (i=3; i <= count; i++) buffer[i-3] = buffer[i]; - } - } - } - } while (checksum != xmitcsum); - -} - -/* send the packet in buffer. The host get's one chance to read it. - This routine does not wait for a positive acknowledge. */ - - -void putpacket(buffer) -char * buffer; -{ - unsigned char checksum; - int count; - char ch; - - /* $#. */ - do { - putDebugChar('$'); - checksum = 0; - count = 0; - - while (ch=buffer[count]) { - if (! putDebugChar(ch)) return; - checksum += ch; - count += 1; - } - - putDebugChar('#'); - putDebugChar(hexchars[checksum >> 4]); - putDebugChar(hexchars[checksum % 16]); - - } while (1 == 0); /* (getDebugChar() != '+'); */ - -} - -char remcomInBuffer[BUFMAX]; -char remcomOutBuffer[BUFMAX]; -static short error; - - -void debug_error(format, parm) -char * format; -char * parm; -{ - if (remote_debug) fprintf (stderr,format,parm); -} - -/* convert the memory pointed to by mem into hex, placing result in buf */ -/* return a pointer to the last char put in buf (null) */ -char* mem2hex(mem, buf, count) -char* mem; -char* buf; -int count; -{ - int i; - unsigned char ch; - for (i=0;i> 4]; - *buf++ = hexchars[ch % 16]; - } - *buf = 0; - return(buf); -} - -/* convert the hex array pointed to by buf into binary to be placed in mem */ -/* return a pointer to the character AFTER the last byte written */ -char* hex2mem(buf, mem, count) -char* buf; -char* mem; -int count; -{ - int i; - unsigned char ch; - for (i=0;i=0) - { - *intValue = (*intValue <<4) | hexValue; - numChars ++; - } - else - break; - - (*ptr)++; - } - - return (numChars); -} - -/* - * This function does all command procesing for interfacing to gdb. - */ -void handle_exception(int exceptionVector) -{ - int sigval; - int addr, length; - char * ptr; - int newPC; - Frame *frame; - - if (remote_debug) printf("vector=%d, sr=0x%x, pc=0x%x\n", - exceptionVector, - registers[ PS ], - registers[ PC ]); - - /* reply to host that an exception has occurred */ - sigval = computeSignal( exceptionVector ); - remcomOutBuffer[0] = 'S'; - remcomOutBuffer[1] = hexchars[sigval >> 4]; - remcomOutBuffer[2] = hexchars[sigval % 16]; - remcomOutBuffer[3] = 0; - - putpacket(remcomOutBuffer); - - while (1==1) { - error = 0; - remcomOutBuffer[0] = 0; - getpacket(remcomInBuffer); - switch (remcomInBuffer[0]) { - case '?' : remcomOutBuffer[0] = 'S'; - remcomOutBuffer[1] = hexchars[sigval >> 4]; - remcomOutBuffer[2] = hexchars[sigval % 16]; - remcomOutBuffer[3] = 0; - break; - case 'd' : remote_debug = !(remote_debug); /* toggle debug flag */ - break; - case 'g' : /* return the value of the CPU registers */ - mem2hex((char*) registers, remcomOutBuffer, NUMREGBYTES); - break; - case 'G' : /* set the value of the CPU registers - return OK */ - hex2mem(&remcomInBuffer[1], (char*) registers, NUMREGBYTES); - strcpy(remcomOutBuffer,"OK"); - break; - - /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */ - case 'm' : - if (setjmp(remcomEnv) == 0) - { - exceptionHandler(2,handle_buserror); - - /* TRY TO READ %x,%x. IF SUCCEED, SET PTR = 0 */ - ptr = &remcomInBuffer[1]; - if (hexToInt(&ptr,&addr)) - if (*(ptr++) == ',') - if (hexToInt(&ptr,&length)) - { - ptr = 0; - mem2hex((char*) addr, remcomOutBuffer, length); - } - - if (ptr) - { - strcpy(remcomOutBuffer,"E01"); - debug_error("malformed read memory command: %s",remcomInBuffer); - } - } - else { - exceptionHandler(2,_catchException); - strcpy(remcomOutBuffer,"E03"); - debug_error("bus error"); - } - - /* restore handler for bus error */ - exceptionHandler(2,_catchException); - break; - - /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */ - case 'M' : - if (setjmp(remcomEnv) == 0) { - exceptionHandler(2,handle_buserror); - - /* TRY TO READ '%x,%x:'. IF SUCCEED, SET PTR = 0 */ - ptr = &remcomInBuffer[1]; - if (hexToInt(&ptr,&addr)) - if (*(ptr++) == ',') - if (hexToInt(&ptr,&length)) - if (*(ptr++) == ':') - { - hex2mem(ptr, (char*) addr, length); - ptr = 0; - strcpy(remcomOutBuffer,"OK"); - } - if (ptr) - { - strcpy(remcomOutBuffer,"E02"); - debug_error("malformed write memory command: %s",remcomInBuffer); - } - } - else { - exceptionHandler(2,_catchException); - strcpy(remcomOutBuffer,"E03"); - debug_error("bus error"); - } - - /* restore handler for bus error */ - exceptionHandler(2,_catchException); - break; - - /* cAA..AA Continue at address AA..AA(optional) */ - /* sAA..AA Step one instruction from AA..AA(optional) */ - case 'c' : - case 's' : - /* try to read optional parameter, pc unchanged if no parm */ - ptr = &remcomInBuffer[1]; - if (hexToInt(&ptr,&addr)) - registers[ PC ] = addr; - - newPC = registers[ PC]; - - /* clear the trace bit */ - registers[ PS ] &= 0x7fff; - - /* set the trace bit if we're stepping */ - if (remcomInBuffer[0] == 's') registers[ PS ] |= 0x8000; - - /* - * look for newPC in the linked list of exception frames. - * if it is found, use the old frame it. otherwise, - * fake up a dummy frame in returnFromException(). - */ - if (remote_debug) printf("new pc = 0x%x\n",newPC); - frame = lastFrame; - while (frame) - { - if (remote_debug) - printf("frame at 0x%x has pc=0x%x, except#=%d\n", - frame,frame->exceptionPC, - frame->exceptionVector); - if (frame->exceptionPC == newPC) break; /* bingo! a match */ - /* - * for a breakpoint instruction, the saved pc may - * be off by two due to re-executing the instruction - * replaced by the trap instruction. Check for this. - */ - if ((frame->exceptionVector == 33) && - (frame->exceptionPC == (newPC+2))) break; - if (frame == frame->previous) - { - frame = 0; /* no match found */ - break; - } - frame = frame->previous; - } - - /* - * If we found a match for the PC AND we are not returning - * as a result of a breakpoint (33), - * trace exception (9), nmi (31), jmp to - * the old exception handler as if this code never ran. - */ - if (frame) - { - if ((frame->exceptionVector != 9) && - (frame->exceptionVector != 31) && - (frame->exceptionVector != 33)) - { - /* - * invoke the previous handler. - */ - if (oldExceptionHook) - (*oldExceptionHook) (frame->exceptionVector); - newPC = registers[ PC ]; /* pc may have changed */ - if (newPC != frame->exceptionPC) - { - if (remote_debug) - printf("frame at 0x%x has pc=0x%x, except#=%d\n", - frame,frame->exceptionPC, - frame->exceptionVector); - /* re-use the last frame, we're skipping it (longjump?)*/ - frame = (Frame *) 0; - _returnFromException( frame ); /* this is a jump */ - } - } - } - - /* if we couldn't find a frame, create one */ - if (frame == 0) - { - frame = lastFrame -1 ; - - /* by using a bunch of print commands with breakpoints, - it's possible for the frame stack to creep down. If it creeps - too far, give up and reset it to the top. Normal use should - not see this happen. - */ - if ((unsigned int) (frame-2) < (unsigned int) &gdbFrameStack) - { - initializeRemcomErrorFrame(); - frame = lastFrame; - } - frame->previous = lastFrame; - lastFrame = frame; - frame = 0; /* null so _return... will properly initialize it */ - } - - _returnFromException( frame ); /* this is a jump */ - - break; - - /* kill the program */ - case 'k' : /* do nothing */ - break; - } /* switch */ - - /* reply to the request */ - putpacket(remcomOutBuffer); - } -} - - -void -initializeRemcomErrorFrame() -{ - lastFrame = ((Frame *) &gdbFrameStack[FRAMESIZE-1]) - 1; - lastFrame->previous = lastFrame; -} - -/* this function is used to set up exception handlers for tracing and - breakpoints */ -void set_debug_traps() -{ - extern void _debug_level7(); - extern void remcomHandler(); - int exception; - - initializeRemcomErrorFrame(); - stackPtr = &remcomStack[STACKSIZE/sizeof(int) - 1]; - - for (exception = 2; exception <= 23; exception++) - exceptionHandler(exception,_catchException); - - /* level 7 interrupt */ - exceptionHandler(31,_debug_level7); - - /* breakpoint exception (trap #1) */ - exceptionHandler(33,_catchException); - - /* This is a trap #8 instruction. Apparently it is someone's software - convention for some sort of SIGFPE condition. Whose? How many - people are being screwed by having this code the way it is? - Is there a clean solution? */ - exceptionHandler(40,_catchException); - - /* 48 to 54 are floating point coprocessor errors */ - for (exception = 48; exception <= 54; exception++) - exceptionHandler(exception,_catchException); - - if (oldExceptionHook != remcomHandler) - { - oldExceptionHook = exceptionHook; - exceptionHook = remcomHandler; - } - - initialized = 1; - -} - -/* This function will generate a breakpoint exception. It is used at the - beginning of a program to sync up with a debugger and can be used - otherwise as a quick means to stop program execution and "break" into - the debugger. */ - -void breakpoint() -{ - if (initialized) BREAKPOINT(); -} - diff --git a/contrib/gdb/gdb/m68k-tdep.c b/contrib/gdb/gdb/m68k-tdep.c deleted file mode 100644 index f5cc3b0..0000000 --- a/contrib/gdb/gdb/m68k-tdep.c +++ /dev/null @@ -1,514 +0,0 @@ -/* Target dependent code for the Motorola 68000 series. - Copyright (C) 1990, 1992 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "defs.h" -#include "frame.h" -#include "symtab.h" - - -/* Push an empty stack frame, to record the current PC, etc. */ - -void -m68k_push_dummy_frame () -{ - register CORE_ADDR sp = read_register (SP_REGNUM); - register int regnum; - char raw_buffer[12]; - - sp = push_word (sp, read_register (PC_REGNUM)); - sp = push_word (sp, read_register (FP_REGNUM)); - write_register (FP_REGNUM, sp); - - /* Always save the floating-point registers, whether they exist on - this target or not. */ - for (regnum = FP0_REGNUM + 7; regnum >= FP0_REGNUM; regnum--) - { - read_register_bytes (REGISTER_BYTE (regnum), raw_buffer, 12); - sp = push_bytes (sp, raw_buffer, 12); - } - - for (regnum = FP_REGNUM - 1; regnum >= 0; regnum--) - { - sp = push_word (sp, read_register (regnum)); - } - sp = push_word (sp, read_register (PS_REGNUM)); - write_register (SP_REGNUM, sp); -} - -/* Discard from the stack the innermost frame, - restoring all saved registers. */ - -void -m68k_pop_frame () -{ - register struct frame_info *frame = get_current_frame (); - register CORE_ADDR fp; - register int regnum; - struct frame_saved_regs fsr; - struct frame_info *fi; - char raw_buffer[12]; - - fp = FRAME_FP (frame); - get_frame_saved_regs (frame, &fsr); - for (regnum = FP0_REGNUM + 7 ; regnum >= FP0_REGNUM ; regnum--) - { - if (fsr.regs[regnum]) - { - read_memory (fsr.regs[regnum], raw_buffer, 12); - write_register_bytes (REGISTER_BYTE (regnum), raw_buffer, 12); - } - } - for (regnum = FP_REGNUM - 1 ; regnum >= 0 ; regnum--) - { - if (fsr.regs[regnum]) - { - write_register (regnum, read_memory_integer (fsr.regs[regnum], 4)); - } - } - if (fsr.regs[PS_REGNUM]) - { - write_register (PS_REGNUM, read_memory_integer (fsr.regs[PS_REGNUM], 4)); - } - write_register (FP_REGNUM, read_memory_integer (fp, 4)); - write_register (PC_REGNUM, read_memory_integer (fp + 4, 4)); - write_register (SP_REGNUM, fp + 8); - flush_cached_frames (); -} - - -/* Given an ip value corresponding to the start of a function, - return the ip of the first instruction after the function - prologue. This is the generic m68k support. Machines which - require something different can override the SKIP_PROLOGUE - macro to point elsewhere. - - Some instructions which typically may appear in a function - prologue include: - - A link instruction, word form: - - link.w %a6,&0 4e56 XXXX - - A link instruction, long form: - - link.l %fp,&F%1 480e XXXX XXXX - - A movm instruction to preserve integer regs: - - movm.l &M%1,(4,%sp) 48ef XXXX XXXX - - A fmovm instruction to preserve float regs: - - fmovm &FPM%1,(FPO%1,%sp) f237 XXXX XXXX XXXX XXXX - - Some profiling setup code (FIXME, not recognized yet): - - lea.l (.L3,%pc),%a1 43fb XXXX XXXX XXXX - bsr _mcount 61ff XXXX XXXX - - */ - -#define P_LINK_L 0x480e -#define P_LINK_W 0x4e56 -#define P_MOV_L 0x207c -#define P_JSR 0x4eb9 -#define P_BSR 0x61ff -#define P_LEA_L 0x43fb -#define P_MOVM_L 0x48ef -#define P_FMOVM 0xf237 -#define P_TRAP 0x4e40 - -CORE_ADDR -m68k_skip_prologue (ip) -CORE_ADDR ip; -{ - register CORE_ADDR limit; - struct symtab_and_line sal; - register int op; - - /* Find out if there is a known limit for the extent of the prologue. - If so, ensure we don't go past it. If not, assume "infinity". */ - - sal = find_pc_line (ip, 0); - limit = (sal.end) ? sal.end : (CORE_ADDR) ~0; - - while (ip < limit) - { - op = read_memory_integer (ip, 2); - op &= 0xFFFF; - - if (op == P_LINK_W) - { - ip += 4; /* Skip link.w */ - } - else if (op == 0x4856) - ip += 2; /* Skip pea %fp */ - else if (op == 0x2c4f) - ip += 2; /* Skip move.l %sp, %fp */ - else if (op == P_LINK_L) - { - ip += 6; /* Skip link.l */ - } - else if (op == P_MOVM_L) - { - ip += 6; /* Skip movm.l */ - } - else if (op == P_FMOVM) - { - ip += 10; /* Skip fmovm */ - } - else - { - break; /* Found unknown code, bail out. */ - } - } - return (ip); -} - -void -m68k_find_saved_regs (frame_info, saved_regs) - struct frame_info *frame_info; - struct frame_saved_regs *saved_regs; -{ - register int regnum; - register int regmask; - register CORE_ADDR next_addr; - register CORE_ADDR pc; - - /* First possible address for a pc in a call dummy for this frame. */ - CORE_ADDR possible_call_dummy_start = - (frame_info)->frame - CALL_DUMMY_LENGTH - FP_REGNUM*4 - 4 - 8*12; - - int nextinsn; - memset (saved_regs, 0, sizeof (*saved_regs)); - if ((frame_info)->pc >= possible_call_dummy_start - && (frame_info)->pc <= (frame_info)->frame) - { - - /* It is a call dummy. We could just stop now, since we know - what the call dummy saves and where. But this code proceeds - to parse the "prologue" which is part of the call dummy. - This is needlessly complex and confusing. FIXME. */ - - next_addr = (frame_info)->frame; - pc = possible_call_dummy_start; - } - else - { - pc = get_pc_function_start ((frame_info)->pc); - - if (0x4856 == read_memory_integer (pc, 2) - && 0x2c4f == read_memory_integer (pc + 2, 2)) - { - /* - pea %fp - move.l %sp, %fp */ - - pc += 4; - next_addr = frame_info->frame; - } - else if (044016 == read_memory_integer (pc, 2)) - /* link.l %fp */ - /* Find the address above the saved - regs using the amount of storage from the link instruction. */ - next_addr = (frame_info)->frame + read_memory_integer (pc += 2, 4), pc+=4; - else if (047126 == read_memory_integer (pc, 2)) - /* link.w %fp */ - /* Find the address above the saved - regs using the amount of storage from the link instruction. */ - next_addr = (frame_info)->frame + read_memory_integer (pc += 2, 2), pc+=2; - else goto lose; - - /* If have an addal #-n, sp next, adjust next_addr. */ - if ((0177777 & read_memory_integer (pc, 2)) == 0157774) - next_addr += read_memory_integer (pc += 2, 4), pc += 4; - } - regmask = read_memory_integer (pc + 2, 2); - - /* Here can come an fmovem. Check for it. */ - nextinsn = 0xffff & read_memory_integer (pc, 2); - if (0xf227 == nextinsn - && (regmask & 0xff00) == 0xe000) - { pc += 4; /* Regmask's low bit is for register fp7, the first pushed */ - for (regnum = FP0_REGNUM + 7; regnum >= FP0_REGNUM; regnum--, regmask >>= 1) - if (regmask & 1) - saved_regs->regs[regnum] = (next_addr -= 12); - regmask = read_memory_integer (pc + 2, 2); } - - /* next should be a moveml to (sp) or -(sp) or a movl r,-(sp) */ - if (0044327 == read_memory_integer (pc, 2)) - { pc += 4; /* Regmask's low bit is for register 0, the first written */ - for (regnum = 0; regnum < 16; regnum++, regmask >>= 1) - if (regmask & 1) - saved_regs->regs[regnum] = (next_addr += 4) - 4; } - else if (0044347 == read_memory_integer (pc, 2)) - { - pc += 4; /* Regmask's low bit is for register 15, the first pushed */ - for (regnum = 15; regnum >= 0; regnum--, regmask >>= 1) - if (regmask & 1) - saved_regs->regs[regnum] = (next_addr -= 4); - } - else if (0x2f00 == (0xfff0 & read_memory_integer (pc, 2))) - { - regnum = 0xf & read_memory_integer (pc, 2); pc += 2; - saved_regs->regs[regnum] = (next_addr -= 4); - /* gcc, at least, may use a pair of movel instructions when saving - exactly 2 registers. */ - if (0x2f00 == (0xfff0 & read_memory_integer (pc, 2))) - { - regnum = 0xf & read_memory_integer (pc, 2); - pc += 2; - saved_regs->regs[regnum] = (next_addr -= 4); - } - } - - /* fmovemx to index of sp may follow. */ - regmask = read_memory_integer (pc + 2, 2); - nextinsn = 0xffff & read_memory_integer (pc, 2); - if (0xf236 == nextinsn - && (regmask & 0xff00) == 0xf000) - { pc += 10; /* Regmask's low bit is for register fp0, the first written */ - for (regnum = FP0_REGNUM + 7; regnum >= FP0_REGNUM; regnum--, regmask >>= 1) - if (regmask & 1) - saved_regs->regs[regnum] = (next_addr += 12) - 12; - regmask = read_memory_integer (pc + 2, 2); } - - /* clrw -(sp); movw ccr,-(sp) may follow. */ - if (0x426742e7 == read_memory_integer (pc, 4)) - saved_regs->regs[PS_REGNUM] = (next_addr -= 4); - lose: ; - saved_regs->regs[SP_REGNUM] = (frame_info)->frame + 8; - saved_regs->regs[FP_REGNUM] = (frame_info)->frame; - saved_regs->regs[PC_REGNUM] = (frame_info)->frame + 4; -#ifdef SIG_SP_FP_OFFSET - /* Adjust saved SP_REGNUM for fake _sigtramp frames. */ - if (frame_info->signal_handler_caller && frame_info->next) - saved_regs->regs[SP_REGNUM] = frame_info->next->frame + SIG_SP_FP_OFFSET; -#endif -} - - -#ifdef USE_PROC_FS /* Target dependent support for /proc */ - -#include - -/* The /proc interface divides the target machine's register set up into - two different sets, the general register set (gregset) and the floating - point register set (fpregset). For each set, there is an ioctl to get - the current register set and another ioctl to set the current values. - - The actual structure passed through the ioctl interface is, of course, - naturally machine dependent, and is different for each set of registers. - For the m68k for example, the general register set is typically defined - by: - - typedef int gregset_t[18]; - - #define R_D0 0 - ... - #define R_PS 17 - - and the floating point set by: - - typedef struct fpregset { - int f_pcr; - int f_psr; - int f_fpiaddr; - int f_fpregs[8][3]; (8 regs, 96 bits each) - } fpregset_t; - - These routines provide the packing and unpacking of gregset_t and - fpregset_t formatted data. - - */ - -/* Atari SVR4 has R_SR but not R_PS */ - -#if !defined (R_PS) && defined (R_SR) -#define R_PS R_SR -#endif - -/* Given a pointer to a general register set in /proc format (gregset_t *), - unpack the register contents and supply them as gdb's idea of the current - register values. */ - -void -supply_gregset (gregsetp) -gregset_t *gregsetp; -{ - register int regi; - register greg_t *regp = (greg_t *) gregsetp; - - for (regi = 0 ; regi < R_PC ; regi++) - { - supply_register (regi, (char *) (regp + regi)); - } - supply_register (PS_REGNUM, (char *) (regp + R_PS)); - supply_register (PC_REGNUM, (char *) (regp + R_PC)); -} - -void -fill_gregset (gregsetp, regno) -gregset_t *gregsetp; -int regno; -{ - register int regi; - register greg_t *regp = (greg_t *) gregsetp; - extern char registers[]; - - for (regi = 0 ; regi < R_PC ; regi++) - { - if ((regno == -1) || (regno == regi)) - { - *(regp + regi) = *(int *) ®isters[REGISTER_BYTE (regi)]; - } - } - if ((regno == -1) || (regno == PS_REGNUM)) - { - *(regp + R_PS) = *(int *) ®isters[REGISTER_BYTE (PS_REGNUM)]; - } - if ((regno == -1) || (regno == PC_REGNUM)) - { - *(regp + R_PC) = *(int *) ®isters[REGISTER_BYTE (PC_REGNUM)]; - } -} - -#if defined (FP0_REGNUM) - -/* Given a pointer to a floating point register set in /proc format - (fpregset_t *), unpack the register contents and supply them as gdb's - idea of the current floating point register values. */ - -void -supply_fpregset (fpregsetp) -fpregset_t *fpregsetp; -{ - register int regi; - char *from; - - for (regi = FP0_REGNUM ; regi < FPC_REGNUM ; regi++) - { - from = (char *) &(fpregsetp -> f_fpregs[regi-FP0_REGNUM][0]); - supply_register (regi, from); - } - supply_register (FPC_REGNUM, (char *) &(fpregsetp -> f_pcr)); - supply_register (FPS_REGNUM, (char *) &(fpregsetp -> f_psr)); - supply_register (FPI_REGNUM, (char *) &(fpregsetp -> f_fpiaddr)); -} - -/* Given a pointer to a floating point register set in /proc format - (fpregset_t *), update the register specified by REGNO from gdb's idea - of the current floating point register set. If REGNO is -1, update - them all. */ - -void -fill_fpregset (fpregsetp, regno) -fpregset_t *fpregsetp; -int regno; -{ - int regi; - char *to; - char *from; - extern char registers[]; - - for (regi = FP0_REGNUM ; regi < FPC_REGNUM ; regi++) - { - if ((regno == -1) || (regno == regi)) - { - from = (char *) ®isters[REGISTER_BYTE (regi)]; - to = (char *) &(fpregsetp -> f_fpregs[regi-FP0_REGNUM][0]); - memcpy (to, from, REGISTER_RAW_SIZE (regi)); - } - } - if ((regno == -1) || (regno == FPC_REGNUM)) - { - fpregsetp -> f_pcr = *(int *) ®isters[REGISTER_BYTE (FPC_REGNUM)]; - } - if ((regno == -1) || (regno == FPS_REGNUM)) - { - fpregsetp -> f_psr = *(int *) ®isters[REGISTER_BYTE (FPS_REGNUM)]; - } - if ((regno == -1) || (regno == FPI_REGNUM)) - { - fpregsetp -> f_fpiaddr = *(int *) ®isters[REGISTER_BYTE (FPI_REGNUM)]; - } -} - -#endif /* defined (FP0_REGNUM) */ - -#endif /* USE_PROC_FS */ - -#ifdef GET_LONGJMP_TARGET -/* Figure out where the longjmp will land. Slurp the args out of the stack. - We expect the first arg to be a pointer to the jmp_buf structure from which - we extract the pc (JB_PC) that we will land at. The pc is copied into PC. - This routine returns true on success. */ - -int -get_longjmp_target(pc) - CORE_ADDR *pc; -{ - char buf[TARGET_PTR_BIT / TARGET_CHAR_BIT]; - CORE_ADDR sp, jb_addr; - - sp = read_register(SP_REGNUM); - - if (target_read_memory (sp + SP_ARG0, /* Offset of first arg on stack */ - buf, - TARGET_PTR_BIT / TARGET_CHAR_BIT)) - return 0; - - jb_addr = extract_address (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT); - - if (target_read_memory (jb_addr + JB_PC * JB_ELEMENT_SIZE, buf, - TARGET_PTR_BIT / TARGET_CHAR_BIT)) - return 0; - - *pc = extract_address (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT); - - return 1; -} -#endif /* GET_LONGJMP_TARGET */ - -/* Immediately after a function call, return the saved pc before the frame - is setup. For sun3's, we check for the common case of being inside of a - system call, and if so, we know that Sun pushes the call # on the stack - prior to doing the trap. */ - -CORE_ADDR -m68k_saved_pc_after_call(frame) - struct frame_info *frame; -{ -#ifdef SYSCALL_TRAP - int op; - - op = read_memory_integer (frame->pc - SYSCALL_TRAP_OFFSET, 2); - - if (op == SYSCALL_TRAP) - return read_memory_integer (read_register (SP_REGNUM) + 4, 4); - else -#endif /* SYSCALL_TRAP */ - return read_memory_integer (read_register (SP_REGNUM), 4); -} - -void -_initialize_m68k_tdep () -{ - tm_print_insn = print_insn_m68k; -} diff --git a/contrib/gdb/gdb/m68knbsd-nat.c b/contrib/gdb/gdb/m68knbsd-nat.c deleted file mode 100644 index 7f98147..0000000 --- a/contrib/gdb/gdb/m68knbsd-nat.c +++ /dev/null @@ -1,86 +0,0 @@ -/* Native-dependent code for Motorola m68k's running NetBSD, for GDB. - Copyright 1988, 1989, 1991, 1992, 1994, 1996 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include -#include -#include -#include - -#include "defs.h" -#include "inferior.h" - -void -fetch_inferior_registers(regno) - int regno; -{ - struct reg inferior_registers; - struct fpreg inferior_fp_registers; - - ptrace (PT_GETREGS, inferior_pid, - (PTRACE_ARG3_TYPE) &inferior_registers, 0); - memcpy (®isters[REGISTER_BYTE (0)], &inferior_registers, - sizeof(inferior_registers)); - - ptrace (PT_GETFPREGS, inferior_pid, - (PTRACE_ARG3_TYPE) &inferior_fp_registers, 0); - memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers, - sizeof(inferior_fp_registers)); - - registers_fetched (); -} - -void -store_inferior_registers(regno) - int regno; -{ - struct reg inferior_registers; - struct fpreg inferior_fp_registers; - - memcpy (&inferior_registers, ®isters[REGISTER_BYTE (0)], - sizeof(inferior_registers)); - ptrace (PT_SETREGS, inferior_pid, - (PTRACE_ARG3_TYPE) &inferior_registers, 0); - - memcpy (&inferior_fp_registers, ®isters[REGISTER_BYTE (FP0_REGNUM)], - sizeof(inferior_fp_registers)); - ptrace (PT_SETFPREGS, inferior_pid, - (PTRACE_ARG3_TYPE) &inferior_fp_registers, 0); -} - -struct md_core { - struct reg intreg; - struct fpreg freg; -}; - -void -fetch_core_registers (core_reg_sect, core_reg_size, which, ignore) - char *core_reg_sect; - unsigned core_reg_size; - int which; - unsigned int ignore; -{ - struct md_core *core_reg = (struct md_core *)core_reg_sect; - - /* Integer registers */ - memcpy(®isters[REGISTER_BYTE (0)], - &core_reg->intreg, sizeof(struct reg)); - /* Floating point registers */ - memcpy(®isters[REGISTER_BYTE (FP0_REGNUM)], - &core_reg->freg, sizeof(struct fpreg)); -} diff --git a/contrib/gdb/gdb/m88k-nat.c b/contrib/gdb/gdb/m88k-nat.c deleted file mode 100644 index 19e9392..0000000 --- a/contrib/gdb/gdb/m88k-nat.c +++ /dev/null @@ -1,285 +0,0 @@ -/* Native-dependent Motorola 88xxx support for GDB, the GNU Debugger. - Copyright 1988, 1990, 1991, 1992 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "defs.h" -#include "frame.h" -#include "inferior.h" - -#include -#include -#include -#include -#include "gdbcore.h" -#include - -#ifndef USER /* added to support BCS ptrace_user */ -#define USER ptrace_user -#endif -#include -#include -#include -#include "gdb_stat.h" - -#include "symtab.h" -#include "setjmp.h" -#include "value.h" - -#ifdef DELTA88 -#include - -/* define offsets to the pc instruction offsets in ptrace_user struct */ -#define SXIP_OFFSET ((char *)&u.pt_sigframe.sig_sxip - (char *)&u) -#define SNIP_OFFSET ((char *)&u.pt_sigframe.sig_snip - (char *)&u) -#define SFIP_OFFSET ((char *)&u.pt_sigframe.sig_sfip - (char *)&u) -#else -/* define offsets to the pc instruction offsets in ptrace_user struct */ -#define SXIP_OFFSET ((char *)&u.pt_sigframe.dg_sigframe.sc_sxip - (char *)&u) -#define SNIP_OFFSET ((char *)&u.pt_sigframe.dg_sigframe.sc_snip - (char *)&u) -#define SFIP_OFFSET ((char *)&u.pt_sigframe.dg_sigframe.sc_sfip - (char *)&u) -#endif - -extern int have_symbol_file_p(); - -extern jmp_buf stack_jmp; - -extern int errno; -extern char registers[REGISTER_BYTES]; - -void -fetch_inferior_registers (regno) - int regno; /* Original value discarded */ -{ - register unsigned int regaddr; - char buf[MAX_REGISTER_RAW_SIZE]; - register int i; - - struct USER u; - unsigned int offset; - - offset = (char *) &u.pt_r0 - (char *) &u; - regaddr = offset; /* byte offset to r0;*/ - -/* offset = ptrace (3, inferior_pid, (PTRACE_ARG3_TYPE) offset, 0) - KERNEL_U_ADDR; */ - for (regno = 0; regno < NUM_REGS; regno++) - { - /*regaddr = register_addr (regno, offset);*/ - /* 88k enhancement */ - - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) - { - *(int *) &buf[i] = ptrace (3, inferior_pid, - (PTRACE_ARG3_TYPE) regaddr, 0); - regaddr += sizeof (int); - } - supply_register (regno, buf); - } - /* now load up registers 36 - 38; special pc registers */ - *(int *) &buf[0] = ptrace (3,inferior_pid, - (PTRACE_ARG3_TYPE) SXIP_OFFSET ,0); - supply_register (SXIP_REGNUM, buf); - *(int *) &buf[0] = ptrace (3, inferior_pid, - (PTRACE_ARG3_TYPE) SNIP_OFFSET,0); - supply_register (SNIP_REGNUM, buf); - *(int *) &buf[0] = ptrace (3, inferior_pid, - (PTRACE_ARG3_TYPE) SFIP_OFFSET,0); - supply_register (SFIP_REGNUM, buf); -} - -/* Store our register values back into the inferior. - If REGNO is -1, do this for all registers. - Otherwise, REGNO specifies which register (so we can save time). */ - -void -store_inferior_registers (regno) - int regno; -{ - register unsigned int regaddr; - char buf[80]; - - struct USER u; - - unsigned int offset = (char *) &u.pt_r0 - (char *) &u; - - regaddr = offset; - - /* Don't try to deal with EXIP_REGNUM or ENIP_REGNUM, because I think either - svr3 doesn't run on an 88110, or the kernel isolates the different (not - completely sure this is true, but seems to be. */ - if (regno >= 0) - { - /* regaddr = register_addr (regno, offset); */ - if (regno < PC_REGNUM) - { - regaddr = offset + regno * sizeof (int); - errno = 0; - ptrace (6, inferior_pid, - (PTRACE_ARG3_TYPE) regaddr, read_register (regno)); - if (errno != 0) - { - sprintf (buf, "writing register number %d", regno); - perror_with_name (buf); - } - } - else if (regno == SXIP_REGNUM) - ptrace (6, inferior_pid, - (PTRACE_ARG3_TYPE) SXIP_OFFSET, read_register(regno)); - else if (regno == SNIP_REGNUM) - ptrace (6, inferior_pid, - (PTRACE_ARG3_TYPE) SNIP_OFFSET, read_register(regno)); - else if (regno == SFIP_REGNUM) - ptrace (6, inferior_pid, - (PTRACE_ARG3_TYPE) SFIP_OFFSET, read_register(regno)); - else - printf_unfiltered ("Bad register number for store_inferior routine\n"); - } - else - { - for (regno = 0; regno < PC_REGNUM; regno++) - { - /* regaddr = register_addr (regno, offset); */ - errno = 0; - regaddr = offset + regno * sizeof (int); - ptrace (6, inferior_pid, - (PTRACE_ARG3_TYPE) regaddr, read_register (regno)); - if (errno != 0) - { - sprintf (buf, "writing register number %d", regno); - perror_with_name (buf); - } - } - ptrace (6,inferior_pid, - (PTRACE_ARG3_TYPE) SXIP_OFFSET,read_register(SXIP_REGNUM)); - ptrace (6,inferior_pid, - (PTRACE_ARG3_TYPE) SNIP_OFFSET,read_register(SNIP_REGNUM)); - ptrace (6,inferior_pid, - (PTRACE_ARG3_TYPE) SFIP_OFFSET,read_register(SFIP_REGNUM)); - } -} - - -/* blockend is the address of the end of the user structure */ -m88k_register_u_addr (blockend, regnum) -{ - struct USER u; - int ustart = blockend - sizeof (struct USER); - switch (regnum) - { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: - case 26: - case 27: - case 28: - case 29: - case 30: - case 31: - return (ustart + ((int) &u.pt_r0 - (int) &u) + REGISTER_SIZE * regnum); - case PSR_REGNUM: return (ustart + ((int) &u.pt_psr - (int) &u)); - case FPSR_REGNUM: return (ustart + ((int) &u.pt_fpsr - (int) &u)); - case FPCR_REGNUM: return (ustart + ((int) &u.pt_fpcr - (int) &u)); - case SXIP_REGNUM: return (ustart + SXIP_OFFSET); - case SNIP_REGNUM: return (ustart + SNIP_OFFSET); - case SFIP_REGNUM: return (ustart + SFIP_OFFSET); - default: - if (regnum < NUM_REGS) - /* The register is one of those which is not defined... - give it zero */ - return (ustart + ((int) &u.pt_r0 - (int) &u)); - else - return (blockend + REGISTER_SIZE * regnum); - } -} - -#ifdef USE_PROC_FS - -#include - -/* Given a pointer to a general register set in /proc format (gregset_t *), - unpack the register contents and supply them as gdb's idea of the current - register values. */ - -void -supply_gregset (gregsetp) - gregset_t *gregsetp; -{ - register int regi; - register greg_t *regp = (greg_t *) gregsetp; - - for (regi=0; regi <= SP_REGNUM; regi++) - supply_register (regi, (char *) (regp + regi)); - - supply_register (SXIP_REGNUM, (char *) (regp + R_XIP)); - supply_register (SNIP_REGNUM, (char *) (regp + R_NIP)); - supply_register (SFIP_REGNUM, (char *) (regp + R_FIP)); - supply_register (PSR_REGNUM, (char *) (regp + R_PSR)); - supply_register (FPSR_REGNUM, (char *) (regp + R_FPSR)); - supply_register (FPCR_REGNUM, (char *) (regp + R_FPCR)); -} - -void -fill_gregset (gregsetp, regno) - gregset_t *gregsetp; - int regno; -{ - int regi; - register greg_t *regp = (greg_t *) gregsetp; - extern char registers[]; - - for (regi = 0 ; regi <= R_R31 ; regi++) - if ((regno == -1) || (regno == regi)) - *(regp + regi) = *(int *) ®isters[REGISTER_BYTE(regi)]; - - if ((regno == -1) || (regno == SXIP_REGNUM)) - *(regp + R_XIP) = *(int *) ®isters[REGISTER_BYTE(SXIP_REGNUM)]; - if ((regno == -1) || (regno == SNIP_REGNUM)) - *(regp + R_NIP) = *(int *) ®isters[REGISTER_BYTE(SNIP_REGNUM)]; - if ((regno == -1) || (regno == SFIP_REGNUM)) - *(regp + R_FIP) = *(int *) ®isters[REGISTER_BYTE(SFIP_REGNUM)]; - if ((regno == -1) || (regno == PSR_REGNUM)) - *(regp + R_PSR) = *(int *) ®isters[REGISTER_BYTE(PSR_REGNUM)]; - if ((regno == -1) || (regno == FPSR_REGNUM)) - *(regp + R_FPSR) = *(int *) ®isters[REGISTER_BYTE(FPSR_REGNUM)]; - if ((regno == -1) || (regno == FPCR_REGNUM)) - *(regp + R_FPCR) = *(int *) ®isters[REGISTER_BYTE(FPCR_REGNUM)]; -} - -#endif /* USE_PROC_FS */ diff --git a/contrib/gdb/gdb/m88k-tdep.c b/contrib/gdb/gdb/m88k-tdep.c deleted file mode 100644 index a21bd96..0000000 --- a/contrib/gdb/gdb/m88k-tdep.c +++ /dev/null @@ -1,616 +0,0 @@ -/* Target-machine dependent code for Motorola 88000 series, for GDB. - Copyright 1988, 1990, 1991, 1994, 1995 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "defs.h" -#include "frame.h" -#include "inferior.h" -#include "value.h" -#include "gdbcore.h" -#include "symtab.h" -#include "setjmp.h" -#include "value.h" - -/* Size of an instruction */ -#define BYTES_PER_88K_INSN 4 - -void frame_find_saved_regs (); - -/* Is this target an m88110? Otherwise assume m88100. This has - relevance for the ways in which we screw with instruction pointers. */ - -int target_is_m88110 = 0; - -/* Given a GDB frame, determine the address of the calling function's frame. - This will be used to create a new GDB frame struct, and then - INIT_EXTRA_FRAME_INFO and INIT_FRAME_PC will be called for the new frame. - - For us, the frame address is its stack pointer value, so we look up - the function prologue to determine the caller's sp value, and return it. */ - -CORE_ADDR -frame_chain (thisframe) - struct frame_info *thisframe; -{ - - frame_find_saved_regs (thisframe, (struct frame_saved_regs *) 0); - /* NOTE: this depends on frame_find_saved_regs returning the VALUE, not - the ADDRESS, of SP_REGNUM. It also depends on the cache of - frame_find_saved_regs results. */ - if (thisframe->fsr->regs[SP_REGNUM]) - return thisframe->fsr->regs[SP_REGNUM]; - else - return thisframe->frame; /* Leaf fn -- next frame up has same SP. */ -} - -int -frameless_function_invocation (frame) - struct frame_info *frame; -{ - - frame_find_saved_regs (frame, (struct frame_saved_regs *) 0); - /* NOTE: this depends on frame_find_saved_regs returning the VALUE, not - the ADDRESS, of SP_REGNUM. It also depends on the cache of - frame_find_saved_regs results. */ - if (frame->fsr->regs[SP_REGNUM]) - return 0; /* Frameful -- return addr saved somewhere */ - else - return 1; /* Frameless -- no saved return address */ -} - -void -init_extra_frame_info (fromleaf, frame) - int fromleaf; - struct frame_info *frame; -{ - frame->fsr = 0; /* Not yet allocated */ - frame->args_pointer = 0; /* Unknown */ - frame->locals_pointer = 0; /* Unknown */ -} - -/* Examine an m88k function prologue, recording the addresses at which - registers are saved explicitly by the prologue code, and returning - the address of the first instruction after the prologue (but not - after the instruction at address LIMIT, as explained below). - - LIMIT places an upper bound on addresses of the instructions to be - examined. If the prologue code scan reaches LIMIT, the scan is - aborted and LIMIT is returned. This is used, when examining the - prologue for the current frame, to keep examine_prologue () from - claiming that a given register has been saved when in fact the - instruction that saves it has not yet been executed. LIMIT is used - at other times to stop the scan when we hit code after the true - function prologue (e.g. for the first source line) which might - otherwise be mistaken for function prologue. - - The format of the function prologue matched by this routine is - derived from examination of the source to gcc 1.95, particularly - the routine output_prologue () in config/out-m88k.c. - - subu r31,r31,n # stack pointer update - - (st rn,r31,offset)? # save incoming regs - (st.d rn,r31,offset)? - - (addu r30,r31,n)? # frame pointer update - - (pic sequence)? # PIC code prologue - - (or rn,rm,0)? # Move parameters to other regs -*/ - -/* Macros for extracting fields from instructions. */ - -#define BITMASK(pos, width) (((0x1 << (width)) - 1) << (pos)) -#define EXTRACT_FIELD(val, pos, width) ((val) >> (pos) & BITMASK (0, width)) -#define SUBU_OFFSET(x) ((unsigned)(x & 0xFFFF)) -#define ST_OFFSET(x) ((unsigned)((x) & 0xFFFF)) -#define ST_SRC(x) EXTRACT_FIELD ((x), 21, 5) -#define ADDU_OFFSET(x) ((unsigned)(x & 0xFFFF)) - -/* - * prologue_insn_tbl is a table of instructions which may comprise a - * function prologue. Associated with each table entry (corresponding - * to a single instruction or group of instructions), is an action. - * This action is used by examine_prologue (below) to determine - * the state of certain machine registers and where the stack frame lives. - */ - -enum prologue_insn_action { - PIA_SKIP, /* don't care what the instruction does */ - PIA_NOTE_ST, /* note register stored and where */ - PIA_NOTE_STD, /* note pair of registers stored and where */ - PIA_NOTE_SP_ADJUSTMENT, /* note stack pointer adjustment */ - PIA_NOTE_FP_ASSIGNMENT, /* note frame pointer assignment */ - PIA_NOTE_PROLOGUE_END, /* no more prologue */ -}; - -struct prologue_insns { - unsigned long insn; - unsigned long mask; - enum prologue_insn_action action; -}; - -struct prologue_insns prologue_insn_tbl[] = { - /* Various register move instructions */ - { 0x58000000, 0xf800ffff, PIA_SKIP }, /* or/or.u with immed of 0 */ - { 0xf4005800, 0xfc1fffe0, PIA_SKIP }, /* or rd, r0, rs */ - { 0xf4005800, 0xfc00ffff, PIA_SKIP }, /* or rd, rs, r0 */ - - /* Stack pointer setup: "subu sp, sp, n" where n is a multiple of 8 */ - { 0x67ff0000, 0xffff0007, PIA_NOTE_SP_ADJUSTMENT }, - - /* Frame pointer assignment: "addu r30, r31, n" */ - { 0x63df0000, 0xffff0000, PIA_NOTE_FP_ASSIGNMENT }, - - /* Store to stack instructions; either "st rx, sp, n" or "st.d rx, sp, n" */ - { 0x241f0000, 0xfc1f0000, PIA_NOTE_ST }, /* st rx, sp, n */ - { 0x201f0000, 0xfc1f0000, PIA_NOTE_STD }, /* st.d rs, sp, n */ - - /* Instructions needed for setting up r25 for pic code. */ - { 0x5f200000, 0xffff0000, PIA_SKIP }, /* or.u r25, r0, offset_high */ - { 0xcc000002, 0xffffffff, PIA_SKIP }, /* bsr.n Lab */ - { 0x5b390000, 0xffff0000, PIA_SKIP }, /* or r25, r25, offset_low */ - { 0xf7396001, 0xffffffff, PIA_SKIP }, /* Lab: addu r25, r25, r1 */ - - /* Various branch or jump instructions which have a delay slot -- these - do not form part of the prologue, but the instruction in the delay - slot might be a store instruction which should be noted. */ - { 0xc4000000, 0xe4000000, PIA_NOTE_PROLOGUE_END }, - /* br.n, bsr.n, bb0.n, or bb1.n */ - { 0xec000000, 0xfc000000, PIA_NOTE_PROLOGUE_END }, /* bcnd.n */ - { 0xf400c400, 0xfffff7e0, PIA_NOTE_PROLOGUE_END } /* jmp.n or jsr.n */ - -}; - - -/* Fetch the instruction at ADDR, returning 0 if ADDR is beyond LIM or - is not the address of a valid instruction, the address of the next - instruction beyond ADDR otherwise. *PWORD1 receives the first word - of the instruction. */ - -#define NEXT_PROLOGUE_INSN(addr, lim, pword1) \ - (((addr) < (lim)) ? next_insn (addr, pword1) : 0) - -/* Read the m88k instruction at 'memaddr' and return the address of - the next instruction after that, or 0 if 'memaddr' is not the - address of a valid instruction. The instruction - is stored at 'pword1'. */ - -CORE_ADDR -next_insn (memaddr, pword1) - unsigned long *pword1; - CORE_ADDR memaddr; -{ - *pword1 = read_memory_integer (memaddr, BYTES_PER_88K_INSN); - return memaddr + BYTES_PER_88K_INSN; -} - -/* Read a register from frames called by us (or from the hardware regs). */ - -static int -read_next_frame_reg(frame, regno) - struct frame_info *frame; - int regno; -{ - for (; frame; frame = frame->next) { - if (regno == SP_REGNUM) - return FRAME_FP (frame); - else if (frame->fsr->regs[regno]) - return read_memory_integer(frame->fsr->regs[regno], 4); - } - return read_register(regno); -} - -/* Examine the prologue of a function. `ip' points to the first instruction. - `limit' is the limit of the prologue (e.g. the addr of the first - linenumber, or perhaps the program counter if we're stepping through). - `frame_sp' is the stack pointer value in use in this frame. - `fsr' is a pointer to a frame_saved_regs structure into which we put - info about the registers saved by this frame. - `fi' is a struct frame_info pointer; we fill in various fields in it - to reflect the offsets of the arg pointer and the locals pointer. */ - -static CORE_ADDR -examine_prologue (ip, limit, frame_sp, fsr, fi) - register CORE_ADDR ip; - register CORE_ADDR limit; - CORE_ADDR frame_sp; - struct frame_saved_regs *fsr; - struct frame_info *fi; -{ - register CORE_ADDR next_ip; - register int src; - unsigned int insn; - int size, offset; - char must_adjust[32]; /* If set, must adjust offsets in fsr */ - int sp_offset = -1; /* -1 means not set (valid must be mult of 8) */ - int fp_offset = -1; /* -1 means not set */ - CORE_ADDR frame_fp; - CORE_ADDR prologue_end = 0; - - memset (must_adjust, '\0', sizeof (must_adjust)); - next_ip = NEXT_PROLOGUE_INSN (ip, limit, &insn); - - while (next_ip) - { - struct prologue_insns *pip; - - for (pip=prologue_insn_tbl; (insn & pip->mask) != pip->insn; ) - if (++pip >= prologue_insn_tbl + sizeof prologue_insn_tbl) - goto end_of_prologue_found; /* not a prologue insn */ - - switch (pip->action) - { - case PIA_NOTE_ST: - case PIA_NOTE_STD: - if (sp_offset != -1) { - src = ST_SRC (insn); - offset = ST_OFFSET (insn); - must_adjust[src] = 1; - fsr->regs[src++] = offset; /* Will be adjusted later */ - if (pip->action == PIA_NOTE_STD && src < 32) - { - offset += 4; - must_adjust[src] = 1; - fsr->regs[src++] = offset; - } - } - else - goto end_of_prologue_found; - break; - case PIA_NOTE_SP_ADJUSTMENT: - if (sp_offset == -1) - sp_offset = -SUBU_OFFSET (insn); - else - goto end_of_prologue_found; - break; - case PIA_NOTE_FP_ASSIGNMENT: - if (fp_offset == -1) - fp_offset = ADDU_OFFSET (insn); - else - goto end_of_prologue_found; - break; - case PIA_NOTE_PROLOGUE_END: - if (!prologue_end) - prologue_end = ip; - break; - case PIA_SKIP: - default : - /* Do nothing */ - break; - } - - ip = next_ip; - next_ip = NEXT_PROLOGUE_INSN (ip, limit, &insn); - } - -end_of_prologue_found: - - if (prologue_end) - ip = prologue_end; - - /* We're done with the prologue. If we don't care about the stack - frame itself, just return. (Note that fsr->regs has been trashed, - but the one caller who calls with fi==0 passes a dummy there.) */ - - if (fi == 0) - return ip; - - /* - OK, now we have: - - sp_offset original (before any alloca calls) displacement of SP - (will be negative). - - fp_offset displacement from original SP to the FP for this frame - or -1. - - fsr->regs[0..31] displacement from original SP to the stack - location where reg[0..31] is stored. - - must_adjust[0..31] set if corresponding offset was set. - - If alloca has been called between the function prologue and the current - IP, then the current SP (frame_sp) will not be the original SP as set by - the function prologue. If the current SP is not the original SP, then the - compiler will have allocated an FP for this frame, fp_offset will be set, - and we can use it to calculate the original SP. - - Then, we figure out where the arguments and locals are, and relocate the - offsets in fsr->regs to absolute addresses. */ - - if (fp_offset != -1) { - /* We have a frame pointer, so get it, and base our calc's on it. */ - frame_fp = (CORE_ADDR) read_next_frame_reg (fi->next, ACTUAL_FP_REGNUM); - frame_sp = frame_fp - fp_offset; - } else { - /* We have no frame pointer, therefore frame_sp is still the same value - as set by prologue. But where is the frame itself? */ - if (must_adjust[SRP_REGNUM]) { - /* Function header saved SRP (r1), the return address. Frame starts - 4 bytes down from where it was saved. */ - frame_fp = frame_sp + fsr->regs[SRP_REGNUM] - 4; - fi->locals_pointer = frame_fp; - } else { - /* Function header didn't save SRP (r1), so we are in a leaf fn or - are otherwise confused. */ - frame_fp = -1; - } - } - - /* The locals are relative to the FP (whether it exists as an allocated - register, or just as an assumed offset from the SP) */ - fi->locals_pointer = frame_fp; - - /* The arguments are just above the SP as it was before we adjusted it - on entry. */ - fi->args_pointer = frame_sp - sp_offset; - - /* Now that we know the SP value used by the prologue, we know where - it saved all the registers. */ - for (src = 0; src < 32; src++) - if (must_adjust[src]) - fsr->regs[src] += frame_sp; - - /* The saved value of the SP is always known. */ - /* (we hope...) */ - if (fsr->regs[SP_REGNUM] != 0 - && fsr->regs[SP_REGNUM] != frame_sp - sp_offset) - fprintf_unfiltered(gdb_stderr, "Bad saved SP value %x != %x, offset %x!\n", - fsr->regs[SP_REGNUM], - frame_sp - sp_offset, sp_offset); - - fsr->regs[SP_REGNUM] = frame_sp - sp_offset; - - return (ip); -} - -/* Given an ip value corresponding to the start of a function, - return the ip of the first instruction after the function - prologue. */ - -CORE_ADDR -skip_prologue (ip) - CORE_ADDR (ip); -{ - struct frame_saved_regs saved_regs_dummy; - struct symtab_and_line sal; - CORE_ADDR limit; - - sal = find_pc_line (ip, 0); - limit = (sal.end) ? sal.end : 0xffffffff; - - return (examine_prologue (ip, limit, (CORE_ADDR) 0, &saved_regs_dummy, - (struct frame_info *)0 )); -} - -/* Put here the code to store, into a struct frame_saved_regs, - the addresses of 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. - - We cache the result of doing this in the frame_cache_obstack, since - it is fairly expensive. */ - -void -frame_find_saved_regs (fi, fsr) - struct frame_info *fi; - struct frame_saved_regs *fsr; -{ - register struct frame_saved_regs *cache_fsr; - extern struct obstack frame_cache_obstack; - CORE_ADDR ip; - struct symtab_and_line sal; - CORE_ADDR limit; - - if (!fi->fsr) - { - cache_fsr = (struct frame_saved_regs *) - obstack_alloc (&frame_cache_obstack, - sizeof (struct frame_saved_regs)); - memset (cache_fsr, '\0', sizeof (struct frame_saved_regs)); - fi->fsr = cache_fsr; - - /* Find the start and end of the function prologue. If the PC - is in the function prologue, we only consider the part that - has executed already. In the case where the PC is not in - the function prologue, we set limit to two instructions beyond - where the prologue ends in case if any of the prologue instructions - were moved into a delay slot of a branch instruction. */ - - ip = get_pc_function_start (fi->pc); - sal = find_pc_line (ip, 0); - limit = (sal.end && sal.end < fi->pc) ? sal.end + 2 * BYTES_PER_88K_INSN - : fi->pc; - - /* This will fill in fields in *fi as well as in cache_fsr. */ -#ifdef SIGTRAMP_FRAME_FIXUP - if (fi->signal_handler_caller) - SIGTRAMP_FRAME_FIXUP(fi->frame); -#endif - examine_prologue (ip, limit, fi->frame, cache_fsr, fi); -#ifdef SIGTRAMP_SP_FIXUP - if (fi->signal_handler_caller && fi->fsr->regs[SP_REGNUM]) - SIGTRAMP_SP_FIXUP(fi->fsr->regs[SP_REGNUM]); -#endif - } - - if (fsr) - *fsr = *fi->fsr; -} - -/* Return the address of the locals block for the frame - described by FI. Returns 0 if the address is unknown. - NOTE! Frame locals are referred to by negative offsets from the - argument pointer, so this is the same as frame_args_address(). */ - -CORE_ADDR -frame_locals_address (fi) - struct frame_info *fi; -{ - struct frame_saved_regs fsr; - - if (fi->args_pointer) /* Cached value is likely there. */ - return fi->args_pointer; - - /* Nope, generate it. */ - - get_frame_saved_regs (fi, &fsr); - - return fi->args_pointer; -} - -/* Return the address of the argument block for the frame - described by FI. Returns 0 if the address is unknown. */ - -CORE_ADDR -frame_args_address (fi) - struct frame_info *fi; -{ - struct frame_saved_regs fsr; - - if (fi->args_pointer) /* Cached value is likely there. */ - return fi->args_pointer; - - /* Nope, generate it. */ - - get_frame_saved_regs (fi, &fsr); - - return fi->args_pointer; -} - -/* Return the saved PC from this frame. - - If the frame has a memory copy of SRP_REGNUM, use that. If not, - just use the register SRP_REGNUM itself. */ - -CORE_ADDR -frame_saved_pc (frame) - struct frame_info *frame; -{ - return read_next_frame_reg(frame, SRP_REGNUM); -} - - -#define DUMMY_FRAME_SIZE 192 - -static void -write_word (sp, word) - CORE_ADDR sp; - unsigned LONGEST word; -{ - register int len = REGISTER_SIZE; - char buffer[MAX_REGISTER_RAW_SIZE]; - - store_unsigned_integer (buffer, len, word); - write_memory (sp, buffer, len); -} - -void -m88k_push_dummy_frame() -{ - register CORE_ADDR sp = read_register (SP_REGNUM); - register int rn; - int offset; - - sp -= DUMMY_FRAME_SIZE; /* allocate a bunch of space */ - - for (rn = 0, offset = 0; rn <= SP_REGNUM; rn++, offset+=4) - write_word (sp+offset, read_register(rn)); - - write_word (sp+offset, read_register (SXIP_REGNUM)); - offset += 4; - - write_word (sp+offset, read_register (SNIP_REGNUM)); - offset += 4; - - write_word (sp+offset, read_register (SFIP_REGNUM)); - offset += 4; - - write_word (sp+offset, read_register (PSR_REGNUM)); - offset += 4; - - write_word (sp+offset, read_register (FPSR_REGNUM)); - offset += 4; - - write_word (sp+offset, read_register (FPCR_REGNUM)); - offset += 4; - - write_register (SP_REGNUM, sp); - write_register (ACTUAL_FP_REGNUM, sp); -} - -void -pop_frame () -{ - register struct frame_info *frame = get_current_frame (); - register CORE_ADDR fp; - register int regnum; - struct frame_saved_regs fsr; - - fp = FRAME_FP (frame); - get_frame_saved_regs (frame, &fsr); - - if (PC_IN_CALL_DUMMY (read_pc (), read_register (SP_REGNUM), FRAME_FP (fi))) - { - /* FIXME: I think get_frame_saved_regs should be handling this so - that we can deal with the saved registers properly (e.g. frame - 1 is a call dummy, the user types "frame 2" and then "print $ps"). */ - register CORE_ADDR sp = read_register (ACTUAL_FP_REGNUM); - int offset; - - for (regnum = 0, offset = 0; regnum <= SP_REGNUM; regnum++, offset+=4) - (void) write_register (regnum, read_memory_integer (sp+offset, 4)); - - write_register (SXIP_REGNUM, read_memory_integer (sp+offset, 4)); - offset += 4; - - write_register (SNIP_REGNUM, read_memory_integer (sp+offset, 4)); - offset += 4; - - write_register (SFIP_REGNUM, read_memory_integer (sp+offset, 4)); - offset += 4; - - write_register (PSR_REGNUM, read_memory_integer (sp+offset, 4)); - offset += 4; - - write_register (FPSR_REGNUM, read_memory_integer (sp+offset, 4)); - offset += 4; - - write_register (FPCR_REGNUM, read_memory_integer (sp+offset, 4)); - offset += 4; - - } - else - { - for (regnum = FP_REGNUM ; regnum > 0 ; regnum--) - if (fsr.regs[regnum]) - write_register (regnum, - read_memory_integer (fsr.regs[regnum], 4)); - write_pc (frame_saved_pc (frame)); - } - reinit_frame_cache (); -} - -void -_initialize_m88k_tdep () -{ - tm_print_insn = print_insn_m88k; -} diff --git a/contrib/gdb/gdb/minimon.h b/contrib/gdb/gdb/minimon.h deleted file mode 100644 index f60c417..0000000 --- a/contrib/gdb/gdb/minimon.h +++ /dev/null @@ -1,562 +0,0 @@ -/* Definitions and macros for support of AMD's remote debugger, MiniMON. - Copyright (C) 1990, 1991 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. */ - -/* - * Some basic types. FIXME, this should be done by declaring bitfield - * sizes in the structs. We can't portably depend on a "long int" being - * 32 bits, etc. - */ -typedef long int INT32; /* 32 bit integer */ -typedef unsigned long int UINT32; /* 32 bit integer (unsigned) */ -typedef unsigned long int ADDR32; /* 32 bit address */ -typedef unsigned long int INST32; /* 32 bit instruction */ -typedef long int BOOLEAN; /* Boolean value (32 bit) */ -typedef unsigned char BYTE; /* byte (8 bit) */ -typedef short int INT16; /* 16 bit integer */ -typedef unsigned short int UINT16; /* 16 bit integer (unsigned) */ - -/****************************************************************************/ -/************************* Message Information ******************************/ -/****************************************************************************/ - -/* - * Error codes - */ - -/* General errors */ -#define EMUSAGE 1 /* Bad args / flags */ -#define EMFAIL 2 /* Unrecoverable error */ -#define EMBADADDR 3 /* Illegal address */ -#define EMBADREG 4 /* Illegal register */ -#define EMSYNTAX 5 /* Illegal command syntax */ -#define EMACCESS 6 /* Could not access memory */ -#define EMALLOC 7 /* Could not allocate memory */ -#define EMTARGET 8 /* Unknown target type */ -#define EMHINIT 9 /* Could not initialize host */ -#define EMCOMM 10 /* Could not open communication channel */ - -/* Message errors */ -#define EMBADMSG 11 /* Unknown message type */ -#define EMMSG2BIG 12 /* Message to large for buffer */ -#define EMNOSEND 13 /* Could not send message */ -#define EMNORECV 14 /* Could not receive message */ - -#define EMRESET 15 /* Could not RESET target */ -#define EMCONFIG 16 /* Could not get target CONFIG */ -#define EMSTATUS 17 /* Could not get target STATUS */ -#define EMREAD 18 /* Could not READ target memory */ -#define EMWRITE 19 /* Could not WRITE target memory */ -#define EMBKPTSET 20 /* Could not set breakpoint */ -#define EMBKPTRM 21 /* Could not remove breakpoint */ -#define EMBKPTSTAT 22 /* Could not get breakpoint status */ -#define EMBKPTNONE 23 /* All breakpoints in use */ -#define EMBKPTUSED 24 /* Breakpoints already in use */ -#define EMCOPY 25 /* Could not COPY target memory */ -#define EMFILL 26 /* Could not FILL target memory */ -#define EMINIT 27 /* Could not initialize target memory */ -#define EMGO 28 /* Could not start execution */ -#define EMSTEP 29 /* Could not single step */ -#define EMBREAK 30 /* Could not BREAK */ -#define EMHIF 31 /* Could not perform HIF service */ -#define EMCHANNEL0 32 /* Could not read CHANNEL0 */ -#define EMCHANNEL1 33 /* Could not write CHANNEL1 */ - -/* COFF file loader errors */ -#define EMOPEN 34 /* Could not open COFF file */ -#define EMHDR 35 /* Could not read COFF header */ -#define EMMAGIC 36 /* Bad magic number */ -#define EMAOUT 37 /* Could not read COFF a.out header */ -#define EMSCNHDR 38 /* Could not read COFF section header */ -#define EMSCN 39 /* Could not read COFF section */ -#define EMCLOSE 40 /* Could not close COFF file */ - -/* Log file errors */ -#define EMLOGOPEN 41 /* Could not open log file */ -#define EMLOGREAD 42 /* Could not read log file */ -#define EMLOGWRITE 43 /* Could not write to log file */ -#define EMLOGCLOSE 44 /* Could not close log file */ - -/* Command file errors */ -#define EMCMDOPEN 45 /* Could not open command file */ -#define EMCMDREAD 46 /* Could not read command file */ -#define EMCMDWRITE 47 /* Could not write to command file */ -#define EMCMDCLOSE 48 /* Could not close comand file */ - -#define EMTIMEOUT 49 /* Host timed out waiting for a message */ -#define EMCOMMTYPE 50 /* A '-t' flag must be specified */ -#define EMCOMMERR 51 /* Communication error */ -#define EMBAUD 52 /* Invalid baud rate specified */ -/* - * Memory Spaces - */ -#define LOCAL_REG 0 /* Local processor register */ -#define GLOBAL_REG 1 /* Global processor register */ -#define SPECIAL_REG 2 /* Special processor register */ -#define TLB_REG 3 /* Translation Lookaside Buffer */ -#define COPROC_REG 4 /* Coprocessor register */ -#define I_MEM 5 /* Instruction Memory */ -#define D_MEM 6 /* Data Memory */ -#define I_ROM 7 /* Instruction ROM */ -#define D_ROM 8 /* Data ROM */ -#define I_O 9 /* Input/Output */ -#define I_CACHE 10 /* Instruction Cache */ -#define D_CACHE 11 /* Data Cache */ - -/* To supress warnings for zero length array definitions */ -#define DUMMY 1 - -/* -** Host to target definitions -*/ - -#define RESET 0 -#define CONFIG_REQ 1 -#define STATUS_REQ 2 -#define READ_REQ 3 -#define WRITE_REQ 4 -#define BKPT_SET 5 -#define BKPT_RM 6 -#define BKPT_STAT 7 -#define COPY 8 -#define FILL 9 -#define INIT 10 -#define GO 11 -#define STEP 12 -#define BREAK 13 - -#define HIF_CALL_RTN 64 -#define CHANNEL0 65 -#define CHANNEL1_ACK 66 - - -/* -** Target to host definitions -*/ - -#define RESET_ACK 32 -#define CONFIG 33 -#define STATUS 34 -#define READ_ACK 35 -#define WRITE_ACK 36 -#define BKPT_SET_ACK 37 -#define BKPT_RM_ACK 38 -#define BKPT_STAT_ACK 39 -#define COPY_ACK 40 -#define FILL_ACK 41 -#define INIT_ACK 42 -#define HALT 43 - -#define ERROR 63 - -#define HIF_CALL 96 -#define CHANNEL0_ACK 97 -#define CHANNEL1 98 - - -/* A "generic" message */ -struct generic_msg_t { - INT32 code; /* generic */ - INT32 length; - BYTE byte[DUMMY]; -}; - - -/* A "generic" message (with an INT32 array) */ -struct generic_int32_msg_t { - INT32 code; /* generic */ - INT32 length; - INT32 int32[DUMMY]; -}; - - -/* -** Host to target messages -*/ - -struct reset_msg_t { - INT32 code; /* 0 */ - INT32 length; -}; - - -struct config_req_msg_t { - INT32 code; /* 1 */ - INT32 length; -}; - - -struct status_req_msg_t { - INT32 code; /* 2 */ - INT32 length; -}; - - -struct read_req_msg_t { - INT32 code; /* 3 */ - INT32 length; - INT32 memory_space; - ADDR32 address; - INT32 byte_count; -}; - - -struct write_req_msg_t { - INT32 code; /* 4 */ - INT32 length; - INT32 memory_space; - ADDR32 address; - INT32 byte_count; - BYTE data[DUMMY]; -}; - - -struct write_r_msg_t { - INT32 code; /* 4 */ - INT32 length; - INT32 memory_space; - ADDR32 address; - INT32 byte_count; - INT32 data[DUMMY]; -}; - - -struct bkpt_set_msg_t { - INT32 code; /* 5 */ - INT32 length; - INT32 memory_space; - ADDR32 bkpt_addr; - INT32 pass_count; - INT32 bkpt_type; -}; - - -struct bkpt_rm_msg_t { - INT32 code; /* 6 */ - INT32 length; - INT32 memory_space; - ADDR32 bkpt_addr; -}; - - -struct bkpt_stat_msg_t { - INT32 code; /* 7 */ - INT32 length; - INT32 memory_space; - ADDR32 bkpt_addr; -}; - - -struct copy_msg_t { - INT32 code; /* 8 */ - INT32 length; - INT32 source_space; - ADDR32 source_addr; - INT32 dest_space; - ADDR32 dest_addr; - INT32 byte_count; -}; - - -struct fill_msg_t { - INT32 code; /* 9 */ - INT32 length; - INT32 memory_space; - ADDR32 start_addr; - INT32 fill_count; - INT32 byte_count; - BYTE fill_data[DUMMY]; -}; - - -struct init_msg_t { - INT32 code; /* 10 */ - INT32 length; - ADDR32 text_start; - ADDR32 text_end; - ADDR32 data_start; - ADDR32 data_end; - ADDR32 entry_point; - INT32 mem_stack_size; - INT32 reg_stack_size; - ADDR32 arg_start; - INT32 os_control; -}; - - -struct go_msg_t { - INT32 code; /* 11 */ - INT32 length; -}; - - -struct step_msg_t { - INT32 code; /* 12 */ - INT32 length; - INT32 count; -}; - - -struct break_msg_t { - INT32 code; /* 13 */ - INT32 length; -}; - - -struct hif_call_rtn_msg_t { - INT32 code; /* 64 */ - INT32 length; - INT32 service_number; - INT32 gr121; - INT32 gr96; - INT32 gr97; -}; - - -struct channel0_msg_t { - INT32 code; /* 65 */ - INT32 length; - BYTE data; -}; - - -struct channel1_ack_msg_t { - INT32 code; /* 66 */ - INT32 length; -}; - - -/* -** Target to host messages -*/ - - -struct reset_ack_msg_t { - INT32 code; /* 32 */ - INT32 length; -}; - - -struct config_msg_t { - INT32 code; /* 33 */ - INT32 length; - INT32 processor_id; - INT32 version; - ADDR32 I_mem_start; - INT32 I_mem_size; - ADDR32 D_mem_start; - INT32 D_mem_size; - ADDR32 ROM_start; - INT32 ROM_size; - INT32 max_msg_size; - INT32 max_bkpts; - INT32 coprocessor; - INT32 reserved; -}; - - -struct status_msg_t { - INT32 code; /* 34 */ - INT32 length; - INT32 msgs_sent; - INT32 msgs_received; - INT32 errors; - INT32 bkpts_hit; - INT32 bkpts_free; - INT32 traps; - INT32 fills; - INT32 spills; - INT32 cycles; - INT32 reserved; -}; - - -struct read_ack_msg_t { - INT32 code; /* 35 */ - INT32 length; - INT32 memory_space; - ADDR32 address; - INT32 byte_count; - BYTE data[DUMMY]; -}; - -struct read_r_ack_msg_t { - INT32 code; /* 35 */ - INT32 length; - INT32 memory_space; - ADDR32 address; - INT32 byte_count; - INT32 data[DUMMY]; -}; - - -struct write_ack_msg_t { - INT32 code; /* 36 */ - INT32 length; - INT32 memory_space; - ADDR32 address; - INT32 byte_count; -}; - - -struct bkpt_set_ack_msg_t { - INT32 code; /* 37 */ - INT32 length; - INT32 memory_space; - ADDR32 address; - INT32 pass_count; - INT32 bkpt_type; -}; - - -struct bkpt_rm_ack_msg_t { - INT32 code; /* 38 */ - INT32 length; - INT32 memory_space; - ADDR32 address; -}; - - -struct bkpt_stat_ack_msg_t { - INT32 code; /* 39 */ - INT32 length; - INT32 memory_space; - ADDR32 address; - INT32 pass_count; - INT32 bkpt_type; -}; - - -struct copy_ack_msg_t { - INT32 code; /* 40 */ - INT32 length; - INT32 source_space; - ADDR32 source_addr; - INT32 dest_space; - ADDR32 dest_addr; - INT32 byte_count; -}; - - -struct fill_ack_msg_t { - INT32 code; /* 41 */ - INT32 length; - INT32 memory_space; - ADDR32 start_addr; - INT32 fill_count; - INT32 byte_count; -}; - - -struct init_ack_msg_t { - INT32 code; /* 42 */ - INT32 length; -}; - - -struct halt_msg_t { - INT32 code; /* 43 */ - INT32 length; - INT32 memory_space; - ADDR32 pc0; - ADDR32 pc1; - INT32 trap_number; -}; - - -struct error_msg_t { - INT32 code; /* 63 */ - INT32 length; - INT32 error_code; - INT32 memory_space; - ADDR32 address; -}; - - -struct hif_call_msg_t { - INT32 code; /* 96 */ - INT32 length; - INT32 service_number; - INT32 lr2; - INT32 lr3; - INT32 lr4; -}; - - -struct channel0_ack_msg_t { - INT32 code; /* 97 */ - INT32 length; -}; - - -struct channel1_msg_t { - INT32 code; /* 98 */ - INT32 length; - BYTE data[DUMMY]; -}; - - - -/* -** Union all of the message types together -*/ - -union msg_t { - struct generic_msg_t generic_msg; - struct generic_int32_msg_t generic_int32_msg; - - struct reset_msg_t reset_msg; - struct config_req_msg_t config_req_msg; - struct status_req_msg_t status_req_msg; - struct read_req_msg_t read_req_msg; - struct write_req_msg_t write_req_msg; - struct write_r_msg_t write_r_msg; - struct bkpt_set_msg_t bkpt_set_msg; - struct bkpt_rm_msg_t bkpt_rm_msg; - struct bkpt_stat_msg_t bkpt_stat_msg; - struct copy_msg_t copy_msg; - struct fill_msg_t fill_msg; - struct init_msg_t init_msg; - struct go_msg_t go_msg; - struct step_msg_t step_msg; - struct break_msg_t break_msg; - - struct hif_call_rtn_msg_t hif_call_rtn_msg; - struct channel0_msg_t channel0_msg; - struct channel1_ack_msg_t channel1_ack_msg; - - struct reset_ack_msg_t reset_ack_msg; - struct config_msg_t config_msg; - struct status_msg_t status_msg; - struct read_ack_msg_t read_ack_msg; - struct read_r_ack_msg_t read_r_ack_msg; - struct write_ack_msg_t write_ack_msg; - struct bkpt_set_ack_msg_t bkpt_set_ack_msg; - struct bkpt_rm_ack_msg_t bkpt_rm_ack_msg; - struct bkpt_stat_ack_msg_t bkpt_stat_ack_msg; - struct copy_ack_msg_t copy_ack_msg; - struct fill_ack_msg_t fill_ack_msg; - struct init_ack_msg_t init_ack_msg; - struct halt_msg_t halt_msg; - - struct error_msg_t error_msg; - - struct hif_call_msg_t hif_call_msg; - struct channel0_ack_msg_t channel0_ack_msg; - struct channel1_msg_t channel1_msg; -}; diff --git a/contrib/gdb/gdb/mon960-rom.c b/contrib/gdb/gdb/mon960-rom.c deleted file mode 100644 index 5a79923..0000000 --- a/contrib/gdb/gdb/mon960-rom.c +++ /dev/null @@ -1,270 +0,0 @@ -/* Remote target glue for the Intel 960 ROM monitor. - Copyright 1995, 1996 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - - -#include "defs.h" -#include "gdbcore.h" -#include "target.h" -#include "monitor.h" -#include "serial.h" -#include "srec.h" -#include "xmodem.h" - -#if !defined (HAVE_TERMIOS) && !defined (HAVE_TERMIO) && !defined (HAVE_SGTTY) -#define HAVE_SGTTY -#endif - -#ifdef HAVE_SGTTY -#include -#endif - -#include /* Needed by file.h on Sys V */ -#include -#include -#include - -#define USE_GENERIC_LOAD - -int quiet = 0; /* 1 => stifle unnecessary messages */ -serial_t mon960_serial; -char *mon960_ttyname; /* name of tty to talk to mon960 on, or null */ -static struct monitor_ops mon960_cmds; - -#ifdef USE_GENERIC_LOAD -extern void generic_load PARAMS ((char* filename, int from_tty)); -#endif -static void mon960_open PARAMS ((char *args, int from_tty)); - -#ifdef USE_GENERIC_LOAD -static void -mon960_load_gen (filename, from_tty) - char *filename; - int from_tty; -{ - extern int inferior_pid; - generic_load (filename, from_tty); - /* Finally, make the PC point at the start address */ - if (exec_bfd) - write_pc (bfd_get_start_address (exec_bfd)); - - inferior_pid = 0; /* No process now */ -} - -#else -static void -mon960_load (desc, file, hashmark) - serial_t desc; - char *file; - int hashmark; -{ - bfd *abfd; - asection *s; - char *buffer; - int i; - - buffer = alloca (XMODEM_PACKETSIZE); - abfd = bfd_openr (file, 0); - if (!abfd) - { - printf_filtered ("Unable to open file %s\n", file); - return; - } - if (bfd_check_format (abfd, bfd_object) == 0) - { - printf_filtered ("File is not an object file\n"); - return; - } - for (s = abfd->sections; s; s = s->next) - if (s->flags & SEC_LOAD) - { - bfd_size_type section_size; - printf_filtered ("%s\t: 0x%4x .. 0x%4x ", s->name, s->vma, - s->vma + s->_raw_size); - gdb_flush (gdb_stdout); - monitor_printf (mon960_cmds.load, s->vma); - if (mon960_cmds.loadresp) - monitor_expect (mon960_cmds.loadresp, NULL, 0); - xmodem_init_xfer (desc); - section_size = bfd_section_size (abfd, s); - for (i = 0; i < section_size; i += XMODEM_DATASIZE) - { - int numbytes; - numbytes = min (XMODEM_DATASIZE, section_size - i); - bfd_get_section_contents (abfd, s, buffer + XMODEM_DATAOFFSET, i, - numbytes); - xmodem_send_packet (desc, buffer, numbytes, hashmark); - if (hashmark) - { - putchar_unfiltered ('#'); - gdb_flush (gdb_stdout); - } - } /* Per-packet (or S-record) loop */ - xmodem_finish_xfer (desc); - monitor_expect_prompt (NULL, 0); - putchar_unfiltered ('\n'); - } /* Loadable sections */ - if (hashmark) - putchar_unfiltered ('\n'); -} -#endif - -/* This array of registers need to match the indexes used by GDB. - This exists because the various ROM monitors use different strings - than does GDB, and don't necessarily support all the registers - either. So, typing "info reg sp" becomes a "r30". */ - -/* these correspond to the offsets from tm-* files from config directories */ -/* g0-g14, fp, pfp, sp, rip,r3-15, pc, ac, tc, fp0-3 */ -/* NOTE: "ip" is documented as "ir" in the Mon960 UG. */ -/* NOTE: "ir" can't be accessed... but there's an ip and rip. */ -static char *mon960_regnames[NUM_REGS] = { - /* 0 */ "pfp", "sp", "rip", "r3", "r4", "r5", "r6", "r7", \ - /* 8 */ "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",\ - /* 16 */ "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7", \ - /* 24 */ "g8", "g9", "g10", "g11", "g12", "g13", "g14", "fp", \ - /* 32 */ "pc", "ac", "tc", "ip", "fp0", "fp1", "fp2", "fp3",\ - }; - -/* Define the monitor command strings. Since these are passed directly - through to a printf style function, we may include formatting - strings. We also need a CR or LF on the end. */ - -static struct target_ops mon960_ops; - -/* need to pause the monitor for timing reasons, so slow it down */ -static char *mon960_inits[] = {"\n\r\r\r\r\r\r\r\r\r\r\r\r\r\r\n\r\n\r\n", NULL}; /* Exits sub-command mode & download cmds */ - -static struct monitor_ops mon960_cmds = -{ - MO_CLR_BREAK_USES_ADDR - | MO_NO_ECHO_ON_OPEN - | MO_SEND_BREAK_ON_STOP - | MO_GETMEM_READ_SINGLE, /* flags */ - mon960_inits, /* Init strings */ - "go\n\r", /* continue command */ - "st\n\r", /* single step */ - "\n\r", /* break interrupts the program */ - NULL, /* set a breakpoint */ - /* can't use "br" because only 2 hw bps are supported */ - NULL, /* clear a breakpoint - "de" is for hw bps */ - NULL, /* clear all breakpoints */ - NULL, /* fill (start end val) */ - /* can't use "fi" because it takes words, not bytes */ - { - /* can't use "mb", "md" or "mo" because they require interaction */ - NULL, /* setmem.cmdb (addr, value) */ - "md %x %x\n\r", /* setmem.cmdw (addr, value) */ - NULL, /* setmem.cmdl (addr, value) */ - NULL, /* setmem.cmdll (addr, value) */ - NULL, /* setmem.resp_delim */ - NULL, /* setmem.term */ - NULL, /* setmem.term_cmd */ - }, - { - /* since the parsing of multiple bytes is difficult due to - interspersed addresses, we'll only read 1 value at a time, - even tho these can handle a count */ - "db %x\n\r", /* getmem.cmdb (addr, #bytes) */ - "ds %x\n\r", /* getmem.cmdw (addr, #swords) */ - "di %x\n\r", /* getmem.cmdl (addr, #words) */ - "dd %x\n\r", /* getmem.cmdll (addr, #dwords) */ - " : ", /* getmem.resp_delim */ - NULL, /* getmem.term */ - NULL, /* getmem.term_cmd */ - }, - { - "md %s %x\n\r", /* setreg.cmd (name, value) */ - NULL, /* setreg.resp_delim */ - NULL, /* setreg.term */ - NULL /* setreg.term_cmd */ - }, - { - "di %s\n\r", /* getreg.cmd (name) */ - " : ", /* getreg.resp_delim */ - NULL, /* getreg.term */ - NULL, /* getreg.term_cmd */ - }, - "re\n\r", /* dump_registers */ - "\\(\\w+\\)=\\([0-9a-fA-F]+\\)", /* register_pattern */ - NULL, /* supply_register */ -#ifdef USE_GENERIC_LOAD - NULL, /* load_routine (defaults to SRECs) */ - NULL, /* download command */ - NULL, /* load response */ -#else - mon960_load, /* load_routine (defaults to SRECs) */ - "do\n\r", /* download command */ - "Downloading\n\r", /* load response */ -#endif - "=>", /* monitor command prompt */ - "\n\r", /* end-of-command delimitor */ - NULL, /* optional command terminator */ - &mon960_ops, /* target operations */ - SERIAL_1_STOPBITS, /* number of stop bits */ - mon960_regnames, /* registers names */ - MONITOR_OPS_MAGIC /* magic */ -}; - -/* invoked from monitor.c - opens the serial port */ -static void -mon960_open (args, from_tty) - char *args; - int from_tty; -{ - char *serial_port_name = args; - if (args) - { - char *cursor = serial_port_name = strsave (args); - - while (*cursor && *cursor != ' ') - cursor++; - - if (*cursor) - *cursor++ = 0; - - while (*cursor == ' ') - cursor++; - - } - monitor_open (serial_port_name, &mon960_cmds, from_tty); -} - - -void -_initialize_mon960 () -{ - init_monitor_ops (&mon960_ops); - - mon960_ops.to_shortname = "mon960"; /* for the target command */ - mon960_ops.to_longname = "Intel 960 rom monitor"; -#ifdef USE_GENERIC_LOAD - mon960_ops.to_load = mon960_load_gen; /* FIXME - should go back and try "do" */ -#endif - /* use SW breaks; target only supports 2 HW breakpoints */ - mon960_ops.to_insert_breakpoint = memory_insert_breakpoint; - mon960_ops.to_remove_breakpoint = memory_remove_breakpoint; - - mon960_ops.to_doc = - "Debug on an Intel 960 eval board running the Mon960 rom monitor.\n" - "Specify the serial device it is connected to (e.g. /dev/ttya)."; - - mon960_ops.to_open = mon960_open; - add_target (&mon960_ops); -} - diff --git a/contrib/gdb/gdb/monitor.c b/contrib/gdb/gdb/monitor.c deleted file mode 100644 index db8913c..0000000 --- a/contrib/gdb/gdb/monitor.c +++ /dev/null @@ -1,1541 +0,0 @@ -/* Remote debugging interface for boot monitors, for GDB. - Copyright 1990, 1991, 1992, 1993, 1995, 1996 - Free Software Foundation, Inc. - Contributed by Cygnus Support. Written by Rob Savoye for Cygnus. - Resurrected from the ashes by Stu Grossman. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* This file was derived from various remote-* modules. It is a collection - of generic support functions so GDB can talk directly to a ROM based - monitor. This saves use from having to hack an exception based handler - into existance, and makes for quick porting. - - This module talks to a debug monitor called 'MONITOR', which - We communicate with MONITOR via either a direct serial line, or a TCP - (or possibly TELNET) stream to a terminal multiplexor, - which in turn talks to the target board. */ - -#include "defs.h" -#include "gdbcore.h" -#include "target.h" -#include "wait.h" -#ifdef ANSI_PROTOTYPES -#include -#else -#include -#endif -#include -#include -#include "gdb_string.h" -#include -#include "command.h" -#include "serial.h" -#include "monitor.h" -#include "gdbcmd.h" -#include "inferior.h" -#include "gnu-regex.h" -#include "dcache.h" -#include "srec.h" - -static int readchar PARAMS ((int timeout)); - -static void monitor_command PARAMS ((char *args, int fromtty)); - -static void monitor_fetch_register PARAMS ((int regno)); -static void monitor_store_register PARAMS ((int regno)); - -static void monitor_detach PARAMS ((char *args, int from_tty)); -static void monitor_resume PARAMS ((int pid, int step, enum target_signal sig)); -static void monitor_interrupt PARAMS ((int signo)); -static void monitor_interrupt_twice PARAMS ((int signo)); -static void monitor_interrupt_query PARAMS ((void)); -static void monitor_wait_cleanup PARAMS ((int old_timeout)); - -static int monitor_wait PARAMS ((int pid, struct target_waitstatus *status)); -static void monitor_fetch_registers PARAMS ((int regno)); -static void monitor_store_registers PARAMS ((int regno)); -static void monitor_prepare_to_store PARAMS ((void)); -static int monitor_xfer_memory PARAMS ((CORE_ADDR memaddr, char *myaddr, int len, int write, struct target_ops *target)); -static void monitor_files_info PARAMS ((struct target_ops *ops)); -static int monitor_insert_breakpoint PARAMS ((CORE_ADDR addr, char *shadow)); -static int monitor_remove_breakpoint PARAMS ((CORE_ADDR addr, char *shadow)); -static void monitor_kill PARAMS ((void)); -static void monitor_load PARAMS ((char *file, int from_tty)); -static void monitor_mourn_inferior PARAMS ((void)); -static void monitor_stop PARAMS ((void)); -static void monitor_debug PARAMS ((char *prefix, char *string, char *suffix)); - -static int monitor_read_memory PARAMS ((CORE_ADDR addr, char *myaddr,int len)); -static int monitor_write_memory PARAMS ((CORE_ADDR addr, char *myaddr,int len)); - -static int monitor_expect_regexp PARAMS ((struct re_pattern_buffer *pat, - char *buf, int buflen)); -static int from_hex PARAMS ((int a)); -static unsigned long get_hex_word PARAMS ((void)); - -static struct monitor_ops *current_monitor; - -static int hashmark; /* flag set by "set hash" */ - -static int timeout = 30; - -static int in_monitor_wait = 0; /* Non-zero means we are in monitor_wait() */ - -static void (*ofunc)(); /* Old SIGINT signal handler */ - -/* Descriptor for I/O to remote machine. Initialize it to NULL so - that monitor_open knows that we don't have a file open when the - program starts. */ - -static serial_t monitor_desc = NULL; - -/* Pointer to regexp pattern matching data */ - -static struct re_pattern_buffer register_pattern; -static char register_fastmap[256]; - -static struct re_pattern_buffer getmem_resp_delim_pattern; -static char getmem_resp_delim_fastmap[256]; - -static int dump_reg_flag; /* Non-zero means do a dump_registers cmd when - monitor_wait wakes up. */ - -static DCACHE *remote_dcache; - -/* monitor_debug is like fputs_unfiltered, except it prints special - characters in printable fashion. */ - -static void -monitor_debug (prefix, string, suffix) - char *prefix; - char *string; - char *suffix; -{ - int ch; - - /* print prefix and suffix after each line */ - static int new_line=1; - if (new_line==1) { /* print prefix if last char was a newline */ - fputs_unfiltered (prefix, gdb_stderr); - new_line=0; - } - if (strchr(string,'\n')) /* save state for next call */ - new_line=1; - - while ((ch = *string++) != '\0') - { - switch (ch) { - default: - if (isprint (ch)) - fputc_unfiltered (ch, gdb_stderr); - - else - fprintf_unfiltered (gdb_stderr, "\\%03o", ch); - - break; - - case '\\': fputs_unfiltered ("\\\\", gdb_stderr); break; - case '\b': fputs_unfiltered ("\\b", gdb_stderr); break; - case '\f': fputs_unfiltered ("\\f", gdb_stderr); break; - case '\n': fputs_unfiltered ("\\n", gdb_stderr); break; - case '\r': fputs_unfiltered ("\\r", gdb_stderr); break; - case '\t': fputs_unfiltered ("\\t", gdb_stderr); break; - case '\v': fputs_unfiltered ("\\v", gdb_stderr); break; - } - } - - if (new_line==1) { /* print suffix if last char was a newline */ - fputs_unfiltered (suffix, gdb_stderr); - fputs_unfiltered ("\n", gdb_stderr); - } -} - -/* monitor_printf_noecho -- Send data to monitor, but don't expect an echo. - Works just like printf. */ - -void -#ifdef ANSI_PROTOTYPES -monitor_printf_noecho (char *pattern, ...) -#else -monitor_printf_noecho (va_alist) - va_dcl -#endif -{ - va_list args; - char sndbuf[2000]; - int len; - -#if ANSI_PROTOTYPES - va_start (args, pattern); -#else - char *pattern; - va_start (args); - pattern = va_arg (args, char *); -#endif - - vsprintf (sndbuf, pattern, args); - - if (remote_debug > 0) - monitor_debug ("sent -->", sndbuf, "<--"); - - len = strlen (sndbuf); - - if (len + 1 > sizeof sndbuf) - abort (); - - if (SERIAL_WRITE(monitor_desc, sndbuf, len)) - fprintf_unfiltered (stderr, "SERIAL_WRITE failed: %s\n", safe_strerror (errno)); -} - -/* monitor_printf -- Send data to monitor and check the echo. Works just like - printf. */ - -void -#ifdef ANSI_PROTOTYPES -monitor_printf (char *pattern, ...) -#else -monitor_printf (va_alist) - va_dcl -#endif -{ - va_list args; - char sndbuf[2000]; - int len; - -#ifdef ANSI_PROTOTYPES - va_start (args, pattern); -#else - char *pattern; - va_start (args); - pattern = va_arg (args, char *); -#endif - - vsprintf (sndbuf, pattern, args); - - if (remote_debug > 0) - monitor_debug ("sent -->", sndbuf, "<--"); - - len = strlen (sndbuf); - - if (len + 1 > sizeof sndbuf) - abort (); - - if (SERIAL_WRITE(monitor_desc, sndbuf, len)) - fprintf_unfiltered (stderr, "SERIAL_WRITE failed: %s\n", safe_strerror (errno)); - - /* We used to expect that the next immediate output was the characters we - just output, but sometimes some extra junk appeared before the characters - we expected, like an extra prompt, or a portmaster sending telnet negotiations. - So, just start searching for what we sent, and skip anything unknown. */ - monitor_expect (sndbuf, (char *)0, 0); -} - -/* Read a character from the remote system, doing all the fancy - timeout stuff. */ - -static int -readchar (timeout) - int timeout; -{ - int c; - static enum { last_random, last_nl, last_cr, last_crnl } state = last_random; - int looping; - - do - { - looping = 0; - c = SERIAL_READCHAR (monitor_desc, timeout); - - if (c >= 0) - { - c &= 0x7f; - if (remote_debug > 0) - { - char buf[2]; - buf[0] = c; - buf[1] = '\0'; - monitor_debug ("read -->", buf, "<--"); - } - } - - /* Canonicialize \n\r combinations into one \r */ - if ((current_monitor->flags & MO_HANDLE_NL) != 0) - { - if ((c == '\r' && state == last_nl) - || (c == '\n' && state == last_cr)) - { - state = last_crnl; - looping = 1; - } - else if (c == '\r') - state = last_cr; - else if (c != '\n') - state = last_random; - else - { - state = last_nl; - c = '\r'; - } - } - } - while (looping); - - if (c >= 0) - return c; - - if (c == SERIAL_TIMEOUT) -#ifdef MAINTENANCE_CMDS - if (in_monitor_wait) /* Watchdog went off */ - { - target_mourn_inferior (); - error ("Watchdog has expired. Target detached.\n"); - } - else -#endif - error ("Timeout reading from remote system."); - - perror_with_name ("remote-monitor"); -} - -/* Scan input from the remote system, until STRING is found. If BUF is non- - zero, then collect input until we have collected either STRING or BUFLEN-1 - chars. In either case we terminate BUF with a 0. If input overflows BUF - because STRING can't be found, return -1, else return number of chars in BUF - (minus the terminating NUL). Note that in the non-overflow case, STRING - will be at the end of BUF. */ - -int -monitor_expect (string, buf, buflen) - char *string; - char *buf; - int buflen; -{ - char *p = string; - int obuflen = buflen; - int c; - - immediate_quit = 1; - while (1) - { - if (buf) - { - if (buflen < 2) - { - *buf = '\000'; - immediate_quit = 0; - return -1; - } - - c = readchar (timeout); - if (c == '\000') - continue; - *buf++ = c; - buflen--; - } - else - c = readchar (timeout); - - /* Don't expect any ^C sent to be echoed */ - - if (*p == '\003' || c == *p) - { - p++; - if (*p == '\0') - { - immediate_quit = 0; - - if (buf) - { - *buf++ = '\000'; - return obuflen - buflen; - } - else - return 0; - } - } - else - { - p = string; - if (c == *p) - p++; - } - } -} - -/* Search for a regexp. */ - -static int -monitor_expect_regexp (pat, buf, buflen) - struct re_pattern_buffer *pat; - char *buf; - int buflen; -{ - char *mybuf; - char *p; - - if (buf) - mybuf = buf; - else - { - mybuf = alloca (1024); - buflen = 1024; - } - - p = mybuf; - while (1) - { - int retval; - - if (p - mybuf >= buflen) - { /* Buffer about to overflow */ - -/* On overflow, we copy the upper half of the buffer to the lower half. Not - great, but it usually works... */ - - memcpy (mybuf, mybuf + buflen / 2, buflen / 2); - p = mybuf + buflen / 2; - } - - *p++ = readchar (timeout); - - retval = re_search (pat, mybuf, p - mybuf, 0, p - mybuf, NULL); - if (retval >= 0) - return 1; - } -} - -/* Keep discarding input until we see the MONITOR prompt. - - The convention for dealing with the prompt is that you - o give your command - o *then* wait for the prompt. - - Thus the last thing that a procedure does with the serial line - will be an monitor_expect_prompt(). Exception: monitor_resume does not - wait for the prompt, because the terminal is being handed over - to the inferior. However, the next thing which happens after that - is a monitor_wait which does wait for the prompt. - Note that this includes abnormal exit, e.g. error(). This is - necessary to prevent getting into states from which we can't - recover. */ - -int -monitor_expect_prompt (buf, buflen) - char *buf; - int buflen; -{ - return monitor_expect (PROMPT, buf, buflen); -} - -/* Get N 32-bit words from remote, each preceded by a space, and put - them in registers starting at REGNO. */ - -static unsigned long -get_hex_word () -{ - unsigned long val; - int i; - int ch; - - do - ch = readchar (timeout); - while (isspace(ch)); - - val = from_hex (ch); - - for (i = 7; i >= 1; i--) - { - ch = readchar (timeout); - if (!isxdigit (ch)) - break; - val = (val << 4) | from_hex (ch); - } - - return val; -} - -static void -compile_pattern (pattern, compiled_pattern, fastmap) - char *pattern; - struct re_pattern_buffer *compiled_pattern; - char *fastmap; -{ - int tmp; - char *val; - - compiled_pattern->fastmap = fastmap; - - tmp = re_set_syntax (RE_SYNTAX_EMACS); - val = re_compile_pattern (pattern, - strlen (pattern), - compiled_pattern); - re_set_syntax (tmp); - - if (val) - error ("compile_pattern: Can't compile pattern string `%s': %s!", pattern, val); - - if (fastmap) - re_compile_fastmap (compiled_pattern); -} - -/* Open a connection to a remote debugger. NAME is the filename used - for communication. */ - -static char *dev_name; -static struct target_ops *targ_ops; - -void -monitor_open (args, mon_ops, from_tty) - char *args; - struct monitor_ops *mon_ops; - int from_tty; -{ - char *name; - int i; - char **p; - - if (mon_ops->magic != MONITOR_OPS_MAGIC) - error ("Magic number of monitor_ops struct wrong."); - - targ_ops = mon_ops->target; - name = targ_ops->to_shortname; - - if (!args) - error ("Use `target %s DEVICE-NAME' to use a serial port, or \n\ -`target %s HOST-NAME:PORT-NUMBER' to use a network connection.", name, name); - - target_preopen (from_tty); - - /* Setup pattern for register dump */ - - if (mon_ops->register_pattern) - compile_pattern (mon_ops->register_pattern, ®ister_pattern, - register_fastmap); - - if (mon_ops->getmem.resp_delim) - compile_pattern (mon_ops->getmem.resp_delim, &getmem_resp_delim_pattern, - getmem_resp_delim_fastmap); - - unpush_target (targ_ops); - - if (dev_name) - free (dev_name); - dev_name = strsave (args); - - monitor_desc = SERIAL_OPEN (dev_name); - - if (!monitor_desc) - perror_with_name (dev_name); - - if (baud_rate != -1) - { - if (SERIAL_SETBAUDRATE (monitor_desc, baud_rate)) - { - SERIAL_CLOSE (monitor_desc); - perror_with_name (dev_name); - } - } - - SERIAL_RAW (monitor_desc); - - SERIAL_FLUSH_INPUT (monitor_desc); - - /* some systems only work with 2 stop bits */ - - SERIAL_SETSTOPBITS (monitor_desc, mon_ops->stopbits); - - current_monitor = mon_ops; - - /* See if we can wake up the monitor. First, try sending a stop sequence, - then send the init strings. Last, remove all breakpoints. */ - - if (current_monitor->stop) - { - monitor_stop (); - if ((current_monitor->flags & MO_NO_ECHO_ON_OPEN) == 0) - { - monitor_expect_prompt (NULL, 0); - } - } - - /* wake up the monitor and see if it's alive */ - for (p = mon_ops->init; *p != NULL; p++) - { - /* Some of the characters we send may not be echoed, - but we hope to get a prompt at the end of it all. */ - - if ((current_monitor->flags & MO_NO_ECHO_ON_OPEN) == 0) - monitor_printf(*p); - else - monitor_printf_noecho (*p); - monitor_expect_prompt (NULL, 0); - } - - SERIAL_FLUSH_INPUT (monitor_desc); - - /* Remove all breakpoints */ - - if (mon_ops->clr_all_break) - { - monitor_printf (mon_ops->clr_all_break); - monitor_expect_prompt (NULL, 0); - } - - if (from_tty) - printf_unfiltered ("Remote target %s connected to %s\n", name, dev_name); - - push_target (targ_ops); - - inferior_pid = 42000; /* Make run command think we are busy... */ - - /* Give monitor_wait something to read */ - - monitor_printf (current_monitor->line_term); - - remote_dcache = dcache_init (monitor_read_memory, monitor_write_memory); - - start_remote (); -} - -/* Close out all files and local state before this target loses - control. */ - -void -monitor_close (quitting) - int quitting; -{ - if (monitor_desc) - SERIAL_CLOSE (monitor_desc); - monitor_desc = NULL; -} - -/* Terminate the open connection to the remote debugger. Use this - when you want to detach and do something else with your gdb. */ - -static void -monitor_detach (args, from_tty) - char *args; - int from_tty; -{ - pop_target (); /* calls monitor_close to do the real work */ - if (from_tty) - printf_unfiltered ("Ending remote %s debugging\n", target_shortname); -} - -/* Convert VALSTR into the target byte-ordered value of REGNO and store it. */ - -char * -monitor_supply_register (regno, valstr) - int regno; - char *valstr; -{ - unsigned LONGEST val; - unsigned char regbuf[MAX_REGISTER_RAW_SIZE]; - char *p; - - val = strtoul (valstr, &p, 16); - - if (val == 0 && valstr == p) - error ("monitor_supply_register (%d): bad value from monitor: %s.", - regno, valstr); - - /* supply register stores in target byte order, so swap here */ - - store_unsigned_integer (regbuf, REGISTER_RAW_SIZE (regno), val); - - supply_register (regno, regbuf); - - return p; -} - -/* Tell the remote machine to resume. */ - -static void -monitor_resume (pid, step, sig) - int pid, step; - enum target_signal sig; -{ - dcache_flush (remote_dcache); - if (step) - monitor_printf (STEP_CMD); - else - { - monitor_printf (CONT_CMD); - if (current_monitor->flags & MO_NEED_REGDUMP_AFTER_CONT) - dump_reg_flag = 1; - } -} - -/* Parse the output of a register dump command. A monitor specific - regexp is used to extract individual register descriptions of the - form REG=VAL. Each description is split up into a name and a value - string which are passed down to monitor specific code. */ - -static char * -parse_register_dump (buf, len) - char *buf; - int len; -{ - while (1) - { - int regnamelen, vallen; - char *regname, *val; - /* Element 0 points to start of register name, and element 1 - points to the start of the register value. */ - struct re_registers register_strings; - - if (re_search (®ister_pattern, buf, len, 0, len, - ®ister_strings) == -1) - break; - - regnamelen = register_strings.end[1] - register_strings.start[1]; - regname = buf + register_strings.start[1]; - vallen = register_strings.end[2] - register_strings.start[2]; - val = buf + register_strings.start[2]; - - current_monitor->supply_register (regname, regnamelen, val, vallen); - - buf += register_strings.end[0]; - len -= register_strings.end[0]; - } -} - -/* Send ^C to target to halt it. Target will respond, and send us a - packet. */ - -static void -monitor_interrupt (signo) - int signo; -{ - /* If this doesn't work, try more severe steps. */ - signal (signo, monitor_interrupt_twice); - - if (remote_debug) - printf_unfiltered ("monitor_interrupt called\n"); - - target_stop (); -} - -/* The user typed ^C twice. */ - -static void -monitor_interrupt_twice (signo) - int signo; -{ - signal (signo, ofunc); - - monitor_interrupt_query (); - - signal (signo, monitor_interrupt); -} - -/* Ask the user what to do when an interrupt is received. */ - -static void -monitor_interrupt_query () -{ - target_terminal_ours (); - - if (query ("Interrupted while waiting for the program.\n\ -Give up (and stop debugging it)? ")) - { - target_mourn_inferior (); - return_to_top_level (RETURN_QUIT); - } - - target_terminal_inferior (); -} - -static void -monitor_wait_cleanup (old_timeout) - int old_timeout; -{ - timeout = old_timeout; - signal (SIGINT, ofunc); - in_monitor_wait = 0; -} - -/* Wait until the remote machine stops, then return, storing status in - status just as `wait' would. */ - -static int -monitor_wait (pid, status) - int pid; - struct target_waitstatus *status; -{ - int old_timeout = timeout; - char buf[1024]; - int resp_len; - struct cleanup *old_chain; - - status->kind = TARGET_WAITKIND_EXITED; - status->value.integer = 0; - - old_chain = make_cleanup (monitor_wait_cleanup, old_timeout); - -#ifdef MAINTENANCE_CMDS - in_monitor_wait = 1; - timeout = watchdog > 0 ? watchdog : -1; -#else - timeout = -1; /* Don't time out -- user program is running. */ -#endif - - ofunc = (void (*)()) signal (SIGINT, monitor_interrupt); - - do - { - resp_len = monitor_expect_prompt (buf, sizeof (buf)); - - if (resp_len <= 0) - fprintf_unfiltered (gdb_stderr, "monitor_wait: excessive response from monitor: %s.", buf); - } - while (resp_len < 0); - - signal (SIGINT, ofunc); - - timeout = old_timeout; - - if (dump_reg_flag && current_monitor->dump_registers) - { - dump_reg_flag = 0; - - monitor_printf (current_monitor->dump_registers); - resp_len = monitor_expect_prompt (buf, sizeof (buf)); - } - - if (current_monitor->register_pattern) - parse_register_dump (buf, resp_len); - - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_TRAP; - - discard_cleanups (old_chain); - - in_monitor_wait = 0; - - return inferior_pid; -} - -/* Fetch register REGNO, or all registers if REGNO is -1. Returns - errno value. */ - -static void -monitor_fetch_register (regno) - int regno; -{ - char *name; - static char zerobuf[MAX_REGISTER_RAW_SIZE] = {0}; - char regbuf[MAX_REGISTER_RAW_SIZE * 2 + 1]; - int i; - - name = REGNAMES (regno); - - if (!name) - { - supply_register (regno, zerobuf); - return; - } - - /* send the register examine command */ - - monitor_printf (current_monitor->getreg.cmd, name); - - /* If RESP_DELIM is specified, we search for that as a leading - delimiter for the register value. Otherwise, we just start - searching from the start of the buf. */ - - if (current_monitor->getreg.resp_delim) - monitor_expect (current_monitor->getreg.resp_delim, NULL, 0); - - /* Read upto the maximum number of hex digits for this register, skipping - spaces, but stop reading if something else is seen. Some monitors - like to drop leading zeros. */ - - for (i = 0; i < REGISTER_RAW_SIZE (regno) * 2; i++) - { - int c; - c = readchar (timeout); - while (c == ' ') - c = readchar (timeout); - - if (!isxdigit (c)) - break; - - regbuf[i] = c; - } - - regbuf[i] = '\000'; /* terminate the number */ - - /* If TERM is present, we wait for that to show up. Also, (if TERM - is present), we will send TERM_CMD if that is present. In any - case, we collect all of the output into buf, and then wait for - the normal prompt. */ - - if (current_monitor->getreg.term) - { - monitor_expect (current_monitor->getreg.term, NULL, 0); /* get response */ - - if (current_monitor->getreg.term_cmd) - { - monitor_printf (current_monitor->getreg.term_cmd); - monitor_expect_prompt (NULL, 0); - } - } - else - monitor_expect_prompt (NULL, 0); /* get response */ - - monitor_supply_register (regno, regbuf); -} - -/* Read the remote registers into the block regs. */ - -static void monitor_dump_regs () -{ - if (current_monitor->dump_registers) - { - char buf[200]; - int resp_len; - - monitor_printf (current_monitor->dump_registers); - resp_len = monitor_expect_prompt (buf, sizeof (buf)); - parse_register_dump (buf, resp_len); - } - else - abort(); /* Need some way to read registers */ -} - -static void -monitor_fetch_registers (regno) - int regno; -{ - if (current_monitor->getreg.cmd) - { - if (regno >= 0) - { - monitor_fetch_register (regno); - return; - } - - for (regno = 0; regno < NUM_REGS; regno++) - monitor_fetch_register (regno); - } - else { - monitor_dump_regs (); - } -} - -/* Store register REGNO, or all if REGNO == 0. Return errno value. */ - -static void -monitor_store_register (regno) - int regno; -{ - char *name; - unsigned LONGEST val; - - name = REGNAMES (regno); - if (!name) - return; - - val = read_register (regno); - - /* send the register deposit command */ - - monitor_printf (current_monitor->setreg.cmd, name, val); - -/* It's possible that there are actually some monitors out there that - will prompt you when you set a register. In that case, you may - need to add some code here to deal with TERM and TERM_CMD (see - monitor_fetch_register to get an idea of what's needed...) */ - - monitor_expect_prompt (NULL, 0); -} - -/* Store the remote registers. */ - -static void -monitor_store_registers (regno) - int regno; -{ - if (regno >= 0) - { - monitor_store_register (regno); - return; - } - - for (regno = 0; regno < NUM_REGS; regno++) - monitor_store_register (regno); -} - -/* Get ready to modify the registers array. On machines which store - individual registers, this doesn't need to do anything. On machines - which store all the registers in one fell swoop, this makes sure - that registers contains all the registers from the program being - debugged. */ - -static void -monitor_prepare_to_store () -{ - /* Do nothing, since we can store individual regs */ -} - -static void -monitor_files_info (ops) - struct target_ops *ops; -{ - printf_unfiltered ("\tAttached to %s at %d baud.\n", dev_name, baud_rate); -} - -static int -monitor_write_memory (memaddr, myaddr, len) - CORE_ADDR memaddr; - char *myaddr; - int len; -{ - unsigned LONGEST val; - char *cmd; - int i; - - /* Use memory fill command for leading 0 bytes. */ - - if (current_monitor->fill) - { - for (i = 0; i < len; i++) - if (myaddr[i] != 0) - break; - - if (i > 4) /* More than 4 zeros is worth doing */ - { - if (current_monitor->flags & MO_FILL_USES_ADDR) - monitor_printf (current_monitor->fill, memaddr, memaddr + i, 0); - else - monitor_printf (current_monitor->fill, memaddr, i, 0); - - monitor_expect_prompt (NULL, 0); - - return i; - } - } - - if ((memaddr & 0x7) == 0 && len >= 8 && current_monitor->setmem.cmdll) - { - len = 8; - cmd = current_monitor->setmem.cmdll; - } - else if ((memaddr & 0x3) == 0 && len >= 4 && current_monitor->setmem.cmdl) - { - len = 4; - cmd = current_monitor->setmem.cmdl; - } - else if ((memaddr & 0x1) == 0 && len >= 2 && current_monitor->setmem.cmdw) - { - len = 2; - cmd = current_monitor->setmem.cmdw; - } - else - { - len = 1; - cmd = current_monitor->setmem.cmdb; - } - - val = extract_unsigned_integer (myaddr, len); - - monitor_printf (cmd, memaddr, val); - - monitor_expect_prompt (NULL, 0); - - return len; -} - -/* This is an alternate form of monitor_read_memory which is used for monitors - which can only read a single byte/word/etc. at a time. */ - -static int -monitor_read_memory_single (memaddr, myaddr, len) - CORE_ADDR memaddr; - char *myaddr; - int len; -{ - unsigned LONGEST val; - char membuf[sizeof(LONGEST) * 2 + 1]; - char *p; - char *cmd; - int i; - - if ((memaddr & 0x7) == 0 && len >= 8 && current_monitor->getmem.cmdll) - { - len = 8; - cmd = current_monitor->getmem.cmdll; - } - else if ((memaddr & 0x3) == 0 && len >= 4 && current_monitor->getmem.cmdl) - { - len = 4; - cmd = current_monitor->getmem.cmdl; - } - else if ((memaddr & 0x1) == 0 && len >= 2 && current_monitor->getmem.cmdw) - { - len = 2; - cmd = current_monitor->getmem.cmdw; - } - else - { - len = 1; - cmd = current_monitor->getmem.cmdb; - } - -/* Send the examine command. */ - - monitor_printf (cmd, memaddr); - -/* If RESP_DELIM is specified, we search for that as a leading delimiter for - the register value. Otherwise, we just start searching from the start of - the buf. */ - - if (current_monitor->getmem.resp_delim) - monitor_expect_regexp (&getmem_resp_delim_pattern, NULL, 0); - -/* Now, read the appropriate number of hex digits for this loc, skipping - spaces. */ - - for (i = 0; i < len * 2; i++) - { - int c; - - while (1) - { - c = readchar (timeout); - if (isxdigit (c)) - break; - if (c == ' ') - continue; - - error ("monitor_read_memory_single (0x%x): bad response from monitor: %.*s%c.", - memaddr, i, membuf, c); - } - - membuf[i] = c; - } - - membuf[i] = '\000'; /* terminate the number */ - -/* If TERM is present, we wait for that to show up. Also, (if TERM is - present), we will send TERM_CMD if that is present. In any case, we collect - all of the output into buf, and then wait for the normal prompt. */ - - if (current_monitor->getmem.term) - { - monitor_expect (current_monitor->getmem.term, NULL, 0); /* get response */ - - if (current_monitor->getmem.term_cmd) - { - monitor_printf (current_monitor->getmem.term_cmd); - monitor_expect_prompt (NULL, 0); - } - } - else - monitor_expect_prompt (NULL, 0); /* get response */ - - p = membuf; - val = strtoul (membuf, &p, 16); - - if (val == 0 && membuf == p) - error ("monitor_read_memory_single (0x%x): bad value from monitor: %s.", - memaddr, membuf); - - /* supply register stores in target byte order, so swap here */ - - store_unsigned_integer (myaddr, len, val); - - return len; -} - -/* Copy LEN bytes of data from debugger memory at MYADDR to inferior's memory - at MEMADDR. Returns length moved. Currently, we only do one byte at a - time. */ - -static int -monitor_read_memory (memaddr, myaddr, len) - CORE_ADDR memaddr; - char *myaddr; - int len; -{ - unsigned LONGEST val; - unsigned char regbuf[MAX_REGISTER_RAW_SIZE]; - char buf[512]; - char *p, *p1; - char *name; - int resp_len; - int i; - - if (current_monitor->flags & MO_GETMEM_READ_SINGLE) - return monitor_read_memory_single (memaddr, myaddr, len); - - len = min (len, 16); - -/* See if xfer would cross a 16 byte boundary. If so, clip it. */ - if (((memaddr ^ (memaddr + len - 1)) & ~0xf) != 0) - len = ((memaddr + len) & ~0xf) - memaddr; - - /* send the memory examine command */ - - if (current_monitor->flags & MO_GETMEM_NEEDS_RANGE) - monitor_printf (current_monitor->getmem.cmdb, memaddr, memaddr + len - 1); - else - monitor_printf (current_monitor->getmem.cmdb, memaddr, len); - -/* If TERM is present, we wait for that to show up. Also, (if TERM is - present), we will send TERM_CMD if that is present. In any case, we collect - all of the output into buf, and then wait for the normal prompt. */ - - if (current_monitor->getmem.term) - { - resp_len = monitor_expect (current_monitor->getmem.term, buf, sizeof buf); /* get response */ - - if (resp_len <= 0) - error ("monitor_read_memory (0x%x): excessive response from monitor: %.*s.", - memaddr, resp_len, buf); - - if (current_monitor->getmem.term_cmd) - { - SERIAL_WRITE (monitor_desc, current_monitor->getmem.term_cmd, - strlen (current_monitor->getmem.term_cmd)); - monitor_expect_prompt (NULL, 0); - } - } - else - resp_len = monitor_expect_prompt (buf, sizeof buf); /* get response */ - - p = buf; - - /* If RESP_DELIM is specified, we search for that as a leading delimiter for - the values. Otherwise, we just start searching from the start of the buf. - */ - - if (current_monitor->getmem.resp_delim) - { - int retval, tmp; - struct re_registers resp_strings; - - tmp = strlen (p); - retval = re_search (&getmem_resp_delim_pattern, p, tmp, 0, tmp, - &resp_strings); - - if (retval < 0) - error ("monitor_read_memory (0x%x): bad response from monitor: %.*s.", - memaddr, resp_len, buf); - - p += resp_strings.end[0]; -#if 0 - p = strstr (p, current_monitor->getmem.resp_delim); - if (!p) - error ("monitor_read_memory (0x%x): bad response from monitor: %.*s.", - memaddr, resp_len, buf); - p += strlen (current_monitor->getmem.resp_delim); -#endif - } - - for (i = len; i > 0; i--) - { - /* Skip non-hex chars, but bomb on end of string and newlines */ - - while (1) - { - if (isxdigit (*p)) - break; - if (*p == '\000' || *p == '\n' || *p == '\r') - error ("monitor_read_memory (0x%x): badly terminated response from monitor: %.*s", memaddr, resp_len, buf); - p++; - } - - val = strtoul (p, &p1, 16); - - if (val == 0 && p == p1) - error ("monitor_read_memory (0x%x): bad value from monitor: %.*s.", memaddr, - resp_len, buf); - - *myaddr++ = val; - - if (i == 1) - break; - - p = p1; - } - - return len; -} - -static int -monitor_xfer_memory (memaddr, myaddr, len, write, target) - CORE_ADDR memaddr; - char *myaddr; - int len; - int write; - struct target_ops *target; /* ignored */ -{ - return dcache_xfer_memory (remote_dcache, memaddr, myaddr, len, write); -} - -static void -monitor_kill () -{ - return; /* ignore attempts to kill target system */ -} - -/* All we actually do is set the PC to the start address of exec_bfd, and start - the program at that point. */ - -static void -monitor_create_inferior (exec_file, args, env) - char *exec_file; - char *args; - char **env; -{ - if (args && (*args != '\000')) - error ("Args are not supported by the monitor."); - - clear_proceed_status (); - proceed (bfd_get_start_address (exec_bfd), TARGET_SIGNAL_0, 0); -} - -/* Clean up when a program exits. - The program actually lives on in the remote processor's RAM, and may be - run again without a download. Don't leave it full of breakpoint - instructions. */ - -static void -monitor_mourn_inferior () -{ - unpush_target (targ_ops); - generic_mourn_inferior (); /* Do all the proper things now */ -} - -#define NUM_MONITOR_BREAKPOINTS 8 - -static CORE_ADDR breakaddr[NUM_MONITOR_BREAKPOINTS] = {0}; - -/* Tell the monitor to add a breakpoint. */ - -static int -monitor_insert_breakpoint (addr, shadow) - CORE_ADDR addr; - char *shadow; -{ - int i; - static unsigned char break_insn[] = BREAKPOINT; - - for (i = 0; i < NUM_MONITOR_BREAKPOINTS; i++) - { - if (breakaddr[i] == 0) - { - breakaddr[i] = addr; - monitor_read_memory (addr, shadow, sizeof (break_insn)); - monitor_printf (SET_BREAK_CMD, addr); - monitor_expect_prompt (NULL, 0); - return 0; - } - } - - error ("Too many breakpoints (> %d) for monitor.", NUM_MONITOR_BREAKPOINTS); -} - -/* Tell the monitor to remove a breakpoint. */ - -static int -monitor_remove_breakpoint (addr, shadow) - CORE_ADDR addr; - char *shadow; -{ - int i; - - for (i = 0; i < NUM_MONITOR_BREAKPOINTS; i++) - { - if (breakaddr[i] == addr) - { - breakaddr[i] = 0; - /* some monitors remove breakpoints based on the address */ - if (current_monitor->flags & MO_CLR_BREAK_USES_ADDR) - monitor_printf (CLR_BREAK_CMD, addr); - else - monitor_printf (CLR_BREAK_CMD, i); - monitor_expect_prompt (NULL, 0); - return 0; - } - } - fprintf_unfiltered (stderr, "Can't find breakpoint associated with 0x%x\n", addr); - return 1; -} - -/* monitor_load -- download a file. */ - -static void -monitor_load (file, from_tty) - char *file; - int from_tty; -{ - dcache_flush (remote_dcache); - - if (current_monitor->load_routine) - current_monitor->load_routine (monitor_desc, file, hashmark); - else - { /* The default is ascii S-records */ - monitor_printf (LOAD_CMD); /* tell the monitor to load */ - if (current_monitor->loadresp) - monitor_expect (current_monitor->loadresp, NULL, 0); - - load_srec (monitor_desc, file, 32, SREC_ALL, hashmark); - - monitor_expect_prompt (NULL, 0); - } - -/* Finally, make the PC point at the start address */ - - if (exec_bfd) - write_pc (bfd_get_start_address (exec_bfd)); - - inferior_pid = 0; /* No process now */ - -/* This is necessary because many things were based on the PC at the time that - we attached to the monitor, which is no longer valid now that we have loaded - new code (and just changed the PC). Another way to do this might be to call - normal_stop, except that the stack may not be valid, and things would get - horribly confused... */ - - clear_symtab_users (); -} - -static void -monitor_stop () -{ - if ((current_monitor->flags & MO_SEND_BREAK_ON_STOP) != 0) - SERIAL_SEND_BREAK (monitor_desc); - if (current_monitor->stop) - monitor_printf_noecho (current_monitor->stop); -} - -/* Put a command string, in args, out to MONITOR. Output from MONITOR - is placed on the users terminal until the prompt is seen. FIXME: We - read the characters ourseleves here cause of a nasty echo. */ - -static void -monitor_command (args, from_tty) - char *args; - int from_tty; -{ - char *p; - int resp_len; - char buf[1000]; - - if (monitor_desc == NULL) - error ("monitor target not open."); - - p = PROMPT; - - /* Send the command. Note that if no args were supplied, then we're - just sending the monitor a newline, which is sometimes useful. */ - - monitor_printf ("%s\r", (args ? args : "")); - - resp_len = monitor_expect_prompt (buf, sizeof buf); - - fputs_unfiltered (buf, gdb_stdout); /* Output the response */ -} - -/* Convert hex digit A to a number. */ - -static int -from_hex (a) - int a; -{ - if (a >= '0' && a <= '9') - return a - '0'; - if (a >= 'a' && a <= 'f') - return a - 'a' + 10; - if (a >= 'A' && a <= 'F') - return a - 'A' + 10; - - error ("Reply contains invalid hex digit 0x%x", a); -} - -static struct target_ops monitor_ops = -{ - NULL, /* to_shortname */ - NULL, /* to_longname */ - NULL, /* to_doc */ - NULL, /* to_open */ - monitor_close, /* to_close */ - NULL, /* to_attach */ - monitor_detach, /* to_detach */ - monitor_resume, /* to_resume */ - monitor_wait, /* to_wait */ - monitor_fetch_registers, /* to_fetch_registers */ - monitor_store_registers, /* to_store_registers */ - monitor_prepare_to_store, /* to_prepare_to_store */ - monitor_xfer_memory, /* to_xfer_memory */ - monitor_files_info, /* to_files_info */ - monitor_insert_breakpoint, /* to_insert_breakpoint */ - monitor_remove_breakpoint, /* to_remove_breakpoint */ - 0, /* to_terminal_init */ - 0, /* to_terminal_inferior */ - 0, /* to_terminal_ours_for_output */ - 0, /* to_terminal_ours */ - 0, /* to_terminal_info */ - monitor_kill, /* to_kill */ - monitor_load, /* to_load */ - 0, /* to_lookup_symbol */ - monitor_create_inferior, /* to_create_inferior */ - monitor_mourn_inferior, /* to_mourn_inferior */ - 0, /* to_can_run */ - 0, /* to_notice_signals */ - 0, /* to_thread_alive */ - monitor_stop, /* to_stop */ - process_stratum, /* to_stratum */ - 0, /* to_next */ - 1, /* to_has_all_memory */ - 1, /* to_has_memory */ - 1, /* to_has_stack */ - 1, /* to_has_registers */ - 1, /* to_has_execution */ - 0, /* sections */ - 0, /* sections_end */ - OPS_MAGIC /* to_magic */ -}; - -/* Init the target_ops structure pointed at by OPS */ - -void -init_monitor_ops (ops) - struct target_ops *ops; -{ - memcpy (ops, &monitor_ops, sizeof monitor_ops); -} - -/* Define additional commands that are usually only used by monitors. */ - -void -_initialize_remote_monitors () -{ - add_show_from_set (add_set_cmd ("hash", no_class, var_boolean, - (char *)&hashmark, - "Set display of activity while downloading a file.\n\ -When enabled, a hashmark \'#\' is displayed.", - &setlist), - &showlist); - - add_com ("monitor", class_obscure, monitor_command, - "Send a command to the debug monitor."); -} diff --git a/contrib/gdb/gdb/monitor.h b/contrib/gdb/gdb/monitor.h deleted file mode 100644 index daad1ca..0000000 --- a/contrib/gdb/gdb/monitor.h +++ /dev/null @@ -1,177 +0,0 @@ -/* Remote debugging interface ROM monitors. - * Copyright 1990, 1991, 1992, 1996 Free Software Foundation, Inc. - * Contributed by Cygnus Support. Written by Rob Savoye for Cygnus. - * - * This file is part of GDB. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include "serial.h" - -/* This structure describes the strings necessary to give small command - sequences to the monitor, and parse the response. - - CMD is the actual command typed at the monitor. Usually this has embedded - sequences ala printf, which are substituted with the arguments appropriate - to that type of command. Ie: to examine a register, we substitute the - register name for the first arg. To modify memory, we substitute the memory - location and the new contents for the first and second args, etc... - - RESP_DELIM used to home in on the response string, and is used to - disambiguate the answer within the pile of text returned by the monitor. - This should be a unique string that immediately precedes the answer. Ie: if - your monitor prints out `PC: 00000001= ' in response to asking for the PC, - you should use `: ' as the RESP_DELIM. RESP_DELIM may be NULL if the res- - ponse is going to be ignored, or has no particular leading text. - - TERM is the string that the monitor outputs to indicate that it is idle, and - waiting for input. This is usually a prompt of some sort. In the previous - example, it would be `= '. It is important that TERM really means that the - monitor is idle, otherwise GDB may try to type at it when it isn't ready for - input. This is a problem because many monitors cannot deal with type-ahead. - TERM may be NULL if the normal prompt is output. - - TERM_CMD is used to quit out of the subcommand mode and get back to the main - prompt. TERM_CMD may be NULL if it isn't necessary. It will also be - ignored if TERM is NULL. -*/ - -struct memrw_cmd -{ - char *cmdb; /* Command to send for byte read/write */ - char *cmdw; /* Command for word (16 bit) read/write */ - char *cmdl; /* Command for long (32 bit) read/write */ - char *cmdll; /* Command for long long (64 bit) read/write */ - char *resp_delim; /* String just prior to the desired value */ - char *term; /* Terminating string to search for */ - char *term_cmd; /* String to get out of sub-mode (if necessary) */ -}; - -struct regrw_cmd -{ - char *cmd; /* Command to send for reg read/write */ - char *resp_delim; /* String (actually a regexp if getmem) just - prior to the desired value */ - char *term; /* Terminating string to search for */ - char *term_cmd; /* String to get out of sub-mode (if necessary) */ -}; - -struct monitor_ops -{ - int flags; /* See below */ - char **init; /* List of init commands. NULL terminated. */ - char *cont; /* continue command */ - char *step; /* single step */ - char *stop; /* Interrupt program string */ - char *set_break; /* set a breakpoint */ - char *clr_break; /* clear a breakpoint */ - char *clr_all_break; /* Clear all breakpoints */ - char *fill; /* Memory fill cmd (addr len val) */ - struct memrw_cmd setmem; /* set memory to a value */ - struct memrw_cmd getmem; /* display memory */ - struct regrw_cmd setreg; /* set a register */ - struct regrw_cmd getreg; /* get a register */ - /* Some commands can dump a bunch of registers - at once. This comes as a set of REG=VAL - pairs. This should be called for each pair - of registers that we can parse to supply - GDB with the value of a register. */ - char *dump_registers; /* Command to dump all regs at once */ - char *register_pattern; /* Pattern that picks out register from reg dump */ - void (*supply_register) PARAMS ((char *name, int namelen, char *val, int vallen)); - void (*load_routine) PARAMS ((serial_t desc, char *file, int hashmark)); /* Download routine */ - char *load; /* load command */ - char *loadresp; /* Response to load command */ - char *prompt; /* monitor command prompt */ - char *line_term; /* end-of-command delimitor */ - char *cmd_end; /* optional command terminator */ - struct target_ops *target; /* target operations */ - int stopbits; /* number of stop bits */ - char **regnames; /* array of register names in ascii */ - int magic; /* Check value */ -}; - -#define MONITOR_OPS_MAGIC 600925 - -/* Flag defintions */ - -#define MO_CLR_BREAK_USES_ADDR 0x1 /* If set, then clear breakpoint command - uses address, otherwise it uses an index - returned by the monitor. */ -#define MO_FILL_USES_ADDR 0x2 /* If set, then memory fill command uses - STARTADDR, ENDADDR+1, VALUE as args, else it - uses STARTADDR, LENGTH, VALUE as args. */ -#define MO_NEED_REGDUMP_AFTER_CONT 0x4 /* If set, then monitor doesn't auto- - matically supply register dump when - coming back after a continue. */ -#define MO_GETMEM_NEEDS_RANGE 0x8 /* getmem needs start addr and end addr */ -#define MO_GETMEM_READ_SINGLE 0x10 /* getmem can only read one loc at a time */ -#define MO_HANDLE_NL 0x20 /* handle \r\n combinations */ - -#define MO_NO_ECHO_ON_OPEN 0x40 /* don't expect echos in monitor_open */ - -#define MO_SEND_BREAK_ON_STOP 0x80 /* If set, send break to stop monitor */ - -extern struct monitor_ops *current_monitor; - -#define LOADTYPES (current_monitor->loadtypes) -#define LOADPROTOS (current_monitor->loadprotos) -#define INIT_CMD (current_monitor->init) -#define CONT_CMD (current_monitor->cont) -#define STEP_CMD (current_monitor->step) -#define SET_BREAK_CMD (current_monitor->set_break) -#define CLR_BREAK_CMD (current_monitor->clr_break) -#define SET_MEM (current_monitor->setmem) -#define GET_MEM (current_monitor->getmem) -#define LOAD_CMD (current_monitor->load) -#define GET_REG (current_monitor->regget) -#define SET_REG (current_monitor->regset) -#define CMD_END (current_monitor->cmd_end) -#define CMD_DELIM (current_monitor->cmd_delim) -#define PROMPT (current_monitor->prompt) -#define TARGET_OPS (current_monitor->target) -#define TARGET_NAME (current_monitor->target->to_shortname) -#define BAUDRATES (current_monitor->baudrates) -#define STOPBITS (current_monitor->stopbits) -#define REGNAMES(x) (current_monitor->regnames[x]) -#define ROMCMD(x) (x.cmd) -#define ROMDELIM(x) (x.delim) -#define ROMRES(x) (x.result) - -#define push_monitor(x) current_monitor = x; - -#define SREC_SIZE 160 - -/* - * FIXME: These are to temporarily maintain compatability with the - * old monitor structure till remote-mon.c is fixed to work - * like the *-rom.c files. - */ -#define MEM_PROMPT (current_monitor->loadtypes) -#define MEM_SET_CMD (current_monitor->setmem) -#define MEM_DIS_CMD (current_monitor->getmem) -#define REG_DELIM (current_monitor->regset.delim) - -extern void monitor_open PARAMS ((char *args, struct monitor_ops *ops, int from_tty)); -extern void monitor_close PARAMS ((int quitting)); -extern char *monitor_supply_register PARAMS ((int regno, char *valstr)); -extern int monitor_expect PARAMS ((char *prompt, char *buf, int buflen)); -extern int monitor_expect_prompt PARAMS ((char *buf, int buflen)); -extern void monitor_printf PARAMS ((char *, ...)) - ATTR_FORMAT(printf, 1, 2); -extern void monitor_printf_noecho PARAMS ((char *, ...)) - ATTR_FORMAT(printf, 1, 2); -extern void init_monitor_ops PARAMS ((struct target_ops *)); diff --git a/contrib/gdb/gdb/mpw-config.in b/contrib/gdb/gdb/mpw-config.in deleted file mode 100644 index 47e7186..0000000 --- a/contrib/gdb/gdb/mpw-config.in +++ /dev/null @@ -1,82 +0,0 @@ -# Configuration fragment for GDB. - -If "{host_canonical}" =~ /m68k-apple-mpw/ - forward-include "{srcdir}"config:m68k:xm-mpw.h xm.h - Set siow_lib '"{Libraries}"SIOW.o' - -Else If "{host_canonical}" =~ /powerpc-apple-mpw/ - forward-include "{srcdir}"config:powerpc:xm-mpw.h xm.h - Set siow_lib '"{PPCLibraries}"PPCSIOW.o' - -End If - -Set xdepfiles '"{o}"mac-xdep.c.o' - -Set enable_cflags "" - -# Make a copy of this file and give it a different name, so it -# won't be confused with GDB's serial.h. - -Duplicate -y "{CIncludes}"Serial.h MacSerial.h - -Echo "/* dummy */" >termio.h - -If "{target_canonical}" =~ /m68k-apple-macos/ - forward-include "{srcdir}"config:m68k:tm-mac.h tm.h - forward-include "{srcdir}"config:m68k:tm-m68k.h 'm68k/tm-m68k.h' - Set tdepfiles '"{o}"m68k-tdep.c.o' - -Else If "{target_canonical}" =~ /powerpc-apple-macos/ - forward-include "{srcdir}"config:powerpc:tm-macos.h tm.h - forward-include "{srcdir}"config:rs6000:tm-rs6000.h 'rs6000/tm-rs6000.h' - Set tdepfiles '"{o}"rs6000-tdep.c.o "{o}"xcoffread.c.o' - -Else If "{target_canonical}" =~ /i386-unknown-go32/ - forward-include "{srcdir}"config:i386:tm-i386v.h tm.h - Set tdepfiles '"{o}"i386-tdep.c.o' - -Else If "{target_canonical}" =~ /mips-idt-ecoff/ - forward-include "{srcdir}"config:mips:tm-embed.h tm.h - forward-include "{srcdir}"config:mips:tm-bigmips.h 'mips/tm-bigmips.h' - forward-include "{srcdir}"config:mips:tm-mips.h 'mips/tm-mips.h' - Set tdepfiles '"{o}"mips-tdep.c.o "{o}"remote-mips.c.o' - - -Else If "{target_canonical}" =~ /sh-hitachi-hms/ - forward-include "{srcdir}"config:sh:tm-sh.h tm.h - Set tdepfiles '"{o}"sh-tdep.c.o' - -End If - -If "{target_canonical}" =~ /m68k-apple-macos/ - forward-include "{srcdir}"config:m68k:nm-macos.h nm.h - Set natdepfiles '"{o}"mac-nat.c.o' - -Else If "{target_canonical}" =~ /powerpc-apple-macos/ - forward-include "{srcdir}"config:powerpc:nm-macos.h nm.h - Set natdepfiles '"{o}"mac-nat.c.o' - -Else - forward-include "{srcdir}"config:nm-empty.h nm.h - Set natdepfiles ' ' - -End If - -Echo '# From mpw-config.in' > "{o}"mk.tmp -Echo "TDEPFILES = " {tdepfiles} >> "{o}"mk.tmp -Echo "XDEPFILES = " {xdepfiles} >> "{o}"mk.tmp -Echo "NATDEPFILES = " {natdepfiles} >> "{o}"mk.tmp -Echo "XM_ADD_FILES = " >> "{o}"mk.tmp -Echo "TM_ADD_FILES = " >> "{o}"mk.tmp -Echo "NAT_ADD_FILES = " >> "{o}"mk.tmp -Echo "XM_CDEPS = " >> "{o}"mk.tmp -Echo "TM_CDEPS = " >> "{o}"mk.tmp -Echo "NAT_CDEPS = " >> "{o}"mk.tmp -Echo "SIOW_LIB = " {siow_lib} >> "{o}"mk.tmp -Echo "ENABLE_CFLAGS = " {enable_cflags} >> "{o}"mk.tmp -Echo '# End from mpw-config.in' >> "{o}"mk.tmp - -Echo '/* config.h. Generated by mpw-configure. */' > "{o}"config.new -Echo '#include "mpw.h"' >> "{o}"config.new - -MoveIfChange "{o}"config.new "{o}"config.h diff --git a/contrib/gdb/gdb/mpw-make.sed b/contrib/gdb/gdb/mpw-make.sed deleted file mode 100644 index 9cfaaa3..0000000 --- a/contrib/gdb/gdb/mpw-make.sed +++ /dev/null @@ -1,167 +0,0 @@ -# Sed commands that finish translating the GDB Unix Makefile to MPW syntax. - -/^host_alias =/s/^/#/ -/^target_alias =/s/^/#/ - -/^host_makefile_frag@$/d -/^target_makefile_frag@$/d - -/@ENABLE_CFLAGS@/s/@ENABLE_CFLAGS@/{ENABLE_CFLAGS}/g -/^ENABLE_CFLAGS=/s/^/#/ - -# Edit all the symbolic definitions pointing to various libraries and such. - -/^INCLUDE_DIR = /s/"{srcdir}":include/"{topsrcdir}"include:/ - -/^MMALLOC_DIR = /s/::mmalloc/mmalloc:/ -/^MMALLOC_SRC = /s/"{srcdir}"/"{topsrcdir}"/ -/^MMALLOC =/s/=.*$/=/ -/#MMALLOC_DISABLE/s/^#// - -/^BFD_DIR = /s/::bfd/bfd:/ -/^BFD = /s/{BFD_DIR}:libbfd/{BFD_DIR}libbfd/ -/^BFD_SRC = /s/"{srcdir}"/"{topsrcdir}"/ - -/^READLINE_DIR = /s/::readline/readline:/ -/^READLINE =/s/=.*$/=/ -/^READLINE_SRC = /s/"{srcdir}"/"{topsrcdir}"/ - -/^INCLUDE_CFLAGS = /s/$/ -i "{topsrcdir}"include:mpw: -i ::extra-include:/ - -/^SER_HARDWIRE =/s/ser-unix/ser-mac/ - -/^TERMCAP =/s/ =.*$/ =/ - -/@DEFS@/s/@DEFS@//g - -/@YACC@/s/@YACC@/byacc/g - -/@ENABLE_OBS@/s/@ENABLE_OBS@//g - -/@ENABLE_CLIBS@/s/@ENABLE_CLIBS@//g - -/@LIBS@/s/@LIBS@//g - -/INCLUDE_DIR/s/"{s}"{INCLUDE_DIR}/{INCLUDE_DIR}/g -/INCLUDE_DIR/s/{INCLUDE_DIR}:/{INCLUDE_DIR}/g -/INCLUDE_DIR/s/"{INCLUDE_DIR}":/"{INCLUDE_DIR}"/g - -/{BFD_DIR}/s/"{BFD_DIR}":/"{BFD_DIR}"/g -/{BFD_DIR}/s/\([ ]\){BFD_DIR}/\1::{BFD_DIR}/g -/{BFD_DIR}/s/\([ ]\)"{BFD_DIR}"/\1::"{BFD_DIR}"/g - -/{BFD_SRC}/s/"{s}"{BFD_SRC}/{BFD_SRC}/g -/{BFD_SRC}/s/{BFD_SRC}:/{BFD_SRC}/g - -/{READLINE_SRC}/s/"{s}"{READLINE_SRC}/{READLINE_SRC}/g - -/^readline_headers =/,/^$/c\ -readline_headers =\ - - -/{MMALLOC_CHECK}/s/{MMALLOC_CHECK}//g - -# This isn't really useful, and seems to cause nonsensical complaints. -/{ALLDEPFILES}/s/{ALLDEPFILES}//g - -/^copying.c \\Option-f /,/^$/d - -# Fix the syntax of bits of C code that go into version.c. -/char /s/'char .Option-x/'char */ - -/version/s/"{s}"version\.c/"{o}"version.c/g -/version/s/^version\.c/"{o}"version.c/ -/config/s/"{s}"config\.h/"{o}"config.h/g -/config/s/^config\.h/"{o}"config.h/ -/xm/s/"{s}"xm\.h/"{o}"xm.h/g -/xm/s/^xm\.h/"{o}"xm.h/ -/tm/s/"{s}"tm\.h/"{o}"tm.h/g -/tm/s/^tm\.h/"{o}"tm.h/ -/nm/s/"{s}"nm\.h/"{o}"nm.h/g -/nm/s/^nm\.h/"{o}"nm.h/ - -/exp.tab.c/s/"{s}"\([a-z0-9]*\)-exp\.tab\.c/"{o}"\1-exp.tab.c/g -/exp.tab.c/s/^\([a-z0-9]*\)-exp\.tab\.c/"{o}"\1-exp.tab.c/ - -/y.tab/s/"{s}"y.tab\.c/"{o}"y.tab.c/g -/y.tab/s/^y.tab\.c/"{o}"y.tab.c/ - -/init/s/"{s}"init\.c-tmp/"{o}"init.c-tmp/g -/init/s/^init\.c-tmp/"{o}"init.c-tmp/ -/init/s/"{s}"init\.c/"{o}"init.c/g -/init/s/^init\.c/"{o}"init.c/ - -/"{o}"version.c \\Option-f Makefile/,/^$/c\ -"{o}"version.c \\Option-f Makefile\ - echo -n 'char *version = "' >"{o}"version.c\ - echo -n "{VERSION}" >>"{o}"version.c\ - echo '";' >>"{o}"version.c\ - echo -n 'char *host_name = "' >>"{o}"version.c\ - echo -n "{host_alias}" >>"{o}"version.c\ - echo '";' >>"{o}"version.c\ - echo -n 'char *target_name = "' >>"{o}"version.c\ - echo -n "{target_alias}" >>"{o}"version.c\ - echo '";' >>"{o}"version.c\ - - -# Open-brace in a command causes much confusion; replace with the -# result from a script. -/initialize_all_files ()/c\ - Echo -n 'void initialize_all_files () ' >> "{o}"init.c-tmp\ - open-brace >> "{o}"init.c-tmp - -# Replace the whole sed bit for init.c; it's simpler that way... -/filename=`echo $i | sed/,/esac/c\ - set filename "`Echo {i} | sed \\Option-d\ - -e '/^Onindy.c.o/d' \\Option-d\ - -e '/^nindy.c.o/d' \\Option-d\ - -e '/ttyflush.c.o/d' \\Option-d\ - -e '/xdr_ld.c.o/d' \\Option-d\ - -e '/xdr_ptrace.c.o/d' \\Option-d\ - -e '/xdr_rdb.c.o/d' \\Option-d\ - -e '/udr.c.o/d' \\Option-d\ - -e '/udip2soc.c.o/d' \\Option-d\ - -e '/udi2go32.c.o/d' \\Option-d\ - -e '/version.c.o/d' \\Option-d\ - -e '/[a-z0-9A-Z_]*-exp.tab.c.o/d' \\Option-d\ - -e 's/\\.c\\.o/.c/' \\Option-d\ - -e 's/^://'`"\ - If "{filename}" != ""\ - sed <"{s}""{filename}" >>"{o}"init.c-tmp -n \\Option-d\ - -e '/^_initialize_[a-z_0-9A-Z]* *(/s/^\\([a-z_0-9A-Z]*\\).*/ {extern void \\1 (); \\1 ();}/p'\ - End If - -# Fix the main compile/link command. -/{CC_LD} {INTERNAL_LDFLAGS} -o gdb/,/"{o}"init.c.o {OBS} {TSOBS} {ADD_FILES} {CLIBS} {LOADLIBES}/c\ - {CC_LD} {INTERNAL_LDFLAGS} -o gdb{PROG_EXT} "{o}"init.c.o {OBS} {TSOBS} {ADD_FILES} {CLIBS} {LOADLIBES} {EXTRALIBS}\ - {MAKEPEF} gdb{PROG_EXT} -o gdb {MAKEPEF_TOOL_FLAGS} {MAKEPEF_FLAGS}\ - {REZ} "{s}"mac-gdb.r -o gdb -append -d PROG_NAME='"'gdb'"' -d VERSION_STRING='"'{version}'"'\ - -/^install \\Option-f /,/^$/c\ -install \\Option-f all install-only\ -\ -install-only \\Option-f \ - Duplicate -y gdb "{bindir}"gdb\ - If "`Exists SiowGDB`" != ""\ - Duplicate -y SiowGDB "{bindir}"SiowGDB\ - End If\ - - -# Don't do any recursive subdir stuff. -/ subdir_do/s/{MAKE}/null-command/ - -# Edit out actions that only confuse MPW Make. -/^config.status \\Option-f/,/^$/d -/^Makefile \\Option-f/,/^$/d - -/^"{o}"config.h \\Option-f/s/^/#/ - -# Add an action to build SIOWgdb. -$a\ -SIOWgdb \\Option-f {OBS} {TSOBS} {ADD_DEPS} {CDEPS} "{o}"init.c.o\ - Delete -i -y SIOWgdb\ - {CC_LD} {INTERNAL_LDFLAGS} -t 'APPL' -c 'gdb ' -o SIOWgdb{PROG_EXT} "{o}"init.c.o {OBS} {TSOBS} {ADD_FILES} {CLIBS} {SIOW_LIB} {LOADLIBES} {EXTRALIBS}\ - {MAKEPEF} SIOWgdb{PROG_EXT} -o SIOWgdb -ft 'APPL' -fc 'gdb ' {MAKEPEF_FLAGS} \ - {REZ} -o SIOWgdb "{RIncludes}"siow.r -append -d __kPrefSize=5000 -d __kMinSize=2000 -d APPNAME='"'SIOWgdb'"' \ - {REZ} "{s}"mac-gdb.r -o SIOWgdb -append -d VERSION_STRING='"'{version}'"'\ - diff --git a/contrib/gdb/gdb/news-xdep.c b/contrib/gdb/gdb/news-xdep.c deleted file mode 100644 index 7f57aeb..0000000 --- a/contrib/gdb/gdb/news-xdep.c +++ /dev/null @@ -1,65 +0,0 @@ -/* Low level interface to ptrace, for GDB when running under Unix. - Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#ifdef __GNUC__ -/* Bad implement execle(3). It's depend for "/bin/cc". - - main() - { - printf("execle:\n"); - execle(FILE, ARGS, envp); - exit(1); - } - - GCC: - link a6,#0 - pea LC5 ; call printf - jbsr _printf - ; ; (not popd stack) - pea _envp ; call execle - clrl sp@- - pea LC4 - pea LC4 - pea LC4 - pea LC3 - pea LC6 - jbsr _execle - addw #32,sp ; delayed pop !! - - /bin/cc: - link.l fp,#L23 - movem.l #L24,(sp) - pea L26 ; call printf - jbsr _printf - addq.l #4,sp ; <--- popd stack !! - pea _envp ; call execle - clr.l -(sp) - pea L32 - - */ - -execle(name, args) - char *name, *args; -{ - register char **env = &args; - while (*env++) - ; - execve(name, (char **)&args, (char **)*env); -} -#endif diff --git a/contrib/gdb/gdb/nindy-tdep.c b/contrib/gdb/gdb/nindy-tdep.c deleted file mode 100644 index 76f04e4..0000000 --- a/contrib/gdb/gdb/nindy-tdep.c +++ /dev/null @@ -1,73 +0,0 @@ -/* Target-machine dependent code for the NINDY monitor running on the Intel 960 - Copyright (C) 1991 Free Software Foundation, Inc. - Contributed by Intel Corporation. - -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. */ - -/* Miscellaneous NINDY-dependent routines. - Some replace macros normally defined in "tm.h". */ - -#include "defs.h" -#include "symtab.h" -#include "frame.h" - -/* 'start_frame' is a variable in the NINDY runtime startup routine - that contains the frame pointer of the 'start' routine (the routine - that calls 'main'). By reading its contents out of remote memory, - we can tell where the frame chain ends: backtraces should halt before - they display this frame. */ - -int -nindy_frame_chain_valid (chain, curframe) - unsigned int chain; - struct frame_info *curframe; -{ - struct symbol *sym; - struct minimal_symbol *msymbol; - - /* crtnindy.o is an assembler module that is assumed to be linked - * first in an i80960 executable. It contains the true entry point; - * it performs startup up initialization and then calls 'main'. - * - * 'sf' is the name of a variable in crtnindy.o that is set - * during startup to the address of the first frame. - * - * 'a' is the address of that variable in 80960 memory. - */ - static char sf[] = "start_frame"; - CORE_ADDR a; - - - chain &= ~0x3f; /* Zero low 6 bits because previous frame pointers - contain return status info in them. */ - if ( chain == 0 ){ - return 0; - } - - sym = lookup_symbol(sf, 0, VAR_NAMESPACE, (int *)NULL, - (struct symtab **)NULL); - if ( sym != 0 ){ - a = SYMBOL_VALUE (sym); - } else { - msymbol = lookup_minimal_symbol (sf, NULL, NULL); - if (msymbol == NULL) - return 0; - a = SYMBOL_VALUE_ADDRESS (msymbol); - } - - return ( chain != read_memory_integer(a,4) ); -} diff --git a/contrib/gdb/gdb/ns32k-tdep.c b/contrib/gdb/gdb/ns32k-tdep.c deleted file mode 100644 index 58a0860..0000000 --- a/contrib/gdb/gdb/ns32k-tdep.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Print NS 32000 instructions for GDB, the GNU debugger. - Copyright 1986, 1988, 1991, 1992, 1994, 1995 - Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "defs.h" - -void -_initialize_ns32k_tdep () -{ - tm_print_insn = print_insn_ns32k; -} diff --git a/contrib/gdb/gdb/ns32km3-nat.c b/contrib/gdb/gdb/ns32km3-nat.c deleted file mode 100644 index 89696ba..0000000 --- a/contrib/gdb/gdb/ns32km3-nat.c +++ /dev/null @@ -1,181 +0,0 @@ -/* Low level interface to ns532 running mach 3.0. - Copyright (C) 1992 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "defs.h" -#include "inferior.h" - -#include - -#include -#include -#include -#include - -#define private static - - -/* Find offsets to thread states at compile time. - * If your compiler does not grok this, calculate offsets - * offsets yourself and use them (or get a compatible compiler :-) - */ - -#define REG_N_OFFSET(reg) (int)(&((struct ns532_combined_state *)0)->ts.reg) -#define REG_F_OFFSET(reg) (int)(&((struct ns532_combined_state *)0)->fs.reg) - -/* at reg_offset[i] is the offset to the ns532_combined_state - * location where the gdb registers[i] is stored. - */ - -static int reg_offset[] = -{ - REG_N_OFFSET(r0), REG_N_OFFSET(r1), REG_N_OFFSET(r2), REG_N_OFFSET(r3), - REG_N_OFFSET(r4), REG_N_OFFSET(r5), REG_N_OFFSET(r6), REG_N_OFFSET(r7), - REG_F_OFFSET(l0a), REG_F_OFFSET(l1a),REG_F_OFFSET(l2a),REG_F_OFFSET(l3a), - REG_F_OFFSET(l4a), REG_F_OFFSET(l5a),REG_F_OFFSET(l6a),REG_F_OFFSET(l7a), - REG_N_OFFSET(sp), REG_N_OFFSET(fp), REG_N_OFFSET(pc), REG_N_OFFSET(psr), - REG_F_OFFSET(fsr), - REG_F_OFFSET(l0a), REG_F_OFFSET(l2a),REG_F_OFFSET(l4a),REG_F_OFFSET(l6a) - /* @@@ 532 has more double length floating point regs, not accessed currently */ -}; - -/* Fetch COUNT contiguous registers from thread STATE starting from REGNUM - * Caller knows that the regs handled in one transaction are of same size. - */ -#define FETCH_REGS(state, regnum, count) \ - memcpy (®isters[REGISTER_BYTE (regnum)], \ - (char *)state+reg_offset[ regnum ], \ - count*REGISTER_SIZE) - -/* Store COUNT contiguous registers to thread STATE starting from REGNUM */ -#define STORE_REGS(state, regnum, count) \ - memcpy ((char *)state+reg_offset[ regnum ], \ - ®isters[REGISTER_BYTE (regnum)], \ - count*REGISTER_SIZE) - -/* - * Fetch inferiors registers for gdb. - * REGNO specifies which (as gdb views it) register, -1 for all. - */ - -void -fetch_inferior_registers (regno) - int regno; -{ - kern_return_t ret; - thread_state_data_t state; - unsigned int stateCnt = NS532_COMBINED_STATE_COUNT; - int index; - - if (! MACH_PORT_VALID (current_thread)) - error ("fetch inferior registers: Invalid thread"); - - if (must_suspend_thread) - setup_thread (current_thread, 1); - - ret = thread_get_state (current_thread, - NS532_COMBINED_STATE, - state, - &stateCnt); - - if (ret != KERN_SUCCESS) - message ("fetch_inferior_registers: %s ", - mach_error_string (ret)); -#if 0 - /* It may be more effective to store validate all of them, - * since we fetched them all anyway - */ - else if (regno != -1) - supply_register (regno, (char *)state+reg_offset[regno]); -#endif - else - { - for (index = 0; index < NUM_REGS; index++) - supply_register (index, (char *)state+reg_offset[index]); - } - - if (must_suspend_thread) - setup_thread (current_thread, 0); -} - -/* Store our register values back into the inferior. - * If REGNO is -1, do this for all registers. - * Otherwise, REGNO specifies which register - * - * On mach3 all registers are always saved in one call. - */ -void -store_inferior_registers (regno) - int regno; -{ - kern_return_t ret; - thread_state_data_t state; - unsigned int stateCnt = NS532_COMBINED_STATE_COUNT; - register int index; - - if (! MACH_PORT_VALID (current_thread)) - error ("store inferior registers: Invalid thread"); - - if (must_suspend_thread) - setup_thread (current_thread, 1); - - /* Fetch the state of the current thread */ - ret = thread_get_state (current_thread, - NS532_COMBINED_STATE, - state, - &stateCnt); - - if (ret != KERN_SUCCESS) - { - message ("store_inferior_registers (get): %s", - mach_error_string (ret)); - if (must_suspend_thread) - setup_thread (current_thread, 0); - return; - } - - /* move gdb's registers to thread's state - * - * Since we save all registers anyway, save the ones - * that gdb thinks are valid (e.g. ignore the regno - * parameter) - */ -#if 0 - if (regno != -1) - STORE_REGS (state, regno, 1); - else -#endif - { - for (index = 0; index < NUM_REGS; index++) - STORE_REGS (state, index, 1); - } - - /* Write gdb's current view of register to the thread - */ - ret = thread_set_state (current_thread, - NS532_COMBINED_STATE, - state, - NS532_COMBINED_STATE_COUNT); - - if (ret != KERN_SUCCESS) - message ("store_inferior_registers (set): %s", - mach_error_string (ret)); - - if (must_suspend_thread) - setup_thread (current_thread, 0); -} diff --git a/contrib/gdb/gdb/op50-rom.c b/contrib/gdb/gdb/op50-rom.c deleted file mode 100644 index f8cb7fa..0000000 --- a/contrib/gdb/gdb/op50-rom.c +++ /dev/null @@ -1,146 +0,0 @@ -/* Remote target glue for the Oki op50n based eval board. - - Copyright 1995 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "defs.h" -#include "gdbcore.h" -#include "target.h" -#include "monitor.h" -#include "serial.h" - -static void op50n_open PARAMS ((char *args, int from_tty)); - -/* - * this array of registers need to match the indexes used by GDB. The - * whole reason this exists is cause the various ROM monitors use - * different strings than GDB does, and doesn't support all the - * registers either. So, typing "info reg sp" becomes a "r30". - */ - -static char *op50n_regnames[NUM_REGS] = -{ - "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", - "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", - "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", - "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", - "cr11", "p", NULL, NULL, NULL, "cr15", "cr19", "cr20", - "cr21", "cr22", NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, "cr0", "cr8", "cr9", "cr10","cr12", - "cr13", "cr24", "cr25", "cr26", -}; - -/* - * Define the monitor command strings. Since these are passed directly - * through to a printf style function, we need can include formatting - * strings. We also need a CR or LF on the end. - */ - -static struct target_ops op50n_ops; - -static char *op50n_inits[] = {".\r", NULL}; - -static struct monitor_ops op50n_cmds = -{ - MO_CLR_BREAK_USES_ADDR /*| MO_GETMEM_READ_SINGLE*/, /* flags */ - op50n_inits, /* Init strings */ - "g\r", /* continue command */ - "t\r", /* single step */ - "\003.\r", /* Interrupt char */ - "b %x\r", /* set a breakpoint */ - "b %x,0\r", /* clear breakpoint at addr */ - "bx\r", /* clear all breakpoints */ - "fx %x s%x %x\r", /* memory fill cmd (addr, len, val) */ - { - "sx %x %x\r", /* setmem.cmdb (addr, value) */ - "sh %x %x\r", /* setmem.cmdw (addr, value) */ - "s %x %x\r", /* setmem.cmdl (addr, value) */ - NULL, /* setmem.cmdll (addr, value) */ - NULL, /* setmem.resp_delim */ - NULL, /* setmem.term */ - NULL, /* setmem.term_cmd */ - }, -#if 0 - { - "sx %x\r", /* getmem.cmdb (addr, len) */ - "sh %x\r", /* getmem.cmdw (addr, len) */ - "s %x\r", /* getmem.cmdl (addr, len) */ - NULL, /* getmem.cmdll (addr, len) */ - " : ", /* getmem.resp_delim */ - " ", /* getmem.term */ - ".\r", /* getmem.term_cmd */ - }, -#else - { - "dx %x s%x\r", /* getmem.cmdb (addr, len) */ - NULL, /* getmem.cmdw (addr, len) */ - NULL, /* getmem.cmdl (addr, len) */ - NULL, /* getmem.cmdll (addr, len) */ - " : ", /* getmem.resp_delim */ - NULL, /* getmem.term */ - NULL, /* getmem.term_cmd */ - }, -#endif - { - "x %s %x\r", /* setreg.cmd (name, value) */ - NULL, /* setreg.resp_delim */ - NULL, /* setreg.term */ - NULL, /* setreg.term_cmd */ - }, - { - "x %s\r", /* getreg.cmd (name) */ - "=", /* getreg.resp_delim */ - " ", /* getreg.term */ - ".\r", /* getreg.term_cmd */ - }, - NULL, /* dump_registers */ - NULL, /* register_pattern */ - NULL, /* supply_register */ - NULL, /* load routine */ - "r 0\r", /* download command */ - NULL, /* load response */ - "\n#", /* monitor command prompt */ - "\r", /* end-of-command delimitor */ - NULL, /* optional command terminator */ - &op50n_ops, /* target operations */ - SERIAL_1_STOPBITS, /* number of stop bits */ - op50n_regnames, /* register names */ - MONITOR_OPS_MAGIC /* magic */ - }; - -static void -op50n_open (args, from_tty) - char *args; - int from_tty; -{ - monitor_open (args, &op50n_cmds, from_tty); -} - -void -_initialize_op50n () -{ - init_monitor_ops (&op50n_ops); - - op50n_ops.to_shortname = "op50n"; - op50n_ops.to_longname = "Oki's debug monitor for the Op50n Eval board"; - op50n_ops.to_doc = "Debug on a Oki OP50N eval board.\n\ -Specify the serial device it is connected to (e.g. /dev/ttya)."; - op50n_ops.to_open = op50n_open; - - add_target (&op50n_ops); -} diff --git a/contrib/gdb/gdb/osfsolib.c b/contrib/gdb/gdb/osfsolib.c deleted file mode 100644 index 85afa24..0000000 --- a/contrib/gdb/gdb/osfsolib.c +++ /dev/null @@ -1,955 +0,0 @@ -/* Handle OSF/1 shared libraries for GDB, the GNU Debugger. - Copyright 1993, 1994, 1995, 1996 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* FIXME: Most of this code could be merged with solib.c by using - next_link_map_member and xfer_link_map_member in solib.c. */ - -#include "defs.h" - -#include -#include -#include "gdb_string.h" -#include - -#include "symtab.h" -#include "bfd.h" -#include "symfile.h" -#include "objfiles.h" -#include "gdbcore.h" -#include "command.h" -#include "target.h" -#include "frame.h" -#include "gnu-regex.h" -#include "inferior.h" -#include "language.h" -#include "gdbcmd.h" - -#define MAX_PATH_SIZE 1024 /* FIXME: Should be dynamic */ - -/* When handling shared libraries, GDB has to find out the pathnames - of all shared libraries that are currently loaded (to read in their - symbols) and where the shared libraries are loaded in memory - (to relocate them properly from their prelinked addresses to the - current load address). - - Under OSF/1 there are two possibilities to get at this information: - 1) Peek around in the runtime loader structures. - These are not documented, and they are not defined in the system - header files. The definitions below were obtained by experimentation, - but they seem stable enough. - 2) Use the undocumented libxproc.a library, which contains the - equivalent ldr_* routines. - This approach is somewhat cleaner, but it requires that the GDB - executable is dynamically linked. In addition it requires a - NAT_CLIBS= -lxproc -Wl,-expect_unresolved,ldr_process_context - linker specification for GDB and all applications that are using - libgdb. - We will use the peeking approach until it becomes unwieldy. */ - -#ifndef USE_LDR_ROUTINES - -/* Definition of runtime loader structures, found by experimentation. */ -#define RLD_CONTEXT_ADDRESS 0x3ffc0000000 - -typedef struct -{ - CORE_ADDR next; - CORE_ADDR previous; - CORE_ADDR unknown1; - char *module_name; - CORE_ADDR modinfo_addr; - long module_id; - CORE_ADDR unknown2; - CORE_ADDR unknown3; - long region_count; - CORE_ADDR regioninfo_addr; -} ldr_module_info_t; - -typedef struct -{ - long unknown1; - CORE_ADDR regionname_addr; - long protection; - CORE_ADDR vaddr; - CORE_ADDR mapaddr; - long size; - long unknown2[5]; -} ldr_region_info_t; - -typedef struct -{ - CORE_ADDR unknown1; - CORE_ADDR unknown2; - CORE_ADDR head; - CORE_ADDR tail; -} ldr_context_t; - -static ldr_context_t ldr_context; - -#else - -#include -static ldr_process_t fake_ldr_process; - -/* Called by ldr_* routines to read memory from the current target. */ - -static int ldr_read_memory PARAMS ((CORE_ADDR, char *, int, int)); - -static int -ldr_read_memory (memaddr, myaddr, len, readstring) - CORE_ADDR memaddr; - char *myaddr; - int len; - int readstring; -{ - int result; - char *buffer; - - if (readstring) - { - target_read_string (memaddr, &buffer, len, &result); - if (result == 0) - strcpy (myaddr, buffer); - free (buffer); - } - else - result = target_read_memory (memaddr, myaddr, len); - - if (result != 0) - result = -result; - return result; -} - -#endif - -/* Define our own link_map structure. - This will help to share code with solib.c. */ - -struct link_map { - CORE_ADDR l_offset; /* prelink to load address offset */ - char *l_name; /* full name of loaded object */ - ldr_module_info_t module_info; /* corresponding module info */ -}; - -#define LM_OFFSET(so) ((so) -> lm.l_offset) -#define LM_NAME(so) ((so) -> lm.l_name) - -struct so_list { - struct so_list *next; /* next structure in linked list */ - struct link_map lm; /* copy of link map from inferior */ - struct link_map *lmaddr; /* addr in inferior lm was read from */ - CORE_ADDR lmend; /* upper addr bound of mapped object */ - char so_name[MAX_PATH_SIZE]; /* shared object lib name (FIXME) */ - char symbols_loaded; /* flag: symbols read in yet? */ - char from_tty; /* flag: print msgs? */ - struct objfile *objfile; /* objfile for loaded lib */ - struct section_table *sections; - struct section_table *sections_end; - struct section_table *textsection; - bfd *abfd; -}; - -static struct so_list *so_list_head; /* List of known shared objects */ - -extern int -fdmatch PARAMS ((int, int)); /* In libiberty */ - -/* Local function prototypes */ - -static void -sharedlibrary_command PARAMS ((char *, int)); - -static void -info_sharedlibrary_command PARAMS ((char *, int)); - -static int -symbol_add_stub PARAMS ((char *)); - -static struct so_list * -find_solib PARAMS ((struct so_list *)); - -static struct link_map * -first_link_map_member PARAMS ((void)); - -static struct link_map * -next_link_map_member PARAMS ((struct so_list *)); - -static void -xfer_link_map_member PARAMS ((struct so_list *, struct link_map *)); - -static void -solib_map_sections PARAMS ((struct so_list *)); - -/* - -LOCAL FUNCTION - - solib_map_sections -- open bfd and build sections for shared lib - -SYNOPSIS - - static void solib_map_sections (struct so_list *so) - -DESCRIPTION - - Given a pointer to one of the shared objects in our list - of mapped objects, use the recorded name to open a bfd - descriptor for the object, build a section table, and then - relocate all the section addresses by the base address at - which the shared object was mapped. - -FIXMES - - In most (all?) cases the shared object file name recorded in the - dynamic linkage tables will be a fully qualified pathname. For - cases where it isn't, do we really mimic the systems search - mechanism correctly in the below code (particularly the tilde - expansion stuff?). - */ - -static void -solib_map_sections (so) - struct so_list *so; -{ - char *filename; - char *scratch_pathname; - int scratch_chan; - struct section_table *p; - struct cleanup *old_chain; - bfd *abfd; - - filename = tilde_expand (so -> so_name); - old_chain = make_cleanup (free, filename); - - scratch_chan = openp (getenv ("PATH"), 1, filename, O_RDONLY, 0, - &scratch_pathname); - if (scratch_chan < 0) - { - scratch_chan = openp (getenv ("LD_LIBRARY_PATH"), 1, filename, - O_RDONLY, 0, &scratch_pathname); - } - if (scratch_chan < 0) - { - perror_with_name (filename); - } - /* Leave scratch_pathname allocated. bfd->name will point to it. */ - - abfd = bfd_fdopenr (scratch_pathname, gnutarget, scratch_chan); - if (!abfd) - { - close (scratch_chan); - error ("Could not open `%s' as an executable file: %s", - scratch_pathname, bfd_errmsg (bfd_get_error ())); - } - /* Leave bfd open, core_xfer_memory and "info files" need it. */ - so -> abfd = abfd; - abfd -> cacheable = true; - - if (!bfd_check_format (abfd, bfd_object)) - { - error ("\"%s\": not in executable format: %s.", - scratch_pathname, bfd_errmsg (bfd_get_error ())); - } - if (build_section_table (abfd, &so -> sections, &so -> sections_end)) - { - error ("Can't find the file sections in `%s': %s", - bfd_get_filename (exec_bfd), bfd_errmsg (bfd_get_error ())); - } - - for (p = so -> sections; p < so -> sections_end; p++) - { - /* Relocate the section binding addresses as recorded in the shared - object's file by the offset to get the address to which the - object was actually mapped. */ - p -> addr += LM_OFFSET (so); - p -> endaddr += LM_OFFSET (so); - so -> lmend = (CORE_ADDR) max (p -> endaddr, so -> lmend); - if (STREQ (p -> the_bfd_section -> name, ".text")) - { - so -> textsection = p; - } - } - - /* Free the file names, close the file now. */ - do_cleanups (old_chain); -} - -/* - -LOCAL FUNCTION - - first_link_map_member -- locate first member in dynamic linker's map - -SYNOPSIS - - static struct link_map *first_link_map_member (void) - -DESCRIPTION - - Read in a copy of the first member in the inferior's dynamic - link map from the inferior's dynamic linker structures, and return - a pointer to the copy in our address space. -*/ - -static struct link_map * -first_link_map_member () -{ - struct link_map *lm = NULL; - static struct link_map first_lm; - -#ifdef USE_LDR_ROUTINES - ldr_module_t mod_id = LDR_NULL_MODULE; - size_t retsize; - - fake_ldr_process = ldr_core_process (); - ldr_set_core_reader (ldr_read_memory); - ldr_xdetach (fake_ldr_process); - if (ldr_xattach (fake_ldr_process) != 0 - || ldr_next_module(fake_ldr_process, &mod_id) != 0 - || mod_id == LDR_NULL_MODULE - || ldr_inq_module(fake_ldr_process, mod_id, - &first_lm.module_info, sizeof(ldr_module_info_t), - &retsize) != 0) - return lm; -#else - CORE_ADDR ldr_context_addr; - - if (target_read_memory ((CORE_ADDR) RLD_CONTEXT_ADDRESS, - (char *) &ldr_context_addr, - sizeof (CORE_ADDR)) != 0 - || target_read_memory (ldr_context_addr, - (char *) &ldr_context, - sizeof (ldr_context_t)) != 0 - || target_read_memory ((CORE_ADDR) ldr_context.head, - (char *) &first_lm.module_info, - sizeof (ldr_module_info_t)) != 0) - return lm; -#endif - - lm = &first_lm; - - /* The first entry is for the main program and should be skipped. */ - lm->l_name = NULL; - - return lm; -} - -static struct link_map * -next_link_map_member (so_list_ptr) - struct so_list *so_list_ptr; -{ - struct link_map *lm = NULL; - static struct link_map next_lm; -#ifdef USE_LDR_ROUTINES - ldr_module_t mod_id = so_list_ptr->lm.module_info.lmi_modid; - size_t retsize; - - if (ldr_next_module(fake_ldr_process, &mod_id) != 0 - || mod_id == LDR_NULL_MODULE - || ldr_inq_module(fake_ldr_process, mod_id, - &next_lm.module_info, sizeof(ldr_module_info_t), - &retsize) != 0) - return lm; - - lm = &next_lm; - lm->l_name = lm->module_info.lmi_name; -#else - CORE_ADDR ldr_context_addr; - - /* Reread context in case ldr_context.tail was updated. */ - - if (target_read_memory ((CORE_ADDR) RLD_CONTEXT_ADDRESS, - (char *) &ldr_context_addr, - sizeof (CORE_ADDR)) != 0 - || target_read_memory (ldr_context_addr, - (char *) &ldr_context, - sizeof (ldr_context_t)) != 0 - || so_list_ptr->lm.module_info.modinfo_addr == ldr_context.tail - || target_read_memory (so_list_ptr->lm.module_info.next, - (char *) &next_lm.module_info, - sizeof (ldr_module_info_t)) != 0) - return lm; - - lm = &next_lm; - lm->l_name = lm->module_info.module_name; -#endif - return lm; -} - -static void -xfer_link_map_member (so_list_ptr, lm) - struct so_list *so_list_ptr; - struct link_map *lm; -{ - int i; - so_list_ptr->lm = *lm; - - /* OSF/1 shared libraries are pre-linked to particular addresses, - but the runtime loader may have to relocate them if the - address ranges of the libraries used by the target executable clash, - or if the target executable is linked with the -taso option. - The offset is the difference between the address where the shared - library is mapped and the pre-linked address of the shared library. - - FIXME: GDB is currently unable to relocate the shared library - sections by different offsets. If sections are relocated by - different offsets, put out a warning and use the offset of the - first section for all remaining sections. */ - LM_OFFSET (so_list_ptr) = 0; - - /* There is one entry that has no name (for the inferior executable) - since it is not a shared object. */ - if (LM_NAME (so_list_ptr) != 0) - { - -#ifdef USE_LDR_ROUTINES - int len = strlen (LM_NAME (so_list_ptr) + 1); - - if (len > MAX_PATH_SIZE) - len = MAX_PATH_SIZE; - strncpy (so_list_ptr->so_name, LM_NAME (so_list_ptr), MAX_PATH_SIZE); - so_list_ptr->so_name[MAX_PATH_SIZE - 1] = '\0'; - - for (i = 0; i < lm->module_info.lmi_nregion; i++) - { - ldr_region_info_t region_info; - size_t retsize; - CORE_ADDR region_offset; - - if (ldr_inq_region (fake_ldr_process, lm->module_info.lmi_modid, - i, ®ion_info, sizeof (region_info), - &retsize) != 0) - break; - region_offset = (CORE_ADDR) region_info.lri_mapaddr - - (CORE_ADDR) region_info.lri_vaddr; - if (i == 0) - LM_OFFSET (so_list_ptr) = region_offset; - else if (LM_OFFSET (so_list_ptr) != region_offset) - warning ("cannot handle shared library relocation for %s (%s)", - so_list_ptr->so_name, region_info.lri_name); - } -#else - int errcode; - char *buffer; - target_read_string ((CORE_ADDR) LM_NAME (so_list_ptr), &buffer, - MAX_PATH_SIZE - 1, &errcode); - if (errcode != 0) - error ("xfer_link_map_member: Can't read pathname for load map: %s\n", - safe_strerror (errcode)); - strncpy (so_list_ptr->so_name, buffer, MAX_PATH_SIZE - 1); - free (buffer); - so_list_ptr->so_name[MAX_PATH_SIZE - 1] = '\0'; - - for (i = 0; i < lm->module_info.region_count; i++) - { - ldr_region_info_t region_info; - CORE_ADDR region_offset; - - if (target_read_memory (lm->module_info.regioninfo_addr - + i * sizeof (region_info), - (char *) ®ion_info, - sizeof (region_info)) != 0) - break; - region_offset = region_info.mapaddr - region_info.vaddr; - if (i == 0) - LM_OFFSET (so_list_ptr) = region_offset; - else if (LM_OFFSET (so_list_ptr) != region_offset) - { - char *region_name; - target_read_string (region_info.regionname_addr, &buffer, - MAX_PATH_SIZE - 1, &errcode); - if (errcode == 0) - region_name = buffer; - else - region_name = "??"; - warning ("cannot handle shared library relocation for %s (%s)", - so_list_ptr->so_name, region_name); - free (buffer); - } - } -#endif - - solib_map_sections (so_list_ptr); - } -} - -/* - -LOCAL FUNCTION - - find_solib -- step through list of shared objects - -SYNOPSIS - - struct so_list *find_solib (struct so_list *so_list_ptr) - -DESCRIPTION - - This module contains the routine which finds the names of any - loaded "images" in the current process. The argument in must be - NULL on the first call, and then the returned value must be passed - in on subsequent calls. This provides the capability to "step" down - the list of loaded objects. On the last object, a NULL value is - returned. - - The arg and return value are "struct link_map" pointers, as defined - in . - */ - -static struct so_list * -find_solib (so_list_ptr) - struct so_list *so_list_ptr; /* Last lm or NULL for first one */ -{ - struct so_list *so_list_next = NULL; - struct link_map *lm = NULL; - struct so_list *new; - - if (so_list_ptr == NULL) - { - /* We are setting up for a new scan through the loaded images. */ - if ((so_list_next = so_list_head) == NULL) - { - /* Find the first link map list member. */ - lm = first_link_map_member (); - } - } - else - { - /* We have been called before, and are in the process of walking - the shared library list. Advance to the next shared object. */ - lm = next_link_map_member (so_list_ptr); - so_list_next = so_list_ptr -> next; - } - if ((so_list_next == NULL) && (lm != NULL)) - { - /* Get next link map structure from inferior image and build a local - abbreviated load_map structure */ - new = (struct so_list *) xmalloc (sizeof (struct so_list)); - memset ((char *) new, 0, sizeof (struct so_list)); - new -> lmaddr = lm; - /* Add the new node as the next node in the list, or as the root - node if this is the first one. */ - if (so_list_ptr != NULL) - { - so_list_ptr -> next = new; - } - else - { - so_list_head = new; - } - so_list_next = new; - xfer_link_map_member (new, lm); - } - return (so_list_next); -} - -/* A small stub to get us past the arg-passing pinhole of catch_errors. */ - -static int -symbol_add_stub (arg) - char *arg; -{ - register struct so_list *so = (struct so_list *) arg; /* catch_errs bogon */ - - so -> objfile = symbol_file_add (so -> so_name, so -> from_tty, - so -> textsection -> addr, - 0, 0, 0); - return (1); -} - -/* - -GLOBAL FUNCTION - - solib_add -- add a shared library file to the symtab and section list - -SYNOPSIS - - void solib_add (char *arg_string, int from_tty, - struct target_ops *target) - -DESCRIPTION - -*/ - -void -solib_add (arg_string, from_tty, target) - char *arg_string; - int from_tty; - struct target_ops *target; -{ - register struct so_list *so = NULL; /* link map state variable */ - - /* Last shared library that we read. */ - struct so_list *so_last = NULL; - - char *re_err; - int count; - int old; - - if ((re_err = re_comp (arg_string ? arg_string : ".")) != NULL) - { - error ("Invalid regexp: %s", re_err); - } - - - /* Add the shared library sections to the section table of the - specified target, if any. */ - if (target) - { - /* Count how many new section_table entries there are. */ - so = NULL; - count = 0; - while ((so = find_solib (so)) != NULL) - { - if (so -> so_name[0]) - { - count += so -> sections_end - so -> sections; - } - } - - if (count) - { - int update_coreops; - - /* We must update the to_sections field in the core_ops structure - here, otherwise we dereference a potential dangling pointer - for each call to target_read/write_memory within this routine. */ - update_coreops = core_ops.to_sections == target->to_sections; - - /* Reallocate the target's section table including the new size. */ - if (target -> to_sections) - { - old = target -> to_sections_end - target -> to_sections; - target -> to_sections = (struct section_table *) - xrealloc ((char *)target -> to_sections, - (sizeof (struct section_table)) * (count + old)); - } - else - { - old = 0; - target -> to_sections = (struct section_table *) - xmalloc ((sizeof (struct section_table)) * count); - } - target -> to_sections_end = target -> to_sections + (count + old); - - /* Update the to_sections field in the core_ops structure - if needed. */ - if (update_coreops) - { - core_ops.to_sections = target->to_sections; - core_ops.to_sections_end = target->to_sections_end; - } - - /* Add these section table entries to the target's table. */ - while ((so = find_solib (so)) != NULL) - { - if (so -> so_name[0]) - { - count = so -> sections_end - so -> sections; - memcpy ((char *) (target -> to_sections + old), - so -> sections, - (sizeof (struct section_table)) * count); - old += count; - } - } - } - } - - /* Now add the symbol files. */ - so = NULL; - while ((so = find_solib (so)) != NULL) - { - if (so -> so_name[0] && re_exec (so -> so_name)) - { - so -> from_tty = from_tty; - if (so -> symbols_loaded) - { - if (from_tty) - { - printf_unfiltered ("Symbols already loaded for %s\n", so -> so_name); - } - } - else if (catch_errors - (symbol_add_stub, (char *) so, - "Error while reading shared library symbols:\n", - RETURN_MASK_ALL)) - { - so_last = so; - so -> symbols_loaded = 1; - } - } - } - - /* Getting new symbols may change our opinion about what is - frameless. */ - if (so_last) - reinit_frame_cache (); -} - -/* - -LOCAL FUNCTION - - info_sharedlibrary_command -- code for "info sharedlibrary" - -SYNOPSIS - - static void info_sharedlibrary_command () - -DESCRIPTION - - Walk through the shared library list and print information - about each attached library. -*/ - -static void -info_sharedlibrary_command (ignore, from_tty) - char *ignore; - int from_tty; -{ - register struct so_list *so = NULL; /* link map state variable */ - int header_done = 0; - - if (exec_bfd == NULL) - { - printf_unfiltered ("No exec file.\n"); - return; - } - while ((so = find_solib (so)) != NULL) - { - if (so -> so_name[0]) - { - unsigned long txt_start = 0; - unsigned long txt_end = 0; - - if (!header_done) - { - printf_unfiltered("%-20s%-20s%-12s%s\n", "From", "To", "Syms Read", - "Shared Object Library"); - header_done++; - } - if (so -> textsection) - { - txt_start = (unsigned long) so -> textsection -> addr; - txt_end = (unsigned long) so -> textsection -> endaddr; - } - printf_unfiltered ("%-20s", local_hex_string_custom (txt_start, "08l")); - printf_unfiltered ("%-20s", local_hex_string_custom (txt_end, "08l")); - printf_unfiltered ("%-12s", so -> symbols_loaded ? "Yes" : "No"); - printf_unfiltered ("%s\n", so -> so_name); - } - } - if (so_list_head == NULL) - { - printf_unfiltered ("No shared libraries loaded at this time.\n"); - } -} - -/* - -GLOBAL FUNCTION - - solib_address -- check to see if an address is in a shared lib - -SYNOPSIS - - char *solib_address (CORE_ADDR address) - -DESCRIPTION - - Provides a hook for other gdb routines to discover whether or - not a particular address is within the mapped address space of - a shared library. Any address between the base mapping address - and the first address beyond the end of the last mapping, is - considered to be within the shared library address space, for - our purposes. - - For example, this routine is called at one point to disable - breakpoints which are in shared libraries that are not currently - mapped in. - */ - -char * -solib_address (address) - CORE_ADDR address; -{ - register struct so_list *so = 0; /* link map state variable */ - - while ((so = find_solib (so)) != NULL) - { - if (so -> so_name[0] && so -> textsection) - { - if ((address >= (CORE_ADDR) so -> textsection -> addr) && - (address < (CORE_ADDR) so -> textsection -> endaddr)) - return (so->so_name); - } - } - return (0); -} - -/* Called by free_all_symtabs */ - -void -clear_solib() -{ - struct so_list *next; - char *bfd_filename; - - while (so_list_head) - { - if (so_list_head -> sections) - { - free ((PTR)so_list_head -> sections); - } - if (so_list_head -> abfd) - { - bfd_filename = bfd_get_filename (so_list_head -> abfd); - if (!bfd_close (so_list_head -> abfd)) - warning ("cannot close \"%s\": %s", - bfd_filename, bfd_errmsg (bfd_get_error ())); - } - else - /* This happens for the executable on SVR4. */ - bfd_filename = NULL; - - next = so_list_head -> next; - if (bfd_filename) - free ((PTR)bfd_filename); - free ((PTR)so_list_head); - so_list_head = next; - } -} - -/* - -GLOBAL FUNCTION - - solib_create_inferior_hook -- shared library startup support - -SYNOPSIS - - void solib_create_inferior_hook() - -DESCRIPTION - - When gdb starts up the inferior, it nurses it along (through the - shell) until it is ready to execute it's first instruction. At this - point, this function gets called via expansion of the macro - SOLIB_CREATE_INFERIOR_HOOK. - For a statically bound executable, this first instruction is the - one at "_start", or a similar text label. No further processing is - needed in that case. - For a dynamically bound executable, this first instruction is somewhere - in the rld, and the actual user executable is not yet mapped in. - We continue the inferior again, rld then maps in the actual user - executable and any needed shared libraries and then sends - itself a SIGTRAP. - At that point we discover the names of all shared libraries and - read their symbols in. - -FIXME - - This code does not properly handle hitting breakpoints which the - user might have set in the rld itself. Proper handling would have - to check if the SIGTRAP happened due to a kill call. - - Also, what if child has exit()ed? Must exit loop somehow. - */ - -void -solib_create_inferior_hook() -{ - - /* Nothing to do for statically bound executables. */ - - if (symfile_objfile == NULL - || symfile_objfile->obfd == NULL - || ((bfd_get_file_flags (symfile_objfile->obfd) & DYNAMIC) == 0)) - return; - - /* Now run the target. It will eventually get a SIGTRAP, at - which point all of the libraries will have been mapped in and we - can go groveling around in the rld structures to find - out what we need to know about them. */ - - clear_proceed_status (); - stop_soon_quietly = 1; - stop_signal = TARGET_SIGNAL_0; - do - { - target_resume (-1, 0, stop_signal); - wait_for_inferior (); - } - while (stop_signal != TARGET_SIGNAL_TRAP); - - /* solib_add will call reinit_frame_cache. - But we are stopped in the runtime loader and we do not have symbols - for the runtime loader. So heuristic_proc_start will be called - and will put out an annoying warning. - Delaying the resetting of stop_soon_quietly until after symbol loading - suppresses the warning. */ - if (auto_solib_add) - solib_add ((char *) 0, 0, (struct target_ops *) 0); - stop_soon_quietly = 0; -} - - -/* - -LOCAL FUNCTION - - sharedlibrary_command -- handle command to explicitly add library - -SYNOPSIS - - static void sharedlibrary_command (char *args, int from_tty) - -DESCRIPTION - -*/ - -static void -sharedlibrary_command (args, from_tty) -char *args; -int from_tty; -{ - dont_repeat (); - solib_add (args, from_tty, (struct target_ops *) 0); -} - -void -_initialize_solib() -{ - add_com ("sharedlibrary", class_files, sharedlibrary_command, - "Load shared object library symbols for files matching REGEXP."); - add_info ("sharedlibrary", info_sharedlibrary_command, - "Status of loaded shared object libraries."); - - add_show_from_set - (add_set_cmd ("auto-solib-add", class_support, var_zinteger, - (char *) &auto_solib_add, - "Set autoloading of shared library symbols.\n\ -If nonzero, symbols from all shared object libraries will be loaded\n\ -automatically when the inferior begins execution or when the dynamic linker\n\ -informs gdb that a new library has been loaded. Otherwise, symbols\n\ -must be loaded manually, using `sharedlibrary'.", - &setlist), - &showlist); -} diff --git a/contrib/gdb/gdb/ppcbug-rom.c b/contrib/gdb/gdb/ppcbug-rom.c deleted file mode 100644 index 6c7432b..0000000 --- a/contrib/gdb/gdb/ppcbug-rom.c +++ /dev/null @@ -1,233 +0,0 @@ -/* Remote debugging interface for PPCbug (PowerPC) Rom monitor - for GDB, the GNU debugger. - Copyright 1995 Free Software Foundation, Inc. - - Written by Stu Grossman of Cygnus Support - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without 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 "target.h" -#include "monitor.h" -#include "serial.h" - -static void ppcbug_open PARAMS ((char *args, int from_tty)); - -static void -ppcbug_supply_register (regname, regnamelen, val, vallen) - char *regname; - int regnamelen; - char *val; - int vallen; -{ - int regno = 0, base = 0; - - if (regnamelen < 2 || regnamelen > 4) - return; - - switch (regname[0]) - { - case 'R': - if (regname[1] < '0' || regname[1] > '9') - return; - if (regnamelen == 2) - regno = regname[1] - '0'; - else if (regnamelen == 3 && regname[2] >= '0' && regname[2] <= '9') - regno = (regname[1] - '0') * 10 + (regname[2] - '0'); - else - return; - break; - case 'F': - if (regname[1] != 'R' || regname[2] < '0' || regname[2] > '9') - return; - if (regnamelen == 3) - regno = 32 + regname[2] - '0'; - else if (regnamelen == 4 && regname[3] >= '0' && regname[3] <= '9') - regno = 32 + (regname[2] - '0') * 10 + (regname[3] - '0'); - else - return; - break; - case 'I': - if (regnamelen != 2 || regname[1] != 'P') - return; - regno = 64; - break; - case 'M': - if (regnamelen != 3 || regname[1] != 'S' || regname[2] != 'R') - return; - regno = 65; - break; - case 'C': - if (regnamelen != 2 || regname[1] != 'R') - return; - regno = 66; - break; - case 'S': - if (regnamelen != 4 || regname[1] != 'P' || regname[2] != 'R') - return; - else if (regname[3] == '8') - regno = 67; - else if (regname[3] == '9') - regno = 68; - else if (regname[3] == '1') - regno = 69; - else if (regname[3] == '0') - regno = 70; - else - return; - break; - default: - return; - } - - monitor_supply_register (regno, val); -} - -/* - * This array of registers needs to match the indexes used by GDB. The - * whole reason this exists is because the various ROM monitors use - * different names than GDB does, and don't support all the - * registers either. So, typing "info reg sp" becomes an "A7". - */ - -static char *ppcbug_regnames[NUM_REGS] = -{ - "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", - "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", - "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", - "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", - - "fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7", - "fr8", "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15", - "fr16", "fr17", "fr18", "fr19", "fr20", "fr21", "fr22", "fr23", - "fr24", "fr25", "fr26", "fr27", "fr28", "fr29", "fr30", "fr31", - -/* pc ps cnd lr cnt xer mq */ - "ip", "msr", "cr", "spr8", "spr9", "spr1", "spr0" -}; - -/* - * Define the monitor command strings. Since these are passed directly - * through to a printf style function, we need can include formatting - * strings. We also need a CR or LF on the end. - */ - -static struct target_ops ppcbug_ops0; -static struct target_ops ppcbug_ops1; - -static char *ppcbug_inits[] = {"\r", NULL}; - -#define PPC_CMDS(LOAD_CMD, OPS) \ -{ \ - MO_CLR_BREAK_USES_ADDR | MO_HANDLE_NL, \ - ppcbug_inits, /* Init strings */ \ - "g\r", /* continue command */ \ - "t\r", /* single step */ \ - NULL, /* interrupt command */ \ - "br %x\r", /* set a breakpoint */ \ - "nobr %x\r", /* clear a breakpoint */ \ - "nobr\r", /* clear all breakpoints */ \ - "bf %x:%x %x;b\r", /* fill (start count val) */ \ - { \ - "ms %x %02x\r", /* setmem.cmdb (addr, value) */ \ - "ms %x %04x\r", /* setmem.cmdw (addr, value) */ \ - "ms %x %08x\r", /* setmem.cmdl (addr, value) */ \ - NULL, /* setmem.cmdll (addr, value) */ \ - NULL, /* setreg.resp_delim */ \ - NULL, /* setreg.term */ \ - NULL, /* setreg.term_cmd */ \ - }, \ - { \ - "md %x:%x;b\r", /* getmem.cmdb (addr, len) */ \ - "md %x:%x;b\r", /* getmem.cmdw (addr, len) */ \ - "md %x:%x;b\r", /* getmem.cmdl (addr, len) */ \ - NULL, /* getmem.cmdll (addr, len) */ \ - " ", /* getmem.resp_delim */ \ - NULL, /* getmem.term */ \ - NULL, /* getmem.term_cmd */ \ - }, \ - { \ - "rs %s %x\r", /* setreg.cmd (name, value) */ \ - NULL, /* setreg.resp_delim */ \ - NULL, /* setreg.term */ \ - NULL /* setreg.term_cmd */ \ - }, \ - { \ - "rs %s\r", /* getreg.cmd (name) */ \ - "=", /* getreg.resp_delim */ \ - NULL, /* getreg.term */ \ - NULL /* getreg.term_cmd */ \ - }, \ - "rd\r", /* dump_registers */ \ - "\\(\\w+\\) +=\\([0-9a-fA-F]+\\b\\)", /* register_pattern */ \ - ppcbug_supply_register, /* supply_register */ \ - NULL, /* load_routine (defaults to SRECs) */ \ - LOAD_CMD, /* download command */ \ - NULL, /* load response */ \ - "PPC1-Bug>", /* monitor command prompt */ \ - "\r", /* end-of-line terminator */ \ - NULL, /* optional command terminator */ \ - &OPS, /* target operations */ \ - SERIAL_1_STOPBITS, /* number of stop bits */ \ - ppcbug_regnames, /* registers names */ \ - MONITOR_OPS_MAGIC /* magic */ \ -} - - -static struct monitor_ops ppcbug_cmds0 = PPC_CMDS("lo 0\r", ppcbug_ops0); -static struct monitor_ops ppcbug_cmds1 = PPC_CMDS("lo 1\r", ppcbug_ops1); - -static void -ppcbug_open0(args, from_tty) - char *args; - int from_tty; -{ - monitor_open (args, &ppcbug_cmds0, from_tty); -} - -static void -ppcbug_open1(args, from_tty) - char *args; - int from_tty; -{ - monitor_open (args, &ppcbug_cmds1, from_tty); -} - -void -_initialize_ppcbug_rom () -{ - init_monitor_ops (&ppcbug_ops0); - - ppcbug_ops0.to_shortname = "ppcbug"; - ppcbug_ops0.to_longname = "PowerPC PPCBug monitor on port 0"; - ppcbug_ops0.to_doc = "Debug via the PowerPC PPCBug monitor using port 0.\n\ -Specify the serial device it is connected to (e.g. /dev/ttya)."; - ppcbug_ops0.to_open = ppcbug_open0; - - add_target (&ppcbug_ops0); - - init_monitor_ops (&ppcbug_ops1); - - ppcbug_ops1.to_shortname = "ppcbug1"; - ppcbug_ops1.to_longname = "PowerPC PPCBug monitor on port 1"; - ppcbug_ops1.to_doc = "Debug via the PowerPC PPCBug monitor using port 1.\n\ -Specify the serial device it is connected to (e.g. /dev/ttya)."; - ppcbug_ops1.to_open = ppcbug_open1; - - add_target (&ppcbug_ops1); -} diff --git a/contrib/gdb/gdb/procfs.c b/contrib/gdb/gdb/procfs.c deleted file mode 100644 index edc062b..0000000 --- a/contrib/gdb/gdb/procfs.c +++ /dev/null @@ -1,3815 +0,0 @@ -/* Machine independent support for SVR4 /proc (process file system) for GDB. - Copyright 1991, 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc. - Written by Fred Fish at Cygnus Support. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without 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. */ - - -/* N O T E S - -For information on the details of using /proc consult section proc(4) -in the UNIX System V Release 4 System Administrator's Reference Manual. - -The general register and floating point register sets are manipulated by -separate ioctl's. This file makes the assumption that if FP0_REGNUM is -defined, then support for the floating point register set is desired, -regardless of whether or not the actual target has floating point hardware. - - */ - - -#include "defs.h" - -#include -#include -#include -#include -#include -#include -#include -#include "gdb_string.h" -#include -#include -#include -#include "gdb_stat.h" - -#include "inferior.h" -#include "target.h" -#include "command.h" -#include "gdbcore.h" -#include "thread.h" - -#define MAX_SYSCALLS 256 /* Maximum number of syscalls for table */ - -#ifndef PROC_NAME_FMT -#define PROC_NAME_FMT "/proc/%05d" -#endif - -extern struct target_ops procfs_ops; /* Forward declaration */ - -#if 1 /* FIXME: Gross and ugly hack to resolve coredep.c global */ -CORE_ADDR kernel_u_addr; -#endif - -#ifdef BROKEN_SIGINFO_H /* Workaround broken SGS */ -#undef si_pid -#define si_pid _data._proc.pid -#undef si_uid -#define si_uid _data._proc._pdata._kill.uid -#endif /* BROKEN_SIGINFO_H */ - -/* All access to the inferior, either one started by gdb or one that has - been attached to, is controlled by an instance of a procinfo structure, - defined below. Since gdb currently only handles one inferior at a time, - the procinfo structure for the inferior is statically allocated and - only one exists at any given time. There is a separate procinfo - structure for use by the "info proc" command, so that we can print - useful information about any random process without interfering with - the inferior's procinfo information. */ - -struct procinfo { - struct procinfo *next; - int pid; /* Process ID of inferior */ - int fd; /* File descriptor for /proc entry */ - char *pathname; /* Pathname to /proc entry */ - int had_event; /* poll/select says something happened */ - int was_stopped; /* Nonzero if was stopped prior to attach */ - int nopass_next_sigstop; /* Don't pass a sigstop on next resume */ - prrun_t prrun; /* Control state when it is run */ - prstatus_t prstatus; /* Current process status info */ - gregset_t gregset; /* General register set */ - fpregset_t fpregset; /* Floating point register set */ - fltset_t fltset; /* Current traced hardware fault set */ - sigset_t trace; /* Current traced signal set */ - sysset_t exitset; /* Current traced system call exit set */ - sysset_t entryset; /* Current traced system call entry set */ - fltset_t saved_fltset; /* Saved traced hardware fault set */ - sigset_t saved_trace; /* Saved traced signal set */ - sigset_t saved_sighold; /* Saved held signal set */ - sysset_t saved_exitset; /* Saved traced system call exit set */ - sysset_t saved_entryset; /* Saved traced system call entry set */ -}; - -/* List of inferior process information */ -static struct procinfo *procinfo_list = NULL; - -static struct pollfd *poll_list; /* pollfds used for waiting on /proc */ - -static int num_poll_list = 0; /* Number of entries in poll_list */ - -static int last_resume_pid = -1; /* Last pid used with procfs_resume */ - -/* Much of the information used in the /proc interface, particularly for - printing status information, is kept as tables of structures of the - following form. These tables can be used to map numeric values to - their symbolic names and to a string that describes their specific use. */ - -struct trans { - int value; /* The numeric value */ - char *name; /* The equivalent symbolic value */ - char *desc; /* Short description of value */ -}; - -/* Translate bits in the pr_flags member of the prstatus structure, into the - names and desc information. */ - -static struct trans pr_flag_table[] = -{ -#if defined (PR_STOPPED) - { PR_STOPPED, "PR_STOPPED", "Process is stopped" }, -#endif -#if defined (PR_ISTOP) - { PR_ISTOP, "PR_ISTOP", "Stopped on an event of interest" }, -#endif -#if defined (PR_DSTOP) - { PR_DSTOP, "PR_DSTOP", "A stop directive is in effect" }, -#endif -#if defined (PR_ASLEEP) - { PR_ASLEEP, "PR_ASLEEP", "Sleeping in an interruptible system call" }, -#endif -#if defined (PR_FORK) - { PR_FORK, "PR_FORK", "Inherit-on-fork is in effect" }, -#endif -#if defined (PR_RLC) - { PR_RLC, "PR_RLC", "Run-on-last-close is in effect" }, -#endif -#if defined (PR_PTRACE) - { PR_PTRACE, "PR_PTRACE", "Process is being controlled by ptrace" }, -#endif -#if defined (PR_PCINVAL) - { PR_PCINVAL, "PR_PCINVAL", "PC refers to an invalid virtual address" }, -#endif -#if defined (PR_ISSYS) - { PR_ISSYS, "PR_ISSYS", "Is a system process" }, -#endif -#if defined (PR_STEP) - { PR_STEP, "PR_STEP", "Process has single step pending" }, -#endif -#if defined (PR_KLC) - { PR_KLC, "PR_KLC", "Kill-on-last-close is in effect" }, -#endif -#if defined (PR_ASYNC) - { PR_ASYNC, "PR_ASYNC", "Asynchronous stop is in effect" }, -#endif -#if defined (PR_PCOMPAT) - { PR_PCOMPAT, "PR_PCOMPAT", "Ptrace compatibility mode in effect" }, -#endif - { 0, NULL, NULL } -}; - -/* Translate values in the pr_why field of the prstatus struct. */ - -static struct trans pr_why_table[] = -{ -#if defined (PR_REQUESTED) - { PR_REQUESTED, "PR_REQUESTED", "Directed to stop via PIOCSTOP/PIOCWSTOP" }, -#endif -#if defined (PR_SIGNALLED) - { PR_SIGNALLED, "PR_SIGNALLED", "Receipt of a traced signal" }, -#endif -#if defined (PR_FAULTED) - { PR_FAULTED, "PR_FAULTED", "Incurred a traced hardware fault" }, -#endif -#if defined (PR_SYSENTRY) - { PR_SYSENTRY, "PR_SYSENTRY", "Entry to a traced system call" }, -#endif -#if defined (PR_SYSEXIT) - { PR_SYSEXIT, "PR_SYSEXIT", "Exit from a traced system call" }, -#endif -#if defined (PR_JOBCONTROL) - { PR_JOBCONTROL, "PR_JOBCONTROL", "Default job control stop signal action" }, -#endif -#if defined (PR_SUSPENDED) - { PR_SUSPENDED, "PR_SUSPENDED", "Process suspended" }, -#endif - { 0, NULL, NULL } -}; - -/* Hardware fault translation table. */ - -static struct trans faults_table[] = -{ -#if defined (FLTILL) - { FLTILL, "FLTILL", "Illegal instruction" }, -#endif -#if defined (FLTPRIV) - { FLTPRIV, "FLTPRIV", "Privileged instruction" }, -#endif -#if defined (FLTBPT) - { FLTBPT, "FLTBPT", "Breakpoint trap" }, -#endif -#if defined (FLTTRACE) - { FLTTRACE, "FLTTRACE", "Trace trap" }, -#endif -#if defined (FLTACCESS) - { FLTACCESS, "FLTACCESS", "Memory access fault" }, -#endif -#if defined (FLTBOUNDS) - { FLTBOUNDS, "FLTBOUNDS", "Memory bounds violation" }, -#endif -#if defined (FLTIOVF) - { FLTIOVF, "FLTIOVF", "Integer overflow" }, -#endif -#if defined (FLTIZDIV) - { FLTIZDIV, "FLTIZDIV", "Integer zero divide" }, -#endif -#if defined (FLTFPE) - { FLTFPE, "FLTFPE", "Floating-point exception" }, -#endif -#if defined (FLTSTACK) - { FLTSTACK, "FLTSTACK", "Unrecoverable stack fault" }, -#endif -#if defined (FLTPAGE) - { FLTPAGE, "FLTPAGE", "Recoverable page fault" }, -#endif - { 0, NULL, NULL } -}; - -/* Translation table for signal generation information. See UNIX System - V Release 4 Programmer's Reference Manual, siginfo(5). */ - -static struct sigcode { - int signo; - int code; - char *codename; - char *desc; -} siginfo_table[] = { -#if defined (SIGILL) && defined (ILL_ILLOPC) - { SIGILL, ILL_ILLOPC, "ILL_ILLOPC", "Illegal opcode" }, -#endif -#if defined (SIGILL) && defined (ILL_ILLOPN) - { SIGILL, ILL_ILLOPN, "ILL_ILLOPN", "Illegal operand", }, -#endif -#if defined (SIGILL) && defined (ILL_ILLADR) - { SIGILL, ILL_ILLADR, "ILL_ILLADR", "Illegal addressing mode" }, -#endif -#if defined (SIGILL) && defined (ILL_ILLTRP) - { SIGILL, ILL_ILLTRP, "ILL_ILLTRP", "Illegal trap" }, -#endif -#if defined (SIGILL) && defined (ILL_PRVOPC) - { SIGILL, ILL_PRVOPC, "ILL_PRVOPC", "Privileged opcode" }, -#endif -#if defined (SIGILL) && defined (ILL_PRVREG) - { SIGILL, ILL_PRVREG, "ILL_PRVREG", "Privileged register" }, -#endif -#if defined (SIGILL) && defined (ILL_COPROC) - { SIGILL, ILL_COPROC, "ILL_COPROC", "Coprocessor error" }, -#endif -#if defined (SIGILL) && defined (ILL_BADSTK) - { SIGILL, ILL_BADSTK, "ILL_BADSTK", "Internal stack error" }, -#endif -#if defined (SIGFPE) && defined (FPE_INTDIV) - { SIGFPE, FPE_INTDIV, "FPE_INTDIV", "Integer divide by zero" }, -#endif -#if defined (SIGFPE) && defined (FPE_INTOVF) - { SIGFPE, FPE_INTOVF, "FPE_INTOVF", "Integer overflow" }, -#endif -#if defined (SIGFPE) && defined (FPE_FLTDIV) - { SIGFPE, FPE_FLTDIV, "FPE_FLTDIV", "Floating point divide by zero" }, -#endif -#if defined (SIGFPE) && defined (FPE_FLTOVF) - { SIGFPE, FPE_FLTOVF, "FPE_FLTOVF", "Floating point overflow" }, -#endif -#if defined (SIGFPE) && defined (FPE_FLTUND) - { SIGFPE, FPE_FLTUND, "FPE_FLTUND", "Floating point underflow" }, -#endif -#if defined (SIGFPE) && defined (FPE_FLTRES) - { SIGFPE, FPE_FLTRES, "FPE_FLTRES", "Floating point inexact result" }, -#endif -#if defined (SIGFPE) && defined (FPE_FLTINV) - { SIGFPE, FPE_FLTINV, "FPE_FLTINV", "Invalid floating point operation" }, -#endif -#if defined (SIGFPE) && defined (FPE_FLTSUB) - { SIGFPE, FPE_FLTSUB, "FPE_FLTSUB", "Subscript out of range" }, -#endif -#if defined (SIGSEGV) && defined (SEGV_MAPERR) - { SIGSEGV, SEGV_MAPERR, "SEGV_MAPERR", "Address not mapped to object" }, -#endif -#if defined (SIGSEGV) && defined (SEGV_ACCERR) - { SIGSEGV, SEGV_ACCERR, "SEGV_ACCERR", "Invalid permissions for object" }, -#endif -#if defined (SIGBUS) && defined (BUS_ADRALN) - { SIGBUS, BUS_ADRALN, "BUS_ADRALN", "Invalid address alignment" }, -#endif -#if defined (SIGBUS) && defined (BUS_ADRERR) - { SIGBUS, BUS_ADRERR, "BUS_ADRERR", "Non-existent physical address" }, -#endif -#if defined (SIGBUS) && defined (BUS_OBJERR) - { SIGBUS, BUS_OBJERR, "BUS_OBJERR", "Object specific hardware error" }, -#endif -#if defined (SIGTRAP) && defined (TRAP_BRKPT) - { SIGTRAP, TRAP_BRKPT, "TRAP_BRKPT", "Process breakpoint" }, -#endif -#if defined (SIGTRAP) && defined (TRAP_TRACE) - { SIGTRAP, TRAP_TRACE, "TRAP_TRACE", "Process trace trap" }, -#endif -#if defined (SIGCLD) && defined (CLD_EXITED) - { SIGCLD, CLD_EXITED, "CLD_EXITED", "Child has exited" }, -#endif -#if defined (SIGCLD) && defined (CLD_KILLED) - { SIGCLD, CLD_KILLED, "CLD_KILLED", "Child was killed" }, -#endif -#if defined (SIGCLD) && defined (CLD_DUMPED) - { SIGCLD, CLD_DUMPED, "CLD_DUMPED", "Child has terminated abnormally" }, -#endif -#if defined (SIGCLD) && defined (CLD_TRAPPED) - { SIGCLD, CLD_TRAPPED, "CLD_TRAPPED", "Traced child has trapped" }, -#endif -#if defined (SIGCLD) && defined (CLD_STOPPED) - { SIGCLD, CLD_STOPPED, "CLD_STOPPED", "Child has stopped" }, -#endif -#if defined (SIGCLD) && defined (CLD_CONTINUED) - { SIGCLD, CLD_CONTINUED, "CLD_CONTINUED", "Stopped child had continued" }, -#endif -#if defined (SIGPOLL) && defined (POLL_IN) - { SIGPOLL, POLL_IN, "POLL_IN", "Input input available" }, -#endif -#if defined (SIGPOLL) && defined (POLL_OUT) - { SIGPOLL, POLL_OUT, "POLL_OUT", "Output buffers available" }, -#endif -#if defined (SIGPOLL) && defined (POLL_MSG) - { SIGPOLL, POLL_MSG, "POLL_MSG", "Input message available" }, -#endif -#if defined (SIGPOLL) && defined (POLL_ERR) - { SIGPOLL, POLL_ERR, "POLL_ERR", "I/O error" }, -#endif -#if defined (SIGPOLL) && defined (POLL_PRI) - { SIGPOLL, POLL_PRI, "POLL_PRI", "High priority input available" }, -#endif -#if defined (SIGPOLL) && defined (POLL_HUP) - { SIGPOLL, POLL_HUP, "POLL_HUP", "Device disconnected" }, -#endif - { 0, 0, NULL, NULL } -}; - -static char *syscall_table[MAX_SYSCALLS]; - -/* Prototypes for local functions */ - -static void set_proc_siginfo PARAMS ((struct procinfo *, int)); - -static void init_syscall_table PARAMS ((void)); - -static char *syscallname PARAMS ((int)); - -static char *signalname PARAMS ((int)); - -static char *errnoname PARAMS ((int)); - -static int proc_address_to_fd PARAMS ((struct procinfo *, CORE_ADDR, int)); - -static int open_proc_file PARAMS ((int, struct procinfo *, int)); - -static void close_proc_file PARAMS ((struct procinfo *)); - -static void unconditionally_kill_inferior PARAMS ((struct procinfo *)); - -static NORETURN void proc_init_failed PARAMS ((struct procinfo *, char *)) ATTR_NORETURN; - -static void info_proc PARAMS ((char *, int)); - -static void info_proc_flags PARAMS ((struct procinfo *, int)); - -static void info_proc_stop PARAMS ((struct procinfo *, int)); - -static void info_proc_siginfo PARAMS ((struct procinfo *, int)); - -static void info_proc_syscalls PARAMS ((struct procinfo *, int)); - -static void info_proc_mappings PARAMS ((struct procinfo *, int)); - -static void info_proc_signals PARAMS ((struct procinfo *, int)); - -static void info_proc_faults PARAMS ((struct procinfo *, int)); - -static char *mappingflags PARAMS ((long)); - -static char *lookupname PARAMS ((struct trans *, unsigned int, char *)); - -static char *lookupdesc PARAMS ((struct trans *, unsigned int)); - -static int do_attach PARAMS ((int pid)); - -static void do_detach PARAMS ((int siggnal)); - -static void procfs_create_inferior PARAMS ((char *, char *, char **)); - -static void procfs_notice_signals PARAMS ((int pid)); - -static struct procinfo *find_procinfo PARAMS ((pid_t pid, int okfail)); - -/* External function prototypes that can't be easily included in any - header file because the args are typedefs in system include files. */ - -extern void supply_gregset PARAMS ((gregset_t *)); - -extern void fill_gregset PARAMS ((gregset_t *, int)); - -extern void supply_fpregset PARAMS ((fpregset_t *)); - -extern void fill_fpregset PARAMS ((fpregset_t *, int)); - -/* - -LOCAL FUNCTION - - find_procinfo -- convert a process id to a struct procinfo - -SYNOPSIS - - static struct procinfo * find_procinfo (pid_t pid, int okfail); - -DESCRIPTION - - Given a process id, look it up in the procinfo chain. Returns - a struct procinfo *. If can't find pid, then call error(), - unless okfail is set, in which case, return NULL; - */ - -static struct procinfo * -find_procinfo (pid, okfail) - pid_t pid; - int okfail; -{ - struct procinfo *procinfo; - - for (procinfo = procinfo_list; procinfo; procinfo = procinfo->next) - if (procinfo->pid == pid) - return procinfo; - - if (okfail) - return NULL; - - error ("procfs (find_procinfo): Couldn't locate pid %d", pid); -} - -/* - -LOCAL MACRO - - current_procinfo -- convert inferior_pid to a struct procinfo - -SYNOPSIS - - static struct procinfo * current_procinfo; - -DESCRIPTION - - Looks up inferior_pid in the procinfo chain. Always returns a - struct procinfo *. If process can't be found, we error() out. - */ - -#define current_procinfo find_procinfo (inferior_pid, 0) - -/* - -LOCAL FUNCTION - - add_fd -- Add the fd to the poll/select list - -SYNOPSIS - - static void add_fd (struct procinfo *); - -DESCRIPTION - - Add the fd of the supplied procinfo to the list of fds used for - poll/select operations. - */ - -static void -add_fd (pi) - struct procinfo *pi; -{ - if (num_poll_list <= 0) - poll_list = (struct pollfd *) xmalloc (sizeof (struct pollfd)); - else - poll_list = (struct pollfd *) xrealloc (poll_list, - (num_poll_list + 1) - * sizeof (struct pollfd)); - poll_list[num_poll_list].fd = pi->fd; - poll_list[num_poll_list].events = POLLPRI; - - num_poll_list++; -} - -static void -remove_fd (pi) - struct procinfo *pi; -{ - int i; - - for (i = 0; i < num_poll_list; i++) - { - if (poll_list[i].fd == pi->fd) - { - if (i != num_poll_list - 1) - memcpy (poll_list, poll_list + i + 1, - (num_poll_list - i - 1) * sizeof (struct pollfd)); - - num_poll_list--; - - if (num_poll_list == 0) - free (poll_list); - else - poll_list = (struct pollfd *) xrealloc (poll_list, - num_poll_list - * sizeof (struct pollfd)); - return; - } - } -} - -#define LOSING_POLL unixware_sux - -static struct procinfo * -wait_fd () -{ - struct procinfo *pi; - int num_fds; - int i; - - set_sigint_trap (); /* Causes SIGINT to be passed on to the - attached process. */ - set_sigio_trap (); - -#ifndef LOSING_POLL - num_fds = poll (poll_list, num_poll_list, -1); -#else - pi = current_procinfo; - - while (ioctl (pi->fd, PIOCWSTOP, &pi->prstatus) < 0) - { - if (errno == ENOENT) - { - /* Process exited. */ - pi->prstatus.pr_flags = 0; - break; - } - else if (errno != EINTR) - { - print_sys_errmsg (pi->pathname, errno); - error ("PIOCWSTOP failed"); - } - } - pi->had_event = 1; -#endif - - clear_sigint_trap (); - clear_sigio_trap (); - -#ifndef LOSING_POLL - - if (num_fds <= 0) - { - print_sys_errmsg ("poll failed\n", errno); - error ("Poll failed, returned %d", num_fds); - } - - for (i = 0; i < num_poll_list && num_fds > 0; i++) - { - if ((poll_list[i].revents & (POLLPRI|POLLERR|POLLHUP|POLLNVAL)) == 0) - continue; - for (pi = procinfo_list; pi; pi = pi->next) - { - if (poll_list[i].fd == pi->fd) - { - if (ioctl (pi->fd, PIOCSTATUS, &pi->prstatus) < 0) - { - print_sys_errmsg (pi->pathname, errno); - error ("PIOCSTATUS failed"); - } - num_fds--; - pi->had_event = 1; - break; - } - } - if (!pi) - error ("procfs_wait: Couldn't find procinfo for fd %d\n", - poll_list[i].fd); - } -#endif /* LOSING_POLL */ - - return pi; -} - -/* - -LOCAL FUNCTION - - lookupdesc -- translate a value to a summary desc string - -SYNOPSIS - - static char *lookupdesc (struct trans *transp, unsigned int val); - -DESCRIPTION - - Given a pointer to a translation table and a value to be translated, - lookup the desc string and return it. - */ - -static char * -lookupdesc (transp, val) - struct trans *transp; - unsigned int val; -{ - char *desc; - - for (desc = NULL; transp -> name != NULL; transp++) - { - if (transp -> value == val) - { - desc = transp -> desc; - break; - } - } - - /* Didn't find a translation for the specified value, set a default one. */ - - if (desc == NULL) - { - desc = "Unknown"; - } - return (desc); -} - -/* - -LOCAL FUNCTION - - lookupname -- translate a value to symbolic name - -SYNOPSIS - - static char *lookupname (struct trans *transp, unsigned int val, - char *prefix); - -DESCRIPTION - - Given a pointer to a translation table, a value to be translated, - and a default prefix to return if the value can't be translated, - match the value with one of the translation table entries and - return a pointer to the symbolic name. - - If no match is found it just returns the value as a printable string, - with the given prefix. The previous such value, if any, is freed - at this time. - */ - -static char * -lookupname (transp, val, prefix) - struct trans *transp; - unsigned int val; - char *prefix; -{ - static char *locbuf; - char *name; - - for (name = NULL; transp -> name != NULL; transp++) - { - if (transp -> value == val) - { - name = transp -> name; - break; - } - } - - /* Didn't find a translation for the specified value, build a default - one using the specified prefix and return it. The lifetime of - the value is only until the next one is needed. */ - - if (name == NULL) - { - if (locbuf != NULL) - { - free (locbuf); - } - locbuf = xmalloc (strlen (prefix) + 16); - sprintf (locbuf, "%s %u", prefix, val); - name = locbuf; - } - return (name); -} - -static char * -sigcodename (sip) - siginfo_t *sip; -{ - struct sigcode *scp; - char *name = NULL; - static char locbuf[32]; - - for (scp = siginfo_table; scp -> codename != NULL; scp++) - { - if ((scp -> signo == sip -> si_signo) && - (scp -> code == sip -> si_code)) - { - name = scp -> codename; - break; - } - } - if (name == NULL) - { - sprintf (locbuf, "sigcode %u", sip -> si_signo); - name = locbuf; - } - return (name); -} - -static char * -sigcodedesc (sip) - siginfo_t *sip; -{ - struct sigcode *scp; - char *desc = NULL; - - for (scp = siginfo_table; scp -> codename != NULL; scp++) - { - if ((scp -> signo == sip -> si_signo) && - (scp -> code == sip -> si_code)) - { - desc = scp -> desc; - break; - } - } - if (desc == NULL) - { - desc = "Unrecognized signal or trap use"; - } - return (desc); -} - -/* - -LOCAL FUNCTION - - syscallname - translate a system call number into a system call name - -SYNOPSIS - - char *syscallname (int syscallnum) - -DESCRIPTION - - Given a system call number, translate it into the printable name - of a system call, or into "syscall " if it is an unknown - number. - */ - -static char * -syscallname (syscallnum) - int syscallnum; -{ - static char locbuf[32]; - char *rtnval; - - if (syscallnum >= 0 && syscallnum < MAX_SYSCALLS) - { - rtnval = syscall_table[syscallnum]; - } - else - { - sprintf (locbuf, "syscall %u", syscallnum); - rtnval = locbuf; - } - return (rtnval); -} - -/* - -LOCAL FUNCTION - - init_syscall_table - initialize syscall translation table - -SYNOPSIS - - void init_syscall_table (void) - -DESCRIPTION - - Dynamically initialize the translation table to convert system - call numbers into printable system call names. Done once per - gdb run, on initialization. - -NOTES - - This is awfully ugly, but preprocessor tricks to make it prettier - tend to be nonportable. - */ - -static void -init_syscall_table () -{ -#if defined (SYS_exit) - syscall_table[SYS_exit] = "exit"; -#endif -#if defined (SYS_fork) - syscall_table[SYS_fork] = "fork"; -#endif -#if defined (SYS_read) - syscall_table[SYS_read] = "read"; -#endif -#if defined (SYS_write) - syscall_table[SYS_write] = "write"; -#endif -#if defined (SYS_open) - syscall_table[SYS_open] = "open"; -#endif -#if defined (SYS_close) - syscall_table[SYS_close] = "close"; -#endif -#if defined (SYS_wait) - syscall_table[SYS_wait] = "wait"; -#endif -#if defined (SYS_creat) - syscall_table[SYS_creat] = "creat"; -#endif -#if defined (SYS_link) - syscall_table[SYS_link] = "link"; -#endif -#if defined (SYS_unlink) - syscall_table[SYS_unlink] = "unlink"; -#endif -#if defined (SYS_exec) - syscall_table[SYS_exec] = "exec"; -#endif -#if defined (SYS_execv) - syscall_table[SYS_execv] = "execv"; -#endif -#if defined (SYS_execve) - syscall_table[SYS_execve] = "execve"; -#endif -#if defined (SYS_chdir) - syscall_table[SYS_chdir] = "chdir"; -#endif -#if defined (SYS_time) - syscall_table[SYS_time] = "time"; -#endif -#if defined (SYS_mknod) - syscall_table[SYS_mknod] = "mknod"; -#endif -#if defined (SYS_chmod) - syscall_table[SYS_chmod] = "chmod"; -#endif -#if defined (SYS_chown) - syscall_table[SYS_chown] = "chown"; -#endif -#if defined (SYS_brk) - syscall_table[SYS_brk] = "brk"; -#endif -#if defined (SYS_stat) - syscall_table[SYS_stat] = "stat"; -#endif -#if defined (SYS_lseek) - syscall_table[SYS_lseek] = "lseek"; -#endif -#if defined (SYS_getpid) - syscall_table[SYS_getpid] = "getpid"; -#endif -#if defined (SYS_mount) - syscall_table[SYS_mount] = "mount"; -#endif -#if defined (SYS_umount) - syscall_table[SYS_umount] = "umount"; -#endif -#if defined (SYS_setuid) - syscall_table[SYS_setuid] = "setuid"; -#endif -#if defined (SYS_getuid) - syscall_table[SYS_getuid] = "getuid"; -#endif -#if defined (SYS_stime) - syscall_table[SYS_stime] = "stime"; -#endif -#if defined (SYS_ptrace) - syscall_table[SYS_ptrace] = "ptrace"; -#endif -#if defined (SYS_alarm) - syscall_table[SYS_alarm] = "alarm"; -#endif -#if defined (SYS_fstat) - syscall_table[SYS_fstat] = "fstat"; -#endif -#if defined (SYS_pause) - syscall_table[SYS_pause] = "pause"; -#endif -#if defined (SYS_utime) - syscall_table[SYS_utime] = "utime"; -#endif -#if defined (SYS_stty) - syscall_table[SYS_stty] = "stty"; -#endif -#if defined (SYS_gtty) - syscall_table[SYS_gtty] = "gtty"; -#endif -#if defined (SYS_access) - syscall_table[SYS_access] = "access"; -#endif -#if defined (SYS_nice) - syscall_table[SYS_nice] = "nice"; -#endif -#if defined (SYS_statfs) - syscall_table[SYS_statfs] = "statfs"; -#endif -#if defined (SYS_sync) - syscall_table[SYS_sync] = "sync"; -#endif -#if defined (SYS_kill) - syscall_table[SYS_kill] = "kill"; -#endif -#if defined (SYS_fstatfs) - syscall_table[SYS_fstatfs] = "fstatfs"; -#endif -#if defined (SYS_pgrpsys) - syscall_table[SYS_pgrpsys] = "pgrpsys"; -#endif -#if defined (SYS_xenix) - syscall_table[SYS_xenix] = "xenix"; -#endif -#if defined (SYS_dup) - syscall_table[SYS_dup] = "dup"; -#endif -#if defined (SYS_pipe) - syscall_table[SYS_pipe] = "pipe"; -#endif -#if defined (SYS_times) - syscall_table[SYS_times] = "times"; -#endif -#if defined (SYS_profil) - syscall_table[SYS_profil] = "profil"; -#endif -#if defined (SYS_plock) - syscall_table[SYS_plock] = "plock"; -#endif -#if defined (SYS_setgid) - syscall_table[SYS_setgid] = "setgid"; -#endif -#if defined (SYS_getgid) - syscall_table[SYS_getgid] = "getgid"; -#endif -#if defined (SYS_signal) - syscall_table[SYS_signal] = "signal"; -#endif -#if defined (SYS_msgsys) - syscall_table[SYS_msgsys] = "msgsys"; -#endif -#if defined (SYS_sys3b) - syscall_table[SYS_sys3b] = "sys3b"; -#endif -#if defined (SYS_acct) - syscall_table[SYS_acct] = "acct"; -#endif -#if defined (SYS_shmsys) - syscall_table[SYS_shmsys] = "shmsys"; -#endif -#if defined (SYS_semsys) - syscall_table[SYS_semsys] = "semsys"; -#endif -#if defined (SYS_ioctl) - syscall_table[SYS_ioctl] = "ioctl"; -#endif -#if defined (SYS_uadmin) - syscall_table[SYS_uadmin] = "uadmin"; -#endif -#if defined (SYS_utssys) - syscall_table[SYS_utssys] = "utssys"; -#endif -#if defined (SYS_fsync) - syscall_table[SYS_fsync] = "fsync"; -#endif -#if defined (SYS_umask) - syscall_table[SYS_umask] = "umask"; -#endif -#if defined (SYS_chroot) - syscall_table[SYS_chroot] = "chroot"; -#endif -#if defined (SYS_fcntl) - syscall_table[SYS_fcntl] = "fcntl"; -#endif -#if defined (SYS_ulimit) - syscall_table[SYS_ulimit] = "ulimit"; -#endif -#if defined (SYS_rfsys) - syscall_table[SYS_rfsys] = "rfsys"; -#endif -#if defined (SYS_rmdir) - syscall_table[SYS_rmdir] = "rmdir"; -#endif -#if defined (SYS_mkdir) - syscall_table[SYS_mkdir] = "mkdir"; -#endif -#if defined (SYS_getdents) - syscall_table[SYS_getdents] = "getdents"; -#endif -#if defined (SYS_sysfs) - syscall_table[SYS_sysfs] = "sysfs"; -#endif -#if defined (SYS_getmsg) - syscall_table[SYS_getmsg] = "getmsg"; -#endif -#if defined (SYS_putmsg) - syscall_table[SYS_putmsg] = "putmsg"; -#endif -#if defined (SYS_poll) - syscall_table[SYS_poll] = "poll"; -#endif -#if defined (SYS_lstat) - syscall_table[SYS_lstat] = "lstat"; -#endif -#if defined (SYS_symlink) - syscall_table[SYS_symlink] = "symlink"; -#endif -#if defined (SYS_readlink) - syscall_table[SYS_readlink] = "readlink"; -#endif -#if defined (SYS_setgroups) - syscall_table[SYS_setgroups] = "setgroups"; -#endif -#if defined (SYS_getgroups) - syscall_table[SYS_getgroups] = "getgroups"; -#endif -#if defined (SYS_fchmod) - syscall_table[SYS_fchmod] = "fchmod"; -#endif -#if defined (SYS_fchown) - syscall_table[SYS_fchown] = "fchown"; -#endif -#if defined (SYS_sigprocmask) - syscall_table[SYS_sigprocmask] = "sigprocmask"; -#endif -#if defined (SYS_sigsuspend) - syscall_table[SYS_sigsuspend] = "sigsuspend"; -#endif -#if defined (SYS_sigaltstack) - syscall_table[SYS_sigaltstack] = "sigaltstack"; -#endif -#if defined (SYS_sigaction) - syscall_table[SYS_sigaction] = "sigaction"; -#endif -#if defined (SYS_sigpending) - syscall_table[SYS_sigpending] = "sigpending"; -#endif -#if defined (SYS_context) - syscall_table[SYS_context] = "context"; -#endif -#if defined (SYS_evsys) - syscall_table[SYS_evsys] = "evsys"; -#endif -#if defined (SYS_evtrapret) - syscall_table[SYS_evtrapret] = "evtrapret"; -#endif -#if defined (SYS_statvfs) - syscall_table[SYS_statvfs] = "statvfs"; -#endif -#if defined (SYS_fstatvfs) - syscall_table[SYS_fstatvfs] = "fstatvfs"; -#endif -#if defined (SYS_nfssys) - syscall_table[SYS_nfssys] = "nfssys"; -#endif -#if defined (SYS_waitsys) - syscall_table[SYS_waitsys] = "waitsys"; -#endif -#if defined (SYS_sigsendsys) - syscall_table[SYS_sigsendsys] = "sigsendsys"; -#endif -#if defined (SYS_hrtsys) - syscall_table[SYS_hrtsys] = "hrtsys"; -#endif -#if defined (SYS_acancel) - syscall_table[SYS_acancel] = "acancel"; -#endif -#if defined (SYS_async) - syscall_table[SYS_async] = "async"; -#endif -#if defined (SYS_priocntlsys) - syscall_table[SYS_priocntlsys] = "priocntlsys"; -#endif -#if defined (SYS_pathconf) - syscall_table[SYS_pathconf] = "pathconf"; -#endif -#if defined (SYS_mincore) - syscall_table[SYS_mincore] = "mincore"; -#endif -#if defined (SYS_mmap) - syscall_table[SYS_mmap] = "mmap"; -#endif -#if defined (SYS_mprotect) - syscall_table[SYS_mprotect] = "mprotect"; -#endif -#if defined (SYS_munmap) - syscall_table[SYS_munmap] = "munmap"; -#endif -#if defined (SYS_fpathconf) - syscall_table[SYS_fpathconf] = "fpathconf"; -#endif -#if defined (SYS_vfork) - syscall_table[SYS_vfork] = "vfork"; -#endif -#if defined (SYS_fchdir) - syscall_table[SYS_fchdir] = "fchdir"; -#endif -#if defined (SYS_readv) - syscall_table[SYS_readv] = "readv"; -#endif -#if defined (SYS_writev) - syscall_table[SYS_writev] = "writev"; -#endif -#if defined (SYS_xstat) - syscall_table[SYS_xstat] = "xstat"; -#endif -#if defined (SYS_lxstat) - syscall_table[SYS_lxstat] = "lxstat"; -#endif -#if defined (SYS_fxstat) - syscall_table[SYS_fxstat] = "fxstat"; -#endif -#if defined (SYS_xmknod) - syscall_table[SYS_xmknod] = "xmknod"; -#endif -#if defined (SYS_clocal) - syscall_table[SYS_clocal] = "clocal"; -#endif -#if defined (SYS_setrlimit) - syscall_table[SYS_setrlimit] = "setrlimit"; -#endif -#if defined (SYS_getrlimit) - syscall_table[SYS_getrlimit] = "getrlimit"; -#endif -#if defined (SYS_lchown) - syscall_table[SYS_lchown] = "lchown"; -#endif -#if defined (SYS_memcntl) - syscall_table[SYS_memcntl] = "memcntl"; -#endif -#if defined (SYS_getpmsg) - syscall_table[SYS_getpmsg] = "getpmsg"; -#endif -#if defined (SYS_putpmsg) - syscall_table[SYS_putpmsg] = "putpmsg"; -#endif -#if defined (SYS_rename) - syscall_table[SYS_rename] = "rename"; -#endif -#if defined (SYS_uname) - syscall_table[SYS_uname] = "uname"; -#endif -#if defined (SYS_setegid) - syscall_table[SYS_setegid] = "setegid"; -#endif -#if defined (SYS_sysconfig) - syscall_table[SYS_sysconfig] = "sysconfig"; -#endif -#if defined (SYS_adjtime) - syscall_table[SYS_adjtime] = "adjtime"; -#endif -#if defined (SYS_systeminfo) - syscall_table[SYS_systeminfo] = "systeminfo"; -#endif -#if defined (SYS_seteuid) - syscall_table[SYS_seteuid] = "seteuid"; -#endif -#if defined (SYS_sproc) - syscall_table[SYS_sproc] = "sproc"; -#endif -} - -/* - -LOCAL FUNCTION - - procfs_kill_inferior - kill any currently inferior - -SYNOPSIS - - void procfs_kill_inferior (void) - -DESCRIPTION - - Kill any current inferior. - -NOTES - - Kills even attached inferiors. Presumably the user has already - been prompted that the inferior is an attached one rather than - one started by gdb. (FIXME?) - -*/ - -static void -procfs_kill_inferior () -{ - target_mourn_inferior (); -} - -/* - -LOCAL FUNCTION - - unconditionally_kill_inferior - terminate the inferior - -SYNOPSIS - - static void unconditionally_kill_inferior (struct procinfo *) - -DESCRIPTION - - Kill the specified inferior. - -NOTE - - A possibly useful enhancement would be to first try sending - the inferior a terminate signal, politely asking it to commit - suicide, before we murder it (we could call that - politely_kill_inferior()). - -*/ - -static void -unconditionally_kill_inferior (pi) - struct procinfo *pi; -{ - int signo; - int ppid; - - ppid = pi->prstatus.pr_ppid; - - signo = SIGKILL; - -#ifdef PROCFS_NEED_CLEAR_CURSIG_FOR_KILL - /* Alpha OSF/1-3.x procfs needs a clear of the current signal - before the PIOCKILL, otherwise it might generate a corrupted core - file for the inferior. */ - ioctl (pi->fd, PIOCSSIG, NULL); -#endif -#ifdef PROCFS_NEED_PIOCSSIG_FOR_KILL - /* Alpha OSF/1-2.x procfs needs a PIOCSSIG call with a SIGKILL signal - to kill the inferior, otherwise it might remain stopped with a - pending SIGKILL. - We do not check the result of the PIOCSSIG, the inferior might have - died already. */ - { - struct siginfo newsiginfo; - - memset ((char *) &newsiginfo, 0, sizeof (newsiginfo)); - newsiginfo.si_signo = signo; - newsiginfo.si_code = 0; - newsiginfo.si_errno = 0; - newsiginfo.si_pid = getpid (); - newsiginfo.si_uid = getuid (); - ioctl (pi->fd, PIOCSSIG, &newsiginfo); - } -#else - ioctl (pi->fd, PIOCKILL, &signo); -#endif - - close_proc_file (pi); - -/* Only wait() for our direct children. Our grandchildren zombies are killed - by the death of their parents. */ - - if (ppid == getpid()) - wait ((int *) 0); -} - -/* - -LOCAL FUNCTION - - procfs_xfer_memory -- copy data to or from inferior memory space - -SYNOPSIS - - int procfs_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, - int dowrite, struct target_ops target) - -DESCRIPTION - - Copy LEN bytes to/from inferior's memory starting at MEMADDR - from/to debugger memory starting at MYADDR. Copy from inferior - if DOWRITE is zero or to inferior if DOWRITE is nonzero. - - Returns the length copied, which is either the LEN argument or - zero. This xfer function does not do partial moves, since procfs_ops - doesn't allow memory operations to cross below us in the target stack - anyway. - -NOTES - - The /proc interface makes this an almost trivial task. - */ - -static int -procfs_xfer_memory (memaddr, myaddr, len, dowrite, target) - CORE_ADDR memaddr; - char *myaddr; - int len; - int dowrite; - struct target_ops *target; /* ignored */ -{ - int nbytes = 0; - struct procinfo *pi; - - pi = current_procinfo; - - if (lseek(pi->fd, (off_t) memaddr, 0) == (off_t) memaddr) - { - if (dowrite) - { - nbytes = write (pi->fd, myaddr, len); - } - else - { - nbytes = read (pi->fd, myaddr, len); - } - if (nbytes < 0) - { - nbytes = 0; - } - } - return (nbytes); -} - -/* - -LOCAL FUNCTION - - procfs_store_registers -- copy register values back to inferior - -SYNOPSIS - - void procfs_store_registers (int regno) - -DESCRIPTION - - Store our current register values back into the inferior. If - REGNO is -1 then store all the register, otherwise store just - the value specified by REGNO. - -NOTES - - If we are storing only a single register, we first have to get all - the current values from the process, overwrite the desired register - in the gregset with the one we want from gdb's registers, and then - send the whole set back to the process. For writing all the - registers, all we have to do is generate the gregset and send it to - the process. - - Also note that the process has to be stopped on an event of interest - for this to work, which basically means that it has to have been - run under the control of one of the other /proc ioctl calls and not - ptrace. Since we don't use ptrace anyway, we don't worry about this - fine point, but it is worth noting for future reference. - - Gdb is confused about what this function is supposed to return. - Some versions return a value, others return nothing. Some are - declared to return a value and actually return nothing. Gdb ignores - anything returned. (FIXME) - - */ - -static void -procfs_store_registers (regno) - int regno; -{ - struct procinfo *pi; - - pi = current_procinfo; - - if (regno != -1) - { - ioctl (pi->fd, PIOCGREG, &pi->gregset); - } - fill_gregset (&pi->gregset, regno); - ioctl (pi->fd, PIOCSREG, &pi->gregset); - -#if defined (FP0_REGNUM) - - /* Now repeat everything using the floating point register set, if the - target has floating point hardware. Since we ignore the returned value, - we'll never know whether it worked or not anyway. */ - - if (regno != -1) - { - ioctl (pi->fd, PIOCGFPREG, &pi->fpregset); - } - fill_fpregset (&pi->fpregset, regno); - ioctl (pi->fd, PIOCSFPREG, &pi->fpregset); - -#endif /* FP0_REGNUM */ - -} - -/* - -LOCAL FUNCTION - - create_procinfo - initialize access to a /proc entry - -SYNOPSIS - - struct procinfo * create_procinfo (int pid) - -DESCRIPTION - - Allocate a procinfo structure, open the /proc file and then set up the - set of signals and faults that are to be traced. Returns a pointer to - the new procinfo structure. - -NOTES - - If proc_init_failed ever gets called, control returns to the command - processing loop via the standard error handling code. - - */ - -static struct procinfo * -create_procinfo (pid) - int pid; -{ - struct procinfo *pi; - - pi = find_procinfo (pid, 1); - if (pi != NULL) - return pi; /* All done! It already exists */ - - pi = (struct procinfo *) xmalloc (sizeof (struct procinfo)); - - if (!open_proc_file (pid, pi, O_RDWR)) - proc_init_failed (pi, "can't open process file"); - - /* Add new process to process info list */ - - pi->next = procinfo_list; - procinfo_list = pi; - - add_fd (pi); /* Add to list for poll/select */ - - memset ((char *) &pi->prrun, 0, sizeof (pi->prrun)); - prfillset (&pi->prrun.pr_trace); - procfs_notice_signals (pid); - prfillset (&pi->prrun.pr_fault); - prdelset (&pi->prrun.pr_fault, FLTPAGE); - -#ifdef PROCFS_DONT_TRACE_FAULTS - premptyset (&pi->prrun.pr_fault); -#endif - - if (ioctl (pi->fd, PIOCWSTOP, &pi->prstatus) < 0) - proc_init_failed (pi, "PIOCWSTOP failed"); - - if (ioctl (pi->fd, PIOCSFAULT, &pi->prrun.pr_fault) < 0) - proc_init_failed (pi, "PIOCSFAULT failed"); - - return pi; -} - -/* - -LOCAL FUNCTION - - procfs_init_inferior - initialize target vector and access to a - /proc entry - -SYNOPSIS - - void procfs_init_inferior (int pid) - -DESCRIPTION - - When gdb starts an inferior, this function is called in the parent - process immediately after the fork. It waits for the child to stop - on the return from the exec system call (the child itself takes care - of ensuring that this is set up), then sets up the set of signals - and faults that are to be traced. - -NOTES - - If proc_init_failed ever gets called, control returns to the command - processing loop via the standard error handling code. - - */ - -static void -procfs_init_inferior (pid) - int pid; -{ - push_target (&procfs_ops); - - create_procinfo (pid); - add_thread (pid); /* Setup initial thread */ - -#ifdef START_INFERIOR_TRAPS_EXPECTED - startup_inferior (START_INFERIOR_TRAPS_EXPECTED); -#else - /* One trap to exec the shell, one to exec the program being debugged. */ - startup_inferior (2); -#endif -} - -/* - -GLOBAL FUNCTION - - procfs_notice_signals - -SYNOPSIS - - static void procfs_notice_signals (int pid); - -DESCRIPTION - - When the user changes the state of gdb's signal handling via the - "handle" command, this function gets called to see if any change - in the /proc interface is required. It is also called internally - by other /proc interface functions to initialize the state of - the traced signal set. - - One thing it does is that signals for which the state is "nostop", - "noprint", and "pass", have their trace bits reset in the pr_trace - field, so that they are no longer traced. This allows them to be - delivered directly to the inferior without the debugger ever being - involved. - */ - -static void -procfs_notice_signals (pid) - int pid; -{ - int signo; - struct procinfo *pi; - - pi = find_procinfo (pid, 0); - - for (signo = 0; signo < NSIG; signo++) - { - if (signal_stop_state (target_signal_from_host (signo)) == 0 && - signal_print_state (target_signal_from_host (signo)) == 0 && - signal_pass_state (target_signal_from_host (signo)) == 1) - { - prdelset (&pi->prrun.pr_trace, signo); - } - else - { - praddset (&pi->prrun.pr_trace, signo); - } - } - if (ioctl (pi->fd, PIOCSTRACE, &pi->prrun.pr_trace)) - { - print_sys_errmsg ("PIOCSTRACE failed", errno); - } -} - -/* - -LOCAL FUNCTION - - proc_set_exec_trap -- arrange for exec'd child to halt at startup - -SYNOPSIS - - void proc_set_exec_trap (void) - -DESCRIPTION - - This function is called in the child process when starting up - an inferior, prior to doing the exec of the actual inferior. - It sets the child process's exitset to make exit from the exec - system call an event of interest to stop on, and then simply - returns. The child does the exec, the system call returns, and - the child stops at the first instruction, ready for the gdb - parent process to take control of it. - -NOTE - - We need to use all local variables since the child may be sharing - it's data space with the parent, if vfork was used rather than - fork. - - Also note that we want to turn off the inherit-on-fork flag in - the child process so that any grand-children start with all - tracing flags cleared. - */ - -static void -proc_set_exec_trap () -{ - sysset_t exitset; - sysset_t entryset; - auto char procname[32]; - int fd; - - sprintf (procname, PROC_NAME_FMT, getpid ()); - if ((fd = open (procname, O_RDWR)) < 0) - { - perror (procname); - gdb_flush (gdb_stderr); - _exit (127); - } - premptyset (&exitset); - premptyset (&entryset); - -#ifdef PIOCSSPCACT - /* Under Alpha OSF/1 we have to use a PIOCSSPCACT ioctl to trace - exits from exec system calls because of the user level loader. */ - { - int prfs_flags; - - if (ioctl (fd, PIOCGSPCACT, &prfs_flags) < 0) - { - perror (procname); - gdb_flush (gdb_stderr); - _exit (127); - } - prfs_flags |= PRFS_STOPEXEC; - if (ioctl (fd, PIOCSSPCACT, &prfs_flags) < 0) - { - perror (procname); - gdb_flush (gdb_stderr); - _exit (127); - } - } -#else - /* GW: Rationale... - Not all systems with /proc have all the exec* syscalls with the same - names. On the SGI, for example, there is no SYS_exec, but there - *is* a SYS_execv. So, we try to account for that. */ - -#ifdef SYS_exec - praddset (&exitset, SYS_exec); -#endif -#ifdef SYS_execve - praddset (&exitset, SYS_execve); -#endif -#ifdef SYS_execv - praddset (&exitset, SYS_execv); -#endif - - if (ioctl (fd, PIOCSEXIT, &exitset) < 0) - { - perror (procname); - gdb_flush (gdb_stderr); - _exit (127); - } -#endif - - praddset (&entryset, SYS_exit); - - if (ioctl (fd, PIOCSENTRY, &entryset) < 0) - { - perror (procname); - gdb_flush (gdb_stderr); - _exit (126); - } - - /* Turn off inherit-on-fork flag so that all grand-children of gdb - start with tracing flags cleared. */ - -#if defined (PIOCRESET) /* New method */ - { - long pr_flags; - pr_flags = PR_FORK; - ioctl (fd, PIOCRESET, &pr_flags); - } -#else -#if defined (PIOCRFORK) /* Original method */ - ioctl (fd, PIOCRFORK, NULL); -#endif -#endif - - /* Turn on run-on-last-close flag so that this process will not hang - if GDB goes away for some reason. */ - -#if defined (PIOCSET) /* New method */ - { - long pr_flags; - pr_flags = PR_RLC; - (void) ioctl (fd, PIOCSET, &pr_flags); - } -#else -#if defined (PIOCSRLC) /* Original method */ - (void) ioctl (fd, PIOCSRLC, 0); -#endif -#endif -} - -/* - -GLOBAL FUNCTION - - proc_iterate_over_mappings -- call function for every mapped space - -SYNOPSIS - - int proc_iterate_over_mappings (int (*func)()) - -DESCRIPTION - - Given a pointer to a function, call that function for every - mapped address space, passing it an open file descriptor for - the file corresponding to that mapped address space (if any) - and the base address of the mapped space. Quit when we hit - the end of the mappings or the function returns nonzero. - */ - -int -proc_iterate_over_mappings (func) - int (*func) PARAMS ((int, CORE_ADDR)); -{ - int nmap; - int fd; - int funcstat = 0; - struct prmap *prmaps; - struct prmap *prmap; - struct procinfo *pi; - - pi = current_procinfo; - - if (ioctl (pi->fd, PIOCNMAP, &nmap) == 0) - { - prmaps = (struct prmap *) alloca ((nmap + 1) * sizeof (*prmaps)); - if (ioctl (pi->fd, PIOCMAP, prmaps) == 0) - { - for (prmap = prmaps; prmap -> pr_size && funcstat == 0; ++prmap) - { - fd = proc_address_to_fd (pi, (CORE_ADDR) prmap -> pr_vaddr, 0); - funcstat = (*func) (fd, (CORE_ADDR) prmap -> pr_vaddr); - close (fd); - } - } - } - return (funcstat); -} - -#if 0 /* Currently unused */ -/* - -GLOBAL FUNCTION - - proc_base_address -- find base address for segment containing address - -SYNOPSIS - - CORE_ADDR proc_base_address (CORE_ADDR addr) - -DESCRIPTION - - Given an address of a location in the inferior, find and return - the base address of the mapped segment containing that address. - - This is used for example, by the shared library support code, - where we have the pc value for some location in the shared library - where we are stopped, and need to know the base address of the - segment containing that address. -*/ - -CORE_ADDR -proc_base_address (addr) - CORE_ADDR addr; -{ - int nmap; - struct prmap *prmaps; - struct prmap *prmap; - CORE_ADDR baseaddr = 0; - struct procinfo *pi; - - pi = current_procinfo; - - if (ioctl (pi->fd, PIOCNMAP, &nmap) == 0) - { - prmaps = (struct prmap *) alloca ((nmap + 1) * sizeof (*prmaps)); - if (ioctl (pi->fd, PIOCMAP, prmaps) == 0) - { - for (prmap = prmaps; prmap -> pr_size; ++prmap) - { - if ((prmap -> pr_vaddr <= (caddr_t) addr) && - (prmap -> pr_vaddr + prmap -> pr_size > (caddr_t) addr)) - { - baseaddr = (CORE_ADDR) prmap -> pr_vaddr; - break; - } - } - } - } - return (baseaddr); -} - -#endif /* 0 */ - -/* - -LOCAL FUNCTION - - proc_address_to_fd -- return open fd for file mapped to address - -SYNOPSIS - - int proc_address_to_fd (struct procinfo *pi, CORE_ADDR addr, complain) - -DESCRIPTION - - Given an address in the current inferior's address space, use the - /proc interface to find an open file descriptor for the file that - this address was mapped in from. Return -1 if there is no current - inferior. Print a warning message if there is an inferior but - the address corresponds to no file (IE a bogus address). - -*/ - -static int -proc_address_to_fd (pi, addr, complain) - struct procinfo *pi; - CORE_ADDR addr; - int complain; -{ - int fd = -1; - - if ((fd = ioctl (pi->fd, PIOCOPENM, (caddr_t *) &addr)) < 0) - { - if (complain) - { - print_sys_errmsg (pi->pathname, errno); - warning ("can't find mapped file for address 0x%x", addr); - } - } - return (fd); -} - - -/* Attach to process PID, then initialize for debugging it - and wait for the trace-trap that results from attaching. */ - -static void -procfs_attach (args, from_tty) - char *args; - int from_tty; -{ - char *exec_file; - int pid; - - if (!args) - error_no_arg ("process-id to attach"); - - pid = atoi (args); - - if (pid == getpid()) /* Trying to masturbate? */ - error ("I refuse to debug myself!"); - - if (from_tty) - { - exec_file = (char *) get_exec_file (0); - - if (exec_file) - printf_unfiltered ("Attaching to program `%s', %s\n", exec_file, target_pid_to_str (pid)); - else - printf_unfiltered ("Attaching to %s\n", target_pid_to_str (pid)); - - gdb_flush (gdb_stdout); - } - - do_attach (pid); - inferior_pid = pid; - push_target (&procfs_ops); -} - - -/* Take a program previously attached to and detaches it. - The program resumes execution and will no longer stop - on signals, etc. We'd better not have left any breakpoints - in the program or it'll die when it hits one. For this - to work, it may be necessary for the process to have been - previously attached. It *might* work if the program was - started via the normal ptrace (PTRACE_TRACEME). */ - -static void -procfs_detach (args, from_tty) - char *args; - int from_tty; -{ - int siggnal = 0; - - if (from_tty) - { - char *exec_file = get_exec_file (0); - if (exec_file == 0) - exec_file = ""; - printf_unfiltered ("Detaching from program: %s %s\n", - exec_file, target_pid_to_str (inferior_pid)); - gdb_flush (gdb_stdout); - } - if (args) - siggnal = atoi (args); - - do_detach (siggnal); - inferior_pid = 0; - unpush_target (&procfs_ops); /* Pop out of handling an inferior */ -} - -/* Get ready to modify the registers array. On machines which store - individual registers, this doesn't need to do anything. On machines - which store all the registers in one fell swoop, this makes sure - that registers contains all the registers from the program being - debugged. */ - -static void -procfs_prepare_to_store () -{ -#ifdef CHILD_PREPARE_TO_STORE - CHILD_PREPARE_TO_STORE (); -#endif -} - -/* Print status information about what we're accessing. */ - -static void -procfs_files_info (ignore) - struct target_ops *ignore; -{ - printf_unfiltered ("\tUsing the running image of %s %s via /proc.\n", - attach_flag? "attached": "child", target_pid_to_str (inferior_pid)); -} - -/* ARGSUSED */ -static void -procfs_open (arg, from_tty) - char *arg; - int from_tty; -{ - error ("Use the \"run\" command to start a Unix child process."); -} - -/* - -LOCAL FUNCTION - - do_attach -- attach to an already existing process - -SYNOPSIS - - int do_attach (int pid) - -DESCRIPTION - - Attach to an already existing process with the specified process - id. If the process is not already stopped, query whether to - stop it or not. - -NOTES - - The option of stopping at attach time is specific to the /proc - versions of gdb. Versions using ptrace force the attachee - to stop. (I have changed this version to do so, too. All you - have to do is "continue" to make it go on. -- gnu@cygnus.com) - -*/ - -static int -do_attach (pid) - int pid; -{ - int result; - struct procinfo *pi; - - pi = (struct procinfo *) xmalloc (sizeof (struct procinfo)); - - if (!open_proc_file (pid, pi, O_RDWR)) - { - free (pi); - perror_with_name (pi->pathname); - /* NOTREACHED */ - } - - /* Add new process to process info list */ - - pi->next = procinfo_list; - procinfo_list = pi; - - add_fd (pi); /* Add to list for poll/select */ - - /* Get current status of process and if it is not already stopped, - then stop it. Remember whether or not it was stopped when we first - examined it. */ - - if (ioctl (pi->fd, PIOCSTATUS, &pi->prstatus) < 0) - { - print_sys_errmsg (pi->pathname, errno); - close_proc_file (pi); - error ("PIOCSTATUS failed"); - } - if (pi->prstatus.pr_flags & (PR_STOPPED | PR_ISTOP)) - { - pi->was_stopped = 1; - } - else - { - pi->was_stopped = 0; - if (1 || query ("Process is currently running, stop it? ")) - { - /* Make it run again when we close it. */ -#if defined (PIOCSET) /* New method */ - { - long pr_flags; - pr_flags = PR_RLC; - result = ioctl (pi->fd, PIOCSET, &pr_flags); - } -#else -#if defined (PIOCSRLC) /* Original method */ - result = ioctl (pi->fd, PIOCSRLC, 0); -#endif -#endif - if (result < 0) - { - print_sys_errmsg (pi->pathname, errno); - close_proc_file (pi); - error ("PIOCSRLC or PIOCSET failed"); - } - if (ioctl (pi->fd, PIOCSTOP, &pi->prstatus) < 0) - { - print_sys_errmsg (pi->pathname, errno); - close_proc_file (pi); - error ("PIOCSTOP failed"); - } - pi->nopass_next_sigstop = 1; - } - else - { - printf_unfiltered ("Ok, gdb will wait for %s to stop.\n", target_pid_to_str (pid)); - } - } - - /* Remember some things about the inferior that we will, or might, change - so that we can restore them when we detach. */ - - ioctl (pi->fd, PIOCGTRACE, &pi->saved_trace); - ioctl (pi->fd, PIOCGHOLD, &pi->saved_sighold); - ioctl (pi->fd, PIOCGFAULT, &pi->saved_fltset); - ioctl (pi->fd, PIOCGENTRY, &pi->saved_entryset); - ioctl (pi->fd, PIOCGEXIT, &pi->saved_exitset); - - /* Set up trace and fault sets, as gdb expects them. */ - - memset (&pi->prrun, 0, sizeof (pi->prrun)); - prfillset (&pi->prrun.pr_trace); - procfs_notice_signals (pid); - prfillset (&pi->prrun.pr_fault); - prdelset (&pi->prrun.pr_fault, FLTPAGE); - -#ifdef PROCFS_DONT_TRACE_FAULTS - premptyset (&pi->prrun.pr_fault); -#endif - - if (ioctl (pi->fd, PIOCSFAULT, &pi->prrun.pr_fault)) - { - print_sys_errmsg ("PIOCSFAULT failed", errno); - } - if (ioctl (pi->fd, PIOCSTRACE, &pi->prrun.pr_trace)) - { - print_sys_errmsg ("PIOCSTRACE failed", errno); - } - attach_flag = 1; - return (pid); -} - -/* - -LOCAL FUNCTION - - do_detach -- detach from an attached-to process - -SYNOPSIS - - void do_detach (int signal) - -DESCRIPTION - - Detach from the current attachee. - - If signal is non-zero, the attachee is started running again and sent - the specified signal. - - If signal is zero and the attachee was not already stopped when we - attached to it, then we make it runnable again when we detach. - - Otherwise, we query whether or not to make the attachee runnable - again, since we may simply want to leave it in the state it was in - when we attached. - - We report any problems, but do not consider them errors, since we - MUST detach even if some things don't seem to go right. This may not - be the ideal situation. (FIXME). - */ - -static void -do_detach (signal) - int signal; -{ - int result; - struct procinfo *pi; - - pi = current_procinfo; - - if (signal) - { - set_proc_siginfo (pi, signal); - } - if (ioctl (pi->fd, PIOCSEXIT, &pi->saved_exitset) < 0) - { - print_sys_errmsg (pi->pathname, errno); - printf_unfiltered ("PIOCSEXIT failed.\n"); - } - if (ioctl (pi->fd, PIOCSENTRY, &pi->saved_entryset) < 0) - { - print_sys_errmsg (pi->pathname, errno); - printf_unfiltered ("PIOCSENTRY failed.\n"); - } - if (ioctl (pi->fd, PIOCSTRACE, &pi->saved_trace) < 0) - { - print_sys_errmsg (pi->pathname, errno); - printf_unfiltered ("PIOCSTRACE failed.\n"); - } - if (ioctl (pi->fd, PIOCSHOLD, &pi->saved_sighold) < 0) - { - print_sys_errmsg (pi->pathname, errno); - printf_unfiltered ("PIOSCHOLD failed.\n"); - } - if (ioctl (pi->fd, PIOCSFAULT, &pi->saved_fltset) < 0) - { - print_sys_errmsg (pi->pathname, errno); - printf_unfiltered ("PIOCSFAULT failed.\n"); - } - if (ioctl (pi->fd, PIOCSTATUS, &pi->prstatus) < 0) - { - print_sys_errmsg (pi->pathname, errno); - printf_unfiltered ("PIOCSTATUS failed.\n"); - } - else - { - if (signal || (pi->prstatus.pr_flags & (PR_STOPPED | PR_ISTOP))) - { - if (signal || !pi->was_stopped || - query ("Was stopped when attached, make it runnable again? ")) - { - /* Clear any pending signal if we want to detach without - a signal. */ - if (signal == 0) - set_proc_siginfo (pi, signal); - - /* Clear any fault that might have stopped it. */ - if (ioctl (pi->fd, PIOCCFAULT, 0)) - { - print_sys_errmsg (pi->pathname, errno); - printf_unfiltered ("PIOCCFAULT failed.\n"); - } - - /* Make it run again when we close it. */ -#if defined (PIOCSET) /* New method */ - { - long pr_flags; - pr_flags = PR_RLC; - result = ioctl (pi->fd, PIOCSET, &pr_flags); - } -#else -#if defined (PIOCSRLC) /* Original method */ - result = ioctl (pi->fd, PIOCSRLC, 0); -#endif -#endif - if (result) - { - print_sys_errmsg (pi->pathname, errno); - printf_unfiltered ("PIOCSRLC or PIOCSET failed.\n"); - } - } - } - } - close_proc_file (pi); - attach_flag = 0; -} - -/* emulate wait() as much as possible. - Wait for child to do something. Return pid of child, or -1 in case - of error; store status in *OURSTATUS. - - Not sure why we can't - just use wait(), but it seems to have problems when applied to a - process being controlled with the /proc interface. - - We have a race problem here with no obvious solution. We need to let - the inferior run until it stops on an event of interest, which means - that we need to use the PIOCWSTOP ioctl. However, we cannot use this - ioctl if the process is already stopped on something that is not an - event of interest, or the call will hang indefinitely. Thus we first - use PIOCSTATUS to see if the process is not stopped. If not, then we - use PIOCWSTOP. But during the window between the two, if the process - stops for any reason that is not an event of interest (such as a job - control signal) then gdb will hang. One possible workaround is to set - an alarm to wake up every minute of so and check to see if the process - is still running, and if so, then reissue the PIOCWSTOP. But this is - a real kludge, so has not been implemented. FIXME: investigate - alternatives. - - FIXME: Investigate why wait() seems to have problems with programs - being control by /proc routines. */ - -static int -procfs_wait (pid, ourstatus) - int pid; - struct target_waitstatus *ourstatus; -{ - short what; - short why; - int statval = 0; - int checkerr = 0; - int rtnval = -1; - struct procinfo *pi; - - if (pid != -1) /* Non-specific process? */ - pi = NULL; - else - for (pi = procinfo_list; pi; pi = pi->next) - if (pi->had_event) - break; - - if (!pi) - { - wait_again: - - pi = wait_fd (); - } - - if (pid != -1) - for (pi = procinfo_list; pi; pi = pi->next) - if (pi->pid == pid && pi->had_event) - break; - - if (!pi && !checkerr) - goto wait_again; - - if (!checkerr && !(pi->prstatus.pr_flags & (PR_STOPPED | PR_ISTOP))) - { - if (ioctl (pi->fd, PIOCWSTOP, &pi->prstatus) < 0) - { - checkerr++; - } - } - if (checkerr) - { - if (errno == ENOENT) - { - rtnval = wait (&statval); - if (rtnval != inferior_pid) - { - print_sys_errmsg (pi->pathname, errno); - error ("PIOCWSTOP, wait failed, returned %d", rtnval); - /* NOTREACHED */ - } - } - else - { - print_sys_errmsg (pi->pathname, errno); - error ("PIOCSTATUS or PIOCWSTOP failed."); - /* NOTREACHED */ - } - } - else if (pi->prstatus.pr_flags & (PR_STOPPED | PR_ISTOP)) - { - rtnval = pi->prstatus.pr_pid; - why = pi->prstatus.pr_why; - what = pi->prstatus.pr_what; - - switch (why) - { - case PR_SIGNALLED: - statval = (what << 8) | 0177; - break; - case PR_SYSENTRY: - if (what != SYS_exit) - error ("PR_SYSENTRY, unknown system call %d", what); - - pi->prrun.pr_flags = PRCFAULT; - - if (ioctl (pi->fd, PIOCRUN, &pi->prrun) != 0) - perror_with_name (pi->pathname); - - rtnval = wait (&statval); - - break; - case PR_SYSEXIT: - switch (what) - { -#ifdef SYS_exec - case SYS_exec: -#endif -#ifdef SYS_execve - case SYS_execve: -#endif -#ifdef SYS_execv - case SYS_execv: -#endif - statval = (SIGTRAP << 8) | 0177; - break; -#ifdef SYS_sproc - case SYS_sproc: -/* We've just detected the completion of an sproc system call. Now we need to - setup a procinfo struct for this thread, and notify the thread system of the - new arrival. */ - -/* If sproc failed, then nothing interesting happened. Continue the process and - go back to sleep. */ - - if (pi->prstatus.pr_errno != 0) - { - pi->prrun.pr_flags &= PRSTEP; - pi->prrun.pr_flags |= PRCFAULT; - - if (ioctl (pi->fd, PIOCRUN, &pi->prrun) != 0) - perror_with_name (pi->pathname); - - goto wait_again; - } - -/* At this point, the new thread is stopped at it's first instruction, and - the parent is stopped at the exit from sproc. */ - -/* Notify the caller of the arrival of a new thread. */ - create_procinfo (pi->prstatus.pr_rval1); - - rtnval = pi->prstatus.pr_rval1; - statval = (SIGTRAP << 8) | 0177; - - break; - case SYS_fork: -#ifdef SYS_vfork - case SYS_vfork: -#endif -/* At this point, we've detected the completion of a fork (or vfork) call in - our child. The grandchild is also stopped because we set inherit-on-fork - earlier. (Note that nobody has the grandchilds' /proc file open at this - point.) We will release the grandchild from the debugger by opening it's - /proc file and then closing it. Since run-on-last-close is set, the - grandchild continues on its' merry way. */ - - { - struct procinfo *pitemp; - - pitemp = create_procinfo (pi->prstatus.pr_rval1); - if (pitemp) - close_proc_file (pitemp); - - if (ioctl (pi->fd, PIOCRUN, &pi->prrun) != 0) - perror_with_name (pi->pathname); - } - goto wait_again; -#endif /* SYS_sproc */ - - default: - error ("PIOCSTATUS (PR_SYSEXIT): Unknown system call %d", what); - } - break; - case PR_REQUESTED: - statval = (SIGSTOP << 8) | 0177; - break; - case PR_JOBCONTROL: - statval = (what << 8) | 0177; - break; - case PR_FAULTED: - switch (what) - { -#ifdef FLTWATCH - case FLTWATCH: - statval = (SIGTRAP << 8) | 0177; - break; -#endif -#ifdef FLTKWATCH - case FLTKWATCH: - statval = (SIGTRAP << 8) | 0177; - break; -#endif -#ifndef FAULTED_USE_SIGINFO - /* Irix, contrary to the documentation, fills in 0 for si_signo. - Solaris fills in si_signo. I'm not sure about others. */ - case FLTPRIV: - case FLTILL: - statval = (SIGILL << 8) | 0177; - break; - case FLTBPT: - case FLTTRACE: - statval = (SIGTRAP << 8) | 0177; - break; - case FLTSTACK: - case FLTACCESS: - case FLTBOUNDS: - statval = (SIGSEGV << 8) | 0177; - break; - case FLTIOVF: - case FLTIZDIV: - case FLTFPE: - statval = (SIGFPE << 8) | 0177; - break; - case FLTPAGE: /* Recoverable page fault */ -#endif /* not FAULTED_USE_SIGINFO */ - default: - /* Use the signal which the kernel assigns. This is better than - trying to second-guess it from the fault. In fact, I suspect - that FLTACCESS can be either SIGSEGV or SIGBUS. */ - statval = ((pi->prstatus.pr_info.si_signo) << 8) | 0177; - break; - } - break; - default: - error ("PIOCWSTOP, unknown why %d, what %d", why, what); - } -/* Stop all the other threads when any of them stops. */ - - { - struct procinfo *procinfo; - - for (procinfo = procinfo_list; procinfo; procinfo = procinfo->next) - { - if (!procinfo->had_event) - if (ioctl (procinfo->fd, PIOCSTOP, &procinfo->prstatus) < 0) - { - print_sys_errmsg (procinfo->pathname, errno); - error ("PIOCSTOP failed"); - } - } - } - } - else - { - error ("PIOCWSTOP, stopped for unknown/unhandled reason, flags %#x", - pi->prstatus.pr_flags); - } - - store_waitstatus (ourstatus, statval); - - if (rtnval == -1) /* No more children to wait for */ - { - fprintf_unfiltered (gdb_stderr, "Child process unexpectedly missing.\n"); - /* Claim it exited with unknown signal. */ - ourstatus->kind = TARGET_WAITKIND_SIGNALLED; - ourstatus->value.sig = TARGET_SIGNAL_UNKNOWN; - return rtnval; - } - - pi->had_event = 0; /* Indicate that we've seen this one */ - return (rtnval); -} - -/* - -LOCAL FUNCTION - - set_proc_siginfo - set a process's current signal info - -SYNOPSIS - - void set_proc_siginfo (struct procinfo *pip, int signo); - -DESCRIPTION - - Given a pointer to a process info struct in PIP and a signal number - in SIGNO, set the process's current signal and its associated signal - information. The signal will be delivered to the process immediately - after execution is resumed, even if it is being held. In addition, - this particular delivery will not cause another PR_SIGNALLED stop - even if the signal is being traced. - - If we are not delivering the same signal that the prstatus siginfo - struct contains information about, then synthesize a siginfo struct - to match the signal we are doing to deliver, make it of the type - "generated by a user process", and send this synthesized copy. When - used to set the inferior's signal state, this will be required if we - are not currently stopped because of a traced signal, or if we decide - to continue with a different signal. - - Note that when continuing the inferior from a stop due to receipt - of a traced signal, we either have set PRCSIG to clear the existing - signal, or we have to call this function to do a PIOCSSIG with either - the existing siginfo struct from pr_info, or one we have synthesized - appropriately for the signal we want to deliver. Otherwise if the - signal is still being traced, the inferior will immediately stop - again. - - See siginfo(5) for more details. -*/ - -static void -set_proc_siginfo (pip, signo) - struct procinfo *pip; - int signo; -{ - struct siginfo newsiginfo; - struct siginfo *sip; - -#ifdef PROCFS_DONT_PIOCSSIG_CURSIG - /* With Alpha OSF/1 procfs, the kernel gets really confused if it - receives a PIOCSSIG with a signal identical to the current signal, - it messes up the current signal. Work around the kernel bug. */ - if (signo == pip -> prstatus.pr_cursig) - return; -#endif - - if (signo == pip -> prstatus.pr_info.si_signo) - { - sip = &pip -> prstatus.pr_info; - } - else - { - memset ((char *) &newsiginfo, 0, sizeof (newsiginfo)); - sip = &newsiginfo; - sip -> si_signo = signo; - sip -> si_code = 0; - sip -> si_errno = 0; - sip -> si_pid = getpid (); - sip -> si_uid = getuid (); - } - if (ioctl (pip -> fd, PIOCSSIG, sip) < 0) - { - print_sys_errmsg (pip -> pathname, errno); - warning ("PIOCSSIG failed"); - } -} - -/* Resume execution of process PID. If STEP is nozero, then - just single step it. If SIGNAL is nonzero, restart it with that - signal activated. */ - -static void -procfs_resume (pid, step, signo) - int pid; - int step; - enum target_signal signo; -{ - int signal_to_pass; - struct procinfo *pi, *procinfo; - - pi = find_procinfo (pid == -1 ? inferior_pid : pid, 0); - - errno = 0; - pi->prrun.pr_flags = PRSTRACE | PRSFAULT | PRCFAULT; - -#if 0 - /* It should not be necessary. If the user explicitly changes the value, - value_assign calls write_register_bytes, which writes it. */ -/* It may not be absolutely necessary to specify the PC value for - restarting, but to be safe we use the value that gdb considers - to be current. One case where this might be necessary is if the - user explicitly changes the PC value that gdb considers to be - current. FIXME: Investigate if this is necessary or not. */ - -#ifdef PRSVADDR_BROKEN -/* Can't do this under Solaris running on a Sparc, as there seems to be no - place to put nPC. In fact, if you use this, nPC seems to be set to some - random garbage. We have to rely on the fact that PC and nPC have been - written previously via PIOCSREG during a register flush. */ - - pi->prrun.pr_vaddr = (caddr_t) *(int *) ®isters[REGISTER_BYTE (PC_REGNUM)]; - pi->prrun.pr_flags != PRSVADDR; -#endif -#endif - - if (signo == TARGET_SIGNAL_STOP && pi->nopass_next_sigstop) - /* When attaching to a child process, if we forced it to stop with - a PIOCSTOP, then we will have set the nopass_next_sigstop flag. - Upon resuming the first time after such a stop, we explicitly - inhibit sending it another SIGSTOP, which would be the normal - result of default signal handling. One potential drawback to - this is that we will also ignore any attempt to by the user - to explicitly continue after the attach with a SIGSTOP. Ultimately - this problem should be dealt with by making the routines that - deal with the inferior a little smarter, and possibly even allow - an inferior to continue running at the same time as gdb. (FIXME?) */ - signal_to_pass = 0; - else if (signo == TARGET_SIGNAL_TSTP - && pi->prstatus.pr_cursig == SIGTSTP - && pi->prstatus.pr_action.sa_handler == SIG_DFL) - - /* We are about to pass the inferior a SIGTSTP whose action is - SIG_DFL. The SIG_DFL action for a SIGTSTP is to stop - (notifying the parent via wait()), and then keep going from the - same place when the parent is ready for you to keep going. So - under the debugger, it should do nothing (as if the program had - been stopped and then later resumed. Under ptrace, this - happens for us, but under /proc, the system obligingly stops - the process, and wait_for_inferior would have no way of - distinguishing that type of stop (which indicates that we - should just start it again), with a stop due to the pr_trace - field of the prrun_t struct. - - Note that if the SIGTSTP is being caught, we *do* need to pass it, - because the handler needs to get executed. */ - signal_to_pass = 0; - else - signal_to_pass = target_signal_to_host (signo); - - if (signal_to_pass) - { - set_proc_siginfo (pi, signal_to_pass); - } - else - { - pi->prrun.pr_flags |= PRCSIG; - } - pi->nopass_next_sigstop = 0; - if (step) - { - pi->prrun.pr_flags |= PRSTEP; - } - if (ioctl (pi->fd, PIOCRUN, &pi->prrun) != 0) - { - perror_with_name (pi->pathname); - /* NOTREACHED */ - } - - pi->had_event = 0; - - /* Continue all the other threads that haven't had an event of - interest. */ - - if (pid == -1) - for (procinfo = procinfo_list; procinfo; procinfo = procinfo->next) - { - if (pi != procinfo && !procinfo->had_event) - { - procinfo->prrun.pr_flags &= PRSTEP; - procinfo->prrun.pr_flags |= PRCFAULT | PRCSIG; - ioctl (procinfo->fd, PIOCSTATUS, &procinfo->prstatus); - if (ioctl (procinfo->fd, PIOCRUN, &procinfo->prrun) < 0) - { - if (ioctl (procinfo->fd, PIOCSTATUS, &procinfo->prstatus) < 0) - { - fprintf_unfiltered(gdb_stderr, "PIOCSTATUS failed, errno=%d\n", errno); - } - print_sys_errmsg (procinfo->pathname, errno); - error ("PIOCRUN failed"); - } - ioctl (procinfo->fd, PIOCSTATUS, &procinfo->prstatus); - } - } -} - -/* - -LOCAL FUNCTION - - procfs_fetch_registers -- fetch current registers from inferior - -SYNOPSIS - - void procfs_fetch_registers (int regno) - -DESCRIPTION - - Read the current values of the inferior's registers, both the - general register set and floating point registers (if supported) - and update gdb's idea of their current values. - -*/ - -static void -procfs_fetch_registers (regno) - int regno; -{ - struct procinfo *pi; - - pi = current_procinfo; - - if (ioctl (pi->fd, PIOCGREG, &pi->gregset) != -1) - { - supply_gregset (&pi->gregset); - } -#if defined (FP0_REGNUM) - if (ioctl (pi->fd, PIOCGFPREG, &pi->fpregset) != -1) - { - supply_fpregset (&pi->fpregset); - } -#endif -} - -/* - -LOCAL FUNCTION - - proc_init_failed - called whenever /proc access initialization -fails - -SYNOPSIS - - static void proc_init_failed (struct procinfo *pi, char *why) - -DESCRIPTION - - This function is called whenever initialization of access to a /proc - entry fails. It prints a suitable error message, does some cleanup, - and then invokes the standard error processing routine which dumps - us back into the command loop. - */ - -static void -proc_init_failed (pi, why) - struct procinfo *pi; - char *why; -{ - print_sys_errmsg (pi->pathname, errno); - kill (pi->pid, SIGKILL); - close_proc_file (pi); - error (why); - /* NOTREACHED */ -} - -/* - -LOCAL FUNCTION - - close_proc_file - close any currently open /proc entry - -SYNOPSIS - - static void close_proc_file (struct procinfo *pip) - -DESCRIPTION - - Close any currently open /proc entry and mark the process information - entry as invalid. In order to ensure that we don't try to reuse any - stale information, the pid, fd, and pathnames are explicitly - invalidated, which may be overkill. - - */ - -static void -close_proc_file (pip) - struct procinfo *pip; -{ - struct procinfo *procinfo; - - remove_fd (pip); /* Remove fd from poll/select list */ - - close (pip -> fd); - - free (pip -> pathname); - - /* Unlink pip from the procinfo chain. Note pip might not be on the list. */ - - if (procinfo_list == pip) - procinfo_list = pip->next; - else - for (procinfo = procinfo_list; procinfo; procinfo = procinfo->next) - if (procinfo->next == pip) - procinfo->next = pip->next; - - free (pip); -} - -/* - -LOCAL FUNCTION - - open_proc_file - open a /proc entry for a given process id - -SYNOPSIS - - static int open_proc_file (int pid, struct procinfo *pip, int mode) - -DESCRIPTION - - Given a process id and a mode, close the existing open /proc - entry (if any) and open one for the new process id, in the - specified mode. Once it is open, then mark the local process - information structure as valid, which guarantees that the pid, - fd, and pathname fields match an open /proc entry. Returns - zero if the open fails, nonzero otherwise. - - Note that the pathname is left intact, even when the open fails, - so that callers can use it to construct meaningful error messages - rather than just "file open failed". - */ - -static int -open_proc_file (pid, pip, mode) - int pid; - struct procinfo *pip; - int mode; -{ - pip -> next = NULL; - pip -> had_event = 0; - pip -> pathname = xmalloc (32); - pip -> pid = pid; - - sprintf (pip -> pathname, PROC_NAME_FMT, pid); - if ((pip -> fd = open (pip -> pathname, mode)) < 0) - return 0; - - return 1; -} - -static char * -mappingflags (flags) - long flags; -{ - static char asciiflags[8]; - - strcpy (asciiflags, "-------"); -#if defined (MA_PHYS) - if (flags & MA_PHYS) asciiflags[0] = 'd'; -#endif - if (flags & MA_STACK) asciiflags[1] = 's'; - if (flags & MA_BREAK) asciiflags[2] = 'b'; - if (flags & MA_SHARED) asciiflags[3] = 's'; - if (flags & MA_READ) asciiflags[4] = 'r'; - if (flags & MA_WRITE) asciiflags[5] = 'w'; - if (flags & MA_EXEC) asciiflags[6] = 'x'; - return (asciiflags); -} - -static void -info_proc_flags (pip, summary) - struct procinfo *pip; - int summary; -{ - struct trans *transp; - - printf_filtered ("%-32s", "Process status flags:"); - if (!summary) - { - printf_filtered ("\n\n"); - } - for (transp = pr_flag_table; transp -> name != NULL; transp++) - { - if (pip -> prstatus.pr_flags & transp -> value) - { - if (summary) - { - printf_filtered ("%s ", transp -> name); - } - else - { - printf_filtered ("\t%-16s %s.\n", transp -> name, transp -> desc); - } - } - } - printf_filtered ("\n"); -} - -static void -info_proc_stop (pip, summary) - struct procinfo *pip; - int summary; -{ - struct trans *transp; - int why; - int what; - - why = pip -> prstatus.pr_why; - what = pip -> prstatus.pr_what; - - if (pip -> prstatus.pr_flags & PR_STOPPED) - { - printf_filtered ("%-32s", "Reason for stopping:"); - if (!summary) - { - printf_filtered ("\n\n"); - } - for (transp = pr_why_table; transp -> name != NULL; transp++) - { - if (why == transp -> value) - { - if (summary) - { - printf_filtered ("%s ", transp -> name); - } - else - { - printf_filtered ("\t%-16s %s.\n", - transp -> name, transp -> desc); - } - break; - } - } - - /* Use the pr_why field to determine what the pr_what field means, and - print more information. */ - - switch (why) - { - case PR_REQUESTED: - /* pr_what is unused for this case */ - break; - case PR_JOBCONTROL: - case PR_SIGNALLED: - if (summary) - { - printf_filtered ("%s ", signalname (what)); - } - else - { - printf_filtered ("\t%-16s %s.\n", signalname (what), - safe_strsignal (what)); - } - break; - case PR_SYSENTRY: - if (summary) - { - printf_filtered ("%s ", syscallname (what)); - } - else - { - printf_filtered ("\t%-16s %s.\n", syscallname (what), - "Entered this system call"); - } - break; - case PR_SYSEXIT: - if (summary) - { - printf_filtered ("%s ", syscallname (what)); - } - else - { - printf_filtered ("\t%-16s %s.\n", syscallname (what), - "Returned from this system call"); - } - break; - case PR_FAULTED: - if (summary) - { - printf_filtered ("%s ", - lookupname (faults_table, what, "fault")); - } - else - { - printf_filtered ("\t%-16s %s.\n", - lookupname (faults_table, what, "fault"), - lookupdesc (faults_table, what)); - } - break; - } - printf_filtered ("\n"); - } -} - -static void -info_proc_siginfo (pip, summary) - struct procinfo *pip; - int summary; -{ - struct siginfo *sip; - - if ((pip -> prstatus.pr_flags & PR_STOPPED) && - (pip -> prstatus.pr_why == PR_SIGNALLED || - pip -> prstatus.pr_why == PR_FAULTED)) - { - printf_filtered ("%-32s", "Additional signal/fault info:"); - sip = &pip -> prstatus.pr_info; - if (summary) - { - printf_filtered ("%s ", signalname (sip -> si_signo)); - if (sip -> si_errno > 0) - { - printf_filtered ("%s ", errnoname (sip -> si_errno)); - } - if (sip -> si_code <= 0) - { - printf_filtered ("sent by %s, uid %d ", - target_pid_to_str (sip -> si_pid), - sip -> si_uid); - } - else - { - printf_filtered ("%s ", sigcodename (sip)); - if ((sip -> si_signo == SIGILL) || - (sip -> si_signo == SIGFPE) || - (sip -> si_signo == SIGSEGV) || - (sip -> si_signo == SIGBUS)) - { - printf_filtered ("addr=%#lx ", - (unsigned long) sip -> si_addr); - } - else if ((sip -> si_signo == SIGCHLD)) - { - printf_filtered ("child %s, status %u ", - target_pid_to_str (sip -> si_pid), - sip -> si_status); - } - else if ((sip -> si_signo == SIGPOLL)) - { - printf_filtered ("band %u ", sip -> si_band); - } - } - } - else - { - printf_filtered ("\n\n"); - printf_filtered ("\t%-16s %s.\n", signalname (sip -> si_signo), - safe_strsignal (sip -> si_signo)); - if (sip -> si_errno > 0) - { - printf_filtered ("\t%-16s %s.\n", - errnoname (sip -> si_errno), - safe_strerror (sip -> si_errno)); - } - if (sip -> si_code <= 0) - { - printf_filtered ("\t%-16u %s\n", sip -> si_pid, /* XXX need target_pid_to_str() */ - "PID of process sending signal"); - printf_filtered ("\t%-16u %s\n", sip -> si_uid, - "UID of process sending signal"); - } - else - { - printf_filtered ("\t%-16s %s.\n", sigcodename (sip), - sigcodedesc (sip)); - if ((sip -> si_signo == SIGILL) || - (sip -> si_signo == SIGFPE)) - { - printf_filtered ("\t%#-16lx %s.\n", - (unsigned long) sip -> si_addr, - "Address of faulting instruction"); - } - else if ((sip -> si_signo == SIGSEGV) || - (sip -> si_signo == SIGBUS)) - { - printf_filtered ("\t%#-16lx %s.\n", - (unsigned long) sip -> si_addr, - "Address of faulting memory reference"); - } - else if ((sip -> si_signo == SIGCHLD)) - { - printf_filtered ("\t%-16u %s.\n", sip -> si_pid, /* XXX need target_pid_to_str() */ - "Child process ID"); - printf_filtered ("\t%-16u %s.\n", sip -> si_status, - "Child process exit value or signal"); - } - else if ((sip -> si_signo == SIGPOLL)) - { - printf_filtered ("\t%-16u %s.\n", sip -> si_band, - "Band event for POLL_{IN,OUT,MSG}"); - } - } - } - printf_filtered ("\n"); - } -} - -static void -info_proc_syscalls (pip, summary) - struct procinfo *pip; - int summary; -{ - int syscallnum; - - if (!summary) - { - -#if 0 /* FIXME: Needs to use gdb-wide configured info about system calls. */ - if (pip -> prstatus.pr_flags & PR_ASLEEP) - { - int syscallnum = pip -> prstatus.pr_reg[R_D0]; - if (summary) - { - printf_filtered ("%-32s", "Sleeping in system call:"); - printf_filtered ("%s", syscallname (syscallnum)); - } - else - { - printf_filtered ("Sleeping in system call '%s'.\n", - syscallname (syscallnum)); - } - } -#endif - - if (ioctl (pip -> fd, PIOCGENTRY, &pip -> entryset) < 0) - { - print_sys_errmsg (pip -> pathname, errno); - error ("PIOCGENTRY failed"); - } - - if (ioctl (pip -> fd, PIOCGEXIT, &pip -> exitset) < 0) - { - print_sys_errmsg (pip -> pathname, errno); - error ("PIOCGEXIT failed"); - } - - printf_filtered ("System call tracing information:\n\n"); - - printf_filtered ("\t%-12s %-8s %-8s\n", - "System call", - "Entry", - "Exit"); - for (syscallnum = 0; syscallnum < MAX_SYSCALLS; syscallnum++) - { - QUIT; - if (syscall_table[syscallnum] != NULL) - { - printf_filtered ("\t%-12s ", syscall_table[syscallnum]); - printf_filtered ("%-8s ", - prismember (&pip -> entryset, syscallnum) - ? "on" : "off"); - printf_filtered ("%-8s ", - prismember (&pip -> exitset, syscallnum) - ? "on" : "off"); - printf_filtered ("\n"); - } - } - printf_filtered ("\n"); - } -} - -static char * -signalname (signo) - int signo; -{ - const char *name; - static char locbuf[32]; - - name = strsigno (signo); - if (name == NULL) - { - sprintf (locbuf, "Signal %d", signo); - } - else - { - sprintf (locbuf, "%s (%d)", name, signo); - } - return (locbuf); -} - -static char * -errnoname (errnum) - int errnum; -{ - const char *name; - static char locbuf[32]; - - name = strerrno (errnum); - if (name == NULL) - { - sprintf (locbuf, "Errno %d", errnum); - } - else - { - sprintf (locbuf, "%s (%d)", name, errnum); - } - return (locbuf); -} - -static void -info_proc_signals (pip, summary) - struct procinfo *pip; - int summary; -{ - int signo; - - if (!summary) - { - if (ioctl (pip -> fd, PIOCGTRACE, &pip -> trace) < 0) - { - print_sys_errmsg (pip -> pathname, errno); - error ("PIOCGTRACE failed"); - } - - printf_filtered ("Disposition of signals:\n\n"); - printf_filtered ("\t%-15s %-8s %-8s %-8s %s\n\n", - "Signal", "Trace", "Hold", "Pending", "Description"); - for (signo = 0; signo < NSIG; signo++) - { - QUIT; - printf_filtered ("\t%-15s ", signalname (signo)); - printf_filtered ("%-8s ", - prismember (&pip -> trace, signo) - ? "on" : "off"); - printf_filtered ("%-8s ", - prismember (&pip -> prstatus.pr_sighold, signo) - ? "on" : "off"); - -#ifdef PROCFS_SIGPEND_OFFSET - /* Alpha OSF/1 numbers the pending signals from 1. */ - printf_filtered ("%-8s ", - (signo ? prismember (&pip -> prstatus.pr_sigpend, - signo - 1) - : 0) - ? "yes" : "no"); -#else - printf_filtered ("%-8s ", - prismember (&pip -> prstatus.pr_sigpend, signo) - ? "yes" : "no"); -#endif - printf_filtered (" %s\n", safe_strsignal (signo)); - } - printf_filtered ("\n"); - } -} - -static void -info_proc_faults (pip, summary) - struct procinfo *pip; - int summary; -{ - struct trans *transp; - - if (!summary) - { - if (ioctl (pip -> fd, PIOCGFAULT, &pip -> fltset) < 0) - { - print_sys_errmsg (pip -> pathname, errno); - error ("PIOCGFAULT failed"); - } - - printf_filtered ("Current traced hardware fault set:\n\n"); - printf_filtered ("\t%-12s %-8s\n", "Fault", "Trace"); - - for (transp = faults_table; transp -> name != NULL; transp++) - { - QUIT; - printf_filtered ("\t%-12s ", transp -> name); - printf_filtered ("%-8s", prismember (&pip -> fltset, transp -> value) - ? "on" : "off"); - printf_filtered ("\n"); - } - printf_filtered ("\n"); - } -} - -static void -info_proc_mappings (pip, summary) - struct procinfo *pip; - int summary; -{ - int nmap; - struct prmap *prmaps; - struct prmap *prmap; - - if (!summary) - { - printf_filtered ("Mapped address spaces:\n\n"); -#ifdef BFD_HOST_64_BIT - printf_filtered (" %18s %18s %10s %10s %7s\n", -#else - printf_filtered ("\t%10s %10s %10s %10s %7s\n", -#endif - "Start Addr", - " End Addr", - " Size", - " Offset", - "Flags"); - if (ioctl (pip -> fd, PIOCNMAP, &nmap) == 0) - { - prmaps = (struct prmap *) alloca ((nmap + 1) * sizeof (*prmaps)); - if (ioctl (pip -> fd, PIOCMAP, prmaps) == 0) - { - for (prmap = prmaps; prmap -> pr_size; ++prmap) - { -#ifdef BFD_HOST_64_BIT - printf_filtered (" %#18lx %#18lx %#10x %#10x %7s\n", -#else - printf_filtered ("\t%#10lx %#10lx %#10x %#10x %7s\n", -#endif - (unsigned long)prmap -> pr_vaddr, - (unsigned long)prmap -> pr_vaddr - + prmap -> pr_size - 1, - prmap -> pr_size, - prmap -> pr_off, - mappingflags (prmap -> pr_mflags)); - } - } - } - printf_filtered ("\n"); - } -} - -/* - -LOCAL FUNCTION - - info_proc -- implement the "info proc" command - -SYNOPSIS - - void info_proc (char *args, int from_tty) - -DESCRIPTION - - Implement gdb's "info proc" command by using the /proc interface - to print status information about any currently running process. - - Examples of the use of "info proc" are: - - info proc (prints summary info for current inferior) - info proc 123 (prints summary info for process with pid 123) - info proc mappings (prints address mappings) - info proc times (prints process/children times) - info proc id (prints pid, ppid, gid, sid, etc) - FIXME: i proc id not implemented. - info proc status (prints general process state info) - FIXME: i proc status not implemented. - info proc signals (prints info about signal handling) - info proc all (prints all info) - - */ - -static void -info_proc (args, from_tty) - char *args; - int from_tty; -{ - int pid; - struct procinfo *pip; - struct cleanup *old_chain; - char **argv; - int argsize; - int summary = 1; - int flags = 0; - int syscalls = 0; - int signals = 0; - int faults = 0; - int mappings = 0; - int times = 0; - int id = 0; - int status = 0; - int all = 0; - - old_chain = make_cleanup (null_cleanup, 0); - - /* Default to using the current inferior if no pid specified. Note - that inferior_pid may be 0, hence we set okerr. */ - - pip = find_procinfo (inferior_pid, 1); - - if (args != NULL) - { - if ((argv = buildargv (args)) == NULL) - { - nomem (0); - } - make_cleanup (freeargv, (char *) argv); - - while (*argv != NULL) - { - argsize = strlen (*argv); - if (argsize >= 1 && strncmp (*argv, "all", argsize) == 0) - { - summary = 0; - all = 1; - } - else if (argsize >= 2 && strncmp (*argv, "faults", argsize) == 0) - { - summary = 0; - faults = 1; - } - else if (argsize >= 2 && strncmp (*argv, "flags", argsize) == 0) - { - summary = 0; - flags = 1; - } - else if (argsize >= 1 && strncmp (*argv, "id", argsize) == 0) - { - summary = 0; - id = 1; - } - else if (argsize >= 1 && strncmp (*argv, "mappings", argsize) == 0) - { - summary = 0; - mappings = 1; - } - else if (argsize >= 2 && strncmp (*argv, "signals", argsize) == 0) - { - summary = 0; - signals = 1; - } - else if (argsize >= 2 && strncmp (*argv, "status", argsize) == 0) - { - summary = 0; - status = 1; - } - else if (argsize >= 2 && strncmp (*argv, "syscalls", argsize) == 0) - { - summary = 0; - syscalls = 1; - } - else if (argsize >= 1 && strncmp (*argv, "times", argsize) == 0) - { - summary = 0; - times = 1; - } - else if ((pid = atoi (*argv)) > 0) - { - pip = (struct procinfo *) xmalloc (sizeof (struct procinfo)); - memset (pip, 0, sizeof (*pip)); - - pip->pid = pid; - if (!open_proc_file (pid, pip, O_RDONLY)) - { - perror_with_name (pip -> pathname); - /* NOTREACHED */ - } - make_cleanup (close_proc_file, pip); - } - else if (**argv != '\000') - { - error ("Unrecognized or ambiguous keyword `%s'.", *argv); - } - argv++; - } - } - - /* If we don't have a valid open process at this point, then we have no - inferior or didn't specify a specific pid. */ - - if (!pip) - { - error ("\ -No process. Start debugging a program or specify an explicit process ID."); - } - if (ioctl (pip -> fd, PIOCSTATUS, &(pip -> prstatus)) < 0) - { - print_sys_errmsg (pip -> pathname, errno); - error ("PIOCSTATUS failed"); - } - - /* Print verbose information of the requested type(s), or just a summary - of the information for all types. */ - - printf_filtered ("\nInformation for %s:\n\n", pip -> pathname); - if (summary || all || flags) - { - info_proc_flags (pip, summary); - } - if (summary || all) - { - info_proc_stop (pip, summary); - } - if (summary || all || signals || faults) - { - info_proc_siginfo (pip, summary); - } - if (summary || all || syscalls) - { - info_proc_syscalls (pip, summary); - } - if (summary || all || mappings) - { - info_proc_mappings (pip, summary); - } - if (summary || all || signals) - { - info_proc_signals (pip, summary); - } - if (summary || all || faults) - { - info_proc_faults (pip, summary); - } - printf_filtered ("\n"); - - /* All done, deal with closing any temporary process info structure, - freeing temporary memory , etc. */ - - do_cleanups (old_chain); -} - -/* - -LOCAL FUNCTION - - procfs_set_sproc_trap -- arrange for child to stop on sproc(). - -SYNOPSIS - - void procfs_set_sproc_trap (struct procinfo *) - -DESCRIPTION - - This function sets up a trap on sproc system call exits so that we can - detect the arrival of a new thread. We are called with the new thread - stopped prior to it's first instruction. - - Also note that we turn on the inherit-on-fork flag in the child process - so that any grand-children start with all tracing flags set. - */ - -#ifdef SYS_sproc - -static void -procfs_set_sproc_trap (pi) - struct procinfo *pi; -{ - sysset_t exitset; - - if (ioctl (pi->fd, PIOCGEXIT, &exitset) < 0) - { - print_sys_errmsg (pi->pathname, errno); - error ("PIOCGEXIT failed"); - } - - praddset (&exitset, SYS_sproc); - - /* We trap on fork() and vfork() in order to disable debugging in our grand- - children and descendant processes. At this time, GDB can only handle - threads (multiple processes, one address space). forks (and execs) result - in the creation of multiple address spaces, which GDB can't handle yet. */ - - praddset (&exitset, SYS_fork); -#ifdef SYS_vfork - praddset (&exitset, SYS_vfork); -#endif - - if (ioctl (pi->fd, PIOCSEXIT, &exitset) < 0) - { - print_sys_errmsg (pi->pathname, errno); - error ("PIOCSEXIT failed"); - } - - /* Turn on inherit-on-fork flag so that all grand-children of gdb start with - tracing flags set. */ - -#ifdef PIOCSET /* New method */ - { - long pr_flags; - pr_flags = PR_FORK; - ioctl (pi->fd, PIOCSET, &pr_flags); - } -#else -#ifdef PIOCSFORK /* Original method */ - ioctl (pi->fd, PIOCSFORK, NULL); -#endif -#endif -} -#endif /* SYS_sproc */ - -/* Fork an inferior process, and start debugging it with /proc. */ - -static void -procfs_create_inferior (exec_file, allargs, env) - char *exec_file; - char *allargs; - char **env; -{ - char *shell_file = getenv ("SHELL"); - char *tryname; - if (shell_file != NULL && strchr (shell_file, '/') == NULL) - { - - /* We will be looking down the PATH to find shell_file. If we - just do this the normal way (via execlp, which operates by - attempting an exec for each element of the PATH until it - finds one which succeeds), then there will be an exec for - each failed attempt, each of which will cause a PR_SYSEXIT - stop, and we won't know how to distinguish the PR_SYSEXIT's - for these failed execs with the ones for successful execs - (whether the exec has succeeded is stored at that time in the - carry bit or some such architecture-specific and - non-ABI-specified place). - - So I can't think of anything better than to search the PATH - now. This has several disadvantages: (1) There is a race - condition; if we find a file now and it is deleted before we - exec it, we lose, even if the deletion leaves a valid file - further down in the PATH, (2) there is no way to know exactly - what an executable (in the sense of "capable of being - exec'd") file is. Using access() loses because it may lose - if the caller is the superuser; failing to use it loses if - there are ACLs or some such. */ - - char *p; - char *p1; - /* FIXME-maybe: might want "set path" command so user can change what - path is used from within GDB. */ - char *path = getenv ("PATH"); - int len; - struct stat statbuf; - - if (path == NULL) - path = "/bin:/usr/bin"; - - tryname = alloca (strlen (path) + strlen (shell_file) + 2); - for (p = path; p != NULL; p = p1 ? p1 + 1: NULL) - { - p1 = strchr (p, ':'); - if (p1 != NULL) - len = p1 - p; - else - len = strlen (p); - strncpy (tryname, p, len); - tryname[len] = '\0'; - strcat (tryname, "/"); - strcat (tryname, shell_file); - if (access (tryname, X_OK) < 0) - continue; - if (stat (tryname, &statbuf) < 0) - continue; - if (!S_ISREG (statbuf.st_mode)) - /* We certainly need to reject directories. I'm not quite - as sure about FIFOs, sockets, etc., but I kind of doubt - that people want to exec() these things. */ - continue; - break; - } - if (p == NULL) - /* Not found. This must be an error rather than merely passing - the file to execlp(), because execlp() would try all the - exec()s, causing GDB to get confused. */ - error ("Can't find shell %s in PATH", shell_file); - - shell_file = tryname; - } - - fork_inferior (exec_file, allargs, env, - proc_set_exec_trap, procfs_init_inferior, shell_file); - - /* We are at the first instruction we care about. */ - /* Pedal to the metal... */ - - /* Setup traps on exit from sproc() */ - -#ifdef SYS_sproc - procfs_set_sproc_trap (current_procinfo); -#endif - - proceed ((CORE_ADDR) -1, TARGET_SIGNAL_0, 0); -} - -/* Clean up after the inferior dies. */ - -static void -procfs_mourn_inferior () -{ - struct procinfo *pi; - struct procinfo *next_pi; - - for (pi = procinfo_list; pi; pi = next_pi) - { - next_pi = pi->next; - unconditionally_kill_inferior (pi); - } - - unpush_target (&procfs_ops); - generic_mourn_inferior (); -} - - -/* Mark our target-struct as eligible for stray "run" and "attach" commands. */ -static int -procfs_can_run () -{ - return(1); -} -#ifdef TARGET_HAS_HARDWARE_WATCHPOINTS - -/* Insert a watchpoint */ -int -procfs_set_watchpoint(pid, addr, len, rw) - int pid; - CORE_ADDR addr; - int len; - int rw; -{ - struct procinfo *pi; - prwatch_t wpt; - - pi = find_procinfo (pid == -1 ? inferior_pid : pid, 0); - wpt.pr_vaddr = (caddr_t)addr; - wpt.pr_size = len; - wpt.pr_wflags = ((rw & 1) ? MA_READ : 0) | ((rw & 2) ? MA_WRITE : 0); - if (ioctl (pi->fd, PIOCSWATCH, &wpt) < 0) - { - if (errno == E2BIG) - return -1; - /* Currently it sometimes happens that the same watchpoint gets - deleted twice - don't die in this case (FIXME please) */ - if (errno == ESRCH && len == 0) - return 0; - print_sys_errmsg (pi->pathname, errno); - error ("PIOCSWATCH failed"); - } - return 0; -} - -int -procfs_stopped_by_watchpoint(pid) - int pid; -{ - struct procinfo *pi; - short what; - short why; - - pi = find_procinfo (pid == -1 ? inferior_pid : pid, 0); - if (pi->prstatus.pr_flags & (PR_STOPPED | PR_ISTOP)) - { - why = pi->prstatus.pr_why; - what = pi->prstatus.pr_what; - if (why == PR_FAULTED -#if defined (FLTWATCH) && defined (FLTKWATCH) - && (what == FLTWATCH || what == FLTKWATCH) -#else -#ifdef FLTWATCH - && (what == FLTWATCH) -#endif -#ifdef FLTKWATCH - && (what == FLTKWATCH) -#endif -#endif - ) - return what; - } - return 0; -} -#endif - -/* Send a SIGINT to the process group. This acts just like the user typed a - ^C on the controlling terminal. - - XXX - This may not be correct for all systems. Some may want to use - killpg() instead of kill (-pgrp). */ - -void -procfs_stop () -{ - extern pid_t inferior_process_group; - - kill (-inferior_process_group, SIGINT); -} - - -struct target_ops procfs_ops = { - "procfs", /* to_shortname */ - "Unix /proc child process", /* to_longname */ - "Unix /proc child process (started by the \"run\" command).", /* to_doc */ - procfs_open, /* to_open */ - 0, /* to_close */ - procfs_attach, /* to_attach */ - procfs_detach, /* to_detach */ - procfs_resume, /* to_resume */ - procfs_wait, /* to_wait */ - procfs_fetch_registers, /* to_fetch_registers */ - procfs_store_registers, /* to_store_registers */ - procfs_prepare_to_store, /* to_prepare_to_store */ - procfs_xfer_memory, /* to_xfer_memory */ - procfs_files_info, /* to_files_info */ - memory_insert_breakpoint, /* to_insert_breakpoint */ - memory_remove_breakpoint, /* to_remove_breakpoint */ - terminal_init_inferior, /* to_terminal_init */ - terminal_inferior, /* to_terminal_inferior */ - terminal_ours_for_output, /* to_terminal_ours_for_output */ - terminal_ours, /* to_terminal_ours */ - child_terminal_info, /* to_terminal_info */ - procfs_kill_inferior, /* to_kill */ - 0, /* to_load */ - 0, /* to_lookup_symbol */ - procfs_create_inferior, /* to_create_inferior */ - procfs_mourn_inferior, /* to_mourn_inferior */ - procfs_can_run, /* to_can_run */ - procfs_notice_signals, /* to_notice_signals */ - 0, /* to_thread_alive */ - procfs_stop, /* to_stop */ - process_stratum, /* to_stratum */ - 0, /* to_next */ - 1, /* to_has_all_memory */ - 1, /* to_has_memory */ - 1, /* to_has_stack */ - 1, /* to_has_registers */ - 1, /* to_has_execution */ - 0, /* sections */ - 0, /* sections_end */ - OPS_MAGIC /* to_magic */ -}; - -void -_initialize_procfs () -{ -#ifdef HAVE_OPTIONAL_PROC_FS - char procname[32]; - int fd; - - /* If we have an optional /proc filesystem (e.g. under OSF/1), - don't add procfs support if we cannot access the running - GDB via /proc. */ - sprintf (procname, PROC_NAME_FMT, getpid ()); - if ((fd = open (procname, O_RDONLY)) < 0) - return; - close (fd); -#endif - - add_target (&procfs_ops); - - add_info ("proc", info_proc, -"Show process status information using /proc entry.\n\ -Specify process id or use current inferior by default.\n\ -Specify keywords for detailed information; default is summary.\n\ -Keywords are: `all', `faults', `flags', `id', `mappings', `signals',\n\ -`status', `syscalls', and `times'.\n\ -Unambiguous abbreviations may be used."); - - init_syscall_table (); -} diff --git a/contrib/gdb/gdb/ptx4-nat.c b/contrib/gdb/gdb/ptx4-nat.c deleted file mode 100644 index 564b799..0000000 --- a/contrib/gdb/gdb/ptx4-nat.c +++ /dev/null @@ -1,209 +0,0 @@ -/* Native-dependent code for ptx 4.0 - Copyright 1988, 1989, 1991, 1992 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "defs.h" -#include "inferior.h" -#include "gdbcore.h" -#include -#include -#include -#include - -/* Given a pointer to a general register set in /proc format (gregset_t *), - unpack the register contents and supply them as gdb's idea of the current - register values. */ - -void -supply_gregset (gregsetp) - gregset_t *gregsetp; -{ - supply_register(EAX_REGNUM, (char *)&(*gregsetp)[EAX]); - supply_register(EDX_REGNUM, (char *)&(*gregsetp)[EDX]); - supply_register(ECX_REGNUM, (char *)&(*gregsetp)[ECX]); - supply_register(EBX_REGNUM, (char *)&(*gregsetp)[EBX]); - supply_register(ESI_REGNUM, (char *)&(*gregsetp)[ESI]); - supply_register(EDI_REGNUM, (char *)&(*gregsetp)[EDI]); - supply_register(ESP_REGNUM, (char *)&(*gregsetp)[UESP]); - supply_register(EBP_REGNUM, (char *)&(*gregsetp)[EBP]); - supply_register(EIP_REGNUM, (char *)&(*gregsetp)[EIP]); - supply_register(EFLAGS_REGNUM, (char *)&(*gregsetp)[EFL]); -} - -void -fill_gregset (gregsetp, regno) - gregset_t *gregsetp; - int regno; -{ - int regi; - extern char registers[]; - - for (regi = 0 ; regi < NUM_REGS ; regi++) - { - if ((regno == -1) || (regno == regi)) - { - (*gregsetp)[regi] = *(greg_t *)®isters[REGISTER_BYTE (regi)]; - } - } -} - -#if defined (FP0_REGNUM) - -/* Given a pointer to a floating point register set in /proc format - (fpregset_t *), unpack the register contents and supply them as gdb's - idea of the current floating point register values. */ - -void -supply_fpregset (fpregsetp) - fpregset_t *fpregsetp; -{ - supply_fpu_registers((struct fpusave *)&fpregsetp->fp_reg_set); - supply_fpa_registers((struct fpasave *)&fpregsetp->f_wregs); -} - -/* Given a pointer to a floating point register set in /proc format - (fpregset_t *), update the register specified by REGNO from gdb's idea - of the current floating point register set. If REGNO is -1, update - them all. */ - -void -fill_fpregset (fpregsetp, regno) - fpregset_t *fpregsetp; - int regno; -{ - int regi; - char *to; - char *from; - extern char registers[]; - - /* FIXME: see m68k-tdep.c for an example, for the m68k. */ -} - -#endif /* defined (FP0_REGNUM) */ - -/* - * This doesn't quite do the same thing as the procfs.c version, but give - * it the same name so we don't have to put an ifdef in solib.c. - */ -/* this could use elf_interpreter() from elfread.c */ -int -proc_iterate_over_mappings(func) - int (*func) PARAMS ((int, CORE_ADDR)); -{ - vaddr_t curseg, memptr; - pt_vseg_t pv; - int rv, cmperr; - sec_ptr interp_sec; - char *interp_content; - int interp_fd, funcstat; - unsigned int size; - char buf1[NBPG], buf2[NBPG]; - - /* - * The following is really vile. We can get the name of the - * shared library from the exec_bfd, and we can get a list of - * each virtual memory segment, but there is no simple way to - * find the mapped segment from the shared library (ala - * procfs's PIOCOPENMEM). As a pretty nasty kludge, we - * compare the virtual memory segment to the contents of the - * .interp file. If they match, we assume that we've got the - * right one. - */ - - /* - * TODO: for attach, use XPT_OPENT to get the executable, in - * case we're attached without knowning the executable's - * filename. - */ - -#ifdef VERBOSE_DEBUG - printf("proc_iter\n"); -#endif - interp_sec = bfd_get_section_by_name(exec_bfd, ".interp"); - if (!interp_sec) { - return 0; - } - - size = bfd_section_size(exec_bfd, interp_sec); - interp_content = alloca(size); - if (0 == bfd_get_section_contents(exec_bfd, interp_sec, - interp_content, (file_ptr)0, size)) { - return 0; - } - -#ifdef VERBOSE_DEBUG - printf("proc_iter: \"%s\"\n", interp_content); -#endif - interp_fd = open(interp_content, O_RDONLY, 0); - if (-1 == interp_fd) { - return 0; - } - - curseg = 0; - while (1) { - rv = ptrace(PT_NEXT_VSEG, inferior_pid, &pv, curseg); -#ifdef VERBOSE_DEBUG - printf("PT_NEXT_VSEG: rv %d errno %d\n", rv, errno); -#endif - if (-1 == rv) - break; - if (0 == rv) - break; -#ifdef VERBOSE_DEBUG - printf("pv.pv_start 0x%x pv_size 0x%x pv_prot 0x%x\n", - pv.pv_start, pv.pv_size, pv.pv_prot); -#endif - curseg = pv.pv_start + pv.pv_size; - - rv = lseek(interp_fd, 0, SEEK_SET); - if (-1 == rv) { - perror("lseek"); - close(interp_fd); - return 0; - } - for (memptr = pv.pv_start; memptr < pv.pv_start + pv.pv_size; - memptr += NBPG) { -#ifdef VERBOSE_DEBUG - printf("memptr 0x%x\n", memptr); -#endif - rv = read(interp_fd, buf1, NBPG); - if (-1 == rv) { - perror("read"); - close(interp_fd); - return 0; - } - rv = ptrace(PT_RDATA_PAGE, inferior_pid, buf2, - memptr); - if (-1 == rv) { - perror("ptrace"); - close(interp_fd); - return 0; - } - cmperr = memcmp(buf1, buf2, NBPG); - if (cmperr) - break; - } - if (0 == cmperr) { - /* this is it */ - funcstat = (*func)(interp_fd, pv.pv_start); - break; - } - } - close(interp_fd); - return 0; -} diff --git a/contrib/gdb/gdb/pyr-tdep.c b/contrib/gdb/gdb/pyr-tdep.c deleted file mode 100644 index b9abc0f..0000000 --- a/contrib/gdb/gdb/pyr-tdep.c +++ /dev/null @@ -1,452 +0,0 @@ -/* Pyramid target-dependent code for GDB. - Copyright (C) 1988, 1989, 1991 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" - -/*** Prettier register printing. ***/ - -/* Print registers in the same format as pyramid's dbx, adb, sdb. */ -pyr_print_registers(reg_buf, regnum) - long *reg_buf[]; -{ - register int regno; - int usp, ksp; - struct user u; - - for (regno = 0; regno < 16; regno++) { - printf_unfiltered/*_filtered*/ ("%6.6s: %8x %6.6s: %8x %6s: %8x %6s: %8x\n", - reg_names[regno], reg_buf[regno], - reg_names[regno+16], reg_buf[regno+16], - reg_names[regno+32], reg_buf[regno+32], - reg_names[regno+48], reg_buf[regno+48]); - } - usp = ptrace (3, inferior_pid, - (PTRACE_ARG3_TYPE) ((char *)&u.u_pcb.pcb_usp) - - ((char *)&u), 0); - ksp = ptrace (3, inferior_pid, - (PTRACE_ARG3_TYPE) ((char *)&u.u_pcb.pcb_ksp) - - ((char *)&u), 0); - printf_unfiltered/*_filtered*/ ("\n%6.6s: %8x %6.6s: %8x (%08x) %6.6s %8x\n", - reg_names[CSP_REGNUM],reg_buf[CSP_REGNUM], - reg_names[KSP_REGNUM], reg_buf[KSP_REGNUM], ksp, - "usp", usp); -} - -/* Print the register regnum, or all registers if regnum is -1. - fpregs is currently ignored. */ - -pyr_do_registers_info (regnum, fpregs) - int regnum; - int fpregs; -{ - /* On a pyr, we know a virtual register can always fit in an long. - Here (and elsewhere) we take advantage of that. Yuk. */ - long raw_regs[MAX_REGISTER_RAW_SIZE*NUM_REGS]; - register int i; - - for (i = 0 ; i < 64 ; i++) { - read_relative_register_raw_bytes(i, raw_regs+i); - } - if (regnum == -1) - pyr_print_registers (raw_regs, regnum); - else - for (i = 0; i < NUM_REGS; i++) - if (i == regnum) { - long val = raw_regs[i]; - - fputs_filtered (reg_names[i], stdout); - printf_filtered(":"); - print_spaces_filtered (6 - strlen (reg_names[i]), stdout); - if (val == 0) - printf_filtered ("0"); - else - printf_filtered ("%s %d", local_hex_string_custom(val,"08"), val); - printf_filtered("\n"); - } -} - -/*** Debugging editions of various macros from m-pyr.h ****/ - -CORE_ADDR frame_locals_address (frame) - struct frame_info *frame; -{ - register int addr = find_saved_register (frame,CFP_REGNUM); - register int result = read_memory_integer (addr, 4); -#ifdef PYRAMID_CONTROL_FRAME_DEBUGGING - fprintf_unfiltered (stderr, - "\t[[..frame_locals:%8x, %s= %x @%x fcfp= %x foo= %x\n\t gr13=%x pr13=%x tr13=%x @%x]]\n", - frame->frame, - reg_names[CFP_REGNUM], - result, addr, - frame->frame_cfp, (CFP_REGNUM), - - - read_register(13), read_register(29), read_register(61), - find_saved_register(frame, 61)); -#endif /* PYRAMID_CONTROL_FRAME_DEBUGGING */ - - /* FIXME: I thought read_register (CFP_REGNUM) should be the right answer; - or at least CFP_REGNUM relative to FRAME (ie, result). - There seems to be a bug in the way the innermost frame is set up. */ - - return ((frame->next) ? result: frame->frame_cfp); -} - -CORE_ADDR frame_args_addr (frame) - struct frame_info *frame; -{ - register int addr = find_saved_register (frame,CFP_REGNUM); - register int result = read_memory_integer (addr, 4); - -#ifdef PYRAMID_CONTROL_FRAME_DEBUGGING - fprintf_unfiltered (stderr, - "\t[[..frame_args:%8x, %s= %x @%x fcfp= %x r_r= %x\n\t gr13=%x pr13=%x tr13=%x @%x]]\n", - frame->frame, - reg_names[CFP_REGNUM], - result, addr, - frame->frame_cfp, read_register(CFP_REGNUM), - - read_register(13), read_register(29), read_register(61), - find_saved_register(frame, 61)); -#endif /* PYRAMID_CONTROL_FRAME_DEBUGGING */ - - /* FIXME: I thought read_register (CFP_REGNUM) should be the right answer; - or at least CFP_REGNUM relative to FRAME (ie, result). - There seems to be a bug in the way the innermost frame is set up. */ - return ((frame->next) ? result: frame->frame_cfp); -} - -#include "symtab.h" -#include "opcode/pyr.h" -#include "gdbcore.h" - - -/* A couple of functions used for debugging frame-handling on - Pyramids. (The Pyramid-dependent handling of register values for - windowed registers is known to be buggy.) - - When debugging, these functions can supplant the normal definitions of some - of the macros in tm-pyramid.h The quantity of information produced - when these functions are used makes the gdb unusable as a - debugger for user programs. */ - -extern unsigned pyr_saved_pc(), pyr_frame_chain(); - -CORE_ADDR pyr_frame_chain(frame) - CORE_ADDR frame; -{ - int foo=frame - CONTROL_STACK_FRAME_SIZE; - /* printf_unfiltered ("...following chain from %x: got %x\n", frame, foo);*/ - return foo; -} - -CORE_ADDR pyr_saved_pc(frame) - CORE_ADDR frame; -{ - int foo=0; - foo = read_memory_integer (((CORE_ADDR)(frame))+60, 4); - printf_unfiltered ("..reading pc from frame 0x%0x+%d regs: got %0x\n", - frame, 60/4, foo); - return foo; -} - -/* Pyramid instructions are never longer than this many bytes. */ -#define MAXLEN 24 - -/* Number of elements in the opcode table. */ -/*const*/ static int nopcodes = (sizeof (pyr_opcodes) / sizeof( pyr_opcodes[0])); -#define NOPCODES (nopcodes) - -/* Let's be byte-independent so we can use this as a cross-assembler. */ - -#define NEXTLONG(p) \ - (p += 4, (((((p[-4] << 8) + p[-3]) << 8) + p[-2]) << 8) + p[-1]) - -/* Print one instruction at address MEMADDR in debugged memory, - on STREAM. Returns length of the instruction, in bytes. */ - -int -pyr_print_insn (memaddr, stream) - CORE_ADDR memaddr; - FILE *stream; -{ - unsigned char buffer[MAXLEN]; - register int i, nargs, insn_size =4; - register unsigned char *p; - register char *d; - register int insn_opcode, operand_mode; - register int index_multiplier, index_reg_regno, op_1_regno, op_2_regno ; - long insn; /* first word of the insn, not broken down. */ - pyr_insn_format insn_decode; /* the same, broken out into op{code,erands} */ - long extra_1, extra_2; - - read_memory (memaddr, buffer, MAXLEN); - insn_decode = *((pyr_insn_format *) buffer); - insn = * ((int *) buffer); - insn_opcode = insn_decode.operator; - operand_mode = insn_decode.mode; - index_multiplier = insn_decode.index_scale; - index_reg_regno = insn_decode.index_reg; - op_1_regno = insn_decode.operand_1; - op_2_regno = insn_decode.operand_2; - - - if (*((int *)buffer) == 0x0) { - /* "halt" looks just like an invalid "jump" to the insn decoder, - so is dealt with as a special case */ - fprintf_unfiltered (stream, "halt"); - return (4); - } - - for (i = 0; i < NOPCODES; i++) - if (pyr_opcodes[i].datum.code == insn_opcode) - break; - - if (i == NOPCODES) - /* FIXME: Handle unrecognised instructions better. */ - fprintf_unfiltered (stream, "???\t#%08x\t(op=%x mode =%x)", - insn, insn_decode.operator, insn_decode.mode); - else - { - /* Print the mnemonic for the instruction. Pyramid insn operands - are so regular that we can deal with almost all of them - separately. - Unconditional branches are an exception: they are encoded as - conditional branches (branch if false condition, I think) - with no condition specified. The average user will not be - aware of this. To maintain their illusion that an - unconditional branch insn exists, we will have to FIXME to - treat the insn mnemnonic of all branch instructions here as a - special case: check the operands of branch insn and print an - appropriate mnemonic. */ - - fprintf_unfiltered (stream, "%s\t", pyr_opcodes[i].name); - - /* Print the operands of the insn (as specified in - insn.operand_mode). - Branch operands of branches are a special case: they are a word - offset, not a byte offset. */ - - if (insn_decode.operator == 0x01 || insn_decode.operator == 0x02) { - register int bit_codes=(insn >> 16)&0xf; - register int i; - register int displacement = (insn & 0x0000ffff) << 2; - - static char cc_bit_names[] = "cvzn"; /* z,n,c,v: strange order? */ - - /* Is bfc and no bits specified an unconditional branch?*/ - for (i=0;i<4;i++) { - if ((bit_codes) & 0x1) - fputc_unfiltered (cc_bit_names[i], stream); - bit_codes >>= 1; - } - - fprintf_unfiltered (stream, ",%0x", - displacement + memaddr); - return (insn_size); - } - - switch (operand_mode) { - case 0: - fprintf_unfiltered (stream, "%s,%s", - reg_names [op_1_regno], - reg_names [op_2_regno]); - break; - - case 1: - fprintf_unfiltered (stream, " 0x%0x,%s", - op_1_regno, - reg_names [op_2_regno]); - break; - - case 2: - read_memory (memaddr+4, buffer, MAXLEN); - insn_size += 4; - extra_1 = * ((int *) buffer); - fprintf_unfiltered (stream, " $0x%0x,%s", - extra_1, - reg_names [op_2_regno]); - break; - case 3: - fprintf_unfiltered (stream, " (%s),%s", - reg_names [op_1_regno], - reg_names [op_2_regno]); - break; - - case 4: - read_memory (memaddr+4, buffer, MAXLEN); - insn_size += 4; - extra_1 = * ((int *) buffer); - fprintf_unfiltered (stream, " 0x%0x(%s),%s", - extra_1, - reg_names [op_1_regno], - reg_names [op_2_regno]); - break; - - /* S1 destination mode */ - case 5: - fprintf_unfiltered (stream, - ((index_reg_regno) ? "%s,(%s)[%s*%1d]" : "%s,(%s)"), - reg_names [op_1_regno], - reg_names [op_2_regno], - reg_names [index_reg_regno], - index_multiplier); - break; - - case 6: - fprintf_unfiltered (stream, - ((index_reg_regno) ? " $%#0x,(%s)[%s*%1d]" - : " $%#0x,(%s)"), - op_1_regno, - reg_names [op_2_regno], - reg_names [index_reg_regno], - index_multiplier); - break; - - case 7: - read_memory (memaddr+4, buffer, MAXLEN); - insn_size += 4; - extra_1 = * ((int *) buffer); - fprintf_unfiltered (stream, - ((index_reg_regno) ? " $%#0x,(%s)[%s*%1d]" - : " $%#0x,(%s)"), - extra_1, - reg_names [op_2_regno], - reg_names [index_reg_regno], - index_multiplier); - break; - - case 8: - fprintf_unfiltered (stream, - ((index_reg_regno) ? " (%s),(%s)[%s*%1d]" : " (%s),(%s)"), - reg_names [op_1_regno], - reg_names [op_2_regno], - reg_names [index_reg_regno], - index_multiplier); - break; - - case 9: - read_memory (memaddr+4, buffer, MAXLEN); - insn_size += 4; - extra_1 = * ((int *) buffer); - fprintf_unfiltered (stream, - ((index_reg_regno) - ? "%#0x(%s),(%s)[%s*%1d]" - : "%#0x(%s),(%s)"), - extra_1, - reg_names [op_1_regno], - reg_names [op_2_regno], - reg_names [index_reg_regno], - index_multiplier); - break; - - /* S2 destination mode */ - case 10: - read_memory (memaddr+4, buffer, MAXLEN); - insn_size += 4; - extra_1 = * ((int *) buffer); - fprintf_unfiltered (stream, - ((index_reg_regno) ? "%s,%#0x(%s)[%s*%1d]" : "%s,%#0x(%s)"), - reg_names [op_1_regno], - extra_1, - reg_names [op_2_regno], - reg_names [index_reg_regno], - index_multiplier); - break; - case 11: - read_memory (memaddr+4, buffer, MAXLEN); - insn_size += 4; - extra_1 = * ((int *) buffer); - fprintf_unfiltered (stream, - ((index_reg_regno) ? - " $%#0x,%#0x(%s)[%s*%1d]" : " $%#0x,%#0x(%s)"), - op_1_regno, - extra_1, - reg_names [op_2_regno], - reg_names [index_reg_regno], - index_multiplier); - break; - case 12: - read_memory (memaddr+4, buffer, MAXLEN); - insn_size += 4; - extra_1 = * ((int *) buffer); - read_memory (memaddr+8, buffer, MAXLEN); - insn_size += 4; - extra_2 = * ((int *) buffer); - fprintf_unfiltered (stream, - ((index_reg_regno) ? - " $%#0x,%#0x(%s)[%s*%1d]" : " $%#0x,%#0x(%s)"), - extra_1, - extra_2, - reg_names [op_2_regno], - reg_names [index_reg_regno], - index_multiplier); - break; - - case 13: - read_memory (memaddr+4, buffer, MAXLEN); - insn_size += 4; - extra_1 = * ((int *) buffer); - fprintf_unfiltered (stream, - ((index_reg_regno) - ? " (%s),%#0x(%s)[%s*%1d]" - : " (%s),%#0x(%s)"), - reg_names [op_1_regno], - extra_1, - reg_names [op_2_regno], - reg_names [index_reg_regno], - index_multiplier); - break; - case 14: - read_memory (memaddr+4, buffer, MAXLEN); - insn_size += 4; - extra_1 = * ((int *) buffer); - read_memory (memaddr+8, buffer, MAXLEN); - insn_size += 4; - extra_2 = * ((int *) buffer); - fprintf_unfiltered (stream, - ((index_reg_regno) ? "%#0x(%s),%#0x(%s)[%s*%1d]" - : "%#0x(%s),%#0x(%s) "), - extra_1, - reg_names [op_1_regno], - extra_2, - reg_names [op_2_regno], - reg_names [index_reg_regno], - index_multiplier); - break; - - default: - fprintf_unfiltered (stream, - ((index_reg_regno) ? "%s,%s [%s*%1d]" : "%s,%s"), - reg_names [op_1_regno], - reg_names [op_2_regno], - reg_names [index_reg_regno], - index_multiplier); - fprintf_unfiltered (stream, - "\t\t# unknown mode in %08x", - insn); - break; - } /* switch */ - } - - { - return insn_size; - } - abort (); -} diff --git a/contrib/gdb/gdb/pyr-xdep.c b/contrib/gdb/gdb/pyr-xdep.c deleted file mode 100644 index e205b50..0000000 --- a/contrib/gdb/gdb/pyr-xdep.c +++ /dev/null @@ -1,370 +0,0 @@ -/* Low level Pyramid interface to ptrace, for GDB when running under Unix. - Copyright (C) 1988, 1989, 1991 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 "frame.h" -#include "inferior.h" - -#include -#include -#include -#include -/* #include Can we live without this? */ - -#include "gdbcore.h" -#include /* After a.out.h */ -#include -#include "gdb_stat.h" - - -void -fetch_inferior_registers (regno) - int regno; -{ - register int datum; - register unsigned int regaddr; - int reg_buf[NUM_REGS+1]; - struct user u; - register int skipped_frames = 0; - - registers_fetched (); - - for (regno = 0; regno < 64; regno++) { - reg_buf[regno] = ptrace (3, inferior_pid, (PTRACE_ARG3_TYPE) regno, 0); - -#if defined(PYRAMID_CONTROL_FRAME_DEBUGGING) - printf_unfiltered ("Fetching register %s, got %0x\n", - reg_names[regno], - reg_buf[regno]); -#endif /* PYRAMID_CONTROL_FRAME_DEBUGGING */ - - if (reg_buf[regno] == -1 && errno == EIO) { - printf_unfiltered("fetch_interior_registers: fetching register %s\n", - reg_names[regno]); - errno = 0; - } - supply_register (regno, reg_buf+regno); - } - /* that leaves regs 64, 65, and 66 */ - datum = ptrace (3, inferior_pid, - (PTRACE_ARG3_TYPE) (((char *)&u.u_pcb.pcb_csp) - - ((char *)&u)), 0); - - - - /* FIXME: Find the Current Frame Pointer (CFP). CFP is a global - register (ie, NOT windowed), that gets saved in a frame iff - the code for that frame has a prologue (ie, "adsf N"). If - there is a prologue, the adsf insn saves the old cfp in - pr13, cfp is set to sp, and N bytes of locals are allocated - (sp is decremented by n). - This makes finding CFP hard. I guess the right way to do it - is: - - If this is the innermost frame, believe ptrace() or - the core area. - - Otherwise: - Find the first insn of the current frame. - - find the saved pc; - - find the call insn that saved it; - - figure out where the call is to; - - if the first insn is an adsf, we got a frame - pointer. */ - - - /* Normal processors have separate stack pointers for user and - kernel mode. Getting the last user mode frame on such - machines is easy: the kernel context of the ptrace()'d - process is on the kernel stack, and the USP points to what - we want. But Pyramids only have a single cfp for both user and - kernel mode. And processes being ptrace()'d have some - kernel-context control frames on their stack. - To avoid tracing back into the kernel context of an inferior, - we skip 0 or more contiguous control frames where the pc is - in the kernel. */ - - while (1) { - register int inferior_saved_pc; - inferior_saved_pc = ptrace (1, inferior_pid, - (PTRACE_ARG3_TYPE) (datum+((32+15)*4)), 0); - if (inferior_saved_pc > 0) break; -#if defined(PYRAMID_CONTROL_FRAME_DEBUGGING) - printf_unfiltered("skipping kernel frame %08x, pc=%08x\n", datum, - inferior_saved_pc); -#endif /* PYRAMID_CONTROL_FRAME_DEBUGGING */ - skipped_frames++; - datum -= CONTROL_STACK_FRAME_SIZE; - } - - reg_buf[CSP_REGNUM] = datum; - supply_register(CSP_REGNUM, reg_buf+CSP_REGNUM); -#ifdef PYRAMID_CONTROL_FRAME_DEBUGGING - if (skipped_frames) { - fprintf_unfiltered (stderr, - "skipped %d frames from %x to %x; cfp was %x, now %x\n", - skipped_frames, reg_buf[CSP_REGNUM]); - } -#endif /* PYRAMID_CONTROL_FRAME_DEBUGGING */ -} - -/* Store our register values back into the inferior. - If REGNO is -1, do this for all registers. - Otherwise, REGNO specifies which register (so we can save time). */ - -void -store_inferior_registers (regno) - int regno; -{ - register unsigned int regaddr; - char buf[80]; - - if (regno >= 0) - { - if ((0 <= regno) && (regno < 64)) { - /*regaddr = register_addr (regno, offset);*/ - regaddr = regno; - errno = 0; - ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, - read_register (regno)); - if (errno != 0) - { - sprintf (buf, "writing register number %d", regno); - perror_with_name (buf); - } - } - } - else - { - for (regno = 0; regno < NUM_REGS; regno++) - { - /*regaddr = register_addr (regno, offset);*/ - regaddr = regno; - errno = 0; - ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, - read_register (regno)); - if (errno != 0) - { - sprintf (buf, "writing all regs, number %d", regno); - perror_with_name (buf); - } - } -} - -/*** Extensions to core and dump files, for GDB. */ - -extern unsigned int last_frame_offset; - -#ifdef PYRAMID_CORE - -/* Can't make definitions here static, since corefile.c needs them - to do bounds checking on the core-file areas. O well. */ - -/* have two stacks: one for data, one for register windows. */ -extern CORE_ADDR reg_stack_start; -extern CORE_ADDR reg_stack_end; - -/* need this so we can find the global registers: they never get saved. */ -CORE_ADDR global_reg_offset; -static CORE_ADDR last_frame_address; -CORE_ADDR last_frame_offset; - - -/* Address in core file of start of register window stack area. - Don't know if is this any of meaningful, useful or necessary. */ -extern int reg_stack_offset; - -#endif /* PYRAMID_CORE */ - - -/* Work with core dump and executable files, for GDB. - This code would be in corefile.c if it weren't machine-dependent. */ - -void -core_file_command (filename, from_tty) - char *filename; - int from_tty; -{ - int val; - extern char registers[]; - - /* Discard all vestiges of any previous core file - and mark data and stack spaces as empty. */ - - if (corefile) - free (corefile); - corefile = 0; - - if (corechan >= 0) - close (corechan); - corechan = -1; - - data_start = 0; - data_end = 0; - stack_start = STACK_END_ADDR; - stack_end = STACK_END_ADDR; - -#ifdef PYRAMID_CORE - reg_stack_start = CONTROL_STACK_ADDR; - reg_stack_end = CONTROL_STACK_ADDR; /* this isn't strictly true...*/ -#endif /* PYRAMID_CORE */ - - /* Now, if a new core file was specified, open it and digest it. */ - - if (filename) - { - filename = tilde_expand (filename); - make_cleanup (free, filename); - - if (have_inferior_p ()) - error ("To look at a core file, you must kill the program with \"kill\"."); - corechan = open (filename, O_RDONLY, 0); - if (corechan < 0) - perror_with_name (filename); - /* 4.2-style (and perhaps also sysV-style) core dump file. */ - { - struct user u; - - unsigned int reg_offset; - - val = myread (corechan, &u, sizeof u); - if (val < 0) - perror_with_name ("Not a core file: reading upage"); - if (val != sizeof u) - error ("Not a core file: could only read %d bytes", val); - data_start = exec_data_start; - - data_end = data_start + NBPG * u.u_dsize; - data_offset = NBPG * UPAGES; - stack_offset = NBPG * (UPAGES + u.u_dsize); - - /* find registers in core file */ -#ifdef PYRAMID_PTRACE - stack_start = stack_end - NBPG * u.u_ussize; - reg_stack_offset = stack_offset + (NBPG *u.u_ussize); - reg_stack_end = reg_stack_start + NBPG * u.u_cssize; - - last_frame_address = ((int) u.u_pcb.pcb_csp); - last_frame_offset = reg_stack_offset + last_frame_address - - CONTROL_STACK_ADDR ; - global_reg_offset = (char *)&u - (char *)&u.u_pcb.pcb_gr0 ; - - /* skip any control-stack frames that were executed in the - kernel. */ - - while (1) { - char buf[4]; - val = lseek (corechan, last_frame_offset+(47*4), 0); - if (val < 0) - perror_with_name (filename); - val = myread (corechan, buf, sizeof buf); - if (val < 0) - perror_with_name (filename); - - if (*(int *)buf >= 0) - break; - printf_unfiltered ("skipping frame %s\n", local_hex_string (last_frame_address)); - last_frame_offset -= CONTROL_STACK_FRAME_SIZE; - last_frame_address -= CONTROL_STACK_FRAME_SIZE; - } - reg_offset = last_frame_offset; - -#if 1 || defined(PYRAMID_CONTROL_FRAME_DEBUGGING) - printf_unfiltered ("Control stack pointer = %s\n", - local_hex_string (u.u_pcb.pcb_csp)); - printf_unfiltered ("offset to control stack %d outermost frame %d (%s)\n", - reg_stack_offset, reg_offset, local_hex_string (last_frame_address)); -#endif /* PYRAMID_CONTROL_FRAME_DEBUGGING */ - -#else /* not PYRAMID_CORE */ - stack_start = stack_end - NBPG * u.u_ssize; - reg_offset = (int) u.u_ar0 - KERNEL_U_ADDR; -#endif /* not PYRAMID_CORE */ - -#ifdef __not_on_pyr_yet - /* Some machines put an absolute address in here and some put - the offset in the upage of the regs. */ - reg_offset = (int) u.u_ar0; - if (reg_offset > NBPG * UPAGES) - reg_offset -= KERNEL_U_ADDR; -#endif - - /* I don't know where to find this info. - So, for now, mark it as not available. */ - N_SET_MAGIC (core_aouthdr, 0); - - /* Read the register values out of the core file and store - them where `read_register' will find them. */ - - { - register int regno; - - for (regno = 0; regno < 64; regno++) - { - char buf[MAX_REGISTER_RAW_SIZE]; - - val = lseek (corechan, register_addr (regno, reg_offset), 0); - if (val < 0 - || (val = myread (corechan, buf, sizeof buf)) < 0) - { - char * buffer = (char *) alloca (strlen (reg_names[regno]) - + 30); - strcpy (buffer, "Reading register "); - strcat (buffer, reg_names[regno]); - - perror_with_name (buffer); - } - - if (val < 0) - perror_with_name (filename); -#ifdef PYRAMID_CONTROL_FRAME_DEBUGGING - printf_unfiltered ("[reg %s(%d), offset in file %s=0x%0x, addr =0x%0x, =%0x]\n", - reg_names[regno], regno, filename, - register_addr(regno, reg_offset), - regno * 4 + last_frame_address, - *((int *)buf)); -#endif /* PYRAMID_CONTROL_FRAME_DEBUGGING */ - supply_register (regno, buf); - } - } - } - if (filename[0] == '/') - corefile = savestring (filename, strlen (filename)); - else - { - corefile = concat (current_directory, "/", filename, NULL); - } - -#if 1 || defined(PYRAMID_CONTROL_FRAME_DEBUGGING) - printf_unfiltered ("Providing CSP (%s) as nominal address of current frame.\n", - local_hex_string(last_frame_address)); -#endif PYRAMID_CONTROL_FRAME_DEBUGGING - /* FIXME: Which of the following is correct? */ -#if 0 - set_current_frame ( create_new_frame (read_register (FP_REGNUM), - read_pc ())); -#else - set_current_frame ( create_new_frame (last_frame_address, - read_pc ())); -#endif - - select_frame (get_current_frame (), 0); - validate_files (); - } - else if (from_tty) - printf_unfiltered ("No core file now.\n"); -} diff --git a/contrib/gdb/gdb/remote-adapt.c b/contrib/gdb/gdb/remote-adapt.c deleted file mode 100644 index 8fcb1f7..0000000 --- a/contrib/gdb/gdb/remote-adapt.c +++ /dev/null @@ -1,1359 +0,0 @@ -/* Remote debugging interface for AMD 290*0 Adapt Monitor Version 2.1d18. - Copyright 1990, 1991, 1992 Free Software Foundation, Inc. - Contributed by David Wood at New York University (wood@lab.ultra.nyu.edu). - Adapted from work done at Cygnus Support in remote-eb.c. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* This is like remote.c but is for an esoteric situation-- - having a 29k board attached to an Adapt inline monitor. - The monitor is connected via serial line to a unix machine - running gdb. - - 3/91 - developed on Sun3 OS 4.1, by David Wood - o - I can't get binary coff to load. - o - I can't get 19200 baud rate to work. - 7/91 o - Freeze mode tracing can be done on a 29050. */ - -#include "defs.h" -#include "gdb_string.h" -#include "inferior.h" -#include "wait.h" -#include "value.h" -#include -#include -#include -#include -#include "terminal.h" -#include "target.h" -#include "gdbcore.h" - -/* External data declarations */ -extern int stop_soon_quietly; /* for wait_for_inferior */ - -/* Forward data declarations */ -extern struct target_ops adapt_ops; /* Forward declaration */ - -/* Forward function declarations */ -static void adapt_fetch_registers (); -static void adapt_store_registers (); -static void adapt_close (); -static int adapt_clear_breakpoints(); - -#define FREEZE_MODE (read_register(CPS_REGNUM) && 0x400) -#define USE_SHADOW_PC ((processor_type == a29k_freeze_mode) && FREEZE_MODE) - -/* Can't seem to get binary coff working */ -#define ASCII_COFF /* Adapt will be downloaded with ascii coff */ - -/* FIXME: Replace with `set remotedebug'. */ -#define LOG_FILE "adapt.log" -#if defined (LOG_FILE) -FILE *log_file=NULL; -#endif - -static int timeout = 5; -static char *dev_name; - -/* Descriptor for I/O to remote machine. Initialize it to -1 so that - adapt_open knows that we don't have a file open when the program - starts. */ -int adapt_desc = -1; - -/* stream which is fdopen'd from adapt_desc. Only valid when - adapt_desc != -1. */ -FILE *adapt_stream; - -#define ON 1 -#define OFF 0 -static void -rawmode(desc, turnon) -int desc; -int turnon; -{ - TERMINAL sg; - - if (desc < 0) - return; - - ioctl (desc, TIOCGETP, &sg); - - if (turnon) { -#ifdef HAVE_TERMIO - sg.c_lflag &= ~(ICANON); -#else - sg.sg_flags |= RAW; -#endif - } else { -#ifdef HAVE_TERMIO - sg.c_lflag |= ICANON; -#else - sg.sg_flags &= ~(RAW); -#endif - } - ioctl (desc, TIOCSETP, &sg); -} - -/* Suck up all the input from the adapt */ -slurp_input() -{ - char buf[8]; - -#ifdef HAVE_TERMIO - /* termio does the timeout for us. */ - while (read (adapt_desc, buf, 8) > 0); -#else - alarm (timeout); - while (read (adapt_desc, buf, 8) > 0); - alarm (0); -#endif -} - -/* Read a character from the remote system, doing all the fancy - timeout stuff. */ -static int -readchar () -{ - char buf; - - buf = '\0'; -#ifdef HAVE_TERMIO - /* termio does the timeout for us. */ - read (adapt_desc, &buf, 1); -#else - alarm (timeout); - if (read (adapt_desc, &buf, 1) < 0) - { - if (errno == EINTR) - error ("Timeout reading from remote system."); - else - perror_with_name ("remote"); - } - alarm (0); -#endif - - if (buf == '\0') - error ("Timeout reading from remote system."); -#if defined (LOG_FILE) - putc (buf & 0x7f, log_file); -#endif - return buf & 0x7f; -} - -/* Keep discarding input from the remote system, until STRING is found. - Let the user break out immediately. */ -static void -expect (string) - char *string; -{ - char *p = string; - - fflush(adapt_stream); - immediate_quit = 1; - while (1) - { - if (readchar() == *p) - { - p++; - if (*p == '\0') - { - immediate_quit = 0; - return; - } - } - else - p = string; - } -} - -/* Keep discarding input until we see the adapt prompt. - - The convention for dealing with the prompt is that you - o give your command - o *then* wait for the prompt. - - Thus the last thing that a procedure does with the serial line - will be an expect_prompt(). Exception: adapt_resume does not - wait for the prompt, because the terminal is being handed over - to the inferior. However, the next thing which happens after that - is a adapt_wait which does wait for the prompt. - Note that this includes abnormal exit, e.g. error(). This is - necessary to prevent getting into states from which we can't - recover. */ -static void -expect_prompt () -{ -#if defined (LOG_FILE) - /* This is a convenient place to do this. The idea is to do it often - enough that we never lose much data if we terminate abnormally. */ - fflush (log_file); -#endif - fflush(adapt_stream); - expect ("\n# "); -} - -/* Get a hex digit from the remote system & return its value. - If ignore_space is nonzero, ignore spaces (not newline, tab, etc). */ -static int -get_hex_digit (ignore_space) - int ignore_space; -{ - int ch; - while (1) - { - ch = readchar (); - if (ch >= '0' && ch <= '9') - return ch - '0'; - else if (ch >= 'A' && ch <= 'F') - return ch - 'A' + 10; - else if (ch >= 'a' && ch <= 'f') - return ch - 'a' + 10; - else if (ch == ' ' && ignore_space) - ; - else - { - expect_prompt (); - error ("Invalid hex digit from remote system."); - } - } -} - -/* Get a byte from adapt_desc and put it in *BYT. Accept any number - leading spaces. */ -static void -get_hex_byte (byt) - char *byt; -{ - int val; - - val = get_hex_digit (1) << 4; - val |= get_hex_digit (0); - *byt = val; -} - -/* Read a 32-bit hex word from the adapt, preceded by a space */ -static long -get_hex_word() -{ - long val; - int j; - - val = 0; - for (j = 0; j < 8; j++) - val = (val << 4) + get_hex_digit (j == 0); - return val; -} -/* Get N 32-bit hex words from remote, each preceded by a space - and put them in registers starting at REGNO. */ -static void -get_hex_regs (n, regno) - int n; - int regno; -{ - long val; - while (n--) { - val = get_hex_word(); - supply_register(regno++,(char *) &val); - } -} -/* Called when SIGALRM signal sent due to alarm() timeout. */ -#ifndef HAVE_TERMIO - -#ifndef __STDC__ -# ifndef volatile -# define volatile /**/ -# endif -#endif -volatile int n_alarms; - -void -adapt_timer () -{ -#if 0 - if (kiodebug) - printf ("adapt_timer called\n"); -#endif - n_alarms++; -} -#endif - -/* malloc'd name of the program on the remote system. */ -static char *prog_name = NULL; - -/* Number of SIGTRAPs we need to simulate. That is, the next - NEED_ARTIFICIAL_TRAP calls to adapt_wait should just return - SIGTRAP without actually waiting for anything. */ - -static int need_artificial_trap = 0; - -void -adapt_kill(arg,from_tty) -char *arg; -int from_tty; -{ - fprintf (adapt_stream, "K"); - fprintf (adapt_stream, "\r"); - expect_prompt (); -} -/* - * Download a file specified in 'args', to the adapt. - * FIXME: Assumes the file to download is a binary coff file. - */ -static void -adapt_load(args,fromtty) -char *args; -int fromtty; -{ - FILE *fp; - int n; - char buffer[1024]; - - if (!adapt_stream) { - printf_filtered("Adapt not open. Use 'target' command to open adapt\n"); - return; - } - - /* OK, now read in the file. Y=read, C=COFF, T=dTe port - 0=start address. */ - -#ifdef ASCII_COFF /* Ascii coff */ - fprintf (adapt_stream, "YA T,0\r"); - fflush(adapt_stream); /* Just in case */ - /* FIXME: should check args for only 1 argument */ - sprintf(buffer,"cat %s | btoa > /tmp/#adapt-btoa",args); - system(buffer); - fp = fopen("/tmp/#adapt-btoa","r"); - rawmode(adapt_desc,OFF); - while (n=fread(buffer,1,1024,fp)) { - do { n -= write(adapt_desc,buffer,n); } while (n>0); - if (n<0) { perror("writing ascii coff"); break; } - } - fclose(fp); - rawmode(adapt_desc,ON); - system("rm /tmp/#adapt-btoa"); -#else /* Binary coff - can't get it to work .*/ - fprintf (adapt_stream, "YC T,0\r"); - fflush(adapt_stream); /* Just in case */ - if (!(fp = fopen(args,"r"))) { - printf_filtered("Can't open %s\n",args); - return; - } - while (n=fread(buffer,1,512,fp)) { - do { n -= write(adapt_desc,buffer,n); } while (n>0); - if (n<0) { perror("writing ascii coff"); break; } - } - fclose(fp); -#endif - expect_prompt (); /* Skip garbage that comes out */ - fprintf (adapt_stream, "\r"); - expect_prompt (); -} - -/* This is called not only when we first attach, but also when the - user types "run" after having attached. */ -void -adapt_create_inferior (execfile, args, env) - char *execfile; - char *args; - char **env; -{ - int entry_pt; - - if (args && *args) - error ("Can't pass arguments to remote adapt process."); - - if (execfile == 0 || exec_bfd == 0) - error ("No exec file specified"); - - entry_pt = (int) bfd_get_start_address (exec_bfd); - - if (adapt_stream) { - adapt_kill(NULL,NULL); - adapt_clear_breakpoints(); - init_wait_for_inferior (); - /* Clear the input because what the adapt sends back is different - * depending on whether it was running or not. - */ - slurp_input(); /* After this there should be a prompt */ - fprintf(adapt_stream,"\r"); - expect_prompt(); - printf_filtered("Do you want to download '%s' (y/n)? [y] : ",prog_name); - { - char buffer[10]; - gets(buffer); - if (*buffer != 'n') { - adapt_load(prog_name,0); - } - } - -#ifdef NOTDEF - /* Set the PC and wait for a go/cont */ - fprintf (adapt_stream, "G %x,N\r",entry_pt); - printf_filtered("Now use the 'continue' command to start.\n"); - expect_prompt (); -#else - insert_breakpoints (); /* Needed to get correct instruction in cache */ - proceed(entry_pt, TARGET_SIGNAL_DEFAULT, 0); -#endif - - } else { - printf_filtered("Adapt not open yet.\n"); - } -} - -/* Translate baud rates from integers to damn B_codes. Unix should - have outgrown this crap years ago, but even POSIX wouldn't buck it. */ - -#ifndef B19200 -#define B19200 EXTA -#endif -#ifndef B38400 -#define B38400 EXTB -#endif - -static struct {int rate, damn_b;} baudtab[] = { - {0, B0}, - {50, B50}, - {75, B75}, - {110, B110}, - {134, B134}, - {150, B150}, - {200, B200}, - {300, B300}, - {600, B600}, - {1200, B1200}, - {1800, B1800}, - {2400, B2400}, - {4800, B4800}, - {9600, B9600}, - {19200, B19200}, - {38400, B38400}, - {-1, -1}, -}; - -static int damn_b (rate) - int rate; -{ - int i; - - for (i = 0; baudtab[i].rate != -1; i++) - if (rate == baudtab[i].rate) return baudtab[i].damn_b; - return B38400; /* Random */ -} - - -/* Open a connection to a remote debugger. - NAME is the filename used for communication, then a space, - then the baud rate. - */ - -static int baudrate = 9600; -static void -adapt_open (name, from_tty) - char *name; - int from_tty; -{ - TERMINAL sg; - unsigned int prl; - char *p; - - /* Find the first whitespace character, it separates dev_name from - prog_name. */ - if (name == 0) - goto erroid; - - for (p = name; - *p != '\0' && !isspace (*p); p++) - ; - if (*p == '\0') -erroid: - error ("\ -Please include the name of the device for the serial port,\n\ -the baud rate, and the name of the program to run on the remote system."); - dev_name = (char*)xmalloc(p - name + 1); - strncpy (dev_name, name, p - name); - dev_name[p - name] = '\0'; - - /* Skip over the whitespace after dev_name */ - for (; isspace (*p); p++) - /*EMPTY*/; - - if (1 != sscanf (p, "%d ", &baudrate)) - goto erroid; - - /* Skip the number and then the spaces */ - for (; isdigit (*p); p++) - /*EMPTY*/; - for (; isspace (*p); p++) - /*EMPTY*/; - - if (prog_name != NULL) - free (prog_name); - prog_name = savestring (p, strlen (p)); - - adapt_close (0); - - adapt_desc = open (dev_name, O_RDWR); - if (adapt_desc < 0) - perror_with_name (dev_name); - ioctl (adapt_desc, TIOCGETP, &sg); -#ifdef HAVE_TERMIO - sg.c_cc[VMIN] = 0; /* read with timeout. */ - sg.c_cc[VTIME] = timeout * 10; - sg.c_lflag &= ~(ICANON | ECHO); - sg.c_cflag = (sg.c_cflag & ~CBAUD) | damn_b (baudrate); -#else - sg.sg_ispeed = damn_b (baudrate); - sg.sg_ospeed = damn_b (baudrate); - sg.sg_flags |= RAW | ANYP; - sg.sg_flags &= ~ECHO; -#endif - - ioctl (adapt_desc, TIOCSETP, &sg); - adapt_stream = fdopen (adapt_desc, "r+"); - - push_target (&adapt_ops); - -#ifndef HAVE_TERMIO -#ifndef NO_SIGINTERRUPT - /* Cause SIGALRM's to make reads fail with EINTR instead of resuming - the read. */ - if (siginterrupt (SIGALRM, 1) != 0) - perror ("adapt_open: error in siginterrupt"); -#endif - - /* Set up read timeout timer. */ - if ((void (*)) signal (SIGALRM, adapt_timer) == (void (*)) -1) - perror ("adapt_open: error in signal"); -#endif - -#if defined (LOG_FILE) - log_file = fopen (LOG_FILE, "w"); - if (log_file == NULL) - perror_with_name (LOG_FILE); -#endif - - /* Put this port into NORMAL mode, send the 'normal' character */ - write(adapt_desc, "", 1); /* Control A */ - write(adapt_desc, "\r", 1); - expect_prompt (); - - /* Hello? Are you there? */ - write (adapt_desc, "\r", 1); - - expect_prompt (); - - /* Clear any break points */ - adapt_clear_breakpoints(); - - /* Print out some stuff, letting the user now what's going on */ - printf_filtered("Connected to an Adapt via %s.\n", dev_name); - /* FIXME: can this restriction be removed? */ - printf_filtered("Remote debugging using virtual addresses works only\n"); - printf_filtered("\twhen virtual addresses map 1:1 to physical addresses.\n"); - if (processor_type != a29k_freeze_mode) { - fprintf_filtered(stderr, - "Freeze-mode debugging not available, and can only be done on an A29050.\n"); - } -} - -/* Close out all files and local state before this target loses control. */ - -static void -adapt_close (quitting) - int quitting; -{ - - /* Clear any break points */ - adapt_clear_breakpoints(); - - /* Put this port back into REMOTE mode */ - if (adapt_stream) { - fflush(adapt_stream); - sleep(1); /* Let any output make it all the way back */ - write(adapt_desc, "R\r", 2); - } - - /* Due to a bug in Unix, fclose closes not only the stdio stream, - but also the file descriptor. So we don't actually close - adapt_desc. */ - if (adapt_stream) - fclose (adapt_stream); /* This also closes adapt_desc */ - if (adapt_desc >= 0) - /* close (adapt_desc); */ - - /* Do not try to close adapt_desc again, later in the program. */ - adapt_stream = NULL; - adapt_desc = -1; - -#if defined (LOG_FILE) - if (log_file) { - if (ferror (log_file)) - printf_filtered ("Error writing log file.\n"); - if (fclose (log_file) != 0) - printf_filtered ("Error closing log file.\n"); - log_file = NULL; - } -#endif -} - -/* Attach to the target that is already loaded and possibly running */ -static void -adapt_attach (args, from_tty) - char *args; - int from_tty; -{ - - if (from_tty) - printf_filtered ("Attaching to remote program %s.\n", prog_name); - - /* Send the adapt a kill. It is ok if it is not already running */ - fprintf(adapt_stream, "K\r"); fflush(adapt_stream); - expect_prompt(); /* Slurp the echo */ -} - - -/* Terminate the open connection to the remote debugger. - Use this when you want to detach and do something else - with your gdb. */ -void -adapt_detach (args,from_tty) - char *args; - int from_tty; -{ - - if (adapt_stream) { /* Send it on its way (tell it to continue) */ - adapt_clear_breakpoints(); - fprintf(adapt_stream,"G\r"); - } - - pop_target(); /* calls adapt_close to do the real work */ - if (from_tty) - printf_filtered ("Ending remote %s debugging\n", target_shortname); -} - -/* Tell the remote machine to resume. */ - -void -adapt_resume (pid, step, sig) - int pid, step; - enum target_signal sig; -{ - if (step) - { - write (adapt_desc, "t 1,s\r", 6); - /* Wait for the echo. */ - expect ("t 1,s\r\n"); - /* Then comes a line containing the instruction we stepped to. */ - expect ("@"); - /* Then we get the prompt. */ - expect_prompt (); - - /* Force the next adapt_wait to return a trap. Not doing anything - about I/O from the target means that the user has to type - "continue" to see any. FIXME, this should be fixed. */ - need_artificial_trap = 1; - } - else - { - write (adapt_desc, "G\r", 2); - /* Swallow the echo. */ - expect_prompt(); - } -} - -/* Wait until the remote machine stops, then return, - storing status in STATUS just as `wait' would. */ - -int -adapt_wait (status) - struct target_waitstatus *status; -{ - /* Strings to look for. '?' means match any single character. - Note that with the algorithm we use, the initial character - of the string cannot recur in the string, or we will not - find some cases of the string in the input. */ - - static char bpt[] = "@"; - /* It would be tempting to look for "\n[__exit + 0x8]\n" - but that requires loading symbols with "yc i" and even if - we did do that we don't know that the file has symbols. */ - static char exitmsg[] = "@????????I JMPTI GR121,LR0"; - char *bp = bpt; - char *ep = exitmsg; - - /* Large enough for either sizeof (bpt) or sizeof (exitmsg) chars. */ - char swallowed[50]; - /* Current position in swallowed. */ - char *swallowed_p = swallowed; - - int ch; - int ch_handled; - int old_timeout = timeout; - int old_immediate_quit = immediate_quit; - - status->kind = TARGET_WAITKIND_EXITED; - status->value.integer = 0; - - if (need_artificial_trap != 0) - { - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_TRAP; - need_artificial_trap--; - return 0; - } - - timeout = 0; /* Don't time out -- user program is running. */ - immediate_quit = 1; /* Helps ability to QUIT */ - while (1) { - QUIT; /* Let user quit and leave process running */ - ch_handled = 0; - ch = readchar (); - if (ch == *bp) { - bp++; - if (*bp == '\0') - break; - ch_handled = 1; - - *swallowed_p++ = ch; - } else - bp = bpt; - if (ch == *ep || *ep == '?') { - ep++; - if (*ep == '\0') - break; - - if (!ch_handled) - *swallowed_p++ = ch; - ch_handled = 1; - } else - ep = exitmsg; - if (!ch_handled) { - char *p; - /* Print out any characters which have been swallowed. */ - for (p = swallowed; p < swallowed_p; ++p) - putc (*p, stdout); - swallowed_p = swallowed; - putc (ch, stdout); - } - } - expect_prompt (); - if (*bp== '\0') - { - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_TRAP; - } - else - { - status->kind = TARGET_WAITKIND_EXITED; - status->value.integer = 0; - } - timeout = old_timeout; - immediate_quit = old_immediate_quit; - return 0; -} - -/* Return the name of register number REGNO - in the form input and output by adapt. - - Returns a pointer to a static buffer containing the answer. */ -static char * -get_reg_name (regno) - int regno; -{ - static char buf[80]; - if (regno >= GR96_REGNUM && regno < GR96_REGNUM + 32 ) - sprintf (buf, "GR%03d", regno - GR96_REGNUM + 96); -#if defined(GR64_REGNUM) - else if (regno >= GR64_REGNUM && regno < GR64_REGNUM + 32 ) - sprintf (buf, "GR%03d", regno - GR64_REGNUM + 64); -#endif - else if (regno >= LR0_REGNUM && regno < LR0_REGNUM + 128) - sprintf (buf, "LR%03d", regno - LR0_REGNUM); - else if (regno == Q_REGNUM) - strcpy (buf, "SR131"); - else if (regno >= BP_REGNUM && regno <= CR_REGNUM) - sprintf (buf, "SR%03d", regno - BP_REGNUM + 133); - else if (regno == ALU_REGNUM) - strcpy (buf, "SR132"); - else if (regno >= IPC_REGNUM && regno <= IPB_REGNUM) - sprintf (buf, "SR%03d", regno - IPC_REGNUM + 128); - else if (regno >= VAB_REGNUM && regno <= LRU_REGNUM) { - /* When a 29050 is in freeze-mode, read shadow pcs instead */ - if ((regno >= NPC_REGNUM && regno <= PC2_REGNUM) && USE_SHADOW_PC) - sprintf (buf, "SR%03d", regno - NPC_REGNUM + 20); - else - sprintf (buf, "SR%03d", regno - VAB_REGNUM); - } - else if (regno == GR1_REGNUM) - strcpy (buf, "GR001"); - return buf; -} - -/* Read the remote registers. */ - -static void -adapt_fetch_registers () -{ - int reg_index; - int regnum_index; - char tempbuf[10]; - int sreg_buf[16]; - int i,j; - -/* - * Global registers - */ -#if defined(GR64_REGNUM) - write (adapt_desc, "dw gr64,gr95\r", 13); - for (reg_index = 64, regnum_index = GR64_REGNUM; - reg_index < 96; - reg_index += 4, regnum_index += 4) - { - sprintf (tempbuf, "GR%03d ", reg_index); - expect (tempbuf); - get_hex_regs (4, regnum_index); - expect ("\n"); - } -#endif - write (adapt_desc, "dw gr96,gr127\r", 14); - for (reg_index = 96, regnum_index = GR96_REGNUM; - reg_index < 128; - reg_index += 4, regnum_index += 4) - { - sprintf (tempbuf, "GR%03d ", reg_index); - expect (tempbuf); - get_hex_regs (4, regnum_index); - expect ("\n"); - } - -/* - * Local registers - */ - for (i = 0; i < 128; i += 32) - { - /* The PC has a tendency to hang if we get these - all in one fell swoop ("dw lr0,lr127"). */ - sprintf (tempbuf, "dw lr%d\r", i); - write (adapt_desc, tempbuf, strlen (tempbuf)); - for (reg_index = i, regnum_index = LR0_REGNUM + i; - reg_index < i + 32; - reg_index += 4, regnum_index += 4) - { - sprintf (tempbuf, "LR%03d ", reg_index); - expect (tempbuf); - get_hex_regs (4, regnum_index); - expect ("\n"); - } - } - -/* - * Special registers - */ - sprintf (tempbuf, "dw sr0\r"); - write (adapt_desc, tempbuf, strlen (tempbuf)); - for (i=0 ; i<4 ; i++) { /* SR0 - SR14 */ - sprintf (tempbuf, "SR%3d",i*4); - expect(tempbuf); - for (j=0 ; j < (i==3 ? 3 : 4) ; j++) - sreg_buf[i*4 + j] = get_hex_word(); - } - expect_prompt(); - /* - * Read the pcs individually if we are in freeze mode. - * See get_reg_name(), it translates the register names for the pcs to - * the names of the shadow pcs. - */ - if (USE_SHADOW_PC) { - sreg_buf[10] = read_register(NPC_REGNUM); /* pc0 */ - sreg_buf[11] = read_register(PC_REGNUM); /* pc1 */ - sreg_buf[12] = read_register(PC2_REGNUM); /* pc2 */ - } - for (i=0 ; i<14 ; i++) /* Supply vab -> lru */ - supply_register(VAB_REGNUM+i, (char *) &sreg_buf[i]); - sprintf (tempbuf, "dw sr128\r"); - write (adapt_desc, tempbuf, strlen (tempbuf)); - for (i=0 ; i<2 ; i++) { /* SR128 - SR135 */ - sprintf (tempbuf, "SR%3d",128 + i*4); - expect(tempbuf); - for (j=0 ; j<4 ; j++) - sreg_buf[i*4 + j] = get_hex_word(); - } - expect_prompt(); - supply_register(IPC_REGNUM,(char *) &sreg_buf[0]); - supply_register(IPA_REGNUM,(char *) &sreg_buf[1]); - supply_register(IPB_REGNUM,(char *) &sreg_buf[2]); - supply_register(Q_REGNUM, (char *) &sreg_buf[3]); - /* Skip ALU */ - supply_register(BP_REGNUM, (char *) &sreg_buf[5]); - supply_register(FC_REGNUM, (char *) &sreg_buf[6]); - supply_register(CR_REGNUM, (char *) &sreg_buf[7]); - - /* There doesn't seem to be any way to get these. */ - { - int val = -1; - supply_register (FPE_REGNUM, (char *) &val); - supply_register (INTE_REGNUM, (char *) &val); - supply_register (FPS_REGNUM, (char *) &val); - supply_register (EXO_REGNUM, (char *) &val); - } - - write (adapt_desc, "dw gr1,gr1\r", 11); - expect ("GR001 "); - get_hex_regs (1, GR1_REGNUM); - expect_prompt (); -} - -/* Fetch register REGNO, or all registers if REGNO is -1. - */ -static void -adapt_fetch_register (regno) - int regno; -{ - if (regno == -1) - adapt_fetch_registers (); - else - { - char *name = get_reg_name (regno); - fprintf (adapt_stream, "dw %s,%s\r", name, name); - expect (name); - expect (" "); - get_hex_regs (1, regno); - expect_prompt (); - } -} - -/* Store the remote registers from the contents of the block REGS. */ - -static void -adapt_store_registers () -{ - int i, j; - - fprintf (adapt_stream, "s gr1,%x\r", read_register (GR1_REGNUM)); - expect_prompt (); - -#if defined(GR64_REGNUM) - for (j = 0; j < 32; j += 16) - { - fprintf (adapt_stream, "s gr%d,", j + 64); - for (i = 0; i < 15; ++i) - fprintf (adapt_stream, "%x,", read_register (GR64_REGNUM + j + i)); - fprintf (adapt_stream, "%x\r", read_register (GR64_REGNUM + j + 15)); - expect_prompt (); - } -#endif - for (j = 0; j < 32; j += 16) - { - fprintf (adapt_stream, "s gr%d,", j + 96); - for (i = 0; i < 15; ++i) - fprintf (adapt_stream, "%x,", read_register (GR96_REGNUM + j + i)); - fprintf (adapt_stream, "%x\r", read_register (GR96_REGNUM + j + 15)); - expect_prompt (); - } - - for (j = 0; j < 128; j += 16) - { - fprintf (adapt_stream, "s lr%d,", j); - for (i = 0; i < 15; ++i) - fprintf (adapt_stream, "%x,", read_register (LR0_REGNUM + j + i)); - fprintf (adapt_stream, "%x\r", read_register (LR0_REGNUM + j + 15)); - expect_prompt (); - } - - fprintf (adapt_stream, "s sr128,%x,%x,%x\r", read_register (IPC_REGNUM), - read_register (IPA_REGNUM), read_register (IPB_REGNUM)); - expect_prompt (); - fprintf (adapt_stream, "s sr133,%x,%x,%x\r", read_register (BP_REGNUM), - read_register (FC_REGNUM), read_register (CR_REGNUM)); - expect_prompt (); - fprintf (adapt_stream, "s sr131,%x\r", read_register (Q_REGNUM)); - expect_prompt (); - fprintf (adapt_stream, "s sr0,"); - for (i=0 ; i<7 ; ++i) - fprintf (adapt_stream, "%x,", read_register (VAB_REGNUM + i)); - expect_prompt (); - fprintf (adapt_stream, "s sr7,"); - for (i=7; i<14 ; ++i) - fprintf (adapt_stream, "%x,", read_register (VAB_REGNUM + i)); - expect_prompt (); -} - -/* Store register REGNO, or all if REGNO == -1. - Return errno value. */ -void -adapt_store_register (regno) - int regno; -{ - /* printf("adapt_store_register() called.\n"); fflush(stdout); /* */ - if (regno == -1) - adapt_store_registers (); - else - { - char *name = get_reg_name (regno); - fprintf (adapt_stream, "s %s,%x\r", name, read_register (regno)); - /* Setting GR1 changes the numbers of all the locals, so - invalidate the register cache. Do this *after* calling - read_register, because we want read_register to return the - value that write_register has just stuffed into the registers - array, not the value of the register fetched from the - inferior. */ - if (regno == GR1_REGNUM) - registers_changed (); - expect_prompt (); - } -} - -/* Get ready to modify the registers array. On machines which store - individual registers, this doesn't need to do anything. On machines - which store all the registers in one fell swoop, this makes sure - that registers contains all the registers from the program being - debugged. */ - -void -adapt_prepare_to_store () -{ - /* Do nothing, since we can store individual regs */ -} - -static CORE_ADDR -translate_addr(addr) -CORE_ADDR addr; -{ -#if defined(KERNEL_DEBUGGING) - /* Check for a virtual address in the kernel */ - /* Assume physical address of ublock is in paddr_u register */ - if (addr >= UVADDR) { - /* PADDR_U register holds the physical address of the ublock */ - CORE_ADDR i = (CORE_ADDR)read_register(PADDR_U_REGNUM); - return(i + addr - (CORE_ADDR)UVADDR); - } else { - return(addr); - } -#else - return(addr); -#endif -} - - -/* FIXME! Merge these two. */ -int -adapt_xfer_inferior_memory (memaddr, myaddr, len, write) - CORE_ADDR memaddr; - char *myaddr; - int len; - int write; -{ - - memaddr = translate_addr(memaddr); - - if (write) - return adapt_write_inferior_memory (memaddr, myaddr, len); - else - return adapt_read_inferior_memory (memaddr, myaddr, len); -} - -void -adapt_files_info () -{ - printf_filtered("\tAttached to %s at %d baud and running program %s\n", - dev_name, baudrate, prog_name); - printf_filtered("\ton an %s processor.\n", processor_name[processor_type]); -} - -/* Copy LEN bytes of data from debugger memory at MYADDR - to inferior's memory at MEMADDR. Returns errno value. - * sb/sh instructions don't work on unaligned addresses, when TU=1. - */ -int -adapt_write_inferior_memory (memaddr, myaddr, len) - CORE_ADDR memaddr; - char *myaddr; - int len; -{ - int i; - unsigned int cps; - - /* Turn TU bit off so we can do 'sb' commands */ - cps = read_register(CPS_REGNUM); - if (cps & 0x00000800) - write_register(CPS_REGNUM,cps&~(0x00000800)); - - for (i = 0; i < len; i++) - { - if ((i % 16) == 0) - fprintf (adapt_stream, "sb %x,", memaddr + i); - if ((i % 16) == 15 || i == len - 1) - { - fprintf (adapt_stream, "%x\r", ((unsigned char *)myaddr)[i]); - expect_prompt (); - } - else - fprintf (adapt_stream, "%x,", ((unsigned char *)myaddr)[i]); - } - /* Restore the old value of cps if the TU bit was on */ - if (cps & 0x00000800) - write_register(CPS_REGNUM,cps); - return len; -} - -/* Read LEN bytes from inferior memory at MEMADDR. Put the result - at debugger address MYADDR. Returns errno value. */ -int -adapt_read_inferior_memory(memaddr, myaddr, len) - CORE_ADDR memaddr; - char *myaddr; - int len; -{ - int i; - - /* Number of bytes read so far. */ - int count; - - /* Starting address of this pass. */ - unsigned long startaddr; - - /* Number of bytes to read in this pass. */ - int len_this_pass; - - /* Note that this code works correctly if startaddr is just less - than UINT_MAX (well, really CORE_ADDR_MAX if there was such a - thing). That is, something like - adapt_read_bytes (CORE_ADDR_MAX - 4, foo, 4) - works--it never adds len to memaddr and gets 0. */ - /* However, something like - adapt_read_bytes (CORE_ADDR_MAX - 3, foo, 4) - doesn't need to work. Detect it and give up if there's an attempt - to do that. */ - - if (((memaddr - 1) + len) < memaddr) - return EIO; - - startaddr = memaddr; - count = 0; - while (count < len) - { - len_this_pass = 16; - if ((startaddr % 16) != 0) - len_this_pass -= startaddr % 16; - if (len_this_pass > (len - count)) - len_this_pass = (len - count); - - fprintf (adapt_stream, "db %x,%x\r", startaddr, - (startaddr - 1) + len_this_pass); - -#ifdef NOTDEF /* Why do this */ - expect ("\n"); - /* Look for 8 hex digits. */ - i = 0; - while (1) - { - if (isxdigit (readchar ())) - ++i; - else - { - expect_prompt (); - error ("Hex digit expected from remote system."); - } - if (i >= 8) - break; - } -#endif /* NOTDEF */ - - expect (" "); - - for (i = 0; i < len_this_pass; i++) - get_hex_byte (&myaddr[count++]); - - expect_prompt (); - - startaddr += len_this_pass; - } - return count; -} - -#define MAX_BREAKS 8 -static int num_brkpts=0; -static int -adapt_insert_breakpoint(addr, save) -CORE_ADDR addr; -char *save; /* Throw away, let adapt save instructions */ -{ - if (num_brkpts < MAX_BREAKS) { - num_brkpts++; - fprintf (adapt_stream, "B %x", addr); - fprintf (adapt_stream, "\r"); - expect_prompt (); - return(0); /* Success */ - } else { - fprintf_filtered(stderr, - "Too many break points, break point not installed\n"); - return(1); /* Failure */ - } - -} -static int -adapt_remove_breakpoint(addr, save) -CORE_ADDR addr; -char *save; /* Throw away, let adapt save instructions */ -{ - if (num_brkpts > 0) { - num_brkpts--; - fprintf (adapt_stream, "BR %x", addr); - fprintf (adapt_stream, "\r"); - fflush (adapt_stream); - expect_prompt (); - } - return(0); -} - -/* Clear the adapts notion of what the break points are */ -static int -adapt_clear_breakpoints() -{ - if (adapt_stream) { - fprintf (adapt_stream, "BR"); /* Clear all break points */ - fprintf (adapt_stream, "\r"); - fflush(adapt_stream); - expect_prompt (); - } - num_brkpts = 0; -} -static void -adapt_mourn() -{ - adapt_clear_breakpoints(); - pop_target (); /* Pop back to no-child state */ - generic_mourn_inferior (); -} - -/* Display everthing we read in from the adapt until we match/see the - * specified string - */ -static int -display_until(str) -char *str; -{ - int i=0,j,c; - - while (c=readchar()) { - if (c==str[i]) { - i++; - if (i == strlen(str)) return; - } else { - if (i) { - for (j=0 ; j", class_obscure, adapt_com, - "Send a command to the AMD Adapt remote monitor."); -} diff --git a/contrib/gdb/gdb/remote-array.c b/contrib/gdb/gdb/remote-array.c deleted file mode 100644 index 0ed84ca..0000000 --- a/contrib/gdb/gdb/remote-array.c +++ /dev/null @@ -1,1465 +0,0 @@ -/* Remote debugging interface for Array Tech RAID controller.. - Copyright 90, 91, 92, 93, 94, 1995 Free Software Foundation, Inc. - Contributed by Cygnus Support. Written by Rob Savoye for Cygnus. - - This module talks to a debug monitor called 'MONITOR', which - We communicate with MONITOR via either a direct serial line, or a TCP - (or possibly TELNET) stream to a terminal multiplexor, - which in turn talks to the target board. - - 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 "target.h" -#include "wait.h" -#ifdef ANSI_PROTOTYPES -#include -#else -#include -#endif -#include -#include -#include "gdb_string.h" -#include "command.h" -#include "serial.h" -#include "monitor.h" -#include "remote-utils.h" - -extern int baud_rate; - -#define ARRAY_PROMPT ">> " - -#define SWAP_TARGET_AND_HOST(buffer,len) \ - do \ - { \ - if (TARGET_BYTE_ORDER != HOST_BYTE_ORDER) \ - { \ - char tmp; \ - char *p = (char *)(buffer); \ - char *q = ((char *)(buffer)) + len - 1; \ - for (; p < q; p++, q--) \ - { \ - tmp = *q; \ - *q = *p; \ - *p = tmp; \ - } \ - } \ - } \ - while (0) - -static void debuglogs PARAMS((int, char *, ...)); -static void array_open(); -static void array_close(); -static void array_detach(); -static void array_attach(); -static void array_resume(); -static void array_fetch_register(); -static void array_store_register(); -static void array_fetch_registers(); -static void array_store_registers(); -static void array_prepare_to_store(); -static void array_files_info(); -static void array_kill(); -static void array_create_inferior(); -static void array_mourn_inferior(); -static void make_gdb_packet(); -static int array_xfer_memory(); -static int array_wait(); -static int array_insert_breakpoint(); -static int array_remove_breakpoint(); -static int tohex(); -static int to_hex(); -static int from_hex(); -static int array_send_packet(); -static int array_get_packet(); -static unsigned long ascii2hexword(); -static char *hexword2ascii(); - -extern char *version; - -#define LOG_FILE "monitor.log" -#if defined (LOG_FILE) -FILE *log_file; -#endif - -static int timeout = 30; -/* Having this larger than 400 causes us to be incompatible with m68k-stub.c - and i386-stub.c. Normally, no one would notice because it only matters - for writing large chunks of memory (e.g. in downloads). Also, this needs - to be more than 400 if required to hold the registers (see below, where - we round it up based on REGISTER_BYTES). */ -#define PBUFSIZ 400 - -/* - * Descriptor for I/O to remote machine. Initialize it to NULL so that - * array_open knows that we don't have a file open when the program starts. - */ -serial_t array_desc = NULL; - -/* - * this array of registers need to match the indexes used by GDB. The - * whole reason this exists is cause the various ROM monitors use - * different strings than GDB does, and doesn't support all the - * registers either. So, typing "info reg sp" becomes a "r30". - */ -extern char *tmp_mips_processor_type; -extern int mips_set_processor_type(); - -static struct target_ops array_ops = { - "array", /* to_shortname */ - /* to_longname */ - "Debug using the standard GDB remote protocol for the Array Tech target.", - /* to_doc */ - "Debug using the standard GDB remote protocol for the Array Tech target.\n\ -Specify the serial device it is connected to (e.g. /dev/ttya).", - array_open, /* to_open */ - array_close, /* to_close */ - NULL, /* to_attach */ - array_detach, /* to_detach */ - array_resume, /* to_resume */ - array_wait, /* to_wait */ - array_fetch_registers, /* to_fetch_registers */ - array_store_registers, /* to_store_registers */ - array_prepare_to_store, /* to_prepare_to_store */ - array_xfer_memory, /* to_xfer_memory */ - array_files_info, /* to_files_info */ - array_insert_breakpoint, /* to_insert_breakpoint */ - array_remove_breakpoint, /* to_remove_breakpoint */ - 0, /* to_terminal_init */ - 0, /* to_terminal_inferior */ - 0, /* to_terminal_ours_for_output */ - 0, /* to_terminal_ours */ - 0, /* to_terminal_info */ - array_kill, /* to_kill */ - 0, /* to_load */ - 0, /* to_lookup_symbol */ - array_create_inferior, /* to_create_inferior */ - array_mourn_inferior, /* to_mourn_inferior */ - 0, /* to_can_run */ - 0, /* to_notice_signals */ - 0, /* to_thread_alive */ - 0, /* to_stop */ - process_stratum, /* to_stratum */ - 0, /* to_next */ - 1, /* to_has_all_memory */ - 1, /* to_has_memory */ - 1, /* to_has_stack */ - 1, /* to_has_registers */ - 1, /* to_has_execution */ - 0, /* sections */ - 0, /* sections_end */ - OPS_MAGIC /* to_magic */ -}; - -/* - * printf_monitor -- send data to monitor. Works just like printf. - */ -static void -#ifdef ANSI_PROTOTYPES -printf_monitor(char *pattern, ...) -#else -printf_monitor(va_alist) - va_dcl -#endif -{ - va_list args; - char buf[PBUFSIZ]; - int i; - -#ifdef ANSI_PROTOTYPES - va_start(args, pattern); -#else - char *pattern; - va_start(args); - pattern = va_arg(args, char *); -#endif - - vsprintf(buf, pattern, args); - - debuglogs (1, "printf_monitor(), Sending: \"%s\".", buf); - - if (strlen(buf) > PBUFSIZ) - error ("printf_monitor(): string too long"); - if (SERIAL_WRITE(array_desc, buf, strlen(buf))) - fprintf(stderr, "SERIAL_WRITE failed: %s\n", safe_strerror(errno)); -} -/* - * write_monitor -- send raw data to monitor. - */ -static void -write_monitor(data, len) - char data[]; - int len; -{ - if (SERIAL_WRITE(array_desc, data, len)) - fprintf(stderr, "SERIAL_WRITE failed: %s\n", safe_strerror(errno)); - - *(data + len+1) = '\0'; - debuglogs (1, "write_monitor(), Sending: \"%s\".", data); - -} - -/* - * debuglogs -- deal with debugging info to multiple sources. This takes - * two real args, the first one is the level to be compared against - * the sr_get_debug() value, the second arg is a printf buffer and args - * to be formatted and printed. A CR is added after each string is printed. - */ -static void -#ifdef ANSI_PROTOTYPES -debuglogs(int level, char *pattern, ...) -#else -debuglogs(va_alist) - va_dcl -#endif -{ - va_list args; - char *p; - unsigned char buf[PBUFSIZ]; - char newbuf[PBUFSIZ]; - int i; - -#ifdef ANSI_PROTOTYPES - va_start(args, pattern); -#else - char *pattern; - int level; - va_start(args); - level = va_arg(args, int); /* get the debug level */ - pattern = va_arg(args, char *); /* get the printf style pattern */ -#endif - - if ((level <0) || (level > 100)) { - error ("Bad argument passed to debuglogs(), needs debug level"); - return; - } - - vsprintf(buf, pattern, args); /* format the string */ - - /* convert some characters so it'll look right in the log */ - p = newbuf; - for (i = 0 ; buf[i] != '\0'; i++) { - if (i > PBUFSIZ) - error ("Debug message too long"); - switch (buf[i]) { - case '\n': /* newlines */ - *p++ = '\\'; - *p++ = 'n'; - continue; - case '\r': /* carriage returns */ - *p++ = '\\'; - *p++ = 'r'; - continue; - case '\033': /* escape */ - *p++ = '\\'; - *p++ = 'e'; - continue; - case '\t': /* tab */ - *p++ = '\\'; - *p++ = 't'; - continue; - case '\b': /* backspace */ - *p++ = '\\'; - *p++ = 'b'; - continue; - default: /* no change */ - *p++ = buf[i]; - } - - if (buf[i] < 26) { /* modify control characters */ - *p++ = '^'; - *p++ = buf[i] + 'A'; - continue; - } - if (buf[i] >= 128) { /* modify control characters */ - *p++ = '!'; - *p++ = buf[i] + 'A'; - continue; - } - } - *p = '\0'; /* terminate the string */ - - if (sr_get_debug() > level) - printf_unfiltered ("%s\n", newbuf); - -#ifdef LOG_FILE /* write to the monitor log */ - if (log_file != 0x0) { - fputs (newbuf, log_file); - fputc ('\n', log_file); - fflush (log_file); - } -#endif -} - -/* readchar -- read a character from the remote system, doing all the fancy - * timeout stuff. - */ -static int -readchar(timeout) - int timeout; -{ - int c; - - c = SERIAL_READCHAR(array_desc, abs(timeout)); - - if (sr_get_debug() > 5) { - putchar(c & 0x7f); - debuglogs (5, "readchar: timeout = %d\n", timeout); - } - -#ifdef LOG_FILE - if (isascii (c)) - putc(c & 0x7f, log_file); -#endif - - if (c >= 0) - return c & 0x7f; - - if (c == SERIAL_TIMEOUT) { - if (timeout <= 0) - return c; /* Polls shouldn't generate timeout errors */ - error("Timeout reading from remote system."); -#ifdef LOG_FILE - fputs ("ERROR: Timeout reading from remote system", log_file); -#endif - } - perror_with_name("readchar"); -} - -/* - * expect -- scan input from the remote system, until STRING is found. - * If DISCARD is non-zero, then discard non-matching input, else print - * it out. Let the user break out immediately. - */ -static void -expect (string, discard) - char *string; - int discard; -{ - char *p = string; - int c; - - - debuglogs (1, "Expecting \"%s\".", string); - - immediate_quit = 1; - while (1) { - c = readchar(timeout); - if (!isascii (c)) - continue; - if (c == *p++) { - if (*p == '\0') { - immediate_quit = 0; - debuglogs (4, "Matched"); - return; - } - } else { - if (!discard) { - fputc_unfiltered (c, gdb_stdout); - } - p = string; - } - } -} - -/* Keep discarding input until we see the MONITOR array_cmds->prompt. - - The convention for dealing with the expect_prompt is that you - o give your command - o *then* wait for the expect_prompt. - - Thus the last thing that a procedure does with the serial line - will be an expect_prompt(). Exception: array_resume does not - wait for the expect_prompt, because the terminal is being handed over - to the inferior. However, the next thing which happens after that - is a array_wait which does wait for the expect_prompt. - Note that this includes abnormal exit, e.g. error(). This is - necessary to prevent getting into states from which we can't - recover. */ -static void -expect_prompt(discard) - int discard; -{ - expect (ARRAY_PROMPT, discard); -} - -/* - * junk -- ignore junk characters. Returns a 1 if junk, 0 otherwise - */ -static int -junk(ch) - char ch; -{ - switch (ch) { - case '\0': - case ' ': - case '-': - case '\t': - case '\r': - case '\n': - if (sr_get_debug() > 5) - debuglogs (5, "Ignoring \'%c\'.", ch); - return 1; - default: - if (sr_get_debug() > 5) - debuglogs (5, "Accepting \'%c\'.", ch); - return 0; - } -} - -/* - * get_hex_digit -- Get a hex digit from the remote system & return its value. - * If ignore is nonzero, ignore spaces, newline & tabs. - */ -static int -get_hex_digit(ignore) - int ignore; -{ - static int ch; - while (1) { - ch = readchar(timeout); - if (junk(ch)) - continue; - if (sr_get_debug() > 4) { - debuglogs (4, "get_hex_digit() got a 0x%x(%c)", ch, ch); - } else { -#ifdef LOG_FILE /* write to the monitor log */ - if (log_file != 0x0) { - fputs ("get_hex_digit() got a 0x", log_file); - fputc (ch, log_file); - fputc ('\n', log_file); - fflush (log_file); - } -#endif - } - - if (ch >= '0' && ch <= '9') - return ch - '0'; - else if (ch >= 'A' && ch <= 'F') - return ch - 'A' + 10; - else if (ch >= 'a' && ch <= 'f') - return ch - 'a' + 10; - else if (ch == ' ' && ignore) - ; - else { - expect_prompt(1); - debuglogs (4, "Invalid hex digit from remote system. (0x%x)", ch); - error("Invalid hex digit from remote system. (0x%x)", ch); - } - } -} - -/* get_hex_byte -- Get a byte from monitor and put it in *BYT. - * Accept any number leading spaces. - */ -static void -get_hex_byte (byt) - char *byt; -{ - int val; - - val = get_hex_digit (1) << 4; - debuglogs (4, "get_hex_byte() -- Read first nibble 0x%x", val); - - val |= get_hex_digit (0); - debuglogs (4, "get_hex_byte() -- Read second nibble 0x%x", val); - *byt = val; - - debuglogs (4, "get_hex_byte() -- Read a 0x%x", val); -} - -/* - * get_hex_word -- Get N 32-bit words from remote, each preceded by a space, - * and put them in registers starting at REGNO. - */ -static int -get_hex_word () -{ - long val, newval; - int i; - - val = 0; - -#if 0 - if (HOST_BYTE_ORDER == BIG_ENDIAN) { -#endif - for (i = 0; i < 8; i++) - val = (val << 4) + get_hex_digit (i == 0); -#if 0 - } else { - for (i = 7; i >= 0; i--) - val = (val << 4) + get_hex_digit (i == 0); - } -#endif - - debuglogs (4, "get_hex_word() got a 0x%x for a %s host.", val, (HOST_BYTE_ORDER == BIG_ENDIAN) ? "big endian" : "little endian"); - - return val; -} - -/* This is called not only when we first attach, but also when the - user types "run" after having attached. */ -static void -array_create_inferior (execfile, args, env) - char *execfile; - char *args; - char **env; -{ - int entry_pt; - - if (args && *args) - error("Can't pass arguments to remote MONITOR process"); - - if (execfile == 0 || exec_bfd == 0) - error("No exec file specified"); - - entry_pt = (int) bfd_get_start_address (exec_bfd); - -/* The "process" (board) is already stopped awaiting our commands, and - the program is already downloaded. We just set its PC and go. */ - - clear_proceed_status (); - - /* Tell wait_for_inferior that we've started a new process. */ - init_wait_for_inferior (); - - /* Set up the "saved terminal modes" of the inferior - based on what modes we are starting it with. */ - target_terminal_init (); - - /* Install inferior's terminal modes. */ - target_terminal_inferior (); - - /* insert_step_breakpoint (); FIXME, do we need this? */ - - /* Let 'er rip... */ - proceed ((CORE_ADDR)entry_pt, TARGET_SIGNAL_DEFAULT, 0); -} - -/* - * array_open -- open a connection to a remote debugger. - * NAME is the filename used for communication. - */ -static int baudrate = 9600; -static char dev_name[100]; - -static void -array_open(args, name, from_tty) - char *args; - char *name; - int from_tty; -{ - char packet[PBUFSIZ]; - - if (args == NULL) - error ("Use `target %s DEVICE-NAME' to use a serial port, or \n\ -`target %s HOST-NAME:PORT-NUMBER' to use a network connection.", name, name); - -/* if (is_open) */ - array_close(0); - - target_preopen (from_tty); - unpush_target (&array_ops); - - tmp_mips_processor_type = "lsi33k"; /* change the default from r3051 */ - mips_set_processor_type_command ("lsi33k", 0); - - strcpy(dev_name, args); - array_desc = SERIAL_OPEN(dev_name); - - if (array_desc == NULL) - perror_with_name(dev_name); - - if (baud_rate != -1) { - if (SERIAL_SETBAUDRATE (array_desc, baud_rate)) { - SERIAL_CLOSE (array_desc); - perror_with_name (name); - } - } - - SERIAL_RAW(array_desc); - -#if defined (LOG_FILE) - log_file = fopen (LOG_FILE, "w"); - if (log_file == NULL) - perror_with_name (LOG_FILE); - fprintf_filtered (log_file, "GDB %s (%s", version); - fprintf_filtered (log_file, " --target %s)\n", array_ops.to_shortname); - fprintf_filtered (log_file, "Remote target %s connected to %s\n\n", array_ops.to_shortname, dev_name); -#endif - - /* see if the target is alive. For a ROM monitor, we can just try to force the - expect_prompt to print a few times. For the GDB remote protocol, the application - being debugged is sitting at a breakpoint and waiting for GDB to initialize - the connection. We force it to give us an empty packet to see if it's alive. - */ - debuglogs (3, "Trying to ACK the target's debug stub"); - /* unless your are on the new hardware, the old board won't initialize - because the '@' doesn't flush output like it does on the new ROMS. - */ - printf_monitor ("@"); /* ask for the last signal */ - expect_prompt(1); /* See if we get a expect_prompt */ -#ifdef TEST_ARRAY /* skip packet for testing */ - make_gdb_packet (packet, "?"); /* ask for a bogus packet */ - if (array_send_packet (packet) == 0) - error ("Couldn't transmit packet\n"); - printf_monitor ("@\n"); /* force it to flush stdout */ - expect_prompt(1); /* See if we get a expect_prompt */ -#endif - push_target (&array_ops); - if (from_tty) - printf("Remote target %s connected to %s\n", array_ops.to_shortname, dev_name); -} - -/* - * array_close -- Close out all files and local state before this - * target loses control. - */ - -static void -array_close (quitting) - int quitting; -{ - SERIAL_CLOSE(array_desc); - array_desc = NULL; - - debuglogs (1, "array_close (quitting=%d)", quitting); - -#if defined (LOG_FILE) - if (log_file) { - if (ferror(log_file)) - printf_filtered ("Error writing log file.\n"); - if (fclose(log_file) != 0) - printf_filtered ("Error closing log file.\n"); - } -#endif -} - -/* - * array_detach -- terminate the open connection to the remote - * debugger. Use this when you want to detach and do something - * else with your gdb. - */ -static void -array_detach (from_tty) - int from_tty; -{ - - debuglogs (1, "array_detach ()"); - - pop_target(); /* calls array_close to do the real work */ - if (from_tty) - printf ("Ending remote %s debugging\n", target_shortname); -} - -/* - * array_attach -- attach GDB to the target. - */ -static void -array_attach (args, from_tty) - char *args; - int from_tty; -{ - if (from_tty) - printf ("Starting remote %s debugging\n", target_shortname); - - debuglogs (1, "array_attach (args=%s)", args); - - printf_monitor ("go %x\n"); - /* swallow the echo. */ - expect ("go %x\n", 1); -} - -/* - * array_resume -- Tell the remote machine to resume. - */ -static void -array_resume (pid, step, sig) - int pid, step; - enum target_signal sig; -{ - debuglogs (1, "array_resume (step=%d, sig=%d)", step, sig); - - if (step) { - printf_monitor ("s\n"); - } else { - printf_monitor ("go\n"); - } -} - -#define TMPBUFSIZ 5 - -/* - * array_wait -- Wait until the remote machine stops, then return, - * storing status in status just as `wait' would. - */ -static int -array_wait (pid, status) - int pid; - struct target_waitstatus *status; -{ - int old_timeout = timeout; - int result, i; - char c; - serial_t tty_desc; - serial_ttystate ttystate; - - debuglogs(1, "array_wait (), printing extraneous text."); - - status->kind = TARGET_WAITKIND_EXITED; - status->value.integer = 0; - - timeout = 0; /* Don't time out -- user program is running. */ - -#if !defined(__GO32__) && !defined(__MSDOS__) && !defined(__WIN32__) - tty_desc = SERIAL_FDOPEN (0); - ttystate = SERIAL_GET_TTY_STATE (tty_desc); - SERIAL_RAW (tty_desc); - - i = 0; - /* poll on the serial port and the keyboard. */ - while (1) { - c = readchar(timeout); - if (c > 0) { - if (c == *(ARRAY_PROMPT + i)) { - if (++i >= strlen (ARRAY_PROMPT)) { /* matched the prompt */ - debuglogs (4, "array_wait(), got the expect_prompt."); - break; - } - } else { /* not the prompt */ - i = 0; - } - fputc_unfiltered (c, gdb_stdout); - fflush (stdout); - } - c = SERIAL_READCHAR(tty_desc, timeout); - if (c > 0) { - SERIAL_WRITE(array_desc, &c, 1); - /* do this so it looks like there's keyboard echo */ - if (c == 3) /* exit on Control-C */ - break; -#if 0 - fputc_unfiltered (c, gdb_stdout); - fflush (stdout); -#endif - } - } - SERIAL_SET_TTY_STATE (tty_desc, ttystate); -#else - expect_prompt(1); - debuglogs (4, "array_wait(), got the expect_prompt."); -#endif - - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_TRAP; - - timeout = old_timeout; - - return 0; -} - -/* - * array_fetch_registers -- read the remote registers into the - * block regs. - */ -static void -array_fetch_registers (ignored) - int ignored; -{ - int regno, i; - char *p; - unsigned char packet[PBUFSIZ]; - char regs[REGISTER_BYTES]; - - debuglogs (1, "array_fetch_registers (ignored=%d)\n", ignored); - - memset (packet, 0, PBUFSIZ); - /* Unimplemented registers read as all bits zero. */ - memset (regs, 0, REGISTER_BYTES); - make_gdb_packet (packet, "g"); - if (array_send_packet (packet) == 0) - error ("Couldn't transmit packet\n"); - if (array_get_packet (packet) == 0) - error ("Couldn't receive packet\n"); - /* FIXME: read bytes from packet */ - debuglogs (4, "array_fetch_registers: Got a \"%s\" back\n", packet); - for (regno = 0; regno <= PC_REGNUM+4; regno++) { - /* supply register stores in target byte order, so swap here */ - /* FIXME: convert from ASCII hex to raw bytes */ - i = ascii2hexword (packet + (regno * 8)); - debuglogs (5, "Adding register %d = %x\n", regno, i); - SWAP_TARGET_AND_HOST (&i, 4); - supply_register (regno, (char *)&i); - } -} - -/* - * This is unused by targets like this one that use a - * protocol based on GDB's remote protocol. - */ -static void -array_fetch_register (ignored) - int ignored; -{ - array_fetch_registers (); -} - -/* - * Get all the registers from the targets. They come back in a large array. - */ -static void -array_store_registers (ignored) - int ignored; -{ - int regno; - unsigned long i; - char packet[PBUFSIZ]; - char buf[PBUFSIZ]; - char num[9]; - - debuglogs (1, "array_store_registers()"); - - memset (packet, 0, PBUFSIZ); - memset (buf, 0, PBUFSIZ); - buf[0] = 'G'; - - /* Unimplemented registers read as all bits zero. */ - /* FIXME: read bytes from packet */ - for (regno = 0; regno < 41; regno++) { /* FIXME */ - /* supply register stores in target byte order, so swap here */ - /* FIXME: convert from ASCII hex to raw bytes */ - i = (unsigned long)read_register (regno); - hexword2ascii (num, i); - strcpy (buf+(regno * 8)+1, num); - } - *(buf + (regno * 8) + 2) = 0; - make_gdb_packet (packet, buf); - if (array_send_packet (packet) == 0) - error ("Couldn't transmit packet\n"); - if (array_get_packet (packet) == 0) - error ("Couldn't receive packet\n"); - - registers_changed (); -} - -/* - * This is unused by targets like this one that use a - * protocol based on GDB's remote protocol. - */ -static void -array_store_register (ignored) - int ignored; -{ - array_store_registers (); -} - -/* Get ready to modify the registers array. On machines which store - individual registers, this doesn't need to do anything. On machines - which store all the registers in one fell swoop, this makes sure - that registers contains all the registers from the program being - debugged. */ - -static void -array_prepare_to_store () -{ - /* Do nothing, since we can store individual regs */ -} - -static void -array_files_info () -{ - printf ("\tAttached to %s at %d baud.\n", - dev_name, baudrate); -} - -/* - * array_write_inferior_memory -- Copy LEN bytes of data from debugger - * memory at MYADDR to inferior's memory at MEMADDR. Returns length moved. - */ -static int -array_write_inferior_memory (memaddr, myaddr, len) - CORE_ADDR memaddr; - unsigned char *myaddr; - int len; -{ - unsigned long i; - int j; - char packet[PBUFSIZ]; - char buf[PBUFSIZ]; - char num[9]; - char *p; - - debuglogs (1, "array_write_inferior_memory (memaddr=0x%x, myaddr=0x%x, len=%d)", memaddr, myaddr, len); - memset (buf, '\0', PBUFSIZ); /* this also sets the string terminator */ - p = buf; - - *p++ = 'M'; /* The command to write memory */ - hexword2ascii (num, memaddr); /* convert the address */ - strcpy (p, num); /* copy the address */ - p += 8; - *p++ = ','; /* add comma delimeter */ - hexword2ascii (num, len); /* Get the length as a 4 digit number */ - *p++ = num[4]; - *p++ = num[5]; - *p++ = num[6]; - *p++ = num[7]; - *p++ = ':'; /* add the colon delimeter */ - for (j = 0; j < len; j++) { /* copy the data in after converting it */ - *p++ = tohex ((myaddr[j] >> 4) & 0xf); - *p++ = tohex (myaddr[j] & 0xf); - } - - make_gdb_packet (packet, buf); - if (array_send_packet (packet) == 0) - error ("Couldn't transmit packet\n"); - if (array_get_packet (packet) == 0) - error ("Couldn't receive packet\n"); - - return len; -} - -/* - * array_read_inferior_memory -- read LEN bytes from inferior memory - * at MEMADDR. Put the result at debugger address MYADDR. Returns - * length moved. - */ -static int -array_read_inferior_memory(memaddr, myaddr, len) - CORE_ADDR memaddr; - char *myaddr; - int len; -{ - int j; - char buf[20]; - char packet[PBUFSIZ]; - int count; /* Number of bytes read so far. */ - unsigned long startaddr; /* Starting address of this pass. */ - int len_this_pass; /* Number of bytes to read in this pass. */ - - debuglogs (1, "array_read_inferior_memory (memaddr=0x%x, myaddr=0x%x, len=%d)", memaddr, myaddr, len); - - /* Note that this code works correctly if startaddr is just less - than UINT_MAX (well, really CORE_ADDR_MAX if there was such a - thing). That is, something like - array_read_bytes (CORE_ADDR_MAX - 4, foo, 4) - works--it never adds len To memaddr and gets 0. */ - /* However, something like - array_read_bytes (CORE_ADDR_MAX - 3, foo, 4) - doesn't need to work. Detect it and give up if there's an attempt - to do that. */ - if (((memaddr - 1) + len) < memaddr) { - errno = EIO; - return 0; - } - - for (count = 0, startaddr = memaddr; count < len; startaddr += len_this_pass) - { - /* Try to align to 16 byte boundry (why?) */ - len_this_pass = 16; - if ((startaddr % 16) != 0) - { - len_this_pass -= startaddr % 16; - } - /* Only transfer bytes we need */ - if (len_this_pass > (len - count)) - { - len_this_pass = (len - count); - } - /* Fetch the bytes */ - debuglogs (3, "read %d bytes from inferior address %x", len_this_pass, - startaddr); - sprintf (buf, "m%08x,%04x", startaddr, len_this_pass); - make_gdb_packet (packet, buf); - if (array_send_packet (packet) == 0) - { - error ("Couldn't transmit packet\n"); - } - if (array_get_packet (packet) == 0) - { - error ("Couldn't receive packet\n"); - } - if (*packet == 0) - { - error ("Got no data in the GDB packet\n"); - } - /* Pick packet apart and xfer bytes to myaddr */ - debuglogs (4, "array_read_inferior_memory: Got a \"%s\" back\n", packet); - for (j = 0; j < len_this_pass ; j++) - { - /* extract the byte values */ - myaddr[count++] = from_hex (*(packet+(j*2))) * 16 + from_hex (*(packet+(j*2)+1)); - debuglogs (5, "myaddr[%d] set to %x\n", count-1, myaddr[count-1]); - } - } - return (count); -} - -/* FIXME-someday! merge these two. */ -static int -array_xfer_memory (memaddr, myaddr, len, write, target) - CORE_ADDR memaddr; - char *myaddr; - int len; - int write; - struct target_ops *target; /* ignored */ -{ - if (write) - return array_write_inferior_memory (memaddr, myaddr, len); - else - return array_read_inferior_memory (memaddr, myaddr, len); -} - -static void -array_kill (args, from_tty) - char *args; - int from_tty; -{ - return; /* ignore attempts to kill target system */ -} - -/* Clean up when a program exits. - The program actually lives on in the remote processor's RAM, and may be - run again without a download. Don't leave it full of breakpoint - instructions. */ - -static void -array_mourn_inferior () -{ - remove_breakpoints (); - generic_mourn_inferior (); /* Do all the proper things now */ -} - -#define MAX_ARRAY_BREAKPOINTS 16 - -extern int memory_breakpoint_size; -static CORE_ADDR breakaddr[MAX_ARRAY_BREAKPOINTS] = {0}; - -/* - * array_insert_breakpoint -- add a breakpoint - */ -static int -array_insert_breakpoint (addr, shadow) - CORE_ADDR addr; - char *shadow; -{ - int i; - - debuglogs (1, "array_insert_breakpoint() addr = 0x%x", addr); - - for (i = 0; i <= MAX_ARRAY_BREAKPOINTS; i++) { - if (breakaddr[i] == 0) { - breakaddr[i] = addr; - if (sr_get_debug() > 4) - printf ("Breakpoint at %x\n", addr); - array_read_inferior_memory(addr, shadow, memory_breakpoint_size); - printf_monitor("b 0x%x\n", addr); - expect_prompt(1); - return 0; - } - } - - fprintf(stderr, "Too many breakpoints (> 16) for monitor\n"); - return 1; -} - -/* - * _remove_breakpoint -- Tell the monitor to remove a breakpoint - */ -static int -array_remove_breakpoint (addr, shadow) - CORE_ADDR addr; - char *shadow; -{ - int i; - - debuglogs (1, "array_remove_breakpoint() addr = 0x%x", addr); - - for (i = 0; i < MAX_ARRAY_BREAKPOINTS; i++) { - if (breakaddr[i] == addr) { - breakaddr[i] = 0; - /* some monitors remove breakpoints based on the address */ - printf_monitor("bd %x\n", i); - expect_prompt(1); - return 0; - } - } - fprintf(stderr, "Can't find breakpoint associated with 0x%x\n", addr); - return 1; -} - -static void -array_stop () -{ - debuglogs (1, "array_stop()"); - printf_monitor("\003"); - expect_prompt(1); -} - -/* - * array_command -- put a command string, in args, out to MONITOR. - * Output from MONITOR is placed on the users terminal until the - * expect_prompt is seen. FIXME - */ -static void -monitor_command (args, fromtty) - char *args; - int fromtty; -{ - debuglogs (1, "monitor_command (args=%s)", args); - - if (array_desc == NULL) - error("monitor target not open."); - - if (!args) - error("Missing command."); - - printf_monitor ("%s\n", args); - expect_prompt(0); -} - -/* - * make_gdb_packet -- make a GDB packet. The data is always ASCII. - * A debug packet whose contents are - * is encapsulated for transmission in the form: - * - * $ # CSUM1 CSUM2 - * - * must be ASCII alphanumeric and cannot include characters - * '$' or '#'. If starts with two characters followed by - * ':', then the existing stubs interpret this as a sequence number. - * - * CSUM1 and CSUM2 are ascii hex representation of an 8-bit - * checksum of , the most significant nibble is sent first. - * the hex digits 0-9,a-f are used. - * - */ -static void -make_gdb_packet (buf, data) - char *buf, *data; -{ - int i; - unsigned char csum = 0; - int cnt; - char *p; - - debuglogs (3, "make_gdb_packet(%s)\n", data); - cnt = strlen (data); - if (cnt > PBUFSIZ) - error ("make_gdb_packet(): to much data\n"); - - /* start with the packet header */ - p = buf; - *p++ = '$'; - - /* calculate the checksum */ - for (i = 0; i < cnt; i++) { - csum += data[i]; - *p++ = data[i]; - } - - /* terminate the data with a '#' */ - *p++ = '#'; - - /* add the checksum as two ascii digits */ - *p++ = tohex ((csum >> 4) & 0xf); - *p++ = tohex (csum & 0xf); - *p = 0x0; /* Null terminator on string */ -} - -/* - * array_send_packet -- send a GDB packet to the target with error handling. We - * get a '+' (ACK) back if the packet is received and the checksum - * matches. Otherwise a '-' (NAK) is returned. It returns a 1 for a - * successful transmition, or a 0 for a failure. - */ -static int -array_send_packet (packet) - char *packet; -{ - int c, retries, i; - char junk[PBUFSIZ]; - - retries = 0; - -#if 0 - /* scan the packet to make sure it only contains valid characters. - this may sound silly, but sometimes a garbled packet will hang - the target board. We scan the whole thing, then print the error - message. - */ - for (i = 0; i < strlen(packet); i++) { - debuglogs (5, "array_send_packet(): Scanning \'%c\'\n", packet[i]); - /* legit hex numbers or command */ - if ((isxdigit(packet[i])) || (isalpha(packet[i]))) - continue; - switch (packet[i]) { - case '+': /* ACK */ - case '-': /* NAK */ - case '#': /* end of packet */ - case '$': /* start of packet */ - continue; - default: /* bogus character */ - retries++; - debuglogs (4, "array_send_packet(): Found a non-ascii digit \'%c\' in the packet.\n", packet[i]); - } - } -#endif - - if (retries > 0) - error ("Can't send packet, found %d non-ascii characters", retries); - - /* ok, try to send the packet */ - retries = 0; - while (retries++ <= 10) { - printf_monitor ("%s", packet); - - /* read until either a timeout occurs (-2) or '+' is read */ - while (retries <= 10) { - c = readchar (-timeout); - debuglogs (3, "Reading a GDB protocol packet... Got a '%c'\n", c); - switch (c) { - case '+': - debuglogs (3, "Got Ack\n"); - return 1; - case SERIAL_TIMEOUT: - debuglogs (3, "Timed out reading serial port\n"); - printf_monitor("@"); /* resync with the monitor */ - expect_prompt(1); /* See if we get a expect_prompt */ - break; /* Retransmit buffer */ - case '-': - debuglogs (3, "Got NAK\n"); - printf_monitor("@"); /* resync with the monitor */ - expect_prompt(1); /* See if we get a expect_prompt */ - break; - case '$': - /* it's probably an old response, or the echo of our command. - * just gobble up the packet and ignore it. - */ - debuglogs (3, "Got a junk packet\n"); - i = 0; - do { - c = readchar (timeout); - junk[i++] = c; - } while (c != '#'); - c = readchar (timeout); - junk[i++] = c; - c = readchar (timeout); - junk[i++] = c; - junk[i++] = '\0'; - debuglogs (3, "Reading a junk packet, got a \"%s\"\n", junk); - continue; /* Now, go look for next packet */ - default: - continue; - } - retries++; - debuglogs (3, "Retransmitting packet \"%s\"\n", packet); - break; /* Here to retransmit */ - } - } /* outer while */ - return 0; -} - -/* - * array_get_packet -- get a GDB packet from the target. Basically we read till we - * see a '#', then check the checksum. It returns a 1 if it's gotten a - * packet, or a 0 it the packet wasn't transmitted correctly. - */ -static int -array_get_packet (packet) - char *packet; -{ - int c; - int retries; - unsigned char csum; - unsigned char pktcsum; - char *bp; - - csum = 0; - bp = packet; - - memset (packet, 1, PBUFSIZ); - retries = 0; - while (retries <= 10) { - do { - c = readchar (timeout); - if (c == SERIAL_TIMEOUT) { - debuglogs (3, "array_get_packet: got time out from serial port.\n"); - } - debuglogs (3, "Waiting for a '$', got a %c\n", c); - } while (c != '$'); - - retries = 0; - while (retries <= 10) { - c = readchar (timeout); - debuglogs (3, "array_get_packet: got a '%c'\n", c); - switch (c) { - case SERIAL_TIMEOUT: - debuglogs (3, "Timeout in mid-packet, retrying\n"); - return 0; - case '$': - debuglogs (3, "Saw new packet start in middle of old one\n"); - return 0; /* Start a new packet, count retries */ - case '#': - *bp = '\0'; - pktcsum = from_hex (readchar (timeout)) << 4; - pktcsum |= from_hex (readchar (timeout)); - if (csum == 0) - debuglogs (3, "\nGDB packet checksum zero, must be a bogus packet\n"); - if (csum == pktcsum) { - debuglogs (3, "\nGDB packet checksum correct, packet data is \"%s\",\n", packet); - printf_monitor ("@"); - expect_prompt (1); - return 1; - } - debuglogs (3, "Bad checksum, sentsum=0x%x, csum=0x%x\n", pktcsum, csum); - return 0; - case '*': /* Run length encoding */ - debuglogs (5, "Run length encoding in packet\n"); - csum += c; - c = readchar (timeout); - csum += c; - c = c - ' ' + 3; /* Compute repeat count */ - - if (c > 0 && c < 255 && bp + c - 1 < packet + PBUFSIZ - 1) { - memset (bp, *(bp - 1), c); - bp += c; - continue; - } - *bp = '\0'; - printf_filtered ("Repeat count %d too large for buffer.\n", c); - return 0; - - default: - if ((!isxdigit(c)) && (!ispunct(c))) - debuglogs (4, "Got a non-ascii digit \'%c\'.\\n", c); - if (bp < packet + PBUFSIZ - 1) { - *bp++ = c; - csum += c; - continue; - } - - *bp = '\0'; - puts_filtered ("Remote packet too long.\n"); - return 0; - } - } - } -} - -/* - * ascii2hexword -- convert an ascii number represented by 8 digits to a hex value. - */ -static unsigned long -ascii2hexword (mem) - unsigned char *mem; -{ - unsigned long val; - int i; - char buf[9]; - - val = 0; - for (i = 0; i < 8; i++) { - val <<= 4; - if (mem[i] >= 'A' && mem[i] <= 'F') - val = val + mem[i] - 'A' + 10; - if (mem[i] >= 'a' && mem[i] <= 'f') - val = val + mem[i] - 'a' + 10; - if (mem[i] >= '0' && mem[i] <= '9') - val = val + mem[i] - '0'; - buf[i] = mem[i]; - } - buf[8] = '\0'; - debuglogs (4, "ascii2hexword() got a 0x%x from %s(%x).\n", val, buf, mem); - return val; -} - -/* - * ascii2hexword -- convert a hex value to an ascii number represented by 8 - * digits. - */ -static char* -hexword2ascii (mem, num) - unsigned char *mem; - unsigned long num; -{ - int i; - unsigned char ch; - - debuglogs (4, "hexword2ascii() converting %x ", num); - for (i = 7; i >= 0; i--) { - mem[i] = tohex ((num >> 4) & 0xf); - mem[i] = tohex (num & 0xf); - num = num >> 4; - } - mem[8] = '\0'; - debuglogs (4, "\tto a %s", mem); -} - -/* Convert hex digit A to a number. */ -static int -from_hex (a) - int a; -{ - if (a == 0) - return 0; - - debuglogs (4, "from_hex got a 0x%x(%c)\n",a,a); - if (a >= '0' && a <= '9') - return a - '0'; - if (a >= 'a' && a <= 'f') - return a - 'a' + 10; - if (a >= 'A' && a <= 'F') - return a - 'A' + 10; - else { - error ("Reply contains invalid hex digit 0x%x", a); - } -} - -/* Convert number NIB to a hex digit. */ -static int -tohex (nib) - int nib; -{ - if (nib < 10) - return '0'+nib; - else - return 'a'+nib-10; -} - -/* - * _initialize_remote_monitors -- setup a few addtitional commands that - * are usually only used by monitors. - */ -void -_initialize_remote_monitors () -{ - /* generic monitor command */ - add_com ("monitor", class_obscure, monitor_command, - "Send a command to the debug monitor."); - -} - -/* - * _initialize_array -- do any special init stuff for the target. - */ -void -_initialize_array () -{ - add_target (&array_ops); -} diff --git a/contrib/gdb/gdb/remote-bug.c b/contrib/gdb/gdb/remote-bug.c deleted file mode 100644 index cd3b798..0000000 --- a/contrib/gdb/gdb/remote-bug.c +++ /dev/null @@ -1,1053 +0,0 @@ -/* Remote debugging interface for Motorola's MVME187BUG monitor, an embedded - monitor for the m88k. - - Copyright 1992, 1993 Free Software Foundation, Inc. - Contributed by Cygnus Support. Written by K. Richard Pixley. - -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 "wait.h" - -#include "gdb_string.h" -#include -#include -#include -#include -#include - -#include "terminal.h" -#include "gdbcore.h" -#include "gdbcmd.h" - -#include "remote-utils.h" - -extern int sleep(); - -/* External data declarations */ -extern int stop_soon_quietly; /* for wait_for_inferior */ - -/* Forward data declarations */ -extern struct target_ops bug_ops; /* Forward declaration */ - -/* Forward function declarations */ -static int bug_clear_breakpoints PARAMS((void)); - -static int bug_read_memory PARAMS((CORE_ADDR memaddr, - unsigned char *myaddr, - int len)); - -static int bug_write_memory PARAMS((CORE_ADDR memaddr, - unsigned char *myaddr, - int len)); - -/* This variable is somewhat arbitrary. It's here so that it can be - set from within a running gdb. */ - -static int srec_max_retries = 3; - -/* Each S-record download to the target consists of an S0 header - record, some number of S3 data records, and one S7 termination - record. I call this download a "frame". Srec_frame says how many - bytes will be represented in each frame. */ - -#define SREC_SIZE 160 -static int srec_frame = SREC_SIZE; - -/* This variable determines how many bytes will be represented in each - S3 s-record. */ - -static int srec_bytes = 40; - -/* At one point it appeared to me as though the bug monitor could not - really be expected to receive two sequential characters at 9600 - baud reliably. Echo-pacing is an attempt to force data across the - line even in this condition. Specifically, in echo-pace mode, each - character is sent one at a time and we look for the echo before - sending the next. This is excruciatingly slow. */ - -static int srec_echo_pace = 0; - -/* How long to wait after an srec for a possible error message. - Similar to the above, I tried sleeping after sending each S3 record - in hopes that I might actually see error messages from the bug - monitor. This might actually work if we were to use sleep - intervals smaller than 1 second. */ - -static int srec_sleep = 0; - -/* Every srec_noise records, flub the checksum. This is a debugging - feature. Set the variable to something other than 1 in order to - inject *deliberate* checksum errors. One might do this if one - wanted to test error handling and recovery. */ - -static int srec_noise = 0; - -/* Called when SIGALRM signal sent due to alarm() timeout. */ - -/* Number of SIGTRAPs we need to simulate. That is, the next - NEED_ARTIFICIAL_TRAP calls to bug_wait should just return - SIGTRAP without actually waiting for anything. */ - -static int need_artificial_trap = 0; - -/* - * Download a file specified in 'args', to the bug. - */ - -static void -bug_load (args, fromtty) - char *args; - int fromtty; -{ - bfd *abfd; - asection *s; - char buffer[1024]; - - sr_check_open (); - - dcache_flush (gr_get_dcache()); - inferior_pid = 0; - abfd = bfd_openr (args, 0); - if (!abfd) - { - printf_filtered ("Unable to open file %s\n", args); - return; - } - - if (bfd_check_format (abfd, bfd_object) == 0) - { - printf_filtered ("File is not an object file\n"); - return; - } - - s = abfd->sections; - while (s != (asection *) NULL) - { - srec_frame = SREC_SIZE; - if (s->flags & SEC_LOAD) - { - int i; - - char *buffer = xmalloc (srec_frame); - - printf_filtered ("%s\t: 0x%4x .. 0x%4x ", s->name, s->vma, s->vma + s->_raw_size); - fflush (stdout); - for (i = 0; i < s->_raw_size; i += srec_frame) - { - if (srec_frame > s->_raw_size - i) - srec_frame = s->_raw_size - i; - - bfd_get_section_contents (abfd, s, buffer, i, srec_frame); - bug_write_memory (s->vma + i, buffer, srec_frame); - printf_filtered ("*"); - fflush (stdout); - } - printf_filtered ("\n"); - free (buffer); - } - s = s->next; - } - sprintf (buffer, "rs ip %lx", (unsigned long) abfd->start_address); - sr_write_cr (buffer); - gr_expect_prompt (); -} - -#if 0 -static char * -get_word (p) - char **p; -{ - char *s = *p; - char *word; - char *copy; - size_t len; - - while (isspace (*s)) - s++; - - word = s; - - len = 0; - - while (*s && !isspace (*s)) - { - s++; - len++; - - } - copy = xmalloc (len + 1); - memcpy (copy, word, len); - copy[len] = 0; - *p = s; - return copy; -} -#endif - -static struct gr_settings bug_settings = { - NULL, /* dcache */ - "Bug>", /* prompt */ - &bug_ops, /* ops */ - bug_clear_breakpoints, /* clear_all_breakpoints */ - bug_read_memory, /* readfunc */ - bug_write_memory, /* writefunc */ - gr_generic_checkin, /* checkin */ -}; - -static char *cpu_check_strings[] = { - "=", - "Invalid Register", -}; - -static void -bug_open (args, from_tty) - char *args; - int from_tty; -{ - if (args == NULL) - args = ""; - - gr_open(args, from_tty, &bug_settings); - /* decide *now* whether we are on an 88100 or an 88110 */ - sr_write_cr("rs cr06"); - sr_expect("rs cr06"); - - switch (gr_multi_scan(cpu_check_strings, 0)) - { - case 0: /* this is an m88100 */ - target_is_m88110 = 0; - break; - case 1: /* this is an m88110 */ - target_is_m88110 = 1; - break; - default: - abort(); - } -} - -/* Tell the remote machine to resume. */ - -void -bug_resume (pid, step, sig) - int pid, step; - enum target_signal sig; -{ - dcache_flush (gr_get_dcache()); - - if (step) - { - sr_write_cr("t"); - - /* Force the next bug_wait to return a trap. Not doing anything - about I/O from the target means that the user has to type - "continue" to see any. FIXME, this should be fixed. */ - need_artificial_trap = 1; - } - else - sr_write_cr ("g"); - - return; -} - -/* Wait until the remote machine stops, then return, - storing status in STATUS just as `wait' would. */ - -static char *wait_strings[] = { - "At Breakpoint", - "Exception: Data Access Fault (Local Bus Timeout)", - "\r8???-Bug>", - "\r197-Bug>", - NULL, -}; - -int -bug_wait (pid, status) - int pid; - struct target_waitstatus *status; -{ - int old_timeout = sr_get_timeout(); - int old_immediate_quit = immediate_quit; - - status->kind = TARGET_WAITKIND_EXITED; - status->value.integer = 0; - - /* read off leftovers from resume so that the rest can be passed - back out as stdout. */ - if (need_artificial_trap == 0) - { - sr_expect("Effective address: "); - (void) sr_get_hex_word(); - sr_expect ("\r\n"); - } - - sr_set_timeout(-1); /* Don't time out -- user program is running. */ - immediate_quit = 1; /* Helps ability to QUIT */ - - switch (gr_multi_scan(wait_strings, need_artificial_trap == 0)) - { - case 0: /* breakpoint case */ - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_TRAP; - /* user output from the target can be discarded here. (?) */ - gr_expect_prompt(); - break; - - case 1: /* bus error */ - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_BUS; - /* user output from the target can be discarded here. (?) */ - gr_expect_prompt(); - break; - - case 2: /* normal case */ - case 3: - if (need_artificial_trap != 0) - { - /* stepping */ - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_TRAP; - need_artificial_trap--; - break; - } - else - { - /* exit case */ - status->kind = TARGET_WAITKIND_EXITED; - status->value.integer = 0; - break; - } - - case -1: /* trouble */ - default: - fprintf_filtered (stderr, - "Trouble reading target during wait\n"); - break; - } - - sr_set_timeout(old_timeout); - immediate_quit = old_immediate_quit; - return 0; -} - -/* Return the name of register number REGNO - in the form input and output by bug. - - Returns a pointer to a static buffer containing the answer. */ -static char * -get_reg_name (regno) - int regno; -{ - static char *rn[] = { - "r00", "r01", "r02", "r03", "r04", "r05", "r06", "r07", - "r08", "r09", "r10", "r11", "r12", "r13", "r14", "r15", - "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", - "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", - - /* these get confusing because we omit a few and switch some ordering around. */ - - "cr01", /* 32 = psr */ - "fcr62", /* 33 = fpsr*/ - "fcr63", /* 34 = fpcr */ - "ip", /* this is something of a cheat. */ - /* 35 = sxip */ - "cr05", /* 36 = snip */ - "cr06", /* 37 = sfip */ - - "x00", "x01", "x02", "x03", "x04", "x05", "x06", "x07", - "x08", "x09", "x10", "x11", "x12", "x13", "x14", "x15", - "x16", "x17", "x18", "x19", "x20", "x21", "x22", "x23", - "x24", "x25", "x26", "x27", "x28", "x29", "x30", "x31", - }; - - return rn[regno]; -} - -#if 0 /* not currently used */ -/* Read from remote while the input matches STRING. Return zero on - success, -1 on failure. */ - -static int -bug_scan (s) - char *s; -{ - int c; - - while (*s) - { - c = sr_readchar(); - if (c != *s++) - { - fflush(stdout); - printf("\nNext character is '%c' - %d and s is \"%s\".\n", c, c, --s); - return(-1); - } - } - - return(0); -} -#endif /* never */ - -static int -bug_srec_write_cr (s) - char *s; -{ - char *p = s; - - if (srec_echo_pace) - for (p = s; *p; ++p) - { - if (sr_get_debug() > 0) - printf ("%c", *p); - - do - SERIAL_WRITE(sr_get_desc(), p, 1); - while (sr_pollchar() != *p); - } - else - { - sr_write_cr (s); -/* return(bug_scan (s) || bug_scan ("\n")); */ - } - - return(0); -} - -/* Store register REGNO, or all if REGNO == -1. */ - -static void -bug_fetch_register(regno) - int regno; -{ - sr_check_open(); - - if (regno == -1) - { - int i; - - for (i = 0; i < NUM_REGS; ++i) - bug_fetch_register(i); - } - else if (target_is_m88110 && regno == SFIP_REGNUM) - { - /* m88110 has no sfip. */ - long l = 0; - supply_register(regno, (char *) &l); - } - else if (regno < XFP_REGNUM) - { - char buffer[MAX_REGISTER_RAW_SIZE]; - - sr_write ("rs ", 3); - sr_write_cr (get_reg_name(regno)); - sr_expect ("="); - store_unsigned_integer (buffer, REGISTER_RAW_SIZE (regno), - sr_get_hex_word()); - gr_expect_prompt (); - supply_register (regno, buffer); - } - else - { - /* Float register so we need to parse a strange data format. */ - long p; - unsigned char fpreg_buf[10]; - - sr_write("rs ", 3); - sr_write(get_reg_name(regno), strlen(get_reg_name(regno))); - sr_write_cr(";d"); - sr_expect("rs"); - sr_expect(get_reg_name(regno)); - sr_expect(";d"); - sr_expect("="); - - /* sign */ - p = sr_get_hex_digit(1); - fpreg_buf[0] = p << 7; - - /* exponent */ - sr_expect("_"); - p = sr_get_hex_digit(1); - fpreg_buf[0] += (p << 4); - fpreg_buf[0] += sr_get_hex_digit(1); - - fpreg_buf[1] = sr_get_hex_digit(1) << 4; - - /* fraction */ - sr_expect("_"); - fpreg_buf[1] += sr_get_hex_digit(1); - - fpreg_buf[2] = (sr_get_hex_digit(1) << 4) + sr_get_hex_digit(1); - fpreg_buf[3] = (sr_get_hex_digit(1) << 4) + sr_get_hex_digit(1); - fpreg_buf[4] = (sr_get_hex_digit(1) << 4) + sr_get_hex_digit(1); - fpreg_buf[5] = (sr_get_hex_digit(1) << 4) + sr_get_hex_digit(1); - fpreg_buf[6] = (sr_get_hex_digit(1) << 4) + sr_get_hex_digit(1); - fpreg_buf[7] = (sr_get_hex_digit(1) << 4) + sr_get_hex_digit(1); - fpreg_buf[8] = 0; - fpreg_buf[9] = 0; - - gr_expect_prompt(); - supply_register(regno, fpreg_buf); - } - - return; -} - -/* Store register REGNO, or all if REGNO == -1. */ - -static void -bug_store_register (regno) - int regno; -{ - char buffer[1024]; - sr_check_open(); - - if (regno == -1) - { - int i; - - for (i = 0; i < NUM_REGS; ++i) - bug_store_register(i); - } - else - { - char *regname; - - regname = get_reg_name(regno); - - if (target_is_m88110 && regno == SFIP_REGNUM) - return; - else if (regno < XFP_REGNUM) - sprintf(buffer, "rs %s %08x", - regname, - read_register(regno)); - else - { - unsigned char *fpreg_buf = - (unsigned char *)®isters[REGISTER_BYTE(regno)]; - - sprintf(buffer, "rs %s %1x_%02x%1x_%1x%02x%02x%02x%02x%02x%02x;d", - regname, - /* sign */ - (fpreg_buf[0] >> 7) & 0xf, - /* exponent */ - fpreg_buf[0] & 0x7f, - (fpreg_buf[1] >> 8) & 0xf, - /* fraction */ - fpreg_buf[1] & 0xf, - fpreg_buf[2], - fpreg_buf[3], - fpreg_buf[4], - fpreg_buf[5], - fpreg_buf[6], - fpreg_buf[7]); - } - - sr_write_cr(buffer); - gr_expect_prompt(); - } - - return; -} - -int -bug_xfer_memory (memaddr, myaddr, len, write, target) - CORE_ADDR memaddr; - char *myaddr; - int len; - int write; - struct target_ops *target; /* ignored */ -{ - register int i; - - /* Round starting address down to longword boundary. */ - register CORE_ADDR addr; - - /* Round ending address up; get number of longwords that makes. */ - register int count; - - /* Allocate buffer of that many longwords. */ - register int *buffer; - - addr = memaddr & -sizeof (int); - count = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int); - - buffer = (int *) alloca (count * sizeof (int)); - - if (write) - { - /* Fill start and end extra bytes of buffer with existing memory data. */ - - if (addr != memaddr || len < (int) sizeof (int)) - { - /* Need part of initial word -- fetch it. */ - buffer[0] = gr_fetch_word (addr); - } - - if (count > 1) /* FIXME, avoid if even boundary */ - { - buffer[count - 1] - = gr_fetch_word (addr + (count - 1) * sizeof (int)); - } - - /* Copy data to be written over corresponding part of buffer */ - - memcpy ((char *) buffer + (memaddr & (sizeof (int) - 1)), myaddr, len); - - /* Write the entire buffer. */ - - for (i = 0; i < count; i++, addr += sizeof (int)) - { - errno = 0; - gr_store_word (addr, buffer[i]); - if (errno) - { - - return 0; - } - - } - } - else - { - /* Read all the longwords */ - for (i = 0; i < count; i++, addr += sizeof (int)) - { - errno = 0; - buffer[i] = gr_fetch_word (addr); - if (errno) - { - return 0; - } - QUIT; - } - - /* Copy appropriate bytes out of the buffer. */ - memcpy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len); - } - - return len; -} - -static void -start_load() -{ - char *command; - - command = (srec_echo_pace ? "lo 0 ;x" : "lo 0"); - - sr_write_cr (command); - sr_expect (command); - sr_expect ("\r\n"); - bug_srec_write_cr ("S0030000FC"); - return; -} - -/* This is an extremely vulnerable and fragile function. I've made - considerable attempts to make this deterministic, but I've - certainly forgotten something. The trouble is that S-records are - only a partial file format, not a protocol. Worse, apparently the - m88k bug monitor does not run in real time while receiving - S-records. Hence, we must pay excruciating attention to when and - where error messages are returned, and what has actually been sent. - - Each call represents a chunk of memory to be sent to the target. - We break that chunk into an S0 header record, some number of S3 - data records each containing srec_bytes, and an S7 termination - record. */ - -static char *srecord_strings[] = { - "S-RECORD", - "-Bug>", - NULL, -}; - -static int -bug_write_memory (memaddr, myaddr, len) - CORE_ADDR memaddr; - unsigned char *myaddr; - int len; -{ - int done; - int checksum; - int x; - int retries; - char *buffer = alloca ((srec_bytes + 8) << 1); - - retries = 0; - - do - { - done = 0; - - if (retries > srec_max_retries) - return(-1); - - if (retries > 0) - { - if (sr_get_debug() > 0) - printf("\n\n"); - - /* This gr_expect_prompt call is extremely important. Without - it, we will tend to resend our packet so fast that it - will arrive before the bug monitor is ready to receive - it. This would lead to a very ugly resend loop. */ - - gr_expect_prompt(); - } - - start_load(); - - while (done < len) - { - int thisgo; - int idx; - char *buf = buffer; - CORE_ADDR address; - - checksum = 0; - thisgo = len - done; - if (thisgo > srec_bytes) - thisgo = srec_bytes; - - address = memaddr + done; - sprintf (buf, "S3%02X%08X", thisgo + 4 + 1, address); - buf += 12; - - checksum += (thisgo + 4 + 1 - + (address & 0xff) - + ((address >> 8) & 0xff) - + ((address >> 16) & 0xff) - + ((address >> 24) & 0xff)); - - for (idx = 0; idx < thisgo; idx++) - { - sprintf (buf, "%02X", myaddr[idx + done]); - checksum += myaddr[idx + done]; - buf += 2; - } - - if (srec_noise > 0) - { - /* FIXME-NOW: insert a deliberate error every now and then. - This is intended for testing/debugging the error handling - stuff. */ - static int counter = 0; - if (++counter > srec_noise) - { - counter = 0; - ++checksum; - } - } - - sprintf(buf, "%02X", ~checksum & 0xff); - bug_srec_write_cr (buffer); - - if (srec_sleep != 0) - sleep(srec_sleep); - - /* This pollchar is probably redundant to the gr_multi_scan - below. Trouble is, we can't be sure when or where an - error message will appear. Apparently, when running at - full speed from a typical sun4, error messages tend to - appear to arrive only *after* the s7 record. */ - - if ((x = sr_pollchar()) != 0) - { - if (sr_get_debug() > 0) - printf("\n\n"); - - ++retries; - - /* flush any remaining input and verify that we are back - at the prompt level. */ - gr_expect_prompt(); - /* start all over again. */ - start_load(); - done = 0; - continue; - } - - done += thisgo; - } - - bug_srec_write_cr("S7060000000000F9"); - ++retries; - - /* Having finished the load, we need to figure out whether we - had any errors. */ - } while (gr_multi_scan(srecord_strings, 0) == 0);; - - return(0); -} - -/* Copy LEN bytes of data from debugger memory at MYADDR - to inferior's memory at MEMADDR. Returns errno value. - * sb/sh instructions don't work on unaligned addresses, when TU=1. - */ - -/* Read LEN bytes from inferior memory at MEMADDR. Put the result - at debugger address MYADDR. Returns errno value. */ -static int -bug_read_memory (memaddr, myaddr, len) - CORE_ADDR memaddr; - unsigned char *myaddr; - int len; -{ - char request[100]; - char *buffer; - char *p; - char type; - char size; - unsigned char c; - unsigned int inaddr; - unsigned int checksum; - - sprintf(request, "du 0 %x:&%d", memaddr, len); - sr_write_cr(request); - - p = buffer = alloca(len); - - /* scan up through the header */ - sr_expect("S0030000FC"); - - while (p < buffer + len) - { - /* scan off any white space. */ - while (sr_readchar() != 'S') ;; - - /* what kind of s-rec? */ - type = sr_readchar(); - - /* scan record size */ - sr_get_hex_byte(&size); - checksum = size; - --size; - inaddr = 0; - - switch (type) - { - case '7': - case '8': - case '9': - goto done; - - case '3': - sr_get_hex_byte(&c); - inaddr = (inaddr << 8) + c; - checksum += c; - --size; - /* intentional fall through */ - case '2': - sr_get_hex_byte(&c); - inaddr = (inaddr << 8) + c; - checksum += c; - --size; - /* intentional fall through */ - case '1': - sr_get_hex_byte(&c); - inaddr = (inaddr << 8) + c; - checksum += c; - --size; - sr_get_hex_byte(&c); - inaddr = (inaddr << 8) + c; - checksum += c; - --size; - break; - - default: - /* bonk */ - error("reading s-records."); - } - - if (inaddr < memaddr - || (memaddr + len) < (inaddr + size)) - error("srec out of memory range."); - - if (p != buffer + inaddr - memaddr) - error("srec out of sequence."); - - for (; size; --size, ++p) - { - sr_get_hex_byte(p); - checksum += *p; - } - - sr_get_hex_byte(&c); - if (c != (~checksum & 0xff)) - error("bad s-rec checksum"); - } - - done: - gr_expect_prompt(); - if (p != buffer + len) - return(1); - - memcpy(myaddr, buffer, len); - return(0); -} - -#define MAX_BREAKS 16 -static int num_brkpts = 0; -static int -bug_insert_breakpoint (addr, save) - CORE_ADDR addr; - char *save; /* Throw away, let bug save instructions */ -{ - sr_check_open (); - - if (num_brkpts < MAX_BREAKS) - { - char buffer[100]; - - num_brkpts++; - sprintf (buffer, "br %x", addr); - sr_write_cr (buffer); - gr_expect_prompt (); - return(0); - } - else - { - fprintf_filtered (stderr, - "Too many break points, break point not installed\n"); - return(1); - } - -} -static int -bug_remove_breakpoint (addr, save) - CORE_ADDR addr; - char *save; /* Throw away, let bug save instructions */ -{ - if (num_brkpts > 0) - { - char buffer[100]; - - num_brkpts--; - sprintf (buffer, "nobr %x", addr); - sr_write_cr (buffer); - gr_expect_prompt (); - - } - return (0); -} - -/* Clear the bugs notion of what the break points are */ -static int -bug_clear_breakpoints () -{ - - if (sr_is_open()) - { - sr_write_cr ("nobr"); - sr_expect("nobr"); - gr_expect_prompt (); - } - num_brkpts = 0; - return(0); -} - -struct target_ops bug_ops = -{ - "bug", "Remote BUG monitor", - "Use the mvme187 board running the BUG monitor connected by a serial line.", - - bug_open, gr_close, - 0, gr_detach, bug_resume, bug_wait, /* attach */ - bug_fetch_register, bug_store_register, - gr_prepare_to_store, - bug_xfer_memory, - gr_files_info, - bug_insert_breakpoint, bug_remove_breakpoint, /* Breakpoints */ - 0, 0, 0, 0, 0, /* Terminal handling */ - gr_kill, /* FIXME, kill */ - bug_load, - 0, /* lookup_symbol */ - gr_create_inferior, /* create_inferior */ - gr_mourn, /* mourn_inferior FIXME */ - 0, /* can_run */ - 0, /* notice_signals */ - process_stratum, 0, /* next */ - 1, 1, 1, 1, 1, /* all mem, mem, stack, regs, exec */ - 0, 0, /* Section pointers */ - OPS_MAGIC, /* Always the last thing */ -}; - -void -_initialize_remote_bug () -{ - add_target (&bug_ops); - - add_show_from_set - (add_set_cmd ("srec-bytes", class_support, var_uinteger, - (char *) &srec_bytes, - "\ -Set the number of bytes represented in each S-record.\n\ -This affects the communication protocol with the remote target.", - &setlist), - &showlist); - - add_show_from_set - (add_set_cmd ("srec-max-retries", class_support, var_uinteger, - (char *) &srec_max_retries, - "\ -Set the number of retries for shipping S-records.\n\ -This affects the communication protocol with the remote target.", - &setlist), - &showlist); - -#if 0 - /* This needs to set SREC_SIZE, not srec_frame which gets changed at the - end of a download. But do we need the option at all? */ - add_show_from_set - (add_set_cmd ("srec-frame", class_support, var_uinteger, - (char *) &srec_frame, - "\ -Set the number of bytes in an S-record frame.\n\ -This affects the communication protocol with the remote target.", - &setlist), - &showlist); -#endif /* 0 */ - - add_show_from_set - (add_set_cmd ("srec-noise", class_support, var_zinteger, - (char *) &srec_noise, - "\ -Set number of S-record to send before deliberately flubbing a checksum.\n\ -Zero means flub none at all. This affects the communication protocol\n\ -with the remote target.", - &setlist), - &showlist); - - add_show_from_set - (add_set_cmd ("srec-sleep", class_support, var_zinteger, - (char *) &srec_sleep, - "\ -Set number of seconds to sleep after an S-record for a possible error message to arrive.\n\ -This affects the communication protocol with the remote target.", - &setlist), - &showlist); - - add_show_from_set - (add_set_cmd ("srec-echo-pace", class_support, var_boolean, - (char *) &srec_echo_pace, - "\ -Set echo-verification.\n\ -When on, use verification by echo when downloading S-records. This is\n\ -much slower, but generally more reliable.", - &setlist), - &showlist); -} diff --git a/contrib/gdb/gdb/remote-e7000.c b/contrib/gdb/gdb/remote-e7000.c deleted file mode 100644 index d188913..0000000 --- a/contrib/gdb/gdb/remote-e7000.c +++ /dev/null @@ -1,2066 +0,0 @@ -/* Remote debugging interface for Hitachi E7000 ICE, for GDB - Copyright 1993, 1994, 1996 Free Software Foundation, Inc. - Contributed by Cygnus Support. - - Written by Steve Chamberlain for Cygnus Support. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without 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. */ - -/* The E7000 is an in-circuit emulator for the Hitachi H8/300-H and - Hitachi-SH processor. It has serial port and a lan port. - - The monitor command set makes it difficult to load large ammounts of - data over the lan without using ftp - so try not to issue load - commands when communicating over ethernet; use the ftpload command. - - The monitor pauses for a second when dumping srecords to the serial - line too, so we use a slower per byte mechanism but without the - startup overhead. Even so, it's pretty slow... */ - -#include "defs.h" -#include "gdbcore.h" -#include "inferior.h" -#include "target.h" -#include "wait.h" -#include "value.h" -#include "command.h" -#include -#include "gdb_string.h" -#include -#include "serial.h" -#include "remote-utils.h" -#include "symfile.h" -#include - -#if 0 -#define HARD_BREAKPOINTS -#define BC_BREAKPOINTS 0 -#endif - -#define CTRLC 0x03 -#define ENQ 0x05 -#define ACK 0x06 -#define CTRLZ 0x1a - -extern void notice_quit PARAMS ((void)); - -/* Local function declarations. */ - -static void e7000_close PARAMS ((int)); - -static void e7000_fetch_register PARAMS ((int)); - -static void e7000_store_register PARAMS ((int)); - -static void e7000_command PARAMS ((char *, int)); - -static void e7000_login_command PARAMS ((char *, int)); - -static void e7000_ftp_command PARAMS ((char *, int)); - -static void e7000_drain_command PARAMS ((char *, int)); - -static void expect PARAMS ((char *)); - -static void expect_full_prompt PARAMS ((void)); - -static void expect_prompt PARAMS ((void)); - -/* Variables. */ - -static serial_t e7000_desc; - -/* Nonzero if using the tcp serial driver. */ - -static int using_tcp; - -/* Nonzero if using the pc isa card. */ - -static int using_pc; - -extern struct target_ops e7000_ops; /* Forward declaration */ - -char *ENQSTRING = "\005"; - -/* Nonzero if some routine (as opposed to the user) wants echoing. - FIXME: Do this reentrantly with an extra parameter. */ - -static int echo; - -static int ctrl_c; - -static int timeout = 5; - -/* Send data to e7000debug. */ - -static void -puts_e7000debug (buf) - char *buf; -{ - if (!e7000_desc) - error ("Use \"target e7000 ...\" first."); - - if (remote_debug) - printf("Sending %s\n", buf); - - if (SERIAL_WRITE (e7000_desc, buf, strlen (buf))) - fprintf (stderr, "SERIAL_WRITE failed: %s\n", safe_strerror (errno)); - - /* And expect to see it echoed, unless using the pc interface */ -#if 0 - if (!using_pc) -#endif - expect (buf); -} - -static void -putchar_e7000 (x) - int x; -{ - char b[1]; - - b[0] = x; - SERIAL_WRITE (e7000_desc, b, 1); -} - -static void -write_e7000 (s) - char *s; -{ - SERIAL_WRITE (e7000_desc, s, strlen (s)); -} - -static int -normal (x) - int x; -{ - if (x == '\n') - return '\r'; - return x; -} - -/* Read a character from the remote system, doing all the fancy timeout - stuff. */ - -static int -readchar (timeout) - int timeout; -{ - int c; - - do - { - c = SERIAL_READCHAR (e7000_desc, timeout); - } - while (c > 127); - - if (c == SERIAL_TIMEOUT) - { - if (timeout == 0) - return -1; - echo = 0; - error ("Timeout reading from remote system."); - } - if (remote_debug) - { - putchar (c); - fflush (stdout); - } - - return normal (c); -} - -#if 0 -char * -tl (x) -{ - static char b[8][10]; - static int p; - - p++; - p &= 7; - if (x >= ' ') - { - b[p][0] = x; - b[p][1] = 0; - } - else - { - sprintf(b[p], "<%d>", x); - } - - return b[p]; -} -#endif - -/* Scan input from the remote system, until STRING is found. If - DISCARD is non-zero, then discard non-matching input, else print it - out. Let the user break out immediately. */ - -static void -expect (string) - char *string; -{ - char *p = string; - int c; - int nl = 0; - - while (1) - { - c = readchar (timeout); - notice_quit (); - if (quit_flag == 1) - { - if (ctrl_c) - { - putchar_e7000(CTRLC); - --ctrl_c; - } - else - { - quit (); - } - } - - if (c == SERIAL_ERROR) - { - error ("Serial communication error"); - } - if (echo || remote_debug) - { - if (c == '\r' || c == '\n') - { - if (!nl) - putchar ('\n'); - nl = 1; - } - else - { - nl = 0; - putchar (c); - } - fflush (stdout); - } - if (normal (c) == normal (*p++)) - { - if (*p == '\0') - return; - } - else - { - p = string; - - if (normal (c) == normal (string[0])) - p++; - } - } -} - -/* Keep discarding input until we see the e7000 prompt. - - The convention for dealing with the prompt is that you - o give your command - o *then* wait for the prompt. - - Thus the last thing that a procedure does with the serial line will - be an expect_prompt(). Exception: e7000_resume does not wait for - the prompt, because the terminal is being handed over to the - inferior. However, the next thing which happens after that is a - e7000_wait which does wait for the prompt. Note that this includes - abnormal exit, e.g. error(). This is necessary to prevent getting - into states from which we can't recover. */ - -static void -expect_prompt () -{ - expect (":"); -} - -static void -expect_full_prompt () -{ - expect ("\r:"); -} - -static int -convert_hex_digit (ch) - int ch; -{ - if (ch >= '0' && ch <= '9') - return ch - '0'; - else if (ch >= 'A' && ch <= 'F') - return ch - 'A' + 10; - else if (ch >= 'a' && ch <= 'f') - return ch - 'a' + 10; - return -1; -} - -static int -get_hex (start) - int *start; -{ - int value = convert_hex_digit (*start); - int try; - - *start = readchar (timeout); - while ((try = convert_hex_digit (*start)) >= 0) - { - value <<= 4; - value += try; - *start = readchar (timeout); - } - return value; -} - -#if 0 -/* Get N 32-bit words from remote, each preceded by a space, and put - them in registers starting at REGNO. */ - -static void -get_hex_regs (n, regno) - int n; - int regno; -{ - long val; - int i; - - for (i = 0; i < n; i++) - { - int j; - - val = 0; - for (j = 0; j < 8; j++) - val = (val << 4) + get_hex_digit (j == 0); - supply_register (regno++, (char *) &val); - } -} -#endif - -/* This is called not only when we first attach, but also when the - user types "run" after having attached. */ - -static void -e7000_create_inferior (execfile, args, env) - char *execfile; - char *args; - char **env; -{ - int entry_pt; - - if (args && *args) - error ("Can't pass arguments to remote E7000DEBUG process"); - - if (execfile == 0 || exec_bfd == 0) - error ("No exec file specified"); - - entry_pt = (int) bfd_get_start_address (exec_bfd); - -#ifdef CREATE_INFERIOR_HOOK - CREATE_INFERIOR_HOOK (0); /* No process-ID */ -#endif - - /* The "process" (board) is already stopped awaiting our commands, and - the program is already downloaded. We just set its PC and go. */ - - clear_proceed_status (); - - /* Tell wait_for_inferior that we've started a new process. */ - init_wait_for_inferior (); - - /* Set up the "saved terminal modes" of the inferior - based on what modes we are starting it with. */ - target_terminal_init (); - - /* Install inferior's terminal modes. */ - target_terminal_inferior (); - - /* insert_step_breakpoint (); FIXME, do we need this? */ - proceed ((CORE_ADDR) entry_pt, -1, 0); /* Let 'er rip... */ -} - -/* Open a connection to a remote debugger. NAME is the filename used - for communication. */ - -static int baudrate = 9600; -static char dev_name[100]; - -static char *machine = ""; -static char *user = ""; -static char *passwd = ""; -static char *dir = ""; - -/* Grab the next token and buy some space for it */ - -static char * -next (ptr) - char **ptr; -{ - char *p = *ptr; - char *s; - char *r; - int l = 0; - - while (*p && *p == ' ') - p++; - s = p; - while (*p && (*p != ' ' && *p != '\t')) - { - l++; - p++; - } - r = xmalloc (l + 1); - memcpy (r, s, l); - r[l] = 0; - *ptr = p; - return r; -} - -static void -e7000_login_command (args, from_tty) - char *args; - int from_tty; -{ - if (args) - { - machine = next (&args); - user = next (&args); - passwd = next (&args); - dir = next (&args); - if (from_tty) - { - printf ("Set info to %s %s %s %s\n", machine, user, passwd, dir); - } - } - else - { - error ("Syntax is ftplogin "); - } -} - -/* Start an ftp transfer from the E7000 to a host */ - -static void -e7000_ftp_command (args, from_tty) - char *args; - int from_tty; -{ - /* FIXME: arbitrary limit on machine names and such. */ - char buf[200]; - - int oldtimeout = timeout; - timeout = 10; - - sprintf (buf, "ftp %s\r", machine); - puts_e7000debug (buf); - expect (" Username : "); - sprintf (buf, "%s\r", user); - puts_e7000debug (buf); - expect (" Password : "); - write_e7000 (passwd); - write_e7000 ("\r"); - expect ("success\r"); - expect ("FTP>"); - sprintf (buf, "cd %s\r", dir); - puts_e7000debug (buf); - expect ("FTP>"); - sprintf (buf, "ll 0;s:%s\r", args); - puts_e7000debug (buf); - expect ("FTP>"); - puts_e7000debug ("bye\r"); - expect (":"); - timeout = oldtimeout; -} - -static void -e7000_open (args, from_tty) - char *args; - int from_tty; -{ - int n; - int loop; - char junk[100]; - int sync; - target_preopen (from_tty); - - n = 0; - if (args && strcasecmp (args, "pc") == 0) - { - strcpy (dev_name, args); - } - else - { - if (args) - { - n = sscanf (args, " %s %d %s", dev_name, &baudrate, junk); - } - - if (n != 1 && n != 2) - { - error ("Bad arguments. Usage:\ttarget e7000 \n\ -or \t\ttarget e7000 [:]\n\ -or \t\ttarget e7000 pc\n"); - } - -#ifndef __GO32__ - if (n == 1 && strchr (dev_name, ':') == 0) - { - /* Default to normal telnet port */ - strcat (dev_name, ":23"); - } -#endif - } - - push_target (&e7000_ops); - - e7000_desc = SERIAL_OPEN (dev_name); - - if (!e7000_desc) - perror_with_name (dev_name); - - using_tcp = strcmp (e7000_desc->ops->name, "tcp") == 0; - using_pc = strcmp (e7000_desc->ops->name, "pc") == 0; - - SERIAL_SETBAUDRATE (e7000_desc, baudrate); - SERIAL_RAW (e7000_desc); - - /* Hello? Are you there? */ - sync = 0; - loop = 0; - putchar_e7000 (CTRLC); - while (!sync) - { - int c; - - if (from_tty) - printf_unfiltered ("[waiting for e7000...]\n"); - - write_e7000 ("\r"); - c = SERIAL_READCHAR (e7000_desc, 1); - while (c != SERIAL_TIMEOUT) - { - /* Dont echo cr's */ - if (from_tty && c != '\r') - { - putchar (c); - fflush (stdout); - } - if (c == ':') - sync = 1; - - if (loop++ == 20) - { - putchar_e7000 (CTRLC); - loop = 0; - } - - QUIT ; - - - if (quit_flag) - { - putchar_e7000 (CTRLC); - quit_flag = 0; - } - c = SERIAL_READCHAR (e7000_desc, 1); - } - } - puts_e7000debug ("\r"); - - expect_prompt (); - - puts_e7000debug ("b -\r"); - - expect_prompt (); - - if (from_tty) - printf_filtered ("Remote target %s connected to %s\n", target_shortname, - dev_name); - -#ifdef GDB_TARGET_IS_H8300 - h8300hmode = 1; -#endif -} - -/* Close out all files and local state before this target loses control. */ - -static void -e7000_close (quitting) - int quitting; -{ - if (e7000_desc) - { - SERIAL_CLOSE (e7000_desc); - e7000_desc = 0; - } -} - -/* Terminate the open connection to the remote debugger. Use this - when you want to detach and do something else with your gdb. */ - -static void -e7000_detach (from_tty) - int from_tty; -{ - pop_target (); /* calls e7000_close to do the real work */ - if (from_tty) - printf ("Ending remote %s debugging\n", target_shortname); -} - -/* Tell the remote machine to resume. */ - -static void -e7000_resume (pid, step, sig) - int pid, step, sig; -{ - if (step) - puts_e7000debug ("S\r"); - else - puts_e7000debug ("G\r"); -} - -/* Read the remote registers into the block REGS. - - For the H8/300 a register dump looks like: - - PC=00021A CCR=80:I******* - ER0 - ER3 0000000A 0000002E 0000002E 00000000 - ER4 - ER7 00000000 00000000 00000000 00FFEFF6 - 000218 MOV.B R1L,R2L - STEP NORMAL END or - BREAK POINT - */ - -#ifdef GDB_TARGET_IS_H8300 - -char *want = "PC=%p CCR=%c\n\ - ER0 - ER3 %0 %1 %2 %3\n\ - ER4 - ER7 %4 %5 %6 %7\n"; - -char *want_nopc = "%p CCR=%c\n\ - ER0 - ER3 %0 %1 %2 %3\n\ - ER4 - ER7 %4 %5 %6 %7"; - -#endif - -#ifdef GDB_TARGET_IS_SH - -char *want = "PC=%16 SR=%22\n\ -PR=%17 GBR=%18 VBR=%19\n\ -MACH=%20 MACL=%21\n\ -R0-7 %0 %1 %2 %3 %4 %5 %6 %7\n\ -R8-15 %8 %9 %10 %11 %12 %13 %14 %15\n"; - -char *want_nopc = "%16 SR=%22\n\ - PR=%17 GBR=%18 VBR=%19\n\ - MACH=%20 MACL=%21\n\ - R0-7 %0 %1 %2 %3 %4 %5 %6 %7\n\ - R8-15 %8 %9 %10 %11 %12 %13 %14 %15"; - -#endif - -static int -gch () -{ - int c = readchar (timeout); - - if (remote_debug) - { - if (c >= ' ') - printf ("%c", c); - else if (c == '\n') - printf ("\n"); - } - return c; -} - -static unsigned int -gbyte () -{ - int high = convert_hex_digit (gch ()); - int low = convert_hex_digit (gch ()); - - return (high << 4) + low; -} - -void -fetch_regs_from_dump (nextchar, want) - int (*nextchar)(); - char *want; -{ - int regno; - char buf[MAX_REGISTER_RAW_SIZE]; - - int thischar = nextchar (); - - while (*want) - { - switch (*want) - { - case '\n': - /* Skip to end of line and then eat all new line type stuff */ - while (thischar != '\n' && thischar != '\r') - thischar = nextchar (); - while (thischar == '\n' || thischar == '\r') - thischar = nextchar (); - want++; - break; - - case ' ': - while (thischar == ' ' - || thischar == '\t' - || thischar == '\r' - || thischar == '\n') - thischar = nextchar (); - want++; - break; - - default: - if (*want == thischar) - { - want++; - if (*want) - thischar = nextchar (); - - } - else if (thischar == ' ' || thischar == '\n' || thischar == '\r') - { - thischar = nextchar (); - } - else { - error ("out of sync in fetch registers wanted <%s>, got <%c 0x%x>", - want, thischar, thischar); - } - - break; - case '%': - /* Got a register command */ - want++; - switch (*want) - { -#ifdef PC_REGNUM - case 'p': - regno = PC_REGNUM; - want++; - break; -#endif -#ifdef CCR_REGNUM - case 'c': - regno = CCR_REGNUM; - want++; - break; -#endif -#ifdef SP_REGNUM - case 's': - regno = SP_REGNUM; - want++; - break; -#endif -#ifdef FP_REGNUM - case 'f': - regno = FP_REGNUM; - want++; - break; -#endif - - default: - if (isdigit (want[0])) - { - if (isdigit (want[1])) - { - regno = (want[0] - '0') * 10 + want[1] - '0'; - want += 2; - } - else - { - regno = want[0] - '0'; - want++; - } - } - - else - abort (); - } - store_signed_integer (buf, - REGISTER_RAW_SIZE(regno), - (LONGEST) get_hex (&thischar, nextchar)); - supply_register (regno, buf); - break; - } - } -} - -static void -e7000_fetch_registers () -{ - int regno; - - puts_e7000debug ("R\r"); - fetch_regs_from_dump (gch, want); - - /* And supply the extra ones the simulator uses */ - for (regno = NUM_REALREGS; regno < NUM_REGS; regno++) - { - int buf = 0; - - supply_register (regno, (char *) (&buf)); - } -} - -/* Fetch register REGNO, or all registers if REGNO is -1. Returns - errno value. */ - -static void -e7000_fetch_register (regno) - int regno; -{ - e7000_fetch_registers (); -} - -/* Store the remote registers from the contents of the block REGS. */ - -static void -e7000_store_registers () -{ - int regno; - - for (regno = 0; regno < NUM_REALREGS; regno++) - e7000_store_register (regno); - - registers_changed (); -} - -/* Store register REGNO, or all if REGNO == 0. Return errno value. */ - -static void -e7000_store_register (regno) - int regno; -{ - char buf[200]; - - if (regno == -1) - { - e7000_store_registers (); - return; - } - -#ifdef GDB_TARGET_IS_H8300 - if (regno <= 7) - { - sprintf (buf, ".ER%d %x\r", regno, read_register (regno)); - puts_e7000debug (buf); - } - else if (regno == PC_REGNUM) - { - sprintf (buf, ".PC %x\r", read_register (regno)); - puts_e7000debug (buf); - } - else if (regno == CCR_REGNUM) - { - sprintf (buf, ".CCR %x\r", read_register (regno)); - puts_e7000debug (buf); - } -#endif /* GDB_TARGET_IS_H8300 */ - -#ifdef GDB_TARGET_IS_SH - switch (regno) - { - default: - sprintf (buf, ".R%d %x\r", regno, read_register (regno)); - puts_e7000debug (buf); - break; - - case PC_REGNUM: - sprintf (buf, ".PC %x\r", read_register (regno)); - puts_e7000debug (buf); - break; - - case SR_REGNUM: - sprintf (buf, ".SR %x\r", read_register (regno)); - puts_e7000debug (buf); - break; - - case PR_REGNUM: - sprintf (buf, ".PR %x\r", read_register (regno)); - puts_e7000debug (buf); - break; - - case GBR_REGNUM: - sprintf (buf, ".GBR %x\r", read_register (regno)); - puts_e7000debug (buf); - break; - - case VBR_REGNUM: - sprintf (buf, ".VBR %x\r", read_register (regno)); - puts_e7000debug (buf); - break; - - case MACH_REGNUM: - sprintf (buf, ".MACH %x\r", read_register (regno)); - puts_e7000debug (buf); - break; - - case MACL_REGNUM: - sprintf (buf, ".MACL %x\r", read_register (regno)); - puts_e7000debug (buf); - break; - } - -#endif /* GDB_TARGET_IS_SH */ - - expect_prompt (); -} - -/* Get ready to modify the registers array. On machines which store - individual registers, this doesn't need to do anything. On machines - which store all the registers in one fell swoop, this makes sure - that registers contains all the registers from the program being - debugged. */ - -static void -e7000_prepare_to_store () -{ - /* Do nothing, since we can store individual regs */ -} - -static void -e7000_files_info () -{ - printf ("\tAttached to %s at %d baud.\n", dev_name, baudrate); -} - -static int -stickbyte (where, what) - char *where; - unsigned int what; -{ - static CONST char digs[] = "0123456789ABCDEF"; - - where[0] = digs[(what >> 4) & 0xf]; - where[1] = digs[(what & 0xf) & 0xf]; - - return what; -} - -/* Write a small ammount of memory. */ - -static int -write_small (memaddr, myaddr, len) - CORE_ADDR memaddr; - unsigned char *myaddr; - int len; -{ - int i; - char buf[200]; - - for (i = 0; i < len; i++) - { - if (((memaddr + i) & 3) == 0 && (i + 3 < len)) - { - /* Can be done with a long word */ - sprintf (buf, "m %x %x%02x%02x%02x;l\r", - memaddr + i, - myaddr[i], myaddr[i + 1], myaddr[i + 2], myaddr[i + 3]); - puts_e7000debug (buf); - i += 3; - } - else - { - sprintf (buf, "m %x %x\r", memaddr + i, myaddr[i]); - puts_e7000debug (buf); - } - } - - expect_prompt (); - - return len; -} - -/* Write a large ammount of memory, this only works with the serial - mode enabled. Command is sent as - - il ;s:s\r -> - <- il ;s:s\r - <- ENQ - ACK -> - <- LO s\r - Srecords... - ^Z -> - <- ENQ - ACK -> - <- : - */ - -static int -write_large (memaddr, myaddr, len) - CORE_ADDR memaddr; - unsigned char *myaddr; - int len; -{ - int i; -#define maxstride 128 - int stride; - - puts_e7000debug ("IL ;S:FK\r"); - expect (ENQSTRING); - putchar_e7000 (ACK); - expect ("LO FK\r"); - - for (i = 0; i < len; i += stride) - { - char compose[maxstride * 2 + 50]; - int address = i + memaddr; - int j; - int check_sum; - int where = 0; - int alen; - - stride = len - i; - if (stride > maxstride) - stride = maxstride; - - compose[where++] = 'S'; - check_sum = 0; - if (address >= 0xffffff) - alen = 4; - else if (address >= 0xffff) - alen = 3; - else - alen = 2; - /* Insert type. */ - compose[where++] = alen - 1 + '0'; - /* Insert length. */ - check_sum += stickbyte (compose + where, alen + stride + 1); - where += 2; - while (alen > 0) - { - alen--; - check_sum += stickbyte (compose + where, address >> (8 * (alen))); - where += 2; - } - - for (j = 0; j < stride; j++) - { - check_sum += stickbyte (compose + where, myaddr[i + j]); - where += 2; - } - stickbyte (compose + where, ~check_sum); - where += 2; - compose[where++] = '\r'; - compose[where++] = '\n'; - compose[where++] = 0; - - SERIAL_WRITE (e7000_desc, compose, where); - j = SERIAL_READCHAR (e7000_desc, 0); - if (j == SERIAL_TIMEOUT) - { - /* This is ok - nothing there */ - } - else if (j == ENQ) - { - /* Hmm, it's trying to tell us something */ - expect (":"); - error ("Error writing memory"); - } - else - { - printf ("@%d}@", j); - while ((j = SERIAL_READCHAR(e7000_desc,0)) > 0) - { - printf ("@{%d}@",j); - } - } - } - - /* Send the trailer record */ - write_e7000 ("S70500000000FA\r"); - putchar_e7000 (CTRLZ); - expect (ENQSTRING); - putchar_e7000 (ACK); - expect (":"); - - return len; -} - -/* Copy LEN bytes of data from debugger memory at MYADDR to inferior's - memory at MEMADDR. Returns length moved. - - Can't use the Srecord load over ethernet, so don't use fast method - then. */ - -static int -e7000_write_inferior_memory (memaddr, myaddr, len) - CORE_ADDR memaddr; - unsigned char *myaddr; - int len; -{ - if (len < 16 || using_tcp || using_pc) - return write_small (memaddr, myaddr, len); - else - return write_large (memaddr, myaddr, len); -} - -/* Read LEN bytes from inferior memory at MEMADDR. Put the result - at debugger address MYADDR. Returns length moved. - - Small transactions we send - m ;l - and receive - 00000000 12345678 ? - */ - -static int -e7000_read_inferior_memory (memaddr, myaddr, len) - CORE_ADDR memaddr; - unsigned char *myaddr; - int len; -{ - int count; - int c; - int i; - char buf[200]; - /* Starting address of this pass. */ - -/* printf("READ INF %x %x %d\n", memaddr, myaddr, len);*/ - if (((memaddr - 1) + len) < memaddr) - { - errno = EIO; - return 0; - } - - sprintf (buf, "m %x;l\r", memaddr); - puts_e7000debug (buf); - - for (count = 0; count < len; count += 4) - { - /* Suck away the address */ - c = gch (); - while (c != ' ') - c = gch (); - c = gch (); - if (c == '*') - { /* Some kind of error */ - expect_prompt(); - return -1; - } - while (c != ' ') - c = gch (); - - /* Now read in the data */ - for (i = 0; i < 4; i++) - { - int b = gbyte(); - if (count + i < len) { - myaddr[count + i] = b; - } - } - - /* Skip the trailing ? and send a . to end and a cr for more */ - gch (); - gch (); - if (count + 4 >= len) - puts_e7000debug(".\r"); - else - puts_e7000debug("\r"); - - } - expect_prompt(); - return len; -} - - -#if 0 -/* - For large transfers we used to send - - - d \r - - and receive - < D A T A > < ASCII CODE > - 000000 5F FD FD FF DF 7F DF FF 01 00 01 00 02 00 08 04 "_..............." - 000010 FF D7 FF 7F D7 F1 7F FF 00 05 00 00 08 00 40 00 "..............@." - 000020 7F FD FF F7 7F FF FF F7 00 00 00 00 00 00 00 00 "................" - - A cost in chars for each transaction of 80 + 5*n-bytes. - - Large transactions could be done with the srecord load code, but - there is a pause for a second before dumping starts, which slows the - average rate down! -*/ - -static int -e7000_read_inferior_memory (memaddr, myaddr, len) - CORE_ADDR memaddr; - unsigned char *myaddr; - int len; -{ - int count; - int c; - char buf[200]; - - /* Starting address of this pass. */ - - if (((memaddr - 1) + len) < memaddr) - { - errno = EIO; - return 0; - } - - sprintf (buf, "d %x %x\r", memaddr, memaddr + len - 1); - puts_e7000debug (buf); - - count = 0; - c = gch (); - - /* First skip the command */ - while (c == '\n') - c = gch (); - - while (c == ' ') - c = gch (); - if (c == '*') - { - expect ("\r"); - return -1; - } - - /* Skip the title line */ - while (c != '\n') - c = gch (); - c = gch (); - while (count < len) - { - /* Skip the address */ - while (c <= ' ') - c = gch (); - - get_hex (&c); - - /* read in the bytes on the line */ - while (c != '"' && count < len) - { - if (c == ' ') - c = gch (); - else - { - myaddr[count++] = get_hex (&c); - } - } - - while (c != '\n') - c = gch (); - } - - while (c != ':') - c = gch (); - - return len; -} - -static int -fast_but_for_the_pause_e7000_read_inferior_memory (memaddr, myaddr, len) - CORE_ADDR memaddr; - char *myaddr; - int len; -{ - int loop; - int c; - char buf[200]; - - if (((memaddr - 1) + len) < memaddr) - { - errno = EIO; - return 0; - } - - sprintf (buf, "is %x@%x:s\r", memaddr, len); - puts_e7000debug (buf); - gch (); - c = gch (); - if (c != ENQ) - { - /* Got an error */ - error ("Memory read error"); - } - putchar_e7000 (ACK); - expect ("SV s"); - loop = 1; - while (loop) - { - int type; - int length; - int addr; - int i; - - c = gch (); - switch (c) - { - case ENQ: /* ENQ, at the end */ - loop = 0; - break; - case 'S': - /* Start of an Srecord */ - type = gch (); - length = gbyte (); - switch (type) - { - case '7': /* Termination record, ignore */ - case '0': - case '8': - case '9': - /* Header record - ignore it */ - while (length--) - { - gbyte (); - } - break; - case '1': - case '2': - case '3': - { - int alen; - - alen = type - '0' + 1; - addr = 0; - while (alen--) - { - addr = (addr << 8) + gbyte (); - length--; - } - - for (i = 0; i < length - 1; i++) - myaddr[i + addr - memaddr] = gbyte (); - - gbyte (); /* Ignore checksum */ - } - } - } - } - - putchar_e7000 (ACK); - expect ("TOP ADDRESS ="); - expect ("END ADDRESS ="); - expect (":"); - - return len; -} - -#endif - -static int -e7000_xfer_inferior_memory (memaddr, myaddr, len, write, target) - CORE_ADDR memaddr; - unsigned char *myaddr; - int len; - int write; - struct target_ops *target; /* ignored */ -{ - if (write) - return e7000_write_inferior_memory( memaddr, myaddr, len); - else - return e7000_read_inferior_memory( memaddr, myaddr, len); -} - -static void -e7000_kill (args, from_tty) - char *args; - int from_tty; -{ -} - -static void -e7000_load (args, from_tty) - char *args; - int from_tty; -{ - struct cleanup *old_chain; - asection *section; - bfd *pbfd; - bfd_vma entry; - int i; -#define WRITESIZE 0x1000 - char buf[2 + 4 + 4 + WRITESIZE]; /* `DT' + + + */ - char *filename; - int quiet; - int nostart; - time_t start_time, end_time; /* Start and end times of download */ - unsigned long data_count; /* Number of bytes transferred to memory */ - - if (!strchr (dev_name, ':')) - { - generic_load (args, from_tty); - return; - } - - buf[0] = 'D'; - buf[1] = 'T'; - quiet = 0; - nostart = 0; - filename = NULL; - - while (*args != '\000') - { - char *arg; - - while (isspace (*args)) args++; - - arg = args; - - while ((*args != '\000') && !isspace (*args)) args++; - - if (*args != '\000') - *args++ = '\000'; - - if (*arg != '-') - filename = arg; - else if (strncmp (arg, "-quiet", strlen (arg)) == 0) - quiet = 1; - else if (strncmp (arg, "-nostart", strlen (arg)) == 0) - nostart = 1; - else - error ("unknown option `%s'", arg); - } - - if (!filename) - filename = get_exec_file (1); - - pbfd = bfd_openr (filename, gnutarget); - if (pbfd == NULL) - { - perror_with_name (filename); - return; - } - old_chain = make_cleanup (bfd_close, pbfd); - - if (!bfd_check_format (pbfd, bfd_object)) - error ("\"%s\" is not an object file: %s", filename, - bfd_errmsg (bfd_get_error ())); - - start_time = time (NULL); - data_count = 0; - - puts_e7000debug ("mw\r"); - - expect ("\nOK"); - - for (section = pbfd->sections; section; section = section->next) - { - if (bfd_get_section_flags (pbfd, section) & SEC_LOAD) - { - bfd_vma section_address; - bfd_size_type section_size; - file_ptr fptr; - - section_address = bfd_get_section_vma (pbfd, section); - section_size = bfd_get_section_size_before_reloc (section); - - if (!quiet) - printf_filtered ("[Loading section %s at 0x%x (%d bytes)]\n", - bfd_get_section_name (pbfd, section), - section_address, - section_size); - - fptr = 0; - - data_count += section_size; - - while (section_size > 0) - { - int count; - static char inds[] = "|/-\\"; - static int k = 0; - - QUIT; - - count = min (section_size, WRITESIZE); - - buf[2] = section_address >> 24; - buf[3] = section_address >> 16; - buf[4] = section_address >> 8; - buf[5] = section_address; - - buf[6] = count >> 24; - buf[7] = count >> 16; - buf[8] = count >> 8; - buf[9] = count; - - bfd_get_section_contents (pbfd, section, buf + 10, fptr, count); - - if (SERIAL_WRITE (e7000_desc, buf, count + 10)) - fprintf_unfiltered (gdb_stderr, - "e7000_load: SERIAL_WRITE failed: %s\n", - safe_strerror(errno)); - - expect ("OK"); - - if (!quiet) - { - printf_unfiltered ("\r%c", inds[k++ % 4]); - gdb_flush (gdb_stdout); - } - - section_address += count; - fptr += count; - section_size -= count; - } - } - } - - write_e7000 ("ED"); - - expect_prompt (); - - end_time = time (NULL); - -/* Finally, make the PC point at the start address */ - - if (exec_bfd) - write_pc (bfd_get_start_address (exec_bfd)); - - inferior_pid = 0; /* No process now */ - -/* This is necessary because many things were based on the PC at the time that - we attached to the monitor, which is no longer valid now that we have loaded - new code (and just changed the PC). Another way to do this might be to call - normal_stop, except that the stack may not be valid, and things would get - horribly confused... */ - - clear_symtab_users (); - - if (!nostart) - { - entry = bfd_get_start_address (pbfd); - - if (!quiet) - printf_unfiltered ("[Starting %s at 0x%x]\n", filename, entry); - -/* start_routine (entry);*/ - } - - printf_filtered ("Transfer rate: %d bits/sec.\n", - (data_count * 8)/(end_time - start_time)); - - do_cleanups (old_chain); -} - -/* Clean up when a program exits. - - The program actually lives on in the remote processor's RAM, and may be - run again without a download. Don't leave it full of breakpoint - instructions. */ - -static void -e7000_mourn_inferior () -{ - remove_breakpoints (); - unpush_target (&e7000_ops); - generic_mourn_inferior (); /* Do all the proper things now */ -} - -#ifdef HARD_BREAKPOINTS -#define MAX_E7000DEBUG_BREAKPOINTS (BC_BREAKPOINTS ? 5 : 200) -#else -#define MAX_E7000DEBUG_BREAKPOINTS 200 -#endif - -extern int memory_breakpoint_size; - -static CORE_ADDR breakaddr[MAX_E7000DEBUG_BREAKPOINTS] = {0}; - -static int -e7000_insert_breakpoint (addr, shadow) - CORE_ADDR addr; - unsigned char *shadow; -{ - int i; - char buf[200]; - static char nop[2] = NOP; - - for (i = 0; i <= MAX_E7000DEBUG_BREAKPOINTS; i++) - if (breakaddr[i] == 0) - { - breakaddr[i] = addr; - /* Save old contents, and insert a nop in the space */ -#ifdef HARD_BREAKPOINTS - if (BC_BREAKPOINTS) - { - sprintf (buf, "BC%d A=%x\r", i+1, addr); - puts_e7000debug (buf); - } - else - { - sprintf (buf, "B %x\r", addr); - puts_e7000debug (buf); - } -#else -#if 0 - e7000_read_inferior_memory (addr, shadow, 2); - e7000_write_inferior_memory (addr, nop, 2); -#endif - - sprintf (buf, "B %x\r", addr); - puts_e7000debug (buf); -#endif - expect_prompt (); - return 0; - } - - error ("Too many breakpoints ( > %d) for the E7000\n", - MAX_E7000DEBUG_BREAKPOINTS); - return 1; -} - -static int -e7000_remove_breakpoint (addr, shadow) - CORE_ADDR addr; - unsigned char *shadow; -{ - int i; - char buf[200]; - - for (i = 0; i < MAX_E7000DEBUG_BREAKPOINTS; i++) - if (breakaddr[i] == addr) - { - breakaddr[i] = 0; -#ifdef HARD_BREAKPOINTS - if (BC_BREAKPOINTS) - { - sprintf (buf, "BC%d - \r", i+1); - puts_e7000debug (buf); - } - else - { - sprintf (buf, "B - %x\r", addr); - puts_e7000debug (buf); - } - expect_prompt (); -#else - sprintf (buf, "B - %x\r", addr); - puts_e7000debug (buf); - expect_prompt (); - -#if 0 - /* Replace the insn under the break */ - e7000_write_inferior_memory (addr, shadow, 2); -#endif -#endif - - return 0; - } - - warning ("Can't find breakpoint associated with 0x%x\n", addr); - return 1; -} - -/* Put a command string, in args, out to STDBUG. Output from STDBUG - is placed on the users terminal until the prompt is seen. */ - -static void -e7000_command (args, fromtty) - char *args; - int fromtty; -{ - /* FIXME: arbitrary limit on length of args. */ - char buf[200]; - - echo = 0; - - if (!e7000_desc) - error ("e7000 target not open."); - if (!args) - { - puts_e7000debug ("\r"); - } - else - { - sprintf (buf, "%s\r", args); - puts_e7000debug (buf); - } - - echo++; - ctrl_c = 2; - expect_full_prompt (); - echo--; - ctrl_c = 0; - printf_unfiltered ("\n"); - - /* Who knows what the command did... */ - registers_changed (); -} - - -static void -e7000_drain_command (args, fromtty) - char *args; - int fromtty; - -{ - int c; - - puts_e7000debug("end\r"); - putchar_e7000 (CTRLC); - - while ((c = SERIAL_READCHAR (e7000_desc, 1) != SERIAL_TIMEOUT)) - { - if (quit_flag) - { - putchar_e7000(CTRLC); - quit_flag = 0; - } - if (c > ' ' && c < 127) - printf ("%c", c & 0xff); - else - printf ("<%x>", c & 0xff); - } -} - -#define NITEMS 7 - -static int -why_stop () -{ - static char *strings[NITEMS] = { - "STEP NORMAL", - "BREAK POINT", - "BREAK KEY", - "BREAK CONDI", - "CYCLE ACCESS", - "ILLEGAL INSTRUCTION", - "WRITE PROTECT", - }; - char *p[NITEMS]; - int c; - int i; - - for (i = 0; i < NITEMS; ++i) - p[i] = strings[i]; - - c = gch (); - while (1) - { - for (i = 0; i < NITEMS; i++) - { - if (c == *(p[i])) - { - p[i]++; - if (*(p[i]) == 0) - { - /* found one of the choices */ - return i; - } - } - else - p[i] = strings[i]; - } - - c = gch (); - } -} - -/* Suck characters, if a string match, then return the strings index - otherwise echo them. */ - -int -expect_n (strings) -char **strings; -{ - char *(ptr[10]); - int n; - int c; - char saveaway[100]; - char *buffer = saveaway; - /* Count number of expect strings */ - - for (n = 0; strings[n]; n++) - { - ptr[n] = strings[n]; - } - - while (1) - { - int i; - int gotone = 0; - - c = SERIAL_READCHAR (e7000_desc, 1); - if (c == SERIAL_TIMEOUT) - { - printf_unfiltered ("[waiting for e7000...]\n"); - } -#ifdef __GO32__ - if (kbhit ()) - { - int k = getkey(); - - if (k == 1) - quit_flag = 1; - } -#endif - if (quit_flag) - { - putchar_e7000 (CTRLC); /* interrupt the running program */ - quit_flag = 0; - } - - for (i = 0; i < n; i++) - { - if (c == ptr[i][0]) - { - ptr[i]++; - if (ptr[i][0] == 0) - { - /* Gone all the way */ - return i; - } - gotone = 1; - } - else - { - ptr[i] = strings[i]; - } - } - - if (gotone) - { - /* Save it up incase we find that there was no match */ - *buffer ++ = c; - } - else - { - if (buffer != saveaway) - { - *buffer++ = 0; - printf ("%s", buffer); - buffer = saveaway; - } - if (c != SERIAL_TIMEOUT) - { - putchar (c); - fflush (stdout); - } - } - } -} - -/* We subtract two from the pc here rather than use - DECR_PC_AFTER_BREAK since the e7000 doesn't always add two to the - pc, and the simulators never do. */ - -static void -sub2_from_pc () -{ - char buf[4]; - char buf2[200]; - - store_signed_integer (buf, - REGISTER_RAW_SIZE(PC_REGNUM), - read_register (PC_REGNUM) -2); - supply_register (PC_REGNUM, buf); - sprintf (buf2, ".PC %x\r", read_register (PC_REGNUM)); - puts_e7000debug (buf2); -} - -#define WAS_SLEEP 0 -#define WAS_INT 1 -#define WAS_RUNNING 2 -#define WAS_OTHER 3 - -static char *estrings[] = { - "** SLEEP", - "BREAK !", - "** PC", - "PC", - NULL -}; - -/* Wait until the remote machine stops, then return, storing status in - STATUS just as `wait' would. */ - -static int -e7000_wait (pid, status) - int pid; - struct target_waitstatus *status; -{ - int stop_reason; - int regno; - int running_count = 0; - int had_sleep = 0; - int loop = 1; - - /* Then echo chars until PC= string seen */ - gch (); /* Drop cr */ - gch (); /* and space */ - - while (loop) - { - switch (expect_n (estrings)) - { - case WAS_OTHER: - /* how did this happen ? */ - loop = 0; - break; - case WAS_SLEEP: - had_sleep = 1; - putchar_e7000 (CTRLC); - loop = 0; - break; - case WAS_INT: - loop = 0; - break; - case WAS_RUNNING: - running_count++; - if (running_count == 20) - { - printf_unfiltered ("[running...]\n"); - running_count = 0; - } - break; - default: - /* error? */ - break; - } - } - - /* Skip till the PC= */ - expect ("="); - fetch_regs_from_dump (gch, want_nopc); - - /* And supply the extra ones the simulator uses */ - for (regno = NUM_REALREGS; regno < NUM_REGS; regno++) - { - int buf = 0; - supply_register (regno, (char *) &buf); - } - - stop_reason = why_stop (); - expect_full_prompt (); - - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_TRAP; - - switch (stop_reason) - { - case 1: /* Breakpoint */ - write_pc (read_pc ()); /* PC is always off by 2 for breakpoints */ - status->value.sig = TARGET_SIGNAL_TRAP; - break; - case 0: /* Single step */ - status->value.sig = TARGET_SIGNAL_TRAP; - break; - case 2: /* Interrupt */ - if (had_sleep) - { - status->value.sig = TARGET_SIGNAL_TRAP; - sub2_from_pc (); - } - else - { - status->value.sig = TARGET_SIGNAL_INT; - } - break; - case 3: - break; - case 4: - printf_unfiltered ("a cycle address error?\n"); - status->value.sig = TARGET_SIGNAL_UNKNOWN; - break; - case 5: - status->value.sig = TARGET_SIGNAL_ILL; - break; - case 6: - status->value.sig = TARGET_SIGNAL_SEGV; - break; - case 7: /* Anything else (NITEMS + 1) */ - printf_unfiltered ("a write protect error?\n"); - status->value.sig = TARGET_SIGNAL_UNKNOWN; - break; - default: - /* Get the user's attention - this should never happen. */ - abort (); - } - - return 0; -} - -/* Define the target subroutine names. */ - -struct target_ops e7000_ops = -{ - "e7000", - "Remote Hitachi e7000 target", - "Use a remote Hitachi e7000 ICE connected by a serial line,\n\ -or a network connection.\n\ -Arguments are the name of the device for the serial line,\n\ -the speed to connect at in bits per second.\n\ -eg\n\ -target e7000 /dev/ttya 9600\n\ -target e7000 foobar", - e7000_open, /* to_open */ - e7000_close, /* to_close */ - 0, /* to_attach */ - e7000_detach, /* to_detach */ - e7000_resume, /* to_resume */ - e7000_wait, /* to_wait */ - e7000_fetch_register, /* to_fetch_registers */ - e7000_store_register, /* to_store_registers */ - e7000_prepare_to_store, /* to_prepare_to_store */ - e7000_xfer_inferior_memory, /* to_xfer_memory */ - e7000_files_info, /* to_files_info */ - e7000_insert_breakpoint, /* to_insert_breakpoint */ - e7000_remove_breakpoint, /* to_remove_breakpoint */ - 0, /* to_terminal_init */ - 0, /* to_terminal_inferior */ - 0, /* to_terminal_ours_for_output */ - 0, /* to_terminal_ours */ - 0, /* to_terminal_info */ - e7000_kill, /* to_kill */ - e7000_load, /* to_load */ - 0, /* to_lookup_symbol */ - e7000_create_inferior, /* to_create_inferior */ - e7000_mourn_inferior, /* to_mourn_inferior */ - 0, /* to_can_run */ - 0, /* to_notice_signals */ - 0, /* to_thread_alive */ - 0, /* to_stop */ - process_stratum, /* to_stratum */ - 0, /* next (unused) */ - 1, /* to_has_all_memory */ - 1, /* to_has_memory */ - 1, /* to_has_stack */ - 1, /* to_has_registers */ - 1, /* to_has_execution */ - 0, /* to_sections */ - 0, /* to_sections_end */ - OPS_MAGIC, /* Always the last thing */ -}; - -void -_initialize_remote_e7000 () -{ - add_target (&e7000_ops); - - add_com ("e7000 ", class_obscure, e7000_command, - "Send a command to the e7000 monitor."); - - add_com ("ftplogin ", class_obscure, e7000_login_command, - "Login to machine and change to directory."); - - add_com ("ftpload ", class_obscure, e7000_ftp_command, - "Fetch and load a file from previously described place."); - - add_com ("drain", class_obscure, e7000_drain_command, - "Drain pending e7000 text buffers."); -} diff --git a/contrib/gdb/gdb/remote-eb.c b/contrib/gdb/gdb/remote-eb.c deleted file mode 100644 index baa4d24..0000000 --- a/contrib/gdb/gdb/remote-eb.c +++ /dev/null @@ -1,1009 +0,0 @@ -/* Remote debugging interface for AMD 29000 EBMON on IBM PC, for GDB. - Copyright 1990, 1991, 1992 Free Software Foundation, Inc. - Contributed by Cygnus Support. Written by Jim Kingdon for Cygnus. - -This file is part of GDB. - -This 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 is like remote.c but is for an esoteric situation-- - having a a29k board in a PC hooked up to a unix machine with - a serial line, and running ctty com1 on the PC, through which - the unix machine can run ebmon. Not to mention that the PC - has PC/NFS, so it can access the same executables that gdb can, - over the net in real time. */ - -#include "defs.h" -#include "gdb_string.h" - -#include "inferior.h" -#include "bfd.h" -#include "symfile.h" -#include "wait.h" -#include "value.h" -#include -#include -#include -#include -#include "terminal.h" -#include "target.h" -#include "gdbcore.h" - -extern struct target_ops eb_ops; /* Forward declaration */ - -static void eb_close(); - -#define LOG_FILE "eb.log" -#if defined (LOG_FILE) -FILE *log_file; -#endif - -static int timeout = 24; - -/* Descriptor for I/O to remote machine. Initialize it to -1 so that - eb_open knows that we don't have a file open when the program - starts. */ -int eb_desc = -1; - -/* stream which is fdopen'd from eb_desc. Only valid when - eb_desc != -1. */ -FILE *eb_stream; - -/* Read a character from the remote system, doing all the fancy - timeout stuff. */ -static int -readchar () -{ - char buf; - - buf = '\0'; -#ifdef HAVE_TERMIO - /* termio does the timeout for us. */ - read (eb_desc, &buf, 1); -#else - alarm (timeout); - if (read (eb_desc, &buf, 1) < 0) - { - if (errno == EINTR) - error ("Timeout reading from remote system."); - else - perror_with_name ("remote"); - } - alarm (0); -#endif - - if (buf == '\0') - error ("Timeout reading from remote system."); -#if defined (LOG_FILE) - putc (buf & 0x7f, log_file); -#endif - return buf & 0x7f; -} - -/* Keep discarding input from the remote system, until STRING is found. - Let the user break out immediately. */ -static void -expect (string) - char *string; -{ - char *p = string; - - immediate_quit = 1; - while (1) - { - if (readchar() == *p) - { - p++; - if (*p == '\0') - { - immediate_quit = 0; - return; - } - } - else - p = string; - } -} - -/* Keep discarding input until we see the ebmon prompt. - - The convention for dealing with the prompt is that you - o give your command - o *then* wait for the prompt. - - Thus the last thing that a procedure does with the serial line - will be an expect_prompt(). Exception: eb_resume does not - wait for the prompt, because the terminal is being handed over - to the inferior. However, the next thing which happens after that - is a eb_wait which does wait for the prompt. - Note that this includes abnormal exit, e.g. error(). This is - necessary to prevent getting into states from which we can't - recover. */ -static void -expect_prompt () -{ -#if defined (LOG_FILE) - /* This is a convenient place to do this. The idea is to do it often - enough that we never lose much data if we terminate abnormally. */ - fflush (log_file); -#endif - expect ("\n# "); -} - -/* Get a hex digit from the remote system & return its value. - If ignore_space is nonzero, ignore spaces (not newline, tab, etc). */ -static int -get_hex_digit (ignore_space) - int ignore_space; -{ - int ch; - while (1) - { - ch = readchar (); - if (ch >= '0' && ch <= '9') - return ch - '0'; - else if (ch >= 'A' && ch <= 'F') - return ch - 'A' + 10; - else if (ch >= 'a' && ch <= 'f') - return ch - 'a' + 10; - else if (ch == ' ' && ignore_space) - ; - else - { - expect_prompt (); - error ("Invalid hex digit from remote system."); - } - } -} - -/* Get a byte from eb_desc and put it in *BYT. Accept any number - leading spaces. */ -static void -get_hex_byte (byt) - char *byt; -{ - int val; - - val = get_hex_digit (1) << 4; - val |= get_hex_digit (0); - *byt = val; -} - -/* Get N 32-bit words from remote, each preceded by a space, - and put them in registers starting at REGNO. */ -static void -get_hex_regs (n, regno) - int n; - int regno; -{ - long val; - int i; - - for (i = 0; i < n; i++) - { - int j; - - val = 0; - for (j = 0; j < 8; j++) - val = (val << 4) + get_hex_digit (j == 0); - supply_register (regno++, (char *) &val); - } -} - -/* Called when SIGALRM signal sent due to alarm() timeout. */ -#ifndef HAVE_TERMIO - -#ifndef __STDC__ -#define volatile /**/ -#endif -volatile int n_alarms; - -void -eb_timer () -{ -#if 0 - if (kiodebug) - printf ("eb_timer called\n"); -#endif - n_alarms++; -} -#endif - -/* malloc'd name of the program on the remote system. */ -static char *prog_name = NULL; - -/* Nonzero if we have loaded the file ("yc") and not yet issued a "gi" - command. "gi" is supposed to happen exactly once for each "yc". */ -static int need_gi = 0; - -/* Number of SIGTRAPs we need to simulate. That is, the next - NEED_ARTIFICIAL_TRAP calls to eb_wait should just return - SIGTRAP without actually waiting for anything. */ - -static int need_artificial_trap = 0; - -/* This is called not only when we first attach, but also when the - user types "run" after having attached. */ -static void -eb_create_inferior (execfile, args, env) - char *execfile; - char *args; - char **env; -{ - int entry_pt; - - if (args && *args) - error ("Can't pass arguments to remote EBMON process"); - - if (execfile == 0 || exec_bfd == 0) - error ("No exec file specified"); - - entry_pt = (int) bfd_get_start_address (exec_bfd); - - { - /* OK, now read in the file. Y=read, C=COFF, D=no symbols - 0=start address, %s=filename. */ - - fprintf (eb_stream, "YC D,0:%s", prog_name); - - if (args != NULL) - fprintf(eb_stream, " %s", args); - - fprintf (eb_stream, "\n"); - fflush (eb_stream); - - expect_prompt (); - - need_gi = 1; - } - -/* The "process" (board) is already stopped awaiting our commands, and - the program is already downloaded. We just set its PC and go. */ - - clear_proceed_status (); - - /* Tell wait_for_inferior that we've started a new process. */ - init_wait_for_inferior (); - - /* Set up the "saved terminal modes" of the inferior - based on what modes we are starting it with. */ - target_terminal_init (); - - /* Install inferior's terminal modes. */ - target_terminal_inferior (); - - /* insert_step_breakpoint (); FIXME, do we need this? */ - proceed ((CORE_ADDR)entry_pt, TARGET_SIGNAL_DEFAULT, 0); /* Let 'er rip... */ -} - -/* Translate baud rates from integers to damn B_codes. Unix should - have outgrown this crap years ago, but even POSIX wouldn't buck it. */ - -#ifndef B19200 -#define B19200 EXTA -#endif -#ifndef B38400 -#define B38400 EXTB -#endif - -struct {int rate, damn_b;} baudtab[] = { - {0, B0}, - {50, B50}, - {75, B75}, - {110, B110}, - {134, B134}, - {150, B150}, - {200, B200}, - {300, B300}, - {600, B600}, - {1200, B1200}, - {1800, B1800}, - {2400, B2400}, - {4800, B4800}, - {9600, B9600}, - {19200, B19200}, - {38400, B38400}, - {-1, -1}, -}; - -int damn_b (rate) - int rate; -{ - int i; - - for (i = 0; baudtab[i].rate != -1; i++) - if (rate == baudtab[i].rate) return baudtab[i].damn_b; - return B38400; /* Random */ -} - - -/* Open a connection to a remote debugger. - NAME is the filename used for communication, then a space, - then the name of the program as we should name it to EBMON. */ - -static int baudrate = 9600; -static char *dev_name; -void -eb_open (name, from_tty) - char *name; - int from_tty; -{ - TERMINAL sg; - - char *p; - - target_preopen (from_tty); - - /* Find the first whitespace character, it separates dev_name from - prog_name. */ - if (name == 0) - goto erroid; - - for (p = name; - *p != '\0' && !isspace (*p); p++) - ; - if (*p == '\0') -erroid: - error ("\ -Please include the name of the device for the serial port,\n\ -the baud rate, and the name of the program to run on the remote system."); - dev_name = alloca (p - name + 1); - strncpy (dev_name, name, p - name); - dev_name[p - name] = '\0'; - - /* Skip over the whitespace after dev_name */ - for (; isspace (*p); p++) - /*EMPTY*/; - - if (1 != sscanf (p, "%d ", &baudrate)) - goto erroid; - - /* Skip the number and then the spaces */ - for (; isdigit (*p); p++) - /*EMPTY*/; - for (; isspace (*p); p++) - /*EMPTY*/; - - if (prog_name != NULL) - free (prog_name); - prog_name = savestring (p, strlen (p)); - - eb_close (0); - - eb_desc = open (dev_name, O_RDWR); - if (eb_desc < 0) - perror_with_name (dev_name); - ioctl (eb_desc, TIOCGETP, &sg); -#ifdef HAVE_TERMIO - sg.c_cc[VMIN] = 0; /* read with timeout. */ - sg.c_cc[VTIME] = timeout * 10; - sg.c_lflag &= ~(ICANON | ECHO); - sg.c_cflag = (sg.c_cflag & ~CBAUD) | damn_b (baudrate); -#else - sg.sg_ispeed = damn_b (baudrate); - sg.sg_ospeed = damn_b (baudrate); - sg.sg_flags |= RAW | ANYP; - sg.sg_flags &= ~ECHO; -#endif - - ioctl (eb_desc, TIOCSETP, &sg); - eb_stream = fdopen (eb_desc, "r+"); - - push_target (&eb_ops); - if (from_tty) - printf ("Remote %s debugging %s using %s\n", target_shortname, - prog_name, dev_name); - -#ifndef HAVE_TERMIO -#ifndef NO_SIGINTERRUPT - /* Cause SIGALRM's to make reads fail with EINTR instead of resuming - the read. */ - if (siginterrupt (SIGALRM, 1) != 0) - perror ("eb_open: error in siginterrupt"); -#endif - - /* Set up read timeout timer. */ - if ((void (*)) signal (SIGALRM, eb_timer) == (void (*)) -1) - perror ("eb_open: error in signal"); -#endif - -#if defined (LOG_FILE) - log_file = fopen (LOG_FILE, "w"); - if (log_file == NULL) - perror_with_name (LOG_FILE); -#endif - - /* Hello? Are you there? */ - write (eb_desc, "\n", 1); - - expect_prompt (); -} - -/* Close out all files and local state before this target loses control. */ - -static void -eb_close (quitting) - int quitting; -{ - - /* Due to a bug in Unix, fclose closes not only the stdio stream, - but also the file descriptor. So we don't actually close - eb_desc. */ - if (eb_stream) - fclose (eb_stream); /* This also closes eb_desc */ - if (eb_desc >= 0) - /* close (eb_desc); */ - - /* Do not try to close eb_desc again, later in the program. */ - eb_stream = NULL; - eb_desc = -1; - -#if defined (LOG_FILE) - if (log_file) { - if (ferror (log_file)) - printf ("Error writing log file.\n"); - if (fclose (log_file) != 0) - printf ("Error closing log file.\n"); - } -#endif -} - -/* Terminate the open connection to the remote debugger. - Use this when you want to detach and do something else - with your gdb. */ -void -eb_detach (from_tty) - int from_tty; -{ - pop_target(); /* calls eb_close to do the real work */ - if (from_tty) - printf ("Ending remote %s debugging\n", target_shortname); -} - -/* Tell the remote machine to resume. */ - -void -eb_resume (pid, step, sig) - int pid, step; - enum target_signal sig; -{ - if (step) - { - write (eb_desc, "t 1,s\n", 6); - /* Wait for the echo. */ - expect ("t 1,s\r"); - /* Then comes a line containing the instruction we stepped to. */ - expect ("\n@"); - /* Then we get the prompt. */ - expect_prompt (); - - /* Force the next eb_wait to return a trap. Not doing anything - about I/O from the target means that the user has to type - "continue" to see any. This should be fixed. */ - need_artificial_trap = 1; - } - else - { - if (need_gi) - { - need_gi = 0; - write (eb_desc, "gi\n", 3); - - /* Swallow the echo of "gi". */ - expect ("gi\r"); - } - else - { - write (eb_desc, "GR\n", 3); - /* Swallow the echo. */ - expect ("GR\r"); - } - } -} - -/* Wait until the remote machine stops, then return, - storing status in STATUS just as `wait' would. */ - -int -eb_wait (status) - struct target_waitstatus *status; -{ - /* Strings to look for. '?' means match any single character. - Note that with the algorithm we use, the initial character - of the string cannot recur in the string, or we will not - find some cases of the string in the input. */ - - static char bpt[] = "Invalid interrupt taken - #0x50 - "; - /* It would be tempting to look for "\n[__exit + 0x8]\n" - but that requires loading symbols with "yc i" and even if - we did do that we don't know that the file has symbols. */ - static char exitmsg[] = "\n@????????I JMPTI GR121,LR0"; - char *bp = bpt; - char *ep = exitmsg; - - /* Large enough for either sizeof (bpt) or sizeof (exitmsg) chars. */ - char swallowed[50]; - /* Current position in swallowed. */ - char *swallowed_p = swallowed; - - int ch; - int ch_handled; - - int old_timeout = timeout; - - status->kind = TARGET_WAITKIND_EXITED; - status->value.integer = 0; - - if (need_artificial_trap != 0) - { - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_TRAP; - need_artificial_trap--; - return 0; - } - - timeout = 0; /* Don't time out -- user program is running. */ - while (1) - { - ch_handled = 0; - ch = readchar (); - if (ch == *bp) - { - bp++; - if (*bp == '\0') - break; - ch_handled = 1; - - *swallowed_p++ = ch; - } - else - bp = bpt; - - if (ch == *ep || *ep == '?') - { - ep++; - if (*ep == '\0') - break; - - if (!ch_handled) - *swallowed_p++ = ch; - ch_handled = 1; - } - else - ep = exitmsg; - - if (!ch_handled) - { - char *p; - - /* Print out any characters which have been swallowed. */ - for (p = swallowed; p < swallowed_p; ++p) - putc (*p, stdout); - swallowed_p = swallowed; - - putc (ch, stdout); - } - } - expect_prompt (); - if (*bp== '\0') - { - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_TRAP; - } - else - { - status->kind = TARGET_WAITKIND_EXITED; - status->value.integer = 0; - } - timeout = old_timeout; - - return 0; -} - -/* Return the name of register number REGNO - in the form input and output by EBMON. - - Returns a pointer to a static buffer containing the answer. */ -static char * -get_reg_name (regno) - int regno; -{ - static char buf[80]; - if (regno >= GR96_REGNUM && regno < GR96_REGNUM + 32) - sprintf (buf, "GR%03d", regno - GR96_REGNUM + 96); - else if (regno >= LR0_REGNUM && regno < LR0_REGNUM + 128) - sprintf (buf, "LR%03d", regno - LR0_REGNUM); - else if (regno == Q_REGNUM) - strcpy (buf, "SR131"); - else if (regno >= BP_REGNUM && regno <= CR_REGNUM) - sprintf (buf, "SR%03d", regno - BP_REGNUM + 133); - else if (regno == ALU_REGNUM) - strcpy (buf, "SR132"); - else if (regno >= IPC_REGNUM && regno <= IPB_REGNUM) - sprintf (buf, "SR%03d", regno - IPC_REGNUM + 128); - else if (regno >= VAB_REGNUM && regno <= LRU_REGNUM) - sprintf (buf, "SR%03d", regno - VAB_REGNUM); - else if (regno == GR1_REGNUM) - strcpy (buf, "GR001"); - return buf; -} - -/* Read the remote registers into the block REGS. */ - -static void -eb_fetch_registers () -{ - int reg_index; - int regnum_index; - char tempbuf[10]; - int i; - -#if 0 - /* This should not be necessary, because one is supposed to read the - registers only when the inferior is stopped (at least with - ptrace() and why not make it the same for remote?). */ - /* ^A is the "normal character" used to make sure we are talking to EBMON - and not to the program being debugged. */ - write (eb_desc, "\001\n"); - expect_prompt (); -#endif - - write (eb_desc, "dw gr96,gr127\n", 14); - for (reg_index = 96, regnum_index = GR96_REGNUM; - reg_index < 128; - reg_index += 4, regnum_index += 4) - { - sprintf (tempbuf, "GR%03d ", reg_index); - expect (tempbuf); - get_hex_regs (4, regnum_index); - expect ("\n"); - } - - for (i = 0; i < 128; i += 32) - { - /* The PC has a tendency to hang if we get these - all in one fell swoop ("dw lr0,lr127"). */ - sprintf (tempbuf, "dw lr%d\n", i); - write (eb_desc, tempbuf, strlen (tempbuf)); - for (reg_index = i, regnum_index = LR0_REGNUM + i; - reg_index < i + 32; - reg_index += 4, regnum_index += 4) - { - sprintf (tempbuf, "LR%03d ", reg_index); - expect (tempbuf); - get_hex_regs (4, regnum_index); - expect ("\n"); - } - } - - write (eb_desc, "dw sr133,sr133\n", 15); - expect ("SR133 "); - get_hex_regs (1, BP_REGNUM); - expect ("\n"); - - write (eb_desc, "dw sr134,sr134\n", 15); - expect ("SR134 "); - get_hex_regs (1, FC_REGNUM); - expect ("\n"); - - write (eb_desc, "dw sr135,sr135\n", 15); - expect ("SR135 "); - get_hex_regs (1, CR_REGNUM); - expect ("\n"); - - write (eb_desc, "dw sr131,sr131\n", 15); - expect ("SR131 "); - get_hex_regs (1, Q_REGNUM); - expect ("\n"); - - write (eb_desc, "dw sr0,sr14\n", 12); - for (reg_index = 0, regnum_index = VAB_REGNUM; - regnum_index <= LRU_REGNUM; - regnum_index += 4, reg_index += 4) - { - sprintf (tempbuf, "SR%03d ", reg_index); - expect (tempbuf); - get_hex_regs (reg_index == 12 ? 3 : 4, regnum_index); - expect ("\n"); - } - - /* There doesn't seem to be any way to get these. */ - { - int val = -1; - supply_register (FPE_REGNUM, (char *) &val); - supply_register (INTE_REGNUM, (char *) &val); - supply_register (FPS_REGNUM, (char *) &val); - supply_register (EXO_REGNUM, (char *) &val); - } - - write (eb_desc, "dw gr1,gr1\n", 11); - expect ("GR001 "); - get_hex_regs (1, GR1_REGNUM); - expect_prompt (); -} - -/* Fetch register REGNO, or all registers if REGNO is -1. - Returns errno value. */ -void -eb_fetch_register (regno) - int regno; -{ - if (regno == -1) - eb_fetch_registers (); - else - { - char *name = get_reg_name (regno); - fprintf (eb_stream, "dw %s,%s\n", name, name); - expect (name); - expect (" "); - get_hex_regs (1, regno); - expect_prompt (); - } - return; -} - -/* Store the remote registers from the contents of the block REGS. */ - -static void -eb_store_registers () -{ - int i, j; - fprintf (eb_stream, "s gr1,%x\n", read_register (GR1_REGNUM)); - expect_prompt (); - - for (j = 0; j < 32; j += 16) - { - fprintf (eb_stream, "s gr%d,", j + 96); - for (i = 0; i < 15; ++i) - fprintf (eb_stream, "%x,", read_register (GR96_REGNUM + j + i)); - fprintf (eb_stream, "%x\n", read_register (GR96_REGNUM + j + 15)); - expect_prompt (); - } - - for (j = 0; j < 128; j += 16) - { - fprintf (eb_stream, "s lr%d,", j); - for (i = 0; i < 15; ++i) - fprintf (eb_stream, "%x,", read_register (LR0_REGNUM + j + i)); - fprintf (eb_stream, "%x\n", read_register (LR0_REGNUM + j + 15)); - expect_prompt (); - } - - fprintf (eb_stream, "s sr133,%x,%x,%x\n", read_register (BP_REGNUM), - read_register (FC_REGNUM), read_register (CR_REGNUM)); - expect_prompt (); - fprintf (eb_stream, "s sr131,%x\n", read_register (Q_REGNUM)); - expect_prompt (); - fprintf (eb_stream, "s sr0,"); - for (i = 0; i < 11; ++i) - fprintf (eb_stream, "%x,", read_register (VAB_REGNUM + i)); - fprintf (eb_stream, "%x\n", read_register (VAB_REGNUM + 11)); - expect_prompt (); -} - -/* Store register REGNO, or all if REGNO == 0. - Return errno value. */ -void -eb_store_register (regno) - int regno; -{ - if (regno == -1) - eb_store_registers (); - else - { - char *name = get_reg_name (regno); - fprintf (eb_stream, "s %s,%x\n", name, read_register (regno)); - /* Setting GR1 changes the numbers of all the locals, so - invalidate the register cache. Do this *after* calling - read_register, because we want read_register to return the - value that write_register has just stuffed into the registers - array, not the value of the register fetched from the - inferior. */ - if (regno == GR1_REGNUM) - registers_changed (); - expect_prompt (); - } -} - -/* Get ready to modify the registers array. On machines which store - individual registers, this doesn't need to do anything. On machines - which store all the registers in one fell swoop, this makes sure - that registers contains all the registers from the program being - debugged. */ - -void -eb_prepare_to_store () -{ - /* Do nothing, since we can store individual regs */ -} - - -/* FIXME-someday! Merge these two. */ -int -eb_xfer_inferior_memory (memaddr, myaddr, len, write, target) - CORE_ADDR memaddr; - char *myaddr; - int len; - int write; - struct target_ops *target; /* ignored */ -{ - if (write) - return eb_write_inferior_memory (memaddr, myaddr, len); - else - return eb_read_inferior_memory (memaddr, myaddr, len); -} - -void -eb_files_info () -{ - printf ("\tAttached to %s at %d baud and running program %s.\n", - dev_name, baudrate, prog_name); -} - -/* Copy LEN bytes of data from debugger memory at MYADDR - to inferior's memory at MEMADDR. Returns length moved. */ -int -eb_write_inferior_memory (memaddr, myaddr, len) - CORE_ADDR memaddr; - char *myaddr; - int len; -{ - int i; - - for (i = 0; i < len; i++) - { - if ((i % 16) == 0) - fprintf (eb_stream, "sb %x,", memaddr + i); - if ((i % 16) == 15 || i == len - 1) - { - fprintf (eb_stream, "%x\n", ((unsigned char *)myaddr)[i]); - expect_prompt (); - } - else - fprintf (eb_stream, "%x,", ((unsigned char *)myaddr)[i]); - } - return len; -} - -/* Read LEN bytes from inferior memory at MEMADDR. Put the result - at debugger address MYADDR. Returns length moved. */ -int -eb_read_inferior_memory(memaddr, myaddr, len) - CORE_ADDR memaddr; - char *myaddr; - int len; -{ - int i; - - /* Number of bytes read so far. */ - int count; - - /* Starting address of this pass. */ - unsigned long startaddr; - - /* Number of bytes to read in this pass. */ - int len_this_pass; - - /* Note that this code works correctly if startaddr is just less - than UINT_MAX (well, really CORE_ADDR_MAX if there was such a - thing). That is, something like - eb_read_bytes (CORE_ADDR_MAX - 4, foo, 4) - works--it never adds len to memaddr and gets 0. */ - /* However, something like - eb_read_bytes (CORE_ADDR_MAX - 3, foo, 4) - doesn't need to work. Detect it and give up if there's an attempt - to do that. */ - if (((memaddr - 1) + len) < memaddr) { - errno = EIO; - return 0; - } - - startaddr = memaddr; - count = 0; - while (count < len) - { - len_this_pass = 16; - if ((startaddr % 16) != 0) - len_this_pass -= startaddr % 16; - if (len_this_pass > (len - count)) - len_this_pass = (len - count); - - fprintf (eb_stream, "db %x,%x\n", startaddr, - (startaddr - 1) + len_this_pass); - expect ("\n"); - - /* Look for 8 hex digits. */ - i = 0; - while (1) - { - if (isxdigit (readchar ())) - ++i; - else - { - expect_prompt (); - error ("Hex digit expected from remote system."); - } - if (i >= 8) - break; - } - - expect (" "); - - for (i = 0; i < len_this_pass; i++) - get_hex_byte (&myaddr[count++]); - - expect_prompt (); - - startaddr += len_this_pass; - } - return len; -} - -static void -eb_kill (args, from_tty) - char *args; - int from_tty; -{ - return; /* Ignore attempts to kill target system */ -} - -/* Clean up when a program exits. - - The program actually lives on in the remote processor's RAM, and may be - run again without a download. Don't leave it full of breakpoint - instructions. */ - -void -eb_mourn_inferior () -{ - remove_breakpoints (); - unpush_target (&eb_ops); - generic_mourn_inferior (); /* Do all the proper things now */ -} -/* Define the target subroutine names */ - -struct target_ops eb_ops = { - "amd-eb", "Remote serial AMD EBMON target", - "Use a remote computer running EBMON connected by a serial line.\n\ -Arguments are the name of the device for the serial line,\n\ -the speed to connect at in bits per second, and the filename of the\n\ -executable as it exists on the remote computer. For example,\n\ - target amd-eb /dev/ttya 9600 demo", - eb_open, eb_close, - 0, eb_detach, eb_resume, eb_wait, - eb_fetch_register, eb_store_register, - eb_prepare_to_store, - eb_xfer_inferior_memory, eb_files_info, - 0, 0, /* Breakpoints */ - 0, 0, 0, 0, 0, /* Terminal handling */ - eb_kill, - generic_load, /* load */ - 0, /* lookup_symbol */ - eb_create_inferior, - eb_mourn_inferior, - 0, /* can_run */ - 0, /* notice_signals */ - 0, /* to_stop */ - process_stratum, 0, /* next */ - 1, 1, 1, 1, 1, /* all mem, mem, stack, regs, exec */ - 0, 0, /* Section pointers */ - OPS_MAGIC, /* Always the last thing */ -}; - -void -_initialize_remote_eb () -{ - add_target (&eb_ops); -} diff --git a/contrib/gdb/gdb/remote-es.c b/contrib/gdb/gdb/remote-es.c deleted file mode 100644 index b4e60ef..0000000 --- a/contrib/gdb/gdb/remote-es.c +++ /dev/null @@ -1,2152 +0,0 @@ -/* Memory-access and commands for remote es1800 processes, for GDB. - Copyright (C) 1988, 1992 Free Software Foundation, Inc. - - This file is added to GDB to make it possible to do debugging via an - ES-1800 emulator. The code was originally written by Johan Holmberg - TT/SJ Ericsson Telecom AB and later modified by Johan Henriksson - TT/SJ. It was modified for gdb 4.0 by TX/DK Jan Nordenand by TX/DKG - Harald Johansen. - -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 1, 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. */ - - -/* Emulator communication protocol. - All values are encoded in ascii hex digits. - - Request -Command -Reply - read registers: -DR - - 0 - - 1 - - 2 - - 3 - - 4 - - 5 - -- 6 - - 7 - -D = XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX -A = XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX - PC = XXXXXX SSP = XXXXXX USP = XXXXXX SR = XXXXXXXX - > -Each byte of register data is described by two hex digits. - - write regs -D0=XXXXXXXX - >D1=XXXXXXXX - >D2=XXXXXXXX - >D3=XXXXXXXX - >D4=XXXXXXXX - >D5=XXXXXXXX - >D6=XXXXXXXX - >D7=XXXXXXXX - >A0=XXXXXXXX - >A1=XXXXXXXX - >A2=XXXXXXXX - >A3=XXXXXXXX - >A4=XXXXXXXX - >A5=XXXXXXXX - >A6=XXXXXXXX - >A7=XXXXXXXX - >SR=XXXXXXXX - >PC=XXXXXX - > -Each byte of register data is described by two hex digits. - - read mem -@.BAA..AA -$FFFFFFXX - > -AA..AA is address, XXXXXXX is the contents - - write mem - @.BAA..AA=$XXXXXXXX - > -AA..AA is address, XXXXXXXX is data - - cont -PC=$AA..AA - >RBK -R> -AA..AA is address to resume. If AA..AA is omitted, resume at same address. - - step -PC=$AA..AA - >STP -R> -AA..AA is address to resume. If AA..AA is omitted, resume at same address. - - kill req -STP - > -*/ - - -#include -#include -#include -#include -#include -#include -#include "gdb_string.h" -#include -#include -#include "defs.h" -#include "frame.h" -#include "inferior.h" -#include "target.h" -#include "wait.h" -#include "command.h" -#include "remote-utils.h" -#include "gdbcore.h" -#include "serial.h" - -/* Prototypes for local functions */ - -static void -es1800_child_detach PARAMS ((char *, int)); - -static void -es1800_child_open PARAMS ((char *, int)); - -static void -es1800_transparent PARAMS ((char *, int)); - -static void -es1800_create_inferior PARAMS ((char *, char *, char **)); - -static void -es1800_load PARAMS ((char *, int)); - -static void -es1800_kill PARAMS ((void)); - -static int -verify_break PARAMS ((int)); - -static int -es1800_remove_breakpoint PARAMS ((CORE_ADDR, char *)); - -static int -es1800_insert_breakpoint PARAMS ((CORE_ADDR, char *)); - -static void -es1800_files_info PARAMS ((struct target_ops *)); - -static int -es1800_xfer_inferior_memory PARAMS ((CORE_ADDR, char *, int, int, - struct target_ops *)); - -static void -es1800_prepare_to_store PARAMS ((void)); - -static int es1800_wait PARAMS ((int, struct target_waitstatus *)); - -static void es1800_resume PARAMS ((int, int, enum target_signal)); - -static void -es1800_detach PARAMS ((char *, int)); - -static void -es1800_attach PARAMS ((char *, int)); - -static int -damn_b PARAMS ((char *)); - -static void -es1800_open PARAMS ((char *, int)); - -static void -es1800_timer PARAMS ((void)); - -static void -es1800_reset PARAMS ((char *)); - -static void -es1800_request_quit PARAMS ((void)); - -static int -readchar PARAMS ((void)); - -static void -expect PARAMS ((char *, int)); - -static void -expect_prompt PARAMS ((void)); - -static void -download PARAMS ((FILE *, int, int)); - -#if 0 -static void -bfd_copy PARAMS ((bfd *, bfd *)); -#endif - -static void -get_break_addr PARAMS ((int, CORE_ADDR *)); - -static int -fromhex PARAMS ((int)); - -static int -tohex PARAMS ((int)); - -static void -es1800_close PARAMS ((int)); - -static void -es1800_fetch_registers PARAMS ((void)); - -static void -es1800_fetch_register PARAMS ((int)); - -static void -es1800_store_register PARAMS ((int)); - -static void -es1800_read_bytes PARAMS ((CORE_ADDR, char *, int)); - -static void -es1800_write_bytes PARAMS ((CORE_ADDR, char *, int)); - -static void -send_with_reply PARAMS ((char *, char *, int)); - -static void -send_command PARAMS ((char *)); - -static void -send PARAMS ((char *)); - -static void -getmessage PARAMS ((char *, int)); - -static void -es1800_mourn_inferior PARAMS ((void)); - -static void -es1800_create_break_insn PARAMS ((char *, int)); - -static void -es1800_init_break PARAMS ((char *, int)); - -/* Local variables */ - -/* FIXME: Convert this to use "set remotedebug" instead. */ -#define LOG_FILE "es1800.log" -#if defined (LOG_FILE) -static FILE *log_file; -#endif - -extern struct target_ops es1800_ops; /* Forward decl */ -extern struct target_ops es1800_child_ops; /* Forward decl */ - -static int kiodebug; -static int timeout = 100; -static char *savename; /* Name of i/o device used */ -static serial_ttystate es1800_saved_ttystate; -static int es1800_fc_save; /* Save fcntl state */ - -/* indicates that the emulator uses 32-bit data-adress (68020-mode) - instead of 24-bit (68000 -mode) */ - -static int m68020; - -#define MODE (m68020 ? "M68020" : "M68000" ) -#define ES1800_BREAK_VEC (0xf) - -/* Descriptor for I/O to remote machine. Initialize it to NULL so that - es1800_open knows that we don't have a file open when the program - starts. */ - -static serial_t es1800_desc = NULL; - -#define PBUFSIZ 1000 -#define HDRLEN sizeof("@.BAAAAAAAA=$VV\r") - -/* Maximum number of bytes to read/write at once. The value here - is chosen to fill up a packet. */ - -#define MAXBUFBYTES ((PBUFSIZ-150)*16/75 ) - -static int es1800_break_vec = 0; -static char es1800_break_insn[2]; -static long es1800_break_address; -static void (*old_sigint)(); /* Old signal-handler for sigint */ -static jmp_buf interrupt; - -/* Local signalhandler to allow breaking tranfers or program run. - Rely on global variables: old_sigint(), interrupt */ - -static void -es1800_request_quit () -{ - /* restore original signalhandler */ - signal (SIGINT, old_sigint); - longjmp (interrupt, 1); -} - - -/* Reset emulator. - Sending reset character(octal 32) to emulator. - quit - return to '(esgdb)' prompt or continue */ - -static void -es1800_reset (quit) - char *quit; -{ - char buf[80]; - - if (quit) - { - printf ("\nResetting emulator... "); - } - strcpy (buf, "\032"); - send (buf); - expect_prompt (); - if (quit) - { - error ("done\n"); - } -} - - -/* Open a connection to a remote debugger and push the new target - onto the stack. Check if the emulator is responding and find out - what kind of processor the emulator is connected to. - Initiate the breakpoint handling in the emulator. - - name - the filename used for communication (ex. '/dev/tta') - from_tty - says whether to be verbose or not */ - -static void -es1800_open (name, from_tty) - char *name; - int from_tty; -{ - char buf[PBUFSIZ]; - char *p; - int i, fcflag; - - m68020 = 0; - - if (!name) /* no device name given in target command */ - { - error_no_arg ("serial port device name"); - } - - target_preopen (from_tty); - es1800_close (0); - - /* open the device and configure it for communication */ - -#ifndef DEBUG_STDIN - - es1800_desc = SERIAL_OPEN (name); - if (es1800_desc == NULL) - { - perror_with_name (name); - } - savename = savestring (name, strlen (name)); - - es1800_saved_ttystate = SERIAL_GET_TTY_STATE (es1800_desc); - - if ((fcflag = fcntl (es1800_desc->fd, F_GETFL, 0)) == -1) - { - perror_with_name ("fcntl serial"); - } - es1800_fc_save = fcflag; - - fcflag = (fcflag & (FREAD | FWRITE)); /* mask out any funny stuff */ - if (fcntl (es1800_desc->fd, F_SETFL, fcflag) == -1) - { - perror_with_name ("fcntl serial"); - } - - if (baud_rate != -1) - { - if (SERIAL_SETBAUDRATE (es1800_desc, baud_rate)) - { - SERIAL_CLOSE (es1800_desc); - perror_with_name (name); - } - } - - SERIAL_RAW (es1800_desc); - - /* If there is something sitting in the buffer we might take it as a - response to a command, which would be bad. */ - SERIAL_FLUSH_INPUT (es1800_desc); - -#endif /* DEBUG_STDIN */ - - push_target (&es1800_ops); /* Switch to using remote target now */ - if (from_tty) - { - printf ("Remote ES1800 debugging using %s\n", name); - } - -#if defined (LOG_FILE) - - log_file = fopen (LOG_FILE, "w"); - if (log_file == NULL) - { - perror_with_name (LOG_FILE); - } - -#endif /* LOG_FILE */ - - /* Hello? Are you there?, also check mode */ - - /* send_with_reply( "DB 0 TO 1", buf, sizeof(buf)); */ - /* for (p = buf, i = 0; *p++ =='0';) */ /* count the number of zeros */ - /* i++; */ - - send ("\032"); - getmessage (buf, sizeof (buf)); /* send reset character */ - - if (from_tty) - { - printf ("Checking mode.... "); - } - /* m68020 = (i==8); */ /* if eight zeros then we are in m68020 mode */ - - /* What kind of processor am i talking to ?*/ - p = buf; - while (*p++ != '\n') {;} - while (*p++ != '\n') {;} - while (*p++ != '\n') {;} - for (i = 0; i < 20; i++, p++) {;} - m68020 = !strncmp (p, "68020", 5); - if (from_tty) - { - printf ("You are in %s(%c%c%c%c%c)-mode\n", MODE, p[0], p[1], p[2], - p[3], p[4]); - } - - /* if no init_break statement is present in .gdb file we have to check - whether to download a breakpoint routine or not */ - -#if 0 - if ((es1800_break_vec == 0) || (verify_break (es1800_break_vec) != 0) - && query ("No breakpoint routine in ES 1800 emulator!\nDownload a breakpoint routine to the emulator? ")) - { - CORE_ADDR memaddress; - printf ("Give the start address of the breakpoint routine: "); - scanf ("%li", &memaddress); - es1800_init_break ((es1800_break_vec ? es1800_break_vec : - ES1800_BREAK_VEC), memaddress); - } -#endif - -} - -/* Close out all files and local state before this target loses control. - quitting - are we quitting gdb now? */ - -static void -es1800_close (quitting) - int quitting; -{ - if (es1800_desc != NULL) - { - printf ("\nClosing connection to emulator...\n"); - if (SERIAL_SET_TTY_STATE (es1800_desc, es1800_saved_ttystate) < 0) - print_sys_errmsg ("warning: unable to restore tty state", errno); - fcntl (es1800_desc->fd, F_SETFL, es1800_fc_save); - SERIAL_CLOSE (es1800_desc); - es1800_desc = NULL; - } - if (savename != NULL) - { - free (savename); - } - savename = NULL; - -#if defined (LOG_FILE) - - if (log_file != NULL) - { - if (ferror (log_file)) - { - printf ("Error writing log file.\n"); - } - if (fclose (log_file) != 0) - { - printf ("Error closing log file.\n"); - } - log_file = NULL; - } - -#endif /* LOG_FILE */ - -} - -/* Attaches to a process on the target side - proc_id - the id of the process to be attached. - from_tty - says whether to be verbose or not */ - -static void -es1800_attach (args, from_tty) - char *args; - int from_tty; -{ - error ("Cannot attach to pid %s, this feature is not implemented yet.", - args); -} - - -/* Takes a program previously attached to and detaches it. - We better not have left any breakpoints - in the program or it'll die when it hits one. - Close the open connection to the remote debugger. - Use this when you want to detach and do something else - with your gdb. - - args - arguments given to the 'detach' command - from_tty - says whether to be verbose or not */ - -static void -es1800_detach (args, from_tty) - char *args; - int from_tty; -{ - if (args) - { - error ("Argument given to \"detach\" when remotely debugging."); - } - pop_target (); - if (from_tty) - { - printf ("Ending es1800 remote debugging.\n"); - } -} - - -/* Tell the remote machine to resume. - step - single-step or run free - siggnal - the signal value to be given to the target (0 = no signal) */ - -static void -es1800_resume (pid, step, siggnal) - int pid; - int step; - enum target_signal siggnal; -{ - char buf[PBUFSIZ]; - - if (siggnal) - { - error ("Can't send signals to a remote system."); - } - if (step) - { - strcpy (buf,"STP\r"); - send (buf); - } - else - { - send_command ("RBK"); - } -} - -/* Wait until the remote machine stops, then return, - storing status in STATUS just as `wait' would. - status - */ - -static int -es1800_wait (pid, status) - int pid; - struct target_waitstatus *status; -{ - unsigned char buf[PBUFSIZ]; - int old_timeout = timeout; - - status->kind = TARGET_WAITKIND_EXITED; - status->value.integer = 0; - - timeout = 0; /* Don't time out -- user program is running. */ - if (!setjmp (interrupt)) - { - old_sigint = signal (SIGINT, es1800_request_quit); - while (1) - { - getmessage (buf, sizeof(buf)); - if (strncmp ( buf, "\r\n* BREAK *", 11) == 0) - { - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_TRAP; - send_command ("STP"); /* Restore stack and PC and such */ - if (m68020) - { - send_command ("STP"); - } - break; - } - if (strncmp (buf, "STP\r\n ", 6) == 0) - { - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_TRAP; - break; - } - if (buf[strlen (buf) - 2] == 'R') - { - printf ("Unexpected emulator reply: \n%s\n", buf); - } - else - { - printf ("Unexpected stop: \n%s\n", buf); - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_QUIT; - break; - } - } - } - else - { - fflush (stdin); - printf ("\nStopping emulator..."); - if (!setjmp (interrupt)) - { - old_sigint = signal (SIGINT, es1800_request_quit); - send_command ("STP"); - printf (" emulator stopped\n"); - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_INT; - } - else - { - fflush (stdin); - es1800_reset ((char*) 1); - } - } - signal (SIGINT, old_sigint); - timeout = old_timeout; - return (0); -} - - -/* Fetch register values from remote machine. - regno - the register to be fetched (fetch all registers if -1) */ - -static void -es1800_fetch_register (regno) - int regno; -{ - char buf[PBUFSIZ]; - int k; - int r; - char *p; - static char regtab[18][4] = - { - "D0 ", "D1 ", "D2 ", "D3 ", "D4 ", "D5 ", "D6 ", "D7 ", - "A0 ", "A1 ", "A2 ", "A3 ", "A4 ", "A5 ", "A6 ", "SSP", - "SR ", "PC " - }; - - if ((regno < 15) || (regno == 16) || (regno == 17)) - { - r = regno * 4; - send_with_reply (regtab[regno], buf, sizeof (buf)); - p = buf; - for (k = 0; k < 4; k++) - { - if ((p[k*2 + 1] == 0) || (p[k*2 + 2] == 0)) - { - error ("Emulator reply is too short: %s", buf); - } - registers[r++] = (fromhex (p[k*2 + 1]) * 16) + fromhex (p[k*2 + 2]); - } - } - else - { - es1800_fetch_registers (); - } -} - -/* Read the remote registers into REGISTERS. - Always fetches all registers. */ - -static void -es1800_fetch_registers () -{ - char buf[PBUFSIZ]; - char SR_buf[PBUFSIZ]; - int i; - int k; - int r; - char *p; - - send_with_reply ("DR", buf, sizeof (buf)); - - /* Reply is edited to a string that describes registers byte by byte, - each byte encoded as two hex characters. */ - - p = buf; - r = 0; - - /* parsing row one - D0-D7-registers */ - - while (*p++ != '\n') {;} - for (i = 4; i < 70; i += (i == 39 ? 3 : 1)) - { - for (k = 0; k < 4; k++) - { - if (p[i+0] == 0 || p[i+1] == 0) - { - error ("Emulator reply is too short: %s", buf); - } - registers[r++] = (fromhex (p[i+0]) * 16) + fromhex (p[i+1]); - i += 2; - } - } - p += i; - - /* parsing row two - A0-A6-registers */ - - while (*p++ != '\n') {;} - for (i = 4; i < 61; i += (i == 39 ? 3 : 1)) - { - for (k = 0; k < 4; k++) - { - if (p[i+0] == 0 || p[i+1] == 0) - { - error ("Emulator reply is too short: %s", buf); - } - registers[r++] = (fromhex (p[i+0])) * 16 + fromhex (p[i+1]); - i += 2; - } - } - p += i; - - while (*p++ != '\n') {;} - - /* fetch SSP-, SR- and PC-registers */ - - /* first - check STATUS-word and decide which stackpointer to use */ - - send_with_reply ("SR", SR_buf, sizeof (SR_buf)); - p = SR_buf; - p += 5; - - if (m68020) - { - if (*p == '3') /* use masterstackpointer MSP */ - { - send_with_reply ("MSP", buf, sizeof (buf)); - } - else if (*p == '2') /* use interruptstackpointer ISP */ - { - send_with_reply ("ISP", buf, sizeof (buf)); - } - else /* use userstackpointer USP */ - { - send_with_reply ("USP", buf, sizeof (buf)); - } - p = buf; - for (k = 0; k<4; k++) - { - if (p[k*2+1] == 0 || p[k*2+2] == 0) - { - error ("Emulator reply is too short: %s", buf); - } - registers[r++] = fromhex (buf[k*2+1]) * 16 + fromhex (buf[k*2+2]); - } - - p = SR_buf; - for (k = 0; k < 4; k++) - { - if (p[k*2+1] == 0 || p[k*2+2] == 0) - { - error ("Emulator reply is too short: %s", buf); - } - registers[r++] = - fromhex (SR_buf[k*2+1]) * 16 + fromhex (SR_buf[k*2+2]); - } - send_with_reply ("PC", buf, sizeof (buf)); - p = buf; - for (k = 0; k<4; k++) - { - if (p[k*2+1] == 0 || p[k*2+2] == 0) - { - error ("Emulator reply is too short: %s", buf); - } - registers[r++] = fromhex (buf[k*2+1]) * 16 + fromhex (buf[k*2+2]); - } - } - else /* 68000-mode */ - { - if (*p == '2') /* use supervisorstackpointer SSP */ - { - send_with_reply ("SSP", buf, sizeof (buf)); - } - else /* use userstackpointer USP */ - { - send_with_reply ("USP", buf, sizeof (buf)); - } - - /* fetch STACKPOINTER */ - - p = buf; - for (k = 0; k < 4; k++) - { - if (p[k*2 + 1] == 0 || p[k*2 + 2] == 0) - { - error ("Emulator reply is too short: %s", buf); - } - registers[r++] = fromhex (buf[k*2+1]) * 16 + fromhex (buf[k*2+2]); - } - - /* fetch STATUS */ - - p = SR_buf; - for (k = 0; k < 4; k++) - { - if (p[k*2+1] == 0 || p[k*2+2] == 0) - { - error ("Emulator reply is too short: %s", buf); - } - registers[r++] = - fromhex (SR_buf[k*2+1]) * 16 + fromhex (SR_buf[k*2+2]); - } - - /* fetch PC */ - - send_with_reply ("PC", buf, sizeof (buf)); - p = buf; - for (k = 0; k < 4; k++) - { - if (p[k*2+1] == 0 || p[k*2+2] == 0) - { - error ("Emulator reply is too short: %s", buf); - } - registers[r++] = fromhex (buf[k*2+1]) * 16 + fromhex (buf[k*2+2]); - } - } -} - -/* Store register value, located in REGISTER, on the target processor. - regno - the register-number of the register to store - (-1 means store them all) - FIXME: Return errno value. */ - -static void -es1800_store_register(regno) - int regno; -{ - - static char regtab[18][4] = - { - "D0 ", "D1 ", "D2 ", "D3 ", "D4 ", "D5 ", "D6 ", "D7 ", - "A0 ", "A1 ", "A2 ", "A3 ", "A4 ", "A5 ", "A6 ", "SSP", - "SR ", "PC " - }; - - char buf[PBUFSIZ]; - char SR_buf[PBUFSIZ]; - char stack_pointer[4]; - char *p; - int i; - int j; - int k; - unsigned char *r; - - r = (unsigned char *) registers; - - if (regno == -1) /* write all registers */ - { - j = 0; - k = 18; - } - else /* write one register */ - { - j = regno; - k = regno+1; - r += regno * 4; - } - - if ((regno == -1) || (regno == 15)) - { - /* fetch current status */ - send_with_reply ("SR", SR_buf, sizeof (SR_buf)); - p = SR_buf; - p += 5; - if (m68020) - { - if (*p == '3') /* use masterstackpointer MSP */ - { - strcpy (stack_pointer,"MSP"); - } - else - { - if (*p == '2') /* use interruptstackpointer ISP */ - { - strcpy (stack_pointer,"ISP"); - } - else - { - strcpy (stack_pointer,"USP"); /* use userstackpointer USP */ - } - } - } - else /* 68000-mode */ - { - if (*p == '2') /* use supervisorstackpointer SSP */ - { - strcpy (stack_pointer,"SSP"); - } - else - { - strcpy (stack_pointer,"USP");/* use userstackpointer USP */ - } - } - strcpy (regtab[15],stack_pointer); - } - - for (i = j; i> 4) & 0x0f); - buf[6] = tohex (*r++ & 0x0f); - buf[7] = tohex ((*r >> 4) & 0x0f); - buf[8] = tohex (*r++ & 0x0f); - buf[9] = tohex ((*r >> 4) & 0x0f); - buf[10] = tohex (*r++ & 0x0f); - buf[11] = tohex ((*r >> 4) & 0x0f); - buf[12] = tohex (*r++ & 0x0f); - buf[13] = 0; - - send_with_reply (buf, buf, sizeof (buf)); /* FIXME, reply not used? */ - } -} - - -/* Prepare to store registers. */ - -static void -es1800_prepare_to_store () -{ - /* Do nothing, since we can store individual regs */ -} - -/* Convert hex digit A to a number. */ - -static int -fromhex (a) - int a; -{ - if (a >= '0' && a <= '9') - { - return a - '0'; - } - else if (a >= 'a' && a <= 'f') - { - return a - 'a' + 10; - } - else if (a >= 'A' && a <= 'F') - { - return a - 'A' + 10; - } - else - { - error ("Reply contains invalid hex digit"); - } - return (-1); -} - - -/* Convert number NIB to a hex digit. */ - -static int -tohex (nib) - int nib; -{ - if (nib < 10) - { - return ('0' + nib); - } - else - { - return ('A' + nib - 10); - } -} - -/* Read or write LEN bytes from inferior memory at MEMADDR, transferring - to or from debugger address MYADDR. Write to inferior if WRITE is - nonzero. Returns length of data written or read; 0 for error. - - memaddr - the target's address - myaddr - gdb's address - len - number of bytes - write - write if != 0 otherwise read */ - -static int -es1800_xfer_inferior_memory (memaddr, myaddr, len, write, tops) - CORE_ADDR memaddr; - char *myaddr; - int len; - int write; - struct target_ops *tops; /* Unused */ -{ - int origlen = len; - int xfersize; - - while (len > 0) - { - xfersize = len > MAXBUFBYTES ? MAXBUFBYTES : len; - if (write) - { - es1800_write_bytes (memaddr, myaddr, xfersize); - } - else - { - es1800_read_bytes (memaddr, myaddr, xfersize); - } - memaddr += xfersize; - myaddr += xfersize; - len -= xfersize; - } - return (origlen); /* no error possible */ -} - - -/* Write memory data directly to the emulator. - This does not inform the data cache; the data cache uses this. - MEMADDR is the address in the remote memory space. - MYADDR is the address of the buffer in our space. - LEN is the number of bytes. - - memaddr - the target's address - myaddr - gdb's address - len - number of bytes */ - -static void -es1800_write_bytes (memaddr, myaddr, len) - CORE_ADDR memaddr; - char *myaddr; - int len; -{ - char buf[PBUFSIZ]; - int i; - char *p; - - p = myaddr; - for (i = 0; i < len; i++) - { - sprintf (buf, "@.B$%x=$%x", memaddr+i, (*p++) & 0xff); - send_with_reply (buf, buf, sizeof (buf)); /* FIXME send_command? */ - } -} - - -/* Read memory data directly from the emulator. - This does not use the data cache; the data cache uses this. - - memaddr - the target's address - myaddr - gdb's address - len - number of bytes */ - -static void -es1800_read_bytes (memaddr, myaddr, len) - CORE_ADDR memaddr; - char *myaddr; - int len; -{ - static int DB_tab[16] = {8,11,14,17,20,23,26,29,34,37,40,43,46,49,52,55}; - char buf[PBUFSIZ]; - int i; - int low_addr; - char *p; - char *b; - - if (len > PBUFSIZ / 2 - 1) - { - abort (); - } - - if (len == 1) /* The emulator does not like expressions like: */ - { - len = 2; /* DB.B $20018 TO $20018 */ - } - - /* Reply describes registers byte by byte, each byte encoded as two hex - characters. */ - - sprintf (buf, "DB.B $%x TO $%x", memaddr, memaddr+len-1); - send_with_reply (buf, buf, sizeof (buf)); - b = buf; - low_addr = memaddr&0x0f; - for (i = low_addr; i < low_addr + len; i++) - { - if ((!(i % 16)) && i) - { /* if (i = 16,32,48) */ - while (*p++!='\n') {;} - b = p; - } - p = b + DB_tab[i%16] + (m68020 ? 2 : 0); - if (p[0] == 32 || p[1] == 32) - { - error ("Emulator reply is too short: %s", buf); - } - myaddr[i-low_addr] = fromhex (p[0]) * 16 + fromhex (p[1]); - } -} - -/* Information about the current target */ - -static void -es1800_files_info (tops) - struct target_ops *tops; /* Unused */ -{ - printf ("ES1800 Attached to %s at %d baud in %s mode\n", savename, 19200, - MODE); -} - - -/* We read the contents of the target location and stash it, - then overwrite it with a breakpoint instruction. - - addr - is the target location in the target machine. - contents_cache - is a pointer to memory allocated for saving the target contents. - It is guaranteed by the caller to be long enough to save sizeof - BREAKPOINT bytes. - - FIXME: This size is target_arch dependent and should be available in - the target_arch transfer vector, if we ever have one... */ - -static int -es1800_insert_breakpoint (addr, contents_cache) - CORE_ADDR addr; - char *contents_cache; -{ - int val; - - val = target_read_memory (addr, contents_cache, sizeof (es1800_break_insn)); - - if (val == 0) - { - val = target_write_memory (addr, es1800_break_insn, - sizeof (es1800_break_insn)); - } - - return (val); -} - - -/* Write back the stashed instruction - - addr - is the target location in the target machine. - contents_cache - is a pointer to memory allocated for saving the target contents. - It is guaranteed by the caller to be long enough to save sizeof - BREAKPOINT bytes. */ - -static int -es1800_remove_breakpoint (addr, contents_cache) - CORE_ADDR addr; - char *contents_cache; -{ - - return (target_write_memory (addr, contents_cache, - sizeof (es1800_break_insn))); -} - -/* create_break_insn () - Primitive datastructures containing the es1800 breakpoint instruction */ - -static void -es1800_create_break_insn (ins, vec) - char *ins; - int vec; -{ - if (vec == 15) - { - ins[0] = 0x4e; - ins[1] = 0x4f; - } -} - - -/* verify_break () - Seach for breakpoint routine in emulator memory. - returns non-zero on failure - vec - trap vector used for breakpoints */ - -static int -verify_break (vec) - int vec; -{ - CORE_ADDR memaddress; - char buf[8]; - char *instr = "NqNqNqNs"; /* breakpoint routine */ - int status; - - get_break_addr (vec, &memaddress); - - if (memaddress) - { - status = target_read_memory (memaddress, buf, 8); - if (status != 0) - { - memory_error (status, memaddress); - } - return (STRCMP (instr, buf)); - } - return (-1); -} - - -/* get_break_addr () - find address of breakpint routine - vec - trap vector used for breakpoints - addrp - store the address here */ - -static void -get_break_addr (vec, addrp) - int vec; - CORE_ADDR *addrp; -{ - CORE_ADDR memaddress = 0; - int status; - int k; - char buf[PBUFSIZ]; - char base_addr[4]; - char *p; - - if (m68020) - { - send_with_reply ("VBR ", buf, sizeof (buf)); - p = buf; - for (k = 0; k < 4; k++) - { - if ((p[k*2 + 1] == 0) || (p[k*2 + 2] == 0)) - { - error ("Emulator reply is too short: %s", buf); - } - base_addr[k] = (fromhex (p[k*2 + 1]) * 16) + fromhex (p[k*2 + 2]); - } - /* base addr of exception vector table */ - memaddress = *((CORE_ADDR *) base_addr); - } - - memaddress += (vec + 32) * 4; /* address of trap vector */ - status = target_read_memory (memaddress, (char *) addrp, 4); - if (status != 0) - { - memory_error (status, memaddress); - } -} - - -/* Kill an inferior process */ - -static void -es1800_kill () -{ - if (inferior_pid != 0) - { - inferior_pid = 0; - es1800_mourn_inferior (); - } -} - - -/* Load a file to the ES1800 emulator. - Converts the file from a.out format into Extended Tekhex format - before the file is loaded. - Also loads the trap routine, and sets the ES1800 breakpoint on it - filename - the a.out to be loaded - from_tty - says whether to be verbose or not - FIXME Uses emulator overlay memory for trap routine */ - -static void -es1800_load (filename, from_tty) - char *filename; - int from_tty; -{ - - FILE *instream; - char loadname[15]; - char buf[160]; - struct cleanup *old_chain; - int es1800_load_format = 5; - - if (es1800_desc == NULL) - { - printf ("No emulator attached, type emulator-command first\n"); - return; - } - - filename = tilde_expand (filename); - make_cleanup (free, filename); - - switch (es1800_load_format) - { - case 2: /* Extended Tekhex */ - if (from_tty) - { - printf ("Converting \"%s\" to Extended Tekhex Format\n", filename); - } - sprintf (buf, "tekhex %s", filename); - system (buf); - sprintf (loadname, "out.hex"); - break; - - case 5: /* Motorola S-rec */ - if (from_tty) - { - printf ("Converting \"%s\" to Motorola S-record format\n", - filename); - } - /* in the future the source code in copy (part of binutils-1.93) will - be included in this file */ - sprintf (buf, - "copy -s \"a.out-sunos-big\" -d \"srec\" %s /tmp/out.hex", - filename); - system (buf); - sprintf (loadname, "/tmp/out.hex"); - break; - - default: - error ("Downloading format not defined\n"); - } - - breakpoint_init_inferior (); - inferior_pid = 0; - if (from_tty) - { - printf ("Downloading \"%s\" to the ES 1800\n",filename); - } - if ((instream = fopen (loadname, "r")) == NULL) - { - perror_with_name ("fopen:"); - } - - old_chain = make_cleanup (fclose, instream); - immediate_quit++; - - es1800_reset (0); - - download (instream, from_tty, es1800_load_format); - - /* if breakpoint routine is not present anymore we have to check - whether to download a new breakpoint routine or not */ - - if ((verify_break (es1800_break_vec) != 0) - && query ("No breakpoint routine in ES 1800 emulator!\nDownload a breakpoint routine to the emulator? ")) - { - char buf[128]; - printf ("Using break vector 0x%x\n", es1800_break_vec); - sprintf (buf, "0x%x ", es1800_break_vec); - printf ("Give the start address of the breakpoint routine: "); - fgets (buf + strlen (buf), sizeof (buf) - strlen (buf), stdin); - es1800_init_break (buf, 0); - } - - do_cleanups (old_chain); - expect_prompt (); - readchar (); /* FIXME I am getting a ^G = 7 after the prompt */ - printf ("\n"); - - if (fclose (instream) == EOF) - { - ; - } - - if (es1800_load_format != 2) - { - sprintf (buf, "/usr/bin/rm %s", loadname); - system (buf); - } - - symbol_file_command (filename, from_tty); /* reading symbol table */ - immediate_quit--; -} - -#if 0 - -#define NUMCPYBYTES 20 - -static void -bfd_copy (from_bfd, to_bfd) - bfd *from_bfd; - bfd *to_bfd; -{ - asection *p, *new; - int i; - char buf[NUMCPYBYTES]; - - for (p = from_bfd->sections; p != NULL; p = p->next) - { - printf (" Copying section %s. Size = %x.\n", p->name, p->_cooked_size); - printf (" vma = %x, offset = %x, output_sec = %x\n", - p->vma, p->output_offset, p->output_section); - new = bfd_make_section (to_bfd, p->name); - if (p->_cooked_size && - !bfd_set_section_size (to_bfd, new, p->_cooked_size)) - { - error ("Wrong BFD size!\n"); - } - if (!bfd_set_section_flags (to_bfd, new, p->flags)) - { - error ("bfd_set_section_flags"); - } - new->vma = p->vma; - - for (i = 0; (i + NUMCPYBYTES) < p->_cooked_size ; i += NUMCPYBYTES) - { - if (!bfd_get_section_contents (from_bfd, p, (PTR) buf, (file_ptr) i, - (bfd_size_type) NUMCPYBYTES)) - { - error ("bfd_get_section_contents\n"); - } - if (!bfd_set_section_contents (to_bfd, new, (PTR) buf, (file_ptr) i, - (bfd_size_type) NUMCPYBYTES)) - { - error ("bfd_set_section_contents\n"); - } - } - bfd_get_section_contents (from_bfd, p, (PTR) buf, (file_ptr) i, - (bfd_size_type) (p->_cooked_size - i)); - bfd_set_section_contents (to_bfd, new, (PTR) buf,(file_ptr) i, - (bfd_size_type) (p->_cooked_size - i)); - } -} - -#endif - -/* Start an process on the es1800 and set inferior_pid to the new - process' pid. - execfile - the file to run - args - arguments passed to the program - env - the environment vector to pass */ - -static void -es1800_create_inferior (execfile, args, env) - char *execfile; - char *args; - char **env; -{ - int entry_pt; - int pid; -#if 0 - struct expression *expr; - register struct cleanup *old_chain = 0; - register value val; -#endif - - if (args && *args) - { - error ("Can't pass arguments to remote ES1800 process"); - } - -#if 0 - if (query ("Use 'start' as entry point? ")) - { - expr = parse_c_expression ("start"); - old_chain = make_cleanup (free_current_contents, &expr); - val = evaluate_expression (expr); - entry_pt = (val->location).address; - } - else - { - printf ("Enter the program's entry point (in hexadecimal): "); - scanf ("%x", &entry_pt); - } -#endif - - if (execfile == 0 || exec_bfd == 0) - { - error ("No exec file specified"); - } - - entry_pt = (int) bfd_get_start_address (exec_bfd); - - pid = 42; - - /* Now that we have a child process, make it our target. */ - - push_target (&es1800_child_ops); - - /* The "process" (board) is already stopped awaiting our commands, and - the program is already downloaded. We just set its PC and go. */ - - inferior_pid = pid; /* Needed for wait_for_inferior below */ - - clear_proceed_status (); - - /* Tell wait_for_inferior that we've started a new process. */ - - init_wait_for_inferior (); - - /* Set up the "saved terminal modes" of the inferior - based on what modes we are starting it with. */ - - target_terminal_init (); - - /* Install inferior's terminal modes. */ - - target_terminal_inferior (); - - /* remote_start (args); */ - /* trap_expected = 0; */ - /* insert_step_breakpoint (); FIXME, do we need this? */ - - /* Let 'er rip... */ - proceed ((CORE_ADDR) entry_pt, TARGET_SIGNAL_DEFAULT, 0); - -} - - -/* The process has died, clean up. */ - -static void -es1800_mourn_inferior () -{ - remove_breakpoints (); - unpush_target (&es1800_child_ops); - generic_mourn_inferior (); /* Do all the proper things now */ -} - -/* ES1800-protocol specific routines */ - -/* Keep discarding input from the remote system, until STRING is found. - Let the user break out immediately. - string - the string to expect - nowait - break out if string not the emulator's first respond otherwise - read until string is found (== 0) */ - -static void -expect (string, nowait) - char *string; - int nowait; -{ - char c; - char *p = string; - - immediate_quit++; - while (1) - { - c = readchar (); - if (isalpha (c)) - { - c = toupper (c); - } - if (c == toupper (*p)) - { - p++; - if (*p == '\0') - { - immediate_quit--; - return; - } - } - else if (!nowait) - { - p = string; - } - else - { - printf ("\'%s\' expected\n" , string); - printf ("char %d is %d", p - string, c); - error ("\n" ); - } - } -} - -/* Keep discarding input until we see the prompt. */ - -static void -expect_prompt () -{ - expect (">", 0); -} - - -/* Read one character */ - -#ifdef DEBUG_STDIN - -/* read from stdin */ - -static int -readchar () -{ - char buf[1]; - - buf[0] = '\0'; - printf ("readchar, give one character\n"); - read (0, buf, 1); - -#if defined (LOG_FILE) - putc (buf[0] & 0x7f, log_file); -#endif - - return (buf[0] & 0x7f); -} - -#else /* !DEBUG_STDIN */ - -/* Read a character from the remote system, doing all the fancy - timeout stuff. */ - -static int -readchar () -{ - int ch; - - ch = SERIAL_READCHAR (es1800_desc, timeout); - - /* FIXME: doing an error() here will probably cause trouble, at least if from - es1800_wait. */ - if (ch == SERIAL_TIMEOUT) - error ("Timeout reading from remote system."); - else if (ch == SERIAL_ERROR) - perror_with_name ("remote read"); - -#if defined (LOG_FILE) - putc (ch & 0x7f, log_file); - fflush (log_file); -#endif - - return (ch); -} - -#endif /* DEBUG_STDIN */ - - -/* Send a command to the emulator and save the reply. - Report an error if we get an error reply. - string - the es1800 command - buf - containing the emulator reply on return - len - size of buf */ - -static void -send_with_reply (string, buf, len) - char *string, *buf; - int len; -{ - send (string); - SERIAL_WRITE (es1800_desc, "\r", 1); - -#ifndef DEBUG_STDIN - expect (string, 1); - expect ("\r\n", 0); -#endif - - getmessage (buf, len); -} - - -/* Send the command in STR to the emulator adding \r. check - the echo for consistency. - string - the es1800 command */ - -static void -send_command (string) - char *string; -{ - send (string); - SERIAL_WRITE (es1800_desc, "\r", 1); - -#ifndef DEBUG_STDIN - expect (string, 0); - expect_prompt (); -#endif - -} - -/* Send a string - string - the es1800 command */ - -static void -send (string) - char *string; -{ - if (kiodebug) - { - fprintf (stderr, "Sending: %s\n", string); - } - SERIAL_WRITE (es1800_desc, string, strlen (string)); -} - - -/* Read a message from the emulator and store it in BUF. - buf - containing the emulator reply on return - len - size of buf */ - -static void -getmessage (buf, len) - char *buf; - int len; -{ - char *bp; - int c; - int prompt_found = 0; - extern kiodebug; - -#if defined (LOG_FILE) - /* This is a convenient place to do this. The idea is to do it often - enough that we never lose much data if we terminate abnormally. */ - fflush (log_file); -#endif - - bp = buf; - c = readchar (); - do - { - if (c) - { - if (len-- < 2) /* char and terminaling NULL */ - { - error ("input buffer overrun\n"); - } - *bp++ = c; - } - c = readchar (); - if ((c == '>') && (*(bp - 1) == ' ')) - { - prompt_found = 1; - } - } - while (!prompt_found); - *bp = 0; - - if (kiodebug) - { - fprintf (stderr,"message received :%s\n", buf); - } -} - -static void -download (instream, from_tty, format) -FILE *instream; - int from_tty; - int format; -{ - char c; - char buf[160]; - int i = 0; - - send_command ("SET #2,$1A"); /* reset char = ^Z */ - send_command ("SET #3,$11,$13"); /* XON XOFF */ - if (format == 2) - { - send_command ("SET #26,#2"); - } - else - { - send_command ("SET #26,#5"); /* Format=Extended Tekhex */ - } - send_command ("DFB = $10"); - send_command ("PUR"); - send_command ("CES"); - send ("DNL\r"); - expect ("DNL", 1); - if (from_tty) - { - printf (" 0 records loaded...\r"); - } - while (fgets (buf, 160, instream)) - { - send (buf); - if (from_tty) - { - printf ("%5d\b\b\b\b\b",++i); - fflush (stdout); - } - if ((c = readchar ()) != 006) - { - error ("expected ACK"); - } - } - if (from_tty) - { - printf ("- All"); - } -} - -/* Additional commands */ - -#if defined (TIOCGETP) && defined (FNDELAY) && defined (EWOULDBLOCK) -#define PROVIDE_TRANSPARENT -#endif - -#ifdef PROVIDE_TRANSPARENT -/* Talk directly to the emulator - FIXME, uses busy wait, and is SUNOS (or at least BSD) specific */ - -/*ARGSUSED*/ -static void -es1800_transparent (args, from_tty) - char *args; - int from_tty; -{ - int console; - struct sgttyb modebl; - int fcflag; - int cc; - struct sgttyb console_mode_save; - int console_fc_save; - int es1800_fc_save; - int inputcnt = 80; - char inputbuf[80]; - int consolecnt = 0; - char consolebuf[80]; - int es1800_cnt = 0; - char es1800_buf[80]; - int i; - - dont_repeat (); - if (es1800_desc == NULL) - { - printf ("No emulator attached, type emulator-command first\n"); - return; - } - - printf ("\n"); - printf ("You are now communicating directly with the ES 1800 emulator.\n"); - printf ("To leave this mode (transparent mode), press ^E.\n"); - printf ("\n"); - printf (" >"); - fflush (stdout); - - if ((console = open ("/dev/tty", O_RDWR)) == -1) - { - perror_with_name ("/dev/tty:"); - } - - if ((fcflag = fcntl (console, F_GETFL, 0)) == -1) - { - perror_with_name ("fcntl console"); - } - - console_fc_save = fcflag; - fcflag = fcflag | FNDELAY; - - if (fcntl (console, F_SETFL, fcflag) == -1) - { - perror_with_name ("fcntl console"); - } - - if (ioctl (console, TIOCGETP, &modebl)) - { - perror_with_name ("ioctl console"); - } - - console_mode_save = modebl; - modebl.sg_flags = RAW; - - if (ioctl (console, TIOCSETP, &modebl)) - { - perror_with_name ("ioctl console"); - } - - if ((fcflag = fcntl (es1800_desc->fd, F_GETFL, 0)) == -1) - { - perror_with_name ("fcntl serial"); - } - - es1800_fc_save = fcflag; - fcflag = fcflag | FNDELAY; - - if (fcntl (es1800_desc->fd, F_SETFL, fcflag) == -1) - { - perror_with_name ("fcntl serial"); - } - - while (1) - { - cc = read (console, inputbuf, inputcnt); - if (cc != -1) - { - if ((*inputbuf & 0x7f) == 0x05) - { - break; - } - for (i = 0; i < cc; ) - { - es1800_buf[es1800_cnt++] = inputbuf[i++]; - } - if ((cc = SERIAL_WRITE (es1800_desc, es1800_buf, es1800_cnt)) == -1) - { - perror_with_name ("FEL! write:"); - } - es1800_cnt -= cc; - if (es1800_cnt && cc) - { - for (i = 0; i < es1800_cnt; i++) - { - es1800_buf[i] = es1800_buf[cc+i]; - } - } - } - else if (errno != EWOULDBLOCK) - { - perror_with_name ("FEL! read:"); - } - - cc = read (es1800_desc->fd,inputbuf,inputcnt); - if (cc != -1) - { - for (i = 0; i < cc; ) - { - consolebuf[consolecnt++] = inputbuf[i++]; - } - if ((cc = write (console,consolebuf,consolecnt)) == -1) - { - perror_with_name ("FEL! write:"); - } - consolecnt -= cc; - if (consolecnt && cc) - { - for (i = 0; i < consolecnt; i++) - { - consolebuf[i] = consolebuf[cc+i]; - } - } - } - else if (errno != EWOULDBLOCK) - { - perror_with_name ("FEL! read:"); - } - } - - console_fc_save = console_fc_save & !FNDELAY; - if (fcntl (console, F_SETFL, console_fc_save) == -1) - { - perror_with_name ("FEL! fcntl"); - } - - if (ioctl (console, TIOCSETP, &console_mode_save)) - { - perror_with_name ("FEL! ioctl"); - } - - close (console); - - if (fcntl (es1800_desc->fd, F_SETFL, es1800_fc_save) == -1) - { - perror_with_name ("FEL! fcntl"); - } - - printf ("\n"); - -} -#endif /* PROVIDE_TRANSPARENT */ - -static void -es1800_init_break (args, from_tty) - char *args; - int from_tty; -{ - CORE_ADDR memaddress = 0; - char buf[PBUFSIZ]; - char base_addr[4]; - char *space_index; - char *p; - int k; - - if (args == NULL) - { - error_no_arg ("a trap vector"); - } - - if (!(space_index = strchr (args, ' '))) - { - error ("Two arguments needed (trap vector and address of break routine).\n"); - } - - *space_index = '\0'; - - es1800_break_vec = strtol (args, (char **) NULL, 0); - es1800_break_address = parse_and_eval_address (space_index + 1); - - es1800_create_break_insn (es1800_break_insn, es1800_break_vec); - - if (m68020) - { - send_with_reply ("VBR ", buf, sizeof (buf)); - p = buf; - for (k = 0; k < 4; k++) - { - if ((p[k*2 + 1] == 0) || (p[k*2 + 2] == 0)) - { - error ("Emulator reply is too short: %s", buf); - } - base_addr[k] = (fromhex (p[k*2 + 1]) * 16) + fromhex (p[k*2 + 2]); - } - /* base addr of exception vector table */ - memaddress = *((CORE_ADDR *) base_addr); - } - - memaddress += (es1800_break_vec + 32) * 4; /* address of trap vector */ - - sprintf (buf, "@.L%lx=$%lx", memaddress, es1800_break_address); - send_command (buf); /* set the address of the break routine in the */ - /* trap vector */ - - sprintf (buf, "@.L%lx=$4E714E71", es1800_break_address); /* NOP; NOP */ - send_command (buf); - sprintf (buf, "@.L%lx=$4E714E73", es1800_break_address + 4); /* NOP; RTE */ - send_command (buf); - - sprintf (buf, "AC2=$%lx", es1800_break_address + 4); - /* breakpoint at es1800-break_address */ - send_command (buf); - send_command ("WHEN AC2 THEN BRK"); /* ie in exception routine */ - - if (from_tty) - { - printf ("Breakpoint (trap $%x) routine at address: %lx\n", - es1800_break_vec, es1800_break_address); - } -} - -static void -es1800_child_open (arg, from_tty) - char *arg; - int from_tty; -{ - error ("Use the \"run\" command to start a child process."); -} - -static void -es1800_child_detach (args, from_tty) - char *args; - int from_tty; -{ - if (args) - { - error ("Argument given to \"detach\" when remotely debugging."); - } - - pop_target (); - if (from_tty) - { - printf ("Ending debugging the process %d.\n", inferior_pid); - } -} - - -/* Define the target subroutine names */ - -struct target_ops es1800_ops = -{ - "es1800", /* to_shortname */ - /* to_longname */ - "Remote serial target in ES1800-emulator protocol", - /* to_doc */ - "Remote debugging on the es1800 emulator via a serial line.\n\ -Specify the serial device it is connected to (e.g. /dev/ttya).", - es1800_open, /* to_open */ - es1800_close, /* to_close */ - es1800_attach, /* to_attach */ - es1800_detach, /* to_detach */ - es1800_resume, /* to_resume */ - NULL, /* to_wait */ - NULL, /* to_fetch_registers */ - NULL, /* to_store_registers */ - es1800_prepare_to_store, /* to_prepare_to_store */ - es1800_xfer_inferior_memory, /* to_xfer_memory */ - es1800_files_info, /* to_files_info */ - es1800_insert_breakpoint, /* to_insert_breakpoint */ - es1800_remove_breakpoint, /* to_remove_breakpoint */ - NULL, /* to_terminal_init */ - NULL, /* to_terminal_inferior */ - NULL, /* to_terminal_ours_for_output */ - NULL, /* to_terminal_ours */ - NULL, /* to_terminal_info */ - NULL, /* to_kill */ - es1800_load, /* to_load */ - NULL, /* to_lookup_symbol */ - es1800_create_inferior, /* to_create_inferior */ - NULL, /* to_mourn_inferior */ - 0, /* to_can_run */ - 0, /* to_notice_signals */ - 0, /* to_thread_alive */ - 0, /* to_stop */ - core_stratum, /* to_stratum */ - 0, /* to_next */ - 0, /* to_has_all_memory */ - 1, /* to_has_memory */ - 0, /* to_has_stack */ - 0, /* to_has_registers */ - 0, /* to_has_execution */ - NULL, /* to_sections */ - NULL, /* to_sections_end */ - OPS_MAGIC /* to_magic (always last) */ -}; - -/* Define the target subroutine names */ - -struct target_ops es1800_child_ops = -{ - "es1800_process", /* to_shortname */ - /* to_longname */ - "Remote serial target in ES1800-emulator protocol", - /* to_doc */ - "Remote debugging on the es1800 emulator via a serial line.\n\ -Specify the serial device it is connected to (e.g. /dev/ttya).", - es1800_child_open, /* to_open */ - NULL, /* to_close */ - es1800_attach, /* to_attach */ - es1800_child_detach, /* to_detach */ - es1800_resume, /* to_resume */ - es1800_wait, /* to_wait */ - es1800_fetch_register, /* to_fetch_registers */ - es1800_store_register, /* to_store_registers */ - es1800_prepare_to_store, /* to_prepare_to_store */ - es1800_xfer_inferior_memory, /* to_xfer_memory */ - es1800_files_info, /* to_files_info */ - es1800_insert_breakpoint, /* to_insert_breakpoint */ - es1800_remove_breakpoint, /* to_remove_breakpoint */ - NULL, /* to_terminal_init */ - NULL, /* to_terminal_inferior */ - NULL, /* to_terminal_ours_for_output */ - NULL, /* to_terminal_ours */ - NULL, /* to_terminal_info */ - es1800_kill, /* to_kill */ - es1800_load, /* to_load */ - NULL, /* to_lookup_symbol */ - es1800_create_inferior, /* to_create_inferior */ - es1800_mourn_inferior, /* to_mourn_inferior */ - 0, /* to_can_run */ - 0, /* notice_signals */ - 0, /* to_thread_alive */ - 0, /* to_stop */ - process_stratum, /* to_stratum */ - 0, /* to_next */ - 1, /* to_has_all_memory */ - 1, /* to_has_memory */ - 1, /* to_has_stack */ - 1, /* to_has_registers */ - 1, /* to_has_execution */ - NULL, /* to_sections */ - NULL, /* to_sections_end */ - OPS_MAGIC /* to_magic (always last) */ -}; - -void -_initialize_es1800 () -{ - add_target (&es1800_ops); - add_target (&es1800_child_ops); -#ifdef PROVIDE_TRANSPARENT - add_com ("transparent", class_support, es1800_transparent, - "Start transparent communication with the ES 1800 emulator."); -#endif /* PROVIDE_TRANSPARENT */ - add_com ("init_break", class_support, es1800_init_break, - "Download break routine and initialize break facility on ES 1800"); -} diff --git a/contrib/gdb/gdb/remote-est.c b/contrib/gdb/gdb/remote-est.c deleted file mode 100644 index cfa9731..0000000 --- a/contrib/gdb/gdb/remote-est.c +++ /dev/null @@ -1,174 +0,0 @@ -/* Remote debugging interface for EST-300 ICE, for GDB - Copyright 1995 Free Software Foundation, Inc. - Contributed by Cygnus Support. - - Written by Steve Chamberlain for Cygnus Support. - Re-written by Stu Grossman of Cygnus Support - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without 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 "target.h" -#include "monitor.h" -#include "serial.h" - -static void est_open PARAMS ((char *args, int from_tty)); - -static void -est_supply_register (regname, regnamelen, val, vallen) - char *regname; - int regnamelen; - char *val; - int vallen; -{ - int regno; - - if (regnamelen != 2) - return; - - switch (regname[0]) - { - case 'S': - if (regname[1] != 'R') - return; - regno = PS_REGNUM; - break; - case 'P': - if (regname[1] != 'C') - return; - regno = PC_REGNUM; - break; - case 'D': - if (regname[1] < '0' || regname[1] > '7') - return; - regno = regname[1] - '0' + D0_REGNUM; - break; - case 'A': - if (regname[1] < '0' || regname[1] > '7') - return; - regno = regname[1] - '0' + A0_REGNUM; - break; - default: - return; - } - - monitor_supply_register (regno, val); -} - -/* - * This array of registers needs to match the indexes used by GDB. The - * whole reason this exists is because the various ROM monitors use - * different names than GDB does, and don't support all the - * registers either. So, typing "info reg sp" becomes a "r30". - */ - -static char *est_regnames[NUM_REGS] = -{ - "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7", - "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", - "SR", "PC", -}; - -/* - * Define the monitor command strings. Since these are passed directly - * through to a printf style function, we need can include formatting - * strings. We also need a CR or LF on the end. - */ - -static struct target_ops est_ops; - -static char *est_inits[] = {"he\r", /* Resets the prompt, and clears repeated cmds */ - NULL}; - -static struct monitor_ops est_cmds = -{ - MO_CLR_BREAK_USES_ADDR | MO_FILL_USES_ADDR | MO_NEED_REGDUMP_AFTER_CONT, - est_inits, /* Init strings */ - "go\r", /* continue command */ - "sidr\r", /* single step */ - "\003", /* ^C interrupts the program */ - "sb %x\r", /* set a breakpoint */ - "rb %x\r", /* clear a breakpoint */ - "rb\r", /* clear all breakpoints */ - "bfb %x %x %x\r", /* fill (start end val) */ - { - "smb %x %x\r", /* setmem.cmdb (addr, value) */ - "smw %x %x\r", /* setmem.cmdw (addr, value) */ - "sml %x %x\r", /* setmem.cmdl (addr, value) */ - NULL, /* setmem.cmdll (addr, value) */ - NULL, /* setreg.resp_delim */ - NULL, /* setreg.term */ - NULL, /* setreg.term_cmd */ - }, - { - "dmb %x %x\r", /* getmem.cmdb (addr, len) */ - "dmw %x %x\r", /* getmem.cmdw (addr, len) */ - "dml %x %x\r", /* getmem.cmdl (addr, len) */ - NULL, /* getmem.cmdll (addr, len) */ - ": ", /* getmem.resp_delim */ - NULL, /* getmem.term */ - NULL, /* getmem.term_cmd */ - }, - { - "sr %s %x\r", /* setreg.cmd (name, value) */ - NULL, /* setreg.resp_delim */ - NULL, /* setreg.term */ - NULL /* setreg.term_cmd */ - }, - { - "dr %s\r", /* getreg.cmd (name) */ - " = ", /* getreg.resp_delim */ - NULL, /* getreg.term */ - NULL /* getreg.term_cmd */ - }, - "dr\r", /* dump_registers */ - "\\(\\w+\\) = \\([0-9a-fA-F]+\\)", /* register_pattern */ - est_supply_register, /* supply_register */ - NULL, /* load_routine (defaults to SRECs) */ - "dl\r", /* download command */ - "+", /* load response */ - ">BKM>", /* monitor command prompt */ - "\r", /* end-of-line terminator */ - NULL, /* optional command terminator */ - &est_ops, /* target operations */ - SERIAL_1_STOPBITS, /* number of stop bits */ - est_regnames, /* registers names */ - MONITOR_OPS_MAGIC /* magic */ - }; - -static void -est_open(args, from_tty) - char *args; - int from_tty; -{ - monitor_open (args, &est_cmds, from_tty); -} - -void -_initialize_est () -{ - init_monitor_ops (&est_ops); - - est_ops.to_shortname = "est"; - est_ops.to_longname = "EST background debug monitor"; - est_ops.to_doc = "Debug via the EST BDM.\n\ -Specify the serial device it is connected to (e.g. /dev/ttya)."; - est_ops.to_open = est_open; - - add_target (&est_ops); -} diff --git a/contrib/gdb/gdb/remote-hms.c b/contrib/gdb/gdb/remote-hms.c deleted file mode 100644 index 2f43e20..0000000 --- a/contrib/gdb/gdb/remote-hms.c +++ /dev/null @@ -1,1463 +0,0 @@ -/* Remote debugging interface for Hitachi HMS Monitor Version 1.0 - Copyright 1995 Free Software Foundation, Inc. - Contributed by Cygnus Support. Written by Steve Chamberlain - (sac@cygnus.com). - - 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 "target.h" -#include "monitor.h" -#include "serial.h" - -static void hms_open PARAMS ((char *args, int from_tty)); - -static void -hms_supply_register (regname, regnamelen, val, vallen) - char *regname; - int regnamelen; - char *val; - int vallen; -{ - int regno; - - if (regnamelen != 2) - return; - if (regname[0] != 'P') - return; - /* We scan off all the registers in one go */ - - val = monitor_supply_register (PC_REGNUM, val); - /* Skip the ccr string */ - while (*val != '=' && *val) - val++; - - val = monitor_supply_register (CCR_REGNUM, val + 1); - - /* Skip up to rest of regs */ - while (*val != '=' && *val) - val++; - - for (regno = 0; regno < 7; regno++) - { - val = monitor_supply_register (regno, val + 1); - } -} - -/* - * This array of registers needs to match the indexes used by GDB. The - * whole reason this exists is because the various ROM monitors use - * different names than GDB does, and don't support all the - * registers either. So, typing "info reg sp" becomes a "r30". - */ - -static char *hms_regnames[NUM_REGS] = -{ - "R0", "R1", "R2", "R3", "R4", "R5", "R6", "R7", "CCR", "PC" -}; - -/* - * Define the monitor command strings. Since these are passed directly - * through to a printf style function, we need can include formatting - * strings. We also need a CR or LF on the end. - */ - -static struct target_ops hms_ops; - -static char *hms_inits[] = -{"\003", /* Resets the prompt, and clears repeated cmds */ - NULL}; - -static struct monitor_ops hms_cmds = -{ - MO_CLR_BREAK_USES_ADDR | MO_FILL_USES_ADDR | MO_GETMEM_NEEDS_RANGE, - hms_inits, /* Init strings */ - "g\r", /* continue command */ - "s\r", /* single step */ - "\003", /* ^C interrupts the program */ - "b %x\r", /* set a breakpoint */ - "b - %x\r", /* clear a breakpoint */ - "b -\r", /* clear all breakpoints */ - "f %x %x %x\r", /* fill (start end val) */ - { - "m.b %x=%x\r", /* setmem.cmdb (addr, value) */ - "m.w %x=%x\r", /* setmem.cmdw (addr, value) */ - NULL, /* setmem.cmdl (addr, value) */ - NULL, /* setmem.cmdll (addr, value) */ - NULL, /* setreg.resp_delim */ - NULL, /* setreg.term */ - NULL, /* setreg.term_cmd */ - }, - { - "m.b %x %x\r", /* getmem.cmdb (addr, addr) */ - "m.w %x %x\r", /* getmem.cmdw (addr, addr) */ - NULL, /* getmem.cmdl (addr, addr) */ - NULL, /* getmem.cmdll (addr, addr) */ - ": ", /* getmem.resp_delim */ - ">", /* getmem.term */ - "\003", /* getmem.term_cmd */ - }, - { - "r %s=%x\r", /* setreg.cmd (name, value) */ - NULL, /* setreg.resp_delim */ - NULL, /* setreg.term */ - NULL /* setreg.term_cmd */ - }, - { - "r %s\r", /* getreg.cmd (name) */ - " (", /* getreg.resp_delim */ - ":", /* getreg.term */ - "\003", /* getreg.term_cmd */ - }, - "r\r", /* dump_registers */ - "\\(\\w+\\)=\\([0-9a-fA-F]+\\)", /* register_pattern */ - hms_supply_register, /* supply_register */ - NULL, /* load_routine (defaults to SRECs) */ - "tl\r", /* download command */ - NULL, /* load response */ - ">", /* monitor command prompt */ - "\r", /* end-of-command delimitor */ - NULL, /* optional command terminator */ - &hms_ops, /* target operations */ - SERIAL_1_STOPBITS, /* number of stop bits */ - hms_regnames, /* registers names */ - MONITOR_OPS_MAGIC /* magic */ -}; - -static void -hms_open (args, from_tty) - char *args; - int from_tty; -{ - monitor_open (args, &hms_cmds, from_tty); -} - -int write_dos_tick_delay; - -void -_initialize_remote_hms () -{ - init_monitor_ops (&hms_ops); - - hms_ops.to_shortname = "hms"; - hms_ops.to_longname = "Hitachi Microsystems H8/300 debug monitor"; - hms_ops.to_doc = "Debug via the HMS monitor.\n\ -Specify the serial device it is connected to (e.g. /dev/ttya)."; - hms_ops.to_open = hms_open; - /* By trial and error I've found that this delay doesn't break things */ - write_dos_tick_delay = 1; - add_target (&hms_ops); -} - - -#if 0 -/* This is kept here because we used to support the H8/500 in this module, - and I haven't done the H8/500 yet */ -#include "defs.h" -#include "inferior.h" -#include "wait.h" -#include "value.h" -#include "gdb_string.h" -#include -#include -#include -#include -#include -#include "terminal.h" -#include "target.h" -#include "gdbcore.h" -#include "serial.h" -#include "remote-utils.h" -/* External data declarations */ -extern int stop_soon_quietly; /* for wait_for_inferior */ - -/* Forward data declarations */ -extern struct target_ops hms_ops; /* Forward declaration */ - -/* Forward function declarations */ -static void hms_fetch_registers (); -static int hms_store_registers (); -static void hms_close (); -static int hms_clear_breakpoints (); - -extern struct target_ops hms_ops; -static void hms_drain (); -static void add_commands (); -static void remove_commands (); - -static int quiet = 1; /* FIXME - can be removed after Dec '94 */ - - - -/*********************************************************************** - * I/O stuff stolen from remote-eb.c - ***********************************************************************/ - -static int timeout = 2; - -static const char *dev_name; - -/* Descriptor for I/O to remote machine. Initialize it to -1 so that - hms_open knows that we don't have a file open when the program - starts. */ - -static int before = 0xdead; -static int is_open = 0; -static int after = 0xdead; -int -check_open () -{ - if (before != 0xdead - || after != 0xdead) - printf ("OUTCH! \n"); - if (!is_open) - { - error ("remote device not open"); - } -} - -#define ON 1 -#define OFF 0 - -/* Read a character from the remote system, doing all the fancy - timeout stuff. */ -static int -readchar () -{ - int buf; - - buf = SERIAL_READCHAR (desc, timeout); - - if (buf == SERIAL_TIMEOUT) - { - hms_write (".\r\n", 3); - error ("Timeout reading from remote system."); - } - if (buf == SERIAL_ERROR) - { - error ("Serial port error!"); - } - - if (!quiet || remote_debug) - printf_unfiltered ("%c", buf); - - return buf & 0x7f; -} - -static void -flush () -{ - while (1) - { - int b = SERIAL_READCHAR (desc, 0); - if (b == SERIAL_TIMEOUT) - return; - } -} - -static int -readchar_nofail () -{ - int buf; - - buf = SERIAL_READCHAR (desc, timeout); - if (buf == SERIAL_TIMEOUT) - buf = 0; - if (!quiet || remote_debug) - printf_unfiltered ("%c", buf); - - return buf & 0x7f; - -} - -/* Keep discarding input from the remote system, until STRING is found. - Let the user break out immediately. */ -static void -expect (string) - char *string; -{ - char *p = string; - char c; - immediate_quit = 1; - while (1) - { - c = readchar (); - if (c == *p) - { - p++; - if (*p == '\0') - { - immediate_quit = 0; - return; - } - } - else - { - p = string; - if (c == *p) - p++; - } - } -} - -/* Keep discarding input until we see the hms prompt. - - The convention for dealing with the prompt is that you - o give your command - o *then* wait for the prompt. - - Thus the last thing that a procedure does with the serial line - will be an expect_prompt(). Exception: hms_resume does not - wait for the prompt, because the terminal is being handed over - to the inferior. However, the next thing which happens after that - is a hms_wait which does wait for the prompt. - Note that this includes abnormal exit, e.g. error(). This is - necessary to prevent getting into states from which we can't - recover. */ -static void -expect_prompt () -{ - expect ("HMS>"); -} - -/* Get a hex digit from the remote system & return its value. - If ignore_space is nonzero, ignore spaces (not newline, tab, etc). */ -static int -get_hex_digit (ignore_space) - int ignore_space; -{ - int ch; - - while (1) - { - ch = readchar (); - if (ch >= '0' && ch <= '9') - return ch - '0'; - else if (ch >= 'A' && ch <= 'F') - return ch - 'A' + 10; - else if (ch >= 'a' && ch <= 'f') - return ch - 'a' + 10; - else if (ch == ' ' && ignore_space) - ; - else - { - expect_prompt (); - error ("Invalid hex digit from remote system."); - } - } -} - -/* Get a byte from hms_desc and put it in *BYT. Accept any number - leading spaces. */ -static void -get_hex_byte (byt) - char *byt; -{ - int val; - - val = get_hex_digit (1) << 4; - val |= get_hex_digit (0); - *byt = val; -} - -/* Read a 32-bit hex word from the hms, preceded by a space */ -static long -get_hex_word () -{ - long val; - int j; - - val = 0; - for (j = 0; j < 8; j++) - val = (val << 4) + get_hex_digit (j == 0); - return val; -} - -/* Called when SIGALRM signal sent due to alarm() timeout. */ - -/* Number of SIGTRAPs we need to simulate. That is, the next - NEED_ARTIFICIAL_TRAP calls to hms_wait should just return - SIGTRAP without actually waiting for anything. */ - -static int need_artificial_trap = 0; - -void -hms_kill (arg, from_tty) - char *arg; - int from_tty; -{ - -} - -/* This is called not only when we first attach, but also when the - user types "run" after having attached. */ -void -hms_create_inferior (execfile, args, env) - char *execfile; - char *args; - char **env; -{ - int entry_pt; - char buffer[100]; - - if (args && *args) - error ("Can't pass arguments to remote hms process."); - - if (execfile == 0 || exec_bfd == 0) - error ("No exec file specified"); - - entry_pt = (int) bfd_get_start_address (exec_bfd); - check_open (); - - hms_kill (NULL, NULL); - hms_clear_breakpoints (); - init_wait_for_inferior (); - hms_write_cr (""); - expect_prompt (); - - insert_breakpoints (); /* Needed to get correct instruction in cache */ - proceed (entry_pt, TARGET_SIGNAL_DEFAULT, 0); -} - -/* Open a connection to a remote debugger. - NAME is the filename used for communication, then a space, - then the baud rate. - */ - -static char * -find_end_of_word (s) - char *s; -{ - while (*s && !isspace (*s)) - s++; - return s; -} - -static char * -get_word (p) - char **p; -{ - char *s = *p; - char *word; - char *copy; - size_t len; - - while (isspace (*s)) - s++; - - word = s; - - len = 0; - - while (*s && !isspace (*s)) - { - s++; - len++; - - } - copy = xmalloc (len + 1); - memcpy (copy, word, len); - copy[len] = 0; - *p = s; - return copy; -} - -static int baudrate = 9600; - -static int -is_baudrate_right () -{ - int ok; - - /* Put this port into NORMAL mode, send the 'normal' character */ - - hms_write ("\001", 1); /* Control A */ - hms_write ("\r\n", 2); /* Cr */ - - while (1) - { - ok = SERIAL_READCHAR (desc, timeout); - if (ok < 0) - break; - } - - hms_write ("r", 1); - - if (readchar_nofail () == 'r') - return 1; - - /* Not the right baudrate, or the board's not on */ - return 0; -} -static void -set_rate () -{ - if (!SERIAL_SETBAUDRATE (desc, baudrate)) - error ("Can't set baudrate"); -} - - - -/* Close out all files and local state before this target loses control. */ - -static void -hms_close (quitting) - int quitting; -{ - /* Clear any break points */ - remove_commands (); - hms_clear_breakpoints (); - sleep (1); /* Let any output make it all the way back */ - if (is_open) - { - SERIAL_WRITE (desc, "R\r\n", 3); - SERIAL_CLOSE (desc); - } - is_open = 0; -} - -/* Terminate the open connection to the remote debugger. Use this - when you want to detach and do something else with your gdb. */ void -hms_detach (args, from_tty) - char *args; - int from_tty; -{ - if (is_open) - { - hms_clear_breakpoints (); - } - - pop_target (); /* calls hms_close to do the real work - */ - if (from_tty) - printf_filtered ("Ending remote %s debugging\n", - target_shortname); -} - -/* Tell the remote machine to resume. */ - -void -hms_resume (pid, step, sig) - int pid, step; - enum target_signal - sig; -{ - if (step) - { - hms_write_cr ("s"); - expect ("Step>"); - - /* Force the next hms_wait to return a trap. Not doing anything - about I/O from the target means that the user has to type "continue" - to see any. FIXME, this should be fixed. */ - need_artificial_trap = 1; - } - else - { - hms_write_cr ("g"); - expect ("g"); - } -} - -/* Wait until the remote machine stops, then return, storing status in - STATUS just as `wait' would. */ - -int -hms_wait (pid, status) - int pid; - struct target_waitstatus *status; -{ - /* Strings to look for. '?' means match any single character. Note - that with the algorithm we use, the initial character of the string - cannot recur in the string, or we will not find some cases of the - string in the input. */ - - static char bpt[] = "At breakpoint:"; - - /* It would be tempting to look for "\n[__exit + 0x8]\n" but that - requires loading symbols with "yc i" and even if we did do that we - don't know that the file has symbols. */ - static char exitmsg[] = "HMS>"; - char *bp = bpt; - char *ep = exitmsg; - - /* Large enough for either sizeof (bpt) or sizeof (exitmsg) chars. - */ - char swallowed[50]; - - /* Current position in swallowed. */ - char *swallowed_p = swallowed; - - int ch; - int ch_handled; - int old_timeout = timeout; - int - old_immediate_quit = immediate_quit; - int swallowed_cr = 0; - - status->kind = TARGET_WAITKIND_EXITED; - status->value.integer = 0; - - if (need_artificial_trap != 0) - { - status->kind = - TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_TRAP; - need_artificial_trap--; - return 0; - } - - timeout = 5; /* Don't time out for a while - user program is running. - */ - immediate_quit = 1; /* Helps ability to QUIT */ - while (1) - { - QUIT; /* Let user quit and leave process running */ - ch_handled = 0; - ch = readchar (); - if (ch == *bp) - { - bp++; - if (*bp == '\0') - break; - ch_handled = 1; - - *swallowed_p++ = ch; - } - else - { - bp = bpt; - } - if - (ch == *ep || *ep == '?') - { - ep++; - if (*ep == '\0') - break; - - if (!ch_handled) - *swallowed_p++ = ch; - ch_handled = - 1; - } - else - { - ep = exitmsg; - } - - if (!ch_handled) - { - char *p; - - /* Print out any characters which have been swallowed. */ - for (p = swallowed; p < swallowed_p; ++p) - putchar_unfiltered (*p); - swallowed_p = swallowed; - - if ((ch != '\r' && ch != '\n') || swallowed_cr > 10) - { - putchar_unfiltered (ch); - swallowed_cr = 10; - } - swallowed_cr++; - - } - } - if (*bp == '\0') - { - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_TRAP; - expect_prompt (); - } - else - { - status->kind = TARGET_WAITKIND_EXITED; - status->value.integer = - TARGET_SIGNAL_STOP; - } - - timeout = old_timeout; - immediate_quit = old_immediate_quit; - return - 0; -} - -/* Return the name of register number REGNO in the form input and - output by hms. - - Returns a pointer to a static buffer containing the answer. */ -static char * -get_reg_name (regno) - int regno; -{ - static char *rn[] = - REGISTER_NAMES; - - return rn[regno]; -} - -/* Read the remote registers. */ - -static int -gethex (length, start, ok) - unsigned int length; - char *start; - int *ok; -{ - int result = 0; - - while (length--) - { - result <<= 4; - if (*start >= 'a' && *start <= 'f') - { - result += *start - 'a' + 10; - } - else if (*start >= 'A' && - *start <= 'F') - { - result += *start - 'A' + 10; - } - else if - (*start >= '0' && *start <= '9') - { - result += *start - '0'; - } - else - *ok = 0; - start++; - - } - return result; -} -static int -timed_read (buf, n, timeout) - char - *buf; - -{ - int i; - char c; - - i = 0; - while (i < n) - { - c = readchar (); - - if (c == 0) - return i; - buf[i] = c; - i++; - - } - return i; -} - -hms_write (a, l) - char *a; -{ - int i; - - SERIAL_WRITE (desc, a, l); - - if (!quiet || remote_debug) - { - printf_unfiltered ("<"); - for (i = 0; i < l; i++) - { - printf_unfiltered ("%c", a[i]); - } - printf_unfiltered (">"); - } -} - -hms_write_cr (s) - char *s; -{ - hms_write (s, strlen (s)); - hms_write ("\r\n", 2); -} - -#ifdef GDB_TARGET_IS_H8500 - -/* H8/500 monitor reg dump looks like: - - HMS>r - PC:8000 SR:070C .7NZ.. CP:00 DP:00 EP:00 TP:00 BR:00 - R0-R7: FF5A 0001 F4FE F500 0000 F528 F528 F4EE - HMS> - - - */ - -supply_val (n, size, ptr, segptr) - int n; - int size; - char *ptr; - char *segptr; -{ - int ok; - char raw[4]; - switch (size) - { - case 2: - raw[0] = gethex (2, ptr, &ok); - raw[1] = gethex (2, ptr + 2, &ok); - supply_register (n, raw); - break; - case 1: - raw[0] = gethex (2, ptr, &ok); - supply_register (n, raw); - break; - case 4: - { - int v = gethex (4, ptr, &ok); - v |= gethex (2, segptr, &ok) << 16; - raw[0] = 0; - raw[1] = (v >> 16) & 0xff; - raw[2] = (v >> 8) & 0xff; - raw[3] = (v >> 0) & 0xff; - supply_register (n, raw); - } - } - -} -static void -hms_fetch_register (dummy) - int dummy; -{ -#define REGREPLY_SIZE 108 - char linebuf[REGREPLY_SIZE + 1]; - int i; - int s; - int gottok; - - LONGEST reg[NUM_REGS]; - check_open (); - - do - { - - hms_write_cr ("r"); - expect ("r"); - s = timed_read (linebuf + 1, REGREPLY_SIZE, 1); - - linebuf[REGREPLY_SIZE] = 0; - gottok = 0; - if (linebuf[3] == 'P' && - linebuf[4] == 'C' && - linebuf[5] == ':' && - linebuf[105] == 'H' && - linebuf[106] == 'M' && - linebuf[107] == 'S') - { - - /* - 012 - r** - -------1---------2---------3---------4---------5----- - 345678901234567890123456789012345678901234567890123456 - PC:8000 SR:070C .7NZ.. CP:00 DP:00 EP:00 TP:00 BR:00** - ---6---------7---------8---------9--------10---- - 789012345678901234567890123456789012345678901234 - R0-R7: FF5A 0001 F4FE F500 0000 F528 F528 F4EE** - - 56789 - HMS> - */ - gottok = 1; - - - supply_val (PC_REGNUM, 4, linebuf + 6, linebuf + 29); - - supply_val (CCR_REGNUM, 2, linebuf + 14); - supply_val (SEG_C_REGNUM, 1, linebuf + 29); - supply_val (SEG_D_REGNUM, 1, linebuf + 35); - supply_val (SEG_E_REGNUM, 1, linebuf + 41); - supply_val (SEG_T_REGNUM, 1, linebuf + 47); - for (i = 0; i < 8; i++) - { - static int sr[8] = - {35, 35, 35, 35, - 41, 41, 47, 47}; - - char raw[4]; - char *src = linebuf + 64 + 5 * i; - char *segsrc = linebuf + sr[i]; - supply_val (R0_REGNUM + i, 2, src); - supply_val (PR0_REGNUM + i, 4, src, segsrc); - } - } - if (!gottok) - { - hms_write_cr (""); - expect ("HMS>"); - } - } - while (!gottok); -} -#endif - -#ifdef GDB_TARGET_IS_H8300 -static void -hms_fetch_register (dummy) - int dummy; -{ -#define REGREPLY_SIZE 79 - char linebuf[REGREPLY_SIZE + 1]; - int i; - int s; - int gottok; - - unsigned LONGEST reg[NUM_REGS]; - - check_open (); - - do - { - hms_write_cr ("r"); - - s = timed_read (linebuf, 1, 1); - - while (linebuf[0] != 'r') - s = timed_read (linebuf, 1, 1); - - s = timed_read (linebuf + 1, REGREPLY_SIZE - 1, 1); - - linebuf[REGREPLY_SIZE] = 0; - gottok = 0; - if (linebuf[0] == 'r' && - linebuf[3] == 'P' && - linebuf[4] == 'C' && - linebuf[5] == '=' && - linebuf[75] == 'H' && - linebuf[76] == 'M' && - linebuf[77] == 'S') - { - /* - PC=XXXX CCR=XX:XXXXXXXX R0-R7= XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX - 5436789012345678901234567890123456789012345678901234567890123456789012 - 0 1 2 3 4 5 6 - */ - gottok = 1; - - reg[PC_REGNUM] = gethex (4, linebuf + 6, &gottok); - reg[CCR_REGNUM] = gethex (2, linebuf + 15, &gottok); - for (i = 0; i < 8; i++) - { - reg[i] = gethex (4, linebuf + 34 + 5 * i, &gottok); - } - } - } - while (!gottok); - for (i = 0; i < NUM_REGS; i++) - { - char swapped[2]; - - swapped[1] = reg[i]; - swapped[0] = (reg[i]) >> 8; - - supply_register (i, swapped); - } -} -#endif -/* Store register REGNO, or all if REGNO == -1. - Return errno value. */ -static void -hms_store_register (regno) - int regno; -{ - if (regno == -1) - { - for (regno = 0; regno < NUM_REGS; regno++) - { - hms_store_register (regno); - } - } - else - { - char *name = get_reg_name (regno); - char buffer[100]; - /* Some regs dont really exist */ - if (!(name[0] == 'p' && name[1] == 'r') - && !(name[0] == 'c' && name[1] == 'y') - && !(name[0] == 't' && name[1] == 'i') - && !(name[0] == 'i' && name[1] == 'n')) - { - sprintf (buffer, "r %s=%x", name, read_register (regno)); - hms_write_cr (buffer); - expect_prompt (); - } - } -} - - -/* Get ready to modify the registers array. On machines which store - individual registers, this doesn't need to do anything. On machines - which store all the registers in one fell swoop, this makes sure - that registers contains all the registers from the program being - debugged. */ - -void -hms_prepare_to_store () -{ - /* Do nothing, since we can store individual regs */ -} - -static CORE_ADDR -translate_addr (addr) - CORE_ADDR addr; -{ - - return (addr); - -} - - -int -hms_xfer_inferior_memory (memaddr, myaddr, len, write, target) - CORE_ADDR memaddr; - char *myaddr; - int len; - int write; - struct target_ops *target; /* ignored */ -{ - - return len; -} - -int -hms_write_inferior_memory (memaddr, myaddr, len) - CORE_ADDR memaddr; - unsigned char *myaddr; - int len; -{ - bfd_vma addr; - int done; - int todo; - char buffer[100]; - done = 0; - hms_write_cr ("."); - expect_prompt (); - while (done < len) - { - char *ptr = buffer; - int thisgo; - int idx; - - thisgo = len - done; - if (thisgo > 20) - thisgo = 20; - - sprintf (ptr, "M.B %4x =", memaddr + done); - ptr += 10; - for (idx = 0; idx < thisgo; idx++) - { - sprintf (ptr, "%2x ", myaddr[idx + done]); - ptr += 3; - } - hms_write_cr (buffer); - expect_prompt (); - done += thisgo; - } -} - -void -hms_files_info () -{ - char *file = "nothing"; - - if (exec_bfd) - file = bfd_get_filename (exec_bfd); - - if (exec_bfd) -#ifdef __GO32__ - printf_filtered ("\tAttached to DOS asynctsr and running program %s\n", file); -#else - printf_filtered ("\tAttached to %s at %d baud and running program %s\n", dev_name, baudrate, file); -#endif - printf_filtered ("\ton an H8/300 processor.\n"); -} - -/* Copy LEN bytes of data from debugger memory at MYADDR - to inferior's memory at MEMADDR. Returns errno value. - * sb/sh instructions don't work on unaligned addresses, when TU=1. - */ - -/* Read LEN bytes from inferior memory at MEMADDR. Put the result - at debugger address MYADDR. Returns errno value. */ -int -hms_read_inferior_memory (memaddr, myaddr, len) - CORE_ADDR memaddr; - char *myaddr; - int len; -{ - /* Align to nearest low 16 bits */ - int i; - - CORE_ADDR start = memaddr; - CORE_ADDR end = memaddr + len - 1; - - int ok = 1; - - /* - AAAA: XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX '................' - 012345678901234567890123456789012345678901234567890123456789012345 - 0 1 2 3 4 5 6 - */ - char buffer[66]; - - if (memaddr & 0xf) - abort (); - if (len != 16) - abort (); - - sprintf (buffer, "m %4x %4x", start & 0xffff, end & 0xffff); - - flush (); - hms_write_cr (buffer); - /* drop the echo and newline */ - for (i = 0; i < 13; i++) - readchar (); - - /* Grab the lines as they come out and fill the area */ - /* Skip over cr */ - while (1) - { - int p; - int i; - int addr; - size_t idx; - - char byte[16]; - - buffer[0] = readchar (); - while (buffer[0] == '\r' - || buffer[0] == '\n') - buffer[0] = readchar (); - - if (buffer[0] == 'M') - break; - - for (i = 1; i < 50; i++) - { - buffer[i] = readchar (); - } - /* sometimes we loose characters in the ascii representation of the - data. I don't know where. So just scan for the end of line */ - i = readchar (); - while (i != '\n' && i != '\r') - i = readchar (); - - /* Now parse the line */ - - addr = gethex (4, buffer, &ok); - idx = 6; - for (p = 0; p < 16; p += 2) - { - byte[p] = gethex (2, buffer + idx, &ok); - byte[p + 1] = gethex (2, buffer + idx + 2, &ok); - idx += 5; - } - - for (p = 0; p < 16; p++) - { - if (addr + p >= memaddr && - addr + p < memaddr + len) - { - myaddr[(addr + p) - memaddr] = byte[p]; - - } - - } - } -#ifdef GDB_TARGET_IS_H8500 - expect ("ore>"); -#endif -#ifdef GDB_TARGET_IS_H8300 - expect ("emory>"); -#endif - hms_write_cr ("."); - - expect_prompt (); - return len; -} - - - -#define MAX_BREAKS 16 -static int num_brkpts = 0; -static int -hms_insert_breakpoint (addr, save) - CORE_ADDR addr; - char *save; /* Throw away, let hms save instructions */ -{ - check_open (); - - if (num_brkpts < MAX_BREAKS) - { - char buffer[100]; - - num_brkpts++; - sprintf (buffer, "b %x", addr & 0xffff); - hms_write_cr (buffer); - expect_prompt (); - return (0); - } - else - { - fprintf_filtered (gdb_stderr, - "Too many break points, break point not installed\n"); - return (1); - } - -} -static int -hms_remove_breakpoint (addr, save) - CORE_ADDR addr; - char *save; /* Throw away, let hms save instructions */ -{ - if (num_brkpts > 0) - { - char buffer[100]; - - num_brkpts--; - sprintf (buffer, "b - %x", addr & 0xffff); - hms_write_cr (buffer); - expect_prompt (); - - } - return (0); -} - -/* Clear the hmss notion of what the break points are */ -static int -hms_clear_breakpoints () -{ - - if (is_open) - { - hms_write_cr ("b -"); - expect_prompt (); - } - num_brkpts = 0; -} -static void -hms_mourn () -{ - hms_clear_breakpoints (); - unpush_target (&hms_ops); - generic_mourn_inferior (); -} - -/* Put a command string, in args, out to the hms. The hms is assumed to - be in raw mode, all writing/reading done through desc. - Ouput from the hms is placed on the users terminal until the - prompt from the hms is seen. - FIXME: Can't handle commands that take input. */ - -void -hms_com (args, fromtty) - char *args; - int fromtty; -{ - check_open (); - - if (!args) - return; - - /* Clear all input so only command relative output is displayed */ - - hms_write_cr (args); -/* hms_write ("\030", 1); */ - expect_prompt (); -} - -static void -hms_open (name, from_tty) - char *name; - int from_tty; -{ - unsigned int prl; - char *p; - - if (name == 0) - { - name = ""; - } - if (is_open) - hms_close (0); - dev_name = strdup (name); - - if (!(desc = SERIAL_OPEN (dev_name))) - perror_with_name ((char *) dev_name); - - SERIAL_RAW (desc); - is_open = 1; - push_target (&hms_ops); - dcache_ptr = dcache_init (hms_read_inferior_memory, - hms_write_inferior_memory); - remote_dcache = 1; - /* Hello? Are you there? */ - SERIAL_WRITE (desc, "\r\n", 2); - expect_prompt (); - - /* Clear any break points */ - hms_clear_breakpoints (); - - printf_filtered ("Connected to remote board running HMS monitor.\n"); - add_commands (); -/* hms_drain (); */ -} - -/* Define the target subroutine names */ - -struct target_ops hms_ops = -{ - "hms", "Remote HMS monitor", - "Use the H8 evaluation board running the HMS monitor connected\n\ -by a serial line.", - - hms_open, hms_close, - 0, hms_detach, hms_resume, hms_wait, /* attach */ - hms_fetch_register, hms_store_register, - hms_prepare_to_store, - hms_xfer_inferior_memory, - hms_files_info, - hms_insert_breakpoint, hms_remove_breakpoint, /* Breakpoints */ - 0, 0, 0, 0, 0, /* Terminal handling */ - hms_kill, /* FIXME, kill */ - generic_load, - 0, /* lookup_symbol */ - hms_create_inferior, /* create_inferior */ - hms_mourn, /* mourn_inferior FIXME */ - 0, /* can_run */ - 0, /* notice_signals */ - 0, /* to_thread_alive */ - 0, /* to_stop */ - process_stratum, 0, /* next */ - 1, 1, 1, 1, 1, /* all mem, mem, stack, regs, exec */ - 0, 0, /* Section pointers */ - OPS_MAGIC, /* Always the last thing */ -}; - -hms_quiet () /* FIXME - this routine can be removed after Dec '94 */ -{ - quiet = !quiet; - if (quiet) - printf_filtered ("Snoop disabled\n"); - else - printf_filtered ("Snoop enabled\n"); - - printf_filtered ("`snoop' is obsolete, please use `set remotedebug'.\n"); -} - -hms_device (s) - char *s; -{ - if (s) - { - dev_name = get_word (&s); - } -} - -static -hms_speed (s) - char *s; -{ - check_open (); - - if (s) - { - char buffer[100]; - int newrate = atoi (s); - int which = 0; - - if (SERIAL_SETBAUDRATE (desc, newrate)) - error ("Can't use %d baud\n", newrate); - - printf_filtered ("Checking target is in sync\n"); - - printf_filtered ("Sending commands to set target to %d\n", - baudrate); - - sprintf (buffer, "tm %d. N 8 1", baudrate); - hms_write_cr (buffer); - } -} - -/***********************************************************************/ - -static void -hms_drain (args, fromtty) - char *args; - int fromtty; -{ - int c; - while (1) - { - c = SERIAL_READCHAR (desc, 1); - if (c == SERIAL_TIMEOUT) - break; - if (c == SERIAL_ERROR) - break; - if (c > ' ' && c < 127) - printf ("%c", c & 0xff); - else - printf ("<%x>", c & 0xff); - } -} - -static void -add_commands () -{ - - add_com ("hms_drain", class_obscure, hms_drain, - "Drain pending hms text buffers."); -} - -static void -remove_commands () -{ - extern struct cmd_list_element *cmdlist; - delete_cmd ("hms-drain", &cmdlist); -} - - -void -_initialize_remote_hms () -{ - add_target (&hms_ops); - - add_com ("hms ", class_obscure, hms_com, - "Send a command to the HMS monitor."); - - /* FIXME - hms_quiet and `snoop' can be removed after Dec '94 */ - add_com ("snoop", class_obscure, hms_quiet, - "Show what commands are going to the monitor (OBSOLETE - see 'set remotedebug')"); - - add_com ("device", class_obscure, hms_device, - "Set the terminal line for HMS communications"); - - add_com ("speed", class_obscure, hms_speed, - "Set the terminal line speed for HMS communications"); - - dev_name = NULL; -} -#endif - diff --git a/contrib/gdb/gdb/remote-mips.c b/contrib/gdb/gdb/remote-mips.c deleted file mode 100644 index 176e1be..0000000 --- a/contrib/gdb/gdb/remote-mips.c +++ /dev/null @@ -1,2997 +0,0 @@ -/* Remote debugging interface for MIPS remote debugging protocol. - Copyright 1993, 1994, 1995 Free Software Foundation, Inc. - Contributed by Cygnus Support. Written by Ian Lance Taylor - . - -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 "bfd.h" -#include "symfile.h" -#include "wait.h" -#include "gdbcmd.h" -#include "gdbcore.h" -#include "serial.h" -#include "target.h" -#include "remote-utils.h" - -#include -#ifdef ANSI_PROTOTYPES -#include -#else -#include -#endif - -extern char *mips_read_processor_type PARAMS ((void)); - -extern void mips_set_processor_type_command PARAMS ((char *, int)); - - -/* Prototypes for local functions. */ - -static int mips_readchar PARAMS ((int timeout)); - -static int mips_receive_header PARAMS ((unsigned char *hdr, int *pgarbage, - int ch, int timeout)); - -static int mips_receive_trailer PARAMS ((unsigned char *trlr, int *pgarbage, - int *pch, int timeout)); - -static int mips_cksum PARAMS ((const unsigned char *hdr, - const unsigned char *data, - int len)); - -static void mips_send_packet PARAMS ((const char *s, int get_ack)); - -static void mips_send_command PARAMS ((const char *cmd, int prompt)); - -static int mips_receive_packet PARAMS ((char *buff, int throw_error, - int timeout)); - -static int mips_request PARAMS ((int cmd, unsigned int addr, - unsigned int data, int *perr, int timeout, - char *buff)); - -static void mips_initialize PARAMS ((void)); - -static void mips_open PARAMS ((char *name, int from_tty)); - -static void pmon_open PARAMS ((char *name, int from_tty)); - -static void mips_close PARAMS ((int quitting)); - -static void mips_detach PARAMS ((char *args, int from_tty)); - -static void mips_resume PARAMS ((int pid, int step, - enum target_signal siggnal)); - -static int mips_wait PARAMS ((int pid, struct target_waitstatus *status)); - -static int pmon_wait PARAMS ((int pid, struct target_waitstatus *status)); - -static int mips_map_regno PARAMS ((int regno)); - -static void mips_fetch_registers PARAMS ((int regno)); - -static void mips_prepare_to_store PARAMS ((void)); - -static void mips_store_registers PARAMS ((int regno)); - -static int mips_fetch_word PARAMS ((CORE_ADDR addr)); - -static int mips_store_word PARAMS ((CORE_ADDR addr, int value, - char *old_contents)); - -static int mips_xfer_memory PARAMS ((CORE_ADDR memaddr, char *myaddr, int len, - int write, struct target_ops *ignore)); - -static void mips_files_info PARAMS ((struct target_ops *ignore)); - -static void mips_create_inferior PARAMS ((char *execfile, char *args, - char **env)); - -static void mips_mourn_inferior PARAMS ((void)); - -static int pmon_makeb64 PARAMS ((unsigned long v, char *p, int n, int *chksum)); - -static int pmon_zeroset PARAMS ((int recsize, char **buff, int *amount, - unsigned int *chksum)); - -static int pmon_checkset PARAMS ((int recsize, char **buff, int *value)); - -static void pmon_make_fastrec PARAMS ((char **outbuf, unsigned char *inbuf, - int *inptr, int inamount, int *recsize, - unsigned int *csum, unsigned int *zerofill)); - -static int pmon_check_ack PARAMS ((void)); - -static void pmon_load_fast PARAMS ((char *file)); - -static void mips_load PARAMS ((char *file, int from_tty)); - -static int mips_make_srec PARAMS ((char *buffer, int type, CORE_ADDR memaddr, - unsigned char *myaddr, int len)); - -static int common_breakpoint PARAMS ((int cmd, CORE_ADDR addr, CORE_ADDR mask, - char *flags)); - -static void common_open PARAMS ((struct target_ops *ops, char *name, - int from_tty)); -/* Forward declarations. */ -extern struct target_ops mips_ops; -extern struct target_ops pmon_ops; - -/* The MIPS remote debugging interface is built on top of a simple - packet protocol. Each packet is organized as follows: - - SYN The first character is always a SYN (ASCII 026, or ^V). SYN - may not appear anywhere else in the packet. Any time a SYN is - seen, a new packet should be assumed to have begun. - - TYPE_LEN - This byte contains the upper five bits of the logical length - of the data section, plus a single bit indicating whether this - is a data packet or an acknowledgement. The documentation - indicates that this bit is 1 for a data packet, but the actual - board uses 1 for an acknowledgement. The value of the byte is - 0x40 + (ack ? 0x20 : 0) + (len >> 6) - (we always have 0 <= len < 1024). Acknowledgement packets do - not carry data, and must have a data length of 0. - - LEN1 This byte contains the lower six bits of the logical length of - the data section. The value is - 0x40 + (len & 0x3f) - - SEQ This byte contains the six bit sequence number of the packet. - The value is - 0x40 + seq - An acknowlegment packet contains the sequence number of the - packet being acknowledged plus 1 modulo 64. Data packets are - transmitted in sequence. There may only be one outstanding - unacknowledged data packet at a time. The sequence numbers - are independent in each direction. If an acknowledgement for - the previous packet is received (i.e., an acknowledgement with - the sequence number of the packet just sent) the packet just - sent should be retransmitted. If no acknowledgement is - received within a timeout period, the packet should be - retransmitted. This has an unfortunate failure condition on a - high-latency line, as a delayed acknowledgement may lead to an - endless series of duplicate packets. - - DATA The actual data bytes follow. The following characters are - escaped inline with DLE (ASCII 020, or ^P): - SYN (026) DLE S - DLE (020) DLE D - ^C (003) DLE C - ^S (023) DLE s - ^Q (021) DLE q - The additional DLE characters are not counted in the logical - length stored in the TYPE_LEN and LEN1 bytes. - - CSUM1 - CSUM2 - CSUM3 - These bytes contain an 18 bit checksum of the complete - contents of the packet excluding the SEQ byte and the - CSUM[123] bytes. The checksum is simply the twos complement - addition of all the bytes treated as unsigned characters. The - values of the checksum bytes are: - CSUM1: 0x40 + ((cksum >> 12) & 0x3f) - CSUM2: 0x40 + ((cksum >> 6) & 0x3f) - CSUM3: 0x40 + (cksum & 0x3f) - - It happens that the MIPS remote debugging protocol always - communicates with ASCII strings. Because of this, this - implementation doesn't bother to handle the DLE quoting mechanism, - since it will never be required. */ - -/* The SYN character which starts each packet. */ -#define SYN '\026' - -/* The 0x40 used to offset each packet (this value ensures that all of - the header and trailer bytes, other than SYN, are printable ASCII - characters). */ -#define HDR_OFFSET 0x40 - -/* The indices of the bytes in the packet header. */ -#define HDR_INDX_SYN 0 -#define HDR_INDX_TYPE_LEN 1 -#define HDR_INDX_LEN1 2 -#define HDR_INDX_SEQ 3 -#define HDR_LENGTH 4 - -/* The data/ack bit in the TYPE_LEN header byte. */ -#define TYPE_LEN_DA_BIT 0x20 -#define TYPE_LEN_DATA 0 -#define TYPE_LEN_ACK TYPE_LEN_DA_BIT - -/* How to compute the header bytes. */ -#define HDR_SET_SYN(data, len, seq) (SYN) -#define HDR_SET_TYPE_LEN(data, len, seq) \ - (HDR_OFFSET \ - + ((data) ? TYPE_LEN_DATA : TYPE_LEN_ACK) \ - + (((len) >> 6) & 0x1f)) -#define HDR_SET_LEN1(data, len, seq) (HDR_OFFSET + ((len) & 0x3f)) -#define HDR_SET_SEQ(data, len, seq) (HDR_OFFSET + (seq)) - -/* Check that a header byte is reasonable. */ -#define HDR_CHECK(ch) (((ch) & HDR_OFFSET) == HDR_OFFSET) - -/* Get data from the header. These macros evaluate their argument - multiple times. */ -#define HDR_IS_DATA(hdr) \ - (((hdr)[HDR_INDX_TYPE_LEN] & TYPE_LEN_DA_BIT) == TYPE_LEN_DATA) -#define HDR_GET_LEN(hdr) \ - ((((hdr)[HDR_INDX_TYPE_LEN] & 0x1f) << 6) + (((hdr)[HDR_INDX_LEN1] & 0x3f))) -#define HDR_GET_SEQ(hdr) ((hdr)[HDR_INDX_SEQ] & 0x3f) - -/* The maximum data length. */ -#define DATA_MAXLEN 1023 - -/* The trailer offset. */ -#define TRLR_OFFSET HDR_OFFSET - -/* The indices of the bytes in the packet trailer. */ -#define TRLR_INDX_CSUM1 0 -#define TRLR_INDX_CSUM2 1 -#define TRLR_INDX_CSUM3 2 -#define TRLR_LENGTH 3 - -/* How to compute the trailer bytes. */ -#define TRLR_SET_CSUM1(cksum) (TRLR_OFFSET + (((cksum) >> 12) & 0x3f)) -#define TRLR_SET_CSUM2(cksum) (TRLR_OFFSET + (((cksum) >> 6) & 0x3f)) -#define TRLR_SET_CSUM3(cksum) (TRLR_OFFSET + (((cksum) ) & 0x3f)) - -/* Check that a trailer byte is reasonable. */ -#define TRLR_CHECK(ch) (((ch) & TRLR_OFFSET) == TRLR_OFFSET) - -/* Get data from the trailer. This evaluates its argument multiple - times. */ -#define TRLR_GET_CKSUM(trlr) \ - ((((trlr)[TRLR_INDX_CSUM1] & 0x3f) << 12) \ - + (((trlr)[TRLR_INDX_CSUM2] & 0x3f) << 6) \ - + ((trlr)[TRLR_INDX_CSUM3] & 0x3f)) - -/* The sequence number modulos. */ -#define SEQ_MODULOS (64) - -enum mips_monitor_type { - /* IDT/SIM monitor being used: */ - MON_IDT, - /* PMON monitor being used: */ - MON_PMON, - /* Last and unused value, for sizing vectors, etc. */ - MON_LAST -}; -static enum mips_monitor_type mips_monitor = MON_LAST; - -/* The default monitor prompt text: */ -static char *mips_monitor_prompt = TARGET_MONITOR_PROMPT; -/* For the Cogent PMON world this is still not ideal. The default - prompt is "PMON> ", unfortunately the user can change the prompt - and the new prompt will survive over a power-cycle (EEPROM). This - means that the code should really force the monitor prompt to a - known value as the very first action, and that the - "mips_monitor_prompt" support is not needed... since the prompt - could be explicitly set to TARGET_MONITOR_PROMPT (even though it - may be the prompt for a different monitor). However, this will - require changing the mips_initialize reset sequence. (TODO) */ - -/* Set to 1 if the target is open. */ -static int mips_is_open; - -/* Currently active target description (if mips_is_open == 1) */ -static struct target_ops *current_ops; - -/* Set to 1 while the connection is being initialized. */ -static int mips_initializing; - -/* The next sequence number to send. */ -static unsigned int mips_send_seq; - -/* The next sequence number we expect to receive. */ -static unsigned int mips_receive_seq; - -/* The time to wait before retransmitting a packet, in seconds. */ -static int mips_retransmit_wait = 3; - -/* The number of times to try retransmitting a packet before giving up. */ -static int mips_send_retries = 10; - -/* The number of garbage characters to accept when looking for an - SYN for the next packet. */ -static int mips_syn_garbage = 1050; - -/* The time to wait for a packet, in seconds. */ -static int mips_receive_wait = 5; - -/* Set if we have sent a packet to the board but have not yet received - a reply. */ -static int mips_need_reply = 0; - -/* Handle used to access serial I/O stream. */ -static serial_t mips_desc; - -/* Counts the number of times the user tried to interrupt the target (usually - via ^C. */ -static int interrupt_count; - -/* If non-zero, means that the target is running. */ -static int mips_wait_flag = 0; - -/* If non-zero, monitor supports breakpoint commands. */ -static monitor_supports_breakpoints = 0; - -/* Data cache header. */ - -static DCACHE *mips_dcache; - -/* Non-zero means that we've just hit a read or write watchpoint */ -static int hit_watchpoint; - -/* Handle low-level error that we can't recover from. Note that just - error()ing out from target_wait or some such low-level place will cause - all hell to break loose--the rest of GDB will tend to get left in an - inconsistent state. */ - -static NORETURN void -#ifdef ANSI_PROTOTYPES -mips_error (char *string, ...) -#else -mips_error (va_alist) - va_dcl -#endif -{ - va_list args; - -#ifdef ANSI_PROTOTYPES - va_start (args, string); -#else - char *string; - va_start (args); - string = va_arg (args, char *); -#endif - - target_terminal_ours (); - wrap_here(""); /* Force out any buffered output */ - gdb_flush (gdb_stdout); - if (error_pre_print) - fprintf_filtered (gdb_stderr, error_pre_print); - vfprintf_filtered (gdb_stderr, string, args); - fprintf_filtered (gdb_stderr, "\n"); - va_end (args); - gdb_flush (gdb_stderr); - - /* Clean up in such a way that mips_close won't try to talk to the - board (it almost surely won't work since we weren't able to talk to - it). */ - mips_is_open = 0; - SERIAL_CLOSE (mips_desc); - - printf_unfiltered ("Ending remote MIPS debugging.\n"); - target_mourn_inferior (); - - return_to_top_level (RETURN_ERROR); -} - -/* Wait until STRING shows up in mips_desc. Returns 1 if successful, else 0 if - timed out. */ - -int -mips_expect (string) - char *string; -{ - char *p = string; - - immediate_quit = 1; - while (1) - { - int c; - -/* Must use SERIAL_READCHAR here cuz mips_readchar would get confused if we - were waiting for the mips_monitor_prompt... */ - - c = SERIAL_READCHAR (mips_desc, 2); - - if (c == SERIAL_TIMEOUT) - return 0; - - if (c == *p++) - { - if (*p == '\0') - { - immediate_quit = 0; - return 1; - } - } - else - { - p = string; - if (c == *p) - p++; - } - } -} - -/* Read the required number of characters into the given buffer (which - is assumed to be large enough). The only failure is a timeout. */ -int -mips_getstring (string, n) - char *string; - int n; -{ - char *p = string; - int c; - - immediate_quit = 1; - while (n > 0) - { - c = SERIAL_READCHAR (mips_desc, 2); - - if (c == SERIAL_TIMEOUT) { - fprintf_unfiltered (stderr, "Failed to read %d characters from target (TIMEOUT)\n", n); - return 0; - } - - *p++ = c; - n--; - } - - return 1; -} - -/* Read a character from the remote, aborting on error. Returns - SERIAL_TIMEOUT on timeout (since that's what SERIAL_READCHAR - returns). FIXME: If we see the string mips_monitor_prompt from - the board, then we are debugging on the main console port, and we - have somehow dropped out of remote debugging mode. In this case, - we automatically go back in to remote debugging mode. This is a - hack, put in because I can't find any way for a program running on - the remote board to terminate without also ending remote debugging - mode. I assume users won't have any trouble with this; for one - thing, the IDT documentation generally assumes that the remote - debugging port is not the console port. This is, however, very - convenient for DejaGnu when you only have one connected serial - port. */ - -static int -mips_readchar (timeout) - int timeout; -{ - int ch; - static int state = 0; - static int mips_monitor_prompt_len = -1; - - /* NASTY, since we assume that the prompt does not change after the - first mips_readchar call: */ - if (mips_monitor_prompt_len = -1) - mips_monitor_prompt_len = strlen(mips_monitor_prompt); - -#ifdef MAINTENANCE_CMDS - { - int i; - - i = timeout; - if (i == -1 && watchdog > 0) - i = watchdog; - } -#endif - - if (state == mips_monitor_prompt_len) - timeout = 1; - ch = SERIAL_READCHAR (mips_desc, timeout); -#ifdef MAINTENANCE_CMDS - if (ch == SERIAL_TIMEOUT && timeout == -1) /* Watchdog went off */ - { - target_mourn_inferior (); - error ("Watchdog has expired. Target detached.\n"); - } -#endif - if (ch == SERIAL_EOF) - mips_error ("End of file from remote"); - if (ch == SERIAL_ERROR) - mips_error ("Error reading from remote: %s", safe_strerror (errno)); - if (remote_debug > 1) - { - /* Don't use _filtered; we can't deal with a QUIT out of - target_wait, and I think this might be called from there. */ - if (ch != SERIAL_TIMEOUT) - printf_unfiltered ("Read '%c' %d 0x%x\n", ch, ch, ch); - else - printf_unfiltered ("Timed out in read\n"); - } - - /* If we have seen mips_monitor_prompt and we either time out, or - we see a @ (which was echoed from a packet we sent), reset the - board as described above. The first character in a packet after - the SYN (which is not echoed) is always an @ unless the packet is - more than 64 characters long, which ours never are. */ - if ((ch == SERIAL_TIMEOUT || ch == '@') - && state == mips_monitor_prompt_len - && ! mips_initializing) - { - if (remote_debug > 0) - /* Don't use _filtered; we can't deal with a QUIT out of - target_wait, and I think this might be called from there. */ - printf_unfiltered ("Reinitializing MIPS debugging mode\n"); - - mips_need_reply = 0; - mips_initialize (); - - state = 0; - - /* At this point, about the only thing we can do is abort the command - in progress and get back to command level as quickly as possible. */ - - error ("Remote board reset, debug protocol re-initialized."); - } - - if (ch == mips_monitor_prompt[state]) - ++state; - else - state = 0; - - return ch; -} - -/* Get a packet header, putting the data in the supplied buffer. - PGARBAGE is a pointer to the number of garbage characters received - so far. CH is the last character received. Returns 0 for success, - or -1 for timeout. */ - -static int -mips_receive_header (hdr, pgarbage, ch, timeout) - unsigned char *hdr; - int *pgarbage; - int ch; - int timeout; -{ - int i; - - while (1) - { - /* Wait for a SYN. mips_syn_garbage is intended to prevent - sitting here indefinitely if the board sends us one garbage - character per second. ch may already have a value from the - last time through the loop. */ - while (ch != SYN) - { - ch = mips_readchar (timeout); - if (ch == SERIAL_TIMEOUT) - return -1; - if (ch != SYN) - { - /* Printing the character here lets the user of gdb see - what the program is outputting, if the debugging is - being done on the console port. Don't use _filtered; - we can't deal with a QUIT out of target_wait. */ - if (! mips_initializing || remote_debug > 0) - { - /* Note that the host's idea of newline may not - correspond to the target's idea, so recognize - newline by its actual ASCII code, but write it - out using the \n notation. */ - if (ch < 0x20 && ch != '\012') - { - putchar_unfiltered ('^'); - putchar_unfiltered (ch + 0x40); - } - else if (ch == '\012') - putchar_unfiltered ('\n'); - else - putchar_unfiltered (ch); - gdb_flush (gdb_stdout); - } - - ++*pgarbage; - if (mips_syn_garbage > 0 - && *pgarbage > mips_syn_garbage) - mips_error ("Debug protocol failure: more than %d characters before a sync.", - mips_syn_garbage); - } - } - - /* Get the packet header following the SYN. */ - for (i = 1; i < HDR_LENGTH; i++) - { - ch = mips_readchar (timeout); - if (ch == SERIAL_TIMEOUT) - return -1; - /* Make sure this is a header byte. */ - if (ch == SYN || ! HDR_CHECK (ch)) - break; - - hdr[i] = ch; - } - - /* If we got the complete header, we can return. Otherwise we - loop around and keep looking for SYN. */ - if (i >= HDR_LENGTH) - return 0; - } -} - -/* Get a packet header, putting the data in the supplied buffer. - PGARBAGE is a pointer to the number of garbage characters received - so far. The last character read is returned in *PCH. Returns 0 - for success, -1 for timeout, -2 for error. */ - -static int -mips_receive_trailer (trlr, pgarbage, pch, timeout) - unsigned char *trlr; - int *pgarbage; - int *pch; - int timeout; -{ - int i; - int ch; - - for (i = 0; i < TRLR_LENGTH; i++) - { - ch = mips_readchar (timeout); - *pch = ch; - if (ch == SERIAL_TIMEOUT) - return -1; - if (! TRLR_CHECK (ch)) - return -2; - trlr[i] = ch; - } - return 0; -} - -/* Get the checksum of a packet. HDR points to the packet header. - DATA points to the packet data. LEN is the length of DATA. */ - -static int -mips_cksum (hdr, data, len) - const unsigned char *hdr; - const unsigned char *data; - int len; -{ - register const unsigned char *p; - register int c; - register int cksum; - - cksum = 0; - - /* The initial SYN is not included in the checksum. */ - c = HDR_LENGTH - 1; - p = hdr + 1; - while (c-- != 0) - cksum += *p++; - - c = len; - p = data; - while (c-- != 0) - cksum += *p++; - - return cksum; -} - -/* Send a packet containing the given ASCII string. */ - -static void -mips_send_packet (s, get_ack) - const char *s; - int get_ack; -{ - unsigned int len; - unsigned char *packet; - register int cksum; - int try; - - len = strlen (s); - if (len > DATA_MAXLEN) - mips_error ("MIPS protocol data packet too long: %s", s); - - packet = (unsigned char *) alloca (HDR_LENGTH + len + TRLR_LENGTH + 1); - - packet[HDR_INDX_SYN] = HDR_SET_SYN (1, len, mips_send_seq); - packet[HDR_INDX_TYPE_LEN] = HDR_SET_TYPE_LEN (1, len, mips_send_seq); - packet[HDR_INDX_LEN1] = HDR_SET_LEN1 (1, len, mips_send_seq); - packet[HDR_INDX_SEQ] = HDR_SET_SEQ (1, len, mips_send_seq); - - memcpy (packet + HDR_LENGTH, s, len); - - cksum = mips_cksum (packet, packet + HDR_LENGTH, len); - packet[HDR_LENGTH + len + TRLR_INDX_CSUM1] = TRLR_SET_CSUM1 (cksum); - packet[HDR_LENGTH + len + TRLR_INDX_CSUM2] = TRLR_SET_CSUM2 (cksum); - packet[HDR_LENGTH + len + TRLR_INDX_CSUM3] = TRLR_SET_CSUM3 (cksum); - - /* Increment the sequence number. This will set mips_send_seq to - the sequence number we expect in the acknowledgement. */ - mips_send_seq = (mips_send_seq + 1) % SEQ_MODULOS; - - /* We can only have one outstanding data packet, so we just wait for - the acknowledgement here. Keep retransmitting the packet until - we get one, or until we've tried too many times. */ - for (try = 0; try < mips_send_retries; try++) - { - int garbage; - int ch; - - if (remote_debug > 0) - { - /* Don't use _filtered; we can't deal with a QUIT out of - target_wait, and I think this might be called from there. */ - packet[HDR_LENGTH + len + TRLR_LENGTH] = '\0'; - printf_unfiltered ("Writing \"%s\"\n", packet + 1); - } - - if (SERIAL_WRITE (mips_desc, packet, - HDR_LENGTH + len + TRLR_LENGTH) != 0) - mips_error ("write to target failed: %s", safe_strerror (errno)); - - if (! get_ack) - return; - - garbage = 0; - ch = 0; - while (1) - { - unsigned char hdr[HDR_LENGTH + 1]; - unsigned char trlr[TRLR_LENGTH + 1]; - int err; - int seq; - - /* Get the packet header. If we time out, resend the data - packet. */ - err = mips_receive_header (hdr, &garbage, ch, mips_retransmit_wait); - if (err != 0) - break; - - ch = 0; - - /* If we get a data packet, assume it is a duplicate and - ignore it. FIXME: If the acknowledgement is lost, this - data packet may be the packet the remote sends after the - acknowledgement. */ - if (HDR_IS_DATA (hdr)) { - int i; - - /* Ignore any errors raised whilst attempting to ignore - packet. */ - - len = HDR_GET_LEN (hdr); - - for (i = 0; i < len; i++) - { - int rch; - - rch = mips_readchar (2); - if (rch == SYN) - { - ch = SYN; - break; - } - if (rch == SERIAL_TIMEOUT) - break; - /* ignore the character */ - } - - if (i == len) - (void) mips_receive_trailer (trlr, &garbage, &ch, 2); - - /* We don't bother checking the checksum, or providing an - ACK to the packet. */ - continue; - } - - /* If the length is not 0, this is a garbled packet. */ - if (HDR_GET_LEN (hdr) != 0) - continue; - - /* Get the packet trailer. */ - err = mips_receive_trailer (trlr, &garbage, &ch, - mips_retransmit_wait); - - /* If we timed out, resend the data packet. */ - if (err == -1) - break; - - /* If we got a bad character, reread the header. */ - if (err != 0) - continue; - - /* If the checksum does not match the trailer checksum, this - is a bad packet; ignore it. */ - if (mips_cksum (hdr, (unsigned char *) NULL, 0) - != TRLR_GET_CKSUM (trlr)) - continue; - - if (remote_debug > 0) - { - hdr[HDR_LENGTH] = '\0'; - trlr[TRLR_LENGTH] = '\0'; - /* Don't use _filtered; we can't deal with a QUIT out of - target_wait, and I think this might be called from there. */ - printf_unfiltered ("Got ack %d \"%s%s\"\n", - HDR_GET_SEQ (hdr), hdr + 1, trlr); - } - - /* If this ack is for the current packet, we're done. */ - seq = HDR_GET_SEQ (hdr); - if (seq == mips_send_seq) - return; - - /* If this ack is for the last packet, resend the current - packet. */ - if ((seq + 1) % SEQ_MODULOS == mips_send_seq) - break; - - /* Otherwise this is a bad ack; ignore it. Increment the - garbage count to ensure that we do not stay in this loop - forever. */ - ++garbage; - } - } - - mips_error ("Remote did not acknowledge packet"); -} - -/* Receive and acknowledge a packet, returning the data in BUFF (which - should be DATA_MAXLEN + 1 bytes). The protocol documentation - implies that only the sender retransmits packets, so this code just - waits silently for a packet. It returns the length of the received - packet. If THROW_ERROR is nonzero, call error() on errors. If not, - don't print an error message and return -1. */ - -static int -mips_receive_packet (buff, throw_error, timeout) - char *buff; - int throw_error; - int timeout; -{ - int ch; - int garbage; - int len; - unsigned char ack[HDR_LENGTH + TRLR_LENGTH + 1]; - int cksum; - - ch = 0; - garbage = 0; - while (1) - { - unsigned char hdr[HDR_LENGTH]; - unsigned char trlr[TRLR_LENGTH]; - int i; - int err; - - if (mips_receive_header (hdr, &garbage, ch, timeout) != 0) - { - if (throw_error) - mips_error ("Timed out waiting for remote packet"); - else - return -1; - } - - ch = 0; - - /* An acknowledgement is probably a duplicate; ignore it. */ - if (! HDR_IS_DATA (hdr)) - { - len = HDR_GET_LEN (hdr); - /* Check if the length is valid for an ACK, we may aswell - try and read the remainder of the packet: */ - if (len == 0) - { - /* Ignore the error condition, since we are going to - ignore the packet anyway. */ - (void) mips_receive_trailer (trlr, &garbage, &ch, timeout); - } - /* Don't use _filtered; we can't deal with a QUIT out of - target_wait, and I think this might be called from there. */ - if (remote_debug > 0) - printf_unfiltered ("Ignoring unexpected ACK\n"); - continue; - } - - len = HDR_GET_LEN (hdr); - for (i = 0; i < len; i++) - { - int rch; - - rch = mips_readchar (timeout); - if (rch == SYN) - { - ch = SYN; - break; - } - if (rch == SERIAL_TIMEOUT) - { - if (throw_error) - mips_error ("Timed out waiting for remote packet"); - else - return -1; - } - buff[i] = rch; - } - - if (i < len) - { - /* Don't use _filtered; we can't deal with a QUIT out of - target_wait, and I think this might be called from there. */ - if (remote_debug > 0) - printf_unfiltered ("Got new SYN after %d chars (wanted %d)\n", - i, len); - continue; - } - - err = mips_receive_trailer (trlr, &garbage, &ch, timeout); - if (err == -1) - { - if (throw_error) - mips_error ("Timed out waiting for packet"); - else - return -1; - } - if (err == -2) - { - /* Don't use _filtered; we can't deal with a QUIT out of - target_wait, and I think this might be called from there. */ - if (remote_debug > 0) - printf_unfiltered ("Got SYN when wanted trailer\n"); - continue; - } - - /* If this is the wrong sequence number, ignore it. */ - if (HDR_GET_SEQ (hdr) != mips_receive_seq) - { - /* Don't use _filtered; we can't deal with a QUIT out of - target_wait, and I think this might be called from there. */ - if (remote_debug > 0) - printf_unfiltered ("Ignoring sequence number %d (want %d)\n", - HDR_GET_SEQ (hdr), mips_receive_seq); - continue; - } - - if (mips_cksum (hdr, buff, len) == TRLR_GET_CKSUM (trlr)) - break; - - if (remote_debug > 0) - /* Don't use _filtered; we can't deal with a QUIT out of - target_wait, and I think this might be called from there. */ - printf_unfiltered ("Bad checksum; data %d, trailer %d\n", - mips_cksum (hdr, buff, len), - TRLR_GET_CKSUM (trlr)); - - /* The checksum failed. Send an acknowledgement for the - previous packet to tell the remote to resend the packet. */ - ack[HDR_INDX_SYN] = HDR_SET_SYN (0, 0, mips_receive_seq); - ack[HDR_INDX_TYPE_LEN] = HDR_SET_TYPE_LEN (0, 0, mips_receive_seq); - ack[HDR_INDX_LEN1] = HDR_SET_LEN1 (0, 0, mips_receive_seq); - ack[HDR_INDX_SEQ] = HDR_SET_SEQ (0, 0, mips_receive_seq); - - cksum = mips_cksum (ack, (unsigned char *) NULL, 0); - - ack[HDR_LENGTH + TRLR_INDX_CSUM1] = TRLR_SET_CSUM1 (cksum); - ack[HDR_LENGTH + TRLR_INDX_CSUM2] = TRLR_SET_CSUM2 (cksum); - ack[HDR_LENGTH + TRLR_INDX_CSUM3] = TRLR_SET_CSUM3 (cksum); - - if (remote_debug > 0) - { - ack[HDR_LENGTH + TRLR_LENGTH] = '\0'; - /* Don't use _filtered; we can't deal with a QUIT out of - target_wait, and I think this might be called from there. */ - printf_unfiltered ("Writing ack %d \"%s\"\n", mips_receive_seq, - ack + 1); - } - - if (SERIAL_WRITE (mips_desc, ack, HDR_LENGTH + TRLR_LENGTH) != 0) - { - if (throw_error) - mips_error ("write to target failed: %s", safe_strerror (errno)); - else - return -1; - } - } - - if (remote_debug > 0) - { - buff[len] = '\0'; - /* Don't use _filtered; we can't deal with a QUIT out of - target_wait, and I think this might be called from there. */ - printf_unfiltered ("Got packet \"%s\"\n", buff); - } - - /* We got the packet. Send an acknowledgement. */ - mips_receive_seq = (mips_receive_seq + 1) % SEQ_MODULOS; - - ack[HDR_INDX_SYN] = HDR_SET_SYN (0, 0, mips_receive_seq); - ack[HDR_INDX_TYPE_LEN] = HDR_SET_TYPE_LEN (0, 0, mips_receive_seq); - ack[HDR_INDX_LEN1] = HDR_SET_LEN1 (0, 0, mips_receive_seq); - ack[HDR_INDX_SEQ] = HDR_SET_SEQ (0, 0, mips_receive_seq); - - cksum = mips_cksum (ack, (unsigned char *) NULL, 0); - - ack[HDR_LENGTH + TRLR_INDX_CSUM1] = TRLR_SET_CSUM1 (cksum); - ack[HDR_LENGTH + TRLR_INDX_CSUM2] = TRLR_SET_CSUM2 (cksum); - ack[HDR_LENGTH + TRLR_INDX_CSUM3] = TRLR_SET_CSUM3 (cksum); - - if (remote_debug > 0) - { - ack[HDR_LENGTH + TRLR_LENGTH] = '\0'; - /* Don't use _filtered; we can't deal with a QUIT out of - target_wait, and I think this might be called from there. */ - printf_unfiltered ("Writing ack %d \"%s\"\n", mips_receive_seq, - ack + 1); - } - - if (SERIAL_WRITE (mips_desc, ack, HDR_LENGTH + TRLR_LENGTH) != 0) - { - if (throw_error) - mips_error ("write to target failed: %s", safe_strerror (errno)); - else - return -1; - } - - return len; -} - -/* Optionally send a request to the remote system and optionally wait - for the reply. This implements the remote debugging protocol, - which is built on top of the packet protocol defined above. Each - request has an ADDR argument and a DATA argument. The following - requests are defined: - - \0 don't send a request; just wait for a reply - i read word from instruction space at ADDR - d read word from data space at ADDR - I write DATA to instruction space at ADDR - D write DATA to data space at ADDR - r read register number ADDR - R set register number ADDR to value DATA - c continue execution (if ADDR != 1, set pc to ADDR) - s single step (if ADDR != 1, set pc to ADDR) - - The read requests return the value requested. The write requests - return the previous value in the changed location. The execution - requests return a UNIX wait value (the approximate signal which - caused execution to stop is in the upper eight bits). - - If PERR is not NULL, this function waits for a reply. If an error - occurs, it sets *PERR to 1 and sets errno according to what the - target board reports. */ - -static int -mips_request (cmd, addr, data, perr, timeout, buff) - int cmd; - unsigned int addr; - unsigned int data; - int *perr; - int timeout; - char *buff; -{ - char myBuff[DATA_MAXLEN + 1]; - int len; - int rpid; - char rcmd; - int rerrflg; - int rresponse; - - if (buff == (char *) NULL) - buff = myBuff; - - if (cmd != '\0') - { - if (mips_need_reply) - fatal ("mips_request: Trying to send command before reply"); - sprintf (buff, "0x0 %c 0x%x 0x%x", cmd, addr, data); - mips_send_packet (buff, 1); - mips_need_reply = 1; - } - - if (perr == (int *) NULL) - return 0; - - if (! mips_need_reply) - fatal ("mips_request: Trying to get reply before command"); - - mips_need_reply = 0; - - len = mips_receive_packet (buff, 1, timeout); - buff[len] = '\0'; - - if (sscanf (buff, "0x%x %c 0x%x 0x%x", - &rpid, &rcmd, &rerrflg, &rresponse) != 4 - || (cmd != '\0' && rcmd != cmd)) - mips_error ("Bad response from remote board"); - - if (rerrflg != 0) - { - *perr = 1; - - /* FIXME: This will returns MIPS errno numbers, which may or may - not be the same as errno values used on other systems. If - they stick to common errno values, they will be the same, but - if they don't, they must be translated. */ - errno = rresponse; - - return 0; - } - - *perr = 0; - return rresponse; -} - -static void -mips_initialize_cleanups (arg) - PTR arg; -{ - mips_initializing = 0; -} - -static void -mips_send_command (cmd, prompt) - const char *cmd; - int prompt; -{ - SERIAL_WRITE (mips_desc, cmd, strlen(cmd)); - mips_expect (cmd); - mips_expect ("\012"); - if (prompt) - mips_expect (mips_monitor_prompt); -} - -/* Enter remote (dbx) debug mode: */ -static void -mips_enter_debug () -{ - /* Reset the sequence numbers, ready for the new debug sequence: */ - mips_send_seq = 0; - mips_receive_seq = 0; - - if (mips_monitor == MON_PMON) - mips_send_command ("debug\015", 0); - else /* assume IDT monitor by default */ - mips_send_command ("db tty0\015", 0); - - SERIAL_WRITE (mips_desc, "\015", sizeof "\015" - 1); - - /* We don't need to absorb any spurious characters here, since the - mips_receive_header will eat up a reasonable number of characters - whilst looking for the SYN, however this avoids the "garbage" - being displayed to the user. */ - if (mips_monitor == MON_PMON) - mips_expect ("\015"); - - { - char buff[DATA_MAXLEN + 1]; - if (mips_receive_packet (buff, 1, 3) < 0) - mips_error ("Failed to initialize (didn't receive packet)."); - } -} - -/* Exit remote (dbx) debug mode, returning to the monitor prompt: */ -static int -mips_exit_debug () -{ - int err; - - mips_request ('x', (unsigned int) 0, (unsigned int) 0, &err, - mips_receive_wait, NULL); - - if (mips_monitor == MON_PMON && !mips_expect ("Exiting remote debug mode")) - return -1; - - if (!mips_expect ("\015\012")) - return -1; - - if (!mips_expect (mips_monitor_prompt)) - return -1; - - return 0; -} - -/* Initialize a new connection to the MIPS board, and make sure we are - really connected. */ - -static void -mips_initialize () -{ - int err; - struct cleanup *old_cleanups = make_cleanup (mips_initialize_cleanups, NULL); - int j; - - /* What is this code doing here? I don't see any way it can happen, and - it might mean mips_initializing didn't get cleared properly. - So I'll make it a warning. */ - - if (mips_initializing) - { - warning ("internal error: mips_initialize called twice"); - return; - } - - mips_wait_flag = 0; - mips_initializing = 1; - - /* At this point, the packit protocol isn't responding. We'll try getting - into the monitor, and restarting the protocol. */ - - /* Force the system into the monitor. After this we *should* be at - the mips_monitor_prompt. */ - if (mips_monitor == MON_PMON) - j = 0; /* start by checking if we are already at the prompt */ - else - j = 1; /* start by sending a break */ - for (; j <= 4; j++) - { - switch (j) - { - case 0: /* First, try sending a CR */ - SERIAL_FLUSH_INPUT (mips_desc); - SERIAL_WRITE (mips_desc, "\015", 1); - break; - case 1: /* First, try sending a break */ - SERIAL_SEND_BREAK (mips_desc); - break; - case 2: /* Then, try a ^C */ - SERIAL_WRITE (mips_desc, "\003", 1); - break; - case 3: /* Then, try escaping from download */ - { - if (mips_monitor == MON_PMON) - { - char tbuff[7]; - - /* We shouldn't need to send multiple termination - sequences, since the target performs line (or - block) reads, and then processes those - packets. In-case we were downloading a large packet - we flush the output buffer before inserting a - termination sequence. */ - SERIAL_FLUSH_OUTPUT (mips_desc); - sprintf (tbuff, "\015/E/E\015"); - SERIAL_WRITE (mips_desc, tbuff, 6); - } - else - { - char srec[10]; - int i; - - /* We are possibly in binary download mode, having - aborted in the middle of an S-record. ^C won't - work because of binary mode. The only reliable way - out is to send enough termination packets (8 bytes) - to fill up and then overflow the largest size - S-record (255 bytes in this case). This amounts to - 256/8 + 1 packets. - */ - - mips_make_srec (srec, '7', 0, NULL, 0); - - for (i = 1; i <= 33; i++) - { - SERIAL_WRITE (mips_desc, srec, 8); - - if (SERIAL_READCHAR (mips_desc, 0) >= 0) - break; /* Break immediatly if we get something from - the board. */ - } - } - } - break; - case 4: - mips_error ("Failed to initialize."); - } - - if (mips_expect (mips_monitor_prompt)) - break; - } - - if (mips_monitor == MON_PMON) - { - /* Ensure the correct target state: */ - mips_send_command ("set regsize 64\015", -1); - mips_send_command ("set hostport tty0\015", -1); - mips_send_command ("set brkcmd \"\"\015", -1); - /* Delete all the current breakpoints: */ - mips_send_command ("db *\015", -1); - /* NOTE: PMON does not have breakpoint support through the - "debug" mode, only at the monitor command-line. */ - } - - mips_enter_debug (); - - /* Clear all breakpoints: */ - if (common_breakpoint ('b', -1, 0, NULL)) - monitor_supports_breakpoints = 0; - else - monitor_supports_breakpoints = 1; - - do_cleanups (old_cleanups); - - /* If this doesn't call error, we have connected; we don't care if - the request itself succeeds or fails. */ - - mips_request ('r', (unsigned int) 0, (unsigned int) 0, &err, - mips_receive_wait, NULL); - set_current_frame (create_new_frame (read_fp (), read_pc ())); - select_frame (get_current_frame (), 0); -} - -/* Open a connection to the remote board. */ -static void -common_open (ops, name, from_tty) - struct target_ops *ops; - char *name; - int from_tty; -{ - char *ptype; - - if (name == 0) - error ( -"To open a MIPS remote debugging connection, you need to specify what serial\n\ -device is attached to the target board (e.g., /dev/ttya)."); - - target_preopen (from_tty); - - if (mips_is_open) - unpush_target (current_ops); - - mips_desc = SERIAL_OPEN (name); - if (mips_desc == (serial_t) NULL) - perror_with_name (name); - - if (baud_rate != -1) - { - if (SERIAL_SETBAUDRATE (mips_desc, baud_rate)) - { - SERIAL_CLOSE (mips_desc); - perror_with_name (name); - } - } - - SERIAL_RAW (mips_desc); - - current_ops = ops; - mips_is_open = 1; - - mips_initialize (); - - if (from_tty) - printf_unfiltered ("Remote MIPS debugging using %s\n", name); - - /* Switch to using remote target now. */ - push_target (ops); - - /* FIXME: Should we call start_remote here? */ - - /* Try to figure out the processor model if possible. */ - ptype = mips_read_processor_type (); - if (ptype) - mips_set_processor_type_command (strsave (ptype), 0); - -/* This is really the job of start_remote however, that makes an assumption - that the target is about to print out a status message of some sort. That - doesn't happen here (in fact, it may not be possible to get the monitor to - send the appropriate packet). */ - - flush_cached_frames (); - registers_changed (); - stop_pc = read_pc (); - set_current_frame (create_new_frame (read_fp (), stop_pc)); - select_frame (get_current_frame (), 0); - print_stack_frame (selected_frame, -1, 1); -} - -static void -mips_open (name, from_tty) - char *name; - int from_tty; -{ - mips_monitor = MON_IDT; - common_open (&mips_ops, name, from_tty); -} - -static void -pmon_open (name, from_tty) - char *name; - int from_tty; -{ - /* The PMON monitor has a prompt different from the default - "TARGET_MONITOR_PROMPT": */ - mips_monitor_prompt = "PMON> "; - mips_monitor = MON_PMON; - common_open (&pmon_ops, name, from_tty); -} - - -/* Close a connection to the remote board. */ - -static void -mips_close (quitting) - int quitting; -{ - if (mips_is_open) - { - int err; - - mips_is_open = 0; - - /* Get the board out of remote debugging mode. */ - (void) mips_exit_debug (); - - SERIAL_CLOSE (mips_desc); - } -} - -/* Detach from the remote board. */ - -static void -mips_detach (args, from_tty) - char *args; - int from_tty; -{ - if (args) - error ("Argument given to \"detach\" when remotely debugging."); - - pop_target (); - - mips_close (1); - - if (from_tty) - printf_unfiltered ("Ending remote MIPS debugging.\n"); -} - -/* Tell the target board to resume. This does not wait for a reply - from the board. */ - -static void -mips_resume (pid, step, siggnal) - int pid, step; - enum target_signal siggnal; -{ - - - mips_request (step ? 's' : 'c', - (unsigned int) 1, - (unsigned int) siggnal, - (int *) NULL, - mips_receive_wait, NULL); -} - -/* Return the signal corresponding to SIG, where SIG is the number which - the MIPS protocol uses for the signal. */ -enum target_signal -mips_signal_from_protocol (sig) - int sig; -{ - /* We allow a few more signals than the IDT board actually returns, on - the theory that there is at least *some* hope that perhaps the numbering - for these signals is widely agreed upon. */ - if (sig <= 0 - || sig > 31) - return TARGET_SIGNAL_UNKNOWN; - - /* Don't want to use target_signal_from_host because we are converting - from MIPS signal numbers, not host ones. Our internal numbers - match the MIPS numbers for the signals the board can return, which - are: SIGINT, SIGSEGV, SIGBUS, SIGILL, SIGFPE, SIGTRAP. */ - return (enum target_signal) sig; -} - -/* Wait until the remote stops, and return a wait status. */ - -static int -mips_wait (pid, status) - int pid; - struct target_waitstatus *status; -{ - int rstatus; - int err; - char buff[DATA_MAXLEN]; - int rpc, rfp, rsp; - char flags[20]; - int nfields; - - interrupt_count = 0; - hit_watchpoint = 0; - - /* If we have not sent a single step or continue command, then the - board is waiting for us to do something. Return a status - indicating that it is stopped. */ - if (! mips_need_reply) - { - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_TRAP; - return 0; - } - - /* No timeout; we sit here as long as the program continues to execute. */ - mips_wait_flag = 1; - rstatus = mips_request ('\000', (unsigned int) 0, (unsigned int) 0, &err, -1, - buff); - mips_wait_flag = 0; - if (err) - mips_error ("Remote failure: %s", safe_strerror (errno)); - - nfields = sscanf (buff, "0x%*x %*c 0x%*x 0x%*x 0x%x 0x%x 0x%x 0x%*x %s", - &rpc, &rfp, &rsp, flags); - - /* See if we got back extended status. If so, pick out the pc, fp, sp, etc... */ - - if (nfields == 7 || nfields == 9) - { - char buf[MAX_REGISTER_RAW_SIZE]; - - store_unsigned_integer (buf, REGISTER_RAW_SIZE (PC_REGNUM), rpc); - supply_register (PC_REGNUM, buf); - - store_unsigned_integer (buf, REGISTER_RAW_SIZE (PC_REGNUM), rfp); - supply_register (30, buf); /* This register they are avoiding and so it is unnamed */ - - store_unsigned_integer (buf, REGISTER_RAW_SIZE (SP_REGNUM), rsp); - supply_register (SP_REGNUM, buf); - - store_unsigned_integer (buf, REGISTER_RAW_SIZE (FP_REGNUM), 0); - supply_register (FP_REGNUM, buf); - - if (nfields == 9) - { - int i; - - for (i = 0; i <= 2; i++) - if (flags[i] == 'r' || flags[i] == 'w') - hit_watchpoint = 1; - else if (flags[i] == '\000') - break; - } - } - - /* Translate a MIPS waitstatus. We use constants here rather than WTERMSIG - and so on, because the constants we want here are determined by the - MIPS protocol and have nothing to do with what host we are running on. */ - if ((rstatus & 0377) == 0) - { - status->kind = TARGET_WAITKIND_EXITED; - status->value.integer = (((rstatus) >> 8) & 0377); - } - else if ((rstatus & 0377) == 0177) - { - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = mips_signal_from_protocol (((rstatus) >> 8) & 0377); - } - else - { - status->kind = TARGET_WAITKIND_SIGNALLED; - status->value.sig = mips_signal_from_protocol (rstatus & 0177); - } - - return 0; -} - -static int -pmon_wait (pid, status) - int pid; - struct target_waitstatus *status; -{ - int rstatus; - int err; - char buff[DATA_MAXLEN]; - - interrupt_count = 0; - hit_watchpoint = 0; - - /* If we have not sent a single step or continue command, then the - board is waiting for us to do something. Return a status - indicating that it is stopped. */ - if (! mips_need_reply) - { - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_TRAP; - return 0; - } - - /* Sit, polling the serial until the target decides to talk to - us. NOTE: the timeout value we use is used not just for the - first character, but for all the characters. */ - mips_wait_flag = 1; - rstatus = mips_request ('\000', (unsigned int) 0, (unsigned int) 0, &err, -1, - buff); - mips_wait_flag = 0; - if (err) - mips_error ("Remote failure: %s", safe_strerror (errno)); - - /* NOTE: The following (sig) numbers are defined by PMON: - SPP_SIGTRAP 5 breakpoint - SPP_SIGINT 2 - SPP_SIGSEGV 11 - SPP_SIGBUS 10 - SPP_SIGILL 4 - SPP_SIGFPE 8 - SPP_SIGTERM 15 */ - - /* On returning from a continue, the PMON monitor seems to start - echoing back the messages we send prior to sending back the - ACK. The code can cope with this, but to try and avoid the - unnecessary serial traffic, and "spurious" characters displayed - to the user, we cheat and reset the debug protocol. The problems - seems to be caused by a check on the number of arguments, and the - command length, within the monitor causing it to echo the command - as a bad packet. */ - mips_exit_debug (); - mips_enter_debug (); - - /* Translate a MIPS waitstatus. We use constants here rather than WTERMSIG - and so on, because the constants we want here are determined by the - MIPS protocol and have nothing to do with what host we are running on. */ - if ((rstatus & 0377) == 0) - { - status->kind = TARGET_WAITKIND_EXITED; - status->value.integer = (((rstatus) >> 8) & 0377); - } - else if ((rstatus & 0377) == 0177) - { - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = mips_signal_from_protocol (((rstatus) >> 8) & 0377); - } - else - { - status->kind = TARGET_WAITKIND_SIGNALLED; - status->value.sig = mips_signal_from_protocol (rstatus & 0177); - } - - return 0; -} - -/* We have to map between the register numbers used by gdb and the - register numbers used by the debugging protocol. This function - assumes that we are using tm-mips.h. */ - -#define REGNO_OFFSET 96 - -static int -mips_map_regno (regno) - int regno; -{ - if (regno < 32) - return regno; - if (regno >= FP0_REGNUM && regno < FP0_REGNUM + 32) - return regno - FP0_REGNUM + 32; - switch (regno) - { - case PC_REGNUM: - return REGNO_OFFSET + 0; - case CAUSE_REGNUM: - return REGNO_OFFSET + 1; - case HI_REGNUM: - return REGNO_OFFSET + 2; - case LO_REGNUM: - return REGNO_OFFSET + 3; - case FCRCS_REGNUM: - return REGNO_OFFSET + 4; - case FCRIR_REGNUM: - return REGNO_OFFSET + 5; - default: - /* FIXME: Is there a way to get the status register? */ - return 0; - } -} - -/* Fetch the remote registers. */ - -static void -mips_fetch_registers (regno) - int regno; -{ - unsigned LONGEST val; - int err; - - if (regno == -1) - { - for (regno = 0; regno < NUM_REGS; regno++) - mips_fetch_registers (regno); - return; - } - - if (regno == FP_REGNUM || regno == ZERO_REGNUM) - /* FP_REGNUM on the mips is a hack which is just supposed to read - zero (see also mips-nat.c). */ - val = 0; - else - { -#if 0 /* Unfortunately the PMON version in the Vr4300 board has been - compiled without the 64bit register access commands. This - means we cannot get hold of the full register width. */ - if (mips_monitor == MON_PMON) - val = mips_request ('t', (unsigned int) mips_map_regno (regno), - (unsigned int) 0, &err, mips_receive_wait, NULL); - else -#endif - val = mips_request ('r', (unsigned int) mips_map_regno (regno), - (unsigned int) 0, &err, mips_receive_wait, NULL); - if (err) - mips_error ("Can't read register %d: %s", regno, - safe_strerror (errno)); - } - - { - char buf[MAX_REGISTER_RAW_SIZE]; - - /* We got the number the register holds, but gdb expects to see a - value in the target byte ordering. */ - store_unsigned_integer (buf, REGISTER_RAW_SIZE (regno), val); - supply_register (regno, buf); - } -} - -/* Prepare to store registers. The MIPS protocol can store individual - registers, so this function doesn't have to do anything. */ - -static void -mips_prepare_to_store () -{ -} - -/* Store remote register(s). */ - -static void -mips_store_registers (regno) - int regno; -{ - int err; - - if (regno == -1) - { - for (regno = 0; regno < NUM_REGS; regno++) - mips_store_registers (regno); - return; - } - - mips_request ('R', (unsigned int) mips_map_regno (regno), - (unsigned int) read_register (regno), - &err, mips_receive_wait, NULL); - if (err) - mips_error ("Can't write register %d: %s", regno, safe_strerror (errno)); -} - -/* Fetch a word from the target board. */ - -static int -mips_fetch_word (addr) - CORE_ADDR addr; -{ - int val; - int err; - - val = mips_request ('d', (unsigned int) addr, (unsigned int) 0, &err, - mips_receive_wait, NULL); - if (err) - { - /* Data space failed; try instruction space. */ - val = mips_request ('i', (unsigned int) addr, (unsigned int) 0, &err, - mips_receive_wait, NULL); - if (err) - mips_error ("Can't read address 0x%x: %s", addr, safe_strerror (errno)); - } - return val; -} - -/* Store a word to the target board. Returns errno code or zero for - success. If OLD_CONTENTS is non-NULL, put the old contents of that - memory location there. */ - -static int -mips_store_word (addr, val, old_contents) - CORE_ADDR addr; - int val; - char *old_contents; -{ - int err; - unsigned int oldcontents; - - oldcontents = mips_request ('D', (unsigned int) addr, (unsigned int) val, - &err, - mips_receive_wait, NULL); - if (err) - { - /* Data space failed; try instruction space. */ - oldcontents = mips_request ('I', (unsigned int) addr, - (unsigned int) val, &err, - mips_receive_wait, NULL); - if (err) - return errno; - } - if (old_contents != NULL) - store_unsigned_integer (old_contents, 4, oldcontents); - return 0; -} - -/* Read or write LEN bytes from inferior memory at MEMADDR, - transferring to or from debugger address MYADDR. Write to inferior - if SHOULD_WRITE is nonzero. Returns length of data written or - read; 0 for error. Note that protocol gives us the correct value - for a longword, since it transfers values in ASCII. We want the - byte values, so we have to swap the longword values. */ - -static int -mips_xfer_memory (memaddr, myaddr, len, write, ignore) - CORE_ADDR memaddr; - char *myaddr; - int len; - int write; - struct target_ops *ignore; -{ - register int i; - /* Round starting address down to longword boundary. */ - register CORE_ADDR addr = memaddr &~ 3; - /* Round ending address up; get number of longwords that makes. */ - register int count = (((memaddr + len) - addr) + 3) / 4; - /* Allocate buffer of that many longwords. */ - register char *buffer = alloca (count * 4); - - int status; - - if (write) - { - /* Fill start and end extra bytes of buffer with existing data. */ - if (addr != memaddr || len < 4) - { - /* Need part of initial word -- fetch it. */ - store_unsigned_integer (&buffer[0], 4, mips_fetch_word (addr)); - } - - if (count > 1) - { - /* Need part of last word -- fetch it. FIXME: we do this even - if we don't need it. */ - store_unsigned_integer (&buffer[(count - 1) * 4], 4, - mips_fetch_word (addr + (count - 1) * 4)); - } - - /* Copy data to be written over corresponding part of buffer */ - - memcpy ((char *) buffer + (memaddr & 3), myaddr, len); - - /* Write the entire buffer. */ - - for (i = 0; i < count; i++, addr += 4) - { - status = mips_store_word (addr, - extract_unsigned_integer (&buffer[i*4], 4), - NULL); - /* Report each kilobyte (we download 32-bit words at a time) */ - if (i % 256 == 255) - { - printf_unfiltered ("*"); - fflush (stdout); - } - if (status) - { - errno = status; - return 0; - } - /* FIXME: Do we want a QUIT here? */ - } - if (count >= 256) - printf_unfiltered ("\n"); - } - else - { - /* Read all the longwords */ - for (i = 0; i < count; i++, addr += 4) - { - store_unsigned_integer (&buffer[i*4], 4, mips_fetch_word (addr)); - QUIT; - } - - /* Copy appropriate bytes out of the buffer. */ - memcpy (myaddr, buffer + (memaddr & 3), len); - } - return len; -} - -/* Print info on this target. */ - -static void -mips_files_info (ignore) - struct target_ops *ignore; -{ - printf_unfiltered ("Debugging a MIPS board over a serial line.\n"); -} - -/* Kill the process running on the board. This will actually only - work if we are doing remote debugging over the console input. I - think that if IDT/sim had the remote debug interrupt enabled on the - right port, we could interrupt the process with a break signal. */ - -static void -mips_kill () -{ - if (!mips_wait_flag) - return; - - interrupt_count++; - - if (interrupt_count >= 2) - { - interrupt_count = 0; - - target_terminal_ours (); - - if (query ("Interrupted while waiting for the program.\n\ -Give up (and stop debugging it)? ")) - { - /* Clean up in such a way that mips_close won't try to talk to the - board (it almost surely won't work since we weren't able to talk to - it). */ - mips_wait_flag = 0; - mips_is_open = 0; - SERIAL_CLOSE (mips_desc); - - printf_unfiltered ("Ending remote MIPS debugging.\n"); - target_mourn_inferior (); - - return_to_top_level (RETURN_QUIT); - } - - target_terminal_inferior (); - } - - if (remote_debug > 0) - printf_unfiltered ("Sending break\n"); - - SERIAL_SEND_BREAK (mips_desc); - -#if 0 - if (mips_is_open) - { - char cc; - - /* Send a ^C. */ - cc = '\003'; - SERIAL_WRITE (mips_desc, &cc, 1); - sleep (1); - target_mourn_inferior (); - } -#endif -} - -/* Start running on the target board. */ - -static void -mips_create_inferior (execfile, args, env) - char *execfile; - char *args; - char **env; -{ - CORE_ADDR entry_pt; - - if (args && *args) - { - warning ("\ -Can't pass arguments to remote MIPS board; arguments ignored."); - /* And don't try to use them on the next "run" command. */ - execute_command ("set args", 0); - } - - if (execfile == 0 || exec_bfd == 0) - error ("No executable file specified"); - - entry_pt = (CORE_ADDR) bfd_get_start_address (exec_bfd); - - init_wait_for_inferior (); - - /* FIXME: Should we set inferior_pid here? */ - - proceed (entry_pt, TARGET_SIGNAL_DEFAULT, 0); -} - -/* Clean up after a process. Actually nothing to do. */ - -static void -mips_mourn_inferior () -{ - if (current_ops != NULL) - unpush_target (current_ops); - generic_mourn_inferior (); -} - -/* We can write a breakpoint and read the shadow contents in one - operation. */ - -/* The IDT board uses an unusual breakpoint value, and sometimes gets - confused when it sees the usual MIPS breakpoint instruction. */ - -#define BREAK_INSN (0x00000a0d) -#define BREAK_INSN_SIZE (4) - -/* Insert a breakpoint on targets that don't have any better breakpoint - support. We read the contents of the target location and stash it, - then overwrite it with a breakpoint instruction. ADDR is the target - location in the target machine. CONTENTS_CACHE is a pointer to - memory allocated for saving the target contents. It is guaranteed - by the caller to be long enough to save sizeof BREAKPOINT bytes (this - is accomplished via BREAKPOINT_MAX). */ - -static int -mips_insert_breakpoint (addr, contents_cache) - CORE_ADDR addr; - char *contents_cache; -{ - int status; - - if (monitor_supports_breakpoints) - return common_breakpoint ('B', addr, 0x3, "f"); - - return mips_store_word (addr, BREAK_INSN, contents_cache); -} - -static int -mips_remove_breakpoint (addr, contents_cache) - CORE_ADDR addr; - char *contents_cache; -{ - if (monitor_supports_breakpoints) - return common_breakpoint ('b', addr, 0, NULL); - - return target_write_memory (addr, contents_cache, BREAK_INSN_SIZE); -} - -#if 0 /* currently not used */ -/* PMON does not currently provide support for the debug mode 'b' - commands to manipulate breakpoints. However, if we wanted to use - the monitor breakpoints (rather than the GDB BREAK_INSN version) - then this code performs the work needed to leave debug mode, - set/clear the breakpoint, and then return to debug mode. */ - -#define PMON_MAX_BP (33) /* 32 SW, 1 HW */ -static CORE_ADDR mips_pmon_bp_info[PMON_MAX_BP]; -/* NOTE: The code relies on this vector being zero-initialised by the system */ - -static int -pmon_insert_breakpoint (addr, contents_cache) - CORE_ADDR addr; - char *contents_cache; -{ - int status; - - if (monitor_supports_breakpoints) - { - char tbuff[12]; /* space for breakpoint command */ - int bpnum; - CORE_ADDR bpaddr; - - /* PMON does not support debug level breakpoint set/remove: */ - if (mips_exit_debug ()) - mips_error ("Failed to exit debug mode"); - - sprintf (tbuff, "b %08x\015", addr); - mips_send_command (tbuff, 0); - - mips_expect ("Bpt "); - - if (!mips_getstring (tbuff, 2)) - return 1; - tbuff[2] = '\0'; /* terminate the string */ - if (sscanf (tbuff, "%d", &bpnum) != 1) - { - fprintf_unfiltered (stderr, "Invalid decimal breakpoint number from target: %s\n", tbuff); - return 1; - } - - mips_expect (" = "); - - /* Lead in the hex number we are expecting: */ - tbuff[0] = '0'; - tbuff[1] = 'x'; - - if (!mips_getstring (&tbuff[2], 8)) - return 1; - tbuff[10] = '\0'; /* terminate the string */ - - if (sscanf (tbuff, "0x%08x", &bpaddr) != 1) - { - fprintf_unfiltered (stderr, "Invalid hex address from target: %s\n", tbuff); - return 1; - } - - if (bpnum >= PMON_MAX_BP) - { - fprintf_unfiltered (stderr, "Error: Returned breakpoint number %d outside acceptable range (0..%d)\n", - bpnum, PMON_MAX_BP - 1); - return 1; - } - - if (bpaddr != addr) - fprintf_unfiltered (stderr, "Warning: Breakpoint addresses do not match: 0x%x != 0x%x\n", addr, bpaddr); - - mips_pmon_bp_info[bpnum] = bpaddr; - - mips_expect ("\015\012"); - mips_expect (mips_monitor_prompt); - - mips_enter_debug (); - - return 0; - } - - return mips_store_word (addr, BREAK_INSN, contents_cache); -} - -static int -pmon_remove_breakpoint (addr, contents_cache) - CORE_ADDR addr; - char *contents_cache; -{ - if (monitor_supports_breakpoints) - { - int bpnum; - char tbuff[7]; /* enough for delete breakpoint command */ - - for (bpnum = 0; bpnum < PMON_MAX_BP; bpnum++) - if (mips_pmon_bp_info[bpnum] == addr) - break; - - if (bpnum >= PMON_MAX_BP) - { - fprintf_unfiltered (stderr, "pmon_remove_breakpoint: Failed to find breakpoint at address 0x%x\n", addr); - return 1; - } - - if (mips_exit_debug ()) - mips_error ("Failed to exit debug mode"); - - sprintf (tbuff, "db %02d\015", bpnum); - - mips_send_command (tbuff, -1); - /* NOTE: If the breakpoint does not exist then a "Bpt
not - set" message will be returned. */ - - mips_enter_debug (); - - return 0; - } - - return target_write_memory (addr, contents_cache, BREAK_INSN_SIZE); -} -#endif - -/* Compute a don't care mask for the region bounding ADDR and ADDR + LEN - 1. - This is used for memory ref breakpoints. */ - -static unsigned long -calculate_mask (addr, len) - CORE_ADDR addr; - int len; -{ - unsigned long mask; - int i; - - mask = addr ^ (addr + len - 1); - - for (i = 32; i >= 0; i--) - if (mask == 0) - break; - else - mask >>= 1; - - mask = (unsigned long) 0xffffffff >> i; - - return mask; -} - -/* Set a data watchpoint. ADDR and LEN should be obvious. TYPE is either 1 - for a read watchpoint, or 2 for a read/write watchpoint. */ - -int -remote_mips_set_watchpoint (addr, len, type) - CORE_ADDR addr; - int len; - int type; -{ - CORE_ADDR first_addr; - unsigned long mask; - char *flags; - - mask = calculate_mask (addr, len); - - first_addr = addr & ~mask; - - switch (type) - { - case 0: /* write */ - flags = "w"; - break; - case 1: /* read */ - flags = "r"; - break; - case 2: /* read/write */ - flags = "rw"; - break; - default: - abort (); - } - - if (common_breakpoint ('B', first_addr, mask, flags)) - return -1; - - return 0; -} - -int -remote_mips_remove_watchpoint (addr, len, type) - CORE_ADDR addr; - int len; - int type; -{ - CORE_ADDR first_addr; - unsigned long mask; - - mask = calculate_mask (addr, len); - - first_addr = addr & ~mask; - - if (common_breakpoint ('b', first_addr, 0, NULL)) - return -1; - - return 0; -} - -int -remote_mips_stopped_by_watchpoint () -{ - return hit_watchpoint; -} - -/* This routine generates the a breakpoint command of the form: - - 0x0 - - Where is one of: `B' to set, or `b' to clear a breakpoint. is - the address of the breakpoint. is a don't care mask for addresses. - is any combination of `r', `w', or `f' for read/write/or fetch. */ - -static int -common_breakpoint (cmd, addr, mask, flags) - int cmd; - CORE_ADDR addr; - CORE_ADDR mask; - char *flags; -{ - int len; - char buf[DATA_MAXLEN + 1]; - char rcmd; - int rpid, rerrflg, rresponse; - int nfields; - - if (flags) - sprintf (buf, "0x0 %c 0x%x 0x%x %s", cmd, addr, mask, flags); - else - sprintf (buf, "0x0 %c 0x%x", cmd, addr); - - mips_send_packet (buf, 1); - - len = mips_receive_packet (buf, 1, mips_receive_wait); - buf[len] = '\0'; - - nfields = sscanf (buf, "0x%x %c 0x%x 0x%x", &rpid, &rcmd, &rerrflg, &rresponse); - - if (nfields != 4 - || rcmd != cmd) - mips_error ("common_breakpoint: Bad response from remote board: %s", buf); - - if (rerrflg != 0) - { - if (rresponse != EINVAL) - fprintf_unfiltered (stderr, "common_breakpoint (0x%x): Got error: 0x%x\n", - addr, rresponse); - return 1; - } - - return 0; -} - -static void -send_srec (srec, len, addr) - char *srec; - int len; - CORE_ADDR addr; -{ - while (1) - { - int ch; - - SERIAL_WRITE (mips_desc, srec, len); - - ch = mips_readchar (2); - - switch (ch) - { - case SERIAL_TIMEOUT: - error ("Timeout during download."); - break; - case 0x6: /* ACK */ - return; - case 0x15: /* NACK */ - fprintf_unfiltered (gdb_stderr, "Download got a NACK at byte %d! Retrying.\n", addr); - continue; - default: - error ("Download got unexpected ack char: 0x%x, retrying.\n", ch); - } - } -} - -/* Download a binary file by converting it to S records. */ - -static void -mips_load_srec (args) - char *args; -{ - bfd *abfd; - asection *s; - char *buffer, srec[1024]; - int i; - int srec_frame = 200; - int reclen; - static int hashmark = 1; - - buffer = alloca (srec_frame * 2 + 256); - - abfd = bfd_openr (args, 0); - if (!abfd) - { - printf_filtered ("Unable to open file %s\n", args); - return; - } - - if (bfd_check_format (abfd, bfd_object) == 0) - { - printf_filtered ("File is not an object file\n"); - return; - } - -/* This actually causes a download in the IDT binary format: */ -#define LOAD_CMD "load -b -s tty0\015" - mips_send_command (LOAD_CMD, 0); - - for (s = abfd->sections; s; s = s->next) - { - if (s->flags & SEC_LOAD) - { - int numbytes; - - printf_filtered ("%s\t: 0x%4x .. 0x%4x ", s->name, s->vma, - s->vma + s->_raw_size); - gdb_flush (gdb_stdout); - - for (i = 0; i < s->_raw_size; i += numbytes) - { - numbytes = min (srec_frame, s->_raw_size - i); - - bfd_get_section_contents (abfd, s, buffer, i, numbytes); - - reclen = mips_make_srec (srec, '3', s->vma + i, buffer, numbytes); - send_srec (srec, reclen, s->vma + i); - - if (hashmark) - { - putchar_unfiltered ('#'); - gdb_flush (gdb_stdout); - } - - } /* Per-packet (or S-record) loop */ - - putchar_unfiltered ('\n'); - } /* Loadable sections */ - } - if (hashmark) - putchar_unfiltered ('\n'); - - /* Write a type 7 terminator record. no data for a type 7, and there - is no data, so len is 0. */ - - reclen = mips_make_srec (srec, '7', abfd->start_address, NULL, 0); - - send_srec (srec, reclen, abfd->start_address); - - SERIAL_FLUSH_INPUT (mips_desc); -} - -/* - * mips_make_srec -- make an srecord. This writes each line, one at a - * time, each with it's own header and trailer line. - * An srecord looks like this: - * - * byte count-+ address - * start ---+ | | data +- checksum - * | | | | - * S01000006F6B692D746573742E73726563E4 - * S315000448600000000000000000FC00005900000000E9 - * S31A0004000023C1400037DE00F023604000377B009020825000348D - * S30B0004485A0000000000004E - * S70500040000F6 - * - * S
- * - * Where - * - length - * is the number of bytes following upto the checksum. Note that - * this is not the number of chars following, since it takes two - * chars to represent a byte. - * - type - * is one of: - * 0) header record - * 1) two byte address data record - * 2) three byte address data record - * 3) four byte address data record - * 7) four byte address termination record - * 8) three byte address termination record - * 9) two byte address termination record - * - * - address - * is the start address of the data following, or in the case of - * a termination record, the start address of the image - * - data - * is the data. - * - checksum - * is the sum of all the raw byte data in the record, from the length - * upwards, modulo 256 and subtracted from 255. - * - * This routine returns the length of the S-record. - * - */ - -static int -mips_make_srec (buf, type, memaddr, myaddr, len) - char *buf; - int type; - CORE_ADDR memaddr; - unsigned char *myaddr; - int len; -{ - unsigned char checksum; - int i; - - /* Create the header for the srec. addr_size is the number of bytes in the address, - and 1 is the number of bytes in the count. */ - - buf[0] = 'S'; - buf[1] = type; - buf[2] = len + 4 + 1; /* len + 4 byte address + 1 byte checksum */ - /* This assumes S3 style downloads (4byte addresses). There should - probably be a check, or the code changed to make it more - explicit. */ - buf[3] = memaddr >> 24; - buf[4] = memaddr >> 16; - buf[5] = memaddr >> 8; - buf[6] = memaddr; - memcpy (&buf[7], myaddr, len); - - /* Note that the checksum is calculated on the raw data, not the - hexified data. It includes the length, address and the data - portions of the packet. */ - checksum = 0; - buf += 2; /* Point at length byte */ - for (i = 0; i < len + 4 + 1; i++) - checksum += *buf++; - - *buf = ~checksum; - - return len + 8; -} - -/* The following manifest controls whether we enable the simple flow - control support provided by the monitor. If enabled the code will - wait for an affirmative ACK between transmitting packets. */ -#define DOETXACK (1) - -/* The PMON fast-download uses an encoded packet format constructed of - 3byte data packets (encoded as 4 printable ASCII characters), and - escape sequences (preceded by a '/'): - - 'K' clear checksum - 'C' compare checksum (12bit value, not included in checksum calculation) - 'S' define symbol name (for addr) terminated with "," and padded to 4char boundary - 'Z' zero fill multiple of 3bytes - 'B' byte (12bit encoded value, of 8bit data) - 'A' address (36bit encoded value) - 'E' define entry as original address, and exit load - - The packets are processed in 4 character chunks, so the escape - sequences that do not have any data (or variable length data) - should be padded to a 4 character boundary. The decoder will give - an error if the complete message block size is not a multiple of - 4bytes (size of record). - - The encoding of numbers is done in 6bit fields. The 6bit value is - used to index into this string to get the specific character - encoding for the value: */ -static char encoding[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789,."; - -/* Convert the number of bits required into an encoded number, 6bits - at a time (range 0..63). Keep a checksum if required (passed - pointer non-NULL). The function returns the number of encoded - characters written into the buffer. */ -static int -pmon_makeb64 (v, p, n, chksum) - unsigned long v; - char *p; - int n; - int *chksum; -{ - int count = (n / 6); - - if ((n % 12) != 0) { - fprintf_unfiltered(stderr,"Fast encoding bitcount must be a multiple of 12bits: %dbit%s\n",n,(n == 1)?"":"s"); - return(0); - } - if (n > 36) { - fprintf_unfiltered(stderr,"Fast encoding cannot process more than 36bits at the moment: %dbits\n",n); - return(0); - } - - /* Deal with the checksum: */ - if (chksum != NULL) { - switch (n) { - case 36: *chksum += ((v >> 24) & 0xFFF); - case 24: *chksum += ((v >> 12) & 0xFFF); - case 12: *chksum += ((v >> 0) & 0xFFF); - } - } - - do { - n -= 6; - *p++ = encoding[(v >> n) & 0x3F]; - } while (n > 0); - - return(count); -} - -/* Shorthand function (that could be in-lined) to output the zero-fill - escape sequence into the data stream. */ -static int -pmon_zeroset (recsize, buff, amount, chksum) - int recsize; - char **buff; - int *amount; - unsigned int *chksum; -{ - int count; - - sprintf(*buff,"/Z"); - count = pmon_makeb64 (*amount, (*buff + 2), 12, chksum); - *buff += (count + 2); - *amount = 0; - return(recsize + count + 2); -} - -static int -pmon_checkset (recsize, buff, value) - int recsize; - char **buff; - int *value; -{ - int count; - - /* Add the checksum (without updating the value): */ - sprintf (*buff, "/C"); - count = pmon_makeb64 (*value, (*buff + 2), 12, NULL); - *buff += (count + 2); - sprintf (*buff, "\015"); - *buff += 2; /* include zero terminator */ - /* Forcing a checksum validation clears the sum: */ - *value = 0; - return(recsize + count + 3); -} - -/* Amount of padding we leave after at the end of the output buffer, - for the checksum and line termination characters: */ -#define CHECKSIZE (4 + 4 + 4 + 2) -/* zero-fill, checksum, transfer end and line termination space. */ - -/* The amount of binary data loaded from the object file in a single - operation: */ -#define BINCHUNK (1024) - -/* Maximum line of data accepted by the monitor: */ -#define MAXRECSIZE (550) -/* NOTE: This constant depends on the monitor being used. This value - is for PMON 5.x on the Cogent Vr4300 board. */ - -static void -pmon_make_fastrec (outbuf, inbuf, inptr, inamount, recsize, csum, zerofill) - char **outbuf; - unsigned char *inbuf; - int *inptr; - int inamount; - int *recsize; - unsigned int *csum; - unsigned int *zerofill; -{ - int count = 0; - char *p = *outbuf; - - /* This is a simple check to ensure that our data will fit within - the maximum allowable record size. Each record output is 4bytes - in length. We must allow space for a pending zero fill command, - the record, and a checksum record. */ - while ((*recsize < (MAXRECSIZE - CHECKSIZE)) && ((inamount - *inptr) > 0)) { - /* Process the binary data: */ - if ((inamount - *inptr) < 3) { - if (*zerofill != 0) - *recsize = pmon_zeroset (*recsize, &p, zerofill, csum); - sprintf (p, "/B"); - count = pmon_makeb64 (inbuf[*inptr], &p[2], 12, csum); - p += (2 + count); - *recsize += (2 + count); - (*inptr)++; - } else { - unsigned int value = ((inbuf[*inptr + 0] << 16) | (inbuf[*inptr + 1] << 8) | inbuf[*inptr + 2]); - /* Simple check for zero data. TODO: A better check would be - to check the last, and then the middle byte for being zero - (if the first byte is not). We could then check for - following runs of zeros, and if above a certain size it is - worth the 4 or 8 character hit of the byte insertions used - to pad to the start of the zeroes. NOTE: This also depends - on the alignment at the end of the zero run. */ - if (value == 0x00000000) { - (*zerofill)++; - if (*zerofill == 0xFFF) /* 12bit counter */ - *recsize = pmon_zeroset (*recsize, &p, zerofill, csum); - }else { - if (*zerofill != 0) - *recsize = pmon_zeroset (*recsize, &p, zerofill, csum); - count = pmon_makeb64 (value, p, 24, csum); - p += count; - *recsize += count; - } - *inptr += 3; - } - } - - *outbuf = p; - return; -} - -#if defined(DOETXACK) -static int -pmon_check_ack() -{ - int c = SERIAL_READCHAR (mips_desc, 2); - if ((c == SERIAL_TIMEOUT) || (c != 0x06)) { - fprintf_unfiltered (gdb_stderr, "Failed to receive valid ACK\n"); - return(-1); /* terminate the download */ - } - return(0); -} -#endif /* DOETXACK */ - -static void -pmon_load_fast (file) - char *file; -{ - bfd *abfd; - asection *s; - unsigned char *binbuf; - char *buffer; - int reclen; - unsigned int csum = 0; - static int hashmark = 1; - int bintotal = 0; - int final; - int finished = 0; - - buffer = (char *)xmalloc(MAXRECSIZE + 1); - binbuf = (unsigned char *)xmalloc(BINCHUNK); - - abfd = bfd_openr(file,0); - if (!abfd) - { - printf_filtered ("Unable to open file %s\n",file); - return; - } - - if (bfd_check_format(abfd,bfd_object) == 0) - { - printf_filtered("File is not an object file\n"); - return; - } - - /* Setup the required download state: */ - mips_send_command ("set dlproto etxack\015", -1); - mips_send_command ("set dlecho off\015", -1); - /* NOTE: We get a "cannot set variable" message if the variable is - already defined to have the argument we give. The code doesn't - care, since it just scans to the next prompt anyway. */ - /* Start the download: */ - mips_send_command (LOAD_CMD, 0); - mips_expect ("Downloading from tty0, ^C to abort\015\012"); - - /* Zero the checksum */ - sprintf(buffer,"/Kxx\015"); - reclen = strlen(buffer); - SERIAL_WRITE (mips_desc, buffer, reclen); - -#if defined(DOETXACK) - finished = pmon_check_ack(); -#endif /* DOETXACK */ - - for (s = abfd->sections; s && !finished; s = s->next) - if (s->flags & SEC_LOAD) /* only deal with loadable sections */ - { - bintotal += s->_raw_size; - final = (s->vma + s->_raw_size); - - printf_filtered ("%s\t: 0x%4x .. 0x%4x ", s->name, s->vma, - s->vma + s->_raw_size); - gdb_flush (gdb_stdout); - - /* Output the starting address */ - sprintf(buffer,"/A"); - reclen = pmon_makeb64(s->vma,&buffer[2],36,&csum); - buffer[2 + reclen] = '\015'; - buffer[3 + reclen] = '\0'; - reclen += 3; /* for the initial escape code and carriage return */ - SERIAL_WRITE (mips_desc, buffer, reclen); -#if defined(DOETXACK) - finished = pmon_check_ack(); -#endif /* DOETXACK */ - - if (!finished) - { - int binamount; - unsigned int zerofill = 0; - char *bp = buffer; - int i; - - reclen = 0; - - for (i = 0; ((i < s->_raw_size) && !finished); i += binamount) { - int binptr = 0; - - binamount = min (BINCHUNK, s->_raw_size - i); - - bfd_get_section_contents (abfd, s, binbuf, i, binamount); - - /* This keeps a rolling checksum, until we decide to output - the line: */ - for (; ((binamount - binptr) > 0);) { - pmon_make_fastrec (&bp, binbuf, &binptr, binamount, &reclen, &csum, &zerofill); - if (reclen >= (MAXRECSIZE - CHECKSIZE)) { - reclen = pmon_checkset (reclen, &bp, &csum); - SERIAL_WRITE (mips_desc, buffer, reclen); -#if defined(DOETXACK) - finished = pmon_check_ack(); - if (finished) { - zerofill = 0; /* do not transmit pending zerofills */ - break; - } -#endif /* DOETXACK */ - - if (hashmark) { - putchar_unfiltered ('#'); - gdb_flush (gdb_stdout); - } - - bp = buffer; - reclen = 0; /* buffer processed */ - } - } - } - - /* Ensure no out-standing zerofill requests: */ - if (zerofill != 0) - reclen = pmon_zeroset (reclen, &bp, &zerofill, &csum); - - /* and then flush the line: */ - if (reclen > 0) { - reclen = pmon_checkset (reclen, &bp, &csum); - /* Currently pmon_checkset outputs the line terminator by - default, so we write out the buffer so far: */ - SERIAL_WRITE (mips_desc, buffer, reclen); -#if defined(DOETXACK) - finished = pmon_check_ack(); -#endif /* DOETXACK */ - } - } - - if (hashmark) - putchar_unfiltered ('\n'); - } - - /* Terminate the transfer. We know that we have an empty output - buffer at this point. */ - sprintf (buffer, "/E/E\015"); /* include dummy padding characters */ - reclen = strlen (buffer); - SERIAL_WRITE (mips_desc, buffer, reclen); - - if (finished) { /* Ignore the termination message: */ - SERIAL_FLUSH_INPUT (mips_desc); - } else { /* Deal with termination message: */ - char hexnumber[9]; /* includes '\0' space */ - mips_expect ("Entry Address = "); - sprintf(hexnumber,"%x",final); - mips_expect (hexnumber); -#if defined(DOETXACK) - mips_expect ("\015\012\006\015\012total = 0x"); -#else /* normal termination */ - mips_expect ("\015\012\015\012total = 0x"); -#endif /* !DOETXACK */ - sprintf(hexnumber,"%x",bintotal); - mips_expect (hexnumber); - mips_expect (" bytes\015\012"); - } - - return; -} - -/* mips_load -- download a file. */ - -static void -mips_load (file, from_tty) - char *file; - int from_tty; -{ - /* Get the board out of remote debugging mode. */ - if (mips_exit_debug ()) - error ("mips_load: Couldn't get into monitor mode."); - - if (mips_monitor == MON_PMON) - pmon_load_fast (file); - else - mips_load_srec (file); - - mips_initialize (); - -/* Finally, make the PC point at the start address */ - - if (exec_bfd) - write_pc (bfd_get_start_address (exec_bfd)); - - inferior_pid = 0; /* No process now */ - -/* This is necessary because many things were based on the PC at the time that - we attached to the monitor, which is no longer valid now that we have loaded - new code (and just changed the PC). Another way to do this might be to call - normal_stop, except that the stack may not be valid, and things would get - horribly confused... */ - - clear_symtab_users (); -} - -/* The target vector. */ - -struct target_ops mips_ops = -{ - "mips", /* to_shortname */ - "Remote MIPS debugging over serial line", /* to_longname */ - "\ -Debug a board using the MIPS remote debugging protocol over a serial line.\n\ -The argument is the device it is connected to or, if it contains a colon,\n\ -HOST:PORT to access a board over a network", /* to_doc */ - mips_open, /* to_open */ - mips_close, /* to_close */ - NULL, /* to_attach */ - mips_detach, /* to_detach */ - mips_resume, /* to_resume */ - mips_wait, /* to_wait */ - mips_fetch_registers, /* to_fetch_registers */ - mips_store_registers, /* to_store_registers */ - mips_prepare_to_store, /* to_prepare_to_store */ - mips_xfer_memory, /* to_xfer_memory */ - mips_files_info, /* to_files_info */ - mips_insert_breakpoint, /* to_insert_breakpoint */ - mips_remove_breakpoint, /* to_remove_breakpoint */ - NULL, /* to_terminal_init */ - NULL, /* to_terminal_inferior */ - NULL, /* to_terminal_ours_for_output */ - NULL, /* to_terminal_ours */ - NULL, /* to_terminal_info */ - mips_kill, /* to_kill */ - mips_load, /* to_load */ - NULL, /* to_lookup_symbol */ - mips_create_inferior, /* to_create_inferior */ - mips_mourn_inferior, /* to_mourn_inferior */ - NULL, /* to_can_run */ - NULL, /* to_notice_signals */ - 0, /* to_thread_alive */ - 0, /* to_stop */ - process_stratum, /* to_stratum */ - NULL, /* to_next */ - 1, /* to_has_all_memory */ - 1, /* to_has_memory */ - 1, /* to_has_stack */ - 1, /* to_has_registers */ - 1, /* to_has_execution */ - NULL, /* sections */ - NULL, /* sections_end */ - OPS_MAGIC /* to_magic */ -}; - -/* An alternative target vector: */ -struct target_ops pmon_ops = -{ - "pmon", /* to_shortname */ - "Remote MIPS debugging over serial line", /* to_longname */ - "\ -Debug a board using the PMON MIPS remote debugging protocol over a serial\n\ -line. The argument is the device it is connected to or, if it contains a\n\ -colon, HOST:PORT to access a board over a network", /* to_doc */ - pmon_open, /* to_open */ - mips_close, /* to_close */ - NULL, /* to_attach */ - mips_detach, /* to_detach */ - mips_resume, /* to_resume */ - pmon_wait, /* to_wait */ - mips_fetch_registers, /* to_fetch_registers */ - mips_store_registers, /* to_store_registers */ - mips_prepare_to_store, /* to_prepare_to_store */ - mips_xfer_memory, /* to_xfer_memory */ - mips_files_info, /* to_files_info */ - mips_insert_breakpoint, /* to_insert_breakpoint */ - mips_remove_breakpoint, /* to_remove_breakpoint */ - NULL, /* to_terminal_init */ - NULL, /* to_terminal_inferior */ - NULL, /* to_terminal_ours_for_output */ - NULL, /* to_terminal_ours */ - NULL, /* to_terminal_info */ - mips_kill, /* to_kill */ - mips_load, /* to_load */ - NULL, /* to_lookup_symbol */ - mips_create_inferior, /* to_create_inferior */ - mips_mourn_inferior, /* to_mourn_inferior */ - NULL, /* to_can_run */ - NULL, /* to_notice_signals */ - 0, /* to_thread_alive */ - 0, /* to_stop */ - process_stratum, /* to_stratum */ - NULL, /* to_next */ - 1, /* to_has_all_memory */ - 1, /* to_has_memory */ - 1, /* to_has_stack */ - 1, /* to_has_registers */ - 1, /* to_has_execution */ - NULL, /* sections */ - NULL, /* sections_end */ - OPS_MAGIC /* to_magic */ -}; - -void -_initialize_remote_mips () -{ - add_target (&mips_ops); - add_target (&pmon_ops); - - add_show_from_set ( - add_set_cmd ("timeout", no_class, var_zinteger, - (char *) &mips_receive_wait, - "Set timeout in seconds for remote MIPS serial I/O.", - &setlist), - &showlist); - - add_show_from_set ( - add_set_cmd ("retransmit-timeout", no_class, var_zinteger, - (char *) &mips_retransmit_wait, - "Set retransmit timeout in seconds for remote MIPS serial I/O.\n\ -This is the number of seconds to wait for an acknowledgement to a packet\n\ -before resending the packet.", &setlist), - &showlist); - - add_show_from_set ( - add_set_cmd ("syn-garbage-limit", no_class, var_zinteger, - (char *) &mips_syn_garbage, -"Set the maximum number of characters to ignore when scanning for a SYN.\n\ -This is the maximum number of characters GDB will ignore when trying to\n\ -synchronize with the remote system. A value of -1 means that there is no limit\n\ -(Note that these characters are printed out even though they are ignored.)", - &setlist), - &showlist); -} diff --git a/contrib/gdb/gdb/remote-mm.c b/contrib/gdb/gdb/remote-mm.c deleted file mode 100644 index 101d964..0000000 --- a/contrib/gdb/gdb/remote-mm.c +++ /dev/null @@ -1,1627 +0,0 @@ -/* Remote debugging interface for Am290*0 running MiniMON monitor, for GDB. - Copyright 1990, 1991, 1992 Free Software Foundation, Inc. - Originally written by Daniel Mann at AMD. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* This is like remote.c but ecpects MiniMON to be running on the Am29000 - target hardware. - - David Wood (wood@lab.ultra.nyu.edu) at New York University adapted this - file to gdb 3.95. I was unable to get this working on sun3os4 - with termio, only with sgtty. Because we are only attempting to - use this module to debug our kernel, which is already loaded when - gdb is started up, I did not code up the file downloading facilities. - As a result this module has only the stubs to download files. - You should get tagged at compile time if you need to make any - changes/additions. */ - -#include "defs.h" -#include "inferior.h" -#include "wait.h" -#include "value.h" -#include -#include -#include -#include -#include "gdb_string.h" -#include "terminal.h" -#include "minimon.h" -#include "target.h" - -/* Offset of member MEMBER in a struct of type TYPE. */ -#define offsetof(TYPE, MEMBER) ((int) &((TYPE *)0)->MEMBER) - -#define DRAIN_INPUT() (msg_recv_serial((union msg_t*)0)) - -extern int stop_soon_quietly; /* for wait_for_inferior */ - -static void mm_resume(); -static void mm_fetch_registers (); -static int fetch_register (); -static void mm_store_registers (); -static int store_register (); -static int regnum_to_srnum(); -static void mm_close (); -static char* msg_str(); -static char* error_msg_str(); -static int expect_msg(); -static void init_target_mm(); -static int mm_memory_space(); - -#define FREEZE_MODE (read_register(CPS_REGNUM) && 0x400) -#define USE_SHADOW_PC ((processor_type == a29k_freeze_mode) && FREEZE_MODE) - -/* FIXME: Replace with `set remotedebug'. */ -#define LLOG_FILE "minimon.log" -#if defined (LOG_FILE) -FILE *log_file; -#endif - -/* - * Size of message buffers. I couldn't get memory reads to work when - * the byte_count was larger than 512 (it may be a baud rate problem). - */ -#define BUFER_SIZE 512 -/* - * Size of data area in message buffer on the TARGET (remote system). - */ -#define MAXDATA_T (target_config.max_msg_size - \ - offsetof(struct write_r_msg_t,data[0])) -/* - * Size of data area in message buffer on the HOST (gdb). - */ -#define MAXDATA_H (BUFER_SIZE - offsetof(struct write_r_msg_t,data[0])) -/* - * Defined as the minimum size of data areas of the two message buffers - */ -#define MAXDATA (MAXDATA_H < MAXDATA_T ? MAXDATA_H : MAXDATA_T) - -static char out_buf[BUFER_SIZE]; -static char in_buf[BUFER_SIZE]; - -int msg_recv_serial(); -int msg_send_serial(); - -#define MAX_RETRIES 5000 -extern struct target_ops mm_ops; /* Forward declaration */ -struct config_msg_t target_config; /* HIF needs this */ -union msg_t *out_msg_buf = (union msg_t*)out_buf; -union msg_t *in_msg_buf = (union msg_t*)in_buf; - -static int timeout = 5; - -/* Descriptor for I/O to remote machine. Initialize it to -1 so that - mm_open knows that we don't have a file open when the program - starts. */ -int mm_desc = -1; - -/* stream which is fdopen'd from mm_desc. Only valid when - mm_desc != -1. */ -FILE *mm_stream; - -/* Called when SIGALRM signal sent due to alarm() timeout. */ -#ifndef HAVE_TERMIO - -#ifndef __STDC__ -# ifndef volatile -# define volatile /**/ -# endif -#endif -volatile int n_alarms; - -static void -mm_timer () -{ -#if 0 - if (kiodebug) - printf ("mm_timer called\n"); -#endif - n_alarms++; -} -#endif /* HAVE_TERMIO */ - -/* malloc'd name of the program on the remote system. */ -static char *prog_name = NULL; - - -/* Number of SIGTRAPs we need to simulate. That is, the next - NEED_ARTIFICIAL_TRAP calls to mm_wait should just return - SIGTRAP without actually waiting for anything. */ - -/**************************************************** REMOTE_CREATE_INFERIOR */ -/* This is called not only when we first attach, but also when the - user types "run" after having attached. */ -static void -mm_create_inferior (execfile, args, env) - char *execfile; - char *args; - char **env; -{ -#define MAX_TOKENS 25 -#define BUFFER_SIZE 256 - int token_count; - int result; - char *token[MAX_TOKENS]; - char cmd_line[BUFFER_SIZE]; - - if (args && *args) - error ("Can't pass arguments to remote mm process (yet)."); - - if (execfile == 0 /* || exec_bfd == 0 */ ) - error ("No exec file specified"); - - if (!mm_stream) { - printf("Minimon not open yet.\n"); - return; - } - - /* On ultra3 (NYU) we assume the kernel is already running so there is - no file to download. - FIXME: Fixed required here -> load your program, possibly with mm_load(). - */ - printf_filtered ("\n\ -Assuming you are at NYU debuging a kernel, i.e., no need to download.\n\n"); - - /* We will get a task spawn event immediately. */ - init_wait_for_inferior (); - clear_proceed_status (); - stop_soon_quietly = 1; - proceed (-1, TARGET_SIGNAL_DEFAULT, 0); - normal_stop (); -} -/**************************************************** REMOTE_MOURN_INFERIOR */ -static void -mm_mourn() -{ - pop_target (); /* Pop back to no-child state */ - generic_mourn_inferior (); -} - -/********************************************************************** damn_b -*/ -/* Translate baud rates from integers to damn B_codes. Unix should - have outgrown this crap years ago, but even POSIX wouldn't buck it. */ - -#ifndef B19200 -#define B19200 EXTA -#endif -#ifndef B38400 -#define B38400 EXTB -#endif - -static struct {int rate, damn_b;} baudtab[] = { - {0, B0}, - {50, B50}, - {75, B75}, - {110, B110}, - {134, B134}, - {150, B150}, - {200, B200}, - {300, B300}, - {600, B600}, - {1200, B1200}, - {1800, B1800}, - {2400, B2400}, - {4800, B4800}, - {9600, B9600}, - {19200, B19200}, - {38400, B38400}, - {-1, -1}, -}; - -static int damn_b (rate) - int rate; -{ - int i; - - for (i = 0; baudtab[i].rate != -1; i++) - if (rate == baudtab[i].rate) return baudtab[i].damn_b; - return B38400; /* Random */ -} - - -/***************************************************************** REMOTE_OPEN -** Open a connection to remote minimon. - NAME is the filename used for communication, then a space, - then the baud rate. - 'target adapt /dev/ttya 9600 [prognam]' for example. - */ - -static char *dev_name; -int baudrate = 9600; -static void -mm_open (name, from_tty) - char *name; - int from_tty; -{ - TERMINAL sg; - unsigned int prl; - char *p; - - /* Find the first whitespace character, it separates dev_name from - prog_name. */ - for (p = name; - p && *p && !isspace (*p); p++) - ; - if (p == 0 || *p == '\0') -erroid: - error ("Usage : [progname]"); - dev_name = (char*)xmalloc (p - name + 1); - strncpy (dev_name, name, p - name); - dev_name[p - name] = '\0'; - - /* Skip over the whitespace after dev_name */ - for (; isspace (*p); p++) - /*EMPTY*/; - - if (1 != sscanf (p, "%d ", &baudrate)) - goto erroid; - - /* Skip the number and then the spaces */ - for (; isdigit (*p); p++) - /*EMPTY*/; - for (; isspace (*p); p++) - /*EMPTY*/; - - if (prog_name != NULL) - free (prog_name); - prog_name = savestring (p, strlen (p)); - - - if (mm_desc >= 0) - close (mm_desc); - - mm_desc = open (dev_name, O_RDWR); - if (mm_desc < 0) - perror_with_name (dev_name); - ioctl (mm_desc, TIOCGETP, &sg); -#ifdef HAVE_TERMIO - sg.c_cc[VMIN] = 0; /* read with timeout. */ - sg.c_cc[VTIME] = timeout * 10; - sg.c_lflag &= ~(ICANON | ECHO); - sg.c_cflag = (sg.c_cflag & ~CBAUD) | damn_b (baudrate); -#else - sg.sg_ispeed = damn_b (baudrate); - sg.sg_ospeed = damn_b (baudrate); - sg.sg_flags |= RAW; - sg.sg_flags |= ANYP; - sg.sg_flags &= ~ECHO; -#endif - - - ioctl (mm_desc, TIOCSETP, &sg); - mm_stream = fdopen (mm_desc, "r+"); - - push_target (&mm_ops); - -#ifndef HAVE_TERMIO -#ifndef NO_SIGINTERRUPT - /* Cause SIGALRM's to make reads fail with EINTR instead of resuming - the read. */ - if (siginterrupt (SIGALRM, 1) != 0) - perror ("mm_open: error in siginterrupt"); -#endif - - /* Set up read timeout timer. */ - if ((void (*)) signal (SIGALRM, mm_timer) == (void (*)) -1) - perror ("mm_open: error in signal"); -#endif - -#if defined (LOG_FILE) - log_file = fopen (LOG_FILE, "w"); - if (log_file == NULL) - perror_with_name (LOG_FILE); -#endif - /* - ** Initialize target configuration structure (global) - */ - DRAIN_INPUT(); - out_msg_buf->config_req_msg.code = CONFIG_REQ; - out_msg_buf->config_req_msg.length = 4*0; - msg_send_serial(out_msg_buf); /* send config request message */ - - expect_msg(CONFIG,in_msg_buf,1); - - a29k_get_processor_type (); - - /* Print out some stuff, letting the user now what's going on */ - printf_filtered("Connected to MiniMon via %s.\n", dev_name); - /* FIXME: can this restriction be removed? */ - printf_filtered("Remote debugging using virtual addresses works only\n"); - printf_filtered("\twhen virtual addresses map 1:1 to physical addresses.\n") -; - if (processor_type != a29k_freeze_mode) { - fprintf_filtered(stderr, - "Freeze-mode debugging not available, and can only be done on an A29050.\n"); - } - - target_config.code = CONFIG; - target_config.length = 0; - target_config.processor_id = in_msg_buf->config_msg.processor_id; - target_config.version = in_msg_buf->config_msg.version; - target_config.I_mem_start = in_msg_buf->config_msg.I_mem_start; - target_config.I_mem_size = in_msg_buf->config_msg.I_mem_size; - target_config.D_mem_start = in_msg_buf->config_msg.D_mem_start; - target_config.D_mem_size = in_msg_buf->config_msg.D_mem_size; - target_config.ROM_start = in_msg_buf->config_msg.ROM_start; - target_config.ROM_size = in_msg_buf->config_msg.ROM_size; - target_config.max_msg_size = in_msg_buf->config_msg.max_msg_size; - target_config.max_bkpts = in_msg_buf->config_msg.max_bkpts; - target_config.coprocessor = in_msg_buf->config_msg.coprocessor; - target_config.reserved = in_msg_buf->config_msg.reserved; - if (from_tty) { - printf("Connected to MiniMON :\n"); - printf(" Debugcore version %d.%d\n", - 0x0f & (target_config.version >> 4), - 0x0f & (target_config.version ) ); - printf(" Configuration version %d.%d\n", - 0x0f & (target_config.version >> 12), - 0x0f & (target_config.version >> 8) ); - printf(" Message system version %d.%d\n", - 0x0f & (target_config.version >> 20), - 0x0f & (target_config.version >> 16) ); - printf(" Communication driver version %d.%d\n", - 0x0f & (target_config.version >> 28), - 0x0f & (target_config.version >> 24) ); - } - - /* Leave the target running... - * The above message stopped the target in the dbg core (MiniMon), - * so restart the target out of MiniMon, - */ - out_msg_buf->go_msg.code = GO; - out_msg_buf->go_msg.length = 0; - msg_send_serial(out_msg_buf); - /* No message to expect after a GO */ -} - -/**************************************************************** REMOTE_CLOSE -** Close the open connection to the minimon debugger. - Use this when you want to detach and do something else - with your gdb. */ -static void -mm_close (quitting) /*FIXME: how is quitting used */ - int quitting; -{ - if (mm_desc < 0) - error ("Can't close remote connection: not debugging remotely."); - - /* We should never get here if there isn't something valid in - mm_desc and mm_stream. - - Due to a bug in Unix, fclose closes not only the stdio stream, - but also the file descriptor. So we don't actually close - mm_desc. */ - DRAIN_INPUT(); - fclose (mm_stream); - /* close (mm_desc); */ - - /* Do not try to close mm_desc again, later in the program. */ - mm_stream = NULL; - mm_desc = -1; - -#if defined (LOG_FILE) - if (ferror (log_file)) - printf ("Error writing log file.\n"); - if (fclose (log_file) != 0) - printf ("Error closing log file.\n"); -#endif - - printf ("Ending remote debugging\n"); -} - -/************************************************************* REMOTE_ATACH */ -/* Attach to a program that is already loaded and running - * Upon exiting the process's execution is stopped. - */ -static void -mm_attach (args, from_tty) - char *args; - int from_tty; -{ - - if (!mm_stream) - error ("MiniMon not opened yet, use the 'target minimon' command.\n"); - - if (from_tty) - printf ("Attaching to remote program %s...\n", prog_name); - - /* Make sure the target is currently running, it is supposed to be. */ - /* FIXME: is it ok to send MiniMon a BREAK if it is already stopped in - * the dbg core. If so, we don't need to send this GO. - */ - out_msg_buf->go_msg.code = GO; - out_msg_buf->go_msg.length = 0; - msg_send_serial(out_msg_buf); - sleep(2); /* At the worst it will stop, receive a message, continue */ - - /* Send the mm a break. */ - out_msg_buf->break_msg.code = BREAK; - out_msg_buf->break_msg.length = 0; - msg_send_serial(out_msg_buf); -} -/********************************************************** REMOTE_DETACH */ -/* Terminate the open connection to the remote debugger. - Use this when you want to detach and do something else - with your gdb. Leave remote process running (with no breakpoints set). */ -static void -mm_detach (args,from_tty) - char *args; - int from_tty; -{ - remove_breakpoints(); /* Just in case there were any left in */ - out_msg_buf->go_msg.code = GO; - out_msg_buf->go_msg.length = 0; - msg_send_serial(out_msg_buf); - pop_target(); /* calls mm_close to do the real work */ -} - - -/*************************************************************** REMOTE_RESUME -** Tell the remote machine to resume. */ - -static void -mm_resume (pid, step, sig) - int pid, step; - enum target_signal sig; -{ - if (sig != TARGET_SIGNAL_0) - warning ("Can't send signals to a remote MiniMon system."); - - if (step) { - out_msg_buf->step_msg.code= STEP; - out_msg_buf->step_msg.length = 1*4; - out_msg_buf->step_msg.count = 1; /* step 1 instruction */ - msg_send_serial(out_msg_buf); - } else { - out_msg_buf->go_msg.code= GO; - out_msg_buf->go_msg.length = 0; - msg_send_serial(out_msg_buf); - } -} - -/***************************************************************** REMOTE_WAIT -** Wait until the remote machine stops, then return, - storing status in STATUS just as `wait' would. */ - -static int -mm_wait (status) - struct target_waitstatus *status; -{ - int i, result; - int old_timeout = timeout; - int old_immediate_quit = immediate_quit; - - status->kind = TARGET_WAITKIND_EXITED; - status->value.integer = 0; - -/* wait for message to arrive. It should be: - - A HIF service request. - - A HIF exit service request. - - A CHANNEL0_ACK. - - A CHANNEL1 request. - - a debugcore HALT message. - HIF services must be responded too, and while-looping continued. - If the target stops executing, mm_wait() should return. -*/ - timeout = 0; /* Wait indefinetly for a message */ - immediate_quit = 1; /* Helps ability to QUIT */ - while(1) - { - while(msg_recv_serial(in_msg_buf)) { - QUIT; /* Let user quit if they want */ - } - switch (in_msg_buf->halt_msg.code) - { - case HIF_CALL: - i = in_msg_buf->hif_call_rtn_msg.service_number; - result=service_HIF(in_msg_buf); - if(i == 1) /* EXIT */ - goto exit; - if(result) - printf("Warning: failure during HIF service %d\n", i); - break; - case CHANNEL0_ACK: - service_HIF(in_msg_buf); - break; - case CHANNEL1: - i=in_msg_buf->channel1_msg.length; - in_msg_buf->channel1_msg.data[i] = '\0'; - printf("%s", in_msg_buf->channel1_msg.data); - gdb_flush(stdout); - /* Send CHANNEL1_ACK message */ - out_msg_buf->channel1_ack_msg.code = CHANNEL1_ACK; - out_msg_buf->channel1_ack_msg.length = 0; - result = msg_send_serial(out_msg_buf); - break; - case HALT: - goto halted; - default: - goto halted; - } - } -halted: - /* FIXME, these printfs should not be here. This is a source level - debugger, guys! */ - if (in_msg_buf->halt_msg.trap_number== 0) - { printf("Am290*0 received vector number %d (break point)\n", - in_msg_buf->halt_msg.trap_number); - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_TRAP; - } - else if (in_msg_buf->halt_msg.trap_number== 1) - { - printf("Am290*0 received vector number %d\n", - in_msg_buf->halt_msg.trap_number); - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_BUS; - } - else if (in_msg_buf->halt_msg.trap_number== 3 - || in_msg_buf->halt_msg.trap_number== 4) - { printf("Am290*0 received vector number %d\n", - in_msg_buf->halt_msg.trap_number); - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_FPE; - } - else if (in_msg_buf->halt_msg.trap_number== 5) - { printf("Am290*0 received vector number %d\n", - in_msg_buf->halt_msg.trap_number); - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_ILL; - } - else if (in_msg_buf->halt_msg.trap_number >= 6 - && in_msg_buf->halt_msg.trap_number <= 11) - { printf("Am290*0 received vector number %d\n", - in_msg_buf->halt_msg.trap_number); - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_SEGV; - } - else if (in_msg_buf->halt_msg.trap_number== 12 - || in_msg_buf->halt_msg.trap_number== 13) - { printf("Am290*0 received vector number %d\n", - in_msg_buf->halt_msg.trap_number); - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_ILL; - } - else if (in_msg_buf->halt_msg.trap_number== 14) - { printf("Am290*0 received vector number %d\n", - in_msg_buf->halt_msg.trap_number); - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_ALRM; - } - else if (in_msg_buf->halt_msg.trap_number== 15) - { - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_TRAP; - } - else if (in_msg_buf->halt_msg.trap_number >= 16 - && in_msg_buf->halt_msg.trap_number <= 21) - { printf("Am290*0 received vector number %d\n", - in_msg_buf->halt_msg.trap_number); - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_INT; - } - else if (in_msg_buf->halt_msg.trap_number== 22) - { printf("Am290*0 received vector number %d\n", - in_msg_buf->halt_msg.trap_number); - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_ILL; - } /* BREAK message was sent */ - else if (in_msg_buf->halt_msg.trap_number== 75) - { - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_TRAP; - } - else -exit: - { - status->kind = TARGET_WAITKIND_EXITED; - status->value.integer = 0; - } - - timeout = old_timeout; /* Restore original timeout value */ - immediate_quit = old_immediate_quit; - return 0; -} - -/******************************************************* REMOTE_FETCH_REGISTERS - * Read a remote register 'regno'. - * If regno==-1 then read all the registers. - */ -static void -mm_fetch_registers (regno) -int regno; -{ - INT32 *data_p; - - if (regno >= 0) { - fetch_register(regno); - return; - } - -/* Gr1/rsp */ - out_msg_buf->read_req_msg.byte_count = 4*1; - out_msg_buf->read_req_msg.memory_space = GLOBAL_REG; - out_msg_buf->read_req_msg.address = 1; - msg_send_serial(out_msg_buf); - expect_msg(READ_ACK,in_msg_buf,1); - data_p = &(in_msg_buf->read_r_ack_msg.data[0]); - supply_register (GR1_REGNUM , data_p); - -#if defined(GR64_REGNUM) /* Read gr64-127 */ -/* Global Registers gr64-gr95 */ - out_msg_buf->read_req_msg.code= READ_REQ; - out_msg_buf->read_req_msg.length = 4*3; - out_msg_buf->read_req_msg.byte_count = 4*32; - out_msg_buf->read_req_msg.memory_space = GLOBAL_REG; - out_msg_buf->read_req_msg.address = 64; - msg_send_serial(out_msg_buf); - expect_msg(READ_ACK,in_msg_buf,1); - data_p = &(in_msg_buf->read_r_ack_msg.data[0]); - - for (regno=GR64_REGNUM; regnoread_req_msg.code= READ_REQ; - out_msg_buf->read_req_msg.length = 4*3; - out_msg_buf->read_req_msg.byte_count = 4 * 32; - out_msg_buf->read_req_msg.memory_space = GLOBAL_REG; - out_msg_buf->read_req_msg.address = 96; - msg_send_serial(out_msg_buf); - expect_msg(READ_ACK,in_msg_buf,1); - data_p = &(in_msg_buf->read_r_ack_msg.data[0]); - - for (regno=GR96_REGNUM; regnoread_req_msg.byte_count = 4 * (128); - out_msg_buf->read_req_msg.memory_space = LOCAL_REG; - out_msg_buf->read_req_msg.address = 0; - msg_send_serial(out_msg_buf); - expect_msg(READ_ACK,in_msg_buf,1); - data_p = &(in_msg_buf->read_r_ack_msg.data[0]); - - for (regno=LR0_REGNUM; regnoread_req_msg.byte_count = 4*15; - out_msg_buf->read_req_msg.memory_space = SPECIAL_REG; - out_msg_buf->read_req_msg.address = 0; - msg_send_serial( out_msg_buf); - expect_msg(READ_ACK,in_msg_buf,1); - data_p = &(in_msg_buf->read_r_ack_msg.data[0]); - - for (regno=0; regno<=14; regno++) { - supply_register (SR_REGNUM(regno), data_p++); - } - if (USE_SHADOW_PC) { /* Let regno_to_srnum() handle the register number */ - fetch_register(NPC_REGNUM); - fetch_register(PC_REGNUM); - fetch_register(PC2_REGNUM); - } - -/* Unprotected Special Registers */ - out_msg_buf->read_req_msg.byte_count = 4*8; - out_msg_buf->read_req_msg.memory_space = SPECIAL_REG; - out_msg_buf->read_req_msg.address = 128; - msg_send_serial( out_msg_buf); - expect_msg(READ_ACK,in_msg_buf,1); - data_p = &(in_msg_buf->read_r_ack_msg.data[0]); - - for (regno=128; regno<=135; regno++) { - supply_register (SR_REGNUM(regno), data_p++); - } - - /* There doesn't seem to be any way to get these. */ - { - int val = -1; - supply_register (FPE_REGNUM, &val); - supply_register (INTE_REGNUM, &val); - supply_register (FPS_REGNUM, &val); - supply_register (EXO_REGNUM, &val); - } -} - - -/****************************************************** REMOTE_STORE_REGISTERS - * Store register regno into the target. - * If regno==-1 then store all the registers. - * Result is 0 for success, -1 for failure. - */ - -static void -mm_store_registers (regno) -int regno; -{ - int result; - - if (regno >= 0) { - store_register(regno); - return; - } - - result = 0; - - out_msg_buf->write_r_msg.code= WRITE_REQ; - -/* Gr1/rsp */ - out_msg_buf->write_r_msg.byte_count = 4*1; - out_msg_buf->write_r_msg.length = 3*4 + out_msg_buf->write_r_msg.byte_count; - out_msg_buf->write_r_msg.memory_space = GLOBAL_REG; - out_msg_buf->write_r_msg.address = 1; - out_msg_buf->write_r_msg.data[0] = read_register (GR1_REGNUM); - - msg_send_serial( out_msg_buf); - if (!expect_msg(WRITE_ACK,in_msg_buf,1)) { - result = -1; - } - -#if defined(GR64_REGNUM) -/* Global registers gr64-gr95 */ - out_msg_buf->write_r_msg.byte_count = 4* (32); - out_msg_buf->write_r_msg.length = 3*4 + out_msg_buf->write_r_msg.byte_count; - out_msg_buf->write_r_msg.address = 64; - - for (regno=GR64_REGNUM ; regnowrite_r_msg.data[regno-GR64_REGNUM] = read_register (regno); - } - msg_send_serial(out_msg_buf); - if (!expect_msg(WRITE_ACK,in_msg_buf,1)) { - result = -1; - } -#endif /* GR64_REGNUM */ - -/* Global registers gr96-gr127 */ - out_msg_buf->write_r_msg.byte_count = 4* (32); - out_msg_buf->write_r_msg.length = 3*4 + out_msg_buf->write_r_msg.byte_count; - out_msg_buf->write_r_msg.address = 96; - for (regno=GR96_REGNUM ; regnowrite_r_msg.data[regno-GR96_REGNUM] = read_register (regno); - } - msg_send_serial( out_msg_buf); - if (!expect_msg(WRITE_ACK,in_msg_buf,1)) { - result = -1; - } - -/* Local Registers */ - out_msg_buf->write_r_msg.memory_space = LOCAL_REG; - out_msg_buf->write_r_msg.byte_count = 4*128; - out_msg_buf->write_r_msg.length = 3*4 + out_msg_buf->write_r_msg.byte_count; - out_msg_buf->write_r_msg.address = 0; - - for (regno = LR0_REGNUM ; regno < LR0_REGNUM+128 ; regno++) - { - out_msg_buf->write_r_msg.data[regno-LR0_REGNUM] = read_register (regno); - } - msg_send_serial( out_msg_buf); - if (!expect_msg(WRITE_ACK,in_msg_buf,1)) { - result = -1; - } - -/* Protected Special Registers */ - /* VAB through TMR */ - out_msg_buf->write_r_msg.memory_space = SPECIAL_REG; - out_msg_buf->write_r_msg.byte_count = 4* 10; - out_msg_buf->write_r_msg.length = 3*4 + out_msg_buf->write_r_msg.byte_count; - out_msg_buf->write_r_msg.address = 0; - for (regno = 0 ; regno<=9 ; regno++) /* VAB through TMR */ - out_msg_buf->write_r_msg.data[regno] = read_register (SR_REGNUM(regno)); - msg_send_serial( out_msg_buf); - if (!expect_msg(WRITE_ACK,in_msg_buf,1)) { - result = -1; - } - - /* PC0, PC1, PC2 possibly as shadow registers */ - out_msg_buf->write_r_msg.byte_count = 4* 3; - out_msg_buf->write_r_msg.length = 3*4 + out_msg_buf->write_r_msg.byte_count; - for (regno=10 ; regno<=12 ; regno++) /* LRU and MMU */ - out_msg_buf->write_r_msg.data[regno-10] = read_register (SR_REGNUM(regno)); - if (USE_SHADOW_PC) - out_msg_buf->write_r_msg.address = 20; /* SPC0 */ - else - out_msg_buf->write_r_msg.address = 10; /* PC0 */ - msg_send_serial( out_msg_buf); - if (!expect_msg(WRITE_ACK,in_msg_buf,1)) { - result = -1; - } - - /* LRU and MMU */ - out_msg_buf->write_r_msg.byte_count = 4* 2; - out_msg_buf->write_r_msg.length = 3*4 + out_msg_buf->write_r_msg.byte_count; - out_msg_buf->write_r_msg.address = 13; - for (regno=13 ; regno<=14 ; regno++) /* LRU and MMU */ - out_msg_buf->write_r_msg.data[regno-13] = read_register (SR_REGNUM(regno)); - msg_send_serial( out_msg_buf); - if (!expect_msg(WRITE_ACK,in_msg_buf,1)) { - result = -1; - } - -/* Unprotected Special Registers */ - out_msg_buf->write_r_msg.byte_count = 4*8; - out_msg_buf->write_r_msg.length = 3*4 + out_msg_buf->write_r_msg.byte_count; - out_msg_buf->write_r_msg.address = 128; - for (regno = 128 ; regno<=135 ; regno++) - out_msg_buf->write_r_msg.data[regno-128] = read_register(SR_REGNUM(regno)); - msg_send_serial( out_msg_buf); - if (!expect_msg(WRITE_ACK,in_msg_buf,1)) { - result = -1; - } - - registers_changed (); -} - -/*************************************************** REMOTE_PREPARE_TO_STORE */ -/* Get ready to modify the registers array. On machines which store - individual registers, this doesn't need to do anything. On machines - which store all the registers in one fell swoop, this makes sure - that registers contains all the registers from the program being - debugged. */ - -static void -mm_prepare_to_store () -{ - /* Do nothing, since we can store individual regs */ -} - -/******************************************************* REMOTE_XFER_MEMORY */ -static CORE_ADDR -translate_addr(addr) -CORE_ADDR addr; -{ -#if defined(KERNEL_DEBUGGING) - /* Check for a virtual address in the kernel */ - /* Assume physical address of ublock is in paddr_u register */ - /* FIXME: doesn't work for user virtual addresses */ - if (addr >= UVADDR) { - /* PADDR_U register holds the physical address of the ublock */ - CORE_ADDR i = (CORE_ADDR)read_register(PADDR_U_REGNUM); - return(i + addr - (CORE_ADDR)UVADDR); - } else { - return(addr); - } -#else - return(addr); -#endif -} - -/******************************************************* REMOTE_FILES_INFO */ -static void -mm_files_info () -{ - printf ("\tAttached to %s at %d baud and running program %s.\n", - dev_name, baudrate, prog_name); -} - -/************************************************* REMOTE_INSERT_BREAKPOINT */ -static int -mm_insert_breakpoint (addr, contents_cache) - CORE_ADDR addr; - char *contents_cache; -{ - out_msg_buf->bkpt_set_msg.code = BKPT_SET; - out_msg_buf->bkpt_set_msg.length = 4*4; - out_msg_buf->bkpt_set_msg.memory_space = I_MEM; - out_msg_buf->bkpt_set_msg.bkpt_addr = (ADDR32) addr; - out_msg_buf->bkpt_set_msg.pass_count = 1; - out_msg_buf->bkpt_set_msg.bkpt_type = -1; /* use illop for 29000 */ - msg_send_serial( out_msg_buf); - if (expect_msg(BKPT_SET_ACK,in_msg_buf,1)) { - return 0; /* Success */ - } else { - return 1; /* Failure */ - } -} - -/************************************************* REMOTE_DELETE_BREAKPOINT */ -static int -mm_remove_breakpoint (addr, contents_cache) - CORE_ADDR addr; - char *contents_cache; -{ - out_msg_buf->bkpt_rm_msg.code = BKPT_RM; - out_msg_buf->bkpt_rm_msg.length = 4*3; - out_msg_buf->bkpt_rm_msg.memory_space = I_MEM; - out_msg_buf->bkpt_rm_msg.bkpt_addr = (ADDR32) addr; - msg_send_serial( out_msg_buf); - if (expect_msg(BKPT_RM_ACK,in_msg_buf,1)) { - return 0; /* Success */ - } else { - return 1; /* Failure */ - } -} - - -/******************************************************* REMOTE_KILL */ -static void -mm_kill(arg,from_tty) -char *arg; -int from_tty; -{ - char buf[4]; - -#if defined(KERNEL_DEBUGGING) - /* We don't ever kill the kernel */ - if (from_tty) { - printf("Kernel not killed, but left in current state.\n"); - printf("Use detach to leave kernel running.\n"); - } -#else - out_msg_buf->break_msg.code = BREAK; - out_msg_buf->bkpt_set_msg.length = 4*0; - expect_msg(HALT,in_msg_buf,from_tty); - if (from_tty) { - printf("Target has been stopped."); - printf("Would you like to do a hardware reset (y/n) [n] "); - fgets(buf,3,stdin); - if (buf[0] == 'y') { - out_msg_buf->reset_msg.code = RESET; - out_msg_buf->bkpt_set_msg.length = 4*0; - expect_msg(RESET_ACK,in_msg_buf,from_tty); - printf("Target has been reset."); - } - } - pop_target(); -#endif -} - - - -/***************************************************************************/ -/* - * Load a program into the target. - */ -static void -mm_load(arg_string,from_tty) -char *arg_string; -int from_tty; -{ - dont_repeat (); - -#if defined(KERNEL_DEBUGGING) - printf("The kernel had better be loaded already! Loading not done.\n"); -#else - if (arg_string == 0) - error ("The load command takes a file name"); - - arg_string = tilde_expand (arg_string); - make_cleanup (free, arg_string); - QUIT; - immediate_quit++; - error("File loading is not yet supported for MiniMon."); - /* FIXME, code to load your file here... */ - /* You may need to do an init_target_mm() */ - /* init_target_mm(?,?,?,?,?,?,?,?); */ - immediate_quit--; - /* symbol_file_add (arg_string, from_tty, text_addr, 0, 0); */ -#endif - -} - -/************************************************ REMOTE_WRITE_INFERIOR_MEMORY -** Copy LEN bytes of data from debugger memory at MYADDR - to inferior's memory at MEMADDR. Returns number of bytes written. */ -static int -mm_write_inferior_memory (memaddr, myaddr, len) - CORE_ADDR memaddr; - char *myaddr; - int len; -{ - int i,nwritten; - - out_msg_buf->write_req_msg.code= WRITE_REQ; - out_msg_buf->write_req_msg.memory_space = mm_memory_space(memaddr); - - nwritten=0; - while (nwritten < len) { - int num_to_write = len - nwritten; - if (num_to_write > MAXDATA) num_to_write = MAXDATA; - for (i=0 ; i < num_to_write ; i++) - out_msg_buf->write_req_msg.data[i] = myaddr[i+nwritten]; - out_msg_buf->write_req_msg.byte_count = num_to_write; - out_msg_buf->write_req_msg.length = 3*4 + num_to_write; - out_msg_buf->write_req_msg.address = memaddr + nwritten; - msg_send_serial(out_msg_buf); - - if (expect_msg(WRITE_ACK,in_msg_buf,1)) { - nwritten += in_msg_buf->write_ack_msg.byte_count; - } else { - break; - } - } - return(nwritten); -} - -/************************************************* REMOTE_READ_INFERIOR_MEMORY -** Read LEN bytes from inferior memory at MEMADDR. Put the result - at debugger address MYADDR. Returns number of bytes read. */ -static int -mm_read_inferior_memory(memaddr, myaddr, len) - CORE_ADDR memaddr; - char *myaddr; - int len; -{ - int i,nread; - - out_msg_buf->read_req_msg.code= READ_REQ; - out_msg_buf->read_req_msg.memory_space = mm_memory_space(memaddr); - - nread=0; - while (nread < len) { - int num_to_read = (len - nread); - if (num_to_read > MAXDATA) num_to_read = MAXDATA; - out_msg_buf->read_req_msg.byte_count = num_to_read; - out_msg_buf->read_req_msg.length = 3*4 + num_to_read; - out_msg_buf->read_req_msg.address = memaddr + nread; - msg_send_serial(out_msg_buf); - - if (expect_msg(READ_ACK,in_msg_buf,1)) { - for (i=0 ; iread_ack_msg.byte_count ; i++) - myaddr[i+nread] = in_msg_buf->read_ack_msg.data[i]; - nread += in_msg_buf->read_ack_msg.byte_count; - } else { - break; - } - } - return(nread); -} - -/* FIXME! Merge these two. */ -static int -mm_xfer_inferior_memory (memaddr, myaddr, len, write) - CORE_ADDR memaddr; - char *myaddr; - int len; - int write; -{ - - memaddr = translate_addr(memaddr); - - if (write) - return mm_write_inferior_memory (memaddr, myaddr, len); - else - return mm_read_inferior_memory (memaddr, myaddr, len); -} - - -/********************************************************** MSG_SEND_SERIAL -** This function is used to send a message over the -** serial line. -** -** If the message is successfully sent, a zero is -** returned. If the message was not sendable, a -1 -** is returned. This function blocks. That is, it -** does not return until the message is completely -** sent, or until an error is encountered. -** -*/ - -int -msg_send_serial(msg_ptr) - union msg_t *msg_ptr; -{ - INT32 message_size; - int byte_count; - int result; - char c; - - /* Send message header */ - byte_count = 0; - message_size = msg_ptr->generic_msg.length + (2 * sizeof(INT32)); - do { - c = *((char *)msg_ptr+byte_count); - result = write(mm_desc, &c, 1); - if (result == 1) { - byte_count = byte_count + 1; - } - } while ((byte_count < message_size) ); - - return(0); -} /* end msg_send_serial() */ - -/********************************************************** MSG_RECV_SERIAL -** This function is used to receive a message over a -** serial line. -** -** If the message is waiting in the buffer, a zero is -** returned and the buffer pointed to by msg_ptr is filled -** in. If no message was available, a -1 is returned. -** If timeout==0, wait indefinetly for a character. -** -*/ - -int -msg_recv_serial(msg_ptr) -union msg_t *msg_ptr; -{ - static INT32 length=0; - static INT32 byte_count=0; - int result; - char c; - if(msg_ptr == 0) /* re-sync request */ - { length=0; - byte_count=0; -#ifdef HAVE_TERMIO - /* The timeout here is the prevailing timeout set with VTIME */ - ->"timeout==0 semantics not supported" - read(mm_desc, in_buf, BUFER_SIZE); -#else - alarm (1); - read(mm_desc, in_buf, BUFER_SIZE); - alarm (0); -#endif - return(0); - } - /* Receive message */ -#ifdef HAVE_TERMIO -/* Timeout==0, help support the mm_wait() routine */ - ->"timeout==0 semantics not supported (and its nice if they are)" - result = read(mm_desc, &c, 1); -#else - alarm(timeout); - result = read(mm_desc, &c, 1); - alarm (0); -#endif - if ( result < 0) { - if (errno == EINTR) { - error ("Timeout reading from remote system."); - } else - perror_with_name ("remote"); - } else if (result == 1) { - *((char *)msg_ptr+byte_count) = c; - byte_count = byte_count + 1; - } - - /* Message header received. Save message length. */ - if (byte_count == (2 * sizeof(INT32))) - length = msg_ptr->generic_msg.length; - - if (byte_count >= (length + (2 * sizeof(INT32)))) { - /* Message received */ - byte_count = 0; - return(0); - } else - return (-1); - -} /* end msg_recv_serial() */ - -/********************************************************************* KBD_RAW -** This function is used to put the keyboard in "raw" -** mode for BSD Unix. The original status is saved -** so that it may be restored later. -*/ -TERMINAL kbd_tbuf; - -int -kbd_raw() { - int result; - TERMINAL tbuf; - - /* Get keyboard termio (to save to restore original modes) */ -#ifdef HAVE_TERMIO - result = ioctl(0, TCGETA, &kbd_tbuf); -#else - result = ioctl(0, TIOCGETP, &kbd_tbuf); -#endif - if (result == -1) - return (errno); - - /* Get keyboard TERMINAL (for modification) */ -#ifdef HAVE_TERMIO - result = ioctl(0, TCGETA, &tbuf); -#else - result = ioctl(0, TIOCGETP, &tbuf); -#endif - if (result == -1) - return (errno); - - /* Set up new parameters */ -#ifdef HAVE_TERMIO - tbuf.c_iflag = tbuf.c_iflag & - ~(INLCR | ICRNL | IUCLC | ISTRIP | IXON | BRKINT); - tbuf.c_lflag = tbuf.c_lflag & ~(ICANON | ISIG | ECHO); - tbuf.c_cc[4] = 0; /* MIN */ - tbuf.c_cc[5] = 0; /* TIME */ -#else - /* FIXME: not sure if this is correct (matches HAVE_TERMIO). */ - tbuf.sg_flags |= RAW; - tbuf.sg_flags |= ANYP; - tbuf.sg_flags &= ~ECHO; -#endif - - /* Set keyboard termio to new mode (RAW) */ -#ifdef HAVE_TERMIO - result = ioctl(0, TCSETAF, &tbuf); -#else - result = ioctl(0, TIOCSETP, &tbuf); -#endif - if (result == -1) - return (errno); - - return (0); -} /* end kbd_raw() */ - - - -/***************************************************************** KBD_RESTORE -** This function is used to put the keyboard back in the -** mode it was in before kbk_raw was called. Note that -** kbk_raw() must have been called at least once before -** kbd_restore() is called. -*/ - -int -kbd_restore() { - int result; - - /* Set keyboard termio to original mode */ -#ifdef HAVE_TERMIO - result = ioctl(0, TCSETAF, &kbd_tbuf); -#else - result = ioctl(0, TIOCGETP, &kbd_tbuf); -#endif - - if (result == -1) - return (errno); - - return(0); -} /* end kbd_cooked() */ - - -/*****************************************************************************/ -/* Fetch a single register indicatated by 'regno'. - * Returns 0/-1 on success/failure. - */ -static int -fetch_register (regno) - int regno; -{ - int result; - out_msg_buf->read_req_msg.code= READ_REQ; - out_msg_buf->read_req_msg.length = 4*3; - out_msg_buf->read_req_msg.byte_count = 4; - - if (regno == GR1_REGNUM) - { out_msg_buf->read_req_msg.memory_space = GLOBAL_REG; - out_msg_buf->read_req_msg.address = 1; - } - else if (regno >= GR96_REGNUM && regno < GR96_REGNUM + 32) - { out_msg_buf->read_req_msg.memory_space = GLOBAL_REG; - out_msg_buf->read_req_msg.address = (regno - GR96_REGNUM) + 96; - } -#if defined(GR64_REGNUM) - else if (regno >= GR64_REGNUM && regno < GR64_REGNUM + 32 ) - { out_msg_buf->read_req_msg.memory_space = GLOBAL_REG; - out_msg_buf->read_req_msg.address = (regno - GR64_REGNUM) + 64; - } -#endif /* GR64_REGNUM */ - else if (regno >= LR0_REGNUM && regno < LR0_REGNUM + 128) - { out_msg_buf->read_req_msg.memory_space = LOCAL_REG; - out_msg_buf->read_req_msg.address = (regno - LR0_REGNUM); - } - else if (regno>=FPE_REGNUM && regno<=EXO_REGNUM) - { int val = -1; - supply_register(160 + (regno - FPE_REGNUM),&val); - return 0; /* Pretend Success */ - } - else - { out_msg_buf->read_req_msg.memory_space = SPECIAL_REG; - out_msg_buf->read_req_msg.address = regnum_to_srnum(regno); - } - - msg_send_serial(out_msg_buf); - - if (expect_msg(READ_ACK,in_msg_buf,1)) { - supply_register (regno, &(in_msg_buf->read_r_ack_msg.data[0])); - result = 0; - } else { - result = -1; - } - return result; -} -/*****************************************************************************/ -/* Store a single register indicated by 'regno'. - * Returns 0/-1 on success/failure. - */ -static int -store_register (regno) - int regno; -{ - int result; - - out_msg_buf->write_req_msg.code= WRITE_REQ; - out_msg_buf->write_req_msg.length = 4*4; - out_msg_buf->write_req_msg.byte_count = 4; - out_msg_buf->write_r_msg.data[0] = read_register (regno); - - if (regno == GR1_REGNUM) - { out_msg_buf->write_req_msg.memory_space = GLOBAL_REG; - out_msg_buf->write_req_msg.address = 1; - /* Setting GR1 changes the numbers of all the locals, so invalidate the - * register cache. Do this *after* calling read_register, because we want - * read_register to return the value that write_register has just stuffed - * into the registers array, not the value of the register fetched from - * the inferior. - */ - registers_changed (); - } -#if defined(GR64_REGNUM) - else if (regno >= GR64_REGNUM && regno < GR64_REGNUM + 32 ) - { out_msg_buf->write_req_msg.memory_space = GLOBAL_REG; - out_msg_buf->write_req_msg.address = (regno - GR64_REGNUM) + 64; - } -#endif /* GR64_REGNUM */ - else if (regno >= GR96_REGNUM && regno < GR96_REGNUM + 32) - { out_msg_buf->write_req_msg.memory_space = GLOBAL_REG; - out_msg_buf->write_req_msg.address = (regno - GR96_REGNUM) + 96; - } - else if (regno >= LR0_REGNUM && regno < LR0_REGNUM + 128) - { out_msg_buf->write_req_msg.memory_space = LOCAL_REG; - out_msg_buf->write_req_msg.address = (regno - LR0_REGNUM); - } - else if (regno>=FPE_REGNUM && regno<=EXO_REGNUM) - { - return 0; /* Pretend Success */ - } - else /* An unprotected or protected special register */ - { out_msg_buf->write_req_msg.memory_space = SPECIAL_REG; - out_msg_buf->write_req_msg.address = regnum_to_srnum(regno); - } - - msg_send_serial(out_msg_buf); - - if (expect_msg(WRITE_ACK,in_msg_buf,1)) { - result = 0; - } else { - result = -1; - } - return result; -} -/****************************************************************************/ -/* - * Convert a gdb special register number to a 29000 special register number. - */ -static int -regnum_to_srnum(regno) -int regno; -{ - switch(regno) { - case VAB_REGNUM: return(0); - case OPS_REGNUM: return(1); - case CPS_REGNUM: return(2); - case CFG_REGNUM: return(3); - case CHA_REGNUM: return(4); - case CHD_REGNUM: return(5); - case CHC_REGNUM: return(6); - case RBP_REGNUM: return(7); - case TMC_REGNUM: return(8); - case TMR_REGNUM: return(9); - case NPC_REGNUM: return(USE_SHADOW_PC ? (20) : (10)); - case PC_REGNUM: return(USE_SHADOW_PC ? (21) : (11)); - case PC2_REGNUM: return(USE_SHADOW_PC ? (22) : (12)); - case MMU_REGNUM: return(13); - case LRU_REGNUM: return(14); - case IPC_REGNUM: return(128); - case IPA_REGNUM: return(129); - case IPB_REGNUM: return(130); - case Q_REGNUM: return(131); - case ALU_REGNUM: return(132); - case BP_REGNUM: return(133); - case FC_REGNUM: return(134); - case CR_REGNUM: return(135); - case FPE_REGNUM: return(160); - case INTE_REGNUM: return(161); - case FPS_REGNUM: return(162); - case EXO_REGNUM:return(164); - default: - return(255); /* Failure ? */ - } -} -/****************************************************************************/ -/* - * Initialize the target debugger (minimon only). - */ -static void -init_target_mm(tstart,tend,dstart,dend,entry,ms_size,rs_size,arg_start) -ADDR32 tstart,tend,dstart,dend,entry; -INT32 ms_size,rs_size; -ADDR32 arg_start; -{ - out_msg_buf->init_msg.code = INIT; - out_msg_buf->init_msg.length= sizeof(struct init_msg_t)-2*sizeof(INT32); - out_msg_buf->init_msg.text_start = tstart; - out_msg_buf->init_msg.text_end = tend; - out_msg_buf->init_msg.data_start = dstart; - out_msg_buf->init_msg.data_end = dend; - out_msg_buf->init_msg.entry_point = entry; - out_msg_buf->init_msg.mem_stack_size = ms_size; - out_msg_buf->init_msg.reg_stack_size = rs_size; - out_msg_buf->init_msg.arg_start = arg_start; - msg_send_serial(out_msg_buf); - expect_msg(INIT_ACK,in_msg_buf,1); -} -/****************************************************************************/ -/* - * Return a pointer to a string representing the given message code. - * Not all messages are represented here, only the ones that we expect - * to be called with. - */ -static char* -msg_str(code) -INT32 code; -{ - static char cbuf[32]; - - switch (code) { - case BKPT_SET_ACK: sprintf(cbuf,"%s (%d)","BKPT_SET_ACK",code); break; - case BKPT_RM_ACK: sprintf(cbuf,"%s (%d)","BKPT_RM_ACK",code); break; - case INIT_ACK: sprintf(cbuf,"%s (%d)","INIT_ACK",code); break; - case READ_ACK: sprintf(cbuf,"%s (%d)","READ_ACK",code); break; - case WRITE_ACK: sprintf(cbuf,"%s (%d)","WRITE_ACK",code); break; - case ERROR: sprintf(cbuf,"%s (%d)","ERROR",code); break; - case HALT: sprintf(cbuf,"%s (%d)","HALT",code); break; - default: sprintf(cbuf,"UNKNOWN (%d)",code); break; - } - return(cbuf); -} -/****************************************************************************/ -/* - * Selected (not all of them) error codes that we might get. - */ -static char* -error_msg_str(code) -INT32 code; -{ - static char cbuf[50]; - - switch (code) { - case EMFAIL: return("EMFAIL: unrecoverable error"); - case EMBADADDR: return("EMBADADDR: Illegal address"); - case EMBADREG: return("EMBADREG: Illegal register "); - case EMACCESS: return("EMACCESS: Could not access memory"); - case EMBADMSG: return("EMBADMSG: Unknown message type"); - case EMMSG2BIG: return("EMMSG2BIG: Message to large"); - case EMNOSEND: return("EMNOSEND: Could not send message"); - case EMNORECV: return("EMNORECV: Could not recv message"); - case EMRESET: return("EMRESET: Could not RESET target"); - case EMCONFIG: return("EMCONFIG: Could not get target CONFIG"); - case EMSTATUS: return("EMSTATUS: Could not get target STATUS"); - case EMREAD: return("EMREAD: Could not READ target memory"); - case EMWRITE: return("EMWRITE: Could not WRITE target memory"); - case EMBKPTSET: return("EMBKPTSET: Could not set breakpoint"); - case EMBKPTRM: return("EMBKPTRM: Could not remove breakpoint"); - case EMBKPTSTAT:return("EMBKPTSTAT: Could not get breakpoint status"); - case EMBKPTNONE:return("EMBKPTNONE: All breakpoints in use"); - case EMBKPTUSED:return("EMBKPTUSED: Breakpoints already in use"); - case EMINIT: return("EMINIT: Could not init target memory"); - case EMGO: return("EMGO: Could not start execution"); - case EMSTEP: return("EMSTEP: Could not single step"); - case EMBREAK: return("EMBREAK: Could not BREAK"); - case EMCOMMERR: return("EMCOMMERR: Communication error"); - default: sprintf(cbuf,"error number %d",code); break; - } /* end switch */ - - return (cbuf); -} -/****************************************************************************/ -/* - * Receive a message and expect it to be of type msgcode. - * Returns 0/1 on failure/success. - */ -static int -expect_msg(msgcode,msg_buf,from_tty) -INT32 msgcode; /* Msg code we expect */ -union msg_t *msg_buf; /* Where to put the message received */ -int from_tty; /* Print message on error if non-zero */ -{ - int retries=0; - while(msg_recv_serial(msg_buf) && (retries++= MAX_RETRIES) { - printf("Expected msg %s, ",msg_str(msgcode)); - printf("no message received!\n"); - return(0); /* Failure */ - } - - if (msg_buf->generic_msg.code != msgcode) { - if (from_tty) { - printf("Expected msg %s, ",msg_str(msgcode)); - printf("got msg %s\n",msg_str(msg_buf->generic_msg.code)); - if (msg_buf->generic_msg.code == ERROR) - printf("%s\n",error_msg_str(msg_buf->error_msg.error_code)); - } - return(0); /* Failure */ - } - return(1); /* Success */ -} -/****************************************************************************/ -/* - * Determine the MiniMon memory space qualifier based on the addr. - * FIXME: Can't distinguis I_ROM/D_ROM. - * FIXME: Doesn't know anything about I_CACHE/D_CACHE. - */ -static int -mm_memory_space(addr) -CORE_ADDR *addr; -{ - ADDR32 tstart = target_config.I_mem_start; - ADDR32 tend = tstart + target_config.I_mem_size; - ADDR32 dstart = target_config.D_mem_start; - ADDR32 dend = tstart + target_config.D_mem_size; - ADDR32 rstart = target_config.ROM_start; - ADDR32 rend = tstart + target_config.ROM_size; - - if (((ADDR32)addr >= tstart) && ((ADDR32)addr < tend)) { - return I_MEM; - } else if (((ADDR32)addr >= dstart) && ((ADDR32)addr < dend)) { - return D_MEM; - } else if (((ADDR32)addr >= rstart) && ((ADDR32)addr < rend)) { - /* FIXME: how do we determine between D_ROM and I_ROM */ - return D_ROM; - } else /* FIXME: what do me do now? */ - return D_MEM; /* Hmmm! */ -} - -/****************************************************************************/ -/* - * Define the target subroutine names - */ -struct target_ops mm_ops = { - "minimon", "Remote AMD/Minimon target", - "Remote debug an AMD 290*0 using the MiniMon dbg core on the target", - mm_open, mm_close, - mm_attach, mm_detach, mm_resume, mm_wait, - mm_fetch_registers, mm_store_registers, - mm_prepare_to_store, - mm_xfer_inferior_memory, - mm_files_info, - mm_insert_breakpoint, mm_remove_breakpoint, /* Breakpoints */ - 0, 0, 0, 0, 0, /* Terminal handling */ - mm_kill, /* FIXME, kill */ - mm_load, - 0, /* lookup_symbol */ - mm_create_inferior, /* create_inferior */ - mm_mourn, /* mourn_inferior FIXME */ - 0, /* can_run */ - 0, /* notice_signals */ - 0, /* to_stop */ - process_stratum, 0, /* next */ - 1, 1, 1, 1, 1, /* all mem, mem, stack, regs, exec */ - 0,0, /* sections, sections_end */ - OPS_MAGIC, /* Always the last thing */ -}; - -void -_initialize_remote_mm() -{ - add_target (&mm_ops); -} - -#ifdef NO_HIF_SUPPORT -service_HIF(msg) -union msg_t *msg; -{ - return(0); /* Emulate a failure */ -} -#endif diff --git a/contrib/gdb/gdb/remote-nindy.c b/contrib/gdb/gdb/remote-nindy.c deleted file mode 100644 index a3417f0..0000000 --- a/contrib/gdb/gdb/remote-nindy.c +++ /dev/null @@ -1,820 +0,0 @@ -/* Memory-access and commands for remote NINDY process, for GDB. - Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc. - Contributed by Intel Corporation. Modified from remote.c by Chris Benenati. - -GDB is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY. No author or distributor accepts responsibility to anyone -for the consequences of using it or for whether it serves any -particular purpose or works at all, unless he says so in writing. -Refer to the GDB General Public License for full details. - -Everyone is granted permission to copy, modify and redistribute GDB, -but only under the conditions described in the GDB General Public -License. A copy of this license is supposed to have been given to you -along with GDB so you can know your rights and responsibilities. It -should be in a file named COPYING. Among other things, the copyright -notice and this notice must be preserved on all copies. - -In other words, go ahead and share GDB, but don't try to stop -anyone else from sharing it farther. Help stamp out software hoarding! -*/ - -/* -Except for the data cache routines, this file bears little resemblence -to remote.c. A new (although similar) protocol has been specified, and -portions of the code are entirely dependent on having an i80960 with a -NINDY ROM monitor at the other end of the line. -*/ - -/***************************************************************************** - * - * REMOTE COMMUNICATION PROTOCOL BETWEEN GDB960 AND THE NINDY ROM MONITOR. - * - * - * MODES OF OPERATION - * ----- -- --------- - * - * As far as NINDY is concerned, GDB is always in one of two modes: command - * mode or passthrough mode. - * - * In command mode (the default) pre-defined packets containing requests - * are sent by GDB to NINDY. NINDY never talks except in reponse to a request. - * - * Once the the user program is started, GDB enters passthrough mode, to give - * the user program access to the terminal. GDB remains in this mode until - * NINDY indicates that the program has stopped. - * - * - * PASSTHROUGH MODE - * ----------- ---- - * - * GDB writes all input received from the keyboard directly to NINDY, and writes - * all characters received from NINDY directly to the monitor. - * - * Keyboard input is neither buffered nor echoed to the monitor. - * - * GDB remains in passthrough mode until NINDY sends a single ^P character, - * to indicate that the user process has stopped. - * - * Note: - * GDB assumes NINDY performs a 'flushreg' when the user program stops. - * - * - * COMMAND MODE - * ------- ---- - * - * All info (except for message ack and nak) is transferred between gdb - * and the remote processor in messages of the following format: - * - * # - * - * where - * # is a literal character - * - * ASCII information; all numeric information is in the - * form of hex digits ('0'-'9' and lowercase 'a'-'f'). - * - * - * is a pair of ASCII hex digits representing an 8-bit - * checksum formed by adding together each of the - * characters in . - * - * The receiver of a message always sends a single character to the sender - * to indicate that the checksum was good ('+') or bad ('-'); the sender - * re-transmits the entire message over until a '+' is received. - * - * In response to a command NINDY always sends back either data or - * a result code of the form "Xnn", where "nn" are hex digits and "X00" - * means no errors. (Exceptions: the "s" and "c" commands don't respond.) - * - * SEE THE HEADER OF THE FILE "gdb.c" IN THE NINDY MONITOR SOURCE CODE FOR A - * FULL DESCRIPTION OF LEGAL COMMANDS. - * - * SEE THE FILE "stop.h" IN THE NINDY MONITOR SOURCE CODE FOR A LIST - * OF STOP CODES. - * - ***************************************************************************/ - -#include "defs.h" -#include -#include -#include - -#include "frame.h" -#include "inferior.h" -#include "bfd.h" -#include "symfile.h" -#include "target.h" -#include "gdbcore.h" -#include "command.h" -#include "floatformat.h" - -#include "wait.h" -#include -#include -#include "serial.h" -#include "nindy-share/env.h" -#include "nindy-share/stop.h" - -#include "dcache.h" -#include "remote-utils.h" - -static DCACHE *nindy_dcache; - -extern int unlink(); -extern char *getenv(); -extern char *mktemp(); - -extern void generic_mourn_inferior (); - -extern struct target_ops nindy_ops; -extern GDB_FILE *instream; - -extern char ninStopWhy (); -extern int ninMemGet (); -extern int ninMemPut (); - -int nindy_initial_brk; /* nonzero if want to send an initial BREAK to nindy */ -int nindy_old_protocol; /* nonzero if want to use old protocol */ -char *nindy_ttyname; /* name of tty to talk to nindy on, or null */ - -#define DLE '\020' /* Character NINDY sends to indicate user program has - * halted. */ -#define TRUE 1 -#define FALSE 0 - -/* From nindy-share/nindy.c. */ -extern serial_t nindy_serial; - -static int have_regs = 0; /* 1 iff regs read since i960 last halted */ -static int regs_changed = 0; /* 1 iff regs were modified since last read */ - -extern char *exists(); - -static void -nindy_fetch_registers PARAMS ((int)); - -static void -nindy_store_registers PARAMS ((int)); - -static char *savename; - -static void -nindy_close (quitting) - int quitting; -{ - if (nindy_serial != NULL) - SERIAL_CLOSE (nindy_serial); - nindy_serial = NULL; - - if (savename) - free (savename); - savename = 0; -} - -/* Open a connection to a remote debugger. - FIXME, there should be "set" commands for the options that are - now specified with gdb command-line options (old_protocol, - and initial_brk). */ -void -nindy_open (name, from_tty) - char *name; /* "/dev/ttyXX", "ttyXX", or "XX": tty to be opened */ - int from_tty; -{ - char baudrate[1024]; - - if (!name) - error_no_arg ("serial port device name"); - - target_preopen (from_tty); - - nindy_close (0); - - have_regs = regs_changed = 0; - nindy_dcache = dcache_init(ninMemGet, ninMemPut); - - /* Allow user to interrupt the following -- we could hang if there's - no NINDY at the other end of the remote tty. */ - immediate_quit++; - /* If baud_rate is -1, then ninConnect will not recognize the baud rate - and will deal with the situation in a (more or less) reasonable - fashion. */ - sprintf(baudrate, "%d", baud_rate); - ninConnect(name, baudrate, - nindy_initial_brk, !from_tty, nindy_old_protocol); - immediate_quit--; - - if (nindy_serial == NULL) - { - perror_with_name (name); - } - - savename = savestring (name, strlen (name)); - push_target (&nindy_ops); - target_fetch_registers(-1); -} - -/* User-initiated quit of nindy operations. */ - -static void -nindy_detach (name, from_tty) - char *name; - int from_tty; -{ - if (name) - error ("Too many arguments"); - pop_target (); -} - -static void -nindy_files_info () -{ - /* FIXME: this lies about the baud rate if we autobauded. */ - printf_unfiltered("\tAttached to %s at %d bits per second%s%s.\n", savename, - baud_rate, - nindy_old_protocol? " in old protocol": "", - nindy_initial_brk? " with initial break": ""); -} - -/* Return the number of characters in the buffer before - the first DLE character. */ - -static -int -non_dle( buf, n ) - char *buf; /* Character buffer; NOT '\0'-terminated */ - int n; /* Number of characters in buffer */ -{ - int i; - - for ( i = 0; i < n; i++ ){ - if ( buf[i] == DLE ){ - break; - } - } - return i; -} - -/* Tell the remote machine to resume. */ - -void -nindy_resume (pid, step, siggnal) - int pid, step; - enum target_signal siggnal; -{ - if (siggnal != TARGET_SIGNAL_0 && siggnal != stop_signal) - warning ("Can't send signals to remote NINDY targets."); - - dcache_flush(nindy_dcache); - if ( regs_changed ) - { - nindy_store_registers (-1); - regs_changed = 0; - } - have_regs = 0; - ninGo( step ); -} - -/* FIXME, we can probably use the normal terminal_inferior stuff here. - We have to do terminal_inferior and then set up the passthrough - settings initially. Thereafter, terminal_ours and terminal_inferior - will automatically swap the settings around for us. */ - -struct clean_up_tty_args { - serial_ttystate state; - serial_t serial; -}; -static struct clean_up_tty_args tty_args; - -static void -clean_up_tty (ptrarg) - PTR ptrarg; -{ - struct clean_up_tty_args *args = (struct clean_up_tty_args *) ptrarg; - SERIAL_SET_TTY_STATE (args->serial, args->state); - free (args->state); - warning ("\n\nYou may need to reset the 80960 and/or reload your program.\n"); -} - -/* Recover from ^Z or ^C while remote process is running */ -static void (*old_ctrlc)(); -#ifdef SIGTSTP -static void (*old_ctrlz)(); -#endif - -static void -clean_up_int() -{ - SERIAL_SET_TTY_STATE (tty_args.serial, tty_args.state); - free (tty_args.state); - - signal(SIGINT, old_ctrlc); -#ifdef SIGTSTP - signal(SIGTSTP, old_ctrlz); -#endif - error("\n\nYou may need to reset the 80960 and/or reload your program.\n"); -} - -/* Wait until the remote machine stops. While waiting, operate in passthrough - * mode; i.e., pass everything NINDY sends to gdb_stdout, and everything from - * stdin to NINDY. - * - * Return to caller, storing status in 'status' just as `wait' would. - */ - -static int -nindy_wait( pid, status ) - int pid; - struct target_waitstatus *status; -{ - fd_set fds; - int c; - char buf[2]; - int i, n; - unsigned char stop_exit; - unsigned char stop_code; - struct cleanup *old_cleanups; - long ip_value, fp_value, sp_value; /* Reg values from stop */ - - status->kind = TARGET_WAITKIND_EXITED; - status->value.integer = 0; - - /* OPERATE IN PASSTHROUGH MODE UNTIL NINDY SENDS A DLE CHARACTER */ - - /* Save current tty attributes, and restore them when done. */ - tty_args.serial = SERIAL_FDOPEN (0); - tty_args.state = SERIAL_GET_TTY_STATE (tty_args.serial); - old_ctrlc = signal( SIGINT, clean_up_int ); -#ifdef SIGTSTP - old_ctrlz = signal( SIGTSTP, clean_up_int ); -#endif - - old_cleanups = make_cleanup (clean_up_tty, &tty_args); - - /* Pass input from keyboard to NINDY as it arrives. NINDY will interpret - and perform echo. */ - /* This used to set CBREAK and clear ECHO and CRMOD. I hope this is close - enough. */ - SERIAL_RAW (tty_args.serial); - - while (1) - { - /* Input on remote */ - c = SERIAL_READCHAR (nindy_serial, -1); - if (c == SERIAL_ERROR) - { - error ("Cannot read from serial line"); - } - else if (c == 0x1b) /* ESC */ - { - c = SERIAL_READCHAR (nindy_serial, -1); - c &= ~0x40; - } - else if (c != 0x10) /* DLE */ - /* Write out any characters preceding DLE */ - { - buf[0] = (char)c; - write (1, buf, 1); - } - else - { - stop_exit = ninStopWhy(&stop_code, - &ip_value, &fp_value, &sp_value); - if (!stop_exit && (stop_code == STOP_SRQ)) - { - immediate_quit++; - ninSrq(); - immediate_quit--; - } - else - { - /* Get out of loop */ - supply_register (IP_REGNUM, - (char *)&ip_value); - supply_register (FP_REGNUM, - (char *)&fp_value); - supply_register (SP_REGNUM, - (char *)&sp_value); - break; - } - } - } - - SERIAL_SET_TTY_STATE (tty_args.serial, tty_args.state); - free (tty_args.state); - discard_cleanups (old_cleanups); - - if (stop_exit) - { - status->kind = TARGET_WAITKIND_EXITED; - status->value.integer = stop_code; - } - else - { - /* nindy has some special stop code need to be handled */ - if (stop_code == STOP_GDB_BPT) - stop_code = TRACE_STEP; - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = i960_fault_to_signal (stop_code); - } - return inferior_pid; -} - -/* Read the remote registers into the block REGS. */ - -/* This is the block that ninRegsGet and ninRegsPut handles. */ -struct nindy_regs { - char local_regs[16 * 4]; - char global_regs[16 * 4]; - char pcw_acw[2 * 4]; - char ip[4]; - char tcw[4]; - char fp_as_double[4 * 8]; -}; - -static void -nindy_fetch_registers(regno) - int regno; -{ - struct nindy_regs nindy_regs; - int regnum, inv; - double dub; - - immediate_quit++; - ninRegsGet( (char *) &nindy_regs ); - immediate_quit--; - - memcpy (®isters[REGISTER_BYTE (R0_REGNUM)], nindy_regs.local_regs, 16*4); - memcpy (®isters[REGISTER_BYTE (G0_REGNUM)], nindy_regs.global_regs, 16*4); - memcpy (®isters[REGISTER_BYTE (PCW_REGNUM)], nindy_regs.pcw_acw, 2*4); - memcpy (®isters[REGISTER_BYTE (IP_REGNUM)], nindy_regs.ip, 1*4); - memcpy (®isters[REGISTER_BYTE (TCW_REGNUM)], nindy_regs.tcw, 1*4); - for (regnum = FP0_REGNUM; regnum < FP0_REGNUM + 4; regnum++) { - dub = unpack_double (builtin_type_double, - &nindy_regs.fp_as_double[8 * (regnum - FP0_REGNUM)], - &inv); - /* dub now in host byte order */ - floatformat_from_double (&floatformat_i960_ext, &dub, - ®isters[REGISTER_BYTE (regnum)]); - } - - registers_fetched (); -} - -static void -nindy_prepare_to_store() -{ - /* Fetch all regs if they aren't already here. */ - read_register_bytes (0, NULL, REGISTER_BYTES); -} - -static void -nindy_store_registers(regno) - int regno; -{ - struct nindy_regs nindy_regs; - int regnum; - double dub; - - memcpy (nindy_regs.local_regs, ®isters[REGISTER_BYTE (R0_REGNUM)], 16*4); - memcpy (nindy_regs.global_regs, ®isters[REGISTER_BYTE (G0_REGNUM)], 16*4); - memcpy (nindy_regs.pcw_acw, ®isters[REGISTER_BYTE (PCW_REGNUM)], 2*4); - memcpy (nindy_regs.ip, ®isters[REGISTER_BYTE (IP_REGNUM)], 1*4); - memcpy (nindy_regs.tcw, ®isters[REGISTER_BYTE (TCW_REGNUM)], 1*4); - for (regnum = FP0_REGNUM; regnum < FP0_REGNUM + 4; regnum++) - { - floatformat_to_double (&floatformat_i960_ext, - ®isters[REGISTER_BYTE (regnum)], &dub); - store_floating (&nindy_regs.fp_as_double[8 * (regnum - FP0_REGNUM)], - REGISTER_VIRTUAL_SIZE (regnum), - dub); - } - - immediate_quit++; - ninRegsPut( (char *) &nindy_regs ); - immediate_quit--; -} - -/* Read a word from remote address ADDR and return it. - * This goes through the data cache. - */ -int -nindy_fetch_word (addr) - CORE_ADDR addr; -{ - return dcache_fetch (nindy_dcache, addr); -} - -/* Write a word WORD into remote address ADDR. - This goes through the data cache. */ - -void -nindy_store_word (addr, word) - CORE_ADDR addr; - int word; -{ - dcache_poke (nindy_dcache, addr, word); -} - -/* 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. Returns the length copied. - - This is stolen almost directly from infptrace.c's child_xfer_memory, - which also deals with a word-oriented memory interface. Sometime, - FIXME, rewrite this to not use the word-oriented routines. */ - -int -nindy_xfer_inferior_memory(memaddr, myaddr, len, write, target) - CORE_ADDR memaddr; - char *myaddr; - int len; - int write; - struct target_ops *target; /* ignored */ -{ - register int i; - /* Round starting address down to longword boundary. */ - register CORE_ADDR addr = memaddr & - sizeof (int); - /* Round ending address up; get number of longwords that makes. */ - register int count - = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int); - /* Allocate buffer of that many longwords. */ - register int *buffer = (int *) alloca (count * sizeof (int)); - - if (write) - { - /* Fill start and end extra bytes of buffer with existing memory data. */ - - if (addr != memaddr || len < (int)sizeof (int)) { - /* Need part of initial word -- fetch it. */ - buffer[0] = nindy_fetch_word (addr); - } - - if (count > 1) /* FIXME, avoid if even boundary */ - { - buffer[count - 1] - = nindy_fetch_word (addr + (count - 1) * sizeof (int)); - } - - /* Copy data to be written over corresponding part of buffer */ - - memcpy ((char *) buffer + (memaddr & (sizeof (int) - 1)), myaddr, len); - - /* Write the entire buffer. */ - - for (i = 0; i < count; i++, addr += sizeof (int)) - { - errno = 0; - nindy_store_word (addr, buffer[i]); - if (errno) - return 0; - } - } - else - { - /* Read all the longwords */ - for (i = 0; i < count; i++, addr += sizeof (int)) - { - errno = 0; - buffer[i] = nindy_fetch_word (addr); - if (errno) - return 0; - QUIT; - } - - /* Copy appropriate bytes out of the buffer. */ - memcpy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len); - } - return len; -} - -static void -nindy_create_inferior (execfile, args, env) - char *execfile; - char *args; - char **env; -{ - int entry_pt; - int pid; - - if (args && *args) - error ("Can't pass arguments to remote NINDY process"); - - if (execfile == 0 || exec_bfd == 0) - error ("No exec file specified"); - - entry_pt = (int) bfd_get_start_address (exec_bfd); - - pid = 42; - - /* The "process" (board) is already stopped awaiting our commands, and - the program is already downloaded. We just set its PC and go. */ - - inferior_pid = pid; /* Needed for wait_for_inferior below */ - - clear_proceed_status (); - - /* Tell wait_for_inferior that we've started a new process. */ - init_wait_for_inferior (); - - /* Set up the "saved terminal modes" of the inferior - based on what modes we are starting it with. */ - target_terminal_init (); - - /* Install inferior's terminal modes. */ - target_terminal_inferior (); - - /* insert_step_breakpoint (); FIXME, do we need this? */ - /* Let 'er rip... */ - proceed ((CORE_ADDR)entry_pt, TARGET_SIGNAL_DEFAULT, 0); -} - -static void -reset_command(args, from_tty) - char *args; - int from_tty; -{ - if (nindy_serial == NULL) - { - error( "No target system to reset -- use 'target nindy' command."); - } - if ( query("Really reset the target system?",0,0) ) - { - SERIAL_SEND_BREAK (nindy_serial); - tty_flush (nindy_serial); - } -} - -void -nindy_kill (args, from_tty) - char *args; - int from_tty; -{ - return; /* Ignore attempts to kill target system */ -} - -/* Clean up when a program exits. - - The program actually lives on in the remote processor's RAM, and may be - run again without a download. Don't leave it full of breakpoint - instructions. */ - -void -nindy_mourn_inferior () -{ - remove_breakpoints (); - unpush_target (&nindy_ops); - generic_mourn_inferior (); /* Do all the proper things now */ -} - -/* Pass the args the way catch_errors wants them. */ -static int -nindy_open_stub (arg) - char *arg; -{ - nindy_open (arg, 1); - return 1; -} - -static void -nindy_load( filename, from_tty ) - char *filename; - int from_tty; -{ - asection *s; - /* Can't do unix style forking on a VMS system, so we'll use bfd to do - all the work for us - */ - - bfd *file = bfd_openr(filename,0); - if (!file) - { - perror_with_name(filename); - return; - } - - if (!bfd_check_format(file, bfd_object)) - { - error("can't prove it's an object file\n"); - return; - } - - for ( s = file->sections; s; s=s->next) - { - if (s->flags & SEC_LOAD) - { - char *buffer = xmalloc(s->_raw_size); - bfd_get_section_contents(file, s, buffer, 0, s->_raw_size); - printf("Loading section %s, size %x vma %x\n", - s->name, - s->_raw_size, - s->vma); - ninMemPut(s->vma, buffer, s->_raw_size); - free(buffer); - } - } - bfd_close(file); -} - -static int -load_stub (arg) - char *arg; -{ - target_load (arg, 1); - return 1; -} - -/* This routine is run as a hook, just before the main command loop is - entered. If gdb is configured for the i960, but has not had its - nindy target specified yet, this will loop prompting the user to do so. - - Unlike the loop provided by Intel, we actually let the user get out - of this with a RETURN. This is useful when e.g. simply examining - an i960 object file on the host system. */ - -void -nindy_before_main_loop () -{ - char ttyname[100]; - char *p, *p2; - - while (target_stack->target_ops != &nindy_ops) /* What is this crap??? */ - { /* remote tty not specified yet */ - if ( instream == stdin ){ - printf_unfiltered("\nAttach /dev/ttyNN -- specify NN, or \"quit\" to quit: "); - gdb_flush( gdb_stdout ); - } - fgets( ttyname, sizeof(ttyname)-1, stdin ); - - /* Strip leading and trailing whitespace */ - for ( p = ttyname; isspace(*p); p++ ){ - ; - } - if ( *p == '\0' ){ - return; /* User just hit spaces or return, wants out */ - } - for ( p2= p; !isspace(*p2) && (*p2 != '\0'); p2++ ){ - ; - } - *p2= '\0'; - if ( STREQ("quit",p) ){ - exit(1); - } - - if (catch_errors (nindy_open_stub, p, "", RETURN_MASK_ALL)) - { - /* Now that we have a tty open for talking to the remote machine, - download the executable file if one was specified. */ - if (exec_bfd) - { - catch_errors (load_stub, bfd_get_filename (exec_bfd), "", - RETURN_MASK_ALL); - } - } - } -} - -/* Define the target subroutine names */ - -struct target_ops nindy_ops = { - "nindy", "Remote serial target in i960 NINDY-specific protocol", - "Use a remote i960 system running NINDY connected by a serial line.\n\ -Specify the name of the device the serial line is connected to.\n\ -The speed (baud rate), whether to use the old NINDY protocol,\n\ -and whether to send a break on startup, are controlled by options\n\ -specified when you started GDB.", - nindy_open, nindy_close, - 0, - nindy_detach, - nindy_resume, - nindy_wait, - nindy_fetch_registers, nindy_store_registers, - nindy_prepare_to_store, - nindy_xfer_inferior_memory, nindy_files_info, - memory_insert_breakpoint, - memory_remove_breakpoint, - 0, 0, 0, 0, 0, /* Terminal crud */ - nindy_kill, - nindy_load, - 0, /* lookup_symbol */ - nindy_create_inferior, - nindy_mourn_inferior, - 0, /* can_run */ - 0, /* notice_signals */ - 0, /* to_thread_alive */ - 0, /* to_stop */ - process_stratum, 0, /* next */ - 1, 1, 1, 1, 1, /* all mem, mem, stack, regs, exec */ - 0, 0, /* Section pointers */ - OPS_MAGIC, /* Always the last thing */ -}; - -void -_initialize_nindy () -{ - add_target (&nindy_ops); - add_com ("reset", class_obscure, reset_command, - "Send a 'break' to the remote target system.\n\ -Only useful if the target has been equipped with a circuit\n\ -to perform a hard reset when a break is detected."); -} diff --git a/contrib/gdb/gdb/remote-nrom.c b/contrib/gdb/gdb/remote-nrom.c deleted file mode 100644 index d67791b..0000000 --- a/contrib/gdb/gdb/remote-nrom.c +++ /dev/null @@ -1,332 +0,0 @@ -/* Remote debugging with the XLNT Designs, Inc (XDI) NetROM. - Copyright 1990, 1991, 1992, 1995 Free Software Foundation, Inc. - Contributed by: - Roger Moyers - XLNT Designs, Inc. - 15050 Avenue of Science, Suite 106 - San Diego, CA 92128 - (619)487-9320 - roger@xlnt.com - Adapted from work done at Cygnus Support in remote-nindy.c, - later merged in by Stan Shebs at Cygnus. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "defs.h" -#include "gdbcmd.h" -#include "serial.h" -#include "target.h" - -/* Default ports used to talk with the NetROM. */ - -#define DEFAULT_NETROM_LOAD_PORT 1236 -#define DEFAULT_NETROM_CONTROL_PORT 1237 - -static void nrom_close PARAMS ((int quitting)); - -/* New commands. */ - -static void nrom_passthru PARAMS ((char *, int)); - -/* We talk to the NetROM over these sockets. */ - -static serial_t load_desc = NULL; -static serial_t ctrl_desc = NULL; - -static int load_port = DEFAULT_NETROM_LOAD_PORT; -static int control_port = DEFAULT_NETROM_CONTROL_PORT; - -static char nrom_hostname[100]; - -/* Forward data declaration. */ - -extern struct target_ops nrom_ops; - -/* Scan input from the remote system, until STRING is found. Print chars that - don't match. */ - -static int -expect (string) - char *string; -{ - char *p = string; - int c; - - immediate_quit = 1; - - while (1) - { - c = SERIAL_READCHAR (ctrl_desc, 5); - - if (c == *p++) - { - if (*p == '\0') - { - immediate_quit = 0; - - return 0; - } - } - else - { - fputc_unfiltered (c, gdb_stdout); - p = string; - if (c == *p) - p++; - } - } -} - -static void -nrom_kill () -{ - nrom_close (0); -} - -static serial_t -open_socket (name, port) - char *name; - int port; -{ - char sockname[100]; - serial_t desc; - - sprintf (sockname, "%s:%d", name, port); - desc = SERIAL_OPEN (sockname); - if (!desc) - perror_with_name (sockname); - - return desc; -} - -static void -load_cleanup () -{ - SERIAL_CLOSE (load_desc); - load_desc = NULL; -} - -/* Download a file specified in ARGS to the netROM. */ - -static void -nrom_load (args, fromtty) - char *args; - int fromtty; -{ - int fd, rd_amt, fsize; - bfd *pbfd; - asection *section; - char *downloadstring = "download 0\n"; - struct cleanup *old_chain; - - /* Tell the netrom to get ready to download. */ - if (SERIAL_WRITE (ctrl_desc, downloadstring, strlen (downloadstring))) - error ("nrom_load: control_send() of `%s' failed", downloadstring); - - expect ("Waiting for a connection...\n"); - - load_desc = open_socket (nrom_hostname, load_port); - - old_chain = make_cleanup (load_cleanup, 0); - - pbfd = bfd_openr (args, 0); - - if (pbfd) - { - make_cleanup (bfd_close, pbfd); - - if (!bfd_check_format (pbfd, bfd_object)) - error ("\"%s\": not in executable format: %s", - args, bfd_errmsg (bfd_get_error ())); - - for (section = pbfd->sections; section; section = section->next) - { - if (bfd_get_section_flags (pbfd, section) & SEC_ALLOC) - { - bfd_vma section_address; - unsigned long section_size; - const char *section_name; - - section_name = bfd_get_section_name (pbfd, section); - section_address = bfd_get_section_vma (pbfd, section); - section_size = bfd_section_size (pbfd, section); - - if (bfd_get_section_flags (pbfd, section) & SEC_LOAD) - { - file_ptr fptr; - - printf_filtered ("[Loading section %s at %x (%d bytes)]\n", - section_name, section_address, - section_size); - - fptr = 0; - - while (section_size > 0) - { - char buffer[1024]; - int count; - - count = min (section_size, 1024); - - bfd_get_section_contents (pbfd, section, buffer, fptr, - count); - - SERIAL_WRITE (load_desc, buffer, count); - section_address += count; - fptr += count; - section_size -= count; - } - } - else /* BSS and such */ - { - printf_filtered ("[section %s: not loading]\n", - section_name); - } - } - } - } - else - error ("\"%s\": Could not open", args); - - do_cleanups (old_chain); -} - -/* Open a connection to the remote NetROM devices. */ - -static void -nrom_open (name, from_tty) - char *name; - int from_tty; -{ - int errn; - - if (!name || strchr (name, '/') || strchr (name, ':')) - error ( -"To open a NetROM connection, you must specify the hostname\n\ -or IP address of the NetROM device you wish to use."); - - strcpy (nrom_hostname, name); - - target_preopen (from_tty); - - unpush_target (&nrom_ops); - - ctrl_desc = open_socket (nrom_hostname, control_port); - - push_target (&nrom_ops); - - if (from_tty) - printf_filtered ("Connected to NetROM device \"%s\"\n", nrom_hostname); -} - -/* Close out all files and local state before this target loses control. */ - -static void -nrom_close (quitting) - int quitting; -{ - if (load_desc) - SERIAL_CLOSE (load_desc); - if (ctrl_desc) - SERIAL_CLOSE (ctrl_desc); -} - -/* Pass arguments directly to the NetROM. */ - -static void -nrom_passthru (args, fromtty) - char *args; - int fromtty; -{ - char buf[1024]; - - sprintf (buf, "%s\n", args); - if (SERIAL_WRITE (ctrl_desc, buf, strlen (buf))) - error ("nrom_reset: control_send() of `%s'failed", args); -} - -static void -nrom_mourn() -{ - unpush_target (&nrom_ops); - generic_mourn_inferior (); -} - -/* Define the target vector. */ - -struct target_ops nrom_ops = { - "nrom", /* to_shortname */ - "Remote XDI `NetROM' target", /* to_longname */ - "Remote debug using a NetROM over Ethernet", /* to_doc */ - nrom_open, /* to_open */ - nrom_close, /* to_close */ - NULL, /* to_attach */ - NULL, /* to_detach */ - NULL, /* to_resume */ - NULL, /* to_wait */ - NULL, /* to_fetch_registers */ - NULL, /* to_store_registers */ - NULL, /* to_prepare_to_store */ - NULL, /* to_xfer_memory */ - NULL, /* to_files_info */ - NULL, /* to_insert_breakpoint */ - NULL, /* to_remove_breakpoint */ - NULL, /* to_terminal_init */ - NULL, /* to_terminal_inferior */ - NULL, /* to_terminal_ours_for_output */ - NULL, /* to_terminal_ours */ - NULL, /* to_terminal_info */ - nrom_kill, /* to_kill */ - nrom_load, /* to_load */ - NULL, /* to_lookup_symbol */ - NULL, /* to_create_inferior */ - nrom_mourn, /* to_mourn_inferior */ - NULL, /* to_can_run */ - 0, /* to_notice_signals */ - 0, /* to_thread_alive */ - 0, /* to_stop */ - download_stratum, /* to_stratum */ - NULL, /* to_next */ - 1, /* to_has_all_memory */ - 1, /* to_has_memory */ - 1, /* to_has_stack */ - 1, /* to_has_registers */ - 0, /* to_has_execution */ - NULL, /* sections */ - NULL, /* sections_end */ - OPS_MAGIC /* to_magic */ -}; - -void -_initialize_remote_nrom () -{ - add_target (&nrom_ops); - - add_show_from_set ( - add_set_cmd ("nrom_load_port", no_class, var_zinteger, (char *)&load_port, - "Set the port to use for NetROM downloads\n", &setlist), - &showlist); - - add_show_from_set ( - add_set_cmd ("nrom_control_port", no_class, var_zinteger, (char *)&control_port, - "Set the port to use for NetROM debugger services\n", &setlist), - &showlist); - - add_cmd ("nrom", no_class, nrom_passthru, - "Pass arguments as command to NetROM", - &cmdlist); -} diff --git a/contrib/gdb/gdb/remote-os9k.c b/contrib/gdb/gdb/remote-os9k.c deleted file mode 100644 index fda5272..0000000 --- a/contrib/gdb/gdb/remote-os9k.c +++ /dev/null @@ -1,1230 +0,0 @@ -/* Remote debugging interface for boot monitors, for GDB. - Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* This file was derived from remote-eb.c, which did a similar job, but for - an AMD-29K running EBMON. That file was in turn derived from remote.c - as mentioned in the following comment (left in for comic relief): - - "This is like remote.c but is for a different situation-- - having a PC running os9000 hook up with a unix machine with - a serial line, and running ctty com2 on the PC. os9000 has a debug - monitor called ROMBUG running. Not to mention that the PC - has PC/NFS, so it can access the same executables that gdb can, - over the net in real time." - - In reality, this module talks to a debug monitor called 'ROMBUG', which - We communicate with ROMBUG via a direct serial line, the network version - of ROMBUG is not available yet. -*/ - -#include "defs.h" -#include "gdbcore.h" -#include "target.h" -#include "wait.h" -#ifdef ANSI_PROTOTYPES -#include -#else -#include -#endif -#include -#include "gdb_string.h" -#include -#include "command.h" -#include "serial.h" -#include "monitor.h" -#include "remote-utils.h" -#include "symtab.h" -#include "symfile.h" -#include "objfiles.h" -#include "gdb-stabs.h" - -struct monitor_ops *current_monitor; -struct cmd_list_element *showlist; -extern struct target_ops rombug_ops; /* Forward declaration */ -extern struct monitor_ops rombug_cmds; /* Forward declaration */ -extern struct cmd_list_element *setlist; -extern struct cmd_list_element *unsetlist; -extern int attach_flag; - -static void rombug_close(); -static void rombug_fetch_register(); -static void rombug_fetch_registers(); -static void rombug_store_register(); -#if 0 -static int sr_get_debug(); /* flag set by "set remotedebug" */ -#endif -static int hashmark; /* flag set by "set hash" */ -static int rombug_is_open = 0; - -/* FIXME: Replace with sr_get_debug (). */ -#define LOG_FILE "monitor.log" -FILE *log_file; -static int monitor_log = 0; -static int tty_xon = 0; -static int tty_xoff = 0; - -static int timeout = 10; -static int is_trace_mode = 0; -/* Descriptor for I/O to remote machine. Initialize it to NULL*/ -static serial_t monitor_desc = NULL; - -static CORE_ADDR bufaddr = 0; -static int buflen = 0; -static char readbuf[16]; - -/* Send data to monitor. Works just like printf. */ -static void -#ifdef ANSI_PROTOTYPES -printf_monitor(char *pattern, ...) -#else -printf_monitor(va_alist) - va_dcl -#endif -{ - va_list args; - char buf[200]; - int i; - -#ifdef ANSI_PROTOTYPES - va_start (args, pattern); -#else - char *pattern; - va_start(args); - pattern = va_arg(args, char *); -#endif - - vsprintf(buf, pattern, args); - va_end(args); - - if (SERIAL_WRITE(monitor_desc, buf, strlen(buf))) - fprintf(stderr, "SERIAL_WRITE failed: %s\n", safe_strerror(errno)); -} - -/* Read a character from the remote system, doing all the fancy timeout stuff*/ -static int -readchar(timeout) - int timeout; -{ - int c; - - c = SERIAL_READCHAR(monitor_desc, timeout); - - if (sr_get_debug()) - putchar(c & 0x7f); - - if (monitor_log && isascii(c)) - putc(c & 0x7f, log_file); - - if (c >= 0) - return c & 0x7f; - - if (c == SERIAL_TIMEOUT) - { - if (timeout == 0) - return c; /* Polls shouldn't generate timeout errors */ - - error("Timeout reading from remote system."); - } - - perror_with_name("remote-monitor"); -} - -/* Scan input from the remote system, until STRING is found. If DISCARD is - non-zero, then discard non-matching input, else print it out. - Let the user break out immediately. */ -static void -expect(string, discard) - char *string; - int discard; -{ - char *p = string; - int c; - - if (sr_get_debug()) - printf ("Expecting \"%s\"\n", string); - - immediate_quit = 1; - while (1) - { - c = readchar(timeout); - if (!isascii (c)) - continue; - if (c == *p++) - { - if (*p == '\0') - { - immediate_quit = 0; - if (sr_get_debug()) - printf ("\nMatched\n"); - return; - } - } - else - { - if (!discard) - { - fwrite(string, 1, (p - 1) - string, stdout); - putchar((char)c); - fflush(stdout); - } - p = string; - } - } -} - -/* Keep discarding input until we see the ROMBUG prompt. - - The convention for dealing with the prompt is that you - o give your command - o *then* wait for the prompt. - - Thus the last thing that a procedure does with the serial line - will be an expect_prompt(). Exception: rombug_resume does not - wait for the prompt, because the terminal is being handed over - to the inferior. However, the next thing which happens after that - is a rombug_wait which does wait for the prompt. - Note that this includes abnormal exit, e.g. error(). This is - necessary to prevent getting into states from which we can't - recover. */ -static void -expect_prompt(discard) - int discard; -{ - if (monitor_log) - /* This is a convenient place to do this. The idea is to do it often - enough that we never lose much data if we terminate abnormally. */ - fflush(log_file); - - if (is_trace_mode) { - expect("trace", discard); - } else { - expect (PROMPT, discard); - } -} - -/* Get a hex digit from the remote system & return its value. - If ignore_space is nonzero, ignore spaces (not newline, tab, etc). */ -static int -get_hex_digit(ignore_space) - int ignore_space; -{ - int ch; - while (1) - { - ch = readchar(timeout); - if (ch >= '0' && ch <= '9') - return ch - '0'; - else if (ch >= 'A' && ch <= 'F') - return ch - 'A' + 10; - else if (ch >= 'a' && ch <= 'f') - return ch - 'a' + 10; - else if (ch == ' ' && ignore_space) - ; - else - { - expect_prompt(1); - error("Invalid hex digit from remote system."); - } - } -} - -/* Get a byte from monitor and put it in *BYT. Accept any number - leading spaces. */ -static void -get_hex_byte (byt) - char *byt; -{ - int val; - - val = get_hex_digit (1) << 4; - val |= get_hex_digit (0); - *byt = val; -} - -/* Get N 32-bit words from remote, each preceded by a space, - and put them in registers starting at REGNO. */ -static void -get_hex_regs (n, regno) - int n; - int regno; -{ - long val; - int i; - unsigned char b; - - for (i = 0; i < n; i++) - { - int j; - - val = 0; - for (j = 0; j < 4; j++) - { - get_hex_byte (&b); - if (TARGET_BYTE_ORDER == BIG_ENDIAN) - val = (val << 8) + b; - else - val = val + (b << (j*8)); - } - supply_register (regno++, (char *) &val); - } -} - -/* This is called not only when we first attach, but also when the - user types "run" after having attached. */ -static void -rombug_create_inferior (execfile, args, env) - char *execfile; - char *args; - char **env; -{ - int entry_pt; - - if (args && *args) - error("Can't pass arguments to remote ROMBUG process"); - - if (execfile == 0 || exec_bfd == 0) - error("No exec file specified"); - - entry_pt = (int) bfd_get_start_address (exec_bfd); - - if (monitor_log) - fputs ("\nIn Create_inferior()", log_file); - - -/* The "process" (board) is already stopped awaiting our commands, and - the program is already downloaded. We just set its PC and go. */ - - init_wait_for_inferior (); - proceed ((CORE_ADDR)entry_pt, TARGET_SIGNAL_DEFAULT, 0); -} - -/* Open a connection to a remote debugger. - NAME is the filename used for communication. */ - -static char dev_name[100]; - -static void -rombug_open(args, from_tty) - char *args; - int from_tty; -{ - if (args == NULL) - error ("Use `target RomBug DEVICE-NAME' to use a serial port, or \n\ -`target RomBug HOST-NAME:PORT-NUMBER' to use a network connection."); - - target_preopen(from_tty); - - if (rombug_is_open) - unpush_target(&rombug_ops); - - strcpy(dev_name, args); - monitor_desc = SERIAL_OPEN(dev_name); - if (monitor_desc == NULL) - perror_with_name(dev_name); - - /* if baud rate is set by 'set remotebaud' */ - if (SERIAL_SETBAUDRATE (monitor_desc, sr_get_baud_rate())) - { - SERIAL_CLOSE (monitor_desc); - perror_with_name ("RomBug"); - } - SERIAL_RAW(monitor_desc); - if (tty_xon || tty_xoff) - { - struct hardware_ttystate { struct termios t;} *tty_s; - - tty_s =(struct hardware_ttystate *)SERIAL_GET_TTY_STATE(monitor_desc); - if (tty_xon) tty_s->t.c_iflag |= IXON; - if (tty_xoff) tty_s->t.c_iflag |= IXOFF; - SERIAL_SET_TTY_STATE(monitor_desc, (serial_ttystate) tty_s); - } - - rombug_is_open = 1; - - log_file = fopen (LOG_FILE, "w"); - if (log_file == NULL) - perror_with_name (LOG_FILE); - - push_monitor (&rombug_cmds); - printf_monitor("\r"); /* CR wakes up monitor */ - expect_prompt(1); - push_target (&rombug_ops); - attach_flag = 1; - - if (from_tty) - printf("Remote %s connected to %s\n", target_shortname, - dev_name); - - rombug_fetch_registers(); - - printf_monitor ("ov e \r"); - expect_prompt(1); - bufaddr = 0; - buflen = 0; -} - -/* - * Close out all files and local state before this target loses control. - */ - -static void -rombug_close (quitting) - int quitting; -{ - if (rombug_is_open) { - SERIAL_CLOSE(monitor_desc); - monitor_desc = NULL; - rombug_is_open = 0; - } - - if (log_file) { - if (ferror(log_file)) - fprintf(stderr, "Error writing log file.\n"); - if (fclose(log_file) != 0) - fprintf(stderr, "Error closing log file.\n"); - log_file = 0; - } -} - -int -rombug_link(mod_name, text_reloc) - char *mod_name; - CORE_ADDR *text_reloc; -{ - int i, j; - unsigned long val; - unsigned char b; - - printf_monitor("l %s \r", mod_name); - expect_prompt(1); - printf_monitor(".r \r"); - expect(REG_DELIM, 1); - for (i=0; i <= 7; i++) - { - val = 0; - for (j = 0; j < 4; j++) - { - get_hex_byte(&b); - val = (val << 8) + b; - } - } - expect_prompt(1); - *text_reloc = val; - return 1; -} - -/* Terminate the open connection to the remote debugger. - Use this when you want to detach and do something else - with your gdb. */ -static void -rombug_detach (from_tty) - int from_tty; -{ - if (attach_flag) { - printf_monitor (GO_CMD); - attach_flag = 0; - } - pop_target(); /* calls rombug_close to do the real work */ - if (from_tty) - printf ("Ending remote %s debugging\n", target_shortname); -} - -/* - * Tell the remote machine to resume. - */ -static void -rombug_resume (pid, step, sig) - int pid, step; - enum target_signal sig; -{ - if (monitor_log) - fprintf (log_file, "\nIn Resume (step=%d, sig=%d)\n", step, sig); - - if (step) - { - is_trace_mode = 1; - printf_monitor (STEP_CMD); - /* wait for the echo. ** - expect (STEP_CMD, 1); - */ - } - else - { - printf_monitor (GO_CMD); - /* swallow the echo. ** - expect (GO_CMD, 1); - */ - } - bufaddr = 0; - buflen= 0; -} - -/* - * Wait until the remote machine stops, then return, - * storing status in status just as `wait' would. - */ - -static int -rombug_wait (pid, status) - int pid; - struct target_waitstatus *status; -{ - int old_timeout = timeout; - struct section_offsets *offs; - CORE_ADDR addr, pc; - struct obj_section *obj_sec; - - if (monitor_log) - fputs ("\nIn wait ()", log_file); - - status->kind = TARGET_WAITKIND_EXITED; - status->value.integer = 0; - - timeout = -1; /* Don't time out -- user program is running. */ - expect ("eax:", 0); /* output any message before register display */ - expect_prompt(1); /* Wait for prompt, outputting extraneous text */ - - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_TRAP; - timeout = old_timeout; - rombug_fetch_registers(); - bufaddr = 0; - buflen = 0; - pc = read_register(PC_REGNUM); - addr = read_register(DATABASE_REG); - obj_sec = find_pc_section (pc); - if (obj_sec != NULL) - { - if (obj_sec->objfile != symfile_objfile) - new_symfile_objfile(obj_sec->objfile, 1, 0); - offs = ((struct section_offsets *) - alloca (sizeof (struct section_offsets) - + (symfile_objfile->num_sections * sizeof (offs->offsets)))); - memcpy (offs, symfile_objfile->section_offsets, - (sizeof (struct section_offsets) + - (symfile_objfile->num_sections * sizeof (offs->offsets)))); - ANOFFSET (offs, SECT_OFF_DATA) = addr; - ANOFFSET (offs, SECT_OFF_BSS) = addr; - - objfile_relocate(symfile_objfile, offs); - } - - return 0; -} - -/* Return the name of register number regno in the form input and output by - monitor. Currently, register_names just happens to contain exactly what - monitor wants. Lets take advantage of that just as long as possible! */ - -static char * -get_reg_name (regno) - int regno; -{ - static char buf[50]; - char *p; - char *b; - - b = buf; - - if (regno < 0) - return (""); -/* - for (p = reg_names[regno]; *p; p++) - *b++ = toupper(*p); - *b = '\000'; -*/ - p = (char *)reg_names[regno]; - return p; -/* - return buf; -*/ -} - -/* read the remote registers into the block regs. */ - -static void -rombug_fetch_registers () -{ - int regno, j, i; - long val; - unsigned char b; - - printf_monitor (GET_REG); - expect("eax:", 1); - expect("\n", 1); - get_hex_regs(1, 0); - get_hex_regs(1, 3); - get_hex_regs(1, 1); - get_hex_regs(1, 2); - get_hex_regs(1, 6); - get_hex_regs(1, 7); - get_hex_regs(1, 5); - get_hex_regs(1, 4); - for (regno = 8; regno <= 15; regno++) - { - expect(REG_DELIM, 1); - if (regno >= 8 && regno <= 13) - { - val = 0; - for (j = 0; j < 2; j++) - { - get_hex_byte (&b); - if (TARGET_BYTE_ORDER == BIG_ENDIAN) - val = (val << 8) + b; - else - val = val + (b << (j*8)); - } - - if (regno == 8) i = 10; - if (regno >= 9 && regno <= 12) i = regno + 3; - if (regno == 13) i = 11; - supply_register (i, (char *) &val); - } - else if (regno == 14) - { - get_hex_regs(1, PC_REGNUM); - } - else if (regno == 15) - { - get_hex_regs(1, 9); - } - else - { - val = 0; - supply_register(regno, (char *) &val); - } - } - is_trace_mode = 0; - expect_prompt (1); -} - -/* Fetch register REGNO, or all registers if REGNO is -1. - Returns errno value. */ -static void -rombug_fetch_register (regno) - int regno; -{ - int val, j; - unsigned char b; - - if (monitor_log) { - fprintf (log_file, "\nIn Fetch Register (reg=%s)\n", get_reg_name (regno)); - fflush (log_file); - } - - if (regno < 0) - { - rombug_fetch_registers (); - } - else - { - char *name = get_reg_name (regno); - printf_monitor (GET_REG); - if (regno >= 10 && regno <= 15) - { - expect ("\n", 1); - expect ("\n", 1); - expect (name, 1); - expect (REG_DELIM, 1); - val = 0; - for (j = 0; j < 2; j++) - { - get_hex_byte (&b); - if (TARGET_BYTE_ORDER == BIG_ENDIAN) - val = (val << 8) + b; - else - val = val + (b << (j*8)); - } - supply_register (regno, (char *) &val); - } - else if (regno == 8 || regno == 9) - { - expect ("\n", 1); - expect ("\n", 1); - expect ("\n", 1); - expect (name, 1); - expect (REG_DELIM, 1); - get_hex_regs (1, regno); - } - else - { - expect (name, 1); - expect (REG_DELIM, 1); - expect("\n", 1); - get_hex_regs(1, 0); - get_hex_regs(1, 3); - get_hex_regs(1, 1); - get_hex_regs(1, 2); - get_hex_regs(1, 6); - get_hex_regs(1, 7); - get_hex_regs(1, 5); - get_hex_regs(1, 4); - } - expect_prompt (1); - } - return; -} - -/* Store the remote registers from the contents of the block REGS. */ - -static void -rombug_store_registers () -{ - int regno; - - for (regno = 0; regno <= PC_REGNUM; regno++) - rombug_store_register(regno); - - registers_changed (); -} - -/* Store register REGNO, or all if REGNO == 0. - return errno value. */ -static void -rombug_store_register (regno) - int regno; -{ -char *name; - - if (monitor_log) - fprintf (log_file, "\nIn Store_register (regno=%d)\n", regno); - - if (regno == -1) - rombug_store_registers (); - else - { - if (sr_get_debug()) - printf ("Setting register %s to 0x%x\n", get_reg_name (regno), read_register (regno)); - - name = get_reg_name(regno); - if (name == 0) return; - printf_monitor (SET_REG, name, read_register (regno)); - - is_trace_mode = 0; - expect_prompt (1); - } -} - -/* Get ready to modify the registers array. On machines which store - individual registers, this doesn't need to do anything. On machines - which store all the registers in one fell swoop, this makes sure - that registers contains all the registers from the program being - debugged. */ - -static void -rombug_prepare_to_store () -{ - /* Do nothing, since we can store individual regs */ -} - -static void -rombug_files_info () -{ - printf ("\tAttached to %s at %d baud.\n", - dev_name, sr_get_baud_rate()); -} - -/* Copy LEN bytes of data from debugger memory at MYADDR - to inferior's memory at MEMADDR. Returns length moved. */ -static int -rombug_write_inferior_memory (memaddr, myaddr, len) - CORE_ADDR memaddr; - unsigned char *myaddr; - int len; -{ - int i; - char buf[10]; - - if (monitor_log) - fprintf (log_file, "\nIn Write_inferior_memory (memaddr=%x, len=%d)\n", memaddr, len); - - printf_monitor (MEM_SET_CMD, memaddr); - for (i = 0; i < len; i++) - { - expect (CMD_DELIM, 1); - printf_monitor ("%x \r", myaddr[i]); - if (sr_get_debug()) - printf ("\nSet 0x%x to 0x%x\n", memaddr + i, myaddr[i]); - } - expect (CMD_DELIM, 1); - if (CMD_END) - printf_monitor (CMD_END); - is_trace_mode = 0; - expect_prompt (1); - - bufaddr = 0; - buflen = 0; - return len; -} - -/* Read LEN bytes from inferior memory at MEMADDR. Put the result - at debugger address MYADDR. Returns length moved. */ -static int -rombug_read_inferior_memory(memaddr, myaddr, len) - CORE_ADDR memaddr; - char *myaddr; - int len; -{ - int i, j; - - /* Number of bytes read so far. */ - int count; - - /* Starting address of this pass. */ - unsigned long startaddr; - - /* Number of bytes to read in this pass. */ - int len_this_pass; - - if (monitor_log) - fprintf (log_file, "\nIn Read_inferior_memory (memaddr=%x, len=%d)\n", memaddr, len); - - /* Note that this code works correctly if startaddr is just less - than UINT_MAX (well, really CORE_ADDR_MAX if there was such a - thing). That is, something like - rombug_read_bytes (CORE_ADDR_MAX - 4, foo, 4) - works--it never adds len To memaddr and gets 0. */ - /* However, something like - rombug_read_bytes (CORE_ADDR_MAX - 3, foo, 4) - doesn't need to work. Detect it and give up if there's an attempt - to do that. */ - if (((memaddr - 1) + len) < memaddr) { - errno = EIO; - return 0; - } - if (bufaddr <= memaddr && (memaddr+len) <= (bufaddr+buflen)) - { - memcpy(myaddr, &readbuf[memaddr-bufaddr], len); - return len; - } - - startaddr = memaddr; - count = 0; - while (count < len) - { - len_this_pass = 16; - if ((startaddr % 16) != 0) - len_this_pass -= startaddr % 16; - if (len_this_pass > (len - count)) - len_this_pass = (len - count); - if (sr_get_debug()) - printf ("\nDisplay %d bytes at %x\n", len_this_pass, startaddr); - - printf_monitor (MEM_DIS_CMD, startaddr, 8); - expect ("- ", 1); - for (i = 0; i < 16; i++) - { - get_hex_byte (&readbuf[i]); - } - bufaddr = startaddr; - buflen = 16; - memcpy(&myaddr[count], readbuf, len_this_pass); - count += len_this_pass; - startaddr += len_this_pass; - expect(CMD_DELIM, 1); - } - if (CMD_END) - printf_monitor (CMD_END); - is_trace_mode = 0; - expect_prompt (1); - - return len; -} - -/* FIXME-someday! merge these two. */ -static int -rombug_xfer_inferior_memory (memaddr, myaddr, len, write, target) - CORE_ADDR memaddr; - char *myaddr; - int len; - int write; - struct target_ops *target; /* ignored */ -{ - if (write) - return rombug_write_inferior_memory (memaddr, myaddr, len); - else - return rombug_read_inferior_memory (memaddr, myaddr, len); -} - -static void -rombug_kill (args, from_tty) - char *args; - int from_tty; -{ - return; /* ignore attempts to kill target system */ -} - -/* Clean up when a program exits. - The program actually lives on in the remote processor's RAM, and may be - run again without a download. Don't leave it full of breakpoint - instructions. */ - -static void -rombug_mourn_inferior () -{ - remove_breakpoints (); - generic_mourn_inferior (); /* Do all the proper things now */ -} - -#define MAX_MONITOR_BREAKPOINTS 16 - -extern int memory_breakpoint_size; -static CORE_ADDR breakaddr[MAX_MONITOR_BREAKPOINTS] = {0}; - -static int -rombug_insert_breakpoint (addr, shadow) - CORE_ADDR addr; - char *shadow; -{ - int i; - - if (monitor_log) - fprintf (log_file, "\nIn Insert_breakpoint (addr=%x)\n", addr); - - for (i = 0; i <= MAX_MONITOR_BREAKPOINTS; i++) - if (breakaddr[i] == 0) - { - breakaddr[i] = addr; - if (sr_get_debug()) - printf ("Breakpoint at %x\n", addr); - rombug_read_inferior_memory(addr, shadow, memory_breakpoint_size); - printf_monitor(SET_BREAK_CMD, addr); - is_trace_mode = 0; - expect_prompt(1); - return 0; - } - - fprintf(stderr, "Too many breakpoints (> 16) for monitor\n"); - return 1; -} - -/* - * _remove_breakpoint -- Tell the monitor to remove a breakpoint - */ -static int -rombug_remove_breakpoint (addr, shadow) - CORE_ADDR addr; - char *shadow; -{ - int i; - - if (monitor_log) - fprintf (log_file, "\nIn Remove_breakpoint (addr=%x)\n", addr); - - for (i = 0; i < MAX_MONITOR_BREAKPOINTS; i++) - if (breakaddr[i] == addr) - { - breakaddr[i] = 0; - printf_monitor(CLR_BREAK_CMD, addr); - is_trace_mode = 0; - expect_prompt(1); - return 0; - } - - fprintf(stderr, "Can't find breakpoint associated with 0x%x\n", addr); - return 1; -} - -/* Load a file. This is usually an srecord, which is ascii. No - protocol, just sent line by line. */ - -#define DOWNLOAD_LINE_SIZE 100 -static void -rombug_load (arg) - char *arg; -{ -/* this part comment out for os9* */ -#if 0 - FILE *download; - char buf[DOWNLOAD_LINE_SIZE]; - int i, bytes_read; - - if (sr_get_debug()) - printf ("Loading %s to monitor\n", arg); - - download = fopen (arg, "r"); - if (download == NULL) - { - error (sprintf (buf, "%s Does not exist", arg)); - return; - } - - printf_monitor (LOAD_CMD); -/* expect ("Waiting for S-records from host... ", 1); */ - - while (!feof (download)) - { - bytes_read = fread (buf, sizeof (char), DOWNLOAD_LINE_SIZE, download); - if (hashmark) - { - putchar ('.'); - fflush (stdout); - } - - if (SERIAL_WRITE(monitor_desc, buf, bytes_read)) { - fprintf(stderr, "SERIAL_WRITE failed: (while downloading) %s\n", safe_strerror(errno)); - break; - } - i = 0; - while (i++ <=200000) {} ; /* Ugly HACK, probably needs flow control */ - if (bytes_read < DOWNLOAD_LINE_SIZE) - { - if (!feof (download)) - error ("Only read %d bytes\n", bytes_read); - break; - } - } - - if (hashmark) - { - putchar ('\n'); - } - if (!feof (download)) - error ("Never got EOF while downloading"); - fclose (download); -#endif 0 -} - -/* Put a command string, in args, out to MONITOR. - Output from MONITOR is placed on the users terminal until the prompt - is seen. */ - -static void -rombug_command (args, fromtty) - char *args; - int fromtty; -{ - if (monitor_desc == NULL) - error("monitor target not open."); - - if (monitor_log) - fprintf (log_file, "\nIn command (args=%s)\n", args); - - if (!args) - error("Missing command."); - - printf_monitor("%s\r", args); - expect_prompt(0); -} - -#if 0 -/* Connect the user directly to MONITOR. This command acts just like the - 'cu' or 'tip' command. Use ~. or ~^D to break out. */ - -static struct ttystate ttystate; - -static void -cleanup_tty() -{ printf("\r\n[Exiting connect mode]\r\n"); - /*SERIAL_RESTORE(0, &ttystate);*/ -} - -static void -connect_command (args, fromtty) - char *args; - int fromtty; -{ - fd_set readfds; - int numfds; - int c; - char cur_esc = 0; - - dont_repeat(); - - if (monitor_desc == NULL) - error("monitor target not open."); - - if (args) - fprintf("This command takes no args. They have been ignored.\n"); - - printf("[Entering connect mode. Use ~. or ~^D to escape]\n"); - - serial_raw(0, &ttystate); - - make_cleanup(cleanup_tty, 0); - - FD_ZERO(&readfds); - - while (1) - { - do - { - FD_SET(0, &readfds); - FD_SET(monitor_desc, &readfds); - numfds = select(sizeof(readfds)*8, &readfds, 0, 0, 0); - } - while (numfds == 0); - - if (numfds < 0) - perror_with_name("select"); - - if (FD_ISSET(0, &readfds)) - { /* tty input, send to monitor */ - c = getchar(); - if (c < 0) - perror_with_name("connect"); - - printf_monitor("%c", c); - switch (cur_esc) - { - case 0: - if (c == '\r') - cur_esc = c; - break; - case '\r': - if (c == '~') - cur_esc = c; - else - cur_esc = 0; - break; - case '~': - if (c == '.' || c == '\004') - return; - else - cur_esc = 0; - } - } - - if (FD_ISSET(monitor_desc, &readfds)) - { - while (1) - { - c = readchar(0); - if (c < 0) - break; - putchar(c); - } - fflush(stdout); - } - } -} -#endif - -/* - * Define the monitor command strings. Since these are passed directly - * through to a printf style function, we need can include formatting - * strings. We also need a CR or LF on the end. - */ -struct monitor_ops rombug_cmds = { - "g \r", /* execute or usually GO command */ - "g \r", /* continue command */ - "t \r", /* single step */ - "b %x\r", /* set a breakpoint */ - "k %x\r", /* clear a breakpoint */ - "c %x\r", /* set memory to a value */ - "d %x %d\r", /* display memory */ - "$%08X", /* prompt memory commands use */ - ".%s %x\r", /* set a register */ - ":", /* delimiter between registers */ - ". \r", /* read a register */ - "mf \r", /* download command */ - "RomBug: ", /* monitor command prompt */ - ": ", /* end-of-command delimitor */ - ".\r" /* optional command terminator */ -}; - -struct target_ops rombug_ops = { - "rombug", - "Microware's ROMBUG debug monitor", - "Use a remote computer running the ROMBUG debug monitor.\n\ -Specify the serial device it is connected to (e.g. /dev/ttya).", - rombug_open, - rombug_close, - 0, - rombug_detach, - rombug_resume, - rombug_wait, - rombug_fetch_register, - rombug_store_register, - rombug_prepare_to_store, - rombug_xfer_inferior_memory, - rombug_files_info, - rombug_insert_breakpoint, - rombug_remove_breakpoint, /* Breakpoints */ - 0, - 0, - 0, - 0, - 0, /* Terminal handling */ - rombug_kill, - rombug_load, /* load */ - rombug_link, /* lookup_symbol */ - rombug_create_inferior, - rombug_mourn_inferior, - 0, /* can_run */ - 0, /* notice_signals */ - 0, /* to_stop */ - process_stratum, - 0, /* next */ - 1, - 1, - 1, - 1, - 1, /* has execution */ - 0, - 0, /* Section pointers */ - OPS_MAGIC, /* Always the last thing */ -}; - -void -_initialize_remote_os9k () -{ - add_target (&rombug_ops); - - add_show_from_set ( - add_set_cmd ("hash", no_class, var_boolean, (char *)&hashmark, - "Set display of activity while downloading a file.\nWhen enabled, a period \'.\' is displayed.", - &setlist), - &showlist); - - add_show_from_set ( - add_set_cmd ("timeout", no_class, var_zinteger, - (char *) &timeout, - "Set timeout in seconds for remote MIPS serial I/O.", - &setlist), - &showlist); - - add_show_from_set ( - add_set_cmd ("remotelog", no_class, var_zinteger, - (char *) &monitor_log, - "Set monitor activity log on(=1) or off(=0).", - &setlist), - &showlist); - - add_show_from_set ( - add_set_cmd ("remotexon", no_class, var_zinteger, - (char *) &tty_xon, - "Set remote tty line XON control", - &setlist), - &showlist); - - add_show_from_set ( - add_set_cmd ("remotexoff", no_class, var_zinteger, - (char *) &tty_xoff, - "Set remote tty line XOFF control", - &setlist), - &showlist); - - add_com ("rombug ", class_obscure, rombug_command, - "Send a command to the debug monitor."); -#if 0 - add_com ("connect", class_obscure, connect_command, - "Connect the terminal directly up to a serial based command monitor.\nUse ~. or ~^D to break out."); -#endif -} diff --git a/contrib/gdb/gdb/remote-pa.c b/contrib/gdb/gdb/remote-pa.c deleted file mode 100644 index 1121e15..0000000 --- a/contrib/gdb/gdb/remote-pa.c +++ /dev/null @@ -1,1540 +0,0 @@ -/* Remote target communications for serial-line targets in custom GDB protocol - Copyright 1988, 1991, 1992, 1993, 1994 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. */ - -/* Remote communication protocol. - - A debug packet whose contents are - is encapsulated for transmission in the form: - - $ # CSUM1 CSUM2 - - must be ASCII alphanumeric and cannot include characters - '$' or '#'. If starts with two characters followed by - ':', then the existing stubs interpret this as a sequence number. - - CSUM1 and CSUM2 are ascii hex representation of an 8-bit - checksum of , the most significant nibble is sent first. - the hex digits 0-9,a-f are used. - - Receiver responds with: - - + - if CSUM is correct and ready for next packet - - - if CSUM is incorrect - - is as follows: - All values are encoded in ascii hex digits. - - Request Packet - - read registers g - reply XX....X Each byte of register data - is described by two hex digits. - Registers are in the internal order - for GDB, and the bytes in a register - are in the same order the machine uses. - or ENN for an error. - - write regs GXX..XX Each byte of register data - is described by two hex digits. - reply OK for success - ENN for an error - - write reg Pn...=r... Write register n... with value r..., - which contains two hex digits for each - byte in the register (target byte - order). - reply OK for success - ENN for an error - (not supported by all stubs). - - read mem mAA..AA,LLLL AA..AA is address, LLLL is length. - reply XX..XX XX..XX is mem contents - Can be fewer bytes than requested - if able to read only part of the data. - or ENN NN is errno - - write mem MAA..AA,LLLL:XX..XX - AA..AA is address, - LLLL is number of bytes, - XX..XX is data - reply OK for success - ENN for an error (this includes the case - where only part of the data was - written). - - cont cAA..AA AA..AA is address to resume - If AA..AA is omitted, - resume at same address. - - step sAA..AA AA..AA is address to resume - If AA..AA is omitted, - resume at same address. - - last signal ? Reply the current reason for stopping. - This is the same reply as is generated - for step or cont : SAA where AA is the - signal number. - - There is no immediate reply to step or cont. - The reply comes when the machine stops. - It is SAA AA is the "signal number" - - or... TAAn...:r...;n:r...;n...:r...; - AA = signal number - n... = register number - r... = register contents - or... WAA The process exited, and AA is - the exit status. This is only - applicable for certains sorts of - targets. - kill request k - - toggle debug d toggle debug flag (see 386 & 68k stubs) - reset r reset -- see sparc stub. - reserved On other requests, the stub should - ignore the request and send an empty - response ($#). This way - we can extend the protocol and GDB - can tell whether the stub it is - talking to uses the old or the new. - search tAA:PP,MM Search backwards starting at address - AA for a match with pattern PP and - mask MM. PP and MM are 4 bytes. - Not supported by all stubs. - - general query qXXXX Request info about XXXX. - general set QXXXX=yyyy Set value of XXXX to yyyy. - query sect offs qOffsets Get section offsets. Reply is - Text=xxx;Data=yyy;Bss=zzz - console output Otext Send text to stdout. Only comes from - remote target. - - Responses can be run-length encoded to save space. A '*' means that - the next character is an ASCII encoding giving a repeat count which - stands for that many repititions of the character preceding the '*'. - The encoding is n+29, yielding a printable character where n >=3 - (which is where rle starts to win). Don't use an n > 126. - - So - "0* " means the same as "0000". */ - -#include "defs.h" -#include "gdb_string.h" -#include -#include "frame.h" -#include "inferior.h" -#include "bfd.h" -#include "symfile.h" -#include "target.h" -#include "wait.h" -#include "terminal.h" -#include "gdbcmd.h" -#include "objfiles.h" -#include "gdb-stabs.h" -#include "remote-utils.h" -#include "dcache.h" - -#ifdef USG -#include -#endif - -#include -#include "serial.h" - -/* Prototypes for local functions */ - -static int -remote_write_bytes PARAMS ((CORE_ADDR memaddr, char *myaddr, int len)); - -static int -remote_read_bytes PARAMS ((CORE_ADDR memaddr, char *myaddr, int len)); - -static void -remote_files_info PARAMS ((struct target_ops *ignore)); - -static int -remote_xfer_memory PARAMS ((CORE_ADDR memaddr, char *myaddr, int len, - int should_write, struct target_ops *target)); - -static void -remote_prepare_to_store PARAMS ((void)); - -static void -remote_fetch_registers PARAMS ((int regno)); - -static void -remote_resume PARAMS ((int pid, int step, enum target_signal siggnal)); - -static int -remote_start_remote PARAMS ((char *dummy)); - -static void -remote_open PARAMS ((char *name, int from_tty)); - -static void -remote_close PARAMS ((int quitting)); - -static void -remote_store_registers PARAMS ((int regno)); - -static void -getpkt PARAMS ((char *buf, int forever)); - -static void -putpkt PARAMS ((char *buf)); - -static void -remote_send PARAMS ((char *buf)); - -static int -readchar PARAMS ((int timeout)); - -static int -remote_wait PARAMS ((int pid, struct target_waitstatus *status)); - -static int -tohex PARAMS ((int nib)); - -static int -fromhex PARAMS ((int a)); - -static void -remote_detach PARAMS ((char *args, int from_tty)); - -static void -remote_interrupt PARAMS ((int signo)); - -static void -remote_interrupt_twice PARAMS ((int signo)); - -static void -interrupt_query PARAMS ((void)); - -static void -hppro_load PARAMS ((char *name, int from_tty)); - -extern struct target_ops remote_ops; /* Forward decl */ - -/* This was 5 seconds, which is a long time to sit and wait. - Unless this is going though some terminal server or multiplexer or - other form of hairy serial connection, I would think 2 seconds would - be plenty. */ -static int remote_timeout = 2; - -/* Descriptor for I/O to remote machine. Initialize it to NULL so that - remote_open knows that we don't have a file open when the program - starts. */ -extern serial_t remote_desc; - -/* Having this larger than 400 causes us to be incompatible with m68k-stub.c - and i386-stub.c. Normally, no one would notice because it only matters - for writing large chunks of memory (e.g. in downloads). Also, this needs - to be more than 400 if required to hold the registers (see below, where - we round it up based on REGISTER_BYTES). */ -#define PBUFSIZ 400 - -/* Maximum number of bytes to read/write at once. The value here - is chosen to fill up a packet (the headers account for the 32). */ -#define MAXBUFBYTES ((PBUFSIZ-32)/2) - -/* Round up PBUFSIZ to hold all the registers, at least. */ -/* The blank line after the #if seems to be required to work around a - bug in HP's PA compiler. */ -#if REGISTER_BYTES > MAXBUFBYTES - -#undef PBUFSIZ -#define PBUFSIZ (REGISTER_BYTES * 2 + 32) -#endif - -/* Should we try the 'P' request? If this is set to one when the stub - doesn't support 'P', the only consequence is some unnecessary traffic. */ -static int stub_supports_P = 1; - -/* sets the download protocol, choices are srec, generic, boot */ -char *loadtype; -static char *loadtype_str; -static void set_loadtype_command -PARAMS ((char *, int, struct cmd_list_element *)); - -static void -hppro_load (file, from_tty) - char *file; - int from_tty; -{ - puts ("Loading... HA!"); -} - - -/* Clean up connection to a remote debugger. */ - -/* ARGSUSED */ -static void -remote_close (quitting) - int quitting; -{ - if (remote_desc) - SERIAL_CLOSE (remote_desc); - remote_desc = NULL; -} - -/* Query the remote side for the text, data and bss offsets. */ - -static void -get_offsets () -{ - unsigned char buf[PBUFSIZ]; - int nvals; - CORE_ADDR text_addr, data_addr, bss_addr; - struct section_offsets *offs; - - putpkt ("qOffsets"); - - getpkt (buf, 0); - - if (buf[0] == '\000') - return; /* Return silently. Stub doesn't support this - command. */ - if (buf[0] == 'E') - { - warning ("Remote failure reply: %s", buf); - return; - } - - nvals = sscanf (buf, "Text=%lx;Data=%lx;Bss=%lx", &text_addr, &data_addr, - &bss_addr); - if (nvals != 3) - error ("Malformed response to offset query, %s", buf); - - if (symfile_objfile == NULL) - return; - - offs = (struct section_offsets *) alloca (sizeof (struct section_offsets) - + symfile_objfile->num_sections - * sizeof (offs->offsets)); - memcpy (offs, symfile_objfile->section_offsets, - sizeof (struct section_offsets) - + symfile_objfile->num_sections - * sizeof (offs->offsets)); - - /* FIXME: This code assumes gdb-stabs.h is being used; it's broken - for xcoff, dwarf, sdb-coff, etc. But there is no simple - canonical representation for this stuff. (Just what does "text" - as seen by the stub mean, anyway? I think it means all sections - with SEC_CODE set, but we currently have no way to deal with that). */ - - ANOFFSET (offs, SECT_OFF_TEXT) = text_addr; - - /* This is a temporary kludge to force data and bss to use the same offsets - because that's what nlmconv does now. The real solution requires changes - to the stub and remote.c that I don't have time to do right now. */ - - ANOFFSET (offs, SECT_OFF_DATA) = data_addr; - ANOFFSET (offs, SECT_OFF_BSS) = data_addr; - - objfile_relocate (symfile_objfile, offs); -} - -#define INBUFSIZE 10 - -void -boot_board() -{ - char c; - char buf[INBUFSIZE]; - char *ptr; - - /* See if we can connect to the boot ROM command line */ - ptr = buf; - while (1) { - SERIAL_WRITE (remote_desc, "\r\n", 2); - c = readchar (2); - if ((sr_get_debug() > 2) && (isascii(c))) - putchar (c); - if (c == SERIAL_TIMEOUT) { - if (sr_get_debug()) - puts_filtered ("Timed out.\n"); - break; - } - if (c == '&') { - if (sr_get_debug() > 2) - puts ("Got ACK from stub"); - break; - } - if (c == '>') { - if (sr_get_debug() > 2) - puts ("Got prompt from ROM monitor"); - break; - } - } - -} - -/* Stub for catch_errors. */ -static int -remote_start_remote (dummy) - char *dummy; -{ - int timeout; - - immediate_quit = 1; /* Allow user to interrupt it */ - - /* Ack any packet which the remote side has already sent. */ - - if (sr_get_debug()) - puts ("Trying a '+' to ACK the target."); - - SERIAL_WRITE (remote_desc, "+", 1); - -#if 0 - boot_board(); - - get_offsets (); /* Get text, data & bss offsets */ -#endif - - putpkt ("?"); /* initiate a query from remote machine */ - immediate_quit = 0; - - start_remote (); /* Initialize gdb process mechanisms */ - - return 1; -} - -/* Open a connection to a remote debugger. - NAME is the filename used for communication. */ - -static DCACHE *remote_dcache; - -static void -remote_open (name, from_tty) - char *name; - int from_tty; -{ - if (name == 0) - error ( -"To open a remote debug connection, you need to specify what serial\n\ -device is attached to the remote system (e.g. /dev/ttya)."); - - target_preopen (from_tty); - - unpush_target (&remote_ops); - - remote_dcache = dcache_init (remote_read_bytes, remote_write_bytes); - - remote_desc = SERIAL_OPEN (name); - if (!remote_desc) - perror_with_name (name); - - if (baud_rate != -1) - { - if (SERIAL_SETBAUDRATE (remote_desc, baud_rate)) - { - SERIAL_CLOSE (remote_desc); - perror_with_name (name); - } - } - - SERIAL_RAW (remote_desc); - - /* If there is something sitting in the buffer we might take it as a - response to a command, which would be bad. */ - SERIAL_FLUSH_INPUT (remote_desc); - - if (from_tty) - { - puts_filtered ("Remote debugging using "); - puts_filtered (name); - puts_filtered ("\n"); - } - push_target (&remote_ops); /* Switch to using remote target now */ - - /* Start out by trying the 'P' request to set registers. We set this each - time that we open a new target so that if the user switches from one - stub to another, we can (if the target is closed and reopened) cope. */ - stub_supports_P = 1; - - /* Without this, some commands which require an active target (such as kill) - won't work. This variable serves (at least) double duty as both the pid - of the target process (if it has such), and as a flag indicating that a - target is active. These functions should be split out into seperate - variables, especially since GDB will someday have a notion of debugging - several processes. */ - - inferior_pid = 42000; - - /* Start the remote connection; if error (0), discard this target. - In particular, if the user quits, be sure to discard it - (we'd be in an inconsistent state otherwise). */ - if (!catch_errors (remote_start_remote, (char *)0, - "Couldn't establish connection to remote target\n", RETURN_MASK_ALL)) - pop_target(); -} - -/* remote_detach() - takes a program previously attached to and detaches it. - We better not have left any breakpoints - in the program or it'll die when it hits one. - Close the open connection to the remote debugger. - Use this when you want to detach and do something else - with your gdb. */ - -static void -remote_detach (args, from_tty) - char *args; - int from_tty; -{ - if (args) - error ("Argument given to \"detach\" when remotely debugging."); - - pop_target (); - if (from_tty) - puts_filtered ("Ending remote debugging.\n"); -} - -/* Convert hex digit A to a number. */ - -static int -fromhex (a) - int a; -{ - if (a >= '0' && a <= '9') - return a - '0'; - else if (a >= 'a' && a <= 'f') - return a - 'a' + 10; - else - error ("Reply contains invalid hex digit"); -} - -/* Convert number NIB to a hex digit. */ - -static int -tohex (nib) - int nib; -{ - if (nib < 10) - return '0'+nib; - else - return 'a'+nib-10; -} - -/* Tell the remote machine to resume. */ - -static void -remote_resume (pid, step, siggnal) - int pid, step; - enum target_signal siggnal; -{ - char buf[PBUFSIZ]; - - if (siggnal) - { - target_terminal_ours_for_output (); - printf_filtered - ("Can't send signals to a remote system. %s not sent.\n", - target_signal_to_name (siggnal)); target_terminal_inferior (); - } - - dcache_flush (remote_dcache); - - strcpy (buf, step ? "s": "c"); - - putpkt (buf); -} - -/* Send ^C to target to halt it. Target will respond, and send us a - packet. */ - -static void -remote_interrupt (signo) - int signo; -{ - /* If this doesn't work, try more severe steps. */ - signal (signo, remote_interrupt_twice); - - if (remote_debug) - printf_unfiltered ("remote_interrupt called\n"); - - SERIAL_WRITE (remote_desc, "\003", 1); /* Send a ^C */ -} - -static void (*ofunc)(); - -/* The user typed ^C twice. */ -static void -remote_interrupt_twice (signo) - int signo; -{ - signal (signo, ofunc); - - interrupt_query (); - - signal (signo, remote_interrupt); -} - -/* Ask the user what to do when an interrupt is received. */ - -static void -interrupt_query () -{ - target_terminal_ours (); - - if (query ("Interrupted while waiting for the program.\n\ -Give up (and stop debugging it)? ")) - { - target_mourn_inferior (); - return_to_top_level (RETURN_QUIT); - } - - target_terminal_inferior (); -} - -/* Wait until the remote machine stops, then return, - storing status in STATUS just as `wait' would. - Returns "pid" (though it's not clear what, if anything, that - means in the case of this target). */ - -static int -remote_wait (pid, status) - int pid; - struct target_waitstatus *status; -{ - unsigned char buf[PBUFSIZ]; - - status->kind = TARGET_WAITKIND_EXITED; - status->value.integer = 0; - - while (1) - { - unsigned char *p; - - ofunc = (void (*)()) signal (SIGINT, remote_interrupt); - getpkt ((char *) buf, 1); - signal (SIGINT, ofunc); - - switch (buf[0]) - { - case 'E': /* Error of some sort */ - warning ("Remote failure reply: %s", buf); - continue; - case 'T': /* Status with PC, SP, FP, ... */ - { - int i; - long regno; - char regs[MAX_REGISTER_RAW_SIZE]; - - /* Expedited reply, containing Signal, {regno, reg} repeat */ - /* format is: 'Tssn...:r...;n...:r...;n...:r...;#cc', where - ss = signal number - n... = register number - r... = register contents - */ - - p = &buf[3]; /* after Txx */ - - while (*p) - { - unsigned char *p1; - - regno = strtol (p, (char **) &p1, 16); /* Read the register number */ - - if (p1 == p) - warning ("Remote sent badly formed register number: %s\nPacket: '%s'\n", - p1, buf); - - p = p1; - - if (*p++ != ':') - warning ("Malformed packet (missing colon): %s\nPacket: '%s'\n", - p, buf); - - if (regno >= NUM_REGS) - warning ("Remote sent bad register number %d: %s\nPacket: '%s'\n", - regno, p, buf); - - for (i = 0; i < REGISTER_RAW_SIZE (regno); i++) - { - if (p[0] == 0 || p[1] == 0) - warning ("Remote reply is too short: %s", buf); - regs[i] = fromhex (p[0]) * 16 + fromhex (p[1]); - p += 2; - } - - if (*p++ != ';') - warning ("Remote register badly formatted: %s", buf); - - supply_register (regno, regs); - } - } - /* fall through */ - case 'S': /* Old style status, just signal only */ - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = (enum target_signal) - (((fromhex (buf[1])) << 4) + (fromhex (buf[2]))); - - return inferior_pid; - case 'W': /* Target exited */ - { - /* The remote process exited. */ - status->kind = TARGET_WAITKIND_EXITED; - status->value.integer = (fromhex (buf[1]) << 4) + fromhex (buf[2]); - return inferior_pid; - } - case 'O': /* Console output */ - fputs_filtered (buf + 1, gdb_stdout); - continue; - default: - warning ("Invalid remote reply: %s", buf); - continue; - } - } - return inferior_pid; -} - -/* Number of bytes of registers this stub implements. */ -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 regno. */ -/* ARGSUSED */ -static void -remote_fetch_registers (regno) - int regno; -{ - char buf[PBUFSIZ]; - int i; - char *p; - char regs[REGISTER_BYTES]; - - sprintf (buf, "g"); - remote_send (buf); - - /* Unimplemented registers read as all bits zero. */ - memset (regs, 0, REGISTER_BYTES); - - /* We can get out of synch in various cases. If the first character - in the buffer is not a hex character, assume that has happened - and try to fetch another packet to read. */ - while ((buf[0] < '0' || buf[0] > '9') - && (buf[0] < 'a' || buf[0] > 'f')) - { - if (remote_debug) - printf_unfiltered ("Bad register packet; fetching a new packet\n"); - getpkt (buf, 0); - } - - /* Reply describes registers byte by byte, each byte encoded as two - hex characters. Suck them all up, then supply them to the - register cacheing/storage mechanism. */ - - p = buf; - for (i = 0; i < REGISTER_BYTES; i++) - { - if (p[0] == 0) - break; - if (p[1] == 0) - { - warning ("Remote reply is of odd length: %s", buf); - /* Don't change register_bytes_found in this case, and don't - print a second warning. */ - goto supply_them; - } - regs[i] = fromhex (p[0]) * 16 + fromhex (p[1]); - p += 2; - } - - if (i != register_bytes_found) - { - register_bytes_found = i; -#ifdef REGISTER_BYTES_OK - if (!REGISTER_BYTES_OK (i)) - warning ("Remote reply is too short: %s", buf); -#endif - } - - supply_them: - for (i = 0; i < NUM_REGS; i++) - supply_register (i, ®s[REGISTER_BYTE(i)]); -} - -/* Prepare to store registers. Since we may send them all (using a - 'G' request), we have to read out the ones we don't want to change - first. */ - -static void -remote_prepare_to_store () -{ - /* Make sure the entire registers array is valid. */ - read_register_bytes (0, (char *)NULL, REGISTER_BYTES); -} - -/* Store register REGNO, or all registers if REGNO == -1, from the contents - of REGISTERS. FIXME: ignores errors. */ - -static void -remote_store_registers (regno) - int regno; -{ - char buf[PBUFSIZ]; - int i; - char *p; - - if (regno >= 0 && stub_supports_P) - { - /* Try storing a single register. */ - char *regp; - - sprintf (buf, "P%x=", regno); - p = buf + strlen (buf); - regp = ®isters[REGISTER_BYTE (regno)]; - for (i = 0; i < REGISTER_RAW_SIZE (regno); ++i) - { - *p++ = tohex ((regp[i] >> 4) & 0xf); - *p++ = tohex (regp[i] & 0xf); - } - *p = '\0'; - remote_send (buf); - if (buf[0] != '\0') - { - /* The stub understands the 'P' request. We are done. */ - return; - } - - /* The stub does not support the 'P' request. Use 'G' instead, - and don't try using 'P' in the future (it will just waste our - time). */ - stub_supports_P = 0; - } - - buf[0] = 'G'; - - /* Command describes registers byte by byte, - each byte encoded as two hex characters. */ - - p = buf + 1; - /* remote_prepare_to_store insures that register_bytes_found gets set. */ - for (i = 0; i < register_bytes_found; i++) - { - *p++ = tohex ((registers[i] >> 4) & 0xf); - *p++ = tohex (registers[i] & 0xf); - } - *p = '\0'; - - remote_send (buf); -} - -#if 0 - -/* Use of the data cache is disabled because it loses for looking at - and changing hardware I/O ports and the like. Accepting `volatile' - would perhaps be one way to fix it. Another idea would be to use the - executable file for the text segment (for all SEC_CODE sections? - For all SEC_READONLY sections?). This has problems if you want to - actually see what the memory contains (e.g. self-modifying code, - clobbered memory, user downloaded the wrong thing). */ - -/* Read a word from remote address ADDR and return it. - This goes through the data cache. */ - -static int -remote_fetch_word (addr) - CORE_ADDR addr; -{ - return dcache_fetch (remote_dcache, addr); -} - -/* Write a word WORD into remote address ADDR. - This goes through the data cache. */ - -static void -remote_store_word (addr, word) - CORE_ADDR addr; - int word; -{ - dcache_poke (remote_dcache, addr, word); -} -#endif /* 0 */ - -/* Write memory data directly to the remote machine. - This does not inform the data cache; the data cache uses this. - MEMADDR is the address in the remote memory space. - MYADDR is the address of the buffer in our space. - LEN is the number of bytes. - - Returns number of bytes transferred, or 0 for error. */ - -static int -remote_write_bytes (memaddr, myaddr, len) - CORE_ADDR memaddr; - char *myaddr; - int len; -{ - char buf[PBUFSIZ]; - int i; - char *p; - - /* FIXME-32x64: Need a version of print_address_numeric which puts the - result in a buffer like sprintf. */ - sprintf (buf, "M%lx,%x:", (unsigned long) memaddr, len); - - /* We send target system values byte by byte, in increasing byte addresses, - each byte encoded as two hex characters. */ - - p = buf + strlen (buf); - for (i = 0; i < len; i++) - { - *p++ = tohex ((myaddr[i] >> 4) & 0xf); - *p++ = tohex (myaddr[i] & 0xf); - } - *p = '\0'; - - putpkt (buf); - getpkt (buf, 0); - - if (buf[0] == 'E') - { - /* There is no correspondance between what the remote protocol uses - for errors and errno codes. We would like a cleaner way of - representing errors (big enough to include errno codes, bfd_error - codes, and others). But for now just return EIO. */ - errno = EIO; - return 0; - } - return len; -} - -/* Read memory data directly from the remote machine. - This does not use the data cache; the data cache uses this. - MEMADDR is the address in the remote memory space. - MYADDR is the address of the buffer in our space. - LEN is the number of bytes. - - Returns number of bytes transferred, or 0 for error. */ - -static int -remote_read_bytes (memaddr, myaddr, len) - CORE_ADDR memaddr; - char *myaddr; - int len; -{ - char buf[PBUFSIZ]; - int i; - char *p; - - if (len > PBUFSIZ / 2 - 1) - abort (); - - /* FIXME-32x64: Need a version of print_address_numeric which puts the - result in a buffer like sprintf. */ - sprintf (buf, "m%lx,%x", (unsigned long) memaddr, len); - putpkt (buf); - getpkt (buf, 0); - - if (buf[0] == 'E') - { - /* There is no correspondance between what the remote protocol uses - for errors and errno codes. We would like a cleaner way of - representing errors (big enough to include errno codes, bfd_error - codes, and others). But for now just return EIO. */ - errno = EIO; - return 0; - } - - /* Reply describes memory byte by byte, - each byte encoded as two hex characters. */ - - p = buf; - for (i = 0; i < len; i++) - { - if (p[0] == 0 || p[1] == 0) - /* Reply is short. This means that we were able to read only part - of what we wanted to. */ - break; - myaddr[i] = fromhex (p[0]) * 16 + fromhex (p[1]); - p += 2; - } - return i; -} - -/* Read or write LEN bytes from inferior memory at MEMADDR, transferring - to or from debugger address MYADDR. Write to inferior if SHOULD_WRITE is - nonzero. Returns length of data written or read; 0 for error. */ - -/* ARGSUSED */ -static int -remote_xfer_memory(memaddr, myaddr, len, should_write, target) - CORE_ADDR memaddr; - char *myaddr; - int len; - int should_write; - struct target_ops *target; /* ignored */ -{ - int xfersize; - int bytes_xferred; - int total_xferred = 0; - - while (len > 0) - { - if (len > MAXBUFBYTES) - xfersize = MAXBUFBYTES; - else - xfersize = len; - - if (should_write) - bytes_xferred = remote_write_bytes (memaddr, myaddr, xfersize); - else - bytes_xferred = remote_read_bytes (memaddr, myaddr, xfersize); - - /* If we get an error, we are done xferring. */ - if (bytes_xferred == 0) - break; - - memaddr += bytes_xferred; - myaddr += bytes_xferred; - len -= bytes_xferred; - total_xferred += bytes_xferred; - } - return total_xferred; -} - -#if 0 -/* Enable after 4.12. */ - -void -remote_search (len, data, mask, startaddr, increment, lorange, hirange - addr_found, data_found) - int len; - char *data; - char *mask; - CORE_ADDR startaddr; - int increment; - CORE_ADDR lorange; - CORE_ADDR hirange; - CORE_ADDR *addr_found; - char *data_found; -{ - if (increment == -4 && len == 4) - { - long mask_long, data_long; - long data_found_long; - CORE_ADDR addr_we_found; - char buf[PBUFSIZ]; - long returned_long[2]; - char *p; - - mask_long = extract_unsigned_integer (mask, len); - data_long = extract_unsigned_integer (data, len); - sprintf (buf, "t%x:%x,%x", startaddr, data_long, mask_long); - putpkt (buf); - getpkt (buf, 0); - if (buf[0] == '\0') - { - /* The stub doesn't support the 't' request. We might want to - remember this fact, but on the other hand the stub could be - switched on us. Maybe we should remember it only until - the next "target remote". */ - generic_search (len, data, mask, startaddr, increment, lorange, - hirange, addr_found, data_found); - return; - } - - if (buf[0] == 'E') - /* There is no correspondance between what the remote protocol uses - for errors and errno codes. We would like a cleaner way of - representing errors (big enough to include errno codes, bfd_error - codes, and others). But for now just use EIO. */ - memory_error (EIO, startaddr); - p = buf; - addr_we_found = 0; - while (*p != '\0' && *p != ',') - addr_we_found = (addr_we_found << 4) + fromhex (*p++); - if (*p == '\0') - error ("Protocol error: short return for search"); - - data_found_long = 0; - while (*p != '\0' && *p != ',') - data_found_long = (data_found_long << 4) + fromhex (*p++); - /* Ignore anything after this comma, for future extensions. */ - - if (addr_we_found < lorange || addr_we_found >= hirange) - { - *addr_found = 0; - return; - } - - *addr_found = addr_we_found; - *data_found = store_unsigned_integer (data_we_found, len); - return; - } - generic_search (len, data, mask, startaddr, increment, lorange, - hirange, addr_found, data_found); -} -#endif /* 0 */ - -static void -remote_files_info (ignore) - struct target_ops *ignore; -{ - puts_filtered ("Debugging a target over a serial line.\n"); -} - -/* Stuff for dealing with the packets which are part of this protocol. - See comment at top of file for details. */ - -/* Read a single character from the remote end, masking it down to 7 bits. */ - -static int -readchar (timeout) - int timeout; -{ - int ch; - - ch = SERIAL_READCHAR (remote_desc, timeout); - - switch (ch) - { - case SERIAL_EOF: - error ("Remote connection closed"); - case SERIAL_ERROR: - perror_with_name ("Remote communication error"); - case SERIAL_TIMEOUT: - return ch; - default: - return ch & 0x7f; - } -} - -/* Send the command in BUF to the remote machine, - and read the reply into BUF. - Report an error if we get an error reply. */ - -static void -remote_send (buf) - char *buf; -{ - - putpkt (buf); - getpkt (buf, 0); - - if (buf[0] == 'E') - error ("Remote failure reply: %s", buf); -} - -/* Send a packet to the remote machine, with error checking. - The data of the packet is in BUF. */ -static void -putpkt (buf) - char *buf; -{ - int i; - unsigned char csum = 0; - char buf2[PBUFSIZ]; - int cnt = strlen (buf); - int ch; - char *p; - - /* Copy the packet into buffer BUF2, encapsulating it - and giving it a checksum. */ - - if (cnt > sizeof(buf2) - 5) /* Prosanity check */ - abort(); - - p = buf2; - *p++ = '$'; - - for (i = 0; i < cnt; i++) - { - csum += buf[i]; - *p++ = buf[i]; - } - *p++ = '#'; - *p++ = tohex ((csum >> 4) & 0xf); - *p++ = tohex (csum & 0xf); - - /* Send it over and over until we get a positive ack. */ - - while (1) - { - int started_error_output = 0; - - if (remote_debug) - { - *p = '\0'; - printf_unfiltered ("Sending packet: %s...", buf2); - gdb_flush(gdb_stdout); - } - if (SERIAL_WRITE (remote_desc, buf2, p - buf2)) - perror_with_name ("putpkt: write failed"); - - /* read until either a timeout occurs (-2) or '+' is read */ - while (1) - { - ch = readchar (remote_timeout); - - if (remote_debug) - { - switch (ch) - { - case '+': - case SERIAL_TIMEOUT: - case '$': - if (started_error_output) - { - putchar_unfiltered ('\n'); - started_error_output = 0; - } - } - } - - switch (ch) - { - case '+': - if (remote_debug) - printf_unfiltered("Got Ack\n"); - return; - case SERIAL_TIMEOUT: - break; /* Retransmit buffer */ - case '$': - { - unsigned char junkbuf[PBUFSIZ]; - - /* It's probably an old response, and we're out of sync. Just - gobble up the packet and ignore it. */ - getpkt (junkbuf, 0); - continue; /* Now, go look for + */ - } - default: - if (remote_debug) - { - if (!started_error_output) - { - started_error_output = 1; - printf_unfiltered ("putpkt: Junk: "); - } - putchar_unfiltered (ch & 0177); - } - continue; - } - break; /* Here to retransmit */ - } - -#if 0 - /* This is wrong. If doing a long backtrace, the user should be - able to get out next time we call QUIT, without anything as violent - as interrupt_query. If we want to provide a way out of here - without getting to the next QUIT, it should be based on hitting - ^C twice as in remote_wait. */ - if (quit_flag) - { - quit_flag = 0; - interrupt_query (); - } -#endif - } -} - -/* Come here after finding the start of the frame. Collect the rest into BUF, - verifying the checksum, length, and handling run-length compression. - Returns 0 on any error, 1 on success. */ - -static int -read_frame (buf) - char *buf; -{ - unsigned char csum; - char *bp; - int c; - - csum = 0; - bp = buf; - - while (1) - { - c = readchar (remote_timeout); - - switch (c) - { - case SERIAL_TIMEOUT: - if (remote_debug) - puts_filtered ("Timeout in mid-packet, retrying\n"); - return 0; - case '$': - if (remote_debug) - puts_filtered ("Saw new packet start in middle of old one\n"); - return 0; /* Start a new packet, count retries */ - case '#': - { - unsigned char pktcsum; - - *bp = '\000'; - - pktcsum = fromhex (readchar (remote_timeout)) << 4; - pktcsum |= fromhex (readchar (remote_timeout)); - - if (csum == pktcsum) - return 1; - - printf_filtered ("Bad checksum, sentsum=0x%x, csum=0x%x, buf=", - pktcsum, csum); - puts_filtered (buf); - puts_filtered ("\n"); - - return 0; - } - case '*': /* Run length encoding */ - csum += c; - c = readchar (remote_timeout); - csum += c; - c = c - ' ' + 3; /* Compute repeat count */ - - if (bp + c - 1 < buf + PBUFSIZ - 1) - { - memset (bp, *(bp - 1), c); - bp += c; - continue; - } - - *bp = '\0'; - printf_filtered ("Repeat count %d too large for buffer: ", c); - puts_filtered (buf); - puts_filtered ("\n"); - return 0; - - default: - if (bp < buf + PBUFSIZ - 1) - { - *bp++ = c; - csum += c; - continue; - } - - *bp = '\0'; - puts_filtered ("Remote packet too long: "); - puts_filtered (buf); - puts_filtered ("\n"); - - return 0; - } - } -} - -/* Read a packet from the remote machine, with error checking, - and store it in BUF. BUF is expected to be of size PBUFSIZ. - If FOREVER, wait forever rather than timing out; this is used - while the target is executing user code. */ - -static void -getpkt (buf, forever) - char *buf; - int forever; -{ - char *bp; - int c; - int tries; - int timeout; - int val; - - if (forever) - timeout = -1; - else - timeout = remote_timeout; - -#define MAX_TRIES 10 - - for (tries = 1; tries <= MAX_TRIES; tries++) - { - /* This can loop forever if the remote side sends us characters - continuously, but if it pauses, we'll get a zero from readchar - because of timeout. Then we'll count that as a retry. */ - - /* Note that we will only wait forever prior to the start of a packet. - After that, we expect characters to arrive at a brisk pace. They - should show up within remote_timeout intervals. */ - - do - { - c = readchar (timeout); - - if (c == SERIAL_TIMEOUT) - { - if (remote_debug) - puts_filtered ("Timed out.\n"); - goto retry; - } - } - while (c != '$'); - - /* We've found the start of a packet, now collect the data. */ - - val = read_frame (buf); - - if (val == 1) - { - if (remote_debug) - fprintf_unfiltered (gdb_stderr, "Packet received: %s\n", buf); - SERIAL_WRITE (remote_desc, "+", 1); - return; - } - - /* Try the whole thing again. */ -retry: - SERIAL_WRITE (remote_desc, "-", 1); - } - - /* We have tried hard enough, and just can't receive the packet. Give up. */ - - printf_unfiltered ("Ignoring packet error, continuing...\n"); - SERIAL_WRITE (remote_desc, "+", 1); -} - -static void -remote_kill () -{ - putpkt ("k"); - /* Don't wait for it to die. I'm not really sure it matters whether - we do or not. For the existing stubs, kill is a noop. */ - target_mourn_inferior (); -} - -static void -remote_mourn () -{ - unpush_target (&remote_ops); - generic_mourn_inferior (); -} - -#ifdef REMOTE_BREAKPOINT - -/* On some machines, e.g. 68k, we may use a different breakpoint instruction - than other targets. */ -static unsigned char break_insn[] = REMOTE_BREAKPOINT; - -#else /* No REMOTE_BREAKPOINT. */ - -/* Same old breakpoint instruction. This code does nothing different - than mem-break.c. */ -static unsigned char break_insn[] = BREAKPOINT; - -#endif /* No REMOTE_BREAKPOINT. */ - -/* Insert a breakpoint on targets that don't have any better breakpoint - support. We read the contents of the target location and stash it, - then overwrite it with a breakpoint instruction. ADDR is the target - location in the target machine. CONTENTS_CACHE is a pointer to - memory allocated for saving the target contents. It is guaranteed - by the caller to be long enough to save sizeof BREAKPOINT bytes (this - is accomplished via BREAKPOINT_MAX). */ - -static int -remote_insert_breakpoint (addr, contents_cache) - CORE_ADDR addr; - char *contents_cache; -{ - int val; - - val = target_read_memory (addr, contents_cache, sizeof break_insn); - - if (val == 0) - val = target_write_memory (addr, (char *)break_insn, sizeof break_insn); - - return val; -} - -static int -remote_remove_breakpoint (addr, contents_cache) - CORE_ADDR addr; - char *contents_cache; -{ - return target_write_memory (addr, contents_cache, sizeof break_insn); -} - -/* Define the target subroutine names */ - -struct target_ops remote_hppro_ops = { - "hppro", /* to_shortname */ - "Remote serial target for HP-PRO targets", /* to_longname */ - "Use a remote computer via a serial line, using a gdb-specific protocol.\n\ -This is for targets that supports the HP-PRO standard.\n\ -Specify the serial device it is connected to (e.g. /dev/ttya) or telnet port.", /* to_doc */ - remote_open, /* to_open */ - remote_close, /* to_close */ - NULL, /* to_attach */ - remote_detach, /* to_detach */ - remote_resume, /* to_resume */ - remote_wait, /* to_wait */ - remote_fetch_registers, /* to_fetch_registers */ - remote_store_registers, /* to_store_registers */ - remote_prepare_to_store, /* to_prepare_to_store */ - remote_xfer_memory, /* to_xfer_memory */ - remote_files_info, /* to_files_info */ - - remote_insert_breakpoint, /* to_insert_breakpoint */ - remote_remove_breakpoint, /* to_remove_breakpoint */ - - NULL, /* to_terminal_init */ - NULL, /* to_terminal_inferior */ - NULL, /* to_terminal_ours_for_output */ - NULL, /* to_terminal_ours */ - NULL, /* to_terminal_info */ - remote_kill, /* to_kill */ - hppro_load, /* to_load */ - NULL, /* to_lookup_symbol */ - NULL, /* to_create_inferior */ - remote_mourn, /* to_mourn_inferior */ - 0, /* to_can_run */ - 0, /* to_notice_signals */ - 0, /* to_thread_alive */ - 0, /* to_stop */ - process_stratum, /* to_stratum */ - NULL, /* to_next */ - 1, /* to_has_all_memory */ - 1, /* to_has_memory */ - 1, /* to_has_stack */ - 1, /* to_has_registers */ - 1, /* to_has_execution */ - NULL, /* sections */ - NULL, /* sections_end */ - OPS_MAGIC /* to_magic */ -}; - -void -_initialize_remote_hppro () -{ - struct cmd_list_element *c; - add_target (&remote_hppro_ops); - - /* this sets the type of download protocol */ - c = add_set_cmd ("loadtype", no_class, var_string, (char *)&loadtype_str, - "Set the type of the remote load protocol.\n", &setlist); - c->function.sfunc = set_loadtype_command; - add_show_from_set (c, &showlist); - loadtype_str = savestring ("generic", 8); - - /* this adds a command to boot the board */ - add_com ("boot", class_support, boot_board, - "Boot the damn target board.\n"); -} - -static void -set_loadtype_command (ignore, from_tty, c) - char *ignore; - int from_tty; - struct cmd_list_element *c; -{ - loadtype_str = savestring (*(char **) c->var, strlen (*(char **) c->var)); -} - diff --git a/contrib/gdb/gdb/remote-rdp.c b/contrib/gdb/gdb/remote-rdp.c deleted file mode 100644 index 3cc4c4e..0000000 --- a/contrib/gdb/gdb/remote-rdp.c +++ /dev/null @@ -1,1247 +0,0 @@ -/* Remote debugging for the ARM RDP interface. - Copyright 1994, 1995 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - - */ - - -/* - Much of this file (in particular the SWI stuff) is based on code by - David Taylor (djt1000@uk.ac.cam.hermes). - - I hacked on and simplified it by removing a lot of sexy features he - had added, and some of the (unix specific) workarounds he'd done - for other GDB problems - which if they still exist should be fixed - in GDB, not in a remote-foo thing . I also made it conform more to - the doc I have; which may be wrong. - - Steve Chamberlain (sac@cygnus.com). - */ - - -#include "defs.h" -#include "inferior.h" -#include "wait.h" -#include "value.h" -#include "callback.h" -#include "command.h" -#ifdef ANSI_PROTOTYPES -#include -#else -#include -#endif -#include -#include -#include "symfile.h" -#include "remote-utils.h" -#include "gdb_string.h" -#ifdef HAVE_UNISTD_H -#include -#endif - - -extern struct target_ops remote_rdp_ops; -static serial_t io; -static host_callback *callback = &default_callback; - -struct - { - int step_info; - int break_info; - int model_info; - int target_info; - int can_step; - char command_line[10]; - int rdi_level; - int rdi_stopped_status; - } -ds; - - - -/* Definitions for the RDP protocol. */ - -#define RDP_MOUTHFULL (1<<6) -#define FPU_COPRO_NUMBER 1 - -#define RDP_OPEN 0 -#define RDP_OPEN_TYPE_COLD 0 -#define RDP_OPEN_TYPE_WARM 1 -#define RDP_OPEN_TYPE_BAUDRATE 2 - -#define RDP_OPEN_BAUDRATE_9600 1 -#define RDP_OPEN_BAUDRATE_19200 2 -#define RDP_OPEN_BAUDRATE_38400 3 - -#define RDP_OPEN_TYPE_RETURN_SEX (1<<3) - -#define RDP_CLOSE 1 - -#define RDP_MEM_READ 2 - -#define RDP_MEM_WRITE 3 - -#define RDP_CPU_READ 4 -#define RDP_CPU_WRITE 5 -#define RDP_CPU_READWRITE_MODE_CURRENT 255 -#define RDP_CPU_READWRITE_MASK_PC (1<<16) -#define RDP_CPU_READWRITE_MASK_CPSR (1<<17) -#define RDP_CPU_READWRITE_MASK_SPSR (1<<18) - -#define RDP_COPRO_READ 6 -#define RDP_COPRO_WRITE 7 -#define RDP_FPU_READWRITE_MASK_FPS (1<<8) - -#define RDP_SET_BREAK 0xa -#define RDP_SET_BREAK_TYPE_PC_EQUAL 0 -#define RDP_SET_BREAK_TYPE_GET_HANDLE (0x10) - -#define RDP_CLEAR_BREAK 0xb - -#define RDP_EXEC 0x10 -#define RDP_EXEC_TYPE_SYNC 0 - -#define RDP_STEP 0x11 - -#define RDP_INFO 0x12 -#define RDP_INFO_ABOUT_STEP 2 -#define RDP_INFO_ABOUT_STEP_GT_1 1 -#define RDP_INFO_ABOUT_STEP_TO_JMP 2 -#define RDP_INFO_ABOUT_STEP_1 4 -#define RDP_INFO_ABOUT_TARGET 0 -#define RDP_INFO_ABOUT_BREAK 1 -#define RDP_INFO_ABOUT_BREAK_COMP 1 -#define RDP_INFO_ABOUT_BREAK_RANGE 2 -#define RDP_INFO_ABOUT_BREAK_BYTE_READ 4 -#define RDP_INFO_ABOUT_BREAK_HALFWORD_READ 8 -#define RDP_INFO_ABOUT_BREAK_WORD_READ (1<<4) -#define RDP_INFO_ABOUT_BREAK_BYTE_WRITE (1<<5) -#define RDP_INFO_ABOUT_BREAK_HALFWORD_WRITE (1<<6) -#define RDP_INFO_ABOUT_BREAK_WORD_WRITE (1<<7) -#define RDP_INFO_ABOUT_BREAK_MASK (1<<8) -#define RDP_INFO_ABOUT_BREAK_THREAD_BREAK (1<<9) -#define RDP_INFO_ABOUT_BREAK_THREAD_WATCH (1<<10) -#define RDP_INFO_ABOUT_BREAK_COND (1<<11) - -#define RDP_RESET 0x7f - -/* Returns from RDP */ -#define RDP_RES_STOPPED 0x20 -#define RDP_RES_SWI 0x21 -#define RDP_RES_FATAL 0x5e -#define RDP_RES_VALUE 0x5f -#define RDP_RES_VALUE_LITTLE_ENDIAN 240 -#define RDP_RES_VALUE_BIG_ENDIAN 241 -#define RDP_RES_RESET 0x7f -#define RDP_RES_AT_BREAKPOINT 143 -#define RDP_RES_IDUNNO 0xe6 -#define RDP_OSOpReply 0x13 -#define RDP_OSOpWord 2 -#define RDP_OSOpNothing 0 - -static int timeout = 2; - -static int -remote_rdp_xfer_inferior_memory PARAMS ((CORE_ADDR memaddr, - char *myaddr, - int len, - int write, - struct target_ops * target)); - - -/* Stuff for talking to the serial layer. */ - -static unsigned char -get_byte () -{ - int c = SERIAL_READCHAR (io, timeout); - - if (remote_debug) - printf ("[%02x]\n", c); - - if (c == SERIAL_TIMEOUT) - { - if (timeout == 0) - return (unsigned char) c; - - error ("Timeout reading from remote_system"); - } - - return c; -} - -/* Note that the target always speaks little-endian to us, - even if it's a big endian machine. */ -static unsigned int -get_word () -{ - unsigned int val = 0; - unsigned int c; - int n; - for (n = 0; n < 4; n++) - { - c = get_byte (); - val |= c << (n * 8); - } - return val; -} - -static void -put_byte (val) - char val; -{ - if (remote_debug) - printf ("(%02x)\n", val); - SERIAL_WRITE (io, &val, 1); -} - -static void -put_word (val) - int val; -{ - /* We always send in little endian */ - unsigned char b[4]; - b[0] = val; - b[1] = val >> 8; - b[2] = val >> 16; - b[3] = val >> 24; - - if (remote_debug) - printf ("(%04x)", val); - - SERIAL_WRITE (io, b, 4); -} - - - -/* Stuff for talking to the RDP layer. */ - -/* This is a bit more fancy that need be so that it syncs even in nasty cases. - - I'be been unable to make it reliably sync up with the change - baudrate open command. It likes to sit and say it's been reset, - with no more action. So I took all that code out. I'd rather sync - reliably at 9600 than wait forever for a possible 19200 connection. - - */ -static void -rdp_init (cold, tty) - int cold; - int tty; -{ - int sync = 0; - int type = cold ? RDP_OPEN_TYPE_COLD : RDP_OPEN_TYPE_WARM; - int baudtry = 9600; - - time_t now = time (0); - time_t stop_time = now + 10; /* Try and sync for 10 seconds, then give up */ - - - while (time (0) < stop_time && !sync) - { - int restype; - QUIT; - - SERIAL_FLUSH_INPUT (io); - SERIAL_FLUSH_OUTPUT (io); - - if (tty) - printf_unfiltered ("Trying to connect at %d baud.\n", baudtry); - put_byte (RDP_OPEN); - - put_byte (type | RDP_OPEN_TYPE_RETURN_SEX); - put_word (0); - - while (!sync && (restype = SERIAL_READCHAR (io, 1)) > 0) - { - if (remote_debug) - printf_unfiltered ("[%02x]\n", restype); - - switch (restype) - { - case SERIAL_TIMEOUT: - break; - case RDP_RESET: - while ((restype = SERIAL_READCHAR (io, 1)) == RDP_RESET) - ; - while ((restype = SERIAL_READCHAR (io, 1)) > 0) - { - printf_unfiltered ("%c", isgraph (restype) ? restype : ' '); - } - while ((restype = SERIAL_READCHAR (io, 1)) > 0) - ; - if (tty) - { - printf_unfiltered ("\nThe board has sent notification that it was reset.\n"); - printf_unfiltered ("Waiting for it to settle down...\n"); - } - sleep (3); - if (tty) - printf_unfiltered ("\nTrying again.\n"); - break; - default: - break; - case RDP_RES_VALUE: - { - int resval = SERIAL_READCHAR (io, 1); - switch (resval) - { - case SERIAL_TIMEOUT: - break; - case RDP_RES_VALUE_LITTLE_ENDIAN: - target_byte_order = LITTLE_ENDIAN; - sync = 1; - break; - case RDP_RES_VALUE_BIG_ENDIAN: - target_byte_order = BIG_ENDIAN; - sync = 1; - break; - default: - break; - } - } - } - } - } - - if (!sync) - { - error ("Couldn't reset the board, try pressing the reset button"); - } -} - - -#ifdef ANSI_PROTOTYPES -void -send_rdp (char *template,...) -#else -void -send_rdp (char *template, va_alist) - va_dcl -#endif -{ - char buf[200]; - char *dst = buf; - va_list alist; -#ifdef ANSI_PROTOTYPES - va_start (alist, template); -#else - va_start (alist); -#endif - - while (*template) - { - unsigned int val; - int *pi; - int *pstat; - char *pc; - int i; - switch (*template++) - { - case 'b': - val = va_arg (alist, int); - *dst++ = val; - break; - case 'w': - val = va_arg (alist, int); - *dst++ = val; - *dst++ = val >> 8; - *dst++ = val >> 16; - *dst++ = val >> 24; - break; - case 'S': - val = get_byte (); - if (val != RDP_RES_VALUE) - { - printf_unfiltered ("got bad res value of %d, %x\n", val, val); - } - break; - case 'V': - pstat = va_arg (alist, int *); - pi = va_arg (alist, int *); - - *pstat = get_byte (); - /* Check the result was zero, if not read the syndrome */ - if (*pstat) - { - *pi = get_word (); - } - break; - case 'Z': - /* Check the result code, error if not zero */ - if (get_byte ()) - error ("Command garbled"); - break; - case 'W': - /* Read a word from the target */ - pi = va_arg (alist, int *); - *pi = get_word (); - break; - case 'P': - /* Read in some bytes from the target. */ - pc = va_arg (alist, char *); - val = va_arg (alist, int); - for (i = 0; i < val; i++) - { - pc[i] = get_byte (); - } - break; - case 'p': - /* send what's being pointed at */ - pc = va_arg (alist, char *); - val = va_arg (alist, int); - dst = buf; - SERIAL_WRITE (io, pc, val); - break; - case '-': - /* Send whats in the queue */ - if (dst != buf) - { - SERIAL_WRITE (io, buf, dst - buf); - dst = buf; - } - break; - case 'B': - pi = va_arg (alist, int *); - *pi = get_byte (); - break; - default: - abort (); - } - } - va_end (args); - - if (dst != buf) - abort (); -} - - -static int -rdp_write (memaddr, buf, len) - CORE_ADDR memaddr; - char *buf; - int len; -{ - int res; - int val; - - send_rdp ("bww-p-SV", RDP_MEM_WRITE, memaddr, len, buf, len, &res, &val); - - if (res) - { - return val; - } - return len; -} - - -static int -rdp_read (memaddr, buf, len) - CORE_ADDR memaddr; - char *buf; - int len; -{ - int res; - int val; - send_rdp ("bww-S-P-V", - RDP_MEM_READ, memaddr, len, - buf, len, - &res, &val); - if (res) - { - return val; - } - return len; -} - -static void -rdp_fetch_one_register (mask, buf) - int mask; - char *buf; -{ - int val; - send_rdp ("bbw-SWZ", RDP_CPU_READ, RDP_CPU_READWRITE_MODE_CURRENT, mask, &val); - store_signed_integer (buf, 4, val); -} - -static void -rdp_fetch_one_fpu_register (mask, buf) - int mask; - char *buf; -{ -#if 0 - /* !!! Since the PIE board doesn't work as documented, - and it doesn't have FPU hardware anyway and since it - slows everything down, I've disabled this. */ - int val; - if (mask == RDP_FPU_READWRITE_MASK_FPS) - { - /* this guy is only a word */ - send_rdp ("bbw-SWZ", RDP_COPRO_READ, FPU_COPRO_NUMBER, mask, &val); - store_signed_integer (buf, 4, val); - } - else - { - /* There are 12 bytes long - !! fixme about endianness - */ - int dummy; /* I've seen these come back as four words !! */ - send_rdp ("bbw-SWWWWZ", RDP_COPRO_READ, FPU_COPRO_NUMBER, mask, buf + 0, buf + 4, buf + 8, &dummy); - } -#endif - memset (buf, 0, MAX_REGISTER_RAW_SIZE); -} - - -static void -rdp_store_one_register (mask, buf) - int mask; - char *buf; -{ - int val = extract_unsigned_integer (buf, 4); - - send_rdp ("bbww-SZ", - RDP_CPU_WRITE, RDP_CPU_READWRITE_MODE_CURRENT, mask, val); -} - - -static void -rdp_store_one_fpu_register (mask, buf) - int mask; - char *buf; -{ -#if 0 - /* See comment in fetch_one_fpu_register */ - if (mask == RDP_FPU_READWRITE_MASK_FPS) - { - int val = extract_unsigned_integer (buf, 4); - /* this guy is only a word */ - send_rdp ("bbww-SZ", RDP_COPRO_WRITE, - FPU_COPRO_NUMBER, - mask, val); - } - else - { - /* There are 12 bytes long - !! fixme about endianness - */ - int dummy = 0; - /* I've seen these come as four words, not the three advertized !! */ - printf ("Sending mask %x\n", mask); - send_rdp ("bbwwwww-SZ", - RDP_COPRO_WRITE, - FPU_COPRO_NUMBER, - mask, - *(int *) (buf + 0), - *(int *) (buf + 4), - *(int *) (buf + 8), - 0); - - printf ("done mask %x\n", mask); - } -#endif -} - - -/* Convert between GDB requests and the RDP layer. */ - -static void -remote_rdp_fetch_register (regno) - int regno; -{ - if (regno == -1) - { - for (regno = 0; regno < NUM_REGS; regno++) - remote_rdp_fetch_register (regno); - } - else - { - char buf[MAX_REGISTER_RAW_SIZE]; - if (regno < 15) - rdp_fetch_one_register (1 << regno, buf); - else if (regno == PC_REGNUM) - rdp_fetch_one_register (RDP_CPU_READWRITE_MASK_PC, buf); - else if (regno == PS_REGNUM) - rdp_fetch_one_register (RDP_CPU_READWRITE_MASK_CPSR, buf); - else if (regno == FPS_REGNUM) - rdp_fetch_one_fpu_register (RDP_FPU_READWRITE_MASK_FPS, buf); - else if (regno >= F0_REGNUM && regno <= F7_REGNUM) - rdp_fetch_one_fpu_register (1 << (regno - F0_REGNUM), buf); - else - { - printf ("Help me with fetch reg %d\n", regno); - } - supply_register (regno, buf); - } -} - - -static void -remote_rdp_store_register (regno) - int regno; -{ - if (regno == -1) - { - for (regno = 0; regno < NUM_REGS; regno++) - remote_rdp_store_register (regno); - } - else - { - char tmp[MAX_REGISTER_RAW_SIZE]; - read_register_gen (regno, tmp); - if (regno < 15) - rdp_store_one_register (1 << regno, tmp); - else if (regno == PC_REGNUM) - rdp_store_one_register (RDP_CPU_READWRITE_MASK_PC, tmp); - else if (regno == PS_REGNUM) - rdp_store_one_register (RDP_CPU_READWRITE_MASK_CPSR, tmp); - else if (regno >= F0_REGNUM && regno <= F7_REGNUM) - rdp_store_one_fpu_register (1 << (regno - F0_REGNUM), tmp); - else - { - printf ("Help me with reg %d\n", regno); - } - } -} - -static void -remote_rdp_kill () -{ - callback->shutdown (callback); -} - - -static void -rdp_info () -{ - send_rdp ("bw-S-W-Z", RDP_INFO, RDP_INFO_ABOUT_STEP, - &ds.step_info); - send_rdp ("bw-S-W-Z", RDP_INFO, RDP_INFO_ABOUT_BREAK, - &ds.break_info); - send_rdp ("bw-S-WW-Z", RDP_INFO, RDP_INFO_ABOUT_TARGET, - &ds.target_info, - &ds.model_info); - - ds.can_step = ds.step_info & RDP_INFO_ABOUT_STEP_1; - - ds.rdi_level = (ds.target_info >> 5) & 3; -} - - -static void -rdp_execute_start () -{ - /* Start it off, but don't wait for it */ - send_rdp ("bb-", RDP_EXEC, RDP_EXEC_TYPE_SYNC); -} - - - -#define a_byte 1 -#define a_word 2 -#define a_string 3 - - -typedef struct -{ - CORE_ADDR n; - const char *s; -} -argsin; - -#define ABYTE 1 -#define AWORD 2 -#define ASTRING 3 -#define ADDRLEN 4 - -#define SWI_WriteC 0x0 -#define SWI_Write0 0x2 -#define SWI_ReadC 0x4 -#define SWI_CLI 0x5 -#define SWI_GetEnv 0x10 -#define SWI_Exit 0x11 -#define SWI_EnterOS 0x16 - -#define SWI_GetErrno 0x60 -#define SWI_Clock 0x61 - -#define SWI_Time 0x63 -#define SWI_Remove 0x64 -#define SWI_Rename 0x65 -#define SWI_Open 0x66 - -#define SWI_Close 0x68 -#define SWI_Write 0x69 -#define SWI_Read 0x6a -#define SWI_Seek 0x6b -#define SWI_Flen 0x6c - -#define SWI_IsTTY 0x6e -#define SWI_TmpNam 0x6f -#define SWI_InstallHandler 0x70 -#define SWI_GenerateError 0x71 - - -static int -exec_swi (swi, args) - int swi; - argsin *args; -{ - int i; - char c; - switch (swi) - { - case SWI_WriteC: - callback->write_stdout (callback, &c, 1); - return 0; - case SWI_Write0: - for (i = 0; i < args->n; i++) - callback->write_stdout (callback, args->s, strlen (args->s)); - return 0; - case SWI_ReadC: - callback->read_stdin (callback, &c, 1); - args->n = c; - return 1; - case SWI_CLI: - args->n = callback->system (callback, args->s); - return 1; - case SWI_GetErrno: - args->n = callback->get_errno (callback); - return 1; - case SWI_Time: - args->n = callback->time (callback, NULL); - return 1; - case SWI_Remove: - args->n = callback->unlink (callback, args->s); - return 1; - case SWI_Rename: - args->n = callback->rename (callback, args[0].s, args[1].s); - return 1; - case SWI_Open: - i = 0; - -#ifdef O_BINARY - if (args[1].n & 1) - i |= O_BINARY; -#endif - if (args[1].n & 2) - i |= O_RDWR; - - if (args[1].n & 4) - { - i |= O_CREAT; - } - - if (args[1].n & 8) - i |= O_APPEND; - - args->n = callback->open (callback, args->s, i); - return 1; - - case SWI_Close: - args->n = callback->close (callback, args->n); - return 1; - - case SWI_Write: - args->n = callback->write (callback, args[0].n, args[1].s, args[1].n); - return 1; - case SWI_Read: - { - char *copy = alloca (args[2].n); - int done = callback->read (callback, args[0].n, copy, args[2].n); - if (done > 0) - remote_rdp_xfer_inferior_memory (args[0].n, copy, done, 1, 0); - args->n -= done; - return 1; - } - - case SWI_Seek: - args->n = callback->lseek (callback, args[0].n, args[1].n, 0) >= 0; - return 1; - case SWI_Flen: - { - long old = callback->lseek (callback, args->n, 1, 1); - args->n = callback->lseek (callback, args->n, 2, 0); - callback->lseek (callback, args->n, old, 0); - return 1; - } - - case SWI_IsTTY: - args->n = callback->isatty (callback, args->n); - return 1; - - default: - return 0; - } -} - - -static void -handle_swi () -{ - argsin args[3]; - char *buf; - int len; - int count = 0; - - int swino = get_word (); - int type = get_byte (); - while (type != 0) - { - switch (type & 0x3) - { - case ABYTE: - args[count].n = get_byte (); - break; - - case AWORD: - args[count].n = get_word (); - break; - - case ASTRING: - /* If the word is under 32 bytes it will be sent otherwise - an address to it is passed. Also: Special case of 255 */ - - len = get_byte (); - if (len > 32) - { - if (len == 255) - { - len = get_word (); - } - buf = alloca (len); - remote_rdp_xfer_inferior_memory (get_word (), - buf, - len, - 0, - 0); - } - else - { - int i; - buf = alloca (len + 1); - for (i = 0; i < len; i++) - buf[i] = get_byte (); - buf[i] = 0; - } - args[count].n = len; - args[count].s = buf; - break; - - default: - error ("Unimplented SWI argument"); - } - - type = type >> 2; - count++; - } - - if (exec_swi (swino, args)) - { - /* We have two options here reply with either a byte or a word - which is stored in args[0].n. There is no harm in replying with - a word all the time, so thats what I do! */ - send_rdp ("bbw-", RDP_OSOpReply, RDP_OSOpWord, args[0].n); - } - else - { - send_rdp ("bb-", RDP_OSOpReply, RDP_OSOpNothing); - } -} - -static void -rdp_execute_finish () -{ - int running = 1; - - while (running) - { - int res; - res = SERIAL_READCHAR (io, 1); - while (res == SERIAL_TIMEOUT) - { - QUIT; - printf_filtered ("Waiting for target..\n"); - res = SERIAL_READCHAR (io, 1); - } - - switch (res) - { - case RDP_RES_SWI: - handle_swi (); - break; - case RDP_RES_VALUE: - send_rdp ("B", &ds.rdi_stopped_status); - running = 0; - break; - case RDP_RESET: - printf_filtered ("Target reset\n"); - running = 0; - break; - default: - printf_filtered ("Ignoring %x\n", res); - break; - } - } -} - - -static void -rdp_execute () -{ - rdp_execute_start (); - rdp_execute_finish (); -} - -static int -remote_rdp_insert_breakpoint (addr, save) - CORE_ADDR addr; - char *save; -{ - int res; - if (ds.rdi_level > 0) - { - send_rdp ("bwb-SWB", - RDP_SET_BREAK, - addr, - RDP_SET_BREAK_TYPE_PC_EQUAL | RDP_SET_BREAK_TYPE_GET_HANDLE, - save, - &res); - } - else - { - send_rdp ("bwb-SB", - RDP_SET_BREAK, - addr, - RDP_SET_BREAK_TYPE_PC_EQUAL, - &res); - } - return res; -} - -static int -remote_rdp_remove_breakpoint (addr, save) - CORE_ADDR addr; - char *save; -{ - int res; - if (ds.rdi_level > 0) - { - send_rdp ("b-p-S-B", - RDP_CLEAR_BREAK, - save, 4, - &res); - } - else - { - send_rdp ("bw-S-B", - RDP_CLEAR_BREAK, - addr, - &res); - } - return res; -} - -static void -rdp_step () -{ - if (ds.can_step && 0) - { - /* The pie board can't do steps so I can't test this, and - the other code will always work. */ - int status; - send_rdp ("bbw-S-B", - RDP_STEP, 0, 1, - &status); - } - else - { - char handle[4]; - CORE_ADDR pc = read_register (PC_REGNUM); - pc = arm_get_next_pc (pc); - remote_rdp_insert_breakpoint (pc, &handle); - rdp_execute (); - remote_rdp_remove_breakpoint (pc, &handle); - } -} - -static void -remote_rdp_open (args, from_tty) - char *args; - int from_tty; -{ - if (!args) - error_no_arg ("serial port device name"); - - baud_rate = 9600; - - target_preopen (from_tty); - - io = SERIAL_OPEN (args); - - if (!io) - perror_with_name (args); - - SERIAL_RAW (io); - - rdp_init (1, from_tty); - - - if (from_tty) - { - printf_unfiltered ("Remote RDP debugging using %s at %d baud\n", args, baud_rate); - } - - rdp_info (); - - push_target (&remote_rdp_ops); - - callback->init (callback); - flush_cached_frames (); - registers_changed (); - stop_pc = read_pc (); - set_current_frame (create_new_frame (read_fp (), stop_pc)); - select_frame (get_current_frame (), 0); - print_stack_frame (selected_frame, -1, 1); -} - - - -/* Close out all files and local state before this target loses control. */ - -static void -remote_rdp_close (quitting) - int quitting; -{ - callback->shutdown (callback); - if (io) - SERIAL_CLOSE (io); - io = 0; -} - - -/* Resume execution of the target process. STEP says whether to single-step - or to run free; SIGGNAL is the signal value (e.g. SIGINT) to be given - to the target, or zero for no signal. */ - -static void -remote_rdp_resume (pid, step, siggnal) - int pid, step; - enum target_signal siggnal; -{ - if (step) - rdp_step (); - else - rdp_execute (); -} - -/* Wait for inferior process to do something. Return pid of child, - or -1 in case of error; store status through argument pointer STATUS, - just as `wait' would. */ - -static int -remote_rdp_wait (pid, status) - int pid; - struct target_waitstatus *status; -{ - switch (ds.rdi_stopped_status) - { - default: - case RDP_RES_RESET: - case RDP_RES_SWI: - status->kind = TARGET_WAITKIND_EXITED; - status->value.integer = read_register (0); - break; - case RDP_RES_AT_BREAKPOINT: - status->kind = TARGET_WAITKIND_STOPPED; - /* The signal in sigrc is a host signal. That probably - should be fixed. */ - status->value.sig = TARGET_SIGNAL_TRAP; - break; -#if 0 - case rdp_signalled: - status->kind = TARGET_WAITKIND_SIGNALLED; - /* The signal in sigrc is a host signal. That probably - should be fixed. */ - status->value.sig = target_signal_from_host (sigrc); - break; -#endif - } - - return inferior_pid; -} - -/* Get ready to modify the registers array. On machines which store - individual registers, this doesn't need to do anything. On machines - which store all the registers in one fell swoop, this makes sure - that registers contains all the registers from the program being - debugged. */ - -static void -remote_rdp_prepare_to_store () -{ - /* Do nothing, since we can store individual regs */ -} - -static int -remote_rdp_xfer_inferior_memory (memaddr, myaddr, len, write, target) - CORE_ADDR memaddr; - char *myaddr; - int len; - int write; - struct target_ops *target; /* ignored */ -{ - /* I infer from D Taylor's code that there's a limit on the amount - we can transfer in one chunk.. */ - int done = 0; - while (done < len) - { - int justdone; - int thisbite = len - done; - if (thisbite > RDP_MOUTHFULL) - thisbite = RDP_MOUTHFULL; - - QUIT; - - if (write) - { - justdone = rdp_write (memaddr + done, myaddr + done, thisbite); - } - else - { - justdone = rdp_read (memaddr + done, myaddr + done, thisbite); - } - - done += justdone; - - if (justdone != thisbite) - break; - } - return done; -} - - - -struct yn -{ - const char *name; - int bit; -}; -static struct yn stepinfo[] = -{ - {"Step more than one instruction", RDP_INFO_ABOUT_STEP_GT_1}, - {"Step to jump", RDP_INFO_ABOUT_STEP_TO_JMP}, - {"Step one instruction", RDP_INFO_ABOUT_STEP_1}, - {0} -}; - -static struct yn breakinfo[] = -{ - {"comparison breakpoints supported", RDP_INFO_ABOUT_BREAK_COMP}, - {"range breakpoints supported", RDP_INFO_ABOUT_BREAK_RANGE}, - {"watchpoints for byte reads supported", RDP_INFO_ABOUT_BREAK_BYTE_READ}, - {"watchpoints for half-word reads supported", RDP_INFO_ABOUT_BREAK_HALFWORD_READ}, - {"watchpoints for word reads supported", RDP_INFO_ABOUT_BREAK_WORD_READ}, - {"watchpoints for byte writes supported", RDP_INFO_ABOUT_BREAK_BYTE_WRITE}, - {"watchpoints for half-word writes supported", RDP_INFO_ABOUT_BREAK_HALFWORD_WRITE}, - {"watchpoints for word writes supported", RDP_INFO_ABOUT_BREAK_WORD_WRITE}, - {"mask break/watch-points supported", RDP_INFO_ABOUT_BREAK_MASK}, -{"thread-specific breakpoints supported", RDP_INFO_ABOUT_BREAK_THREAD_BREAK}, -{"thread-specific watchpoints supported", RDP_INFO_ABOUT_BREAK_THREAD_WATCH}, - {"conditional breakpoints supported", RDP_INFO_ABOUT_BREAK_COND}, - {0} -}; - - -static void -dump_bits (t, info) - struct yn *t; - int info; -{ - while (t->name) - { - printf_unfiltered (" %-45s : %s\n", t->name, (info & t->bit) ? "Yes" : "No"); - t++; - } -} - -static void -remote_rdp_files_info (target) - struct target_ops *target; -{ - printf_filtered ("Target capabilities:\n"); - dump_bits (stepinfo, ds.step_info); - dump_bits (breakinfo, ds.break_info); - printf_unfiltered ("target level RDI %x\n", (ds.target_info >> 5) & 3); -} - - -/* Define the target subroutine names */ - -struct target_ops remote_rdp_ops = -{ - "rdp", /* to_shortname */ - /* to_longname */ - "Remote Target using the RDProtocol", - /* to_doc */ - "Use a remote ARM system which uses the ARM Remote Debugging Protocol", - remote_rdp_open, /* to_open */ - remote_rdp_close, /* to_close */ - NULL, /* to_attach */ - NULL, /* to_detach */ - remote_rdp_resume, /* to_resume */ - remote_rdp_wait, /* to_wait */ - remote_rdp_fetch_register, /* to_fetch_registers */ - remote_rdp_store_register, /* to_store_registers */ - remote_rdp_prepare_to_store, /* to_prepare_to_store */ - remote_rdp_xfer_inferior_memory, /* to_xfer_memory */ - remote_rdp_files_info, /* to_files_info */ - remote_rdp_insert_breakpoint, /* to_insert_breakpoint */ - remote_rdp_remove_breakpoint, /* to_remove_breakpoint */ - NULL, /* to_terminal_init */ - NULL, /* to_terminal_inferior */ - NULL, /* to_terminal_ours_for_output */ - NULL, /* to_terminal_ours */ - NULL, /* to_terminal_info */ - remote_rdp_kill, /* to_kill */ - generic_load, /* to_load */ - NULL, /* to_lookup_symbol */ - NULL, /* to_create_inferior */ - generic_mourn_inferior, /* to_mourn_inferior */ - 0, /* to_can_run */ - 0, /* to_notice_signals */ - 0, /* to_thread_alive */ - 0, /* to_stop */ - process_stratum, /* to_stratum */ - NULL, /* to_next */ - 1, /* to_has_all_memory */ - 1, /* to_has_memory */ - 1, /* to_has_stack */ - 1, /* to_has_registers */ - 1, /* to_has_execution */ - NULL, /* sections */ - NULL, /* sections_end */ - OPS_MAGIC, /* to_magic */ -}; - -void -_initialize_remote_rdp () -{ - add_target (&remote_rdp_ops); -} diff --git a/contrib/gdb/gdb/remote-sim.c b/contrib/gdb/gdb/remote-sim.c deleted file mode 100644 index d0f0f50..0000000 --- a/contrib/gdb/gdb/remote-sim.c +++ /dev/null @@ -1,468 +0,0 @@ -/* Generic remote debugging interface for simulators. - Copyright 1993, 1994 Free Software Foundation, Inc. - Contributed by Cygnus Support. - Steve Chamberlain (sac@cygnus.com). - -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 "wait.h" -#include "value.h" -#include "gdb_string.h" -#include -#include -#include -#include -#include -#include "terminal.h" -#include "target.h" -#include "gdbcore.h" -#include "remote-sim.h" -#include "remote-utils.h" -#include "callback.h" - -/* Naming convention: - - sim_* are the interface to the simulator (see remote-sim.h). - sim_callback_* are the stuff which the simulator can see inside GDB. - gdbsim_* are stuff which is internal to gdb. */ - -/* Forward data declarations */ -extern struct target_ops gdbsim_ops; - -static int program_loaded = 0; - -static void -dump_mem (buf, len) - char *buf; - int len; -{ - if (len <= 8) - { - if (len == 8 || len == 4) - { - long l[2]; - memcpy (l, buf, len); - printf_filtered ("\t0x%x", l[0]); - printf_filtered (len == 8 ? " 0x%x\n" : "\n", l[1]); - } - else - { - int i; - printf_filtered ("\t"); - for (i = 0; i < len; i++) - printf_filtered ("0x%x ", buf[i]); - printf_filtered ("\n"); - } - } -} - -static void -gdbsim_fetch_register (regno) -int regno; -{ - if (regno == -1) - { - for (regno = 0; regno < NUM_REGS; regno++) - gdbsim_fetch_register (regno); - } - else - { - char buf[MAX_REGISTER_RAW_SIZE]; - - sim_fetch_register (regno, buf); - supply_register (regno, buf); - if (sr_get_debug ()) - { - printf_filtered ("gdbsim_fetch_register: %d", regno); - /* FIXME: We could print something more intelligible. */ - dump_mem (buf, REGISTER_RAW_SIZE (regno)); - } - } -} - - -static void -gdbsim_store_register (regno) -int regno; -{ - if (regno == -1) - { - for (regno = 0; regno < NUM_REGS; regno++) - gdbsim_store_register (regno); - } - else - { - /* FIXME: Until read_register() returns LONGEST, we have this. */ - char tmp[MAX_REGISTER_RAW_SIZE]; - read_register_gen (regno, tmp); - sim_store_register (regno, tmp); - if (sr_get_debug ()) - { - printf_filtered ("gdbsim_store_register: %d", regno); - /* FIXME: We could print something more intelligible. */ - dump_mem (tmp, REGISTER_RAW_SIZE (regno)); - } - } -} - -/* Kill the running program. This may involve closing any open files - and releasing other resources acquired by the simulated program. */ - -static void -gdbsim_kill () -{ - if (sr_get_debug ()) - printf_filtered ("gdbsim_kill\n"); - - sim_kill (); /* close fd's, remove mappings */ - inferior_pid = 0; -} - -/* Load an executable file into the target process. This is expected to - not only bring new code into the target process, but also to update - GDB's symbol tables to match. */ - -static void -gdbsim_load (prog, fromtty) - char *prog; - int fromtty; -{ - if (sr_get_debug ()) - printf_filtered ("gdbsim_load: prog \"%s\"\n", prog); - - inferior_pid = 0; - - /* This must be done before calling gr_load_image. */ - program_loaded = 1; - - if (sim_load (prog, fromtty) != 0) - generic_load (prog, fromtty); -} - - -/* Start an inferior process and set inferior_pid to its pid. - EXEC_FILE is the file to run. - ALLARGS is a string containing the arguments to the program. - ENV is the environment vector to pass. Errors reported with error(). - On VxWorks and various standalone systems, we ignore exec_file. */ -/* This is called not only when we first attach, but also when the - user types "run" after having attached. */ - -static void -gdbsim_create_inferior (exec_file, args, env) - char *exec_file; - char *args; - char **env; -{ - int len; - char *arg_buf,**argv; - CORE_ADDR entry_pt; - - if (! program_loaded) - error ("No program loaded."); - - if (sr_get_debug ()) - printf_filtered ("gdbsim_create_inferior: exec_file \"%s\", args \"%s\"\n", - exec_file, args); - - if (exec_file == 0 || exec_bfd == 0) - error ("No exec file specified."); - - entry_pt = (CORE_ADDR) bfd_get_start_address (exec_bfd); - - gdbsim_kill (NULL, NULL); - remove_breakpoints (); - init_wait_for_inferior (); - - len = 5 + strlen (exec_file) + 1 + strlen (args) + 1 + /*slop*/ 10; - arg_buf = (char *) alloca (len); - arg_buf[0] = '\0'; - strcat (arg_buf, exec_file); - strcat (arg_buf, " "); - strcat (arg_buf, args); - argv = buildargv (arg_buf); - make_cleanup (freeargv, (char *) argv); - sim_create_inferior (entry_pt, argv, env); - - inferior_pid = 42; - insert_breakpoints (); /* Needed to get correct instruction in cache */ - proceed (entry_pt, TARGET_SIGNAL_DEFAULT, 0); -} - -/* The open routine takes the rest of the parameters from the command, - and (if successful) pushes a new target onto the stack. - Targets should supply this routine, if only to provide an error message. */ -/* Called when selecting the simulator. EG: (gdb) target sim name. */ - -static void -gdbsim_open (args, from_tty) - char *args; - int from_tty; -{ - if (sr_get_debug ()) - printf_filtered ("gdbsim_open: args \"%s\"\n", args ? args : "(null)"); - - sim_set_callbacks (&default_callback); - default_callback.init (&default_callback); - - sim_open (args); - - push_target (&gdbsim_ops); - target_fetch_registers (-1); - printf_filtered ("Connected to the simulator.\n"); -} - -/* Does whatever cleanup is required for a target that we are no longer - going to be calling. Argument says whether we are quitting gdb and - should not get hung in case of errors, or whether we want a clean - termination even if it takes a while. This routine is automatically - always called just before a routine is popped off the target stack. - Closing file descriptors and freeing memory are typical things it should - do. */ -/* Close out all files and local state before this target loses control. */ - -static void -gdbsim_close (quitting) - int quitting; -{ - if (sr_get_debug ()) - printf_filtered ("gdbsim_close: quitting %d\n", quitting); - - program_loaded = 0; - - sim_close (quitting); -} - -/* Takes a program previously attached to and detaches it. - The program may resume execution (some targets do, some don't) and will - no longer stop on signals, etc. We better not have left any breakpoints - in the program or it'll die when it hits one. ARGS is arguments - typed by the user (e.g. a signal to send the process). FROM_TTY - says whether to be verbose or not. */ -/* Terminate the open connection to the remote debugger. - Use this when you want to detach and do something else with your gdb. */ - -static void -gdbsim_detach (args,from_tty) - char *args; - int from_tty; -{ - if (sr_get_debug ()) - printf_filtered ("gdbsim_detach: args \"%s\"\n", args); - - pop_target (); /* calls gdbsim_close to do the real work */ - if (from_tty) - printf_filtered ("Ending simulator %s debugging\n", target_shortname); -} - -/* Resume execution of the target process. STEP says whether to single-step - or to run free; SIGGNAL is the signal value (e.g. SIGINT) to be given - to the target, or zero for no signal. */ - -static void -gdbsim_resume (pid, step, siggnal) - int pid, step; - enum target_signal siggnal; -{ - if (sr_get_debug ()) - printf_filtered ("gdbsim_resume: step %d, signal %d\n", step, siggnal); - - sim_resume (step, target_signal_to_host (siggnal)); -} - -/* Wait for inferior process to do something. Return pid of child, - or -1 in case of error; store status through argument pointer STATUS, - just as `wait' would. */ - -static int -gdbsim_wait (pid, status) - int pid; - struct target_waitstatus *status; -{ - int sigrc; - enum sim_stop reason; - - if (sr_get_debug ()) - printf_filtered ("gdbsim_wait\n"); - - sim_stop_reason (&reason, &sigrc); - switch (reason) - { - case sim_exited: - status->kind = TARGET_WAITKIND_EXITED; - status->value.integer = sigrc; - break; - case sim_stopped: - status->kind = TARGET_WAITKIND_STOPPED; - /* The signal in sigrc is a host signal. That probably - should be fixed. */ - status->value.sig = target_signal_from_host (sigrc); - break; - case sim_signalled: - status->kind = TARGET_WAITKIND_SIGNALLED; - /* The signal in sigrc is a host signal. That probably - should be fixed. */ - status->value.sig = target_signal_from_host (sigrc); - break; - } - - return inferior_pid; -} - -/* Get ready to modify the registers array. On machines which store - individual registers, this doesn't need to do anything. On machines - which store all the registers in one fell swoop, this makes sure - that registers contains all the registers from the program being - debugged. */ - -static void -gdbsim_prepare_to_store () -{ - /* Do nothing, since we can store individual regs */ -} - -static int -gdbsim_xfer_inferior_memory (memaddr, myaddr, len, write, target) - CORE_ADDR memaddr; - char *myaddr; - int len; - int write; - struct target_ops *target; /* ignored */ -{ - if (! program_loaded) - error ("No program loaded."); - - if (sr_get_debug ()) - { - printf_filtered ("gdbsim_xfer_inferior_memory: myaddr 0x%x, memaddr 0x%x, len %d, write %d\n", - myaddr, memaddr, len, write); - if (sr_get_debug () && write) - dump_mem(myaddr, len); - } - - if (write) - { - len = sim_write (memaddr, myaddr, len); - } - else - { - len = sim_read (memaddr, myaddr, len); - if (sr_get_debug () && len > 0) - dump_mem(myaddr, len); - } - return len; -} - -static void -gdbsim_files_info (target) - struct target_ops *target; -{ - char *file = "nothing"; - - if (exec_bfd) - file = bfd_get_filename (exec_bfd); - - if (sr_get_debug ()) - printf_filtered ("gdbsim_files_info: file \"%s\"\n", file); - - if (exec_bfd) - { - printf_filtered ("\tAttached to %s running program %s\n", - target_shortname, file); - sim_info (0); - } -} - -/* Clear the simulator's notion of what the break points are. */ - -static void -gdbsim_mourn_inferior () -{ - if (sr_get_debug ()) - printf_filtered ("gdbsim_mourn_inferior:\n"); - - remove_breakpoints (); - generic_mourn_inferior (); -} - -/* Put a command string, in args, out to MONITOR. Output from MONITOR - is placed on the users terminal until the prompt is seen. FIXME: We - read the characters ourseleves here cause of a nasty echo. */ - -static void -simulator_command (args, from_tty) - char *args; - int from_tty; -{ - sim_do_command (args); -} - -/* Define the target subroutine names */ - -struct target_ops gdbsim_ops = { - "sim", /* to_shortname */ - "simulator", /* to_longname */ - "Use the compiled-in simulator.", /* to_doc */ - gdbsim_open, /* to_open */ - gdbsim_close, /* to_close */ - NULL, /* to_attach */ - gdbsim_detach, /* to_detach */ - gdbsim_resume, /* to_resume */ - gdbsim_wait, /* to_wait */ - gdbsim_fetch_register, /* to_fetch_registers */ - gdbsim_store_register, /* to_store_registers */ - gdbsim_prepare_to_store, /* to_prepare_to_store */ - gdbsim_xfer_inferior_memory, /* to_xfer_memory */ - gdbsim_files_info, /* to_files_info */ - memory_insert_breakpoint, /* to_insert_breakpoint */ - memory_remove_breakpoint, /* to_remove_breakpoint */ - NULL, /* to_terminal_init */ - NULL, /* to_terminal_inferior */ - NULL, /* to_terminal_ours_for_output */ - NULL, /* to_terminal_ours */ - NULL, /* to_terminal_info */ - gdbsim_kill, /* to_kill */ - gdbsim_load, /* to_load */ - NULL, /* to_lookup_symbol */ - gdbsim_create_inferior, /* to_create_inferior */ - gdbsim_mourn_inferior, /* to_mourn_inferior */ - 0, /* to_can_run */ - 0, /* to_notice_signals */ - 0, /* to_thread_alive */ - 0, /* to_stop */ - process_stratum, /* to_stratum */ - NULL, /* to_next */ - 1, /* to_has_all_memory */ - 1, /* to_has_memory */ - 1, /* to_has_stack */ - 1, /* to_has_registers */ - 1, /* to_has_execution */ - NULL, /* sections */ - NULL, /* sections_end */ - OPS_MAGIC, /* to_magic */ -}; - -void -_initialize_remote_sim () -{ - add_target (&gdbsim_ops); - - add_com ("sim ", class_obscure, simulator_command, - "Send a command to the simulator."); -} diff --git a/contrib/gdb/gdb/remote-st.c b/contrib/gdb/gdb/remote-st.c deleted file mode 100644 index 117501d..0000000 --- a/contrib/gdb/gdb/remote-st.c +++ /dev/null @@ -1,847 +0,0 @@ -/* Remote debugging interface for Tandem ST2000 phone switch, for GDB. - Copyright 1990, 1991, 1992 Free Software Foundation, Inc. - Contributed by Cygnus Support. Written by Jim Kingdon for Cygnus. - -This file is part of GDB. - -This 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 derived from remote-eb.c, which did a similar job, but for - an AMD-29K running EBMON. That file was in turn derived from remote.c - as mentioned in the following comment (left in for comic relief): - - "This is like remote.c but is for an esoteric situation-- - having an a29k board in a PC hooked up to a unix machine with - a serial line, and running ctty com1 on the PC, through which - the unix machine can run ebmon. Not to mention that the PC - has PC/NFS, so it can access the same executables that gdb can, - over the net in real time." - - In reality, this module talks to a debug monitor called 'STDEBUG', which - runs in a phone switch. We communicate with STDEBUG via either a direct - serial line, or a TCP (or possibly TELNET) stream to a terminal multiplexor, - which in turn talks to the phone switch. */ - -#include "defs.h" -#include "gdbcore.h" -#include "target.h" -#include "wait.h" -#ifdef ANSI_PROTOTYPES -#include -#else -#include -#endif -#include -#include "gdb_string.h" -#include -#include "serial.h" - -extern struct target_ops st2000_ops; /* Forward declaration */ - -static void st2000_close(); -static void st2000_fetch_register(); -static void st2000_store_register(); - -#define LOG_FILE "st2000.log" -#if defined (LOG_FILE) -FILE *log_file; -#endif - -static int timeout = 24; - -/* Descriptor for I/O to remote machine. Initialize it to -1 so that - st2000_open knows that we don't have a file open when the program - starts. */ - -static serial_t st2000_desc; - -/* Send data to stdebug. Works just like printf. */ - -static void -#ifdef ANSI_PROTOTYPES -printf_stdebug(char *pattern, ...) -#else -printf_stdebug(va_alist) - va_dcl -#endif -{ - va_list args; - char buf[200]; - -#ifdef ANSI_PROTOTYPES - va_start(args, pattern); -#else - char *pattern; - va_start(args); - pattern = va_arg(args, char *); -#endif - - vsprintf(buf, pattern, args); - va_end(args); - - if (SERIAL_WRITE(st2000_desc, buf, strlen(buf))) - fprintf(stderr, "SERIAL_WRITE failed: %s\n", safe_strerror(errno)); -} - -/* Read a character from the remote system, doing all the fancy timeout - stuff. */ - -static int -readchar(timeout) - int timeout; -{ - int c; - - c = SERIAL_READCHAR(st2000_desc, timeout); - -#ifdef LOG_FILE - putc(c & 0x7f, log_file); -#endif - - if (c >= 0) - return c & 0x7f; - - if (c == SERIAL_TIMEOUT) - { - if (timeout == 0) - return c; /* Polls shouldn't generate timeout errors */ - - error("Timeout reading from remote system."); - } - - perror_with_name("remote-st2000"); -} - -/* Scan input from the remote system, until STRING is found. If DISCARD is - non-zero, then discard non-matching input, else print it out. - Let the user break out immediately. */ -static void -expect(string, discard) - char *string; - int discard; -{ - char *p = string; - int c; - - immediate_quit = 1; - while (1) - { - c = readchar(timeout); - if (c == *p++) - { - if (*p == '\0') - { - immediate_quit = 0; - return; - } - } - else - { - if (!discard) - { - fwrite(string, 1, (p - 1) - string, stdout); - putchar((char)c); - fflush(stdout); - } - p = string; - } - } -} - -/* Keep discarding input until we see the STDEBUG prompt. - - The convention for dealing with the prompt is that you - o give your command - o *then* wait for the prompt. - - Thus the last thing that a procedure does with the serial line - will be an expect_prompt(). Exception: st2000_resume does not - wait for the prompt, because the terminal is being handed over - to the inferior. However, the next thing which happens after that - is a st2000_wait which does wait for the prompt. - Note that this includes abnormal exit, e.g. error(). This is - necessary to prevent getting into states from which we can't - recover. */ -static void -expect_prompt(discard) - int discard; -{ -#if defined (LOG_FILE) - /* This is a convenient place to do this. The idea is to do it often - enough that we never lose much data if we terminate abnormally. */ - fflush(log_file); -#endif - expect ("dbug> ", discard); -} - -/* Get a hex digit from the remote system & return its value. - If ignore_space is nonzero, ignore spaces (not newline, tab, etc). */ -static int -get_hex_digit(ignore_space) - int ignore_space; -{ - int ch; - while (1) - { - ch = readchar(timeout); - if (ch >= '0' && ch <= '9') - return ch - '0'; - else if (ch >= 'A' && ch <= 'F') - return ch - 'A' + 10; - else if (ch >= 'a' && ch <= 'f') - return ch - 'a' + 10; - else if (ch == ' ' && ignore_space) - ; - else - { - expect_prompt(1); - error("Invalid hex digit from remote system."); - } - } -} - -/* Get a byte from stdebug and put it in *BYT. Accept any number - leading spaces. */ -static void -get_hex_byte (byt) - char *byt; -{ - int val; - - val = get_hex_digit (1) << 4; - val |= get_hex_digit (0); - *byt = val; -} - -/* Get N 32-bit words from remote, each preceded by a space, - and put them in registers starting at REGNO. */ -static void -get_hex_regs (n, regno) - int n; - int regno; -{ - long val; - int i; - - for (i = 0; i < n; i++) - { - int j; - - val = 0; - for (j = 0; j < 8; j++) - val = (val << 4) + get_hex_digit (j == 0); - supply_register (regno++, (char *) &val); - } -} - -/* This is called not only when we first attach, but also when the - user types "run" after having attached. */ -static void -st2000_create_inferior (execfile, args, env) - char *execfile; - char *args; - char **env; -{ - int entry_pt; - - if (args && *args) - error("Can't pass arguments to remote STDEBUG process"); - - if (execfile == 0 || exec_bfd == 0) - error("No exec file specified"); - - entry_pt = (int) bfd_get_start_address (exec_bfd); - -/* The "process" (board) is already stopped awaiting our commands, and - the program is already downloaded. We just set its PC and go. */ - - clear_proceed_status (); - - /* Tell wait_for_inferior that we've started a new process. */ - init_wait_for_inferior (); - - /* Set up the "saved terminal modes" of the inferior - based on what modes we are starting it with. */ - target_terminal_init (); - - /* Install inferior's terminal modes. */ - target_terminal_inferior (); - - /* insert_step_breakpoint (); FIXME, do we need this? */ - /* Let 'er rip... */ - proceed ((CORE_ADDR)entry_pt, TARGET_SIGNAL_DEFAULT, 0); -} - -/* Open a connection to a remote debugger. - NAME is the filename used for communication. */ - -static int baudrate = 9600; -static char dev_name[100]; - -static void -st2000_open(args, from_tty) - char *args; - int from_tty; -{ - int n; - char junk[100]; - - target_preopen(from_tty); - - n = sscanf(args, " %s %d %s", dev_name, &baudrate, junk); - - if (n != 2) - error("Bad arguments. Usage: target st2000 \n\ -or target st2000 \n"); - - st2000_close(0); - - st2000_desc = SERIAL_OPEN(dev_name); - - if (!st2000_desc) - perror_with_name(dev_name); - - SERIAL_SETBAUDRATE(st2000_desc, baudrate); - - SERIAL_RAW(st2000_desc); - - push_target(&st2000_ops); - -#if defined (LOG_FILE) - log_file = fopen (LOG_FILE, "w"); - if (log_file == NULL) - perror_with_name (LOG_FILE); -#endif - - /* Hello? Are you there? */ - printf_stdebug("\003"); /* ^C wakes up dbug */ - - expect_prompt(1); - - if (from_tty) - printf("Remote %s connected to %s\n", target_shortname, - dev_name); -} - -/* Close out all files and local state before this target loses control. */ - -static void -st2000_close (quitting) - int quitting; -{ - SERIAL_CLOSE(st2000_desc); - -#if defined (LOG_FILE) - if (log_file) { - if (ferror(log_file)) - fprintf(stderr, "Error writing log file.\n"); - if (fclose(log_file) != 0) - fprintf(stderr, "Error closing log file.\n"); - } -#endif -} - -/* Terminate the open connection to the remote debugger. - Use this when you want to detach and do something else - with your gdb. */ -static void -st2000_detach (from_tty) - int from_tty; -{ - pop_target(); /* calls st2000_close to do the real work */ - if (from_tty) - printf ("Ending remote %s debugging\n", target_shortname); -} - -/* Tell the remote machine to resume. */ - -static void -st2000_resume (pid, step, sig) - int pid, step; - enum target_signal sig; -{ - if (step) - { - printf_stdebug ("ST\r"); - /* Wait for the echo. */ - expect ("ST\r", 1); - } - else - { - printf_stdebug ("GO\r"); - /* Swallow the echo. */ - expect ("GO\r", 1); - } -} - -/* Wait until the remote machine stops, then return, - storing status in STATUS just as `wait' would. */ - -static int -st2000_wait (status) - struct target_waitstatus *status; -{ - int old_timeout = timeout; - - status->kind = TARGET_WAITKIND_EXITED; - status->value.integer = 0; - - timeout = 0; /* Don't time out -- user program is running. */ - - expect_prompt(0); /* Wait for prompt, outputting extraneous text */ - - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_TRAP; - - timeout = old_timeout; - - return 0; -} - -/* Return the name of register number REGNO in the form input and output by - STDEBUG. Currently, REGISTER_NAMES just happens to contain exactly what - STDEBUG wants. Lets take advantage of that just as long as possible! */ - -static char * -get_reg_name (regno) - int regno; -{ - static char buf[50]; - const char *p; - char *b; - - b = buf; - - for (p = reg_names[regno]; *p; p++) - *b++ = toupper(*p); - *b = '\000'; - - return buf; -} - -/* Read the remote registers into the block REGS. */ - -static void -st2000_fetch_registers () -{ - int regno; - - /* Yeah yeah, I know this is horribly inefficient. But it isn't done - very often... I'll clean it up later. */ - - for (regno = 0; regno <= PC_REGNUM; regno++) - st2000_fetch_register(regno); -} - -/* Fetch register REGNO, or all registers if REGNO is -1. - Returns errno value. */ -static void -st2000_fetch_register (regno) - int regno; -{ - if (regno == -1) - st2000_fetch_registers (); - else - { - char *name = get_reg_name (regno); - printf_stdebug ("DR %s\r", name); - expect (name, 1); - expect (" : ", 1); - get_hex_regs (1, regno); - expect_prompt (1); - } - return; -} - -/* Store the remote registers from the contents of the block REGS. */ - -static void -st2000_store_registers () -{ - int regno; - - for (regno = 0; regno <= PC_REGNUM; regno++) - st2000_store_register(regno); - - registers_changed (); -} - -/* Store register REGNO, or all if REGNO == 0. - Return errno value. */ -static void -st2000_store_register (regno) - int regno; -{ - if (regno == -1) - st2000_store_registers (); - else - { - printf_stdebug ("PR %s %x\r", get_reg_name (regno), - read_register (regno)); - - expect_prompt (1); - } -} - -/* Get ready to modify the registers array. On machines which store - individual registers, this doesn't need to do anything. On machines - which store all the registers in one fell swoop, this makes sure - that registers contains all the registers from the program being - debugged. */ - -static void -st2000_prepare_to_store () -{ - /* Do nothing, since we can store individual regs */ -} - -static void -st2000_files_info () -{ - printf ("\tAttached to %s at %d baud.\n", - dev_name, baudrate); -} - -/* Copy LEN bytes of data from debugger memory at MYADDR - to inferior's memory at MEMADDR. Returns length moved. */ -static int -st2000_write_inferior_memory (memaddr, myaddr, len) - CORE_ADDR memaddr; - unsigned char *myaddr; - int len; -{ - int i; - - for (i = 0; i < len; i++) - { - printf_stdebug ("PM.B %x %x\r", memaddr + i, myaddr[i]); - expect_prompt (1); - } - return len; -} - -/* Read LEN bytes from inferior memory at MEMADDR. Put the result - at debugger address MYADDR. Returns length moved. */ -static int -st2000_read_inferior_memory(memaddr, myaddr, len) - CORE_ADDR memaddr; - char *myaddr; - int len; -{ - int i; - - /* Number of bytes read so far. */ - int count; - - /* Starting address of this pass. */ - unsigned long startaddr; - - /* Number of bytes to read in this pass. */ - int len_this_pass; - - /* Note that this code works correctly if startaddr is just less - than UINT_MAX (well, really CORE_ADDR_MAX if there was such a - thing). That is, something like - st2000_read_bytes (CORE_ADDR_MAX - 4, foo, 4) - works--it never adds len to memaddr and gets 0. */ - /* However, something like - st2000_read_bytes (CORE_ADDR_MAX - 3, foo, 4) - doesn't need to work. Detect it and give up if there's an attempt - to do that. */ - if (((memaddr - 1) + len) < memaddr) { - errno = EIO; - return 0; - } - - startaddr = memaddr; - count = 0; - while (count < len) - { - len_this_pass = 16; - if ((startaddr % 16) != 0) - len_this_pass -= startaddr % 16; - if (len_this_pass > (len - count)) - len_this_pass = (len - count); - - printf_stdebug ("DI.L %x %x\r", startaddr, len_this_pass); - expect (": ", 1); - - for (i = 0; i < len_this_pass; i++) - get_hex_byte (&myaddr[count++]); - - expect_prompt (1); - - startaddr += len_this_pass; - } - return len; -} - -/* FIXME-someday! Merge these two. */ -static int -st2000_xfer_inferior_memory (memaddr, myaddr, len, write, target) - CORE_ADDR memaddr; - char *myaddr; - int len; - int write; - struct target_ops *target; /* ignored */ -{ - if (write) - return st2000_write_inferior_memory (memaddr, myaddr, len); - else - return st2000_read_inferior_memory (memaddr, myaddr, len); -} - -static void -st2000_kill (args, from_tty) - char *args; - int from_tty; -{ - return; /* Ignore attempts to kill target system */ -} - -/* Clean up when a program exits. - - The program actually lives on in the remote processor's RAM, and may be - run again without a download. Don't leave it full of breakpoint - instructions. */ - -static void -st2000_mourn_inferior () -{ - remove_breakpoints (); - unpush_target (&st2000_ops); - generic_mourn_inferior (); /* Do all the proper things now */ -} - -#define MAX_STDEBUG_BREAKPOINTS 16 - -extern int memory_breakpoint_size; -static CORE_ADDR breakaddr[MAX_STDEBUG_BREAKPOINTS] = {0}; - -static int -st2000_insert_breakpoint (addr, shadow) - CORE_ADDR addr; - char *shadow; -{ - int i; - - for (i = 0; i <= MAX_STDEBUG_BREAKPOINTS; i++) - if (breakaddr[i] == 0) - { - breakaddr[i] = addr; - - st2000_read_inferior_memory(addr, shadow, memory_breakpoint_size); - printf_stdebug("BR %x H\r", addr); - expect_prompt(1); - return 0; - } - - fprintf(stderr, "Too many breakpoints (> 16) for STDBUG\n"); - return 1; -} - -static int -st2000_remove_breakpoint (addr, shadow) - CORE_ADDR addr; - char *shadow; -{ - int i; - - for (i = 0; i < MAX_STDEBUG_BREAKPOINTS; i++) - if (breakaddr[i] == addr) - { - breakaddr[i] = 0; - - printf_stdebug("CB %d\r", i); - expect_prompt(1); - return 0; - } - - fprintf(stderr, "Can't find breakpoint associated with 0x%x\n", addr); - return 1; -} - - -/* Put a command string, in args, out to STDBUG. Output from STDBUG is placed - on the users terminal until the prompt is seen. */ - -static void -st2000_command (args, fromtty) - char *args; - int fromtty; -{ - if (!st2000_desc) - error("st2000 target not open."); - - if (!args) - error("Missing command."); - - printf_stdebug("%s\r", args); - expect_prompt(0); -} - -/* Connect the user directly to STDBUG. This command acts just like the - 'cu' or 'tip' command. Use ~. or ~^D to break out. */ - -/*static struct ttystate ttystate;*/ - -static void -cleanup_tty() -{ - printf("\r\n[Exiting connect mode]\r\n"); -/* SERIAL_RESTORE(0, &ttystate);*/ -} - -#if 0 -/* This all should now be in serial.c */ - -static void -connect_command (args, fromtty) - char *args; - int fromtty; -{ - fd_set readfds; - int numfds; - int c; - char cur_esc = 0; - - dont_repeat(); - - if (st2000_desc < 0) - error("st2000 target not open."); - - if (args) - fprintf("This command takes no args. They have been ignored.\n"); - - printf("[Entering connect mode. Use ~. or ~^D to escape]\n"); - - serial_raw(0, &ttystate); - - make_cleanup(cleanup_tty, 0); - - FD_ZERO(&readfds); - - while (1) - { - do - { - FD_SET(0, &readfds); - FD_SET(st2000_desc, &readfds); - numfds = select(sizeof(readfds)*8, &readfds, 0, 0, 0); - } - while (numfds == 0); - - if (numfds < 0) - perror_with_name("select"); - - if (FD_ISSET(0, &readfds)) - { /* tty input, send to stdebug */ - c = getchar(); - if (c < 0) - perror_with_name("connect"); - - printf_stdebug("%c", c); - switch (cur_esc) - { - case 0: - if (c == '\r') - cur_esc = c; - break; - case '\r': - if (c == '~') - cur_esc = c; - else - cur_esc = 0; - break; - case '~': - if (c == '.' || c == '\004') - return; - else - cur_esc = 0; - } - } - - if (FD_ISSET(st2000_desc, &readfds)) - { - while (1) - { - c = readchar(0); - if (c < 0) - break; - putchar(c); - } - fflush(stdout); - } - } -} -#endif /* 0 */ - -/* Define the target subroutine names */ - -struct target_ops st2000_ops = { - "st2000", - "Remote serial Tandem ST2000 target", - "Use a remote computer running STDEBUG connected by a serial line,\n\ -or a network connection.\n\ -Arguments are the name of the device for the serial line,\n\ -the speed to connect at in bits per second.", - st2000_open, - st2000_close, - 0, - st2000_detach, - st2000_resume, - st2000_wait, - st2000_fetch_register, - st2000_store_register, - st2000_prepare_to_store, - st2000_xfer_inferior_memory, - st2000_files_info, - st2000_insert_breakpoint, - st2000_remove_breakpoint, /* Breakpoints */ - 0, - 0, - 0, - 0, - 0, /* Terminal handling */ - st2000_kill, - 0, /* load */ - 0, /* lookup_symbol */ - st2000_create_inferior, - st2000_mourn_inferior, - 0, /* can_run */ - 0, /* notice_signals */ - 0, /* to_stop */ - process_stratum, - 0, /* next */ - 1, - 1, - 1, - 1, - 1, /* all mem, mem, stack, regs, exec */ - 0, - 0, /* Section pointers */ - OPS_MAGIC, /* Always the last thing */ -}; - -void -_initialize_remote_st2000 () -{ - add_target (&st2000_ops); - add_com ("st2000 ", class_obscure, st2000_command, - "Send a command to the STDBUG monitor."); - add_com ("connect", class_obscure, connect_command, - "Connect the terminal directly up to the STDBUG command monitor.\n\ -Use ~. or ~^D to break out."); -} diff --git a/contrib/gdb/gdb/remote-udi.c b/contrib/gdb/gdb/remote-udi.c deleted file mode 100644 index 9512023..0000000 --- a/contrib/gdb/gdb/remote-udi.c +++ /dev/null @@ -1,1689 +0,0 @@ -/* Remote debugging interface for AMD 29k interfaced via UDI, for GDB. - Copyright 1990, 1992, 1995 Free Software Foundation, Inc. - Written by Daniel Mann. Contributed by AMD. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* This is like remote.c but uses the Universal Debug Interface (UDI) to - talk to the target hardware (or simulator). UDI is a TCP/IP based - protocol; for hardware that doesn't run TCP, an interface adapter - daemon talks UDI on one side, and talks to the hardware (typically - over a serial port) on the other side. - - - Originally written by Daniel Mann at AMD for MiniMON and gdb 3.91.6. - - David Wood (wood@lab.ultra.nyu.edu) at New York University adapted this - file to gdb 3.95. I was unable to get this working on sun3os4 - with termio, only with sgtty. - - Daniel Mann at AMD took the 3.95 adaptions above and replaced - MiniMON interface with UDI-p interface. */ - -#include "defs.h" -#include "frame.h" -#include "inferior.h" -#include "wait.h" -#include "value.h" -#include -#include -#include -#include -#include "gdb_string.h" -#include "terminal.h" -#include "target.h" -#include "29k-share/udi/udiproc.h" -#include "gdbcmd.h" -#include "bfd.h" -#include "gdbcore.h" /* For download function */ - -/* access the register store directly, without going through - the normal handler functions. This avoids an extra data copy. */ - -extern int stop_soon_quietly; /* for wait_for_inferior */ -extern struct value *call_function_by_hand(); -static void udi_resume PARAMS ((int pid, int step, enum target_signal sig)); -static void udi_fetch_registers PARAMS ((int regno)); -static void udi_load PARAMS ((char *args, int from_tty)); -static void fetch_register PARAMS ((int regno)); -static void udi_store_registers PARAMS ((int regno)); -static int store_register PARAMS ((int regno)); -static int regnum_to_srnum PARAMS ((int regno)); -static void udi_close PARAMS ((int quitting)); -static CPUSpace udi_memory_space PARAMS ((CORE_ADDR addr)); -static int udi_write_inferior_memory PARAMS ((CORE_ADDR memaddr, char *myaddr, - int len)); -static int udi_read_inferior_memory PARAMS ((CORE_ADDR memaddr, char *myaddr, - int len)); -static void download PARAMS ((char *load_arg_string, int from_tty)); -char CoffFileName[100] = ""; - -#define FREEZE_MODE (read_register(CPS_REGNUM) & 0x400) -#define USE_SHADOW_PC ((processor_type == a29k_freeze_mode) && FREEZE_MODE) - -static int timeout = 5; -extern struct target_ops udi_ops; /* Forward declaration */ - -/* Special register enumeration. -*/ - -/******************************************************************* UDI DATA*/ -#define MAXDATA 2*1024 /* max UDI[read/write] byte size */ -/* Descriptor for I/O to remote machine. Initialize it to -1 so that - udi_open knows that we don't have a file open when the program - starts. */ - -UDISessionId udi_session_id = -1; -static char *udi_config_id; - -CPUOffset IMemStart = 0; -CPUSizeT IMemSize = 0; -CPUOffset DMemStart = 0; -CPUSizeT DMemSize = 0; -CPUOffset RMemStart = 0; -CPUSizeT RMemSize = 0; -UDIUInt32 CPUPRL; -UDIUInt32 CoProcPRL; - -UDIMemoryRange address_ranges[2]; /* Text and data */ -UDIResource entry = {0, 0}; /* Entry point */ -CPUSizeT stack_sizes[2]; /* Regular and memory stacks */ - -#define SBUF_MAX 1024 /* maximum size of string handling buffer */ -char sbuf[SBUF_MAX]; - -typedef struct bkpt_entry_str -{ - UDIResource Addr; - UDIUInt32 PassCount; - UDIBreakType Type; - unsigned int BreakId; -} bkpt_entry_t; -#define BKPT_TABLE_SIZE 40 -static bkpt_entry_t bkpt_table[BKPT_TABLE_SIZE]; -extern char dfe_errmsg[]; /* error string */ - -/* malloc'd name of the program on the remote system. */ -static char *prog_name = NULL; - -/* This is called not only when we first attach, but also when the - user types "run" after having attached. */ - -static void -udi_create_inferior (execfile, args, env) - char *execfile; - char *args; - char **env; -{ - char *args1; - - if (execfile) - { - if (prog_name != NULL) - free (prog_name); - prog_name = savestring (execfile, strlen (execfile)); - } - else if (entry.Offset) - execfile = ""; - else - error ("No image loaded into target."); - - if (udi_session_id < 0) - { - /* If the TIP is not open, open it. */ - if (UDIConnect (udi_config_id, &udi_session_id)) - error("UDIConnect() failed: %s\n", dfe_errmsg); - /* We will need to download the program. */ - entry.Offset = 0; - } - - inferior_pid = 40000; - - if (!entry.Offset) - download(execfile, 0); - - args1 = alloca (strlen(execfile) + strlen(args) + 2); - - if (execfile[0] == '\0') - - /* It is empty. We need to quote it somehow, or else the target - will think there is no argument being passed here. According - to the UDI spec it is quoted "according to TIP OS rules" which - I guess means quoting it like the Unix shell should work - (sounds pretty bogus to me...). In fact it doesn't work (with - isstip anyway), but passing in two quotes as the argument seems - like a reasonable enough behavior anyway (I guess). */ - - strcpy (args1, "''"); - else - strcpy (args1, execfile); - strcat (args1, " "); - strcat (args1, args); - - UDIInitializeProcess (address_ranges, /* ProcessMemory[] */ - (UDIInt)2, /* NumberOfRanges */ - entry, /* EntryPoint */ - stack_sizes, /* *StackSizes */ - (UDIInt)2, /* NumberOfStacks */ - args1); /* ArgString */ - - init_wait_for_inferior (); - clear_proceed_status (); - proceed (-1, TARGET_SIGNAL_DEFAULT, 0); -} - -static void -udi_mourn() -{ -#if 0 - /* Requiring "target udi" each time you run is a major pain. I suspect - this was just blindy copied from remote.c, in which "target" and - "run" are combined. Having a udi target without an inferior seems - to work between "target udi" and "run", so why not now? */ - pop_target (); /* Pop back to no-child state */ -#endif - /* But if we're going to want to run it again, we better remove the - breakpoints... */ - remove_breakpoints (); - generic_mourn_inferior (); -} - -/******************************************************************** UDI_OPEN -** Open a connection to remote TIP. - NAME is the socket domain used for communication with the TIP, - then a space and the socket name or TIP-host name. - '' for example. - */ - -/* XXX - need cleanups for udiconnect for various failures!!! */ - -static void -udi_open (name, from_tty) - char *name; - int from_tty; -{ - unsigned int prl; - char *p; - int cnt; - UDIMemoryRange KnownMemory[10]; - UDIUInt32 ChipVersions[10]; - UDIInt NumberOfRanges = 10; - UDIInt NumberOfChips = 10; - UDIPId PId; - UDIUInt32 TIPId, TargetId, DFEId, DFE, TIP, DFEIPCId, TIPIPCId; - - target_preopen(from_tty); - - entry.Offset = 0; - - for (cnt = 0; cnt < BKPT_TABLE_SIZE; cnt++) - bkpt_table[cnt].Type = 0; - - if (udi_config_id) - free (udi_config_id); - - if (!name) - error("Usage: target udi config_id, where config_id appears in udi_soc file"); - - udi_config_id = strdup (strtok (name, " \t")); - - if (UDIConnect (udi_config_id, &udi_session_id)) - /* FIXME: Should set udi_session_id to -1 here. */ - error("UDIConnect() failed: %s\n", dfe_errmsg); - - push_target (&udi_ops); - - /* - ** Initialize target configuration structure (global) - */ - if (UDIGetTargetConfig (KnownMemory, &NumberOfRanges, - ChipVersions, &NumberOfChips)) - error ("UDIGetTargetConfig() failed"); - if (NumberOfChips > 2) - fprintf_unfiltered(gdb_stderr,"Target has more than one processor\n"); - for (cnt=0; cnt < NumberOfRanges; cnt++) - { - switch(KnownMemory[cnt].Space) - { - default: - fprintf_unfiltered(gdb_stderr, "UDIGetTargetConfig() unknown memory space\n"); - break; - case UDI29KCP_S: - break; - case UDI29KIROMSpace: - RMemStart = KnownMemory[cnt].Offset; - RMemSize = KnownMemory[cnt].Size; - break; - case UDI29KIRAMSpace: - IMemStart = KnownMemory[cnt].Offset; - IMemSize = KnownMemory[cnt].Size; - break; - case UDI29KDRAMSpace: - DMemStart = KnownMemory[cnt].Offset; - DMemSize = KnownMemory[cnt].Size; - break; - } - } - - a29k_get_processor_type (); - - if (UDICreateProcess (&PId)) - fprintf_unfiltered(gdb_stderr, "UDICreateProcess() failed\n"); - - /* Print out some stuff, letting the user now what's going on */ - if (UDICapabilities (&TIPId, &TargetId, DFEId, DFE, &TIP, &DFEIPCId, - &TIPIPCId, sbuf)) - error ("UDICapabilities() failed"); - if (from_tty) - { - printf_filtered ("Connected via UDI socket,\n\ - DFE-IPC version %x.%x.%x TIP-IPC version %x.%x.%x TIP version %x.%x.%x\n %s\n", - (DFEIPCId>>8)&0xf, (DFEIPCId>>4)&0xf, DFEIPCId&0xf, - (TIPIPCId>>8)&0xf, (TIPIPCId>>4)&0xf, TIPIPCId&0xf, - (TargetId>>8)&0xf, (TargetId>>4)&0xf, TargetId&0xf, - sbuf); - } -} - -/******************************************************************* UDI_CLOSE - Close the open connection to the TIP process. - Use this when you want to detach and do something else - with your gdb. */ -static void -udi_close (quitting) /*FIXME: how is quitting used */ - int quitting; -{ - if (udi_session_id < 0) - return; - - /* We should never get here if there isn't something valid in - udi_session_id. */ - - if (UDIDisconnect (udi_session_id, UDITerminateSession)) - { - if (quitting) - warning ("UDIDisconnect() failed in udi_close"); - else - error ("UDIDisconnect() failed in udi_close"); - } - - /* Do not try to close udi_session_id again, later in the program. */ - udi_session_id = -1; - inferior_pid = 0; - - printf_filtered (" Ending remote debugging\n"); -} - -/**************************************************************** UDI_ATACH */ -/* Attach to a program that is already loaded and running - * Upon exiting the process's execution is stopped. - */ -static void -udi_attach (args, from_tty) - char *args; - int from_tty; -{ - UDIResource From; - UDIInt32 PC_adds; - UDICount Count = 1; - UDISizeT Size = 4; - UDICount CountDone; - UDIBool HostEndian = 0; - UDIError err; - - if (args == NULL) - error_no_arg ("program to attach"); - - if (udi_session_id < 0) - error ("UDI connection not opened yet, use the 'target udi' command.\n"); - - if (from_tty) - printf_unfiltered ("Attaching to remote program %s...\n", prog_name); - - UDIStop(); - From.Space = UDI29KSpecialRegs; - From.Offset = 11; - if (err = UDIRead(From, &PC_adds, Count, Size, &CountDone, HostEndian)) - error ("UDIRead failed in udi_attach"); - printf_unfiltered ("Remote process is now halted, pc1 = 0x%x.\n", PC_adds); -} -/************************************************************* UDI_DETACH */ -/* Terminate the open connection to the TIP process. - Use this when you want to detach and do something else - with your gdb. Leave remote process running (with no breakpoints set). */ -static void -udi_detach (args,from_tty) - char *args; - int from_tty; -{ - - remove_breakpoints(); /* Just in case there were any left in */ - - if (UDIDisconnect (udi_session_id, UDIContinueSession)) - error ("UDIDisconnect() failed in udi_detach"); - - /* Don't try to UDIDisconnect it again in udi_close, which is called from - pop_target. */ - udi_session_id = -1; - inferior_pid = 0; - - pop_target(); - - if (from_tty) - printf_unfiltered ("Detaching from TIP\n"); -} - - -/****************************************************************** UDI_RESUME -** Tell the remote machine to resume. */ - -static void -udi_resume (pid, step, sig) - int pid, step; - enum target_signal sig; -{ - UDIError tip_error; - UDIUInt32 Steps = 1; - UDIStepType StepType = UDIStepNatural; - UDIRange Range; - - if (step) /* step 1 instruction */ - { - tip_error = UDIStep (Steps, StepType, Range); - if (!tip_error) - return; - - fprintf_unfiltered (gdb_stderr, "UDIStep() error = %d\n", tip_error); - error ("failed in udi_resume"); - } - - if (UDIExecute()) - error ("UDIExecute() failed in udi_resume"); -} - -/******************************************************************** UDI_WAIT -** Wait until the remote machine stops, then return, - storing status in STATUS just as `wait' would. */ - -static int -udi_wait (pid, status) - int pid; - struct target_waitstatus *status; -{ - UDIInt32 MaxTime; - UDIPId PId; - UDIInt32 StopReason; - UDISizeT CountDone; - int old_timeout = timeout; - int old_immediate_quit = immediate_quit; - int i; - - status->kind = TARGET_WAITKIND_EXITED; - status->value.integer = 0; - -/* wait for message to arrive. It should be: - If the target stops executing, udi_wait() should return. -*/ - timeout = 0; /* Wait indefinetly for a message */ - immediate_quit = 1; /* Helps ability to QUIT */ - - while(1) - { - i = 0; - MaxTime = UDIWaitForever; - UDIWait(MaxTime, &PId, &StopReason); - QUIT; /* Let user quit if they want */ - - switch (StopReason & UDIGrossState) - { - case UDIStdoutReady: - if (UDIGetStdout (sbuf, (UDISizeT)SBUF_MAX, &CountDone)) - /* This is said to happen if the program tries to output - a whole bunch of output (more than SBUF_MAX, I would - guess). It doesn't seem to happen with the simulator. */ - warning ("UDIGetStdout() failed in udi_wait"); - fwrite (sbuf, 1, CountDone, gdb_stdout); - gdb_flush(gdb_stdout); - continue; - - case UDIStderrReady: - UDIGetStderr (sbuf, (UDISizeT)SBUF_MAX, &CountDone); - fwrite (sbuf, 1, CountDone, gdb_stderr); - gdb_flush(gdb_stderr); - continue; - - case UDIStdinNeeded: - { - int ch; - i = 0; - do - { - ch = getchar (); - if (ch == EOF) - break; - sbuf[i++] = ch; - } while (i < SBUF_MAX && ch != '\n'); - UDIPutStdin (sbuf, (UDISizeT)i, &CountDone); - continue; - } - - case UDIRunning: - /* In spite of the fact that we told UDIWait to wait forever, it will - return spuriously sometimes. */ - case UDIStdinModeX: - continue; - default: - break; - } - break; - } - - switch (StopReason & UDIGrossState) - { - case UDITrapped: - printf_unfiltered("Am290*0 received vector number %d\n", StopReason >> 24); - - switch ((StopReason >> 8 ) & 0xff) - { - case 0: /* Illegal opcode */ - printf_unfiltered(" (break point)\n"); - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_TRAP; - break; - case 1: /* Unaligned Access */ - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_BUS; - break; - case 3: - case 4: - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_FPE; - break; - case 5: /* Protection Violation */ - status->kind = TARGET_WAITKIND_STOPPED; - /* Why not SEGV? What is a Protection Violation? */ - status->value.sig = TARGET_SIGNAL_ILL; - break; - case 6: - case 7: - case 8: /* User Instruction Mapping Miss */ - case 9: /* User Data Mapping Miss */ - case 10: /* Supervisor Instruction Mapping Miss */ - case 11: /* Supervisor Data Mapping Miss */ - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_SEGV; - break; - case 12: - case 13: - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_ILL; - break; - case 14: /* Timer */ - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_ALRM; - break; - case 15: /* Trace */ - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_TRAP; - break; - case 16: /* INTR0 */ - case 17: /* INTR1 */ - case 18: /* INTR2 */ - case 19: /* INTR3/Internal */ - case 20: /* TRAP0 */ - case 21: /* TRAP1 */ - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_INT; - break; - case 22: /* Floating-Point Exception */ - status->kind = TARGET_WAITKIND_STOPPED; - /* Why not FPE? */ - status->value.sig = TARGET_SIGNAL_ILL; - break; - case 77: /* assert 77 */ - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_TRAP; - break; - default: - status->kind = TARGET_WAITKIND_EXITED; - status->value.integer = 0; - } - break; - case UDINotExecuting: - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_TERM; - break; - case UDIStopped: - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_TSTP; - break; - case UDIWarned: - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_URG; - break; - case UDIStepped: - case UDIBreak: - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_TRAP; - break; - case UDIWaiting: - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_STOP; - break; - case UDIHalted: - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_KILL; - break; - case UDIExited: - default: - status->kind = TARGET_WAITKIND_EXITED; - status->value.integer = 0; - } - - timeout = old_timeout; /* Restore original timeout value */ - immediate_quit = old_immediate_quit; - return inferior_pid; -} - -#if 0 -/* Handy for debugging */ -udi_pc() -{ - UDIResource From; - UDIUInt32 *To; - UDICount Count; - UDISizeT Size = 4; - UDICount CountDone; - UDIBool HostEndian = 0; - UDIError err; - int pc[2]; - unsigned long myregs[256]; - int i; - - From.Space = UDI29KPC; - From.Offset = 0; - To = (UDIUInt32 *)pc; - Count = 2; - - err = UDIRead(From, To, Count, Size, &CountDone, HostEndian); - - printf_unfiltered ("err = %d, CountDone = %d, pc[0] = 0x%x, pc[1] = 0x%x\n", - err, CountDone, pc[0], pc[1]); - - udi_fetch_registers(-1); - - printf_unfiltered("other pc1 = 0x%x, pc0 = 0x%x\n", *(int *)®isters[4 * PC_REGNUM], - *(int *)®isters[4 * NPC_REGNUM]); - - /* Now, read all the registers globally */ - - From.Space = UDI29KGlobalRegs; - From.Offset = 0; - err = UDIRead(From, myregs, 256, 4, &CountDone, HostEndian); - - printf ("err = %d, CountDone = %d\n", err, CountDone); - - printf("\n"); - - for (i = 0; i < 256; i += 2) - printf("%d:\t%#10x\t%11d\t%#10x\t%11d\n", i, myregs[i], myregs[i], - myregs[i+1], myregs[i+1]); - printf("\n"); - - return pc[0]; -} -#endif - -/********************************************************** UDI_FETCH_REGISTERS - * Read a remote register 'regno'. - * If regno==-1 then read all the registers. - */ -static void -udi_fetch_registers (regno) -int regno; -{ - UDIResource From; - UDIUInt32 *To; - UDICount Count; - UDISizeT Size = 4; - UDICount CountDone; - UDIBool HostEndian = 0; - UDIError err; - int i; - - if (regno >= 0) { - fetch_register(regno); - return; - } - -/* Gr1/rsp */ - - From.Space = UDI29KGlobalRegs; - From.Offset = 1; - To = (UDIUInt32 *)®isters[4 * GR1_REGNUM]; - Count = 1; - if (err = UDIRead(From, To, Count, Size, &CountDone, HostEndian)) - error("UDIRead() failed in udi_fetch_registers"); - - register_valid[GR1_REGNUM] = 1; - -#if defined(GR64_REGNUM) /* Read gr64-127 */ - -/* Global Registers gr64-gr95 */ - - From.Space = UDI29KGlobalRegs; - From.Offset = 64; - To = (UDIUInt32 *)®isters[4 * GR64_REGNUM]; - Count = 32; - if (err = UDIRead(From, To, Count, Size, &CountDone, HostEndian)) - error("UDIRead() failed in udi_fetch_registers"); - - for (i = GR64_REGNUM; i < GR64_REGNUM + 32; i++) - register_valid[i] = 1; - -#endif /* GR64_REGNUM */ - -/* Global Registers gr96-gr127 */ - - From.Space = UDI29KGlobalRegs; - From.Offset = 96; - To = (UDIUInt32 *)®isters[4 * GR96_REGNUM]; - Count = 32; - if (err = UDIRead(From, To, Count, Size, &CountDone, HostEndian)) - error("UDIRead() failed in udi_fetch_registers"); - - for (i = GR96_REGNUM; i < GR96_REGNUM + 32; i++) - register_valid[i] = 1; - -/* Local Registers */ - - From.Space = UDI29KLocalRegs; - From.Offset = 0; - To = (UDIUInt32 *)®isters[4 * LR0_REGNUM]; - Count = 128; - if (err = UDIRead(From, To, Count, Size, &CountDone, HostEndian)) - error("UDIRead() failed in udi_fetch_registers"); - - for (i = LR0_REGNUM; i < LR0_REGNUM + 128; i++) - register_valid[i] = 1; - -/* Protected Special Registers */ - - From.Space = UDI29KSpecialRegs; - From.Offset = 0; - To = (UDIUInt32 *)®isters[4 * SR_REGNUM(0)]; - Count = 15; - if (err = UDIRead(From, To, Count, Size, &CountDone, HostEndian)) - error("UDIRead() failed in udi_fetch_registers"); - - for (i = SR_REGNUM(0); i < SR_REGNUM(0) + 15; i++) - register_valid[i] = 1; - - if (USE_SHADOW_PC) { /* Let regno_to_srnum() handle the register number */ - fetch_register(NPC_REGNUM); - fetch_register(PC_REGNUM); - fetch_register(PC2_REGNUM); - -/* Unprotected Special Registers sr128-sr135 */ - - From.Space = UDI29KSpecialRegs; - From.Offset = 128; - To = (UDIUInt32 *)®isters[4 * SR_REGNUM(128)]; - Count = 135-128 + 1; - if (err = UDIRead(From, To, Count, Size, &CountDone, HostEndian)) - error("UDIRead() failed in udi_fetch_registers"); - - for (i = SR_REGNUM(128); i < SR_REGNUM(128) + 135-128+1; i++) - register_valid[i] = 1; - } - - if (remote_debug) - { - printf_unfiltered("Fetching all registers\n"); - printf_unfiltered("Fetching PC0 = 0x%x, PC1 = 0x%x, PC2 = 0x%x\n", - read_register(NPC_REGNUM), read_register(PC_REGNUM), - read_register(PC2_REGNUM)); - } - - /* There doesn't seem to be any way to get these. */ - { - int val = -1; - supply_register (FPE_REGNUM, (char *) &val); - supply_register (INTE_REGNUM, (char *) &val); - supply_register (FPS_REGNUM, (char *) &val); - supply_register (EXO_REGNUM, (char *) &val); - } -} - - -/********************************************************* UDI_STORE_REGISTERS -** Store register regno into the target. - * If regno==-1 then store all the registers. - */ - -static void -udi_store_registers (regno) -int regno; -{ - UDIUInt32 *From; - UDIResource To; - UDICount Count; - UDISizeT Size = 4; - UDICount CountDone; - UDIBool HostEndian = 0; - - if (regno >= 0) - { - store_register(regno); - return; - } - - if (remote_debug) - { - printf_unfiltered("Storing all registers\n"); - printf_unfiltered("PC0 = 0x%x, PC1 = 0x%x, PC2 = 0x%x\n", read_register(NPC_REGNUM), - read_register(PC_REGNUM), read_register(PC2_REGNUM)); - } - -/* Gr1/rsp */ - - From = (UDIUInt32 *)®isters[4 * GR1_REGNUM]; - To.Space = UDI29KGlobalRegs; - To.Offset = 1; - Count = 1; - if(UDIWrite(From, To, Count, Size, &CountDone, HostEndian)) - error("UDIWrite() failed in udi_store_regisetrs"); - -#if defined(GR64_REGNUM) - -/* Global registers gr64-gr95 */ - - From = (UDIUInt32 *)®isters[4 * GR64_REGNUM]; - To.Space = UDI29KGlobalRegs; - To.Offset = 64; - Count = 32; - if(UDIWrite(From, To, Count, Size, &CountDone, HostEndian)) - error("UDIWrite() failed in udi_store_regisetrs"); - -#endif /* GR64_REGNUM */ - -/* Global registers gr96-gr127 */ - - From = (UDIUInt32 *)®isters[4 * GR96_REGNUM]; - To.Space = UDI29KGlobalRegs; - To.Offset = 96; - Count = 32; - if(UDIWrite(From, To, Count, Size, &CountDone, HostEndian)) - error("UDIWrite() failed in udi_store_regisetrs"); - -/* Local Registers */ - - From = (UDIUInt32 *)®isters[4 * LR0_REGNUM]; - To.Space = UDI29KLocalRegs; - To.Offset = 0; - Count = 128; - if(UDIWrite(From, To, Count, Size, &CountDone, HostEndian)) - error("UDIWrite() failed in udi_store_regisetrs"); - - -/* Protected Special Registers */ /* VAB through TMR */ - - From = (UDIUInt32 *)®isters[4 * SR_REGNUM(0)]; - To.Space = UDI29KSpecialRegs; - To.Offset = 0; - Count = 10; - if(UDIWrite(From, To, Count, Size, &CountDone, HostEndian)) - error("UDIWrite() failed in udi_store_regisetrs"); - -/* PC0, PC1, PC2 possibly as shadow registers */ - - From = (UDIUInt32 *)®isters[4 * SR_REGNUM(10)]; - To.Space = UDI29KSpecialRegs; - Count = 3; - if (USE_SHADOW_PC) - To.Offset = 20; /* SPC0 */ - else - To.Offset = 10; /* PC0 */ - if(UDIWrite(From, To, Count, Size, &CountDone, HostEndian)) - error("UDIWrite() failed in udi_store_regisetrs"); - -/* PC1 via UDI29KPC */ - - From = (UDIUInt32 *)®isters[4 * PC_REGNUM]; - To.Space = UDI29KPC; - To.Offset = 0; /* PC1 */ - Count = 1; - if (UDIWrite (From, To, Count, Size, &CountDone, HostEndian)) - error ("UDIWrite() failed in udi_store_regisetrs"); - - /* LRU and MMU */ - - From = (UDIUInt32 *)®isters[4 * SR_REGNUM(13)]; - To.Space = UDI29KSpecialRegs; - To.Offset = 13; - Count = 2; - if(UDIWrite(From, To, Count, Size, &CountDone, HostEndian)) - error("UDIWrite() failed in udi_store_regisetrs"); - -/* Unprotected Special Registers */ - - From = (UDIUInt32 *)®isters[4 * SR_REGNUM(128)]; - To.Space = UDI29KSpecialRegs; - To.Offset = 128; - Count = 135-128 +1; - if(UDIWrite(From, To, Count, Size, &CountDone, HostEndian)) - error("UDIWrite() failed in udi_store_regisetrs"); - - registers_changed (); -} - -/****************************************************** UDI_PREPARE_TO_STORE */ -/* Get ready to modify the registers array. On machines which store - individual registers, this doesn't need to do anything. On machines - which store all the registers in one fell swoop, this makes sure - that registers contains all the registers from the program being - debugged. */ - -static void -udi_prepare_to_store () -{ - /* Do nothing, since we can store individual regs */ -} - -/********************************************************** TRANSLATE_ADDR */ -static CORE_ADDR -translate_addr(addr) -CORE_ADDR addr; -{ -#if defined(ULTRA3) && defined(KERNEL_DEBUGGING) - /* Check for a virtual address in the kernel */ - /* Assume physical address of ublock is in paddr_u register */ - /* FIXME: doesn't work for user virtual addresses */ - if (addr >= UVADDR) { - /* PADDR_U register holds the physical address of the ublock */ - CORE_ADDR i = (CORE_ADDR)read_register(PADDR_U_REGNUM); - return(i + addr - (CORE_ADDR)UVADDR); - } else { - return(addr); - } -#else - return(addr); -#endif -} -/************************************************* UDI_XFER_INFERIOR_MEMORY */ -/* FIXME! Merge these two. */ -static int -udi_xfer_inferior_memory (memaddr, myaddr, len, write) - CORE_ADDR memaddr; - char *myaddr; - int len; - int write; -{ - - memaddr = translate_addr(memaddr); - - if (write) - return udi_write_inferior_memory (memaddr, myaddr, len); - else - return udi_read_inferior_memory (memaddr, myaddr, len); -} - -/********************************************************** UDI_FILES_INFO */ -static void -udi_files_info () -{ - printf_unfiltered ("\tAttached to UDI socket to %s", udi_config_id); - if (prog_name != NULL) - printf_unfiltered ("and running program %s", prog_name); - printf_unfiltered (".\n"); -} - -/**************************************************** UDI_INSERT_BREAKPOINT */ -static int -udi_insert_breakpoint (addr, contents_cache) - CORE_ADDR addr; - char *contents_cache; -{ - int cnt; - UDIError err; - - for (cnt = 0; cnt < BKPT_TABLE_SIZE; cnt++) - if (bkpt_table[cnt].Type == 0) /* Find first free slot */ - break; - - if(cnt >= BKPT_TABLE_SIZE) - error("Too many breakpoints set"); - - bkpt_table[cnt].Addr.Offset = addr; - bkpt_table[cnt].Addr.Space = UDI29KIRAMSpace; - bkpt_table[cnt].PassCount = 1; - bkpt_table[cnt].Type = UDIBreakFlagExecute; - - err = UDISetBreakpoint(bkpt_table[cnt].Addr, - bkpt_table[cnt].PassCount, - bkpt_table[cnt].Type, - &bkpt_table[cnt].BreakId); - - if (err == 0) return 0; /* Success */ - - bkpt_table[cnt].Type = 0; - error("UDISetBreakpoint returned error code %d\n", err); -} - -/**************************************************** UDI_REMOVE_BREAKPOINT */ -static int -udi_remove_breakpoint (addr, contents_cache) - CORE_ADDR addr; - char *contents_cache; -{ - int cnt; - UDIError err; - - for (cnt = 0; cnt < BKPT_TABLE_SIZE; cnt++) - if (bkpt_table[cnt].Addr.Offset == addr) /* Find matching breakpoint */ - break; - - if(cnt >= BKPT_TABLE_SIZE) - error("Can't find breakpoint in table"); - - bkpt_table[cnt].Type = 0; - - err = UDIClearBreakpoint(bkpt_table[cnt].BreakId); - if (err == 0) return 0; /* Success */ - - error("UDIClearBreakpoint returned error code %d\n", err); -} - -static void -udi_kill(arg,from_tty) - char *arg; - int from_tty; -{ - -#if 0 -/* -UDIStop does not really work as advertised. It causes the TIP to close it's -connection, which usually results in GDB dying with a SIGPIPE. For now, we -just invoke udi_close, which seems to get things right. -*/ - UDIStop(); - - udi_session_id = -1; - inferior_pid = 0; - - if (from_tty) - printf_unfiltered("Target has been stopped."); -#endif /* 0 */ -#if 0 - udi_close(0); - pop_target(); -#endif /* 0 */ - - /* Keep the target around, e.g. so "run" can do the right thing when - we are already debugging something. */ - - if (UDIDisconnect (udi_session_id, UDITerminateSession)) - { - warning ("UDIDisconnect() failed"); - } - - /* Do not try to close udi_session_id again, later in the program. */ - udi_session_id = -1; - inferior_pid = 0; -} - -/* - Load a program into the target. Args are: `program {options}'. The options - are used to control loading of the program, and are NOT passed onto the - loaded code as arguments. (You need to use the `run' command to do that.) - - The options are: - -ms %d Set mem stack size to %d - -rs %d Set regular stack size to %d - -i send init info (default) - -noi don't send init info - -[tT] Load Text section - -[dD] Load Data section - -[bB] Load BSS section - -[lL] Load Lit section - */ - -static void -download(load_arg_string, from_tty) - char *load_arg_string; - int from_tty; -{ -#define DEFAULT_MEM_STACK_SIZE 0x6000 -#define DEFAULT_REG_STACK_SIZE 0x2000 - - char *token; - char *filename; - asection *section; - bfd *pbfd; - UDIError err; - int load_text = 1, load_data = 1, load_bss = 1, load_lit = 1; - - address_ranges[0].Space = UDI29KIRAMSpace; - address_ranges[0].Offset = 0xffffffff; - address_ranges[0].Size = 0; - - address_ranges[1].Space = UDI29KDRAMSpace; - address_ranges[1].Offset = 0xffffffff; - address_ranges[1].Size = 0; - - stack_sizes[0] = DEFAULT_REG_STACK_SIZE; - stack_sizes[1] = DEFAULT_MEM_STACK_SIZE; - - dont_repeat (); - - filename = strtok(load_arg_string, " \t"); - if (!filename) - error ("Must specify at least a file name with the load command"); - - filename = tilde_expand (filename); - make_cleanup (free, filename); - - while (token = strtok (NULL, " \t")) - { - if (token[0] == '-') - { - token++; - - if (STREQ (token, "ms")) - stack_sizes[1] = atol (strtok (NULL, " \t")); - else if (STREQ (token, "rs")) - stack_sizes[0] = atol (strtok (NULL, " \t")); - else - { - load_text = load_data = load_bss = load_lit = 0; - - while (*token) - { - switch (*token++) - { - case 't': - case 'T': - load_text = 1; - break; - case 'd': - case 'D': - load_data = 1; - break; - case 'b': - case 'B': - load_bss = 1; - break; - case 'l': - case 'L': - load_lit = 1; - break; - default: - error ("Unknown UDI load option -%s", token-1); - } - } - } - } - } - - pbfd = bfd_openr (filename, gnutarget); - - if (!pbfd) - /* FIXME: should be using bfd_errmsg, not assuming it was - bfd_error_system_call. */ - perror_with_name (filename); - - /* FIXME: should be checking for errors from bfd_close (for one thing, - on error it does not free all the storage associated with the - bfd). */ - make_cleanup (bfd_close, pbfd); - - QUIT; - immediate_quit++; - - if (!bfd_check_format (pbfd, bfd_object)) - error ("It doesn't seem to be an object file"); - - for (section = pbfd->sections; section; section = section->next) - { - if (bfd_get_section_flags (pbfd, section) & SEC_ALLOC) - { - UDIResource To; - UDICount Count; - unsigned long section_size, section_end; - const char *section_name; - - section_name = bfd_get_section_name (pbfd, section); - if (STREQ (section_name, ".text") && !load_text) - continue; - else if (STREQ (section_name, ".data") && !load_data) - continue; - else if (STREQ (section_name, ".bss") && !load_bss) - continue; - else if (STREQ (section_name, ".lit") && !load_lit) - continue; - - To.Offset = bfd_get_section_vma (pbfd, section); - section_size = bfd_section_size (pbfd, section); - section_end = To.Offset + section_size; - - if (section_size == 0) - /* This is needed at least in the BSS case, where the code - below starts writing before it even checks the size. */ - continue; - - printf_unfiltered("[Loading section %s at %x (%d bytes)]\n", - section_name, - To.Offset, - section_size); - - if (bfd_get_section_flags (pbfd, section) & SEC_CODE) - { - To.Space = UDI29KIRAMSpace; - - address_ranges[0].Offset = min (address_ranges[0].Offset, - To.Offset); - address_ranges[0].Size = max (address_ranges[0].Size, - section_end - - address_ranges[0].Offset); - } - else - { - To.Space = UDI29KDRAMSpace; - - address_ranges[1].Offset = min (address_ranges[1].Offset, - To.Offset); - address_ranges[1].Size = max (address_ranges[1].Size, - section_end - - address_ranges[1].Offset); - } - - if (bfd_get_section_flags (pbfd, section) & SEC_LOAD) /* Text, data or lit */ - { - file_ptr fptr; - - fptr = 0; - - while (section_size > 0) - { - char buffer[1024]; - - Count = min (section_size, 1024); - - bfd_get_section_contents (pbfd, section, buffer, fptr, - Count); - - err = UDIWrite ((UDIHostMemPtr)buffer, /* From */ - To, /* To */ - Count, /* Count */ - (UDISizeT)1, /* Size */ - &Count, /* CountDone */ - (UDIBool)0); /* HostEndian */ - if (err) - error ("UDIWrite failed, error = %d", err); - - To.Offset += Count; - fptr += Count; - section_size -= Count; - } - } - else /* BSS */ - { - UDIResource From; - unsigned long zero = 0; - - /* Write a zero byte at the vma */ - /* FIXME: Broken for sections of 1-3 bytes (we test for - zero above). */ - err = UDIWrite ((UDIHostMemPtr)&zero, /* From */ - To, /* To */ - (UDICount)1, /* Count */ - (UDISizeT)4, /* Size */ - &Count, /* CountDone */ - (UDIBool)0); /* HostEndian */ - if (err) - error ("UDIWrite failed, error = %d", err); - - From = To; - To.Offset+=4; - - /* Now, duplicate it for the length of the BSS */ - err = UDICopy (From, /* From */ - To, /* To */ - (UDICount)(section_size/4 - 1), /* Count */ - (UDISizeT)4, /* Size */ - &Count, /* CountDone */ - (UDIBool)1); /* Direction */ - if (err) - { - char message[100]; - int xerr; - - xerr = UDIGetErrorMsg(err, 100, message, &Count); - if (!xerr) - fprintf_unfiltered (gdb_stderr, "Error is %s\n", message); - else - fprintf_unfiltered (gdb_stderr, "xerr is %d\n", xerr); - error ("UDICopy failed, error = %d", err); - } - } - - } - } - - entry.Space = UDI29KIRAMSpace; - entry.Offset = bfd_get_start_address (pbfd); - - immediate_quit--; -} - -/* Function to download an image into the remote target. */ - -static void -udi_load (args, from_tty) - char *args; - int from_tty; -{ - download (args, from_tty); - - /* As a convenience, pick up any symbol info that is in the program - being loaded. Note that we assume that the program is the``mainline''; - if this is not always true, then this code will need to be augmented. */ - symbol_file_add (strtok (args, " \t"), from_tty, 0, 1, 0, 0); - - /* Getting new symbols may change our opinion about what is - frameless. */ - reinit_frame_cache (); -} - -/*************************************************** UDI_WRITE_INFERIOR_MEMORY -** Copy LEN bytes of data from debugger memory at MYADDR - to inferior's memory at MEMADDR. Returns number of bytes written. */ -static int -udi_write_inferior_memory (memaddr, myaddr, len) - CORE_ADDR memaddr; - char *myaddr; - int len; -{ - int nwritten = 0; - UDIUInt32 *From; - UDIResource To; - UDICount Count; - UDISizeT Size = 1; - UDICount CountDone = 0; - UDIBool HostEndian = 0; - - To.Space = udi_memory_space(memaddr); - From = (UDIUInt32*)myaddr; - - while (nwritten < len) - { Count = len - nwritten; - if (Count > MAXDATA) Count = MAXDATA; - To.Offset = memaddr + nwritten; - if(UDIWrite(From, To, Count, Size, &CountDone, HostEndian)) - { error("UDIWrite() failed in udi_write_inferior_memory"); - break; - } - else - { nwritten += CountDone; - From += CountDone; - } - } - return(nwritten); -} - -/**************************************************** UDI_READ_INFERIOR_MEMORY -** Read LEN bytes from inferior memory at MEMADDR. Put the result - at debugger address MYADDR. Returns number of bytes read. */ -static int -udi_read_inferior_memory(memaddr, myaddr, len) - CORE_ADDR memaddr; - char *myaddr; - int len; -{ - int nread = 0; - UDIResource From; - UDIUInt32 *To; - UDICount Count; - UDISizeT Size = 1; - UDICount CountDone = 0; - UDIBool HostEndian = 0; - UDIError err; - - From.Space = udi_memory_space(memaddr); - To = (UDIUInt32*)myaddr; - - while (nread < len) - { Count = len - nread; - if (Count > MAXDATA) Count = MAXDATA; - From.Offset = memaddr + nread; - if(err = UDIRead(From, To, Count, Size, &CountDone, HostEndian)) - { error("UDIRead() failed in udi_read_inferior_memory"); - break; - } - else - { nread += CountDone; - To += CountDone; - } - } - return(nread); -} - -/********************************************************************* WARNING -*/ -udi_warning(num) -int num; -{ - error ("ERROR while loading program into remote TIP: $d\n", num); -} - - -/*****************************************************************************/ -/* Fetch a single register indicatated by 'regno'. - * Returns 0/-1 on success/failure. - */ -static void -fetch_register (regno) - int regno; -{ - UDIResource From; - UDIUInt32 To; - UDICount Count = 1; - UDISizeT Size = 4; - UDICount CountDone; - UDIBool HostEndian = 0; - UDIError err; - int result; - - if (regno == GR1_REGNUM) - { - From.Space = UDI29KGlobalRegs; - From.Offset = 1; - } - else if (regno >= GR96_REGNUM && regno < GR96_REGNUM + 32) - { - From.Space = UDI29KGlobalRegs; - From.Offset = (regno - GR96_REGNUM) + 96;; - } - -#if defined(GR64_REGNUM) - - else if (regno >= GR64_REGNUM && regno < GR64_REGNUM + 32 ) - { - From.Space = UDI29KGlobalRegs; - From.Offset = (regno - GR64_REGNUM) + 64; - } - -#endif /* GR64_REGNUM */ - - else if (regno >= LR0_REGNUM && regno < LR0_REGNUM + 128) - { - From.Space = UDI29KLocalRegs; - From.Offset = (regno - LR0_REGNUM); - } - else if (regno>=FPE_REGNUM && regno<=EXO_REGNUM) - { - int val = -1; - /*supply_register(160 + (regno - FPE_REGNUM),(char *) &val);*/ - supply_register(regno, (char *) &val); - return; /* Pretend Success */ - } - else - { - From.Space = UDI29KSpecialRegs; - From.Offset = regnum_to_srnum(regno); - } - - if (err = UDIRead(From, &To, Count, Size, &CountDone, HostEndian)) - error("UDIRead() failed in udi_fetch_registers"); - - supply_register(regno, (char *) &To); - - if (remote_debug) - printf_unfiltered("Fetching register %s = 0x%x\n", reg_names[regno], To); -} -/*****************************************************************************/ -/* Store a single register indicated by 'regno'. - * Returns 0/-1 on success/failure. - */ -static int -store_register (regno) - int regno; -{ - int result; - UDIUInt32 From; - UDIResource To; - UDICount Count = 1; - UDISizeT Size = 4; - UDICount CountDone; - UDIBool HostEndian = 0; - - From = read_register (regno); /* get data value */ - - if (remote_debug) - printf_unfiltered("Storing register %s = 0x%x\n", reg_names[regno], From); - - if (regno == GR1_REGNUM) - { - To.Space = UDI29KGlobalRegs; - To.Offset = 1; - result = UDIWrite(&From, To, Count, Size, &CountDone, HostEndian); - /* Setting GR1 changes the numbers of all the locals, so invalidate the - * register cache. Do this *after* calling read_register, because we want - * read_register to return the value that write_register has just stuffed - * into the registers array, not the value of the register fetched from - * the inferior. - */ - registers_changed (); - } -#if defined(GR64_REGNUM) - else if (regno >= GR64_REGNUM && regno < GR64_REGNUM + 32 ) - { - To.Space = UDI29KGlobalRegs; - To.Offset = (regno - GR64_REGNUM) + 64; - result = UDIWrite(&From, To, Count, Size, &CountDone, HostEndian); - } -#endif /* GR64_REGNUM */ - else if (regno >= GR96_REGNUM && regno < GR96_REGNUM + 32) - { - To.Space = UDI29KGlobalRegs; - To.Offset = (regno - GR96_REGNUM) + 96; - result = UDIWrite(&From, To, Count, Size, &CountDone, HostEndian); - } - else if (regno >= LR0_REGNUM && regno < LR0_REGNUM + 128) - { - To.Space = UDI29KLocalRegs; - To.Offset = (regno - LR0_REGNUM); - result = UDIWrite(&From, To, Count, Size, &CountDone, HostEndian); - } - else if (regno >= FPE_REGNUM && regno <= EXO_REGNUM) - return 0; /* Pretend Success */ - else if (regno == PC_REGNUM) - { - /* PC1 via UDI29KPC */ - - To.Space = UDI29KPC; - To.Offset = 0; /* PC1 */ - result = UDIWrite (&From, To, Count, Size, &CountDone, HostEndian); - - /* Writing to this loc actually changes the values of pc0 & pc1 */ - - register_valid[PC_REGNUM] = 0; /* pc1 */ - register_valid[NPC_REGNUM] = 0; /* pc0 */ - } - else /* An unprotected or protected special register */ - { - To.Space = UDI29KSpecialRegs; - To.Offset = regnum_to_srnum(regno); - result = UDIWrite(&From, To, Count, Size, &CountDone, HostEndian); - } - - if (result != 0) - error("UDIWrite() failed in store_registers"); - - return 0; -} -/********************************************************** REGNUM_TO_SRNUM */ -/* - * Convert a gdb special register number to a 29000 special register number. - */ -static int -regnum_to_srnum(regno) -int regno; -{ - switch(regno) { - case VAB_REGNUM: return(0); - case OPS_REGNUM: return(1); - case CPS_REGNUM: return(2); - case CFG_REGNUM: return(3); - case CHA_REGNUM: return(4); - case CHD_REGNUM: return(5); - case CHC_REGNUM: return(6); - case RBP_REGNUM: return(7); - case TMC_REGNUM: return(8); - case TMR_REGNUM: return(9); - case NPC_REGNUM: return(USE_SHADOW_PC ? (20) : (10)); - case PC_REGNUM: return(USE_SHADOW_PC ? (21) : (11)); - case PC2_REGNUM: return(USE_SHADOW_PC ? (22) : (12)); - case MMU_REGNUM: return(13); - case LRU_REGNUM: return(14); - case IPC_REGNUM: return(128); - case IPA_REGNUM: return(129); - case IPB_REGNUM: return(130); - case Q_REGNUM: return(131); - case ALU_REGNUM: return(132); - case BP_REGNUM: return(133); - case FC_REGNUM: return(134); - case CR_REGNUM: return(135); - case FPE_REGNUM: return(160); - case INTE_REGNUM: return(161); - case FPS_REGNUM: return(162); - case EXO_REGNUM:return(164); - default: - return(255); /* Failure ? */ - } -} -/****************************************************************************/ -/* - * Determine the Target memory space qualifier based on the addr. - * FIXME: Can't distinguis I_ROM/D_ROM. - * FIXME: Doesn't know anything about I_CACHE/D_CACHE. - */ -static CPUSpace -udi_memory_space(addr) -CORE_ADDR addr; -{ - UDIUInt32 tstart = IMemStart; - UDIUInt32 tend = tstart + IMemSize; - UDIUInt32 dstart = DMemStart; - UDIUInt32 dend = tstart + DMemSize; - UDIUInt32 rstart = RMemStart; - UDIUInt32 rend = tstart + RMemSize; - - if (((UDIUInt32)addr >= tstart) && ((UDIUInt32)addr < tend)) { - return UDI29KIRAMSpace; - } else if (((UDIUInt32)addr >= dstart) && ((UDIUInt32)addr < dend)) { - return UDI29KDRAMSpace; - } else if (((UDIUInt32)addr >= rstart) && ((UDIUInt32)addr < rend)) { - /* FIXME: how do we determine between D_ROM and I_ROM */ - return UDI29KIROMSpace; - } else /* FIXME: what do me do now? */ - return UDI29KDRAMSpace; /* Hmmm! */ -} -/*********************************************************************** STUBS -*/ - -void convert16() {;} -void convert32() {;} -GDB_FILE * EchoFile = 0; /* used for debugging */ -int QuietMode = 0; /* used for debugging */ - -#ifdef NO_HIF_SUPPORT -service_HIF(msg) - union msg_t *msg; -{ - return(0); /* Emulate a failure */ -} -#endif - -/* Target_ops vector. Not static because there does not seem to be - any portable way to do a forward declaration of a static variable. - The RS/6000 doesn't like "extern" followed by "static"; SunOS - /bin/cc doesn't like "static" twice. */ - -struct target_ops udi_ops = { - "udi", - "Remote UDI connected TIP", - "Remote debug an AMD 29k using UDI socket connection to TIP process.\n\ -Arguments are\n\ -`configuration-id AF_INET hostname port-number'\n\ - To connect via the network, where hostname and port-number specify the\n\ - host and port where you can connect via UDI.\n\ - configuration-id is unused.\n\ -\n\ -`configuration-id AF_UNIX socket-name tip-program'\n\ - To connect using a local connection to the \"tip.exe\" program which is\n\ - supplied by AMD. If socket-name specifies an AF_UNIX socket then the\n\ - tip program must already be started; connect to it using that socket.\n\ - If not, start up tip-program, which should be the name of the tip\n\ - program. If appropriate, the PATH environment variable is searched.\n\ - configuration-id is unused.\n\ -\n\ -`configuration-id'\n\ - Look up the configuration in ./udi_soc or /etc/udi_soc, which\n\ - are files containing lines in the above formats. configuration-id is\n\ - used to pick which line of the file to use.", - udi_open, - udi_close, - udi_attach, - udi_detach, - udi_resume, - udi_wait, - udi_fetch_registers, - udi_store_registers, - udi_prepare_to_store, - udi_xfer_inferior_memory, - udi_files_info, - udi_insert_breakpoint, - udi_remove_breakpoint, - 0, /* termial_init */ - 0, /* terminal_inferior */ - 0, /* terminal_ours_for_output */ - 0, /* terminal_ours */ - 0, /* terminal_info */ - udi_kill, /* FIXME, kill */ - udi_load, /* to_load */ - 0, /* lookup_symbol */ - udi_create_inferior, - udi_mourn, /* mourn_inferior FIXME */ - 0, /* can_run */ - 0, /* notice_signals */ - 0, /* to_thread_alive */ - 0, /* to_stop */ - process_stratum, - 0, /* next */ - 1, /* has_all_memory */ - 1, /* has_memory */ - 1, /* has_stack */ - 1, /* has_registers */ - 1, /* has_execution */ - 0, /* sections */ - 0, /* sections_end */ - OPS_MAGIC, /* Always the last thing */ -}; - -void -_initialize_remote_udi () -{ - add_target (&udi_ops); -} diff --git a/contrib/gdb/gdb/remote-vx.c b/contrib/gdb/gdb/remote-vx.c deleted file mode 100644 index 13b6c29..0000000 --- a/contrib/gdb/gdb/remote-vx.c +++ /dev/null @@ -1,1488 +0,0 @@ -/* Memory-access and commands for remote VxWorks processes, for GDB. - Copyright 1990, 1991, 1992 Free Software Foundation, Inc. - Contributed by Wind River Systems and Cygnus Support. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without 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 "frame.h" -#include "inferior.h" -#include "wait.h" -#include "target.h" -#include "gdbcore.h" -#include "command.h" -#include "symtab.h" -#include "complaints.h" -#include "gdbcmd.h" -#include "bfd.h" /* Required by objfiles.h. */ -#include "symfile.h" /* Required by objfiles.h. */ -#include "objfiles.h" -#include "gdb-stabs.h" - -#include "gdb_string.h" -#include -#include -#include -#include -#include -#define malloc bogon_malloc /* Sun claims "char *malloc()" not void * */ -#define free bogon_free /* Sun claims "int free()" not void */ -#define realloc bogon_realloc /* Sun claims "char *realloc()", not void * */ -#include -#undef malloc -#undef free -#undef realloc -#include /* UTek's doesn't #incl this */ -#include -#include "vx-share/ptrace.h" -#include "vx-share/xdr_ptrace.h" -#include "vx-share/xdr_ld.h" -#include "vx-share/xdr_rdb.h" -#include "vx-share/dbgRpcLib.h" - -#include - -/* Maximum number of bytes to transfer in a single - PTRACE_{READ,WRITE}DATA request. */ -#define VX_MEMXFER_MAX 4096 - -extern void vx_read_register (); -extern void vx_write_register (); -extern void symbol_file_command (); -extern int stop_soon_quietly; /* for wait_for_inferior */ - -static int net_step (); -static int net_ptrace_clnt_call (); /* Forward decl */ -static enum clnt_stat net_clnt_call (); /* Forward decl */ -extern struct target_ops vx_ops, vx_run_ops; /* Forward declaration */ - -/* Saved name of target host and called function for "info files". - Both malloc'd. */ - -static char *vx_host; -static char *vx_running; /* Called function */ - -/* Nonzero means target that is being debugged remotely has a floating - point processor. */ - -int target_has_fp; - -/* Default error message when the network is forking up. */ - -static const char rpcerr[] = "network target debugging: rpc error"; - -CLIENT *pClient; /* client used in net debugging */ -static int ptraceSock = RPC_ANYSOCK; - -enum clnt_stat net_clnt_call(); -static void parse_args (); - -static struct timeval rpcTimeout = { 10, 0 }; - -static char *skip_white_space (); -static char *find_white_space (); - -/* Tell the VxWorks target system to download a file. - The load addresses of the text, data, and bss segments are - stored in *pTextAddr, *pDataAddr, and *pBssAddr (respectively). - Returns 0 for success, -1 for failure. */ - -static int -net_load (filename, pTextAddr, pDataAddr, pBssAddr) - char *filename; - CORE_ADDR *pTextAddr; - CORE_ADDR *pDataAddr; - CORE_ADDR *pBssAddr; -{ - enum clnt_stat status; - struct ldfile ldstruct; - struct timeval load_timeout; - - memset ((char *) &ldstruct, '\0', sizeof (ldstruct)); - - /* We invoke clnt_call () here directly, instead of through - net_clnt_call (), because we need to set a large timeout value. - The load on the target side can take quite a while, easily - more than 10 seconds. The user can kill this call by typing - CTRL-C if there really is a problem with the load. - - Do not change the tv_sec value without checking -- select() imposes - a limit of 10**8 on it for no good reason that I can see... */ - - load_timeout.tv_sec = 99999999; /* A large number, effectively inf. */ - load_timeout.tv_usec = 0; - - status = clnt_call (pClient, VX_LOAD, xdr_wrapstring, &filename, xdr_ldfile, - &ldstruct, load_timeout); - - if (status == RPC_SUCCESS) - { - if (*ldstruct.name == 0) /* load failed on VxWorks side */ - return -1; - *pTextAddr = ldstruct.txt_addr; - *pDataAddr = ldstruct.data_addr; - *pBssAddr = ldstruct.bss_addr; - return 0; - } - else - return -1; -} - -/* returns 0 if successful, errno if RPC failed or VxWorks complains. */ - -static int -net_break (addr, procnum) - int addr; - u_long procnum; -{ - enum clnt_stat status; - int break_status; - Rptrace ptrace_in; /* XXX This is stupid. It doesn't need to be a ptrace - structure. How about something smaller? */ - - memset ((char *) &ptrace_in, '\0', sizeof (ptrace_in)); - break_status = 0; - - ptrace_in.addr = addr; - ptrace_in.pid = inferior_pid; - - status = net_clnt_call (procnum, xdr_rptrace, &ptrace_in, xdr_int, - &break_status); - - if (status != RPC_SUCCESS) - return errno; - - if (break_status == -1) - return ENOMEM; - return break_status; /* probably (FIXME) zero */ -} - -/* returns 0 if successful, errno otherwise */ - -static int -vx_insert_breakpoint (addr) - int addr; -{ - return net_break (addr, VX_BREAK_ADD); -} - -/* returns 0 if successful, errno otherwise */ - -static int -vx_remove_breakpoint (addr) - int addr; -{ - return net_break (addr, VX_BREAK_DELETE); -} - -/* Start an inferior process and sets inferior_pid to its pid. - EXEC_FILE is the file to run. - ALLARGS is a string containing the arguments to the program. - ENV is the environment vector to pass. - Returns process id. Errors reported with error(). - On VxWorks, we ignore exec_file. */ - -static void -vx_create_inferior (exec_file, args, env) - char *exec_file; - char *args; - char **env; -{ - enum clnt_stat status; - arg_array passArgs; - TASK_START taskStart; - - memset ((char *) &passArgs, '\0', sizeof (passArgs)); - memset ((char *) &taskStart, '\0', sizeof (taskStart)); - - /* parse arguments, put them in passArgs */ - - parse_args (args, &passArgs); - - if (passArgs.arg_array_len == 0) - error ("You must specify a function name to run, and arguments if any"); - - status = net_clnt_call (PROCESS_START, xdr_arg_array, &passArgs, - xdr_TASK_START, &taskStart); - - if ((status != RPC_SUCCESS) || (taskStart.status == -1)) - error ("Can't create process on remote target machine"); - - /* Save the name of the running function */ - vx_running = savestring (passArgs.arg_array_val[0], - strlen (passArgs.arg_array_val[0])); - - push_target (&vx_run_ops); - inferior_pid = taskStart.pid; - - /* We will get a trace trap after one instruction. - Insert breakpoints and continue. */ - - init_wait_for_inferior (); - - /* Set up the "saved terminal modes" of the inferior - based on what modes we are starting it with. */ - target_terminal_init (); - - /* Install inferior's terminal modes. */ - target_terminal_inferior (); - - stop_soon_quietly = 1; - wait_for_inferior (); /* Get the task spawn event */ - stop_soon_quietly = 0; - - /* insert_step_breakpoint (); FIXME, do we need this? */ - proceed (-1, TARGET_SIGNAL_DEFAULT, 0); -} - -/* Fill ARGSTRUCT in argc/argv form with the arguments from the - argument string ARGSTRING. */ - -static void -parse_args (arg_string, arg_struct) - register char *arg_string; - arg_array *arg_struct; -{ - register int arg_count = 0; /* number of arguments */ - register int arg_index = 0; - register char *p0; - - memset ((char *) arg_struct, '\0', sizeof (arg_array)); - - /* first count how many arguments there are */ - - p0 = arg_string; - while (*p0 != '\0') - { - if (*(p0 = skip_white_space (p0)) == '\0') - break; - p0 = find_white_space (p0); - arg_count++; - } - - arg_struct->arg_array_len = arg_count; - arg_struct->arg_array_val = (char **) xmalloc ((arg_count + 1) - * sizeof (char *)); - - /* now copy argument strings into arg_struct. */ - - while (*(arg_string = skip_white_space (arg_string))) - { - p0 = find_white_space (arg_string); - arg_struct->arg_array_val[arg_index++] = savestring (arg_string, - p0 - arg_string); - arg_string = p0; - } - - arg_struct->arg_array_val[arg_count] = NULL; -} - -/* Advance a string pointer across whitespace and return a pointer - to the first non-white character. */ - -static char * -skip_white_space (p) - register char *p; -{ - while (*p == ' ' || *p == '\t') - p++; - return p; -} - -/* Search for the first unquoted whitespace character in a string. - Returns a pointer to the character, or to the null terminator - if no whitespace is found. */ - -static char * -find_white_space (p) - register char *p; -{ - register int c; - - while ((c = *p) != ' ' && c != '\t' && c) - { - if (c == '\'' || c == '"') - { - while (*++p != c && *p) - { - if (*p == '\\') - p++; - } - if (!*p) - break; - } - p++; - } - return p; -} - -/* Poll the VxWorks target system for an event related - to the debugged task. - Returns -1 if remote wait failed, task status otherwise. */ - -static int -net_wait (pEvent) - RDB_EVENT *pEvent; -{ - int pid; - enum clnt_stat status; - - memset ((char *) pEvent, '\0', sizeof (RDB_EVENT)); - - pid = inferior_pid; - status = net_clnt_call (PROCESS_WAIT, xdr_int, &pid, xdr_RDB_EVENT, - pEvent); - - /* return (status == RPC_SUCCESS)? pEvent->status: -1; */ - if (status == RPC_SUCCESS) - return ((pEvent->status) ? 1 : 0); - else if (status == RPC_TIMEDOUT) - return (1); - else - return (-1); -} - -/* Suspend the remote task. - Returns -1 if suspend fails on target system, 0 otherwise. */ - -static int -net_quit () -{ - int pid; - int quit_status; - enum clnt_stat status; - - quit_status = 0; - - /* don't let rdbTask suspend itself by passing a pid of 0 */ - - if ((pid = inferior_pid) == 0) - return -1; - - status = net_clnt_call (VX_TASK_SUSPEND, xdr_int, &pid, xdr_int, - &quit_status); - - return (status == RPC_SUCCESS)? quit_status: -1; -} - -/* Read a register or registers from the remote system. */ - -void -net_read_registers (reg_buf, len, procnum) - char *reg_buf; - int len; - u_long procnum; -{ - int status; - Rptrace ptrace_in; - Ptrace_return ptrace_out; - C_bytes out_data; - char message[100]; - - memset ((char *) &ptrace_in, '\0', sizeof (ptrace_in)); - memset ((char *) &ptrace_out, '\0', sizeof (ptrace_out)); - - /* Initialize RPC input argument structure. */ - - ptrace_in.pid = inferior_pid; - ptrace_in.info.ttype = NOINFO; - - /* Initialize RPC return value structure. */ - - out_data.bytes = reg_buf; - out_data.len = len; - ptrace_out.info.more_data = (caddr_t) &out_data; - - /* Call RPC; take an error exit if appropriate. */ - - status = net_ptrace_clnt_call (procnum, &ptrace_in, &ptrace_out); - if (status) - error (rpcerr); - if (ptrace_out.status == -1) - { - errno = ptrace_out.errno; - sprintf (message, "reading %s registers", (procnum == PTRACE_GETREGS) - ? "general-purpose" - : "floating-point"); - perror_with_name (message); - } -} - -/* Write register values to a VxWorks target. REG_BUF points to a buffer - containing the raw register values, LEN is the length of REG_BUF in - bytes, and PROCNUM is the RPC procedure number (PTRACE_SETREGS or - PTRACE_SETFPREGS). An error exit is taken if the RPC call fails or - if an error status is returned by the remote debug server. This is - a utility routine used by vx_write_register (). */ - -void -net_write_registers (reg_buf, len, procnum) - char *reg_buf; - int len; - u_long procnum; -{ - int status; - Rptrace ptrace_in; - Ptrace_return ptrace_out; - C_bytes in_data; - char message[100]; - - memset ((char *) &ptrace_in, '\0', sizeof (ptrace_in)); - memset ((char *) &ptrace_out, '\0', sizeof (ptrace_out)); - - /* Initialize RPC input argument structure. */ - - in_data.bytes = reg_buf; - in_data.len = len; - - ptrace_in.pid = inferior_pid; - ptrace_in.info.ttype = DATA; - ptrace_in.info.more_data = (caddr_t) &in_data; - - /* Call RPC; take an error exit if appropriate. */ - - status = net_ptrace_clnt_call (procnum, &ptrace_in, &ptrace_out); - if (status) - error (rpcerr); - if (ptrace_out.status == -1) - { - errno = ptrace_out.errno; - sprintf (message, "writing %s registers", (procnum == PTRACE_SETREGS) - ? "general-purpose" - : "floating-point"); - perror_with_name (message); - } -} - -/* Prepare to store registers. Since we will store all of them, - read out their current values now. */ - -static void -vx_prepare_to_store () -{ - /* Fetch all registers, if any of them are not yet fetched. */ - read_register_bytes (0, NULL, REGISTER_BYTES); -} - -/* Copy LEN bytes to or from remote inferior's memory starting at MEMADDR - to debugger memory starting at MYADDR. WRITE is true if writing to the - inferior. - Result is the number of bytes written or read (zero if error). The - protocol allows us to return a negative count, indicating that we can't - handle the current address but can handle one N bytes further, but - vxworks doesn't give us that information. */ - -static int -vx_xfer_memory (memaddr, myaddr, len, write, target) - CORE_ADDR memaddr; - char *myaddr; - int len; - int write; - struct target_ops *target; /* ignored */ -{ - int status; - Rptrace ptrace_in; - Ptrace_return ptrace_out; - C_bytes data; - enum ptracereq request; - int nleft, nxfer; - - memset ((char *) &ptrace_in, '\0', sizeof (ptrace_in)); - memset ((char *) &ptrace_out, '\0', sizeof (ptrace_out)); - - ptrace_in.pid = inferior_pid; /* XXX pid unnecessary for READDATA */ - ptrace_in.addr = (int) memaddr; /* Where from */ - ptrace_in.data = len; /* How many bytes */ - - if (write) - { - ptrace_in.info.ttype = DATA; - ptrace_in.info.more_data = (caddr_t) &data; - - data.bytes = (caddr_t) myaddr; /* Where from */ - data.len = len; /* How many bytes (again, for XDR) */ - request = PTRACE_WRITEDATA; - } - else - { - ptrace_out.info.more_data = (caddr_t) &data; - request = PTRACE_READDATA; - } - /* Loop until the entire request has been satisfied, transferring - at most VX_MEMXFER_MAX bytes per iteration. Break from the loop - if an error status is returned by the remote debug server. */ - - nleft = len; - status = 0; - - while (nleft > 0 && status == 0) - { - nxfer = min (nleft, VX_MEMXFER_MAX); - - ptrace_in.addr = (int) memaddr; - ptrace_in.data = nxfer; - data.bytes = (caddr_t) myaddr; - data.len = nxfer; - - /* Request a block from the remote debug server; if RPC fails, - report an error and return to debugger command level. */ - - if (net_ptrace_clnt_call (request, &ptrace_in, &ptrace_out)) - error (rpcerr); - - status = ptrace_out.status; - if (status == 0) - { - memaddr += nxfer; - myaddr += nxfer; - nleft -= nxfer; - } - else - { - /* A target-side error has ocurred. Set errno to the error - code chosen by the target so that a later perror () will - say something meaningful. */ - - errno = ptrace_out.errno; - } - } - - /* Return the number of bytes transferred. */ - - return (len - nleft); -} - -static void -vx_files_info () -{ - printf_unfiltered ("\tAttached to host `%s'", vx_host); - printf_unfiltered (", which has %sfloating point", target_has_fp? "": "no "); - printf_unfiltered (".\n"); -} - -static void -vx_run_files_info () -{ - printf_unfiltered ("\tRunning %s VxWorks process %s", - vx_running ? "child" : "attached", - local_hex_string (inferior_pid)); - if (vx_running) - printf_unfiltered (", function `%s'", vx_running); - printf_unfiltered(".\n"); -} - -static void -vx_resume (pid, step, siggnal) - int pid; - int step; - enum target_signal siggnal; -{ - int status; - Rptrace ptrace_in; - Ptrace_return ptrace_out; - CORE_ADDR cont_addr; - - if (pid == -1) - pid = inferior_pid; - - if (siggnal != 0 && siggnal != stop_signal) - error ("Cannot send signals to VxWorks processes"); - - /* Set CONT_ADDR to the address at which we are continuing, - or to 1 if we are continuing from where the program stopped. - This conforms to traditional ptrace () usage, but at the same - time has special meaning for the VxWorks remote debug server. - If the address is not 1, the server knows that the target - program is jumping to a new address, which requires special - handling if there is a breakpoint at the new address. */ - - cont_addr = read_register (PC_REGNUM); - if (cont_addr == stop_pc) - cont_addr = 1; - - memset ((char *) &ptrace_in, '\0', sizeof (ptrace_in)); - memset ((char *) &ptrace_out, '\0', sizeof (ptrace_out)); - - ptrace_in.pid = pid; - ptrace_in.addr = cont_addr; /* Target side insists on this, or it panics. */ - - if (step) - status = net_step(); - else - status = net_ptrace_clnt_call (PTRACE_CONT, &ptrace_in, &ptrace_out); - - if (status) - error (rpcerr); - if (ptrace_out.status == -1) - { - errno = ptrace_out.errno; - perror_with_name ("Resuming remote process"); - } -} - -static void -vx_mourn_inferior () -{ - pop_target (); /* Pop back to no-child state */ - generic_mourn_inferior (); -} - - -static void vx_add_symbols PARAMS ((char *, int, CORE_ADDR, CORE_ADDR, - CORE_ADDR)); - -struct find_sect_args { - CORE_ADDR text_start; - CORE_ADDR data_start; - CORE_ADDR bss_start; -}; - -static void find_sect PARAMS ((bfd *, asection *, void *)); - -static void -find_sect (abfd, sect, obj) - bfd *abfd; - asection *sect; - PTR obj; -{ - struct find_sect_args *args = (struct find_sect_args *)obj; - - if (bfd_get_section_flags (abfd, sect) & (SEC_CODE & SEC_READONLY)) - args->text_start = bfd_get_section_vma (abfd, sect); - else if (bfd_get_section_flags (abfd, sect) & SEC_ALLOC) - { - if (bfd_get_section_flags (abfd, sect) & SEC_LOAD) - { - /* Exclude .ctor and .dtor sections which have SEC_CODE set but not - SEC_DATA. */ - if (bfd_get_section_flags (abfd, sect) & SEC_DATA) - args->data_start = bfd_get_section_vma (abfd, sect); - } - else - args->bss_start = bfd_get_section_vma (abfd, sect); - } -} - -static void -vx_add_symbols (name, from_tty, text_addr, data_addr, bss_addr) - char *name; - int from_tty; - CORE_ADDR text_addr; - CORE_ADDR data_addr; - CORE_ADDR bss_addr; -{ - struct section_offsets *offs; - struct objfile *objfile; - struct find_sect_args ss; - - /* It might be nice to suppress the breakpoint_re_set which happens here - because we are going to do one again after the objfile_relocate. */ - objfile = symbol_file_add (name, from_tty, 0, 0, 0, 0); - - /* This is a (slightly cheesy) way of superceding the old symbols. A less - cheesy way would be to find the objfile with the same name and - free_objfile it. */ - objfile_to_front (objfile); - - offs = (struct section_offsets *) - alloca (sizeof (struct section_offsets) - + objfile->num_sections * sizeof (offs->offsets)); - memcpy (offs, objfile->section_offsets, - sizeof (struct section_offsets) - + objfile->num_sections * sizeof (offs->offsets)); - - ss.text_start = 0; - ss.data_start = 0; - ss.bss_start = 0; - bfd_map_over_sections (objfile->obfd, find_sect, &ss); - - /* Both COFF and b.out frontends use these SECT_OFF_* values. */ - ANOFFSET (offs, SECT_OFF_TEXT) = text_addr - ss.text_start; - ANOFFSET (offs, SECT_OFF_DATA) = data_addr - ss.data_start; - ANOFFSET (offs, SECT_OFF_BSS) = bss_addr - ss.bss_start; - objfile_relocate (objfile, offs); - - /* Need to do this *after* things are relocated. */ - breakpoint_re_set (); -} - -/* This function allows the addition of incrementally linked object files. */ - -static void -vx_load_command (arg_string, from_tty) - char *arg_string; - int from_tty; -{ - CORE_ADDR text_addr; - CORE_ADDR data_addr; - CORE_ADDR bss_addr; - - if (arg_string == 0) - error ("The load command takes a file name"); - - arg_string = tilde_expand (arg_string); - make_cleanup (free, arg_string); - - dont_repeat (); - - /* Refuse to load the module if a debugged task is running. Doing so - can have a number of unpleasant consequences to the running task. */ - - if (inferior_pid != 0 && target_has_execution) - { - if (query ("You may not load a module while the target task is running.\n\ -Kill the target task? ")) - target_kill (); - else - error ("Load cancelled."); - } - - QUIT; - immediate_quit++; - if (net_load (arg_string, &text_addr, &data_addr, &bss_addr) == -1) - error ("Load failed on target machine"); - immediate_quit--; - - vx_add_symbols (arg_string, from_tty, text_addr, data_addr, bss_addr); - - /* Getting new symbols may change our opinion about what is - frameless. */ - reinit_frame_cache (); -} - -/* Single step the target program at the source or machine level. - Takes an error exit if rpc fails. - Returns -1 if remote single-step operation fails, else 0. */ - -static int -net_step () -{ - enum clnt_stat status; - int step_status; - SOURCE_STEP source_step; - - source_step.taskId = inferior_pid; - - if (step_range_end) - { - source_step.startAddr = step_range_start; - source_step.endAddr = step_range_end; - } - else - { - source_step.startAddr = 0; - source_step.endAddr = 0; - } - - status = net_clnt_call (VX_SOURCE_STEP, xdr_SOURCE_STEP, &source_step, - xdr_int, &step_status); - - if (status == RPC_SUCCESS) - return step_status; - else - error (rpcerr); -} - -/* Emulate ptrace using RPC calls to the VxWorks target system. - Returns nonzero (-1) if RPC status to VxWorks is bad, 0 otherwise. */ - -static int -net_ptrace_clnt_call (request, pPtraceIn, pPtraceOut) - enum ptracereq request; - Rptrace *pPtraceIn; - Ptrace_return *pPtraceOut; -{ - enum clnt_stat status; - - status = net_clnt_call (request, xdr_rptrace, pPtraceIn, xdr_ptrace_return, - pPtraceOut); - - if (status != RPC_SUCCESS) - return -1; - - return 0; -} - -/* Query the target for the name of the file from which VxWorks was - booted. pBootFile is the address of a pointer to the buffer to - receive the file name; if the pointer pointed to by pBootFile is - NULL, memory for the buffer will be allocated by XDR. - Returns -1 if rpc failed, 0 otherwise. */ - -static int -net_get_boot_file (pBootFile) - char **pBootFile; -{ - enum clnt_stat status; - - status = net_clnt_call (VX_BOOT_FILE_INQ, xdr_void, (char *) 0, - xdr_wrapstring, pBootFile); - return (status == RPC_SUCCESS) ? 0 : -1; -} - -/* Fetch a list of loaded object modules from the VxWorks target. - Returns -1 if rpc failed, 0 otherwise - There's no way to check if the returned loadTable is correct. - VxWorks doesn't check it. */ - -static int -net_get_symbols (pLoadTable) - ldtabl *pLoadTable; /* return pointer to ldtabl here */ -{ - enum clnt_stat status; - - memset ((char *) pLoadTable, '\0', sizeof (struct ldtabl)); - - status = net_clnt_call (VX_STATE_INQ, xdr_void, 0, xdr_ldtabl, pLoadTable); - return (status == RPC_SUCCESS) ? 0 : -1; -} - -/* Look up a symbol in the VxWorks target's symbol table. - Returns status of symbol read on target side (0=success, -1=fail) - Returns -1 and complain()s if rpc fails. */ - -struct complaint cant_contact_target = - {"Lost contact with VxWorks target", 0, 0}; - -static int -vx_lookup_symbol (name, pAddr) - char *name; /* symbol name */ - CORE_ADDR *pAddr; -{ - enum clnt_stat status; - SYMBOL_ADDR symbolAddr; - - *pAddr = 0; - memset ((char *) &symbolAddr, '\0', sizeof (symbolAddr)); - - status = net_clnt_call (VX_SYMBOL_INQ, xdr_wrapstring, &name, - xdr_SYMBOL_ADDR, &symbolAddr); - if (status != RPC_SUCCESS) - { - complain (&cant_contact_target); - return -1; - } - - *pAddr = symbolAddr.addr; - return symbolAddr.status; -} - -/* Check to see if the VxWorks target has a floating point coprocessor. - Returns 1 if target has floating point processor, 0 otherwise. - Calls error() if rpc fails. */ - -static int -net_check_for_fp () -{ - enum clnt_stat status; - bool_t fp = 0; /* true if fp processor is present on target board */ - - status = net_clnt_call (VX_FP_INQUIRE, xdr_void, 0, xdr_bool, &fp); - if (status != RPC_SUCCESS) - error (rpcerr); - - return (int) fp; -} - -/* Establish an RPC connection with the VxWorks target system. - Calls error () if unable to establish connection. */ - -static void -net_connect (host) - char *host; -{ - struct sockaddr_in destAddr; - struct hostent *destHost; - unsigned long addr; - - /* Get the internet address for the given host. Allow a numeric - IP address or a hostname. */ - - addr = inet_addr (host); - if (addr == -1) - { - destHost = (struct hostent *) gethostbyname (host); - if (destHost == NULL) - /* FIXME: Probably should include hostname here in quotes. - For example if the user types "target vxworks vx960 " it should - say "Invalid host `vx960 '." not just "Invalid hostname". */ - error ("Invalid hostname. Couldn't find remote host address."); - addr = * (unsigned long *) destHost->h_addr; - } - - memset (&destAddr, '\0', sizeof (destAddr)); - - destAddr.sin_addr.s_addr = addr; - destAddr.sin_family = AF_INET; - destAddr.sin_port = 0; /* set to actual port that remote - ptrace is listening on. */ - - /* Create a tcp client transport on which to issue - calls to the remote ptrace server. */ - - ptraceSock = RPC_ANYSOCK; - pClient = clnttcp_create (&destAddr, RDBPROG, RDBVERS, &ptraceSock, 0, 0); - /* FIXME, here is where we deal with different version numbers of the - proto */ - - if (pClient == NULL) - { - clnt_pcreateerror ("\tnet_connect"); - error ("Couldn't connect to remote target."); - } -} - -/* Sleep for the specified number of milliseconds - * (assumed to be less than 1000). - * If select () is interrupted, returns immediately; - * takes an error exit if select () fails for some other reason. - */ - -static void -sleep_ms (ms) - long ms; -{ - struct timeval select_timeout; - int status; - - select_timeout.tv_sec = 0; - select_timeout.tv_usec = ms * 1000; - - status = select (0, (fd_set *) 0, (fd_set *) 0, (fd_set *) 0, - &select_timeout); - - if (status < 0 && errno != EINTR) - perror_with_name ("select"); -} - -static int -vx_wait (pid_to_wait_for, status) - int pid_to_wait_for; - struct target_waitstatus *status; -{ - register int pid; - RDB_EVENT rdbEvent; - int quit_failed; - - do - { - /* If CTRL-C is hit during this loop, - suspend the inferior process. */ - - quit_failed = 0; - if (quit_flag) - { - quit_failed = (net_quit () == -1); - quit_flag = 0; - } - - /* If a net_quit () or net_wait () call has failed, - allow the user to break the connection with the target. - We can't simply error () out of this loop, since the - data structures representing the state of the inferior - are in an inconsistent state. */ - - if (quit_failed || net_wait (&rdbEvent) == -1) - { - terminal_ours (); - if (query ("Can't %s. Disconnect from target system? ", - (quit_failed) ? "suspend remote task" - : "get status of remote task")) - { - target_mourn_inferior(); - error ("Use the \"target\" command to reconnect."); - } - else - { - terminal_inferior (); - continue; - } - } - - pid = rdbEvent.taskId; - if (pid == 0) - { - sleep_ms (200); /* FIXME Don't kill the network too badly */ - } - else if (pid != inferior_pid) - fatal ("Bad pid for debugged task: %s\n", - local_hex_string((unsigned long) pid)); - } while (pid == 0); - - /* The mostly likely kind. */ - status->kind = TARGET_WAITKIND_STOPPED; - - switch (rdbEvent.eventType) - { - case EVENT_EXIT: - status->kind = TARGET_WAITKIND_EXITED; - /* FIXME is it possible to distinguish between a - normal vs abnormal exit in VxWorks? */ - status->value.integer = 0; - break; - - case EVENT_START: - /* Task was just started. */ - status->value.sig = TARGET_SIGNAL_TRAP; - break; - - case EVENT_STOP: - status->value.sig = TARGET_SIGNAL_TRAP; - /* XXX was it stopped by a signal? act accordingly */ - break; - - case EVENT_BREAK: /* Breakpoint was hit. */ - status->value.sig = TARGET_SIGNAL_TRAP; - break; - - case EVENT_SUSPEND: /* Task was suspended, probably by ^C. */ - status->value.sig = TARGET_SIGNAL_INT; - break; - - case EVENT_BUS_ERR: /* Task made evil nasty reference. */ - status->value.sig = TARGET_SIGNAL_BUS; - break; - - case EVENT_ZERO_DIV: /* Division by zero */ - status->value.sig = TARGET_SIGNAL_FPE; - break; - - case EVENT_SIGNAL: -#ifdef I80960 - status->value.sig = i960_fault_to_signal (rdbEvent.sigType); -#else - /* Back in the old days, before enum target_signal, this code used - to add NSIG to the signal number and claim that PRINT_RANDOM_SIGNAL - would take care of it. But PRINT_RANDOM_SIGNAL has never been - defined except on the i960, so I don't really know what we are - supposed to do on other architectures. */ - status->value.sig = TARGET_SIGNAL_UNKNOWN; -#endif - break; - } /* switch */ - return pid; -} - -static int -symbol_stub (arg) - char *arg; -{ - symbol_file_command (arg, 0); - return 1; -} - -static int -add_symbol_stub (arg) - char *arg; -{ - struct ldfile *pLoadFile = (struct ldfile *)arg; - - printf_unfiltered("\t%s: ", pLoadFile->name); - vx_add_symbols (pLoadFile->name, 0, pLoadFile->txt_addr, - pLoadFile->data_addr, pLoadFile->bss_addr); - printf_unfiltered ("ok\n"); - return 1; -} -/* Target command for VxWorks target systems. - - Used in vxgdb. Takes the name of a remote target machine - running vxWorks and connects to it to initialize remote network - debugging. */ - -static void -vx_open (args, from_tty) - char *args; - int from_tty; -{ - extern int close (); - char *bootFile; - extern char *source_path; - struct ldtabl loadTable; - struct ldfile *pLoadFile; - int i; - extern CLIENT *pClient; - int symbols_added = 0; - - if (!args) - error_no_arg ("target machine name"); - - target_preopen (from_tty); - - unpush_target (&vx_ops); - printf_unfiltered ("Attaching remote machine across net...\n"); - gdb_flush (gdb_stdout); - - /* Allow the user to kill the connect attempt by typing ^C. - Wait until the call to target_has_fp () completes before - disallowing an immediate quit, since even if net_connect () - is successful, the remote debug server might be hung. */ - - immediate_quit++; - - net_connect (args); - target_has_fp = net_check_for_fp (); - printf_filtered ("Connected to %s.\n", args); - - immediate_quit--; - - push_target (&vx_ops); - - /* Save a copy of the target host's name. */ - vx_host = savestring (args, strlen (args)); - - /* Find out the name of the file from which the target was booted - and load its symbol table. */ - - printf_filtered ("Looking in Unix path for all loaded modules:\n"); - bootFile = NULL; - if (!net_get_boot_file (&bootFile)) - { - if (*bootFile) - { - printf_filtered ("\t%s: ", bootFile); - /* This assumes that the kernel is never relocated. Hope that is an - accurate assumption. */ - if (catch_errors - (symbol_stub, - bootFile, - "Error while reading symbols from boot file:\n", - RETURN_MASK_ALL)) - puts_filtered ("ok\n"); - } - else if (from_tty) - printf_unfiltered ("VxWorks kernel symbols not loaded.\n"); - } - else - error ("Can't retrieve boot file name from target machine."); - - clnt_freeres (pClient, xdr_wrapstring, &bootFile); - - if (net_get_symbols (&loadTable) != 0) - error ("Can't read loaded modules from target machine"); - - i = 0-1; - while (++i < loadTable.tbl_size) - { - QUIT; /* FIXME, avoids clnt_freeres below: mem leak */ - pLoadFile = &loadTable.tbl_ent [i]; -#ifdef WRS_ORIG - { - register int desc; - struct cleanup *old_chain; - char *fullname = NULL; - - desc = openp (source_path, 0, pLoadFile->name, O_RDONLY, 0, &fullname); - if (desc < 0) - perror_with_name (pLoadFile->name); - old_chain = make_cleanup (close, desc); - add_file_at_addr (fullname, desc, pLoadFile->txt_addr, pLoadFile->data_addr, - pLoadFile->bss_addr); - do_cleanups (old_chain); - } -#else - /* FIXME: Is there something better to search than the PATH? (probably - not the source path, since source might be in different directories - than objects. */ - - if (catch_errors (add_symbol_stub, (char *)pLoadFile, (char *)0, - RETURN_MASK_ALL)) - symbols_added = 1; -#endif - } - printf_filtered ("Done.\n"); - - clnt_freeres (pClient, xdr_ldtabl, &loadTable); - - /* Getting new symbols may change our opinion about what is - frameless. */ - if (symbols_added) - reinit_frame_cache (); -} - -/* Takes a task started up outside of gdb and ``attaches'' to it. - This stops it cold in its tracks and allows us to start tracing it. */ - -static void -vx_attach (args, from_tty) - char *args; - int from_tty; -{ - unsigned long pid; - char *cptr = 0; - Rptrace ptrace_in; - Ptrace_return ptrace_out; - int status; - - if (!args) - error_no_arg ("process-id to attach"); - - pid = strtoul (args, &cptr, 0); - if ((cptr == args) || (*cptr != '\0')) - error ("Invalid process-id -- give a single number in decimal or 0xhex"); - - if (from_tty) - printf_unfiltered ("Attaching pid %s.\n", - local_hex_string((unsigned long) pid)); - - memset ((char *)&ptrace_in, '\0', sizeof (ptrace_in)); - memset ((char *)&ptrace_out, '\0', sizeof (ptrace_out)); - ptrace_in.pid = pid; - - status = net_ptrace_clnt_call (PTRACE_ATTACH, &ptrace_in, &ptrace_out); - if (status == -1) - error (rpcerr); - if (ptrace_out.status == -1) - { - errno = ptrace_out.errno; - perror_with_name ("Attaching remote process"); - } - - /* It worked... */ - push_target (&vx_run_ops); - /* The unsigned long pid will get turned into a signed int here, - but it doesn't seem to matter. inferior_pid must be signed - in order for other parts of GDB to work correctly. */ - inferior_pid = pid; - vx_running = 0; -#if defined (START_INFERIOR_HOOK) - START_INFERIOR_HOOK (); -#endif - - mark_breakpoints_out (); - - /* Set up the "saved terminal modes" of the inferior - based on what modes we are starting it with. */ - - target_terminal_init (); - - /* Install inferior's terminal modes. */ - - target_terminal_inferior (); - - /* We will get a task spawn event immediately. */ - - init_wait_for_inferior (); - clear_proceed_status (); - stop_soon_quietly = 1; - wait_for_inferior (); - stop_soon_quietly = 0; - normal_stop (); -} - - -/* detach_command -- - takes a program previously attached to and detaches it. - The program resumes execution and will no longer stop - on signals, etc. We better not have left any breakpoints - in the program or it'll die when it hits one. For this - to work, it may be necessary for the process to have been - previously attached. It *might* work if the program was - started via the normal ptrace (PTRACE_TRACEME). */ - -static void -vx_detach (args, from_tty) - char *args; - int from_tty; -{ - Rptrace ptrace_in; - Ptrace_return ptrace_out; - int signal = 0; - int status; - - if (args) - error ("Argument given to VxWorks \"detach\"."); - - if (from_tty) - printf_unfiltered ("Detaching pid %s.\n", - local_hex_string((unsigned long) inferior_pid)); - - if (args) /* FIXME, should be possible to leave suspended */ - signal = atoi (args); - - memset ((char *)&ptrace_in, '\0', sizeof (ptrace_in)); - memset ((char *)&ptrace_out, '\0', sizeof (ptrace_out)); - ptrace_in.pid = inferior_pid; - - status = net_ptrace_clnt_call (PTRACE_DETACH, &ptrace_in, &ptrace_out); - if (status == -1) - error (rpcerr); - if (ptrace_out.status == -1) - { - errno = ptrace_out.errno; - perror_with_name ("Detaching VxWorks process"); - } - - inferior_pid = 0; - pop_target (); /* go back to non-executing VxWorks connection */ -} - -/* vx_kill -- takes a running task and wipes it out. */ - -static void -vx_kill () -{ - Rptrace ptrace_in; - Ptrace_return ptrace_out; - int status; - - printf_unfiltered ("Killing pid %s.\n", local_hex_string((unsigned long) inferior_pid)); - - memset ((char *)&ptrace_in, '\0', sizeof (ptrace_in)); - memset ((char *)&ptrace_out, '\0', sizeof (ptrace_out)); - ptrace_in.pid = inferior_pid; - - status = net_ptrace_clnt_call (PTRACE_KILL, &ptrace_in, &ptrace_out); - if (status == -1) - warning (rpcerr); - else if (ptrace_out.status == -1) - { - errno = ptrace_out.errno; - perror_with_name ("Killing VxWorks process"); - } - - /* If it gives good status, the process is *gone*, no events remain. - If the kill failed, assume the process is gone anyhow. */ - inferior_pid = 0; - pop_target (); /* go back to non-executing VxWorks connection */ -} - -/* Clean up from the VxWorks process target as it goes away. */ - -static void -vx_proc_close (quitting) - int quitting; -{ - inferior_pid = 0; /* No longer have a process. */ - if (vx_running) - free (vx_running); - vx_running = 0; -} - -/* Make an RPC call to the VxWorks target. - Returns RPC status. */ - -static enum clnt_stat -net_clnt_call (procNum, inProc, in, outProc, out) - enum ptracereq procNum; - xdrproc_t inProc; - char *in; - xdrproc_t outProc; - char *out; -{ - enum clnt_stat status; - - status = clnt_call (pClient, procNum, inProc, in, outProc, out, rpcTimeout); - - if (status != RPC_SUCCESS) - clnt_perrno (status); - - return status; -} - -/* Clean up before losing control. */ - -static void -vx_close (quitting) - int quitting; -{ - if (pClient) - clnt_destroy (pClient); /* The net connection */ - pClient = 0; - - if (vx_host) - free (vx_host); /* The hostname */ - vx_host = 0; -} - -/* A vxprocess target should be started via "run" not "target". */ -/*ARGSUSED*/ -static void -vx_proc_open (name, from_tty) - char *name; - int from_tty; -{ - error ("Use the \"run\" command to start a VxWorks process."); -} - -/* Target ops structure for accessing memory and such over the net */ - -struct target_ops vx_ops = { - "vxworks", "VxWorks target memory via RPC over TCP/IP", - "Use VxWorks target memory. \n\ -Specify the name of the machine to connect to.", - vx_open, vx_close, vx_attach, 0, /* vx_detach, */ - 0, 0, /* resume, wait */ - 0, 0, /* read_reg, write_reg */ - 0, /* prep_to_store, */ - vx_xfer_memory, vx_files_info, - 0, 0, /* insert_breakpoint, remove_breakpoint */ - 0, 0, 0, 0, 0, /* terminal stuff */ - 0, /* vx_kill, */ - vx_load_command, - vx_lookup_symbol, - vx_create_inferior, 0, /* mourn_inferior */ - 0, /* can_run */ - 0, /* notice_signals */ - 0, /* thread_alive */ - 0, /* to_stop */ - core_stratum, 0, /* next */ - 1, 1, 0, 0, 0, /* all mem, mem, stack, regs, exec */ - 0, 0, /* Section pointers */ - OPS_MAGIC, /* Always the last thing */ -}; - -/* Target ops structure for accessing VxWorks child processes over the net */ - -struct target_ops vx_run_ops = { - "vxprocess", "VxWorks process", - "VxWorks process, started by the \"run\" command.", - vx_proc_open, vx_proc_close, 0, vx_detach, /* vx_attach */ - vx_resume, vx_wait, - vx_read_register, vx_write_register, - vx_prepare_to_store, - vx_xfer_memory, vx_run_files_info, - vx_insert_breakpoint, vx_remove_breakpoint, - 0, 0, 0, 0, 0, /* terminal stuff */ - vx_kill, - vx_load_command, - vx_lookup_symbol, - 0, vx_mourn_inferior, - 0, /* can_run */ - 0, /* notice_signals */ - 0, /* thread_alive */ - 0, /* to_stop */ - process_stratum, 0, /* next */ - 0, /* all_mem--off to avoid spurious msg in "i files" */ - 1, 1, 1, 1, /* mem, stack, regs, exec */ - 0, 0, /* Section pointers */ - OPS_MAGIC, /* Always the last thing */ -}; -/* ==> Remember when reading at end of file, there are two "ops" structs here. */ - -void -_initialize_vx () -{ - add_show_from_set - (add_set_cmd ("vxworks-timeout", class_support, var_uinteger, - (char *) &rpcTimeout.tv_sec, - "Set seconds to wait for rpc calls to return.\n\ -Set the number of seconds to wait for rpc calls to return.", &setlist), - &showlist); - - add_target (&vx_ops); - add_target (&vx_run_ops); -} diff --git a/contrib/gdb/gdb/remote-vx29k.c b/contrib/gdb/gdb/remote-vx29k.c deleted file mode 100644 index 02554aa..0000000 --- a/contrib/gdb/gdb/remote-vx29k.c +++ /dev/null @@ -1,188 +0,0 @@ -/* Am29k-dependent portions of the RPC protocol - used with a VxWorks target - -Contributed by Wind River Systems. - -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 -#include "defs.h" - -#include "vx-share/regPacket.h" -#include "frame.h" -#include "inferior.h" -#include "wait.h" -#include "target.h" -#include "gdbcore.h" -#include "command.h" -#include "symtab.h" -#include "symfile.h" /* for struct complaint */ - -#include "gdb_string.h" -#include -#include -#include -#include -#include -#include - -#ifdef _AIX /* IBM claims "void *malloc()" not char * */ -#define malloc bogon_malloc -#endif - -#include -#include /* UTek's doesn't #incl this */ -#include -#include "vx-share/ptrace.h" -#include "vx-share/xdr_ptrace.h" -#include "vx-share/xdr_ld.h" -#include "vx-share/xdr_rdb.h" -#include "vx-share/dbgRpcLib.h" - -/* get rid of value.h if possible */ -#include -#include - -/* Flag set if target has fpu */ - -extern int target_has_fp; - -/* Generic register read/write routines in remote-vx.c. */ - -extern void net_read_registers (); -extern void net_write_registers (); - -/* Read a register or registers from the VxWorks target. - REGNO is the register to read, or -1 for all; currently, - it is ignored. FIXME look at regno to improve efficiency. */ - -void -vx_read_register (regno) - int regno; -{ - char am29k_greg_packet[AM29K_GREG_PLEN]; - char am29k_fpreg_packet[AM29K_FPREG_PLEN]; - - /* Get general-purpose registers. When copying values into - registers [], don't assume that a location in registers [] - is properly aligned for the target data type. */ - - net_read_registers (am29k_greg_packet, AM29K_GREG_PLEN, PTRACE_GETREGS); - - /* Now copy the register values into registers[]. - Note that this code depends on the ordering of the REGNUMs - as defined in "tm-29k.h". */ - - bcopy (&am29k_greg_packet[AM29K_R_GR96], - ®isters[REGISTER_BYTE (GR96_REGNUM)], 160 * AM29K_GREG_SIZE); - bcopy (&am29k_greg_packet[AM29K_R_VAB], - ®isters[REGISTER_BYTE (VAB_REGNUM)], 15 * AM29K_GREG_SIZE); - registers[REGISTER_BYTE (INTE_REGNUM)] = am29k_greg_packet[AM29K_R_INTE]; - bcopy (&am29k_greg_packet[AM29K_R_RSP], - ®isters[REGISTER_BYTE (GR1_REGNUM)], 5 * AM29K_GREG_SIZE); - - /* PAD For now, don't care about exop register */ - - memset (®isters[REGISTER_BYTE (EXO_REGNUM)], '\0', AM29K_GREG_SIZE); - - /* If the target has floating point registers, fetch them. - Otherwise, zero the floating point register values in - registers[] for good measure, even though we might not - need to. */ - - if (target_has_fp) - { - net_read_registers (am29k_fpreg_packet, AM29K_FPREG_PLEN, - PTRACE_GETFPREGS); - registers[REGISTER_BYTE (FPE_REGNUM)] = am29k_fpreg_packet[AM29K_R_FPE]; - registers[REGISTER_BYTE (FPS_REGNUM)] = am29k_fpreg_packet[AM29K_R_FPS]; - - /* PAD For now, don't care about registers (?) AI0 to q */ - - memset (®isters[REGISTER_BYTE (161)], '\0', 21 * AM29K_FPREG_SIZE); - } - else - { - memset (®isters[REGISTER_BYTE (FPE_REGNUM)], '\0', AM29K_FPREG_SIZE); - memset (®isters[REGISTER_BYTE (FPS_REGNUM)], '\0', AM29K_FPREG_SIZE); - - /* PAD For now, don't care about registers (?) AI0 to q */ - - memset (®isters[REGISTER_BYTE (161)], '\0', 21 * AM29K_FPREG_SIZE); - } - - /* Mark the register cache valid. */ - - registers_fetched (); -} - -/* Store a register or registers into the VxWorks target. - REGNO is the register to store, or -1 for all; currently, - it is ignored. FIXME look at regno to improve efficiency. */ - -void -vx_write_register (regno) - int regno; -{ - char am29k_greg_packet[AM29K_GREG_PLEN]; - char am29k_fpreg_packet[AM29K_FPREG_PLEN]; - - /* Store general purpose registers. When copying values from - registers [], don't assume that a location in registers [] - is properly aligned for the target data type. */ - - bcopy (®isters[REGISTER_BYTE (GR96_REGNUM)], - &am29k_greg_packet[AM29K_R_GR96], 160 * AM29K_GREG_SIZE); - bcopy (®isters[REGISTER_BYTE (VAB_REGNUM)], - &am29k_greg_packet[AM29K_R_VAB], 15 * AM29K_GREG_SIZE); - am29k_greg_packet[AM29K_R_INTE] = registers[REGISTER_BYTE (INTE_REGNUM)]; - bcopy (®isters[REGISTER_BYTE (GR1_REGNUM)], - &am29k_greg_packet[AM29K_R_RSP], 5 * AM29K_GREG_SIZE); - - net_write_registers (am29k_greg_packet, AM29K_GREG_PLEN, PTRACE_SETREGS); - - /* Store floating point registers if the target has them. */ - - if (target_has_fp) - { - am29k_fpreg_packet[AM29K_R_FPE] = registers[REGISTER_BYTE (FPE_REGNUM)]; - am29k_fpreg_packet[AM29K_R_FPS] = registers[REGISTER_BYTE (FPS_REGNUM)]; - - net_write_registers (am29k_fpreg_packet, AM29K_FPREG_PLEN, - PTRACE_SETFPREGS); - } -} - -/* VxWorks zeroes fp when the task is initialized; we use this - to terminate the frame chain. Chain means here the nominal address of - a frame, that is, the return address (lr0) address in the stack. To - obtain the frame pointer (lr1) contents, we must add 4 bytes. - Note : may be we should modify init_frame_info() to get the frame pointer - and store it into the frame_info struct rather than reading its - contents when FRAME_CHAIN_VALID is invoked. */ - -int -get_fp_contents (chain, thisframe) - CORE_ADDR chain; - struct frame_info *thisframe; /* not used here */ -{ - int fp_contents; - - read_memory ((CORE_ADDR)(chain + 4), (char *) &fp_contents, 4); - return (fp_contents != 0); -} - diff --git a/contrib/gdb/gdb/remote-vx68.c b/contrib/gdb/gdb/remote-vx68.c deleted file mode 100644 index c6ceda1..0000000 --- a/contrib/gdb/gdb/remote-vx68.c +++ /dev/null @@ -1,158 +0,0 @@ -/* 68k-dependent portions of the RPC protocol - used with a VxWorks target - -Contributed by Wind River Systems. - -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 -#include "defs.h" - -#include "vx-share/regPacket.h" -#include "frame.h" -#include "inferior.h" -#include "wait.h" -#include "target.h" -#include "gdbcore.h" -#include "command.h" -#include "symtab.h" -#include "symfile.h" /* for struct complaint */ - -#include "gdb_string.h" -#include -#include -#include -#include -#include -#include - -#ifdef _AIX /* IBM claims "void *malloc()" not char * */ -#define malloc bogon_malloc -#endif - -#include - -#ifdef _AIX -#undef malloc -#endif - -#include /* UTek's doesn't #incl this */ -#include -#include "vx-share/ptrace.h" -#include "vx-share/xdr_ptrace.h" -#include "vx-share/xdr_ld.h" -#include "vx-share/xdr_rdb.h" -#include "vx-share/dbgRpcLib.h" - -/* get rid of value.h if possible */ -#include -#include - -/* Flag set if target has fpu */ - -extern int target_has_fp; - -/* Generic register read/write routines in remote-vx.c. */ - -extern void net_read_registers (); -extern void net_write_registers (); - -/* Read a register or registers from the VxWorks target. - REGNO is the register to read, or -1 for all; currently, - it is ignored. FIXME look at regno to improve efficiency. */ - -void -vx_read_register (regno) - int regno; -{ - char mc68k_greg_packet[MC68K_GREG_PLEN]; - char mc68k_fpreg_packet[MC68K_FPREG_PLEN]; - - /* Get general-purpose registers. */ - - net_read_registers (mc68k_greg_packet, MC68K_GREG_PLEN, PTRACE_GETREGS); - - bcopy (&mc68k_greg_packet[MC68K_R_D0], registers, 16 * MC68K_GREG_SIZE); - bcopy (&mc68k_greg_packet[MC68K_R_SR], ®isters[REGISTER_BYTE (PS_REGNUM)], - MC68K_GREG_SIZE); - bcopy (&mc68k_greg_packet[MC68K_R_PC], ®isters[REGISTER_BYTE (PC_REGNUM)], - MC68K_GREG_SIZE); - - /* Get floating-point registers, if the target system has them. - Otherwise, zero them. */ - - if (target_has_fp) - { - net_read_registers (mc68k_fpreg_packet, MC68K_FPREG_PLEN, - PTRACE_GETFPREGS); - - bcopy (&mc68k_fpreg_packet[MC68K_R_FP0], - ®isters[REGISTER_BYTE (FP0_REGNUM)], - MC68K_FPREG_SIZE * 8); - bcopy (&mc68k_fpreg_packet[MC68K_R_FPCR], - ®isters[REGISTER_BYTE (FPC_REGNUM)], - MC68K_FPREG_PLEN - (MC68K_FPREG_SIZE * 8)); - } - else - { - bzero (®isters[REGISTER_BYTE (FP0_REGNUM)], - MC68K_FPREG_SIZE * 8); - bzero (®isters[REGISTER_BYTE (FPC_REGNUM)], - MC68K_FPREG_PLEN - (MC68K_FPREG_SIZE * 8)); - } - - /* Mark the register cache valid. */ - - registers_fetched (); -} - -/* Store a register or registers into the VxWorks target. - REGNO is the register to store, or -1 for all; currently, - it is ignored. FIXME look at regno to improve efficiency. */ - -void -vx_write_register (regno) - int regno; -{ - char mc68k_greg_packet[MC68K_GREG_PLEN]; - char mc68k_fpreg_packet[MC68K_FPREG_PLEN]; - - /* Store general-purpose registers. */ - - bcopy (registers, &mc68k_greg_packet[MC68K_R_D0], 16 * MC68K_GREG_SIZE); - bcopy (®isters[REGISTER_BYTE (PS_REGNUM)], - &mc68k_greg_packet[MC68K_R_SR], MC68K_GREG_SIZE); - bcopy (®isters[REGISTER_BYTE (PC_REGNUM)], - &mc68k_greg_packet[MC68K_R_PC], MC68K_GREG_SIZE); - - net_write_registers (mc68k_greg_packet, MC68K_GREG_PLEN, PTRACE_SETREGS); - - /* Store floating point registers if the target has them. */ - - if (target_has_fp) - { - bcopy (®isters[REGISTER_BYTE (FP0_REGNUM)], - &mc68k_fpreg_packet[MC68K_R_FP0], - MC68K_FPREG_SIZE * 8); - bcopy (®isters[REGISTER_BYTE (FPC_REGNUM)], - &mc68k_fpreg_packet[MC68K_R_FPCR], - MC68K_FPREG_PLEN - (MC68K_FPREG_SIZE * 8)); - - net_write_registers (mc68k_fpreg_packet, MC68K_FPREG_PLEN, - PTRACE_SETFPREGS); - } -} diff --git a/contrib/gdb/gdb/remote-vx960.c b/contrib/gdb/gdb/remote-vx960.c deleted file mode 100644 index bb4fbee..0000000 --- a/contrib/gdb/gdb/remote-vx960.c +++ /dev/null @@ -1,163 +0,0 @@ -/* i80960-dependent portions of the RPC protocol - used with a VxWorks target - -Contributed by Wind River Systems. - -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 -#include "defs.h" - -#include "vx-share/regPacket.h" -#include "frame.h" -#include "inferior.h" -#include "wait.h" -#include "target.h" -#include "gdbcore.h" -#include "command.h" -#include "symtab.h" -#include "symfile.h" /* for struct complaint */ - -#include "gdb_string.h" -#include -#include -#include -#include -#include -#include - -#ifdef _AIX /* IBM claims "void *malloc()" not char * */ -#define malloc bogon_malloc -#endif - -#include -#include /* UTek's doesn't #incl this */ -#include -#include "vx-share/ptrace.h" -#include "vx-share/xdr_ptrace.h" -#include "vx-share/xdr_ld.h" -#include "vx-share/xdr_rdb.h" -#include "vx-share/dbgRpcLib.h" - -/* get rid of value.h if possible */ -#include -#include - -/* Flag set if target has fpu */ - -extern int target_has_fp; - -/* 960 floating point format descriptor, from "i960-tdep.c." */ - -extern struct ext_format ext_format_i960; - -/* Generic register read/write routines in remote-vx.c. */ - -extern void net_read_registers (); -extern void net_write_registers (); - -/* Read a register or registers from the VxWorks target. - REGNO is the register to read, or -1 for all; currently, - it is ignored. FIXME look at regno to improve efficiency. */ - -void -vx_read_register (regno) - int regno; -{ - char i960_greg_packet[I960_GREG_PLEN]; - char i960_fpreg_packet[I960_FPREG_PLEN]; - - /* Get general-purpose registers. When copying values into - registers [], don't assume that a location in registers [] - is properly aligned for the target data type. */ - - net_read_registers (i960_greg_packet, I960_GREG_PLEN, PTRACE_GETREGS); - - bcopy (&i960_greg_packet[I960_R_R0], - ®isters[REGISTER_BYTE (R0_REGNUM)], 16 * I960_GREG_SIZE); - bcopy (&i960_greg_packet[I960_R_G0], - ®isters[REGISTER_BYTE (G0_REGNUM)], 16 * I960_GREG_SIZE); - bcopy (&i960_greg_packet[I960_R_PCW], - ®isters[REGISTER_BYTE (PCW_REGNUM)], sizeof (int)); - bcopy (&i960_greg_packet[I960_R_ACW], - ®isters[REGISTER_BYTE (ACW_REGNUM)], sizeof (int)); - bcopy (&i960_greg_packet[I960_R_TCW], - ®isters[REGISTER_BYTE (TCW_REGNUM)], sizeof (int)); - - /* If the target has floating point registers, fetch them. - Otherwise, zero the floating point register values in - registers[] for good measure, even though we might not - need to. */ - - if (target_has_fp) - { - net_read_registers (i960_fpreg_packet, I960_FPREG_PLEN, - PTRACE_GETFPREGS); - bcopy (&i960_fpreg_packet[I960_R_FP0], - ®isters[REGISTER_BYTE (FP0_REGNUM)], - REGISTER_RAW_SIZE (FP0_REGNUM) * 4); - } - else - bzero (®isters[REGISTER_BYTE (FP0_REGNUM)], - REGISTER_RAW_SIZE (FP0_REGNUM) * 4); - - /* Mark the register cache valid. */ - - registers_fetched (); -} - -/* Store a register or registers into the VxWorks target. - REGNO is the register to store, or -1 for all; currently, - it is ignored. FIXME look at regno to improve efficiency. */ - -void -vx_write_register (regno) - int regno; -{ - char i960_greg_packet[I960_GREG_PLEN]; - char i960_fpreg_packet[I960_FPREG_PLEN]; - - /* Store floating-point registers. When copying values from - registers [], don't assume that a location in registers [] - is properly aligned for the target data type. */ - - bcopy (®isters[REGISTER_BYTE (R0_REGNUM)], - &i960_greg_packet[I960_R_R0], 16 * I960_GREG_SIZE); - bcopy (®isters[REGISTER_BYTE (G0_REGNUM)], - &i960_greg_packet[I960_R_G0], 16 * I960_GREG_SIZE); - bcopy (®isters[REGISTER_BYTE (PCW_REGNUM)], - &i960_greg_packet[I960_R_PCW], sizeof (int)); - bcopy (®isters[REGISTER_BYTE (ACW_REGNUM)], - &i960_greg_packet[I960_R_ACW], sizeof (int)); - bcopy (®isters[REGISTER_BYTE (TCW_REGNUM)], - &i960_greg_packet[I960_R_TCW], sizeof (int)); - - net_write_registers (i960_greg_packet, I960_GREG_PLEN, PTRACE_SETREGS); - - /* Store floating point registers if the target has them. */ - - if (target_has_fp) - { - bcopy (®isters[REGISTER_BYTE (FP0_REGNUM)], - &i960_fpreg_packet[I960_R_FP0], - REGISTER_RAW_SIZE (FP0_REGNUM) * 4); - - net_write_registers (i960_fpreg_packet, I960_FPREG_PLEN, - PTRACE_SETFPREGS); - } -} - diff --git a/contrib/gdb/gdb/remote-vxmips.c b/contrib/gdb/gdb/remote-vxmips.c deleted file mode 100644 index c65ac01..0000000 --- a/contrib/gdb/gdb/remote-vxmips.c +++ /dev/null @@ -1,201 +0,0 @@ -/* MIPS-dependent portions of the RPC protocol - used with a VxWorks target - -Contributed by Wind River Systems. - -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 -#include "defs.h" - -#include "vx-share/regPacket.h" -#include "frame.h" -#include "inferior.h" -#include "wait.h" -#include "target.h" -#include "gdbcore.h" -#include "command.h" -#include "symtab.h" -#include "symfile.h" /* for struct complaint */ - -#include "gdb_string.h" -#include -#include -#include -#include -#include -#include -#include -#include /* UTek's doesn't #incl this */ -#include -#include "vx-share/ptrace.h" -#include "vx-share/xdr_ptrace.h" -#include "vx-share/xdr_ld.h" -#include "vx-share/xdr_rdb.h" -#include "vx-share/dbgRpcLib.h" - -/* get rid of value.h if possible */ -#include -#include - -/* Flag set if target has fpu */ - -extern int target_has_fp; - -/* Generic register read/write routines in remote-vx.c. */ - -extern void net_read_registers (); -extern void net_write_registers (); - -/* Read a register or registers from the VxWorks target. - REGNO is the register to read, or -1 for all; currently, - it is ignored. FIXME look at regno to improve efficiency. */ - -void -vx_read_register (regno) - int regno; -{ - char mips_greg_packet[MIPS_GREG_PLEN]; - char mips_fpreg_packet[MIPS_FPREG_PLEN]; - - /* Get general-purpose registers. */ - - net_read_registers (mips_greg_packet, MIPS_GREG_PLEN, PTRACE_GETREGS); - - /* this code copies the registers obtained by RPC - stored in a structure(s) like this : - - Register(s) Offset(s) - gp 0-31 0x00 - hi 0x80 - lo 0x84 - sr 0x88 - pc 0x8c - - into a stucture like this: - - 0x00 GP 0-31 - 0x80 SR - 0x84 LO - 0x88 HI - 0x8C BAD --- Not available currently - 0x90 CAUSE --- Not available currently - 0x94 PC - 0x98 FP 0-31 - 0x118 FCSR - 0x11C FIR --- Not available currently - 0x120 FP --- Not available currently - - structure is 0x124 (292) bytes in length */ - - /* Copy the general registers. */ - - bcopy (&mips_greg_packet[MIPS_R_GP0], ®isters[0], 32 * MIPS_GREG_SIZE); - - /* Copy SR, LO, HI, and PC. */ - - bcopy (&mips_greg_packet[MIPS_R_SR], - ®isters[REGISTER_BYTE (PS_REGNUM)], MIPS_GREG_SIZE); - bcopy (&mips_greg_packet[MIPS_R_LO], - ®isters[REGISTER_BYTE (LO_REGNUM)], MIPS_GREG_SIZE); - bcopy (&mips_greg_packet[MIPS_R_HI], - ®isters[REGISTER_BYTE (HI_REGNUM)], MIPS_GREG_SIZE); - bcopy (&mips_greg_packet[MIPS_R_PC], - ®isters[REGISTER_BYTE (PC_REGNUM)], MIPS_GREG_SIZE); - - /* If the target has floating point registers, fetch them. - Otherwise, zero the floating point register values in - registers[] for good measure, even though we might not - need to. */ - - if (target_has_fp) - { - net_read_registers (mips_fpreg_packet, MIPS_FPREG_PLEN, - PTRACE_GETFPREGS); - - /* Copy the floating point registers. */ - - bcopy (&mips_fpreg_packet[MIPS_R_FP0], - ®isters[REGISTER_BYTE (FP0_REGNUM)], - REGISTER_RAW_SIZE (FP0_REGNUM) * 32); - - /* Copy the floating point control/status register (fpcsr). */ - - bcopy (&mips_fpreg_packet[MIPS_R_FPCSR], - ®isters[REGISTER_BYTE (FCRCS_REGNUM)], - REGISTER_RAW_SIZE (FCRCS_REGNUM)); - } - else - { - bzero ((char *) ®isters[REGISTER_BYTE (FP0_REGNUM)], - REGISTER_RAW_SIZE (FP0_REGNUM) * 32); - bzero ((char *) ®isters[REGISTER_BYTE (FCRCS_REGNUM)], - REGISTER_RAW_SIZE (FCRCS_REGNUM)); - } - - /* Mark the register cache valid. */ - - registers_fetched (); -} - -/* Store a register or registers into the VxWorks target. - REGNO is the register to store, or -1 for all; currently, - it is ignored. FIXME look at regno to improve efficiency. */ - -vx_write_register (regno) - int regno; -{ - char mips_greg_packet[MIPS_GREG_PLEN]; - char mips_fpreg_packet[MIPS_FPREG_PLEN]; - - /* Store general registers. */ - - bcopy (®isters[0], &mips_greg_packet[MIPS_R_GP0], 32 * MIPS_GREG_SIZE); - - /* Copy SR, LO, HI, and PC. */ - - bcopy (®isters[REGISTER_BYTE (PS_REGNUM)], - &mips_greg_packet[MIPS_R_SR], MIPS_GREG_SIZE); - bcopy (®isters[REGISTER_BYTE (LO_REGNUM)], - &mips_greg_packet[MIPS_R_LO], MIPS_GREG_SIZE); - bcopy (®isters[REGISTER_BYTE (HI_REGNUM)], - &mips_greg_packet[MIPS_R_HI], MIPS_GREG_SIZE); - bcopy (®isters[REGISTER_BYTE (PC_REGNUM)], - &mips_greg_packet[MIPS_R_PC], MIPS_GREG_SIZE); - - net_write_registers (mips_greg_packet, MIPS_GREG_PLEN, PTRACE_SETREGS); - - /* Store floating point registers if the target has them. */ - - if (target_has_fp) - { - /* Copy the floating point data registers. */ - - bcopy (®isters[REGISTER_BYTE (FP0_REGNUM)], - &mips_fpreg_packet[MIPS_R_FP0], - REGISTER_RAW_SIZE (FP0_REGNUM) * 32); - - /* Copy the floating point control/status register (fpcsr). */ - - bcopy (®isters[REGISTER_BYTE (FCRCS_REGNUM)], - &mips_fpreg_packet[MIPS_R_FPCSR], - REGISTER_RAW_SIZE (FCRCS_REGNUM)); - - net_write_registers (mips_fpreg_packet, MIPS_FPREG_PLEN, - PTRACE_SETFPREGS); - } -} diff --git a/contrib/gdb/gdb/remote-vxsparc.c b/contrib/gdb/gdb/remote-vxsparc.c deleted file mode 100644 index 0682542..0000000 --- a/contrib/gdb/gdb/remote-vxsparc.c +++ /dev/null @@ -1,196 +0,0 @@ -/* sparc-dependent portions of the RPC protocol - used with a VxWorks target - -Contributed by Wind River Systems. - -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 -#include "defs.h" - -#include "vx-share/regPacket.h" -#include "frame.h" -#include "inferior.h" -#include "wait.h" -#include "target.h" -#include "gdbcore.h" -#include "command.h" -#include "symtab.h" -#include "symfile.h" /* for struct complaint */ - -#include "gdb_string.h" -#include -#include -#include -#include -#include -#include - -#ifdef _AIX /* IBM claims "void *malloc()" not char * */ -#define malloc bogon_malloc -#endif - -#include -#include /* UTek's doesn't #incl this */ -#include -#include "vx-share/ptrace.h" -#include "vx-share/xdr_ptrace.h" -#include "vx-share/xdr_ld.h" -#include "vx-share/xdr_rdb.h" -#include "vx-share/dbgRpcLib.h" - -/* get rid of value.h if possible */ -#include -#include - -/* Flag set if target has fpu */ - -extern int target_has_fp; - -/* sparc floating point format descriptor, from "sparc-tdep.c." */ - -extern struct ext_format ext_format_sparc; - -/* Generic register read/write routines in remote-vx.c. */ - -extern void net_read_registers (); -extern void net_write_registers (); - -/* Read a register or registers from the VxWorks target. - REGNO is the register to read, or -1 for all; currently, - it is ignored. FIXME look at regno to improve efficiency. */ - -void -vx_read_register (regno) - int regno; -{ - char sparc_greg_packet[SPARC_GREG_PLEN]; - char sparc_fpreg_packet[SPARC_FPREG_PLEN]; - CORE_ADDR sp; - - /* Get general-purpose registers. When copying values into - registers [], don't assume that a location in registers [] - is properly aligned for the target data type. */ - - net_read_registers (sparc_greg_packet, SPARC_GREG_PLEN, PTRACE_GETREGS); - - /* Now copy the register values into registers[]. - Note that this code depends on the ordering of the REGNUMs - as defined in "tm-sparc.h". */ - - bcopy (&sparc_greg_packet[SPARC_R_G0], - ®isters[REGISTER_BYTE (G0_REGNUM)], 32 * SPARC_GREG_SIZE); - bcopy (&sparc_greg_packet[SPARC_R_Y], - ®isters[REGISTER_BYTE (Y_REGNUM)], 6 * SPARC_GREG_SIZE); - - /* Now write the local and in registers to the register window - spill area in the frame. VxWorks does not do this for the - active frame automatically; it greatly simplifies debugging - (FRAME_FIND_SAVED_REGS, in particular, depends on this). */ - - sp = extract_address (®isters[REGISTER_BYTE (SP_REGNUM)], - REGISTER_RAW_SIZE (CORE_ADDR)); - write_memory (sp, ®isters[REGISTER_BYTE (L0_REGNUM)], - 16 * REGISTER_RAW_SIZE (L0_REGNUM)); - - /* If the target has floating point registers, fetch them. - Otherwise, zero the floating point register values in - registers[] for good measure, even though we might not - need to. */ - - if (target_has_fp) - { - net_read_registers (sparc_fpreg_packet, SPARC_FPREG_PLEN, - PTRACE_GETFPREGS); - bcopy (&sparc_fpreg_packet[SPARC_R_FP0], - ®isters[REGISTER_BYTE (FP0_REGNUM)], 32 * SPARC_FPREG_SIZE); - bcopy (&sparc_fpreg_packet[SPARC_R_FSR], - ®isters[REGISTER_BYTE (FPS_REGNUM)], 1 * SPARC_FPREG_SIZE); - } - else - { - bzero (®isters[REGISTER_BYTE (FP0_REGNUM)], 32 * SPARC_FPREG_SIZE); - bzero (®isters[REGISTER_BYTE (FPS_REGNUM)], 1 * SPARC_FPREG_SIZE); - } - - /* Mark the register cache valid. */ - - registers_fetched (); -} - -/* Store a register or registers into the VxWorks target. - REGNO is the register to store, or -1 for all; currently, - it is ignored. FIXME look at regno to improve efficiency. */ - -void -vx_write_register (regno) - int regno; -{ - char sparc_greg_packet[SPARC_GREG_PLEN]; - char sparc_fpreg_packet[SPARC_FPREG_PLEN]; - int in_gp_regs; - int in_fp_regs; - CORE_ADDR sp; - - /* Store general purpose registers. When copying values from - registers [], don't assume that a location in registers [] - is properly aligned for the target data type. */ - - in_gp_regs = 1; - in_fp_regs = 1; - if (regno >= 0) - { - if ((G0_REGNUM <= regno && regno <= I7_REGNUM) - || (Y_REGNUM <= regno && regno <= NPC_REGNUM)) - in_fp_regs = 0; - else - in_gp_regs = 0; - } - if (in_gp_regs) - { - bcopy (®isters[REGISTER_BYTE (G0_REGNUM)], - &sparc_greg_packet[SPARC_R_G0], 32 * SPARC_GREG_SIZE); - bcopy (®isters[REGISTER_BYTE (Y_REGNUM)], - &sparc_greg_packet[SPARC_R_Y], 6 * SPARC_GREG_SIZE); - - net_write_registers (sparc_greg_packet, SPARC_GREG_PLEN, PTRACE_SETREGS); - - /* If this is a local or in register, or we're storing all - registers, update the register window spill area. */ - - if (regno < 0 || (L0_REGNUM <= regno && regno <= I7_REGNUM)) - { - sp = extract_address (®isters[REGISTER_BYTE (SP_REGNUM)], - REGISTER_RAW_SIZE (CORE_ADDR)); - write_memory (sp, ®isters[REGISTER_BYTE (L0_REGNUM)], - 16 * REGISTER_RAW_SIZE (L0_REGNUM)); - } - } - - /* Store floating point registers if the target has them. */ - - if (in_fp_regs && target_has_fp) - { - bcopy (®isters[REGISTER_BYTE (FP0_REGNUM)], - &sparc_fpreg_packet[SPARC_R_FP0], 32 * SPARC_FPREG_SIZE); - bcopy (®isters[REGISTER_BYTE (FPS_REGNUM)], - &sparc_fpreg_packet[SPARC_R_FSR], 1 * SPARC_FPREG_SIZE); - - net_write_registers (sparc_fpreg_packet, SPARC_FPREG_PLEN, - PTRACE_SETFPREGS); - } -} diff --git a/contrib/gdb/gdb/ser-e7kpc.c b/contrib/gdb/gdb/ser-e7kpc.c deleted file mode 100644 index 9faf7dd..0000000 --- a/contrib/gdb/gdb/ser-e7kpc.c +++ /dev/null @@ -1,420 +0,0 @@ -/* Remote serial interface using Hitachi E7000 PC ISA card in a PC - - Copyright 1994 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. */ - -#ifdef __GO32__ -#include "defs.h" -#include "serial.h" -#include - - - -static int e7000pc_open PARAMS ((serial_t scb, const char *name)); -static void e7000pc_raw PARAMS ((serial_t scb)); -static int e7000pc_readchar PARAMS ((serial_t scb, int timeout)); -static int e7000pc_setbaudrate PARAMS ((serial_t scb, int rate)); -static int e7000pc_write PARAMS ((serial_t scb, const char *str, int len)); -static void e7000pc_close PARAMS ((serial_t scb)); -static serial_ttystate e7000pc_get_tty_state PARAMS ((serial_t scb)); -static int e7000pc_set_tty_state PARAMS ((serial_t scb, serial_ttystate state)); -static char *aptr PARAMS ((short p)); - -static int dos_async_init PARAMS ((int port)); -static void dos_async_tx PARAMS ((const char c)); -static int dos_async_rx PARAMS (()); - - - -#define OFF_DPD 0x0000 -#define OFF_DDP 0x1000 -#define OFF_CPD 0x2000 -#define OFF_CDP 0x2400 -#define OFF_FA 0x3000 -#define OFF_FB 0x3002 -#define OFF_FC 0x3004 -#define OFF_IRQTOD 0x3008 -#define OFF_IRQTOP 0x300a -#define OFF_READY 0x300c -#define OFF_PON 0x300e - -#define IDLE 0x0000 -#define CMD_CI 0x4349 -#define CMD_CO 0x434f -#define CMD_LO 0x4c4f -#define CMD_LS 0x4c53 -#define CMD_SV 0x5356 -#define CMD_SS 0x5353 -#define CMD_OK 0x4f4b -#define CMD_ER 0x4552 -#define CMD_NF 0x4e46 -#define CMD_AB 0x4142 -#define CMD_ED 0x4544 -#define CMD_CE 0x4345 - -static unsigned long fa; -static unsigned long irqtod; -static unsigned long ready; -static unsigned long fb; -static unsigned long cpd ; -static unsigned long cdp ; -static unsigned long ready; -static unsigned long pon; -static unsigned long irqtop; -static unsigned long board_at; - -#define SET_BYTE(x,y) { char _buf = y;dosmemput(&_buf,1, x);} -#define SET_WORD(x,y) { short _buf = y;dosmemput(&_buf,2, x);} -#define GET_BYTE(x) ( dosmemget(x,1,&bb), bb) -#define GET_WORD(x) ( dosmemget(x,2,&sb), sb) - -static unsigned char bb; -static unsigned short sb; - - -static struct sw -{ - int sw; - int addr; -} sigs[] = { - {0x14, 0xd0000}, - {0x15, 0xd4000}, - {0x16, 0xd8000}, - {0x17, 0xdc000}, - 0}; - -static int -e7000pc_init () -{ - /* Look around in memory for the board's signature */ - - int try; - - for (try = 0; sigs[try].sw; try++) - - { - int val; - board_at = sigs[try].addr; - fa = board_at + OFF_FA; - fb = board_at + OFF_FB; - cpd = board_at + OFF_CPD; - cdp = board_at + OFF_CDP; - ready =board_at + OFF_READY; - pon = board_at + OFF_PON; - irqtop = board_at + OFF_IRQTOP; - irqtod = board_at + OFF_IRQTOD; - - val = GET_WORD (ready); - - if (val == (0xaaa0 | sigs[try].sw)) - { - if (GET_BYTE (pon) & 0xf) - { - SET_BYTE(fa, 0); - SET_BYTE (fb, 0); - - SET_BYTE (irqtop, 1); /* Disable interrupts from e7000 */ - SET_WORD (ready, 1); - printf_filtered ("\nConnected to the E7000PC at address 0x%x\n", - sigs[try].addr); - return 1; - } - error ("The E7000 PC board is working, but the E7000 is turned off.\n"); - return 0; - } - } - - error ("GDB cannot connect to the E7000 PC board, check that it is installed\n\ -and that the switch settings are correct. Some other DOS programs can \n\ -stop the board from working. Try starting from a very minimal boot, \n\ -perhaps you need to disable EMM386 over the region where the board has\n\ -its I/O space, remove other unneeded cards, etc etc\n"); - return 0; - -} - -static int pbuf_size; -static int pbuf_index; - -static -int -e7000_get () -{ - static char pbuf[1000]; - char tmp[1000]; - int x; - if (pbuf_index < pbuf_size) - { - x = pbuf[pbuf_index++]; - } - else if ((GET_BYTE (fb) & 1)) - { - int i; - pbuf_size = GET_WORD(cdp + 2); - - dosmemget (cdp + 8, pbuf_size + 1, tmp); - - /* Tell the E7000 we've eaten */ - SET_BYTE(fb,0); - /* Swap it around */ - for (i = 0; i < pbuf_size; i++) - { - pbuf[i] = tmp[i^1]; - } - pbuf_index = 0; - x = pbuf[pbuf_index++]; - } - else - { - x = -1; - } - return x; -} - -static int -dosasync_read (fd, buf, len, timeout) - int fd; - char *buf; - int len; - int timeout; - -{ - long now; - long then; - int i = 0; - int p; - - /* Then look for some more if we're still hungry */ - time (&now); - then = now + timeout; - while (i < len) - { - int ch = e7000_get(); - - /* While there's room in the buffer, and we've already - read the stuff in, suck it over */ - if (ch != -1) - { - buf[i++] = ch; - while (i < len && pbuf_index < pbuf_size ) - { - ch = e7000_get(); - if (ch == -1) - break; - buf[i++] = ch; - } - } - - time (&now); - - if (timeout == 0) - return i; - if (now >= then && timeout > 0) - { - return i; - } - } - return len; -} - - -static int -dosasync_write (fd, buf, len) - int fd; - const char *buf; - int len; -{ - int i; - char dummy[1000]; - - - /* Construct copy locally */ - ((short *)dummy)[0] = CMD_CI; - ((short *)dummy)[1] = len; - ((short *)dummy)[2] = 0; - ((short *)dummy)[3] = 0; - for (i = 0; i < len ; i++) - { - dummy[8 + i ^ 1] = buf[i]; - } - - /* Wait for the card to get ready */ - while ((GET_BYTE(fa) & 1) != 0) - ; - - /* Blast onto the ISA card */ - dosmemput (dummy, 8 + len + 1, cpd); - - SET_BYTE(fa, 1); - SET_BYTE(irqtod, 1); /* Interrupt the E7000 */ - - return len; -} - -static int -e7000pc_open (scb, name) - serial_t scb; - const char *name; -{ - if (strncasecmp (name, "pc", 2) != 0) - { - errno = ENOENT; - return -1; - } - - scb->fd = e7000pc_init (); - - if (!scb->fd) - return -1; - - return 0; -} - -static int -e7000pc_noop (scb) - serial_t scb; -{ - return 0; -} - -static void -e7000pc_raw (scb) - serial_t scb; -{ - /* Always in raw mode */ -} - -static int -e7000pc_readchar (scb, timeout) - serial_t scb; - int timeout; -{ - char buf; - - top: - - if (dosasync_read (scb->fd, &buf, 1, timeout)) - { - if (buf == 0) goto top; - return buf; - } - else - return SERIAL_TIMEOUT; -} - -struct e7000pc_ttystate { - int dummy; -}; - -/* e7000pc_{get set}_tty_state() are both dummys to fill out the function - vector. Someday, they may do something real... */ - -static serial_ttystate -e7000pc_get_tty_state (scb) - serial_t scb; -{ - struct e7000pc_ttystate *state; - - state = (struct e7000pc_ttystate *) xmalloc (sizeof *state); - - return (serial_ttystate) state; -} - -static int -e7000pc_set_tty_state (scb, ttystate) - serial_t scb; - serial_ttystate ttystate; -{ - return 0; -} - -static int -e7000pc_noflush_set_tty_state (scb, new_ttystate, old_ttystate) - serial_t scb; - serial_ttystate new_ttystate; - serial_ttystate old_ttystate; -{ - return 0; -} - -static void -e7000pc_print_tty_state (scb, ttystate) - serial_t scb; - serial_ttystate ttystate; -{ - /* Nothing to print. */ - return; -} - -static int -e7000pc_setbaudrate (scb, rate) - serial_t scb; - int rate; -{ - return 0; -} - -static int -e7000pc_write (scb, str, len) - serial_t scb; - const char *str; - int len; -{ - dosasync_write (scb->fd, str, len); - - return 0; -} - -static void -e7000pc_close (scb) - serial_t scb; -{ -} - -static struct serial_ops e7000pc_ops = -{ - "pc", - 0, - e7000pc_open, - e7000pc_close, - e7000pc_readchar, - e7000pc_write, - e7000pc_noop, /* flush output */ - e7000pc_noop, /* flush input */ - e7000pc_noop, /* send break -- currently used only for nindy */ - e7000pc_raw, - e7000pc_get_tty_state, - e7000pc_set_tty_state, - e7000pc_print_tty_state, - e7000pc_noflush_set_tty_state, - e7000pc_setbaudrate, -}; - -void -_initialize_ser_e7000pc () -{ - serial_add_interface (&e7000pc_ops); -} -#else - -void -_initialize_ser_e7000pc () -{ - -} -#endif diff --git a/contrib/gdb/gdb/ser-go32.c b/contrib/gdb/gdb/ser-go32.c deleted file mode 100644 index 4af25f1..0000000 --- a/contrib/gdb/gdb/ser-go32.c +++ /dev/null @@ -1,957 +0,0 @@ -/* Remote serial interface for local (hardwired) serial ports for - GO32. Copyright 1992, 1993 Free Software Foundation, Inc. - - Contributed by Nigel Stephens, Algorithmics Ltd. (nigel@algor.co.uk). - - This version uses DPMI interrupts to handle buffered i/o - without the separate "asynctsr" program. - - 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 "gdbcmd.h" -#include "serial.h" - - -/* - * NS16550 UART registers - */ - -#define COM1ADDR 0x3f8 -#define COM2ADDR 0x2f8 -#define COM3ADDR 0x3e8 -#define COM4ADDR 0x3e0 - -#define com_data 0 /* data register (R/W) */ -#define com_dlbl 0 /* divisor latch low (W) */ -#define com_ier 1 /* interrupt enable (W) */ -#define com_dlbh 1 /* divisor latch high (W) */ -#define com_iir 2 /* interrupt identification (R) */ -#define com_fifo 2 /* FIFO control (W) */ -#define com_lctl 3 /* line control register (R/W) */ -#define com_cfcr 3 /* line control register (R/W) */ -#define com_mcr 4 /* modem control register (R/W) */ -#define com_lsr 5 /* line status register (R/W) */ -#define com_msr 6 /* modem status register (R/W) */ - -/* - * Constants for computing 16 bit baud rate divisor (lower byte - * in com_dlbl, upper in com_dlbh) from 1.8432MHz crystal. Divisor is - * 1.8432 MHz / (16 * X) for X bps. If the baud rate can't be set - * to within +- (desired_rate*SPEED_TOLERANCE/1000) bps, we fail. - */ -#define COMTICK (1843200/16) -#define SPEED_TOLERANCE 30 /* thousandths; real == desired +- 3.0% */ - -/* interrupt enable register */ -#define IER_ERXRDY 0x1 /* int on rx ready */ -#define IER_ETXRDY 0x2 /* int on tx ready */ -#define IER_ERLS 0x4 /* int on line status change */ -#define IER_EMSC 0x8 /* int on modem status change */ - -/* interrupt identification register */ -#define IIR_FIFO_MASK 0xc0 /* set if FIFOs are enabled */ -#define IIR_IMASK 0xf /* interrupt cause mask */ -#define IIR_NOPEND 0x1 /* nothing pending */ -#define IIR_RLS 0x6 /* receive line status */ -#define IIR_RXRDY 0x4 /* receive ready */ -#define IIR_RXTOUT 0xc /* receive timeout */ -#define IIR_TXRDY 0x2 /* transmit ready */ -#define IIR_MLSC 0x0 /* modem status */ - - -/* fifo control register */ -#define FIFO_ENABLE 0x01 /* enable fifo */ -#define FIFO_RCV_RST 0x02 /* reset receive fifo */ -#define FIFO_XMT_RST 0x04 /* reset transmit fifo */ -#define FIFO_DMA_MODE 0x08 /* enable dma mode */ -#define FIFO_TRIGGER_1 0x00 /* trigger at 1 char */ -#define FIFO_TRIGGER_4 0x40 /* trigger at 4 chars */ -#define FIFO_TRIGGER_8 0x80 /* trigger at 8 chars */ -#define FIFO_TRIGGER_14 0xc0 /* trigger at 14 chars */ - -/* character format control register */ -#define CFCR_DLAB 0x80 /* divisor latch */ -#define CFCR_SBREAK 0x40 /* send break */ -#define CFCR_PZERO 0x30 /* zero parity */ -#define CFCR_PONE 0x20 /* one parity */ -#define CFCR_PEVEN 0x10 /* even parity */ -#define CFCR_PODD 0x00 /* odd parity */ -#define CFCR_PENAB 0x08 /* parity enable */ -#define CFCR_STOPB 0x04 /* 2 stop bits */ -#define CFCR_8BITS 0x03 /* 8 data bits */ -#define CFCR_7BITS 0x02 /* 7 data bits */ -#define CFCR_6BITS 0x01 /* 6 data bits */ -#define CFCR_5BITS 0x00 /* 5 data bits */ - -/* modem control register */ -#define MCR_LOOPBACK 0x10 /* loopback */ -#define MCR_IENABLE 0x08 /* output 2 = int enable */ -#define MCR_DRS 0x04 /* output 1 = xxx */ -#define MCR_RTS 0x02 /* enable RTS */ -#define MCR_DTR 0x01 /* enable DTR */ - -/* line status register */ -#define LSR_RCV_FIFO 0x80 /* error in receive fifo */ -#define LSR_TSRE 0x40 /* transmitter empty */ -#define LSR_TXRDY 0x20 /* transmitter ready */ -#define LSR_BI 0x10 /* break detected */ -#define LSR_FE 0x08 /* framing error */ -#define LSR_PE 0x04 /* parity error */ -#define LSR_OE 0x02 /* overrun error */ -#define LSR_RXRDY 0x01 /* receiver ready */ -#define LSR_RCV_MASK 0x1f - -/* modem status register */ -#define MSR_DCD 0x80 -#define MSR_RI 0x40 -#define MSR_DSR 0x20 -#define MSR_CTS 0x10 -#define MSR_DDCD 0x08 -#define MSR_TERI 0x04 -#define MSR_DDSR 0x02 -#define MSR_DCTS 0x01 - -#include -#include -#include - -/* DPMI Communication */ -static union REGS dpmi_regs; -static struct SREGS dpmi_sregs; - -/* 16550 rx fifo trigger point */ -#define FIFO_TRIGGER FIFO_TRIGGER_4 - -/* input buffer size */ -#define CBSIZE 4096 - -/* return raw 18Hz clock count */ -extern long rawclock (void); - -#define RAWHZ 18 - -#ifdef DOS_STATS -#define CNT_RX 16 -#define CNT_TX 17 -#define CNT_STRAY 18 -#define CNT_ORUN 19 -#define NCNT 20 - -static int intrcnt; -static int cnts[NCNT]; -static char *cntnames[NCNT] = { - /* h/w interrupt counts. */ - "mlsc", "nopend", "txrdy", "?3", - "rxrdy", "?5", "rls", "?7", - "?8", "?9", "?a", "?b", - "rxtout", "?d", "?e", "?f", - /* s/w counts. */ - "rxcnt", "txcnt", "stray", "swoflo" -}; - -#define COUNT(x) cnts[x]++ -#else -#define COUNT(x) -#endif - -/* Main interrupt controller port addresses. */ -#define ICU_BASE 0x20 -#define ICU_OCW2 (ICU_BASE + 0) -#define ICU_MASK (ICU_BASE + 1) - -/* Original interrupt controller mask register. */ -unsigned char icu_oldmask; - -/* Maximum of 8 interrupts (we don't handle the slave icu yet). */ -#define NINTR 8 - -static struct intrupt -{ - char inuse; - struct dos_ttystate *port; - _go32_dpmi_seginfo old_rmhandler; - _go32_dpmi_seginfo old_pmhandler; - _go32_dpmi_seginfo new_rmhandler; - _go32_dpmi_seginfo new_pmhandler; - _go32_dpmi_registers regs; -} intrupts[NINTR]; - - -static struct dos_ttystate -{ - int base; - int irq; - int refcnt; - struct intrupt *intrupt; - int fifo; - int baudrate; - unsigned char cbuf[CBSIZE]; - unsigned int first; - unsigned int count; - int txbusy; - unsigned char old_mcr; - int ferr; - int perr; - int oflo; - int msr; -} ports[4] = { - {COM1ADDR, 4}, - {COM2ADDR, 3}, - {COM3ADDR, 4}, - {COM4ADDR, 3} -}; - -static int dos_open PARAMS ((serial_t scb, const char *name)); -static void dos_raw PARAMS ((serial_t scb)); -static int dos_readchar PARAMS ((serial_t scb, int timeout)); -static int dos_setbaudrate PARAMS ((serial_t scb, int rate)); -static int dos_write PARAMS ((serial_t scb, const char *str, int len)); -static void dos_close PARAMS ((serial_t scb)); -static serial_ttystate dos_get_tty_state PARAMS ((serial_t scb)); -static int dos_set_tty_state PARAMS ((serial_t scb, serial_ttystate state)); -static int dos_baudconv PARAMS ((int rate)); - -#define inb(p,a) inportb((p)->base + (a)) -#define outb(p,a,v) outportb((p)->base + (a), (v)) -#define disable() asm volatile ("cli"); -#define enable() asm volatile ("sti"); - - -static int -dos_getc (port) - volatile struct dos_ttystate *port; -{ - int c; - - if (port->count == 0) - return -1; - - c = port->cbuf[port->first]; - disable (); - port->first = (port->first + 1) & (CBSIZE - 1); - port->count--; - enable (); - return c; -} - - -static int -dos_putc (c, port) - int c; - struct dos_ttystate *port; -{ - if (port->count >= CBSIZE - 1) - return -1; - port->cbuf[(port->first + port->count) & (CBSIZE - 1)] = c; - port->count++; - return 0; -} - - - -static void -dos_comisr (irq) - int irq; -{ - struct dos_ttystate *port; - unsigned char iir, lsr, c; - - disable (); /* Paranoia */ - outportb (ICU_OCW2, 0x20); /* End-Of-Interrupt */ -#ifdef DOS_STATS - ++intrcnt; -#endif - - port = intrupts[irq].port; - if (!port) - { - COUNT (CNT_STRAY); - return; /* not open */ - } - - while (1) - { - iir = inb (port, com_iir) & IIR_IMASK; - switch (iir) - { - - case IIR_RLS: - lsr = inb (port, com_lsr); - goto rx; - - case IIR_RXTOUT: - case IIR_RXRDY: - lsr = 0; - - rx: - do - { - c = inb (port, com_data); - if (lsr & (LSR_BI | LSR_FE | LSR_PE | LSR_OE)) - { - if (lsr & (LSR_BI | LSR_FE)) - port->ferr++; - else if (lsr & LSR_PE) - port->perr++; - if (lsr & LSR_OE) - port->oflo++; - } - - if (dos_putc (c, port) < 0) - { - COUNT (CNT_ORUN); - } - else - { - COUNT (CNT_RX); - } - } - while ((lsr = inb (port, com_lsr)) & LSR_RXRDY); - break; - - case IIR_MLSC: - /* could be used to flowcontrol Tx */ - port->msr = inb (port, com_msr); - break; - - case IIR_TXRDY: - port->txbusy = 0; - break; - - case IIR_NOPEND: - /* no more pending interrupts, all done */ - return; - - default: - /* unexpected interrupt, ignore */ - break; - } - COUNT (iir); - } -} - -#ifdef __STDC__ -#define ISRNAME(x) dos_comisr##x -#else -#define ISRNAME(x) dos_comisr/**/x -#endif -#define ISR(x) static void ISRNAME(x)() {dos_comisr(x);} - -ISR(0) ISR(1) ISR(2) ISR(3) -ISR(4) ISR(5) ISR(6) ISR(7) - -typedef void (*isr_t)(); - -static isr_t isrs[NINTR] = { - ISRNAME(0), ISRNAME(1), ISRNAME(2), ISRNAME(3), - ISRNAME(4), ISRNAME(5), ISRNAME(6), ISRNAME(7) -}; - - - -static struct intrupt * -dos_hookirq (irq) - unsigned int irq; -{ - struct intrupt *intr; - unsigned int vec; - isr_t isr; - - if (irq >= NINTR) - return 0; - - intr = &intrupts[irq]; - if (intr->inuse) - return 0; - - vec = 0x08 + irq; - isr = isrs[irq]; - - /* setup real mode handler */ - _go32_dpmi_get_real_mode_interrupt_vector (vec, &intr->old_rmhandler); - - intr->new_rmhandler.pm_selector = _go32_my_cs(); - intr->new_rmhandler.pm_offset = (u_long)isr; - if (_go32_dpmi_allocate_real_mode_callback_iret (&intr->new_rmhandler, - &intr->regs)) - { - return 0; - } - - if (_go32_dpmi_set_real_mode_interrupt_vector (vec, &intr->new_rmhandler)) - { - return 0; - } - - /* setup protected mode handler */ - _go32_dpmi_get_protected_mode_interrupt_vector(vec, &intr->old_pmhandler); - - intr->new_pmhandler.pm_selector = _go32_my_cs(); - intr->new_pmhandler.pm_offset = (u_long)isr; - _go32_dpmi_allocate_iret_wrapper (&intr->new_pmhandler); - - if (_go32_dpmi_set_protected_mode_interrupt_vector(vec, &intr->new_pmhandler)) - { - return 0; - } - - /* setup interrupt controller mask */ - disable (); - outportb (ICU_MASK, inportb (ICU_MASK) & ~(1 << irq)); - enable (); - - intr->inuse = 1; - return intr; -} - - -static void -dos_unhookirq (intr) - struct intrupt *intr; -{ - unsigned int irq, vec; - unsigned char mask; - - irq = intr - intrupts; - vec = 0x08 + irq; - - /* restore old interrupt mask bit */ - mask = 1 << irq; - disable (); - outportb (ICU_MASK, inportb (ICU_MASK) | (mask & icu_oldmask)); - enable (); - - /* remove real mode handler */ - _go32_dpmi_set_real_mode_interrupt_vector (vec, &intr->old_rmhandler); - _go32_dpmi_free_real_mode_callback (&intr->new_rmhandler); - - /* remove protected mode handler */ - _go32_dpmi_set_protected_mode_interrupt_vector (vec, &intr->old_pmhandler); - _go32_dpmi_free_iret_wrapper (&intr->new_pmhandler); - intr->inuse = 0; -} - - - -static int -dos_open (scb, name) - serial_t scb; - const char *name; -{ - struct dos_ttystate *port; - int fd, i; - - if (strncasecmp (name, "/dev/", 5) == 0) - name += 5; - else if (strncasecmp (name, "\\dev\\", 5) == 0) - name += 5; - - if (strlen (name) != 4 || strncasecmp (name, "com", 3) != 0) - { - errno = ENOENT; - return -1; - } - - if (name[3] < '1' || name[3] > '4') - { - errno = ENOENT; - return -1; - } - - fd = name[3] - '1'; - port = &ports[fd]; - if (port->refcnt++ > 0) - { - /* Device already opened another user. Just point at it. */ - scb->fd = fd; - return 0; - } - - /* force access to ID reg */ - outb(port, com_cfcr, 0); - outb(port, com_iir, 0); - for (i = 0; i < 17; i++) { - if ((inb(port, com_iir) & 0x38) == 0) - goto ok; - (void) inb(port, com_data); /* clear recv */ - } - errno = ENODEV; - return -1; - -ok: - /* disable all interrupts in chip */ - outb(port, com_ier, 0); - - /* tentatively enable 16550 fifo, and see if it responds */ - outb(port, com_fifo, FIFO_ENABLE|FIFO_RCV_RST|FIFO_XMT_RST|FIFO_TRIGGER); - sleep(1); - port->fifo = ((inb(port, com_iir) & IIR_FIFO_MASK) == IIR_FIFO_MASK); - - /* clear pending status reports. */ - (void) inb(port, com_lsr); - (void) inb(port, com_msr); - - /* enable external interrupt gate (to avoid floating IRQ) */ - outb(port, com_mcr, MCR_IENABLE); - - /* hook up interrupt handler and initialise icu */ - port->intrupt = dos_hookirq (port->irq); - if (!port->intrupt) - { - outb(port, com_mcr, 0); - outb(port, com_fifo, 0); - errno = ENODEV; - return -1; - } - - disable (); - - /* record port */ - port->intrupt->port = port; - scb->fd = fd; - - /* clear rx buffer, tx busy flag and overflow count */ - port->first = port->count = 0; - port->txbusy = 0; - port->oflo = 0; - - /* set default baud rate and mode: 9600,8,n,1 */ - i = dos_baudconv (port->baudrate = 9600); - outb(port, com_cfcr, CFCR_DLAB); - outb(port, com_dlbl, i & 0xff); - outb(port, com_dlbh, i >> 8); - outb(port, com_cfcr, CFCR_8BITS); - - /* enable all interrupts */ - outb(port, com_ier, IER_ETXRDY | IER_ERXRDY | IER_ERLS | IER_EMSC); - - /* enable DTR & RTS */ - outb(port, com_mcr, MCR_DTR | MCR_RTS | MCR_IENABLE); - - enable (); - - return 0; -} - - -static void -dos_close (scb) - serial_t scb; -{ - struct dos_ttystate *port; - struct intrupt *intrupt; - - if (!scb) - return; - - port = &ports[scb->fd]; - - if (port->refcnt-- > 1) - return; - - if (!(intrupt = port->intrupt)) - return; - - /* disable interrupts, fifo, flow control */ - disable (); - port->intrupt = 0; - intrupt->port = 0; - outb(port, com_fifo, 0); - outb(port, com_ier, 0); - enable (); - - /* unhook handler, and disable interrupt gate */ - dos_unhookirq (intrupt); - outb(port, com_mcr, 0); - - /* Check for overflow errors */ - if (port->oflo) - { - fprintf_unfiltered (gdb_stderr, - "Serial input overruns occurred.\n"); - fprintf_unfiltered (gdb_stderr, "This system %s handle %d baud.\n", - port->fifo ? "cannot" : "needs a 16550 to", - port->baudrate); - } -} - - - -static int -dos_noop (scb) - serial_t scb; -{ - return 0; -} - -static void -dos_raw (scb) - serial_t scb; -{ - /* Always in raw mode */ -} - -static int -dos_readchar (scb, timeout) - serial_t scb; - int timeout; -{ - struct dos_ttystate *port = &ports[scb->fd]; - long then; - int c; - - then = rawclock() + (timeout * RAWHZ); - while ((c = dos_getc (port)) < 0) - { - if (timeout >= 0 && (rawclock () - then) >= 0) - return SERIAL_TIMEOUT; - notice_quit (); - } - - return c; -} - - -static serial_ttystate -dos_get_tty_state (scb) - serial_t scb; -{ - struct dos_ttystate *port = &ports[scb->fd]; - struct dos_ttystate *state; - - state = (struct dos_ttystate *) xmalloc (sizeof *state); - *state = *port; - return (serial_ttystate) state; -} - -static int -dos_set_tty_state (scb, ttystate) - serial_t scb; - serial_ttystate ttystate; -{ - struct dos_ttystate *state; - - state = (struct dos_ttystate *) ttystate; - dos_setbaudrate (scb, state->baudrate); - return 0; -} - -static int -dos_noflush_set_tty_state (scb, new_ttystate, old_ttystate) - serial_t scb; - serial_ttystate new_ttystate; - serial_ttystate old_ttystate; -{ - struct dos_ttystate *state; - - state = (struct dos_ttystate *) new_ttystate; - dos_setbaudrate (scb, state->baudrate); - return 0; -} - -static int -dos_flush_input (scb) - serial_t scb; -{ - struct dos_ttystate *port = &ports[scb->fd]; - disable(); - port->first = port->count = 0; - if (port->fifo) - outb(port, com_fifo, FIFO_ENABLE|FIFO_RCV_RST|FIFO_TRIGGER); - enable(); -} - -static void -dos_print_tty_state (scb, ttystate) - serial_t scb; - serial_ttystate ttystate; -{ - /* Nothing to print */ - return; -} - -static int -dos_baudconv (rate) - int rate; -{ - long x, err; - - if (rate <= 0) - return -1; - -#define divrnd(n, q) (((n) * 2 / (q) + 1) / 2) /* divide and round off */ - x = divrnd(COMTICK, rate); - if (x <= 0) - return -1; - - err = divrnd(1000 * COMTICK, x * rate) - 1000; - if (err < 0) - err = -err; - if (err > SPEED_TOLERANCE) - return -1; -#undef divrnd - return x; -} - - -static int -dos_setbaudrate (scb, rate) - serial_t scb; - int rate; -{ - struct dos_ttystate *port = &ports[scb->fd]; - - if (port->baudrate != rate) - { - int x; - unsigned char cfcr; - - x = dos_baudconv (rate); - if (x <= 0) - { - fprintf_unfiltered (gdb_stderr, "%d: impossible baudrate\n", rate); - errno = EINVAL; - return -1; - } - - disable (); - cfcr = inb (port, com_cfcr); - - outb(port, com_cfcr, CFCR_DLAB); - outb(port, com_dlbl, x & 0xff); - outb(port, com_dlbh, x >> 8); - outb(port, com_cfcr, cfcr); - port->baudrate = rate; - enable (); - } - - return 0; -} - -static int -dos_setstopbits (scb, num) - serial_t scb; - int num; -{ - struct dos_ttystate *port = &ports[scb->fd]; - unsigned char cfcr; - - disable (); - cfcr = inb (port, com_cfcr); - - switch (num) - { - case SERIAL_1_STOPBITS: - outb (port, com_cfcr, cfcr & ~CFCR_STOPB); - break; - case SERIAL_1_AND_A_HALF_STOPBITS: - case SERIAL_2_STOPBITS: - outb (port, com_cfcr, cfcr | CFCR_STOPB); - break; - default: - enable (); - return 1; - } - enable (); - - return 0; -} - -static int -dos_write (scb, str, len) - serial_t scb; - const char *str; - int len; -{ - volatile struct dos_ttystate *port = &ports[scb->fd]; - int fifosize = port->fifo ? 16 : 1; - long then; - int cnt; - - while (len > 0) - { - /* send the data, fifosize bytes at a time */ - cnt = fifosize > len ? len : fifosize; - port->txbusy = 1; - outportsb (port->base + com_data, str, cnt); - str += cnt; - len -= cnt; -#ifdef DOS_STATS - cnts[CNT_TX] += cnt; -#endif - /* wait for transmission to complete (max 1 sec) */ - then = rawclock() + RAWHZ; - while (port->txbusy) - { - if ((rawclock () - then) >= 0) - { - errno = EIO; - return SERIAL_ERROR; - } - } - } - return 0; -} - - -static int -dos_sendbreak (scb) - serial_t scb; -{ - volatile struct dos_ttystate *port = &ports[scb->fd]; - unsigned char cfcr; - long then; - - cfcr = inb(port, com_cfcr); - outb(port, com_cfcr, cfcr | CFCR_SBREAK); - - /* 0.25 sec delay */ - then = rawclock () + RAWHZ / 4; - while ((rawclock () - then) < 0) - continue; - - outb(port, com_cfcr, cfcr); - return 0; -} - - -static struct serial_ops dos_ops = -{ - "hardwire", - 0, - dos_open, - dos_close, - dos_readchar, - dos_write, - dos_noop, /* flush output */ - dos_flush_input, - dos_sendbreak, - dos_raw, - dos_get_tty_state, - dos_set_tty_state, - dos_print_tty_state, - dos_noflush_set_tty_state, - dos_setbaudrate, - dos_setstopbits, -}; - - -static void -dos_info (arg, from_tty) - char *arg; - int from_tty; -{ - struct dos_ttystate *port; - int i; - - for (port = ports; port < &ports[4]; port++) - { - if (port->baudrate == 0) - continue; - printf_filtered ("Port:\tCOM%d (%sactive)\n", port - ports + 1, - port->intrupt ? "" : "not "); - printf_filtered ("Addr:\t0x%03x (irq %d)\n", port->base, port->irq); - printf_filtered ("16550:\t%s\n", port->fifo ? "yes" : "no"); - printf_filtered ("Speed:\t%d baud\n", port->baudrate); - printf_filtered ("Errs:\tframing %d parity %d overflow %d\n\n", - port->ferr, port->perr, port->oflo); - } - -#ifdef DOS_STATS - printf_filtered ("\nTotal interrupts: %d\n", intrcnt); - for (i = 0; i < NCNT; i++) - if (cnts[i]) - printf_filtered ("%s:\t%d\n", cntnames[i], cnts[i]); -#endif -} - - -void -_initialize_ser_dos () -{ - struct cmd_list_element *c; - - serial_add_interface (&dos_ops); - - /* Save original interrupt mask register. */ - icu_oldmask = inportb (ICU_MASK); - - /* Mark fixed motherboard irqs as inuse. */ - intrupts[0].inuse = /* timer tick */ - intrupts[1].inuse = /* keyboard */ - intrupts[2].inuse = 1; /* slave icu */ - - add_show_from_set ( - add_set_cmd ("com1base", class_obscure, var_zinteger, - (char *) &ports[0].base, - "Set COM1 base i/o port address.", - &setlist), - &showlist); - - add_show_from_set ( - add_set_cmd ("com1irq", class_obscure, var_zinteger, - (char *) &ports[0].irq, - "Set COM1 interrupt request.", - &setlist), - &showlist); - - add_show_from_set ( - add_set_cmd ("com2base", class_obscure, var_zinteger, - (char *) &ports[1].base, - "Set COM2 base i/o port address.", - &setlist), - &showlist); - - add_show_from_set ( - add_set_cmd ("com2irq", class_obscure, var_zinteger, - (char *) &ports[1].irq, - "Set COM2 interrupt request.", - &setlist), - &showlist); - - add_show_from_set ( - add_set_cmd ("com3base", class_obscure, var_zinteger, - (char *) &ports[2].base, - "Set COM3 base i/o port address.", - &setlist), - &showlist); - - add_show_from_set ( - add_set_cmd ("com3irq", class_obscure, var_zinteger, - (char *) &ports[2].irq, - "Set COM3 interrupt request.", - &setlist), - &showlist); - - add_show_from_set ( - add_set_cmd ("com4base", class_obscure, var_zinteger, - (char *) &ports[3].base, - "Set COM4 base i/o port address.", - &setlist), - &showlist); - - add_show_from_set ( - add_set_cmd ("com4irq", class_obscure, var_zinteger, - (char *) &ports[3].irq, - "Set COM4 interrupt request.", - &setlist), - &showlist); - - add_info ("serial", dos_info, - "Print DOS serial port status."); -} diff --git a/contrib/gdb/gdb/ser-mac.c b/contrib/gdb/gdb/ser-mac.c deleted file mode 100644 index e27a9dd0..0000000 --- a/contrib/gdb/gdb/ser-mac.c +++ /dev/null @@ -1,361 +0,0 @@ -/* Remote serial interface for local (hardwired) serial ports for Macintosh. - Copyright 1994 Free Software Foundation, Inc. - Contributed by Cygnus Support. Written by Stan Shebs. - - 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 "serial.h" - -#include -#include -/* This is the regular Mac Serial.h, but copied to a different name - so as not to get confused with the GDB serial.h above. */ -#include "MacSerial.h" - -/* This is unused for now. We just return a placeholder. */ - -struct mac_ttystate - { - int bogus; - }; - -static int mac_open PARAMS ((serial_t scb, const char *name)); -static void mac_raw PARAMS ((serial_t scb)); -static int mac_readchar PARAMS ((serial_t scb, int timeout)); -static int mac_setbaudrate PARAMS ((serial_t scb, int rate)); -static int mac_write PARAMS ((serial_t scb, const char *str, int len)); -static void mac_close PARAMS ((serial_t scb)); -static serial_ttystate mac_get_tty_state PARAMS ((serial_t scb)); -static int mac_set_tty_state PARAMS ((serial_t scb, serial_ttystate state)); -static char *aptr PARAMS ((short p)); - -short input_refnum; -short output_refnum; - -char *mac_input_buffer; -char *mac_output_buffer; - -static int -mac_open (scb, name) - serial_t scb; - const char *name; -{ - OSErr err; - - /* Alloc buffer space first - that way any allocation failures are - intercepted before the serial driver gets involved. */ - if (mac_input_buffer == NULL) - mac_input_buffer = (char *) xmalloc (4096); - /* Match on a name and open a port. */ - if (strcmp (name, "modem") == 0) - { - err = OpenDriver ("\p.AIn", &input_refnum); - if (err != 0) - { - return (-1); - } - err = OpenDriver ("\p.AOut", &output_refnum); - if (err != 0) - { - CloseDriver (input_refnum); - return (-1); - } - } - else if (strcmp (name, "printer") == 0) - { - err = OpenDriver ("\p.BIn", &input_refnum); - if (err != 0) - { - return (-1); - } - err = OpenDriver ("\p.BOut", &output_refnum); - if (err != 0) - { - CloseDriver (input_refnum); - return (-1); - } - /* fake */ - scb->fd = 1; - return 0; - } - else - { - error ("You must specify a valid serial port name; your choices are `modem' or `printer'."); - errno = ENOENT; - return (-1); - } - /* We got something open. */ - if (1 /* using custom buffer */) - SerSetBuf (input_refnum, mac_input_buffer, 4096); - /* Set to a GDB-preferred state. */ - SerReset (input_refnum, stop10|noParity|data8|baud9600); - SerReset (output_refnum, stop10|noParity|data8|baud9600); - { - CntrlParam cb; - struct SerShk *handshake; - - cb.ioCRefNum = output_refnum; - cb.csCode = 14; - handshake = (struct SerShk *) &cb.csParam[0]; - handshake->fXOn = 0; - handshake->fCTS = 0; - handshake->xOn = 0; - handshake->xOff = 0; - handshake->errs = 0; - handshake->evts = 0; - handshake->fInX = 0; - handshake->fDTR = 0; - err = PBControl ((ParmBlkPtr) &cb, 0); - if (err < 0) - return (-1); - } - /* fake */ - scb->fd = 1; - return 0; -} - -static int -mac_noop (scb) - serial_t scb; -{ - return 0; -} - -static void -mac_raw (scb) - serial_t scb; -{ - /* Always effectively in raw mode. */ -} - -/* Read a character with user-specified timeout. TIMEOUT is number of seconds - to wait, or -1 to wait forever. Use timeout of 0 to effect a poll. Returns - char if successful. Returns -2 if timeout expired, EOF if line dropped - dead, or -3 for any other error (see errno in that case). */ - -static int -mac_readchar (scb, timeout) - serial_t scb; - int timeout; -{ - int status, n; - /* time_t */ unsigned long start_time, now; - OSErr err; - CntrlParam cb; - IOParam pb; - - if (scb->bufcnt-- > 0) - return *scb->bufp++; - - time (&start_time); - - while (1) - { - cb.ioCRefNum = input_refnum; - cb.csCode = 2; - err = PBStatus ((ParmBlkPtr) &cb, 0); - if (err < 0) - return SERIAL_ERROR; - n = *((long *) &cb.csParam[0]); - if (n > 0) - { - pb.ioRefNum = input_refnum; - pb.ioBuffer = (Ptr) (scb->buf); - pb.ioReqCount = (n > 64 ? 64 : n); - err = PBRead ((ParmBlkPtr) &pb, 0); - if (err < 0) - return SERIAL_ERROR; - scb->bufcnt = pb.ioReqCount; - scb->bufcnt--; - scb->bufp = scb->buf; - return *scb->bufp++; - } - else if (timeout == 0) - return SERIAL_TIMEOUT; - else if (timeout == -1) - ; - else - { - time (&now); - if (now > start_time + timeout) - return SERIAL_TIMEOUT; - } - PROGRESS (1); - } -} - -/* mac_{get set}_tty_state() are both dummys to fill out the function - vector. Someday, they may do something real... */ - -static serial_ttystate -mac_get_tty_state (scb) - serial_t scb; -{ - struct mac_ttystate *state; - - state = (struct mac_ttystate *) xmalloc (sizeof *state); - - return (serial_ttystate) state; -} - -static int -mac_set_tty_state (scb, ttystate) - serial_t scb; - serial_ttystate ttystate; -{ - return 0; -} - -static int -mac_noflush_set_tty_state (scb, new_ttystate, old_ttystate) - serial_t scb; - serial_ttystate new_ttystate; - serial_ttystate old_ttystate; -{ - return 0; -} - -static void -mac_print_tty_state (scb, ttystate) - serial_t scb; - serial_ttystate ttystate; -{ - /* Nothing to print. */ - return; -} - -/* If there is a tricky formula to relate real baud rates - to what the serial driver wants, we should use it. Until - we get one, this table will have to do. */ - -static struct { - int real_rate; - int bits; -} mac_baud_rate_table[] = { - { 57600, baud57600 }, - { 38400, 1 }, - { 19200, baud19200 }, - { 9600, baud9600 }, - { 7200, baud7200 }, - { 4800, baud4800 }, - { 3600, baud3600 }, - { 2400, baud2400 }, - { 1800, baud1800 }, - { 1200, baud1200 }, - { 600, baud600 }, - { 300, baud300 }, - { 0, 0 } -}; - -static int -mac_set_baud_rate (scb, rate) - serial_t scb; - int rate; -{ - int i, bits; - - for (i = 0; mac_baud_rate_table[i].real_rate != 0; ++i) - { - if (mac_baud_rate_table[i].real_rate == rate) - { - bits = mac_baud_rate_table[i].bits; - break; - } - } - SerReset (input_refnum, stop10|noParity|data8|bits); - SerReset (output_refnum, stop10|noParity|data8|bits); -} - -static int -mac_set_stop_bits (scb, num) - serial_t scb; - int num; -{ - return 0; -} - -int first_mac_write = 0; - -static int -mac_write (scb, str, len) - serial_t scb; - const char *str; - int len; -{ - OSErr err; - IOParam pb; - - if (first_mac_write++ < 4) - { - sleep (1); - } - pb.ioRefNum = output_refnum; - pb.ioBuffer = (Ptr) str; - pb.ioReqCount = len; - err = PBWrite ((ParmBlkPtr) &pb, 0); - if (err < 0) - { - return 1; - } - return 0; -} - -static void -mac_close (serial_t scb) -{ - if (input_refnum) - { - if (1 /* custom buffer */) - SerSetBuf (input_refnum, mac_input_buffer, 0); - CloseDriver (input_refnum); - input_refnum = 0; - } - if (output_refnum) - { - if (0 /* custom buffer */) - SetSetBuf (input_refnum, mac_output_buffer, 0); - CloseDriver (output_refnum); - output_refnum = 0; - } -} - -static struct serial_ops mac_ops = -{ - "hardwire", - 0, - mac_open, - mac_close, - mac_readchar, - mac_write, - mac_noop, /* flush output */ - mac_noop, /* flush input */ - mac_noop, /* send break -- currently only for nindy */ - mac_raw, - mac_get_tty_state, - mac_set_tty_state, - mac_print_tty_state, - mac_noflush_set_tty_state, - mac_set_baud_rate, - mac_set_stop_bits, -}; - -void -_initialize_ser_mac () -{ - serial_add_interface (&mac_ops); -} diff --git a/contrib/gdb/gdb/somread.c b/contrib/gdb/gdb/somread.c deleted file mode 100644 index ab8d531..0000000 --- a/contrib/gdb/gdb/somread.c +++ /dev/null @@ -1,470 +0,0 @@ -/* Read HP PA/Risc object files for GDB. - Copyright 1991, 1992, 1996 Free Software Foundation, Inc. - Written by Fred Fish at Cygnus Support. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without 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 "bfd.h" -#include "som.h" -#include "libhppa.h" -#include -#include "symtab.h" -#include "symfile.h" -#include "objfiles.h" -#include "buildsym.h" -#include "stabsread.h" -#include "gdb-stabs.h" -#include "complaints.h" -#include "gdb_string.h" -#include "demangle.h" -#include - -/* Various things we might complain about... */ - -static void -som_symfile_init PARAMS ((struct objfile *)); - -static void -som_new_init PARAMS ((struct objfile *)); - -static void -som_symfile_read PARAMS ((struct objfile *, struct section_offsets *, int)); - -static void -som_symfile_finish PARAMS ((struct objfile *)); - -static void -som_symtab_read PARAMS ((bfd *, struct objfile *, - struct section_offsets *)); - -static struct section_offsets * -som_symfile_offsets PARAMS ((struct objfile *, CORE_ADDR)); - -static void -record_minimal_symbol PARAMS ((char *, CORE_ADDR, - enum minimal_symbol_type, - struct objfile *)); - -static void -record_minimal_symbol (name, address, ms_type, objfile) - char *name; - CORE_ADDR address; - enum minimal_symbol_type ms_type; - struct objfile *objfile; -{ - name = obsavestring (name, strlen (name), &objfile -> symbol_obstack); - prim_record_minimal_symbol (name, address, ms_type, objfile); -} - -/* - -LOCAL FUNCTION - - som_symtab_read -- read the symbol table of a SOM file - -SYNOPSIS - - void som_symtab_read (bfd *abfd, struct objfile *objfile, - struct section_offsets *section_offsets) - -DESCRIPTION - - Given an open bfd, a base address to relocate symbols to, and a - flag that specifies whether or not this bfd is for an executable - or not (may be shared library for example), add all the global - function and data symbols to the minimal symbol table. -*/ - -static void -som_symtab_read (abfd, objfile, section_offsets) - bfd *abfd; - struct objfile *objfile; - struct section_offsets *section_offsets; -{ - unsigned int number_of_symbols; - int val, dynamic; - char *stringtab; - asection *shlib_info; - struct symbol_dictionary_record *buf, *bufp, *endbufp; - char *symname; - CONST int symsize = sizeof (struct symbol_dictionary_record); - CORE_ADDR text_offset, data_offset; - - - text_offset = ANOFFSET (section_offsets, 0); - data_offset = ANOFFSET (section_offsets, 1); - - number_of_symbols = bfd_get_symcount (abfd); - - buf = alloca (symsize * number_of_symbols); - bfd_seek (abfd, obj_som_sym_filepos (abfd), SEEK_SET); - val = bfd_read (buf, symsize * number_of_symbols, 1, abfd); - if (val != symsize * number_of_symbols) - error ("Couldn't read symbol dictionary!"); - - stringtab = alloca (obj_som_stringtab_size (abfd)); - bfd_seek (abfd, obj_som_str_filepos (abfd), SEEK_SET); - val = bfd_read (stringtab, obj_som_stringtab_size (abfd), 1, abfd); - if (val != obj_som_stringtab_size (abfd)) - error ("Can't read in HP string table."); - - /* We need to determine if objfile is a dynamic executable (so we - can do the right thing for ST_ENTRY vs ST_CODE symbols). - - There's nothing in the header which easily allows us to do - this. The only reliable way I know of is to check for the - existance of a $SHLIB_INFO$ section with a non-zero size. */ - shlib_info = bfd_get_section_by_name (objfile->obfd, "$SHLIB_INFO$"); - if (shlib_info) - dynamic = (bfd_section_size (objfile->obfd, shlib_info) != 0); - else - dynamic = 0; - - endbufp = buf + number_of_symbols; - for (bufp = buf; bufp < endbufp; ++bufp) - { - enum minimal_symbol_type ms_type; - - QUIT; - - switch (bufp->symbol_scope) - { - case SS_UNIVERSAL: - case SS_EXTERNAL: - switch (bufp->symbol_type) - { - case ST_SYM_EXT: - case ST_ARG_EXT: - continue; - - case ST_CODE: - case ST_PRI_PROG: - case ST_SEC_PROG: - case ST_MILLICODE: - symname = bufp->name.n_strx + stringtab; - ms_type = mst_text; - bufp->symbol_value += text_offset; -#ifdef SMASH_TEXT_ADDRESS - SMASH_TEXT_ADDRESS (bufp->symbol_value); -#endif - break; - - case ST_ENTRY: - symname = bufp->name.n_strx + stringtab; - /* For a dynamic executable, ST_ENTRY symbols are - the stubs, while the ST_CODE symbol is the real - function. */ - if (dynamic) - ms_type = mst_solib_trampoline; - else - ms_type = mst_text; - bufp->symbol_value += text_offset; -#ifdef SMASH_TEXT_ADDRESS - SMASH_TEXT_ADDRESS (bufp->symbol_value); -#endif - break; - - case ST_STUB: - symname = bufp->name.n_strx + stringtab; - ms_type = mst_solib_trampoline; - bufp->symbol_value += text_offset; -#ifdef SMASH_TEXT_ADDRESS - SMASH_TEXT_ADDRESS (bufp->symbol_value); -#endif - break; - - case ST_DATA: - symname = bufp->name.n_strx + stringtab; - bufp->symbol_value += data_offset; - ms_type = mst_data; - break; - default: - continue; - } - break; - -#if 0 - /* SS_GLOBAL and SS_LOCAL are two names for the same thing (!). */ - case SS_GLOBAL: -#endif - case SS_LOCAL: - switch (bufp->symbol_type) - { - case ST_SYM_EXT: - case ST_ARG_EXT: - continue; - - case ST_CODE: - symname = bufp->name.n_strx + stringtab; - ms_type = mst_file_text; - bufp->symbol_value += text_offset; -#ifdef SMASH_TEXT_ADDRESS - SMASH_TEXT_ADDRESS (bufp->symbol_value); -#endif - - check_strange_names: - /* Utah GCC 2.5, FSF GCC 2.6 and later generate correct local - label prefixes for stabs, constant data, etc. So we need - only filter out L$ symbols which are left in due to - limitations in how GAS generates SOM relocations. - - When linking in the HPUX C-library the HP linker has - the nasty habit of placing section symbols from the literal - subspaces in the middle of the program's text. Filter - those out as best we can. Check for first and last character - being '$'. - - And finally, the newer HP compilers emit crud like $PIC_foo$N - in some circumstance (PIC code I guess). It's also claimed - that they emit D$ symbols too. What stupidity. */ - if ((symname[0] == 'L' && symname[1] == '$') - || (symname[0] == '$' && symname[strlen(symname) - 1] == '$') - || (symname[0] == 'D' && symname[1] == '$') - || (strncmp (symname, "$PIC", 4) == 0)) - continue; - break; - - case ST_PRI_PROG: - case ST_SEC_PROG: - case ST_MILLICODE: - symname = bufp->name.n_strx + stringtab; - ms_type = mst_file_text; - bufp->symbol_value += text_offset; -#ifdef SMASH_TEXT_ADDRESS - SMASH_TEXT_ADDRESS (bufp->symbol_value); -#endif - break; - - case ST_ENTRY: - symname = bufp->name.n_strx + stringtab; - /* For a dynamic executable, ST_ENTRY symbols are - the stubs, while the ST_CODE symbol is the real - function. */ - if (dynamic) - ms_type = mst_solib_trampoline; - else - ms_type = mst_file_text; - bufp->symbol_value += text_offset; -#ifdef SMASH_TEXT_ADDRESS - SMASH_TEXT_ADDRESS (bufp->symbol_value); -#endif - break; - - case ST_STUB: - symname = bufp->name.n_strx + stringtab; - ms_type = mst_solib_trampoline; - bufp->symbol_value += text_offset; -#ifdef SMASH_TEXT_ADDRESS - SMASH_TEXT_ADDRESS (bufp->symbol_value); -#endif - break; - - - case ST_DATA: - symname = bufp->name.n_strx + stringtab; - bufp->symbol_value += data_offset; - ms_type = mst_file_data; - goto check_strange_names; - - default: - continue; - } - break; - - /* This can happen for common symbols when -E is passed to the - final link. No idea _why_ that would make the linker force - common symbols to have an SS_UNSAT scope, but it does. */ - case SS_UNSAT: - switch (bufp->symbol_type) - { - case ST_STORAGE: - symname = bufp->name.n_strx + stringtab; - bufp->symbol_value += data_offset; - ms_type = mst_data; - break; - - default: - continue; - } - break; - - default: - continue; - } - - if (bufp->name.n_strx > obj_som_stringtab_size (abfd)) - error ("Invalid symbol data; bad HP string table offset: %d", - bufp->name.n_strx); - - record_minimal_symbol (symname, - bufp->symbol_value, ms_type, - objfile); - } -} - -/* Scan and build partial symbols for a symbol file. - We have been initialized by a call to som_symfile_init, which - currently does nothing. - - SECTION_OFFSETS is a set of offsets to apply to relocate the symbols - in each section. This is ignored, as it isn't needed for SOM. - - MAINLINE is true if we are reading the main symbol - table (as opposed to a shared lib or dynamically loaded file). - - This function only does the minimum work necessary for letting the - user "name" things symbolically; it does not read the entire symtab. - Instead, it reads the external and static symbols and puts them in partial - symbol tables. When more extensive information is requested of a - file, the corresponding partial symbol table is mutated into a full - fledged symbol table by going back and reading the symbols - for real. - - We look for sections with specific names, to tell us what debug - format to look for: FIXME!!! - - somstab_build_psymtabs() handles STABS symbols. - - Note that SOM files have a "minimal" symbol table, which is vaguely - reminiscent of a COFF symbol table, but has only the minimal information - necessary for linking. We process this also, and use the information to - build gdb's minimal symbol table. This gives us some minimal debugging - capability even for files compiled without -g. */ - -static void -som_symfile_read (objfile, section_offsets, mainline) - struct objfile *objfile; - struct section_offsets *section_offsets; - int mainline; -{ - bfd *abfd = objfile->obfd; - struct cleanup *back_to; - - init_minimal_symbol_collection (); - back_to = make_cleanup (discard_minimal_symbols, 0); - - /* Process the normal SOM symbol table first. */ - - som_symtab_read (abfd, objfile, section_offsets); - - /* Now read information from the stabs debug sections. */ - stabsect_build_psymtabs (objfile, section_offsets, mainline, - "$GDB_SYMBOLS$", "$GDB_STRINGS$", "$TEXT$"); - - /* Now read the native debug information. */ - hpread_build_psymtabs (objfile, section_offsets, mainline); - - /* Install any minimal symbols that have been collected as the current - minimal symbols for this objfile. */ - install_minimal_symbols (objfile); - - /* Force hppa-tdep.c to re-read the unwind descriptors. */ - objfile->obj_private = NULL; - do_cleanups (back_to); -} - -/* Initialize anything that needs initializing when a completely new symbol - file is specified (not just adding some symbols from another file, e.g. a - shared library). - - We reinitialize buildsym, since we may be reading stabs from a SOM file. */ - -static void -som_new_init (ignore) - struct objfile *ignore; -{ - stabsread_new_init (); - buildsym_new_init (); -} - -/* Perform any local cleanups required when we are done with a particular - objfile. I.E, we are in the process of discarding all symbol information - for an objfile, freeing up all memory held for it, and unlinking the - objfile struct from the global list of known objfiles. */ - -static void -som_symfile_finish (objfile) - struct objfile *objfile; -{ - if (objfile -> sym_stab_info != NULL) - { - mfree (objfile -> md, objfile -> sym_stab_info); - } - hpread_symfile_finish (objfile); -} - -/* SOM specific initialization routine for reading symbols. */ - -static void -som_symfile_init (objfile) - struct objfile *objfile; -{ - /* SOM objects may be reordered, so set OBJF_REORDERED. If we - find this causes a significant slowdown in gdb then we could - set it in the debug symbol readers only when necessary. */ - objfile->flags |= OBJF_REORDERED; - hpread_symfile_init (objfile); -} - -/* SOM specific parsing routine for section offsets. - - Plain and simple for now. */ - -static struct section_offsets * -som_symfile_offsets (objfile, addr) - struct objfile *objfile; - CORE_ADDR addr; -{ - struct section_offsets *section_offsets; - int i; - - objfile->num_sections = SECT_OFF_MAX; - section_offsets = (struct section_offsets *) - obstack_alloc (&objfile -> psymbol_obstack, - sizeof (struct section_offsets) - + sizeof (section_offsets->offsets) * (SECT_OFF_MAX-1)); - - /* First see if we're a shared library. If so, get the section - offsets from the library, else get them from addr. */ - if (!som_solib_section_offsets (objfile, section_offsets)) - { - for (i = 0; i < SECT_OFF_MAX; i++) - ANOFFSET (section_offsets, i) = addr; - } - - return section_offsets; -} - -/* Register that we are able to handle SOM object file formats. */ - -static struct sym_fns som_sym_fns = -{ - bfd_target_som_flavour, - som_new_init, /* sym_new_init: init anything gbl to entire symtab */ - som_symfile_init, /* sym_init: read initial info, setup for sym_read() */ - som_symfile_read, /* sym_read: read a symbol file into symtab */ - som_symfile_finish, /* sym_finish: finished with file, cleanup */ - som_symfile_offsets, /* sym_offsets: Translate ext. to int. relocation */ - NULL /* next: pointer to next struct sym_fns */ -}; - -void -_initialize_somread () -{ - add_symtab_fns (&som_sym_fns); -} diff --git a/contrib/gdb/gdb/somsolib.c b/contrib/gdb/gdb/somsolib.c deleted file mode 100644 index 1c32837..0000000 --- a/contrib/gdb/gdb/somsolib.c +++ /dev/null @@ -1,820 +0,0 @@ -/* Handle HP SOM shared libraries for GDB, the GNU Debugger. - Copyright 1993, 1996 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -Written by the Center for Software Science at the Univerity of Utah -and by Cygnus Support. */ - - -#include "defs.h" - -#include "frame.h" -#include "bfd.h" -#include "som.h" -#include "libhppa.h" -#include "gdbcore.h" -#include "symtab.h" -#include "breakpoint.h" -#include "symfile.h" -#include "objfiles.h" -#include "inferior.h" -#include "gdb-stabs.h" -#include "gdbcmd.h" - -/* TODO: - - * Most of this code should work for hp300 shared libraries. Does - anyone care enough to weed out any SOM-isms. - - * Support for hpux8 dynamic linker. */ - -/* The basic structure which describes a dynamically loaded object. This - data structure is private to the dynamic linker and isn't found in - any HPUX include file. */ - -struct som_solib_mapped_entry -{ - /* The name of the library. */ - char *name; - - /* Version of this structure (it is expected to change again in hpux10). */ - unsigned char struct_version; - - /* Binding mode for this library. */ - unsigned char bind_mode; - - /* Version of this library. */ - short library_version; - - /* Start of text address, link-time text location, end of text address. */ - CORE_ADDR text_addr; - CORE_ADDR text_link_addr; - CORE_ADDR text_end; - - /* Start of data, start of bss and end of data. */ - CORE_ADDR data_start; - CORE_ADDR bss_start; - CORE_ADDR data_end; - - /* Value of linkage pointer (%r19). */ - CORE_ADDR got_value; - - /* Next entry. */ - struct som_solib_mapped_entry *next; - - /* There are other fields, but I don't have information as to what is - contained in them. */ -}; - -/* A structure to keep track of all the known shared objects. */ -struct so_list -{ - struct som_solib_mapped_entry som_solib; - struct objfile *objfile; - bfd *abfd; - struct section_table *sections; - struct section_table *sections_end; - struct so_list *next; -}; - -static struct so_list *so_list_head; - -static void som_sharedlibrary_info_command PARAMS ((char *, int)); - -/* Add symbols from shared libraries into the symtab list. */ - -void -som_solib_add (arg_string, from_tty, target) - char *arg_string; - int from_tty; - struct target_ops *target; -{ - struct minimal_symbol *msymbol; - struct so_list *so_list_tail; - CORE_ADDR addr; - asection *shlib_info; - int status; - unsigned int dld_flags; - char buf[4], *re_err; - - /* First validate our arguments. */ - if ((re_err = re_comp (arg_string ? arg_string : ".")) != NULL) - { - error ("Invalid regexp: %s", re_err); - } - - /* If we're debugging a core file, or have attached to a running - process, then som_solib_create_inferior_hook will not have been - called. - - We need to first determine if we're dealing with a dynamically - linked executable. If not, then return without an error or warning. - - We also need to examine __dld_flags to determine if the shared library - list is valid and to determine if the libraries have been privately - mapped. */ - if (symfile_objfile == NULL) - return; - - /* First see if the objfile was dynamically linked. */ - shlib_info = bfd_get_section_by_name (symfile_objfile->obfd, "$SHLIB_INFO$"); - if (!shlib_info) - return; - - /* It's got a $SHLIB_INFO$ section, make sure it's not empty. */ - if (bfd_section_size (symfile_objfile->obfd, shlib_info) == 0) - return; - - msymbol = lookup_minimal_symbol ("__dld_flags", NULL, NULL); - if (msymbol == NULL) - { - error ("Unable to find __dld_flags symbol in object file.\n"); - return; - } - - addr = SYMBOL_VALUE_ADDRESS (msymbol); - /* Read the current contents. */ - status = target_read_memory (addr, buf, 4); - if (status != 0) - { - error ("Unable to read __dld_flags\n"); - return; - } - dld_flags = extract_unsigned_integer (buf, 4); - - /* __dld_list may not be valid. If it's not valid tell the user. */ - if ((dld_flags & 4) == 0) - { - error ("__dld_list is not valid according to __dld_flags.\n"); - return; - } - - /* If the libraries were not mapped private, warn the user. */ - if ((dld_flags & 1) == 0) - warning ("The shared libraries were not privately mapped; setting a\nbreakpoint in a shared library will not work until you rerun the program.\n"); - - msymbol = lookup_minimal_symbol ("__dld_list", NULL, NULL); - if (!msymbol) - { - /* Older crt0.o files (hpux8) don't have __dld_list as a symbol, - but the data is still available if you know where to look. */ - msymbol = lookup_minimal_symbol ("__dld_flags", NULL, NULL); - if (!msymbol) - { - error ("Unable to find dynamic library list.\n"); - return; - } - addr = SYMBOL_VALUE_ADDRESS (msymbol) - 8; - } - else - addr = SYMBOL_VALUE_ADDRESS (msymbol); - - status = target_read_memory (addr, buf, 4); - if (status != 0) - { - error ("Unable to find dynamic library list.\n"); - return; - } - - addr = extract_unsigned_integer (buf, 4); - - /* If addr is zero, then we're using an old dynamic loader which - doesn't maintain __dld_list. We'll have to use a completely - different approach to get shared library information. */ - if (addr == 0) - goto old_dld; - - /* Using the information in __dld_list is the preferred method - to get at shared library information. It doesn't depend on - any functions in /usr/lib/end.o and has a chance of working - with hpux10 when it is released. */ - status = target_read_memory (addr, buf, 4); - if (status != 0) - { - error ("Unable to find dynamic library list.\n"); - return; - } - - /* addr now holds the address of the first entry in the dynamic - library list. */ - addr = extract_unsigned_integer (buf, 4); - - /* Now that we have a pointer to the dynamic library list, walk - through it and add the symbols for each library. */ - - so_list_tail = so_list_head; - /* Find the end of the list of shared objects. */ - while (so_list_tail && so_list_tail->next) - so_list_tail = so_list_tail->next; - - while (1) - { - CORE_ADDR name_addr, text_addr; - unsigned int name_len; - char *name; - struct so_list *new_so; - struct so_list *so_list = so_list_head; - struct section_table *p; - struct stat statbuf; - - if (addr == 0) - break; - - /* Get a pointer to the name of this library. */ - status = target_read_memory (addr, buf, 4); - if (status != 0) - goto err; - - name_addr = extract_unsigned_integer (buf, 4); - name_len = 0; - while (1) - { - target_read_memory (name_addr + name_len, buf, 1); - if (status != 0) - goto err; - - name_len++; - if (*buf == '\0') - break; - } - name = alloca (name_len); - status = target_read_memory (name_addr, name, name_len); - if (status != 0) - goto err; - - /* See if we've already loaded something with this name. */ - while (so_list) - { - if (!strcmp (so_list->som_solib.name, name)) - break; - so_list = so_list->next; - } - - /* See if the file exists. If not, give a warning, but don't - die. */ - status = stat (name, &statbuf); - if (status == -1) - { - warning ("Can't find file %s referenced in dld_list.", name); - - status = target_read_memory (addr + 36, buf, 4); - if (status != 0) - goto err; - - addr = (CORE_ADDR) extract_unsigned_integer (buf, 4); - continue; - } - - /* If we've already loaded this one or it's the main program, skip it. */ - if (so_list || !strcmp (name, symfile_objfile->name)) - { - status = target_read_memory (addr + 36, buf, 4); - if (status != 0) - goto err; - - addr = (CORE_ADDR) extract_unsigned_integer (buf, 4); - continue; - } - - name = obsavestring (name, name_len - 1, - &symfile_objfile->symbol_obstack); - - status = target_read_memory (addr + 8, buf, 4); - if (status != 0) - goto err; - - text_addr = extract_unsigned_integer (buf, 4); - - - new_so = (struct so_list *) xmalloc (sizeof (struct so_list)); - memset ((char *)new_so, 0, sizeof (struct so_list)); - if (so_list_head == NULL) - { - so_list_head = new_so; - so_list_tail = new_so; - } - else - { - so_list_tail->next = new_so; - so_list_tail = new_so; - } - - /* Fill in all the entries in GDB's shared library list. */ - new_so->som_solib.name = name; - status = target_read_memory (addr + 4, buf, 4); - if (status != 0) - goto err; - - new_so->som_solib.struct_version = extract_unsigned_integer (buf + 3, 1); - new_so->som_solib.bind_mode = extract_unsigned_integer (buf + 2, 1); - new_so->som_solib.library_version = extract_unsigned_integer (buf, 2); - new_so->som_solib.text_addr = text_addr; - - status = target_read_memory (addr + 12, buf, 4); - if (status != 0) - goto err; - - new_so->som_solib.text_link_addr = extract_unsigned_integer (buf, 4); - - status = target_read_memory (addr + 16, buf, 4); - if (status != 0) - goto err; - - new_so->som_solib.text_end = extract_unsigned_integer (buf, 4); - - status = target_read_memory (addr + 20, buf, 4); - if (status != 0) - goto err; - - new_so->som_solib.data_start = extract_unsigned_integer (buf, 4); - - status = target_read_memory (addr + 24, buf, 4); - if (status != 0) - goto err; - - new_so->som_solib.bss_start = extract_unsigned_integer (buf, 4); - - status = target_read_memory (addr + 28, buf, 4); - if (status != 0) - goto err; - - new_so->som_solib.data_end = extract_unsigned_integer (buf, 4); - - status = target_read_memory (addr + 32, buf, 4); - if (status != 0) - goto err; - - new_so->som_solib.got_value = extract_unsigned_integer (buf, 4); - - status = target_read_memory (addr + 36, buf, 4); - if (status != 0) - goto err; - - new_so->som_solib.next = (void *)extract_unsigned_integer (buf, 4); - addr = (CORE_ADDR)new_so->som_solib.next; - - new_so->objfile = symbol_file_add (name, from_tty, text_addr, 0, 0, 0); - new_so->abfd = new_so->objfile->obfd; - - if (!bfd_check_format (new_so->abfd, bfd_object)) - { - error ("\"%s\": not in executable format: %s.", - name, bfd_errmsg (bfd_get_error ())); - } - - /* Now we need to build a section table for this library since - we might be debugging a core file from a dynamically linked - executable in which the libraries were not privately mapped. */ - if (build_section_table (new_so->abfd, - &new_so->sections, - &new_so->sections_end)) - { - error ("Unable to build section table for shared library\n."); - return; - } - - /* Relocate all the sections based on where they got loaded. */ - for (p = new_so->sections; p < new_so->sections_end; p++) - { - if (p->the_bfd_section->flags & SEC_CODE) - { - p->addr += text_addr - new_so->som_solib.text_link_addr; - p->endaddr += text_addr - new_so->som_solib.text_link_addr; - } - else if (p->the_bfd_section->flags & SEC_DATA) - { - p->addr += new_so->som_solib.data_start; - p->endaddr += new_so->som_solib.data_start; - } - } - - /* Now see if we need to map in the text and data for this shared - library (for example debugging a core file which does not use - private shared libraries.). - - Carefully peek at the first text address in the library. If the - read succeeds, then the libraries were privately mapped and were - included in the core dump file. - - If the peek failed, then the libraries were not privately mapped - and are not in the core file, we'll have to read them in ourselves. */ - status = target_read_memory (text_addr, buf, 4); - if (status != 0) - { - int old, new; - int update_coreops; - - /* We must update the to_sections field in the core_ops structure - here, otherwise we dereference a potential dangling pointer - for each call to target_read/write_memory within this routine. */ - update_coreops = core_ops.to_sections == target->to_sections; - - new = new_so->sections_end - new_so->sections; - /* Add sections from the shared library to the core target. */ - if (target->to_sections) - { - old = target->to_sections_end - target->to_sections; - target->to_sections = (struct section_table *) - xrealloc ((char *)target->to_sections, - ((sizeof (struct section_table)) * (old + new))); - } - else - { - old = 0; - target->to_sections = (struct section_table *) - xmalloc ((sizeof (struct section_table)) * new); - } - target->to_sections_end = (target->to_sections + old + new); - - /* Update the to_sections field in the core_ops structure - if needed. */ - if (update_coreops) - { - core_ops.to_sections = target->to_sections; - core_ops.to_sections_end = target->to_sections_end; - } - - /* Copy over the old data before it gets clobbered. */ - memcpy ((char *)(target->to_sections + old), - new_so->sections, - ((sizeof (struct section_table)) * new)); - } - } - - /* Getting new symbols may change our opinion about what is - frameless. */ - reinit_frame_cache (); - return; - -old_dld: - error ("Debugging dynamic executables loaded via the hpux8 dld.sl is not supported.\n"); - return; - -err: - error ("Error while reading dynamic library list.\n"); - return; -} - - -/* This hook gets called just before the first instruction in the - inferior process is executed. - - This is our opportunity to set magic flags in the inferior so - that GDB can be notified when a shared library is mapped in and - to tell the dynamic linker that a private copy of the library is - needed (so GDB can set breakpoints in the library). - - __dld_flags is the location of the magic flags; as of this implementation - there are 3 flags of interest: - - bit 0 when set indicates that private copies of the libraries are needed - bit 1 when set indicates that the callback hook routine is valid - bit 2 when set indicates that the dynamic linker should maintain the - __dld_list structure when loading/unloading libraries. - - Note that shared libraries are not mapped in at this time, so we have - run the inferior until the libraries are mapped in. Typically this - means running until the "_start" is called. */ - -void -som_solib_create_inferior_hook() -{ - struct minimal_symbol *msymbol; - unsigned int dld_flags, status, have_endo; - asection *shlib_info; - char shadow_contents[BREAKPOINT_MAX], buf[4]; - struct objfile *objfile; - CORE_ADDR anaddr; - - /* First, remove all the solib event breakpoints. Their addresses - may have changed since the last time we ran the program. */ - remove_solib_event_breakpoints (); - - if (symfile_objfile == NULL) - return; - - /* First see if the objfile was dynamically linked. */ - shlib_info = bfd_get_section_by_name (symfile_objfile->obfd, "$SHLIB_INFO$"); - if (!shlib_info) - return; - - /* It's got a $SHLIB_INFO$ section, make sure it's not empty. */ - if (bfd_section_size (symfile_objfile->obfd, shlib_info) == 0) - return; - - have_endo = 0; - /* Slam the pid of the process into __d_pid; failing is only a warning! */ - msymbol = lookup_minimal_symbol ("__d_pid", NULL, symfile_objfile); - if (msymbol == NULL) - { - warning ("Unable to find __d_pid symbol in object file."); - warning ("Suggest linking with /usr/lib/end.o."); - warning ("GDB will be unable to track shl_load/shl_unload calls"); - goto keep_going; - } - - anaddr = SYMBOL_VALUE_ADDRESS (msymbol); - store_unsigned_integer (buf, 4, inferior_pid); - status = target_write_memory (anaddr, buf, 4); - if (status != 0) - { - warning ("Unable to write __d_pid"); - warning ("Suggest linking with /usr/lib/end.o."); - warning ("GDB will be unable to track shl_load/shl_unload calls"); - goto keep_going; - } - - /* Get the value of _DLD_HOOK (an export stub) and put it in __dld_hook; - This will force the dynamic linker to call __d_trap when significant - events occur. */ - msymbol = lookup_minimal_symbol ("_DLD_HOOK", NULL, symfile_objfile); - if (msymbol == NULL) - { - warning ("Unable to find _DLD_HOOK symbol in object file."); - warning ("Suggest linking with /usr/lib/end.o."); - warning ("GDB will be unable to track shl_load/shl_unload calls"); - goto keep_going; - } - anaddr = SYMBOL_VALUE_ADDRESS (msymbol); - - /* Grrr, this might not be an export symbol! We have to find the - export stub. */ - ALL_OBJFILES (objfile) - { - struct unwind_table_entry *u; - extern struct unwind_table_entry *find_unwind_entry PARAMS ((CORE_ADDR pc)); - - /* What a crock. */ - msymbol = lookup_minimal_symbol_solib_trampoline (SYMBOL_NAME (msymbol), - NULL, objfile); - /* Found a symbol with the right name. */ - if (msymbol) - { - struct unwind_table_entry *u; - /* It must be a shared library trampoline. */ - if (SYMBOL_TYPE (msymbol) != mst_solib_trampoline) - continue; - - /* It must also be an export stub. */ - u = find_unwind_entry (SYMBOL_VALUE (msymbol)); - if (!u || u->stub_type != EXPORT) - continue; - - /* OK. Looks like the correct import stub. */ - anaddr = SYMBOL_VALUE (msymbol); - break; - } - } - store_unsigned_integer (buf, 4, anaddr); - - msymbol = lookup_minimal_symbol ("__dld_hook", NULL, symfile_objfile); - if (msymbol == NULL) - { - warning ("Unable to find __dld_hook symbol in object file."); - warning ("Suggest linking with /usr/lib/end.o."); - warning ("GDB will be unable to track shl_load/shl_unload calls"); - goto keep_going; - } - anaddr = SYMBOL_VALUE_ADDRESS (msymbol); - status = target_write_memory (anaddr, buf, 4); - - /* Now set a shlib_event breakpoint at __d_trap so we can track - significant shared library events. */ - msymbol = lookup_minimal_symbol ("__d_trap", NULL, symfile_objfile); - if (msymbol == NULL) - { - warning ("Unable to find __dld_d_trap symbol in object file."); - warning ("Suggest linking with /usr/lib/end.o."); - warning ("GDB will be unable to track shl_load/shl_unload calls"); - goto keep_going; - } - create_solib_event_breakpoint (SYMBOL_VALUE_ADDRESS (msymbol)); - - /* We have all the support usually found in end.o, so we can track - shl_load and shl_unload calls. */ - have_endo = 1; - -keep_going: - - /* Get the address of __dld_flags, if no such symbol exists, then we can - not debug the shared code. */ - msymbol = lookup_minimal_symbol ("__dld_flags", NULL, NULL); - if (msymbol == NULL) - { - error ("Unable to find __dld_flags symbol in object file.\n"); - goto keep_going; - return; - } - - anaddr = SYMBOL_VALUE_ADDRESS (msymbol); - /* Read the current contents. */ - status = target_read_memory (anaddr, buf, 4); - if (status != 0) - { - error ("Unable to read __dld_flags\n"); - return; - } - dld_flags = extract_unsigned_integer (buf, 4); - - /* Turn on the flags we care about. */ - dld_flags |= (0x5 | (have_endo << 1)); - store_unsigned_integer (buf, 4, dld_flags); - status = target_write_memory (anaddr, buf, 4); - if (status != 0) - { - error ("Unable to write __dld_flags\n"); - return; - } - - /* Now find the address of _start and set a breakpoint there. - We still need this code for two reasons: - - * Not all sites have /usr/lib/end.o, so it's not always - possible to track the dynamic linker's events. - - * At this time no events are triggered for shared libraries - loaded at startup time (what a crock). */ - - msymbol = lookup_minimal_symbol ("_start", NULL, symfile_objfile); - if (msymbol == NULL) - { - error ("Unable to find _start symbol in object file.\n"); - return; - } - - anaddr = SYMBOL_VALUE_ADDRESS (msymbol); - - /* Make the breakpoint at "_start" a shared library event breakpoint. */ - create_solib_event_breakpoint (anaddr); - - /* Wipe out all knowledge of old shared libraries since their - mapping can change from one exec to another! */ - while (so_list_head) - { - struct so_list *temp; - - free_objfile (so_list_head->objfile); - temp = so_list_head; - free (so_list_head); - so_list_head = temp->next; - } - clear_symtab_users (); -} - -/* Return the GOT value for the shared library in which ADDR belongs. If - ADDR isn't in any known shared library, return zero. */ - -CORE_ADDR -som_solib_get_got_by_pc (addr) - CORE_ADDR addr; -{ - struct so_list *so_list = so_list_head; - CORE_ADDR got_value = 0; - - while (so_list) - { - if (so_list->som_solib.text_addr <= addr - && so_list->som_solib.text_end > addr) - { - got_value = so_list->som_solib.got_value; - break; - } - so_list = so_list->next; - } - return got_value; -} - -int -som_solib_section_offsets (objfile, offsets) - struct objfile *objfile; - struct section_offsets *offsets; -{ - struct so_list *so_list = so_list_head; - - while (so_list) - { - /* Oh what a pain! We need the offsets before so_list->objfile - is valid. The BFDs will never match. Make a best guess. */ - if (strstr (objfile->name, so_list->som_solib.name)) - { - asection *private_section; - - /* The text offset is easy. */ - ANOFFSET (offsets, SECT_OFF_TEXT) - = (so_list->som_solib.text_addr - - so_list->som_solib.text_link_addr); - ANOFFSET (offsets, SECT_OFF_RODATA) - = ANOFFSET (offsets, SECT_OFF_TEXT); - - /* We should look at presumed_dp in the SOM header, but - that's not easily available. This should be OK though. */ - private_section = bfd_get_section_by_name (objfile->obfd, - "$PRIVATE$"); - if (!private_section) - { - warning ("Unable to find $PRIVATE$ in shared library!"); - ANOFFSET (offsets, SECT_OFF_DATA) = 0; - ANOFFSET (offsets, SECT_OFF_BSS) = 0; - return 1; - } - ANOFFSET (offsets, SECT_OFF_DATA) - = (so_list->som_solib.data_start - private_section->vma); - ANOFFSET (offsets, SECT_OFF_BSS) - = ANOFFSET (offsets, SECT_OFF_DATA); - return 1; - } - so_list = so_list->next; - } - return 0; -} - -/* Dump information about all the currently loaded shared libraries. */ - -static void -som_sharedlibrary_info_command (ignore, from_tty) - char *ignore; - int from_tty; -{ - struct so_list *so_list = so_list_head; - - if (exec_bfd == NULL) - { - printf_unfiltered ("no exec file.\n"); - return; - } - - if (so_list == NULL) - { - printf_unfiltered ("No shared libraries loaded at this time.\n"); - return; - } - - printf_unfiltered ("Shared Object Libraries\n"); - printf_unfiltered (" %-12s%-12s%-12s%-12s%-12s%-12s\n", - " flags", " tstart", " tend", " dstart", " dend", " dlt"); - while (so_list) - { - unsigned int flags; - - flags = so_list->som_solib.struct_version << 24; - flags |= so_list->som_solib.bind_mode << 16; - flags |= so_list->som_solib.library_version; - printf_unfiltered ("%s\n", so_list->som_solib.name); - printf_unfiltered (" %-12s", local_hex_string_custom (flags, "08l")); - printf_unfiltered ("%-12s", - local_hex_string_custom (so_list->som_solib.text_addr, "08l")); - printf_unfiltered ("%-12s", - local_hex_string_custom (so_list->som_solib.text_end, "08l")); - printf_unfiltered ("%-12s", - local_hex_string_custom (so_list->som_solib.data_start, "08l")); - printf_unfiltered ("%-12s", - local_hex_string_custom (so_list->som_solib.data_end, "08l")); - printf_unfiltered ("%-12s\n", - local_hex_string_custom (so_list->som_solib.got_value, "08l")); - so_list = so_list->next; - } -} - -static void -som_solib_sharedlibrary_command (args, from_tty) - char *args; - int from_tty; -{ - dont_repeat (); - som_solib_add (args, from_tty, (struct target_ops *) 0); -} - -void -_initialize_som_solib () -{ - add_com ("sharedlibrary", class_files, som_solib_sharedlibrary_command, - "Load shared object library symbols for files matching REGEXP."); - add_info ("sharedlibrary", som_sharedlibrary_info_command, - "Status of loaded shared object libraries."); - add_show_from_set - (add_set_cmd ("auto-solib-add", class_support, var_zinteger, - (char *) &auto_solib_add, - "Set autoloading of shared library symbols at startup.\n\ -If nonzero, symbols from all shared object libraries will be loaded\n\ -automatically when the inferior begins execution or when the dynamic linker\n\ -informs gdb that a new library has been loaded. Otherwise, symbols\n\ -must be loaded manually, using `sharedlibrary'.", - &setlist), - &showlist); - -} diff --git a/contrib/gdb/gdb/somsolib.h b/contrib/gdb/gdb/somsolib.h deleted file mode 100644 index 6fe0200..0000000 --- a/contrib/gdb/gdb/somsolib.h +++ /dev/null @@ -1,51 +0,0 @@ -/* HP SOM Shared library declarations for GDB, the GNU Debugger. - Copyright (C) 1992 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -Written by the Center for Software Science at the Univerity of Utah -and by Cygnus Support. */ - -#ifdef __STDC__ /* Forward decl's for prototypes */ -struct target_ops; -struct objfile; -struct section_offsets; -#endif - -/* Called to add symbols from a shared library to gdb's symbol table. */ - -#define SOLIB_ADD(filename, from_tty, targ) \ - som_solib_add (filename, from_tty, targ) - -extern void -som_solib_add PARAMS ((char *, int, struct target_ops *)); - -extern CORE_ADDR -som_solib_get_got_by_pc PARAMS ((CORE_ADDR)); - -extern int -som_solib_section_offsets PARAMS ((struct objfile *, struct section_offsets *)); - -/* Function to be called when the inferior starts up, to discover the names - of shared libraries that are dynamically linked, the base addresses to - which they are linked, and sufficient information to read in their symbols - at a later time. */ - -#define SOLIB_CREATE_INFERIOR_HOOK(PID) som_solib_create_inferior_hook() - -extern void -som_solib_create_inferior_hook PARAMS((void)); diff --git a/contrib/gdb/gdb/srec.h b/contrib/gdb/gdb/srec.h deleted file mode 100644 index 1446bda..0000000 --- a/contrib/gdb/gdb/srec.h +++ /dev/null @@ -1,35 +0,0 @@ -/* S-record download support for GDB, the GNU debugger. - Copyright 1995 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -void load_srec PARAMS ((serial_t desc, const char *file, int maxrecsize, - int flags, int hashmark)); - -/* S-record capability flags */ - -/* Which record types are supported */ -#define SREC_2_BYTE_ADDR 0x00000001 -#define SREC_3_BYTE_ADDR 0x00000002 -#define SREC_4_BYTE_ADDR 0x00000004 -#define SREC_TERM_SHIFT 3 - -#define SREC_ALL (SREC_2_BYTE_ADDR | SREC_3_BYTE_ADDR | SREC_4_BYTE_ADDR \ - | ((SREC_2_BYTE_ADDR | SREC_3_BYTE_ADDR | SREC_4_BYTE_ADDR) \ - << SREC_TERM_SHIFT)) - -#define SREC_BINARY 0x00000040 /* Supports binary form of S-records */ diff --git a/contrib/gdb/gdb/standalone.c b/contrib/gdb/gdb/standalone.c deleted file mode 100644 index 13fc476..0000000 --- a/contrib/gdb/gdb/standalone.c +++ /dev/null @@ -1,593 +0,0 @@ -/* Interface to bare machine for GDB running as kernel debugger. - Copyright (C) 1986, 1989, 1991 Free Software Foundation, Inc. - -This file is part of GDB. - -This 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 -#include -#include -#include -#include "gdb_stat.h" - -#if defined (SIGTSTP) && defined (SIGIO) -#include -#include -#endif /* SIGTSTP and SIGIO defined (must be 4.2) */ - -#include "defs.h" -#include "signals.h" -#include "symtab.h" -#include "frame.h" -#include "inferior.h" -#include "wait.h" - - -/* Random system calls, mostly no-ops to prevent link problems */ - -ioctl (desc, code, arg) -{} - -int (* signal ()) () -{} - -kill () -{} - -getpid () -{ - return 0; -} - -sigsetmask () -{} - -chdir () -{} - -char * -getcwd (buf, len) - char *buf; - unsigned int len; -{ - buf[0] = '/'; - buf[1] = 0; - return buf; -} - -/* Used to check for existence of .gdbinit. Say no. */ - -access () -{ - return -1; -} - -exit () -{ - error ("Fatal error; restarting."); -} - -/* Reading "files". The contents of some files are written into kdb's - data area before it is run. These files are used to contain the - symbol table for kdb to load, and the source files (in case the - kdb user wants to print them). The symbols are stored in a file - named "kdb-symbols" in a.out format (except that all the text and - data have been stripped to save room). - - The files are stored in the following format: - int number of bytes of data for this file, including these four. - char[] name of the file, ending with a null. - padding to multiple of 4 boundary. - char[] file contents. The length can be deduced from what was - specified before. There is no terminating null here. - - If the int at the front is zero, it means there are no more files. - - Opening a file in kdb returns a nonzero value to indicate success, - but the value does not matter. Only one file can be open, and only - for reading. All the primitives for input from the file know - which file is open and ignore what is specified for the descriptor - or for the stdio stream. - - Input with fgetc can be done either on the file that is open - or on stdin (which reads from the terminal through tty_input () */ - -/* Address of data for the files stored in format described above. */ -char *files_start; - -/* The file stream currently open: */ - -char *sourcebeg; /* beginning of contents */ -int sourcesize; /* size of contents */ -char *sourceptr; /* current read pointer */ -int sourceleft; /* number of bytes to eof */ - -/* "descriptor" for the file now open. - Incremented at each close. - If specified descriptor does not match this, - it means the program is trying to use a closed descriptor. - We report an error for that. */ - -int sourcedesc; - -open (filename, modes) - char *filename; - int modes; -{ - register char *next; - - if (modes) - { - errno = EROFS; - return -1; - } - - if (sourceptr) - { - errno = EMFILE; - return -1; - } - - for (next = files_start; * (int *) next; next += * (int *) next) - { - if (!STRCMP (next + 4, filename)) - { - sourcebeg = next + 4 + strlen (next + 4) + 1; - sourcebeg = (char *) (((int) sourcebeg + 3) & (-4)); - sourceptr = sourcebeg; - sourcesize = next + * (int *) next - sourceptr; - sourceleft = sourcesize; - return sourcedesc; - } - } - return 0; -} - -close (desc) - int desc; -{ - sourceptr = 0; - sourcedesc++; - /* Don't let sourcedesc get big enough to be confused with stdin. */ - if (sourcedesc == 100) - sourcedesc = 5; -} - -FILE * -fopen (filename, modes) - char *filename; - char *modes; -{ - return (FILE *) open (filename, *modes == 'w'); -} - -FILE * -fdopen (desc) - int desc; -{ - return (FILE *) desc; -} - -fclose (desc) - int desc; -{ - close (desc); -} - -fstat (desc, statbuf) - struct stat *statbuf; -{ - if (desc != sourcedesc) - { - errno = EBADF; - return -1; - } - statbuf->st_size = sourcesize; -} - -myread (desc, destptr, size, filename) - int desc; - char *destptr; - int size; - char *filename; -{ - int len = min (sourceleft, size); - - if (desc != sourcedesc) - { - errno = EBADF; - return -1; - } - - memcpy (destptr, sourceptr, len); - sourceleft -= len; - return len; -} - -int -fread (bufp, numelts, eltsize, stream) -{ - register int elts = min (numelts, sourceleft / eltsize); - register int len = elts * eltsize; - - if (stream != sourcedesc) - { - errno = EBADF; - return -1; - } - - memcpy (bufp, sourceptr, len); - sourceleft -= len; - return elts; -} - -int -fgetc (desc) - int desc; -{ - - if (desc == (int) stdin) - return tty_input (); - - if (desc != sourcedesc) - { - errno = EBADF; - return -1; - } - - if (sourceleft-- <= 0) - return EOF; - return *sourceptr++; -} - -lseek (desc, pos) - int desc; - int pos; -{ - - if (desc != sourcedesc) - { - errno = EBADF; - return -1; - } - - if (pos < 0 || pos > sourcesize) - { - errno = EINVAL; - return -1; - } - - sourceptr = sourcebeg + pos; - sourceleft = sourcesize - pos; -} - -/* Output in kdb can go only to the terminal, so the stream - specified may be ignored. */ - -printf (a1, a2, a3, a4, a5, a6, a7, a8, a9) -{ - char buffer[1024]; - sprintf (buffer, a1, a2, a3, a4, a5, a6, a7, a8, a9); - display_string (buffer); -} - -fprintf (ign, a1, a2, a3, a4, a5, a6, a7, a8, a9) -{ - char buffer[1024]; - sprintf (buffer, a1, a2, a3, a4, a5, a6, a7, a8, a9); - display_string (buffer); -} - -fwrite (buf, numelts, size, stream) - register char *buf; - int numelts, size; -{ - register int i = numelts * size; - while (i-- > 0) - fputc (*buf++, stream); -} - -fputc (c, ign) -{ - char buf[2]; - buf[0] = c; - buf[1] = 0; - display_string (buf); -} - -/* sprintf refers to this, but loading this from the - library would cause fflush to be loaded from it too. - In fact there should be no need to call this (I hope). */ - -_flsbuf () -{ - error ("_flsbuf was actually called."); -} - -fflush (ign) -{ -} - -/* Entries into core and inflow, needed only to make things link ok. */ - -exec_file_command () -{} - -core_file_command () -{} - -char * -get_exec_file (err) - int err; -{ - /* Makes one printout look reasonable; value does not matter otherwise. */ - return "run"; -} - -/* Nonzero if there is a core file. */ - -have_core_file_p () -{ - return 0; -} - -kill_command () -{ - inferior_pid = 0; -} - -terminal_inferior () -{} - -terminal_ours () -{} - -terminal_init_inferior () -{} - -write_inferior_register () -{} - -read_inferior_register () -{} - -read_memory (memaddr, myaddr, len) - CORE_ADDR memaddr; - char *myaddr; - int len; -{ - memcpy (myaddr, memaddr, len); -} - -/* Always return 0 indicating success. */ - -write_memory (memaddr, myaddr, len) - CORE_ADDR memaddr; - char *myaddr; - int len; -{ - memcpy (memaddr, myaddr, len); - return 0; -} - -static REGISTER_TYPE saved_regs[NUM_REGS]; - -REGISTER_TYPE -read_register (regno) - int regno; -{ - if (regno < 0 || regno >= NUM_REGS) - error ("Register number %d out of range.", regno); - return saved_regs[regno]; -} - -void -write_register (regno, value) - int regno; - REGISTER_TYPE value; -{ - if (regno < 0 || regno >= NUM_REGS) - error ("Register number %d out of range.", regno); - saved_regs[regno] = value; -} - -/* System calls needed in relation to running the "inferior". */ - -vfork () -{ - /* Just appear to "succeed". Say the inferior's pid is 1. */ - return 1; -} - -/* These are called by code that normally runs in the inferior - that has just been forked. That code never runs, when standalone, - and these definitions are so it will link without errors. */ - -ptrace () -{} - -setpgrp () -{} - -execle () -{} - -_exit () -{} - -/* Malloc calls these. */ - -malloc_warning (str) - char *str; -{ - printf ("\n%s.\n\n", str); -} - -char *next_free; -char *memory_limit; - -char * -sbrk (amount) - int amount; -{ - if (next_free + amount > memory_limit) - return (char *) -1; - next_free += amount; - return next_free - amount; -} - -/* Various ways malloc might ask where end of memory is. */ - -char * -ulimit () -{ - return memory_limit; -} - -int -vlimit () -{ - return memory_limit - next_free; -} - -getrlimit (addr) - struct rlimit *addr; -{ - addr->rlim_cur = memory_limit - next_free; -} - -/* Context switching to and from program being debugged. */ - -/* GDB calls here to run the user program. - The frame pointer for this function is saved in - gdb_stack by save_frame_pointer; then we restore - all of the user program's registers, including PC and PS. */ - -static int fault_code; -static REGISTER_TYPE gdb_stack; - -resume () -{ - REGISTER_TYPE restore[NUM_REGS]; - - PUSH_FRAME_PTR; - save_frame_pointer (); - - memcpy (restore, saved_regs, sizeof restore); - POP_REGISTERS; - /* Control does not drop through here! */ -} - -save_frame_pointer (val) - CORE_ADDR val; -{ - gdb_stack = val; -} - -/* Fault handlers call here, running in the user program stack. - They must first push a fault code, - old PC, old PS, and any other info about the fault. - The exact format is machine-dependent and is known only - in the definition of PUSH_REGISTERS. */ - -fault () -{ - /* Transfer all registers and fault code to the stack - in canonical order: registers in order of GDB register number, - followed by fault code. */ - PUSH_REGISTERS; - - /* Transfer them to saved_regs and fault_code. */ - save_registers (); - - restore_gdb (); - /* Control does not reach here */ -} - -restore_gdb () -{ - CORE_ADDR new_fp = gdb_stack; - /* Switch to GDB's stack */ - POP_FRAME_PTR; - /* Return from the function `resume'. */ -} - -/* Assuming register contents and fault code have been pushed on the stack as - arguments to this function, copy them into the standard place - for the program's registers while GDB is running. */ - -save_registers (firstreg) - int firstreg; -{ - memcpy (saved_regs, &firstreg, sizeof saved_regs); - fault_code = (&firstreg)[NUM_REGS]; -} - -/* Store into the structure such as `wait' would return - the information on why the program faulted, - converted into a machine-independent signal number. */ - -static int fault_table[] = FAULT_TABLE; - -int -wait (w) - WAITTYPE *w; -{ - WSETSTOP (*w, fault_table[fault_code / FAULT_CODE_UNITS]); - return inferior_pid; -} - -/* Allocate a big space in which files for kdb to read will be stored. - Whatever is left is where malloc can allocate storage. - - Initialize it, so that there will be space in the executable file - for it. Then the files can be put into kdb by writing them into - kdb's executable file. */ - -/* The default size is as much space as we expect to be available - for kdb to use! */ - -#ifndef HEAP_SIZE -#define HEAP_SIZE 400000 -#endif - -char heap[HEAP_SIZE] = {0}; - -#ifndef STACK_SIZE -#define STACK_SIZE 100000 -#endif - -int kdb_stack_beg[STACK_SIZE / sizeof (int)]; -int kdb_stack_end; - -_initialize_standalone () -{ - register char *next; - - /* Find start of data on files. */ - - files_start = heap; - - /* Find the end of the data on files. */ - - for (next = files_start; * (int *) next; next += * (int *) next) {} - - /* That is where free storage starts for sbrk to give out. */ - next_free = next; - - memory_limit = heap + sizeof heap; -} - diff --git a/contrib/gdb/gdb/stop-gdb.c b/contrib/gdb/gdb/stop-gdb.c deleted file mode 100644 index 8f22bf9..0000000 --- a/contrib/gdb/gdb/stop-gdb.c +++ /dev/null @@ -1,110 +0,0 @@ -/* A client to make GDB return to command level in Mach 3. - Copyright (C) 1992, 1993 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* Authors: Jukka Virtanen and Peter Stout . - - A simple client to make GDB (versions 4.4 and later) on Mach 3 return - to the command level when it is waiting for the inferior to stop. - - Actions: Lookup the send right to the GDB message port from the - NetMsgServer. - - Send an asynchronous message with msgh_id - GDB_MESSAGE_ID_STOP to that port. - */ - -#include - -#include "defs.h" - -#include -#include -#include -#include -#include - -void -main (argc, argv) - int argc; - char **argv; -{ - kern_return_t kr; - mach_msg_header_t msg; - mach_port_t gdb_port; - char *host; - char *name; - - if (argc == 1) - argv[argc++] = GDB_DEF_NAME; - - if (argc != 2) - { - fprintf (stderr, "Usage : %s \n", argv[0]); - exit (1); - } - - /* Allow the user to specify a remote host. */ - host = strchr (argv[1], '@'); - if (host) - *(host++) = '\0'; - else - host = (char *) ""; - - name = malloc (strlen (argv[1]) + sizeof(GDB_NAME_PREFIX)); - if (name == NULL) - { - fprintf (stderr, "Unable to allocate memory for name."); - exit (1); - } - - strcpy (name, GDB_NAME_PREFIX); - strcat (name, argv[1]); - - /* Look up the GDB service port. For convenience, add the - GDB_NAME_PREFIX the argument before looking up the name. - For backwards compatibility, do it without. */ - - kr = netname_look_up (name_server_port, host, name, &gdb_port); - if (kr == NETNAME_NOT_CHECKED_IN) - kr = netname_look_up (name_server_port, host, argv[1], &gdb_port); - if (kr != KERN_SUCCESS) - { - fprintf (stderr, "Unable to lookup the GDB service port: %s.\n", - mach_error_string(kr)); - exit(1); - } - - /* Code generated by mig stub generator, with minor cleanups :-) - - simpleroutine stop_inferior(gdb_port : mach_port_t); */ - - msg.msgh_bits = MACH_MSGH_BITS (MACH_MSG_TYPE_COPY_SEND, 0); - msg.msgh_remote_port = gdb_port; - msg.msgh_local_port = MACH_PORT_NULL; - msg.msgh_size = sizeof(msg); - msg.msgh_seqno = 0; - msg.msgh_id = GDB_MESSAGE_ID_STOP; - - kr = mach_msg_send (&msg); - if (kr != KERN_SUCCESS) - fprintf (stderr, "Message not sent, return code %d : %s\n", kr, - mach_error_string (kr)); - - exit (kr != KERN_SUCCESS); -} diff --git a/contrib/gdb/gdb/stuff.c b/contrib/gdb/gdb/stuff.c deleted file mode 100644 index eedbeab..0000000 --- a/contrib/gdb/gdb/stuff.c +++ /dev/null @@ -1,174 +0,0 @@ -/* Program to stuff files into a specially prepared space in kdb. - Copyright (C) 1986, 1989, 1991 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* Written 13-Mar-86 by David Bridgham. */ - -#include -#include -#include -#include "gdb_stat.h" -#include -#include - -main (argc, argv) - int argc; - char *argv[]; -{ - register char *cp; - char *outfile; - register int i; - int offset; - int out_fd, in_fd; - struct stat stat_buf; - int size, pad; - char buf[1024]; - static char zeros[4] = {0}; - - if (argc < 4) - err("Not enough arguments\nUsage: %s -o kdb file1 file2 ...\n", - argv[0]); - - outfile = 0; - for (i = 1; i < argc; i++) - { - if (STREQ (argv[i], "-o")) - outfile = argv[++i]; - } - if (outfile == 0) - err("Output file not specified\n"); - - offset = get_offset (outfile, "_heap"); - - out_fd = open (outfile, O_WRONLY); - if (out_fd < 0) - err ("Error opening %s for write: %s\n", outfile, strerror (errno)); - if (lseek (out_fd, offset, 0) < 0) - err ("Error seeking to heap in %s: %s\n", outfile, strerror (errno)); - - /* For each file listed on the command line, write it into the - * 'heap' of the output file. Make sure to skip the arguments - * that name the output file. */ - for (i = 1; i < argc; i++) - { - if (STREQ (argv[i], "-o")) - continue; - if ((in_fd = open (argv[i], O_RDONLY)) < 0) - err ("Error opening %s for read: %s\n", argv[i], - strerror (errno)); - if (fstat (in_fd, &stat_buf) < 0) - err ("Error stat'ing %s: %s\n", argv[i], strerror (errno)); - size = strlen (argv[i]); - pad = 4 - (size & 3); - size += pad + stat_buf.st_size + sizeof (int); - write (out_fd, &size, sizeof (int)); - write (out_fd, argv[i], strlen (argv[i])); - write (out_fd, zeros, pad); - while ((size = read (in_fd, buf, sizeof (buf))) > 0) - write (out_fd, buf, size); - close (in_fd); - } - size = 0; - write (out_fd, &size, sizeof (int)); - close (out_fd); - return (0); -} - -/* Read symbol table from file and returns the offset into the file - * where symbol sym_name is located. If error, print message and - * exit. */ -get_offset (file, sym_name) - char *file; - char *sym_name; -{ - int f; - struct exec file_hdr; - struct nlist *symbol_table; - int size; - char *strings; - - f = open (file, O_RDONLY); - if (f < 0) - err ("Error opening %s: %s\n", file, strerror (errno)); - if (read (f, &file_hdr, sizeof (file_hdr)) < 0) - err ("Error reading exec structure: %s\n", strerror (errno)); - if (N_BADMAG (file_hdr)) - err ("File %s not an a.out file\n", file); - - /* read in symbol table */ - if ((symbol_table = (struct nlist *)malloc (file_hdr.a_syms)) == 0) - err ("Couldn't allocate space for symbol table\n"); - if (lseek (f, N_SYMOFF (file_hdr), 0) == -1) - err ("lseek error: %s\n", strerror (errno)); - if (read (f, symbol_table, file_hdr.a_syms) == -1) - err ("Error reading symbol table from %s: %s\n", file, - strerror (errno)); - - /* read in string table */ - if (read (f, &size, 4) == -1) - err ("reading string table size: %s\n", strerror (errno)); - if ((strings = (char *)malloc (size)) == 0) - err ("Couldn't allocate memory for string table\n"); - if (read (f, strings, size - 4) == -1) - err ("reading string table: %s\n", strerror (errno)); - - /* Find the core address at which the first byte of kdb text segment - should be loaded into core when kdb is run. */ - origin = find_symbol ("_etext", symbol_table, file_hdr.a_syms, strings) - - file_hdr.a_text; - /* Find the core address at which the heap will appear. */ - coreaddr = find_symbol (sym_name, symbol_table, file_hdr.a_syms, strings); - /* Return address in file of the heap data space. */ - return (N_TXTOFF (file_hdr) + core_addr - origin); -} - -find_symbol (sym_name, symbol_table, length, strings) - char *sym_name; - struct nlist *symbol_table; - int length; - char *strings; -{ - register struct nlist *sym; - - /* Find symbol in question */ - for (sym = symbol_table; - sym != (struct nlist *)((char *)symbol_table + length); - sym++) - { - if ((sym->n_type & N_TYPE) != N_DATA) continue; - if (sym->n_un.n_strx == 0) continue; - if (STREQ (sym_name, strings + sym->n_un.n_strx - 4)) - return sym->n_value; - } - err ("Data symbol %s not found in %s\n", sym_name, file); -} - -/* VARARGS */ -void -err (va_alist) - va_dcl -{ - va_list args; - char *string; - - va_start (args); - string = va_arg (args, char *); - vfprintf (gdb_stderr, string, args); - va_end (args); - exit (-1); -} diff --git a/contrib/gdb/gdb/symm-nat.c b/contrib/gdb/gdb/symm-nat.c deleted file mode 100644 index 0461066..0000000 --- a/contrib/gdb/gdb/symm-nat.c +++ /dev/null @@ -1,846 +0,0 @@ -/* Sequent Symmetry host interface, for GDB when running under Unix. - Copyright 1986, 1987, 1989, 1991, 1992, 1994 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. */ - -/* FIXME, some 387-specific items of use taken from i387-tdep.c -- ought to be - merged back in. */ - -#include "defs.h" -#include "frame.h" -#include "inferior.h" -#include "symtab.h" -#include "target.h" - -/* FIXME: What is the _INKERNEL define for? */ -#define _INKERNEL -#include -#undef _INKERNEL -#include -#include -#include -#include -#include -#include -#include "gdb_stat.h" -#ifdef _SEQUENT_ -#include -#else -/* Dynix has only machine/ptrace.h, which is already included by sys/user.h */ -/* Dynix has no mptrace call */ -#define mptrace ptrace -#endif -#include "gdbcore.h" -#include -#include -#define TERMINAL struct sgttyb - -#include "gdbcore.h" - -void -store_inferior_registers(regno) -int regno; -{ - struct pt_regset regs; - int i; - extern char registers[]; - - /* FIXME: Fetching the registers is a kludge to initialize all elements - in the fpu and fpa status. This works for normal debugging, but - might cause problems when calling functions in the inferior. - At least fpu_control and fpa_pcr (probably more) should be added - to the registers array to solve this properly. */ - mptrace (XPT_RREGS, inferior_pid, (PTRACE_ARG3_TYPE) ®s, 0); - - regs.pr_eax = *(int *)®isters[REGISTER_BYTE(0)]; - regs.pr_ebx = *(int *)®isters[REGISTER_BYTE(5)]; - regs.pr_ecx = *(int *)®isters[REGISTER_BYTE(2)]; - regs.pr_edx = *(int *)®isters[REGISTER_BYTE(1)]; - regs.pr_esi = *(int *)®isters[REGISTER_BYTE(6)]; - regs.pr_edi = *(int *)®isters[REGISTER_BYTE(7)]; - regs.pr_esp = *(int *)®isters[REGISTER_BYTE(14)]; - regs.pr_ebp = *(int *)®isters[REGISTER_BYTE(15)]; - regs.pr_eip = *(int *)®isters[REGISTER_BYTE(16)]; - regs.pr_flags = *(int *)®isters[REGISTER_BYTE(17)]; - for (i = 0; i < 31; i++) - { - regs.pr_fpa.fpa_regs[i] = - *(int *)®isters[REGISTER_BYTE(FP1_REGNUM+i)]; - } - memcpy (regs.pr_fpu.fpu_stack[0], ®isters[REGISTER_BYTE(ST0_REGNUM)], 10); - memcpy (regs.pr_fpu.fpu_stack[1], ®isters[REGISTER_BYTE(ST1_REGNUM)], 10); - memcpy (regs.pr_fpu.fpu_stack[2], ®isters[REGISTER_BYTE(ST2_REGNUM)], 10); - memcpy (regs.pr_fpu.fpu_stack[3], ®isters[REGISTER_BYTE(ST3_REGNUM)], 10); - memcpy (regs.pr_fpu.fpu_stack[4], ®isters[REGISTER_BYTE(ST4_REGNUM)], 10); - memcpy (regs.pr_fpu.fpu_stack[5], ®isters[REGISTER_BYTE(ST5_REGNUM)], 10); - memcpy (regs.pr_fpu.fpu_stack[6], ®isters[REGISTER_BYTE(ST6_REGNUM)], 10); - memcpy (regs.pr_fpu.fpu_stack[7], ®isters[REGISTER_BYTE(ST7_REGNUM)], 10); - mptrace (XPT_WREGS, inferior_pid, (PTRACE_ARG3_TYPE) ®s, 0); -} - -void -fetch_inferior_registers (regno) - int regno; -{ - int i; - struct pt_regset regs; - extern char registers[]; - - registers_fetched (); - - mptrace (XPT_RREGS, inferior_pid, (PTRACE_ARG3_TYPE) ®s, 0); - *(int *)®isters[REGISTER_BYTE(EAX_REGNUM)] = regs.pr_eax; - *(int *)®isters[REGISTER_BYTE(EBX_REGNUM)] = regs.pr_ebx; - *(int *)®isters[REGISTER_BYTE(ECX_REGNUM)] = regs.pr_ecx; - *(int *)®isters[REGISTER_BYTE(EDX_REGNUM)] = regs.pr_edx; - *(int *)®isters[REGISTER_BYTE(ESI_REGNUM)] = regs.pr_esi; - *(int *)®isters[REGISTER_BYTE(EDI_REGNUM)] = regs.pr_edi; - *(int *)®isters[REGISTER_BYTE(EBP_REGNUM)] = regs.pr_ebp; - *(int *)®isters[REGISTER_BYTE(ESP_REGNUM)] = regs.pr_esp; - *(int *)®isters[REGISTER_BYTE(EIP_REGNUM)] = regs.pr_eip; - *(int *)®isters[REGISTER_BYTE(EFLAGS_REGNUM)] = regs.pr_flags; - for (i = 0; i < FPA_NREGS; i++) - { - *(int *)®isters[REGISTER_BYTE(FP1_REGNUM+i)] = - regs.pr_fpa.fpa_regs[i]; - } - memcpy (®isters[REGISTER_BYTE(ST0_REGNUM)], regs.pr_fpu.fpu_stack[0], 10); - memcpy (®isters[REGISTER_BYTE(ST1_REGNUM)], regs.pr_fpu.fpu_stack[1], 10); - memcpy (®isters[REGISTER_BYTE(ST2_REGNUM)], regs.pr_fpu.fpu_stack[2], 10); - memcpy (®isters[REGISTER_BYTE(ST3_REGNUM)], regs.pr_fpu.fpu_stack[3], 10); - memcpy (®isters[REGISTER_BYTE(ST4_REGNUM)], regs.pr_fpu.fpu_stack[4], 10); - memcpy (®isters[REGISTER_BYTE(ST5_REGNUM)], regs.pr_fpu.fpu_stack[5], 10); - memcpy (®isters[REGISTER_BYTE(ST6_REGNUM)], regs.pr_fpu.fpu_stack[6], 10); - memcpy (®isters[REGISTER_BYTE(ST7_REGNUM)], regs.pr_fpu.fpu_stack[7], 10); -} - -/* FIXME: This should be merged with i387-tdep.c as well. */ -static -print_fpu_status(ep) -struct pt_regset ep; -{ - int i; - int bothstatus; - int top; - int fpreg; - unsigned char *p; - - printf_unfiltered("80387:"); - if (ep.pr_fpu.fpu_ip == 0) { - printf_unfiltered(" not in use.\n"); - return; - } else { - printf_unfiltered("\n"); - } - if (ep.pr_fpu.fpu_status != 0) { - print_387_status_word (ep.pr_fpu.fpu_status); - } - print_387_control_word (ep.pr_fpu.fpu_control); - printf_unfiltered ("last exception: "); - printf_unfiltered ("opcode 0x%x; ", ep.pr_fpu.fpu_rsvd4); - printf_unfiltered ("pc 0x%x:0x%x; ", ep.pr_fpu.fpu_cs, ep.pr_fpu.fpu_ip); - printf_unfiltered ("operand 0x%x:0x%x\n", ep.pr_fpu.fpu_data_offset, ep.pr_fpu.fpu_op_sel); - - top = (ep.pr_fpu.fpu_status >> 11) & 7; - - printf_unfiltered ("regno tag msb lsb value\n"); - for (fpreg = 7; fpreg >= 0; fpreg--) - { - double val; - - printf_unfiltered ("%s %d: ", fpreg == top ? "=>" : " ", fpreg); - - switch ((ep.pr_fpu.fpu_tag >> (fpreg * 2)) & 3) - { - case 0: printf_unfiltered ("valid "); break; - case 1: printf_unfiltered ("zero "); break; - case 2: printf_unfiltered ("trap "); break; - case 3: printf_unfiltered ("empty "); break; - } - for (i = 9; i >= 0; i--) - printf_unfiltered ("%02x", ep.pr_fpu.fpu_stack[fpreg][i]); - - i387_to_double ((char *)ep.pr_fpu.fpu_stack[fpreg], (char *)&val); - printf_unfiltered (" %g\n", val); - } - if (ep.pr_fpu.fpu_rsvd1) - warning ("rsvd1 is 0x%x\n", ep.pr_fpu.fpu_rsvd1); - if (ep.pr_fpu.fpu_rsvd2) - warning ("rsvd2 is 0x%x\n", ep.pr_fpu.fpu_rsvd2); - if (ep.pr_fpu.fpu_rsvd3) - warning ("rsvd3 is 0x%x\n", ep.pr_fpu.fpu_rsvd3); - if (ep.pr_fpu.fpu_rsvd5) - warning ("rsvd5 is 0x%x\n", ep.pr_fpu.fpu_rsvd5); -} - - -print_1167_control_word(pcr) -unsigned int pcr; - -{ - int pcr_tmp; - - pcr_tmp = pcr & FPA_PCR_MODE; - printf_unfiltered("\tMODE= %#x; RND= %#x ", pcr_tmp, pcr_tmp & 12); - switch (pcr_tmp & 12) { - case 0: - printf_unfiltered("RN (Nearest Value)"); - break; - case 1: - printf_unfiltered("RZ (Zero)"); - break; - case 2: - printf_unfiltered("RP (Positive Infinity)"); - break; - case 3: - printf_unfiltered("RM (Negative Infinity)"); - break; - } - printf_unfiltered("; IRND= %d ", pcr_tmp & 2); - if (0 == pcr_tmp & 2) { - printf_unfiltered("(same as RND)\n"); - } else { - printf_unfiltered("(toward zero)\n"); - } - pcr_tmp = pcr & FPA_PCR_EM; - printf_unfiltered("\tEM= %#x", pcr_tmp); - if (pcr_tmp & FPA_PCR_EM_DM) printf_unfiltered(" DM"); - if (pcr_tmp & FPA_PCR_EM_UOM) printf_unfiltered(" UOM"); - if (pcr_tmp & FPA_PCR_EM_PM) printf_unfiltered(" PM"); - if (pcr_tmp & FPA_PCR_EM_UM) printf_unfiltered(" UM"); - if (pcr_tmp & FPA_PCR_EM_OM) printf_unfiltered(" OM"); - if (pcr_tmp & FPA_PCR_EM_ZM) printf_unfiltered(" ZM"); - if (pcr_tmp & FPA_PCR_EM_IM) printf_unfiltered(" IM"); - printf_unfiltered("\n"); - pcr_tmp = FPA_PCR_CC; - printf_unfiltered("\tCC= %#x", pcr_tmp); - if (pcr_tmp & FPA_PCR_20MHZ) printf_unfiltered(" 20MHZ"); - if (pcr_tmp & FPA_PCR_CC_Z) printf_unfiltered(" Z"); - if (pcr_tmp & FPA_PCR_CC_C2) printf_unfiltered(" C2"); - - /* Dynix defines FPA_PCR_CC_C0 to 0x100 and ptx defines - FPA_PCR_CC_C1 to 0x100. Use whichever is defined and assume - the OS knows what it is doing. */ -#ifdef FPA_PCR_CC_C1 - if (pcr_tmp & FPA_PCR_CC_C1) printf_unfiltered(" C1"); -#else - if (pcr_tmp & FPA_PCR_CC_C0) printf_unfiltered(" C0"); -#endif - - switch (pcr_tmp) - { - case FPA_PCR_CC_Z: - printf_unfiltered(" (Equal)"); - break; -#ifdef FPA_PCR_CC_C1 - case FPA_PCR_CC_C1: -#else - case FPA_PCR_CC_C0: -#endif - printf_unfiltered(" (Less than)"); - break; - case 0: - printf_unfiltered(" (Greater than)"); - break; - case FPA_PCR_CC_Z | -#ifdef FPA_PCR_CC_C1 - FPA_PCR_CC_C1 -#else - FPA_PCR_CC_C0 -#endif - | FPA_PCR_CC_C2: - printf_unfiltered(" (Unordered)"); - break; - default: - printf_unfiltered(" (Undefined)"); - break; - } - printf_unfiltered("\n"); - pcr_tmp = pcr & FPA_PCR_AE; - printf_unfiltered("\tAE= %#x", pcr_tmp); - if (pcr_tmp & FPA_PCR_AE_DE) printf_unfiltered(" DE"); - if (pcr_tmp & FPA_PCR_AE_UOE) printf_unfiltered(" UOE"); - if (pcr_tmp & FPA_PCR_AE_PE) printf_unfiltered(" PE"); - if (pcr_tmp & FPA_PCR_AE_UE) printf_unfiltered(" UE"); - if (pcr_tmp & FPA_PCR_AE_OE) printf_unfiltered(" OE"); - if (pcr_tmp & FPA_PCR_AE_ZE) printf_unfiltered(" ZE"); - if (pcr_tmp & FPA_PCR_AE_EE) printf_unfiltered(" EE"); - if (pcr_tmp & FPA_PCR_AE_IE) printf_unfiltered(" IE"); - printf_unfiltered("\n"); -} - -print_1167_regs(regs) -long regs[FPA_NREGS]; - -{ - int i; - - union { - double d; - long l[2]; - } xd; - union { - float f; - long l; - } xf; - - - for (i = 0; i < FPA_NREGS; i++) { - xf.l = regs[i]; - printf_unfiltered("%%fp%d: raw= %#x, single= %f", i+1, regs[i], xf.f); - if (!(i & 1)) { - printf_unfiltered("\n"); - } else { - xd.l[1] = regs[i]; - xd.l[0] = regs[i+1]; - printf_unfiltered(", double= %f\n", xd.d); - } - } -} - -print_fpa_status(ep) -struct pt_regset ep; - -{ - - printf_unfiltered("WTL 1167:"); - if (ep.pr_fpa.fpa_pcr !=0) { - printf_unfiltered("\n"); - print_1167_control_word(ep.pr_fpa.fpa_pcr); - print_1167_regs(ep.pr_fpa.fpa_regs); - } else { - printf_unfiltered(" not in use.\n"); - } -} - -#if 0 /* disabled because it doesn't go through the target vector. */ -i386_float_info () -{ - char ubuf[UPAGES*NBPG]; - struct pt_regset regset; - - if (have_inferior_p()) - { - PTRACE_READ_REGS (inferior_pid, (PTRACE_ARG3_TYPE) ®set); - } - else - { - int corechan = bfd_cache_lookup (core_bfd); - if (lseek (corechan, 0, 0) < 0) - { - perror ("seek on core file"); - } - if (myread (corechan, ubuf, UPAGES*NBPG) < 0) - { - perror ("read on core file"); - } - /* only interested in the floating point registers */ - regset.pr_fpu = ((struct user *) ubuf)->u_fpusave; - regset.pr_fpa = ((struct user *) ubuf)->u_fpasave; - } - print_fpu_status(regset); - print_fpa_status(regset); -} -#endif - -static volatile int got_sigchld; - -/*ARGSUSED*/ -/* This will eventually be more interesting. */ -void -sigchld_handler(signo) - int signo; -{ - got_sigchld++; -} - -/* - * Signals for which the default action does not cause the process - * to die. See for where this came from (alas, we - * can't use those macros directly) - */ -#ifndef sigmask -#define sigmask(s) (1 << ((s) - 1)) -#endif -#define SIGNALS_DFL_SAFE sigmask(SIGSTOP) | sigmask(SIGTSTP) | \ - sigmask(SIGTTIN) | sigmask(SIGTTOU) | sigmask(SIGCHLD) | \ - sigmask(SIGCONT) | sigmask(SIGWINCH) | sigmask(SIGPWR) | \ - sigmask(SIGURG) | sigmask(SIGPOLL) - -#ifdef ATTACH_DETACH -/* - * Thanks to XPT_MPDEBUGGER, we have to mange child_wait(). - */ -int -child_wait(pid, status) - int pid; - struct target_waitstatus *status; -{ - int save_errno, rv, xvaloff, saoff, sa_hand; - struct pt_stop pt; - struct user u; - sigset_t set; - /* Host signal number for a signal which the inferior terminates with, or - 0 if it hasn't terminated due to a signal. */ - static int death_by_signal = 0; -#ifdef SVR4_SHARED_LIBS /* use this to distinguish ptx 2 vs ptx 4 */ - prstatus_t pstatus; -#endif - - do { - set_sigint_trap(); /* Causes SIGINT to be passed on to the - attached process. */ - save_errno = errno; - - got_sigchld = 0; - - sigemptyset(&set); - - while (got_sigchld == 0) { - sigsuspend(&set); - } - - clear_sigint_trap(); - - rv = mptrace(XPT_STOPSTAT, 0, (char *)&pt, 0); - if (-1 == rv) { - printf("XPT_STOPSTAT: errno %d\n", errno); /* DEBUG */ - continue; - } - - pid = pt.ps_pid; - - if (pid != inferior_pid) { - /* NOTE: the mystery fork in csh/tcsh needs to be ignored. - * We should not return new children for the initial run - * of a process until it has done the exec. - */ - /* inferior probably forked; send it on its way */ - rv = mptrace(XPT_UNDEBUG, pid, 0, 0); - if (-1 == rv) { - printf("child_wait: XPT_UNDEBUG: pid %d: %s\n", pid, - safe_strerror(errno)); - } - continue; - } - /* FIXME: Do we deal with fork notification correctly? */ - switch (pt.ps_reason) { - case PTS_FORK: - /* multi proc: treat like PTS_EXEC */ - /* - * Pretend this didn't happen, since gdb isn't set up - * to deal with stops on fork. - */ - rv = ptrace(PT_CONTSIG, pid, 1, 0); - if (-1 == rv) { - printf("PTS_FORK: PT_CONTSIG: error %d\n", errno); - } - continue; - case PTS_EXEC: - /* - * Pretend this is a SIGTRAP. - */ - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_TRAP; - break; - case PTS_EXIT: - /* - * Note: we stop before the exit actually occurs. Extract - * the exit code from the uarea. If we're stopped in the - * exit() system call, the exit code will be in - * u.u_ap[0]. An exit due to an uncaught signal will have - * something else in here, see the comment in the default: - * case, below. Finally,let the process exit. - */ - if (death_by_signal) - { - status->kind = TARGET_WAITKIND_SIGNALED; - status->value.sig = target_signal_from_host (death_by_signal); - death_by_signal = 0; - break; - } - xvaloff = (unsigned long)&u.u_ap[0] - (unsigned long)&u; - errno = 0; - rv = ptrace(PT_RUSER, pid, (char *)xvaloff, 0); - status->kind = TARGET_WAITKIND_EXITED; - status->value.integer = rv; - /* - * addr & data to mptrace() don't matter here, since - * the process is already dead. - */ - rv = mptrace(XPT_UNDEBUG, pid, 0, 0); - if (-1 == rv) { - printf("child_wait: PTS_EXIT: XPT_UNDEBUG: pid %d error %d\n", pid, - errno); - } - break; - case PTS_WATCHPT_HIT: - fatal("PTS_WATCHPT_HIT\n"); - break; - default: - /* stopped by signal */ - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = target_signal_from_host (pt.ps_reason); - death_by_signal = 0; - - if (0 == (SIGNALS_DFL_SAFE & sigmask(pt.ps_reason))) { - break; - } - /* else default action of signal is to die */ -#ifdef SVR4_SHARED_LIBS - rv = ptrace(PT_GET_PRSTATUS, pid, (char *)&pstatus, 0); - if (-1 == rv) - error("child_wait: signal %d PT_GET_PRSTATUS: %s\n", - pt.ps_reason, safe_strerror(errno)); - if (pstatus.pr_cursig != pt.ps_reason) { - printf("pstatus signal %d, pt signal %d\n", - pstatus.pr_cursig, pt.ps_reason); - } - sa_hand = (int)pstatus.pr_action.sa_handler; -#else - saoff = (unsigned long)&u.u_sa[0] - (unsigned long)&u; - saoff += sizeof(struct sigaction) * (pt.ps_reason - 1); - errno = 0; - sa_hand = ptrace(PT_RUSER, pid, (char *)saoff, 0); - if (errno) - error("child_wait: signal %d: RUSER: %s\n", - pt.ps_reason, safe_strerror(errno)); -#endif - if ((int)SIG_DFL == sa_hand) { - /* we will be dying */ - death_by_signal = pt.ps_reason; - } - break; - } - - } while (pid != inferior_pid); /* Some other child died or stopped */ - - return pid; -} -#else /* !ATTACH_DETACH */ -/* - * Simple child_wait() based on inftarg.c child_wait() for use until - * the MPDEBUGGER child_wait() works properly. This will go away when - * that is fixed. - */ -child_wait (pid, ourstatus) - int pid; - struct target_waitstatus *ourstatus; -{ - int save_errno; - int status; - - do { - pid = wait (&status); - save_errno = errno; - - if (pid == -1) - { - if (save_errno == EINTR) - continue; - fprintf (stderr, "Child process unexpectedly missing: %s.\n", - safe_strerror (save_errno)); - ourstatus->kind = TARGET_WAITKIND_SIGNALLED; - ourstatus->value.sig = TARGET_SIGNAL_UNKNOWN; - return -1; - } - } while (pid != inferior_pid); /* Some other child died or stopped */ - store_waitstatus (ourstatus, status); - return pid; -} -#endif /* ATTACH_DETACH */ - - - -/* This function simply calls ptrace with the given arguments. - It exists so that all calls to ptrace are isolated in this - machine-dependent file. */ -int -call_ptrace (request, pid, addr, data) - int request, pid; - PTRACE_ARG3_TYPE addr; - int data; -{ - return ptrace (request, pid, addr, data); -} - -int -call_mptrace(request, pid, addr, data) - int request, pid; - PTRACE_ARG3_TYPE addr; - int data; -{ - return mptrace(request, pid, addr, data); -} - -#if defined (DEBUG_PTRACE) -/* For the rest of the file, use an extra level of indirection */ -/* This lets us breakpoint usefully on call_ptrace. */ -#define ptrace call_ptrace -#define mptrace call_mptrace -#endif - -void -kill_inferior () -{ - if (inferior_pid == 0) - return; - - /* For MPDEBUGGER, don't use PT_KILL, since the child will stop - again with a PTS_EXIT. Just hit him with SIGKILL (so he stops) - and detach. */ - - kill (inferior_pid, SIGKILL); -#ifdef ATTACH_DETACH - detach(SIGKILL); -#else /* ATTACH_DETACH */ - ptrace(PT_KILL, inferior_pid, 0, 0); - wait((int *)NULL); -#endif /* ATTACH_DETACH */ - target_mourn_inferior (); -} - -/* Resume execution of the inferior process. - If STEP is nonzero, single-step it. - If SIGNAL is nonzero, give it that signal. */ - -void -child_resume (pid, step, signal) - int pid; - int step; - enum target_signal signal; -{ - errno = 0; - - if (pid == -1) - pid = inferior_pid; - - /* An address of (PTRACE_ARG3_TYPE)1 tells ptrace to continue from where - it was. (If GDB wanted it to start some other way, we have already - written a new PC value to the child.) - - If this system does not support PT_SSTEP, a higher level function will - have called single_step() to transmute the step request into a - continue request (by setting breakpoints on all possible successor - instructions), so we don't have to worry about that here. */ - - if (step) - ptrace (PT_SSTEP, pid, (PTRACE_ARG3_TYPE) 1, signal); - else - ptrace (PT_CONTSIG, pid, (PTRACE_ARG3_TYPE) 1, signal); - - if (errno) - perror_with_name ("ptrace"); -} - -#ifdef ATTACH_DETACH -/* Start debugging the process whose number is PID. */ -int -attach (pid) - int pid; -{ - sigset_t set; - int rv; - - rv = mptrace(XPT_DEBUG, pid, 0, 0); - if (-1 == rv) { - error("mptrace(XPT_DEBUG): %s", safe_strerror(errno)); - } - rv = mptrace(XPT_SIGNAL, pid, 0, SIGSTOP); - if (-1 == rv) { - error("mptrace(XPT_SIGNAL): %s", safe_strerror(errno)); - } - attach_flag = 1; - return pid; -} - -void -detach (signo) - int signo; -{ - int rv; - - rv = mptrace(XPT_UNDEBUG, inferior_pid, 1, signo); - if (-1 == rv) { - error("mptrace(XPT_UNDEBUG): %s", safe_strerror(errno)); - } - attach_flag = 0; -} - -#endif /* ATTACH_DETACH */ - -/* Default the type of the ptrace transfer to int. */ -#ifndef PTRACE_XFER_TYPE -#define PTRACE_XFER_TYPE int -#endif - - -/* 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. - - 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 (memaddr, myaddr, len, write, target) - CORE_ADDR memaddr; - char *myaddr; - int len; - int write; - struct target_ops *target; /* ignored */ -{ - register int i; - /* Round starting address down to longword boundary. */ - register CORE_ADDR addr = memaddr & - sizeof (PTRACE_XFER_TYPE); - /* Round ending address up; get number of longwords that makes. */ - register int count - = (((memaddr + len) - addr) + sizeof (PTRACE_XFER_TYPE) - 1) - / sizeof (PTRACE_XFER_TYPE); - /* Allocate buffer of that many longwords. */ - register PTRACE_XFER_TYPE *buffer - = (PTRACE_XFER_TYPE *) alloca (count * sizeof (PTRACE_XFER_TYPE)); - - if (write) - { - /* Fill start and end extra bytes of buffer with existing memory data. */ - - if (addr != memaddr || len < (int) sizeof (PTRACE_XFER_TYPE)) { - /* Need part of initial word -- fetch it. */ - buffer[0] = ptrace (PT_RTEXT, inferior_pid, (PTRACE_ARG3_TYPE) addr, - 0); - } - - if (count > 1) /* FIXME, avoid if even boundary */ - { - buffer[count - 1] - = ptrace (PT_RTEXT, inferior_pid, - ((PTRACE_ARG3_TYPE) - (addr + (count - 1) * sizeof (PTRACE_XFER_TYPE))), - 0); - } - - /* Copy data to be written over corresponding part of buffer */ - - memcpy ((char *) buffer + (memaddr & (sizeof (PTRACE_XFER_TYPE) - 1)), - myaddr, - len); - - /* Write the entire buffer. */ - - for (i = 0; i < count; i++, addr += sizeof (PTRACE_XFER_TYPE)) - { - errno = 0; - ptrace (PT_WDATA, inferior_pid, (PTRACE_ARG3_TYPE) addr, - buffer[i]); - if (errno) - { - /* Using the appropriate one (I or D) is necessary for - Gould NP1, at least. */ - errno = 0; - ptrace (PT_WTEXT, inferior_pid, (PTRACE_ARG3_TYPE) addr, - buffer[i]); - } - if (errno) - return 0; - } - } - else - { - /* Read all the longwords */ - for (i = 0; i < count; i++, addr += sizeof (PTRACE_XFER_TYPE)) - { - errno = 0; - buffer[i] = ptrace (PT_RTEXT, inferior_pid, - (PTRACE_ARG3_TYPE) addr, 0); - if (errno) - return 0; - QUIT; - } - - /* Copy appropriate bytes out of the buffer. */ - memcpy (myaddr, - (char *) buffer + (memaddr & (sizeof (PTRACE_XFER_TYPE) - 1)), - len); - } - return len; -} - - -void -_initialize_symm_nat () -{ -#ifdef ATTACH_DETACH -/* - * the MPDEBUGGER is necessary for process tree debugging and attach - * to work, but it alters the behavior of debugged processes, so other - * things (at least child_wait()) will have to change to accomodate - * that. - * - * Note that attach is not implemented in dynix 3, and not in ptx - * until version 2.1 of the OS. - */ - int rv; - sigset_t set; - struct sigaction sact; - - rv = mptrace(XPT_MPDEBUGGER, 0, 0, 0); - if (-1 == rv) { - fatal("_initialize_symm_nat(): mptrace(XPT_MPDEBUGGER): %s", - safe_strerror(errno)); - } - - /* - * Under MPDEBUGGER, we get SIGCLHD when a traced process does - * anything of interest. - */ - - /* - * Block SIGCHLD. We leave it blocked all the time, and then - * call sigsuspend() in child_wait() to wait for the child - * to do something. None of these ought to fail, but check anyway. - */ - sigemptyset(&set); - rv = sigaddset(&set, SIGCHLD); - if (-1 == rv) { - fatal("_initialize_symm_nat(): sigaddset(SIGCHLD): %s", - safe_strerror(errno)); - } - rv = sigprocmask(SIG_BLOCK, &set, (sigset_t *)NULL); - if (-1 == rv) { - fatal("_initialize_symm_nat(): sigprocmask(SIG_BLOCK): %s", - safe_strerror(errno)); - } - - sact.sa_handler = sigchld_handler; - sigemptyset(&sact.sa_mask); - sact.sa_flags = SA_NOCLDWAIT; /* keep the zombies away */ - rv = sigaction(SIGCHLD, &sact, (struct sigaction *)NULL); - if (-1 == rv) { - fatal("_initialize_symm_nat(): sigaction(SIGCHLD): %s", - safe_strerror(errno)); - } -#endif -} diff --git a/contrib/gdb/gdb/symm-tdep.c b/contrib/gdb/gdb/symm-tdep.c deleted file mode 100644 index aaf73e9..0000000 --- a/contrib/gdb/gdb/symm-tdep.c +++ /dev/null @@ -1,93 +0,0 @@ -/* Sequent Symmetry target interface, for GDB. - Copyright (C) 1986, 1987, 1989, 1991, 1994 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. */ - -/* many 387-specific items of use taken from i386-dep.c */ - -#include "defs.h" -#include "frame.h" -#include "inferior.h" -#include "symtab.h" - -#include -#include -#include -#include -#include -#include "gdb_stat.h" -#include "gdbcore.h" -#include - -void -symmetry_extract_return_value(type, regbuf, valbuf) - struct type *type; - char *regbuf; - char *valbuf; -{ - union { - double d; - int l[2]; - } xd; - struct minimal_symbol *msymbol; - float f; - - if (TYPE_CODE_FLT == TYPE_CODE(type)) { - msymbol = lookup_minimal_symbol ("1167_flt", NULL, NULL); - if (msymbol != NULL) { - /* found "1167_flt" means 1167, %fp2-%fp3 */ - /* float & double; 19= %fp2, 20= %fp3 */ - /* no single precision on 1167 */ - xd.l[1] = *((int *)®buf[REGISTER_BYTE(19)]); - xd.l[0] = *((int *)®buf[REGISTER_BYTE(20)]); - switch (TYPE_LENGTH(type)) { - case 4: - /* FIXME: broken for cross-debugging. */ - f = (float) xd.d; - memcpy (valbuf, &f, TYPE_LENGTH(type)); - break; - case 8: - /* FIXME: broken for cross-debugging. */ - memcpy (valbuf, &xd.d, TYPE_LENGTH(type)); - break; - default: - error("Unknown floating point size"); - break; - } - } else { - /* 387 %st(0), gcc uses this */ - i387_to_double(((int *)®buf[REGISTER_BYTE(3)]), - &xd.d); - switch (TYPE_LENGTH(type)) { - case 4: /* float */ - f = (float) xd.d; - /* FIXME: broken for cross-debugging. */ - memcpy (valbuf, &f, 4); - break; - case 8: /* double */ - /* FIXME: broken for cross-debugging. */ - memcpy (valbuf, &xd.d, 8); - break; - default: - error("Unknown floating point size"); - break; - } - } - } else { - memcpy (valbuf, regbuf, TYPE_LENGTH (type)); - } -} diff --git a/contrib/gdb/gdb/umax-xdep.c b/contrib/gdb/gdb/umax-xdep.c deleted file mode 100644 index d54519e..0000000 --- a/contrib/gdb/gdb/umax-xdep.c +++ /dev/null @@ -1,133 +0,0 @@ -/* umax host stuff. - Copyright (C) 1986, 1987, 1989, 1991 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 "frame.h" -#include "inferior.h" - -#include -#include -#include -#include -#include - -#include "gdbcore.h" -#include -#define PTRACE_ATTACH PT_ATTACH -#define PTRACE_DETACH PT_FREEPROC - -#include -#include "gdb_stat.h" - -/* Work with core dump and executable files, for GDB. - This code would be in corefile.c if it weren't machine-dependent. */ - -void -core_file_command (filename, from_tty) - char *filename; - int from_tty; -{ - int val; - extern char registers[]; - - /* Discard all vestiges of any previous core file - and mark data and stack spaces as empty. */ - - if (corefile) - free (corefile); - corefile = 0; - - if (corechan >= 0) - close (corechan); - corechan = -1; - - data_start = 0; - data_end = 0; - stack_start = STACK_END_ADDR; - stack_end = STACK_END_ADDR; - - /* Now, if a new core file was specified, open it and digest it. */ - - if (filename) - { - filename = tilde_expand (filename); - make_cleanup (free, filename); - - if (have_inferior_p ()) - error ("To look at a core file, you must kill the program with \"kill\"."); - corechan = open (filename, O_RDONLY, 0); - if (corechan < 0) - perror_with_name (filename); - /* 4.2-style (and perhaps also sysV-style) core dump file. */ - { - struct ptrace_user u; - int reg_offset; - - val = myread (corechan, &u, sizeof u); - if (val < 0) - perror_with_name (filename); - data_start = exec_data_start; - - data_end = data_start + u.pt_dsize; - stack_start = stack_end - u.pt_ssize; - data_offset = sizeof u; - stack_offset = data_offset + u.pt_dsize; - reg_offset = 0; - - memcpy (&core_aouthdr, &u.pt_aouthdr, sizeof (AOUTHDR)); - printf_unfiltered ("Core file is from \"%s\".\n", u.pt_comm); - if (u.pt_signal > 0) - printf_unfiltered ("Program terminated with signal %d, %s.\n", - u.pt_signal, safe_strsignal (u.pt_signal)); - - /* Read the register values out of the core file and store - them where `read_register' will find them. */ - - { - register int regno; - - for (regno = 0; regno < NUM_REGS; regno++) - { - char buf[MAX_REGISTER_RAW_SIZE]; - - val = lseek (corechan, register_addr (regno, reg_offset), 0); - if (val < 0) - perror_with_name (filename); - - val = myread (corechan, buf, sizeof buf); - if (val < 0) - perror_with_name (filename); - supply_register (regno, buf); - } - } - } - if (filename[0] == '/') - corefile = savestring (filename, strlen (filename)); - else - { - corefile = concat (current_directory, "/", filename, NULL); - } - - flush_cached_frames (); - select_frame (get_current_frame (), 0); - validate_files (); - } - else if (from_tty) - printf_unfiltered ("No core file now.\n"); -} diff --git a/contrib/gdb/gdb/xcoffread.c b/contrib/gdb/gdb/xcoffread.c deleted file mode 100644 index 7704a5f..0000000 --- a/contrib/gdb/gdb/xcoffread.c +++ /dev/null @@ -1,2767 +0,0 @@ -/* Read AIX xcoff symbol tables and convert to internal format, for GDB. - Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996 - Free Software Foundation, Inc. - Derived from coffread.c, dbxread.c, and a lot of hacking. - Contributed by IBM Corporation. - -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. */ - -/* RS/6000 and PowerPC only: - Needs xcoff_add_toc_to_loadinfo and xcoff_init_loadinfo in - rs6000-tdep.c from target. - However, if you define FAKING_RS6000, then this code will link with - any target. */ - -#include "defs.h" -#include "bfd.h" - -#include -#include -#include -#include "gdb_string.h" - -#include -#ifndef NO_SYS_FILE -#include -#endif -#include "gdb_stat.h" - -#include "coff/internal.h" -#include "libcoff.h" /* FIXME, internal data from BFD */ -#include "coff/rs6000.h" - -#include "symtab.h" -#include "gdbtypes.h" -#include "symfile.h" -#include "objfiles.h" -#include "buildsym.h" -#include "stabsread.h" -#include "expression.h" -#include "language.h" /* Needed inside partial-stab.h */ -#include "complaints.h" - -#include "gdb-stabs.h" - -/* For interface with stabsread.c. */ -#include "aout/stab_gnu.h" - -/* For interface with partial-stab.h. */ -#define N_UNDF 0 /* Undefined symbol */ -#undef N_ABS -#define N_ABS 2 -#define N_TEXT 4 /* Text sym -- defined at offset in text seg */ -#define N_DATA 6 /* Data sym -- defined at offset in data seg */ -#define N_BSS 8 /* BSS sym -- defined at offset in zero'd seg */ -#define N_COMM 0x12 /* Common symbol (visible after shared lib dynlink) */ -#define N_FN 0x1f /* File name of .o file */ -#define N_FN_SEQ 0x0C /* N_FN from Sequent compilers (sigh) */ -/* Note: N_EXT can only be usefully OR-ed with N_UNDF, N_ABS, N_TEXT, - N_DATA, or N_BSS. When the low-order bit of other types is set, - (e.g. N_WARNING versus N_FN), they are two different types. */ -#define N_EXT 1 /* External symbol (as opposed to local-to-this-file) */ -#define N_INDR 0x0a - -/* The following symbols refer to set elements. - All the N_SET[ATDB] symbols with the same name form one set. - Space is allocated for the set in the text section, and each set - elements value is stored into one word of the space. - The first word of the space is the length of the set (number of elements). - - The address of the set is made into an N_SETV symbol - whose name is the same as the name of the set. - This symbol acts like a N_DATA global symbol - in that it can satisfy undefined external references. */ - -/* These appear as input to LD, in a .o file. */ -#define N_SETA 0x14 /* Absolute set element symbol */ -#define N_SETT 0x16 /* Text set element symbol */ -#define N_SETD 0x18 /* Data set element symbol */ -#define N_SETB 0x1A /* Bss set element symbol */ - -/* This is output from LD. */ -#define N_SETV 0x1C /* Pointer to set vector in data area. */ - -/* We put a pointer to this structure in the read_symtab_private field - of the psymtab. */ - -struct symloc { - - /* First symbol number for this file. */ - - int first_symnum; - - /* Number of symbols in the section of the symbol table devoted to - this file's symbols (actually, the section bracketed may contain - more than just this file's symbols). If numsyms is 0, the only - reason for this thing's existence is the dependency list. Nothing - else will happen when it is read in. */ - - int numsyms; - - /* Position of the start of the line number information for this psymtab. */ - unsigned int lineno_off; -}; - -/* Remember what we deduced to be the source language of this psymtab. */ - -static enum language psymtab_language = language_unknown; - - -/* Simplified internal version of coff symbol table information */ - -struct coff_symbol { - char *c_name; - int c_symnum; /* symbol number of this entry */ - int c_naux; /* 0 if syment only, 1 if syment + auxent */ - long c_value; - unsigned char c_sclass; - int c_secnum; - unsigned int c_type; -}; - -/* last function's saved coff symbol `cs' */ - -static struct coff_symbol fcn_cs_saved; - -static bfd *symfile_bfd; - -/* Core address of start and end of text of current source file. - This is calculated from the first function seen after a C_FILE - symbol. */ - - -static CORE_ADDR cur_src_end_addr; - -/* Core address of the end of the first object file. */ - -static CORE_ADDR first_object_file_end; - -/* initial symbol-table-debug-string vector length */ - -#define INITIAL_STABVECTOR_LENGTH 40 - -/* Nonzero if within a function (so symbols should be local, - if nothing says specifically). */ - -int within_function; - -/* Size of a COFF symbol. I think it is always 18, so I'm not sure - there is any reason not to just use a #define, but might as well - ask BFD for the size and store it here, I guess. */ - -static unsigned local_symesz; - -struct coff_symfile_info { - file_ptr min_lineno_offset; /* Where in file lowest line#s are */ - file_ptr max_lineno_offset; /* 1+last byte of line#s in file */ - - /* Pointer to the string table. */ - char *strtbl; - - /* Pointer to debug section. */ - char *debugsec; - - /* Pointer to the a.out symbol table. */ - char *symtbl; - - /* Number of symbols in symtbl. */ - int symtbl_num_syms; -}; - -static struct complaint storclass_complaint = - {"Unexpected storage class: %d", 0, 0}; - -static struct complaint bf_notfound_complaint = - {"line numbers off, `.bf' symbol not found", 0, 0}; - -static struct complaint ef_complaint = - {"Mismatched .ef symbol ignored starting at symnum %d", 0, 0}; - -static struct complaint eb_complaint = - {"Mismatched .eb symbol ignored starting at symnum %d", 0, 0}; - -static void -enter_line_range PARAMS ((struct subfile *, unsigned, unsigned, - CORE_ADDR, CORE_ADDR, unsigned *)); - -static void -init_stringtab PARAMS ((bfd *, file_ptr, struct objfile *)); - -static void -xcoff_symfile_init PARAMS ((struct objfile *)); - -static void -xcoff_new_init PARAMS ((struct objfile *)); - -static void -xcoff_symfile_finish PARAMS ((struct objfile *)); - -static struct section_offsets * -xcoff_symfile_offsets PARAMS ((struct objfile *, CORE_ADDR)); - -static void -find_linenos PARAMS ((bfd *, sec_ptr, PTR)); - -static char * -coff_getfilename PARAMS ((union internal_auxent *, struct objfile *)); - -static void -read_symbol PARAMS ((struct internal_syment *, int)); - -static int -read_symbol_lineno PARAMS ((int)); - -static int -read_symbol_nvalue PARAMS ((int)); - -static struct symbol * -process_xcoff_symbol PARAMS ((struct coff_symbol *, struct objfile *)); - -static void -read_xcoff_symtab PARAMS ((struct partial_symtab *)); - -static void -add_stab_to_list PARAMS ((char *, struct pending_stabs **)); - - -/* Translate from a COFF section number (target_index) to a SECT_OFF_* - code. */ -static int secnum_to_section PARAMS ((int, struct objfile *)); - -struct find_targ_sec_arg { - int targ_index; - int *resultp; -}; - -static void find_targ_sec PARAMS ((bfd *, asection *, void *)); - -static void find_targ_sec (abfd, sect, obj) - bfd *abfd; - asection *sect; - PTR obj; -{ - struct find_targ_sec_arg *args = (struct find_targ_sec_arg *)obj; - if (sect->target_index == args->targ_index) - { - /* This is the section. Figure out what SECT_OFF_* code it is. */ - if (bfd_get_section_flags (abfd, sect) & SEC_CODE) - *args->resultp = SECT_OFF_TEXT; - else if (bfd_get_section_flags (abfd, sect) & SEC_LOAD) - *args->resultp = SECT_OFF_DATA; - else - *args->resultp = SECT_OFF_BSS; - } -} - -/* Return the section number (SECT_OFF_*) that CS points to. */ -static int -secnum_to_section (secnum, objfile) - int secnum; - struct objfile *objfile; -{ - int off = SECT_OFF_TEXT; - struct find_targ_sec_arg args; - args.targ_index = secnum; - args.resultp = &off; - bfd_map_over_sections (objfile->obfd, find_targ_sec, &args); - return off; -} - -/* add a given stab string into given stab vector. */ - -static void -add_stab_to_list (stabname, stabvector) -char *stabname; -struct pending_stabs **stabvector; -{ - if ( *stabvector == NULL) { - *stabvector = (struct pending_stabs *) - xmalloc (sizeof (struct pending_stabs) + - INITIAL_STABVECTOR_LENGTH * sizeof (char*)); - (*stabvector)->count = 0; - (*stabvector)->length = INITIAL_STABVECTOR_LENGTH; - } - else if ((*stabvector)->count >= (*stabvector)->length) { - (*stabvector)->length += INITIAL_STABVECTOR_LENGTH; - *stabvector = (struct pending_stabs *) - xrealloc ((char *) *stabvector, sizeof (struct pending_stabs) + - (*stabvector)->length * sizeof (char*)); - } - (*stabvector)->stab [(*stabvector)->count++] = stabname; -} - -/* Linenos are processed on a file-by-file basis. - - Two reasons: - - 1) xlc (IBM's native c compiler) postpones static function code - emission to the end of a compilation unit. This way it can - determine if those functions (statics) are needed or not, and - can do some garbage collection (I think). This makes line - numbers and corresponding addresses unordered, and we end up - with a line table like: - - - lineno addr - foo() 10 0x100 - 20 0x200 - 30 0x300 - - foo3() 70 0x400 - 80 0x500 - 90 0x600 - - static foo2() - 40 0x700 - 50 0x800 - 60 0x900 - - and that breaks gdb's binary search on line numbers, if the - above table is not sorted on line numbers. And that sort - should be on function based, since gcc can emit line numbers - like: - - 10 0x100 - for the init/test part of a for stmt. - 20 0x200 - 30 0x300 - 10 0x400 - for the increment part of a for stmt. - - arrange_linetable() will do this sorting. - - 2) aix symbol table might look like: - - c_file // beginning of a new file - .bi // beginning of include file - .ei // end of include file - .bi - .ei - - basically, .bi/.ei pairs do not necessarily encapsulate - their scope. They need to be recorded, and processed later - on when we come the end of the compilation unit. - Include table (inclTable) and process_linenos() handle - that. */ - -/* compare line table entry addresses. */ - -static int -compare_lte (lte1, lte2) - struct linetable_entry *lte1, *lte2; -{ - return lte1->pc - lte2->pc; -} - -/* Give a line table with function entries are marked, arrange its functions - in assending order and strip off function entry markers and return it in - a newly created table. If the old one is good enough, return the old one. */ -/* FIXME: I think all this stuff can be replaced by just passing - sort_linevec = 1 to end_symtab. */ - -static struct linetable * -arrange_linetable (oldLineTb) - struct linetable *oldLineTb; /* old linetable */ -{ - int ii, jj, - newline, /* new line count */ - function_count; /* # of functions */ - - struct linetable_entry *fentry; /* function entry vector */ - int fentry_size; /* # of function entries */ - struct linetable *newLineTb; /* new line table */ - -#define NUM_OF_FUNCTIONS 20 - - fentry_size = NUM_OF_FUNCTIONS; - fentry = (struct linetable_entry*) - xmalloc (fentry_size * sizeof (struct linetable_entry)); - - for (function_count=0, ii=0; ii nitems; ++ii) { - - if (oldLineTb->item[ii].line == 0) { /* function entry found. */ - - if (function_count >= fentry_size) { /* make sure you have room. */ - fentry_size *= 2; - fentry = (struct linetable_entry*) - xrealloc (fentry, fentry_size * sizeof (struct linetable_entry)); - } - fentry[function_count].line = ii; - fentry[function_count].pc = oldLineTb->item[ii].pc; - ++function_count; - } - } - - if (function_count == 0) { - free (fentry); - return oldLineTb; - } - else if (function_count > 1) - qsort (fentry, function_count, sizeof(struct linetable_entry), compare_lte); - - /* allocate a new line table. */ - newLineTb = (struct linetable *) - xmalloc - (sizeof (struct linetable) + - (oldLineTb->nitems - function_count) * sizeof (struct linetable_entry)); - - /* if line table does not start with a function beginning, copy up until - a function begin. */ - - newline = 0; - if (oldLineTb->item[0].line != 0) - for (newline=0; - newline < oldLineTb->nitems && oldLineTb->item[newline].line; ++newline) - newLineTb->item[newline] = oldLineTb->item[newline]; - - /* Now copy function lines one by one. */ - - for (ii=0; ii < function_count; ++ii) { - for (jj = fentry[ii].line + 1; - jj < oldLineTb->nitems && oldLineTb->item[jj].line != 0; - ++jj, ++newline) - newLineTb->item[newline] = oldLineTb->item[jj]; - } - free (fentry); - newLineTb->nitems = oldLineTb->nitems - function_count; - return newLineTb; -} - -/* include file support: C_BINCL/C_EINCL pairs will be kept in the - following `IncludeChain'. At the end of each symtab (end_symtab), - we will determine if we should create additional symtab's to - represent if (the include files. */ - - -typedef struct _inclTable { - char *name; /* include filename */ - - /* Offsets to the line table. end points to the last entry which is - part of this include file. */ - int begin, end; - - struct subfile *subfile; - unsigned funStartLine; /* start line # of its function */ -} InclTable; - -#define INITIAL_INCLUDE_TABLE_LENGTH 20 -static InclTable *inclTable; /* global include table */ -static int inclIndx; /* last entry to table */ -static int inclLength; /* table length */ -static int inclDepth; /* nested include depth */ - -static void allocate_include_entry PARAMS ((void)); - -static void -record_include_begin (cs) -struct coff_symbol *cs; -{ - if (inclDepth) - { - /* In xcoff, we assume include files cannot be nested (not in .c files - of course, but in corresponding .s files.). */ - - /* This can happen with old versions of GCC. - GCC 2.3.3-930426 does not exhibit this on a test case which - a user said produced the message for him. */ - static struct complaint msg = {"Nested C_BINCL symbols", 0, 0}; - complain (&msg); - } - ++inclDepth; - - allocate_include_entry (); - - inclTable [inclIndx].name = cs->c_name; - inclTable [inclIndx].begin = cs->c_value; -} - -static void -record_include_end (cs) -struct coff_symbol *cs; -{ - InclTable *pTbl; - - if (inclDepth == 0) - { - static struct complaint msg = {"Mismatched C_BINCL/C_EINCL pair", 0, 0}; - complain (&msg); - } - - allocate_include_entry (); - - pTbl = &inclTable [inclIndx]; - pTbl->end = cs->c_value; - - --inclDepth; - ++inclIndx; -} - -static void -allocate_include_entry () -{ - if (inclTable == NULL) - { - inclTable = (InclTable *) - xmalloc (sizeof (InclTable) * INITIAL_INCLUDE_TABLE_LENGTH); - memset (inclTable, - '\0', sizeof (InclTable) * INITIAL_INCLUDE_TABLE_LENGTH); - inclLength = INITIAL_INCLUDE_TABLE_LENGTH; - inclIndx = 0; - } - else if (inclIndx >= inclLength) - { - inclLength += INITIAL_INCLUDE_TABLE_LENGTH; - inclTable = (InclTable *) - xrealloc (inclTable, sizeof (InclTable) * inclLength); - memset (inclTable + inclLength - INITIAL_INCLUDE_TABLE_LENGTH, - '\0', sizeof (InclTable)*INITIAL_INCLUDE_TABLE_LENGTH); - } -} - -/* Global variable to pass the psymtab down to all the routines involved - in psymtab to symtab processing. */ -static struct partial_symtab *this_symtab_psymtab; - -/* given the start and end addresses of a compilation unit (or a csect, - at times) process its lines and create appropriate line vectors. */ - -static void -process_linenos (start, end) - CORE_ADDR start, end; -{ - int offset, ii; - file_ptr max_offset = - ((struct coff_symfile_info *)this_symtab_psymtab->objfile->sym_private) - ->max_lineno_offset; - - /* subfile structure for the main compilation unit. */ - struct subfile main_subfile; - - /* In the main source file, any time we see a function entry, we - reset this variable to function's absolute starting line number. - All the following line numbers in the function are relative to - this, and we record absolute line numbers in record_line(). */ - - unsigned int main_source_baseline = 0; - - unsigned *firstLine; - - offset = - ((struct symloc *)this_symtab_psymtab->read_symtab_private)->lineno_off; - if (offset == 0) - goto return_after_cleanup; - - memset (&main_subfile, '\0', sizeof (main_subfile)); - - if (inclIndx == 0) - /* All source lines were in the main source file. None in include files. */ - - enter_line_range (&main_subfile, offset, 0, start, end, - &main_source_baseline); - - else - { - /* There was source with line numbers in include files. */ - main_source_baseline = 0; - for (ii=0; ii < inclIndx; ++ii) - { - struct subfile *tmpSubfile; - - /* If there is main file source before include file, enter it. */ - if (offset < inclTable[ii].begin) - { - enter_line_range - (&main_subfile, offset, inclTable[ii].begin - LINESZ, - start, 0, &main_source_baseline); - } - - /* Have a new subfile for the include file. */ - - tmpSubfile = inclTable[ii].subfile = - (struct subfile *) xmalloc (sizeof (struct subfile)); - - memset (tmpSubfile, '\0', sizeof (struct subfile)); - firstLine = &(inclTable[ii].funStartLine); - - /* Enter include file's lines now. */ - enter_line_range (tmpSubfile, inclTable[ii].begin, - inclTable[ii].end, start, 0, firstLine); - - if (offset <= inclTable[ii].end) - offset = inclTable[ii].end + LINESZ; - } - - /* All the include files' line have been processed at this point. Now, - enter remaining lines of the main file, if any left. */ - if (offset < max_offset + 1 - LINESZ) - { - enter_line_range (&main_subfile, offset, 0, start, end, - &main_source_baseline); - } - } - - /* Process main file's line numbers. */ - if (main_subfile.line_vector) - { - struct linetable *lineTb, *lv; - - lv = main_subfile.line_vector; - - /* Line numbers are not necessarily ordered. xlc compilation will - put static function to the end. */ - - lineTb = arrange_linetable (lv); - if (lv == lineTb) - { - current_subfile->line_vector = (struct linetable *) - xrealloc (lv, (sizeof (struct linetable) - + lv->nitems * sizeof (struct linetable_entry))); - } - else - { - free (lv); - current_subfile->line_vector = lineTb; - } - - current_subfile->line_vector_length = - current_subfile->line_vector->nitems; - } - - /* Now, process included files' line numbers. */ - - for (ii=0; ii < inclIndx; ++ii) - { - if ((inclTable[ii].subfile)->line_vector) /* Useless if!!! FIXMEmgo */ - { - struct linetable *lineTb, *lv; - - lv = (inclTable[ii].subfile)->line_vector; - - /* Line numbers are not necessarily ordered. xlc compilation will - put static function to the end. */ - - lineTb = arrange_linetable (lv); - - push_subfile (); - - /* For the same include file, we might want to have more than one - subfile. This happens if we have something like: - - ...... - #include "foo.h" - ...... - #include "foo.h" - ...... - - while foo.h including code in it. (stupid but possible) - Since start_subfile() looks at the name and uses an - existing one if finds, we need to provide a fake name and - fool it. */ - -#if 0 - start_subfile (inclTable[ii].name, (char*)0); -#else - { - /* Pick a fake name that will produce the same results as this - one when passed to deduce_language_from_filename. Kludge on - top of kludge. */ - char *fakename = strrchr (inclTable[ii].name, '.'); - if (fakename == NULL) - fakename = " ?"; - start_subfile (fakename, (char*)0); - free (current_subfile->name); - } - current_subfile->name = strdup (inclTable[ii].name); -#endif - - if (lv == lineTb) - { - current_subfile->line_vector = - (struct linetable *) xrealloc - (lv, (sizeof (struct linetable) - + lv->nitems * sizeof (struct linetable_entry))); - - } - else - { - free (lv); - current_subfile->line_vector = lineTb; - } - - current_subfile->line_vector_length = - current_subfile->line_vector->nitems; - start_subfile (pop_subfile (), (char*)0); - } - } - - return_after_cleanup: - - /* We don't want to keep alloc/free'ing the global include file table. */ - inclIndx = 0; - - /* Start with a fresh subfile structure for the next file. */ - memset (&main_subfile, '\0', sizeof (struct subfile)); -} - -void -aix_process_linenos () -{ - /* process line numbers and enter them into line vector */ - process_linenos (last_source_start_addr, cur_src_end_addr); -} - - -/* Enter a given range of lines into the line vector. - can be called in the following two ways: - enter_line_range (subfile, beginoffset, endoffset, startaddr, 0, firstLine) or - enter_line_range (subfile, beginoffset, 0, startaddr, endaddr, firstLine) - - endoffset points to the last line table entry that we should pay - attention to. */ - -static void -enter_line_range (subfile, beginoffset, endoffset, startaddr, endaddr, - firstLine) - struct subfile *subfile; - unsigned beginoffset, endoffset; /* offsets to line table */ - CORE_ADDR startaddr, endaddr; - unsigned *firstLine; -{ - unsigned int curoffset; - CORE_ADDR addr; - struct external_lineno ext_lnno; - struct internal_lineno int_lnno; - unsigned int limit_offset; - bfd *abfd; - - if (endoffset == 0 && startaddr == 0 && endaddr == 0) - return; - curoffset = beginoffset; - limit_offset = - ((struct coff_symfile_info *)this_symtab_psymtab->objfile->sym_private) - ->max_lineno_offset; - - if (endoffset != 0) - { - if (endoffset >= limit_offset) - { - static struct complaint msg = - {"Bad line table offset in C_EINCL directive", 0, 0}; - complain (&msg); - return; - } - limit_offset = endoffset; - } - else - limit_offset -= 1; - abfd = this_symtab_psymtab->objfile->obfd; - - while (curoffset <= limit_offset) - { - bfd_seek (abfd, curoffset, SEEK_SET); - bfd_read (&ext_lnno, sizeof (struct external_lineno), 1, abfd); - bfd_coff_swap_lineno_in (abfd, &ext_lnno, &int_lnno); - - /* Find the address this line represents. */ - addr = (int_lnno.l_lnno - ? int_lnno.l_addr.l_paddr - : read_symbol_nvalue (int_lnno.l_addr.l_symndx)); - addr += ANOFFSET (this_symtab_psymtab->objfile->section_offsets, - SECT_OFF_TEXT); - - if (addr < startaddr || (endaddr && addr >= endaddr)) - return; - - if (int_lnno.l_lnno == 0) - { - *firstLine = read_symbol_lineno (int_lnno.l_addr.l_symndx); - record_line (subfile, 0, addr); - --(*firstLine); - } - else - record_line (subfile, *firstLine + int_lnno.l_lnno, addr); - curoffset += LINESZ; - } -} - - -/* Save the vital information for use when closing off the current file. - NAME is the file name the symbols came from, START_ADDR is the first - text address for the file, and SIZE is the number of bytes of text. */ - -#define complete_symtab(name, start_addr) { \ - last_source_file = savestring (name, strlen (name)); \ - last_source_start_addr = start_addr; \ -} - - -/* Refill the symbol table input buffer - and set the variables that control fetching entries from it. - Reports an error if no data available. - This function can read past the end of the symbol table - (into the string table) but this does no harm. */ - -/* Reading symbol table has to be fast! Keep the followings as macros, rather - than functions. */ - -#define RECORD_MINIMAL_SYMBOL(NAME, ADDR, TYPE, SECTION, OBJFILE) \ -{ \ - char *namestr; \ - namestr = (NAME); \ - if (namestr[0] == '.') ++namestr; \ - prim_record_minimal_symbol_and_info (namestr, (ADDR), (TYPE), \ - (char *)NULL, (SECTION), (OBJFILE)); \ - misc_func_recorded = 1; \ -} - - -/* xcoff has static blocks marked in `.bs', `.es' pairs. They cannot be - nested. At any given time, a symbol can only be in one static block. - This is the base address of current static block, zero if non exists. */ - -static int static_block_base = 0; - -/* Section number for the current static block. */ - -static int static_block_section = -1; - -/* true if space for symbol name has been allocated. */ - -static int symname_alloced = 0; - -/* Next symbol to read. Pointer into raw seething symbol table. */ - -static char *raw_symbol; - -/* This is the function which stabsread.c calls to get symbol - continuations. */ -static char * -xcoff_next_symbol_text (objfile) - struct objfile *objfile; -{ - struct internal_syment symbol; - static struct complaint msg = - {"Unexpected symbol continuation", 0, 0}; - char *retval; - /* FIXME: is this the same as the passed arg? */ - objfile = this_symtab_psymtab->objfile; - - bfd_coff_swap_sym_in (objfile->obfd, raw_symbol, &symbol); - if (symbol.n_zeroes) - { - complain (&msg); - - /* Return something which points to '\0' and hope the symbol reading - code does something reasonable. */ - retval = ""; - } - else if (symbol.n_sclass & 0x80) - { - retval = - ((struct coff_symfile_info *)objfile->sym_private)->debugsec - + symbol.n_offset; - raw_symbol += - coff_data (objfile->obfd)->local_symesz; - ++symnum; - } - else - { - complain (&msg); - - /* Return something which points to '\0' and hope the symbol reading - code does something reasonable. */ - retval = ""; - } - return retval; -} - -/* Read symbols for a given partial symbol table. */ - -static void -read_xcoff_symtab (pst) - struct partial_symtab *pst; -{ - struct objfile *objfile = pst->objfile; - bfd *abfd = objfile->obfd; - char *raw_auxptr; /* Pointer to first raw aux entry for sym */ - char *strtbl = ((struct coff_symfile_info *)objfile->sym_private)->strtbl; - char *debugsec = - ((struct coff_symfile_info *)objfile->sym_private)->debugsec; - - struct internal_syment symbol[1]; - union internal_auxent main_aux; - struct coff_symbol cs[1]; - CORE_ADDR file_start_addr = 0; - CORE_ADDR file_end_addr = 0; - - int next_file_symnum = -1; - unsigned int max_symnum; - int just_started = 1; - int depth = 0; - int fcn_start_addr = 0; - - struct coff_symbol fcn_stab_saved; - - /* fcn_cs_saved is global because process_xcoff_symbol needs it. */ - union internal_auxent fcn_aux_saved; - struct context_stack *new; - - char *filestring = " _start_ "; /* Name of the current file. */ - - char *last_csect_name; /* last seen csect's name and value */ - CORE_ADDR last_csect_val; - int last_csect_sec; - - this_symtab_psymtab = pst; - - /* Get the appropriate COFF "constants" related to the file we're - handling. */ - local_symesz = coff_data (abfd)->local_symesz; - - last_source_file = NULL; - last_csect_name = 0; - last_csect_val = 0; - - start_stabs (); - start_symtab (filestring, (char *)NULL, file_start_addr); - symnum = ((struct symloc *)pst->read_symtab_private)->first_symnum; - max_symnum = - symnum + ((struct symloc *)pst->read_symtab_private)->numsyms; - first_object_file_end = 0; - - raw_symbol = - ((struct coff_symfile_info *) objfile->sym_private)->symtbl - + symnum * local_symesz; - - while (symnum < max_symnum) - { - - QUIT; /* make this command interruptable. */ - - /* READ_ONE_SYMBOL (symbol, cs, symname_alloced); */ - /* read one symbol into `cs' structure. After processing the - whole symbol table, only string table will be kept in memory, - symbol table and debug section of xcoff will be freed. Thus - we can mark symbols with names in string table as - `alloced'. */ - { - int ii; - - /* Swap and align the symbol into a reasonable C structure. */ - bfd_coff_swap_sym_in (abfd, raw_symbol, symbol); - - cs->c_symnum = symnum; - cs->c_naux = symbol->n_numaux; - if (symbol->n_zeroes) - { - symname_alloced = 0; - /* We must use the original, unswapped, name here so the name field - pointed to by cs->c_name will persist throughout xcoffread. If - we use the new field, it gets overwritten for each symbol. */ - cs->c_name = ((struct external_syment *)raw_symbol)->e.e_name; - /* If it's exactly E_SYMNMLEN characters long it isn't - '\0'-terminated. */ - if (cs->c_name[E_SYMNMLEN - 1] != '\0') - { - char *p; - p = obstack_alloc (&objfile->symbol_obstack, E_SYMNMLEN + 1); - strncpy (p, cs->c_name, E_SYMNMLEN); - p[E_SYMNMLEN] = '\0'; - cs->c_name = p; - symname_alloced = 1; - } - } - else if (symbol->n_sclass & 0x80) - { - cs->c_name = debugsec + symbol->n_offset; - symname_alloced = 0; - } - else - { - /* in string table */ - cs->c_name = strtbl + (int)symbol->n_offset; - symname_alloced = 1; - } - cs->c_value = symbol->n_value; - cs->c_sclass = symbol->n_sclass; - cs->c_secnum = symbol->n_scnum; - cs->c_type = (unsigned)symbol->n_type; - - raw_symbol += coff_data (abfd)->local_symesz; - ++symnum; - - /* Save addr of first aux entry. */ - raw_auxptr = raw_symbol; - - /* Skip all the auxents associated with this symbol. */ - for (ii = symbol->n_numaux; ii; --ii) - { - raw_symbol += coff_data (abfd)->local_auxesz; - ++symnum; - } - } - - /* if symbol name starts with ".$" or "$", ignore it. */ - if (cs->c_name[0] == '$' - || (cs->c_name[1] == '$' && cs->c_name[0] == '.')) - continue; - - if (cs->c_symnum == next_file_symnum && cs->c_sclass != C_FILE) - { - if (last_source_file) - { - pst->symtab = - end_symtab (cur_src_end_addr, objfile, SECT_OFF_TEXT); - end_stabs (); - } - - start_stabs (); - start_symtab ("_globals_", (char *)NULL, (CORE_ADDR)0); - cur_src_end_addr = first_object_file_end; - /* done with all files, everything from here on is globals */ - } - - /* if explicitly specified as a function, treat is as one. */ - if (ISFCN(cs->c_type) && cs->c_sclass != C_TPDEF) - { - bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type, cs->c_sclass, - 0, cs->c_naux, &main_aux); - goto function_entry_point; - } - - if ((cs->c_sclass == C_EXT || cs->c_sclass == C_HIDEXT) - && cs->c_naux == 1) - { - /* Dealing with a symbol with a csect entry. */ - -#define CSECT(PP) ((PP)->x_csect) -#define CSECT_LEN(PP) (CSECT(PP).x_scnlen.l) -#define CSECT_ALIGN(PP) (SMTYP_ALIGN(CSECT(PP).x_smtyp)) -#define CSECT_SMTYP(PP) (SMTYP_SMTYP(CSECT(PP).x_smtyp)) -#define CSECT_SCLAS(PP) (CSECT(PP).x_smclas) - - /* Convert the auxent to something we can access. */ - bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type, cs->c_sclass, - 0, cs->c_naux, &main_aux); - - switch (CSECT_SMTYP (&main_aux)) - { - - case XTY_ER: - /* Ignore all external references. */ - continue; - - case XTY_SD: - /* A section description. */ - { - switch (CSECT_SCLAS (&main_aux)) - { - - case XMC_PR: - { - - /* A program csect is seen. We have to allocate one - symbol table for each program csect. Normally gdb - prefers one symtab for each source file. In case - of AIX, one source file might include more than one - [PR] csect, and they don't have to be adjacent in - terms of the space they occupy in memory. Thus, one - single source file might get fragmented in the - memory and gdb's file start and end address - approach does not work! GCC (and I think xlc) seem - to put all the code in the unnamed program csect. */ - - if (last_csect_name) - { - complete_symtab (filestring, file_start_addr); - cur_src_end_addr = file_end_addr; - end_symtab (file_end_addr, objfile, SECT_OFF_TEXT); - end_stabs (); - start_stabs (); - /* Give all csects for this source file the same - name. */ - start_symtab (filestring, NULL, (CORE_ADDR)0); - } - - /* If this is the very first csect seen, - basically `__start'. */ - if (just_started) - { - first_object_file_end - = cs->c_value + CSECT_LEN (&main_aux); - just_started = 0; - } - - file_start_addr = - cs->c_value + ANOFFSET (objfile->section_offsets, - SECT_OFF_TEXT); - file_end_addr = file_start_addr + CSECT_LEN (&main_aux); - - if (cs->c_name && cs->c_name[0] == '.') - { - last_csect_name = cs->c_name; - last_csect_val = cs->c_value; - last_csect_sec = secnum_to_section (cs->c_secnum, objfile); - } - } - continue; - - /* All other symbols are put into the minimal symbol - table only. */ - - case XMC_RW: - continue; - - case XMC_TC0: - continue; - - case XMC_TC: - continue; - - default: - /* Ignore the symbol. */ - continue; - } - } - break; - - case XTY_LD: - - switch (CSECT_SCLAS (&main_aux)) - { - case XMC_PR: - /* a function entry point. */ - function_entry_point: - - fcn_start_addr = cs->c_value; - - /* save the function header info, which will be used - when `.bf' is seen. */ - fcn_cs_saved = *cs; - fcn_aux_saved = main_aux; - continue; - - case XMC_GL: - /* shared library function trampoline code entry point. */ - continue; - - case XMC_DS: - /* The symbols often have the same names as debug symbols for - functions, and confuse lookup_symbol. */ - continue; - - default: - /* xlc puts each variable in a separate csect, so we get - an XTY_SD for each variable. But gcc puts several - variables in a csect, so that each variable only gets - an XTY_LD. This will typically be XMC_RW; I suspect - XMC_RO and XMC_BS might be possible too. - These variables are put in the minimal symbol table - only. */ - continue; - } - break; - - case XTY_CM: - /* Common symbols are put into the minimal symbol table only. */ - continue; - - default: - break; - } - } - - switch (cs->c_sclass) - { - - case C_FILE: - - /* c_value field contains symnum of next .file entry in table - or symnum of first global after last .file. */ - - next_file_symnum = cs->c_value; - - /* Complete symbol table for last object file containing - debugging information. */ - - /* Whether or not there was a csect in the previous file, we - have to call `end_stabs' and `start_stabs' to reset - type_vector, line_vector, etc. structures. */ - - complete_symtab (filestring, file_start_addr); - cur_src_end_addr = file_end_addr; - end_symtab (file_end_addr, objfile, SECT_OFF_TEXT); - end_stabs (); - - /* XCOFF, according to the AIX 3.2 documentation, puts the filename - in cs->c_name. But xlc 1.3.0.2 has decided to do things the - standard COFF way and put it in the auxent. We use the auxent if - the symbol is ".file" and an auxent exists, otherwise use the symbol - itself. Simple enough. */ - if (!strcmp (cs->c_name, ".file") && cs->c_naux > 0) - { - bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type, cs->c_sclass, - 0, cs->c_naux, &main_aux); - filestring = coff_getfilename (&main_aux, objfile); - } - else - filestring = cs->c_name; - - start_stabs (); - start_symtab (filestring, (char *)NULL, (CORE_ADDR)0); - last_csect_name = 0; - - /* reset file start and end addresses. A compilation unit with no text - (only data) should have zero file boundaries. */ - file_start_addr = file_end_addr = 0; - break; - - case C_FUN: - fcn_stab_saved = *cs; - break; - - case C_FCN: - if (STREQ (cs->c_name, ".bf")) - { - CORE_ADDR off = ANOFFSET (objfile->section_offsets, - SECT_OFF_TEXT); - bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type, cs->c_sclass, - 0, cs->c_naux, &main_aux); - - within_function = 1; - - new = push_context (0, fcn_start_addr + off); - - new->name = define_symbol - (fcn_cs_saved.c_value + off, - fcn_stab_saved.c_name, 0, 0, objfile); - if (new->name != NULL) - SYMBOL_SECTION (new->name) = SECT_OFF_TEXT; - } - else if (STREQ (cs->c_name, ".ef")) - { - - bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type, cs->c_sclass, - 0, cs->c_naux, &main_aux); - - /* The value of .ef is the address of epilogue code; - not useful for gdb. */ - /* { main_aux.x_sym.x_misc.x_lnsz.x_lnno - contains number of lines to '}' */ - - if (context_stack_depth <= 0) - { /* We attempted to pop an empty context stack */ - complain (&ef_complaint, cs->c_symnum); - within_function = 0; - break; - } - new = pop_context (); - /* Stack must be empty now. */ - if (context_stack_depth > 0 || new == NULL) - { - complain (&ef_complaint, cs->c_symnum); - within_function = 0; - break; - } - - finish_block (new->name, &local_symbols, new->old_blocks, - new->start_addr, - (fcn_cs_saved.c_value - + fcn_aux_saved.x_sym.x_misc.x_fsize - + ANOFFSET (objfile->section_offsets, - SECT_OFF_TEXT)), - objfile); - within_function = 0; - } - break; - - case C_BSTAT: - /* Begin static block. */ - { - struct internal_syment symbol; - - read_symbol (&symbol, cs->c_value); - static_block_base = symbol.n_value; - static_block_section = - secnum_to_section (symbol.n_scnum, objfile); - } - break; - - case C_ESTAT: - /* End of static block. */ - static_block_base = 0; - static_block_section = -1; - break; - - case C_ARG: - case C_REGPARM: - case C_REG: - case C_TPDEF: - case C_STRTAG: - case C_UNTAG: - case C_ENTAG: - { - static struct complaint msg = - {"Unrecognized storage class %d.", 0, 0}; - complain (&msg, cs->c_sclass); - } - break; - - case C_LABEL: - case C_NULL: - /* Ignore these. */ - break; - - case C_HIDEXT: - case C_STAT: - break; - - case C_BINCL: - /* beginning of include file */ - /* In xlc output, C_BINCL/C_EINCL pair doesn't show up in sorted - order. Thus, when wee see them, we might not know enough info - to process them. Thus, we'll be saving them into a table - (inclTable) and postpone their processing. */ - - record_include_begin (cs); - break; - - case C_EINCL: - /* End of include file. */ - /* See the comment after case C_BINCL. */ - record_include_end (cs); - break; - - case C_BLOCK: - if (STREQ (cs->c_name, ".bb")) - { - depth++; - new = push_context (depth, - (cs->c_value - + ANOFFSET (objfile->section_offsets, - SECT_OFF_TEXT))); - } - else if (STREQ (cs->c_name, ".eb")) - { - if (context_stack_depth <= 0) - { /* We attempted to pop an empty context stack */ - complain (&eb_complaint, cs->c_symnum); - break; - } - new = pop_context (); - if (depth-- != new->depth) - { - complain (&eb_complaint, cs->c_symnum); - break; - } - if (local_symbols && context_stack_depth > 0) - { - /* Make a block for the local symbols within. */ - finish_block (new->name, &local_symbols, new->old_blocks, - new->start_addr, - (cs->c_value - + ANOFFSET (objfile->section_offsets, - SECT_OFF_TEXT)), - objfile); - } - local_symbols = new->locals; - } - break; - - default: - process_xcoff_symbol (cs, objfile); - break; - } - } - - if (last_source_file) - { - struct symtab *s; - - complete_symtab (filestring, file_start_addr); - cur_src_end_addr = file_end_addr; - s = end_symtab (file_end_addr, objfile, SECT_OFF_TEXT); - /* When reading symbols for the last C_FILE of the objfile, try - to make sure that we set pst->symtab to the symtab for the - file, not to the _globals_ symtab. I'm not sure whether this - actually works right or when/if it comes up. */ - if (pst->symtab == NULL) - pst->symtab = s; - end_stabs (); - } -} - -#define SYMBOL_DUP(SYMBOL1, SYMBOL2) \ - (SYMBOL2) = (struct symbol *) \ - obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol)); \ - *(SYMBOL2) = *(SYMBOL1); - - -#define SYMNAME_ALLOC(NAME, ALLOCED) \ - (ALLOCED) ? (NAME) : obstack_copy0 (&objfile->symbol_obstack, (NAME), strlen (NAME)); - - -static struct type *func_symbol_type; -static struct type *var_symbol_type; - -/* process one xcoff symbol. */ - -static struct symbol * -process_xcoff_symbol (cs, objfile) - register struct coff_symbol *cs; - struct objfile *objfile; -{ - struct symbol onesymbol; - register struct symbol *sym = &onesymbol; - struct symbol *sym2 = NULL; - char *name, *pp; - - int sec; - CORE_ADDR off; - - if (cs->c_secnum < 0) - { - /* The value is a register number, offset within a frame, etc., - and does not get relocated. */ - off = 0; - sec = -1; - } - else - { - sec = secnum_to_section (cs->c_secnum, objfile); - off = ANOFFSET (objfile->section_offsets, sec); - } - - name = cs->c_name; - if (name[0] == '.') - ++name; - - memset (sym, '\0', sizeof (struct symbol)); - - /* default assumptions */ - SYMBOL_VALUE (sym) = cs->c_value + off; - SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE; - SYMBOL_SECTION (sym) = secnum_to_section (cs->c_secnum, objfile); - - if (ISFCN (cs->c_type)) - { - /* At this point, we don't know the type of the function. This - will be patched with the type from its stab entry later on in - patch_block_stabs (), unless the file was compiled without -g. */ - - SYMBOL_NAME (sym) = SYMNAME_ALLOC (name, symname_alloced); - SYMBOL_TYPE (sym) = func_symbol_type; - - SYMBOL_CLASS (sym) = LOC_BLOCK; - SYMBOL_DUP (sym, sym2); - - if (cs->c_sclass == C_EXT) - add_symbol_to_list (sym2, &global_symbols); - else if (cs->c_sclass == C_HIDEXT || cs->c_sclass == C_STAT) - add_symbol_to_list (sym2, &file_symbols); - } - else - { - /* In case we can't figure out the type, provide default. */ - SYMBOL_TYPE (sym) = var_symbol_type; - - switch (cs->c_sclass) - { -#if 0 - /* The values of functions and global symbols are now resolved - via the global_sym_chain in stabsread.c. */ - case C_FUN: - if (fcn_cs_saved.c_sclass == C_EXT) - add_stab_to_list (name, &global_stabs); - else - add_stab_to_list (name, &file_stabs); - break; - - case C_GSYM: - add_stab_to_list (name, &global_stabs); - break; -#endif - - case C_BCOMM: - common_block_start (cs->c_name, objfile); - break; - - case C_ECOMM: - common_block_end (objfile); - break; - - default: - complain (&storclass_complaint, cs->c_sclass); - /* FALLTHROUGH */ - - case C_DECL: - case C_PSYM: - case C_RPSYM: - case C_ECOML: - case C_LSYM: - case C_RSYM: - case C_GSYM: - - { - sym = define_symbol (cs->c_value + off, cs->c_name, 0, 0, objfile); - if (sym != NULL) - { - SYMBOL_SECTION (sym) = sec; - } - return sym; - } - - case C_STSYM: - - /* For xlc (not GCC), the 'V' symbol descriptor is used for - all statics and we need to distinguish file-scope versus - function-scope using within_function. We do this by - changing the string we pass to define_symbol to use 'S' - where we need to, which is not necessarily super-clean, - but seems workable enough. */ - - if (*name == ':' || (pp = (char *) strchr(name, ':')) == NULL) - return NULL; - - ++pp; - if (*pp == 'V' && !within_function) - *pp = 'S'; - sym = define_symbol ((cs->c_value - + ANOFFSET (objfile->section_offsets, - static_block_section)), - cs->c_name, 0, 0, objfile); - if (sym != NULL) - { - SYMBOL_VALUE (sym) += static_block_base; - SYMBOL_SECTION (sym) = static_block_section; - } - return sym; - - } - } - return sym2; -} - -/* Extract the file name from the aux entry of a C_FILE symbol. Return - only the last component of the name. Result is in static storage and - is only good for temporary use. */ - -static char * -coff_getfilename (aux_entry, objfile) - union internal_auxent *aux_entry; - struct objfile *objfile; -{ - static char buffer[BUFSIZ]; - register char *temp; - char *result; - - if (aux_entry->x_file.x_n.x_zeroes == 0) - strcpy (buffer, - ((struct coff_symfile_info *)objfile->sym_private)->strtbl - + aux_entry->x_file.x_n.x_offset); - else - { - strncpy (buffer, aux_entry->x_file.x_fname, FILNMLEN); - buffer[FILNMLEN] = '\0'; - } - result = buffer; - - /* FIXME: We should not be throwing away the information about what - directory. It should go into dirname of the symtab, or some such - place. */ - if ((temp = strrchr (result, '/')) != NULL) - result = temp + 1; - return (result); -} - -/* Set *SYMBOL to symbol number symno in symtbl. */ -static void -read_symbol (symbol, symno) - struct internal_syment *symbol; - int symno; -{ - int nsyms = - ((struct coff_symfile_info *)this_symtab_psymtab->objfile->sym_private) - ->symtbl_num_syms; - char *stbl = - ((struct coff_symfile_info *)this_symtab_psymtab->objfile->sym_private) - ->symtbl; - if (symno < 0 || symno >= nsyms) - { - static struct complaint msg = - {"Invalid symbol offset", 0, 0}; - complain (&msg); - symbol->n_value = 0; - symbol->n_scnum = -1; - return; - } - bfd_coff_swap_sym_in (this_symtab_psymtab->objfile->obfd, - stbl + (symno*local_symesz), - symbol); -} - -/* Get value corresponding to symbol number symno in symtbl. */ - -static int -read_symbol_nvalue (symno) - int symno; -{ - struct internal_syment symbol[1]; - - read_symbol (symbol, symno); - return symbol->n_value; -} - - -/* Find the address of the function corresponding to symno, where - symno is the symbol pointed to by the linetable. */ - -static int -read_symbol_lineno (symno) - int symno; -{ - int nsyms = - ((struct coff_symfile_info *)this_symtab_psymtab->objfile->sym_private) - ->symtbl_num_syms; - char *stbl = - ((struct coff_symfile_info *)this_symtab_psymtab->objfile->sym_private) - ->symtbl; - struct internal_syment symbol[1]; - union internal_auxent main_aux[1]; - - if (symno < 0) - { - complain (&bf_notfound_complaint); - return 0; - } - - /* Note that just searching for a short distance (e.g. 50 symbols) - is not enough, at least in the following case. - - .extern foo - [many .stabx entries] - [a few functions, referring to foo] - .globl foo - .bf - - What happens here is that the assembler moves the .stabx entries - to right before the ".bf" for foo, but the symbol for "foo" is before - all the stabx entries. See PR gdb/2222. */ - - /* Maintaining a table of .bf entries might be preferable to this search. - If I understand things correctly it would need to be done only for - the duration of a single psymtab to symtab conversion. */ - while (symno < nsyms) - { - bfd_coff_swap_sym_in (symfile_bfd, - stbl + (symno * local_symesz), symbol); - if (symbol->n_sclass == C_FCN && STREQ (symbol->n_name, ".bf")) - goto gotit; - symno += symbol->n_numaux + 1; - } - - complain (&bf_notfound_complaint); - return 0; - -gotit: - /* take aux entry and return its lineno */ - symno++; - bfd_coff_swap_aux_in (this_symtab_psymtab->objfile->obfd, - stbl + symno * local_symesz, - symbol->n_type, symbol->n_sclass, - 0, symbol->n_numaux, main_aux); - - return main_aux->x_sym.x_misc.x_lnsz.x_lnno; -} - -/* Support for line number handling */ - -/* This function is called for every section; it finds the outer limits - * of the line table (minimum and maximum file offset) so that the - * mainline code can read the whole thing for efficiency. - */ -static void -find_linenos (abfd, asect, vpinfo) - bfd *abfd; - sec_ptr asect; - PTR vpinfo; -{ - struct coff_symfile_info *info; - int size, count; - file_ptr offset, maxoff; - - count = asect->lineno_count; - - if (!STREQ (asect->name, ".text") || count == 0) - return; - - size = count * coff_data (abfd)->local_linesz; - info = (struct coff_symfile_info *)vpinfo; - offset = asect->line_filepos; - maxoff = offset + size; - - if (offset < info->min_lineno_offset || info->min_lineno_offset == 0) - info->min_lineno_offset = offset; - - if (maxoff > info->max_lineno_offset) - info->max_lineno_offset = maxoff; -} - -static void xcoff_psymtab_to_symtab_1 PARAMS ((struct partial_symtab *)); - -static void -xcoff_psymtab_to_symtab_1 (pst) - struct partial_symtab *pst; -{ - struct cleanup *old_chain; - int i; - - if (!pst) - return; - - if (pst->readin) - { - fprintf_unfiltered - (gdb_stderr, "Psymtab for %s already read in. Shouldn't happen.\n", - pst->filename); - return; - } - - /* Read in all partial symtabs on which this one is dependent */ - for (i = 0; i < pst->number_of_dependencies; i++) - if (!pst->dependencies[i]->readin) - { - /* Inform about additional files that need to be read in. */ - if (info_verbose) - { - fputs_filtered (" ", gdb_stdout); - wrap_here (""); - fputs_filtered ("and ", gdb_stdout); - wrap_here (""); - printf_filtered ("%s...", pst->dependencies[i]->filename); - wrap_here (""); /* Flush output */ - gdb_flush (gdb_stdout); - } - xcoff_psymtab_to_symtab_1 (pst->dependencies[i]); - } - - if (((struct symloc *)pst->read_symtab_private)->numsyms != 0) - { - /* Init stuff necessary for reading in symbols. */ - stabsread_init (); - buildsym_init (); - old_chain = make_cleanup (really_free_pendings, 0); - - read_xcoff_symtab (pst); - sort_symtab_syms (pst->symtab); - - do_cleanups (old_chain); - } - - pst->readin = 1; -} - -static void xcoff_psymtab_to_symtab PARAMS ((struct partial_symtab *)); - -/* Read in all of the symbols for a given psymtab for real. - Be verbose about it if the user wants that. */ - -static void -xcoff_psymtab_to_symtab (pst) - struct partial_symtab *pst; -{ - bfd *sym_bfd; - - if (!pst) - return; - - if (pst->readin) - { - fprintf_unfiltered - (gdb_stderr, "Psymtab for %s already read in. Shouldn't happen.\n", - pst->filename); - return; - } - - if (((struct symloc *)pst->read_symtab_private)->numsyms != 0 - || pst->number_of_dependencies) - { - /* Print the message now, before reading the string table, - to avoid disconcerting pauses. */ - if (info_verbose) - { - printf_filtered ("Reading in symbols for %s...", pst->filename); - gdb_flush (gdb_stdout); - } - - sym_bfd = pst->objfile->obfd; - - next_symbol_text_func = xcoff_next_symbol_text; - - xcoff_psymtab_to_symtab_1 (pst); - - /* Match with global symbols. This only needs to be done once, - after all of the symtabs and dependencies have been read in. */ - scan_file_globals (pst->objfile); - - /* Finish up the debug error message. */ - if (info_verbose) - printf_filtered ("done.\n"); - } -} - -static void -xcoff_new_init (objfile) - struct objfile *objfile; -{ - stabsread_new_init (); - buildsym_new_init (); -} - -/* Do initialization in preparation for reading symbols from OBJFILE. - - We will only be called if this is an XCOFF or XCOFF-like file. - BFD handles figuring out the format of the file, and code in symfile.c - uses BFD's determination to vector to us. */ - -static void -xcoff_symfile_init (objfile) - struct objfile *objfile; -{ - /* Allocate struct to keep track of the symfile */ - objfile -> sym_private = xmmalloc (objfile -> md, - sizeof (struct coff_symfile_info)); - - /* XCOFF objects may be reordered, so set OBJF_REORDERED. If we - find this causes a significant slowdown in gdb then we could - set it in the debug symbol readers only when necessary. */ - objfile->flags |= OBJF_REORDERED; - - init_entry_point_info (objfile); -} - -/* Perform any local cleanups required when we are done with a particular - objfile. I.E, we are in the process of discarding all symbol information - for an objfile, freeing up all memory held for it, and unlinking the - objfile struct from the global list of known objfiles. */ - -static void -xcoff_symfile_finish (objfile) - struct objfile *objfile; -{ - if (objfile -> sym_private != NULL) - { - mfree (objfile -> md, objfile -> sym_private); - } - - /* Start with a fresh include table for the next objfile. */ - if (inclTable) - { - free (inclTable); - inclTable = NULL; - } - inclIndx = inclLength = inclDepth = 0; -} - - -static void -init_stringtab (abfd, offset, objfile) - bfd *abfd; - file_ptr offset; - struct objfile *objfile; -{ - long length; - int val; - unsigned char lengthbuf[4]; - char *strtbl; - - ((struct coff_symfile_info *)objfile->sym_private)->strtbl = NULL; - - if (bfd_seek (abfd, offset, SEEK_SET) < 0) - error ("cannot seek to string table in %s: %s", - bfd_get_filename (abfd), bfd_errmsg (bfd_get_error ())); - - val = bfd_read ((char *)lengthbuf, 1, sizeof lengthbuf, abfd); - length = bfd_h_get_32 (abfd, lengthbuf); - - /* If no string table is needed, then the file may end immediately - after the symbols. Just return with `strtbl' set to NULL. */ - - if (val != sizeof lengthbuf || length < sizeof lengthbuf) - return; - - /* Allocate string table from symbol_obstack. We will need this table - as long as we have its symbol table around. */ - - strtbl = (char *) obstack_alloc (&objfile->symbol_obstack, length); - ((struct coff_symfile_info *)objfile->sym_private)->strtbl = strtbl; - - /* Copy length buffer, the first byte is usually zero and is - used for stabs with a name length of zero. */ - memcpy (strtbl, lengthbuf, sizeof lengthbuf); - if (length == sizeof lengthbuf) - return; - - val = bfd_read (strtbl + sizeof lengthbuf, 1, length - sizeof lengthbuf, - abfd); - - if (val != length - sizeof lengthbuf) - error ("cannot read string table from %s: %s", - bfd_get_filename (abfd), bfd_errmsg (bfd_get_error ())); - if (strtbl[length - 1] != '\0') - error ("bad symbol file: string table does not end with null character"); - - return; -} - -/* If we have not yet seen a function for this psymtab, this is 0. If we - have seen one, it is the offset in the line numbers of the line numbers - for the psymtab. */ -static unsigned int first_fun_line_offset; - -static struct partial_symtab *xcoff_start_psymtab - PARAMS ((struct objfile *, struct section_offsets *, char *, int, - struct partial_symbol **, struct partial_symbol **)); - -/* Allocate and partially fill a partial symtab. It will be - completely filled at the end of the symbol list. - - SYMFILE_NAME is the name of the symbol-file we are reading from, and ADDR - is the address relative to which its symbols are (incremental) or 0 - (normal). */ - -static struct partial_symtab * -xcoff_start_psymtab (objfile, section_offsets, - filename, first_symnum, global_syms, static_syms) - struct objfile *objfile; - struct section_offsets *section_offsets; - char *filename; - int first_symnum; - struct partial_symbol **global_syms; - struct partial_symbol **static_syms; -{ - struct partial_symtab *result = - start_psymtab_common (objfile, section_offsets, - filename, - /* We fill in textlow later. */ - 0, - global_syms, static_syms); - - result->read_symtab_private = (char *) - obstack_alloc (&objfile -> psymbol_obstack, sizeof (struct symloc)); - ((struct symloc *)result->read_symtab_private)->first_symnum = first_symnum; - result->read_symtab = xcoff_psymtab_to_symtab; - - /* Deduce the source language from the filename for this psymtab. */ - psymtab_language = deduce_language_from_filename (filename); - - return result; -} - -static struct partial_symtab *xcoff_end_psymtab - PARAMS ((struct partial_symtab *, char **, int, int, - struct partial_symtab **, int)); - -/* Close off the current usage of PST. - Returns PST, or NULL if the partial symtab was empty and thrown away. - - CAPPING_SYMBOL_NUMBER is the end of pst (exclusive). - - INCLUDE_LIST, NUM_INCLUDES, DEPENDENCY_LIST, and NUMBER_DEPENDENCIES - are the information for includes and dependencies. */ - -static struct partial_symtab * -xcoff_end_psymtab (pst, include_list, num_includes, capping_symbol_number, - dependency_list, number_dependencies) - struct partial_symtab *pst; - char **include_list; - int num_includes; - int capping_symbol_number; - struct partial_symtab **dependency_list; - int number_dependencies; -{ - int i; - struct objfile *objfile = pst -> objfile; - - if (capping_symbol_number != -1) - ((struct symloc *)pst->read_symtab_private)->numsyms = - capping_symbol_number - - ((struct symloc *)pst->read_symtab_private)->first_symnum; - ((struct symloc *)pst->read_symtab_private)->lineno_off = - first_fun_line_offset; - first_fun_line_offset = 0; - pst->n_global_syms = - objfile->global_psymbols.next - (objfile->global_psymbols.list + pst->globals_offset); - pst->n_static_syms = - objfile->static_psymbols.next - (objfile->static_psymbols.list + pst->statics_offset); - - pst->number_of_dependencies = number_dependencies; - if (number_dependencies) - { - pst->dependencies = (struct partial_symtab **) - obstack_alloc (&objfile->psymbol_obstack, - number_dependencies * sizeof (struct partial_symtab *)); - memcpy (pst->dependencies, dependency_list, - number_dependencies * sizeof (struct partial_symtab *)); - } - else - pst->dependencies = 0; - - for (i = 0; i < num_includes; i++) - { - struct partial_symtab *subpst = - allocate_psymtab (include_list[i], objfile); - - subpst->section_offsets = pst->section_offsets; - subpst->read_symtab_private = - (char *) obstack_alloc (&objfile->psymbol_obstack, - sizeof (struct symloc)); - ((struct symloc *)subpst->read_symtab_private)->first_symnum = 0; - ((struct symloc *)subpst->read_symtab_private)->numsyms = 0; - subpst->textlow = 0; - subpst->texthigh = 0; - - /* We could save slight bits of space by only making one of these, - shared by the entire set of include files. FIXME-someday. */ - subpst->dependencies = (struct partial_symtab **) - obstack_alloc (&objfile->psymbol_obstack, - sizeof (struct partial_symtab *)); - subpst->dependencies[0] = pst; - subpst->number_of_dependencies = 1; - - subpst->globals_offset = - subpst->n_global_syms = - subpst->statics_offset = - subpst->n_static_syms = 0; - - subpst->readin = 0; - subpst->symtab = 0; - subpst->read_symtab = pst->read_symtab; - } - - sort_pst_symbols (pst); - - /* If there is already a psymtab or symtab for a file of this name, - remove it. (If there is a symtab, more drastic things also - happen.) This happens in VxWorks. */ - free_named_symtabs (pst->filename); - - if (num_includes == 0 - && number_dependencies == 0 - && pst->n_global_syms == 0 - && pst->n_static_syms == 0) - { - /* Throw away this psymtab, it's empty. We can't deallocate it, since - it is on the obstack, but we can forget to chain it on the list. */ - /* Empty psymtabs happen as a result of header files which don't have - any symbols in them. There can be a lot of them. */ - struct partial_symtab *prev_pst; - - /* First, snip it out of the psymtab chain */ - - if (pst->objfile->psymtabs == pst) - pst->objfile->psymtabs = pst->next; - else - for (prev_pst = pst->objfile->psymtabs; prev_pst; prev_pst = pst->next) - if (prev_pst->next == pst) - prev_pst->next = pst->next; - - /* Next, put it on a free list for recycling */ - - pst->next = pst->objfile->free_psymtabs; - pst->objfile->free_psymtabs = pst; - - /* Indicate that psymtab was thrown away. */ - pst = (struct partial_symtab *)NULL; - } - return pst; -} - -static void swap_sym PARAMS ((struct internal_syment *, - union internal_auxent *, char **, char **, - unsigned int *, - struct objfile *)); - -/* Swap raw symbol at *RAW and put the name in *NAME, the symbol in - *SYMBOL, the first auxent in *AUX. Advance *RAW and *SYMNUMP over - the symbol and its auxents. */ - -static void -swap_sym (symbol, aux, name, raw, symnump, objfile) - struct internal_syment *symbol; - union internal_auxent *aux; - char **name; - char **raw; - unsigned int *symnump; - struct objfile *objfile; -{ - bfd_coff_swap_sym_in (objfile->obfd, *raw, symbol); - if (symbol->n_zeroes) - { - /* If it's exactly E_SYMNMLEN characters long it isn't - '\0'-terminated. */ - if (symbol->n_name[E_SYMNMLEN - 1] != '\0') - { - /* FIXME: wastes memory for symbols which we don't end up putting - into the minimal symbols. */ - char *p; - p = obstack_alloc (&objfile->psymbol_obstack, E_SYMNMLEN + 1); - strncpy (p, symbol->n_name, E_SYMNMLEN); - p[E_SYMNMLEN] = '\0'; - *name = p; - } - else - /* Point to the unswapped name as that persists as long as the - objfile does. */ - *name = ((struct external_syment *)*raw)->e.e_name; - } - else if (symbol->n_sclass & 0x80) - { - *name = ((struct coff_symfile_info *)objfile->sym_private)->debugsec - + symbol->n_offset; - } - else - { - *name = ((struct coff_symfile_info *)objfile->sym_private)->strtbl - + symbol->n_offset; - } - ++*symnump; - *raw += coff_data (objfile->obfd)->local_symesz; - if (symbol->n_numaux > 0) - { - bfd_coff_swap_aux_in (objfile->obfd, *raw, symbol->n_type, - symbol->n_sclass, 0, symbol->n_numaux, aux); - - *symnump += symbol->n_numaux; - *raw += coff_data (objfile->obfd)->local_symesz * symbol->n_numaux; - } -} - -static void -scan_xcoff_symtab (section_offsets, objfile) - struct section_offsets *section_offsets; - struct objfile *objfile; -{ - int toc_offset = 0; /* toc offset value in data section. */ - char *filestring = NULL; - - char *namestring; - int past_first_source_file = 0; - bfd *abfd; - unsigned int nsyms; - - /* Current partial symtab */ - struct partial_symtab *pst; - - /* List of current psymtab's include files */ - char **psymtab_include_list; - int includes_allocated; - int includes_used; - - /* Index within current psymtab dependency list */ - struct partial_symtab **dependency_list; - int dependencies_used, dependencies_allocated; - - char *sraw_symbol; - struct internal_syment symbol; - union internal_auxent main_aux; - unsigned int ssymnum; - - char *last_csect_name = NULL; /* last seen csect's name and value */ - CORE_ADDR last_csect_val = 0; - int last_csect_sec = 0; - int misc_func_recorded = 0; /* true if any misc. function */ - - pst = (struct partial_symtab *) 0; - - includes_allocated = 30; - includes_used = 0; - psymtab_include_list = (char **) alloca (includes_allocated * - sizeof (char *)); - - dependencies_allocated = 30; - dependencies_used = 0; - dependency_list = - (struct partial_symtab **) alloca (dependencies_allocated * - sizeof (struct partial_symtab *)); - - last_source_file = NULL; - - abfd = objfile->obfd; - - sraw_symbol = ((struct coff_symfile_info *)objfile->sym_private)->symtbl; - nsyms = ((struct coff_symfile_info *)objfile->sym_private)->symtbl_num_syms; - ssymnum = 0; - while (ssymnum < nsyms) - { - int sclass = ((struct external_syment *)sraw_symbol)->e_sclass[0] & 0xff; - /* This is the type we pass to partial-stab.h. A less kludgy solution - would be to break out partial-stab.h into its various parts--shuffle - off the DBXREAD_ONLY stuff to dbxread.c, and make separate - pstab-norm.h (for most types), pstab-sol.h (for N_SOL), etc. */ - int stype; - - QUIT; - - switch (sclass) - { - case C_EXT: - case C_HIDEXT: - { - /* The CSECT auxent--always the last auxent. */ - union internal_auxent csect_aux; - unsigned int symnum_before = ssymnum; - - swap_sym (&symbol, &main_aux, &namestring, &sraw_symbol, - &ssymnum, objfile); - if (symbol.n_numaux > 1) - { - bfd_coff_swap_aux_in - (objfile->obfd, - sraw_symbol - coff_data(abfd)->local_symesz, - symbol.n_type, - symbol.n_sclass, - symbol.n_numaux - 1, - symbol.n_numaux, - &csect_aux); - } - else - csect_aux = main_aux; - - /* If symbol name starts with ".$" or "$", ignore it. */ - if (namestring[0] == '$' - || (namestring[0] == '.' && namestring[1] == '$')) - break; - - switch (csect_aux.x_csect.x_smtyp & 0x7) - { - case XTY_SD: - switch (csect_aux.x_csect.x_smclas) - { - case XMC_PR: - if (last_csect_name) - { - /* If no misc. function recorded in the last - seen csect, enter it as a function. This - will take care of functions like strcmp() - compiled by xlc. */ - - if (!misc_func_recorded) - { - RECORD_MINIMAL_SYMBOL - (last_csect_name, last_csect_val, - mst_text, last_csect_sec, - objfile); - } - - if (pst != NULL) - { - /* We have to allocate one psymtab for - each program csect, because their text - sections need not be adjacent. */ - xcoff_end_psymtab - (pst, psymtab_include_list, - includes_used, - symnum_before, - dependency_list, dependencies_used); - includes_used = 0; - dependencies_used = 0; - /* Give all psymtabs for this source file the same - name. */ - pst = xcoff_start_psymtab - (objfile, section_offsets, - filestring, - symnum_before, - objfile->global_psymbols.next, - objfile->static_psymbols.next); - } - } - if (namestring && namestring[0] == '.') - { - last_csect_name = namestring; - last_csect_val = symbol.n_value; - last_csect_sec = - secnum_to_section (symbol.n_scnum, objfile); - } - if (pst != NULL) - { - CORE_ADDR highval = - symbol.n_value + csect_aux.x_csect.x_scnlen.l; - if (highval > pst->texthigh) - pst->texthigh = highval; - if (pst->textlow == 0 || symbol.n_value < pst->textlow) - pst->textlow = symbol.n_value; - } - misc_func_recorded = 0; - break; - - case XMC_RW: - /* Data variables are recorded in the minimal symbol - table, except for section symbols. */ - if (*namestring != '.') - prim_record_minimal_symbol_and_info - (namestring, symbol.n_value, - sclass == C_HIDEXT ? mst_file_data : mst_data, - NULL, secnum_to_section (symbol.n_scnum, objfile), - objfile); - break; - - case XMC_TC0: - if (toc_offset) - warning ("More than one XMC_TC0 symbol found."); - toc_offset = symbol.n_value; - break; - - case XMC_TC: - /* These symbols tell us where the TOC entry for a - variable is, not the variable itself. */ - break; - - default: - break; - } - break; - - case XTY_LD: - switch (csect_aux.x_csect.x_smclas) - { - case XMC_PR: - /* A function entry point. */ - - if (first_fun_line_offset == 0 && symbol.n_numaux > 1) - first_fun_line_offset = - main_aux.x_sym.x_fcnary.x_fcn.x_lnnoptr; - RECORD_MINIMAL_SYMBOL - (namestring, symbol.n_value, - sclass == C_HIDEXT ? mst_file_text : mst_text, - secnum_to_section (symbol.n_scnum, objfile), - objfile); - break; - - case XMC_GL: - /* shared library function trampoline code entry - point. */ - - /* record trampoline code entries as - mst_solib_trampoline symbol. When we lookup mst - symbols, we will choose mst_text over - mst_solib_trampoline. */ - RECORD_MINIMAL_SYMBOL - (namestring, symbol.n_value, - mst_solib_trampoline, - secnum_to_section (symbol.n_scnum, objfile), - objfile); - break; - - case XMC_DS: - /* The symbols often have the same names as - debug symbols for functions, and confuse - lookup_symbol. */ - break; - - default: - - /* xlc puts each variable in a separate csect, - so we get an XTY_SD for each variable. But - gcc puts several variables in a csect, so - that each variable only gets an XTY_LD. We - still need to record them. This will - typically be XMC_RW; I suspect XMC_RO and - XMC_BS might be possible too. */ - if (*namestring != '.') - prim_record_minimal_symbol_and_info - (namestring, symbol.n_value, - sclass == C_HIDEXT ? mst_file_data : mst_data, - NULL, secnum_to_section (symbol.n_scnum, objfile), - objfile); - break; - } - break; - - case XTY_CM: - switch (csect_aux.x_csect.x_smclas) - { - case XMC_RW: - case XMC_BS: - /* Common variables are recorded in the minimal symbol - table, except for section symbols. */ - if (*namestring != '.') - prim_record_minimal_symbol_and_info - (namestring, symbol.n_value, - sclass == C_HIDEXT ? mst_file_bss : mst_bss, - NULL, secnum_to_section (symbol.n_scnum, objfile), - objfile); - break; - } - break; - - default: - break; - } - } - break; - case C_FILE: - { - unsigned int symnum_before; - - symnum_before = ssymnum; - swap_sym (&symbol, &main_aux, &namestring, &sraw_symbol, - &ssymnum, objfile); - - /* See if the last csect needs to be recorded. */ - - if (last_csect_name && !misc_func_recorded) - { - - /* If no misc. function recorded in the last seen csect, enter - it as a function. This will take care of functions like - strcmp() compiled by xlc. */ - - RECORD_MINIMAL_SYMBOL - (last_csect_name, last_csect_val, - mst_text, last_csect_sec, objfile); - } - - if (pst) - { - xcoff_end_psymtab (pst, psymtab_include_list, includes_used, - symnum_before, - dependency_list, dependencies_used); - includes_used = 0; - dependencies_used = 0; - } - first_fun_line_offset = 0; - - /* XCOFF, according to the AIX 3.2 documentation, puts the - filename in cs->c_name. But xlc 1.3.0.2 has decided to - do things the standard COFF way and put it in the auxent. - We use the auxent if the symbol is ".file" and an auxent - exists, otherwise use the symbol itself. */ - if (!strcmp (namestring, ".file") && symbol.n_numaux > 0) - { - filestring = coff_getfilename (&main_aux, objfile); - } - else - filestring = namestring; - - pst = xcoff_start_psymtab (objfile, section_offsets, - filestring, - symnum_before, - objfile->global_psymbols.next, - objfile->static_psymbols.next); - last_csect_name = NULL; - } - break; - - default: - { - static struct complaint msg = - {"Storage class %d not recognized during scan", 0, 0}; - complain (&msg, sclass); - } - /* FALLTHROUGH */ - - /* C_FCN is .bf and .ef symbols. I think it is sufficient - to handle only the C_FUN and C_EXT. */ - case C_FCN: - - case C_BSTAT: - case C_ESTAT: - case C_ARG: - case C_REGPARM: - case C_REG: - case C_TPDEF: - case C_STRTAG: - case C_UNTAG: - case C_ENTAG: - case C_LABEL: - case C_NULL: - - /* C_EINCL means we are switching back to the main file. But there - is no reason to care; the only thing we want to know about - includes is the names of all the included (.h) files. */ - case C_EINCL: - - case C_BLOCK: - - /* I don't think C_STAT is used in xcoff; C_HIDEXT appears to be - used instead. */ - case C_STAT: - - /* I don't think the name of the common block (as opposed to the - variables within it) is something which is user visible - currently. */ - case C_BCOMM: - case C_ECOMM: - - case C_PSYM: - case C_RPSYM: - - /* I think we can ignore C_LSYM; types on xcoff seem to use C_DECL - so C_LSYM would appear to be only for locals. */ - case C_LSYM: - - case C_AUTO: - case C_RSYM: - { - /* We probably could save a few instructions by assuming that - C_LSYM, C_PSYM, etc., never have auxents. */ - int naux1 = - ((struct external_syment *)sraw_symbol)->e_numaux[0] + 1; - ssymnum += naux1; - sraw_symbol += sizeof (struct external_syment) * naux1; - } - break; - - case C_BINCL: - stype = N_SOL; - goto pstab; - - case C_FUN: - /* The value of the C_FUN is not the address of the function (it - appears to be the address before linking), but as long as it - is smaller than the actual address, then find_pc_partial_function - will use the minimal symbols instead. I hope. */ - - case C_GSYM: - case C_ECOML: - case C_DECL: - case C_STSYM: - stype = N_LSYM; - pstab:; - swap_sym (&symbol, &main_aux, &namestring, &sraw_symbol, - &ssymnum, objfile); -#define CUR_SYMBOL_TYPE stype -#define CUR_SYMBOL_VALUE symbol.n_value - -/* START_PSYMTAB and END_PSYMTAB are never used, because they are only - called from DBXREAD_ONLY or N_SO code. Likewise for the symnum - variable. */ -#define START_PSYMTAB(ofile,secoff,fname,low,symoff,global_syms,static_syms) 0 -#define END_PSYMTAB(pst,ilist,ninc,c_off,c_text,dep_list,n_deps)\ - do {} while (0) -/* We have already set the namestring. */ -#define SET_NAMESTRING() /* */ - -#include "partial-stab.h" - } - } - - if (pst) - { - xcoff_end_psymtab (pst, psymtab_include_list, includes_used, - ssymnum, - dependency_list, dependencies_used); - } - - /* Record the toc offset value of this symbol table into ldinfo structure. - If no XMC_TC0 is found, toc_offset should be zero. Another place to obtain - this information would be file auxiliary header. */ - -#ifndef FAKING_RS6000 - xcoff_add_toc_to_loadinfo (toc_offset); -#endif -} - -/* Scan and build partial symbols for a symbol file. - We have been initialized by a call to dbx_symfile_init, which - put all the relevant info into a "struct dbx_symfile_info", - hung off the objfile structure. - - SECTION_OFFSETS contains offsets relative to which the symbols in the - various sections are (depending where the sections were actually loaded). - MAINLINE is true if we are reading the main symbol - table (as opposed to a shared lib or dynamically loaded file). */ - -static void -xcoff_initial_scan (objfile, section_offsets, mainline) - struct objfile *objfile; - struct section_offsets *section_offsets; - int mainline; /* FIXME comments above */ -{ - bfd *abfd; - int val; - struct cleanup *back_to; - int num_symbols; /* # of symbols */ - file_ptr symtab_offset; /* symbol table and */ - file_ptr stringtab_offset; /* string table file offsets */ - struct coff_symfile_info *info; - char *name; - unsigned int size; - -#ifndef FAKING_RS6000 - /* Initialize load info structure. */ - if (mainline) - xcoff_init_loadinfo (); -#endif - - info = (struct coff_symfile_info *) objfile -> sym_private; - symfile_bfd = abfd = objfile->obfd; - name = objfile->name; - - num_symbols = bfd_get_symcount (abfd); /* # of symbols */ - symtab_offset = obj_sym_filepos (abfd); /* symbol table file offset */ - stringtab_offset = symtab_offset + - num_symbols * coff_data(abfd)->local_symesz; - - info->min_lineno_offset = 0; - info->max_lineno_offset = 0; - bfd_map_over_sections (abfd, find_linenos, info); - - if (num_symbols > 0) - { - /* Read the string table. */ - init_stringtab (abfd, stringtab_offset, objfile); - - /* Read the .debug section, if present. */ - { - sec_ptr secp; - bfd_size_type length; - char *debugsec = NULL; - - secp = bfd_get_section_by_name (abfd, ".debug"); - if (secp) - { - length = bfd_section_size (abfd, secp); - if (length) - { - debugsec = - (char *) obstack_alloc (&objfile->symbol_obstack, length); - - if (!bfd_get_section_contents (abfd, secp, debugsec, - (file_ptr) 0, length)) - { - error ("Error reading .debug section of `%s': %s", - name, bfd_errmsg (bfd_get_error ())); - } - } - } - ((struct coff_symfile_info *)objfile->sym_private)->debugsec = - debugsec; - } - } - - /* Read the symbols. We keep them in core because we will want to - access them randomly in read_symbol*. */ - val = bfd_seek (abfd, symtab_offset, SEEK_SET); - if (val < 0) - error ("Error reading symbols from %s: %s", - name, bfd_errmsg (bfd_get_error ())); - size = coff_data (abfd)->local_symesz * num_symbols; - ((struct coff_symfile_info *)objfile->sym_private)->symtbl = - obstack_alloc (&objfile->symbol_obstack, size); - ((struct coff_symfile_info *)objfile->sym_private)->symtbl_num_syms = - num_symbols; - - val = bfd_read (((struct coff_symfile_info *)objfile->sym_private)->symtbl, - size, 1, abfd); - if (val != size) - perror_with_name ("reading symbol table"); - - /* If we are reinitializing, or if we have never loaded syms yet, init */ - if (mainline - || objfile->global_psymbols.size == 0 - || objfile->static_psymbols.size == 0) - /* I'm not sure how how good num_symbols is; the rule of thumb in - init_psymbol_list was developed for a.out. On the one hand, - num_symbols includes auxents. On the other hand, it doesn't - include N_SLINE. */ - init_psymbol_list (objfile, num_symbols); - - pending_blocks = 0; - back_to = make_cleanup (really_free_pendings, 0); - - init_minimal_symbol_collection (); - make_cleanup (discard_minimal_symbols, 0); - - /* Now that the symbol table data of the executable file are all in core, - process them and define symbols accordingly. */ - - scan_xcoff_symtab (section_offsets, objfile); - - /* Install any minimal symbols that have been collected as the current - minimal symbols for this objfile. */ - - install_minimal_symbols (objfile); - - do_cleanups (back_to); -} - -static struct section_offsets * -xcoff_symfile_offsets (objfile, addr) - struct objfile *objfile; - CORE_ADDR addr; -{ - struct section_offsets *section_offsets; - int i; - - objfile->num_sections = SECT_OFF_MAX; - section_offsets = (struct section_offsets *) - obstack_alloc - (&objfile -> psymbol_obstack, - sizeof (struct section_offsets) - + sizeof (section_offsets->offsets) * objfile->num_sections); - - /* syms_from_objfile kindly subtracts from addr the bfd_section_vma - of the .text section. This strikes me as wrong--whether the - offset to be applied to symbol reading is relative to the start - address of the section depends on the symbol format. In any - event, this whole "addr" concept is pretty broken (it doesn't - handle any section but .text sensibly), so just ignore the addr - parameter and use 0. rs6000-nat.c will set the correct section - offsets via objfile_relocate. */ - for (i = 0; i < objfile->num_sections; ++i) - ANOFFSET (section_offsets, i) = 0; - - return section_offsets; -} - -/* Register our ability to parse symbols for xcoff BFD files. */ - -static struct sym_fns xcoff_sym_fns = -{ - - /* Because the bfd uses coff_flavour, we need to specially kludge - the flavour. It is possible that coff and xcoff should be merged as - they do have fundamental similarities (for example, the extra storage - classes used for stabs could presumably be recognized in any COFF file). - However, in addition to obvious things like all the csect hair, there are - some subtler differences between xcoffread.c and coffread.c, notably - the fact that coffread.c has no need to read in all the symbols, but - xcoffread.c reads all the symbols and does in fact randomly access them - (in C_BSTAT and line number processing). */ - - (enum bfd_flavour)-1, - - xcoff_new_init, /* sym_new_init: init anything gbl to entire symtab */ - xcoff_symfile_init, /* sym_init: read initial info, setup for sym_read() */ - xcoff_initial_scan, /* sym_read: read a symbol file into symtab */ - xcoff_symfile_finish, /* sym_finish: finished with file, cleanup */ - xcoff_symfile_offsets, /* sym_offsets: xlate offsets ext->int form */ - NULL /* next: pointer to next struct sym_fns */ -}; - -void -_initialize_xcoffread () -{ - add_symtab_fns(&xcoff_sym_fns); - - func_symbol_type = init_type (TYPE_CODE_FUNC, 1, 0, - "", NULL); - TYPE_TARGET_TYPE (func_symbol_type) = builtin_type_int; - var_symbol_type = - init_type (TYPE_CODE_INT, TARGET_INT_BIT / HOST_CHAR_BIT, 0, - "", NULL); -} diff --git a/contrib/gdb/gdb/xcoffsolib.c b/contrib/gdb/gdb/xcoffsolib.c deleted file mode 100644 index edcfda1..0000000 --- a/contrib/gdb/gdb/xcoffsolib.c +++ /dev/null @@ -1,211 +0,0 @@ -/* Shared library support for RS/6000 (xcoff) object files, for GDB. - Copyright 1991, 1992 Free Software Foundation. - Contributed by IBM Corporation. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#if 0 -#include -#include -#endif - -#include "defs.h" -#include "bfd.h" -#include "xcoffsolib.h" -#include "inferior.h" - -#ifdef SOLIB_SYMBOLS_MANUAL - -extern struct symtab *current_source_symtab; -extern int current_source_line; - -/* The real work of adding a shared library file to the symtab and - the section list. */ - -void -solib_add (arg_string, from_tty, target) - char *arg_string; - int from_tty; - struct target_ops *target; -{ - char *val; - struct vmap *vp = vmap; - struct objfile *obj; - struct symtab *saved_symtab; - int saved_line; - - int loaded = 0; /* true if any shared obj loaded */ - int matched = 0; /* true if any shared obj matched */ - - if (arg_string == 0) - re_comp ("."); - else if (val = (char *) re_comp (arg_string)) { - error ("Invalid regexp: %s", val); - } - if (!vp || !vp->nxt) - return; - - /* save current symbol table and line number, in case they get changed - in symbol loading process. */ - - saved_symtab = current_source_symtab; - saved_line = current_source_line; - - /* skip over the first vmap, it is the main program, always loaded. */ - vp = vp->nxt; - - for (; vp; vp = vp->nxt) { - - if (re_exec (vp->name) || (*vp->member && re_exec (vp->member))) { - - matched = 1; - - /* if already loaded, continue with the next one. */ - if (vp->loaded) { - - printf_unfiltered ("%s%s%s%s: already loaded.\n", - *vp->member ? "(" : "", - vp->member, - *vp->member ? ") " : "", - vp->name); - continue; - } - - printf_unfiltered ("Loading %s%s%s%s...", - *vp->member ? "(" : "", - vp->member, - *vp->member ? ") " : "", - vp->name); - gdb_flush (gdb_stdout); - - /* This is gross and doesn't work. If this code is re-enabled, - just stick a objfile member into the struct vmap; that's the - way solib.c (for SunOS/SVR4) does it. */ - obj = lookup_objfile_bfd (vp->bfd); - if (!obj) { - warning ("\nObj structure for the shared object not found. Loading failed."); - continue; - } - - syms_from_objfile (obj, 0, 0, 0); - new_symfile_objfile (obj, 0, 0); - vmap_symtab (vp, 0, 0); - printf_unfiltered ("Done.\n"); - loaded = vp->loaded = 1; - } - } - /* if any shared object is loaded, then misc_func_vector needs sorting. */ - if (loaded) { -#if 0 - sort_misc_function_vector (); -#endif - current_source_symtab = saved_symtab; - current_source_line = saved_line; - - /* Getting new symbols might change our opinion about what is frameless. - Is this correct?? FIXME. */ -/* reinit_frame_cache(); */ - } - else if (!matched) - printf_unfiltered ("No matching shared object found.\n"); -} -#endif /* SOLIB_SYMBOLS_MANUAL */ - -/* Return the module name of a given text address. Note that returned buffer - is not persistent. */ - -char * -pc_load_segment_name (addr) -CORE_ADDR addr; -{ - static char buffer [BUFSIZ]; - struct vmap *vp = vmap; - - buffer [0] = buffer [1] = '\0'; - for (; vp; vp = vp->nxt) - if (vp->tstart <= addr && addr < vp->tend) { - if (*vp->member) { - buffer [0] = '('; - strcat (&buffer[1], vp->member); - strcat (buffer, ")"); - } - strcat (buffer, vp->name); - return buffer; - } - return "(unknown load module)"; -} - -static void solib_info PARAMS ((char *, int)); - -static void -solib_info (args, from_tty) - char *args; - int from_tty; -{ - struct vmap *vp = vmap; - - /* Check for new shared libraries loaded with load (). */ - xcoff_relocate_symtab (inferior_pid); - - if (vp == NULL || vp->nxt == NULL) - { - printf_unfiltered ("No shared libraries loaded at this time.\n"); - return; - } - - /* Skip over the first vmap, it is the main program, always loaded. */ - vp = vp->nxt; - - printf_unfiltered ("\ -Text Range Data Range Syms Shared Object Library\n"); - - for (; vp != NULL; vp = vp->nxt) - { - printf_unfiltered ("0x%08x-0x%08x 0x%08x-0x%08x %s %s%s%s%s\n", - vp->tstart, vp->tend, - vp->dstart, vp->dend, - vp->loaded ? "Yes" : "No ", - *vp->member ? "(" : "", - vp->member, - *vp->member ? ") " : "", - vp->name); - } -} - -void -sharedlibrary_command (args, from_tty) - char *args; - int from_tty; -{ - dont_repeat (); - - /* Check for new shared libraries loaded with load (). */ - xcoff_relocate_symtab (inferior_pid); - -#ifdef SOLIB_SYMBOLS_MANUAL - solib_add (args, from_tty, (struct target_ops *)0); -#endif /* SOLIB_SYMBOLS_MANUAL */ -} - -void -_initialize_solib() -{ - add_com ("sharedlibrary", class_files, sharedlibrary_command, - "Load shared object library symbols for files matching REGEXP."); - add_info ("sharedlibrary", solib_info, - "Status of loaded shared object libraries"); -} diff --git a/contrib/gdb/gdb/xmodem.c b/contrib/gdb/gdb/xmodem.c deleted file mode 100644 index dd13b87..0000000 --- a/contrib/gdb/gdb/xmodem.c +++ /dev/null @@ -1,284 +0,0 @@ -/* XMODEM support for GDB, the GNU debugger. - Copyright 1995 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "defs.h" -#include "serial.h" -#include "target.h" -#include "xmodem.h" - -/* These definitions are for xmodem protocol. */ - -#define SOH 0x01 -#define STX 0x02 -#define ACK 0x06 -#define NAK 0x15 -#define EOT 0x04 -#define CANCEL 0x18 - -static int blknum; /* XMODEM block number */ -static int crcflag; /* Sez we are using CRC's instead of cksums */ - -static int -readchar (desc, timeout) - serial_t desc; - int timeout; -{ - int c; - - c = SERIAL_READCHAR (desc, timeout); - - if (remote_debug > 0) - fputc_unfiltered (c, gdb_stderr); - - if (c >= 0) - return c; - - if (c == SERIAL_TIMEOUT) - error ("Timeout reading from remote system."); - - perror_with_name ("xmodem.c:readchar()"); -} - -#define CRC16 0x1021 /* Generator polynomial (X^16 + X^12 + X^5 + 1) */ - -static unsigned short *crctab; - -/* Call this to init the fast CRC-16 calculation table. */ - -static void -crcinit () -{ - static int crctab_inited = 0; - int val; - - if (crctab_inited == 1) - return; - - crctab = xmalloc (256 * sizeof (short)); - - for (val = 0; val <= 255; val++) - { - int i; - unsigned int crc; - - crc = val << 8; - - for (i = 0; i < 8; ++i) - { - crc <<= 1; - - if (crc & 0x10000) - crc ^= CRC16; - } - - crctab [val] = crc; - } - - crctab_inited = 1; -} - -/* Calculate a CRC-16 for the LEN byte message pointed at by P. */ - -static unsigned short -docrc (p, len) - unsigned char *p; - int len; -{ - unsigned short crc = 0; - - while (len-- > 0) - crc = (crc << 8) ^ crctab [(crc >> 8) ^ *p++]; - - return crc; -} - -/* Start up the transmit process. Reset state variables. Wait for receiver to - send NAK or CRC request. */ - -int -xmodem_init_xfer (desc) - serial_t desc; -{ - int c; - int i; - - blknum = 1; - crcflag = 0; - crcinit (); - - for (i = 1; i <= 10; i++) - { - c = readchar (desc, 6); - - switch (c) - { - case 'C': - crcflag = 1; - case NAK: - return 0; - default: - fprintf_unfiltered (gdb_stderr, "xmodem_init_xfer: Got unexpected character %c (0%o)\n", c, c); - continue; - case CANCEL: /* target aborted load */ - fprintf_unfiltered (gdb_stderr, "Got a CANCEL from the target.\n"); - continue; - } - } - error ("xmodem_init_xfer: Too many unexpected characters."); -} - -/* Take 128 bytes of data and make a packet out of it. - * - * Each packet looks like this: - * +-----+-------+-------+------+-----+ - * | SOH | Seq1. | Seq2. | data | SUM | - * +-----+-------+-------+------+-----+ - * SOH = 0x01 - * Seq1 = The sequence number. - * Seq2 = The complement of the sequence number. - * Data = A 128 bytes of data. - * SUM = Add the contents of the 128 bytes and use the low-order - * 8 bits of the result. - * - * send_xmodem_packet fills in the XMODEM fields of PACKET and sends it to the - * remote system. PACKET must be XMODEM_PACKETSIZE bytes long. The data must - * start 3 bytes after the beginning of the packet to leave room for the - * XMODEM header. LEN is the length of the data portion of the packet (and - * must be <= 128 bytes). If it is < 128 bytes, ^Z padding will be added. - */ - -void -xmodem_send_packet (desc, packet, len, hashmark) - serial_t desc; - unsigned char *packet; - int len; - int hashmark; -{ - int i; - int retries; - int pktlen; - int datasize; - - /* build the packet header */ - - packet[1] = blknum; - packet[2] = ~blknum; - - blknum++; - - if (len <= XMODEM_DATASIZE) - { - packet[0] = SOH; - datasize = XMODEM_DATASIZE; - } - else if (len <= XMODEM_1KDATASIZE) - { - packet[0] = STX; - datasize = XMODEM_1KDATASIZE; - } - else - abort (); /* Packet way too large */ - - /* Add ^Z padding if packet < 128 (or 1024) bytes */ - - memset (packet + 3 + len, '\026', datasize - len); - - if (crcflag) - { - int crc; - - crc = docrc (packet + 3, datasize); - - packet[3 + datasize] = crc >> 8; - packet[3 + datasize + 1] = crc; - pktlen = datasize + 5; - } - else - { - int sum; - - sum = 0; - for (i = 3; i < datasize + 3; i++) - sum += packet[i]; - - packet[3 + datasize] = sum; /* add the checksum */ - pktlen = datasize + 4; - } - - for (retries = 3; retries >= 0; retries--) - { - int c; - - SERIAL_WRITE (desc, packet, pktlen); - - c = readchar (desc, 3); - switch (c) - { - case ACK: - return; - case NAK: - if (!hashmark) - continue; - putchar_unfiltered ('-'); - gdb_flush (gdb_stdout); - continue; - case CANCEL: - error ("xmodem_send_packet: Transfer aborted by receiver."); - default: - fprintf_unfiltered (gdb_stderr, "xmodem_send_packet: Got unexpected character %c (0%o)\n", c, c); - continue; - } - } - - SERIAL_WRITE (desc, "\004", 1); /* Send an EOT */ - - error ("xmodem_send_packet: Excessive retries."); -} - -/* Finish off the transfer. Send out the EOT, and wait for an ACK. */ - -void -xmodem_finish_xfer (desc) - serial_t desc; -{ - int retries; - - for (retries = 10; retries >= 0; retries--) - { - int c; - - SERIAL_WRITE (desc, "\004", 1); /* Send an EOT */ - - c = readchar (desc, 3); - switch (c) - { - case ACK: - return; - case NAK: - continue; - case CANCEL: - error ("xmodem_finish_xfer: Transfer aborted by receiver."); - default: - fprintf_unfiltered (gdb_stderr, "xmodem_send_packet: Got unexpected character %c (0%o)\n", c, c); - continue; - } - } - - error ("xmodem_finish_xfer: Excessive retries."); -} diff --git a/contrib/gdb/gdb/xmodem.h b/contrib/gdb/gdb/xmodem.h deleted file mode 100644 index 0303612..0000000 --- a/contrib/gdb/gdb/xmodem.h +++ /dev/null @@ -1,29 +0,0 @@ -/* XMODEM support for GDB, the GNU debugger. - Copyright 1995 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -int xmodem_init_xfer PARAMS ((serial_t desc)); -void send_xmodem_packet PARAMS ((serial_t desc, unsigned char *packet, int len, - int hashmark)); -void xmodem_finish_xfer PARAMS ((serial_t desc)); - -#define XMODEM_DATASIZE 128 /* The data size is ALWAYS 128 */ -#define XMODEM_1KDATASIZE 1024 /* Unless it's 1024!!! */ -#define XMODEM_PACKETSIZE 133 /* data + packet headers and crc */ -#define XMODEM_1KPACKETSIZE 1024 + 5 /* data + packet headers and crc */ -#define XMODEM_DATAOFFSET 3 /* Offset to start of actual data */ diff --git a/contrib/gdb/readline/doc/ChangeLog b/contrib/gdb/readline/doc/ChangeLog deleted file mode 100644 index 2520a85..0000000 --- a/contrib/gdb/readline/doc/ChangeLog +++ /dev/null @@ -1,12 +0,0 @@ -Wed Sep 20 12:57:29 1995 Ian Lance Taylor - - * Makefile.in (maintainer-clean): New synonym for realclean. - -Tue Feb 2 11:40:04 1993 Roland H. Pesch (pesch@fowanton.cygnus.com) - - * Makefile.in: configurable (and useable) Makefile template - * Makefile: removed, replaced with configurable Makefile.in - * texindex.c texinfo.tex: remove, replacing w/refs to tools - elsewhere in distribution tree - * configure.in: pro forma configure stub - * ChangeLog: new file diff --git a/contrib/gdb/readline/doc/Makefile.in b/contrib/gdb/readline/doc/Makefile.in deleted file mode 100644 index 451b9fe..0000000 --- a/contrib/gdb/readline/doc/Makefile.in +++ /dev/null @@ -1,94 +0,0 @@ -## Copyright (C) 1993 Free Software Foundation, Inc. - -# Makefile for Readline documentation. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -srcdir = . - -prefix = /usr/local - -infodir = $(prefix)/info - -SHELL = /bin/sh - -INSTALL = install -c -INSTALL_DATA = $(INSTALL) - -# where to find texinfo -TEXIDIR=$(srcdir)/../../texinfo - -# where to find makeinfo, preferably one designed for texinfo-2 -MAKEINFO=makeinfo - -# auxiliary program for sorting Texinfo indices -TEXINDEX=texindex - -# Don Knuth's TeX formatter -TEX=tex - -#### Host, target, and site specific Makefile fragments come in here. -### - -all: info dvi - -install: install-info - -info: history.info readline.info - -dvi: history.dvi readline.dvi - -install-info: info - -parent=`echo $(infodir)|sed -e 's@/[^/]*$$@@'`; \ - if [ -d $$parent ] ; then true ; else mkdir $$parent ; fi - -if [ -d $(infodir) ] ; then true ; else mkdir $(infodir) ; fi - for i in *.info* ; do \ - $(INSTALL_DATA) $$i $(infodir)/$$i ; \ - done - -history.info: hist.texinfo hsuser.texinfo hstech.texinfo - $(MAKEINFO) -I $(srcdir) -o ./history.info $(srcdir)/hist.texinfo - -history.dvi: hist.texinfo hsuser.texinfo hstech.texinfo $(TEXIDIR)/texinfo.tex - TEXINPUTS=${TEXIDIR}:$(srcdir):$$TEXINPUTS $(TEX) hist.texinfo - $(TEXINDEX) hist.?? - TEXINPUTS=${TEXIDIR}:$(srcdir):$$TEXINPUTS $(TEX) hist.texinfo - -readline.info: rlman.texinfo rluser.texinfo rltech.texinfo - $(MAKEINFO) -I $(srcdir) -o ./readline.info $(srcdir)/rlman.texinfo - -readline.dvi: rlman.texinfo rluser.texinfo rltech.texinfo - TEXINPUTS=${TEXIDIR}:$(srcdir):$$TEXINPUTS $(TEX) rlman.texinfo - $(TEXINDEX) rlman.?? - TEXINPUTS=${TEXIDIR}:$(srcdir):$$TEXINPUTS $(TEX) rlman.texinfo - -distclean: clean - rm -f Makefile config.status - -mostlyclean: clean - -realclean maintainer-clean: distclean - -clean: clean-info clean-dvi - -clean-info: - rm -f history.info* readline.info* - -clean-dvi: - rm -f hist.?? hist.??? - rm -f rlman.?? rlman.??? - -Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag) - $(SHELL) ./config.status diff --git a/contrib/gdb/readline/doc/configure.in b/contrib/gdb/readline/doc/configure.in deleted file mode 100644 index c082c56..0000000 --- a/contrib/gdb/readline/doc/configure.in +++ /dev/null @@ -1,8 +0,0 @@ -srcname="READLINE doc" -srctrigger=rlman.texinfo -# per-host: - -# per-target: - -files="" -links="" diff --git a/contrib/gdb/readline/doc/hist.texinfo b/contrib/gdb/readline/doc/hist.texinfo deleted file mode 100644 index 6292738..0000000 --- a/contrib/gdb/readline/doc/hist.texinfo +++ /dev/null @@ -1,106 +0,0 @@ -\input texinfo @c -*-texinfo-*- -@comment %**start of header (This is for running Texinfo on a region.) -@setfilename history.info -@settitle GNU Readline Library -@comment %**end of header (This is for running Texinfo on a region.) -@synindex vr fn -@setchapternewpage odd - -@ifinfo -This document describes the GNU History library, a programming tool that -provides a consistent user interface for recalling lines of previously -typed input. - -Copyright (C) 1988, 1991 Free Software Foundation, Inc. - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -pare preserved on all copies. - -@ignore -Permission is granted to process this file through TeX and print the -results, provided the printed document carries copying permission -notice identical to this one except for the removal of this paragraph -(this paragraph not being relevant to the printed manual). -@end ignore - -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided that the entire -resulting derived work is distributed under the terms of a permission -notice identical to this one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions, -except that this permission notice may be stated in a translation approved -by the Foundation. -@end ifinfo - -@titlepage -@sp 10 -@center @titlefont{GNU History Library} -@center Brian Fox -@center Free Software Foundation -@center Version 1.1 -@center April 1991 - -@c Include the Distribution inside the titlepage environment so -@c that headings are turned off. - -@page - -This document describes the GNU History library, a programming tool that -provides a consistent user interface for recalling lines of previously -typed input. - -Published by the Free Software Foundation @* -675 Massachusetts Avenue, @* -Cambridge, MA 02139 USA - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided that the entire -resulting derived work is distributed under the terms of a permission -notice identical to this one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions, -except that this permission notice may be stated in a translation approved -by the Foundation. - -@vskip 0pt plus 1filll -Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc. -@end titlepage - -@ifinfo -@node Top -@top GNU History Library - -This document describes the GNU History library, a programming tool that -provides a consistent user interface for recalling lines of previously -typed input. - -@menu -* Using History Interactively:: GNU History User's Manual. -* Programming with GNU History:: GNU History Programmer's Manual. -* Concept Index:: Index of concepts described in this manual. -* Function and Variable Index:: Index of externally visible functions - and variables. -@end menu -@end ifinfo - -@include hsuser.texinfo -@include hstech.texinfo - -@node Concept Index -@appendix Concept Index -@printindex cp - -@node Function and Variable Index -@appendix Function and Variable Index -@printindex vr -@contents - -@bye diff --git a/contrib/gdb/readline/doc/hstech.texinfo b/contrib/gdb/readline/doc/hstech.texinfo deleted file mode 100644 index c3fe3f6..0000000 --- a/contrib/gdb/readline/doc/hstech.texinfo +++ /dev/null @@ -1,311 +0,0 @@ -@ignore -This file documents the user interface to the GNU History library. - -Copyright (C) 1988, 1991 Free Software Foundation, Inc. -Authored by Brian Fox. - -Permission is granted to make and distribute verbatim copies of this manual -provided the copyright notice and this permission notice are preserved on -all copies. - -Permission is granted to process this file through Tex and print the -results, provided the printed document carries copying permission notice -identical to this one except for the removal of this paragraph (this -paragraph not being relevant to the printed manual). - -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided also that the -GNU Copyright statement is available to the distributee, and provided that -the entire resulting derived work is distributed under the terms of a -permission notice identical to this one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions. -@end ignore - -@node Programming with GNU History -@chapter Programming with GNU History - -This chapter describes how to interface the GNU History Library with -programs that you write. It should be considered a technical guide. -For information on the interactive use of GNU History, @pxref{Using -History Interactively}. - -@menu -* Introduction to History:: What is the GNU History library for? -* History Storage:: How information is stored. -* History Functions:: Functions that you can use. -* History Variables:: Variables that control behaviour. -* History Programming Example:: Example of using the GNU History Library. -@end menu - -@node Introduction to History -@section Introduction to History - -Many programs read input from the user a line at a time. The GNU history -library is able to keep track of those lines, associate arbitrary data with -each line, and utilize information from previous lines in making up new -ones. - -The programmer using the History library has available to him functions -for remembering lines on a history stack, associating arbitrary data -with a line, removing lines from the stack, searching through the stack -for a line containing an arbitrary text string, and referencing any line -on the stack directly. In addition, a history @dfn{expansion} function -is available which provides for a consistent user interface across many -different programs. - -The end-user using programs written with the History library has the -benifit of a consistent user interface, with a set of well-known -commands for manipulating the text of previous lines and using that text -in new commands. The basic history manipulation commands are similar to -the history substitution used by @code{Csh}. - -If the programmer desires, he can use the Readline library, which -includes some history manipulation by default, and has the added -advantage of Emacs style command line editing. - -@node History Storage -@section History Storage - -@example -typedef struct _hist_entry @{ - char *line; - char *data; -@} HIST_ENTRY; -@end example - -@node History Functions -@section History Functions - -This section describes the calling sequence for the various functions -present in GNU History. - -@defun {void using_history} () -Begin a session in which the history functions might be used. This -just initializes the interactive variables. -@end defun - -@defun {void add_history} (char *string) -Place @var{string} at the end of the history list. The associated data -field (if any) is set to @code{NULL}. -@end defun - -@defun {int where_history} () -Returns the number which says what history element we are now looking -at. -@end defun - -@defun {int history_set_pos} (int pos) -Set the position in the history list to @var{pos}. -@end defun - -@defun {int history_search_pos} (char *string, int direction, int pos) -Search for @var{string} in the history list, starting at @var{pos}, an -absolute index into the list. @var{direction}, if negative, says to search -backwards from @var{pos}, else forwards. Returns the absolute index of -the history element where @var{string} was found, or -1 otherwise. -@end defun - -@defun {HIST_ENTRY *remove_history} (); -Remove history element @var{which} from the history. The removed -element is returned to you so you can free the line, data, -and containing structure. -@end defun - -@defun {void stifle_history} (int max) -Stifle the history list, remembering only @var{max} number of entries. -@end defun - -@defun {int unstifle_history} (); -Stop stifling the history. This returns the previous amount the -history was stifled by. The value is positive if the history was -stifled, negative if it wasn't. -@end defun - -@defun {int read_history} (char *filename) -Add the contents of @var{filename} to the history list, a line at a -time. If @var{filename} is @code{NULL}, then read from -@file{~/.history}. Returns 0 if successful, or errno if not. -@end defun - -@defun {int read_history_range} (char *filename, int from, int to) -Read a range of lines from @var{filename}, adding them to the history list. -Start reading at the @var{from}'th line and end at the @var{to}'th. If -@var{from} is zero, start at the beginning. If @var{to} is less than -@var{from}, then read until the end of the file. If @var{filename} is -@code{NULL}, then read from @file{~/.history}. Returns 0 if successful, -or @code{errno} if not. -@end defun - -@defun {int write_history} (char *filename) -Append the current history to @var{filename}. If @var{filename} is -@code{NULL}, then append the history list to @file{~/.history}. Values -returned are as in @code{read_history ()}. -@end defun - -@defun {int append_history} (int nelements, char *filename) -Append @var{nelement} entries to @var{filename}. The entries appended -are from the end of the list minus @var{nelements} up to the end of the -list. -@end defun - -@defun {HIST_ENTRY *replace_history_entry} () -Make the history entry at @var{which} have @var{line} and @var{data}. -This returns the old entry so you can dispose of the data. In the case -of an invalid @var{which}, a @code{NULL} pointer is returned. -@end defun - -@defun {HIST_ENTRY *current_history} () -Return the history entry at the current position, as determined by -@code{history_offset}. If there is no entry there, return a @code{NULL} -pointer. -@end defun - -@defun {HIST_ENTRY *previous_history} () -Back up @var{history_offset} to the previous history entry, and return a -pointer to that entry. If there is no previous entry, return a -@code{NULL} pointer. -@end defun - -@defun {HIST_ENTRY *next_history} () -Move @code{history_offset} forward to the next history entry, and return -the a pointer to that entry. If there is no next entry, return a -@code{NULL} pointer. -@end defun - -@defun {HIST_ENTRY **history_list} () -Return a @code{NULL} terminated array of @code{HIST_ENTRY} which is the -current input history. Element 0 of this list is the beginning of time. -If there is no history, return @code{NULL}. -@end defun - -@defun {int history_search} (char *string, int direction) -Search the history for @var{string}, starting at @code{history_offset}. -If @var{direction} < 0, then the search is through previous entries, -else through subsequent. If @var{string} is found, then -@code{current_history ()} is the history entry, and the value of this -function is the offset in the line of that history entry that the -@var{string} was found in. Otherwise, nothing is changed, and a -1 is -returned. -@end defun - -@defun {int history_expand} (char *string, char **output) -Expand @var{string}, placing the result into @var{output}, a pointer -to a string. Returns: -@table @code -@item 0 -If no expansions took place (or, if the only change in -the text was the de-slashifying of the history expansion -character), -@item 1 -if expansions did take place, or -@item -1 -if there was an error in expansion. -@end table - -If an error ocurred in expansion, then @var{output} contains a descriptive -error message. -@end defun - -@defun {char *history_arg_extract} (int first, int last, char *string) -Extract a string segment consisting of the @var{first} through @var{last} -arguments present in @var{string}. Arguments are broken up as in -the GNU Bash shell. -@end defun - -@defun {int history_total_bytes} (); -Return the number of bytes that the primary history entries are using. -This just adds up the lengths of @code{the_history->lines}. -@end defun - -@node History Variables -@section History Variables - -This section describes the variables in GNU History that are externally -visible. - -@defvar {int history_base} -For convenience only. You set this when interpreting history commands. -It is the logical offset of the first history element. -@end defvar - -@node History Programming Example -@section History Programming Example - -The following snippet of code demonstrates simple use of the GNU History -Library. - -@smallexample -main () -@{ - char line[1024], *t; - int done = 0; - - line[0] = 0; - - while (!done) - @{ - fprintf (stdout, "history%% "); - t = gets (line); - - if (!t) - strcpy (line, "quit"); - - if (line[0]) - @{ - char *expansion; - int result; - - using_history (); - - result = history_expand (line, &expansion); - strcpy (line, expansion); - free (expansion); - if (result) - fprintf (stderr, "%s\n", line); - - if (result < 0) - continue; - - add_history (line); - @} - - if (strcmp (line, "quit") == 0) done = 1; - if (strcmp (line, "save") == 0) write_history (0); - if (strcmp (line, "read") == 0) read_history (0); - if (strcmp (line, "list") == 0) - @{ - register HIST_ENTRY **the_list = history_list (); - register int i; - - if (the_list) - for (i = 0; the_list[i]; i++) - fprintf (stdout, "%d: %s\n", - i + history_base, the_list[i]->line); - @} - if (strncmp (line, "delete", strlen ("delete")) == 0) - @{ - int which; - if ((sscanf (line + strlen ("delete"), "%d", &which)) == 1) - @{ - HIST_ENTRY *entry = remove_history (which); - if (!entry) - fprintf (stderr, "No such entry %d\n", which); - else - @{ - free (entry->line); - free (entry); - @} - @} - else - @{ - fprintf (stderr, "non-numeric arg given to `delete'\n"); - @} - @} - @} -@} -@end smallexample - - - diff --git a/contrib/gdb/readline/doc/hsuser.texinfo b/contrib/gdb/readline/doc/hsuser.texinfo deleted file mode 100644 index cda0a68..0000000 --- a/contrib/gdb/readline/doc/hsuser.texinfo +++ /dev/null @@ -1,153 +0,0 @@ -@ignore -This file documents the user interface to the GNU History library. - -Copyright (C) 1988, 1991 Free Software Foundation, Inc. -Authored by Brian Fox. - -Permission is granted to make and distribute verbatim copies of this manual -provided the copyright notice and this permission notice are preserved on -all copies. - -Permission is granted to process this file through Tex and print the -results, provided the printed document carries copying permission notice -identical to this one except for the removal of this paragraph (this -paragraph not being relevant to the printed manual). - -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided also that the -GNU Copyright statement is available to the distributee, and provided that -the entire resulting derived work is distributed under the terms of a -permission notice identical to this one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions. -@end ignore - -@node Using History Interactively -@chapter Using History Interactively - -This chapter describes how to use the GNU History Library interactively, -from a user's standpoint. It should be considered a user's guide. For -information on using the GNU History Library in your own programs, -@pxref{Programming with GNU History}. - -@menu -* History Interaction:: What it feels like using History as a user. -@end menu - -@node History Interaction -@section History Interaction -@cindex expansion - -The History library provides a history expansion feature that is similar -to the history expansion in Csh. The following text describes the sytax -that you use to manipulate the history information. - -History expansion takes place in two parts. The first is to determine -which line from the previous history should be used during substitution. -The second is to select portions of that line for inclusion into the -current one. The line selected from the previous history is called the -@dfn{event}, and the portions of that line that are acted upon are -called @dfn{words}. The line is broken into words in the same fashion -that the Bash shell does, so that several English (or Unix) words -surrounded by quotes are considered as one word. - -@menu -* Event Designators:: How to specify which history line to use. -* Word Designators:: Specifying which words are of interest. -* Modifiers:: Modifying the results of susbstitution. -@end menu - -@node Event Designators -@subsection Event Designators -@cindex event designators - -An event designator is a reference to a command line entry in the -history list. - -@table @asis - -@item @code{!} -Start a history subsititution, except when followed by a space, tab, or -the end of the line... @key{=} or @key{(}. - -@item @code{!!} -Refer to the previous command. This is a synonym for @code{!-1}. - -@item @code{!n} -Refer to command line @var{n}. - -@item @code{!-n} -Refer to the command line @var{n} lines back. - -@item @code{!string} -Refer to the most recent command starting with @var{string}. - -@item @code{!?string}[@code{?}] -Refer to the most recent command containing @var{string}. - -@end table - -@node Word Designators -@subsection Word Designators - -A @key{:} separates the event specification from the word designator. It -can be omitted if the word designator begins with a @key{^}, @key{$}, -@key{*} or @key{%}. Words are numbered from the beginning of the line, -with the first word being denoted by a 0 (zero). - -@table @code - -@item 0 (zero) -The zero'th word. For many applications, this is the command word. - -@item n -The @var{n}'th word. - -@item ^ -The first argument. that is, word 1. - -@item $ -The last argument. - -@item % -The word matched by the most recent @code{?string?} search. - -@item x-y -A range of words; @code{-@var{y}} Abbreviates @code{0-@var{y}}. - -@item * -All of the words, excepting the zero'th. This is a synonym for @code{1-$}. -It is not an error to use @key{*} if there is just one word in the event. -The empty string is returned in that case. - -@end table - -@node Modifiers -@subsection Modifiers - -After the optional word designator, you can add a sequence of one or more -of the following modifiers, each preceded by a @key{:}. - -@table @code - -@item # -The entire command line typed so far. This means the current command, -not the previous command, so it really isn't a word designator, and doesn't -belong in this section. - -@item h -Remove a trailing pathname component, leaving only the head. - -@item r -Remove a trailing suffix of the form @samp{.}@var{suffix}, leaving the basename. - -@item e -Remove all but the suffix. - -@item t -Remove all leading pathname components, leaving the tail. - -@item p -Print the new command but do not execute it. -@end table diff --git a/contrib/gdb/readline/doc/inc-hist.texi b/contrib/gdb/readline/doc/inc-hist.texi deleted file mode 100644 index 9cdde40..0000000 --- a/contrib/gdb/readline/doc/inc-hist.texi +++ /dev/null @@ -1,159 +0,0 @@ -@ignore -This file is completely identical to hsuser.texinfo, except that it has the -reference to the programming manual removed. There are definately better ways -to do this! - -This file documents the user interface to the GNU History library. - -Copyright (C) 1988, 1991 Free Software Foundation, Inc. -Authored by Brian Fox. - -Permission is granted to make and distribute verbatim copies of this manual -provided the copyright notice and this permission notice are preserved on -all copies. - -Permission is granted to process this file through Tex and print the -results, provided the printed document carries copying permission notice -identical to this one except for the removal of this paragraph (this -paragraph not being relevant to the printed manual). - -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided also that the -GNU Copyright statement is available to the distributee, and provided that -the entire resulting derived work is distributed under the terms of a -permission notice identical to this one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions. -@end ignore - -@node Using History Interactively -@appendix Using History Interactively - -This chapter describes how to use the GNU History Library interactively, -from a user's standpoint. - -@menu -* History Interaction:: What it feels like using History as a user. -@end menu - -@node History Interaction -@section History Interaction -@cindex expansion - -The History library provides a history expansion feature similar -to the history expansion in @code{csh}. The following text describes the -syntax you use to manipulate history information. - -History expansion takes two parts. In the first part, determine -which line from the previous history will be used for substitution. -This line is called the @dfn{event}. -In the second part, select portions of that line for inclusion into the -current line. These portions are called @dfn{words}. -@value{GDBN} breaks the line into words in the same -way that the Bash shell does, so that several English (or Unix) words -surrounded by quotes are considered one word. - -@menu -* Event Designators:: How to specify which history line to use. -* Word Designators:: Specifying which words are of interest. -* Modifiers:: Modifying the results of susbstitution. -@end menu - -@node Event Designators -@subsection Event Designators -@cindex event designators - -An @dfn{event designator} is a reference to a command line entry in the -history list. - -@table @asis - -@item @code{!} -Start a history subsititution, except when followed by a space, tab, or -the end of the line... @key{=} or @key{(}. - -@item @code{!!} -Refer to the previous command. This is a synonym for @code{!-1}. - -@item @code{!n} -Refer to command line @var{n}. - -@item @code{!-n} -Refer to the command line @var{n} lines back. - -@item @code{!string} -Refer to the most recent command starting with @var{string}. - -@item @code{!?string}[@code{?}] -Refer to the most recent command containing @var{string}. - -@end table - -@node Word Designators -@subsection Word Designators - -A @key{:} separates the event designator from the @dfn{word designator}. -It can be omitted if the word designator begins with a @key{^}, @key{$}, -@key{*} or @key{%}. Words are numbered from the beginning of the line, -with the first word being denoted by a 0 (zero). - -@table @code - -@item 0 (zero) -The zero'th word. For many applications, this is the command word. - -@item n -The @var{n}'th word. - -@item ^ -The first argument. that is, word 1. - -@item $ -The last argument. - -@item % -The word matched by the most recent @code{?string?} search. - -@item x-y -A range of words; @code{-@var{y}} Abbreviates @code{0-@var{y}}. - -@item * -All of the words, excepting the zero'th. This is a synonym for @code{1-$}. -It is not an error to use @key{*} if there is just one word in the event. -The empty string is returned in that case. - -@end table - -@node Modifiers -@subsection Modifiers - -After the optional word designator, you can add a sequence of one or more -of the following @dfn{modifiers}, each preceded by a @key{:}. - -@table @code - -@item # -The entire command line typed so far. This means the current command, -not the previous command. -@c -@c FIXME: If it doesn't belong here, let's put it where it does. -@c -@c so it technically isn't a word designator and doesn't belong in -@c this section. - -@item h -Remove a trailing pathname component, leaving only the head. - -@item r -Remove a trailing suffix of the form @samp{.}@var{suffix}, leaving the basename. - -@item e -Remove all but the suffix. - -@item t -Remove all leading pathname components, leaving the tail. - -@item p -Print the new command but do not execute it. -@end table diff --git a/contrib/gdb/readline/doc/rlman.texinfo b/contrib/gdb/readline/doc/rlman.texinfo deleted file mode 100644 index f2e7fb6..0000000 --- a/contrib/gdb/readline/doc/rlman.texinfo +++ /dev/null @@ -1,103 +0,0 @@ -\input texinfo @c -*-texinfo-*- -@comment %**start of header (This is for running Texinfo on a region.) -@setfilename readline.info -@settitle GNU Readline Library -@comment %**end of header (This is for running Texinfo on a region.) -@synindex vr fn -@setchapternewpage odd - -@ifinfo -This document describes the GNU Readline Library, a utility which aids -in the consistency of user interface across discrete programs that need -to provide a command line interface. - -Copyright (C) 1988, 1991 Free Software Foundation, Inc. - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -pare preserved on all copies. - -@ignore -Permission is granted to process this file through TeX and print the -results, provided the printed document carries copying permission -notice identical to this one except for the removal of this paragraph -(this paragraph not being relevant to the printed manual). -@end ignore - -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided that the entire -resulting derived work is distributed under the terms of a permission -notice identical to this one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions, -except that this permission notice may be stated in a translation approved -by the Foundation. -@end ifinfo - -@titlepage -@sp 10 -@center @titlefont{GNU Readline Library} -@center Brian Fox -@center Free Software Foundation -@center Version 1.1 -@center April 1991 - -@page -This document describes the GNU Readline Library, a utility which aids -in the consistency of user interface across discrete programs that need -to provide a command line interface. - -Published by the Free Software Foundation @* -675 Massachusetts Avenue, @* -Cambridge, MA 02139 USA - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided that the entire -resulting derived work is distributed under the terms of a permission -notice identical to this one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions, -except that this permission notice may be stated in a translation approved -by the Foundation. - -@vskip 0pt plus 1filll -Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc. -@end titlepage - -@ifinfo -@node Top -@top GNU Readline Library - -This document describes the GNU Readline Library, a utility which aids -in the consistency of user interface across discrete programs that need -to provide a command line interface. - -@menu -* Command Line Editing:: GNU Readline User's Manual. -* Programming with GNU Readline:: GNU Readline Programmer's Manual. -* Concept Index:: Index of concepts described in this manual. -* Function and Variable Index:: Index of externally visible functions - and variables. -@end menu -@end ifinfo - -@include rluser.texinfo -@include rltech.texinfo - -@node Concept Index -@unnumbered Concept Index -@printindex cp - -@node Function and Variable Index -@unnumbered Function and Variable Index -@printindex fn - -@contents -@bye - diff --git a/contrib/gdb/readline/doc/rltech.texinfo b/contrib/gdb/readline/doc/rltech.texinfo deleted file mode 100644 index 2048b7c..0000000 --- a/contrib/gdb/readline/doc/rltech.texinfo +++ /dev/null @@ -1,1012 +0,0 @@ -@comment %**start of header (This is for running Texinfo on a region.) -@setfilename rltech.info -@comment %**end of header (This is for running Texinfo on a region.) -@setchapternewpage odd - -@ifinfo -This document describes the GNU Readline Library, a utility for aiding -in the consitency of user interface across discrete programs that need -to provide a command line interface. - -Copyright (C) 1988 Free Software Foundation, Inc. - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -pare preserved on all copies. - -@ignore -Permission is granted to process this file through TeX and print the -results, provided the printed document carries copying permission -notice identical to this one except for the removal of this paragraph -(this paragraph not being relevant to the printed manual). -@end ignore - -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided that the entire -resulting derived work is distributed under the terms of a permission -notice identical to this one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions, -except that this permission notice may be stated in a translation approved -by the Foundation. -@end ifinfo - -@node Programming with GNU Readline -@chapter Programming with GNU Readline - -This manual describes the interface between the GNU Readline Library and -user programs. If you are a programmer, and you wish to include the -features found in GNU Readline in your own programs, such as completion, -line editing, and interactive history manipulation, this documentation -is for you. - -@menu -* Default Behaviour:: Using the default behaviour of Readline. -* Custom Functions:: Adding your own functions to Readline. -* Custom Completers:: Supplanting or supplementing Readline's - completion functions. -@end menu - -@node Default Behaviour -@section Default Behaviour - -Many programs provide a command line interface, such as @code{mail}, -@code{ftp}, and @code{sh}. For such programs, the default behaviour of -Readline is sufficient. This section describes how to use Readline in -the simplest way possible, perhaps to replace calls in your code to -@code{gets ()}. - -@findex readline () -@cindex readline, function -The function @code{readline} prints a prompt and then reads and returns -a single line of text from the user. The line which @code{readline ()} -returns is allocated with @code{malloc ()}; you should @code{free ()} -the line when you are done with it. The declaration for @code{readline} -in ANSI C is - -@example -@code{char *readline (char *@var{prompt});} -@end example - -So, one might say -@example -@code{char *line = readline ("Enter a line: ");} -@end example -in order to read a line of text from the user. - -The line which is returned has the final newline removed, so only the -text of the line remains. - -If readline encounters an @code{EOF} while reading the line, and the -line is empty at that point, then @code{(char *)NULL} is returned. -Otherwise, the line is ended just as if a newline was typed. - -If you want the user to be able to get at the line later, (with -@key{C-p} for example), you must call @code{add_history ()} to save the -line away in a @dfn{history} list of such lines. - -@example -@code{add_history (line)}; -@end example - -For full details on the GNU History Library, see the associated manual. - -It is polite to avoid saving empty lines on the history list, since it -is rare than someone has a burning need to reuse a blank line. Here is -a function which usefully replaces the standard @code{gets ()} library -function: - -@example -/* A static variable for holding the line. */ -static char *line_read = (char *)NULL; - -/* Read a string, and return a pointer to it. Returns NULL on EOF. */ -char * -do_gets () -@{ - /* If the buffer has already been allocated, return the memory - to the free pool. */ - if (line_read != (char *)NULL) - @{ - free (line_read); - line_read = (char *)NULL; - @} - - /* Get a line from the user. */ - line_read = readline (""); - - /* If the line has any text in it, save it on the history. */ - if (line_read && *line_read) - add_history (line_read); - - return (line_read); -@} -@end example - -The above code gives the user the default behaviour of @key{TAB} -completion: completion on file names. If you do not want readline to -complete on filenames, you can change the binding of the @key{TAB} key -with @code{rl_bind_key ()}. - -@findex rl_bind_key () -@example -@code{int rl_bind_key (int @var{key}, int (*@var{function})());} -@end example - -@code{rl_bind_key ()} takes 2 arguments; @var{key} is the character that -you want to bind, and @var{function} is the address of the function to -run when @var{key} is pressed. Binding @key{TAB} to @code{rl_insert ()} -makes @key{TAB} just insert itself. - -@code{rl_bind_key ()} returns non-zero if @var{key} is not a valid -ASCII character code (between 0 and 255). - -@example -@code{rl_bind_key ('\t', rl_insert);} -@end example - -This code should be executed once at the start of your program; you -might write a function called @code{initialize_readline ()} which -performs this and other desired initializations, such as installing -custom completers, etc. - -@node Custom Functions -@section Custom Functions - -Readline provides a great many functions for manipulating the text of -the line. But it isn't possible to anticipate the needs of all -programs. This section describes the various functions and variables -defined in within the Readline library which allow a user program to add -customized functionality to Readline. - -@menu -* The Function Type:: C declarations to make code readable. -* Function Naming:: How to give a function you write a name. -* Keymaps:: Making keymaps. -* Binding Keys:: Changing Keymaps. -* Function Writing:: Variables and calling conventions. -* Allowing Undoing:: How to make your functions undoable. -@end menu - -@node The Function Type -@subsection The Function Type - -For the sake of readabilty, we declare a new type of object, called -@dfn{Function}. A @code{Function} is a C language function which -returns an @code{int}. The type declaration for @code{Function} is: - -@noindent -@code{typedef int Function ();} - -The reason for declaring this new type is to make it easier to write -code describing pointers to C functions. Let us say we had a variable -called @var{func} which was a pointer to a function. Instead of the -classic C declaration - -@code{int (*)()func;} - -we have - -@code{Function *func;} - -@node Function Naming -@subsection Naming a Function - -The user can dynamically change the bindings of keys while using -Readline. This is done by representing the function with a descriptive -name. The user is able to type the descriptive name when referring to -the function. Thus, in an init file, one might find - -@example -Meta-Rubout: backward-kill-word -@end example - -This binds the keystroke @key{Meta-Rubout} to the function -@emph{descriptively} named @code{backward-kill-word}. You, as the -programmer, should bind the functions you write to descriptive names as -well. Readline provides a function for doing that: - -@defun rl_add_defun (char *name, Function *function, int key) -Add @var{name} to the list of named functions. Make @var{function} be -the function that gets called. If @var{key} is not -1, then bind it to -@var{function} using @code{rl_bind_key ()}. -@end defun - -Using this function alone is sufficient for most applications. It is -the recommended way to add a few functions to the default functions that -Readline has built in already. If you need to do more or different -things than adding a function to Readline, you may need to use the -underlying functions described below. - -@node Keymaps -@subsection Selecting a Keymap - -Key bindings take place on a @dfn{keymap}. The keymap is the -association between the keys that the user types and the functions that -get run. You can make your own keymaps, copy existing keymaps, and tell -Readline which keymap to use. - -@defun {Keymap rl_make_bare_keymap} () -Returns a new, empty keymap. The space for the keymap is allocated with -@code{malloc ()}; you should @code{free ()} it when you are done. -@end defun - -@defun {Keymap rl_copy_keymap} (Keymap map) -Return a new keymap which is a copy of @var{map}. -@end defun - -@defun {Keymap rl_make_keymap} () -Return a new keymap with the printing characters bound to rl_insert, -the lowercase Meta characters bound to run their equivalents, and -the Meta digits bound to produce numeric arguments. -@end defun - -@node Binding Keys -@subsection Binding Keys - -You associate keys with functions through the keymap. Here are -functions for doing that. - -@defun {int rl_bind_key} (int key, Function *function) -Binds @var{key} to @var{function} in the currently selected keymap. -Returns non-zero in the case of an invalid @var{key}. -@end defun - -@defun {int rl_bind_key_in_map} (int key, Function *function, Keymap map) -Bind @var{key} to @var{function} in @var{map}. Returns non-zero in the case -of an invalid @var{key}. -@end defun - -@defun {int rl_unbind_key} (int key) -Make @var{key} do nothing in the currently selected keymap. -Returns non-zero in case of error. -@end defun - -@defun {int rl_unbind_key_in_map} (int key, Keymap map) -Make @var{key} be bound to the null function in @var{map}. -Returns non-zero in case of error. -@end defun - -@defun rl_generic_bind (int type, char *keyseq, char *data, Keymap map) -Bind the key sequence represented by the string @var{keyseq} to the arbitrary -pointer @var{data}. @var{type} says what kind of data is pointed to by -@var{data}; right now this can be a function (@code{ISFUNC}), a macro -(@code{ISMACR}), or a keymap (@code{ISKMAP}). This makes new keymaps as -necessary. The initial place to do bindings is in @var{map}. -@end defun - -@node Function Writing -@subsection Writing a New Function - -In order to write new functions for Readline, you need to know the -calling conventions for keyboard invoked functions, and the names of the -variables that describe the current state of the line gathered so far. - -@defvar {char *rl_line_buffer} -This is the line gathered so far. You are welcome to modify the -contents of this, but see Undoing, below. -@end defvar - -@defvar {int rl_point} -The offset of the current cursor position in @var{rl_line_buffer}. -@end defvar - -@defvar {int rl_end} -The number of characters present in @code{rl_line_buffer}. When -@code{rl_point} is at the end of the line, then @code{rl_point} and -@code{rl_end} are equal. -@end defvar - -The calling sequence for a command @code{foo} looks like - -@example -@code{foo (int count, int key)} -@end example - -where @var{count} is the numeric argument (or 1 if defaulted) and -@var{key} is the key that invoked this function. - -It is completely up to the function as to what should be done with the -numeric argument; some functions use it as a repeat count, other -functions as a flag, and some choose to ignore it. In general, if a -function uses the numeric argument as a repeat count, it should be able -to do something useful with a negative argument as well as a positive -argument. At the very least, it should be aware that it can be passed a -negative argument. - -@node Allowing Undoing -@subsection Allowing Undoing - -Supporting the undo command is a painless thing to do, and makes your -functions much more useful to the end user. It is certainly easy to try -something if you know you can undo it. I could use an undo function for -the stock market. - -If your function simply inserts text once, or deletes text once, and it -calls @code{rl_insert_text ()} or @code{rl_delete_text ()} to do it, then -undoing is already done for you automatically, and you can safely skip -this section. - -If you do multiple insertions or multiple deletions, or any combination -of these operations, you should group them together into one operation. -This can be done with @code{rl_begin_undo_group ()} and -@code{rl_end_undo_group ()}. - -@defun rl_begin_undo_group () -Begins saving undo information in a group construct. The undo -information usually comes from calls to @code{rl_insert_text ()} and -@code{rl_delete_text ()}, but they could be direct calls to -@code{rl_add_undo ()}. -@end defun - -@defun rl_end_undo_group () -Closes the current undo group started with @code{rl_begin_undo_group -()}. There should be exactly one call to @code{rl_end_undo_group ()} -for every call to @code{rl_begin_undo_group ()}. -@end defun - -Finally, if you neither insert nor delete text, but directly modify the -existing text (e.g. change its case), you call @code{rl_modifying ()} -once, just before you modify the text. You must supply the indices of -the text range that you are going to modify. - -@defun rl_modifying (int start, int end) -Tell Readline to save the text between @var{start} and @var{end} as a -single undo unit. It is assumed that subsequent to this call you will -modify that range of text in some way. -@end defun - -@subsection An Example - -Here is a function which changes lowercase characters to the uppercase -equivalents, and uppercase characters to the lowercase equivalents. If -this function was bound to @samp{M-c}, then typing @samp{M-c} would -change the case of the character under point. Typing @samp{10 M-c} -would change the case of the following 10 characters, leaving the cursor on -the last character changed. - -@example -/* Invert the case of the COUNT following characters. */ -invert_case_line (count, key) - int count, key; -@{ - register int start, end; - - start = rl_point; - - if (count < 0) - @{ - direction = -1; - count = -count; - @} - else - direction = 1; - - /* Find the end of the range to modify. */ - end = start + (count * direction); - - /* Force it to be within range. */ - if (end > rl_end) - end = rl_end; - else if (end < 0) - end = -1; - - if (start > end) - @{ - int temp = start; - start = end; - end = temp; - @} - - if (start == end) - return; - - /* Tell readline that we are modifying the line, so save the undo - information. */ - rl_modifying (start, end); - - for (; start != end; start += direction) - @{ - if (uppercase_p (rl_line_buffer[start])) - rl_line_buffer[start] = to_lower (rl_line_buffer[start]); - else if (lowercase_p (rl_line_buffer[start])) - rl_line_buffer[start] = to_upper (rl_line_buffer[start]); - @} - /* Move point to on top of the last character changed. */ - rl_point = end - direction; -@} -@end example - -@node Custom Completers -@section Custom Completers - -Typically, a program that reads commands from the user has a way of -disambiguating commands and data. If your program is one of these, then -it can provide completion for either commands, or data, or both commands -and data. The following sections describe how your program and Readline -cooperate to provide this service to end users. - -@menu -* How Completing Works:: The logic used to do completion. -* Completion Functions:: Functions provided by Readline. -* Completion Variables:: Variables which control completion. -* A Short Completion Example:: An example of writing completer subroutines. -@end menu - -@node How Completing Works -@subsection How Completing Works - -In order to complete some text, the full list of possible completions -must be available. That is to say, it is not possible to accurately -expand a partial word without knowing what all of the possible words -that make sense in that context are. The GNU Readline library provides -the user interface to completion, and additionally, two of the most common -completion functions; filename and username. For completing other types -of text, you must write your own completion function. This section -describes exactly what those functions must do, and provides an example -function. - -There are three major functions used to perform completion: - -@enumerate -@item -The user-interface function @code{rl_complete ()}. This function is -called interactively with the same calling conventions as other -functions in readline intended for interactive use; i.e. @var{count}, -and @var{invoking-key}. It isolates the word to be completed and calls -@code{completion_matches ()} to generate a list of possible completions. -It then either lists the possible completions or actually performs the -completion, depending on which behaviour is desired. - -@item -The internal function @code{completion_matches ()} uses your -@dfn{generator} function to generate the list of possible matches, and -then returns the array of these matches. You should place the address -of your generator function in @code{rl_completion_entry_function}. - -@item -The generator function is called repeatedly from -@code{completion_matches ()}, returning a string each time. The -arguments to the generator function are @var{text} and @var{state}. -@var{text} is the partial word to be completed. @var{state} is zero the -first time the function is called, and a positive non-zero integer for -each subsequent call. When the generator function returns @code{(char -*)NULL} this signals @code{completion_matches ()} that there are no more -possibilities left. - -@end enumerate - -@defun rl_complete (int ignore, int invoking_key) -Complete the word at or before point. You have supplied the function -that does the initial simple matching selection algorithm (see -@code{completion_matches ()}). The default is to do filename completion. -@end defun - -Note that @code{rl_complete ()} has the identical calling conventions as -any other key-invokable function; this is because by default it is bound -to the @samp{TAB} key. - -@defvar {Function *rl_completion_entry_function} -This is a pointer to the generator function for @code{completion_matches -()}. If the value of @code{rl_completion_entry_function} is -@code{(Function *)NULL} then the default filename generator function is -used, namely @code{filename_entry_function ()}. -@end defvar - -@node Completion Functions -@subsection Completion Functions - -Here is the complete list of callable completion functions present in -Readline. - -@defun rl_complete_internal (int what_to_do) -Complete the word at or before point. @var{what_to_do} says what to do -with the completion. A value of @samp{?} means list the possible -completions. @samp{TAB} means do standard completion. @samp{*} means -insert all of the possible completions. -@end defun - -@defun rl_complete (int ignore, int invoking_key) -Complete the word at or before point. You have supplied the function -that does the initial simple matching selection algorithm (see -@code{completion_matches ()}). The default is to do filename -completion. This just calls @code{rl_complete_internal ()} with an -argument of @samp{TAB}. -@end defun - -@defun rl_possible_completions () -List the possible completions. See description of @code{rl_complete -()}. This just calls @code{rl_complete_internal ()} with an argument of -@samp{?}. -@end defun - -@defun {char **completion_matches} (char *text, char *(*entry_function) ()) -Returns an array of @code{(char *)} which is a list of completions for -@var{text}. If there are no completions, returns @code{(char **)NULL}. -The first entry in the returned array is the substitution for @var{text}. -The remaining entries are the possible completions. The array is -terminated with a @code{NULL} pointer. - -@var{entry_function} is a function of two args, and returns a -@code{(char *)}. The first argument is @var{text}. The second is a -state argument; it is zero on the first call, and non-zero on subsequent -calls. It returns a @code{NULL} pointer to the caller when there are -no more matches. -@end defun - -@defun {char *filename_completion_function} (char *text, int state) -A generator function for filename completion in the general case. Note -that completion in the Bash shell is a little different because of all -the pathnames that must be followed when looking up the completion for a -command. -@end defun - -@defun {char *username_completion_function} (char *text, int state) -A completion generator for usernames. @var{text} contains a partial -username preceded by a random character (usually @samp{~}). -@end defun - -@node Completion Variables -@subsection Completion Variables - -@defvar {Function *rl_completion_entry_function} -A pointer to the generator function for @code{completion_matches ()}. -@code{NULL} means to use @code{filename_entry_function ()}, the default -filename completer. -@end defvar - -@defvar {Function *rl_attempted_completion_function} -A pointer to an alternative function to create matches. -The function is called with @var{text}, @var{start}, and @var{end}. -@var{start} and @var{end} are indices in @code{rl_line_buffer} saying -what the boundaries of @var{text} are. If this function exists and -returns @code{NULL} then @code{rl_complete ()} will call the value of -@code{rl_completion_entry_function} to generate matches, otherwise the -array of strings returned will be used. -@end defvar - -@defvar {int rl_completion_query_items} -Up to this many items will be displayed in response to a -possible-completions call. After that, we ask the user if she is sure -she wants to see them all. The default value is 100. -@end defvar - -@defvar {char *rl_basic_word_break_characters} -The basic list of characters that signal a break between words for the -completer routine. The contents of this variable is what breaks words -in the Bash shell, i.e. " \t\n\"\\'`@@$><=;|&@{(". -@end defvar - -@defvar {char *rl_completer_word_break_characters} -The list of characters that signal a break between words for -@code{rl_complete_internal ()}. The default list is the contents of -@code{rl_basic_word_break_characters}. -@end defvar - -@defvar {char *rl_special_prefixes} -The list of characters that are word break characters, but should be -left in @var{text} when it is passed to the completion function. -Programs can use this to help determine what kind of completing to do. -@end defvar - -@defvar {int rl_ignore_completion_duplicates} -If non-zero, then disallow duplicates in the matches. Default is 1. -@end defvar - -@defvar {int rl_filename_completion_desired} -Non-zero means that the results of the matches are to be treated as -filenames. This is @emph{always} zero on entry, and can only be changed -within a completion entry generator function. -@end defvar - -@defvar {Function *rl_ignore_some_completions_function} -This function, if defined, is called by the completer when real filename -completion is done, after all the matching names have been generated. -It is passed a @code{NULL} terminated array of @code{(char *)} known as -@var{matches} in the code. The 1st element (@code{matches[0]}) is the -maximal substring that is common to all matches. This function can -re-arrange the list of matches as required, but each deleted element of -the array must be @code{free()}'d. -@end defvar - -@node A Short Completion Example -@subsection A Short Completion Example - -Here is a small application demonstrating the use of the GNU Readline -library. It is called @code{fileman}, and the source code resides in -@file{readline/examples/fileman.c}. This sample application provides -completion of command names, line editing features, and access to the -history list. - -@page -@smallexample -/* fileman.c -- A tiny application which demonstrates how to use the - GNU Readline library. This application interactively allows users - to manipulate files and their modes. */ - -#include -#include -#include -#include -#include -#include -#include - -/* The names of functions that actually do the manipulation. */ -int com_list (), com_view (), com_rename (), com_stat (), com_pwd (); -int com_delete (), com_help (), com_cd (), com_quit (); - -/* A structure which contains information on the commands this program - can understand. */ - -typedef struct @{ - char *name; /* User printable name of the function. */ - Function *func; /* Function to call to do the job. */ - char *doc; /* Documentation for this function. */ -@} COMMAND; - -COMMAND commands[] = @{ - @{ "cd", com_cd, "Change to directory DIR" @}, - @{ "delete", com_delete, "Delete FILE" @}, - @{ "help", com_help, "Display this text" @}, - @{ "?", com_help, "Synonym for `help'" @}, - @{ "list", com_list, "List files in DIR" @}, - @{ "ls", com_list, "Synonym for `list'" @}, - @{ "pwd", com_pwd, "Print the current working directory" @}, - @{ "quit", com_quit, "Quit using Fileman" @}, - @{ "rename", com_rename, "Rename FILE to NEWNAME" @}, - @{ "stat", com_stat, "Print out statistics on FILE" @}, - @{ "view", com_view, "View the contents of FILE" @}, - @{ (char *)NULL, (Function *)NULL, (char *)NULL @} -@}; - -/* The name of this program, as taken from argv[0]. */ -char *progname; - -/* When non-zero, this global means the user is done using this program. */ -int done = 0; -@page -main (argc, argv) - int argc; - char **argv; -@{ - progname = argv[0]; - - initialize_readline (); /* Bind our completer. */ - - /* Loop reading and executing lines until the user quits. */ - while (!done) - @{ - char *line; - - line = readline ("FileMan: "); - - if (!line) - @{ - done = 1; /* Encountered EOF at top level. */ - @} - else - @{ - /* Remove leading and trailing whitespace from the line. - Then, if there is anything left, add it to the history list - and execute it. */ - stripwhite (line); - - if (*line) - @{ - add_history (line); - execute_line (line); - @} - @} - - if (line) - free (line); - @} - exit (0); -@} - -/* Execute a command line. */ -execute_line (line) - char *line; -@{ - register int i; - COMMAND *find_command (), *command; - char *word; - - /* Isolate the command word. */ - i = 0; - while (line[i] && !whitespace (line[i])) - i++; - - word = line; - - if (line[i]) - line[i++] = '\0'; - - command = find_command (word); - - if (!command) - @{ - fprintf (stderr, "%s: No such command for FileMan.\n", word); - return; - @} - - /* Get argument to command, if any. */ - while (whitespace (line[i])) - i++; - - word = line + i; - - /* Call the function. */ - (*(command->func)) (word); -@} - -/* Look up NAME as the name of a command, and return a pointer to that - command. Return a NULL pointer if NAME isn't a command name. */ -COMMAND * -find_command (name) - char *name; -@{ - register int i; - - for (i = 0; commands[i].name; i++) - if (strcmp (name, commands[i].name) == 0) - return (&commands[i]); - - return ((COMMAND *)NULL); -@} - -/* Strip whitespace from the start and end of STRING. */ -stripwhite (string) - char *string; -@{ - register int i = 0; - - while (whitespace (string[i])) - i++; - - if (i) - strcpy (string, string + i); - - i = strlen (string) - 1; - - while (i > 0 && whitespace (string[i])) - i--; - - string[++i] = '\0'; -@} -@page -/* **************************************************************** */ -/* */ -/* Interface to Readline Completion */ -/* */ -/* **************************************************************** */ - -/* Tell the GNU Readline library how to complete. We want to try to complete - on command names if this is the first word in the line, or on filenames - if not. */ -initialize_readline () -@{ - char **fileman_completion (); - - /* Allow conditional parsing of the ~/.inputrc file. */ - rl_readline_name = "FileMan"; - - /* Tell the completer that we want a crack first. */ - rl_attempted_completion_function = (Function *)fileman_completion; -@} - -/* Attempt to complete on the contents of TEXT. START and END show the - region of TEXT that contains the word to complete. We can use the - entire line in case we want to do some simple parsing. Return the - array of matches, or NULL if there aren't any. */ -char ** -fileman_completion (text, start, end) - char *text; - int start, end; -@{ - char **matches; - char *command_generator (); - - matches = (char **)NULL; - - /* If this word is at the start of the line, then it is a command - to complete. Otherwise it is the name of a file in the current - directory. */ - if (start == 0) - matches = completion_matches (text, command_generator); - - return (matches); -@} - -/* Generator function for command completion. STATE lets us know whether - to start from scratch; without any state (i.e. STATE == 0), then we - start at the top of the list. */ -char * -command_generator (text, state) - char *text; - int state; -@{ - static int list_index, len; - char *name; - - /* If this is a new word to complete, initialize now. This includes - saving the length of TEXT for efficiency, and initializing the index - variable to 0. */ - if (!state) - @{ - list_index = 0; - len = strlen (text); - @} - - /* Return the next name which partially matches from the command list. */ - while (name = commands[list_index].name) - @{ - list_index++; - - if (strncmp (name, text, len) == 0) - return (name); - @} - - /* If no names matched, then return NULL. */ - return ((char *)NULL); -@} -@page -/* **************************************************************** */ -/* */ -/* FileMan Commands */ -/* */ -/* **************************************************************** */ - -/* String to pass to system (). This is for the LIST, VIEW and RENAME - commands. */ -static char syscom[1024]; - -/* List the file(s) named in arg. */ -com_list (arg) - char *arg; -@{ - if (!arg) - arg = "*"; - - sprintf (syscom, "ls -FClg %s", arg); - system (syscom); -@} - -com_view (arg) - char *arg; -@{ - if (!valid_argument ("view", arg)) - return; - - sprintf (syscom, "cat %s | more", arg); - system (syscom); -@} - -com_rename (arg) - char *arg; -@{ - too_dangerous ("rename"); -@} - -com_stat (arg) - char *arg; -@{ - struct stat finfo; - - if (!valid_argument ("stat", arg)) - return; - - if (stat (arg, &finfo) == -1) - @{ - perror (arg); - return; - @} - - printf ("Statistics for `%s':\n", arg); - - printf ("%s has %d link%s, and is %d bytes in length.\n", arg, - finfo.st_nlink, (finfo.st_nlink == 1) ? "" : "s", finfo.st_size); - printf (" Created on: %s", ctime (&finfo.st_ctime)); - printf (" Last access at: %s", ctime (&finfo.st_atime)); - printf ("Last modified at: %s", ctime (&finfo.st_mtime)); -@} - -com_delete (arg) - char *arg; -@{ - too_dangerous ("delete"); -@} - -/* Print out help for ARG, or for all of the commands if ARG is - not present. */ -com_help (arg) - char *arg; -@{ - register int i; - int printed = 0; - - for (i = 0; commands[i].name; i++) - @{ - if (!*arg || (strcmp (arg, commands[i].name) == 0)) - @{ - printf ("%s\t\t%s.\n", commands[i].name, commands[i].doc); - printed++; - @} - @} - - if (!printed) - @{ - printf ("No commands match `%s'. Possibilties are:\n", arg); - - for (i = 0; commands[i].name; i++) - @{ - /* Print in six columns. */ - if (printed == 6) - @{ - printed = 0; - printf ("\n"); - @} - - printf ("%s\t", commands[i].name); - printed++; - @} - - if (printed) - printf ("\n"); - @} -@} - -/* Change to the directory ARG. */ -com_cd (arg) - char *arg; -@{ - if (chdir (arg) == -1) - perror (arg); - - com_pwd (""); -@} - -/* Print out the current working directory. */ -com_pwd (ignore) - char *ignore; -@{ - char dir[1024]; - - (void) getwd (dir); - - printf ("Current directory is %s\n", dir); -@} - -/* The user wishes to quit using this program. Just set DONE non-zero. */ -com_quit (arg) - char *arg; -@{ - done = 1; -@} - -/* Function which tells you that you can't do this. */ -too_dangerous (caller) - char *caller; -@{ - fprintf (stderr, - "%s: Too dangerous for me to distribute. Write it yourself.\n", - caller); -@} - -/* Return non-zero if ARG is a valid argument for CALLER, else print - an error message and return zero. */ -int -valid_argument (caller, arg) - char *caller, *arg; -@{ - if (!arg || !*arg) - @{ - fprintf (stderr, "%s: Argument required.\n", caller); - return (0); - @} - - return (1); -@} -@end smallexample diff --git a/contrib/gdb/readline/doc/rluser.texinfo b/contrib/gdb/readline/doc/rluser.texinfo deleted file mode 100644 index da11111..0000000 --- a/contrib/gdb/readline/doc/rluser.texinfo +++ /dev/null @@ -1,566 +0,0 @@ -@ignore -This file documents the end user interface to the GNU command line -editing feautres. It is to be an appendix to manuals for programs which -use these features. There is a document entitled "readline.texinfo" -which contains both end-user and programmer documentation for the GNU -Readline Library. - -Copyright (C) 1988 Free Software Foundation, Inc. - -Authored by Brian Fox. - -Permission is granted to process this file through Tex and print the -results, provided the printed document carries copying permission notice -identical to this one except for the removal of this paragraph (this -paragraph not being relevant to the printed manual). - -Permission is granted to make and distribute verbatim copies of this manual -provided the copyright notice and this permission notice are preserved on -all copies. - -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided also that the -GNU Copyright statement is available to the distributee, and provided that -the entire resulting derived work is distributed under the terms of a -permission notice identical to this one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions. -@end ignore - -@node Command Line Editing -@appendix Command Line Editing - -This text describes GNU's command line editing interface. - -@menu -* Introduction and Notation:: Notation used in this text. -* Readline Interaction:: The minimum set of commands for editing a line. -* Readline Init File:: Customizing Readline from a user's view. -@end menu - -@node Introduction and Notation -@section Introduction to Line Editing - -The following paragraphs describe the notation we use to represent -keystrokes. - -The text @key{C-k} is read as `Control-K' and describes the character -produced when the Control key is depressed and the @key{k} key is struck. - -The text @key{M-k} is read as `Meta-K' and describes the character -produced when the meta key (if you have one) is depressed, and the @key{k} -key is struck. If you do not have a meta key, the identical keystroke -can be generated by typing @key{ESC} @i{first}, and then typing @key{k}. -Either process is known as @dfn{metafying} the @key{k} key. - -The text @key{M-C-k} is read as `Meta-Control-k' and describes the -character produced by @dfn{metafying} @key{C-k}. - -In addition, several keys have their own names. Specifically, -@key{DEL}, @key{ESC}, @key{LFD}, @key{SPC}, @key{RET}, and @key{TAB} all -stand for themselves when seen in this text, or in an init file -(@pxref{Readline Init File}, for more info). - -@node Readline Interaction -@section Readline Interaction -@cindex interaction, readline - -Often during an interactive session you type in a long line of text, -only to notice that the first word on the line is misspelled. The -Readline library gives you a set of commands for manipulating the text -as you type it in, allowing you to just fix your typo, and not forcing -you to retype the majority of the line. Using these editing commands, -you move the cursor to the place that needs correction, and delete or -insert the text of the corrections. Then, when you are satisfied with -the line, you simply press @key{RET}. You do not have to be at the -end of the line to press @key{RET}; the entire line is accepted -regardless of the location of the cursor within the line. - -@menu -* Readline Bare Essentials:: The least you need to know about Readline. -* Readline Movement Commands:: Moving about the input line. -* Readline Killing Commands:: How to delete text, and how to get it back! -* Readline Arguments:: Giving numeric arguments to commands. -@end menu - -@node Readline Bare Essentials -@subsection Readline Bare Essentials - -In order to enter characters into the line, simply type them. The typed -character appears where the cursor was, and then the cursor moves one -space to the right. If you mistype a character, you can use @key{DEL} to -back up, and delete the mistyped character. - -Sometimes you may miss typing a character that you wanted to type, and -not notice your error until you have typed several other characters. In -that case, you can type @key{C-b} to move the cursor to the left, and then -correct your mistake. Aftwerwards, you can move the cursor to the right -with @key{C-f}. - -When you add text in the middle of a line, you will notice that characters -to the right of the cursor get `pushed over' to make room for the text -that you have inserted. Likewise, when you delete text behind the cursor, -characters to the right of the cursor get `pulled back' to fill in the -blank space created by the removal of the text. A list of the basic bare -essentials for editing the text of an input line follows. - -@table @asis -@item @key{C-b} -Move back one character. -@item @key{C-f} -Move forward one character. -@item @key{DEL} -Delete the character to the left of the cursor. -@item @key{C-d} -Delete the character underneath the cursor. -@item @w{Printing characters} -Insert itself into the line at the cursor. -@item @key{C-_} -Undo the last thing that you did. You can undo all the way back to an -empty line. -@end table - -@node Readline Movement Commands -@subsection Readline Movement Commands - -The above table describes the most basic possible keystrokes that you need -in order to do editing of the input line. For your convenience, many -other commands have been added in addition to @key{C-b}, @key{C-f}, -@key{C-d}, and @key{DEL}. Here are some commands for moving more rapidly -about the line. - -@table @key -@item C-a -Move to the start of the line. -@item C-e -Move to the end of the line. -@item M-f -Move forward a word. -@item M-b -Move backward a word. -@item C-l -Clear the screen, reprinting the current line at the top. -@end table - -Notice how @key{C-f} moves forward a character, while @key{M-f} moves -forward a word. It is a loose convention that control keystrokes -operate on characters while meta keystrokes operate on words. - -@node Readline Killing Commands -@subsection Readline Killing Commands - -@dfn{Killing} text means to delete the text from the line, but to save -it away for later use, usually by @dfn{yanking} it back into the line. -If the description for a command says that it `kills' text, then you can -be sure that you can get the text back in a different (or the same) -place later. - -Here is the list of commands for killing text. - -@table @key -@item C-k -Kill the text from the current cursor position to the end of the line. - -@item M-d -Kill from the cursor to the end of the current word, or if between -words, to the end of the next word. - -@item M-DEL -Kill from the cursor to the start of the previous word, or if between -words, to the start of the previous word. - -@item C-w -Kill from the cursor to the previous whitespace. This is different than -@key{M-DEL} because the word boundaries differ. - -@end table - -And, here is how to @dfn{yank} the text back into the line. - -@table @key -@item C-y -Yank the most recently killed text back into the buffer at the cursor. - -@item M-y -Rotate the kill-ring, and yank the new top. You can only do this if -the prior command is @key{C-y} or @key{M-y}. -@end table - -When you use a kill command, the text is saved in a @dfn{kill-ring}. -Any number of consecutive kills save all of the killed text together, so -that when you yank it back, you get it in one clean sweep. The kill -ring is not line specific; the text that you killed on a previously -typed line is available to be yanked back later, when you are typing -another line. - -@node Readline Arguments -@subsection Readline Arguments - -You can pass numeric arguments to Readline commands. Sometimes the -argument acts as a repeat count, other times it is the @i{sign} of the -argument that is significant. If you pass a negative argument to a -command which normally acts in a forward direction, that command will -act in a backward direction. For example, to kill text back to the -start of the line, you might type @key{M--} @key{C-k}. - -The general way to pass numeric arguments to a command is to type meta -digits before the command. If the first `digit' you type is a minus -sign (@key{-}), then the sign of the argument will be negative. Once -you have typed one meta digit to get the argument started, you can type -the remainder of the digits, and then the command. For example, to give -the @key{C-d} command an argument of 10, you could type @key{M-1 0 C-d}. - - -@node Readline Init File -@section Readline Init File - -Although the Readline library comes with a set of @sc{gnu} Emacs-like -keybindings, it is possible that you would like to use a different set -of keybindings. You can customize programs that use Readline by putting -commands in an @dfn{init} file in your home directory. The name of this -file is @file{~/.inputrc}. - -When a program which uses the Readline library starts up, the -@file{~/.inputrc} file is read, and the keybindings are set. - -In addition, the @key{C-x C-r} command re-reads this init file, thus -incorporating any changes that you might have made to it. - -@menu -* Readline Init Syntax:: Syntax for the commands in @file{~/.inputrc}. -* Readline vi Mode:: Switching to @code{vi} mode in Readline. -@end menu - -@node Readline Init Syntax -@subsection Readline Init Syntax - -There are only four constructs allowed in the @file{~/.inputrc} -file: - -@table @asis -@item Variable Settings -You can change the state of a few variables in Readline. You do this by -using the @code{set} command within the init file. Here is how you -would specify that you wish to use @code{vi} line editing commands: - -@example -set editing-mode vi -@end example - -Right now, there are only a few variables which can be set; so few in -fact, that we just iterate them here: - -@table @code - -@item editing-mode -@vindex editing-mode -The @code{editing-mode} variable controls which editing mode you are -using. By default, @sc{gnu} Readline starts up in Emacs editing mode, where -the keystrokes are most similar to Emacs. This variable can either be -set to @code{emacs} or @code{vi}. - -@item horizontal-scroll-mode -@vindex horizontal-scroll-mode -This variable can either be set to @code{On} or @code{Off}. Setting it -to @code{On} means that the text of the lines that you edit will scroll -horizontally on a single screen line when they are larger than the width -of the screen, instead of wrapping onto a new screen line. By default, -this variable is set to @code{Off}. - -@item mark-modified-lines -@vindex mark-modified-lines -This variable when set to @code{On}, says to display an asterisk -(@samp{*}) at the starts of history lines which have been modified. -This variable is off by default. - -@item prefer-visible-bell -@vindex prefer-visible-bell -If this variable is set to @code{On} it means to use a visible bell if -one is available, rather than simply ringing the terminal bell. By -default, the value is @code{Off}. -@end table - -@item Key Bindings -The syntax for controlling keybindings in the @file{~/.inputrc} file is -simple. First you have to know the @i{name} of the command that you -want to change. The following pages contain tables of the command name, -the default keybinding, and a short description of what the command -does. - -Once you know the name of the command, simply place the name of the key -you wish to bind the command to, a colon, and then the name of the -command on a line in the @file{~/.inputrc} file. The name of the key -can be expressed in different ways, depending on which is most -comfortable for you. - -@table @asis -@item @w{@var{keyname}: @var{function-name} or @var{macro}} -@var{keyname} is the name of a key spelled out in English. For example: -@example -Control-u: universal-argument -Meta-Rubout: backward-kill-word -Control-o: ">&output" -@end example - -In the above example, @key{C-u} is bound to the function -@code{universal-argument}, and @key{C-o} is bound to run the macro -expressed on the right hand side (that is, to insert the text -@samp{>&output} into the line). - -@item @w{"@var{keyseq}": @var{function-name} or @var{macro}} -@var{keyseq} differs from @var{keyname} above in that strings denoting -an entire key sequence can be specified. Simply place the key sequence -in double quotes. @sc{gnu} Emacs style key escapes can be used, as in the -following example: - -@example -"\C-u": universal-argument -"\C-x\C-r": re-read-init-file -"\e[11~": "Function Key 1" -@end example - -In the above example, @key{C-u} is bound to the function -@code{universal-argument} (just as it was in the first example), -@key{C-x C-r} is bound to the function @code{re-read-init-file}, and -@key{ESC [ 1 1 ~} is bound to insert the text @samp{Function Key 1}. - -@end table -@end table - -@menu -* Commands For Moving:: Moving about the line. -* Commands For History:: Getting at previous lines. -* Commands For Text:: Commands for changing text. -* Commands For Killing:: Commands for killing and yanking. -* Numeric Arguments:: Specifying numeric arguments, repeat counts. -* Commands For Completion:: Getting Readline to do the typing for you. -* Miscellaneous Commands:: Other miscillaneous commands. -@end menu - -@need 2000 -@node Commands For Moving -@subsubsection Commands For Moving - -@ftable @code -@item beginning-of-line (@key{C-a}) -Move to the start of the current line. - -@item end-of-line (@key{C-e}) -Move to the end of the line. - -@item forward-char (@key{C-f}) -Move forward a character. - -@item backward-char (@key{C-b}) -Move back a character. - -@item forward-word (@key{M-f}) -Move forward to the end of the next word. - -@item backward-word (@key{M-b}) -Move back to the start of this, or the previous, word. - -@item clear-screen (@key{C-l}) -Clear the screen leaving the current line at the top of the screen. - -@end ftable - -@need 2000 -@node Commands For History -@subsubsection Commands For Manipulating The History - -@ftable @code -@item accept-line (Newline, Return) -Accept the line regardless of where the cursor is. If this line is -non-empty, add it to the history list. If this line was a history -line, then restore the history line to its original state. - -@item previous-history (@key{C-p}) -Move `up' through the history list. - -@item next-history (@key{C-n}) -Move `down' through the history list. - -@item beginning-of-history (@key{M-<}) -Move to the first line in the history. - -@item end-of-history (@key{M->}) -Move to the end of the input history, i.e., the line you are entering. - -@item reverse-search-history (@key{C-r}) -Search backward starting at the current line and moving `up' through -the history as necessary. This is an incremental search. - -@item forward-search-history (@key{C-s}) -Search forward starting at the current line and moving `down' through -the the history as necessary. - -@end ftable - -@need 2000 -@node Commands For Text -@subsubsection Commands For Changing Text - -@ftable @code -@item delete-char (@key{C-d}) -Delete the character under the cursor. If the cursor is at the -beginning of the line, and there are no characters in the line, and -the last character typed was not @key{C-d}, then return EOF. - -@item backward-delete-char (Rubout) -Delete the character behind the cursor. A numeric argument says to kill -the characters instead of deleting them. - -@item quoted-insert (@key{C-q}, @key{C-v}) -Add the next character that you type to the line verbatim. This is -how to insert things like @key{C-q} for example. - -@item tab-insert (@key{M-TAB}) -Insert a tab character. - -@item self-insert (a, b, A, 1, !, ...) -Insert yourself. - -@item transpose-chars (@key{C-t}) -Drag the character before point forward over the character at point. -Point moves forward as well. If point is at the end of the line, then -transpose the two characters before point. Negative arguments don't work. - -@item transpose-words (@key{M-t}) -Drag the word behind the cursor past the word in front of the cursor -moving the cursor over that word as well. - -@item upcase-word (@key{M-u}) -Uppercase all letters in the current (or following) word. With a -negative argument, do the previous word, but do not move point. - -@item downcase-word (@key{M-l}) -Lowercase all letters in the current (or following) word. With a -negative argument, do the previous word, but do not move point. - -@item capitalize-word (@key{M-c}) -Uppercase the first letter in the current (or following) word. With a -negative argument, do the previous word, but do not move point. - -@end ftable - -@need 2000 -@node Commands For Killing -@subsubsection Killing And Yanking - -@ftable @code -@item kill-line (@key{C-k}) -Kill the text from the current cursor position to the end of the line. - -@item backward-kill-line () -Kill backward to the beginning of the line. This is normally unbound. - -@item kill-word (@key{M-d}) -Kill from the cursor to the end of the current word, or if between -words, to the end of the next word. - -@item backward-kill-word (@key{M-DEL}) -Kill the word behind the cursor. - -@item unix-line-discard (@key{C-u}) -Kill the whole line the way @key{C-u} used to in Unix line input. -The killed text is saved on the kill-ring. - -@item unix-word-rubout (@key{C-w}) -Kill the word the way @key{C-w} used to in Unix line input. -The killed text is saved on the kill-ring. This is different than -backward-kill-word because the word boundaries differ. - -@item yank (@key{C-y}) -Yank the top of the kill ring into the buffer at point. - -@item yank-pop (@key{M-y}) -Rotate the kill-ring, and yank the new top. You can only do this if -the prior command is yank or yank-pop. -@end ftable - -@need 2000 -@node Numeric Arguments -@subsubsection Specifying Numeric Arguments - -@ftable @code - -@item digit-argument (@key{M-0}, @key{M-1}, ... @key{M--}) -Add this digit to the argument already accumulating, or start a new -argument. @key{M--} starts a negative argument. - -@item universal-argument () -Do what @key{C-u} does in @sc{gnu} Emacs. By default, this is not bound. -@end ftable - - -@need 2000 -@node Commands For Completion -@subsubsection Letting Readline Type For You - -@ftable @code -@item complete (TAB) -Attempt to do completion on the text before point. This is -implementation defined. Generally, if you are typing a filename -argument, you can do filename completion; if you are typing a command, -you can do command completion, if you are typing in a symbol to GDB, you -can do symbol name completion, if you are typing in a variable to Bash, -you can do variable name completion. - -@item possible-completions (M-?) -List the possible completions of the text before point. -@end ftable - -@need 2000 -@node Miscellaneous Commands -@subsubsection Some Miscellaneous Commands - -@ftable @code - -@item re-read-init-file (@key{C-x} @key{C-r}) -Read in the contents of your @file{~/.inputrc} file, and incorporate -any bindings found there. - -@item abort (@key{C-g}) -Stop running the current editing command. - -@ignore -@c I have no idea what this means, and can't figure it out by -@c experiment, and can't find it in the readline source. -@c doc@cygnus.com, 20may1993. -@item do-uppercase-version (@key{M-a}, @key{M-b}, ...) -Run the command that is bound to your uppercase brother. -@end ignore - -@item prefix-meta (ESC) -Make the next character that you type be metafied. This is for people -without a meta key. Typing @key{ESC f} is equivalent to typing -@key{M-f}. - -@item undo (@key{C-_}) -Incremental undo, separately remembered for each line. - -@item revert-line (@key{M-r}) -Undo all changes made to this line. This is like typing the `undo' -command enough times to get back to the beginning. -@end ftable - -@need 2000 -@node Readline vi Mode -@subsection Readline @code{vi} Mode - -@cindex @code{vi} style command editing -@kindex toggle-editing-mode -While the Readline library does not have a full set of @code{vi} editing -functions, it does contain enough to allow simple editing of the line. - -In order to switch interactively between @sc{gnu} Emacs and @code{vi} -editing modes, use the command @key{M-C-j} (toggle-editing-mode). - -When you enter a line in @code{vi} mode, you are already placed in `insertion' -mode, as if you had typed an `i'. Pressing @key{ESC} switches you into -`edit' mode, where you can edit the text of the line with the standard -@code{vi} movement keys, move to previous history lines with `k', and following -lines with `j', and so forth. - -- cgit v1.1