From: Michael Snyder Date: Thu, 29 Oct 1998 18:07:01 +0000 (+0000) Subject: Thu Oct 29 10:04:20 1998 Michael Snyder X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2e7eeba99de6891ada5f4b4661ecb4a9b1084038;p=binutils-gdb.git Thu Oct 29 10:04:20 1998 Michael Snyder [Support for trace debugging: registers that were not collected.] * remote.c (remote_fetch_registers): accept 'xxxx' in the register packet, with the meaning "register value is not available". Set register_valid to -1, which will connote "no value available". * findvar.c (read_relative_register_raw_bytes): return failure if register_valid == -1. (value_of_register): return failure if register_valid == -1. (read_var_value): return error if value_of_register fails for a register variable. (value_from_register): return failure if register_valid == -1. * eval.c (evaluate_subexp_standard): return error if value_of_register fails for a register used in an expression. * infcmd.c (do_registers_info): display "value not available" for registers for which register_valid == -1. * tracepoint.c (set_raw_tracepoint): just save the filename as is from the symbol table, rather than trying to prepend the dir name. Also save the bfd section. (tracepoints_info): use the section when looking up the function name. * tracepoint.h: add section field to tracepoint struct. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 22a8a15e5da..1b010f1c462 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,25 @@ +Thu Oct 29 10:04:20 1998 Michael Snyder + + [Support for trace debugging: registers that were not collected.] + * remote.c (remote_fetch_registers): accept 'xxxx' in the register + packet, with the meaning "register value is not available". + Set register_valid to -1, which will connote "no value available". + * findvar.c (read_relative_register_raw_bytes): return failure if + register_valid == -1. (value_of_register): return failure if + register_valid == -1. (read_var_value): return error if + value_of_register fails for a register variable. + (value_from_register): return failure if register_valid == -1. + * eval.c (evaluate_subexp_standard): return error if + value_of_register fails for a register used in an expression. + * infcmd.c (do_registers_info): display "value not available" + for registers for which register_valid == -1. + + * tracepoint.c (set_raw_tracepoint): just save the filename as is + from the symbol table, rather than trying to prepend the dir name. + Also save the bfd section. (tracepoints_info): use the section + when looking up the function name. + * tracepoint.h: add section field to tracepoint struct. + start-sanitize-sky Wed Oct 28 12:33:52 EST 1998 Frank Ch. Eigler @@ -131,7 +153,7 @@ Tue Oct 13 18:56:51 1998 Felix Lee * configure.in (gdb_cv_proc_service_is_old): new test. * acconfig.h (PROC_SERVICE_IS_OLD): new define. * configure, config.in: regenerate. - + 1998-10-13 Jason Molenda (jsm@bugshack.cygnus.com) * blockframe.c (find_pc_sect_partial_function): Add braces to avoid @@ -143,7 +165,7 @@ Tue Oct 13 18:56:51 1998 Felix Lee * gnu-regex.c: Define _REGEX_RE_COMP only if it isn't already defined. * gnu-regex.h: Define _REGEX_RE_COMP to pick up old compatability prototypes. - + * symtab.h: Add prototype for _initialize_source. * value.h: Add prototype for _initialize_value. @@ -152,7 +174,7 @@ Tue Oct 13 18:56:51 1998 Felix Lee a prototype for this function. (mfree): Add prototypes for mmalloc, mrealloc, mfree if we aren't using mmalloc. - + * ax-gdb.c breakpoint.c coffread.c corelow.c dbxread.c dwarf2read.c dwarfread.c elfread.c eval.c exec.c gdbtk-cmds.c gdbtk.c infcmd.c infrun.c mipsread.c nlmread.c os9kread.c parse.c printcmd.c symfile.c @@ -218,10 +240,10 @@ start-sanitize-cygnus sets gdb_target + gdb_target_cpu to carp. XXX - this is tempoary. end-sanitize-cygnus * configure: Re-generate. - + * Makefile.in (DEPFILES): Add TARGET_OBS. (TARGET_OBS): Defined by configure. - + start-sanitize-cygnus * config/carp/carp.mt, config/carp/tm-carp.h: Pseudo configuration for carp target. XXX - this is tempoary. @@ -270,15 +292,15 @@ Fri Oct 2 19:42:31 1998 Stu Grossman to allow handling of wchar_t/Unicode strings. Fix c_printstr to handle wide characters. Supply width argument to LA_PRINT_STRING and val_print_string. - + * jv-lang.c (java_object_type dynamics_objfile java_link_class_type get_dynamics_objfile get_java_object_type) jv-lang.h (get_java_object_type): Make lots of things static. - + * expprint.c (dump_prefix_expression dump_subexp): Move opcode name printing to common routine (op_name). * (dump_subexp): Add support for OP_SCOPE. - + Fri Oct 2 16:25:54 1998 Stan Shebs * configure.host (i[3456]86-*-windows): Remove, no longer used. @@ -343,8 +365,8 @@ Thu Oct 1 20:52:39 1998 Andrew Cagney start with "com", not "/dev/tty". (Unix_OpenSerial): Do not use O_NONBLOCK on cygwin32. - * rdi-share/devsw.c (DevSW_Close): Free the device's state (SwitcherState) - so that the device may be reopened. + * rdi-share/devsw.c (DevSW_Close): Free the device's state + (SwitcherState) so that the device may be reopened. * remote-rdi.c (mywritec): Send all output through gdb's *_unfiltered functions, ignoring non-ASCII chars, so that non-tty UI's can snarf @@ -391,7 +413,7 @@ Wed Sep 23 18:21:03 1998 Andrew Cagney REMOTE_ADDRESS_SIZE variable. * NEWS: Update. - + Wed Sep 23 18:08:52 1998 Andrew Cagney * remote.c (_initialize_remote, packet_command, print_packet): @@ -401,7 +423,7 @@ Wed Sep 23 12:32:54 1998 * remote.c (packet_command): Test REMOTE_DESC to determine if remote connection is open. - + Tue Sep 22 22:27:24 1998 Mark Alexander Patch from Dawn Perchik : @@ -419,7 +441,7 @@ Mon Sep 21 19:29:32 1998 Stu Grossman * jv-lang.c (java_printchar): Fix output of chars > 0xff. Fold java_emit_char into java_printchar. * language.h (PRINT_LITERAL_FORM): Reformat for readability. - + Mon Sep 21 14:38:03 1998 Catherine Moore * config/arm/tm-arm.h (*_BREAKPOINT): Define both little endian @@ -464,7 +486,7 @@ Tue Sep 15 15:24:16 1998 Stu Grossman when using xrealloc(). Fix pointer arithmetic problem when clearing memory. This and the previous patch prevent random SEGV's when there are lots of live range symbols. - + Tue Sep 15 14:02:01 1998 Nick Clifton * remote-rdi.c: Prevent multiple attempts to close the remote @@ -496,7 +518,7 @@ Fri Sep 11 12:38:34 EDT 1998 Zdenek Radouch (radouch@cygnus.com) Thu Sep 10 20:51:23 1998 Michael Snyder * mn10300-tdep.c (mn10300_analyze_prologue): guard against NULL. - + Wed Sep 9 19:37:36 1998 Stan Shebs * dbxread.c (IGNORE_SYMBOL): Remove definition, is never used. @@ -516,7 +538,7 @@ start-sanitize-sky * tm-txvu.h: add COP0 registers * mips-tdep.c: use NUM_CORE_REGS end-sanitize-sky - + 1998-09-08 Jason Molenda (jsm@bugshack.cygnus.com) * breakpoint.c (bpstat_stop_status): Declare a bp match if the @@ -625,7 +647,7 @@ Wed Aug 19 03:07:53 1998 Richard Henderson * stack.c: Define new hook, selected_frame_level_changed_hook, which will be called whenever the selected stack level changes. (select_frame): Call the selected_frame_level_changed_hook. - + Tue Aug 18 18:03:42 1998 Stan Shebs * remote-rdi.c (arm_rdi_open): Pass serial device name to @@ -685,8 +707,8 @@ Wed Aug 12 16:30:01 1998 Frank Ch. Eigler Wed Aug 12 09:00:26 1998 Stu Grossman - * expprint.c (dump_prefix/postfix_expression): Don't try to print type - expressions. + * expprint.c (dump_prefix/postfix_expression): Don't try to print + type expressions. Tue Aug 11 11:33:25 1998 Stu Grossman @@ -699,7 +721,7 @@ Tue Aug 11 11:33:25 1998 Stu Grossman with indentation and better formatting and interpretation. * parse.c (parse_exp_1): Put calls to dump expressions under ifdef MAINTENANCE_CMDS and expressiondebug variable. - + Thu Aug 6 13:20:02 1998 Ron Unrau * infrun.c (wait_for_inferior): use stop_func_name instead of @@ -710,7 +732,7 @@ Thu Aug 6 13:15:05 1998 Ron Unrau * txvu-tdep.c: add VU0/1 control registers * config/mips/tm-txvu.h: ditto - + Tue Aug 4 11:02:50 1998 Ron Unrau * txvu-tdep.c (txvu_insert_breakpoint): make sure CPU context is @@ -844,7 +866,7 @@ end-sanitize-sky * source.c (print_source_lines): Print "No such file or directory" just once. (directory_command): same as above; resets if user issues dir. - + Sun Jul 19 02:11:45 1998 Martin M. Hunt * symtab.c (decode_line_2): Instead of printing a prompt @@ -878,7 +900,7 @@ Wed Jul 15 11:51:33 1998 Keith Seitz * Makefile.in: Add target for v850ice.o. * configure.tgt: Add cygwin32 dependencies for v850 ice. - + Wed Jul 15 10:58:29 1998 Nick Clifton * tracepoint.c (set_raw_tracepoint): Cope with symbols that do not @@ -1018,7 +1040,7 @@ Wed Jun 17 15:50:00 1998 Ron Unrau (runrau@cygnus.com) * parse.c (target_map_name_to_register): Check target specific aliases *first* so that it can over-ride architectural names - + Wed Jun 17 17:13:38 1998 Said Ziouani (saidz@park-street.cygnus.com) * remote-sds.c (sds_start_remote): Fix printf call. @@ -1043,7 +1065,7 @@ Sun Jun 14 08:46:25 1998 Ron Unrau (runrau@cygnus.com) Sat Jun 13 13:02:32 1998 Dawn Perchik (dawn@cygnus.com) - * remote.c : Fix remote help string to match that of help.exp. + * remote.c: Fix remote help string to match that of help.exp. Fri Jun 12 14:22:55 1998 Jason Molenda (crash@bugshack.cygnus.com) @@ -1060,8 +1082,8 @@ Thu Jun 11 15:05:10 1998 Jason Molenda (crash@bugshack.cygnus.com) Wed Jun 10 15:39:14 1998 Stu Grossman - * c-exp.y: Fix problems with parsing "'foo.bar'::func". Some languages - allow symbols with dots. + * c-exp.y: Fix problems with parsing "'foo.bar'::func". + Some languages allow symbols with dots. * gdbtypes.c (check_stub_method): Cosmetic. Use more descriptive names for parameters. @@ -1075,8 +1097,8 @@ end-sanitize-java * language.c language.h (set_language): Now returns previous language. * symtab.c (find_methods): Make static. Cosmetic changes, including - indentation, and adding descriptive comments. Move local variable defs - into the block they are used in. + indentation, and adding descriptive comments. Move local variable + defs into the block they are used in. * Don't call check_stub_method any more. Use gdb_mangle_name to generate the full method name. find_method doesn't need all the other goobldegook that check_stub_method does. @@ -1088,7 +1110,7 @@ start-sanitize-java end-sanitize-java * (decode_line_1): Move local variable defs into the block they are used in. (Improves code readability.) - + Wed Jun 10 18:04:35 1998 Frank Ch. Eigler * gdbtypes.c (get_discrete_bounds): Assign unsigned type flag for @@ -1408,12 +1430,12 @@ Mon May 18 13:04:27 1998 Michael Snyder (tdump_command): check to see if we're connected to a trace- capable target (currently only "remote") before doing anything else. - + Sat May 16 22:21:48 1998 Frank Ch. Eigler * config/d30v/tm-d30v.h (INIT_FRAME_PC_FIRST): Fill in PC into frame struct before extracting saved register offsets. - + Fri May 15 22:47:45 1998 Michael Snyder * tracepoint.c (encode_actions): fix typo in printf format string. @@ -1432,10 +1454,10 @@ Fri May 15 22:47:45 1998 Michael Snyder * ax-gdb.c (gen_conversion): Reworked to avoid some unnecessary sign extension. - + * ax-gdb.c (gen_usual_arithmetic): Renamed from gen_usual_binary, to match the ANSI C standard better. Callers changed. - + * ax-gdb.c (gen_traced_pop): Add prototyped declaration. Fri May 15 18:18:38 1998 David Taylor @@ -1523,7 +1545,7 @@ Tue May 12 13:17:35 1998 Frank Ch. Eigler (gen_expr): Factor out common code in binary arithmetic operators. Add support for `%'. (gen_mul, gen_div): Removed. - + Thu May 7 14:49:38 1998 Bob Manson * config/sparc/tm-sp64.h (CALL_DUMMY): Store and retrieve @@ -1583,8 +1605,8 @@ Mon May 4 07:08:25 1998 Michael Snyder Sat May 2 09:35:07 1998 Stu Grossman - * ocd.h: Add new flags, function codes, and processor types to support - new Wiggler capabilities. + * ocd.h: Add new flags, function codes, and processor types to + support new Wiggler capabilities. * (ocd_write_bytes_size): New function to allow atomic writes of memory in sizes larger than a byte. @@ -1699,7 +1721,7 @@ Tue Apr 28 17:41:20 1998 Philippe De Muyter Tue Apr 28 11:08:25 1998 John Metzler * rom68k-rom.c (_initialize_rom68k): Fix unresolved init_rom_68kcmds. - + Mon Apr 27 14:32:21 1998 Mark Alexander * config/sparc/tm-sparc.h (CALL_DUMMY): Shorten it drastically, @@ -1776,7 +1798,7 @@ Thu Apr 23 12:52:21 1998 Philippe De Muyter * acconfig.h (NEED_DECLARATION_STRERROR): New define slot. * gdb_string.h (strerror): Function declaration issued if NEED_DECLARATION_STRERROR. - * configure, config.in : Files regenerated. + * configure, config.in: Files regenerated. Thu Apr 23 12:27:43 1998 Philippe De Muyter @@ -1895,7 +1917,7 @@ Mon Apr 20 14:12:30 1998 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) Sat Apr 18 15:21:04 1998 Stan Cox * configure.tgt: Added sparc86x support. - + Thu Apr 16 13:13:24 1998 Jason Molenda (crash@bugshack.cygnus.com) * rdi-share/etherdrv.c (EthernetWrite): Use strerror to get @@ -1995,7 +2017,7 @@ Fri Apr 10 10:35:35 1998 John Metzler * utils.c (fmthex): A formatting function for hexdumps - * mips-tdep.c (unpack_mips16): Fixed instruction decoding, lots of + * mips-tdep.c (unpack_mips16): Fixed instruction decoding, lots of bit pattern interpretations. mips_fetch_instruction does not work for 16 bit instructions. Some confusion remains about sign extension in backward branches. @@ -2006,8 +2028,8 @@ Fri Apr 10 10:35:35 1998 John Metzler (mips16_next_16): Initial major debugging of this function. Lots of bit pattern mistakes. (mips_next_pc): key on low bit of PC, not symbol table. - * symfile.c(generic_load) : Added a download verification which - reads back the loade code. Download chunk size is now a defined + * symfile.c (generic_load): Added a download verification which + reads back the loaded code. Download chunk size is now a defined macro. Fixed a bug in which downloading slips into loading one byte at a time. Lower level functions in monitor.c can load long sequences of bytes and make use of these fixups. Referencing @@ -2107,15 +2129,6 @@ Tue Mar 31 21:30:39 1998 Nick Clifton * dbxread.c (process_one_symbol): Call SMASH_TEXT_ADDRESS (if it is defined) for function symbols. -Mon Feb 16 14:05:54 1998 Andrew Cagney - - * d10v-tdep.c (d10v_extract_return_value): Wierd. GCC wants to - return odd sized register quantities with only half of the first - register used! - - * config/d10v/tm-d10v.h (USE_STRUCT_CONVENTION): Use stack when - size > 8. - Tue Mar 31 16:39:28 1998 Michael Snyder * tracepoint.c (get_tracepoint_by_number): change warning to note. @@ -2240,7 +2253,7 @@ Tue Mar 24 16:22:40 1998 Stu Grossman * Makefile.in: Derive SHELL from configure. * config/d10v/d10v.mt config/m32r/m32r.mt config/mn10200/mn10200.mt config/mn10300/mn10300.mt - config/d30v/d30v.mt : Remove -lm from SIM. This prevents + config/d30v/d30v.mt: Remove -lm from SIM. This prevents dependency checking of -lm (under NT native builds). (It is automatically added by configure if it exists.) * doc/configure mswin/configure nlm/configure @@ -2273,7 +2286,7 @@ end-sanitize-sky Sat Mar 21 19:34:49 1998 Elena Zannoni merged changes from Foundry (list follows by file/author): - + - Tom Tromey * Makefile.in (gdbres.o): New target. (WINDRES): New define. @@ -2373,7 +2386,7 @@ Fri Mar 20 14:45:36 1998 Michael Snyder to avoid being killed by async SIGIO signals. * config/m32r/m32r.mt: define GDBSERVER_(LIBS and DEPFILES), so that gdbserver can be built with the m32r simulator. - + Fri Mar 20 09:04:06 1998 Andrew Cagney start-sanitize-r5900 @@ -2389,7 +2402,7 @@ end-sanitize-r5900 start-sanitize-r5900 (builtin_type_{,u}int128): Ditto. end-sanitize-r5900 - + * gdbtypes.c (_initialize_gdbtypes): Initialize new types. * mips-tdep.c (do_gp_register_row): Pad register value when GP @@ -2437,7 +2450,7 @@ Fri Mar 13 15:37:02 1998 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) start-sanitize-vr4320 Tue Mar 10 16:15:13 1998 Gavin Koch - * configure.tgt (mips64*vr4320*el-*-elf*) : Removed spurious case. + * configure.tgt (mips64*vr4320*el-*-elf*): Removed spurious case. end-sanitize-vr4320 Fri Mar 6 13:10:27 1998 Fred Fish @@ -2500,7 +2513,7 @@ start-sanitize-vr4111 end-sanitize-vr4111 * dwarfread.c (read_tag_pointer_type): Pointer sizes now come from TARGET_PTR_BIT rather from sizeof(char *) on host. - + Tue Mar 3 14:37:02 1998 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) * alpha-nat.c (fetch_osf_core_registers): Renamed from @@ -2511,7 +2524,7 @@ Tue Mar 3 14:37:02 1998 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) start-sanitize-vr4320 Tue Mar 3 11:12:39 1998 Gavin Koch - * configure.tgt (mips64*vr4320*el-*-elf*,mips64*vr4320*-*-elf*) : + * configure.tgt (mips64*vr4320*el-*-elf*,mips64*vr4320*-*-elf*): Added. end-sanitize-vr4320 @@ -2599,7 +2612,7 @@ Tue Feb 17 14:28:33 1998 Peter Schauer Tue Feb 17 14:07:34 1998 Peter Schauer * gdbtypes.c (check_typedef): Do not try to resolve the length of - a type which has TYPE_FLAG_TARGET_STUB set, if the target type has + a type which has TYPE_FLAG_TARGET_STUB set, if the target type has set TYPE_FLAG_TARGET_STUB as well. Tue Feb 17 14:32:18 1998 Andrew Cagney @@ -2616,15 +2629,19 @@ Mon Feb 16 14:05:54 1998 Andrew Cagney * remote.c (remote_xfer_memory): Use REMOTE_TRANSLATE_XFER_ADDRESS to translate addr/size when defined. (open_remote_target): Delete. - + * target.h (open_remote_target): Delete. - + * config/d10v/tm-d10v.h (REMOTE_TRANSLATE_XFER_ADDRESS): Define. - + Mon Feb 16 14:05:54 1998 Andrew Cagney - * config/d10v/tm-d10v.h (USE_STRUCT_CONVENTION): Define. True when - sizeof type > 1. + * d10v-tdep.c (d10v_extract_return_value): Wierd. GCC wants to + return odd sized register quantities with only half of the first + register used! + + * config/d10v/tm-d10v.h (USE_STRUCT_CONVENTION): Use stack when + size > 8. Mon Feb 16 14:05:54 1998 Andrew Cagney @@ -2785,7 +2802,7 @@ Thu Feb 5 13:16:36 1998 Andrew Cagney * config/d10v/tm-d10v.h (EXTRA_FRAME_INFO): Delete dummy from struct. (POP_FRAME): Point at generic_pop_current_frame. - + * d10v-tdep.c (d10v_pop_frame): Delete code handling dummy frames, handled earlier. (d10v_push_return_address): New function. @@ -2822,7 +2839,7 @@ Thu Feb 5 13:16:36 1998 Andrew Cagney (STORE_RETURN_VALUE): Specify return register using RET1_REGNUM. (STORE_STRUCT_RETURN): Specify ARG1_REGNUM as the struct ptr location. - + Thu Feb 5 13:16:36 1998 Andrew Cagney * blockframe.c (generic_pop_dummy_frame): Flush the frame, no @@ -3116,7 +3133,7 @@ Thu Jan 8 11:03:59 1998 Nick Clifton * Makefile.in: Add build rules for remote-rdi.c and rdi-share/libangsd.a. - + * configure.tgt: Updated from source on branch. * config/arm/tm-arm.h: Updated from source on branch. * arm-tdep.c: Updated from source on branch. diff --git a/gdb/remote.c b/gdb/remote.c index e3ebaec8568..d51c08a181c 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -1,5 +1,6 @@ /* Remote target communications for serial-line targets in custom GDB protocol - Copyright 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. + Copyright 1988, 91, 92, 93, 94, 95, 96, 97, 1998 + Free Software Foundation, Inc. This file is part of GDB. @@ -257,8 +258,6 @@ static void remote_detach PARAMS ((char *args, int from_tty)); static void remote_interrupt PARAMS ((int signo)); -static void remote_interrupt_twice PARAMS ((int signo)); - static void interrupt_query PARAMS ((void)); static void set_thread PARAMS ((int, int)); @@ -279,15 +278,39 @@ static void init_remote_ops PARAMS ((void)); static void init_extended_remote_ops PARAMS ((void)); +static void remote_stop PARAMS ((void)); + +static int hexnumstr PARAMS ((char *, ULONGEST)); + +static CORE_ADDR remote_address_masked PARAMS ((CORE_ADDR)); + +static void print_packet PARAMS ((char *)); + +static unsigned long crc32 PARAMS ((unsigned char *, int, unsigned int)); + +static void compare_sections_command PARAMS ((char *, int)); + +static void packet_command PARAMS ((char *, int)); + /* exported functions */ extern int fromhex PARAMS ((int a)); + extern void getpkt PARAMS ((char *buf, int forever)); + extern int putpkt PARAMS ((char *buf)); -static struct target_ops remote_ops ; +void remote_console_output PARAMS ((char *)); + +void open_remote_target PARAMS ((char *, int, struct target_ops *, int)); + +void _initialize_remote PARAMS ((void)); + +/* */ + +static struct target_ops remote_ops; -static struct target_ops extended_remote_ops ; +static struct target_ops extended_remote_ops; /* This was 5 seconds, which is a long time to sit and wait. Unless this is going though some terminal server or multiplexer or @@ -305,6 +328,11 @@ extern int remote_timeout; static int remote_break; +/* Has the user attempted to interrupt the target? If so, then offer + the user the opportunity to bail out completely if he interrupts + again. */ +static int interrupted_already = 0; + /* Descriptor for I/O to remote machine. Initialize it to NULL so that remote_open knows that we don't have a file open when the program starts. */ @@ -337,6 +365,19 @@ static serial_t remote_desc = NULL; static int remote_write_size = PBUFSIZ; +/* This variable sets the number of bits in an address that are to be + sent in a memory ("M" or "m") packet. Normally, after stripping + leading zeros, the entire address would be sent. This variable + restricts the address to REMOTE_ADDRESS_SIZE bits. HISTORY: The + initial implementation of remote.c restricted the address sent in + memory packets to ``host::sizeof long'' bytes - (typically 32 + bits). Consequently, for 64 bit targets, the upper 32 bits of an + address was never sent. Since fixing this bug may cause a break in + some remote targets this variable is principly provided to + facilitate backward compatibility. */ + +static int remote_address_size; + /* This is the size (in chars) of the first response to the `g' command. This is used to limit the size of the memory read and write commands to prevent stub buffers from overflowing. The size does not include headers and @@ -744,36 +785,39 @@ remote_resume (pid, step, siggnal) /* Send ^C to target to halt it. Target will respond, and send us a packet. */ +static void (*ofunc) PARAMS ((int)); static void remote_interrupt (signo) int signo; { - /* If this doesn't work, try more severe steps. */ - signal (signo, remote_interrupt_twice); - - if (remote_debug) - printf_unfiltered ("remote_interrupt called\n"); - - /* Send a break or a ^C, depending on user preference. */ - if (remote_break) - SERIAL_SEND_BREAK (remote_desc); - else - SERIAL_WRITE (remote_desc, "\003", 1); + remote_stop (); + signal (signo, remote_interrupt); } - -static void (*ofunc)(); - -/* The user typed ^C twice. */ + static void -remote_interrupt_twice (signo) - int signo; +remote_stop () { - signal (signo, ofunc); - - interrupt_query (); + if (!interrupted_already) + { + /* Send a break or a ^C, depending on user preference. */ + interrupted_already = 1; - signal (signo, remote_interrupt); + if (remote_debug) + printf_unfiltered ("remote_stop called\n"); + + if (remote_break) + SERIAL_SEND_BREAK (remote_desc); + else + SERIAL_WRITE (remote_desc, "\003", 1); + } + else + { + signal (SIGINT, ofunc); + interrupt_query (); + signal (SIGINT, remote_interrupt); + interrupted_already = 0; + } } /* Ask the user what to do when an interrupt is received. */ @@ -835,7 +879,8 @@ remote_wait (pid, status) { unsigned char *p; - ofunc = (void (*)()) signal (SIGINT, remote_interrupt); + interrupted_already = 0; + ofunc = signal (SIGINT, remote_interrupt); getpkt ((char *) buf, 1); signal (SIGINT, ofunc); @@ -1004,7 +1049,8 @@ remote_fetch_registers (regno) in the buffer is not a hex character, assume that has happened and try to fetch another packet to read. */ while ((buf[0] < '0' || buf[0] > '9') - && (buf[0] < 'a' || buf[0] > 'f')) + && (buf[0] < 'a' || buf[0] > 'f') + && buf[0] != 'x') /* New: unavailable register value */ { if (remote_debug) printf_unfiltered ("Bad register packet; fetching a new packet\n"); @@ -1027,7 +1073,10 @@ remote_fetch_registers (regno) print a second warning. */ goto supply_them; } - regs[i] = fromhex (p[0]) * 16 + fromhex (p[1]); + if (p[0] == 'x' && p[1] == 'x') + regs[i] = 0; /* 'x' */ + else + regs[i] = fromhex (p[0]) * 16 + fromhex (p[1]); p += 2; } @@ -1039,10 +1088,14 @@ remote_fetch_registers (regno) warning ("Remote reply is too short: %s", buf); #endif } - - supply_them: + + supply_them: for (i = 0; i < NUM_REGS; i++) + { supply_register (i, ®s[REGISTER_BYTE(i)]); + if (buf[REGISTER_BYTE(i) * 2] == 'x') + register_valid[i] = -1; /* register value not available */ + } } /* Prepare to store registers. Since we may send them all (using a @@ -1165,6 +1218,45 @@ hexnumlen (num) return max (i, 1); } +/* Set BUF to the hex digits representing NUM */ + +static int +hexnumstr (buf, num) + char *buf; + ULONGEST num; +{ + int i; + int len = hexnumlen (num); + + buf[len] = '\0'; + + for (i = len - 1; i >= 0; i--) + { + buf[i] = "0123456789abcdef" [(num & 0xf)]; + num >>= 4; + } + + return len; +} + +/* Mask all but the least significant REMOTE_ADDRESS_SIZE bits */ + +static CORE_ADDR +remote_address_masked (addr) + CORE_ADDR addr; +{ + if (remote_address_size > 0 + && remote_address_size < (sizeof (ULONGEST) * 8)) + { + /* Only create a mask when that mask can safely be constructed + in a ULONGEST variable. */ + ULONGEST mask = 1; + mask = (mask << remote_address_size) - 1; + addr &= mask; + } + return addr; +} + /* Write memory data directly to the remote machine. This does not inform the data cache; the data cache uses this. MEMADDR is the address in the remote memory space. @@ -1201,14 +1293,20 @@ remote_write_bytes (memaddr, myaddr, len) todo = min (len, max_buf_size / 2); /* num bytes that will fit */ - /* FIXME-32x64: Need a version of print_address_numeric which puts the - result in a buffer like sprintf. */ - sprintf (buf, "M%lx,%x:", (unsigned long) memaddr, todo); + /* construct "M"","":" */ + /* sprintf (buf, "M%lx,%x:", (unsigned long) memaddr, todo); */ + memaddr = remote_address_masked (memaddr); + p = buf; + *p++ = 'M'; + p += hexnumstr (p, (ULONGEST) memaddr); + *p++ = ','; + p += hexnumstr (p, (ULONGEST) todo); + *p++ = ':'; + *p = '\0'; /* We send target system values byte by byte, in increasing byte addresses, each byte encoded as two hex characters. */ - p = buf + strlen (buf); for (i = 0; i < todo; i++) { *p++ = tohex ((myaddr[i] >> 4) & 0xf); @@ -1268,9 +1366,16 @@ remote_read_bytes (memaddr, myaddr, len) todo = min (len, max_buf_size / 2); /* num bytes that will fit */ - /* FIXME-32x64: Need a version of print_address_numeric which puts the - result in a buffer like sprintf. */ - sprintf (buf, "m%lx,%x", (unsigned long) memaddr, todo); + /* construct "m"","" */ + /* sprintf (buf, "m%lx,%x", (unsigned long) memaddr, todo); */ + memaddr = remote_address_masked (memaddr); + p = buf; + *p++ = 'm'; + p += hexnumstr (p, (ULONGEST) memaddr); + *p++ = ','; + p += hexnumstr (p, (ULONGEST) todo); + *p = '\0'; + putpkt (buf); getpkt (buf, 0); @@ -1978,6 +2083,13 @@ crc32 (buf, len, crc) return crc; } +/* compare-sections command + + With no arguments, compares each loadable section in the exec bfd + with the same memory range on the target, and reports mismatches. + Useful for verifying the image on the target against the exec file. + Depends on the target understanding the new "qCRC:" request. */ + static void compare_sections_command (args, from_tty) char *args; @@ -2099,6 +2211,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_stop = remote_stop; remote_ops.to_stratum = process_stratum; remote_ops.to_has_all_memory = 1; remote_ops.to_has_memory = 1; @@ -2159,4 +2272,10 @@ terminating `#' character and checksum.", var_integer, (char *)&remote_write_size, "Set the maximum number of bytes in each memory write packet.\n", &setlist), &showlist); + + remote_address_size = TARGET_PTR_BIT; + add_show_from_set (add_set_cmd ("remoteaddresssize", class_obscure, + var_integer, (char *)&remote_address_size, + "Set the maximum size of the address (in bits) in a memory packet.\n", &setlist), + &showlist); } diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index d7978ddbb1d..e19485fecef 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -332,30 +332,11 @@ set_raw_tracepoint (sal) if (sal.symtab == NULL) t->source_file = NULL; else - { - if (sal.symtab->dirname == NULL) - { - t->source_file = (char *) xmalloc (strlen (sal.symtab->filename) + 1); - strcpy (t->source_file, sal.symtab->filename); - } - else - { - char *p; - - t->source_file = (char *) xmalloc (strlen (sal.symtab->filename) + - strlen (sal.symtab->dirname) + 2); - - strcpy (t->source_file, sal.symtab->dirname); - p = t->source_file; - while (*p) - p++; - if (*(--p) != '/') /* Will this work on Windows? */ - strcat (t->source_file, "/"); - strcat (t->source_file, sal.symtab->filename); - } - } + t->source_file = savestring (sal.symtab->filename, + strlen (sal.symtab->filename)); - t->language = current_language->la_language; + t->section = sal.section; + t->language = current_language->la_language; t->input_radix = input_radix; t->line_number = sal.line; t->enabled = enabled; @@ -503,7 +484,7 @@ tracepoints_info (tpnum_exp, from_tty) if (t->source_file) { - sym = find_pc_function (t->address); + sym = find_pc_sect_function (t->address, t->section); if (sym) { fputs_filtered ("in ", gdb_stdout); diff --git a/gdb/tracepoint.h b/gdb/tracepoint.h index 889cd54e331..2ffe3bdab22 100644 --- a/gdb/tracepoint.h +++ b/gdb/tracepoint.h @@ -86,8 +86,12 @@ struct tracepoint aborting, so you can back up to just before the abort. */ int hit_count; - /* Thread number for thread-specific breakpoint, or -1 if don't care */ + /* Thread number for thread-specific tracepoint, or -1 if don't care */ int thread; + + /* BFD section, in case of overlays: + no, I don't know if tracepoints are really gonna work with overlays. */ + asection *section; }; enum actionline_type