"Set a new convenience variable to a program variable"
gdb_test "print /x \$prog_var" " = $hex" \
"Print contents of new convenience variable of program variable"
+
+ # Test $_thread/$_inferior convenience variables in various commands.
+ gdb_test "info threads \$_thread" "\\* 1 .* main.*"
+ gdb_test "info inferiors \$_inferior" "\\* 1 .* process.*"
+ gdb_test "break foo_int thread \$_thread" "Breakpoint \[0-9\]*.*"
}
gdb_test_no_output "set print sevenbit-strings"
for (thread_info *tp : all_threads ())
{
+ /* In case REQUESTED_THREADS contains $_thread. */
+ if (current_thread != nullptr)
+ switch_to_thread (current_thread);
+
if (!should_print_thread (requested_threads, default_inf_num,
global_ids, pid, tp))
continue;
if (tp == current_thread && tp->state == THREAD_EXITED)
current_exited = true;
+ /* In case REQUESTED_THREADS contains $_thread. */
+ if (current_thread != nullptr)
+ switch_to_thread (current_thread);
+
if (!should_print_thread (requested_threads, default_inf_num,
global_ids, pid, tp))
continue;
}
}
+ if (var->kind == INTERNALVAR_MAKE_VALUE)
+ {
+ struct gdbarch *gdbarch = get_current_arch ();
+ struct value *val
+ = (*var->u.make_value.functions->make_value) (gdbarch, var,
+ var->u.make_value.data);
+ struct type *type = check_typedef (val->type ());
+
+ if (type->code () == TYPE_CODE_INT)
+ {
+ *result = value_as_long (val);
+ return 1;
+ }
+ }
+
return 0;
}