Doug Evans [Thu, 16 Jan 2014 17:29:10 +0000 (09:29 -0800)]
dwarf2read.c (open_and_init_dwp_file): Fix typo in comment.
Markus Metzger [Mon, 6 May 2013 14:04:46 +0000 (16:04 +0200)]
record-btrace: add (reverse-)stepping support
Provide to_resume and to_wait target methods for the btrace record target
to allow reverse stepping and replay support.
Replay is limited in the sense that only stepping and source correlation
are supported. We do not record data and thus can not show variables.
Non-stop mode is not working. Do not allow record-btrace in non-stop mode.
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* btrace.h (btrace_thread_flag): New.
(struct btrace_thread_info) <flags>: New.
* record-btrace.c (record_btrace_resume_thread)
(record_btrace_find_thread_to_move, btrace_step_no_history)
(btrace_step_stopped, record_btrace_start_replaying)
(record_btrace_step_thread, record_btrace_decr_pc_after_break)
(record_btrace_find_resume_thread): New.
(record_btrace_resume, record_btrace_wait): Extend.
(record_btrace_can_execute_reverse): New.
(record_btrace_open): Fail in non-stop mode.
(record_btrace_set_replay): Split into this, ...
(record_btrace_stop_replaying): ... this, ...
(record_btrace_clear_histories): ... and this.
(init_record_btrace_ops): Init to_can_execute_reverse.
* NEWS: Announce it.
testsuite/
* gdb.btrace/delta.exp: Check reverse stepi.
* gdb.btrace/tailcall.exp: Update. Add stepping tests.
* gdb.btrace/finish.exp: New.
* gdb.btrace/next.exp: New.
* gdb.btrace/nexti.exp: New.
* gdb.btrace/record_goto.c: Add comments.
* gdb.btrace/step.exp: New.
* gdb.btrace/stepi.exp: New.
* gdb.btrace/multi-thread-step.c: New.
* gdb.btrace/multi-thread-step.exp: New.
* gdb.btrace/rn-dl-bind.c: New.
* gdb.btrace/rn-dl-bind.exp: New.
* gdb.btrace/data.c: New.
* gdb.btrace/data.exp: New.
* gdb.btrace/Makefile.in (EXECUTABLES): Add new.
doc/
* gdb.texinfo: Document limited reverse/replay support
for target record-btrace.
Markus Metzger [Wed, 18 Dec 2013 10:09:34 +0000 (11:09 +0100)]
target: allow decr_pc_after_break to be defined by the target
Allow the target to define which value to use in decr_pc_after_break.
It defaults to gdbarch_decr_pc_after_break (GDBARCH).
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* target.h (struct target_ops) <to_decr_pc_after_break>: New.
(forward_target_decr_pc_after_break)
(target_decr_pc_after_break): New.
* target.c (forward_target_decr_pc_after_break)
(target_decr_pc_after_break): New.
* aix-thread.c (aix_thread_wait): Call target_decr_pc_after_break
instead of gdbarch_decr_pc_after_break.
* darwin-nat.c (cancel_breakpoint): Call target_decr_pc_after_break
instead of gdbarch_decr_pc_after_break.
* infrun.c (adjust_pc_after_break): Call target_decr_pc_after_break
instead of gdbarch_decr_pc_after_break.
* linux-nat.c (cancel_breakpoint): Call target_decr_pc_after_break
instead of gdbarch_decr_pc_after_break.
* linux-thread-db.c (check_event): Call target_decr_pc_after_break
instead of gdbarch_decr_pc_after_break.
* record-full.c (record_full_wait_1): Call target_decr_pc_after_break
instead of gdbarch_decr_pc_after_break.
Markus Metzger [Tue, 10 Sep 2013 10:27:14 +0000 (12:27 +0200)]
record-btrace: show trace from enable location
The btrace record target shows the branch trace from the location of the first
branch destination. This is the first BTS records.
After adding incremental updates, we can now add a dummy record for the current
PC when we enable tracing so we show the trace from the location where branch
tracing has been enabled.
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* btrace.c: Include regcache.h.
(btrace_add_pc): New.
(btrace_enable): Call btrace_add_pc.
(btrace_is_empty): New.
* btrace.h (btrace_is_empty): New.
* record-btrace.c (require_btrace, record_btrace_info): Call
btrace_is_empty.
testsuite/
* gdb.btrace/Makefile.in (EXECUTABLES): Add delta.
* gdb.btrace/exception.exp: Update.
* gdb.btrace/instruction_history.exp: Update.
* gdb.btrace/record_goto.exp: Update.
* gdb.btrace/tailcall.exp: Update.
* gdb.btrace/unknown_functions.exp: Update.
* gdb.btrace/delta.exp: New.
Markus Metzger [Mon, 3 Jun 2013 13:39:35 +0000 (15:39 +0200)]
btrace, gdbserver: read branch trace incrementally
Read branch trace data incrementally and extend the current trace rather than
discarding it and reading the entire trace buffer each time.
If the branch trace buffer overflowed, we can't extend the current trace so we
discard it and start anew by reading the entire branch trace buffer.
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* common/linux-btrace.c (perf_event_read_bts, linux_read_btrace):
Support delta reads.
(linux_disable_btrace): Change return type.
* common/linux-btrace.h (linux_read_btrace): Change parameters
and return type to allow error reporting. Update users.
(linux_disable_btrace): Change return type. Update users.
* common/btrace-common.h (btrace_read_type) <BTRACE_READ_DELTA>:
New.
(btrace_error): New.
(btrace_block) <begin>: Comment on BEGIN == 0.
* btrace.c (btrace_compute_ftrace): Start from the end of
the current trace.
(btrace_stitch_trace, btrace_clear_history): New.
(btrace_fetch): Read delta trace, return if replaying.
(btrace_clear): Move clear history code to btrace_clear_history.
(parse_xml_btrace): Throw an error if parsing failed.
* target.h (struct target_ops) <to_read_btrace>: Change parameters
and return type to allow error reporting.
(target_read_btrace): Change parameters and return type to allow
error reporting.
* target.c (target_read_btrace): Update.
* remote.c (remote_read_btrace): Support delta reads. Pass
errors on.
* NEWS: Announce it.
gdbserver/
* target.h (target_ops) <read_btrace>: Change parameters and
return type to allow error reporting.
* server.c (handle_qxfer_btrace): Support delta reads. Pass
trace reading errors on.
* linux-low.c (linux_low_read_btrace): Pass trace reading
errors on.
(linux_low_disable_btrace): New.
Markus Metzger [Wed, 27 Mar 2013 08:49:47 +0000 (09:49 +0100)]
record-btrace: extend unwinder
Extend the always failing unwinder to provide the PC based on the call
structure detected in the branch trace.
The unwinder supports normal frames and tailcall frames.
Inline frames are not supported.
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* record.h (record_btrace_frame_unwind)
(record_btrace_tailcall_frame_unwind): New declarations.
* dwarf2-frame: Include record.h
(dwarf2_frame_cfa): Throw an error for btrace frames.
* record-btrace.c: Include hashtab.h.
(btrace_get_bfun_name): New.
(btrace_call_history): Call btrace_get_bfun_name.
(struct btrace_frame_cache): New.
(bfcache): New.
(bfcache_hash, bfcache_eq, bfcache_new): New.
(btrace_get_frame_function): New.
(record_btrace_frame_unwind_stop_reason): Allow unwinding.
(record_btrace_frame_this_id): Compute own id.
(record_btrace_frame_prev_register): Provide PC, throw_error
for all other registers.
(record_btrace_frame_sniffer): Detect btrace frames.
(record_btrace_tailcall_frame_sniffer): New.
(record_btrace_frame_dealloc_cache): New.
(record_btrace_frame_unwind): Add new functions.
(record_btrace_tailcall_frame_unwind): New.
(_initialize_record_btrace): Allocate cache.
* btrace.c (btrace_clear): Call reinit_frame_cache.
* NEWS: Announce it.
testsuite/
* gdb.btrace/record_goto.exp: Add backtrace test.
* gdb.btrace/tailcall.exp: Add backtrace test.
Markus Metzger [Mon, 25 Mar 2013 15:01:33 +0000 (16:01 +0100)]
record-btrace: add record goto target methods
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* record-btrace.c (record_btrace_set_replay)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto): New.
(init_record_btrace_ops): Initialize them.
* NEWS: Announce it.
testsuite/
* gdb.btrace/Makefile.in (EXECUTABLES): Add record_goto.
* gdb.btrace/record_goto.c: New.
* gdb.btrace/record_goto.exp: New.
* gdb.btrace/x86-record_goto.S: New.
Markus Metzger [Fri, 3 May 2013 08:51:13 +0000 (10:51 +0200)]
record-btrace: provide target_find_new_threads method
The "info threads" command tries to read memory, which is not possible during
replay. This results in an error message and aborts the command without showing
the existing threads.
Provide a to_find_new_threads target method to skip the search while replaying.
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* record-btrace.c (record_btrace_find_new_threads)
(record_btrace_thread_alive): New.
(init_record_btrace_ops): Initialize to_find_new_threads and
to_thread_alive.
Markus Metzger [Mon, 25 Mar 2013 14:44:43 +0000 (15:44 +0100)]
record-btrace: add to_wait and to_resume target methods.
Add simple to_wait and to_resume target methods that prevent stepping when the
current replay position is not at the end of the execution log.
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* record-btrace.c (record_btrace_resume): New.
(record_btrace_wait): New.
(init_record_btrace_ops): Initialize to_wait and to_resume.
Markus Metzger [Wed, 24 Apr 2013 11:24:11 +0000 (13:24 +0200)]
record-btrace: provide xfer_partial target method
Provide the xfer_partial target method for the btrace record target.
Only allow memory read accesses to readonly memory while we're replaying,
except for inserting and removing breakpoints.
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* record-btrace.c (record_btrace_xfer_partial)
(record_btrace_insert_breakpoint, record_btrace_remove_breakpoint)
(record_btrace_allow_memory_access): New.
(init_record_btrace_ops): Initialize new methods.
* target.c (raw_memory_xfer_partial): Bail out if target reports
that this memory is not available.
Markus Metzger [Tue, 17 Dec 2013 09:49:03 +0000 (10:49 +0100)]
target, breakpoint: allow insert/remove breakpoint to be forwarded
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* target.h (target_ops) <to_insert_breakpoint>
<to_remove_breakpoint>: Add target_ops parameter.
(forward_target_insert_breakpoint): New.
(forward_target_remove_breakpoint): New.
(memory_remove_breakpoint, memory_insert_breakpoint):
Add target_ops parameter.
* target.c (target_insert_breakpoint): Split into this and ...
(forward_target_insert_breakpoint): ... this.
(target_remove_breakpoint): Split into this and ...
(forward_target_remove_breakpoint): ... this.
(debug_to_insert_breakpoint): Add target_ops parameter.
Call forward_target_insert_breakpoint.
(debug_to_remove_breakpoint): Add target_ops parameter.
Call forward_target_remove_breakpoint.
(update_current_target): Do not inherit or default to_insert_breakpoint
and to_remove_breakpoint.
* corelow.c (ignore): Add target_ops parameter.
* exec.c (ignore): Add target_ops parameter.
* mem-break.c (memory_insert_breakpoint, memory_remove_breakpoint):
Add target_ops parameter.
* monitor.c (monitor_insert_breakpoint, monitor_remove_breakpoint):
Add target_ops parameter.
* nto-procfs.c (procfs_insert_breakpoint, procfs_remove_breakpoint):
Add target_ops parameter.
* record-full.c (record_full_beneath_to_insert_breakpoint)
(record_full_beneath_to_remove_breakpoint, tmp_to_insert_breakpoint)
(tmp_to_remove_breakpoint, record_full_insert_breakpoint)
(record_full_remove_breakpoint, record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint): Add target_ops parameter.
Update users.
(record_full_beneath_to_insert_breakpoint_ops)
(record_full_beneath_to_remove_breakpoint_ops)
(tmp_to_insert_breakpoint_ops, tmp_to_remove_breakpoint_ops): New.
(record_full_open): Initialize tmp_to_insert_breakpoint_ops,
tmp_to_remove_breakpoint_ops,
record_full_beneath_to_insert_breakpoint_ops, and
record_full_beneath_to_remove_breakpoint_ops.
* remote-m32r-sdi.c (m32r_insert_breakpoint)
(m32r_remove_breakpoint): Add target_ops parameter.
* remote-mips.c (mips_insert_breakpoint, mips_remove_breakpoint):
Add target_ops parameter.
* remote.c (remote_insert_breakpoint, remote_remove_breakpoint):
Add target_ops parameter.
Markus Metzger [Mon, 18 Mar 2013 15:47:01 +0000 (16:47 +0100)]
record-btrace, frame: supply target-specific unwinder
Supply a target-specific frame unwinder for the record-btrace target that does
not allow unwinding while replaying.
2013-02-11 Jan Kratochvil <jan.kratochvil@redhat.com>
Markus Metzger <markus.t.metzger@intel.com>
gdb/
* record-btrace.c: Include frame-unwind.h.
(record_btrace_frame_unwind_stop_reason)
(record_btrace_frame_this_id, record_btrace_frame_prev_register)
(record_btrace_frame_sniffer, record_btrace_frame_unwind):
New.
(init_record_btrace_ops): Install it.
Markus Metzger [Mon, 18 Mar 2013 15:43:05 +0000 (16:43 +0100)]
frame: do not assume unwinding will succeed
In get_frame_unwind_stop_reason, remove the assumption that further frame
unwinding will succeed.
gdb/
2013-02-11 Jan Kratochvil <jan.kratochvil@redhat.com>
* frame.c (get_frame_unwind_stop_reason): Unconditionally call
get_prev_frame_1.
Markus Metzger [Mon, 18 Mar 2013 15:43:05 +0000 (16:43 +0100)]
frame, cfa: check unwind stop reason first
Swap the unwind stop reason check and the unwinder check to allow
non-dwarf2 frame types to fail with a recoverable error.
gdb/
2013-02-11 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf2-frame.c (dwarf2_frame_cfa): Move UNWIND_UNAVAILABLE check
earlier.
Markus Metzger [Mon, 18 Mar 2013 15:43:05 +0000 (16:43 +0100)]
frame, backtrace: allow targets to supply a frame unwinder
Allow targets to supply their own target-specific frame unwinders; one for
normal frames and one for tailcall frames. If a target-specific unwinder
is supplied, it will be chosen before any other unwinder.
The original patch has been split into this and the next two patches.
gdb/
2013-02-11 Jan Kratochvil <jan.kratochvil@redhat.com>
* frame-unwind.c: Include target.h.
(frame_unwind_try_unwinder): New function with code from ...
(frame_unwind_find_by_frame): ... here. New variable
unwinder_from_target, call also target_get_unwinder)
(target_get_tailcall_unwinder, and frame_unwind_try_unwinder for it.
* target.c (target_get_unwinder, target_get_tailcall_unwinder): New.
* target.h (struct target_ops): New fields to_get_unwinder and
to_get_tailcall_unwinder.
(target_get_unwinder, target_get_tailcall_unwinder): New declarations.
Markus Metzger [Thu, 28 Mar 2013 09:38:24 +0000 (10:38 +0100)]
record-btrace: supply register target methods
Supply target methods to allow reading the PC. Forbid anything else.
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* record-btrace.c (record_btrace_fetch_registers)
(record_btrace_store_registers)
(record_btrace_to_prepare_to_store): New.
(init_record_btrace_ops): Add the above.
Markus Metzger [Mon, 13 Jan 2014 13:24:50 +0000 (14:24 +0100)]
Add target_ops argument to to_prepare_to_store
2013-12-17 Tom Tromey <tromey@redhat.com>
* windows-nat.c (windows_prepare_to_store): Add 'self' argument.
* target.h (struct target_ops) <to_prepare_to_store>: Add
argument.
(target_prepare_to_store): Add argument.
* target.c (debug_to_prepare_to_store): Add argument.
(update_current_target): Update.
* remote.c (remote_prepare_to_store): Add 'self' argument.
* remote-sim.c (gdbsim_prepare_to_store): Add 'self' argument.
* remote-mips.c (mips_prepare_to_store): Add 'self' argument.
* remote-m32r-sdi.c (m32r_prepare_to_store): Add 'self' argument.
* record-full.c (record_full_core_prepare_to_store): Add 'self'
argument.
* ravenscar-thread.c (ravenscar_prepare_to_store): Add argument.
* nto-procfs.c (procfs_prepare_to_store): Add 'self' argument.
* monitor.c (monitor_prepare_to_store): Add 'self' argument.
* inf-child.c (inf_child_prepare_to_store): Add 'self' argument.
* go32-nat.c (go32_prepare_to_store): Add 'self' argument.
Markus Metzger [Fri, 26 Apr 2013 06:37:06 +0000 (08:37 +0200)]
btrace: add replay position to btrace thread info
Add a branch trace instruction iterator pointing to the current replay position
to the branch trace thread info struct.
Free the iterator when btrace is cleared.
Start at the replay position for the instruction and function-call histories.
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* btrace.h (replay) <replay>: New.
(btrace_is_replaying): New.
* btrace.c (btrace_clear): Free replay iterator.
(btrace_is_replaying): New.
* record-btrace.c (record_btrace_is_replaying): New.
(record_btrace_info): Print insn number if replaying.
(record_btrace_insn_history): Start at replay position.
(record_btrace_call_history): Start at replay position.
(init_record_btrace_ops): Init to_record_is_replaying.
Markus Metzger [Wed, 17 Apr 2013 07:39:43 +0000 (09:39 +0200)]
record-btrace: make ranges include begin and end
The "record function-call-history" and "record instruction-history" commands
accept a range "begin, end". End is not included in both cases. Include it.
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* record-btrace.c (record_btrace_insn_history_range): Include
end.
(record_btrace_insn_history_from): Adjust range.
(record_btrace_call_history_range): Include
end.
(record_btrace_call_history_from): Adjust range.
* NEWS: Announce changes.
testsuite/
* gdb.btrace/function_call_history.exp: Update tests.
* gdb.btrace/instruction_history.exp: Update tests.
doc/
* gdb.texinfo (Process Record and Replay): Update documentation.
Markus Metzger [Thu, 18 Apr 2013 08:58:05 +0000 (10:58 +0200)]
record-btrace: optionally indent function call history
Add a new modifier /c to the "record function-call-history" command to
indent the function name based on its depth in the call stack.
Also reorder the optional fields to have the indentation at the very beginning.
Prefix the insn range (/i modifier) with "inst ".
Prefix the source line (/l modifier) with "at ".
Change the range syntax from "begin-end" to "begin,end" to allow copy&paste to
the "record instruction-history" and "list" commands.
Adjust the respective tests and add new tests for the /c modifier.
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* record.h (enum record_print_flag)
<record_print_indent_calls>: New.
* record.c (get_call_history_modifiers): Recognize /c modifier.
(_initialize_record): Document /c modifier.
* record-btrace.c (btrace_call_history): Add btinfo parameter.
Reorder fields. Optionally indent the function name. Update
all users.
* NEWS: Announce changes.
testsuite/
* gdb.btrace/function_call_history.exp: Fix expected field
order for "record function-call-history".
Add new tests for "record function-call-history /c".
* gdb.btrace/exception.cc: New.
* gdb.btrace/exception.exp: New.
* gdb.btrace/tailcall.exp: New.
* gdb.btrace/x86-tailcall.S: New.
* gdb.btrace/x86-tailcall.c: New.
* gdb.btrace/unknown_functions.c: New.
* gdb.btrace/unknown_functions.exp: New.
* gdb.btrace/Makefile.in (EXECUTABLES): Add new.
doc/
* gdb.texinfo (Process Record and Replay): Document new /c
modifier accepted by "record function-call-history".
Add /i modifier to "record function-call-history" example.
Markus Metzger [Wed, 10 Apr 2013 11:43:41 +0000 (13:43 +0200)]
btrace: increase buffer size
Try to allocate as much buffer as we can for each thread with a maximum
of 64KB.
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* common/linux-btrace.c (linux_enable_btrace): Enlarge buffer.
Markus Metzger [Mon, 13 May 2013 12:57:42 +0000 (14:57 +0200)]
record-btrace: start counting at one
The record instruction-history and record-function-call-history commands start
counting instructions at zero. This is somewhat unintuitive when we start
navigating in the recorded instruction history. Start at one, instead.
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* btrace.c (ftrace_new_function): Start counting at one.
* record-btrace.c (record_btrace_info): Adjust number of calls
and insns.
* NEWS: Announce it.
testsuite/
* gdb.btrace/instruction_history.exp: Update.
* gdb.btrace/function_call_history.exp: Update.
Markus Metzger [Tue, 26 Mar 2013 10:32:20 +0000 (11:32 +0100)]
record-btrace: fix insn range in function call history
With the "/i" modifier, we print the instruction number range in the
"record function-call-history" command as [begin, end).
It would be more intuitive if we printed the range as [begin, end].
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* record-btrace.c (btrace_call_history_insn_range): Print
insn range as [begin, end].
Markus Metzger [Fri, 22 Mar 2013 13:32:47 +0000 (14:32 +0100)]
btrace: change branch trace data structure
The branch trace is represented as 3 vectors:
- a block vector
- a instruction vector
- a function vector
Each vector (except for the first) is computed from the one above.
Change this into a graph where a node represents a sequence of instructions
belonging to the same function and where we have three types of edges to connect
the function segments:
- control flow
- same function (instance)
- call stack
This allows us to navigate in the branch trace. We will need this for "record
goto" and reverse execution.
This patch introduces the data structure and computes the control flow edges.
It also introduces iterator structs to simplify iterating over the branch trace
in control-flow order.
It also fixes PR gdb/15240 since now recursive calls are handled correctly.
Fix the test that got the number of expected fib instances and also the
function numbers wrong.
The current instruction had been part of the branch trace. This will look odd
once we start support for reverse execution. Remove it. We still keep it in
the trace itself to allow extending the branch trace more easily in the future.
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* btrace.h (struct btrace_func_link): New.
(enum btrace_function_flag): New.
(struct btrace_inst): Rename to ...
(struct btrace_insn): ...this. Update all users.
(struct btrace_func) <ibegin, iend>: Remove.
(struct btrace_func_link): New.
(struct btrace_func): Rename to ...
(struct btrace_function): ...this. Update all users.
(struct btrace_function) <segment, flow, up, insn, insn_offset)
(number, level, flags>: New.
(struct btrace_insn_iterator): Rename to ...
(struct btrace_insn_history): ...this.
Update all users.
(struct btrace_insn_iterator, btrace_call_iterator): New.
(struct btrace_target_info) <btrace, itrace, ftrace>: Remove.
(struct btrace_target_info) <begin, end, level>
<insn_history, call_history>: New.
(btrace_insn_get, btrace_insn_number, btrace_insn_begin)
(btrace_insn_end, btrace_insn_prev, btrace_insn_next)
(btrace_insn_cmp, btrace_find_insn_by_number, btrace_call_get)
(btrace_call_number, btrace_call_begin, btrace_call_end)
(btrace_call_prev, btrace_call_next, btrace_call_cmp)
(btrace_find_function_by_number, btrace_set_insn_history)
(btrace_set_call_history): New.
* btrace.c (btrace_init_insn_iterator)
(btrace_init_func_iterator, compute_itrace): Remove.
(ftrace_print_function_name, ftrace_print_filename)
(ftrace_skip_file): Change
parameter to const.
(ftrace_init_func): Remove.
(ftrace_debug): Use new btrace_function fields.
(ftrace_function_switched): Also consider gaining and
losing symbol information).
(ftrace_print_insn_addr, ftrace_new_call, ftrace_new_return)
(ftrace_new_switch, ftrace_find_caller, ftrace_new_function)
(ftrace_update_caller, ftrace_fixup_caller, ftrace_new_tailcall):
New.
(ftrace_new_function): Move. Remove debug print.
(ftrace_update_lines, ftrace_update_insns): New.
(ftrace_update_function): Check for call, ret, and jump.
(compute_ftrace): Renamed to ...
(btrace_compute_ftrace): ...this. Rewritten to compute call
stack.
(btrace_fetch, btrace_clear): Updated.
(btrace_insn_get, btrace_insn_number, btrace_insn_begin)
(btrace_insn_end, btrace_insn_prev, btrace_insn_next)
(btrace_insn_cmp, btrace_find_insn_by_number, btrace_call_get)
(btrace_call_number, btrace_call_begin, btrace_call_end)
(btrace_call_prev, btrace_call_next, btrace_call_cmp)
(btrace_find_function_by_number, btrace_set_insn_history)
(btrace_set_call_history): New.
* record-btrace.c (require_btrace): Use new btrace thread
info fields.
(record_btrace_info, btrace_insn_history)
(record_btrace_insn_history, record_btrace_insn_history_range):
Use new btrace thread info fields and new iterator.
(btrace_func_history_src_line): Rename to ...
(btrace_call_history_src_line): ...this. Use new btrace
thread info fields.
(btrace_func_history): Rename to ...
(btrace_call_history): ...this. Use new btrace thread info
fields and new iterator.
(record_btrace_call_history, record_btrace_call_history_range):
Use new btrace thread info fields and new iterator.
testsuite/
* gdb.btrace/function_call_history.exp: Fix expected function
trace.
* gdb.btrace/instruction_history.exp: Initialize traced.
Remove traced_functions.
Markus Metzger [Wed, 18 Dec 2013 13:13:54 +0000 (14:13 +0100)]
frame: add frame_id_build_unavailable_stack_special
Add a function to build a frame_id for a frame with unavailable stack
and with a special identifier address.
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* frame.h (frame_id_build_unavailable_stack_special): New.
* frame.c (frame_id_build_unavailable_stack_special): New.
Markus Metzger [Fri, 22 Mar 2013 14:56:56 +0000 (15:56 +0100)]
gdbarch: add instruction predicate methods
Add new methods to gdbarch for analyzing the instruction at a given address.
Implement those methods for i386 and amd64 architectures.
This is needed by "record btrace" to detect function calls in the
execution trace.
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* amd64-tdep.c (amd64_classify_insn_at, amd64_insn_is_call)
(amd64_insn_is_ret, amd64_insn_is_jump, amd64_jmp_p): New.
(amd64_init_abi): Add insn_is_call, insn_is_ret, and insn_is_jump
to gdbarch.
* i386-tdep.c (i386_insn_is_call, i386_insn_is_ret)
(i386_insn_is_jump, i386_jmp_p): New.
(i386_gdbarch_init): Add insn_is_call, insn_is_ret, and
insn_is_jump to gdbarch.
* gdbarch.sh (insn_is_call, insn_is_ret, insn_is_jump): New.
* gdbarch.h: Regenerated.
* gdbarch.c: Regenerated.
* arch-utils.h (default_insn_is_call, default_insn_is_ret)
(default_insn_is_jump): New.
* arch-utils.c (default_insn_is_call, default_insn_is_ret)
(default_insn_is_jump): New.
Markus Metzger [Mon, 30 Sep 2013 13:00:16 +0000 (15:00 +0200)]
btrace: uppercase btrace_read_type
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* common/btrace-common.h (btrace_read_type) <btrace_read_all>:
Change to ...
(btrace_read_type) <BTRACE_READ_ALL>: ... this. Update users.
(btrace_read_type) <btrace_read_new>: Change to ...
(btrace_read_type) <BTRACE_READ_NEW>: ... this. Update users.
Markus Metzger [Mon, 3 Jun 2013 12:32:15 +0000 (14:32 +0200)]
btrace, linux: fix memory leak when reading branch trace
When it takes more than one iteration to read the BTS trace, the trace from the
previous iteration is leaked. Fix it.
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* common/linux-btrace.c (linux_read_btrace): Free trace from
previous iteration.
Markus Metzger [Wed, 18 Dec 2013 13:47:17 +0000 (14:47 +0100)]
btrace, test: fix multi-line btrace tests
For testing multi-line test output, gdb.btrace tests used the following
pattern:
gdb_test "..." "
...\r
..."
Change this to:
gdb_test "..." [join [list \
"..." \
"..."] "\r\n"]
Also extract repeated tests into a test function and shorten or remove
test messages.
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
testsuite/
* gdb.btrace/function_call_history.exp: Update
* gdb.btrace/instruction_history.exp: Update.
Markus Metzger [Thu, 16 Jan 2014 08:47:51 +0000 (09:47 +0100)]
test, btrace: update expected text
The error message for starting recording twice changed.
Update the expected text to fix resulting regressions.
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* gdb.btrace/enable.exp: Update expected text.
Omair Javaid [Thu, 16 Jan 2014 11:00:00 +0000 (11:00 +0000)]
Fix testsuite/gdb.dwarf2/dw2-dos-drive.exp on ARM.
This test currently fails on ARM:
(gdb) PASS: gdb.dwarf2/dw2-dos-drive.exp: set breakpoint pending off
break 'z:file.c':func
Cannot access memory at address 0x0
The error is GDB trying to read the prologue at the breakpoint's
address, and failing:
38 throw_error() exceptions.c:444 0x0016728c
37 memory_error() corefile.c:204 0x001d1fcc
36 read_memory() corefile.c:223 0x001d201a
35 read_memory_unsigned_integer() corefile.c:312 0x001d2166
34 arm_skip_prologue() arm-tdep.c:1452 0x00054270
static CORE_ADDR
arm_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
{
...
for (skip_pc = pc; skip_pc < limit_pc; skip_pc += 4)
{
inst = read_memory_unsigned_integer (skip_pc, 4, byte_order_for_code);
The test doesn't execute the compiled object's code, so GDB will try
to read memory from the binary's sections. Instructions on ARM are
4-byte wide, and thus ARM's prologue scanner reads in 4-byte chunks.
As the section 'func' is put at is only 1 byte long, and no other
section is allocated contiguously:
...
Sections:
Idx Name Size VMA LMA File off Algn
0 .text
00000001 00000000 00000000 00000034 2**0
CONTENTS, ALLOC, LOAD, READONLY, CODE
...
... the exec target fails the read the 4 bytes.
Fix this by increasing the function's size.
gdb/testsuite/ChangeLog:
2014-01-16 Omair Javaid <Omair.Javaid@linaro.org>
* gdb.dwarf2/dw2-dos-drive.S: Increase text section size to 4
bytes.
H.J. Lu [Wed, 15 Jan 2014 20:53:04 +0000 (12:53 -0800)]
Skip directories with LIBPATH_SUFFIX_SKIP suffix
On Linux/x86-64, when binutils is configured with --libdir=/usr/lib64,
genscripts.sh treats /usr/lib64 as the default search directory. It
puts /usr/lib64 in linker scripts for all emulations, like
---
/* Script for -z combreloc: combine and sort reloc sections */
OUTPUT_FORMAT("elf32-i386", "elf32-i386",
"elf32-i386")
OUTPUT_ARCH(i386)
ENTRY(_start)
SEARCH_DIR("/usr/x86_64-redhat-linux/lib32");
SEARCH_DIR("/usr/i386-redhat-linux/lib32"); SEARCH_DIR("/usr/lib6432");
SEARCH_DIR("/usr/local/lib32"); SEARCH_DIR("/lib32");
SEARCH_DIR("/usr/lib32"); SEARCH_DIR("/usr/i386-redhat-linux/lib");
SEARCH_DIR("/usr/lib64"); SEARCH_DIR("/usr/local/lib");
SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
---
/usr/lib6432 is odd and /usr/lib64 is wrong. This patch changes
genscripts.sh to check LIBPATH_SUFFIX_SKIP if it is defined. It
skips directories with LIBPATH_SUFFIX_SKIP suffix.
PR ld/16456
* genscripts.sh: Don't search directory with LIBPATH_SUFFIX_SKIP
suffix.
* emulparams/elf32_x86_64.sh (LIBPATH_SUFFIX_SKIP): Set to 64
for elf32_x86_64 emulation.
* emulparams/elf_i386.sh (LIBPATH_SUFFIX_SKIP): Set to 64
for elf_i386 emulation.
Alan Modra [Thu, 16 Jan 2014 01:17:25 +0000 (11:47 +1030)]
Tidy ld use of bfd_section userdata.
A long time ago ld made use of userdata to tie an output section to
its lang_input_statement_struct object file. Some time later Joern
made map file printing of symbols at lot faster, using userdata on
input sections. That complicated allocation of userdata, and when the
output section use disappeared a year later, the code wasn't properly
cleaned up. This patch does that cleanup, and also tidies the symbol
printing code to not allocate userdata where it won't be needed. We
don't print symbols defined in the absolute section or in output
sections.
* ld.h (fat_section_userdata_type, get_userdata): Move to..
* ldlang.h (input_section_userdata_type, get_userdata): ..here.
* ldlang.c (init_map_userdata): Delete. Fold into..
(sort_def_symbol): ..here. Don't attach input section userdata
to output sections or global bfd sections.
(lang_map): Don't pre-allocate input section userdata.
(init_os): Don't allocate userdata for output sections.
(print_all_symbols): Update.
Alan Modra [Thu, 16 Jan 2014 01:20:28 +0000 (11:50 +1030)]
Fix mips segfault on GOT access of absolute symbol
When a symbol is absolute, this code in mips_elf_record_got_page_entry
entry = bfd_zalloc (sec->owner, sizeof (*entry));
segfaults. sec == bfd_abs_section_ptr and sec->owner == NULL.
* elfxx-mips.c (mips_elf_record_got_page_entry): Pass in a
mips_elf_traverse_got_arg* rather than mips_got_info*.
Adjust caller. Alloc on output_bfd rather than symbol section
owner.
Doug Evans [Thu, 16 Jan 2014 00:35:37 +0000 (16:35 -0800)]
delete thread_id_to_gdb_id, unused
* inferiors.c (thread_id_to_gdb_id): Delete.
* inferiors.h (thread_id_to_gdb_id): Delete.
Alan Modra [Wed, 15 Jan 2014 23:01:07 +0000 (09:31 +1030)]
daily update
Maciej W. Rozycki [Wed, 15 Jan 2014 22:17:53 +0000 (22:17 +0000)]
AArch64: gdb.base/float.exp: Fix `info float' test
* gdb.base/float.exp: Handle "aarch64*-*-*" targets.
Doug Evans [Wed, 15 Jan 2014 21:14:06 +0000 (13:14 -0800)]
* dwarf2read.c (open_and_init_dwp_file): Use pulongest to print uint32_t.
Tom Tromey [Tue, 31 Dec 2013 03:34:16 +0000 (20:34 -0700)]
move the "main" data into the per-BFD object
This adds the "main"-related data into the per-BFD. This is needed
because once symbol sharing across objfiles is complete, computing the
main name as a side effect of symbol reading will no longer work --
the symbols simply won't be re-read.
After this change, set_main_name is only used by the main_name
machinery itself, so this patch makes it static.
2014-01-15 Tom Tromey <tromey@redhat.com>
* dbxread.c (process_one_symbol): Use set_objfile_main_name.
* dwarf2read.c (read_partial_die): Use set_objfile_main_name.
* objfiles.c (get_objfile_bfd_data): Initialize language_of_main.
(set_objfile_main_name): New function.
* objfiles.h (struct objfile_per_bfd_storage) <name_of_main,
language_of_main>: New fields.
(set_objfile_main_name): Declare.
* symtab.c (find_main_name): Loop over objfiles to find the main
name and language.
(set_main_name): Now static.
(get_main_info): Add comment.
* symtab.h (set_main_name): Don't declare.
Tom Tromey [Tue, 31 Dec 2013 03:18:24 +0000 (20:18 -0700)]
move main name into the progspace
This moves the "main" name and language into an object attached to the
current progspace. This prevents problems if there are multiple
inferiors tha have different ideas of "main" -- which matters at least
for unwinding, see frame.c:inside_main_func.
2014-01-15 Tom Tromey <tromey@redhat.com>
* symtab.c (main_progspace_key): New global.
(struct main_info): New.
(name_of_main, language_of_main): Remove.
(get_main_info, main_info_cleanup): New function.
(set_main_name, main_name, main_language): Use get_main_info.
(_initialize_symtab): Initialize main_progspace_key.
Tom Tromey [Tue, 31 Dec 2013 03:05:34 +0000 (20:05 -0700)]
make language_of_main static
This makes the global language_of_main static. Now it can be set only
via a new argument to set_main_name.
2014-01-15 Tom Tromey <tromey@redhat.com>
* dbxread.c (process_one_symbol): Update.
* dwarf2read.c (read_partial_die): Update.
* symfile.c (set_initial_language): Call main_language.
* symtab.c (language_of_main): Now static.
(set_main_name): Add 'lang' parameter.
(find_main_name): Update.
(main_language): New function.
(symtab_observer_executable_changed): Update.
* symtab.h (set_main_name): Update.
(language_of_main): Remove.
(main_language): Declare.
Tom Tromey [Tue, 31 Dec 2013 13:57:18 +0000 (06:57 -0700)]
move the entry point info into the per-bfd object
This moves the entry point information into the per-BFD object and
arranges not to recompute it when it has already been computed.
2014-01-15 Tom Tromey <tromey@redhat.com>
* symfile.c (init_entry_point_info): Use new "initialized" field.
Update.
* objfiles.h (struct entry_point) <initialized>: New field.
(struct objfile_per_bfd_storage) <ei>: New field, moved from...
(struct objfile) <ei>: ...here. Remove.
* objfiles.c (entry_point_address_query): Update.
Tom Tromey [Tue, 31 Dec 2013 13:52:33 +0000 (06:52 -0700)]
relocate the entry point address when used
This changes the entry point to be unrelocated in the objfile, and
instead applies the relocation when it is used.
2014-01-15 Tom Tromey <tromey@redhat.com>
* objfiles.c (entry_point_address_query): Relocate entry point
address.
(objfile_relocate1): Do not relocate entry point address.
* objfiles.h (struct entry_info) <entry_point>: Update comment.
<the_bfd_section_index>: New field.
* symfile.c (init_entry_point_info): Find the entry point's
section.
Tom Tromey [Tue, 31 Dec 2013 09:47:37 +0000 (02:47 -0700)]
change solib-frv to use entry_point_address_query
This is just a minor cleanup in advance of some other changes, that
modifies solib-frv.c to use entry_point_address_query. I don't have a
good way to test this but I think it is obviously correct.
2014-01-15 Tom Tromey <tromey@redhat.com>
* solib-frv.c (enable_break): Use entry_point_address_query.
Omair Javaid [Fri, 3 Jan 2014 19:15:36 +0000 (00:15 +0500)]
gdb: Add a NEWS entry for ARM record/replay improvements
This patch adds a news entry about improvements in record-replay and
reverse debugging support for arm*-linux* targets.
gdb/ChangeLog:
2014-01-15 Omair Javaid <omair.javaid@linaro.org>
* NEWS: Add note on improved process record-replay on
arm*-linux* targets.
Omair Javaid [Thu, 9 Jan 2014 10:59:55 +0000 (15:59 +0500)]
gdb: ARM: Update configure.tgt and enable gdb.reverse testsuite
gdb/testsuite/ChangeLog:
2014-01-15 Omair Javaid <omair.javaid@linaro.org>
* lib/gdb.exp (supports_process_record): Return true for
arm*-linux*. (supports_reverse): Likewise.
Omair Javaid [Thu, 9 Jan 2014 10:33:55 +0000 (15:33 +0500)]
gdb: ARM: Add support for thumb32 instructions recording
gdb/ChangeLog:
2014-01-15 Omair Javaid <omair.javaid@linaro.org>
* arm-tdep.c (enum arm_record_result): New enum.
(arm_record_unsupported_insn): New function.
(arm_record_coproc_data_proc): Removed.
(thumb2_record_ld_st_multiple): New function.
(thumb2_record_ld_st_dual_ex_tbb): New function.
(thumb2_record_data_proc_sreg_mimm): New function.
(thumb2_record_ps_dest_generic): New function.
(thumb2_record_branch_misc_cntrl): New function.
(thumb2_record_str_single_data): New function.
(thumb2_record_ld_mem_hints): New function.
(thumb2_record_ld_word): New function.
(thumb2_record_lmul_lmla_div): New function.
(thumb2_record_decode_insn_handler): New function.
(decode_insn): Add thumb32 instruction handlers.
Omair Javaid [Thu, 9 Jan 2014 10:49:27 +0000 (15:49 +0500)]
gdb: ARM: Adds support for recording system call instructions
gdb/ChangeLog:
2014-01-15 Omair Javaid <omair.javaid@linaro.org>
* arm-linux-tdep.c: Include "record-full.h" and "linux-record.h".
(struct arm_linux_record_tdep): Declare.
(arm_canonicalize_syscall): New function.
(arm_all_but_pc_registers_record): New function.
(arm_linux_syscall_record): New function.
(arm_linux_init_abi): Add syscall recording constructs.
* arm-tdep.c (thumb_record_ldm_stm_swi): Update thumb syscall
decoding. (arm_record_coproc_data_proc): Update arm syscall
decoding.
* arm-tdep.h (struct gdbarch_tdep) <arm_swi_record>: Remove.
<arm_syscall_record>: New field.
* configure.tgt (arm*-*-linux*): Add linux-record.o to
gdb_target_obs.
Omair Javaid [Fri, 3 Jan 2014 19:15:32 +0000 (00:15 +0500)]
gdb: ARM: Fix for bug in pop instruction decoding
This patch fixes thumb push instruction recording by replacing base
register from pc to sp.
gdb/ChangeLog:
2014-01-15 Omair Javaid <omair.javaid@linaro.org>
* arm-tdep.c (thumb_record_misc): Update to use sp as base
register for push instruction recording.
Omair Javaid [Fri, 3 Jan 2014 19:15:31 +0000 (00:15 +0500)]
gdb: ARM: Fix for bugs in push and ldm instructions decoding
This patch corrects the register numbers and removes multiple loops in
recording procedure of instructions involving multiple registers.
gdb/ChangeLog:
2014-01-15 Omair Javaid <omair.javaid@linaro.org>
* arm-tdep.c (thumb_record_misc): Update to correct logical
error while recording ldm, ldmia and pop instructions.
Omair Javaid [Thu, 9 Jan 2014 10:35:45 +0000 (15:35 +0500)]
gdb: ARM: Fix for memory record corruption due to 64bit addresses
gdb/ChangeLog:
2014-01-15 Omair Javaid <omair.javaid@linaro.org>
* arm-tdep.c (struct arm_mem_r) <addr>: Change type to uint32_t.
Pedro Alves [Wed, 15 Jan 2014 16:18:04 +0000 (16:18 +0000)]
Fix go32-nat.c build fallout from to_detach constification.
The recent constification of to_detach missed updating the forward
declaration of go32_detach, breaking the build:
../../src/gdb/go32-nat.c:387:1: error: conflicting types for 'go32_detach'
../../src/gdb/go32-nat.c:240:13: note: previous declaration of 'go32_detach' was here
go32_detach is actually defined before it's ever used, making the
forward declaration is unnecessary. So we can just remove it instead
of updating it. While at it, remove all others in the same situation.
Tested by building a djgpp gdb.
gdb/
2014-01-15 Pedro Alves <palves@redhat.com>
* go32-nat.c (go32_open, go32_close, go32_attach, go32_detach)
(go32_resume, go32_fetch_registers, store_register)
(go32_store_registers, go32_prepare_to_store)
(go32_xfer_memory, go32_files_info, go32_kill_inferior)
(go32_create_inferior, go32_can_run, go32_terminal_init)
(go32_terminal_inferior, go32_terminal_ours): Delete forward
declarations.
H.J. Lu [Wed, 15 Jan 2014 15:43:19 +0000 (07:43 -0800)]
Silence uninitialized warning on ehdr_start_save
Older GCC, like 4.1/4.2, will issue an uninitialized warning on
ehdr_start_save. This patch silences by using
struct bfd_link_hash_entry ehdr_start_save = ehdr_start_save;
* emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation):
Silence uninitialized warning on ehdr_start_save with older
GCC.
Tom Tromey [Thu, 19 Dec 2013 21:33:07 +0000 (14:33 -0700)]
introduce async_callback_ftype
This introduces async_callback_ftype. This is needed for
make-target-delegates to work properly, as it doesn't implement a real
parser. I think it's also an ok cleanup in its own right.
2014-01-15 Tom Tromey <tromey@redhat.com>
* target.h (async_callback_ftype): New typedef.
(struct target_ops) <to_async>: Use it.
Joel Brobecker [Wed, 15 Jan 2014 12:40:22 +0000 (16:40 +0400)]
Fix small style violation in py-value.c:get_field_type
gdb/ChangeLog:
* python/py-value.c (get_field_type): Remove unnecessary curly
braces for single-statement if block.
Tested on x86_64-linux.
Joel Brobecker [Wed, 15 Jan 2014 12:28:08 +0000 (16:28 +0400)]
Add missing empty line after declarations in "if" block (py-type.c).
This patch fixes a small coding-style violation...
gdb/ChangeLog:
* python/py-type.c (convert_field): Add missing empty line
after declarations.
Joel Brobecker [Mon, 23 Dec 2013 00:25:14 +0000 (04:25 +0400)]
Small fixes to the GDB/MI Output Syntax grammar.
This patch fixes the grammar, and tries to do it in a way that makes
the logic behind the current implementation a little clearer.
gdb/doc/ChangeLog:
(from Yuanhui Zhang <asmwarrior@gmail.com>)
(from Joel Brobecker <brobecker@adacore.com>)
* gdb.texinfo (GDB/MI Output Syntax): Add some missing "nl"
markers. Remove one that was misplaced.
H.J. Lu [Wed, 15 Jan 2014 11:59:42 +0000 (03:59 -0800)]
Revert the last change
It has been fixed by
commit
4199e3b8669d0a36448687850374fdc2ad7240b6
Author: Alan Modra <amodra@gmail.com>
Date: Wed Jan 15 21:50:55 2014 +1030
non-PIC references to __ehdr_start in pie and shared
Rather than hacking every backend to not discard dynamic relocations
against an undefined hidden __ehdr_start, make it appear to be defined
early. We want __ehdr_start hidden before size_dynamic_sections so
that it isn't put in .dynsym, but we do need the dynamic relocations
for a PIE or shared library with a non-PIC reference. Defining it
early is wrong if we don't actually define the symbol later to its
proper value. (In some cases we want to leave the symbol undefined,
for example, when the ELF header isn't loaded, and we don't have this
infomation available in before_allocation.)
* elf32-i386.c (elf_i386_allocate_dynrelocs): Revert the last
change.
* elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewise.
Alan Modra [Wed, 15 Jan 2014 11:20:55 +0000 (21:50 +1030)]
non-PIC references to __ehdr_start in pie and shared
Rather than hacking every backend to not discard dynamic relocations
against an undefined hidden __ehdr_start, make it appear to be defined
early. We want __ehdr_start hidden before size_dynamic_sections so
that it isn't put in .dynsym, but we do need the dynamic relocations
for a PIE or shared library with a non-PIC reference. Defining it
early is wrong if we don't actually define the symbol later to its
proper value. (In some cases we want to leave the symbol undefined,
for example, when the ELF header isn't loaded, and we don't have this
infomation available in before_allocation.)
ld/
* emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Define
__ehdr_start before size_dynamic_sections and restore afterwards.
ld/testsuite/
* ld-elf/ehdr_start-shared.d: New.
* ld-elf/ehdr_start-userdef.d: xfail frv.
* ld-elf/ehdr_start-weak.d: Likewise.
* ld-elf/ehdr_start.d: Likewise.
Doug Evans [Wed, 15 Jan 2014 02:36:33 +0000 (18:36 -0800)]
psymtab cleanup patch 3/3
This last patch removes "partial" from the names of
expand_partial_symbol_names and map_partial_symbol_filenames.
It also renames expand_partial_symbol_names to match the
struct quick_symbol_functions "method" that it wraps:
expand_symtabs_matching.
This patch also adds two parameters to expand_symtabs_matching
so that it can fully wrap the underlying quick_symbol_functions method.
This makes it usable in more places.
I thought of having a cover function that still had the same
signature as the old expand_partial_symbol_names function,
but I couldn't think of a good name, and it wasn't clear it was
worth it anyway.
* symfile.h (expand_symtabs_matching): Renamed from
expand_partial_symbol_names. Update prototype.
(map_symbol_filenames): Renamed from map_partial_symbol_filenames.
* symfile.c (expand_symtabs_matching): Renamed from
expand_partial_symbol_names. New args file_matcher, kind.
Rename arg fun to symbol_matcher.
(map_symbol_filenames): Renamed from map_partial_symbol_filenames.
* ada-lang.c (ada_complete_symbol_matcher): Renamed from
ada_expand_partial_symbol_name.
(ada_make_symbol_completion_list): Update to call
expand_symtabs_matching.
(ada_add_global_exceptions): Call expand_symtabs_matching.
* mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_files): Update to
call map_symbol_filenames.
* symtab.c (sources_info): Update to call map_symbol_filenames.
(search_symbols): Call expand_symtabs_matching.
(symbol_completion_matcher): Renamed from expand_partial_symbol_name.
(default_make_symbol_completion_list_break_on): Update to call
expand_symtabs_matching.
(make_source_files_completion_list): Update to call
map_symbol_filenames.
Doug Evans [Wed, 15 Jan 2014 02:30:31 +0000 (18:30 -0800)]
psymtab cleanup patch 2/3
This patch adds two typedefs:
expand_symtabs_file_matcher_ftype
expand_symtabs_symbol_matcher_ftype
It also renames the NAME_MATCHER argument in expand_symtabs_matching.
The function is named expand_symtabs_matching and it takes a name_matcher
argument. Name of what? The symtab? A symbol?
I made it SYMBOL_MATCHER to make it clearer.
* symfile.h (expand_symtabs_file_matcher_ftype): New typedef.
(expand_symtabs_symbol_matcher_ftype): New typedef.
(quick_symbol_functions.expand_symtabs_matching): Update to use.
expand_symtabs_file_matcher_ftype, expand_symtabs_symbol_matcher_ftype.
* symfile.c (expand_partial_symbol_names): Update to use
expand_symtabs_symbol_matcher_ftype.
* dwarf2read.c (dw2_expand_symtabs_matching): Update to use
expand_symtabs_file_matcher_ftype, expand_symtabs_symbol_matcher_ftype.
Arg name_matcher renamed to symbol_matcher.
* psymtab.c (recursively_search_psymtabs): Update to use
expand_symtabs_symbol_matcher_ftype. Arg name_matcher renamed to
sym_matcher.
(expand_symtabs_matching_via_partial): Update to use
expand_symtabs_file_matcher_ftype, expand_symtabs_symbol_matcher_ftype.
Arg name_matcher renamed to symbol_matcher.
Doug Evans [Wed, 15 Jan 2014 02:19:51 +0000 (18:19 -0800)]
psymtab cleanup patch 1/3
This is the first of a set of three patches to cleanup psymtab.c a bit.
Basically, these two functions do not belong in psymtab.c:
expand_partial_symbol_names, map_partial_symbol_filenames,
and "partial" does not belong in the function name.
This first patch moves them to a better location.
The second patch adds some typedefs for function parameters to
quick_symbol_functions.expand_symtabs_matching.
The third patch removes "partial" from the function names
and uses them in more places.
* psymtab.c (expand_partial_symbol_names): Delete, moved to symfile.c.
(map_partial_symbol_filenames): Ditto.
* psymtab.h (expand_partial_symbol_names): Delete, moved to symfile.h.
(map_partial_symbol_filenames): Ditto.
* symfile.c (expand_partial_symbol_names): Moved here from psymtab.c.
(map_partial_symbol_filenames): Ditto.
* symfile.h (expand_partial_symbol_names): Moved here from psymtab.h.
(map_partial_symbol_filenames): Ditto.
* symtab.c: Delete #include "psymtab.h".
H.J. Lu [Wed, 15 Jan 2014 00:42:35 +0000 (16:42 -0800)]
Don't discard relocs against __ehdr_start
__ehdr_start will be defined by assign_file_positions_for_non_load_sections
later.
PR ld/16428
* elf32-i386.c (elf_i386_allocate_dynrelocs): Don't discard relocs
against __ehdr_start.
* elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewise.
H.J. Lu [Wed, 15 Jan 2014 00:40:13 +0000 (16:40 -0800)]
Revert the last change
* elf32-i386.c (elf_i386_allocate_dynrelocs): Revert the last
change.
* elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewise.
Alan Modra [Tue, 14 Jan 2014 23:00:50 +0000 (09:30 +1030)]
daily update
H.J. Lu [Tue, 14 Jan 2014 18:48:39 +0000 (10:48 -0800)]
Don't update reloc count if there are any non pc-relative relocs
PR ld/16428
* elf32-i386.c (elf_i386_allocate_dynrelocs): Don't update reloc
count if there are any non pc-relative relocs.
* elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewise.
Pedro Alves [Tue, 14 Jan 2014 16:12:19 +0000 (16:12 +0000)]
Fix "is a record target open" checks.
RECORD_IS_USED and record_full_open look at current_target.to_stratum
to determine whether a record target is in use. This is wrong because
arch_stratum is greater than record_stratum, so if an arch_stratum
target is pushed, RECORD_IS_USED and record_full_open will miss it.
To fix this, we can use the existing find_record_target instead, which
looks up for a record stratum target across the target stack. Since
that means exporting find_record_target in record.h, RECORD_IS_USED
ends up redundant, so the patch eliminates it.
That exercise then reveals other issues:
- adjust_pc_after_break is gating record_full_... calls based on
RECORD_IS_USED. But, record_full_ calls shouldn't be made when
recording with the record-btrace target. So this adds a new
record_full_is_used predicate to be used in that spot.
- record_full_open says "Process record target already running", even
if the recording target is record-btrace ("process record" is the
original complete name of the record-full target). record_btrace_open
only says "The process is already being recorded." and does not
suggest "record stop", like record-full does. The patch factors out
and merges that error to a new record_preopen function that all record
targets call in their open routine.
Tested on x86_64 Fedora 17.
gdb/
2014-01-14 Pedro Alves <palves@redhat.com>
Tom Tromey <tromey@redhat.com>
* infrun.c (use_displaced_stepping): Use find_record_target
instead of RECORD_IS_USED.
(adjust_pc_after_break): Use record_full_is_used instead of
RECORD_IS_USED.
* record-btrace.c (record_btrace_open): Call record_preopen
instead of checking RECORD_IS_USED.
* record-full.c (record_full_shortname)
(record_full_core_shortname): New globals.
(record_full_is_used): New function.
(find_full_open): Call record_preopen instead of checking
RECORD_IS_USED.
(init_record_full_ops): Set the target's shortname to
record_full_shortname.
(init_record_full_core_ops): Set the target's shortname to
record_full_core_shortname.
* record-full.h (record_full_is_used): Declare.
* record.c (find_record_target): Make extern.
(record_preopen): New function.
* record.h (RECORD_IS_USED): Delete macro.
(find_record_target, record_preopen): Declare functions.
Christophe Lyon [Tue, 14 Jan 2014 14:53:50 +0000 (15:53 +0100)]
2014-01-14 Michael Hudson-Doyle <michael.hudson@linaro.org>
Kugan Vivekanandarajah <kugan.vivekanandarajah@linaro.org>
bfd/
* elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Use correct
offset while calculating relocation address.
(elfNN_aarch64_create_small_pltn_entry): Likewise.
(elfNN_aarch64_init_small_plt0_entry): Likewise.
Yao Qi [Thu, 2 Jan 2014 07:36:55 +0000 (15:36 +0800)]
Change 'len''s type from LONGEST to ULONGEST: gdbarch methods core_xfer_shared_libraries and core_xfer_shared_libraries_aix
This patch changes the type of 'len' from LONGEST to ULONGEST. 'len'
is the argument of gdbarch methods core_xfer_shared_libraries and
core_xfer_shared_libraries_aix.
gdb:
2014-01-14 Yao Qi <yao@codesourcery.com>
* gdbarch.sh (core_xfer_shared_libraries): Change its argument
'len''s type to ULONGEST.
(core_xfer_shared_libraries_aix): Likewise.
* gdbarch.c, gdbarch.h: Reenerated.
* i386-cygwin-tdep.c (windows_core_xfer_shared_libraries):
Change type of 'len' to ULONGEST.
* rs6000-aix-tdep.c (rs6000_aix_ld_info_to_xml): Likewise.
(rs6000_aix_core_xfer_shared_libraries_aix): Likewise.
Yao Qi [Fri, 3 Jan 2014 11:19:51 +0000 (19:19 +0800)]
Change 'len' of linux_common_xfer_osdata to ULONGEST.
gdb:
2014-01-14 Yao Qi <yao@codesourcery.com>
* common/linux-osdata.c (linux_xfer_osdata_processes): Change
type of 'len' to ULONGEST.
(linux_xfer_osdata_processgroups): Likewise.
(linux_xfer_osdata_threads): Likewise.
(linux_xfer_osdata_fds): Likewise.
(linux_xfer_osdata_isockets): Likewise.
(linux_xfer_osdata_shm): Likewise.
(linux_xfer_osdata_sem): Likewise.
(linux_xfer_osdata_msg): Likewise.
(linux_common_xfer_osdata): Likewise.
(struct osdata_type) <getter>: Likewise.
* common/linux-osdata.h (linux_common_xfer_osdata): Update
the declaration.
Yao Qi [Fri, 3 Jan 2014 13:11:46 +0000 (21:11 +0800)]
Change to_xfer_partial 'len' type to ULONGEST.
This patch changes to_xfer_partial's len's type to ULONGEST, and
adjust its implementations.
gdb:
2014-01-14 Yao Qi <yao@codesourcery.com>
* target.h (target_xfer_partial_ftype): Update.
(struct target_ops) <to_xfer_partial>: Change 'len' type to
ULONGEST.
* aix-thread.c (aix_thread_xfer_partial): Change type of
argument 'len' to ULONGEST.
* auxv.c (procfs_xfer_auxv): Likewise.
(ld_so_xfer_auxv): Likewise.
(memory_xfer_auxv): Likewise.
* bfd-target.c (target_bfd_xfer_partial): Likewise.
* bsd-kvm.c (bsd_kvm_xfer_partial): Likewise.
* bsd-uthread.c (bsd_uthread_xfer_partial): Likewise.
* corelow.c (core_xfer_partial): Likewise.
* ctf.c (ctf_xfer_partial): Likewise.
* darwin-nat.c (darwin_read_write_inferior): Likewise. Use
'%u'.
(darwin_read_dyld_info): Likewise.
(darwin_xfer_partial): Likewise.
* exec.c (section_table_xfer_memory_partial): Likewise.
(exec_xfer_partial): Likewise.
* exec.h (section_table_xfer_memory_partial): Update
declaration.
* gnu-nat.c (gnu_xfer_memory): Likewise. Call pulongest
instead of plongest.
(gnu_xfer_partial): Likewise.
* ia64-hpux-nat.c (ia64_hpux_xfer_memory): Likewise.
(ia64_hpux_xfer_solib_got): Likewise.
(ia64_hpux_xfer_partial): Likewise.
* ia64-linux-nat.c (ia64_linux_xfer_partial):
* inf-ptrace.c (inf_ptrace_xfer_partial):
* inf-ttrace.c (inf_ttrace_xfer_partial):
* linux-nat.c (linux_xfer_siginfo): Likewise.
(linux_nat_xfer_partial): Likewise.
(spu_enumerate_spu_ids, linux_proc_xfer_spu): Likewise.
(linux_nat_xfer_osdata, linux_xfer_partial): Likewise.
* monitor.c (monitor_xfer_memory): Likewise.
(monitor_xfer_partial): Likewise.
* procfs.c (procfs_xfer_partial): Likewise.
* record-full.c (record_full_xfer_partial): Likewise.
(record_full_core_xfer_partial): Likewise.
* remote-sim.c (gdbsim_xfer_memory): Likewise. Call pulongest
instead of plongest.
(gdbsim_xfer_partial): Likewise.
* remote.c (remote_xfer_partial): Likewise.
* rs6000-aix-tdep.c (rs6000_aix_ld_info_to_xml): Likewise.
* rs6000-aix-tdep.h (rs6000_aix_ld_info_to_xml): Update
declaration.
* rs6000-nat.c (rs6000_xfer_partial): Likewise.
(rs6000_xfer_shared_libraries): Likewise.
* sol-thread.c (sol_thread_xfer_partial): Likewise.
* sparc-nat.c (sparc_xfer_wcookie): Likewise.
(sparc_xfer_partial): Likewise.
* spu-linux-nat.c (spu_proc_xfer_spu): Likewise.
(spu_xfer_partial): Likewise.
* spu-multiarch.c (spu_xfer_partial): Likewise.
* target.c (target_read_live_memory): Likewise.
(memory_xfer_live_readonly_partial): Likewise.
(memory_xfer_partial, memory_xfer_partial_1): Likewise.
(target_xfer_partial, default_xfer_partial): Likewise.
(current_xfer_partial): Likewise.
* tracepoint.c (tfile_xfer_partial): Likewise.
* windows-nat.c (windows_xfer_memory): Likewise. Call
pulongest instead of plongest.
(windows_xfer_partial): Likewise.
(windows_xfer_shared_libraries): Likewise.
Yao Qi [Fri, 3 Jan 2014 02:33:44 +0000 (10:33 +0800)]
Use target_xfer_partial_ftype for rs6000_xfer_shared_libraries
Hi,
We can use target_xfer_partial_ftype here for
rs6000_xfer_shared_libraries declaration.
gdb:
2014-01-14 Yao Qi <yao@codesourcery.com>
* rs6000-nat.c (rs6000_xfer_shared_libraries): Use
target_xfer_partial_ftype.
Vidya Praveen [Tue, 14 Jan 2014 13:09:22 +0000 (13:09 +0000)]
* lib/ld-lib.exp (default_ld_link): Remove support for ldflags.
(default_ld_simple_link): Likewise.
Nick Clifton [Tue, 14 Jan 2014 12:39:45 +0000 (12:39 +0000)]
PR gas/16434
* config/tc-z80.c (wrong_match): Provide format string to
as_warn.
(parse_exp_not_indexed): Delete unused variable dummy.
(emit_byte): Delete unused variable fixp.
Siva Chandra [Fri, 27 Dec 2013 20:20:59 +0000 (12:20 -0800)]
Use bitpos and type to lookup a gdb.Field object when its name is 'None'.
PR python/15464
PR python/16113
* valops.c (value_struct_elt_bitpos): New function
* py-type.c (convert_field): Set 'name' attribute of a gdb.Field
object to 'None' if the field name is an empty string ("").
* python/py-value.c (valpy_getitem): Use 'bitpos' and 'type'
attribute to look for a field when 'name' is 'None'.
(get_field_type): New function
testsuite/
* gdb.python/py-type.c: Enhance test case.
* gdb.python/py-value-cc.cc: Likewise
* gdb.python/py-type.exp: Add new tests.
* gdb.python/py-value-cc.exp: Likewise
Doug Evans [Tue, 14 Jan 2014 01:15:42 +0000 (17:15 -0800)]
PR symtab/16426
* dwarf2read.c (dwarf2_get_dwz_file): Call gdb_bfd_record_inclusion.
(try_open_dwop_file): Ditto.
* gdb_bfd.c: #include "vec.h".
(bfdp): New typedef.
(struct gdb_bfd_data): New member included_bfds.
(gdb_bfd_unref): Unref all included bfds.
(gdb_bfd_record_inclusion): New function.
* gdb_bfd.h (gdb_bfd_record_inclusion): Declare.
Alan Modra [Mon, 13 Jan 2014 23:00:39 +0000 (09:30 +1030)]
daily update
Tom Tromey [Mon, 30 Dec 2013 02:35:02 +0000 (19:35 -0700)]
remove obsolete declaration
deprecated_core_resize_section_table is declared but never defined.
This patch removes the stale declaration.
2014-01-13 Tom Tromey <tromey@redhat.com>
* gdbcore.h (deprecated_core_resize_section_table): Remove.
Tom Tromey [Sat, 28 Dec 2013 22:11:36 +0000 (15:11 -0700)]
remove use_windows
Nothing actually uses use_windows, not even Insight. So, this patch
removes it.
2014-01-13 Tom Tromey <tromey@redhat.com>
* defs.h (use_windows): Remove.
* gdb.c (main): Update.
* main.c (captured_main, gdb_main): Update.
* main.h (struct captured_main_args) <use_windows>: Remove.
* top.c (use_windows): Remove.
Tom Tromey [Sat, 28 Dec 2013 21:43:25 +0000 (14:43 -0700)]
remove unused deprecated_flush_hook declaration
deprecated_flush_hook is declared in defs.h but never defined.
This patch removes the stale declaration.
2014-01-13 Tom Tromey <tromey@redhat.com>
* defs.h (deprecated_flush_hook): Remove.
Jan Kratochvil [Mon, 13 Jan 2014 20:19:18 +0000 (21:19 +0100)]
Fix set auto-load safe-path false warning regression (PR 16216)
gdb/
2014-01-07 Jan Kratochvil <jan.kratochvil@redhat.com>
PR threads/16216
* linux-thread-db.c (try_thread_db_load): Add parameter
check_auto_load_safe. Move here the file_is_auto_load_safe call.
(try_thread_db_load_from_pdir_1): Move it there from here.
(try_thread_db_load_from_sdir): Update caller.
(try_thread_db_load_from_dir): Move it there from here.
Patrick Palka [Fri, 10 Jan 2014 03:55:50 +0000 (22:55 -0500)]
Have regdat.sh always rewrite the output register file
The rules for generating the output register files look like:
amd64.c : $(srcdir)/../regformats/i386/amd64.dat $(regdat_sh)
$(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/amd64.dat amd64.c
According to this rule, if regdat.sh is newer than amd64.c, then
regdat.sh shall be invoked on amd64.dat. According to regdat.sh, if the
script determines that the output file amd64.c has not changed, then it
will not overwrite the existing output file. This means that a
subsequent invocation of make will trigger the above rule again as
regdat.sh will be perpetually newer than amd64.c.
This then shows up in the make output like so:
/bin/bash ./../regformats/regdat.sh ./../regformats/i386/amd64-linux.dat amd64-linux.c
amd64-linux.c unchanged.
/bin/bash ./../regformats/regdat.sh ./../regformats/i386/amd64-avx-linux.dat amd64-avx-linux.c
amd64-avx-linux.c unchanged.
...
To fix this pathological behavior, it suffices to have regdat.sh
unconditionally rewrite the output register file.
On my machine, which has a regdat.sh file that is newer than some of the
input register files, this change speeds up every invocation of make
under gdb/ by about 5 seconds.
Pedro Alves [Mon, 13 Jan 2014 19:36:38 +0000 (19:36 +0000)]
New "make check-headers" rule.
Tries to compile each header in isolation, thus ensuring headers are
self-contained.
Defaults to checking all $HFILES_NO_SRCDIR headers.
Do:
make check-headers CHECK_HEADERS="header.h list.h"
to check specific headers.
gdb/
2014-01-13 Pedro Alves <palves@redhat.com>
* Makefile.in (CHECK_HEADERS): New variable.
(check-headers:): New rule.
Tom Tromey [Sat, 28 Dec 2013 21:56:18 +0000 (14:56 -0700)]
remove deprecated_set_hook
This removes deprecated_set_hook. Insight was the last user of this
hook, but I recently checked in a patch to have it use the
command_param_changed observer instead.
2014-01-13 Tom Tromey <tromey@redhat.com>
* cli/cli-setshow.c (do_set_command): Update.
* defs.h (deprecated_set_hook): Remove.
* top.c (deprecated_set_hook): Remove.
Eli Zaretskii [Mon, 13 Jan 2014 18:54:47 +0000 (20:54 +0200)]
Fix MinGW compilation errors in gdbserver/.
gdb/gdbserver/Makefile.in (INCLUDE_CFLAGS): Remove trailing slash from
"-I$(srcdir)/../". Fixes MinGW compilation errors with old GCC versions.
Ma Jiang [Mon, 13 Jan 2014 16:06:28 +0000 (16:06 +0000)]
2014-01-13 Ma Jiang <ma.jiang@zte.com.cn>
PR ld/16202
* elf32-arm.c (elf32_arm_final_link_relocate): Refetch addends for
R_ARM_ABS8 and R_ARM_ABS16.
Pedro Alves [Mon, 13 Jan 2014 14:56:29 +0000 (14:56 +0000)]
tfile: Don't infer the PC from the tracepoint if the PC is a pseudo-register.
This PC guessing can't work when the PC is a pseudo-register.
Pseudo-register values don't end up stored in the regcache, they're
always recomputed. And, it's actually wrong to try to write a
pseudo-register with regcache_raw_supply. Skip it and add a comment.
gdb/
2014-01-13 Pedro Alves <palves@redhat.com>
* tracepoint.c (tfile_fetch_registers): Don't infer the PC from
the tracepoint if the PC is a pseudo-register.
Tom Tromey [Sat, 28 Dec 2013 22:32:27 +0000 (15:32 -0700)]
replace XCALLOC with XCNEWVEC or XCNEW
This removes XCALLOC and replaces it either with XCNEWVEC, or, if the
number of elements being requested was 1, with XCNEW.
2014-01-13 Tom Tromey <tromey@redhat.com>
* defs.h (XCALLOC): Remove.
* bcache.c (bcache_xmalloc): Use XCNEW, not XCALLOC.
(print_bcache_statistics): Use XCNEWVEC, not XCALLOC.
* dwarf2loc.c (allocate_piece_closure): Likewise.
* elfread.c (elf_symfile_segments): Likewise.
(elf_symfile_segments): Likewise.
* gdbtypes.c (copy_type_recursive): Likewise.
* i386-tdep.c (i386_gdbarch_init): Use XCNEW, not XCALLOC.
* jit.c (jit_frame_sniffer): Use XCNEWVEC, not XCALLOC.
* minsyms.c (prim_record_minimal_symbol_full): Use XCNEW, not
XCALLOC.
* mt-tdep.c (mt_gdbarch_init): Likewise.
* opencl-lang.c (allocate_lval_closure): Use XCNEWVEC, not
XCALLOC.
* psymtab.c (psymbol_compare): Use XCNEW, not XCALLOC.
* regcache.c (regcache_xmalloc_1): Use XCNEWVEC, not XCALLOC.
* registry.c (registry_alloc_data): Likewise.
* rs6000-tdep.c (rs6000_gdbarch_init): Use XCNEW, not XCALLOC.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* serial.c (serial_fdopen_ops): Likewise.
* solib-aix.c (solib_aix_get_section_offsets): Use XCNEWVEC, not
XCALLOC.
* spu-tdep.c (spu_gdbarch_init): Use XCNEW, not XCALLOC.
* symfile.c (default_symfile_segments): Use XCNEW and XCNEWVEC,
not XCALLOC.
Tom Tromey [Sat, 28 Dec 2013 22:31:23 +0000 (15:31 -0700)]
replace XMALLOC with XNEW
This replaces XMALLOC with XNEW, and removes XMALLOC. The only
non-mechanical bit here was remembering to edit gdbarch.sh.
2014-01-13 Tom Tromey <tromey@redhat.com>
* defs.h (XMALLOC): Remove.
* avr-tdep.c (avr_gdbarch_init): Use XNEW, not XMALLOC.
* bfin-tdep.c (bfin_gdbarch_init): Likewise.
* cli-out.c (struct ui_out *): Likewise.
* cli/cli-dump.c (add_dump_command): Likewise.
(add_dump_command): Likewise.
* complaints.c (get_complaints): Likewise.
(find_complaint): Likewise.
* dwarf2-frame.c (execute_cfa_program): Likewise.
* dwarf2read.c (abbrev_table_read_table): Likewise.
* gdbarch.sh: Likewise.
* gdbarch.c: Rebuild.
* inf-ttrace.c (inf_ttrace_add_page): Likewise.
* interps.c (interp_new): Likewise.
* lm32-tdep.c (lm32_gdbarch_init): Likewise.
* m32r-tdep.c (m32r_gdbarch_init): Likewise.
* mi/mi-console.c (mi_console_file_new): Likewise.
* mi/mi-interp.c (mi_interpreter_init): Likewise.
* mi/mi-out.c (mi_out_new): Likewise.
* mi/mi-parse.c (mi_parse): Likewise.
* microblaze-tdep.c (microblaze_gdbarch_init): Likewise.
* moxie-tdep.c (moxie_gdbarch_init): Likewise.
* observer.c (xalloc_observer_list_node): Likewise.
* regcache.c (regcache_xmalloc_1): Likewise.
* reggroups.c (reggroup_new): Likewise.
(_initialize_reggroup): Likewise.
* registry.c (register_data_with_cleanup): Likewise.
* remote.c (remote_notif_stop_alloc_reply): Likewise.
* ser-base.c (serial_ttystate): Likewise.
* ser-mingw.c (make_pipe_state): Likewise.
* ser-pipe.c (pipe_open): Likewise.
* serial.c (serial_open): Likewise.
* sh64-tdep.c (sh64_gdbarch_init): Likewise.
* tui/tui-data.c (tui_alloc_generic_win_info): Likewise.
(tui_alloc_win_info): Likewise.
(tui_add_content_elements): Likewise.
* tui/tui-file.c (tui_file_new): Likewise.
* tui/tui-out.c (tui_out_new): Likewise.
* ui-file.c (mem_file_new): Likewise.
* ui-out.c (push_level): Likewise.
(make_cleanup_ui_out_end): Likewise.
(append_header_to_list): Likewise.
(ui_out_new): Likewise.
* user-regs.c (user_reg_add_builtin): Likewise.
Tom Tromey [Sat, 28 Dec 2013 22:31:01 +0000 (15:31 -0700)]
replace XZALLOC with XCNEW
This replaces XZALLOC with XCNEW and removes XZALLOC.
This change is purely mechanical.
2014-01-13 Tom Tromey <tromey@redhat.com>
* defs.h (XZALLOC): Remove.
* ada-lang.c (get_ada_inferior_data): Use XCNEW, not XZALLOC.
* ada-tasks.c (get_ada_tasks_pspace_data): Likewise.
(get_ada_tasks_inferior_data): Likewise.
* auto-load.c (get_auto_load_pspace_data): Likewise.
* auxv.c (get_auxv_inferior_data): Likewise.
* bfd-target.c (target_bfd_reopen): Likewise.
* breakpoint.c (get_catch_syscall_inferior_data): Likewise.
(deprecated_insert_raw_breakpoint): Likewise.
* bsd-uthread.c (bsd_uthread_pid_to_str): Likewise.
* corelow.c (core_open): Likewise.
* darwin-nat.c (darwin_check_new_threads): Likewise.
(darwin_attach_pid): Likewise.
* dummy-frame.c (dummy_frame_push): Likewise.
* dwarf2-frame.c (dwarf2_frame_cache): Likewise.
* dwarf2loc.c (allocate_piece_closure): Likewise.
* elfread.c (elf_symfile_segments): Likewise.
* eval.c (ptrmath_type_p): Likewise.
* exceptions.c (EXCEPTIONS_SIGJMP_BUF): Likewise.
* gdbtypes.c (alloc_type_arch): Likewise.
(alloc_type_instance): Likewise.
* hppa-tdep.c (hppa_gdbarch_init): Likewise.
* inf-child.c (inf_child_can_use_agent): Likewise.
* inflow.c (get_inflow_inferior_data): Likewise.
* infrun.c (save_infcall_suspend_state): Likewise.
* jit.c (jit_reader_load): Likewise.
(get_jit_objfile_data): Likewise.
(get_jit_program_space_data): Likewise.
(jit_object_open_impl): Likewise.
(jit_symtab_open_impl): Likewise.
(jit_block_open_impl): Likewise.
(jit_frame_sniffer): Likewise.
* linux-fork.c (add_fork): Likewise.
* maint.c (make_command_stats_cleanup): Likewise.
* objfiles.c (get_objfile_pspace_data): Likewise.
* opencl-lang.c (struct lval_closure): Likewise.
* osdata.c (osdata_start_osdata): Likewise.
* progspace.c (new_address_space): Likewise.
(add_program_space): Likewise.
* remote-sim.c (get_sim_inferior_data): Likewise.
* sh-tdep.c (sh_gdbarch_init): Likewise.
* skip.c (Ignore): Likewise.
(skip_delete_command): Likewise.
* solib-aix.c (get_solib_aix_inferior_data): Likewise.
(library_list_start_library): Likewise.
(solib_aix_current_sos): Likewise.
* solib-darwin.c (get_darwin_info): Likewise.
(darwin_current_sos): Likewise.
* solib-dsbt.c (get_dsbt_info): Likewise.
* solib-ia64-hpux.c (new_so_list): Likewise.
(ia64_hpux_get_solib_linkage_addr): Likewise.
* solib-spu.c (append_ocl_sos): Likewise.
(spu_current_sos): Likewise.
* solib-svr4.c (get_svr4_info): Likewise.
(svr4_keep_data_in_core): Likewise.
(library_list_start_library): Likewise.
(svr4_default_sos): Likewise.
(svr4_read_so_list): Likewise.
* solib-target.c (library_list_start_library): Likewise.
(solib_target_current_sos): Likewise.
* sparc-tdep.c (sparc32_gdbarch_init): Likewise.
* symfile-debug.c (install_symfile_debug_logging): Likewise.
* symfile.c (default_symfile_segments): Likewise.
* target-descriptions.c (tdesc_data_init): Likewise.
(tdesc_create_reg): Likewise.
(struct tdesc_type *): Likewise.
(tdesc_create_vector): Likewise.
(tdesc_set_struct_size): Likewise.
(struct tdesc_type *): Likewise.
(tdesc_free_feature): Likewise.
(tdesc_create_feature): Likewise.
* windows-nat.c (windows_add_thread): Likewise.
(windows_make_so): Likewise.
* xml-support.c (gdb_xml_body_text): Likewise.
(gdb_xml_create_parser_and_cleanup): Likewise.
(xml_process_xincludes): Likewise.
* xml-syscall.c (allocate_syscalls_info): Likewise.
(syscall_create_syscall_desc): Likewise.
Alan Modra [Mon, 13 Jan 2014 05:18:24 +0000 (15:48 +1030)]
missing changelog for last patch
Alan Modra [Mon, 13 Jan 2014 03:21:16 +0000 (13:51 +1030)]
Error on shared lib call to @local ifunc
On powerpc32, making ifuncs have non-default visibility in shared
libraries or pies can result in runtime failures. The problem is that
if gcc is told that a given function has non-default visibility, then
calls to that function are assumed to be local (which is true) and
thus need not go via a plt call stub (which is false for ifunc). If
the caller has no other reason to set up the got pointer (r30), code
won't be emitted to do so. However, a pic plt call stub makes use of
r30 to load the plt entry. So a call to an ifunc, which always needs
a plt entry, will fail.
This patch makes ld emit an error for the problem case, and allows
calls to non-default visibility ifuncs to work in normal executables.
I also fix some cases where ifuncs fail when using the old bss-plt.
* elf32-ppc.c (ppc_elf_check_relocs): For @local call to ifunc,
error when shared and force a plt call otherwise.
(ppc_elf_size_dynamic_sections): Don't emit DT_PPC_GOT unless
plt_type == PLT_NEW.
(ppc_elf_relocate_section): Add missing test to resolve ifuncs to
the appropriate call stub.
Alan Modra [Sun, 12 Jan 2014 23:00:37 +0000 (09:30 +1030)]
daily update
Sergio Durigan Junior [Sun, 12 Jan 2014 03:32:26 +0000 (01:32 -0200)]
Split i386_stap_parse_special_token into smaller functions
This patch reorganizes code on gdb/i386-tdep.c's SystemTap SDT probe
support functions. Before it, the code to parse special operands on x86
lived in a single, big function. This patch creates 2 new functions
that makes the code more organized and removes a few indentation levels
(which is always good IMO).
I haven't modified anything logical in the functions, i.e., there's still
one latent bug on i386_stap_parse_special_token_triplet now. I will soon
post a patch to fix this, and to also improve the readability of the two
new functions.
2014-01-12 Sergio Durigan Junior <sergiodj@redhat.com>
* i386-tdep.c (i386_stap_parse_special_token_triplet): New
function, with code from i386_stap_parse_special_token.
(i386_stap_parse_special_token_three_arg_disp): Likewise.
(i386_stap_parse_special_token): Move code to the two functions
above; simplify it.
Alan Modra [Sat, 11 Jan 2014 23:00:39 +0000 (09:30 +1030)]
daily update
Alan Modra [Fri, 10 Jan 2014 23:00:57 +0000 (09:30 +1030)]
daily update
Pedro Alves [Fri, 10 Jan 2014 15:46:59 +0000 (15:46 +0000)]
[doc] Mention that "set environment" affects the shell too.
gdb/doc/
2014-01-10 Pedro Alves <palves@redhat.com>
* gdb.texinfo (Your Program's Environment) <set environment>:
Mention the shell, and point at 'set exec-wrapper'.
Andreas Arnez [Fri, 10 Jan 2014 15:37:36 +0000 (15:37 +0000)]
Since upstream gcc has recently increased the function alignment on
S390, the dw2-dir-file-name test case fails in the first
gdb_continue_to_breakpoint. Indeed, the breakpoint is now placed into
the alignment gap *before* the actual function.
This happens because the test case declares the respective "*_start"
symbol as a "loose" label before the function definition, and the
compiler inserts the alignment between that label and the function
itself.
The "*_start" symbols were only necessary because FUNC made the
function static. The fix makes the functions extern instead, thus
making the "*_start" labels unnecessary.
testsuite/
2014-01-10 Andreas Arnez <arnez@linux.vnet.ibm.com>
Pedro Alves <palves@redhat.com>
* gdb.dwarf2/dw2-dir-file-name.c (FUNC): Remove "*_start" symbol.
Make "name" extern.
* gdb.dwarf2/dw2-dir-file-name.exp (out_cu, out_line): Replace
references to ${name}_start by references to ${name}.
Alan Modra [Fri, 10 Jan 2014 10:41:46 +0000 (21:11 +1030)]
Don't adjust LOAD segment to match GNU_RELRO segment
Instead, fix Jakub's original code setting up the PR_GNU_RELRO header
from the PT_LOAD header.
PR ld/14207
PR ld/16322
PR binutils/16323
bfd/
* elf.c (assign_file_positions_for_load_sections): Revert last change.
(assign_file_positions_for_non_load_sections): When setting up
PT_GNU_RELRO header, don't require a corresponding PT_LOAD
header that completely covers the relro region.
ld/
* ldlang.c (lang_size_sections): Remove unneeded RELRO base
adjust. Tidy comments.
* ld.texinfo (DATA_SEGMENT_RELRO_END): Correct description.
ld/testsuite/
* ld-x86-64/pr14207.d: Adjust
Joel Brobecker [Fri, 10 Jan 2014 03:54:23 +0000 (07:54 +0400)]
Remove path from gdb.ada/pp-rec-component.exp "source" test
gdb/testsuite/ChangeLog:
* gdb.ada/pp-rec-component.exp: Remove path from "source" test.