3 * README: Don't mention xscale*-*-linux*.
4 * configure.srv (xscale*-*-linux*): Don't handle target.
8 * linux-x86-low.c (amd64_emit_const): Call memcpy instead of
10 (amd64_emit_reg, amd64_emit_int_call_1, amd64_emit_void_call_2):
11 (i386_emit_const, i386_emit_reg, i386_emit_int_call_1):
12 (i386_emit_void_call_2): Likewise.
16 * linux-low.c: Move common macros to linux-ptrace.h.
17 Include linux-ptrace.h.
18 * Makefile.in (linux_ptrace_h): New.
19 (linux-low.o): Depends on linux-ptrace.h.
23 * remote-utils.c (handle_accept_event): Close LISTEN_DESC only if
24 RUN_ONCE. Comment for the LISTEN_DESC delete_file_handler call.
25 (remote_prepare): New function with most of the TCP code from ...
26 (remote_open): ... here. Detect PORT here unconditionally. Move also
27 setting transport_is_reliable.
28 * server.c (run_once): New variable.
29 (gdbserver_usage): Document it.
30 (main): Set run_once for `--once'. Call remote_prepare. Exit after
31 the first run if RUN_ONCE.
32 * server.h (run_once, remote_prepare): New declarations.
36 * win32-low.c (handle_load_dll): Remove duplicate "the".
40 Remove support for old Cygwin 1.5 versions.
41 * win32-low.c (win32_create_inferior): Use new cygwin_path_list
42 function to avoid warning.
43 (win32_add_one_solib): Use cygwin_conv_path function to avoid
48 * gdbserver/server.h (Macro _): Define it if not available.
52 * hostio.c (handle_close): Remove unnecessary null test.
56 * Makefile.in (maintainer-clean realclean distclean): Remove
57 "make ... subdir_do" command.
61 * tracepoint.c (tracepoint_finish_step): Fix loop variable.
63 * server.c (handle_v_run): Free alloced buffer on early return.
70 * Makefile.in: Remove GNU make feature --directory.
74 * Makefile.in (CLEANDIRS, REQUIRED_SUBDIRS): New variable.
75 (subdir_do): New make target. Copied from gdb/Makefile.
76 (maintainer-clean, realclean, distclean, clean): Call corresponding
77 make targets in common/Makefile.
81 * configure.ac: Call AC_PROG_RANLIB.
82 * Makefile.in: Remove signals.o from OBS. Link libcommon.a.
83 * configure: Regenerate.
87 * remote-utils.c (putpkt_binary_1): Calculate BUF2 size dynamically.
91 * Makefile.in (REQUIRED_SUBDIRS): Remove $(LIBCOMMON_DIR).
95 * Makefile.in (CLEANDIRS, REQUIRED_SUBDIRS): New variable.
96 (subdir_do): New make target. Copied from gdb/Makefile.
97 (maintainer-clean, realclean, distclean, clean): Call corresponding
98 make targets in common/Makefile.
102 * Makefile.in: Remove GNU make feature --directory.
106 * server.c (queue_stop_reply): Call xmalloc not malloc.
110 * linux-arm-low.c (arm_arch_setup): Replace malloc with xmalloc.
114 * tracepoint.c (cmd_qtv): Discard unused value 'packet'.
115 (cmd_qtframe): Ditto.
116 (cmd_qtbuffer): Ditto.
117 (cmd_bigqtbuffer): Ditto.
119 * utils.c (decimal2str): Initialize 'width' to nine, then
124 * hostio.c (require_data): Free *data, not data.
128 * hostio.c (require_data): Use free, not xfree.
132 * server.c (handle_query): Discard unused value.
134 * hostio.c (require_data): Free malloc memory before returning
139 * linux-low.c (list_threads): Call closedir for dirent.
143 * i386-low.c (i386-length_and_rw_bits): Comment the fact that
144 a case statement falls through.
146 * linux-low.c (linux_xfer_siginfo): Fix fencepost error.
148 * linux-amd64-ipa.c (gdb_agent_get_raw_reg): Fix fencepost error
153 * utils.c (decimal2str): Eliminate dead code and dead param.
154 (pulongest): Drop dead param from call to decimal2str.
159 Revert the following patch (not approved yet):
161 * tracepoint.c (tp_printf): New function.
162 (eval_agent_expr): Handle gdb_agent_op_printf.
166 * tracepoint.c (tp_printf): New function.
167 (eval_agent_expr): Handle gdb_agent_op_printf.
171 * Makefile.in (tracepoint-ipa.o): Depend on ax.def.
172 (tracepoint.o): Likewise.
173 * tracepoint.c (enum gdb_agent_op): Use ax.def.
174 (gdb_agent_op_names): Likewise.
178 * tracepoint.c (enum gdb_agent_op) <gdb_agent_op_pick,
179 gdb_agent_op_rot>: New constants.
180 (gdb_agent_op_names): Add pick and roll.
181 (eval_agent_expr) <gdb_agent_op_pick, gdb_agent_op_rot>: New
186 * aclocal.m4: Regenerated with aclocal-1.11.1.
190 * server.c (handle_qxfer_traceframe_info): New.
191 (qxfer_packets): Register "traceframe-info".
192 (handle_query): Report support for qXfer:traceframe-info:read+.
193 * tracepoint.c (match_blocktype): New.
194 (traceframe_find_block_type): Rename to ...
195 (traceframe_walk_blocks): ... this. Add callback filter argument,
197 (traceframe_find_block_type): New, reimplemented on top of
198 traceframe_walk_blocks.
199 (build_traceframe_info_xml): New.
200 (traceframe_read_info): New.
201 * server.h (traceframe_read_info): Declare.
205 * configure.ac: Call AC_PROG_RANLIB.
206 * Makefile.in: Remove signals.o from OBS. Link libcommon.a.
207 * configure: Regenerate.
211 * server.c (gdb_read_memory): Change return semantics to allow
213 (handle_search_memory_1): Adjust.
214 (process_serial_event) <'m' packet>: Handle partial transfers.
215 * tracepoint.c (traceframe_read_mem): Handle partial transfers.
219 * regcache.c (init_register_cache): Initialize
220 regcache->register_status.
221 (free_register_cache): Release regcache->register_status.
222 (regcache_cpy): Copy register_status.
223 (registers_to_string): Print 'x's for unavailable registers.
224 (supply_register): Mark the register's status valid or
225 unavailable, depending on whether a buffer was passed in or not.
226 (supply_register_zeroed): New.
227 (supply_regblock): Mark the registers' status valid or
228 unavailable, depending on whether a buffer was passed in or not.
229 * regcache.h (REG_UNAVAILABLE, REG_VALID): New defines.
230 (struct regcache): New `register_status' field.
231 (supply_register_zeroed): Declare.
232 * i387-fp.c (i387_xsave_to_cache): Zero out registers using
233 supply_register_zeroed, rather than passing a NULL buffer to
235 * tracepoint.c (fetch_traceframe_registers): Update comment.
239 * i387-fp.c (i387_xsave_to_cache): Make passing NULL as register
244 * server.h (decode_xfer_write): Change prototype.
245 * remote-utils.c (decode_xfer_write): Remove `annex' parameter,
246 and don't extract the annex here.
247 * server.c (decode_xfer_read): Remove `annex' parameter,
248 and don't extract the annex here.
251 (handle_qxfer_auxv, handle_qxfer_features, handle_qxfer_libraries)
252 (handle_qxfer_osdata, handle_qxfer_siginfo, handle_qxfer_spu)
253 (handle_qxfer_statictrace): New functions, abstracted out from
254 handle_query, and made to use the struct qxfer interface.
255 (handle_threads_qxfer_proper): Rename to ...
256 (handle_qxfer_threads_proper): ... this.
257 (handle_threads_qxfer): Rename to ...
258 (handle_qxfer_threads): ... this. Adjust.
259 (qxfer_packets): New array.
260 (handle_qxfer): New function.
261 (handle_query): Use handle_qxfer.
265 * gdbreplay.c: Shorten lines of >= 80 columns.
266 * linux-low.c: Ditto.
267 * linux-ppc-low.c: Ditto.
268 * linux-s390-low.c: Ditto.
269 * linux-sparc-low.c: Ditto.
270 * linux-x86-low.c: Ditto.
271 * linux-xtensa-low.c: Ditto.
272 * mem-break.c: Ditto.
275 * remote-utils.c: Ditto.
278 * thread-db.c: Ditto.
279 * tracepoint.c: Ditto.
281 * win32-low.h: Ditto.
285 * gdbserver/configure.ac, gdbserver/gdbserver.1: Copyright year
290 * server.c (gdbserver_version): Update copyright year in version
292 * gdbreplay.c (gdbreplay_version): Ditto.
296 * configure.srv (bfin-*-*linux*): Handle Blackfin/Linux targets.
297 * linux-bfin-low.c: New file.
298 * linux-low.c: Define PT_TEXT_ADDR, PT_TEXT_END_ADDR, and
299 PT_DATA_ADDR for BFIN targets.
300 * Makefile.in (SFILES): Add linux-bfin-low.c.
301 (clean): Remove reg-bfin.c.
302 (linux-bfin-low.o, reg-bfin.o, reg-bfin.c): New targets.
303 * README: Mention supported Blackfin targets.
307 * .gitignore: New file.
311 * linux-low.c (linux_tracefork_child): Add char* cast to arg.
315 * Makefile.in: Add FLAGS_TO_PASS variable.
316 (install): Remove dependency of install-only and recursively
317 invoke make for install-only.
321 * Makefile.in (uninstall): Use $(DESTDIR).
327 * linux-x86-low.c (compat_siginfo_from_siginfo)
328 (siginfo_from_compat_siginfo): Also copy si_pid and si_uid when
329 si_code is < 0. Check for si_code == SI_TIMER before checking for
334 * lynx-i386-low.c: New file.
335 * configure.srv: Add handling of i[34567]86-*-lynxos* targets.
339 * lynx-low.c (ptrace_request_to_str): Remove handling for
340 request values that have been removed in LynxOS 5.x.
344 * lynx-low.c, lynx-ppc-loc.c: Include <sys/ptrace.h> instead of
349 * configure.ac: Add --enable-inprocess-agent option.
350 * configure: Rebuilt.
354 * linux-low.c (linux_kill): Remove unused variable.
355 (linux_stabilize_threads): Likewise.
356 * server.c (start_inferior): Likewise.
357 (queue_stop_reply_callback): Likewise.
358 * tracepoint.c (do_action_at_tracepoint): Likewise.
362 * linux-low.c (maybe_move_out_of_jump_pad): Restore current_inferior
367 * target.c (mywait) <TARGET_WAITKIND_EXITED>: Fix to use INTEGER.
371 * Makefile.in (install-only): Replace $IPA_DEPFILES with
376 * gdbserver/lynx-low.c, gdbserver/lynx-low.h,
377 gdbserver/lynx-ppc-low.c: New files.
378 * Makefile.in (lynx_low_h): New variable.
379 (lynx-low.o, lynx-ppc-low.o): New rules.
380 * configure.ac: On LynxOS, link with -lnetinet.
381 * configure.srv: Add handling of powerpc-*-lynxos* targets.
382 * configure: regenerate.
386 * Makefile.in (vasprintf.o, vsnprintf.o): New rules.
387 * configure.ac: Add check for vasprintf and vsnprintf.
388 * configure, config.in: Regenerate.
389 * server.h (vasprintf, vsnprintf): Add conditional declarations.
393 * gdbreplay.c: Move include of alloca.h up, next to include of
395 * server.h: Add include of malloc.h.
396 * mem-break.c: Remove include of malloc.h.
397 * server.c, tracepoint.c, utils.c, win32-low.c: Likewise.
401 * Makefile.in (memmem.o): Build with -Wno-error.
405 * utils.c (xsnprintf): Make non-static.
406 * server.h: Add xsnprintf declaration.
407 * linux-low.c, nto-low.c, target.c, thread-db.c, tracepoint.c:
408 replace calls to snprintf by calls to xsnprintf throughout.
412 * configure.ac: Add configure check for alloca.
413 * configure, config.in: Regenerate.
414 * server.h: Include alloca.h if it exists.
415 * gdbreplay.c: Include alloca.h if it exists.
419 * linux-low.c (__SIGRTMIN): Define if not already defined.
420 (linux_create_inferior): Check for __ANDROID__ rather than
422 (enqueue_one_deferred_signal): Don't requeue non-RT signals that
423 are already deferred.
424 (linux_wait_1): Check for __ANDROID__ rather than __SIGRTMIN.
425 (linux_resume_one_thread): Don't queue a SIGSTOP if the lwp is
426 stopped and already has a pending signal to report.
427 (proceed_one_lwp): : Don't queue a SIGSTOP if the lwp already has
428 a pending signal to report or is moving out of a jump pad.
429 (linux_init_signals): Check for __ANDROID__ rather than
434 * linux-low.c (linux_stabilize_threads): Wrap debug output in a
435 debug_threads check. Avoid a linear search when not doing debug
440 * event-loop.c (event_handle_func): Adjust to use gdb_fildes_t.
441 (struct gdb_event) <fd>: Change type to gdb_fildes_t.
442 (struct file_handler) <fd>: Change type to gdb_fildes_t.
443 (process_event): Change local fd's type to gdb_fildes_t.
444 (create_file_handler): Adjust prototype.
445 (delete_file_handler): Adjust prototype.
446 (handle_file_event): Adjust prototype. Use pfildes.
447 (create_file_event): Adjsut prototype.
448 * remote-utils.c (remote_desc, listen_desc): Change type to
450 * server.h: New gdb_fildes_t typedef.
451 [USE_WIN32API]: Include winsock2.h.
452 (delete_file_handler, add_file_handler): Adjust prototypes.
454 * utils.c (pfildes): New.
458 * configure.ac (build_warnings): Add -Wno-char-subscripts.
459 * configure: Regenerate.
463 * linux-low.c (linux_unprepare_to_access_memory): Rename to ...
464 (linux_done_accessing_memory): ... this.
465 (linux_target_ops): Adjust.
466 * linux-x86-low.c (x86_insert_point, x86_remove_point): Adjust.
467 * nto-low.c (nto_target_ops): Adjust comment.
468 * server.c (gdb_read_memory, gdb_write_memory): Adjust.
469 * spu-low.c (spu_target_ops): Adjust comment.
470 * target.h (target_ops): Rename unprepare_to_access_memory field
471 to done_accessing_memory.
472 (unprepare_to_access_memory): Rename to ...
473 (done_accessing_memory): ... this.
477 * linux-low.c (linux_prepare_to_access_memory): New.
478 (linux_unprepare_to_access_memory): New.
479 (linux_target_ops): Install them.
480 * server.c (read_memory): Rename to ...
481 (gdb_read_memory): ... this. Use
482 prepare_to_access_memory/prepare_to_access_memory.
483 (write_memory): Rename to ...
484 (gdb_write_memory): ... this. Use
485 prepare_to_access_memory/prepare_to_access_memory.
486 (handle_search_memory_1): Adjust.
487 (process_serial_event): Adjust.
488 * target.h (struct target_ops): New fields
489 prepare_to_access_memory and unprepare_to_access_memory.
490 (prepare_to_access_memory, unprepare_to_access_memory): New.
491 * linux-x86-low.c (x86_insert_point, x86_remove_point): Use
492 prepare_to_access_memory/prepare_to_access_memory.
493 * nto-low.c (nto_target_ops): Adjust.
494 * spu-low.c (spu_target_ops): Adjust.
495 * win32-low.c (win32_target_ops): Adjust.
499 * Makefile.in (WARN_CFLAGS): Get it from configure.
500 (WERROR_CFLAGS): New.
501 (INTERNAL_CFLAGS): Add WERROR_CFLAGS.
502 * configure.ac: Introduce --enable-werror, which adds -Werror to
503 the compiler command line. Enabled by default. Disable with
504 --disable-werror. Add -Wdeclaration-after-statement
505 Wpointer-arith and -Wformat-nonliteral to warning flags.
506 * configure: Regenerate.
510 * mem-break.c [HAVE_MALLOC_H]: Include malloc.h.
514 * gdbreplay.c (remote_error): New.
516 (expect): Use gdbchar. Check for error reading from GDB.
517 Clarify sync error output.
518 (play): Check for errors writing to GDB.
519 * linux-low.c (sigchld_handler): Really ignore `write' errors.
520 * remote-utils.c (getpkt): Check for errors writing to the remote
525 * linux-low.c (linux_wait_1): Move non-debugging code out of
526 `debug_threads' control.
530 * linux-low.c (linux_wait_1): Don't set last_status here.
531 * server.c (push_event, queue_stop_reply_callback): Assert we're
532 not pushing a TARGET_WAITKIND_IGNORE event.
533 (start_inferior, start_inferior, attach_inferior, handle_v_cont)
534 (myresume, handle_target_event): Set the thread's last_resume_kind
535 and last_status from the target returned status.
541 * linux-x86-low.c (update_debug_registers_callback): New.
542 (i386_dr_low_set_addr): Use it.
543 (i386_dr_low_get_addr): New.
544 (i386_dr_low_set_control): Use update_debug_registers_callback.
545 (i386_dr_low_get_control): New.
546 (i386_dr_low_get_status): Adjust.
547 * linux-low.c (linux_stop_lwp): New.
548 * linux-low.h (linux_stop_lwp): Declare.
550 * i386-low.c (I386_DR_GET_RW_LEN): Take the dr7 contents as
551 argument instead of a i386_debug_reg_state.
552 (I386_DR_WATCH_HIT): Take the dr6 contents as argument instead of
553 a i386_debug_reg_state.
554 (i386_insert_aligned_watchpoint): Adjust.
555 (i386_remove_aligned_watchpoint): Adjust.
556 (i386_low_stopped_data_address): Read the debug registers from the
557 inferior instead of from the mirrors.
558 * i386-low.h (struct i386_debug_reg_state): Extend comment.
559 (i386_dr_low_get_addr): Declare.
560 (i386_dr_low_get_control): Declare.
561 (i386_dr_low_get_status): Change prototype.
563 * win32-i386-low.c (dr_status_mirror, dr_control_mirror): New globals.
564 (i386_dr_low_get_addr): New.
565 (i386_dr_low_get_control): New.
566 (i386_dr_low_get_status): Adjust prototype. Return
568 (i386_initial_stuff): Clear dr_status_mirror and
570 (i386_get_thread_context): Adjust.
571 (i386_set_thread_context): Adjust.
572 (i386_thread_added): Adjust.
576 * linux-low.h (linux_thread_area): Delete declaration.
580 * linux-low.c (linux_wait_1): Correctly return the ptid of the child
581 after its termination.
585 * linux-low.c (gdb_wants_lwp_stopped): Delete.
586 (gdb_wants_all_stopped): Delete.
587 (linux_wait_1): Don't call them.
588 * server.c (handle_v_cont): Tag all threads as want-stopped.
589 (gdb_wants_thread_stopped): Fix comments. Tag the thread that
590 stopped as "client-wants-stopped".
594 * Makefile.in (signals_h): New.
595 (server_h): Depend on it.
596 (server.o): Don't depend on $(signals_def).
597 (signals.o): Depend on $(signals_def).
601 * Makefile.in (signals_def): New.
602 (server_h): Append include/gdb/signals.h and signals_def.
603 (server.o): Append signals_def.
607 * server.c (handle_target_event): Use target_signal_to_host for
608 resume_info.sig initialization.
609 * target.h (struct thread_resume) <sig>: New comment.
613 * server.c (handle_query): strcpy() the returned string from paddress()
614 instead of sprintf().
615 * utils.c (paddress): Return phex_nz().
619 * server.c (handle_v_cont): Call mourn_inferior if process
621 (myresume): Likewise.
625 Static tracepoints, and integration with UST.
627 * configure.ac: Handle --with-ust. substitute ustlibs and ustinc.
628 * mem-break.c (uninsert_all_breakpoints)
629 (reinsert_all_breakpoints): New.
630 * mem-break.h (reinsert_all_breakpoints, uninsert_all_breakpoints):
631 * tracepoint.c (ust_loaded, helper_thread_id, cmd_buf): New.
632 (gdb_agent_ust_loaded, helper_thread_id)
633 (gdb_agent_helper_thread_id): New macros.
634 (struct ipa_sym_addresses): Add addr_ust_loaded,
635 addr_helper_thread_id, addr_cmd_buf.
636 (symbol_list): Add ust_loaded, helper_thread_id, cmd_buf.
637 (in_process_agent_loaded_ust): New.
638 (write_e_ust_not_loaded): New.
639 (maybe_write_ipa_ust_not_loaded): New.
640 (struct collect_static_trace_data_action): New.
641 (enum tracepoint_type) <static_tracepoint>: New.
642 (struct tracepoint) <handle>: Mention static tracepoints.
643 (struct static_tracepoint_ctx): New.
645 (add_tracepoint_action): Handle static tracepoint actions.
646 (unprobe_marker_at): New.
647 (clear_installed_tracepoints): Handle static tracepoints.
648 (cmd_qtdp): Handle static tracepoints.
649 (probe_marker_at): New.
650 (cmd_qtstart): Handle static tracepoints.
651 (response_tracepoint): Handle static tracepoints.
652 (cmd_qtfstm, cmd_qtsstm, cmd_qtstmat): New.
653 (handle_tracepoint_query): Handle qTfSTM, qTsSTM and qTSTMat.
654 (get_context_regcache): Handle static tracepoints.
655 (do_action_at_tracepoint): Handle static tracepoint actions.
656 (traceframe_find_block_type): Handle static trace data blocks.
657 (traceframe_read_sdata): New.
658 (download_tracepoints): Download static tracepoint actions.
659 [HAVE_UST] Include ust/ust.h, dlfcn.h, sys/socket.h, and sys/un.h.
660 (GDB_PROBE_NAME): New.
665 (ust_marker_to_static_tracepoint): New.
667 (collect_ust_data_at_tracepoint): New.
668 (gdb_ust_probe): New.
669 (UNIX_PATH_MAX, SOCK_DIR): New.
670 (gdb_ust_connect_sync_socket): New.
671 (resume_thread, stop_thread): New.
672 (run_inferior_command): New.
673 (init_named_socket): New.
674 (gdb_ust_socket_init): New.
675 (cstr_to_hexstr): New.
677 (first_marker, next_marker): New.
678 (response_ust_marker): New.
679 (cmd_qtfstm, cmd_qtsstm): New.
680 (unprobe_marker_at, probe_marker_at): New.
681 (cmd_qtstmat, gdb_ust_thread): New.
683 (initialize_tracepoint_ftlib): Call gdb_ust_init.
684 * linux-amd64-ipa.c [HAVE_UST]: Include ust/processor.h
686 (x86_64_st_collect_regmap): New.
687 (X86_64_NUM_ST_COLLECT_GREGS): New.
688 (AMD64_RIP_REGNUM): New.
689 (supply_static_tracepoint_registers): New.
690 * linux-i386-ipa.c [HAVE_UST]: Include ust/processor.h
692 (i386_st_collect_regmap): New.
693 (i386_NUM_ST_COLLECT_GREGS): New.
694 (supply_static_tracepoint_registers): New.
695 * server.c (handle_query): Handle qXfer:statictrace:read.
696 <qSupported>: Report support for StaticTracepoints, and
697 qXfer:statictrace:read features.
698 * server.h (traceframe_read_sdata)
699 (supply_static_tracepoint_registers): Declare.
700 * remote-utils.c (convert_int_to_ascii, hexchars, ishex, tohex)
701 (unpack_varlen_hex): Include in IPA build.
702 * Makefile.in (ustlibs, ustinc): New.
703 (IPA_OBJS): Add remote-utils-ipa.o.
704 ($(IPA_LIB)): Link -ldl and -lpthread.
706 (IPAGENT_CFLAGS): Add UST_CFLAGS.
707 * config.in, configure: Regenerate.
712 * linux-x86-low.c (always_true): Delete.
713 (EMIT_ASM, EMIT_ASM32): Use an uncondition asm jmp instead of
714 trying to fool the compiler with always_true.
718 * tracepoint.c (condition_true_at_tracepoint): Don't run compiled
719 conditions in gdbserver.
723 * spu-low.c (spu_read_memory): Wrap around local store limit.
724 (spu_write_memory): Likewise.
728 * linux-x86-low.c (amd64_emit_const, amd64_emit_void_call_2)
729 (i386_emit_const, i386_emit_void_call_2): Replace int64_t uses with
731 * server.h (struct emit_ops): Replace int64_t uses with LONGEST
733 * tracepoint.c (emit_const, emit_void_call_2): Replace int64_t
734 uses with LONGEST uses.
741 * linux-x86-low.c: Include limits.h.
746 (amd64_emit_prologue, amd64_emit_epilogue, amd64_emit_add)
747 (amd64_emit_sub, amd64_emit_mul, amd64_emit_lsh)
748 (amd64_emit_rsh_signed, amd64_emit_rsh_unsigned, amd64_emit_ext,
749 (amd64_emit_log_not, amd64_emit_bit_and, amd64_emit_bit_or)
750 (amd64_emit_bit_xor, amd64_emit_bit_not, amd64_emit_equal,
751 (amd64_emit_less_signed, amd64_emit_less_unsigned, amd64_emit_ref,
752 (amd64_emit_if_goto, amd64_emit_goto, amd64_write_goto_address)
753 (amd64_emit_const, amd64_emit_call, amd64_emit_reg)
754 (amd64_emit_pop, amd64_emit_stack_flush, amd64_emit_zero_ext)
755 (amd64_emit_swap, amd64_emit_stack_adjust, amd64_emit_int_call_1)
756 (amd64_emit_void_call_2): New.
757 (amd64_emit_ops): New.
758 (i386_emit_prologue, i386_emit_epilogue, i386_emit_add)
759 (i386_emit_sub,i386_emit_mul, i386_emit_lsh, i386_emit_rsh_signed)
760 (i386_emit_rsh_unsigned, i386_emit_ext, i386_emit_log_not)
761 (i386_emit_bit_and, i386_emit_bit_or, i386_emit_bit_xor)
762 (i386_emit_bit_not, i386_emit_equal, i386_emit_less_signed)
763 (i386_emit_less_unsigned, i386_emit_ref, i386_emit_if_goto)
764 (i386_emit_goto, i386_write_goto_address, i386_emit_const)
765 (i386_emit_call, i386_emit_reg, i386_emit_pop)
766 (i386_emit_stack_flush, i386_emit_zero_ext, i386_emit_swap)
767 (i386_emit_stack_adjust, i386_emit_int_call_1)
768 (i386_emit_void_call_2): New.
769 (i386_emit_ops): New.
771 (the_low_target): Install x86_emit_ops.
772 * server.h (struct emit_ops): New.
773 (get_raw_reg_func_addr): Declare.
774 (current_insn_ptr, emit_error): Declare.
775 * tracepoint.c (get_raw_reg, get_trace_state_variable_value)
776 (set_trace_state_variable_value): New defines.
777 (struct ipa_sym_addresses): New fields addr_get_raw_reg,
778 addr_get_trace_state_variable_value and
779 addr_set_trace_state_variable_value.
780 (symbol_list): New fields for get_raw_reg,
781 get_trace_state_variable_value and set_trace_state_variable_value.
782 (condfn): New typedef.
783 (struct tracepoint): New field `compiled_cond'.
784 (do_action_at_tracepoint): Clear compiled_cond.
785 (get_trace_state_variable_value, set_trace_state_variable_value):
787 (condition_true_at_tracepoint): If there's a compiled condition,
789 (current_insn_ptr, emit_error): New globals.
790 (struct bytecode_address): New.
791 (get_raw_reg_func_addr): New.
792 (emit_prologue, emit_epilogue, emit_add, emit_sub, emit_mul)
793 (emit_lsh, emit_rsh_signed, emit_rsh_unsigned, emit_ext)
794 (emit_log_not, emit_bit_and, emit_bit_or, emit_bit_xor)
795 (emit_bit_not, emit_equal, emit_less_signed, emit_less_unsigned)
796 (emit_ref, emit_if_goto, emit_goto, write_goto_address, emit_const)
797 (emit_reg, emit_pop, emit_stack_flush, emit_zero_ext, emit_swap)
798 (emit_stack_adjust, emit_int_call_1, emit_void_call_2): New.
799 (compile_tracepoint_condition, compile_bytecodes): New.
800 * target.h (emit_ops): Forward declare.
801 (struct target_ops): New field emit_ops.
802 (target_emit_ops): New.
803 * linux-amd64-ipa.c (gdb_agent_get_raw_reg): New.
804 * linux-i386-ipa.c (gdb_agent_get_raw_reg): New.
805 * linux-low.c (linux_emit_ops): New.
806 (linux_target_ops): Install it.
807 * linux-low.h (struct linux_target_ops): New field emit_ops.
811 * linux-ppc-low.c (ppc_arch_setup): Use private regcache to test MSR.
812 * linux-s390-low.c (ppc_arch_setup): Use private regcache to test PSW.
817 * Makefile.in (IPA_DEPFILES, extra_libraries): New.
818 (all): Depend on $(extra_libraries).
819 (install-only): Install the IPA.
820 (IPA_OBJS, IPA_LIB): New.
821 (clean): Remove the IPA lib.
822 (IPAGENT_CFLAGS): New.
823 (tracepoint-ipa.o, utils-ipa.o, remote-utils-ipa.o)
824 (regcache-ipa.o, i386-linux-ipa.o, linux-i386-ipa.o)
825 (linux-amd64-ipa.o, amd64-linux-ipa.o): New rules.
826 * linux-amd64-ipa.c, linux-i386-ipa.c: New files.
827 * configure.ac: Check for atomic builtins support in the compiler.
828 (IPA_DEPFILES, extra_libraries): Define.
829 * configure.srv (ipa_obj): Add description.
830 (ipa_i386_linux_regobj, ipa_amd64_linux_regobj): Define.
831 (i[34567]86-*-linux*): Set ipa_obj.
832 (x86_64-*-linux*): Set ipa_obj.
833 * linux-low.c (stabilizing_threads): New.
834 (supports_fast_tracepoints): New.
835 (linux_detach): Stabilize threads before detaching.
836 (handle_tracepoints): Handle internal tracing breakpoints. Assert
837 the lwp is either not stabilizing, or is moving out of a jump pad.
838 (linux_fast_tracepoint_collecting): New.
839 (maybe_move_out_of_jump_pad): New.
840 (enqueue_one_deferred_signal): New.
841 (dequeue_one_deferred_signal): New.
842 (linux_wait_for_event_1): If moving out of a jump pad, defer
843 pending signals to later.
844 (linux_stabilize_threads): New.
845 (linux_wait_1): Check if threads need moving out of jump pads, and
847 (stuck_in_jump_pad_callback): New.
848 (move_out_of_jump_pad_callback): New.
850 (linux_resume_one_lwp): Handle moving out of jump pads.
851 (linux_set_resume_request): Dequeue deferred signals.
852 (need_step_over_p): Also step over fast tracepoint jumps.
853 (start_step_over): Also uninsert fast tracepoint jumps.
854 (finish_step_over): Also reinsert fast tracepoint jumps.
855 (linux_install_fast_tracepoint_jump): New.
856 (linux_target_ops): Install linux_stabilize_threads and
857 linux_install_fast_tracepoint_jump_pad.
858 * linux-low.h (linux_target_ops) <get_thread_area,
859 install_fast_tracepoint_jump_pad>: New fields.
860 (struct lwp_info) <collecting_fast_tracepoint,
861 pending_signals_to_report, exit_jump_pad_bkpt>: New fields.
862 (linux_get_thread_area): Declare.
863 * linux-x86-low.c (jump_insn): New.
864 (x86_get_thread_area): New.
867 (amd64_install_fast_tracepoint_jump_pad): New.
868 (i386_install_fast_tracepoint_jump_pad): New.
869 (x86_install_fast_tracepoint_jump_pad): New.
870 (the_low_target): Install x86_get_thread_area and
871 x86_install_fast_tracepoint_jump_pad.
872 * mem-break.c (set_raw_breakpoint_at): Use read_inferior_memory.
873 (struct fast_tracepoint_jump): New.
874 (fast_tracepoint_jump_insn): New.
875 (fast_tracepoint_jump_shadow): New.
876 (find_fast_tracepoint_jump_at): New.
877 (fast_tracepoint_jump_here): New.
878 (delete_fast_tracepoint_jump): New.
879 (set_fast_tracepoint_jump): New.
880 (uninsert_fast_tracepoint_jumps_at): New.
881 (reinsert_fast_tracepoint_jumps_at): New.
882 (set_breakpoint_at): Use write_inferior_memory.
883 (uninsert_raw_breakpoint): Use write_inferior_memory.
884 (check_mem_read): Mask out fast tracepoint jumps.
885 (check_mem_write): Mask out fast tracepoint jumps.
886 * mem-break.h (struct fast_tracepoint_jump): Forward declare.
887 (set_fast_tracepoint_jump): Declare.
888 (delete_fast_tracepoint_jump)
889 (fast_tracepoint_jump_here, uninsert_fast_tracepoint_jumps_at)
890 (reinsert_fast_tracepoint_jumps_at): Declare.
891 * regcache.c: Don't compile many functions when building the
892 in-process agent library.
893 (init_register_cache) [IN_PROCESS_AGENT]: Don't allow allocating
894 the register buffer in the heap.
895 (free_register_cache): If the register buffer isn't owned by the
896 regcache, don't free it.
897 (set_register_cache) [IN_PROCESS_AGENT]: Don't re-alocate
898 pre-existing register caches.
899 * remote-utils.c (convert_int_to_ascii): Constify `from' parameter
901 (convert_ascii_to_int): : Constify `from' parameter type.
902 (decode_M_packet, decode_X_packet): Replace the `to' parameter by
903 a `to_p' pointer to pointer parameter. If TO_P is NULL, malloc
904 the needed buffer in-place.
905 (relocate_instruction): New.
906 * server.c (handle_query) <qSymbols>: If the target supports
907 tracepoints, give it a chance of looking up symbols. Report
908 support for fast tracepoints.
909 (handle_status): Stabilize threads.
910 (process_serial_event): Adjust.
911 * server.h (struct fast_tracepoint_jump): Forward declare.
912 (struct process_info) <fast_tracepoint_jumps>: New field.
913 (convert_ascii_to_int, convert_int_to_ascii): Adjust.
914 (decode_X_packet, decode_M_packet): Adjust.
915 (relocate_instruction): Declare.
916 (in_process_agent_loaded): Declare.
917 (tracepoint_look_up_symbols): Declare.
918 (struct fast_tpoint_collect_status): Declare.
919 (fast_tracepoint_collecting): Declare.
920 (force_unlock_trace_buffer): Declare.
921 (handle_tracepoint_bkpts): Declare.
922 (initialize_low_tracepoint)
923 (supply_fast_tracepoint_registers) [IN_PROCESS_AGENT]: Declare.
924 * target.h (struct target_ops) <stabilize_threads,
925 install_fast_tracepoint_jump_pad>: New fields.
926 (stabilize_threads, install_fast_tracepoint_jump_pad): New.
927 * tracepoint.c [HAVE_MALLOC_H]: Include malloc.h.
928 [HAVE_STDINT_H]: Include stdint.h.
929 (trace_debug_1): Rename to ...
930 (trace_vdebug): ... this.
931 (trace_debug): Rename to ...
932 (trace_debug_1): ... this. Add `level' parameter.
934 (ATTR_USED, ATTR_NOINLINE): New.
935 (IP_AGENT_EXPORT): New.
936 (gdb_tp_heap_buffer, gdb_jump_pad_buffer, gdb_jump_pad_buffer_end)
937 (collecting, gdb_collect, stop_tracing, flush_trace_buffer)
938 (about_to_request_buffer_space, trace_buffer_is_full)
939 (stopping_tracepoint, expr_eval_result, error_tracepoint)
940 (tracepoints, tracing, trace_buffer_ctrl, trace_buffer_ctrl_curr)
941 (trace_buffer_lo, trace_buffer_hi, traceframe_read_count)
942 (traceframe_write_count, traceframes_created)
943 (trace_state_variables)
944 New renaming defines.
945 (struct ipa_sym_addresses): New.
946 (STRINGIZE_1, STRINGIZE, IPA_SYM): New.
948 (ipa_sym_addrs): New.
949 (all_tracepoint_symbols_looked_up): New.
950 (in_process_agent_loaded): New.
951 (write_e_ipa_not_loaded): New.
952 (maybe_write_ipa_not_loaded): New.
953 (tracepoint_look_up_symbols): New.
954 (debug_threads) [IN_PROCESS_AGENT]: New.
955 (read_inferior_memory) [IN_PROCESS_AGENT]: New.
956 (UNKNOWN_SIDE_EFFECTS): New.
958 (flush_trace_buffer): New.
959 (stop_tracing_bkpt): New.
960 (flush_trace_buffer_bkpt): New.
961 (read_inferior_integer): New.
962 (read_inferior_uinteger): New.
963 (read_inferior_data_pointer): New.
964 (write_inferior_data_pointer): New.
965 (write_inferior_integer): New.
966 (write_inferior_uinteger): New.
967 (struct collect_static_trace_data_action): Delete.
968 (enum tracepoint_type): New.
969 (struct tracepoint) <type>: New field `type'.
970 <actions_str, step_actions, step_actions_str>: Only include in GDBserver.
971 <orig_size, obj_addr_on_target, adjusted_insn_addr>
972 <adjusted_insn_addr_end, jump_pad, jump_pad_end>: New fields.
973 (tracepoints): Use IP_AGENT_EXPORT.
974 (last_tracepoint): Don't include in the IPA.
975 (stopping_tracepoint): Use IP_AGENT_EXPORT.
976 (trace_buffer_is_full): Use IP_AGENT_EXPORT.
977 (alloced_trace_state_variables): New.
978 (trace_state_variables): Use IP_AGENT_EXPORT.
979 (traceframe_t): Delete unused variable.
980 (circular_trace_buffer): Don't include in the IPA.
981 (trace_buffer_start): Delete.
982 (struct trace_buffer_control): New.
983 (trace_buffer_free): Delete.
984 (struct ipa_trace_buffer_control): New.
985 (GDBSERVER_FLUSH_COUNT_MASK, GDBSERVER_FLUSH_COUNT_MASK_PREV)
986 (GDBSERVER_FLUSH_COUNT_MASK_CURR, GDBSERVER_UPDATED_FLUSH_COUNT_BIT):
988 (trace_buffer_ctrl): New.
989 (TRACE_BUFFER_CTRL_CURR): New.
990 (trace_buffer_start, trace_buffer_free, trace_buffer_end_free):
991 Reimplement as macros.
992 (trace_buffer_wrap): Delete.
993 (traceframe_write_count, traceframe_read_count)
994 (traceframes_created, tracing): Use IP_AGENT_EXPORT.
995 (struct tracepoint_hit_ctx) <type>: New field.
996 (struct fast_tracepoint_ctx): New.
997 (memory_barrier): New.
999 (record_tracepoint_error): Update atomically in the IPA.
1000 (clear_inferior_trace_buffer): New.
1001 (about_to_request_buffer_space): New.
1002 (trace_buffer_alloc): Handle GDBserver and inferior simulatenous
1003 updating the same buffer.
1004 (add_tracepoint): Default the tracepoint's type to trap
1005 tracepoint, and orig_size to -1.
1006 (get_trace_state_variable) [IN_PROCESS_AGENT]: Handle allocated
1008 (create_trace_state_variable): New parameter `gdb'. Handle it.
1009 (clear_installed_tracepoints): Clear fast tracepoint jumps.
1010 (cmd_qtdp): Handle fast tracepoints.
1012 (max_jump_pad_size): New.
1013 (gdb_jump_pad_head): New.
1014 (get_jump_space_head): New.
1015 (claim_jump_space): New.
1016 (sort_tracepoints): New.
1017 (MAX_JUMP_SIZE): New.
1018 (cmd_qtstart): Handle fast tracepoints. Sync tracepoints with the
1020 (stop_tracing) [IN_PROCESS_AGENT]: Don't include the tdisconnected
1021 support. Upload fast traceframes, and delete internal IPA
1023 (stop_tracing_handler): New.
1024 (flush_trace_buffer_handler): New.
1025 (cmd_qtstop): Upload fast tracepoints.
1026 (response_tracepoint): Handle fast tracepoints.
1027 (tracepoint_finished_step): Upload fast traceframes. Set the
1028 tracepoint hit context's tracepoint type.
1029 (handle_tracepoint_bkpts): New.
1030 (tracepoint_was_hit): Set the tracepoint hit context's tracepoint
1031 type. Add comment about fast tracepoints.
1032 (collect_data_at_tracepoint) [IN_PROCESS_AGENT]: Don't access the
1033 non-existing action_str field.
1034 (get_context_regcache): Handle fast tracepoints.
1035 (do_action_at_tracepoint) [!IN_PROCESS_AGENT]: Don't write the PC
1037 (fast_tracepoint_from_jump_pad_address): New.
1038 (fast_tracepoint_from_ipa_tpoint_address): New.
1039 (collecting_t): New.
1040 (force_unlock_trace_buffer): New.
1041 (fast_tracepoint_collecting): New.
1044 (write_inferior_data_ptr): New.
1045 (target_tp_heap): New.
1046 (target_malloc): New.
1047 (download_agent_expr): New.
1049 (download_tracepoints): New.
1050 (download_trace_state_variables): New.
1051 (upload_fast_traceframes): New.
1052 (IPA_FIRST_TRACEFRAME): New.
1053 (IPA_NEXT_TRACEFRAME_1): New.
1054 (IPA_NEXT_TRACEFRAME): New.
1055 [IN_PROCESS_AGENT]: Include sys/mman.h and fcntl.h.
1056 [IN_PROCESS_AGENT] (gdb_tp_heap_buffer, gdb_jump_pad_buffer)
1057 (gdb_jump_pad_buffer_end): New.
1058 [IN_PROCESS_AGENT] (initialize_tracepoint_ftlib): New.
1059 (initialize_tracepoint): Adjust.
1060 [IN_PROCESS_AGENT]: Allocate the IPA heap, and jump pad scratch
1061 buffer. Initialize the low module.
1062 * utils.c (PREFIX, TOOLNAME): New.
1063 (malloc_failure): Use PREFIX.
1064 (error): In the IPA, an error causes an exit.
1065 (fatal, warning): Use PREFIX.
1066 (internal_error): Use TOOLNAME.
1067 (NUMCELLS): Increase to 10.
1068 * configure, config.in: Regenerate.
1072 * server.c (handle_query) <qSupported>: Do two passes over the
1073 qSupported string to avoid nesting strtok.
1077 * Makefile.in (SFILES): Add $(srcdir)/proc-service.list.
1079 * configure.ac (RDYNAMIC): New AC_MSG_CHECKING wrapping. Test also
1081 * configure: Regenerate.
1082 * proc-service.list: New.
1086 * linux-low.c (linux_core_of_thread): Fix crash on invalid CONTENT.
1091 * gdbreplay.c (remote_open): Check error return from socket() call by
1092 its equality to -1 not by it being negative.
1093 * remote-utils.c (remote_open): Likewise.
1097 * config.h: Regenerate.
1101 * linux-m68k-low.c (ps_get_thread_area): Don't define if kernel
1102 doesn't provide PTRACE_GET_THREAD_AREA.
1106 * linux-m68k-low.c: Include <asm/ptrace.h>
1107 (ps_get_thread_area): Implement.
1111 * event-loop.c (struct callback_event): New struct.
1112 (callback_list): New global.
1113 (append_callback_event, delete_callback_event): New functions.
1114 (process_callback): New function.
1115 (start_event_loop): Call it.
1116 * remote-utils.c (NOT_SCHEDULED): Define.
1117 (readchar_buf, readchar_bufcnt, readchar_bufp): New static globals,
1118 moved out of readchar.
1119 (readchar): Rewrite. Call reschedule before returning.
1120 (reset_readchar): New function.
1121 (remote_close): Call it.
1122 (process_remaining, reschedule): New functions.
1123 * server.h (callback_handler_func): New typedef.
1124 (append_callback_event, delete_callback_event): Declare.
1128 * proc-service.c (ps_pglobal_lookup): Use
1129 thread_db_look_up_one_symbol.
1130 * remote-utils.c (look_up_one_symbol): Add new `may_ask_gdb'
1131 parameter. Use it instead of all_symbols_looked_up.
1132 * server.h (struct process_info) <all_symbols_looked_up>: Delete
1134 (all_symbols_looked_up): Don't declare.
1135 (look_up_one_symbol): Add new `may_ask_gdb' parameter.
1136 * thread-db.c (struct thread_db) <all_symbols_looked_up>: New
1138 (thread_db_look_up_symbols): Adjust call to look_up_one_symbol.
1139 Set all_symbols_looked_up here.
1140 (thread_db_look_up_one_symbol): New.
1141 (thread_db_get_tls_address): Adjust.
1142 (thread_db_load_search, try_thread_db_load_1): Always allocate the
1143 thread_db object on the heap, and tentatively set it in the
1145 (thread_db_init): Don't set all_symbols_looked_up here.
1146 * linux-low.h (thread_db_look_up_one_symbol): Declare.
1150 * linux-low.c (linux_kill, linux_detach): Adjust.
1151 (status_pending_p_callback): Remove redundant statement. Check
1152 for !TARGET_WAITIKIND_IGNORE, instead of
1153 TARGET_WAITKIND_STOPPED.
1154 (handle_tracepoints): Make sure LWP is locked. Adjust.
1155 (linux_wait_for_event_1): Adjust.
1156 (linux_cancel_breakpoints): New.
1157 (unsuspend_one_lwp): New.
1158 (unsuspend_all_lwps): New.
1159 (linux_wait_1): If finishing a step-over, unsuspend all lwps.
1160 (send_sigstop_callback): Change return type to int, add new
1161 `except' parameter and handle it.
1162 (suspend_and_send_sigstop_callback): New.
1163 (stop_all_lwps): Add new `suspend' and `expect' parameters, and
1164 pass them down. If SUSPEND, also increment the lwp's suspend
1166 (linux_resume_one_lwp): Add notice about resuming a suspended LWP.
1167 (need_step_over_p): Don't consider suspended LWPs.
1168 (start_step_over): Adjust.
1169 (proceed_one_lwp): Change return type to int, add new `except'
1170 parameter and handle it.
1171 (unsuspend_and_proceed_one_lwp): New.
1172 (proceed_all_lwps): Use find_inferior instead of
1174 (unstop_all_lwps): Add `unsuspend' parameter. If UNSUSPEND, them
1175 also decrement the suspend count of LWPs. Pass `except' down,
1176 instead of hacking its suspend count.
1177 (linux_pause_all): Add `freeze' parameter. Adjust.
1178 (linux_unpause_all): New.
1179 (linux_target_ops): Install linux_unpause_all.
1180 * server.c (handle_status): Adjust.
1181 * target.h (struct target_ops): New fields `unpause_all' and
1182 `cancel_breakpoints'. Add new parameter to `pause_all'.
1183 (pause_all): Add new `freeze' parameter.
1185 (cancel_breakpoints): New.
1186 * tracepoint.c (clear_installed_tracepoints): Pause threads, and
1188 (cmd_qtstart): Pause threads.
1189 (stop_tracing): Pause threads, and cancel breakpoints.
1190 * win32-low.c (win32_target_ops): Adjust.
1194 * linux-low.c (linux_wait_for_event_1): Move passing the signal to
1195 the inferior right away from here...
1196 (linux_wait_1): ... to here, and adjust to check the thread's
1197 last_resume_kind instead of the lwp's step or stop_expected flags.
1201 * README: Use consistent `GDB' and `GDBserver' spellings.
1205 * linux-low.c (linux_kill_one_lwp): Assume the lwp is stopped.
1206 (linux_kill): Stop all lwps here. Don't delete the main lwp here.
1207 (linux_detach_one_lwp): Assume the lwp is stopped.
1208 (any_thread_of): Delete.
1209 (linux_detach): Stop all lwps here. Don't blindly delete all
1211 (delete_lwp_callback): New.
1212 (linux_mourn): Delete all lwps of the process that is gone.
1213 (linux_wait_1): Don't delete the last lwp of the process here.
1214 * mem-break.h (mark_breakpoints_out): Declare.
1215 * mem-break.c (mark_breakpoints_out): New.
1216 (free_all_breakpoints): Use it.
1217 * server.c (handle_target_event): If the process is gone, mark
1219 * thread-db.c (struct thread_db) <create_bp>: New field.
1220 (thread_db_enable_reporting): Fix prototype. Store a thread event
1221 breakpoint reference in the thread_db struct.
1222 (thread_db_load_search): Clear the thread_db object.
1223 (try_thread_db_load_1): Ditto.
1224 (switch_to_process): New.
1225 (disable_thread_event_reporting): Use it.
1226 (remove_thread_event_breakpoints): New.
1227 (thread_db_detach, thread_db_mourn): Use it.
1231 * linux-low.c (linux_enable_event_reporting): New.
1232 (linux_wait_for_event_1, handle_extended_wait): Use it.
1236 * linux-low.c (linux_kill_one_lwp, linux_kill)
1237 (linux_detach_one_lwp): Adjust to send_sigstop interface change.
1238 (send_sigstop): Take an lwp_info as parameter instead. Queue a
1239 SIGSTOP even if the LWP is stopped.
1240 (send_sigstop_callback): New.
1241 (stop_all_lwps): Use send_sigstop_callback instead.
1242 (linux_resume_one_thread): Adjust.
1243 (proceed_one_lwp): Still proceed an LWP that the client has
1244 requested to stop, if we haven't reported it as stopped yet. Make
1245 sure that LWPs the client want stopped, have a pending SIGSTOP.
1249 * server.c (handle_general_set): Make static.
1251 * remote-utils.c (putpkt_binary_1): Call readchar instead of read.
1252 Print received char after testing for error/eof instead of before.
1253 (input_interrupt): Tweak comment.
1257 * server.c (start_inferior): Print inferior argv if --debug.
1261 * Makefile.in (nto_low_h nto-low.o nto-x86-low.o): New dependency lists.
1262 * nto-x86-low.c: Include server.h
1266 * win32-i386-low.c: Use __x86_64__ macro instead of __x86_64 to
1267 be consistent with other sources of this directory.
1268 (init_registers_amd64): Correct name of source file of this function
1273 * configure.srv (x86_64-*-mingw*): New configuration for Windows
1278 * win32-i386-low.c: Add 64-bit support.
1279 (CONTEXT_EXTENDED_REGISTERS): Set macro to zero if not exisiting.
1280 (init_registers_amd64): Declare.
1281 (mappings): Add 64-bit version of array.
1282 (init_windows_x86): New function.
1283 (the_low_target): Change init_arch field to init_windows_x86.
1287 * win32-low.c: Adapt to support also 64-bit architecture.
1288 (child_xfer_memory): Use uintptr_t type for local variable `addr'.
1289 (get_image_name): Use SIZE_T type for local variable `done'.
1290 (psapi_get_dll_name): Use LPVOID type for parameter `BaseAddress'.
1291 (toolhelp_get_dll_name): Idem.
1292 (handle_load_dll): Use CORE_ADDR type for local variable `load_addr'.
1293 Use uintptr_t typecast to avoid warning.
1294 (handle_unload_dll): Use uintptr_t typecast to avoid warning.
1295 (handle_exception): Use phex_nz to avoid warning.
1296 (win32_wait): Remove unused local variable `process'.
1300 * configure.srv (srv_amd64_regobj): Replace `x86-64-avx.o' by
1305 * configure.ac: Use `ws2_32' library for srv_mingw.
1306 * configure: Regenerate.
1307 * gdbreplay.c: Include winsock2.h instead of winsock.h.
1308 * remote-utils.c: Likewise.
1312 * linux-x86-low.c (xmltarget_amd64_linux_no_xml): Define only
1313 if __x86_64__ is defined.
1317 * configure: Regenerate.
1321 * server.c (handle_query): Handle 'qGetTIBAddr' query.
1322 * target.h (target_ops): New get_tib_address field.
1323 * win32-low.h (win32_thread_info): Add thread_local_base field.
1324 * win32-low.c (child_add_thread): Add tlb argument.
1325 Set thread_local_base field to TLB.
1326 (get_child_debug_event): Adapt to child_add_thread change.
1327 (win32_get_tib_address): New function.
1328 (win32_target_ops): Set get_tib_address field to
1329 win32_get_tib_address.
1330 * linux-low.c (linux_target_ops): Set get_tib_address field to NULL.
1334 * linux-low.c (linux_mourn): Also remove the process.
1335 * server.c (handle_target_event): Don't remove the process here.
1336 * nto-low.c (nto_mourn): New.
1337 (nto_target_ops): Install it.
1338 * spu-low.c (spu_mourn): New.
1339 (spu_target_ops): Install it.
1340 * win32-low.c (win32_mourn): New.
1341 (win32_target_ops): Install it.
1345 * server.h (buffer_xml_printf): Remove redundant `;'.
1349 * regcache.c (set_register_cache): Invalidate regcaches before
1350 changing the register cache layout.
1351 (regcache_invalidate_one): Allow a NULL regcache.
1352 * linux-x86-low.c (x86_linux_update_xmltarget): Invalidate
1353 regcaches before changing the register cache layout or the target
1358 * linux-x86-low.c (x86_linux_update_xmltarget): Avoid unused
1359 variable warning on Linux/x86-64.
1363 GDBserver disconnected tracing support.
1365 * linux-low.c (linux_remove_process): Delete.
1366 (add_lwp): Don't set last_resume_kind here.
1367 (linux_kill): Use `mourn'.
1368 (linux_detach): Use `thread_db_detach', and `mourn'.
1370 (linux_attach_lwp_1): Adjust comment.
1371 (linux_attach): last_resume_kind moved the thread_info; adjust.
1372 (status_pending_p_callback): Adjust.
1373 (linux_wait_for_event_1): Adjust.
1374 (count_events_callback, select_singlestep_lwp_callback)
1375 (select_event_lwp_callback, cancel_breakpoints_callback)
1376 (db_wants_lwp_stopped, linux_wait_1, need_step_over_p)
1377 (proceed_one_lwp): Adjust.
1378 (linux_async): Add debug output.
1379 (linux_thread_stopped): New.
1380 (linux_pause_all): New.
1381 (linux_target_ops): Install linux_mourn, linux_thread_stopped and
1383 * linux-low.h (struct lwp_info): Delete last_resume_kind field.
1384 (thread_db_free): Delete declaration.
1385 (thread_db_detach, thread_db_mourn): Declare.
1386 * thread-db.c (thread_db_init): Use thread_db_mourn.
1387 (thread_db_free): Delete, split in two.
1388 (disable_thread_event_reporting): New.
1389 (thread_db_detach): New.
1390 (thread_db_mourn): New.
1392 * server.h (struct thread_info) <last_resume_kind>: New field.
1393 <attached>: Add comment.
1394 <gdb_detached>: New field.
1395 (handler_func): Change return type to int.
1396 (handle_serial_event, handle_target_event): Ditto.
1397 (gdb_connected): Declare.
1399 (disconnected_tracing): Declare.
1400 (stop_tracing): Declare.
1402 * server.c (handle_query) <qSupported>: Report support for
1403 disconnected tracing.
1404 (queue_stop_reply_callback): Account for running threads.
1405 (gdb_wants_thread_stopped): New.
1406 (gdb_wants_all_threads_stopped): New.
1407 (gdb_reattached_process): New.
1408 (handle_status): Clear the `gdb_detached' flag of all processes.
1409 In all-stop, stop all threads.
1410 (main): Be sure to leave tfind mode. Handle disconnected tracing.
1411 (process_serial_event): If the remote connection breaks, or if an
1412 exit was forced with "monitor exit", force an event loop exit.
1413 Handle disconnected tracing on detach.
1414 (handle_serial_event): Adjust.
1415 (handle_target_event): If GDB isn't connected, forward events back
1416 to the inferior, unless the last process exited, in which case,
1417 exit gdbserver. Adjust interface.
1419 * remote-utils.c (remote_open): Don't block in accept. Instead
1420 register an event loop source on the listen socket file
1421 descriptor. Refactor bits into ...
1422 (listen_desc): ... this new global.
1423 (gdb_connected): ... this new function.
1424 (enable_async_notification): ... this new function.
1425 (handle_accept_event): ... this new function.
1426 (remote_close): Clear remote_desc.
1428 * inferiors.c (add_thread): Set the new thread's last_resume_kind.
1430 * target.h (struct target_ops) <mourn, thread_stopped, pause_all>:
1432 (mourn_inferior): Define.
1433 (target_process_qsupported): Avoid the dangling else problem.
1434 (thread_stopped): Define.
1435 (pause_all): Define.
1436 (target_waitstatus_to_string): Declare.
1437 * target.c (target_waitstatus_to_string): New.
1439 * tracepoint.c (tracing): Make extern.
1440 (disconnected_tracing): New.
1441 (stop_tracing): Make extern. Handle tracing stops due to GDB
1443 (cmd_qtdisconnected): New.
1444 (cmd_qtstatus): Report disconnected tracing status in trace reply.
1445 (handle_tracepoint_general_set): Handle QTDisconnected.
1447 * event-loop.c (event_handler_func): Change return type to int.
1448 (process_event): Bail out if the event handler wants the event
1450 (handle_file_event): Ditto.
1451 (start_event_loop): Bail out if the event handler wants the event
1454 * nto-low.c (nto_target_ops): Adjust.
1455 * spu-low.c (spu_wait): Don't remove the process here.
1456 (spu_target_ops): Adjust.
1457 * win32-low.c (win32_wait): Don't remove the process here.
1458 (win32_target_ops): Adjust.
1462 * regcache.c (realloc_register_cache): Invalidate inferior's
1463 regcache before recreating it.
1467 * tracepoint.c (cmd_qtstatus): Report trace buffer circularity.
1472 * server.h (LONGEST): New.
1473 (struct thread_info) <while_stepping>: New field.
1474 (unpack_varlen_hex, xrealloc, pulongest, plongest, phex_nz):
1476 (initialize_tracepoint, handle_tracepoint_general_set)
1477 (handle_tracepoint_query, tracepoint_finished_step)
1478 (tracepoint_was_hit, release_while_stepping_state_list):
1479 (current_traceframe): Declare.
1480 * server.c (handle_general_set): Handle tracepoint packets.
1482 (write_memory): New.
1483 (handle_search_memory_1): Use read_memory.
1484 (handle_query): Report support for conditional tracepoints, trace
1485 state variables, and tracepoint sources. Handle tracepoint
1487 (main): Initialize the tracepoints module.
1488 (process_serial_event): Handle traceframe reads/writes.
1490 * linux-low.c (handle_tracepoints): New.
1491 (linux_wait_1): Call it.
1492 (linux_resume_one_lwp): Handle while-stepping.
1493 (linux_supports_tracepoints, linux_read_pc, linux_write_pc): New.
1494 (linux_target_ops): Install them.
1495 * linux-low.h (struct linux_target_ops) <supports_tracepoints>:
1497 * linux-x86-low.c (x86_supports_tracepoints): New.
1498 (the_low_target). Install it.
1500 * mem-break.h (delete_breakpoint): Declare.
1501 * mem-break.c (delete_breakpoint): Make external.
1503 * target.h (struct target_ops): Add `supports_tracepoints',
1504 `read_pc', and `write_pc' fields.
1505 (target_supports_tracepoints): Define.
1506 * utils.c (xrealloc, decimal2str, pulongest, plongest, thirty_two)
1509 * regcache.h (struct regcache) <registers_owned>: New field.
1510 (init_register_cache, regcache_cpy): Declare.
1511 (regcache_read_pc, regcache_write_pc): Declare.
1512 (register_cache_size): Declare.
1513 (supply_regblock): Declare.
1514 * regcache.c (init_register_cache): New.
1515 (new_register_cache): Use it.
1516 (regcache_cpy): New.
1517 (register_cache_size): New.
1518 (supply_regblock): New.
1519 (regcache_read_pc, regcache_write_pc): New.
1521 * tracepoint.c: New.
1523 * Makefile.in (OBS): Add tracepoint.o.
1524 (tracepoint.o): New rule.
1528 * Makefile.in (clean): Also remove i386-mmx.c i386-mmx-linux.c.
1530 (i386-mmx.c): Likewise.
1531 (i386-mmx-linux.o): Likewise.
1532 (i386-mmx-linux.c): Likewise.
1534 * configure.srv (srv_i386_regobj): Add i386-mmx.o.
1535 (srv_i386_linux_regobj): Add i386-mmx-linux.o.
1536 (srv_i386_xmlfiles): Add i386/i386-mmx.xml.
1537 (srv_i386_linux_xmlfiles): Add i386/i386-mmx-linux.xml.
1539 * linux-x86-low.c (init_registers_i386_mmx_linux): New.
1540 (x86_linux_update_xmltarget): Call init_registers_i386_mmx_linux
1541 and return if ptrace PTRACE_GETFPXREGS failed in 32bit.
1545 * Makefile.in (clean): Updated.
1547 (i386-avx.c): Likewise.
1548 (i386-avx-linux.o): Likewise.
1549 (i386-avx-linux.c): Likewise.
1550 (amd64-avx.o): Likewise.
1551 (amd64-avx.c): Likewise.
1552 (amd64-avx-linux.o): Likewise.
1553 (amd64-avx-linux.c): Likewise.
1555 * configure.srv (srv_i386_regobj): Add i386-avx.o.
1556 (srv_i386_linux_regobj): Add i386-avx-linux.o.
1557 (srv_amd64_regobj): Add amd64-avx.o.
1558 (srv_amd64_linux_regobj): Add amd64-avx-linux.o.
1559 (srv_i386_32bit_xmlfiles): Add i386/32bit-avx.xml.
1560 (srv_i386_64bit_xmlfiles): Add i386/64bit-avx.xml.
1561 (srv_i386_xmlfiles): Add i386/i386-avx.xml.
1562 (srv_amd64_xmlfiles): Add i386/amd64-avx.xml.
1563 (srv_i386_linux_xmlfiles): Add i386/i386-avx-linux.xml.
1564 (srv_amd64_linux_xmlfiles): Add i386/amd64-avx-linux.xml.
1566 * i387-fp.c: Include "i386-xstate.h".
1568 (i387_cache_to_xsave): Likewise.
1569 (i387_xsave_to_cache): Likewise.
1570 (x86_xcr0): Likewise.
1572 * i387-fp.h (i387_cache_to_xsave): Likewise.
1573 (i387_xsave_to_cache): Likewise.
1574 (x86_xcr0): Likewise.
1576 * linux-arm-low.c (target_regsets): Initialize nt_type to 0.
1577 * linux-crisv32-low.c (target_regsets): Likewise.
1578 * linux-m68k-low.c (target_regsets): Likewise.
1579 * linux-mips-low.c (target_regsets): Likewise.
1580 * linux-ppc-low.c (target_regsets): Likewise.
1581 * linux-s390-low.c (target_regsets): Likewise.
1582 * linux-sh-low.c (target_regsets): Likewise.
1583 * linux-sparc-low.c (target_regsets): Likewise.
1584 * linux-xtensa-low.c (target_regsets): Likewise.
1586 * linux-low.c: Include <sys/uio.h>.
1587 (regsets_fetch_inferior_registers): Support nt_type.
1588 (regsets_store_inferior_registers): Likewise.
1589 (linux_process_qsupported): New.
1590 (linux_target_ops): Add linux_process_qsupported.
1592 * linux-low.h (regset_info): Add nt_type.
1593 (linux_target_ops): Add process_qsupported.
1595 * linux-x86-low.c: Include "i386-xstate.h", "elf/common.h"
1597 (init_registers_i386_avx_linux): New.
1598 (init_registers_amd64_avx_linux): Likewise.
1599 (xmltarget_i386_linux_no_xml): Likewise.
1600 (xmltarget_amd64_linux_no_xml): Likewise.
1601 (PTRACE_GETREGSET): Likewise.
1602 (PTRACE_SETREGSET): Likewise.
1603 (x86_fill_xstateregset): Likewise.
1604 (x86_store_xstateregset): Likewise.
1605 (use_xml): Likewise.
1606 (x86_linux_update_xmltarget): Likewise.
1607 (x86_linux_process_qsupported): Likewise.
1608 (target_regsets): Add NT_X86_XSTATE entry and Initialize nt_type.
1609 (x86_arch_setup): Don't call init_registers_amd64_linux nor
1610 init_registers_i386_linux here. Call
1611 x86_linux_update_xmltarget.
1612 (the_low_target): Add x86_linux_process_qsupported.
1614 * server.c (handle_query): Call target_process_qsupported.
1616 * target.h (target_ops): Add process_qsupported.
1617 (target_process_qsupported): New.
1621 * inferiors.c (add_thread): Set last_status kind to
1622 TARGET_WAITKIND_IGNORE.
1623 * linux-low.c (cancel_breakpoint): Remove unnecessary regcache
1624 fetch. Use ptid_of. Avoid unnecessary get_lwp_thread calls.
1625 (linux_wait_1): Move `thread' local definition to block that uses
1626 it. Don't NULL initialize `event_child'.
1627 (linux_resume_one_thread): Avoid unnecessary get_lwp_thread calls.
1628 Alway set the thread's last_status to TARGET_WAITKIND_IGNORE.
1629 * linux-x86-low.c (x86_breakpoint_at): Read raw memory.
1633 * linux-low.c (get_stop_pc): Don't adjust the PC if stopped with
1634 an extended waitstatus, or by a watchpoint.
1635 (cancel_breakpoints_callback): Don't cancel a breakpoint if the
1636 thread was stepping or has been stopped by a watchpoint.
1640 * mem-break.c (struct raw_breakpoint): New field shlib_disabled.
1641 (set_gdb_breakpoint_at): If GDB is inserting a breakpoint on top
1642 of another, then delete the previous, and validate all
1644 (validate_inserted_breakpoint): New.
1645 (delete_disabled_breakpoints): New.
1646 (validate_breakpoints): New.
1647 (check_mem_read): Validate breakpoints before trusting their
1648 shadow. Delete disabled breakpoints.
1649 (check_mem_write): Validate breakpoints before trusting they
1650 should be inserted. Delete disabled breakpoints.
1651 * mem-break.h (validate_breakpoints):
1652 * server.c (handle_query): Validate breakpoints when we see a
1657 * linux-low.c (linux_wait_1): Avoid setting need_step_over is
1658 there's a GDB breakpoint at stop_pc. Always report a trap to GDB
1659 if we could tell there's a GDB breakpoint at stop_pc.
1660 (need_step_over_p): Don't do a step over if we find a GDB
1661 breakpoint at the resume PC.
1663 * mem-break.c (struct raw_breakpoint): New.
1664 (enum bkpt_type): New type `gdb_breakpoint'.
1665 (struct breakpoint): Delete the `PC', `old_data' and `inserted'
1666 fields. New field `raw'.
1667 (find_raw_breakpoint_at): New.
1668 (set_raw_breakpoint_at): Handle refcounting. Create a raw
1670 (set_breakpoint_at): Adjust.
1671 (delete_raw_breakpoint): New.
1672 (release_breakpoint): New.
1673 (delete_breakpoint): Rename to...
1674 (delete_breakpoint_1): ... this. Add proc parameter. Use
1675 release_breakpoint. Return ENOENT.
1676 (delete_breakpoint): Reimplement.
1677 (find_breakpoint_at): Delete.
1678 (find_gdb_breakpoint_at): New.
1679 (delete_breakpoint_at): Delete.
1680 (set_gdb_breakpoint_at): New.
1681 (delete_gdb_breakpoint_at): New.
1682 (gdb_breakpoint_here): New.
1683 (set_reinsert_breakpoint): Use release_breakpoint.
1684 (uninsert_breakpoint): Rename to ...
1685 (uninsert_raw_breakpoint): ... this.
1686 (uninsert_breakpoints_at): Adjust to handle raw breakpoints.
1687 (reinsert_raw_breakpoint): Change parameter type to
1689 (reinsert_breakpoints_at): Adjust to handle raw breakpoints
1691 (check_breakpoints): Adjust. Use release_breakpoint.
1692 (breakpoint_here): Rewrite using find_raw_breakpoint_at.
1693 (breakpoint_inserted_here): Ditto.
1694 (check_mem_read): Adjust to iterate over raw breakpoints instead.
1695 Don't trust the breakpoint's shadow if it is not inserted.
1696 (check_mem_write): Adjust to iterate over raw breakpoints instead.
1697 (delete_all_breakpoints): Adjust.
1698 (free_all_breakpoints): Mark all breakpoints as uninserted, and
1699 use delete_breakpoint_1.
1701 * mem-break.h (breakpoints_supported): Delete declaration.
1702 (set_gdb_breakpoint_at): Declare.
1703 (gdb_breakpoint_here): Declare.
1704 (delete_breakpoint_at): Delete.
1705 (delete_gdb_breakpoint_at): Declare.
1707 * server.h (struct raw_breakpoint): Forward declare.
1708 (struct process_info): New field `raw_breakpoints'.
1710 * linux-x86-low.c (x86_insert_point, x86_remote_point): Handle Z0
1715 * linux-low.c (status_pending_p_callback): Fix comment.
1716 (linux_wait_for_event_1): Move most of the internal breakpoint
1717 handling from here...
1718 (linux_wait_1): ... to here.
1719 (count_events_callback): New.
1720 (select_singlestep_lwp_callback): New.
1721 (select_event_lwp_callback): New.
1722 (cancel_breakpoints_callback): New.
1723 (select_event_lwp): New.
1724 (linux_wait_1): Simplify internal breakpoint handling. Give equal
1725 priority to all LWPs that have had events that should be reported
1726 to the client. Cancel breakpoints when about to reporting the
1727 event to the client, not while stopping lwps. No longer cancel
1728 finished single-steps here.
1729 (cancel_finished_single_step): Delete.
1730 (cancel_finished_single_steps): Delete.
1734 * mem-break.c (enum bkpt_type): New.
1735 (struct breakpoint): New field `type'.
1736 (set_breakpoint_at): Change return type to struct breakpoint
1737 pointer. Set type to `other_breakpoint' by default.
1738 (delete_breakpoint): Rewrite, supporting more than one breakpoint
1739 in the breakpoint list.
1740 (delete_reinsert_breakpoints): Only delete reinsert breakpoints.
1741 (reinsert_breakpoint): Rename to ...
1742 (reinsert_raw_breakpoint): ... this.
1743 (reinsert_breakpoints_at): Adjust.
1744 * mem-break.h (struct breakpoint): Declare.
1745 (set_breakpoint_at): Change return type to struct breakpoint
1750 * server.c (handle_query): Assign, not compare.
1754 Teach linux gdbserver to step-over-breakpoints.
1756 * linux-low.c (can_hardware_single_step): New.
1757 (supports_breakpoints): New.
1758 (handle_extended_wait): If stopping threads, read the stop pc of
1761 (get_stop_pc): Add `lwp' parameter. Handle it. Bail out if the
1762 low target doesn't support retrieving the PC.
1763 (add_lwp): Set last_resume_kind to resume_continue.
1764 (linux_attach_lwp_1): Adjust comments. Always set stop_expected.
1765 (linux_attach): Don't clear stop_expected. Set the lwp's
1766 last_resume_kind to resume_stop.
1767 (linux_detach_one_lwp): Don't check for removed breakpoints.
1768 (check_removed_breakpoint): Delete.
1769 (status_pending_p): Rename to ...
1770 (status_pending_p_callback): ... this. Don't check for removed
1771 breakpoints. Don't consider threads that are stopped from GDB's
1773 (linux_wait_for_lwp): Always read the stop_pc here.
1774 (cancel_breakpoint): New.
1775 (step_over_bkpt): New global.
1776 (linux_wait_for_event_1): Implement stepping over breakpoints.
1777 (gdb_wants_lwp_stopped): New.
1778 (gdb_wants_all_stopped): New.
1779 (linux_wait_1): Tag threads as gdb-wants-stopped. Cancel finished
1780 single-step traps here. Store the thread's last reported target
1782 (send_sigstop): Don't clear stop_expected. Always set it,
1784 (mark_lwp_dead): Remove reference to pending_is_breakpoint.
1785 (cancel_finished_single_step): New.
1786 (cancel_finished_single_steps): New.
1787 (wait_for_sigstop): Don't cancel finished single-step traps here.
1788 (linux_resume_one_lwp): Don't check for removed breakpoints.
1789 Don't set `step' on non-hardware step archs.
1790 (linux_set_resume_request): Ignore resume_stop requests if already
1791 stopping or stopped. Set the lwp's last_resume_kind.
1792 (resume_status_pending_p): Don't check for removed breakpoints.
1793 (need_step_over_p): New.
1794 (start_step_over): New.
1795 (finish_step_over): New.
1796 (linux_resume_one_thread): Always queue a sigstop for resume_stop
1797 requests. Clear the thread's last reported target waitstatus.
1798 Don't use the `suspended' flag. Don't consider pending breakpoints.
1799 (linux_resume): Start a step-over if necessary.
1800 (proceed_one_lwp): New.
1801 (proceed_all_lwps): New.
1802 (unstop_all_lwps): New.
1803 * linux-low.h (struct lwp_info): Rewrite comment for the
1804 `suspended' flag. Add the `stop_pc' field. Delete the
1805 `pending_stop_pc' field. Tweak the `stepping' flag's comment.
1806 Add `'last_resume_kind' and `need_step_over' fields.
1807 * inferiors.c (struct thread_info): Delete, moved elsewhere.
1808 * mem-break.c (struct breakpoint): Delete `reinserting' flag.
1809 Delete `breakpoint_to_reinsert' field. New flag `inserted'.
1810 (set_raw_breakpoint_at): New.
1811 (set_breakpoint_at): Rewrite to use it.
1812 (reinsert_breakpoint_handler): Delete.
1813 (set_reinsert_breakpoint): New.
1814 (reinsert_breakpoint_by_bp): Delete.
1815 (delete_reinsert_breakpoints): New.
1816 (uninsert_breakpoint): Rewrite.
1817 (uninsert_breakpoints_at): New.
1818 (reinsert_breakpoint): Rewrite.
1819 (reinsert_breakpoints_at): New.
1820 (check_breakpoints): Rewrite.
1821 (breakpoint_here): New.
1822 (breakpoint_inserted_here): New.
1823 (check_mem_read): Adjust.
1824 * mem-break.h (breakpoints_supported, breakpoint_here)
1825 (breakpoint_inserted_here, set_reinsert_breakpoint): Declare.
1826 (reinsert_breakpoint_by_bp): Delete declaration.
1827 (delete_reinsert_breakpoints): Declare.
1828 (reinsert_breakpoint): Delete declaration.
1829 (reinsert_breakpoints_at): Declare.
1830 (uninsert_breakpoint): Delete declaration.
1831 (uninsert_breakpoints_at): Declare.
1832 (check_breakpoints): Adjust prototype.
1833 * server.h: Adjust include order.
1834 (struct thread_info): Declare here. Add a `last_status' field.
1838 * server.c (crc32): New function.
1839 (handle_query): Add handling for 'qCRC:' request.
1843 * linux-x86-low.c (x86_linux_prepare_to_resume): Clear DR6 if the
1844 lwp had been stopped by a watchpoint.
1848 * server.h (internal_error): Declare.
1849 (gdb_assert, ASSERT_FUNCTION, gdb_assert_fail): Define.
1850 * utils.c (internal_error): New function.
1854 * configure.srv: Fix typo setting srv_regobj.
1858 * linux-low.c (fetch_register): Avoid passing a non string literal
1860 (usr_store_inferior_registers): Ditto.
1864 * linux-low.c (linux_write_memory): Bail out early if peeking
1869 * linux-low.h (struct lwp_info): New fields
1870 `stopped_by_watchpoint' and `stopped_data_address'.
1871 * linux-low.c (linux_wait_for_lwp): Check for watchpoint triggers
1872 here, and cache them in the lwp object.
1873 (wait_for_sigstop): Check stopped_by_watchpoint lwp field
1875 (linux_resume_one_lwp): Clear the lwp's stopped_by_watchpoint
1877 (linux_stopped_by_watchpoint): Rewrite.
1878 (linux_stopped_data_address): Rewrite.
1882 * linux-low.c (linux_wait_for_lwp): Fetch the regcache after
1883 switching the current inferior, not before.
1887 * Makefile.in (clean): Replace reg-i386.c, reg-x86-64.c,
1888 reg-i386-linux.c and reg-x86-64-linux.c with i386.c, amd64.c,
1889 i386-linux.c and amd64-linux.c.
1890 (reg-i386.o): Removed.
1891 (reg-i386.c): Likewise.
1892 (reg-i386-linux.o): Likewise.
1893 (reg-i386-linux.c): Likewise.
1894 (reg-x86-64.o): Likewise.
1895 (reg-x86-64.c): Likewise.
1896 (reg-x86-64-linux.o): Likewise.
1897 (reg-x86-64-linux.c): Likewise.
1900 (i386-linux.o): Likewise.
1901 (i386-linux.c): Likewise.
1902 (amd64.o): Likewise.
1903 (amd64.c): Likewise.
1904 (amd64-linux.o): Likewise.
1905 (amd64-linux.c): Likewise.
1907 * configure.srv (srv_i386_regobj): New.
1908 (srv_i386_linux_regobj): Likewise.
1909 (srv_amd64_regobj): Likewise.
1910 (srv_amd64_linux_regobj): Likewise.
1911 (srv_i386_32bit_xmlfiles): Likewise.
1912 (srv_i386_64bit_xmlfiles): Likewise.
1913 (srv_i386_xmlfiles): Likewise.
1914 (srv_amd64_xmlfiles): Likewise.
1915 (srv_i386_linux_xmlfiles): Likewise.
1916 (srv_amd64_linux_xmlfiles): Likewise.
1917 (i[34567]86-*-cygwin*): Set srv_regobj to $srv_i386_regobj. Set
1918 srv_xmlfiles to $srv_i386_xmlfiles.
1919 (i[34567]86-*-mingw32ce*): Likewise.
1920 (i[34567]86-*-mingw*): Likewise.
1921 (i[34567]86-*-nto*): Likewise.
1922 (i[34567]86-*-linux*): Set srv_regobj to $srv_i386_linux_regobj
1923 and $srv_amd64_linux_regobj. Set srv_xmlfiles to
1924 $srv_i386_linux_xmlfiles and $srv_amd64_linux_xmlfiles.
1925 (x86_64-*-linux*): Likewise.
1927 * linux-x86-low.c (init_registers_x86_64_linux): Removed.
1928 (init_registers_amd64_linux): New.
1929 (x86_arch_setup): Replace init_registers_x86_64_linux with
1930 init_registers_amd64_linux.
1934 * configure.ac: Check for libdl. If it is not available link against
1935 static libthread_db.
1936 * configure: Regenerate.
1942 * i386-low.c (i386_length_and_rw_bits): Throw a fatal error if
1943 handing a read watchpoint.
1944 (i386_low_insert_watchpoint): Read watchpoints aren't supported.
1948 * linux-low.c (linux_supports_tracefork_flag): Document.
1949 (linux_look_up_symbols): Add comment.
1953 * regcache.c (supply_register): Clear regcache if buf is NULL.
1958 * inferiors.c (find_inferior): Add function documentation.
1959 (unloaded_dll): Handle the case where the unloaded dll has not
1960 been previously registered in the dll list.
1964 * linux-arm-low.c (thumb_breakpoint_len): Delete.
1965 (thumb2_breakpoint): New.
1966 (arm_breakpoint_at): Check for Thumb-2 breakpoints.
1970 * linux-low.c (get_stop_pc): Check for SIGTRAP.
1971 (linux_wait_for_event_1): Handle SIGILL and SIGSEGV as possible
1976 * linux-ppc-low.c (ppc_arch_setup): Adjust to regcache changes.
1980 * linux-s390-low.c (s390_collect_ptrace_register)
1981 (s390_supply_ptrace_register): Adjust it for the new regcache parameter.
1985 * linux-low.c (PTRACE_ARG3_TYPE): Change from long to void*.
1986 (PTRACE_ARG4_TYPE): New macro.
1987 (handle_extended_wait): Cast ptrace arg4 to PTRACE_ARG4_TYPE.
1988 (linux_wait_for_event_1, linux_resume_one_lwp): Ditto.
1989 (fetch_register): Cast to uintptr_t before casting to PTRACE_ARG3_TYPE.
1990 (usr_store_inferior_registers): Ditto.
1991 (linux_read_memory, linux_write_memory): Ditto.
1992 (linux_test_for_tracefork): Ditto.
1994 * linux-arm-low.c: Remove redundant include of gdb_proc_service.h.
1995 Only include elf.h if gdb_proc_service.h didn't include linux/elf.h.
1999 * proc-service.c (ps_lgetregs): Don't refetch registers from the
2004 * spu-low.c (spu_fetch_registers, spu_store_registers): Change
2005 prototype to take a regcache. Adjust.
2009 * regcache.h (struct thread_info): Forward declare.
2010 (struct regcache): New.
2011 (new_register_cache): Adjust prototype.
2012 (get_thread_regcache): Declare.
2013 (free_register_cache): Adjust prototype.
2014 (registers_to_string, registers_from_string): Ditto.
2015 (supply_register, supply_register_by_name, collect_register)
2016 (collect_register_as_string, collect_register_by_name): Ditto.
2017 * regcache.c (struct inferior_regcache_data): Delete.
2018 (get_regcache): Rename to ...
2019 (get_thread_regcache): ... this. Adjust. Switch inferior before
2021 (regcache_invalidate_one): Adjust.
2022 (regcache_invalidate): Fix prototype.
2023 (new_register_cache): Return the new register cache.
2024 (free_register_cache): Change prototype.
2025 (realloc_register_cache): Adjust.
2026 (registers_to_string): Change prototype to take a regcache. Adjust.
2027 (registers_from_string): Ditto.
2028 (register_data): Ditto.
2029 (supply_register): Ditto.
2030 (supply_register_by_name): Ditto.
2031 (collect_register): Ditto.
2032 (collect_register_as_string): Ditto.
2033 (collect_register_by_name): Ditto.
2034 * server.c (process_serial_event): Adjust.
2035 * linux-low.h (regset_fill_func, regset_store_func): Change
2037 (get_pc, set_pc, collect_ptrace_register, supply_ptrace_register):
2039 * linux-low.c (get_stop_pc): Adjust.
2040 (check_removed_breakpoint): Adjust.
2041 (linux_wait_for_event): Adjust.
2042 (linux_resume_one_lwp): Adjust.
2043 (fetch_register): Add regcache parameter. Adjust.
2044 (usr_store_inferior_registers): Ditto.
2045 (regsets_fetch_inferior_registers): Ditto.
2046 (regsets_store_inferior_registers): Ditto.
2047 (linux_fetch_registers, linux_store_registers): Ditto.
2048 * i387-fp.c (i387_cache_to_fsave): Change prototype to take a
2050 (i387_fsave_to_cache, i387_cache_to_fxsave, i387_fxsave_to_cache): Ditto.
2051 * i387-fp.h (i387_cache_to_fsave, i387_fsave_to_cache): Change
2052 prototype to take a regcache.
2053 (i387_cache_to_fxsave, i387_fxsave_to_cache): Ditto.
2054 * remote-utils.c (convert_ascii_to_int, outreg)
2055 (prepare_resume_reply): Change prototype to take a regcache.
2057 * target.h (struct target_ops) <fetch_registers, store_registers>:
2058 Change prototype to take a regcache.
2059 (fetch_inferior_registers, store_inferior_registers): Change
2060 prototype to take a regcache. Adjust.
2061 * proc-service.c (ps_lgetregs): Adjust.
2062 * linux-x86-low.c (x86_fill_gregset, x86_store_gregset)
2063 (x86_fill_fpregset, x86_store_fpregset, x86_fill_fpxregset)
2064 (x86_store_fpxregset, x86_get_pc, x86_set_pc): Change prototype to
2065 take a regcache. Adjust.
2066 * linux-arm-low.c (arm_fill_gregset, arm_store_gregset)
2067 (arm_fill_wmmxregset, arm_store_wmmxregset, arm_fill_vfpregset)
2068 (arm_store_vfpregset, arm_get_pc, arm_set_pc):
2069 (arm_breakpoint_at): Change prototype to take a regcache. Adjust.
2070 * linux-cris-low.c (cris_get_pc, cris_set_pc)
2071 (cris_cannot_fetch_register):
2072 (cris_breakpoint_at): Change prototype to take a regcache.
2074 * linux-crisv32-low.c (cris_get_pc, cris_set_pc,
2075 cris_reinsert_addr, cris_write_data_breakpoint): Change prototype
2076 to take a regcache. Adjust.
2077 (cris_breakpoint_at, cris_insert_point, cris_remove_point):
2079 * linux-m32r-low.c (m32r_get_pc, m32r_set_pc): Change prototype to
2080 take a regcache. Adjust.
2081 * linux-m68k-low.c (m68k_fill_gregset, m68k_store_gregset)
2082 (m68k_fill_fpregset, m68k_store_fpregset, m68k_get_pc,
2083 (m68k_set_pc): Change prototype to take a regcache. Adjust.
2084 * linux-mips-low.c (mips_get_pc):
2085 (mips_set_pc): Change prototype to take a regcache. Adjust.
2086 (mips_reinsert_addr): Adjust.
2087 (mips_collect_register): Change prototype to take a regcache.
2089 (mips_supply_register):
2090 (mips_collect_register_32bit, mips_supply_register_32bit)
2091 (mips_fill_gregset, mips_store_gregset, mips_fill_fpregset)
2092 (mips_store_fpregset): Ditto.
2093 * linux-ppc-low.c (ppc_supply_ptrace_register, ppc_supply_ptrace_register):
2095 (parse_spufs_run): Adjust.
2096 (ppc_get_pc, ppc_set_pc, ppc_fill_gregset, ppc_fill_vsxregset)
2097 (ppc_store_vsxregset, ppc_fill_vrregset, ppc_store_vrregset)
2098 (ppc_fill_evrregset, ppc_store_evrregset): Change prototype to
2099 take a regcache. Adjust.
2100 * linux-s390-low.c (s390_collect_ptrace_register)
2101 (s390_supply_ptrace_register, s390_fill_gregset, s390_get_pc)
2102 (s390_set_pc): Change prototype to take a regcache. Adjust.
2103 (s390_arch_setup): Adjust.
2104 * linux-sh-low.c (sh_get_pc, sh_breakpoint_at)
2105 (sh_fill_gregset): Change prototype to take a regcache. Adjust.
2106 * linux-sparc-low.c (sparc_fill_gregset_to_stack)
2107 (sparc_fill_gregset, sparc_store_gregset_from_stack)
2108 (sparc_store_gregset, sparc_get_pc): Change prototype to take a
2110 (sparc_breakpoint_at): Adjust.
2111 * linux-xtensa-low.c (xtensa_fill_gregset):
2112 (xtensa_store_gregset):
2113 (xtensa_fill_xtregset, xtensa_store_xtregset, xtensa_get_pc)
2114 (xtensa_set_pc): Change prototype to take a regcache. Adjust.
2115 * nto-low.c (nto_fetch_registers, nto_store_registers): Change
2116 prototype to take a regcache. Adjust.
2117 * win32-arm-low.c (arm_fetch_inferior_register)
2118 (arm_store_inferior_register): Change prototype to take a
2120 * win32-i386-low.c (i386_fetch_inferior_register)
2121 (i386_store_inferior_register): Change prototype to take a
2123 * win32-low.c (child_fetch_inferior_registers)
2124 (child_store_inferior_registers): Change prototype to take a
2126 (win32_wait): Adjust.
2127 (win32_fetch_inferior_registers): Change prototype to take a
2129 (win32_store_inferior_registers): Adjust.
2130 * win32-low.h (struct win32_target_ops) <fetch_inferior_register,
2131 store_inferior_register>: Change prototype to take a regcache.
2135 * linux-low.c (linux_create_inferior): Wrap use of __SIGRTMIN in
2137 (linux_wait_for_event1, linux_init_signals): Ditto.
2138 (W_STOPCODE): Provide definition if missing.
2142 * linux-low.c (linux_core_of_thread): New.
2143 (compare_ints, show_process, list_threads): New.
2144 (linux_qxfer_osdata): Report threads and cores.
2145 (linux_target_op): Register linux_core_of_thread.
2146 * remote-utils.c (prepare_resume_reply): Report the core.
2147 (buffer_xml_printf): Support %d specifier.
2148 * server.c (handle_threads_qxfer_proper, handle_threads_qxfer):
2150 (handle_query): Handle qXfer:threads. Announce availability
2152 * target.h (struct target_ops): New field core_of_thread.
2156 * Makefile.in (clean): Remove new generated files.
2157 (reg-s390.o, reg-s390.c): Remove rules.
2158 (reg-s390x.o, reg-s390x.c): Likewise.
2159 (s390-linux32.o, s390-linux32.c): Add rules.
2160 (s390-linux64.o, s390-linux64.c): Likewise.
2161 (s390x-linux64.o, s390x-linux64.c): Likewise.
2162 * configure.srv (s390*-*-linux*): Update srv_regobj and srv_xmlfiles.
2163 * linux-s390-low.c: Include <elf.h>.
2164 (HWCAP_S390_HIGH_GPRS): Define if undefined.
2165 (init_registers_s390): Remove prototype.
2166 (init_registers_s390x): Likewise.
2167 (init_registers_s390_linux32): Add prototype.
2168 (init_registers_s390_linux64): Likewise.
2169 (init_registers_s390x_linux64): Likewise.
2170 (s390_num_regs_3264): New define.
2171 (s390_regmap_3264): New global variable.
2172 (s390_cannot_fetch_register): Remove obsolete check.
2173 (s390_cannot_store_register): Likewise.
2174 (s390_collect_ptrace_register): Handle upper/lower register halves.
2175 (s390_supply_ptrace_register): Likewise.
2176 (s390_fill_gregset): Update to register number changes.
2177 (s390_get_hwcap): New routine.
2178 (s390_arch_setup): Detect 32-bit process running on 64-bit system.
2179 Install appropriate regmap and register set.
2183 * server.c (gdbserver_version): Update copyright year to 2010.
2184 * gdbreplay.c (gdbreplay_version): Likewise.
2188 * linux-low.c: Delete inclusion of ansidecl.h, elf/common.h,
2189 elf/external.h. Include <elf.h> instead but only if necessary.
2193 * linux-low.c (linux_remove_process): Remove `detaching'
2194 parameter. Don't release/detach from thread_db here.
2195 (linux_kill): Release/detach from thread_db here, ...
2196 (linux_detach): ... and here, before actually detaching.
2197 (linux_wait_1): ... and here, when a process exits.
2198 * thread-db.c (any_thread_of): New.
2199 (thread_db_free): Switch the current inferior to a thread of the
2204 * linux-x86-low.c: Delete outdated comment about Elf32_Phdr.
2206 * linux-low.c (kill_lwp): Use __NR_tkill instead of SYS_tkill.
2207 Move definition of tkill_failed to ifdef __NR_tkill to avoid gcc
2208 warning ifndef __NR_tkill. Move setting of errno there too.
2209 Delete unnecessary resetting of errno after syscall.
2210 Minor comment changes to match gdb/linux-nat.c:kill_lwp.
2212 * configure.ac: Check for dladdr.
2213 * config.in: Regenerate.
2214 * configure: Regenerate.
2215 * thread-db.c (dladdr_to_soname): Only define ifdef HAVE_DLADDR.
2216 (try_thread_db_load): Update.
2218 * linux-low.c (my_waitpid): Delete unnecessary prototype.
2222 * event-loop.c: Include unistd.h if it exists.
2224 * linux-low.c (my_waitpid): Move definition away from being in
2225 between linux_tracefork_child/linux_test_for_tracefork.
2227 * gdb_proc_service.h (psaddr_t): Fix type.
2228 * thread-db.c (thread_db_info.td_thr_tls_get_addr_p): Fix
2229 signature to match glibc.
2233 * linux-low.c (linux_read_memory): Fix argument to read.
2237 * win32-low.c (get_child_debug_event): On EXIT_THREAD_DEBUG_EVENT
2238 events, don't leave current_inferior pointing at null.
2242 * win32-low.c (LOG): Delete.
2243 (OUTMSG): Output to stderr.
2244 (OUTMSG2): Conditionalize on `debug_threads' variable, instead of
2245 on compile time LOG macro.
2246 (win32_wait): Fix debug output.
2250 * win32-low.c (win32_add_one_solib): If the dll name is
2251 "ntdll.dll", prepend the system directory to the dll path.
2255 * m68k-tdep.c (m68k_gdbarch_init): Reuse previous initialization.
2260 * Makefile.in (reg-cf.o, reg-cf.c): New targets.
2261 * configure.ac: Check for __mcoldfire__ and set
2262 gdb_cv_m68k_is_coldfire.
2263 * configure.srv: Use gdb_cv_m68k_is_coldfire to select between
2264 reg-cf.o and reg-m68k.o.
2265 * configure: Regenerated.
2269 * linux-low.c (linux_remove_process): Add `detaching' parameter.
2270 Pass it to thread_db_free.
2271 (linux_kill, linux_detach, linux_wait_1): Adjust to pass the
2272 proper `detaching' argument to linux_remove_process.
2273 * linux-low.h (thread_db_free): Add `detaching' parameter.
2274 * thread-db.c (thread_db_init): Pass false as `detaching' argument
2276 (thread_db_free): Add `detaching' parameter. Only
2277 call td_ta_clear_event if detaching from process.
2281 * thread-db.c (thread_db_free): Fix typo.
2286 * thread-db.c (thread_db_free): Call td_ta_clear_event.
2290 * configure.ac (i[34567]86-*): Check if we're targetting x86-64
2291 with an i686 compiler.
2292 * configure.srv (i[34567]86-*-linux*): Pull in x86-64 handling if
2294 * configure: Rebuilt.
2300 * server.c (handle_search_memory_1): Correct read_addr initialization
2301 in loop for searching subsequent chunks.
2305 * configure.ac: New --with-libthread-db option.
2306 * thread-db.c: Allow direct dependence on libthread_db.
2307 (thread_db_free): Adjust.
2308 * config.in: Regenerate.
2309 * configure: Likewise.
2314 * thread-db.c (attach_thread): New function.
2315 (maybe_attach_thread): Return success/failure.
2316 (find_new_threads_callback): Adjust.
2317 (thread_db_find_new_threads): Loop until no new threads.
2321 * proc-service.c (ps_lgetregs): Formatting.
2325 * acinclude.m4: (SRV_CHECK_THREAD_DB, SRV_CHECK_TLS_GET_ADDR): Remove.
2326 * configure.ac: Adjust.
2327 * linux-low.h (struct process_info_private): Move members to struct
2329 (thread_db_free, thread_db_handle_monitor_command): New prototype.
2330 * linux-low.c (linux_remove_process): Adjust.
2331 (linux_wait_for_event_1, linux_look_up_symbols): Likewise.
2332 * server.c (handle_query): Move code ...
2333 (handle_monitor_command): ... here. New function.
2334 * target.h (struct target_ops): New member.
2335 * thread-db.c (struct thread_db): New.
2336 (libthread_db_search_path): New variable.
2337 (thread_db_create_event, thread_db_enable_reporting)
2338 (find_one_thread, maybe_attach_thread, find_new_threads_callback)
2339 (thread_db_find_new_threads, (thread_db_get_tls_address): Adjust.
2340 (try_thread_db_load_1, dladdr_to_soname): New functions.
2341 (try_thread_db_load, thread_db_load_search): New functions.
2342 (thread_db_init): Search for libthread_db.
2343 (thread_db_free): New function.
2344 (thread_db_handle_monitor_command): Likewise.
2345 * config.in: Regenerate.
2346 * configure: Regenerate.
2350 * spu-low.c (spu_kill): Wait for inferior to terminate.
2351 Call clear_inferiors.
2352 (spu_detach): Call clear_inferiors.
2356 * aclocal.m4: Regenerate.
2357 * config.in: Likewise.
2358 * configure: Likewise.
2362 * linux-ppc-low.c (INSTR_SC, NR_spu_run): Define.
2363 (parse_spufs_run): New function.
2364 (ppc_get_pc, ppc_set_pc): Detect and handle SPU PC.
2365 (ppc_breakpoint_at): Handle SPU breakpoints.
2369 * linux-low.c: Include <sys/stat.h> and <sys/vfs.h>.
2370 (SPUFS_MAGIC): Define.
2371 (spu_enumerate_spu_ids): New function.
2372 (linux_qxfer_spu): New function.
2373 (linux_target_ops): Install linux_qxfer_spu.
2377 * configure.srv (powerpc*-*-linux*): Add powerpc-cell32l.o
2378 and powerpc-cell64l.o to srv_regobj. Add rs6000/powerpc-cell32l.xml
2379 and rs6000/powerpc-cell64l.xml to srv_xmlfiles.
2380 * Makefile.in (powerpc-cell32l.o, powerpc-cell32l.c): New rules.
2381 (powerpc-cell64l.o, powerpc-cell64l.c): Likewise.
2382 (clean): Handle powerpc-cell32l.c and powerpc-cell64l.c.
2383 * linux-ppc-low.c (PPC_FEATURE_CELL): Define.
2384 (init_registers_powerpc_cell32l): Add prototype.
2385 (init_registers_powerpc_cell64l): Likewise.
2386 (ppc_arch_setup): Detect Cell/B.E. architecture.
2390 * Makefile.in (datarootdir): New variable.
2394 * linux-low.c (linux_write_memory): Update debugging output.
2395 * Makefile.in (clean): Add new descriptions.
2396 (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o)
2397 (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules.
2398 * configure.srv: Add new files for arm*-*-linux*.
2399 * linux-arm-low.c: Add new declarations.
2400 (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined.
2401 (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3)
2402 (HWCAP_VFPv3D16): New.
2403 (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT
2404 instead of __IWMMXT__.
2405 (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap)
2406 (arm_arch_setup): New.
2407 (target_regsets): Remove #ifdef. Add VFP regset.
2408 (the_low_target): Use arm_arch_setup.
2412 * linux-low.c (linux_kill_one_lwp): Adjust kernel workaround to skip
2413 the main thread again.
2417 Adding Neutrino gdbserver.
2418 * configure: Regenerated.
2419 * configure.ac: Add case for srv_qnx and set LIBS accordingly.
2420 * configure.srv (i[34567]86-*-nto*): New target.
2421 * nto-low.c, nto-low.h, nto-x86-low.c: New files.
2422 * remote-utils.c [__QNX__]: Include sys/iomgr.h
2423 (nto_comctrl) [__QNX__]: New function.
2424 (enable_async_io, disable_async_io) [__QNX__]: Call nto_comctrl.
2428 * configure.srv (i[34567]86-*-mingw32ce*): Add i386-low.o to
2434 * win32-i386-low.c (i386_get_thread_context): Handle systems that
2435 don't support CONTEXT_EXTENDED_REGISTERS.
2436 (i386_win32_breakpoint, i386_win32_breakpoint_len): New.
2437 (the_low_target): Install them.
2438 * win32-low.c (get_child_debug_event): Handle WaitForDebugEvent
2439 failing with ERROR_PIPE_NOT_CONNECTED.
2444 Add h/w watchpoint support to x86-linux, win32-i386.
2445 * Makefile.in (SFILES): Add i386-low.c
2446 (i386_low_h): Define.
2447 (i386-low.o): Add dependencies.
2448 (linux-x86-low.o): Add i386-low.h dependency.
2449 (win32-i386-low.o): Ditto.
2450 * i386-low.c: New file.
2451 * i386-low.h: New file.
2452 * configure.srv (i[34567]86-*-cygwin*): Add i386-low.o to srv_tgtobj.
2453 (i[34567]86-*-linux*, i[34567]86-*-mingw*, x86_64-*-linux*): Ditto.
2454 * linux-low.c (linux_add_process): Initialize arch_private.
2455 (linux_remove_process): Free arch_private.
2456 (add_lwp): Initialize arch_private.
2457 (delete_lwp): Free arch_private.
2458 (linux_resume_one_lwp): Call the_low_target.prepare_to_resume if
2460 * linux-low.h (process_info_private): New member arch_private.
2461 (lwp_info): New member arch_private.
2462 (linux_target_ops): New members new_process, new_thread,
2464 (ptid_of): New macro.
2465 * linux-x86-low.c: Include stddef.h, i386-low.h.
2466 (arch_process_info): New struct.
2467 (arch_lwp_info): New struct.
2468 (x86_linux_dr_get, x86_linux_dr_set): New functions.
2469 (i386_dr_low_set_addr, i386_dr_low_set_control): New functions.
2470 (i386_dr_low_get_status): New function.
2471 (x86_insert_point, x86_remove_point): New functions.
2472 (x86_stopped_by_watchpoint): New function.
2473 (x86_stopped_data_address): New function.
2474 (x86_linux_new_process, x86_linux_new_thread): New functions.
2475 (x86_linux_prepare_to_resume): New function.
2476 (the_low_target): Add entries for insert_point, remove_point,
2477 stopped_by_watchpoint, stopped_data_address, new_process, new_thread,
2479 * server.c (debug_hw_points): New global.
2480 (monitor_show_help): Document set debug-hw-points.
2481 (handle_query): Process "set debug-hw-points".
2482 * server.h (debug_hw_points): Declare.
2483 (paddress): Declare.
2484 * utils.c (NUMCELLS, CELLSIZE): New macros.
2485 (get_sell, xsnprintf, paddress): New functions.
2486 * win32-arm-low.c (the_low_target): Add entries for insert_point,
2487 remove_point, stopped_by_watchpoint, stopped_data_address.
2488 * win32-i386-low.c: Include i386-low.h.
2489 (debug_reg_state): Replaces dr.
2490 (i386_dr_low_set_addr, i386_dr_low_set_control): New functions.
2491 (i386_dr_low_get_status): New function.
2492 (i386_insert_point, i386_remove_point): New functions.
2493 (i386_stopped_by_watchpoint): New function.
2494 (i386_stopped_data_address): New function.
2495 (i386_initial_stuff): Update.
2496 (get_thread_context,set_thread_context,i386_thread_added): Update.
2497 (the_low_target): Add entries for insert_point,
2498 remove_point, stopped_by_watchpoint, stopped_data_address.
2499 * win32-low.c (win32_insert_watchpoint): New function.
2500 (win32_remove_watchpoint): New function.
2501 (win32_stopped_by_watchpoint): New function.
2502 (win32_stopped_data_address): New function.
2503 (win32_target_ops): Add entries for insert_watchpoint,
2504 remove_watchpoint, stopped_by_watchpoint, stopped_data_address.
2505 * win32-low.h (win32_target_ops): New members insert_point,
2506 remove_point, stopped_by_watchpoint, stopped_data_address.
2510 * server.c (process_serial_event): Re-return unsupported, not
2511 error, if the type isn't recognized. Re-allow supporting only
2512 insert or remove packets. Also call require_running for
2513 breakpoints. Add missing break statement to default case. Tidy.
2514 * target.h (struct target_ops): Rename insert_watchpoint to
2515 insert_point, and remove_watchpoint to remove_point.
2517 * linux-low.h (struct linux_target_ops): Likewise.
2518 * linux-low.c (linux_insert_watchpoint): Rename to ...
2519 (linux_insert_point): ... this. Adjust.
2520 (linux_remove_watchpoint): Rename to ...
2521 (linux_remove_point): ... this. Adjust.
2522 (linux_target_ops): Adjust.
2523 * linux-crisv32-low.c (cris_insert_watchpoint): Rename to ...
2524 (cris_insert_point): ... this.
2525 (cris_remove_watchpoint): Rename to ...
2526 (cris_remove_point): ... this.
2527 (the_low_target): Adjust.
2531 * server.c (handle_v_kill): Pass signal_pid to
2532 kill_inferior if multi_process is zero.
2536 * server.c (process_serial_event): Add support for Z0 and Z1 packet.
2537 * target.h (target_ops): Comment for *_watchpoint to make it clear
2538 the functions can get types '0' and '1'.
2542 * linux-low.c (usr_fetch_inferior_registers): Remove check for regno 0.
2543 * proc-service.c (ps_lgetregs): Pass -1 to fetch all registers.
2544 * regcache.c (get_regcache): Likewise.
2545 * spu-low.c (spu_fetch_registers): Remove 0 to -1 conversion.
2546 * win32-low.c (child_fetch_inferior_registers): Remove check for
2552 * target.h (struct target_ops) <supports_multi_process>: New
2554 (target_supports_multi_process): New.
2555 * server.c (handle_query): Even if GDB reports support, only
2556 enable multi-process if the target also supports it. Report
2557 multi-process support only if the target backend supports it.
2558 * linux-low.c (linux_supports_multi_process): New function.
2559 (linux_target_ops): Install it as target_supports_multi_process
2564 Global renaming of find_thread_pid to find_thread_ptid.
2565 * server.h (find_thread_ptid): Renamed from find_thread_pid.
2566 * inferiors.c (find_thread_ptid): Renamed from find_thread_pid.
2567 All callers updated.
2569 * linux-low.c (handle_extended_wait): Use linux_resume_one_lwp
2570 to resume the newly created thread, don't call ptrace (PTRACE_CONT)
2573 * linux-low.c (get_stop_pc): Print pc if debug_threads.
2574 (check_removed_breakpoint, linux_wait_for_lwp): Ditto.
2575 (linux_resume_one_lwp): Ditto.
2579 * linux-low.c (linux_resume_one_lwp): Change type of first arg
2580 from struct inferior_list_entry * to struct lwp_info *.
2581 All callers updated.
2585 * linux-x86-low.c: Don't include assert.h.
2586 (x86_siginfo_fixup): Use fatal, not assert.
2587 (x86_arch_setup): Fix comment.
2591 Biarch support for i386/amd64 gdbserver.
2592 * Makefile.in (SFILES): Remove linux-i386-low.c, linux-x86-64-low.c.
2593 Add linux-x86-low.c.
2594 (linux-i386-low.o, linux-x86-64-low.o): Delete.
2595 (linux-x86-low.o): Add.
2596 * linux-x86-64-low.c: Delete.
2597 * linux-i386-low.c: Delete.
2598 * linux-x86-low.c: New file.
2599 * configure.srv (i?86-linux srv_tgtobj): Replace linux-i386-low.o with
2601 (x86_64-linux srv_tgtobj): Replace linux-x86-64-low.o with
2603 (x86_64-linux srv_regobj): Add reg-i386-linux.o.
2604 * linux-low.c: Include ansidecl.h, elf/common.h, elf/external.h.
2605 (linux_child_pid_to_exec_file): New function.
2606 (elf_64_header_p, elf_64_file_p): New functions.
2607 (siginfo_fixup): New function.
2608 (linux_xfer_siginfo): New local inf_siginfo. Call siginfo_fixup to
2609 give target a chance to convert layout.
2610 * linux-low.h (linux_target_ops): New member siginfo_fixup.
2611 (linux_child_pid_to_exec_file, elf_64_file_p): Declare.
2615 * linux-low.c (regsets_fetch_inferior_registers): Fix memory leak.
2616 (regsets_store_inferior_registers): Ditto.
2622 * linux-low.c (must_set_ptrace_flags): Delete.
2623 (linux_create_inferior): Set `lwp->must_set_ptrace_flags' instead
2625 (linux_attach_lwp_1): Don't set PTRACE_SETOPTIONS here. Set
2626 `lwp->must_set_ptrace_flags' instead.
2627 (linux_wait_for_event_1): Set ptrace options here.
2628 (linux_wait_1): ... not here.
2632 * inferiors.c (started_inferior_callback): New function.
2633 (attached_inferior_callback): New function.
2634 (have_started_inferiors_p, have_attached_inferiors_p): New functions.
2635 * server.c (print_started_pid, print_attached_pid): New functions.
2636 (detach_or_kill_for_exit): New function.
2637 (main): Call it instead of for_each_inferior (kill_inferior_callback).
2638 * server.h (have_started_inferiors_p): Declare.
2639 (have_attached_inferiors_p): Declare.
2641 * inferiors.c (remove_process): Fix memory leak, free process.
2642 * linux-low.c (linux_remove_process): New function.
2643 (linux_kill): Call it instead of remove_process.
2644 (linux_detach, linux_wait_1): Ditto.
2648 * configure.srv: Add x86 Windows CE target.
2652 * inferiors.c (get_thread_process): Make global.
2653 * server.h (get_thread_process): Add prototype.
2654 * thread-db.c (find_one_thread): Use get_thread_process
2655 instead of current_process.
2656 (thread_db_get_tls_address): Do not crash if called when
2657 thread layer is not yet initialized.
2661 * remote-utils.c (prepare_resume_reply): Null-terminate packet.
2662 * spu-low.c (current_tid): Rename to ...
2663 (current_ptid): ... this.
2664 (fetch_ppc_register, fetch_ppc_memory, store_ppc_memory,
2665 spu_proc_xfer_spu, spu_resume, spu_request_interrupt): Use
2666 ptid_get_lwp (current_ptid) instead of current_tid.
2667 (spu_kill, spu_detach, spu_join, spu_wait): Use pid argument
2668 instead of current_tid. Use find_process_pid to verify pid
2669 argument is valid. Pass proper argument to remove_process.
2670 (spu_thread_alive): Compare current_ptid instead of current_tid.
2671 (spu_resume): Likewise.
2675 * linux-low.c (usr_store_inferior_registers): Declare local `pid'
2680 Implement the multiprocess extensions, and add linux multiprocess
2683 * server.h (ULONGEST): Declare.
2684 (struct ptid, ptid_t): New.
2685 (minus_one_ptid, null_ptid): Declare.
2686 (ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp)
2687 (ptid_get_tid, ptid_equal, ptid_is_pid): Declare.
2688 (struct inferior_list_entry): Change `id' type from unsigned from
2690 (struct sym_cache, struct breakpoint, struct
2691 process_info_private): Forward declare.
2692 (struct process_info): Declare.
2693 (current_process): Declare.
2694 (all_processes): Declare.
2695 (initialize_inferiors): Declare.
2696 (add_thread): Adjust to use ptid_t.
2697 (thread_id_to_gdb_id, thread_to_gdb_id, gdb_id_to_thread_id): Ditto.
2698 (add_process, remove_process, find_thread_pid): Declare.
2699 (find_inferior_id): Adjust to use ptid_t.
2700 (cont_thread, general_thread, step_thread): Change type to ptid_t.
2701 (multi_process): Declare.
2702 (push_event): Adjust to use ptid_t.
2703 (read_ptid, write_ptid): Declare.
2704 (prepare_resume_reply): Adjust to use ptid_t.
2705 (clear_symbol_cache): Declare.
2706 * inferiors.c (all_processes): New.
2707 (null_ptid, minus_one_ptid): New.
2708 (ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp)
2709 (ptid_get_tid, ptid_equal, ptid_is_pid): New.
2710 (add_thread): Change unsigned long to ptid. Remove gdb_id
2712 (thread_id_to_gdb_id, thread_to_gdb_id): Change unsigned long to ptid.
2713 (gdb_id_to_thread): Rename to ...
2714 (find_thread_pid): ... this. Change unsigned long to ptid.
2715 (gdb_id_to_thread_id, find_inferior_id): Change unsigned long to ptid.
2716 (loaded_dll, pull_pid_from_list): Adjust.
2717 (add_process, remove_process, find_process_pid)
2718 (get_thread_process, current_process, initialize_inferiors): New.
2719 * target.h (struct thread_resume) <thread>: Change type to ptid_t.
2720 (struct target_waitstatus) <related_pid>: Ditto.
2721 (struct target_ops) <kill, detach>: Add `pid' argument. Change
2723 (struct target_ops) <join>: Add `pid' argument.
2724 (struct target_ops) <thread_alive>: Change pid's type to ptid_t.
2725 (struct target_ops) <wait>: Add `ptid' field. Change return type
2727 (kill_inferior, detach_inferior, join_inferior): Add `pid' argument.
2728 (mywait): Add `ptid' argument. Change return type to ptid_t.
2729 (target_pid_to_str): Declare.
2730 * target.c (set_desired_inferior): Adjust to use ptids.
2731 (mywait): Add new `ptid' argument. Adjust.
2732 (target_pid_to_str): New.
2733 * mem-break.h (free_all_breakpoints): Declare.
2734 * mem-break.c (breakpoints): Delelete.
2735 (set_breakpoint_at, delete_breakpoint, find_breakpoint_at)
2736 (check_mem_read, check_mem_write, delete_all_breakpoints): Adjust
2737 to use per-process breakpoint list.
2738 (free_all_breakpoints): New.
2739 * remote-utils.c (struct sym_cache) <name>: Drop `const'.
2740 (symbol_cache, all_symbols_looked_up): Delete.
2742 (ishex, unpack_varlen_hex, write_ptid, hex_or_minus_one,
2744 (prepare_resume_reply): Change ptid argument's type from unsigned
2745 long to ptid_t. Adjust. Implement W;process and X;process.
2746 (free_sym_cache, clear_symbol_cache): New.
2747 (look_up_one_symbol): Adjust to per-process symbol cache. *
2748 * server.c (cont_thread, general_thread, step_thread): Change type
2751 (multi_process): New.
2752 (last_ptid): Change type to ptid_t.
2753 (struct vstop_notif) <ptid>: Change type to ptid_t.
2754 (queue_stop_reply, push_event): Change `ptid' argument's type to
2756 (discard_queued_stop_replies): Add `pid' argument.
2757 (start_inferior): Adjust to use ptids. Adjust to mywait interface
2758 changes. Don't reference the `attached' global.
2759 (attach_inferior): Adjust to mywait interface changes.
2760 (handle_query): Adjust to use ptids. Parse GDB's qSupported
2761 features. Handle and report "multiprocess+". Handle
2763 (handle_v_cont): Adjust to use ptids. Adjust to mywait interface
2765 (handle_v_kill): New.
2766 (handle_v_stopped): Adjust to use target_pid_to_str.
2767 (handle_v_requests): Allow multiple attaches and runs when
2768 multiprocess extensions are in effect. Handle "vKill".
2769 (myresume): Adjust to use ptids.
2770 (queue_stop_reply_callback): Add `arg' parameter. Handle it.
2771 (handle_status): Adjust to discard_queued_stop_replies interface
2773 (first_thread_of, kill_inferior_callback)
2774 (detach_or_kill_inferior_callback, join_inferiors_callback): New.
2775 (main): Call initialize_inferiors. Adjust to use ptids, killing
2776 and detaching from all inferiors. Handle multiprocess packet
2778 * linux-low.h: Include gdb_proc_service.h.
2779 (struct process_info_private): New.
2780 (struct linux_target_ops) <pid_of>: Use ptid_get_pid.
2781 <lwpid_of>: Use ptid_get_lwp.
2782 (get_lwp_thread): Adjust.
2783 (struct lwp_info): Add `dead' member.
2784 (find_lwp_pid): Declare.
2785 * linux-low.c (thread_db_active): Delete.
2786 (new_inferior): Adjust comment.
2787 (inferior_pid): Delete.
2788 (linux_add_process): New.
2789 (handle_extended_wait): Adjust.
2790 (add_lwp): Change unsigned long to ptid.
2791 (linux_create_inferior): Add process to processes table. Adjust
2792 to use ptids. Don't set new_inferior here.
2793 (linux_attach_lwp): Rename to ...
2794 (linux_attach_lwp_1): ... this. Add `initial' argument. Handle
2795 it. Adjust to use ptids.
2796 (linux_attach_lwp): New.
2797 (linux_attach): Add process to processes table. Don't set
2799 (struct counter): New.
2800 (second_thread_of_pid_p, last_thread_of_process_p): New.
2801 (linux_kill_one_lwp): Add `args' parameter. Handle it. Adjust to
2803 (linux_kill): Add `pid' argument. Handle it. Adjust to multiple
2804 processes. Remove process from process table.
2805 (linux_detach_one_lwp): Add `args' parameter. Handle it. Adjust
2806 to multiple processes.
2807 (any_thread_of): New.
2808 (linux_detach): Add `pid' argument, and handle it. Remove process
2809 from processes table.
2810 (linux_join): Add `pid' argument. Handle it.
2811 (linux_thread_alive): Change unsighed long argument to ptid_t.
2812 Consider dead lwps as not being alive.
2813 (status_pending_p): Rename `dummy' argument to `arg'. Filter out
2814 threads we're not interested in.
2815 (same_lwp, find_lwp_pid): New.
2816 (linux_wait_for_lwp): Change `pid' argument's type from int to
2818 (linux_wait_for_event): Rename to ...
2819 (linux_wait_for_event_1): ... this. Change `pid' argument's type
2820 from int to ptid_t. Adjust.
2821 (linux_wait_for_event): New.
2822 (linux_wait_1): Add `ptid' argument. Change return type to
2823 ptid_t. Adjust. Use last_thread_of_process_p. Remove processes
2824 that exit from the process table.
2825 (linux_wait): Add `ptid' argument. Change return type to ptid_t.
2827 (mark_lwp_dead): New.
2828 (wait_for_sigstop): Adjust to use ptids. If a process exits while
2829 stopping all threads, mark its main lwp as dead.
2830 (linux_set_resume_request, linux_resume_one_thread): Adjust to use
2832 (fetch_register, usr_store_inferior_registers)
2833 (regsets_fetch_inferior_registers)
2834 (regsets_store_inferior_registers, linux_read_memory)
2835 (linux_write_memory): Inline `inferior_pid'.
2836 (linux_look_up_symbols): Adjust to use per-process
2838 (linux_request_interrupt): Adjust to use ptids.
2839 (linux_read_auxv): Inline `inferior_pid'.
2840 (initialize_low): Don't reference thread_db_active.
2841 * gdb_proc_service.h (struct ps_prochandle) <pid>: Remove.
2842 * proc-service.c (ps_lgetregs): Use find_lwp_pid.
2843 (ps_getpid): Return the pid of the current inferior.
2844 * thread-db.c (proc_handle, thread_agent): Delete.
2845 (thread_db_create_event, thread_db_enable_reporting): Adjust to
2847 (find_one_thread): Change argument type to ptid_t. Adjust to
2849 (maybe_attach_thread): Adjust to per-process data and ptids.
2850 (thread_db_find_new_threads): Ditto.
2851 (thread_db_init): Ditto.
2852 * spu-low.c (spu_create_inferior, spu_attach): Add process to
2853 processes table. Adjust to use ptids.
2854 (spu_kill, spu_detach): Adjust interface. Remove process from
2856 (spu_join, spu_thread_alive): Adjust interface.
2857 (spu_wait): Adjust interface. Remove process from processes
2858 table. Adjust to use ptids.
2859 * win32-low.c (current_inferior_tid): Delete.
2860 (current_inferior_ptid): New.
2861 (debug_event_ptid): New.
2862 (thread_rec): Take a ptid. Adjust.
2863 (child_add_thread): Add `pid' argument. Adjust to use ptids.
2864 (child_delete_thread): Ditto.
2865 (do_initial_child_stuff): Add `attached' argument. Add process to
2867 (child_fetch_inferior_registers, child_store_inferior_registers):
2869 (win32_create_inferior): Pass 0 to do_initial_child_stuff.
2870 (win32_attach): Pass 1 to do_initial_child_stuff.
2871 (win32_kill): Adjust interface. Remove process from processes
2873 (win32_detach): Ditto.
2874 (win32_join): Adjust interface.
2875 (win32_thread_alive): Take a ptid.
2876 (win32_resume): Adjust to use ptids.
2877 (get_child_debug_event): Ditto.
2878 (win32_wait): Adjust interface. Remove exiting process from
2883 Non-stop mode support.
2885 * server.h (non_stop): Declare.
2886 (gdb_client_data, handler_func): Declare.
2887 (delete_file_handler, add_file_handler, start_event_loop):
2889 (handle_serial_event, handle_target_event, push_event)
2890 (putpkt_notif): Declare.
2891 * target.h (enum resume_kind): New.
2892 (struct thread_resume): Replace `step' field by `kind' field.
2893 (TARGET_WNOHANG): Define.
2894 (struct target_ops) <wait>: Add `options' argument.
2895 <supports_non_stop, async, start_non_stop>: New fields.
2896 (target_supports_non_stop, target_async): New.
2897 (start_non_stop): Declare.
2898 (mywait): Add `options' argument.
2899 * target.c (mywait): Add `options' argument. Print child exit
2901 (start_non_stop): New.
2902 * server.c (non_stop, own_buf, mem_buf): New globals.
2903 (struct vstop_notif): New.
2904 (notif_queue): New global.
2905 (queue_stop_reply, push_event, discard_queued_stop_replies)
2906 (send_next_stop_reply): New.
2907 (start_inferior): Adjust to use resume_kind. Adjust to mywait
2909 (attach_inferior): In non-stop mode, don't wait for the target
2911 (handle_general_set): Handle QNonStop.
2912 (handle_query): When handling qC, return the current general
2913 thread, instead of the first thread of the list.
2914 (handle_query): If the backend supports non-stop mode, include
2915 QNonStop+ in the qSupported query response.
2916 (handle_v_cont): Adjust to use resume_kind. Handle resume_stop
2918 (handle_v_attach, handle_v_run): Handle non-stop mode.
2919 (handle_v_stopped): New.
2920 (handle_v_requests): Report support for vCont;t. Handle vStopped.
2921 (myresume): Adjust to use resume_kind. Handle non-stop.
2922 (queue_stop_reply_callback): New.
2923 (handle_status): Handle non-stop mode.
2924 (main): Clear non_stop flag on reconnection. Use the event-loop.
2925 Refactor serial protocol handling from here ...
2926 (process_serial_event): ... to this new function. When GDB
2927 selects any thread, select one here. In non-stop mode, wait until
2928 GDB acks all pending events before exiting.
2929 (handle_serial_event, handle_target_event): New.
2930 * remote-utils.c (remote_open): Install remote_desc in the event
2932 (remote_close): Remove remote_desc from the event loop.
2933 (putpkt_binary): Rename to...
2934 (putpkt_binary_1): ... this. Add `is_notic' argument. Handle it.
2935 (putpkt_binary): New as wrapper around putpkt_binary_1.
2936 (putpkt_notif): New.
2937 (prepare_resume_reply): In non-stop mode, don't change the
2939 * event-loop.c: New.
2940 * Makefile.in (OBJ): Add event-loop.o.
2941 (event-loop.o): New rule.
2943 * linux-low.h (pid_of): Moved here.
2945 (get_lwp_thread): Use lwpid_of.
2946 (struct lwp_info): Delete `lwpid' field. Add `suspended' field.
2947 * linux-low.c (pid_of): Delete.
2948 (inferior_pid): Use lwpid_of.
2949 (linux_event_pipe): New.
2950 (target_is_async_p): New.
2952 (handle_extended_wait): Use lwpid_of.
2953 (add_lwp): Don't set lwpid field.
2954 (linux_attach_lwp): Adjust debug output. Use lwpid_of.
2955 (linux_kill_one_lwp): If killing a running lwp, stop it first.
2956 Use lwpid_of. Adjust to linux_wait_for_event interface changes.
2957 (linux_detach_one_lwp): If detaching from a running lwp, stop it
2958 first. Adjust to linux_wait_for_event interface changes. Use
2960 (linux_detach): Don't delete the main lwp here.
2961 (linux_join): Use my_waitpid. Avoid signal_pid. Use lwpid_of.
2962 (status_pending_p): Don't consider explicitly suspended lwps.
2963 (linux_wait_for_lwp): Take an integer pid instead of a lwp_info
2964 pointer. Add OPTIONS argument. Change return type to int. Use
2965 my_waitpid instead of sleeping. Handle WNOHANG. Use lwpid_of.
2966 (linux_wait_for_event): Take an integer pid instead of a lwp_info
2967 pointer. Add status pointer argument. Return a pid instead of a
2968 status. Use lwpid_of. Adjust to linux_wait_for_lwp interface
2969 changes. In non-stop mode, don't switch to a random thread.
2970 (linux_wait): Rename to...
2971 (linux_wait_1): ... this. Add target_options argument, and handle
2972 it. Adjust to use resume_kind. Use lwpid_of. In non-stop mode,
2973 don't handle the continue thread. Handle TARGET_WNOHANG. Merge
2974 clean exit and signal exit code. Don't stop all threads in
2975 non-stop mode. In all-stop mode, only stop all threads when
2976 reporting a stop to GDB. Handle explicit thread stop requests.
2977 (async_file_flush, async_file_mark): New.
2979 (send_sigstop): Use lwpid_of.
2980 (wait_for_sigstop): Use lwpid_of. Adjust to linux_wait_for_event
2981 interface changes. In non-stop mode, don't switch to a random
2983 (linux_resume_one_lwp): Use lwpid_of.
2984 (linux_continue_one_thread, linux_queue_one_thread): Merge into ...
2985 (linux_resume_one_thread): ... this. Handle resume_stop. In
2986 non-stop mode, don't look for pending flag in all threads.
2987 (resume_status_pending_p): Don't consider explicitly suspended
2989 (my_waitpid): Reimplement. Emulate __WALL.
2990 (linux_request_interrupt, linux_read_offsets, linux_xfer_siginfo):
2992 (sigchld_handler, linux_supports_non_stop, linux_async)
2993 (linux_start_non_stop): New.
2994 (linux_target_ops): Register linux_supports_non_stop, linux_async
2995 and linux_start_non_stop.
2996 (initialize_low): Install SIGCHLD handler.
2997 * thread-db.c (thread_db_create_event, find_one_thread)
2998 (thread_db_get_tls_address): Use lwpid_of.
2999 * win32-low.c (win32_detach): Adjust to use resume_kind.
3000 (win32_wait): Add `options' argument.
3001 * spu-low.c (spu_resume): Adjust to use resume_kind.
3002 (spu_wait): Add `options' argument.
3006 Decouple target code from remote protocol.
3008 * target.h (enum target_waitkind): New.
3009 (struct target_waitstatus): New.
3010 (struct target_ops) <wait>: Return an unsigned long. Take a
3011 target_waitstatus pointer instead of a char pointer.
3013 * target.c (mywait): Change prototype to return an unsigned long.
3014 Take a target_waitstatus pointer instead of a char pointer. Adjust.
3015 * server.h (thread_from_wait, old_thread_from_wait): Delete
3017 (prepare_resume_reply): Change prototype to take a
3019 * server.c (thread_from_wait, old_thread_from_wait): Delete.
3020 (last_status, last_ptid): New.
3021 (start_inferior): Remove "statusptr" argument. Adjust. Return a
3022 pid instead of a signal.
3023 (attach_inferior): Remove "status" and "signal" parameters.
3025 (handle_query): For qGetTLSAddr, parse the thread id with strtol,
3027 (handle_v_cont, handle_v_attach, handle_v_run, handle_v_kill)
3028 (handle_v_requests, myresume): Remove "status" and "signal"
3030 (handle_status): New.
3031 (main): Delete local `status'. Adjust.
3032 * remote-utils.c: Include target.h.
3033 (prepare_resume_reply): Change prototype to take a
3034 target_waitstatus. Adjust.
3036 * linux-low.c (linux_wait): Adjust to new target_ops->wait
3038 * spu-low.c (spu_wait): Adjust.
3039 * win32-low.c (enum target_waitkind, struct target_waitstatus):
3041 (win32_wait): Adjust.
3045 * target.h (struct thread_resume): Delete leave_stopped member.
3046 (struct target_ops): Add a `n' argument to the `resume' callback.
3047 * server.c (start_inferior): Adjust.
3048 (handle_v_cont, myresume): Adjust.
3049 * linux-low.c (check_removed_breakpoint): Adjust to resume
3050 interface change, and to removed leave_stopped field.
3051 (resume_ptr): Delete.
3052 (struct thread_resume_array): New.
3053 (linux_set_resume_request): Add new `arg' parameter. Adjust to
3054 resume interface change.
3055 (linux_continue_one_thread, linux_queue_one_thread)
3056 (resume_status_pending_p): Check if the resume field is NULL
3057 instead of checking the leave_stopped member.
3058 (linux_resume): Adjust to the target resume interface change.
3059 * spu-low.c (spu_resume): Adjust to the target resume interface
3061 * win32-low.c (win32_detach, win32_resume): Ditto.
3065 * linux-low.c (linux_wait_for_event): Don't clear the `stepping'
3067 (wait_for_sigstop): Don't leave a finished single-step SIGTRAP
3069 (linux_continue_one_thread): Only preserve the stepping flag if
3070 there's a pending breakpoint.
3074 * server.c (main): After the inferior having exited, call
3075 remote_close before exiting gdbserver.
3079 Fix size of FPSCR in Power 7 processors.
3080 * linux-ppc-low.c (PPC_FEATURE_ARCH_2_05): Remove #define.
3081 (PPC_FEATURE_HAS_DFP): New #define.
3082 (ppc_arch_setup): Check for DFP feature instead of ISA 2.05 to decide on
3087 * server.c (handle_query) Whitespace and formatting.
3091 * i387-fp.c, linux-arm-low.c, linux-cris-low.c,
3092 linux-crisv32-low.c, linux-i386-low.c, linux-low.c,
3093 linux-mips-low.c, linux-s390-low.c, linux-sparc-low.c,
3094 linux-x86-64-low.c, linux-xtensa-low.c, proc-service.c,
3095 regcache.c, remote-utils.c, server.c, spu-low.c, target.h,
3096 thread-db.c, win32-low.c, xtensa-xtregs.c, gdbreplay.c,
3097 Makefile.in, configure.ac: Fix whitespace throughout.
3098 * configure: Regenerate.
3102 * inferiors.c (find_inferior): Make it safe for the callback
3103 function to delete the currently iterated inferior.
3107 * Makefile.in (linuw_low_h): Move higher.
3108 (thread-db.o): Depend on $(linux_low_h).
3112 Rename "process" to "lwp" throughout.
3114 * linux-low.c (all_processes): Rename to...
3115 (all_lwps): ... this.
3116 (inferior_pid, handle_extended_wait, get_stop_pc): Adjust.
3117 (add_process): Rename to ...
3118 (add_lwp): ... this. Adjust.
3119 (linux_create_inferior): Adjust.
3120 (linux_attach_lwp): Adjust.
3121 (linux_attach): Adjust.
3122 (linux_kill_one_process): Rename to ...
3123 (linux_kill_one_lwp): ... this. Adjust.
3124 (linux_kill): Adjust.
3125 (linux_detach_one_process): Rename to ...
3126 (linux_detach_one_lwp): ... this. Adjust.
3127 (linux_detach): Adjust.
3128 (check_removed_breakpoint): Adjust.
3129 (status_pending_p): Adjust.
3130 (linux_wait_for_process): Rename to ...
3131 (linux_wait_for_lwp): ... this. Adjust.
3132 (linux_wait_for_event): Adjust.
3133 (send_sigstop): Adjust.
3134 (wait_for_sigstop): Adjust.
3135 (stop_all_processes): Rename to ...
3136 (stop_all_lwps): ... this.
3137 (linux_resume_one_process): Rename to ...
3138 (linux_resume_one_lwp): ... this. Adjust.
3139 (linux_set_resume_request, linux_continue_one_thread)
3140 (linux_queue_one_thread, resume_status_pending_p)
3141 (usr_store_inferior_registers, regsets_store_inferior_registers)
3142 (linux_request_interrupt, linux_read_offsets, linux_xfer_siginfo):
3144 * linux-low.h (get_process): Rename to ...
3145 (get_lwp): ... this. Adjust.
3146 (get_thread_process): Rename to ...
3147 (get_thread_lwp): ... this. Adjust.
3148 (get_process_thread): Rename to ...
3149 (get_lwp_thread): ... this. Adjust.
3150 (struct process_info): Rename to ...
3151 (struct lwp_info): ... this.
3152 (all_processes): Rename to ...
3153 (all_lwps): ... this.
3154 * proc-service.c (ps_lgetregs): Adjust.
3155 * thread-db.c (thread_db_create_event, find_one_thread)
3156 (maybe_attach_thread, thread_db_get_tls_address): Adjust.
3160 * server.c (handle_query): Handle "qAttached".
3164 * Makefile.in, hostio-errno.c, errno.c, xtensa-xtregs.c: Change to
3165 GPLv3, update license URL.
3169 * Makefile.in (INCLUDE_CFLAGS): Add -I$(srcdir)/../common.
3170 (server_h): Add gdb_signals.h.
3171 (signals.o): Update.
3172 * server.h (target_signal_from_host,target_signal_to_host_p)
3173 (target_signal_to_host,target_signal_to_name): Moved to gdb_signals.h.
3177 * remote-utils.c (getpkt): Also generate remote-debug
3178 information if noack_mode is set.
3182 * server.c (handle_query): Report qXfer:siginfo:read and
3183 qXfer:siginfo:write as supported and handle them.
3184 * target.h (struct target_ops) <qxfer_siginfo>: New field.
3185 * linux-low.c (linux_xfer_siginfo): New.
3186 (linux_target_ops): Set it.
3190 * server.c (gdbserver_usage): Mention --remote-debug.
3191 (main): Accept '--remote-debug' switch.
3195 * regcache.c (new_register_cache): No need to check result of xcalloc.
3196 * server.c (handle_search_memory): Back out calls to xmalloc,
3197 result is checked and error is returned to user upon failure.
3198 (handle_query): Ditto. Add more checks for result of malloc.
3199 (handle_v_cont): Check result of malloc, report error back to
3201 (handle_v_run): Ditto. Call freeargv.
3202 * server.h (freeargv): Declare.
3203 * utils.c (freeargv): New fn.
3207 * gdbreplay.c (perror_with_name): Make arg const char *.
3208 * server.h (target_signal_to_name): Make return type const char *.
3209 * thread-db.c (thread_db_err_str): Make return type const char *.
3210 * utils.c (perror_with_name): Make arg const char *.
3214 * win32-low.c (get_child_debug_event): Issue a final DBG_CONTINUE
3215 when handling a EXIT_PROCESS_DEBUG_EVENT.
3219 * gdbreplay.c (gdbreplay_version): Update copyright year.
3220 * server.c (gdbserver_version): Likewise.
3224 * linux-low.c (linux_attach_lwp): Add some comments/fixmes.
3225 (handle_extended_wait): Improve comment.
3229 * utils.c (xmalloc,xcalloc,xstrdup): New fns.
3230 * server.h (ATTR_MALLOC): New macro.
3231 (xmalloc,xcalloc,xstrdup): Declare.
3232 * hostio.c: Replace malloc,calloc,strdup with xmalloc,xcalloc,xstrdup.
3233 * inferiors.c: Ditto.
3234 * linux-low.c: Ditto.
3235 * mem-break.c: Ditto.
3236 * regcache.c: Ditto.
3237 * remote-utils.c: Ditto.
3240 * win32-low.c: Ditto.
3244 * linux-low.c (linux_wait_for_process): Don't clobber current_inferior
3245 in debugging printf.
3247 * linux-low.c (handle_extended_wait): Simplify, use my_waitpid.
3251 * linux-low.h (struct process_info): Delete member tid, unused.
3252 * thread-db.c (find_one_thread): Update.
3253 (maybe_attach_thread): Update.
3257 * target.h (struct target_ops): Add qxfer_osdata member.
3258 * linux-low.c: Include ctype.h and pwd.h and sys/types.h
3260 (linux_qxfer_osdata): New functions.
3261 (linux_target_ops): Register linux_qxfer_osdata as qxfer_osdata
3263 * server.c (handle_query): Handle "qXfer:osdata:read:".
3264 * remote-utils.c (buffer_grow, buffer_free, buffer_init, buffer_finish)
3265 (buffer_xml_printf): New functions.
3266 * server.h (struct buffer): New.
3267 (buffer_grow_str, buffer_grow_str0): New macros.
3268 (buffer_grow, buffer_free, buffer_init, buffer_finish)
3269 (buffer_xml_printf): Declare.
3273 * Makefile.in (VERSION,DIST,LINT,LINTFLAGS): Delete, unused.
3277 * server.c (handle_v_run): Always use the supplied argument list.
3281 * xtensa-xtregs.c (XTENSA_ELF_XTREG_SIZE): Change to 4.
3282 (xtensa_regmap_table): Add entry for scompare1.
3286 * Makefile.in (powerpc-isa205-32l.o, powerpc-isa205-32l.c,
3287 powerpc-isa205-altivec32l.o, powerpc-isa205-altivec32l.c,
3288 powerpc-isa205-vsx32l.o, powerpc-isa205-vsx32l.c,
3289 powerpc-isa205-64l.o, powerpc-isa205-64l.c,
3290 powerpc-isa205-altivec64l.o, powerpc-isa205-altivec64l.c,
3291 powerpc-isa205-vsx64l.o, powerpc-isa205-vsx64l.c): New targets.
3292 * configure.srv (powerpc*-*-linux*): Add ISA 2.05 object files and
3293 XML target descriptions.
3294 * linux-ppc-low.c (ppc_arch_setup): Init registers with 64-bit FPSCR
3295 when inferior is running on an ISA 2.05 or later processor. Add
3296 special case to return offset for full 64-bit slot of FPSCR when
3301 * Makefile.in (SFILES, clean): Added sparc64 files.
3302 (reg-sparc64.o, reg-sparc64.c): New.
3303 * configure.srv (sparc*-*-linux*): New configuration.
3304 * linux-low.c (regsets_fetch_inferior_registers): Swap ptrace
3305 syscall arguments for SPARC.
3306 (regsets_store_inferior_registers): Likewise.
3307 * linux-sparc-low.c: New file.
3311 * Makefile.in (BFD_DIR,BFD,BFD_SRC,BFD_CFLAGS): Delete.
3312 (READLINE_DIR,READLINE_DEP): Delete.
3313 (INTERNAL_CFLAGS): Update.
3314 (LINTFLAGS): Update.
3318 * server.c (handle_v_run): If GDB didn't specify an argv, use the
3319 whole argv from the last run, not just argv[0].
3323 * regcache.c (new_register_cache): Return NULL if the register
3324 cache size isn't known yet.
3325 (free_register_cache): Avoid dereferencing a NULL regcache.
3329 * configure.srv: Merge MIPS and MIPS64.
3333 * Makefile.in (uninstall): Apply $(EXEEXT) too.
3337 * Makefile.in: Add required vsx dependencies.
3339 * linux-ppc-low: Define PPC_FEATURE_HAS_VSX.
3340 Declare init_registers_powerpc_vsx32l.
3341 Declare init_registers_powerpc_vsx64l.
3342 Define PTRACE_GETVSXREGS and PTRACE_SETVSXREGS.
3343 (ppc_arch_setup): Check for VSX in hwcap.
3344 (ppc_fill_vsxregset): New function.
3345 (ppc_store_vsxregset): New function.
3346 Add new VSX entry in regset_info target_regsets.
3348 * configure.srv: Add new VSX dependencies.
3352 * remote-utils.c (noack_mode, transport_is_reliable): New globals.
3353 (remote_open): Set or clear transport_is_reliable.
3354 (putpkt_binary): Don't expect acks in noack mode.
3355 (getpkt): Don't send ack/nac in noack mode.
3356 * server.c (handle_general_set): Handle QStartNoAckMode.
3357 (handle_query): If connected by tcp pass QStartNoAckMode+ in
3359 (main): Reset noack_mode on every connection.
3360 * server.h (noack_mode): Declare.
3364 * Makefile.in (GDBREPLAY_OBS): New variable.
3365 (gdbreplay$(EXEEXT)): Use it to avoid unportable $^.
3370 * linux-low.c (linux_resume_one_process): Ignore ESRCH.
3371 (usr_store_inferior_registers): Likewise.
3372 (regsets_store_inferior_registers): Likewise.
3377 * configure.ac: Check for memmem declaration.
3378 * server.c [HAVE_MALLOC_H]: Include malloc.h.
3379 (disable_packet_vCont, disable_packet_Tthread, disable_packet_qC)
3380 (disable_packet_qfThreadInfo): Unconditionally compile.
3381 * server.h [!HAVE_DECL_MEMMEM]: Declare memmem.
3382 * configure, config.in: Regenerate.
3386 * linux-low.c (sys/dir.h, sys/user.h): Remove includes.
3387 (linux_write_memory): Remove declaration of errno.
3391 * linux-low.c (handle_extended_wait): Do not use "status"
3392 variable uninitialized.
3396 * server.c (handle_v_attach): Inhibit reporting dll changes.
3400 * remote-utils.c (prepare_resume_reply): If requested, don't
3401 output "thread:TID" in the T stop reply.
3403 * server.c (disable_packet_vCont, disable_packet_Tthread)
3404 (disable_packet_qC, disable_packet_qfThreadInfo): New globals.
3405 (handle_query): If requested, disable support for qC, qfThreadInfo
3407 (handle_v_requests): If requested, disable support for vCont.
3408 (gdbserver_show_disableable): New.
3409 (main): Handle --disable-packet and --disable-packet=LIST.
3411 * server.h (disable_packet_vCont, disable_packet_Tthread)
3412 (disable_packet_qC, disable_packet_qfThreadInfo): Declare.
3416 * server.c (gdbserver_usage): Mention --version.
3420 * Makefile.in (gdbreplay.o): New rule.
3424 * gdbreplay.c (gdbreplay_version): Say gdbreplay in version
3425 message, not gdbserver.
3431 * acinclude.m4: Include ../../config/acx.m4.
3432 * configure.ac: Use ACX_PKGVERSION and ACX_BUGURL.
3433 * configure, config.in: Regenerate.
3434 * Makefile.in (gdbreplay$(EXEEXT)): Add version.o.
3435 * server.c (gdbserver_version): Print PKGVERSION.
3436 (gdbsrever_usage): Add stream parameter. Print REPORT_BUGS_TO.
3437 (main): Adjust gdbserver_usage calls.
3438 * gdbreplay.c (version, host_name): Add declarations.
3439 (gdbreplay_version, gdbreplay_usage): New.
3440 (main): Accept --version and --help options.
3444 * linux-arm-low.c (thumb_breakpoint, thumb_breakpoint_len): New.
3445 (arm_breakpoint_at): Handle Thumb.
3446 (the_low_target): Add comment.
3450 * linux-ppc-low.c (ppc_collect_ptrace_register): Clear buffer.
3454 * server.h (decode_search_memory_packet): Declare.
3455 * remote-utils.c (decode_search_memory_packet): New fn.
3456 * server.c (handle_search_memory_1): New fn.
3457 (handle_search_memory): New fn.
3458 (handle_query): Process qSearch:memory packets.
3462 * regcache.c (registers_length): Remove.
3463 (set_register_cache): Verify that PBUFSIZ is large enough to hold a
3464 full register packet.
3465 * regcache.h (registers_length): Remove prototype.
3466 * server.h (PBUFSIZ): Define to 16384.
3470 * configure.srv (powerpc*-*-linux*): Set srv_regobj to
3471 powerpc-32l.o, powerpc-altivec32l.o, powerpc-e500l.o,
3472 powerpc-64l.o, and powerpc-altivec64l.o.
3473 Remove rs6000/powerpc-32.xml, rs6000/powerpc-64.xml, and
3474 rs6000/powerpc-e500.xml; add rs6000/powerpc-32l.xml,
3475 rs6000/powerpc-altivec32l.xml, rs6000/powerpc-e500l.xml,
3476 rs6000/powerpc-64l.xml, rs6000/powerpc-altivec64l.xml,
3477 rs6000/power-linux.xml, and rs6000/power64-linux.xml
3480 * Makefile.in (reg-ppc.o, reg-ppc.c): Remove, replace by ...
3481 (powerpc-32l.o, powerpc-32l.c): ... these new rules.
3482 (powerpc-32.o, powerpc-32.c): Remove, replace by ...
3483 (powerpc-altivec32l.o, powerpc-altivec32l.c): ... these new rules.
3484 (powerpc-e500.o, powerpc-e500.c): Remove, replace by ...
3485 (powerpc-e500l.o, powerpc-e500l.c): ... these new rules.
3486 (reg-ppc64.o, reg-ppc64.c): Remove, replace by ...
3487 (powerpc-64l.o, powerpc-64l.c): ... these new rules.
3488 (powerpc-64.o, powerpc-64.c): Remove, replace by ...
3489 (powerpc-altivec64l.o, powerpc-altivec64l.c): ... these new rules.
3492 * linux-ppc-low.c (init_registers_ppc): Remove, replace by ...
3493 (init_registers_powerpc_32l): ... this new prototype.
3494 (init_registers_powerpc_32): Remove, replace by ...
3495 (init_registers_powerpc_altivec32l): ... this new prototype.
3496 (init_registers_powerpc_e500): Remove, replace by ...
3497 (init_registers_powerpc_e500l): ... this new prototype.
3498 (init_registers_ppc64): Remove, replace by ...
3499 (init_registers_powerpc_64l): ... this new prototype.
3500 (init_registers_powerpc_64): Remove, replace by ...
3501 (init_registers_powerpc_altivec64l): ... this new prototype.
3502 (ppc_num_regs): Set to 73.
3503 (PT_ORIG_R3, PT_TRAP): Define if necessary.
3504 (ppc_regmap, ppc_regmap_e500): Add values for orig_r3 and trap.
3505 (ppc_cannot_store_register): Handle orig_r3 and trap.
3506 (ppc_arch_setup): Update init_registers_... calls.
3507 (ppc_fill_gregset): Handle orig_r3 and trap.
3509 * inferiors.c (clear_inferiors): Reset current_inferior.
3513 * acinclude.m4: Add override.m4.
3514 * configure: Regenerate.
3518 * linux-ppc-low.c (ppc_arch_setup): Reset ppc_hwcap after the
3519 initial call to init_register_ppc64.
3523 * configure.srv (powerpc64-*-linux*, powerpc-*-linux*): Merge into single
3524 powerpc*-*-linux* case.
3525 (s390-*-linux*, s390x-*-linux*): Merge into single s390*-*-linux* case.
3529 * configure.srv [powerpc64-*-linux*]: Remove powerpc-e500.o from
3530 srv_regobj. Remove rs6000/powerpc-e500.xml and rs6000/power-spe.xml
3532 * linux-ppc-low.c: Include <elf.h>.
3533 (PPC_FEATURE_HAS_ALTIVEC, PPC_FEATURE_HAS_SPE): Define.
3534 (ppc_hwcap): New global variable.
3535 (ppc_regmap): Remove __SPE__ #ifdef sections.
3536 (ppc_regmap_e500): New global variable.
3537 (ppc_cannot_store_register): Update __SPE__ special case.
3538 (ppc_get_hwcap): New function.
3539 (ppc_arch_setup): Use it to determine whether inferior supports
3540 AltiVec or SPE registers. Set the_low_target.regmap if appropriate.
3541 (ppc_fill_vrregset, ppc_store_vrregset): Define unconditionally.
3542 Do not access registers if target does not support AltiVec.
3543 (ppc_fill_evrregset, ppc_store_evrregset): Define unconditionally.
3544 Do not access registers if target does not support SPE.
3545 (target_regsets): Unconditionally include AltiVec and SPE regsets.
3549 * linux-low.c (disabled_regsets, num_regsets): New.
3550 (use_regsets_p): Delete.
3551 (linux_wait_for_process): Clear disabled_regsets.
3552 (regsets_fetch_inferior_registers): Check and set it.
3553 (regsets_store_inferior_registers): Likewise.
3554 (linux_fetch_registers, linux_store_registers): Do not use
3556 (initialize_low): Allocate disabled_regsets.
3560 * Makefile.in (LIBOBJS): New.
3562 (memmem.o): New rule.
3563 * configure.ac: Use AC_CONFIG_LIBOBJ_DIR and check for memmem.
3564 * configure: Regenerated.
3568 * server.c (handle_query): Never return "unsupported" for
3569 qXfer:features:read queries.
3573 * server.c (get_features_xml): Fix inverted condition.
3574 (handle_query): Always support qXfer:feature:read.
3578 * server.c (wrapper_argv): New.
3579 (start_inferior): Handle wrapper_argv. If set, expect an extra
3581 (gdbserver_usage): Document --wrapper.
3582 (main): Parse --wrapper.
3586 * configure.srv [powerpc64-*-linux*]: Add all files mentioned for
3587 powerpc-*-linux* to srv_regobj and reg_xmlfiles.
3588 * linux-ppc-low.c (ppc_get_pc): Support bi-arch operation.
3589 (ppc_set_pc): Likewise.
3590 (ppc_arch_setup): New function.
3591 (ppc_fill_gregset): Call ppc_collect_ptrace_register instead
3592 of collect_register.
3593 (the_low_target): Use ppc_arch_setup as arch_setup initializer.
3597 * configure.srv [powerpc64-*-linux*]: Use linux-ppc-low.o
3598 instead of linux-ppc64-low.o.
3599 * linux-ppc64-low.c: Remove file.
3600 * Makefile.in (SFILES): Remove linux-ppc64-low.c.
3601 (linux-ppc64-low.o): Remove rule.
3603 * linux-ppc-low.c (init_registers_ppc64): Add prototype.
3604 (init_registers_powerpc_64): Likewise.
3605 (ppc_regmap): Conditionally define depending on __powerpc64__.
3606 (ppc_cannot_store_register): Do not special-case "fpscr" when
3607 compiled on __powerpc64__.
3608 (ppc_collect_ptrace_register): New function.
3609 (ppc_supply_ptrace_register): New function.
3610 (ppc_breakpoint): Change type to "unsigned int".
3611 (ppc_breakpoint_at): Change type of "insn" to "unsigned int".
3612 (the_low_target): Conditionally provide initializers for the
3613 arch_setup member depending on __powerpc64__. Install
3614 collect_ptrace_register and supply_ptrace_register members.
3618 * regcache.h (gdbserver_xmltarget): Add extern declaration.
3619 * server.c (gdbserver_xmltarget): Define.
3620 (get_features_xml): Use it to replace "target.xml" and arch_string.
3622 * configure.srv: Remove srv_xmltarget. Add XML files that were
3623 mentioned there to srv_xmlfiles instead. Remove conditional tests
3624 on gdb_cv_arm_iwmmxt, gdb_cv_ppc_altivec, gdb_cv_ppc_spe; set
3625 srv_xmlfiles and srv_regobj to include all possible choices.
3626 * configure.ac (srv_xmltarget): Remove.
3627 (srv_xmlfiles): Do not add "target.xml".
3628 (gdb_cv_arm_iwmmxt, gdb_cv_ppc_altivec, gdb_cv_ppc_spe): Remove
3629 checks for supplementary target information.
3630 * configure: Regenerate.
3631 * Makefile.in (XML_TARGET): Remove.
3632 (target.xml): Remove rule.
3633 (clean): Do not clean up target.xml.
3634 (.PRECIOUS): Do not mention target.xml.
3636 * target.h (struct target_ops): Remove arch_string member.
3637 * linux-low.c (linux_arch_string): Remove.
3638 (linux_target_ops): Remove arch_string initializer.
3639 * linux-low.h (struct linux_target_ops): Remove arch_string member.
3640 * linux-i386-low.c (the_low_target): Remove arch_string initializer.
3641 * linux-x86-64-low.c (the_low_target): Remove arch_string initializer.
3642 * spu-low.c (spu_arch_string): Remove.
3643 (spu_target_ops): Remove arch_string initializer.
3644 * win32-low.c (win32_arch_string): Remove.
3645 (win32_target_ops): Remove arch_string initializer.
3646 * win32-low.h (struct win32_target_ops): Remove arch_string member.
3647 * win32-arm-low.c (the_low_target): Remove arch_string initializer.
3648 * win32-i368-low.c (the_low_target): Remove arch_string initializer.
3652 * linux-low.h (struct linux_target_ops): Replace left_pad_xfer field
3653 by collect_ptrace_register and supply_ptrace_register hooks.
3654 * linux-low.c (fetch_register): Use supply_ptrace_register callback
3655 instead of checking for the_low_target.left_pad_xfer.
3656 (usr_store_inferior_registers): Use collect_ptrace_register callback
3657 instead of checking for the_low_target.left_pad_xfer.
3659 * linux-s390-low.c (s390_collect_ptrace_register): New function.
3660 (s390_supply_ptrace_register): Likewise.
3661 (s390_fill_gregset): Call s390_collect_ptrace_register.
3662 (the_low_target): Update.
3664 * linux-ppc64-low.c (ppc_collect_ptrace_register): New function.
3665 (ppc_supply_ptrace_register): Likewise.
3666 (the_low_target): Update.
3668 * linux-i386-low.c (the_low_target): Update.
3669 * linux-x86-64-low.c (the_low_target): Update.
3673 * configure.srv [s390x-*-linux*]: Set srv_regobj to include both
3674 reg-s390.o and reg-s390x.o.
3676 * linux-low.c (new_inferior): New global variable.
3677 (linux_create_inferior, linux_attach): Set it.
3678 (linux_wait_for_process): Call the_low_target.arch_setup after the
3679 target has stopped for the first time.
3680 (initialize_low): Do not call the_low_target.arch_setup.
3682 * linux-s390-low.c (s390_get_pc): Support bi-arch operation.
3683 (s390_set_pc): Likewise.
3684 (s390_arch_setup): New function.
3685 (the_low_target): Use s390_arch_setup as arch_setup routine.
3687 * regcache.c (realloc_register_cache): New function.
3688 (set_register_cache): Call it for each existing regcache.
3692 * server.h (init_registers): Remove prototype.
3694 * linux-low.h (struct linux_target_ops): Add arch_setup field.
3695 * linux-low.c (initialize_low): Call the_low_target.arch_setup ()
3696 instead of init_registers ().
3697 * linux-arm-low.c (init_registers_arm): Add prototype.
3698 (init_registers_arm_with_iwmmxt): Likewise.
3699 (the_low_target): Add initializer for arch_setup field.
3700 * linux-cris-low.c (init_registers_cris): Add prototype.
3701 (the_low_target): Add initializer for arch_setup field.
3702 * linux-crisv32-low.c (init_registers_crisv32): Add prototype.
3703 (the_low_target): Add initializer for arch_setup field.
3704 * linux-i386-low.c (init_registers_i386_linux): Add prototype.
3705 (the_low_target): Add initializer for arch_setup field.
3706 * linux-ia64-low.c (init_registers_ia64): Add prototype.
3707 (the_low_target): Add initializer for arch_setup field.
3708 * linux-m32r-low.c (init_registers_m32r): Add prototype.
3709 (the_low_target): Add initializer for arch_setup field.
3710 * linux-m68k-low.c (init_registers_m68k): Add prototype.
3711 (the_low_target): Add initializer for arch_setup field.
3712 * linux-mips-low.c (init_registers_mips_linux): Add prototype.
3713 (init_registers_mips64_linux): Likewise.
3714 (the_low_target): Add initializer for arch_setup field.
3715 * linux-ppc-low.c (init_registers_ppc): Add prototype.
3716 (init_registers_powerpc_32, init_registers_powerpc_e500): Likewise.
3717 (the_low_target): Add initializer for arch_setup field.
3718 * linux-ppc64-low.c (init_registers_ppc64): Add prototype.
3719 (init_registers_powerpc_64): Likewise.
3720 (the_low_target): Add initializer for arch_setup field.
3721 * linux-s390-low.c (init_registers_s390): Add prototype.
3722 (init_registers_s390x): Likewise.
3723 (the_low_target): Add initializer for arch_setup field.
3724 * linux-sh-low.c (init_registers_sh): Add prototype.
3725 (the_low_target): Add initializer for arch_setup field.
3726 * linux-x86-64-low.c (init_registers_x86_64_linux): Add prototype.
3727 (the_low_target): Add initializer for arch_setup field.
3728 * linux-xtensa-low.c (init_registers_xtensa): Add prototype.
3729 (the_low_target): Add initializer for arch_setup field.
3731 * win32-low.h (struct win32_target_ops): Add arch_setup field.
3732 * win32-low.c (initialize_low): Call the_low_target.arch_setup ()
3733 instead of init_registers ().
3734 * win32-arm-low.c (init_registers_arm): Add prototype.
3735 (the_low_target): Add initializer for arch_setup field.
3736 * win32-i386-low.c (init_registers_i386): Add prototype.
3737 (the_low_target): Add initializer for arch_setup field.
3739 * spu-low.c (init_registers_spu): Add prototype.
3740 (initialize_low): Call initialie_registers_spu () instead of
3741 initialize_registers ().
3745 * server.c (handle_v_requests): When handling the vRun and vAttach
3746 packets, if already debugging a process, don't kill it. Return an
3751 * server.c (handle_query): Correct length check.
3755 * win32-low.c (do_initial_child_stuff): Add process handle
3756 parameter. Set current_process_handle and current_process_id from the
3757 parameters. Clear globals.
3758 (win32_create_inferior): Don't set current_process_handle and
3759 current_process_id here. Instead pass them on the call to
3760 do_initial_child_stuff.
3761 (win32_attach): Likewise.
3762 (win32_clear_inferiors): New.
3763 (win32_kill): Don't close the current process handle or the
3764 current thread handle here. Instead call win32_clear_inferiors.
3765 (win32_detach): Don't open a new handle to the process. Call
3766 win32_clear_inferiors.
3767 (win32_join): Don't rely on current_process_handle; open a new
3768 handle using the process id.
3769 (win32_wait): Call win32_clear_inferiors when the inferior process
3774 * server.c (monitor_show_help): Add "exit".
3778 * Makefile.in (SFILES): Add linux-xtensa-low.c.
3779 (clean): Add reg-xtensa.c.
3780 (linux-xtensa-low.o, reg-xtensa.o, reg-xtensa.c): New dependencies.
3781 * configure.srv (xtensa*-*-linux*) New target.
3782 * linux-xtensa-low.c: New.
3783 * xtensa-xtregs.c: New.
3787 * hostio.c: Don't include errno.h.
3788 (errno_to_fileio_errno): Move to hostio-errno.
3789 * hostio.c: (hostio_error): Remove the error parameter. Defer the
3790 error number outputting to the target->hostio_last_error callback.
3791 (hostio_packet_error): Use FILEIO_EINVAL directly.
3792 (handle_open, handle_pread, hostio_error, handle_unlink): Update
3793 calls to hostio_error.
3794 * hostio-errno.c: New.
3795 * server.h (hostio_last_error_from_errno): Declare.
3796 * target.h (target_ops): Add hostio_last_error member.
3797 * linux-low.c (linux_target_op): Register hostio_last_error_from_errno
3798 as hostio_last_error handler.
3799 * spu-low.c (spu_target_ops): Likewise.
3800 * win32-low.c [_WIN32_WCE] (win32_error_to_fileio_error)
3801 (wince_hostio_last_error): New functions.
3802 (win32_target_ops) [_WIN32_WCE]: Register wince_hostio_last_error
3803 as hostio_last_error handler.
3804 (win32_target_ops) [!_WIN32_WCE]: Register
3805 hostio_last_error_from_errno as hostio_last_error handler.
3806 * Makefile.in (SFILES): Add hostio.c and hostio-errno.c.
3807 (hostio-errno.o): New rule.
3808 * configure.ac (GDBSERVER_DEPFILES): Add $srv_hostio_err_objs.
3809 * configure.srv (srv_hostio_err_objs): New variable. Default to
3811 (arm*-*-mingw32ce*): Set srv_hostio_err_objs to "".
3812 * configure: Regenerate.
3816 * linux-low.c (linux_attach_lwp): Do not _exit after errors.
3817 (linux_kill, linux_detach): Clean up the process list.
3818 * remote-utils.c (remote_open): Improve port number parsing.
3819 (putpkt_binary, input_interrupt): Only send interrupts if the target
3821 * server.c (extended_protocol): Make static.
3822 (attached): Define earlier.
3823 (exit_requested, response_needed, program_argv): New variables.
3824 (target_running): New.
3825 (start_inferior): Clear attached here.
3826 (attach_inferior): Set attached here.
3827 (require_running): Define.
3828 (handle_query): Use require_running and target_running. Implement
3830 (handle_v_attach, handle_v_run): New.
3831 (handle_v_requests): Use require_running. Handle vAttach and vRun.
3832 (gdbserver_usage): Update.
3833 (main): Redo argument parsing. Handle --debug and --multi. Handle
3834 --attach along with other options or after the port. Save
3835 program_argv. Support no initial program. Resynchronize
3836 communication with GDB after an error. Handle "monitor exit".
3837 Use require_running and target_running. Always allow the extended
3838 protocol. Do not error out for Hc0 or Hc-1. Do not automatically
3839 restart in extended mode.
3840 * README: Refer to the GDB manual. Update --attach usage.
3844 * linux-low.c (STACK_SIZE): Define.
3845 (linux_tracefork_child): Use it. Use __clone2 on ia64.
3846 (linux_test_for_tracefork): Likewise.
3850 * linux-low.c (linux_wait_for_event): Update messages. Do not
3851 reinsert auto-delete breakpoints.
3852 * mem-break.c (struct breakpoint): Change return type of handler to
3854 (set_breakpoint_at): Update handler type.
3855 (reinsert_breakpoint_handler): Return 1 instead of calling
3857 (reinsert_breakpoint_by_bp): Check for the original breakpoint before
3859 (check_breakpoints): Delete auto-delete breakpoints and return 2.
3860 * mem-break.h (set_breakpoint_at): Update handler type.
3861 * thread-db.c (thread_db_create_event, thread_db_create_event): Update.
3862 * win32-low.c (auto_delete_breakpoint): New.
3863 (get_child_debug_event): Use it.
3867 * configure.ac: Check for pread and pwrite.
3868 * hostio.c (handle_pread): Fall back to lseek and read.
3869 (handle_pwrite): Fall back to lseek and write.
3870 * config.in, configure: Regenerated.
3874 * server.c (myresume): Add own_buf argument.
3875 (main): Update calls.
3879 * linux-low.c (linux_wait, linux_resume): Do not handle async I/O.
3880 * remote-utils.c (remote_open): Do not call disable_async_io.
3881 (block_async_io): Delete.
3882 (unblock_async_io): Make static.
3883 (initialize_async_io): New.
3884 * server.c (handle_v_cont): Handle async I/O here.
3885 (myresume): Likewise. Move other common resume tasks here...
3886 (main): ... from here. Call initialize_async_io. Disable async
3887 I/O before the main loop.
3888 * server.h (initialize_async_io): Declare.
3889 (block_async_io, unblock_async_io): Delete prototypes.
3890 * spu-low.c (spu_resume, spu_wait): Do not handle async I/O here.
3894 * remote-utils.c (readchar): Allow binary data in received messages.
3898 * win32-low.c (attaching): New global.
3899 (win32_create_inferior): Clear the `attaching' global.
3900 (win32_attach): Set the `attaching' global.
3901 (get_child_debug_event) [_WIN32_WCE]: Stop the inferior when
3902 attaching. Only set a breakpoint at the entry point if not
3907 * server.c (main): Don't report dll events on the initial
3908 connection on attaches.
3912 * server.c (main): Relax numerical bases supported for the pid of
3913 the --attach command line argument.
3917 * win32-low.c (win32_attach): Call OpenProcess before
3918 DebugActiveProcess, not after. Add last error output to error
3923 * win32-low.c (win32_get_thread_context)
3924 (win32_set_thread_context): New functions.
3925 (thread_rec): Use win32_get_thread_context.
3926 (continue_one_thread, win32_resume): Use win32_set_thread_context.
3927 * win32-low.h (win32_thread_info) [_WIN32_WCE]: Add `base_context'
3930 2007-12-03 Leo Zayas
3933 * win32-low.c (soft_interrupt_requested, faked_breakpoint): New
3935 (child_add_thread): Minor cleanup.
3936 (child_continue): Resume artificially suspended threads before
3937 calling ContinueDebugEvent.
3938 (suspend_one_thread): New.
3939 (fake_breakpoint_event): New.
3940 (get_child_debug_event): Change return type to int. Check here if
3941 gdb sent an interrupt request. If a soft interrupt was requested,
3942 fake a breakpoint event. Return 0 if there is no event to handle,
3944 (win32_wait): Don't check here if gdb sent an interrupt request.
3945 Ensure there is a valid event to handle.
3946 (win32_request_interrupt): Add soft interruption method as last
3949 2007-12-03 Leo Zayas
3952 * win32-low.h (win32_thread_info): Add descriptions to the
3953 structure members. Replace `suspend_count' counter by a
3955 * win32-low.c (thread_rec): Update condition of when to get the
3956 context from the inferior. Rely on ContextFlags being set if it
3957 has already been retrieved. Only suspend the inferior thread if
3958 we haven't already. Warn if that fails.
3959 (continue_one_thread): s/suspend_count/suspended/. Only call
3960 ResumeThread once. Warn if that fails.
3964 * win32-low.c (win32_wait): Don't read from the inferior when it
3969 * Makefile.in (win32_low_h): New variable.
3970 (win32-low.o): Add dependency on $(win32_low_h).
3971 (win32-arm-low.o, win32-i386-low.o): New rules.
3975 * hostio.c: Correct copyright year.
3979 * Makefile.in (OBS): Add hostio.o.
3980 (hostio.o): New rule.
3981 * server.h (handle_vFile): Declare.
3982 * hostio.c: New file.
3983 * server.c (handle_v_requests): Take packet_len and new_packet_len
3984 for binary packets. Call handle_vFile.
3985 (main): Update call to handle_v_requests.
3989 * linux-low.c: Include <sched.h>.
3993 * linux-low.c (linux_tracefork_grandchild): New.
3994 (linux_tracefork_child): Use clone.
3995 (linux_test_for_tracefork): Use clone; allocate and free a stack.
3999 * Makefile.in: Use $(SHELL) instead of "sh" to call regdat.sh.
4003 * linux-low.c (handle_extended_wait): Handle unexpected signals.
4007 * inferiors.c (change_inferior_id): Delete.
4008 (add_pid_to_list, pull_pid_from_list): New.
4009 * linux-low.c (PTRACE_SETOPTIONS, PTRACE_GETEVENTMSG)
4010 (PTRACE_O_TRACESYSGOOD, PTRACE_O_TRACEFORK, PTRACE_O_TRACEVFORK)
4011 (PTRACE_O_TRACECLONE, PTRACE_O_TRACEEXEC, PTRACE_O_TRACEVFORKDONE)
4012 (PTRACE_O_TRACEEXIT, PTRACE_EVENT_FORK, PTRACE_EVENT_VFORK)
4013 (PTRACE_EVENT_CLONE, PTRACE_EVENT_EXEC, PTRACE_EVENT_VFORK_DONE)
4014 (PTRACE_EVENT_EXIT, __WALL): Provide default definitions.
4015 (stopped_pids, thread_db_active, must_set_ptrace_flags): New variables.
4016 (using_threads): Always set to 1.
4017 (handle_extended_wait): New.
4018 (add_process): Do not set TID.
4019 (linux_create_inferior): Set must_set_ptrace_flags.
4020 (linux_attach_lwp): Remove TID argument. Do not check using_threads.
4021 Use PTRACE_SETOPTIONS. Call new_thread_notify. Update all callers.
4022 (linux_thread_alive): Rename TID argument to LWPID.
4023 (linux_wait_for_process): Handle unknown processes. Do not use TID.
4024 (linux_wait_for_event): Do not use TID or check using_threads. Update
4025 call to dead_thread_notify. Call handle_extended_wait.
4026 (linux_create_inferior): Use PTRACE_SETOPTIONS.
4027 (send_sigstop): Delete sigstop_sent.
4028 (wait_for_sigstop): Avoid TID.
4029 (linux_supports_tracefork_flag, linux_tracefork_child, my_waitpid)
4030 (linux_test_for_tracefork): New.
4031 (linux_lookup_signals): Use thread_db_active and
4032 linux_supports_tracefork_flag.
4033 (initialize_low): Use thread_db_active and linux_test_for_tracefork.
4034 * linux-low.h (get_process_thread): Avoid TID.
4035 (struct process_ifo): Move thread_known and tid to the end. Remove
4037 (linux_attach_lwp, thread_db_init): Update prototypes.
4038 * server.h (change_inferior_id): Delete prototype.
4039 (add_pid_to_list, pull_pid_from_list): New prototypes.
4040 * thread-db.c (thread_db_use_events): New.
4041 (find_first_thread): Rename to...
4042 (find_one_thread): ...this. Update callers and messages. Do not
4043 call fatal. Check thread_db_use_events. Do not call
4044 change_inferior_id or new_thread_notify.
4045 (maybe_attach_thread): Update. Do not call new_thread_notify.
4046 (thread_db_init): Set thread_db_use_events. Check use_events.
4047 * utils.c (fatal, warning): Correct message prefix.
4051 * Makefile.in (clean): Remove new files.
4052 (powerpc-32.o, powerpc-32.c, powerpc-e500.o, powerpc-e500.c)
4053 (powerpc-64.o, powerpc-64.c): New rules.
4054 * configure.srv: Use alternate register sets for powerpc64-*-linux*
4055 with AltiVec, powerpc-*-linux* with AltiVec, and powerpc-*-linux*
4057 * linux-ppc-low.c (ppc_regmap): Do not fetch the FP registers for
4059 (ppc_cannot_store_register): Do not check for FPSCR for SPE targets.
4060 (PTRACE_GETVRREGS, PTRACE_SETVRREGS, SIZEOF_VRREGS, ppc_fill_vrregset)
4061 (ppc_store_vrregset, PTRACE_GETEVRREGS, PTRACE_SETEVRREGS)
4062 (struct gdb_evrregset_t, ppc_fill_evrregset, ppc_store_evrregset): New.
4063 (target_regsets): Add AltiVec and SPE register sets.
4064 * configure.ac: Check for AltiVec and SPE.
4065 * linux-ppc64-low.c (PTRACE_GETVRREGS, PTRACE_SETVRREGS, SIZEOF_VRREGS)
4066 (ppc_fill_vrregset, ppc_store_vrregset): New.
4067 (target_regsets): Add AltiVec register set.
4068 * configure: Regenerated.
4072 * linux-low.c (O_LARGEFILE): Define.
4073 (linux_read_memory): Use /proc/PID/mem.
4074 * configure.ac: Use AC_GNU_SOURCE. Check for pread64.
4075 * configure, config.in: Regenerated.
4079 * linux-low.c (linux_wait_for_event): Do not pass signals while
4084 * win32-low.c (create_process): New.
4085 (win32_create_inferior): Use create_process instead of
4086 CreateProcess. If create_process failed retry appending an ".exe"
4087 suffix. Store the GetLastError result immediatelly after
4088 create_process calls and use it on the call to error.
4092 * win32-low.c (handle_load_dll): Don't use toolhelp when waiting.
4096 * configure.ac: Switch license to GPLv3.
4100 * remote-utils.c (putpkt_binary): Memory leak, free buf2.
4104 * win32-low.c (winapi_CloseToolhelp32Snapshot) [_WIN32_WCE]: New
4106 (win32_CloseToolhelp32Snapshot) [_WIN32_WCE]: New global var.
4107 (load_toolhelp) [_WIN32_WCE]: Load TOOLHELP.DLL. Get
4108 CloseToolhelp32Snapshot.
4109 (toolhelp_get_dll_name) [_WIN32_WCE]: Close the snapshot with
4110 CloseToolhelp32Snapshot.
4114 * server.c (main): Check for inferior exit before main loop.
4118 * remote-utils.c (remote_open): Set SO_KEEPALIVE on remote_desc
4119 instead of on tmp_desc.
4124 * inferiors.c (all_dlls, dlls_changed, get_dll): New.
4125 (add_thread): Minor cleanups.
4126 (clear_inferiors): Move lower in the file. Clear the DLL
4128 (free_one_dll, match_dll, loaded_dll, unloaded_dll, clear_list): New.
4129 * remote-utils.c (prepare_resume_reply): Check dlls_changed.
4130 (xml_escape_text): New.
4131 * server.c (handle_query): Handle qXfer:libraries:read. Report it
4133 (handle_v_cont): Report errors.
4134 (gdbserver_version): Update.
4135 (main): Correct size of own_buf. Do not report initial DLL events.
4136 * server.h (struct dll_info, all_dlls, dlls_changed, loaded_dll)
4137 (unloaded_dll, xml_escape_text): New.
4138 * win32-low.c (enum target_waitkind): Update comments.
4139 (win32_add_one_solib, get_image_name, winapi_EnumProcessModules)
4140 (winapi_GetModuleInformation, winapi_GetModuleFileNameExA)
4141 (win32_EnumProcessModules, win32_GetModuleInformation)
4142 (win32_GetModuleFileNameExA, load_psapi, psapi_get_dll_name)
4143 (winapi_CreateToolhelp32Snapshot, winapi_Module32First)
4144 (winapi_Module32Next, win32_CreateToolhelp32Snapshot)
4145 (win32_Module32First, win32_Module32Next, load_toolhelp)
4146 (toolhelp_get_dll_name, handle_load_dll, handle_unload_dll): New.
4147 (get_child_debug_event): Handle DLL events.
4148 (win32_wait): Likewise.
4152 * configure.srv: Set srv_linux_regsets for sh*-*-linux*.
4153 * linux-sh-low.c (sh_fill_gregset, target_regsets): New.
4157 * win32-low.c (handle_output_debug_string): Ignore event if not
4162 * win32-arm-low.c (arm_wince_breakpoint): Fix typo.
4166 * remote-utils.c (look_up_one_symbol): Handle 'm' packets.
4170 * inferiors.c (change_inferior_id): Add comment.
4171 * linux-low.c (check_removed_breakpoint): Add an early
4172 prototype. Improve debug output.
4173 (linux_attach): Doc update.
4174 (linux_detach_one_process, linux_detach): Clean up before releasing
4176 (send_sigstop, wait_for_sigstop): Improve comments and debug output.
4177 * linux-low.h (struct process_info): Doc improvement.
4178 * mem-break.c (delete_all_breakpoints): New.
4179 * mem-break.h (delete_all_breakpoints): New prototype.
4180 * thread-db.c (find_first_thread): New.
4181 (thread_db_create_event): Call it instead of
4182 thread_db_find_new_threads. Clean up unused variables.
4183 (maybe_attach_thread): Remove first thread handling.
4184 (thread_db_find_new_threads): Use find_first_thread.
4185 (thread_db_get_tls_address): Likewise.
4189 * thread-db.c (thread_db_find_new_threads): Add prototype.
4190 (thread_db_create_event): Check for the main thread before adding
4192 (maybe_attach_thread): Only enable event reporting if TID == 0.
4193 (thread_db_get_tls_address): Check for new threads.
4197 * linux-low.c (linux_create_inferior): Try execv before execvp.
4198 * spu-low.c (spu_create_inferior): Likewise.
4202 * linux-low.c (linux_create_inferior): Change execv to execvp.
4203 * spu-low.c (spu_create_inferior): Likewies.
4207 * Makefile.in (clean): Clean new files instead of deleted ones.
4208 (reg-mips.o, reg-mips.c, reg-mips64.o, reg-mips64.c): Delete.
4209 (mips-linux.o, mips-linux.c, mips64-linux.o, mips64-linux.c): New
4211 * configure.srv: Specify XML files and new regformats for MIPS and
4213 * linux-mips-low.c (mips_num_regs): Set to only used registers.
4214 (mips_regmap): Do not fetch $0. Remove unused registers. Add
4215 an entry for the restart register.
4216 (mips_cannot_fetch_register, mips_cannot_store_register)
4217 (mips_reinsert_addr, mips_fill_fpregset, mips_store_fpregset): Update
4218 register names to match the XML descriptions.
4219 (mips_fill_gregset, mips_store_gregset): Likewise. Handle the
4220 restart register instead of $0.
4225 * remote-utils.c (decode_xfer_write): New function.
4226 * server.h (decode_xfer_write): Add prototype.
4227 * server.c (handle_query): Add PACKET_LEN argument. Support
4228 qXfer:spu:read and qXfer:spu:write packets.
4229 (main): Pass packet_len to handle_query.
4230 * spu-low.c (spu_target_ops): Add spu_proc_xfer_spu.
4231 * target.h (target_ops): Add qxfer_spu.
4235 * spu-low.c (spu_proc_xfer_spu): Do not return failure when
4236 accessing non-seekable spufs files.
4240 * server.c (handle_query): Add reply for qC packet.
4243 Leo Zayas <lerele@champenstudios@com>
4245 * server.h (check_remote_input_interrupt_request): New function.
4246 * remote_utils.c (INVALID_DESCRIPTOR): New define.
4247 (remote_desc): Initialize with INVALID_DESCRIPTOR.
4248 (input_interrupt): Expose on USE_WIN32API too. Fix whitespace.
4249 (check_remote_input_interrupt_request): New function.
4250 * server.h (check_remote_input_interrupt_request): Declare.
4251 * win32-low.c (winapi_DebugBreakProcess,
4252 winapi_GenerateConsoleCtrlEvent): New typedefs.
4253 (get_child_debug_event): Lower Win32 debug event polling from 1 sec
4255 (win32_wait): Check for remote interrupt request
4256 with check_remote_input_interrupt_request.
4257 (win32_request_interrupt): New function.
4258 (win32_target_op): Set request_interrupt to win32_request_interrupt.
4262 * win32-low.c (debug_registers_changed,
4263 debug_registers_used, CONTEXT_EXTENDED_REGISTERS,
4264 CONTEXT_FLOATING_POINT, CONTEXT_DEBUG_REGISTERS,
4265 CONTEXT_DEBUGGER, CONTEXT_DEBUGGER_DR): Delete.
4266 (thread_rec): Get context using the low target.
4267 (child_add_thread): Call thread_added on the low target,
4268 which does the same thing.
4270 (do_initial_child_stuff): Remove debug registers references.
4271 Set context using the low target. Resume threads after
4272 setting the contexts.
4273 (child_continue): Remove dead variable. Remove debug
4274 registers references.
4275 (child_fetch_inferior_registers): Go through the low target.
4276 (do_child_store_inferior_registers): Remove.
4277 (child_store_inferior_registers): Go through the low target.
4278 (win32_resume): Remove debug registers references.
4279 Set context using the low target.
4280 (handle_exception): Change return type to void. Don't record
4281 context here. Set status to TARGET_WAITKIND_SPURIOUS on a
4282 first chance exception.
4283 (get_child_debug_event): Change return type to void. Remove
4284 goto loop. Always return after waiting for debug event.
4285 (win32_wait): Convert to switch statement. Handle spurious
4288 * win32-i386-low.c (debug_registers_changed,
4289 debug_registers_used): New.
4290 (initial_stuff): Rename to ...
4291 (i386_initial_stuff): ... this. Clear debug registers
4293 (store_debug_registers): Delete.
4294 (i386_get_thread_context): New.
4295 (load_debug_registers): Delete.
4296 (i386_set_thread_context): New.
4297 (i386_thread_added): New.
4298 (single_step): Rename to ...
4299 (i386_single_step): ... this.
4300 (do_fetch_inferior_registers): Rename to ...
4301 (i386_fetch_inferior_register): ... this.
4302 (i386_store_inferior_register): New.
4303 (the_low_target): Adapt to new interface.
4305 * win32-arm-low.c (CONTEXT_FLOATING_POINT): Define.
4306 (arm_get_thread_context): New.
4307 (arm_set_thread_context): New.
4309 (do_fetch_inferior_registers): Rename to ...
4310 (arm_fetch_inferior_register): ... this.
4311 (arm_store_inferior_register): New.
4312 (arm_wince_breakpoint): Reimplement as unsigned long.
4313 (arm_wince_breakpoint_len): Define.
4314 (the_low_target): Adapt to new interface.
4316 * win32-low.h (target_ops): Remove regmap, store_debug_registers and
4317 load_debug_registers. Add get_thread_context, set_thread_context,
4318 thread_added and store_inferior_register. Rename
4319 fetch_inferior_registers to fetch_inferior_register.
4320 (regptr): Remove declaration.
4324 * linux-low.c (linux_detach): Change return type to int. Return 0.
4325 * spu-low.c (spu_detach): Likewise.
4329 * target.h (target_ops): Change return type of detach to int.
4331 (join_inferior): New.
4332 * server.c (main): Don't skip detach support on mingw32.
4333 If the inferior doesn't support detaching return error.
4334 Call join_inferior instead of using waitpid.
4335 * linux-low.c (linux_join): New.
4336 (linux_target_op): Add linux_join.
4337 * spu-low.c (spu_join): New.
4338 (spu_target_ops): Add spu_join.
4339 * win32-low.c (win32_detach): Adapt to new interface.
4340 Reopen current_process_handle before detaching. Issue a child
4341 resume before detaching.
4343 (win32_target_op): Add win32_join.
4347 * win32-low.c (win32-attach): Fix return value.
4348 * target.h (target_ops): Describe ATTACH return values.
4352 * win32-low.c (GETPROCADDRESS): Define.
4353 (winapi_DebugActiveProcessStop): Add WINAPI. typedef as pointer.
4354 (winapi_DebugSetProcessKillOnExit): Likewise.
4355 (win32_create_inferior): Force usage of ansi CreateProcessA.
4356 (win32_attach): Use GETPROCADDRESS.
4357 (win32_detach): Likewise.
4361 * win32-low.c (win32_wait): Don't use WSTOPSIG.
4365 * win32-low.c: Commit leftover changes from 2007-03-29.
4369 * i387-fp.c (struct i387_fsave, struct i387_fxsave): Make 16-bit
4370 fields short instead of int. Add explicit padding.
4371 (i387_cache_to_fsave): Remove unnecessary casts.
4372 (i387_fsave_to_cache): Doc fix.
4373 (i387_cache_to_fxsave): Remove unnecessary casts and masking.
4377 * i387-fp.c (i387_cache_to_fxsave): Reinitialize val2 before use.
4378 (i387_fxsave_to_cache): Check fp->ftag while building ftag value.
4382 * configure.srv (arm*-*-mingw32ce*): Move near the other
4387 * configure.ac: Add errno checking.
4388 (AC_CHECK_HEADERS): Add errno.h, fcntl.h, signal.h,
4389 sys/file.h and malloc.h.
4390 (AC_CHECK_DECLS): Add perror.
4391 (srv_mingwce): Handle.
4392 * configure.srv (i[34567]86-*-cygwin*): Add
4393 win32-i386-low.o to srv_tgtobj.
4394 (i[34567]86-*-mingw*): Likewise.
4395 (arm*-*-mingw32ce*): Add case.
4396 * gdbreplay.c [HAVE_SYS_FILE_H, HAVE_SIGNAL_H,
4397 HAVE_FCNTL_H, HAVE_ERRNO_H, HAVE_MALLOC_H]: Check.
4398 [__MINGW32CE__] (strerror): New function.
4399 [__MINGW32CE__] (errno): Define to GetLastError.
4400 [__MINGW32CE__] (COUNTOF): New macro.
4401 (remote_open): Remove extra close call.
4402 * mem-break.c (delete_breakpoint_at): New function.
4403 * mem-break.h (delete_breakpoint_at): Declare.
4404 * remote-utils.c [HAVE_SYS_FILE_H, HAVE_SIGNAL_H,
4405 HAVE_FCNTL_H, HAVE_UNISTD_H, HAVE_ERRNO_H]: Check.
4406 [USE_WIN32API] (read, write): Add char* casts.
4407 * server.c [HAVE_UNISTD_H, HAVE_SIGNAL_H]: Check.
4408 * server.h: Include wincecompat.h on Windows CE.
4409 [HAVE_ERRNO_H]: Check.
4410 (perror): Declare if not declared.
4411 * utils.c: Add stdlib.h, errno.h and malloc.h includes.
4412 (perror_with_name): Remove errno declaration.
4413 * wincecompat.h: New.
4414 * wincecompat.c: New.
4416 * win32-arm-low.c: New.
4417 * win32-i386-low.c: New.
4418 (win32-low.c): Include mem-break.h and win32-low.h, and winnt.h.
4419 (OUTMSG2): Make it safe.
4421 (COUNTOF): New macro.
4422 (NUM_REGS): Get it from the low target.
4423 (CONTEXT_EXTENDED_REGISTERS, CONTEXT_FLOATING_POINT,
4424 CONTEXT_DEBUG_REGISTERS): Add fallbacks to 0.
4425 (thread_rec): Let low target handle debug registers.
4426 (child_add_thread): Likewise.
4427 (child_init_thread_list): Likewise.
4428 (continue_one_thread): Likewise.
4430 (do_child_fetch_inferior_registers): Move to ...
4431 * win32-i386-low.c: ... here, and rename to ...
4432 (do_fetch_inferior_registers): ... this.
4433 * win32-low.c (child_fetch_inferior_registers):
4434 Go through the low target.
4435 (do_child_store_inferior_registers): Use regptr.
4436 (strwinerror): New function.
4437 (win32_create_inferior): Handle Windows CE.
4438 Use strwinerror instead of strerror on Windows error
4439 codes. Add program to the error output.
4440 Don't close the main thread handle on Windows CE.
4441 (win32_attach): Use coredll.dll on Windows CE.
4442 (win32_kill): Close current process and current
4444 (win32_detach): Use coredll.dll on Windows CE.
4445 (win32_resume): Let low target handle debug registers, and
4447 (handle_exception): Add/Remove initial breakpoint. Avoid
4448 non-existant WSTOPSIG on Windows CE.
4449 (win32_read_inferior_memory): Cast to remove warning.
4450 (win32_arch_string): Go through the low target.
4451 (initialize_low): Call set_breakpoint_data with the low
4452 target's breakpoint.
4453 * win32-low.c (dr, FLAG_TRACE_BIT, FCS_REGNUM,
4454 FOP_REGNUM, mappings): Move to ...
4455 * win32-i386-low.c: ... here.
4456 * win32-low.c (win32_thread_info): Move to ...
4457 * win32-low.h: ... here.
4458 * Makefile.in (SFILES): Add win32-low.c, win32-i386-low.c,
4459 win32-arm-low.c and wincecompat.c.
4460 (all:): Add $EXEEXT.
4461 (install-only:): Likewise.
4462 (gdbserver:): Likewise.
4463 (gdbreplay:): Likewise.
4464 * config.in: Regenerate.
4465 * configure: Regenerate.
4469 * win32-low.c: Rename typedef thread_info to
4470 win32_thread_info throughout.
4474 * win32-i386-low.c: Rename to ...
4475 * win32-low.c: ... this.
4476 * configure.srv: Replace win32-i386-low.o with win32-low.o.
4477 * Makefile.in: Likewise.
4481 * remote-utils.c (monitor_output): Constify msg parameter.
4482 * server.h (monitor_output): Likewise.
4483 * win32-i386-low.c (handle_output_debug_string): New.
4484 (win32_kill): Handle OUTPUT_DEBUG_STRING_EVENT events using
4485 handle_output_debug_string.
4486 (get_child_debug_event): Likewise.
4490 * server.c (main): Correct strtoul check.
4494 * linux-low.c: Check __ARCH_HAS_MMU__ also.
4498 * Makefile.in: Add dummy "pdf" and "install-pdf" targets.
4502 * terminal.h: Check HAVE_SGTTY_H.
4506 * remote-utils.c (remote_open): Print out the assigned port number.
4510 * remote-utils.c (monitor_output): New function.
4511 * server.c (debug_threads): Define here.
4512 (monitor_show_help): New function.
4513 (handle_query): Handle qRcmd.
4514 (main): Do not handle 'd' packet.
4515 * server.h (debug_threads, remote_debug, monitor_output): Declare.
4516 * linux-low.c, spu-low.c, win32-i386-low.c: Remove definitions
4521 * Makefile.in (EXEEXT): New.
4522 (clean): Use $(EXEEXT).
4526 * target.h (target_ops): Rename send_signal to request_interrupt,
4527 and remove enum target_signal parameter.
4528 * linux-low.c (linux_request_interrupt): Rename from
4529 linux_send_signal, and always send SIGINT.
4530 * spu-low.c (spu_request_interrupt): Rename from spu_send_signal,
4531 and always send SIGINT.
4532 * remote-utils.c (putpkt_binary): Call request_interrupt, instead
4534 (input_interrupt): Likewise.
4538 * server.c (get_features_xml): Check if target implemented
4540 * win32-i386-low.c (win32_arch_string): New.
4541 (win32_target_ops): Add win32_arch_string as arch_string member.
4545 * spu-low.c (spu_arch_string): New.
4546 (spu_target_ops): Add spu_arch_string.
4550 * remote-utils.c: Remove HAVE_TERMINAL_H check.
4551 * configure.ac: Do not check for terminal.h.
4552 * configure, config.in: Regenerated.
4556 * Makefile.in (OBS): Add $(XML_BUILTIN).
4557 (XML_DIR, XML_TARGET, XML_FILES, XML_BUILTIN): New.
4559 (target.xml, xml-builtin.c, stamp-xml, arm-with-iwmmxt.o)
4560 (arm-with-iwmmxt.c): New.
4561 * config.in, configure: Regenerate.
4562 * configure.ac: Check for iWMMXt. Handle srv_xmltarget,
4563 srv_xmlbuiltin, and srv_xmlfiles. Define USE_XML.
4564 * configure.srv: Mention srv_xmltarget and srv_xmlfiles.
4565 (arm*-*-linux*): Add iWMMXt and regset support.
4566 * linux-arm-low.c (PTRACE_GETWMMXREGS, PTRACE_SETWMMXREGS): Define.
4567 (arm_fill_gregset, arm_store_gregset, arm_fill_wmmxregset)
4568 (arm_store_wmmxregset, target_regsets): New.
4569 * server.c (get_features_xml): Take annex argument. Check builtin
4571 (handle_query): Handle multiple annexes.
4575 * remote-utils.c [USE_WIN32API] (read, write): Define.
4576 (putpkt_binary, input_interrupt, readchar, getpkt): Use read and
4581 * linux-i386-low.c (the_low_target): Set arch_string.
4582 * linux-x86-64-low.c (the_low_target): Likewise.
4583 * linux-low.c (linux_arch_string): New.
4584 (linux_target_ops): Add it.
4585 * linux-low.h (struct linux_target_ops): Add arch_string.
4586 * server.c (write_qxfer_response): Use const void * for DATA.
4587 (get_features_xml): New.
4588 (handle_query): Handle qXfer:features:read. Report it for qSupported.
4589 * target.h (struct target_ops): Add arch_string method.
4594 * linux-low.c (linux_kill): Handle being called with no threads.
4595 * win32-i386-low.c (win32_kill): Likewise.
4596 (get_child_debug_event): Clear current_process_handle.
4601 * remote-utils.c (remote_open): Check the type of specified
4602 serial port devices before opening them.
4603 * server.c (main): Kill the inferior if an error occurs during
4604 the first remote_open.
4608 * README: Update supported targets.
4612 * Makefile.in (clean): Remove reg-mips64.c.
4613 (reg-mips64.c, reg-mips64.o): New rules.
4614 * configure.srv: Handle mips64. Include regset support for mips.
4615 * linux-mips-low.c (union mips_register): New.
4616 (mips_get_pc, mips_set_pc, mips_reinsert_addr): Use it.
4617 (mips_breakpoint, mips_breakpoint_at): Use int.
4618 (mips_collect_register, mips_supply_register)
4619 (mips_collect_register_32bit, mips_supply_register_32bit)
4620 (mips_fill_gregset, mips_store_gregset, mips_fill_fpregset)
4621 (mips_store_fpregset, target_regsets): New.
4622 * thread-db.c (thread_db_get_tls_address): Use uintptr_t.
4626 * configure.srv: Add target "spu*-*-*".
4627 * Makefile.in (clean): Remove reg-spu.c.
4628 (reg-spu.c, reg-spu.o, spu-low.o): Add dependencies.
4629 * spu-low.c: New file.
4633 * configure.ac: Correct td_thr_tls_get_addr test.
4634 * configure: Regenerated.
4638 * linux-low.c (linux_wait_for_event): Reformat. Use the
4640 * remote-utils.c (decode_address_to_semicolon): New.
4641 * server.c (pass_signals, handle_general_set): New.
4642 (handle_query): Mention QPassSignals for qSupported.
4643 (main): Call handle_general_set.
4644 * server.h (pass_signals, decode_address_to_semicolon): New.
4648 * server.c (handle_query): Correct error handling for read_auxv.
4652 * configure.srv [s390-*-linux*, s390x-*-linux*]: Set srv_linux_regsets
4653 and srv_linux_thread_db to yes.
4654 * linux-s390-low.c (s390_fill_gregset): New function.
4655 (target_regsets): Define data structure.
4659 * acinclude.m4 (SRV_CHECK_TLS_GET_ADDR): New.
4660 * configure.ac: Use it. Define HAVE_TD_THR_TLS_GET_ADDR.
4661 * config.in, configure: Regenerated.
4662 * inferiors.c (gdb_id_to_thread): New function.
4663 (gdb_id_to_thread_id): Use it.
4664 * linux-low.c (linux_target_ops): Use thread_db_get_tls_address.
4665 * linux-low.h (struct process_info): Add th member.
4666 (thread_db_get_tls_address): New prototype.
4667 * remote-utils.c (decode_address): Make non-static.
4668 * server.c (handle_query): Handle qGetTLSAddr.
4669 * server.h (gdb_id_to_thread, decode_address): New prototypes.
4670 * target.h (struct target_ops): Add get_tls_address.
4671 * thread-db.c (maybe_attach_thread): Save the thread handle.
4672 (thread_db_get_tls_address): New.
4676 * linux-low.c (PTRACE_GETSIGINFO, PTRACE_SETSIGINFO): Define.
4677 (linux_resume_one_process): Take a siginfo_t *. Update all
4678 callers. Queue it if necessary. Use PTRACE_SETSIGINFO.
4679 (struct pending_signals): Add a siginfo_t.
4680 (linux_wait_for_process): Always set last_status.
4681 (linux_wait_for_event): Use PTRACE_GETSIGINFO.
4682 (linux_queue_one_thread): Use PTRACE_GETSIGINFO.
4683 * linux-low.h (struct process_info): Add last_status.
4687 * remote-utils.c (try_rle): New function.
4688 (putpkt_binary): Use it.
4692 * Makefile.in (clean): Clean reg-x86-64-linux.c.
4693 (reg-x86-64-linux.o, reg-x86-64-linux.c): New.
4694 * configure.srv (x86_64-*-linux*): Use reg-x86-64-linux.o.
4695 * linux-x86-64-low.c (x86_64_regmap): Include ORIG_RAX.
4696 (x86_64_fill_gregset, x86_64_store_gregset): Skip floating
4701 * server.c (terminal_fd): New variable.
4702 (old_foreground_pgrp): Likewise.
4703 (restore_old_foreground_pgrp): New function.
4704 (start_inferior): Record the terminal file descriptor in terminal_fd
4705 and its original foreground group in old_foreground_pgrp. Register
4706 restore_old_foreground_pgrp with atexit().
4710 * server.c (handle_query): Correct qPart to qXfer.
4714 * configure.ac: Check for more headers which are missing on
4715 Windows. Automatically supply -lwsock32 and USE_WIN32API.
4716 * configure.srv: Add Cygwin and mingw32.
4717 * remote-utils.c: Don't include headers unconditionally which
4718 are missing on mingw32. Include <winsock.h> for mingw32.
4719 (remote_open): Adjust for mingw32 support. Flush
4720 standard error after writing to it.
4721 (remote_close, putpkt_binary, input_interrupt, block_async_io)
4722 (unblock_async_io, enable_async_io, disable_async_io)
4723 (readchar, getpkt): Update for Winsock support.
4724 (prepare_resume_reply): Expect a protocol signal number.
4725 * server.c: Disable <sys/wait.h> on mingw32.
4726 (start_inferior): Adjust for mingw32 support. Flush
4727 standard error after writing to it.
4728 (attach_inferior): Likewise. Use protocol signal
4730 (main): Skip 'D' packet on mingw32. Use protocol signal numbers
4732 * win32-i386-low.c: New file.
4733 * Makefile.in (XM_CLIBS): Set.
4734 (gdbserver, gdbreplay): Use $(INTERNAL_CFLAGS).
4735 (win32-i386-low.o): New dependency rule.
4736 * linux-low.c (linux_wait): Use target signal numbers.
4737 * target.h (struct target_ops): Doc fix.
4738 * server.h (target_signal_to_name): New prototype.
4739 * gdbreplay.c: Don't include headers unconditionally which
4740 are missing on mingw32. Include <winsock.h> for mingw32.
4741 (remote_close, remote_open): Adjust for Winsock support.
4742 * configure, config.in: Regenerated.
4746 * server.c (decode_xfer_read, write_qxfer_response): New.
4747 (handle_query): Take a packet length argument. Handle
4748 qXfer:auxv:read instead of qPart:auxv:read. Mention it in
4749 the qSupported response.
4750 (main): Update call to handle_query.
4754 * remote-utils.c (remote_escape_output, remote_unescape_input): New.
4755 (putpkt_binary): Renamed from putpkt and adjusted for binary
4757 (putpkt): New wrapper for putpkt_binary.
4758 (readchar): Don't mask off the high bit.
4759 (decode_X_packet): New function.
4760 * server.c (main): Call putpkt_binary if a handler sets the packet
4761 length. Save the length of the incoming packet. Handle 'X'.
4762 * server.h (gdb_byte, remote_escape_output, decode_X_packet): New.
4766 * server.c (handle_query): Handle qSupported.
4770 * remote-utils.c (all_symbols_looked_up): New variable.
4771 (look_up_one_symbol): Check it.
4772 * server.h (look_up_one_symbol): New declaration.
4773 * thread-db.c (thread_db_init): Set all_symbols_looked_up.
4777 * Makefile.in (linux-arm-low.o): Update dependencies.
4778 * linux-arm-low.c: Include "gdb_proc_service.h".
4779 (PTRACE_GET_THREAD_AREA): Define.
4780 (ps_get_thread_area): New function.
4784 * configure.srv (m68k*-*-uclinux*): New target.
4785 * linux-low.c (linux_create_inferior): Use vfork on mmuless systems.
4786 (linux_resume_one_process): Remove extraneous cast.
4787 (linux_read_offsets): New.
4788 (linux_target_op): Add linux_read_offsets on mmuless systems.
4789 * server.c (handle_query): Add qOffsets logic.
4790 * target.h (struct target_ops): Add read_offsets.
4794 * linux-mips-low.c: Include <sys/ptrace.h> and "gdb_proc_service.h".
4795 (PTRACE_GET_THREAD_AREA): Define.
4796 (ps_get_thread_area): New function.
4797 * Makefile.in (linux-i386-low.o, linux-mips-low.o)
4798 (linux-x86-64-low.o): Update.
4802 * configure.ac: Remove checks for prfpregset_t.
4803 * gdb_proc_service.h: New file.
4804 * linux-i386-low.c, linux-x86-64-low.c, thread-db.c: Use the
4805 new "gdb_proc_service.h".
4806 * proc-service.c: Likewise.
4807 (ps_pglobal_lookup, ps_pdread, ps_pdwrite): Use psaddr_t.
4808 (ps_lgetfpregs, ps_lsetfpregs): Use a void* argument.
4809 * Makefile.in (gdb_proc_service_h): Updated.
4810 * configure, config.in: Regenerated.
4814 * remote-utils.c (prepare_resume_reply): Move declaration
4815 of gdb_id_from_wait to the top of the block.
4819 * linux-low.c (regsets_store_inferior_registers): Read the regset
4820 from the target before filling it.
4824 * server.c (attach_inferior): Return SIGTRAP for a successful
4829 * Makefile.in (OBS): Add version.o.
4830 (STAGESTUFF): Delete.
4831 (version.o): Add dependencies.
4832 (version.c): Replace rule.
4833 (clean): Remove version.c.
4834 * server.c (gdbserver_version): New.
4835 (gdbserver_usage): Use printf.
4836 (main): Handle --version and --help.
4837 * server.h (version, host_name): Add declarations.
4851 * linux-x86-64-low.c:
4854 * linux-ppc64-low.c:
4863 * linux-crisv32-low.c:
4875 * gdbserver.1: Add (C) after Copyright. Update the FSF
4880 * linux-arm-low.c (arm_eabi_breakpoint): New variable.
4881 (arm_breakpoint_at): Recognize both breakpoints.
4882 (the_low_target): Use the correct breakpoint instruction.
4886 * configure.srv (x86_64-*-linux*): Turn on thread_db support.
4887 * linux-x86-64-low.c (x86_64_breakpoint, x86_64_breakpoint_len)
4888 (x86_64_get_pc, x86_64_set_pc, x86_64_breakpoint_at): New.
4889 (the_low_target): Update.
4893 * server.c (main): Allocate mem_buf with PBUFSIZ bytes.
4895 * linux-ia64-low.c (ia64_regmap): Remove NAT registers.
4896 (ia64_num_regs): Reduce to 462.
4900 * acinclude.m4: Correct quoting.
4901 * aclocal.m4: Regenerated.
4904 * thread-db.c (thread_db_err_str): Handle TD_VERSION.
4905 (thread_db_init): Call thread_db_err_str.
4906 * configure.ac: Check for TD_VERSION.
4907 * config.in, configure: Regenerated.
4911 * server.h (error, fatal, warning): Add ATTR_FORMAT.
4915 * configure.ac: Define HAVE_LINUX_REGSETS even if PTRACE_GETREGS
4916 is not available. Define HAVE_PTRACE_GETREGS if it is.
4917 * config.in, configure: Regenerated.
4918 * configure.srv: Set srv_linux_regsets for PowerPC and PowerPC64.
4919 * linux-i386-low.c, linux-m68k-low.c: Update to use
4920 HAVE_PTRACE_GETREGS.
4921 * linux-low.c (regsets_fetch_inferior_registers)
4922 (regsets_store_inferior_registers): Only return 0 if we processed
4924 * linux-ppc-low.c (ppc_fill_gregset, target_regsets): New.
4925 * linux-ppc64-low.c (ppc_fill_gregset, target_regsets): New.
4929 * inferiors.c (struct thread_info): Add gdb_id.
4930 (add_thread): Add gdb_id argument.
4931 (thread_id_to_gdb_id, thread_to_gdb_id, gdb_id_to_thread_id): New.
4932 * linux-low.c (linux_create_inferior, linux_attach_lwp): Update
4933 calls to add_thread.
4934 * remote-utils.c (prepare_resume_reply: Use thread_to_gdb_id.
4935 * server.c (handle_query): Use thread_to_gdb_id.
4936 (handle_v_cont, main): Use gdb_id_to_thread_id.
4937 * server.h (add_thread): Update prototype.
4938 (thread_id_to_gdb_id, thread_to_gdb_id, gdb_id_to_thread_id): New
4943 * linux-low.c (fetch_register, usr_store_inferior_registers): Handle
4944 left-padded registers.
4945 * linux-low.h (struct linux_target_ops): Add left_pad_xfer.
4946 * linux-ppc64-low.c (the_low_target): Set left_pad_xfer.
4950 * configure.ac (BFD_NEED_DECLARATION): Replace with AC_CHECK_DECLS.
4951 * configure: Regenerate.
4952 * config.in: Regenerate.
4953 * server.h (NEED_DECLARATION_STRERROR):
4954 Replace with !HAVE_DECL_STRERROR.
4958 * linux-low.c (linux_wait, linux_send_signal): Don't test
4959 an unsigned long variable for > 0 if it could be MAX_ULONG.
4960 * server.c (myresume): Likewise.
4961 * target.c (set_desired_inferior): Likewise.
4965 * configure.ac: Simplify and improve check for socklen_t.
4966 * configure, config.in: Regenerate.
4970 * acconfig.h: Remove.
4971 * configure.ac: Add a test for socklen_t. Use three-argument
4972 AC_DEFINE throughout.
4973 * config.in: Regenerated using autoheader 2.59.
4974 * configure: Regenerated.
4976 * gdbreplay.c (socklen_t): Provide a default.
4977 (remote_open): Use socklen_t.
4978 * remote-utils.c (socklen_t): Provide a default.
4979 (remote_open): Use socklen_t.
4980 (convert_int_to_ascii, convert_ascii_to_int, decode_M_packet): Use
4983 * i387-fp.c (struct i387_fsave, struct i387_fxsave): Use unsigned
4985 * linux-low.c (linux_read_memory, linux_write_memory)
4986 (linux_read_auxv): Likewise.
4987 * mem-break.c (breakpoint_data, set_breakpoint_data, check_mem_read)
4988 (check_mem_write): Likewise.
4989 * mem-break.h (set_breakpoint_data, check_mem_read, check_mem_write):
4991 * regcache.c (struct inferior_rgcache_data, registers_to_string)
4992 (registers_from_string, register_data): Likewise.
4993 * server.c (handle_query, main): Likewise.
4994 * server.h (convert_ascii_to_int, convert_int_to_ascii)
4995 (decode_M_packet): Likewise.
4996 * target.c (read_inferior_memory, write_inferior_memory): Likewise.
4997 * target.h (struct target_ops): Update read_memory, write_memory,
4999 (read_inferior_memory, write_inferior_memory): Update.
5000 * linux-low.h (struct linux_target_ops): Change type of breakpoint
5002 * linux-arm-low.c, linux-cris-low.c, linux-crisv32-low.c,
5003 linux-i386-low.c, linux-m32r-low.c, linux-m68k-low.c,
5004 linux-mips-low.c, linux-ppc-low.c, linux-ppc64-low.c,
5005 linux-s390-low.c, linux-sh-low.c: Update for changes in
5006 read_inferior_memory and the_low_target->breakpoint.
5010 * Makefile.in (SFILES): Add linux-ppc64-low.c.
5011 (linux-ppc64-low.o, reg-ppc64.c, reg-ppc64.o): New targets.
5012 * configure.srv: Add powerpc64-*-linux*.
5013 * linux-ppc64-low.c: New file.
5017 * linux-cris-low.c: New file with support for CRIS.
5018 * linux-crisv32-low.c: Ditto for CRISv32.
5019 * Makefile.in (SFILES): Add linux-cris-low.c, linux-crisv32-low.c.
5020 (clean): Add reg-cris.c and reg-crisv32.c.
5021 Add linux-cris-low.o, linux-crisv32-low.o, reg-cris.o, reg-cris.c,
5022 reg-crisv32.o, and reg-crisv32.c to make rules.
5023 * configure.srv: Add cris-*-linux* and crisv32-*-linux* to list of
5028 * linux-low.c (fetch_register): Ensure buffer size is a multiple
5029 of sizeof (PTRACE_XFER_TYPE).
5030 (usr_store_inferior_registers): Likewise. Zero out excess bytes.
5034 * target.h (struct target_ops): Add insert_watchpoint,
5035 remove_watchpoint, stopped_by_watchpoint, stopped_data_address function
5036 pointers for hardware watchpoint support.
5037 * linux-low.h (struct linux_target_ops): Ditto.
5038 * linux-low.c (linux_insert_watchpoint, linux_remove_watchpoint)
5039 (linux_stopped_by_watchpoint, linux_stopped_data_address): New. Add
5040 to linux_target_ops.
5041 * remote-utils.c (prepare_resume_reply): Add watchpoint information to
5043 * server.c (main): Recognize 'Z' and 'z' packets.
5047 * linux-s390-low.c (s390_breakpoint, s390_breakpoint_len): Define.
5048 (s390_get_pc, s390_set_pc, s390_breakpoint_at): New functions.
5049 (the_low_target): Add new members.
5053 * proc-service.c (ps_lgetregs): Search all_processes instead of
5058 * server.c (start_inferior): Change return type to int.
5059 (attach_inferior): Change sigptr to int *.
5060 (handle_v_cont, handle_v_requests): Change signal to int *.
5061 (main): Change signal to int.
5065 * Makefile.in: Add linux-m32r-low.o, reg-m32r.c and reg-m32r.o.
5066 * configure.srv: Add m32r*-*-linux*.
5067 * linux-m32r-low.c: New file.
5071 * Makefile.in (stamp-h): Set CONFIG_HEADERS explicitly.
5075 * inferiors.c (change_inferior_id, add_thread, find_inferior_id):
5076 Take unsigned long arguments for PIDs.
5077 * linux-low.c (add_process, linux_attach_lwp, linux_attach)
5078 (linux_thread_alive, linux_wait_for_event, kill_lwp, send_sigstop)
5079 (wait_for_sigstop, linux_resume_one_process)
5080 (regsets_fetch_inferior_registers, linux_send_signal)
5081 (linux_read_auxv): Likewise. Update the types of variables holding
5082 PIDs. Update format string specifiers.
5083 * linux-low.h (struct process_info, linux_attach_lwp): Likewise.
5084 * remote-utils.c (prepare_resume_reply): Likewise.
5085 * server.c (cont_thread, general_thread, step_thread)
5086 (thread_from_wait, old_thread_from_wait, signal_pid): Change type to
5088 (handle_query): Update format specifiers.
5089 (handle_v_cont, main): Use strtoul for thread IDs.
5090 * server.h (struct inferior_list_entry): Use unsigned long for ID.
5091 (add_thread, find_inferior_id, change_inferior_id, cont_thread)
5092 (general_thread, step_thread, thread_from_wait)
5093 (old_thread_from_wait): Update.
5094 * target.h (struct thread_resume): Use unsigned long for THREAD.
5095 (struct target_ops): Use unsigned long for arguments to attach and
5100 * acinclude.m4: Include bfd/bfd.m4 directly.
5101 * configure.ac: Use AC_ARG_PROGRAM. Suggested by Aron Griffis
5103 * aclocal.m4, configure: Regenerated.
5107 * configure.ac: Rename configure.in, require autoconf 2.59.
5108 * configure: Re-generate.
5112 * acinclude.m4 (SRV_CHECK_THREAD_DB): Add ps_get_thread_area. Reset
5114 * aclocal.m4: Regenerated.
5115 * configure: Regenerated.
5119 * linux-m68k-low.c (m68k_num_gregs): Define.
5120 (m68k_fill_gregset, m68k_store_gregset, m68k_fill_fpregset)
5121 (m68k_store_fpregset, target_regsets) [HAVE_LINUX_REGSETS]: New.
5122 (m68k_breakpoint, m68k_breakpoint_len, m68k_get_pc, m68k_set_pc)
5123 (m68k_breakpoint_at): New. Add to the_low_target.
5125 * configure.srv (m68*-*-linux*): Set srv_linux_regsets and
5126 srv_linux_thread_db to yes.
5130 * linux-x86-64-low.c (ARCH_SET_GS): Add definition if missing.
5131 (ARCH_SET_FS): Likewise.
5132 (ARCH_GET_FS): Likewise.
5133 (ARCH_GET_GS): Likewise.
5137 * linux-i386-low.c (ps_get_thread_area): New.
5138 * linux-x86-64-low.c (ps_get_thread_area): New.
5139 * linux-low.c: Include <sys/syscall.h>.
5140 (linux_kill_one_process): Don't kill the first thread here.
5141 (linux_kill): Kill the first thread here.
5142 (kill_lwp): New function.
5143 (send_sigstop, linux_send_signal): Use it.
5144 * proc-service.c: Clean up #ifdefs.
5145 (fpregset_info): Delete.
5146 (ps_lgetregs): Update and enable implementation.
5147 (ps_lsetregs, ps_lgetfpregs, ps_lsetfpregs): Remove disabled
5149 * remote-utils.c (struct sym_cache, symbol_cache): New.
5150 (input_interrupt): Print a clearer message.
5151 (async_io_enabled): New variable.
5152 (enable_async_io, disable_async_io): Use it. Update comments.
5153 (look_up_one_symbol): Use the symbol cache.
5154 * thread-db.c (thread_db_look_up_symbols): New function.
5155 (thread_db_init): Update comments. Call thread_db_look_up_symbols.
5159 * configure.in: Test for -rdynamic.
5160 * configure: Regenerated.
5161 * Makefile (INTERNAL_LDFLAGS): New.
5162 (gdbserver, gdbreplay): Use it.
5166 * Makefile.in (TAGS): Replace TM_FILE with DEPRECATED_TM_FILE.
5170 * linux-low.c (linux_wait): Clear all_processes list also.
5174 * linux-low.c: Include <errno.h>. Remove extern declaration of
5179 * gdbreplay.c, server.h, utils.c: Update copyright years.
5183 * server.c (main): Print child status or termination signal from
5184 variable 'signal', not 'sig'.
5188 * linux-low.c (linux_read_memory): Change return type to
5189 int. Check for and return error from ptrace().
5190 * target.c (read_inferior_memory): Change return type to int. Pass
5191 back return status from the_target->read_memory().
5192 * target.h (struct target_ops): Adapt *read_memory() prototype.
5194 (read_inferior_memory): Adapt prototype.
5195 * server.c (main): Return an error packet if
5196 read_inferior_memory() returns an error.
5200 * Makefile.in (distclean): Remove config.h, stamp-h, and config.log.
5201 Unify with other clean targets.
5205 * server.c (handle_v_cont): Call set_desired_inferior.
5209 * remote-utils.c (prepare_resume_reply): Always supply "thread:".
5213 * linux-low.c (linux_wait): Unblock async I/O.
5214 (linux_resume): Block and enable async I/O.
5215 * remote-utils.c (block_async_io, unblock_async_io): New functions.
5216 * server.h (block_async_io, unblock_async_io): Add prototypes.
5220 * remote-utils.c (remote_open): Print a status notice after
5222 * server.c (attach_inferior): Print a status notice after
5227 * linux-arm-low.c (arm_get_pc): Print out stop PC in debug mode.
5231 * remote-utils.c (write_enn): Use "E01" instead of "ENN" for the
5233 * server.c, target.h: Update copyright years.
5237 * target.h (struct target_ops): New member `read_auxv'.
5238 * server.c (handle_query): Handle qPart:auxv:read: query using that.
5239 * linux-low.c (linux_read_auxv): New function.
5240 (linux_target_ops): Initialize `read_auxv' member to that.
5246 * linux-s390-low.c (s390_num_regs): Update.
5247 (s390_regmap): Remove control registers. Use __s390x__ predefine
5248 instead of GPR_SIZE to distiguish s390 and s390x targets.
5252 * linux-low.c: Update copyright year.
5253 (check_removed_breakpoint): Clear pending_is_breakpoint.
5254 (linux_set_resume_request, linux_queue_one_thread)
5255 (resume_status_pending_p): New functions.
5256 (linux_continue_one_thread): Use process->resume.
5257 (linux_resume): Only resume threads if there are no pending events.
5258 * linux-low.h (struct process_info): Add resume request
5263 * regcache.c (new_register_cache): Clear the allocated register
5268 * linux-low.c (linux_resume): Take a struct thread_resume *
5270 (linux_wait): Update call.
5271 (resume_ptr): New static variable.
5272 (linux_continue_one_thread): Renamed from
5273 linux_continue_one_process. Use resume_ptr.
5274 (linux_resume): Use linux_continue_one_thread.
5275 * server.c (handle_v_cont, handle_v_requests): New functions.
5276 (myresume): New function.
5277 (main): Handle 'v' case.
5278 * target.h (struct thread_resume): New type.
5279 (struct target_ops): Change argument of "resume" to struct
5281 (myresume): Delete macro.
5285 * Makefile.in (install-only): Create dest dir. Support DESTDIR.
5286 (uninstall): Support DESTDIR.
5290 * configure.srv: Add xscale*linux copy of arm*linux entry.
5294 * linux-arm-low.c (arm_reinsert_addr): New function.
5295 (the_low_target): Add arm_reinsert_addr.
5299 * mem-break.c: Remove whitespace at end of file.
5303 * configure.in: Check whether we need to prototype strerror.
5304 * server.h: Optionally prototype strerror.
5305 * gdbreplay.c (perror_with_name): Use strerror.
5306 * linux-low.c (linux_attach_lwp): Use strerror.
5307 * utils.c (perror_with_name): Use strerror.
5308 * config.in, configure: Regenerated.
5312 * linux-sh-low.c (sh_regmap): Fix FP register offsets, reported by
5317 * Makefile.in (SFILES): Update.
5318 * low-hppabsd.c, low-lynx.c, low-nbsd.c, low-sim.c, low-sparc.c,
5319 low-sun3.c: Remove files.
5323 * linux-low.c: Move comment to linux_thread_alive where it belonged.
5324 (linux_detach_one_process, linux_detach): New functions.
5325 (linux_target_ops): Add linux_detach.
5326 * server.c (main): Handle 'D' packet.
5327 * target.h (struct target_ops): Add "detach" member.
5328 (detach_inferior): Define.
5333 * configure.srv: Accept i[34567]86 variants.
5337 * linux-low.c (linux_wait_for_event): Correct comment typos.
5338 (linux_resume_one_process): Call check_removed_breakpoint.
5339 (linux_send_signal): New function.
5340 (linux_target_ops): Add linux_send_signal.
5341 * remote-utils.c (putpkt, input_interrupt): Use send_signal instead
5343 * target.h (struct target_ops): Add send_signal.
5347 * linux-low.c (usr_store_inferior_registers): Transfer buf in
5348 PTRACE_XFER_TYPE-sized chunks, not int-sized chunks. Otherwise,
5349 if 'int' is smaller than PTRACE_XFER_TYPE, you end up throwing
5350 away part of the register's value.
5354 * linux-low.c (linux_create_inferior): Use __SIGRTMIN.
5355 (linux_wait_for_event, linux_init_signals): Likewise.
5359 * configure.in: Check for stdlib.h.
5360 * configure: Regenerated.
5361 * config.in: Regenerated.
5365 * linux-m68k-low.c (m68k_num_regs): Define to 29 instead of 31.
5369 * Makefile.in: Remove obsolete code.
5373 * linux-s390-low.c (s390_regmap): Check GPR_SIZE instead of
5374 defined(PT_FPR0_HI).
5378 * linux-arm-low.c (arm_num_regs): Increase.
5379 (arm_regmap): Include status register.
5383 * linux-low.c (register_addr): Remove incorrect -1 check.
5387 * linux-low.c (linux_create_inferior): Call setpgid. Return
5389 (unstopped_p, linux_signal_pid): Remove.
5390 (linux_target_ops): Remove linux_signal_pid.
5391 * remote-utils.c (putpkt, input_interrupt): Use signal_pid
5392 global instead of target method.
5393 * target.h (struct target_ops): Remove signal_pid. Update comment
5394 for create_inferior.
5395 * server.c (signal_pid): New variable.
5396 (create_inferior): Set signal_pid. Block SIGTTOU and SIGTTIN in
5397 gdbserver. Set the child to be the foreground process group.
5398 (attach_inferior): Set signal_pid.
5402 * ChangeLog: New file, with entries from gdb/ChangeLog after GDB 5.2.
5406 * Makefile.in (LDFLAGS): Allow the configure script to establish a
5411 * Makefile.in: Make chill references obsolete.
5415 * configure.in (unistd.h): Add to AC_CHECK_HEADERS list.
5416 * configure: Regenerate.
5417 * config.in: Regenerate.
5421 * gdbreplay.c (stdlib.h, unistd.h): Conditionaly include.
5422 (perror_with_name, remote_close, remote_open, expect, play): Static.
5426 * linux-x86-64-low.c (x86_64_regmap): Make it an array of
5427 byte offsets instead of an array of indexes.
5428 (x86_64_store_gregset, x86_64_store_fpregset): Parameter made const.
5432 * regcache.c: Add comment.
5436 * thread-db.c: New file.
5437 * proc-service.c: New file.
5438 * acinclude.m4: New file.
5439 * Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h,
5440 proc-service.o, and thread-db.o.
5441 (linux-low.o): Add USE_THREAD_DB.
5442 * acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T,
5443 HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN.
5444 * aclocal.m4: Regenerated.
5445 * config.in: Regenerated.
5446 * configure: Regenerated.
5447 * configure.in: Check for proc_service.h, sys/procfs.h,
5448 thread_db.h, and linux/elf.h headrs.
5449 Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and
5450 PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB.
5451 Check for -lthread_db and thread support.
5452 * configure.srv: Enable thread_db support for ARM, i386, MIPS,
5453 PowerPC, and SuperH.
5454 * i387-fp.c: Constify arguments.
5455 * i387-fp.h: Likewise.
5456 * inferiors.c: (struct thread_info): Renamed from
5457 `struct inferior_info'. Remove PID member. Use generic inferior
5458 list header. All uses updated.
5459 (inferiors, signal_pid): Removed.
5460 (all_threads): New variable.
5461 (get_thread): Define.
5462 (add_inferior_to_list): New function.
5463 (for_each_inferior): New function.
5464 (change_inferior_id): New function.
5465 (add_inferior): Removed.
5466 (remove_inferior): New function.
5467 (add_thread): New function.
5468 (free_one_thread): New function.
5469 (remove_thread): New function.
5470 (clear_inferiors): Use for_each_inferior and free_one_thread.
5471 (find_inferior): New function.
5472 (find_inferior_id): New function.
5473 (inferior_target_data): Update argument type.
5474 (set_inferior_target_data): Likewise.
5475 (inferior_regcache_data): Likewise.
5476 (set_inferior_regcache_data): Likewise.
5477 * linux-low.c (linux_bp_reinsert): Remove.
5478 (all_processes, stopping_threads, using_thrads)
5479 (struct pending_signals, debug_threads, pid_of): New.
5480 (inferior_pid): Replace with macro.
5481 (struct inferior_linux_data): Remove.
5482 (get_stop_pc, add_process): New functions.
5483 (linux_create_inferior): Restore SIGRTMIN+1 before calling exec.
5484 Use add_process and add_thread.
5485 (linux_attach_lwp): New function, based on old linux_attach. Use
5486 add_process and add_thread. Set stop_expected for new threads.
5487 (linux_attach): New function.
5488 (linux_kill_one_process): New function.
5489 (linux_kill): Kill all LWPs.
5490 (linux_thread_alive): Use find_inferior_id.
5491 (check_removed_breakpoints, status_pending_p): New functions.
5492 (linux_wait_for_process): Renamed from linux_wait_for_one_inferior.
5493 Update. Use WNOHANG. Wait for cloned processes also. Update process
5494 struct for the found process.
5495 (linux_wait_for_event): New function.
5496 (linux_wait): Use it. Support LWPs.
5497 (send_sigstop, wait_for_sigstop, stop_all_processes)
5498 (linux_resume_one_process, linux_continue_one_process): New functions.
5499 (linux_resume): Support LWPs.
5500 (REGISTER_RAW_SIZE): Remove.
5501 (fetch_register): Use register_size instead. Call supply_register.
5502 (usr_store_inferior_registers): Likewise. Call collect_register.
5504 (regsets_fetch_inferior_registers): Improve error message.
5505 (regsets_store_inferior_registers): Add debugging.
5506 (linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB.
5507 (unstopped_p, linux_signal_pid): New functions.
5508 (linux_target_ops): Add linux_signal_pid.
5509 (linux_init_signals): New function.
5510 (initialize_low): Call it. Initialize using_threads.
5511 * regcache.c (inferior_regcache_data): Add valid
5513 (get_regcache): Fetch registers lazily. Add fetch argument
5514 and update all callers.
5515 (regcache_invalidate_one, regcache_invalidate): New
5517 (new_register_cache): Renamed from create_register_cache.
5518 Return the new regcache.
5519 (free_register_cache): Change argument to a void *.
5520 (registers_to_string, registers_from_string): Call get_regcache
5521 with fetch flag set.
5522 (register_data): Make static. Pass fetch flag to get_regcache.
5523 (supply_register): Call get_regcache with fetch flag clear.
5524 (collect_register): Call get_regcache with fetch flag set.
5525 (collect_register_as_string): New function.
5526 * regcache.h: Update.
5527 * remote-utils.c (putpkt): Flush after debug output and use
5529 Handle input interrupts while waiting for an ACK.
5530 (input_interrupt): Use signal_pid method.
5531 (getpkt): Flush after debug output and use stderr.
5532 (outreg): Use collect_register_as_string.
5533 (new_thread_notify, dead_thread_notify): New functions.
5534 (prepare_resume_reply): Check using_threads. Set thread_from_wait
5536 (look_up_one_symbol): Flush after debug output.
5537 * server.c (step_thread, server_waiting): New variables.
5538 (start_inferior): Don't use signal_pid. Update call to mywait.
5539 (attach_inferior): Update call to mywait.
5540 (handle_query): Handle qfThreadInfo and qsThreadInfo.
5541 (main): Don't fetch/store registers explicitly. Use
5542 set_desired_inferior. Support proposed ``Hs'' packet. Update
5545 (struct inferior_list, struct_inferior_list_entry): New.
5546 * target.c (set_desired_inferior): New.
5547 (write_inferior_memory): Constify.
5548 (mywait): New function.
5550 (struct target_ops): New signal_pid method.
5551 (mywait): Removed macro, added prototype.
5553 * linux-low.h (regset_func): Removed.
5554 (regset_fill_func, regset_store_func): New.
5555 (enum regset_type): New.
5556 (struct regset_info): Add type field. Use new operation types.
5557 (struct linux_target_ops): stop_pc renamed to get_pc.
5558 Add decr_pc_after_break and breakpoint_at.
5559 (get_process, get_thread_proess, get_process_thread)
5560 (strut process_info, all_processes, linux_attach_lwp)
5561 (thread_db_init): New.
5563 * linux-arm-low.c (arm_get_pc, arm_set_pc,
5564 arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New.
5565 (the_low_target): Add new members.
5566 * linux-i386-low.c (i386_store_gregset, i386_store_fpregset)
5567 (i386_store_fpxregset): Constify.
5568 (target_regsets): Add new kind identifier.
5569 (i386_get_pc): Renamed from i386_stop_pc. Simplify.
5570 (i386_set_pc): Add debugging.
5571 (i386_breakpoint_at): New function.
5572 (the_low_target): Add new members.
5573 * linux-mips-low.c (mips_get_pc, mips_set_pc)
5574 (mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr)
5575 (mips_breakpoint_at): New.
5576 (the_low_target): Add new members.
5577 * linux-ppc-low.c (ppc_get_pc, ppc_set_pc)
5578 (ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New.
5579 (the_low_target): Add new members.
5580 * linux-sh-low.c (sh_get_pc, sh_set_pc)
5581 (sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New.
5582 (the_low_target): Add new members.
5583 * linux-x86-64-low.c (target_regsets): Add new kind
5589 * server.c (gdbserver_usage): New function.
5594 * mem-break.c (reinsert_breakpoint_by_bp): Correct typo
5599 * Makefile.in: Remove obsolete code.
5603 * linux-low.c (regsets_fetch_inferior_registers),
5604 (regsets_store_inferior_registers): Removed cast to int from
5606 * regcache.h: Added declaration of struct inferior_info.
5610 * inferiors.c (struct inferior_info): Add regcache_data.
5611 (add_inferior): Call create_register_cache.
5612 (clear_inferiors): Call free_register_cache.
5613 (inferior_regcache_data, set_inferior_regcache_data): New functions.
5614 * regcache.c (struct inferior_regcache_data): New.
5615 (registers): Remove.
5616 (get_regcache): New function.
5617 (create_register_cache, free_register_cache): New functions.
5618 (set_register_cache): Don't initialize the register cache here.
5619 (registers_to_string, registers_from_string, register_data): Call
5621 * regcache.h: Add prototypes.
5622 * server.h: Likewise.
5626 * mem-break.c: New file.
5627 * mem-break.h: New file.
5628 * Makefile.in: Add mem-break.o rule; update server.h
5630 * inferiors.c (struct inferior_info): Add target_data
5632 (clear_inferiors): Free target_data member if set.
5633 (inferior_target_data, set_inferior_target_data): New functions.
5634 * linux-i386-low.c (i386_breakpoint, i386_breakpoint_len)
5635 (i386_stop_pc, i386_set_pc): New. Add to the_low_target.
5636 * linux-low.c (linux_bp_reinsert): New variable.
5637 (struct inferior_linux_data): New.
5638 (linux_create_inferior): Use set_inferior_target_data.
5639 (linux_attach): Likewise. Call add_inferior.
5640 (linux_wait_for_one_inferior): New function.
5641 (linux_wait): Call it.
5642 (linux_write_memory): Add const.
5643 (initialize_low): Call set_breakpoint_data.
5644 * linux-low.h (struct linux_target_ops): Add breakpoint
5646 * server.c (attach_inferior): Remove extra add_inferior
5648 * server.h: Include mem-break.h. Update inferior.c
5650 * target.c (read_inferior_memory)
5651 (write_inferior_memory): New functions.
5652 * target.h (read_inferior_memory)
5653 (write_inferior_memory): Change macros to prototypes.
5654 (struct target_ops): Update comments. Add const to write_memory
5659 * linux-low.c (usr_store_inferior_registers): Support
5660 registers which are allowed to fail to store.
5661 * linux-low.h (linux_target_ops): Likewise.
5662 * linux-ppc-low.c (ppc_regmap): Support FPSCR.
5663 (ppc_cannot_store_register): FPSCR may not be storable.
5667 * server.h: Include <string.h> if HAVE_STRING_H.
5668 * ChangeLog: Correct paths in last ChangeLog entry.
5672 * linux-low.h: Remove obsolete prototypes.
5673 (struct linux_target_ops): New.
5674 (extern the_low_target): New.
5675 * linux-low.c (num_regs, regmap): Remove declarations.
5676 (register_addr): Use the_low_target explicitly.
5677 (fetch_register): Likewise.
5678 (usr_fetch_inferior_registers): Likewise.
5679 (usr_store_inferior_registers): Likewise.
5680 * linux-arm-low.c (num_regs): Remove.
5681 (arm_num_regs): Define.
5682 (arm_regmap): Renamed from regmap, made static.
5683 (arm_cannot_fetch_register): Renamed from cannot_fetch_register,
5685 (arm_cannot_store_register): Renamed from cannot_store_register,
5687 (the_low_target): New.
5688 * linux-i386-low.c (num_regs): Remove.
5689 (i386_num_regs): Define.
5690 (i386_regmap): Renamed from regmap, made static.
5691 (i386_cannot_fetch_register): Renamed from cannot_fetch_register,
5693 (i386_cannot_store_register): Renamed from cannot_store_register,
5695 (the_low_target): New.
5696 * linux-ia64-low.c (num_regs): Remove.
5697 (ia64_num_regs): Define.
5698 (ia64_regmap): Renamed from regmap, made static.
5699 (ia64_cannot_fetch_register): Renamed from cannot_fetch_register,
5701 (ia64_cannot_store_register): Renamed from cannot_store_register,
5703 (the_low_target): New.
5704 * linux-m68k-low.c (num_regs): Remove.
5705 (m68k_num_regs): Define.
5706 (m68k_regmap): Renamed from regmap, made static.
5707 (m68k_cannot_fetch_register): Renamed from cannot_fetch_register,
5709 (m68k_cannot_store_register): Renamed from cannot_store_register,
5711 (the_low_target): New.
5712 * linux-mips-low.c (num_regs): Remove.
5713 (mips_num_regs): Define.
5714 (mips_regmap): Renamed from regmap, made static.
5715 (mips_cannot_fetch_register): Renamed from cannot_fetch_register,
5717 (mips_cannot_store_register): Renamed from cannot_store_register,
5719 (the_low_target): New.
5720 * linux-ppc-low.c (num_regs): Remove.
5721 (ppc_num_regs): Define.
5722 (ppc_regmap): Renamed from regmap, made static.
5723 (ppc_cannot_fetch_register): Renamed from cannot_fetch_register,
5725 (ppc_cannot_store_register): Renamed from cannot_store_register,
5727 (the_low_target): New.
5728 * linux-s390-low.c (num_regs): Remove.
5729 (s390_num_regs): Define.
5730 (s390_regmap): Renamed from regmap, made static.
5731 (s390_cannot_fetch_register): Renamed from cannot_fetch_register,
5733 (s390_cannot_store_register): Renamed from cannot_store_register,
5735 (the_low_target): New.
5736 * linux-sh-low.c (num_regs): Remove.
5737 (sh_num_regs): Define.
5738 (sh_regmap): Renamed from regmap, made static.
5739 (sh_cannot_fetch_register): Renamed from cannot_fetch_register,
5741 (sh_cannot_store_register): Renamed from cannot_store_register,
5743 (the_low_target): New.
5744 * linux-x86-64-low.c (x86_64_regmap): Renamed from regmap.
5745 (the_low_target): New.
5749 * Makefile.in: Add stamp-h target.
5750 * configure.in: Create stamp-h.
5751 * configure: Regenerated.
5755 * inferiors.c: New file.
5756 * target.c: New file.
5757 * target.h: New file.
5758 * Makefile.in: Add target.o and inferiors.o. Update
5760 * linux-low.c (inferior_pid): New static variable,
5761 moved from server.c.
5762 (linux_create_inferior): Renamed from create_inferior.
5763 Call add_inferior. Return 0 on success instead of a PID.
5764 (linux_attach): Renamed from myattach.
5765 (linux_kill): Renamed from kill_inferior. Call clear_inferiors ().
5766 (linux_thread_alive): Renamed from mythread_alive.
5767 (linux_wait): Renamed from mywait. Call clear_inferiors () if the
5769 (linux_resume): Renamed from myresume. Add missing ``return 0''.
5770 (regsets_store_inferior_registers): Correct error message.
5771 Add missing ``return 0''.
5772 (linux_fetch_registers): Renamed from fetch_inferior_registers.
5773 (linux_store_registers): Renamed from store_inferior_registers.
5774 (linux_read_memory): Renamed from read_inferior_memory.
5775 (linux_write_memory): Renamed from write_inferior_memory.
5776 (linux_target_ops): New structure.
5777 (initialize_low): Call set_target_ops ().
5778 * remote-utils.c (unhexify): New function.
5779 (hexify): New function.
5780 (input_interrupt): Send signals to ``signal_pid''.
5781 * server.c (inferior_pid): Remove.
5782 (start_inferior): Update create_inferior call.
5783 (attach_inferior): Call add_inferior.
5784 (handle_query): New function.
5785 (main): Call handle_query for `q' packets.
5786 * server.h: Include "target.h". Remove obsolete prototypes.
5787 Add prototypes for "inferiors.c", "target.c", hexify, and unhexify.
5791 * Makefile.in: Add WARN_CFLAGS. Update configury
5793 * configure.in: Check for <string.h>
5794 * configure: Regenerate.
5795 * config.in: Regenerate.
5796 * gdbreplay.c: Include needed system headers.
5797 (remote_open): Remove strchr prototype.
5798 * linux-low.h: Correct #ifdef to HAVE_LINUX_USRREGS.
5799 * regcache.c (supply_register): Change buf argument to const void *.
5800 (supply_register_by_name): Likewise.
5801 (collect_register): Change buf argument to void *.
5802 (collect_register_by_name): Likewise.
5803 * regcache.h: Add missing prototypes.
5804 * remote-utils.c: Include <arpa/inet.h> for inet_ntoa.
5805 * server.c (handle_query): New function.
5806 (attached): New static variable, moved out of main.
5807 (main): Quiet longjmp clobber warnings.
5808 * server.h: Add ATTR_NORETURN and ATTR_FORMAT. Update prototypes.
5809 * utils.c (error): Remove NORETURN.