public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@palves.net>
To: Tom de Vries <tdevries@suse.de>, Tom Tromey <tom@tromey.com>,
	Tom de Vries via Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [pushed] [gdb/testsuite] Add and use is_x86_64_m64_target
Date: Thu, 26 Jan 2023 18:34:08 +0000	[thread overview]
Message-ID: <6fb4b81f-fe82-4e5f-01b5-b93cc518961e@palves.net> (raw)
In-Reply-To: <2d0bbb89-e68c-7098-58ad-ad2eed5e1355@suse.de>

On 2023-01-26 5:08 p.m., Tom de Vries via Gdb-patches wrote:
> On 1/26/23 17:38, Pedro Alves wrote:
>> On 2023-01-26 4:10 p.m., Tom Tromey wrote:
>>>>>>>> "Tom" == Tom de Vries via Gdb-patches <gdb-patches@sourceware.org> writes:
>>>
>>> Tom> On 1/26/23 10:17, Tom de Vries wrote:
>>>>> ./gdb.base/jit-reader.exp:
>>>>>    require {is_any_target "i?86-*-*" "x86_64-*-*"} is_lp64_target
>>>>> ./gdb.arch/amd64-i386-address.exp:
>>>>>    require {is_any_target "x86_64-*-*" "i?86-*-*"} is_lp64_target
>>>
>>> Tom> And, doesn't is_lp64_target imply that we're not on an "i?86-*-*" ?
>>>
>>> Tom> Am I missing something here?
>>>
>>> I am not sure.  Can you use 'gcc -m64' on an x86?
>>
>> Yeah, you can.  CodeSourcery toolchains used to be like that back in the day -- 32-bit
>> hosted, so the target triplet indicated 32-bit, but you could use -m64 for 64-bit.
>> No clue what they do nowadays.
> 
> Ah, that's interesting, thanks.
> 
> So, perhaps then you could indeed end up with is_lp64_target == true on an i?86 (by using target board unix/-m64).

Right.

> 
> But assuming you would end up with a complete 64-bit executable, you still wouldn't been able to run it on the 32-bit target, so I think it's a corner-case that doesn't prevent us from dropping the i?86 test here.

Don't know whether that's true on all operating systems.

I may be misremembering -- it may be that gdb was actually built as 64-bit,
but with the toolchain configured to target 32-bit by default (and thus with 32-bit triplet).
In that case, then debugging would work.

See:

  https://sourceware.org/pipermail/gdb-patches/2009-April/064685.html

"x86 -m64" is also why is_amd64_regs_target also runs the test for [istarget "i?86-*"]:

 # Return 1 if target has x86_64 registers - either amd64 or x32.
 # x32 target identifies as x86_64-*-linux*, therefore it cannot be determined
 # just from the target string.
 gdb_caching_proc is_amd64_regs_target {
     if {![istarget "x86_64-*-*"] && ![istarget "i?86-*"]} {
 	return 0
     }

Pedro Alves

> 
> Thanks,
> - Tom
> 
>>
>> Pedro Alves
>>
>>> Or could you have a
>>> 64-bit machine that advertises as i386 if userspace is mostly 32-bit?
>>
>>


  parent reply	other threads:[~2023-01-26 18:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-25 20:06 [RFC 0/3] [gdb/testsuite] Introduce is_x86_64_m64_target Tom de Vries
2023-01-25 20:06 ` [RFC 1/3] [gdb/contrib] Add refactor.py Tom de Vries
2023-01-25 20:06 ` [RFC 2/3] [gdb/contrib] Add refactor_require.py Tom de Vries
2023-01-25 20:06 ` [RFC 3/3] [gdb/testsuite] Add and use is_x86_64_m64_target Tom de Vries
2023-01-25 21:25   ` Tom Tromey
2023-01-26  9:17     ` [pushed] " Tom de Vries
2023-01-26 15:48       ` Tom de Vries
2023-01-26 16:10         ` Tom Tromey
2023-01-26 16:36           ` Tom de Vries
2023-01-26 16:38           ` Pedro Alves
2023-01-26 17:08             ` Tom de Vries
2023-01-26 18:25               ` Tom Tromey
2023-01-26 18:34               ` Pedro Alves [this message]
2023-01-25 21:26 ` [RFC 0/3] [gdb/testsuite] Introduce is_x86_64_m64_target Tom Tromey
2023-01-26  9:30   ` Tom de Vries

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=6fb4b81f-fe82-4e5f-01b5-b93cc518961e@palves.net \
    --to=pedro@palves.net \
    --cc=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    --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).