PR exp/13907:
* valprint.h (struct value_print_options) <symbol_print>: New field. * valprint.c (user_print_options): Add default for symbol_print. (show_symbol_print): New function. (generic_val_print): Respect symbol_print. (_initialize_valprint): Add "print symbol" setting. * f-valprint.c (f_val_print): Respect symbol_print. * c-valprint.c (c_val_print): Respect symbol_print. * NEWS: Update. * printcmd.c (print_address_symbolic): Return int. Ignore some zero-size symbols. (print_address_demangle): Return int. * defs.h: (print_address_symbolic): Return int. * value.h (print_address_demangle): Return int. doc * gdb.texinfo (Print Settings): Document 'set print symbol'. testsuite * gdb.mi/mi-var-cmd.exp: Update. * gdb.objc/basicclass.exp (do_objc_tests): Update. * gdb.cp/virtbase.exp: Update. * gdb.cp/classes.exp (test_static_members): Update. * gdb.cp/casts.exp: Update. * gdb.base/pointers.exp: Update. * gdb.base/funcargs.exp (pointer_args): Update. (structs_by_reference): Update. * gdb.base/find.exp: Update. * gdb.base/call-strs.exp: Send "set print symbol off". * gdb.base/call-ar-st.exp: Update. * gdb.ada/fun_addr.exp: Update. * gdb.base/printcmds.exp (test_print_symbol): New proc. Call it. (test_print_repeats_10, test_print_strings) (test_print_char_arrays): Update.
This commit is contained in:
parent
b012acddd8
commit
9cb709b6ba
|
@ -1,3 +1,21 @@
|
|||
2012-05-18 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
PR exp/13907:
|
||||
* valprint.h (struct value_print_options) <symbol_print>: New
|
||||
field.
|
||||
* valprint.c (user_print_options): Add default for symbol_print.
|
||||
(show_symbol_print): New function.
|
||||
(generic_val_print): Respect symbol_print.
|
||||
(_initialize_valprint): Add "print symbol" setting.
|
||||
* f-valprint.c (f_val_print): Respect symbol_print.
|
||||
* c-valprint.c (c_val_print): Respect symbol_print.
|
||||
* NEWS: Update.
|
||||
* printcmd.c (print_address_symbolic): Return int. Ignore some
|
||||
zero-size symbols.
|
||||
(print_address_demangle): Return int.
|
||||
* defs.h: (print_address_symbolic): Return int.
|
||||
* value.h (print_address_demangle): Return int.
|
||||
|
||||
2012-05-18 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
* valprint.c (val_print_string): Don't print leading space.
|
||||
|
|
6
gdb/NEWS
6
gdb/NEWS
|
@ -147,6 +147,12 @@
|
|||
resumes your program's execution, so it is like a printf that you
|
||||
can insert dynamically at runtime instead of at compiletime.
|
||||
|
||||
** "set print symbol"
|
||||
"show print symbol"
|
||||
Controls whether GDB attempts to display the symbol, if any,
|
||||
corresponding to addresses it prints. This defaults to "on", but
|
||||
you can set it to "off" to restore GDB's previous behavior.
|
||||
|
||||
* New targets
|
||||
|
||||
Renesas RL78 rl78-*-elf
|
||||
|
|
|
@ -268,7 +268,10 @@ c_val_print (struct type *type, const gdb_byte *valaddr,
|
|||
return;
|
||||
}
|
||||
|
||||
if (options->addressprint)
|
||||
if (options->symbol_print)
|
||||
want_space = print_address_demangle (options, gdbarch, addr,
|
||||
stream, demangle);
|
||||
else if (options->addressprint)
|
||||
{
|
||||
fputs_filtered (paddress (gdbarch, addr), stream);
|
||||
want_space = 1;
|
||||
|
@ -296,7 +299,9 @@ c_val_print (struct type *type, const gdb_byte *valaddr,
|
|||
struct minimal_symbol *msymbol =
|
||||
lookup_minimal_symbol_by_pc (vt_address);
|
||||
|
||||
if ((msymbol != NULL)
|
||||
/* If 'symbol_print' is set, we did the work above. */
|
||||
if (!options->symbol_print
|
||||
&& (msymbol != NULL)
|
||||
&& (vt_address == SYMBOL_VALUE_ADDRESS (msymbol)))
|
||||
{
|
||||
if (want_space)
|
||||
|
|
|
@ -583,8 +583,8 @@ extern int info_verbose;
|
|||
|
||||
extern void set_next_address (struct gdbarch *, CORE_ADDR);
|
||||
|
||||
extern void print_address_symbolic (struct gdbarch *, CORE_ADDR,
|
||||
struct ui_file *, int, char *);
|
||||
extern int print_address_symbolic (struct gdbarch *, CORE_ADDR,
|
||||
struct ui_file *, int, char *);
|
||||
|
||||
extern int build_address_symbolic (struct gdbarch *,
|
||||
CORE_ADDR addr,
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2012-05-18 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
* gdb.texinfo (Print Settings): Document 'set print symbol'.
|
||||
|
||||
2012-05-14 Stan Shebs <stan@codesourcery.com>
|
||||
|
||||
* gdb.texinfo (Dynamic Printf): New subsection.
|
||||
|
|
|
@ -8435,6 +8435,24 @@ does not show the symbol name and filename of the referent, even with
|
|||
the appropriate @code{set print} options turned on.
|
||||
@end quotation
|
||||
|
||||
You can also enable @samp{/a}-like formatting all the time using
|
||||
@samp{set print symbol on}:
|
||||
|
||||
@table @code
|
||||
@item set print symbol on
|
||||
Tell @value{GDBN} to print the symbol corresponding to an address, if
|
||||
one exists.
|
||||
|
||||
@item set print symbol off
|
||||
Tell @value{GDBN} not to print the symbol corresponding to an
|
||||
address. In this mode, @value{GDBN} will still print the symbol
|
||||
corresponding to pointers to functions. This is the default.
|
||||
|
||||
@item show print symbol
|
||||
Show whether @value{GDBN} will display the symbol corresponding to an
|
||||
address.
|
||||
@end table
|
||||
|
||||
Other settings control how different kinds of objects are printed:
|
||||
|
||||
@table @code
|
||||
|
|
|
@ -322,7 +322,10 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
|||
return;
|
||||
}
|
||||
|
||||
if (options->addressprint && options->format != 's')
|
||||
if (options->symbol_print)
|
||||
want_space = print_address_demangle (options, gdbarch, addr,
|
||||
stream, demangle);
|
||||
else if (options->addressprint && options->format != 's')
|
||||
{
|
||||
fputs_filtered (paddress (gdbarch, addr), stream);
|
||||
want_space = 1;
|
||||
|
|
|
@ -226,7 +226,9 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
|
|||
struct minimal_symbol *msymbol =
|
||||
lookup_minimal_symbol_by_pc (vt_address);
|
||||
|
||||
if ((msymbol != NULL)
|
||||
/* If 'symbol_print' is set, we did the work above. */
|
||||
if (!options->symbol_print
|
||||
&& (msymbol != NULL)
|
||||
&& (vt_address == SYMBOL_VALUE_ADDRESS (msymbol)))
|
||||
{
|
||||
if (want_space)
|
||||
|
|
|
@ -568,9 +568,10 @@ set_next_address (struct gdbarch *gdbarch, CORE_ADDR addr)
|
|||
DO_DEMANGLE controls whether to print a symbol in its native "raw" form,
|
||||
or to interpret it as a possible C++ name and convert it back to source
|
||||
form. However note that DO_DEMANGLE can be overridden by the specific
|
||||
settings of the demangle and asm_demangle variables. */
|
||||
settings of the demangle and asm_demangle variables. Returns
|
||||
non-zero if anything was printed; zero otherwise. */
|
||||
|
||||
void
|
||||
int
|
||||
print_address_symbolic (struct gdbarch *gdbarch, CORE_ADDR addr,
|
||||
struct ui_file *stream,
|
||||
int do_demangle, char *leadin)
|
||||
|
@ -589,7 +590,7 @@ print_address_symbolic (struct gdbarch *gdbarch, CORE_ADDR addr,
|
|||
&filename, &line, &unmapped))
|
||||
{
|
||||
do_cleanups (cleanup_chain);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
fputs_filtered (leadin, stream);
|
||||
|
@ -616,6 +617,7 @@ print_address_symbolic (struct gdbarch *gdbarch, CORE_ADDR addr,
|
|||
fputs_filtered (">", stream);
|
||||
|
||||
do_cleanups (cleanup_chain);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Given an address ADDR return all the elements needed to print the
|
||||
|
@ -683,6 +685,13 @@ build_address_symbolic (struct gdbarch *gdbarch,
|
|||
name_temp = SYMBOL_LINKAGE_NAME (symbol);
|
||||
}
|
||||
|
||||
if (msymbol != NULL
|
||||
&& MSYMBOL_SIZE (msymbol) == 0
|
||||
&& MSYMBOL_TYPE (msymbol) != mst_text
|
||||
&& MSYMBOL_TYPE (msymbol) != mst_text_gnu_ifunc
|
||||
&& MSYMBOL_TYPE (msymbol) != mst_file_text)
|
||||
msymbol = NULL;
|
||||
|
||||
if (msymbol != NULL)
|
||||
{
|
||||
if (SYMBOL_VALUE_ADDRESS (msymbol) > name_location || symbol == NULL)
|
||||
|
@ -763,10 +772,9 @@ pc_prefix (CORE_ADDR addr)
|
|||
|
||||
/* Print address ADDR symbolically on STREAM. Parameter DEMANGLE
|
||||
controls whether to print the symbolic name "raw" or demangled.
|
||||
Global setting "addressprint" controls whether to print hex address
|
||||
or not. */
|
||||
Return non-zero if anything was printed; zero otherwise. */
|
||||
|
||||
void
|
||||
int
|
||||
print_address_demangle (const struct value_print_options *opts,
|
||||
struct gdbarch *gdbarch, CORE_ADDR addr,
|
||||
struct ui_file *stream, int do_demangle)
|
||||
|
@ -778,8 +786,9 @@ print_address_demangle (const struct value_print_options *opts,
|
|||
}
|
||||
else
|
||||
{
|
||||
print_address_symbolic (gdbarch, addr, stream, do_demangle, "");
|
||||
return print_address_symbolic (gdbarch, addr, stream, do_demangle, "");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
2012-05-18 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
* gdb.mi/mi-var-cmd.exp: Update.
|
||||
* gdb.objc/basicclass.exp (do_objc_tests): Update.
|
||||
* gdb.cp/virtbase.exp: Update.
|
||||
* gdb.cp/classes.exp (test_static_members): Update.
|
||||
* gdb.cp/casts.exp: Update.
|
||||
* gdb.base/pointers.exp: Update.
|
||||
* gdb.base/funcargs.exp (pointer_args): Update.
|
||||
(structs_by_reference): Update.
|
||||
* gdb.base/find.exp: Update.
|
||||
* gdb.base/call-strs.exp: Send "set print symbol off".
|
||||
* gdb.base/call-ar-st.exp: Update.
|
||||
* gdb.ada/fun_addr.exp: Update.
|
||||
* gdb.base/printcmds.exp (test_print_symbol): New proc.
|
||||
Call it.
|
||||
(test_print_repeats_10, test_print_strings)
|
||||
(test_print_char_arrays): Update.
|
||||
|
||||
2012-05-18 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
* gdb.base/charset.exp (string_display): Update.
|
||||
|
|
|
@ -31,7 +31,7 @@ clean_restart ${testfile}
|
|||
# the inferior is *not* running (no frame).
|
||||
|
||||
gdb_test "print foo'address" \
|
||||
"= .* 0x\[0-9a-zA-Z\]+" \
|
||||
"= .* 0x\[0-9a-zA-Z\]+ <foo>" \
|
||||
"print foo'address"
|
||||
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ if {![gdb_skip_float_test "continuing to breakpoint 1220"] && \
|
|||
|
||||
#step
|
||||
gdb_test "step" \
|
||||
"print_all_arrays \\(array_i=, array_c=.ZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZa., array_f=, array_d=\\) at .*call-ar-st.c:306\[ \t\r\n\]+306.*print_int_array\\(array_i\\);.*" \
|
||||
"print_all_arrays \\(array_i=<integer_array.*>, array_c=<char_array.*> .ZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZa., array_f=<float_array.*>, array_d=<double_array.*>\\) at .*call-ar-st.c:306\[ \t\r\n\]+306.*print_int_array\\(array_i\\);.*" \
|
||||
"step inside print_all_arrays"
|
||||
|
||||
#step -over
|
||||
|
|
|
@ -56,6 +56,7 @@ gdb_reinitialize_dir $srcdir/$subdir
|
|||
gdb_load ${binfile}
|
||||
gdb_test_no_output "set print sevenbit-strings"
|
||||
gdb_test_no_output "set print address off"
|
||||
gdb_test_no_output "set print symbol off"
|
||||
gdb_test_no_output "set width 0"
|
||||
|
||||
if ![runto_main] then {
|
||||
|
|
|
@ -83,7 +83,7 @@ gdb_test "find /1 &int8_search_buf\[0\], +sizeof(int8_search_buf), 'a', 'a', 'a'
|
|||
"max-count"
|
||||
|
||||
gdb_test "print \$_" \
|
||||
"${history_prefix}.*${hex_number}" \
|
||||
"${history_prefix}.*${hex_number} <int8_search_buf\\+10>" \
|
||||
"\$_"
|
||||
|
||||
gdb_test "print \$numfound" \
|
||||
|
|
|
@ -332,7 +332,7 @@ proc pointer_args {} {
|
|||
|
||||
gdb_run_cmd
|
||||
gdb_expect {
|
||||
-re ".* call3a \\(cp=$hex \"a.*\", sp=$hex, ip=$hex, lp=$hex\\) .*$gdb_prompt $" { pass "run to call3a" }
|
||||
-re ".* call3a \\(cp=$hex <c> \"a.*\", sp=$hex <s>, ip=$hex <i>, lp=$hex <l>\\) .*$gdb_prompt $" { pass "run to call3a" }
|
||||
-re "$gdb_prompt $" { fail "run to call3a" ; gdb_suppress_tests; }
|
||||
timeout { fail "(timeout) run to call3a" ; gdb_suppress_tests; }
|
||||
}
|
||||
|
@ -344,7 +344,7 @@ proc pointer_args {} {
|
|||
|
||||
# Continue; should stop at call3b and print actual arguments.
|
||||
# Try dereferencing the arguments.
|
||||
if [gdb_test "cont" ".* call3b \\(ucp=$hex \"b.*\", usp=$hex, uip=$hex, ulp=$hex\\) .*" "continue to call3b"] {
|
||||
if [gdb_test "cont" ".* call3b \\(ucp=$hex <uc> \"b.*\", usp=$hex <us>, uip=$hex <ui>, ulp=$hex <ul>\\) .*" "continue to call3b"] {
|
||||
gdb_suppress_tests;
|
||||
}
|
||||
|
||||
|
@ -355,7 +355,7 @@ proc pointer_args {} {
|
|||
|
||||
# Continue; should stop at call3c and print actual arguments.
|
||||
# Try dereferencing the arguments.
|
||||
if [gdb_test "cont" ".* call3c \\(fp=$hex, dp=$hex\\) .*" "continue to call3c"] {
|
||||
if [gdb_test "cont" ".* call3c \\(fp=$hex <f>, dp=$hex <d>\\) .*" "continue to call3c"] {
|
||||
gdb_suppress_tests;
|
||||
}
|
||||
|
||||
|
@ -388,7 +388,7 @@ proc structs_by_reference {} {
|
|||
|
||||
gdb_run_cmd
|
||||
gdb_expect {
|
||||
-re ".* call4a \\(stp=$hex\\) .*$gdb_prompt $" {
|
||||
-re ".* call4a \\(stp=$hex <st>\\) .*$gdb_prompt $" {
|
||||
pass "run to call4a"
|
||||
}
|
||||
-re "$gdb_prompt $" { fail "run to call4a" ; gdb_suppress_tests; }
|
||||
|
@ -399,7 +399,7 @@ proc structs_by_reference {} {
|
|||
|
||||
# Continue; should stop at call4b and print actual arguments.
|
||||
|
||||
gdb_test "cont" ".* call4b \\(unp=$hex\\) .*" "continue to call4b"
|
||||
gdb_test "cont" ".* call4b \\(unp=$hex <un>\\) .*" "continue to call4b"
|
||||
|
||||
# Try dereferencing the arguments.
|
||||
if { $target_sizeof_long == $target_sizeof_int } {
|
||||
|
|
|
@ -281,4 +281,4 @@ gdb_test "ptype ppppppC" "type = char \\*\\*\\*\\*\\*\\*" "ptype ppppppC"
|
|||
# Regression test for a crash.
|
||||
|
||||
gdb_test "p instance.array_variable + 0" \
|
||||
" = \\(long (int )?\\*\\) 0x\[0-9a-f\]*"
|
||||
" = \\(long (int )?\\*\\) 0x\[0-9a-f\]* <instance>"
|
||||
|
|
|
@ -422,7 +422,7 @@ proc test_print_all_chars {} {
|
|||
# repeat count, set to the default of 10.
|
||||
|
||||
proc test_print_repeats_10 {} {
|
||||
global gdb_prompt
|
||||
global gdb_prompt decimal
|
||||
|
||||
for { set x 1; } { $x <= 16 } { incr x; } {
|
||||
gdb_test_no_output "set print elements $x"
|
||||
|
@ -464,7 +464,7 @@ proc test_print_repeats_10 {} {
|
|||
if { $aval < 16 } {
|
||||
set xstr "${xstr}\[.\]\[.\]\[.\]"
|
||||
}
|
||||
set string " = \[(\]unsigned char \[*\]\[)\] ${a}${xstr}";
|
||||
set string " = \[(\]unsigned char \[*\]\[)\] <ctable2(\\+$decimal)?> ${a}${xstr}";
|
||||
gdb_test "$command" "$string" "$command with print elements set to $x";
|
||||
}
|
||||
}
|
||||
|
@ -483,7 +483,7 @@ proc test_print_repeats_embedded_array {} {
|
|||
}
|
||||
|
||||
proc test_print_strings {} {
|
||||
global gdb_prompt
|
||||
global gdb_prompt decimal
|
||||
|
||||
# We accept "(unsigned char *) " before the string. char vs. unsigned char
|
||||
# is already tested elsewhere.
|
||||
|
@ -509,71 +509,71 @@ proc test_print_strings {} {
|
|||
gdb_test_no_output "set print elements 8"
|
||||
|
||||
gdb_test "p &ctable1\[0\]" \
|
||||
" = \\(unsigned char \\*\\) \"\""
|
||||
" = \\(unsigned char \\*\\) <ctable1> \"\""
|
||||
gdb_test "p &ctable1\[1\]" \
|
||||
" = \\(unsigned char \\*\\) \"\\\\001\\\\002\\\\003\\\\004\\\\005\\\\006\\\\a\\\\b\"..."
|
||||
" = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\001\\\\002\\\\003\\\\004\\\\005\\\\006\\\\a\\\\b\"..."
|
||||
gdb_test "p &ctable1\[1*8\]" \
|
||||
" = \\(unsigned char \\*\\) \"\\\\b\\\\t\\\\n\\\\v\\\\f\\\\r\\\\016\\\\017\"..."
|
||||
" = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\b\\\\t\\\\n\\\\v\\\\f\\\\r\\\\016\\\\017\"..."
|
||||
gdb_test "p &ctable1\[2*8\]" \
|
||||
" = \\(unsigned char \\*\\) \"\\\\020\\\\021\\\\022\\\\023\\\\024\\\\025\\\\026\\\\027\"..."
|
||||
" = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\020\\\\021\\\\022\\\\023\\\\024\\\\025\\\\026\\\\027\"..."
|
||||
gdb_test "p &ctable1\[3*8\]" \
|
||||
" = \\(unsigned char \\*\\) \"\\\\030\\\\031\\\\032\\\\033\\\\034\\\\035\\\\036\\\\037\"..."
|
||||
" = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\030\\\\031\\\\032\\\\033\\\\034\\\\035\\\\036\\\\037\"..."
|
||||
gdb_test "p &ctable1\[4*8\]" \
|
||||
" = \\(unsigned char \\*\\) \" !\\\\\"#\\\$%&'\"..."
|
||||
" = \\(unsigned char \\*\\) <ctable1\\+$decimal> \" !\\\\\"#\\\$%&'\"..."
|
||||
gdb_test "p &ctable1\[5*8\]" \
|
||||
" = \\(unsigned char \\*\\) \"\\(\\)\\*\\+,-./\"..."
|
||||
" = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\(\\)\\*\\+,-./\"..."
|
||||
gdb_test "p &ctable1\[6*8\]" \
|
||||
" = \\(unsigned char \\*\\) \"01234567\"..."
|
||||
" = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"01234567\"..."
|
||||
gdb_test "p &ctable1\[7*8\]" \
|
||||
" = \\(unsigned char \\*\\) \"89:;<=>\\?\"..."
|
||||
" = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"89:;<=>\\?\"..."
|
||||
gdb_test "p &ctable1\[8*8\]" \
|
||||
" = \\(unsigned char \\*\\) \"@ABCDEFG\"..."
|
||||
" = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"@ABCDEFG\"..."
|
||||
gdb_test "p &ctable1\[9*8\]" \
|
||||
" = \\(unsigned char \\*\\) \"HIJKLMNO\"..."
|
||||
" = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"HIJKLMNO\"..."
|
||||
gdb_test "p &ctable1\[10*8\]" \
|
||||
" = \\(unsigned char \\*\\) \"PQRSTUVW\"..."
|
||||
" = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"PQRSTUVW\"..."
|
||||
gdb_test "p &ctable1\[11*8\]" \
|
||||
" = \\(unsigned char \\*\\) \"XYZ\\\[\\\\\\\\\\\]\\^_\"..."
|
||||
" = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"XYZ\\\[\\\\\\\\\\\]\\^_\"..."
|
||||
gdb_test "p &ctable1\[12*8\]" \
|
||||
" = \\(unsigned char \\*\\) \"`abcdefg\"..."
|
||||
" = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"`abcdefg\"..."
|
||||
gdb_test "p &ctable1\[13*8\]" \
|
||||
" = \\(unsigned char \\*\\) \"hijklmno\"..."
|
||||
" = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"hijklmno\"..."
|
||||
gdb_test "p &ctable1\[14*8\]" \
|
||||
" = \\(unsigned char \\*\\) \"pqrstuvw\"..."
|
||||
" = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"pqrstuvw\"..."
|
||||
gdb_test "p &ctable1\[15*8\]" \
|
||||
" = \\(unsigned char \\*\\) \"xyz\[{|}\]+\\~\\\\177\"..."
|
||||
" = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"xyz\[{|}\]+\\~\\\\177\"..."
|
||||
gdb_test "p &ctable1\[16*8\]" \
|
||||
" = \\(unsigned char \\*\\) \"\\\\200\\\\201\\\\202\\\\203\\\\204\\\\205\\\\206\\\\207\"..."
|
||||
" = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\200\\\\201\\\\202\\\\203\\\\204\\\\205\\\\206\\\\207\"..."
|
||||
gdb_test "p &ctable1\[17*8\]" \
|
||||
" = \\(unsigned char \\*\\) \"\\\\210\\\\211\\\\212\\\\213\\\\214\\\\215\\\\216\\\\217\"..."
|
||||
" = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\210\\\\211\\\\212\\\\213\\\\214\\\\215\\\\216\\\\217\"..."
|
||||
gdb_test "p &ctable1\[18*8\]" \
|
||||
" = \\(unsigned char \\*\\) \"\\\\220\\\\221\\\\222\\\\223\\\\224\\\\225\\\\226\\\\227\"..."
|
||||
" = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\220\\\\221\\\\222\\\\223\\\\224\\\\225\\\\226\\\\227\"..."
|
||||
gdb_test "p &ctable1\[19*8\]" \
|
||||
" = \\(unsigned char \\*\\) \"\\\\230\\\\231\\\\232\\\\233\\\\234\\\\235\\\\236\\\\237\"..."
|
||||
" = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\230\\\\231\\\\232\\\\233\\\\234\\\\235\\\\236\\\\237\"..."
|
||||
gdb_test "p &ctable1\[20*8\]" \
|
||||
" = \\(unsigned char \\*\\) \"\\\\240\\\\241\\\\242\\\\243\\\\244\\\\245\\\\246\\\\247\"..."
|
||||
" = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\240\\\\241\\\\242\\\\243\\\\244\\\\245\\\\246\\\\247\"..."
|
||||
gdb_test "p &ctable1\[21*8\]" \
|
||||
" = \\(unsigned char \\*\\) \"\\\\250\\\\251\\\\252\\\\253\\\\254\\\\255\\\\256\\\\257\"..."
|
||||
" = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\250\\\\251\\\\252\\\\253\\\\254\\\\255\\\\256\\\\257\"..."
|
||||
gdb_test "p &ctable1\[22*8\]" \
|
||||
" = \\(unsigned char \\*\\) \"\\\\260\\\\261\\\\262\\\\263\\\\264\\\\265\\\\266\\\\267\"..."
|
||||
" = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\260\\\\261\\\\262\\\\263\\\\264\\\\265\\\\266\\\\267\"..."
|
||||
gdb_test "p &ctable1\[23*8\]" \
|
||||
" = \\(unsigned char \\*\\) \"\\\\270\\\\271\\\\272\\\\273\\\\274\\\\275\\\\276\\\\277\"..."
|
||||
" = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\270\\\\271\\\\272\\\\273\\\\274\\\\275\\\\276\\\\277\"..."
|
||||
gdb_test "p &ctable1\[24*8\]" \
|
||||
" = \\(unsigned char \\*\\) \"\\\\300\\\\301\\\\302\\\\303\\\\304\\\\305\\\\306\\\\307\"..."
|
||||
" = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\300\\\\301\\\\302\\\\303\\\\304\\\\305\\\\306\\\\307\"..."
|
||||
gdb_test "p &ctable1\[25*8\]" \
|
||||
" = \\(unsigned char \\*\\) \"\\\\310\\\\311\\\\312\\\\313\\\\314\\\\315\\\\316\\\\317\"..."
|
||||
" = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\310\\\\311\\\\312\\\\313\\\\314\\\\315\\\\316\\\\317\"..."
|
||||
gdb_test "p &ctable1\[26*8\]" \
|
||||
" = \\(unsigned char \\*\\) \"\\\\320\\\\321\\\\322\\\\323\\\\324\\\\325\\\\326\\\\327\"..."
|
||||
" = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\320\\\\321\\\\322\\\\323\\\\324\\\\325\\\\326\\\\327\"..."
|
||||
gdb_test "p &ctable1\[27*8\]" \
|
||||
" = \\(unsigned char \\*\\) \"\\\\330\\\\331\\\\332\\\\333\\\\334\\\\335\\\\336\\\\337\"..."
|
||||
" = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\330\\\\331\\\\332\\\\333\\\\334\\\\335\\\\336\\\\337\"..."
|
||||
gdb_test "p &ctable1\[28*8\]" \
|
||||
" = \\(unsigned char \\*\\) \"\\\\340\\\\341\\\\342\\\\343\\\\344\\\\345\\\\346\\\\347\"..."
|
||||
" = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\340\\\\341\\\\342\\\\343\\\\344\\\\345\\\\346\\\\347\"..."
|
||||
gdb_test "p &ctable1\[29*8\]" \
|
||||
" = \\(unsigned char \\*\\) \"\\\\350\\\\351\\\\352\\\\353\\\\354\\\\355\\\\356\\\\357\"..."
|
||||
" = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\350\\\\351\\\\352\\\\353\\\\354\\\\355\\\\356\\\\357\"..."
|
||||
gdb_test "p &ctable1\[30*8\]" \
|
||||
" = \\(unsigned char \\*\\) \"\\\\360\\\\361\\\\362\\\\363\\\\364\\\\365\\\\366\\\\367\"..."
|
||||
" = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\360\\\\361\\\\362\\\\363\\\\364\\\\365\\\\366\\\\367\"..."
|
||||
gdb_test "p &ctable1\[31*8\]" \
|
||||
" = \\(unsigned char \\*\\) \"\\\\370\\\\371\\\\372\\\\373\\\\374\\\\375\\\\376\\\\377\"..."
|
||||
" = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\370\\\\371\\\\372\\\\373\\\\374\\\\375\\\\376\\\\377\"..."
|
||||
}
|
||||
|
||||
proc test_print_int_arrays {} {
|
||||
|
@ -624,7 +624,7 @@ proc test_artificial_arrays {} {
|
|||
|
||||
proc test_print_char_arrays {} {
|
||||
global gdb_prompt
|
||||
global hex
|
||||
global hex decimal
|
||||
|
||||
gdb_test_no_output "set print elements 24"
|
||||
gdb_test_no_output "set print address on"
|
||||
|
@ -632,17 +632,17 @@ proc test_print_char_arrays {} {
|
|||
gdb_test "p arrays" \
|
||||
" = {array1 = \"abc\", array2 = \"d\", array3 = \"e\", array4 = \"fg\", array5 = \"hij\"}"
|
||||
|
||||
gdb_test "p parrays" " = \\(struct some_arrays \\*\\) $hex"
|
||||
gdb_test "p parrays" " = \\(struct some_arrays \\*\\) $hex <arrays>"
|
||||
gdb_test "p parrays->array1" " = \"abc\""
|
||||
gdb_test "p &parrays->array1" " = \\(unsigned char \\(\\*\\)\\\[4\\\]\\) $hex"
|
||||
gdb_test "p &parrays->array1" " = \\(unsigned char \\(\\*\\)\\\[4\\\]\\) $hex <arrays>"
|
||||
gdb_test "p parrays->array2" " = \"d\""
|
||||
gdb_test "p &parrays->array2" " = \\(unsigned char \\(\\*\\)\\\[1\\\]\\) $hex"
|
||||
gdb_test "p &parrays->array2" " = \\(unsigned char \\(\\*\\)\\\[1\\\]\\) $hex <arrays\\+$decimal>"
|
||||
gdb_test "p parrays->array3" " = \"e\""
|
||||
gdb_test "p &parrays->array3" " = \\(unsigned char \\(\\*\\)\\\[1\\\]\\) $hex"
|
||||
gdb_test "p &parrays->array3" " = \\(unsigned char \\(\\*\\)\\\[1\\\]\\) $hex <arrays\\+$decimal>"
|
||||
gdb_test "p parrays->array4" " = \"fg\""
|
||||
gdb_test "p &parrays->array4" " = \\(unsigned char \\(\\*\\)\\\[2\\\]\\) $hex"
|
||||
gdb_test "p &parrays->array4" " = \\(unsigned char \\(\\*\\)\\\[2\\\]\\) $hex <arrays\\+$decimal>"
|
||||
gdb_test "p parrays->array5" " = \"hij\""
|
||||
gdb_test "p &parrays->array5" " = \\(unsigned char \\(\\*\\)\\\[4\\\]\\) $hex"
|
||||
gdb_test "p &parrays->array5" " = \\(unsigned char \\(\\*\\)\\\[4\\\]\\) $hex <arrays\\+$decimal>"
|
||||
|
||||
gdb_test_no_output "set print address off"
|
||||
}
|
||||
|
@ -773,6 +773,16 @@ proc test_printf_with_dfp {} {
|
|||
gdb_test "printf \"%DDf\\n\",1.2E6144dl" "1.200000000000000000000000000000000E\\+6144"
|
||||
}
|
||||
|
||||
proc test_print_symbol {} {
|
||||
gdb_test_no_output "set print symbol on"
|
||||
|
||||
gdb_test "print &three" " = .* <three>"
|
||||
gdb_test "print parrays" " = .* <arrays>"
|
||||
|
||||
# In case somebody adds tests after this.
|
||||
gdb_test_no_output "set print symbol off"
|
||||
}
|
||||
|
||||
# Escape a left curly brace to prevent it from being interpreted as
|
||||
# the beginning of a bound
|
||||
proc gdb_test_escape_braces { args } {
|
||||
|
@ -840,3 +850,4 @@ test_print_array_constants
|
|||
test_print_enums
|
||||
test_printf
|
||||
test_printf_with_dfp
|
||||
test_print_symbol
|
||||
|
|
|
@ -141,7 +141,7 @@ gdb_test "print dynamic_cast<Alpha &> (derived)" \
|
|||
"dynamic_cast simple upcast to reference"
|
||||
|
||||
gdb_test "print dynamic_cast<Derived *> (ad)" \
|
||||
" = \\(Derived \\*\\) $nonzero_hex" \
|
||||
" = \\(Derived \\*\\) ${nonzero_hex}( <vtable for Derived.*>)?" \
|
||||
"dynamic_cast simple downcast"
|
||||
|
||||
gdb_test "print dynamic_cast<VirtuallyDerived *> (add)" \
|
||||
|
@ -157,7 +157,7 @@ gdb_test "print dynamic_cast<VirtuallyDerived &> (*ad)" \
|
|||
"dynamic_cast to reference to non-existing base"
|
||||
|
||||
gdb_test "print dynamic_cast<DoublyDerived *> (add)" \
|
||||
" = \\(DoublyDerived \\*\\) $nonzero_hex" \
|
||||
" = \\(DoublyDerived \\*\\) ${nonzero_hex}( <vtable for DoublyDerived.*>)?" \
|
||||
"dynamic_cast unique downcast"
|
||||
|
||||
gdb_test "print dynamic_cast<Gamma *> (add)" \
|
||||
|
|
|
@ -519,8 +519,8 @@ proc test_static_members {} {
|
|||
gdb_test "print Foo::st" "\\$\[0-9\]+ = 100"
|
||||
gdb_test_no_output "set foo.st = 200" ""
|
||||
gdb_test "print bar.st" "\\$\[0-9\]+ = 200"
|
||||
gdb_test "print &foo.st" "\\$\[0-9\]+ = \\(int ?\\*\\) $hex"
|
||||
gdb_test "print &Bar::st" "\\$\[0-9\]+ = \\(int ?\\*\\) $hex"
|
||||
gdb_test "print &foo.st" "\\$\[0-9\]+ = \\(int ?\\*\\) $hex <Foo::st>"
|
||||
gdb_test "print &Bar::st" "\\$\[0-9\]+ = \\(int ?\\*\\) $hex <Foo::st>"
|
||||
gdb_test "print *\$" "\\$\[0-9\]+ = 200"
|
||||
|
||||
gdb_test_no_output "set print static-members off"
|
||||
|
|
|
@ -72,10 +72,10 @@ gdb_test "print rtti_data" " = .*, data = 1\}"
|
|||
# value history to check the pointer value is not changed. If it had
|
||||
# been changed, then we'd not be able to find the real type anymore.
|
||||
gdb_test "print virtual_middle_b" \
|
||||
" = \\(Virtual \\*\\) $hex" \
|
||||
" = \\(Virtual \\*\\) $hex <virtual_o>" \
|
||||
"print pointer to virtual base at non-zero offset of larger object"
|
||||
gdb_test "print $" \
|
||||
" = \\(Virtual \\*\\) $hex" \
|
||||
" = \\(Virtual \\*\\) $hex <virtual_o>" \
|
||||
"print same pointer from history value"
|
||||
gdb_test "print *$$" \
|
||||
" = \\(Virtual\\) {<VirtualMiddleA> = {<VirtualBase> = {_vptr.VirtualBase = ${hex}( <vtable for Virtual.*>)?, x = 0}, _vptr.VirtualMiddleA = ${hex}( <vtable for Virtual.*>)?, y = \\{0 <repeats 300 times>\\}}, <VirtualMiddleB> = {_vptr.VirtualMiddleB = ${hex}( <vtable for Virtual.*>)?, y = 0}, _vptr.Virtual = ${hex}( <vtable for Virtual.*>)?, z = 0}" \
|
||||
|
|
|
@ -377,11 +377,11 @@ mi_gdb_test "-var-update *" \
|
|||
"assign same value to func (update)"
|
||||
|
||||
mi_gdb_test "-var-create array_ptr * array_ptr" \
|
||||
"\\^done,name=\"array_ptr\",numchild=\"1\",value=\"$hex\",type=\"int \\*\",has_more=\"0\"" \
|
||||
"\\^done,name=\"array_ptr\",numchild=\"1\",value=\"$hex <array>\",type=\"int \\*\",has_more=\"0\"" \
|
||||
"create global variable array_ptr"
|
||||
|
||||
mi_gdb_test "-var-assign array_ptr array2" \
|
||||
"\\^done,value=\"$hex\"" \
|
||||
"\\^done,value=\"$hex <array2>\"" \
|
||||
"assign array to pointer"
|
||||
|
||||
mi_gdb_test "-var-update *" \
|
||||
|
@ -389,7 +389,7 @@ mi_gdb_test "-var-update *" \
|
|||
"assign array to pointer (update)"
|
||||
|
||||
mi_gdb_test "-var-assign array_ptr array2" \
|
||||
"\\^done,value=\"$hex\"" \
|
||||
"\\^done,value=\"$hex <array2>\"" \
|
||||
"assign same array to pointer"
|
||||
|
||||
mi_gdb_test "-var-update *" \
|
||||
|
|
|
@ -148,7 +148,7 @@ gdb_test "print self" \
|
|||
" print self"
|
||||
|
||||
gdb_test "print \*self" \
|
||||
"\\$\[0-9\] = \{{?isa = 0x\[0-9a-f\]+}?, object = 0x0\}" \
|
||||
"\\$\[0-9\] = \{{?isa = 0x\[0-9a-f\]+( <.*>)?}?, object = 0x0\}" \
|
||||
" print contents of self"
|
||||
|
||||
#
|
||||
|
|
|
@ -85,7 +85,8 @@ struct value_print_options user_print_options =
|
|||
1, /* static_field_print */
|
||||
1, /* pascal_static_field_print */
|
||||
0, /* raw */
|
||||
0 /* summary */
|
||||
0, /* summary */
|
||||
1 /* symbol_print */
|
||||
};
|
||||
|
||||
/* Initialize *OPTS to be a copy of the user print options. */
|
||||
|
@ -219,6 +220,16 @@ show_addressprint (struct ui_file *file, int from_tty,
|
|||
{
|
||||
fprintf_filtered (file, _("Printing of addresses is %s.\n"), value);
|
||||
}
|
||||
|
||||
static void
|
||||
show_symbol_print (struct ui_file *file, int from_tty,
|
||||
struct cmd_list_element *c, const char *value)
|
||||
{
|
||||
fprintf_filtered (file,
|
||||
_("Printing of symbols when printing pointers is %s.\n"),
|
||||
value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* A helper function for val_print. When printing in "summary" mode,
|
||||
|
@ -388,7 +399,9 @@ generic_val_print (struct type *type, const gdb_byte *valaddr,
|
|||
return;
|
||||
}
|
||||
|
||||
if (options->addressprint)
|
||||
if (options->symbol_print)
|
||||
print_address_demangle (options, gdbarch, addr, stream, demangle);
|
||||
else if (options->addressprint)
|
||||
fputs_filtered (paddress (gdbarch, addr), stream);
|
||||
}
|
||||
break;
|
||||
|
@ -2600,6 +2613,14 @@ Show printing of addresses."), NULL,
|
|||
show_addressprint,
|
||||
&setprintlist, &showprintlist);
|
||||
|
||||
add_setshow_boolean_cmd ("symbol", class_support,
|
||||
&user_print_options.symbol_print, _("\
|
||||
Set printing of symbol names when printing pointers."), _("\
|
||||
Show printing of symbol names when printing pointers."),
|
||||
NULL, NULL,
|
||||
show_symbol_print,
|
||||
&setprintlist, &showprintlist);
|
||||
|
||||
add_setshow_zuinteger_cmd ("input-radix", class_support, &input_radix_1,
|
||||
_("\
|
||||
Set default input radix for entering numbers."), _("\
|
||||
|
|
|
@ -90,6 +90,10 @@ struct value_print_options
|
|||
|
||||
/* If nonzero, print the value in "summary" form. */
|
||||
int summary;
|
||||
|
||||
/* If nonzero, when printing a pointer, print the symbol to which it
|
||||
points, if any. */
|
||||
int symbol_print;
|
||||
};
|
||||
|
||||
/* The global print options set by the user. In general this should
|
||||
|
|
|
@ -491,9 +491,9 @@ extern void read_value_memory (struct value *val, int embedded_offset,
|
|||
struct frame_info;
|
||||
struct fn_field;
|
||||
|
||||
extern void print_address_demangle (const struct value_print_options *,
|
||||
struct gdbarch *, CORE_ADDR,
|
||||
struct ui_file *, int);
|
||||
extern int print_address_demangle (const struct value_print_options *,
|
||||
struct gdbarch *, CORE_ADDR,
|
||||
struct ui_file *, int);
|
||||
|
||||
extern LONGEST value_as_long (struct value *val);
|
||||
extern DOUBLEST value_as_double (struct value *val);
|
||||
|
|
Loading…
Reference in New Issue