Some btrace tests use assembly source files. They use the target triplet to
distinguish between x86_64 and ia32 ISA. This does not work for -m32 tests
without setting the target triplet to i686-?-?.
Instead use is_amd64_regs_target to distinguish between x86_64 and ia32 ISA.
See also https://sourceware.org/ml/gdb-patches/2016-07/msg00256.html.
testsuite/
* gdb.btrace/record_goto.exp: Use is_amd64_regs_target for selecting
assembly source files.
* gdb.btrace/stepi.exp: Use is_amd64_regs_target for selecting
assembly source files.
* gdb.btrace/tailcall.exp: Use is_amd64_regs_target for selecting
assembly source files.
* gdb.btrace/tailcall-only.exp: Use is_amd64_regs_target for selecting
assembly source files.
When a bad interpreter name is passed to new-ui, such as:
(gdb) new-ui bloop /dev/pts/10
A partially created UI is left in the UI list, with interp set to NULL.
Trying to do anything that will print on this UI (such as "start") will
cause a segmentation fault.
Changes in v2:
- Use with_test_prefix to namespace test procedures
- Give an explicit stable test name
- Add a "bad terminal path" test
- Remove useless runto_main
- Add missing intro comments
I did not factor out the pty spawn, as there is some magic involved I
don't quite understand. But it wouldn't bring that much anyway.
gdb/ChangeLog:
* top.h (make_delete_ui_cleanup): New declaration.
* top.c (delete_ui_cleanup): New function.
(make_delete_ui_cleanup): New function.
(new_ui_command): Create restore_ui cleanup earlier, create a
delete_ui cleanup and discard it on success.
gdb/testsuite/ChangeLog:
* gdb.base/new-ui.exp (do_test_invalid_args): New
procedure.
Since Linux 2.6.33, /proc/PID/status shows "t (tracing stop)", with
lowercase 't'. Because GDB is only expecting "T (tracing stop)", GDB
can incorrectly suppress errors in check_ptrace_stopped_lwp_gone:
1578 if (!check_ptrace_stopped_lwp_gone (lp))
1579 throw_exception (ex);
Ref: https://sourceware.org/ml/gdb-patches/2016-06/msg00072.html
2016-07-25 Pedro Alves <palves@redhat.com>
Jan Kratochvil <jan.kratochvil@redhat.com>
* nat/linux-procfs.c (parse_proc_status_state): Handle lowercase
't'.
Parse the process's /proc/PID/status state into an enum instead of the
current scheme of passing state strings around.
gdb/ChangeLog:
2016-07-25 Pedro Alves <palves@redhat.com>
* nat/linux-procfs.c (enum proc_state): New enum.
(parse_proc_status_state): New function.
(linux_proc_pid_get_state): Replace output string buffer parameter
with an output proc_state parameter. Use parse_proc_status_state.
(linux_proc_pid_is_gone): Adjust to use proc_state values.
(linux_proc_pid_has_state): Change type of 'state' parameter; now
an enum proc_state. Adjust to linux_proc_pid_get_state interface
change.
(linux_proc_pid_is_stopped)
(linux_proc_pid_is_trace_stopped_nowarn)
(linux_proc_pid_is_zombie_maybe_warn): Adjust to
linux_proc_pid_get_state interface change.
This patch allows gdbserver to continue recording after disconnect. On
reconnect, the recorded data is accessible to gdb as if no disconnect happened.
A possible application for this feature is remotely examine bugs that occur
at irregular intervals, where maintaining a gdb connection is inconvenient.
This also fixes the issue mentioned here:
https://sourceware.org/ml/gdb-patches/2015-11/msg00424.html
Signed-off-by: Tim Wiederhake <tim.wiederhake@intel.com>
gdb/ChangeLog:
* NEWS: Resume btrace on reconnect.
* record-btrace.c: Added record-btrace.h include.
(record_btrace_open): Split into this and ...
(record_btrace_push_target): ... this.
(record_btrace_disconnect): New function.
(init_record_btrace_ops): Use record_btrace_disconnect.
* record-btrace.h: New file.
* remote.c: Added record-btrace.h include.
(remote_start_remote): Check recording status.
(remote_btrace_maybe_reopen): New function.
gdb/doc/ChangeLog:
* gdb.texinfo: Resume btrace on reconnect.
gdb/testsuite/ChangeLog:
* gdb.btrace/reconnect.c: New file.
* gdb.btrace/reconnect.exp: New file.
Change-Id: I95e8b0ab8a89e58591aba0e63818cee82fd211bc
Implement support to add catchpoints for a group of related syscalls
using the syntax:
(gdb) catch syscall group:<group>
or
(gdb) catch syscall g:<group>
Several groups are predefined in the xml files for all architectures
supported by GDB over Linux. They are based on the groups defined by
strace.
gdb/
* xml-syscall.c (get_syscalls_by_group): New.
(get_syscall_group_names): New.
(struct syscall_group_desc): New structure to store group data.
(struct syscalls_info): Include field to store the group list.
(sysinfo_free_syscall_group_desc): New.
(free_syscalls_info): Free group list.
(syscall_group_create_syscall_group_desc): New.
(syscall_group_add_syscall): New.
(syscall_create_syscall_desc): Add syscall to its groups.
(syscall_start_syscall): Load group attribute.
(syscall_group_get_group_by_name): New.
(xml_list_syscalls_by_group): New.
(xml_list_of_groups): New.
* xml-syscall.h (get_syscalls_by_group): Export function
to retrieve a list of syscalls filtered by the group name.
(get_syscall_group_names): Export function to retrieve the list
of syscall groups.
* break-catch-syscall.c (catch_syscall_split_args): Verify if
argument is a syscall group and expand it to a list of syscalls
when creating catchpoints.
(catch_syscall_completer): Add word completion for system call
groups.
* configure.ac: Include dependency for xsltproc when building
in maintainer-mode.
* break-catch-syscall.c (_initialize_breakpoint): Update catch
syscall command documentation.
* NEWS: Include section about catching groups of syscalls.
* configure: Regenerate.
* data-directory/Makefile.in: Generate syscall xml when building
in maintainer mode.
* syscalls/gdb-syscalls.dtd: Include group attribute to the
syscall element.
* syscalls/apply-defaults.xsl: New.
* syscalls/linux-defaults.xml.in: New.
* syscalls/aarch64-linux.xml: Rename to aarch64-linux.xml.in.
* syscalls/amd64-linux.xml: Rename to amd64-linux.xml.in.
* syscalls/arm-linux.xml: Rename to arm-linux.xml.in.
* syscalls/bfin-linux.xml: Rename to bfin-linux.xml.in.
* syscalls/i386-linux.xml: Rename to i386-linux.xml.in.
* syscalls/mips-n32-linux.xml: Rename to mips-n32-linux.xml.in.
* syscalls/mips-n64-linux.xml: Rename to mips-n64-linux.xml.in.
* syscalls/mips-o32-linux.xml: Rename to mips-o32-linux.xml.in.
* syscalls/ppc-linux.xml: Rename to ppc-linux.xml.in.
* syscalls/ppc64-linux.xml: Rename to ppc64-linux.xml.in.
* syscalls/s390-linux.xml: Rename to s390-linux.xml.in.
* syscalls/s390x-linux.xml: Rename to s390x-linux.xml.in.
* syscalls/sparc-linux.xml: Rename to sparc-linux.xml.in.
* syscalls/sparc64-linux.xml: Rename to sparc64-linux.xml.in.
* syscalls/aarch64-linux.xml: Regenerate.
* syscalls/amd64-linux.xml: Regenerate.
* syscalls/arm-linux.xml: Regenerate.
* syscalls/i386-linux.xml: Regenerate.
* syscalls/mips-n32-linux.xml: Regenerate.
* syscalls/mips-n64-linux.xml: Regenerate.
* syscalls/mips-o32-linux.xml: Regenerate.
* syscalls/ppc-linux.xml: Regenerate.
* syscalls/ppc64-linux.xml: Regenerate.
* syscalls/s390-linux.xml: Regenerate.
* syscalls/s390x-linux.xml: Regenerate.
* syscalls/sparc-linux.xml: Regenerate.
* syscalls/sparc64-linux.xml: Regenerate.
gdb/testsuite/
* gdb.base/catch-syscall.exp (do_syscall_tests): Add call
to test_catch_syscall_group.
(test_catch_syscall_group): New.
gdb/doc/
* gdb.texinfo (Set Catchpoints): Add 'group' argument to catch
syscall.
The problem here is ARMv8.1 (and ARMv8.2) define a
different debug version than ARMv8 (7 and 8 respectively).
This fixes hw watchpoints and breakpoints by checking
for those debug versions too.
Committed as obvious after a test on aarch64-linux-gnu
(on a ThunderX machine which has ARMv8.1 support enabled).
ChangeLog:
* nat/aarch64-linux-hw-point.c
(aarch64_linux_get_debug_reg_capacity): Handle
ARMv8.1 and ARMv8.2 debug versions.
* nat/aarch64-linux-hw-point.h
(AARCH64_DEBUG_ARCH_V8_1): New define.
(AARCH64_DEBUG_ARCH_V8_2): New define.
Signed-off-by: Andrew Pinski <apinski@cavium.com>
PR rust/20162 started life as a reminder to test gdb with versions of
rust after 1.8; but now concerns some gdb regressions seen with rust
1.10 ("beta") and 1.11 ("nightly").
The failures turn out to be a discrepancy between how rustc emits
DWARF and how gdb interprets it. In particular, rustc will emit DWARF
like:
<2><bc>: Abbrev Number: 9 (DW_TAG_structure_type)
<bd> DW_AT_name : (indirect string, offset: 0x46a): HasMethods
<c1> DW_AT_byte_size : 4
...
<3><cc>: Abbrev Number: 11 (DW_TAG_subprogram)
...
<df> DW_AT_name : (indirect string, offset: 0x514f): new
gdb wants to see a separate top-level DW_TAG_subprogram that refers to
this one via DW_AT_specification; but rustc doesn't emit one. By my
reading of DWARF 4 5.5.7, this is ok, and gdb is incorrect here.
Fixing this involved a new case in scan_partial_symbols, and then a
further change in process_structure_scope to account for the fact
that, in Rust, such functions are not methods and should not be
attached to the structure type.
Next, it turns out that rust is emitting bad values for
DW_AT_linkage_name, e.g.:
<db> DW_AT_linkage_name: (indirect string, offset: 0x422): _ZN7methods8{{impl}}3newE
The the "{{impl}}" stuff is apparently some side effect of a change to
the compiler's internal representation. Oops!
This also had a simple fix -- disregard these mangled names.
With these changes, there are no regressions in the gdb Rust tests
with either 1.10 or 1.11. 1.9, the stable release, is still pretty
broken, but I think there's nothing much to do about that.
These changes are a bit hackish, but no worse, I think, than other
kinds of quirk handling already done in the DWARF parser. I have
reported all the rustc bugs upstream. I plan to remove these hacks
from gdb some suitable time after they have been fixed in released
versions of Rust.
2016-07-22 Tom Tromey <tom@tromey.com>
PR rust/20162:
* dwarf2read.c (scan_partial_symbols) <DW_TAG_structure_type>:
Call scan_partial_symbols for children when reading a Rust CU.
(dwarf2_physname): Ignore invalid DW_AT_linkage_name generated by
rustc.
(process_structure_scope) <DW_TAG_subprogram>: Call
read_func_scope for Rust.
I see the following fail due to the warning,
-trace-frame-collected^M
[warning] Extracting signed value from an unsigned int (num)^M
....
FAIL: gdb.trace/mi-trace-frame-collected.exp: ctf: -trace-frame-collected
In ctf metadata, "num" in "tsv" is defined as unint32_t,
ctf_save_write_metadata (&writer->tcs,
"event {\n\tname = \"tsv\";\n\tid = %u;\n"
"\tfields := struct { \n"
"\t\tuint64_t val;\n"
"\t\tuint32_t num;\n"
"\t};\n"
"};\n", CTF_EVENT_ID_TSV);
so we should read it as unsigned. The patch below fixes the fail by
changing to bt_ctf_get_uint64.
gdb:
2016-07-22 Yao Qi <yao.qi@linaro.org>
* ctf.c (ctf_traceframe_info): Call bt_ctf_get_uint64 rather than
bt_ctf_get_int64.
I learned recently that empty struct expressions, like "X{}", have been
promoted from experimental to stable in Rust. This patch changes the
Rust expression parser to allow this case.
New test case included.
Built and regtested on x86-64 Fedora 23, using Rust 1.11 beta.
2016-07-21 Tom Tromey <tom@tromey.com>
* rust-lang.c (rust_tuple_struct_type_p): Return false for empty
structs.
* rust-exp.y (struct_expr_list): Allow empty elements.
2016-07-21 Tom Tromey <tom@tromey.com>
* gdb.rust/simple.rs (main): Use empty struct expression.
* gdb.rust/simple.exp: Add tests for empty struct expression.
- A few missing casts required by C++, resulting in:
../../src/gdb/ser-go32.c:795:21: error: invalid conversion from 'const void*' to 'const char*' [-fpermissive]
etc.
- dos_noop has an incompatible prototype with struct serial_ops's
setparity, resulting in:
../../src/gdb/ser-go32.c:874:1: error: invalid conversion from 'int (*)(serial*)' to 'int (*)(serial*, int)' [-fpermissive]
(I thought of calling the ser-base.c default methods, but djgpp
doesn't include ser-base.c in the build.)
gdb/ChangeLog:
2016-07-21 Pedro Alves <palves@redhat.com>
* go32-nat.c (go32_create_inferior): Add cast.
* ser-go32.c (dos_noop): Delete.
(dos_flush_output, dos_setparity, dos_drain_output): New
functions.
(dos_write): Add cast.
(dos_ops): Use dos_flush_output, dos_setparity and
dos_drain_output.
* top.c (do_chdir_cleanup): Add cast.
GDBserver with software single step should be able to claim supporting
vCont s and S actions, so that GDB knows the remote target can do
single step. It doesn't matter to GDB that the single step in the
remote target is done via hardware or software.
gdb/gdbserver:
2016-07-21 Yao Qi <yao.qi@linaro.org>
* server.c (handle_v_requests): Support s and S actions
if target_supports_software_single_step return true.
This patch is to teach GDBserver using software single step to handle
vCont;s. Simply speaking, if the thread's resume request is resume_step,
install reinsert breakpoint at the next pcs when GDBserver is about to
resume threads. These reinsert breakpoints of a thread are removed,
when GDBserver gets an event from that thread and reports it back to
GDB.
gdb/gdbserver:
2016-07-21 Yao Qi <yao.qi@linaro.org>
* linux-low.c (resume_stopped_resumed_lwps): If resume request
is resume_step, call maybe_hw_step.
(linux_wait_1): Stop all threads, remove reinsert breakpoints,
and unstop them.
(linux_resume_one_lwp_throw): Don't assert the thread has reinsert
breakpoints or not.
(proceed_one_lwp): If resume request is resume_step, install
reinsert breakpoints and call maybe_hw_step.
Nowadays, we only enqueue signal when we leave thread pending in
linux_resume_one_thread. If lwp->resume->sig isn't zero (GDB wants
to resume with signal), we pass lwp->resume->sig to
linux_resume_one_lwp.
In order to reduce the difference between resuming thread with signal
and proceeding thread with signal, when we resume thread, we can
enqueue signal too, and proceed thread. The signal will be consumed in
linux_resume_one_lwp_throw from lwp->pending_signals.
gdb/gdbserver:
2016-07-21 Yao Qi <yao.qi@linaro.org>
* linux-low.c (proceed_one_lwp): Declare.
(linux_resume_one_thread): Remove local variable 'step'.
Lift code enqueue signal. Call proceed_one_lwp instead of
linux_resume_one_lwp.
install_software_single_step_breakpoints has parameter lwp, but still
need to switch to current_thread. In order to simplify its caller,
we do the current_thread save/restore inside install_software_single_step_breakpoints.
gdb/gdbserver:
2016-07-21 Yao Qi <yao.qi@linaro.org>
* gdbthread.h (make_cleanup_restore_current_thread): Declare.
* inferiors.c (do_restore_current_thread_cleanup): New function.
(make_cleanup_restore_current_thread): Likewise.
* linux-low.c (install_software_single_step_breakpoints): Call
make_cleanup_restore_current_thread. Switch current_thread to
thread.
This patch makes reinsert_breakpoint thread specific, which means we
insert and remove reinsert_breakpoint breakpoints for a specific
thread. This motivation of this change is that I'll use
reinsert_breakpoint for vCont;s on software single step target, so that
GDBserver may insert one reinsert_breakpoint for one thread doing
step-over, and insert one reinsert_breakpoint for another thread doing
vCont;s. After the operation of one thread is finished, GDBserver must
remove reinsert_breakpoint for that thread only.
On the other hand, reinsert_breakpoint is used for step-over nowadays.
GDBserver inserts reinsert_breakpoint, and wait only from the thread
doing step-over. After the step-over is done, GDBserver removes the
reinsert_breakpoint. If there is still any threads need step-over, do
the same again until all threads are finished step-over. In other words,
reinsert_breakpoint is globally thread specific, but in an implicit way.
It is natural to make it explicitly thread specific.
gdb/gdbserver:
2016-07-21 Yao Qi <yao.qi@linaro.org>
* mem-break.c (struct reinsert_breakpoint) <ptid>: New field.
(set_reinsert_breakpoint): New parameter ptid. Callers updated.
(clone_one_breakpoint): Likewise.
(delete_reinsert_breakpoints): Change parameter to thread.
Callers updated.
(has_reinsert_breakpoints): Likewise.
(uninsert_reinsert_breakpoints): Likewise.
(reinsert_reinsert_breakpoints): Likewise.
* mem-break.h (set_reinsert_breakpoint): Update declaration.
(delete_reinsert_breakpoints): Likewise.
(reinsert_reinsert_breakpoints): Likewise.
(uninsert_reinsert_breakpoints): Likewise.
(has_reinsert_breakpoints): Likewise.
This patch is to change the interface of clone_all_breakpoints, from
lists of breakpoints and raw_breakpoints to child thread and parent
thread. I choose child thread to pass because we need the ptid of
the child thread in the following patch.
gdb/gdbserver:
2016-07-21 Yao Qi <yao.qi@linaro.org>
* inferiors.c (get_thread_process): Make parameter const.
* inferiors.h (get_thread_process): Update declaration.
* mem-break.c (clone_all_breakpoints): Remove all parameters.
Add new parameters child_thread and parent_thread. Callers
updated.
* mem-break.h (clone_all_breakpoints): Update declaration.
Nowadays, there are three types of breakpoint in GDBserver,
- gdb breakpoints,
- reinsert breakpoints, used for software single step,
- other breakpoints, used for tracepoint,
but we only have one 'struct breakpoint' for all of them. Some fields
are only useful to one type of breakpoint. For example, cond_list
and command_list are only used by gdb breakpoints, while handler is
only used by other breakpoints.
This patch changes 'struct breakpoint' to a base class, which has fields
needed by all breakpoint types, also add three sub-classes to
'struct breakpoint' to these three types of breakpoints.
gdb/gdbserver:
2016-07-21 Yao Qi <yao.qi@linaro.org>
* mem-break.c (struct breakpoint) <cond_list>: Remove.
<command_list, handler>: Remove.
(struct gdb_breakpoint): New.
(struct other_breakpoint): New.
(struct reinsert_breakpoint): New.
(is_gdb_breakpoint): New function.
(any_persistent_commands): Update command_list if
is_gdb_breakpoint returns true.
(set_breakpoint): Create breakpoints according to their types.
(find_gdb_breakpoint): Return 'struct gdb_breakpoint *'.
(set_gdb_breakpoint_1): Likewise.
(set_gdb_breakpoint): Likewise.
(clear_breakpoint_conditions): Change parameter type to
'struct gdb_breakpoint *'.
(clear_breakpoint_commands): Likewise.
(clear_breakpoint_conditions_and_commands): Likewise.
(add_condition_to_breakpoint): Likewise.
(add_breakpoint_condition): Likewise.
(add_commands_to_breakpoint): Likewise.
(check_breakpoints): Check other_breakpoint.
(clone_one_breakpoint): Clone breakpopint according to its type.
* mem-break.h (struct gdb_breakpoint): Declare.
(set_gdb_breakpoint): Update declaration.
(clear_breakpoint_conditions_and_commands): Likewise.
(add_breakpoint_condition): Likewise.
(add_breakpoint_commands): Likewise.
* server.c (process_point_options): Change parameter type to
'struct gdb_breakpoint *'.
Nowadays, set_breakpoint_at creates breakpoint of type
other_breakpoint, but we also use set_breakpoint_at
in set_reinsert_breakpoint to create breakpoint, so that
we have to overwrite the breakpoint type like this,
bp = set_breakpoint_at (stop_at, NULL);
bp->type = reinsert_breakpoint;
which looks not very good. This patch changes set_breakpoint_at
to receive breakpoint type. Since set_breakpoint_at is
used in many places, I rename it to set_breakpoint_type_at, and wrap
it with set_breakpoint_at, and pass other_breakpoint. In this way,
we can call set_breakpoint_type_at with reinsert_breakpoint in
set_reinsert_breakpoint too, and code looks cleaner.
gdb/gdbserver:
2016-07-21 Yao Qi <yao.qi@linaro.org>
* mem-break.c (set_breakpoint_at): Rename it to ...
(set_breakpoint_type_at): ... it.
(set_breakpoint_at): Call set_breakpoint_type_at.
(set_reinsert_breakpoint): Call set_breakpoint_type_at.
* mem-break.h (set_breakpoint_at): Update comments.
I recently see some gdb.server/*.exp fails in my native gdb testing,
in which libexpat isn't available, so GDB isn't able to parse xml file.
It causes gdb.server/ tests fails because GDB can't get registers
correctly from GDBserver.
(gdb) PASS: gdb.server/connect-without-multi-process.exp: multiprocess=off: break main
target remote localhost:2352^M
Remote debugging using localhost:2352^M
warning: Can not parse XML target description; XML support was disabled at compile time^M
Reading /lib/ld-linux-armhf.so.3 from remote target...^M
warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead.^M
Reading /lib/ld-linux-armhf.so.3 from remote target...^M
Reading symbols from target:/lib/ld-linux-armhf.so.3...Reading /lib/ld-2.17.so.debug from remote target...^M
Reading /lib/.debug/ld-2.17.so.debug from remote target...^M
(no debugging symbols found)...done.^M
Remote 'g' packet reply is too long: 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000efffbe00000000808d0f4d100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000^
0x4d0f8d80 in _start () from target:/lib/ld-linux-armhf.so.3^M
Without XML support in GDB, it can't parse xml sent by GDBserver, and has
to fall back to the oldest arch. However, GDBserver doesn't know this
(IMO, this is a defect in RSP), and still choose the right target
description to create regcache and 'g' packet. If the port only has
one target description or coincidentally two sides choose the same
target description, there is no such issue. Otherwise, GDB is broken
on read registers.
This patch is to skip gdbserver tests if XML is not support and the
target has multiple target descriptions.
gdb/testsuite:
2016-07-21 Yao Qi <yao.qi@linaro.org>
* lib/gdbserver-support.exp (skip_gdbserver_tests): Return 1
if gdb_skip_xml_test is true on some targets.
If I run single test solib-list.exp, it is OK. If I run two, as below,
there are fails,
$ make check RUNTESTFLAGS="server-run.exp solib-list.exp"
FAIL: gdb.server/solib-list.exp: non-stop 0: continue (the program exited)
FAIL: gdb.server/solib-list.exp: non-stop 0: p libvar
FAIL: gdb.server/solib-list.exp: non-stop 1: continue (the program exited)
FAIL: gdb.server/solib-list.exp: non-stop 1: p libvar
in gdb.log,
/scratch/yao/gdb/build-git/x86_64/gdb/testsuite/../../gdb/gdbserver/gdbserver --once :2347 /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/outputs/gdb.server/server-run/server-run /lib64/ld-linux-x86-64.so.2 /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/outputs/gdb.server/solib-list/solib-list
server-run is spawned, which is wrong. If I only run solib-list.exp, ld-linux
is spawned, which is right.
/scratch/yao/gdb/build-git/x86_64/gdb/testsuite/../../gdb/gdbserver/gdbserver --once :2346 /lib64/ld-linux-x86-64.so.2 /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/outputs/gdb.server/solib-list/solib-list
in test, we spawn gdbserver this way,
# Note we pass ${interp_system}, the program gdbserver spawns, as
# argument here, instead of using gdb_load, because we don't want
# to download the interpreter to the target (it's already there)
# or to the test output directory.
set res [gdbserver_spawn "${interp_system} ${remote_binfile}"]
in gdbserver_spawn -> gdbserver_download_current_prog, if
last_loaded_file is set (when you run multiple tests), it is
returned.
This patch is to unset last_loaded_file in solib-list.exp.
gdb/testsuite:
2016-07-21 Yao Qi <yao.qi@linaro.org>
* gdb.server/solib-list.exp: Unset last_loaded_file.
FreeBSD 12 recently added a new ptrace event to indicate when the vfork
parent resumes after the child process stops sharing the address space.
Use this event to report a proper TARGET_WAITKIND_VFORK_DONE rather than
faking a vfork done event after a delay.
gdb/ChangeLog:
* fbsd-nat.c (fbsd_enable_proc_events): Enable "PTRACE_VFORK"
events.
(fbsd_pending_vfork_done): Only define if "PTRACE_VFORK" is not
defined.
(fbsd_add_vfork_done): Likewise.
(fbsd_is_vfork_done_pending): Likewise.
(fbsd_next_vfork_done): Likewise.
(fbsd_resume): Only ignore pending vfork done events if
"PTRACE_VFORK" is not defined.
(fbsd_wait): Only look for pending vfork done events if
"PTRACE_VFORK" is not defined.
[PTRACE_VFORK]: Handle "PL_FLAG_VFORKED" and "PL_FLAG_VFORK_DONE"
events.
(fbsd_follow_fork): Only fake a vfork done event if "PTRACE_VFORK"
is not defined.
New child processes on FreeBSD do not inherit optional ptrace events
such as fork and LWP events from the parent process. Instead,
explicitly enable events on new children when reporting a fork
event.
gdb/ChangeLog:
* fbsd-nat.c (fbsd_wait): Use "fbsd_enable_proc_events" on
new child processes.
Add a new function to enable optional event reporting for FreeBSD native
targets. Specifically, use this to enable fork and LWP events.
The bodies of fbsd_enable_follow_fork and fbsd_enable_lwp_events have been
subsumed into the new function. In addition, use the PT_GET_EVENT_MASK
and PT_EVENT_SET_MASK requests added in FreeBSD 12 when present to enable
these events.
gdb/ChangeLog:
* fbsd-nat.c (fbsd_enable_lwp_events): Remove function.
(fbsd_enable_proc_events): New function.
(fbsd_enable_follow_fork): Remove function.
(fbsd_post_startup_inferior): Use "fbsd_enable_proc_events".
(fbsd_post_attach): Likewise.
tested on Fedora 24 x86_64 after:
./configure; make
That is: CFLAGS='-g -O2' CXXFLAGS='-g -O2'
FAIL: gdb.gdb/selftest.exp: unknown source line
FAIL: gdb.gdb/selftest.exp: step into xmalloc call
gdb/testsuite/ChangeLog
2016-07-20 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.gdb/selftest.exp (do_steps_and_nexts): Add "next over TRY" and
"step into captured_main (args)".
$ runtest 'CC_FOR_TARGET=gcc -m32' gdb.btrace/tailcall-only.exp
Running ./gdb.btrace/tailcall-only.exp ...
gdb compile failed, tailcall-only.c: Assembler messages:
tailcall-only.c:142: Error: cannot represent relocation type BFD_RELOC_64
[...]
tailcall-only.c:425: Error: cannot represent relocation type BFD_RELOC_64
It works for the other x86 arch combinations:
On Mon, 11 Apr 2016 08:44:23 +0200, Metzger, Markus T wrote:
I'm setting the target triplet to "i686-unknown-linux" in my m32 configuration.
Like this:
set target_triplet "i686-unknown-linux"
set_board_info cflags "-m32"
set_board_info cppflags "-m32"
On Wed, 20 Jul 2016 16:02:20 +0200, Pedro Alves wrote:
There's no reason you should _not_ set it.
But, multilib-style testing with --target_board=unix\{-m64,-m32\} etc.
should work _too_, IMO.
gdb/testsuite/ChangeLog
2016-07-20 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.btrace/tailcall-only.exp: Use is_lp64_target check.
(gdb) source /home/jkratoch/redhat/gdb-clean/gdb/testsuite/outputs/gdb.python/py-unwind/py-unwind.py^M
Python script imported^M
Python Exception <type 'exceptions.ValueError'> Bad register: ^M
(gdb) FAIL: gdb.python/py-unwind.exp: import python scripts
class TestUnwinder(Unwinder):
AMD64_RBP = 6
AMD64_RSP = 7
AMD64_RIP = 16
On Tue, 19 Jul 2016 12:06:09 +0200, Yao Qi wrote:
py-unwind.exp does nothing on arch specific thing, so py-unwind.exp shouldn't
be aware of the arch difference, but py-unwind.py should.
On Tue, 19 Jul 2016 20:04:33 +0200, Pedro Alves wrote:
How about we handle this in the .exp file for now and leave something
more complicated for when the test is first ported to some other
arch. WDYT?
gdb/testsuite/ChangeLog
2016-07-20 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.python/py-unwind.exp: Test also ![is_lp64_target].
A test recently added to gdb.opt/inline-cmds.exp fails for
arm-none-eabi targets because -O2 leads to instructions to be
reordered widely.
I guess it might have made sense years ago to enable optimization in
these tests, but I fail to see the need for that nowadays.
Using -O0 while relying on __attribute__((always_inline)), which is
already used in the tests [1] [2], avoids this sort of trouble, while
still exercising the inlining-related use cases that are the focus of
these tests.
I think that nowadays we can safely assume that all compilers we care
about support __attribute__((always_inline)) or similar.
[1] - Except one spot that missed it.
[2] - Note that the .exp files make sure the frames that should have
been inlined are indeed inlined, with "info frame".
gdb/testsuite/ChangeLog:
2016-07-19 Pedro Alves <palves@redhat.com>
* gdb.opt/inline-break.exp: Remove optimize=-O2.
* gdb.opt/inline-bt.exp: Likewise.
* gdb.opt/inline-cmds.exp: Remove optimize=-O2 and add
additional_flags=-Winline.
* gdb.opt/inline-locals.exp: Likewise.
* gdb.opt/inline-markers.c (ATTR): Define.
(inlined_fn): Use it.
This patch uses do_self_tests to simplify selftest.exp. It doesn't
change the tests except the order,
-PASS: gdb.gdb/selftest.exp: Disassemble main
PASS: gdb.gdb/selftest.exp: breakpoint in captured_main
+PASS: gdb.gdb/selftest.exp: run until breakpoint at captured_main
+PASS: gdb.gdb/selftest.exp: Disassemble main
PASS: gdb.gdb/selftest.exp: set interrupt character in test_with_self
PASS: gdb.gdb/selftest.exp: set listsize to 1
-PASS: gdb.gdb/selftest.exp: run until breakpoint at captured_main
gdb/testsuite:
2016-07-19 Yao Qi <yao.qi@linaro.org>
* gdb.gdb/selftest.exp: Remove checks on is_remote and isnative.
(test_with_self): Remove some code. Remove argument executable.
(top-level): Use do_self_tests.
This patch fixes problems with a few GDB testsuites when executing in a
path that contains special characters (e.g. "++"). When such paths are
used as a regular expression, the regular expression parser will choke
and cause the tests to fail. This patch uses string_to_regexp to
escape strings that will be used as regular expressions, in order to
sanitize path names used in expect scripts.
2016-07-15 Zachary Welch <zwelch@codesourcery.com>
Don Breazeal <donb@codesourcery.com>
gdb/testsuite/ChangeLog:
* gdb.base/maint.exp: Escape paths used in regular expressions.
* gdb.stabs/weird.exp: Likewise.
FreeBSD's librt uses SIGLIBRT as an internal signal to implement
SIGEV_THREAD sigevent notifications. Similar to SIGLWP or SIGCANCEL
this signal should be passed through to child processes by default.
include/ChangeLog:
* signals.def: Add GDB_SIGNAL_LIBRT.
gdb/ChangeLog:
* common/signals.c (gdb_signal_from_host): Handle SIGLIBRT.
(do_gdb_signal_to_host): Likewise.
* infrun.c (_initialize_infrun): Pass GDB_SIGNAL_LIBRT through to
programs.
* proc-events.c (signal_table): Add entry for SIGLIBRT.
In https://sourceware.org/ml/gdb-patches/2016-07/msg00152.html,
Yao noted that a patch of mine was missing a newline.
I thought I had fixed this but when looking today I realized it was
not fixed. This patch adds it.
I'm checking this in as obvious.
2016-07-14 Tom Tromey <tom@tromey.com>
* python/py-breakpoint.c (gdbpy_breakpoint_deleted): Add missing
newline.
This patch consolidates the (possibly-questionable) spots where we
remove a declaration but continue to call some function for side
effects. In a couple of cases it wasn't entirely clear to me that
this mattered; and in some other cases it might be more aesthetically
pleasing to use ATTRIBUTE_UNUSED. So, I broke this out into a
separate patch for simpler review.
2016-07-14 Tom Tromey <tom@tromey.com>
* arch-utils.c (default_skip_permanent_breakpoint): Remove
"bp_insn".
* disasm.c (do_assembly_only): Remove "num_displayed".
* dwarf2read.c (read_abbrev_offset): Remove "length".
(dwarf_decode_macro_bytes) <DW_MACINFO_vendor_ext>: Remove
"constant".
* m32c-tdep.c (make_regs): Remove "r2hl", "r3hl", and "intbhl".
* microblaze-tdep.c (microblaze_frame_cache): Remove "func".
* tracefile.c (trace_save): Remove "status".
This patch removes some unneeded initializations in overlay code in
symfile.c. It also deletes some old commented-out code.
2016-07-14 Tom Tromey <tom@tromey.com>
* symfile.c (simple_overlay_update_1): Remove initialization
of "size", and commented-out code.
(simple_overlay_update): Likewise.
As suggested by Pedro, this changes a few spots to use getcurx, rather
than getyx. This avoids some unused variable warnings.
2016-07-14 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.c (tui_show_source_line): Use getcurx.
* tui/tui-io.c (tui_puts): Use getcurx.
(tui_redisplay_readline): Likewise.
One spot needed ATTRIBUTE_UNUSED to cope with the new warnings.
The case in inflow.c is just a mass of ifdefs; and while the only use
of "result" is guarded by "#if 0", I thought it simplest to leave it
all in place.
2016-07-14 Tom Tromey <tom@tromey.com>
* inflow.c (child_terminal_ours_1): Use ATTRIBUTE_UNUSED.
This seems to be a real bug found by -Wunused-but-set-variable. If
"stat" fails for some reason, gdb would use the uninitialized "st".
2016-07-14 Tom Tromey <tom@tromey.com>
* corefile.c (reopen_exec_file): Only examine st.st_mtime if stat
succeeded.
This patch adds some breakpoint events to Python. In particular,
there is a creation event that is emitted when a breakpoint is
created; a modification event that is emitted when a breakpoint
changes somehow; and a deletion event that is emitted when a
breakpoint is deleted.
In this patch, the event's payload is the breakpoint itself. I
considered making a new event type to hold the breakpoint, but I
didn't see a need. Still, I thought I would mention this as a spot
where some other choice is possible.
Built and regtested on x86-64 Fedora 23.
2016-07-13 Tom Tromey <tom@tromey.com>
PR python/15620, PR python/18620:
* python/py-evts.c (gdbpy_initialize_py_events): Call
add_new_registry for new events.
* python/py-events.h (events_object) <breakpoint_created,
breakpoint_deleted, breakpoint_modified>: New fields.
* python/py-breakpoint.c (gdbpy_breakpoint_created): Emit the
breakpoint changed event.
(gdbpy_breakpoint_deleted): Emit the breakpoint deleted event.
(gdbpy_breakpoint_modified): New function.
(gdbpy_initialize_breakpoints): Attach to the breakpoint modified
observer.
2016-07-13 Tom Tromey <tom@tromey.com>
PR python/15620, PR python/18620:
* python.texi (Events In Python): Document new breakpoint events.
2016-07-13 Tom Tromey <tom@tromey.com>
PR python/15620, PR python/18620:
* gdb.python/py-breakpoint.exp (connect_event, check_last_event)
(test_bkpt_events): New procs.
This patch adds a "pending" attribute to gdb.Breakpoint.
Built and regtested on x86-64 Fedora 23.
2016-07-13 Tom Tromey <tom@tromey.com>
PR python/17698:
* NEWS: Update.
* python/py-breakpoint.c (bppy_get_pending): New function.
(breakpoint_object_getset): Add entry for "pending".
* breakpoint.h (pending_breakpoint_p): Declare.
* breakpoint.c (pending_breakpoint_p): New function.
2016-07-13 Tom Tromey <tom@tromey.com>
PR python/17698:
* python.texi (Breakpoints In Python): Document
Breakpoint.pending.
2016-07-13 Tom Tromey <tom@tromey.com>
PR python/17698:
* gdb.python/py-breakpoint.exp (test_bkpt_basic): Add "pending"
test.
(test_watchpoints): Likewise.
(test_bkpt_pending): New proc.
I noticed that bppy_get_visibility and gdbpy_breakpoint_created
implemented their own visibility checks, but subtly different from
user_breakpoint_p. I think the latter is more correct, and so changed
the Python code to use it.
I suspect there isn't a decent way to test this, so no new test.
Built and regtested on x86-64 Fedora 23.
2016-07-13 Tom Tromey <tom@tromey.com>
* python/py-breakpoint.c (bppy_get_visibility)
(gdbpy_breakpoint_created): Use user_breakpoint_p.
I noticed that the Python breakpoint documentation was ordered a bit
oddly. It documented the constructor; then the stop method; then the
watchpoint constants (used for the constructor); then various other
methods and attributes; then the other constants used by the
constructor; and then finally some more methods and attributes.
This patch rearranges the node a little to move the constants to just
after the constructor and before the other methods and attributes.
2016-07-13 Tom Tromey <tom@tromey.com>
* python.texi (Breakpoints In Python): Move table of types and
table of watchpoint types earlier in node.
PR cli/18053 concerns a couple of minor bugs in the JIT debuginfo
support. First, jit-reader-load should use filename completion and
support tilde expansion. Second, the help for jit-reader-unload is
incorrect. While working on this I also realized that
jit-reader-unload should use the no-op completer, so I've included
that as well.
Built and regtested on x86-64 Fedora 23. A completer test for
jit-reader-load is included, but not a tilde-expansion test, as I
couldn't think of a reliable way to test that.
2016-07-13 Tom Tromey <tom@tromey.com>
PR cli/18053:
* jit.c (jit_reader_load_command): Use tilde_expand.
(_initialize_jit): Fix help for jit-reader-unload. Set completer
for new commands.
2016-07-13 Tom Tromey <tom@tromey.com>
PR cli/18053:
* gdb.base/jit-so.exp (one_jit_test): Add jit-reader-load
completion test.