When running a program with the simulator target, I get:
/home/simark/src/binutils-gdb/gdb/inferior.c:279: internal-error: inferior* find_inferior_pid(process_stratum_target*, int): Assertion `pid != 0' failed.
This can be reproduced by building a GDB for --target=arm-none-gnueabi,
and running with
$ ./gdb -nx --data-directory=data-directory a.out -ex "target sim" -ex load -ex "b main" -ex r
Where a.out is any program with a main.
The problem is that gdbsim_target::wait assumes that inferior_ptid has
the value of the thread it wants to report an event for.
Actually, it's the target's responsibility to come up with the ptid of
the thread the event is for. In the sim target, that ptid is stored in
sim_inferior_data::remote_sim_ptid, so return that instead of
inferior_ptid.
ChangeLog:
* remote-sim.c (gdbsim_target::wait): Return
sim_data->remote_sim_ptid instead of inferior_ptid.
When trying to compile GDB with --target=avr, with gcc 9.2.0, I am
getting a bunch of:
/home/simark/src/binutils-gdb/sim/avr/../common/nrun.c:94:7: error: implicit declaration of function ‘abort’ [-Werror=implicit-function-declaration]
94 | abort ();
| ^~~~~
/home/simark/src/binutils-gdb/sim/avr/../common/nrun.c:94:7: error: incompatible implicit declaration of built-in function ‘abort’ [-Werror]
/home/simark/src/binutils-gdb/sim/avr/../common/nrun.c:94:7: note: include ‘<stdlib.h>’ or provide a declaration of ‘abort’
I did what the compiler told me and added the relevant includes in the
problematic files.
sim/common/ChangeLog:
* nrun.c: Include stdlib.h.
* sim-core.c: Likewise.
* sim-engine.c: Likewise.
* sim-io.c: Likewise.
* sim-module.c: Likewise.
* sim-reason.c: Likewise.
Commit 20135676fc ("PR24960, Memory leak
from disassembler") added "disassemble_free_target" to opcodes. This
is used to free target-specific data when finished with a
disassembler.
This patch changes gdb to call this function where needed.
gdb/ChangeLog
2020-01-19 Tom Tromey <tom@tromey.com>
* disasm.c (~gdb_disassembler): New destructor.
(gdb_buffered_insn_length): Call disassemble_free_target.
* disasm.h (class gdb_disassembler): Declare destructor. Use
DISABLE_COPY_AND_ASSIGN.
Change-Id: I245ba5b7dec5e5d9f29cd21832c6e2b4fecef047
init_cutu_and_read_dies takes a callback function, which I've always
found somewhat difficult to follow. This patch replaces this function
with a class, and changes the callers to use it. In some cases this
allows for the removal of a helper struct and helper function as well.
gdb/ChangeLog
2020-01-19 Tom Tromey <tom@tromey.com>
* dwarf2read.c (abbrev_table_up): Move typedef earlier.
(die_reader_func_ftype): Remove.
(cutu_reader): New class.
(dw2_get_file_names_reader): Remove "data" parameter.
(dw2_get_file_names): Use cutu_reader.
(create_debug_type_hash_table): Update.
(read_cutu_die_from_dwo): Update comment.
(lookup_dwo_unit): Add dwo_name parameter.
(cutu_reader::init_tu_and_read_dwo_dies): Now a method. Remove
die_reader_func_ftype and data parameters.
(cutu_reader::cutu_reader): Rename from init_cutu_and_read_dies.
Remove die_reader_func_ftype and data parameters.
(~cutu_reader): New; from init_cutu_and_read_dies.
(cutu_reader::cutu_reader): Rename from
init_cutu_and_read_dies_no_follow. Remove die_reader_func_ftype
and data parameters.
(init_cutu_and_read_dies_simple): Remove.
(struct process_psymtab_comp_unit_data): Remove.
(process_psymtab_comp_unit_reader): Remove data parameter; add
want_partial_unit and pretend_language parameters.
(process_psymtab_comp_unit): Use cutu_reader.
(build_type_psymtabs_reader): Remove data parameter.
(build_type_psymtabs_1): Use cutu_reader.
(process_skeletonless_type_unit): Likewise.
(load_partial_comp_unit_reader): Remove.
(load_partial_comp_unit): Use cutu_reader.
(load_full_comp_unit_reader): Remove.
(load_full_comp_unit): Use cutu_reader.
(struct create_dwo_cu_data): Remove.
(create_dwo_cu_reader): Remove datap parameter; add dwo_file and
dwo_unit parameters.
(create_cus_hash_table): Use cutu_reader.
(struct dwarf2_read_addr_index_data): Remove.
(dwarf2_read_addr_index_reader): Remove.
(dwarf2_read_addr_index): Use cutu_reader.
(read_signatured_type_reader): Remove.
(read_signatured_type): Use cutu_reader.
Change-Id: I4ef2f29e73108ce94bfe97799f8f638ed272212d
In some cases, the TUI flickers when redrawing. This can be seen
mostly easily when switching layouts.
This patch fixes the problem by exploiting the double buffering that
curses already does. In some spots, the TUI will now disable flushing
the curses buffers to the screen; and then flush them all at once when
the rendering is complete.
gdb/ChangeLog
2020-01-19 Tom Tromey <tom@tromey.com>
* tui/tui.c (tui_show_assembly): Use tui_suppress_output.
* tui/tui-wingeneral.h (class tui_suppress_output): New.
(tui_wrefresh): Declare.
* tui/tui-wingeneral.c (suppress_output): New global.
(tui_suppress_output, ~tui_suppress_output): New constructor and
destructor.
(tui_wrefresh): New function.
(tui_gen_win_info::refresh_window): Use tui_wrefresh.
(tui_gen_win_info::make_window): Call wnoutrefresh when needed.
* tui/tui-regs.h (struct tui_data_window) <no_refresh>: Declare
method.
* tui/tui-regs.c (tui_data_window::erase_data_content): Call
tui_wrefresh.
(tui_data_window::no_refresh): New method.
(tui_data_item_window::refresh_window): Call tui_wrefresh.
(tui_reg_command): Use tui_suppress_output
* tui/tui-layout.c (tui_set_layout): Use tui_suppress_output.
* tui/tui-data.h (struct tui_gen_win_info) <no_refresh>: New
method.
* tui/tui-command.c (tui_refresh_cmd_win): Call tui_wrefresh.
Change-Id: Icb832ae100b861de3af3307488e636fa928d5c9f
I noticed that a plain "file" will leave the current source file in
the TUI source window. Instead, I think, it should clear the source
window. This patch implements this.
gdb/ChangeLog
2020-01-19 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.c (tui_update_source_windows_with_line):
Handle case where symtab is null.
gdb/testsuite/ChangeLog
2020-01-19 Tom Tromey <tom@tromey.com>
* gdb.tui/main.exp: Add check for plain "file".
Change-Id: I8424acf837f1a47f75bc6a833d1e917d4c10b51e
Unless I'm missing something, this function is a complicated way of
saying "fork_list.size () == 1".
gdb/ChangeLog:
* linux-fork.c (one_fork_p): Simplify.
ld/ChangeLog
* testsuite/ld-x86-64/align-branch-1.d: Loosen instruction regexps
to admit whatever absolute address. The label-relative address is
what the test needs to verify.
2020-01-01 Ben Elliston <bje@gnu.org>
* config.guess: Update copyright years.
* config.sub: Likewise.
2019-12-21 Ben Elliston <bje@gnu.org>
* config.guess (set_cc_for_build): Prevent multiple calls by
checking if $tmp is already set. We can't check CC_FOR_BUILD as
the user may set it externally. Thanks to Torbj?rn Granlund for
the bug report.
2019-12-21 Torbj?rn Granlund <tg@gmplib.org>
* config.guess (alpha:Linux:*:*): Guard against missing
/proc/cpuinfo by redirecting standard error to /dev/null.
2019-09-12 Daniel Bittman <danielbittman1@gmail.com>
* config.guess (*:Twizzler:*:*): New.
* config.sub (-twizzler*): New.
2019-07-24 Ben Elliston <bje@gnu.org>
* config.guess (mips:OSF1:*.*): Whitespace cleanup.
2019-06-30 Ben Elliston <bje@gnu.org>
* config.sub (case $os): Match nsk* and powerunix. Don't later
match nsk* and set os=nsk which removes the OS version number.
2019-06-30 Ben Elliston <bje@gnu.org>
* config.sub: Recognise os108*.
2019-06-26 Ben Elliston <bje@gnu.org>
* config.sub (hp300): Set $os to hpux.
2019-06-26 Ben Elliston <bje@gnu.org>
* config.sub (vsta): Move into alphabetical order.
2019-06-10 Ben Elliston <bje@gnu.org>
* config.guess (*:OS108:*:*): Recognise new OS.
2019-05-28 Ben Elliston <bje@gnu.org>
* config.guess (*:Darwin:*:*): Run xcode-select to determine if a
system compiler is installed. If not, do not run set_cc_for_build,
as the default cc will open a dialog box asking to install
Xcode. If no C compiler is available, guess based on uname -p and
uname -m.
2019-05-28 Ben Elliston <bje@gnu.org>
* config.guess (*:Darwin:*:*): Simplify UNAME_PROCESSOR.
Trying to run "make all-gdbsupport" at the top-level in a build from scratch
results in:
make[2]: Entering directory '/home/smarchi/build/binutils-gdb/gdbsupport'
CC agent.o
In file included from /home/smarchi/src/binutils-gdb/gdbsupport/common-defs.h:133,
from /home/smarchi/src/binutils-gdb/gdbsupport/agent.c:20:
/home/smarchi/src/binutils-gdb/gdbsupport/common-types.h:35:10: fatal error: bfd.h: No such file or directory
35 | #include "bfd.h"
| ^~~~~~~
Before building all-gdbsupport, we need all-bfd to run, so that bfd.h is
generated.
(Once this patch is merged in the binutils-gdb repo, I'll send it to gcc
to keep the files in sync.)
ChangeLog:
* Makefile.def: Add dependencies of all-gdbsupport on all-bfd.
* Makefile.in: Re-generate.
* objdump.c (jump_info_visualize_address): Discard jumps that are
no longer needed.
(disassemble_bytes): Only compute the maximum level if jumps were
detected.
gdbsupport fails to build with compilers that don't default to C++11
or above. gdbsupport's configure.ac is already using
AX_CXX_COMPILE_STDCXX, which sets CXX_DIALECT to the -std=gnu++11
switch if necessary, but the problem is that nowhere are we using
CXX_DIALECT. This fixes it.
gdbsupport/ChangeLog:
2020-01-17 Pedro Alves <palves@redhat.com>
* Makefile.am: Append CXX_DIALECT to CXX.
* Makefile.in: Regenerate.
I'm seeing this on F27 (a clean build from scratch):
~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[3]: Entering directory '/home/pedro/brno/pedro/gdb/binutils-gdb/build/gdbsupport'
CC gdb_tilde_expand.o
In file included from /home/pedro/gdb/binutils-gdb/src/gdbsupport/../gnulib/import/libc-config.h:33:0,
from ../gnulib/import/glob.h:544,
from /home/pedro/gdb/binutils-gdb/src/gdbsupport/gdb_tilde_expand.c:22:
../bfd/config.h:7:4: error: #error config.h must be #included before system headers
# error config.h must be #included before system headers
^~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~
libc-config.h, where it includes config.h, says:
~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* This is intended to be a good-enough substitute for glibc system
macros like those defined in <sys/cdefs.h>, so that Gnulib code
shared with glibc can do this as the first #include:
#ifndef _LIBC
# include <libc-config.h>
#endif
When compiled as part of glibc this is a no-op; when compiled as
part of Gnulib this includes Gnulib's <config.h> and defines macros
that glibc library code would normally assume. */
#include <config.h>
~~~~~~~~~~~~~~~~~~~~~~~~~~~
The issue is that that '#include <config.h>' picks up bfd's config.h
instead of gnulib's.
This problem doesn't trigger in the gdb dir because there we generate
config.h under that exact name so gnulib's libc-config.h ends up
picking gdb's config.h instead of gnulib.c and that ends up harmless.
In gdbsupport, the config.h file is really named support-config.h, so
that '#include <config.h>' in libc-config.h doesn't pick it like it
would if it had the conventional config.h name.
This patch fixes it by simply renaming gdbserver's support-config.h to
config.h.
gdbsupport/ChangeLog:
2020-01-17 Pedro Alves <palves@redhat.com>
* configure.ac: Generate config.h instead of support-config.h.
* common-defs.h: Include <gdbsupport/config.h> instead of
<gdbsupport/support-config.h>.
* Makefile.in: Regenerate.
* configure: Regenerate.
Replace with range-based for loops.
gdb/ChangeLog:
* top.c (struct qt_args): Remove.
(kill_or_detach): Change return type to void, replace `void *`
parameter with a proper one.
(print_inferior_quit_action): Likewise.
(quit_confirm): Use range-based for loop to iterate over inferiors.
(quit_force): Likewise.
Replace with range-based loops.
gdb/ChangeLog:
* mi/mi-main.c (run_one_inferior): Change return type to void, replace
`void *` parameter with proper parameters.
(mi_cmd_exec_run): Use range-based loop to iterate over inferiors.
(print_one_inferior): Change return type to void, replace `void *`
parameter with proper parameters.
(mi_cmd_list_thread_groups): Use range-based loop to iterate over
inferiors.
(get_other_inferior): Remove.
(mi_cmd_remove_inferior): Use range-based loop to iterate over
inferiors.
Replace it with a range-based for. I've updated the comment in
mi_interp::init, which was a bit stale.
gdb/ChangeLog:
* mi/mi-interp.c (report_initial_inferior): Remove.
(mi_interp::init): Use range-based for to iterate over inferiors.
Use range-based for instead of iterate_over_inferiors in one spot in the Python
code.
gdb/ChangeLog:
* python/py-inferior.c (build_inferior_list): Remove.
(gdbpy_ref): Use range-based for loop to iterate over inferiors.
The type then looks like this:
(gdb) pt $_tlb->process_environment_block->process_parameters
type = struct rtl_user_process_parameters {
DWORD32 maximum_length;
DWORD32 length;
DWORD32 flags;
DWORD32 debug_flags;
void *console_handle;
DWORD32 console_flags;
void *standard_input;
void *standard_output;
void *standard_error;
unicode_string current_directory;
void *current_directory_handle;
unicode_string dll_path;
unicode_string image_path_name;
unicode_string command_line;
void *environment;
DWORD32 starting_x;
DWORD32 starting_y;
DWORD32 count_x;
DWORD32 count_y;
DWORD32 count_chars_x;
DWORD32 count_chars_y;
DWORD32 fill_attribute;
DWORD32 window_flags;
DWORD32 show_window_flags;
unicode_string window_title;
unicode_string desktop_info;
unicode_string shell_info;
unicode_string runtime_data;
} *
It's mainly useful to get the current directory, or the full command line:
(gdb) p $_tlb->process_environment_block->process_parameters->current_directory
$1 = {
length = 26,
maximum_length = 520,
buffer = 0xe36c8 L"C:\\src\\tests\\"
}
(gdb) p $_tlb->process_environment_block->process_parameters->command_line
$2 = {
length = 94,
maximum_length = 96,
buffer = 0xe32aa L"\"C:\\gdb\\build64\\gdb-git\\gdb\\gdb.exe\" access.exe"
}
The type names are all lowercase because the existing types created
by windows_get_tlb_type are also lowercase.
Type unicode_string is documented at [1].
The official documentation [2] for rtl_user_process_parameters is limited,
so I've used this other page [3].
[1] https://docs.microsoft.com/en-us/windows/win32/api/ntdef/ns-ntdef-_unicode_string
[2] https://docs.microsoft.com/en-us/windows/win32/api/winternl/ns-winternl-rtl_user_process_parameters
[3] https://www.nirsoft.net/kernel_struct/vista/RTL_USER_PROCESS_PARAMETERS.html
gdb/ChangeLog:
2020-01-16 Hannes Domani <ssbssa@yahoo.de>
* windows-tdep.c (windows_get_tlb_type):
Add rtl_user_process_parameters type.
Compiling GDB with '-fvisibility=hidden' removes the symbols that
should be exported.
This patch explicitly marks them as visible.
gdb/ChangeLog:
2020-01-16 Pedro Alves <palves@redhat.com>
Norbert Lange <nolange79@gmail.com>
PR build/24805
* gdbsupport/gdb_proc_service.h (PS_EXPORT): New.
(ps_get_thread_area, ps_getpid, ps_lcontinue, ps_lgetfpregs)
(ps_lgetregs, ps_lsetfpregs, ps_lsetregs, ps_lstop, ps_pcontinue)
(ps_pdread, ps_pdwrite, ps_pglobal_lookup, ps_pstop, ps_ptread)
(ps_ptwrite, ps_lgetxregs, ps_lgetxregsize, ps_lsetxregs)
(ps_plog): Redeclare exported functions with default visibility.
I spotted a few misplaced entries in the ChangeLog-2019 entries, and
went on to fix them.
Looking around I saw a good number of other entries in other years.
Then OCD got the best of me and I fixed them all.
Also fixes cases of wrong paths in entries, like "* gdb/foo.c" instead
of "* foo.c".
This patch handles DW_LLE_base_addressx, DW_LLE_startx_length and
DW_LLE_start_length.
Tested by running the testsuite before and after the patch and there is
no increase in the number of test cases that fails. Tested with both
-gdwarf-4 and -gdwarf-5 flags. Also tested -gslit-dwarf along with
-gdwarf-4 as well as -gdwarf5 flags.
This is an effort to support DWARF5 in gdb.
gdb/ChangeLog:
* dwarf2loc.c (decode_debug_loclists_addresses): Handle
DW_LLE_base_addressx, DW_LLE_startx_length, DW_LLE_start_length.
This patch moves MVE feature bits into the CORE_HIGH section. This makes sure
.fpu and -mfpu does not reset the bits set by MVE. This is important because
.fpu has no option to "set" these same bits and thus, mimic'ing GCC, we choose
to define MVE as an architecture extension rather than put it together with
other the legacy fpu features.
This will enable the following behavior:
.arch armv8.1-m.main
.arch mve
.fpu fpv5-sp-d16 #does not disable mve.
vadd.i32 q0, q1, q2
This patch also makes sure MVE is not taken into account during auto-detect.
This was already the case, but because we moved the MVE bits to the
architecture feature space we must make sure ARM_ANY does not include MVE.
gas/ChangeLog:
2020-01-16 Andre Vieira <andre.simoesdiasvieira@arm.com>
PR 25376
* config/tc-arm.c (mve_ext, mve_fp_ext): Use CORE_HIGH.
(armv8_1m_main_ext_table): Use CORE_HIGH for mve.
* testsuite/arm/armv8_1-m-fpu-mve-1.s: New.
* testsuite/arm/armv8_1-m-fpu-mve-1.d: New.
* testsuite/arm/armv8_1-m-fpu-mve-2.s: New.
* testsuite/arm/armv8_1-m-fpu-mve-2.d: New.
include/ChangeLog:
2020-01-16 Andre Vieira <andre.simoesdiasvieira@arm.com>
PR 25376
* opcodes/arm.h (FPU_MVE, FPU_MVE_FPU): Move these features to...
(ARM_EXT2_MVE, ARM_EXT2_MVE_FP): ... the CORE_HIGH space.
(ARM_ANY): Redefine to not include any MVE bits.
(ARM_FEATURE_ALL): Removed.
opcodes/ChangeLog:
2020-01-16 Andre Vieira <andre.simoesdiasvieira@arm.com>
PR 25376
* opcodes/arm-dis.c (coprocessor_opcodes): Use CORE_HIGH for MVE bits.
(neon_opcodes): Likewise.
(select_arm_features): Make sure we enable MVE bits when selecting
armv8.1-m.main. Make sure we do not enable MVE bits when not selecting
any architecture.
ld/ChangeLog:
2020-01-16 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* scripttempl/elf32msp430.sc: Add input section rules for
.upper.{text,data,rodata,bss}.
* testsuite/ld-msp430-elf/msp430-elf.exp: Run new test.
* testsuite/ld-msp430-elf/upper-input-sections.s: New test.
The AVX512DQ patterns lacking a Cpu64 attribute made the memory operand
forms accepted even outside of 64-bit mode, and this even without any
{evex} pseudo-prefix (otherwise one could argue that this is an attempt
to follow one possible, albeit somewhat odd, interpretation of the SDM
wording to this effect).
For consistency between the various involved templates drop the
* (now) unnecessary IgnoreSize attributes
* unnecessary (due to VexW1) Size64 attributes from VEX encoded forms
* redundant (with Reg64) Qword operand attributes
uniformly.
GDB's man page source (in gdb.texinfo) contains:
@t{++}
The @t{...} part is supposed to display the wrapped text with a
fixed-width font. The texi2pod.pl script currently doesn't handle
@t{...}, so it appears as-is in the man page:
You can use GDB to debug programs written in C, C@t{++}, Fortran and Modula-2.
gcc's version of texi2pod.pl (at contrib/texi2pod.pl in gcc's repo)
replaces @t{...} with the wrapped text as-is, which I think is an
acceptable behavior. The fixed-width font distinction is not really
important for a man page, where the text will be displayed with whatever
font the user is using.
Import the line that does that from gcc's version.
I have verified that there is no other, unwanted change in man pages
generated in binutils' and GDB's doc, with this patch applied.
etc/ChangeLog:
* texi2pod.pl: Handle @t{...} tags.
In post_create_inferior, we get the current thread using the
inferior_thread function and store it in `thr`. We then call
get_current_regcache immediately after, which does:
return get_thread_regcache (inferior_thread ());
This patch makes post_create_inferior use get_thread_regcache, passing
`thr`, saving an unnecessary inferior_thread call.
gdb/ChangeLog:
* infcmd.c (post_create_inferior): Use get_thread_regcache
instead of get_current_regcache.
tic4x uses a number of static variables for tables that are generated
depending on the current machine (tic4x vs. tic3x). However, it is
possible to change the machine from one invocation of print_insn_tic4x
to the next. This patch throws away the old state if that happens,
and uses a relatively small known size array of register names rather
than a malloc'd table.
* tic4x-dis.c (tic4x_version): Make unsigned long.
(optab, optab_special, registernames): New file scope vars.
(tic4x_print_register): Set up registernames rather than
malloc'd registertable.
(tic4x_disassemble): Delete optable and optable_special. Use
optab and optab_special instead. Throw away old optab,
optab_special and registernames when info->mach changes.
gas/ChangeLog:
2020-01-15 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* config/tc-msp430.c (CHECK_RELOC_MSP430): Always generate 430X
relocations when the target is 430X, except when extracting part of an
expression.
(msp430_srcoperand): Adjust comment.
Initialize the expp member of the msp430_operand_s struct as
appropriate.
(msp430_dstoperand): Likewise.
* testsuite/gas/msp430/msp430.exp: Run new test.
* testsuite/gas/msp430/reloc-lo-430x.d: New test.
* testsuite/gas/msp430/reloc-lo-430x.s: New test.
include/ChangeLog:
2020-01-15 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* opcode/msp430.h (enum msp430_expp_e): New.
(struct msp430_operand_s): Add expp member to struct.
ld/ChangeLog:
2020-01-15 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* testsuite/ld-msp430-elf/msp430-elf.exp: Run new test.
* testsuite/ld-msp430-elf/reloc-lo-430x.s: New test.