Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: gdb-patches@sources.redhat.com
Subject: Re: [mi] organize possible exec async mi oc command reasons
Date: Sat, 28 May 2005 18:56:00 -0000	[thread overview]
Message-ID: <20050528185302.GG26806@nevyn.them.org> (raw)
In-Reply-To: <20050518040011.GD20928@white>

On Wed, May 18, 2005 at 12:00:11AM -0400, Bob Rossi wrote:
> I have a feeling that I messed up the internal_error coding style
> function call in _initialize_gdb_mi_common, but I have no idea how to
> fix it. The constant char* error message is longer than 80 char's. Any
> ideas? (I even ran gdb_indent on it, but it didn't help)

There's lots of ways to do this.  You have:

  if (async_reason_string_lookup[EXEC_ASYNC_LAST] != NULL)
    internal_error (__FILE__, __LINE__,
      _("_initialize_gdb_mi_common: async_reason_string_lookup[] is inconsistent"));

You could do:

  if (async_reason_string_lookup[EXEC_ASYNC_LAST] != NULL)
    internal_error (__FILE__, __LINE__, _("\
_initialize_gdb_mi_common: async_reason_string_lookup[] is inconsistent"));

Or:
  if (async_reason_string_lookup[EXEC_ASYNC_LAST] != NULL)
    internal_error (__FILE__, __LINE__,
		    _("_initialize_gdb_mi_common: "
		      "async_reason_string_lookup[] is inconsistent"));

Or:
  if (async_reason_string_lookup[EXEC_ASYNC_LAST] != NULL)
    internal_error
      (__FILE__, __LINE__,
       _("_initialize_gdb_mi_common: async_reason_string_lookup[] is inconsistent"));

Except that last one is still past 80 chars.

Or, you could do this:
  if (async_reason_string_lookup[EXEC_ASYNC_LAST] != NULL)
    internal_error (__FILE__, __LINE__,
		    _("async_reason_string_lookup[] is inconsistent"));

Or my personal favorite of the bunch:
  if (ARRAY_SIZE (async_reason_string_lookup) != EXEC_ASYNC_LAST + 1)
    internal_error (__FILE__, __LINE__,
		    _("async_reason_string_lookup is inconsistent"));

Which won't access out of bounds memory if someone shortens the array. 
No one ever will, of course, but...

> 
> 2005-05-17  Bob Rossi  <bob@brasko.net>
> 	* Makefile.in (SUBDIR_MI_OBS, SUBDIR_MI_SRCS): Add mi-common.
> 	(gdb/mi/ headers): Add mi_common_h.
> 	(breakpoint.o, infrun.o): Add dependencies mi_common_h.
> 	* breakpoint.c (include): Add include 'mi/mi-common.h'.
> 	(print_it_typical): Use async_reason_lookup.
> 	(watchpoint_check): Ditto.
> 	* infrun.c (include): Add include 'mi/mi-common.h'.
> 	(print_stop_reason): Use async_reason_lookup.
> 	* mi/mi-common.h: New file.
> 	* mi/mi-common.c: Ditto.

The other half of your changelog was lost in the patch below :-)

> -	    ui_out_field_string (uiout, "reason", "watchpoint-trigger");
> +	    ui_out_field_string (uiout, "reason", 
> +				 async_reason_lookup
> +				 (EXEC_ASYNC_WATCHPOINT_TRIGGER));

This is fine, but if the indentation bugs you, here's an alternative:

	    ui_out_field_string
	      (uiout, "reason",
	       async_reason_lookup (EXEC_ASYNC_WATCHPOINT_TRIGGER));


> +@item read-watchpoint-trigger
> +A read watchpoint was triggered

This one lost a trailing period.

> /* Represents the reason why GDB is sending an asyncronous command to the
>    front end.  
>    NOTE: When modifing this, don't forget to update gdb.texinfo!  */

In general stray line breaks in comments will get eaten by
gdb_indent.sh.  You can just put the NOTE on the same line.  Also,
"asynchronous" with an h.

>     /* This is here only to represent the number of enum's */

"the number of enums.  "

-- 
Daniel Jacobowitz
CodeSourcery, LLC


  parent reply	other threads:[~2005-05-28 18:53 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-24 15:46 Bob Rossi
2005-03-24 15:54 ` Daniel Jacobowitz
2005-03-24 16:06 ` Daniel Jacobowitz
2005-03-24 18:47   ` Stan Shebs
2005-03-24 21:20   ` Bob Rossi
2005-03-26 10:43     ` Eli Zaretskii
2005-04-30 19:32     ` Daniel Jacobowitz
2005-05-18  3:29       ` Bob Rossi
2005-05-18  3:34         ` Daniel Jacobowitz
2005-05-18  3:36           ` Bob Rossi
2005-05-18  3:43             ` Daniel Jacobowitz
2005-05-18  4:00               ` Bob Rossi
2005-05-18  8:53       ` Bob Rossi
2005-05-26  2:35         ` Bob Rossi
2005-05-28 18:56         ` Daniel Jacobowitz [this message]
2005-05-29  2:55           ` Bob Rossi
2005-05-29  3:00             ` Bob Rossi
2005-05-29  4:57               ` Daniel Jacobowitz
2005-05-29  5:53                 ` Bob Rossi
2005-05-29  3:11             ` Daniel Jacobowitz
2005-06-15 19:25     ` David Lecomber
2005-06-15 20:03       ` Bob Rossi
2005-06-15 20:46         ` Daniel Jacobowitz
2005-03-24 20:00 ` Eli Zaretskii
2005-03-24 21:02   ` Bob Rossi
2005-03-26 10:40     ` Eli Zaretskii
2005-03-26 13:32       ` Eli Zaretskii
2005-03-27  2:56         ` Bob Rossi
2005-03-27  4:42           ` 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=20050528185302.GG26806@nevyn.them.org \
    --to=drow@false.org \
    --cc=gdb-patches@sources.redhat.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