public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] [gdb/contrib] Require minimal dwz version in cc-with-tweaks.sh
@ 2023-08-31 11:56 Tom de Vries
  2023-08-31 13:18 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2023-08-31 11:56 UTC (permalink / raw)
  To: gdb-patches

I usually run target boards cc-with-dwz and cc-with-dwz-m using a dwz build
from current trunk, but the pathname to the build dir changed and I forgot to
update my test scripts, so the test scripts reverted to using system dwz,
version 0.12.

Consequently, I ran into:
...
(gdb) p ZERO^M
No symbol "ZERO" in current context.^M
(gdb) FAIL: gdb.base/enumval.exp: p ZERO
...
which is due to PR dwz/24468, which was fixed in version 0.13.

Fix this by minimally requiring dwz version 0.13 in cc-with-tweaks.sh, such
that this situation is detected and we get instead:
...
gdb compile failed, cc-with-tweaks.sh: dwz version 0.12 detected, version \
  0.13 or higher required
...

Tested on x86_64-linux, verified with shellcheck.
---
 gdb/contrib/cc-with-tweaks.sh | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/gdb/contrib/cc-with-tweaks.sh b/gdb/contrib/cc-with-tweaks.sh
index 8add32d54a3..62d3bcf9707 100755
--- a/gdb/contrib/cc-with-tweaks.sh
+++ b/gdb/contrib/cc-with-tweaks.sh
@@ -209,6 +209,24 @@ if [ "$want_index" = true ]; then
     [ $rc != 0 ] && exit $rc
 fi
 
+if [ "$want_dwz" = true ] || [ "$want_multi" = true ]; then
+    # Require dwz version with PR dwz/24468 fixed.
+    dwz_version_major_required=0
+    dwz_version_minor_required=13
+    dwz_version_line=$($DWZ --version 2>&1 | head -n 1)
+    dwz_version=${dwz_version_line//dwz version /}
+    dwz_version_major=${dwz_version//\.*/}
+    dwz_version_minor=${dwz_version//*\./}
+    if [ "$dwz_version_major" -lt "$dwz_version_major_required" ] \
+	   || { [ "$dwz_version_major" -eq "$dwz_version_major_required" ] \
+		    && [ "$dwz_version_minor" -lt "$dwz_version_minor_required" ]; }; then
+	detected="$dwz_version_major.$dwz_version_minor"
+	required="$dwz_version_major_required.$dwz_version_minor_required"
+	echo "$myname: dwz version $detected detected, version $required or higher required"
+	exit 1
+    fi
+fi
+
 if [ "$want_dwz" = true ]; then
     # Validate dwz's result by checking if the executable was modified.
     cp "$output_file" "${output_file}.copy"

base-commit: 959db212304e64751563bcaaacbdd28efd5016a7
-- 
2.35.3


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] [gdb/contrib] Require minimal dwz version in cc-with-tweaks.sh
  2023-08-31 11:56 [PATCH] [gdb/contrib] Require minimal dwz version in cc-with-tweaks.sh Tom de Vries
@ 2023-08-31 13:18 ` Tom Tromey
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2023-08-31 13:18 UTC (permalink / raw)
  To: Tom de Vries via Gdb-patches; +Cc: Tom de Vries

>>>>> "Tom" == Tom de Vries via Gdb-patches <gdb-patches@sourceware.org> writes:

Tom> Fix this by minimally requiring dwz version 0.13 in cc-with-tweaks.sh, such
Tom> that this situation is detected and we get instead:
Tom> ...
Tom> gdb compile failed, cc-with-tweaks.sh: dwz version 0.12 detected, version \
Tom>   0.13 or higher required
Tom> ...

Seems fine to me.
Approved-By: Tom Tromey <tom@tromey.com>

Tom

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-08-31 13:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-31 11:56 [PATCH] [gdb/contrib] Require minimal dwz version in cc-with-tweaks.sh Tom de Vries
2023-08-31 13:18 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).