public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: "Metzger, Markus T" <markus.t.metzger@intel.com>
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 07:36:07 +0000	[thread overview]
Message-ID: <DM8PR11MB5749FF55A5FC589A8BC6EDF2DEF89@DM8PR11MB5749.namprd11.prod.outlook.com> (raw)
In-Reply-To: <1a6a663b-0ea3-3704-402f-9a1ad49822da@trande.de>

Hello Zied,


Please check the return value.  You may just error out but we should

detect errors, at least.
[Zied] according to man pages the returned values should not be below 1. I will check against it and write a warning message.

I’m referring to: “
On  error,  -1 is returned and errno is set to indicate the cause of the error
“.



  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.

[Zied] I go a clean compilation on my machine. here is the outcome:

"build_intel/gdb$ make
  CXX    nat/linux-btrace.o
  GEN    init.c
  CXXLD  gdb
"

Do you recommend casting page_size to a __u64?
You may need to enable warnings.    I’m configuring with “
--enable-build-warnings --enable-gdb-build-warnings --enable-werror
“ but I have not checked this case myself.

The original PAGE_SIZE macro is defined as (1UL << PAGE_SHIFT).  After checking for errors, we
should probably cast it to an appropriate unsigned type.

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

  reply	other threads:[~2022-04-25  7:36 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
2022-04-25  7:02     ` Zied Guermazi
2022-04-25  7:36       ` Metzger, Markus T [this message]
2022-04-25  0:13 ` [PATCH 0/1] btrace: " Simon Marchi
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=DM8PR11MB5749FF55A5FC589A8BC6EDF2DEF89@DM8PR11MB5749.namprd11.prod.outlook.com \
    --to=markus.t.metzger@intel.com \
    --cc=gdb-patches@sourceware.org \
    --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).