public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@palves.net>
To: Zied Guermazi <zied.guermazi@trande.de>,
	Andreas Schwab <schwab@linux-m68k.org>,
	Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 1/1] get page size using sysconf (_SC_PAGESIZE) instead of PAGE_SIZE
Date: Mon, 2 May 2022 19:55:13 +0100	[thread overview]
Message-ID: <12ded5b8-54c4-b336-2fbf-1a0417ce4361@palves.net> (raw)
In-Reply-To: <2ab7945d-5355-586c-1af5-7b465586d01c@trande.de>

On 2022-05-02 19:01, Zied Guermazi wrote:
> hi Pedro,
> 
> I think I can clarify the situation here by giving more insight on the context. A short explanation is needed.
> 
> In current build system linux-btrace.c is only included when the host is a Linux running of an i386 cpu. (see gdb/configure.nat).  so the point of Andreas is pertinent with no further explanations of additional planned changes.
> 
> This patch is a preparation for another patch set for adding btrace on arm processors using ARM Coresight ETM traces. (see the patch set https://pi.simark.ca/gdb-patches/20210531213307.275079-1-zied.guermazi@trande.de/#r ). Markus Metzger in his review recommended submitting this change in a separated patch.
> 
> In the patch set for adding btrace on arm,  there is a need to build linux-btrace.c for hosts linux/aarch64 and linux/arm. gdb/configure.nat at line 233 looks now as following:
> 
> "
> 
>  /   linux)//
> //    case ${gdb_host_cpu} in//
> //        aarch64)//
> //        #  Host: AArch64 based machine running GNU/Linux//
> //        NATDEPFILES="${NATDEPFILES} aarch64-nat.o aarch64-linux-nat.o \//
> //        aarch32-linux-nat.o nat/aarch64-hw-point.o \//
> //        nat/aarch64-linux-hw-point.o \//
> //        nat/aarch64-linux.o \//
> //        *nat/linux-btrace.o* \//
> //        nat/aarch64-sve-linux-ptrace.o \//
> //        nat/aarch64-mte-linux-ptrace.o"//
> //        ;;//
> //        arc)//
> //        # Host: ARC based machine running GNU/Linux//
> //        NATDEPFILES="${NATDEPFILES} arc-linux-nat.o"//
> //        ;;//
> //        arm)//
> //        # Host: ARM based machine running GNU/Linux//
> //        NATDEPFILES="${NATDEPFILES} arm-linux-nat.o \//
> //        aarch32-linux-nat.o *nat/linux-btrace.o*"//
> //        ;;/
> 
> "
> 
> which means that the file is now included in the build for linux/aarch64 and linux/arm
> 
> 
> I have observed this issue when the build machine was an intel x86,  host and target were both aarch64-linux (and also arm-linux)

OK, thanks, that clarifies things.  I wasn't aware of that patch series.  The build and target machines (in autoconf terms) are
really irrelevant here.  The only machine that matters here is the host one.

> 
> using following configuration
> 
> "../binutils-gdb/configure --host aarch64-linux-gnu --target=aarch64-linux-gnu --disable-ld --disable-gold --disable-gas --disable-sim --disable-gprofng --with-arm-cs "
> 
> and when building natively on Debian on aarch64 and Debian on arm.

Did you really run configure on one machine, and then typed "make" on a different machine?
Anyhow, doesn't matter.

> 
> I was getting following build error message
> 
> "
> /../../binutils-gdb/gdb/nat/linux-btrace.c:799:30: error: ‘PAGE_SIZE’ was not declared in this scope; did you mean ‘PTRACE_SEIZE’?//
> //  799 |   scoped_mmap data (nullptr, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED,//
> //      |                              ^~~~~~~~~//
> //      |                              PTRACE_SEIZE/
> 
> "
> 
> The issue was fixed with this patch.

Right.

So in the commit log, instead of:

 "PAGE_SIZE is not defined in all build configurations, e.g cross compiling
 for aarch64 GNU/Linux machine. This patch gets the value at runtime using 
 posix call sysconf (_SC_PAGESIZE)"

don't mention cross compiling at all, as that just confuses things.

I'd suggest instead:

 "Currently, linux-btrace.c is only built when the host is x86 or x86_64 GNU/Linux.
 Later patches will add btrace support on ARM processors using ARM Coresight ETM traces.
 That ran into the fact that PAGE_SIZE is not defined on Aarch64.  This patch fixes that
 by getting the page size value at runtime using POSIX sysconf(_SC_PAGESIZE) instead."

Pedro Alves

  reply	other threads:[~2022-05-02 18:55 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-30 12:16 [PATCH v4 0/1] " Zied Guermazi
2022-04-30 12:16 ` [PATCH 1/1] " Zied Guermazi
2022-04-30 12:29   ` Andreas Schwab
2022-04-30 12:32     ` Zied Guermazi
2022-04-30 12:52       ` Andreas Schwab
2022-04-30 12:58         ` Zied Guermazi
2022-04-30 13:03           ` Andreas Schwab
2022-04-30 13:25             ` Zied Guermazi
2022-04-30 13:33               ` Andreas Schwab
2022-05-02 16:46                 ` Pedro Alves
2022-05-02 18:01                   ` Zied Guermazi
2022-05-02 18:55                     ` Pedro Alves [this message]
2022-05-02 19:16                       ` Zied Guermazi
2022-05-02 16:38   ` Tom Tromey
2022-05-02 16:50     ` Pedro Alves
2022-05-02 17:04       ` Tom Tromey
2022-05-02 17:08         ` Pedro Alves
  -- strict thread matches above, loose matches on Subject: below --
2022-04-24 21:15 [PATCH 0/1] btrace: " Zied Guermazi
2022-04-24 21:15 ` [PATCH 1/1] " Zied Guermazi
2022-04-25  5:03   ` Metzger, Markus T
2022-04-25  7:02     ` Zied Guermazi
2022-04-25  7:36       ` Metzger, Markus T

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=12ded5b8-54c4-b336-2fbf-1a0417ce4361@palves.net \
    --to=pedro@palves.net \
    --cc=gdb-patches@sourceware.org \
    --cc=schwab@linux-m68k.org \
    --cc=tom@tromey.com \
    --cc=zied.guermazi@trande.de \
    /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).