Age | Commit message (Collapse) | Author | Files | Lines |
|
This adds cp_print_value, a value-based analogue of cp_print_val, and
changes cp_print_value_fields to use it.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* cp-valprint.c (cp_print_value_fields): Update.
(cp_print_value): New function.
|
|
This adds cp_print_value_fields and c_value_print_struct, value-based
analogues of the corresponding val-printing functions. Note that the
Modula-2 printing code also calls cp_print_val_fields, and so is
updated to call the function function.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* m2-valprint.c (m2_value_print_inner): Use
cp_print_value_fields.
* cp-valprint.c (cp_print_value_fields): New function.
* c-valprint.c (c_value_print_struct): New function.
(c_value_print_inner): Use c_value_print_struct.
* c-lang.h (cp_print_value_fields): Declare.
|
|
This adds c_value_print_array, a value-based analogue of
c_val_print_array.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* c-valprint.c (c_value_print_array): New function.
(c_value_print_inner): Use it.
|
|
This adds c_value_print_memberptr, a value-based analogue of
c_val_print_memberptr.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* c-valprint.c (c_value_print_memberptr): New function.
(c_value_print_inner): Use it.
|
|
This adds c_value_print_int, a value-based analogue of
c_val_print_int.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* c-valprint.c (c_value_print_int): New function.
(c_value_print_inner): Use it.
|
|
This adds c_value_print_ptr, a value-based analogue of
c_val_print_ptr.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* c-valprint.c (c_value_print_ptr): New function.
(c_value_print_inner): Use it.
|
|
This rewrites c_value_print_inner, copying in the body of
c_val_print_inner and adusting as needed. This will form the base of
future changes to fully convert this to using the value-based API
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* c-valprint.c (c_value_print_inner): Rewrite.
|
|
This adds generic_value_print_complex, a value-based analogue of
generic_val_print_complex.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* valprint.c (generic_value_print_complex): New function.
(generic_value_print): Use it.
|
|
This changes generic_val_print_float not to call
val_print_scalar_formatted. This lets generic_value_print then use
value_print_scalar_formatted instead.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* valprint.c (generic_val_print_float): Don't call
val_print_scalar_formatted.
(generic_val_print, generic_value_print): Update.
|
|
This adds generic_value_print_char, a value-based analogue of
generic_val_print_char.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* valprint.c (generic_value_print_char): New function
(generic_value_print): Use it.
|
|
This adds generic_value_print_int, a value-based analogue of
generic_val_print_int.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* valprint.c (generic_value_print_int): New function.
(generic_value_print): Use it.
|
|
This adds generic_value_print_bool, a value-based analogue of
generic_val_print_bool.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* valprint.c (generic_value_print_bool): New function.
(generic_value_print): Use it.
|
|
This removes the call to val_print_scalar_formatted from
generic_val_print_func, allowing generic_value_print to call the
value-based variant instead.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* valprint.c (generic_val_print_func): Simplify.
(generic_val_print, generic_value_print): Update.
|
|
This remove generic_val_print_flags in favor of using the value-based
API where possible.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* valprint.c (generic_val_print_flags): Remove.
(generic_val_print, generic_value_print): Update.
(val_print_type_code_flags): Add original_value parameter.
|
|
This removes a call to val_print_scalar_formatted from
generic_val_print_enum, preferring to do the work in the callers.
This lets generic_value_print use the value-based API.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* valprint.c (generic_val_print): Update.
(generic_value_print): Update.
* valprint.c (generic_val_print_enum): Don't call
val_print_scalar_formatted.
|
|
This introduces generic_value_print_ptr, a value-based analogue of
generic_val_print_ptr, and changes generic_value_print to use it.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* valprint.c (generic_value_print): Call generic_value_print_ptr.
* valprint.c (generic_value_print_ptr): New function.
|
|
This rewrites generic_value_print, by copying in the body of
generic_val_print and making the needed adjustments.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* valprint.c (generic_value_print): Rewrite.
|
|
This finishes the conversion of Pascal to the value-based API, by
introducing two more value-based analogues of existing val-print
functions.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* p-valprint.c (pascal_object_print_value_fields)
(pascal_object_print_value): New functions.
|
|
This rewrites pascal_value_print_inner, copying in the body of
pascal_val_print_inner and adusting as needed. This will form the
base of future changes to fully convert this to using the value-based
API.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* p-valprint.c (pascal_value_print_inner): Rewrite.
|
|
This finishes the conversion of the Fortran printing code to the
value-based API. The body of f_val_print is copied into
f_value_print_innner, and then modified as needed to use the value
API.
Note that not all calls must be updated. For example, f77_print_array
remains "val-like", because it does not result in any calls to
val_print (f77_print_array_1 calls common_val_print, which is
nominally value-based).
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* f-valprint.c (f_value_print_innner): Rewrite.
|
|
This finishes the conversion of Modula-2 printing to the value-based
API. It does so by copying the body of m2_val_print into
m2_value_print_inner, and then introducing new functions as needed to
use the value API.
The "val_" API code continues to exist, because it's still possible
for it to be called via some paths. This code will all be removed at
the end of the series.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* m2-valprint.c (m2_print_unbounded_array): New overload.
(m2_print_unbounded_array): Update.
(m2_print_array_contents): Take a struct value.
(m2_value_print_inner): Rewrite.
|
|
As with Rust and Go, it was straightforward to convert D to the
value-based API directly.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* d-valprint.c (dynamic_array_type): Call d_value_print_inner.
(d_value_print_inner): New function.
* d-lang.h (d_value_print_inner): Declare.
* d-lang.c (d_language_defn): Use d_value_print_inner.
|
|
This introduces go_value_print_inner, a modified copy of go_val_print.
Unlike some of the other languages, Go was straightforward to convert
to the value-based API all at once, so this patch takes that approach.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* go-valprint.c (go_value_print_inner): New function.
* go-lang.h (go_value_print_inner): Declare.
* go-lang.c (go_language_defn): Use go_value_print_inner.
|
|
For Rust, it was simple to convert the printing code to the
value-based API all at once.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* rust-lang.c (val_print_struct, rust_print_enum): Use the value
API.
(rust_val_print): Rewrite.
(rust_value_print_inner): New function, from rust_val_print.
(rust_language_defn): Use rust_value_print_inner.
|
|
This introduces ada_value_print_inner.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* ada-valprint.c (ada_value_print_inner): New function.
* ada-lang.h (ada_value_print_inner): Declare.
* ada-lang.c (ada_language_defn): Use ada_value_print_inner.
|
|
This introduces f_value_print_innner.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* f-valprint.c (f_value_print_innner): New function.
* f-lang.h (f_value_print_innner): Declare.
* f-lang.c (f_language_defn): Use f_value_print_innner.
|
|
This introduces pascal_value_print_inner.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* p-valprint.c (pascal_value_print_inner): New function.
* p-lang.h (pascal_value_print_inner): Declare.
* p-lang.c (pascal_language_defn): Use pascal_value_print_inner.
|
|
This introduces m2_value_print_inner.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* m2-valprint.c (m2_value_print_inner): New function.
* m2-lang.h (m2_value_print_inner): Declare.
* m2-lang.c (m2_language_defn): Use m2_value_print_inner.
|
|
This introduces c_value_print_inner, which implements the
la_value_print_inner method for the C family of languages. In this
patch, it is just a simple wrapper of c_val_print. However,
subsequent patches will convert it to use the value API. The
transformation is done this way to make each patch easier to review.
Future patches will apply this same treatment to other languages as
well.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* opencl-lang.c (opencl_language_defn): Use c_value_print_inner.
* objc-lang.c (objc_language_defn): Use c_value_print_inner.
* c-valprint.c (c_value_print_inner): New function.
* c-lang.h (c_value_print_inner): Declare.
* c-lang.c (c_language_defn, cplus_language_defn)
(asm_language_defn, minimal_language_defn): Use
c_value_print_inner.
|
|
pascal_object_print_value_fields is only needed in p-valprint.c, so
make it static.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* p-valprint.c (pascal_object_print_value_fields): Now static.
* p-lang.h (pascal_object_print_value_fields): Don't declare.
|
|
This slightly simplifies c_val_print_array by moving a variable to a
more inner scope and removing a dead assignment.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* c-valprint.c (c_val_print_array): Simplify.
|
|
This introduces value_print_array_elements, which is an analogue of
val_print_array_elements that uses the value API.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* valprint.c (value_print_array_elements): New function.
* valprint.h (value_print_array_elements): Declare.
|
|
A couple of spots could be easily converted to use
value_print_scalar_formatted. This patch makes this change.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* printcmd.c (print_formatted): Use value_print_scalar_formatted.
* mips-tdep.c (mips_print_register): Use
value_print_scalar_formatted.
|
|
This introduces a value_print_scalar_formatted, which is an analogue
of val_print_scalar_formatted that uses the value API.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* valprint.h (value_print_scalar_formatted): Declare.
* valprint.c (value_print_scalar_formatted): New function.
|
|
This introduces generic_value_print, which is a value-based analogue
to generic_val_print. For now this is unused and simply calls
generic_val_print, but subsequent patches will both change this
function to work using the value API directly, and convert callers of
generic_val_print to call this instead.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* valprint.h (generic_value_print): Declare.
* valprint.c (generic_value_print): New function.
|
|
The plan for removing val_print is, essentially, to first duplicate
printing code as needed to use the value API; and then remove the
val_print code. This makes it possible to do the changes
incrementally while keeping everything working.
This adds a new la_value_print_inner function pointer to struct
language_defn. Eventually this will replace la_val_print. This patch
also changes printing to prefer this API, when available -- but no
language defines it yet.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* valprint.c (do_val_print): Call la_value_print_inner, if
available.
* rust-lang.c (rust_language_defn): Update.
* p-lang.c (pascal_language_defn): Update.
* opencl-lang.c (opencl_language_defn): Update.
* objc-lang.c (objc_language_defn): Update.
* m2-lang.c (m2_language_defn): Update.
* language.h (struct language_defn) <la_value_print_inner>: New
member.
* language.c (unknown_language_defn, auto_language_defn): Update.
* go-lang.c (go_language_defn): Update.
* f-lang.c (f_language_defn): Update.
* d-lang.c (d_language_defn): Update.
* c-lang.c (c_language_defn, cplus_language_defn)
(asm_language_defn, minimal_language_defn): Update.
* ada-lang.c (ada_language_defn): Update.
|
|
This changes c_value_print to call common_val_print. This is more
complicated than the usual sort of common_val_print change, due to the
handling of RTTI.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* c-valprint.c (c_value_print): Use common_val_print.
gdb/testsuite/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* gdb.base/printcmds.exp (test_print_strings): Add regression
test.
* gdb.base/printcmds.c (charptr): New typedef.
(teststring2): New global.
|
|
This changes a spot in cp-valprint.c to use common_val_print rather
than val_print.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* cp-valprint.c (cp_print_static_field): Use common_val_print.
|
|
This changes a couple spots in f-valprint.c to use common_val_print
rather than val_print.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* f-valprint.c (f77_print_array_1, f_val_print): Use
common_val_print.
|
|
This changes some spots in riscv-tdep.c to use common_val_print rather
than val_print.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* riscv-tdep.c (riscv_print_one_register_info): Use
common_val_print.
|
|
This changes a spot in mi-main.c to use common_val_print rather than
val_print.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* mi/mi-main.c (output_register): Use common_val_print.
|
|
This changes some spots in infcmd.c to use common_val_print (which,
despite its name, is a value-based API) rather than val_print.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* infcmd.c (default_print_one_register_info): Use
common_val_print.
|
|
A (much) later patch will remove the call to value_check_printable
from common_val_print. This will needed to preserve some details of
how optimized-out structures are printed.
However, doing this will also break dw2-op-out-param.exp. Making the
change causes "bt" to print:
However, the test wants to see:
... operand2=<optimized out>
That is, a wholly-optimized out structure should not print its fields.
So, this patch introduces a new common_val_print_checked, which calls
value_check_printable first, and then arranges to use it in the one
spot that affects the test suite.
I was not completely sure if it would be preferable to change the
test. However, I reasoned that, assuming this output was intentional
in the first place, in a backtrace space is at a premium and so this
is a reasonable approach. In other spots calling common_val_print,
this behavior is probably unintended, or at least a "don't care".
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* valprint.h (common_val_print_checked): Declare.
* valprint.c (common_val_print_checked): New function.
* stack.c (print_frame_arg): Use common_val_print_checked.
|
|
This changes val_print and common_val_print to use a new helper
function. A theme in the coming patches is that calls to val_print
itself should be removed. This is the first such patch; at the end of
the series, we'll remove val_print and simplify do_val_print.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* valprint.c (do_val_print): New function, from val_print.
(val_print): Use do_val_print.
(common_val_print): Use do_val_print.
|
|
Switching the low-level printing to use the value API means we will be
using more temporary values. This adds a scoped_value_mark to
value_print, so that these intermediates are destroyed in a timely
way.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* valprint.c (value_print): Use scoped_value_mark.
|
|
Removes paths from some test names, and make the test names unique in
the gdb.base/break-interp.exp test file.
gdb/testsuite/ChangeLog:
* gdb.base/break-interp.exp: Use the tail of the filename, not the
full path in the test name.
(test_ld): Add some with_test_prefix blocks to make test names
unique.
|
|
With debug info packages for system libs installed, I run into buffer full
errors with test-case gdb.mi/mi-sym-info.exp. Fix these using exp_continue.
This exposes timeouts due to gdb taking a long time before starting to print
output. Fix these using with_timeout_factor.
Tested on x86_64-linux, with make targets check and check-read1.
gdb/testsuite/ChangeLog:
2020-03-13 Tom de Vries <tdevries@suse.de>
* gdb.mi/mi-sym-info.exp: Fix buffer full errors, and timeouts.
|
|
With debug info packages for system libraries installed, I currently run into
some "internal buffer is full" errors with test-case gdb.mi/mi-sym-info.exp,
but if I disable the corresponding tests, I get further-on:
...
FAIL: gdb.mi/mi-sym-info.exp: List all functions matching pattern f3 \
(unexpected output)
FAIL: gdb.mi/mi-sym-info.exp: List all functions matching type void \
(unexpected output)
FAIL: gdb.mi/mi-sym-info.exp: List all variables matching type float \
(unexpected output)
FAIL: gdb.mi/mi-sym-info.exp: -symbol-info-functions --max-results 1 \
(unexpected output)
FAIL: gdb.mi/mi-sym-info.exp: -symbol-info-functions --max-results 2 \
(unexpected output)
...
Fix this by making the matching more precise.
Tested on x86_64-linux.
Also tested with an extra:
...
mi_gdb_test "set debug-file-directory"
...
to prevent gdb from finding the debug info for system libraries.
gdb/testsuite/ChangeLog:
2020-03-13 Tom de Vries <tdevries@suse.de>
* gdb.mi/mi-sym-info.exp: Make matching more precise.
|
|
Consider test-case gdb.dwarf2/imported-unit.exp.
It contains a CU with type int:
...
<0><129>: Abbrev Number: 2 (DW_TAG_compile_unit)
<12a> DW_AT_language : 4 (C++)
<12b> DW_AT_name : imported_unit.c
<1><13b>: Abbrev Number: 3 (DW_TAG_base_type)
<13c> DW_AT_byte_size : 4
<13d> DW_AT_encoding : 5 (signed)
<13e> DW_AT_name : int
...
which is imported in another CU:
...
<0><d2>: Abbrev Number: 2 (DW_TAG_compile_unit)
<d3> DW_AT_language : 4 (C++)
<d4> DW_AT_name : <artificial>
<1><e1>: Abbrev Number: 3 (DW_TAG_imported_unit)
<e2> DW_AT_import : <0x129> [Abbrev Number: 2]
...
However, if we print the partial symbols:
...
$ gdb -batch imported-unit -ex "maint print psymbols"
...
we see type int both in the importing CU:
...
Partial symtab for source file <artificial>@0xc7 (object 0x29f9b80)
...
Depends on 1 other partial symtabs.
0 0x2a24240 imported_unit.c
Global partial symbols:
`main', function, 0x4004b2
Static partial symbols:
`int', type, 0x0
...
and in the imported CU:
...
Partial symtab for source file imported_unit.c (object 0x2a24240)
...
Depends on 0 other partial symtabs.
Shared partial symtab with user 0x29f9b80
Static partial symbols:
`int', type, 0x0
...
This is an artefact resulting from the fact that all CUs in an objfile
share the same storage array for static partial symbols (and another array for
global partial symbols), using a range to describe their symbols.
Then when scanning the partial symbols of a CU and encountering an import, either:
- the referred CU has not been parsed yet, and will be parsed, and the range of
static partial symbols of the referred CU will be a subrange of the range of
static partial symbols of this CU, or
- the referred CU has already been parsed, and the range of static partial
symbols of the referred CU will not be a subrange of the range of static
partial symbols of this CU.
This is inconsistent handling, and confuses the notion of a symbol belonging to
a single symtab.
Furthermore, it might slow down searches, given that the symbol needs to be
skipped twice.
Finally, the same issue holds for global partial symbols, where the range of a
CU is sorted after parsing is finished. Obviously sorting the range of a CU
may invalidate subranges, effectively moving symbols in and out of imported
CUs.
Fix this for both static and global partial symbols, by gathering partial
symbols in a per-CU vector, and adding those symbols to the per-objfile
storage only once complete.
Tested on x86_64-linux, with native and board cc-with-dwz and cc-with-dwz-m.
gdb/ChangeLog:
2020-03-13 Tom de Vries <tdevries@suse.de>
PR symtab/25646
* psymtab.c (partial_symtab::partial_symtab): Don't set
globals_offset and statics_offset. Push element onto
current_global_psymbols and current_static_psymbols stacks.
(concat): New function.
(end_psymtab_common): Set globals_offset and statics_offset. Pop
element from current_global_psymbols and current_static_psymbols
stacks. Concat popped elements to global_psymbols and
static_symbols.
(add_psymbol_to_list): Use current_global_psymbols and
current_static_psymbols stacks.
* psymtab.h (class psymtab_storage): Add current_global_psymbols and
current_static_psymbols fields.
gdb/testsuite/ChangeLog:
2020-03-13 Tom de Vries <tdevries@suse.de>
PR symtab/25646
* gdb.dwarf2/imported-unit.exp: Add test.
|
|
When running gdb.mi/mi-sym-info.exp on openSUSE Leap 15.1, I get:
...
FAIL: gdb.mi/mi-sym-info.exp: List all functions matching type void \
(unexpected output)
FAIL: gdb.mi/mi-sym-info.exp: -symbol-info-variables --max-results 3 \
(unexpected output)
FAIL: gdb.mi/mi-sym-info.exp: -symbol-info-types --max-results 4 \
(unexpected output)
...
The executable contains debug info from files other than the source files:
...
$ readelf -wi mi-sym-info | grep "DW_AT_name.*\.[cS]$" | awk '{print $8}'
../sysdeps/x86_64/start.S
init.c
../sysdeps/x86_64/crti.S
src/gdb/testsuite/gdb.mi/mi-sym-info-1.c
src/gdb/testsuite/gdb.mi/mi-sym-info-2.c
elf-init.c
../sysdeps/x86_64/crtn.S
...
The test does not expect this extra info, resulting in matching failures.
Fix this by restricting the failing commands using --name.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2020-03-13 Tom de Vries <tdevries@suse.de>
* gdb.mi/mi-sym-info-2.c (another_char_t, another_short_t): New typedef.
(var1, var2): New variable.
* gdb.mi/mi-sym-info.exp: Add --name to various commands to restrict
matching symbols.
|