52#include "gdbsupport/format.h"
54#include "gdbsupport/byte-vector.h"
55#include "gdbsupport/gdb_optional.h"
56#include "safe-ctype.h"
57#include "gdbsupport/rsp-low.h"
106 _(
"The largest offset that will be "
107 "printed in <symbol+1234> form is %s.\n"),
118 gdb_printf (file, _(
"Printing of source filename and "
119 "line number with <symbol> is %s.\n"),
137 const struct block *block_)
194 const char *p = *string_ptr;
207 if (*p >=
'0' && *p <=
'9')
208 val.
count *= atoi (p);
209 while (*p >=
'0' && *p <=
'9')
216 if (*p ==
'b' || *p ==
'h' || *p ==
'w' || *p ==
'g')
228 else if (*p >=
'a' && *p <=
'z')
234 *string_ptr = skip_spaces (p);
248 val.
format = oformat ==
'i' ?
'x' : oformat;
250 else if (val.
size ==
'?')
257 val.
size = osize ?
'a' : osize;
261 if (osize ==
'w' || osize ==
'g')
266 val.
size = osize ?
'g' : osize;
270 val.
size = osize ?
'b' : osize;
314 stream, options) * len);
333 ||
type->
code () == TYPE_CODE_STRING
334 ||
type->
code () == TYPE_CODE_STRUCT
336 ||
type->
code () == TYPE_CODE_NAMESPACE)
376 gdb_assert (options->
format !=
's');
387 if (options->
format !=
'c'
390 if (len < type->length () && byte_order == BFD_ENDIAN_BIG)
396 const gdb_byte zero = 0;
422 error (_(
"Undefined output size \"%c\"."),
size);
424 if (newlen < len && byte_order == BFD_ENDIAN_BIG)
425 valaddr += len - newlen;
431 gdb::byte_vector converted_bytes;
435 gdb::optional<LONGEST> val_long;
437 && (options->
format ==
'o'
442 || options->
format ==
'u'))
449 byte_order, *val_long);
450 valaddr = converted_bytes.data ();
456 char format = options->
format;
457 if (format ==
'f' &&
type->
code () != TYPE_CODE_FLT)
500 if (!val_long.has_value ())
515 if (!val_long.has_value ())
522 error (_(
"Undefined output format \"%c\"."),
format);
554 int do_demangle,
const char *leadin)
556 std::string
name, filename;
562 &offset, &filename, &line, &unmapped))
578 gdb_puts (line == -1 ?
" in " :
" at ", stream);
597 bool prefer_sym_over_minsym,
600 std::string *filename,
606 CORE_ADDR name_location = 0;
608 const char *name_temp =
"";
655 if (msymbol.
minsym != NULL
663 if (msymbol.
minsym != NULL)
675 (!prefer_sym_over_minsym
677 && name_location !=
addr))
738 CORE_ADDR addr,
struct ui_file *stream)
769 struct ui_file *stream,
int do_demangle)
771 if (opts->addressprint)
795 int inst_count,
int *inst_read)
799 CORE_ADDR loop_start, loop_end, p;
800 std::vector<CORE_ADDR> pcs;
804 loop_start = loop_end = addr;
822 gdb_printf (_(
"No line number information available "
830 loop_end = loop_start;
835 for (p = loop_start; p < loop_end;)
841 inst_count -= pcs.size ();
842 *inst_read += pcs.size ();
844 while (inst_count > 0);
868 p = pcs.size () > 0 ? pcs[-inst_count] : loop_start;
874 *inst_read += inst_count;
885 CORE_ADDR memaddr, gdb_byte *myaddr,
int len)
902 for (nread = 0; nread < len; ++nread)
908 gdb_printf (_(
"Cannot access memory at address %s\n"),
924 while (i < len && x[i] == 0)
937 CORE_ADDR addr,
int count,
int char_size,
939 int *strings_counted)
941 const int chunk_size = 0x20;
944 int chars_to_read = chunk_size;
945 int chars_counted = 0;
946 int count_original = count;
947 CORE_ADDR string_start_addr = addr;
949 gdb_assert (char_size == 1 || char_size == 2 || char_size == 4);
950 gdb::byte_vector buffer (chars_to_read * char_size);
951 while (count > 0 && read_error == 0)
955 addr -= chars_to_read * char_size;
957 chars_to_read * char_size);
958 chars_read /= char_size;
959 read_error = (chars_read == chars_to_read) ? 0 : 1;
961 for (i = 0; i < chars_read && count > 0 ; ++i, ++chars_counted)
963 int offset = (chars_to_read - i - 1) * char_size;
972 string_start_addr = addr + offset + char_size;
979 *strings_counted = count_original - count;
985 string_start_addr -= chars_counted * char_size;
988 return string_start_addr;
1000 struct type *val_type = NULL;
1004 int need_to_update_next_address = 0;
1005 CORE_ADDR addr_rewound = 0;
1031 internal_error (_(
"failed internal consistency check"));
1036 else if (
size ==
'h')
1038 else if (
size ==
'w')
1040 else if (
size ==
'g')
1045 struct type *char_type = NULL;
1051 else if (
size ==
'w')
1054 val_type = char_type;
1058 warning (_(
"Unable to display strings with "
1059 "size '%c', using 'b' instead."),
size);
1070 if (format ==
's' || format ==
'i')
1087 else if (format ==
's')
1101 addr_rewound = (format ==
's'
1104 need_to_update_next_address = 1;
1109 bool print_range_tag =
true;
1119 CORE_ADDR tag_laddr = 0, tag_haddr = 0;
1128 struct value *v_addr
1142 gdb_printf (_(
"<Allocation Tag %s for range [%s,%s)>\n"),
1148 print_range_tag =
false;
1179 if (format ==
'i' && count == 1)
1185 print_range_tag =
true;
1190 if (need_to_update_next_address)
1198 error (_(
"Size letters are meaningless in \"%s\" command."), cmdname);
1200 error (_(
"Item count other than 1 is meaningless in \"%s\" command."),
1203 error (_(
"Format letter \"%c\" is meaningless in \"%s\" command."),
1214 const char *exp = *expp;
1219 if (exp && *exp ==
'/')
1228 opts->format = fmt.
format;
1229 opts->raw = opts->raw || fmt.
raw;
1271 if (
code != TYPE_CODE_PTR
1287static struct value *
1299 const char *exp = args;
1301 if (exp !=
nullptr && *exp)
1345 gdb_printf (_(
"Logical tag (%s) does not match the "
1346 "allocation tag (%s).\n"),
1347 ltag.c_str (), atag.c_str ());
1350 catch (gdb_exception_error &ex)
1352 if (ex.error == TARGET_CLOSE_ERROR)
1356 _(
"Could not validate memory tag: %s\n"),
1357 ex.message->c_str ());
1382 const char *text = *args;
1389 if (text[1] ==
'\0')
1401 text = skip_to_space (text);
1418 text = skip_spaces (text);
1435 const char *text,
const char * )
1475 if (exp && *exp ==
'/')
1503 switch (
expr->op->opcode ())
1505 case UNOP_PREINCREMENT:
1506 case UNOP_POSTINCREMENT:
1507 case UNOP_PREDECREMENT:
1508 case UNOP_POSTDECREMENT:
1510 case BINOP_ASSIGN_MODIFY:
1515 (_(
"Expression is not an assignment (and might have no effect)"));
1526 CORE_ADDR
addr, sect_addr;
1544 if (osect->
addr () <= sect_addr && sect_addr < osect->
endaddr ()
1549 const char *obj_name, *mapped, *sec_name, *msym_name;
1550 const char *loc_string;
1560 std::string string_holder;
1563 string_holder = string_printf (
"%s + %u", msym_name,
offset);
1564 loc_string = string_holder.c_str ();
1567 loc_string = msym_name;
1576 "%s overlay section %s of %s\n"),
1577 loc_string, mapped, sec_name, obj_name);
1580 "section %s of %s\n"),
1581 loc_string, sec_name, obj_name);
1584 gdb_printf (_(
"%s in %s overlay section %s of %s\n"),
1585 loc_string, mapped, sec_name, obj_name);
1588 loc_string, sec_name, obj_name);
1592 gdb_printf (_(
"%s in load address range of %s overlay "
1594 loc_string, mapped, sec_name);
1597 (_(
"%s in load address range of section %s\n"),
1598 loc_string, sec_name);
1601 gdb_printf (_(
"%s in %s overlay section %s\n"),
1602 loc_string, mapped, sec_name);
1605 loc_string, sec_name);
1609 gdb_printf (_(
"No symbol matches %s.\n"), arg);
1621 CORE_ADDR load_addr, context_pc = 0;
1625 error (_(
"Argument required."));
1628 &is_a_field_of_this).
symbol;
1631 if (is_a_field_of_this.
type != NULL)
1636 gdb_printf (
"\" is a field of the local class variable ");
1646 if (msymbol.
minsym != NULL)
1659 gdb_printf (
" in a file compiled without debugging");
1674 error (_(
"No symbol \"%s\" in current context."), exp);
1720 gdb_assert_not_reached (
"LOC_COMPUTED variable missing a method");
1740 gdb_printf (_(
"static storage at address "));
1758 gdb_printf (_(
"address of an argument in register %s"),
1763 gdb_printf (_(
"an argument at offset %ld"), val);
1767 gdb_printf (_(
"a local variable at frame offset %ld"), val);
1771 gdb_printf (_(
"a reference argument at offset %ld"), val);
1809 gdb_printf (_(
"a thread-local variable at offset %s "
1810 "in the thread-local storage for `%s'"),
1817 gdb_printf (_(
"static storage at address "));
1864 if (exp && *exp ==
'/')
1866 const char *tmp = exp + 1;
1876 if (exp != 0 && *exp != 0)
1941 const char *text,
const char * )
1960 const char *
exp = arg;
2016 [=] (
const std::unique_ptr<struct display> &item)
2018 return item.get () == display;
2029 gdb::function_view<
void (
struct display *)> function)
2040 const char *p = parser.
cur_tok ();
2044 warning (_(
"bad display number at or near '%s'"), p);
2049 [=] (
const std::unique_ptr<display> &item)
2051 return item->number == num;
2054 gdb_printf (_(
"No display number %d.\n"), num);
2056 function (iter->get ());
2068 if (
query (_(
"Delete all auto-display expressions? ")))
2085 int within_current_scope;
2112 catch (
const gdb_exception &ex)
2116 warning (_(
"Unable to display \"%s\": %s"),
2128 within_current_scope = 0;
2131 within_current_scope = 1;
2132 if (!within_current_scope)
2135 scoped_restore save_display_number
2178 catch (
const gdb_exception_error &ex)
2213 catch (
const gdb_exception_error &ex)
2216 _(
"<error: %s>"), ex.what ());
2244 if (d->number == num)
2246 d->enabled_p =
false;
2249 gdb_printf (_(
"No display number %d.\n"), num);
2259 _(
"Disabling display %d to "
2260 "avoid infinite recursion.\n"),
2270 gdb_printf (_(
"There are no auto-display expressions now.\n"));
2272 gdb_printf (_(
"Auto-display expressions now in effect:\n\
2273Num Enb Expression\n"));
2277 gdb_printf (
"%d: %c ", d->number,
"ny"[(
int) d->enabled_p]);
2279 gdb_printf (
"/%d%c%c ", d->format.count, d->format.size,
2281 else if (d->format.format)
2285 gdb_printf (_(
" (cannot be evaluated in the current context)"));
2351 if (d->pspace != pspace)
2354 struct objfile *bl_objf =
nullptr;
2355 if (d->block !=
nullptr)
2383 struct ui_file *stream,
int indent)
2389 gdb_printf (stream,
"%*s%ps = ", 2 * indent,
"",
2410 catch (
const gdb_exception_error &except)
2413 "<error reading variable %s (%s)>",
name,
2429 const gdb_byte *str;
2441 gdb_byte *tem_str = (gdb_byte *) alloca (len + 1);
2454 DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
2463 for (len = 0;; len++)
2474 gdb_byte *tem_str = (gdb_byte *) alloca (len + 1);
2483 DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
2497 const gdb_byte *str;
2501 "wchar_t", NULL, 0);
2502 int wcwidth = wctype->
length ();
2517 DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
2525 gdb_byte *buf = (gdb_byte *) alloca (wcwidth);
2527 for (len = 0;; len += wcwidth)
2536 gdb_byte *tem_str = (gdb_byte *) alloca (len + wcwidth);
2540 memset (&tem_str[len], 0, wcwidth);
2544 auto_obstack output;
2550 obstack_grow_str0 (&output,
"");
2553 DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
2554 gdb_printf (stream, format, obstack_base (&output));
2570 struct type *fmt_type;
2576 case long_double_arg:
2579 case dec32float_arg:
2582 case dec64float_arg:
2585 case dec128float_arg:
2589 gdb_assert_not_reached (
"unexpected argument class");
2612 if (fmt_type->
code () == TYPE_CODE_FLT)
2642#ifdef PRINTF_HAS_LONG_LONG
2648 fmt = (
char *) alloca (strlen (format) + 5);
2655 int is_percent = (*p ==
'%');
2672 while (*p ==
'-' || (*p >=
'0' && *p <
'9'))
2675 gdb_assert (*p ==
'p' && *(p + 1) ==
'\0');
2678#ifdef PRINTF_HAS_LONG_LONG
2685 DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
2694 DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
2705 const char *s = arg;
2706 std::vector<struct value *> val_args;
2709 error_no_arg (_(
"format-control string and values to print"));
2711 s = skip_spaces (s);
2715 error (_(
"Bad format string, missing '\"'."));
2717 format_pieces fpieces (&s);
2720 error (_(
"Bad format string, non-terminated '\"'."));
2722 s = skip_spaces (s);
2724 if (*s !=
',' && *s != 0)
2725 error (_(
"Invalid argument syntax"));
2729 s = skip_spaces (s);
2734 const char *current_substring;
2737 for (
auto &&piece : fpieces)
2738 if (piece.argclass != literal_piece)
2756 if (val_args.size () != nargs_wanted)
2757 error (_(
"Wrong number of arguments for specified format-string"));
2761 for (
auto &&piece : fpieces)
2763 current_substring = piece.string;
2764 switch (piece.argclass)
2769 case wide_string_arg:
2776 "wchar_t", NULL, 0);
2777 struct type *valtype;
2778 const gdb_byte *bytes;
2782 || valtype->
code () != TYPE_CODE_INT)
2783 error (_(
"expected wchar_t argument for %%lc"));
2787 auto_obstack output;
2791 bytes, valtype->
length (),
2794 obstack_grow_str0 (&output,
"");
2797 DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
2799 obstack_base (&output));
2804#ifdef PRINTF_HAS_LONG_LONG
2809 DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
2815 error (_(
"long long not supported in printf"));
2822 DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
2832 DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
2842 DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
2849 case long_double_arg:
2850 case dec32float_arg:
2851 case dec64float_arg:
2852 case dec128float_arg:
2869 DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
2874 internal_error (_(
"failed internal consistency check"));
2877 if (piece.argclass != literal_piece)
2913 error (_(
"Address %s not in a region mapped with a memory tagging flag."),
2922 error (_(
"Memory tagging not supported or disabled by the current"
2939 if (args ==
nullptr)
2956 struct value *tag_value
2999 gdb::byte_vector &tags,
3003 std::string address_string = extract_string_maybe_quoted (&args);
3010 std::string tag_string = extract_string_maybe_quoted (&args);
3013 if (address_string.empty () || tag_string.empty ())
3014 error (_(
"Missing arguments."));
3016 if (tag_string.length () != 2)
3017 error (_(
"Error parsing tags argument. The tag should be 2 digits."));
3019 tags = hex2bin (tag_string.c_str ());
3030 if (args ==
nullptr)
3033 gdb::byte_vector tags;
3059 gdb_printf (_(
"Could not update the logical tag data.\n"));
3072 size_t *length, gdb::byte_vector &tags)
3075 std::string address_string = extract_string_maybe_quoted (&args);
3083 std::string length_string = extract_string_maybe_quoted (&args);
3086 std::string tags_string = extract_string_maybe_quoted (&args);
3089 if (address_string.empty () || length_string.empty () || tags_string.empty ())
3090 error (_(
"Missing arguments."));
3093 const char *trailer =
nullptr;
3094 LONGEST parsed_length = strtoulst (length_string.c_str (), &trailer, 10);
3096 if (errno != 0 || (trailer !=
nullptr && trailer[0] !=
'\0'))
3097 error (_(
"Error parsing length argument."));
3099 if (parsed_length <= 0)
3100 error (_(
"Invalid zero or negative length."));
3102 *length = parsed_length;
3104 if (tags_string.length () % 2)
3105 error (_(
"Error parsing tags argument. Tags should be 2 digits per byte."));
3107 tags = hex2bin (tags_string.c_str ());
3124 if (args ==
nullptr)
3125 error_no_arg (_(
"<starting address> <length> <tag bytes>"));
3127 gdb::byte_vector tags;
3136 gdb_printf (_(
"Could not update the allocation tag(s).\n"));
3138 gdb_printf (_(
"Allocation tag(s) updated successfully.\n"));
3149 if (args ==
nullptr)
3150 error (_(
"Argument required (address or pointer)"));
3178 gdb_printf (_(
"Logical tag (%s) does not match"
3179 " the allocation tag (%s) for address %s.\n"),
3180 ltag.c_str (), atag.c_str (),
3190 gdb_printf (_(
"Memory tags for address %s match (%s).\n"),
3207 _(
"Describe where symbol SYM is stored.\n\
3208Usage: info address SYM"));
3211Describe what symbol is at location ADDR.\n\
3212Usage: info symbol ADDR\n\
3213Only for symbols with fixed locations (global or static scope)."));
3216Examine memory: x/FMT ADDRESS.\n\
3217ADDRESS is an expression for the memory address to examine.\n\
3218FMT is a repeat count followed by a format letter and a size letter.\n\
3219Format letters are o(octal), x(hex), d(decimal), u(unsigned decimal),\n\
3220 t(binary), f(float), a(address), i(instruction), c(char), s(string)\n\
3221 and z(hex, zero padded on the left).\n\
3222Size letters are b(byte), h(halfword), w(word), g(giant, 8 bytes).\n\
3223The specified number of objects of the specified size are printed\n\
3224according to the format. If a negative number is specified, memory is\n\
3225examined backward from the address.\n\n\
3226Defaults for format and size letters are those previously used.\n\
3227Default count is 1. Default address is following last thing printed\n\
3228with this command or \"print\"."));
3232Expressions to display when program stops, with code numbers.\n\
3233Usage: info display"));
3236Cancel some expressions to be displayed when program stops.\n\
3237Usage: undisplay [NUM]...\n\
3238Arguments are the code numbers of the expressions to stop displaying.\n\
3239No argument means cancel all automatic-display expressions.\n\
3240\"delete display\" has the same effect as this command.\n\
3241Do \"info display\" to see current list of code numbers."),
3245Print value of expression EXP each time the program stops.\n\
3246Usage: display[/FMT] EXP\n\
3247/FMT may be used before EXP as in the \"print\" command.\n\
3248/FMT \"i\" or \"s\" or including a size-letter is allowed,\n\
3249as in the \"x\" command, and then EXP is used to get the address to examine\n\
3250and examining is done as in the \"x\" command.\n\n\
3251With no argument, display all currently requested auto-display expressions.\n\
3252Use \"undisplay\" to cancel display requests previously made."));
3256Enable some expressions to be displayed when program stops.\n\
3257Usage: enable display [NUM]...\n\
3258Arguments are the code numbers of the expressions to resume displaying.\n\
3259No argument means enable all automatic-display expressions.\n\
3260Do \"info display\" to see current list of code numbers."), &
enablelist);
3263Disable some expressions to be displayed when program stops.\n\
3264Usage: disable display [NUM]...\n\
3265Arguments are the code numbers of the expressions to stop displaying.\n\
3266No argument means disable all automatic-display expressions.\n\
3267Do \"info display\" to see current list of code numbers."), &
disablelist);
3270Cancel some expressions to be displayed when program stops.\n\
3271Usage: delete display [NUM]...\n\
3272Arguments are the code numbers of the expressions to stop displaying.\n\
3273No argument means cancel all automatic-display expressions.\n\
3274Do \"info display\" to see current list of code numbers."), &
deletelist);
3277Formatted printing, like the C \"printf\" function.\n\
3278Usage: printf \"format string\", ARG1, ARG2, ARG3, ..., ARGN\n\
3279This supports most C printf format specifications, like %s, %d, etc."));
3282Like \"print\" but don't put in value history and don't print newline.\n\
3284This is useful in user-defined commands."));
3287Evaluate expression EXP and assign result to variable VAR.\n\
3288Usage: set VAR = EXP\n\
3289This uses assignment syntax appropriate for the current language\n\
3290(VAR = EXP or VAR := EXP for example).\n\
3291VAR may be a debugger \"convenience\" variable (names starting\n\
3292with $), a register (a few standard names starting with $), or an actual\n\
3293variable in the program being debugged. EXP is any valid expression.\n\
3294Use \"set variable\" for variables with names identical to set subcommands.\n\
3296With a subcommand, this command modifies parts of the gdb environment.\n\
3297You can see these environment settings with the \"show\" command."),
3302Call a function in the program.\n\
3304The argument is the function name and arguments, in the notation of the\n\
3305current working language. The result is printed and saved in the value\n\
3306history, if it is not void."));
3311Evaluate expression EXP and assign result to variable VAR.\n\
3312Usage: set variable VAR = EXP\n\
3313This uses assignment syntax appropriate for the current language\n\
3314(VAR = EXP or VAR := EXP for example).\n\
3315VAR may be a debugger \"convenience\" variable (names starting\n\
3316with $), a register (a few standard names starting with $), or an actual\n\
3317variable in the program being debugged. EXP is any valid expression.\n\
3318This may usually be abbreviated to simply \"set\"."),
3325Print value of expression EXP.\n\
3326Usage: print [[OPTION]... --] [/FMT] [EXP]\n\
3331Note: because this command accepts arbitrary expressions, if you\n\
3332specify any command option, you must use a double dash (\"--\")\n\
3333to mark the end of option processing. E.g.: \"print -o -- myobj\".\n\
3335Variables accessible are those of the lexical environment of the selected\n\
3336stack frame, plus all those whose scope is global or an entire file.\n\
3338$NUM gets previous value number NUM. $ and $$ are the last two values.\n\
3339$$NUM refers to NUM'th value back from the last one.\n\
3340Names starting with $ refer to registers (with the values they would have\n\
3341if the program were to return to the stack frame now selected, restoring\n\
3342all registers saved by frames farther in) or else to debugger\n\
3343\"convenience\" variables (any such name not a known register).\n\
3344Use assignment expressions to give values to convenience variables.\n\
3346{TYPE}ADREXP refers to a datum of data type TYPE, located at address ADREXP.\n\
3347@ is a binary operator for treating consecutive data objects\n\
3348anywhere in memory as an array. FOO@NUM gives an array whose first\n\
3349element is FOO, whose second element is stored in the space following\n\
3350where FOO is stored, etc. FOO must be an expression whose value\n\
3351resides in memory.\n\
3353EXP may be preceded with /FMT, where FMT is a format letter\n\
3354but no count or size letter (see \"x\" command)."),
3365Set the largest offset that will be printed in <SYMBOL+1234> form."), _(
"\
3366Show the largest offset that will be printed in <SYMBOL+1234> form."), _(
"\
3367Tell GDB to only display the symbolic form of an address if the\n\
3368offset between the closest earlier symbol and the address is less than\n\
3369the specified maximum offset. The default is \"unlimited\", which tells GDB\n\
3370to always print the symbolic form of an address if any symbol precedes\n\
3371it. Zero is equivalent to \"unlimited\"."),
3377Set printing of source filename and line number with <SYMBOL>."), _(
"\
3378Show printing of source filename and line number with <SYMBOL>."), NULL,
3384Construct a GDB command and then evaluate it.\n\
3385Usage: eval \"format string\", ARG1, ARG2, ARG3, ..., ARGN\n\
3386Convert the arguments to a string as \"printf\" would, but then\n\
3387treat this string as a command line, and evaluate it."));
3391Generic command for printing and manipulating memory tag properties."),
3395 (
"Print the logical tag from POINTER.\n\
3396Usage: memory-tag print-logical-tag <POINTER>.\n\
3397<POINTER> is an expression that evaluates to a pointer.\n\
3398Print the logical tag contained in POINTER. The tag interpretation is\n\
3399architecture-specific."),
3403 _(
"Print the allocation tag for ADDRESS.\n\
3404Usage: memory-tag print-allocation-tag <ADDRESS>.\n\
3405<ADDRESS> is an expression that evaluates to a memory address.\n\
3406Print the allocation tag associated with the memory address ADDRESS.\n\
3407The tag interpretation is architecture-specific."),
3410 _(
"Print a POINTER with a specific logical TAG.\n\
3411Usage: memory-tag with-logical-tag <POINTER> <TAG>\n\
3412<POINTER> is an expression that evaluates to a pointer.\n\
3413<TAG> is a sequence of hex bytes that is interpreted by the architecture\n\
3414as a single memory tag."),
3418 _(
"Set the allocation tag(s) for a memory range.\n\
3419Usage: memory-tag set-allocation-tag <ADDRESS> <LENGTH> <TAG_BYTES>\n\
3420<ADDRESS> is an expression that evaluates to a memory address\n\
3421<LENGTH> is the number of bytes that is added to <ADDRESS> to calculate\n\
3423<TAG_BYTES> is a sequence of hex bytes that is interpreted by the\n\
3424architecture as one or more memory tags.\n\
3425Sets the tags of the memory range [ADDRESS, ADDRESS + LENGTH)\n\
3428If the number of tags is greater than or equal to the number of tag granules\n\
3429in the [ADDRESS, ADDRESS + LENGTH) range, only the tags up to the\n\
3430number of tag granules are updated.\n\
3432If the number of tags is less than the number of tag granules, then the\n\
3433command is a fill operation. The TAG_BYTES are interpreted as a pattern\n\
3434that gets repeated until the number of tag granules in the memory range\n\
3435[ADDRESS, ADDRESS + LENGTH) is updated."),
3438 _(
"Validate a pointer's logical tag against the allocation tag.\n\
3439Usage: memory-tag check <POINTER>\n\
3440<POINTER> is an expression that evaluates to a pointer\n\
3441Fetch the logical and allocation tags for POINTER and compare them\n\
3442for equality. If the tags do not match, print additional information about\n\
void annotate_display_number_end(void)
void annotate_display_expression(void)
void annotate_value_end(void)
void annotate_value_history_begin(int histindex, struct type *type)
void annotate_display_end(void)
void annotate_display_value(void)
void annotate_display_begin(void)
void annotate_display_format(void)
void annotate_value_history_end(void)
void annotate_display_expression_end(void)
void annotate_value_history_value(void)
void annotate_value_begin(struct type *type)
struct gdbarch * get_current_arch(void)
struct gdbarch * target_gdbarch(void)
constexpr std::string_view s1
struct objfile * block_objfile(const struct block *block)
bool contained_in(const struct block *a, const struct block *b, bool allow_nested)
struct symbol * find_pc_sect_function(CORE_ADDR pc, struct obj_section *section)
bool c_is_string_type_p(struct type *type)
const char * target_wide_charset(struct gdbarch *gdbarch)
const char * host_charset(void)
void convert_between_encodings(const char *from, const char *to, const gdb_byte *bytes, unsigned int num_bytes, int width, struct obstack *output, enum transliterations translit)
ui_file_style style() const
void add_completion(gdb::unique_xmalloc_ptr< char > name, completion_match_for_lcd *match_for_lcd=NULL, const char *text=NULL, const char *word=NULL)
void advance_custom_word_point_by(int len)
void set_use_custom_word_point(bool enable)
const struct block * block() const
const char * cur_tok() const
const char * c_str() const
virtual void wrap_here(int indent)
struct cmd_list_element * showprintlist
struct cmd_list_element * deletelist
void error_no_arg(const char *why)
struct cmd_list_element * cmdlist
struct cmd_list_element * setprintlist
struct cmd_list_element * setlist
struct cmd_list_element * disablelist
struct cmd_list_element * enablelist
set_show_commands add_setshow_uinteger_cmd(const char *name, enum command_class theclass, unsigned int *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_func_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
struct cmd_list_element * add_alias_cmd(const char *name, cmd_list_element *target, enum command_class theclass, int abbrev_flag, struct cmd_list_element **list)
struct cmd_list_element * add_cmd(const char *name, enum command_class theclass, const char *doc, struct cmd_list_element **list)
void set_cmd_completer_handle_brkchars(struct cmd_list_element *cmd, completer_handle_brkchars_ftype *func)
cmd_list_element * add_com_alias(const char *name, cmd_list_element *target, command_class theclass, int abbrev_flag)
void help_list(struct cmd_list_element *list, const char *cmdtype, enum command_class theclass, struct ui_file *stream)
struct cmd_list_element * add_com(const char *name, enum command_class theclass, cmd_simple_func_ftype *fun, const char *doc)
struct cmd_list_element * add_prefix_cmd(const char *name, enum command_class theclass, cmd_simple_func_ftype *fun, const char *doc, struct cmd_list_element **subcommands, int allow_unknown, struct cmd_list_element **list)
set_show_commands add_setshow_boolean_cmd(const char *name, enum command_class theclass, bool *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_func_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
struct cmd_list_element * add_info(const char *name, cmd_simple_func_ftype *fun, const char *doc)
std::string insert_user_defined_cmd_args(const char *line)
cli_style_option address_style
cli_style_option function_name_style
cli_style_option variable_name_style
cli_style_option file_name_style
cli_style_option metadata_style
void set_repeat_arguments(const char *args)
void expression_completer(struct cmd_list_element *ignore, completion_tracker &tracker, const char *text, const char *word)
const char * advance_to_expression_complete_word_point(completion_tracker &tracker, const char *text)
void read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
static void store_signed_integer(gdb_byte *addr, int len, enum bfd_endian byte_order, LONGEST val)
static ULONGEST extract_unsigned_integer(gdb::array_view< const gdb_byte > buf, enum bfd_endian byte_order)
int gdb_print_insn(struct gdbarch *gdbarch, CORE_ADDR memaddr, struct ui_file *stream, int *branch_delay_insns)
int gdb_insn_length(struct gdbarch *gdbarch, CORE_ADDR addr)
struct value * parse_to_comma_and_eval(const char **expp)
struct value * evaluate_expression(struct expression *exp, struct type *expect_type)
CORE_ADDR parse_and_eval_address(const char *exp)
std::unique_ptr< expression > expression_up
expression_up parse_expression(const char *, innermost_block_tracker *=nullptr, bool void_context_p=false)
struct value * read_var_value(struct symbol *var, const struct block *var_block, frame_info_ptr frame)
bool get_frame_pc_if_available(frame_info_ptr frame, CORE_ADDR *pc)
frame_info_ptr get_selected_frame(const char *message)
const struct block * get_selected_block(CORE_ADDR *addr_in_block)
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
const char * gdbarch_register_name(struct gdbarch *gdbarch, int regnr)
std::string gdbarch_memtag_to_string(struct gdbarch *gdbarch, struct value *tag)
int gdbarch_addr_bit(struct gdbarch *gdbarch)
bool gdbarch_set_memtags(struct gdbarch *gdbarch, struct value *address, size_t length, const gdb::byte_vector &tags, memtag_type tag_type)
struct value * gdbarch_get_memtag(struct gdbarch *gdbarch, struct value *address, memtag_type tag_type)
bool gdbarch_tagged_address_p(struct gdbarch *gdbarch, struct value *address)
bool gdbarch_memtag_matches_p(struct gdbarch *gdbarch, struct value *address)
CORE_ADDR gdbarch_memtag_granule_size(struct gdbarch *gdbarch)
CORE_ADDR gdbarch_addr_bits_remove(struct gdbarch *gdbarch, CORE_ADDR addr)
int gdbarch_ptr_bit(struct gdbarch *gdbarch)
void execute_command(const char *, int)
enum bfd_endian type_byte_order(const struct type *type)
struct type * lookup_pointer_type(struct type *type)
struct type * lookup_typename(const struct language_defn *language, const char *name, const struct block *block, int noerr)
bool is_fixed_point_type(struct type *type)
struct type * check_typedef(struct type *type)
#define TYPE_IS_REFERENCE(t)
const struct language_defn * current_language
bound_minimal_symbol lookup_minimal_symbol_by_pc_section(CORE_ADDR pc_in, struct obj_section *section, lookup_msym_prefer prefer, bound_minimal_symbol *previous)
struct bound_minimal_symbol lookup_bound_minimal_symbol(const char *name)
observable< struct objfile * > free_objfile
bool process_options(const char **args, process_options_mode mode, gdb::array_view< const option_def_group > options_group)
@ PROCESS_OPTIONS_REQUIRE_DELIMITER
std::string build_help(const char *help_tmpl, gdb::array_view< const option_def_group > options_group)
bool complete_options(completion_tracker &tracker, const char **args, process_options_mode mode, gdb::array_view< const option_def_group > options_group)
const char * objfile_name(const struct objfile *objfile)
#define ALL_OBJFILE_OSECTIONS(objfile, osect)
bool exp_uses_objfile(struct expression *exp, struct objfile *objfile)
void print_scalar_formatted(const gdb_byte *valaddr, struct type *type, const struct value_print_options *options, int size, struct ui_file *stream)
static CORE_ADDR last_examine_address
int build_address_symbolic(struct gdbarch *gdbarch, CORE_ADDR addr, bool do_demangle, bool prefer_sym_over_minsym, std::string *name, int *offset, std::string *filename, int *line, int *unmapped)
static void undisplay_command(const char *args, int from_tty)
static bool print_symbol_filename
void set_next_address(struct gdbarch *gdbarch, CORE_ADDR addr)
static void parse_with_logical_tag_input(const char *args, struct value **val, gdb::byte_vector &tags, value_print_options *print_opts)
static void enable_display_command(const char *args, int from_tty)
static void printf_floating(struct ui_file *stream, const char *format, struct value *value, enum argclass argclass)
static void eval_command(const char *arg, int from_tty)
static value_ref_ptr last_examine_value
static void disable_display_command(const char *args, int from_tty)
static void do_one_display(struct display *)
static void printf_pointer(struct ui_file *stream, const char *format, struct value *value)
void _initialize_printcmd()
int print_address_symbolic(struct gdbarch *gdbarch, CORE_ADDR addr, struct ui_file *stream, int do_demangle, const char *leadin)
static void memory_tag_print_logical_tag_command(const char *args, int from_tty)
static void info_display_command(const char *ignore, int from_tty)
static void printf_c_string(struct ui_file *stream, const char *format, struct value *value)
static void ui_printf(const char *arg, struct ui_file *stream)
static void info_address_command(const char *exp, int from_tty)
static bool last_print_tags
static void display_command(const char *arg, int from_tty)
static void memory_tag_command(const char *arg, int from_tty)
static struct type * float_type_from_length(struct type *type)
void disable_display(int num)
static void show_print_symbol_filename(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static int branch_delay_insns
static struct cmd_list_element * memory_tag_list
static struct format_data decode_format(const char **string_ptr, int oformat, int osize)
static int integer_is_zero(const gdb_byte *x, int len)
static void set_command(const char *exp, int from_tty)
static void printf_wide_c_string(struct ui_file *stream, const char *format, struct value *value)
static void enable_disable_display_command(const char *args, int from_tty, bool enable)
static void printf_command(const char *arg, int from_tty)
static bool should_validate_memtags(struct value *value)
static CORE_ADDR find_instruction_backward(struct gdbarch *gdbarch, CORE_ADDR addr, int inst_count, int *inst_read)
static void memory_tag_set_allocation_tag_command(const char *args, int from_tty)
void print_command_parse_format(const char **expp, const char *cmdname, value_print_options *opts)
static CORE_ADDR next_address
static void print_formatted(struct value *val, int size, const struct value_print_options *options, struct ui_file *stream)
void disable_current_display(void)
static struct gdbarch * next_gdbarch
static void show_max_symbolic_offset(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static void clear_dangling_display_expressions(struct objfile *objfile)
static unsigned int max_symbolic_offset
const char * pc_prefix(CORE_ADDR addr)
static CORE_ADDR find_string_backward(struct gdbarch *gdbarch, CORE_ADDR addr, int count, int char_size, const struct value_print_options *options, int *strings_counted)
static void memory_tag_with_logical_tag_command(const char *args, int from_tty)
static std::vector< std::unique_ptr< struct display > > all_displays
static void show_addr_not_tagged(CORE_ADDR address)
static void validate_format(struct format_data fmt, const char *cmdname)
void print_value(value *val, const value_print_options &opts)
static void print_command(const char *exp, int from_tty)
static void memory_tag_print_allocation_tag_command(const char *args, int from_tty)
static int display_number
static bool skip_over_slash_fmt(completion_tracker &tracker, const char **args)
void print_command_completer(struct cmd_list_element *ignore, completion_tracker &tracker, const char *text, const char *)
void print_variable_and_value(const char *name, struct symbol *var, frame_info_ptr frame, struct ui_file *stream, int indent)
static void delete_display(struct display *display)
int print_address_demangle(const struct value_print_options *opts, struct gdbarch *gdbarch, CORE_ADDR addr, struct ui_file *stream, int do_demangle)
static void memory_tag_check_command(const char *args, int from_tty)
static void print_command_1(const char *args, int voidprint)
static void parse_set_allocation_tag_input(const char *args, struct value **val, size_t *length, gdb::byte_vector &tags)
static void map_display_numbers(const char *args, gdb::function_view< void(struct display *)> function)
static void memory_tag_print_tag_command(const char *args, enum memtag_type tag_type)
static int current_display_number
static void do_examine(struct format_data fmt, struct gdbarch *gdbarch, CORE_ADDR addr)
void output_command(const char *exp, int from_tty)
void print_address(struct gdbarch *gdbarch, CORE_ADDR addr, struct ui_file *stream)
static void show_memory_tagging_unsupported(void)
static void call_command(const char *exp, int from_tty)
static void x_command(const char *exp, int from_tty)
static void info_symbol_command(const char *arg, int from_tty)
static struct value * process_print_command_args(const char *args, value_print_options *print_opts, bool voidprint)
static void display_and_x_command_completer(struct cmd_list_element *ignore, completion_tracker &tracker, const char *text, const char *)
static int read_memory_backward(struct gdbarch *gdbarch, CORE_ADDR memaddr, gdb_byte *myaddr, int len)
struct program_space * current_program_space
const char * symtab_to_filename_for_display(struct symtab *symtab)
CORE_ADDR entry_pc() const
CORE_ADDR value_address() const
struct minimal_symbol * minsym
struct obj_section * obj_section() const
struct type * builtin_declong
struct type * builtin_double
struct type * builtin_int8
struct type * builtin_data_ptr
struct type * builtin_true_unsigned_char
struct type * builtin_long_double
struct type * builtin_char16
struct type * builtin_int64
struct type * builtin_decfloat
struct type * builtin_int32
struct type * builtin_decdouble
struct type * builtin_char32
struct type * builtin_int16
struct type * builtin_float
struct type * builtin_true_char
display(const char *exp_string_, expression_up &&exp_, const struct format_data &format_, struct program_space *pspace_, const struct block *block_)
const struct block * block
struct format_data format
struct program_space * pspace
const char * print_name() const
struct obj_section * obj_section(const struct objfile *objfile) const
const char * linkage_name() const
enum language la_language
unsigned long size() const
CORE_ADDR value_raw_address() const
minimal_symbol_type type() const
CORE_ADDR value_address(objfile *objfile) const
CORE_ADDR endaddr() const
struct bfd_section * the_bfd_section
struct objfile * separate_debug_objfile_backlink
struct program_space * pspace
struct gdbarch * arch() const
objfiles_range objfiles()
bool multi_objfile_p() const
const block * value_block() const
address_class aclass() const
LONGEST value_longest() const
bool is_objfile_owned() const
CORE_ADDR value_address() const
struct objfile * objfile() const
struct obj_section * section
struct type * pointer_type
bool bit_size_differs_p() const
range_bounds * bounds() const
const ui_file_style * ptr() const
bool memory_tag_violations
struct obj_section * find_pc_overlay(CORE_ADDR pc)
CORE_ADDR overlay_unmapped_address(CORE_ADDR pc, struct obj_section *section)
int section_is_mapped(struct obj_section *osect)
CORE_ADDR overlay_mapped_address(CORE_ADDR pc, struct obj_section *section)
CORE_ADDR pc_in_unmapped_range(CORE_ADDR pc, struct obj_section *section)
int section_is_overlay(struct obj_section *section)
enum overlay_debugging_state overlay_debugging
struct block_symbol lookup_symbol(const char *name, const struct block *block, domain_enum domain, struct field_of_this_result *is_a_field_of_this)
struct symtab_and_line find_pc_sect_line(CORE_ADDR pc, struct obj_section *section, int notcurrent)
#define SYMBOL_COMPUTED_OPS(symbol)
#define SYMBOL_REGISTER_OPS(symbol)
std::string target_float_to_string(const gdb_byte *addr, const struct type *type, const char *format)
bool target_supports_memory_tagging()
int target_read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
static styled_string_s * styled_string(const ui_file_style &style, const char *str, styled_string_s &&tmp={})
int query(const char *ctlstr,...)
const char * paddress(struct gdbarch *gdbarch, CORE_ADDR addr)
void fprintf_styled(struct ui_file *stream, const ui_file_style &style, const char *format,...)
void gdb_printf(struct ui_file *stream, const char *format,...)
void fputs_styled(const char *linebuffer, const ui_file_style &style, struct ui_file *stream)
void fprintf_symbol(struct ui_file *stream, const char *name, enum language lang, int arg_mode)
void gdb_flush(struct ui_file *stream)
void gdb_puts(const char *linebuffer, struct ui_file *stream)
struct value * value_at_lazy(struct type *type, CORE_ADDR addr)
struct value * value_cast(struct type *type, struct value *arg2)
void get_formatted_print_options(struct value_print_options *opts, char format)
void value_print(struct value *val, struct ui_file *stream, const struct value_print_options *options)
void value_print_scalar_formatted(struct value *val, const struct value_print_options *options, int size, struct ui_file *stream)
void print_decimal_chars(struct ui_file *stream, const gdb_byte *valaddr, unsigned len, bool is_signed, enum bfd_endian byte_order)
void print_octal_chars(struct ui_file *stream, const gdb_byte *valaddr, unsigned len, enum bfd_endian byte_order)
gdb::option::option_def_group make_value_print_options_def_group(value_print_options *opts)
int val_print_string(struct type *elttype, const char *encoding, CORE_ADDR addr, int len, struct ui_file *stream, const struct value_print_options *options)
void get_user_print_options(struct value_print_options *opts)
void common_val_print_checked(struct value *val, struct ui_file *stream, int recurse, const struct value_print_options *options, const struct language_defn *language)
void print_hex_chars(struct ui_file *stream, const gdb_byte *valaddr, unsigned len, enum bfd_endian byte_order, bool zero_pad)
void print_floating(const gdb_byte *valaddr, struct type *type, struct ui_file *stream)
void print_binary_chars(struct ui_file *stream, const gdb_byte *valaddr, unsigned len, enum bfd_endian byte_order, bool zero_pad, const struct value_print_options *options)
struct type * value_type(const struct value *value)
int value_entirely_available(struct value *value)
int value_lazy(const struct value *value)
void clear_internalvar(struct internalvar *var)
CORE_ADDR value_as_address(struct value *val)
struct value * value_from_ulongest(struct type *type, ULONGEST num)
CORE_ADDR value_address(const struct value *value)
int record_latest_value(struct value *val)
struct value * value_from_longest(struct type *type, LONGEST num)
struct value * coerce_ref(struct value *arg)
struct value * value_from_contents(struct type *type, const gdb_byte *contents)
void set_internalvar(struct internalvar *var, struct value *val)
gdb::array_view< const gdb_byte > value_contents(struct value *value)
struct internalvar * lookup_internalvar(const char *name)
LONGEST value_as_long(struct value *val)
int value_optimized_out(struct value *value)
struct value * value_from_pointer(struct type *type, CORE_ADDR addr)
struct value * access_value_history(int num)
value_ref_ptr release_value(struct value *val)
LONGEST unpack_long(struct type *type, const gdb_byte *valaddr)
gdb::ref_ptr< struct value, value_ref_policy > value_ref_ptr