From: Tom de Vries <tdevries@suse.de>
To: Simon Marchi <simon.marchi@polymtl.ca>, gdb-patches@sourceware.org
Subject: Re: [PATCH][gdb/breakpoint] Fix assert in jit_event_handler
Date: Fri, 21 May 2021 13:27:55 +0200 [thread overview]
Message-ID: <df106571-69d5-3d3a-8559-3b823ad9cd31@suse.de> (raw)
In-Reply-To: <ec0a73be-8cb8-3fa3-36b4-f514a53e0343@polymtl.ca>
[-- Attachment #1: Type: text/plain, Size: 1536 bytes --]
On 5/20/21 6:22 PM, Simon Marchi wrote:
> It's quite annoying that separate debug info files are represented by
> "objfile"s...
>
Yeah, indeed.
And you could even say that that's fine, but question whether they
should be in the objfiles list, that is, have the default behaviour of:
...
for (objfile *the_objfile : pspace->objfiles ())
{
+ /* Skip separate debug objects. */
+ if (the_objfile->separate_debug_objfile_backlink != nullptr)
+ continue;
...
without having to specify this, and if you need to access the separate
debuginfo files, use the specific iterator for this.
>> ...
>> but consequently we'll have two jit breakpoints, so we also make sure we don't
>> set a jit breakpoint on separate debug objects like libLLVM.so.10.debug.
>>
>> Tested on x86_64-linux.
>
> Does that fix some test when running the testsuite with the fission
> board or something like that?
No, though I ran into another problem :) while playing around with the
jit test-cases and target boards (
https://sourceware.org/bugzilla/show_bug.cgi?id=27893 ). [ And yet
another problem while looking into the missing DIE problem (
https://sourceware.org/bugzilla/show_bug.cgi?id=27894 ).
> I think it would be important for this to
> be tested.
>
I wrote this target board file, which does trigger this assert in the
jit test-cases, and verified that the patch fixes all of them.
During testing of the target board, I ran into another assert in
gdb.python/py-objfile.exp, will file that as well. WDYT?
Thanks,
- Tom
[-- Attachment #2: 0002-gdb-testsuite-Add-target-board-cc-with-gnu-debuglink.exp.patch --]
[-- Type: text/x-patch, Size: 4289 bytes --]
[gdb/testsuite] Add target board cc-with-gnu-debuglink.exp
Add target board cc-with-gnu-debuglink.exp that splits off debuginfo into
a
seperate .debug file and links to it using .gnu_debuglink.
Tested on x86_64-linux.
gdb/ChangeLog:
2021-05-21 Tom de Vries <tdevries@suse.de>
* contrib/cc-with-tweaks.sh: Handle -l.
gdb/testsuite/ChangeLog:
2021-05-21 Tom de Vries <tdevries@suse.de>
* boards/cc-with-gnu-debuglink.exp: New file.
---
gdb/contrib/cc-with-tweaks.sh | 46 +++++++++++++++++++++++++-
gdb/testsuite/boards/cc-with-gnu-debuglink.exp | 26 +++++++++++++++
2 files changed, 71 insertions(+), 1 deletion(-)
diff --git a/gdb/contrib/cc-with-tweaks.sh b/gdb/contrib/cc-with-tweaks.sh
index 2eda76a89c2..8653dfb260e 100755
--- a/gdb/contrib/cc-with-tweaks.sh
+++ b/gdb/contrib/cc-with-tweaks.sh
@@ -45,6 +45,7 @@
# -i make an index (.gdb_index)
# -n make a dwarf5 index (.debug_names)
# -p create .dwp files (Fission), you need to also use gcc option -gsplit-dwarf
+# -l creates separate debuginfo files linked to using .gnu_debuglink
# If nothing is given, no changes are made
myname=cc-with-tweaks.sh
@@ -83,6 +84,7 @@ want_dwz=false
want_multi=false
want_dwp=false
want_objcopy_compress=false
+want_gnu_debuglink=false
while [ $# -gt 0 ]; do
case "$1" in
@@ -92,6 +94,7 @@ while [ $# -gt 0 ]; do
-n) want_index=true; index_options=-dwarf-5;;
-m) want_multi=true ;;
-p) want_dwp=true ;;
+ -l) want_gnu_debuglink=true ;;
*) break ;;
esac
shift
@@ -158,7 +161,12 @@ fi
get_tmpdir ()
{
- tmpdir=$(dirname "$output_file")/.tmp
+ subdir="$1"
+ if [ "$subdir" = "" ]; then
+ subdir=.tmp
+ fi
+
+ tmpdir=$(dirname "$output_file")/"$subdir"
mkdir -p "$tmpdir"
}
@@ -234,4 +242,40 @@ if [ "$want_dwp" = true ]; then
fi
fi
+if [ "$want_gnu_debuglink" = true ]; then
+ # Based on gdb_gnu_strip_debug.
+
+ # Gdb looks for the .gnu_debuglink file in the .debug subdirectory
+ # of the directory of the executable.
+ get_tmpdir .debug
+
+ stripped_file="$tmpdir"/$(basename "$output_file").stripped
+ debug_file="$tmpdir"/$(basename "$output_file").debug
+
+ # Create stripped and debug versions of output_file.
+ strip --strip-debug "${output_file}" \
+ -o "${stripped_file}"
+ rc=$?
+ [ $rc != 0 ] && exit $rc
+ strip --only-keep-debug "${output_file}" \
+ -o "${debug_file}"
+ rc=$?
+ [ $rc != 0 ] && exit $rc
+
+ # The .gnu_debuglink is supposed to contain no leading directories.
+ link=$(basename "${debug_file}")
+
+ (
+ # Temporarily cd to tmpdir to allow objcopy to find $link
+ cd "$tmpdir" || exit 1
+
+ # Overwrite output_file with stripped version containing
+ # .gnu_debuglink to debug_file.
+ objcopy --add-gnu-debuglink="$link" "${stripped_file}" \
+ "${output_file}"
+ rc=$?
+ [ $rc != 0 ] && exit $rc
+ )
+fi
+
exit $rc
diff --git a/gdb/testsuite/boards/cc-with-gnu-debuglink.exp b/gdb/testsuite/boards/cc-with-gnu-debuglink.exp
new file mode 100644
index 00000000000..ca977d9f165
--- /dev/null
+++ b/gdb/testsuite/boards/cc-with-gnu-debuglink.exp
@@ -0,0 +1,26 @@
+# Copyright 2021 Free Software Foundation, Inc.
+
+# 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/>.
+
+# This file is a dejagnu "board file" and is used to run the testsuite
+# with contrib/cc-with-tweaks.sh -l.
+#
+# Example usage:
+# bash$ cd $objdir
+# bash$ make check-gdb \
+# RUNTESTFLAGS='--target_board=cc-with-gnu-debuglink'
+#
+
+set CC_WITH_TWEAKS_FLAGS "-l"
+load_board_description "cc-with-tweaks"
next prev parent reply other threads:[~2021-05-21 11:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-20 15:29 Tom de Vries
2021-05-20 16:22 ` Simon Marchi via Gdb-patches
2021-05-20 22:04 ` Tom de Vries
2021-05-21 19:12 ` Tom de Vries
2021-05-21 11:27 ` Tom de Vries [this message]
2021-05-21 14:07 ` Simon Marchi via Gdb-patches
2021-05-24 15:20 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=df106571-69d5-3d3a-8559-3b823ad9cd31@suse.de \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@polymtl.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox