The gdb TUI is calling gdb_print_insn() (which calls
disassemble_init_powerpc()) enough to show up high in profiles. As
suggested by Alan, only initialise if the indices are empty.
opcodes/ChangeLog:
2015-03-25 Anton Blanchard <anton@samba.org>
* ppc-dis.c (disassemble_init_powerpc): Only initialise
powerpc_opcd_indices and vle_opcd_indices once.
Ensure that injection of a stub section does not break a link where
there is an xpectation that flow of control can pass from one input
section to another simply by linking the input sections in series.
The solution here is to allow stub sections to be inserted after any
input section (existing behaviour), but inject an additional branch at
the start of each stub section such that control flow falling into the
stub section will branch over the stub section.
The x86-record_goto.S assembly source file does not build on 32-bit.
This breaks many tests that use this file.
Split it into x86_64-record_goto.S and i686-record_goto.S. Luckily, we
can use either one with the same test .exp file.
It further turned out that most tests do not really need a fixed binary;
they should work pretty well with a newly-compiled C program. The
one thing that breaks this is the heavy use of "record goto" to navigate
inside the recorded execution.
Combine step.exp, next,exp, and finish.exp into a single test step.exp
and use normal stepping and reverse-stepping commands for navigation.
testsuite/
* gdb.btrace/next.exp: Merged into step.exp.
* gdb.btrace/finish.exp: Merged into step.exp.
* gdb.btrace/nexti.exp: Merged into stepi.exp.
* gdb.btrace/step.exp: Use record_goto.c as test file. Avoid using
"record goto" and checking the exact replay position.
* gdb.btrace/stepi.exp: Choose test file based on target. Do not
check for "Recording format" in "info record" output.
* gdb.btrace/record_goto.exp: Choose test file based on target.
* gdb.btrace/x86-record_goto.S: Renamed into ...
* gdb.btrace/x86_64-record_goto.S: ... this.
* gdb.btrace/i686-record_goto.S: New.
* gdb.btrace/x86-tailcall.S: Renamed into ...
* gdb.btrace/x86_64-tailcall.S: ... this.
* gdb.btrace/i686-tailcall.S: New.
* gdb.btrace/x86-tailcall.c: Renamed into ...
* gdb.btrace/tailcall.c: ... this. Split "return ++answer" into two
separate statements. Update test.
* gdb.btrace/delta.exp: Use record_goto.c as test file.
* gdb.btrace/gcore.exp: Use record_goto.c as test file.
* gdb.btrace/nohist.exp: Use record_goto.c as test file.
* gdb.btrace/tailcall.exp: Choose test file based on target.
* gdb.btrace/Makefile.in: Remove next, finish, and nexti.
The trace for throwing and catching an exception can be quite big.
Increase the buffer size to avoid spurious fails.
testsuite/
* gdb.btrace/exception.exp: Increase BTS buffer size.
gas/ChangeLog:
2015-03-25 Renlin Li <renlin.li@arm.com>
* config/tc-aarch64.c (mapping_state): Remove first MAP_DATA emitting code.
(mapping_state_2): Emit first MAP_DATA symbol here.
All callers of target_async pass it the same callback
(inferior_event_handler). Since both common code and target backends
need to be able to put the target in and out of target async mode at
any given time, there's really no way that a different callback could
be passed. This commit simplifies things, and removes the indirection
altogether. Bonus: with this, gdb's target_async method ends up with
the same signature as gdbserver's.
Tested on x86_64 Fedora 20, native and gdbserver.
gdb/ChangeLog:
2015-03-25 Pedro Alves <palves@redhat.com>
* target.h <to_async>: Replace 'callback' and 'context' parameters
with boolean 'enable' parameter.
(target_async): Replace CALLBACK and CONTEXT parameters with
boolean ENABLE parameter.
* inf-loop.c (inferior_event_handler): Adjust.
* linux-nat.c (linux_nat_attach, linux_nat_resume)
(linux_nat_resume): Adjust.
(async_client_callback, async_client_context): Delete.
(handle_target_event): Call inferior_event_handler directly.
(linux_nat_async): Replace 'callback' and 'context' parameters
with boolean 'enable' parameter. Adjust. Remove references to
async_client_callback and async_client_context.
(linux_nat_close): Adjust.
* record-btrace.c (record_btrace_async): Replace 'callback' and
'context' parameters with boolean 'enable' parameter. Adjust.
(record_btrace_resume): Adjust.
* record-full.c (record_full_async): Replace 'callback' and
'context' parameters with boolean 'enable' parameter. Adjust.
(record_full_resume, record_full_core_resume): Adjust.
* remote.c (struct remote_state) <async_client_callback,
async_client_context>: Delete fields.
(remote_start_remote, extended_remote_attach_1, remote_resume)
(extended_remote_create_inferior): Adjust.
(remote_async_serial_handler): Call inferior_event_handler
directly.
(remote_async): Replace 'callback' and 'context' parameters with
boolean 'enable' parameter. Adjust.
* top.c (gdb_readline_wrapper_cleanup, gdb_readline_wrapper):
Adjust.
* target-delegates.c: Regenerate.
Various target_fileio_* functions use integer file descriptors to
refer to open files. File operation functions are looked up from
the target stack as they are used, which causes problems if the
target stack changes after the file is opened.
For example, if a file is opened on a remote target and the remote
target disconnects or closes the remote target will be popped off
the stack. If target_fileio_close is then called on that file and
"set auto-connect-native-target" is "on" (the default) then the
native target's close method will be called. If the file opened
on the remote happens to share the same number with a file open in
GDB then that file will be closed by mistake.
This commit changes target_fileio_open to store newly opened file
descriptors in a table together with the target_ops used to open
them. The index into the table is returned and used as the file
descriptor argument to all target_fileio_* functions that accept
file descriptor arguments.
gdb/ChangeLog:
* target.c (fileio_ft_t): New typedef, define object vector.
(fileio_fhandles): New static variable.
(is_closed_fileio_fh): New macro.
(lowest_closed_fd): New static variable.
(acquire_fileio_fd): New function.
(release_fileio_fd): Likewise.
(fileio_fd_to_fh): New macro.
(target_fileio_open): Wrap the file descriptor on success.
(target_fileio_pwrite): Updated to use wrapped file descriptor.
(target_fileio_pread): Likewise.
(target_fileio_close): Likewise.
I noticed that _bfd_elf_gc_mark_extra_sections attempts to unmark
related debug sections when it finds an unmarked code section.
When it finds .text.foo is unmarked, for example, it removes
.debug_line.text.foo as well (using the section name as a suffix
match check.
However, it bails out after finding one such section.
bfd/
* elflink.c (_bfd_elf_gc_mark_extra_sections): Don't break on
first matching debug section.
ld/testsuite/
* ld-gc/all-debug-sections.d: New file.
* ld-gc/all-debug-sections.s: Likewise.
* ld-gc/gc.exp: Execute new testcase.
No need to write the zlib header if compression didn't make the section
smaller.
PR gas/18087
* write.c (compress_debug): Don't write the zlib header if
compression didn't make the section smaller.
I noticed that "thread apply all" sometimes crashes.
The problem is that thread_apply_all_command doesn take exited threads
into account, and we qsort and then walk more elements than there
really ever were put in the array. Valgrind shows:
The current thread <Thread ID 3> has terminated. See `help thread'.
(gdb) thread apply all p 1
Thread 1 (Thread 0x7ffff7fc2740 (LWP 29579)):
$1 = 1
==29576== Use of uninitialised value of size 8
==29576== at 0x639CA8: set_thread_refcount (thread.c:1337)
==29576== by 0x5C2C7B: do_my_cleanups (cleanups.c:155)
==29576== by 0x5C2CE8: do_cleanups (cleanups.c:177)
==29576== by 0x63A191: thread_apply_all_command (thread.c:1477)
==29576== by 0x50374D: do_cfunc (cli-decode.c:105)
==29576== by 0x506865: cmd_func (cli-decode.c:1893)
==29576== by 0x7562CB: execute_command (top.c:476)
==29576== by 0x647DA4: command_handler (event-top.c:494)
==29576== by 0x648367: command_line_handler (event-top.c:692)
==29576== by 0x7BF7C9: rl_callback_read_char (callback.c:220)
==29576== by 0x64784C: rl_callback_read_char_wrapper (event-top.c:171)
==29576== by 0x647CB5: stdin_event_handler (event-top.c:432)
==29576==
...
This can happen easily today as linux-nat.c/linux-thread-db.c are
forgetting to purge non-current exited threads. But even with that
fixed, we can always do "thread apply all" with an exited thread
selected, which won't be deleted until the user switches to another
thread. That's what the test added by this commit exercises.
Tested on x86_64 Fedora 20.
gdb/ChangeLog:
2015-03-24 Pedro Alves <palves@redhat.com>
* thread.c (thread_apply_all_command): Take exited threads into
account.
gdb/testsuite/ChangeLog:
2015-03-24 Pedro Alves <palves@redhat.com>
* gdb.threads/no-unwaited-for-left.exp: Test "thread apply all".
No need to write the zlib header if compression didn't make the section
smaller.
PR binutils/18087
* compress.c (bfd_compress_section_contents): Don't write the
zlib header and set contents as well as compress_status if
compression didn't make the section smaller.
(bfd_init_section_compress_status): Don't check compression
size here.
... and move comment to declaration.
gdb/ChangeLog:
2015-03-24 Pedro Alves <palves@redhat.com>
* infrun.c (user_visible_resume_ptid): Rewrite going from
most-locked to unlocked instead of the opposite. Move comment ...
* infrun.h (user_visible_resume_ptid): ... here.
This adds/tweaks a few debug logs I found useful recently.
gdb/gdbserver/ChangeLog:
2015-03-24 Pedro Alves <palves@redhat.com>
* linux-low.c (check_stopped_by_breakpoint): Tweak debug log
output. Also dump TRAP_TRACE.
(linux_low_filter_event): In debug output, distinguish a
resume_stop SIGSTOP from a delayed SIGSTOP.
gdb/ChangeLog:
2015-03-24 Pedro Alves <palves@redhat.com>
* linux-nat.c (linux_nat_resume): Output debug logs before trying
to resume the event lwp. Use the lwp's ptid instead of the passed
in (maybe wildcard) ptid.
(stop_wait_callback): Tweak debug log output.
(check_stopped_by_breakpoint): Tweak debug log output. Also dump
TRAP_TRACE.
(linux_nat_filter_event): In debug output, distinguish a
resume_stop SIGSTOP from a delayed SIGSTOP. Output debug logs
before trying to resume the lwp.
struct dynamic_prop_list is declared as follow:
struct dynamic_prop_list
{
[...]
/* The dynamic property itself. */
struct dynamic_prop *prop;
[...]
};
In this case, the pointer indirection is unnecessary and costing us,
for each dynamic property, the memory needed to store one pointer.
This patch removes this pointer indirection, savin us a tiny bit of
memory, as well as reduces a bit the complexity by removing the need
to allocate memory for the property, as the allocation is now part
of the struct itself.
gdb/ChangeLog:
* gdbtypes.h (struct dynamic_prop_list) <prop>: Remove
pointer indirection.
* gdbtypes.c (get_dyn_prop): Adjust, following change above.
(add_dyn_prop, copy_dynamic_prop_list): Likewise.
Tested on x86_64-linux.
The terminology we've been using is (dynamic) "property" rather than
"attribute", so this patch renames an enum to use the same terminology.
No behavior change.
gdb/ChangeLog:
* gdbtypes.h (enum dynamic_prop_node_kind) <DYN_PROP_DATA_LOCATION>:
Renames DYN_ATTR_DATA_LOCATION.
(TYPE_DATA_LOCATION): Use DYN_PROP_DATA_LOCATION instead of
DYN_ATTR_DATA_LOCATION.
* dwarf2read.c (set_die_type): Use DYN_PROP_DATA_LOCATION
instead of DYN_ATTR_DATA_LOCATION.
Tested on x86_64-linux.
The "step" parameters of 'proceed' and 'resume' aren't really useful
as indication of whether run control wants to single-step the target,
as that information must already be retrievable from
currently_stepping. In fact, if currently_stepping disagrees with
whether we single-stepped the target, then things break. Thus instead
of having the same information in two places, this patch removes those
parameters.
Setting 'step_start_function' is the only user of proceed's 'step'
argument, other than passing the 'step' argument down to 'resume' and
debug log output. Move that instead to set_step_frame, where we
already set other related fields.
clear_proceed_status keeps its "step" parameter for now because it
needs to know which set of threads should have their state cleared,
and is called before the "stepping_command" flag is set.
Tested on x86_64 Fedora 20, native and gdbserver.
gdb/ChangeLog:
2015-03-24 Pedro Alves <palves@redhat.com>
* breakpoint.c (until_break_command): Adjust call to proceed.
* gdbthread.h (struct thread_control_state) <stepping_command>:
New field.
* infcall.c (run_inferior_call): Adjust call to proceed.
* infcmd.c (run_command_1, proceed_thread_callback, continue_1):
Adjust calls to proceed.
(set_step_frame): Set the current thread's step_start_function
here.
(step_once): Adjust calls to proceed.
(jump_command, signal_command, until_next_command)
(finish_backward, finish_forward, proceed_after_attach_callback)
(attach_command_post_wait): Adjust calls to proceed.
* infrun.c (proceed_after_vfork_done): Adjust call to proceed.
(do_target_resume): New function, factored out from ...
(resume): ... here. Remove 'step' parameter. Instead, check
currently_stepping to determine whether the thread should be
single-stepped.
(proceed): Remove 'step' parameter and don't set the thread's
step_start_function here. Adjust call to 'resume'.
(handle_inferior_event): Adjust calls to 'resume'.
(switch_back_to_stepped_thread): Use do_target_resume instead of
'resume'.
(keep_going): Adjust calls to 'resume'.
* infrun.h (proceed): Remove 'step' parameter.
(resume): Likewise.
* windows-nat.c (do_initial_windows_stuff): Adjust call to
'resume'.
* mi/mi-main.c (proceed_thread): Adjust call to 'proceed'.
Currently, "set scheduler-locking step" is a bit odd. The manual
documents it as being optimized for stepping, so that focus of
debugging does not change unexpectedly, but then it says that
sometimes other threads may run, and thus focus may indeed change
unexpectedly... A user can then be excused to get confused and wonder
why does GDB behave like this.
I don't think a user should have to know about details of how "next"
or whatever other run control command is implemented internally to
understand when does the "scheduler-locking step" setting take effect.
This patch completes a transition that the code has been moving
towards for a while. It makes "set scheduler-locking step" hold
threads depending on whether the _command_ the user entered was a
stepping command [step/stepi/next/nexti], or not.
Before, GDB could end up locking threads even on "continue" if for
some reason run control decides a thread needs to be single stepped
(e.g., for a software watchpoint).
After, if a "continue" happens to need to single-step for some reason,
we won't lock threads (unless when stepping over a breakpoint,
naturally). And if a stepping command wants to continue a thread for
bit, like when skipping a function to a step-resume breakpoint, we'll
still lock threads, so focus of debugging doesn't change.
In order to make this work, we need to record in the thread structure
whether what set it running was a stepping command.
(A follow up patch will remove the "step" parameters of 'proceed' and 'resume')
FWIW, Fedora GDB, which defaults to "scheduler-locking step" (mainline
defaults to "off") carries a different patch that goes in this
direction as well.
Tested on x86_64 Fedora 20, native and gdbserver.
gdb/ChangeLog:
2015-03-24 Pedro Alves <palves@redhat.com>
* gdbthread.h (struct thread_control_state) <stepping_command>:
New field.
* infcmd.c (step_once): Pass step=1 to clear_proceed_status. Set
the thread's stepping_command field.
* infrun.c (resume): Check the thread's stepping_command flag to
determine which threads should be resumed. Rename 'entry_step'
local to user_step.
(clear_proceed_status_thread): Clear 'stepping_command'.
(schedlock_applies): Change parameter type to struct thread_info
pointer. Adjust.
(find_thread_needs_step_over): Remove 'step' parameter. Adjust.
(switch_back_to_stepped_thread): Adjust calls to
'schedlock_applies'.
(_initialize_infrun): Adjust "set scheduler-locking step" help.
gdb/testsuite/ChangeLog:
2015-03-24 Pedro Alves <palves@redhat.com>
* gdb.threads/schedlock.exp (test_step): No longer expect that
"set scheduler-locking step" with "next" over a function call runs
threads unlocked.
gdb/doc/ChangeLog:
2015-03-24 Pedro Alves <palves@redhat.com>
* gdb.texinfo (test_step) <set scheduler-locking step>: No longer
mention that threads may sometimes run unlocked.
I noticed that step_start_function is still a global, while it
obviously should be a per-thread field.
gdb/ChangeLog:
2015-03-24 Pedro Alves <palves@redhat.com>
* infrun.c (step_start_function): Delete and ...
* gdbthread.h (struct thread_control_state) <step_start_function>:
... now a field here.
* infrun.c (clear_proceed_status_thread): Clear the thread's
step_start_function.
(proceed, process_event_stop_test, print_stop_event): Adjust.
Nothing ever passes a negative 'step' to proceed.
Gets rid of one of the few remaining stop_after_trap references.
gdb/ChangeLog
2015-03-24 Pedro Alves <palves@redhat.com>
* infrun.c (proceed): No longer handle negative step.
Change the behaviour of section_group[] such that .stub_sec points to
the stub section attached to the indexed section rather than the stub
section attached to the link_section pointed to be the index section.
This provides a mechanism to get to the stub section following any
input section. While still allowing the section grouping mechanism to
find the section group stub section associated with an input section
by first following the link_sec pointer.
This commit moves two identical functions from gdb/x86-linux-nat.c and
gdb/gdbserver/linux-x86-low.c into the shared file gdb/nat/x86-linux.c.
gdb/ChangeLog:
* nat/x86-linux.h (x86_linux_new_thread): New declaration.
(x86_linux_prepare_to_resume): Likewise.
* x86-linux-nat.c (x86_linux_new_thread):
Moved to nat/x86-linux.c.
(x86_linux_prepare_to_resume): Likewise.
* nat/x86-linux.c (x86_linux_new_thread): New function.
(x86_linux_prepare_to_resume): Likewise.
gdb/gdbserver/ChangeLog:
* linux-x86-low.c (x86_linux_new_thread): Moved to
nat/x86-linux.c.
(x86_linux_prepare_to_resume): Likewise.
This commit moves the entire body of both GDB's and gdbserver's
x86_linux_prepare_to_resume functions into new functions,
x86_linux_update_debug_registers. This reorganisation allows
all Linux x86 low-level debug register code to be placed in one
shared file, separate from general Linux x86 shared code.
gdb/ChangeLog:
* x86-linux-nat.c (x86_linux_update_debug_registers):
New function, factored out from...
(x86_linux_prepare_to_resume): ...this.
gdb/gdbserver/ChangeLog:
* linux-x86-low.c (x86_linux_update_debug_registers):
New function, factored out from...
(x86_linux_prepare_to_resume): ...this.
This commit makes several small changes to the low-level debug
register code for Linux x86, making the code in the GDB and
gdbserver implementations identical.
gdb/ChangeLog:
* x86-linux-nat.c (x86_linux_dr_set_addr): Update assertion.
(x86_linux_new_thread): Rename argument.
gdb/gdbserver/ChangeLog:
* linux-x86-low.c (x86_linux_dr_get): Add assertion.
Use perror_with_name. Pass string through gettext.
(x86_linux_dr_set): Likewise.
This commit renames gdbserver's low-level Linux x86 debug register
accessors to the same names used by GDB.
gdb/gdbserver/ChangeLog:
* linux-x86-low.c (x86_dr_low_set_addr): Rename to...
(x86_linux_dr_set_addr): ...this.
(x86_dr_low_get_addr): Rename to...
(x86_linux_dr_get_addr): ...this.
(x86_dr_low_set_control): Rename to...
(x86_linux_dr_set_control): ...this.
(x86_dr_low_get_control): Rename to...
(x86_linux_dr_get_control): ...this.
(x86_dr_low_get_status): Rename to...
(x86_linux_dr_get_status): ...this.
(x86_dr_low): Update with new function names.
This commit moves the code to handle lwp_info.arch_private for
Linux x86 into a new shared file, nat/x86-linux.c.
gdb/ChangeLog:
* nat/x86-linux.h: New file.
* nat/x86-linux.c: Likewise.
* Makefile.in (HFILES_NO_SRCDIR): Add nat/x86-linux.h.
(x86-linux.o): New rule.
* config/i386/linux.mh (NATDEPFILES): Add x86-linux.o.
* config/i386/linux64.mh (NATDEPFILES): Likewise.
* nat/linux-nat.h (struct arch_lwp_info): New forward declaration.
(lwp_set_arch_private_info): New declaration.
(lwp_arch_private_info): Likewise.
* linux-nat.c (lwp_set_arch_private_info): New function.
(lwp_arch_private_info): Likewise.
* x86-linux-nat.c: Include nat/x86-linux.h.
(arch_lwp_info): Removed structure.
(update_debug_registers_callback):
Use lwp_set_debug_registers_changed.
(x86_linux_prepare_to_resume): Use lwp_debug_registers_changed
and lwp_set_debug_registers_changed.
(x86_linux_new_thread): Use lwp_set_debug_registers_changed.
gdb/gdbserver/ChangeLog:
* Makefile.in (x86-linux.o): New rule.
* configure.srv: Add x86-linux.o to relevant targets.
* linux-low.c (lwp_set_arch_private_info): New function.
(lwp_arch_private_info): Likewise.
* linux-x86-low.c: Include nat/x86-linux.h.
(arch_lwp_info): Removed structure.
(update_debug_registers_callback):
Use lwp_set_debug_registers_changed.
(x86_linux_prepare_to_resume): Use lwp_debug_registers_changed
and lwp_set_debug_registers_changed.
(x86_linux_new_thread): Use lwp_set_debug_registers_changed.
This commit changes the signature of linux_target_ops.new_thread in
gdbserver to match that used in GDB's equivalent.
gdb/gdbserver/ChangeLog:
* linux-low.h (linux_target_ops) <new_thread>: Changed signature.
* linux-arm-low.c (arm_new_thread): Likewise.
* linux-aarch64-low.c (aarch64_linux_new_thread): Likewise.
* linux-mips-low.c (mips_linux_new_thread): Likewise.
* linux-x86-low.c (x86_linux_new_thread): Likewise.
* linux-low.c (add_lwp): Update the_low_target.new_thread call.
This commit introduces three accessors that shared Linux code can
use to access fields of struct lwp_info. The GDB and gdbserver
Linux x86 code is modified to use them.
gdb/ChangeLog:
* nat/linux-nat.h (ptid_of_lwp): New declaration.
(lwp_is_stopped): Likewise.
(lwp_stop_reason): Likewise.
* linux-nat.c (ptid_of_lwp): New function.
(lwp_is_stopped): Likewise.
(lwp_is_stopped_by_watchpoint): Likewise.
* x86-linux-nat.c (update_debug_registers_callback):
Use lwp_is_stopped.
(x86_linux_prepare_to_resume): Use ptid_of_lwp and
lwp_stop_reason.
gdb/gdbserver/ChangeLog:
* linux-low.c (ptid_of_lwp): New function.
(lwp_is_stopped): Likewise.
(lwp_stop_reason): Likewise.
* linux-x86-low.c (update_debug_registers_callback):
Use lwp_is_stopped.
(x86_linux_prepare_to_resume): Use ptid_of_lwp and
lwp_stop_reason.
Both GDB and gdbserver had linux_stop_lwp functions with identical
declarations. This commit moves these to nat/linux-nat.h to allow
shared code to use the function.
gdb/ChangeLog:
* linux-nat.h (linux_stop_lwp): Move declaration to...
* nat/linux-nat.h (linux_stop_lwp): New declaration.
gdb/gdbserver/ChangeLog:
* linux-low.h (linux_stop_lwp): Remove declaration.
This commit introduces a new function, iterate_over_lwps, that
shared Linux code can use to call a function for each LWP that
matches certain criteria. This function already existed in GDB
and was in use by GDB's various low-level Linux x86 debug register
setters. An equivalent was written for gdbserver and gdbserver's
low-level Linux x86 debug register setters were modified to use
it.
gdb/ChangeLog:
* linux-nat.h: Include nat/linux-nat.h.
(iterate_over_lwps): Move declaration to nat/linux-nat.h.
* nat/linux-nat.h (struct lwp_info): New forward declaration.
(iterate_over_lwps_ftype): New typedef.
(iterate_over_lwps): New declaration.
* linux-nat.h (iterate_over_lwps): Update comment. Use
iterate_over_lwps_ftype. Update callback return value check.
gdb/gdbserver/ChangeLog:
* linux-low.h: Include nat/linux-nat.h.
* linux-low.c (iterate_over_lwps_args): New structure.
(iterate_over_lwps_filter): New function.
(iterate_over_lwps): Likewise.
* linux-x86-low.c (update_debug_registers_callback):
Update signature to what iterate_over_lwps expects.
Remove PID check that iterate_over_lwps now performs.
(x86_dr_low_set_addr): Use iterate_over_lwps.
(x86_dr_low_set_control): Likewise.
This commit introduces a new function, x86_debug_reg_state, that
shared x86 code can use to access the local mirror of a process's
debug registers. This function already existed in GDB and was
in use by GDB's x86_linux_prepare_to_resume. An equivalent was
written for gdbserver and gdbserver's x86_linux_prepare_to_resume
was modified to use it.
gdb/ChangeLog:
* x86-nat.h (x86_debug_reg_state): Move declaration to...
* nat/x86-dregs.h (x86_debug_reg_state): New declaration.
gdb/gdbserver/ChangeLog:
* linux-x86-low.c (x86_debug_reg_state): New function.
(x86_linux_prepare_to_resume): Use the above.
This commit introduces a new function, current_lwp_ptid, that
shared Linux code can use to obtain the ptid of the current
lightweight process.
gdb/ChangeLog:
* nat/linux-nat.h (current_lwp_ptid): New declaration.
* linux-nat.c (current_lwp_ptid): New function.
* x86-linux-nat.c: Include nat/linux-nat.h.
(x86_linux_dr_get_addr): Use current_lwp_ptid.
(x86_linux_dr_get_control): Likewise.
(x86_linux_dr_get_status): Likewise.
(x86_linux_dr_set_control): Likewise.
(x86_linux_dr_set_addr): Likewise.
gdb/gdbserver/ChangeLog:
* linux-low.c (current_lwp_ptid): New function.
* linux-x86-low.c: Include nat/linux-nat.h.
(x86_dr_low_get_addr): Use current_lwp_ptid.
(x86_dr_low_get_control): Likewise.
(x86_dr_low_get_status): Likewise.
When setting a pending breakpoint with a thread condition while using
the mi interface, the thread condition would be lost by gdb when the breakpoint
was resolved.
This patch fixes this behavior by setting the thread condition properly in the
mi case.
Also, this patch modifies the mi-pending test case to test for this issue and
removes some unneeded code in the testcase and dependency on stdio.
gdb/Changelog:
PR breakpoints/16466
* breakpoint.c (create_breakpoint): Set thread on breakpoint struct.
gdb/testsuite/ChangeLog:
PR breakpoints/16466
* gdb.mi/Makefile.in: Add mi-pendshr2.sl to cleanup.
* gdb.mi/mi-pending.c (thread_func): New function.
(int main): Add threading support required.
* gdb.mi/mi-pending.exp: Add tests for this issue.
* gdb.mi/mi-pendshr.c (pendfunc1): Remove stdio dependency.
(pendfunc2): Remove stdio dependency.
* gdb.mi/mi-pendshr2.c: New file.
This patch recognizes that we only need to perform one scan for the
835769 errata and that this scan can take place before we insert
branch stubs. The erratum scan code is relocated and adjusted to
create stub entries directly rather than populating an intermediate
representation. Since stub entries are created immediately we can
drop the adhoc stub size adjustment code and allow the generic stub
sizing code to deal with 835769 stub entries.
This patch restructures the code but does not change the workaround
used to deal with erratum 83679, the exact placement of workaround
stubs in the final image may change slightly after this patch due to
stubs being created in a different order.
* elf64-ppc.c (ppc64_elf_relocate_section): Report overflow to
stubs, even those for undefined weak symbols. Otherwise, don't
report relocation overflow on branches to undefined strong
symbols. Fix memory leak.
* elf32-ppc.c (ppc_elf_relocate_section): Don't report relocation
overflow on branches to undefined strong symbols.
The previous profile change broke these sims that use sim-profile but
not sim-cpu (due to missing model support). Add simple funcs until we
can convert these over properly.
If ignoring unresolved symbols, ignore reloc overflows too. If not
ignoring unresolved symbols we will report an error about the symbol
being undefined, making any report about reloc overflow superfluous.
PR18147
* powerpc.cc (Target_powerpc::Relocate::relocate): Don't report
relocation errors for branches to strong undefined symbols.
The profile code was using STATE_WATCHPOINTS to get access to the PC, but
we already have a standard method for getting the pc, so switch to that.
This assumes that sizeof_pc is the same size as sim_cia, but we already
assume this in places by way of sim_pc_{get,set}, and this is how it's
documented in the sim-base.h API.