Commit Graph

104380 Commits

Author SHA1 Message Date
H.J. Lu
2e635a0157 elfedit: Pass osabi to reconcat
Pass osabi to reconcat to get

Usage: elfedit <option(s)> elffile(s)
...
  --input-osabi [none|HPUX|NetBSD|GNU|Linux|Solaris|AIX|Irix|FreeBSD|TRU64|Modesto|OpenBSD|OpenVMS|NSK|AROS|FenixOS]
                              Set input OSABI

instead of

  --input-osabi [|FenixOS]
                              Set input OSABI

	* elfedit (usage): Pass osabi to reconcat.
2020-12-29 10:37:24 -08:00
Hannes Domani
6596a5d4f6 Fix wrong method name
The objects returned by FrameDecorator.frame_args need to implement a
method named symbol, not argument.

gdb/doc/ChangeLog:

2020-12-29  Hannes Domani  <ssbssa@yahoo.de>

	* python.texi (Frame Decorator API): Fix method name.
2020-12-29 18:35:50 +01:00
GDB Administrator
e2e3422ce1 Automatic date update in version.in 2020-12-29 00:00:06 +00:00
H.J. Lu
3e9373fcaf binutils: Use the newly built assembler and linker
Use the newly built assembler and linker in test_gnu_debuglink by passing
$gcc_gas_flag to target_compile.

	* testsuite/binutils-all/compress.exp (test_gnu_debuglink): Pass
	$gcc_gas_flag to target_compile.
2020-12-28 10:44:28 -08:00
GDB Administrator
adf6c633a3 Automatic date update in version.in 2020-12-28 00:00:08 +00:00
Tom Tromey
c8f02daac9 Simplify MULTI_SUBSCRIPT implementation
The MULTI_SUBSCRIPT code in evaluate_subexp_standard has a comment
saying that perhaps the EVAL_SKIP handling is incorrect.  This patch
simplifies this code.  In particular, it precomputes all the indices
in a separate loop and removes some complicated flow-control.

Tested using the gdb.modula2 and gdb.dlang test suites, as these are
the only parsers that emit MULTI_SUBSCRIPT.

gdb/ChangeLog
2020-12-27  Tom Tromey  <tom@tromey.com>

	* eval.c (evaluate_subexp_standard) <case MULTI_SUBSCRIPT>:
	Simplify.
2020-12-27 13:36:55 -07:00
GDB Administrator
9e87bc7f0f Automatic date update in version.in 2020-12-27 00:00:06 +00:00
GDB Administrator
556444effa Automatic date update in version.in 2020-12-26 00:00:06 +00:00
H.J. Lu
a12f86b9a6 gas: Update 80387 floating point 's' suffix
Update 80387 floating point 's' suffix to read:

  * Integer constructors are '.word', '.long' or '.int', and '.quad'
     for the 16-, 32-, and 64-bit integer formats.  The corresponding
     instruction mnemonic suffixes are 's' (short), 'l' (long), and 'q'
     (quad).

instead of 's' (single).

	PR gas/27106
	* doc/c-i386.texi: Update 80387 floating point 's' suffix
2020-12-25 05:56:36 -08:00
GDB Administrator
e142715391 Automatic date update in version.in 2020-12-25 00:00:08 +00:00
Andrew Burgess
b7874836c3 gdb: avoid resolving dynamic properties for non-allocated arrays
In PR gdb/27059 an issue was discovered where GDB would sometimes
trigger undefined behaviour in the form of signed integer overflow.
The problem here is that GDB was reading random garbage from the
inferior memory space, assuming this data was valid, and performing
arithmetic on it.

This bug raises an interesting general problem with GDB's DWARF
expression evaluator, which is this:

We currently assume that the DWARF expressions being evaluated are
well formed, and well behaving.  As an example, this is the expression
that the bug was running into problems on, this was used as the
expression for a DW_AT_byte_stride of a DW_TAG_subrange_type:

	DW_OP_push_object_address;
	DW_OP_plus_uconst: 88;
	DW_OP_deref;
	DW_OP_push_object_address;
	DW_OP_plus_uconst: 32;
	DW_OP_deref;
	DW_OP_mul

Two values are read from the inferior and multiplied together.  GDB
should not assume that any value read from the inferior is in any way
sane, as such the implementation of DW_OP_mul should be guarding
against overflow and doing something semi-sane here.

However, it turns out that the original bug PR gdb/27059, is hitting a
more specific case, which doesn't require changes to the DWARF
expression evaluator, so I'm going to leave the above issue for
another day.

In the test mentioned in the bug GDB is actually trying to resolve the
dynamic type of a Fortran array that is NOT allocated.  A
non-allocated Fortran array is one that does not have any data
allocated for it yet, and even the upper and lower bounds of the array
are not yet known.

It turns out that, at least for gfortran compiled code, the data
fields that describe the byte-stride are not initialised until the
array is allocated.

This leads me to the following conclusion: GDB should not try to
resolve the bounds, or stride information for an array that is not
allocated (or not associated, a similar, but slightly different
Fortran feature).  Instead, each of these properties should be set to
undefined if the array is not allocated (or associated).

That is what this commit does.  There's a new flag that is passed
around during the dynamic array resolution.  When this flag is true
the dynamic properties are resolved using the DWARF expressions as
they currently are, but when this flag is false the expressions are
not evaluated, and instead the properties are set to undefined.

gdb/ChangeLog:

	PR gdb/27059
	* eval.c (evaluate_subexp_for_sizeof): Handle not allocated and
	not associated arrays.
	* f-lang.c (fortran_adjust_dynamic_array_base_address_hack): Don't
	adjust arrays that are not allocated/associated.
	* gdbtypes.c (resolve_dynamic_range): Update header comment.  Add
	new parameter which is used to sometimes set dynamic properties to
	undefined.
	(resolve_dynamic_array_or_string): Update header comment.  Add new
	parameter which is used to guard evaluating dynamic properties.
	Resolve allocated/associated properties first.

gdb/testsuite/ChangeLog:

	PR gdb/27059
	* gdb.dwarf2/dyn-type-unallocated.c: New file.
	* gdb.dwarf2/dyn-type-unallocated.exp: New file.
2020-12-24 16:45:40 +00:00
Andrew Burgess
5ba3b20ec2 gdb: include allocated/associated properties in 'maint print type'
Adds the allocated and associated dynamic properties into the output
of the 'maintenance print type' command.

gdb/ChangeLog:

	* gdbtypes (recursive_dump_type): Include allocated and associated
	properties.
2020-12-24 16:45:39 +00:00
Lancelot SIX
f867677682 gdb/gdbtypes.h: Fix comparison of uninitialized values
When called with an array type of unknown dimensions,
is_scalar_type_recursive ended up comparing uninitialized values.

This was picked up by the following compiler warning:

  CXX    gdbtypes.o
/binutils-gdb/gdb/gdbtypes.c: In function int is_scalar_type_recursive(type*):
/binutils-gdb/gdb/gdbtypes.c:3670:38: warning: high_bound may be used uninitialized in this function [-Wmaybe-uninitialized]
 3670 |       return high_bound == low_bound && is_scalar_type_recursive (elt_type);
      | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/binutils-gdb/gdb/gdbtypes.c:3670:38: warning: low_bound may be used uninitialized in this function [-Wmaybe-uninitialized]

This patch makes sure that when dealing with an array of unknown size
(or an array of more than 1 element), is_scalar_type_recursive returns
false.

gdb/ChangeLog:

	* gdbtypes.c (is_scalar_type_recursive): Prevent comparison
	between uninitialized values.

Change-Id: Ifc005ced166aa7a065fef3e652977bae67625bf4
2020-12-24 11:02:55 -05:00
Alan Modra
99d8bab0c1 SHF_GNU_RETAIN 7a and 7b tests
* testsuite/ld-elf/retain7a.d: Don't run on hppa-linux.
	* testsuite/ld-elf/retain7b.d: Correct name.  Don't run on tic6x.
	Allow OSABI FreeBSD.
2020-12-24 22:58:14 +10:30
Alan Modra
dccc31dee3 asan: print_vms_time signed integer overflow
I really don't think anyone cares about underflow of vms time values,
but the potential segfault on a gmtime failure is worth fixing.

	* readelf.c (INT64_MIN): Define if not already defined.
	(print_vms_time): Catch 64-bit overflow when converting from
	vms time to posix time.  Don't segfault if gmtime returns NULL.
2020-12-24 22:58:14 +10:30
Alan Modra
de34d42812 PR27100, final link failed: bad value
The failure on this PR is due to using the same bfd section for
multiple output sections.  Commit 21401fc7bf managed to create
duplicate linker script output section statements, but not the actual
bfd sections.

	PR 27100
	* ldlang.h (lang_output_section_statement_type): Add dup_output.
	* ldlang.c (lang_output_section_statement_lookup): Set dup_output.
	(init_os): Test dup_output rather than constraint.
	* testsuite/ld-scripts/pr27100.d,
	* testsuite/ld-scripts/pr27100.s,
	* testsuite/ld-scripts/pr27100.t: New test.
	* testsuite/ld-scripts/data.exp: Run it.  Don't exclude aout here.
	* testsuite/ld-scripts/data.d: Do so here instead.
	* testsuite/ld-scripts/fill.d: Likewise.
	* testsuite/ld-scripts/fill16.d: Likewise.
2020-12-24 22:58:03 +10:30
GDB Administrator
62fa7b3c6a Automatic date update in version.in 2020-12-24 00:00:06 +00:00
Alex Bennée
f37059ea22 Clarify language for the '?' packet
Both QEMU and kgdb make the assumption that the '?' packet is only
sent during the initial setup of a gdbstub connection. Both use that
knowledge to reset breakpoints and ensure the gdbstub is in a
clean-state on a resumed connection. This can cause confusion for
others implementing clients that speak to gdbstub devices. To avoid
that make the language clearer that this is a start-up query packet
that you only expect to see once.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

gdb/doc/ChangeLog:

	* gdb.texinfo (Packets): Clarify language for ? packet.

Change-Id: Iae25d3110fe28b8d2467704962a6889e55224ca5
2020-12-23 16:36:48 -05:00
H.J. Lu
279d901e5a x86-64: Add Intel LAM property support
Add Intel Linear Address Masking (LAM) property support.  LAM modifies
the checking that is applied to 64-bit linear addresses, allowing
software to use of the untranslated address bits for metadata.

bfd/

	* elf-linker-x86.h (elf_x86_cet_report): Renamed to ...
	(elf_x86_prop_report): This.
	(elf_linker_x86_params): Add lam_u48, lam_u57, lam_u48_report
	and lam_u57_report.
	* elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Support
	GNU_PROPERTY_X86_FEATURE_1_LAM_U48 and
	GNU_PROPERTY_X86_FEATURE_1_LAM_U57.
	(_bfd_x86_elf_link_fixup_gnu_properties): Keep LAM features only
	for 64-bit output.

binutils/

	* NEWS: Mention LAM_U48 and LAM_U57 support.
	* elfedit.c (elf_x86_feature): Support lam_u48 and lam_u57.
	(usage): Add lam_u48 and lam_u57.
	* readelf.c (decode_x86_feature_1): Support LAM_U48 and LAM_U57.
	* doc/binutils.texi: Update elfedit with lam_u48 and lam_u57
	support.
	* testsuite/binutils-all/x86-64/lam-u48.d: New file.
	* testsuite/binutils-all/x86-64/lam-u48.s: Likewise.
	* testsuite/binutils-all/x86-64/lam-u57.d: Likewise.
	* testsuite/binutils-all/x86-64/lam-u57.s: Likewise.

include/

	* elf/common.h (GNU_PROPERTY_X86_FEATURE_1_LAM_U48): New.
	(GNU_PROPERTY_X86_FEATURE_1_LAM_U57): Likewise.

ld/

	* NEWS: Mention LAM_U48 and LAM_U57 support.
	* ld.texi: Document LAM_U48 and LAM_U57 support.
	* emulparams/cet.sh: Updated.
	* emulparams/elf_x86_64.sh: Source x86-64-lam.sh.
	* emulparams/x86-64-lam.sh: New file.
	* testsuite/ld-x86-64/property-x86-lam-u48-1a.d: Likewise.
	* testsuite/ld-x86-64/property-x86-lam-u48-1b.d: Likewise.
	* testsuite/ld-x86-64/property-x86-lam-u48-2.d: Likewise.
	* testsuite/ld-x86-64/property-x86-lam-u48-3a.d: Likewise.
	* testsuite/ld-x86-64/property-x86-lam-u48-3b.d: Likewise.
	* testsuite/ld-x86-64/property-x86-lam-u48-4.d: Likewise.
	* testsuite/ld-x86-64/property-x86-lam-u48-5.d: Likewise.
	* testsuite/ld-x86-64/property-x86-lam-u48.s: Likewise.
	* testsuite/ld-x86-64/property-x86-lam-u57-1a.d: Likewise.
	* testsuite/ld-x86-64/property-x86-lam-u57-1b.d: Likewise.
	* testsuite/ld-x86-64/property-x86-lam-u57-2.d: Likewise.
	* testsuite/ld-x86-64/property-x86-lam-u57-3a.d: Likewise.
	* testsuite/ld-x86-64/property-x86-lam-u57-3b.d: Likewise.
	* testsuite/ld-x86-64/property-x86-lam-u57-4.d: Likewise.
	* testsuite/ld-x86-64/property-x86-lam-u57-5.d: Likewise.
	* testsuite/ld-x86-64/property-x86-lam-u57.s: Likewise.
	* testsuite/ld-x86-64/x86-64.exp: Run LAM tests.
2020-12-23 13:00:55 -08:00
Andrew Burgess
5cc0917c38 gdb: remove some uses of LA_PRINT_STRING
This commit removes some, but not all, uses of LA_PRINT_STRING.  In
this commit I've removed those uses where there is an obvious language
object on which I can instead call the printstr method.

In the remaining 3 uses it is harder to know if the correct thing is
to call printstr on the current language, or on a specific language.
Currently obviously, we always call on the current language (as that's
what LA_PRINT_STRING does), and clearly this behaviour is good enough
right now, but is it "right"?  I've left them for now and will give
them more thought in the future.

gdb/ChangeLog:

	* expprint.c (print_subexp_standard): Replace uses of
	LA_PRINT_STRING.
	* f-valprint.c (f_language::value_print_inner): Likewise.
	* guile/scm-pretty-print.c (ppscm_print_string_repr): Likewise.
	* p-valprint.c (pascal_language::value_print_inner): Likewise.
	* python/py-prettyprint.c (print_string_repr): Likewise.
2020-12-23 20:53:14 +00:00
Andrew Burgess
1c4852651c gdb: move rust_language into rust-lang.h
Move the rust_language class declaration into the rust-lang.h header
file.  This allows for the function implementations called directly in
rust-lang.c and rust-exp.y without the need for trampoline functions.

There should be no user visible changes after this commit.

gdb/ChangeLog:

	* rust-exp.y (rust_parse): Rename to...
	(rust_language::parser): ...this.
	* rust-lang.c (-rust_printstr): Rename to...
	(rust_language::printstr): ...this.
	(rust_value_print_inner): Delete declaration.
	(val_print_struct): Rename to...
	(rust_language::val_print_struct): ...this.  Update calls to
	member functions.
	(rust_print_enum): Rename to...
	(rust_language::print_enum): ...this.  Update calls to member
	functions.
	(rust_value_print_inner): Rename to...
	(rust_language::value_print_inner): ...this.  Update calls to
	member functions.
	(exp_descriptor_rust): Rename to...
	(rust_language::exp_descriptor_tab): ...this.
	(class rust_language): Move to rust-lang.h.
	(rust_language::language_arch_info): Implementation moved to here
	from class declaration.
	(rust_language::print_type): Likewise.
	(rust_language::emitchar): Likewise.
	(rust_language::is_string_type_p): Likewise.
	* rust-lang.h: Add 'demangle.h', 'language.h', 'value.h', and
	'c-lang.h' includes.
	(rust_parse): Delete declaration.
	(class rust_language): Class declaration moved here from
	rust-lang.c.
2020-12-23 20:53:14 +00:00
Andrew Burgess
ed5797ee2c gdb/objc: fix bug in objc_language::opcode_print_table
In this commit:

  commit b7c6e27dbb
  Date:   Tue Aug 4 17:07:59 2020 +0100

      gdb: Convert language_data::la_op_print_tab to a method

A bug was introduced, the objc language now returns the wrong op_print
table.  Fixed in this commit.

gdb/ChangeLog:

	* objc-lang.c (objc_language::opcode_print_table): Return
	objc_op_print_tab.
2020-12-23 20:53:14 +00:00
Andrew Burgess
46157d77c3 gdb: move pascal_language into p-lang.h
Move the pascal_language class declaration into the p-lang.h header
file.  This allows for the function implementations to be spread over
the different p-*.c files without the need for global trampoline
functions.

As a consequence of this change many of the Pascal value and type
printing helper functions have become member functions within the
pascal_language class.

There should be no user visible changes after this commit.

gdb/ChangeLog:

	* p-exp.y (exp): Update call to pascal_is_string_type.
	(pascal_parse): Rename to...
	(pascal_language::parser): ...this.
	* p-lang.c (is_pascal_string_type): Rename to...
	(pascal_is_string_type): ...this.
	(pascal_one_char): Rename to...
	(pascal_language::print_one_char): ...this.
	(pascal_printchar): Rename to...
	(pascal_language::printchar): ...this.  Update call to
	print_one_char member function.
	(pascal_op_print_tab): Rename to...
	(pascal_language::op_print_tab): ...this.
	(class pascal_language): Moved to p-lang.h.
	(pascal_language::language_arch_info): Function implementation
	moved out of class declaration.
	(pascal_language::printstr): Likewise.
	* p-lang.h (pascal_parse): Delete declaration.
	(pascal_is_string_type): Declare.
	(pascal_print_type): Delete declaration.
	(pascal_print_typedef): Delete declaration.
	(pascal_value_print_inner): Delete declaration.
	(pascal_value_print): Delete declaration.
	(pascal_type_print_method_args): Delete declaration.
	(is_pascal_string_type): Delete declaration.
	(pascal_printchar): Delete declaration.
	(pascal_builtin_types): Delete declaration.
	(pascal_type_print_base): Delete declaration.
	(pascal_type_print_varspec_prefix): Delete declaration.
	(class pascal_language): Moved here from p-lang.c.
	* p-typeprint.c (pascal_type_print_varspec_suffix): Delete
	declaration.
	(pascal_type_print_derivation_info): Delete declaration.
	(pascal_print_type): Rename to...
	(pascal_language::print_type): ...this.  Update calls to member
	functions.
	(pascal_print_typedef): Rename to...
	(pascal_language::print_typedef): ...this.  Update calls to member
	functions.
	(pascal_type_print_derivation_info): Rename to...
	(pascal_language::type_print_derivation_info): ...this.
	(pascal_type_print_method_args): Rename to...
	(pascal_language::type_print_method_args): ...this.
	(pascal_type_print_varspec_prefix): Rename to...
	(pascal_language::type_print_varspec_prefix): ...this.  Update
	calls to member functions.
	(pascal_print_func_args): Rename to...
	(pascal_language::print_func_args): ...this.  Update calls to
	member functions.
	(pascal_type_print_func_varspec_suffix): Rename to...
	(pascal_language::type_print_func_varspec_suffix): ...this.
	Update calls to member functions.
	(pascal_type_print_varspec_suffix): Rename to...
	(pascal_language::type_print_varspec_suffix): ...this.  Update
	calls to member functions.
	(pascal_type_print_base): Rename to...
	(pascal_language::type_print_base): ...this.  Update calls to
	member functions.
	* p-valprint.c (pascal_value_print_inner): Rename to...
	(pascal_language::value_print_inner): ...this.  Update calls to
	member functions.
	(pascal_value_print): Rename to...
	(pascal_language::value_print): ...this.  Update calls to member
	functions.
2020-12-23 20:53:14 +00:00
Andrew Burgess
82fc57fd6b gdb: move go_language class declaration into header file
Move the go_language class into go-lang.h, this allows us to have
member functions implemented directly in the different go-*.c files
instead of having to trampoline out to global functions.

There should be no user visible changes after this commit.

gdb/ChangeLog:

	* go-exp.y (go_parse): Rename to...
	(go_language::parser): ...this.
	* go-lang.c (go_demangle): Rename to...
	(go_language::demangle_symbol): ...this.
	(go_language::expression_ops): Implementation moved here out of
	class declaration.
	(go_op_print_tab): Rename to...
	(go_language::op_print_tab): ...this, update comment.
	(class go_language): Declaration moved to go-lang.h.
	(go_language::language_arch_info): Implementation moved here out
	of class declaration.
	* go-lang.h (go_parse): Delete declaration.
	(go_demangle): Delete declaration.
	(go_print_type): Delete declaration.
	(go_value_print_inner): Delete declaration.
	(class go_language): Declaration moved here from go-lang.c.
	* go-typeprint.c (go_print_type): Rename to...
	(go_language::print_type): ...this.
	* go-valprint.c (go_value_print_inner): Rename to...
	(go_language::value_print_inner): ...this.
	* symtab.c (demangle_for_lookup): Call demangle_symbol method on
	the go_language object.
2020-12-23 20:53:14 +00:00
Andrew Burgess
76ca72bc5b gdb: remove LA_EMIT_CHAR macro
Now that every use of the LA_EMIT_CHAR macro is within a language_defn
member function we can simply call the emitchar member function
directly instead of using the LA_EMIT_CHAR macro.

If we are ever inside a language object, for example, cplus_language,
while current_language points at something other than cplus_language
then this commit will result in a change in behaviour.  However, I
believe if we did have such a difference then this would be a bug in
GDB.  AS such I'm going to claim there _should_ be no user visible
changes from this commit.

gdb/ChangeLog:

	* c-lang.c (language_defn::printchar): Call emitchar, not
	LA_EMIT_CHAR.
	* f-lang.h (f_language::printchar): Likewise.
	* language.h (LA_EMIT_CHAR): Delete macro.
	* rust-lang.c (rust_language::printchar): Call emitchar, not
	LA_EMIT_CHAR.
2020-12-23 20:53:14 +00:00
Andrew Burgess
c5ee319e6c gdb: rename c_printchar as language_defn::printchar
This commit removes the global function c_printchar and moves the
implementation into language_defn::printchar.

There should be no user visible changes after this commit.

gdb/ChangeLog:

	* c-lang.c (c_printchar): Rename to...
	(language_defn::printchar): ...this.
	* c-lang.h (c_printchar): Delete declaration.
	* language.c (language_defn::printchar): Delete this
	implementation.  Is now implemented in c-lang.c.
2020-12-23 20:53:14 +00:00
Andrew Burgess
2c75ccb24c gdb: avoid accessing global C++ language implementation functions
The function c_printchar is called from two places; it provides the
implementation of language_defn::printchar and it is called from
dwarf2_compute_name.

It would be nice to rename c_printchar as language_defn::printchar and
so avoid the trampoline.

To achieve this, instead of calling c_printchar directly from the
DWARF code, I lookup the C++ language object and call the printchar
member function.

In a later commit I can then rename c_printchar.

There should be no user visible changes after this commit.

gdb/ChangeLog:

	* dwarf2/read.c (dwarf2_compute_name): Call methods on C++
	language object instead of calling global functions directly.
2020-12-23 20:53:14 +00:00
Andrew Burgess
016382f8a4 gdb: delete unused function print_char_chars
Spotted that print_char_chars appears to be unused, delete it.  There
should be no user visible changes after this commit.

gdb/ChangeLog:

	* valprint.c (print_char_chars): Delete definition.
	* valprint.h (print_char_chars): Delete declaration.
2020-12-23 20:53:14 +00:00
Samuel Thibault
05ecfa4726 Add myself to gdb/MAINTAINERS
gdb/ChangeLog:

	* MAINTAINERS (Write After Approval): Add myself.
2020-12-23 17:22:17 +00:00
Samuel Thibault
06f6f78f62 hurd: Add changelog for dca11eb872 2020-12-23 17:19:27 +00:00
Samuel Thibault
dca11eb872 hurd: Fix getting VM_MIN/MAX_ADDRESS
gnu-nat.c was getting the inclusion of vm_param.h only by luck. We need
to explicitly include it to be sure to get the definitions of
VM_MIN/MAX_ADDRESS.

gdb/ChangeLog:

	* gnu-nat.c: Include <mach/vm_param.h>.
2020-12-23 16:56:36 +00:00
GDB Administrator
9423103f54 Automatic date update in version.in 2020-12-23 00:00:06 +00:00
Shahab Vahedi
e512699ac8 Remove trailing white spaces in gdb/frame.{c,h}
gdb/ChangeLog:

	* frame.c: Remove trailing white spaces.
	* frame.h: Likewise.
2020-12-23 00:52:45 +01:00
Shahab Vahedi
acf10cacc6 arc: Make variable name in comments uppercase
The word "regnum" in comments should be uppercase, because it
reflects a variable name in the code.

gdb/ChangeLog

	* arc-linux-tdep.c: Replace "regnum" with "REGNUM" in comments.
2020-12-22 12:27:00 +01:00
Anton Kolesov
04c9f85efc gdb: Add native support for ARC in GNU/Linux
With this patch in place it is possible to build a GDB that
can run on ARC (GNU/Linux) hosts for debugging ARC targets.

The "arc-linux-nat.c" is a rather small one that mostly deals
with registers and a few thread related hooks.

v2 [1]:
- Remove "void" from the input of "_initialize_arc_linux_nat ()"

[1] Tom's remark after the first patch
https://sourceware.org/pipermail/gdb-patches/2020-November/173223.html

gdb/ChangeLog:

	* Makefile.in (ALLDEPFILES): Add arc-linux-nat.c.
	* configure.host (host to gdb names): Add arc*-*-linux*.
	* configure.nat (gdb_host_cpu): Add arc.
	* arc-linux-nat.c: New.
2020-12-22 12:18:40 +01:00
Shahab Vahedi
46023bbe81 arc: Take into account the REGNUM in supply/collect gdb hooks
All the arc_linux_supply_*() target operations and the
arc_linux_collect_v2_regset() in arc-linux-tdep.c were
supplying/collecting all the registers in regcache as if the
REGNUM was set to -1.

The more efficient behavior is to examine the REGNUM and act
accordingly.  That is what this patch does.

gdb/ChangeLog:

	* arc-linux-tdep.c (supply_register): New.
	(arc_linux_supply_gregset, arc_linux_supply_v2_regset,
	arc_linux_collect_v2_regset): Consider REGNUM.
2020-12-22 12:16:17 +01:00
Anton Kolesov
d4af727286 arc: Add support for signal frames for Linux targets
Implement functions needed to unwind signal frames on ARC Linux targets.

gdb/ChangeLog

	* arc-linux-tdep.c (arc_linux_sc_reg_offsets): New static variable.
	(arc_linux_is_sigtramp): New function.
	(arc_linux_sigcontext_addr): Likewise.
	(arc_linux_init_osabi): Use them.
2020-12-22 12:05:19 +01:00
Anton Kolesov
b4e3cd0440 arc: Add support for signal handlers
This patch adds the necessary infrastructure to handle signal frames for
ARC architecture.  It is fairly similar to what any other architecture
would have.  Linux specific parts will be in a separate patch.

v2 [1]:
- Make the logic of "arc_sigtramp_frame_sniffer ()" simpler.

[1] Tom's remark for the first version
https://sourceware.org/pipermail/gdb-patches/2020-November/173221.html

gdb/ChangeLog:

	* arc-tdep.c (arc_make_sigtramp_frame_cache): New function.
	(arc_sigtramp_frame_this_id): Likewise.
	(arc_sigtramp_frame_prev_register): Likewise.
	(arc_sigtramp_frame_sniffer): Likewise.
	(arc_siftramp_frame_unwind): New global variable.
	(arc_gdbarch_init): Use sigtramp capabilities.
	(arc_dump_tdep): Print sigtramp fields.
	* arc-tdep.h (gdbarch_tdep): Add sigtramp fields.
2020-12-22 12:04:31 +01:00
GDB Administrator
6bf6909bf4 Automatic date update in version.in 2020-12-22 00:00:06 +00:00
Tom Tromey
6c078f0bfe Move enum noside earlier in expression.h
For the expression rewrite series, I needed to move enum noside
earlier in expression.h.  Because this is a pure move, and because it
seems harmless and uncontroversial to move an enum definition earlier
in a file, I'm pushing it in early, to reduce the size of that series.

Tested by rebuilding.

gdb/ChangeLog
2020-12-21  Tom Tromey  <tom@tromey.com>

	* expression.h (enum noside): Move earlier.
2020-12-21 12:55:53 -07:00
Peter Waller
e1ff6226d8 Preserve gdb_std{out, err, log, targ, targerr} across interpreter_exec_cmd
Calls through interpreter_exec_cmd can cause the output state to be modified in
a way which doesn't get back after the execution.

It looks like the intent is that interp::resume should put things back how they
should be, however, mi_interp::resume modifies gdb_stdout and nothing currently
restores it to the previous state.

To see the broken behaviour:

  gdb -ex starti -ex bt -ex 'interpreter-exec mi echo' -ex bt -ex q echo <<<''

Prior to this patch, on a terminal environment, the first backtrace is
coloured, and the second backtrace is not. The reason is that
stdio_file::can_emit_style_escape becomes false, because the gdb_stdout gets
overwritten in mi_interp::resume and not replaced.

gdb/ChangeLog:

	* interps.c (interpreter_exec_cmd): Restore streams pointers.

gdb/testsuite/ChangeLog:

	* gdb.base/style-interp-exec-mi.exp: New.
	* gdb.base/style-interp-exec-mi.c: New.

Signed-off-by: Peter Waller <p@pwaller.net>
Change-Id: Id87423b262d058857ea9dca5866ca6471741e512
2020-12-21 09:38:22 -05:00
Simon Marchi
ca01f1bf3d gdb/testsuite: use gdb_test in gdb.base/list.exp
Use gdb_test instead of send_gdb + gdb_expect.  Use proc_with_prefix to
help with name uniqueness.

gdb/testsuite/ChangeLog:

	* gdb.base/list.exp: Replace send_gdb + gdb_expect with
	  gdb_test.  Use proc_with_prefix.

Change-Id: Ieee8fb2c80f596f60397fab7633773a7f8c8c879
2020-12-21 09:16:44 -05:00
Markus Metzger
0fe69a94d4 testsuite, gdb.btrace: fix 32-bit PIE false positives
For 32-bit position independent executables, GCC generates an extra call to

    __x86.get_pc_thunk.<reg>

which appears in the function call history.  It is correct to appear there
but this confuses the tests, which check for an expected sequence of
functions.

Build with nopie to avoid this complication.

gdb/testsuite/ChangeLog:
2020-12-04  Markus Metzger  <markus.t.metzger@intel.com>

	* gdb.btrace/exception.exp: Build with nopie.
	* gdb.btrace/function_call_history.exp: Likewise.
	* gdb.btrace/unknown_functions.exp: Likewise.
2020-12-21 09:00:28 +01:00
Markus Metzger
806e7575e2 testsuite, gdb.btrace: skip multi-inferior.exp on gdbserver targets
The gdb.btrace/multi-inferior.exp test creates multiple inferiors to check
that recording is per-inferior.

When run with the native-gdbserver board, this test hangs when trying to
add the second inferior over the remote connection.  Skip the test.

Note that the test runs fine with the native-extended-gdbserver board file
and we want to keep testing that configuration.

gdb/testsuite/ChangeLog:
2020-12-11  Markus Metzger  <markus.t.metzger@intel.com>

	* gdb.btrace/multi-inferior.exp: Skip if use_gdb_stub.
2020-12-21 08:59:25 +01:00
Markus Metzger
493d2172ac testsuite, gdb.python: make py-record-*.exp test names unique
gdb/testsuite/ChangeLog:
2020-12-14  Markus Metzger  <markus.t.metzger@intel.com>

	* gdb.python/py-record-btrace.exp: Make test names unique.
	* gdb.python/py-record-full.exp: Likewise.
2020-12-21 08:58:25 +01:00
Markus Metzger
1a1c0afcee testsuite, gdb.btrace: make test names unique
gdb/testsuite/ChangeLog:
2020-12-04  Markus Metzger  <markus.t.metzger@intel.com>

	* gdb.btrace/data.exp: Make test names unique.
	* gdb.btrace/delta.exp: Likewise.
	* gdb.btrace/enable.exp: Likewise.
	* gdb.btrace/function_call_history.exp: Likewise.
	* gdb.btrace/nohist.exp: Likewise.
	* gdb.btrace/non-stop.exp: Likewise.
	* gdb.btrace/rn-dl-bind.exp: Likewise.
	* gdb.btrace/step.exp: Likewise.
	* gdb.btrace/stepi.exp: Likewise.
	* gdb.btrace/tailcall.exp: Likewise.
2020-12-21 08:57:37 +01:00
Markus Metzger
98d837f0ef gdb, record: rephrase the 'not recording' error message
When trying to use one of the record commands without having enabled
recording first, GDB gives the error message:

    (gdb) record function-call-history
    No record target is currently active.
    Use one of the "target record-<TAB><TAB>" commands first.

In the record help, however, we say:

    (gdb) help record
    record, rec
    Start recording.

    List of record subcommands:

    record btrace, record b -- Start branch trace recording.
    record delete, record del, record d -- Delete the rest of execution log and start recording it anew.
    record full -- Start full execution recording.
    record function-call-history -- Prints the execution history at function granularity.
    record goto -- Restore the program to its state at instruction number N.
    record instruction-history -- Print disassembled instructions stored in the execution log.
    record save -- Save the execution log to a file.
    record stop, record s -- Stop the record/replay target.

Change the above error message to

    (gdb) record function-call-history
    No recording is currently active.
    Use the "record full" or "record btrace" command first.

to align with the help text.

gdb/ChangeLog:
2020-12-03  Markus Metzger  <markus.t.metzger@intel.com>

	* record.c (require_record_target): Rephrase error message.
	(info_record_command): Likewise.

gdb/testsuite/ChangeLog:
2020-12-03  Markus Metzger  <markus.t.metzger@intel.com>

	* gdb.btrace/enable.exp: Update error message.
	* gdb.btrace/multi-inferior.exp: Likewise.
	* gdb.btrace/reconnect.exp: Likewise.
	* gdb.python/py-record-btrace.exp: Likewise.
	* gdb.python/py-record-full.exp: Likewise.
2020-12-21 08:56:26 +01:00
Joel Brobecker
904cb749cf gdb.texinfo: Document GMP as mandatory requirement to build GDB
gdb/doc/ChangeLog

        * gdb.texinfo (Requirements): Add GMP to list of requirements.
2020-12-21 06:21:41 +04:00
GDB Administrator
0335338177 Automatic date update in version.in 2020-12-21 00:00:06 +00:00
Tom de Vries
c541fa7c91 [gdb/testsuite] Add save_target_board_info
Add a proc save_target_board_info, similar to save_vars, such that we can do:
...
save_target_board_info { multilib_flags } {
    global board
    set board [target_info name]
    unset_board_info multilib_flags
    set_board_info multilib_flags "$override_multilib_flags"
    ...
}
...
and use it in gdb_compile_shlib.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-12-20  Tom de Vries  <tdevries@suse.de>

	* lib/gdb.exp (save_target_board_info): New proc.
	(gdb_compile_shlib): Use save_target_board_info.
2020-12-20 09:35:36 +01:00