Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: "Aktemur, Tankut Baris" <tankut.baris.aktemur@intel.com>,
	Shahab Vahedi <shahab.vahedi@gmail.com>
Cc: Anton Kolesov <Anton.Kolesov@synopsys.com>,
	Shahab Vahedi <shahab@synopsys.com>,
	"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
	Francois Bedard <fbedard@synopsys.com>
Subject: Re: [PATCH] arc: Add support for Linux coredump files
Date: Mon, 28 Sep 2020 15:10:23 -0400	[thread overview]
Message-ID: <a677b233-04ab-9493-81a7-ed9976775d8d@simark.ca> (raw)
In-Reply-To: <SN6PR11MB28938622114CF7477C9DB9E7C4350@SN6PR11MB2893.namprd11.prod.outlook.com>

On 2020-09-28 10:08 a.m., Aktemur, Tankut Baris wrote:
> Hi Shahab,
>
> On Monday, September 28, 2020 3:47 PM, Shahab Vahedi wrote:
>> Hi Baris,
>>
>> On Thu, Sep 17, 2020 at 11:55:42AM +0000, Aktemur, Tankut Baris wrote:
>>>> On 2020-08-27 7:27 a.m., Shahab Vahedi via Gdb-patches wrote:
>>>> +bool
>>>> +arc_target::low_breakpoint_at (CORE_ADDR where)
>>>> +{
>>>> +  uint16_t insn;
>>>> +  uint16_t breakpoint = ntohs (TRAP_S_1_OPCODE);
>>>> +
>>>> +  the_target->read_memory (where, (gdb_byte *) &insn, TRAP_S_1_SIZE);
>>>
>>> Because 'the_target' is the same as 'this', you may want to simply call
>>> 'read_memory' without explicitly stating the receiver object.  This way,
>>> accessing the global variable could be avoided.
>>
>> Thank you very much for your input, but since it is not very obvious to
>> me where/when the "the_target" is initialized, I'd rather keep it this
>> way. Specially seeing that other targets (ARM and RISCV) doing the same.
>>
>>
>> Cheers,
>> Shahab
>
> Just for the record, there are similar uses in linux-aarch32-low.cc,
> linux-arm-low.cc, linux-low.cc, linux-sparc-low.cc, and win32-low.cc (I don't
> see it in linux-riscv-low.cc), and in all of these uses the context is a function
> (not a method) where the 'this' pointer is not available.
>
> Regards
> -Baris

FWIW, I'm leaning towards what Baris says, better use "this" than the
global variable.  And I even prefer to make it explicit,
"this->read_memory (...", to make it clear that we call a method and not
a free function.  But I don't want to start an endless discussion about
coding style :).

Simon

  reply	other threads:[~2020-09-28 19:10 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-27 11:27 Shahab Vahedi
2020-09-07  9:14 ` Shahab Vahedi
2020-09-16  2:31 ` [PING^2][PATCH] " Shahab Vahedi
2020-09-16 20:21 ` [PATCH] " Simon Marchi
2020-09-17 11:55   ` Aktemur, Tankut Baris
2020-09-28 13:47     ` Shahab Vahedi via Gdb-patches
2020-09-28 14:08       ` Aktemur, Tankut Baris via Gdb-patches
2020-09-28 19:10         ` Simon Marchi [this message]
2020-09-29  8:24           ` Shahab Vahedi via Gdb-patches
2020-09-29  9:02             ` Shahab Vahedi via Gdb-patches
2020-09-29 14:22             ` Simon Marchi
2020-09-29 15:42               ` Shahab Vahedi via Gdb-patches
2020-10-01 13:30   ` Shahab Vahedi via Gdb-patches
2020-09-29 16:15 ` [PATCH v2] " Shahab Vahedi via Gdb-patches
2020-10-05  2:13   ` Simon Marchi
2020-10-07 16:11 ` [PUSHED master] " Shahab Vahedi via Gdb-patches
2020-10-07 16:32 ` [PUSHED gdb-10-branch] " Shahab Vahedi via Gdb-patches

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=a677b233-04ab-9493-81a7-ed9976775d8d@simark.ca \
    --to=simark@simark.ca \
    --cc=Anton.Kolesov@synopsys.com \
    --cc=fbedard@synopsys.com \
    --cc=gdb-patches@sourceware.org \
    --cc=shahab.vahedi@gmail.com \
    --cc=shahab@synopsys.com \
    --cc=tankut.baris.aktemur@intel.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