From: Pedro Alves <palves@redhat.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: Kaushik Phatak <Kaushik.Phatak@kpitcummins.com>,
"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
"binutils@sourceware.org" <binutils@sourceware.org>,
Pedro Alves <palves@redhat.com>,
Yao Qi <yao@codesourcery.com>,
nick clifton <nickc@redhat.com>,
Tom Tromey <tromey@redhat.com>
Subject: Re: [RFA 3/5] New port: CR16: gdb port
Date: Fri, 18 Jan 2013 18:25:00 -0000 [thread overview]
Message-ID: <50F9937F.5000508@redhat.com> (raw)
In-Reply-To: <20130117085919.GA3564@adacore.com>
On 01/17/2013 08:59 AM, Joel Brobecker wrote:
>> + /* Read 6 bytes, max 48 bit opcode. */
>> + target_read_memory (pc, buf, 6);
>> + cr16_words[0] = buf[1] << 8 | buf[0];
>> + cr16_words[1] = buf[3] << 8 | buf[2];
>> + cr16_words[2] = buf[5] << 8 | buf[4];
>> + cr16_allWords = (((ULONGLONG) cr16_words[0] << 32)
>> + + ((ULONGLONG) cr16_words[1] << 16)
>> + + cr16_words[2]);
>> +
>> + /* Find a matching opcode in table.
>> + Nonzero means instruction has a match. */
>> + is_decoded = cr16_match_opcode ();
>> + cr16_make_instruction ();
>> + length = cr16_currInsn.size;
>
> It hurts every time I read this code... Nothing you can do short
> of improving opcode, but this is really awful :-(.
This seems pretty isolated. How about exporting a function that
hides these opcodes details? I don't even pretend to understand
what the code is trying to do, and it'd be an opportunity to
comment it in the function description. :-)
/* Take BUF, do something with it, and write length
to LENGTH. Blah, blah. */
cr16_do_something (buf, *length, ...);
> static const char *const reg_names[] =
> +{
...
> + "r0r1_orig",
This too looks like a ptrace detail escaping all the
way to the user, similar to the gdbserver issues.
Any reason not to split those up? I think it'd be nicer.
...
> +};
Joel Brobecker wrote:
> The rest still looks pretty good to me :)
I agree. :-)
--
Pedro Alves
prev parent reply other threads:[~2013-01-18 18:25 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-04 10:22 Kaushik Phatak
2012-10-04 14:48 ` Joel Brobecker
2012-10-05 11:44 ` Kaushik Phatak
2012-10-05 12:21 ` Joel Brobecker
2012-10-09 13:20 ` Kaushik Phatak
2012-10-08 6:59 ` Yao Qi
2012-10-09 15:03 ` Kaushik Phatak
2012-10-22 22:41 ` Joel Brobecker
2012-10-23 13:03 ` Kaushik Phatak
2012-10-23 13:55 ` Joel Brobecker
2012-10-26 5:15 ` Kaushik Phatak
2012-11-15 17:43 ` Joel Brobecker
2012-11-20 13:01 ` Kaushik Phatak
2012-11-22 17:50 ` Joel Brobecker
2013-01-08 10:02 ` Kaushik Phatak
2013-01-15 9:31 ` Kaushik Phatak
2013-01-17 8:59 ` Joel Brobecker
2013-01-18 7:41 ` Kaushik Phatak
2013-01-18 14:17 ` Joel Brobecker
2013-01-22 13:49 ` Kaushik Phatak
2013-01-22 15:43 ` Pedro Alves
2013-01-23 14:22 ` Kaushik Phatak
2013-01-23 14:26 ` Pedro Alves
2013-01-23 15:34 ` Pedro Alves
2013-06-19 13:30 ` Kaushik Phatak
2013-06-25 18:42 ` Pedro Alves
2013-06-26 7:08 ` Kaushik Phatak
2013-06-26 10:37 ` Pedro Alves
2013-01-18 18:25 ` Pedro Alves [this message]
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=50F9937F.5000508@redhat.com \
--to=palves@redhat.com \
--cc=Kaushik.Phatak@kpitcummins.com \
--cc=binutils@sourceware.org \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=nickc@redhat.com \
--cc=tromey@redhat.com \
--cc=yao@codesourcery.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