Age | Commit message (Collapse) | Author | Files | Lines |
|
This changes skip_rust_tests to invert the sense, and renames it to
allow_rust_tests.
|
|
This changes skip_python_tests to invert the sense, and renames it to
allow_python_tests.
|
|
This changes various tests to use "require" for the Python feature.
|
|
This changes some tests to use "require !skip_rust_tests".
|
|
This series changes 'require' to take a list of simple predicates.
This patch backs out the one use of 'require' that doesn't conform to
this -- calling ensure_gdb_index.
|
|
This commit is the result of running the gdb/copyright.py script,
which automated the update of the copyright year range for all
source files managed by the GDB project to be updated to include
year 2023.
|
|
The following commit broke the readnow detection in the testsuite:
commit dfaa040b440084dd73ebd359326752d5f44fc02c
Date: Mon Mar 29 18:31:31 2021 -0600
Remove some "OBJF_READNOW" code from dwarf2_debug_names_index
The testsuite checks if GDB was started with the -readnow flag by
using the 'maintenance print objfiles' command, and looking for the
string 'faked for "readnow"' in the output. This is implemented in
two helper procs `readnow` (gdb.exp) and `mi_readnow` (mi-support.exp).
The following tests all currently depend on this detection:
gdb.base/maint.exp
gdb.cp/nsalias.exp
gdb.dwarf2/debug-aranges-duplicate-offset-warning.exp
gdb.dwarf2/dw2-stack-boundary.exp
gdb.dwarf2/dw2-zero-range.exp
gdb.dwarf2/gdb-index-nodebug.exp
gdb.mi/mi-info-sources.exp
gdb.python/py-symbol.exp
gdb.rust/traits.exp
The following test also includes detection of 'readnow', but does the
detection itself by checking $::GDBFLAGS for the readnow flag:
gdb.opt/break-on-_exit.exp
The above commit removed from GDB the code that produced the 'faked
for "readnow"' string, as a consequence the testsuite can no longer
correctly spot when readnow is in use, and many of the above tests
will fail (at least partially).
When looking at the above tests, I noticed that gdb.rust/traits.exp
does call `readnow`, but doesn't actually use the result, so I've
removed the readnow call, this simplifies the next part of this patch
as gdb.rust/traits.exp was the only place an extra regexp was passed
to the readnow call.
Next I have rewritten `readnow` to check the $GDBFLAGS for the
-readnow flag, and removed the `maintenance print objfiles` check. At
least for all the tests above, when using the readnow board, this is
good enough to get everything passing again.
For the `mi_readnow` proc, I changed this to just call `readnow` from
gdb.exp, I left the mi_readnow name in place - in the future it might
be the case that we want to do some different checks here.
Finally, I updated gdb.opt/break-on-_exit.exp to call the `readnow`
proc.
With these changes, all of the tests listed above now pass correctly
when using the readnow board.
|
|
My earlier patch to fix PR rust/29859 introduced a new operator
precedence bug in the Rust parser. Assignment operators are
right-associative in Rust. And, while this doesn't often matter, as
Rust assignments always have the value (), still as a matter of
principle we should get this correct.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29859
|
|
PR rust/29859 points out an operator precedence bug in the Rust
parser. This patch fixes it and adds a regression test.
|
|
This adds the gdb.current_language function, which can be used to find
the current language without (1) ever having the value "auto" or (2)
having to parse the output of "show language".
It also adds the gdb.Frame.language, which can be used to find the
language of a given frame. This is normally preferable if one has a
Frame object handy.
|
|
Many test cases had a few lines in the beginning that look like:
if { condition } {
continue
}
Where conditions varied, but were mostly in the form of ![runto_main] or
[skip_*_tests], making it quite clear that this code block was supposed
to finish the test if it entered the code block. This generates TCL
errors, as most of these tests are not inside loops. All cases on which
this was an obvious mistake are changed in this patch.
|
|
The current nightly Rust compiler (aka 1.61) added better DWARF
representation for unsized types. Fixing this is PR rust/21466; but
the code is actually the same as what is required to make slice
printing more useful, which is PR rust/23871. This patch implements
this. I tested this against various Rust compilers: 1.48, current
stable, current beta, and current nightly.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=21466
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=23871
|
|
I noticed that "print 5," passed in Rust -- the parser wasn't checking
that the entire input was used. This patch fixes the problem. This
in turn pointed out another bug in the parser, namely that it didn't
lex the next token after handling a string token. This is also fixed
here.
|
|
With nightly rustc, gdb.rust/unsized.exp fails:
(gdb) ptype *us
Structure has no component named operator*.
rustc changed to emit a bit more debug info for unsized types.
Because the original test is just to make sure that ptype of an
unsized array looks right, this patch relaxes the regexp and changes
the expression. I think this keeps the original test meaning, but
also works with nightly. I also tested stable and 1.48.
|
|
Rust 1.53 (quite a while ago now) ungated the support for non-ASCII
identifiers. This didn't work in gdb. This is PR rust/20166.
This patch fixes the problem by allowing non-ASCII characters to be
considered as identifier components. It seemed simplest to just pass
them through -- doing any extra checking didn't seem worthwhile.
The new test also verifies that such characters are allowed in strings
and character literals as well. The latter also required a bit of
work in the lexer.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=20166
|
|
In Rust, 'obj.f()' is a method call -- but '(obj.f)()' is a call of a
function-valued field 'f' in 'obj'. The Rust parser in gdb currently
gets this wrong. This is PR rust/24082.
The expression and Rust parser rewrites made this simple to fix --
simply wrapping a parenthesized expression in a new operation handles
it. This patch has a slight hack because I didn't want to introduce a
new exp_opcode enumeration constant just for this. IMO this doesn't
matter, since we should work toward removing dependencies on these
opcodes anyway; but let me know what you think of this.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=24082
|
|
This commit brings all the changes made by running gdb/copyright.py
as per GDB's Start of New Year Procedure.
For the avoidance of doubt, all changes in this commits were
performed by the script.
|
|
Replace:
...
if { [ensure_gdb_index $binfile] == -1 } {
return -1
}
...
with:
...
require {ensure_gdb_index $binfile} != -1
...
and consequently, add a missing UNTESTED message.
Tested on x86_64-linux, both with native and target board readnow.
|
|
When GCC emits .debug_aranges, it adds padding to align the contents
to two times the address size. GCC has done this for many years --
but there is nothing in the DWARF standard that says this should be
done, and LLVM does not seem to add this padding.
It's simple to detect if the padding exists, though: if the contents
of one .debug_aranges CU (excluding the header) are not a multiple of
the alignment that GCC uses, then anything extra must be padding.
This patch changes gdb to correctly read both styles. It removes the
requirement that the padding bytes be zero, as this seemed
unnecessarily pedantic to me.
gdb/ChangeLog
2021-06-25 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (create_addrmap_from_aranges): Change padding
logic.
gdb/testsuite/ChangeLog
2021-06-25 Tom Tromey <tom@tromey.com>
* lib/gdb.exp (add_gdb_index, ensure_gdb_index): Add "style"
parameter.
* gdb.rust/dwindex.exp: New file.
* gdb.rust/dwindex.rs: New file.
|
|
This patch implements Rust raw identifiers in the lexer in gdb. There
was an earlier patch to do this, but the contributor didn't reply to
my email asking whether he had sorted out his copyright assignment.
This is relatively straightforward, but a small test suite addition
was needd to ensure that the new test is skipped on older versions of
rustc -- ones that predate the introduction of raw identifiers.
gdb/ChangeLog
2021-06-11 Tom Tromey <tom@tromey.com>
PR rust/23427
* rust-parse.c (rust_parser::lex_identifier): Handle raw
identifiers.
(rust_lex_tests): Add raw identifier tests.
gdb/testsuite/ChangeLog
2021-06-11 Tom Tromey <tom@tromey.com>
PR rust/23427
* lib/rust-support.exp (rust_compiler_version): New caching proc.
* gdb.rust/rawids.exp: New file.
* gdb.rust/rawids.rs: New file.
|
|
While reviewing a patch sent to the mailing list, I noticed there are few
places where python code checks if a variable is 'None' or not by using the
comparison operators '==' and '!='. PEP8[1], which is used as coding standard
in GDBÂ coding standards, recommends using 'is' / 'is not' when comparing to a
singleton such as 'None'.
This patch proposes to change the instances of '== None' by 'is None' and
'!= None' by 'is not None'.
[1] https://www.python.org/dev/peps/pep-0008/
gdb/doc/ChangeLog:
* python.texi (Writing a Pretty-Printer): Use 'is None' instead of
'== None'.
gdb/ChangeLog:
* python/lib/gdb/FrameDecorator.py (FrameDecorator): Use 'is None' instead of
'== None'.
(FrameVars): Use 'is not None' instead of '!= None'.
* python/lib/gdb/command/frame_filters.py (SetFrameFilterPriority): Use 'is None'
instead of '== None' and 'is not None' instead of '!= None'.
gdb/testsuite/ChangeLog:
* gdb.base/premature-dummy-frame-removal.py (TestUnwinder): Use
'is None' instead of '== None' and 'is not None' instead of
'!= None'.
* gdb.python/py-frame-args.py (lookup_function): Same.
* gdb.python/py-framefilter-invalidarg.py (Reverse_Function): Same.
* gdb.python/py-framefilter.py (Reverse_Function): Same.
* gdb.python/py-nested-maps.py (lookup_function): Same.
* gdb.python/py-objfile-script-gdb.py (lookup_function): Same.
* gdb.python/py-prettyprint.py (lookup_function): Same.
* gdb.python/py-section-script.py (lookup_function): Same.
* gdb.python/py-unwind-inline.py (dummy_unwinder): Same.
* gdb.python/python.exp: Same.
* gdb.rust/pp.py (lookup_function): Same.
|
|
An upstream Rust bug notes notes that the Python pretty-printing
feature is broken for values that appear as members of certain types
in Rust.
The bug here is that some of the Rust value-printing code calls
value_print_inner, a method on rust_language. This bypasses the
common code that calls into Python.
I'm checking this in.
gdb/ChangeLog
2021-05-14 Tom Tromey <tom@tromey.com>
* rust-lang.c (rust_language::val_print_struct)
(rust_language::print_enum): Use common_val_print, not
value_print_inner.
gdb/testsuite/ChangeLog
2021-05-14 Tom Tromey <tom@tromey.com>
* gdb.rust/pp.exp: New file.
* gdb.rust/pp.py: New file.
* gdb.rust/pp.rs: New file.
|
|
This commit adds a flag to the ptype command in order to print the
offsets and sizes of struct members using the hexadecimal notation. The
'x' flag ensures use of the hexadecimal notation while the 'd' flag
ensures use of the decimal notation. The default is to use decimal
notation.
Before this patch, gdb only uses decimal notation, as pointed out in PR
gdb/22640.
Here is an example of this new behavior with hex output turned on:
(gdb) ptype /ox struct type_print_options
/* offset | size */ type = struct type_print_options {
/* 0x0000: 0x0 | 0x0004 */ unsigned int raw : 1;
/* 0x0000: 0x1 | 0x0004 */ unsigned int print_methods : 1;
/* 0x0000: 0x2 | 0x0004 */ unsigned int print_typedefs : 1;
/* 0x0000: 0x3 | 0x0004 */ unsigned int print_offsets : 1;
/* 0x0000: 0x4 | 0x0004 */ unsigned int print_in_hex : 1;
/* XXX 3-bit hole */
/* XXX 3-byte hole */
/* 0x0004 | 0x0004 */ int print_nested_type_limit;
/* 0x0008 | 0x0008 */ typedef_hash_table *local_typedefs;
/* 0x0010 | 0x0008 */ typedef_hash_table *global_typedefs;
/* 0x0018 | 0x0008 */ ext_lang_type_printers *global_printers;
/* total size (bytes): 32 */
}
This patch also adds the 'set print type hex' and 'show print type hex'
commands in order to set and inspect the default behavior regarding the
use of decimal or hexadecimal notation when printing struct sizes and
offsets.
Tested using on x86_64.
gdb/ChangeLog:
PR gdb/22640
* typeprint.h (struct type_print_options): Add print_in_hex
flag.
(struct print_offset_data): Add print_in_hex flag, add a
constructor accepting a type_print_options* argument.
* typeprint.c (type_print_raw_options, default_ptype_flags): Set
default value for print_in_hex.
(print_offset_data::indentation): Allow more horizontal space.
(print_offset_data::print_offset_data): Add ctor.
(print_offset_data::maybe_print_hole, print_offset_data::update):
Handle the print_in_hex flag.
(whatis_exp): Handle 'x' and 'd' flags.
(print_offsets_and_sizes_in_hex): Declare.
(set_print_offsets_and_sizes_in_hex): Create.
(show_print_offsets_and_sizes_in_hex): Create.
(_initialize_typeprint): Update help message for the ptype
command, register the 'set print type hex' and 'show print type
hex' commands.
* c-typeprint.c (c_print_type, c_type_print_base_struct_union)
(c_type_print_base): Construct the print_offset_data
object using the type_print_optons parameter.
* rust-lang.c (rust_language::print_type): Construct the
print_offset_data object using the type_print_optons parameter.
* NEWS: Mention the new flags of the ptype command.
gdb/doc/ChangeLog:
PR gdb/22640
* gdb.texinfo (Symbols): Describe the 'x' and 'd' flags of the
ptype command, describe 'set print type hex' and 'show print
type hex' commands. Update 'ptype/o' examples.
gdb/testsuite/ChangeLog:
PR gdb/22640
* gdb.base/ptype-offsets.exp: Add tests to verify the behavior
of 'ptype/ox' and 'ptype/od'. Check that 'set print type hex'
changes the default behavior of 'ptype/o'. Update to take into
account new horizontal layout.
* gdb.rust/simple.exp: Update ptype test to check new horizontal
layout.
* gdb.rust/union.exp: Same.
|
|
I enabled code coverage and ran the gdb test suite, and noticed that
the new Rust parser was missing testing on a few lines that were easy
to cover. This patch mostly adds tests for certain syntax errors; but
this process also uncovered a couple of real bugs: I must have
cut-and-pasted the 'sizeof' parsing code from some other code, because
it is checking for KW_MUT (the old bison parser did not do this), and
the array length check is actually impossible because a negative
number like '-1' is parsed as two tokens.
gdb/ChangeLog
2021-04-22 Tom Tromey <tom@tromey.com>
* rust-parse.c (rust_parser::parse_sizeof): Remove KW_MUT code.
(struct typed_val_int) <val>: Now ULONGEST.
(rust_parser::parse_array_type): Remove negative check.
(rust_lex_int_test): Change 'value' to ULONGEST.
gdb/testsuite/ChangeLog
2021-04-22 Tom Tromey <tom@tromey.com>
* gdb.rust/modules.exp: Add checks for syntax errors.
* gdb.rust/expr.exp: Add checks for syntax errors.
* gdb.rust/simple.exp: Add checks for syntax errors.
|
|
The Rust expression parser was written to construct its own AST, then
lower this to GDB expressions. I did this primarily because the old
expressions were difficult to work with; after rewriting those, I
realized I could remove the AST from the Rust parser.
After looking at this, I realized it might be simpler to rewrite the
parser. This patch reimplements it as a recursive-descent parser. I
kept a fair amount of the existing code -- the lexer is pulled in
nearly unchanged.
There are several benefits to this approach:
* The parser is shorter now (from 2882 LOC to 2351).
* The parser is just ordinary C++ code that can be debugged in the
usual way.
* Memory management in the parser is now straightforward, as
parsing methods simply return a unique pointer or vector.
This required a couple of minor changes to the test suite, as some
errors have changed.
While this passes the tests, it's possible there are lurking bugs,
particularly around error handling.
gdb/ChangeLog
2021-04-16 Tom Tromey <tom@tromey.com>
* rust-parse.c: New file.
* rust-exp.y: Remove.
* Makefile.in (COMMON_SFILES): Add rust-parse.c.
(SFILES): Remove rust-exp.y.
(YYFILES, local-maintainer-clean): Remove rust-exp.c.
gdb/testsuite/ChangeLog
2021-04-16 Tom Tromey <tom@tromey.com>
* gdb.rust/simple.exp: Change error text.
* gdb.rust/expr.exp: Change error text.
|
|
The Rust test case simple.exp does:
print slice as &[i32][0]
However, this is a syntax error in Rust. Parens are needed around the
"as".
gdb/testsuite/ChangeLog
2021-04-16 Tom Tromey <tom@tromey.com>
* gdb.rust/simple.exp: Add parens to 'as' test.
|
|
This commits the result of running gdb/copyright.py as per our Start
of New Year procedure...
gdb/ChangeLog
Update copyright year range in copyright header of all GDB files.
|
|
Rust 1.49 was released today, and it includes some library changes
which caused some gdb.rust tests to fail. This patch adapts the test
suite to the new output. I also verified that this continues to work
with Rust 1.48.
gdb/testsuite/ChangeLog
2020-12-31 Tom Tromey <tom@tromey.com>
* gdb.rust/simple.exp: Update output for Rust 1.49.
|
|
PR rust/26799 points out that a certain test case fails with -readnow.
This happens because, with -readnow, there are no partial symtabs; but
find_symbol_at_address requires these.
This patch fixes this problem by searching all of an objfile's
compunit symtabs if it does not have partial symbols.
Note that this test will still fail with .gdb_index. I don't think
that is readily fixable.
gdb/ChangeLog
2020-11-12 Tom Tromey <tom@tromey.com>
PR rust/26799:
* symtab.c (find_symbol_at_address): Search symtabs if no psymtabs
exist.
gdb/testsuite/ChangeLog
2020-11-12 Tom Tromey <tom@tromey.com>
PR rust/26799:
* gdb.rust/traits.exp: Remove kfails.
|
|
With test-case gdb.rust/traits.exp and target board readnow we get:
...
FAIL: gdb.rust/traits.exp: print *td
FAIL: gdb.rust/traits.exp: print *tu
...
Mark these FAILs as KFAILs.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2020-10-28 Tom de Vries <tdevries@suse.de>
* lib/gdb.exp (readnow): Handle arg.
* gdb.rust/traits.exp: Add KFAILs for -readnow.
|
|
LLVM 8.0 introduced some changes to let the Rust compiler emit DWARF
variant parts. Before this change, the compiler would emit two types
with the same name, and unfortunately gdb happens to pick the wrong
one. So, this patch disables the test when using an older version of
LLVM.
gdb/testsuite/ChangeLog
2020-09-15 Tom Tromey <tromey@adacore.com>
PR rust/26197:
* lib/rust-support.exp (rust_llvm_version): New proc.
* gdb.rust/simple.exp: Check rust_llvm_version.
|
|
When running the rust test-cases with release 1.36.0 and LLVM version 7.0, I
run into:
...
(gdb) UNTESTED: gdb.rust/traits.exp: could not read \
outputs/gdb.rust/traits/traits with readelf
PATH: gdb.rust/traits.exp: could not read \
outputs/gdb.rust/traits/traits with readelf
...
Fix the PATH warning by printing [file tail $binfile] instead $binfile.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2020-09-14 Tom de Vries <tdevries@suse.de>
* gdb.rust/traits.exp: Fix PATH warning.
|
|
In PR rust/26197, Tom de Vries notes that the variant part rewrite
caused some regressions for the Rust compiler he has. This compiler
is unusual in that it combines a relatively recent rustc with a
relatively old LLVM -- so variant parts are not emitted using DWARF.
Most of the bugs in that PR were already fixed by earlier patches, but
some lingered. After some research we found that some of these never
did work -- which is consistent with the investigations we did into
the debug info -- but instead were xfail'd. This patch updates the
xfails to cope with the new output. (After this, just one failure
remains.)
Tom de Vries tested this using his rustc and suggested a fix that
appears in this version.
gdb/testsuite/ChangeLog
2020-08-17 Tom de Vries <tdevries@suse.de>
Tom Tromey <tromey@adacore.com>
PR rust/26197:
* gdb.rust/simple.exp (xfail_pattern): Update for new failure.
|
|
I noticed that the modules test was failing. Some choice use of `nm`
revealed `TWENTY_THREE` was not in the final binary. Fix by taking a
pointer to the global, forcing the linker to keep the symbol in.
gdb/testsuite/ChangeLog
2020-07-11 Daniel Xu <dxu@dxuuu.xyz>
PR rust/26121
* gdb.rust/modules.rs: Prevent linker from discarding test
symbol.
Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
|
|
An earlier patch inadvertently broke a Rust test. This restores it.
gdb/testsuite/ChangeLog
2020-05-19 Tom Tromey <tromey@adacore.com>
* gdb.rust/simple.exp: Restore missing test result.
|
|
gdb.rust complains about some duplicate test names. This patch fixes
this in a straightforward way.
2020-05-19 Tom Tromey <tromey@adacore.com>
* gdb.rust/simple.exp: Add some test descriptions.
(test_one_slice): Use with_test_prefix.
|
|
This changes the gdb Python API to add support for dynamic types. In
particular, this adds an attribute to gdb.Type, and updates some
attributes to reflect dynamic sizes and field offsets.
There's still no way to get the dynamic type from one of its concrete
instances. This could perhaps be added if needed.
gdb/ChangeLog
2020-04-24 Tom Tromey <tromey@adacore.com>
PR python/23662:
* python/py-type.c (convert_field): Handle
FIELD_LOC_KIND_DWARF_BLOCK.
(typy_get_sizeof): Handle TYPE_HAS_DYNAMIC_LENGTH.
(typy_get_dynamic): Nw function.
(type_object_getset): Add "dynamic".
* NEWS: Add entry.
gdb/doc/ChangeLog
2020-04-24 Tom Tromey <tromey@adacore.com>
PR python/23662:
* python.texi (Types In Python): Document new features.
gdb/testsuite/ChangeLog
2020-04-24 Tom Tromey <tromey@adacore.com>
PR python/23662:
* gdb.ada/variant.exp: Add Python checks.
* gdb.rust/simple.exp: Add dynamic type checks.
|
|
I wanted to run the gdb.rust tests against older versions of the Rust
compiler, to ensure that changes I am making don't break debugging
when using older compilers.
However, this did not work because simple.rs now uses unchecked
unions, which were only added in Rust 1.19.
This patch splits the union code into its own file, so that simple.exp
can continue to work. I tested this with selected rust versions back
to 1.12.
gdb/testsuite/ChangeLog
2020-04-01 Tom Tromey <tromey@adacore.com>
* gdb.rust/union.rs: New file.
* gdb.rust/union.exp: New file.
* gdb.rust/simple.rs (Union, Union2): Move to union.rs.
(main): Update.
* gdb.rust/simple.exp: Move union tests to union.exp.
|
|
This removes the "y0" variable from simple.rs:main. This variable
isn't needed by the test case, and it uses a form of initialization
that was added in rust 1.17. Removing this makes it simpler to run
the gdb.rust tests against older versions of rustc.
gdb/testsuite/ChangeLog
2020-04-01 Tom Tromey <tromey@adacore.com>
* gdb.rust/simple.rs (main): Remove "y0".
|
|
This changes gdb to use the "variable" style when printing field
names. I've added new tests for C and Rust, but not other languages.
I chose "variable" because that seemed most straightforward. However,
another option would be to introduce a new "field" style. Similarly,
this patch uses the variable style for enumerator constants -- but
again, a new style could be used if that's preferred.
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* valprint.c (generic_val_print_enum_1)
(val_print_type_code_flags): Style member names.
* rust-lang.c (val_print_struct, rust_print_enum)
(rust_print_struct_def, rust_internal_print_type): Style member
names.
* p-valprint.c (pascal_object_print_value_fields): Style member
names. Only call fprintf_symbol_filtered for static members.
* m2-typeprint.c (m2_record_fields, m2_enum): Style member names.
* f-valprint.c (f_val_print): Style member names.
* f-typeprint.c (f_type_print_base): Style member names.
* cp-valprint.c (cp_print_value_fields): Style member names. Only
call fprintf_symbol_filtered for static members.
(cp_print_class_member): Style member names.
* c-typeprint.c (c_print_type_1, c_type_print_base_1): Style
member names.
* ada-valprint.c (ada_print_scalar): Style enum names.
(ada_val_print_enum): Likewise.
* ada-typeprint.c (print_enum_type): Style enum names.
gdb/testsuite/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* gdb.rust/rust-style.rs: New file.
* gdb.rust/rust-style.exp: New file.
* gdb.base/style.exp: Test structure printing.
* gdb.base/style.c (struct some_struct): New type.
(enum etype): New type.
(struct_value): New global.
Change-Id: I070e1293c6cc830c9ea916af8243410aa384e944
|
|
Hopefully straightforward (and I didn't miss anything ...).
gdb/ChangeLog
2020-02-19 Doug Evans <dje@google.com>
PR rust/25535
* rust-lang.c (rust_print_enum): Apply embedded_offset to
rust_enum_variant calculation.
gdb/testsuite/ChangeLog
2020-02-19 Doug Evans <dje@google.com>
PR rust/25535
* gdb.rust/simple.exp: Add test.
* gdb.rust/simple.rs: Add test.
|
|
gdb/ChangeLog:
Update copyright year range in all GDB files.
|
|
On openSUSE Leap 15.1 using rustc version 1.36.0 (using llvm 7), I get:
...
(gdb) PASS: gdb.rust/simple.exp: print e2.0
print k^M
$54 = simple::SpaceSaver::Thebox(40, 0x0)^M
(gdb) FAIL: gdb.rust/simple.exp: print k
...
while we're expecting:
...
gdb_test "print k" " = simple::SpaceSaver::Nothing"
...
When using a relatively recent version of Rust with a somewhat older version
of LLVM, the Rust compiler will emit a legacy encoding of enums (see also
quirk_rust_enum in dwarf2read.c).
So, the variable k:
...
<17><3d58>: Abbrev Number: 15 (DW_TAG_variable)
<3d59> DW_AT_location : 3 byte block: 91 b8 4 (DW_OP_fbreg: 568)
<3d5d> DW_AT_name : (indirect string, offset: 0xf9a): k
<3d61> DW_AT_alignment : 1
<3d62> DW_AT_decl_file : 1
<3d63> DW_AT_decl_line : 129
<3d64> DW_AT_type : <0x4232>
...
has type:
...
<2><4232>: Abbrev Number: 11 (DW_TAG_union_type)
<4233> DW_AT_name : (indirect string, offset: 0x3037): SpaceSaver
<4237> DW_AT_byte_size : 16
<4238> DW_AT_alignment : 8
<3><4239>: Abbrev Number: 9 (DW_TAG_member)
<423a> DW_AT_name : (indirect string, offset: 0x29f5): RUST$ENCODED$ENUM$0$Nothing
<423e> DW_AT_type : <0x4245>
<4242> DW_AT_alignment : 8
<4243> DW_AT_data_member_location: 0
...
The "RUST$ENCODED$ENUM$0$Nothing" means that field 0 is both a pointer and a
discriminant, and if the value is 0, then the enum is just a data-less variant
named "Nothing".
However, the corresponding type has two fields, where not field 0 but field 1
is a pointer, and field 0 is a byte:
...
<2><4245>: Abbrev Number: 8 (DW_TAG_structure_type)
<4246> DW_AT_name : (indirect string, offset: 0x2a11): Thebox
<424a> DW_AT_byte_size : 16
<424b> DW_AT_alignment : 8
<3><424c>: Abbrev Number: 9 (DW_TAG_member)
<424d> DW_AT_name : (indirect string, offset: 0x670): __0
<4251> DW_AT_type : <0x436b>
<4255> DW_AT_alignment : 1
<4256> DW_AT_data_member_location: 8
<3><4257>: Abbrev Number: 9 (DW_TAG_member)
<4258> DW_AT_name : (indirect string, offset: 0x1662): __1
<425c> DW_AT_type : <0x45da>
<4260> DW_AT_alignment : 8
<4261> DW_AT_data_member_location: 0
...
Mark this as xfail.
gdb/testsuite/ChangeLog:
2019-10-09 Tom de Vries <tdevries@suse.de>
PR testsuite/25048
* gdb.rust/simple.exp: Add xfails for incorrect DWARF.
|
|
PR rust/24976 points out a crash in gdb when a single-field union is
used in Rust.
The immediate problem was a NULL pointer dereference in
quirk_rust_enum. However, that code is also erroneously treating a
single-field union as if it were a univariant enum. Looking at the
output of an older Rust compiler, it turns out that univariant enums
are distinguished by having a single *anonymous* field. This patch
changes quirk_rust_enum to limit its fixup to this case.
Tested with a new-enough version of the Rust compiler to cause the
crash; plus by using an older executable that uses the old univariant
encoding.
gdb/ChangeLog
2019-10-03 Tom Tromey <tom@tromey.com>
PR rust/24976:
* dwarf2read.c (quirk_rust_enum): Handle single-element unions.
gdb/testsuite/ChangeLog
2019-10-03 Tom Tromey <tom@tromey.com>
PR rust/24976:
* gdb.rust/simple.rs (Union2): New type.
(main): Use Union2.
* gdb.rust/simple.exp: Add test.
|
|
With rustc 1.37, I started seeing compiler warnings from the traits.rs
test case:
warning: trait objects without an explicit `dyn` are deprecated
It seems to me that we generally do not want warnings in these test
cases. At some point, we'll probably have to patch traits.rs to use
the "dyn" keyword; by that time I expect that all the Rust compilers
in common use will support it. In the meantime it seemed simplest to
simply disable all warnings in this file.
gdb/testsuite/ChangeLog
2019-09-30 Tom Tromey <tromey@adacore.com>
* gdb.rust/traits.rs: Disable all warnings.
|
|
When printing a rust structure that contains a string GDB can
currently fail to read the fields that define the string. This is
because GDB mistakenly treats a value that is the parent structure as
though it is the structure that defines the string, and then fails to
find the fields needed to extract a string.
The solution is to create a new value to represent the string field of
the parent value.
gdb/ChangeLog:
* rust-lang.c (val_print_struct): Handle printing structures
containing strings.
gdb/testsuite/ChangeLog:
* gdb.rust/simple.exp: Add new test case.
* gdb.rust/simple.rs (struct StringAtOffset): New struct.
(main): Initialise an instance of the new struct.
|
|
This commit applies all changes made after running the gdb/copyright.py
script.
Note that one file was flagged by the script, due to an invalid
copyright header
(gdb/unittests/basic_string_view/element_access/char/empty.cc).
As the file was copied from GCC's libstdc++-v3 testsuite, this commit
leaves this file untouched for the time being; a patch to fix the header
was sent to gcc-patches first.
gdb/ChangeLog:
Update copyright year range in all GDB files.
|
|
This changes the Rust type printers to handle TYPE_CODE_PTR. The
current approach is not ideal, because currently the code can't
distinguish between mut and const, or between pointers and references.
(These are debuginfo deficiencies, for which there are rustc bugs on
file.)
Meanwhile, this at least clears up the case seen in PR rust/23625.
Tested on x86-64 Fedora 28. The nightly compiler gives the best
results, but I regression-tested with stable and beta as well.
gdb/ChangeLog
2018-11-16 Tom Tromey <tom@tromey.com>
PR rust/23625:
* rust-lang.c (rust_internal_print_type): Handle TYPE_CODE_PTR.
gdb/testsuite/ChangeLog
2018-11-19 Tom Tromey <tom@tromey.com>
PR rust/23625:
* gdb.rust/simple.exp: Add ptype test. Update expected output.
* gdb.rust/expr.exp: Update expected output. Change one test.
|
|
gdb.rust/simple.exp will fail when run with a recent version of rustc.
This patch fixes the test case so that it will continue to run.
Tested on x86-64 Fedora 28.
I also temporarily backed out the rust-lang.c from
commit 098b2108a2b61531c0bc8ea16854f773083a95d7, and verified that
this updated test still would have provoked the original bug.
gdb/testsuite/ChangeLog
2018-11-19 Tom Tromey <tom@tromey.com>
* gdb.rust/simple.rs: Don't initialize empty_enum_value.
|
|
I noticed a spot in rust-lang.c where the placeholder "foo" was used
instead of the actual field name. This patch fixes the bug.
gdb/ChangeLog
2018-09-13 Tom Tromey <tom@tromey.com>
PR rust/23650:
* rust-lang.c (rust_evaluate_subexp): Use field name, not "foo".
gdb/testsuite/ChangeLog
2018-09-13 Tom Tromey <tom@tromey.com>
PR rust/23650:
* gdb.rust/simple.exp: Add test for enum field access error.
|