From 0f71a2f66f83f4c7ac139fa8d33ab882362fe861 Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Mon, 14 Jun 1999 18:08:47 +0000 Subject: [PATCH] import gdb-1999-06-14 snapshot --- gdb/ChangeLog | 459 ++++ gdb/ChangeLog-98 | 56 + gdb/MAINTAINERS | 2 + gdb/Makefile.in | 2 +- gdb/config/d10v/tm-d10v.h | 10 + gdb/config/mips/tm-mips.h | 6 +- gdb/config/mn10300/tm-mn10300.h | 30 +- gdb/d10v-tdep.c | 112 +- gdb/defs.h | 24 +- gdb/doc/gdbint.texinfo | 9 + gdb/event-loop.c | 3 +- gdb/event-loop.h | 15 +- gdb/event-top.c | 273 ++- gdb/exec.c | 38 + gdb/findvar.c | 146 +- gdb/gdbarch.c | 2866 ++++++++++++++++++++++++- gdb/gdbarch.h | 909 +++++++- gdb/gdbtypes.c | 31 + gdb/inferior.h | 20 + gdb/infrun.c | 3 + gdb/main.c | 26 +- gdb/mips-tdep.c | 11 +- gdb/mn10300-tdep.c | 62 +- gdb/parse.c | 11 + gdb/partial-stab.h | 18 +- gdb/remote.c | 805 ++++++- gdb/rs6000-tdep.c | 2 +- gdb/testsuite/ChangeLog | 16 + gdb/testsuite/gdb.base/annota1.exp | 6 + gdb/testsuite/gdb.base/call-strs.c | 5 + gdb/testsuite/gdb.base/ending-run.exp | 2 + gdb/top.c | 2383 +------------------- gdb/top.h | 12 + gdb/tracepoint.c | 7 +- gdb/utils.c | 89 +- gdb/value.h | 2 + gdb/values.c | 26 + 37 files changed, 5862 insertions(+), 2635 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 75d8426cc1c..8c72e762a33 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,267 @@ +1999-06-14 Stan Shebs + + * MAINTAINERS: Add Jimmy Guo and Jim Blandy as HP testsuite and + SVR4 solib maintainers, respectively. + +1999-06-14 Michael Snyder + + Add parameters to the gdb prompt. + * top.c (prompt): Rename to gdb_prompt_string for clarity. + (command_line_input): rename "prrompt" to prompt_arg for clarity. + (gdb_readline): rename "prrompt" to prompt_arg for clarity. + (read_command_lines): rename "prompt" to prompt_arg for clarity. + (stop_sig): call get_prompt instead of reading prompt string directly. + (command_loop): ditto. + (simplified_command_loop): ditto. + (gdb_prompt_escape): New variable. Esc char for prompt parameters. + (get_prompt_1): New function, workhorse for get_prompt. + (get_prompt): Completely rewrite. Add functionality for a + parameterized prompt, ie. the displayed prompt can change according + to the value of one or more expressions given as parameters in the + prompt string. + (init_main): use renamed variable gdb_prompt_string. Add new + command "set prompt-escape-char" to set gdb_prompt_escape. + +Sun Jun 13 10:44:13 1999 Andrew Cagney + + * defs.h (gdb_stdlog), main.c: Declare. + * main.c (main): Initialize. + * gdbarch.c: Write trace messages to the log file. + * remote.c: Update any debug/log prints. + +1999-06-11 Michael Snyder + + * remote.c (remote_wait): Clean up new thread handling. + (record_currthread): Announce new threads. + +1999-06-11 Jim Blandy + + * partial-stab.h (case N_LSYM, 'T' descriptor): Don't create + partial symbol table entries for nameless enums, even if the type + name is " ". (We still pick up the enum elements, though.) + + * partial-stab.h: Remove #if 0'd sections, dating back to 1992, + which set a variable which exists nowhere else in the source. + Please examine your test suite output carefully, and report any + problems to me. + +1999-06-11 Elena Zannoni + + * event-top.c (setup_event_loop): Change name to start_event_loop. + Move the intialization of event-loop variables to + _initialize_event_loop. + (_initialize_event_loop): New function. Called at init time, to + set up important event-loop variables. + + * event-loop.h: setup_event_loop is now start_event_loop. + * main.c (main): Ditto. + +Fri Jun 11 18:34:33 1999 Andrew Cagney + + * defs.h (gdb_file_rewind_ftype, gdb_file_rewind, + set_gdb_file_rewind, gdb_file_put_ftype, gdb_file_put, + set_gdb_file_put): Declare. + + * utils.c (gdb_file_new): Initialize ``rewind'' and ``put''. + (struct gdb_file): Add to_rewind and to_put. + (null_file_put, null_file_rewind, gdb_file_put, gdb_file_rewind, + set_gdb_file_put, set_gdb_file_rewind): New functions. + (tui_file_rewind, tui_file_put): New functions. + (tui_file_new): Add rewind and put. + +Fri Jun 11 15:10:32 1999 Andrew Cagney + + * d10v-tdep.c (d10v_push_arguments): Fix order of arguments passed + to store_address. + +Fri Jun 11 10:31:29 1999 Andrew Cagney + + * remote.c (tty_input): Change array to pointer. + (_initialize_remote): Call build_remote_gdbarch_data. + (build_remote_gdbarch_data): New function. Allocate space for + tty_input. + (readsocket, readtty): Delete extern declaration of tty_input. + +1999-06-10 Elena Zannoni + + * event-top.c (gdb_readline2): Call the command handling function + via the input_handler pointer. + (change_line_handler): When turning off editing, set input_handler + as well. + + * utils.c (prompt_for_continue): If running asynchronously, call + async_request_quit, instead of request_quit. + + * tracepoint.c (read_actions): If running asynchronously, set the + signal handler for STOP_SIGNAL to handle_stop_sig. + + * top.h: (source_line_number, source_file_name, source_error, + source_pre_error, history_expansion_p, server_command): export for + use of event-top.c. + + * event-top.c: Include top.h and terminal.h. + (instream): Remove extern declaration. + (handle_sigint, handle_sigquit, handle_sighup, handle_sigfpe, + handle_sigwinch, async_do_nothing, async_disconnect, + async_float_handler, async_stop_sig): Make static. + (async_request_quit, async_do_nothing, async_disconnect, + async_float_handler, async_stop_sig): Add gdb_glient_data + argument. + (handle_stop_sig): New function. + (sigtstp_token): New variable. + (sigint_token, sigquit_token, sigfpe_token, sigwinch_token): + Change their type tp PTR. + (mark_async_signal_handler_wrapper): New function. + (setup_event_loop): Initialize all the variables used by readline + only if not already done while reading the .gdbinit file. Display + the initial gdb prompt, if .gdbinit took care of setting things up + for readline. + (change_line_handler): When turning on the use of readline, + initialize input_handler as well. + (command_line_handler): Set up the signal handler for STOP_SIGNAL + to be handle_stop_sig. + (async_init_signals): Remove coercion of signal handlers in calls + to create_async_signal_handler. Initialize token for stop signal. + (handle_sigint): Call async_request_quit using one argument. + (handle_sigint, handle_sigquit, handle_sighup, handle_sigfpe, + handle_sigwinch): Call mark_async_signal_handler_wrapper instead + of mark_async_signal_handler. + + * event-loop.h: Add extern declarations for handle_stop_sig, + async_command_editing_p, async_annotation_suffix, + new_async_prompt, the_prompts. + + * top.c (command_line_input): Set the signal handler to be + handle_stop_sig, in case gdb is running asynchronously. + (get_prompt): Return the top of the prompt stack if running + asynchronously. + (set_prompt): Set the top of the prompt stack if running + asynchronously. + (init_main): Move ``extern'' vars from here to event-loop.h. + +1999-06-10 Michael Snyder + + * values.c (value_from_string): new function. Make a value_ptr + from a string, with storage in local GDB memory (not in inferior). + * value.h (value_from_string): add prototype. + * remote.c (remote_cisco_ops): New remote target, "target cisco". + (init_remote_cisco_ops): New function, initialize new target. + (remote_cisco_mourn, remote_cisco_wait, remote_cisco_open, + remote_cisco_close): New functions, implement new target cisco. + (minitelnet, readtty, readsocket) New functions, implement the + I/O pass-through mode for target cisco. + (remote_wait): Detect special enhanced version of the 'S' packet + for target cisco. + (remote_cisco_expand): Perform Cisco variant of RLL decoding. + +1999-06-10 Elena Zannoni + + * event-loop.c (gdb_wait_for_event): Initialize num_found to 0. + + * top.c (print_prompt): Delete this function. + + From: Andrew Cagney + + * event-top.c (async_hook): Delete extern declaration. + + * defs.h: Replace ``async_hook'' with ``async_p''. + * top.c (gdb_init, init_main, init_main, init_main, init_main): + Replace ``async_hook'' with ``async_p''. + + * main.c: Rename ``async'' to ``async_p''. + (main): Add --noasync option. + (main): Hook in the asynchronous event-loop based CLI using + command_loop_hook instead of async_hook. Delete call to + async_hook(). + +Thu Jun 10 21:14:16 1999 Andrew Cagney + + * mn10300-tdep.c (mn10300_store_return_value, + mn10300_extract_struct_value_address, + mn10300_extract_return_value), config/mn10300/tm-mn10300.h: New + functions. + * config/mn10300/tm-mn10300.h (EXTRACT_STRUCT_VALUE_ADDRESS, + STORE_RETURN_VALUE, EXTRACT_RETURN_VALUE): Update. + (TARGET_MN10300): Delete macro. Not used. + +Thu Jun 10 20:04:02 1999 Andrew Cagney + + * mn10300-tdep.c (mn10300_register_names): Make static. + (STORE_STRUCT_RETURN): Do not modify SP. + + * config/mn10300/tm-mn10300.h(mn10300_register_name), + mn10300-tdep.c : New function. + * config/mn10300/tm-mn10300.h (REGISTER_NAME): Update. + * config/mn10300/tm-mn10300.h (mn10300_saved_pc_after_call), + mn10300-tdep.c: New function. + * config/mn10300/tm-mn10300.h (SAVED_PC_AFTER_CALL): Update. + +1999-06-09 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) + + * rs6000-tdep.c (skip_prologue): Don't mistake a branch for a + subroutine call. + +1999-06-08 Michael Snyder + + * remote.c (remote_wait): Add 'N' response packet, which is a + stop with signal number plus section offsets for .text, .data and + .bss. This is used by Cisco to indicate relocation offsets. + (remote_cisco_section_offsets, remote_cisco_objfile_relocate): + new files to support 'N' packet. + (remote_info_process): New function. Implements the + "info remote-process" command, by means of which the remote target + can report anything it wants to about the remote process/app being + debugged. + (_initialize_remote): add info remote-proc command. + (remote_threads_info): New function for "info threads" command. + Attempts to use new query "qfThreadInfo" instead of the old + undocumented query. + * exec.c (exec_set_section_offsets) new files to support 'N' packet. + +Tue Jun 8 13:33:42 1999 Andrew Cagney + + * inferior.h (generic_target_read_pc, generic_target_write_pc, + generic_target_read_fp, generic_target_write_fp, + generic_target_read_sp, generic_target_write_sp): Declare new + functions. + * findvar.c (generic_target_read_pc, generic_target_write_pc, + generic_target_read_fp, generic_target_write_fp, + generic_target_read_sp, generic_target_write_sp): New functions. + (TARGET_READ_PC, TARGET_WRITE_PC, TARGET_READ_FP, TARGET_WRITE_FP, + TARGET_READ_SP, TARGET_WRITE_SP): Default to corresponding generic + function. + (write_pc_pid, write_pc_pid, read_sp, write_sp, read_fp, + write_fp): Simplify. + + * gdbarch.c (verify_gdbarch): Always verify TARGET_PTR_BIT, + TARGET_SHORT_BIT, TARGET_INT_BIT, TARGET_LONG_BIT, + TARGET_LONG_LONG_BIT, TARGET_FLOAT_BIT, TARGET_DOUBLE_BIT, + TARGET_LONG_DOUBLE_BIT, TARGET_READ_PC, TARGET_WRITE_PC, + TARGET_READ_FP, TARGET_WRITE_FP, TARGET_READ_SP, TARGET_WRITE_SP, + USE_GENERIC_DUMMY_FRAMES, CALL_DUMMY_BREAKPOINT_OFFSET_P, + CALL_DUMMY_P, CALL_DUMMY_STACK_ADJUST_P, GET_SAVED_REGISTER, + REGISTER_CONVERTIBLE, PUSH_ARGUMENTS, PUSH_RETURN_ADDRESS, + FRAME_CHAIN_VALID. + (GET_GDBARCH, SET_GDBARCH): Delete macros. Implement functions + directly. + * gdbarch.h, gdbarch.c: Call fatal() instead of abort(). Identify + the function / macro with a problem. Always verify a architecture + attribute before returning it. + * gdbarch.h, gdbarch.c (generic_register_convertible_not): New + function. + + * mips-tdep.c (mips_push_return_address): New function. + * config/mips/tm-mips.h (PUSH_RETURN_ADDRESS): Define. + + * mips-tdep.c (mips_gdbarch_init): Initialize short_bit, + double_bit, long_double_bit, read_pc, write_pc, read_fp, write_fp, + read_sp, write_sp, frame_chain_valid, get_saved_register, + push_arguments, push_return_address, register_convertible, + call_dummy_p, use_generic_dummy_frames, + call_dummy_breakpoint_offset_p, call_dummy_stack_adjust_p, + call_dummy_words and sizeof_call_dummy_words. + * config/mips/tm-mips.h: Don't define CALL_DUMMY when multi-arch. + 1999-06-07 Keith Seitz * v850ice.c (init_hidden_window): Do not rely on the existence of @@ -52,6 +316,8 @@ Sun Jun 6 11:09:19 1999 Andrew Cagney * remote.c (PBUFSIZ): Re-define so that value is computed at run-time. (MAXBUFBYTES): Re-define as a macro function. + * gdbarch.h, gdbarch.c: Add multi-arch support for REGISTER_BYTES. + * d10v-tdep.c, config/d10v/tm-d10v.h: Update. 1999-06-05 Fernando Nasser @@ -83,6 +349,11 @@ Fri Jun 4 17:10:36 1999 Andrew Cagney * parser-defs.h (std_regs): Replace array with pointer. * parse.c (build_parse): Build the std_regs table according to the standard registers available. + (_initialize_parse): Register std_regs and num_std_regs as + architecture specific. + * gdbarch.h, gdbarch.c: Add multi-arch support for SP_REGNUM, + FP_REGNUM, PC_REGNUM, NUM_REGS, REGISTER_NAME. + * d10v-tdep.c, config/d10v/tm-d10v.h: Update. 1999-06-03 Michael Snyder @@ -110,6 +381,8 @@ Fri Jun 4 17:10:36 1999 Andrew Cagney * parse.c: Ditto. * somread.c: Ditto. + * gdbarch.h: Forward decl of struct value. + Thu Jun 3 10:12:38 1999 Andrew Cagney * d10v-tdep.c (do_d10v_pop_frame): Rename d10v_pop_frame. Make @@ -118,6 +391,16 @@ Thu Jun 3 10:12:38 1999 Andrew Cagney function. Call generic_pop_current_frame. * config/d10v/tm-d10v.h (POP_FRAME): Update. * gdbarch.h, gdbarch.c (frame_num_args_unknown): New function. + * gdbarch.h, gdbarch.c: Add multi-arch support for POP_FRAME, + SKIP_PROLOGUE, INNER_THAN, DECR_PC_AFTER_BREAK, + FUNCTION_START_OFFSET, REMOTE_TRANSLATE_XFER_ADDRESS, FRAME_CHAIN, + FRAME_CHAIN_VALID, FRAME_SAVED_PC, FRAME_ARGS_ADDRESS, + FRAME_LOCALS_ADDRESS, FRAME_ARGS_SKIP, + FRAMELESS_FUNCTION_INVOCATION, REGISTER_BYTE, REGISTER_RAW_SIZE, + REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, SAVED_PC_AFTER_CALL, + FRAME_NUM_ARGS, MAX_REGISTER_RAW_SIZE, MAX_REGISTER_VIRTUAL_SIZE, + REGISTER_SIZE. + * d10v-tdep.c, config/d10v/tm-d10v.h: Update. * config/d10v/tm-d10v.h (DMEM_START, IMEM_START, STACK_START, ARG1_REGNUM, ARGN_REGNUM, RET1_REGNUM): Move definitions from here. @@ -189,16 +472,29 @@ Wed Jun 2 17:37:03 1999 Jeffrey A Law (law@cygnus.com) Wed Jun 2 16:10:08 1999 Andrew Cagney + * gdbarch.h, gdbarch.c: Add multi-arch support for + STORE_STRUCT_RETURN, STORE_RETURN_VALUE, + EXTRACT_STRUCT_VALUE_ADDRESS, USE_STRUCT_CONVENTION, + FRAME_INIT_SAVED_REGS and INIT_EXTRA_FRAME_INFO. + * d10v-tdep.c, config/d10v/tm-d10v.h: Update. + * config/d10v/tm-d10v.h (FRAME_INIT_SAVED_REGS): Replace FRAME_FIND_SAVED_REGS. (d10v_frame_init_saved_regs): Replace d10v_frame_find_saved_regs. * d10v-tdep.c (d10v_pop_frame, d10v_frame_chain, d10v_frame_init_saved_regs): Update. + * gdbarch.h: Disallow FRAME_FIND_SAVED_REGS when multi-arch. + + * gdbarch.h, gdbarch.c: Add multi-arch support for + D10V_MAKE_DADDR, D10V_MAKE_IADDR, D10V_DADDR_P, D10V_IADDR_P, + D10V_CONVERT_DADDR_TO_RAW and D10V_CONVERT_IADDR_TO_RAW. + * d10v-tdep.c, config/d10v/tm-d10v.h: Update. * config/d10v/tm-d10v.h (EXTRA_FRAME_INFO): Delete. * d10v-tdep.c (struct frame_extra_info): Define. (d10v_init_extra_frame_info, d10v_pop_frame, d10v_frame_chain, d10v_frame_find_saved_regs): Update. + * gdbarch.h: Disallow EXTRA_FRAME_INFO when multi-arch. Tue Jun 1 13:36:31 1999 Philippe De Muyter @@ -209,18 +505,66 @@ Tue Jun 1 13:36:31 1999 Philippe De Muyter Wed Jun 2 11:18:37 1999 Andrew Cagney + * gdbarch.h, gdbarch.c: Add multi-arch support for + EXTRACT_RETURN_VALUE, PUSH_ARGUMENTS, PUSH_DUMMY_FRAME, + PUSH_RETURN_ADDRESS, POP_FRAME, FRAME_FIND_SAVED_REGS. + * d10v-tdep.c, config/d10v/tm-d10v.h: Update. + + * gdbarch.h, gdbarch.c: Add multi-arch support for + REGISTER_CONVERTIBLE, REGISTER_CONVERT_TO_VIRTUAL, + REGISTER_CONVERT_TO_RAW. + * config/d10v/tm-d10v.h, d10v-tdep.c (d10v_gdbarch_init): Update. + * defs.h (REGISTER_NAME): Move compatibility definition from here. * gdbarch.h: To here. * frame.h, blockframe.c (generic_fix_call_dummy): New stub function. + * gdbarch.h, gdbarch.c: Add multi-arch support for FIX_CALL_DUMMY. + * config/d10v/tm-d10v.h, d10v-tdep.c (d10v_gdbarch_init): Update. + +Tue Jun 1 20:06:38 1999 Andrew Cagney + + * d10v-tdep.c (d10v_gdbarch_init): Set get_saved_register. + * config/d10v/tm-d10v.h: Update. + +Tue Jun 1 19:50:05 1999 Andrew Cagney + + * gdbarch.h, gdbarch.c: Add multi-arch support for TARGET_READ_PC, + TARGET_WRITE_PC, TARGET_READ_FP, TARGET_WRITE_FP, TARGET_READ_SP + and TARGET_WRITE_SP. + * config/d10v/tm-d10v.h, d10v-tdep.c (d10v_gdbarch_init): Update. + +Tue Jun 1 19:19:02 1999 Andrew Cagney + + * gdbarch.c (default_gdbarch): Set field GET_SAVED_REGISTER to + generic_get_saved_register. + * gdbarch.c: Change update dispatch functions so that they check + for a NULL function pointer. + +Tue Jun 1 19:19:02 1999 Andrew Cagney + * gdbarch.h, gdbarch.c: Add multi-arch support for TARGET_INT_BIT, + TARGET_CHAR_BIT, TARGET_SHORT_BIT, TARGET_FLOAT_BIT, + TARGET_DOUBLE_BIT and TARGET_LONG_DOUBLE_BIT. + * config/d10v/tm-d10v.h, d10v-tdep.c (d10v_gdbarch_init): Update. + Tue Jun 1 18:47:54 1999 Andrew Cagney * parse.c (build_parse): New function. Initialize msym_text_symbol_type, msym_data_symbol_type and msym_unknown_symbol_type. (_initialize_parse): Call build_parse. + (_initialize_parse): Register variables msym_text_symbol_type, + msym_data_symbol_type as msym_unknown_symbol_type as + per-architecture. + +Tue Jun 1 11:30:09 1999 Andrew Cagney + + * d10v-tdep.c (_initialize_d10v_tdep): Register d10v as an + architecture. + (d10v_gdbarch_init): New function. + * confg/d10v/tm-d10v.h (GDB_MULTI_ARCH): Define. Tue Jun 1 10:45:24 1999 Andrew Cagney @@ -406,6 +750,11 @@ Tue May 25 12:23:39 1999 Andrew Cagney (java_rerun_cleanup): Add extern declaration for this stub function. +Tue May 25 12:06:29 1999 Andrew Cagney + + * gdbarch.h: When multi-arch, check that REGISTER_NAMES was not + defined. + Mon May 24 16:16:29 1999 Andrew Cagney * inflow.c (_initialize_inflow), annotate.c @@ -865,6 +1214,15 @@ Mon Apr 26 08:55:46 1999 Andrew Cagney * gdbarch.h, gdbarch.c: More format cleanups. +Sun Apr 25 18:54:51 1999 Andrew Cagney + + * gdbarch.h (CALL_DUMMY_STACK_ADJUST_P): Replace + SIZEOF_CALL_DUMMY_STACK_ADJUST_P. + (CALL_DUMMY_STACK_ADJUST): Replace + SIZEOF_CALL_DUMMY_STACK_ADJUST_P. + * gdbarch.c (gdbarch_call_dummy_stack_adjust, + set_gdbarch_call_dummy_stack_adjust): Define. + Fri Apr 23 15:00:25 1999 Andrew Cagney * gdbarch.c (arch_ok): New function. Fix logic test for a valid @@ -878,6 +1236,11 @@ Fri Apr 23 15:00:25 1999 Andrew Cagney Thu Apr 22 21:02:28 1999 Andrew Cagney + * gdbarch.h, gdbarch.c (GET_SAVED_REGISTER, get_saved_register): + Add. + (struct gdbarch, verify_gdbarch, gdbarch_alloc, gdbarch_dump, + default_gdbarch): Update. + * value.h (get_saved_register): Cleanup prototype. * findvar.c (default_get_saved_register): Rename function get_saved_register. @@ -902,8 +1265,19 @@ Thu Apr 22 21:02:28 1999 Andrew Cagney mn10200-tdep.c, m32r-tdep.c, h8300-tdep.c, rs6000-tdep.c: Delete function get_saved_register. +Thu Apr 22 13:32:23 1999 Andrew Cagney + + * gdbarch.c: Cleanup. Re-order the definition of the ``struct + gdbarch'' initialization functions so that maintenance is more + straightforward. + Thu Apr 22 11:07:21 1999 Andrew Cagney + * gdbarch.h, gdbarch.c (use_generic_dummy_frames, + USE_GENERIC_DUMMY_FRAMES): Add. + (struct gdbarch, verify_gdbarch, gdbarch_alloc, gdbarch_dump, + default_gdbarch): Update. + * config/v850/tm-v850.h, config/tic80/tm-tic80.h, config/sh/tm-sh.h, config/powerpc/tm-ppc-eabi.h, config/mn10300/tm-mn10300.h, config/mn10200/tm-mn10200.h, @@ -928,13 +1302,32 @@ Thu Apr 22 11:07:21 1999 Andrew Cagney runtime test. (get_saved_register): Always define. +Wed Apr 21 17:15:52 1999 Andrew Cagney + + * gdbarch.c (gdbarch_dump): Fix robustness check on + BELIEVE_PCC_PROMOTION_TYPE. + +Wed Apr 21 15:39:27 1999 Andrew Cagney + + * gdbarch.h (TARGET_BYTE_ORDER_SELECTABLE_P): When multi-arch, + force selectable byte order. + (CALL_DUMMY): Check for CALL_DUMMY definition when multi-arch. Are + incompatible. + * gdbarch.c (verify_gdbarch): Check call_dummy_stack_adjust. + Wed Apr 21 14:45:44 1999 Andrew Cagney + * gdbarch.c (gdbarch_update): Move dump-arch code from here. + (gdbarch_dump): To here. Make more robust. + * gdbarch.h (gdbarch_dump): Add prototype. + * gdbarch.c (enum set_arch): Declare. (set_arch): Add type parameter. Only disable ``target_architecture_auto'' when set_arch_manual. (set_architecture, set_architecture_from_arch_mach, set_architecture_from_file): Update. + (set_arch): When ``gdbarch_debug'', gdbarch_dump() the current + architecture. Wed Apr 21 10:48:53 1999 Andrew Cagney @@ -963,6 +1356,17 @@ Tue Apr 20 12:15:45 1999 Andrew Cagney * values.c (unpack_long): Ditto. * printcmd.c (print_frame_args): Ditto. +Sat Apr 17 15:39:33 1999 Andrew Cagney + + * gdbarch.h: Cleanup multi-arch comments. + +Fri Apr 16 15:39:10 1999 Andrew Cagney + + * gdbarch.h: Provide definition if GDB_MULTI_ARCH > 1 or + GDB_MULTI_ARCH > 0 and no previous definition. + * gdbarch.c (verify_gdbarch): Only verify a full multi-arch + target. + 1999-04-15 Stan Shebs * infrun.c (wait_for_inferior) [HAVE_STEPPABLE_WATCHPOINT, @@ -985,6 +1389,13 @@ Tue Apr 20 12:15:45 1999 Andrew Cagney Wed Apr 14 11:09:45 1999 Andrew Cagney + * gdbarch.h (BELIEVE_PCC_PROMOTION_TYPE, BELIEVE_PCC_PROMOTION): + Add multi-arch definitions. + * gdbarch.c (gdbarch_believe_pcc_promotion, + gdbarch_believe_pcc_promotion_type): New functions. + (gdbarch_update): Update + (struct gdbarch default_gdbarch): Update. + * stabsread.c (BELIEVE_PCC_PROMOTION_TYPE): Provide default. (define_symbol): Change #if BELIEVE_PCC_PROMOTION_TYPE and #if BELIEVE_PCC_PROMOTION to if(). @@ -995,6 +1406,19 @@ Wed Apr 14 11:09:45 1999 Andrew Cagney on a Solaris host (of any architecture). * configure: Regenerated. +Wed Apr 14 08:23:32 1999 Andrew Cagney + + * gdbarch.c (SET_GDBARCH, GET_GDBARCH, FSET_GDBARCH): New macros. + (gdbarch_byte_order, gdbarch_long_bit, gdbarch_long_long_bit, + gdbarch_ptr_bit, gdbarch_call_dummy_location, + gdbarch_call_dummy_address, gdbarch_call_dummy_address, + gdbarch_call_dummy_breakpoint_offset, + gdbarch_call_dummy_breakpoint_offset, gdbarch_call_dummy_length, + gdbarch_pc_in_call_dummy, dbarch_call_dummy_breakpoint_offset_p, + dbarch_call_dummy_p, dbarch_call_dummy_words, + dbarch_sizeof_call_dummy_words, dbarch_call_dummy_stack_adjust, + dbarch_call_dummy_stack_adjust_p): Define using new macros. + 1999-04-13 Jason Molenda (jsm@bugshack.cygnus.com) * rom68k-rom.c (init_rom68k_cmds): Fix an accidental substitution @@ -1043,6 +1467,16 @@ Mon Apr 12 15:57:16 1999 Andrew Cagney * valops.c (hand_function_call): Replace #ifdef CALL_DUMMY_STACK_ADJUST with if (CALL_DUMMY_STACK_ADJUST_P). + * gdbarch.h (SIZEOF_CALL_DUMMY_STACK_ADJUST, + (SIZEOF_CALL_DUMMY_STACK_ADJUST_P): Define + * gdbarch.c (struct gdbarch): Add call_dummy_stack_adjust, + call_dummy_stack_adjust_p. + (gdbarch_call_dummy_stack_adjust, + set_gdbarch_call_dummy_stack_adjust, + gdbarch_call_dummy_stack_adjust_p, + set_gdbarch_call_dummy_stack_adjust_p): New functions. + (default_gdbarch): Update. + 1999-04-09 Jim Blandy * ax-gdb.c, ax-gdb.h, ax-general.c, ax.h: Remove RCS Id strings. @@ -1068,6 +1502,15 @@ Thu Apr 8 16:04:34 1999 Andrew Cagney *dummy1 using alloca. * breakpoint.c (frame_in_dummy): Update. + * gdbarch.h (CALL_DUMMY_P, CALL_DUMMY_WORDS, + SIZEOF_CALL_DUMMY_WORDS): Define. + * gdbarch.c (gdbarch_call_dummy_p, set_gdbarch_call_dummy_p, + gdbarch_call_dummy_words, set_gdbarch_call_dummy_words, + gdbarch_sizeof_call_dummy_words, + set_gdbarch_sizeof_call_dummy_words): New functions. + (gdbarch_alloc, verify_gdbarch, gdbarch_update, struct + default_gdbarch): Update. + 1999-04-08 Jason Molenda (jsm@bugshack.cygnus.com) * monitor.c (monitor_read_memory): If a MO_GETMEM_NEEDS_RANGE @@ -1094,6 +1537,12 @@ Thu Apr 8 14:13:19 1999 Andrew Cagney (run_stack_dummy): Update. * infrun.c (wait_for_inferior): Update + * gdbarch.h (CALL_DUMMY_BREAKPOINT_OFFSET_P): New macro. + * gdbarch.c (set_gdbarch_call_dummy_breakpoint_offset_p, + gdbarch_call_dummy_breakpoint_offset_p): New functions. + (struct gdbarch, gdbarch_alloc, default_gdbarch, gdbarch_update): + Update. + 1999-04-07 Stan Shebs * MAINTAINERS: Mark Alexander can no longer maintain @@ -1275,6 +1724,13 @@ Fri Mar 26 17:27:27 1999 Andrew Cagney Thu Mar 25 19:30:02 1999 Andrew Cagney * gdbarch.c: Include all headers. + (struct gdbarch), gdbarch.h (CALL_DUMMY_LOCATION, + CALL_DUMMY_ADDRESS, CALL_DUMMY_START_OFFSET, + CALL_DUMMY_BREAKPOINT_OFFSET, CALL_DUMMY_LENGTH, + PC_IN_CALL_DUMMY): Add ``call_dummy_location'', + ``call_dummy_length'', ``pc_in_call_dummy'', + ``call_dummy_start_offset'', ``call_dummy_breakpoint_offset'' to + multi-arch framework. * inferior.h, blockframe.c (pc_in_call_dummy_before_text_end, pc_in_call_dummy_after_text_end, pc_in_call_dummy_on_stack, @@ -1527,6 +1983,8 @@ Wed Mar 10 21:20:25 1999 Andrew Cagney (build_findvar): New function. Allocate space for REGISTERS and REGISTER_VALID. (_initialize_findvar): Call build_findvar. + (_initialize_findvar): Register REGISTERS and REGISTER_VALID as + arch dependant. * inferior.h (registers, register_valid): Replace array with pointer. @@ -1546,6 +2004,7 @@ Wed Mar 10 21:20:25 1999 Andrew Cagney * infrun.c (stop_registers): Update. (build_infrun): Initialize stop_registers. (_initialize_infrun): Call build_infrun. + (_initialize_infrun): Register ``stop_registers'' as arch dependant. Wed Mar 10 14:50:42 1999 Andrew Cagney diff --git a/gdb/ChangeLog-98 b/gdb/ChangeLog-98 index f60cd5bbc6c..5f3fd1106c4 100644 --- a/gdb/ChangeLog-98 +++ b/gdb/ChangeLog-98 @@ -3355,11 +3355,62 @@ Fri Dec 18 14:23:34 1998 Andrew Cagney (mips_push_arguments, mips_push_dummy_frame, mips_pop_frame, mips_extract_return_value): Update. +Fri Dec 18 12:56:56 1998 Andrew Cagney + + * gdbarch.h (gdbarch_init_ftype): Pass struct gdbarch_info + by-value. + (struct gdbarch_info): Add struct gdbarch_tdep_info *tdep_info. + * gdbarch.c (gdbarch_update): Update. + + * gdbarch.c (gdbarch_update): Add more tracing. + Thu Dec 17 02:15:40 1998 Andrew Cagney * configure.tgt (gdb_target): Identify mips64*vr4100*-*-elf* as vr4100. +Thu Dec 17 02:01:58 1998 Andrew Cagney + + * gdbtypes.c (_initialize_gdbtypes): Register all builtin types + with gdbarch so that they are updated whenever the architecture is + changed. + +Thu Dec 17 01:58:16 1998 Andrew Cagney + + * gdbarch.h (GDB_MULTI_ARCH): New macro, default to zero. + (current_gdbarch): Current architecture pointer. + * gdbarch.c (struct gdbarch): Define. + + * gdbarch.h (TARGET_ARCHITECTURE, TARGET_BYTE_ORDER, + TARGET_LONG_BIT, TARGET_LONG_LONG_BIT, TARGET_PTR_BIT): When + multi-arch force definition. + * gdbarch.h, gdbarch.c (gdbarch_tdep, gdbarch_bfd_arch_info, + gdbarch_byte_order, {set,}gdbarch_long_bit, + {set,}gdbarch_long_long_bit, {set,}gdbarch_ptr_bit): Corresponding + functions. + + * gdbarch.h (struct gdbarch_list, struct gdbarch_info, + gdbarch_init_ftype), gdbarch.c (register_gdbarch_init): Mechanism + for registering an architecture with GDB. + (gdbarch_list_lookup_by_info, gdbarch_alloc, gdbarch_update, + verify_gdbarch): Support functions. + + * gdbarch.h (gdbarch_data_ftype), gdbarch.c + (register_gdbarch_data, gdbarch_data): Mechanism for maintaining + per-architecture pointers. + (init_gdbarch_data): Support functions. + + * gdbarch.h (gdbarch_swap_ftype), gdbarch.c + (register_gdbarch_swap): Ditto for swapped memory regions. + (init_gdbarch_swap, swapout_gdbarch_swap, swapin_gdbarch_swap): + Support functions. + + * gdbarch.c (set_endian_big, set_endian_little, set_architecture, + info_architecture, set_gdbarch_from_file): Hook in multi-arch + code by calling gdbarch_update. + (default_gdbarch): Default multi-arch vector. Use host's type + system for values. + Thu Dec 17 01:34:36 1998 Andrew Cagney * gdbtypes.c (build_gdbtypes): New function. @@ -4402,6 +4453,11 @@ Thu Oct 8 08:40:42 1998 Mark Alexander * rs6000-tdep.c (get_saved_register): Define only if USE_GENERIC_DUMMY_FRAMES is defined. +Tue Oct 6 21:35:10 1998 Andrew Cagney + + * Makefile.in (DEPFILES): Add TARGET_OBS. + (TARGET_OBS): Defined by configure. + 1998-10-06 Jason Molenda (jsm@bugshack.cygnus.com) Eliminate a few warnings from the compiler. diff --git a/gdb/MAINTAINERS b/gdb/MAINTAINERS index 3ea38367c0f..745d111753e 100644 --- a/gdb/MAINTAINERS +++ b/gdb/MAINTAINERS @@ -1,3 +1,4 @@ +hp testsuite (gdb.hp) Jimmy Guo adl-debugger-wdb-merge-guru@cup.hp.com d10v target Andrew Cagney cagney@cygnus.com d30v target Andrew Cagney cagney@cygnus.com mips target Andrew Cagney cagney@cygnus.com @@ -17,6 +18,7 @@ elf reader Jim Blandy jimb@cygnus.com stabs reader Jim Blandy jimb@cygnus.com x86 linux native Jim Blandy jimb@cygnus.com Scheme support Jim Blandy jimb@cygnus.com +svr4 shlibs (solib.c) Jim Blandy jimb@cygnus.com hurd native Mark Kettenis kettenis@wins.va.nl hpux, hp pa native Jeff Law law@cygnus.com m32r target Michael Snyder msnyder@cygnus.com diff --git a/gdb/Makefile.in b/gdb/Makefile.in index cc0bd9885d5..48baccfc877 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -219,7 +219,7 @@ CDEPS = $(XM_CDEPS) $(TM_CDEPS) $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE) \ ADD_FILES = $(REGEX) $(XM_ADD_FILES) $(TM_ADD_FILES) $(NAT_ADD_FILES) ADD_DEPS = $(REGEX1) $(XM_ADD_FILES) $(TM_ADD_FILES) $(NAT_ADD_FILES) -VERSION = 19990607 +VERSION = 19990614 DIST=gdb LINT=/usr/5bin/lint diff --git a/gdb/config/d10v/tm-d10v.h b/gdb/config/d10v/tm-d10v.h index 99fd9ac41b9..8dfa9fd3d17 100644 --- a/gdb/config/d10v/tm-d10v.h +++ b/gdb/config/d10v/tm-d10v.h @@ -19,11 +19,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Contributed by Martin Hunt, hunt@cygnus.com */ +#define GDB_MULTI_ARCH 1 /* #define GDB_TARGET_IS_D10V - moved to gdbarch.h */ /* Define the bit, byte, and word ordering of the machine. */ +#if !GDB_MULTI_ARCH + #define TARGET_BYTE_ORDER BIG_ENDIAN /* Offset from address of function to start of its code. @@ -53,6 +56,8 @@ extern char *d10v_register_name PARAMS ((int reg_nr)); #define NUM_REGS 37 +#endif /* GDB_MULTI_ARCH */ + /* Register numbers of various important registers. Note that some of these values are "real" register numbers, and correspond to the general registers of the machine, @@ -64,15 +69,19 @@ extern char *d10v_register_name PARAMS ((int reg_nr)); #define R0_REGNUM 0 #define LR_REGNUM 13 +#if !GDB_MULTI_ARCH #define SP_REGNUM 15 #define FP_REGNUM 11 #define PC_REGNUM 18 +#endif #define PSW_REGNUM 16 #define IMAP0_REGNUM 32 #define IMAP1_REGNUM 33 #define DMAP_REGNUM 34 #define A0_REGNUM 35 +#if !GDB_MULTI_ARCH + /* ??? */ #define REGISTER_SIZE 2 @@ -298,3 +307,4 @@ extern void remote_d10v_translate_xfer_address PARAMS ((CORE_ADDR gdb_addr, int #define REMOTE_TRANSLATE_XFER_ADDRESS(GDB_ADDR, GDB_LEN, REM_ADDR, REM_LEN) \ remote_d10v_translate_xfer_address ((GDB_ADDR), (GDB_LEN), (REM_ADDR), (REM_LEN)) +#endif diff --git a/gdb/config/mips/tm-mips.h b/gdb/config/mips/tm-mips.h index e2e5099df6b..99a54498727 100644 --- a/gdb/config/mips/tm-mips.h +++ b/gdb/config/mips/tm-mips.h @@ -386,10 +386,12 @@ extern void mips_find_saved_regs PARAMS ((struct frame_info *)); function calls. We don't need STACK_ALIGN, PUSH_ARGUMENTS will handle it. */ +extern CORE_ADDR mips_push_arguments PARAMS ((int, struct value **, CORE_ADDR, int, CORE_ADDR)); #define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \ (mips_push_arguments((nargs), (args), (sp), (struct_return), (struct_addr))) -extern CORE_ADDR -mips_push_arguments PARAMS ((int, struct value **, CORE_ADDR, int, CORE_ADDR)); + +extern CORE_ADDR mips_push_return_address PARAMS ((CORE_ADDR pc, CORE_ADDR sp)); +#define PUSH_RETURN_ADDRESS(PC, SP) (mips_push_return_address ((PC), (SP))) /* Push an empty stack frame, to record the current PC, etc. */ diff --git a/gdb/config/mn10300/tm-mn10300.h b/gdb/config/mn10300/tm-mn10300.h index ae5f0aa2e5b..eb47fecf218 100644 --- a/gdb/config/mn10300/tm-mn10300.h +++ b/gdb/config/mn10300/tm-mn10300.h @@ -37,8 +37,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define REGISTER_BYTES (NUM_REGS * REGISTER_SIZE) -extern char **mn10300_register_names; -#define REGISTER_NAME(i) mn10300_register_names[i] +extern char *mn10300_register_name PARAMS ((int regnr)); +#define REGISTER_NAME(i) (mn10300_register_name (i)) #define D2_REGNUM 2 #define D3_REGNUM 3 @@ -65,8 +65,9 @@ extern breakpoint_from_pc_fn mn10300_breakpoint_from_pc; #define INNER_THAN(lhs,rhs) ((lhs) < (rhs)) +extern CORE_ADDR mn10300_saved_pc_after_call PARAMS ((struct frame_info *frame)); #define SAVED_PC_AFTER_CALL(frame) \ - read_memory_integer (read_register (SP_REGNUM), 4) + mn10300_saved_pc_after_call (frame) #ifdef __STDC__ struct frame_info; @@ -92,25 +93,20 @@ extern CORE_ADDR mn10300_frame_saved_pc PARAMS ((struct frame_info *)); a function return value of type TYPE, and copy that, in virtual format, into VALBUF. */ +extern void mn10300_extract_return_value PARAMS ((struct type *type, char *regbuf, char *valbuf)); #define EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \ - if (TYPE_CODE (TYPE) == TYPE_CODE_PTR) \ - memcpy (VALBUF, REGBUF + REGISTER_BYTE (4), TYPE_LENGTH (TYPE)); \ - else \ - memcpy (VALBUF, REGBUF + REGISTER_BYTE (0), TYPE_LENGTH (TYPE)); - + mn10300_extract_return_value (TYPE, REGBUF, VALBUF) +CORE_ADDR mn10300_extract_struct_value_address PARAMS ((char *regbuf)); #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ - extract_address (REGBUF + REGISTER_BYTE (4), \ - REGISTER_RAW_SIZE (4)) + mn10300_extract_struct_value_address (REGBUF) +void mn10300_store_return_value PARAMS ((struct type *type, char *valbuf)); #define STORE_RETURN_VALUE(TYPE, VALBUF) \ - if (TYPE_CODE (TYPE) == TYPE_CODE_PTR) \ - write_register_bytes(REGISTER_BYTE (4), VALBUF, TYPE_LENGTH (TYPE)); \ - else \ - write_register_bytes(REGISTER_BYTE (0), VALBUF, TYPE_LENGTH (TYPE)); + mn10300_store_return_value (TYPE, VALBUF) #define STORE_STRUCT_RETURN(STRUCT_ADDR, SP) \ - (SP) = mn10300_store_struct_return (STRUCT_ADDR, SP) + (mn10300_store_struct_return (STRUCT_ADDR, SP)) extern CORE_ADDR mn10300_skip_prologue PARAMS ((CORE_ADDR)); #define SKIP_PROLOGUE(pc) (mn10300_skip_prologue (pc)) @@ -160,7 +156,3 @@ extern use_struct_convention_fn mn10300_use_struct_convention; extern void mn10300_virtual_frame_pointer PARAMS ((CORE_ADDR, long *, long *)); #define TARGET_VIRTUAL_FRAME_POINTER(PC, REGP, OFFP) \ mn10300_virtual_frame_pointer ((PC), (REGP), (OFFP)) - -/* Define this for Wingdb */ - -#define TARGET_MN10300 diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c index 566af7149cb..861533f4003 100644 --- a/gdb/d10v-tdep.c +++ b/gdb/d10v-tdep.c @@ -924,7 +924,7 @@ d10v_push_arguments (nargs, args, sp, struct_return, struct_addr) { char ptr[2]; /* arg will go onto stack */ - store_address (ptr, val & 0xffff, 2); + store_address (ptr, 2, val & 0xffff); si = push_stack_item (si, ptr, 2); } } @@ -1322,12 +1322,122 @@ display_trace (low, high) } +static gdbarch_init_ftype d10v_gdbarch_init; +static struct gdbarch * +d10v_gdbarch_init (info, arches) + struct gdbarch_info info; + struct gdbarch_list *arches; +{ + static LONGEST d10v_call_dummy_words[] = { 0 }; + struct gdbarch *gdbarch; + int d10v_num_regs = 37; + + /* there is only one d10v architecture */ + if (arches != NULL) + return arches->gdbarch; + gdbarch = gdbarch_alloc (&info, NULL); + + set_gdbarch_read_pc (gdbarch, d10v_read_pc); + set_gdbarch_write_pc (gdbarch, d10v_write_pc); + set_gdbarch_read_fp (gdbarch, d10v_read_fp); + set_gdbarch_write_fp (gdbarch, d10v_write_fp); + set_gdbarch_read_sp (gdbarch, d10v_read_sp); + set_gdbarch_write_sp (gdbarch, d10v_write_sp); + + set_gdbarch_num_regs (gdbarch, d10v_num_regs); + set_gdbarch_sp_regnum (gdbarch, 15); + set_gdbarch_fp_regnum (gdbarch, 11); + set_gdbarch_pc_regnum (gdbarch, 18); + set_gdbarch_register_name (gdbarch, d10v_register_name); + set_gdbarch_register_size (gdbarch, 2); + set_gdbarch_register_bytes (gdbarch, (d10v_num_regs - 2) * 2 + 16); + set_gdbarch_register_byte (gdbarch, d10v_register_byte); + set_gdbarch_register_raw_size (gdbarch, d10v_register_raw_size); + set_gdbarch_max_register_raw_size (gdbarch, 8); + set_gdbarch_register_virtual_size (gdbarch, d10v_register_virtual_size); + set_gdbarch_max_register_virtual_size (gdbarch, 8); + set_gdbarch_register_virtual_type (gdbarch, d10v_register_virtual_type); + + set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT); + set_gdbarch_short_bit (gdbarch, 2 * TARGET_CHAR_BIT); + set_gdbarch_int_bit (gdbarch, 2 * TARGET_CHAR_BIT); + set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT); + set_gdbarch_long_long_bit (gdbarch, 4 * TARGET_CHAR_BIT); + set_gdbarch_float_bit (gdbarch, 4 * TARGET_CHAR_BIT); + set_gdbarch_double_bit (gdbarch, 4 * TARGET_CHAR_BIT); + set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT); + + set_gdbarch_use_generic_dummy_frames (gdbarch, 1); + set_gdbarch_call_dummy_length (gdbarch, 0); + set_gdbarch_call_dummy_location (gdbarch, AT_ENTRY_POINT); + set_gdbarch_call_dummy_address (gdbarch, entry_point_address); + set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); + set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0); + set_gdbarch_call_dummy_start_offset (gdbarch, 0); + set_gdbarch_pc_in_call_dummy (gdbarch, generic_pc_in_call_dummy); + set_gdbarch_call_dummy_words (gdbarch, d10v_call_dummy_words); + set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (d10v_call_dummy_words)); + set_gdbarch_call_dummy_p (gdbarch, 1); + set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); + set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register); + set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy); + + set_gdbarch_register_convertible (gdbarch, d10v_register_convertible); + set_gdbarch_register_convert_to_virtual (gdbarch, d10v_register_convert_to_virtual); + set_gdbarch_register_convert_to_raw (gdbarch, d10v_register_convert_to_raw); + + set_gdbarch_extract_return_value (gdbarch, d10v_extract_return_value); + set_gdbarch_push_arguments (gdbarch, d10v_push_arguments); + set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame); + set_gdbarch_push_return_address (gdbarch, d10v_push_return_address); + + set_gdbarch_d10v_make_daddr (gdbarch, d10v_make_daddr); + set_gdbarch_d10v_make_iaddr (gdbarch, d10v_make_iaddr); + set_gdbarch_d10v_daddr_p (gdbarch, d10v_daddr_p); + set_gdbarch_d10v_iaddr_p (gdbarch, d10v_iaddr_p); + set_gdbarch_d10v_convert_daddr_to_raw (gdbarch, d10v_convert_daddr_to_raw); + set_gdbarch_d10v_convert_iaddr_to_raw (gdbarch, d10v_convert_iaddr_to_raw); + + set_gdbarch_store_struct_return (gdbarch, d10v_store_struct_return); + set_gdbarch_store_return_value (gdbarch, d10v_store_return_value); + set_gdbarch_extract_struct_value_address (gdbarch, d10v_extract_struct_value_address); + set_gdbarch_use_struct_convention (gdbarch, d10v_use_struct_convention); + + set_gdbarch_frame_init_saved_regs (gdbarch, d10v_frame_init_saved_regs); + set_gdbarch_init_extra_frame_info (gdbarch, d10v_init_extra_frame_info); + + set_gdbarch_pop_frame (gdbarch, d10v_pop_frame); + + set_gdbarch_skip_prologue (gdbarch, d10v_skip_prologue); + set_gdbarch_inner_than (gdbarch, core_addr_lessthan); + set_gdbarch_decr_pc_after_break (gdbarch, 4); + set_gdbarch_function_start_offset (gdbarch, 0); + set_gdbarch_breakpoint_from_pc (gdbarch, d10v_breakpoint_from_pc); + + set_gdbarch_remote_translate_xfer_address (gdbarch, remote_d10v_translate_xfer_address); + + set_gdbarch_frame_args_skip (gdbarch, 0); + set_gdbarch_frameless_function_invocation (gdbarch, frameless_look_for_prologue); + set_gdbarch_frame_chain (gdbarch, d10v_frame_chain); + set_gdbarch_frame_chain_valid (gdbarch, d10v_frame_chain_valid); + set_gdbarch_frame_saved_pc (gdbarch, d10v_frame_saved_pc); + set_gdbarch_frame_args_address (gdbarch, d10v_frame_args_address); + set_gdbarch_frame_locals_address (gdbarch, d10v_frame_locals_address); + set_gdbarch_saved_pc_after_call (gdbarch, d10v_saved_pc_after_call); + set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); + + return gdbarch; +} + + extern void (*target_resume_hook) PARAMS ((void)); extern void (*target_wait_loop_hook) PARAMS ((void)); void _initialize_d10v_tdep () { + register_gdbarch_init (bfd_arch_d10v, d10v_gdbarch_init); + tm_print_insn = print_insn_d10v; target_resume_hook = d10v_eva_prepare_to_trace; diff --git a/gdb/defs.h b/gdb/defs.h index 8251aca0eca..88564f4a216 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -359,8 +359,15 @@ struct tui_stream struct gdb_file; typedef struct gdb_file GDB_FILE; /* deprecated */ +/* Normal results */ extern GDB_FILE *gdb_stdout; +/* Serious error notifications */ extern GDB_FILE *gdb_stderr; +/* Log/debug/trace messages that should bypass normal stdout/stderr + filtering. For momement, always call this stream using + *_unfiltered. In the very near future that restriction shall be + removed - either call shall be unfiltered. (cagney 1999-06-13). */ +extern GDB_FILE *gdb_stdlog; #if defined(TUI) #include "tui.h" @@ -382,6 +389,12 @@ extern void set_gdb_file_fputs PARAMS ((struct gdb_file *stream, gdb_file_fputs_ typedef int (gdb_file_isatty_ftype) PARAMS ((struct gdb_file *stream)); extern void set_gdb_file_isatty PARAMS ((struct gdb_file *stream, gdb_file_isatty_ftype *isatty)); +typedef void (gdb_file_rewind_ftype) PARAMS ((struct gdb_file *stream)); +extern void set_gdb_file_rewind PARAMS ((struct gdb_file *stream, gdb_file_rewind_ftype *rewind)); + +typedef void (gdb_file_put_ftype) PARAMS ((struct gdb_file *stream, struct gdb_file *dest)); +extern void set_gdb_file_put PARAMS ((struct gdb_file *stream, gdb_file_put_ftype *put)); + typedef void (gdb_file_delete_ftype) PARAMS ((struct gdb_file *stream)); extern void set_gdb_file_data PARAMS ((struct gdb_file *stream, void *data, gdb_file_delete_ftype *delete)); @@ -389,6 +402,11 @@ extern struct gdb_file *gdb_file_new PARAMS ((void)); extern void gdb_file_delete PARAMS ((struct gdb_file *stream)); +extern void gdb_file_rewind PARAMS ((struct gdb_file *stream)); + +/* NOTE: copies left to right */ +extern void gdb_file_put PARAMS ((struct gdb_file *src, struct gdb_file *dest)); + extern void *gdb_file_data PARAMS ((struct gdb_file *file)); /* Open the specified FILE as a gdb_file. */ @@ -1068,13 +1086,15 @@ extern CORE_ADDR push_word PARAMS ((CORE_ADDR, ULONGEST)); extern int watchdog; /* Hooks for alternate command interfaces. */ - #ifdef __STDC__ struct target_waitstatus; struct cmd_list_element; #endif -extern void (*async_hook) PARAMS ((void)); +/* Should the asynchronous variant of the interpreter (using the + event-loop) be enabled? */ +extern int async_p; + extern void (*init_ui_hook) PARAMS ((char *argv0)); extern void (*command_loop_hook) PARAMS ((void)); extern void (*fputs_unfiltered_hook) PARAMS ((const char *linebuffer, diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index 4bbdf0929e3..0793ddb2252 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -1398,6 +1398,15 @@ detect that GCC compiled the file. The default symbols are @code{gcc_compiled.} and @code{gcc2_compiled.}, respectively. (Currently only defined for the Delta 68.) +@item GDB_MULTI_ARCH +If defined and non-zero, enables suport for multiple architectures +within GDB. + +The support can be enabled at two levels. At level one, only +definitions for previously undefined macros are provided; at level two, +a multi-arch definition of all architecture dependant macros will be +defined. + @item GDB_TARGET_IS_HPPA This determines whether horrible kludge code in dbxread.c and partial-stab.h is used to mangle multiple-symbol-table files from diff --git a/gdb/event-loop.c b/gdb/event-loop.c index 26930343fbd..77f46bb6478 100644 --- a/gdb/event-loop.c +++ b/gdb/event-loop.c @@ -531,7 +531,8 @@ gdb_wait_for_event () { file_handler *file_ptr; gdb_event *file_event_ptr; - int num_found, i; + int num_found = 0; + int i; #ifndef HAVE_POLL int mask, bit, index; diff --git a/gdb/event-loop.h b/gdb/event-loop.h index a366ed3a113..5debe0f2e69 100644 --- a/gdb/event-loop.h +++ b/gdb/event-loop.h @@ -233,6 +233,8 @@ struct prompts #define PREFIX(X) the_prompts.prompt_stack[the_prompts.top + X].prefix #define SUFFIX(X) the_prompts.prompt_stack[the_prompts.top + X].suffix +/* Exported functions from event-top.c */ + extern void delete_file_handler PARAMS ((int)); extern void create_file_handler PARAMS ((int, int, file_handler_func, gdb_client_data)); @@ -240,14 +242,19 @@ extern int gdb_do_one_event PARAMS ((void)); extern void mark_async_signal_handler PARAMS ((async_signal_handler *)); extern async_signal_handler * create_async_signal_handler PARAMS ((async_handler_func *, gdb_client_data)); - extern void delete_async_signal_handler PARAMS ((async_signal_handler *async_handler_ptr)); extern void display_gdb_prompt PARAMS ((char*)); - -extern void setup_event_loop PARAMS ((void)); +extern void start_event_loop PARAMS ((void)); extern void async_init_signals PARAMS ((void)); - extern void set_async_editing_command PARAMS ((char *, int, struct cmd_list_element *)); extern void set_async_annotation_level PARAMS ((char *, int, struct cmd_list_element *)); extern void set_async_prompt PARAMS ((char *, int, struct cmd_list_element *)); +extern void handle_stop_sig PARAMS ((int)); + +/* Exported variables from event-top.c */ + +extern int async_command_editing_p; +extern char *async_annotation_suffix; +extern char *new_async_prompt; +extern struct prompts the_prompts; diff --git a/gdb/event-top.c b/gdb/event-top.c index d241dda7ad4..ad269eb25fa 100644 --- a/gdb/event-top.c +++ b/gdb/event-top.c @@ -20,10 +20,12 @@ #include "defs.h" #include "event-loop.h" +#include "top.h" #ifdef HAVE_POLL #include #endif #include "inferior.h" +#include "terminal.h" /* for job_control*/ /* readline include files */ #include @@ -32,7 +34,7 @@ /* readline defines this. */ #undef savestring -extern FILE *instream; +extern void _initialize_event_loop (void); static void command_line_handler PARAMS ((char *)); static void gdb_readline2 PARAMS ((void)); @@ -43,32 +45,26 @@ static void change_annotation_level PARAMS ((void)); static void command_handler PARAMS ((char *)); /* Signal handlers. */ -void handle_sigint PARAMS ((int)); -void handle_sigquit PARAMS ((int)); -void handle_sighup PARAMS ((int)); -void handle_sigfpe PARAMS ((int)); -void handle_sigwinch PARAMS ((int)); +static void handle_sigint PARAMS ((int)); +static void handle_sigquit PARAMS ((int)); +static void handle_sighup PARAMS ((int)); +static void handle_sigfpe PARAMS ((int)); +static void handle_sigwinch PARAMS ((int)); +/* Signal to catch ^Z typed while reading a command: SIGTSTP or SIGCONT. */ +#ifndef STOP_SIGNAL +#ifdef SIGTSTP +#define STOP_SIGNAL SIGTSTP +void handle_stop_sig PARAMS ((int)); +#endif +#endif /* Functions to be invoked by the event loop in response to signals. */ -void async_request_quit PARAMS ((void)); -void async_do_nothing PARAMS ((void)); -void async_disconnect PARAMS ((void)); -void async_float_handler PARAMS ((void)); - -/* Functions from top.c. */ -extern void command_loop_marker PARAMS ((int)); -extern int quit_cover PARAMS ((PTR)); -extern void quit_command PARAMS ((char *, int)); -extern void execute_command PARAMS ((char *, int)); - -/* Variables from top.c. */ -extern int source_line_number; -extern char *source_file_name; -extern char *source_error; -extern char *source_pre_error; -extern int history_expansion_p; -extern int server_command; +void async_request_quit PARAMS ((gdb_client_data)); +static void async_do_nothing PARAMS ((gdb_client_data)); +static void async_disconnect PARAMS ((gdb_client_data)); +static void async_float_handler PARAMS ((gdb_client_data)); +static void async_stop_sig PARAMS ((gdb_client_data)); /* If this definition isn't overridden by the header files, assume that isatty and fileno exist on this system. */ @@ -76,9 +72,6 @@ extern int server_command; #define ISATTY(FP) (isatty (fileno (FP))) #endif -/* Hook for alternate command interface. */ -void (*async_hook) PARAMS ((void)); - /* Readline offers an alternate interface, via callback functions. These are all included in the file callback.c in the readline distribution. This file provides (mainly) a function, which @@ -106,7 +99,7 @@ void (*call_readline) PARAMS ((void)); /* This is used to determine if GDB is using the readline library or its own simplified form of readline. It is used by the asynchronous - form of the set editing command. + form of the set editing command. ezannoni: as of 1999-04-29 I expect that this variable will not be used after gdb is changed to use the event loop as default engine, and event-top.c is merged into top.c. */ @@ -135,15 +128,20 @@ struct prompts the_prompts; handlers mark these functions as ready to be executed and the event loop, in a later iteration, calls them. See the function invoke_async_signal_handler. */ -async_signal_handler *sigint_token; +PTR sigint_token; #ifdef SIGHUP -async_signal_handler *sighup_token; +PTR sighup_token; #endif -async_signal_handler *sigquit_token; -async_signal_handler *sigfpe_token; +PTR sigquit_token; +PTR sigfpe_token; #if defined(SIGWINCH) && defined(SIGWINCH_HANDLER) -async_signal_handler *sigwinch_token; +PTR sigwinch_token; #endif +#ifdef STOP_SIGNAL +PTR sigtstp_token; +#endif + +void mark_async_signal_handler_wrapper PARAMS ((void *)); /* Structure to save a partially entered command. This is used when the user types '\' at the end of a command line. This is necessary @@ -163,46 +161,27 @@ readline_input_state; /* Initialize all the necessary variables, start the event loop, register readline, and stdin. */ void -setup_event_loop () +start_event_loop () { - int length = strlen (PREFIX (0)) + strlen (PROMPT (0)) + strlen (SUFFIX (0)) + 1; - char *a_prompt = (char *) xmalloc (length); - - /* Set things up for readline to be invoked via the alternate - interface, i.e. via a callback function (rl_callback_read_char). */ - call_readline = rl_callback_read_char; - - /* When readline has read an end-of-line character, it passes the - complete line to gdb for processing. command_line_handler is the - function that does this. */ - input_handler = command_line_handler; - - /* Tell readline what the prompt to display is and what function it - will need to call after a whole line is read. */ - strcpy (a_prompt, PREFIX (0)); - strcat (a_prompt, PROMPT (0)); - strcat (a_prompt, SUFFIX (0)); - rl_callback_handler_install (a_prompt, input_handler); - - /* Tell readline to use the same input stream that gdb uses. */ - rl_instream = instream; - /* Get a file descriptor for the input stream, so that we can - register it with the event loop. */ - input_fd = fileno (instream); + int length; + char *a_prompt; - /* Now we need to create the event sources for the input file descriptor. */ - /* At this point in time, this is the only event source that we - register with the even loop. Another source is going to be the - target program (inferior), but that must be registered only when - it actually exists (I.e. after we say 'run' or after we connect - to a remote target. */ -#ifdef HAVE_POLL - create_file_handler (input_fd, POLLIN, - (file_handler_func *) call_readline, 0); -#else - create_file_handler (input_fd, GDB_READABLE, - (file_handler_func *) call_readline, 0); -#endif + /* If we are using readline, set things up and display the first + prompt, otherwise just print the prompt. */ + if (async_command_editing_p) + { + /* Tell readline what the prompt to display is and what function it + will need to call after a whole line is read. This also displays + the first prompt.*/ + length = strlen (PREFIX (0)) + strlen (PROMPT (0)) + strlen (SUFFIX (0)) + 1; + a_prompt = (char *) xmalloc (length); + strcpy (a_prompt, PREFIX (0)); + strcat (a_prompt, PROMPT (0)); + strcat (a_prompt, SUFFIX (0)); + rl_callback_handler_install (a_prompt, input_handler); + } + else + display_gdb_prompt (0); /* Loop until there is something to do. This is the entry point to the event loop engine. gdb_do_one_event will process one event @@ -229,12 +208,17 @@ change_line_handler () { /* Turn on editing by using readline. */ call_readline = rl_callback_read_char; + input_handler = command_line_handler; } else { /* Turn off editing by using gdb_readline2. */ rl_callback_handler_remove (); call_readline = gdb_readline2; + + /* Set up the command handler as well, in case we are called as + first thing from .gdbinit. */ + input_handler = command_line_handler; } /* To tell the event loop to change the handler associated with the @@ -255,12 +239,12 @@ change_line_handler () top of the prompt stack, if the argument NEW_PROMPT is 0. Otherwise, it displays whatever NEW_PROMPT is. This is used after each gdb command has completed, and in the following cases: - 1. when the user enters a command line which is ended by '\' - indicating that the command will continue on the next line. + 1. when the user enters a command line which is ended by '\' + indicating that the command will continue on the next line. In that case the prompt that is displayed is the empty string. - 2. When the user is entering 'commands' for a breakpoint, or - actions for a tracepoint. In this case the prompt will be '>' - 3. Other???? + 2. When the user is entering 'commands' for a breakpoint, or + actions for a tracepoint. In this case the prompt will be '>' + 3. Other???? FIXME: 2. & 3. not implemented yet for async. */ void display_gdb_prompt (new_prompt) @@ -521,7 +505,7 @@ command_line_handler (rl) #ifdef STOP_SIGNAL if (job_control) - signal (STOP_SIGNAL, stop_sig); + signal (STOP_SIGNAL, handle_stop_sig); #endif /* Make sure that all output has been output. Some machines may let @@ -726,7 +710,7 @@ gdb_readline2 () we'll return NULL then. */ break; free (result); - command_line_handler (0); + (*input_handler) (0); } if (c == '\n') @@ -749,7 +733,7 @@ gdb_readline2 () } result[input_index++] = '\0'; - command_line_handler (result); + (*input_handler) (result); } @@ -767,10 +751,10 @@ gdb_readline2 () as the default for gdb. */ void async_init_signals () -{ +{ signal (SIGINT, handle_sigint); sigint_token = - create_async_signal_handler ((async_handler_func *) async_request_quit, NULL); + create_async_signal_handler (async_request_quit, NULL); /* If SIGTRAP was set to SIG_IGN, then the SIG_IGN will get passed to the inferior and breakpoints will be ignored. */ @@ -788,29 +772,41 @@ async_init_signals () to SIG_DFL for us. */ signal (SIGQUIT, handle_sigquit); sigquit_token = - create_async_signal_handler ((async_handler_func *) async_do_nothing, NULL); + create_async_signal_handler (async_do_nothing, NULL); #ifdef SIGHUP if (signal (SIGHUP, handle_sighup) != SIG_IGN) sighup_token = - create_async_signal_handler ((async_handler_func *) async_disconnect, NULL); + create_async_signal_handler (async_disconnect, NULL); else sighup_token = - create_async_signal_handler ((async_handler_func *) async_do_nothing, NULL); + create_async_signal_handler (async_do_nothing, NULL); #endif signal (SIGFPE, handle_sigfpe); sigfpe_token = - create_async_signal_handler ((async_handler_func *) async_float_handler, NULL); + create_async_signal_handler (async_float_handler, NULL); #if defined(SIGWINCH) && defined(SIGWINCH_HANDLER) signal (SIGWINCH, handle_sigwinch); sigwinch_token = - create_async_signal_handler ((async_handler_func *) SIGWINCH_HANDLER, NULL); + create_async_signal_handler (SIGWINCH_HANDLER, NULL); #endif +#ifdef STOP_SIGNAL + sigtstp_token = + create_async_signal_handler (async_stop_sig, NULL); +#endif + +} + +void +mark_async_signal_handler_wrapper (token) + void *token; +{ + mark_async_signal_handler ((async_signal_handler *) token); } /* Tell the event loop what to do if SIGINT is received. See event-signal.c. */ -void +static void handle_sigint (sig) int sig; { @@ -824,16 +820,17 @@ handle_sigint (sig) that point, though, the command that we want to interrupt needs to finish first, which is unacceptable. */ if (immediate_quit) - async_request_quit (); + async_request_quit (0); else /* If immediate quit is not set, we process SIGINT the next time through the loop, which is fine. */ - mark_async_signal_handler (sigint_token); + mark_async_signal_handler_wrapper (sigint_token); } /* Do the quit. All the checks have been done by the caller. */ void -async_request_quit () +async_request_quit (arg) + gdb_client_data arg; { quit_flag = 1; #ifdef REQUEST_QUIT @@ -845,17 +842,18 @@ async_request_quit () /* Tell the event loop what to do if SIGQUIT is received. See event-signal.c. */ -void +static void handle_sigquit (sig) int sig; { - mark_async_signal_handler (sigquit_token); + mark_async_signal_handler_wrapper (sigquit_token); signal (sig, handle_sigquit); } /* Called by the event loop in response to a SIGQUIT. */ -void -async_do_nothing () +static void +async_do_nothing (arg) + gdb_client_data arg; { /* Empty function body. */ } @@ -863,17 +861,18 @@ async_do_nothing () #ifdef SIGHUP /* Tell the event loop what to do if SIGHUP is received. See event-signal.c. */ -void +static void handle_sighup (sig) int sig; { - mark_async_signal_handler (sighup_token); + mark_async_signal_handler_wrapper (sighup_token); signal (sig, handle_sighup); } -/* Called by the event loop to process a SIGHUP. */ -void -async_disconnect () +/* Called by the event loop to process a SIGHUP */ +static void +async_disconnect (arg) + gdb_client_data arg; { catch_errors (quit_cover, NULL, "Could not kill the program being debugged", @@ -883,19 +882,49 @@ async_disconnect () } #endif +#ifdef STOP_SIGNAL +void handle_stop_sig (sig) + int sig; +{ + mark_async_signal_handler_wrapper (sigtstp_token); + signal (sig, handle_stop_sig); +} + +static void +async_stop_sig (arg) + gdb_client_data arg; +{ + char *prompt = PROMPT (0); +#if STOP_SIGNAL == SIGTSTP + signal (SIGTSTP, SIG_DFL); + sigsetmask (0); + kill (getpid (), SIGTSTP); + signal (SIGTSTP, handle_stop_sig); +#else + signal (STOP_SIGNAL, handle_stop_sig); +#endif + printf_unfiltered ("%s", prompt); + gdb_flush (gdb_stdout); + + /* Forget about any previous command -- null line now will do nothing. */ + dont_repeat (); +} +#endif /* STOP_SIGNAL */ + /* Tell the event loop what to do if SIGFPE is received. See event-signal.c. */ -void +static void handle_sigfpe (sig) int sig; { - mark_async_signal_handler (sigfpe_token); + mark_async_signal_handler_wrapper (sigfpe_token); signal (sig, handle_sigfpe); } /* Event loop will call this functin to process a SIGFPE. */ -void -async_float_handler () +static void +async_float_handler (arg) + gdb_client_data arg; { /* This message is based on ANSI C, section 4.7. Note that integer divide by zero causes this, so "float" is a misnomer. */ @@ -905,11 +934,11 @@ async_float_handler () /* Tell the event loop what to do if SIGWINCH is received. See event-signal.c. */ #if defined(SIGWINCH) && defined(SIGWINCH_HANDLER) -void +static void handle_sigwinch (sig) int sig; { - mark_async_signal_handler (sigwinch_token); + mark_async_signal_handler_wrapper (sigwinch_token); signal (sig, handle_sigwinch); } #endif @@ -948,6 +977,40 @@ set_async_prompt (args, from_tty, c) PROMPT (0) = savestring (new_async_prompt, strlen (new_async_prompt)); } +/* Set things up for readline to be invoked via the alternate + interface, i.e. via a callback function (rl_callback_read_char), + and hook up instream to the event loop.*/ +void +_initialize_event_loop () +{ + /* When a character is detected on instream by select or poll, readline + will be invoked via this callback function. */ + call_readline = rl_callback_read_char; + /* When readline has read an end-of-line character, it passes the + complete line to gdb for processing. command_line_handler is the + function that does this. */ + input_handler = command_line_handler; + + /* Tell readline to use the same input stream that gdb uses. */ + rl_instream = instream; + + /* Get a file descriptor for the input stream, so that we can + register it with the event loop. */ + input_fd = fileno (instream); + /* Now we need to create the event sources for the input file descriptor. */ + /* At this point in time, this is the only event source that we + register with the even loop. Another source is going to be the + target program (inferior), but that must be registered only when + it actually exists (I.e. after we say 'run' or after we connect + to a remote target. */ +#ifdef HAVE_POLL + create_file_handler (input_fd, POLLIN, + (file_handler_func *) call_readline, 0); +#else + create_file_handler (input_fd, GDB_READABLE, + (file_handler_func *) call_readline, 0); +#endif +} diff --git a/gdb/exec.c b/gdb/exec.c index 600a905c8ba..d24c4b49bff 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -641,6 +641,44 @@ exec_files_info (t) } } +/* msnyder 5/21/99: + exec_set_section_offsets sets the offsets of all the sections + in the exec objfile. */ + +void +exec_set_section_offsets (text_off, data_off, bss_off) + bfd_signed_vma text_off; + bfd_signed_vma data_off; + bfd_signed_vma bss_off; +{ + struct section_table *sect; + + for (sect = exec_ops.to_sections; + sect < exec_ops.to_sections_end; + sect++) + { + flagword flags; + + flags = bfd_get_section_flags (exec_bfd, sect->the_bfd_section); + + if (flags & SEC_CODE) + { + sect->addr += text_off; + sect->endaddr += text_off; + } + else if (flags & (SEC_DATA | SEC_LOAD)) + { + sect->addr += data_off; + sect->endaddr += data_off; + } + else if (flags & SEC_ALLOC) + { + sect->addr += bss_off; + sect->endaddr += bss_off; + } + } +} + static void set_section_command (args, from_tty) char *args; diff --git a/gdb/findvar.c b/gdb/findvar.c index 8cfead6618d..f721c71e2bc 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -998,7 +998,34 @@ supply_register (regno, val) /* This routine is getting awfully cluttered with #if's. It's probably time to turn this into READ_PC and define it in the tm.h file. - Ditto for write_pc. */ + Ditto for write_pc. + + 1999-06-08: The following were re-written so that it assumes the + existance of a TARGET_READ_PC et.al. macro. A default generic + version of that macro is made available where needed. + + Since the ``TARGET_READ_PC'' et.al. macro is going to be controlled + by the multi-arch framework, it will eventually be possible to + eliminate the intermediate read_pc_pid(). The client would call + TARGET_READ_PC directly. (cagney). */ + +#ifndef TARGET_READ_PC +#define TARGET_READ_PC generic_target_read_pc +#endif + +CORE_ADDR +generic_target_read_pc (pid) +{ +#ifdef PC_REGNUM + if (PC_REGNUM >= 0) + { + CORE_ADDR pc_val = ADDR_BITS_REMOVE ((CORE_ADDR) read_register_pid (PC_REGNUM, pid)); + return pc_val; + } +#endif + fatal ("generic_target_read_pc"); + return 0; +} CORE_ADDR read_pc_pid (pid) @@ -1011,11 +1038,7 @@ read_pc_pid (pid) saved_inferior_pid = inferior_pid; inferior_pid = pid; -#ifdef TARGET_READ_PC pc_val = TARGET_READ_PC (pid); -#else - pc_val = ADDR_BITS_REMOVE ((CORE_ADDR) read_register_pid (PC_REGNUM, pid)); -#endif inferior_pid = saved_inferior_pid; return pc_val; @@ -1027,6 +1050,31 @@ read_pc () return read_pc_pid (inferior_pid); } +#ifndef TARGET_WRITE_PC +#define TARGET_WRITE_PC generic_target_write_pc +#endif + +void +generic_target_write_pc (pc, pid) + CORE_ADDR pc; + int pid; +{ +#ifdef PC_REGNUM + if (PC_REGNUM >= 0) + write_register_pid (PC_REGNUM, pc, pid); +#ifdef NPC_REGNUM + if (NPC_REGNUM >= 0) + write_register_pid (NPC_REGNUM, pc + 4, pid); +#ifdef NNPC_REGNUM + if (NNPC_REGNUM >= 0) + write_register_pid (NNPC_REGNUM, pc + 8, pid); +#endif +#endif +#else + fatal ("generic_target_write_pc"); +#endif +} + void write_pc_pid (pc, pid) CORE_ADDR pc; @@ -1038,17 +1086,7 @@ write_pc_pid (pc, pid) saved_inferior_pid = inferior_pid; inferior_pid = pid; -#ifdef TARGET_WRITE_PC TARGET_WRITE_PC (pc, pid); -#else - write_register_pid (PC_REGNUM, pc, pid); -#ifdef NPC_REGNUM - write_register_pid (NPC_REGNUM, pc + 4, pid); -#ifdef NNPC_REGNUM - write_register_pid (NNPC_REGNUM, pc + 8, pid); -#endif -#endif -#endif inferior_pid = saved_inferior_pid; } @@ -1062,46 +1100,94 @@ write_pc (pc) /* Cope with strage ways of getting to the stack and frame pointers */ +#ifndef TARGET_READ_SP +#define TARGET_READ_SP generic_target_read_sp +#endif + +CORE_ADDR +generic_target_read_sp () +{ +#ifdef SP_REGNUM + if (SP_REGNUM >= 0) + return read_register (SP_REGNUM); +#endif + fatal ("generic_target_read_sp"); +} + CORE_ADDR read_sp () { -#ifdef TARGET_READ_SP return TARGET_READ_SP (); -#else - return read_register (SP_REGNUM); +} + +#ifndef TARGET_WRITE_SP +#define TARGET_WRITE_SP generic_target_write_sp +#endif + +void +generic_target_write_sp (val) + CORE_ADDR val; +{ +#ifdef SP_REGNUM + if (SP_REGNUM >= 0) + { + write_register (SP_REGNUM, val); + return; + } #endif + fatal ("generic_target_write_sp"); } void write_sp (val) CORE_ADDR val; { -#ifdef TARGET_WRITE_SP TARGET_WRITE_SP (val); -#else - write_register (SP_REGNUM, val); +} + +#ifndef TARGET_READ_FP +#define TARGET_READ_FP generic_target_read_fp #endif + +CORE_ADDR +generic_target_read_fp () +{ +#ifdef FP_REGNUM + if (FP_REGNUM >= 0) + return read_register (FP_REGNUM); +#endif + fatal ("generic_target_read_fp"); } CORE_ADDR read_fp () { -#ifdef TARGET_READ_FP return TARGET_READ_FP (); -#else - return read_register (FP_REGNUM); +} + +#ifndef TARGET_WRITE_FP +#define TARGET_WRITE_FP generic_target_write_fp +#endif + +void +generic_target_write_fp (val) + CORE_ADDR val; +{ +#ifdef FP_REGNUM + if (FP_REGNUM >= 0) + { + write_register (FP_REGNUM, val); + return; + } #endif + fatal ("generic_target_write_fp"); } void write_fp (val) CORE_ADDR val; { -#ifdef TARGET_WRITE_FP TARGET_WRITE_FP (val); -#else - write_register (FP_REGNUM, val); -#endif } /* Will calling read_var_value or locate_var_value on SYM end @@ -1640,4 +1726,8 @@ void _initialize_findvar () { build_findvar (); + + register_gdbarch_swap (®isters, sizeof (registers), NULL); + register_gdbarch_swap (®ister_valid, sizeof (register_valid), NULL); + register_gdbarch_swap (NULL, 0, build_findvar); } diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index e6f647eae2f..d0cf66d12e6 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -19,6 +19,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "defs.h" +#if GDB_MULTI_ARCH +#include "gdbcmd.h" +#include "inferior.h" /* enum CALL_DUMMY_LOCATION et.al. */ +#else /* Just include everything in sight so that the every old definition of macro is visible. */ #include "gdb_string.h" @@ -34,15 +38,2788 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "gdbthread.h" #include "annotate.h" #include "symfile.h" /* for overlay functions */ +#endif #include "symcat.h" -/* Non-zero if we want to trace architecture code. */ +/* Convenience macro for allocting typesafe memory. */ + +#ifndef XMALLOC +#define XMALLOC(TYPE) (TYPE*) xmalloc (sizeof (TYPE)) +#endif + + +/* Non-zero if we want to trace architecture code. */ + +#ifndef GDBARCH_DEBUG +#define GDBARCH_DEBUG 0 +#endif +int gdbarch_debug = GDBARCH_DEBUG; + + +/* Maintain the struct gdbarch object */ + +struct gdbarch +{ + /* basic architectural information */ + const struct bfd_arch_info * bfd_arch_info; + int byte_order; + + /* target specific vector. */ + struct gdbarch_tdep *tdep; + + /* per-architecture data-pointers */ + int nr_data; + void **data; + + /* per-architecture swap-regions */ + struct gdbarch_swap *swap; + + /* Multi-arch values. + + When extending this structure you must: + + Add the field below. + + Declare set/get functions and define the corresponding + macro in gdbarch.h. + + gdbarch_alloc(): If zero/NULL is not a suitable default, + initialize the new field. + + verify_gdbarch(): Confirm that the target updated the field + correctly. + + gdbarch_dump(): Add a fprintf_unfiltered call to so that the new + field is dumped out + + ``default_gdbarch()'': Append an initial value to the static + variable (base values on the host's c-type system). + + get_gdbarch(): Implement the set/get functions (probably using + the macro's as shortcuts). + + */ + + int ptr_bit; + int short_bit; + int int_bit; + int long_bit; + int long_long_bit; + int float_bit; + int double_bit; + int long_double_bit; + gdbarch_read_pc_ftype *read_pc; + gdbarch_write_pc_ftype *write_pc; + gdbarch_read_fp_ftype *read_fp; + gdbarch_write_fp_ftype *write_fp; + gdbarch_read_sp_ftype *read_sp; + gdbarch_write_sp_ftype *write_sp; + int num_regs; + int sp_regnum; + int fp_regnum; + int pc_regnum; + gdbarch_register_name_ftype *register_name; + int register_size; + int register_bytes; + gdbarch_register_byte_ftype *register_byte; + gdbarch_register_raw_size_ftype *register_raw_size; + int max_register_raw_size; + gdbarch_register_virtual_size_ftype *register_virtual_size; + int max_register_virtual_size; + gdbarch_register_virtual_type_ftype *register_virtual_type; + int use_generic_dummy_frames; + int call_dummy_location; + gdbarch_call_dummy_address_ftype *call_dummy_address; + CORE_ADDR call_dummy_start_offset; + CORE_ADDR call_dummy_breakpoint_offset; + int call_dummy_breakpoint_offset_p; + int call_dummy_length; + gdbarch_pc_in_call_dummy_ftype *pc_in_call_dummy; + int call_dummy_p; + LONGEST * call_dummy_words; + int sizeof_call_dummy_words; + int call_dummy_stack_adjust_p; + int call_dummy_stack_adjust; + gdbarch_fix_call_dummy_ftype *fix_call_dummy; + int believe_pcc_promotion; + int believe_pcc_promotion_type; + gdbarch_get_saved_register_ftype *get_saved_register; + gdbarch_register_convertible_ftype *register_convertible; + gdbarch_register_convert_to_virtual_ftype *register_convert_to_virtual; + gdbarch_register_convert_to_raw_ftype *register_convert_to_raw; + gdbarch_extract_return_value_ftype *extract_return_value; + gdbarch_push_arguments_ftype *push_arguments; + gdbarch_push_dummy_frame_ftype *push_dummy_frame; + gdbarch_push_return_address_ftype *push_return_address; + gdbarch_pop_frame_ftype *pop_frame; + gdbarch_d10v_make_daddr_ftype *d10v_make_daddr; + gdbarch_d10v_make_iaddr_ftype *d10v_make_iaddr; + gdbarch_d10v_daddr_p_ftype *d10v_daddr_p; + gdbarch_d10v_iaddr_p_ftype *d10v_iaddr_p; + gdbarch_d10v_convert_daddr_to_raw_ftype *d10v_convert_daddr_to_raw; + gdbarch_d10v_convert_iaddr_to_raw_ftype *d10v_convert_iaddr_to_raw; + gdbarch_store_struct_return_ftype *store_struct_return; + gdbarch_store_return_value_ftype *store_return_value; + gdbarch_extract_struct_value_address_ftype *extract_struct_value_address; + gdbarch_use_struct_convention_ftype *use_struct_convention; + gdbarch_frame_init_saved_regs_ftype *frame_init_saved_regs; + gdbarch_init_extra_frame_info_ftype *init_extra_frame_info; + gdbarch_skip_prologue_ftype *skip_prologue; + gdbarch_inner_than_ftype *inner_than; + gdbarch_breakpoint_from_pc_ftype *breakpoint_from_pc; + CORE_ADDR decr_pc_after_break; + CORE_ADDR function_start_offset; + gdbarch_remote_translate_xfer_address_ftype *remote_translate_xfer_address; + CORE_ADDR frame_args_skip; + gdbarch_frameless_function_invocation_ftype *frameless_function_invocation; + gdbarch_frame_chain_ftype *frame_chain; + gdbarch_frame_chain_valid_ftype *frame_chain_valid; + gdbarch_frame_saved_pc_ftype *frame_saved_pc; + gdbarch_frame_args_address_ftype *frame_args_address; + gdbarch_frame_locals_address_ftype *frame_locals_address; + gdbarch_saved_pc_after_call_ftype *saved_pc_after_call; + gdbarch_frame_num_args_ftype *frame_num_args; +}; + + +/* The default architecture uses host values (for want of a better + choice). */ + +extern const struct bfd_arch_info bfd_default_arch_struct; + +struct gdbarch default_gdbarch = { + /* basic architecture information */ + &bfd_default_arch_struct, + BIG_ENDIAN, + /* target specific vector */ + NULL, + /*per-architecture data-pointers and swap regions */ + 0, NULL, NULL, + /* Multi-arch values */ + 8 * sizeof (void*), + 8 * sizeof (short), + 8 * sizeof (int), + 8 * sizeof (long), + 8 * sizeof (LONGEST), + 8 * sizeof (float), + 8 * sizeof (double), + 8 * sizeof (long double), + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + generic_get_saved_register, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + /* default_gdbarch() */ +}; +struct gdbarch *current_gdbarch = &default_gdbarch; + + +/* Create a new ``struct gdbarch'' based in information provided by + ``struct gdbarch_info''. */ + +struct gdbarch * +gdbarch_alloc (info, tdep) + const struct gdbarch_info *info; + struct gdbarch_tdep *tdep; +{ + struct gdbarch *gdbarch = XMALLOC (struct gdbarch); + memset (gdbarch, 0, sizeof (*gdbarch)); + + gdbarch->tdep = tdep; + + gdbarch->bfd_arch_info = info->bfd_arch_info; + gdbarch->byte_order = info->byte_order; + + /* Force the explicit initialization of these. */ + gdbarch->num_regs = -1; + gdbarch->sp_regnum = -1; + gdbarch->fp_regnum = -1; + gdbarch->pc_regnum = -1; + gdbarch->register_size = -1; + gdbarch->register_bytes = -1; + gdbarch->max_register_raw_size = -1; + gdbarch->max_register_virtual_size = -1; + gdbarch->use_generic_dummy_frames = -1; + gdbarch->call_dummy_start_offset = -1; + gdbarch->call_dummy_breakpoint_offset = -1; + gdbarch->call_dummy_breakpoint_offset_p = -1; + gdbarch->call_dummy_length = -1; + gdbarch->call_dummy_p = -1; + gdbarch->call_dummy_stack_adjust_p = -1; + gdbarch->decr_pc_after_break = -1; + gdbarch->function_start_offset = -1; + gdbarch->frame_args_skip = -1; + /* gdbarch_alloc() */ + + return gdbarch; +} + + +/* Ensure that all values in a GDBARCH are reasonable. */ + +static void verify_gdbarch PARAMS ((struct gdbarch *gdbarch)); +static void +verify_gdbarch (gdbarch) + struct gdbarch *gdbarch; +{ + /* Only perform sanity checks on a multi-arch target. */ + if (GDB_MULTI_ARCH <= 0) + return; + /* fundamental */ + if (gdbarch->byte_order == 0) + fatal ("verify_gdbarch: byte-order unset"); + if (gdbarch->bfd_arch_info == NULL) + fatal ("verify_gdbarch: bfd_arch_info unset"); + /* Check those that need to be defined for the given multi-arch level. */ + if ((GDB_MULTI_ARCH >= 1) + && (gdbarch->ptr_bit == 0)) + fatal ("gdbarch: verify_gdbarch: ptr_bit invalid"); + if ((GDB_MULTI_ARCH >= 1) + && (gdbarch->short_bit == 0)) + fatal ("gdbarch: verify_gdbarch: short_bit invalid"); + if ((GDB_MULTI_ARCH >= 1) + && (gdbarch->int_bit == 0)) + fatal ("gdbarch: verify_gdbarch: int_bit invalid"); + if ((GDB_MULTI_ARCH >= 1) + && (gdbarch->long_bit == 0)) + fatal ("gdbarch: verify_gdbarch: long_bit invalid"); + if ((GDB_MULTI_ARCH >= 1) + && (gdbarch->long_long_bit == 0)) + fatal ("gdbarch: verify_gdbarch: long_long_bit invalid"); + if ((GDB_MULTI_ARCH >= 1) + && (gdbarch->float_bit == 0)) + fatal ("gdbarch: verify_gdbarch: float_bit invalid"); + if ((GDB_MULTI_ARCH >= 1) + && (gdbarch->double_bit == 0)) + fatal ("gdbarch: verify_gdbarch: double_bit invalid"); + if ((GDB_MULTI_ARCH >= 1) + && (gdbarch->long_double_bit == 0)) + fatal ("gdbarch: verify_gdbarch: long_double_bit invalid"); + if ((GDB_MULTI_ARCH >= 1) + && (gdbarch->read_pc == 0)) + fatal ("gdbarch: verify_gdbarch: read_pc invalid"); + if ((GDB_MULTI_ARCH >= 1) + && (gdbarch->write_pc == 0)) + fatal ("gdbarch: verify_gdbarch: write_pc invalid"); + if ((GDB_MULTI_ARCH >= 1) + && (gdbarch->read_fp == 0)) + fatal ("gdbarch: verify_gdbarch: read_fp invalid"); + if ((GDB_MULTI_ARCH >= 1) + && (gdbarch->write_fp == 0)) + fatal ("gdbarch: verify_gdbarch: write_fp invalid"); + if ((GDB_MULTI_ARCH >= 1) + && (gdbarch->read_sp == 0)) + fatal ("gdbarch: verify_gdbarch: read_sp invalid"); + if ((GDB_MULTI_ARCH >= 1) + && (gdbarch->write_sp == 0)) + fatal ("gdbarch: verify_gdbarch: write_sp invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->num_regs == -1)) + fatal ("gdbarch: verify_gdbarch: num_regs invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->sp_regnum == -1)) + fatal ("gdbarch: verify_gdbarch: sp_regnum invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->fp_regnum == -1)) + fatal ("gdbarch: verify_gdbarch: fp_regnum invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->pc_regnum == -1)) + fatal ("gdbarch: verify_gdbarch: pc_regnum invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->register_name == 0)) + fatal ("gdbarch: verify_gdbarch: register_name invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->register_size == -1)) + fatal ("gdbarch: verify_gdbarch: register_size invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->register_bytes == -1)) + fatal ("gdbarch: verify_gdbarch: register_bytes invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->register_byte == 0)) + fatal ("gdbarch: verify_gdbarch: register_byte invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->register_raw_size == 0)) + fatal ("gdbarch: verify_gdbarch: register_raw_size invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->max_register_raw_size == -1)) + fatal ("gdbarch: verify_gdbarch: max_register_raw_size invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->register_virtual_size == 0)) + fatal ("gdbarch: verify_gdbarch: register_virtual_size invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->max_register_virtual_size == -1)) + fatal ("gdbarch: verify_gdbarch: max_register_virtual_size invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->register_virtual_type == 0)) + fatal ("gdbarch: verify_gdbarch: register_virtual_type invalid"); + if ((GDB_MULTI_ARCH >= 1) + && (gdbarch->use_generic_dummy_frames == -1)) + fatal ("gdbarch: verify_gdbarch: use_generic_dummy_frames invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->call_dummy_location == 0)) + fatal ("gdbarch: verify_gdbarch: call_dummy_location invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->call_dummy_location == AT_ENTRY_POINT && gdbarch->call_dummy_address == 0)) + fatal ("gdbarch: verify_gdbarch: call_dummy_address invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->call_dummy_start_offset == -1)) + fatal ("gdbarch: verify_gdbarch: call_dummy_start_offset invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->call_dummy_breakpoint_offset == -1)) + fatal ("gdbarch: verify_gdbarch: call_dummy_breakpoint_offset invalid"); + if ((GDB_MULTI_ARCH >= 1) + && (gdbarch->call_dummy_breakpoint_offset_p == -1)) + fatal ("gdbarch: verify_gdbarch: call_dummy_breakpoint_offset_p invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->call_dummy_length == -1)) + fatal ("gdbarch: verify_gdbarch: call_dummy_length invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->pc_in_call_dummy == 0)) + fatal ("gdbarch: verify_gdbarch: pc_in_call_dummy invalid"); + if ((GDB_MULTI_ARCH >= 1) + && (gdbarch->call_dummy_p == -1)) + fatal ("gdbarch: verify_gdbarch: call_dummy_p invalid"); + if ((GDB_MULTI_ARCH >= 1) + && (gdbarch->call_dummy_stack_adjust_p == -1)) + fatal ("gdbarch: verify_gdbarch: call_dummy_stack_adjust_p invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->call_dummy_stack_adjust_p && gdbarch->call_dummy_stack_adjust == 0)) + fatal ("gdbarch: verify_gdbarch: call_dummy_stack_adjust invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->fix_call_dummy == 0)) + fatal ("gdbarch: verify_gdbarch: fix_call_dummy invalid"); + if ((GDB_MULTI_ARCH >= 1) + && (gdbarch->get_saved_register == 0)) + fatal ("gdbarch: verify_gdbarch: get_saved_register invalid"); + if ((GDB_MULTI_ARCH >= 1) + && (gdbarch->register_convertible == 0)) + fatal ("gdbarch: verify_gdbarch: register_convertible invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->register_convert_to_virtual == 0)) + fatal ("gdbarch: verify_gdbarch: register_convert_to_virtual invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->register_convert_to_raw == 0)) + fatal ("gdbarch: verify_gdbarch: register_convert_to_raw invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->extract_return_value == 0)) + fatal ("gdbarch: verify_gdbarch: extract_return_value invalid"); + if ((GDB_MULTI_ARCH >= 1) + && (gdbarch->push_arguments == 0)) + fatal ("gdbarch: verify_gdbarch: push_arguments invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->push_dummy_frame == 0)) + fatal ("gdbarch: verify_gdbarch: push_dummy_frame invalid"); + if ((GDB_MULTI_ARCH >= 1) + && (gdbarch->push_return_address == 0)) + fatal ("gdbarch: verify_gdbarch: push_return_address invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->pop_frame == 0)) + fatal ("gdbarch: verify_gdbarch: pop_frame invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->d10v_make_daddr == 0)) + fatal ("gdbarch: verify_gdbarch: d10v_make_daddr invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->d10v_make_iaddr == 0)) + fatal ("gdbarch: verify_gdbarch: d10v_make_iaddr invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->d10v_daddr_p == 0)) + fatal ("gdbarch: verify_gdbarch: d10v_daddr_p invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->d10v_iaddr_p == 0)) + fatal ("gdbarch: verify_gdbarch: d10v_iaddr_p invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->d10v_convert_daddr_to_raw == 0)) + fatal ("gdbarch: verify_gdbarch: d10v_convert_daddr_to_raw invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->d10v_convert_iaddr_to_raw == 0)) + fatal ("gdbarch: verify_gdbarch: d10v_convert_iaddr_to_raw invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->store_struct_return == 0)) + fatal ("gdbarch: verify_gdbarch: store_struct_return invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->store_return_value == 0)) + fatal ("gdbarch: verify_gdbarch: store_return_value invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->extract_struct_value_address == 0)) + fatal ("gdbarch: verify_gdbarch: extract_struct_value_address invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->use_struct_convention == 0)) + fatal ("gdbarch: verify_gdbarch: use_struct_convention invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->frame_init_saved_regs == 0)) + fatal ("gdbarch: verify_gdbarch: frame_init_saved_regs invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->init_extra_frame_info == 0)) + fatal ("gdbarch: verify_gdbarch: init_extra_frame_info invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->skip_prologue == 0)) + fatal ("gdbarch: verify_gdbarch: skip_prologue invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->inner_than == 0)) + fatal ("gdbarch: verify_gdbarch: inner_than invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->breakpoint_from_pc == 0)) + fatal ("gdbarch: verify_gdbarch: breakpoint_from_pc invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->decr_pc_after_break == -1)) + fatal ("gdbarch: verify_gdbarch: decr_pc_after_break invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->function_start_offset == -1)) + fatal ("gdbarch: verify_gdbarch: function_start_offset invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->remote_translate_xfer_address == 0)) + fatal ("gdbarch: verify_gdbarch: remote_translate_xfer_address invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->frame_args_skip == -1)) + fatal ("gdbarch: verify_gdbarch: frame_args_skip invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->frameless_function_invocation == 0)) + fatal ("gdbarch: verify_gdbarch: frameless_function_invocation invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->frame_chain == 0)) + fatal ("gdbarch: verify_gdbarch: frame_chain invalid"); + if ((GDB_MULTI_ARCH >= 1) + && (gdbarch->frame_chain_valid == 0)) + fatal ("gdbarch: verify_gdbarch: frame_chain_valid invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->frame_saved_pc == 0)) + fatal ("gdbarch: verify_gdbarch: frame_saved_pc invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->frame_args_address == 0)) + fatal ("gdbarch: verify_gdbarch: frame_args_address invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->frame_locals_address == 0)) + fatal ("gdbarch: verify_gdbarch: frame_locals_address invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->saved_pc_after_call == 0)) + fatal ("gdbarch: verify_gdbarch: saved_pc_after_call invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->frame_num_args == 0)) + fatal ("gdbarch: verify_gdbarch: frame_num_args invalid"); +} + + +/* Print out the details of the current architecture. */ + +void +gdbarch_dump () +{ + if (TARGET_ARCHITECTURE != NULL) + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: TARGET_ARCHITECTURE = %s\n", + TARGET_ARCHITECTURE->printable_name); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: TARGET_BYTE_ORDER = %ld\n", + (long) TARGET_BYTE_ORDER); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: TARGET_PTR_BIT = %ld\n", + (long) TARGET_PTR_BIT); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: TARGET_SHORT_BIT = %ld\n", + (long) TARGET_SHORT_BIT); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: TARGET_INT_BIT = %ld\n", + (long) TARGET_INT_BIT); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: TARGET_LONG_BIT = %ld\n", + (long) TARGET_LONG_BIT); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: TARGET_LONG_LONG_BIT = %ld\n", + (long) TARGET_LONG_LONG_BIT); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: TARGET_FLOAT_BIT = %ld\n", + (long) TARGET_FLOAT_BIT); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: TARGET_DOUBLE_BIT = %ld\n", + (long) TARGET_DOUBLE_BIT); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: TARGET_LONG_DOUBLE_BIT = %ld\n", + (long) TARGET_LONG_DOUBLE_BIT); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: TARGET_READ_PC = 0x%08lx\n", + (long) current_gdbarch->read_pc + /*TARGET_READ_PC ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: TARGET_WRITE_PC = 0x%08lx\n", + (long) current_gdbarch->write_pc + /*TARGET_WRITE_PC ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: TARGET_READ_FP = 0x%08lx\n", + (long) current_gdbarch->read_fp + /*TARGET_READ_FP ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: TARGET_WRITE_FP = 0x%08lx\n", + (long) current_gdbarch->write_fp + /*TARGET_WRITE_FP ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: TARGET_READ_SP = 0x%08lx\n", + (long) current_gdbarch->read_sp + /*TARGET_READ_SP ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: TARGET_WRITE_SP = 0x%08lx\n", + (long) current_gdbarch->write_sp + /*TARGET_WRITE_SP ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: NUM_REGS = %ld\n", + (long) NUM_REGS); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: SP_REGNUM = %ld\n", + (long) SP_REGNUM); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: FP_REGNUM = %ld\n", + (long) FP_REGNUM); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: PC_REGNUM = %ld\n", + (long) PC_REGNUM); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: REGISTER_NAME = 0x%08lx\n", + (long) current_gdbarch->register_name + /*REGISTER_NAME ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: REGISTER_SIZE = %ld\n", + (long) REGISTER_SIZE); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: REGISTER_BYTES = %ld\n", + (long) REGISTER_BYTES); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: REGISTER_BYTE = 0x%08lx\n", + (long) current_gdbarch->register_byte + /*REGISTER_BYTE ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: REGISTER_RAW_SIZE = 0x%08lx\n", + (long) current_gdbarch->register_raw_size + /*REGISTER_RAW_SIZE ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: MAX_REGISTER_RAW_SIZE = %ld\n", + (long) MAX_REGISTER_RAW_SIZE); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: REGISTER_VIRTUAL_SIZE = 0x%08lx\n", + (long) current_gdbarch->register_virtual_size + /*REGISTER_VIRTUAL_SIZE ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: MAX_REGISTER_VIRTUAL_SIZE = %ld\n", + (long) MAX_REGISTER_VIRTUAL_SIZE); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: REGISTER_VIRTUAL_TYPE = 0x%08lx\n", + (long) current_gdbarch->register_virtual_type + /*REGISTER_VIRTUAL_TYPE ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: USE_GENERIC_DUMMY_FRAMES = %ld\n", + (long) USE_GENERIC_DUMMY_FRAMES); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: CALL_DUMMY_LOCATION = %ld\n", + (long) CALL_DUMMY_LOCATION); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: CALL_DUMMY_ADDRESS = 0x%08lx\n", + (long) current_gdbarch->call_dummy_address + /*CALL_DUMMY_ADDRESS ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: CALL_DUMMY_START_OFFSET = 0x%08lx\n", + (long) CALL_DUMMY_START_OFFSET); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: CALL_DUMMY_BREAKPOINT_OFFSET = 0x%08lx\n", + (long) CALL_DUMMY_BREAKPOINT_OFFSET); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: CALL_DUMMY_BREAKPOINT_OFFSET_P = %ld\n", + (long) CALL_DUMMY_BREAKPOINT_OFFSET_P); + if (CALL_DUMMY_LOCATION == BEFORE_TEXT_END || CALL_DUMMY_LOCATION == AFTER_TEXT_END) + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: CALL_DUMMY_LENGTH = %ld\n", + (long) CALL_DUMMY_LENGTH); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: PC_IN_CALL_DUMMY = 0x%08lx\n", + (long) current_gdbarch->pc_in_call_dummy + /*PC_IN_CALL_DUMMY ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: CALL_DUMMY_P = %ld\n", + (long) CALL_DUMMY_P); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: CALL_DUMMY_WORDS = 0x%08lx\n", + (long) CALL_DUMMY_WORDS); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: SIZEOF_CALL_DUMMY_WORDS = 0x%08lx\n", + (long) SIZEOF_CALL_DUMMY_WORDS); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: CALL_DUMMY_STACK_ADJUST_P = 0x%08lx\n", + (long) CALL_DUMMY_STACK_ADJUST_P); + if (CALL_DUMMY_STACK_ADJUST_P) + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: CALL_DUMMY_STACK_ADJUST = 0x%08lx\n", + (long) CALL_DUMMY_STACK_ADJUST); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: FIX_CALL_DUMMY = 0x%08lx\n", + (long) current_gdbarch->fix_call_dummy + /*FIX_CALL_DUMMY ()*/); +#ifdef BELIEVE_PCC_PROMOTION + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: BELIEVE_PCC_PROMOTION = %ld\n", + (long) BELIEVE_PCC_PROMOTION); +#endif +#ifdef BELIEVE_PCC_PROMOTION_TYPE + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: BELIEVE_PCC_PROMOTION_TYPE = %ld\n", + (long) BELIEVE_PCC_PROMOTION_TYPE); +#endif + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: GET_SAVED_REGISTER = 0x%08lx\n", + (long) current_gdbarch->get_saved_register + /*GET_SAVED_REGISTER ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: REGISTER_CONVERTIBLE = 0x%08lx\n", + (long) current_gdbarch->register_convertible + /*REGISTER_CONVERTIBLE ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: REGISTER_CONVERT_TO_VIRTUAL = 0x%08lx\n", + (long) current_gdbarch->register_convert_to_virtual + /*REGISTER_CONVERT_TO_VIRTUAL ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: REGISTER_CONVERT_TO_RAW = 0x%08lx\n", + (long) current_gdbarch->register_convert_to_raw + /*REGISTER_CONVERT_TO_RAW ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: EXTRACT_RETURN_VALUE = 0x%08lx\n", + (long) current_gdbarch->extract_return_value + /*EXTRACT_RETURN_VALUE ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: PUSH_ARGUMENTS = 0x%08lx\n", + (long) current_gdbarch->push_arguments + /*PUSH_ARGUMENTS ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: PUSH_DUMMY_FRAME = 0x%08lx\n", + (long) current_gdbarch->push_dummy_frame + /*PUSH_DUMMY_FRAME ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: PUSH_RETURN_ADDRESS = 0x%08lx\n", + (long) current_gdbarch->push_return_address + /*PUSH_RETURN_ADDRESS ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: POP_FRAME = 0x%08lx\n", + (long) current_gdbarch->pop_frame + /*POP_FRAME ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: D10V_MAKE_DADDR = 0x%08lx\n", + (long) current_gdbarch->d10v_make_daddr + /*D10V_MAKE_DADDR ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: D10V_MAKE_IADDR = 0x%08lx\n", + (long) current_gdbarch->d10v_make_iaddr + /*D10V_MAKE_IADDR ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: D10V_DADDR_P = 0x%08lx\n", + (long) current_gdbarch->d10v_daddr_p + /*D10V_DADDR_P ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: D10V_IADDR_P = 0x%08lx\n", + (long) current_gdbarch->d10v_iaddr_p + /*D10V_IADDR_P ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: D10V_CONVERT_DADDR_TO_RAW = 0x%08lx\n", + (long) current_gdbarch->d10v_convert_daddr_to_raw + /*D10V_CONVERT_DADDR_TO_RAW ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: D10V_CONVERT_IADDR_TO_RAW = 0x%08lx\n", + (long) current_gdbarch->d10v_convert_iaddr_to_raw + /*D10V_CONVERT_IADDR_TO_RAW ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: STORE_STRUCT_RETURN = 0x%08lx\n", + (long) current_gdbarch->store_struct_return + /*STORE_STRUCT_RETURN ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: STORE_RETURN_VALUE = 0x%08lx\n", + (long) current_gdbarch->store_return_value + /*STORE_RETURN_VALUE ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: EXTRACT_STRUCT_VALUE_ADDRESS = 0x%08lx\n", + (long) current_gdbarch->extract_struct_value_address + /*EXTRACT_STRUCT_VALUE_ADDRESS ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: USE_STRUCT_CONVENTION = 0x%08lx\n", + (long) current_gdbarch->use_struct_convention + /*USE_STRUCT_CONVENTION ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: FRAME_INIT_SAVED_REGS = 0x%08lx\n", + (long) current_gdbarch->frame_init_saved_regs + /*FRAME_INIT_SAVED_REGS ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: INIT_EXTRA_FRAME_INFO = 0x%08lx\n", + (long) current_gdbarch->init_extra_frame_info + /*INIT_EXTRA_FRAME_INFO ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: SKIP_PROLOGUE = 0x%08lx\n", + (long) current_gdbarch->skip_prologue + /*SKIP_PROLOGUE ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: INNER_THAN = 0x%08lx\n", + (long) current_gdbarch->inner_than + /*INNER_THAN ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: BREAKPOINT_FROM_PC = 0x%08lx\n", + (long) current_gdbarch->breakpoint_from_pc + /*BREAKPOINT_FROM_PC ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: DECR_PC_AFTER_BREAK = %ld\n", + (long) DECR_PC_AFTER_BREAK); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: FUNCTION_START_OFFSET = %ld\n", + (long) FUNCTION_START_OFFSET); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: REMOTE_TRANSLATE_XFER_ADDRESS = 0x%08lx\n", + (long) current_gdbarch->remote_translate_xfer_address + /*REMOTE_TRANSLATE_XFER_ADDRESS ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: FRAME_ARGS_SKIP = %ld\n", + (long) FRAME_ARGS_SKIP); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: FRAMELESS_FUNCTION_INVOCATION = 0x%08lx\n", + (long) current_gdbarch->frameless_function_invocation + /*FRAMELESS_FUNCTION_INVOCATION ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: FRAME_CHAIN = 0x%08lx\n", + (long) current_gdbarch->frame_chain + /*FRAME_CHAIN ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: FRAME_CHAIN_VALID = 0x%08lx\n", + (long) current_gdbarch->frame_chain_valid + /*FRAME_CHAIN_VALID ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: FRAME_SAVED_PC = 0x%08lx\n", + (long) current_gdbarch->frame_saved_pc + /*FRAME_SAVED_PC ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: FRAME_ARGS_ADDRESS = 0x%08lx\n", + (long) current_gdbarch->frame_args_address + /*FRAME_ARGS_ADDRESS ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: FRAME_LOCALS_ADDRESS = 0x%08lx\n", + (long) current_gdbarch->frame_locals_address + /*FRAME_LOCALS_ADDRESS ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: SAVED_PC_AFTER_CALL = 0x%08lx\n", + (long) current_gdbarch->saved_pc_after_call + /*SAVED_PC_AFTER_CALL ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: FRAME_NUM_ARGS = 0x%08lx\n", + (long) current_gdbarch->frame_num_args + /*FRAME_NUM_ARGS ()*/); +} + +struct gdbarch_tdep * +gdbarch_tdep (gdbarch) + struct gdbarch *gdbarch; +{ + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_tdep called\n"); + return gdbarch->tdep; +} + + +const struct bfd_arch_info * +gdbarch_bfd_arch_info (gdbarch) + struct gdbarch *gdbarch; +{ + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_bfd_arch_info called\n"); + return gdbarch->bfd_arch_info; +} + +int +gdbarch_byte_order (gdbarch) + struct gdbarch *gdbarch; +{ + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_byte_order called\n"); + return gdbarch->byte_order; +} + +int +gdbarch_ptr_bit (gdbarch) + struct gdbarch *gdbarch; +{ + if (gdbarch->ptr_bit == 0) + fatal ("gdbarch: gdbarch_ptr_bit invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_ptr_bit called\n"); + return gdbarch->ptr_bit; +} + +void +set_gdbarch_ptr_bit (gdbarch, ptr_bit) + struct gdbarch *gdbarch; + int ptr_bit; +{ + gdbarch->ptr_bit = ptr_bit; +} + +int +gdbarch_short_bit (gdbarch) + struct gdbarch *gdbarch; +{ + if (gdbarch->short_bit == 0) + fatal ("gdbarch: gdbarch_short_bit invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_short_bit called\n"); + return gdbarch->short_bit; +} + +void +set_gdbarch_short_bit (gdbarch, short_bit) + struct gdbarch *gdbarch; + int short_bit; +{ + gdbarch->short_bit = short_bit; +} + +int +gdbarch_int_bit (gdbarch) + struct gdbarch *gdbarch; +{ + if (gdbarch->int_bit == 0) + fatal ("gdbarch: gdbarch_int_bit invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_int_bit called\n"); + return gdbarch->int_bit; +} + +void +set_gdbarch_int_bit (gdbarch, int_bit) + struct gdbarch *gdbarch; + int int_bit; +{ + gdbarch->int_bit = int_bit; +} + +int +gdbarch_long_bit (gdbarch) + struct gdbarch *gdbarch; +{ + if (gdbarch->long_bit == 0) + fatal ("gdbarch: gdbarch_long_bit invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_long_bit called\n"); + return gdbarch->long_bit; +} + +void +set_gdbarch_long_bit (gdbarch, long_bit) + struct gdbarch *gdbarch; + int long_bit; +{ + gdbarch->long_bit = long_bit; +} + +int +gdbarch_long_long_bit (gdbarch) + struct gdbarch *gdbarch; +{ + if (gdbarch->long_long_bit == 0) + fatal ("gdbarch: gdbarch_long_long_bit invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_long_long_bit called\n"); + return gdbarch->long_long_bit; +} + +void +set_gdbarch_long_long_bit (gdbarch, long_long_bit) + struct gdbarch *gdbarch; + int long_long_bit; +{ + gdbarch->long_long_bit = long_long_bit; +} + +int +gdbarch_float_bit (gdbarch) + struct gdbarch *gdbarch; +{ + if (gdbarch->float_bit == 0) + fatal ("gdbarch: gdbarch_float_bit invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_float_bit called\n"); + return gdbarch->float_bit; +} + +void +set_gdbarch_float_bit (gdbarch, float_bit) + struct gdbarch *gdbarch; + int float_bit; +{ + gdbarch->float_bit = float_bit; +} + +int +gdbarch_double_bit (gdbarch) + struct gdbarch *gdbarch; +{ + if (gdbarch->double_bit == 0) + fatal ("gdbarch: gdbarch_double_bit invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_double_bit called\n"); + return gdbarch->double_bit; +} + +void +set_gdbarch_double_bit (gdbarch, double_bit) + struct gdbarch *gdbarch; + int double_bit; +{ + gdbarch->double_bit = double_bit; +} + +int +gdbarch_long_double_bit (gdbarch) + struct gdbarch *gdbarch; +{ + if (gdbarch->long_double_bit == 0) + fatal ("gdbarch: gdbarch_long_double_bit invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_long_double_bit called\n"); + return gdbarch->long_double_bit; +} + +void +set_gdbarch_long_double_bit (gdbarch, long_double_bit) + struct gdbarch *gdbarch; + int long_double_bit; +{ + gdbarch->long_double_bit = long_double_bit; +} + +CORE_ADDR +gdbarch_read_pc (struct gdbarch *gdbarch, int pid) +{ + if (gdbarch->read_pc == 0) + fatal ("gdbarch: gdbarch_read_pc invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_read_pc called\n"); + return gdbarch->read_pc (pid); +} + +void +set_gdbarch_read_pc (gdbarch, read_pc) + struct gdbarch *gdbarch; + gdbarch_read_pc_ftype read_pc; +{ + gdbarch->read_pc = read_pc; +} + +void +gdbarch_write_pc (struct gdbarch *gdbarch, CORE_ADDR val, int pid) +{ + if (gdbarch->write_pc == 0) + fatal ("gdbarch: gdbarch_write_pc invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_write_pc called\n"); + gdbarch->write_pc (val, pid); +} + +void +set_gdbarch_write_pc (gdbarch, write_pc) + struct gdbarch *gdbarch; + gdbarch_write_pc_ftype write_pc; +{ + gdbarch->write_pc = write_pc; +} + +CORE_ADDR +gdbarch_read_fp (struct gdbarch *gdbarch) +{ + if (gdbarch->read_fp == 0) + fatal ("gdbarch: gdbarch_read_fp invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_read_fp called\n"); + return gdbarch->read_fp (); +} + +void +set_gdbarch_read_fp (gdbarch, read_fp) + struct gdbarch *gdbarch; + gdbarch_read_fp_ftype read_fp; +{ + gdbarch->read_fp = read_fp; +} + +void +gdbarch_write_fp (struct gdbarch *gdbarch, CORE_ADDR val) +{ + if (gdbarch->write_fp == 0) + fatal ("gdbarch: gdbarch_write_fp invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_write_fp called\n"); + gdbarch->write_fp (val); +} + +void +set_gdbarch_write_fp (gdbarch, write_fp) + struct gdbarch *gdbarch; + gdbarch_write_fp_ftype write_fp; +{ + gdbarch->write_fp = write_fp; +} + +CORE_ADDR +gdbarch_read_sp (struct gdbarch *gdbarch) +{ + if (gdbarch->read_sp == 0) + fatal ("gdbarch: gdbarch_read_sp invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_read_sp called\n"); + return gdbarch->read_sp (); +} + +void +set_gdbarch_read_sp (gdbarch, read_sp) + struct gdbarch *gdbarch; + gdbarch_read_sp_ftype read_sp; +{ + gdbarch->read_sp = read_sp; +} + +void +gdbarch_write_sp (struct gdbarch *gdbarch, CORE_ADDR val) +{ + if (gdbarch->write_sp == 0) + fatal ("gdbarch: gdbarch_write_sp invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_write_sp called\n"); + gdbarch->write_sp (val); +} + +void +set_gdbarch_write_sp (gdbarch, write_sp) + struct gdbarch *gdbarch; + gdbarch_write_sp_ftype write_sp; +{ + gdbarch->write_sp = write_sp; +} + +int +gdbarch_num_regs (gdbarch) + struct gdbarch *gdbarch; +{ + if (gdbarch->num_regs == -1) + fatal ("gdbarch: gdbarch_num_regs invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_num_regs called\n"); + return gdbarch->num_regs; +} + +void +set_gdbarch_num_regs (gdbarch, num_regs) + struct gdbarch *gdbarch; + int num_regs; +{ + gdbarch->num_regs = num_regs; +} + +int +gdbarch_sp_regnum (gdbarch) + struct gdbarch *gdbarch; +{ + if (gdbarch->sp_regnum == -1) + fatal ("gdbarch: gdbarch_sp_regnum invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_sp_regnum called\n"); + return gdbarch->sp_regnum; +} + +void +set_gdbarch_sp_regnum (gdbarch, sp_regnum) + struct gdbarch *gdbarch; + int sp_regnum; +{ + gdbarch->sp_regnum = sp_regnum; +} + +int +gdbarch_fp_regnum (gdbarch) + struct gdbarch *gdbarch; +{ + if (gdbarch->fp_regnum == -1) + fatal ("gdbarch: gdbarch_fp_regnum invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_fp_regnum called\n"); + return gdbarch->fp_regnum; +} + +void +set_gdbarch_fp_regnum (gdbarch, fp_regnum) + struct gdbarch *gdbarch; + int fp_regnum; +{ + gdbarch->fp_regnum = fp_regnum; +} + +int +gdbarch_pc_regnum (gdbarch) + struct gdbarch *gdbarch; +{ + if (gdbarch->pc_regnum == -1) + fatal ("gdbarch: gdbarch_pc_regnum invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_pc_regnum called\n"); + return gdbarch->pc_regnum; +} + +void +set_gdbarch_pc_regnum (gdbarch, pc_regnum) + struct gdbarch *gdbarch; + int pc_regnum; +{ + gdbarch->pc_regnum = pc_regnum; +} + +char * +gdbarch_register_name (struct gdbarch *gdbarch, int regnr) +{ + if (gdbarch->register_name == 0) + fatal ("gdbarch: gdbarch_register_name invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_register_name called\n"); + return gdbarch->register_name (regnr); +} + +void +set_gdbarch_register_name (gdbarch, register_name) + struct gdbarch *gdbarch; + gdbarch_register_name_ftype register_name; +{ + gdbarch->register_name = register_name; +} + +int +gdbarch_register_size (gdbarch) + struct gdbarch *gdbarch; +{ + if (gdbarch->register_size == -1) + fatal ("gdbarch: gdbarch_register_size invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_register_size called\n"); + return gdbarch->register_size; +} + +void +set_gdbarch_register_size (gdbarch, register_size) + struct gdbarch *gdbarch; + int register_size; +{ + gdbarch->register_size = register_size; +} + +int +gdbarch_register_bytes (gdbarch) + struct gdbarch *gdbarch; +{ + if (gdbarch->register_bytes == -1) + fatal ("gdbarch: gdbarch_register_bytes invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_register_bytes called\n"); + return gdbarch->register_bytes; +} + +void +set_gdbarch_register_bytes (gdbarch, register_bytes) + struct gdbarch *gdbarch; + int register_bytes; +{ + gdbarch->register_bytes = register_bytes; +} + +int +gdbarch_register_byte (struct gdbarch *gdbarch, int reg_nr) +{ + if (gdbarch->register_byte == 0) + fatal ("gdbarch: gdbarch_register_byte invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_register_byte called\n"); + return gdbarch->register_byte (reg_nr); +} + +void +set_gdbarch_register_byte (gdbarch, register_byte) + struct gdbarch *gdbarch; + gdbarch_register_byte_ftype register_byte; +{ + gdbarch->register_byte = register_byte; +} + +int +gdbarch_register_raw_size (struct gdbarch *gdbarch, int reg_nr) +{ + if (gdbarch->register_raw_size == 0) + fatal ("gdbarch: gdbarch_register_raw_size invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_register_raw_size called\n"); + return gdbarch->register_raw_size (reg_nr); +} + +void +set_gdbarch_register_raw_size (gdbarch, register_raw_size) + struct gdbarch *gdbarch; + gdbarch_register_raw_size_ftype register_raw_size; +{ + gdbarch->register_raw_size = register_raw_size; +} + +int +gdbarch_max_register_raw_size (gdbarch) + struct gdbarch *gdbarch; +{ + if (gdbarch->max_register_raw_size == -1) + fatal ("gdbarch: gdbarch_max_register_raw_size invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_max_register_raw_size called\n"); + return gdbarch->max_register_raw_size; +} + +void +set_gdbarch_max_register_raw_size (gdbarch, max_register_raw_size) + struct gdbarch *gdbarch; + int max_register_raw_size; +{ + gdbarch->max_register_raw_size = max_register_raw_size; +} + +int +gdbarch_register_virtual_size (struct gdbarch *gdbarch, int reg_nr) +{ + if (gdbarch->register_virtual_size == 0) + fatal ("gdbarch: gdbarch_register_virtual_size invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_register_virtual_size called\n"); + return gdbarch->register_virtual_size (reg_nr); +} + +void +set_gdbarch_register_virtual_size (gdbarch, register_virtual_size) + struct gdbarch *gdbarch; + gdbarch_register_virtual_size_ftype register_virtual_size; +{ + gdbarch->register_virtual_size = register_virtual_size; +} + +int +gdbarch_max_register_virtual_size (gdbarch) + struct gdbarch *gdbarch; +{ + if (gdbarch->max_register_virtual_size == -1) + fatal ("gdbarch: gdbarch_max_register_virtual_size invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_max_register_virtual_size called\n"); + return gdbarch->max_register_virtual_size; +} + +void +set_gdbarch_max_register_virtual_size (gdbarch, max_register_virtual_size) + struct gdbarch *gdbarch; + int max_register_virtual_size; +{ + gdbarch->max_register_virtual_size = max_register_virtual_size; +} + +struct type * +gdbarch_register_virtual_type (struct gdbarch *gdbarch, int reg_nr) +{ + if (gdbarch->register_virtual_type == 0) + fatal ("gdbarch: gdbarch_register_virtual_type invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_register_virtual_type called\n"); + return gdbarch->register_virtual_type (reg_nr); +} + +void +set_gdbarch_register_virtual_type (gdbarch, register_virtual_type) + struct gdbarch *gdbarch; + gdbarch_register_virtual_type_ftype register_virtual_type; +{ + gdbarch->register_virtual_type = register_virtual_type; +} + +int +gdbarch_use_generic_dummy_frames (gdbarch) + struct gdbarch *gdbarch; +{ + if (gdbarch->use_generic_dummy_frames == -1) + fatal ("gdbarch: gdbarch_use_generic_dummy_frames invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_use_generic_dummy_frames called\n"); + return gdbarch->use_generic_dummy_frames; +} + +void +set_gdbarch_use_generic_dummy_frames (gdbarch, use_generic_dummy_frames) + struct gdbarch *gdbarch; + int use_generic_dummy_frames; +{ + gdbarch->use_generic_dummy_frames = use_generic_dummy_frames; +} + +int +gdbarch_call_dummy_location (gdbarch) + struct gdbarch *gdbarch; +{ + if (gdbarch->call_dummy_location == 0) + fatal ("gdbarch: gdbarch_call_dummy_location invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_location called\n"); + return gdbarch->call_dummy_location; +} + +void +set_gdbarch_call_dummy_location (gdbarch, call_dummy_location) + struct gdbarch *gdbarch; + int call_dummy_location; +{ + gdbarch->call_dummy_location = call_dummy_location; +} + +CORE_ADDR +gdbarch_call_dummy_address (struct gdbarch *gdbarch) +{ + if (gdbarch->call_dummy_address == 0) + fatal ("gdbarch: gdbarch_call_dummy_address invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_address called\n"); + return gdbarch->call_dummy_address (); +} + +void +set_gdbarch_call_dummy_address (gdbarch, call_dummy_address) + struct gdbarch *gdbarch; + gdbarch_call_dummy_address_ftype call_dummy_address; +{ + gdbarch->call_dummy_address = call_dummy_address; +} + +CORE_ADDR +gdbarch_call_dummy_start_offset (gdbarch) + struct gdbarch *gdbarch; +{ + if (gdbarch->call_dummy_start_offset == -1) + fatal ("gdbarch: gdbarch_call_dummy_start_offset invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_start_offset called\n"); + return gdbarch->call_dummy_start_offset; +} + +void +set_gdbarch_call_dummy_start_offset (gdbarch, call_dummy_start_offset) + struct gdbarch *gdbarch; + CORE_ADDR call_dummy_start_offset; +{ + gdbarch->call_dummy_start_offset = call_dummy_start_offset; +} + +CORE_ADDR +gdbarch_call_dummy_breakpoint_offset (gdbarch) + struct gdbarch *gdbarch; +{ + if (gdbarch->call_dummy_breakpoint_offset == -1) + fatal ("gdbarch: gdbarch_call_dummy_breakpoint_offset invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_breakpoint_offset called\n"); + return gdbarch->call_dummy_breakpoint_offset; +} + +void +set_gdbarch_call_dummy_breakpoint_offset (gdbarch, call_dummy_breakpoint_offset) + struct gdbarch *gdbarch; + CORE_ADDR call_dummy_breakpoint_offset; +{ + gdbarch->call_dummy_breakpoint_offset = call_dummy_breakpoint_offset; +} + +int +gdbarch_call_dummy_breakpoint_offset_p (gdbarch) + struct gdbarch *gdbarch; +{ + if (gdbarch->call_dummy_breakpoint_offset_p == -1) + fatal ("gdbarch: gdbarch_call_dummy_breakpoint_offset_p invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_breakpoint_offset_p called\n"); + return gdbarch->call_dummy_breakpoint_offset_p; +} + +void +set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, call_dummy_breakpoint_offset_p) + struct gdbarch *gdbarch; + int call_dummy_breakpoint_offset_p; +{ + gdbarch->call_dummy_breakpoint_offset_p = call_dummy_breakpoint_offset_p; +} + +int +gdbarch_call_dummy_length (gdbarch) + struct gdbarch *gdbarch; +{ + if (gdbarch->call_dummy_length == -1) + fatal ("gdbarch: gdbarch_call_dummy_length invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_length called\n"); + return gdbarch->call_dummy_length; +} + +void +set_gdbarch_call_dummy_length (gdbarch, call_dummy_length) + struct gdbarch *gdbarch; + int call_dummy_length; +{ + gdbarch->call_dummy_length = call_dummy_length; +} + +int +gdbarch_pc_in_call_dummy (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address) +{ + if (gdbarch->pc_in_call_dummy == 0) + fatal ("gdbarch: gdbarch_pc_in_call_dummy invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_pc_in_call_dummy called\n"); + return gdbarch->pc_in_call_dummy (pc, sp, frame_address); +} + +void +set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy) + struct gdbarch *gdbarch; + gdbarch_pc_in_call_dummy_ftype pc_in_call_dummy; +{ + gdbarch->pc_in_call_dummy = pc_in_call_dummy; +} + +int +gdbarch_call_dummy_p (gdbarch) + struct gdbarch *gdbarch; +{ + if (gdbarch->call_dummy_p == -1) + fatal ("gdbarch: gdbarch_call_dummy_p invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_p called\n"); + return gdbarch->call_dummy_p; +} + +void +set_gdbarch_call_dummy_p (gdbarch, call_dummy_p) + struct gdbarch *gdbarch; + int call_dummy_p; +{ + gdbarch->call_dummy_p = call_dummy_p; +} + +LONGEST * +gdbarch_call_dummy_words (gdbarch) + struct gdbarch *gdbarch; +{ + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_words called\n"); + return gdbarch->call_dummy_words; +} + +void +set_gdbarch_call_dummy_words (gdbarch, call_dummy_words) + struct gdbarch *gdbarch; + LONGEST * call_dummy_words; +{ + gdbarch->call_dummy_words = call_dummy_words; +} + +int +gdbarch_sizeof_call_dummy_words (gdbarch) + struct gdbarch *gdbarch; +{ + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_sizeof_call_dummy_words called\n"); + return gdbarch->sizeof_call_dummy_words; +} + +void +set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof_call_dummy_words) + struct gdbarch *gdbarch; + int sizeof_call_dummy_words; +{ + gdbarch->sizeof_call_dummy_words = sizeof_call_dummy_words; +} + +int +gdbarch_call_dummy_stack_adjust_p (gdbarch) + struct gdbarch *gdbarch; +{ + if (gdbarch->call_dummy_stack_adjust_p == -1) + fatal ("gdbarch: gdbarch_call_dummy_stack_adjust_p invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_stack_adjust_p called\n"); + return gdbarch->call_dummy_stack_adjust_p; +} + +void +set_gdbarch_call_dummy_stack_adjust_p (gdbarch, call_dummy_stack_adjust_p) + struct gdbarch *gdbarch; + int call_dummy_stack_adjust_p; +{ + gdbarch->call_dummy_stack_adjust_p = call_dummy_stack_adjust_p; +} + +int +gdbarch_call_dummy_stack_adjust (gdbarch) + struct gdbarch *gdbarch; +{ + if (gdbarch->call_dummy_stack_adjust_p && gdbarch->call_dummy_stack_adjust == 0) + fatal ("gdbarch: gdbarch_call_dummy_stack_adjust invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_stack_adjust called\n"); + return gdbarch->call_dummy_stack_adjust; +} + +void +set_gdbarch_call_dummy_stack_adjust (gdbarch, call_dummy_stack_adjust) + struct gdbarch *gdbarch; + int call_dummy_stack_adjust; +{ + gdbarch->call_dummy_stack_adjust = call_dummy_stack_adjust; +} + +void +gdbarch_fix_call_dummy (struct gdbarch *gdbarch, char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p) +{ + if (gdbarch->fix_call_dummy == 0) + fatal ("gdbarch: gdbarch_fix_call_dummy invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_fix_call_dummy called\n"); + gdbarch->fix_call_dummy (dummy, pc, fun, nargs, args, type, gcc_p); +} + +void +set_gdbarch_fix_call_dummy (gdbarch, fix_call_dummy) + struct gdbarch *gdbarch; + gdbarch_fix_call_dummy_ftype fix_call_dummy; +{ + gdbarch->fix_call_dummy = fix_call_dummy; +} + +int +gdbarch_believe_pcc_promotion (gdbarch) + struct gdbarch *gdbarch; +{ + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_believe_pcc_promotion called\n"); + return gdbarch->believe_pcc_promotion; +} + +void +set_gdbarch_believe_pcc_promotion (gdbarch, believe_pcc_promotion) + struct gdbarch *gdbarch; + int believe_pcc_promotion; +{ + gdbarch->believe_pcc_promotion = believe_pcc_promotion; +} + +int +gdbarch_believe_pcc_promotion_type (gdbarch) + struct gdbarch *gdbarch; +{ + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_believe_pcc_promotion_type called\n"); + return gdbarch->believe_pcc_promotion_type; +} + +void +set_gdbarch_believe_pcc_promotion_type (gdbarch, believe_pcc_promotion_type) + struct gdbarch *gdbarch; + int believe_pcc_promotion_type; +{ + gdbarch->believe_pcc_promotion_type = believe_pcc_promotion_type; +} + +void +gdbarch_get_saved_register (struct gdbarch *gdbarch, char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval) +{ + if (gdbarch->get_saved_register == 0) + fatal ("gdbarch: gdbarch_get_saved_register invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_get_saved_register called\n"); + gdbarch->get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval); +} + +void +set_gdbarch_get_saved_register (gdbarch, get_saved_register) + struct gdbarch *gdbarch; + gdbarch_get_saved_register_ftype get_saved_register; +{ + gdbarch->get_saved_register = get_saved_register; +} + +int +gdbarch_register_convertible (struct gdbarch *gdbarch, int nr) +{ + if (gdbarch->register_convertible == 0) + fatal ("gdbarch: gdbarch_register_convertible invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_register_convertible called\n"); + return gdbarch->register_convertible (nr); +} + +void +set_gdbarch_register_convertible (gdbarch, register_convertible) + struct gdbarch *gdbarch; + gdbarch_register_convertible_ftype register_convertible; +{ + gdbarch->register_convertible = register_convertible; +} + +void +gdbarch_register_convert_to_virtual (struct gdbarch *gdbarch, int regnum, struct type *type, char *from, char *to) +{ + if (gdbarch->register_convert_to_virtual == 0) + fatal ("gdbarch: gdbarch_register_convert_to_virtual invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_register_convert_to_virtual called\n"); + gdbarch->register_convert_to_virtual (regnum, type, from, to); +} + +void +set_gdbarch_register_convert_to_virtual (gdbarch, register_convert_to_virtual) + struct gdbarch *gdbarch; + gdbarch_register_convert_to_virtual_ftype register_convert_to_virtual; +{ + gdbarch->register_convert_to_virtual = register_convert_to_virtual; +} + +void +gdbarch_register_convert_to_raw (struct gdbarch *gdbarch, struct type *type, int regnum, char *from, char *to) +{ + if (gdbarch->register_convert_to_raw == 0) + fatal ("gdbarch: gdbarch_register_convert_to_raw invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_register_convert_to_raw called\n"); + gdbarch->register_convert_to_raw (type, regnum, from, to); +} + +void +set_gdbarch_register_convert_to_raw (gdbarch, register_convert_to_raw) + struct gdbarch *gdbarch; + gdbarch_register_convert_to_raw_ftype register_convert_to_raw; +{ + gdbarch->register_convert_to_raw = register_convert_to_raw; +} + +void +gdbarch_extract_return_value (struct gdbarch *gdbarch, struct type *type, char *regbuf, char *valbuf) +{ + if (gdbarch->extract_return_value == 0) + fatal ("gdbarch: gdbarch_extract_return_value invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_extract_return_value called\n"); + gdbarch->extract_return_value (type, regbuf, valbuf); +} + +void +set_gdbarch_extract_return_value (gdbarch, extract_return_value) + struct gdbarch *gdbarch; + gdbarch_extract_return_value_ftype extract_return_value; +{ + gdbarch->extract_return_value = extract_return_value; +} + +CORE_ADDR +gdbarch_push_arguments (struct gdbarch *gdbarch, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr) +{ + if (gdbarch->push_arguments == 0) + fatal ("gdbarch: gdbarch_push_arguments invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_push_arguments called\n"); + return gdbarch->push_arguments (nargs, args, sp, struct_return, struct_addr); +} + +void +set_gdbarch_push_arguments (gdbarch, push_arguments) + struct gdbarch *gdbarch; + gdbarch_push_arguments_ftype push_arguments; +{ + gdbarch->push_arguments = push_arguments; +} + +void +gdbarch_push_dummy_frame (struct gdbarch *gdbarch) +{ + if (gdbarch->push_dummy_frame == 0) + fatal ("gdbarch: gdbarch_push_dummy_frame invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_push_dummy_frame called\n"); + gdbarch->push_dummy_frame (); +} + +void +set_gdbarch_push_dummy_frame (gdbarch, push_dummy_frame) + struct gdbarch *gdbarch; + gdbarch_push_dummy_frame_ftype push_dummy_frame; +{ + gdbarch->push_dummy_frame = push_dummy_frame; +} + +CORE_ADDR +gdbarch_push_return_address (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR sp) +{ + if (gdbarch->push_return_address == 0) + fatal ("gdbarch: gdbarch_push_return_address invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_push_return_address called\n"); + return gdbarch->push_return_address (pc, sp); +} + +void +set_gdbarch_push_return_address (gdbarch, push_return_address) + struct gdbarch *gdbarch; + gdbarch_push_return_address_ftype push_return_address; +{ + gdbarch->push_return_address = push_return_address; +} + +void +gdbarch_pop_frame (struct gdbarch *gdbarch) +{ + if (gdbarch->pop_frame == 0) + fatal ("gdbarch: gdbarch_pop_frame invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_pop_frame called\n"); + gdbarch->pop_frame (); +} + +void +set_gdbarch_pop_frame (gdbarch, pop_frame) + struct gdbarch *gdbarch; + gdbarch_pop_frame_ftype pop_frame; +{ + gdbarch->pop_frame = pop_frame; +} + +CORE_ADDR +gdbarch_d10v_make_daddr (struct gdbarch *gdbarch, CORE_ADDR x) +{ + if (gdbarch->d10v_make_daddr == 0) + fatal ("gdbarch: gdbarch_d10v_make_daddr invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_d10v_make_daddr called\n"); + return gdbarch->d10v_make_daddr (x); +} + +void +set_gdbarch_d10v_make_daddr (gdbarch, d10v_make_daddr) + struct gdbarch *gdbarch; + gdbarch_d10v_make_daddr_ftype d10v_make_daddr; +{ + gdbarch->d10v_make_daddr = d10v_make_daddr; +} + +CORE_ADDR +gdbarch_d10v_make_iaddr (struct gdbarch *gdbarch, CORE_ADDR x) +{ + if (gdbarch->d10v_make_iaddr == 0) + fatal ("gdbarch: gdbarch_d10v_make_iaddr invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_d10v_make_iaddr called\n"); + return gdbarch->d10v_make_iaddr (x); +} + +void +set_gdbarch_d10v_make_iaddr (gdbarch, d10v_make_iaddr) + struct gdbarch *gdbarch; + gdbarch_d10v_make_iaddr_ftype d10v_make_iaddr; +{ + gdbarch->d10v_make_iaddr = d10v_make_iaddr; +} + +int +gdbarch_d10v_daddr_p (struct gdbarch *gdbarch, CORE_ADDR x) +{ + if (gdbarch->d10v_daddr_p == 0) + fatal ("gdbarch: gdbarch_d10v_daddr_p invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_d10v_daddr_p called\n"); + return gdbarch->d10v_daddr_p (x); +} + +void +set_gdbarch_d10v_daddr_p (gdbarch, d10v_daddr_p) + struct gdbarch *gdbarch; + gdbarch_d10v_daddr_p_ftype d10v_daddr_p; +{ + gdbarch->d10v_daddr_p = d10v_daddr_p; +} + +int +gdbarch_d10v_iaddr_p (struct gdbarch *gdbarch, CORE_ADDR x) +{ + if (gdbarch->d10v_iaddr_p == 0) + fatal ("gdbarch: gdbarch_d10v_iaddr_p invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_d10v_iaddr_p called\n"); + return gdbarch->d10v_iaddr_p (x); +} + +void +set_gdbarch_d10v_iaddr_p (gdbarch, d10v_iaddr_p) + struct gdbarch *gdbarch; + gdbarch_d10v_iaddr_p_ftype d10v_iaddr_p; +{ + gdbarch->d10v_iaddr_p = d10v_iaddr_p; +} + +CORE_ADDR +gdbarch_d10v_convert_daddr_to_raw (struct gdbarch *gdbarch, CORE_ADDR x) +{ + if (gdbarch->d10v_convert_daddr_to_raw == 0) + fatal ("gdbarch: gdbarch_d10v_convert_daddr_to_raw invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_d10v_convert_daddr_to_raw called\n"); + return gdbarch->d10v_convert_daddr_to_raw (x); +} + +void +set_gdbarch_d10v_convert_daddr_to_raw (gdbarch, d10v_convert_daddr_to_raw) + struct gdbarch *gdbarch; + gdbarch_d10v_convert_daddr_to_raw_ftype d10v_convert_daddr_to_raw; +{ + gdbarch->d10v_convert_daddr_to_raw = d10v_convert_daddr_to_raw; +} + +CORE_ADDR +gdbarch_d10v_convert_iaddr_to_raw (struct gdbarch *gdbarch, CORE_ADDR x) +{ + if (gdbarch->d10v_convert_iaddr_to_raw == 0) + fatal ("gdbarch: gdbarch_d10v_convert_iaddr_to_raw invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_d10v_convert_iaddr_to_raw called\n"); + return gdbarch->d10v_convert_iaddr_to_raw (x); +} + +void +set_gdbarch_d10v_convert_iaddr_to_raw (gdbarch, d10v_convert_iaddr_to_raw) + struct gdbarch *gdbarch; + gdbarch_d10v_convert_iaddr_to_raw_ftype d10v_convert_iaddr_to_raw; +{ + gdbarch->d10v_convert_iaddr_to_raw = d10v_convert_iaddr_to_raw; +} + +void +gdbarch_store_struct_return (struct gdbarch *gdbarch, CORE_ADDR addr, CORE_ADDR sp) +{ + if (gdbarch->store_struct_return == 0) + fatal ("gdbarch: gdbarch_store_struct_return invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_store_struct_return called\n"); + gdbarch->store_struct_return (addr, sp); +} + +void +set_gdbarch_store_struct_return (gdbarch, store_struct_return) + struct gdbarch *gdbarch; + gdbarch_store_struct_return_ftype store_struct_return; +{ + gdbarch->store_struct_return = store_struct_return; +} + +void +gdbarch_store_return_value (struct gdbarch *gdbarch, struct type *type, char *valbuf) +{ + if (gdbarch->store_return_value == 0) + fatal ("gdbarch: gdbarch_store_return_value invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_store_return_value called\n"); + gdbarch->store_return_value (type, valbuf); +} + +void +set_gdbarch_store_return_value (gdbarch, store_return_value) + struct gdbarch *gdbarch; + gdbarch_store_return_value_ftype store_return_value; +{ + gdbarch->store_return_value = store_return_value; +} + +CORE_ADDR +gdbarch_extract_struct_value_address (struct gdbarch *gdbarch, char *regbuf) +{ + if (gdbarch->extract_struct_value_address == 0) + fatal ("gdbarch: gdbarch_extract_struct_value_address invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_extract_struct_value_address called\n"); + return gdbarch->extract_struct_value_address (regbuf); +} + +void +set_gdbarch_extract_struct_value_address (gdbarch, extract_struct_value_address) + struct gdbarch *gdbarch; + gdbarch_extract_struct_value_address_ftype extract_struct_value_address; +{ + gdbarch->extract_struct_value_address = extract_struct_value_address; +} + +int +gdbarch_use_struct_convention (struct gdbarch *gdbarch, int gcc_p, struct type *value_type) +{ + if (gdbarch->use_struct_convention == 0) + fatal ("gdbarch: gdbarch_use_struct_convention invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_use_struct_convention called\n"); + return gdbarch->use_struct_convention (gcc_p, value_type); +} + +void +set_gdbarch_use_struct_convention (gdbarch, use_struct_convention) + struct gdbarch *gdbarch; + gdbarch_use_struct_convention_ftype use_struct_convention; +{ + gdbarch->use_struct_convention = use_struct_convention; +} + +void +gdbarch_frame_init_saved_regs (struct gdbarch *gdbarch, struct frame_info *frame) +{ + if (gdbarch->frame_init_saved_regs == 0) + fatal ("gdbarch: gdbarch_frame_init_saved_regs invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_init_saved_regs called\n"); + gdbarch->frame_init_saved_regs (frame); +} + +void +set_gdbarch_frame_init_saved_regs (gdbarch, frame_init_saved_regs) + struct gdbarch *gdbarch; + gdbarch_frame_init_saved_regs_ftype frame_init_saved_regs; +{ + gdbarch->frame_init_saved_regs = frame_init_saved_regs; +} + +void +gdbarch_init_extra_frame_info (struct gdbarch *gdbarch, int fromleaf, struct frame_info *frame) +{ + if (gdbarch->init_extra_frame_info == 0) + fatal ("gdbarch: gdbarch_init_extra_frame_info invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_init_extra_frame_info called\n"); + gdbarch->init_extra_frame_info (fromleaf, frame); +} + +void +set_gdbarch_init_extra_frame_info (gdbarch, init_extra_frame_info) + struct gdbarch *gdbarch; + gdbarch_init_extra_frame_info_ftype init_extra_frame_info; +{ + gdbarch->init_extra_frame_info = init_extra_frame_info; +} + +CORE_ADDR +gdbarch_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR ip) +{ + if (gdbarch->skip_prologue == 0) + fatal ("gdbarch: gdbarch_skip_prologue invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_skip_prologue called\n"); + return gdbarch->skip_prologue (ip); +} + +void +set_gdbarch_skip_prologue (gdbarch, skip_prologue) + struct gdbarch *gdbarch; + gdbarch_skip_prologue_ftype skip_prologue; +{ + gdbarch->skip_prologue = skip_prologue; +} + +int +gdbarch_inner_than (struct gdbarch *gdbarch, CORE_ADDR lhs, CORE_ADDR rhs) +{ + if (gdbarch->inner_than == 0) + fatal ("gdbarch: gdbarch_inner_than invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_inner_than called\n"); + return gdbarch->inner_than (lhs, rhs); +} + +void +set_gdbarch_inner_than (gdbarch, inner_than) + struct gdbarch *gdbarch; + gdbarch_inner_than_ftype inner_than; +{ + gdbarch->inner_than = inner_than; +} + +unsigned char * +gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr) +{ + if (gdbarch->breakpoint_from_pc == 0) + fatal ("gdbarch: gdbarch_breakpoint_from_pc invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_breakpoint_from_pc called\n"); + return gdbarch->breakpoint_from_pc (pcptr, lenptr); +} + +void +set_gdbarch_breakpoint_from_pc (gdbarch, breakpoint_from_pc) + struct gdbarch *gdbarch; + gdbarch_breakpoint_from_pc_ftype breakpoint_from_pc; +{ + gdbarch->breakpoint_from_pc = breakpoint_from_pc; +} + +CORE_ADDR +gdbarch_decr_pc_after_break (gdbarch) + struct gdbarch *gdbarch; +{ + if (gdbarch->decr_pc_after_break == -1) + fatal ("gdbarch: gdbarch_decr_pc_after_break invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_decr_pc_after_break called\n"); + return gdbarch->decr_pc_after_break; +} + +void +set_gdbarch_decr_pc_after_break (gdbarch, decr_pc_after_break) + struct gdbarch *gdbarch; + CORE_ADDR decr_pc_after_break; +{ + gdbarch->decr_pc_after_break = decr_pc_after_break; +} + +CORE_ADDR +gdbarch_function_start_offset (gdbarch) + struct gdbarch *gdbarch; +{ + if (gdbarch->function_start_offset == -1) + fatal ("gdbarch: gdbarch_function_start_offset invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_function_start_offset called\n"); + return gdbarch->function_start_offset; +} + +void +set_gdbarch_function_start_offset (gdbarch, function_start_offset) + struct gdbarch *gdbarch; + CORE_ADDR function_start_offset; +{ + gdbarch->function_start_offset = function_start_offset; +} + +void +gdbarch_remote_translate_xfer_address (struct gdbarch *gdbarch, CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len) +{ + if (gdbarch->remote_translate_xfer_address == 0) + fatal ("gdbarch: gdbarch_remote_translate_xfer_address invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_remote_translate_xfer_address called\n"); + gdbarch->remote_translate_xfer_address (gdb_addr, gdb_len, rem_addr, rem_len); +} + +void +set_gdbarch_remote_translate_xfer_address (gdbarch, remote_translate_xfer_address) + struct gdbarch *gdbarch; + gdbarch_remote_translate_xfer_address_ftype remote_translate_xfer_address; +{ + gdbarch->remote_translate_xfer_address = remote_translate_xfer_address; +} + +CORE_ADDR +gdbarch_frame_args_skip (gdbarch) + struct gdbarch *gdbarch; +{ + if (gdbarch->frame_args_skip == -1) + fatal ("gdbarch: gdbarch_frame_args_skip invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_args_skip called\n"); + return gdbarch->frame_args_skip; +} + +void +set_gdbarch_frame_args_skip (gdbarch, frame_args_skip) + struct gdbarch *gdbarch; + CORE_ADDR frame_args_skip; +{ + gdbarch->frame_args_skip = frame_args_skip; +} + +int +gdbarch_frameless_function_invocation (struct gdbarch *gdbarch, struct frame_info *fi) +{ + if (gdbarch->frameless_function_invocation == 0) + fatal ("gdbarch: gdbarch_frameless_function_invocation invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_frameless_function_invocation called\n"); + return gdbarch->frameless_function_invocation (fi); +} + +void +set_gdbarch_frameless_function_invocation (gdbarch, frameless_function_invocation) + struct gdbarch *gdbarch; + gdbarch_frameless_function_invocation_ftype frameless_function_invocation; +{ + gdbarch->frameless_function_invocation = frameless_function_invocation; +} + +CORE_ADDR +gdbarch_frame_chain (struct gdbarch *gdbarch, struct frame_info *frame) +{ + if (gdbarch->frame_chain == 0) + fatal ("gdbarch: gdbarch_frame_chain invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_chain called\n"); + return gdbarch->frame_chain (frame); +} + +void +set_gdbarch_frame_chain (gdbarch, frame_chain) + struct gdbarch *gdbarch; + gdbarch_frame_chain_ftype frame_chain; +{ + gdbarch->frame_chain = frame_chain; +} + +int +gdbarch_frame_chain_valid (struct gdbarch *gdbarch, CORE_ADDR chain, struct frame_info *thisframe) +{ + if (gdbarch->frame_chain_valid == 0) + fatal ("gdbarch: gdbarch_frame_chain_valid invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_chain_valid called\n"); + return gdbarch->frame_chain_valid (chain, thisframe); +} + +void +set_gdbarch_frame_chain_valid (gdbarch, frame_chain_valid) + struct gdbarch *gdbarch; + gdbarch_frame_chain_valid_ftype frame_chain_valid; +{ + gdbarch->frame_chain_valid = frame_chain_valid; +} + +CORE_ADDR +gdbarch_frame_saved_pc (struct gdbarch *gdbarch, struct frame_info *fi) +{ + if (gdbarch->frame_saved_pc == 0) + fatal ("gdbarch: gdbarch_frame_saved_pc invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_saved_pc called\n"); + return gdbarch->frame_saved_pc (fi); +} + +void +set_gdbarch_frame_saved_pc (gdbarch, frame_saved_pc) + struct gdbarch *gdbarch; + gdbarch_frame_saved_pc_ftype frame_saved_pc; +{ + gdbarch->frame_saved_pc = frame_saved_pc; +} + +CORE_ADDR +gdbarch_frame_args_address (struct gdbarch *gdbarch, struct frame_info *fi) +{ + if (gdbarch->frame_args_address == 0) + fatal ("gdbarch: gdbarch_frame_args_address invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_args_address called\n"); + return gdbarch->frame_args_address (fi); +} + +void +set_gdbarch_frame_args_address (gdbarch, frame_args_address) + struct gdbarch *gdbarch; + gdbarch_frame_args_address_ftype frame_args_address; +{ + gdbarch->frame_args_address = frame_args_address; +} + +CORE_ADDR +gdbarch_frame_locals_address (struct gdbarch *gdbarch, struct frame_info *fi) +{ + if (gdbarch->frame_locals_address == 0) + fatal ("gdbarch: gdbarch_frame_locals_address invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_locals_address called\n"); + return gdbarch->frame_locals_address (fi); +} + +void +set_gdbarch_frame_locals_address (gdbarch, frame_locals_address) + struct gdbarch *gdbarch; + gdbarch_frame_locals_address_ftype frame_locals_address; +{ + gdbarch->frame_locals_address = frame_locals_address; +} + +CORE_ADDR +gdbarch_saved_pc_after_call (struct gdbarch *gdbarch, struct frame_info *frame) +{ + if (gdbarch->saved_pc_after_call == 0) + fatal ("gdbarch: gdbarch_saved_pc_after_call invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_saved_pc_after_call called\n"); + return gdbarch->saved_pc_after_call (frame); +} + +void +set_gdbarch_saved_pc_after_call (gdbarch, saved_pc_after_call) + struct gdbarch *gdbarch; + gdbarch_saved_pc_after_call_ftype saved_pc_after_call; +{ + gdbarch->saved_pc_after_call = saved_pc_after_call; +} + +int +gdbarch_frame_num_args (struct gdbarch *gdbarch, struct frame_info *frame) +{ + if (gdbarch->frame_num_args == 0) + fatal ("gdbarch: gdbarch_frame_num_args invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_num_args called\n"); + return gdbarch->frame_num_args (frame); +} + +void +set_gdbarch_frame_num_args (gdbarch, frame_num_args) + struct gdbarch *gdbarch; + gdbarch_frame_num_args_ftype frame_num_args; +{ + gdbarch->frame_num_args = frame_num_args; +} + + +/* Keep a registrary of per-architecture data-pointers required by GDB + modules. */ + +struct gdbarch_data +{ + int index; +}; + +struct gdbarch_data_registration +{ + gdbarch_data_ftype *init; + struct gdbarch_data *data; + struct gdbarch_data_registration *next; +}; + +struct gdbarch_data_registrary +{ + int nr; + struct gdbarch_data_registration *registrations; +}; + +struct gdbarch_data_registrary gdbarch_data_registrary = +{ + 0, NULL, +}; + +struct gdbarch_data * +register_gdbarch_data (init) + gdbarch_data_ftype *init; +{ + struct gdbarch_data_registration **curr; + for (curr = &gdbarch_data_registrary.registrations; + (*curr) != NULL; + curr = &(*curr)->next); + (*curr) = XMALLOC (struct gdbarch_data_registration); + (*curr)->next = NULL; + (*curr)->init = init; + (*curr)->data = XMALLOC (struct gdbarch_data); + (*curr)->data->index = gdbarch_data_registrary.nr++; + return (*curr)->data; +} + + +/* Walk through all the registered users initializing each in turn. */ + +static void init_gdbarch_data PARAMS ((struct gdbarch *)); +static void +init_gdbarch_data (gdbarch) + struct gdbarch *gdbarch; +{ + struct gdbarch_data_registration *rego; + gdbarch->nr_data = gdbarch_data_registrary.nr + 1; + gdbarch->data = xmalloc (sizeof (void*) * gdbarch->nr_data); + for (rego = gdbarch_data_registrary.registrations; + rego != NULL; + rego = rego->next) + { + if (rego->data->index < gdbarch->nr_data) + gdbarch->data[rego->data->index] = rego->init (); + } +} + + +/* Return the current value of the specified per-architecture + data-pointer. */ + +void * +gdbarch_data (data) + struct gdbarch_data *data; +{ + if (data->index >= current_gdbarch->nr_data) + fatal ("gdbarch_data: request for non-existant data."); + return current_gdbarch->data[data->index]; +} + + + +/* Keep a registrary of swaped data required by GDB modules. */ + +struct gdbarch_swap +{ + void *swap; + struct gdbarch_swap_registration *source; + struct gdbarch_swap *next; +}; + +struct gdbarch_swap_registration +{ + void *data; + unsigned long sizeof_data; + gdbarch_swap_ftype *init; + struct gdbarch_swap_registration *next; +}; + +struct gdbarch_swap_registrary +{ + int nr; + struct gdbarch_swap_registration *registrations; +}; + +struct gdbarch_swap_registrary gdbarch_swap_registrary = +{ + 0, NULL, +}; + +void +register_gdbarch_swap (data, sizeof_data, init) + void *data; + unsigned long sizeof_data; + gdbarch_swap_ftype *init; +{ + struct gdbarch_swap_registration **rego; + for (rego = &gdbarch_swap_registrary.registrations; + (*rego) != NULL; + rego = &(*rego)->next); + (*rego) = XMALLOC (struct gdbarch_swap_registration); + (*rego)->next = NULL; + (*rego)->init = init; + (*rego)->data = data; + (*rego)->sizeof_data = sizeof_data; +} + + +static void init_gdbarch_swap PARAMS ((struct gdbarch *)); +static void +init_gdbarch_swap (gdbarch) + struct gdbarch *gdbarch; +{ + struct gdbarch_swap_registration *rego; + struct gdbarch_swap **curr = &gdbarch->swap; + for (rego = gdbarch_swap_registrary.registrations; + rego != NULL; + rego = rego->next) + { + if (rego->data != NULL) + { + (*curr) = XMALLOC (struct gdbarch_swap); + (*curr)->source = rego; + (*curr)->swap = xmalloc (rego->sizeof_data); + (*curr)->next = NULL; + memset (rego->data, 0, rego->sizeof_data); + curr = &(*curr)->next; + } + if (rego->init != NULL) + rego->init (); + } +} + +static void swapout_gdbarch_swap PARAMS ((struct gdbarch *)); +static void +swapout_gdbarch_swap (gdbarch) + struct gdbarch *gdbarch; +{ + struct gdbarch_swap *curr; + for (curr = gdbarch->swap; + curr != NULL; + curr = curr->next) + memcpy (curr->swap, curr->source->data, curr->source->sizeof_data); +} + +static void swapin_gdbarch_swap PARAMS ((struct gdbarch *)); +static void +swapin_gdbarch_swap (gdbarch) + struct gdbarch *gdbarch; +{ + struct gdbarch_swap *curr; + for (curr = gdbarch->swap; + curr != NULL; + curr = curr->next) + memcpy (curr->source->data, curr->swap, curr->source->sizeof_data); +} + + +/* Keep a registrary of the architectures known by GDB. */ + +struct gdbarch_init_registration +{ + enum bfd_architecture bfd_architecture; + gdbarch_init_ftype *init; + struct gdbarch_list *arches; + struct gdbarch_init_registration *next; +}; + +static struct gdbarch_init_registration *gdbarch_init_registrary = NULL; + +void +register_gdbarch_init (bfd_architecture, init) + enum bfd_architecture bfd_architecture; + gdbarch_init_ftype *init; +{ + struct gdbarch_init_registration **curr; + const struct bfd_arch_info *bfd_arch_info; + /* Check that BFD reconizes this architecture */ + bfd_arch_info = bfd_lookup_arch (bfd_architecture, 0); + if (bfd_arch_info == NULL) + { + fatal ("gdbarch: Attempt to register unknown architecture (%d)", bfd_architecture); + } + /* Check that we haven't seen this architecture before */ + for (curr = &gdbarch_init_registrary; + (*curr) != NULL; + curr = &(*curr)->next) + { + if (bfd_architecture == (*curr)->bfd_architecture) + fatal ("gdbarch: Duplicate registraration of architecture (%s)", + bfd_arch_info->printable_name); + } + /* log it */ + if (gdbarch_debug) + fprintf_unfiltered (gdb_stdlog, "register_gdbarch_init (%s, 0x%08lx)\n", + bfd_arch_info->printable_name, + (long) init); + /* Append it */ + (*curr) = XMALLOC (struct gdbarch_init_registration); + (*curr)->bfd_architecture = bfd_architecture; + (*curr)->init = init; + (*curr)->arches = NULL; + (*curr)->next = NULL; +} + + + +/* Look for an architecture using gdbarch_info. Base search on only + BFD_ARCH_INFO and BYTE_ORDER. */ + +struct gdbarch_list * +gdbarch_list_lookup_by_info (arches, info) + struct gdbarch_list *arches; + const struct gdbarch_info *info; +{ + for (; arches != NULL; arches = arches->next) + { + if (info->bfd_arch_info != arches->gdbarch->bfd_arch_info) + continue; + if (info->byte_order != arches->gdbarch->byte_order) + continue; + return arches; + } + return NULL; +} + + +/* Update the current architecture. Return ZERO if the update request + failed. */ + +int +gdbarch_update (info) + struct gdbarch_info info; +{ + struct gdbarch *new_gdbarch; + struct gdbarch_list **list; + struct gdbarch_init_registration *rego; + + /* Fill in any missing bits. Most important is the bfd_architecture + which is used to select the target architecture. */ + if (info.bfd_architecture == bfd_arch_unknown) + { + if (info.bfd_arch_info != NULL) + info.bfd_architecture = info.bfd_arch_info->arch; + else if (info.abfd != NULL) + info.bfd_architecture = bfd_get_arch (info.abfd); + /* FIXME - should query BFD for its default architecture. */ + else + info.bfd_architecture = current_gdbarch->bfd_arch_info->arch; + } + if (info.bfd_arch_info == NULL) + { + if (target_architecture_auto && info.abfd != NULL) + info.bfd_arch_info = bfd_get_arch_info (info.abfd); + else + info.bfd_arch_info = current_gdbarch->bfd_arch_info; + } + if (info.byte_order == 0) + { + if (target_byte_order_auto && info.abfd != NULL) + info.byte_order = (bfd_big_endian (info.abfd) ? BIG_ENDIAN + : bfd_little_endian (info.abfd) ? LITTLE_ENDIAN + : 0); + else + info.byte_order = current_gdbarch->byte_order; + /* FIXME - should query BFD for its default byte-order. */ + } + /* A default for abfd? */ + + /* Find the target that knows about this architecture. */ + for (rego = gdbarch_init_registrary; + rego != NULL && rego->bfd_architecture != info.bfd_architecture; + rego = rego->next); + if (rego == NULL) + { + if (gdbarch_debug) + fprintf_unfiltered (gdb_stdlog, "gdbarch_update: No matching architecture\n"); + return 0; + } + + if (gdbarch_debug) + { + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: info.bfd_architecture %d (%s)\n", + info.bfd_architecture, + bfd_lookup_arch (info.bfd_architecture, 0)->printable_name); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: info.bfd_arch_info %s\n", + (info.bfd_arch_info != NULL + ? info.bfd_arch_info->printable_name + : "(null)")); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: info.byte_order %d (%s)\n", + info.byte_order, + (info.byte_order == BIG_ENDIAN ? "big" + : info.byte_order == LITTLE_ENDIAN ? "little" + : "default")); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: info.abfd 0x%lx\n", + (long) info.abfd); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: info.tdep_info 0x%lx\n", + (long) info.tdep_info); + } + + /* Ask the target for a replacement architecture. */ + new_gdbarch = rego->init (info, rego->arches); + + /* Did the target like it? No. Reject the change. */ + if (new_gdbarch == NULL) + { + if (gdbarch_debug) + fprintf_unfiltered (gdb_stdlog, "gdbarch_update: Target rejected architecture\n"); + return 0; + } + + /* Did the architecture change? No. Do nothing. */ + if (current_gdbarch == new_gdbarch) + { + if (gdbarch_debug) + fprintf_unfiltered (gdb_stdlog, "gdbarch_update: Architecture 0x%08lx (%s) unchanged\n", + (long) new_gdbarch, + new_gdbarch->bfd_arch_info->printable_name); + return 1; + } + + /* Swap all data belonging to the old target out */ + swapout_gdbarch_swap (current_gdbarch); + + /* Is this a pre-existing architecture? Yes. Swap it in. */ + for (list = ®o->arches; + (*list) != NULL; + list = &(*list)->next) + { + if ((*list)->gdbarch == new_gdbarch) + { + if (gdbarch_debug) + fprintf_unfiltered (gdb_stdlog, "gdbarch_update: Previous architecture 0x%08lx (%s) selected\n", + (long) new_gdbarch, + new_gdbarch->bfd_arch_info->printable_name); + current_gdbarch = new_gdbarch; + swapin_gdbarch_swap (new_gdbarch); + return 1; + } + } + + /* Append this new architecture to this targets list. */ + (*list) = XMALLOC (struct gdbarch_list); + (*list)->next = NULL; + (*list)->gdbarch = new_gdbarch; + + /* Switch to this new architecture. Dump it out. */ + current_gdbarch = new_gdbarch; + if (gdbarch_debug) + { + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: New architecture 0x%08lx (%s) selected\n", + (long) new_gdbarch, + new_gdbarch->bfd_arch_info->printable_name); + gdbarch_dump (); + } + + /* Check that the newly installed architecture is valid. */ + verify_gdbarch (new_gdbarch); + + /* Initialize the per-architecture memory (swap) areas. + CURRENT_GDBARCH must be update before these modules are + called. */ + init_gdbarch_swap (new_gdbarch); + + /* Initialize the per-architecture data-pointer of all parties that + registered an interest in this architecture. CURRENT_GDBARCH + must be updated before these modules are called. */ + init_gdbarch_data (new_gdbarch); + + return 1; +} -#ifndef GDBARCH_DEBUG -#define GDBARCH_DEBUG 0 -#endif -int gdbarch_debug = GDBARCH_DEBUG; /* Functions to manipulate the endianness of the target. */ @@ -109,6 +2886,13 @@ set_endian_big (args, from_tty) { target_byte_order = BIG_ENDIAN; target_byte_order_auto = 0; + if (GDB_MULTI_ARCH) + { + struct gdbarch_info info; + memset (&info, 0, sizeof info); + info.byte_order = BIG_ENDIAN; + gdbarch_update (info); + } } else { @@ -128,6 +2912,13 @@ set_endian_little (args, from_tty) { target_byte_order = LITTLE_ENDIAN; target_byte_order_auto = 0; + if (GDB_MULTI_ARCH) + { + struct gdbarch_info info; + memset (&info, 0, sizeof info); + info.byte_order = LITTLE_ENDIAN; + gdbarch_update (info); + } } else { @@ -238,6 +3029,8 @@ set_arch (arch, type) } break; } + if (gdbarch_debug) + gdbarch_dump (); } /* Called if the user enters ``show architecture'' without an argument. */ @@ -271,6 +3064,22 @@ set_architecture (args, from_tty) { target_architecture_auto = 1; } + else if (GDB_MULTI_ARCH) + { + const struct bfd_arch_info *arch = bfd_scan_arch (args); + if (arch == NULL) + printf_unfiltered ("Architecture `%s' not reconized.\n", args); + else + { + struct gdbarch_info info; + memset (&info, 0, sizeof info); + info.bfd_arch_info = arch; + if (gdbarch_update (info)) + target_architecture_auto = 0; + else + printf_unfiltered ("Architecture `%s' not reconized.\n", args); + } + } else { const struct bfd_arch_info *arch = bfd_scan_arch (args); @@ -289,6 +3098,36 @@ info_architecture (args, from_tty) int from_tty; { enum bfd_architecture a; + if (GDB_MULTI_ARCH) + { + if (gdbarch_init_registrary != NULL) + { + struct gdbarch_init_registration *rego; + printf_filtered ("Available architectures are:\n"); + for (rego = gdbarch_init_registrary; + rego != NULL; + rego = rego->next) + { + const struct bfd_arch_info *ap; + ap = bfd_lookup_arch (rego->bfd_architecture, 0); + if (ap != NULL) + { + do + { + printf_filtered (" %s", ap->printable_name); + ap = ap->next; + } + while (ap != NULL); + printf_filtered ("\n"); + } + } + } + else + { + printf_filtered ("There are no available architectures.\n"); + } + return; + } printf_filtered ("Available architectures are:\n"); for (a = bfd_arch_obscure + 1; a < bfd_arch_last; a++) { @@ -316,7 +3155,7 @@ set_architecture_from_arch_mach (arch, mach) if (wanted != NULL) set_arch (wanted, set_arch_manual); else - fatal ("hardwired architecture/machine not reconized"); + fatal ("gdbarch: hardwired architecture/machine not reconized"); } /* Set the architecture from a BFD */ @@ -349,6 +3188,13 @@ frame_num_args_unknown (fi) } +int +generic_register_convertible_not (num) + int num; +{ + return 0; +} + /* Disassembler */ /* Pointer to the target-dependent disassembly function. */ @@ -364,6 +3210,14 @@ void set_gdbarch_from_file (abfd) bfd *abfd; { + if (GDB_MULTI_ARCH) + { + struct gdbarch_info info; + memset (&info, 0, sizeof info); + info.abfd = abfd; + gdbarch_update (info); + return; + } set_architecture_from_file (abfd); set_endian_from_file (abfd); } diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 2bcc7f61175..15be3ae9acd 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -26,6 +26,901 @@ struct value; enum lval_type; #endif + +#ifndef GDB_MULTI_ARCH +#define GDB_MULTI_ARCH 0 +#endif + +extern struct gdbarch *current_gdbarch; + + +/* See gdb/doc/gdbint.texi for a discussion of the GDB_MULTI_ARCH + macro */ + + +/* If any of the following are defined, the target wasn't correctly + converted. */ + +#if GDB_MULTI_ARCH +#if defined (CALL_DUMMY) +#error "CALL_DUMMY: replaced by CALL_DUMMY_WORDS/SIZEOF_CALL_DUMMY_WORDS" +#endif +#endif + +#if GDB_MULTI_ARCH +#if defined (REGISTER_NAMES) +#error "REGISTER_NAMES: replaced by REGISTER_NAME" +#endif +#endif + +#if GDB_MULTI_ARCH +#if defined (EXTRA_FRAME_INFO) +#error "EXTRA_FRAME_INFO: replaced by struct frame_extra_info" +#endif +#endif + +#if GDB_MULTI_ARCH +#if defined (FRAME_FIND_SAVED_REGS) +#error "FRAME_FIND_SAVED_REGS: replaced by FRAME_INIT_SAVED_REGS" +#endif +#endif + + +/* The following are pre-initialized by GDBARCH. */ + +extern const struct bfd_arch_info * gdbarch_bfd_arch_info PARAMS ((struct gdbarch *gdbarch)); +/* set_gdbarch_bfd_arch_info() - not applicable - pre-initialized. */ +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (TARGET_ARCHITECTURE) +#define TARGET_ARCHITECTURE (gdbarch_bfd_arch_info (current_gdbarch)) +#endif +#endif + +extern int gdbarch_byte_order PARAMS ((struct gdbarch *gdbarch)); +/* set_gdbarch_byte_order() - not applicable - pre-initialized. */ +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (TARGET_BYTE_ORDER) +#define TARGET_BYTE_ORDER (gdbarch_byte_order (current_gdbarch)) +#endif +#endif + + +/* The following are initialized by the target dependant code. */ + +extern int gdbarch_ptr_bit PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_ptr_bit PARAMS ((struct gdbarch *gdbarch, int ptr_bit)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (TARGET_PTR_BIT) +#define TARGET_PTR_BIT (gdbarch_ptr_bit (current_gdbarch)) +#endif +#endif + +extern int gdbarch_short_bit PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_short_bit PARAMS ((struct gdbarch *gdbarch, int short_bit)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (TARGET_SHORT_BIT) +#define TARGET_SHORT_BIT (gdbarch_short_bit (current_gdbarch)) +#endif +#endif + +extern int gdbarch_int_bit PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_int_bit PARAMS ((struct gdbarch *gdbarch, int int_bit)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (TARGET_INT_BIT) +#define TARGET_INT_BIT (gdbarch_int_bit (current_gdbarch)) +#endif +#endif + +extern int gdbarch_long_bit PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_long_bit PARAMS ((struct gdbarch *gdbarch, int long_bit)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (TARGET_LONG_BIT) +#define TARGET_LONG_BIT (gdbarch_long_bit (current_gdbarch)) +#endif +#endif + +extern int gdbarch_long_long_bit PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_long_long_bit PARAMS ((struct gdbarch *gdbarch, int long_long_bit)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (TARGET_LONG_LONG_BIT) +#define TARGET_LONG_LONG_BIT (gdbarch_long_long_bit (current_gdbarch)) +#endif +#endif + +extern int gdbarch_float_bit PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_float_bit PARAMS ((struct gdbarch *gdbarch, int float_bit)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (TARGET_FLOAT_BIT) +#define TARGET_FLOAT_BIT (gdbarch_float_bit (current_gdbarch)) +#endif +#endif + +extern int gdbarch_double_bit PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_double_bit PARAMS ((struct gdbarch *gdbarch, int double_bit)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (TARGET_DOUBLE_BIT) +#define TARGET_DOUBLE_BIT (gdbarch_double_bit (current_gdbarch)) +#endif +#endif + +extern int gdbarch_long_double_bit PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_long_double_bit PARAMS ((struct gdbarch *gdbarch, int long_double_bit)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (TARGET_LONG_DOUBLE_BIT) +#define TARGET_LONG_DOUBLE_BIT (gdbarch_long_double_bit (current_gdbarch)) +#endif +#endif + +typedef CORE_ADDR (gdbarch_read_pc_ftype) PARAMS ((int pid)); +extern CORE_ADDR gdbarch_read_pc PARAMS ((struct gdbarch *gdbarch, int pid)); +extern void set_gdbarch_read_pc PARAMS ((struct gdbarch *gdbarch, gdbarch_read_pc_ftype *read_pc)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (TARGET_READ_PC) +#define TARGET_READ_PC(pid) (gdbarch_read_pc (current_gdbarch, pid)) +#endif +#endif + +typedef void (gdbarch_write_pc_ftype) PARAMS ((CORE_ADDR val, int pid)); +extern void gdbarch_write_pc PARAMS ((struct gdbarch *gdbarch, CORE_ADDR val, int pid)); +extern void set_gdbarch_write_pc PARAMS ((struct gdbarch *gdbarch, gdbarch_write_pc_ftype *write_pc)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (TARGET_WRITE_PC) +#define TARGET_WRITE_PC(val, pid) (gdbarch_write_pc (current_gdbarch, val, pid)) +#endif +#endif + +typedef CORE_ADDR (gdbarch_read_fp_ftype) PARAMS ((void)); +extern CORE_ADDR gdbarch_read_fp PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_read_fp PARAMS ((struct gdbarch *gdbarch, gdbarch_read_fp_ftype *read_fp)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (TARGET_READ_FP) +#define TARGET_READ_FP() (gdbarch_read_fp (current_gdbarch)) +#endif +#endif + +typedef void (gdbarch_write_fp_ftype) PARAMS ((CORE_ADDR val)); +extern void gdbarch_write_fp PARAMS ((struct gdbarch *gdbarch, CORE_ADDR val)); +extern void set_gdbarch_write_fp PARAMS ((struct gdbarch *gdbarch, gdbarch_write_fp_ftype *write_fp)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (TARGET_WRITE_FP) +#define TARGET_WRITE_FP(val) (gdbarch_write_fp (current_gdbarch, val)) +#endif +#endif + +typedef CORE_ADDR (gdbarch_read_sp_ftype) PARAMS ((void)); +extern CORE_ADDR gdbarch_read_sp PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_read_sp PARAMS ((struct gdbarch *gdbarch, gdbarch_read_sp_ftype *read_sp)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (TARGET_READ_SP) +#define TARGET_READ_SP() (gdbarch_read_sp (current_gdbarch)) +#endif +#endif + +typedef void (gdbarch_write_sp_ftype) PARAMS ((CORE_ADDR val)); +extern void gdbarch_write_sp PARAMS ((struct gdbarch *gdbarch, CORE_ADDR val)); +extern void set_gdbarch_write_sp PARAMS ((struct gdbarch *gdbarch, gdbarch_write_sp_ftype *write_sp)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (TARGET_WRITE_SP) +#define TARGET_WRITE_SP(val) (gdbarch_write_sp (current_gdbarch, val)) +#endif +#endif + +extern int gdbarch_num_regs PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_num_regs PARAMS ((struct gdbarch *gdbarch, int num_regs)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (NUM_REGS) +#define NUM_REGS (gdbarch_num_regs (current_gdbarch)) +#endif +#endif + +extern int gdbarch_sp_regnum PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_sp_regnum PARAMS ((struct gdbarch *gdbarch, int sp_regnum)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (SP_REGNUM) +#define SP_REGNUM (gdbarch_sp_regnum (current_gdbarch)) +#endif +#endif + +extern int gdbarch_fp_regnum PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_fp_regnum PARAMS ((struct gdbarch *gdbarch, int fp_regnum)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (FP_REGNUM) +#define FP_REGNUM (gdbarch_fp_regnum (current_gdbarch)) +#endif +#endif + +extern int gdbarch_pc_regnum PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_pc_regnum PARAMS ((struct gdbarch *gdbarch, int pc_regnum)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (PC_REGNUM) +#define PC_REGNUM (gdbarch_pc_regnum (current_gdbarch)) +#endif +#endif + +typedef char * (gdbarch_register_name_ftype) PARAMS ((int regnr)); +extern char * gdbarch_register_name PARAMS ((struct gdbarch *gdbarch, int regnr)); +extern void set_gdbarch_register_name PARAMS ((struct gdbarch *gdbarch, gdbarch_register_name_ftype *register_name)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (REGISTER_NAME) +#define REGISTER_NAME(regnr) (gdbarch_register_name (current_gdbarch, regnr)) +#endif +#endif + +extern int gdbarch_register_size PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_register_size PARAMS ((struct gdbarch *gdbarch, int register_size)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (REGISTER_SIZE) +#define REGISTER_SIZE (gdbarch_register_size (current_gdbarch)) +#endif +#endif + +extern int gdbarch_register_bytes PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_register_bytes PARAMS ((struct gdbarch *gdbarch, int register_bytes)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (REGISTER_BYTES) +#define REGISTER_BYTES (gdbarch_register_bytes (current_gdbarch)) +#endif +#endif + +typedef int (gdbarch_register_byte_ftype) PARAMS ((int reg_nr)); +extern int gdbarch_register_byte PARAMS ((struct gdbarch *gdbarch, int reg_nr)); +extern void set_gdbarch_register_byte PARAMS ((struct gdbarch *gdbarch, gdbarch_register_byte_ftype *register_byte)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (REGISTER_BYTE) +#define REGISTER_BYTE(reg_nr) (gdbarch_register_byte (current_gdbarch, reg_nr)) +#endif +#endif + +typedef int (gdbarch_register_raw_size_ftype) PARAMS ((int reg_nr)); +extern int gdbarch_register_raw_size PARAMS ((struct gdbarch *gdbarch, int reg_nr)); +extern void set_gdbarch_register_raw_size PARAMS ((struct gdbarch *gdbarch, gdbarch_register_raw_size_ftype *register_raw_size)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (REGISTER_RAW_SIZE) +#define REGISTER_RAW_SIZE(reg_nr) (gdbarch_register_raw_size (current_gdbarch, reg_nr)) +#endif +#endif + +extern int gdbarch_max_register_raw_size PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_max_register_raw_size PARAMS ((struct gdbarch *gdbarch, int max_register_raw_size)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (MAX_REGISTER_RAW_SIZE) +#define MAX_REGISTER_RAW_SIZE (gdbarch_max_register_raw_size (current_gdbarch)) +#endif +#endif + +typedef int (gdbarch_register_virtual_size_ftype) PARAMS ((int reg_nr)); +extern int gdbarch_register_virtual_size PARAMS ((struct gdbarch *gdbarch, int reg_nr)); +extern void set_gdbarch_register_virtual_size PARAMS ((struct gdbarch *gdbarch, gdbarch_register_virtual_size_ftype *register_virtual_size)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (REGISTER_VIRTUAL_SIZE) +#define REGISTER_VIRTUAL_SIZE(reg_nr) (gdbarch_register_virtual_size (current_gdbarch, reg_nr)) +#endif +#endif + +extern int gdbarch_max_register_virtual_size PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_max_register_virtual_size PARAMS ((struct gdbarch *gdbarch, int max_register_virtual_size)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (MAX_REGISTER_VIRTUAL_SIZE) +#define MAX_REGISTER_VIRTUAL_SIZE (gdbarch_max_register_virtual_size (current_gdbarch)) +#endif +#endif + +typedef struct type * (gdbarch_register_virtual_type_ftype) PARAMS ((int reg_nr)); +extern struct type * gdbarch_register_virtual_type PARAMS ((struct gdbarch *gdbarch, int reg_nr)); +extern void set_gdbarch_register_virtual_type PARAMS ((struct gdbarch *gdbarch, gdbarch_register_virtual_type_ftype *register_virtual_type)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (REGISTER_VIRTUAL_TYPE) +#define REGISTER_VIRTUAL_TYPE(reg_nr) (gdbarch_register_virtual_type (current_gdbarch, reg_nr)) +#endif +#endif + +extern int gdbarch_use_generic_dummy_frames PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_use_generic_dummy_frames PARAMS ((struct gdbarch *gdbarch, int use_generic_dummy_frames)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (USE_GENERIC_DUMMY_FRAMES) +#define USE_GENERIC_DUMMY_FRAMES (gdbarch_use_generic_dummy_frames (current_gdbarch)) +#endif +#endif + +extern int gdbarch_call_dummy_location PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_call_dummy_location PARAMS ((struct gdbarch *gdbarch, int call_dummy_location)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (CALL_DUMMY_LOCATION) +#define CALL_DUMMY_LOCATION (gdbarch_call_dummy_location (current_gdbarch)) +#endif +#endif + +typedef CORE_ADDR (gdbarch_call_dummy_address_ftype) PARAMS ((void)); +extern CORE_ADDR gdbarch_call_dummy_address PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_call_dummy_address PARAMS ((struct gdbarch *gdbarch, gdbarch_call_dummy_address_ftype *call_dummy_address)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (CALL_DUMMY_ADDRESS) +#define CALL_DUMMY_ADDRESS() (gdbarch_call_dummy_address (current_gdbarch)) +#endif +#endif + +extern CORE_ADDR gdbarch_call_dummy_start_offset PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_call_dummy_start_offset PARAMS ((struct gdbarch *gdbarch, CORE_ADDR call_dummy_start_offset)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (CALL_DUMMY_START_OFFSET) +#define CALL_DUMMY_START_OFFSET (gdbarch_call_dummy_start_offset (current_gdbarch)) +#endif +#endif + +extern CORE_ADDR gdbarch_call_dummy_breakpoint_offset PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_call_dummy_breakpoint_offset PARAMS ((struct gdbarch *gdbarch, CORE_ADDR call_dummy_breakpoint_offset)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (CALL_DUMMY_BREAKPOINT_OFFSET) +#define CALL_DUMMY_BREAKPOINT_OFFSET (gdbarch_call_dummy_breakpoint_offset (current_gdbarch)) +#endif +#endif + +extern int gdbarch_call_dummy_breakpoint_offset_p PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_call_dummy_breakpoint_offset_p PARAMS ((struct gdbarch *gdbarch, int call_dummy_breakpoint_offset_p)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (CALL_DUMMY_BREAKPOINT_OFFSET_P) +#define CALL_DUMMY_BREAKPOINT_OFFSET_P (gdbarch_call_dummy_breakpoint_offset_p (current_gdbarch)) +#endif +#endif + +extern int gdbarch_call_dummy_length PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_call_dummy_length PARAMS ((struct gdbarch *gdbarch, int call_dummy_length)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (CALL_DUMMY_LENGTH) +#define CALL_DUMMY_LENGTH (gdbarch_call_dummy_length (current_gdbarch)) +#endif +#endif + +typedef int (gdbarch_pc_in_call_dummy_ftype) PARAMS ((CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address)); +extern int gdbarch_pc_in_call_dummy PARAMS ((struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address)); +extern void set_gdbarch_pc_in_call_dummy PARAMS ((struct gdbarch *gdbarch, gdbarch_pc_in_call_dummy_ftype *pc_in_call_dummy)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (PC_IN_CALL_DUMMY) +#define PC_IN_CALL_DUMMY(pc, sp, frame_address) (gdbarch_pc_in_call_dummy (current_gdbarch, pc, sp, frame_address)) +#endif +#endif + +extern int gdbarch_call_dummy_p PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_call_dummy_p PARAMS ((struct gdbarch *gdbarch, int call_dummy_p)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (CALL_DUMMY_P) +#define CALL_DUMMY_P (gdbarch_call_dummy_p (current_gdbarch)) +#endif +#endif + +extern LONGEST * gdbarch_call_dummy_words PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_call_dummy_words PARAMS ((struct gdbarch *gdbarch, LONGEST * call_dummy_words)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (CALL_DUMMY_WORDS) +#define CALL_DUMMY_WORDS (gdbarch_call_dummy_words (current_gdbarch)) +#endif +#endif + +extern int gdbarch_sizeof_call_dummy_words PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_sizeof_call_dummy_words PARAMS ((struct gdbarch *gdbarch, int sizeof_call_dummy_words)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (SIZEOF_CALL_DUMMY_WORDS) +#define SIZEOF_CALL_DUMMY_WORDS (gdbarch_sizeof_call_dummy_words (current_gdbarch)) +#endif +#endif + +extern int gdbarch_call_dummy_stack_adjust_p PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_call_dummy_stack_adjust_p PARAMS ((struct gdbarch *gdbarch, int call_dummy_stack_adjust_p)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (CALL_DUMMY_STACK_ADJUST_P) +#define CALL_DUMMY_STACK_ADJUST_P (gdbarch_call_dummy_stack_adjust_p (current_gdbarch)) +#endif +#endif + +extern int gdbarch_call_dummy_stack_adjust PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_call_dummy_stack_adjust PARAMS ((struct gdbarch *gdbarch, int call_dummy_stack_adjust)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (CALL_DUMMY_STACK_ADJUST) +#define CALL_DUMMY_STACK_ADJUST (gdbarch_call_dummy_stack_adjust (current_gdbarch)) +#endif +#endif + +typedef void (gdbarch_fix_call_dummy_ftype) PARAMS ((char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p)); +extern void gdbarch_fix_call_dummy PARAMS ((struct gdbarch *gdbarch, char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p)); +extern void set_gdbarch_fix_call_dummy PARAMS ((struct gdbarch *gdbarch, gdbarch_fix_call_dummy_ftype *fix_call_dummy)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (FIX_CALL_DUMMY) +#define FIX_CALL_DUMMY(dummy, pc, fun, nargs, args, type, gcc_p) (gdbarch_fix_call_dummy (current_gdbarch, dummy, pc, fun, nargs, args, type, gcc_p)) +#endif +#endif + +extern int gdbarch_believe_pcc_promotion PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_believe_pcc_promotion PARAMS ((struct gdbarch *gdbarch, int believe_pcc_promotion)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (BELIEVE_PCC_PROMOTION) +#define BELIEVE_PCC_PROMOTION (gdbarch_believe_pcc_promotion (current_gdbarch)) +#endif +#endif + +extern int gdbarch_believe_pcc_promotion_type PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_believe_pcc_promotion_type PARAMS ((struct gdbarch *gdbarch, int believe_pcc_promotion_type)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (BELIEVE_PCC_PROMOTION_TYPE) +#define BELIEVE_PCC_PROMOTION_TYPE (gdbarch_believe_pcc_promotion_type (current_gdbarch)) +#endif +#endif + +typedef void (gdbarch_get_saved_register_ftype) PARAMS ((char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval)); +extern void gdbarch_get_saved_register PARAMS ((struct gdbarch *gdbarch, char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval)); +extern void set_gdbarch_get_saved_register PARAMS ((struct gdbarch *gdbarch, gdbarch_get_saved_register_ftype *get_saved_register)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (GET_SAVED_REGISTER) +#define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) (gdbarch_get_saved_register (current_gdbarch, raw_buffer, optimized, addrp, frame, regnum, lval)) +#endif +#endif + +typedef int (gdbarch_register_convertible_ftype) PARAMS ((int nr)); +extern int gdbarch_register_convertible PARAMS ((struct gdbarch *gdbarch, int nr)); +extern void set_gdbarch_register_convertible PARAMS ((struct gdbarch *gdbarch, gdbarch_register_convertible_ftype *register_convertible)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (REGISTER_CONVERTIBLE) +#define REGISTER_CONVERTIBLE(nr) (gdbarch_register_convertible (current_gdbarch, nr)) +#endif +#endif + +typedef void (gdbarch_register_convert_to_virtual_ftype) PARAMS ((int regnum, struct type *type, char *from, char *to)); +extern void gdbarch_register_convert_to_virtual PARAMS ((struct gdbarch *gdbarch, int regnum, struct type *type, char *from, char *to)); +extern void set_gdbarch_register_convert_to_virtual PARAMS ((struct gdbarch *gdbarch, gdbarch_register_convert_to_virtual_ftype *register_convert_to_virtual)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (REGISTER_CONVERT_TO_VIRTUAL) +#define REGISTER_CONVERT_TO_VIRTUAL(regnum, type, from, to) (gdbarch_register_convert_to_virtual (current_gdbarch, regnum, type, from, to)) +#endif +#endif + +typedef void (gdbarch_register_convert_to_raw_ftype) PARAMS ((struct type *type, int regnum, char *from, char *to)); +extern void gdbarch_register_convert_to_raw PARAMS ((struct gdbarch *gdbarch, struct type *type, int regnum, char *from, char *to)); +extern void set_gdbarch_register_convert_to_raw PARAMS ((struct gdbarch *gdbarch, gdbarch_register_convert_to_raw_ftype *register_convert_to_raw)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (REGISTER_CONVERT_TO_RAW) +#define REGISTER_CONVERT_TO_RAW(type, regnum, from, to) (gdbarch_register_convert_to_raw (current_gdbarch, type, regnum, from, to)) +#endif +#endif + +typedef void (gdbarch_extract_return_value_ftype) PARAMS ((struct type *type, char *regbuf, char *valbuf)); +extern void gdbarch_extract_return_value PARAMS ((struct gdbarch *gdbarch, struct type *type, char *regbuf, char *valbuf)); +extern void set_gdbarch_extract_return_value PARAMS ((struct gdbarch *gdbarch, gdbarch_extract_return_value_ftype *extract_return_value)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (EXTRACT_RETURN_VALUE) +#define EXTRACT_RETURN_VALUE(type, regbuf, valbuf) (gdbarch_extract_return_value (current_gdbarch, type, regbuf, valbuf)) +#endif +#endif + +typedef CORE_ADDR (gdbarch_push_arguments_ftype) PARAMS ((int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr)); +extern CORE_ADDR gdbarch_push_arguments PARAMS ((struct gdbarch *gdbarch, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr)); +extern void set_gdbarch_push_arguments PARAMS ((struct gdbarch *gdbarch, gdbarch_push_arguments_ftype *push_arguments)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (PUSH_ARGUMENTS) +#define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) (gdbarch_push_arguments (current_gdbarch, nargs, args, sp, struct_return, struct_addr)) +#endif +#endif + +typedef void (gdbarch_push_dummy_frame_ftype) PARAMS ((void)); +extern void gdbarch_push_dummy_frame PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_push_dummy_frame PARAMS ((struct gdbarch *gdbarch, gdbarch_push_dummy_frame_ftype *push_dummy_frame)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (PUSH_DUMMY_FRAME) +#define PUSH_DUMMY_FRAME (gdbarch_push_dummy_frame (current_gdbarch)) +#endif +#endif + +typedef CORE_ADDR (gdbarch_push_return_address_ftype) PARAMS ((CORE_ADDR pc, CORE_ADDR sp)); +extern CORE_ADDR gdbarch_push_return_address PARAMS ((struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR sp)); +extern void set_gdbarch_push_return_address PARAMS ((struct gdbarch *gdbarch, gdbarch_push_return_address_ftype *push_return_address)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (PUSH_RETURN_ADDRESS) +#define PUSH_RETURN_ADDRESS(pc, sp) (gdbarch_push_return_address (current_gdbarch, pc, sp)) +#endif +#endif + +typedef void (gdbarch_pop_frame_ftype) PARAMS ((void)); +extern void gdbarch_pop_frame PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_pop_frame PARAMS ((struct gdbarch *gdbarch, gdbarch_pop_frame_ftype *pop_frame)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (POP_FRAME) +#define POP_FRAME (gdbarch_pop_frame (current_gdbarch)) +#endif +#endif + +typedef CORE_ADDR (gdbarch_d10v_make_daddr_ftype) PARAMS ((CORE_ADDR x)); +extern CORE_ADDR gdbarch_d10v_make_daddr PARAMS ((struct gdbarch *gdbarch, CORE_ADDR x)); +extern void set_gdbarch_d10v_make_daddr PARAMS ((struct gdbarch *gdbarch, gdbarch_d10v_make_daddr_ftype *d10v_make_daddr)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (D10V_MAKE_DADDR) +#define D10V_MAKE_DADDR(x) (gdbarch_d10v_make_daddr (current_gdbarch, x)) +#endif +#endif + +typedef CORE_ADDR (gdbarch_d10v_make_iaddr_ftype) PARAMS ((CORE_ADDR x)); +extern CORE_ADDR gdbarch_d10v_make_iaddr PARAMS ((struct gdbarch *gdbarch, CORE_ADDR x)); +extern void set_gdbarch_d10v_make_iaddr PARAMS ((struct gdbarch *gdbarch, gdbarch_d10v_make_iaddr_ftype *d10v_make_iaddr)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (D10V_MAKE_IADDR) +#define D10V_MAKE_IADDR(x) (gdbarch_d10v_make_iaddr (current_gdbarch, x)) +#endif +#endif + +typedef int (gdbarch_d10v_daddr_p_ftype) PARAMS ((CORE_ADDR x)); +extern int gdbarch_d10v_daddr_p PARAMS ((struct gdbarch *gdbarch, CORE_ADDR x)); +extern void set_gdbarch_d10v_daddr_p PARAMS ((struct gdbarch *gdbarch, gdbarch_d10v_daddr_p_ftype *d10v_daddr_p)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (D10V_DADDR_P) +#define D10V_DADDR_P(x) (gdbarch_d10v_daddr_p (current_gdbarch, x)) +#endif +#endif + +typedef int (gdbarch_d10v_iaddr_p_ftype) PARAMS ((CORE_ADDR x)); +extern int gdbarch_d10v_iaddr_p PARAMS ((struct gdbarch *gdbarch, CORE_ADDR x)); +extern void set_gdbarch_d10v_iaddr_p PARAMS ((struct gdbarch *gdbarch, gdbarch_d10v_iaddr_p_ftype *d10v_iaddr_p)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (D10V_IADDR_P) +#define D10V_IADDR_P(x) (gdbarch_d10v_iaddr_p (current_gdbarch, x)) +#endif +#endif + +typedef CORE_ADDR (gdbarch_d10v_convert_daddr_to_raw_ftype) PARAMS ((CORE_ADDR x)); +extern CORE_ADDR gdbarch_d10v_convert_daddr_to_raw PARAMS ((struct gdbarch *gdbarch, CORE_ADDR x)); +extern void set_gdbarch_d10v_convert_daddr_to_raw PARAMS ((struct gdbarch *gdbarch, gdbarch_d10v_convert_daddr_to_raw_ftype *d10v_convert_daddr_to_raw)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (D10V_CONVERT_DADDR_TO_RAW) +#define D10V_CONVERT_DADDR_TO_RAW(x) (gdbarch_d10v_convert_daddr_to_raw (current_gdbarch, x)) +#endif +#endif + +typedef CORE_ADDR (gdbarch_d10v_convert_iaddr_to_raw_ftype) PARAMS ((CORE_ADDR x)); +extern CORE_ADDR gdbarch_d10v_convert_iaddr_to_raw PARAMS ((struct gdbarch *gdbarch, CORE_ADDR x)); +extern void set_gdbarch_d10v_convert_iaddr_to_raw PARAMS ((struct gdbarch *gdbarch, gdbarch_d10v_convert_iaddr_to_raw_ftype *d10v_convert_iaddr_to_raw)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (D10V_CONVERT_IADDR_TO_RAW) +#define D10V_CONVERT_IADDR_TO_RAW(x) (gdbarch_d10v_convert_iaddr_to_raw (current_gdbarch, x)) +#endif +#endif + +typedef void (gdbarch_store_struct_return_ftype) PARAMS ((CORE_ADDR addr, CORE_ADDR sp)); +extern void gdbarch_store_struct_return PARAMS ((struct gdbarch *gdbarch, CORE_ADDR addr, CORE_ADDR sp)); +extern void set_gdbarch_store_struct_return PARAMS ((struct gdbarch *gdbarch, gdbarch_store_struct_return_ftype *store_struct_return)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (STORE_STRUCT_RETURN) +#define STORE_STRUCT_RETURN(addr, sp) (gdbarch_store_struct_return (current_gdbarch, addr, sp)) +#endif +#endif + +typedef void (gdbarch_store_return_value_ftype) PARAMS ((struct type *type, char *valbuf)); +extern void gdbarch_store_return_value PARAMS ((struct gdbarch *gdbarch, struct type *type, char *valbuf)); +extern void set_gdbarch_store_return_value PARAMS ((struct gdbarch *gdbarch, gdbarch_store_return_value_ftype *store_return_value)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (STORE_RETURN_VALUE) +#define STORE_RETURN_VALUE(type, valbuf) (gdbarch_store_return_value (current_gdbarch, type, valbuf)) +#endif +#endif + +typedef CORE_ADDR (gdbarch_extract_struct_value_address_ftype) PARAMS ((char *regbuf)); +extern CORE_ADDR gdbarch_extract_struct_value_address PARAMS ((struct gdbarch *gdbarch, char *regbuf)); +extern void set_gdbarch_extract_struct_value_address PARAMS ((struct gdbarch *gdbarch, gdbarch_extract_struct_value_address_ftype *extract_struct_value_address)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (EXTRACT_STRUCT_VALUE_ADDRESS) +#define EXTRACT_STRUCT_VALUE_ADDRESS(regbuf) (gdbarch_extract_struct_value_address (current_gdbarch, regbuf)) +#endif +#endif + +typedef int (gdbarch_use_struct_convention_ftype) PARAMS ((int gcc_p, struct type *value_type)); +extern int gdbarch_use_struct_convention PARAMS ((struct gdbarch *gdbarch, int gcc_p, struct type *value_type)); +extern void set_gdbarch_use_struct_convention PARAMS ((struct gdbarch *gdbarch, gdbarch_use_struct_convention_ftype *use_struct_convention)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (USE_STRUCT_CONVENTION) +#define USE_STRUCT_CONVENTION(gcc_p, value_type) (gdbarch_use_struct_convention (current_gdbarch, gcc_p, value_type)) +#endif +#endif + +typedef void (gdbarch_frame_init_saved_regs_ftype) PARAMS ((struct frame_info *frame)); +extern void gdbarch_frame_init_saved_regs PARAMS ((struct gdbarch *gdbarch, struct frame_info *frame)); +extern void set_gdbarch_frame_init_saved_regs PARAMS ((struct gdbarch *gdbarch, gdbarch_frame_init_saved_regs_ftype *frame_init_saved_regs)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (FRAME_INIT_SAVED_REGS) +#define FRAME_INIT_SAVED_REGS(frame) (gdbarch_frame_init_saved_regs (current_gdbarch, frame)) +#endif +#endif + +typedef void (gdbarch_init_extra_frame_info_ftype) PARAMS ((int fromleaf, struct frame_info *frame)); +extern void gdbarch_init_extra_frame_info PARAMS ((struct gdbarch *gdbarch, int fromleaf, struct frame_info *frame)); +extern void set_gdbarch_init_extra_frame_info PARAMS ((struct gdbarch *gdbarch, gdbarch_init_extra_frame_info_ftype *init_extra_frame_info)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (INIT_EXTRA_FRAME_INFO) +#define INIT_EXTRA_FRAME_INFO(fromleaf, frame) (gdbarch_init_extra_frame_info (current_gdbarch, fromleaf, frame)) +#endif +#endif + +typedef CORE_ADDR (gdbarch_skip_prologue_ftype) PARAMS ((CORE_ADDR ip)); +extern CORE_ADDR gdbarch_skip_prologue PARAMS ((struct gdbarch *gdbarch, CORE_ADDR ip)); +extern void set_gdbarch_skip_prologue PARAMS ((struct gdbarch *gdbarch, gdbarch_skip_prologue_ftype *skip_prologue)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (SKIP_PROLOGUE) +#define SKIP_PROLOGUE(ip) (gdbarch_skip_prologue (current_gdbarch, ip)) +#endif +#endif + +typedef int (gdbarch_inner_than_ftype) PARAMS ((CORE_ADDR lhs, CORE_ADDR rhs)); +extern int gdbarch_inner_than PARAMS ((struct gdbarch *gdbarch, CORE_ADDR lhs, CORE_ADDR rhs)); +extern void set_gdbarch_inner_than PARAMS ((struct gdbarch *gdbarch, gdbarch_inner_than_ftype *inner_than)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (INNER_THAN) +#define INNER_THAN(lhs, rhs) (gdbarch_inner_than (current_gdbarch, lhs, rhs)) +#endif +#endif + +typedef unsigned char * (gdbarch_breakpoint_from_pc_ftype) PARAMS ((CORE_ADDR *pcptr, int *lenptr)); +extern unsigned char * gdbarch_breakpoint_from_pc PARAMS ((struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr)); +extern void set_gdbarch_breakpoint_from_pc PARAMS ((struct gdbarch *gdbarch, gdbarch_breakpoint_from_pc_ftype *breakpoint_from_pc)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (BREAKPOINT_FROM_PC) +#define BREAKPOINT_FROM_PC(pcptr, lenptr) (gdbarch_breakpoint_from_pc (current_gdbarch, pcptr, lenptr)) +#endif +#endif + +extern CORE_ADDR gdbarch_decr_pc_after_break PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_decr_pc_after_break PARAMS ((struct gdbarch *gdbarch, CORE_ADDR decr_pc_after_break)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (DECR_PC_AFTER_BREAK) +#define DECR_PC_AFTER_BREAK (gdbarch_decr_pc_after_break (current_gdbarch)) +#endif +#endif + +extern CORE_ADDR gdbarch_function_start_offset PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_function_start_offset PARAMS ((struct gdbarch *gdbarch, CORE_ADDR function_start_offset)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (FUNCTION_START_OFFSET) +#define FUNCTION_START_OFFSET (gdbarch_function_start_offset (current_gdbarch)) +#endif +#endif + +typedef void (gdbarch_remote_translate_xfer_address_ftype) PARAMS ((CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len)); +extern void gdbarch_remote_translate_xfer_address PARAMS ((struct gdbarch *gdbarch, CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len)); +extern void set_gdbarch_remote_translate_xfer_address PARAMS ((struct gdbarch *gdbarch, gdbarch_remote_translate_xfer_address_ftype *remote_translate_xfer_address)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (REMOTE_TRANSLATE_XFER_ADDRESS) +#define REMOTE_TRANSLATE_XFER_ADDRESS(gdb_addr, gdb_len, rem_addr, rem_len) (gdbarch_remote_translate_xfer_address (current_gdbarch, gdb_addr, gdb_len, rem_addr, rem_len)) +#endif +#endif + +extern CORE_ADDR gdbarch_frame_args_skip PARAMS ((struct gdbarch *gdbarch)); +extern void set_gdbarch_frame_args_skip PARAMS ((struct gdbarch *gdbarch, CORE_ADDR frame_args_skip)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (FRAME_ARGS_SKIP) +#define FRAME_ARGS_SKIP (gdbarch_frame_args_skip (current_gdbarch)) +#endif +#endif + +typedef int (gdbarch_frameless_function_invocation_ftype) PARAMS ((struct frame_info *fi)); +extern int gdbarch_frameless_function_invocation PARAMS ((struct gdbarch *gdbarch, struct frame_info *fi)); +extern void set_gdbarch_frameless_function_invocation PARAMS ((struct gdbarch *gdbarch, gdbarch_frameless_function_invocation_ftype *frameless_function_invocation)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (FRAMELESS_FUNCTION_INVOCATION) +#define FRAMELESS_FUNCTION_INVOCATION(fi) (gdbarch_frameless_function_invocation (current_gdbarch, fi)) +#endif +#endif + +typedef CORE_ADDR (gdbarch_frame_chain_ftype) PARAMS ((struct frame_info *frame)); +extern CORE_ADDR gdbarch_frame_chain PARAMS ((struct gdbarch *gdbarch, struct frame_info *frame)); +extern void set_gdbarch_frame_chain PARAMS ((struct gdbarch *gdbarch, gdbarch_frame_chain_ftype *frame_chain)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (FRAME_CHAIN) +#define FRAME_CHAIN(frame) (gdbarch_frame_chain (current_gdbarch, frame)) +#endif +#endif + +typedef int (gdbarch_frame_chain_valid_ftype) PARAMS ((CORE_ADDR chain, struct frame_info *thisframe)); +extern int gdbarch_frame_chain_valid PARAMS ((struct gdbarch *gdbarch, CORE_ADDR chain, struct frame_info *thisframe)); +extern void set_gdbarch_frame_chain_valid PARAMS ((struct gdbarch *gdbarch, gdbarch_frame_chain_valid_ftype *frame_chain_valid)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (FRAME_CHAIN_VALID) +#define FRAME_CHAIN_VALID(chain, thisframe) (gdbarch_frame_chain_valid (current_gdbarch, chain, thisframe)) +#endif +#endif + +typedef CORE_ADDR (gdbarch_frame_saved_pc_ftype) PARAMS ((struct frame_info *fi)); +extern CORE_ADDR gdbarch_frame_saved_pc PARAMS ((struct gdbarch *gdbarch, struct frame_info *fi)); +extern void set_gdbarch_frame_saved_pc PARAMS ((struct gdbarch *gdbarch, gdbarch_frame_saved_pc_ftype *frame_saved_pc)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (FRAME_SAVED_PC) +#define FRAME_SAVED_PC(fi) (gdbarch_frame_saved_pc (current_gdbarch, fi)) +#endif +#endif + +typedef CORE_ADDR (gdbarch_frame_args_address_ftype) PARAMS ((struct frame_info *fi)); +extern CORE_ADDR gdbarch_frame_args_address PARAMS ((struct gdbarch *gdbarch, struct frame_info *fi)); +extern void set_gdbarch_frame_args_address PARAMS ((struct gdbarch *gdbarch, gdbarch_frame_args_address_ftype *frame_args_address)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (FRAME_ARGS_ADDRESS) +#define FRAME_ARGS_ADDRESS(fi) (gdbarch_frame_args_address (current_gdbarch, fi)) +#endif +#endif + +typedef CORE_ADDR (gdbarch_frame_locals_address_ftype) PARAMS ((struct frame_info *fi)); +extern CORE_ADDR gdbarch_frame_locals_address PARAMS ((struct gdbarch *gdbarch, struct frame_info *fi)); +extern void set_gdbarch_frame_locals_address PARAMS ((struct gdbarch *gdbarch, gdbarch_frame_locals_address_ftype *frame_locals_address)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (FRAME_LOCALS_ADDRESS) +#define FRAME_LOCALS_ADDRESS(fi) (gdbarch_frame_locals_address (current_gdbarch, fi)) +#endif +#endif + +typedef CORE_ADDR (gdbarch_saved_pc_after_call_ftype) PARAMS ((struct frame_info *frame)); +extern CORE_ADDR gdbarch_saved_pc_after_call PARAMS ((struct gdbarch *gdbarch, struct frame_info *frame)); +extern void set_gdbarch_saved_pc_after_call PARAMS ((struct gdbarch *gdbarch, gdbarch_saved_pc_after_call_ftype *saved_pc_after_call)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (SAVED_PC_AFTER_CALL) +#define SAVED_PC_AFTER_CALL(frame) (gdbarch_saved_pc_after_call (current_gdbarch, frame)) +#endif +#endif + +typedef int (gdbarch_frame_num_args_ftype) PARAMS ((struct frame_info *frame)); +extern int gdbarch_frame_num_args PARAMS ((struct gdbarch *gdbarch, struct frame_info *frame)); +extern void set_gdbarch_frame_num_args PARAMS ((struct gdbarch *gdbarch, gdbarch_frame_num_args_ftype *frame_num_args)); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > 1) || !defined (FRAME_NUM_ARGS) +#define FRAME_NUM_ARGS(frame) (gdbarch_frame_num_args (current_gdbarch, frame)) +#endif +#endif + +extern struct gdbarch_tdep *gdbarch_tdep PARAMS ((struct gdbarch *gdbarch)); + + +/* Mechanism for co-ordinating the selection of a specific + architecture. + + GDB targets (*-tdep.c) can register an interest in a specific + architecture. Other GDB components can register a need to maintain + per-architecture data. + + The mechanisms below ensures that there is only a loose connection + between the set-architecture command and the various GDB + components. Each component can independantly register their need + to maintain architecture specific data with gdbarch. + + Pragmatics: + + Previously, a single TARGET_ARCHITECTURE_HOOK was provided. It + didn't scale. + + The more traditional mega-struct containing architecture specific + data for all the various GDB components was also considered. Since + GDB is built from a variable number of (fairly independant) + components it was determined that the global aproach was not + applicable. */ + + +/* Register a new architectural family with GDB. + + Register support for the specified ARCHITECTURE with GDB. When + gdbarch determines that the specified architecture has been + selected, the corresponding INIT function is called. + + -- + + The INIT function takes two parameters: INFO which contains the + information available to gdbarch about the (possibly new) + architecture; ARCHES which is a list of the previously created + ``struct gdbarch'' for this architecture. + + The INIT function parameter INFO shall, as far as possible, be + pre-initialized with information obtained from INFO.ABFD or + previously selected architecture (if similar). INIT shall ensure + that the INFO.BYTE_ORDER is non-zero. + + The INIT function shall return any of: NULL - indicating that it + doesn't reconize the selected architecture; an existing ``struct + gdbarch'' from the ARCHES list - indicating that the new + architecture is just a synonym for an earlier architecture (see + gdbarch_list_lookup_by_info()); a newly created ``struct gdbarch'' + - that describes the selected architecture (see + gdbarch_alloc()). */ + +struct gdbarch_list +{ + struct gdbarch *gdbarch; + struct gdbarch_list *next; +}; + +struct gdbarch_info +{ + /* Use default: bfd_arch_unknown (ZERO). */ + enum bfd_architecture bfd_architecture; + + /* Use default: NULL (ZERO). */ + const struct bfd_arch_info *bfd_arch_info; + + /* Use default: 0 (ZERO). */ + int byte_order; + + /* Use default: NULL (ZERO). */ + bfd *abfd; + + /* Use default: NULL (ZERO). */ + struct gdbarch_tdep_info *tdep_info; +}; + +typedef struct gdbarch *(gdbarch_init_ftype) PARAMS ((struct gdbarch_info info, struct gdbarch_list *arches)); + +extern void register_gdbarch_init PARAMS ((enum bfd_architecture architecture, gdbarch_init_ftype *)); + + +/* Helper function. Search the list of ARCHES for a GDBARCH that + matches the information provided by INFO. */ + +extern struct gdbarch_list *gdbarch_list_lookup_by_info PARAMS ((struct gdbarch_list *arches, const struct gdbarch_info *info)); + + +/* Helper function. Create a preliminary ``struct gdbarch''. Perform + basic initialization using values obtained from the INFO andTDEP + parameters. set_gdbarch_*() functions are called to complete the + initialization of the object. */ + +extern struct gdbarch *gdbarch_alloc PARAMS ((const struct gdbarch_info *info, struct gdbarch_tdep *tdep)); + + +/* Helper function. Force an update of the current architecture. Used + by legacy targets that have added their own target specific + architecture manipulation commands. + + The INFO parameter shall be fully initialized (``memset (&INFO, + sizeof (info), 0)'' set relevant fields) before gdbarch_update() is + called. gdbarch_update() shall initialize any ``default'' fields + using information obtained from the previous architecture or + INFO.ABFD (if specified) before calling the corresponding + architectures INIT function. */ + +extern int gdbarch_update PARAMS ((struct gdbarch_info info)); + + + +/* Register per-architecture data-pointer. + + Reserve space for a per-architecture data-pointer. An identifier + for the reserved data-pointer is returned. That identifer should + be saved in a local static. + + When a new architecture is selected, INIT() is called. When a + previous architecture is re-selected, the per-architecture + data-pointer for that previous architecture is restored (INIT() is + not called). + + INIT() shall return the initial value for the per-architecture + data-pointer for the current architecture. + + Multiple registrarants for any architecture are allowed (and + strongly encouraged). */ + +typedef void *(gdbarch_data_ftype) PARAMS ((void)); +extern struct gdbarch_data *register_gdbarch_data PARAMS ((gdbarch_data_ftype *init)); + +/* Return the value of the per-architecture data-pointer for the + current architecture. */ + +extern void *gdbarch_data PARAMS ((struct gdbarch_data*)); + + + +/* Register per-architecture memory region. + + Provide a memory-region swap mechanism. Per-architecture memory + region are created. These memory regions are swapped whenever the + architecture is changed. For a new architecture, the memory region + is initialized with zero (0) and the INIT function is called. + + Memory regions are swapped / initialized in the order that they are + registered. NULL DATA and/or INIT values can be specified. + + New code should use register_gdbarch_data(). */ + +typedef void (gdbarch_swap_ftype) PARAMS ((void)); +extern void register_gdbarch_swap PARAMS ((void *data, unsigned long size, gdbarch_swap_ftype *init)); + + + /* The target-system-dependant byte order is dynamic */ /* TARGET_BYTE_ORDER_SELECTABLE_P determines if the target endianness @@ -34,6 +929,11 @@ enum lval_type; target_byte_order should be auto-detected (from the program image say). */ +#if GDB_MULTI_ARCH +/* Multi-arch GDB is always bi-endian. */ +#define TARGET_BYTE_ORDER_SELECTABLE_P 1 +#endif + #ifndef TARGET_BYTE_ORDER_SELECTABLE_P /* compat - Catch old targets that define TARGET_BYTE_ORDER_SLECTABLE when they should have defined TARGET_BYTE_ORDER_SELECTABLE_P 1 */ @@ -110,10 +1010,10 @@ extern disassemble_info tm_print_insn_info; #define GDB_TARGET_IS_D10V (TARGET_ARCHITECTURE->arch == bfd_arch_d10v) #ifndef D10V_MAKE_DADDR -#define D10V_MAKE_DADDR(X) (abort (), 0) +#define D10V_MAKE_DADDR(X) (fatal ("gdbarch: D10V_MAKE_DADDR"), 0) #endif #ifndef D10V_MAKE_IADDR -#define D10V_MAKE_IADDR(X) (abort (), 0) +#define D10V_MAKE_IADDR(X) (fatal ("gdbarch: D10V_MAKE_IADDR"), 0) #endif @@ -124,6 +1024,7 @@ extern disassemble_info tm_print_insn_info; /* Fallback definition of REGISTER_CONVERTIBLE etc */ +extern int generic_register_convertible_not PARAMS ((int reg_nr)); #ifndef REGISTER_CONVERTIBLE #define REGISTER_CONVERTIBLE(x) (0) #endif @@ -138,7 +1039,7 @@ extern disassemble_info tm_print_insn_info; /* Fallback definition for EXTRACT_STRUCT_VALUE_ADDRESS */ #ifndef EXTRACT_STRUCT_VALUE_ADDRESS #define EXTRACT_STRUCT_VALUE_ADDRESS_P (0) -#define EXTRACT_STRUCT_VALUE_ADDRESS(X) (abort (), 0) +#define EXTRACT_STRUCT_VALUE_ADDRESS(X) (fatal ("gdbarch: EXTRACT_STRUCT_VALUE_ADDRESS"), 0) #else #ifndef EXTRACT_STRUCT_VALUE_ADDRESS_P #define EXTRACT_STRUCT_VALUE_ADDRESS_P (1) @@ -175,4 +1076,6 @@ extern int frame_num_args_unknown PARAMS ((struct frame_info *fi)); /* gdbarch trace variable */ extern int gdbarch_debug; +extern void gdbarch_dump PARAMS ((void)); + #endif diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index ca9764b1eb9..64407668b82 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -2897,4 +2897,35 @@ void _initialize_gdbtypes () { build_gdbtypes (); + + /* FIXME - For the moment, handle types by swapping them in and out. + Should be using the per-architecture data-pointer and a large + struct. */ + register_gdbarch_swap (&builtin_type_void, sizeof (struct type*), NULL); + register_gdbarch_swap (&builtin_type_char, sizeof (struct type*), NULL); + register_gdbarch_swap (&builtin_type_short, sizeof (struct type*), NULL); + register_gdbarch_swap (&builtin_type_int, sizeof (struct type*), NULL); + register_gdbarch_swap (&builtin_type_long, sizeof (struct type*), NULL); + register_gdbarch_swap (&builtin_type_long_long, sizeof (struct type*), NULL); + register_gdbarch_swap (&builtin_type_signed_char, sizeof (struct type*), NULL); + register_gdbarch_swap (&builtin_type_unsigned_char, sizeof (struct type*), NULL); + register_gdbarch_swap (&builtin_type_unsigned_short, sizeof (struct type*), NULL); + register_gdbarch_swap (&builtin_type_unsigned_int, sizeof (struct type*), NULL); + register_gdbarch_swap (&builtin_type_unsigned_long, sizeof (struct type*), NULL); + register_gdbarch_swap (&builtin_type_unsigned_long_long, sizeof (struct type*), NULL); + register_gdbarch_swap (&builtin_type_float, sizeof (struct type*), NULL); + register_gdbarch_swap (&builtin_type_double, sizeof (struct type*), NULL); + register_gdbarch_swap (&builtin_type_long_double, sizeof (struct type*), NULL); + register_gdbarch_swap (&builtin_type_complex, sizeof (struct type*), NULL); + register_gdbarch_swap (&builtin_type_double_complex, sizeof (struct type*), NULL); + register_gdbarch_swap (&builtin_type_string, sizeof (struct type*), NULL); + register_gdbarch_swap (&builtin_type_int8, sizeof (struct type*), NULL); + register_gdbarch_swap (&builtin_type_uint8, sizeof (struct type*), NULL); + register_gdbarch_swap (&builtin_type_int16, sizeof (struct type*), NULL); + register_gdbarch_swap (&builtin_type_uint16, sizeof (struct type*), NULL); + register_gdbarch_swap (&builtin_type_int32, sizeof (struct type*), NULL); + register_gdbarch_swap (&builtin_type_uint32, sizeof (struct type*), NULL); + register_gdbarch_swap (&builtin_type_int64, sizeof (struct type*), NULL); + register_gdbarch_swap (&builtin_type_uint64, sizeof (struct type*), NULL); + register_gdbarch_swap (NULL, 0, build_gdbtypes); } diff --git a/gdb/inferior.h b/gdb/inferior.h index 02d942ec1af..b87bca9899d 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -122,18 +122,30 @@ extern CORE_ADDR read_pc PARAMS ((void)); extern CORE_ADDR read_pc_pid PARAMS ((int)); +extern CORE_ADDR generic_target_read_pc PARAMS ((int)); + extern void write_pc PARAMS ((CORE_ADDR)); extern void write_pc_pid PARAMS ((CORE_ADDR, int)); +extern void generic_target_write_pc PARAMS ((CORE_ADDR, int)); + extern CORE_ADDR read_sp PARAMS ((void)); +extern CORE_ADDR generic_target_read_sp PARAMS ((void)); + extern void write_sp PARAMS ((CORE_ADDR)); +extern void generic_target_write_sp PARAMS ((CORE_ADDR)); + extern CORE_ADDR read_fp PARAMS ((void)); +extern CORE_ADDR generic_target_read_fp PARAMS ((void)); + extern void write_fp PARAMS ((CORE_ADDR)); +extern void generic_target_write_fp PARAMS ((CORE_ADDR)); + extern void wait_for_inferior PARAMS ((void)); extern void init_wait_for_inferior PARAMS ((void)); @@ -435,24 +447,32 @@ extern int sizeof_call_dummy_words; /* Are we in a call dummy? */ extern int pc_in_call_dummy_before_text_end PARAMS ((CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address)); +#if !GDB_MULTI_ARCH #if !defined (PC_IN_CALL_DUMMY) && CALL_DUMMY_LOCATION == BEFORE_TEXT_END #define PC_IN_CALL_DUMMY(pc, sp, frame_address) pc_in_call_dummy_before_text_end (pc, sp, frame_address) #endif /* Before text_end. */ +#endif extern int pc_in_call_dummy_after_text_end PARAMS ((CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address)); +#if !GDB_MULTI_ARCH #if !defined (PC_IN_CALL_DUMMY) && CALL_DUMMY_LOCATION == AFTER_TEXT_END #define PC_IN_CALL_DUMMY(pc, sp, frame_address) pc_in_call_dummy_after_text_end (pc, sp, frame_address) #endif +#endif extern int pc_in_call_dummy_on_stack PARAMS ((CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address)); +#if !GDB_MULTI_ARCH #if !defined (PC_IN_CALL_DUMMY) && CALL_DUMMY_LOCATION == ON_STACK #define PC_IN_CALL_DUMMY(pc, sp, frame_address) pc_in_call_dummy_on_stack (pc, sp, frame_address) #endif +#endif extern int pc_in_call_dummy_at_entry_point PARAMS ((CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address)); +#if !GDB_MULTI_ARCH #if !defined (PC_IN_CALL_DUMMY) && CALL_DUMMY_LOCATION == AT_ENTRY_POINT #define PC_IN_CALL_DUMMY(pc, sp, frame_address) pc_in_call_dummy_at_entry_point (pc, sp, frame_address) #endif +#endif /* It's often not enough for our clients to know whether the PC is merely somewhere within the call dummy. They may need to know whether the diff --git a/gdb/infrun.c b/gdb/infrun.c index a051ec1c670..339acf826b4 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -3784,6 +3784,9 @@ _initialize_infrun () build_infrun (); + register_gdbarch_swap (&stop_registers, sizeof (stop_registers), NULL); + register_gdbarch_swap (NULL, 0, build_infrun); + add_info ("signals", signals_info, "What debugger does when program gets various signals.\n\ Specify a signal as argument to print info on that signal only."); diff --git a/gdb/main.c b/gdb/main.c index 594ca9ef25d..db624b23c2c 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -48,7 +48,7 @@ int display_space; invoked on the command line with the -nw --async options. In this version, the usual command_loop is substituted by and event loop which processes UI events asynchronously. */ -int async = 0; +int async_p = 0; /* Whether this is the command line version or not */ int tui_version = 0; @@ -61,6 +61,7 @@ int dbx_commands = 0; GDB_FILE *gdb_stdout; GDB_FILE *gdb_stderr; +GDB_FILE *gdb_stdlog; /* Whether to enable writing into executable and core files */ extern int write_files; @@ -161,9 +162,11 @@ main (argc, argv) /* not yet */ gdb_stdout = stdio_fileopen (stdout); gdb_stderr = stdio_fileopen (stderr); + gdb_stdlog = gdb_stderr; /* for moment */ #else gdb_stdout = tui_fileopen (stdout); gdb_stderr = tui_fileopen (stderr); + gdb_stdlog = gdb_stdout; /* for moment */ #endif /* Parse arguments and options. */ @@ -174,7 +177,8 @@ main (argc, argv) with no equivalent). */ static struct option long_options[] = { - {"async", no_argument, &async, 1}, + {"async", no_argument, &async_p, 1}, + {"noasync", no_argument, &async_p, 0}, #if defined(TUI) {"tui", no_argument, &tui_version, 1}, #endif @@ -388,12 +392,16 @@ main (argc, argv) /* Get ready to invoke the event loop instead of the command_loop. See event-loop.h for more details.*/ - if (async) - async_hook = setup_event_loop; + if (async_p) + command_loop_hook = start_event_loop; #if defined(TUI) + /* Should this be moved to tui-top.c:_initialize_tui()? */ if (tui_version) init_ui_hook = tuiInit; #endif + + /* Initialize all files. Give the interpreter a chance to take + control of the console via the init_ui_hook()) */ gdb_init (argv[0]); /* Do these (and anything which might call wrap_here or *_filtered) @@ -617,12 +625,6 @@ main (argc, argv) #endif } - /* Call the event loop, if gdb was invoked with the --async - option. Control will never get back to this file, if the event - loop is invoked. See the files event-*.[ch] for details. */ - if (async_hook) - async_hook(); - /* The default command loop. The WIN32 Gui calls this main to set up gdb's state, and has its own command loop. */ @@ -642,7 +644,6 @@ main (argc, argv) quit_command ((char *)0, instream == stdin); } } - /* No exit -- exit is through quit_command. */ #endif @@ -660,6 +661,9 @@ print_gdb_help (stream) This is the GNU debugger. Usage:\n\n\ gdb [options] [executable-file [core-file or process-id]]\n\n\ Options:\n\n\ +", stream); + fputs_unfiltered ("\ + --[no]async Enable (disable) asynchronous version of CLI\n\ ", stream); fputs_unfiltered ("\ -b BAUDRATE Set serial port baud rate used for remote debugging.\n\ diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 365eb84e26d..d472b18b200 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -2020,11 +2020,18 @@ mips_push_arguments(nargs, args, sp, struct_return, struct_addr) } } + /* Return adjusted stack pointer. */ + return sp; +} + +CORE_ADDR +mips_push_return_address (pc, sp) + CORE_ADDR pc; + CORE_ADDR sp; +{ /* Set the return address register to point to the entry point of the program, where a breakpoint lies in wait. */ write_register (RA_REGNUM, CALL_DUMMY_ADDRESS()); - - /* Return adjusted stack pointer. */ return sp; } diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c index 795e68586b6..a0113edc892 100644 --- a/gdb/mn10300-tdep.c +++ b/gdb/mn10300-tdep.c @@ -28,14 +28,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "gdbcore.h" #include "symfile.h" -static char *mn10300_generic_register_names[] = -{ "d0", "d1", "d2", "d3", "a0", "a1", "a2", "a3", - "sp", "pc", "mdr", "psw", "lir", "lar", "", "", - "", "", "", "", "", "", "", "", - "", "", "", "", "", "", "", "fp" }; - -char **mn10300_register_names = mn10300_generic_register_names; - static CORE_ADDR mn10300_analyze_prologue PARAMS ((struct frame_info *fi, CORE_ADDR pc)); @@ -47,6 +39,60 @@ struct frame_extra_info int stack_size; }; + +static char *mn10300_generic_register_names[] = +{ "d0", "d1", "d2", "d3", "a0", "a1", "a2", "a3", + "sp", "pc", "mdr", "psw", "lir", "lar", "", "", + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "fp" }; + +static char **mn10300_register_names = mn10300_generic_register_names; + +char * +mn10300_register_name (i) + int i; +{ + return mn10300_register_names[i]; +} + +CORE_ADDR +mn10300_saved_pc_after_call (fi) + struct frame_info *fi; +{ + return read_memory_integer (read_register (SP_REGNUM), 4); +} + +void +mn10300_extract_return_value (type, regbuf, valbuf) + struct type *type; + char *regbuf; + char *valbuf; +{ + if (TYPE_CODE (type) == TYPE_CODE_PTR) + memcpy (valbuf, regbuf + REGISTER_BYTE (4), TYPE_LENGTH (type)); + else + memcpy (valbuf, regbuf + REGISTER_BYTE (0), TYPE_LENGTH (type)); +} + +CORE_ADDR +mn10300_extract_struct_value_address (regbuf) + char *regbuf; +{ + return extract_address (regbuf + REGISTER_BYTE (4), + REGISTER_RAW_SIZE (4)); +} + +void +mn10300_store_return_value (type, valbuf) + struct type *type; + char *valbuf; +{ + if (TYPE_CODE (type) == TYPE_CODE_PTR) + write_register_bytes (REGISTER_BYTE (4), valbuf, TYPE_LENGTH (type)); + else + write_register_bytes (REGISTER_BYTE (0), valbuf, TYPE_LENGTH (type)); +} + static struct frame_info *analyze_dummy_frame PARAMS ((CORE_ADDR, CORE_ADDR)); static struct frame_info * analyze_dummy_frame (pc, frame) diff --git a/gdb/parse.c b/gdb/parse.c index a18e5210e15..6f5a93e485f 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -1360,6 +1360,17 @@ _initialize_parse () build_parse (); + /* FIXME - For the moment, handle types by swapping them in and out. + Should be using the per-architecture data-pointer and a large + struct. */ + register_gdbarch_swap (&msym_text_symbol_type, sizeof (msym_text_symbol_type), NULL); + register_gdbarch_swap (&msym_data_symbol_type, sizeof (msym_data_symbol_type), NULL); + register_gdbarch_swap (&msym_unknown_symbol_type, sizeof (msym_unknown_symbol_type), NULL); + + register_gdbarch_swap (&num_std_regs, sizeof (std_regs), NULL); + register_gdbarch_swap (&std_regs, sizeof (std_regs), NULL); + register_gdbarch_swap (NULL, 0, build_parse); + add_show_from_set ( add_set_cmd ("expressiondebug", class_maintenance, var_zinteger, (char *)&expressiondebug, diff --git a/gdb/partial-stab.h b/gdb/partial-stab.h index d74c1c9ca5f..ffaaa5140c2 100644 --- a/gdb/partial-stab.h +++ b/gdb/partial-stab.h @@ -441,7 +441,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ continue; case 'T': - if (p != namestring) /* a name is there, not just :T... */ + /* When a 'T' entry is defining an anonymous enum, it + may have a name which is the empty string, or a + single space. Since they're not really defining a + symbol, those shouldn't go in the partial symbol + table. We do pick up the elements of such enums at + 'check_enum:', below. */ + if (p >= namestring + 2 + || (p == namestring + 1 + && namestring[0] != ' ')) { add_psymbol_to_list (namestring, p - namestring, STRUCT_NAMESPACE, LOC_TYPEDEF, @@ -579,10 +587,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ find_stab_function_addr (namestring, pst, objfile); textlow_not_set = 0; } -#endif -#if 0 - if (startup_file_end == 0) - startup_file_end = CUR_SYMBOL_VALUE; #endif /* End kludge. */ @@ -626,10 +630,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ find_stab_function_addr (namestring, pst, objfile); textlow_not_set = 0; } -#endif -#if 0 - if (startup_file_end == 0) - startup_file_end = CUR_SYMBOL_VALUE; #endif /* End kludge. */ /* In reordered executables this function may lie outside diff --git a/gdb/remote.c b/gdb/remote.c index 2a1a8788bdc..e1b0b1ec6c1 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -141,6 +141,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ targets. or... XAA The process terminated with signal AA. + or (obsolete) NAA;tttttttt;dddddddd;bbbbbbbb + AA = signal number + tttttttt = address of symbol "_start" + dddddddd = base of data section + bbbbbbbb = base of bss section. + Note: only used by Cisco Systems + targets. The difference between this + reply and the "qOffsets" query is that + the 'N' packet may arrive spontaneously + whereas the 'qOffsets' is a query + initiated by the host debugger. or... OXX..XX XX..XX is hex encoding of ASCII data. This can happen at any time while the program is running and the debugger @@ -213,6 +224,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Prototypes for local functions */ +static void build_remote_gdbarch_data PARAMS ((void)); + static int remote_write_bytes PARAMS ((CORE_ADDR memaddr, char *myaddr, int len)); @@ -291,6 +304,10 @@ static void init_remote_ops PARAMS ((void)); static void init_extended_remote_ops PARAMS ((void)); +static void init_remote_cisco_ops PARAMS ((void)); + +static struct target_ops remote_cisco_ops; + static void remote_stop PARAMS ((void)); static int ishex PARAMS ((int ch, int *val)); @@ -366,6 +383,10 @@ static int remote_break; starts. */ static serial_t remote_desc = NULL; +/* This is set by the target (thru the 'S' message) + to denote that the target is in kernel mode. */ +static int cisco_kernel_mode = 0; + /* This variable (available to the user via "set remotebinarydownload") dictates whether downloads are sent in binary (via the 'X' packet). We assume that the stub can, and attempt to do it. This will be cleared if @@ -451,7 +472,10 @@ record_currthread (currthread) /* If this is a new thread, add it to GDB's thread list. If we leave it up to WFI to do this, bad things will happen. */ if (!in_thread_list (currthread)) - add_thread (currthread); + { + add_thread (currthread); + printf_filtered ("[New %s]\n", target_pid_to_str (currthread)); + } } #define MAGIC_NULL_PID 42000 @@ -1264,6 +1288,35 @@ remote_find_new_threads () inferior_pid = remote_current_thread (inferior_pid); } +static void +remote_threads_info (void) +{ + char buf[PBUFSIZ], *bufp; + int tid; + + if (remote_desc == 0) /* paranoia */ + error ("Command can only be used when connected to the remote target."); + + putpkt ("qfThreadInfo"); + getpkt (bufp = buf, 0); + if (bufp[0] == '\0') /* q packet not recognized! */ + { /* try old jmetzler method */ + remote_find_new_threads (); + return; + } + else /* try new 'q' method */ + while (*bufp++ == 'm') /* reply contains one or more TID */ + { + do { + tid = strtol(bufp, &bufp, 16); + if (tid != 0 && !in_thread_list (tid)) + add_thread (tid); + } while (*bufp++ == ','); /* comma-separated list */ + putpkt ("qsThreadInfo"); + getpkt (bufp = buf, 0); + } +} + /* Restart the remote side; this is an extended protocol operation. */ @@ -1381,8 +1434,141 @@ get_offsets () objfile_relocate (symfile_objfile, offs); } +/* + * Cisco version of section offsets: + * + * Instead of having GDB query the target for the section offsets, + * Cisco lets the target volunteer the information! It's also in + * a different format, so here are the functions that will decode + * a section offset packet from a Cisco target. + */ + +/* + * Function: remote_cisco_section_offsets + * + * Returns: zero for success, non-zero for failure + */ + +static int +remote_cisco_section_offsets (text_addr, data_addr, bss_addr, + text_offs, data_offs, bss_offs) + bfd_vma text_addr; + bfd_vma data_addr; + bfd_vma bss_addr; + bfd_signed_vma * text_offs; + bfd_signed_vma * data_offs; + bfd_signed_vma * bss_offs; +{ + bfd_vma text_base, data_base, bss_base; + struct minimal_symbol *start; + asection *sect; + bfd * abfd; + int len; + char *p; + + if (symfile_objfile == NULL) + return -1; /* no can do nothin' */ + + start = lookup_minimal_symbol ("_start", NULL, NULL); + if (start == NULL) + return -1; /* Can't find "_start" symbol */ + + data_base = bss_base = 0; + text_base = SYMBOL_VALUE_ADDRESS (start); + + abfd = symfile_objfile->obfd; + for (sect = abfd->sections; + sect != 0; + sect = sect->next) + { + p = (unsigned char *) bfd_get_section_name (abfd, sect); + len = strlen (p); + if (strcmp (p + len - 4, "data") == 0) /* ends in "data" */ + if (data_base == 0 || + data_base > bfd_get_section_vma (abfd, sect)) + data_base = bfd_get_section_vma (abfd, sect); + if (strcmp (p + len - 3, "bss") == 0) /* ends in "bss" */ + if (bss_base == 0 || + bss_base > bfd_get_section_vma (abfd, sect)) + bss_base = bfd_get_section_vma (abfd, sect); + } + *text_offs = text_addr - text_base; + *data_offs = data_addr - data_base; + *bss_offs = bss_addr - bss_base; + if (remote_debug) + { + char tmp[128]; + + sprintf (tmp, "VMA: text = 0x"); + sprintf_vma (tmp + strlen (tmp), text_addr); + sprintf (tmp + strlen (tmp), " data = 0x"); + sprintf_vma (tmp + strlen (tmp), data_addr); + sprintf (tmp + strlen (tmp), " bss = 0x"); + sprintf_vma (tmp + strlen (tmp), bss_addr); + fprintf_filtered (gdb_stdlog, tmp); + fprintf_filtered (gdb_stdlog, + "Reloc offset: text = 0x%x data = 0x%x bss = 0x%x\n", + (long) *text_offs, (long) *data_offs, (long) *bss_offs); + } + + return 0; +} + +/* + * Function: remote_cisco_objfile_relocate + * + * Relocate the symbol file for a remote target. + */ + +static void +remote_cisco_objfile_relocate (text_off, data_off, bss_off) + bfd_signed_vma text_off; + bfd_signed_vma data_off; + bfd_signed_vma bss_off; +{ + struct section_offsets *offs; + + if (text_off != 0 || data_off != 0 || bss_off != 0) + { + /* 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. */ + + 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_TEXT) = text_off; + ANOFFSET (offs, SECT_OFF_DATA) = data_off; + ANOFFSET (offs, SECT_OFF_BSS) = bss_off; + + /* First call the standard objfile_relocate. */ + objfile_relocate (symfile_objfile, offs); + + /* Now we need to fix up the section entries already attached to + the exec target. These entries will control memory transfers + from the exec file. */ + + exec_set_section_offsets (text_off, data_off, bss_off); + } +} + /* Stub for catch_errors. */ +static int +remote_start_remote_dummy (dummy) + char *dummy; +{ + start_remote (); /* Initialize gdb process mechanisms */ + return 1; +} + static int remote_start_remote (dummy) PTR dummy; @@ -1402,8 +1588,7 @@ remote_start_remote (dummy) putpkt ("?"); /* initiate a query from remote machine */ immediate_quit = 0; - start_remote (); /* Initialize gdb process mechanisms */ - return 1; + return remote_start_remote_dummy (dummy); } /* Open a connection to a remote debugger. @@ -1629,7 +1814,7 @@ remote_interrupt (signo) signal (signo, remote_interrupt_twice); if (remote_debug) - printf_unfiltered ("remote_interrupt called\n"); + fprintf_unfiltered (gdb_stdlog, "remote_interrupt called\n"); target_stop (); } @@ -1653,7 +1838,7 @@ remote_stop () { /* Send a break or a ^C, depending on user preference. */ if (remote_debug) - printf_unfiltered ("remote_stop called\n"); + fprintf_unfiltered (gdb_stdlog, "remote_stop called\n"); if (remote_break) SERIAL_SEND_BREAK (remote_desc); @@ -1701,9 +1886,10 @@ remote_console_output (msg) } } -/* 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). */ +/* Wait until the remote machine stops, then return, + storing status in STATUS just as `wait' would. + Returns "pid", which in the case of a multi-threaded + remote OS, is the thread-id. */ static int remote_wait (pid, status) @@ -1808,7 +1994,72 @@ Packet: '%s'\n", status->value.sig = (enum target_signal) (((fromhex (buf[1])) << 4) + (fromhex (buf[2]))); + if (buf[3] == 'p') + { + /* Export Cisco kernel mode as a convenience variable + (so that it can be used in the GDB prompt if desired). */ + + if (cisco_kernel_mode == 1) + set_internalvar (lookup_internalvar ("cisco_kernel_mode"), + value_from_string ("PDEBUG-")); + cisco_kernel_mode = 0; + thread_num = strtol ((const char *) &buf[4], NULL, 16); + record_currthread (thread_num); + } + else if (buf[3] == 'k') + { + /* Export Cisco kernel mode as a convenience variable + (so that it can be used in the GDB prompt if desired). */ + + if (cisco_kernel_mode == 1) + set_internalvar (lookup_internalvar ("cisco_kernel_mode"), + value_from_string ("KDEBUG-")); + cisco_kernel_mode = 1; + } goto got_status; + case 'N': /* Cisco special: status and offsets */ + { + bfd_vma text_addr, data_addr, bss_addr; + bfd_signed_vma text_off, data_off, bss_off; + unsigned char *p1; + + status->kind = TARGET_WAITKIND_STOPPED; + status->value.sig = (enum target_signal) + (((fromhex (buf[1])) << 4) + (fromhex (buf[2]))); + + if (symfile_objfile == NULL) + { + warning ("Relocation packet recieved with no symbol file. \ +Packet Dropped"); + goto got_status; + } + + /* Relocate object file. Buffer format is NAATT;DD;BB + * where AA is the signal number, TT is the new text + * address, DD * is the new data address, and BB is the + * new bss address. */ + + p = &buf[3]; + text_addr = strtoul (p, (char **) &p1, 16); + if (p1 == p || *p1 != ';') + warning ("Malformed relocation packet: Packet '%s'", buf); + p = p1 + 1; + data_addr = strtoul (p, (char **) &p1, 16); + if (p1 == p || *p1 != ';') + warning ("Malformed relocation packet: Packet '%s'", buf); + p = p1 + 1; + bss_addr = strtoul (p, (char **) &p1, 16); + if (p1 == p) + warning ("Malformed relocation packet: Packet '%s'", buf); + + if (remote_cisco_section_offsets (text_addr, data_addr, bss_addr, + &text_off, &data_off, &bss_off) + == 0) + if (text_off != 0 || data_off != 0 || bss_off != 0) + remote_cisco_objfile_relocate (text_off, data_off, bss_off); + + goto got_status; + } case 'W': /* Target exited */ { /* The remote process exited. */ @@ -1851,15 +2102,6 @@ Packet: '%s'\n", got_status: if (thread_num != -1) { - /* Initial thread value can only be acquired via wait, so deal with - this marker which is used before the first thread value is - acquired. */ - if (inferior_pid == MAGIC_NULL_PID) - { - inferior_pid = thread_num; - if (!in_thread_list (inferior_pid)) - add_thread (inferior_pid); - } return thread_num; } return inferior_pid; @@ -1901,7 +2143,8 @@ remote_fetch_registers (regno) && buf[0] != 'x') /* New: unavailable register value */ { if (remote_debug) - printf_unfiltered ("Bad register packet; fetching a new packet\n"); + fprintf_unfiltered (gdb_stdlog, + "Bad register packet; fetching a new packet\n"); getpkt (buf, 0); } @@ -2138,9 +2381,11 @@ check_binary_download (addr) if (remote_debug) { if (remote_binary_download) - printf_unfiltered ("binary downloading suppported by target\n"); + fprintf_unfiltered (gdb_stdlog, + "binary downloading suppported by target\n"); else - printf_unfiltered ("binary downloading NOT suppported by target\n"); + fprintf_unfiltered (gdb_stdlog, + "binary downloading NOT suppported by target\n"); } } @@ -2566,8 +2811,8 @@ putpkt_binary (buf, cnt) if (remote_debug) { *p = '\0'; - printf_unfiltered ("Sending packet: %s...", buf2); - gdb_flush (gdb_stdout); + fprintf_unfiltered (gdb_stdlog, "Sending packet: %s...", buf2); + gdb_flush (gdb_stdlog); } if (SERIAL_WRITE (remote_desc, buf2, p - buf2)) perror_with_name ("putpkt: write failed"); @@ -2596,7 +2841,7 @@ putpkt_binary (buf, cnt) { case '+': if (remote_debug) - printf_unfiltered ("Ack\n"); + fprintf_unfiltered (gdb_stdlog, "Ack\n"); return 1; case SERIAL_TIMEOUT: tcount ++; @@ -2618,9 +2863,9 @@ putpkt_binary (buf, cnt) if (!started_error_output) { started_error_output = 1; - printf_unfiltered ("putpkt: Junk: "); + fprintf_unfiltered (gdb_stdlog, "putpkt: Junk: "); } - putchar_unfiltered (ch & 0177); + fputc_unfiltered (ch & 0177, gdb_stdlog); } continue; } @@ -2642,6 +2887,32 @@ putpkt_binary (buf, cnt) } } +static int remote_cisco_mode; + +static void remote_cisco_expand (src, dest) + char *src; + char *dest; +{ + int i; + int repeat; + + do { + if (*src == '*') + { + repeat = (fromhex (src[1]) << 4) + fromhex (src[2]); + for (i = 0; i < repeat; i++) + { + *dest++ = *(src-1); + } + src += 2; + } + else + { + *dest++ = *src; + } + } while (*src++); +} + /* 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. */ @@ -2665,11 +2936,12 @@ read_frame (buf) { case SERIAL_TIMEOUT: if (remote_debug) - puts_filtered ("Timeout in mid-packet, retrying\n"); + fputs_filtered ("Timeout in mid-packet, retrying\n", gdb_stdlog); return 0; case '$': if (remote_debug) - puts_filtered ("Saw new packet start in middle of old one\n"); + fputs_filtered ("Saw new packet start in middle of old one\n", + gdb_stdlog); return 0; /* Start a new packet, count retries */ case '#': { @@ -2681,37 +2953,49 @@ read_frame (buf) pktcsum |= fromhex (readchar (remote_timeout)); if (csum == pktcsum) - return 1; + { + if (remote_cisco_mode) /* variant run-length-encoding */ + { + char tmp_buf[PBUFSIZ]; + + remote_cisco_expand (buf, tmp_buf); + strcpy (buf, tmp_buf); + } + return 1; + } if (remote_debug) { - printf_filtered ("Bad checksum, sentsum=0x%x, csum=0x%x, buf=", - pktcsum, csum); - puts_filtered (buf); - puts_filtered ("\n"); + fprintf_filtered (gdb_stdlog, + "Bad checksum, sentsum=0x%x, csum=0x%x, buf=", + pktcsum, csum); + fputs_filtered (buf, gdb_stdlog); + fputs_filtered ("\n", gdb_stdlog); } return 0; } case '*': /* Run length encoding */ - csum += c; - c = readchar (remote_timeout); - csum += c; - c = c - ' ' + 3; /* Compute repeat count */ - - - if (c > 0 && c < 255 && bp + c - 1 < buf + PBUFSIZ - 1) + if (remote_cisco_mode == 0) /* variant run-length-encoding */ { - memset (bp, *(bp - 1), c); - bp += c; - continue; - } + csum += c; + c = readchar (remote_timeout); + csum += c; + c = c - ' ' + 3; /* Compute repeat count */ - *bp = '\0'; - printf_filtered ("Repeat count %d too large for buffer: ", c); - puts_filtered (buf); - puts_filtered ("\n"); - return 0; + if (c > 0 && c < 255 && 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; + } + /* else fall thru to treat like default */ default: if (bp < buf + PBUFSIZ - 1) { @@ -2779,7 +3063,7 @@ getpkt (buf, forever) error ("Watchdog has expired. Target detached.\n"); } if (remote_debug) - puts_filtered ("Timed out.\n"); + fputs_filtered ("Timed out.\n", gdb_stdlog); goto retry; } } @@ -2792,7 +3076,7 @@ getpkt (buf, forever) if (val == 1) { if (remote_debug) - fprintf_unfiltered (gdb_stdout, "Packet received: %s\n", buf); + fprintf_unfiltered (gdb_stdlog, "Packet received: %s\n", buf); SERIAL_WRITE (remote_desc, "+", 1); return; } @@ -3390,7 +3674,7 @@ Specify the serial device it is connected to (e.g. /dev/ttya)."; remote_ops.to_load = generic_load; remote_ops.to_mourn_inferior = remote_mourn; remote_ops.to_thread_alive = remote_thread_alive; - remote_ops.to_find_new_threads = remote_find_new_threads; + remote_ops.to_find_new_threads = remote_threads_info; remote_ops.to_stop = remote_stop; remote_ops.to_query = remote_query; remote_ops.to_stratum = process_stratum; @@ -3411,21 +3695,425 @@ init_extended_remote_ops () { extended_remote_ops = remote_ops; - extended_remote_ops.to_shortname = "extended-remote"; + extended_remote_ops.to_shortname = "extended-remote"; extended_remote_ops.to_longname = "Extended remote serial target in gdb-specific protocol"; extended_remote_ops.to_doc = "Use a remote computer via a serial line, using a gdb-specific protocol.\n\ Specify the serial device it is connected to (e.g. /dev/ttya).", - extended_remote_ops.to_open = extended_remote_open; + extended_remote_ops.to_open = extended_remote_open; extended_remote_ops.to_create_inferior = extended_remote_create_inferior; extended_remote_ops.to_mourn_inferior = extended_remote_mourn; -} +} + +/* + * Command: info remote-process + * + * This implements Cisco's version of the "info proc" command. + * + * This query allows the target stub to return an arbitrary string + * (or strings) giving arbitrary information about the target process. + * This is optional; the target stub isn't required to implement it. + * + * Syntax: qfProcessInfo request first string + * qsProcessInfo request subsequent string + * reply: 'O' + * 'l' last reply (empty) + */ + +static void +remote_info_process (args, from_tty) + char *args; + int from_tty; +{ + char buf[PBUFSIZ]; + + if (remote_desc == 0) + error ("Command can only be used when connected to the remote target."); + + putpkt ("qfProcessInfo"); + getpkt (buf, 0); + if (buf[0] == 0) + return; /* Silently: target does not support this feature. */ + + if (buf[0] == 'E') + error ("info proc: target error."); + + while (buf[0] == 'O') /* Capitol-O packet */ + { + remote_console_output (&buf[1]); + putpkt ("qsProcessInfo"); + getpkt (buf, 0); + } +} + +/* + * Target Cisco + */ + +static void +remote_cisco_open (name, from_tty) + char *name; + int from_tty; +{ + if (name == 0) + error ( +"To open a remote debug connection, you need to specify what \n\ +device is attached to the remote system (e.g. host:port)."); + + target_preopen (from_tty); + + unpush_target (&remote_cisco_ops); + + remote_dcache = dcache_init (remote_read_bytes, remote_write_bytes); + + remote_desc = SERIAL_OPEN (name); + if (!remote_desc) + perror_with_name (name); + + /* + * If a baud rate was specified on the gdb command line it will + * be greater than the initial value of -1. If it is, use it otherwise + * default to 9600 + */ + + baud_rate = (baud_rate > 0) ? baud_rate : 9600; + 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"); + } + + remote_cisco_mode = 1; + + push_target (&remote_cisco_ops); /* Switch to using cisco 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; + + general_thread = -2; + continue_thread = -2; + + /* Force remote_write_bytes to check whether target supports + binary downloading. */ + remote_binary_checked = 0; + + /* 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 = MAGIC_NULL_PID; + + /* Start the remote connection; if error (0), discard this target. */ + + if (!catch_errors (remote_start_remote_dummy, (char *) 0, + "Couldn't establish connection to remote target\n", + RETURN_MASK_ALL)) + { + pop_target (); + return; + } +} + +static void +remote_cisco_close (quitting) + int quitting; +{ + remote_cisco_mode = 0; + remote_close (quitting); +} + +static void +remote_cisco_mourn PARAMS ((void)) +{ + remote_mourn_1 (&remote_cisco_ops); +} + +enum { + READ_MORE, + FATAL_ERROR, + ENTER_DEBUG, + DISCONNECT_TELNET +} minitelnet_return; + +/* shared between readsocket() and readtty() */ +static char *tty_input; + +static int escape_count; +static int echo_check; +extern int quit_flag; + +static int +readsocket () +{ + int data; + + /* Loop until the socket doesn't have any more data */ + + while ((data = readchar (0)) >= 0) + { + /* Check for the escape sequence */ + if (data == '|') + { + /* If this is the fourth escape, get out */ + if (++escape_count == 4) + { + return ENTER_DEBUG; + } + else + { /* This is a '|', but not the fourth in a row. + Continue without echoing it. If it isn't actually + one of four in a row, it'll be echoed later. */ + continue; + } + } + else /* Not a '|' */ + { + /* Ensure any pending '|'s are flushed. */ + + for ( ; escape_count > 0; escape_count--) + putchar('|'); + } + + if (data == '\r') /* If this is a return character, */ + continue; /* - just supress it. */ + + if (echo_check != -1) /* Check for echo of user input. */ + { + if (tty_input[echo_check] == data) + { + echo_check++; /* Character matched user input: */ + continue; /* Continue without echoing it. */ + } + else if ((data == '\n') && (tty_input[echo_check] == '\r')) + { /* End of the line (and of echo checking). */ + echo_check = -1; /* No more echo supression */ + continue; /* Continue without echoing. */ + } + else + { /* Failed check for echo of user input. + We now have some suppressed output to flush! */ + int j; + + for (j = 0; j < echo_check; j++) + putchar (tty_input[j]); + echo_check = -1; + } + } + putchar (data); /* Default case: output the char. */ + } + + if (data == SERIAL_TIMEOUT) /* Timeout returned from readchar. */ + return READ_MORE; /* Try to read some more */ + else + return FATAL_ERROR; /* Trouble, bail out */ +} + +static int +readtty () +{ + int status; + int tty_bytecount; + + /* First, read a buffer full from the terminal */ + tty_bytecount = read (fileno (stdin), tty_input, sizeof (tty_input) - 1); + if (tty_bytecount == -1) + { + perror ("readtty: read failed"); + return FATAL_ERROR; + } + + /* Remove a quoted newline. */ + if (tty_input[tty_bytecount - 1] == '\n' && + tty_input[tty_bytecount - 2] == '\\') /* line ending in backslash */ + { + tty_input[--tty_bytecount] = 0; /* remove newline */ + tty_input[--tty_bytecount] = 0; /* remove backslash */ + } + + /* Turn trailing newlines into returns */ + if (tty_input[tty_bytecount - 1] == '\n') + tty_input[tty_bytecount - 1] = '\r'; + + /* If the line consists of a ~, enter debugging mode. */ + if ((tty_input[0] == '~') && (tty_bytecount == 2)) + return ENTER_DEBUG; + + /* Make this a zero terminated string and write it out */ + tty_input[tty_bytecount] = 0; + if (SERIAL_WRITE (remote_desc, tty_input, tty_bytecount)) + { + perror_with_name ("readtty: write failed"); + return FATAL_ERROR; + } + + return READ_MORE; +} + +static int +minitelnet () +{ + fd_set input; /* file descriptors for select */ + int tablesize; /* max number of FDs for select */ + int status; + int quit_count = 0; + + extern int escape_count; /* global shared by readsocket */ + extern int echo_check; /* ditto */ + + escape_count = 0; + echo_check = -1; + + tablesize = 8 * sizeof (input); + + for (;;) + { + /* Check for anything from our socket - doesn't block. Note that + this must be done *before* the select as there may be + buffered I/O waiting to be processed. */ + + if ((status = readsocket ()) == FATAL_ERROR) + { + error ("Debugging terminated by communications error"); + } + else if (status != READ_MORE) + { + return (status); + } + + fflush(stdout); /* Flush output before blocking */ + + /* Now block on more socket input or TTY input */ + + FD_ZERO (&input); + FD_SET (fileno(stdin), &input); + FD_SET (remote_desc->fd, &input); + + status = select (tablesize, &input, 0, 0, 0); + if ((status == -1) && (errno != EINTR)) + { + error ("Communications error on select %d", errno); + } + + /* Handle Control-C typed */ + + if (quit_flag) + { + if ((++quit_count) == 2) + { + if (query ("Interrupt GDB? ")) + { + printf_filtered ("Interrupted by user.\n"); + return_to_top_level (RETURN_QUIT); + } + quit_count = 0; + } + quit_flag = 0; + + if (remote_break) + SERIAL_SEND_BREAK (remote_desc); + else + SERIAL_WRITE (remote_desc, "\003", 1); + + continue; + } + + /* Handle console input */ + + if (FD_ISSET (fileno (stdin), &input)) + { + quit_count = 0; + echo_check = 0; + status = readtty (); + if (status == READ_MORE) + continue; + + return status; /* telnet session ended */ + } + } +} + +static int +remote_cisco_wait (pid, status) + int pid; + struct target_waitstatus *status; +{ + if (minitelnet() != ENTER_DEBUG) + { + error ("Debugging session terminated by protocol error"); + } + putpkt ("?"); + return remote_wait (pid, status); +} + +static void +init_remote_cisco_ops () +{ + remote_cisco_ops.to_shortname = "cisco"; + remote_cisco_ops.to_longname = "Remote serial target in cisco-specific protocol"; + remote_cisco_ops.to_doc = + "Use a remote machine via TCP, using a cisco-specific protocol.\n\ +Specify the serial device it is connected to (e.g. host:2020)."; + remote_cisco_ops.to_open = remote_cisco_open; + remote_cisco_ops.to_close = remote_cisco_close; + remote_cisco_ops.to_detach = remote_detach; + remote_cisco_ops.to_resume = remote_resume; + remote_cisco_ops.to_wait = remote_cisco_wait; + remote_cisco_ops.to_fetch_registers = remote_fetch_registers; + remote_cisco_ops.to_store_registers = remote_store_registers; + remote_cisco_ops.to_prepare_to_store = remote_prepare_to_store; + remote_cisco_ops.to_xfer_memory = remote_xfer_memory; + remote_cisco_ops.to_files_info = remote_files_info; + remote_cisco_ops.to_insert_breakpoint = remote_insert_breakpoint; + remote_cisco_ops.to_remove_breakpoint = remote_remove_breakpoint; + remote_cisco_ops.to_kill = remote_kill; + remote_cisco_ops.to_load = generic_load; + remote_cisco_ops.to_mourn_inferior = remote_cisco_mourn; + remote_cisco_ops.to_thread_alive = remote_thread_alive; + remote_cisco_ops.to_find_new_threads = remote_threads_info; + remote_cisco_ops.to_stratum = process_stratum; + remote_cisco_ops.to_has_all_memory = 1; + remote_cisco_ops.to_has_memory = 1; + remote_cisco_ops.to_has_stack = 1; + remote_cisco_ops.to_has_registers = 1; + remote_cisco_ops.to_has_execution = 1; + remote_cisco_ops.to_magic = OPS_MAGIC; +} + +static void +build_remote_gdbarch_data () +{ + tty_input = xmalloc (PBUFSIZ); +} + void _initialize_remote () { - /* runtime constants */ + /* architecture specific data */ + build_remote_gdbarch_data (); + register_gdbarch_swap (&tty_input, sizeof (&tty_input), NULL); + register_gdbarch_swap (NULL, 0, build_remote_gdbarch_data); + + /* runtime constants - we retain the value of remote_write_size + across architecture swaps. */ remote_write_size = PBUFSIZ; init_remote_ops (); @@ -3434,6 +4122,9 @@ _initialize_remote () init_extended_remote_ops (); add_target (&extended_remote_ops); + init_remote_cisco_ops (); + add_target (&remote_cisco_ops); + #if 0 init_remote_threadtests (); #endif @@ -3487,4 +4178,8 @@ in a memory packet.\n", var_boolean, (char *) &remote_binary_download, "Set binary downloads.\n", &setlist), &showlist); + + add_info ("remote-process", remote_info_process, + "Query the remote system for process info."); + } diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 1179bd18143..b5554d72c33 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -399,7 +399,7 @@ skip_prologue (pc, fdata) (op & 0xffff0000) == 0x3bde0000) { /* addi 30,30,foo@l */ continue; - } else if ((op & 0xfc000000) == 0x48000000) { /* bl foo, + } else if ((op & 0xfc000001) == 0x48000001) { /* bl foo, to save fprs??? */ fdata->frameless = 0; diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index a6fe8dcdeca..2014e7fa044 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,19 @@ +Fri Jun 11 12:56:50 1999 Andrew Cagney + + * gdb.base/call-strs.c (link_malloc): New function. Ensure that + malloc() is linked in. + +1999-06-08 Fernando Nasser + + * gdb.base/ending-run.exp: Make sure we fail and do not timeout at + step at end. + + * gdb.base/annota1.exp: Increase match_max to prevent timeout. + +1999-06-08 Jim Blandy + + * gdb.java/jv-print.exp: New file. (Our first Java test!) + Fri Jun 4 10:47:46 1999 Jeffrey A Law (law@cygnus.com) * gdb.base/a1-selftest.exp: Remove bogus hppa xfail. diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp index b2d0dd04157..4239822c659 100644 --- a/gdb/testsuite/gdb.base/annota1.exp +++ b/gdb/testsuite/gdb.base/annota1.exp @@ -269,6 +269,12 @@ gdb_expect { # test: # annotate-signal-handler-caller # +verbose "match_max local is: [match_max]" +verbose "match_max default is: [match_max -d]" +# This is necessary because a 2000 buffer is not enought to get everything +# up to the prompt ad the test gets a timeout. +match_max 3000 +verbose "match_max now is: [match_max]" send_gdb "backtrace\n" gdb_expect { -re ".*frame-begin 0 $hex.*0.*frame-end.*frame-begin 1 $hex.*1.*\032\032signal-handler-caller\r\n.signal handler called.\r\n\r\n\032\032frame-end\r\n\r\n.*frame-begin 2 $hex.*2.*frame-begin 3 $hex.*3.*frame-end.*$gdb_prompt$" \ diff --git a/gdb/testsuite/gdb.base/call-strs.c b/gdb/testsuite/gdb.base/call-strs.c index 9ba875b5d32..02870e0f603 100644 --- a/gdb/testsuite/gdb.base/call-strs.c +++ b/gdb/testsuite/gdb.base/call-strs.c @@ -43,6 +43,11 @@ char * s7; return bigbuf; } +char * +link_malloc () +{ + return (char*) malloc (1); +} main() { diff --git a/gdb/testsuite/gdb.base/ending-run.exp b/gdb/testsuite/gdb.base/ending-run.exp index a8d0f05bea6..8f102fbb43e 100644 --- a/gdb/testsuite/gdb.base/ending-run.exp +++ b/gdb/testsuite/gdb.base/ending-run.exp @@ -141,6 +141,7 @@ gdb_expect { -re ".*in.*start.*$gdb_prompt $" { pass "step out of main" } + -re ".*$gdb_prompt $" { fail "step at end 2" } timeout { fail "hang or timeout on step at end 2" } } } @@ -157,6 +158,7 @@ gdb_expect { -re ".*Program received signal SIGTRAP.*$gdb_prompt $" { pass "Cygmon stopped in ending trap." } + -re ".*$gdb_prompt $" { fail "step at end 1" } timeout { fail "hang or timeout on step at end 1" } } diff --git a/gdb/top.c b/gdb/top.c index d487193ec74..1f2a2172466 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -290,7 +290,8 @@ int epoch_interface; int xgdb_verbose; /* gdb prints this when reading a command interactively */ -static char *prompt; +static char *gdb_prompt_string; /* the global prompt string */ +extern char *get_prompt PARAMS((void)); /* access function for prompt string */ /* Buffer used for reading command lines, and the size allocated for it so far. */ @@ -652,7 +653,7 @@ read_command_file (stream) cleanups = make_cleanup ((make_cleanup_func) source_cleanup, instream); instream = stream; - command_loop (); + command_loop (); do_cleanups (cleanups); } @@ -682,10 +683,10 @@ gdb_init (argv0) not the async version is run. NOTE: in the future we plan to make the event loop be the default engine of gdb, and this difference will disappear. */ - if (async_hook) + if (async_p) async_init_signals (); else - init_signals (); + init_signals (); /* We need a default language for parsing expressions, so simple things like "set width 0" won't fail if no language is explicitly set in a config file @@ -693,6 +694,8 @@ gdb_init (argv0) set_language (language_c); expected_language = current_language; /* don't warn about the change. */ + /* All the interpreters should have had a look at things by now. + Initialize the selected interpreter. */ if (init_ui_hook) init_ui_hook (argv0); } @@ -1351,7 +1354,7 @@ command_loop () extern int insert_mode; #endif if (window_hook && instream == stdin) - (*window_hook) (instream, prompt); + (*window_hook) (instream, get_prompt ()); quit_flag = 0; if (instream == stdin && stdin_is_tty) @@ -1368,7 +1371,8 @@ command_loop () insert_mode = 0; #endif /* Get a command-line. This calls the readline package. */ - command = command_line_input (instream == stdin ? prompt : (char *) NULL, + command = command_line_input (instream == stdin ? + get_prompt () : (char *) NULL, instream == stdin, "prompt"); #if defined(TUI) insert_mode = 0; @@ -1418,2370 +1422,3 @@ command_loop () } } - -/* Commands call this if they do not want to be repeated by null lines. */ - -void -dont_repeat () -{ - if (server_command) - return; - - /* If we aren't reading from standard input, we are saving the last - thing read from stdin in line and don't want to delete it. Null lines - won't repeat here in any case. */ - if (instream == stdin) - *line = 0; -} - -/* Read a line from the stream "instream" without command line editing. - - It prints PRROMPT once at the start. - Action is compatible with "readline", e.g. space for the result is - malloc'd and should be freed by the caller. - - A NULL return means end of file. */ -char * -gdb_readline (prrompt) - char *prrompt; -{ - int c; - char *result; - int input_index = 0; - int result_size = 80; - - if (prrompt) - { - /* Don't use a _filtered function here. It causes the assumed - character position to be off, since the newline we read from - the user is not accounted for. */ - fputs_unfiltered (prrompt, gdb_stdout); -#ifdef MPW - /* Move to a new line so the entered line doesn't have a prompt - on the front of it. */ - fputs_unfiltered ("\n", gdb_stdout); -#endif /* MPW */ - gdb_flush (gdb_stdout); - } - - result = (char *) xmalloc (result_size); - - while (1) - { - /* Read from stdin if we are executing a user defined command. - This is the right thing for prompt_for_continue, at least. */ - c = fgetc (instream ? instream : stdin); - - if (c == EOF) - { - if (input_index > 0) - /* The last line does not end with a newline. Return it, and - if we are called again fgetc will still return EOF and - we'll return NULL then. */ - break; - free (result); - return NULL; - } - - if (c == '\n') -#ifndef CRLF_SOURCE_FILES - break; -#else - { - if (input_index > 0 && result[input_index - 1] == '\r') - input_index--; - break; - } -#endif - - result[input_index++] = c; - while (input_index >= result_size) - { - result_size *= 2; - result = (char *) xrealloc (result, result_size); - } - } - - result[input_index++] = '\0'; - return result; -} - -/* Variables which control command line editing and history - substitution. These variables are given default values at the end - of this file. */ -static int command_editing_p; -/* NOTE 1999-04-29: This variable will be static again, once we modify - gdb to use the event loop as the default command loop and we merge - event-top.c into this file, top.c */ -/* static */ int history_expansion_p; -static int write_history_p; -static int history_size; -static char *history_filename; - -/* readline uses the word breaks for two things: - (1) In figuring out where to point the TEXT parameter to the - rl_completion_entry_function. Since we don't use TEXT for much, - it doesn't matter a lot what the word breaks are for this purpose, but - it does affect how much stuff M-? lists. - (2) If one of the matches contains a word break character, readline - will quote it. That's why we switch between - gdb_completer_word_break_characters and - gdb_completer_command_word_break_characters. I'm not sure when - we need this behavior (perhaps for funky characters in C++ symbols?). */ - -/* Variables which are necessary for fancy command line editing. */ -char *gdb_completer_word_break_characters = - " \t\n!@#$%^&*()+=|~`}{[]\"';:?/>.<,-"; - -/* When completing on command names, we remove '-' from the list of - word break characters, since we use it in command names. If the - readline library sees one in any of the current completion strings, - it thinks that the string needs to be quoted and automatically supplies - a leading quote. */ -char *gdb_completer_command_word_break_characters = - " \t\n!@#$%^&*()+=|~`}{[]\"';:?/>.<,"; - -/* Characters that can be used to quote completion strings. Note that we - can't include '"' because the gdb C parser treats such quoted sequences - as strings. */ -char *gdb_completer_quote_characters = - "'"; - -/* Functions that are used as part of the fancy command line editing. */ - -/* This can be used for functions which don't want to complete on symbols - but don't want to complete on anything else either. */ -/* ARGSUSED */ -char ** -noop_completer (text, prefix) - char *text; - char *prefix; -{ - return NULL; -} - -/* Complete on filenames. */ -char ** -filename_completer (text, word) - char *text; - char *word; -{ - /* From readline. */ - extern char *filename_completion_function PARAMS ((char *, int)); - int subsequent_name; - char **return_val; - int return_val_used; - int return_val_alloced; - - return_val_used = 0; - /* Small for testing. */ - return_val_alloced = 1; - return_val = (char **) xmalloc (return_val_alloced * sizeof (char *)); - - subsequent_name = 0; - while (1) - { - char *p; - p = filename_completion_function (text, subsequent_name); - if (return_val_used >= return_val_alloced) - { - return_val_alloced *= 2; - return_val = - (char **) xrealloc (return_val, - return_val_alloced * sizeof (char *)); - } - if (p == NULL) - { - return_val[return_val_used++] = p; - break; - } - /* Like emacs, don't complete on old versions. Especially useful - in the "source" command. */ - if (p[strlen (p) - 1] == '~') - continue; - - { - char *q; - if (word == text) - /* Return exactly p. */ - return_val[return_val_used++] = p; - else if (word > text) - { - /* Return some portion of p. */ - q = xmalloc (strlen (p) + 5); - strcpy (q, p + (word - text)); - return_val[return_val_used++] = q; - free (p); - } - else - { - /* Return some of TEXT plus p. */ - q = xmalloc (strlen (p) + (text - word) + 5); - strncpy (q, word, text - word); - q[text - word] = '\0'; - strcat (q, p); - return_val[return_val_used++] = q; - free (p); - } - } - subsequent_name = 1; - } -#if 0 - /* There is no way to do this just long enough to affect quote inserting - without also affecting the next completion. This should be fixed in - readline. FIXME. */ - /* Insure that readline does the right thing - with respect to inserting quotes. */ - rl_completer_word_break_characters = ""; -#endif - return return_val; -} - -/* Here are some useful test cases for completion. FIXME: These should - be put in the test suite. They should be tested with both M-? and TAB. - - "show output-" "radix" - "show output" "-radix" - "p" ambiguous (commands starting with p--path, print, printf, etc.) - "p " ambiguous (all symbols) - "info t foo" no completions - "info t " no completions - "info t" ambiguous ("info target", "info terminal", etc.) - "info ajksdlfk" no completions - "info ajksdlfk " no completions - "info" " " - "info " ambiguous (all info commands) - "p \"a" no completions (string constant) - "p 'a" ambiguous (all symbols starting with a) - "p b-a" ambiguous (all symbols starting with a) - "p b-" ambiguous (all symbols) - "file Make" "file" (word break hard to screw up here) - "file ../gdb.stabs/we" "ird" (needs to not break word at slash) - */ - -/* Generate completions one by one for the completer. Each time we are - called return another potential completion to the caller. - line_completion just completes on commands or passes the buck to the - command's completer function, the stuff specific to symbol completion - is in make_symbol_completion_list. - - TEXT is the caller's idea of the "word" we are looking at. - - MATCHES is the number of matches that have currently been collected from - calling this completion function. When zero, then we need to initialize, - otherwise the initialization has already taken place and we can just - return the next potential completion string. - - LINE_BUFFER is available to be looked at; it contains the entire text - of the line. POINT is the offset in that line of the cursor. You - should pretend that the line ends at POINT. - - Returns NULL if there are no more completions, else a pointer to a string - which is a possible completion, it is the caller's responsibility to - free the string. */ - -static char * -line_completion_function (text, matches, line_buffer, point) - char *text; - int matches; - char *line_buffer; - int point; -{ - static char **list = (char **)NULL; /* Cache of completions */ - static int index; /* Next cached completion */ - char *output = NULL; - char *tmp_command, *p; - /* Pointer within tmp_command which corresponds to text. */ - char *word; - struct cmd_list_element *c, *result_list; - - if (matches == 0) - { - /* The caller is beginning to accumulate a new set of completions, so - we need to find all of them now, and cache them for returning one at - a time on future calls. */ - - if (list) - { - /* Free the storage used by LIST, but not by the strings inside. - This is because rl_complete_internal () frees the strings. */ - free ((PTR)list); - } - list = 0; - index = 0; - - /* Choose the default set of word break characters to break completions. - If we later find out that we are doing completions on command strings - (as opposed to strings supplied by the individual command completer - functions, which can be any string) then we will switch to the - special word break set for command strings, which leaves out the - '-' character used in some commands. */ - - rl_completer_word_break_characters = - gdb_completer_word_break_characters; - - /* Decide whether to complete on a list of gdb commands or on symbols. */ - tmp_command = (char *) alloca (point + 1); - p = tmp_command; - - strncpy (tmp_command, line_buffer, point); - tmp_command[point] = '\0'; - /* Since text always contains some number of characters leading up - to point, we can find the equivalent position in tmp_command - by subtracting that many characters from the end of tmp_command. */ - word = tmp_command + point - strlen (text); - - if (point == 0) - { - /* An empty line we want to consider ambiguous; that is, it - could be any command. */ - c = (struct cmd_list_element *) -1; - result_list = 0; - } - else - { - c = lookup_cmd_1 (&p, cmdlist, &result_list, 1); - } - - /* Move p up to the next interesting thing. */ - while (*p == ' ' || *p == '\t') - { - p++; - } - - if (!c) - { - /* It is an unrecognized command. So there are no - possible completions. */ - list = NULL; - } - else if (c == (struct cmd_list_element *) -1) - { - char *q; - - /* lookup_cmd_1 advances p up to the first ambiguous thing, but - doesn't advance over that thing itself. Do so now. */ - q = p; - while (*q && (isalnum (*q) || *q == '-' || *q == '_')) - ++q; - if (q != tmp_command + point) - { - /* There is something beyond the ambiguous - command, so there are no possible completions. For - example, "info t " or "info t foo" does not complete - to anything, because "info t" can be "info target" or - "info terminal". */ - list = NULL; - } - else - { - /* We're trying to complete on the command which was ambiguous. - This we can deal with. */ - if (result_list) - { - list = complete_on_cmdlist (*result_list->prefixlist, p, - word); - } - else - { - list = complete_on_cmdlist (cmdlist, p, word); - } - /* Insure that readline does the right thing with respect to - inserting quotes. */ - rl_completer_word_break_characters = - gdb_completer_command_word_break_characters; - } - } - else - { - /* We've recognized a full command. */ - - if (p == tmp_command + point) - { - /* There is no non-whitespace in the line beyond the command. */ - - if (p[-1] == ' ' || p[-1] == '\t') - { - /* The command is followed by whitespace; we need to complete - on whatever comes after command. */ - if (c->prefixlist) - { - /* It is a prefix command; what comes after it is - a subcommand (e.g. "info "). */ - list = complete_on_cmdlist (*c->prefixlist, p, word); - - /* Insure that readline does the right thing - with respect to inserting quotes. */ - rl_completer_word_break_characters = - gdb_completer_command_word_break_characters; - } - else if (c->enums) - { - list = complete_on_enum (c->enums, p, word); - rl_completer_word_break_characters = - gdb_completer_command_word_break_characters; - } - else - { - /* It is a normal command; what comes after it is - completed by the command's completer function. */ - list = (*c->completer) (p, word); - } - } - else - { - /* The command is not followed by whitespace; we need to - complete on the command itself. e.g. "p" which is a - command itself but also can complete to "print", "ptype" - etc. */ - char *q; - - /* Find the command we are completing on. */ - q = p; - while (q > tmp_command) - { - if (isalnum (q[-1]) || q[-1] == '-' || q[-1] == '_') - --q; - else - break; - } - - list = complete_on_cmdlist (result_list, q, word); - - /* Insure that readline does the right thing - with respect to inserting quotes. */ - rl_completer_word_break_characters = - gdb_completer_command_word_break_characters; - } - } - else - { - /* There is non-whitespace beyond the command. */ - - if (c->prefixlist && !c->allow_unknown) - { - /* It is an unrecognized subcommand of a prefix command, - e.g. "info adsfkdj". */ - list = NULL; - } - else if (c->enums) - { - list = complete_on_enum (c->enums, p, word); - } - else - { - /* It is a normal command. */ - list = (*c->completer) (p, word); - } - } - } - } - - /* If we found a list of potential completions during initialization then - dole them out one at a time. The vector of completions is NULL - terminated, so after returning the last one, return NULL (and continue - to do so) each time we are called after that, until a new list is - available. */ - - if (list) - { - output = list[index]; - if (output) - { - index++; - } - } - -#if 0 - /* Can't do this because readline hasn't yet checked the word breaks - for figuring out whether to insert a quote. */ - if (output == NULL) - /* Make sure the word break characters are set back to normal for the - next time that readline tries to complete something. */ - rl_completer_word_break_characters = - gdb_completer_word_break_characters; -#endif - - return (output); -} - -/* Line completion interface function for readline. */ - -static char * -readline_line_completion_function (text, matches) - char *text; - int matches; -{ - return line_completion_function (text, matches, rl_line_buffer, rl_point); -} - -/* Skip over a possibly quoted word (as defined by the quote characters - and word break characters the completer uses). Returns pointer to the - location after the "word". */ - -char * -skip_quoted (str) - char *str; -{ - char quote_char = '\0'; - char *scan; - - for (scan = str; *scan != '\0'; scan++) - { - if (quote_char != '\0') - { - /* Ignore everything until the matching close quote char */ - if (*scan == quote_char) - { - /* Found matching close quote. */ - scan++; - break; - } - } - else if (strchr (gdb_completer_quote_characters, *scan)) - { - /* Found start of a quoted string. */ - quote_char = *scan; - } - else if (strchr (gdb_completer_word_break_characters, *scan)) - { - break; - } - } - return (scan); -} - - -#ifdef STOP_SIGNAL -static void -stop_sig (signo) -int signo; -{ -#if STOP_SIGNAL == SIGTSTP - signal (SIGTSTP, SIG_DFL); - sigsetmask (0); - kill (getpid (), SIGTSTP); - signal (SIGTSTP, stop_sig); -#else - signal (STOP_SIGNAL, stop_sig); -#endif - printf_unfiltered ("%s", prompt); - gdb_flush (gdb_stdout); - - /* Forget about any previous command -- null line now will do nothing. */ - dont_repeat (); -} -#endif /* STOP_SIGNAL */ - -/* Initialize signal handlers. */ -static void -do_nothing (signo) -int signo; -{ - /* Under System V the default disposition of a signal is reinstated after - the signal is caught and delivered to an application process. On such - systems one must restore the replacement signal handler if one wishes - to continue handling the signal in one's program. On BSD systems this - is not needed but it is harmless, and it simplifies the code to just do - it unconditionally. */ - signal (signo, do_nothing); -} - -static void -init_signals () -{ - signal (SIGINT, request_quit); - - /* If SIGTRAP was set to SIG_IGN, then the SIG_IGN will get passed - to the inferior and breakpoints will be ignored. */ -#ifdef SIGTRAP - signal (SIGTRAP, SIG_DFL); -#endif - - /* If we initialize SIGQUIT to SIG_IGN, then the SIG_IGN will get - passed to the inferior, which we don't want. It would be - possible to do a "signal (SIGQUIT, SIG_DFL)" after we fork, but - on BSD4.3 systems using vfork, that can affect the - GDB process as well as the inferior (the signal handling tables - might be in memory, shared between the two). Since we establish - a handler for SIGQUIT, when we call exec it will set the signal - to SIG_DFL for us. */ - signal (SIGQUIT, do_nothing); -#ifdef SIGHUP - if (signal (SIGHUP, do_nothing) != SIG_IGN) - signal (SIGHUP, disconnect); -#endif - signal (SIGFPE, float_handler); - -#if defined(SIGWINCH) && defined(SIGWINCH_HANDLER) - signal (SIGWINCH, SIGWINCH_HANDLER); -#endif -} - -/* Read one line from the command input stream `instream' - into the local static buffer `linebuffer' (whose current length - is `linelength'). - The buffer is made bigger as necessary. - Returns the address of the start of the line. - - NULL is returned for end of file. - - *If* the instream == stdin & stdin is a terminal, the line read - is copied into the file line saver (global var char *line, - length linesize) so that it can be duplicated. - - This routine either uses fancy command line editing or - simple input as the user has requested. */ - -char * -command_line_input (prrompt, repeat, annotation_suffix) - char *prrompt; - int repeat; - char *annotation_suffix; -{ - static char *linebuffer = 0; - static unsigned linelength = 0; - register char *p; - char *p1; - char *rl; - char *local_prompt = prrompt; - char *nline; - char got_eof = 0; - - /* The annotation suffix must be non-NULL. */ - if (annotation_suffix == NULL) - annotation_suffix = ""; - - if (annotation_level > 1 && instream == stdin) - { - local_prompt = alloca ((prrompt == NULL ? 0 : strlen (prrompt)) - + strlen (annotation_suffix) + 40); - if (prrompt == NULL) - local_prompt[0] = '\0'; - else - strcpy (local_prompt, prrompt); - strcat (local_prompt, "\n\032\032"); - strcat (local_prompt, annotation_suffix); - strcat (local_prompt, "\n"); - } - - if (linebuffer == 0) - { - linelength = 80; - linebuffer = (char *) xmalloc (linelength); - } - - p = linebuffer; - - /* Control-C quits instantly if typed while in this loop - since it should not wait until the user types a newline. */ - immediate_quit++; -#ifdef STOP_SIGNAL - if (job_control) - signal (STOP_SIGNAL, stop_sig); -#endif - - while (1) - { - /* Make sure that all output has been output. Some machines may let - you get away with leaving out some of the gdb_flush, but not all. */ - wrap_here (""); - gdb_flush (gdb_stdout); - gdb_flush (gdb_stderr); - - if (source_file_name != NULL) - { - ++source_line_number; - sprintf (source_error, - "%s%s:%d: Error in sourced command file:\n", - source_pre_error, - source_file_name, - source_line_number); - error_pre_print = source_error; - } - - if (annotation_level > 1 && instream == stdin) - { - printf_unfiltered ("\n\032\032pre-"); - printf_unfiltered (annotation_suffix); - printf_unfiltered ("\n"); - } - - /* Don't use fancy stuff if not talking to stdin. */ - if (readline_hook && instream == NULL) - { - rl = (*readline_hook) (local_prompt); - } - else if (command_editing_p && instream == stdin && ISATTY (instream)) - { - rl = readline (local_prompt); - } - else - { - rl = gdb_readline (local_prompt); - } - - if (annotation_level > 1 && instream == stdin) - { - printf_unfiltered ("\n\032\032post-"); - printf_unfiltered (annotation_suffix); - printf_unfiltered ("\n"); - } - - if (!rl || rl == (char *) EOF) - { - got_eof = 1; - break; - } - if (strlen(rl) + 1 + (p - linebuffer) > linelength) - { - linelength = strlen(rl) + 1 + (p - linebuffer); - nline = (char *) xrealloc (linebuffer, linelength); - p += nline - linebuffer; - linebuffer = nline; - } - p1 = rl; - /* Copy line. Don't copy null at end. (Leaves line alone - if this was just a newline) */ - while (*p1) - *p++ = *p1++; - - free (rl); /* Allocated in readline. */ - - if (p == linebuffer || *(p - 1) != '\\') - break; - - p--; /* Put on top of '\'. */ - local_prompt = (char *) 0; - } - -#ifdef STOP_SIGNAL - if (job_control) - signal (STOP_SIGNAL, SIG_DFL); -#endif - immediate_quit--; - - if (got_eof) - return NULL; - -#define SERVER_COMMAND_LENGTH 7 - server_command = - (p - linebuffer > SERVER_COMMAND_LENGTH) - && STREQN (linebuffer, "server ", SERVER_COMMAND_LENGTH); - if (server_command) - { - /* Note that we don't set `line'. Between this and the check in - dont_repeat, this insures that repeating will still do the - right thing. */ - *p = '\0'; - return linebuffer + SERVER_COMMAND_LENGTH; - } - - /* Do history expansion if that is wished. */ - if (history_expansion_p && instream == stdin - && ISATTY (instream)) - { - char *history_value; - int expanded; - - *p = '\0'; /* Insert null now. */ - expanded = history_expand (linebuffer, &history_value); - if (expanded) - { - /* Print the changes. */ - printf_unfiltered ("%s\n", history_value); - - /* If there was an error, call this function again. */ - if (expanded < 0) - { - free (history_value); - return command_line_input (prrompt, repeat, annotation_suffix); - } - if (strlen (history_value) > linelength) - { - linelength = strlen (history_value) + 1; - linebuffer = (char *) xrealloc (linebuffer, linelength); - } - strcpy (linebuffer, history_value); - p = linebuffer + strlen(linebuffer); - free (history_value); - } - } - - /* If we just got an empty line, and that is supposed - to repeat the previous command, return the value in the - global buffer. */ - if (repeat && p == linebuffer) - return line; - for (p1 = linebuffer; *p1 == ' ' || *p1 == '\t'; p1++) ; - if (repeat && !*p1) - return line; - - *p = 0; - - /* Add line to history if appropriate. */ - if (instream == stdin - && ISATTY (stdin) && *linebuffer) - add_history (linebuffer); - - /* Note: lines consisting solely of comments are added to the command - history. This is useful when you type a command, and then - realize you don't want to execute it quite yet. You can comment - out the command and then later fetch it from the value history - and remove the '#'. The kill ring is probably better, but some - people are in the habit of commenting things out. */ - if (*p1 == '#') - *p1 = '\0'; /* Found a comment. */ - - /* Save into global buffer if appropriate. */ - if (repeat) - { - if (linelength > linesize) - { - line = xrealloc (line, linelength); - linesize = linelength; - } - strcpy (line, linebuffer); - return line; - } - - return linebuffer; -} - - -/* Expand the body_list of COMMAND so that it can hold NEW_LENGTH - code bodies. This is typically used when we encounter an "else" - clause for an "if" command. */ - -static void -realloc_body_list (command, new_length) - struct command_line *command; - int new_length; -{ - int n; - struct command_line **body_list; - - n = command->body_count; - - /* Nothing to do? */ - if (new_length <= n) - return; - - body_list = (struct command_line **) - xmalloc (sizeof (struct command_line *) * new_length); - - memcpy (body_list, command->body_list, sizeof (struct command_line *) * n); - - free (command->body_list); - command->body_list = body_list; - command->body_count = new_length; -} - -/* Read one line from the input stream. If the command is an "else" or - "end", return such an indication to the caller. */ - -static enum misc_command_type -read_next_line (command) - struct command_line **command; -{ - char *p, *p1, *prompt_ptr, control_prompt[256]; - int i = 0; - - if (control_level >= 254) - error ("Control nesting too deep!\n"); - - /* Set a prompt based on the nesting of the control commands. */ - if (instream == stdin || (instream == 0 && readline_hook != NULL)) - { - for (i = 0; i < control_level; i++) - control_prompt[i] = ' '; - control_prompt[i] = '>'; - control_prompt[i+1] = '\0'; - prompt_ptr = (char *)&control_prompt[0]; - } - else - prompt_ptr = NULL; - - p = command_line_input (prompt_ptr, instream == stdin, "commands"); - - /* Not sure what to do here. */ - if (p == NULL) - return end_command; - - /* Strip leading and trailing whitespace. */ - while (*p == ' ' || *p == '\t') - p++; - - p1 = p + strlen (p); - while (p1 != p && (p1[-1] == ' ' || p1[-1] == '\t')) - p1--; - - /* Blanks and comments don't really do anything, but we need to - distinguish them from else, end and other commands which can be - executed. */ - if (p1 == p || p[0] == '#') - return nop_command; - - /* Is this the end of a simple, while, or if control structure? */ - if (p1 - p == 3 && !strncmp (p, "end", 3)) - return end_command; - - /* Is the else clause of an if control structure? */ - if (p1 - p == 4 && !strncmp (p, "else", 4)) - return else_command; - - /* Check for while, if, break, continue, etc and build a new command - line structure for them. */ - if (p1 - p > 5 && !strncmp (p, "while", 5)) - *command = build_command_line (while_control, p + 6); - else if (p1 - p > 2 && !strncmp (p, "if", 2)) - *command = build_command_line (if_control, p + 3); - else if (p1 - p == 10 && !strncmp (p, "loop_break", 10)) - { - *command = (struct command_line *) - xmalloc (sizeof (struct command_line)); - (*command)->next = NULL; - (*command)->line = NULL; - (*command)->control_type = break_control; - (*command)->body_count = 0; - (*command)->body_list = NULL; - } - else if (p1 - p == 13 && !strncmp (p, "loop_continue", 13)) - { - *command = (struct command_line *) - xmalloc (sizeof (struct command_line)); - (*command)->next = NULL; - (*command)->line = NULL; - (*command)->control_type = continue_control; - (*command)->body_count = 0; - (*command)->body_list = NULL; - } - else - { - /* A normal command. */ - *command = (struct command_line *) - xmalloc (sizeof (struct command_line)); - (*command)->next = NULL; - (*command)->line = savestring (p, p1 - p); - (*command)->control_type = simple_control; - (*command)->body_count = 0; - (*command)->body_list = NULL; - } - - /* Nothing special. */ - return ok_command; -} - -/* Recursively read in the control structures and create a command_line - structure from them. - - The parent_control parameter is the control structure in which the - following commands are nested. */ - -static enum command_control_type -recurse_read_control_structure (current_cmd) - struct command_line *current_cmd; -{ - int current_body, i; - enum misc_command_type val; - enum command_control_type ret; - struct command_line **body_ptr, *child_tail, *next; - - child_tail = NULL; - current_body = 1; - - /* Sanity checks. */ - if (current_cmd->control_type == simple_control) - { - error ("Recursed on a simple control type\n"); - return invalid_control; - } - - if (current_body > current_cmd->body_count) - { - error ("Allocated body is smaller than this command type needs\n"); - return invalid_control; - } - - /* Read lines from the input stream and build control structures. */ - while (1) - { - dont_repeat (); - - next = NULL; - val = read_next_line (&next); - - /* Just skip blanks and comments. */ - if (val == nop_command) - continue; - - if (val == end_command) - { - if (current_cmd->control_type == while_control - || current_cmd->control_type == if_control) - { - /* Success reading an entire control structure. */ - ret = simple_control; - break; - } - else - { - ret = invalid_control; - break; - } - } - - /* Not the end of a control structure. */ - if (val == else_command) - { - if (current_cmd->control_type == if_control - && current_body == 1) - { - realloc_body_list (current_cmd, 2); - current_body = 2; - child_tail = NULL; - continue; - } - else - { - ret = invalid_control; - break; - } - } - - if (child_tail) - { - child_tail->next = next; - } - else - { - body_ptr = current_cmd->body_list; - for (i = 1; i < current_body; i++) - body_ptr++; - - *body_ptr = next; - - } - - child_tail = next; - - /* If the latest line is another control structure, then recurse - on it. */ - if (next->control_type == while_control - || next->control_type == if_control) - { - control_level++; - ret = recurse_read_control_structure (next); - control_level--; - - if (ret != simple_control) - break; - } - } - - dont_repeat (); - - return ret; -} - -/* Read lines from the input stream and accumulate them in a chain of - struct command_line's, which is then returned. For input from a - terminal, the special command "end" is used to mark the end of the - input, and is not included in the returned chain of commands. */ - -#define END_MESSAGE "End with a line saying just \"end\"." - -struct command_line * -read_command_lines (prompt, from_tty) -char *prompt; -int from_tty; -{ - struct command_line *head, *tail, *next; - struct cleanup *old_chain; - enum command_control_type ret; - enum misc_command_type val; - - control_level = 0; - if (readline_begin_hook) - { - /* Note - intentional to merge messages with no newline */ - (*readline_begin_hook) ("%s %s\n", prompt, END_MESSAGE); - } - else if (from_tty && input_from_terminal_p ()) - { - printf_unfiltered ("%s\n%s\n", prompt, END_MESSAGE); - gdb_flush (gdb_stdout); - } - - head = tail = NULL; - old_chain = NULL; - - while (1) - { - val = read_next_line (&next); - - /* Ignore blank lines or comments. */ - if (val == nop_command) - continue; - - if (val == end_command) - { - ret = simple_control; - break; - } - - if (val != ok_command) - { - ret = invalid_control; - break; - } - - if (next->control_type == while_control - || next->control_type == if_control) - { - control_level++; - ret = recurse_read_control_structure (next); - control_level--; - - if (ret == invalid_control) - break; - } - - if (tail) - { - tail->next = next; - } - else - { - head = next; - old_chain = make_cleanup ((make_cleanup_func) free_command_lines, - &head); - } - tail = next; - } - - dont_repeat (); - - if (head) - { - if (ret != invalid_control) - { - discard_cleanups (old_chain); - } - else - do_cleanups (old_chain); - } - - if (readline_end_hook) - { - (*readline_end_hook) (); - } - return (head); -} - -/* Free a chain of struct command_line's. */ - -void -free_command_lines (lptr) - struct command_line **lptr; -{ - register struct command_line *l = *lptr; - register struct command_line *next; - struct command_line **blist; - int i; - - while (l) - { - if (l->body_count > 0) - { - blist = l->body_list; - for (i = 0; i < l->body_count; i++, blist++) - free_command_lines (blist); - } - next = l->next; - free (l->line); - free ((PTR)l); - l = next; - } -} - -/* Add an element to the list of info subcommands. */ - -void -add_info (name, fun, doc) - char *name; - void (*fun) PARAMS ((char *, int)); - char *doc; -{ - add_cmd (name, no_class, fun, doc, &infolist); -} - -/* Add an alias to the list of info subcommands. */ - -void -add_info_alias (name, oldname, abbrev_flag) - char *name; - char *oldname; - int abbrev_flag; -{ - add_alias_cmd (name, oldname, 0, abbrev_flag, &infolist); -} - -/* The "info" command is defined as a prefix, with allow_unknown = 0. - Therefore, its own definition is called only for "info" with no args. */ - -/* ARGSUSED */ -static void -info_command (arg, from_tty) - char *arg; - int from_tty; -{ - printf_unfiltered ("\"info\" must be followed by the name of an info command.\n"); - help_list (infolist, "info ", -1, gdb_stdout); -} - -/* The "complete" command is used by Emacs to implement completion. */ - -/* ARGSUSED */ -static void -complete_command (arg, from_tty) - char *arg; - int from_tty; -{ - int i; - int argpoint; - char *completion; - - dont_repeat (); - - if (arg == NULL) - arg = ""; - argpoint = strlen (arg); - - for (completion = line_completion_function (arg, i = 0, arg, argpoint); - completion; - completion = line_completion_function (arg, ++i, arg, argpoint)) - { - printf_unfiltered ("%s\n", completion); - free (completion); - } -} - -/* The "show" command with no arguments shows all the settings. */ - -/* ARGSUSED */ -static void -show_command (arg, from_tty) - char *arg; - int from_tty; -{ - cmd_show_list (showlist, from_tty, ""); -} - -/* Add an element to the list of commands. */ - -void -add_com (name, class, fun, doc) - char *name; - enum command_class class; - void (*fun) PARAMS ((char *, int)); - char *doc; -{ - add_cmd (name, class, fun, doc, &cmdlist); -} - -/* Add an alias or abbreviation command to the list of commands. */ - -void -add_com_alias (name, oldname, class, abbrev_flag) - char *name; - char *oldname; - enum command_class class; - int abbrev_flag; -{ - add_alias_cmd (name, oldname, class, abbrev_flag, &cmdlist); -} - -void -error_no_arg (why) - char *why; -{ - error ("Argument required (%s).", why); -} - -/* ARGSUSED */ -static void -help_command (command, from_tty) - char *command; - int from_tty; /* Ignored */ -{ - help_cmd (command, gdb_stdout); -} - -static void -validate_comname (comname) - char *comname; -{ - register char *p; - - if (comname == 0) - error_no_arg ("name of command to define"); - - p = comname; - while (*p) - { - if (!isalnum(*p) && *p != '-' && *p != '_') - error ("Junk in argument list: \"%s\"", p); - p++; - } -} - -/* This is just a placeholder in the command data structures. */ -static void -user_defined_command (ignore, from_tty) - char *ignore; - int from_tty; -{ -} - -static void -define_command (comname, from_tty) - char *comname; - int from_tty; -{ - register struct command_line *cmds; - register struct cmd_list_element *c, *newc, *hookc = 0; - char *tem = comname; - char tmpbuf[128]; -#define HOOK_STRING "hook-" -#define HOOK_LEN 5 - - validate_comname (comname); - - /* Look it up, and verify that we got an exact match. */ - c = lookup_cmd (&tem, cmdlist, "", -1, 1); - if (c && !STREQ (comname, c->name)) - c = 0; - - if (c) - { - if (c->class == class_user || c->class == class_alias) - tem = "Redefine command \"%s\"? "; - else - tem = "Really redefine built-in command \"%s\"? "; - if (!query (tem, c->name)) - error ("Command \"%s\" not redefined.", c->name); - } - - /* If this new command is a hook, then mark the command which it - is hooking. Note that we allow hooking `help' commands, so that - we can hook the `stop' pseudo-command. */ - - if (!strncmp (comname, HOOK_STRING, HOOK_LEN)) - { - /* Look up cmd it hooks, and verify that we got an exact match. */ - tem = comname+HOOK_LEN; - hookc = lookup_cmd (&tem, cmdlist, "", -1, 0); - if (hookc && !STREQ (comname+HOOK_LEN, hookc->name)) - hookc = 0; - if (!hookc) - { - warning ("Your new `%s' command does not hook any existing command.", - comname); - if (!query ("Proceed? ")) - error ("Not confirmed."); - } - } - - comname = savestring (comname, strlen (comname)); - - /* If the rest of the commands will be case insensitive, this one - should behave in the same manner. */ - for (tem = comname; *tem; tem++) - if (isupper(*tem)) *tem = tolower(*tem); - - sprintf (tmpbuf, "Type commands for definition of \"%s\".", comname); - cmds = read_command_lines (tmpbuf, from_tty); - - if (c && c->class == class_user) - free_command_lines (&c->user_commands); - - newc = add_cmd (comname, class_user, user_defined_command, - (c && c->class == class_user) - ? c->doc : savestring ("User-defined.", 13), &cmdlist); - newc->user_commands = cmds; - - /* If this new command is a hook, then mark both commands as being - tied. */ - if (hookc) - { - hookc->hook = newc; /* Target gets hooked. */ - newc->hookee = hookc; /* We are marked as hooking target cmd. */ - } -} - -static void -document_command (comname, from_tty) - char *comname; - int from_tty; -{ - struct command_line *doclines; - register struct cmd_list_element *c; - char *tem = comname; - char tmpbuf[128]; - - validate_comname (comname); - - c = lookup_cmd (&tem, cmdlist, "", 0, 1); - - if (c->class != class_user) - error ("Command \"%s\" is built-in.", comname); - - sprintf (tmpbuf, "Type documentation for \"%s\".", comname); - doclines = read_command_lines (tmpbuf, from_tty); - - if (c->doc) free (c->doc); - - { - register struct command_line *cl1; - register int len = 0; - - for (cl1 = doclines; cl1; cl1 = cl1->next) - len += strlen (cl1->line) + 1; - - c->doc = (char *) xmalloc (len + 1); - *c->doc = 0; - - for (cl1 = doclines; cl1; cl1 = cl1->next) - { - strcat (c->doc, cl1->line); - if (cl1->next) - strcat (c->doc, "\n"); - } - } - - free_command_lines (&doclines); -} - -/* Print the GDB banner. */ -void -print_gdb_version (stream) - GDB_FILE *stream; -{ - /* From GNU coding standards, first line is meant to be easy for a - program to parse, and is just canonical program name and version - number, which starts after last space. */ - - fprintf_filtered (stream, "GNU gdb %s\n", version); - - /* Second line is a copyright notice. */ - - fprintf_filtered (stream, "Copyright 1998 Free Software Foundation, Inc.\n"); - - /* Following the copyright is a brief statement that the program is - free software, that users are free to copy and change it on - certain conditions, that it is covered by the GNU GPL, and that - there is no warranty. */ - - fprintf_filtered (stream, "\ -GDB is free software, covered by the GNU General Public License, and you are\n\ -welcome to change it and/or distribute copies of it under certain conditions.\n\ -Type \"show copying\" to see the conditions.\n\ -There is absolutely no warranty for GDB. Type \"show warranty\" for details.\n"); - - /* After the required info we print the configuration information. */ - - fprintf_filtered (stream, "This GDB was configured as \""); - if (!STREQ (host_name, target_name)) - { - fprintf_filtered (stream, "--host=%s --target=%s", host_name, target_name); - } - else - { - fprintf_filtered (stream, "%s", host_name); - } - fprintf_filtered (stream, "\"."); -} - -/* ARGSUSED */ -static void -show_version (args, from_tty) - char *args; - int from_tty; -{ - immediate_quit++; - print_gdb_version (gdb_stdout); - printf_filtered ("\n"); - immediate_quit--; -} - -/* xgdb calls this to reprint the usual GDB prompt. Obsolete now that xgdb - is obsolete. */ - -void -print_prompt () -{ - printf_unfiltered ("%s", prompt); - gdb_flush (gdb_stdout); -} - -/* This replaces the above for the frontends: it returns a pointer - to the prompt. */ -char * -get_prompt () -{ - return prompt; -} - -void -set_prompt (s) - char *s; -{ -/* ??rehrauer: I don't know why this fails, since it looks as though - assignments to prompt are wrapped in calls to savestring... - if (prompt != NULL) - free (prompt); -*/ - prompt = savestring (s, strlen (s)); -} - - -/* If necessary, make the user confirm that we should quit. Return - non-zero if we should quit, zero if we shouldn't. */ - -int -quit_confirm () -{ - if (inferior_pid != 0 && target_has_execution) - { - char *s; - - /* This is something of a hack. But there's no reliable way to - see if a GUI is running. The `use_windows' variable doesn't - cut it. */ - if (init_ui_hook) - s = "A debugging session is active.\nDo you still want to close the debugger?"; - else if (attach_flag) - s = "The program is running. Quit anyway (and detach it)? "; - else - s = "The program is running. Exit anyway? "; - - if (! query (s)) - return 0; - } - - return 1; -} - -/* Quit without asking for confirmation. */ - -void -quit_force (args, from_tty) - char *args; - int from_tty; -{ - int exit_code = 0; - - /* An optional expression may be used to cause gdb to terminate with the - value of that expression. */ - if (args) - { - value_ptr val = parse_and_eval (args); - - exit_code = (int) value_as_long (val); - } - - if (inferior_pid != 0 && target_has_execution) - { - if (attach_flag) - target_detach (args, from_tty); - else - target_kill (); - } - - /* UDI wants this, to kill the TIP. */ - target_close (1); - - /* Save the history information if it is appropriate to do so. */ - if (write_history_p && history_filename) - write_history (history_filename); - - do_final_cleanups(ALL_CLEANUPS); /* Do any final cleanups before exiting */ - -#if defined(TUI) - /* tuiDo((TuiOpaqueFuncPtr)tuiCleanUp); */ - /* The above does not need to be inside a tuiDo(), since - * it is not manipulating the curses screen, but rather, - * it is tearing it down. - */ - if (tui_version) - tuiCleanUp(); -#endif - - exit (exit_code); -} - -/* Handle the quit command. */ - -void -quit_command (args, from_tty) - char *args; - int from_tty; -{ - if (! quit_confirm ()) - error ("Not confirmed."); - quit_force (args, from_tty); -} - -/* Returns whether GDB is running on a terminal and whether the user - desires that questions be asked of them on that terminal. */ - -int -input_from_terminal_p () -{ - return gdb_has_a_terminal () && (instream == stdin) & caution; -} - -/* ARGSUSED */ -static void -pwd_command (args, from_tty) - char *args; - int from_tty; -{ - if (args) error ("The \"pwd\" command does not take an argument: %s", args); - getcwd (gdb_dirbuf, sizeof (gdb_dirbuf)); - - if (!STREQ (gdb_dirbuf, current_directory)) - printf_unfiltered ("Working directory %s\n (canonically %s).\n", - current_directory, gdb_dirbuf); - else - printf_unfiltered ("Working directory %s.\n", current_directory); -} - -void -cd_command (dir, from_tty) - char *dir; - int from_tty; -{ - int len; - /* Found something other than leading repetitions of "/..". */ - int found_real_path; - char *p; - - /* If the new directory is absolute, repeat is a no-op; if relative, - repeat might be useful but is more likely to be a mistake. */ - dont_repeat (); - - if (dir == 0) - error_no_arg ("new working directory"); - - dir = tilde_expand (dir); - make_cleanup (free, dir); - - if (chdir (dir) < 0) - perror_with_name (dir); - - len = strlen (dir); - dir = savestring (dir, len - (len > 1 && SLASH_P(dir[len-1]))); - if (ROOTED_P(dir)) - current_directory = dir; - else - { - if (SLASH_P (current_directory[0]) && current_directory[1] == '\0') - current_directory = concat (current_directory, dir, NULL); - else - current_directory = concat (current_directory, SLASH_STRING, dir, NULL); - free (dir); - } - - /* Now simplify any occurrences of `.' and `..' in the pathname. */ - - found_real_path = 0; - for (p = current_directory; *p;) - { - if (SLASH_P (p[0]) && p[1] == '.' && (p[2] == 0 || SLASH_P (p[2]))) - strcpy (p, p + 2); - else if (SLASH_P (p[0]) && p[1] == '.' && p[2] == '.' - && (p[3] == 0 || SLASH_P (p[3]))) - { - if (found_real_path) - { - /* Search backwards for the directory just before the "/.." - and obliterate it and the "/..". */ - char *q = p; - while (q != current_directory && ! SLASH_P (q[-1])) - --q; - - if (q == current_directory) - /* current_directory is - a relative pathname ("can't happen"--leave it alone). */ - ++p; - else - { - strcpy (q - 1, p + 3); - p = q - 1; - } - } - else - /* We are dealing with leading repetitions of "/..", for example - "/../..", which is the Mach super-root. */ - p += 3; - } - else - { - found_real_path = 1; - ++p; - } - } - - forget_cached_source_info (); - - if (from_tty) - pwd_command ((char *) 0, 1); -} - -struct source_cleanup_lines_args { - int old_line; - char *old_file; - char *old_pre_error; - char *old_error_pre_print; -}; - -static void -source_cleanup_lines (args) - PTR args; -{ - struct source_cleanup_lines_args *p = - (struct source_cleanup_lines_args *)args; - source_line_number = p->old_line; - source_file_name = p->old_file; - source_pre_error = p->old_pre_error; - error_pre_print = p->old_error_pre_print; -} - -/* ARGSUSED */ -void -source_command (args, from_tty) - char *args; - int from_tty; -{ - FILE *stream; - struct cleanup *old_cleanups; - char *file = args; - struct source_cleanup_lines_args old_lines; - int needed_length; - - if (file == NULL) - { - error ("source command requires pathname of file to source."); - } - - file = tilde_expand (file); - old_cleanups = make_cleanup (free, file); - - stream = fopen (file, FOPEN_RT); - if (!stream) - { - if (from_tty) - perror_with_name (file); - else - return; - } - - make_cleanup ((make_cleanup_func) fclose, stream); - - old_lines.old_line = source_line_number; - old_lines.old_file = source_file_name; - old_lines.old_pre_error = source_pre_error; - old_lines.old_error_pre_print = error_pre_print; - make_cleanup (source_cleanup_lines, &old_lines); - source_line_number = 0; - source_file_name = file; - source_pre_error = error_pre_print == NULL ? "" : error_pre_print; - source_pre_error = savestring (source_pre_error, strlen (source_pre_error)); - make_cleanup (free, source_pre_error); - /* This will get set every time we read a line. So it won't stay "" for - long. */ - error_pre_print = ""; - - needed_length = strlen (source_file_name) + strlen (source_pre_error) + 80; - if (source_error_allocated < needed_length) - { - source_error_allocated *= 2; - if (source_error_allocated < needed_length) - source_error_allocated = needed_length; - if (source_error == NULL) - source_error = xmalloc (source_error_allocated); - else - source_error = xrealloc (source_error, source_error_allocated); - } - - read_command_file (stream); - - do_cleanups (old_cleanups); -} - -/* ARGSUSED */ -static void -echo_command (text, from_tty) - char *text; - int from_tty; -{ - char *p = text; - register int c; - - if (text) - while ((c = *p++) != '\0') - { - if (c == '\\') - { - /* \ at end of argument is used after spaces - so they won't be lost. */ - if (*p == 0) - return; - - c = parse_escape (&p); - if (c >= 0) - printf_filtered ("%c", c); - } - else - printf_filtered ("%c", c); - } - - /* Force this output to appear now. */ - wrap_here (""); - gdb_flush (gdb_stdout); -} - -/* ARGSUSED */ -static void -dont_repeat_command (ignored, from_tty) - char *ignored; - int from_tty; -{ - *line = 0; /* Can't call dont_repeat here because we're not - necessarily reading from stdin. */ -} - -/* Functions to manipulate command line editing control variables. */ - -/* Number of commands to print in each call to show_commands. */ -#define Hist_print 10 -static void -show_commands (args, from_tty) - char *args; - int from_tty; -{ - /* Index for history commands. Relative to history_base. */ - int offset; - - /* Number of the history entry which we are planning to display next. - Relative to history_base. */ - static int num = 0; - - /* The first command in the history which doesn't exist (i.e. one more - than the number of the last command). Relative to history_base. */ - int hist_len; - - extern HIST_ENTRY *history_get PARAMS ((int)); - - /* Print out some of the commands from the command history. */ - /* First determine the length of the history list. */ - hist_len = history_size; - for (offset = 0; offset < history_size; offset++) - { - if (!history_get (history_base + offset)) - { - hist_len = offset; - break; - } - } - - if (args) - { - if (args[0] == '+' && args[1] == '\0') - /* "info editing +" should print from the stored position. */ - ; - else - /* "info editing " should print around command number . */ - num = (parse_and_eval_address (args) - history_base) - Hist_print / 2; - } - /* "show commands" means print the last Hist_print commands. */ - else - { - num = hist_len - Hist_print; - } - - if (num < 0) - num = 0; - - /* If there are at least Hist_print commands, we want to display the last - Hist_print rather than, say, the last 6. */ - if (hist_len - num < Hist_print) - { - num = hist_len - Hist_print; - if (num < 0) - num = 0; - } - - for (offset = num; offset < num + Hist_print && offset < hist_len; offset++) - { - printf_filtered ("%5d %s\n", history_base + offset, - (history_get (history_base + offset))->line); - } - - /* The next command we want to display is the next one that we haven't - displayed yet. */ - num += Hist_print; - - /* If the user repeats this command with return, it should do what - "show commands +" does. This is unnecessary if arg is null, - because "show commands +" is not useful after "show commands". */ - if (from_tty && args) - { - args[0] = '+'; - args[1] = '\0'; - } -} - -/* Called by do_setshow_command. */ -/* ARGSUSED */ -static void -set_history_size_command (args, from_tty, c) - char *args; - int from_tty; - struct cmd_list_element *c; -{ - if (history_size == INT_MAX) - unstifle_history (); - else if (history_size >= 0) - stifle_history (history_size); - else - { - history_size = INT_MAX; - error ("History size must be non-negative"); - } -} - -/* ARGSUSED */ -static void -set_history (args, from_tty) - char *args; - int from_tty; -{ - printf_unfiltered ("\"set history\" must be followed by the name of a history subcommand.\n"); - help_list (sethistlist, "set history ", -1, gdb_stdout); -} - -/* ARGSUSED */ -static void -show_history (args, from_tty) - char *args; - int from_tty; -{ - cmd_show_list (showhistlist, from_tty, ""); -} - -int info_verbose = 0; /* Default verbose msgs off */ - -/* Called by do_setshow_command. An elaborate joke. */ -/* ARGSUSED */ -static void -set_verbose (args, from_tty, c) - char *args; - int from_tty; - struct cmd_list_element *c; -{ - char *cmdname = "verbose"; - struct cmd_list_element *showcmd; - - showcmd = lookup_cmd_1 (&cmdname, showlist, NULL, 1); - - if (info_verbose) - { - c->doc = "Set verbose printing of informational messages."; - showcmd->doc = "Show verbose printing of informational messages."; - } - else - { - c->doc = "Set verbosity."; - showcmd->doc = "Show verbosity."; - } -} - -static void -float_handler (signo) -int signo; -{ - /* This message is based on ANSI C, section 4.7. Note that integer - divide by zero causes this, so "float" is a misnomer. */ - signal (SIGFPE, float_handler); - error ("Erroneous arithmetic operation."); -} - - -static void -init_cmd_lists () -{ - cmdlist = NULL; - infolist = NULL; - enablelist = NULL; - disablelist = NULL; - togglelist = NULL; - stoplist = NULL; - deletelist = NULL; - enablebreaklist = NULL; - setlist = NULL; - unsetlist = NULL; - showlist = NULL; - sethistlist = NULL; - showhistlist = NULL; - unsethistlist = NULL; - maintenancelist = NULL; - maintenanceinfolist = NULL; - maintenanceprintlist = NULL; - setprintlist = NULL; - showprintlist = NULL; - setchecklist = NULL; - showchecklist = NULL; -} - -/* Init the history buffer. Note that we are called after the init file(s) - * have been read so that the user can change the history file via his - * .gdbinit file (for instance). The GDBHISTFILE environment variable - * overrides all of this. - */ - -void -init_history() -{ - char *tmpenv; - - tmpenv = getenv ("HISTSIZE"); - if (tmpenv) - history_size = atoi (tmpenv); - else if (!history_size) - history_size = 256; - - stifle_history (history_size); - - tmpenv = getenv ("GDBHISTFILE"); - if (tmpenv) - history_filename = savestring (tmpenv, strlen(tmpenv)); - else if (!history_filename) { - /* We include the current directory so that if the user changes - directories the file written will be the same as the one - that was read. */ - history_filename = concat (current_directory, "/.gdb_history", NULL); - } - read_history (history_filename); -} - -static void -init_main () -{ - struct cmd_list_element *c; - - /* from event-top.c */ - extern int async_command_editing_p; - extern struct prompts the_prompts; - extern char *async_annotation_suffix; - extern char *new_async_prompt; - - /* If we are running the asynchronous version, - we initialize the prompts differently. */ - if (!async_hook) - { -#ifdef DEFAULT_PROMPT - prompt = savestring (DEFAULT_PROMPT, strlen(DEFAULT_PROMPT)); -#else - prompt = savestring ("(gdb) ", 6); -#endif - } - else - { - /* initialize the prompt stack to a simple "(gdb) " prompt or to - whatever the DEFULAT_PROMPT is. */ - the_prompts.top = 0; - PREFIX(0) = ""; -#ifdef DEFAULT_PROMPT - PROMPT(0) = savestring (DEFAULT_PROMPT, strlen(DEFAULT_PROMPT)); -#else - PROMPT(0) = savestring ("(gdb) ", 6); -#endif - SUFFIX(0) = ""; - /* Set things up for annotation_level > 1, if the user ever decides - to use it. */ - async_annotation_suffix = "prompt"; - /* Set the variable associated with the setshow prompt command. */ - new_async_prompt = savestring (PROMPT (0), strlen (PROMPT (0))); - } - - /* Set the important stuff up for command editing. */ - command_editing_p = 1; - async_command_editing_p = 1; - history_expansion_p = 0; - write_history_p = 0; - - /* Setup important stuff for command line editing. */ - rl_completion_entry_function = (int (*)()) readline_line_completion_function; - rl_completer_word_break_characters = gdb_completer_word_break_characters; - rl_completer_quote_characters = gdb_completer_quote_characters; - rl_readline_name = "gdb"; - - /* Define the classes of commands. - They will appear in the help list in the reverse of this order. */ - - add_cmd ("internals", class_maintenance, NO_FUNCTION, - "Maintenance commands.\n\ -Some gdb commands are provided just for use by gdb maintainers.\n\ -These commands are subject to frequent change, and may not be as\n\ -well documented as user commands.", - &cmdlist); - add_cmd ("obscure", class_obscure, NO_FUNCTION, "Obscure features.", &cmdlist); - add_cmd ("aliases", class_alias, NO_FUNCTION, "Aliases of other commands.", &cmdlist); - add_cmd ("user-defined", class_user, NO_FUNCTION, "User-defined commands.\n\ -The commands in this class are those defined by the user.\n\ -Use the \"define\" command to define a command.", &cmdlist); - add_cmd ("support", class_support, NO_FUNCTION, "Support facilities.", &cmdlist); - if (!dbx_commands) - add_cmd ("status", class_info, NO_FUNCTION, "Status inquiries.", &cmdlist); - add_cmd ("files", class_files, NO_FUNCTION, "Specifying and examining files.", &cmdlist); - add_cmd ("breakpoints", class_breakpoint, NO_FUNCTION, "Making program stop at certain points.", &cmdlist); - add_cmd ("data", class_vars, NO_FUNCTION, "Examining data.", &cmdlist); - add_cmd ("stack", class_stack, NO_FUNCTION, "Examining the stack.\n\ -The stack is made up of stack frames. Gdb assigns numbers to stack frames\n\ -counting from zero for the innermost (currently executing) frame.\n\n\ -At any time gdb identifies one frame as the \"selected\" frame.\n\ -Variable lookups are done with respect to the selected frame.\n\ -When the program being debugged stops, gdb selects the innermost frame.\n\ -The commands below can be used to select other frames by number or address.", - &cmdlist); - add_cmd ("running", class_run, NO_FUNCTION, "Running the program.", &cmdlist); - - add_com ("pwd", class_files, pwd_command, - "Print working directory. This is used for your program as well."); - c = add_cmd ("cd", class_files, cd_command, - "Set working directory to DIR for debugger and program being debugged.\n\ -The change does not take effect for the program being debugged\n\ -until the next time it is started.", &cmdlist); - c->completer = filename_completer; - - /* The set prompt command is different depending whether or not the - async version is run. NOTE: this difference is going to - disappear as we make the event loop be the default engine of - gdb. */ - if (!async_hook) - { - add_show_from_set - (add_set_cmd ("prompt", class_support, var_string, (char *)&prompt, - "Set gdb's prompt", - &setlist), - &showlist); - } - else - { - c = add_set_cmd ("prompt", class_support, var_string, - (char *)&new_async_prompt, - "Set gdb's prompt", - &setlist); - add_show_from_set (c, &showlist); - c->function.sfunc = set_async_prompt; - } - - add_com ("echo", class_support, echo_command, - "Print a constant string. Give string as argument.\n\ -C escape sequences may be used in the argument.\n\ -No newline is added at the end of the argument;\n\ -use \"\\n\" if you want a newline to be printed.\n\ -Since leading and trailing whitespace are ignored in command arguments,\n\ -if you want to print some you must use \"\\\" before leading whitespace\n\ -to be printed or after trailing whitespace."); - add_com ("document", class_support, document_command, - "Document a user-defined command.\n\ -Give command name as argument. Give documentation on following lines.\n\ -End with a line of just \"end\"."); - add_com ("define", class_support, define_command, - "Define a new command name. Command name is argument.\n\ -Definition appears on following lines, one command per line.\n\ -End with a line of just \"end\".\n\ -Use the \"document\" command to give documentation for the new command.\n\ -Commands defined in this way may have up to ten arguments."); - -#ifdef __STDC__ - c = add_cmd ("source", class_support, source_command, - "Read commands from a file named FILE.\n\ -Note that the file \"" GDBINIT_FILENAME "\" is read automatically in this way\n\ -when gdb is started.", &cmdlist); -#else - /* Punt file name, we can't help it easily. */ - c = add_cmd ("source", class_support, source_command, - "Read commands from a file named FILE.\n\ -Note that the file \".gdbinit\" is read automatically in this way\n\ -when gdb is started.", &cmdlist); -#endif - c->completer = filename_completer; - - add_com ("quit", class_support, quit_command, "Exit gdb."); - add_com ("help", class_support, help_command, "Print list of commands."); - add_com_alias ("q", "quit", class_support, 1); - add_com_alias ("h", "help", class_support, 1); - - add_com ("dont-repeat", class_support, dont_repeat_command, "Don't repeat this command.\n\ -Primarily used inside of user-defined commands that should not be repeated when\n\ -hitting return."); - - c = add_set_cmd ("verbose", class_support, var_boolean, (char *)&info_verbose, - "Set ", - &setlist), - add_show_from_set (c, &showlist); - c->function.sfunc = set_verbose; - set_verbose (NULL, 0, c); - - /* The set editing command is different depending whether or not the - async version is run. NOTE: this difference is going to disappear - as we make the event loop be the default engine of gdb. */ - if (!async_hook) - { - add_show_from_set - (add_set_cmd ("editing", class_support, var_boolean, (char *)&command_editing_p, - "Set editing of command lines as they are typed.\n\ -Use \"on\" to enable the editing, and \"off\" to disable it.\n\ -Without an argument, command line editing is enabled. To edit, use\n\ -EMACS-like or VI-like commands like control-P or ESC.", &setlist), - &showlist); - } - else - { - c = add_set_cmd ("editing", class_support, var_boolean, (char *)&async_command_editing_p, - "Set editing of command lines as they are typed.\n\ -Use \"on\" to enable the editing, and \"off\" to disable it.\n\ -Without an argument, command line editing is enabled. To edit, use\n\ -EMACS-like or VI-like commands like control-P or ESC.", &setlist); - - add_show_from_set (c, &showlist); - c->function.sfunc = set_async_editing_command; - } - - add_prefix_cmd ("history", class_support, set_history, - "Generic command for setting command history parameters.", - &sethistlist, "set history ", 0, &setlist); - add_prefix_cmd ("history", class_support, show_history, - "Generic command for showing command history parameters.", - &showhistlist, "show history ", 0, &showlist); - - add_show_from_set - (add_set_cmd ("expansion", no_class, var_boolean, (char *)&history_expansion_p, - "Set history expansion on command input.\n\ -Without an argument, history expansion is enabled.", &sethistlist), - &showhistlist); - - add_show_from_set - (add_set_cmd ("save", no_class, var_boolean, (char *)&write_history_p, - "Set saving of the history record on exit.\n\ -Use \"on\" to enable the saving, and \"off\" to disable it.\n\ -Without an argument, saving is enabled.", &sethistlist), - &showhistlist); - - c = add_set_cmd ("size", no_class, var_integer, (char *)&history_size, - "Set the size of the command history, \n\ -ie. the number of previous commands to keep a record of.", &sethistlist); - add_show_from_set (c, &showhistlist); - c->function.sfunc = set_history_size_command; - - add_show_from_set - (add_set_cmd ("filename", no_class, var_filename, (char *)&history_filename, - "Set the filename in which to record the command history\n\ - (the list of previous commands of which a record is kept).", &sethistlist), - &showhistlist); - - add_show_from_set - (add_set_cmd ("confirm", class_support, var_boolean, - (char *)&caution, - "Set whether to confirm potentially dangerous operations.", - &setlist), - &showlist); - - add_prefix_cmd ("info", class_info, info_command, - "Generic command for showing things about the program being debugged.", - &infolist, "info ", 0, &cmdlist); - add_com_alias ("i", "info", class_info, 1); - - add_com ("complete", class_obscure, complete_command, - "List the completions for the rest of the line as a command."); - - add_prefix_cmd ("show", class_info, show_command, - "Generic command for showing things about the debugger.", - &showlist, "show ", 0, &cmdlist); - /* Another way to get at the same thing. */ - add_info ("set", show_command, "Show all GDB settings."); - - add_cmd ("commands", no_class, show_commands, - "Show the history of commands you typed.\n\ -You can supply a command number to start with, or a `+' to start after\n\ -the previous command number shown.", - &showlist); - - add_cmd ("version", no_class, show_version, - "Show what version of GDB this is.", &showlist); - - add_com ("while", class_support, while_command, -"Execute nested commands WHILE the conditional expression is non zero.\n\ -The conditional expression must follow the word `while' and must in turn be\n\ -followed by a new line. The nested commands must be entered one per line,\n\ -and should be terminated by the word `end'."); - - add_com ("if", class_support, if_command, -"Execute nested commands once IF the conditional expression is non zero.\n\ -The conditional expression must follow the word `if' and must in turn be\n\ -followed by a new line. The nested commands must be entered one per line,\n\ -and should be terminated by the word 'else' or `end'. If an else clause\n\ -is used, the same rules apply to its nested commands as to the first ones."); - - /* If target is open when baud changes, it doesn't take effect until the - next open (I think, not sure). */ - add_show_from_set (add_set_cmd ("remotebaud", no_class, - var_zinteger, (char *)&baud_rate, - "Set baud rate for remote serial I/O.\n\ -This value is used to set the speed of the serial port when debugging\n\ -using remote targets.", &setlist), - &showlist); - - add_show_from_set ( - add_set_cmd ("remotedebug", no_class, var_zinteger, (char *)&remote_debug, - "Set debugging of remote protocol.\n\ -When enabled, each packet sent or received with the remote target\n\ -is displayed.", &setlist), - &showlist); - - add_show_from_set ( - add_set_cmd ("remotetimeout", no_class, var_integer, (char *)&remote_timeout, - "Set timeout limit to wait for target to respond.\n\ -This value is used to set the time limit for gdb to wait for a response\n\ -from the target.", &setlist), - &showlist); - - /* The set annotate command is different depending whether or not - the async version is run. NOTE: this difference is going to - disappear as we make the event loop be the default engine of - gdb. */ - if (!async_hook) - { - c = add_set_cmd ("annotate", class_obscure, var_zinteger, - (char *)&annotation_level, "Set annotation_level.\n\ -0 == normal; 1 == fullname (for use when running under emacs)\n\ -2 == output annotated suitably for use by programs that control GDB.", - &setlist); - c = add_show_from_set (c, &showlist); - } - else - { - c = add_set_cmd ("annotate", class_obscure, var_zinteger, - (char *)&annotation_level, "Set annotation_level.\n\ -0 == normal; 1 == fullname (for use when running under emacs)\n\ -2 == output annotated suitably for use by programs that control GDB.", - &setlist); - add_show_from_set (c, &showlist); - c->function.sfunc = set_async_annotation_level; - } -} diff --git a/gdb/top.h b/gdb/top.h index 57e15b9cd88..65085d93a1d 100644 --- a/gdb/top.h +++ b/gdb/top.h @@ -67,6 +67,9 @@ extern void command_loop PARAMS ((void)); extern int quit_confirm PARAMS ((void)); extern void quit_force PARAMS ((char *, int)); extern void quit_command PARAMS ((char *, int)); +extern void command_loop_marker PARAMS ((int)); +extern int quit_cover PARAMS ((PTR)); +extern void execute_command PARAMS ((char *, int)); /* This function returns a pointer to the string that is used by gdb for its command prompt. */ @@ -83,3 +86,12 @@ extern int readnow_symbol_files; /* Perform _initialize initialization */ extern void gdb_init PARAMS ((char *)); + +/* For use by event-top.c */ +/* Variables from top.c. */ +extern int source_line_number; +extern char *source_file_name; +extern char *source_error; +extern char *source_pre_error; +extern int history_expansion_p; +extern int server_command; diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 4c27d5153b9..1eb39d1549c 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -835,7 +835,12 @@ read_actions (t) immediate_quit++; #ifdef STOP_SIGNAL if (job_control) - signal (STOP_SIGNAL, stop_sig); + { + if (async_p) + signal (STOP_SIGNAL, handle_stop_sig); + else + signal (STOP_SIGNAL, stop_sig); + } #endif old_chain = make_cleanup ((make_cleanup_func) free_actions, (void *) t); while (1) diff --git a/gdb/utils.c b/gdb/utils.c index b9b0a9ec36e..c2c12dd9de0 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -717,7 +717,6 @@ void notice_quit() #endif /* !defined(__GO32__) && !defined(_MSC_VER) */ /* Control C comes here */ - void request_quit (signo) int signo; @@ -735,7 +734,6 @@ request_quit (signo) quit (); #endif } - /* Memory management stuff (malloc friends). */ @@ -1444,7 +1442,12 @@ prompt_for_continue () while (*p == ' ' || *p == '\t') ++p; if (p[0] == 'q') - request_quit (SIGINT); + { + if (!async_p) + request_quit (SIGINT); + else + async_request_quit (0); + } free (ignore); } immediate_quit--; @@ -1633,6 +1636,8 @@ stdio_fileopen (file) static gdb_file_flush_ftype tui_file_flush; extern gdb_file_fputs_ftype tui_file_fputs; static gdb_file_isatty_ftype tui_file_isatty; +static gdb_file_rewind_ftype tui_file_rewind; +static gdb_file_put_ftype tui_file_put; static gdb_file_delete_ftype tui_file_delete; static struct gdb_file *tui_file_new PARAMS ((void)); static int tui_file_magic; @@ -1646,6 +1651,8 @@ tui_file_new () set_gdb_file_flush (file, tui_file_flush); set_gdb_file_fputs (file, tui_file_fputs); set_gdb_file_isatty (file, tui_file_isatty); + set_gdb_file_rewind (file, tui_file_rewind); + set_gdb_file_put (file, tui_file_put); tui->ts_magic = &tui_file_magic; return file; } @@ -1690,6 +1697,30 @@ tui_file_isatty (file) else return 0; } +static void +tui_file_rewind (file) + struct gdb_file *file; +{ + struct tui_stream *stream = gdb_file_data (file); + if (stream->ts_magic != &tui_file_magic) + error ("Internal error: bad magic number"); + stream->ts_strbuf[0] = '\0'; +} + +static void +tui_file_put (file, dest) + struct gdb_file *file; + struct gdb_file *dest; +{ + struct tui_stream *stream = gdb_file_data (file); + if (stream->ts_magic != &tui_file_magic) + error ("Internal error: bad magic number"); + if (stream->ts_streamtype == astring) + { + fputs_unfiltered (stream->ts_strbuf, dest); + } +} + GDB_FILE * gdb_file_init_astring (n) int n; @@ -1806,6 +1837,8 @@ static gdb_file_isatty_ftype null_file_isatty; static gdb_file_fputs_ftype null_file_fputs; static gdb_file_flush_ftype null_file_flush; static gdb_file_delete_ftype null_file_delete; +static gdb_file_rewind_ftype null_file_rewind; +static gdb_file_put_ftype null_file_put; struct gdb_file { @@ -1813,6 +1846,8 @@ struct gdb_file gdb_file_fputs_ftype *to_fputs; gdb_file_delete_ftype *to_delete; gdb_file_isatty_ftype *to_isatty; + gdb_file_rewind_ftype *to_rewind; + gdb_file_put_ftype *to_put; void *to_data; }; @@ -1824,6 +1859,8 @@ gdb_file_new () set_gdb_file_flush (file, null_file_flush); set_gdb_file_fputs (file, null_file_fputs); set_gdb_file_isatty (file, null_file_isatty); + set_gdb_file_rewind (file, null_file_rewind); + set_gdb_file_put (file, null_file_put); return file; } @@ -1842,6 +1879,21 @@ null_file_isatty (file) return 0; } +static void +null_file_rewind (file) + struct gdb_file *file; +{ + return; +} + +static void +null_file_put (file, src) + struct gdb_file *file; + struct gdb_file *src; +{ + return; +} + static void null_file_flush (file) struct gdb_file *file; @@ -1885,6 +1937,21 @@ gdb_file_isatty (file) return file->to_isatty (file); } +void +gdb_file_rewind (file) + struct gdb_file *file; +{ + return file->to_rewind (file); +} + +void +gdb_file_put (file, dest) + struct gdb_file *file; + struct gdb_file *dest; +{ + return file->to_put (file, dest); +} + void fputs_unfiltered (buf, file) const char *buf; @@ -1909,6 +1976,22 @@ set_gdb_file_isatty (file, isatty) file->to_isatty = isatty; } +void +set_gdb_file_rewind (file, rewind) + struct gdb_file *file; + gdb_file_rewind_ftype *rewind; +{ + file->to_rewind = rewind; +} + +void +set_gdb_file_put (file, put) + struct gdb_file *file; + gdb_file_put_ftype *put; +{ + file->to_put = put; +} + void set_gdb_file_fputs (file, fputs) struct gdb_file *file; diff --git a/gdb/value.h b/gdb/value.h index 35db8beb357..9dcfac20d2f 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -276,6 +276,8 @@ extern value_ptr value_from_longest PARAMS ((struct type *type, LONGEST num)); extern value_ptr value_from_double PARAMS ((struct type *type, DOUBLEST num)); +extern value_ptr value_from_string PARAMS ((char *string)); + extern value_ptr value_at PARAMS ((struct type *type, CORE_ADDR addr, asection *sect)); extern value_ptr value_at_lazy PARAMS ((struct type *type, CORE_ADDR addr, asection *sect)); diff --git a/gdb/values.c b/gdb/values.c index 68e04441d0b..b3cc82f447a 100644 --- a/gdb/values.c +++ b/gdb/values.c @@ -1454,6 +1454,32 @@ value_from_longest (type, num) return val; } +/* Create a value for a string constant to be stored locally + (not in the inferior's memory space, but in GDB memory). + This is analogous to value_from_longest, which also does not + use inferior memory. String shall NOT contain embedded nulls. */ + +value_ptr +value_from_string (ptr) + char *ptr; +{ + value_ptr val; + int len = strlen (ptr); + int lowbound = current_language->string_lower_bound; + struct type *rangetype = + create_range_type ((struct type *) NULL, + builtin_type_int, + lowbound, len + lowbound - 1); + struct type *stringtype = + create_array_type ((struct type *) NULL, + *current_language->string_char_type, + rangetype); + + val = allocate_value (stringtype); + memcpy (VALUE_CONTENTS_RAW (val), ptr, len); + return val; +} + value_ptr value_from_double (type, num) struct type *type; -- 2.30.2