This commit adds a test for the fix of PR 21352.
gdb/testsuite/ChangeLog:
2017-04-05 Sergio Durigan Junior <sergiodj@redhat.com>
PR gdb/21352
* gdb.trace/tsv.exp: Add test for "tsave -r".
I see the following test fail from time to time, due to the racy test
in gdb.threads/thread-specific-bp.exp.
continue -a^M
Continuing.^M
^M
Thread 1 "thread-specific" hit Breakpoint 4, end () at binutils-gdb/gdb/testsuite/gdb.threads/thread-specific-bp.c:29^M
29 }^M
(gdb) [Thread 0x40322460 (LWP 12950) exited]^M
Thread-specific breakpoint 3 deleted - thread 2 no longer in the thread list.^M
FAIL: gdb.threads/thread-specific-bp.exp: non-stop: continue to end (timeout)
This patch changes gdb_test to gdb_test_multiple to match prompt only
instead of both prompt and anchor.
gdb/testsuite:
2017-04-05 Yao Qi <yao.qi@linaro.org>
* gdb.threads/thread-specific-bp.exp (check_thread_specific_breakpoint):
Use gdb_test_multiple, and don't match anchor.
The two-tier lexer in gdb/d-exp.y, which resolves fully qualified names
missed a case where `module.type' was not being classified as one token.
And so when the grammar takes over, it matched the remaining tokens
against the rule `TypeExp . IdentifierExp', where we were expecting to
instead match cast expression `( TypeExp ) UnaryExpression'.
Adding a case for TYPE_CODE_MODULE in type_aggregate_p means that
classify_inner_name will get a chance to lookup the symbol.
This was noticed when using `watch -l', and got the rather confusing
response:
A syntax error in expression, near `) 0x0add4e55'.
So it's been included in the testsuite, along with another test that
does effectively the same expression, but explicitly.
gdb/ChangeLog:
* d-exp.y (type_aggregate_p): Treat TYPE_CODE_MODULE as being
aggregate-like.
gdb/testsuite/ChangeLog:
* gdb.dlang/watch-loc.c: New file.
* gdb.dlang/watch-loc.exp: New file.
$ gdb rustc
Reading symbols from rustc...Reading symbols from /usr/lib/debug/usr/bin/rustc.debug...done.
done.
warning: Invalid entry in .debug_gdb_scripts section
/usr/bin/rustc
Section Headers:
[Nr] Name Type Address Off Size ES Flg Lk Inf Al
[15] .debug_gdb_scripts PROGBITS 00000000000008ed 0008ed 000022 00 AMS 0 0 1
/usr/lib/debug/usr/bin/rustc.debug
Section Headers:
[Nr] Name Type Address Off Size ES Flg Lk Inf Al
[15] .debug_gdb_scripts NOBITS 00000000000008ed 000280 000022 00 AMS 0 0 1
There remains questionable whether bfd_get_section_by_name() should not return
an error for !SEC_LOAD but I haven't investigated that.
gdb/ChangeLog
2017-03-29 Jan Kratochvil <jan.kratochvil@redhat.com>
* auto-load.c (auto_load_section_scripts): Check SEC_HAS_CONTENTS.
gdb/testsuite/ChangeLog
2017-03-29 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.python/py-section-script.exp (sepdebug): New testcases.
Add a prologue analysis that recognizes all instructions that may happen in
compiler-generated prologue, including various stores, core register moves,
subtraction and ENTER_S instruction that does a lot of prologue actions through
microcode.
Testcases cover various prologue scenarios, including instructions that are
spread across multiple 16-bit encodings (for example there are 7 encodings of
store instruction).
gdb/ChangeLog:
yyyy-mm-dd Anton Kolesov <anton.kolesov@synopsys.com>
* arc-tdep.c (arc_frame_cache): Add support for prologue analysis.
(arc_skip_prologue): Likewise.
(arc_make_frame_cache): Likewise.
(arc_pv_get_operand): New function.
(arc_is_in_prologue): Likewise.
(arc_analyze_prologue): Likewise.
(arc_print_frame_cache): Likewise.
(MAX_PROLOGUE_LENGTH): New constant.
gdb/doc/ChangeLog:
yyyy-mm-dd Anton Kolesov <anton.kolesov@synopsys.com>
* gdb.texinfo (Synopsys ARC): Document "set debug arc 2".
gdb/testsuite/ChangeLog:
yyyy-mm-dd Anton Kolesov <anton.kolesov@synopsys.com>
* gdb.arch/arc-analyze-prologue.S: New file.
* gdb.arch/arc-analyze-prologue.exp: Likewise.
Add disassembler helper for GDB, that uses opcodes structure arc_instruction
and adds convenience functions to handle instruction operands. This interface
solves at least those problems with arc_instruction:
* Some instructions, like "push_s", have implicit operands which are not
directly present in arc_instruction.
* Operands of particular meaning, like branch/jump targets, have various
locations and meaning depending on type of branch/target.
* Access to operand value is abstracted into a separate function, so callee
code shouldn't bother if operand value is an immediate value or in a
register.
Testcases included in this commit are fairly limited - they test exclusively
branch instructions, something that will be used in software single stepping.
Most of the other parts of this disassembler helper are tested during prologue
analysis testing.
gdb/ChangeLog:
yyyy-mm-dd Anton Kolesov <anton.kolesov@synopsys.com>
* configure.tgt: Add arc-insn.o.
* arc-tdep.c (arc_delayed_print_insn): Make non-static.
(dump_arc_instruction_command): New function.
(arc_fprintf_disasm): Likewise.
(arc_disassemble_info): Likewise.
(arc_insn_get_operand_value): Likewise.
(arc_insn_get_operand_value_signed): Likewise.
(arc_insn_get_memory_base_reg): Likewise.
(arc_insn_get_memory_offset): Likewise.
(arc_insn_get_branch_target): Likewise.
(arc_insn_dump): Likewise.
(arc_insn_get_linear_next_pc): Likewise.
* arc-tdep.h (arc_delayed_print_insn): Add function declaration.
(arc_disassemble_info): Likewise.
(arc_insn_get_branch_target): Likewise.
(arc_insn_get_linear_next_pc): Likewise.
* NEWS: Mention new "maint print arc arc-instruction".
gdb/doc/ChangeLog:
yyyy-mm-dd Anton Kolesov <anton.kolesov@synopsys.com>
* gdb.texinfo (Synopsys ARC): Add "maint print arc arc-instruction".
gdb/testsuite/ChangeLog:
yyyy-mm-dd Anton Kolesov <anton.kolesov@synopsys.com>
* gdb.arch/arc-decode-insn.S: New file.
* gdb.arch/arc-decode-insn.exp: Likewise.
While at it, decode also properly one-bit flags for %fsr (accrued and
current exception flags were mixed up).
ChangeLog entry:
2017-03-21 Ivo Raisr <ivo.raisr@oracle.com>
PR tdep/20928
* gdb/sparc-tdep.h (gdbarch_tdep) <sparc64_ccr_type>: New field.
* gdb/sparc64-tdep.c (sparc64_ccr_type): New function.
(sparc64_fsr_type): Fix %fsr decoding.
ChangeLog entry for testsuite:
2017-03-21 Ivo Raisr <ivo.raisr@oracle.com>
PR tdep/20928
* gdb.arch/sparc64-regs.exp: New file.
* gdb.arch/sparc64-regs.S: Likewise.
This changes the return type of "gdb.BtraceInstruction.data ()" from
"memoryview" to "buffer" on Python 2.7 and below, similar to what
"gdb.Inferior.read_memory ()" does.
This patch adds tests for the initial rvalue reference support patchset. All
of the new tests are practically mirrored regular references tests and, except
for the demangler ones, are introduced in new files, which are set to be
compiled with -std=gnu++11. Tested are printing of rvalue reference types and
values, rvalue reference parameters in function overloading, demangling of
function names containing rvalue reference parameters, casts to rvalue
reference types, application of the sizeof operator to rvalue reference types
and values, and support for rvalue references within the gdb python module.
gdb/ChnageLog
PR gdb/14441
* NEWS: Mention support for rvalue references in GDB and python.
* doc/gdb.texinfo (C Plus Plus Expressions): Mention that GDB
supports both lvalue and rvalue references.
gdb/testsuite/ChangeLog
PR gdb/14441
* gdb.cp/demangle.exp: Add rvalue reference tests.
* gdb.cp/rvalue-ref-casts.cc: New file.
* gdb.cp/rvalue-ref-casts.exp: New file.
* gdb.cp/rvalue-ref-overload.cc: New file.
* gdb.cp/rvalue-ref-overload.exp: New file.
* gdb.cp/rvalue-ref-params.cc: New file.
* gdb.cp/rvalue-ref-params.exp: New file.
* gdb.cp/rvalue-ref-sizeof.cc: New file.
* gdb.cp/rvalue-ref-sizeof.exp: New file.
* gdb.cp/rvalue-ref-types.cc: New file.
* gdb.cp/rvalue-ref-types.exp: New file.
* gdb.python/py-rvalue-ref-value-cc.cc: New file.
* gdb.python/py-rvalue-ref-value-cc.exp: New file.
This change adds the MI equivalent for the "info sharedlibrary"
command. The command was already partially documented but ignored as
it was not implemented. The new MI command works similarly to the CLI
command, taking an optional regular expression as an argument and
outputting the library information.
I included a test for the new command in mi-solib.exp.
gdb/doc/ChangeLog:
* gdb.texinfo (gdb/mi Symbol Query Commands): Document new MI
command file-list-shared-libraries
(GDB/MI Async Records): Update documentation of library-loaded with new
field.
gdb/ChangeLog:
* NEWS: Add an entry about new '-file-list-shared-libraries' command.
* mi/mi-cmd-file.c (mi_cmd_file_list_shared_libraries):
New function definition.
* mi/mi-cmds.c (mi_cmds): Add -file-list-shared-libraries command.
* mi/mi-cmds.h (mi_cmd_file_list_shared_libraries):
New function declaration.
* mi/mi-interp.c (mi_output_solib_attribs): New Function.
* mi/mi-interp.h: New file.
* solib.c (info_sharedlibrary_command): Replace for loop with
ALL_SO_LIBS macro
* solib.h (update_solib_list): New function declaration.
(so_list_head): Move macro.
* solist.h (ALL_SO_LIBS): New macro.
gdb/testsuite/ChangeLog:
* gdb.mi/mi-solib.exp (test_file_list_shared_libraries):
New procedure.
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
When using mi_gdb_test, if it fails because of the presence of
unexpected output, the error message is only the message passed as
the argument with no indication that there was an unexpected output.
This change adds an additional text to the failure message to
indicate that there was an unexpected output.
gdb/testsuite/ChangeLog:
* lib/mi-support.exp (mi_gdb_test): Add additional message
for unexpected output.
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
The test case examine-backward.exp issues the command "x/-s" after the end
of the first string in TestStrings, but without making sure that this
string is preceded by a string terminator. Thus GDB may spuriously print
some random characters from before that string, and then the test fails.
This patch assures that TestStrings is preceded by a string terminator.
gdb/testsuite/ChangeLog:
* gdb.base/examine-backward.c (Barrier): New character array
constant, to ensure that TestStrings is preceded by a string
terminator.
Recently I fixed a bug that caused a DW_OP_implicit_pointer with non-zero
offset into a DW_OP_implicit_value to be handled incorrectly on big-endian
targets. GDB ignored the offset and copied the wrong bytes:
https://sourceware.org/ml/gdb-patches/2017-01/msg00251.html
But there is still a similar issue when a DW_OP_implicit_pointer points
into a DW_OP_stack_value instead; and again, the offset is ignored. There
is an important difference, though: While implicit values are treated like
blocks of data and anchored at the lowest-addressed byte, stack values
traditionally contain integer numbers and are anchored at the *least
significant* byte. Also, stack values do not come in varying sizes, but
are cut down appropriately when used. Thus, on big-endian targets the
scenario looks like this (higher addresses shown right):
|<- - - - - Stack value - - - - - - ->|
| |
|<- original object ->|
|
| offset ->|####|
^^^^
de-referenced
implicit pointer
(Note how the original object's size influences the position of the
de-referenced implicit pointer within the stack value. This is not the
case for little-endian targets, where the original object starts at offset
zero within the stack value.)
This patch implements the logic indicated in the above diagram and adds an
appropriate test case. A new function dwarf2_fetch_die_type_sect_off is
added; it is used for retrieving the original object's type, so its size
can be determined. That type is passed to dwarf2_evaluate_loc_desc_full
via a new parameter.
gdb/ChangeLog:
* dwarf2loc.c (indirect_synthetic_pointer): Get data type of
pointed-to DIE and pass it to dwarf2_evaluate_loc_desc_full.
(dwarf2_evaluate_loc_desc_full): New parameter subobj_type; rename
byte_offset to subobj_byte_offset. Fix the handling of
DWARF_VALUE_STACK on big-endian targets when coming via an
implicit pointer.
(dwarf2_evaluate_loc_desc): Adjust call to
dwarf2_evaluate_loc_desc_full.
* dwarf2loc.h (dwarf2_fetch_die_type_sect_off): New declaration.
* dwarf2read.c (dwarf2_fetch_die_type_sect_off): New function.
gdb/testsuite/ChangeLog:
* lib/dwarf.exp: Add support for DW_OP_implicit_pointer.
* gdb.dwarf2/nonvar-access.exp: Add test for stack value location
and implicit pointer into such a location.
This patch keeps the Scheme side of lazy string handling in sync
with the python size, bringing over fixes for
PRs python/17728, python/18439, python/18779.
gdb/ChangeLog:
* guile/scm-lazy-string.c (lazy_string_smob): Clarify use of LENGTH
member. Change type of TYPE member to SCM. All uses updated.
(lsscm_make_lazy_string_smob): Add assert.
(lsscm_make_lazy_string): Flag bad length values.
(lsscm_elt_type): New function.
(gdbscm_lazy_string_to_value): Rewrite to use
lsscm_safe_lazy_string_to_value.
(lsscm_safe_lazy_string_to_value): Fix handling of TYPE_CODE_PTR.
* guile/scm-value.c (gdbscm_value_to_lazy_string): Flag bad length
values. Fix TYPE_CODE_PTR. Handle TYPE_CODE_ARRAY. Handle typedefs
in incoming type.
* guile/guile-internal.h (tyscm_scm_to_type): Declare.
* guile/scm-type.c (tyscm_scm_to_type): New function.
gdb/testsuite/ChangeLog:
* gdb.guile/scm-value.c (main) Delete locals sptr, sn.
* gdb.guile/scm-lazy-string.c: New file.
* gdb.guile/scm-value.exp: Move lazy string tests to ...
* gdb.guile/scm-lazy-string.exp: ... here, new file. Add more tests
for pointer, array, typedef lazy strings.
gdb/ChangeLog:
PR python/17728, python/18439, python/18779
* python/py-lazy-string.c (lazy_string_object): Clarify use of LENGTH
member. Change type of TYPE member to PyObject *. All uses updated.
(stpy_convert_to_value): Fix handling of TYPE_CODE_PTR.
(gdbpy_create_lazy_string_object): Flag bad length values.
Handle TYPE_CODE_ARRAY with possibly different user-provided length.
Handle typedefs in incoming type.
(stpy_lazy_string_elt_type): New function.
(gdbpy_extract_lazy_string): Call it.
* python/py-value.c (valpy_lazy_string): Flag bad length values.
Fix handling of TYPE_CODE_PTR. Handle TYPE_CODE_ARRAY. Handle
typedefs in incoming type.
gdb/testsuite/ChangeLog:
PR python/17728, python/18439, python/18779
* gdb.python/py-value.c (main) Delete locals sptr, sn.
* gdb.python/py-lazy-string.c (pointer): New typedef.
(main): New locals ptr, array, typedef_ptr.
* gdb.python/py-value.exp: Move lazy string tests to ...
* gdb.python/py-lazy-string.exp: ... here. Add more tests for pointer,
array, typedef lazy strings.
The expectation in gdb.cp/m-static.exp for the ptype of
single_constructor is to get in the result of destructor with the
following prototype: ~single_constructor(int).
Yet, m-static.cc declares the destructor as ~single_constructor(). This
commit fixes the expectation.
2017-03-16 Thomas Preud'homme <thomas.preudhomme@arm.com>
gdb/testsuite/
* gdb.cp/m-static.exp: Fix expectation for prototype of
test5.single_constructor and single_constructor::single_constructor.
An optional parameter TEST has been added to get_hexadecimal_valueof in commit:
https://sourceware.org/ml/gdb-patches/2016-06/msg00469.html
This patch adds a similar optional parameter to other related methods that
retrieve expression values: get_valueof, get_integer_valueof and get_sizeof.
Thus tests that evaluate same expression multiple times can provide custom
test names, ensuring that test names will be unique.
gdb/testsuite/ChangeLog:
2017-03-14 Anton Kolesov <anton.kolesov@synopsys.com>
* lib/gdb.exp (get_valueof, get_integer_valueof, get_sizeof):
Add optional 'test' parameter.
I noticed that backslash_in_multi_line_command_test in
gdb.base/commands.exp failed on our RHEL6 servers. I traced it to the
old version of DejaGnu (1.4.4). I have found that instead of receiving
the expected:
"print \\\nargc\n"
gdb received:
"print argc\n"
thus breaking the test and its purpose. Versionof DejaGnu < 1.5 mess
up sending "\\\n", it somehow gets replaced with a space. I found that
the following commit in DejaGnu fixed the issue:
http://git.savannah.gnu.org/cgit/dejagnu.git/commit/lib/remote.exp?id=3f39294f5cd6802858838d3bcc0ccce847ae17f2
Even though the commit is almost 10 years old, the following release of
DejaGnu was only in 2013, which is why we still have systems with the
old code.
If the DejaGnu version is < 1.5, we just skip the test.
gdb/testsuite/ChangeLog:
* gdb.base/commands.exp (backslash_in_multi_line_command_test):
Skip for versions of DejaGnu < 1.5.
The next patch will require checking the DejaGnu version. There is
already a test that does this,
gdb.threads/attach-many-short-lived-threads.exp. This patch introduces
a new procedure, dejagnu_version, and makes that test use it.
The version number is "right-padded" with zeroes, to make sure that we
always return a triplet (major, minor, patch).
The procedure does not consider the DejaGnu versions from git. For
example, if you used DejaGnu from its current master branch, the version
would be "1.6.1-git", meaning that 1.6.1 will be the next release. I
figured we'll cross that bridge when (and if) we get there.
gdb/testsuite/ChangeLog:
* lib/gdb.exp (dejagnu_version): New proc.
* gdb.threads/attach-many-short-lived-threads.exp (bad_dejagnu):
Use dejagnu_version.
For a long time now, c++/8218 has noted that GDB is printing argument types
for destructors:
(gdb) ptype A
type = class A {
public:
~A(int);
}
This happens because cp_type_print_method_args doesn't ignore artificial
arguments. [It ignores the first `this' pointer because it simply skips
the first argument for any non-static function.]
This patch fixes this:
(gdb) ptype A
type = class A {
public:
~A();
}
I've adjusted gdb.cp/templates.exp to account for this and added a new
passing regexp.
gdb/ChangeLog
PR c++/8218
* c-typeprint.c (cp_type_print_method_args): Skip artificial arguments.
gdb/testsuite/ChangeLog
PR c++/8128
* gdb.cp/templates.exp (test_ptype_of_templates): Remove argument
type from destructor regexps.
Add a branch which actually passes the test.
Adjust "ptype t5i" test names.
Currently diffing testrun results shows:
-PASS: gdb.base/step-over-exit.exp: break *0x7ffff77e18c6 if main == 0
+PASS: gdb.base/step-over-exit.exp: break *0x2aaaab0988c6 if main == 0
gdb/testsuite/ChangeLog:
2017-03-08 Pedro Alves <palves@redhat.com>
* gdb.base/step-over-exit.exp: Add explicit test message.
If you do "interrupt -a" just while some thread is stepping over a
breakpoint, gdb trips on an internal error.
The test added by this patch manages to trigger this consistently by
spawning a few threads that are constantly tripping on a conditional
breakpoint whose condition always evaluates to false. With current
gdb, you get:
~~~
interrupt -a
.../src/gdb/inline-frame.c:343: internal-error: void skip_inline_frames(ptid_t): Assertion `find_inline_frame_state (ptid) == NULL' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) FAIL: gdb.threads/interrupt-while-step-over.exp: displaced-stepping=on: iter=0: interrupt -a (GDB internal error)
[...]
.../src/gdb/inline-frame.c:343: internal-error: void skip_inline_frames(ptid_t): Assertion `find_inline_frame_state (ptid) == NULL' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) FAIL: gdb.threads/interrupt-while-step-over.exp: displaced-stepping=off: iter=0: wait for stops (GDB internal error)
~~~
The assertion triggers because we're processing a stop for a thread
that had already stopped before and thus had already its inline-frame
state filled in.
Calling handle_inferior_event_1 directly within a
"thread_stop_requested" observer is something that I've wanted to get
rid of before, for being fragile. Nowadays, infrun is aware of
threads with pending events, so we can use that instead, and let the
normal fetch_inferior_event -> handle_inferior_event code path handle
the forced stop.
The change to finish_step_over is necessary because sometimes a thread
that was told to PTRACE_SINGLESTEP reports back a SIGSTOP instead of a
SIGTRAP (i.e., we tell it to single-step, and then interrupt it quick
enough that on the kernel side the thread dequeues the SIGTOP before
ever having had a chance of executing the instruction to be stepped).
SIGSTOP gets translated to a GDB_SIGNAL_0. And then finish_step_over
would miss calling clear_step_over_info, and thus miss restarting the
other threads (which in this case of threads with pending events,
means setting their "resumed" flag, so their pending events can be
consumed).
And now that we always restart threads in finish_step_over, we no
longer need to do that in handle_signal_stop.
Tested on x86_64 Fedora 23, native and gdbserver.
gdb/ChangeLog:
2017-03-08 Pedro Alves <palves@redhat.com>
PR gdb/18360
* infrun.c (start_step_over, do_target_resume, resume)
(restart_threads): Assert we're not resuming a thread that is
meant to be stopped.
(infrun_thread_stop_requested_callback): Delete.
(infrun_thread_stop_requested): If the thread is internally
stopped, queue a pending stop event and clear the thread's
inline-frame state.
(handle_stop_requested): New function.
(handle_syscall_event, handle_inferior_event_1): Use
handle_stop_requested.
(handle_stop_requested): New function.
(handle_signal_stop): Set the thread's stop_signal here instead of
at caller.
(finish_step_over): Clear step over info unconditionally.
(handle_signal_stop): If the user had interrupted the event
thread, consider the stop a random signal.
(handle_signal_stop) <signal arrived while stepping over
breakpoint>: Don't restart threads here.
(stop_waiting): Don't clear step-over info here.
gdb/testsuite/ChangeLog:
2017-03-08 Pedro Alves <palves@redhat.com>
PR gdb/18360
* gdb.threads/interrupt-while-step-over.c: New file.
* gdb.threads/interrupt-while-step-over.exp: New file.
gdb/testsuite/ChangeLog:
2017-03-08 Pedro Alves <palves@redhat.com>
* gdb.arch/amd64-entry-value-param-dwarf5.exp: Use with_test_prefix.
* gdb.arch/amd64-entry-value-param.exp: Use with_test_prefix.
Currently I get:
(gdb) print have_pkru()
$1 = 0
(gdb) FAIL: gdb.arch/i386-pkru.exp: probe PKRU support
UNSUPPORTED: gdb.arch/i386-pkru.exp: processor does not support protection key feature.
Probing suceeded, so that should be a PASS -> UNSUPPORTED.
gdb/testsuite/ChangeLog:
2017-03-08 Pedro Alves <palves@redhat.com>
* gdb.arch/i386-pkru.exp (probe PKRU support): Handle detecting
PKRU as not supported as a PASS.
Avoid putting unstable path names in test messages, in order to avoid
spurious testrun result diffs like:
[....]
-PASS: gdb.base/break-fun-addr.exp: /home/pedro/gdb/test-build1/gdb/testsuite/outputs/gdb.base/break-fun-addr/break-fun-addr1: break *main
+PASS: gdb.base/break-fun-addr.exp: /home/pedro/gdb/test-build2/gdb/testsuite/outputs/gdb.base/break-fun-addr/break-fun-addr1: break *main
[....]
gdb/ChangeLog:
2017-03-08 Pedro Alves <palves@redhat.com>
* gdb.base/break-fun-addr.exp: Use $testfile1/$testfile2 for test
prefix instead of $binfile1/$binfile2.
* gdb.btrace/gcore.exp: Use "core" instead of unstable path name
in test message.
* gdb.python/py-completion.exp: Use "load python file" as test
messages instead of unstable path names.
With commit 3b12939dfc ("Replace the sync_execution global with a
new enum prompt_state tristate"), GDB started aborting if you try
splitting an input line with a continuation char (backslash) while in
a multi-line command:
(gdb) commands
Type commands for breakpoint(s) 1, one per line.
End with a line saying just "end".
>print \
(gdb) 1 # note "(gdb)" incorrectly printed here.
>end
readline: readline_callback_read_char() called with no handler!
$
That abort is actually a symptom of an old problem introduced when
gdb_readline_wrapper was rewritten to use asynchronous readline, back
in 2007. Note how the "(gdb)" prompt is printed above in the "(gdb)
1" line. Clearly it shouldn't be there, but it already was before the
commit mentioned above. Fixing that also fixes the readline abort
shown above.
The problem starts when command_line_input passes a NULL prompt to
gdb_readline_wrapper when it finds previous incomplete input due to a
backslash, trying to fetch more input without printing another ">"
secondary prompt. That itself should not be a problem, because
passing NULL to gdb_readline_wrapper has the same meaning as passing a
pointer to empty string, since gdb_readline_wrapper exposes the same
interface as 'readline(char *)'. However, gdb_readline_wrapper passes
the prompt argument directly to display_gdb_prompt, and for the
latter, a NULL prompt argument has a different meaning - it requests
printing the primary prompt.
Before commit 782a7b8ef9c096 (which rewrote gdb_readline_wrapper to
use asynchronous readline), GDB behaved like this:
(gdb) commands
[....]
>print \
1
>end
(gdb)
The above is what this commit restores GDB back to.
New test included.
gdb/ChangeLog:
2017-03-08 Pedro Alves <palves@redhat.com>
PR cli/21218
* top.c (gdb_readline_wrapper): Avoid passing NULL to
display_gdb_prompt.
(command_line_input): Add comment.
gdb/testsuite/ChangeLog:
2017-03-08 Pedro Alves <palves@redhat.com>
Jan Kratochvil <jan.kratochvil@redhat.com>
PR cli/21218
* gdb.base/commands.exp (backslash_in_multi_line_command_test):
New proc.
(top level): Call it.
Commit d7e747318f ("Eliminate make_cleanup_ui_file_delete / make
ui_file a class hierarchy") regressed the TUI's command window.
Newlines miss doing a "carriage return", resulting in output like:
~~~~~~~~~~~~~~~~~~
(gdb) helpList of classes of commands:
aliases -- Aliases of other commands
breakpoints -- Making program stop at certain points
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Before the commit mentioned above, the default ui_file->to_write
implementation had a hack that would defer into the ui_file->to_fputs
method. The TUI's ui_file did not implement the to_write method, so
all writes would end up going to the ncurses window via tui_file_fputs
-> tui_puts.
After the commit above, the hack is gone, but the TUI's ui_file still
does not implement the ui_file::write method. Since tui_file inherits
from stdio_file, writing to a tui_file ends up doing fwrite on the
FILE stream the TUI is "associated" with, via stdio_file::write,
instead of writing to the ncurses window.
The fix is to have tui_file override the "write" method.
New test included.
gdb/ChangeLog:
2017-03-08 Pedro Alves <palves@redhat.com>
PR tui/21216
* tui/tui-file.c (tui_file::write): New.
* tui/tui-file.h (tui_file): Override "write".
* tui/tui-io.c (do_tui_putc, update_start_line): New functions,
factored out from ...
(tui_puts): ... here.
(tui_putc): Use them.
(tui_write): New function.
* tui/tui-io.h (tui_write): Declare.
gdb/testsuite/ChangeLog:
2017-03-08 Pedro Alves <palves@redhat.com>
PR tui/21216
* gdb.tui/tui-nl-filtered-output.exp: New file.
gdb/testsuite/ChangeLog:
2017-03-08 Pedro Alves <palves@redhat.com>
* gdb.base/completion.exp: Move TUI completion tests to ...
* gdb.tui/completion.exp: ... this new file.
Let's start putting TUI tests in their own dir.
gdb/testsuite/
2017-03-08 Pedro Alves <palves@redhat.com>
* gdb.base/tui-disasm-long-lines.c,
gdb.base/tui-disasm-long-lines.exp, gdb.base/tui-layout.c,
gdb.base/tui-layout.exp: Move to ...
* gdb.tui/: ... this new directory.
Commit d7e747318f ("Eliminate make_cleanup_ui_file_delete / make
ui_file a class hierarchy") introduced a problem when using "layout
regs", that leads gdb to crash when issuing:
./gdb ./a.out -ex 'layout regs' -ex start
From the backtrace, it's caused by this 'delete' on tui_restore_gdbout():
(gdb) bt
#0 0x00007ffff6b962b2 in free () from /lib64/libc.so.6
#1 0x000000000059fa47 in tui_restore_gdbout (ui=0x22997b0) at ../../gdb/tui/tui-regs.c:714
#2 0x0000000000619996 in do_my_cleanups (pmy_chain=pmy_chain@entry=0x1e08320 <cleanup_chain>, old_chain=old_chain@entry=0x235b4b0) at ../../gdb/common/cleanups.c:154
#3 0x0000000000619b1d in do_cleanups (old_chain=old_chain@entry=0x235b4b0) at ../../gdb/common/cleanups.c:176
#4 0x000000000059fb0d in tui_register_format (frame=frame@entry=0x22564e0, regnum=regnum@entry=0) at ../../gdb/tui/tui-regs.c:747
#5 0x000000000059ffeb in tui_get_register (data=0x2434d18, changedp=0x0, regnum=0, frame=0x22564e0) at ../../gdb/tui/tui-regs.c:768
#6 tui_show_register_group (refresh_values_only=<optimized out>, frame=0x22564e0, group=0x1e09250 <general_group>) at ../../gdb/tui/tui-regs.c:287
#7 tui_show_registers (group=0x1e09250 <general_group>) at ../../gdb/tui/tui-regs.c:156
#8 0x00000000005a07cf in tui_check_register_values (frame=frame@entry=0x22564e0) at ../../gdb/tui/tui-regs.c:496
#9 0x00000000005a3e65 in tui_check_data_values (frame=frame@entry=0x22564e0) at ../../gdb/tui/tui-windata.c:232
#10 0x000000000059cf65 in tui_refresh_frame_and_register_information (registers_too_p=1) at ../../gdb/tui/tui-hooks.c:156
#11 0x00000000006d5c05 in generic_observer_notify (args=0x7fffffffdbe0, subject=<optimized out>) at ../../gdb/observer.c:167
#12 observer_notify_normal_stop (bs=<optimized out>, print_frame=print_frame@entry=1) at ./observer.inc:61
#13 0x00000000006a6409 in normal_stop () at ../../gdb/infrun.c:8364
#14 0x00000000006af8f5 in fetch_inferior_event (client_data=<optimized out>) at ../../gdb/infrun.c:3990
#15 0x000000000066f0fd in gdb_wait_for_event (block=block@entry=0) at ../../gdb/event-loop.c:859
#16 0x000000000066f237 in gdb_do_one_event () at ../../gdb/event-loop.c:322
#17 0x000000000066f386 in gdb_do_one_event () at ../../gdb/event-loop.c:353
#18 0x00000000007411bc in wait_sync_command_done () at ../../gdb/top.c:570
#19 0x0000000000741426 in maybe_wait_sync_command_done (was_sync=0) at ../../gdb/top.c:587
#20 execute_command (p=<optimized out>, p@entry=0x7fffffffe43a "start", from_tty=from_tty@entry=1) at ../../gdb/top.c:676
#21 0x00000000006c2048 in catch_command_errors (command=0x741200 <execute_command(char*, int)>, arg=0x7fffffffe43a "start", from_tty=1) at ../../gdb/main.c:376
#22 0x00000000006c2b60 in captured_main_1 (context=0x7fffffffde70) at ../../gdb/main.c:1119
#23 captured_main (data=0x7fffffffde70) at ../../gdb/main.c:1140
#24 gdb_main (args=args@entry=0x7fffffffdf90) at ../../gdb/main.c:1158
#25 0x0000000000408cf5 in main (argc=<optimized out>, argv=<optimized out>) at ../../gdb/gdb.c:32
(gdb) f 1
#1 0x000000000059fa47 in tui_restore_gdbout (ui=0x22997b0) at ../../gdb/tui/tui-regs.c:714
714 delete gdb_stdout;
The problem is simply that the commit mentioned above made the ui_file
that gdb_stdout is temporarily set to be a stack-allocated
string_file, while before it used to be a heap-allocated ui_file. The
fix is simply to remove the now-incorrect delete.
New test included, which exercises enabling all TUI layouts, with and
without execution. (This particular crash only triggers with
execution.)
gdb/ChangeLog:
2017-03-07 Pedro Alves <palves@redhat.com>
* tui/tui-regs.c (tui_restore_gdbout): Don't delete gdb_stdout.
gdb/testsuite/ChangeLog:
2017-03-07 Pedro Alves <palves@redhat.com>
* gdb.base/tui-layout.c: New file.
* gdb.base/tui-layout.exp: New file.
To better reflect what the testcase is about, and to make room for a
different testcase.
gdb/testsuite/ChangeLog:
2017-03-07 Pedro Alves <palves@redhat.com>
* gdb.base/tui-layout.c: Rename to ...
* gdb.base/tui-disasm-long-lines.c: ... this.
* gdb.base/tui-layout.exp: Rename to ...
* gdb.base/tui-disasm-long-lines.exp: ... this.
This patch initializes the BND registers before executing the inferior
call. BND registers can be in arbitrary values at the moment of the
inferior call. In case the function being called uses as part of the
parameters BND register, e.g. when passing a pointer as parameter, the
current value of the register will be used. This can cause boundary
violations that are not due to a real bug or even desired by the user.
In this sense the best to be done is set the BND registers to allow
access to the whole memory, i.e. initialized state, before pushing the
inferior call.
2017-03-07 Walfred Tedeschi <walfred.tedeschi@intel.com>
gdb/ChangeLog:
* i387-tdep.h (i387_reset_bnd_regs): Add function definition.
* i387-tdep.c (i387_reset_bnd_regs): Add function implementation.
* i386-tdep.c (i386_push_dummy_call): Call i387_reset_bnd_regs.
* amd64-tdep (amd64_push_dummy_call): Call i387_reset_bnd_regs.
gdb/testsuite/ChangeLog:
* i386-mpx-call.c: New file.
* i386-mpx-call.exp: New file.
gdb/doc/ChangeLog:
* Memory Protection Extensions: Add information about inferior
calls.
This commit adds support to GDB so that it can modify the disassembler-options
value that is passed to the disassembler, similar to objdump's -M option.
Currently, the only supported targets are ARM, PowerPC and S/390, but
adding support for a new target(s) is not difficult.
include/
* dis-asm.h (disasm_options_t): New typedef.
(parse_arm_disassembler_option): Remove prototype.
(set_arm_regname_option): Likewise.
(get_arm_regnames): Likewise.
(get_arm_regname_num_options): Likewise.
(disassemble_init_s390): New prototype.
(disassembler_options_powerpc): Likewise.
(disassembler_options_arm): Likewise.
(disassembler_options_s390): Likewise.
(remove_whitespace_and_extra_commas): Likewise.
(disassembler_options_cmp): Likewise.
(next_disassembler_option): New inline function.
(FOR_EACH_DISASSEMBLER_OPTION): New macro.
opcodes/
* disassemble.c Include "safe-ctype.h".
(disassemble_init_for_target): Handle s390 init.
(remove_whitespace_and_extra_commas): New function.
(disassembler_options_cmp): Likewise.
* arm-dis.c: Include "libiberty.h".
(NUM_ELEM): Delete.
(regnames): Use long disassembler style names.
Add force-thumb and no-force-thumb options.
(NUM_ARM_REGNAMES): Rename from this...
(NUM_ARM_OPTIONS): ...to this. Use ARRAY_SIZE.
(get_arm_regname_num_options): Delete.
(set_arm_regname_option): Likewise.
(get_arm_regnames): Likewise.
(parse_disassembler_options): Likewise.
(parse_arm_disassembler_option): Rename from this...
(parse_arm_disassembler_options): ...to this. Make static.
Use new FOR_EACH_DISASSEMBLER_OPTION macro to scan over options.
(print_insn): Use parse_arm_disassembler_options.
(disassembler_options_arm): New function.
(print_arm_disassembler_options): Handle updated regnames.
* ppc-dis.c: Include "libiberty.h".
(ppc_opts): Add "32" and "64" entries.
(ppc_parse_cpu): Use ARRAY_SIZE and disassembler_options_cmp.
(powerpc_init_dialect): Add break to switch statement.
Use new FOR_EACH_DISASSEMBLER_OPTION macro.
(disassembler_options_powerpc): New function.
(print_ppc_disassembler_options): Use ARRAY_SIZE.
Remove printing of "32" and "64".
* s390-dis.c: Include "libiberty.h".
(init_flag): Remove unneeded variable.
(struct s390_options_t): New structure type.
(options): New structure.
(init_disasm): Rename from this...
(disassemble_init_s390): ...to this. Add initializations for
current_arch_mask and option_use_insn_len_bits_p. Remove init_flag.
(print_insn_s390): Delete call to init_disasm.
(disassembler_options_s390): New function.
(print_s390_disassembler_options): Print using information from
struct 'options'.
* po/opcodes.pot: Regenerate.
binutils/
* objdump.c (main): Use remove_whitespace_and_extra_commas.
gdb/
* NEWS: Mention new set/show disassembler-options commands.
* doc/gdb.texinfo: Document new set/show disassembler-options commands.
* disasm.c: Include "arch-utils.h", "gdbcmd.h" and "safe-ctype.h".
(prospective_options): New static variable.
(gdb_disassembler::gdb_disassembler): Initialize
m_di.disassembler_options.
(gdb_buffered_insn_length_init_dis): Initilize di->disassembler_options.
(get_disassembler_options): New function.
(set_disassembler_options): Likewise.
(set_disassembler_options_sfunc): Likewise.
(show_disassembler_options_sfunc): Likewise.
(disassembler_options_completer): Likewise.
(_initialize_disasm): Likewise.
* disasm.h (get_disassembler_options): New prototype.
(set_disassembler_options): Likewise.
* gdbarch.sh (gdbarch_disassembler_options): New variable.
(gdbarch_verify_disassembler_options): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Likewise.
* arm-tdep.c (num_disassembly_options): Delete.
(set_disassembly_style): Likewise.
(arm_disassembler_options): New static variable.
(set_disassembly_style_sfunc): Convert short style name into long
option name. Call set_disassembler_options.
(show_disassembly_style_sfunc): New function.
(arm_gdbarch_init): Call set_gdbarch_disassembler_options and
set_gdbarch_verify_disassembler_options.
(_initialize_arm_tdep): Delete regnames variable and update callers.
(arm_disassembler_options): Initialize.
(disasm_options): New variable.
(num_disassembly_options): Rename from this...
(num_disassembly_styles): ...to this. Compute by scanning through
disasm_options.
(valid_disassembly_styles): Initialize using disasm_options.
Remove calls to parse_arm_disassembler_option, get_arm_regnames and
set_arm_regname_option.
Pass show_disassembly_style_sfunc to the "disassembler" setshow command.
* rs6000-tdep.c (powerpc_disassembler_options): New static variable.
(rs6000_gdbarch_init): Call set_gdbarch_disassembler_options and
set_gdbarch_verify_disassembler_options.
* s390-tdep.c (s390_disassembler_options): New static variable.
(s390_gdbarch_init):all set_gdbarch_disassembler_options and
set_gdbarch_verify_disassembler_options.
gdb/testsuite/
* gdb.arch/powerpc-power.exp: Delete test.
* gdb.arch/powerpc-power.s: Likewise.
* gdb.disasm/disassembler-options.exp: New test.
* gdb.arch/powerpc-altivec.exp: Likewise.
* gdb.arch/powerpc-altivec.s: Likewise.
* gdb.arch/powerpc-altivec2.exp: Likewise.
* gdb.arch/powerpc-altivec2.s: Likewise.
* gdb.arch/powerpc-altivec3.exp: Likewise.
* gdb.arch/powerpc-altivec3.s: Likewise.
* gdb.arch/powerpc-power7.exp: Likewise.
* gdb.arch/powerpc-power7.s: Likewise.
* gdb.arch/powerpc-power8.exp: Likewise.
* gdb.arch/powerpc-power8.s: Likewise.
* gdb.arch/powerpc-power9.exp: Likewise.
* gdb.arch/powerpc-power9.s: Likewise.
* gdb.arch/powerpc-vsx.exp: Likewise.
* gdb.arch/powerpc-vsx.s: Likewise.
* gdb.arch/powerpc-vsx2.exp: Likewise.
* gdb.arch/powerpc-vsx2.s: Likewise.
* gdb.arch/powerpc-vsx3.exp: Likewise.
* gdb.arch/powerpc-vsx3.s: Likewise.
* gdb.arch/arm-disassembler-options.exp: Likewise.
* gdb.arch/powerpc-disassembler-options.exp: Likewise.
* gdb.arch/s390-disassembler-options.exp: Likewise.
As reported in PR21166, there are Intel processors out there that support
rdrand but not rdseed. The fix is to verify both features separately and only
run rdrand/rdseed tests if supported.
gdb/testsuite/ChangeLog:
2017-02-23 Luis Machado <lgustavo@codesourcery.com>
* gdb.reverse/insn-reverse.x86.c (check_rdrand_support): Renamed to ...
(check_supported_features): ... this. Changed return type to void.
(supports_rdseed): New static global.
(rdseed): Check supports_rdseed.
(initialize): Call check_supported_features.
gdb/
2017-02-21 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
* rs6000-tdep.c (LOAD_AND_RESERVE_MASK): Rename from LWARX_MASK.
(STORE_CONDITIONAL_MASK): Rename from STWCX_MASK.
(LBARX_INSTRUCTION, LHARX_INSTRUCTION, LQARX_INSTRUCTION,
STBCX_INSTRUCTION, STHCX_INSTRUCTION, STQCX_INSTRUCTION): New defines.
(IS_LOAD_AND_RESERVE_INSN, IS_STORE_CONDITIONAL_INSN): New macros.
(ppc_displaced_step_copy_insn): Use IS_LOAD_AND_RESERVE_INSN.
(ppc_deal_with_atomic_sequence): Use IS_LOAD_AND_RESERVE_INSN and
IS_STORE_CONDITIONAL_INSN.
gdb/testsuite/
2017-02-21 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
* gdb.arch/ppc64-isa207-atomic-inst.exp: New testcase based on
gdb.arch/ppc64-atomic-inst.exp. Add tests for lbarx/stbcx, lharx/sthcx
and lqarx/stqcx.
* gdb.arch/ppc64-isa207-atomic-inst.S: New file.
* gdb.arch/ppc64-isa207-atomic-inst.c: Likewise.
DWARF-5 has new form DW_FORM_data16. The problem is that GDB cannot pass
16-byte constant as a constant value as that would require GDB to use GCC
extension __int128.
Formerly such data was coded as DW_FORM_block* so GDB still decodes
DW_FORM_data16 like DW_FORM_block*.
gdb/ChangeLog
2017-02-20 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf2read.c (skip_one_die, read_attribute_value)
(dwarf2_const_value_attr, dump_die_shallow)
(dwarf2_get_attr_constant_value, dwarf2_fetch_constant_bytes)
(skip_form_bytes, attr_form_is_constant): Handle DW_FORM_data16.
gdb/testsuite/ChangeLog
2017-02-20 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.dwarf2/formdata16.c: New file.
* gdb.dwarf2/formdata16.exp: New file.
* lib/dwarf.exp (Dwarf): Add DW_FORM_data16.
This is a fix for PR gdb/21164. The problem started to happen after:
commit 34c41c681f
Author: Doug Evans <xdje42@gmail.com>
AuthorDate: Mon Dec 19 08:33:46 2016 -0800
New syntax for mt print symbols,msymbols,psymbols.
This change introduced new syntax for the mentioned commands, and
improved the parsing of arguments by using 'gdb_buildargv'. However,
it is necessary to check if the argv being built is not NULL, which
can happen if the user doesn't provide any arguments to these
commands.
gdb/ChangeLog:
2017-02-15 Sergio Durigan Junior <sergiodj@redhat.com>
PR gdb/21164
* psymtab.c (maintenance_print_psymbols): Verify if 'argv' is not
NULL before using it.
* symmisc.c (maintenance_print_symbols): Likewise.
(maintenance_print_msymbols): Likewise.
gdb/testsuite/ChangeLog:
gdb/ChangeLog:
2017-02-15 Sergio Durigan Junior <sergiodj@redhat.com>
PR gdb/21164
* gdb.base/maint.exp: Add testcases for when the commands do
not have arguments.
3d7b173c29 made upper case commands now
illegal. However gdb.cp/chained-calls.exp still contains one test using
P to print an expression. This patch fixes the testcase to use p
instead.
2017-02-13 Thomas Preud'homme <thomas.preudhomme@arm.com>
gdb/
* gdb.cp/chained-calls.exp: Use p instead of P.
This adds an event that is emitted just before GDB presents a prompt
to the user. This provides Python code a way to react to whatever
changes might have been made by the previous command. For example, in
my GUI I use this to track changes to the selected frame and reflect
them in the UI.
Built and regtested on x86-64 Fedora 23.
gdb/ChangeLog
2017-02-14 Tom Tromey <tom@tromey.com>
PR python/13598:
* python/python.c (gdbpy_before_prompt_hook): Emit before_prompt
event.
* python/py-evts.c (gdbpy_initialize_py_events): Add
before_prompt registry.
* python/py-events.h (events_object) <before_prompt>: New field.
gdb/doc/ChangeLog
2017-02-14 Tom Tromey <tom@tromey.com>
PR python/13598:
* python.texi (Events In Python): Document events.before_prompt.
gdb/testsuite/ChangeLog
2017-02-14 Tom Tromey <tom@tromey.com>
PR python/13598:
* gdb.python/py-events.exp: Add before_prompt event tests.
The test case implptrpiece.exp accesses the second byte of the short
integer number 1 and expects it to be zero. This is valid for
little-endian targets, but fails on big-endian targets.
This is fixed by distinguishing the expected value by endianness.
gdb/testsuite/ChangeLog:
* gdb.dwarf2/implptrpiece.exp: Fix check for big-endian targets.