From: "Metzger, Markus T via Gdb-patches" <gdb-patches@sourceware.org>
To: Zied Guermazi <zied.guermazi@trande.de>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: RE: [PATCH 1/1] get page size using sysconf (_SC_PAGESIZE) instead of PAGE_SIZE
Date: Mon, 25 Apr 2022 05:03:07 +0000 [thread overview]
Message-ID: <DM8PR11MB5749BCE58C1650C60FF604AFDEF89@DM8PR11MB5749.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20220424211541.70674-2-zied.guermazi@trande.de>
Hello Zied,
>diff --git a/gdb/nat/linux-btrace.c b/gdb/nat/linux-btrace.c
>index b0d6dcd7cf1..a9aaa9c88b3 100644
>--- a/gdb/nat/linux-btrace.c
>+++ b/gdb/nat/linux-btrace.c
>@@ -486,9 +486,10 @@ linux_enable_bts (ptid_t ptid, const struct
>btrace_config_bts *conf)
> if (fd.get () < 0)
> diagnose_perf_event_open_fail ();
>
>+ long page_size = sysconf (_SC_PAGESIZE);
Please check the return value. You may just error out but we should
detect errors, at least.
> struct perf_event_mmap_page *header = (struct perf_event_mmap_page *)
> data.get ();
>- data_offset = PAGE_SIZE;
>+ data_offset = page_size;
Hmmm, I would have expected a compiler warning, here, since PAGE_SIZE is
now long and DATA_OFFSET is __u64.
> /* Allocate the configuration page. */
>- scoped_mmap data (nullptr, PAGE_SIZE, PROT_READ | PROT_WRITE,
>MAP_SHARED,
>+ long page_size = sysconf (_SC_PAGESIZE);
Here, we'd also want to check the return value.
>@@ -661,7 +663,7 @@ linux_enable_pt (ptid_t ptid, const struct
>btrace_config_pt *conf)
> size_t length;
> __u64 data_size;
>
>- data_size = (__u64) pages * PAGE_SIZE;
>+ data_size = (__u64) pages * page_size;
Hmmm, this also looks like the compiler would want to warn about
signed and unsigned multiply.
Regards,
Markus.
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
next prev parent reply other threads:[~2022-04-25 5:03 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
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 via Gdb-patches [this message]
2022-04-25 7:02 ` Zied Guermazi
2022-04-25 7:36 ` Metzger, Markus T via Gdb-patches
2022-04-25 0:13 ` [PATCH 0/1] btrace: " Simon Marchi via Gdb-patches
2022-04-25 6:54 ` Zied Guermazi
2022-04-25 18:47 ` John Baldwin
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
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
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=DM8PR11MB5749BCE58C1650C60FF604AFDEF89@DM8PR11MB5749.namprd11.prod.outlook.com \
--to=gdb-patches@sourceware.org \
--cc=markus.t.metzger@intel.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