From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [committed][gdb/testsuite] Fix c-linkage-name.exp with {cc-with-gdb-index,readnow}.exp
Date: Mon, 30 Mar 2020 10:53:52 +0200 [thread overview]
Message-ID: <20200330085351.GA19384@delia> (raw)
Hi,
When running test-case gdb.base/c-linkage-name.exp with target board
cc-with-gdb-index.exp, I see:
...
FAIL: gdb.base/c-linkage-name.exp: maint info psymtab: c-linkage-name-2.c: no
FAIL: gdb.base/c-linkage-name.exp: maint info psymtab: c-linkage-name-2.c: yes
...
The FAILs are due to the fact that partial symbol tables are not generated for
indexed executables.
When running the same test-case with target board readnow.exp, I see:
...
FAIL: gdb.base/c-linkage-name.exp: maint info psymtab: c-linkage-name-2.c: no
FAIL: gdb.base/c-linkage-name.exp: print symada__cS before partial symtab \
expansion
FAIL: gdb.base/c-linkage-name.exp: maint info psymtab: c-linkage-name-2.c: yes
...
The "maint info psymtab" FAILs are also due to fact that the partial symbol
tables not generated, but in this case it's because the symtabs are fully
expanded upon load due to using -readnow. The "print symada__cS before
partial symtab expansion" test intends to test the state before symbol table
expansion, and with -readnow that's not possible.
Mark these FAILs as UNSUPPORTED.
Tested on x86_64-linux, with native, and target boards cc-with-gdb-index.exp,
cc-with-debug-names.exp and readnow.exp.
Committed to trunk.
Thanks,
- Tom
[gdb/testsuite] Fix c-linkage-name.exp with {cc-with-gdb-index,readnow}.exp
gdb/testsuite/ChangeLog:
2020-03-30 Tom de Vries <tdevries@suse.de>
* gdb.base/c-linkage-name.exp: Use readnow call to mark a test
unsupported.
(verify_psymtab_expanded): Move ...
* lib/gdb.exp (verify_psymtab_expanded): ... here. Add unsupported
test.
(readnow): New proc.
---
gdb/testsuite/gdb.base/c-linkage-name.exp | 27 ++++++++--------------
gdb/testsuite/lib/gdb.exp | 38 +++++++++++++++++++++++++++++++
2 files changed, 48 insertions(+), 17 deletions(-)
diff --git a/gdb/testsuite/gdb.base/c-linkage-name.exp b/gdb/testsuite/gdb.base/c-linkage-name.exp
index 4551c8dcac..9a472a79a2 100644
--- a/gdb/testsuite/gdb.base/c-linkage-name.exp
+++ b/gdb/testsuite/gdb.base/c-linkage-name.exp
@@ -26,30 +26,23 @@ if { [gdb_compile "${sources}" "${binfile}" executable {debug}] != "" } {
}
clean_restart ${binfile}
-
-# Verify that partial symtab expansion for $filename has state $readin
-
-proc verify_psymtab_expanded { filename readin } {
- set cmd "maint info psymtab"
- set test "$cmd: $filename: $readin"
- set re [multi_line \
- " \{ psymtab \[^\r\n\]*$filename\[^\r\n\]*" \
- " readin $readin" \
- ".*"]
-
- gdb_test $cmd $re $test
-}
+set readnow [readnow]
# Verify that partial symtab expansion has not taken place for
# c-linkage-name-2.c.
verify_psymtab_expanded c-linkage-name-2.c no
-# Try to print MUNDANE, but using its linkage name.
+set test "print symada__cS before partial symtab expansion"
+if { $readnow } {
+ unsupported $test
+} else {
+ # Try to print MUNDANE, but using its linkage name.
-gdb_test "print symada__cS" \
- "'symada__cS' has unknown type; cast it to its declared type" \
- "print symada__cS before partial symtab expansion"
+ gdb_test "print symada__cS" \
+ "'symada__cS' has unknown type; cast it to its declared type" \
+ $test
+}
# Force the symbols to be expanded for the unit that contains
# our symada__cS symbol by, e.g. inserting a breakpoint on one
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index e17ac0ef75..3bd08816b6 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -6982,5 +6982,43 @@ gdb_caching_proc supports_statement_frontiers {
} executable "additional_flags=-gstatement-frontiers"]
}
+# Return 1 if symbols were read in using -readnow. Otherwise, return 0.
+
+proc readnow { } {
+ set cmd "maint print objfiles"
+ gdb_test_multiple $cmd "" {
+ -re -wrap "\r\n.gdb_index: faked for \"readnow\"\r\n.*" {
+ return 1
+ }
+ -re -wrap "" {
+ return 0
+ }
+ }
+
+ return 0
+}
+
+# Verify that partial symtab expansion for $filename has state $readin.
+
+proc verify_psymtab_expanded { filename readin } {
+ global gdb_prompt
+
+ set cmd "maint info psymtab"
+ set test "$cmd: $filename: $readin"
+ set re [multi_line \
+ " \{ psymtab \[^\r\n\]*$filename\[^\r\n\]*" \
+ " readin $readin" \
+ ".*"]
+
+ gdb_test_multiple $cmd $test {
+ -re "$cmd\r\n$gdb_prompt $" {
+ unsupported $gdb_test_name
+ }
+ -re -wrap $re {
+ pass $gdb_test_name
+ }
+ }
+}
+
# Always load compatibility stuff.
load_lib future.exp
reply other threads:[~2020-03-30 8:53 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20200330085351.GA19384@delia \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.org \
/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