2009-11-17 Vladimir Prus <vladimir@codesourcery.com>
* Makefile.in (reg-cf.o, reg-cf.c): New targets.
* configure.ac: Check for __mcoldfire__ and set
gdb_cv_m68k_is_coldfire.
* configure.srv: Use gdb_cv_m68k_is_coldfire to select between
reg-cf.o and reg-m68k.o.
* configure: Regenerated.
2009-11-17 Nathan Sidwell <nathan@codesourcery.com>
* regformats/reg-cf.dat: New file.
Pass it to thread_db_free.
(linux_kill, linux_detach, linux_wait_1): Adjust to pass the
proper `detaching' argument to linux_remove_process.
* linux-low.h (thread_db_free): Add `detaching' parameter.
* thread-db.c (thread_db_init): Pass false as `detaching' argument
to thread_db_free.
(thread_db_free): Add `detaching' parameter. Only
call td_ta_clear_event if detaching from process.
PR gdb/10757
* thread-db.c (attach_thread): New function.
(maybe_attach_thread): Return success/failure.
(find_new_threads_callback): Adjust.
(thread_db_find_new_threads): Loop until no new threads.
* linux-nat.c: Include <sys/vfs.h>.
(SPUFS_MAGIC): Define.
(spu_enumerate_spu_ids): New function.
(linux_proc_xfer_spu): New function.
(linux_xfer_partial): Handle TARGET_OBJECT_SPU.
(iterate_over_spus): New function.
(struct linux_spu_corefile_data): New data type.
(linux_spu_corefile_callback): New function.
(linux_spu_make_corefile_notes): New function.
(linux_nat_make_corefile_notes): Call it.
* corelow.c (struct spuid_list): New data type.
(add_to_spuid_list): New function.
(core_xfer_partial): Handle TARGET_OBJECT_SPU.
gdbserver/ChangeLog:
* linux-low.c: Include <sys/stat.h> and <sys/vfs.h>.
(SPUFS_MAGIC): Define.
(spu_enumerate_spu_ids): New function.
(linux_qxfer_spu): New function.
(linux_target_ops): Install linux_qxfer_spu.
* configure: Regenerated.
* configure.ac: Add case for srv_qnx and set LIBS accordingly.
* configure.srv (i[34567]86-*-nto*): New target.
* nto-low.c, nto-low.h, nto-x86-low.c: New files.
* remote-utils.c [__QNX__]: Include sys/iomgr.h
(nto_comctrl) [__QNX__]: New function.
(enable_async_io, disable_async_io) [__QNX__]: Call nto_comctrl.
Pedro Alves <pedro@codesourcery.com>
* target.h (struct target_ops) <supports_multi_process>: New
callback.
(target_supports_multi_process): New.
* server.c (handle_query): Even if GDB reports support, only
enable multi-process if the target also supports it. Report
multi-process support only if the target backend supports it.
* linux-low.c (linux_supports_multi_process): New function.
(linux_target_ops): Install it as target_supports_multi_process
callback.
Global renaming of find_thread_pid to find_thread_ptid.
* gdbthread.h (find_thread_ptid): Renamed from find_thread_pid.
* thread.c (find_thread_ptid): Renamed from find_thread_pid.
All callers updated.
gdbserver:
Global renaming of find_thread_pid to find_thread_ptid.
* server.h (find_thread_ptid): Renamed from find_thread_pid.
* inferiors.c (find_thread_ptid): Renamed from find_thread_pid.
All callers updated.
* linux-low.c (must_set_ptrace_flags): Delete.
(linux_create_inferior): Set `lwp->must_set_ptrace_flags' instead
of the global.
(linux_attach_lwp_1): Don't set PTRACE_SETOPTIONS here. Set
`lwp->must_set_ptrace_flags' instead.
(linux_wait_for_event_1): If ptrace options here.
(linux_wait_1): ... not here.
(attached_inferior_callback): New function.
(have_started_inferiors_p, have_attached_inferiors_p): New functions.
* server.c (print_started_pid, print_attached_pid): New functions.
(detach_or_kill_for_exit): New function.
(main): Call it instead of for_each_inferior (kill_inferior_callback).
* server.h (have_started_inferiors_p): Declare.
(have_attached_inferiors_p): Declare.
* server.h (get_thread_process): Add prototype.
* thread-db.c (find_one_thread): Use get_thread_process
instead of current_process.
(thread_db_get_tls_address): Do not crash if called when
thread layer is not yet initialized.
Implement the multiprocess extensions, and add linux multiprocess
support.
* server.h (ULONGEST): Declare.
(struct ptid, ptid_t): New.
(minus_one_ptid, null_ptid): Declare.
(ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp)
(ptid_get_tid, ptid_equal, ptid_is_pid): Declare.
(struct inferior_list_entry): Change `id' type from unsigned from
to ptid_t.
(struct sym_cache, struct breakpoint, struct
process_info_private): Forward declare.
(struct process_info): Declare.
(current_process): Declare.
(all_processes): Declare.
(initialize_inferiors): Declare.
(add_thread): Adjust to use ptid_t.
(thread_id_to_gdb_id, thread_to_gdb_id, gdb_id_to_thread_id): Ditto.
(add_process, remove_process, find_thread_pid): Declare.
(find_inferior_id): Adjust to use ptid_t.
(cont_thread, general_thread, step_thread): Change type to ptid_t.
(multi_process): Declare.
(push_event): Adjust to use ptid_t.
(read_ptid, write_ptid): Declare.
(prepare_resume_reply): Adjust to use ptid_t.
(clear_symbol_cache): Declare.
* inferiors.c (all_processes): New.
(null_ptid, minus_one_ptid): New.
(ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp)
(ptid_get_tid, ptid_equal, ptid_is_pid): New.
(add_thread): Change unsigned long to ptid. Remove gdb_id
parameter. Adjust.
(thread_id_to_gdb_id, thread_to_gdb_id): Change unsigned long to ptid.
(gdb_id_to_thread): Rename to ...
(find_thread_pid): ... this. Change unsigned long to ptid.
(gdb_id_to_thread_id, find_inferior_id): Change unsigned long to ptid.
(loaded_dll, pull_pid_from_list): Adjust.
(add_process, remove_process, find_process_pid)
(get_thread_process, current_process, initialize_inferiors): New.
* target.h (struct thread_resume) <thread>: Change type to ptid_t.
(struct target_waitstatus) <related_pid>: Ditto.
(struct target_ops) <kill, detach>: Add `pid' argument. Change
return type to int.
(struct target_ops) <join>: Add `pid' argument.
(struct target_ops) <thread_alive>: Change pid's type to ptid_t.
(struct target_ops) <wait>: Add `ptid' field. Change return type
to ptid.
(kill_inferior, detach_inferior, join_inferior): Add `pid' argument.
(mywait): Add `ptid' argument. Change return type to ptid_t.
(target_pid_to_str): Declare.
* target.c (set_desired_inferior): Adjust to use ptids.
(mywait): Add new `ptid' argument. Adjust.
(target_pid_to_str): New.
* mem-break.h (free_all_breakpoints): Declare.
* mem-break.c (breakpoints): Delelete.
(set_breakpoint_at, delete_breakpoint, find_breakpoint_at)
(check_mem_read, check_mem_write, delete_all_breakpoints): Adjust
to use per-process breakpoint list.
(free_all_breakpoints): New.
* remote-utils.c (struct sym_cache) <name>: Drop `const'.
(symbol_cache, all_symbols_looked_up): Delete.
(hexchars): New.
(ishex, unpack_varlen_hex, write_ptid, hex_or_minus_one,
read_ptid): New.
(prepare_resume_reply): Change ptid argument's type from unsigned
long to ptid_t. Adjust. Implement W;process and X;process.
(free_sym_cache, clear_symbol_cache): New.
(look_up_one_symbol): Adjust to per-process symbol cache. *
* server.c (cont_thread, general_thread, step_thread): Change type
to ptid_t.
(attached): Delete.
(multi_process): New.
(last_ptid): Change type to ptid_t.
(struct vstop_notif) <ptid>: Change type to ptid_t.
(queue_stop_reply, push_event): Change `ptid' argument's type to
ptid_t.
(discard_queued_stop_replies): Add `pid' argument.
(start_inferior): Adjust to use ptids. Adjust to mywait interface
changes. Don't reference the `attached' global.
(attach_inferior): Adjust to mywait interface changes.
(handle_query): Adjust to use ptids. Parse GDB's qSupported
features. Handle and report "multiprocess+". Handle
"qAttached:PID".
(handle_v_cont): Adjust to use ptids. Adjust to mywait interface
changes.
(handle_v_kill): New.
(handle_v_stopped): Adjust to use target_pid_to_str.
(handle_v_requests): Allow multiple attaches and runs when
multiprocess extensions are in effect. Handle "vKill".
(myresume): Adjust to use ptids.
(queue_stop_reply_callback): Add `arg' parameter. Handle it.
(handle_status): Adjust to discard_queued_stop_replies interface
change.
(first_thread_of, kill_inferior_callback)
(detach_or_kill_inferior_callback, join_inferiors_callback): New.
(main): Call initialize_inferiors. Adjust to use ptids, killing
and detaching from all inferiors. Handle multiprocess packet
variants.
* linux-low.h: Include gdb_proc_service.h.
(struct process_info_private): New.
(struct linux_target_ops) <pid_of>: Use ptid_get_pid.
<lwpid_of>: Use ptid_get_lwp.
(get_lwp_thread): Adjust.
(struct lwp_info): Add `dead' member.
(find_lwp_pid): Declare.
* linux-low.c (thread_db_active): Delete.
(new_inferior): Adjust comment.
(inferior_pid): Delete.
(linux_add_process): New.
(handle_extended_wait): Adjust.
(add_lwp): Change unsigned long to ptid.
(linux_create_inferior): Add process to processes table. Adjust
to use ptids. Don't set new_inferior here.
(linux_attach_lwp): Rename to ...
(linux_attach_lwp_1): ... this. Add `initial' argument. Handle
it. Adjust to use ptids.
(linux_attach_lwp): New.
(linux_attach): Add process to processes table. Don't set
new_inferior here.
(struct counter): New.
(second_thread_of_pid_p, last_thread_of_process_p): New.
(linux_kill_one_lwp): Add `args' parameter. Handle it. Adjust to
multiple processes.
(linux_kill): Add `pid' argument. Handle it. Adjust to multiple
processes. Remove process from process table.
(linux_detach_one_lwp): Add `args' parameter. Handle it. Adjust
to multiple processes.
(any_thread_of): New.
(linux_detach): Add `pid' argument, and handle it. Remove process
from processes table.
(linux_join): Add `pid' argument. Handle it.
(linux_thread_alive): Change unsighed long argument to ptid_t.
Consider dead lwps as not being alive.
(status_pending_p): Rename `dummy' argument to `arg'. Filter out
threads we're not interested in.
(same_lwp, find_lwp_pid): New.
(linux_wait_for_lwp): Change `pid' argument's type from int to
ptid_t. Adjust.
(linux_wait_for_event): Rename to ...
(linux_wait_for_event_1): ... this. Change `pid' argument's type
from int to ptid_t. Adjust.
(linux_wait_for_event): New.
(linux_wait_1): Add `ptid' argument. Change return type to
ptid_t. Adjust. Use last_thread_of_process_p. Remove processes
that exit from the process table.
(linux_wait): Add `ptid' argument. Change return type to ptid_t.
Adjust.
(mark_lwp_dead): New.
(wait_for_sigstop): Adjust to use ptids. If a process exits while
stopping all threads, mark its main lwp as dead.
(linux_set_resume_request, linux_resume_one_thread): Adjust to use
ptids.
(fetch_register, usr_store_inferior_registers)
(regsets_fetch_inferior_registers)
(regsets_store_inferior_registers, linux_read_memory)
(linux_write_memory): Inline `inferior_pid'.
(linux_look_up_symbols): Adjust to use per-process
`thread_db_active'.
(linux_request_interrupt): Adjust to use ptids.
(linux_read_auxv): Inline `inferior_pid'.
(initialize_low): Don't reference thread_db_active.
* gdb_proc_service.h (struct ps_prochandle) <pid>: Remove.
* proc-service.c (ps_lgetregs): Use find_lwp_pid.
(ps_getpid): Return the pid of the current inferior.
* thread-db.c (proc_handle, thread_agent): Delete.
(thread_db_create_event, thread_db_enable_reporting): Adjust to
per-process data.
(find_one_thread): Change argument type to ptid_t. Adjust to
per-process data.
(maybe_attach_thread): Adjust to per-process data and ptids.
(thread_db_find_new_threads): Ditto.
(thread_db_init): Ditto.
* spu-low.c (spu_create_inferior, spu_attach): Add process to
processes table. Adjust to use ptids.
(spu_kill, spu_detach): Adjust interface. Remove process from
processes table.
(spu_join, spu_thread_alive): Adjust interface.
(spu_wait): Adjust interface. Remove process from processes
table. Adjust to use ptids.
* win32-low.c (current_inferior_tid): Delete.
(current_inferior_ptid): New.
(debug_event_ptid): New.
(thread_rec): Take a ptid. Adjust.
(child_add_thread): Add `pid' argument. Adjust to use ptids.
(child_delete_thread): Ditto.
(do_initial_child_stuff): Add `attached' argument. Add process to
processes table.
(child_fetch_inferior_registers, child_store_inferior_registers):
Adjust.
(win32_create_inferior): Pass 0 to do_initial_child_stuff.
(win32_attach): Pass 1 to do_initial_child_stuff.
(win32_kill): Adjust interface. Remove process from processes
table.
(win32_detach): Ditto.
(win32_join): Adjust interface.
(win32_thread_alive): Take a ptid.
(win32_resume): Adjust to use ptids.
(get_child_debug_event): Ditto.
(win32_wait): Adjust interface. Remove exiting process from
processes table.
* server.h (non_stop): Declare.
(gdb_client_data, handler_func): Declare.
(delete_file_handler, add_file_handler, start_event_loop):
Declare.
(handle_serial_event, handle_target_event, push_event)
(putpkt_notif): Declare.
* target.h (enum resume_kind): New.
(struct thread_resume): Replace `step' field by `kind' field.
(TARGET_WNOHANG): Define.
(struct target_ops) <wait>: Add `options' argument.
<supports_non_stop, async, start_non_stop>: New fields.
(target_supports_non_stop, target_async): New.
(start_non_stop): Declare.
(mywait): Add `options' argument.
* target.c (mywait): Add `options' argument. Print child exit
notifications here.
(start_non_stop): New.
* server.c (non_stop, own_buf, mem_buf): New globals.
(struct vstop_notif): New.
(notif_queue): New global.
(queue_stop_reply, push_event, discard_queued_stop_replies)
(send_next_stop_reply): New.
(start_inferior): Adjust to use resume_kind. Adjust to mywait
interface changes.
(attach_inferior): In non-stop mode, don't wait for the target
here.
(handle_general_set): Handle QNonStop.
(handle_query): When handling qC, return the current general
thread, instead of the first thread of the list.
(handle_query): If the backend supports non-stop mode, include
QNonStop+ in the qSupported query response.
(handle_v_cont): Adjust to use resume_kind. Handle resume_stop
and non-stop mode.
(handle_v_attach, handle_v_run): Handle non-stop mode.
(handle_v_stopped): New.
(handle_v_requests): Report support for vCont;t. Handle vStopped.
(myresume): Adjust to use resume_kind. Handle non-stop.
(queue_stop_reply_callback): New.
(handle_status): Handle non-stop mode.
(main): Clear non_stop flag on reconnection. Use the event-loop.
Refactor serial protocol handling from here ...
(process_serial_event): ... to this new function. When GDB
selects any thread, select one here. In non-stop mode, wait until
GDB acks all pending events before exiting.
(handle_serial_event, handle_target_event): New.
* remote-utils.c (remote_open): Install remote_desc in the event
loop.
(remote_close): Remove remote_desc from the event loop.
(putpkt_binary): Rename to...
(putpkt_binary_1): ... this. Add `is_notic' argument. Handle it.
(putpkt_binary): New as wrapper around putpkt_binary_1.
(putpkt_notif): New.
(prepare_resume_reply): In non-stop mode, don't change the
general_thread.
* event-loop.c: New.
* Makefile.in (OBJ): Add event-loop.o.
(event-loop.o): New rule.
* linux-low.h (pid_of): Moved here.
(lwpid_of): New.
(get_lwp_thread): Use lwpid_of.
(struct lwp_info): Delete `lwpid' field. Add `suspended' field.
* linux-low.c (pid_of): Delete.
(inferior_pid): Use lwpid_of.
(linux_event_pipe): New.
(target_is_async_p): New.
(delete_lwp): New.
(handle_extended_wait): Use lwpid_of.
(add_lwp): Don't set lwpid field.
(linux_attach_lwp): Adjust debug output. Use lwpid_of.
(linux_kill_one_lwp): If killing a running lwp, stop it first.
Use lwpid_of. Adjust to linux_wait_for_event interface changes.
(linux_detach_one_lwp): If detaching from a running lwp, stop it
first. Adjust to linux_wait_for_event interface changes. Use
lwpid_of.
(linux_detach): Don't delete the main lwp here.
(linux_join): Use my_waitpid. Avoid signal_pid. Use lwpid_of.
(status_pending_p): Don't consider explicitly suspended lwps.
(linux_wait_for_lwp): Take an integer pid instead of a lwp_info
pointer. Add OPTIONS argument. Change return type to int. Use
my_waitpid instead of sleeping. Handle WNOHANG. Use lwpid_of.
(linux_wait_for_event): Take an integer pid instead of a lwp_info
pointer. Add status pointer argument. Return a pid instead of a
status. Use lwpid_of. Adjust to linux_wait_for_lwp interface
changes. In non-stop mode, don't switch to a random thread.
(linux_wait): Rename to...
(linux_wait_1): ... this. Add target_options argument, and handle
it. Adjust to use resume_kind. Use lwpid_of. In non-stop mode,
don't handle the continue thread. Handle TARGET_WNOHANG. Merge
clean exit and signal exit code. Don't stop all threads in
non-stop mode. In all-stop mode, only stop all threads when
reporting a stop to GDB. Handle explicit thread stop requests.
(async_file_flush, async_file_mark): New.
(linux_wait): New.
(send_sigstop): Use lwpid_of.
(wait_for_sigstop): Use lwpid_of. Adjust to linux_wait_for_event
interface changes. In non-stop mode, don't switch to a random
thread.
(linux_resume_one_lwp): Use lwpid_of.
(linux_continue_one_thread, linux_queue_one_thread): Merge into ...
(linux_resume_one_thread): ... this. Handle resume_stop. In
non-stop mode, don't look for pending flag in all threads.
(resume_status_pending_p): Don't consider explicitly suspended
threads.
(my_waitpid): Reimplement. Emulate __WALL.
(linux_request_interrupt, linux_read_offsets, linux_xfer_siginfo):
Use lwpid_of.
(sigchld_handler, linux_supports_non_stop, linux_async)
(linux_start_non_stop): New.
(linux_target_ops): Register linux_supports_non_stop, linux_async
and linux_start_non_stop.
(initialize_low): Install SIGCHLD handler.
* thread-db.c (thread_db_create_event, find_one_thread)
(thread_db_get_tls_address): Use lwpid_of.
* win32-low.c (win32_detach): Adjust to use resume_kind.
(win32_wait): Add `options' argument.
* spu-low.c (spu_resume): Adjust to use resume_kind.
(spu_wait): Add `options' argument.
* target.h (enum target_waitkind): New.
(struct target_waitstatus): New.
(struct target_ops) <wait>: Return an unsigned long. Take a
target_waitstatus pointer instead of a char pointer.
(mywait): Likewise.
* target.c (mywait): Change prototype to return an unsigned long.
Take a target_waitstatus pointer instead of a char pointer. Adjust.
* server.h (thread_from_wait, old_thread_from_wait): Delete
declarations.
(prepare_resume_reply): Change prototype to take a
target_waitstatus.
* server.c (thread_from_wait, old_thread_from_wait): Delete.
(last_status, last_ptid): New.
(start_inferior): Remove "statusptr" argument. Adjust. Return a
pid instead of a signal.
(attach_inferior): Remove "status" and "signal" parameters.
Adjust.
(handle_query): For qGetTLSAddr, parse the thread id with strtol,
not as an address.
(handle_v_cont, handle_v_attach, handle_v_run, handle_v_kill)
(handle_v_requests, myresume): Remove "status" and "signal"
parameters. Adjust.
(handle_status): New.
(main): Delete local `status'. Adjust.
* remote-utils.c: Include target.h.
(prepare_resume_reply): Change prototype to take a
target_waitstatus. Adjust.
* linux-low.c (linux_wait): Adjust to new target_ops->wait
interface.
* spu-low.c (spu_wait): Adjust.
* win32-low.c (enum target_waitkind, struct target_waitstatus):
Delete.
(win32_wait): Adjust.
(struct target_ops): Add a `n' argument to the `resume' callback.
* server.c (start_inferior): Adjust.
(handle_v_cont, myresume): Adjust.
* linux-low.c (check_removed_breakpoint): Adjust to resume
interface change, and to removed leave_stopped field.
(resume_ptr): Delete.
(struct thread_resume_array): New.
(linux_set_resume_request): Add new `arg' parameter. Adjust to
resume interface change.
(linux_continue_one_thread, linux_queue_one_thread)
(resume_status_pending_p): Check if the resume field is NULL
instead of checking the leave_stopped member.
(linux_resume): Adjust to the target resume interface change.
* spu-low.c (spu_resume): Adjust to the target resume interface
change.
* win32-low.c (win32_detach, win32_resume): Ditto.
* linux-low.c (linux_wait_for_event): Don't clear the `stepping'
flag.
(wait_for_sigstop): Don't leave a finished single-step SIGTRAP
pending.
(linux_continue_one_thread): Only preserve the stepping flag if
there's a pending breakpoint.
gdb/testsuite/
* gdb.threads/pending-step.c, gdb.threads/pending-step.exp: New.
Fix size of FPSCR in Power 7 processors.
* ppc-linux-nat.c (PPC_FEATURE_ARCH_2_05): Remove #define.
(PPC_FEATURE_HAS_DFP): New #define.
(ppc_linux_read_description): Check for DFP feature instead of
ISA 2.05 to decide on size of the FPSCR.
gdbserver/
Fix size of FPSCR in Power 7 processors.
* linux-ppc-low.c (PPC_FEATURE_ARCH_2_05): Remove #define.
(PPC_FEATURE_HAS_DFP): New #define.
(ppc_arch_setup): Check for DFP feature instead of ISA 2.05 to decide on
size of the FPSCR.
gdb/
* remote.c (PACKET_qAttached): New.
(remote_query_attached): New.
(remote_add_inferior): Add new `attached' argument. Handle it.
(remote_notice_new_inferior, remote_start_remote): Adjust to pass
-1 to remote_add_inferior in new parameter.
(extended_remote_attach_1): Adjust to pass 1 to
remote_add_inferior in the new parameter.
(extended_remote_create_inferior_1): Adjust to pass 0 to
remote_add_inferior in the new parameter.
(_initialize_remote): Add "set/show remote query-attached-packet"
commands.
2009-03-14 Pedro Alves <pedro@codesourcery.com>
gdb/gdbserver/
* server.c (handle_query): Handle "qAttached".
2009-03-14 Pedro Alves <pedro@codesourcery.com>
gdb/doc/
* gdb.texinfo (Remote Configuration): Document query-attached.
(General Query Packets): Document qAttached.
* server.c (handle_search_memory): Back out calls to xmalloc,
result is checked and error is returned to user upon failure.
(handle_query): Ditto. Add more checks for result of malloc.
(handle_v_cont): Check result of malloc, report error back to
user upon failure.
(handle_v_run): Ditto. Call freeargv.
* server.h (freeargv): Declare.
* utils.c (freeargv): New fn.
* features/Makefile (rs6000/powerpc-isa205-32l-expedite,
rs6000/powerpc-isa205-altivec32l-expedite,
powerpc-isa205-vsx32l-expedite, rs6000/powerpc-isa205-64l-expedite,
rs6000/powerpc-isa205-altivec64l-expedite,
powerpc-isa205-vsx64l-expedite): New variables.
* regformats/rs6000/powerpc-isa205-32l.dat: Generate.
* regformats/rs6000/powerpc-isa205-altivec32l.dat: Generate.
* regformats/rs6000/powerpc-isa205-vsx32l.dat: Generate.
* regformats/rs6000/powerpc-isa205-64l.dat: Generate.
* regformats/rs6000/powerpc-isa205-altivec64l.dat: Generate.
* regformats/rs6000/powerpc-isa205-vsx64l.dat: Generate.
gdbserver/
* Makefile.in (powerpc-isa205-32l.o, powerpc-isa205-32l.c,
powerpc-isa205-altivec32l.o, powerpc-isa205-altivec32l.c,
powerpc-isa205-vsx32l.o, powerpc-isa205-vsx32l.c,
powerpc-isa205-64l.o, powerpc-isa205-64l.c,
powerpc-isa205-altivec64l.o, powerpc-isa205-altivec64l.c,
powerpc-isa205-vsx64l.o, powerpc-isa205-vsx64l.c): New targets.
* configure.srv (powerpc*-*-linux*): Add ISA 2.05 object files and
XML target descriptions.
* linux-ppc-low.c (ppc_arch_setup): Init registers with 64-bit FPSCR
when inferior is running on an ISA 2.05 or later processor. Add
special case to return offset for full 64-bit slot of FPSCR when
in 32-bits.
2008-08-12 Sandra Loosemore <sandra@codesourcery.com>
* gdb.texinfo (Remote Configuration): Document set remote noack-packet.
(Remote Protocol): Add Packet Acknowledgment to menu.
(Overview): Mention +/- can be disabled, and point to new section
where this is discussed in detail.
(General Query Packets): Document QStartNoAckMode packet, and
corresponding qSupported reply.
(Packet Acknowledgment): New section.
gdb/
2008-08-12 Pedro Alves <pedro@codesourcery.com>
Add no-ack mode to the remote protocol --- optionally stop ACKing
packets and responses when we have a reliable communication
medium.
Based on Apple's GDB, by Jason Molenda <jmolenda@apple.com>
* remote.c (struct remote_state): Add noack_mode field.
(PACKET_QStartNoAckMode): New.
(remote_start_remote): Don't any outstanding packet here.
(remote_open_1): Clear noack_mode. Ack any outstanding packet
here. Activate noack mode if requested.
(remote_protocol_features): Add QStartNoAckMode.
(remote_open_1):
(putpkt_binary): Don't send ack in noack mode.
(read_frame): Don't recompute the checksum in noack mode.
(getpkt_sane): Skip sending ack if in noack mode.
(_initialize_remote): Add set/show remote noack mode.
* NEWS: Note the new features.
gdb/gdbserver/
2008-08-12 Pedro Alves <pedro@codesourcery.com>
* remote-utils.c (noack_mode, transport_is_reliable): New globals.
(remote_open): Set or clear transport_is_reliable.
(putpkt_binary): Don't expect acks in noack mode.
(getpkt): Don't send ack/nac in noack mode.
* server.c (handle_general_set): Handle QStartNoAckMode.
(handle_query): If connected by tcp pass QStartNoAckMode+ in
qSupported.
(main): Reset noack_mode on every connection.
* server.h (noack_mode): Declare.
output "thread:TID" in the T stop reply.
* server.c (disable_packet_vCont, disable_packet_Tthread)
(disable_packet_qC, disable_packet_qfThreadInfo): New globals.
(handle_query): If requested, disable support for qC, qfThreadInfo
and qsThreadInfo.
(handle_v_requests): If requested, disable support for vCont.
(gdbserver_show_disableable): New.
(main): Handle --disable-packet and --disable-packet=LIST.
* server.h (disable_packet_vCont, disable_packet_Tthread)
(disable_packet_qC, disable_packet_qfThreadInfo): Declare.
(set_register_cache): Verify that PBUFSIZ is large enough to hold a
full register packet.
* regcache.h (registers_length): Remove prototype.
* server.h (PBUFSIZ): Define to 16384.
* Makefile.in (ppc_linux_tdep_h): New macro.
(powerpc_32l_c, powerpc_altivec32_c, powerpc_altivec32l_c): Likewise.
(powerpc_64l_c, powerpc_altivec64_c, powerpc_altivec64l_c): Likewise.
(powerpc_e500l_c): Likewise.
(ppc-linux-nat.o): Update dependencies.
(ppc-linux-tdep.o): Update dependencies.
(rs6000-tdep.o): Update dependencies.
* ppc-tdep.h (ppc_linux_memory_remove_breakpoint): Remove.
(ppc_linux_svr4_fetch_link_map_offsets): Remove.
(ppc_linux_gregset, ppc_linux_fpregset): Move to ppc-linux-tdep.h
(ppc_supply_reg, ppc_collect_reg): Add prototypes.
(tdesc_powerpc_e500): Remove.
* rs6000.c: Include "features/rs6000/powerpc-altivec32.c"
and "features/rs6000/powerpc-altivec64.c".
(ppc_supply_reg, ppc_collect_reg): Make global.
(variants): Use tdesc_powerpc_32 for "powerpc" and
tdesc_powerpc_altivec64 for "powerpc64".
(_initialize_rs6000_tdep): Initialize AltiVec descriptions.
* ppc-linux-tdep.h: New file.
* ppc-linux-tdep.c: Include "ppc-linux-tdep.c".
Include "features/rs6000/powerpc-32l.c".
Include "features/rs6000/powerpc-altivec32l.c".
Include "features/rs6000/powerpc-64l.c".
Include "features/rs6000/powerpc-altivec64l.c".
Include "features/rs6000/powerpc-e500l.c".
(ppc_linux_supply_gregset): New function.
(ppc_linux_collect_gregset): Handle orig_r3 and trap registers.
(ppc32_linux_gregset): Use ppc_linux_supply_gregset.
(ppc64_linux_gregset): Likewise.
(ppc_linux_sigtramp_cache): Handle orig_r3 and trap registers.
(ppc_linux_trap_reg_p): New function.
(ppc_linux_write_pc): New function.
(ppc_linux_core_read_description): New function.
(ppc_linux_init_abi): Install ppc_linux_write_pc and
ppc_linux_core_read_description. Install orig_r3 and trap
registers if present in the target description.
(_initialize_ppc_linux_tdep): Initialize Linux target descriptions.
* ppc-linux-nat.c: Include "ppc-linux-tdep.h".
(PT_ORIG_R3, PT_TRAP): Define if necessary.
(ppc_register_u_addr): Handle orig_r3 and trap registers.
(fetch_ppc_registers): Likewise.
(store_ppc_registers): Likewise.
(store_register): Likewise.
(ppc_linux_read_description): Check whether AltiVec is supported.
Check whether inferior is 32-bit or 64-bit. Return the appropriate
Linux target description.
* features/Makefile (WHICH): Use rs6000/powerpc-32l and
rs6000/powerpc-altivec32l instead of rs6000/powerpc-32.
Use rs6000/powerpc-64l and rs6000/powerpc-altivec64l instead
of rs6000/powerpc-64. Use rs6000/powerpc-e500l instead of
rs6000/powerpc-e500. Update -expedite variables accordingly.
* features/rs6000/power-spe.xml: Use regnum 73 for "acc".
* features/rs6000/powerpc-32.xml: Do not include power-altivec.xml.
* features/rs6000/powerpc-64.xml: Do not include power-altivec.xml.
* features/rs6000/powerpc-e500.c: Regenerate.
* features/rs6000/powerpc-32.c: Regenerate.
* features/rs6000/powerpc-64.c: Regenerate.
* features/rs6000/power-linux.xml: New file.
* features/rs6000/power64-linux.xml: New file.
* features/rs6000/powerpc-32l.xml: New file.
* features/rs6000/powerpc-altivec32l.xml: New file.
* features/rs6000/powerpc-64l.xml: New file.
* features/rs6000/powerpc-altivec64l.xml: New file.
* features/rs6000/powerpc-e500l.xml: New file.
* features/rs6000/powerpc-32l.c: New (generated) file.
* features/rs6000/powerpc-altivec32l.c: New (generated) file.
* features/rs6000/powerpc-64l.c: New (generated) file.
* features/rs6000/powerpc-altivec64l.c: New (generated) file.
* features/rs6000/powerpc-e500l.xml: New (generated) file.
* regformats/reg-ppc.dat: Remove.
* regformats/reg-ppc64.dat: Remove.
* regformats/rs6000/powerpc-32.dat: Remove.
* regformats/rs6000/powerpc-64.dat: Remove.
* regformats/rs6000/powerpc-e500.dat: Remove.
* regformats/rs6000/powerpc-32l.dat: New (generated) file.
* regformats/rs6000/powerpc-altivec32l.dat: New (generated) file.
* regformats/rs6000/powerpc-64l.dat: New (generated) file.
* regformats/rs6000/powerpc-altivec64l.dat: New (generated) file.
* regformats/rs6000/powerpc-e500l.dat: New (generated) file.
gdbserver/ChangeLog:
* configure.srv (powerpc*-*-linux*): Set srv_regobj to
powerpc-32l.o, powerpc-altivec32l.o, powerpc-e500l.o,
powerpc-64l.o, and powerpc-altivec64l.o.
Remove rs6000/powerpc-32.xml, rs6000/powerpc-64.xml, and
rs6000/powerpc-e500.xml; add rs6000/powerpc-32l.xml,
rs6000/powerpc-altivec32l.xml, rs6000/powerpc-e500l.xml,
rs6000/powerpc-64l.xml, rs6000/powerpc-altivec64l.xml,
rs6000/power-linux.xml, and rs6000/power64-linux.xml
to srv_xmlfiles.
* Makefile.in (reg-ppc.o, reg-ppc.c): Remove, replace by ...
(powerpc-32l.o, powerpc-32l.c): ... these new rules.
(powerpc-32.o, powerpc-32.c): Remove, replace by ...
(powerpc-altivec32l.o, powerpc-altivec32l.c): ... these new rules.
(powerpc-e500.o, powerpc-e500.c): Remove, replace by ...
(powerpc-e500l.o, powerpc-e500l.c): ... these new rules.
(reg-ppc64.o, reg-ppc64.c): Remove, replace by ...
(powerpc-64l.o, powerpc-64l.c): ... these new rules.
(powerpc-64.o, powerpc-64.c): Remove, replace by ...
(powerpc-altivec64l.o, powerpc-altivec64l.c): ... these new rules.
(clean): Update.
* linux-ppc-low.c (init_registers_ppc): Remove, replace by ...
(init_registers_powerpc_32l): ... this new prototype.
(init_registers_powerpc_32): Remove, replace by ...
(init_registers_powerpc_altivec32l): ... this new prototype.
(init_registers_powerpc_e500): Remove, replace by ...
(init_registers_powerpc_e500l): ... this new prototype.
(init_registers_ppc64): Remove, replace by ...
(init_registers_powerpc_64l): ... this new prototype.
(init_registers_powerpc_64): Remove, replace by ...
(init_registers_powerpc_altivec64l): ... this new prototype.
(ppc_num_regs): Set to 73.
(PT_ORIG_R3, PT_TRAP): Define if necessary.
(ppc_regmap, ppc_regmap_e500): Add values for orig_r3 and trap.
(ppc_cannot_store_register): Handle orig_r3 and trap.
(ppc_arch_setup): Update init_registers_... calls.
(ppc_fill_gregset): Handle orig_r3 and trap.
* inferiors.c (clear_inferiors): Reset current_inferior.
srv_regobj. Remove rs6000/powerpc-e500.xml and rs6000/power-spe.xml
from reg_xmlfiles.
* linux-ppc-low.c: Include <elf.h>.
(PPC_FEATURE_HAS_ALTIVEC, PPC_FEATURE_HAS_SPE): Define.
(ppc_hwcap): New global variable.
(ppc_regmap): Remove __SPE__ #ifdef sections.
(ppc_regmap_e500): New global variable.
(ppc_cannot_store_register): Update __SPE__ special case.
(ppc_get_hwcap): New function.
(ppc_arch_setup): Use it to determine whether inferior supports
AltiVec or SPE registers. Set the_low_target.regmap if appropriate.
(ppc_fill_vrregset, ppc_store_vrregset): Define unconditionally.
Do not access registers if target does not support AltiVec.
(ppc_fill_evrregset, ppc_store_evrregset): Define unconditionally.
Do not access registers if target does not support SPE.
(target_regsets): Unconditionally include AltiVec and SPE regsets.
* linux-low.c (disabled_regsets, num_regsets): New.
(use_regsets_p): Delete.
(linux_wait_for_process): Clear disabled_regsets.
(regsets_fetch_inferior_registers): Check and set it.
(regsets_store_inferior_registers): Likewise.
(linux_fetch_registers, linux_store_registers): Do not use
use_regsets_p.
(initialize_low): Allocate disabled_regsets.
* features/Makefile (%.dat): Set xmltarget to the base filename
of the XML source, without subdirectory.
* regformats/rs6000/powerpc-32.dat: Regenerate.
* regformats/rs6000/powerpc-64.dat: Regenerate.
* regformats/rs6000/powerpc-e500.dat: Regenerate.
gdbserver/ChangeLog:
* server.c (get_features_xml): Fix inverted condition.
(handle_query): Always support qXfer:feature:read.
* NEWS: Document "set exec-wrapper" and the gdbserver --wrapper
argument. Gather all gdbserver features together.
* fork-child.c (exec_wrapper): New variable.
(fork_inferior): Use it.
(startup_inferior): Skip an extra trap if using "set exec-wrapper".
(unset_exec_wrapper_command, _initialize_fork_child): New.
* gdb.texinfo (Starting): Document "set exec-wrapper".
(Server): Document gdbserver --wrapper.
* server.c (wrapper_argv): New.
(start_inferior): Handle wrapper_argv. If set, expect an extra
trap.
(gdbserver_usage): Document --wrapper.
(main): Parse --wrapper.
* regformats/reg-ppc.dat: Rename "ps" to "msr".
* regformats/reg-ppc64.dat: Likewise.
gdbserver/ChangeLog:
* configure.srv [powerpc64-*-linux*]: Add all files mentioned for
powerpc-*-linux* to srv_regobj and reg_xmlfiles.
* linux-ppc-low.c (ppc_get_pc): Support bi-arch operation.
(ppc_set_pc): Likewise.
(ppc_arch_setup): New function.
(ppc_fill_gregset): Call ppc_collect_ptrace_register instead
of collect_register.
(the_low_target): Use ppc_arch_setup as arch_setup initializer.
instead of linux-ppc64-low.o.
* linux-ppc64-low.c: Remove file.
* Makefile.in (SFILES): Remove linux-ppc64-low.c.
(linux-ppc64-low.o): Remove rule.
* linux-ppc-low.c (init_registers_ppc64): Add prototype.
(init_registers_powerpc_64): Likewise.
(ppc_regmap): Conditionally define depending on __powerpc64__.
(ppc_cannot_store_register): Do not special-case "fpscr" when
compiled on __powerpc64__.
(ppc_collect_ptrace_register): New function.
(ppc_supply_ptrace_register): New function.
(ppc_breakpoint): Change type to "unsigned int".
(ppc_breakpoint_at): Change type of "insn" to "unsigned int".
(the_low_target): Conditionally provide initializers for the
arch_setup member depending on __powerpc64__. Install
collect_ptrace_register and supply_ptrace_register members.
reg-s390.o and reg-s390x.o.
* linux-low.c (new_inferior): New global variable.
(linux_create_inferior, linux_attach): Set it.
(linux_wait_for_process): Call the_low_target.arch_setup after the
target has stopped for the first time.
(initialize_low): Do not call the_low_target.arch_setup.
* linux-s390-low.c (s390_get_pc): Support bi-arch operation.
(s390_set_pc): Likewise.
(s390_arch_setup): New function.
(the_low_target): Use s390_arch_setup as arch_setup routine.
* regcache.c (realloc_register_cache): New function.
(set_register_cache): Call it for each existing regcache.
* gdb.texinfo (vAttach, vRun): Remove requirement of the stub
killing the inferior when it is already debugging a process.
gdbserver/
* server.c (handle_v_requests): When handling the vRun and vAttach
packets, if already debugging a process, don't kill it. Return an
error instead.
parameter. Set current_process_handle and current_process_id from the
parameters. Clear globals.
(win32_create_inferior): Don't set current_process_handle and
current_process_id here. Instead pass them on the call to
do_initial_child_stuff.
(win32_attach): Likewise.
(win32_clear_inferiors): New.
(win32_kill): Don't close the current process handle or the
current thread handle here. Instead call win32_clear_inferiors.
(win32_detach): Don't open a new handle to the process. Call
win32_clear_inferiors.
(win32_join): Don't rely on current_process_handle; open a new
handle using the process id.
(win32_wait): Call win32_clear_inferiors when the inferior process
has exited.
(linux_kill, linux_detach): Clean up the process list.
* remote-utils.c (remote_open): Improve port number parsing.
(putpkt_binary, input_interrupt): Only send interrupts if the target
is running.
* server.c (extended_protocol): Make static.
(attached): Define earlier.
(exit_requested, response_needed, program_argv): New variables.
(target_running): New.
(start_inferior): Clear attached here.
(attach_inferior): Set attached here.
(require_running): Define.
(handle_query): Use require_running and target_running. Implement
"monitor exit".
(handle_v_attach, handle_v_run): New.
(handle_v_requests): Use require_running. Handle vAttach and vRun.
(gdbserver_usage): Update.
(main): Redo argument parsing. Handle --debug and --multi. Handle
--attach along with other options or after the port. Save
program_argv. Support no initial program. Resynchronize
communication with GDB after an error. Handle "monitor exit".
Use require_running and target_running. Always allow the extended
protocol. Do not error out for Hc0 or Hc-1. Do not automatically
restart in extended mode.
* README: Refer to the GDB manual. Update --attach usage.
* remote.c (struct remote_state): Add cached_wait_status.
(remote_exec_file): New variable.
(PACKET_vAttach, PACKET_vRun): New constants.
(extended_remote_restart): Do not query for status.
(struct start_remote_args): New.
(remote_start_remote): Take it as a second argument. Check
whether the target is running. Issue an error for non-running
non-extended targets. Cache the wait status. Set inferior_ptid
here.
(remote_open_1): Prompt to disconnect non-running targets. Make
sure the target is marked running. Do not set inferior_ptid here.
Update call to remote_start_remote. Do not call remote_check_symbols
if the target is not running.
(remote_detach_1): Rename from remote_detach. Take an EXTENDED
argument. Handle a non-running target.
(remote_detach): Use it.
(extended_remote_detach): New.
(remote_disconnect): Fix typo. Use remoute_mourn_1.
(extended_remote_attach_1, extended_remote_attach)
(extended_async_remote_attach): New.
(remote_vcont_resume): Remove unused variable.
(remote_wait, remote_async_wait): Use any cached wait status.
(putpkt_binary, getpkt): Clear any cached wait status.
(extended_remoute_mourn_1): New.
(extended_remote_mourn): Use it.
(extended_async_remote_mourn, extended_remote_run): New.
(extended_remote_create_inferior_1): New.
(extended_remote_create_inferior): Use it.
(extended_remote_async_create_inferior): Likewise.
(remote_xfer_partial): Skip for non-executing targets.
(init_extended_remote_ops): Set to_detach and to_attach.
(init_extended_async_remote_ops): Likewise. Use
extended_async_remote_mourn.
(_initialize_remote): Register vAttach, vRun, and
set remote exec-file.
* NEWS: Mention vAttach, vRun, and gdbserver extended-remote support.
* gdb.server/ext-attach.c, gdb.server/ext-attach.exp,
gdb.server/ext-run.exp: New files.
* lib/gdbserver-support.exp (gdbserver_download): New.
(gdbserver_start): New. Update gdbserver expected
output.
(gdbserver_spawn): Use them.
(gdbserver_start_extended): New.
* gdb.texinfo (Using the `gdbserver' Program): Add security
warning. Rearrange into subsections and subsubsections. Document
--multi and --debug. Correct --with-sysroot typo. Update --attach
usage. Make load reference clearer. Document monitor exit.
(Remote Configuration): Document set remote exec-file, attach-packet,
and run-packet.
(Packets): Document vAttach and vRun.
reinsert auto-delete breakpoints.
* mem-break.c (struct breakpoint): Change return type of handler to
int.
(set_breakpoint_at): Update handler type.
(reinsert_breakpoint_handler): Return 1 instead of calling
delete_breakpoint.
(reinsert_breakpoint_by_bp): Check for the original breakpoint before
setting a new one.
(check_breakpoints): Delete auto-delete breakpoints and return 2.
* mem-break.h (set_breakpoint_at): Update handler type.
* thread-db.c (thread_db_create_event, thread_db_create_event): Update.
* win32-low.c (auto_delete_breakpoint): New.
(get_child_debug_event): Use it.
(win32_create_inferior): Clear the `attaching' global.
(win32_attach): Set the `attaching' global.
(get_child_debug_event) [_WIN32_WCE]: Stop the inferior when
attaching. Only set a breakpoint at the entry point if not
attaching.
global variables.
(child_add_thread): Minor cleanup.
(child_continue): Resume artificially suspended threads before
calling ContinueDebugEvent.
(suspend_one_thread): New.
(fake_breakpoint_event): New.
(get_child_debug_event): Change return type to int. Check here if
gdb sent an interrupt request. If a soft interrupt was requested,
fake a breakpoint event. Return 0 if there is no event to handle,
and 1 otherwise.
(win32_wait): Don't check here if gdb sent an interrupt request.
Ensure there is a valid event to handle.
(win32_request_interrupt): Add soft interruption method as last
resort.
structure members. Replace `suspend_count' counter by a
`suspended' flag.
* win32-low.c (thread_rec): Update condition of when to get the
context from the inferior. Rely on ContextFlags being set if it
has already been retrieved. Only suspend the inferior thread if
we haven't already. Warn if that fails.
(continue_one_thread): s/suspend_count/suspended/. Only call
ResumeThread once. Warn if that fails.