From: Joel Brobecker <brobecker@adacore.com>
To: Pierre Muller <pierre.muller@ics-cnrs.unistra.fr>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] avoid GDB crash on inspection of pascal arrays
Date: Mon, 08 Mar 2010 18:55:00 -0000 [thread overview]
Message-ID: <20100308185450.GK3081@adacore.com> (raw)
In-Reply-To: <001801cabee0$31499ca0$93dcd5e0$@muller@ics-cnrs.unistra.fr>
Hi Pierre,
> 2020-03-08 Pierre Muller <muller@ics.u-strasbg.fr>
>
> * p-lang.c (is_pascal_string_type): Check that TYPE arg is non NULL.
Seems odd that you'd call a function whose job is to inspect a type with
a NULL type, but it's not hard to add a check indeed - and that would not.
be the first time ;-). Please do not consider this an objection, just
"speaking" aloud...
Just one nit:
> - if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
> + if ((type != NULL) && (TYPE_CODE (type) == TYPE_CODE_STRUCT))
Would you mind removing the extra parenthesis around each block?
I'd like for the code to be as consistent as possible, to help
readability. It's a question of taste, and I don't agree with all
our rules, but I'd like for things to stay as consistent as possible...
While I'm sending you an email, I started looking at the call sites
for your function, to see if I could see why the function is called
with a NULL pointer, in case there was something obvious to be found.
Nothing obvious, but I noticed that some code in p-valprint might need
a little reformatting?
> elttype = check_typedef (TYPE_TARGET_TYPE (type));
> {
> addr = unpack_pointer (type, valaddr + embedded_offset);
> print_unpacked_pointer:
> elttype = check_typedef (TYPE_TARGET_TYPE (type));
>
> if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
(this is around line 153).
Something else that caught my attention, as well, is the following
statement is repeated twice:
elttype = check_typedef (TYPE_TARGET_TYPE (type));
It looks like the first instance is really unnecessary now?
(I am guessing there was a "if" before the mis-indented curly
brace before, and that this "if" got removed, but not its body,
to keep the patch readable - although there is always the diff -w
option). How about the curly brace themselves - since the block
does not introduce new local variables, it looks like it can go too.
--
Joel
next prev parent reply other threads:[~2010-03-08 18:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-08 16:55 Pierre Muller
2010-03-08 18:43 ` Kevin Buettner
2010-03-08 19:18 ` Pierre Muller
2010-03-08 18:55 ` Joel Brobecker [this message]
2010-03-08 23:30 ` Pierre Muller
2010-03-09 5:17 ` Joel Brobecker
2010-03-09 5:17 ` Joel Brobecker
2010-03-09 8:40 ` Pierre Muller
2010-03-09 17:33 ` Eli Zaretskii
2010-03-09 17:56 ` Joel Brobecker
2010-03-09 18:33 ` Tom Tromey
2010-03-09 18:33 ` Eli Zaretskii
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=20100308185450.GK3081@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=pierre.muller@ics-cnrs.unistra.fr \
/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