public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: [pushed] gdbserver/linux-x86: move lwp declaration out of __x86_64__ region
Date: Fri, 18 Nov 2022 12:19:25 -0500	[thread overview]
Message-ID: <20221118171925.944900-1-simon.marchi@polymtl.ca> (raw)

From: Simon Marchi <simon.marchi@efficios.com>

Commit 4855cbdc3d8f ("gdbserver/linux-x86: make is_64bit_tdesc accept
thread as a parameter") caused this when building in 32 bits / i386
mode:

      CXX    linux-x86-low.o
    In file included from /home/smarchi/src/binutils-gdb/gdbserver/linux-x86-low.cc:24:
    /home/smarchi/src/binutils-gdb/gdbserver/linux-x86-low.cc: In member function ‘virtual int x86_target::low_get_thread_area(int, CORE_ADDR*)’:
    /home/smarchi/src/binutils-gdb/gdbserver/linux-x86-low.cc:357:47: error: ‘lwp’ was not declared in this scope
      357 |     struct thread_info *thr = get_lwp_thread (lwp);
          |                                               ^~~
    /home/smarchi/src/binutils-gdb/gdbserver/linux-low.h:709:31: note: in definition of macro ‘get_lwp_thread’
      709 | #define get_lwp_thread(lwp) ((lwp)->thread)
          |                               ^~~

This is because it moved the lwp variable declaration inside the
__x86_64__ guard, making it unavailable when building in 32 bits mode.
Move the lwp variable outside of the __x86_64__ region.

Change-Id: I7fa3938c6b44b345c27a52c8b8d3ea12aba53e05
---
 gdbserver/linux-x86-low.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdbserver/linux-x86-low.cc b/gdbserver/linux-x86-low.cc
index 93f6da672937..b24791f21275 100644
--- a/gdbserver/linux-x86-low.cc
+++ b/gdbserver/linux-x86-low.cc
@@ -335,9 +335,9 @@ ps_get_thread_area (struct ps_prochandle *ph,
 int
 x86_target::low_get_thread_area (int lwpid, CORE_ADDR *addr)
 {
-#ifdef __x86_64__
   lwp_info *lwp = find_lwp_pid (ptid_t (lwpid));
   gdb_assert (lwp != nullptr);
+#ifdef __x86_64__
   int use_64bit = is_64bit_tdesc (get_lwp_thread (lwp));
 
   if (use_64bit)

base-commit: c0cb02a4cf590f3cb64cdcc1b5bf539196333160
-- 
2.38.1


                 reply	other threads:[~2022-11-18 17:19 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=20221118171925.944900-1-simon.marchi@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@efficios.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).