Le lundi 31 juillet 2006 à 16:00 +0200, Frederic RISS a écrit : > I'll follow up soon with a patch doing this. Here's a code patch for discussion and a tentative doco patch. I've chosen to initialize the variable early in handle_inferior_event, so that it's set whatever happens. I thought that if we document it, it'd rather be always set and not only for breakpoint condition evaluation. I'm still wondering about 2 things: 1. Should it change on a user requested thread switch? That would be a simple patch to thread.c:switch_to_thread. But maybe documenting it as 'the id of the last stopped thread' wouldn't be a bad idea. I don't think GDB provides a way for the user to get this information (I mean once he has selected another thread). This way 'thread $_gdb_thread' would always bring you back to the stopped thread. 2. Should we add support for read-only convenience variables? Writing in $_gdb_thread makes no sense... but it causes no harm either. We already have $bpnum in the same situation. I see some ways to support this: - Add lval_internalvar_readonly - Add a read_only flag to struct internalvar and check it at assignment time. Internal vars are already special-cased there, so this should be easy. Would be my solution of choice. - Don't create a real convenience variable, but add OP_THREADID to expression.h and generate it in write_dollar_var. Also add some API to infrun.c to export the stopped threadid. Fred.