Age | Commit message (Collapse) | Author | Files | Lines |
|
I'm trying to enable clang's -Wmissing-variable-declarations warning.
This patch fixes all the obvious spots where we can simply add "static"
(at least, found when building on x86-64 Linux).
gdb/ChangeLog:
* aarch64-linux-tdep.c (aarch64_linux_record_tdep): Make static.
* aarch64-tdep.c (tdesc_aarch64_list, aarch64_prologue_unwind,
aarch64_stub_unwind, aarch64_normal_base, ): Make static.
* arm-linux-tdep.c (arm_prologue_unwind): Make static.
* arm-tdep.c (struct frame_unwind): Make static.
* auto-load.c (auto_load_safe_path_vec): Make static.
* csky-tdep.c (csky_stub_unwind): Make static.
* gdbarch.c (gdbarch_data_registry): Make static.
* gnu-v2-abi.c (gnu_v2_abi_ops): Make static.
* i386-netbsd-tdep.c (i386nbsd_mc_reg_offset): Make static.
* i386-tdep.c (i386_frame_setup_skip_insns,
i386_tramp_chain_in_reg_insns, i386_tramp_chain_on_stack_insns):
Make static.
* infrun.c (observer_mode): Make static.
* linux-nat.c (sigchld_action): Make static.
* linux-thread-db.c (thread_db_list): Make static.
* maint-test-options.c (maintenance_test_options_list):
* mep-tdep.c (mep_csr_registers): Make static.
* mi/mi-cmds.c (struct mi_cmd_stats): Remove struct type name.
(stats): Make static.
* nat/linux-osdata.c (struct osdata_type): Make static.
* ppc-netbsd-tdep.c (ppcnbsd_reg_offsets): Make static.
* progspace.c (last_program_space_num): Make static.
* python/py-param.c (struct parm_constant): Remove struct type
name.
(parm_constants): Make static.
* python/py-record-btrace.c (btpy_list_methods): Make static.
* python/py-record.c (recpy_gap_type): Make static.
* record.c (record_goto_cmdlist): Make static.
* regcache.c (regcache_descr_handle): Make static.
* registry.h (DEFINE_REGISTRY): Make definition static.
* symmisc.c (std_in, std_out, std_err): Make static.
* top.c (previous_saved_command_line): Make static.
* tracepoint.c (trace_user, trace_notes, trace_stop_notes): Make
static.
* unittests/command-def-selftests.c (nr_duplicates,
nr_invalid_prefixcmd, lists): Make static.
* unittests/observable-selftests.c (test_notification): Make
static.
* unittests/optional/assignment/1.cc (counter): Make static.
* unittests/optional/assignment/2.cc (counter): Make static.
* unittests/optional/assignment/3.cc (counter): Make static.
* unittests/optional/assignment/4.cc (counter): Make static.
* unittests/optional/assignment/5.cc (counter): Make static.
* unittests/optional/assignment/6.cc (counter): Make static.
gdbserver/ChangeLog:
* ax.cc (bytecode_address_table): Make static.
* debug.cc (debug_file): Make static.
* linux-low.cc (stopping_threads): Make static.
(step_over_bkpt): Make static.
* linux-x86-low.cc (amd64_emit_ops, i386_emit_ops): Make static.
* tracepoint.cc (stop_tracing_bkpt, flush_trace_buffer_bkpt,
alloced_trace_state_variables, trace_buffer_ctrl,
tracing_start_time, tracing_stop_time, tracing_user_name,
tracing_notes, tracing_stop_note): Make static.
Change-Id: Ic1d8034723b7802502bda23770893be2338ab020
|
|
When building with gcc 4.8, we get:
CXX remote.o
cc1plus: warning: command line option '-Wmissing-prototypes' is valid for C/ObjC but not for C++ [enabled by default]
/home/smarchi/src/binutils-gdb/gdb/remote.c:1157:38: error: 'resume_state' is not a class, namespace, or enumeration
enum resume_state m_resume_state = resume_state::NOT_RESUMED;
^
It looks like gcc 4.8 doesn't like that there is an enum class named
resume_state as well as a method. Since it's an easy fix, rename the method to
get_remote_state to avoid the clash.
gdb/ChangeLog:
PR gdb/27219
* remote.c (struct remote_thread_info) <resume_state>: Rename
to...
<get_resume_state>: ... this.
(remote_target::resume): Adjust.
(remote_target::commit_resume): Adjust.
(remote_target::select_thread_for_ambiguous_stop_reply): Adjust.
Change-Id: Ib86c877a4c75ee671d69c27ed06cb8f57bc087db
|
|
|
|
I am having trouble remembering which of _cur_x/_cur_y is columns and
which is rows, so renaming them helps. We already have _rows and _cols
to represent the terminal size, so I think that makes sense to name the
"_cur" variables accordingly.
gdb/testsuite/ChangeLog:
* lib/tuiterm.exp: Rename _cur_x/_cur_y to _cur_col/_cur_row.
Change-Id: I6abd3cdfdb295d8abde12dcd5f0ae09f18f07967
|
|
This code can be a bit cryptic for those who don't know terminal control
sequences very well. This patch adds links for all the handled
sequences, so it's easy to get some doc to follow the code.
I linked to a VT510 manual, because I think it's well formatted and easy
to read. There's only the repeat sequence (_csi_b) which I haven't
found in it, it looks to be xterm-specific or something.
I also tried to use the sequence names as they are in the manual.
gdb/testsuite/ChangeLog:
* lib/tuiterm.exp: Add links in comments.
Change-Id: I670b947a238e5e9bcab7c476a20eb3c31cf2909d
|
|
When running test-case gdb.python/py-format-string.exp with target board
unix/-m32, we run into:
...
(gdb) python print \
(gdb.parse_and_eval ('a_base_ref').format_string (deref_refs=True))^M
@0xffffc468: {_vptr.Base = 0x80487e0 <vtable for Deriv+8>, a = 42, \
static a_static_member = 2019}^M
(gdb) FAIL: gdb.python/py-format-string.exp: format_string: \
lang_cpp: a_base_ref with option deref_refs: deref_refs=true
...
while with -m64, we have instead:
...
@0x7fffffffd170: {_vptr.Base = 0x400910 <vtable for Deriv+16>, a = 42, \
static a_static_member = 2019}^M
(gdb) PASS: gdb.python/py-format-string.exp: format_string: \
lang_cpp: a_base_ref with option deref_refs: deref_refs=true
...
The vtable contains pointer entries which are 4-byte for -m32 and 8-byte for
-m64, so it's not surprising the offsets (Deriv+8 vs. Deriv+16) differ.
Fix this by allow Deriv+$decimal.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2021-01-20 Tom de Vries <tdevries@suse.de>
* gdb.python/py-format-string.exp: Allow Deriv+$decimal as vtable
offset.
|
|
When running gdb.rust/*.exp with target board unix/-m32, we see:
...
Running src/gdb/testsuite/gdb.rust/union.exp ...
gdb compile failed, error: Unrecognized option: 'm'
Running src/gdb/testsuite/gdb.rust/modules.exp ...
gdb compile failed, error: Unrecognized option: 'm'
Running src/gdb/testsuite/gdb.rust/unsized.exp ...
gdb compile failed, error: Unrecognized option: 'm'
Running src/gdb/testsuite/gdb.rust/simple.exp ...
gdb compile failed, error: Unrecognized option: 'm'
Running src/gdb/testsuite/gdb.rust/watch.exp ...
gdb compile failed, error: Unrecognized option: 'm'
Running src/gdb/testsuite/gdb.rust/traits.exp ...
gdb compile failed, error: Unrecognized option: 'm'
Running src/gdb/testsuite/gdb.rust/expr.exp ...
Running src/gdb/testsuite/gdb.rust/rust-style.exp ...
gdb compile failed, error: Unrecognized option: 'm'
Running src/gdb/testsuite/gdb.rust/methods.exp ...
gdb compile failed, error: Unrecognized option: 'm'
Running src/gdb/testsuite/gdb.rust/generics.exp ...
gdb compile failed, error: Unrecognized option: 'm'
=== gdb Summary ===
nr of expected passes 95
nr of untested testcases 9
...
Fix this by testing for -m32 in the target board multilib_flags in
skip_rust_tests.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2021-01-20 Tom de Vries <tdevries@suse.de>
* lib/gdb.exp (skip_rust_tests): Skip if multilib_flags contains -m32.
|
|
The creation of this patch was motivated by Tom's "Change handling of
'!' operator in stap probes" patch.
While reviewing his patch, I stumbled upon a few issues with the stap
expression parser. They are:
- As it turns out, even with Tom's patch applied the parser doesn't
properly handle the '!' operator. The underlying issue was the fact
that stap_parse_argument_conditionally also needed to be patched in
order to recognize '!' as an operator that is part of a single
operand, and parse it accordingly.
- While writing the testcase I'm proposing on this patch, I found that
parenthesized sub-expressions were not being parsed correctly when
there was another term after them. For example:
1 - (2 + 3) + 4
In this case, the parser was considering "1" to be the left-side of
the expression, and "(2 + 3) + 4" to be the right-side. The patch
fixes the parser by making it identify whether a parenthesized
sub-expression has just been parsed, and act accordingly.
I've tested this on my Debian testing amd64, and everything seems OK.
gdb/ChangeLog:
2021-01-20 Sergio Durigan Junior <sergiodj@sergiodj.net>
Tom Tromey <tom@tromey.com>
* stap-probe.c (stap_parse_single_operand): Handle '!'
operator.
(stap_parse_argument_conditionally): Likewise.
Skip spaces after processing open-parenthesis sub-expression.
(stap_parse_argument_1): Skip spaces after call to
stap_parse_argument_conditionally.
Handle case when right-side expression is a parenthesized
sub-expression.
Skip spaces after call to stap_parse_argument_1.
gdb/testsuite/ChangeLog:
2021-01-20 Sergio Durigan Junior <sergiodj@sergiodj.net>
* gdb.arch/amd64-stap-expressions.S: New file.
* gdb.arch/amd64-stap-expressions.exp: New file.
|
|
Consider a minimal test-case test.c:
...
int main (void) { return 0; }
...
compiled with -m32:
...
$ gcc test.c -m32
...
When running the exec using gdbserver on openSUSE Factory (currently running a
linux kernel version 5.10.5):
...
$ gdbserver localhost:12345 a.out
...
to which we connect in a gdb session, we run into a segfault in the inferior:
...
$ gdb -batch -q -ex "target remote localhost:12345" -ex continue
Program received signal SIGSEGV, Segmentation fault.
0xf7dd8bd2 in init_cacheinfo () at ../sysdeps/x86/cacheinfo.c:761
...
The segfault is caused by gdbserver overwriting $gs_base with 0 using
PTRACE_SETREGS. After it is overwritten, the next use of $gs in the inferior
will trigger the segfault.
Before linux kernel version 5.9, the value used by PTRACE_SETREGS for $gs_base
was ignored, but starting version 5.9, the linux kernel has support for
intel architecture extension FSGSBASE, which allows users to modify $gs_base,
and consequently PTRACE_SETREGS can no longer ignore the $gs_base value.
The overwrite of $gs_base with 0 is done by a memset in x86_fill_gregset,
which was added in commit 9e0aa64f551 "Fix gdbserver qGetTLSAddr for
x86_64 -m32". The memset intends to zero-extend 32-bit registers that are
tracked in the regcache to 64-bit when writing them into the PTRACE_SETREGS
data argument. But in addition, it overwrites other registers that are
not tracked in the regcache, such as $gs_base.
Fix the segfault by redoing the fix from commit 9e0aa64f551 in minimal form.
Tested on x86_64-linux:
- openSUSE Leap 15.2 (using kernel version 5.3.18):
- native
- gdbserver -m32
- -m32
- openSUSE Factory (using kernel version 5.10.5):
- native
- m32
gdbserver/ChangeLog:
2021-01-20 Tom de Vries <tdevries@suse.de>
* linux-x86-low.cc (collect_register_i386): New function.
(x86_fill_gregset): Remove memset. Use collect_register_i386.
|
|
PowerPC version of git commit d1bcae833b.
bfd/
* elf32-ppc.c: Delete outdated comment.
(TARGET_KEEP_UNUSED_SECTION_SYMBOLS): Define.
* elf64-ppc.c (TARGET_KEEP_UNUSED_SECTION_SYMBOLS): Define.
gas/
* testsuite/gas/ppc/power4.d: Adjust for removal of section sym.
* testsuite/gas/ppc/test1elf32.d: Likewise.
* testsuite/gas/ppc/test1elf64.d: Likewise.
ld/
* testsuite/ld-powerpc/relbrlt.s: Make symbols global.
* testsuite/ld-powerpc/relbrlt.d: Adjust to suit.
* testsuite/ld-powerpc/tlsget.d: Adjust for reordered stubs.
* testsuite/ld-powerpc/tlsget.wf: Likewise.
* testsuite/ld-powerpc/tlsget2.d: Likewise.
* testsuite/ld-powerpc/tlsget2.wf: Likewise.
* testsuite/ld-powerpc/tlsexe.r: Adjust for removed section syms.
* testsuite/ld-powerpc/tlsexe32.r: Likewise.
* testsuite/ld-powerpc/tlsexe32no.r: Likewise.
* testsuite/ld-powerpc/tlsexeno.r: Likewise.
* testsuite/ld-powerpc/tlsexenors.r: Likewise.
* testsuite/ld-powerpc/tlsexers.r: Likewise.
* testsuite/ld-powerpc/tlsexetoc.r: Likewise.
* testsuite/ld-powerpc/tlsexetocrs.r: Likewise.
* testsuite/ld-powerpc/tlsso.r: Likewise.
* testsuite/ld-powerpc/tlsso32.r: Likewise.
* testsuite/ld-powerpc/tlstocso.r: Likewise.
|
|
If an assembler trims off unused section symbols there may be no
section symbols. This means that testing for the .opd section symbol
needs to test both the section name and symbol flags.
* elf64-ppc.c (ppc64_elf_get_synthetic_symtab): Don't assume
section symbols are present.
|
|
|
|
In switch_thru_all_uis, a pre-c++11 way of removing copy constructor
and assignment operator is used.
This patch uses the DISABLE_COPY_AND_ASSIGN macro which does the right
thing for pre and post c++11.
gdb/Changelog:
2021-01-19 Lancelot SIX <lsix@lancelotsix.com>
* top.h (switch_thru_all_uis): Use DISABLE_COPY_AND_ASSIGN.
|
|
With the new member functions for struct trad_frame_saved_reg, there is no
need to invoke some of the set/get functions anymore. This patch removes
those and adjusts all callers.
Even though the most natural initial state of a saved register value is
UNKNOWN, there are target backends relying on the previous initial state
of REALREG set to a register's own number. I noticed this in at least a
couple targets: aarch64 and riscv.
Because of that, I decided to keep the reset function that sets the set of
register values to REALREG. I can't exercise all the targets to make sure
the initial state change won't break things, hence why it is risky to change
the default.
Validated with --enable-targets=all on aarch64-linux Ubuntu 18.04/20.04.
gdb/ChangeLog
2021-01-19 Luis Machado <luis.machado@linaro.org>
* trad-frame.h (trad_frame_saved_reg) <set_value_bytes>: Allocate
memory and save data.
(trad_frame_set_value, trad_frame_set_realreg, trad_frame_set_addr)
(trad_frame_set_unknown, trad_frame_set_value_bytes)
(trad_frame_value_p, trad_frame_addr_p, trad_frame_realreg_p)
(trad_frame_value_bytes_p): Remove.
(trad_frame_reset_saved_regs): Adjust documentation.
* trad-frame.c (trad_frame_alloc_saved_regs): Initialize via a
constructor and reset the state of the registers.
(trad_frame_value_p, trad_frame_addr_p, trad_frame_realreg_p)
(trad_frame_value_bytes_p, trad_frame_set_value)
(trad_frame_set_realreg, trad_frame_set_addr)
(trad_frame_set_unknown, trad_frame_set_value_bytes): Remove.
(trad_frame_set_reg_realreg): Update to call member function.
(trad_frame_set_reg_addr, trad_frame_set_reg_value_bytes): Likewise.
(trad_frame_get_prev_register): Likewise.
* aarch64-tdep.c (aarch64_analyze_prologue)
(aarch64_analyze_prologue_test, aarch64_make_prologue_cache_1)
(aarch64_prologue_prev_register): Update to use member functions.
* alpha-mdebug-tdep.c (alpha_mdebug_frame_unwind_cache): Likewise.
* alpha-tdep.c (alpha_heuristic_frame_unwind_cache): Likewise.
* arc-tdep.c (arc_print_frame_cache, arc_make_frame_cache): Likewise.
* arm-tdep.c (arm_make_prologue_cache, arm_exidx_fill_cache)
(arm_make_epilogue_frame_cache): Likewise.
* avr-tdep.c (avr_frame_unwind_cache)
(avr_frame_prev_register): Likewise.
* cris-tdep.c (cris_scan_prologue): Likewise.
* csky-tdep.c (csky_frame_unwind_cache): Likewise.
* frv-tdep.c (frv_analyze_prologue): Likewise.
* hppa-tdep.c (hppa_frame_cache, hppa_fallback_frame_cache): Likewise.
* lm32-tdep.c (lm32_frame_cache): Likewise.
* m32r-tdep.c (m32r_frame_unwind_cache): Likewise.
* m68hc11-tdep.c (m68hc11_frame_unwind_cache): Likewise.
* mips-tdep.c (set_reg_offset, mips_insn16_frame_cache)
(mips_micro_frame_cache, mips_insn32_frame_cache): Likewise.
(reset_saved_regs): Adjust to set realreg.
* riscv-tdep.c (riscv_scan_prologue, riscv_frame_cache): Adjust to
call member functions.
* rs6000-tdep.c (rs6000_frame_cache, rs6000_epilogue_frame_cache)
* s390-tdep.c (s390_prologue_frame_unwind_cache)
(s390_backchain_frame_unwind_cache): Likewise.
* score-tdep.c (score7_analyze_prologue)
(score3_analyze_prologue, score_make_prologue_cache): Likewise.
* sparc-netbsd-tdep.c (sparc32nbsd_sigcontext_saved_regs): Likewise.
* sparc-sol2-tdep.c (sparc32_sol2_sigtramp_frame_cache): Likewise.
* sparc64-netbsd-tdep.c (sparc64nbsd_sigcontext_saved_regs): Likewise.
* sparc64-sol2-tdep.c (sparc64_sol2_sigtramp_frame_cache): Likewise.
* tilegx-tdep.c (tilegx_analyze_prologue)
(tilegx_frame_cache): Likewise.
* v850-tdep.c (v850_frame_cache): Likewise.
* vax-tdep.c (vax_frame_cache): Likewise.
|
|
This patch converts the most obvious functions from gdb/frame.h to use
the gdb::array_view abstraction. I've converted the ones that used buffer +
length.
There are others using only the buffer, with an implicit size. I did not
touch those for now. But it would be nice to pass the size for safety.
Tested with --enable-targets=all on Ubuntu 18.04/20.04 aarch64-linux.
gdb/ChangeLog
2021-01-19 Luis Machado <luis.machado@linaro.org>
* frame.h (get_frame_register_bytes): Pass a gdb::array_view instead
of buffer + length.
(put_frame_register_bytes): Likewise.
Adjust documentation.
(get_frame_memory): Pass a gdb::array_view instead of buffer + length.
(safe_frame_unwind_memory): Likewise.
* frame.c (get_frame_register_bytes, put_frame_register_bytes)
(get_frame_memory, safe_frame_unwind_memory): Adjust to use
gdb::array_view.
* amd64-fbsd-tdep.c (amd64fbsd_sigtramp_p): Likewise.
* amd64-linux-tdep.c (amd64_linux_sigtramp_start): Likewise.
* amd64-obsd-tdep.c (amd64obsd_sigtramp_p): Likewise.
* arc-linux-tdep.c (arc_linux_is_sigtramp): Likewise.
* cris-tdep.c (cris_sigtramp_start, cris_rt_sigtramp_start): Likewise.
* dwarf2/loc.c (rw_pieced_value): Likewise.
* hppa-tdep.c (hppa_frame_cache): Likewise.
* i386-fbsd-tdep.c (i386fbsd_sigtramp_p): Likewise.
* i386-gnu-tdep.c (i386_gnu_sigtramp_start): Likewise.
* i386-linux-tdep.c (i386_linux_sigtramp_start)
(i386_linux_rt_sigtramp_start): Likewise.
* i386-obsd-tdep.c (i386obsd_sigtramp_p): Likewise.
* i386-tdep.c (i386_register_to_value): Likewise.
* i387-tdep.c (i387_register_to_value): Likewise.
* ia64-tdep.c (ia64_register_to_value): Likewise.
* m32r-linux-tdep.c (m32r_linux_sigtramp_start)
(m32r_linux_rt_sigtramp_start): Likewise.
* m68k-linux-tdep.c (m68k_linux_pc_in_sigtramp): Likewise.
* m68k-tdep.c (m68k_register_to_value): Likewise.
* mips-tdep.c (mips_register_to_value)
(mips_value_to_register): Likewise.
* ppc-fbsd-tdep.c (ppcfbsd_sigtramp_frame_sniffer)
(ppcfbsd_sigtramp_frame_cache): Likewise.
* ppc-obsd-tdep.c (ppcobsd_sigtramp_frame_sniffer)
(ppcobsd_sigtramp_frame_cache): Likewise.
* rs6000-tdep.c (rs6000_in_function_epilogue_frame_p)
(rs6000_register_to_value): Likewise.
* tilegx-tdep.c (tilegx_analyze_prologue): Likewise.
* tramp-frame.c (tramp_frame_start): Likewise.
* valops.c (value_assign): Likewise.
|
|
This matches the changes in the common code.
|
|
This patch updates the functions setting value bytes in trad-frame to use
a gdb::array_view instead of passing a buffer and a size.
gdb/ChangeLog:
2021-01-19 Luis Machado <luis.machado@linaro.org>
* aarch64-linux-tdep.c (aarch64_linux_restore_vreg): Pass in an
array_view.
* trad-frame.c (trad_frame_set_value_bytes): Use gdb::array_view
instead of buffer and size.
(trad_frame_set_reg_value_bytes): Likewise.
* trad-frame.h (trad_frame_set_reg_value_bytes): Likewise.
(trad_frame_set_value_bytes): Likewise.
|
|
Our recent commit to support unnamed structure members better ditched
the old ctf_member_iter iterator body in favour of ctf_member_next.
However, these functions treat unnamed structure members differently:
ctf_member_iter just returned whatever the internal representation
contained, while ctf_member_next took care to always return "" rather
than sometimes returning "" and sometimes NULL depending on whether the
dict was dynamic (a product of ctf_create) or not (a product of
ctf_open). After this commit, ctf_member_iter did the same.
It was always a bug for external callers not to treat a "" return from
these functions as if it were NULL, so only buggy callers could be
affected -- but one of those buggy callers was ctf_add_type, which
assumed that it could just take whatever name was returned from
ctf_member_iter and slam it directly into the internal representation of
a dynamic dict -- which expects NULL for unnamed members, not "". The
net effect of all of this is that taking a struct containing unnamed
members and ctf_add_type'ing it into a dynamic dict produced a dict
whose unnamed members were inaccessible to ctf_member_info (though if
you wrote that dict out and then ctf_open'ed it, they would magically
reappear again).
Compensate for this by suitably transforming a "" name into NULL in the
internal representation, as should have been done all along.
libctf/ChangeLog
2021-01-19 Nick Alcock <nick.alcock@oracle.com>
* ctf-create.c (membadd): Transform ""-named members into
NULL-named ones.
* testsuite/libctf-regression/type-add-unnamed-struct*: New test.
|
|
The recent work allowing lookups of pointers in child dicts when the
pointed-to type is in the parent dict broke the case where a pointer
type that does not exist at all is looked up: we mistakenly return the
pointed-to type, which is likely not a pointer at all. This causes
considerable confusion.
Fixed, with a new testcase.
libctf/ChangeLog
2021-01-19 Nick Alcock <nick.alcock@oracle.com>
* ctf-lookup.c (ctf_lookup_by_name_internal): Do not return the
base type if looking up a nonexistent pointer type.
* testsuite/libctf-regression/pptrtab*: Test it.
|
|
GCC 11+ spots that the extern var_1 and var_666 declarations in this
test are unused, and removes them, thus stopping them from appearing as
conflicted data symbols and rendering the test pointless. Use them in a
function unique to this TU to prevent them from being eliminated.
ld/ChangeLog
2021-01-19 Nick Alcock <nick.alcock@oracle.com>
* testsuite/ld-ctf/data-func-2.c: Stop removal of the extern foo_t
symbols by the optimizer.
* testsuite/ld-ctf/data-func-conflicted.d: Adjust accordingly.
|
|
When executing test-case gdb.base/step-over-syscall.exp with target board
unix/-m32, we run into:
...
(gdb) x/2i $pc^M
=> 0xf7fd5155 <__kernel_vsyscall+5>: sysenter ^M
0xf7fd5157 <__kernel_vsyscall+7>: int $0x80^M
(gdb) PASS: gdb.base/step-over-syscall.exp: fork: displaced=off: \
pc before/after syscall instruction
stepi^M
[Detaching after fork from child process 23593]^M
0xf7fd5159 in __kernel_vsyscall ()^M
1: x/i $pc^M
=> 0xf7fd5159 <__kernel_vsyscall+9>: pop %ebp^M
(gdb) PASS: gdb.base/step-over-syscall.exp: fork: displaced=off: stepi fork insn
print /x $pc^M
$2 = 0xf7fd5159^M
(gdb) PASS: gdb.base/step-over-syscall.exp: fork: displaced=off: pc after stepi
FAIL: gdb.base/step-over-syscall.exp: fork: displaced=off: \
pc after stepi matches insn addr after syscall
...
The test tries to verify that after doing a stepi at a syscall insn, the $pc
is matching the insn after the syscall insn.
However, in the case that the syscall insn is "sysenter", the stepi will land
further away, so in this case:
...
0xf7fd5155 <__kernel_vsyscall+5>: sysenter ^M
0xf7fd5157 <__kernel_vsyscall+7>: int $0x80^M
0xf7fd5159 <__kernel_vsyscall+9>: pop %ebp^M
...
the stepi will land at 0xf7fd5159 instead of 0xf7fd5157.
Fix this by detecting the sysenter/int sequence and adjusting the expected
pc.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2021-01-19 Tom de Vries <tdevries@suse.de>
* gdb.base/step-over-syscall.exp: Detect and handle sysenter/int
sequence.
|
|
When running test-case gdb.arch/i386-mpx.exp with target board unix/-m32, we
run into:
...
(gdb) print $bndstatus^M
$3 = {raw = 0xf7ca7ff2, status = {bde = 1039310844, error = 2}}^M
(gdb) FAIL: gdb.arch/i386-mpx.exp: bndstatus formating
print $bndstatus.raw^M
$4 = (void *) 0xf7ca7ff2^M
(gdb) FAIL: gdb.arch/i386-mpx.exp: bndstatus is zero by startup
...
The failure does not occur with -m64, there we have instead:
...
(gdb) print $bndstatus^M
$3 = {raw = 0x0, status = {bde = 0, error = 0}}^M
(gdb) PASS: gdb.arch/i386-mpx.exp: bndstatus formating
print $bndstatus.raw^M
$4 = (void *) 0x0^M
(gdb) PASS: gdb.arch/i386-mpx.exp: bndstatus is zero by startup
...
The difference is as follows. At the point of issuing the print commands, we
have run to main, so in the case of -m64 we have executed:
...
00000000004004c7 <main>:
4004c7: 55 push %rbp
4004c8: 48 89 e5 mov %rsp,%rbp
4004cb: 89 7d fc mov %edi,-0x4(%rbp)
4004ce: 48 89 75 f0 mov %rsi,-0x10(%rbp)
4004d2: 66 0f 1b 45 e0 bndmov %bnd0,-0x20(%rbp)
...
and in the case of -m32:
...
08048426 <main>:
8048426: 55 push %ebp
8048427: 89 e5 mov %esp,%ebp
8048429: 83 ec 08 sub $0x8,%esp
804842c: 8d 45 0c lea 0xc(%ebp),%eax
804842f: 8b 55 0c mov 0xc(%ebp),%edx
8048432: 0f 1a 04 10 bndldx (%eax,%edx,1),%bnd0
8048436: 66 0f 1b 45 f8 bndmov %bnd0,-0x8(%ebp)
...
In both cases, the bnd instructions attempt to save the bound for pointer
argument argv to stack. However, there's no such bound set.
In the -m64 case, that means we just save some random value to stack.
In the -m32 case, that means that when executing bndldx the corresponding
entry in the Bounds Directory is invalid, and $bndstatus is updated to reflect
that.
Fix this by dropping the unnecessary argv parameter to main, similar to all
other gdb.arch/i386-mpx*.c test-cases.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2021-01-19 Tom de Vries <tdevries@suse.de>
* gdb.arch/i386-mpx.c (main): Drop argc/argv parameter.
|
|
Put the logic to select local vs. usual .plt section in one place.
* elf64-ppc.c (elf_hash_entry): New inline function. Use
throughout to replace casts.
(branch_reloc_hash_match): Remove const from params.
(use_local_plt): New function.
(allocate_dynrelocs, ppc_build_one_stub, ppc_size_one_stub),
(build_global_entry_stubs_and_plt, ppc64_elf_relocate_section):
Use use_local_plt.
* elf32-ppc.c (use_local_plt): New function.
(allocate_dynrelocs, ppc_elf_relocate_section),
(write_global_sym_plt): Use use_local_plt.
|
|
A testcase with only ifuncs can result in no plt section (ifunc plt
entries might instead be in iplt), which means we can get to this code
without a static link.
PR 27203
* powerpc.cc (do_plt_fde_location): Remove doing_static_link
assertion.
|
|
This wasn't supposed to be in here when it was first merged as we
had specifically disabled it for all the tests (and ADI has papers
in place w/the FSF). Clean up this one.
|
|
The sizes of compressed and uncompressed .debug_aranges are the same
for the riscv big endian targets, but different for the little endian
targets. The compress rule is fine and isn't broken by riscv, just the
original compressed1d.d fails by accident. Ideally, we should fill the
R_RISCV_ADD/SUB relocations when disabling relaxations in the assembler.
But before that, Jim already had written an alternative test compressed1d-alt
to relpace compressed1d.d for riscv, so we can only xfail the riscv little
endian targets in the short-term.
ld/
* testsuite/ld-elf/elf.exp (riscv_little_endian): Added. Return true
if target is riscv little endian. Otherwise, return false.
* testsuite/ld-elf/compressed1d.d: Only xfail the riscv little endian
targets by [riscv_little_endian].
|
|
|
|
We don't use the host & target aliases, so don't bother emitting them.
|
|
This was mostly orphaned a while back, but left behind so people could
still run `make headers`. Merge that one target to the top sim dir and
delete all the build logic. This should avoid confusing people further.
|
|
It's not 1996 anymore, so stop writing shell code like it is, and
rewrite it with modern POSIX shell standards. This makes it much
more user friendly.
Then regenerate the file with latest newlib sources to verify.
|
|
After commit:
commit 10f92414d6d4a5f8eb8cbb2bf39ca86c1f9c1da5
Date: Fri Jan 15 12:14:45 2021 +0100
[gdb/testsuite] Fix gdb.fortran/array-slices.exp with -m32
Some test names now contain the addresses of variables from the
inferior. When running the test in different directories I'm seeing
slightly different values for the addresses. This makes comparing
test results between directories harder than it needs to be.
This commit just gives the tests a descriptive name without including
the addresses.
gdb/testsuite/ChangeLog:
* gdb.fortran/array-slices.exp (run_test): Avoid including
addresses in test names.
|
|
Currently
$ as -o x.o x.s
fails when x.s contains DWARF5 ".file 0" or ".loc 0" directives. Update
assembler to automatically enable DWARF5 support so that
$ gcc -S -g -c x.c
$ gcc -c x.s
works.
PR gas/27195
* dwarf2dbg.c (dwarf2_gen_line_info): Set dwarf_level to 5 if
needed.
(dwarf2_directive_filename): Likewise.
(dwarf2_directive_loc): Likewise.
* testsuite/gas/elf/dwarf-5-file0.d: Pass --gdwarf-3.
* testsuite/gas/lns/lns-diag-1.l: Remove the
"Error: file number less than one" errors.
|
|
The RISC-V x0 register is hard-coded to zero. As such neither Linux
or FreeBSD supply the value of the register x0 in their core dump
files.
For FreeBSD we take care of this by manually supplying the value of x0
in riscv_fbsd_supply_gregset, however we don't do this for Linux. As
a result after loading a core file on Linux we see this behaviour:
(gdb) p $x0
$1 = <unavailable>
In this commit I make riscv_fbsd_supply_gregset a common function that
can be shared between RISC-V for FreeBSD and Linux, this resolves the
above issue.
There is a similar problem for the two registers `fflags` and `frm`.
These two floating point related CSRs are a little weird. They are
separate CSRs in the RISC-V specification, but are actually sub-fields
of the `fcsr` CSR.
As a result neither Linux or FreeBSD supply the `fflags` or `frm`
registers as separate fields in their core dumps, and so, after
restoring a core dump these register are similarly unavailable.
In this commit I supply `fflags` and `frm` by first asking for the
value of `fcsr`, extracting the two fields, and using these to supply
the values for `fflags` and `frm`.
gdb/ChangeLog:
* riscv-fbsd-tdep.c (riscv_fbsd_supply_gregset): Delete.
(riscv_fbsd_gregset): Use riscv_supply_regset.
(riscv_fbsd_fpregset): Likewise.
* riscv-linux-tdep.c (riscv_linux_gregset): Likewise.
(riscv_linux_fregset): Likewise.
* riscv-tdep.c (riscv_supply_regset): Define new function.
* riscv-tdep.h (riscv_supply_regset): Declare new function.
|
|
This changes the initialisation of output sections so that it is
possible to create read-only sections fed only from linker script
BYTE, SHORT, LONG or QUAD. That currently isn't possible even for one
of the well-known ELF sections like .rodata, because once a section is
marked read/write that sticks. On the other hand if we start
read-only, well-known ELF sections end up read/write as appropriate.
For example .tdata will still be SHF_ALLOC + SHF_WRITE + SHF_TLS.
PR 26378
* ldlang.c (map_input_to_output_sections): Start with a read-only
section for data statements.
* testsuite/ld-elf/size-2.d: Adjust to suit.
|
|
When running test-case gdb.arch/i386-mpx-sigsegv.exp with target board
unix/-m32, we run into:
...
(gdb) continue^M
Continuing.^M
Saw a #BR! status 1 at 0x8048c2d^M
^M
Program received signal SIGSEGV, Segmentation fault^M
Upper bound violation while accessing address 0x0804c15c^M
Bounds: [lower = 0x00000000, upper = 0x00000000].^M
0x08048a4f in lower (p=0x804c160, a=0x804c180, b=0x804c1a0, c=0x804c1c0, \
d=0x804c1e0, len=1) at i386-mpx-sigsegv.c:79^M
79 value = *(p - len);^M
(gdb) FAIL: gdb.arch/i386-mpx-sigsegv.exp: MPX signal segv Lower: 0
...
The problem is that lower and upper in the Bounds message are 0x0, which is
caused by $_siginfo._sifields._sigfault._addr_bnd.{_lower,_upper} evaluating
to 0x0.
Fix this by copying the si_lower/si_upper fields in
compat_siginfo_from_siginfo.
Tested on x86_64-linux, with target board unix/-m32.
gdb/ChangeLog:
2021-01-18 Tom de Vries <tdevries@suse.de>
PR tdep/27172
* nat/amd64-linux-siginfo.c (cpt_si_lower, cpt_si_upper, SEGV_BNDERR):
New macro.
(compat_siginfo_from_siginfo): Copy cpt_si_lower and cpt_si_upper
for SEGV_BNDERR.
|
|
gdb/ChangeLog:
* remote.c (class remote_target) <remote_hostio_send_command,
remote_hostio_parse_result>: Constify parameter.
(remote_hostio_parse_result): Likewise.
(remote_target::remote_hostio_send_command): Adjust.
(remote_target::remote_hostio_pread_vFile): Adjust.
(remote_target::fileio_readlink): Adjust.
(remote_target::fileio_fstat): Adjust.
Change-Id: I6b585b99937e6526a0a7e06261d2193114589912
|
|
The wait_status variable is only used when the target is in in all-stop
mode. We can therefore move it in the !target_is_non_stop scope. That
lets us remove the assert in the else, that checks that the wait status
is not set. If the variable doesn't exist in that scope, it pretty much
guarantees that it is not set.
gdb/ChangeLog:
* remote.c (remote_target::start_remote): Move wait_status to
narrower scope.
Change-Id: I30979135e3f4f36d04178baa67575c4e58d3b648
|
|
... and adjust callers / callees.
gdb/ChangeLog:
* remote.c (class remote_target):
<add_current_inferior_and_thread>: Constify parameter.
(stop_reply_extract_thread): Likewise.
(remote_target::get_current_thread): Likewise.
(remote_target::add_current_inferior_and_thread): Likewise.
Change-Id: Ifdc6c263104b58852b532cfda81caf836437d29c
|
|
Const-ify the unpack_* functions, and then adjust the callers
accordingly.
gdb/ChangeLog:
* remote.c (class remote_target)
<remote_unpack_thread_info_response,
parse_threadlist_response>: Constify parameter and/or return
value and or local variable.
(stub_unpack_int): Likewise.
(unpack_nibble): Likewise.
(unpack_byte): Likewise.
(unpack_int): Likewise.
(unpack_string): Likewise.
(unpack_threadid): Likewise.
(remote_target::remote_unpack_thread_info_response): Likewise.
(remote_target::parse_threadlist_response): Likewise.
Change-Id: Ibda75f664d6e3452df00f85af7134533049171b7
|
|
Fix a NULL dereference seen when assembling invalid input.
PR 27198
* config/tc-i386.c (need_plt32_p): Return FALSE for NULL symbol.
* testsuite/gas/i386/pr27198.d,
* gas/testsuite/gas/i386/pr27198.err,
* gas/testsuite/gas/i386/pr27198.s: New test.
* gas/testsuite/gas/i386/i386.exp: Run it.
|
|
When deciding if a single member comdat group section in file FOO should
be discarded by a linkonce section in file BAR, we check if 2 sections
define the same set of local and global symbols. When only one of the
files doesn't contain the unused section symbols in the symbol table,
such as object files generated by clang or GNU assembler with
commit d1bcae833b32f1408485ce69f844dcd7ded093a8
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Thu Jan 7 06:42:00 2021 -0800
ELF: Don't generate unused section symbols
the check will fail since one file has the extra unused section symbols.
We should ignore both undefined and section symbols in the symbol table
when making such a decision.
bfd/
PR ld/27193
* elflink.c (elf_create_symbuf): Also ignore section symbols.
ld/
PR ld/27193
* testsuite/ld-i386/i386.exp: Run PR ld/27193 test.
* testsuite/ld-i386/pr27193.dd: New file.
* testsuite/ld-i386/pr27193a.o.bz2: Likewise.
* testsuite/ld-i386/pr27193b.s: Likewise.
|
|
On Fedora 33 x86-64 with glibc 2.32-3, ifuncmain6pie failed with:
./ifuncmain6pie: IFUNC symbol 'foo' referenced in './ifuncmod6.so' is defined in the executable and creates an unsatisfiable circular dependency.
FAIL ifuncmain6pie (exit status: 127)
Remove non-JUMP_SLOT relocations against foo in ifuncmod6.so, which
trigger the circular IFUNC dependency.
* testsuite/ifuncmain6pie.c: Remove non-JUMP_SLOT relocations
against foo in ifuncmod6.so.
* testsuite/ifuncmod6.c: Likewise.
|
|
|
|
Increase the max number of open files to 20 for PR binutils/23460 test
which may have more than 16 file descriptors open:
lr-x------ 1 hjl hjl 64 Jan 16 16:49 0 -> /dev/null
l-wx------ 1 hjl hjl 64 Jan 16 16:49 1 -> pipe:[14151430]
lr-x------ 1 hjl hjl 64 Jan 16 16:49 10 -> /export/build/gnu/tools-build/x86_64-linux-toolchain/build-x86_64-linux/binutils/src/binutils-build/ld/tmpdir/pr23460c.o
lr-x------ 1 hjl hjl 64 Jan 16 16:49 11 -> /export/build/gnu/tools-build/x86_64-linux-toolchain/build-x86_64-linux/binutils/src/binutils-build/ld/tmpdir/pr23460d.o
lr-x------ 1 hjl hjl 64 Jan 16 16:49 12 -> /export/build/gnu/tools-build/x86_64-linux-toolchain/build-x86_64-linux/binutils/src/binutils-build/ld/tmpdir/pr23460e.o
lr-x------ 1 hjl hjl 64 Jan 16 16:49 13 -> /export/build/gnu/tools-build/x86_64-linux-toolchain/build-x86_64-linux/binutils/src/binutils-build/ld/tmpdir/pr23460f.o
lrwx------ 1 hjl hjl 64 Jan 16 16:49 14 -> /export/build/gnu/tools-build/x86_64-linux-toolchain/build-x86_64-linux/binutils/src/binutils-build/ld/tmpdir/stTLiXpO
lrwx------ 1 hjl hjl 64 Jan 16 16:49 15 -> /export/build/gnu/tools-build/x86_64-linux-toolchain/build-x86_64-linux/binutils/src/binutils-build/ld/tmpdir/stTLiXpO
l-wx------ 1 hjl hjl 64 Jan 16 16:49 2 -> pipe:[14151430]
lr-x------ 1 hjl hjl 64 Jan 16 16:49 3 -> pipe:[13933216]
l-wx------ 1 hjl hjl 64 Jan 16 16:49 4 -> pipe:[13933216]
lr-x------ 1 hjl hjl 64 Jan 16 16:49 5 -> pipe:[13990857]
l-wx------ 1 hjl hjl 64 Jan 16 16:49 6 -> pipe:[13990857]
lr-x------ 1 hjl hjl 64 Jan 16 16:49 7 -> /export/build/gnu/tools-build/x86_64-linux-toolchain/build-x86_64-linux/binutils/src/binutils-build/ld/tmpdir/libpr23460.a
lr-x------ 1 hjl hjl 64 Jan 16 16:49 8 -> /export/build/gnu/tools-build/x86_64-linux-toolchain/build-x86_64-linux/binutils/src/binutils-build/ld/tmpdir/pr23460a.o
lr-x------ 1 hjl hjl 64 Jan 16 16:49 9 -> /export/build/gnu/tools-build/x86_64-linux-toolchain/build-x86_64-linux/binutils/src/binutils-build/ld/tmpdir/pr23460b.o
PR binutils/23460
* testsuite/ld-plugin/lto.exp: Increase the max number of open
files to 20 for PR binutils/23460 test.
|
|
|
|
On x86, glibc 2.33 starts to issue a fatal error message when calling
IFUNC function defined in the unrelocated executable from a shared
library.
1. Update x86 ELF linker to always convert IFUNC function defined in
position-dependent executable (PDE) to the normal function. GOT in PDE
will be updated by R_*_IRELATIVE at run-time.
2. Update PR ld/23169 tests not to compare function address of external
IFUNC function in the shared object to avoid calling the IFUNC function
defined in the unrelocated executable.
3. Remove pr23169e tests which call the IFUNC function defined in the
unrelocated position-independent executable from a shared library.
bfd/
PR ld/23169
* elfxx-x86.c (_bfd_x86_elf_link_fixup_ifunc_symbol): Don't
check pointer_equality_needed.
ld/
PR ld/23169
* testsuite/ld-ifunc/ifunc.exp: Replace pr23169c.rd with
pr23169a.rd for pr23169c and pr23169f. Remove pr23169e tests.
* testsuite/ld-ifunc/pr23169a.c (foo): Don't compare function
address.
|
|
Linker generated relative relocations don't have symbol info:
[hjl@gnu-cfl-2 tmpdir]$ readelf -rW dump
Relocation section '.rela.dyn' at offset 0x180 contains 2 entries:
Offset Info Type Sym. Value Symbol's Name + Addend
00002f70 00000008 R_X86_64_RELATIVE 1000
00002f68 00000025 R_X86_64_IRELATIVE 1007
[hjl@gnu-cfl-2 tmpdir]$
Add -z report-relative-reloc to x86 ELF linker to report dynamic relative
relocations:
[hjl@gnu-cfl-2 tmpdir]$ ../ld-new -pie -melf32_x86_64 -z report-relative-reloc -o dump report-reloc-1.o
dump: R_X86_64_IRELATIVE (offset: 0x00002f68, info: 0x00000025, addend: 0x00001007) against 'ifunc' for section '.data.rel.ro.local' in report-reloc-1.o
dump: R_X86_64_RELATIVE (offset: 0x00002f70, info: 0x00000008, addend: 0x00001000) against '_start' for section '.data.rel.ro.local' in report-reloc-1.o
[hjl@gnu-cfl-2 tmpdir]$
It can be used to map relative relocations to corresponding symbols.
bfd/
* elf-linker-x86.h (elf_linker_x86_params): Add
report_relative_reloc.
* elf32-i386.c (elf_i386_relocate_section): Call
_bfd_x86_elf_link_report_relative_reloc to report relative
relocations for -z report-relative-reloc.
(elf_i386_finish_dynamic_symbol): Likewse.
* elf64-x86-64.c (elf_x86_64_relocate_section): Likewse.
(elf_x86_64_finish_dynamic_symbol): Likewse.
* elfxx-x86.c (_bfd_x86_elf_link_report_relative_reloc): New
function.
* elfxx-x86.h (_bfd_x86_elf_link_report_relative_reloc): New
prototype.
ld/
* NEWS: Mention -z report-relative-reloc.
* ld.texi: Document -z report-relative-reloc.
* emulparams/elf32_x86_64.sh: Source x86-report-relative.sh.
* emulparams/elf_i386.sh: Likewse.
* emulparams/elf_x86_64.sh: Likewse.
* emulparams/x86-report-relative.sh: New file.
* testsuite/ld-i386/report-reloc-1.d: Likewse.
* testsuite/ld-i386/report-reloc-1.l: Likewse.
* testsuite/ld-i386/report-reloc-1.s: Likewse.
* testsuite/ld-x86-64/report-reloc-1-x32.d: Likewse.
* testsuite/ld-x86-64/report-reloc-1.d: Likewse.
* testsuite/ld-x86-64/report-reloc-1.l: Likewse.
* testsuite/ld-x86-64/report-reloc-1.s: Likewse.
* testsuite/ld-i386/i386.exp: Run report-reloc-1.
* testsuite/ld-x86-64/x86-64.exp: Run report-reloc-1 and
report-reloc-1-x32.
|
|
So that no one need worry about the value of Z_OK.
bfd/
* compress.c (decompress_contents): Tidy inflateEnd result test.
binutils/
* readelf.c (uncompress_section_contents): Tidy inflateEnd result test.
|
|
This patch makes undefined unversioned dynamic symbols use
VER_NDX_GLOBAL (version 1) rather than VER_NDX_LOCAL (version 0).
There really isn't much use for an undefined local dynamic symbol, so
we may as well use the logically correct value in .gnu.version.
https://docs.oracle.com/cd/E26505_01/html/E26506/chapter6-54676.html
bfd/
PR 26002
* elflink.c (elf_link_output_extsym): Use version 1 in
.gnu.version for undefined unversioned symbols.
ld/
PR 26002
* testsuite/ld-elfvers/vers6.dsym: Expect "Base" for undefined
unversioned symbols.
* testsuite/ld-elfvers/vers16.dsym: Likewise.
|
|
Now that all port tests live under testsuite/sim/*/, and none live
in testsuite/ directly, flatten the structure by moving all of the
dirs under testsuite/sim/ to testsuite/ directly.
We need to stop passing --tool to dejagnu so that it searches all
dirs and not just ones that start with "sim". Since we have no
other dirs in this tree, and no plans to add any, should be fine.
|