This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v4] Implement $_exitsignal


On 09/17/2013 06:50 PM, Sergio Durigan Junior wrote:
> +# Running until the end.
> +gdb_test "run" "\\\[Inferior .* exited normally\\\]" "Run inferior until the end"
> +

I was about to OK the whole patch, but I noticed this: :-/

"run" won't work with "target remote".  Please try the native-gdbserver.exp
board.

As long as there's going to be another round, I think the code
could be simplified.  All that logic that clears the variables:

+      /* The inferior did not die because of an uncaught signal,
+	 therefore we must clear $_exitsignal.  */
+      clear_internalvar (lookup_internalvar ("_exitsignal"));
+    }
+
+  /* Clear the $_exitcode internal variable, because there is no way
+     the inferior could have exited and generated a corefile.  */
+  clear_internalvar (lookup_internalvar ("_exitcode"));

could be replaced by this pattern:

/* Clear these first.  */
clear $_exitsignal;
clear $_exitcode;

if (blah)
   set $_exitsignal;
if (bleh)
   set $_exitcode;

IOW, unconditionally clear both variables first, then set
the one that makes sense.

The same pattern can be done in both corelow.c and infrun.c.

(those clears could be put in a small helper, as they'll
be done in two places).

-- 
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]