binutils-gdb/gdb/testsuite/gdb.ada/rdv_wait.exp

36 lines
1.2 KiB
Plaintext
Raw Normal View History

# Copyright 2012-2020 Free Software Foundation, Inc.
DWARF frame unwinder executes one too many rows The problem is trying to unwind from a function where %ebp is NOT used as the frame pointer, and the size of the frame changes over the lifetime of that function. For instance, trying to unwind past the GNAT runtime function called system.tasking.rendezvous.timed_selective_wait on x86-linux, one can get: (gdb) bt [...] #3 0x0805364b in system.tasking.rendezvous.timed_selective_wait () #4 0xb7fe5068 in ?? () Backtrace stopped: previous frame inner to this frame (corrupt stack?) Looking at the CFI, we find the following initial instructions... > DW_CFA_def_cfa: %esp+4 (r4 ofs 4) > DW_CFA_offset: %eip at cfa-4 (r8 = %eip) ... and the associated FDE: > 00001be4 00000054 00001be8 FDE cie=00000000 pc=08053310..08053951 [...] > DW_CFA_advance_loc: 8 to 080534ad > DW_CFA_def_cfa_offset: 112 > DW_CFA_advance_loc2: 414 to 0805364b > DW_CFA_def_cfa_offset: 108 [...] The problem is that the DWARF frame unwinder executed the FDE until the row for PC == 0x0805364b. But in reality, our program hasn't executed the instruction at that address yet (it is the return address). So GDB executed a little too much of the FDE, giving us the wrong offset for the frame base, and thus the wrong address where %eip got saved. This patch fixes the problem by using a more correct PC as the bound for executing the FDE. gdb/ChangeLog: * dwarf2-frame.c (dwarf2_frame_cache): Use get_frame_address_in_block instead of get_frame_pc as the bound for executing the frame's FDE. gdb/testsuite/ChangeLog: * gdb.ada/rdv_wait: New testcase.
2012-08-16 17:45:46 +02:00
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
load_lib "ada.exp"
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
return -1
}
clean_restart ${testfile}
# This test won't work properly if system debuginfo is installed.
gdb_test_no_output "set debug-file-directory"
DWARF frame unwinder executes one too many rows The problem is trying to unwind from a function where %ebp is NOT used as the frame pointer, and the size of the frame changes over the lifetime of that function. For instance, trying to unwind past the GNAT runtime function called system.tasking.rendezvous.timed_selective_wait on x86-linux, one can get: (gdb) bt [...] #3 0x0805364b in system.tasking.rendezvous.timed_selective_wait () #4 0xb7fe5068 in ?? () Backtrace stopped: previous frame inner to this frame (corrupt stack?) Looking at the CFI, we find the following initial instructions... > DW_CFA_def_cfa: %esp+4 (r4 ofs 4) > DW_CFA_offset: %eip at cfa-4 (r8 = %eip) ... and the associated FDE: > 00001be4 00000054 00001be8 FDE cie=00000000 pc=08053310..08053951 [...] > DW_CFA_advance_loc: 8 to 080534ad > DW_CFA_def_cfa_offset: 112 > DW_CFA_advance_loc2: 414 to 0805364b > DW_CFA_def_cfa_offset: 108 [...] The problem is that the DWARF frame unwinder executed the FDE until the row for PC == 0x0805364b. But in reality, our program hasn't executed the instruction at that address yet (it is the return address). So GDB executed a little too much of the FDE, giving us the wrong offset for the frame base, and thus the wrong address where %eip got saved. This patch fixes the problem by using a more correct PC as the bound for executing the FDE. gdb/ChangeLog: * dwarf2-frame.c (dwarf2_frame_cache): Use get_frame_address_in_block instead of get_frame_pc as the bound for executing the frame's FDE. gdb/testsuite/ChangeLog: * gdb.ada/rdv_wait: New testcase.
2012-08-16 17:45:46 +02:00
runto "break_me"
# Switch to task 2, and verify that GDB is able to unwind all the way
# to foo.T.
gdb_test "task 2" \
Output the Ada task name in more messages. With this patch, we e.g. get: [Switching to task 2 "task_list(1)"] [Current task is 2 "task_list(1)"] instead of [Switching to task 2] [Current task is 2] The logic to produce the taskno optionally followed by the task name has been factorized in the task_to_str function. Task names are output between double quotes in the new messages, similarly to what GDB does for thread names. However, no quotes are put around task names in 'info tasks' Name column. This was discussed with Tom, that preferred no quotes there, while I was more in favour of visual consistency. I discussed with a few more users, which led to (exactly) 50% preferring quotes and 50% preferring no quotes :). To arrive to the decision to remove the quotes, the following "killing args" were used: * To have quotes or to not have quotes, that is the question; yes but not *THE* question :). * If there is not a clear majority that prefers quotes, better to not disturb the existing user basis for a (somewhat) irrelevant aspect. * The opinion of the reviewer has more weight. So, compared to the previous version, this version remotes the quotes in 'info tasks'. It improves the alignement of 'info tasks' output. With this patch, we get: (gdb) info task ID TID P-ID Pri State Name * 1 555555759030 48 Runnable main_task 2 555555759e30 1 48 Selective Wait mit (gdb) instead of (gdb) info task ID TID P-ID Pri State Name * 1 555555759030 48 Runnable main_task 2 555555759e30 1 48 Selective Wait mit (gdb) (e.g. the first one properly shows parent and priority under the correct header). This is version 4 of the 'task name' patch. Compared to version 3, the changes are: output task names between quotes but not in 'info tasks' gdb/ChangeLog 2019-09-12 Philippe Waroquiers <philippe.waroquiers@skynet.be> * NEWS: Announce that Ada task names are now shown at more places, and between quotes (except in info task output). * gdb/ada-tasks.c (task_to_str): New function. (display_current_task_id): Call task_to_str. (task_command_1): Likewise. (print_ada_task_info): In non-mi mode, Properly align headers and data when task-id length is > 9 (9 is the default for a 32 bits CORE_ADDR). gdb/doc/ChangeLog 2019-09-12 Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.texinfo (Ada Tasks): Tell the task name is printed, update examples. gdb/testsuite/ChangeLog 2019-09-12 Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.ada/rdv_wait.exp: Update to new task names. * gdb.base/task_switch_in_core.exp: Likewise. * gdb.base/info_sources_base.c: Likewise.
2019-06-08 19:47:51 +02:00
[join {"\\\[Switching to task 2 \"mit\"\\\].*" \
DWARF frame unwinder executes one too many rows The problem is trying to unwind from a function where %ebp is NOT used as the frame pointer, and the size of the frame changes over the lifetime of that function. For instance, trying to unwind past the GNAT runtime function called system.tasking.rendezvous.timed_selective_wait on x86-linux, one can get: (gdb) bt [...] #3 0x0805364b in system.tasking.rendezvous.timed_selective_wait () #4 0xb7fe5068 in ?? () Backtrace stopped: previous frame inner to this frame (corrupt stack?) Looking at the CFI, we find the following initial instructions... > DW_CFA_def_cfa: %esp+4 (r4 ofs 4) > DW_CFA_offset: %eip at cfa-4 (r8 = %eip) ... and the associated FDE: > 00001be4 00000054 00001be8 FDE cie=00000000 pc=08053310..08053951 [...] > DW_CFA_advance_loc: 8 to 080534ad > DW_CFA_def_cfa_offset: 112 > DW_CFA_advance_loc2: 414 to 0805364b > DW_CFA_def_cfa_offset: 108 [...] The problem is that the DWARF frame unwinder executed the FDE until the row for PC == 0x0805364b. But in reality, our program hasn't executed the instruction at that address yet (it is the return address). So GDB executed a little too much of the FDE, giving us the wrong offset for the frame base, and thus the wrong address where %eip got saved. This patch fixes the problem by using a more correct PC as the bound for executing the FDE. gdb/ChangeLog: * dwarf2-frame.c (dwarf2_frame_cache): Use get_frame_address_in_block instead of get_frame_pc as the bound for executing the frame's FDE. gdb/testsuite/ChangeLog: * gdb.ada/rdv_wait: New testcase.
2012-08-16 17:45:46 +02:00
".*foo\\.t \\(.*\\).*foo\\.adb:.*"} ""]