aboutsummaryrefslogtreecommitdiff
path: root/gdb
AgeCommit message (Collapse)AuthorFilesLines
2014-01-17Move ASSERT_FUNCTION to FUNCTION_NAME.Doug Evans5-22/+35
* common/common-utils.h (FUNCTION_NAME): Renamed from ASSERT_FUNCTION, and moved here ... * common/gdb_assert.h (ASSERT_FUNCTION): ... from here. #include "common-utils.h". (gdb_assert, gdb_assert_fail, gdb_assert_not_reached): Update. * common/vec.h (VEC_ASSERT_PASS): Update. * darwin-nat.h: Replace #include of gdb_assert.h with common-utils.h. (MACH_CHECK_ERROR): Update.
2014-01-17Fix PR mention in gdb/gdbserver/ChangeLog's previous change.Pedro Alves1-1/+1
2014-01-17Fix silly ChangeLog entry in previous change.Pedro Alves1-2/+2
2014-01-17Fix PR PR16445 - gdbserver build failure on x86.Pedro Alves2-1/+12
If gdb_proc_service.h ends up including linux/elf.h, we'll trip on duplicate definitions: In file included from ../../../gdb/gdbserver/linux-x86-low.c:29:0: ../../../gdb/gdbserver/../../include/elf/common.h:36:0: error: "ELFMAG0" redefined [-Werror] ... etc ... Handle this the same way linux-low.c and linux-arm-low.c handle this. gdb/gdbserver/ 2014-01-17 Pedro Alves <palves@redhat.com> PR PR16445 * linux-x86-low.c (linux-x86-low.c): Don't include elf/common.h if ELFMAG0 is defined after including gdb_proc_service.h.
2014-01-17Add comments to gdbarch_address_class_name_to_type_flags.Simon Marchi3-0/+14
gdb/ChangeLog 2014-01-17 Simon Marchi <simon.marchi@ericsson.com> * gdbarch.sh (gdbarch_address_class_name_to_type_flags): Add comments. * gdbarch.h: Regenerate.
2014-01-16 * dll.c (UNSPECIFIED_CORE_ADDR): New macro.Doug Evans2-1/+9
(match_dll): Use it.
2014-01-16rearrange struct value to save memoryTom Tromey2-3/+7
This patch rearranges struct value a tiny bit, moving the "regnum" field into a hole. This saves 8 bytes per value on a 64-bit machine, and 4 bytes per value on a 32 bit machine. I think it does not negatively affect readability or performance. Built and regtested on x86-64 Fedora 18. 2014-01-16 Tom Tromey <tromey@redhat.com> * value.c (struct value) <regnum>: Move earlier.
2014-01-16remove extended_remote_create_inferior_1Tom Tromey2-10/+9
I noticed that extended_remote_create_inferior_1 is called from a single spot. This patch unifies the callee and caller. It's just a simple cleanup that made the coming refactoring simpler. 2014-01-16 Tom Tromey <tromey@redhat.com> * remote.c (extended_remote_create_inferior): Rename from extended_remote_create_inferior_1. Add "ops" argument. Remove old implementation.
2014-01-16Fix gdb.trace/mi-traceframe-changed.exp on s390.Pedro Alves2-4/+17
The test fails on s390 with: -trace-find frame-number 0^M &"PC not available\n"^M ^done,found="1",tracepoint="1",traceframe="0",frame={level="-1",addr="<unavailable>",func="??",args=[]}^M (gdb) ^M FAIL: gdb.trace/mi-traceframe-changed.exp: tfile: -trace-find frame-number 0 tfile knows to infer the PC from the tracepoint's address if the PC wasn't collected (tfile_fetch_registers) but, that only works on targets whose PC register is a raw register, and on s390, the PC register is a pseudo register. But even if GDB doesn't know how to infer the value of PC, saying the current frame is level -1 is a bug: ^done,found="1",tracepoint="1",traceframe="0",frame={level="-1",addr="<unavailable>",func="??",args=[]}^M ^^^^^^^^^ '-1' is the level of the sentinel frame, which should never be visible. This is caused by the s390's heuristic unwinder accepting the frame (the fallback heuristic unwinders _always_ accept the frame), but then the unwind->this_id method throws that "PC not available\n" error. IOW, the s390's heuristic unwinder was never adjusted to handle unavailable register values gracefully, which can happen with e.g., a trimmed core file too. This is just the minimal necessary for <unavailable> frames, which at least gets us: (gdb) tfind Found trace frame 0, tracepoint 1 #0 <unavailable> in ?? () That is, frame #0 instead of -1. We could get better info out of "info frame" (this patch makes us show "outermost"), but this change would still be necessary. gdb/ 2014-01-16 Pedro Alves <palves@redhat.com> * s390-linux-tdep.c (s390_frame_unwind_cache): Swallow NOT_AVAILABLE_ERROR errors while parsing the prologue or reading the backchain.
2014-01-16dwarf2read.c (open_and_init_dwp_file): Fix typo in comment.Doug Evans2-1/+5
2014-01-16record-btrace: add (reverse-)stepping supportMarkus Metzger22-42/+1279
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.
2014-01-16target: allow decr_pc_after_break to be defined by the targetMarkus Metzger9-13/+68
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.
2014-01-16record-btrace: show trace from enable locationMarkus Metzger12-118/+260
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.
2014-01-16btrace, gdbserver: read branch trace incrementallyMarkus Metzger16-91/+370
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.
2014-01-16record-btrace: extend unwinderMarkus Metzger9-10/+352
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.
2014-01-16record-btrace: add record goto target methodsMarkus Metzger8-5/+714
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.
2014-01-16record-btrace: provide target_find_new_threads methodMarkus Metzger2-0/+44
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.
2014-01-16record-btrace: add to_wait and to_resume target methods.Markus Metzger2-0/+47
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.
2014-01-16record-btrace: provide xfer_partial target methodMarkus Metzger3-0/+125
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.
2014-01-16target, breakpoint: allow insert/remove breakpoint to be forwardedMarkus Metzger12-50/+173
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.
2014-01-16record-btrace, frame: supply target-specific unwinderMarkus Metzger2-0/+74
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.
2014-01-16frame: do not assume unwinding will succeedMarkus Metzger2-6/+8
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.
2014-01-16frame, cfa: check unwind stop reason firstMarkus Metzger2-4/+9
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.
2014-01-16frame, backtrace: allow targets to supply a frame unwinderMarkus Metzger4-28/+109
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.
2014-01-16record-btrace: supply register target methodsMarkus Metzger2-0/+99
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.
2014-01-16Add target_ops argument to to_prepare_to_storeMarkus Metzger14-22/+50
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.
2014-01-16btrace: add replay position to btrace thread infoMarkus Metzger4-8/+100
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.
2014-01-16record-btrace: make ranges include begin and endMarkus Metzger9-20/+62
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.
2014-01-16record-btrace: optionally indent function call historyMarkus Metzger18-40/+771
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.
2014-01-16btrace: increase buffer sizeMarkus Metzger2-10/+19
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.
2014-01-16record-btrace: start counting at oneMarkus Metzger7-114/+137
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.
2014-01-16record-btrace: fix insn range in function call historyMarkus Metzger2-2/+10
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].
2014-01-16btrace: change branch trace data structureMarkus Metzger7-398/+1448
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.
2014-01-16frame: add frame_id_build_unavailable_stack_specialMarkus Metzger3-0/+29
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.
2014-01-16gdbarch: add instruction predicate methodsMarkus Metzger8-0/+262
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.
2014-01-16btrace: uppercase btrace_read_typeMarkus Metzger6-8/+16
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.
2014-01-16btrace, linux: fix memory leak when reading branch traceMarkus Metzger2-0/+8
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.
2014-01-16btrace, test: fix multi-line btrace testsMarkus Metzger3-159/+150
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.
2014-01-16test, btrace: update expected textMarkus Metzger2-3/+7
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.
2014-01-16Fix testsuite/gdb.dwarf2/dw2-dos-drive.exp on ARM.Omair Javaid2-1/+7
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.
2014-01-15delete thread_id_to_gdb_id, unusedDoug Evans3-16/+5
* inferiors.c (thread_id_to_gdb_id): Delete. * inferiors.h (thread_id_to_gdb_id): Delete.
2014-01-15AArch64: gdb.base/float.exp: Fix `info float' testMaciej W. Rozycki2-1/+7
* gdb.base/float.exp: Handle "aarch64*-*-*" targets.
2014-01-15* dwarf2read.c (open_and_init_dwp_file): Use pulongest to print uint32_t.Doug Evans2-4/+11
2014-01-15move the "main" data into the per-BFD objectTom Tromey7-4/+68
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.
2014-01-15move main name into the progspaceTom Tromey2-11/+81
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.
2014-01-15make language_of_main staticTom Tromey6-22/+37
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.
2014-01-15move the entry point info into the per-bfd objectTom Tromey4-18/+36
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.
2014-01-15relocate the entry point address when usedTom Tromey4-18/+38
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.
2014-01-15change solib-frv to use entry_point_address_queryTom Tromey2-5/+8
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.
2014-01-15gdb: Add a NEWS entry for ARM record/replay improvementsOmair Javaid2-0/+9
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.