From: Simon Marchi <simon.marchi@polymtl.ca>
To: Tom de Vries <tdevries@suse.de>,
gdb-patches@sourceware.org,
Pedro Alves <palves@redhat.com>
Subject: Re: [RFC, gdb/contrib] Fix gdb/contrib/gdb-add-index.sh for dwz-m-ed execs
Date: Sun, 12 May 2019 19:49:00 -0000 [thread overview]
Message-ID: <852d3210-f59a-1540-ed23-19f31829f465@polymtl.ca> (raw)
In-Reply-To: <a9b93e9b-3d9b-844c-4db4-d44c2e1a9e9e@suse.de>
On 2019-05-07 12:13 p.m., Tom de Vries wrote:
> [ was: Re: [PATCH][gdb] Write index for dwz -m file ]
>
>
> Hi,
>
> This is a follow-up patch for "[gdb] Write index for dwz -m file".
>
> Any comments on the updated gdb/contrib/gdb-add-index.sh script?
>
> In particular, I'd like some advice on whether I should add shell
> variables (as I've done for readelf) for grep, tail and sed.
>
> Thanks,
> - Tom
>
Hi Tom,
I think it can be useful to override gdb, readelf and objcopy, as it is likely
that people will want to use specific versions of these (either newer, or
specific to their architectures).
But it's not very likely for grep, tail and sed, as long as we make sure that
we are compatible with the BSD versions of these tools. That would mean making
sure we only use features defined by POSIX.
One case that isn't handled correct by GDB and/or the script (with both my and
your patch applied) is running the script on two executables that share the same
external dwz file. It will fail adding the index to the dwz file the second time.
This use case is kind of important, because the point of having dwz files is to
share it between multiple executables.
This is what I get the second time:
$ GDB="/home/simark/build/binutils-gdb/gdb/gdb --data-directory=/home/simark/build/binutils-gdb/gdb/data-directory" ~/src/binutils-gdb/gdb/contrib/gdb-add-index.sh b
+ objcopy --add-section .gdb_index=shared-debug-info.dwz.gdb-index --set-section-flags .gdb_index=readonly shared-debug-info.dwz shared-debug-info.dwz
objcopy:std9IdCI: can't add section '.gdb_index': file in wrong format
I haven't looked in more details for this problem.
There's a buglet in the clean up code causing the dwz file's index
(shared-debug-info.dwz.gdb-index in my case) to be left in the current directory after
running the script (even successfully). This fixes it:
---
diff --git a/gdb/contrib/gdb-add-index.sh b/gdb/contrib/gdb-add-index.sh
index afedce0c848d..2b3af2e84f71 100755
--- a/gdb/contrib/gdb-add-index.sh
+++ b/gdb/contrib/gdb-add-index.sh
@@ -70,7 +70,7 @@ for f in "$file" "$dwz_file"; do
if [ "$f" = "" ]; then
continue
fi
- set_files "$file"
+ set_files "$f"
tmp_files="$tmp_files $index4 $index5 $debugstr $debugstrmerge $debugstrerr"
done
---
Simon
next prev parent reply other threads:[~2019-05-12 19:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-07 14:42 [PATCH][gdb] Write index for dwz -m file Tom de Vries
2019-05-07 16:13 ` [RFC, gdb/contrib] Fix gdb/contrib/gdb-add-index.sh for dwz-m-ed execs Tom de Vries
2019-05-12 19:49 ` Simon Marchi [this message]
2019-05-13 10:47 ` Tom de Vries
2019-06-10 18:41 ` [PATCH, " Tom de Vries
2019-06-16 17:41 ` Simon Marchi
2019-05-11 2:36 ` [PATCH][gdb] Write index for dwz -m file Simon Marchi
2019-05-13 12:22 ` Tom de Vries
2019-05-13 13:56 ` Simon Marchi
2019-06-16 10:43 ` [PING][PATCH][gdb] " Tom de Vries
2019-06-16 17:22 ` Simon Marchi
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=852d3210-f59a-1540-ed23-19f31829f465@polymtl.ca \
--to=simon.marchi@polymtl.ca \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
--cc=tdevries@suse.de \
/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