From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7892 invoked by alias); 28 May 2005 18:53:15 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 7879 invoked by uid 22791); 28 May 2005 18:53:10 -0000 Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Sat, 28 May 2005 18:53:10 +0000 Received: from drow by nevyn.them.org with local (Exim 4.50) id 1Dc6Qh-00055t-0l for gdb-patches@sources.redhat.com; Sat, 28 May 2005 14:53:03 -0400 Date: Sat, 28 May 2005 18:56:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sources.redhat.com Subject: Re: [mi] organize possible exec async mi oc command reasons Message-ID: <20050528185302.GG26806@nevyn.them.org> Mail-Followup-To: gdb-patches@sources.redhat.com References: <20050324154602.GA10558@white> <20050324160653.GB29185@nevyn.them.org> <20050324212036.GB10808@white> <20050430193220.GG7009@nevyn.them.org> <20050518040011.GD20928@white> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050518040011.GD20928@white> User-Agent: Mutt/1.5.8i X-SW-Source: 2005-05/txt/msg00587.txt.bz2 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 > * 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