This patch fixes the errors below:
Running /home/yao/SourceCode/gnu/gdb/git/gdb/testsuite/gdb.arch/thumb-prologue.exp ...
gdb compile failed, arm-linux-gnueabihf/bin/ld: cannot open output file /scratch/yao/gdb/build-git/arm-linux-gnueabihf/gdb/testsuite/gdb.arch/thumb-prologue: No such file or directory
collect2: error: ld returned 1 exit status
Running /home/yao/SourceCode/gnu/gdb/git/gdb/testsuite/gdb.arch/thumb2-it.exp ...
gdb compile failed, arm-linux-gnueabihf/bin/ld: cannot open output file /scratch/yao/gdb/build-git/arm-linux-gnueabihf/gdb/testsuite/gdb.arch/thumb2-it: No such file or directory
gdb/testsuite:
2016-05-23 Yao Qi <yao.qi@linaro.org>
* gdb.arch/thumb-prologue.exp: Use standard_testfile.
* gdb.arch/thumb2-it.exp: Likewise.
Some fast tracepoints tests make sure that the in-process agent library
is properly loaded, by searching for the library name in "info
sharedlibrary".
Originally, it would search for the full path. Since patch "Make ftrace
tests work with remote targets" [1], the "runtime" location of the IPA,
in the standard output directory, is not the same as the original
location, in the gdbserver build directory. Therefore, the patch
changed the checks:
gdb_test "info sharedlibrary" ".*${libipa}.*" "IPA loaded"
to
gdb_test "info sharedlibrary" ".*[file tail ${libipa}].*" "IPA loaded"
so that only the "libinproctrace.so" part would be searched for.
Antoine (in CC) pointed out that I missed some, so I have to update
them. In the mean time, I noticed that I missed a few test failures:
adding the SONAME to the IPA makes it possible for the test executable
to erroneously pick up libinproctrace.so from /usr/lib if the test
harness failed to put the libinproctrace.so we want to test in the right
place. To mitigate that kind of error in the future, we can use the
return value of gdb_load_shlib (the path of the "runtime" version of the
library) and use that to search in the output of info sharedlibrary.
When testing locally, gdb_load_shlib returns the full normalized path of
the destination library, which the test executable should use e.g.:
/path/to/gdb/testsuite/outputs/gdb.trace/thetest/libinproctrace.so
My testing showed that it was the same path that gdb displayed in info
sharedlibrary. If the test executable picks up another
libinproctrace.so, the test will fail.
When testing remotely, gdb_load_shlib/gdb_remote_download only returns
us "libinproctrace.so", so the situation doesn't really change. If
there is a rogue libinproctrace.so in /usr/lib on the target and we fail
to download ours, it might cover up a test failure. But that situation
is probably still better than the original one, where it wasn't possible
to test remotely using the IPA at all.
[1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=6e774b13c3b81ac2599812adf058796948ce7e95
gdb/testsuite/ChangeLog:
* gdb.arch/ftrace-insn-reloc.exp: Save gdb_load_shlib result,
use it in info sharedlibrary test.
* gdb.trace/ftrace-lock.exp: Likewise.
* gdb.trace/ftrace.exp: Likewise.
* gdb.trace/range-stepping.exp: Likewise.
* gdb.trace/trace-break.exp: Likewise.
* gdb.trace/trace-condition.exp: Likewise.
* gdb.trace/trace-mt.exp: Likewise.
In commit 6e774b13c3, I forgot to update this test.
gdb/testsuite/ChangeLog:
* gdb.arch/ftrace-insn-reloc.exp: Check for IPA basename instead of
absolute.
Pass "debug" to prepare_for_testing otherwise, some tests fail.
gdb/testsuite:
2016-03-29 Yao Qi <yao.qi@linaro.org>
* gdb.arch/arm-neon.exp: Pass debug to prepare_for_testing.
Since test artifacts are organized in a directory hierarchy, the
s390-multiarch test case is not executed correctly any more. This is
because it uses an obsolete way of constructing the output paths.
This fix invokes standard_testfile instead.
gdb/testsuite/ChangeLog:
* gdb.arch/s390-multiarch.exp: Use standard_testfile instead of
maintaining separate logic for constructing the output path.
This patch fixes the following error,
ERROR: (/scratch/yao/gdb/build-git/arm-linux-gnueabihf/gdb/testsuite/outputs/gdb.arch/arm-disp-step/arm-disp-step) No such file or directory
FAIL: gdb.arch/arm-disp-step.exp: Can't run to main
gdb/testsuite:
2016-03-01 Yao Qi <yao.qi@linaro.org>
* gdb.arch/arm-disp-step.exp: Use standard_testfile and
prepare_for_testing.
When we compile gdb.arch/arm-neon.c with options that don't enable NEON,
there are many error/warnings emitted into gdb.sum, which is annoying.
This patch fixes it by passing quiet to prepare_for_testing.
gdb/testsuite:
2016-03-01 Yao Qi <yao.qi@linaro.org>
* gdb.arch/arm-neon.exp: Pass quiet to prepare_for_testing.
Since test artifacts are always organized in a directory hierarchy, the
s390-tdbregs test case is not executed correctly any more. This is
because it uses an obsolete way of constructing the executable's path.
This change invokes prepare_for_testing instead.
gdb/testsuite/ChangeLog:
* gdb.arch/s390-tdbregs.exp: Use prepare_for_testing instead of
manually constructing the output path.
This fixes a GDB internal error that may occur when the inferior has no
valid stack pointer in r15.
gdb/testsuite/ChangeLog:
* gdb.arch/s390-stackless.S: New.
* gdb.arch/s390-stackless.exp: New.
gdb/ChangeLog:
* s390-linux-tdep.c (s390_backchain_frame_unwind_cache): Avoid
exception when attempting to access the inferior's backchain.
With Intel Memory Protection Extensions it was introduced the concept of
boundary violation. A boundary violations is presented to the inferior as
a segmentation fault having SIGCODE 3. This patch adds a
handler for a boundary violation extending the information displayed
when a bound violation is presented to the inferior. In the stop mode
case the debugger will also display the kind of violation: "upper" or
"lower", bounds and the address accessed.
On no stop mode the information will still remain unchanged. Additional
information about bound violations are not meaningful in that case user
does not know the line in which violation occurred as well.
When the segmentation fault handler is stop mode the out puts will be
changed as exemplified below.
The usual output of a segfault is:
Program received signal SIGSEGV, Segmentation fault
0x0000000000400d7c in upper (p=0x603010, a=0x603030, b=0x603050,
c=0x603070, d=0x603090, len=7) at i386-mpx-sigsegv.c:68
68 value = *(p + len);
In case it is a bound violation it will be presented as:
Program received signal SIGSEGV, Segmentation fault
Upper bound violation while accessing address 0x7fffffffc3b3
Bounds: [lower = 0x7fffffffc390, upper = 0x7fffffffc3a3]
0x0000000000400d7c in upper (p=0x603010, a=0x603030, b=0x603050,
c=0x603070, d=0x603090, len=7) at i386-mpx-sigsegv.c:68
68 value = *(p + len);
In mi mode the output of a segfault is:
*stopped,reason="signal-received",signal-name="SIGSEGV",
signal-meaning="Segmentation fault", frame={addr="0x0000000000400d7c",
func="upper",args=[{name="p", value="0x603010"},{name="a",value="0x603030"}
,{name="b",value="0x603050"}, {name="c",value="0x603070"},
{name="d",value="0x603090"},{name="len",value="7"}],
file="i386-mpx-sigsegv.c",fullname="i386-mpx-sigsegv.c",line="68"},
thread-id="1",stopped-threads="all",core="6"
in the case of a bound violation:
*stopped,reason="signal-received",signal-name="SIGSEGV",
signal-meaning="Segmentation fault",
sigcode-meaning="Upper bound violation",
lower-bound="0x603010",upper-bound="0x603023",bound-access="0x60302f",
frame={addr="0x0000000000400d7c",func="upper",args=[{name="p",
value="0x603010"},{name="a",value="0x603030"},{name="b",value="0x603050"},
{name="c",value="0x603070"},{name="d",value="0x603090"},
{name="len",value="7"}],file="i386-mpx-sigsegv.c",
fullname="i386-mpx-sigsegv.c",line="68"},thread-id="1",
stopped-threads="all",core="6"
2016-02-18 Walfred Tedeschi <walfred.tedeschi@intel.com>
gdb/ChangeLog:
* NEWS: Add entry for bound violation.
* amd64-linux-tdep.c (amd64_linux_init_abi_common):
Add handler for segmentation fault.
* gdbarch.sh (handle_segmentation_fault): New.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* i386-linux-tdep.c (i386_linux_handle_segmentation_fault): New.
(SIG_CODE_BONDARY_FAULT): New define.
(i386_linux_init_abi): Use i386_mpx_bound_violation_handler.
* i386-linux-tdep.h (i386_linux_handle_segmentation_fault) New.
* i386-tdep.c (i386_mpx_enabled): Add as external.
* i386-tdep.c (i386_mpx_enabled): Add as external.
* infrun.c (handle_segmentation_fault): New function.
(print_signal_received_reason): Use handle_segmentation_fault.
gdb/testsuite/ChangeLog:
* gdb.arch/i386-mpx-sigsegv.c: New file.
* gdb.arch/i386-mpx-sigsegv.exp: New file.
* gdb.arch/i386-mpx-simple_segv.c: New file.
* gdb.arch/i386-mpx-simple_segv.exp: New file.
gdb/doc/ChangeLog:
* gdb.texinfo (Signals): Add bound violation display hints for
a SIGSEGV.
The testfile has not ran because:
gdb.arch/i386-prologue.c:34:3: warning: implicit declaration of function 'standard' [-Wimplicit-function-declaration]
standard ();
^
gdb.arch/i386-prologue.c:35:3: warning: implicit declaration of function 'stack_align_ecx' [-Wimplicit-function-declaration]
stack_align_ecx ();
^
gdb.arch/i386-prologue.c:36:3: warning: implicit declaration of function 'stack_align_edx' [-Wimplicit-function-declaration]
stack_align_edx ();
^
gdb.arch/i386-prologue.c:37:3: warning: implicit declaration of function 'stack_align_eax' [-Wimplicit-function-declaration]
stack_align_eax ();
^
gdb/testsuite/ChangeLog
2016-02-15 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.arch/i386-prologue.c: Add missing prototypes.
Since
commit 2151ccc56c
Author: Simon Marchi <simon.marchi@ericsson.com>
Date: Mon Feb 8 14:02:36 2016 -0500
Always organize test artifacts in a directory hierarchy
these testfiles could not build.
gdb/testsuite/ChangeLog
2016-02-15 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.arch/i386-gnu-cfi.exp: Use standard_output_file.
* gdb.arch/i386-prologue.exp: Likewise.
* gdb.arch/i386-size.exp: Likewise.
Fix the core file path to use the standard output directory.
gdb/testsuite/ChangeLog:
* i386-biarch-core.exp: Define corefile using
standard_output_file.
GDB step cross kernel helpers only works if the kernel helpers are tail
called, which is the case how it is used in glibc. See __aeabi_read_tp
in sysdeps/unix/sysv/linux/arm/aeabi_read_tp.S. In __aeabi_read_tp,
branch/jump to the kernel helper is the last instruction, and the next
instruction address is in LR, which is in caller function. GDB can
handle this correctly. For example, glibc function __GI___ctype_init
calls __aeabi_read_tp
0xb6e19b30 <__GI___ctype_init+4>: ldr r3, [pc, #80] ;
0xb6e19b34 <__GI___ctype_init+8>: bl 0xb6e0a6e0 <__aeabi_read_tp>
0xb6e19b38 <__GI___ctype_init+12>: ldr r3, [pc, r3]
and __aeabi_read_tp calls kernel helper,
(gdb) disassemble __aeabi_read_tp
0xb6fef5d0 <+0>: mvn r0, #61440 ; 0xf000
0xb6fef5d4 <+4>: sub pc, r0, #31
once GDB or GDBserver single step instruction on 0xb6fef5d4, LR is
0xb6e19b38, which is right address of next instruction to set breakpoint
on.
However, if the kernel helpers are not tail-called, the LR is still the
address in the caller function of kernel helper's caller, which isn't
the right address of next instruction to set breakpoint on. For example,
we use kernel helper in main,
(gdb) disassemble main
....
0x00008624 <+32>: mov r3, #4064 ; 0xfe0^M
0x00008628 <+36>: movt r3, #65535 ; 0xffff^M
0x0000862c <+40>: blx r3
0x00008630 <+44>: ldr r3, [r11, #-8]
kernel helper is called on 0x0000862c and the expected next instruction
address is 0x00008630, but the LR now is the return address of main.
The problem here is LR may not have the right address because when we
single step the instruction, it isn't executed yet, so the LR isn't
updated. This patch fix this problem by decoding instruction, if the
instruction updates LR (BL and BLX), the next instruction address is
PC + INSN_SIZE, otherwise, get the address of next instruction from LR.
gdb:
2016-02-12 Yao Qi <yao.qi@linaro.org>
* arch/arm-linux.c (arm_linux_get_next_pcs_fixup): Calculate
nextpc according to instruction.
gdb/testsuite:
2016-02-12 Yao Qi <yao.qi@linaro.org>
* gdb.arch/arm-single-step-kernel-helper.c: New.
* gdb.arch/arm-single-step-kernel-helper.exp: New.
When running tests in parallel, each test puts its generated files in a
different directory, under "outputs". I think it would be nice if it
was always the case, as it would isolate the test cases a bit more. An
artifact created by a test wouldn't get overwritten by another test.
Also, it makes it easier to clean up. A lot of executables are left all
over the place because their names do not appear in gdb.*/Makefile. If
everything is in "outputs", then we just have to delete that directory
(which we already do).
At the same time it makes the gdb.foo directories and their Makefiles
useless in the build directory, since they are pretty much only used for
cleaning.
What do you think?
gdb/testsuite/ChangeLog:
* Makefile.in (ALL_SUBDIRS): Remove.
(clean mostlyclean): Do not recurse in ALL_SUBDIRS.
(distclean maintainer-clean realclean): Likewise.
* configure.ac (AC_OUTPUT): Remove gdb.*/Makefile.
* configure: Regenerate.
* gdb.ada/Makefile.in: Delete.
* gdb.arch/Makefile.in: Likewise.
* gdb.asm/Makefile.in: Likewise.
* gdb.base/Makefile.in: Likewise.
* gdb.btrace/Makefile.in: Likewise.
* gdb.cell/Makefile.in: Likewise.
* gdb.compile/Makefile.in: Likewise.
* gdb.cp/Makefile.in: Likewise.
* gdb.disasm/Makefile.in: Likewise.
* gdb.dlang/Makefile.in: Likewise.
* gdb.dwarf2/Makefile.in: Likewise.
* gdb.fortran/Makefile.in: Likewise.
* gdb.gdb/Makefile.in: Likewise.
* gdb.go/Makefile.in: Likewise.
* gdb.guile/Makefile.in: Likewise.
* gdb.java/Makefile.in: Likewise.
* gdb.linespec/Makefile.in: Likewise.
* gdb.mi/Makefile.in: Likewise.
* gdb.modula2/Makefile.in: Likewise.
* gdb.multi/Makefile.in: Likewise.
* gdb.objc/Makefile.in: Likewise.
* gdb.opencl/Makefile.in: Likewise.
* gdb.opt/Makefile.in: Likewise.
* gdb.pascal/Makefile.in: Likewise.
* gdb.perf/Makefile.in: Likewise.
* gdb.python/Makefile.in: Likewise.
* gdb.reverse/Makefile.in: Likewise.
* gdb.server/Makefile.in: Likewise.
* gdb.stabs/Makefile.in: Likewise.
* gdb.threads/Makefile.in: Likewise.
* gdb.trace/Makefile.in: Likewise.
* gdb.xml/Makefile.in: Likewise.
* lib/gdb.exp (make_gdb_parallel_path): Add check for
GDB_PARALLEL.
(standard_output_file): Remove check for GDB_PARALLEL, always
return path in outputs/$subdir/$testname.
When `info float` is used on an AMD64 system, GDB prints
floating-point values of x87 registers with raw contents like
0x361a867a8e0527397ce0 or 0xc4f988454a1ddd3cfdab wrongly.
This happens due to truncation to double, after which the former
becomes 0.0, and the latter becomes negative infinity. This is caused
by failed detection of x86-64 host, which results in setting
gdb_host_{float,double,long_double}_format to zeros.
This commit fixes this misdetection, and adds a test to make sure
future commits don't introduce a regression here.
gdb/ChangeLog:
2015-12-09 Ruslan Kabatsayev <b7.10110111@gmail.com>
PR gdb/18702
* configure.host: Fix detection of x86_64 host when setting
floatformats.
gdb/testsuite/ChangeLog:
2015-12-09 Ruslan Kabatsayev <b7.10110111@gmail.com>
Pedro Alves <pedro@redhat.com>
PR gdb/18702
Add checking of floatformats setup on x86_64 hosts.
* gdb.arch/i386-float.S (main): Load bigval and smallval.
(smallval, bigval): New labels/constants.
* gdb.arch/i386-float.exp: Use with_test_prefix and test "info
float" after loading bigval and smallval.
Both ARM and AArch64 have defined some SIMD data types in arm_neon.h,
but we don't have a test case for passing them and returning them in
inferior call. This test also covers passing and returning
homogeneous short vector aggregate (defined by AArch64 ABI document)
in inferior call too.
gdb/testsuite:
* gdb.arch/arm-neon.exp: New.
* gdb.arch/arm-neon.c: New.
This patch adds a missing include that makes the test program to not
be built (--Wimplicit-function-declaration).
gdb/testsuite/ChangeLog:
2015-11-20 Jose E. Marchesi <jose.marchesi@oracle.com>
* gdb.arch/sparc-sysstep.c: Include unistd.h for getpid.
Some of the source code for the test cases in the GDB testsuite
reside in .S files containing assembly code. These files typically
define a symbol - such as main - which may, depending on the target,
require a prefix such as underscore.
For example, gdb.dwarf2/dw-compdir-oldgcc.S defines the symbol main:
main: .globl main
Some targets, such as rx-elf, require main to have an underscore
prefix. (If it doesn't, a linker error results due to not being able
to find _main required by crt0.o.) So, instead, the above should look
like this for rx-elf and other targets with this same requirement:
_main: .globl _main
This patch defines a new tcl proc in lib/gdb named
gdb_target_symbol_prefix_flags_asm. This proc returns a string
which will - assuming everything else is wired up correctly - cause
-DSYMBOL_PREFIX=_ to be passed on the command line to the compiler.
The test cases are augmented with a macro definition for SYMBOL
as follows:
#define CONCAT1(a, b) CONCAT2(a, b)
#define CONCAT2(a, b) a ## b
#ifdef SYMBOL_PREFIX
# define SYMBOL(str) CONCAT1(SYMBOL_PREFIX, str)
#else
# define SYMBOL(str) str
#endif
Symbols, such as main shown in the example earlier are then wrapped
with SYMBOL like this:
SYMBOL(main): .globl SYMBOL(main)
The net effect will be to add a prefix for those targets which need
it and add no prefix for those targets which do not.
It should be noted that there was already a proc in lib/gdb.exp
called gdb_target_symbol_prefix_flags. It still exists, but has
been significantly rewritten. (There is only one small difference
between the two versions.)
That proc used to explicitly list targets which were known to
require an underscore prefix. This is no longer done; the recently
added proc, gdb_target_symbol_prefix, is now invoked to dynamically
discover whether or not a prefix is required for that particular
target.
The difference between gdb_target_symbol_prefix_flags_asm
and gdb_target_symbol_prefix_flags is that the former returns
a bare prefix while the latter returns the prefix enclosed in
double quotes. I.e. assuming that the discovered prefix is
underscore, gdb_target_symbol_prefix_flags_asm returns:
additional_flags=-DSYMBOL_PREFIX=_
while gdb_target_symbol_prefix_flags returns:
additional_flags=-DSYMBOL_PREFIX="_"
The double-quoted version is not suitable for using with .S files
containing assembly code; there is no way to strip the double quotes
using C preprocessor constructs.
It would be possible to use the bare (non double quoted) version in
C source code. However, the supporting macros become more complicated
and therefore more difficult to maintain.
gdb/testsuite/ChangeLog:
* lib/gdb (gdb_target_symbol_prefix_flags_asm): New proc.
(gdb_target_symbol_prefix_flags): Define in terms of _asm
version.
* gdb.arch/i386-float.exp, gdb.arch/i386-permbkpt.exp,
gdb.dwarf2/dw2-canonicalize-type.exp,
gdb.dwarf2/dw2-compdir-oldgcc.exp, gdb.dwarf2/dw2-minsym-in-cu.exp,
gdb.dwarf2/dw2-op-stack-value.exp, gdb.dwarf2/dw2-unresolved.exp,
gdb.dwarf2/fission-reread.exp, gdb.dwarf2/pr13961.exp: Use flags
provided by gdb_target_symbol_prefix_flags_asm.
* gdb.dwarf2/dw2-canonicalize-type.S, gdb.dwarf2/dw2-compdir-oldgcc.S,
testsuite/gdb.dwarf2/dw2-minsym-in-cu.S,
testsuite/gdb.dwarf2/dw2-unresolved-main.c,
testsuite/gdb.dwarf2/dw2-unresolved.S, gdb.dwarf2/fission-reread.S,
gdb.dwarf2/pr13961.S: Define and use SYMBOL macro (and supporting
macros where needed). Use this macro for symbols which require
the prefix provided by SYMBOL_PREFIX.
The breakpoint presented in the return statement was not activated while
compiling the test with gcc 4.9.2. Added a dummy statement to allow the
breakpoint again.
2015-10-14 Walfred Tedeschi <walfred.tedeschi@intel.com>
gdb/testsuite:
* i386-mpx-map.c (foo): Add dummy statement to trigger breakpoint.
Change-Id: I5293ca1c7f82a631e1e41cb650c30dd2d09ef3c2
Signed-off-by: Walfred Tedeschi <walfred.tedeschi@intel.com>
Adapts tests to use actual GCC flags, previous used flags were
related to an internal GCC release.
2015-06-18 Walfred Tedeschi <walfred.tedeschi@intel.com>
gdb/testsuite:
* gdb.arch/i386-mpx-map.exp (comp_flags): Use released GCC flags.
* gdb.arch/i386-mpx.exp (comp_flags): Use released GCC flags.
Change-Id: Id4c4551693a8df071ed4b71bb5dfb46a526ed5db
Signed-off-by: Walfred Tedeschi <walfred.tedeschi@intel.com>
This patch adds a new test case which uses gdb.arch/insn-reloc.c too
to test displaced stepping. Nowadays, tests are for x86, x86_64 and
aarch64.
gdb/testsuite:
2015-10-12 Yao Qi <yao.qi@linaro.org>
* gdb.arch/disp-step-insn-reloc.exp: New test case.
This patch adds more tests in gdb.arch/insn-reloc.c to cover
instruction BL and cover B.CON when CON is false. These new added
tests can be used for displaced stepping too.
gdb/testsuite:
2015-10-12 Yao Qi <yao.qi@linaro.org>
* gdb.arch/insn-reloc.c (can_relocate_bcond): Rename to ...
(can_relocate_bcond_true): ... it.
(can_relocate_bcond_false): New function.
(foo): Likewise.
(can_relocate_bl): Likewise.
(testcases) [__aarch64__]: Add can_relocate_bcond_false and
can_relocate_bl.
This test case makes sure that relocating PC relative instructions does
not change their behaviors. All PC relative AArch64 instructions are
covered. While call and jump (32 bit relative) instructions are covered
on x86.
The test case creates a static array of function pointers for each
supported architecture. Each function in this array tests a specific
instruction using inline assembly. They all need to contain a symbol in
the form of 'set_point\[0-9\]+' and finish by either calling pass or
fail. The number of 'set_pointN' needs to go from 0 to
(ARRAY_SIZE - 1).
The test will:
- look up the number of function pointers in the static array.
- set fast tracepoints on each 'set_point\[0-9\]+' symbol, one in each
functions from 0 to (ARRAY_SIZE - 1).
- run the trace experiment and make sure the pass function is called for
every function.
gdb/testsuite/ChangeLog:
* gdb.arch/insn-reloc.c: New file.
* gdb.arch/ftrace-insn-reloc.exp: New file.
The ppc64 displaced step code can't handle atomic sequences. Fallback
to stepping over the breakpoint in-line if we detect one.
gdb/ChangeLog:
2015-08-07 Pedro Alves <palves@redhat.com>
* infrun.c (displaced_step_prepare_throw): Return -1 if
gdbarch_displaced_step_copy_insn returns NULL. Update intro
comment.
* rs6000-tdep.c (LWARX_MASK, LWARX_INSTRUCTION, LDARX_INSTRUCTION)
(STWCX_MASK, STWCX_INSTRUCTION, STDCX_INSTRUCTION): Move higher up
in file.
(ppc_displaced_step_copy_insn): New function.
(ppc_displaced_step_fixup): Update comment.
(rs6000_gdbarch_init): Install ppc_displaced_step_copy_insn as
gdbarch_displaced_step_copy_insn hook.
* gdbarch.sh (displaced_step_copy_insn): Document what happens on
NULL return.
* gdbarch.h: Regenerate.
gdb/testsuite/ChangeLog:
2015-08-07 Pedro Alves <palves@redhat.com>
* gdb.arch/ppc64-atomic-inst.exp (do_test): New procedure, move
tests here.
(top level): Run do_test with and without displaced stepping.
This new test fails on i686 buildbot slaves,
(gdb) core-file /home/gdb-buildbot-2/fedora-x86-64-2/fedora-i686/build/gdb/testsuite/gdb.arch/i386-biarch-core.core
"/home/gdb-buildbot-2/fedora-x86-64-2/fedora-i686/build/gdb/testsuite/gdb.arch/i386-biarch-core.core"
is not a core dump: File format not recognized
(gdb) FAIL: gdb.arch/i386-biarch-core.exp: core-file
There are two problems:
(1) The testcase did not really test if elf64-i386 is supported by GDB (BFD).
That was OK for a Fedora testcase but I forgot about it when submitting it
upstream.
I haven't really verified if the GNU target is elf64-little but it seems so,
no other one seems suitable from:
elf32-x86-64
elf64-big
elf64-k1om
elf64-l1om
elf64-little
elf64-x86-64
pei-x86-64
(2) The output of the "core-file" command itself can be arbitrary as the
elf64-i386 file with x86_64 registers is really broken; but that does not
matter much, important is the following test whether core file memory is
readable.
./configure --enable-64-bit-bfd
(gdb) core-file /home/jkratoch/redhat/gdb-test-build32-plus64/gdb/testsuite/gdb.arch/i386-biarch-core.core^M
warning: Couldn't find general-purpose registers in core file.^M
Failed to read a valid object file image from memory.^M
warning: Couldn't find general-purpose registers in core file.^M
#0 <unavailable> in ?? ()^M
(gdb) FAIL: gdb.arch/i386-biarch-core.exp: core-file
x/i 0x400078^M
0x400078: hlt ^M
(gdb) PASS: gdb.arch/i386-biarch-core.exp: .text is readable
I do not know much dejagnu but I expect 'istarget' tests against the site.exp
'target_triplet' content which is set to the primary GDB target
(--target=...).
GDB is normally never configured for primary target elf64-i386, I think BFD
does not know such explicit target, it gets recognized as elf64-little.
In fact many testfiles of the GDB testsuite are wrong as they require
'istarget' (therefore primary GDB target) even for just loading arch specific
files which would be sufficient with secondary target (--enable-targets=...)
support.
This my new patch removes this 'istarget' check as it is IMO unrelated to what
we need to test. Although you are right we do 'x/i' and test for 'hlt' so
I think we should test also for available 'set architecture i386'.
We could also test by 'x/bx' instead of 'x/i' to avoid such additional
test/requirement.
This testcase comes from a different bug from 2009:
https://bugzilla.redhat.com/show_bug.cgi?id=457187http://pkgs.fedoraproject.org/cgit/gdb.git/commit/?id=94cd124608bf0dd359cb48a710800d72c21b30c3
That bug has been fixed in the meantime but the same testcase was reproducing
this new different bug - internal error regression - so I submitted it.
We can remove the "x/bx $address" test but it was useful for the previous bug
from 2009 as that time the internal error regression did not happen, just the
core file was not recognized (which would not be detected by the proposed
ignoring of the "core-file" command output) and so the core file was not
available. That can be tested by the "x/bx $address" test.
gdb/testsuite/ChangeLog
2015-07-16 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.arch/i386-biarch-core.exp: Replace istarget
by "complete set gnutarget". Remove expectation for the "core-file"
command.
Some tests expect the the target is aarch64, but checking target
triplet is not accurate, because target triplet can be aarch64 but
the program is in arm (or aarch32) state.
This patch addes a new proc is_aarch64_target which returns true
if the target is on aarch64 state.
gdb/testsuite:
2015-07-07 Yao Qi <yao.qi@linaro.org>
* gdb.arch/aarch64-atomic-inst.exp: Check is_aarch64_target
instead of istarget "aarch64*-*-*".
* gdb.arch/aarch64-fp.exp: Likewise.
* gdb.base/float.exp: Likewise.
* gdb.reverse/aarch64.exp: Likewise.
* lib/gdb.exp (is_aarch64_target): New proc.
GDB tests running on arm target should be also run on aarch32
(32-bit mode on aarch64). There should be no difference. It is not
precise to check target triplet to decide which tests should be run,
because if I compiler all the test binary in 32-bit (arm program),
but target triplet is still aarch64, so that these arm specific tests
are skipped.
This patch is to add a new proc is_aarch32_target which return true
if target triplet is arm or the test binary is compiled for arm.
gdb/testsuite:
2015-07-07 Yao Qi <yao.qi@linaro.org>
* lib/gdb.exp (is_aarch32_target): New proc.
* gdb.arch/arm-bl-branch-dest.exp: Check is_aarch32_target
instead of "istarget "arm*-*-*"".
* gdb.arch/arm-disp-step.exp: Likewise.
* gdb.arch/thumb-bx-pc.exp: Likewise.
* gdb.arch/thumb-prologue.exp: Likewise.
* gdb.arch/thumb-singlestep.exp: Likewise.
* gdb.base/disp-step-syscall.exp: Likewise.
* gdb.base/float.exp: Likewise.
Patch "Do not skip prologue for asm (.S) files" [1] changes GDB's
behaviour on which test gdb.arch/thumb-singlestep.exp depends, so
it causes the fail below:
(gdb) si^M
37 blx foo^M
(gdb) FAIL: gdb.arch/thumb-singlestep.exp: step into foo
the test assumes the program will stop at the instruction after "push"
but it doesn't. The fix to this fail is to do one more single step.
[1] https://sourceware.org/ml/gdb-patches/2015-06/msg00561.html
gdb/testsuite:
2015-07-07 Yao Qi <yao.qi@linaro.org>
* gdb.arch/thumb-singlestep.exp: Do one more single step.
GDB tries to skip prologue for .S files according to .debug_line but it then
places the breakpoint to a location where it is never hit.
This is because #defines in .S files cause prologue skipping which is
completely inappropriate, for s390x:
glibc/sysdeps/unix/syscall-template.S
78:/* This is a "normal" system call stub: if there is an error,
79: it returns -1 and sets errno. */
80:
81:T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)
82: ret
00000000000f4210 T __select
Line Number Statements:
Extended opcode 2: set Address to 0xf41c8
Advance Line by 80 to 81
Copy
Advance PC by 102 to 0xf422e
Special opcode 6: advance Address by 0 to 0xf422e and Line by 1 to 82
Special opcode 34: advance Address by 2 to 0xf4230 and Line by 1 to 83
Advance PC by 38 to 0xf4256
Extended opcode 1: End of Sequence
Compilation Unit @ offset 0x28b3e0:
<0><28b3eb>: Abbrev Number: 1 (DW_TAG_compile_unit)
<28b3ec> DW_AT_stmt_list : 0x7b439
<28b3f0> DW_AT_low_pc : 0xf41c8
<28b3f8> DW_AT_high_pc : 0xf4256
<28b400> DW_AT_name : ../sysdeps/unix/syscall-template.S
<28b423> DW_AT_comp_dir : /usr/src/debug////////glibc-2.17-c758a686/misc
<28b452> DW_AT_producer : GNU AS 2.23.52.0.1
<28b465> DW_AT_language : 32769 (MIPS assembler)
without debuginfo or with debuginfo and the fix - correct address:
(gdb) b select
Breakpoint 1 at 0xf4210
It is also where .dynsym+.symtab point to:
00000000000f4210 T __select
00000000000f4210 W select
with debuginfo, without the fix:
(gdb) b select
Breakpoint 1 at 0xf41c8: file ../sysdeps/unix/syscall-template.S, line 81.
One part is to behave for asm files similar way like for 'locations_valid':
/* Symtab has been compiled with both optimizations and debug info so that
GDB may stop skipping prologues as variables locations are valid already
at function entry points. */
unsigned int locations_valid : 1;
The other part is to extend the 'locations_valid'-like functionality more.
Both minsym_found and find_function_start_sal need to be patched, otherwise
their addresses do not match and GDB regresses on ppc64:
gdb/ChangeLog
2015-06-26 Jan Kratochvil <jan.kratochvil@redhat.com>
* linespec.c (minsym_found): Reset sal.PC for COMPUNIT_LOCATIONS_VALID
and language_asm..
* symtab.c (find_function_start_sal): Likewise.
gdb/testsuite/ChangeLog
2015-06-26 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.arch/amd64-prologue-skip.S: New file.
* gdb.arch/amd64-prologue-skip.exp: New file.
The following patch fixed the assembly / disassembly of the rfebb instruction:
https://sourceware.org/ml/binutils/2015-06/msg00190.html
This patch updates the gdb testsuite to match the new disassembly behavior.
gdb/testsuite/
* gdb.arch/powerpc-power.exp <rfebb>: Fixup test results.
* gdb.arch/powerpc-power.s <rfebb>: Likewise.
Intel(R) Memory protection bound information are located in register
to be tested using the MPX new instructions. Since the number of
bound registers are limited a table is used to provide storage for
bounds during run-time.
In order to investigate the contents of the MPX bound table two new
commands are added to GDB. "show mpx bound" and "set mpx bound" are
used to display and set values on the MPX bound table.
2015-04-20 Walfred Tedeschi <walfred.tedeschi@intel.com>
Mircea Gherzan <mircea.gherzan@intel.com>
* i386-tdep.c (MPX_BASE_MASK, MPX_BD_MASK, MPX_BT_MASK, MPX_BD_MASK_32,
MPX_BT_MASK_32): New macros.
(i386_mpx_set_bounds): New function that implements
the command "set-mpx-bound".
(i386_mpx_enabled) Helper function to test MPX availability.
(i386_mpx_bd_base) Helper function to calculate the base directory
address. (i386_mpx_get_bt_entry) Helper function to access a bound
table entry. (i386_mpx_print_bounds) Effectively display bound
information. (_initialize_i386_tdep): Qdd new commands
to commands "set mpx" and "show mpx". (_initialize_i386_tdep):
Add "bound" to the commands "show mpx" and "set mpx" commands.
(mpx_set_cmdlist and mpx_show_cmdlist):
list for the new prefixed "set mpx" and "show mpx" commands.
* NEWS: List new commands for MPX support.
testsuite:
* gdb.arch/i386-mpx-map.c: New file.
* gdb.arch/i386-mpx-map.exp: New File.
doc:
* gdb.texinfo (i386): Add documentation about "show mpx bound"
and "set mpx bound".
Skips the MPX register test in case target is not Intel.
Improves the test for MPX feature making MPX and AVX512
tests more similar in terms of initialization.
Indentation was improved on sample file and final return added
to have_mpx. On test file identation was improved and
gdb_send was exchanged by gdb_test_multiple.
2015-06-08 Walfred Tedeschi <walfred.tedeschi@intel.com>
gdb/testsuite
* gdb.arch/i386-mpx.c: Added final return to the have_mpx
function and improved indentation.
* gdb.arch/i386-mpx.exp: Exchanging gdb_send and gdb_expect for
gdb_test_multiple. Added additional tests to skip the test.
Changes on the path for i386-cpuid.h file lead to failure in compiling
tests for AVX512 and MPX.
2015-06-08 Walfred Tedeschi <walfred.tedeschi@intel.com>
gdb/testsuite
* gdb.arch/i386-avx512.c: Change path in include file.
* gdb.arch/i386-avx512.exp: Change include dir path
compilation flag.
* gdb.arch/i386-mpx.c: Change path in include file.
* gdb.arch/i386-mpx.exp: Change include dir path compilation
flag.
Initially there is some chain (let's say the longest one
but that doe snot matter). Consequently its elements from the middle are
being removed and there remains only some few unambiguous top and bottom ones.
The original idea why the comparison should be sharp ("<") was that if there
are multiple chains like (0xaddr show jmp instruction address):
main(0x100) -> a(0x200) -> d(0x400)
main(0x100) -> a(0x200) -> c(0x300) -> d(0x400)
then - such situation cannot exist - if two jmp instructions in "a" have the
same address they must also jump to the same address (*).
(*) jump to a computed address would be never considered for the DWARF
tail-call records.
So there could be:
main(0x100) -> a(0x200) -> d(0x400)
main(0x100) -> a(0x270) -> c(0x300) -> d(0x400)
But then "a" frame itself is ambiguous and it must not be displayed.
I did not realize that there can be self-tail-call:
main(0x100) -> a(0x200) -> d(0x400)
main(0x100) -> a(0x280) -> a(0x200) -> d(0x400)
which intersects to:
main(0x100) -> <???>? -> a(0x200) -> d(0x400)
And so if the first chain was chosen the
main(0x100) -> a(0x200) -> d(0x400)
then the final intersection has callers+callees==length.
> for example, if CALLERS is 3 and
> CALLEES is 2, what does the chain look like?
main(0x100) -> x(0x150) -> y(0x200) -> <???>? -> a(0x200) -> d(0x400)
And if LENGTH is 7 then:
call_site[0] = main(0x100)
call_site[1] = x(0x150)
call_site[2] = y(0x200)
call_site[3] = garbage
call_site[4] = garbage
call_site[5] = a(0x200)
call_site[6] = d(0x400)
gdb/ChangeLog
2015-06-01 Andreas Schwab <schwab@linux-m68k.org>
Jan Kratochvil <jan.kratochvil@redhat.com>
PR symtab/18392
* dwarf2-frame-tailcall.c (pretended_chain_levels): Correct
assertion.
* dwarf2loc.c (chain_candidate): Likewise.
gdb/testsuite/ChangeLog
2015-06-01 Jan Kratochvil <jan.kratochvil@redhat.com>
PR symtab/18392
* gdb.arch/amd64-tailcall-self.S: New file.
* gdb.arch/amd64-tailcall-self.c: New file.
* gdb.arch/amd64-tailcall-self.exp: New file.
The test case s390-vregs.exp yields compile errors on 31-bit targets
as well as when using a GCC that defaults to an older "-march=". This
patch fixes these issues.
gdb/testsuite/ChangeLog:
* gdb.arch/s390-vregs.S (change_vrs): Replace exrl by an
appropriate .insn, such that an older assembler can be used.
* gdb.arch/s390-vregs.exp: Add the compile flag -mzarch, to enable
the z/Architecture instruction set on 31-bit targets as well.
Recent patch series "V2 All-stop on top of non-stop" causes a SIGSEGV
in the test case,
> -PASS: gdb.base/info-shared.exp: continue to breakpoint: library function #4
> +FAIL: gdb.base/info-shared.exp: continue to breakpoint: library function #4
>
> continue^M
> Continuing.^M
> ^M
> Program received signal SIGSEGV, Segmentation fault.^M
> 0x40021564 in ?? () gdb/testsuite/gdb.base/info-shared-solib1.so^M
> (gdb) FAIL: gdb.base/info-shared.exp: continue to breakpoint: library function #4
and an ARM displaced stepping bug is exposed. It can be reproduced by
the modified gdb.arch/arm-disp-step.exp as below,
continue^M
Continuing.^M
^M
Program received signal SIGSEGV, Segmentation fault.^M
0xa713cfcc in ?? ()^M
(gdb) FAIL: gdb.arch/arm-disp-step.exp: continue to breakpoint: continue to test_add_rn_pc_end
This patch is to fix it.
gdb:
2015-04-10 Yao Qi <yao.qi@linaro.org>
* arm-tdep.c (install_alu_reg): Update comment.
(thumb_copy_alu_reg): Remove local variable rn. Update
debugging message. Use r2 instead of r1 in the modified
instruction.
gdb/testsuite:
2015-04-10 Yao Qi <yao.qi@linaro.org>
* gdb.arch/arm-disp-step.S (main): Call test_add_rn_pc.
(test_add_rn_pc): New function.
* gdb.arch/arm-disp-step.exp (test_add_rn_pc): New proc.
(top level): Invoke test_add_rn_pc.
The attached patch fixes the SEGV and lets GDB successfully
load all kernel modules installed by default on RHEL 7.
Valgrind on F-21 x86_64 host has shown me more clear what is the problem:
Reading symbols from /home/jkratoch/t/cordic.ko...Reading symbols from
/home/jkratoch/t/cordic.ko.debug...=================================================================
==22763==ERROR: AddressSanitizer: heap-use-after-free on address 0x6120000461c8 at pc 0x150cdbd bp 0x7fffffffc7e0 sp 0x7fffffffc7d0
READ of size 8 at 0x6120000461c8 thread T0
#0 0x150cdbc in ppc64_elf_get_synthetic_symtab /home/jkratoch/redhat/gdb-test-asan/bfd/elf64-ppc.c:3282
#1 0x8c5274 in elf_read_minimal_symbols /home/jkratoch/redhat/gdb-test-asan/gdb/elfread.c:1205
#2 0x8c55e7 in elf_symfile_read /home/jkratoch/redhat/gdb-test-asan/gdb/elfread.c:1268
[...]
0x6120000461c8 is located 264 bytes inside of 288-byte region [0x6120000460c0,0x6120000461e0)
freed by thread T0 here:
#0 0x7ffff715454f in __interceptor_free (/lib64/libasan.so.1+0x5754f)
#1 0xde9cde in xfree common/common-utils.c:98
#2 0x9a04f7 in do_my_cleanups common/cleanups.c:155
#3 0x9a05d3 in do_cleanups common/cleanups.c:177
#4 0x8c538a in elf_read_minimal_symbols /home/jkratoch/redhat/gdb-test-asan/gdb/elfread.c:1229
#5 0x8c55e7 in elf_symfile_read /home/jkratoch/redhat/gdb-test-asan/gdb/elfread.c:1268
[...]
previously allocated by thread T0 here:
#0 0x7ffff71547c7 in malloc (/lib64/libasan.so.1+0x577c7)
#1 0xde9b95 in xmalloc common/common-utils.c:41
#2 0x8c4da2 in elf_read_minimal_symbols /home/jkratoch/redhat/gdb-test-asan/gdb/elfread.c:1147
#3 0x8c55e7 in elf_symfile_read /home/jkratoch/redhat/gdb-test-asan/gdb/elfread.c:1268
[...]
SUMMARY: AddressSanitizer: heap-use-after-free /home/jkratoch/redhat/gdb-test-asan/bfd/elf64-ppc.c:3282 ppc64_elf_get_synthetic_symtab
[...]
==22763==ABORTING
A similar case a few lines later I have fixed in 2010 by:
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=3f1eff0a2c7f0e7078f011f55b8e7f710aae0cc2
My testcase does not always reproduce it but at least a bit:
* GDB without ppc64 target (even as a secondary one) is reported as "untested"
* ASAN-built GDB with ppc64 target always crashes (and PASSes with this fix)
* unpatched non-ASAN-built GDB with ppc64 target crashes from commandline
* unpatched non-ASAN-built GDB with ppc64 target PASSes from runtest (?)
gdb/ChangeLog
2015-02-26 Jan Kratochvil <jan.kratochvil@redhat.com>
* elfread.c (elf_read_minimal_symbols): Use bfd_alloc for
bfd_canonicalize_symtab.
gdb/testsuite/ChangeLog
2015-02-26 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.arch/cordic.ko.bz2: New file.
* gdb.arch/cordic.ko.debug.bz2: New file.
* gdb.arch/ppc64-symtab-cordic.exp: New file.
gdb/testsuite/ChangeLog
2015-02-21 Jan Kratochvil <jan.kratochvil@redhat.com>
PR corefiles/17808
* gdb.arch/i386-biarch-core.core.bz2: New file.
* gdb.arch/i386-biarch-core.exp: New file.
GCC5 defaults to the GNU11 standard for C and warns by default for
implicit function declarations and implicit return types.
https://gcc.gnu.org/gcc-5/porting_to.html
Fixing these issues in the testsuite turns 9 untested and 17 unsupported
testcases into 417 new passes when compiling with GCC5.
gdb/testsuite/ChangeLog:
* gdb.arch/i386-bp_permanent.c (standard): New declaration.
* gdb.base/disp-step-fork.c: Include unistd.h.
* gdb.base/siginfo-obj.c: Include stdio.h.
* gdb.base/siginfo-thread.c: Likewise.
* gdb.mi/non-stop.c: Include unistd.h.
* gdb.mi/nsthrexec.c: Include stdio.h.
* gdb.mi/pthreads.c: Include unistd.h.
* gdb.modula2/unbounded1.c (main): Declare returns int.
* gdb.reverse/consecutive-reverse.c: Likewise.
* gdb.threads/create-fail.c: Include unistd.h.
* gdb.threads/killed.c: Likewise.
* gdb.threads/linux-dp.c: Likewise.
* gdb.threads/non-ldr-exc-1.c: Include stdio.h and string.h.
* gdb.threads/non-ldr-exc-2.c: Likewise.
* gdb.threads/non-ldr-exc-3.c: Likewise.
* gdb.threads/non-ldr-exc-4.c: Likewise.
* gdb.threads/pthreads.c: Include unistd.h.
(main): Declare returns int.
* gdb.threads/tls-main.c (foo): New declaration.
* gdb.threads/watchpoint-fork-mt.c: Define _GNU_SOURCE.
When using aarch64 gdb with gdbserver, floating point registers are
not correctly displayed, as below:
(gdb) info registers fpsr fpcr
fpsr <unavailable>
fpcr <unavailable>
To fix these problems, the missing fpsr and fpcr registers are added
when floating point registers are read/write
Add test for aarch64 floating point
PR server/17457
gdb/gdbserver/
PR server/17457
* linux-aarch64-low.c (AARCH64_FPSR_REGNO): New define.
(AARCH64_FPCR_REGNO): Likewise.
(AARCH64_NUM_REGS): Update to include fpsr/fpcr registers.
(aarch64_fill_fpregset): Add missing fpsr/fpcr registers.
(aarch64_store_fpregset): Likewise.
gdb/testsuite/
PR server/17457
* gdb.arch/aarch64-fp.c: New file.
* gdb.arch/aarch64-fp.exp: New file.
Signed-off-by: Catalin Udma <catalin.udma@freescale.com>
This patch is to use standard_testfile in i386-bp_permanent.exp to replace
existing setting to testfile, srcfile and binfile. So it fixes a problem
in i386-bp_permanent.exp in parallel testing.
$ make -j3 check TESTS='gdb.guile/scm-section-script.exp gdb.arch/i386-bp_permanent.exp'
....
gdb compile failed, /usr/bin/ld: cannot open output file x86/gdb/testsuite/gdb.arch/i386-bp_permanent: No such file or directory
collect2: error: ld returned 1 exit status
gdb/testsuite:
2014-12-05 Yao Qi <yao@codesourcery.com>
* gdb.arch/i386-bp_permanent.exp: Use standard_testfile.