From: Daniel Xu <dxu@dxuuu.xyz>
To: gdb-patches@sourceware.org, tom@tromey.com
Subject: [PATCH] rust: Fix rust modules test
Date: Fri, 3 Jul 2020 20:59:53 -0700 [thread overview]
Message-ID: <20200704035953.849933-1-dxu@dxuuu.xyz> (raw)
I noticed that the modules test was failing. Some choice use of `nm`
revealed `TWENTY_THREE` was not in the final binary. Fix by taking a
pointer to the global, forcing the linker to keep the symbol in.
gdb/testsuite/
* gdb.rust/modules.rs: Prevent linker from discarding test
symbol
Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
---
Changes from V0:
* Take pointer to global instead. Should be more reliable than using
the global twice.
gdb/testsuite/gdb.rust/modules.rs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.rust/modules.rs b/gdb/testsuite/gdb.rust/modules.rs
index 6db082817b..479e6529cd 100644
--- a/gdb/testsuite/gdb.rust/modules.rs
+++ b/gdb/testsuite/gdb.rust/modules.rs
@@ -60,7 +60,8 @@ pub mod mod1 {
let f2 = || println!("lambda f2");
- let copy = ::TWENTY_THREE;
+ // Prevent linker from discarding symbol
+ let ptr: *const u16 = &::TWENTY_THREE;
f2(); // set breakpoint here
f3();
--
2.27.0
next reply other threads:[~2020-07-04 4:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-04 3:59 Daniel Xu [this message]
2020-07-04 6:44 ` Daniel Xu
2020-07-11 22:14 ` Tom Tromey
-- strict thread matches above, loose matches on Subject: below --
2020-07-04 3:27 Daniel Xu
2020-07-06 9:32 ` Tom de Vries
2020-07-07 5:16 ` Daniel Xu
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=20200704035953.849933-1-dxu@dxuuu.xyz \
--to=dxu@dxuuu.xyz \
--cc=gdb-patches@sourceware.org \
--cc=tom@tromey.com \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).