#include "user-regs.h"
#include <algorithm>
#include "completer.h"
-#include "common/selftest.h"
-#include "common/array-view.h"
+#include "gdbsupport/selftest.h"
+#include "gdbsupport/array-view.h"
+#include "cli/cli-style.h"
/* Definition of a user function. */
struct internal_function
fetch it. */
if (value->optimized_out.empty () && value->lazy)
{
- TRY
+ try
{
value_fetch_lazy (value);
}
- CATCH (ex, RETURN_MASK_ERROR)
+ catch (const gdb_exception_error &ex)
{
/* Fall back to checking value->optimized_out. */
}
- END_CATCH
}
return !value->optimized_out.empty ();
for (var = internalvars; var; var = var->next)
if (strncmp (var->name, name, len) == 0)
- {
- gdb::unique_xmalloc_ptr<char> copy (xstrdup (var->name));
-
- tracker.add_completion (std::move (copy));
- }
+ tracker.add_completion (make_unique_xstrdup (var->name));
}
/* Create an internal variable with name NAME and with a void value.
{
struct internalvar *var = XNEW (struct internalvar);
- var->name = concat (name, (char *)NULL);
+ var->name = xstrdup (name);
var->kind = INTERNALVAR_VOID;
var->next = internalvars;
internalvars = var;
}
printf_filtered (("$%s = "), var->name);
- TRY
+ try
{
struct value *val;
val = value_of_internalvar (gdbarch, var);
value_print (val, gdb_stdout, &opts);
}
- CATCH (ex, RETURN_MASK_ERROR)
+ catch (const gdb_exception_error &ex)
{
- fprintf_filtered (gdb_stdout, _("<error: %s>"), ex.message);
+ fprintf_styled (gdb_stdout, metadata_style.style (),
+ _("<error: %s>"), ex.what ());
}
- END_CATCH
printf_filtered (("\n"));
}
case TYPE_CODE_CHAR:
case TYPE_CODE_RANGE:
case TYPE_CODE_MEMBERPTR:
- if (nosign)
- return extract_unsigned_integer (valaddr, len, byte_order);
- else
- return extract_signed_integer (valaddr, len, byte_order);
+ {
+ LONGEST result;
+ if (nosign)
+ result = extract_unsigned_integer (valaddr, len, byte_order);
+ else
+ result = extract_signed_integer (valaddr, len, byte_order);
+ if (code == TYPE_CODE_RANGE)
+ result += TYPE_RANGE_DATA (type)->bias;
+ return result;
+ }
case TYPE_CODE_FLT:
case TYPE_CODE_DECFLOAT:
switch (TYPE_CODE (type))
{
+ case TYPE_CODE_RANGE:
+ num -= TYPE_RANGE_DATA (type)->bias;
+ /* Fall through. */
case TYPE_CODE_INT:
case TYPE_CODE_CHAR:
case TYPE_CODE_ENUM:
case TYPE_CODE_FLAGS:
case TYPE_CODE_BOOL:
- case TYPE_CODE_RANGE:
case TYPE_CODE_MEMBERPTR:
store_signed_integer (buf, len, byte_order, num);
break;