[Public] Hi Abdul, Wrt the backtrace command, I was mentioning the 'backtrace -n' command, with a minus before the 'n', so that 'n' number of the outermost frames, rather than the innermost ones are displayed. That did not seem to work correctlly. Thanks, Jini. ________________________________ From: Ijaz, Abdul B Sent: Wednesday, January 10, 2024 14:52 To: George, Jini Susan ; gdb-patches@sourceware.org Cc: tom@tromey.com ; eliz@gnu.org ; blarsen@redhat.com Subject: RE: [PING 3][PATCH v5 0/4] GDB support for DW_AT_trampoline [Public] Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding. Hi Jini, Thanks a lot for the feedback. I have added my response here : * Shouldn't the frame skipping be done for the 'return' command also ? Yes this is missing so I will add to return command also in next V6 series. * Shouldn't the frame skipping be enabled for the MI command '-stack-list-frames' also ? Yes this is also missing and need to check this. Will be added to this MI command also in V6 series. * The frame skipping does not seem to be working correctly for the 'backtrace -n' command (to list 'n' nbr of the outermost frames). In commit message I think due to “#” character at beginning backtrace lines are removed from commit message. I will update the commit message to show the lines or have you seen some issue as otherwise it works fine. “Backtrace n” shows like following output without trampoline frames. Missing #1 & #3 here are trampoline frames : (gdb) bt 3 #0 second (x=20, y=9) at trampoline.f90:4 #2 0x00000000004051e3 in first (num1=16, num2=3) at trampoline.f90:10 #4 0x0000000000405234 in func_trampoline () at trampoline.f90:17 (gdb) show skip-trampoline-functions Skipping trampoline functions is on. (gdb) set skip-trampoline-functions off (gdb) bt 3 #0 second (x=20, y=9) at trampoline.f90:4 #1 0x0000000000405209 in second_.t74p.t75p () at trampoline.f90:12 #2 0x00000000004051e3 in first (num1=16, num2=3) at trampoline.f90:10 (More stack frames follow...) * As of now, there does not seem to be a way to turn off the filtering of the trampoline frames. Shouldn't there be one ? There is skip-trampoline-functions option added in patch #4 of the series. So it should be possible to turn it off. Would not it be sufficient? Though found out that its handling for backtrace command is missing which I will add like shown above when I will send next V6 series of patch for review. * One suggestion for the trampoline frame filtering is to piggyback on the current python frame filtering (plus FrameDecorator) mechanism. This might mean including adding a filter for this to the current source. This would enable users to use the existing commands to turn off frame filtering. But this is just a suggestion, and it would be good to go by what the maintainers say wrt this Not much familiar with it but as you said need to see maintainers feedback regarding this and then may investigate accordingly. What is done so far regarding python frame filters is that now handling filter trampoline frames also using “skip-trampoline-functions” configure option. By default python frame filters will not show trampoline frames but can be enabled to show this by using this option. Thanks & Best Regards Abdul Basit From: George, Jini Susan Sent: Wednesday, January 10, 2024 8:41 AM To: Ijaz, Abdul B ; gdb-patches@sourceware.org Cc: tom@tromey.com; eliz@gnu.org; blarsen@redhat.com Subject: Re: [PING 3][PATCH v5 0/4] GDB support for DW_AT_trampoline [Public] Hi Abdul, Thank you for incorporating the comments. A few suggestions/ comments wrt the new functionality of skipping the stack frames with the 'bt' and 'finish' commands below. * Shouldn't the frame skipping be done for the 'return' command also ? * Shouldn't the frame skipping be enabled for the MI command '-stack-list-frames' also ? * The frame skipping does not seem to be working correctly for the 'backtrace -n' command (to list 'n' nbr of the outermost frames). * As of now, there does not seem to be a way to turn off the filtering of the trampoline frames. Shouldn't there be one ? * One suggestion for the trampoline frame filtering is to piggyback on the current python frame filtering (plus FrameDecorator) mechanism. This might mean including adding a filter for this to the current source. This would enable users to use the existing commands to turn off frame filtering. But this is just a suggestion, and it would be good to go by what the maintainers say wrt this. Thanks, Jini. ________________________________ From: Ijaz, Abdul B > Sent: Thursday, December 28, 2023 17:00 To: gdb-patches@sourceware.org > Cc: George, Jini Susan >; tom@tromey.com >; eliz@gnu.org >; blarsen@redhat.com > Subject: RE: [PING 3][PATCH v5 0/4] GDB support for DW_AT_trampoline Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding. Ping! Best Regards Abdul Basit -----Original Message----- From: Ijaz, Abdul B Sent: Wednesday, September 27, 2023 11:05 PM To: 'gdb-patches@sourceware.org' > Cc: 'JiniSusan.George@amd.com' >; 'tom@tromey.com' >; 'eliz@gnu.org' >; 'blarsen@redhat.com' > Subject: RE: [PING 2][PATCH v5 0/4] GDB support for DW_AT_trampoline Ping! Thanks & Best Regards Abdul Basit -----Original Message----- From: Ijaz, Abdul B Sent: Sunday, September 3, 2023 9:14 PM To: gdb-patches@sourceware.org Cc: JiniSusan.George@amd.com; tom@tromey.com; eliz@gnu.org; blarsen@redhat.com Subject: RE: [PING][PATCH v5 0/4] GDB support for DW_AT_trampoline Ping! Best Regards Abdul Basit -----Original Message----- From: Ijaz, Abdul B > Sent: Wednesday, August 16, 2023 11:54 PM To: gdb-patches@sourceware.org Cc: Ijaz, Abdul B >; JiniSusan.George@amd.com; tom@tromey.com; eliz@gnu.org; blarsen@redhat.com Subject: [PATCH v5 0/4] GDB support for DW_AT_trampoline From: "Ijaz, Abdul B" > Hi, please find attached a series of patches that attempts to enable GDB to handle the DW_AT_trampoline attribute on functions and inlined functions. DW_AT_trampoline can be emitted by the compiler for functions that are compiler generated trampolines (e.g. wrapping other function calls). In doing so, the compiler can specify a target as the value of DW_AT_trampoline which the trampoline is wrapping. This series enables GDB to recognize the DW_AT_trampoline and store the target for a given function. Patch 3 adapts GDB's stepping behavior when dealing with trampolines and attempts to - by default - hide these trampolines from the user. When about to step into a trampoline, instead, GDB will try and step through the trampoline and directly towards the target. Patch 4 in V2 now skip trampoline frames in the stack for printing or finish command. A new setting has been introduced to turn off this modified stepping behavior or printing of stack for trampolines. The motivation for these patches comes from ifx which emits the attribute for some of its compiler generated functions. As I do not know of any other compiler (especially gcc/gfortran) emitting DW_AT_trampoline, I added a gdb.dwarf2 test to this series in order to test the trampoline handling within GDB. Changes since V4: * Fixed reverse finish for trampolines. * Elide trampoline frames in backtrace for frame-filters case. * Use target subroutine address instead of name in case of ref type trampoline target. * Fixed loops formatting and now split line where possible at ";". V4 series of patches can be found here: https://sourceware.org/pipermail/gdb-patches/2023-August/201263.html No regression seen on testing x64/native-extended-gdbserver(-m32)/x32/ native-gdbserver test configurations for these changes using Ubuntu 22. Thanks & Best Regards Abdul Basit Abdul Basit Ijaz (1): gdb: Skip trampoline frames in the stack for printing or finish command. Nils-Christian Kempke (3): gdb, dwarf: add support for DW_AT_trampoline in DWARF reader gdb/symtab: add lookup for trampoline functions gdb/infrun: handle stepping through functions with DW_AT_trampoline gdb/NEWS | 15 ++ gdb/doc/gdb.texinfo | 47 ++++ gdb/dwarf2/read.c | 46 +++- gdb/gdbtypes.c | 34 ++- gdb/gdbtypes.h | 113 +++++++- gdb/infcmd.c | 13 + gdb/infrun.c | 93 ++++++- gdb/infrun.h | 10 + gdb/python/py-frame.c | 15 ++ gdb/stack.c | 8 + gdb/symtab.c | 80 ++++++ gdb/symtab.h | 19 ++ .../gdb.dwarf2/dw2-function-trampolines.c | 80 ++++++ .../gdb.dwarf2/dw2-function-trampolines.exp | 245 ++++++++++++++++++ gdb/testsuite/gdb.fortran/func-trampoline.exp | 69 +++++ gdb/testsuite/gdb.fortran/func-trampoline.f90 | 39 +++ .../gdb.fortran/mixed-lang-stack.exp | 10 +- 17 files changed, 922 insertions(+), 14 deletions(-) create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-function-trampolines.c create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-function-trampolines.exp create mode 100644 gdb/testsuite/gdb.fortran/func-trampoline.exp create mode 100644 gdb/testsuite/gdb.fortran/func-trampoline.f90 -- 2.34.1 Intel Deutschland GmbH Registered Address: Am Campeon 10, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928 Intel Deutschland GmbH Registered Address: Am Campeon 10, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928