From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id ptjtNkGZp2AidwAAWB0awg (envelope-from ) for ; Fri, 21 May 2021 07:28:01 -0400 Received: by simark.ca (Postfix, from userid 112) id D19891F11C; Fri, 21 May 2021 07:28:01 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=MAILING_LIST_MULTI, RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id A673F1E01F for ; Fri, 21 May 2021 07:28:00 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DD37D385703A; Fri, 21 May 2021 11:27:59 +0000 (GMT) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id D6E6B385703A for ; Fri, 21 May 2021 11:27:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D6E6B385703A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tdevries@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id EC597AAA6; Fri, 21 May 2021 11:27:55 +0000 (UTC) Subject: Re: [PATCH][gdb/breakpoint] Fix assert in jit_event_handler To: Simon Marchi , gdb-patches@sourceware.org References: <20210520152938.GA31635@delia> From: Tom de Vries Message-ID: Date: Fri, 21 May 2021 13:27:55 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------8AADCE0C22B6652EF2394165" Content-Language: en-US X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" This is a multi-part message in MIME format. --------------8AADCE0C22B6652EF2394165 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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 --------------8AADCE0C22B6652EF2394165 Content-Type: text/x-patch; charset=UTF-8; name="0002-gdb-testsuite-Add-target-board-cc-with-gnu-debuglink.exp.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename*0="0002-gdb-testsuite-Add-target-board-cc-with-gnu-debuglink.ex"; filename*1="p.patch" [gdb/testsuite] Add target board cc-with-gnu-debuglink.exp Add target board cc-with-gnu-debuglink.exp that splits off debuginfo into=20 a seperate .debug file and links to it using .gnu_debuglink. Tested on x86_64-linux. gdb/ChangeLog: 2021-05-21 Tom de Vries * contrib/cc-with-tweaks.sh: Handle -l. gdb/testsuite/ChangeLog: 2021-05-21 Tom de Vries * 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.s= h 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 -gspli= t-dwarf +# -l creates separate debuginfo files linked to using .gnu_debuglink # If nothing is given, no changes are made =20 myname=3Dcc-with-tweaks.sh @@ -83,6 +84,7 @@ want_dwz=3Dfalse want_multi=3Dfalse want_dwp=3Dfalse want_objcopy_compress=3Dfalse +want_gnu_debuglink=3Dfalse =20 while [ $# -gt 0 ]; do case "$1" in @@ -92,6 +94,7 @@ while [ $# -gt 0 ]; do -n) want_index=3Dtrue; index_options=3D-dwarf-5;; -m) want_multi=3Dtrue ;; -p) want_dwp=3Dtrue ;; + -l) want_gnu_debuglink=3Dtrue ;; *) break ;; esac shift @@ -158,7 +161,12 @@ fi =20 get_tmpdir () { - tmpdir=3D$(dirname "$output_file")/.tmp + subdir=3D"$1" + if [ "$subdir" =3D "" ]; then + subdir=3D.tmp + fi + + tmpdir=3D$(dirname "$output_file")/"$subdir" mkdir -p "$tmpdir" } =20 @@ -234,4 +242,40 @@ if [ "$want_dwp" =3D true ]; then fi fi =20 +if [ "$want_gnu_debuglink" =3D 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=3D"$tmpdir"/$(basename "$output_file").stripped + debug_file=3D"$tmpdir"/$(basename "$output_file").debug + + # Create stripped and debug versions of output_file. + strip --strip-debug "${output_file}" \ + -o "${stripped_file}" + rc=3D$? + [ $rc !=3D 0 ] && exit $rc + strip --only-keep-debug "${output_file}" \ + -o "${debug_file}" + rc=3D$? + [ $rc !=3D 0 ] && exit $rc + + # The .gnu_debuglink is supposed to contain no leading directories. + link=3D$(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=3D"$link" "${stripped_file}" \ + "${output_file}" + rc=3D$? + [ $rc !=3D 0 ] && exit $rc + ) +fi + exit $rc diff --git a/gdb/testsuite/boards/cc-with-gnu-debuglink.exp b/gdb/testsui= te/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 . + +# 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=3D'--target_board=3Dcc-with-gnu-debuglink' +# + +set CC_WITH_TWEAKS_FLAGS "-l" +load_board_description "cc-with-tweaks" --------------8AADCE0C22B6652EF2394165--