From: Shahab Vahedi via Gdb-patches <gdb-patches@sourceware.org>
To: "Aktemur, Tankut Baris" <tankut.baris.aktemur@intel.com>,
Simon Marchi <simark@simark.ca>
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: Tue, 29 Sep 2020 10:24:56 +0200 [thread overview]
Message-ID: <20200929082456.GB4717@gmail.com> (raw)
In-Reply-To: <a677b233-04ab-9493-81a7-ed9976775d8d@simark.ca>
Hi Baris, Simon,
On Mon, Sep 28, 2020 at 03:10:23PM -0400, Simon Marchi wrote:
> On 2020-09-28 10:08 a.m., Aktemur, Tankut Baris wrote:
> >
> > 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.
I've looked into those files in master branch [1] which at the time
was at commit 9aed480c3a7. The relevant results are:
--------
==> linux-aarch32-low.relevant_grep_results <==
the_target->read_memory (where, (unsigned char *) &insn, 2);
the_target->read_memory (where + 2, (unsigned char *) &insn, 2);
the_target->read_memory (where, (unsigned char *) &insn, 4);
if (target_read_memory (*pcptr, buf, 2) == 0)
target_read_memory (*pcptr, (gdb_byte *) &inst1, 2);
==> linux-arm-low.relevant_grep_results <==
target_read_memory (memaddr, (unsigned char *) &res, len);
the_target->read_memory (sp, (unsigned char *) &sp_data, 4);
the_target->read_memory (sp + pc_offset, (unsigned char *) &next_pc, 4);
the_target->read_memory (sp + pc_offset + 4, (unsigned char *) &cpsr, 4);
target_read_memory (pc, (unsigned char *) &this_instr, 4);
if (read_memory (pc - 4, (unsigned char *) &insn, 4))
==> linux-low.relevant_grep_results <==
return the_target->read_memory (memaddr, myaddr, len);
==> linux-riscv-low.relevant_grep_results <==
if (target_read_memory (*pcptr, buf.bytes, sizeof (buf.insn)) == 0
if (target_read_memory (pc, buf.bytes, sizeof (buf.insn)) == 0
&& target_read_memory (pc + sizeof (buf.insn), buf.bytes,
==> linux-sparc-low.relevant_grep_results <==
the_target->read_memory (addr, tmp_reg_buf, sizeof (tmp_reg_buf));
read_memory (where, (unsigned char *) insn, sizeof (insn));
==> win32-low.relevant_grep_results <==
--------
First, I am confused, because apparently there are 3 ways to
skin a target's memory [2]:
the_target->read_memory() 8 occurrences
target_read_memory() 7 occurrences
read_memory() 2 occurrences
"the_target->read_memory()" and "read_memory()" should be the
same in terms of code execution (not code writing). Then,
there is "target_read_memory()" which I think is the default
implementation [3].
Maybe it is my style, but I dislike hunting the implementation
of a pure virtual method somewhere along the inheritance line
(lineage? :p). Since ARC is not overriding the "read_memory()",
it is more meaningful to use the "target_read_memory()". I will
be changing "the_target->read_memory()" to that then.
[1] Master branch at commit 9aed480c3a7
https://sourceware.org/git/?p=binutils-gdb.git;hb=HEAD;a=tree
[2]
To be clear, what I mean is "There are 3 flavors". I just couldn't
leave this joke alone.
[3]
"process_stratum_target" class (the base) provides
"read_memory()" as pure virtual method. Therefore, it must be defined
overridden somewhere and I _think_ this is the default implementation.
> 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 :).
Please see my answer above.
next prev parent reply other threads:[~2020-09-29 8:24 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
2020-09-29 8:24 ` Shahab Vahedi via Gdb-patches [this message]
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=20200929082456.GB4717@gmail.com \
--to=gdb-patches@sourceware.org \
--cc=Anton.Kolesov@synopsys.com \
--cc=fbedard@synopsys.com \
--cc=shahab.vahedi@gmail.com \
--cc=shahab@synopsys.com \
--cc=simark@simark.ca \
--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