Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
To: "'Joel Brobecker'" <brobecker@adacore.com>
Cc: <gdb-patches@sourceware.org>
Subject: RE: [PATCH] avoid GDB crash on inspection of pascal arrays
Date: Mon, 08 Mar 2010 23:30:00 -0000	[thread overview]
Message-ID: <001201cabf17$43e1b960$cba52c20$@muller@ics-cnrs.unistra.fr> (raw)
In-Reply-To: <20100308185450.GK3081@adacore.com>



> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Joel Brobecker
> Envoyé : Monday, March 08, 2010 7:55 PM
> À : Pierre Muller
> Cc : gdb-patches@sourceware.org
> Objet : Re: [PATCH] avoid GDB crash on inspection of pascal arrays
> 
> 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...

  No, you are perfectly right that it doesn't
seem logical to call this function with a NULL type.

  I fact, that happen probably only because of the p-exp.y 
code, but I tought that adding this test was the safest anyhow.
 
> 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?

  Sorry, I am always confused about operator precedence here
(pascal 'AND' binary operator has a higher precedence than
comparison operators, which means that similar pascal code
means those extra parentheses...)

> 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.

  Formatting with the tab/spaces conversion is still a nightmare
for me...

  I really don't know vi enough to reformat correctly
an almost 100 lines long block... Is there a neat way to do this just with
vi
or do I need something more powerful?

  Could someone tell me the best way?

Pierre



  reply	other threads:[~2010-03-08 23:30 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
2010-03-08 23:30   ` Pierre Muller [this message]
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='001201cabf17$43e1b960$cba52c20$@muller@ics-cnrs.unistra.fr' \
    --to=pierre.muller@ics-cnrs.unistra.fr \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /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