binutils-gdb/gdb/testsuite/ChangeLog

2334 lines
73 KiB
Plaintext
Raw Normal View History

2014-09-07 Gabriel Krisman Bertazi <gabriel@krisman.be>
PR gdb/17035
* gdb.base/commands.exp: Add tests to verify user-defined
commands with empty bodies.
* gdb.python/py-cmd.exp: Test that we don't show user-defined
python commands in `show user command`.
* gdb.python/scm-cmd.exp: Test that we don't show user-defined
scheme commands in `show user command`.
2014-09-07 Jan Kratochvil <jan.kratochvil@redhat.com>
PR python/17355
* gdb.python/amd64-py-framefilter-invalidarg.S: New file.
* gdb.python/py-framefilter-invalidarg-gdb.py.in: New file.
* gdb.python/py-framefilter-invalidarg.exp: New file.
* gdb.python/py-framefilter-invalidarg.py: New file.
2014-09-06 Doug Evans <xdje42@gmail.com>
PR 15276
* gdb.python/py-caller-is.c: New file.
* gdb.python/py-caller-is.exp: New file.
2014-09-05 Sergio Durigan Junior <sergiodj@redhat.com>
PR gdb/17235
* gdb.arch/amd64-stap-wrong-subexp.exp: New file.
* gdb.arch/amd64-stap-wrong-subexp.S: Likewise.
2014-09-04 Sergio Durigan Junior <sergiodj@redhat.com>
PR fortran/17237
* gdb.fortran/print-formatted.exp: New file.
* gdb.fortran/print-formatted.f90: Likewise.
2014-09-03 Sasha Smundak <asmundak@google.com>
* gdb.python/py-frame.exp: Test Frame.read_register.
PR python/16699: GDB Python command completion with overriden complete vs. completer class This PR came from a Red Hat bug that was filed recently. I checked and it still exists on HEAD, so here's a proposed fix. Although this is marked as a Python backend bug, this is really about the completion mechanism used by GDB. Since this code reminds me of my first attempt to make a good noodle, it took me quite some time to fix it in a non-intrusive way. The problem is triggered when one registers a completion method inside a class in a Python script, rather than registering the command using a completer class directly. For example, consider the following script: class MyFirstCommand(gdb.Command): def __init__(self): gdb.Command.__init__(self,'myfirstcommand',gdb.COMMAND_USER,gdb.COMPLETE_FILENAME) def invoke(self,argument,from_tty): raise gdb.GdbError('not implemented') class MySecondCommand(gdb.Command): def __init__(self): gdb.Command.__init__(self,'mysecondcommand',gdb.COMMAND_USER) def invoke(self,argument,from_tty): raise gdb.GdbError('not implemented') def complete(self,text,word): return gdb.COMPLETE_FILENAME MyFirstCommand () MySecondCommand () When one loads this into GDB and tries to complete filenames for both myfirstcommand and mysecondcommand, she gets: (gdb) myfirstcommand /hom<TAB> (gdb) myfirstcommand /home/ ^ ... (gdb) mysecondcommand /hom<TAB> (gdb) mysecondcommand /home ^ (The "^" marks the final position of the cursor after the TAB). So we see that myfirstcommand honors the COMPLETE_FILENAME class (as specified in the command creation), but mysecondcommand does not. After some investigation, I found that the problem lies with the set of word break characters that is used for each case. The set should be the same for both commands, but it is not. During the process of deciding which type of completion should be used, the code in gdb/completer.c:complete_line_internal analyses the command that requested the completion and tries to determine the type of completion wanted by checking which completion function will be called (e.g., filename_completer for filenames, location_completer for locations, etc.). This all works fine for myfirstcommand, because immediately after the command registration the Python backend already sets its completion function to filename_completer (which then causes the complete_line_internal function to choose the right set of word break chars). However, for mysecondcommand, this decision is postponed to when the completer function is evaluated, and the Python backend uses an internal completer (called cmdpy_completer). complete_line_internal doesn't know about this internal completer, and can't choose the right set of word break chars in time, which then leads to a bad decision when completing the "/hom" word. So, after a few attempts, I decided to create another callback in "struct cmd_list_element" that will be responsible for handling the case when there is an unknown completer function for complete_line_internal to work with. So far, only the Python backend uses this callback, and only when the user provides a completer method instead of registering the command directly with a completer class. I think this is the best option because it not very intrusive (all the other commands will still work normally), but especially because the whole completion code is so messy that it would be hard to fix this without having to redesign things. I have regtested this on Fedora 18 x86_64, without regressions. I also included a testcase. gdb/ChangeLog: 2014-09-03 Sergio Durigan Junior <sergiodj@redhat.com> PR python/16699 * cli/cli-decode.c (set_cmd_completer_handle_brkchars): New function. (add_cmd): Set "completer_handle_brkchars" to NULL. * cli/cli-decode.h (struct cmd_list_element) <completer_handle_brkchars>: New field. * command.h (completer_ftype_void): New typedef. (set_cmd_completer_handle_brkchars): New prototype. * completer.c (set_gdb_completion_word_break_characters): New function. (complete_line_internal): Call "completer_handle_brkchars" callback from command. * completer.h: Include "command.h". (set_gdb_completion_word_break_characters): New prototype. * python/py-cmd.c (cmdpy_completer_helper): New function. (cmdpy_completer_handle_brkchars): New function. (cmdpy_completer): Adjust to use cmdpy_completer_helper. (cmdpy_init): Set completer_handle_brkchars to cmdpy_completer_handle_brkchars. gdb/testsuite/ChangeLog: 2014-09-03 Sergio Durigan Junior <sergiodj@redhat.com> PR python/16699 * gdb.python/py-completion.exp: New file. * gdb.python/py-completion.py: Likewise.
2014-09-03 22:30:28 +02:00
2014-09-03 Sergio Durigan Junior <sergiodj@redhat.com>
PR python/16699
* gdb.python/py-completion.exp: New file.
* gdb.python/py-completion.py: Likewise.
2014-08-28 Doug Evans <dje@google.com>
* gdb.arch/amd64-pseudo.c (main): Rewrite to better specify when
eax,etc. are live with values set by gdb and thus the compiler can't
use them.
* gdb.arch/i386-pseudo.c (main): Ditto.
2014-08-27 Doug Evans <dje@google.com>
* lib/gdb.exp (gdb_compile_shlib): Add support for clang.
2014-08-25 Doug Evans <dje@google.com>
* gdb.mi/basics.c (callee3, callee2, callee1): Specify result type.
(main): Ditto.
2014-08-25 Doug Evans <dje@google.com>
* gdb.threads/thread-execl.exp: #include <stdio.h>.
2014-08-24 Yao Qi <yao@codesourcery.com>
* gdb.guile/scm-value.exp (test_lazy_strings): Set print
symbol off.
* gdb.python/py-value.exp (test_lazy_strings): Likewise.
2014-08-22 Doug Evans <dje@google.com>
PR 17276
* gdb.dwarf2/dw2-single-line-discriminators.S: New file.
* gdb.dwarf2/dw2-single-line-discriminators.c: New file.
* gdb.dwarf2/dw2-single-line-discriminators.exp: New file.
2014-08-22 Yao Qi <yao@codesourcery.com>
* gdb.python/py-finish-breakpoint.exp: Copy .py file to host.
* gdb.python/py-finish-breakpoint2.exp: Likewise.
* gdb.python/python.exp: Likewise. Use .py file on the host
instead of the build.
2014-08-21 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.threads/gcore-stale-thread.c: New file.
* gdb.threads/gcore-stale-thread.exp: New file.
2014-08-21 Pedro Alves <palves@redhat.com>
* gdb.base/gcore-buffer-overflow.exp: Remove "help gcore" test.
* gdb.base/gcore-relro-pie.exp: Likewise.
* gdb.base/gcore-relro.exp: Likewise.
* gdb.base/gcore.exp: Likewise.
* gdb.base/print-symbol-loading.exp: Likewise.
* gdb.threads/gcore-thread.exp: Likewise.
* lib/gdb.exp (gdb_gcore_cmd): Don't expect "Undefined command".
2014-08-20 Pedro Alves <palves@redhat.com>
Jan Kratochvil <jan.kratochvil@redhat.com>
* Makefile.in (EXTRA_RULES, CC): New variables, get from
configure.
(EXPECT): Handle READ1 being set.
(all): Depend on EXTRA_RULES.
(check-read1, expect-read1, read1.so, read1): New rules.
* README (Testsuite Parameters): Document the READ1 make variable.
(Race detection): New section.
* configure: Regenerate.
* configure.ac: If build==host==target, and running under a
GNU/glibc system, add read1 to the extra Makefile rules.
(EXTRA_RULES): AC_SUBST it.
* lib/read1.c: New file.
2014-08-20 Joel Brobecker <brobecker@adacore.com>
* gdb.dwarf2/data-loc.exp: Add additional tests exercising
the handling of variables declared as a typedef to an array
which a DW_AT_data_location attribute.
Handle partially optimized out values similarly to unavailable values This fixes PR symtab/14604, PR symtab/14605, and Jan's test at https://sourceware.org/ml/gdb-patches/2014-07/msg00158.html, in a tree with bddbbed reverted: 2014-07-22 Pedro Alves <palves@redhat.com> * value.c (allocate_optimized_out_value): Don't mark value as non-lazy. The PRs are about variables described by the DWARF as being split over multiple registers using DWARF piece information, but some of those registers being marked as optimised out (not saved) by a later frame. GDB currently incorrectly mishandles these partially-optimized-out values. Even though we can usually tell from the debug info whether a local or global is optimized out, handling the case of a local living in a register that was not saved in a frame requires fetching the variable. GDB also needs to fetch a value to tell whether parts of it are "<unavailable>". Given this, it's not worth it to try to avoid fetching lazy optimized-out values based on debug info alone. So this patch makes GDB track which chunks of a value's contents are optimized out like it tracks <unavailable> contents. That is, it makes value->optimized_out be a bit range vector instead of a boolean, and removes the struct lval_funcs check_validity and check_any_valid hooks. Unlike Andrew's series which this is based on (at https://sourceware.org/ml/gdb-patches/2013-08/msg00300.html, note some pieces have gone in since), this doesn't merge optimized out and unavailable contents validity/availability behind a single interface, nor does it merge the bit range vectors themselves (at least yet). While it may be desirable to have a single entry point that returns existence of contents irrespective of what may make them invalid/unavailable, several places want to treat optimized out / unavailable / etc. differently, so each spot that potentially could use it will need to be careful considered on case-by-case basis, and best done as a separate change. This fixes Jan's test, because value_available_contents_eq wasn't considering optimized out value contents. It does now, and because of that it's been renamed to value_contents_eq. A new intro comment is added to value.h describing "<optimized out>", "<not saved>" and "<unavailable>" values. gdb/ PR symtab/14604 PR symtab/14605 * ada-lang.c (coerce_unspec_val_to_type): Use value_contents_copy_raw. * ada-valprint.c (val_print_packed_array_elements): Adjust. * c-valprint.c (c_val_print): Use value_bits_any_optimized_out. * cp-valprint.c (cp_print_value_fields): Let the common printing code handle optimized out values. (cp_print_value_fields_rtti): Use value_bits_any_optimized_out. * d-valprint.c (dynamic_array_type): Use value_bits_any_optimized_out. * dwarf2loc.c (entry_data_value_funcs): Remove check_validity and check_any_valid fields. (check_pieced_value_bits): Delete and inline ... (check_pieced_synthetic_pointer): ... here. (check_pieced_value_validity): Delete. (check_pieced_value_invalid): Delete. (pieced_value_funcs): Remove check_validity and check_any_valid fields. (read_pieced_value): Use mark_value_bits_optimized_out. (write_pieced_value): Switch to use mark_value_bytes_optimized_out. (dwarf2_evaluate_loc_desc_full): Copy the value contents instead of assuming the whole value is optimized out. * findvar.c (read_frame_register_value): Remove special handling of optimized out registers. (value_from_register): Use mark_value_bytes_optimized_out. * frame-unwind.c (frame_unwind_got_optimized): Use mark_value_bytes_optimized_out. * jv-valprint.c (java_value_print): Adjust. (java_print_value_fields): Let the common printing code handle optimized out values. * mips-tdep.c (mips_print_register): Remove special handling of optimized out registers. * opencl-lang.c (lval_func_check_validity): Delete. (lval_func_check_any_valid): Delete. (opencl_value_funcs): Remove check_validity and check_any_valid fields. * p-valprint.c (pascal_object_print_value_fields): Let the common printing code handle optimized out values. * stack.c (read_frame_arg): Remove special handling of optimized out values. Fetch both VAL and ENTRYVAL before comparing contents. Adjust to value_available_contents_eq rename. * valprint.c (valprint_check_validity) (val_print_scalar_formatted): Use value_bits_any_optimized_out. (val_print_array_elements): Adjust. * value.c (struct value) <optimized_out>: Now a VEC(range_s). (value_bits_any_optimized_out): New function. (value_entirely_covered_by_range_vector): New function, factored out from value_entirely_unavailable. (value_entirely_unavailable): Reimplement. (value_entirely_optimized_out): New function. (insert_into_bit_range_vector): New function, factored out from mark_value_bits_unavailable. (mark_value_bits_unavailable): Reimplement. (struct ranges_and_idx): New struct. (find_first_range_overlap_and_match): New function, factored out from value_available_contents_bits_eq. (value_available_contents_bits_eq): Rename to ... (value_contents_bits_eq): ... this. Check both unavailable contents and optimized out contents. (value_available_contents_eq): Rename to ... (value_contents_eq): ... this. (allocate_value_lazy): Remove reference to the old optimized_out boolean. (allocate_optimized_out_value): Use mark_value_bytes_optimized_out. (require_not_optimized_out): Adjust to check whether the optimized_out vec is empty. (ranges_copy_adjusted): New function, factored out from value_contents_copy_raw. (value_contents_copy_raw): Also copy the optimized out ranges. Assert the destination ranges aren't optimized out. (value_contents_copy): Update comment, remove call to require_not_optimized_out. (value_contents_equal): Adjust to check whether the optimized_out vec is empty. (set_value_optimized_out, value_optimized_out_const): Delete. (mark_value_bytes_optimized_out, mark_value_bits_optimized_out): New functions. (value_entirely_optimized_out, value_bits_valid): Delete. (value_copy): Take a VEC copy of the 'optimized_out' field. (value_primitive_field): Remove special handling of optimized out. (value_fetch_lazy): Assert that lazy values have no unavailable regions. Use value_bits_any_optimized_out. Remove some special handling for optimized out values. * value.h: Add intro comment about <optimized out> and <unavailable>. (struct lval_funcs): Remove check_validity and check_any_valid fields. (set_value_optimized_out, value_optimized_out_const): Remove. (mark_value_bytes_optimized_out, mark_value_bits_optimized_out): New declarations. (value_bits_any_optimized_out): New declaration. (value_bits_valid): Delete declaration. (value_available_contents_eq): Rename to ... (value_contents_eq): ... this, and extend comments. gdb/testsuite/ PR symtab/14604 PR symtab/14605 * gdb.dwarf2/dw2-op-out-param.exp: Remove kfail branches and use gdb_test.
2014-08-20 01:07:40 +02:00
2014-08-19 Andrew Burgess <aburgess@broadcom.com>
Pedro Alves <palves@redhat.com>
PR symtab/14604
PR symtab/14605
* gdb.dwarf2/dw2-op-out-param.exp: Remove kfail branches and use
gdb_test.
2014-08-19 Pedro Alves <palves@redhat.com>
* gdb.base/watchpoint-hw-hit-once.c (main): Update comment.
2014-08-19 Yao Qi <yao@codesourcery.com>
* gdb.base/watchpoint-hw-hit-once.exp: Set breakpoint on the
right line.
2014-08-18 David Blaikie <dblaikie@gmail.com>
* boards/fission.exp: Explicitly pass -ggnu-pubnames for clang.
2014-08-18 Joel Brobecker <brobecker@adacore.com>
* gdb.dwarf2/data-loc.exp: Remove second DW_AT_upper bound
attribute in array range.
2014-08-18 Joel Brobecker <brobecker@adacore.com>
* gdb.dwarf2/data-loc.c, gdb.dwarf2/data-loc.exp: New files.
2014-08-15 Siva Chandra Reddy <sivachandra@google.com>
PR c++/17132
* gdb.cp/pr17132.cc: New file.
* gdb.cp/pr17132.exp: New file.
2014-08-15 Siva Chandra Reddy <sivachandra@google.com>
* gdb.python/py-xmethods.py (A_getarrayind)
(E_method_char_worker.__call__, E_method_int_worker.__call__):
Use 'print' with function call syntax.
(E_method_matcher.match): Fix tab vs space indentation mixup.
2014-08-15 Yao Qi <yao@codesourcery.com>
* gdb.trace/tfile.exp: Return -1 if generate_tracefile returns
false.
2014-08-15 Yao Qi <yao@codesourcery.com>
* gdb.cp/casts.exp: Set print symbol off.
* gdb.cp/class2.exp: Likewise.
* gdb.cp/overload.exp: Likewise.
* gdb.cp/templates.exp: Likewise.
2014-08-11 Doug Evans <dje@google.com>
* gdb.base/print-symbol-loading.exp (test_load_core): Update.
(test_load_shlib): Update.
2014-08-09 Yao Qi <yao@codesourcery.com>
* gdb.base/display.exp: Invoke is_address_zero_readable.
* gdb.guile/scm-value.exp (test_value_in_inferior): Likewise.
* gdb.python/py-value.exp (test_value_in_inferior): Likewise.
* gdb.base/hbreak-unmapped.exp: Return if
is_address_zero_readable returns true.
* gdb.base/signest.exp: Likewise.
* gdb.base/signull.exp: Likewise.
* gdb.base/sigbpt.exp: Likewise.
* gdb.guile/scm-disasm.exp: Do the test if
is_address_zero_readable returns false.
* gdb.guile/scm-pretty-print.exp (run_lang_tests): Likewise.
* gdb.python/py-arch.exp: Likewise.
* gdb.python/py-prettyprint.exp (run_lang_tests): Likewise.
* lib/gdb.exp (is_address_zero_readable): New proc.
2014-08-09 Yao Qi <yao@codesourcery.com>
PR testsuite/13443
* gdb.mi/mi-var-display.exp: Make test messages unique.
2014-08-04 Tom Tromey <tromey@redhat.com>
* gdb.base/sss-bp-on-user-bp-2.exp: Expect output from "set debug
target 0".
2014-08-04 Tom Tromey <tromey@redhat.com>
* gdb.base/sss-bp-on-user-bp-2.exp: Match "to_resume", not
"target_resume".
Handle variable-sized fields in the interior of structure type In Ada, variable-sized field can be located at any position of a structure. Consider for instance the following declarations: Dyn_Size : Integer := 1; type Table is array (Positive range <>) of Integer; type Inner is record T1 : Table (1 .. Dyn_Size) := (others => 1); T2 : Table (1 .. Dyn_Size) := (others => 2); end record; type Inner_Array is array (1 .. 2) of Inner; type Outer is record I0 : Integer := 0; A1 : Inner_Array; Marker : Integer := 16#01020304#; end record; Rt : Outer; What this does is declare a variable "Rt" of type Outer, which contains 3 fields where the second (A1) is of type Inner_Array. type Inner_Array is an array with 2 elements of type Inner. Because type Inner contains two arrays whose upper bound depend on a variable, the size of the array, and therefore the size of type Inner is dynamic, thus making field A1 a dynamically-size field. When trying to print the value of Rt, we hit the following limitation: (gdb) print rt Attempt to resolve a variably-sized type which appears in the interior of a structure type The limitation was somewhat making sense in C, but needs to be lifted for Ada. This patch mostly lifts that limitation. As a result of this patch, the type length computation had to be reworked a little bit. gdb/ChangeLog: * gdbtypes.c (resolve_dynamic_struct): Do not generate an error if detecting a variable-sized field that is not the last field. Fix struct type length computation. gdb/testsuite/ChangeLog: * gdb.base/vla-datatypes.c (vla_factory): Add new variable inner_vla_struct_object_size. * gdb.base/vla-datatypes.exp: Adjust last test, and mark it as xfail.
2014-07-08 17:15:35 +02:00
2014-08-01 Joel Brobecker <brobecker@adacore.com>
* gdb.base/vla-datatypes.c (vla_factory): Add new variable
inner_vla_struct_object_size.
* gdb.base/vla-datatypes.exp: Adjust last test, and mark it
as xfail.
2014-07-30 Pedro Alves <palves@redhat.com>
* gdb.threads/signal-command-handle-nopass.exp (test): Add
comment.
Fix PR 17206 As reported in PR 17206, an internal error is triggered when command until is executed. In infcmd.c:until_next_command, step_range_end is set to 'pc', if (!func) { struct bound_minimal_symbol msymbol = lookup_minimal_symbol_by_pc (pc); if (msymbol.minsym == NULL) error (_("Execution is not within a known function.")); tp->control.step_range_start = BMSYMBOL_VALUE_ADDRESS (msymbol); tp->control.step_range_end = pc; } and later in infrun.c:resume, the assert below is triggered in PR 17206. if (tp->control.may_range_step) { /* If we're resuming a thread with the PC out of the step range, then we're doing some nested/finer run control operation, like stepping the thread out of the dynamic linker or the displaced stepping scratch pad. We shouldn't have allowed a range step then. */ gdb_assert (pc_in_thread_step_range (pc, tp)); } In until_next_command, we set step range to [XXX, pc), so pc isn't within the range. pc_in_thread_step_range returns false and the assert is triggered. AFAICS, the range we want in until_next_command is [XXX, pc] instead of [XXX, pc), because we want to program step until greater than pc. This patch is to set step_range_end to 'pc + 1'. Running until-nodebug.exp with unpatched GDB will get the following fail, FAIL: gdb.base/until-nodebug.exp: until 2 (GDB internal error) and the fail goes away when the fix is applied. gdb: 2014-07-29 Yao Qi <yao@codesourcery.com> PR gdb/17206 * infcmd.c (until_next_command): Set step_range_end to PC + 1. gdb/testsuite: 2014-07-29 Yao Qi <yao@codesourcery.com> PR gdb/17206 * gdb.base/until-nodebug.exp: New.
2014-07-28 07:44:57 +02:00
2014-07-29 Yao Qi <yao@codesourcery.com>
PR gdb/17206
* gdb.base/until-nodebug.exp: New.
2014-07-28 Doug Evans <xdje42@gmail.com>
PR guile/17203
* gdb.guile/scm-parameter.exp: Add tests for trying to create
previously existing parameter, and previously ambiguously spelled
parameter.
2014-07-28 Will Newton <will.newton@linaro.org>
* gdb.base/varargs.exp: Remove KFAILs for ARM.
2014-07-26 Ludovic Courtès <ludo@gnu.org>
Doug Evans <xdje42@gmail.com>
PR guile/17146
* gdb.guile/types-module.exp: Add tests for wrong type arguments.
Always pass signals to the right thread Currently, GDB can pass a signal to the wrong thread in several different but related scenarios. E.g., if thread 1 stops for signal SIGFOO, the user switches to thread 2, and then issues "continue", SIGFOO is actually delivered to thread 2, not thread 1. This obviously messes up programs that use pthread_kill to send signals to specific threads. This has been a known issue for a long while. Back in 2008 when I made stop_signal be per-thread (2020b7ab), I kept the behavior -- see code in 'proceed' being removed -- wanting to come back to it later. The time has finally come now. The patch fixes this -- on resumption, intercepted signals are always delivered to the thread that had intercepted them. Another example: if thread 1 stops for a breakpoint, the user switches to thread 2, and then issues "signal SIGFOO", SIGFOO is actually delivered to thread 1, not thread 2, because 'proceed' first switches to thread 1 to step over its breakpoint... If the user deletes the breakpoint before issuing "signal FOO", then the signal is delivered to thread 2 (the current thread). "signal SIGFOO" can be used for two things: inject a signal in the program while the program/thread had stopped for none, bypassing "handle nopass"; or changing/suppressing a signal the program had stopped for. These scenarios are really two faces of the same coin, and GDB can't really guess what the user is trying to do. GDB might have intercepted signals in more than one thread even (see the new signal-command-multiple-signals-pending.exp test). At least in the inject case, it's obviously clear to me that the user means to deliver the signal to the currently selected thread, so best is to make the command's behavior consistent and easy to explain. Then, if the user is trying to suppress/change a signal the program had stopped for instead of injecting a new signal, but, the user had changed threads meanwhile, then she will be surprised that with: (gdb) continue Thread 1 stopped for signal SIGFOO. (gdb) thread 2 (gdb) signal SIGBAR ... GDB actually delivers SIGFOO to thread 1, and SIGBAR to thread 2 (with scheduler-locking off, which is the default, because then "signal" or any other resumption command resumes all threads). So the patch makes GDB detect that, and ask for confirmation: (gdb) thread 1 [Switching to thread 1 (Thread 10979)] (gdb) signal SIGUSR2 Note: Thread 3 previously stopped with signal SIGUSR2, User defined signal 2. Thread 2 previously stopped with signal SIGUSR1, User defined signal 1. Continuing thread 1 (the current thread) with specified signal will still deliver the signals noted above to their respective threads. Continue anyway? (y or n) All these scenarios are covered by the new tests. Tested on x86_64 Fedora 20, native and gdbserver. gdb/ 2014-07-25 Pedro Alves <palves@redhat.com> * NEWS: Mention signal passing and "signal" command changes. * gdbthread.h (struct thread_suspend_state) <stop_signal>: Extend comment. * breakpoint.c (until_break_command): Adjust clear_proceed_status call. * infcall.c (run_inferior_call): Adjust clear_proceed_status call. * infcmd.c (proceed_thread_callback, continue_1, step_once) (jump_command): Adjust clear_proceed_status call. (signal_command): Warn if other thread that are resumed have signals that will be delivered. Adjust clear_proceed_status call. (until_next_command, finish_command) (proceed_after_attach_callback, attach_command_post_wait) (attach_command): Adjust clear_proceed_status call. * infrun.c (proceed_after_vfork_done): Likewise. (proceed_after_attach_callback): Adjust comment. (clear_proceed_status_thread): Clear stop_signal if not in pass state. (clear_proceed_status_callback): Delete. (clear_proceed_status): New 'step' parameter. Only clear the proceed status of threads the command being prepared is about to resume. (proceed): If passed in an explicit signal, override stop_signal with it. Don't pass the last stop signal to the thread we're resuming. (init_wait_for_inferior): Adjust clear_proceed_status call. (switch_back_to_stepped_thread): Clear the signal if it should not be passed. * infrun.h (clear_proceed_status): New 'step' parameter. (user_visible_resume_ptid): Add comment. * linux-nat.c (linux_nat_resume_callback): Don't check whether the signal is in pass state. * remote.c (append_pending_thread_resumptions): Likewise. * mi/mi-main.c (proceed_thread): Adjust clear_proceed_status call. gdb/doc/ 2014-07-25 Pedro Alves <palves@redhat.com> Eli Zaretskii <eliz@gnu.org> * gdb.texinfo (Signaling) <signal command>: Explain what happens with multi-threaded programs. gdb/testsuite/ 2014-07-25 Pedro Alves <palves@redhat.com> * gdb.threads/signal-command-handle-nopass.c: New file. * gdb.threads/signal-command-handle-nopass.exp: New file. * gdb.threads/signal-command-multiple-signals-pending.c: New file. * gdb.threads/signal-command-multiple-signals-pending.exp: New file. * gdb.threads/signal-delivered-right-thread.c: New file. * gdb.threads/signal-delivered-right-thread.exp: New file.
2014-07-25 17:57:31 +02:00
2014-07-25 Pedro Alves <palves@redhat.com>
* gdb.threads/signal-command-handle-nopass.c: New file.
* gdb.threads/signal-command-handle-nopass.exp: New file.
* gdb.threads/signal-command-multiple-signals-pending.c: New file.
* gdb.threads/signal-command-multiple-signals-pending.exp: New file.
* gdb.threads/signal-delivered-right-thread.c: New file.
* gdb.threads/signal-delivered-right-thread.exp: New file.
Fix paginate-*.exp races Jan pointed out in <https://sourceware.org/ml/gdb-patches/2014-07/msg00553.html> that these testcases have racy results: gdb.base/double-prompt-target-event-error.exp gdb.base/paginate-after-ctrl-c-running.exp gdb.base/paginate-bg-execution.exp gdb.base/paginate-execution-startup.exp gdb.base/paginate-inferior-exit.exp This is easily reproducible with "read1" from: [reproducer for races of expect incomplete reads] http://sourceware.org/bugzilla/show_bug.cgi?id=12649 The '-notransfer -re "<return>" { exp_continue }' trick in the current tests doesn't actually work. The issue that led to the -notransfer trick was that "---Type <return> to continue, or q <return> to quit---" has two "<return>"s. If one wants gdb_test_multiple to not hit the built-in "<return>" match that results in FAIL, one has to expect the pagination prompt in chunks, first up to the first "<return>", then again, up to the second. Something around these lines: gdb_test_multiple "" $test { -re "<return>" { exp_continue } -re "to quit ---" { pass $test } } The intent was for -notransfer+exp_continue to make expect fetch more input, and rerun the matches against the now potentially fuller buffer, and then eventually the -re that includes the full pagination prompt regex would match instead (because it's listed higher up, it would match first). But, once that "<return>" -notransfer -re matches, it keeps re-matching forever. It seems like with exp_continue, expect immediately retries matching, instead of first reading in more data into the buffer, if available. Fix this like I should have done in the first place. There's actually no good reason for gdb_test_multiple to only match "<return>". We can make gdb_test_multiple expect the whole pagination prompt text instead, which is store in the 'pagination_prompt' global (similar to 'gdb_prompt'). Then a gdb_test_multiple caller that doesn't want the default match to trigger, because it wants to see one pagination prompt, does simply: gdb_test_multiple "" $test { -re "$pagination_prompt$" { pass $test } } which is just like when we don't want the default $gdb_prompt match within gdb_test_multiple to trigger, like: gdb_test_multiple "" $test { -re "$gdb_prompt $" { pass $test } } Tested on x86_64 Fedora 20. In addition, I've let the racy tests run all in parallel in a loop for 30 minutes, and they never failed. gdb/testsuite/ 2014-07-25 Pedro Alves <palves@redhat.com> * gdb.base/double-prompt-target-event-error.exp (cancel_pagination_in_target_event): Remove '-notransfer <return>' match. (cancel_pagination_in_target_event): Rework double prompt detection. * gdb.base/paginate-after-ctrl-c-running.exp (test_ctrlc_while_target_running_paginates): Remove '-notransfer <return>' match. * gdb.base/paginate-bg-execution.exp (test_bg_execution_pagination_return) (test_bg_execution_pagination_cancel): Remove '-notransfer <return>' matches. * gdb.base/paginate-execution-startup.exp (test_fg_execution_pagination_return) (test_fg_execution_pagination_cancel): Remove '-notransfer <return>' matches. * gdb.base/paginate-inferior-exit.exp (test_paginate_inferior_exited): Remove '-notransfer <return>' match. * lib/gdb-utils.exp (string_to_regexp): Move here from lib/gdb.exp. * lib/gdb.exp (pagination_prompt): Run text through string_to_regexp. (gdb_test_multiple): Match $pagination_prompt instead of "<return>". (string_to_regexp): Move to lib/gdb-utils.exp.
2014-07-25 11:07:38 +02:00
2014-07-25 Pedro Alves <palves@redhat.com>
* gdb.base/double-prompt-target-event-error.exp
(cancel_pagination_in_target_event): Remove '-notransfer <return>'
match.
(cancel_pagination_in_target_event): Rework double prompt
detection.
* gdb.base/paginate-after-ctrl-c-running.exp
(test_ctrlc_while_target_running_paginates): Remove '-notransfer
<return>' match.
* gdb.base/paginate-bg-execution.exp
(test_bg_execution_pagination_return)
(test_bg_execution_pagination_cancel): Remove '-notransfer
<return>' matches.
* gdb.base/paginate-execution-startup.exp
(test_fg_execution_pagination_return)
(test_fg_execution_pagination_cancel): Remove '-notransfer
<return>' matches.
* gdb.base/paginate-inferior-exit.exp
(test_paginate_inferior_exited): Remove '-notransfer <return>'
match.
* lib/gdb-utils.exp (string_to_regexp): Move here from lib/gdb.exp.
* lib/gdb.exp (pagination_prompt): Run text through
string_to_regexp.
(gdb_test_multiple): Match $pagination_prompt instead of
"<return>".
(string_to_regexp): Move to lib/gdb-utils.exp.
2014-07-22 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.arch/amd64-entry-value-paramref.S: New file.
* gdb.arch/amd64-entry-value-paramref.cc: New file.
* gdb.arch/amd64-entry-value-paramref.exp: New file.
* gdb.arch/amd64-optimout-repeat.S: New file.
* gdb.arch/amd64-optimout-repeat.c: New file.
* gdb.arch/amd64-optimout-repeat.exp: New file.
2014-07-17 Jan Kratochvil <jan.kratochvil@redhat.com>
PR gdb/17170
* gdb.base/statistics.exp: New file.
2014-07-17 Doug Evans <dje@google.com>
PR gdb/17170
* gdb.base/maint.exp: Update testing of per-command stats.
gdb.trace/tfile.c: Remove Thumb bit in one more more, general cleanup I noticed that the existing code casts a function's address to 'long', but that doesn't work correctly on some ABIs, like Win64, where long is 32-bit and while pointers are 64-bit: func_addr = (long) &write_basic_trace_file; Fixing that showed there's actually another place in the file that writes a function address to file, and therefore should clear the Thumb bit. This commit adds a macro+function pair to centralize the Thumb bit handling, and uses it in both places. The rest is just enough changes to make the file build without warnings with "-Wall -Wextra" with x86_64-w64-mingw32-gcc and i686-w64-mingw32-gcc cross compilers, and with -m32/-m64 on x86_64 GNU/Linux. Currently with x86_64-w64-mingw32-gcc we get: $ x86_64-w64-mingw32-gcc tfile.c -Wall -DTFILE_DIR=\"\" tfile.c: In function 'start_trace_file': tfile.c:51:23: error: 'S_IRGRP' undeclared (first use in this function) S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); ^ tfile.c:51:23: note: each undeclared identifier is reported only once for each function it appears in tfile.c:51:31: error: 'S_IROTH' undeclared (first use in this function) S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); ^ tfile.c: In function 'add_memory_block': tfile.c:79:10: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] ll_x = (unsigned long) addr; ^ tfile.c: In function 'write_basic_trace_file': tfile.c:113:15: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] func_addr = (long) &write_basic_trace_file; ^ tfile.c:137:3: warning: passing argument 1 of 'add_memory_block' from incompatible pointer type [enabled by default] add_memory_block (&testglob, sizeof (testglob)); ^ tfile.c:72:1: note: expected 'char *' but argument is of type 'int *' add_memory_block (char *addr, int size) ^ tfile.c:139:3: warning: passing argument 1 of 'add_memory_block' from incompatible pointer type [enabled by default] add_memory_block (&testglob2, 1); ^ tfile.c:72:1: note: expected 'char *' but argument is of type 'int *' add_memory_block (char *addr, int size) ^ tfile.c: In function 'write_error_trace_file': tfile.c:185:3: warning: implicit declaration of function 'alloca' [-Wimplicit-function-declaration] char *hex = alloca (len * 2 + 1); ^ tfile.c:185:15: warning: incompatible implicit declaration of built-in function 'alloca' [enabled by default] char *hex = alloca (len * 2 + 1); ^ tfile.c:211:6: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] (long) &write_basic_trace_file); ^ Tested on x86_64 Fedora 20, -m64 and -m32. Tested by Yao on arm targets. gdb/testsuite/ 2014-07-16 Pedro Alves <palves@redhat.com> * gdb.trace/tfile.c: Include unistd.h and stdint.h. (start_trace_file): Guard S_IRGRP and S_IROTH uses behind #ifdef. (tfile_write_64, tfile_write_16, tfile_write_8, tfile_write_addr) (tfile_write_buf): New functions. (add_memory_block): Rewrite using the above. (adjust_function_address): New function. (FUNCTION_ADDRESS): New macro. (write_basic_trace_file): Remove short_x local, and use tfile_write_16. Change type of func_addr local to unsigned long long. Use FUNCTION_ADDRESS instead of handling the Thumb bit here. Cast argument of add_memory_block to char pointer. (write_error_trace_file): Avoid alloca. Use FUNCTION_ADDRESS. (main): Remove parameters. * gdb.trace/tfile.exp: Remove nowarnings.
2014-07-16 20:25:41 +02:00
2014-07-16 Pedro Alves <palves@redhat.com>
* gdb.trace/tfile.c: Include unistd.h and stdint.h.
(start_trace_file): Guard S_IRGRP and S_IROTH uses behind #ifdef.
(tfile_write_64, tfile_write_16, tfile_write_8, tfile_write_addr)
(tfile_write_buf): New functions.
(add_memory_block): Rewrite using the above.
(adjust_function_address): New function.
(FUNCTION_ADDRESS): New macro.
(write_basic_trace_file): Remove short_x local, and use
tfile_write_16. Change type of func_addr local to unsigned long
long. Use FUNCTION_ADDRESS instead of handling the Thumb bit
here. Cast argument of add_memory_block to char pointer.
(write_error_trace_file): Avoid alloca. Use FUNCTION_ADDRESS.
(main): Remove parameters.
* gdb.trace/tfile.exp: Remove nowarnings.
2014-07-15 Simon Marchi <simon.marchi@ericsson.com>
* gdb.base/debug-expr.exp: Test string evaluation with
"debug expression" on.
gdb.base/reread.exp: Really restart GDB The other day I noticed that default_gdb_start reuses the GDB process if it has been spawned already: proc default_gdb_start { } { ... if [info exists gdb_spawn_id] { return 0 } I was a bit surprised, and so I hacked in an error to check whether anything is relying on it: + if [info exists gdb_spawn_id] { + error "GDB already spawned" + } And lo, that tripped on a funny buglet (see below). The comment in reread.exp says "Restart GDB entirely", but in reality, due to the above, that's not what is happening, as a gdb_exit call is missing. The test is proceeding with the previous GDB process... I don't really want to go hunt for whether there's an odd setup out there that assumes this in its board file or something, so for now, I'm taking the simple route of just making the test do what it says it does. I think this much makes it an obvious fix. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (gdb) PASS: gdb.base/reread.exp: run to foo() second time ERROR: tcl error sourcing ../src/gdb/testsuite/gdb.base/reread.exp. ERROR: GDB already spawned while executing "error "GDB already spawned"" invoked from within "if [info exists gdb_spawn_id] { error "GDB already spawned" }" (procedure "default_gdb_start" line 22) invoked from within "default_gdb_start" (procedure "gdb_start" line 2) invoked from within "gdb_start" invoked from within "if [is_remote target] { unsupported "second pass: GDB should check for changes before running" } else { # Put the older executable back in pl..." (file "../src/gdb/testsuite/gdb.base/reread.exp" line 114) invoked from within "source ../src/gdb/testsuite/gdb.base/reread.exp" ("uplevel" body line 1) invoked from within "uplevel #0 source ../src/gdb/testsuite/gdb.base/reread.exp" invoked from within "catch "uplevel #0 source $test_file_name"" testcase ../src/gdb/testsuite/gdb.base/reread.exp completed in 1 seconds ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ gdb/testsuite/ 2014-07-15 Pedro Alves <palves@redhat.com> * gdb.base/reread.exp: Use clean_restart.
2014-07-15 18:30:34 +02:00
2014-07-15 Pedro Alves <palves@redhat.com>
* gdb.base/reread.exp: Use clean_restart.
Add support for the __flash qualifier on AVR The __flash qualifier is part of the named address spaces for AVR [1]. It allows putting read-only data in the flash memory, normally reserved for code. When used together with a pointer, the DW_AT_address_class attribute is set to 1 and allows GDB to detect that when it will be dereferenced, the data will be loaded from the flash memory (with the LPM instruction). We can now properly debug the following code: ~~~ const __flash char data_in_flash = 0xab; int main (void) { const __flash char *pointer_to_flash = &data_in_flash; } ~~~ ~~~ (gdb) print pointer_to_flash $1 = 0x1e8 <data_in_flash> "\253" (gdb) print/x *pointer_to_flash $2 = 0xab (gdb) x/x pointer_to_flash 0x1e8 <data_in_flash>: 0xXXXXXXab ~~~ Whereas previously, GDB would revert to the default address space which is RAM and mapped in higher memory: ~~~ (gdb) print pointer_to_flash $1 = 0x8001e8 "" ~~~ [1] https://gcc.gnu.org/onlinedocs/gcc/Named-Address-Spaces.html 2014-07-15 Pierre Langlois <pierre.langlois@embecosm.com> gdb/ * avr-tdep.c (AVR_TYPE_ADDRESS_CLASS_FLASH): New macro. (AVR_TYPE_INSTANCE_FLAG_ADDRESS_CLASS_FLASH): Likewise. (avr_address_to_pointer): Check for AVR_TYPE_ADDRESS_CLASS_FLASH. (avr_pointer_to_address): Likewise. (avr_address_class_type_flags): New function. (avr_address_class_type_flags_to_name): Likewise. (avr_address_class_name_to_type_flags): Likewise. (avr_gdbarch_init): Set address_class_type_flags, address_class_type_flags_to_name and address_class_name_to_type_flags. gdb/testsuite/ * gdb.arch/avr-flash-qualifer.c: New. * gdb.arch/avr-flash-qualifer.exp: New.
2014-07-15 18:03:09 +02:00
2014-07-15 Pierre Langlois <pierre.langlois@embecosm.com>
* gdb.arch/avr-flash-qualifer.c: New.
* gdb.arch/avr-flash-qualifer.exp: New.
2014-07-14 Pedro Alves <palves@redhat.com>
* gdb.base/paginate-after-ctrl-c-running.c: New file.
* gdb.base/paginate-after-ctrl-c-running.exp: New file.
2014-07-14 Pedro Alves <palves@redhat.com>
* gdb.base/double-prompt-target-event-error.c: New file.
* gdb.base/double-prompt-target-event-error.exp: New file.
Remove the target from the event loop while in secondary prompts If a pagination prompt triggers while the target is running, and the target exits before the user responded to the pagination query, this happens: Starting program: foo ---Type <return> to continue, or q <return> to quit---No unwaited-for children left. Couldn't get registers: No such process. Couldn't get registers: No such process. Couldn't get registers: No such process. (gdb) Couldn't get registers: No such process. (gdb) To reiterate, the user hasn't replied to the pagination prompt above. A pagination query nests an event loop (in gdb_readline_wrapper). In async mode, in addition to stdin and signal handlers, we'll have the target also installed in the event loop still. So if the target reports an event, that wakes up the nested event loop, which calls into fetch_inferior_event etc. to handle the event which generates further output, all while we should be waiting for pagination confirmation... (TBC, any target event that generates output ends up spuriously waking up the pagination, though exits seem to be the worse kind.) I've played with a couple different approaches to fixing this, while at the same time trying to avoid being invasive. Both revolve around not listening to target events while in a pagination prompt (doing anything else I think would be a much bigger change). The approach taken just removes the target from the event loop while within gdb_readline_wrapper. The other approach used gdb_select directly, with only input_fd installed, but that had the issue that it didn't handle the async signal handlers, and turned out to be a bit more code than the first version. gdb/ 2014-07-14 Pedro Alves <palves@redhat.com> PR gdb/17072 * top.c: Include "inf-loop.h". (struct gdb_readline_wrapper_cleanup) <target_is_async_orig>: New field. (gdb_readline_wrapper_cleanup): Make the target async again, if it was async before. (gdb_readline_wrapper): Store whether the target is async, and make it sync. gdb/testsuite/ 2014-07-14 Pedro Alves <palves@redhat.com> PR gdb/17072 * gdb.base/paginate-inferior-exit.c: New file. * gdb.base/paginate-inferior-exit.exp: New file.
2014-07-14 20:55:32 +02:00
2014-07-14 Pedro Alves <palves@redhat.com>
PR gdb/17072
* gdb.base/paginate-inferior-exit.c: New file.
* gdb.base/paginate-inferior-exit.exp: New file.
Background execution + pagination aborts readline/gdb If pagination occurs as result of output sent as response to a target event while the target is executing in the background, subsequent input aborts readline/gdb: $ gdb program ... (gdb) continue& Continuing. (gdb) ---Type <return> to continue, or q <return> to quit--- *return* ---Type <return> to continue, or q <return> to quit--- Breakpoint 2, after_sleep () at paginate-bg-execution.c:21 ---Type <return> to continue, or q <return> to quit--- 21 return; /* after sleep */ p 1 readline: readline_callback_read_char() called with no handler! *abort/SIGABRT* $ gdb_readline_wrapper_line removes the handler after a line is processed. Usually, we'll end up re-displaying the prompt, and that reinstalls the handler. But if the output is coming out of handling a stop event, we don't re-display the prompt, and nothing restores the handler. So the next input wakes up the event loop and calls into readline, which aborts. We should do better with the prompt handling while the target is running (I think we should coordinate with readline, and hide/redisplay it around output), but that's a more invasive change better done post 7.8, so this patch is conservative and just reinstalls the handler as soon as we're out of the readline line callback. gdb/ 2014-07-14 Pedro Alves <palves@redhat.com> PR gdb/17072 * top.c (gdb_readline_wrapper_line): Tweak comment. (gdb_readline_wrapper_cleanup): If readline is enabled, reinstall the input handler callback. gdb/testsuite/ 2014-07-14 Pedro Alves <palves@redhat.com> PR gdb/17072 * gdb.base/paginate-bg-execution.c: New file. * gdb.base/paginate-bg-execution.exp: New file.
2014-07-14 20:55:32 +02:00
2014-07-14 Pedro Alves <palves@redhat.com>
PR gdb/17072
* gdb.base/paginate-bg-execution.c: New file.
* gdb.base/paginate-bg-execution.exp: New file.
Canceling pagination caused by execution command from command line aborts readline/gdb This fixes: $ ./gdb program -ex "set height 2" -ex "start" ... Reading symbols from /home/pedro/gdb/tests/threads...done. ---Type <return> to continue, or q <return> to quit---^CQuit << ctrl-c triggers a Quit *type something* readline: readline_callback_read_char() called with no handler! Aborted $ Usually, if an error propagates all the way to the top level, we'll re-enable stdin, in case the command that was running was a synchronous command. That's done in the event loop's actual loop (event-loop.c:start_event_loop). However, if a foreground execution command is run before the event loop starts and throws, nothing is presently reenabling stdin, which leaves sync_execution set. When we do start the event loop, because sync_execution is still (mistakenly) set, display_gdb_prompt removes the readline input callback, even though stdin is registered in the event loop. Any input from here on results in readline aborting. Such commands are run through catch_command_errors, catch_command_errors_const, so add the tweak there. gdb/ 2014-07-14 Pedro Alves <palves@redhat.com> PR gdb/17072 * main.c: Include event-top.h. (handle_command_errors): New function. (catch_command_errors, catch_command_errors_const): Use it. gdb/testsuite/ 2014-07-14 Pedro Alves <palves@redhat.com> PR gdb/17072 * gdb.base/paginate-execution-startup.c: New file. * gdb.base/paginate-execution-startup.exp: New file. * lib/gdb.exp (pagination_prompt): New global. (default_gdb_spawn): New procedure, factored out from default_gdb_spawn. (default_gdb_start): Adjust to call default_gdb_spawn. (gdb_spawn): New procedure.
2014-07-14 20:55:31 +02:00
2014-07-14 Pedro Alves <palves@redhat.com>
PR gdb/17072
* gdb.base/paginate-execution-startup.c: New file.
* gdb.base/paginate-execution-startup.exp: New file.
* lib/gdb.exp (pagination_prompt): New global.
(default_gdb_spawn): New procedure, factored out from
default_gdb_spawn.
(default_gdb_start): Adjust to call default_gdb_spawn.
(gdb_spawn): New procedure.
2014-07-14 Pedro Alves <palves@redhat.com>
* lib/gdb.exp (gdb_assert): New procedure.
* gdb.trace/backtrace.exp (gdb_backtrace_tdp_4): Use it.
Put the inferior's terminal settings in effect while running (fg) infcalls The "call" and "print" commands presently always run synchronously, in the foreground, but GDB currently forgets to put the inferior's terminal settings into effect while running them, on async-capable targets, resulting in: (gdb) print func () hello world Program received signal SIGTTOU, Stopped (tty output). 0x000000373bceb8d0 in __libc_tcdrain (fd=1) at ../sysdeps/unix/sysv/linux/tcdrain.c:29 29 return INLINE_SYSCALL (ioctl, 3, fd, TCSBRK, 1); The program being debugged was signaled while in a function called from GDB. GDB remains in the frame where the signal was received. To change this behavior use "set unwindonsignal on". Evaluation of the expression containing the function (func) will be abandoned. When the function is done executing, GDB will silently stop. (gdb) That's because target_terminal_inferior skips actually doing anything if running in the background, and, nothing is setting sync_execution while running infcalls: void target_terminal_inferior (void) { /* A background resume (``run&'') should leave GDB in control of the terminal. Use target_can_async_p, not target_is_async_p, since at this point the target is not async yet. However, if sync_execution is not set, we know it will become async prior to resume. */ if (target_can_async_p () && !sync_execution) return; This would best be all cleaned up by making GDB not even call target_terminal_inferior and try to pass the terminal to the inferior if running in the background, but that's a more invasive fix that is better done post-7.8. This was originally caught by a patch later in this series that makes catch_command_errors use exception_print instead of print_any_exception. Note that print_flush calls serial_drain_output while print_any_exception doesnt't have that bit. And, gdb.gdb/python-selftest.exp does: gdb_test "call catch_command_errors(execute_command, \"python print 5\", 0, RETURN_MASK_ALL)" \ "Python not initialized.* = 0" which without this fix results in SIGTTOU... gdb/ 2014-07-14 Pedro Alves <palves@redhat.com> * infcall.c (run_inferior_call): Set 'sync_execution' while running the inferior call. gdb/testsuite/ 2014-07-14 Pedro Alves <palves@redhat.com> * gdb.base/execution-termios.c: New file. * gdb.base/execution-termios.exp: New file.
2014-07-14 20:55:30 +02:00
2014-07-14 Pedro Alves <palves@redhat.com>
* gdb.base/execution-termios.c: New file.
* gdb.base/execution-termios.exp: New file.
2014-07-14 Tom Tromey <tromey@redhat.com>
* gdb.cp/vla-cxx.cc: New file.
* gdb.cp/vla-cxx.exp: New file.
2014-07-14 Tom Tromey <tromey@redhat.com>
* gdb.reverse/rerun-prec.c: New file.
* gdb.reverse/rerun-prec.exp: New file.
2014-07-12 Maciej W. Rozycki <macro@mips.com>
Maciej W. Rozycki <macro@codesourcery.com>
* lib/gdb-utils.exp: New file.
* lib/gdb.exp (gdb_run_cmd): Call gdb_init_commands, replacing
inline `gdb_init_command' processing.
(gdb_start_cmd): Likewise.
* lib/mi-support.exp (mi_run_cmd): Likewise.
* README: Document `gdb_init_command' and `gdb_init_commands'.
Fix false argv0-symlink.exp FAIL running under a very long directory name Starting program: /home/jkratoch/redhat/gdb-test-fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff/gdb/testsuite/gdb.base/argv0-symlink-filelink ^M [...] (gdb) print argv[0]^M $1 = 0x7fffffffda39 "/home/jkratoch/redhat/gdb-test-", 'f' <repeats 169 times>...^M (gdb) FAIL: gdb.base/argv0-symlink.exp: kept file symbolic link name after "set print repeats 10000": print argv[0]^M $1 = 0x7fffffffda39 "/home/jkratoch/redhat/gdb-test-fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"...^M (gdb) FAIL: gdb.base/argv0-symlink.exp: kept file symbolic link name after "set print elements 10000": print argv[0]^M $1 = 0x7fffffffda39 "/home/jkratoch/redhat/gdb-test-fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff/gdb/testsuite/gdb.base/argv0-symlink-filelink"^M (gdb) PASS: gdb.base/argv0-symlink.exp: kept file symbolic link name gdb/testsuite/ 2014-07-11 Jan Kratochvil <jan.kratochvil@redhat.com> Fix false FAIL running under a very long directory name. * gdb.base/argv0-symlink.exp: Add "set print repeats 10000" and "set print elements 10000". Twice.
2014-07-11 17:26:42 +02:00
2014-07-11 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix false FAIL running under a very long directory name.
* gdb.base/argv0-symlink.exp: Add "set print repeats 10000"
and "set print elements 10000". Twice.
2014-07-11 Yao Qi <yao@codesourcery.com>
* gdb.base/exprs.exp: "set print symbol off".
GDBserver crashes when killing a multi-thread process Here's an example, with the new test: gdbserver :9999 gdb.threads/kill gdb gdb.threads/kill (gdb) b 52 Breakpoint 1 at 0x4007f4: file kill.c, line 52. Continuing. Breakpoint 1, main () at kill.c:52 52 return 0; /* set break here */ (gdb) k Kill the program being debugged? (y or n) y gdbserver :9999 gdb.threads/kill Process gdb.base/watch_thread_num created; pid = 9719 Listening on port 1234 Remote debugging from host 127.0.0.1 Killing all inferiors Segmentation fault (core dumped) Backtrace: (gdb) bt #0 0x00000000004068a0 in find_inferior (list=0x66b060 <all_threads>, func=0x427637 <kill_one_lwp_callback>, arg=0x7fffffffd3fc) at src/gdb/gdbserver/inferiors.c:199 #1 0x00000000004277b6 in linux_kill (pid=15708) at src/gdb/gdbserver/linux-low.c:966 #2 0x000000000041354d in kill_inferior (pid=15708) at src/gdb/gdbserver/target.c:163 #3 0x00000000004107e9 in kill_inferior_callback (entry=0x6704f0) at src/gdb/gdbserver/server.c:2934 #4 0x0000000000406522 in for_each_inferior (list=0x66b050 <all_processes>, action=0x4107a6 <kill_inferior_callback>) at src/gdb/gdbserver/inferiors.c:57 #5 0x0000000000412377 in process_serial_event () at src/gdb/gdbserver/server.c:3767 #6 0x000000000041267c in handle_serial_event (err=0, client_data=0x0) at src/gdb/gdbserver/server.c:3880 #7 0x00000000004189ff in handle_file_event (event_file_desc=4) at src/gdb/gdbserver/event-loop.c:434 #8 0x00000000004181c6 in process_event () at src/gdb/gdbserver/event-loop.c:189 #9 0x0000000000418f45 in start_event_loop () at src/gdb/gdbserver/event-loop.c:552 #10 0x0000000000411272 in main (argc=3, argv=0x7fffffffd8d8) at src/gdb/gdbserver/server.c:3283 The problem is that linux_wait_for_event deletes lwps that have exited (even those not passed in as lwps of interest), while the lwp/thread list is being walked on with find_inferior. find_inferior can handle the current iterated inferior being deleted, but not others. When killing lwps, we don't really care about any of the pending status handling of linux_wait_for_event. We can just waitpid the lwps directly, which is also what GDB does (see linux-nat.c:kill_wait_callback). This way the lwps are not deleted while we're walking the list. They'll be deleted by linux_mourn afterwards. This crash triggers several times when running the testsuite against GDBserver with the native-gdbserver board (target remote), but as GDB can't distinguish between GDBserver crashing and "kill" being sucessful, as in both cases the connection is closed (the 'k' packet doesn't require a reply), and the inferior is gone, that results in no FAIL. The patch adds a generic test that catches the issue with extended-remote mode (and works fine with native testing too). Here's how it fails with the native-extended-gdbserver board without the fix: (gdb) info threads Id Target Id Frame 6 Thread 15367.15374 0x000000373bcbc98d in nanosleep () at ../sysdeps/unix/syscall-template.S:81 5 Thread 15367.15373 0x000000373bcbc98d in nanosleep () at ../sysdeps/unix/syscall-template.S:81 4 Thread 15367.15372 0x000000373bcbc98d in nanosleep () at ../sysdeps/unix/syscall-template.S:81 3 Thread 15367.15371 0x000000373bcbc98d in nanosleep () at ../sysdeps/unix/syscall-template.S:81 2 Thread 15367.15370 0x000000373bcbc98d in nanosleep () at ../sysdeps/unix/syscall-template.S:81 * 1 Thread 15367.15367 main () at .../gdb.threads/kill.c:52 (gdb) kill Kill the program being debugged? (y or n) y Remote connection closed ^^^^^^^^^^^^^^^^^^^^^^^^ (gdb) FAIL: gdb.threads/kill.exp: kill Extended remote should remain connected after the kill. gdb/gdbserver/ 2014-07-11 Pedro Alves <palves@redhat.com> * linux-low.c (kill_wait_lwp): New function, based on kill_one_lwp_callback, but use my_waitpid directly. (kill_one_lwp_callback, linux_kill): Use it. gdb/testsuite/ 2014-07-11 Pedro Alves <palves@redhat.com> * gdb.threads/kill.c: New file. * gdb.threads/kill.exp: New file.
2014-07-11 12:07:13 +02:00
2014-07-11 Pedro Alves <palves@redhat.com>
* gdb.threads/kill.c: New file.
* gdb.threads/kill.exp: New file.
2014-06-30 05:47:51 +02:00
2014-07-10 Yao Qi <yao@codesourcery.com>
* gdb.trace/tfile.c (write_basic_trace_file)
[__thumb__||__thumb2__]: Clear the Thumb bit of the function
address written to trace file.
2014-07-09 Pedro Alves <palves@redhat.com>
* gdb.base/attach-wait-input.exp: New file.
* gdb.base/attach-wait-input.c: New file.
Improve MI -var-info-path-expression for nested struct/union case. https://sourceware.org/ml/gdb-patches/2014-05/msg00383.html The MI command -var-info-path-expression currently does not handle non-anonymous structs / unions nested within other structs / unions, it will skip parts of the expression. Consider this example: ## START EXAMPLE ## $ cat ex.c #include <string.h> int main () { struct s1 { int a; }; struct ss { struct s1 x; }; struct ss an_ss; memset (&an_ss, 0, sizeof (an_ss)); return 0; } $ gcc -g -o ex.x ex.c $ gdb ex.x (gdb) break 18 Breakpoint 1 at 0x80483ba: file ex.c, line 18. (gdb) run Starting program: /home/user/ex.x Breakpoint 1, main () at ex.c:18 18 return 0; (gdb) interpreter-exec mi "-var-create an_ss * an_ss" (gdb) interpreter-exec mi "-var-list-children an_ss" ^done,numchild="1",children=[child={name="an_ss.x",exp="x",numchild="1",type="struct s1",thread-id="1"}],has_more="0" (gdb) interpreter-exec mi "-var-list-children an_ss.x" ^done,numchild="1",children=[child={name="an_ss.x.a",exp="a",numchild="0",type="int",thread-id="1"}],has_more="0" (gdb) interpreter-exec mi "-var-list-children an_ss.x.a" ^done,numchild="0",has_more="0" (gdb) interpreter-exec mi "-var-info-path-expression an_ss.x.a" ^done,path_expr="(an_ss).a" (gdb) print (an_ss).a There is no member named a. ## END EXAMPLE ## Notice that the path expression returned is wrong, and as a result the print command fails. This patch adds a new method to the varobj_ops structure called is_path_expr_parent, to allow language specific control over finding the parent varobj, the current logic becomes the C/C++ version and is extended to handle the nested cases. No other language currently uses this code, so all other languages just get a default method. With this patch, the above example now finishes like this: ## START EXAMPLE ## $ gdb ex.x (gdb) break 18 Breakpoint 1 at 0x80483ba: file ex.c, line 18. (gdb) run Starting program: /home/user/ex.x Breakpoint 1, main () at ex.c:18 18 return 0; (gdb) interpreter-exec mi "-var-list-children an_ss" ^done,numchild="1",children=[child={name="an_ss.x",exp="x",numchild="1",type="struct s1",thread-id="1"}],has_more="0" (gdb) interpreter-exec mi "-var-list-children an_ss.x" ^done,numchild="1",children=[child={name="an_ss.x.a",exp="a",numchild="0",type="int",thread-id="1"}],has_more="0" (gdb) interpreter-exec mi "-var-list-children an_ss.x.a" ^done,numchild="0",has_more="0" (gdb) interpreter-exec mi "-var-info-path-expression an_ss.x.a" ^done,path_expr="((an_ss).x).a" (gdb) print ((an_ss).x).a $1 = 0 ## END EXAMPLE ## Notice that the path expression is now correct, and the print is a success. gdb/ChangeLog: * ada-varobj.c (ada_varobj_ops): Fill in is_path_expr_parent field. * c-varobj.c (c_is_path_expr_parent): New function, moved core from varobj.c, with additional checks. (c_varobj_ops): Fill in is_path_expr_parent field. (cplus_varobj_ops): Fill in is_path_expr_parent field. * jv-varobj.c (java_varobj_ops): Fill in is_path_expr_parent field. * varobj.c (is_path_expr_parent): Call is_path_expr_parent varobj ops method. (varobj_default_is_path_expr_parent): New function. * varobj.h (lang_varobj_ops): Add is_path_expr_parent field. (varobj_default_is_path_expr_parent): Declare new function. gdb/testsuite/ChangeLog: * gdb.mi/var-cmd.c (do_nested_struct_union_tests): New function setting up test structures. (main): Call new test function. * gdb.mi/mi2-var-child.exp: Create additional breakpoint in new test function, continue into test function and walk test structures.
2014-07-07 20:22:36 +02:00
2014-07-09 Andrew Burgess <andrew.burgess@embecosm.com>
* gdb.mi/var-cmd.c (do_nested_struct_union_tests): New function
setting up test structures.
(main): Call new test function.
* gdb.mi/mi2-var-child.exp: Create additional breakpoint in new
test function, continue into test function and walk test
structures.
2014-07-02 Yao Qi <yao@codesourcery.com>
* gdb.trace/entry-values.c: Define labels 'foo_start' and
'bar_start' at the beginning of functions 'foo' and 'bar'
respectively.
* gdb.trace/entry-values.exp: Use 'foo_start' and 'bar_start'
instead of 'foo' and 'bar'.
2014-07-08 Markus Metzger <markus.t.metzger@intel.com>
* gdb.btrace/segv.exp: New.
* gdb.btrace/segv.c: New.
2014-07-02 Luis Machado <lgustavo@codesourcery.com>
* gdb.trace/entry-values.exp: Handle powerpc-specific branch
instruction.
2014-06-30 Mark Wielaard <mjw@redhat.com>
* gdb.base/constvars.c (violent, violet, vips, virgen, vulgar,
vulture, vilify, villar): New volatile array constants.
(vindictive, vegetation): New const volatile array constants.
* gdb.base/volatile.exp: Test volatile and const volatile array
types.
2014-06-30 Andreas Arnez <arnez@linux.vnet.ibm.com>
* gdb.base/watchpoint-reuse-slot.exp: Handle the case that the
target lacks support for awatch, rwatch, or hbreak.
Associate dummy_frame with ptid This patch is to add ptid into dummy_frame and extend frame_id to dummy_frame_id (which has a ptid field). With this change, GDB uses dummy_frame_id (thread ptid and frame_id) to find the dummy frames. Currently, dummy frames are looked up by frame_id, which isn't accurate in non-stop or multi-process mode. The test case gdb.multi/dummy-frame-restore.exp shows the problem and this patch can fix it. Test dummy-frame-restore.exp makes two inferiors stop at different functions, say, inferior 1 stops at f1 while inferior 2 stops at f2. Set a breakpoint to a function, do the inferior call in two inferiors, and GDB has two dummy frames of the same frame_id. When the inferior call is finished, GDB will look up a dummy frame from its stack/list and restore the inferior's regcache. Two inferiors are finished in different orders, the inferiors' states are restored differently, which is wrong. Running dummy-frame-restore.exp under un-patched GDB, we'll get two fails: FAIL: gdb.multi/dummy-frame-restore.exp: inf 2 first: after infcall: bt in inferior 2 FAIL: gdb.multi/dummy-frame-restore.exp: inf 2 first: after infcall: bt in inferior 1 With this patch applied, GDB will choose the correct dummy_frame to restore for a given inferior, because ptid is considered when looking up dummy frames. Two fails above are fixed. Regression tested on x86_64-linux, both native and gdbserver. gdb: 2014-06-27 Yao Qi <yao@codesourcery.com> * breakpoint.c (check_longjmp_breakpoint_for_call_dummy): Change parameter type to 'struct thread_info *'. Caller updated. * breakpoint.h (check_longjmp_breakpoint_for_call_dummy): Update declaration. * dummy-frame.c (struct dummy_frame_id): New. (dummy_frame_id_eq): New function. (struct dummy_frame) <id>: Change its type to 'struct dummy_frame_id'. (dummy_frame_push): Add parameter ptid and save it in dummy_frame_id. (pop_dummy_frame_bpt): Use ptid of dummy_frame instead of inferior_ptid. (pop_dummy_frame): Assert that the ptid of dummy_frame equals to inferior_ptid. (lookup_dummy_frame): Change parameter type to 'struct dummy_frame_id *'. Callers updated. Call dummy_frame_id_eq instead of frame_id_eq. (dummy_frame_pop): Add parameter ptid. Callers updated. Update comments. Compose dummy_frame_id and pass it to lookup_dummy_frame. (dummy_frame_discard): Add parameter ptid. (dummy_frame_sniffer): Compose dummy_frame_id and call dummy_frame_id_eq instead of frame_id_eq. (fprint_dummy_frames): Print ptid. * dummy-frame.h: Remove comments. (dummy_frame_push): Add ptid in declaration. (dummy_frame_pop, dummy_frame_discard): Likewise. gdb/testsuite: 2014-06-27 Yao Qi <yao@codesourcery.com> * gdb.multi/dummy-frame-restore.exp: New. * gdb.multi/dummy-frame-restore.c: New. gdb/doc: 2014-06-27 Yao Qi <yao@codesourcery.com> * gdb.texinfo (Maintenance Commands): Update the output of 'maint print dummy-frames' command.
2014-06-25 05:52:52 +02:00
2014-06-27 Yao Qi <yao@codesourcery.com>
* gdb.multi/dummy-frame-restore.exp: New.
* gdb.multi/dummy-frame-restore.c: New.
2014-06-25 Markus Metzger <markus.t.metzger@intel.com>
* gdb.btrace/gcore.exp: New.
x86 Linux watchpoints: Couldn't write debug register: Invalid argument. This patch fixes this on x86 Linux: (gdb) watch *buf@2 Hardware watchpoint 8: *buf@2 (gdb) si 0x00000000004005a7 34 for (i = 0; i < 100000; i++); /* stepi line */ (gdb) del Delete all breakpoints? (y or n) y (gdb) watch *(buf+1)@1 Hardware watchpoint 9: *(buf+1)@1 (gdb) si 0x00000000004005a7 in main () at ../../../src/gdb/testsuite/gdb.base/watchpoint-reuse-slot.c:34 34 for (i = 0; i < 100000; i++); /* stepi line */ Couldn't write debug register: Invalid argument. (gdb) In the example above the debug registers are being switched from this state: CONTROL (DR7): 0000000000050101 STATUS (DR6): 0000000000000000 DR0: addr=0x0000000000601040, ref.count=1 DR1: addr=0x0000000000000000, ref.count=0 DR2: addr=0x0000000000000000, ref.count=0 DR3: addr=0x0000000000000000, ref.count=0 to this: CONTROL (DR7): 0000000000010101 STATUS (DR6): 0000000000000000 DR0: addr=0x0000000000601041, ref.count=1 DR1: addr=0x0000000000000000, ref.count=0 DR2: addr=0x0000000000000000, ref.count=0 DR3: addr=0x0000000000000000, ref.count=0 That is, before, DR7 was setup for watching a 2 byte region starting at what's in DR0 (0x601040). And after, DR7 is setup for watching a 1 byte region starting at what's in DR0 (0x601041). We always write DR0..DR3 before DR7, because if we enable a slot's bits in DR7, you need to have already written the corresponding DR0..DR3 registers -- the kernel rejects the DR7 write with EINVAL otherwise. The error shown above is the opposite scenario. When we try to write 0x601041 to DR0, DR7's bits still indicate intent of watching a 2-byte region. That DR0/DR7 combination is invalid, because 0x601041 is unaligned. To watch two bytes, we'd have to use two slots. So the kernel errors out with EINVAL. Fix this by always first clearing DR7, then writing DR0..DR3, and then setting DR7's bits. A little optimization -- if we're disabling the last watchpoint, then we can clear DR7 just once. The changes to nat/i386-dregs.c make that easier to detect, and as bonus, they make it a little easier to make sense of DR7 in the debug logs, as we no longer need to remember we're seeing stale bits. Tested on x86_64 Fedora 20, native and GDBserver. This adds an exhaustive test that switches between many different combinations of watchpoint types and addresses and widths. gdb/ 2014-06-23 Pedro Alves <palves@redhat.com> * amd64-linux-nat.c (amd64_linux_prepare_to_resume): Clear DR_CONTROL before setting DR0..DR3. * i386-linux-nat.c (i386_linux_prepare_to_resume): Likewise. * nat/i386-dregs.c (i386_remove_aligned_watchpoint): Clear all bits of DR_CONTROL related to the debug register slot being disabled. If all slots are vacant, clear local slowdown as well, and assert DR_CONTROL is 0. gdb/gdbserver/ 2014-06-23 Pedro Alves <palves@redhat.com> * linux-x86-low.c (x86_linux_prepare_to_resume): Clear DR_CONTROL before setting DR0..DR3. gdb/testsuite/ 2014-06-23 Pedro Alves <palves@redhat.com> * gdb.base/watchpoint-reuse-slot.c: New file. * gdb.base/watchpoint-reuse-slot.exp: New file.
2014-06-23 17:44:04 +02:00
2014-06-23 Pedro Alves <palves@redhat.com>
* gdb.base/watchpoint-reuse-slot.c: New file.
* gdb.base/watchpoint-reuse-slot.exp: New file.
2014-06-23 Siva Chandra Reddy <sivachandra@google.com>
* gdb.python/py-xmethods.exp: Use "progspace" instead of the
progspace's filename in 'info', 'enable' and 'disable' command
tests.
2014-06-23 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.arch/amd64-stap-special-operands.exp: Use is_lp64_target.
* gdb.arch/amd64-stap-optional-prefix.exp: Likewise.
* gdb.dwarf2/dw2-error.exp: Use istarget and is_lp64_target.
Move shared native target specific code to gdb/nat https://sourceware.org/gdb/wiki/Common describes the following directory structure: gdb/nat/ Native target backend files. Code that interfaces with the host debug API. E.g., ptrace code, Windows debug API code, procfs code should go here. gdb/target/ Host-independent, target vector specific code (target_ops). gdb/common/ All other shared code. This commit moves all native target backend files currently in gdb/common to gdb/nat. gdb/ 2014-06-20 Gary Benson <gbenson@redhat.com> * common/gdb_thread_db.h: Moved to nat. All includes updated. * common/glibc_thread_db.h: Likewise. * common/i386-cpuid.h: Likewise. * common/i386-gcc-cpuid.h: Likewise. * common/linux-btrace.h: Likewise. * common/linux-osdata.h: Likewise. * common/linux-procfs.h: Likewise. * common/linux-ptrace.h: Likewise. * common/mips-linux-watch.h: Likewise. * common/linux-btrace.c: Moved to nat. * common/linux-osdata.c: Likewise. * common/linux-procfs.c: Likewise. * common/linux-ptrace.c: Likewise. * common/mips-linux-watch.c: Likewise. * nat/gdb_thread_db.h: Moved from common. * nat/glibc_thread_db.h: Likewise. * nat/i386-cpuid.h: Likewise. * nat/i386-gcc-cpuid.h: Likewise. * nat/linux-btrace.c: Likewise. * nat/linux-btrace.h: Likewise. * nat/linux-osdata.c: Likewise. * nat/linux-osdata.h: Likewise. * nat/linux-procfs.c: Likewise. * nat/linux-procfs.h: Likewise. * nat/linux-ptrace.c: Likewise. * nat/linux-ptrace.h: Likewise. * nat/mips-linux-watch.c: Likewise. * nat/mips-linux-watch.h: Likewise. * Makefile.in (HFILES_NO_SRCDIR): Reflect new locations. (object file files): Reordered. * gdb/copyright.py (EXCLUDE_LIST): Reflect new location of glibc_thread_db.h. gdb/gdbserver/ 2014-06-20 Gary Benson <gbenson@redhat.com> * Makefile.in (SFILES): Update locations for files moved from common to nat. (object file files): Reordered. gdb/testsuite/ 2014-06-20 Gary Benson <gbenson@redhat.com> * gdb.arch/i386-avx.exp: Fix include file location. * gdb.arch/i386-sse.exp: Likewise.
2014-06-19 15:46:38 +02:00
2014-06-20 Gary Benson <gbenson@redhat.com>
* gdb.arch/i386-avx.exp: Fix include file location.
* gdb.arch/i386-sse.exp: Likewise.
2014-06-19 Iain Buclaw <ibuclaw@gdcproject.org>
* gdb.dlang/expression.exp: New file.
Fix next over threaded execl with "set scheduler-locking step". Running gdb.threads/thread-execl.exp with scheduler-locking set to "step" reveals a problem: (gdb) next^M [Thread 0x7ffff7fda700 (LWP 27168) exited]^M [New LWP 27168]^M [Thread 0x7ffff74ee700 (LWP 27174) exited]^M process 27168 is executing new program: /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.threads/thread-execl^M [Thread debugging using libthread_db enabled]^M Using host libthread_db library "/lib64/libthread_db.so.1".^M infrun.c:5225: internal-error: switch_back_to_stepped_thread: Assertion `!schedlock_applies (1)' failed.^M A problem internal to GDB has been detected,^M further debugging may prove unreliable.^M Quit this debugging session? (y or n) FAIL: gdb.threads/thread-execl.exp: schedlock step: get to main in new image (GDB internal error) The assertion is correct. The issue is that GDB is mistakenly trying to switch back to an exited thread, that was previously stepping when it exited. This is exactly the sort of thing the test wants to make sure doesn't happen: # Now set a breakpoint at `main', and step over the execl call. The # breakpoint at main should be reached. GDB should not try to revert # back to the old thread from the old image and resume stepping it We don't see this bug with schedlock off only because a different sequence of events makes GDB manage to delete the thread instead of marking it exited. This particular internal error can be fixed by making the loop over all threads in switch_back_to_stepped_thread skip exited threads. But, looking over other ALL_THREADS users, all either can or should be skipping exited threads too. So for simplicity, this patch replaces ALL_THREADS with a new macro that skips exited threads itself, and updates everything to use it. Tested on x86_64 Fedora 20. gdb/ 2014-06-19 Pedro Alves <palves@redhat.com> * gdbthread.h (ALL_THREADS): Delete. (ALL_NON_EXITED_THREADS): New macro. * btrace.c (btrace_free_objfile): Use ALL_NON_EXITED_THREADS instead of ALL_THREADS. * infrun.c (find_thread_needs_step_over) (switch_back_to_stepped_thread): Use ALL_NON_EXITED_THREADS instead of ALL_THREADS. * record-btrace.c (record_btrace_open) (record_btrace_stop_recording, record_btrace_close) (record_btrace_is_replaying, record_btrace_resume) (record_btrace_find_thread_to_move, record_btrace_wait): Likewise. * remote.c (append_pending_thread_resumptions): Likewise. * thread.c (thread_apply_all_command): Likewise. gdb/testsuite/ 2014-06-19 Pedro Alves <palves@redhat.com> * gdb.threads/thread-execl.exp (do_test): New procedure, factored out from ... (top level): ... here. Iterate running tests under different scheduler-locking settings.
2014-06-19 12:59:03 +02:00
2014-06-19 Pedro Alves <palves@redhat.com>
* gdb.threads/thread-execl.exp (do_test): New procedure, factored
out from ...
(top level): ... here. Iterate running tests under different
scheduler-locking settings.
2014-06-18 Luis Machado <lgustavo@codesourcery.com>
* gdb.cp/nsalias.exp: Set type of low_pc and high_pc entries
to DW_FORM_addr and use non-zero addresses.
2014-06-18 Siva Chandra Reddy <sivachandra@google.com>
PR gdb/17017
* gdb.python/py-xmethods.cc: Add global function call counters and
increment them in their respective functions. Remove "cout"
statements.
* gdb.python/py-xmethods.exp: Make tests check the global function
call counters instead of depending on inferior IO.
Symptom: Using the test program gdb.base/foll-fork.c, with follow-fork-mode set to "child" and detach-on-fork set to "off", stepping or running past the fork call results in the child process running to completion, when it should just finish the single step. In addition, the breakpoint is not removed from the parent process, so if it is resumed it receives a SIGTRAP. Cause: No matter what the setting for detach-on-fork, when stepping past a fork, the single-step breakpoint (step_resume_breakpoint) is not handled correctly in the parent. The SR breakpoint is cloned for the child process, but before the clone is associated with the child it is treated as a duplicate of the original, associated wth the parent. This results in the insertion state of the original SR breakpoint and the clone being "swapped" by breakpoint.c:update_global_location_list, so that the clone is marked as inserted. In the case where the parent is not detached, the two breakpoints remain in that state. The breakpoint is never inserted in the child, because although the cloned SR breakpoint is associated with the child, it is marked as inserted. When the child is resumed, it runs to completion. The breakpoint is never removed from the parent, so that if it is resumed after the child exits, it gets a SIGTRAP. Here is the sequence of events: 1) handle_inferior_event: FORK event is recognized. 2) handle_inferior_event: detach_breakpoints removes all breakpoints from the child. 3) follow_fork: the parent SR breakpoint is cloned. Part of this procedure is to call update_global_location_list, which swaps the insertion state of the original and cloned SR breakpoints as part of ensuring that duplicate breakpoints are only inserted once. At this point the original SR breakpoint is not marked as inserted, and the clone is. The breakpoint is actually inserted in the parent but not the child. 4) follow_fork: the original breakpoint is deleted by calling delete_step_resume_breakpoint. Since the original is not marked as inserted, the actual breakpoint remains in the parent process. update_global_location_list is called again as part of the deletion. The clone is still associated with the parent, but since it is marked as enabled and inserted, the breakpoint is left in the parent. 5) follow_fork: if detach-on-fork is 'on', the actual breakpoint will be removed from the parent in target_detach, based on the cloned breakpoint still associated with the parent. Then the clone is no longer marked as inserted. In follow_inferior_reset_breakpoints the clone is associated with the child, and can be inserted. If detach-on-fork is 'off', the actual breakpoint in the parent is never removed (although the breakpoint had been deleted from the list). Since the clone continues to be marked 'inserted', the SR breakpoint is never inserted in the child. Fix: Set the cloned breakpoint as disabled from the moment it is created. This is done by modifying clone_momentary_breakpoint to take an additional argument, LOC_ENABLED, which is used as the value of the bp_location->enabled member. The clone must be disabled at that point because clone_momentary_breakpoint calls update_global_location_list, which will swap treat the clone as a duplicate of the original breakpoint if it is enabled. All the calls to clone_momentary_breakpoint had to be modified to pass '1' or '0'. I looked at implementing an enum for the enabled member, but concluded that readability would suffer because there are so many places it is used as a boolean, e.g. "if (bl->enabled)". In follow_inferior_reset_breakpoints the clone is set to enabled once it has been associated with the child process. With this, the bp_location 'inserted' member is maintained correctly throughout the follow-fork procedure and the behavior is as expected. The same treatment is given to the exception_resume_breakpoint when following a fork. Testing: Ran 'make check' on Linux x64. Along with the fix above, the coverage of the follow-fork test gdb.base/foll-fork.exp was expanded to: 1) cover all the combinations of values for follow-fork-mode and detach-on-fork 2) make sure that both user breakpoints and single-step breakpoints are propagated correctly to the child 3) check that the inferior list has the expected contents after following the fork. 4) check that unfollowed, undetached inferiors can be resumed. gdb/ 2014-06-18 Don Breazeal <donb@codesourcery.com> * breakpoint.c (set_longjmp_breakpoint): Call momentary_breakpoint_from_master with additional argument. (set_longjmp_breakpoint_for_call_dummy): Call momentary_breakpoint_from_master with additional argument. (set_std_terminate_breakpoint): Call momentary_breakpoint_from_master with additional argument. (momentary_breakpoint_from_master): Add argument to function definition and use it to initialize structure member flag. (clone_momentary_breakpoint): Call momentary_breakpoint_from_master with additional argument. * infrun.c (follow_inferior_reset_breakpoints): Clear structure member flags set in momentary_breakpoint_from_master. gdb/testsuite/ 2014-06-18 Don Breazeal <donb@codesourcery.com> * gdb.base/foll-fork.exp (default_fork_parent_follow): Deleted procedure. (explicit_fork_parent_follow): Deleted procedure. (explicit_fork_child_follow): Deleted procedure. (test_follow_fork): New procedure. (do_fork_tests): Replace calls to deleted procedures with calls to test_follow_fork and reset GDB for subsequent procedure calls.
2014-06-18 11:25:47 +02:00
2014-06-18 Don Breazeal <donb@codesourcery.com>
* gdb.base/foll-fork.exp (default_fork_parent_follow):
Deleted procedure.
(explicit_fork_parent_follow): Deleted procedure.
(explicit_fork_child_follow): Deleted procedure.
(test_follow_fork): New procedure.
(do_fork_tests): Replace calls to deleted procedures with
calls to test_follow_fork and reset GDB for subsequent
procedure calls.
2014-06-17 Yao Qi <yao@codesourcery.com>
* gdb.base/wchar.exp: Set $cent to \u00A2 if "host-charset" is
CP1252.
2014-06-17 Luis Machado <lgustavo@codesourcery.com>
* gdb.mi/mi-var-rtti.cc (type_update_when_use_rtti_test):
Initialize ptr and S explicitly.
(skip_type_update_when_not_use_rtti_test): Likewise.
2014-06-16 Keith Seitz <keiths@redhat.com>
PR mi/15863
* gdb.mi/mi-var-cmd.exp: Add test for -var-update before
the inferior is started.
"$ gdb PROGRAM" vs "(gdb) file PROGRAM" difference; warn on failure to remove breakpoint. Turns out there's a difference between loading the program with "gdb PROGRAM", vs loading it with "(gdb) file PROGRAM". The latter results in the objfile ending up with OBJF_USERLOADED set, while not with the former. (That difference seems bogus, but still that's not the point of this patch. We can revisit that afterwards.) The new code that suppresses breakpoint removal errors for add-symbol-file objects ends up being too greedy: /* In some cases, we might not be able to remove a breakpoint in a shared library that has already been removed, but we have not yet processed the shlib unload event. Similarly for an unloaded add-symbol-file object - the user might not yet have had the chance to remove-symbol-file it. shlib_disabled will be set if the library/object has already been removed, but the breakpoint hasn't been uninserted yet, e.g., after "nosharedlibrary" or "remove-symbol-file" with breakpoints always-inserted mode. */ if (val && (bl->loc_type == bp_loc_software_breakpoint && (bl->shlib_disabled || solib_name_from_address (bl->pspace, bl->address) || userloaded_objfile_contains_address_p (bl->pspace, bl->address)))) val = 0; as it turns out that OBJF_USERLOADED can be set for objfiles loaded by some other means not add-symbol-file. In this case, symbol-file (or "file", which is really just "exec-file"+"symbol-file"). Recall that add-symbol-file is documented as: (gdb) help add-symbol-file Load symbols from FILE, assuming FILE has been dynamically loaded. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ And it's the "dynamically loaded" aspect that the breakpoint.c code cares about. So make add-symbol-file set OBJF_SHARED on its objfiles too, and tweak the breakpoint.c code to look for OBJF_SHARED instead of OBJF_USERLOADED. This restores back the missing breakpoint removal warning when we let sss-bp-on-user-bp-2.exp run on native GNU/Linux (https://sourceware.org/ml/gdb-patches/2014-06/msg00335.html): (gdb) PASS: gdb.base/sss-bp-on-user-bp-2.exp: define stepi_del_break stepi_del_break warning: Error removing breakpoint 3 (gdb) FAIL: gdb.base/sss-bp-on-user-bp-2.exp: stepi_del_break I say "restores" because this was GDB's behavior in 7.7 and earlier. And, likewise, "file" with no arguments only started turning breakpoints set in the main executable to "<pending>" with the remote-symbol-file patch (63644780). The old behavior is now restored, and we break-unload-file.exp test now exercizes both "gdb; file PROGRAM" and "gdb PROGRAM". gdb/ 2014-06-16 Pedro Alves <palves@redhat.com> * breakpoint.c (insert_bp_location, remove_breakpoint_1): Adjust. (disable_breakpoints_in_freed_objfile): Skip objfiles that don't have OBJF_SHARED set. * objfiles.c (userloaded_objfile_contains_address_p): Rename to... (shared_objfile_contains_address_p): ... this. Check OBJF_SHARED instead of OBJF_USERLOADED. * objfiles.h (OBJF_SHARED): Update comment. (userloaded_objfile_contains_address_p): Rename to ... (shared_objfile_contains_address_p): ... this, and update comments. * symfile.c (add_symbol_file_command): Also set OBJF_SHARED in the new objfile. (remove_symbol_file_command): Skip objfiles that don't have OBJF_SHARED set. gdb/testsuite/ 2014-06-16 Pedro Alves <palves@redhat.com> * gdb.base/break-main-file-remove-fail.c: New file. * gdb.base/break-main-file-remove-fail.exp: New file. * gdb.base/break-unload-file.exp: Use build_executable instead of prepare_for_testing. (test_break): New parameter "initial_load". Handle it. (top level): Add initial_load cmdline/file axis.
2014-06-16 16:38:13 +02:00
2014-06-16 Pedro Alves <palves@redhat.com>
* gdb.base/break-main-file-remove-fail.c: New file.
* gdb.base/break-main-file-remove-fail.exp: New file.
* gdb.base/break-unload-file.exp: Use build_executable instead of
prepare_for_testing.
(test_break): New parameter "initial_load". Handle it.
(top level): Add initial_load cmdline/file axis.
2014-06-12 Tom Tromey <tromey@redhat.com>
* gdb.base/completion.exp: Don't use directory name in test.
2014-06-09 Gary Benson <gbenson@redhat.com>
* gdb.base/sigall.c [Functions to send signals]: Reorder to
separate the always-available ANSI-standard signals from the
signals that require checking.
(main): Likewise.
* gdb.reverse/sigall-reverse.c [Functions to send signals]:
Likewise.
(main): Likewise.
2014-06-07 Keith Seitz <keiths@redhat.com>
Revert:
PR c++/16253
* gdb.cp/var-tag.cc: New file.
* gdb.cp/var-tag.exp: New file.
* gdb.dwarf2/dw2-ada-ffffffff.exp: Set the language to C++.
* gdb.dwarf2/dw2-anon-mptr.exp: Likewise.
* gdb.dwarf2/dw2-double-set-die-type.exp: Likewise.
* gdb.dwarf2/dw2-inheritance.exp: Likewise.
2014-06-07 01:08:54 +02:00
2014-06-06 Doug Evans <xdje42@gmail.com>
* gdb.guile/scm-frame-args.c (foo): Tweak to work with gcc 4.6.3.
sss-bp-on-user-bp-2.exp sometimes fails on native GNU/Linux. I noticed that sss-bp-on-user-bp-2.exp is racy on native GNU/Linux. I sometimes still see an int3 in the disassembly: (gdb) PASS: gdb.base/sss-bp-on-user-bp-2.exp: set debug target 0 disassemble test Dump of assembler code for function test: 0x0000000000400590 <+0>: push %rbp 0x0000000000400591 <+1>: mov %rsp,%rbp 0x0000000000400594 <+4>: nop => 0x0000000000400595 <+5>: int3 0x0000000000400596 <+6>: pop %rbp 0x0000000000400597 <+7>: retq End of assembler dump. (gdb) FAIL: gdb.base/sss-bp-on-user-bp-2.exp: before/after disassembly matches Enabling infrun/target debug logs, we can see the problem. Simplified, that's: (gdb) PASS: gdb.base/sss-bp-on-user-bp-2.exp: define stepi_del_break stepi_del_break infrun: clear_proceed_status_thread (process 25311) infrun: resume (step=1, signal=GDB_SIGNAL_0), trap_expected=0, current thread [process 25311] at 0x400594 LLR: PTRACE_SINGLESTEP process 25311, 0 (resume event thread) target_resume (25311, step, 0) native:target_xfer_partial (3, (null), 0x0, 0x32dce4c, 0x400595, 1) = 0, 0 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (gdb) linux_nat_wait: [process -1], [TARGET_WNOHANG] 0x400595 is the address of the breakpoint, and "= 0" is TARGET_XFER_EOF. That's default_memory_remove_breakpoint trying to remove the breakpoint, but failing. The problem is that we had just resumed the target and the native GNU/Linux target can't read memory off of a running thread. Most of the time, we get "lucky", because we manage to read memory before the kernel actually schedules the target to run. So just give up and skip the test on any target that uses hardware stepping, not just remote targets. gdb/testsuite/ 2014-06-06 Pedro Alves <palves@redhat.com> * gdb.base/sss-bp-on-user-bp-2.exp: Look for target_resume(step) in target debug output instead of looking at RSP packets, disabling the test on any target that uses hardware stepping. Update comments.
2014-06-06 20:59:21 +02:00
2014-06-06 Pedro Alves <palves@redhat.com>
* gdb.base/sss-bp-on-user-bp-2.exp: Look for target_resume(step)
in target debug output instead of looking at RSP packets,
disabling the test on any target that uses hardware stepping.
Update comments.
2014-06-06 Pedro Alves <palves@redhat.com>
* gdb.base/break-unload-file.exp: Fix typo.
2014-06-06 Yao Qi <yao@codesourcery.com>
* gdb.base/jit.exp (one_jit_test): Restrict the pattern
from "jit_function" to "^jit_function".
Tweak gdb.base/async.exp I see two fails in async.exp on arm-none-eabi target: nexti&^M (gdb) 0x000001ba 14 x = 5; x = 5;^M completed.^M FAIL: gdb.base/async.exp: nexti& finish&^M Run till exit from #0 0x000001ba in foo () at /scratch/yqi/arm-none-eabi-lite/src/gdb-trunk/gdb/testsuite/gdb.base/async.c:14^M (gdb) 0x000001e6 in main () at /scratch/yqi/arm-none-eabi-lite/src/gdb-trunk/gdb/testsuite/gdb.base/async.c:32^M 32 y = foo ();^M Value returned is $1 = 8^M completed.^M FAIL: gdb.base/async.exp: finish& The corresponding test is "test_background "nexti&" "" ".*y = 3.*"", and it assumes that GDB "nexti" into the next source line. It is wrong on arm. After "nexti", it still stops at the same source line, and it fails. When gdb does "finish", if the PC is in the middle of a source line, the PC address is printed too. See stack.c:print_frame, if (opts.addressprint) if (!sal.symtab || frame_show_address (frame, sal) || print_what == LOC_AND_ADDRESS) { annotate_frame_address (); if (pc_p) ui_out_field_core_addr (uiout, "addr", gdbarch, pc); else ui_out_field_string (uiout, "addr", "<unavailable>"); annotate_frame_address_end (); ui_out_text (uiout, " in "); } frame_show_address checks whether PC is the middle of a source line. Since after "nexti", the inferior stops at the middle of a source line, when we do "finish" the PC address is displayed. In sum, GDB works well, but test case needs update. This patch is to add a statement at the same line to make sure "nexti" doesn't go to the new line, match the next instruction address in the output and match the hex address the output of "finish". gdb/testsuite: 2014-06-06 Yao Qi <yao@codesourcery.com> * gdb.base/async.c (foo): Add one statement. * gdb.base/async.exp: Get the next instruction address and match the output of "nexti" by instruction address. Match the hex address in the output of "finish".
2014-06-06 08:32:42 +02:00
2014-06-06 Yao Qi <yao@codesourcery.com>
* gdb.base/async.c (foo): Add one statement.
* gdb.base/async.exp: Get the next instruction address and
match the output of "nexti" by instruction address. Match
the hex address in the output of "finish".
2014-06-06 Gary Benson <gbenson@redhat.com>
* gdb.base/call-signals.c: Remove preprocessor conditionals
for always-defined signals SIGINT, SIGILL, SIGABRT, SIGFPE,
SIGSEGV and SIGTERM.
* gdb.base/sigall.c: Likewise.
* gdb.base/unwindonsignal.c: Likewise.
* gdb.reverse/sigall-reverse.c: Likewise.
2014-06-06 Yao Qi <yao@codesourcery.com>
* gdb.base/hbreak-unmapped.exp: Read memory at address 0. If
readable, skip the test.
2014-06-06 Yao Qi <yao@codesourcery.com>
* gdb.threads/staticthreads.c (thread_function): Move the line
setting breakpoint on forward.
* gdb.threads/staticthreads.exp: Update comments.
2014-06-05 Ludovic Courtès <ludo@gnu.org>
* gdb.guile/scm-value.exp (test_value_in_inferior): Add test
"history-append! type error".
PR mi/15806: Fix quoting of async events Original patch: https://sourceware.org/ml/gdb-patches/2014-04/msg00552.html New in v2: * In remote.c:escape_buffer, pass '\\' to fputstrn_unfiltered/printchar to make sure backslashes are escaped in remote debug output. * Updated function documentation for printchar. See updated ChangeLog below. -------------------- The quoting in whatever goes in the event_channel of MI is little bit broken. Link for the lazy: https://sourceware.org/bugzilla/show_bug.cgi?id=15806 Here is an example of a =library-loaded event with an ill-named directory, /tmp/how"are\you (the problem is present with every directory on Windows since it uses backslashes as a path separator). The result will be the following: =library-loaded,id="/tmp/how"are\\you/libexpat.so.1",... The " between 'how' and 'are' should be escaped. Another bad behavior is double escaping in =breakpoint-created, for example: =breakpoint-created,bkpt={...,fullname="/tmp/how\\"are\\\\you/test.c",...} The two backslashes before 'how' should be one and the four before 'you' should be two. The reason for this is that when sending something to an MI console, escaping can take place at two different moments (the actual escaping work is always done in the printchar function): 1. When generating the content, if ui_out_field_* functions are used. Here, fields are automatically quoted with " and properly escaped. At least mi_field_string does it, not sure about mi_field_fmt, I need to investigate further. 2. When gdb_flush is called, to send the data in the buffer of the console to the actual output (stdout). At this point, mi_console_raw_packet takes the whole string in the buffer, quotes it, and escapes all occurences of the quoting character and backslashes. The event_channel does not specify a quoting character, so quotes are not escaped here, only backslashes. The problem with =library-loaded is that it does use fprintf_unfiltered, which doesn't do escaping (so, no #1). When gdb_flush is called, backslashes are escaped (#2). The problem with =breakpoint-created is that it first uses ui_out_field_* functions to generate its output, so backslashes and quotes are escaped there (#1). backslashes are escaped again in #2, leading to an overdose of backslashes. In retrospect, there is no way escaping can be done reliably in mi_console_raw_packet for data that is already formatted, such as event_channel. At this point, there is no way to differentiate quotes that delimit field values from those that should be escaped. In the case of other MI consoles, it is ok since mi_console_raw_packet receives one big string that should be quoted and escaped as a whole. So, first part of the fix: for the MI channels that specify no quoting character, no escaping at all should be done in mi_console_raw_packet (that's the change in printchar, thanks to Yuanhui Zhang for this). For those channels, whoever generates the content is responsible for proper quoting and escaping. This will fix the =breakpoint-created kind of problem. Second part of the fix is to make =library-loaded generate content that is properly escaped. For this, we use ui_out_field_* functions, instead of one big fprintf_unfiltered. =library-unloaded suffered from the same problem so it is modified as well. There might be other events that need fixing too, but that's all I found with a quick scan. Those that use fprintf_unfiltered but whose sole variable data is a %d are not critical, since it won't generate a " or a \. Finally, a test has been fixed, as it was expecting an erroneous output. Otherwise, all other tests that were previously passing still pass (x86-64 linux). gdb/ChangeLog: 2014-06-02 Simon Marchi <simon.marchi@ericsson.com> PR mi/15806 * utils.c (printchar): Don't escape at all if quoter is NUL. Update function documentation to clarify effect of parameter QUOTER. * remote.c (escape_buffer): Pass '\\' as the quoter to fputstrn_unfiltered. * mi/mi-interp.c (mi_solib_loaded): Use ui_out_field_* functions to generate the output. (mi_solib_unloaded): Same. gdb/testsuite/ChangeLog: 2014-06-02 Simon Marchi <simon.marchi@ericsson.com> * gdb.mi/mi-breakpoint-changed.exp (test_insert_delete_modify): Fix erroneous dprintf expected input.
2014-06-02 23:10:36 +02:00
2014-06-05 Simon Marchi <simon.marchi@ericsson.com>
* gdb.mi/mi-breakpoint-changed.exp (test_insert_delete_modify): Fix
erroneous dprintf expected input.
2014-06-04 Doug Evans <xdje42@gmail.com>
* gdb.guile/scm-generics.exp: Delete.
2014-06-04 Doug Evans <xdje42@gmail.com>
* gdb.guile/scm-breakpoint.exp: Update.
Add tests for breakpoint registration.
2014-06-04 Tom Tromey <tromey@redhat.com>
* gdb.base/vla-datatypes.exp: Add tests for VLA-in-structure and
VLA-in-union.
* gdb.base/vla-datatypes.c (vla_factory): Add vla_struct,
inner_vla_struct, vla_union types. Initialize objects of those
types and compute their sizes.
2014-06-04 Nathan Sidwell <nathan@codesourcery.com>
Hui Zhu <hui@codesourcery.com>
* gdb.base/fileio.exp: Add test for shell not available as well as
available.
* gdb.base/fileio.c (test_system): Check for shell twice.
2014-06-04 Yao Qi <yao@codesourcery.com>
* gdb.base/auto-connect-native-target.exp: Remove redundant
space from the regexp pattern.
2014-06-04 Yao Qi <yao@codesourcery.com>
* gdb.base/default.exp: Replace "child" with "native" in
regexp pattern.
2014-06-03 Siva Chandra Reddy <sivachandra@google.com>
* gdb.python/py-xmethods.cc: New testcase to test xmethods.
* gdb.python/py-xmethods.exp: New tests to test xmethods.
* gdb.python/py-xmethods.py: Python script supporting the
new testcase and tests.
User breakpoint ignored if software-single-step at same location with the following code... 12 Nested; -- break #1 13 return I; -- break #2 14 end; (line 12 is a call to function Nested) ... we have noticed the following errorneous behavior on ppc-aix, where, after having inserted a breakpoint at line 12 and line 13, and continuing from the breakpoint at line 12, the program never stops at line 13, running away until the program terminates: % gdb -q func (gdb) b func.adb:12 Breakpoint 1 at 0x10000a24: file func.adb, line 12. (gdb) b func.adb:13 Breakpoint 2 at 0x10000a28: file func.adb, line 13. (gdb) run Starting program: /[...]/func Breakpoint 1, func () at func.adb:12 12 Nested; -- break #1 (gdb) c Continuing. [Inferior 1 (process 4128872) exited with code 02] When resuming from the first breakpoint, GDB first tries to step out of that first breakpoint. We rely on software single-stepping on this platform, and it just so happens that the address of the first software single-step breakpoint is the same as the user's breakpoint #2 (0x10000a28). So, with infrun and target traces turned on (but uninteresting traces snip'ed off), the "continue" operation looks like this: (gdb) c ### First, we insert the user breakpoints (the second one is an internal ### breakpoint on __pthread_init). The first user breakpoint is not ### inserted as we need to step out of it first. target_insert_breakpoint (0x0000000010000a28, xxx) = 0 target_insert_breakpoint (0x00000000d03f3800, xxx) = 0 ### Then we proceed with the step-out-of-breakpoint... infrun: resume (step=1, signal=GDB_SIGNAL_0), trap_expected=1, current thread [process 15335610] at 0x10000a24 ### That's when we insert the SSS breakpoints... target_insert_breakpoint (0x0000000010000a28, xxx) = 0 target_insert_breakpoint (0x00000000100009ac, xxx) = 0 ### ... then let the inferior resume... target_resume (15335610, continue, 0) infrun: wait_for_inferior () target_wait (-1, status, options={}) = 15335610, status->kind = stopped, signal = GDB_SIGNAL_TRAP infrun: target_wait (-1, status) = infrun: 15335610 [process 15335610], infrun: status->kind = stopped, signal = GDB_SIGNAL_TRAP infrun: infwait_normal_state infrun: TARGET_WAITKIND_STOPPED infrun: stop_pc = 0x100009ac ### At this point, we stopped at the second SSS breakpoint... target_stopped_by_watchpoint () = 0 ### We remove the SSS breakpoints... target_remove_breakpoint (0x0000000010000a28, xxx) = 0 target_remove_breakpoint (0x00000000100009ac, xxx) = 0 target_stopped_by_watchpoint () = 0 ### We find that we're not done, so we resume.... infrun: no stepping, continue ### And thus insert the user breakpoints again, except we're not ### inserting the second breakpoint?!? target_insert_breakpoint (0x0000000010000a24, xxx) = 0 infrun: resume (step=0, signal=GDB_SIGNAL_0), trap_expected=0, current thread [process 15335610] at 0x100009ac target_resume (-1, continue, 0) infrun: prepare_to_wait target_wait (-1, status, options={}) = 15335610, status->kind = exited, status = 2 What happens is that the removal of the software single-step breakpoints effectively removed the breakpoint instruction from inferior memory. But because such breakpoints are inserted directly as raw breakpoints rather than through the normal chain of breakpoints, we fail to notice that one of the user breakpoints points to the same address and that this user breakpoint is therefore effectively un-inserted. When resuming after the single-step, GDB thinks that the user breakpoint is still inserted and therefore does not need to insert it again. This patch teaches the insert and remove routines of both regular and raw breakpoints to be aware of each other. Special care needs to be applied in case the target supports evaluation of breakpoint conditions or commands. gdb/ChangeLog: PR breakpoints/17000 * breakpoint.c (find_non_raw_software_breakpoint_inserted_here): New function, extracted from software_breakpoint_inserted_here_p. (software_breakpoint_inserted_here_p): Replace factored out code by call to find_non_raw_software_breakpoint_inserted_here. (bp_target_info_copy_insertion_state): New function. (bkpt_insert_location): Handle the case of a single-step breakpoint already inserted at the same address. (bkpt_remove_location): Handle the case of a single-step breakpoint still inserted at the same address. (deprecated_insert_raw_breakpoint): Handle the case of non-raw breakpoint already inserted at the same address. (deprecated_remove_raw_breakpoint): Handle the case of a non-raw breakpoint still inserted at the same address. (find_single_step_breakpoint): New function, extracted from single_step_breakpoint_inserted_here_p. (find_single_step_breakpoint): New function, factored out from single_step_breakpoint_inserted_here_p. (single_step_breakpoint_inserted_here_p): Reimplement. gdb/testsuite/ChangeLog: PR breakpoints/17000 * gdb.base/sss-bp-on-user-bp.exp: Remove kfail. * gdb.base/sss-bp-on-user-bp-2.exp: Remove kfail. Tested on ppc-aix with AdaCore's testsuite. Tested on x86_64-linux, (native and gdbserver) with the official testsuite. Also tested on x86_64-linux through Pedro's branch enabling software single-stepping on that platform (native and gdbserver).
2014-06-03 18:42:19 +02:00
2014-06-03 Joel Brobecker <brobecker@adacore.com>
Pedro Alves <palves@redhat.com>
PR breakpoints/17000
* gdb.base/sss-bp-on-user-bp.exp: Remove kfail.
* gdb.base/sss-bp-on-user-bp-2.exp: Remove kfail.
gdb/source.c: Fix matching path substitute rule listing The check for the source (or "from") directory snippet in listing matching path substitution rules currently will not match anything other than a direct match of the "from" field in a substitution rule, resulting in the incorrect behavior below: ... (gdb) set substitute-path /a/path /another/path (gdb) show substitute-path List of all source path substitution rules: `/a/path' -> `/another/path'. (gdb) show substitute-path /a/path/to/a/file.ext Source path substitution rule matching `/a/path/to/a/file.ext': (gdb) show substitute-path /a/path Source path substitution rule matching `/a/path': `/a/path' -> `/another/path'. ... This change effects the following behavior by (sanely) checking with the length of the "from" portion of a rule and ensuring that the next character of the path considered for substitution is a path delimiter (or NULL). With this change, the following behavior is garnered: ... (gdb) set substitute-path /a/path /another/path (gdb) show substitute-path List of all source path substitution rules: `/a/path' -> `/another/path'. (gdb) show substitute-path /a/path/to/a/file.ext Source path substitution rule matching `/a/path/to/a/file.ext': `/a/path' -> `/another/path'. (gdb) show substitute-path /a/pathological/case/that/should/fail.err Source path substitution rule matching `/a/pathological/case/that/should/fail.err': (gdb) Also included is a couple of tests added to subst.exp to verify this behavior in the test suite. gdb/ChangeLog: * source.c (show_substitute_path_command): Fix display of matching substitution rules. gdb/testsuite/ChangeLog: * gdb.ada/subst.exp: Add tests to verify partial path matching output. This was tested on x86_64 Linux.
2014-06-02 22:55:10 +02:00
2014-06-03 Brad Mouring <bmouring@ni.com> (tiny patch)
* gdb.base/subst.exp: Add tests to verify partial path matching
output.
2014-06-03 Pedro Alves <palves@redhat.com>
* gdb.base/sss-bp-on-user-bp-2.exp: Skip if testing with a remote
target that doesn't use software single-stepping.
2014-06-03 Pedro Alves <palves@redhat.com>
PR breakpoints/17000
* gdb.base/sss-bp-on-user-bp-2.c: New file.
* gdb.base/sss-bp-on-user-bp-2.exp: New file.
2014-06-02 Doug Evans <xdje42@gmail.com>
* gdb.guile/scm-parameter.exp: New file.
2014-06-02 Doug Evans <xdje42@gmail.com>
* gdb.guile/scm-cmd.c: New file.
* gdb.guile/scm-cmd.exp: New file.
2014-06-02 Doug Evans <xdje42@gmail.com>
* gdb.guile/scm-pretty-print.exp: Add tests for objfile and progspace
pretty-printer lookup.
* gdb.guile/scm-pretty-print.scm (pp_s-printer): New function.
(make-pp_s-printer): Call it.
(make-pretty-printer-from-dict): New function.
(lookup-pretty-printer-maker-from-dict): New function.
(*pretty-printer*): Simplify.
(make-objfile-pp_s-printer): New function.
(install-objfile-pretty-printers!): New function.
(make-progspace-pp_s-printer): New function.
(install-progspace-pretty-printers!): New function.
* gdb.guile/scm-progspace.c: New file.
* gdb.guile/scm-progspace.exp: New file.
2014-06-02 Pedro Alves <palves@redhat.com>
* gdb.base/dprintf-bp-same-addr.c: New file.
* gdb.base/dprintf-bp-same-addr.exp: New file.
2014-06-02 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
* gdb.arch/powerpc-power.exp: Add power8 instructions to the testcase.
* gdb.arch/powerpc-power.s: Likewise.
2014-06-02 Joel Brobecker <brobecker@adacore.com>
* gdb.base/completion.exp: Remove code aimed at restoring TIMEOUT.
2014-06-01 Yao Qi <yao@codesourcery.com>
* gdb.base/watchpoint.exp (test_watch_location): Check null
pointer can be dereferenced. If not, do the test, otherwise
skip it.
Add a TRY_CATCH to get_prev_frame_always to better manage errors during unwind. https://sourceware.org/ml/gdb-patches/2014-05/msg00737.html Currently a MEMORY_ERROR raised during unwinding a frame will cause the unwind to stop with an error message, for example: (gdb) bt #0 breakpt () at amd64-invalid-stack-middle.c:27 #1 0x00000000004008f0 in func5 () at amd64-invalid-stack-middle.c:32 #2 0x0000000000400900 in func4 () at amd64-invalid-stack-middle.c:38 #3 0x0000000000400910 in func3 () at amd64-invalid-stack-middle.c:44 #4 0x0000000000400928 in func2 () at amd64-invalid-stack-middle.c:50 Cannot access memory at address 0x2aaaaaab0000 However, frame #4 is marked as being the end of the stack unwind, so a subsequent request for the backtrace looses the error message, such as: (gdb) bt #0 breakpt () at amd64-invalid-stack-middle.c:27 #1 0x00000000004008f0 in func5 () at amd64-invalid-stack-middle.c:32 #2 0x0000000000400900 in func4 () at amd64-invalid-stack-middle.c:38 #3 0x0000000000400910 in func3 () at amd64-invalid-stack-middle.c:44 #4 0x0000000000400928 in func2 () at amd64-invalid-stack-middle.c:50 When fetching the backtrace, or requesting the stack depth using the MI interface the situation is even worse, the first time a request is made we encounter the memory error and so the MI returns an error instead of the correct result, for example: (gdb) -stack-info-depth ^error,msg="Cannot access memory at address 0x2aaaaaab0000" Or, (gdb) -stack-list-frames ^error,msg="Cannot access memory at address 0x2aaaaaab0000" However, once one of these commands has been used gdb has, internally, walked the stack and figured that out that frame #4 is the bottom of the stack, so the second time an MI command is tried you'll get the "expected" result: (gdb) -stack-info-depth ^done,depth="5" Or, (gdb) -stack-list-frames ^done,stack=[frame={level="0", .. snip lots .. }] After this patch the MEMORY_ERROR encountered during the frame unwind is attached to frame #4 as the stop reason, and is displayed in the CLI each time the backtrace is requested. In the MI, catching the error means that the "expected" result is returned the first time the MI command is issued. So, from the CLI the results of the backtrace will be: (gdb) bt #0 breakpt () at amd64-invalid-stack-middle.c:27 #1 0x00000000004008f0 in func5 () at amd64-invalid-stack-middle.c:32 #2 0x0000000000400900 in func4 () at amd64-invalid-stack-middle.c:38 #3 0x0000000000400910 in func3 () at amd64-invalid-stack-middle.c:44 #4 0x0000000000400928 in func2 () at amd64-invalid-stack-middle.c:50 Backtrace stopped: Cannot access memory at address 0x2aaaaaab0000 Each and every time that the backtrace is requested, while the MI output will similarly be consistently: (gdb) -stack-info-depth ^done,depth="5" Or, (gdb) -stack-list-frames ^done,stack=[frame={level="0", .. snip lots .. }] gdb/ChangeLog: * frame.c (struct frame_info): Add stop_string field. (get_prev_frame_always_1): Renamed from get_prev_frame_always. (get_prev_frame_always): Old content moved into get_prev_frame_always_1. Call get_prev_frame_always_1 inside TRY_CATCH, handle MEMORY_ERROR exceptions. (frame_stop_reason_string): New function definition. * frame.h (unwind_stop_reason_to_string): Extend comment to mention frame_stop_reason_string. (frame_stop_reason_string): New function declaration. * stack.c (frame_info): Switch to frame_stop_reason_string. (backtrace_command_1): Switch to frame_stop_reason_string. * unwind_stop_reason.def: Add UNWIND_MEMORY_ERROR. (LAST_ENTRY): Changed to UNWIND_MEMORY_ERROR. * guile/lib/gdb.scm: Add FRAME_UNWIND_MEMORY_ERROR to export list. gdb/doc/ChangeLog: * guile.texi (Frames In Guile): Mention FRAME_UNWIND_MEMORY_ERROR. * python.texi (Frames In Python): Mention gdb.FRAME_UNWIND_MEMORY_ERROR. gdb/testsuite/ChangeLog: * gdb.arch/amd64-invalid-stack-middle.exp: Update expected results. * gdb.arch/amd64-invalid-stack-top.exp: Likewise.
2014-05-29 00:34:43 +02:00
2014-05-30 Andrew Burgess <aburgess@broadcom.com>
* gdb.arch/amd64-invalid-stack-middle.exp: Update expected
results.
* gdb.arch/amd64-invalid-stack-top.exp: Likewise.
2014-05-30 Andrew Burgess <aburgess@broadcom.com>
* gdb.arch/amd64-invalid-stack-middle.S: New file.
* gdb.arch/amd64-invalid-stack-middle.c: New file.
* gdb.arch/amd64-invalid-stack-middle.exp: New file.
* gdb.arch/amd64-invalid-stack-top.c: New file.
* gdb.arch/amd64-invalid-stack-top.exp: New file.
2014-05-30 Pedro Alves <palves@redhat.com>
PR breakpoints/17000
* gdb.base/sss-bp-on-user-bp.c: New file.
* gdb.base/sss-bp-on-user-bp.exp: New file.
2014-05-30 David Blaikie <dblaikie@gmail.com>
* gdb.opt/inline-break.c: Fix clang compatibility by specifying
gnu_inline semantics via attribute.
* gdb.opt/inline-break.exp: Remove -std=c89 now that the test
source explicitly specifies the required semantics.
2014-05-30 Maciej W. Rozycki <macro@codesourcery.com>
* gdb.reverse/sigall-reverse.exp: Fix a typo.
enable target async by default; separate MI and target notions of async This finally makes background execution commands possible by default. However, in order to do that, there's one last thing we need to do -- we need to separate the MI and target notions of "async". Unlike the CLI, where the user explicitly requests foreground vs background execution in the execution command itself (c vs c&), MI chose to treat "set target-async" specially -- setting it changes the default behavior of execution commands. So, we can't simply "set target-async" default to on, as that would affect MI frontends. Instead we have to make the setting MI-specific, and teach MI about sync commands on top of an async target. Because the "target" word in "set target-async" ends up as a potential source of confusion, the patch adds a "set mi-async" option, and makes "set target-async" a deprecated alias. Rather than make the targets always async, this patch introduces a new "maint set target-async" option so that the GDB developer can control whether the target is async. This makes it simpler to debug issues arising only in the synchronous mode; important because sync mode seems unlikely to go away. Unlike in previous revisions, "set target-async" does not affect this new maint parameter. The rationale for this is that then one can easily run the test suite in the "maint set target-async off" mode and have tests that enable mi-async fail just like they fail on non-async-capable targets. This emulation is exactly the point of the maint option. I had asked Tom in a previous iteration to split the actual change of the target async default to a separate patch, but it turns out that that is quite awkward in this version of the patch, because with MI async and target async decoupled (unlike in previous versions), if we don't flip the default at the same time, then just "set target-async on" alone never actually manages to do anything. It's best to not have that transitory state in the tree. Given "set target-async on" now only has effect for MI, the patch goes through the testsuite removing it from non-MI tests. MI tests are adjusted to use the new and less confusing "mi-async" spelling. 2014-05-29 Pedro Alves <palves@redhat.com> Tom Tromey <tromey@redhat.com> * NEWS: Mention "maint set target-async", "set mi-async", and that background execution commands are now always available. * target.h (target_async_permitted): Update comment. * target.c (target_async_permitted, target_async_permitted_1): Default to 1. (set_target_async_command): Rename to ... (maint_set_target_async_command): ... this. (show_target_async_command): Rename to ... (maint_show_target_async_command): ... this. (_initialize_target): Adjust. * infcmd.c (prepare_execution_command): Make extern. * inferior.h (prepare_execution_command): Declare. * infrun.c (set_observer_mode): Leave target async alone. * mi/mi-interp.c (mi_interpreter_init): Install mi_on_sync_execution_done as sync_execution_done observer. (mi_on_sync_execution_done): New function. (mi_execute_command_input_handler): Don't print the prompt if we just started a synchronous command with an async target. (mi_on_resume): Check sync_execution before printing prompt. * mi/mi-main.h (mi_async_p): Declare. * mi/mi-main.c: Include gdbcmd.h. (mi_async_p): New function. (mi_async, mi_async_1): New globals. (set_mi_async_command, show_mi_async_command, mi_async): New functions. (exec_continue): Call prepare_execution_command. (run_one_inferior, mi_cmd_exec_run, mi_cmd_list_target_features) (mi_execute_async_cli_command): Use mi_async_p. (_initialize_mi_main): Install "set mi-async". Make "target-async" a deprecated alias. 2014-05-29 Pedro Alves <palves@redhat.com> Tom Tromey <tromey@redhat.com> * gdb.texinfo (Non-Stop Mode): Remove "set target-async 1" from example. (Asynchronous and non-stop modes): Document '-gdb-set mi-async'. Mention that target-async is now deprecated. (Maintenance Commands): Document maint set/show target-async. 2014-05-29 Pedro Alves <palves@redhat.com> Tom Tromey <tromey@redhat.com> * gdb.base/async-shell.exp: Don't enable target-async. * gdb.base/async.exp * gdb.base/corefile.exp (corefile_test_attach): Remove 'async' parameter. Adjust. (top level): Don't test with "target-async". * gdb.base/dprintf-non-stop.exp: Don't enable target-async. * gdb.base/gdb-sigterm.exp: Don't test with "target-async". * gdb.base/inferior-died.exp: Don't enable target-async. * gdb.base/interrupt-noterm.exp: Likewise. * gdb.mi/mi-async.exp: Use "mi-async" instead of "target-async". * gdb.mi/mi-nonstop-exit.exp: Likewise. * gdb.mi/mi-nonstop.exp: Likewise. * gdb.mi/mi-ns-stale-regcache.exp: Likewise. * gdb.mi/mi-nsintrall.exp: Likewise. * gdb.mi/mi-nsmoribund.exp: Likewise. * gdb.mi/mi-nsthrexec.exp: Likewise. * gdb.mi/mi-watch-nonstop.exp: Likewise. * gdb.multi/watchpoint-multi.exp: Adjust comment. * gdb.python/py-evsignal.exp: Don't enable target-async. * gdb.python/py-evthreads.exp: Likewise. * gdb.python/py-prompt.exp: Likewise. * gdb.reverse/break-precsave.exp: Don't test with "target-async". * gdb.server/solib-list.exp: Don't enable target-async. * gdb.threads/thread-specific-bp.exp: Likewise. * lib/mi-support.exp: Adjust to use mi-async.
2014-05-29 20:58:57 +02:00
2014-05-29 Pedro Alves <palves@redhat.com>
Tom Tromey <tromey@redhat.com>
* gdb.base/async-shell.exp: Don't enable target-async.
* gdb.base/async.exp
* gdb.base/corefile.exp (corefile_test_attach): Remove 'async'
parameter. Adjust.
(top level): Don't test with "target-async".
* gdb.base/dprintf-non-stop.exp: Don't enable target-async.
* gdb.base/gdb-sigterm.exp: Don't test with "target-async".
* gdb.base/inferior-died.exp: Don't enable target-async.
* gdb.base/interrupt-noterm.exp: Likewise.
* gdb.mi/mi-async.exp: Use "mi-async" instead of "target-async".
* gdb.mi/mi-nonstop-exit.exp: Likewise.
* gdb.mi/mi-nonstop.exp: Likewise.
* gdb.mi/mi-ns-stale-regcache.exp: Likewise.
* gdb.mi/mi-nsintrall.exp: Likewise.
* gdb.mi/mi-nsmoribund.exp: Likewise.
* gdb.mi/mi-nsthrexec.exp: Likewise.
* gdb.mi/mi-watch-nonstop.exp: Likewise.
* gdb.multi/watchpoint-multi.exp: Adjust comment.
* gdb.python/py-evsignal.exp: Don't enable target-async.
* gdb.python/py-evthreads.exp: Likewise.
* gdb.python/py-prompt.exp: Likewise.
* gdb.reverse/break-precsave.exp: Don't test with "target-async".
* gdb.server/solib-list.exp: Don't enable target-async.
* gdb.threads/thread-specific-bp.exp: Likewise.
* lib/mi-support.exp: Adjust to use mi-async.
PR gdb/13860 - Make MI sync vs async output (closer to) the same. Ignoring expected and desired differences like whether the prompt is output after *stoppped records, GDB MI output is still different in sync and async modes. In sync mode, when a CLI execution command is entered, the "reason" field is missing in the *stopped async record. And in async mode, for some events, like program exits, the corresponding CLI output is missing in the CLI channel. Vis, diff between sync vs async modes: run ^running *running,thread-id="1" (gdb) ... - ~"[Inferior 1 (process 15882) exited normally]\n" =thread-exited,id="1",group-id="i1" =thread-group-exited,id="i1",exit-code="0" - *stopped + *stopped,reason="exited-normally" si ... (gdb) ~"0x000000000045e033\t29\t memset (&args, 0, sizeof args);\n" - *stopped,frame=...,thread-id="1",stopped-threads="all",core="0" + *stopped,reason="end-stepping-range",frame=...,thread-id="1",stopped-threads="all",core="0" (gdb) In addition, in both cases, when a MI execution command is entered, and a breakpoint triggers, the event is sent to the console too. But some events like program exits have the CLI output missing in the CLI channel: -exec-run ^running *running,thread-id="1" (gdb) ... =thread-exited,id="1",group-id="i1" =thread-group-exited,id="i1",exit-code="0" - *stopped + *stopped,reason="exited-normally" We'll want to make background commands always possible by default. IOW, make target-async be the default. But, in order to do that, we'll need to emulate MI sync on top of an async target. That means we'll have yet another combination to care for in the testsuite. Rather than making the testsuite cope with all these differences, I thought it better to just fix GDB to always have the complete output, no matter whether it's in sync or async mode. This is all related to interpreter-exec, and the corresponding uiout switching. (Typing a CLI command directly in MI is shorthand for running it through -interpreter-exec console.) In sync mode, when a CLI command is active, normal_stop is called when the current interpreter and uiout are CLI's. So print_XXX_reason prints the stop reason to CLI uiout (only), and we don't show it in MI. In async mode the stop event is processed when we're back in the MI interpreter, so the stop reason is printed directly to the MI uiout. Fix this by making run control event printing roughly independent of whatever is the current interpreter or uiout. That is, move these prints to interpreter observers, that know whether to print or be quiet, and if printing, which uiout to print to. In the case of the console/tui interpreters, only print if the top interpreter. For MI, always print. Breakpoint hits / normal stops are already handled similarly -- MI has a normal_stop observer that prints the event to both MI and the CLI, though that could be cleaned up further in the direction of this patch. This also makes all of: (gdb) foo and (gdb) interpreter-exec MI "-exec-foo" and (gdb) -exec-foo and (gdb) -interpreter-exec console "foo" print as expected. Tested on x86_64 Fedora 20, sync and async modes. gdb/ 2014-05-29 Pedro Alves <palves@redhat.com> PR gdb/13860 * cli/cli-interp.c: Include infrun.h and observer.h. (cli_uiout, cli_interp): New globals. (cli_on_signal_received, cli_on_end_stepping_range) (cli_on_signal_exited, cli_on_exited, cli_on_no_history): New functions. (cli_interpreter_init): Install them as 'end_stepping_range', 'signal_received' 'signal_exited', 'exited' and 'no_history' observers. (_initialize_cli_interp): Remove cli_interp local. * infrun.c (handle_inferior_event): Call the several stop reason observers instead of printing the stop reason directly. (end_stepping_range): New function. (print_end_stepping_range_reason, print_signal_exited_reason) (print_exited_reason, print_signal_received_reason) (print_no_history_reason): Make static, and add an uiout parameter. Print to that instead of to CURRENT_UIOUT. * infrun.h (print_end_stepping_range_reason) (print_signal_exited_reason, print_exited_reason) (print_signal_received_reason print_no_history_reason): New declarations. * mi/mi-common.h (struct mi_interp): Rename 'uiout' field to 'mi_uiout'. <cli_uiout>: New field. * mi/mi-interp.c (mi_interpreter_init): Adjust. Create the new uiout for CLI output. Install 'signal_received', 'end_stepping_range', 'signal_exited', 'exited' and 'no_history' observers. (find_mi_interpreter, mi_interp_data, mi_on_signal_received) (mi_on_end_stepping_range, mi_on_signal_exited, mi_on_exited) (mi_on_no_history): New functions. (ui_out_free_cleanup): Delete function. (mi_on_normal_stop): Don't allocate a new uiout for CLI output, instead use the one already stored in the MI interpreter data. (mi_ui_out): Adjust. * tui/tui-interp.c: Include infrun.h and observer.h. (tui_interp): New global. (tui_on_signal_received, tui_on_end_stepping_range) (tui_on_signal_exited, tui_on_exited) (tui_on_no_history): New functions. (tui_init): Install them as 'end_stepping_range', 'signal_received' 'signal_exited', 'exited' and 'no_history' observers. (_initialize_tui_interp): Delete tui_interp local. gdb/doc/ 2014-05-29 Pedro Alves <palves@redhat.com> PR gdb/13860 * observer.texi (signal_received, end_stepping_range) (signal_exited, exited, no_history): New observer subjects. gdb/testsuite/ 2014-05-29 Pedro Alves <palves@redhat.com> PR gdb/13860 * gdb.mi/mi-cli.exp: Always expect "end-stepping-range" stop reason, even in sync mode.
2014-05-29 14:09:45 +02:00
2014-05-29 Pedro Alves <palves@redhat.com>
PR gdb/13860
* gdb.mi/mi-cli.exp: Always expect "end-stepping-range" stop
reason, even in sync mode.
PR15693 - Fix spurious *running events, thread state, dprintf-style call If one sets a breakpoint with a condition that involves calling a function in the inferior, and then the condition evaluates false, GDB outputs one *running event for each time the program hits the breakpoint. E.g., $ gdb return-false -i=mi (gdb) start ... (gdb) b 14 if return_false () &"b 14 if return_false ()\n" ~"Breakpoint 2 at 0x4004eb: file return-false.c, line 14.\n" ... ^done (gdb) c &"c\n" ~"Continuing.\n" ^running *running,thread-id=(...) (gdb) *running,thread-id=(...) *running,thread-id=(...) *running,thread-id=(...) *running,thread-id=(...) *running,thread-id=(...) ... repeat forever ... An easy way a user can trip on this is with a dprintf with "set dprintf-style call". In that case, a dprintf is just a breakpoint that when hit GDB calls the printf function in the inferior, and then resumes it, just like the case above. If the breakpoint/dprintf is set in a loop, then these spurious events can potentially slow down a frontend much, if it decides to refresh its GUI whenever it sees this event (Eclipse is one such case). When we run an infcall, we pretend we don't actually run the inferior. This is already handled for the usual case of calling a function directly from the CLI: (gdb) p return_false () &"p return_false ()\n" ~"$1 = 0" ~"\n" ^done (gdb) Note no *running, nor *stopped events. That's handled by: static void mi_on_resume (ptid_t ptid) { ... /* Suppress output while calling an inferior function. */ if (tp->control.in_infcall) return; and equivalent code on normal_stop. However, in the cases of the PR, after finishing the infcall there's one more resume, and mi_on_resume doesn't know that it should suppress output then too, somehow. The "running/stopped" state is a high level user/frontend state. Internal stops are invisible to the frontend. If follows from that that we should be setting the thread to running at a higher level where we still know the set of threads the user _intends_ to resume. Currently we mark a thread as running from within target_resume, a low level target operation. As consequence, today, if we resume a multi-threaded program while stopped at a breakpoint, we see this: -exec-continue ^running *running,thread-id="1" (gdb) *running,thread-id="all" The first *running was GDB stepping over the breakpoint, and the second is GDB finally resuming everything. Between those two *running's, threads other than "1" still have their state set to stopped. That's bogus -- in async mode, this opens a tiny window between both resumes where the user might try to run another execution command to threads other than thread 1, and very much confuse GDB. That is, the "step" below should fail the "step", complaining that the thread is running: (gdb) c -a & (gdb) thread 2 (gdb) step IOW, threads that GDB happens to not resume immediately (say, because it needs to step over a breakpoint) shall still be marked as running. Then, if we move marking threads as running to a higher layer, decoupled from target_resume, plus skip marking threads as running when running an infcall, the spurious *running events disappear, because there will be no state transitions at all. I think we might end up adding a new thread state -- THREAD_INFCALL or some such, however since infcalls are always synchronous today, I didn't find a need. There's no way to execute a CLI/MI command directly from the prompt if some thread is running an infcall. Tested on x86_64 Fedora 20. gdb/ 2014-05-29 Pedro Alves <palves@redhat.com> PR PR15693 * infrun.c (resume): Determine how much to resume depending on whether the caller wanted a step, not whether we can hardware step the target. Mark all threads that we intend to run as running, unless we're calling an inferior function. (normal_stop): If the thread is running an infcall, don't finish thread state. * target.c (target_resume): Don't mark threads as running here. gdb/testsuite/ 2014-05-29 Pedro Alves <palves@redhat.com> Hui Zhu <hui@codesourcery.com> PR PR15693 * gdb.mi/mi-condbreak-call-thr-state-mt.c: New file. * gdb.mi/mi-condbreak-call-thr-state-st.c: New file. * gdb.mi/mi-condbreak-call-thr-state.c: New file. * gdb.mi/mi-condbreak-call-thr-state.exp: New file.
2014-05-29 13:27:01 +02:00
2014-05-29 Pedro Alves <palves@redhat.com>
Hui Zhu <hui@codesourcery.com>
PR PR15693
* gdb.mi/mi-condbreak-call-thr-state-mt.c: New file.
* gdb.mi/mi-condbreak-call-thr-state-st.c: New file.
* gdb.mi/mi-condbreak-call-thr-state.c: New file.
* gdb.mi/mi-condbreak-call-thr-state.exp: New file.
2014-05-28 Joel Brobecker <brobecker@adacore.com>
* config/monitor.exp (gdb_target_monitor): Replace use of
"set remotebaud" by "set serial baud".
2014-05-26 Andy Wingo <wingo@igalia.com>
* gdb.guile/scm-breakpoint.exp:
* gdb.guile/scm-gsmob.exp: Update to use plain old object
properties instead of gdb-object-properties.
2014-05-26 Yao Qi <yao@codesourcery.com>
* gdb.server/no-thread-db.exp: Specify source file name
explicitly when setting a breakpoint.
2014-05-23 Markus Metzger <markus.t.metzger@intel.com>
* gdb.btrace/vdso.c: New.
* gdb.btrace/vdso.exp: New.
2014-05-23 Markus Metzger <markus.t.metzger@intel.com>
* gdb.base/gcore.exp (capture_command_output): Move ...
* lib/gdb.exp (capture_command_output): ... here.
2014-05-23 Markus Metzger <markus.t.metzger@intel.com>
* gdb.btrace/data.exp: Test memory access during btrace replay.
2014-05-22 Simon Marchi <simon.marchi@ericsson.com>
* lib/mi-support.exp (mi_run_cmd_full): Add comments.
PR gdb/13860: don't lose '-interpreter-exec console EXECUTION_COMMAND''s output in async mode. The other part of PR gdb/13860 is about console execution commands in MI getting their output half lost. E.g., take the finish command, executed on a frontend's GDB console: sync: finish &"finish\n" ~"Run till exit from #0 usleep (useconds=10) at ../sysdeps/unix/sysv/linux/usleep.c:27\n" ^running *running,thread-id="1" (gdb) ~"0x00000000004004d7 in foo () at stepinf.c:6\n" ~"6\t usleep (10);\n" ~"Value returned is $1 = 0\n" *stopped,reason="function-finished",frame={addr="0x00000000004004d7",func="foo",args=[],file="stepinf.c",fullname="/home/pedro/gdb/tests/stepinf.c",line="6"},thread-id="1",stopped-threads="all",core="1" async: finish &"finish\n" ~"Run till exit from #0 usleep (useconds=10) at ../sysdeps/unix/sysv/linux/usleep.c:27\n" ^running *running,thread-id="1" (gdb) *stopped,reason="function-finished",frame={addr="0x00000000004004d7",func="foo",args=[],file="stepinf.c",fullname="/home/pedro/gdb/tests/stepinf.c",line="6"},gdb-result-var="$1",return-value="0",thread-id="1",stopped-threads="all",core="0" Note how all the "Value returned" etc. output is missing in async mode. The same happens with e.g., catchpoints: =breakpoint-modified,bkpt={number="1",type="catchpoint",disp="keep",enabled="y",what="22016",times="1"} ~"\nCatchpoint " ~"1 (forked process 22016), 0x0000003791cbd8a6 in __libc_fork () at ../nptl/sysdeps/unix/sysv/linux/fork.c:131\n" ~"131\t pid = ARCH_FORK ();\n" *stopped,reason="fork",disp="keep",bkptno="1",newpid="22016",frame={addr="0x0000003791cbd8a6",func="__libc_fork",args=[],file="../nptl/sysdeps/unix/sysv/linux/fork.c",fullname="/usr/src/debug/glibc-2.14-394-g8f3b1ff/nptl/sysdeps/unix/sysv/linux/fork.c",line="131"},thread-id="1",stopped-threads="all",core="0" where all those ~ lines are missing in async mode, or just the "step" current line indication: s &"s\n" ^running *running,thread-id="all" (gdb) ~"13\t foo ();\n" *stopped,frame={addr="0x00000000004004ef",func="main",args=[{name="argc",value="1"},{name="argv",value="0x7fffffffdd78"}],file="stepinf.c",fullname="/home/pedro/gdb/tests/stepinf.c",line="13"},thread-id="1",stopped-threads="all",core="3" (gdb) Or in the case of the PRs example, the "Stopped due to shared library event" note: start &"start\n" ~"Temporary breakpoint 1 at 0x400608: file ../../../src/gdb/testsuite/gdb.mi/solib-main.c, line 21.\n" =breakpoint-created,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0x0000000000400608",func="main",file="../../../src/gdb/testsuite/gdb.mi/solib-main.c",fullname="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.mi/solib-main.c",line="21",times="0",original-location="main"} ~"Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/solib-main \n" =thread-group-started,id="i1",pid="21990" =thread-created,id="1",group-id="i1" ^running *running,thread-id="all" (gdb) =library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1" ~"Stopped due to shared library event (no libraries added or removed)\n" *stopped,reason="solib-event",thread-id="1",stopped-threads="all",core="3" (gdb) IMO, if you're typing execution commands in a frontend's console, you expect to see their output. Indeed it's what you get in sync mode. I think async mode should do the same. Deciding what to mirror to the console wrt to breakpoints and random stops gets messy real fast. E.g., say "s" trips on a breakpoint. We'd clearly want to mirror the event to the console in this case. But what about more complicated cases like "s&; thread n; s&", and one of those steps spawning a new thread, and that thread hitting a breakpoint? It's impossible in general to track whether the thread had any relation to the commands that had been executed. So I think we should just simplify and always mirror breakpoints and random events to the console. Notes: - mi->out is the same as gdb_stdout when MI is the current interpreter. I think that referring to that directly is cleaner. An earlier revision of this patch made the changes that are now done in mi_on_normal_stop directly in infrun.c:normal_stop, and so not having an obvious place to put the new uiout by then, and not wanting to abuse CLI's uiout, I made a temporary uiout when necessary. - Hopefuly the rest of the patch is more or less obvious given the comments added. Tested on x86_64 Fedora 20, no regressions. 2014-05-21 Pedro Alves <palves@redhat.com> PR gdb/13860 * gdbthread.h (struct thread_control_state): New field `command_interp'. * infrun.c (follow_fork): Copy the new thread control field to the child fork thread. (clear_proceed_status_thread): Clear the new thread control field. (proceed): Set the new thread control field. * interps.h (command_interp): Declare. * interps.c (command_interpreter): New global. (command_interp): New function. (interp_exec): Set `command_interpreter' while here. * cli-out.c (cli_uiout_dtor): New function. (cli_ui_out_impl): Install it. * mi/mi-interp.c: Include cli-out.h. (mi_cmd_interpreter_exec): Add comment. (restore_current_uiout_cleanup): New function. (ui_out_free_cleanup): New function. (mi_on_normal_stop): If finishing an execution command started by a CLI command, or any kind of breakpoint-like event triggered, print the stop event to the output (CLI) stream. * mi/mi-out.c (mi_ui_out_impl): Install NULL `dtor' handler. 2014-05-21 Pedro Alves <palves@redhat.com> PR gdb/13860 * gdb.mi/mi-cli.exp (line_callee4_next_step): New global. (top level): Test that output related to execution commands is sent to the console with CLI commands, but not with MI commands. Test that breakpoint events are always mirrored to the console. Also expect the new source line to be output after a "next" in async mode too. Make it a pass/fail test. * gdb.mi/mi-solib.exp: Test that the CLI solib event note is output. * lib/mi-support.exp (mi_gdb_expect_cli_output): New procedure.
2014-03-11 21:31:36 +01:00
2014-05-21 Pedro Alves <palves@redhat.com>
PR gdb/13860
* gdb.mi/mi-cli.exp (line_callee4_next_step): New global.
(top level): Test that output related to execution commands is
sent to the console with CLI commands, but not with MI commands.
Test that breakpoint events are always mirrored to the console.
Also expect the new source line to be output after a "next" in
async mode too. Make it a pass/fail test.
* gdb.mi/mi-solib.exp: Test that the CLI solib event note is
output.
* lib/mi-support.exp (mi_gdb_expect_cli_output): New procedure.
PR gdb/13860: make -interpreter-exec console "list" behave more like "list". I noticed that "list" behaves differently in CLI vs MI. Particularly: $ ./gdb -nx -q ./testsuite/gdb.mi/mi-cli Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/mi-cli...done. (gdb) start Temporary breakpoint 1 at 0x40054d: file ../../../src/gdb/testsuite/gdb.mi/basics.c, line 62. Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/mi-cli Temporary breakpoint 1, main () at ../../../src/gdb/testsuite/gdb.mi/basics.c:62 62 callee1 (2, "A string argument.", 3.5); (gdb) list 57 { 58 } 59 60 main () 61 { 62 callee1 (2, "A string argument.", 3.5); 63 callee1 (2, "A string argument.", 3.5); 64 65 do_nothing (); /* Hello, World! */ 66 (gdb) Note the list started at line 57. IOW, the program stopped at line 62, and GDB centered the list on that. compare with: $ ./gdb -nx -q ./testsuite/gdb.mi/mi-cli -i=mi =thread-group-added,id="i1" ~"Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/mi-cli..." ~"done.\n" (gdb) start &"start\n" ... ~"\nTemporary breakpoint " ~"1, main () at ../../../src/gdb/testsuite/gdb.mi/basics.c:62\n" ~"62\t callee1 (2, \"A string argument.\", 3.5);\n" *stopped,reason="breakpoint-hit",disp="del",bkptno="1",frame={addr="0x000000000040054d",func="main",args=[],file="../../../src/gdb/testsuite/gdb.mi/basics.c",fullname="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.mi/basics.c",line="62"},thread-id="1",stopped-threads="all",core="0" =breakpoint-deleted,id="1" (gdb) -interpreter-exec console list ~"62\t callee1 (2, \"A string argument.\", 3.5);\n" ~"63\t callee1 (2, \"A string argument.\", 3.5);\n" ~"64\t\n" ~"65\t do_nothing (); /* Hello, World! */\n" ~"66\t\n" ~"67\t callme (1);\n" ~"68\t callme (2);\n" ~"69\t\n" ~"70\t return 0;\n" ~"71\t}\n" ^done (gdb) Here the list starts at line 62, where the program was stopped. This happens because print_stack_frame, called from both normal_stop and mi_on_normal_stop, is the function responsible for setting the current sal from the selected frame, overrides the PRINT_WHAT argument, and only after that does it decide whether to center the current sal line or not, based on the overridden value, and it will always decide false. (The print_stack_frame call in mi_on_normal_stop is a little different from the call in normal_stop, in that it is an unconditional SRC_AND_LOC call. A future patch will make those uniform.) A previous version of this patch made MI uniform with CLI here, by making print_stack_frame also center when MI is active. That changed the output of a "list" command in mi-cli.exp, to expect line 57 instead of 62, as per the example above. However, looking deeper, that list in question is the first "list" after the program stops, and right after the stop, before the "list", the test did "set listsize 1". Let's try the same thing with the CLI: (gdb) start 62 callee1 (2, "A string argument.", 3.5); (gdb) set listsize 1 (gdb) list 57 { Huh, that's unexpected. Why the 57? It's because print_stack_frame, called in reaction to the breakpoint stop, expecting the next "list" to show 10 lines (the listsize at the time) around line 62, sets the lines listed range to 57-67 (62 +/- 5). If the user changes the listsize before "list", why would we still show that range? Looks bogus to me. So the fix for this whole issue should be delay trying to center the listing to until actually listing, so that the correct listsize can be taken into account. This makes MI and CLI uniform too, as it deletes the center code from print_stack_frame. A series of tests are added to list.exp to cover this. mi-cli.exp was after all correct all along, but it now gains an additional test that lists lines with listsize 10, to ensure the centering is consistent with CLI's. One related Python test changed related output -- it's a test that prints the line number after stopping for a breakpoint, similar to the new list.exp tests. Previously we'd print the stop line minus 5 (due to the premature centering), now we print the stop line. I think that's a good change. Tested on x86_64 Fedora 20. gdb/ 2014-05-21 Pedro Alves <palves@redhat.com> * cli/cli-cmds.c (list_command): Handle the first "list" after the current source line having changed. * frame.h (set_current_sal_from_frame): Remove 'center' parameter. * infrun.c (normal_stop): Adjust call to set_current_sal_from_frame. * source.c (clear_lines_listed_range): New function. (set_current_source_symtab_and_line, identify_source_line): Clear the lines listed range. (line_info): Handle the first "info line" after the current source line having changed. * stack.c (print_stack_frame): Remove center handling. (set_current_sal_from_frame): Remove 'center' parameter. Don't center sal.line. gdb/testsuite/ 2014-05-21 Pedro Alves <palves@redhat.com> * gdb.base/list.exp (build_pattern, test_list): New procedures. Use them to test variations of "list" after reaching a breakpoint. * gdb.mi/mi-cli.exp (line_main_callme_2): New global. Test "list" with listsize 10 after reaching a breakpoint. * gdb.python/python.exp (decode_line current location line number): Adjust expected line number.
2014-05-22 00:15:27 +02:00
2014-05-21 Pedro Alves <palves@redhat.com>
* gdb.base/list.exp (build_pattern, test_list): New procedures.
Use them to test variations of "list" after reaching a breakpoint.
* gdb.mi/mi-cli.exp (line_main_callme_2): New global.
Test "list" with listsize 10 after reaching a breakpoint.
* gdb.python/python.exp (decode_line current location line
number): Adjust expected line number.
2014-05-21 Simon Marchi <simon.marchi@ericsson.com>
* lib/mi-support.exp (mi_run_cmd_full): Revert to original
behavior for $args, pass it directly to "run".
2014-05-21 Maciej W. Rozycki <macro@codesourcery.com>
* lib/gdb.exp (default_gdb_init): Bump `match_max' up from
30000 to 65536.
Allow making GDB not automatically connect to the native target. Sometimes it's useful to be able to disable the automatic connection to the native target. E.g., sometimes GDB disconnects from the extended-remote target I was debugging, without me noticing it, and then I do "run". That starts the program locally, and only after a little head scratch session do I figure out the program is running locally instead of remotely as intended. Same thing with "attach", "info os", etc. With the patch, we now can have this instead: (gdb) set auto-connect-native-target off (gdb) target extended-remote :9999 ... *gdb disconnects* (gdb) run Don't know how to run. Try "help target". To still be able to connect to the native target with auto-connect-native-target set to off, I've made "target native" work instead of erroring out as today. Before: (gdb) target native Use the "run" command to start a native process. After: (gdb) target native Done. Use the "run" command to start a process. (gdb) maint print target-stack The current target stack is: - native (Native process) - exec (Local exec file) - None (None) (gdb) run Starting program: ./a.out ... I've also wanted this for the testsuite, when running against the native-extended-gdbserver.exp board (runs against gdbserver in extended-remote mode). With a non-native-target board, it's always a bug to launch a program with the native target. Turns out we still have one such case this patch catches: (gdb) break main Breakpoint 1 at 0x4009e5: file ../../../src/gdb/testsuite/gdb.base/coremaker.c, line 138. (gdb) run Don't know how to run. Try "help target". (gdb) FAIL: gdb.base/corefile.exp: run: with core On the patch itself, probably the least obvious bit is the need to go through all targets, and move the unpush_target call to after the generic_mourn_inferior call instead of before. This is what inf-ptrace.c does too, ever since multi-process support was added. The reason inf-ptrace.c does things in that order is that in the current multi-process/single-target model, we shouldn't unpush the target if there are still other live inferiors being debugged. The check for that is "have_inferiors ()" (a misnomer nowadays...), which does: have_inferiors (void) { for (inf = inferior_list; inf; inf = inf->next) if (inf->pid != 0) return 1; It's generic_mourn_inferior that ends up clearing inf->pid, so we need to call it before the have_inferiors check. To make all native targets behave the same WRT to explicit "target native", I've added an inf_child_maybe_unpush_target function that targets call instead of calling unpush_target directly, and as that includes the have_inferiors check, I needed to adjust the targets. Tested on x86_64 Fedora 20, native, and also with the extended-gdbserver board. Confirmed a cross build of djgpp gdb still builds. Smoke tested a cross build of Windows gdb under Wine. Untested otherwise. gdb/ 2014-05-21 Pedro Alves <palves@redhat.com> * inf-child.c (inf_child_ops, inf_child_explicitly_opened): New globals. (inf_child_open_target): New function. (inf_child_open): Use inf_child_open_target to push the target instead of erroring out. (inf_child_disconnect, inf_child_close) (inf_child_maybe_unpush_target): New functions. (inf_child_target): Install inf_child_disconnect and inf_child_close. Store a pointer to the returned object. * inf-child.h (inf_child_open_target, inf_child_maybe_unpush): New declarations. * target.c (auto_connect_native_target): New global. (show_default_run_target): New function. (find_default_run_target): Return NULL if automatically connecting to the native target is disabled. (_initialize_target): Install set/show auto-connect-native-target. * NEWS: Mention "set auto-connect-native-target", and "target native". * linux-nat.c (super_close): New global. (linux_nat_close): Call super_close. (linux_nat_add_target): Store a pointer to the base class's to_close method. * inf-ptrace.c (inf_ptrace_mourn_inferior, inf_ptrace_detach): Use inf_child_maybe_unpush. * inf-ttrace.c (inf_ttrace_him): Don't push the target if it is already pushed. (inf_ttrace_mourn_inferior): Only unpush the target after mourning the inferior. Use inf_child_maybe_unpush_target. (inf_ttrace_attach): Don't push the target if it is already pushed. (inf_ttrace_detach): Use inf_child_maybe_unpush_target. * darwin-nat.c (darwin_mourn_inferior): Only unpush the target after mourning the inferior. Use inf_child_maybe_unpush_target. (darwin_attach_pid): Don't push the target if it is already pushed. * gnu-nat.c (gnu_mourn_inferior): Only unpush the target after mourning the inferior. Use inf_child_maybe_unpush_target. (gnu_detach): Use inf_child_maybe_unpush_target. * go32-nat.c (go32_create_inferior): Don't push the target if it is already pushed. (go32_mourn_inferior): Use inf_child_maybe_unpush_target. * nto-procfs.c (procfs_is_nto_target): Adjust comment. (procfs_open): Rename to ... (procfs_open_1): ... this. Add target_ops parameter. Adjust comments. Can target_preopen before changing node. Call inf_child_open_target to push the target explicitly. (procfs_attach): Don't push the target if it is already pushed. (procfs_detach): Use inf_child_maybe_unpush_target. (procfs_create_inferior): Don't push the target if it is already pushed. (nto_native_ops): New global. (procfs_open): Reimplement. (procfs_native_open): New function. (init_procfs_targets): Install procfs_native_open as to_open of "target native". Store a pointer to the "native" target in nto_native_ops. * procfs.c (procfs_attach): Don't push the target if it is already pushed. (procfs_detach): Use inf_child_maybe_unpush_target. (procfs_mourn_inferior): Only unpush the target after mourning the inferior. Use inf_child_maybe_unpush_target. (procfs_init_inferior): Don't push the target if it is already pushed. * windows-nat.c (do_initial_windows_stuff): Don't push the target if it is already pushed. (windows_detach): Use inf_child_maybe_unpush_target. (windows_mourn_inferior): Only unpush the target after mourning the inferior. Use inf_child_maybe_unpush_target. gdb/doc/ 2014-05-21 Pedro Alves <palves@redhat.com> * gdb.texinfo (Starting): Document "set/show auto-connect-native-target". (Target Commands): Document "target native". gdb/testsuite/ 2014-05-21 Pedro Alves <palves@redhat.com> * boards/gdbserver-base.exp (GDBFLAGS): Set to "set auto-connect-native-target off". * gdb.base/auto-connect-native-target.c: New file. * gdb.base/auto-connect-native-target.exp: New file.
2014-05-21 19:30:47 +02:00
2014-05-21 Pedro Alves <palves@redhat.com>
* boards/gdbserver-base.exp (GDBFLAGS): Set to "set
auto-connect-native-target off".
* gdb.base/auto-connect-native-target.c: New file.
* gdb.base/auto-connect-native-target.exp: New file.
Rename "target child" to "target native". I had been pondering renaming "target child" to something else. "child" is a little lie in case of "attach", and not exactly very clear to users, IMO. By best suggestion is "target native". If I were to explain what "target child" is, I'd just start out with "it's the native target" anyway. I was worrying a little that "native" might be a lie too if some port comes up with a default target that can run but is not really native, but I think that's a very minor issue - we can consider that "native" really means the default built in target that GDB supports, instead of saying that's the target that debugs host native processes, if it turns out necessary. This change doesn't affect users much, because "target child" results in error today: (gdb) target child Use the "run" command to start a child process. Other places "child" is visible: (gdb) help target ... List of target subcommands: target child -- Child process (started by the "run" command) target core -- Use a core file as a target target exec -- Use an executable file as a target ... (gdb) info target Symbols from "/home/pedro/gdb/mygit/build/gdb/gdb". Child process: Using the running image of child Thread 0x7ffff7fc9740 (LWP 4818). While running this, GDB does not access memory from... ... These places will say "native" instead. I think that's a good thing. gdb/ 2014-05-21 Pedro Alves <palves@redhat.com> * inf-child.c (inf_child_open): Remove mention of "child". (inf_child_target): Rename target to "native" instead of "child". gdb/testsuite/ 2014-05-21 Pedro Alves <palves@redhat.com> * gdb.base/default.exp: Test "target native" instead of "target child".
2014-05-21 19:30:43 +02:00
2014-05-21 Pedro Alves <palves@redhat.com>
* gdb.base/default.exp: Test "target native" instead of "target
child".
2014-05-21 Mark Wielaard <mjw@redhat.com>
* gdb.cp/var-tag.exp (do_global_tests): Handle underlying type.
Fix TLS access for -static -pthread I have posted: TLS variables access for -static -lpthread executables https://sourceware.org/ml/libc-help/2014-03/msg00024.html and the GDB patch below has been confirmed as OK for current glibcs. Further work should be done for newer glibcs: Improve TLS variables glibc compatibility https://sourceware.org/bugzilla/show_bug.cgi?id=16954 Still the patch below implements the feature in a fully functional way backward compatible with current glibcs, it depends on the following glibc source line: csu/libc-tls.c main_map->l_tls_modid = 1; gdb/ 2014-05-21 Jan Kratochvil <jan.kratochvil@redhat.com> Fix TLS access for -static -pthread. * linux-thread-db.c (struct thread_db_info): Add td_thr_tlsbase_p. (try_thread_db_load_1): Initialize it. (thread_db_get_thread_local_address): Call it if LM is zero. * target.c (target_translate_tls_address): Remove LM_ADDR zero check. * target.h (struct target_ops) (to_get_thread_local_address): Add load_module_addr comment. gdb/gdbserver/ 2014-05-21 Jan Kratochvil <jan.kratochvil@redhat.com> Fix TLS access for -static -pthread. * gdbserver/thread-db.c (struct thread_db): Add td_thr_tlsbase_p. (thread_db_get_tls_address): Call it if LOAD_MODULE is zero. (thread_db_load_search, try_thread_db_load_1): Initialize it. gdb/testsuite/ 2014-05-21 Jan Kratochvil <jan.kratochvil@redhat.com> Fix TLS access for -static -pthread. * gdb.threads/staticthreads.c <HAVE_TLS> (tlsvar): New. <HAVE_TLS> (thread_function, main): Initialize it. * gdb.threads/staticthreads.exp: Try gdb_compile_pthreads for $have_tls. Add clean_restart. <$have_tls != "">: Check TLSVAR. Message-ID: <20140410115204.GB16411@host2.jankratochvil.net>
2014-05-21 16:25:53 +02:00
2014-05-21 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix TLS access for -static -pthread.
* gdb.threads/staticthreads.c <HAVE_TLS> (tlsvar): New.
<HAVE_TLS> (thread_function, main): Initialize it.
* gdb.threads/staticthreads.exp: Try gdb_compile_pthreads for $have_tls.
Add clean_restart.
<$have_tls != "">: Check TLSVAR.
2014-05-21 Pedro Alves <palves@redhat.com>
* gdb.base/dcache-line-read-error.c: New.
* gdb.base/dcache-line-read-error.exp: New.
Make compare-sections work against all targets; add compare-sections [-r] tests. This does two things: 1. Adds a test. Recently compare-sections got a new "-r" switch, but given no test existed for compare-sections, the patch was allowed in with no testsuite addition. This now adds a test for both compare-sections and compare-sections -r. 2. Makes the compare-sections command work against all targets. Currently, compare-sections only works with remote targets, and only those that support the qCRC packet. The patch makes it so that if the target doesn't support accelerating memory verification, then GDB falls back to comparing memory itself. This is of course slower, but it's better than nothing, IMO. While testing against extended-remote GDBserver I noticed that we send the qCRC request to the target if we're connected, but not yet running a program. That can't work of course -- the patch fixes that. This all also goes in the direction of bridging the local/remote parity gap. I didn't decouple 1. from 2., because that would mean that the test would need to handle the case of the target not supporting the command. Tested on x86_64 Fedora 17, native, remote GDBserver, and extended-remote GDBserver. I also hack-disabled qCRC support to make sure the fallback paths in remote.c work. gdb/doc/ 2014-05-20 Pedro Alves <palves@redhat.com> * gdb.texinfo (Memory) <compare-sections>: Generalize comments to not be remote specific. Add cross reference to the qCRC packet. (Separate Debug Files): Update cross reference to the qCRC packet. (General Query Packets) <qCRC packet>: Add anchor. gdb/ 2014-05-20 Pedro Alves <palves@redhat.com> * NEWS: Mention that compare-sections now works with all targets. * remote.c (PACKET_qCRC): New enum value. (remote_verify_memory): Don't send qCRC if the target has no execution. Use packet_support/packet_ok. If the target doesn't support the qCRC packet, fallback to a deep memory copy. (compare_sections_command): Say "target image" instead of "remote executable". (_initialize_remote): Add PACKET_qCRC to the list of config packets that have no associated command. Extend comment. * target.c (simple_verify_memory, default_verify_memory): New function. * target.h (struct target_ops) <to_verify_memory>: Default to default_verify_memory. (simple_verify_memory): New declaration. * target-delegates.c: Regenerate. gdb/testsuite/ 2014-05-20 Pedro Alves <palves@redhat.com> * gdb.base/compare-sections.c: New file. * gdb.base/compare-sections.exp: New file.
2014-05-20 20:11:39 +02:00
2014-05-20 Pedro Alves <palves@redhat.com>
* gdb.base/compare-sections.c: New file.
* gdb.base/compare-sections.exp: New file.
[GDBserver] Make Zx/zx packet handling idempotent. This patch fixes hardware breakpoint regressions exposed by my fix for "PR breakpoints/7143 - Watchpoint does not trigger when first set", at https://sourceware.org/ml/gdb-patches/2014-03/msg00167.html The testsuite caught them on Linux/x86_64, at least. gdb.sum: gdb.sum: FAIL: gdb.base/hbreak2.exp: next over recursive call FAIL: gdb.base/hbreak2.exp: backtrace from factorial(5.1) FAIL: gdb.base/hbreak2.exp: continue until exit at recursive next test gdb.log: (gdb) next Program received signal SIGTRAP, Trace/breakpoint trap. factorial (value=4) at ../../../src/gdb/testsuite/gdb.base/break.c:113 113 if (value > 1) { /* set breakpoint 7 here */ (gdb) FAIL: gdb.base/hbreak2.exp: next over recursive call Actually, that patch just exposed a latent issue to "breakpoints always-inserted off" mode, not really caused it. After that patch, GDB no longer removes breakpoints at each internal event, thus making some scenarios behave like breakpoint always-inserted on. The bug is easy to trigger with always-inserted on. The issue is that since the target-side breakpoint conditions support, if the stub/server supports evaluating breakpoint conditions on the target side, then GDB is sending duplicate Zx packets to the target without removing them before, and GDBserver is not really expecting that for Z packets other than Z0/z0. E.g., with "set breakpoint always-inserted on" and "set debug remote 1": (gdb) b main Sending packet: $m410943,1#ff...Packet received: 48 Breakpoint 4 at 0x410943: file ../../../src/gdb/gdbserver/server.c, line 3028. Sending packet: $Z0,410943,1#48...Packet received: OK ^^^^^^^^^^^^ (gdb) b main Note: breakpoint 4 also set at pc 0x410943. Sending packet: $m410943,1#ff...Packet received: 48 Breakpoint 5 at 0x410943: file ../../../src/gdb/gdbserver/server.c, line 3028. Sending packet: $Z0,410943,1#48...Packet received: OK ^^^^^^^^^^^^ (gdb) b main Note: breakpoints 4 and 5 also set at pc 0x410943. Sending packet: $m410943,1#ff...Packet received: 48 Breakpoint 6 at 0x410943: file ../../../src/gdb/gdbserver/server.c, line 3028. Sending packet: $Z0,410943,1#48...Packet received: OK ^^^^^^^^^^^^ (gdb) del Delete all breakpoints? (y or n) y Sending packet: $Z0,410943,1#48...Packet received: OK Sending packet: $Z0,410943,1#48...Packet received: OK Sending packet: $z0,410943,1#68...Packet received: OK And for Z1, similarly: (gdb) hbreak main Sending packet: $m410943,1#ff...Packet received: 48 Hardware assisted breakpoint 4 at 0x410943: file ../../../src/gdb/gdbserver/server.c, line 3028. Sending packet: $Z1,410943,1#49...Packet received: OK ^^^^^^^^^^^^ Packet Z1 (hardware-breakpoint) is supported (gdb) hbreak main Note: breakpoint 4 also set at pc 0x410943. Sending packet: $m410943,1#ff...Packet received: 48 Hardware assisted breakpoint 5 at 0x410943: file ../../../src/gdb/gdbserver/server.c, line 3028. Sending packet: $Z1,410943,1#49...Packet received: OK ^^^^^^^^^^^^ (gdb) hbreak main Note: breakpoints 4 and 5 also set at pc 0x410943. Sending packet: $m410943,1#ff...Packet received: 48 Hardware assisted breakpoint 6 at 0x410943: file ../../../src/gdb/gdbserver/server.c, line 3028. Sending packet: $Z1,410943,1#49...Packet received: OK ^^^^^^^^^^^^ (gdb) del Delete all breakpoints? (y or n) y Sending packet: $Z1,410943,1#49...Packet received: OK ^^^^^^^^^^^^ Sending packet: $Z1,410943,1#49...Packet received: OK ^^^^^^^^^^^^ Sending packet: $z1,410943,1#69...Packet received: OK ^^^^^^^^^^^^ So GDB sent a bunch of Z1 packets, and then when finally removing the breakpoint, only one z1 packet was sent. On the GDBserver side (with monitor set debug-hw-points 1), in the Z1 case, we see: $ ./gdbserver :9999 ./gdbserver Process ./gdbserver created; pid = 8629 Listening on port 9999 Remote debugging from host 127.0.0.1 insert_watchpoint (addr=410943, len=1, type=instruction-execute): CONTROL (DR7): 00000101 STATUS (DR6): 00000000 DR0: addr=0x410943, ref.count=1 DR1: addr=0x0, ref.count=0 DR2: addr=0x0, ref.count=0 DR3: addr=0x0, ref.count=0 insert_watchpoint (addr=410943, len=1, type=instruction-execute): CONTROL (DR7): 00000101 STATUS (DR6): 00000000 DR0: addr=0x410943, ref.count=2 DR1: addr=0x0, ref.count=0 DR2: addr=0x0, ref.count=0 DR3: addr=0x0, ref.count=0 insert_watchpoint (addr=410943, len=1, type=instruction-execute): CONTROL (DR7): 00000101 STATUS (DR6): 00000000 DR0: addr=0x410943, ref.count=3 DR1: addr=0x0, ref.count=0 DR2: addr=0x0, ref.count=0 DR3: addr=0x0, ref.count=0 insert_watchpoint (addr=410943, len=1, type=instruction-execute): CONTROL (DR7): 00000101 STATUS (DR6): 00000000 DR0: addr=0x410943, ref.count=4 DR1: addr=0x0, ref.count=0 DR2: addr=0x0, ref.count=0 DR3: addr=0x0, ref.count=0 insert_watchpoint (addr=410943, len=1, type=instruction-execute): CONTROL (DR7): 00000101 STATUS (DR6): 00000000 DR0: addr=0x410943, ref.count=5 DR1: addr=0x0, ref.count=0 DR2: addr=0x0, ref.count=0 DR3: addr=0x0, ref.count=0 remove_watchpoint (addr=410943, len=1, type=instruction-execute): CONTROL (DR7): 00000101 STATUS (DR6): 00000000 DR0: addr=0x410943, ref.count=4 DR1: addr=0x0, ref.count=0 DR2: addr=0x0, ref.count=0 DR3: addr=0x0, ref.count=0 That's one insert_watchpoint call for each Z1 packet, and then one remove_watchpoint call for the z1 packet. Notice how ref.count increased for each insert_watchpoint call, and then in the end, after GDB told GDBserver to forget about the hardware breakpoint, GDBserver ends with the the first debug register still with ref.count=4! IOW, the hardware breakpoint is left armed on the target, while on the GDB end it's gone. If the program happens to execute 0x410943 afterwards, then the CPU traps, GDBserver reports the trap to GDB, and GDB not having a breakpoint set at that address anymore, reports to the user a spurious SIGTRAP. This is exactly what is happening in the hbreak2.exp test, though in that case, it's a shared library event that triggers a breakpoint_re_set, when breakpoints are still inserted (because nowadays GDB doesn't remove breakpoints while handling internal events), and that recreates breakpoint locations, which likewise forces breakpoint reinsertion and Zx packet resends... That is a lot of bogus Zx duplication that should possibly be addressed on the GDB side. GDB resends Zx packets because the way to change the target-side condition, is to resend the breakpoint to the server with the new condition. (That's an option in the packet: e.g., "Z1,410943,1;X3,220027" for "hbreak main if 0". The packets in the examples above are shorter because the breakpoints don't have conditions attached). GDB doesn't remove the breakpoint first before reinserting it because that'd be bad for non-stop, as it'd open a window where the inferior could miss the breakpoint. The conditions actually haven't changed between the resends, but GDB isn't smart enough to realize that. (TBC, if the target doesn't support target-side conditions, then GDB doesn't trigger these resends (init_bp_location calls mark_breakpoint_location_modified, and that does nothing if condition evaluation is on the host side. The resends are caused by the 'loc->condition_changed = condition_modified.' line.) But, even if GDB was made smarter, GDBserver should really still handle the resends anyway. So target-side conditions also aren't really to blame. The documentation of the Z/z packets says: "To avoid potential problems with duplicate packets, the operations should be implemented in an idempotent way." As such, we may want to fix GDB, but we should definitely fix GDBserver. The fix is a prerequisite for target-side conditions on hardware breakpoints anyway (and while at it, on watchpoints too). GDBserver indeed already treats duplicate Z0 packets in an idempotent way. mem-break.c has the concept of high-level and low-level breakpoints, somewhat similar to GDB's split of breakpoints vs breakpoint locations, and keeps track of multiple breakpoints referencing the same address/location, for the case of an internal GDBserver breakpoint or a tracepoint being set at the same address as a GDB breakpoint. But, it only allows GDB to ever contribute one reference to a software breakpoint location. IOW, if gdbserver sees a Z0 packet for the same address where it already had a GDB breakpoint set, then GDBserver won't create another high-level GDB breakpoint. However, mem-break.c only tracks GDB Z0 breakpoints. The same logic should apply to all kinds of Zx packets. Currently, gdbserver passes down each duplicate Zx (other than Z0) request directly to the target->insert_point routine. The x86 watchpoint support itself refcounts watchpoint / hw breakpoint requests, to handle overlapping watchpoints, and save debug registers. But that code doesn't (and really shouldn't) handle the duplicate requests, assuming that for each insert there will be a corresponding remove. So the fix is to generalize mem-break.c to track all kinds of Zx breakpoints, and filter out duplicates. As mentioned, this ends up adding support for target-side conditions on hardware breakpoints and watchpoints too (though GDB itself doesn't support the latter yet). Probably the least obvious change in the patch is that it kind of turns the breakpoint insert/remove APIs inside out. Before, the target methods were only called for GDB breakpoints. The internal breakpoint set/delete methods inserted memory breakpoints directly bypassing the insert/remove target methods. That's not good when the target should use a debug API to set software breakpoints, instead of relying on GDBserver patching memory with breakpoint instructions, as is the case of NTO. Now removal/insertion of all kinds of breakpoints/watchpoints, either internal, or from GDB, always go through the target methods. The insert_point/remove_point methods no longer get passed a Z packet type, but an internal/raw breakpoint type. They're also passed a pointer to the raw breakpoint itself (note that's still opaque outside mem-break.c), so that insert_memory_breakpoint / remove_memory_breakpoint have access to the breakpoint's shadow buffer. I first tried passing down a new structure based on GDB's "struct bp_target_info" (actually with that name exactly), but then decided against it as unnecessary complication. As software/memory breakpoints work by poking at memory, when setting a GDB Z0 breakpoint (but not internal breakpoints, as those can assume the conditions are already right), we need to tell the target to prepare to access memory (which on Linux means stop threads). If that operation fails, we need to return error to GDB. Seeing an error, if this is the first breakpoint of that type that GDB tries to insert, GDB would then assume the breakpoint type is supported, but it may actually not be. So we need to check whether the type is supported at all before preparing to access memory. And to solve that, the patch adds a new target->supports_z_point_type method that is called before actually trying to insert the breakpoint. Other than that, hopefully the change is more or less obvious. New test added that exercises the hbreak2.exp regression in a more direct way, without relying on a breakpoint re-set happening before main is reached. Tested by building GDBserver for: aarch64-linux-gnu arm-linux-gnueabihf i686-pc-linux-gnu i686-w64-mingw32 m68k-linux-gnu mips-linux-gnu mips-uclinux nios2-linux-gnu powerpc-linux-gnu sh-linux-gnu tilegx-unknown-linux-gnu x86_64-redhat-linux x86_64-w64-mingw32 And also regression tested on x86_64 Fedora 20. gdb/gdbserver/ 2014-05-20 Pedro Alves <palves@redhat.com> * linux-aarch64-low.c (aarch64_insert_point) (aarch64_remove_point): No longer check whether the type is supported here. Adjust to new interface. (the_low_target): Install aarch64_supports_z_point_type as supports_z_point_type method. * linux-arm-low.c (raw_bkpt_type_to_arm_hwbp_type): New function. (arm_linux_hw_point_initialize): Take an enum raw_bkpt_type instead of a Z packet char. Adjust. (arm_supports_z_point_type): New function. (arm_insert_point, arm_remove_point): Adjust to new interface. (the_low_target): Install arm_supports_z_point_type. * linux-crisv32-low.c (cris_supports_z_point_type): New function. (cris_insert_point, cris_remove_point): Adjust to new interface. Don't check whether the type is supported here. (the_low_target): Install cris_supports_z_point_type. * linux-low.c (linux_supports_z_point_type): New function. (linux_insert_point, linux_remove_point): Adjust to new interface. * linux-low.h (struct linux_target_ops) <insert_point, remove_point>: Take an enum raw_bkpt_type instead of a char. Add raw_breakpoint pointer parameter. <supports_z_point_type>: New method. * linux-mips-low.c (mips_supports_z_point_type): New function. (mips_insert_point, mips_remove_point): Adjust to new interface. Use mips_supports_z_point_type. (the_low_target): Install mips_supports_z_point_type. * linux-ppc-low.c (the_low_target): Install NULL as supports_z_point_type method. * linux-s390-low.c (the_low_target): Install NULL as supports_z_point_type method. * linux-sparc-low.c (the_low_target): Install NULL as supports_z_point_type method. * linux-x86-low.c (x86_supports_z_point_type): New function. (x86_insert_point): Adjust to new insert_point interface. Use insert_memory_breakpoint. Adjust to new i386_low_insert_watchpoint interface. (x86_remove_point): Adjust to remove_point interface. Use remove_memory_breakpoint. Adjust to new i386_low_remove_watchpoint interface. (the_low_target): Install x86_supports_z_point_type. * lynx-low.c (lynx_target_ops): Install NULL as supports_z_point_type callback. * nto-low.c (nto_supports_z_point_type): New. (nto_insert_point, nto_remove_point): Adjust to new interface. (nto_target_ops): Install nto_supports_z_point_type. * mem-break.c: Adjust intro comment. (struct raw_breakpoint) <raw_type, size>: New fields. <inserted>: Update comment. <shlib_disabled>: Delete field. (enum bkpt_type) <gdb_breakpoint>: Delete value. <gdb_breakpoint_Z0, gdb_breakpoint_Z1, gdb_breakpoint_Z2, gdb_breakpoint_Z3, gdb_breakpoint_Z4>: New values. (raw_bkpt_type_to_target_hw_bp_type): New function. (find_enabled_raw_code_breakpoint_at): New function. (find_raw_breakpoint_at): New type and size parameters. Use them. (insert_memory_breakpoint): New function, based off set_raw_breakpoint_at. (remove_memory_breakpoint): New function. (set_raw_breakpoint_at): Reimplement. (set_breakpoint): New, based on set_breakpoint_at. (set_breakpoint_at): Reimplement. (delete_raw_breakpoint): Go through the_target->remove_point instead of assuming memory breakpoints. (find_gdb_breakpoint_at): Delete. (Z_packet_to_bkpt_type, Z_packet_to_raw_bkpt_type): New functions. (find_gdb_breakpoint): New function. (set_gdb_breakpoint_at): Delete. (z_type_supported): New function. (set_gdb_breakpoint_1): New function, loosely based off set_gdb_breakpoint_at. (check_gdb_bp_preconditions, set_gdb_breakpoint): New functions. (delete_gdb_breakpoint_at): Delete. (delete_gdb_breakpoint_1): New function, loosely based off delete_gdb_breakpoint_at. (delete_gdb_breakpoint): New function. (clear_gdb_breakpoint_conditions): Rename to ... (clear_breakpoint_conditions): ... this. Don't handle a NULL breakpoint. (add_condition_to_breakpoint): Make static. (add_breakpoint_condition): Take a struct breakpoint pointer instead of an address. Adjust. (gdb_condition_true_at_breakpoint): Rename to ... (gdb_condition_true_at_breakpoint_z_type): ... this, and add z_type parameter. (gdb_condition_true_at_breakpoint): Reimplement. (add_breakpoint_commands): Take a struct breakpoint pointer instead of an address. Adjust. (gdb_no_commands_at_breakpoint): Rename to ... (gdb_no_commands_at_breakpoint_z_type): ... this. Add z_type parameter. Return true if no breakpoint was found. Change debug output. (gdb_no_commands_at_breakpoint): Reimplement. (run_breakpoint_commands): Rename to ... (run_breakpoint_commands_z_type): ... this. Add z_type parameter, and change return type to boolean. (run_breakpoint_commands): New function. (gdb_breakpoint_here): Also check for Z1 breakpoints. (uninsert_raw_breakpoint): Don't try to reinsert a disabled breakpoint. Go through the_target->remove_point instead of assuming memory breakpoint. (uninsert_breakpoints_at, uninsert_all_breakpoints): Uninsert software and hardware breakpoints. (reinsert_raw_breakpoint): Go through the_target->insert_point instead of assuming memory breakpoint. (reinsert_breakpoints_at, reinsert_all_breakpoints): Reinsert software and hardware breakpoints. (check_breakpoints, breakpoint_here, breakpoint_inserted_here): Check both software and hardware breakpoints. (validate_inserted_breakpoint): Assert the breakpoint is a software breakpoint. Set the inserted flag to -1 instead of setting shlib_disabled. (delete_disabled_breakpoints): Adjust. (validate_breakpoints): Only validate software breakpoints. Adjust to inserted flag change. (check_mem_read, check_mem_write): Skip breakpoint types other than software breakpoints. Adjust to inserted flag change. * mem-break.h (enum raw_bkpt_type): New enum. (raw_breakpoint, struct process_info): Forward declare. (Z_packet_to_target_hw_bp_type): Delete declaration. (raw_bkpt_type_to_target_hw_bp_type, Z_packet_to_raw_bkpt_type) (set_gdb_breakpoint, delete_gdb_breakpoint) (clear_breakpoint_conditions): New declarations. (set_gdb_breakpoint_at, clear_gdb_breakpoint_conditions): Delete. (breakpoint_inserted_here): Update comment. (add_breakpoint_condition, add_breakpoint_commands): Replace address parameter with a breakpoint pointer parameter. (gdb_breakpoint_here): Update comment. (delete_gdb_breakpoint_at): Delete. (insert_memory_breakpoint, remove_memory_breakpoint): Declare. * server.c (process_point_options): Take a struct breakpoint pointer instead of an address. Adjust. (process_serial_event) <Z/z packets>: Use set_gdb_breakpoint and delete_gdb_breakpoint. * spu-low.c (spu_target_ops): Install NULL as supports_z_point_type method. * target.h: Include mem-break.h. (struct target_ops) <prepare_to_access_memory>: Update comment. <supports_z_point_type>: New field. <insert_point, remove_point>: Take an enum raw_bkpt_type argument instead of a char. Also take a raw breakpoint pointer. * win32-arm-low.c (the_low_target): Install NULL as supports_z_point_type. * win32-i386-low.c (i386_supports_z_point_type): New function. (i386_insert_point, i386_remove_point): Adjust to new interface. (the_low_target): Install i386_supports_z_point_type. * win32-low.c (win32_supports_z_point_type): New function. (win32_insert_point, win32_remove_point): Adjust to new interface. (win32_target_ops): Install win32_supports_z_point_type. * win32-low.h (struct win32_target_ops): <supports_z_point_type>: New method. <insert_point, remove_point>: Take an enum raw_bkpt_type argument instead of a char. Also take a raw breakpoint pointer. gdb/testsuite/ 2014-05-20 Pedro Alves <palves@redhat.com> * gdb.base/break-idempotent.c: New file. * gdb.base/break-idempotent.exp: New file.
2014-05-20 19:24:28 +02:00
2014-05-20 Pedro Alves <palves@redhat.com>
* gdb.base/break-idempotent.c: New file.
* gdb.base/break-idempotent.exp: New file.
2014-05-20 Markus Metzger <markus.t.metzger@intel.com>
* gdb.btrace/nohist.exp: New.
2014-05-20 Yao Qi <yao@codesourcery.com>
* lib/gdb.exp (gdb_init): Set timeout if test file is under
gdb.reverse directory and gdb_reverse_timeout exists in board
setting.
* README: Document gdb_reverse_timeout.
gdb_init argument ARGS is a string rather than a list The argument ARGS of gdb_init is passed from dejagnu is a string, the test file name. In dejagnu/runtest.exp: proc runtest { test_file_name } { .... .... if [info exists tool] { if { [info procs "${tool}_init"] != "" } { ${tool}_init $test_file_name; } } .... } but inn default_gdb_init (callee of gdb_init), we have set gdb_test_file_name [file rootname [file tail [lindex $args 0]]] In tcl, all actual arguments are combined to a list and assigned to args. This code here isn't wrong, but unnecessary, because its caller (proc runtest) only passes one string to it, and IMO, we don't need such tricky tcl "args". I doubt that "[lindex $args 0]" is to be backward compatible with old dejagnu, but dejagnu-1.4 release started to pass $test_file_name to ${too}_init, as I showed above. dejagnu-1.4 was released in 2001, and it should be old enough. I also tried to check whether gdb testusite works with dejagnu-1.3 or not, but failed to build dejagnu-1.3 on my machine. Supposing GDB testsuite requires at least dejagnu-1.4, this change should be safe. This patch is update default_gdb_init to treat ARGS as a string instead of a list. Then, 'args' sounds like a list, and this patch also renames it by 'test_file_name', to align with dejagnu. gdb/testsuite: 2014-05-20 Yao Qi <yao@codesourcery.com> * lib/gdb.exp (default_gdb_init): Rename argument 'args' by 'test_file_name'. Treat args as a string instead of a list. (gdb_init): Rename argument 'args' by 'test_file_name'.
2014-05-09 05:01:07 +02:00
2014-05-20 Yao Qi <yao@codesourcery.com>
* lib/gdb.exp (default_gdb_init): Rename argument 'args' by
'test_file_name'. Treat args as a string instead of a list.
(gdb_init): Rename argument 'args' by 'test_file_name'.
2014-05-19 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.arch/powerpc-power.exp: New file.
* gdb.arch/powerpc-power.s: New file.
2014-05-16 Doug Evans <dje@google.com>
* gdb.base/Makefile.in (EXECUTABLES): Add completion.
* gdb.base/completion.exp: Check that all expected files exist
before doing file completion.
2014-05-16 Doug Evans <dje@google.com>
* gdb.base/catch-syscall.exp (test_catch_syscall_fail_nodatadir):
Update.
(do_syscall_tests_without_xml): Update.
2014-05-16 Pedro Alves <palves@redhat.com>
* lib/mi-support.exp (mi_expect_stop): On timeout, say "timeout"
instead of "unknown output after running".
2014-05-16 Yao Qi <yao@codesourcery.com>
* gdb.dwarf2/dw2-filename.exp: Copy file1.txt to host. Remove
file1.txt from host at the end.
* gdb.dwarf2/dw2-anonymous-func.exp: Likewise.
2014-05-15 Doug Evans <dje@google.com>
* gdb.dwarf2/fission-reread.S: Remove directory from .dwo file path.
* gdb.dwarf2/fission-reread.exp: Set debug-file-directory before
loading file. Add test for TU lookup.
2014-05-15 Simon Marchi <simon.marchi@ericsson.com>
* lib/mi-support.exp (mi_run_cmd_full): Set arguments by
calling "-exec-arguments" or "set args" before running the
inferior.
2014-05-15 Simon Marchi <simon.marchi@ericsson.com>
* lib/mi-support.exp (mi_expect_stop): Expect message for
inferiors that exit with non-zero exit code.
2014-05-14 Yao Qi <yao@codesourcery.com>
* gdb.mi/mi-file.exp (test_file_list_exec_source_file): Don't
match absolute path on remote host.
(test_file_list_exec_source_files): Remove "/" from the
pattern.
2014-05-14 Yao Qi <yao@codesourcery.com>
* boards/local-remote-host-notty.exp (${board}_file): New
proc.
2014-05-07 Kyle McMartin <kyle@redhat.com>
Pushed by Joel Brobecker <brobecker@adacore.com>.
* gdb.arch/aarch64-atomic-inst.c: New file.
* gdb.arch/aarch64-atomic-inst.exp: New file.
Relax the pattern in dwzbuildid.exp Hi, I recently see the fail in dwzbuildid.exp below on some targets, (gdb) print the_int No symbol "the_int" in current context. (gdb) FAIL: gdb.dwarf2/dwzbuildid.exp: mismatch: print the_int Looks the pattern expects to see "No symbol table is loaded", which is emitted in c-exp.y, variable: name_not_typename .... if (msymbol.minsym != NULL) write_exp_msymbol (pstate, msymbol); else if (!have_full_symbols () && !have_partial_symbols ()) error (_("No symbol table is loaded. Use the \"file\" command.")); else error (_("No symbol \"%s\" in current context."), copy_name ($1.stoken)); it is expected to have no full symbols nor partial symbols, but something brings full symbols or partial symbols in. I added "maint info symtabs" and "maint info psymtabs" in dwzbuildid.exp, and it shows symbols are from ld.so, which has debug information. Then, I reproduce the fail like this, $ make check RUNTESTFLAGS="CFLAGS_FOR_TARGET='-Wl,-rpath=${glibc_build}:${glibc_build}/math -Wl,--dynamic-linker=${glibc_build}/elf/ld.so' dwzbuildid.exp" ${glibc_build} is the glibc build tree. Debug information is not striped, so the test fail. However, if I strip debug information from libc.so, libm.so and ld.so. The test passes. This patch is to relax the pattern to match the both cases that glibc build has and has not debug information. gdb/testsuite: 2014-05-07 Yao Qi <yao@codesourcery.com> * gdb.dwarf2/dwzbuildid.exp: Match output "No symbol "the_int" in current context" too.
2014-05-06 15:47:36 +02:00
2014-05-07 Yao Qi <yao@codesourcery.com>
* gdb.dwarf2/dwzbuildid.exp: Match output "No symbol "the_int"
in current context" too.
2014-05-05 Keith Seitz <keiths@redhat.com>
* gdb.linespec/ls-dollar.exp: Add test for linespec
file:convenience_variable.
Partially available/unavailable data in requested range In gdb.trace/unavailable.exp, an action is defined to collect struct_b.struct_a.array[2] and struct_b.struct_a.array[100], struct StructB { int d, ef; StructA struct_a; int s:1; static StructA static_struct_a; const char *string; }; and the other files are not collected. When GDB examine traceframe collected by the action, "struct_b" is unavailable completely, which is wrong. (gdb) p struct_b $1 = <unavailable> When GDB reads 'struct_b', it will request to read memory at struct_b's address of length LEN. Since struct_b.d is not collected, no 'M' block includes the first part of the desired range, so tfile_xfer_partial returns TARGET_XFER_UNAVAILABLE and GDB thinks the whole requested range is unavailable. In order to fix this problem, in the iteration to 'M' blocks, we record the lowest address of blocks within the request range. If it has, the requested range isn't unavailable completely. This applies to ctf too. With this patch applied, the result looks good and fails in unavailable.exp is fixed. (gdb) p struct_b $1 = {d = <unavailable>, ef = <unavailable>, struct_a = {a = <unavailable>, b = <unavailable>, array = {<unavailable>, <unavailable>, -1431655766, <unavailable> <repeats 97 times>, -1431655766, <unavailable> <repeats 9899 times>}, ptr = <unavailable>, bitfield = <unavailable>}, s = <unavailable>, static static_struct_a = {a = <unavailable>, b = <unavailable>, array = {<unavailable> <repeats 10000 times>}, ptr = <unavailable>, bitfield = <unavailable>}, string = <unavailable>} gdb: 2014-05-05 Yao Qi <yao@codesourcery.com> Pedro Alves <palves@redhat.com> * tracefile-tfile.c (tfile_xfer_partial): Record the lowest address of blocks that intersects the requested range. Trim LEN up to LOW_ADDR_AVAILABLE if read from executable read-only sections. * ctf.c (ctf_xfer_partial): Likewise. gdb/testsuite: 2014-05-05 Yao Qi <yao@codesourcery.com> * gdb.trace/unavailable.exp (gdb_collect_args_test): Save traceframes into tfile and ctf trace files. Read data from trace file and test collected data. (gdb_collect_locals_test): Likewise. (gdb_unavailable_registers_test): Likewise. (gdb_unavailable_floats): Likewise. (gdb_collect_globals_test): Likewise. (top-level): Append "ctf" to trace_file_targets if GDB supports.
2014-04-26 04:14:52 +02:00
2014-05-05 Yao Qi <yao@codesourcery.com>
* gdb.trace/unavailable.exp (gdb_collect_args_test): Save
traceframes into tfile and ctf trace files. Read data from
trace file and test collected data.
(gdb_collect_locals_test): Likewise.
(gdb_unavailable_registers_test): Likewise.
(gdb_unavailable_floats): Likewise.
(gdb_collect_globals_test): Likewise.
(top-level): Append "ctf" to trace_file_targets if GDB
supports.
2014-05-05 Yao Qi <yao@codesourcery.com>
* gdb.trace/unavailable.exp (gdb_collect_args_test): Move some
code to ...
(gdb_collect_args_test_1): ... it. New proc.
(gdb_collect_locals_test): Move some code to ...
(gdb_collect_locals_test_1): ... it. New proc.
(gdb_unavailable_registers_test): Move some code to ...
(gdb_unavailable_registers_test_1): ... it. New proc.
(gdb_unavailable_floats): Move some code to ...
(gdb_unavailable_floats_1): ... it. New proc.
2014-05-02 Sergio Durigan Junior <sergiodj@redhat.com>
* gdb.arch/amd64-stap-optional-prefix.S (main): Add several
probes to test for bitness recognition.
* gdb.arch/amd64-stap-optional-prefix.exp
(test_probe_value_without_reg): New procedure.
Add code to test for different kinds of bitness.
Fix PR breakpoints/16889: gdb segfaults when printing ASM SDT arguments This commit fixes PR breakpoints/16889, which is about a bug that triggers when GDB tries to parse probes whose arguments do not contain the initial (and optional) "N@" part. For reference sake, the de facto format is described here: <https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation> Anyway, this PR actually uncovered two bugs (related) that were happening while parsing the arguments. The first one was that the parser *was* catching *some* arguments that were missing the "N@" part, but it wasn't correctly setting the argument's type. This was causing a NULL pointer being dereferenced, ouch... The second bug uncovered was that the parser was not catching all of the cases for a probe which did not provide the "N@" part. The fix for that was to simplify the check that the code was making to identify non-prefixed probes. The code is simpler and easier to read now. I am also providing a testcase for this bug, only for x86_64 architectures. gdb/ 2014-05-02 Sergio Durigan Junior <sergiodj@redhat.com> PR breakpoints/16889 * stap-probe.c (stap_parse_probe_arguments): Simplify check for non-prefixed probes (i.e., probes whose arguments do not start with "N@"). Always set the argument type to a sane value. gdb/testsuite/ 2014-05-02 Sergio Durigan Junior <sergiodj@redhat.com> PR breakpoints/16889 * gdb.arch/amd64-stap-optional-prefix.S: New file. * gdb.arch/amd64-stap-optional-prefix.exp: Likewise.
2014-05-02 22:45:35 +02:00
2014-05-02 Sergio Durigan Junior <sergiodj@redhat.com>
PR breakpoints/16889
* gdb.arch/amd64-stap-optional-prefix.S: New file.
* gdb.arch/amd64-stap-optional-prefix.exp: Likewise.
gdb_load: Fix latent bugs In a test I was writting, I needed a procedure that would connect to the target, and do "load", or equivalent. Years ago, boards would override gdb_load to implement that. Then gdb_reload was added, and gdb_load was relaxed to allow boards avoid the spawing and connecting to the target. This sped up gdbserver testing. See https://www.sourceware.org/ml/gdb-patches/2007-02/msg00318.html. To actually spawn the target and load the executable on the target side, gdb_reload was born: # gdb_reload -- load a file into the target. Called before "running", # either the first time or after already starting the program once, # for remote targets. Most files that override gdb_load should now # override this instead. proc gdb_reload { } { # For the benefit of existing configurations, default to gdb_load. # Specifying no file defaults to the executable currently being # debugged. return [gdb_load ""] } Note the comment about specifying no file. Indeed looking at config/sid.exp, or config/monitor.exp, we see examples of that. However, the default gdb_load itself doesn't handle the case of no file specified. When passed no file, it just calls gdb_file_cmd with no file either, which ends up invocing the "file" command with no argument, which means unloading the file and its symbols... That means calling gdb_reload when testing against native targets is broken. We don't see that today because the only call to gdb_reload that exists today is guarded by target_info exists gdb,do_reload_on_run. The native-extended-gdbserver.exp board is likewise broken here. When [gdb_load ""] is called, the board sets the remote exec-file to "" ... Tested on x86_64 Fedora 17, native, remote gdbserver and extended-remote gdbserver. testsuite/ 2014-05-01 Pedro Alves <palves@redhat.com> * lib/gdb.exp (gdb_load): Extend comment. Skip calling gdb_file_cmd if no file is specified. * boards/native-extended-gdbserver.exp (gdb_load): Use the last_loaded_file to set the remote exec-file.
2014-05-02 01:59:31 +02:00
2014-05-01 Pedro Alves <palves@redhat.com>
* lib/gdb.exp (gdb_load): Extend comment. Skip calling
gdb_file_cmd if no file is specified.
* boards/native-extended-gdbserver.exp (gdb_load): Use the
last_loaded_file to set the remote exec-file.
2014-05-01 Pedro Alves <palves@redhat.com>
* boards/local-remote-host.exp: New file.
2014-05-01 Pedro Alves <palves@redhat.com>
* boards/local-remote-host.exp: Rename to ...
* boards/local-remote-host-notty.exp: ... this.
2014-04-28 Joel Brobecker <brobecker@adacore.com>
* gdb.ada/dyn_arrayidx: New testcase.
2014-04-26 Yao Qi <yao@codesourcery.com>
* gdb.dwarf2/dwz.exp: Compile main.c to object. Restart GDB
and compute the length of function main. Save it in
$main_length.
(Dwarf::assemble): Use $main_length instead of hard-coded 10.
(top-level): Use gdb_compile to compile objects into
executable and restart GDB. Remove invocation to
prepare_for_testing.
PR server/16255: gdbserver cannot attach to a second inferior that is multi-threaded. On Linux, we need to explicitly ptrace attach to all lwps of a process. Because GDB might not be connected yet when an attach is requested, and thus it may not be possible to activate thread_db, as that requires access to symbols (IOW, gdbserver --attach), a while ago we make linux_attach loop over the lwps as listed by /proc/PID/task to find the lwps to attach to. linux_attach_lwp_1 has: ... if (initial) /* If lwp is the tgid, we handle adding existing threads later. Otherwise we just add lwp without bothering about any other threads. */ ptid = ptid_build (lwpid, lwpid, 0); else { /* Note that extracting the pid from the current inferior is safe, since we're always called in the context of the same process as this new thread. */ int pid = pid_of (current_inferior); ptid = ptid_build (pid, lwpid, 0); } That "safe" comment referred to linux_attach_lwp being called by thread-db.c. But this was clearly missed when a new call to linux_attach_lwp_1 was added to linux_attach. As a result, current_inferior will be set to some random process, and non-initial lwps of the second inferior get assigned the pid of the wrong inferior. E.g., in the case of attaching to two inferiors, for the second inferior (and so on), non-initial lwps of the second inferior get assigned the pid of the first inferior. This doesn't trigger on the first inferior, when current_inferior is NULL, add_thread switches the current inferior to the newly added thread. Rather than making linux_attach switch current_inferior temporarily (thus avoiding further reliance on global state), or making linux_attach_lwp_1 get the tgid from /proc, which add extra syscalls, and will be wrong in case of the user having originally attached directly to a non-tgid lwp, and then that lwp spawning new clones (the ptid.pid field of further new clones should be the same as the original lwp's pid, which is not the tgid), we note that callers of linux_attach_lwp/linux_attach_lwp_1 always have the right pid handy already, so they can pass it down along with the lwpid. The only other reason for the "initial" parameter is to error out instead of warn in case of attach failure, when we're first attaching to a process. There are only three callers of linux_attach_lwp/linux_attach_lwp_1, and each wants to print a different warn/error string, so we can just move the error/warn out of linux_attach_lwp_1 to the callers, thus getting rid of the "initial" parameter. There really nothing gdbserver-specific about attaching to two threaded processes, so this adds a new test under gdb.multi/. The test passes cleanly against the native GNU/Linux target, but fails/triggers the bug against GDBserver (before the patch), with the native-extended-remote board (as plain remote doesn't support multi-process). Tested on x86_64 Fedora 17, with the native-extended-gdbserver board. gdb/gdbserver/ 2014-04-25 Pedro Alves <palves@redhat.com> PR server/16255 * linux-low.c (linux_attach_fail_reason_string): New function. (linux_attach_lwp): Delete. (linux_attach_lwp_1): Rename to ... (linux_attach_lwp): ... this. Take a ptid instead of a pid as argument. Remove "initial" parameter. Return int instead of void. Don't error or warn here. (linux_attach): Adjust to call linux_attach_lwp. Call error on failure to attach to the tgid. Call warning when failing to attach to an lwp. * linux-low.h (linux_attach_lwp): Take a ptid instead of a pid as argument. Remove "initial" parameter. Return int instead of void. Don't error or warn here. (linux_attach_fail_reason_string): New declaration. * thread-db.c (attach_thread): Adjust to linux_attach_lwp's interface change. Use linux_attach_fail_reason_string. gdb/ 2014-04-25 Pedro Alves <palves@redhat.com> PR server/16255 * common/linux-ptrace.c (linux_ptrace_attach_warnings): Rename to ... (linux_ptrace_attach_fail_reason): ... this. Remove "warning: " and newline from built string. * common/linux-ptrace.h (linux_ptrace_attach_warnings): Rename to ... (linux_ptrace_attach_fail_reason): ... this. * linux-nat.c (linux_nat_attach): Adjust to use linux_ptrace_attach_fail_reason. gdb/testsuite/ 2014-04-25 Simon Marchi <simon.marchi@ericsson.com> Pedro Alves <palves@redhat.com> PR server/16255 * gdb.multi/multi-attach.c: New file. * gdb.multi/multi-attach.exp: New file.
2014-04-25 20:07:33 +02:00
2014-04-25 Simon Marchi <simon.marchi@ericsson.com>
Pedro Alves <palves@redhat.com>
PR server/16255
* gdb.multi/multi-attach.c: New file.
* gdb.multi/multi-attach.exp: New file.
Fix several "set remote foo-packet on/off" commands. For several RSP packets, there's a corresponding "set remote foo-packet on/off/auto" command that one can use do bypass auto-detection of support for the packet or feature. However, I noticed that setting several of these commands to 'on' or 'off' doesn't actually have any effect. These are, at least: set remote breakpoint-commands-packet set remote conditional-breakpoints-packet set remote fast-tracepoints-packet set remote static-tracepoints-packet set remote install-in-trace-packet These are commands that control a remote protocol feature that doesn't have a corresponding regular packet, and because of that we cache the knowledge of the remote side support as returned by the qSupported packet in the remote_state object. E.g., in the case of the 'set remote breakpoint-commands-packet' command, whether the feature is supported is recorded in the 'breakpoint_commands' field of the remote_state object. Whether to bypass packet support auto-detection or not is controlled by the 'detect' field of the corresponding packet's packet_config structure. That field is the variable associated directly with the "set remote foo-packet" command. Actual remote stub support for the packet (or feature) is recorded in the 'support' field of the same structure. However, when the user toggles the command, the 'support' field is also correspondingly updated to PACKET_ENABLE/DISABLE/SUPPORT_UNKNOWN, discarding the knowledge of whether the target actually supports the feature. If one toggles back to 'auto', it's no big issue for real packets, as they'll just end up re-probed the next time they might be necessary. But features whose support is only reported through qSupported don't get their corresponding (manually added/maintained) fields in remote_state objected updated. As we lost the actual status of the target support for the feature, GDB would need to probe the qSupported features again, which GDB doesn't do. But we can avoid that extra traffic, and clean things up, IMO. Instead of going in that direction, this patch completely decouples struct packet_config's 'detect' and 'support' fields. E.g., when the user does "set remote foo-packet off", instead of setting the packet config's 'support' field to PACKET_DISABLE, the 'support' field is not touched at all anymore. That is, we end up respecting this simple table: | packet_config->detect | packet_config->support | should use packet/feature? | |-----------------------+------------------------+----------------------------| | auto | PACKET_ENABLE | PACKET_ENABLE | | auto | PACKET_DISABLE | PACKET_DISABLE | | auto | PACKET_UNKNOWN | PACKET_UNKNOWN | | yes | don't care | PACKET_ENABLE | | no | don't care | PACKET_DISABLE | This is implemented by the new packet_support function. With that, we need to update this pattern throughout: if (remote_protocol_packets[PACKET_foo].support == PACKET_DISABLE) to do this instead: if (packet_support (PACKET_qAttached) == PACKET_DISABLE) where as mentioned, the packet_support function takes struct packet_config's 'detect' field into account, like in the table above. As when the packet is force-disabled or force-enabled, the 'support' field is just ignored, if the command is set back to auto, we'll resume respecting whatever the target said it supports. IOW, the end result is that the 'support' field always represents whether the target actually supports the packet or not. After all that, the manually maintained breakpoint_commands and equivalent fields of struct remote_state can then be eliminated, with references replaced by checking the result of calling the packet_support function on the corresponding packet or feature. This required adding new PACKET_foo enum values for several features that didn't have it yet. (The patch does not add corresponding "set remote foo-packet" style commands though, focusing only on bug fixing and laying the groundwork). Tested on x86_64 Fedora 17, native GDBserver. The new tests all fail without this patch. gdb/ 2014-04-25 Pedro Alves <palves@redhat.com> * remote.c (struct remote_state): Remove multi_process_aware, non_stop_aware, cond_tracepoints, cond_breakpoints, breakpoint_commands, fast_tracepoints, static_tracepoints, install_in_trace, disconnected_tracing, enable_disable_tracepoints, string_tracing, and augmented_libraries_svr4_read fields. (remote_multi_process_p): Move further below in the file. (struct packet_config): Add comments. (update_packet_config): Delete function. (show_packet_config_cmd): Use packet_config_support. (add_packet_config_cmd): Use NULL as set callback. (packet_ok): "set remote foo-packet"-style commands no longer change config->supported -- adjust. (PACKET_ConditionalTracepoints, PACKET_ConditionalBreakpoints) (PACKET_BreakpointCommands, PACKET_FastTracepoints) (PACKET_StaticTracepoints, PACKET_InstallInTrace): Add comments. (PACKET_QNonStop, PACKET_multiprocess_feature) (PACKET_EnableDisableTracepoints_feature, PACKET_tracenz_feature) (PACKET_DisconnectedTracing_feature) (PACKET_augmented_libraries_svr4_read_feature): New enum values. (set_remote_protocol_packet_cmd): Delete function. (packet_config_support, packet_support): New functions. (set_remote_protocol_Z_packet_cmd): Don't call update_packet_config. (remote_query_attached, remote_pass_signals) (remote_program_signals, remote_threads_info) (remote_threads_extra_info, remote_start_remote): Use packet_support. (remote_start_remote): Use packet_config_support and packet_support. (init_all_packet_configs): Set all packets to unknown support, instead of calling update_packet_config. (remote_check_symbols): Use packet_support. (remote_supported_packet): Unconditionally set the packet config's support status. (remote_multi_process_feature, remote_non_stop_feature) (remote_cond_tracepoint_feature, remote_cond_breakpoint_feature) (remote_breakpoint_commands_feature) (remote_fast_tracepoint_feature, remote_static_tracepoint_feature) (remote_install_in_trace_feature) (remote_disconnected_tracing_feature) (remote_enable_disable_tracepoint_feature) (remote_string_tracing_feature) (remote_augmented_libraries_svr4_read_feature): Delete functions. (remote_protocol_features): Adjust to use remote_supported_packet for "augmented-libraries-svr4-read", "multiprocess", "QNonStop", "ConditionalTracepoints", "ConditionalBreakpoints", "BreakpointCommands", "FastTracepoints", "StaticTracepoints", "InstallInTrace", "DisconnectedTracing", "DisconnectedTracing", "EnableDisableTracepoints", and "tracenz". (remote_query_supported): Use packet_support. (remote_open_1): Adjust. (extended_remote_attach_1): Use packet_support. Switch on the result of packet_ok instead of checking whether the packet ended up disabled. (remote_vcont_resume): Use packet_support. (remote_resume, remote_stop_ns, fetch_register_using_p) (remote_prepare_to_store, store_register_using_P) (check_binary_download, remote_write_bytes): Use packet_support. (remote_vkill): Use packet_support. Switch on the result of packet_ok instead of checking whether the packet ended up disabled. (extended_remote_supports_disable_randomization): Use packet_support. (extended_remote_run): Switch on the result of packet_ok instead of checking whether the packet ended up disabled. (remote_insert_breakpoint, remote_remove_breakpoint) (remote_insert_watchpoint, remote_remove_watchpoint) (remote_insert_hw_breakpoint, remote_remove_hw_breakpoint): Use packet_support. (remote_search_memory): Use packet_config_support. (remote_get_thread_local_address, remote_get_tib_address) (remote_hostio_send_command, remote_can_execute_reverse): Use packet_support. (remote_supports_cond_tracepoints) (remote_supports_cond_breakpoints) (remote_supports_fast_tracepoints) (remote_supports_static_tracepoints) (remote_supports_install_in_trace) (remote_supports_enable_disable_tracepoint) (remote_supports_string_tracing) (remote_can_run_breakpoint_commands): Rewrite, checking whether the packet config says the feature is enabled or disabled. (remote_download_tracepoint, remote_trace_set_readonly_regions) (remote_get_trace_status): Use packet_support. (remote_set_disconnected_tracing): Adjust to check whether the feature is enabled with packet_support. (remote_set_trace_buffer_size, remote_use_agent) (remote_can_use_agent, remote_supports_btrace): Use packet_support. (remote_enable_btrace, remote_disable_btrace, remote_read_btrace): Use packet_config_support. (remote_augmented_libraries_svr4_read): Rewrite, checking whether the packet config says the feature is enabled or disabled. (set_range_stepping): Use packet_support. gdb/testsuite/ 2014-04-25 Pedro Alves <palves@redhat.com> * gdb.base/cond-eval-mode.exp (warning): Move trailing \r\n to user. (top level): Test that "set remote conditional-breakpoints-packet off" works as intended. * gdb.base/dprintf.exp: Test that "set remote breakpoint-commands-packet off" works as intended. * gdb.trace/change-loc.exp (tracepoint_install_in_trace_disabled): New function. (top level): Call it. * gdb.trace/ftrace.exp (test_fast_tracepoints): Test that "set remote fast-tracepoints-packet off" works as intended. * gdb.trace/qtro.exp (gdb_is_target_remote): Moved ... * lib/gdb.exp (gdb_is_target_remote): ... here.
2014-04-25 19:07:02 +02:00
2014-04-25 Pedro Alves <palves@redhat.com>
* gdb.base/cond-eval-mode.exp (warning): Move trailing \r\n to
user.
(top level): Test that "set remote conditional-breakpoints-packet
off" works as intended.
* gdb.base/dprintf.exp: Test that "set remote
breakpoint-commands-packet off" works as intended.
* gdb.trace/change-loc.exp (tracepoint_install_in_trace_disabled):
New function.
(top level): Call it.
* gdb.trace/ftrace.exp (test_fast_tracepoints): Test that "set
remote fast-tracepoints-packet off" works as intended.
* gdb.trace/qtro.exp (gdb_is_target_remote): Moved ...
* lib/gdb.exp (gdb_is_target_remote): ... here.
2014-04-24 David Blaikie <dblaikie@gmail.com>
* gdb.base/catch-syscall.c: Make unreferenced statics non-static to
ensure clang would not discard them.
* gdb.base/gdbvars.c: Ditto.
* gdb.base/memattr.c: Ditto.
* gdb.base/whatis.c: Ditto.
* gdb.python/py-prettyprint.c: Ditto.
* gdb.trace/actions.c: Ditto.
* gdb.cp/ptype-cv-cp.cc: Mark unused global const int as used to
ensure clang would not discard it.
2014-04-24 David Blaikie <dblaikie@gmail.com>
* gdb.stabs/gdb11479.c (tag_dummy_enum): introduce a variable to cause
clang to emit the full definition of type required by the test
* gdb.stabs/gdb11479.exp (do_test): correct a typo in a test message
2014-04-24 David Blaikie <dblaikie@gmail.com>
* gdb.cp/pr10728-x.cc (main::x): Return by value instead of pointer to
coax Clang into emitting the definition of the type.
* gdb.cp/pr10728-x.h (y): Ditto.
* gdb.cp/pr10728-y.cc (y): Ditto.
2014-04-24 David Blaikie <dblaikie@gmail.com>
* gdb.base/label.exp: XFAIL label related tests under Clang.
* gdb.cp/cplabel.exp: Ditto.
* gdb.linespec/ls-errs.exp: Refactor tests to execute directly and XFAIL
under Clang those using labels.
2014-04-25 Yao Qi <yao@codesourcery.com>
* gdb.dwarf2/dwz.exp (Dwarf::assemble): Remove unused
double_label.
* gdb.dwarf2/dwzbuildid.exp (Dwarf::assemble): Remove
partial_label and double_label.
2014-04-24 David Blaikie <dblaikie@gmail.com>
* gdb.python/lib-types.exp: Fix test and xfail under gcc due to gcc/55641.
2014-04-24 David Blaikie <dblaikie@gmail.com>
* gdb.cp/cpexprs.cc: Move braces to the same line as the start
of the function to work across GCC and Clang.
* gdb.cp/cpexprs.exp: Account for GCC/Clang difference in vtable
pointer types (const void ** const V void **).
Add AVX512 registers support to GDB and GDBserver. This patch adds support for the Intel(R) Advanced Vector Extensions 512 (Intel(R) AVX-512) registers. Native and remote debugging are covered by this patch. Intel(R) AVX-512 is an extension to AVX to support 512-bit wide SIMD registers in 64-bit mode (XMM0-XMM31, YMM0-YMM31, ZMM0-ZMM31). The number of available registers in 32-bit mode is still 8 (XMM0-7, YMM0-7, ZMM0-7). The lower 256-bits of the ZMM registers are aliased to the respective 256-bit YMM registers. The lower 128-bits are aliased to the respective 128-bit XMM registers. There are also 8 new, dedicated mask registers (K0-K7) in both 32-bit mode and 64-bit mode. For more information please see Intel(R) Developer Zone: Intel(R) AVX http://software.intel.com/en-us/intel-isa-extensions#pid-16007-1495 Intel(R) Architecture Instruction Set Extensions Programming Reference: http://software.intel.com/en-us/file/319433-017pdf 2014-04-24 Michael Sturm <michael.sturm@mintel.com> Walfred Tedeschi <walfred.tedeschi@intel.com> * amd64-linux-nat.c (amd64_linux_gregset32_reg_offset): Add AVX512 registers. (amd64_linux_read_description): Add code to handle AVX512 xstate mask and return respective tdesc. * amd64-linux-tdep.c: Include features/i386/amd64-avx512-linux.c and features/i386/x32-avx512-linux.c. (amd64_linux_gregset_reg_offset): Add AVX512 registers. (amd64_linux_core_read_description): Add code to handle AVX512 xstate mask and return respective tdesc. (_initialize_amd64_linux_tdep): Initialize AVX512 tdesc. * amd64-linux-tdep.h (AMD64_LINUX_ORIG_RAX_REGNUM): Adjust regnum calculation. (AMD64_LINUX_NUM_REGS): Adjust to new number of registers. (tdesc_amd64_avx512_linux): New prototype. (tdesc_x32_avx512_linux): Likewise. * amd64-tdep.c: Include features/i386/amd64-avx512.c and features/i386/x32-avx512.c. (amd64_ymm_avx512_names): New register names for pseudo registers YMM16-31. (amd64_ymmh_avx512_names): New register names for raw registers YMMH16-31. (amd64_k_names): New register names for K registers. (amd64_zmmh_names): New register names for ZMM raw registers. (amd64_zmm_names): New registers names for ZMM pseudo registers. (amd64_xmm_avx512_names): New register names for XMM16-31 registers. (amd64_pseudo_register_name): Add code to return AVX512 pseudo registers. (amd64_init_abi): Add code to intitialize AVX512 tdep variables if feature is present. (_initialize_amd64_tdep): Call AVX512 tdesc initializers. * amd64-tdep.h (enum amd64_regnum): Add AVX512 registers. (AMD64_NUM_REGS): Adjust to new number of registers. * i386-linux-nat.c (GETXSTATEREGS_SUPPLIES): Extend range of registers supplied via XSTATE by AVX512 registers. (i386_linux_read_description): Add case for AVX512. * i386-linux-tdep.c: Include i386-avx512-linux.c. (i386_linux_gregset_reg_offset): Add AVX512 registers. (i386_linux_core_read_description): Add case for AVX512. (i386_linux_init_abi): Install supported register note section for AVX512. (_initialize_i386_linux_tdep): Add call to tdesc init function for AVX512. * i386-linux-tdep.h (I386_LINUX_NUM_REGS): Set number of registers to be number of zmm7h + 1. (tdesc_i386_avx512_linux): Add tdesc for AVX512 registers. * i386-tdep.c: Include features/i386/i386-avx512.c. (i386_zmm_names): Add ZMM pseudo register names array. (i386_zmmh_names): Add ZMM raw register names array. (i386_k_names): Add K raw register names array. (num_lower_zmm_regs): Add constant for the number of lower ZMM registers. AVX512 has 16 more ZMM registers than there are YMM registers. (i386_zmmh_regnum_p): Add function to look up register number of ZMM raw registers. (i386_zmm_regnum_p): Likewise for ZMM pseudo registers. (i386_k_regnum_p): Likewise for K raw registers. (i386_ymmh_avx512_regnum_p): Likewise for additional YMM raw registers added by AVX512. (i386_ymm_avx512_regnum_p): Likewise for additional YMM pseudo registers added by AVX512. (i386_xmm_avx512_regnum_p): Likewise for additional XMM registers added by AVX512. (i386_register_name): Add code to hide YMMH16-31 and ZMMH0-31. (i386_pseudo_register_name): Add ZMM pseudo registers. (i386_zmm_type): Construct and return vector registers type for ZMM registers. (i386_pseudo_register_type): Return appropriate type for YMM16-31, ZMM0-31 pseudo registers and K registers. (i386_pseudo_register_read_into_value): Add code to read K, ZMM and YMM16-31 registers from register cache. (i386_pseudo_register_write): Add code to write K, ZMM and YMM16-31 registers. (i386_register_reggroup_p): Add code to include/exclude AVX512 registers in/from respective register groups. (i386_validate_tdesc_p): Handle AVX512 feature, add AVX512 registers if feature is present in xcr0. (i386_gdbarch_init): Add code to initialize AVX512 feature variables in tdep structure, wire in pseudo registers and call initialize_tdesc_i386_avx512. * i386-tdep.h (struct gdbarch_tdep): Add AVX512 related variables. (i386_regnum): Add AVX512 registers. (I386_SSE_NUM_REGS): New define for number of SSE registers. (I386_AVX_NUM_REGS): Likewise for AVX registers. (I386_AVX512_NUM_REGS): Likewise for AVX512 registers. (I386_MAX_REGISTER_SIZE): Change to 64 bytes, ZMM registers are 512 bits wide. (i386_xmm_avx512_regnum_p): New prototype for register look up. (i386_ymm_avx512_regnum_p): Likewise. (i386_k_regnum_p): Likewise. (i386_zmm_regnum_p): Likewise. (i386_zmmh_regnum_p): Likewise. * i387-tdep.c : Update year in copyright notice. (xsave_ymm_avx512_offset): New table for YMM16-31 offsets in XSAVE buffer. (XSAVE_YMM_AVX512_ADDR): New macro. (xsave_xmm_avx512_offset): New table for XMM16-31 offsets in XSAVE buffer. (XSAVE_XMM_AVX512_ADDR): New macro. (xsave_avx512_k_offset): New table for K register offsets in XSAVE buffer. (XSAVE_AVX512_K_ADDR): New macro. (xsave_avx512_zmm_h_offset): New table for ZMM register offsets in XSAVE buffer. (XSAVE_AVX512_ZMM_H_ADDR): New macro. (i387_supply_xsave): Add code to supply AVX512 registers to XSAVE buffer. (i387_collect_xsave): Add code to collect AVX512 registers from XSAVE buffer. * i387-tdep.h (I387_NUM_XMM_AVX512_REGS): New define for number of XMM16-31 registers. (I387_NUM_K_REGS): New define for number of K registers. (I387_K0_REGNUM): New define for K0 register number. (I387_NUM_ZMMH_REGS): New define for number of ZMMH registers. (I387_ZMM0H_REGNUM): New define for ZMM0H register number. (I387_NUM_YMM_AVX512_REGS): New define for number of YMM16-31 registers. (I387_YMM16H_REGNUM): New define for YMM16H register number. (I387_XMM16_REGNUM): New define for XMM16 register number. (I387_YMM0_REGNUM): New define for YMM0 register number. (I387_KEND_REGNUM): New define for last K register number. (I387_ZMMENDH_REGNUM): New define for last ZMMH register number. (I387_YMMH_AVX512_END_REGNUM): New define for YMM31 register number. (I387_XMM_AVX512_END_REGNUM): New define for XMM31 register number. * common/i386-xstate.h: Add AVX 3.1 feature bits, mask and XSTATE size. * features/Makefile: Add AVX512 related files. * features/i386/32bit-avx512.xml: New file. * features/i386/64bit-avx512.xml: Likewise. * features/i386/amd64-avx512-linux.c: Likewise. * features/i386/amd64-avx512-linux.xml: Likewise. * features/i386/amd64-avx512.c: Likewise. * features/i386/amd64-avx512.xml: Likewise. * features/i386/i386-avx512-linux.c: Likewise. * features/i386/i386-avx512-linux.xml: Likewise. * features/i386/i386-avx512.c: Likewise. * features/i386/i386-avx512.xml: Likewise. * features/i386/x32-avx512-linux.c: Likewise. * features/i386/x32-avx512-linux.xml: Likewise. * features/i386/x32-avx512.c: Likewise. * features/i386/x32-avx512.xml: Likewise. * regformats/i386/amd64-avx512-linux.dat: New file. * regformats/i386/amd64-avx512.dat: Likewise. * regformats/i386/i386-avx512-linux.dat: Likewise. * regformats/i386/i386-avx512.dat: Likewise. * regformats/i386/x32-avx512-linux.dat: Likewise. * regformats/i386/x32-avx512.dat: Likewise. * NEWS: Add note about new support for AVX512. testsuite/ * Makefile.in (EXECUTABLES): Added i386-avx512. * gdb.arch/i386-avx512.c: New file. * gdb.arch/i386-avx512.exp: Likewise. gdbserver/ * Makefile.in: Added rules to handle new files i386-avx512.c i386-avx512-linux.c amd64-avx512.c amd64-avx512-linux.c x32-avx512.c x32-avx512-linux.c. * configure.srv (srv_i386_regobj): Add i386-avx512.o. (srv_i386_linux_regobj): Add i386-avx512-linux.o. (srv_amd64_regobj): Add amd64-avx512.o and x32-avx512.o. (srv_amd64_linux_regobj): Add amd64-avx512-linux.o and x32-avx512-linux.o. (srv_i386_32bit_xmlfiles): Add i386/32bit-avx512.xml. (srv_i386_64bit_xmlfiles): Add i386/64bit-avx512.xml. (srv_amd64_xmlfiles): Add i386/amd64-avx512.xml and i386/x32-avx512.xml. (srv_i386_linux_xmlfiles): Add i386/i386-avx512-linux.xml. (srv_amd64_linux_xmlfiles): Add i386/amd64-avx512-linux.xml and i386/x32-avx512-linux.xml. * i387-fp.c (num_avx512_k_registers): New constant for number of K registers. (num_avx512_zmmh_low_registers): New constant for number of lower ZMM registers (0-15). (num_avx512_zmmh_high_registers): New constant for number of higher ZMM registers (16-31). (num_avx512_ymmh_registers): New contant for number of higher YMM registers (ymm16-31 added by avx521 on x86_64). (num_avx512_xmm_registers): New constant for number of higher XMM registers (xmm16-31 added by AVX512 on x86_64). (struct i387_xsave): Add space for AVX512 registers. (i387_cache_to_xsave): Change raw buffer size to 64 characters. Add code to handle AVX512 registers. (i387_xsave_to_cache): Add code to handle AVX512 registers. * linux-x86-low.c (init_registers_amd64_avx512_linux): New prototypei from generated file. (tdesc_amd64_avx512_linux): Likewise. (init_registers_x32_avx512_linux): Likewise. (tdesc_x32_avx512_linux): Likewise. (init_registers_i386_avx512_linux): Likewise. (tdesc_i386_avx512_linux): Likewise. (x86_64_regmap): Add AVX512 registers. (x86_linux_read_description): Add code to handle AVX512 XSTATE mask. (initialize_low_arch): Add code to initialize AVX512 registers. doc/ * gdb.texinfo (i386 Features): Add description of AVX512 registers. Change-Id: Ifc4c08c76b85dbec18d02efdbe6182e851584438 Signed-off-by: Michael Sturm <michael.sturm@intel.com>
2013-12-16 16:43:05 +01:00
2014-04-24 Michael Sturm <michael.sturm@mintel.com>
Walfred Tedeschi <walfred.tedeschi@intel.com>
* Makefile.in (EXECUTABLES): Added i386-avx512.
* gdb.arch/i386-avx512.c: New file.
* gdb.arch/i386-avx512.exp: Likewise.
Introduce some new MI test suite cleanups for breakpoint and breakpoint table handling. This is a patch in five parts (all committed here in one commit). ----- 1/5: parse_args parse_args is a very useful utility function which allows you to do getopt-y kinds of things in Tcl. Example: proc myproc {foo args} { parse_args {{bar} {baz "abc"} {qux}} # ... } myproc ABC -bar -baz DEF peanut butter will define the following variables in myproc: foo (=ABC), bar (=1), baz (=DEF), and qux (=0) args will be the list {peanut butter} ----- 2/5: mi_build_kv_pairs build_kv_pairs simply does what it says: given the input list and an option join string, it combines list elements into kv-pairs for MI handling. It knows how to handle tuples and other special MI types. Example: mi_build_kv_pairs {a b c d e f g \[.*\]} returns a=\"b\",c=\"d\",e=\"f\",g=\[.*\] ----- 3/5: mi_make_breakpoint This function builds breakpoint regexps, such as "bkpt={number=\".*\", [snip]}". Note that ONLY the options given to mi_make_breakpoint/mi_create_breakpoint will actually be tested. So if -number is omitted, the regexp will allow anything [number=\".*\"] Examples: mi_make_breakpoint -number 3 mi_create_breakpoint "myfile.c:21" -file myfile.c -line 21 ----- 4/5: mi_make_breakpoint_table This function builds MI breakpoint table regexps. Example: set bps {} lappend bps [mi_make_breakpoint -number 1 -func "main" \ -file ".*/myfile.c" -line 42 lappend bps [mi_make_breakpoint -number 2 -func "marker" \ -file ".*myfile.c" -line 21 gdb_test "-break-info" "\\^done,[mi_make_breakpoint_table $bps]" \ "breakpoint list" ----- 5/5: Update all callers Self-explanatory testsuite/ChangeLog 2014-04-23 Keith Seitz <keiths@redhat.com> * lib/mi-support.exp (mi_list_breakpoints): Delete. (mi_make_breakpoint_table): New procedure. (mi_create_breakpoint): Use mi_make_breakpoint and return the result. (mi_make_breakpoint): New procedure. (mi_build_kv_pairs): New procedure. * gdb.mi/mi-break.exp: Remove unused globals, update mi_create_breakpoint usage, and use mi_make_breakpoint_table. All callers updated. * gdb.mi/mi-dprintf.exp: Use variable to track command number. Update all callers of mi_create_breakpoint and use mi_make_breakpoint_table. Remove any unused global variables. * gdb.mi/mi-nonstop.exp: Likewise. * gdb.mi/mi-nsintrall.exp: Likewise. * gdb.mi/mi-nsmoribund.exp: Likewise. * gdb.mi/mi-nsthrexec.exp: Likewise. * gdb.mi/mi-reverse.exp: Likewise. * gdb.mi/mi-simplerun.exp: Likewise. * gdb.mi/mi-stepn.exp: Likewise. * gdb.mi/mi-syn-frame.exp: Likewise. * gdb.mi/mi-until.exp: Likewise. * gdb.mi/mi-var-cp.exp: Likewise. * gdb.mi/mi-var-display.exp: Likewise. * gdb.mi/mi2-amd64-entry-value.exp: Likewise. * gdb.mi/mi2-var-child.exp: Likewise. * gdb.mi/mi-vla-c99.exp: Likewise. * lib/mi-support.exp: Likewise. From Ian Lance Taylor <iant@cygnus.com>: * lib/gdb.exp (parse_args): New procedure.
2014-04-23 21:17:31 +02:00
2014-04-23 Keith Seitz <keiths@redhat.com>
* lib/mi-support.exp (mi_list_breakpoints): Delete.
(mi_make_breakpoint_table): New procedure.
(mi_create_breakpoint): Use mi_make_breakpoint
and return the result.
(mi_make_breakpoint): New procedure.
(mi_build_kv_pairs): New procedure.
* gdb.mi/mi-break.exp: Remove unused globals,
update mi_create_breakpoint usage, and use mi_make_breakpoint_table.
All callers updated.
* gdb.mi/mi-dprintf.exp: Use variable to track command
number.
Update all callers of mi_create_breakpoint and use
mi_make_breakpoint_table.
Remove any unused global variables.
* gdb.mi/mi-nonstop.exp: Likewise.
* gdb.mi/mi-nsintrall.exp: Likewise.
* gdb.mi/mi-nsmoribund.exp: Likewise.
* gdb.mi/mi-nsthrexec.exp: Likewise.
* gdb.mi/mi-reverse.exp: Likewise.
* gdb.mi/mi-simplerun.exp: Likewise.
* gdb.mi/mi-stepn.exp: Likewise.
* gdb.mi/mi-syn-frame.exp: Likewise.
* gdb.mi/mi-until.exp: Likewise.
* gdb.mi/mi-var-cp.exp: Likewise.
* gdb.mi/mi-var-display.exp: Likewise.
* gdb.mi/mi2-amd64-entry-value.exp: Likewise.
* gdb.mi/mi2-var-child.exp: Likewise.
* gdb.mi/mi-vla-c99.exp: Likewise.
* lib/mi-support.exp: Likewise.
From Ian Lance Taylor <iant@cygnus.com>:
* lib/gdb.exp (parse_args): New procedure.
Stale breakpoint instructions, spurious SIGTRAPS. Without the code portion of the patch, we get these failures: FAIL: gdb.base/break-unload-file.exp: always-inserted on: break: continue FAIL: gdb.base/break-unload-file.exp: always-inserted on: hbreak: continue FAIL: gdb.base/sym-file.exp: stale bkpts: continue to breakpoint: end here They all looks like random SIGTRAPs: continue Continuing. Program received signal SIGTRAP, Trace/breakpoint trap. 0x0000000000400541 in foo () at ../../../src/gdb/testsuite/gdb.base/break-unload-file.c:21 21 } (gdb) FAIL: gdb.base/break-unload-file.exp: always-inserted on: break: continue (This is a regression caused by the remove-symbol-file command series.) break-unload-file.exp is about having breakpoints inserted, and then doing "file". I caught this while writing a test that does "file PROGRAM", while PROGRAM was already loaded, which internally does "file" first, because I wanted to force a breakpoint_re_set, but the test is more explicit in case GDB ever optimizes out that re-set. The problem is that unloading the file with "file" ends up in disable_breakpoints_in_freed_objfile, which marks all breakpoint locations of the objfile as both shlib_disabled, _and_ clears the inserted flag, without actually removing the breakpoints from the inferior. Now, usually, in all-stop, breakpoints will already be removed from the inferior before the user can issue the "file" command, but, with non-stop, or breakpoints always-inserted on mode, breakpoints stay inserted even while the user has the prompt. In the latter case, then, if we let the program continue, and it executes the address where we had previously set the breakpoint, it'll actually execute the breakpoint instruction that we left behind... Now, one issue is that the intent of disable_breakpoints_in_freed_objfile is really to handle the unloading of OBJF_USERLOADED objfiles. These are objfiles that were added with add-symbol-file and that are removed with remove-symbol-file. "add-symbol-file"'s docs in the manual clearly say these commands are used to let GDB know about dynamically loaded code: You would use this command when @var{filename} has been dynamically loaded (by some other means) into the program that is running. Similarly, the online help says: (gdb) help add-symbol-file Load symbols from FILE, assuming FILE has been dynamically loaded. So it makes sense to, like when shared libraries are unloaded through the generic solib machinery, mark the breakpoint locations as shlib_disabled. But, the "file" command is not about dynamically loaded code, it's about the main program. So the patch makes disable_breakpoints_in_freed_objfile skip all objfiles but OBJF_USERLOADED ones, thus skipping the main objfile. Then, the reason that disable_breakpoints_in_freed_objfile was clearing the inserted flag isn't clear, but likely to avoid breakpoint removal errors, assuming remove-symbol-file was called after the dynamic object was already unmapped from the inferior. In that case, it'd okay to simply clear the inserted flag, but not so if the user for example does remove-symbol-file to remove the library because he made a mistake in the library's address, and wants to re-do add-symbol-file with the correct address. To address all that, I propose an alternative implementation, that handles both cases. The patch includes changes to sym-file.exp to cover them. This implementation leaves the inserted flag alone, and handles breakpoint insertion/removal failure gracefully when the locations are in OBJF_USERLOADED objfiles, just like we handle insertion/removal failure gracefully for locations in shared libraries. To try to make sure we aren't patching back stale shadow memory contents into the inferior, in case the program mapped a different library at the same address where we had the breakpoint, without the user having had a chance of remove-symbol-file'ing before, this adds a new memory_validate_breakpoint function that checks if the breakpoint instruction is still in memory. ppc_linux_memory_remove_breakpoint does this unconditionally for all memory breakpoints, and questions whether memory_remove_breakpoint should be changed to do this for all breakpoints. Possibly yes, though I'm not certain, hence this baby-steps patch. Tested on x86_64 Fedora 17, native and gdbserver. gdb/ 2014-04-23 Pedro Alves <palves@redhat.com> * breakpoint.c (insert_bp_location): Tolerate errors if the breakpoint is set in a user-loaded objfile. (remove_breakpoint_1): Likewise. Also tolerate errors if the location is marked shlib_disabled. If the breakpoint is set in a user-loaded objfile is a GDB-side memory breakpoint, validate it before uninsertion. (disable_breakpoints_in_freed_objfile): Skip non-OBJF_USERLOADED objfiles. Don't clear the location's inserted flag. * mem-break.c (memory_validate_breakpoint): New function. * objfiles.c (userloaded_objfile_contains_address_p): New function. * objfiles.h (userloaded_objfile_contains_address_p): Declare. * target.h (memory_validate_breakpoint): New declaration. gdb/testsuite/ 2014-04-23 Pedro Alves <palves@redhat.com> * gdb.base/break-unload-file.c: New file. * gdb.base/break-unload-file.exp: New file. * gdb.base/sym-file-lib.c (baz): New function. * gdb.base/sym-file-loader.c (struct segment) <mapped_size>: New field. (load): Store the segment's mapped size. (unload): New function. (unload_shlib): New function. * gdb.base/sym-file-loader.h (unload_shlib): New declaration. * gdb.base/sym-file-main.c (main): Unload, and reload the library, set a breakpoint at baz, and call it. * gdb.base/sym-file.exp: New tests for stale breakpoint instructions.
2014-04-23 00:19:19 +02:00
2014-04-23 Pedro Alves <palves@redhat.com>
* gdb.base/break-unload-file.c: New file.
* gdb.base/break-unload-file.exp: New file.
* gdb.base/sym-file-lib.c (baz): New function.
* gdb.base/sym-file-loader.c (struct segment) <mapped_size>: New
field.
(load): Store the segment's mapped size.
(unload): New function.
(unload_shlib): New function.
* gdb.base/sym-file-loader.h (unload_shlib): New declaration.
* gdb.base/sym-file-main.c (main): Unload, and reload the library,
set a breakpoint at baz, and call it.
* gdb.base/sym-file.exp: New tests for stale breakpoint
instructions.
Don't suppress errors inserting/removing hardware breakpoints in shared libraries. As explained in https://sourceware.org/ml/gdb-patches/2008-08/msg00361.html, after a shared library was unloaded, we can no longer insert or remove breakpoints into/from its (no longer present) code segment. That'll fail with memory errors. However, that concern does not apply to hardware breakpoints. By definition, hardware breakpoints are implemented using a mechanism that is not dependent on being able to modify the target's memory. Usually, by setting up CPU debug registers. IOW, we should be able to set hw breakpoints in an unmapped address. We don't seem to have a test that exercises that, so this patch adds one. I noticed the error supression because of a related issue -- the target_insert_hw_breakpoint/target_remove_hw_breakpoint interfaces don't really distinguish "not supported" from "error" return, and so remote.c returns -1 in both cases. This results in hardware breakpoints set in shared libraries silently ending up pending forever even though the target doesn't actually support hw breakpoints. (gdb) set breakpoint always-inserted on (gdb) set remote Z-packet off (gdb) info breakpoints No breakpoints or watchpoints. (gdb) hbreak shrfunc Hardware assisted breakpoint 3 at 0x7ffff7dfb657: file ../../../src/gdb/testsuite/gdb.base/hbreak-in-shr-unsupported-shr.c, line 21. (gdb) info break Num Type Disp Enb Address What 3 hw breakpoint keep y <PENDING> shrfunc After the patch we get the expected: (gdb) hbreak shrfunc Hardware assisted breakpoint 3 at 0x7ffff7dfb657: file ../../../src/gdb/testsuite/gdb.base/hbreak-in-shr-unsupported-shr.c, line 21. Warning: Cannot insert hardware breakpoint 3. Could not insert hardware breakpoints: You may have requested too many hardware breakpoints/watchpoints. (gdb) info break Num Type Disp Enb Address What 3 hw breakpoint keep y 0x00007ffff7dfb657 in shrfunc at ../../../src/gdb/testsuite/gdb.base/hbreak-in-shr-unsupported-shr.c:21 (HW breakpoints set in the main executable, when the target doesn't support HW breakpoints always resulted in the latter output.) We probably should improve the insert/remove interface to return a different error code for unsupported. But I chose to fix the error supression first, as it's a deeper and wider issue. Tested on x86_64 Fedora 17, native and gdbserver. gdb/ 2014-04-23 Pedro Alves <palves@redhat.com> * breakpoint.c (insert_bp_location, remove_breakpoint_1): If the breakpoint is set in a shared library, only suppress errors for software breakpoints, not hardware breakpoints. gdb/testsuite/ 2014-04-23 Pedro Alves <palves@redhat.com> * gdb.base/hbreak-in-shr-unsupported-shr.c: New file. * gdb.base/hbreak-in-shr-unsupported.c: New file. * gdb.base/hbreak-in-shr-unsupported.exp: New file. * gdb.base/hbreak-unmapped.c: New file. * gdb.base/hbreak-unmapped.exp: New file. * gdb.trace/qtro.exp (gdb_is_target_remote): Move ... * lib/gdb.exp (gdb_is_target_remote): ... here.
2014-04-23 16:06:47 +02:00
2014-04-23 Pedro Alves <palves@redhat.com>
* gdb.base/hbreak-in-shr-unsupported-shr.c: New file.
* gdb.base/hbreak-in-shr-unsupported.c: New file.
* gdb.base/hbreak-in-shr-unsupported.exp: New file.
* gdb.base/hbreak-unmapped.c: New file.
* gdb.base/hbreak-unmapped.exp: New file.
* gdb.trace/qtro.exp (gdb_is_target_remote): Move ...
* lib/gdb.exp (gdb_is_target_remote): ... here.
Consecutive step-overs trigger internal error. If a thread trips on a breakpoint that needs stepping over just after finishing a step over, GDB currently fails an assertion. This is a regression caused by the "Handle multiple step-overs." patch (99619beac6252113fed212fdb9e1ab97bface423) at https://sourceware.org/ml/gdb-patches/2014-02/msg00765.html. (gdb) x /4i $pc => 0x400540 <main+4>: movl $0x0,0x2003da(%rip) # 0x600924 <i> 0x40054a <main+14>: movl $0x1,0x2003d0(%rip) # 0x600924 <i> 0x400554 <main+24>: movl $0x2,0x2003c6(%rip) # 0x600924 <i> 0x40055e <main+34>: movl $0x3,0x2003bc(%rip) # 0x600924 <i> (gdb) PASS: gdb.base/consecutive-step-over.exp: get breakpoint addresses break *0x40054a Breakpoint 2 at 0x40054a: file ../../../src/gdb/testsuite/gdb.base/consecutive-step-over.c, line 23. (gdb) PASS: gdb.base/consecutive-step-over.exp: insn 1: set breakpoint condition $bpnum condition (gdb) PASS: gdb.base/consecutive-step-over.exp: insn 1: set condition break *0x400554 Breakpoint 3 at 0x400554: file ../../../src/gdb/testsuite/gdb.base/consecutive-step-over.c, line 24. (gdb) PASS: gdb.base/consecutive-step-over.exp: insn 2: set breakpoint condition $bpnum condition (gdb) PASS: gdb.base/consecutive-step-over.exp: insn 2: set condition break *0x40055e Breakpoint 4 at 0x40055e: file ../../../src/gdb/testsuite/gdb.base/consecutive-step-over.c, line 25. (gdb) PASS: gdb.base/consecutive-step-over.exp: insn 3: set breakpoint condition $bpnum condition (gdb) PASS: gdb.base/consecutive-step-over.exp: insn 3: set condition break 27 Breakpoint 5 at 0x400568: file ../../../src/gdb/testsuite/gdb.base/consecutive-step-over.c, line 27. (gdb) continue Continuing. ../../src/gdb/infrun.c:5200: internal-error: switch_back_to_stepped_thread: Assertion `!tp->control.trap_expected' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. FAIL: gdb.base/consecutive-step-over.exp: continue to breakpoint: break here (GDB internal error) The assertion fails, because the code is not expecting that the event thread itself might need another step over. IOW, not expecting that TP in: tp = find_thread_needs_step_over (stepping_thread != NULL, stepping_thread); could be the event thread. A small fix for this would be to clear the event thread's trap_expected earlier, before asserting. But looking deeper, although currently_stepping_or_nexting_callback's intention is finding the thread that is doing a step/next, it also returns the thread that is doing a step-over dance, with trap_expected set. If there ever was a reason for that (it was I who added currently_stepping_or_nexting_callback , but I can't recall why I put trap_expected there in the first place), the only remaining reason nowadays is to aid in implementing switch_back_to_stepped_thread's assertion that is now triggering, by piggybacking on the walk over all threads, thus avoiding a separate walk. This is quite obscure, and I think we can do even better, by merging the walks that look for the stepping thread, and the walk that looks for some thread that might need a step over. Tested on x86_64 Fedora 17, native and gdbserver, and also native on top of my "software single-step on x86_64" series. gdb/ 2014-04-22 Pedro Alves <palves@redhat.com> * infrun.c (schedlock_applies): New function, factored out from find_thread_needs_step_over. (find_thread_needs_step_over): Use it. (switch_back_to_stepped_thread): Always clear trap_expected if the step over is finished. Return early if scheduler locking applies. Look for the stepping thread and a potential step-over thread with a single loop. (currently_stepping_or_nexting_callback): Delete. 2014-04-22 Pedro Alves <palves@redhat.com> * gdb.base/consecutive-step-over.c: New file. * gdb.base/consecutive-step-over.exp: New file.
2014-04-22 16:00:56 +02:00
2014-04-22 Pedro Alves <palves@redhat.com>
* gdb.base/consecutive-step-over.c: New file.
* gdb.base/consecutive-step-over.exp: New file.
2014-04-22 Pedro Alves <palves@redhat.com>
* lib/gdb.exp (gdb_continue_to_breakpoint): Use gdb_test_multiple
instead of send_gdb/gdb_expect.
2014-04-22 Yao Qi <yao@codesourcery.com>
* lib/trace-support.exp (generate_tracefile): New procedure.
* gdb.trace/tfile.exp: Skip the test if generate_tracefile
return 0.
* gdb.trace/mi-traceframe-changed.exp: Invoke test_tfind_tfile
if generate_tracefile returns 1.
Fix PR backtrace/15558 This PR is about an assertion failure in GDB that can be triggered by setting "backtrace limit" to a value that causes GDB to stop unwinding after an inline frame. In this case, an assertion in inline_frame_this_id will trigger: /* We need a valid frame ID, so we need to be based on a valid frame. (...). */ gdb_assert (frame_id_p (*this_id)); Looking at the function: static void inline_frame_this_id (struct frame_info *this_frame, void **this_cache, struct frame_id *this_id) { struct symbol *func; /* In order to have a stable frame ID for a given inline function, we must get the stack / special addresses from the underlying real frame's this_id method. So we must call get_prev_frame. Because we are inlined into some function, there must be previous frames, so this is safe - as long as we're careful not to create any cycles. */ *this_id = get_frame_id (get_prev_frame (this_frame)); we see we're computing the frame id for the inline frame. If this is an inline frame, which is a virtual frame constructed based on debug info, on top of a real stack frame, we should _always_ be able to find where the frame was inlined into, as that ultimately just means peeling off the virtual frames on top of the real stack frame. If there ultimately was no prev (real) stack frame, then we wouldn't have been able to construct the inline frame either, by design. That's what the assertion catches. So we have an inline frame, we should _always_ be able to compute its ID, even if that means bypassing the user backtrace limits to get at the real stack frame's info. The problem is that inline_frame_id calls get_prev_frame, and that takes user backtrace limits into account. Code that wants to bypass the limits calls get_prev_frame_1 instead. Note how get_prev_frame_1 already skips all checks for inline frames: /* If we are unwinding from an inline frame, all of the below tests were already performed when we unwound from the next non-inline frame. We must skip them, since we can not get THIS_FRAME's ID until we have unwound all the way down to the previous non-inline frame. */ if (get_frame_type (this_frame) == INLINE_FRAME) return get_prev_frame_if_no_cycle (this_frame); And note how the related frame_unwind_caller_id function also uses get_prev_frame_1: struct frame_id frame_unwind_caller_id (struct frame_info *next_frame) { struct frame_info *this_frame; /* Use get_prev_frame_1, and not get_prev_frame. The latter will truncate the frame chain, leading to this function unintentionally returning a null_frame_id (e.g., when a caller requests the frame ID of "main()"s caller. */ next_frame = skip_artificial_frames (next_frame); this_frame = get_prev_frame_1 (next_frame); if (this_frame) return get_frame_id (skip_artificial_frames (this_frame)); else return null_frame_id; } get_prev_frame_1 is currently static in frame.c. As a _1 suffix is not a good name for an extern function, I've renamed it. Tested on x86-64 Fedora 17. gdb/ 2014-04-18 Pedro alves <palves@redhat.com> Tom Tromey <tromey@redhat.com> PR backtrace/15558 * frame.c (get_prev_frame_1): Rename to ... (get_prev_frame_always): ... this, and make extern. Adjust. (skip_artificial_frames): Use get_prev_frame_always. (frame_unwind_caller_id, frame_pop, get_prev_frame) (get_frame_unwind_stop_reason): Adjust to rename. * frame.h (get_prev_frame_always): Declare. * inline-frame.c: Include frame.h. (inline_frame_this_id): Use get_prev_frame_always. gdb/testsuite/ 2014-04-18 Tom Tromey <palves@redhat.com> Pedro alves <tromey@redhat.com> PR backtrace/15558 * gdb.opt/inline-bt.exp: Test backtracing from an inline function with a backtrace limit. * gdb.python/py-frame-inline.exp: Test running to an inline function with a backtrace limit, and printing the newest frame. * gdb.python/py-frame-inline.c (main): Call f.
2014-04-18 11:15:21 +02:00
2014-04-18 Tom Tromey <palves@redhat.com>
Pedro alves <tromey@redhat.com>
PR backtrace/15558
* gdb.opt/inline-bt.exp: Test backtracing from an inline function
with a backtrace limit.
* gdb.python/py-frame-inline.exp: Test running to an inline
function with a backtrace limit, and printing the newest frame.
* gdb.python/py-frame-inline.c (main): Call f.
2014-04-17 16:26:37 +02:00
2014-04-17 Marcus Shawcroft <marcus.shawcroft@arm.com>
* gdb.java/jnpe.exp: Drop srcdir from untested path.
2014-04-17 Marcus Shawcroft <marcus.shawcroft@arm.com>
* lib/gdb.exp (gdb_compile_pthreads, gdb_compile_objc):
Drop prefix from unsupported source file path.
[testsuite] Set target-charset to ascii Hi, We find gdb.base/printcmds.exp fails a lot on windows host, like this, p ctable1[163] $204 = 163 '£' (gdb) FAIL: gdb.base/printcmds.exp: p ctable1[163] however, on linux host, p ctable1[163] $205 = 163 '\243' (gdb) PASS: gdb.base/printcmds.exp: p ctable1[163] The printing related code is in valprint.c:print_wchar, if (gdb_iswprint (w) && (!need_escape || (!gdb_iswdigit (w) && w != LCST ('8') && w != LCST ('9')))) { gdb_wchar_t wchar = w; if (w == gdb_btowc (quoter) || w == LCST ('\\')) obstack_grow_wstr (output, LCST ("\\")); obstack_grow (output, &wchar, sizeof (gdb_wchar_t)); } else { // print W in hex or octal digits } When I debug gdb on different hosts, I find on windows host, gdb_iswprint (iswprint) returns true if 'w' is 163. However, on linux host, iswprint returns false if 'w' is 163. Looks this difference is caused by the charset. On Linux host, the target-charset is ANSI_X3.4-1968, while on windows host, the target-charset is CP1252. We can see how target-charset affects the output. On linux host, (gdb) set target-charset ASCII (gdb) p ctable1[163] $1 = 163 '\243' (gdb) set target-charset CP1252 (gdb) p ctable1[163] $2 = 163 '£' we can print the pound sign too, and it shows target-charset does affect the output. This patch is to set target-charset temporarily to ASCII for some charset-sensitive tests. Tested on arm-none-eabi and powerpc-linux-gnu on mingw32 host. More than one hundred fails are fixed. gdb/testsuite: 2014-04-17 Yao Qi <yao@codesourcery.com> * lib/gdb.exp (with_target_charset): New proc. * gdb.base/printcmds.exp (test_print_all_chars): Wrap tests with with_target_charset. (test_print_strings): Likewise. (test_repeat_bytes): Likewise. * gdb.base/setvar.exp: Set target-charset to ASCII temporarily for some tests.
2014-03-24 04:26:06 +01:00
2014-04-17 Yao Qi <yao@codesourcery.com>
* lib/gdb.exp (with_target_charset): New proc.
* gdb.base/printcmds.exp (test_print_all_chars): Wrap tests with
with_target_charset.
(test_print_strings): Likewise.
(test_repeat_bytes): Likewise.
* gdb.base/setvar.exp: Set target-charset to ASCII temporarily
for some tests.
2014-04-16 Keith Seitz <keiths@redhat.com>
PR gdb/15827
* gdb.dwarf2/corrupt.c: New file.
* gdb.dwarf2/corrupt.exp: New file.
2014-04-16 Keith Seitz <keiths@redhat.com>
PR c++/16597
* gdb.cp/namelessclass.cc: New file.
* gdb.cp/namelessclass.exp: New file.
* gdb.cp/namelessclass.S: New file.
2014-04-16 Doug Evans <dje@google.com>
* lib/gdbserver-support.exp (gdbserver_default_get_remote_address):
Add comment.
(gdbserver_default_get_comm_port): New function.
(gdbserver_start): Check if board file provided
"gdbserver,get_comm_port" and use it if so.
* boards/native-stdio-gdbserver.exp (sockethost): Set to "".
(gdb,socketport): Set to "stdio".
(gdbserver,get_comm_port): Set to ${board}_get_comm_port.
(stdio_gdbserver_template): Delete.
(${board}_get_remote_address): Update.
(${board}_build_remote_cmd): Delete.
(${board}_get_comm_port): New function.
(${board}_spawn): Update.
* boards/remote-stdio-gdbserver.exp (${board}_build_remote_cmd):
Delete.
(${board}_get_remote_address): Update.
(${board}_get_comm_port): New function.
2014-04-16 Andrew Burgess <aburgess@broadcom.com>
* gdb.base/memattr.exp: Improve regexps to handle memory regions
appearing in any order.
2014-04-15 Doug Evans <dje@google.com>
* gdb.gdb/selftest.exp (do_steps_and_nexts): Don't reference
uninitialized value of "description".
2014-04-15 Keith Seitz <keiths@redhat.com>
* gdb.mi/mi-simplerun.exp (test_breakpoints_creation_and_listing):
Remove unused globals.
(test_running_the_program): Likewise.
(test_controlled_execution): Likewise.
(test_controlling_breakpoints): Likewise.
(test_program_termination): Likewise.
2014-04-15 Keith Seitz <keiths@redhat.com>
* gdb.mi/mi-break.exp (test_tbreak_creation_and_listing): Remove
unused globals.
(test_rbreak_creation_and_listing): Likewise.
(test_ignore_count): Likewise.
(test_error): Likewise.
gdb.base/sym-file.exp, hide guts of the custom loader. This test uses a simple custom elf loader, implemented in gdb.base/sym-file-loader.h|c. This loader doesn't have a dlclose-like function today, but I'll need one. But, I found that the guts of the loader are exposed too much to the client, making the interface more complicated than necessary. It's simpler if the loader just exports a few dlopen/dlsym -style functions. That's what this patch does. Tested on x86_86 Fedora 17, native and gdbserver. gdb/testsuite/ 2014-04-15 Pedro Alves <palves@redhat.com> * gdb.base/sym-file-loader.h: Move inclusion of <inttypes.h>, <ansidecl.h>, <elf/common.h> and <elf/external.h> to sym-file-loader.c. (Elf_External_Phdr, Elf_External_Ehdr, Elf_External_Shdr) (Elf_External_Sym, Elf_Addr, GET, GETADDR, struct segment): Move to sym-file-loader.c. (struct library): Forward declare. (load_shlib, lookup_function): Change prototypes. (find_shstrtab, find_strtab, find_shdr, find_symtab) (translate_offset): Remove declarations. (get_text_addr): New declaration. * gdb.base/sym-file-loader.c: Move inclusion of <inttypes.h>, <ansidecl.h>, <elf/common.h> and <elf/external.h> here from sym-file-loader.h. (Elf_External_Phdr, Elf_External_Ehdr, Elf_External_Shdr) (Elf_External_Sym, Elf_Addr, GET, GETADDR, struct segment): Move here from sym-file-loader.h. (struct library): New structure. (load_shlib, lookup_function): Change prototypes and adjust to work with a struct library. (find_shstrtab, find_strtab, find_shdr, find_symtab) (translate_offset): Make static. (get_text_addr): New function. * gdb.base/sym-file-main.c (main): Adjust to new loader interface.
2014-04-15 15:02:34 +02:00
2014-04-15 Pedro Alves <palves@redhat.com>
* gdb.base/sym-file-loader.h: Move inclusion of <inttypes.h>,
<ansidecl.h>, <elf/common.h> and <elf/external.h> to
sym-file-loader.c.
(Elf_External_Phdr, Elf_External_Ehdr, Elf_External_Shdr)
(Elf_External_Sym, Elf_Addr, GET, GETADDR, struct segment): Move
to sym-file-loader.c.
(struct library): Forward declare.
(load_shlib, lookup_function): Change prototypes.
(find_shstrtab, find_strtab, find_shdr, find_symtab)
(translate_offset): Remove declarations.
(get_text_addr): New declaration.
* gdb.base/sym-file-loader.c: Move inclusion of <inttypes.h>,
<ansidecl.h>, <elf/common.h> and <elf/external.h> here from
sym-file-loader.h.
(Elf_External_Phdr, Elf_External_Ehdr, Elf_External_Shdr)
(Elf_External_Sym, Elf_Addr, GET, GETADDR, struct segment): Move
here from sym-file-loader.h.
(struct library): New structure.
(load_shlib, lookup_function): Change prototypes and adjust to
work with a struct library.
(find_shstrtab, find_strtab, find_shdr, find_symtab)
(translate_offset): Make static.
(get_text_addr): New function.
* gdb.base/sym-file-main.c (main): Adjust to new loader interface.
2014-04-15 Pedro Alves <palves@redhat.com>
* gdb.base/sym-file-loader.c: Fix typo. SELF_LINK, not SELK_LINK.
2014-04-15 Pedro Alves <palves@redhat.com>
* gdb.base/sym-file-loader.c: Include <limits.h>.
(SELF_LINK): New define.
(get_origin): New function.
(load_shlib): Use it.
* gdb.base/sym-file.exp: Don't early return if the target is
remote. Use runto_main, and issue fail is that fails. Use
gdb_load_shlibs.
(shlib_name): Delete.
(lib_so, lib_syms, lib_dlopen): New globals. Use them throughout.
2014-04-15 Pedro Alves <palves@redhat.com>
* gdb.base/sym-file.exp: Remove regex characters from test
message. Don't refer to breakpoint numbers in test messages.
Remove symbol_matches_domain. This fixes PR c++/16253. symbol_matches_domain was permitting searches for a VAR_DOMAIN symbol to also match STRUCT_DOMAIN symbols for languages like C++ where STRUCT_DOMAIN symbols also define a typedef of the same name, e.g., "struct foo {}" introduces a typedef of the name "foo". Problems occur if there exists both a VAR_DOMAIN and STRUCT_DOMAIN symbol of the same name. Then it is essentially a race between which symbol is found first. The other symbol is obscurred. [This is a relatively common idiom: enum e { ... } e;] This patchset moves this "language defines a typedef" logic to lookup_symbol[_in_language], looking first for a symbol in the given domain and falling back to searching STRUCT_DOMAIN when/if appropriate. 2014-04-14 Keith Seitz <keiths@redhat.com> PR c++/16253 * ada-lang.c (ada_symbol_matches_domain): Moved here and renamed from symbol_matches_domain in symtab.c. All local callers of symbol_matches_domain updated. (standard_lookup): If DOMAIN is VAR_DOMAIN and no symbol is found, search STRUCT_DOMAIN. (ada_find_any_type_symbol): Do not search STRUCT_DOMAIN independently. standard_lookup will do that automatically. * cp-namespace.c (cp_lookup_symbol_nonlocal): Explain when/why VAR_DOMAIN searches may return a STRUCT_DOMAIN match. (cp_lookup_symbol_in_namespace): Likewise. If no VAR_DOMAIN symbol is found, search STRUCT_DOMAIN. (cp_lookup_symbol_exports): Explain when/why VAR_DOMAIN searches may return a STRUCT_DOMAIN match. (lookup_symbol_file): Search for the class name in STRUCT_DOMAIN. * cp-support.c: Include language.h. (inspect_type): Explicitly search STRUCT_DOMAIN before searching VAR_DOMAIN. * psymtab.c (match_partial_symbol): Compare the requested domain with the symbol's domain directly. (lookup_partial_symbol): Likewise. * symtab.c (lookup_symbol_in_language): Explain when/why VAR_DOMAIN searches may return a STRUCT_DOMAIN match. If no VAR_DOMAIN symbol is found, search STRUCT_DOMAIN for appropriate languages. (symbol_matches_domain): Renamed `ada_symbol_matches_domain' and moved to ada-lang.c (lookup_block_symbol): Explain that this function only returns symbol matching the requested DOMAIN. Compare the requested domain with the symbol's domain directly. (iterate_over_symbols): Compare the requested domain with the symbol's domain directly. * symtab.h (symbol_matches_domain): Remove. 2014-04-14 Keith Seitz <keiths@redhat.com> PR c++/16253 * gdb.cp/var-tag.cc: New file. * gdb.cp/var-tag.exp: New file. * gdb.dwarf2/dw2-ada-ffffffff.exp: Set the language to C++. * gdb.dwarf2/dw2-anon-mptr.exp: Likewise. * gdb.dwarf2/dw2-double-set-die-type.exp: Likewise. * gdb.dwarf2/dw2-inheritance.exp: Likewise.
2014-04-15 00:47:15 +02:00
2014-04-14 Keith Seitz <keiths@redhat.com>
PR c++/16253
* gdb.cp/var-tag.cc: New file.
* gdb.cp/var-tag.exp: New file.
* gdb.dwarf2/dw2-ada-ffffffff.exp: Set the language to C++.
* gdb.dwarf2/dw2-anon-mptr.exp: Likewise.
* gdb.dwarf2/dw2-double-set-die-type.exp: Likewise.
* gdb.dwarf2/dw2-inheritance.exp: Likewise.
2014-04-14 Tom Tromey <tromey@redhat.com>
* gdb.cp/classes.exp (test_enums): Handle underlying type.
* gdb.dwarf2/enum-type.exp: Add test for enum with underlying
type.
* gdb.cp/enum-class.exp: New file.
* gdb.cp/enum-class.cc: New file.
2014-04-14 Tom Tromey <tromey@redhat.com>
* gdb.dwarf2/enum-type.exp: New file.
2014-04-14 Sanimir Agovic <sanimir.agovic@intel.com>
* gdb.mi/mi-vla-c99.exp: New file.
* gdb.mi/vla.c: New file.
2014-04-14 Sanimir Agovic <sanimir.agovic@intel.com>
* gdb.base/vla-datatypes.c: New file.
* gdb.base/vla-datatypes.exp: New file.
2014-04-14 Sanimir Agovic <sanimir.agovic@intel.com>
* gdb.base/vla-ptr.c: New file.
* gdb.base/vla-ptr.exp: New file.
2014-04-14 Sanimir Agovic <sanimir.agovic@intel.com>
* gdb.dwarf2/count.exp: New file.
2014-04-14 Sanimir Agovic <sanimir.agovic@intel.com>
* gdb.base/vla-sideeffect.c: New file.
* gdb.base/vla-sideeffect.exp: New file.
2014-04-14 David Blaikie <dblaikie@gmail.com>
* gdb.mi/non-stop.c: Add return value for non-void function return
statement.
* gdb.threads/staticthreads.c: Ditto.
2014-04-12 Siva Chandra Reddy <sivachandra@google.com>
Doug Evans <xdje42@gmail.com>
* gdb.guile/scm-value.c: Improve test case.
* gdb.guile/scm-value.exp: Add new test.
2014-04-11 David Blaikie <dblaikie@gmail.com>
* gdb.opt/inline-break.exp: Explicitly specify -std=gnu89 to
override Clang's default.
Revert the entire VLA series. This reverts the following patch series, as they cause some regresssions. commit 37c1ab67a35025d37d42c449deab5f254f9f59da type: add c99 variable length array support gdb/ * dwarf2loc.c (dwarf2_locexpr_baton_eval): New function. (dwarf2_evaluate_property): New function. * dwarf2loc.h (dwarf2_evaluate_property): New function prototype. * dwarf2read.c (attr_to_dynamic_prop): New function. (read_subrange_type): Use attr_to_dynamic_prop to read high bound attribute. * gdbtypes.c: Include dwarf2loc.h. (is_dynamic_type): New function. (resolve_dynamic_type): New function. (resolve_dynamic_bounds): New function. (get_type_length): New function. (check_typedef): Use get_type_length to compute type length. * gdbtypes.h (TYPE_HIGH_BOUND_KIND): New macro. (TYPE_LOW_BOUND_KIND): New macro. (is_dynamic_type): New function prototype. * value.c (value_from_contents_and_address): Call resolve_dynamic_type to resolve dynamic properties of the type. Update comment. * valops.c (get_value_at, value_at, value_at_lazy): Update comment. commit 26cb189f8b46dbe7b2d485525329a8919005ca8a vla: enable sizeof operator to work with variable length arrays gdb/ * eval.c (evaluate_subexp_for_sizeof) <OP_VAR_VALUE>: If the type passed to sizeof is dynamic evaluate the argument to compute the length. commit 04b19544ef6a97b62b2cc4a3170b900e046ab185 vla: enable sizeof operator for indirection gdb/ * eval.c (evaluate_subexp_for_sizeof) <UNOP_IND>: Create an indirect value and retrieve the dynamic type size. commit bcd629a44fff61527430f353cf77e20fe3afc395 vla: update type from newly created value gdb/ * ada-lang.c (ada_value_primitive_packed_val): Re-fetch type from value. (ada_template_to_fixed_record_type_1): Likewise. (ada_to_fixed_type_1): Likewise. * cp-valprint.c (cp_print_value_fields_rtti): Likewise. (cp_print_value): Likewise. * d-valprint.c (dynamic_array_type): Likewise. * eval.c (evaluate_subexp_with_coercion): Likewise. * findvar.c (address_of_variable): Likewise. * jv-valprint.c (java_value_print): Likewise. * valops.c (value_ind): Likewise. * value.c (coerce_ref): Likewise. commit b86138fb0484f42db6cb83abed1e3d0ad2ec4eac vla: print "variable length" for unresolved dynamic bounds gdb/ * c-typeprint.c (c_type_print_varspec_suffix): Added check for not yet resolved high bound. If unresolved, print "variable length" string to the console instead of random length. commit e1969afbd454c09c3aad1990305715f70bc47c3c vla: support for DW_AT_count gdb/ * dwarf2read.c (read_subrange_type): Convert DW_AT_count to a dynamic property and store it as the high bound and flag the range accordingly. * gdbtypes.c (resolve_dynamic_bounds): If range is flagged as RANGE_UPPER_BOUND_IS_COUNT assign low + high - 1 as the new high bound. * gdbtypes.h (enum range_flags): New enum. (struct range_bounds): Add flags member. commit 92b09522dc5a93ba4bda3c1c0b3c58264e357c8a vla: resolve dynamic bounds if value contents is a constant byte-sequence gdb/ * findvar.c (default_read_var_value): Resolve dynamic bounds if location points to a constant blob. commit 3bce82377f683870cc89925ff43aefb7dcce4a77 vla: evaluate operand of sizeof if its type is a vla gdb/ * eval.c (evaluate_subexp_for_sizeof): Add enum noside argument. (evaluate_subexp_standard): Pass noside argument. (evaluate_subexp_for_sizeof) <BINOP_SUBSCRIPT>: Handle subscript case if noside equals EVAL_NORMAL. If the subscript yields a vla type re-evaluate subscript operation with EVAL_NORMAL to enable sideffects. * gdbtypes.c (resolve_dynamic_bounds): Mark bound as evaluated. * gdbtypes.h (enum range_flags): Add RANGE_EVALUATED case. gdb/testsuite * gdb.base/vla-sideeffect.c: New file. * gdb.base/vla-sideeffect.exp: New file. commit 504f34326e5ae7c78ebfcdd6ed03c7403b42048b test: cover subranges with present DW_AT_count attribute gdb/testsuite/ * gdb.dwarf2/count.exp: New file. commit 1a237e0ee53bbdee97d72d794b5b42e774cc81c0 test: multi-dimensional c99 vla. gdb/testsuite/ * gdb.base/vla-multi.c: New file. * gdb.base/vla-multi.exp: New file. commit 024e13b46f9c33d151ae82fd9d64c53092fd9313 test: evaluate pointers to C99 vla correctly. gdb/testsuite/ * gdb.base/vla-ptr.c: New file. * gdb.base/vla-ptr.exp: New file. commit c8655f75e2f0fada311be193e3090087a77ec802 test: basic c99 vla tests for C primitives gdb/testsuite/ * gdb.base/vla-datatypes.c: New file. * gdb.base/vla-datatypes.exp: New file. commit 58a84dcf29b735ee776536b4c51ba90b51612b71 test: add mi vla test gdb/testsuite/ * gdb.mi/mi-vla-c99.exp: New file. * gdb.mi/vla.c: New file.
2014-04-11 23:47:15 +02:00
2014-04-11 Joel Brobecker <brobecker@adacore.com>
Revert the following changes (regressions):
* gdb.base/vla-sideeffect.c: New file.
* gdb.base/vla-sideeffect.exp: New file.
* gdb.dwarf2/count.exp: New file.
* gdb.base/vla-multi.c: New file.
* gdb.base/vla-multi.exp: New file.
* gdb.base/vla-ptr.c: New file.
* gdb.base/vla-ptr.exp: New file.
* gdb.base/vla-datatypes.c: New file.
* gdb.base/vla-datatypes.exp: New file.
* gdb.mi/mi-vla-c99.exp: New file.
* gdb.mi/vla.c: New file.
2014-04-11 Keith Seitz <keiths@redhat.com>
PR c++/16675
* gdb.cp/cpsizeof.exp: New file.
* gdb.cp/cpsizeof.cc: New file.
2014-04-11 Sanimir Agovic <sanimir.agovic@intel.com>
* gdb.mi/mi-vla-c99.exp: New file.
* gdb.mi/vla.c: New file.
2014-04-11 Sanimir Agovic <sanimir.agovic@intel.com>
* gdb.base/vla-datatypes.c: New file.
* gdb.base/vla-datatypes.exp: New file.
2014-04-11 Sanimir Agovic <sanimir.agovic@intel.com>
* gdb.base/vla-ptr.c: New file.
* gdb.base/vla-ptr.exp: New file.
2014-04-11 Sanimir Agovic <sanimir.agovic@intel.com>
* gdb.base/vla-multi.c: New file.
* gdb.base/vla-multi.exp: New file.
2014-04-11 Sanimir Agovic <sanimir.agovic@intel.com>
* gdb.dwarf2/count.exp: New file.
2014-04-11 Sanimir Agovic <sanimir.agovic@intel.com>
* gdb.base/vla-sideeffect.c: New file.
* gdb.base/vla-sideeffect.exp: New file.
2014-04-11 Yao Qi <yao@codesourcery.com>
* gdb.base/completion.exp: Check file exists before running tests
on file completion.
Conditional Z1 breakpoint hangs GDBserver. While trying to fix hbreak2.exp against GDBserver I noticed this... (gdb) hbreak main if 1 Sending packet: $m400580,40#2e...Packet received: e8d2ffffff5dc3554889e54883ec10c745fc00000000eb0eb800000000e8c1ffffff8345fc01817dfce70300007ee9b800000000c9c3662e0f1f840000000000 Sending packet: $m40058f,1#31...Packet received: c7 Hardware assisted breakpoint 1 at 0x40058f: file ../../../src/gdb/testsuite/gdb.base/break-idempotent.c, line 46. Sending packet: $Z1,40058f,1;X3,220127#9b... *hangs forever* The issue is that nothing advances the packet pointer if add_breakpoint_condition either fails to parse the agent expression, or fails to find the breakpoint, resulting in an infinite loop in process_point_options. The latter case should really be fixed by GDBserver tracking GDB Z1 breakpoints in its breakpoint structures like Z0 breakpoints are, but the latter case still needs handling. add_breakpoint_commands has the same issue, though at present I don't know any way to trigger it other than sending a manually cooked packet. Unbelievably, it doesn't look like we have any test that tries setting a conditional hardware breakpoint. Looking at cond-eval-mode.exp, it looks like the file was meant to actually test something, but it's mostly empty today. This patch adds tests that tries all sorts of conditional breakpoints and watchpoints. The test hangs/fails without the GDBserver fix. Tested on x86_64 Fedora 17. gdb/gdbserver/ 2014-04-10 Pedro Alves <palves@redhat.com> * mem-break.c (add_breakpoint_condition, add_breakpoint_commands): Check if the condition or command is NULL before checking if the breakpoint is known. On success, return true. * mem-break.h (add_breakpoint_condition): Document return. (add_breakpoint_commands): Add describing comment. * server.c (skip_to_semicolon): New function. (process_point_options): Use it. gdb/testsuite/ 2014-04-10 Pedro Alves <palves@redhat.com> * gdb.base/cond-eval-mode.c: New file. * gdb.base/cond-eval-mode.exp: Use standard_testfile. Adjust prepare_for_testing to build the new file. Check result of runto_main. (test_break, test_watch): New procedures. (top level): Use them.
2014-04-10 20:22:23 +02:00
2014-04-10 Pedro Alves <palves@redhat.com>
* gdb.base/cond-eval-mode.c: New file.
* gdb.base/cond-eval-mode.exp: Use standard_testfile. Adjust
prepare_for_testing to build the new file. Check result of
runto_main.
(test_break, test_watch): New procedures.
(top level): Use them.
2014-04-08 Pierre Muller <muller@sourceware.org>
* gdb.base/printcmds.exp (test_artificial_arrays): Disable
Ctrl-V use for mingw hosts.
2014-04-07 Siva Chandra Reddy <sivachandra@google.com>
* gdb.python/py-value.c: Improve test case.
* gdb.python/py-value.exp: Add new test.
2014-04-07 David Blaikie <dblaikie@gmail.com>
* lib/compiler.c: Identify the clang compiler.
* lib/compiler.cc: Ditto.
2014-04-03 Yao Qi <yao@codesourcery.com>
* gdb.base/setshow.exp: Invoke string_to_regexp to HOME and PWD.
2014-04-01 Anton Blanchard <anton@samba.org>
* gdb.arch/ppc64-atomic-inst.exp: Use untested. Make test
messages unique.
2014-04-01 Anton Blanchard <anton@samba.org>
* gdb.arch/ppc64-atomic-inst.exp: Use standard_testfile,
prepare_for_testing.
2014-04-01 Anton Blanchard <anton@samba.org>
* gdb.arch/ppc64-atomic-inst.c: Remove.
* gdb.arch/ppc64-atomic-inst.S: New file.
* gdb.arch/ppc64-atomic-inst.exp: Adapt for asm based testcase.
2014-03-31 Doug Evans <dje@google.com>
* gdb.base/print-symbol-loading-lib.c: New file.
* gdb.base/print-symbol-loading-main.c: New file.
* gdb.base/print-symbol-loading.exp: New file.
2014-03-31 Yao Qi <yao@codesourcery.com>
* gdb.base/source-dir.exp: Allow ';' as a directory separator.
[varobj] false type-changed status for reference to Ada array Given the following variable... BT : Bounded := New_Bounded (Low => 1, High => 3); ... where type Bounded is defined as a simple unconstrained array: type Bounded is array (Integer range <>) of Integer; Creating a varobj for that variable, and immediately asking for varobj updates, GDB says that our varobj changed types! (gdb) -var-create bt * bt ^done,name="bt",numchild="3",value="[3]",type="<ref> array (1 .. 3) of integer",has_more="0" (gdb) -var-update 1 * ^done,changelist=[{name="bt",value="[3]",in_scope="true",type_changed="true",new_type="<ref> array (1 .. 3) of integer",new_num_children="3",has_more="0"}] The expected output for the -var-update command is, in this case: (gdb) -var-update 1 * ^done,changelist=[] The problem occurs because the ada-varobj module does not handle references, and while the references gets stripped when the varobj gets created, it doesn't when computing varobj updates. More specifically, when creating the varobj, varobj_create creates a new value which is a reference to a TYPE_CODE_ARRAY. It then calls install_new_value which calls coerce_ref with the following comment: /* We are not interested in the address of references, and given that in C++ a reference is not rebindable, it cannot meaningfully change. So, get hold of the real value. */ if (value) value = coerce_ref (value); This leaves the varobj's type component still a ref, while the varobj's value is now our array, without the ref. This explains why the "value" field in the varobj indicates an array with 3 elements "[3]" while the "type" field shows a ref to an array. Generally speaking, most users have said that showing the ref was a useful piece of information, so this patch is not touching this part. Next, when the user issues the -var-update request, varobj_update calls value_of_root to compute the varobj's new value as well as determine whether the value's type has changed or not. What happens in a nutshell is that it calls value_of_root_1 (which re-evaluates the expression and returns the corresponding new value), finds that the new value is not NULL, and thus asks whether it has mutated: else if (varobj_value_has_mutated (var, value, value_type (value))) This then indirectly delegates the determination to the language-specific callback, which fails, because it does not handle references. This patch fixes the issue by adjusting varobj_value_has_mutated to expect references, and strip them when seen. This allows the various language-specific implementations to remain unaware of references. gdb/ChangeLog: * varobj.c (varobj_value_has_mutated): If NEW_VALUE is a reference, strip the reference layer before calling the lang_ops value_has_mutated callback. gdb/testsuite/ChangeLog: * gdb.ada/mi_dyn_arr: New testcase.
2014-03-20 15:43:08 +01:00
2014-03-28 Joel Brobecker <brobecker@adacore.com>
* gdb.ada/mi_dyn_arr: New testcase.
2014-03-27 Doug Evans <dje@google.com>
* gdb.dwarf2/dw2-abs-hi-pc.exp: Build tests with "nodebug".
2014-03-27 Yao Qi <yao@codesourcery.com>
* lib/gdb.exp (can_single_step_to_signal_handler): Return zero
if target is nios2-*-*.
2014-03-26 Yao Qi <yao@codesourcery.com>
* lib/gdb.exp (readline_is_used): New proc.
* gdb.base/completion.exp: Move tests on command complete up.
Skip the rest of tests if readline is not used.
* gdb.ada/complete.exp: Skp the test if readline is not
used.
* gdb.base/filesym.exp: Likewise.
* gdb.base/macscp.exp: Likewise.
* gdb.base/readline-ask.exp: Likewise.
* gdb.base/readline.exp: Likewise.
* gdb.python/py-cmd.exp: Likewise.
* gdb.trace/tfile.exp: Likewise.
2014-03-26 Yao Qi <yao@codesourcery.com>
* gdb.base/macscp.exp: Fix code format issues.
2014-03-25 Ulrich Weigand <uweigand@de.ibm.com>
* gdb.asm/asm-source.exp: Handle powerpc64le-* targets.
* gdb.asm/powerpc64le.inc: New file.
2014-03-25 Pedro Alves <palves@redhat.com>
Doug Evans <dje@google.com>
* gdb.base/source-execution.c: New file.
* gdb.base/source-execution.exp: New file.
* gdb.base/source-execution.gdb: New file.
2014-03-24 Doug Evans <dje@google.com>
* gdb.linespec/macro-relative.exp: Mark the test as unsupported if
using fission.
Fix PR breakpoints/16101: gdb.base/dprintf.exp agent-printf failures with non-Z0-supporting gdbservers After a previous patch that was committed by Pedro (0000e5cc), trying to set a dprintf with with a GDBserver that doesn't support agent commands at all now throws an error. But the dprintf tests still fail with some GDBserver targets because they doesn't try to handle the case of the server reporting support for breakpoint commands, but not be able to use those in combination with Z0 (because Z0 isn't actually supported, for example): FAIL: gdb.base/dprintf.exp: 1st dprintf, agent FAIL: gdb.base/dprintf.exp: 2nd dprintf, agent FAIL: gdb.base/dprintf.exp: dprintf info 2 (pattern 4) Similarly for the MI test. This patch makes the tests handle this scenario. Tested with native, and native gdbserver on x86_64 Fedora 17. Also tested with the native-gdbserver.exp board hacked with: set GDBFLAGS "${GDBFLAGS} -ex \"set remote breakpoint-commands off\"" (actually, "set remote breakpoint-commands off" is presently broken, so this was on top of a fix for that command.) which results in: (gdb) PASS: gdb.base/dprintf.exp: 2nd dprintf, gdb set dprintf-style agent warning: Target cannot run dprintf commands, falling back to GDB printf warning: Target cannot run dprintf commands, falling back to GDB printf (gdb) UNSUPPORTED: gdb.base/dprintf.exp: set dprintf style to agent gdb.sum: Running target native-gdbserver Running ../../../src/gdb/testsuite/gdb.base/dprintf.exp ... PASS: gdb.base/dprintf.exp: dprintf PASS: gdb.base/dprintf.exp: dprintf foo PASS: gdb.base/dprintf.exp: dprintf 29 PASS: gdb.base/dprintf.exp: dprintf foo,"At foo entry\n" PASS: gdb.base/dprintf.exp: ignore $bpnum 1 PASS: gdb.base/dprintf.exp: dprintf 26,"arg=%d, g=%d\n", arg, g PASS: gdb.base/dprintf.exp: dprintf info 1 PASS: gdb.base/dprintf.exp: break 27 PASS: gdb.base/dprintf.exp: 1st dprintf, gdb PASS: gdb.base/dprintf.exp: 2nd dprintf, gdb UNSUPPORTED: gdb.base/dprintf.exp: set dprintf style to agent PASS: gdb.base/dprintf.exp: Set dprintf style to an unrecognized type And also with the native-gdbserver.exp board hacked with: set GDBFLAGS "${GDBFLAGS} -ex \"set remote Z-packet off\"" which results in: (gdb) continue Continuing. Warning: Cannot insert breakpoint 3: Target doesn't support breakpoints that have target side commands. Cannot insert breakpoint 4: Target doesn't support breakpoints that have target side commands. (gdb) UNSUPPORTED: gdb.base/dprintf.exp: 1st dprintf, agent gdb.sum: Running target native-gdbserver Running ../../../src/gdb/testsuite/gdb.base/dprintf.exp ... PASS: gdb.base/dprintf.exp: dprintf PASS: gdb.base/dprintf.exp: dprintf foo PASS: gdb.base/dprintf.exp: dprintf 29 PASS: gdb.base/dprintf.exp: dprintf foo,"At foo entry\n" PASS: gdb.base/dprintf.exp: ignore $bpnum 1 PASS: gdb.base/dprintf.exp: dprintf 26,"arg=%d, g=%d\n", arg, g PASS: gdb.base/dprintf.exp: dprintf info 1 PASS: gdb.base/dprintf.exp: break 27 PASS: gdb.base/dprintf.exp: 1st dprintf, gdb PASS: gdb.base/dprintf.exp: 2nd dprintf, gdb PASS: gdb.base/dprintf.exp: set dprintf style to agent UNSUPPORTED: gdb.base/dprintf.exp: 1st dprintf, agent PASS: gdb.base/dprintf.exp: Set dprintf style to an unrecognized type (One of the new comments mentions breakpoint always-inserted mode. Actually testing with breakpoint always-inserted mode fails these dprintf tests, due to the way they are written. But that'll take a more substancial rewrite of the tests, so I'm leaving that for another day.) gdb/testsuite/ 2014-03-24 Hui Zhu <hui@codesourcery.com> Pedro Alves <palves@redhat.com> PR breakpoints/16101 * gdb.base/dprintf.exp: Use unsupported rather than changing the test pass/fail messages. Detect missing support for dprintf when breakpoints are actually inserted. * gdb.base/mi-dprintf.exp: Detect missing support for dprintf when breakpoints are actually inserted. * lib/mi-support.exp (mi_run_cmd_full): Return -1 if continue fails.
2014-03-24 20:30:50 +01:00
2014-03-24 Hui Zhu <hui@codesourcery.com>
Pedro Alves <palves@redhat.com>
PR breakpoints/16101
* gdb.base/dprintf.exp: Use unsupported rather than changing the
test pass/fail messages. Detect missing support for dprintf when
breakpoints are actually inserted.
* gdb.base/mi-dprintf.exp: Detect missing support for dprintf when
breakpoints are actually inserted.
* lib/mi-support.exp (mi_run_cmd_full): Return -1 if continue
fails.
2014-03-24 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/gdb-sigterm.exp (do_test): Remove "set debug lin-lwp 1".
2014-03-22 Doug Evans <xdje42@gmail.com>
* gdb.python/python.exp (python not supported): Verify multi-line
python command issues an error.
2014-03-22 07:59:04 +01:00
* gdb.guile/guile.exp (guile not supported): Verify multi-line
guile command issues an error.
gdb.threads/thread-specific.exp: Fix uninitialized variable references This fixes: FAIL: gdb.threads/thread-specific.exp: continue to thread-specific breakpoint (timeout) ERROR: tcl error sourcing .../gdb/testsuite/gdb.threads/thread-specific.exp. ERROR: can't read "this_breakpoint": no such variable while executing "gdb_test_multiple "info breakpoint $this_breakpoint" "info on bp" { -re ".*stop only in thread (\[0-9\]*).*$gdb_prompt $" { set this_thread $expe..." (file ".../gdb/testsuite/gdb.threads/thread-specific.exp" line 108) invoked from within "source .../gdb/testsuite/gdb.threads/thread-specific.exp" ("uplevel" body line 1) invoked from within "uplevel #0 source .../gdb/testsuite/gdb.threads/thread-specific.exp" invoked from within "catch "uplevel #0 source $test_file_name"" and then: FAIL: gdb.threads/thread-specific.exp: continue to thread-specific breakpoint (timeout) UNTESTED: gdb.threads/thread-specific.exp: info on bp ERROR: tcl error sourcing .../gdb/testsuite/gdb.threads/thread-specific.exp. ERROR: can't read "this_thread": no such variable while executing "gdb_test {print $_thread} ".* = $this_thread" "thread var at break"" (file ".../gdb/testsuite/gdb.threads/thread-specific.exp" line 119) invoked from within "source .../gdb/testsuite/gdb.threads/thread-specific.exp" ("uplevel" body line 1) invoked from within "uplevel #0 source .../gdb/testsuite/gdb.threads/thread-specific.exp" invoked from within "catch "uplevel #0 source $test_file_name"" Final results: FAIL: gdb.threads/thread-specific.exp: continue to thread-specific breakpoint (timeout) UNTESTED: gdb.threads/thread-specific.exp: info on bp UNTESTED: gdb.threads/thread-specific.exp: thread var at break Of course the first failure best wasn't there, but failing that the script shouldn't crash. * gdb.threads/thread-specific.exp: Handle the lack of usable $this_breakpoint and $this_thread.
2014-03-22 00:51:16 +01:00
2014-03-21 Maciej W. Rozycki <macro@codesourcery.com>
* gdb.threads/thread-specific.exp: Handle the lack of usable
$this_breakpoint and $this_thread.
2014-03-21 Hui Zhu <hui@codesourcery.com>
* gdb.base/attach.exp (do_command_attach_tests): New.
make dprintf.exp pass in target async mode When target-async is enabled, dprintf.exp fails: Running ../../../src/gdb/testsuite/gdb.base/dprintf.exp ... FAIL: gdb.base/dprintf.exp: 1st dprintf, call FAIL: gdb.base/dprintf.exp: 2nd dprintf, call FAIL: gdb.base/dprintf.exp: Set dprintf function FAIL: gdb.base/dprintf.exp: 1st dprintf, fprintf FAIL: gdb.base/dprintf.exp: 2nd dprintf, fprintf Breakpoint 2, main (argc=1, argv=0x7fffffffd3f8) at ../../../src/gdb/testsuite/gdb.base/dprintf.c:33 33 int loc = 1234; (gdb) continue Continuing. kickoff 1234 also to stderr 1234 At foo entry (gdb) FAIL: gdb.base/dprintf.exp: 1st dprintf, call The problem is that GDB gave the prompt back to the user too early. This happens when calling functions while handling an event that doesn't cause a user visible stop. dprintf with "set dprintf-style gdb" is one such case. This patch adds a test case that has a breakpoint with a condition that calls a function that returns false, so that regression testing isn't dependent on the implementation of dprintf. The problem happens because run_inferior_call causes GDB to forget that it is running in sync_execution mode, so any event that runs an inferior call causes fetch_inferior_event to display the prompt, even if the event should not result in a user visible stop (that is, gdb resumes the inferior and waits for the next event). This patch fixes the issue by noticing when GDB was in sync_execution mode in run_inferior_call, and taking care to restore this state afterward. gdb/ 2014-03-20 Tom Tromey <tromey@redhat.com> PR cli/15718 * infcall.c: Include event-top.h. (run_inferior_call): Call async_disable_stdin if needed. gdb/testsuite/ 2014-03-20 Tom Tromey <tromey@redhat.com> Pedro Alves <palves@redhat.com> PR cli/15718 * gdb.base/condbreak-call-false.c: New file. * gdb.base/condbreak-call-false.exp: New file.
2014-03-20 18:03:43 +01:00
2014-03-20 Tom Tromey <tromey@redhat.com>
Pedro Alves <palves@redhat.com>
PR cli/15718
* gdb.base/condbreak-call-false.c: New file.
* gdb.base/condbreak-call-false.exp: New file.
2014-03-20 Pedro Alves <palves@redhat.com>
* gdb.threads/signal-while-stepping-over-bp-other-thread.c (pid):
Delete.
(block_signals, unblock_signals): Delete.
(child_function_2, main): Remove references to deleted variable
and functions.
2014-03-20 Pedro Alves <palves@redhat.com>
* gdb.threads/signal-while-stepping-over-bp-other-thread.c (main):
Use pthread_kill to signal thread 2.
* gdb.threads/signal-while-stepping-over-bp-other-thread.exp:
Adjust to make the test send itself a signal rather than using the
host's "kill" command.
Handle multiple step-overs. This test fails with current mainline. If the program stopped for a breakpoint in thread 1, and then the user switches to thread 2, and resumes the program, GDB first switches back to thread 1 to step it over the breakpoint, in order to make progress. However, that logic only considers the last reported event, assuming only one thread needs that stepping over dance. That's actually not true when we play with scheduler-locking. The patch adds an example to the testsuite of multiple threads needing a step-over before the stepping thread can be resumed. With current mainline, the program re-traps the same breakpoint it had already trapped before. E.g.: Breakpoint 2, main () at ../../../src/gdb/testsuite/gdb.threads/multiple-step-overs.c:99 99 wait_threads (); /* set wait-threads breakpoint here */ (gdb) PASS: gdb.threads/multiple-step-overs.exp: step: continue to breakpoint: run to breakpoint info threads Id Target Id Frame 3 Thread 0x7ffff77c9700 (LWP 4310) "multiple-step-o" 0x00000000004007ca in child_function_3 (arg=0x1) at ../../../src/gdb/testsuite/gdb.threads/multiple-step-overs.c:43 2 Thread 0x7ffff7fca700 (LWP 4309) "multiple-step-o" 0x0000000000400827 in child_function_2 (arg=0x0) at ../../../src/gdb/testsuite/gdb.threads/multiple-step-overs.c:60 * 1 Thread 0x7ffff7fcb740 (LWP 4305) "multiple-step-o" main () at ../../../src/gdb/testsuite/gdb.threads/multiple-step-overs.c:99 (gdb) PASS: gdb.threads/multiple-step-overs.exp: step: info threads shows all threads set scheduler-locking on (gdb) PASS: gdb.threads/multiple-step-overs.exp: step: set scheduler-locking on break 44 Breakpoint 3 at 0x4007d3: file ../../../src/gdb/testsuite/gdb.threads/multiple-step-overs.c, line 44. (gdb) break 61 Breakpoint 4 at 0x40082d: file ../../../src/gdb/testsuite/gdb.threads/multiple-step-overs.c, line 61. (gdb) thread 3 [Switching to thread 3 (Thread 0x7ffff77c9700 (LWP 4310))] #0 0x00000000004007ca in child_function_3 (arg=0x1) at ../../../src/gdb/testsuite/gdb.threads/multiple-step-overs.c:43 43 (*myp) ++; (gdb) PASS: gdb.threads/multiple-step-overs.exp: step: thread 3 continue Continuing. Breakpoint 3, child_function_3 (arg=0x1) at ../../../src/gdb/testsuite/gdb.threads/multiple-step-overs.c:44 44 callme (); /* set breakpoint thread 3 here */ (gdb) PASS: gdb.threads/multiple-step-overs.exp: step: continue to breakpoint: run to breakpoint in thread 3 p *myp = 0 $1 = 0 (gdb) PASS: gdb.threads/multiple-step-overs.exp: step: unbreak loop in thread 3 thread 2 [Switching to thread 2 (Thread 0x7ffff7fca700 (LWP 4309))] #0 0x0000000000400827 in child_function_2 (arg=0x0) at ../../../src/gdb/testsuite/gdb.threads/multiple-step-overs.c:60 60 (*myp) ++; (gdb) PASS: gdb.threads/multiple-step-overs.exp: step: thread 2 continue Continuing. Breakpoint 4, child_function_2 (arg=0x0) at ../../../src/gdb/testsuite/gdb.threads/multiple-step-overs.c:61 61 callme (); /* set breakpoint thread 2 here */ (gdb) PASS: gdb.threads/multiple-step-overs.exp: step: continue to breakpoint: run to breakpoint in thread 2 p *myp = 0 $2 = 0 (gdb) PASS: gdb.threads/multiple-step-overs.exp: step: unbreak loop in thread 2 thread 1 [Switching to thread 1 (Thread 0x7ffff7fcb740 (LWP 4305))] #0 main () at ../../../src/gdb/testsuite/gdb.threads/multiple-step-overs.c:99 99 wait_threads (); /* set wait-threads breakpoint here */ (gdb) PASS: gdb.threads/multiple-step-overs.exp: step: thread 1 set scheduler-locking off (gdb) PASS: gdb.threads/multiple-step-overs.exp: step: set scheduler-locking off At this point all thread are stopped for a breakpoint that needs stepping over. (gdb) step Breakpoint 2, main () at ../../../src/gdb/testsuite/gdb.threads/multiple-step-overs.c:99 99 wait_threads (); /* set wait-threads breakpoint here */ (gdb) FAIL: gdb.threads/multiple-step-overs.exp: step But that "step" retriggers the same breakpoint instead of making progress. The patch teaches GDB to step over all breakpoints of all threads before resuming the stepping thread. Tested on x86_64 Fedora 17, against pristine mainline, and also my branch that implements software single-stepping on x86. gdb/ 2014-03-20 Pedro Alves <palves@redhat.com> * infrun.c (prepare_to_proceed): Delete. (thread_still_needs_step_over): New function. (find_thread_needs_step_over): New function. (proceed): If the current thread needs a step-over, set its steping_over_breakpoint flag. Adjust to use find_thread_needs_step_over instead of prepare_to_proceed. (process_event_stop_test): For BPSTAT_WHAT_STOP_NOISY and BPSTAT_WHAT_STOP_SILENT, assume the thread stopped for a breakpoint. (switch_back_to_stepped_thread): Step over breakpoints of all threads not the stepping thread, before switching back to the stepping thread. gdb/testsuite/ 2014-03-20 Pedro Alves <palves@redhat.com> * gdb.threads/multiple-step-overs.c: New file. * gdb.threads/multiple-step-overs.exp: New file. * gdb.threads/signal-while-stepping-over-bp-other-thread.exp: Adjust expected infrun debug output.
2014-03-20 14:26:32 +01:00
2014-03-20 Pedro Alves <palves@redhat.com>
* gdb.threads/multiple-step-overs.c: New file.
* gdb.threads/multiple-step-overs.exp: New file.
* gdb.threads/signal-while-stepping-over-bp-other-thread.exp:
Adjust expected infrun debug output.
Fix for even more missed events; eliminate thread-hop code. Even with deferred_step_ptid out of the way, GDB can still lose watchpoints. If a watchpoint triggers and the PC points to an address where a thread-specific breakpoint for another thread is set, the thread-hop code triggers, and we lose the watchpoint: if (ecs->event_thread->suspend.stop_signal == GDB_SIGNAL_TRAP) { int thread_hop_needed = 0; struct address_space *aspace = get_regcache_aspace (get_thread_regcache (ecs->ptid)); /* Check if a regular breakpoint has been hit before checking for a potential single step breakpoint. Otherwise, GDB will not see this breakpoint hit when stepping onto breakpoints. */ if (regular_breakpoint_inserted_here_p (aspace, stop_pc)) { if (!breakpoint_thread_match (aspace, stop_pc, ecs->ptid)) thread_hop_needed = 1; ^^^^^^^^^^^^^^^^^^^^^ } And on software single-step targets, even without a thread-specific breakpoint in the way, here in the thread-hop code: else if (singlestep_breakpoints_inserted_p) { ... if (!ptid_equal (singlestep_ptid, ecs->ptid) && in_thread_list (singlestep_ptid)) { /* If the PC of the thread we were trying to single-step has changed, discard this event (which we were going to ignore anyway), and pretend we saw that thread trap. This prevents us continuously moving the single-step breakpoint forward, one instruction at a time. If the PC has changed, then the thread we were trying to single-step has trapped or been signalled, but the event has not been reported to GDB yet. There might be some cases where this loses signal information, if a signal has arrived at exactly the same time that the PC changed, but this is the best we can do with the information available. Perhaps we should arrange to report all events for all threads when they stop, or to re-poll the remote looking for this particular thread (i.e. temporarily enable schedlock). */ CORE_ADDR new_singlestep_pc = regcache_read_pc (get_thread_regcache (singlestep_ptid)); if (new_singlestep_pc != singlestep_pc) { enum gdb_signal stop_signal; if (debug_infrun) fprintf_unfiltered (gdb_stdlog, "infrun: unexpected thread," " but expected thread advanced also\n"); /* The current context still belongs to singlestep_ptid. Don't swap here, since that's the context we want to use. Just fudge our state and continue. */ stop_signal = ecs->event_thread->suspend.stop_signal; ecs->event_thread->suspend.stop_signal = GDB_SIGNAL_0; ecs->ptid = singlestep_ptid; ecs->event_thread = find_thread_ptid (ecs->ptid); ecs->event_thread->suspend.stop_signal = stop_signal; stop_pc = new_singlestep_pc; } else { if (debug_infrun) fprintf_unfiltered (gdb_stdlog, "infrun: unexpected thread\n"); thread_hop_needed = 1; stepping_past_singlestep_breakpoint = 1; saved_singlestep_ptid = singlestep_ptid; } } } we either end up with thread_hop_needed, ignoring the watchpoint SIGTRAP, or switch to the stepping thread, again ignoring that the SIGTRAP could be for some other event. The new test added by this patch exercises both paths. So the fix is similar to the deferred_step_ptid fix -- defer the thread hop to _after_ the SIGTRAP had a change of passing through the regular bpstat handling. If the wrong thread hits a breakpoint, we'll just end up with BPSTAT_WHAT_SINGLE, and if nothing causes a stop, keep_going starts a step-over. Most of the stepping_past_singlestep_breakpoint mechanism is really not necessary -- setting the thread to step over a breakpoint with thread->trap_expected is sufficient to keep all other threads locked. It's best to still keep the flag in some form though, because when we get to keep_going, the software single-step breakpoint we need to step over is already gone -- an optimization done by a follow up patch will check whether a step-over is still be necessary by looking to see whether the breakpoint is still there, and would find the thread no longer needs a step-over, while we still want it. Special care is still needed to handle the case of PC of the thread we were trying to single-step having changed, like in the old code. We can't just keep_going and re-step it, as in that case we can over-step the thread (if it was already done with the step, but hasn't reported it yet, we'd ask it to step even further). That's now handled in switch_back_to_stepped_thread. As bonus, we're now using a technique that doesn't lose signals, unlike the old code -- we now insert a breakpoint at PC, and resume, which either reports the breakpoint immediately, or any pending signal. Tested on x86_64 Fedora 17, against pristine mainline, and against a branch that implements software single-step on x86. gdb/ 2014-03-20 Pedro Alves <palves@redhat.com> * breakpoint.c (single_step_breakpoint_inserted_here_p): Make extern. * breakpoint.h (single_step_breakpoint_inserted_here_p): Declare. * infrun.c (saved_singlestep_ptid) (stepping_past_singlestep_breakpoint): Delete. (resume): Remove stepping_past_singlestep_breakpoint handling. (proceed): Store the prev_pc of the stepping thread too. (init_wait_for_inferior): Adjust. Clear singlestep_ptid and singlestep_pc. (enum infwait_states): Delete infwait_thread_hop_state. (struct execution_control_state) <hit_singlestep_breakpoint>: New field. (handle_inferior_event): Adjust. (handle_signal_stop): Delete stepping_past_singlestep_breakpoint handling and the thread-hop code. Before removing single-step breakpoints, check whether the thread hit a single-step breakpoint of another thread. If it did, the trap is not a random signal. (switch_back_to_stepped_thread): If the event thread hit a single-step breakpoint, unblock it before switching to the stepping thread. Handle the case of the stepped thread having advanced already. (keep_going): Handle the case of the current thread moving past a single-step breakpoint. gdb/testsuite/ 2014-03-20 Pedro Alves <palves@redhat.com> * gdb.threads/step-over-trips-on-watchpoint.c: New file. * gdb.threads/step-over-trips-on-watchpoint.exp: New file.
2014-03-20 14:26:32 +01:00
2014-03-20 Pedro Alves <palves@redhat.com>
* gdb.threads/step-over-trips-on-watchpoint.c: New file.
* gdb.threads/step-over-trips-on-watchpoint.exp: New file.
PR breakpoints/7143 - Watchpoint does not trigger when first set Say the program is stopped at a breakpoint, and the user sets a watchpoint. When the program is next resumed, GDB will first step over the breakpoint, as explained in the manual: @value {GDBN} normally ignores breakpoints when it resumes execution, until at least one instruction has been executed. If it it did not do this, you would be unable to proceed past a breakpoint without first disabling the breakpoint. This rule applies whether or not the breakpoint already existed when your program stopped. However, GDB currently also removes watchpoints, catchpoints, etc., and that means that the first instruction off the breakpoint does not trigger the watchpoint, catchpoint, etc. testsuite/gdb.base/watchpoint.exp has a kfail for this. The PR proposes installing watchpoints only when stepping over a breakpoint, but that misses catchpoints, etc. A better fix would instead work from the opposite direction -- remove only real breakpoints, leaving all other kinds of breakpoints inserted. But, going further, it's really a waste to constantly remove/insert all breakpoints when stepping over a single breakpoint (generating a pair of RSP z/Z packets for each breakpoint), so the fix goes a step further and makes GDB remove _only_ the breakpoint being stepped over, leaving all others installed. This then has the added benefit of reducing breakpoint-related RSP traffic substancialy when there are many breakpoints set. gdb/ 2014-03-20 Pedro Alves <palves@redhat.com> PR breakpoints/7143 * breakpoint.c (should_be_inserted): Don't insert breakpoints that are being stepped over. (breakpoint_address_match): Make extern. * breakpoint.h (breakpoint_address_match): New declaration. * inferior.h (stepping_past_instruction_at): New declaration. * infrun.c (struct step_over_info): New type. (step_over_info): New global. (set_step_over_info, clear_step_over_info) (stepping_past_instruction_at): New functions. (handle_inferior_event): Clear the step-over info when trap_expected is cleared. (resume): Remove now stale comment. (clear_proceed_status): Clear step-over info. (proceed): Adjust step-over handling to set or clear the step-over info instead of removing all breakpoints. (handle_signal_stop): When setting up a thread-hop, don't remove breakpoints here. (stop_stepping): Clear step-over info. (keep_going): Adjust step-over handling to set or clear step-over info and then always inserting breakpoints, instead of removing all breakpoints when stepping over one. gdb/testsuite/ 2014-03-20 Pedro Alves <palves@redhat.com> PR breakpoints/7143 * gdb.base/watchpoint.exp: Mention bugzilla bug number instead of old gnats gdb/38. Remove kfail. Adjust to use gdb_test instead of gdb_test_multiple. * gdb.cp/annota2.exp: Remove kfail for gdb/38. * gdb.cp/annota3.exp: Remove kfail for gdb/38.
2014-03-20 14:26:32 +01:00
2014-03-20 Pedro Alves <palves@redhat.com>
PR breakpoints/7143
* gdb.base/watchpoint.exp: Mention bugzilla bug number instead of
old gnats gdb/38. Remove kfail. Adjust to use gdb_test instead
of gdb_test_multiple.
* gdb.cp/annota2.exp: Remove kfail for gdb/38.
* gdb.cp/annota3.exp: Remove kfail for gdb/38.
Fix missing breakpoint/watchpoint hits, eliminate deferred_step_ptid. Consider the case of the user doing "step" in thread 2, while thread 1 had previously stopped for a breakpoint. In order to make progress, GDB makes thread 1 step over its breakpoint first (with all other threads stopped), and once that is over, thread 2 then starts stepping (with thread 1 and all others running free, by default). If GDB didn't do that, thread 1 would just trip on the same breakpoint immediately again. This is what the prepare_to_proceed / deferred_step_ptid code is all about. However, deferred_step_ptid code resumes the target with: resume (1, GDB_SIGNAL_0); prepare_to_wait (ecs); return; Recall we were just stepping over a breakpoint when we get here. That means that _nothing_ had installed breakpoints yet! If there's another breakpoint just after the breakpoint that was just stepped, we'll miss it. The fix for that would be to use keep_going instead. However, there are more problems. What if the instruction that was just single-stepped triggers a watchpoint? Currently, GDB just happily resumes the thread, losing that too... Missed watchpoints will need yet further fixes, but we should keep those in mind. So the fix must be to let the trap fall through the regular bpstat handling, and only if no breakpoint, watchpoint, etc. claims the trap, shall we switch back to the stepped thread. Now, nowadays, we have code at the tail end of trap handling that does exactly that -- switch back to the stepped thread (switch_back_to_the_stepped_thread). So the deferred_step_ptid code is just standing in the way, and can simply be eliminated, fixing bugs in the process. Sweet. The comment about spurious "Switching to ..." made me pause, but is actually stale nowadays. That isn't needed anymore. previous_inferior_ptid used to be re-set at each (internal) event, but now it's only touched in proceed and normal stop. The two tests added by this patch fail without the fix. Tested on x86_64 Fedora 17 (also against my software single-stepping on x86 branch). gdb/ 2014-03-20 Pedro Alves <palves@redhat.com> * infrun.c (previous_inferior_ptid): Adjust comment. (deferred_step_ptid): Delete. (infrun_thread_ptid_changed, prepare_to_proceed) (init_wait_for_inferior): Adjust. (handle_signal_stop): Delete deferred_step_ptid handling. gdb/testsuite/ 2014-03-20 Pedro Alves <palves@redhat.com> * gdb.threads/step-over-lands-on-breakpoint.c: New file. * gdb.threads/step-over-lands-on-breakpoint.exp: New file.
2014-03-20 14:26:31 +01:00
2014-03-20 Pedro Alves <palves@redhat.com>
* gdb.threads/step-over-lands-on-breakpoint.c: New file.
* gdb.threads/step-over-lands-on-breakpoint.exp: New file.
2014-03-19 Pedro Alves <palves@redhat.com>
* gdb.base/async.exp: Remove early return.
2014-03-19 Pedro Alves <palves@redhat.com>
* gdb.base/async.exp (step& tests): Pass explicit test messages.
2014-03-19 Pedro Alves <palves@redhat.com>
* gdb.base/async.exp (test_background): Expect \r\n after
"completed." in the fail pattern.
2014-03-19 Pedro Alves <palves@redhat.com>
* gdb.base/async.exp (test_background): New procedure.
Use it for all background execution command tests.
2014-03-19 Pedro Alves <palves@redhat.com>
* gdb.base/async.exp: Use prepare_for_testing.
2014-03-19 Pedro Alves <palves@redhat.com>
* gdb.base/async.c (foo): Make 'x' volatile. Write to it twice in
the same line.
2014-03-19 Pedro Alves <palves@redhat.com>
* gdb.base/async.c (main): Add "jump here" and "until here" line
marker comments.
* gdb.base/async.exp (jump_here): New global.
(jump& test): Use it.
(until_here): New global.
(until& test): Use it.
2014-03-19 Pedro Alves <palves@redhat.com>
* gdb.base/async.exp: Don't frob gdb_protocol.
2014-03-18 Doug Evans <xdje42@gmail.com>
* gdb.base/async.exp: Whitespace fixes. Turn on target-async.
Fix spelling of exec-done-display.
2014-03-18 Jan Kratochvil <jan.kratochvil@redhat.com>
PR gdb/15358
* gdb.base/gdb-sigterm.c: New file.
* gdb.base/gdb-sigterm.exp: New file.
PR gdb/13860: make "-exec-foo"'s MI output equal to "foo"'s MI output. Part of PR gdb/13860 is about the mi-solib.exp test's output being different in sync vs async modes. sync: >./gdb -nx -q ./testsuite/gdb.mi/solib-main -ex "set stop-on-solib-events 1" -ex "set target-async off" -i=mi =thread-group-added,id="i1" ~"Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/solib-main..." ~"done.\n" (gdb) &"start\n" ~"Temporary breakpoint 1 at 0x400608: file ../../../src/gdb/testsuite/gdb.mi/solib-main.c, line 21.\n" =breakpoint-created,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0x0000000000400608",func="main",file="../../../src/gdb/testsuite/gdb.mi/solib-main.c",fullname="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.mi/solib-main.c",line="21",times="0",original-location="main"} ~"Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/solib-main \n" =thread-group-started,id="i1",pid="17724" =thread-created,id="1",group-id="i1" ^running *running,thread-id="all" (gdb) =library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1" ~"Stopped due to shared library event (no libraries added or removed)\n" *stopped,reason="solib-event",frame={addr="0x000000379180f990",func="_dl_debug_state",args=[],from="/lib64/ld-linux-x86-64.so.2"},thread-id="1",stopped-threads="all",core="3" (gdb) async: >./gdb -nx -q ./testsuite/gdb.mi/solib-main -ex "set stop-on-solib-events 1" -ex "set target-async on" -i=mi =thread-group-added,id="i1" ~"Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/solib-main..." ~"done.\n" (gdb) start &"start\n" ~"Temporary breakpoint 1 at 0x400608: file ../../../src/gdb/testsuite/gdb.mi/solib-main.c, line 21.\n" =breakpoint-created,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0x0000000000400608",func="main",file="../../../src/gdb/testsuite/gdb.mi/solib-main.c",fullname="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.mi/solib-main.c",line="21",times="0",original-location="main"} ~"Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/solib-main \n" =thread-group-started,id="i1",pid="17729" =thread-created,id="1",group-id="i1" ^running *running,thread-id="all" =library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1" (gdb) *stopped,reason="solib-event",thread-id="1",stopped-threads="all",core="1" For now, let's focus only on the *stopped event. We see that the async output is missing frame info. And this causes a test failure in async mode, as "mi_expect_stop solib-event" wants to see the frame info. However, if we compare the event output when a real MI execution command is used, compared to a CLI command (e.g., run vs -exec-run, next vs -exec-next, etc.), we see: >./gdb -nx -q ./testsuite/gdb.mi/solib-main -ex "set stop-on-solib-events 1" -ex "set target-async off" -i=mi =thread-group-added,id="i1" ~"Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/solib-main..." ~"done.\n" (gdb) r &"r\n" ~"Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/solib-main \n" =thread-group-started,id="i1",pid="17751" =thread-created,id="1",group-id="i1" ^running *running,thread-id="all" (gdb) =library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1" ~"Stopped due to shared library event (no libraries added or removed)\n" *stopped,reason="solib-event",frame={addr="0x000000379180f990",func="_dl_debug_state",args=[],from="/lib64/ld-linux-x86-64.so.2"},thread-id="1",stopped-threads="all",core="3" (gdb) -exec-run =thread-exited,id="1",group-id="i1" =thread-group-exited,id="i1" =library-unloaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",thread-group="i1" =thread-group-started,id="i1",pid="17754" =thread-created,id="1",group-id="i1" ^running *running,thread-id="all" (gdb) =library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1" *stopped,reason="solib-event",thread-id="1",stopped-threads="all",core="1" =thread-selected,id="1" (gdb) As seen above, with MI commands, the *stopped event _doesn't_ have frame info. This is because normal_stop, as commanded by the result of bpstat_print, skips printing frame info in this case (it's an "event", not a "breakpoint"), and when the interpreter is MI, mi_on_normal_stop skips calling print_stack_frame, as the normal_stop call was already done with the MI uiout. This explains why the async output is different even with a CLI command. Its because in async mode, the mi_on_normal_stop path is always taken; it is always reached with the MI uiout, because the stop is handled from the event loop, instead of from within `proceed -> wait_for_inferior -> normal_stop' with the interpreter overridden, as in sync mode. This patch fixes the issue by making all cases output the same *stopped event, by factoring out the print code from normal_stop, and using it from mi_on_normal_stop as well. I chose the *stopped output without a frame, mainly because that is what you already get if you use MI execution commands, the commands frontends are supposed to use (except when implementing a console). This patch makes it simpler to tweak the MI output differently if desired, as we only have to change the centralized print_stop_event (taking into account whether the uiout is MI-like), and all different modes will change accordingly. Tested on x86_64 Fedora 17, no regressions. The mi-solib.exp test no longer fails in async mode with this patch, so the patch removes the kfail. 2014-03-18 Pedro Alves <palves@redhat.com> PR gdb/13860 * inferior.h (print_stop_event): Declare. * infrun.c (print_stop_event): New, factored out from ... (normal_stop): ... this. * mi/mi-interp.c (mi_on_normal_stop): Use print_stop_event instead of bpstat_print/print_stack_frame. 2014-03-18 Pedro Alves <palves@redhat.com> PR gdb/13860 * gdb.mi/mi-solib.exp: Remove gdb/13860 kfail. * lib/mi-support.exp (mi_expect_stop): Add special handling for solib-event.
2014-03-18 18:50:28 +01:00
2014-03-18 Pedro Alves <palves@redhat.com>
PR gdb/13860
* gdb.mi/mi-solib.exp: Remove gdb/13860 kfail.
* lib/mi-support.exp (mi_expect_stop): Add special handling for
solib-event.
2014-03-17 Joel Brobecker <brobecker@adacore.com>
* gdb.ada/pckd_arr_ren: New testcase.
2014-03-13 Doug Evans <xdje42@gmail.com>
PR guile/16612
* gdb.guile/scm-value.ep (test_value_after_death): Do a garbage
collect after discarding symbols.
2014-03-13 Ludovic Courtès <ludo@gnu.org>
Doug Evans <xdje42@gmail.com>
* gdb.guile/scm-value.exp (test_value_in_inferior): Verify value added
to history survives a gc.
2014-03-13 Pedro Alves <palves@redhat.com>
* gdb.base/default.exp: Don't test "target procfs".
Don't mention "Unix" in native target name. I find the mention of "Unix" unnecessary (and really slightly a lie) on GNU/Linux in a couple of places: (gdb) maint print target-stack The current target stack is: - multi-thread (multi-threaded child process.) - child (Unix child process) - exec (Local exec file) - None (None) (gdb) help target child Unix child process (started by the "run" command). (gdb) target child Use the "run" command to start a Unix child process. It's also odd that e.g., the Windows port says "Unix" in reaction to "target child" (it was already that way before Windows used inf-child.c): (gdb) target child Use the "run" command to start a Unix child process. (gdb) So drop "Unix", going in the direction of saying mostly the same on all native targets: (gdb) maint print target-stack The current target stack is: - multi-thread (multi-threaded child process.) - - child (Unix child process) + - child (Child process) - exec (Local exec file) - None (None) (gdb) help target child - Unix child process (started by the "run" command). + Child process (started by the "run" command). (gdb) target child -Use the "run" command to start a Unix child process. +Use the "run" command to start a child process. gdb/ 2014-03-13 Pedro Alves <palves@redhat.com> * inf-child.c (inf_child_open, inf_child_target): Don't mention Unix in user visible strings. gdb/testsuite/ 2014-03-13 Pedro Alves <palves@redhat.com> * gdb.base/default.exp: Update "target child" and "target procfs" tests to not expect "Unix".
2014-03-13 13:02:24 +01:00
2014-03-13 Pedro Alves <palves@redhat.com>
* gdb.base/default.exp: Update "target child" and "target procfs"
tests to not expect "Unix".
fix regressions with target-async A patch in the target cleanup series caused a regression when using record with target-async. Version 4 of the patch is here: https://sourceware.org/ml/gdb-patches/2014-03/msg00159.html The immediate problem is that record supplies to_can_async_p and to_is_async_p methods, but does not supply a to_async method. So, when target-async is set, record claims to support async -- but if the underlying target does not support async, then the to_async method call will end up in that method's default implementation, namely tcomplain. This worked previously because the record target used to provide a to_async method; one that (erroneously, only at push time) checked the other members of the target stack, and then simply dropped to_async calls in the "does not implement async" case. My first thought was to simply drop tcomplain as the default for to_async. This works, but Pedro pointed out that the only reason record has to supply to_can_async_p and to_is_async_p is that these default to using the find_default_run_target machinery -- and these defaults are only needed by "run" and "attach". So, a nicer solution presents itself: change run and attach to explicitly call into the default run target when needed; and change to_is_async_p and to_can_async_p to default to "return 0". This makes the target stack simpler to use and lets us remove the method implementations from record. This is also in harmony with other plans for the target stack; namely trying to reduce the impact of find_default_run_target. This approach makes it clear that find_default_is_async_p is not needed -- it is asking whether a target that may not even be pushed is actually async, which seems like a nonsensical question. While an improvement, this approach proved to introduce the same bug when using the core target. Looking a bit deeper, the issue is that code in "attach" and "run" may need to use either the current target stack or the default run target -- but different calls into the target API in those functions could wind up querying different targets. This new patch makes the target to use more explicit in "run" and "attach". Then these commands explicitly make the needed calls against that target. This ensures that a single target is used for all relevant operations. This lets us remove a couple find_default_* functions from various targets, including the dummy target. I think this is a decent understandability improvement. One issue I see with this patch is that the new calls in "run" and "attach" are not very much like the rest of the target API. I think fundamentally this is due to bad factoring in the target API, which may need to be fixed for multi-target. Tackling that seemed ambitious for a regression fix. While working on this I noticed that there don't seem to be any test cases that involve both target-async and record, so this patch changes break-precsave.exp to add some. It also changes corefile.exp to add some target-async tests; these pass with current trunk and with this patch applied, but fail with the v1 patch. This patch differs from v4 in that it moves initialization of to_can_async_p and to_supports_non_stop into inf-child, adds some assertions to complete_target_initialization, and adds some comments to target.h. Built and regtested on x86-64 Fedora 20. 2014-03-12 Tom Tromey <tromey@redhat.com> * inf-child.c (return_zero): New function. (inf_child_target): Set to_can_async_p, to_supports_non_stop. * aix-thread.c (aix_thread_inferior_created): New function. (aix_thread_attach): Remove. (init_aix_thread_ops): Don't set to_attach. (_initialize_aix_thread): Register inferior_created observer. * corelow.c (init_core_ops): Don't set to_attach or to_create_inferior. * exec.c (init_exec_ops): Don't set to_attach or to_create_inferior. * infcmd.c (run_command_1): Use find_run_target. Make direct target calls. (attach_command): Use find_attach_target. Make direct target calls. * record-btrace.c (init_record_btrace_ops): Don't set to_create_inferior. * record-full.c (record_full_can_async_p, record_full_is_async_p): Remove. (init_record_full_ops, init_record_full_core_ops): Update. Don't set to_create_inferior. * target.c (complete_target_initialization): Add assertion. (target_create_inferior): Remove. (find_default_attach, find_default_create_inferior): Remove. (find_attach_target, find_run_target): New functions. (find_default_is_async_p, find_default_can_async_p) (target_supports_non_stop, target_attach): Remove. (init_dummy_target): Don't set to_create_inferior or to_supports_non_stop. * target.h (struct target_ops) <to_attach>: Add comment. Remove TARGET_DEFAULT_FUNC. <to_create_inferior>: Add comment. <to_can_async_p, to_is_async_p, to_supports_non_stop>: Use TARGET_DEFAULT_RETURN. <to_can_async_p, to_supports_non_stop, to_can_run>: Add comments. (find_attach_target, find_run_target): Declare. (target_create_inferior): Remove. (target_has_execution_1): Update comment. (target_supports_non_stop): Remove. * target-delegates.c: Rebuild. 2014-03-12 Tom Tromey <tromey@redhat.com> * gdb.base/corefile.exp (corefile_test_run, corefile_test_attach): New procs. Add target-async tests. * gdb.reverse/break-precsave.exp (precsave_tests): New proc. Add target-async tests.
2014-02-28 17:47:34 +01:00
2014-03-12 Tom Tromey <tromey@redhat.com>
* gdb.base/corefile.exp (corefile_test_run, corefile_test_attach):
New procs. Add target-async tests.
* gdb.reverse/break-precsave.exp (precsave_tests): New proc.
Add target-async tests.
2014-03-12 Andreas Arnez <arnez@linux.vnet.ibm.com>
* gdb.dwarf2/dw2-ifort-parameter.c (func): Define labels
'func_start' and 'func_end' for the beginning and end of the
function code, respectively.
* gdb.dwarf2/dw2-ifort-parameter.exp: Use 'func_start' and
'func_end' instead of 'func' and 'main'.
2014-03-12 Andreas Arnez <arnez@linux.vnet.ibm.com>
* gdb.dwarf2/dw2-ifort-parameter-debug.S: Remove.
* gdb.dwarf2/dw2-ifort-parameter.exp: Use Dwarf::assemble to
generate the debug info assembler source.
2014-03-12 Andreas Arnez <arnez@linux.vnet.ibm.com>
* gdb.dwarf2/arr-stride.exp: Exploit 'prepare_for_testing'.
* gdb.dwarf2/arr-subrange.exp: Likewise.
* gdb.dwarf2/dwz.exp: Likewise.
* gdb.dwarf2/method-ptr.exp: Likewise.
* gdb.dwarf2/missing-sig-type.exp: Likewise.
* gdb.dwarf2/subrange.exp: Likewise.
* gdb.dwarf2/implptrconst.exp: Exploit 'build_executable'.
* gdb.dwarf2/implptrpiece.exp: Likewise.
* gdb.dwarf2/nostaticblock.exp: Likewise.
2014-03-12 Andreas Arnez <arnez@linux.vnet.ibm.com>
* lib/gdb.exp (build_executable_from_specs): Don't prepend source
directory to absolute path name arguments.
2014-03-10 Joel Brobecker <brobecker@adacore.com>
* gdb.ada/tagged_access: New testcase.
2014-03-07 Markus Metzger <markus.t.metzger@intel.com>
* gdb.btrace/data.exp: Update expected output.
2014-03-06 Yao Qi <yao@codesourcery.com>
* gdb.trace/pr16508.exp: New file.
PR gdb/16575: stale breakpoint instructions in the code cache In non-stop mode, or rather, breakpoints always-inserted mode, the code cache can easily end up with stale breakpoint instructions: All it takes is filling a cache line when breakpoints already exist in that memory region, and then delete the breakpoint. Vis. (from the new test): (gdb) set breakpoint always-inserted on (gdb) b 23 Breakpoint 2 at 0x400540: file ../../../src/gdb/testsuite/gdb.base/breakpoint-shadow.c, line 23. (gdb) b 24 Breakpoint 3 at 0x400547: file ../../../src/gdb/testsuite/gdb.base/breakpoint-shadow.c, line 24. disass main Dump of assembler code for function main: 0x000000000040053c <+0>: push %rbp 0x000000000040053d <+1>: mov %rsp,%rbp => 0x0000000000400540 <+4>: movl $0x1,-0x4(%rbp) 0x0000000000400547 <+11>: movl $0x2,-0x4(%rbp) 0x000000000040054e <+18>: mov $0x0,%eax 0x0000000000400553 <+23>: pop %rbp 0x0000000000400554 <+24>: retq End of assembler dump. So far so good. Now flush the code cache: (gdb) set code-cache off (gdb) set code-cache on Requesting a disassembly works as expected, breakpoint shadowing is applied: (gdb) disass main Dump of assembler code for function main: 0x000000000040053c <+0>: push %rbp 0x000000000040053d <+1>: mov %rsp,%rbp => 0x0000000000400540 <+4>: movl $0x1,-0x4(%rbp) 0x0000000000400547 <+11>: movl $0x2,-0x4(%rbp) 0x000000000040054e <+18>: mov $0x0,%eax 0x0000000000400553 <+23>: pop %rbp 0x0000000000400554 <+24>: retq End of assembler dump. However, now delete the breakpoints: (gdb) delete Delete all breakpoints? (y or n) y And disassembly shows the old breakpoint instructions: (gdb) disass main Dump of assembler code for function main: 0x000000000040053c <+0>: push %rbp 0x000000000040053d <+1>: mov %rsp,%rbp => 0x0000000000400540 <+4>: int3 0x0000000000400541 <+5>: rex.RB cld 0x0000000000400543 <+7>: add %eax,(%rax) 0x0000000000400545 <+9>: add %al,(%rax) 0x0000000000400547 <+11>: int3 0x0000000000400548 <+12>: rex.RB cld 0x000000000040054a <+14>: add (%rax),%al 0x000000000040054c <+16>: add %al,(%rax) 0x000000000040054e <+18>: mov $0x0,%eax 0x0000000000400553 <+23>: pop %rbp 0x0000000000400554 <+24>: retq End of assembler dump. Those breakpoint instructions are no longer installed in target memory they're stale in the code cache. Easily confirmed by just disabling the code cache: (gdb) set code-cache off (gdb) disass main Dump of assembler code for function main: 0x000000000040053c <+0>: push %rbp 0x000000000040053d <+1>: mov %rsp,%rbp => 0x0000000000400540 <+4>: movl $0x1,-0x4(%rbp) 0x0000000000400547 <+11>: movl $0x2,-0x4(%rbp) 0x000000000040054e <+18>: mov $0x0,%eax 0x0000000000400553 <+23>: pop %rbp 0x0000000000400554 <+24>: retq End of assembler dump. I stumbled upon this when writing a patch to infrun.c, that made handle_inferior_event & co fill in the cache before breakpoints were removed from the target. Recall that wait_for_inferior flushes the dcache for every event. So in that case, always-inserted mode was not necessary to trigger this. It's just a convenient way to expose the issue. The dcache works at the raw memory level. We need to update it whenever memory is written, no matter what kind of target memory object was originally passed down by the caller. The issue is that the dcache update code isn't reached when a caller explicitly writes raw memory. Breakpoint insertion/removal is one such case -- mem-break.c uses target_write_read_memory/target_write_raw_memory. The fix is to move the dcache update code from memory_xfer_partial_1 to raw_memory_xfer_partial so that it's always reachable. When we do that, we can actually simplify a series of things. memory_xfer_partial_1 no longer needs to handle writes for any kind of memory object, and therefore dcache_xfer_memory no longer needs to handle writes either. So the latter (dcache_xfer_memory) and its callees can be simplified to only care about reads. While we're touching dcache_xfer_memory's prototype, might as well rename it to reflect that fact that it only handles reads, and make it follow the new target_xfer_status/xfered_len style. This made me notice that dcache_xfer_memory loses the real error status if a memory read fails: we could have failed to read due to TARGET_XFER_E_UNAVAILABLE, for instance, but we always return TARGET_XFER_E_IO, hence the FIXME note. I felt that fixing that fell out of the scope of this patch. Currently dcache_xfer_memory handles the case of a write failing. The whole cache line is invalidated when that happens. However, dcache_update, the sole mechanism for handling writes that will remain after the patch, does not presently handle that scenario. That's a bug. The patch makes it handle that, by passing down the target_xfer_status status from the caller, so that it can better decide what to do itself. While I was changing the function's prototype, I constified the myaddr parameter, getting rid of the need for the cast as seen in its existing caller. Tested on x86_64 Fedora 17, native and gdbserver. gdb/ 2014-03-05 Pedro Alves <palves@redhat.com> PR gdb/16575 * dcache.c (dcache_poke_byte): Constify ptr parameter. Return void. Update comment. (dcache_xfer_memory): Delete. (dcache_read_memory_partial): New, based on the read bits of dcache_xfer_memory. (dcache_update): Add status parameter. Use ULONGEST for len, and adjust. Discard cache lines if the reason for the update was error. * dcache.h (dcache_xfer_memory): Delete declaration. (dcache_read_memory_partial): New declaration. (dcache_update): Update prototype. * target.c (raw_memory_xfer_partial): Update the dcache here. (memory_xfer_partial_1): Don't handle dcache writes here. gdb/testsuite/ 2014-03-05 Pedro Alves <palves@redhat.com> PR gdb/16575 * gdb.base/breakpoint-shadow.exp (compare_disassembly): New procedure. (top level): Adjust to use it. Add tests that exercise breakpoint interaction with the code-cache.
2014-03-05 15:18:28 +01:00
2014-03-05 Pedro Alves <palves@redhat.com>
PR gdb/16575
* gdb.base/breakpoint-shadow.exp (compare_disassembly): New
procedure.
(top level): Adjust to use it. Add tests that exercise breakpoint
interaction with the code-cache.
2014-02-26 Ludovic Courtès <ludo@gnu.org>
* gdb.guile/scm-value.exp (test_value_in_inferior): Add
test for 'history-append!'.
DWARF: Read constant-class addresses correctly Starting with DWARF version 4, the description of the DW_AT_high_pc attribute was amended to say: if it is of class constant, the value is an unsigned integer offset which when added to the low PC gives the address of the first location past the last instruction associated with the entity. A change was made in Apr 27th, 2012 to reflect that change: | commit 91da14142c0171e58a91ad58a32fd010b700e761 | Author: Mark Wielaard <mjw@redhat.com> | Date: Fri Apr 27 18:55:19 2012 +0000 | | * dwarf2read.c (dwarf2_get_pc_bounds): Check DW_AT_high_pc form to | see whether it is an address or a constant offset from DW_AT_low_pc. | (dwarf2_record_block_ranges): Likewise. | (read_partial_die): Likewise. Unfortunately, this new interpretation is now used regardless of the CU's DWARF version. It turns out that one of WindRiver's compilers (FTR: Diabdata 4.4) is generating DWARF version 2 info with DW_AT_high_pc attributes improperly using the data4 form. Because of that, we miscompute all high PCs incorrectly. This leads to a lot of symtabs having overlapping ranges, which in turn causes havoc in pc-to-symtab-and-line translations. One visible effect is when inserting a breakpoint on a given function: (gdb) b world Breakpoint 1 at 0x4005c4 The source location of the breakpoint is missing. The output should be: (gdb) b world Breakpoint 1 at 0x4005c8: file dw2-rel-hi-pc-world.c, line 24. What happens in this case is that the pc-to-SAL translation first starts be trying to find the symtab associated to our PC using each symtab's ranges. Because of the high_pc miscomputation, many symtabs end up matching, and the heuristic trying to select the most probable one unfortunately returns one that is unrelated (it really had no change in this case to do any better). Once we have the wrong symtab, the start searching the associated linetable, where the addresses are correct, thus finding no match, and therefore no SAL. This patch is an attempt at handling the situation as gracefully as we can, without guarantees. It introduces a new function "attr_value_as_address" which uses the correct accessor for getting the value of a given attribute. It then adjust the code throughout this unit to use this function instead of assuming that addresses always have the DW_FORM_addr format. It also fixes the original issue of miscomputing the high_pc by limiting the new interpretation of constant form DW_AT_high_pc attributes to units using DWARF version 4 or later. gdb/ChangeLog: * dwarf2read.c (attr_value_as_address): New function. (dwarf2_find_base_address, read_call_site_scope): Use attr_value_as_address in place of DW_ADDR. (dwarf2_get_pc_bounds): Use attr_value_as_address to get the low and high addresses. Slight rework of the handling of the high pc being a constant form, and limit it to DWARF verson 4 or higher. (dwarf2_record_block_ranges): Likewise. (read_partial_die): Likewise. (new_symbol_full): Use attr_value_as_address in place of DW_ADDR. gdb/testsuite/ChangeLog: * gdb.dwarf2/dw2-abs-hi-pc-hello-dbg.S: New file. * gdb.dwarf2/dw2-abs-hi-pc-hello.c: New file. * gdb.dwarf2/dw2-abs-hi-pc-world-dbg.S: New file. * gdb.dwarf2/dw2-abs-hi-pc-world.c: New file. * gdb.dwarf2/dw2-abs-hi-pc.c: New file. * gdb.dwarf2/dw2-abs-hi-pc.exp: New file. Tested on x86_64-linux.
2014-02-15 16:09:58 +01:00
2014-02-26 Joel Brobecker <brobecker@adacore.com>
* gdb.dwarf2/dw2-abs-hi-pc-hello-dbg.S: New file.
* gdb.dwarf2/dw2-abs-hi-pc-hello.c: New file.
* gdb.dwarf2/dw2-abs-hi-pc-world-dbg.S: New file.
* gdb.dwarf2/dw2-abs-hi-pc-world.c: New file.
* gdb.dwarf2/dw2-abs-hi-pc.c: New file.
* gdb.dwarf2/dw2-abs-hi-pc.exp: New file.
2014-02-26 Joel Brobecker <brobecker@adacore.com>
* testsuite/gdb.python/py-pp-re-notag.c: New file.
* testsuite/gdb.python/py-pp-re-notag.ex: New file.
* testsuite/gdb.python/py-pp-re-notag.p: New file.
DWARF: Set enum type "flag_enum" and "unsigned" flags at type creation. Consider the following Ada code: -- An array whose index is an enumeration type with 128 enumerators. type Enum_T is (Enum_000, Enum_001, [...], Enum_128); type Table is array (Enum_T) of Boolean; When the compiler is configured to generate pure DWARF debugging info, trying to print type Table's description yields: ptype pck.table type = array (enum_000 .. -128) of boolean The expected output was: ptype pck.table type = array (enum_000 .. enum_128) of boolean The DWARF debugging info for our array looks like this: <1><44>: Abbrev Number: 5 (DW_TAG_array_type) <45> DW_AT_name : pck__table <50> DW_AT_type : <0x28> <2><54>: Abbrev Number: 6 (DW_TAG_subrange_type) <55> DW_AT_type : <0x5c> <59> DW_AT_lower_bound : 0 <5a> DW_AT_upper_bound : 128 The array index type is, by construction with the DWARF standard, a subrange of our enumeration type, defined as follow: <2><5b>: Abbrev Number: 0 <1><5c>: Abbrev Number: 7 (DW_TAG_enumeration_type) <5d> DW_AT_name : pck__enum_t <69> DW_AT_byte_size : 1 <2><6b>: Abbrev Number: 8 (DW_TAG_enumerator) <6c> DW_AT_name : pck__enum_000 <7a> DW_AT_const_value : 0 [etc] Therefore, while processing these DIEs, the array index type ends up being a TYPE_CODE_RANGE whose target type is our enumeration type. But the problem is that we read the upper bound as a negative value (-128), which is then used as is by the type printer to print the array upper bound. This negative value explains the "-128" in the output. To understand why the range type's upper bound is read as a negative value, one needs to look at how it is determined, in read_subrange_type: orig_base_type = die_type (die, cu); base_type = check_typedef (orig_base_type); [... high is first correctly read as 128, but then ...] if (!TYPE_UNSIGNED (base_type) && (high & negative_mask)) high |= negative_mask; The negative_mask is applied, here, because BASE_TYPE->FLAG_UNSIGNED is not set. And the reason for that is because the base_type was only partially constructed during the call to die_type. While the enum is constructed on the fly by read_enumeration_type, its flag_unsigned flag is only set later on, while creating the symbols corresponding to the enum type's enumerators (see process_enumeration_scope), after we've already finished creating our range type - and therefore too late. My first naive attempt at fixing this problem consisted in extracting the part in process_enumeration_scope which processes all enumerators, to generate the associated symbols, but more importantly set the type's various flags when necessary. However, this does not always work well, because we're still in the subrange_type's scope, and it might be different from the scope where the enumeration type is defined. So, instead, what this patch does to fix the issue is to extract from process_enumeration_scope the part that determines whether the enumeration type should have the flag_unsigned and/or the flag_flag_enum flags set. It turns out that, aside from the code implementing the loop, this part is fairly independent of the symbol creation. With that part extracted, we can then use it at the end of our enumeration type creation, to produce a type which should now no longer need any adjustment. Once the enumeration type produced is correctly marked as unsigned, the subrange type's upper bound is then correctly read as an unsigned value, therefore giving us an upper bound of 128 instead of -128. gdb/ChangeLog: * dwarf2read.c (update_enumeration_type_from_children): New function, mostly extracted from process_structure_scope. (read_enumeration_type): Call update_enumeration_type_from_children. (process_enumeration_scope): Do not set THIS_TYPE's flag_unsigned and flag_flag_enum fields. gdb/testsuite/ChangeLog: * gdb.dwarf2/arr-subrange.c, gdb.dwarf2/arr-subrange.exp: New files.
2014-01-22 15:40:20 +01:00
2014-02-26 Joel Brobecker <brobecker@adacore.com>
* gdb.dwarf2/arr-subrange.c, gdb.dwarf2/arr-subrange.exp: New files.
DWARF: Add array DW_AT_bit_stride and DW_AT_byte_stride support Consider the following declarations in Ada... type Item is range -32 .. 31; for Item'Size use 6; type Table is array (Natural range 0 .. 4) of Item; pragma Pack (Table); ... which declare a packed array whose elements are 6 bits long. The debugger currently does not notice that the array is packed, and thus prints values of this type incorrectly. This can be seen in the "ptype" output: (gdb) ptype table type = array (0 .. 4) of foo.item Normally, the debugger should print: (gdb) ptype table type = array (0 .. 4) of foo.item <packed: 6-bit elements> The debugging information for this array looks like this: .uleb128 0xf # (DIE (0x15c) DW_TAG_array_type) .long .LASF9 # DW_AT_name: "pck__table" .byte 0x6 # DW_AT_bit_stride .long 0x1a9 # DW_AT_type .uleb128 0x10 # (DIE (0x16a) DW_TAG_subrange_type) .long 0x3b # DW_AT_type .byte 0 # DW_AT_lower_bound .byte 0x4 # DW_AT_upper_bound .byte 0 # end of children of DIE 0x15c The interesting part is the DW_AT_bit_stride attribute, which tells the size of the array elements is 6 bits, rather than the normal element type's size. This patch adds support for this attribute by first creating gdbtypes.c::create_array_type_with_stride, which is an enhanced version of create_array_type taking an extra parameter as the stride. The old create_array_type can then be re-implemented very simply by calling the new create_array_type_with_stride. We can then use this new function from dwarf2read, to create arrays with or without stride. gdb/ChangeLog: * gdbtypes.h (create_array_type_with_stride): Add declaration. * gdbtypes.c (create_array_type_with_stride): New function, renaming create_array_type, but with an added parameter called "bit_stride". (create_array_type): Re-implement using create_array_type_with_stride. * dwarf2read.c (read_array_type): Add support for DW_AT_byte_stride and DW_AT_bit_stride attributes. gdb/testsuite/ChangeLog: * gdb.dwarf2/arr-stride.c: New file. * gdb.dwarf2/arr-stride.exp: New file. The test, relying purely on generating an assembly file, only verifies the type description of our array. But I was also able to verify manually that the debugger print values of these types correctly as well (which was not the case prior to this patch).
2014-01-29 14:39:56 +01:00
2014-02-26 Joel Brobecker <brobecker@adacore.com>
* gdb.dwarf2/arr-stride.c: New file.
* gdb.dwarf2/arr-stride.exp: New file.
Multiple Ada task-specific breakpoints at the same address. With the test changed as in the patch, against current mainline, we get: (gdb) PASS: gdb.ada/tasks.exp: info tasks before inserting breakpoint break break_me task 1 Breakpoint 2 at 0x4030b0: file /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.ada/tasks/foo.adb, line 27. (gdb) PASS: gdb.ada/tasks.exp: break break_me task 1 break break_me task 3 Note: breakpoint 2 also set at pc 0x4030b0. Breakpoint 3 at 0x4030b0: file /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.ada/tasks/foo.adb, line 27. (gdb) PASS: gdb.ada/tasks.exp: break break_me task 3 continue Continuing. [Switching to Thread 0x7ffff7dc7700 (LWP 27133)] Breakpoint 2, foo.break_me () at /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.ada/tasks/foo.adb:27 27 null; (gdb) FAIL: gdb.ada/tasks.exp: continue to breakpoint info tasks ID TID P-ID Pri State Name 1 63b010 48 Waiting on RV with 3 main_task 2 63bd80 1 48 Accept or Select Term task_list(1) * 3 63f510 1 48 Accepting RV with 1 task_list(2) 4 642ca0 1 48 Accept or Select Term task_list(3) (gdb) PASS: gdb.ada/tasks.exp: info tasks after hitting breakpoint The breakpoint that caused a stop is breakpoint 3, but GDB end up reporting (and running breakpoint commands of) "Breakpoint 2" instead. The issue is that the bpstat_check_breakpoint_conditions logic of "wrong thread" is missing the "wrong task" check. This is usually harmless, because the thread hop code in infrun.c code that handles wrong-task-hitting-breakpoint does check for task-specific breakpoints (within breakpoint_thread_match): /* Check if a regular breakpoint has been hit before checking for a potential single step breakpoint. Otherwise, GDB will not see this breakpoint hit when stepping onto breakpoints. */ if (regular_breakpoint_inserted_here_p (aspace, stop_pc)) { if (!breakpoint_thread_match (aspace, stop_pc, ecs->ptid)) thread_hop_needed = 1; } IOW, usually, when one only has a task specific breakpoint at a given address, things work correctly. Put another task-specific or non-task-specific breakpoint there, and things break. A patch that eliminates the special thread hop code in infrun.c is what exposed this, as after that GDB solely relies on bpstat_check_breakpoint_conditions to know whether the right or wrong task hit a breakpoint. IOW, given the latent bug, Ada task-specific breakpoints become non-task-specific, and that is caught by the testsuite, as: break break_me task 3 Breakpoint 2 at 0x4030b0: file /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.ada/tasks/foo.adb, line 27. (gdb) PASS: gdb.ada/tasks.exp: break break_me task 3 continue Continuing. [Switching to Thread 0x7ffff7fcb700 (LWP 17122)] Breakpoint 2, foo.break_me () at /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.ada/tasks/foo.adb:27 27 null; (gdb) PASS: gdb.ada/tasks.exp: continue to breakpoint info tasks ID TID P-ID Pri State Name 1 63b010 48 Waiting on RV with 2 main_task * 2 63bd80 1 48 Accepting RV with 1 task_list(1) 3 63f510 1 48 Accept or Select Term task_list(2) 4 642ca0 1 48 Accept or Select Term task_list(3) (gdb) FAIL: gdb.ada/tasks.exp: info tasks after hitting breakpoint It was after seeing this that I thought of how to expose the bug with current mainline. Tested on x86_64 Fedora 17. gdb/ 2014-02-26 Pedro Alves <palves@redhat.com> * breakpoint.c (bpstat_check_breakpoint_conditions): Handle task-specific breakpoints. gdb/testsuite/ 2014-02-26 Pedro Alves <palves@redhat.com> * gdb.ada/tasks.exp: Set a task-specific breakpoint at break_me that won't ever trigger. Make sure that GDB reports the correct breakpoint that caused the stop.
2014-02-26 15:22:33 +01:00
2014-02-26 Pedro Alves <palves@redhat.com>
* gdb.ada/tasks.exp: Set a task-specific breakpoint at break_me
that won't ever trigger. Make sure that GDB reports the correct
breakpoint that caused the stop.
PR gdb/16626 Fix auto-load 7.7 regression, the regression affects any loading from /usr/share/gdb/auto-load . 5b2bf9471f1499bee578fcd60c05afe85794e280 is the first bad commit commit 5b2bf9471f1499bee578fcd60c05afe85794e280 Author: Doug Evans <xdje42@gmail.com> Date: Fri Nov 29 21:29:26 2013 -0800 Move .debug_gdb_script processing to auto-load.c. Simplify handling of auto-loaded objfile scripts. Fedora 20 x86_64 $ gdb -q /usr/lib64/libgobject-2.0.so Reading symbols from /usr/lib64/libglib-2.0.so.0.3800.2...Reading symbols from /usr/lib/debug/usr/lib64/libglib-2.0.so.0.3800.2.debug...done. done. (gdb) _ Fedora Rawhide x86_64 $ gdb -q /usr/lib64/libgobject-2.0.so Reading symbols from /usr/lib64/libglib-2.0.so...Reading symbols from /usr/lib/debug/usr/lib64/libglib-2.0.so.0.3990.0.debug...done. done. warning: File "/usr/lib64/libglib-2.0.so.0.3990.0-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load:/usr/bin/mono-gdb.py". To enable execution of this file add add-auto-load-safe-path /usr/lib64/libglib-2.0.so.0.3990.0-gdb.py line to your configuration file "/home/jkratoch/.gdbinit". To completely disable this security protection add set auto-load safe-path / line to your configuration file "/home/jkratoch/.gdbinit". For more information about this security protection see the "Auto-loading safe path" section in the GDB manual. E.g., run from the shell: info "(gdb)Auto-loading safe path" (gdb) _ That is it tries to load "forbidden" /usr/lib64/libglib-2.0.so.0.3990.0-gdb.py but it should load instead /usr/share/gdb/auto-load/usr/lib64/libglib-2.0.so.0.3990.0-gdb.py* Although that is also not exactly this way, there does not exist any /usr/lib64/libglib-2.0.so.0.3990.0-gdb.py despite regressed GDB says so. gdb/ 2014-02-24 Jan Kratochvil <jan.kratochvil@redhat.com> PR gdb/16626 * auto-load.c (auto_load_objfile_script_1): Change filename to debugfile. gdb/testsuite/ 2014-02-24 Jan Kratochvil <jan.kratochvil@redhat.com> PR gdb/16626 * gdb.base/auto-load-script: New file. * gdb.base/auto-load.c: New file. * gdb.base/auto-load.exp: New file. Message-ID: <20140223212400.GA8831@host2.jankratochvil.net>
2014-02-25 18:32:32 +01:00
2014-02-25 Jan Kratochvil <jan.kratochvil@redhat.com>
PR gdb/16626
* gdb.base/auto-load-script: New file.
* gdb.base/auto-load.c: New file.
* gdb.base/auto-load.exp: New file.
PR gdb/16626
* gdb.base/auto-load.exp: Fix out-of-srctree run.
Fix dw2-icycle.exp -fsanitize=address GDB crash. binutils readelf -wi: <4><a2>: Abbrev Number: 26 (DW_TAG_inlined_subroutine) <a3> DW_AT_abstract_origin: <0x5a> <a7> DW_AT_low_pc : 0x400590 <ab> DW_AT_high_pc : 0x4 <af> DW_AT_call_file : 1 <b0> DW_AT_call_line : 20 <b1> DW_AT_sibling : <0xb8> <2><b8>: Abbrev Number: 35 (DW_TAG_inlined_subroutine) <b9> DW_AT_abstract_origin: <0x5a> <bd> DW_AT_low_pc : 0x400590 <c1> DW_AT_high_pc : 0x4 <c5> DW_AT_call_file : 1 <c6> DW_AT_call_line : 29 <b1> DW_AT_sibling points to the next DIE - but that DIE is 2 levels upwards - definitely not a sibling. This confuses GDB up to a crash: ==32143== ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6024000198ac at pc 0xb4d104 bp 0x7fff63e96e70 sp 0x7fff63e96e60 READ of size 1 at 0x6024000198ac thread T0 #0 0xb4d103 in read_unsigned_leb128 (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb4d103) #1 0xb15f3c in peek_die_abbrev (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb15f3c) #2 0xb46185 in load_partial_dies (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb46185) #3 0xb103fb in process_psymtab_comp_unit_reader (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb103fb) #4 0xb0d2a9 in init_cutu_and_read_dies (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb0d2a9) #5 0xb1115f in process_psymtab_comp_unit (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb1115f) #6 0xb1235f in dwarf2_build_psymtabs_hard (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb1235f) #7 0xb05536 in dwarf2_build_psymtabs (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb05536) #8 0x86d5a5 in read_psyms (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x86d5a5) #9 0x9b1c37 in require_partial_symbols (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x9b1c37) #10 0x9bf2d0 in read_symbols (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x9bf2d0) #11 0x9c014c in syms_from_objfile_1 (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x9c014c) gdb/testsuite/ 2014-02-25 Jan Kratochvil <jan.kratochvil@redhat.com> Fix dw2-icycle.exp -fsanitize=address GDB crash. * gdb.dwarf2/dw2-icycle.S: Remove all DW_AT_sibling. Message-ID: <20140224201011.GA28926@host2.jankratochvil.net>
2014-02-25 18:28:38 +01:00
2014-02-25 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix dw2-icycle.exp -fsanitize=address GDB crash.
* gdb.dwarf2/dw2-icycle.S: Remove all DW_AT_sibling.
2014-02-24 Doug Evans <dje@google.com>
* lib/gdb.exp (run_on_host): Log error output if program fails.
2014-02-21 Pedro Alves <palves@redhat.com>
* gdb.threads/step-after-sr-lock.c: Rename to ...
* gdb.threads/signal-while-stepping-over-bp-other-thread.c: ... this.
* gdb.threads/step-after-sr-lock.exp: Rename to ...
* gdb.threads/signal-while-stepping-over-bp-other-thread.exp:
... this.
Fix for PR tdep/16397: SystemTap SDT probe support for x86 doesn't work with "triplet operands" This is the continuation of what Joel proposed on: <https://sourceware.org/ml/gdb-patches/2013-12/msg00977.html> Now that I have already submitted and pushed the patch to split i386_stap_parse_special_token into two smaller functions, it is indeed simpler to understand this patch. It occurs because, on x86, triplet displacement operands are allowed (like "-4+8-20(%rbp)"), and the current parser for this expression is buggy. It does not correctly extract the register name from the expression, which leads to incorrect evaluation. The parser was also being very "generous" with the expression, so I included a few more checks to ensure that we're indeed dealing with a triplet displacement operand. This patch also includes testcases for the two different kind of expressions that can be encountered on x86: the triplet displacement (explained above) and the three-argument displacement (as in "(%rbx,%ebx,-8)"). The tests are obviously arch-dependent and are placed under gdb.arch/. Message-ID: <m3mwj1j12v.fsf@redhat.com> URL: <https://sourceware.org/ml/gdb-patches/2014-01/msg00310.html> gdb/ 2014-02-20 Sergio Durigan Junior <sergiodj@redhat.com> PR tdep/16397 * i386-tdep.c (i386_stap_parse_special_token_triplet): Check if a number comes after the + or - signs. Adjust length of register name to be extracted. gdb/testsuite/ 2014-02-20 Sergio Durigan Junior <sergiodj@redhat.com> PR tdep/16397 * gdb.arch/amd64-stap-special-operands.exp: New file. * gdb.arch/amd64-stap-three-arg-disp.S: Likewise. * gdb.arch/amd64-stap-three-arg-disp.c: Likewise. * gdb.arch/amd64-stap-triplet.S: Likewise. * gdb.arch/amd64-stap-triplet.c: Likewise.
2014-02-20 22:49:09 +01:00
2014-02-20 Sergio Durigan Junior <sergiodj@redhat.com>
PR tdep/16397
* gdb.arch/amd64-stap-special-operands.exp: New file.
* gdb.arch/amd64-stap-three-arg-disp.S: Likewise.
* gdb.arch/amd64-stap-three-arg-disp.c: Likewise.
* gdb.arch/amd64-stap-triplet.S: Likewise.
* gdb.arch/amd64-stap-triplet.c: Likewise.
2014-02-20 Joel Brobecker <brobecker@adacore.com>
* gdb.dwarf2/dw2-icycle.S: Remove second and third parameters
in .section pseudo-op.
2014-02-20 lin zuojian <manjian2006@gmail.com>
Joel Brobecker <brobecker@adacore.com>
Doug Evans <xdje42@gmail.com>
PR symtab/16581
* gdb.dwarf2/dw2-icycle.S: New file.
* gdb.dwarf2/dw2-icycle.c: New file.
* gdb.dwarf2/dw2-icycle.exp: New file.
2014-02-19 Siva Chandra Reddy <sivachandra@google.com>
* gdb.python/py-value-cc.cc: Improve test case to enable testing
operations on gdb.Value objects.
* gdb.python/py-value-cc.exp: Add new test to test operations on
gdb.Value objects.
2014-02-18 Doug Evans <dje@google.com>
* Makefile.in (TESTS): New variable.
(expanded_tests, expanded_tests_or_none): New variables
(check-single): Pass $(expanded_tests_or_none) to runtest.
(check-parallel): Only run tests in $(TESTS) if non-empty.
(check/no-matching-tests-found): New rule.
* README: Document TESTS makefile variable.
2014-02-18 Doug Evans <dje@google.com>
* Makefile.in (check-parallel): rm -rf outputs temp.
2014-02-16 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix "ERROR: no fileid for" in the testsuite.
* lib/gdb.exp (gdb_finish): Check gdb_spawn_id.
2014-02-12 Doug Evans <dje@google.com>
* gdb.dwarf2/Makefile.in (EXECUTABLES): Add dwp-symlink.
(MISCELLANEOUS): New variable.
(clean): rm -rf $(MISCELLANEOUS).
* gdb.dwarf2/dwp-symlink.exp: Test the case where the executable and
dwp live in the same directory as symlinks, with each symlink pointed
to a differently named file in a different directory.
2014-02-11 Doug Evans <dje@google.com>
* gdb.dwarf2/dwp-symlink.exp: Rewrite to use remote_* commands instead
of Tcl file commands.
2014-02-10 Mark Kettenis <kettenis@gnu.org>
* gdb.threads/step-after-sr-lock.exp: Avoid executing
"kill -SIGUSR1 -1".
2014-02-10 Joel Brobecker <brobecker@adacore.com>
* gdb.ada/tick_length_array_enum_idx: New testcase.
Add Guile as an extension language. * NEWS: Mention Guile scripting. * Makefile.in (SUBDIR_GUILE_OBS): New variable. (SUBDIR_GUILE_SRCS, SUBDIR_GUILE_DEPS): New variables (SUBDIR_GUILE_LDFLAGS, SUBDIR_GUILE_CFLAGS): New variables. (INTERNAL_CPPFLAGS): Add GUILE_CPPFLAGS. (CLIBS): Add GUILE_LIBS. (install-guile): New rule. (guile.o): New rule. (scm-arch.o, scm-auto-load.o, scm-block.o): New rules. (scm-breakpoint.o, scm-disasm.o, scm-exception.o): New rules. (scm-frame.o, scm-iterator.o, scm-lazy-string.o): New rules. (scm-math.o, scm-objfile.o, scm-ports.o): New rules. (scm-pretty-print.o, scm-safe-call.o, scm-gsmob.o): New rules. (scm-string.o, scm-symbol.o, scm-symtab.o): New rules. (scm-type.o, scm-utils.o, scm-value.o): New rules. * configure.ac: New option --with-guile. * configure: Regenerate. * config.in: Regenerate. * auto-load.c: Remove #include "python/python.h". Add #include "gdb/section-scripts.h". (source_section_scripts): Handle Guile scripts. (_initialize_auto_load): Add name of Guile objfile script to scripts-directory help text. * breakpoint.c (condition_command): Tweak comment to include Scheme. * breakpoint.h (gdbscm_breakpoint_object): Add forward decl. (struct breakpoint): New member scm_bp_object. * defs.h (enum command_control_type): New value guile_control. * cli/cli-cmds.c: Remove #include "python/python.h". Add #include "extension.h". (show_user): Update comment. (_initialize_cli_cmds): Update help text for "show user". Update help text for max-user-call-depth. * cli/cli-script.c: Remove #include "python/python.h". Add #include "extension.h". (multi_line_command_p): Add guile_control. (print_command_lines): Handle guile_control. (execute_control_command, recurse_read_control_structure): Ditto. (process_next_line): Recognize "guile" commands. * disasm.c (gdb_disassemble_info): Make non-static. * disasm.h: #include "dis-asm.h". (struct gdbarch): Add forward decl. (gdb_disassemble_info): Declare. * extension.c: #include "guile/guile.h". (extension_languages): Add guile. (get_ext_lang_defn): Handle EXT_LANG_GDB. * extension.h (enum extension_language): New value EXT_LANG_GUILE. * gdbtypes.c (get_unsigned_type_max): New function. (get_signed_type_minmax): New function. * gdbtypes.h (get_unsigned_type_max): Declare. (get_signed_type_minmax): Declare. * guile/README: New file. * guile/guile-internal.h: New file. * guile/guile.c: New file. * guile/guile.h: New file. * guile/scm-arch.c: New file. * guile/scm-auto-load.c: New file. * guile/scm-block.c: New file. * guile/scm-breakpoint.c: New file. * guile/scm-disasm.c: New file. * guile/scm-exception.c: New file. * guile/scm-frame.c: New file. * guile/scm-gsmob.c: New file. * guile/scm-iterator.c: New file. * guile/scm-lazy-string.c: New file. * guile/scm-math.c: New file. * guile/scm-objfile.c: New file. * guile/scm-ports.c: New file. * guile/scm-pretty-print.c: New file. * guile/scm-safe-call.c: New file. * guile/scm-string.c: New file. * guile/scm-symbol.c: New file. * guile/scm-symtab.c: New file. * guile/scm-type.c: New file. * guile/scm-utils.c: New file. * guile/scm-value.c: New file. * guile/lib/gdb.scm: New file. * guile/lib/gdb/boot.scm: New file. * guile/lib/gdb/experimental.scm: New file. * guile/lib/gdb/init.scm: New file. * guile/lib/gdb/iterator.scm: New file. * guile/lib/gdb/printing.scm: New file. * guile/lib/gdb/types.scm: New file. * data-directory/Makefile.in (GUILE_SRCDIR): New variable. (VPATH): Add $(GUILE_SRCDIR). (GUILE_DIR): New variable. (GUILE_INSTALL_DIR, GUILE_FILES): New variables. (all): Add stamp-guile dependency. (stamp-guile): New rule. (clean-guile, install-guile, uninstall-guile): New rules. (install-only): Add install-guile dependency. (uninstall): Add uninstall-guile dependency. (clean): Add clean-guile dependency. doc/ * Makefile.in (GDB_DOC_FILES): Add guile.texi. * gdb.texinfo (Auto-loading): Add set/show auto-load guile-scripts. (Extending GDB): New menu entries Guile, Multiple Extension Languages. (Guile docs): Include guile.texi. (objfile-gdbdotext file): Add objfile-gdb.scm. (dotdebug_gdb_scripts section): Mention Guile scripts. (Multiple Extension Languages): New node. * guile.texi: New file. testsuite/ * configure.ac (AC_OUTPUT): Add gdb.guile. * configure: Regenerate. * lib/gdb-guile.exp: New file. * lib/gdb.exp (get_target_charset): New function. * gdb.base/help.exp: Update expected output from "apropos apropos". * gdb.guile/Makefile.in: New file. * gdb.guile/guile.exp: New file. * gdb.guile/scm-arch.c: New file. * gdb.guile/scm-arch.exp: New file. * gdb.guile/scm-block.c: New file. * gdb.guile/scm-block.exp: New file. * gdb.guile/scm-breakpoint.c: New file. * gdb.guile/scm-breakpoint.exp: New file. * gdb.guile/scm-disasm.c: New file. * gdb.guile/scm-disasm.exp: New file. * gdb.guile/scm-equal.c: New file. * gdb.guile/scm-equal.exp: New file. * gdb.guile/scm-error.exp: New file. * gdb.guile/scm-error.scm: New file. * gdb.guile/scm-frame-args.c: New file. * gdb.guile/scm-frame-args.exp: New file. * gdb.guile/scm-frame-args.scm: New file. * gdb.guile/scm-frame-inline.c: New file. * gdb.guile/scm-frame-inline.exp: New file. * gdb.guile/scm-frame.c: New file. * gdb.guile/scm-frame.exp: New file. * gdb.guile/scm-generics.exp: New file. * gdb.guile/scm-gsmob.exp: New file. * gdb.guile/scm-iterator.c: New file. * gdb.guile/scm-iterator.exp: New file. * gdb.guile/scm-math.c: New file. * gdb.guile/scm-math.exp: New file. * gdb.guile/scm-objfile-script-gdb.in: New file. * gdb.guile/scm-objfile-script.c: New file. * gdb.guile/scm-objfile-script.exp: New file. * gdb.guile/scm-objfile.c: New file. * gdb.guile/scm-objfile.exp: New file. * gdb.guile/scm-ports.exp: New file. * gdb.guile/scm-pretty-print.c: New file. * gdb.guile/scm-pretty-print.exp: New file. * gdb.guile/scm-pretty-print.scm: New file. * gdb.guile/scm-section-script.c: New file. * gdb.guile/scm-section-script.exp: New file. * gdb.guile/scm-section-script.scm: New file. * gdb.guile/scm-symbol.c: New file. * gdb.guile/scm-symbol.exp: New file. * gdb.guile/scm-symtab-2.c: New file. * gdb.guile/scm-symtab.c: New file. * gdb.guile/scm-symtab.exp: New file. * gdb.guile/scm-type.c: New file. * gdb.guile/scm-type.exp: New file. * gdb.guile/scm-value-cc.cc: New file. * gdb.guile/scm-value-cc.exp: New file. * gdb.guile/scm-value.c: New file. * gdb.guile/scm-value.exp: New file. * gdb.guile/source2.scm: New file. * gdb.guile/types-module.cc: New file. * gdb.guile/types-module.exp: New file.
2014-02-10 04:40:01 +01:00
2014-02-10 Doug Evans <xdje42@gmail.com>
* configure.ac (AC_OUTPUT): Add gdb.guile.
* configure: Regenerate.
* lib/gdb-guile.exp: New file.
* lib/gdb.exp (get_target_charset): New function.
* gdb.base/help.exp: Update expected output from "apropos apropos".
* gdb.guile/Makefile.in: New file.
* gdb.guile/guile.exp: New file.
* gdb.guile/scm-arch.c: New file.
* gdb.guile/scm-arch.exp: New file.
* gdb.guile/scm-block.c: New file.
* gdb.guile/scm-block.exp: New file.
* gdb.guile/scm-breakpoint.c: New file.
* gdb.guile/scm-breakpoint.exp: New file.
* gdb.guile/scm-disasm.c: New file.
* gdb.guile/scm-disasm.exp: New file.
* gdb.guile/scm-equal.c: New file.
* gdb.guile/scm-equal.exp: New file.
* gdb.guile/scm-error.exp: New file.
* gdb.guile/scm-error.scm: New file.
* gdb.guile/scm-frame-args.c: New file.
* gdb.guile/scm-frame-args.exp: New file.
* gdb.guile/scm-frame-args.scm: New file.
* gdb.guile/scm-frame-inline.c: New file.
* gdb.guile/scm-frame-inline.exp: New file.
* gdb.guile/scm-frame.c: New file.
* gdb.guile/scm-frame.exp: New file.
* gdb.guile/scm-generics.exp: New file.
* gdb.guile/scm-gsmob.exp: New file.
* gdb.guile/scm-iterator.c: New file.
* gdb.guile/scm-iterator.exp: New file.
* gdb.guile/scm-math.c: New file.
* gdb.guile/scm-math.exp: New file.
* gdb.guile/scm-objfile-script-gdb.in: New file.
* gdb.guile/scm-objfile-script.c: New file.
* gdb.guile/scm-objfile-script.exp: New file.
* gdb.guile/scm-objfile.c: New file.
* gdb.guile/scm-objfile.exp: New file.
* gdb.guile/scm-ports.exp: New file.
* gdb.guile/scm-pretty-print.c: New file.
* gdb.guile/scm-pretty-print.exp: New file.
* gdb.guile/scm-pretty-print.scm: New file.
* gdb.guile/scm-section-script.c: New file.
* gdb.guile/scm-section-script.exp: New file.
* gdb.guile/scm-section-script.scm: New file.
* gdb.guile/scm-symbol.c: New file.
* gdb.guile/scm-symbol.exp: New file.
* gdb.guile/scm-symtab-2.c: New file.
* gdb.guile/scm-symtab.c: New file.
* gdb.guile/scm-symtab.exp: New file.
* gdb.guile/scm-type.c: New file.
* gdb.guile/scm-type.exp: New file.
* gdb.guile/scm-value-cc.cc: New file.
* gdb.guile/scm-value-cc.exp: New file.
* gdb.guile/scm-value.c: New file.
* gdb.guile/scm-value.exp: New file.
* gdb.guile/source2.scm: New file.
* gdb.guile/types-module.cc: New file.
* gdb.guile/types-module.exp: New file.
2014-02-10 Yao Qi <yao@codesourcery.com>
PR testsuite/16543
* configure.ac: Append gdb.gdb/Makefile in AC_OUTPUT.
* configure: Regenerated.
* Makefile.in: New file.
2014-02-08 Andreas Schwab <schwab@linux-m68k.org>
* gdb.python/py-framefilter.exp: Fix typo.
2014-02-08 Yao Qi <yao@codesourcery.com>
* gdb.mi/mi-breakpoint-changed.exp (test_insert_delete_modify): Test
that no =breakpoint-modified is emitted when breakpoints are
modified through MI commands.
Make sure we don't resume the stepped thread by accident. Say: <stopped at a breakpoint in thread 2> (gdb) thread 3 (gdb) step The above triggers the prepare_to_proceed/deferred_step_ptid process, which switches back to thread 2, to step over its breakpoint before getting back to thread 3 and "step" it. If while stepping over the breakpoint in thread 2, a signal arrives, and it is set to pass/nostop, we'll set a step-resume breakpoint at the supposed signal-handler resume address, and call keep_going. The problem is that we were supposedly stepping thread 3, and that keep_going delivers a signal to thread 2, and due to scheduler-locking off, resumes everything else, _including_ thread 3, the thread we want stepping. This means that we lose control of thread 3 until the next event, when we stop everything. The end result for the user, is that GDB lost control of the "step". Here's the current infrun debug output of the above, with the testcase in the patch below: infrun: clear_proceed_status_thread (Thread 0x2aaaab8f5700 (LWP 11663)) infrun: clear_proceed_status_thread (Thread 0x2aaaab6f4700 (LWP 11662)) infrun: clear_proceed_status_thread (Thread 0x2aaaab4f2b20 (LWP 11659)) infrun: proceed (addr=0xffffffffffffffff, signal=144, step=1) infrun: prepare_to_proceed (step=1), switched to [Thread 0x2aaaab6f4700 (LWP 11662)] infrun: resume (step=1, signal=0), trap_expected=1, current thread [Thread 0x2aaaab6f4700 (LWP 11662)] at 0x40098f infrun: wait_for_inferior () infrun: target_wait (-1, status) = infrun: 11659 [Thread 0x2aaaab6f4700 (LWP 11662)], infrun: status->kind = stopped, signal = SIGUSR1 infrun: infwait_normal_state infrun: TARGET_WAITKIND_STOPPED infrun: stop_pc = 0x40098f infrun: random signal 30 Program received signal SIGUSR1, User defined signal 1. infrun: signal arrived while stepping over breakpoint infrun: inserting step-resume breakpoint at 0x40098f infrun: resume (step=0, signal=30), trap_expected=0, current thread [Thread 0x2aaaab6f4700 (LWP 11662)] at 0x40098f ^^^ this is a wildcard resume. infrun: prepare_to_wait infrun: target_wait (-1, status) = infrun: 11659 [Thread 0x2aaaab6f4700 (LWP 11662)], infrun: status->kind = stopped, signal = SIGTRAP infrun: infwait_normal_state infrun: TARGET_WAITKIND_STOPPED infrun: stop_pc = 0x40098f infrun: BPSTAT_WHAT_STEP_RESUME infrun: resume (step=1, signal=0), trap_expected=1, current thread [Thread 0x2aaaab6f4700 (LWP 11662)] at 0x40098f ^^^ step-resume hit, meaning the handler returned, so we go back to stepping thread 3. infrun: prepare_to_wait infrun: target_wait (-1, status) = infrun: 11659 [Thread 0x2aaaab6f4700 (LWP 11662)], infrun: status->kind = stopped, signal = SIGTRAP infrun: infwait_normal_state infrun: TARGET_WAITKIND_STOPPED infrun: stop_pc = 0x40088b infrun: switching back to stepped thread infrun: Switching context from Thread 0x2aaaab6f4700 (LWP 11662) to Thread 0x2aaaab8f5700 (LWP 11663) infrun: resume (step=1, signal=0), trap_expected=0, current thread [Thread 0x2aaaab8f5700 (LWP 11663)] at 0x400938 infrun: prepare_to_wait infrun: target_wait (-1, status) = infrun: 11659 [Thread 0x2aaaab8f5700 (LWP 11663)], infrun: status->kind = stopped, signal = SIGTRAP infrun: infwait_normal_state infrun: TARGET_WAITKIND_STOPPED infrun: stop_pc = 0x40093a infrun: keep going infrun: resume (step=1, signal=0), trap_expected=0, current thread [Thread 0x2aaaab8f5700 (LWP 11663)] at 0x40093a infrun: prepare_to_wait infrun: target_wait (-1, status) = infrun: 11659 [Thread 0x2aaaab8f5700 (LWP 11663)], infrun: status->kind = stopped, signal = SIGTRAP infrun: infwait_normal_state infrun: TARGET_WAITKIND_STOPPED infrun: stop_pc = 0x40091e infrun: stepped to a different line infrun: stop_stepping [Switching to Thread 0x2aaaab8f5700 (LWP 11663)] 69 (*myp) ++; /* set breakpoint child_two here */ ^^^ we stopped at the wrong line. We still stepped a bit because the test is running in a loop, and when we got back to stepping thread 3, it happened to be in the stepping range. (The loop increments a counter, and the test makes sure it increments exactly once. Without the fix, the counter increments a bunch, since the user-stepped thread runs free without GDB noticing.) The fix is to switch to the stepping thread before continuing for the step-resume breakpoint. gdb/ 2014-02-07 Pedro Alves <palves@redhat.com> * infrun.c (handle_signal_stop) <signal arrives while stepping over a breakpoint>: Switch back to the stepping thread. gdb/testsuite/ 2014-02-07 Pedro Alves <pedro@codesourcery.com> Pedro Alves <palves@redhat.com> * gdb.threads/step-after-sr-lock.c: New file. * gdb.threads/step-after-sr-lock.exp: New file.
2014-02-07 20:11:25 +01:00
2014-02-07 Pedro Alves <pedro@codesourcery.com>
Pedro Alves <palves@redhat.com>
* gdb.threads/step-after-sr-lock.c: New file.
* gdb.threads/step-after-sr-lock.exp: New file.
Fix gdb.threads/stepi-random-signal.exp on software single-step targets. Currently on software single-step Linux targets we get: (gdb) PASS: gdb.threads/stepi-random-signal.exp: before stepi: get hexadecimal valueof "$pc" stepi infrun: clear_proceed_status_thread (Thread 0x7ffff7fca700 (LWP 7073)) infrun: clear_proceed_status_thread (Thread 0x7ffff7fcb740 (LWP 7069)) infrun: proceed (addr=0xffffffffffffffff, signal=GDB_SIGNAL_DEFAULT, step=1) infrun: resume (step=1, signal=GDB_SIGNAL_0), trap_expected=0, current thread [Thread 0x7ffff7fcb740 (LWP 7069)] at 0x400700 infrun: wait_for_inferior () infrun: target_wait (-1, status) = infrun: 7069 [Thread 0x7ffff7fcb740 (LWP 7069)], infrun: status->kind = stopped, signal = GDB_SIGNAL_TRAP infrun: infwait_normal_state infrun: TARGET_WAITKIND_STOPPED infrun: stop_pc = 0x400704 infrun: software single step trap for Thread 0x7ffff7fcb740 (LWP 7069) infrun: stepi/nexti infrun: stop_stepping 44 while (counter != 0) (gdb) FAIL: gdb.threads/stepi-random-signal.exp: stepi (no random signal) Vs hardware-step targets: (gdb) PASS: gdb.threads/stepi-random-signal.exp: before stepi: get hexadecimal valueof "$pc" stepi infrun: clear_proceed_status_thread (Thread 0x7ffff7fca700 (LWP 9565)) infrun: clear_proceed_status_thread (Thread 0x7ffff7fcb740 (LWP 9561)) infrun: proceed (addr=0xffffffffffffffff, signal=GDB_SIGNAL_DEFAULT, step=1) infrun: resume (step=1, signal=GDB_SIGNAL_0), trap_expected=0, current thread [Thread 0x7ffff7fcb740 (LWP 9561)] at 0x400700 infrun: wait_for_inferior () infrun: target_wait (-1, status) = infrun: 9561 [Thread 0x7ffff7fcb740 (LWP 9561)], infrun: status->kind = stopped, signal = GDB_SIGNAL_CHLD infrun: infwait_normal_state infrun: TARGET_WAITKIND_STOPPED infrun: stop_pc = 0x400700 infrun: random signal (GDB_SIGNAL_CHLD) infrun: random signal, keep going infrun: resume (step=1, signal=GDB_SIGNAL_CHLD), trap_expected=0, current thread [Thread 0x7ffff7fcb740 (LWP 9561)] at 0x400700 infrun: prepare_to_wait infrun: target_wait (-1, status) = infrun: 9561 [Thread 0x7ffff7fcb740 (LWP 9561)], infrun: status->kind = stopped, signal = GDB_SIGNAL_TRAP infrun: infwait_normal_state infrun: TARGET_WAITKIND_STOPPED infrun: stop_pc = 0x400704 infrun: stepi/nexti infrun: stop_stepping 44 while (counter != 0) (gdb) PASS: gdb.threads/stepi-random-signal.exp: stepi The test turns on infrun debug, does a stepi while a SIGCHLD is pending, and checks whether the "random signal" paths in infrun.c are taken. On the software single-step variant above, those paths were not taken. This is a test bug. The Linux backend short-circuits reporting signals that are set to pass/nostop/noprint. But _only_ if the thread is _not_ single-stepping. So on hardware-step targets, even though the signal is set to pass/nostop/noprint by default, the thread is indeed told to single-step, and so the core sees the signal. On the other hand, on software single-step architectures, the backend never actually gets a single-step request (steps are emulated by setting a breakpoint at the next pc, and then the target told to continue, not step). So the short-circuiting code triggers and the core doesn't see the signal. The fix is to make the test be sure the target doesn't bypass reporting the signal to the core. Tested on x86_64 Fedora 17, both with and without a series that implements software single-step for x86_64. gdb/testsuite/ 2014-02-07 Pedro Alves <palves@redhat.com> * gdb.threads/stepi-random-signal.exp: Set SIGCHLD to print.
2013-10-30 16:07:07 +01:00
2014-02-07 Pedro Alves <palves@redhat.com>
* gdb.threads/stepi-random-signal.exp: Set SIGCHLD to print.
2014-02-06 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix i386-sse-stack-align.exp regression since GDB_PARALLEL.
* gdb.arch/i386-sse-stack-align.exp: Use standard_output_file.
Extension Language API * configure.ac (libpython checking): Remove all but python.o from CONFIG_OBS. Remove all but python.c from CONFIG_SRCS. * configure: Regenerate. * Makefile.in (SFILES): Add extension.c. (HFILES_NO_SRCDIR): Add extension.h, extension-priv.h (COMMON_OBS): Add extension.o. * extension.h: New file. * extension-priv.h: New file. * extension.c: New file. * python/python-internal.h: #include "extension.h". (gdbpy_auto_load_enabled): Declare. (gdbpy_apply_val_pretty_printer): Declare. (gdbpy_apply_frame_filter): Declare. (gdbpy_preserve_values): Declare. (gdbpy_breakpoint_cond_says_stop): Declare. (gdbpy_breakpoint_has_cond): Declare. (void source_python_script_for_objfile): Delete. * python/python.c: #include "extension-priv.h". Delete inclusion of "observer.h". (extension_language_python): Moved here and renamed from script_language_python in py-auto-load.c. Redefined to be of type extension_language_defn. (python_extension_script_ops): New global. (python_extension_ops): New global. (struct python_env): New member previous_active. (restore_python_env): Call restore_active_ext_lang. (ensure_python_env): Call set_active_ext_lang. (gdbpy_clear_quit_flag): Renamed from clear_quit_flag, made static. New arg extlang. (gdbpy_set_quit_flag): Renamed from set_quit_flag, made static. New arg extlang. (gdbpy_check_quit_flag): Renamed from check_quit_flag, made static. New arg extlang. (gdbpy_eval_from_control_command): Renamed from eval_python_from_control_command, made static. New arg extlang. (gdbpy_source_script) Renamed from source_python_script, made static. New arg extlang. (gdbpy_before_prompt_hook): Renamed from before_prompt_hook. Change result to int. New arg extlang. (gdbpy_source_objfile_script): Renamed from source_python_script_for_objfile, made static. New arg extlang. (gdbpy_start_type_printers): Renamed from start_type_printers, made static. New args extlang, extlang_printers. Change result type to "void". (gdbpy_apply_type_printers): Renamed from apply_type_printers, made static. New arg extlang. Rename arg printers to extlang_printers and change type to ext_lang_type_printers *. (gdbpy_free_type_printers): Renamed from free_type_printers, made static. Replace argument arg with extlang, extlang_printers. (!HAVE_PYTHON, eval_python_from_control_command): Delete. (!HAVE_PYTHON, source_python_script): Delete. (!HAVE_PYTHON, gdbpy_should_stop): Delete. (!HAVE_PYTHON, gdbpy_breakpoint_has_py_cond): Delete. (!HAVE_PYTHON, start_type_printers): Delete. (!HAVE_PYTHON, apply_type_printers): Delete. (!HAVE_PYTHON, free_type_printers): Delete. (_initialize_python): Delete call to observer_attach_before_prompt. (finalize_python): Set/restore active extension language. (gdbpy_finish_initialization) Renamed from finish_python_initialization, made static. New arg extlang. (gdbpy_initialized): New function. * python/python.h: #include "extension.h". Delete #include "value.h", "mi/mi-cmds.h". (extension_language_python): Declare. (GDBPY_AUTO_FILE_NAME): Delete. (enum py_bt_status): Moved to extension.h and renamed to ext_lang_bt_status. (enum frame_filter_flags): Moved to extension.h. (enum py_frame_args): Moved to extension.h and renamed to ext_lang_frame_args. (finish_python_initialization): Delete. (eval_python_from_control_command): Delete. (source_python_script): Delete. (apply_val_pretty_printer): Delete. (apply_frame_filter): Delete. (preserve_python_values): Delete. (gdbpy_script_language_defn): Delete. (gdbpy_should_stop, gdbpy_breakpoint_has_py_cond): Delete. (start_type_printers, apply_type_printers, free_type_printers): Delete. * auto-load.c: #include "extension.h". (GDB_AUTO_FILE_NAME): Delete. (auto_load_gdb_scripts_enabled): Make public. New arg extlang. (script_language_gdb): Delete, moved to extension.c and renamed to extension_language_gdb. (source_gdb_script_for_objfile): Delete. (auto_load_pspace_info): New member unsupported_script_warning_printed. (loaded_script): Change type of language member to struct extension_language_defn *. (init_loaded_scripts_info): Initialize unsupported_script_warning_printed. (maybe_add_script): Make static. Change type of language arg to struct extension_language_defn *. (clear_section_scripts): Reset unsupported_script_warning_printed. (auto_load_objfile_script_1): Rewrite to use extension language API. (auto_load_objfile_script): Make public. Remove support-compiled-in and auto-load-enabled checks, moved to auto_load_scripts_for_objfile. (source_section_scripts): Rewrite to use extension language API. (load_auto_scripts_for_objfile): Rewrite to use auto_load_scripts_for_objfile. (collect_matching_scripts_data): Change type of language member to struct extension_language_defn *. (auto_load_info_scripts): Change type of language arg to struct extension_language_defn *. (unsupported_script_warning_print): New function. (script_not_found_warning_print): Make static. (_initialize_auto_load): Rewrite construction of scripts-directory help. * auto-load.h (struct objfile): Add forward decl. (struct script_language): Delete. (struct auto_load_pspace_info): Add forward decl. (struct extension_language_defn): Add forward decl. (maybe_add_script): Delete. (auto_load_objfile_script): Declare. (script_not_found_warning_print): Delete. (auto_load_info_scripts): Update prototype. (auto_load_gdb_scripts_enabled): Declare. * python/py-auto-load.c (gdbpy_auto_load_enabled): Renamed from auto_load_python_scripts_enabled and made public. (script_language_python): Delete, moved to python.c. (gdbpy_script_language_defn): Delete. (info_auto_load_python_scripts): Update to use extension_language_python. * breakpoint.c (condition_command): Replace call to gdbpy_breakpoint_has_py_cond with call to get_breakpoint_cond_ext_lang. (bpstat_check_breakpoint_conditions): Replace call to gdbpy_should_stop with call to breakpoint_ext_lang_cond_says_stop. * python/py-breakpoint.c (gdbpy_breakpoint_cond_says_stop): Renamed from gdbpy_should_stop. Change result type to enum scr_bp_stop. New arg slang. Return SCR_BP_STOP_UNSET if py_bp_object is NULL. (gdbpy_breakpoint_has_cond): Renamed from gdbpy_breakpoint_has_py_cond. New arg slang. (local_setattro): Print name of extension language with existing stop condition. * valprint.c (val_print, value_print): Update to call apply_ext_lang_val_pretty_printer. * cp-valprint.c (cp_print_value): Update call to apply_ext_lang_val_pretty_printer. * python/py-prettyprint.c: Remove #ifdef HAVE_PYTHON. (gdbpy_apply_val_pretty_printer): Renamed from apply_val_pretty_printer. New arg extlang. (!HAVE_PYTHON, apply_val_pretty_printer): Delete. * cli/cli-cmds.c (source_script_from_stream): Rewrite to use extension language API. * cli/cli-script.c (execute_control_command): Update to call eval_ext_lang_from_control_command. * mi/mi-cmd-stack.c (mi_cmd_stack_list_frames): Update to use enum ext_lang_bt_status values. Update call to apply_ext_lang_frame_filter. (mi_cmd_stack_list_locals): Ditto. (mi_cmd_stack_list_args): Ditto. (mi_cmd_stack_list_variables): Ditto. * mi/mi-main.c: Delete #include "python/python-internal.h". Add #include "extension.h". (mi_cmd_list_features): Replace reference to python internal variable gdb_python_initialized with call to ext_lang_initialized_p. * stack.c (backtrace_command_1): Update to use enum ext_lang_bt_status. Update to use enum ext_lang_frame_args. Update to call apply_ext_lang_frame_filter. * python/py-framefilter.c (extract_sym): Update to use enum ext_lang_bt_status. (extract_value, py_print_type, py_print_value): Ditto. (py_print_single_arg, enumerate_args, enumerate_locals): Ditto. (py_mi_print_variables, py_print_locals, py_print_args): Ditto. (py_print_frame): Ditto. (gdbpy_apply_frame_filter): Renamed from apply_frame_filter. New arg extlang. Update to use enum ext_lang_bt_status. * top.c (gdb_init): Delete #ifdef HAVE_PYTHON call to finish_python_initialization. Replace with call to finish_ext_lang_initialization. * typeprint.c (do_free_global_table): Update to call free_ext_lang_type_printers. (create_global_typedef_table): Update to call start_ext_lang_type_printers. (find_global_typedef): Update to call apply_ext_lang_type_printers. * typeprint.h (struct ext_lang_type_printers): Add forward decl. (type_print_options): Change type of global_printers from "void *" to "struct ext_lang_type_printers *". * value.c (preserve_values): Update to call preserve_ext_lang_values. * python/py-value.c: Remove #ifdef HAVE_PYTHON. (gdbpy_preserve_values): Renamed from preserve_python_values. New arg extlang. (!HAVE_PYTHON, preserve_python_values): Delete. * utils.c (quit_flag): Delete, moved to extension.c. (clear_quit_flag, set_quit_flag, check_quit_flag): Delete, moved to extension.c. * eval.c: Delete #include "python/python.h". * main.c: Delete #include "python/python.h". * defs.h: Update comment. testsuite/ * gdb.python/py-breakpoint.exp (test_bkpt_eval_funcs): Update expected output. * gdb.gdb/python-interrupts.exp: New file.
2014-02-06 04:27:58 +01:00
2014-02-06 Doug Evans <xdje42@gmail.com>
* gdb.python/py-breakpoint.exp (test_bkpt_eval_funcs): Update expected
output.
* gdb.gdb/python-interrupts.exp: New file.
2014-02-05 Yao Qi <yao@codesourcery.com>
* gdb.trace/report.exp (use_collected_data): Test the output
of "info threads" and "info inferiors".
2014-02-05 Yao Qi <yao@codesourcery.com>
Revert this patch:
2013-05-24 Yao Qi <yao@codesourcery.com>
* gdb.trace/tfile.exp: Test inferior and thread.
PowerPC64 ELFv2 ABI: skip global entry point code This patch handles another aspect of the ELFv2 ABI, which unfortunately requires common code changes. In ELFv2, functions may provide both a global and a local entry point. The global entry point (where the function symbol points to) is intended to be used for function-pointer or cross-module (PLT) calls, and requires r12 to be set up to the entry point address itself. The local entry point (which is found at a fixed offset after the global entry point, as defined by bits in the symbol table entries' st_other field), instead expects r2 to be set up to the current TOC. Now, when setting a breakpoint on a function by name, you really want that breakpoint to trigger either way, no matter whether the function is called via its local or global entry point. Since the global entry point will always fall through into the local entry point, the way to achieve that is to simply set the breakpoint at the local entry point. One way to do that would be to have prologue parsing skip the code sequence that makes up the global entry point. Unfortunately, this does not work reliably, since -for optimized code- GDB these days will not actuall invoke the prologue parsing code but instead just set the breakpoint at the symbol address and rely on DWARF being correct at any point throughout the function ... Unfortunately, I don't really see any way to express the notion of local entry points with the current set of gdbarch callbacks. Thus this patch adds a new callback, skip_entrypoint, that is somewhat analogous to skip_prologue, but is called every time GDB needs to determine a function start address, even in those cases where GDB decides to not call skip_prologue. As a side effect, the skip_entrypoint implementation on ppc64 does not need to perform any instruction parsing; it can simply rely on the local entry point flags in the symbol table entry. With this implemented, two test cases would still fail to set the breakpoint correctly, but that's because they use the construct: gdb_test "break *hello" Now, using "*hello" explicitly instructs GDB to set the breakpoint at the numerical value of "hello" treated as function pointer, so it will by definition only hit the global entry point. I think this behaviour is unavoidable, but acceptable -- most people do not use this construct, and if they do, they get what they asked for ... In one of those two test cases, use of this construct is really not appropriate. I think this was added way back when as a means to work around prologue skipping problems on some platforms. These days that shouldn't really be necessary any more ... For the other (step-bt), we really want to make sure backtracing works on the very first instruction of the routine. To enable that test also on powerpc64le-linux, we can modify the code to call the test function via function pointer (which makes it use the global entry point in the ELFv2 ABI). gdb/ChangeLog: * gdbarch.sh (skip_entrypoint): New callback. * gdbarch.c, gdbarch.h: Regenerate. * symtab.c (skip_prologue_sal): Call gdbarch_skip_entrypoint. * infrun.c (fill_in_stop_func): Likewise. * ppc-linux-tdep.c: Include "elf/ppc64.h". (ppc_elfv2_elf_make_msymbol_special): New function. (ppc_elfv2_skip_entrypoint): Likewise. (ppc_linux_init_abi): Install them for ELFv2. gdb/testsuite/ChangeLog: * gdb.base/sigbpt.exp: Do not use "*" when setting breakpoint on a function. * gdb.base/step-bt.c: Call hello via function pointer to make sure its first instruction is executed on powerpc64le-linux.
2014-02-04 18:44:14 +01:00
2014-02-04 Ulrich Weigand <uweigand@de.ibm.com>
* gdb.base/sigbpt.exp: Do not use "*" when setting breakpoint
on a function.
* gdb.base/step-bt.c: Call hello via function pointer to make
sure its first instruction is executed on powerpc64le-linux.
2014-02-04 Ulrich Weigand <uweigand@de.ibm.com>
* gdb.arch/powerpc-d128-regs.exp: Enable on powerpc64*-*.
2014-02-04 Ulrich Weigand <uweigand@de.ibm.com>
* gdb.arch/vsx-regs.exp: Check target endianness. Provide variants
of the test patterns for use on little-endian systems.
2014-02-04 Ulrich Weigand <uweigand@de.ibm.com>
* gdb.arch/altivec-regs.exp: Use gdb_test_multiple for endian test.
(decimal_vector): Fix for little-endian.
2014-01-29 Jose E. Marchesi <jose.marchesi@oracle.com>
* gdb.arch/sparc-sysstep.exp: New file.
* gdb.arch/sparc-sysstep.c: Likewise.
* gdb.arch/Makefile.in (EXECUTABLES): Add sparc-sysstep.
2014-01-28 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
* gdb.base/info-shared.exp: Expect leading `.' on ppc64's symbols.
2014-01-23 Tom Tromey <tromey@redhat.com>
* gdb.ada/array_char_idx: New testcase.
2014-01-23 Tom Tromey <tromey@redhat.com>
PR python/16487:
* gdb.python/py-framefilter.exp: Add test using "Error" filter.
* gdb.python/py-framefilter.py (ErrorInName, ErrorFilter): New
classes.
2014-01-23 Tom Tromey <tromey@redhat.com>
PR python/16491:
* gdb.python/py-framefilter.py (Reverse_Function.function): Read a
string from an inferior frame.
* gdb.python/py-framefilter-mi.exp: Update.
New gdbserver option --debug-format=timestamp. * NEWS: Mention it. gdbserver/ * configure.ac (AC_CHECK_FUNCS): Add test for gettimeofday. * configure: Regenerate. * config.in: Regenerate. * Makefile.in (SFILES): Add debug.c. (OBS): Add debug.o. * debug.c: New file. * debug.h: New file. * linux-aarch64-low.c (*): Update all debugging printfs to use debug_printf instead of fprintf. * linux-arm-low.c (*): Ditto. * linux-cris-low.c (*): Ditto. * linux-crisv32-low.c (*): Ditto. * linux-m32r-low.c (*): Ditto. * linux-sparc-low.c (*): Ditto. * linux-x86.c (*): Ditto. * linux-low.c (*): Ditto. (linux_wait_1): Add calls to debug_enter, debug_exit. (linux_wait): Remove redundant debugging printf. (stop_all_lwps): Add calls to debug_enter, debug_exit. (linux_resume, unstop_all_lwps): Ditto. * mem-break.c (*): Update all debugging printfs to use debug_printf instead of fprintf. * remote-utils.c (*): Ditto. * thread-db.c (*): Ditto. * server.c #include <ctype.h>, "gdb_vecs.h". (debug_threads): Moved to debug.c. (*): Update all debugging printfs to use debug_printf instead of fprintf. (start_inferior): Replace call to fflush with call to debug_flush. (monitor_show_help): Mention set debug-format. (parse_debug_format_options): New function. (handle_monitor_command): Handle "monitor set debug-format". (gdbserver_usage): Mention --debug-format. (main): Parse --debug-format. * server.h (debug_threads): Declaration moved to debug.h. #include "debug.h". * tracepoint.c (trace_debug_1) [!IN_PROCESS_AGENT]: Add version of trace_debug_1 that uses debug_printf. (tracepoint_look_up_symbols): Update all debugging printfs to use debug_printf instead of fprintf. doc/ * gdb.texinfo (Server): Mention --debug-format=all|none|timestamp. (gdbserver man): Ditto. testsuite/ * gdb.server/server-mon.exp: Add tests for "set debug-format".
2014-01-22 23:17:39 +01:00
2014-01-22 Doug Evans <dje@google.com>
* gdb.server/server-mon.exp: Add tests for "set debug-format".
2014-01-22 Andreas Arnez <arnez@vnet.linux.ibm.com>
* gdb.base/catch-syscall.exp: Activate test on s390*-linux.
2014-01-22 Andreas Arnez <arnez@vnet.linux.ibm.com>
* gdb.trace/entry-values.exp: Remove excess space character from
regex patterns. Handle s390 call instruction.
2014-01-22 Andreas Arnez <arnez@vnet.linux.ibm.com>
* gdb.dwarf2/dw2-dir-file-name.c (FUNC): Insert alignment and
define "*_start" label. Make "name" static.
* gdb.dwarf2/dw2-dir-file-name.exp: Replace references to
${name} by references to ${name}_start.
2014-01-22 Andreas Arnez <arnez@vnet.linux.ibm.com>
* gdb.base/info-macros.exp: Remove "debug" from the compile
options.
2014-01-17 Iain Buclaw <ibuclaw@gdcproject.org>
* gdb.dlang/demangle.exp: New file.
2014-01-17 Iain Buclaw <ibuclaw@gdcproject.org>
* gdb.dlang/primitive-types.exp: New file.
2014-01-17 Iain Buclaw <ibuclaw@gdcproject.org>
* configure.ac: Create gdb.dlang/Makefile.
* configure: Regenerate.
* Makefile.in (ALL_SUBDIRS): Add gdb.dlang.
* gdb.dlang/Makefile.in: New file.
* lib/d-support.exp: New file.
* lib/gdb.exp (skip_d_tests): New proc.
record-btrace: add (reverse-)stepping support Provide to_resume and to_wait target methods for the btrace record target to allow reverse stepping and replay support. Replay is limited in the sense that only stepping and source correlation are supported. We do not record data and thus can not show variables. Non-stop mode is not working. Do not allow record-btrace in non-stop mode. 2014-01-16 Markus Metzger <markus.t.metzger@intel.com> * btrace.h (btrace_thread_flag): New. (struct btrace_thread_info) <flags>: New. * record-btrace.c (record_btrace_resume_thread) (record_btrace_find_thread_to_move, btrace_step_no_history) (btrace_step_stopped, record_btrace_start_replaying) (record_btrace_step_thread, record_btrace_decr_pc_after_break) (record_btrace_find_resume_thread): New. (record_btrace_resume, record_btrace_wait): Extend. (record_btrace_can_execute_reverse): New. (record_btrace_open): Fail in non-stop mode. (record_btrace_set_replay): Split into this, ... (record_btrace_stop_replaying): ... this, ... (record_btrace_clear_histories): ... and this. (init_record_btrace_ops): Init to_can_execute_reverse. * NEWS: Announce it. testsuite/ * gdb.btrace/delta.exp: Check reverse stepi. * gdb.btrace/tailcall.exp: Update. Add stepping tests. * gdb.btrace/finish.exp: New. * gdb.btrace/next.exp: New. * gdb.btrace/nexti.exp: New. * gdb.btrace/record_goto.c: Add comments. * gdb.btrace/step.exp: New. * gdb.btrace/stepi.exp: New. * gdb.btrace/multi-thread-step.c: New. * gdb.btrace/multi-thread-step.exp: New. * gdb.btrace/rn-dl-bind.c: New. * gdb.btrace/rn-dl-bind.exp: New. * gdb.btrace/data.c: New. * gdb.btrace/data.exp: New. * gdb.btrace/Makefile.in (EXECUTABLES): Add new. doc/ * gdb.texinfo: Document limited reverse/replay support for target record-btrace.
2013-05-06 16:04:46 +02:00
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* gdb.btrace/delta.exp: Check reverse stepi.
* gdb.btrace/tailcall.exp: Update. Add stepping tests.
* gdb.btrace/finish.exp: New.
* gdb.btrace/next.exp: New.
* gdb.btrace/nexti.exp: New.
* gdb.btrace/record_goto.c: Add comments.
* gdb.btrace/step.exp: New.
* gdb.btrace/stepi.exp: New.
* gdb.btrace/multi-thread-step.c: New.
* gdb.btrace/multi-thread-step.exp: New.
* gdb.btrace/rn-dl-bind.c: New.
* gdb.btrace/rn-dl-bind.exp: New.
* gdb.btrace/data.c: New.
* gdb.btrace/data.exp: New.
* gdb.btrace/Makefile.in (EXECUTABLES): Add new.
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* gdb.btrace/Makefile.in (EXECUTABLES): Add delta.
* gdb.btrace/exception.exp: Update.
* gdb.btrace/instruction_history.exp: Update.
* gdb.btrace/record_goto.exp: Update.
* gdb.btrace/tailcall.exp: Update.
* gdb.btrace/unknown_functions.exp: Update.
* gdb.btrace/delta.exp: New.
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* gdb.btrace/record_goto.exp: Add backtrace test.
* gdb.btrace/tailcall.exp: Add backtrace test.
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* gdb.btrace/Makefile.in (EXECUTABLES): Add record_goto.
* gdb.btrace/record_goto.c: New.
* gdb.btrace/record_goto.exp: New.
* gdb.btrace/x86-record_goto.S: New.
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* gdb.btrace/function_call_history.exp: Update tests.
* gdb.btrace/instruction_history.exp: Update tests.
record-btrace: optionally indent function call history Add a new modifier /c to the "record function-call-history" command to indent the function name based on its depth in the call stack. Also reorder the optional fields to have the indentation at the very beginning. Prefix the insn range (/i modifier) with "inst ". Prefix the source line (/l modifier) with "at ". Change the range syntax from "begin-end" to "begin,end" to allow copy&paste to the "record instruction-history" and "list" commands. Adjust the respective tests and add new tests for the /c modifier. 2014-01-16 Markus Metzger <markus.t.metzger@intel.com> * record.h (enum record_print_flag) <record_print_indent_calls>: New. * record.c (get_call_history_modifiers): Recognize /c modifier. (_initialize_record): Document /c modifier. * record-btrace.c (btrace_call_history): Add btinfo parameter. Reorder fields. Optionally indent the function name. Update all users. * NEWS: Announce changes. testsuite/ * gdb.btrace/function_call_history.exp: Fix expected field order for "record function-call-history". Add new tests for "record function-call-history /c". * gdb.btrace/exception.cc: New. * gdb.btrace/exception.exp: New. * gdb.btrace/tailcall.exp: New. * gdb.btrace/x86-tailcall.S: New. * gdb.btrace/x86-tailcall.c: New. * gdb.btrace/unknown_functions.c: New. * gdb.btrace/unknown_functions.exp: New. * gdb.btrace/Makefile.in (EXECUTABLES): Add new. doc/ * gdb.texinfo (Process Record and Replay): Document new /c modifier accepted by "record function-call-history". Add /i modifier to "record function-call-history" example.
2013-04-18 10:58:05 +02:00
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* gdb.btrace/function_call_history.exp: Fix expected field
order for "record function-call-history".
Add new tests for "record function-call-history /c".
* gdb.btrace/exception.cc: New.
* gdb.btrace/exception.exp: New.
* gdb.btrace/tailcall.exp: New.
* gdb.btrace/x86-tailcall.S: New.
* gdb.btrace/x86-tailcall.c: New.
* gdb.btrace/unknown_functions.c: New.
* gdb.btrace/unknown_functions.exp: New.
* gdb.btrace/Makefile.in (EXECUTABLES): Add new.
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* gdb.btrace/instruction_history.exp: Update.
* gdb.btrace/function_call_history.exp: Update.
btrace: change branch trace data structure The branch trace is represented as 3 vectors: - a block vector - a instruction vector - a function vector Each vector (except for the first) is computed from the one above. Change this into a graph where a node represents a sequence of instructions belonging to the same function and where we have three types of edges to connect the function segments: - control flow - same function (instance) - call stack This allows us to navigate in the branch trace. We will need this for "record goto" and reverse execution. This patch introduces the data structure and computes the control flow edges. It also introduces iterator structs to simplify iterating over the branch trace in control-flow order. It also fixes PR gdb/15240 since now recursive calls are handled correctly. Fix the test that got the number of expected fib instances and also the function numbers wrong. The current instruction had been part of the branch trace. This will look odd once we start support for reverse execution. Remove it. We still keep it in the trace itself to allow extending the branch trace more easily in the future. 2014-01-16 Markus Metzger <markus.t.metzger@intel.com> * btrace.h (struct btrace_func_link): New. (enum btrace_function_flag): New. (struct btrace_inst): Rename to ... (struct btrace_insn): ...this. Update all users. (struct btrace_func) <ibegin, iend>: Remove. (struct btrace_func_link): New. (struct btrace_func): Rename to ... (struct btrace_function): ...this. Update all users. (struct btrace_function) <segment, flow, up, insn, insn_offset) (number, level, flags>: New. (struct btrace_insn_iterator): Rename to ... (struct btrace_insn_history): ...this. Update all users. (struct btrace_insn_iterator, btrace_call_iterator): New. (struct btrace_target_info) <btrace, itrace, ftrace>: Remove. (struct btrace_target_info) <begin, end, level> <insn_history, call_history>: New. (btrace_insn_get, btrace_insn_number, btrace_insn_begin) (btrace_insn_end, btrace_insn_prev, btrace_insn_next) (btrace_insn_cmp, btrace_find_insn_by_number, btrace_call_get) (btrace_call_number, btrace_call_begin, btrace_call_end) (btrace_call_prev, btrace_call_next, btrace_call_cmp) (btrace_find_function_by_number, btrace_set_insn_history) (btrace_set_call_history): New. * btrace.c (btrace_init_insn_iterator) (btrace_init_func_iterator, compute_itrace): Remove. (ftrace_print_function_name, ftrace_print_filename) (ftrace_skip_file): Change parameter to const. (ftrace_init_func): Remove. (ftrace_debug): Use new btrace_function fields. (ftrace_function_switched): Also consider gaining and losing symbol information). (ftrace_print_insn_addr, ftrace_new_call, ftrace_new_return) (ftrace_new_switch, ftrace_find_caller, ftrace_new_function) (ftrace_update_caller, ftrace_fixup_caller, ftrace_new_tailcall): New. (ftrace_new_function): Move. Remove debug print. (ftrace_update_lines, ftrace_update_insns): New. (ftrace_update_function): Check for call, ret, and jump. (compute_ftrace): Renamed to ... (btrace_compute_ftrace): ...this. Rewritten to compute call stack. (btrace_fetch, btrace_clear): Updated. (btrace_insn_get, btrace_insn_number, btrace_insn_begin) (btrace_insn_end, btrace_insn_prev, btrace_insn_next) (btrace_insn_cmp, btrace_find_insn_by_number, btrace_call_get) (btrace_call_number, btrace_call_begin, btrace_call_end) (btrace_call_prev, btrace_call_next, btrace_call_cmp) (btrace_find_function_by_number, btrace_set_insn_history) (btrace_set_call_history): New. * record-btrace.c (require_btrace): Use new btrace thread info fields. (record_btrace_info, btrace_insn_history) (record_btrace_insn_history, record_btrace_insn_history_range): Use new btrace thread info fields and new iterator. (btrace_func_history_src_line): Rename to ... (btrace_call_history_src_line): ...this. Use new btrace thread info fields. (btrace_func_history): Rename to ... (btrace_call_history): ...this. Use new btrace thread info fields and new iterator. (record_btrace_call_history, record_btrace_call_history_range): Use new btrace thread info fields and new iterator. testsuite/ * gdb.btrace/function_call_history.exp: Fix expected function trace. * gdb.btrace/instruction_history.exp: Initialize traced. Remove traced_functions.
2013-03-22 14:32:47 +01:00
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* gdb.btrace/function_call_history.exp: Fix expected function
trace.
* gdb.btrace/instruction_history.exp: Initialize traced.
Remove traced_functions.
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* gdb.btrace/function_call_history.exp: Update
* gdb.btrace/instruction_history.exp: Update.
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* gdb.btrace/enable.exp: Update expected text.
2014-01-16 Omair Javaid <Omair.Javaid@linaro.org>
* gdb.dwarf2/dw2-dos-drive.S: Increase text section size to 4
bytes.
2014-01-15 Maciej W. Rozycki <macro@codesourcery.com>
* gdb.base/float.exp: Handle "aarch64*-*-*" targets.
2014-01-15 Omair Javaid <omair.javaid@linaro.org>
* lib/gdb.exp (supports_process_record): Return true for
arm*-linux*. (supports_reverse): Likewise.
2014-01-13 Siva Chandra Reddy <sivachandra@google.com>
PR python/15464
PR python/16113
* gdb.python/py-type.c: Enhance test case.
* gdb.python/py-value-cc.cc: Likewise
* gdb.python/py-type.exp: Add new tests.
* gdb.python/py-value-cc.exp: Likewise
2014-01-10 Andreas Arnez <arnez@linux.vnet.ibm.com>
Pedro Alves <palves@redhat.com>
* gdb.dwarf2/dw2-dir-file-name.c (FUNC): Remove "*_start" symbol.
Make "name" extern.
* gdb.dwarf2/dw2-dir-file-name.exp (out_cu, out_line): Replace
references to ${name}_start by references to ${name}.
2014-01-10 Joel Brobecker <brobecker@adacore.com>
* gdb.ada/pp-rec-component.exp: Remove path from "source" test.
2014-01-10 Joel Brobecker <brobecker@adacore.com>
* gdb.python/py-pp-integral.exp: Remove path from "source" test.
2014-01-09 Maciej W. Rozycki <macro@codesourcery.com>
Pedro Alves <palves@redhat.com>
* gdb.mi/mi-info-os.exp: Connect to the target with
mi_gdb_target_load.
[remote/gdbserver] Don't lose signals when reconnecting. Currently, when GDB connects in all-stop mode, GDBserver always responds to the status packet with a GDB_SIGNAL_TRAP, even if the program is actually stopped for some other signal. (gdb) tar rem ... ... (gdb) c Program received signal SIGUSR1, User defined signal 1. (gdb) disconnect (gdb) tar rem ... (gdb) c (Or a GDB crash instead of an explicit disconnect.) This results in the program losing that signal on that last continue, because gdb will tell the target to resume with no signal (to suppress the GDB_SIGNAL_TRAP, due to 'handle SISGTRAP nopass'), and that will actually suppress the real signal the program had stopped for (SIGUSR1). To fix that, I think we should make GDBserver report the real signal the thread had stopped for in response to the status packet: @item ? @cindex @samp{?} packet Indicate the reason the target halted. The reply is the same as for step and continue. But, that raises the question -- which thread are we reporting the status for? Due to how the RSP in all-stop works, we can only report one status. The status packet's response is a stop reply packet, so it includes the thread identifier, so it's not a problem packet-wise. However, GDBserver is currently always reporting the status for first thread in the thread list, even though that may well not be the thread that got the signal that caused the program to stop. So the next logical step would be to report the status for the last_ptid/last_status thread (the last event reported to gdb), if it's still around; and if not, fallback to some other thread. There's an issue on the GDB side with that, though... GDB currently always adds the thread reported in response to the status query as the first thread in its list. That means that if we start with e.g., (gdb) info threads 3 Thread 1003 ... * 2 Thread 1002 ... 1 Thread 1001 ... And reconnect: (gdb) disconnect (gdb) tar rem ... We end up with: (gdb) info threads 3 Thread 1003 ... 2 Thread 1001 ... * 1 Thread 1002 ... Not a real big issue, but it's reasonably fixable, by having GDB fetch/sync the thread list before fetching the status/'?', and then using the status to select the right thread as current on the GDB side. Holes in the thread numbers are squashed before/after reconnection (e.g., 2,3,5 becomes 1,2,3), but the order is preserved, which I think is both good, and good enough. However (yes, there's more...), the previous GDB that was connected might have had gdbserver running in non-stop mode, or could have left gdbserver doing disconnected tracing (which also forces non-stop), and if the new gdb/connection is in all-stop mode, we can end up with more than one thread with a signal to report back to gdb. As we can only report one thread/status (in the all-stop RSP variant; the non-stop variant doesn't have this issue), we get to do what we do at every other place we have this situation -- leave events we can't report right now as pending, so that the next resume picks them up. Note all this ammounts to a QoI change, within the existing framework. There's really no RSP change here. The only user visible change (other than that the signal is program is stopped at isn't lost / is passed to the program), is in "info program", that now can show the signal the program stopped for. Of course, the next resume will respect the pass/nopass setting for the signal in question. It'd be reasonable to have the initial connection tell the user the program was stopped with a signal, similar to when we load a core to debug, but I'm leaving that out for a future change. I think we'll need to either change how handle_inferior_event & co handle stop_soon, or maybe bypass them completely (like fork-child.c:startup_inferior) for that. Tested on x86_64 Fedora 17. gdb/gdbserver/ 2014-01-08 Pedro Alves <palves@redhat.com> * gdbthread.h (struct thread_info) <status_pending_p>: New field. * server.c (visit_actioned_threads, handle_pending_status): New function. (handle_v_cont): Factor out parts to ... (resume): ... this new function. If in all-stop, and a thread being resumed has a pending status, report it without actually resuming. (myresume): Adjust to use the new 'resume' function. (clear_pending_status_callback, set_pending_status_callback) (find_status_pending_thread_callback): New functions. (handle_status): Handle the case of multiple threads having interesting statuses to report. Report threads' real last signal instead of always reporting GDB_SIGNAL_TRAP. Look for a thread with an interesting thread to report the status for, instead of always reporting the status of the first thread. gdb/ 2014-01-08 Pedro Alves <palves@redhat.com> * remote.c (remote_add_thread): Add threads silently if starting up. (remote_notice_new_inferior): If in all-stop, and starting up, don't call notice_new_inferior. (get_current_thread): New function, factored out from ... (add_current_inferior_and_thread): ... this. Adjust. (remote_start_remote) <all-stop>: Fetch the thread list. If we found any thread, then select the remote's current thread as GDB's current thread too. gdb/testsuite/ 2014-01-08 Pedro Alves <palves@redhat.com> * gdb.threads/reconnect-signal.c: New file. * gdb.threads/reconnect-signal.exp: New file.
2014-01-08 19:55:51 +01:00
2014-01-08 Pedro Alves <palves@redhat.com>
* gdb.threads/reconnect-signal.c: New file.
* gdb.threads/reconnect-signal.exp: New file.
2014-01-07 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/source-dir.exp: New file.
2014-01-08 10:16:32 +01:00
2014-01-07 Joel Brobecker <brobecker@adacore.com>
* gdb.ada/mi_interface: New testcase.
Ada: Fix missing call to pretty-printer for fields of records. Consider the following types: type Time_T is record Secs : Integer; end record; Before : Time_T := (Secs => 1384395743); In this example, we assume that type Time_T is the number of seconds since Epoch, and so added a Python pretty-printer, to print this type in a more human-friendly way. For instance: (gdb) print before $1 = Thu Nov 14 02:22:23 2013 (1384395743) However, we've noticed that things stop working when this type is embedded inside another record, and we try to print that record. For instance, with the following declarations: type Composite is record Id : Integer; T : Time_T; end record; Afternoon : Composite := (Id => 1, T => (Secs => 1384395865)); (gdb) print afternoon $2 = (id => 1, t => (secs => 1384395865)) We expected instead: (gdb) print afternoon $2 = (id => 1, t => Thu Nov 14 02:24:25 2013 (1384395865)) This patch fixes the problem by making sure that we try to print each field via a call to val_print, rather than calling ada_val_print directly. We need to go through val_print, as the val_print handles all language-independent features such as calling the pretty-printer, knowing that ada_val_print will get called eventually if actual Ada-specific printing is required (which should be the most common scenario). And because val_print takes the language as parameter, we enhanced the print_field_values and print_variant_part to also take a language. As a bonus, this allows us to remove a couple of references to current_language. gdb/ChangeLog: * ada-valprint.c (print_field_values): Add "language" parameter. Update calls to print_field_values and print_variant_part. Pass new parameter "language" in call to val_print instead of "current_language". Replace call to ada_val_print by call to val_print. (print_variant_part): Add "language" parameter. (ada_val_print_struct_union): Update call to print_field_values. gdb/testsuite/ChangeLog: * gdb.ada/pp-rec-component.exp, gdb.ada/pp-rec-component.py, gdb.ada/pp-rec-component/foo.adb, gdb.ada/pp-rec-component/pck.adb, gdb.ada/pp-rec-component/pck.ads: New files.
2013-12-19 18:26:55 +01:00
2014-01-07 Joel Brobecker <brobecker@adacore.com>
* gdb.ada/pp-rec-component.exp, gdb.ada/pp-rec-component.py,
gdb.ada/pp-rec-component/foo.adb, gdb.ada/pp-rec-component/pck.adb,
gdb.ada/pp-rec-component/pck.ads: New files.
2014-01-07 Joel Brobecker <brobecker@adacore.com>
* gdb.python/py-pp-integral.c: New file.
* gdb.python/py-pp-integral.py: New file.
* gdb.python/py-pp-integral.exp: New file.
For older changes see ChangeLog-1993-2013.
;; Local Variables:
;; mode: change-log
;; left-margin: 8
;; fill-column: 74
;; version-control: never
;; End:
Copyright 2014 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted provided the copyright notice and this notice are preserved.