aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
AgeCommit message (Collapse)AuthorFilesLines
2016-06-13gdb: Use UNSUPPORTED not XFAIL for unsupported target featuresAndrew Burgess19-41/+41
If a target does not support making function calls from GDB then in a number of test files, we currently report an XFAIL and skip some, or all of the tests. This commit changes the XFAIL to an UNSUPPORTED as this seems more appropriate in these cases. Some of the tests used bug ID 2416 to be reported in the XFAIL. In the current GDB bugzilla bug 2416 has nothing to do with calling target functions from GDB. gdb/testsuite/ChangeLog: * gdb.base/call-ar-st.exp: Report unsupported rather than xfail for unsupported target features. * gdb.base/call-rt-st.exp: Likewise. * gdb.base/call-sc.exp: Likewise. * gdb.base/call-signal-resume.exp: Likewise. * gdb.base/call-strs.exp: Likewise. * gdb.base/callexit.exp: Likewise. * gdb.base/callfuncs.exp: Likewise. * gdb.base/nodebug.exp: Likewise. * gdb.base/printcmds.exp: Likewise. * gdb.base/ptype.exp: Likewise. * gdb.base/structs.exp: Likewise. * gdb.base/unwindonsignal.exp: Likewise. * gdb.cp/gdb2495.exp: Likewise. * gdb.cp/templates.exp: Likewise. * gdb.cp/virtfunc.exp: Likewise. * gdb.threads/hand-call-in-threads.exp: Likewise. * gdb.threads/interrupted-hand-call.exp: Likewise. * gdb.threads/thread-unwindonsignal.exp: Likewise.
2016-06-10Fix PR rust/20110Tom Tromey2-0/+8
PR rust/20110 concerns the type of an integer constant that is too large for "i32", the default integer type. This patch changes the type of such a constant to i64. This is important because such values are often addresses, so truncating them by default is unfriendly. Built and regtested on x86-64 Fedora 23. 2016-06-10 Tom Tromey <tom@tromey.com> PR rust/20110: * rust-exp.y (lex_number): Don't truncate large numbers to i32. 2016-06-10 Tom Tromey <tom@tromey.com> PR rust/20110: * gdb.rust/expr.exp: Add test for integer constant larger than i32.
2016-06-10Fortran: Testsuite, non-local references in nested functions.Bernhard Heckel3-0/+119
Non-local references in nested functions are usually implemented by using DWARF static link. This feature was added with commit 63e43d3aedb8b1112899c2d0ad74cbbee687e5d6 (DWARF: handle non-local references in nested functions) but a testcase was missing in Fortran. 2016-06-10 Bernhard Heckel <bernhard.heckel@intel.com> gdb/Testsuite/Changelog: * gdb.fortran/nested-funcs.exp: New. * gdb.fortran/nested-funcs.f90: New.
2016-06-09Add negative repeat count to 'x' commandToshihito Kikuchi3-0/+435
This change adds support for specifying a negative repeat count to all the formats of the 'x' command to examine memory backward. A new testcase 'examine-backward' is added to cover this new feature. Here's the example output from the new feature: <format 'i'> (gdb) bt #0 Func1 (n=42, p=0x40432e "hogehoge") at main.cpp:5 #1 0x00000000004041fa in main (argc=1, argv=0x7fffffffdff8) at main.cpp:19 (gdb) x/-4i 0x4041fa 0x4041e5 <main(int, char**)+11>: mov %rsi,-0x10(%rbp) 0x4041e9 <main(int, char**)+15>: lea 0x13e(%rip),%rsi 0x4041f0 <main(int, char**)+22>: mov $0x2a,%edi 0x4041f5 <main(int, char**)+27>: callq 0x404147 <format 'x'> (gdb) x/-4xw 0x404200 0x4041f0 <main(int, char**)+22>: 0x00002abf 0xff4de800 0x76e8ffff 0xb8ffffff (gdb) x/-4 0x4041e0 <main(int, char**)+6>: 0x7d8910ec 0x758948fc 0x358d48f0 0x0000013e gdb/ChangeLog: * NEWS: Mention that GDB now supports a negative repeat count in the 'x' command. * printcmd.c (decode_format): Allow '-' in the parameter "string_ptr" to accept a negative repeat count. (find_instruction_backward): New function. (read_memory_backward): New function. (integer_is_zero): New function. (find_string_backward): New function. (do_examine): Use new functions to examine memory backward. (_initialize_printcmd): Mention that 'x' command supports a negative repeat count. gdb/doc/ChangeLog: * gdb.texinfo (Examining Memory): Document negative repeat count in the 'x' command. gdb/testsuite/ChangeLog: * gdb.base/examine-backward.c: New file. * gdb.base/examine-backward.exp: New file.
2016-06-06Add method/format information to =record-startedSimon Marchi2-2/+7
Eclipse CDT now supports enabling execution recording using two methods (full and btrace) and both formats for btrace (bts and pt). In the event that recording is enabled behind the back of the GUI (by the user on the command line, or a script), we need to know which method/format are being used, so it can be correctly reflected in the interface. This patch adds this information to the =record-started async record. Before: =record-started,thread-group="i1" After: =record-started,thread-group="i1",method="btrace",format="bts" =record-started,thread-group="i1",method="btrace",format="pt" =record-started,thread-group="i1",method="full" The "format" field is only present when the current method supports multiple formats (only the btrace method as of now). gdb/ChangeLog: * NEWS: Mention the new fields in =record-started. * common/btrace-common.h (btrace_format_short_string): New function declaration. * common/btrace-common.c (btrace_format_short_string): New function. * mi/mi-interp.c (mi_record_changed): Output method and format fields in the =record-started record. * record-btrace.c (record_btrace_open): Adapt record_changed notification. * record-full.c (record_full_open): Likewise. * record.c (cmd_record_stop): Likewise. gdb/doc/ChangeLog: * gdb.texinfo (GDB/MI Async Records): Document method and format fields in =record-started. * observer.texi (record_changed): Add method and format parameters. gdb/testsuite/ChangeLog: * gdb.mi/mi-record-changed.exp: Adjust =record-started output matching.
2016-06-02Fix PR python/18984Tom Tromey2-0/+9
This fixes PR python/18984. The bug is that gdbpy_solib_name uses GDB_PY_LL_ARG, whereas it should use GDB_PY_LLU_ARG to avoid overflow. Built and tested on x86-64 Fedora 23. 2016-06-02 Tom Tromey <tom@tromey.com> PR python/18984: * python/python.c (gdbpy_solib_name): Use GDB_PY_LLU_ARG. 2016-06-02 Tom Tromey <tom@tromey.com> PR python/18984: * gdb.python/py-shared.exp: Add solib_name test.
2016-06-02mi-memory-changed.exp: Fix filename passed to untestedSimon Marchi2-1/+5
gdb/testsuite/ChangeLog: * gdb.mi/mi-memory-changed.exp: Fix filename passed to untested.
2016-05-31[PR gdb/19893] Fix handling of synthetic C++ referencesMartin Galvan8-16/+628
https://sourceware.org/bugzilla/show_bug.cgi?id=19893 I've traced the main source of the problem to pieced_value_funcs.coerce_ref not being implemented. Since gdb always assumes references are implemented as pointers, this causes it to think that it's dealing with a NULL pointer, thus breaking any operations involving synthetic references. What I did here was implementing pieced_value_funcs.coerce_ref using some of the synthetic pointer handling code from indirect_pieced_value, as Pedro suggested. I also made a few adjustments to the reference printing code so that it correctly shows either the address of the referenced value or (if it's non-addressable) the "<synthetic pointer>" string. I also wrote some unit tests based on Dwarf::assemble; these took a while to make because in most cases I needed a synthetic reference to a physical variable. Additionally, I started working on a unit test for classes that have a vtable, but ran into a few issues so that'll probably go in a future patch. One thing that should definitely be fixed is that proc function_range (called for MACRO_AT_func) will always try to compile/link using gcc with the default options instead of g++, thus breaking C++ compilations that require e.g. libstdc++. gdb/ChangeLog: * dwarf2loc.c (coerce_pieced_ref, indirect_synthetic_pointer, fetch_const_value_from_synthetic_pointer): New functions. (indirect_pieced_value): Move lower half to indirect_synthetic_pointer. (pieced_value_funcs): Implement coerce_ref. * valops.c (value_addr): Call coerce_ref for synthetic references. * valprint.c (valprint_check_validity): Return true for synthetic references. Also, don't show "<synthetic pointer>" if they reference addressable values. (generic_val_print_ref): Handle synthetic references. Also move some code to print_ref_address. (print_ref_address, get_value_addr_contents): New functions. gdb/testsuite/ChangeLog: * gdb.dwarf2/implref.exp: Rename to... * gdb.dwarf2/implref-const.exp: ...this. Also add more test statements. * gdb.dwarf2/implref-array.c: New file. * gdb.dwarf2/implref-array.exp: Likewise. * gdb.dwarf2/implref-global.c: Likewise. * gdb.dwarf2/implref-global.exp: Likewise. * gdb.dwarf2/implref-struct.c: Likewise. * gdb.dwarf2/implref-struct.exp: Likewise.
2016-05-30Add tests for 64bit values in trace-condition.expAntoine Tremblay2-0/+99
This patch adds tests for emit operations with 64 bit values. It takes special care to avoid mistakes that one could make on a 32bit architecture using 64bit values. gdb/testsuite/ChangeLog: * gdb.trace/trace-condition.exp: Add 64bit tests.
2016-05-30Add variable length tests for emit_ref in trace-condition.expAntoine Tremblay3-5/+17
This patch add variable length tests for emit_ref by reading the variable passed as argument of 8 to 64 bit. gdb/testsuite/ChangeLog: * gdb.trace/trace-condition.c (marker): Adapt signature to 8 to 64 bits types. (main): Adapt to 8 to 64 bits types. * gdb.trace/trace-condition.exp: Add new tests.
2016-05-30Add emit_less_unsigned test in trace-condition.expAntoine Tremblay2-0/+7
This patch adds coverage for emit_less_unsigned. gdb/testsuite/ChangeLog: * gdb.trace/trace-condition.exp: Add emit_less_unsigned test.
2016-05-30Move trace conditions tests from ftrace.exp to trace-condition.expAntoine Tremblay3-74/+12
This patch moves conditional tests that were done in ftrace.exp to trace-condition.exp. Note that emit_ref is now tested by the anarg local variable there is no need to test the register directly. All emit calls have been tested using asserts before / after the move, to ensure that the tests cover the same functions. Note that these function were not covered before and are still not: emit_gt_goto, emit_lt_goto, emit_pop, emit_unsigned_less. gdb/testsuite/ChangeLog: * gdb.trace/ftrace.exp (test_ftrace_condition): Remove. Move condition tests... * gdb.trace/trace-condition.exp: Here.
2016-05-30Add counter-cases for trace-condition.exp testsAntoine Tremblay2-0/+42
In trace-condition.exp, tests are done by doing a conditional tracepoint and validating that the trace contains all the frames that could be collected if that condition is true. E.g. test_tracepoints $trace_command "21 + 21 == 42" 10 This will always return true and collect the 10 frames possible to collect with the test program. However, if the condition evaluation is broken such that the condition is unconditional we will not notice this problem. This patch adds counter-cases to such conditions like so: $trace_command "21 + 11 == 42" 0 This way such a problem would be noticed. gdb/testsuite/ChangeLog: * gdb.trace/trace-condition.exp: Add counter-case tests.
2016-05-30PR 15231: import bare DW_TAG_lexical_blockJan Kratochvil3-6/+76
Local variables in lambdas are not accessible https://sourceware.org/bugzilla/show_bug.cgi?id=15231 GDB: read_lexical_block_scope /* Ignore blocks with missing or invalid low and high pc attributes. */ [...] if (!dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL)) return; But sometimes there is: FAIL: gcc-5.3.1-6.fc23.x86_64 <2><92>: Abbrev Number: 11 (DW_TAG_lexical_block) <3><9c>: Abbrev Number: 13 (DW_TAG_structure_type) <9d> DW_AT_name : (indirect string, offset: 0x3c): <lambda()> [...] Where DW_TAG_lexical_block has no attributes. Such whole subtree is currently dropped by GDB while I think it should just import all its children DIEs. It even XFAIL->XPASSes gdb.ada/out_of_line_in_inlined.exp: commit 0fa7fe506c242b459c4c05d331e7c7d66fb52390 Author: Joel Brobecker <brobecker@adacore.com> out of line functions nested inside inline functions. So I have removed that xfail. gdb/ChangeLog 2016-05-30 Jan Kratochvil <jan.kratochvil@redhat.com> PR c++/15231 * dwarf2read.c (enum pc_bounds_kind): Add PC_BOUNDS_INVALID. (process_psymtab_comp_unit_reader, read_func_scope): Adjust callers. (read_lexical_block_scope): Import DIEs from bare DW_TAG_lexical_block. (read_call_site_scope): Adjust callers. (dwarf2_get_pc_bounds): Implement pc_bounds_invalid. (dwarf2_get_subprogram_pc_bounds, get_scope_pc_bounds): Adjust callers. gdb/testsuite/ChangeLog 2016-05-30 Jan Kratochvil <jan.kratochvil@redhat.com> PR c++/15231 * gdb.ada/out_of_line_in_inlined.exp: Remove xfails. * gdb.dwarf2/dw2-lexical-block-bare.exp: New file.
2016-05-27Skip attach-many-short-lived-threads.exp on known-broken DejaGnu versionsPedro Alves2-0/+40
If the testsuite is run with a DejaGnu version that predates the fix from last year: [PATCH] DejaGnu kills the wrong process due to PID-reuse races http://lists.gnu.org/archive/html/dejagnu/2015-07/msg00005.html ... gdb.threads/attach-many-short-lived-threads.exp fails randomly, often. Other tests randomly fail due to that issue too, but this one is _much_ more exposed. DejaGnu 1.6 was released meanwhile, which includes that DejaGnu fix, and also some distros backported the fix too. So skip the test when run with older/broken DejaGnus. gdb/testsuite/ChangeLog: 2016-05-27 Pedro Alves <palves@redhat.com> * gdb.threads/attach-many-short-lived-threads.exp (bad_dejagnu): New procedure. (top level): Call it, and bail out of DejaGnu is known to be bad.
2016-05-27gdb: Forward VALUE_LVAL when avoiding side effects for STRUCTOP_PTRAndrew Burgess3-4/+92
Assume that we have a C program like this: struct foo_type { int var; } foo; struct foo_type *foo_ptr = &foo; int main () { return foo_ptr->var; } Then GDB should be able to evaluate the following, however, it currently does not: (gdb) start ... (gdb) whatis &(foo_ptr->var) Attempt to take address of value not located in memory. The problem is that in EVAL_AVOID_SIDE_EFFECTS mode, eval.c:evaluate_subexp_standard always returns a not_lval value as the result for a STRUCTOP_PTR operation. As a consequence, the rest of the code believes that one cannot take the address of the returned value. This patch fixes STRUCTOP_PTR handling so that the VALUE_LVAL attribute for the returned value is properly initialized. After this change, the above session becomes: (gdb) start ... (gdb) whatis &(foo_ptr->var) type = int * This commit is largely the same as commit 2520f728b710 (Forward VALUE_LVAL when avoiding side effects for STRUCTOP_STRUCT) but applied to STRUCTOP_PTR rather than STRUCTOP_STRUCT. Both of these commits are building on top of commit ac1ca910d74d (Fixes for PR exp/15364). gdb/ChangeLog: * eval.c (evaluate_subexp_standard): If EVAL_AVOID_SIDE_EFFECTS mode, forward the VALUE_LVAL attribute to the returned value in the STRUCTOP_PTR case. gdb/testsuite/ChangeLog: * gdb.base/whatis.c: Extend the test case. * gdb.base/whatis.exp: Add additional tests.
2016-05-25Fortran, typeprint: Forward level of details to be printed for pointers.Bernhard Heckel3-2/+20
Variable "show" was hardcoded to zero for pointer and reference types. This implementation didn't allow a correct "whatis" print for those types and results in same output for "ptype" and "whatis". Before: (gdb) whatis t3p type = PTR TO -> ( Type t3 integer(kind=4) :: t3_i Type t2 :: t2_n End Type t3 ) After: (gdb) whatis t3p type = PTR TO -> ( Type t3 ) 2016-05-25 Bernhard Heckel <bernhard.heckel@intel.com> gdb/Changelog: * f-typeprint.c (f_type_print_base): Replace 0 by show. gdb/testsuite/Changelog: * gdb.fortran/type.f90: Add pointer variable. * gdb.fortran/whatis_type.exp: Add whatis/ptype of pointers.
2016-05-25Fortran, testsuite: Fix duplicate testcase name.Bernhard Heckel2-1/+6
2016-05-25 Bernhard Heckel <bernhard.heckel@intel.com> gdb/testsuite/Changelog: * gdb.fortran/vla-type.exp: Fix testcase name.
2016-05-25Fortran, testsuite: Add testcases for nested structures.Bernhard Heckel2-0/+29
As as result of printing only the outer elements of nested structures, some testcases have to be added to check for corner cases with VLA's. 2016-05-25 Bernhard Heckel <bernhard.heckel@intel.com> gdb/testsuite/Changelog: * gdb.fortran/vla-type.exp: Access elements in nested structs.
2016-05-25Fortran, typeprint: Decrease level of details when printing elements of a ↵Bernhard Heckel5-21/+51
structure. According to the typeprint's description, the level of details is decreased by one for the typeprint of elements of a structure. Before: (gdb) ptype t3v type = Type t3 integer(kind=4) :: t3_i Type t2 integer(kind=4) :: t2_i Type t1 integer(kind=4) :: t1_i real(kind=4) :: t1_r End Type t1 :: t1_n End Type t2 :: t2_n End Type t3 After: (gdb) ptype t3v type = Type t3 integer(kind=4) :: t3_i Type t2 :: t2_n End Type t3 2016-05-25 Bernhard Heckel <bernhard.heckel@intel.com> gdb/Changelog: * f-typeprint.c (f_type_print_base): Decrease show by one. gdb/testsuite/Changelog: * gdb.fortran/type.f90: Add nested structures. * gdb.fortran/whatis-type.exp: Whatis/ptype nested structures. * gdb.fortran/derived-type.exp: Adapt expected output. * gdb.fortran/vla-type.exp: Adapt expected output.
2016-05-25Fortran, typeprint: Take level of details into account when printing ↵Bernhard Heckel2-12/+6
elements of a structure. According to the typeprint's description, elements of a structure should not be printed when show is < 1. This variable is also used to distinguish the level of details between "ptype" and "whatis" expressions. Before: (gdb) whatis t1v type = Type t1 integer(kind=4) :: t1_i real(kind=4) :: t1_r End Type t1 After: (gdb) whatis t1v type = Type t1 2016-05-25 Bernhard Heckel <bernhard.heckel@intel.com> gdb/Changelog: * f-typeprint.c (f_type_print_base): Don't print fields when show < 0. gdb/testsuite/Changelog: * gdb.fortran/whatis_type.exp: Adapt expected output.
2016-05-25Fortran, typeprint: Fix wrong indentation when ptype nested structures.Bernhard Heckel2-4/+9
Level of indentation was not proper handled when printing the elements type's name. Before: type = Type t1 integer(kind=4) :: var_1 integer(kind=4) :: var_2 End Type t1 After: type = Type t1 integer(kind=4) :: var_1 integer(kind=4) :: var_2 End Type t1 2016-05-25 Bernhard Heckel <bernhard.heckel@intel.com> gdb/Changelog: * f-typeprint.c (f_type_print_base): Take print level into account. gdb/testsuite/Changelog: * gdb.fortran/print_type.exp: Fix expected output. * gdb.fortran/whatis_type.exp: Fix expected output.
2016-05-25Fortran, testsuite: Use multi_line in whatis_type testcase.Bernhard Heckel2-4/+20
2016-05-25 Bernhard Heckel <bernhard.heckel@intel.com> gdb/testsuite/Changelog: * gdb.fortran/whatis_type.exp: Use multi_line.
2016-05-24Fix PR python/17386 - add __index__ method to gdb.ValueTom Tromey2-0/+13
This patch fixes PR python/17386. The bug is that gdb.Value does not implement the Python __index__ method. This method is needed to convert a Python object to an index and is used by various operations in Python, such as indexing an array. The fix is to implement the nb_index method for gdb.Value. nb_index was added in Python 2.5. I don't have a good way to test Python 2.4, but I made an attempt to accomodate it. I chose to use valpy_long in all cases because this simplifies porting to Python 3, and because there didn't seem to be any harm. Built and regtested on x86-64 Fedora 23. 2016-05-24 Tom Tromey <tom@tromey.com> PR python/17386: * python/py-value.c (value_object_as_number): Add nb_inplace_floor_divide, nb_inplace_true_divide, nb_index. 2016-05-24 Tom Tromey <tom@tromey.com> PR python/17386: * gdb.python/py-value.exp (test_value_numeric_ops): Add tests that use value as an index.
2016-05-24Fix PR python/17981Tom Tromey2-1/+10
PR python/17981 notes that gdb.breakpoints() returns None when there are no breakpoints; whereas an empty list or tuple would be more in keeping with Python and the documentation. This patch fixes the bug by changing the no-breakpoint return to make an empty tuple. Built and regtested on x86-64 Fedora 23. 2016-05-23 Tom Tromey <tom@tromey.com> PR python/17981: * python/py-breakpoint.c (gdbpy_breakpoints): Return a new tuple when there are no breakpoints. 2016-05-23 Tom Tromey <tom@tromey.com> * python.texi (Basic Python): Document gdb.breakpoints return. 2016-05-23 Tom Tromey <tom@tromey.com> PR python/17981: * gdb.python/py-breakpoint.exp (test_bkpt_basic): Add test for no-breakpoint case.
2016-05-24Fix PR gdb/19828: gdb -p <process from a container>: internal errorPedro Alves3-0/+170
When GDB attaches to a process, it looks at the /proc/PID/task/ dir for all clone threads of that process, and attaches to each of them. Usually, if there is more than one clone thread, it means the program is multi threaded and linked with pthreads. Thus when GDB soon after attaching finds and loads a libthread_db matching the process, it'll add a thread to the thread list for each of the initially found lower-level LWPs. If, however, GDB fails to find/load a matching libthread_db, nothing is adding the LWPs to the thread list. And because of that, "detach" hits an internal error: (gdb) PASS: gdb.threads/clone-attach-detach.exp: fg attach 1: attach info threads Id Target Id Frame * 1 LWP 6891 "clone-attach-de" 0x00007f87e5fd0790 in __nanosleep_nocancel () at ../sysdeps/unix/syscall-template.S:84 (gdb) FAIL: gdb.threads/clone-attach-detach.exp: fg attach 1: info threads shows two LWPs detach .../src/gdb/thread.c:1010: internal-error: is_executing: Assertion `tp' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) FAIL: gdb.threads/clone-attach-detach.exp: fg attach 1: detach (GDB internal error) From here: ... #8 0x00000000007ba7cc in internal_error (file=0x98ea68 ".../src/gdb/thread.c", line=1010, fmt=0x98ea30 "%s: Assertion `%s' failed.") at .../src/gdb/common/errors.c:55 #9 0x000000000064bb83 in is_executing (ptid=...) at .../src/gdb/thread.c:1010 #10 0x00000000004c23bb in get_pending_status (lp=0x12c5cc0, status=0x7fffffffdc0c) at .../src/gdb/linux-nat.c:1235 #11 0x00000000004c2738 in detach_callback (lp=0x12c5cc0, data=0x0) at .../src/gdb/linux-nat.c:1317 #12 0x00000000004c1a2a in iterate_over_lwps (filter=..., callback=0x4c2599 <detach_callback>, data=0x0) at .../src/gdb/linux-nat.c:899 #13 0x00000000004c295c in linux_nat_detach (ops=0xe7bd30, args=0x0, from_tty=1) at .../src/gdb/linux-nat.c:1358 #14 0x000000000068284d in delegate_detach (self=0xe7bd30, arg1=0x0, arg2=1) at .../src/gdb/target-delegates.c:34 #15 0x0000000000694141 in target_detach (args=0x0, from_tty=1) at .../src/gdb/target.c:2241 #16 0x0000000000630582 in detach_command (args=0x0, from_tty=1) at .../src/gdb/infcmd.c:2975 ... Tested on x86-64 Fedora 23. Also confirmed the test passes against gdbserver with "maint set target-non-stop". gdb/ChangeLog: 2016-05-24 Pedro Alves <palves@redhat.com> PR gdb/19828 * linux-nat.c (attach_proc_task_lwp_callback): Mark the lwp resumed, and add the thread to GDB's thread list. testsuite/ChangeLog: 2016-05-24 Pedro Alves <palves@redhat.com> PR gdb/19828 * gdb.threads/clone-attach-detach.c: New file. * gdb.threads/clone-attach-detach.exp: New file.
2016-05-24Fix syntax error in annota-input-while-running.expFrancis Ricci2-2/+6
This patch fixes a syntax error which caused a failure in annota-input-while-running.exp to crash the test suite runner. 2016-05-24 Francis Ricci <francisjricci@gmail.com> * gdb.base/annota-input-while-running.exp: Fix syntax error.
2016-05-23Fix PR python/19438, PR python/18393 - initialize dictionariesTom Tromey3-0/+10
This fixes PR python/19438 and PR python/18393. Both bugs are about invoking dir() on some Python object implemented by gdb, and getting a crash. The crash happens because the dictionary field of these objects was not initialized. Apparently what happens is that this field can be lazily initialized by Python when assigning to an attribute; and it can also be handled ok when using dir() but without __dict__ defined; but gdb defines __dict__ because this isn't supplied automatically by Python. The docs on this seem rather sparse, but this patch works ok. An alternative might be to lazily create the dictionary in gdb_py_generic_dict, but I went with this approach because it seemed more straightforward. Built and regtested on x86-64 Fedora 23. 2016-05-23 Tom Tromey <tom@tromey.com> PR python/19438, PR python/18393: * python/py-objfile.c (objfpy_initialize): Initialize self->dict. * python/py-progspace.c (pspy_initialize): Initialize self->dict. 2016-05-23 Tom Tromey <tom@tromey.com> PR python/19438, PR python/18393: * gdb.python/py-progspace.exp: Add "dir" test. * gdb.python/py-objfile.exp: Add "dir" test.
2016-05-23Use standard_testfile in gdb.arch/thumb-prologue.exp and gdb.arch/thumb2-it.expYao Qi3-6/+7
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.
2016-05-18Add mi-threads-interrupt.exp test (PR 20039)Simon Marchi3-0/+135
Add a new test for PR 20039. The test spawns new threads, then tries to interrupt, continue, and interrupt again. This use case was fixed by commit 5fe966540d6b748f825774868463003700f0c878 in master, but gdb 7.11 is affected (so if you try it on the gdb-7.11-branch right now, the test will fail). New in v2, the test now handles mi-async on mode properly. The failure was specific to mi-async off, but I don't think it's bad to test the same thing under async on mode. I added a little hack when running in async mode to work around bug 20045. I also removed one continue/interrupt pair, as a single one was enough to trigger the problem. gdb/testsuite/ChangeLog: * gdb.mi/mi-threads-interrupt.c: New file. * gdb.mi/mi-threads-interrupt.exp: New file.
2016-05-17Fix -exec-run not running asynchronously with mi-async on (PR gdb/18077)Simon Marchi3-0/+87
When doing -exec-run on a freshly started GDB, the only target on the target stack at the time the dummy one. When mi_async_p is called to know whether the run should be async, it queries whether the current target (dummy) supports async, and the answer is no. The fix is to make the code query the target that will be used for the run, which is not necessarily the current target. No regressions in the gdb.mi directory using the unix, native-gdbserver and native-extended-gdbserver boards. The test doesn't pass when forcing maint set target-async off, obviously, since it makes mi-async have no effect. It doesn't seem like other tests are checking for that eventuality, so I didn't in the new test. gdb/ChangeLog: * mi/mi-main.c (run_one_inferior): Use run target to determine whether to run async or not. (mi_cmd_exec_run): Likewise. gdb/testsuite/ChangeLog: * gdb.mi/mi-async-run.exp: New file. * gdb.mi/mi-async-run.c: New file.
2016-05-17Update gdb test suite for RustTom Tromey13-1/+1015
This updates the gdb test suite for Rust. 2016-05-17 Tom Tromey <tom@tromey.com> Manish Goregaokar <manishsmail@gmail.com> * lib/rust-support.exp: New file. * lib/gdb.exp (skip_rust_tests): New proc. (build_executable_from_specs): Handle rust. * lib/future.exp (gdb_find_rustc): New proc. (gdb_default_target_compile): Handle rust. * gdb.rust/expr.exp: New file. * gdb.rust/generics.exp: New file. * gdb.rust/generics.rs: New file. * gdb.rust/methods.exp: New file. * gdb.rust/methods.rs: New file. * gdb.rust/modules.exp: New file. * gdb.rust/modules.rs: New file. * gdb.rust/simple.exp: New file. * gdb.rust/simple.rs: New file.
2016-05-17Add support for the Rust languageTom Tromey2-1/+5
This patch adds support for the Rust language. 2016-05-17 Tom Tromey <tom@tromey.com> Manish Goregaokar <manishsmail@gmail.com> * symtab.c (symbol_find_demangled_name): Handle Rust. * symfile.c (init_filename_language_table): Treat ".rs" as Rust. * std-operator.def (STRUCTOP_ANONYMOUS, OP_RUST_ARRAY): New constants. * rust-lang.h: New file. * rust-lang.c: New file. * rust-exp.y: New file. * dwarf2read.c (read_file_scope): Add Rust producer sniffing. (dwarf2_compute_name, read_func_scope, read_structure_type) (read_base_type, read_subrange_type, set_cu_language) (new_symbol_full, determine_prefix): Handle Rust. * defs.h (enum language) <language_rust>: New constant. * Makefile.in (SFILES): Add rust-exp.y, rust-lang.c. (COMMON_OBS): Add rust-exp.o, rust-lang.o. 2016-05-17 Tom Tromey <tom@tromey.com> * gdb.base/default.exp (set language): Add rust.
2016-05-17Add self-test framework to gdbTom Tromey2-0/+21
I wanted to unit test the Rust lexer, so I added a simple unit testing command to gdb. The intent is that self tests will only be compiled into gdb in development mode. In release mode they simply won't exist. So, this exposes $development to C code as GDB_SELF_TEST. In development mode, test functions are registered with the self test module. A test function is just a function that does some checks, and throws an exception on failure. Then this adds a new "maint selftest" command which invokes the test functions, and a new dejagnu test case that invokes it. 2016-05-17 Tom Tromey <tom@tromey.com> * NEWS: Add "maint selftest" entry. * selftest.h: New file. * selftest.c: New file. * maint.c: Include selftest.h. (maintenance_selftest): New function. (_initialize_maint_cmds): Add "maint selftest" command. * configure.ac (GDB_SELF_TEST): Maybe define. * config.in, configure: Rebuild. * Makefile.in (SFILES): Add selftest.c. (COMMON_OBS): Add selftest.o. 2016-05-17 Tom Tromey <tom@tromey.com> * gdb.texinfo (Maintenance Commands): Document "maint selftest". 2016-05-17 Tom Tromey <tom@tromey.com> * gdb.gdb/unittest.exp: New file.
2016-05-16Match shell_prompt # in batch-preserve-term-settings.expYao Qi2-2/+6
batch-preserve-term-settings.exp fails if the shell prompt isn't $. It is # in our testing env. In fact, the shell prompt can be anything. The perfect solution would be "set_board_info shell_prompt" in the host board file, and use board_info shell_prompt in batch-preserve-term-settings.exp. This is a little bit overkill to me, and we still need to figure out the different prompts on different shells. I also tried to start shell with the prompt preset, but there is not unique way to set shell prompt in different shells, so I give up. It is reasonably simple to match either $ or # for the shell prompt, and we can easily extend it to match other char, like >. gdb/testsuite: 2016-05-16 Yao Qi <yao.qi@linaro.org> * gdb.base/batch-preserve-term-settings.exp: Remove variable shell_prompt. Update shell_prompt_re.
2016-05-12PR symtab/19999 gdb unable to resolve vars with fission+PIEDoug Evans4-1/+552
gdb/ChangeLog: * dwarf2loc.c (dwarf2_find_location_expression): For DWO files still add base_offset. gdb/testsuite/ChangeLog: * lib/dwarf.exp (build_executable_from_fission_assembler): Pass $options when building executable. * gdb.dwarf2/fission-loclists-pie.c: New file. * gdb.dwarf2/fission-loclists-pie.exp: New file.
2016-05-04Fix solib-display.exp remote checkSimon Marchi2-1/+23
This test currently uses [is_remote target] to check if the test is supported. This is not quite correct, as the limitation is actually that it requires support for "running", ruling out stub-like targets. Therefore, it should check for use_gdb_stub. This has no visible effect right now, but it will once we make the native-gdbserver board non-dejagnu-remote. gdb/testsuite/ChangeLog: * gdb.base/solib-display.exp: Check for [use_gdb_stub] instead of [is_remote target],
2016-05-04Introduce procedure use_gdb_stubSimon Marchi2-0/+24
This patch introduces the use_gdb_stub procedure, which allows getting the right value of the use_gdb_stub variable/property in any all situations. When calling it before the $use_gdb_stub global variable has been set, it will return the value of the use_gdb_stub property from the board file. This happens when tests want to bail out early (even before gdb has been started) when the current test setup is a stub. Otherwise, it returns the value of the $use_gdb_stub global. It's possible for these two to differ when a test file overrides the value of the global. gdb/testsuite/ChangeLog: * lib/gdb.exp (use_gdb_stub): New procedure.
2016-05-03PR symtab/19914 fix handling of dwp + split debugDoug Evans3-0/+69
PR symtab/19914 * dwarf2read.c (open_and_init_dwp_file): Look at backlink if objfile is separate debug file. testsuite/ * gdb.dwarf2/dwp-sepdebug.c: New file. * gdb.dwarf2/dwp-sepdebug.exp: New file.
2016-05-02Fix detach.exp remote checkSimon Marchi2-5/+4
This test seems to work with both native-gdbserver and native-extended-gdbserver, so I removed the remote check. When running with native-gdbserver (a stub-like target), detach makes gdbserver stop and gdb disconnect. runto_main just spawns a brand new gdbserver. So it tests the exact same thing twice. It doesn't hurt though. With native-extended-gdbserver, the test is probably a bit more useful (and similar to native). It tests running/detaching twice using the same gdb/gdbserver instances, since with extended-remote, you can detach/attach/run all you want, unlike with remote. gdb/testsuite/ChangeLog: * gdb.base/detach.exp: Remove is_remote check.
2016-05-02Fix annota-input-while-running.exp remote checkSimon Marchi2-19/+12
The comment says that we can't use runto_main here becore it doesn't know how to handle annotation. Instead, the test puts a breakpoint at main and calls run by hand. Therefore, it can't work with stub targets, since they can't "run". The check should be then changed to check the use_gdb_stub variable instead of [is_remote target]. But as an alternative, we can just use runto_main and enable annotations after, since the "run to main" part is not really part of what we want to test. I also removed the "set test..." line that is unused. gdb/testsuite/ChangeLog: * gdb.base/annota-input-while-running.exp: Don't check for [is_remote target]. Enable annotations after running to main. Remove unused "set test..." line.
2016-04-28Add test for tracepoint enable/disableSimon Marchi3-0/+171
This patch adds a test for tracepoints enabling/disabling, which didn't work properly for fast tracepoints on big endian systems. gdb/testsuite/ChangeLog: * gdb.trace/trace-enable-disable.exp: New file. * gdb.trace/trace-enable-disable.c: New file.
2016-04-28ftrace tests: Use gdb_load_shlib result to lookup IPA in info sharedlibrarySimon Marchi8-14/+25
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.
2016-04-27Rename gdb_load_shlibs to gdb_load_shlibSimon Marchi54-85/+147
Rename gdb_load_shlibs to gdb_load_shlib to reflect that it can only load a single shlib at the time. gdb/testsuite/ChangeLog: * lib/gdb.exp (gdb_load_shlibs): Rename to... (gdb_load_shlib): ... this. * gdb.arch/ftrace-insn-reloc.exp: Adjust gdb_load_shlibs -> gdb_load_shlib. * gdb.base/catch-load.exp (one_catch_load_test): Likewise. * gdb.base/ctxobj.exp: Likewise. * gdb.base/dprintf-pending.exp: Likewise. * gdb.base/dso2dso.exp: Likewise. * gdb.base/fixsection.exp: Likewise. * gdb.base/gcore-relro.exp: Likewise. * gdb.base/gdb1555.exp: Likewise. * gdb.base/global-var-nested-by-dso.exp: Likewise. * gdb.base/gnu-ifunc.exp: Likewise. * gdb.base/hbreak-in-shr-unsupported.exp: Likewise. * gdb.base/jit-so.exp (one_jit_test): Likewise. * gdb.base/pending.exp: Likewise. * gdb.base/print-file-var.exp: Likewise. * gdb.base/print-symbol-loading.exp: Likewise. * gdb.base/shlib-call.exp: Likewise. * gdb.base/shreloc.exp: Likewise. * gdb.base/so-impl-ld.exp: Likewise. * gdb.base/solib-disc.exp: Likewise. * gdb.base/solib-nodir.exp: Likewise. * gdb.base/solib-overlap.exp: Likewise. * gdb.base/solib-symbol.exp: Likewise. * gdb.base/solib-weak.exp (do_test): Likewise. * gdb.base/sym-file.exp: Likewise. * gdb.base/symtab-search-order.exp: Likewise. * gdb.base/type-opaque.exp: Likewise. * gdb.base/unload.exp: Likewise. * gdb.base/watchpoint-solib.exp: Likewise. * gdb.compile/compile.exp: Likewise. * gdb.cp/gdb2384.exp: Likewise. * gdb.cp/infcall-dlopen.exp: Likewise. * gdb.cp/re-set-overloaded.exp: Likewise. * gdb.fortran/library-module.exp: Likewise. * gdb.opt/solib-intra-step.exp: Likewise. * gdb.python/py-finish-breakpoint.exp: Likewise. * gdb.python/py-shared.exp: Likewise. * gdb.reverse/solib-precsave.exp: Likewise. * gdb.reverse/solib-reverse.exp: Likewise. * gdb.server/solib-list.exp: Likewise. * gdb.threads/dlopen-libpthread.exp: Likewise. * gdb.threads/tls-shared.exp: Likewise. * gdb.threads/tls-so_extern.exp: Likewise. * gdb.trace/change-loc.exp: Likewise. * gdb.trace/ftrace-lock.exp: Likewise. * gdb.trace/ftrace.exp: Likewise. * gdb.trace/mi-tracepoint-changed.exp (test_reconnect): Likewise. * gdb.trace/pending.exp: Likewise. * gdb.trace/range-stepping.exp: Likewise. * gdb.trace/strace.exp (strace_remove_socket): Likewise. (strace_info_marker): Likewise. (strace_probe_marker): Likewise. (strace_trace_on_same_addr): Likewise. (strace_trace_on_diff_addr): Likewise. * gdb.trace/trace-break.exp: Likewise. * gdb.trace/trace-condition.exp: Likewise. * gdb.trace/trace-mt.exp: Likewise.
2016-04-27Make gdb_load_shlibs return the destination path of the librarySimon Marchi11-15/+38
This patch makes gdb_load_shlibs return the destination path of the copied library. To make the procedure implementation and interface more straightforward, it also changes it so that it accepts a single shared library path at the time. Therefore, calls that are passed multiple libraries: gdb_load_shlibs $lib1 $lib2 must be changed to separate calls: gdb_load_shlibs $lib1 gdb_load_shlibs $lib2 A subtle impact is the solib-search-path handling. In the former version, solib-search-path is set using the directory of the first passed lib (further calls overwrite the value). In the later version, the directory of the library passed to the last call to gdb_load_shlibs remnains. I don't think that's a problem in practice, since if we had tests that needed multiple different paths in solib-search-path, they wouldn't work in the first place. Changed in v2: * Split behavioural and rename changes in two separate patches. gdb/testsuite/ChangeLog: * lib/gdb.exp (gdb_load_shlibs): Accept a single argument. Return result of gdb_remote_download. * gdb.base/ctxobj.exp: Split gdb_load_shlibs call. * gdb.base/dso2dso.exp: Likewise. * gdb.base/global-var-nested-by-dso.exp: Likewise. * gdb.base/print-file-var.exp: Likewise. * gdb.base/shlib-call.exp: Likewise. * gdb.base/shreloc.exp: Likewise. * gdb.base/solib-overlap.exp: Likewise. * gdb.base/solib-weak.exp (do_test): Likewise. * gdb.base/unload.exp: Likewise.
2016-04-27Skip gdb.base/branch-to-self.exp if gdb,nosignals existsYao Qi2-0/+10
I get a timeout fail in branch-to-self.exp when it is compiled by a bare-mental target running qemu, which doesn't have signal. The test should be skipped if gdb,nosignals exists, and that is what this patch does. gdb/testsuite: 2016-04-27 Yao Qi <yao.qi@linaro.org> * gdb.base/branch-to-self.exp: Skip it if gdb,nosignals exists.
2016-04-26fort_dyn_array: Use value constructor instead of raw-buffer manipulation.Keven Boell2-0/+7
Instead of pre-computing indices into a fortran array re-use the value_* interfaces to subscript a fortran array. The benefit of using the new interface is that it takes care of dynamic types and resolve them when needed. This fixes issues when printing structures with dynamic arrays from toplevel. Before: (gdb) p twov $1 = ( (( ( 6352320, 0, -66, -1, 267) ( 343476, 1, -15, 1, 0) ( 5, 0, 5, 0, 1) ... After: (gdb) p twov $1 = ( (( ( 1, 1, 1, 1, 1) ( 1, 1, 321, 1, 1) ( 1, 1, 1, 1, 1) ... 2016-04-26 Sanimir Agovic <sanimir.agovic@intel.com> Keven Boell <keven.boell@intel.com> Bernhard Heckel <bernhard.heckel@intel.com> gdb/Changelog: * f-valprint.c (f77_create_arrayprint_offset_tbl): Remove function. (F77_DIM_SIZE, F77_DIM_OFFSET): Remove macro. (f77_print_array_1): Use value_subscript to subscript a value array. (f77_print_array): Remove call to f77_create_arrayprint_offset_tbl. (f_val_print): Use value_field to construct a field value. gdb/testsuite/Changelog: * vla-type.exp: Print structure from toplevel.
2016-04-26fort_dyn_array: Support evaluation of dynamic elements inside arrays.Bernhard Heckel3-2/+77
Resolve type of an array's element to be printed in case it is dynamic. Otherwise we don't use the correct boundaries nor the right location. Before: ptype fivearr(1) type = Type five Type one integer(kind=4) :: ivla(34196784:34196832,34197072:34197120,34197360:34197408) End Type one :: tone End Type five After: ptype fivearr(1) type = Type five Type one integer(kind=4) :: ivla(2,4,6) End Type one :: tone End Type five 2016-04-26 Bernhard Heckel <bernhard.heckel@intel.com> gdb/Changelog: * valarith.c (value_address): Resolve dynamic types. gdb/testsuite/Changelog: * gdb.fortran/vla-type.f90: Add test for static and dynamic arrays of dynamic types. * gdb.fortran/vla-type.exp: Add test for static and dynamic arrays of dynamic types.
2016-04-26fort_dyn_array: Enable dynamic member types inside a structure.Bernhard Heckel3-0/+195
Fortran supports dynamic types for which bounds, size and location can vary during their lifetime. As a result of the dynamic behaviour, they have to be resolved at every query. This patch will resolve the type of a structure field when it is dynamic. 2016-04-26 Bernhard Heckel <bernhard.heckel@intel.com> 2016-04-26 Keven Boell <keven.boell@intel.com> Before: (gdb) print threev%ivla(1) Cannot access memory at address 0x3 (gdb) print threev%ivla(5) no such vector element After: (gdb) print threev%ivla(1) $9 = 1 (gdb) print threev%ivla(5) $10 = 42 gdb/Changelog: * NEWS: Add new supported features for fortran. * gdbtypes.c (remove_dyn_prop): New. (resolve_dynamic_struct): Keep type length for fortran structs. * gdbtypes.h: Forward declaration of new function. * value.c (value_address): Return dynamic resolved location of a value. (set_value_component_location): Adjust the value address for single value prints. (value_primitive_field): Support value types with a dynamic location. (set_internalvar): Remove dynamic location property of internal variables. gdb/testsuite/Changelog: * gdb.fortran/vla-type.f90: New file. * gdb.fortran/vla-type.exp: New file.
2016-04-25New test case gdb.base/branch-to-self.expYao Qi3-0/+114
gdb/testsuite: 2016-04-25 Yao Qi <yao.qi@linaro.org> * gdb.base/branch-to-self.c: New file. * gdb.base/branch-to-self.exp: New file.