Alan Modra [Tue, 17 Dec 2019 03:56:39 +0000 (14:26 +1030)]
ubsan: bpf: left shift cannot be represented in type 'DI' (aka 'long')
cpu/
* bpf.cpu (f-imm64): Avoid signed overflow.
opcodes/
* bpf-ibld.c: Regenerate.
Bernd Edlinger [Wed, 30 Oct 2019 20:35:22 +0000 (21:35 +0100)]
Add a test case for skip with inlined functions
Bernd Edlinger [Fri, 18 Oct 2019 12:28:45 +0000 (14:28 +0200)]
Check all inline frames if they are marked for skip
This makes the skip command work in optimized builds, where skipped
functions may be inlined. Previously that was only working when
stepping into a non-inlined function.
GDB Administrator [Tue, 17 Dec 2019 00:00:26 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Mon, 16 Dec 2019 21:30:50 +0000 (16:30 -0500)]
jit: make gdb_symtab::blocks an std::forward_list
This patch changes the gdb_symtab::blocks manually maintained linked
list to be an std::forward_list, simplifying memory management.
Currently, the list is sorted as blocks are created. With an
std::forward_list, it is easier (and probably a bit more efficient) to
sort them once at the end, so this is what I did.
A note about the comment on the "next" field:
/* gdb_blocks are linked into a tree structure. Next points to the
next node at the same depth as this block and parent to the
parent gdb_block. */
I don't think it's true that "next" points to the next node at the same
depth. All nodes are in a simple singly linked list, so necessarily
some node will point to some other node that isn't at the same depth.
gdb/ChangeLog:
* jit.c (struct gdb_block) <next>: Remove field.
(struct gdb_symtab) <~gdb_symtab>: Remove.
<blocks>: Change type to std::forward_list<gdb_block>.
(compare_block): Remove.
(jit_block_open_impl): Adjust to std::forward_list. Place the new
block at the beginning, don't mind about sorting.
(finalize_symtab): Adjust to std::forward_list, sort the blocks list
before using it.
Simon Marchi [Mon, 16 Dec 2019 21:30:50 +0000 (16:30 -0500)]
jit: c++-ify gdb_block
Add a constructor to gdb_block, change the name field to be a
gdb::unique_xmalloc_ptr. This is in preparation for using an
std::forward_list<gdb_block> in the next patch.
gdb/ChangeLog:
* jit.c (struct gdb_block): Add constructor, initialize
real_block and next fields.
<name>: Change type to gdb::unique_xmalloc_ptr.
(struct gdb_symtab) <~gdb_symtab>: Free blocks with delete.
(jit_block_open_impl): Allocate gdb_block with new.
(finalize_symtab): Adjust to gdb::unique_xmalloc_ptr.
Simon Marchi [Mon, 16 Dec 2019 21:30:49 +0000 (16:30 -0500)]
jit: make gdb_object::symtabs an std::forward_list
Replace the manual linked list with an std::forward_list, simplifying
the memory management. This requires allocating gdb_object with new and
free'ing it with delete.
gdb/ChangeLog:
* jit.c: Include forward_list.
(struct gdb_symtab) <next>: Remove field.
(struct gdb_object) <symtabs>: Change type to
std::forward_list<gdb_symtab>.
(jit_object_open_impl): Allocate gdb_object with new.
(jit_symtab_open_impl): Adjust to std::forward_list.
(finalize_symtab): Don't delete symtab.
(jit_object_close_impl): Adjust to std::forward_list. Free
gdb_object with delete.
Simon Marchi [Mon, 16 Dec 2019 21:30:49 +0000 (16:30 -0500)]
jit: c++-ify gdb_symtab
This patch makes the gdb_symtab bit more c++y, in preparation for the
next patch that will use an std::forward_list<gdb_symtab>. It changes
the fields to use automatic memory management, in the form of
std::string and gdb::unique_xmalloc_ptr, and adds a constructor and a
destructor.
gdb/ChangeLog:
* jit.c (struct gdb_symtab): Add constructor, destructor,
initialize fields.
<linetable>: Change type to unique_xmalloc_ptr.
<file_name>: Change type to std::string.
(jit_symtab_open_impl): Allocate gdb_symtab with new.
(jit_symtab_line_mapping_add_impl): Adjust.
(finalize_symtab): Adjust, call delete on stab.
Simon Marchi [Mon, 16 Dec 2019 21:30:49 +0000 (16:30 -0500)]
Fix double-free when creating more than one block in JIT debug info reader
A double-free happens when using a JIT debug info reader that creates
more than one block. In the loop that frees blocks in finalize_symtab,
at the very end, the gdb_block_iter_tmp variable is set initially, but
not changed as the loop advances. If we have two blocks, the first
iteration frees the first block, the second iteration frees the second
block, but the third iteration tries to free the second block again, as
gdb_block_iter_tmp keeps pointing on the second block.
Fix it by assigning the gdb_block_iter_tmp variable in the loop.
I have improved the jit-reader.exp test to cover this case, by adding a
second "JIT-ed" function and creating a block for it. I have renamed
the existing function to something I find a bit more descriptive. There
are no significant changes to jit-reader.exp itself, only updates
following the renaming. The important changes are in jithost.c
(generate a new function) and in jitreader.c (create a gdb_block for
that function).
This was found because of an ASan report:
$ ./gdb testsuite/outputs/gdb.base/jit-reader/jit-reader -ex "jit-reader-load /home/simark/build/binutils-gdb/gdb/testsuite/outputs/gdb.base/jit-reader/jitreader.so" -ex r
Reading symbols from testsuite/outputs/gdb.base/jit-reader/jit-reader...
Starting program: /home/simark/build/binutils-gdb/gdb/testsuite/outputs/gdb.base/jit-reader/jit-reader
=================================================================
==
1751048==ERROR: AddressSanitizer: heap-use-after-free on address 0x604000042eb8 at pc 0x5650ef8eec88 bp 0x7ffe52767290 sp 0x7ffe52767280
READ of size 8 at 0x604000042eb8 thread T0
#0 0x5650ef8eec87 in finalize_symtab /home/simark/src/binutils-gdb/gdb/jit.c:768
#1 0x5650ef8eef88 in jit_object_close_impl /home/simark/src/binutils-gdb/gdb/jit.c:797
#2 0x7fbbda986278 in read_debug_info /home/simark/src/binutils-gdb/gdb/testsuite/gdb.base/jitreader.c:71
#3 0x5650ef8ef56b in jit_reader_try_read_symtab /home/simark/src/binutils-gdb/gdb/jit.c:850
#4 0x5650ef8effe3 in jit_register_code /home/simark/src/binutils-gdb/gdb/jit.c:948
#5 0x5650ef8f2c92 in jit_event_handler(gdbarch*) /home/simark/src/binutils-gdb/gdb/jit.c:1396
#6 0x5650ef0d137e in handle_jit_event /home/simark/src/binutils-gdb/gdb/breakpoint.c:5470
[snip]
0x604000042eb8 is located 40 bytes inside of 48-byte region [0x604000042e90,0x604000042ec0)
freed by thread T0 here:
#0 0x7fbbe57376b0 in __interceptor_free /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:122
#1 0x5650ef8f350b in xfree<gdb_block> /home/simark/src/binutils-gdb/gdb/gdbsupport/common-utils.h:62
#2 0x5650ef8eeca9 in finalize_symtab /home/simark/src/binutils-gdb/gdb/jit.c:769
#3 0x5650ef8eef88 in jit_object_close_impl /home/simark/src/binutils-gdb/gdb/jit.c:797
#4 0x7fbbda986278 in read_debug_info /home/simark/src/binutils-gdb/gdb/testsuite/gdb.base/jitreader.c:71
#5 0x5650ef8ef56b in jit_reader_try_read_symtab /home/simark/src/binutils-gdb/gdb/jit.c:850
#6 0x5650ef8effe3 in jit_register_code /home/simark/src/binutils-gdb/gdb/jit.c:948
#7 0x5650ef8f2c92 in jit_event_handler(gdbarch*) /home/simark/src/binutils-gdb/gdb/jit.c:1396
#8 0x5650ef0d137e in handle_jit_event /home/simark/src/binutils-gdb/gdb/breakpoint.c:5470
[snip]
previously allocated by thread T0 here:
#0 0x7fbbe5737cd8 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:153
#1 0x5650eef662f3 in xcalloc /home/simark/src/binutils-gdb/gdb/alloc.c:100
#2 0x5650ef8f34ea in xcnew<gdb_block> /home/simark/src/binutils-gdb/gdb/gdbsupport/poison.h:122
#3 0x5650ef8ed467 in jit_block_open_impl /home/simark/src/binutils-gdb/gdb/jit.c:557
#4 0x7fbbda98620a in read_debug_info /home/simark/src/binutils-gdb/gdb/testsuite/gdb.base/jitreader.c:60
#5 0x5650ef8ef56b in jit_reader_try_read_symtab /home/simark/src/binutils-gdb/gdb/jit.c:850
#6 0x5650ef8effe3 in jit_register_code /home/simark/src/binutils-gdb/gdb/jit.c:948
#7 0x5650ef8f2c92 in jit_event_handler(gdbarch*) /home/simark/src/binutils-gdb/gdb/jit.c:1396
#8 0x5650ef0d137e in handle_jit_event /home/simark/src/binutils-gdb/gdb/breakpoint.c:5470
[snip]
gdb/ChangeLog:
* jit.c (finalize_symtab): Set gdb_block_iter_tmp in loop.
gdb/testsuite/ChangeLog:
* gdb.base/jit-reader.exp (jit_reader_test): Rename
jit_function_00 to jit_function_stack_mangle.
* gdb.base/jithost.c (jit_function_t): Rename to...
(jit_function_stack_mangle_t): ... this.
(jit_function_add_t): New typedef.
(jit_function_00_code): Rename to...
(jit_function_stack_mangle_code): ... this, make static.
(jit_function_add_code): New.
(main): Generate "add" function and call it. Adjust to changes
in jithost_abi.
* gdb.base/jithost.h (struct jithost_abi_bounds): New.
(struct jithost_abi) <begin, end>: Remove fields.
<object, function_stack_mangle, function_add>: New fields.
* gdb.base/jitreader.c (struct reader_state) <code_begin,
code_end>: Remove fields.
<func_stack_mangle>: New field.
(read_debug_info): Adjust to renaming, create block for "add"
function.
(read_sp, unwind_frame, get_frame_id): Adjust to other changes.
Tom Tromey [Fri, 13 Dec 2019 22:09:37 +0000 (15:09 -0700)]
Constify get_exec_file
I noticed that get_exec_file could return a "const char *". This
patch implements this change.
I couldn't build all the code -- but I did build Linux native and a
mingw cross.
Consequently, the NTO code has a hack, where it casts away const. I
think this can be removed, but that required more work there, and
since I couldn't compile it, I felt it best not to try.
Let me know what you think.
gdb/ChangeLog
2019-12-16 Tom Tromey <tromey@adacore.com>
* windows-nat.c (windows_nat_target::attach): Update.
* remote.c (extended_remote_target::attach): Update.
* procfs.c (procfs_target::attach): Update.
* nto-procfs.c (nto_procfs_target::attach): Update.
(nto_procfs_target::create_inferior): Update.
* inf-ptrace.c (inf_ptrace_target::attach): Update.
* gnu-nat.c (gnu_nat_target::attach): Update.
(gnu_nat_target::detach): Update.
* darwin-nat.c (darwin_nat_target::attach): Update.
* corefile.c (get_exec_file): Constify result. Remove extraneous
return.
* bsd-kvm.c (bsd_kvm_target_open): Update.
* gdbsupport/common-inferior.h (get_exec_file): Constify result.
gdb/gdbserver/ChangeLog
2019-12-16 Tom Tromey <tromey@adacore.com>
* server.c (get_exec_file): Constify result.
Change-Id: I29c60f7313a7def0dcb290ff0c2a4c1dea4f981f
Christian Biesinger [Sun, 17 Nov 2019 05:37:06 +0000 (23:37 -0600)]
Update Gnulib to the latest git version
This patch allows us to remove a workaround in common-defs.h due to
the gnulib fix in:
https://lists.gnu.org/archive/html/bug-gnulib/2019-11/msg00024.html
All of GDB's local Gnulib patches were already fixed upstream per their
descriptions, so this patch removes them all.
The problem listed here:
https://sourceware.org/ml/gdb-patches/2019-08/msg00553.html
was probably partially fixed by moving gnulib to the toplevel;
for the remainder, I am setting MAKEOVERRIDES to empty in
gnulib/Makefile.am. See also the comment there (it fixes an issue
with compilers that don't use C99/C11 by default such as GCC 4.8.5,
the default on Centos 7).
gdb/ChangeLog:
2019-12-16 Christian Biesinger <cbiesinger@google.com>
* gdbsupport/common-defs.h: Remove workaround for a gnulib bug
(we no longer need to include time.h before pathmax.h)
gnulib/ChangeLog:
2019-12-16 Christian Biesinger <cbiesinger@google.com>
* Makefile.am: Set MAKEOVERRIDES.
* Makefile.in: Regenerate.
* aclocal.m4: Regenerate.
* config.in: Regenerate.
* configure: Regenerate.
* import/Makefile.am: Update.
* import/Makefile.in: Regenerate.
* import/_Noreturn.h: New file.
* import/alloca.c (i00afunc): Update.
* import/alloca.in.h (if): Update.
* import/arg-nonnull.h: Rename from import/extra/snippet/arg-nonnull.h.
* import/arpa_inet.in.h (if): Update.
* import/assure.h: Update.
* import/at-func.c: Update.
* import/basename-lgpl.c: Update.
* import/canonicalize-lgpl.c (if): Update.
* import/c++defs.h: Rename from import/extra/snippet/c++defs.h.
* import/cdefs.h: New file.
* import/chdir-long.c: Update.
* import/chdir-long.h: Update.
* import/cloexec.c: Update.
* import/cloexec.h: Update.
* import/close.c: Update.
* import/closedir.c: Update.
* import/config.charset: Remove.
* import/dirent-private.h: Update.
* import/dirent.in.h: Update.
* import/dirfd.c: Update.
* import/dirname-lgpl.c: Update.
* import/dirname.h (base_name): Update.
* import/dosname.h (if): Update.
* import/dup-safer-flag.c: New file.
* import/dup-safer.c: Update.
* import/dup.c: Update.
* import/dup2.c (if): Update.
(dup2_nothrow): Update.
(ms_windows_dup2): Update.
* import/errno.in.h (if): Update.
(elif): Update.
* import/error.c (if): Update.
(strerror_r): Update.
(program_name): Update.
(error): Update.
(error_at_line): Update.
* import/error.h: Update.
* import/exitfail.c: Update.
* import/exitfail.h: Update.
* import/extra/config.rpath: Update.
* import/extra/snippet/_Noreturn.h: Remove.
* import/extra/update-copyright: Update.
* import/fchdir.c: Update.
* import/fcntl.c (rpl_fcntl): Update.
(INCL_DOS): Update.
(if): Update.
(rpl_fcntl_DUPFD): Update.
(rpl_fcntl_DUPFD_CLOEXEC): Update.
(klibc_fcntl): Update.
(fcntl): Update.
(have_dupfd_cloexec): Update.
* import/fcntl.in.h (if): Update.
(creat): Update.
(_GL_FUNCDECL_RPL): Update.
(_GL_CXXALIAS_RPL): Update.
(_GL_CXXALIAS_SYS): Update.
(_GL_CXXALIASWARN): Update.
(_GL_WARN_ON_USE): Update.
(O_CLOEXEC): Update.
(GNULIB_defined_O_CLOEXEC): Update.
* import/fd-hook.c: Update.
* import/fd-hook.h: Update.
* import/fd-safer-flag.c: New file.
* import/fd-safer.c: Update.
* import/fdopendir.c: Update.
* import/filename.h: Update.
* import/filenamecat-lgpl.c (longest_relative_suffix): Update.
(mfile_name_concat): Update.
* import/filenamecat.h: Update.
* import/flexmember.h: Update.
* import/float+.h: Update.
* import/float.c: Update.
* import/float.in.h (LDBL_MIN): Update.
* import/fnmatch.c (__builtin_expect): Update.
(FALLTHROUGH): Update.
* import/fnmatch.in.h (_FNMATCH_H): Update.
(_): Update.
(fnmatch): Update.
(_GL_FUNCDECL_RPL): Update.
(_GL_CXXALIAS_RPL): Update.
(_GL_FUNCDECL_SYS): Update.
(_GL_CXXALIAS_SYS): Update.
(_GL_CXXALIASWARN): Update.
(_GL_WARN_ON_USE): Update.
* import/fnmatch_loop.c (FCT): Update.
(EXT): Update.
* import/fpucw.h (GET_FPUCW): Update.
(SET_FPUCW): Update.
* import/frexp.c: Update.
* import/frexpl.c: Update.
* import/fstat.c (stat): Update.
(fstat): Update.
(WINDOWS_NATIVE): Update.
(fstat_nothrow): Update.
(WIN32_LEAN_AND_MEAN): Update.
* import/fstatat.c (normal_fstatat): Update.
(rpl_fstatat): Update.
* import/getcwd-lgpl.c (rpl_getcwd): Update.
* import/getcwd.c (getcwd_nothrow): Update.
(getcwd_system): Update.
(__getcwd): Update.
* import/getdtablesize.c (if): Update.
(_setmaxstdio): Update.
(_setmaxstdio_nothrow): Update.
(getdtablesize): Update.
* import/getlogin_r.c (if): Update.
(getlogin_r): Update.
* import/getprogname.c (getprogname): Update.
* import/getprogname.h: Update.
* import/gettext.h (if): Update.
* import/gettimeofday.c (WINDOWS_NATIVE): Update.
(localtime): Update.
(GetProcAddress): Update.
(gmtime): Update.
(void): Update.
(struct tm): Update.
(rpl_localtime): Update.
(initialize): Update.
(rpl_gmtime): Update.
(tzset): Update.
(rpl_tzset): Update.
* import/glob-libc.h (_Restrict_): Update.
(__size_t): Update.
(__need_size_t): Update.
(glob): Update.
(globfree): Update.
(__REDIRECT_NTH): Update.
(glob64): Update.
(globfree64): Update.
(glob_pattern_p): Update.
* import/glob.c (POSIX): Update.
(if): Update.
(__set_errno): Update.
(getpwnam_r): Update.
(__lstat64): Update.
(FLEXIBLE_ARRAY_MEMBER): Update.
(__glob_pattern_p): Update.
(GETPW_R_SIZE_MAX): Update.
(GET_LOGIN_NAME_MAX): Update.
(DT_UNKNOWN): Update.
(DT_DIR): Update.
(DT_LNK): Update.
(D_TYPE_TO_RESULT): Update.
(readdir_result_might_be_symlink): Update.
(readdir_result_might_be_dir): Update.
(readdir_result_type): Update.
(D_INO_TO_RESULT): Update.
(READDIR_RESULT_INITIALIZER): Update.
(attribute_hidden): Update.
(__attribute_noinline__): Update.
(__builtin_expect): Update.
(__glibc_unlikely): Update.
(__has_builtin): Update.
(__glob_pattern_type): Update.
(is_dir): Update.
(glob): Update.
(globfree): Update.
(libc_hidden_def): Update.
(DIRSEP_CHAR): Update.
(prefix_array): Update.
(weak_alias): Update.
(link_exists2_p): Update.
(link_exists_p): Update.
(glob_in_dir): Update.
(GLOBNAMES_MEMBERS): Update.
* import/glob.in.h (_GL_GLOB_H): Update.
(_): Update.
(__BEGIN_DECLS): Update.
(__END_DECLS): Update.
(_Restrict_): Update.
(__THROW): Update.
(__THROWNL): Update.
(__size_t): Update.
(__USE_GNU): Update.
(glob): Update.
(globfree): Update.
(glob_pattern_p): Update.
(__glob_pattern_p): Update.
(__GLOB_GNULIB): Update.
(_GL_FUNCDECL_RPL): Update.
(_GL_CXXALIAS_RPL): Update.
(_GL_FUNCDECL_SYS): Update.
(_GL_CXXALIAS_SYS): Update.
(_GL_WARN_ON_USE): Update.
* import/glob_internal.h: New file.
* import/glob_pattern_p.c: New file.
* import/globfree.c: New file.
* import/glthread/lock.c (glthread_rwlock_init_for_glibc): Update.
(glthread_rwlock_rdlock_multithreaded): Update.
(glthread_once_call): Update.
(glthread_once_multithreaded): Update.
(glthread_once_singlethreaded): Update.
(glthread_recursive_lock_init_multithreaded): Update.
(glthread_recursive_lock_lock_multithreaded): Update.
(glthread_recursive_lock_unlock_multithreaded): Update.
(glthread_recursive_lock_destroy_multithreaded): Update.
(glthread_lock_init_func): Update.
(glthread_lock_lock_func): Update.
(glthread_lock_unlock_func): Update.
(glthread_lock_destroy_func): Update.
(gl_waitqueue_t): Update.
(gl_waitqueue_init): Update.
(gl_waitqueue_add): Update.
(gl_waitqueue_notify_first): Update.
(gl_waitqueue_notify_all): Update.
(glthread_rwlock_init_func): Update.
(glthread_rwlock_rdlock_func): Update.
(glthread_rwlock_wrlock_func): Update.
(glthread_rwlock_unlock_func): Update.
(glthread_rwlock_destroy_func): Update.
(glthread_recursive_lock_init_func): Update.
(glthread_recursive_lock_lock_func): Update.
(glthread_recursive_lock_unlock_func): Update.
(glthread_recursive_lock_destroy_func): Update.
(glthread_once_func): Update.
* import/glthread/lock.h (c11_threads_in_use): Update.
(pthread_in_use): Update.
(gl_rwlock_initializer): Update.
(glthread_rwlock_init): Update.
(glthread_rwlock_init_for_glibc): Update.
(pth_in_use): Update.
(gl_lock_define): Update.
(gl_lock_define_initialized): Update.
(gl_lock_initializer): Update.
(glthread_lock_init): Update.
(glthread_lock_lock): Update.
(glthread_lock_unlock): Update.
(glthread_lock_destroy): Update.
(gl_rwlock_define): Update.
(gl_rwlock_define_initialized): Update.
(glthread_rwlock_rdlock): Update.
(glthread_rwlock_wrlock): Update.
(glthread_rwlock_unlock): Update.
(glthread_rwlock_destroy): Update.
(gl_recursive_lock_define): Update.
(gl_recursive_lock_define_initialized): Update.
(gl_recursive_lock_initializer): Update.
(glthread_recursive_lock_init): Update.
(glthread_recursive_lock_lock): Update.
(glthread_recursive_lock_unlock): Update.
(glthread_recursive_lock_destroy): Update.
(gl_once_define): Update.
(glthread_once): Update.
(glthread_once_multithreaded): Update.
(glthread_once_singlethreaded): Update.
(thread_in_use): Update.
(glthread_recursive_lock_init_multithreaded): Update.
(glthread_recursive_lock_lock_multithreaded): Update.
(glthread_recursive_lock_unlock_multithreaded): Update.
(glthread_recursive_lock_destroy_multithreaded): Update.
(glthread_lock_init_func): Update.
(glthread_lock_lock_func): Update.
(glthread_lock_unlock_func): Update.
(glthread_lock_destroy_func): Update.
(glthread_rwlock_init_func): Update.
(glthread_rwlock_rdlock_func): Update.
(glthread_rwlock_wrlock_func): Update.
(glthread_rwlock_unlock_func): Update.
(glthread_rwlock_destroy_func): Update.
(glthread_recursive_lock_init_func): Update.
(glthread_recursive_lock_lock_func): Update.
(glthread_recursive_lock_unlock_func): Update.
(glthread_recursive_lock_destroy_func): Update.
(glthread_once_func): Update.
* import/glthread/threadlib.c: Update.
* import/hard-locale.c: Update.
* import/hard-locale.h: Update.
* import/inet_ntop.c: Update.
* import/intprops.h (__has_builtin): Update.
(_GL_INT_CONVERT): Update.
(_GL_INT_NEGATE_CONVERT): Update.
(verify): Update.
(_GL_HAS_BUILTIN_OVERFLOW): Update.
(_GL_HAS_BUILTIN_ADD_OVERFLOW): Update.
(_GL_HAS_BUILTIN_OVERFLOW_P): Update.
(_GL_HAS_BUILTIN_MUL_OVERFLOW): Update.
(_GL_BINARY_OP_OVERFLOW): Update.
(INT_ADD_WRAPV): Update.
(INT_SUBTRACT_WRAPV): Update.
(INT_MULTIPLY_WRAPV): Update.
(_GL_INT_OP_WRAPV): Update.
(_GL_INT_OP_WRAPV_SMALLISH): Update.
(_GL_INT_OP_WRAPV_LONGISH): Update.
(_GL_INT_OP_CALC): Update.
(_GL_INT_OP_CALC1): Update.
(_GL_INT_OP_WRAPV_VIA_UNSIGNED): Update.
(_GL_INT_ADD_RANGE_OVERFLOW): Update.
(_GL_INT_SUBTRACT_RANGE_OVERFLOW): Update.
(_GL_INT_MULTIPLY_RANGE_OVERFLOW): Update.
* import/inttypes.in.h (if): Update.
* import/isnan.c: Update.
* import/isnand-nolibm.h: Update.
* import/isnand.c: Update.
* import/isnanl-nolibm.h: Update.
* import/isnanl.c: Update.
* import/itold.c: Update.
* import/libc-config.h: New file.
* import/limits.in.h (LLONG_MIN): Update.
(LLONG_MAX): Update.
(ULLONG_MAX): Update.
(WORD_BIT): Update.
(LONG_BIT): Update.
* import/localcharset.c (setlocale): Update.
(relocate): Update.
(O_NOFOLLOW): Update.
(ISSLASH): Update.
(DIRECTORY_SEPARATOR): Update.
(getc): Update.
(volatile): Update.
(get_charset_aliases): Update.
(struct table_entry): Update.
(alias_table_defined): Update.
(locale_table_defined): Update.
(locale_charset): Update.
(if): Update.
* import/localcharset.h: Update.
* import/localtime-buffer.c: New file.
* import/localtime-buffer.h: New file.
* import/lstat.c (rpl_lstat): Update.
* import/m4/00gnulib.m4: Update.
* import/m4/__inline.m4: New file.
* import/m4/absolute-header.m4: Update.
* import/m4/alloca.m4: Update.
* import/m4/arpa_inet_h.m4: Update.
* import/m4/builtin-expect.m4: New file.
* import/m4/canonicalize.m4: Update.
* import/m4/chdir-long.m4: Update.
* import/m4/close.m4: Update.
* import/m4/closedir.m4: Update.
* import/m4/codeset.m4: Update.
* import/m4/configmake.m4: Remove.
* import/m4/d-ino.m4: Update.
* import/m4/d-type.m4: Update.
* import/m4/dirent_h.m4: Update.
* import/m4/dirfd.m4: Update.
* import/m4/dirname.m4: Update.
* import/m4/double-slash-root.m4: Update.
* import/m4/dup.m4: Update.
* import/m4/dup2.m4: Update.
* import/m4/eealloc.m4: Update.
* import/m4/environ.m4: Update.
* import/m4/errno_h.m4: Update.
* import/m4/error.m4: Update.
* import/m4/exponentd.m4: Update.
* import/m4/exponentl.m4: Update.
* import/m4/extensions.m4: Update.
* import/m4/extern-inline.m4: Update.
* import/m4/fchdir.m4: Update.
* import/m4/fcntl-o.m4: Update.
* import/m4/fcntl.m4: Update.
* import/m4/fcntl_h.m4: Update.
* import/m4/fdopendir.m4: Update.
* import/m4/filenamecat.m4: Update.
* import/m4/flexmember.m4: Update.
* import/m4/float_h.m4: Update.
* import/m4/fnmatch.m4: Update.
* import/m4/fnmatch_h.m4: New file.
* import/m4/fpieee.m4: Update.
* import/m4/frexp.m4: Update.
* import/m4/frexpl.m4: Update.
* import/m4/fstat.m4: Update.
* import/m4/fstatat.m4: Update.
* import/m4/getcwd-abort-bug.m4: Update.
* import/m4/getcwd-path-max.m4: Update.
* import/m4/getcwd.m4: Update.
* import/m4/getdtablesize.m4: Update.
* import/m4/getlogin.m4: New file.
* import/m4/getlogin_r.m4: Update.
* import/m4/getpagesize.m4: New file.
* import/m4/getprogname.m4: Update.
* import/m4/gettimeofday.m4: Update.
* import/m4/glibc21.m4: Remove.
* import/m4/glob.m4: Update.
* import/m4/glob_h.m4: New file.
* import/m4/gnulib-cache.m4: Update.
* import/m4/gnulib-common.m4: Update.
* import/m4/gnulib-comp.m4: Update.
* import/m4/gnulib-tool.m4: Update.
* import/m4/hard-locale.m4: Remove.
* import/m4/host-cpu-c-abi.m4: New file.
* import/m4/include_next.m4: Update.
* import/m4/inet_ntop.m4: Update.
* import/m4/inttypes-pri.m4: Update.
* import/m4/inttypes.m4: Update.
* import/m4/isnand.m4: Update.
* import/m4/isnanl.m4: Update.
* import/m4/largefile.m4: Update.
* import/m4/lib-ld.m4: Update.
* import/m4/lib-link.m4: Update.
* import/m4/lib-prefix.m4: Update.
* import/m4/limits-h.m4: Update.
* import/m4/localcharset.m4: Update.
* import/m4/locale-fr.m4: Update.
* import/m4/locale-ja.m4: Update.
* import/m4/locale-zh.m4: Update.
* import/m4/localtime-buffer.m4: New file.
* import/m4/lock.m4: Update.
* import/m4/longlong.m4: Update.
* import/m4/lstat.m4: Update.
* import/m4/malloc.m4: Update.
* import/m4/malloca.m4: Update.
* import/m4/math_h.m4: Update.
* import/m4/mbrtowc.m4: Update.
* import/m4/mbsinit.m4: Update.
* import/m4/mbsrtowcs.m4: Update.
* import/m4/mbstate_t.m4: Update.
* import/m4/memchr.m4: Update.
* import/m4/memmem.m4: Update.
* import/m4/mempcpy.m4: Update.
* import/m4/memrchr.m4: Update.
* import/m4/mkdir.m4: Update.
* import/m4/mkdtemp.m4: Update.
* import/m4/mkostemp.m4: Update.
* import/m4/mmap-anon.m4: Update.
* import/m4/mode_t.m4: Update.
* import/m4/msvc-inval.m4: Update.
* import/m4/msvc-nothrow.m4: Update.
* import/m4/multiarch.m4: Update.
* import/m4/netinet_in_h.m4: Update.
* import/m4/nocrash.m4: Update.
* import/m4/off_t.m4: Update.
* import/m4/onceonly.m4: Remove.
* import/m4/open-cloexec.m4: New file.
* import/m4/open-slash.m4: New file.
* import/m4/open.m4: Update.
* import/m4/openat.m4: Update.
* import/m4/opendir.m4: Update.
* import/m4/pathmax.m4: Update.
* import/m4/pthread_rwlock_rdlock.m4: New file.
* import/m4/rawmemchr.m4: Update.
* import/m4/readdir.m4: Update.
* import/m4/readlink.m4: Update.
* import/m4/realloc.m4: Update.
* import/m4/rename.m4: Update.
* import/m4/rewinddir.m4: Update.
* import/m4/rmdir.m4: Update.
* import/m4/save-cwd.m4: Update.
* import/m4/secure_getenv.m4: Remove.
* import/m4/setenv.m4: Update.
* import/m4/signal_h.m4: Update.
* import/m4/socklen.m4: Update.
* import/m4/sockpfaf.m4: Update.
* import/m4/ssize_t.m4: Update.
* import/m4/stat-time.m4: New file.
* import/m4/stat.m4: Update.
* import/m4/std-gnu11.m4: New file.
* import/m4/stdalign.m4: Update.
* import/m4/stdbool.m4: Update.
* import/m4/stddef_h.m4: Update.
* import/m4/stdint.m4: Update.
* import/m4/stdio_h.m4: Update.
* import/m4/stdlib_h.m4: Update.
* import/m4/strchrnul.m4: Update.
* import/m4/strdup.m4: Update.
* import/m4/strerror.m4: Update.
* import/m4/strerror_r.m4: Update.
* import/m4/string_h.m4: Update.
* import/m4/strstr.m4: Update.
* import/m4/strtok_r.m4: Update.
* import/m4/sys_socket_h.m4: Update.
* import/m4/sys_stat_h.m4: Update.
* import/m4/sys_time_h.m4: Update.
* import/m4/sys_types_h.m4: Update.
* import/m4/sys_uio_h.m4: Update.
* import/m4/tempname.m4: Update.
* import/m4/threadlib.m4: Update.
* import/m4/time_h.m4: Update.
* import/m4/time_r.m4: Update.
* import/m4/unistd-safer.m4: Update.
* import/m4/unistd_h.m4: Update.
* import/m4/warn-on-use.m4: Update.
* import/m4/wchar_h.m4: Update.
* import/m4/wchar_t.m4: Update.
* import/m4/wctype_h.m4: Update.
* import/m4/wint_t.m4: Update.
* import/malloc.c: Update.
* import/malloc/scratch_buffer.h: New file.
* import/malloc/scratch_buffer_grow.c: New file.
* import/malloc/scratch_buffer_grow_preserve.c: New file.
* import/malloc/scratch_buffer_set_array_size.c: New file.
* import/malloca.c (MAGIC_NUMBER): Update.
(MAGIC_SIZE): Update.
(struct preliminary_header): Update.
(HEADER_SIZE): Update.
(union header): Update.
(verify): Update.
(HASH_TABLE_SIZE): Update.
(freea): Update.
* import/malloca.h (malloca): Update.
(nmalloca): Update.
* import/malloca.valgrind: Remove.
* import/math.in.h (_GL_MATH_CXX_REAL_FLOATING_DECL_2): Update.
(func): Update.
(rpl_func): Update.
(f): Update.
(d): Update.
(l): Update.
(_GL_WARN_ON_USE): Update.
(_GL_WARN_ON_USE_ATTRIBUTE): Update.
(FP_ILOGB0): Update.
(FP_ILOGBNAN): Update.
(acosf): Update.
(_GL_FUNCDECL_RPL): Update.
(_GL_CXXALIAS_RPL): Update.
(asinf): Update.
(atanf): Update.
(atan2f): Update.
(cosf): Update.
(coshf): Update.
(expf): Update.
(expl): Update.
(expm1l): Update.
(ilogbl): Update.
(rintl): Update.
(sinf): Update.
(sinhf): Update.
(sqrtf): Update.
(tanf): Update.
(tanhf): Update.
(isfinite): Update.
(isinf): Update.
(isnan): Update.
(GNULIB_defined_signbit): Update.
(signbit): Update.
* import/mbrtowc.c (FALLTHROUGH): Update.
(locale_enc): Update.
(locale_enc_cached): Update.
(gl_lock_define_initialized): Update.
(mbrtowc): Update.
* import/mbsinit.c (if): Update.
(mbsinit): Update.
* import/mbsrtowcs-impl.h: Update.
* import/mbsrtowcs-state.c: Update.
* import/mbsrtowcs.c: Update.
* import/memchr.c: Update.
* import/memchr.valgrind: Update.
* import/memmem.c (__builtin_expect): Update.
* import/mempcpy.c: Update.
* import/memrchr.c (__memrchr): Update.
* import/mkdir.c (if): Update.
* import/mkdtemp.c: Update.
* import/mkostemp.c: Update.
* import/msvc-inval.c: Update.
* import/msvc-inval.h: Update.
* import/msvc-nothrow.c: Update.
* import/msvc-nothrow.h (if): Update.
* import/netinet_in.in.h: Update.
* import/open.c (open): Update.
(if): Update.
* import/openat-die.c: Update.
* import/openat-priv.h: Update.
* import/openat-proc.c: Update.
* import/openat.c (rpl_openat): Update.
* import/openat.h: Update.
* import/opendir.c: Update.
* import/pathmax.h (if): Update.
* import/pipe-safer.c: Update.
* import/rawmemchr.c: Update.
* import/rawmemchr.valgrind: Update.
* import/readdir.c (readdir): Update.
* import/readlink.c: Update.
* import/realloc.c: Update.
* import/ref-add.sin: Remove.
* import/ref-del.sin: Remove.
* import/rename.c (if): Update.
* import/rewinddir.c: Update.
* import/rmdir.c: Update.
* import/same-inode.h (SAME_INODE): Update.
* import/save-cwd.c (save_cwd): Update.
* import/save-cwd.h: Update.
* import/scratch_buffer.h: New file.
* import/secure_getenv.c: Remove.
* import/setenv.c: Update.
* import/signal.in.h: Update.
* import/stat-time.c: New file.
* import/stat-time.h: New file.
* import/stat-w32.c: New file.
* import/stat-w32.h: New file.
* import/stat.c (if): Update.
(stat): Update.
(REPLACE_FUNC_STAT_DIR): Update.
(WINDOWS_NATIVE): Update.
(WIN32_LEAN_AND_MEAN): Update.
(is_unc_root): Update.
(rpl_stat): Update.
* import/stdalign.in.h (elif): Update.
* import/stdbool.in.h: Update.
* import/stddef.in.h (_GL_STDDEF_ALIGNAS): Update.
(max_align_t): Update.
(GNULIB_defined_max_align_t): Update.
* import/stdint.in.h (WINT_MIN): Update.
(WINT_MAX): Update.
(_STDINT_MIN): Update.
(_STDINT_UNSIGNED_MIN): Update.
(_STDINT_SIGNED_MIN): Update.
(PTRDIFF_MIN): Update.
(SIG_ATOMIC_MIN): Update.
(WCHAR_MIN): Update.
* import/stdio.in.h (if): Update.
* import/stdlib.in.h (if): Update.
(_GL_WARN_ON_USE): Update.
(_GL_FUNCDECL_SYS): Update.
(random): Update.
(_GL_FUNCDECL_RPL): Update.
(_GL_CXXALIAS_RPL): Update.
(srandom): Update.
(initstate): Update.
(setstate): Update.
(_GL_CXXALIAS_SYS): Update.
(_GL_CXXALIASWARN): Update.
(GNULIB_defined_strtod_function): Update.
(strtold): Update.
(GNULIB_defined_strtold_function): Update.
* import/str-two-way.h: Update.
* import/strchrnul.c: Update.
* import/strchrnul.valgrind: Update.
* import/strdup.c: Update.
* import/streq.h: Update.
* import/strerror-override.c: Update.
* import/strerror-override.h: Update.
* import/strerror.c (strerror): Update.
* import/strerror_r.c (safe_copy): Update.
* import/string.in.h (_GL_FUNCDECL_SYS): Update.
(_GL_CXXALIAS_SYS): Update.
(_GL_CXXALIASWARN): Update.
(_GL_WARN_ON_USE): Update.
* import/stripslash.c: Update.
* import/strnlen1.c: Update.
* import/strnlen1.h: Update.
* import/strstr.c (__builtin_expect): Update.
* import/strtok_r.c: Update.
* import/sys_socket.in.h (CMSG_SPACE): Update.
(CMSG_LEN): Update.
(struct sockaddr_storage): Update.
(SO_REUSEPORT): Update.
(_GL_WARN_ON_USE): Update.
* import/sys_stat.in.h (if): Update.
(stat): Update.
(struct stat): Update.
(st_atime): Update.
(st_mtime): Update.
(st_ctime): Update.
(_GL_WINDOWS_STAT_TIMESPEC): Update.
(GNULIB_defined_struct_stat): Update.
(_S_IFBLK): Update.
(_S_IFLNK): Update.
(_S_IFSOCK): Update.
(fstat): Update.
(fstatat): Update.
(lstat): Update.
(stat64): Update.
(_stat64): Update.
(_stat32i64): Update.
(_stati64): Update.
(_stat32): Update.
(_stat64i32): Update.
* import/sys_time.in.h: Update.
* import/sys_types.in.h (dev_t): Update.
(GNULIB_defined_dev_t): Update.
(ino_t): Update.
(GNULIB_defined_ino_t): Update.
(_GL_WINDOWS_STAT_INODES): Update.
(if): Update.
* import/sys_uio.in.h: Update.
* import/tempname.c (__secure_getenv): Update.
(try_nocreate): Update.
* import/tempname.h: Update.
* import/time.in.h (tzset): Update.
(_GL_FUNCDECL_RPL): Update.
(_GL_CXXALIAS_RPL): Update.
(_GL_FUNCDECL_SYS): Update.
(_GL_CXXALIAS_SYS): Update.
(_GL_CXXALIASWARN): Update.
(ctime): Update.
(strftime): Update.
* import/time_r.c: Update.
* import/unistd--.h: Update.
* import/unistd-safer.h: Update.
* import/unistd.in.h (if): Update.
(elif): Update.
(__need_getopt): Update.
(access): Update.
(_GL_FUNCDECL_RPL): Update.
(_GL_CXXALIAS_RPL): Update.
(_GL_CXXALIAS_SYS): Update.
(_GL_CXXALIASWARN): Update.
(_GL_WARN_ON_USE): Update.
(_GL_FUNCDECL_SYS): Update.
(__declspec): Update.
(_GL_WARN_ON_USE_ATTRIBUTE): Update.
(faccessat): Update.
(getpass): Update.
(truncate): Update.
* import/unsetenv.c: Update.
* import/verify.h (if): Update.
(_GL_HAVE__STATIC_ASSERT): Update.
(_GL_HAVE_STATIC_ASSERT): Update.
(_GL_HAVE__STATIC_ASSERT1): Update.
(_GL_HAVE_STATIC_ASSERT1): Update.
(_GL_VERIFY): Update.
(_Static_assert): Update.
(_GL_HAS_BUILTIN_TRAP): Update.
(_GL_HAS_BUILTIN_UNREACHABLE): Update.
(verify_true): Update.
(verify): Update.
(__has_builtin): Update.
(elif): Update.
(assume): Update.
* import/warn-on-use.h: Rename from import/extra/snippet/warn-on-use.h.
* import/wchar.in.h (if): Update.
(wcsftime): Update.
(_GL_FUNCDECL_RPL): Update.
(_GL_CXXALIAS_RPL): Update.
(_GL_FUNCDECL_SYS): Update.
(_GL_CXXALIAS_SYS): Update.
(_GL_CXXALIASWARN): Update.
(_GL_WARN_ON_USE): Update.
* import/wctype.in.h (rpl_iswalnum): Update.
(rpl_iswalpha): Update.
(rpl_iswblank): Update.
(rpl_iswcntrl): Update.
(rpl_iswdigit): Update.
(rpl_iswgraph): Update.
(rpl_iswlower): Update.
(rpl_iswprint): Update.
(rpl_iswpunct): Update.
(rpl_iswspace): Update.
(rpl_iswupper): Update.
(rpl_iswxdigit): Update.
(rpl_towlower): Update.
(rpl_towupper): Update.
(iswalnum): Update.
(iswalpha): Update.
(iswblank): Update.
(iswcntrl): Update.
(iswdigit): Update.
(iswgraph): Update.
(iswlower): Update.
(iswprint): Update.
(iswpunct): Update.
(iswspace): Update.
(iswupper): Update.
(iswxdigit): Update.
(towlower): Update.
(towupper): Update.
* import/windows-initguard.h: New file.
* import/windows-mutex.c: New file.
* import/windows-mutex.h: New file.
* import/windows-once.c: New file.
* import/windows-once.h: New file.
* import/windows-recmutex.c: New file.
* import/windows-recmutex.h: New file.
* import/windows-rwlock.c: New file.
* import/windows-rwlock.h: New file.
* import/xalloc-oversized.h: New file.
* patches/0001-Fix-PR-gdb-23558-Use-system-s-getcwd-when-cross-comp.patch: Remove.
* patches/0002-mkostemp-mkostemps-Fix-compilation-error-in-C-mode-o.patch: Remove.
* patches/0003-Fix-glob-c-Coverity-issues.patch: Remove.
* update-gnulib.sh: Update to latest gnulib and don't apply patches
anymore. Also updates the patch -p flag to the current directory structure in
case patches are needed again in the future.
Change-Id: I9c2b07a3046baecfb664e21b2644353ea888dbfa
Alan Modra [Mon, 16 Dec 2019 06:28:30 +0000 (16:58 +1030)]
ubsan: aarch64: left shift of negative value
* aarch64-dis.c (sign_extend): Return uint64_t. Rewrite without
conditional.
(aarch64_ext_imm): Avoid signed overflow.
Alan Modra [Sun, 15 Dec 2019 23:29:23 +0000 (09:59 +1030)]
ubsan: microblaze: left shift cannot be represented in type 'int'
* microblaze-dis.c (read_insn_microblaze): Avoid signed overflow.
Alan Modra [Sun, 15 Dec 2019 23:28:52 +0000 (09:58 +1030)]
ubsan: nios2: left shift cannot be represented in type 'int'
* nios2-dis.c (nios2_print_insn_arg): Avoid signed overflow
Alan Modra [Sun, 15 Dec 2019 23:30:07 +0000 (10:00 +1030)]
ubsan: xstormy16: left shift of negative value
cpu/
* xstormy16.cpu (f-rel12a): Avoid signed overflow.
opcodes/
* xstormy16-ibld.c: Regenerate.
Alan Modra [Sun, 15 Dec 2019 23:30:39 +0000 (10:00 +1030)]
asan: score: global-buffer-overflow
I'm flying blind here, not having an s+core s3 insn set reference,
but this seems reasonably obvious from what is done by the assembler.
s3_do16_rpop does some mixing of imm and reg values to place in the
rpop reg field, but I'm not going to try to fix the disassembly
there.
* score-dis.c (print_insn_score16): Move rpush/rpop imm field
value adjustment so that it doesn't affect reg field too.
Alan Modra [Sun, 15 Dec 2019 23:28:09 +0000 (09:58 +1030)]
ubsan: crx: left shift cannot be represented in type 'int'
The ubsan complaint is fixed by the SBM change, with similar possible
complaints fixed by the EXTRACT change. The rest is just cleanup.
include/
* opcode/crx.h (inst <match>): Make unsigned int.
opcodes/
* crx-dis.c (EXTRACT, SBM): Avoid signed overflow.
(get_number_of_operands, getargtype, getbits, getregname),
(getcopregname, getprocregname, gettrapstring, getcinvstring),
(getregliststring, get_word_at_PC, get_words_at_PC, build_mask),
(powerof2, match_opcode, make_instruction, print_arguments),
(print_arg): Delete forward declarations, moving static to..
(getregname, getcopregname, getregliststring): ..these definitions.
(build_mask): Return unsigned int mask.
(match_opcode): Use unsigned int vars.
Alan Modra [Mon, 16 Dec 2019 00:01:34 +0000 (10:31 +1030)]
ubsan: bfin: left shift of negative value
* bfin-dis.c (fmtconst, fmtconst_val): Avoid signed overflow.
Alan Modra [Sun, 15 Dec 2019 23:05:30 +0000 (09:35 +1030)]
ubsan: nds32: left shift cannot be represented in type 'int'
Note that using 1u in N32_BIT makes all of N32_BIT, __MASK, __MF, __GF
and __SEXT evaluate as unsigned int (the latter three when when their
v arg is int or smaller). This would be a problem if assigning the
result to a bfd_vma, long, or other type wider than an int since the
__SEXT result would be zero extended to the wider type. Fortunately
nds32 target code doesn't use wider types unnecessarily.
include/
* opcode/nds32.h (N32_BIT): Define using 1u.
(__SEXT): Use __MASK and N32_BIT.
(N32_IMMS): Remove duplicate mask.
opcodes/
* nds32-dis.c (print_insn16, print_insn32): Remove forward decls.
(struct objdump_disasm_info): Delete.
(nds32_parse_audio_ext, nds32_parse_opcode): Cast result of
N32_IMMS to unsigned before shifting left.
Alan Modra [Sun, 15 Dec 2019 23:27:22 +0000 (09:57 +1030)]
ubsan: moxie: left shift of negative value
Commit
8c9b4171877df didn't remove a glaring left shift of a number
that had just been sign extended.
* moxie-dis.c (INST2OFFSET): Don't left shift a signed value.
(print_insn_moxie): Remove unnecessary cast.
Christian Biesinger [Thu, 12 Dec 2019 00:50:43 +0000 (19:50 -0500)]
Use a member function to set a symbol's language
This removes symbol_set_language and SYMBOL_SET_LANGUAGE in favor of
a new function general_symbol_info::set_language. symbol and minimal_symbol
already inherit from that struct so this works naturally.
gdb/ChangeLog:
2019-12-15 Christian Biesinger <cbiesinger@google.com>
* ada-exp.y (write_ambiguous_var): Update.
* coffread.c (process_coff_symbol): Update.
* ctfread.c (ctf_add_enum_member_cb): Update.
(new_symbol): Update.
* dwarf2read.c (fixup_go_packaging): Update.
(new_symbol): Update.
* language.c (language_alloc_type_symbol): Update.
* mdebugread.c (new_symbol): Update.
* minsyms.c (minimal_symbol_reader::record_full): Update.
* psymtab.c (add_psymbol_to_bcache): Update.
* stabsread.c (define_symbol): Update.
(read_enum_type): Update.
* symtab.c (symbol_set_language): Make this a member function...
(general_symbol_info::set_language): ... here.
* symtab.h (struct general_symbol_info) <set_language>: New function.
(SYMBOL_SET_LANGUAGE): Remove.
(symbol_set_language): Remove.
Change-Id: Ideafb6c384004b9adef793a1192735c501da41d5
Christian Biesinger [Tue, 3 Dec 2019 23:10:32 +0000 (17:10 -0600)]
Use an accessor function for general_symbol_info::language
Also renames the member variable to m_language to make code easier to read
when more functions become member functions.
I was originally hoping to eventually make m_language private (after a few
more patches), but unfortunately then it no longer counts as a POD type,
which means gdbsupport/poison.h won't let us use memset to initialize
this type, which psymtabs rely on to clear padding bytes so that bcache
can work properly.
gdb/ChangeLog:
2019-12-15 Christian Biesinger <cbiesinger@google.com>
* ada-lang.c (ada_add_block_symbols): Update.
(ada_collect_symbol_completion_matches): Update.
* ax-gdb.c (gen_expr): Update.
* block.c (block_lookup_symbol): Update.
(block_lookup_symbol_primary): Update.
(block_find_symbol): Update.
* cp-namespace.c (cp_lookup_symbol_imports_or_template): Update.
* dbxread.c (process_one_symbol): Update.
* dictionary.c (insert_symbol_hashed): Update.
(collate_pending_symbols_by_language): Update.
(mdict_add_symbol): Update.
* dwarf-index-write.c (write_psymbols): Update.
* dwarf2read.c (fixup_go_packaging): Update.
* findvar.c (read_var_value): Update.
* ft32-tdep.c (ft32_skip_prologue): Update.
* go-lang.c (go_symbol_package_name): Update.
* language.h (scoped_switch_to_sym_language_if_auto::
scoped_switch_to_sym_language_if_auto): Update.
* linespec.c (find_method): Update.
(find_label_symbols_in_block): Update.
* mdebugread.c (parse_symbol): Update.
* mi/mi-cmd-stack.c (list_arg_or_local): Update.
* minsyms.c (add_minsym_to_demangled_hash_table): Update.
(minimal_symbol_reader::install): Update.
* moxie-tdep.c (moxie_skip_prologue): Update.
* parse.c (parse_exp_in_context): Update.
* psymtab.c (psymbol_name_matches): Update.
(match_partial_symbol): Update.
(lookup_partial_symbol): Update.
(psymbol_hash): Update.
(psymbol_compare): Update.
* python/py-framefilter.c (extract_sym): Update.
(py_print_single_arg): Update.
* stabsread.c (define_symbol): Update.
* stack.c (print_frame_arg): Update.
(find_frame_funname): Update.
(info_frame_command_core): Update.
* symfile.c (set_initial_language): Update.
* symtab.c (symbol_set_demangled_name): Update.
(symbol_get_demangled_name): Update.
(symbol_set_language): Update.
(symbol_find_demangled_name): Update.
(symbol_set_names): Update.
(general_symbol_info::natural_name): Update.
(general_symbol_info::demangled_name): Update.
(general_symbol_info::search_name): Update.
(symbol_matches_search_name): Update.
(eq_symbol_entry): Update.
(iterate_over_symbols): Update.
(completion_list_add_symbol): Update.
(completion_list_add_msymbol): Update.
(completion_list_add_fields): Update.
* symtab.h (struct general_symbol_info) <language>: New function.
<language>: Rename to...
<m_language>: ...this.
(SYMBOL_LANGUAGE): Remove.
(MSYMBOL_LANGUAGE): Remove.
(struct symbol) <ctor>: Update.
* xstormy16-tdep.c (xstormy16_skip_prologue): Update.
Change-Id: I6464d477457e61639c63ddf8b145e407a35c235a
Christian Biesinger [Sat, 14 Dec 2019 20:47:22 +0000 (15:47 -0500)]
Use symbol_set_language to set a symbol's language
Instead of using SYMBOL_LANGUAGE (sym) = foo.
Having only a single way to set a symbol's language is clearer and this
is also a requirement for making set_language a member function.
gdb/ChangeLog:
2019-12-15 Christian Biesinger <cbiesinger@google.com>
* ada-exp.y (write_ambiguous_var): Call symbol_set_language to
set the language of sym.
* language.c (language_alloc_type_symbol): Likewise.
Change-Id: I85338ea2e4121155f2da222fe0aa6b7d3ffe26f7
GDB Administrator [Mon, 16 Dec 2019 00:00:23 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 15 Dec 2019 00:00:52 +0000 (00:00 +0000)]
Automatic date update in version.in
Andrew Burgess [Sat, 14 Dec 2019 23:11:58 +0000 (23:11 +0000)]
gdb/doc: Remove duplicate description of lookup_global_symbol
In this commit:
commit
086baaf1346f07acfb6708e8c6cb79274241488b
Date: Tue Oct 15 16:18:26 2019 +0100
gdb/python: Introduce gdb.lookup_static_symbols
A duplicate description of gdb.lookup_global_symbol was accidentally
added. This commit corrects this mistake and removes the duplicate.
gdb/doc/ChangeLog:
* python.texi (Symbols In Python): Remove duplicate description of
gdb.lookup_global_symbol.
Change-Id: I4457b42cf05bde39e5c0ff39f168af919cad1255
Anthony Green [Sat, 14 Dec 2019 10:23:20 +0000 (05:23 -0500)]
Add unlink support to moxie simulator
This change adds support for the unlink system call, which is
required by the GCC testsuite. It also switches read/write/open
system calls to use the sim_io_* functions.
2019-12-14 Anthony Green <green@moxielogic.com>
* interp.c (sim_engine_run): Make use of sim_io_* functions for
read/write/open system calls. Implement the unlink system call.
Sergio Durigan Junior [Wed, 10 Jul 2019 20:18:27 +0000 (16:18 -0400)]
Guard against 'current_directory == NULL' on gdb_abspath (PR gdb/23613)
Ref.: https://bugzilla.redhat.com/show_bug.cgi?id=
1728147
Ref.: https://sourceware.org/bugzilla/show_bug.cgi?id=23613
Hi,
This bug has been reported against Fedora GDB, but there's also an
upstream bug. The problem reported is that GDB segfaults when the
working directory is deleted. It's pretty use to reproduce it:
mkdir bla
cd bla
rmdir ../bla
gdb echo
Debugging the problem is a bit tricky, because, since the current
directory doesn't exist anymore, a corefile cannot be saved there.
After a few attempts, I came up with the following:
gdb -ex 'shell mkdir bla' -ex 'cd bla' -ex 'shell rmdir ../bla' -ex 'r echo' ./gdb/gdb
This assumes that you're inside a build directory which contains
./gdb/gdb, of course.
After investigating it, I found that the problem happens at
gdb_abspath, where we're dereferencing 'current_directory' without
checking if it's NULL:
...
(concat (current_directory,
IS_DIR_SEPARATOR (current_directory[strlen (current_directory) - 1])
? "" : SLASH_STRING,
...
So I fixed the problem with the patch below. The idea is that, if
'current_directory' is NULL, then the final string returned should be
just the "path".
After fixing the bug, I found a similar one reported against our
bugzilla: PR gdb/23613. The problem is the same, but the reproducer
is a bit different.
I really tried writing a testcase for this, but unfortunately it's
apparently not possible to start GDB inside a non-existent directory
with DejaGNU.
I regression tested this patch on the BuildBot, and no regressions
were found.
gdb/ChangeLog:
2019-12-14 Sergio Durigan Junior <sergiodj@redhat.com>
https://bugzilla.redhat.com/show_bug.cgi?id=
1728147
PR gdb/23613
* bsd-kvm.c (bsd_kvm_target_open): Use 'gdb_abspath'.
* corelow.c: Include 'gdbsupport/pathstuff.h'.
(core_target_open): Use 'gdb_abspath'.
* gdbsupport/pathstuff.c (gdb_abspath): Guard against
'current_directory == NULL' case.
* gdbsupport/pathstuff.h (gdb_abspath): Expand comment and
explain what happens when 'current_directory' is NULL.
* go32-nat.c (go32_nat_target::wait): Check if
'current_directory' is NULL before call to 'chdir'.
* source.c (add_path): Use 'gdb_abspath'.
* top.c: Include 'gdbsupport/pathstuff.h'.
(init_history): Use 'gdb_abspath'.
(set_history_filename): Likewise.
* tracefile-tfile.c: Include 'gdbsupport/pathstuff.h'.
(tfile_target_open): Use 'gdb_abspath'.
Change-Id: Ibb0932fa25bc5c2d3ae4a7f64bd7f32885ca403b
GDB Administrator [Sat, 14 Dec 2019 00:00:16 +0000 (00:00 +0000)]
Automatic date update in version.in
Christian Biesinger [Fri, 13 Dec 2019 22:35:05 +0000 (17:35 -0500)]
Revert "Turn off threaded minsym demangling by default"
This reverts commit
62e77f56f0ce8b10122881d8f0acd70e113fde93.
(except for ChangeLog and a bugfix in minimal_symbol_reader::install)
As agreed on the mailing list, now that GDB 9 has branched, this patch
reverts the change to set worker-threads to zero. After this patch,
multithreaded minsym demangling will be enabled again by default.
gdb/ChangeLog:
2019-12-13 Christian Biesinger <cbiesinger@google.com>
* maint.c (n_worker_threads): Default to -1.
(worker_threads_disabled): Remove function.
* maint.h (worker_threads_disabled): Remove function.
* minsyms.c (minimal_symbol_reader::record_full): Don't call
symbol_set_names here if worker_threads_disabled () is true.
Change-Id: I5ff3e318d96f60968c8b8bedb84546ad2314d94b
Tom Tromey [Thu, 12 Dec 2019 17:40:08 +0000 (10:40 -0700)]
Remove ARI check for multiple calls to warning or error
ARI has a check for multiple calls to warning or error, suggesting
that they be combined into a single call. This triggers at three
places in gdb -- throw_bad_regnum_error, guile_repl_command, and the
end of value_cast -- and after examining these, I think they all make
sense as-is. Instead, it makes sense to remove this check from ARI.
gdb/ChangeLog
2019-12-13 Tom Tromey <tromey@adacore.com>
* contrib/ari/gdb_ari.sh: Remove check for multiple calls to
warning or error.
Change-Id: I0618683623a3c7324460c7b9e5d7f252d88c2e8d
Tom Tromey [Thu, 12 Dec 2019 16:10:49 +0000 (09:10 -0700)]
Remove "fix" call for "long long" from ARI
ARI has a "fix" call for "long long", but this call is incorrect.
This patch removes it.
gdb/ChangeLog
2019-12-13 Tom Tromey <tromey@adacore.com>
* contrib/ari/gdb_ari.sh: Remove call to "fix" for "long long".
Change-Id: I97bca2dc04b579fcf7c9dba7fe7fd939451bcefa
Tom Tromey [Thu, 5 Dec 2019 15:36:31 +0000 (08:36 -0700)]
Accept -Wno- prefix in ARI
This adds -Wno- support to ARI, so that warnings can be disabled
selectively. I use this to ignore "deprecated" warnings.
gdb/ChangeLog
2019-12-13 Tom Tromey <tromey@adacore.com>
* contrib/ari/gdb_ari.sh: Handle -Wno- prefix.
Change-Id: I6919faedf920e857df4f597df66f0ba3943e0eac
Tom Tromey [Thu, 5 Dec 2019 15:29:03 +0000 (08:29 -0700)]
Change ARI usage to GNU style
This changes the ARI usage text to use the GNU style for
"metasyntactic variables".
gdb/ChangeLog
2019-12-13 Tom Tromey <tromey@adacore.com>
* contrib/ari/gdb_ari.sh (usage): Use GNU style.
Change-Id: Ibe5a867571382d2985d1b8b78dfef3ddd02291ff
Tom Tromey [Thu, 5 Dec 2019 15:15:51 +0000 (08:15 -0700)]
Suppress ARI warnings for vsprintf
A few spots can validly call vsprintf; this adds ARI markers to
suppress warnings at these places.
gdb/ChangeLog
2019-12-13 Tom Tromey <tromey@adacore.com>
* gdbsupport/common-utils.c (string_printf, string_vprintf)
(string_vappendf): Add ARI comment.
Change-Id: Ia8665aa5d7b7331a3985b18626b19764a264447b
Tom Tromey [Thu, 5 Dec 2019 15:11:31 +0000 (08:11 -0700)]
Silence ARI warning about floatformat_to_double
This silences ARI at the one spot that is permitted to call
floatformat_to_double, and also removes the corresponding "fix" call
from gdb_ari.sh -- it was incorrect, and now is not needed.
gdb/ChangeLog
2019-12-13 Tom Tromey <tromey@adacore.com>
* contrib/ari/gdb_ari.sh: Remove "fix" call for
floatformat_to_double.
* target-float.c (host_float_ops<T>::from_target): Add ARI
comment.
Change-Id: I778a17a04da417c113194004dd7de3b1df381266
Tom Tromey [Thu, 5 Dec 2019 15:08:39 +0000 (08:08 -0700)]
Silence ARI for valid calls to abort
There are a handful of spots in gdb that validly call abort. This
patch adds the appropriate ARI marker to these lines, to silence the
ARI report. This also removes the "fix" call for "abort" from
gdb_ari.sh; it was incorrect and now is not needed.
gdb/ChangeLog
2019-12-13 Tom Tromey <tromey@adacore.com>
* contrib/ari/gdb_ari.sh: Remove "fix" call for abort.
* utils.c (abort_with_message, dump_core, internal_vproblem): Add
ARI marker to abort.
* event-top.c (handle_sigsegv): Add ARI marker to abort.
Change-Id: I09ce6aa5010bbe4e5bb73ffdb727481be39d34d6
Tom Tromey [Thu, 5 Dec 2019 15:04:42 +0000 (08:04 -0700)]
Fix ARI text for floatformat_from_double
ARI reports the wrong substitution for floatformat_from_double.
"floatformat_from_doublest" was renamed in 2017.
gdb/ChangeLog
2019-12-13 Tom Tromey <tromey@adacore.com>
* contrib/ari/gdb_ari.sh: Fix floatformat_from_double text.
Change-Id: Ibf1b194ea509b12ae8bc30ce285c809c96218557
Tom Tromey [Thu, 5 Dec 2019 14:58:03 +0000 (07:58 -0700)]
Remove ATTRIBUTE_UNUSED check from ARI
The text for the ATTRIBUTE_UNUSED check in ARI is plainly incorrect
now -- gdb does in fact use ATTRIBUTE_UNUSED, and there's no issue in
doing so, when done properly.
This patch removes this check.
gdb/ChangeLog
2019-12-13 Tom Tromey <tromey@adacore.com>
* contrib/ari/gdb_ari.sh: Remove ATTRIBUTE_UNUSED check.
Change-Id: I13fd8e9b40dbaab3978dbf9b6c4228b62299d944
Tom Tromey [Thu, 5 Dec 2019 14:53:32 +0000 (07:53 -0700)]
Remove "boolean" and "var_boolean" checks from ARI
The "boolean" and "var_boolean" checks from ARI seem only to generate
false reports.
Now that gdb is in C++, at least the "boolean" check seems unlikely to
ever generate a true report.
The "var_boolean" check likewise doesn't seem valuable any more --
presumably this refers to some ancient way of doing things in gdb, and
isn't likely to find a bug in the future.
Therefore, this patch removes these two checks.
gdb/ChangeLog
2019-12-13 Tom Tromey <tromey@adacore.com>
* contrib/ari/gdb_ari.sh: Remove "boolean" and "var_boolean"
checks.
Change-Id: Iaf449b51e8182ffa0b9ed25fe688e0ff64a07a67
Tom Tromey [Fri, 13 Dec 2019 15:48:44 +0000 (08:48 -0700)]
Fix the gdb build with GCC 7
The Solaris buildbot builder complained about some recent patches of
mine. Building with GCC 7 failed.
This patch fixes the bug. I'm checking it in.
gdb/ChangeLog
2019-12-13 Tom Tromey <tromey@adacore.com>
* gdbsupport/safe-iterator.h (class basic_safe_range) <begin,
end>: No longer "const".
Change-Id: I5f428fab61087f467ac3b6475f4ef4dbd314fcb0
Simon Marchi [Fri, 13 Dec 2019 15:12:30 +0000 (10:12 -0500)]
Fix indentation in jit.c
Many places in this file use spaces only for indentation. Fix them to
conform to GNU style.
gdb/ChangeLog:
* jit.c: Fix indentation, replace spaces with tabs where
applicable.
Jozef Lawrynowicz [Fri, 13 Dec 2019 13:46:32 +0000 (13:46 +0000)]
MSP430: Relax target glob for configuring GDB
This enables support for the msp430-elfbare target being added to GCC.
gdb/ChangeLog:
2019-12-13 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* configure.tgt: Match msp430-*-elf* targets when configuring GDB.
Alan Modra [Fri, 13 Dec 2019 05:44:57 +0000 (16:14 +1030)]
Set no file contents PT_LOAD p_offset to first page
PR 25237
* elf.c (assign_file_positions_for_load_sections): Attempt to
keep meaningless p_offset for PT_LOAD segments without file
contents within file size.
GDB Administrator [Fri, 13 Dec 2019 00:00:24 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Sun, 3 Nov 2019 22:22:01 +0000 (15:22 -0700)]
Change objfile::partial_symtabs to be a unique_ptr
A plan I had a while ago was to write the DWARF index in a worker
thread. This is why objfile::partial_symtabs is a shared_ptr.
However, it turned out that doing this required keeping the objfile
alive as well. Now that objfiles are managed using shared_ptr,
there's no need for partial_symtabs to be one as well, so this patch
reverts that change.
gdb/ChangeLog
2019-12-12 Tom Tromey <tom@tromey.com>
* objfiles.h (struct objfile) <partial_symtabs>: Now a
unique_ptr.
Change-Id: I3d7831006c40d4c8f3173ba51c0c1b0a32021ae5
Tom Tromey [Sun, 3 Nov 2019 21:47:55 +0000 (14:47 -0700)]
Manage objfiles with shared_ptr
This changes objfiles to be managed using a shared_ptr. shared_ptr is
chosen because it enables the use of objfiles in background threads.
The simplest way to do this was to introduce a new iterator that will
return the underlying objfile, rather than a shared_ptr. (I also
tried changing the rest of gdb to use shared_ptr, but this was quite
large; and to using intrusive reference counting, but this also was
tricky.)
gdb/ChangeLog
2019-12-12 Tom Tromey <tom@tromey.com>
* progspace.h (objfile_list): New typedef.
(class unwrapping_objfile_iterator)
(struct unwrapping_objfile_range): Newl
(struct program_space) <objfiles_range>: Change type.
<objfiles>: Change return type.
<add_objfile>: Change type of "objfile" parameter.
<objfiles_list>: Now a list of shared_ptr.
* progspace.c (program_space::add_objfile): Change type of
"objfile". Update.
(program_space::remove_objfile): Update.
* objfiles.h (struct objfile) <~objfile>: Make public.
* objfiles.c (objfile::make): Update.
(objfile::unlink): Don't call delete.
Change-Id: I6fb7fbf06efb7cb7474c525908365863eae27eb3
Tom Tromey [Sat, 2 Nov 2019 03:02:38 +0000 (21:02 -0600)]
Move free_all_objfiles to program_space
This changes free_all_objfiles to be a method on program_space, in
line with the other changes to treat program_space as a container for
objfiles.
gdb/ChangeLog
2019-12-12 Tom Tromey <tom@tromey.com>
* symfile.c (symbol_file_clear): Update.
* progspace.h (struct program_space) <free_all_objfiles>: Declare
method.
* progspace.c (program_space::free_all_objfiles): New method.
* objfiles.h (free_all_objfiles): Don't declare.
* objfiles.c (free_all_objfiles): Move to program_space.
Change-Id: I908b549d2981b6005f7ca181fc0e6d24fc8b7b6f
Tom Tromey [Sun, 10 Mar 2019 12:56:33 +0000 (06:56 -0600)]
Store objfiles on a std::list
This removes objfile::next and changes objfiles to be stored in a
std::list.
gdb/ChangeLog
2019-12-12 Tom Tromey <tom@tromey.com>
* progspace.c (program_space::add_objfile)
(program_space::remove_objfile): Update.
(program_space::multi_objfile_p): Remove.
* objfiles.h (struct objfile) <next>: Remove.
* objfiles.c (objfile::objfile): Update.
(put_objfile_before): Update.
(unlink_objfile): Update.
* progspace.h (object_files): Remove.
(struct program_space) <objfiles_head>: Remove.
<objfiles_list>: New member.
<objfiles_range, objfiles_safe_range>: Change type.
(objfiles): Change return type.
(objfiles_safe): Update.
(multi_objfile_p): Rewrite and inline.
(object_files): Remove macro.
Change-Id: Ib4430e3db6f9a390399924379a5c10426c514853
Tom Tromey [Sun, 3 Nov 2019 17:38:36 +0000 (10:38 -0700)]
Introduce basic_safe_range
This introduces the basic_safe_range class, which can be used to
create a basic_safe_iterator. This also changes basic_safe_iterator
in two ways.
First, it simplifies the constructor. This seemed unnecessarily
complicated to me, and keeping it this way would prevent the second
change...
... which is to add a second constructor for initializing the
one-past-the-end iterator that is stored in basic_safe_iterator.
gdb/ChangeLog
2019-12-12 Tom Tromey <tom@tromey.com>
* gdbsupport/safe-iterator.h (basic_safe_iterator): Simplify. Add
second constructor.
(basic_safe_range): New class.
Change-Id: Ib351ef6fd435129a5053c64e5561877e1459ab37
Tom Tromey [Sun, 20 Jan 2019 04:33:50 +0000 (21:33 -0700)]
Remove MULTI_OBJFILE_P
This removes the MULTI_OBJFILE_P macro in favor of a method on the
program space.
gdb/ChangeLog
2019-12-12 Tom Tromey <tom@tromey.com>
* progspace.c (program_space::multi_objfile_p): New method.
* printcmd.c (info_symbol_command): Update.
* maint.c (maintenance_translate_address): Update.
* objfiles.h (MULTI_OBJFILE_P): Remove.
* progspace.h (struct program_space) <multi_objfile_p>: New
method.
Change-Id: I2779e26ea8909078d63fea8f13bce94cab73948c
Tom Tromey [Fri, 1 Nov 2019 22:42:29 +0000 (16:42 -0600)]
Introduce program_space::remove_objfile
This introduces a new method, program_space::remove_objfile, and
changes the objfile destructor not to unlink an objfile from the
program space's list.
This is cleaner because, like the previous patch, it treats the
program space more like a container for objfiles. Also, this makes it
possible to keep an objfile alive even though it has been unlinked
from the program space's list, which is important for processing in a
worker thread.
gdb/ChangeLog
2019-12-12 Tom Tromey <tom@tromey.com>
* progspace.h (struct program_space) <remove_objfile>: Declare.
* progspace.c (program_space::remove_objfile): New method.
* objfiles.c (unlink_objfile): Remove.
(objfile::unlink): Call remove_objfile.
(objfile): Don't call unlink_objfile.
Change-Id: I22f768827723dce21886fae9b3664532c8349e68
Tom Tromey [Fri, 1 Nov 2019 22:31:28 +0000 (16:31 -0600)]
Introduce program_space::add_objfile
This introduces a new method, program_space::add_objfile, that adds an
objfile to the program space's list of objfiles. It also changes the
obfile's constructor so that linking an objfile into this list is not
done here.
The former is an improvement because it makes more sense to treat the
program space as a container holding objfiles -- so manipulation of
the list belongs there.
The latter is not strictly needed, but seemed better both because it
is removing a global side effect from a constructor, and for symmetry
reasons, as a subsequent patch will remove unlinking from the
destructor.
gdb/ChangeLog
2019-12-12 Tom Tromey <tom@tromey.com>
* progspace.h (struct program_space) <add_objfile>: Declare
method.
* progspace.c (program_space::add_objfile): New method.
* objfiles.c (~objfile): Don't unlink objfile.
(put_objfile_before): Remove.
(add_separate_debug_objfile): Don't call put_objfile_before.
(objfile::make): Call add_objfile. Set new_objfiles_available on
the per-program-space data.
Change-Id: I93e8525dda631cb89dcc2046a5c51c7c9f34ccfd
Tom Tromey [Fri, 1 Nov 2019 22:21:04 +0000 (16:21 -0600)]
Make the objfile destructor private
The idea behind this is that, in the long run, some code will need to
be able to hold onto an objfile after it is unlinked from the program
space. In particular, this is needed for some functionality to be
moved to worker threads -- otherwise the objfile can be deleted while
still in use.
So, this makes ~objfile private, replacing it with an "unlink" method,
making it more obvious which operation is intended at the calling
points.
gdb/ChangeLog
2019-12-12 Tom Tromey <tom@tromey.com>
* symfile.c (syms_from_objfile_1): Use objfile_up.
(syms_from_objfile_1, remove_symbol_file_command): Call unlink
method.
(reread_symbols): Use objfile_up.
* solib.c (update_solib_list, reload_shared_libraries_1): Call
unlink method.
* objfiles.h (struct objfile) <~objfile>: Now private.
<unlink>: New method.
(struct objfile_deleter): New.
(objfile_up): New typedef.
* objfiles.c (objfile::unlink): New method.
(free_objfile_separate_debug, free_all_objfiles)
(objfile_purge_solibs): Use it.
* jit.c (jit_unregister_code): Remove.
(jit_inferior_exit_hook, jit_event_handler): Call unlink on
objfile.
* compile/compile-object-run.c (do_module_cleanup): Call unlink on
objfile.
* compile/compile-object-load.c (compile_object_load): Use
objfile_up.
Change-Id: I934bee70b26b8b24e1735828fb1e60fe8a05714f
Tom Tromey [Fri, 1 Nov 2019 22:10:48 +0000 (16:10 -0600)]
Make add_separate_debug_objfile static
This changes objfile::make to take a "parent" parameter, and makes
add_separate_debug_objfile static.
gdb/ChangeLog
2019-12-12 Tom Tromey <tom@tromey.com>
* symfile.c (symbol_file_add_with_addrs): Pass "parent" to
objfile::make.
* objfiles.h (struct objjfile) <make>: No longer inline.
(add_separate_debug_objfile): Don't declare.
* objfiles.c (add_separate_debug_objfile): Now static.
(objfile::make): Move from objfiles.h. Call
add_separate_debug_objfile. Add "parent" parameter.
Change-Id: I631f43bb71738dea6ae0697317bf8ef4a0db4617
Tom Tromey [Fri, 1 Nov 2019 22:06:37 +0000 (16:06 -0600)]
Make the objfile constructor private
This changes the objfile constructor to be private, changing the
callers to use a factory method. This isn't perhaps strictly needed
for the goal of this series -- changing the container model of
objfiles -- but is a nice symmetry.
gdb/ChangeLog
2019-12-12 Tom Tromey <tom@tromey.com>
* symfile.c (symbol_file_add_with_addrs): Use objfile::make.
* objfiles.h (struct objfile): Make constructor private.
<make>: New static method.
* jit.c (jit_object_close_impl): Update.
Change-Id: I42e07bc80a88cf3322ace94ffe869ae5788bcb29
H.J. Lu [Thu, 12 Dec 2019 20:25:48 +0000 (12:25 -0800)]
i386: Also check R12-R15 registers when optimizing testq to testb
Similar to SP, BP, SI and DI registers, R12-R15 registers must use REX
prefix for the low byte register when optimizing
test $imm7, %r64/%r32/%r16 -> test $imm7, %r8
PR gas/25274
* config/tc-i386.c (optimize_encoding): Also check R12-R15
registers for "test $imm7, %r64/%r32/%r16 -> test $imm7, %r8"
optimization.
* testsuite/gas/i386/x86-64-optimize-3.s: Add tests for test
with r12.
* testsuite/gas/i386/x86-64-optimize-3.d: Updated.
* testsuite/gas/i386/x86-64-optimize-3b.d: Likewise.
H.J. Lu [Thu, 12 Dec 2019 19:58:50 +0000 (11:58 -0800)]
i386: Add tests for -malign-branch-boundary and -malign-branch
Add tests for -malign-branch-boundary, -malign-branch and
-mbranches-within-32B-boundaries.
gas/
* testsuite/gas/i386/align-branch-1.s: New file.
* testsuite/gas/i386/align-branch-1a.d: Likewise.
* testsuite/gas/i386/align-branch-1b.d: Likewise.
* testsuite/gas/i386/align-branch-1c.d: Likewise.
* testsuite/gas/i386/align-branch-1d.d: Likewise.
* testsuite/gas/i386/align-branch-1e.d: Likewise.
* testsuite/gas/i386/align-branch-1f.d: Likewise.
* testsuite/gas/i386/align-branch-1g.d: Likewise.
* testsuite/gas/i386/align-branch-1h.d: Likewise.
* testsuite/gas/i386/align-branch-2.s: Likewise.
* testsuite/gas/i386/align-branch-2a.d: Likewise.
* testsuite/gas/i386/align-branch-2b.d: Likewise.
* testsuite/gas/i386/align-branch-2c.d: Likewise.
* testsuite/gas/i386/align-branch-3.d: Likewise.
* testsuite/gas/i386/align-branch-3.s: Likewise.
* testsuite/gas/i386/align-branch-4.s: Likewise.
* testsuite/gas/i386/align-branch-4a.d: Likewise.
* testsuite/gas/i386/align-branch-4b.d: Likewise.
* testsuite/gas/i386/align-branch-5.d: Likewise.
* testsuite/gas/i386/align-branch-5.s: Likewise.
* testsuite/gas/i386/align-branch-6.d: Likewise.
* testsuite/gas/i386/align-branch-6.s: Likewise.
* testsuite/gas/i386/align-branch-7.d: Likewise.
* testsuite/gas/i386/align-branch-7.s: Likewise.
* testsuite/gas/i386/align-branch-8.d: Likewise.
* testsuite/gas/i386/align-branch-8.s: Likewise.
* testsuite/gas/i386/x86-64-align-branch-1.s: Likewise.
* testsuite/gas/i386/x86-64-align-branch-1a.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-1b.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-1c.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-1d.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-1e.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-1f.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-1g.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-1h.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-2.s: Likewise.
* testsuite/gas/i386/x86-64-align-branch-2a.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-2b.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-2c.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-3.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-3.s: Likewise.
* testsuite/gas/i386/x86-64-align-branch-4.s: Likewise.
* testsuite/gas/i386/x86-64-align-branch-4a.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-4b.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-5.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-6.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-7.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-7.s: Likewise.
* testsuite/gas/i386/x86-64-align-branch-8.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-8.s: Likewise.
* testsuite/gas/i386/i386.exp: Run new tests.
ld/
* testsuite/ld-i386/align-branch-1.d: New file.
* testsuite/ld-i386/align-branch-1.s: Likewise.
* testsuite/ld-x86-64/align-branch-1.d: Likewise.
* testsuite/ld-x86-64/align-branch-1.3: Likewise.
* testsuite/ld-i386/i386.exp: Run the new test.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
H.J. Lu [Thu, 12 Dec 2019 19:57:03 +0000 (11:57 -0800)]
i386: Add -mbranches-within-32B-boundaries
Add -mbranches-within-32B-boundaries to enable
-malign-branch-boundary=32
-malign-branch=jcc+fused+jmp
-malign-branch-prefix-size=5
* config/tc-i386.c (OPTION_MBRANCHES_WITH_32B_BOUNDARIES): New.
(md_longopts): Add -mbranches-within-32B-boundaries.
(md_parse_option): Handle -mbranches-within-32B-boundaries.
(md_show_usage): Add -mbranches-within-32B-boundaries.
H.J. Lu [Thu, 12 Dec 2019 19:56:06 +0000 (11:56 -0800)]
i386: Align branches within a fixed boundary
Add 3 command-line options to align branches within a fixed boundary
with segment prefixes or NOPs:
1. -malign-branch-boundary=NUM aligns branches within NUM byte boundary.
2. -malign-branch=TYPE[+TYPE...] specifies types of branches to align.
The supported branches are:
a. Conditional jump.
b. Fused conditional jump.
c. Unconditional jump.
d. Call.
e. Ret.
f. Indirect jump and call.
3. -malign-branch-prefix-size=NUM aligns branches with NUM segment
prefixes per instruction.
3 new rs_machine_dependent frag types are added:
1. BRANCH_PADDING. The variable size frag to insert NOP before branch.
2. BRANCH_PREFIX. The variable size frag to insert segment prefixes to
an instruction. The choices of prefixes are:
a. Use the existing segment prefix if there is one.
b. Use CS segment prefix in 64-bit mode.
c. In 32-bit mode, use SS segment prefix with ESP/EBP base register
and use DS segment prefix without ESP/EBP base register.
3. FUSED_JCC_PADDING. The variable size frag to insert NOP before fused
conditional jump.
The new rs_machine_dependent frags aren't inserted if the previous item
is a prefix or a constant directive, which may be used to hardcode an
instruction, since there is no clear instruction boundary. Segment
prefixes and NOP padding are disabled before relaxable TLS relocations
and tls_get_addr calls to keep TLS instruction sequence unchanged.
md_estimate_size_before_relax() and i386_generic_table_relax_frag() are
used to handled BRANCH_PADDING, BRANCH_PREFIX and FUSED_JCC_PADDING frags.
i386_generic_table_relax_frag() grows or shrinks sizes of segment prefix
and NOP to align the next branch frag:
1. First try to add segment prefixes to instructions before a branch.
2. If there is no sufficient room to add segment prefixes, NOP will be
inserted before a branch.
* config/tc-i386.c (_i386_insn): Add has_gotpc_tls_reloc.
(tls_get_addr): New.
(last_insn): New.
(align_branch_power): New.
(align_branch_kind): New.
(align_branch_bit): New.
(align_branch): New.
(MAX_FUSED_JCC_PADDING_SIZE): New.
(align_branch_prefix_size): New.
(BRANCH_PADDING): New.
(BRANCH_PREFIX): New.
(FUSED_JCC_PADDING): New.
(i386_generate_nops): Support BRANCH_PADDING and FUSED_JCC_PADDING.
(md_begin): Abort if align_branch_prefix_size <
MAX_FUSED_JCC_PADDING_SIZE.
(md_assemble): Set last_insn.
(maybe_fused_with_jcc_p): New.
(add_fused_jcc_padding_frag_p): New.
(add_branch_prefix_frag_p): New.
(add_branch_padding_frag_p): New.
(output_insn): Generate a BRANCH_PADDING, FUSED_JCC_PADDING or
BRANCH_PREFIX frag and terminate each frag to align branches.
(output_disp): Set i.has_gotpc_tls_reloc to TRUE for GOTPC and
relaxable TLS relocations.
(output_imm): Likewise.
(i386_next_non_empty_frag): New.
(i386_next_jcc_frag): New.
(i386_classify_machine_dependent_frag): New.
(i386_branch_padding_size): New.
(i386_generic_table_relax_frag): New.
(md_estimate_size_before_relax): Handle COND_JUMP_PADDING,
FUSED_JCC_PADDING and COND_JUMP_PREFIX frags.
(md_convert_frag): Handle BRANCH_PADDING, BRANCH_PREFIX and
FUSED_JCC_PADDING frags.
(OPTION_MALIGN_BRANCH_BOUNDARY): New.
(OPTION_MALIGN_BRANCH_PREFIX_SIZE): New.
(OPTION_MALIGN_BRANCH): New.
(md_longopts): Add -malign-branch-boundary=,
-malign-branch-prefix-size= and -malign-branch=.
(md_parse_option): Handle -malign-branch-boundary=,
-malign-branch-prefix-size= and -malign-branch=.
(md_show_usage): Display -malign-branch-boundary=,
-malign-branch-prefix-size= and -malign-branch=.
(i386_target_format): Set tls_get_addr.
(i386_cons_align): New.
* config/tc-i386.h (i386_cons_align): New.
(md_cons_align): New.
(i386_generic_table_relax_frag): New.
(md_generic_table_relax_frag): New.
(i386_tc_frag_data): Add u, padding_address, length,
max_prefix_length, prefix_length, default_prefix, cmp_size,
classified and branch_type.
(TC_FRAG_INIT): Initialize u, padding_address, length,
max_prefix_length, prefix_length, default_prefix, cmp_size,
classified and branch_type.
* doc/c-i386.texi: Document -malign-branch-boundary=,
-malign-branch= and -malign-branch-prefix-size=.
H.J. Lu [Thu, 12 Dec 2019 19:54:31 +0000 (11:54 -0800)]
gas: Add md_generic_table_relax_frag
Add md_generic_table_relax_frag for TC_GENERIC_RELAX_TABLE targets so
that a backend can extend relax_frag beyond TC_GENERIC_RELAX_TABLE.
* write.c (md_generic_table_relax_frag): New. Defined to
relax_frag if not defined.
(relax_segment): Call md_generic_table_relax_frag instead of
relax_frag.
Simon Marchi [Thu, 12 Dec 2019 19:54:47 +0000 (14:54 -0500)]
Replace xmalloc/xfree with vector in jit.c
I'm currently studying that code and noticed this manual memory
management, which could easily be replaced with a vector, so here it is.
gdb/ChangeLog:
* jit.c (jit_reader_try_read_symtab): Replace xmalloc/xfree with
gdb::byte_vector.
Tom Tromey [Tue, 10 Dec 2019 18:19:23 +0000 (11:19 -0700)]
Remove some calls to malloc_failure
I noticed a couple of spots that call malloc_failure, but that don't
need to.
* In xml-support.c, "concat" uses xmalloc, so cannot return NULL.
* In utils.c, "buildargv" also uses xmalloc, so can only return NULL
if the argument is empty.
Tested by the buildbot.
gdb/ChangeLog
2019-12-12 Tom Tromey <tromey@adacore.com>
* xml-support.c (xml_fetch_content_from_file): Don't call
malloc_failure.
* utils.h (class gdb_argv): Remove malloc_failure comment.
* utils.c (gdb_argv::reset): Don't call malloc_failure.
Change-Id: I59483620deb6609ccf2f024d94a29113bb62d1a9
Tom Tromey [Fri, 19 Apr 2019 16:41:40 +0000 (10:41 -0600)]
Ravenscar port for RISC-V
This adds Ravenscar support to gdb for RISC-V targets.
This was tested internally using AdaCore's test suite and qemu.
gdb/ChangeLog
2019-12-12 Tom Tromey <tromey@adacore.com>
* Makefile.in (ALL_TARGET_OBS): Add riscv-ravenscar-thread.o.
(HFILES_NO_SRCDIR): Add riscv-ravenscar-thread.h.
(ALLDEPFILES): Add riscv-ravenscar-thread.c.
* configure.tgt (riscv-*-*): Add riscv-ravenscar-thread.o.
* riscv-ravenscar-thread.c: New file.
* riscv-ravenscar-thread.h: New file.
* riscv-tdep.c (riscv_gdbarch_init): Call
register_riscv_ravenscar_ops.
Change-Id: Ic47a3b3cfbbe80c2c82a5f48d2e0481845cac8b0
Tom Tromey [Thu, 12 Dec 2019 13:09:40 +0000 (06:09 -0700)]
Fix the thread-pool.c compilation
A recent commit removed DIAGNOSTIC_IGNORE_UNUSED_FUNCTION, which was
used in thread-pool.c. This patch changes this code to use
ATTRIBUTE_UNUSED instead.
Tested by rebuilding.
gdb/ChangeLog
2019-12-12 Tom Tromey <tromey@adacore.com>
* gdbsupport/thread-pool.c (set_thread_name): Use
ATTRIBUTE_UNUSED.
Change-Id: I56d46eaac73690565d0e52db1791411567a918dd
Luis Machado [Wed, 11 Dec 2019 14:55:49 +0000 (11:55 -0300)]
Fix unused function error
Attempting to build GDB in Ubuntu 16.04.6 LTS on x86_64, I ran into warnings
that caused the build to fail:
binutils-gdb/gdb/gdbsupport/safe-strerror.c:44:1: error: ‘char* select_strerror_r(char*, char*)’ defined but not used [-Werror=unused-function] select_strerror_r (char *res, char *)
The diagnostic macro DIAGNOSTIC_IGNORE_UNUSED_FUNCTION seems to expand
correctly to its respective pragma, but this doesn't seem to have an effect on
the warning. I tried to use the pragma explicitly and got the same result.
ATTRIBUTE_UNUSED works fine in this case if you put it in both functions,
which should fix warnings for both gdb and gdbserver builds.
The compiler version is gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0
20160609.
This is likely the result of PR64079 in GCC, which was fixed by commit
9e96f1e1b9731c4e1ef4fbbbf0997319973f0537.
To prevent other developers from attempting to use this macro, only to get
confused by it not working as expected, it seems better to not define this
particular macro.
gdb/ChangeLog:
2019-12-12 Luis Machado <luis.machado@linaro.org>
* gdbsupport/safe-strerror.c: Don't include diagnostics.h.
(select_strerror_r): Use ATTRIBUTE_UNUSED instead of the diagnostics
macros.
include/ChangeLog:
2019-12-12 Luis Machado <luis.machado@linaro.org>
* diagnostics.h (DIAGNOSTIC_IGNORE_UNUSED_FUNCTION). Remove
definitions.
Change-Id: Iad6123d61d76d111e3ef8d24aa8c60112304c749
Alan Modra [Wed, 11 Dec 2019 22:59:45 +0000 (09:29 +1030)]
gas signed overflow fixes
* config/tc-aarch64.c (get_aarch64_insn): Avoid signed overflow.
* config/tc-metag.c (parse_dalu): Likewise.
* config/tc-tic4x.c (md_pcrel_from): Likewise.
* config/tc-tic6x.c (tic6x_output_unwinding): Likewise.
* config/tc-csky.c (parse_fexp): Use an unsigned char temp buffer.
Don't use register keyword. Avoid signed overflow and remove now
unneccesary char masks. Formatting.
* config/tc-ia64.c (operand_match): Don't use shifts to sign extend.
* config/tc-mep.c (mep_apply_fix): Likewise.
* config/tc-pru.c (md_apply_fix): Likewise.
* config/tc-riscv.c (load_const): Likewise.
* config/tc-nios2.c (md_apply_fix): Likewise. Don't potentially
truncate fixup before right shift. Tidy BFD_RELOC_NIOS2_HIADJ16
calculation.
Alan Modra [Thu, 12 Dec 2019 06:17:21 +0000 (16:47 +1030)]
obj-evax.c tidy
This started out as fixing decode_16, which used a char to index a 256
byte decodings array. When char is signed that could result in an out
of bounds array access. The rest of the patch is for consistency and
just general cleanup.
* config/obj-evax.c (crc32, encode_32, encode_16, decode_16):
Remove unnecessary prototypes.
(number_of_codings): Delete, use ARRAY_SIZE instead throughout.
(codings, decodings): Make arrays of unsigned char.
(crc32): Use unsigned variables. Delete unnecessary mask.
(encode_32, encode_16): Return unsigned char*, and make static
buffer an unsigned char array.
(decode_16): Make arg an unsigned char*. Remove useless casts.
(shorten_identifier): Use unsigned char crc_chars.
(is_truncated_identifier): Make ptr an unsigned char*.
Alan Modra [Thu, 12 Dec 2019 06:14:24 +0000 (16:44 +1030)]
csky: tidy csky_chars_to_number
* csky-dis.c (csky_chars_to_number): Remove abort and unnecessary
mask.
Alan Modra [Thu, 12 Dec 2019 03:50:07 +0000 (14:20 +1030)]
Remove duplicate cast
* libbfd.c (bfd_get): Don't cast result of bfd_get_8.
* bfd-in2.h: Regenerate.
Tom Tromey [Thu, 12 Dec 2019 02:17:47 +0000 (19:17 -0700)]
Fix TUI test suite regexps
Testing on another TUI series showed that some of the regexps in the
TUI test suite have been incorrect for a while. In particular, "|"
was meant literally in these tests, but was interpreted as pattern
alternation due to lack of quoting.
This patch fixes the bad tests. I am checking this in.
gdb/testsuite/ChangeLog
2019-12-11 Tom Tromey <tom@tromey.com>
* gdb.tui/resize.exp: Fix regexp.
* gdb.tui/regs.exp: Fix regexps.
* gdb.tui/main.exp: Fix regexp.
Change-Id: Ib6661361171ac120bb92f4a8aec7efa4bcaa36b9
GDB Administrator [Thu, 12 Dec 2019 00:00:15 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Sat, 26 Oct 2019 22:37:32 +0000 (16:37 -0600)]
Change "winheight" resizing to use new layout code
The "winheight" command resizes a specified window, resizing the other
windows in the layout to adapt. In the current code, this is done by
examining each possible layout separately. The new layout code has a
more general approach to handling this, and this patch simply removes
the old code in favor of a call into the new layout engine.
gdb/ChangeLog
2019-12-11 Tom Tromey <tom@tromey.com>
* tui/tui-win.c (tui_set_win_height_command): Call
tui_adjust_window_height.
(tui_adjust_win_heights, new_height_ok): Remove.
* tui/tui-layout.h (tui_adjust_window_height): Declare.
* tui/tui-layout.c (tui_adjust_window_height): New function.
Change-Id: I6bb681375a46adc8d29fd06f581deed4e078e78a
Tom Tromey [Thu, 10 Oct 2019 03:18:31 +0000 (21:18 -0600)]
Re-apply the current layout when resizing
The TUI has separate code for each possible layout to handle the case
where the terminal window is resized. With the new layout code, this
can all be replaced with a call to tui_apply_current_layout, which
simply re-applies the current layout.
This results in some small differences in behavior when resizing, so
some tests are updated.
gdb/ChangeLog
2019-12-11 Tom Tromey <tom@tromey.com>
* tui/tui-win.c (tui_resize_all): Remove code, call
tui_apply_current_layout.
gdb/testsuite/ChangeLog
2019-12-11 Tom Tromey <tom@tromey.com>
* gdb.tui/resize.exp: Update.
* gdb.tui/empty.exp (layouts): Update.
Change-Id: I3dc6c02a753d495d9ab5e8213d550a147198ce6f
Tom Tromey [Wed, 9 Oct 2019 22:35:41 +0000 (16:35 -0600)]
First use of tui_layout
This patch introduces the first use of tui_layout, by changing
show_layout to clone and use the appropriate tui_layout.
This resulted in one minor layout change, and also in the unintended
-- but good -- side effect that the title of each boxed window is now
visible.
gdb/ChangeLog
2019-12-11 Tom Tromey <tom@tromey.com>
* tui/tui-layout.h (tui_apply_current_layout): Declare.
* tui/tui-layout.c (standard_layouts, applied_layout): New
globals.
(tui_apply_current_layout): New function.
(show_layout): Set applied_layout. Call
tui_apply_current_layout.
(show_source_command, show_disasm_command)
(show_source_disasm_command, show_data)
(show_source_or_disasm_and_command): Remove.
(initialize_layouts): New function.
(_initialize_tui_layout): Call initialize_layouts.
gdb/testsuite/ChangeLog
2019-12-11 Tom Tromey <tom@tromey.com>
* gdb.tui/regs.exp: Update.
* gdb.tui/empty.exp (layouts): Update.
* gdb.tui/basic.exp: Update.
* lib/tuiterm.exp (_check_box): Don't check bottom border.
Change-Id: If1ee06ee58f4803e8c213f4ab0f5bb59f4650ec2
Tom Tromey [Tue, 8 Oct 2019 00:03:02 +0000 (18:03 -0600)]
Introduce new layout code
This introduces a new approach to window layout for the TUI. The idea
behind this code is that a layout should be specified in a declarative
way, and then be applied by generic code that does not need to know
the specifics of every possible layout.
This patch itself does not change any behavior, because the new layout
engine isn't yet connected to anything. That is, this merely
introduces the implementation.
This generic approach makes the code more maintainable. It also
enables some future changes:
* New window types are simpler to add;
* User-specified layouts are possible; and
* Horizontal layouts are more attainable
gdb/ChangeLog
2019-12-11 Tom Tromey <tom@tromey.com>
* tui/tui-layout.h (class tui_layout_base)
(class tui_layout_window, class tui_layout_split): New.
* tui/tui-layout.c (tui_get_window_by_name)
(tui_layout_window::clone, tui_layout_window::apply)
(tui_layout_window::get_sizes, tui_layout_window::add_split)
(tui_layout_split::add_window, tui_layout_split::clone)
(tui_layout_split::get_sizes)
(tui_layout_split::set_weights_from_heights)
(tui_layout_split::adjust_size, tui_layout_split::apply): New
functions.
(tui_layout_split::add_split, tui_layout_split::add_split)
(tui_layout_split::set_weights_from_heights)
(tui_layout_split::set_weights_from_heights): New functions.
Change-Id: I3a4cae666327b617d862aaa356f8179f945c6a4e
Tom Tromey [Sat, 26 Oct 2019 22:00:01 +0000 (16:00 -0600)]
Remove struct tui_point
struct tui_point does not help very much. It is only used for
storage, and never passed between functions. I think it makes the
code more verbose without any corresponding benefit, so this patch
removes it.
gdb/ChangeLog
2019-12-11 Tom Tromey <tom@tromey.com>
* tui/tui-wingeneral.c (tui_gen_win_info::make_window): Update.
* tui/tui-win.c (tui_adjust_win_heights, tui_resize_all): Update.
* tui/tui-layout.c (tui_gen_win_info::resize): Update.
* tui/tui-data.h (struct tui_point): Remove.
(struct tui_gen_win_info) <origin>: Remove.
<x, y>: New fields.
* tui/tui-command.c (tui_cmd_window::resize): Update.
Change-Id: I3f77920585b9ea9e2b4b189f3f3ae32d4da0c252
Tom Tromey [Mon, 7 Oct 2019 23:36:49 +0000 (17:36 -0600)]
Introduce the tui_gen_win_info::min_height method
This introduces a new method, tui_gen_win_info::min_height, to fetch
the minimum height of a window. This is used in the subsequent
unified layout patch.
gdb/ChangeLog
2019-12-11 Tom Tromey <tom@tromey.com>
* tui/tui-stack.h (struct tui_locator_window) <min_height>:
Implement.
* tui/tui-regs.h (struct tui_data_item_window) <min_height>:
Implement.
* tui/tui-data.h (struct tui_gen_win_info) <min_height>: New
method.
(struct tui_win_info) <min_height>: Implement.
Change-Id: Id33baffdf041fde072e15c1ff89b75f8b8118adb
Tom Tromey [Wed, 6 Nov 2019 00:12:04 +0000 (17:12 -0700)]
Move can_box to tui_gen_win_info
This moves the can_box method to tui_gen_win_info, so that it will be
available on the tui_locator_window class. This will be used in a
subsequent patch.
gdb/ChangeLog
2019-12-11 Tom Tromey <tom@tromey.com>
* tui/tui-data.h (struct tui_gen_win_info) <can_box>: New method.
(struct tui_win_info) <can_box>: Update.
Change-Id: Idfa58af41341607932d3c39415f6a35ee9b5d3dc
Tom Tromey [Mon, 7 Oct 2019 22:59:02 +0000 (16:59 -0600)]
Move max_height method to tui_gen_win_info
This moves the max_height method to tui_gen_win_info and implements it
in the subclasses. This is used by a subsequent patch, which will
normalize window layout across all window types.
gdb/ChangeLog
2019-12-11 Tom Tromey <tom@tromey.com>
* tui/tui-stack.h (struct tui_locator_window) <max_height>: New
method.
* tui/tui-regs.h (struct tui_data_item_window) <max_height>: New
method.
* tui/tui-data.h (struct tui_gen_win_info) <max_height>: New
method.
(struct tui_win_info) <max_height>: Now override.
Change-Id: I4ba3e8899bc4668328d3d78e3c1674c61882450d
Joel Brobecker [Wed, 11 Dec 2019 20:44:47 +0000 (21:44 +0100)]
Update NEWS post GDB 9 branch creation.
gdb/ChangeLog:
* NEWS: Create a new section for the next release branch.
Rename the section of the current branch, now that it has
been cut.
Joel Brobecker [Wed, 11 Dec 2019 20:37:51 +0000 (21:37 +0100)]
Bump version to 10.0.50.DATE-git.
Now that the GDB 9 branch has been created, we can
bump the version number.
gdb/ChangeLog:
GDB 9 branch created (
27f7b2f64062ac9e52afc60509263c2702a9ebd0):
* version.in: Bump version to 10.0.50.DATE-git.
Simon Marchi [Wed, 11 Dec 2019 16:30:15 +0000 (11:30 -0500)]
Fix typo, get_Frame_id -> get_frame_id
gdb/doc/ChangeLog:
* gdb.texinfo (Writing JIT Debug Info Readers): Fix typo.
Andre Vieira [Wed, 11 Dec 2019 15:53:26 +0000 (15:53 +0000)]
[gas][arm] Add -mwarn-restrict-it
Add a -m{no-}warn-restrict-it option to control IT related warnings in
ARMv8-A and ARMv8-R. This is disabled by default.
Committed on behalf of Wilco Dijkstra.
gas/ChangeLog:
2019-12-11 Wilco Dijkstra <wdijkstr@arm.com>
* config/tc-arm.c (warn_on_restrict_it): Add new variable.
(it_fsm_post_encode): Check warn_on_restrict_it.
(arm_option_table): Add -mwarn-restrict-it/-mno-warn-restrict-it.
* testsuite/gas/arm/armv8-2-fp16-scalar-bad.d: Add -mwarn-restrict-it.
* testsuite/gas/arm/armv8-2-fp16-scalar-bad-ext.d: Likewise.
* testsuite/gas/arm/armv8-a-bad.d: Likewise.
* testsuite/gas/arm/armv8-a-it-bad.d: Likewise.
* testsuite/gas/arm/armv8-r-bad.d: Likewise.
* testsuite/gas/arm/armv8-r-it-bad.d: Likewise.
* testsuite/gas/arm/sp-pc-validations-bad-t-v8a.d: Likewise.
* testsuite/gas/arm/udf.d: Likewise.
Tom Tromey [Tue, 10 Dec 2019 21:16:19 +0000 (14:16 -0700)]
Fix build on macOS
PR build/25268 points out that the build fails on macOS, because on
macOS the "pthread_setname_np" function takes a single argument.
This patch fixes the problem, by introducing a new adapter function
that handles both styles of pthread_setname_np.
This change also meant moving the pthread_setname_np call to the
thread function, because macOS only permits setting the name of the
current thread. This means that there can be a brief window when gdb
will see the wrong name; but I think this is a minor concern.
Tested by rebuilding on x86-64 Fedora 30, and on macOS High Sierra.
On Linux I also debugged gdb to ensure that the thread names are still
set correctly.
gdb/ChangeLog
2019-12-11 Tom Tromey <tromey@adacore.com>
PR build/25268:
* gdbsupport/thread-pool.c (set_thread_name): New function.
(thread_pool::set_thread_count): Don't call pthread_setname_np.
(thread_pool::thread_function): Call set_thread_name.
Change-Id: Id7bf28d99ca27a893a9fc87ebb90b15a9c2a9cb4
Tom Tromey [Wed, 11 Dec 2019 14:58:46 +0000 (07:58 -0700)]
Fix the build after bfd_get_signed_8 change
A recent commit changed bfd_get_signed_8 to extend the result to a
bfd_signed_vma. This caused a compiler error in one spot in my
--enable-targets=all gdb build, where the result of bfd_get_signed_8
was passed to printf.
This patch fixes the build. Tested by rebuilding.
gdb/ChangeLog
2019-12-11 Tom Tromey <tromey@adacore.com>
* fbsd-tdep.c (fbsd_core_info_proc_status): Cast result of
bfd_get_signed_8.
Change-Id: Ic015f5fd3d88da6b5da8f7b4e1d11d5c981333db
Alan Modra [Wed, 11 Dec 2019 06:15:14 +0000 (16:45 +1030)]
Remove more shifts for sign/zero extension
cpu/
* epiphany.cpu (f-sdisp11): Don't sign extend with shifts.
* lm32.cpu (f-branch, f-vall): Likewise.
* m32.cpu (f-lab-8-16): Likewise.
opcodes/
* arc-dis.c (BITS): Don't truncate high bits with shifts.
* nios2-dis.c (nios2_print_insn_arg): Don't sign extend with shifts.
* tic54x-dis.c (print_instruction): Likewise.
* tilegx-opc.c (parse_insn_tilegx): Likewise.
* tilepro-opc.c (parse_insn_tilepro): Likewise.
* visium-dis.c (disassem_class0): Likewise.
* pdp11-dis.c (sign_extend): Likewise.
(SIGN_BITS): Delete.
* epiphany-ibld.c: Regenerate.
* lm32-ibld.c: Regenerate.
* m32c-ibld.c: Regenerate.
Alan Modra [Wed, 11 Dec 2019 03:02:25 +0000 (13:32 +1030)]
bfd signed overflow fixes
Aimed at quietening ubsan.
include/
* opcode/mmix.h (PUSHGO_INSN_BYTE): Make unsigned.
(GO_INSN_BYTE, SETL_INSN_BYTE, INCML_INSN_BYTE, INCMH_INSN_BYTE),
(INCH_INSN_BYTE, SWYM_INSN_BYTE, JMP_INSN_BYTE): Likewise.
bfd/
* elf32-rx.c (elf32_rx_relax_section): Avoid signed overflow.
* libaout.h (N_SET_INFO, N_SET_FLAGS): Likewise.
* netbsd.h (write_object_contents): Likewise.
* elf32-arm.c (bfd_elf32_arm_vfp11_erratum_scan): Likewise.
* libhppa.h (HPPA_R_CONSTANT): Don't signed extend with shifts.
(stm32l4xx_create_replacing_stub_vldm): Don't truncate high bits
with shifts.
* elf32-nds32.h (R_NDS32_RELAX_ENTRY_DISABLE_RELAX_FLAG): Define
using 1u shifted left. Ditto for other macros.
* mmo.c (LOP): Make unsigned.
Alan Modra [Wed, 11 Dec 2019 10:36:17 +0000 (21:06 +1030)]
Make bfd_get_8 return a bfd_vma like other bfd_get_* functions
And similarly for bfd_get_signed_8.
bfd/
* libbfd.c (bfd_get_8): Return a bfd_vma.
(bfd_get_signed_8): Return a bfd_signed_vma.
* bfd-in2.h: Regenerate.
binutils/
* od-xcoff.c (dump_dumpx_core): Adjust for bfd_h_get_8 change.
Jan Beulich [Wed, 11 Dec 2019 08:42:29 +0000 (09:42 +0100)]
x86: further refine SSE check (SSE4a, SHA, GFNI)
In ("x86: extend SSE check to PCLMULQDQ, AES, and GFNI insns") I went
both a little too far and not quite far enough:
- GFNI insns also have AVX512 variants, which also shouldn't get
diagnosed,
- SSE4a insns should get diagnosed just like SSE4.x ones,
- SHA insns should get diagnosed just like PCLMULQDQ or AES ones.
Philippe Waroquiers [Wed, 7 Aug 2019 18:50:54 +0000 (20:50 +0200)]
Implement 'print -raw-values' and 'set print raw-values on|off'
The option framework documentation was speaking about a 'print -raw'
option, but this option does not exist.
This patch implements -raw-values option that tells to ignore the
active pretty printers when printing a value.
As we already have -raw-frame-arguments, I thought -raw-values
was more clear, in particular to differentiate
set print raw-values and set print raw-frame-arguments.
gdb/doc/ChangeLog
2019-12-11 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.texinfo (Command Options): Use -p and -pretty in the example,
as -r is ambiguous. Update the print - TAB TAB completion result.
(Data): Document new option -raw-values. Use -p and -pretty in the
example, as -r is ambiguous.
(Print Settings): Document set print raw values.
(Pretty-Printer Commands): Document interaction between enabled
pretty printers and -raw-values/-raw-frame-arguments.
gdb/ChangeLog
2019-12-11 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* NEWS: Document -raw-values option and the related setting commands.
* printcmd.c (print_command_parse_format): Do not set opts->raw off,
only set it on when /r is given.
* valprint.c (value_print_option_defs): New element raw-values.
* Makefile.in: Add the new file.
gdb/testsuite/ChangeLog
2019-12-11 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.base/options.exp: Add -raw-values in the print completion list.
* gdb.python/py-prettyprint.exp: Add tests for -raw-values.
Alan Modra [Wed, 11 Dec 2019 02:41:07 +0000 (13:11 +1030)]
Re: ubsan: ns32k: left shift cannot be represented in type
* ns32k-dis.c (sign_extend): Correct last patch.
Alan Modra [Tue, 10 Dec 2019 22:27:45 +0000 (08:57 +1030)]
ubsan: vax: left shift cannot be represented in type 'int'
* vax-dis.c (NEXTLONG): Avoid signed overflow.
Alan Modra [Tue, 10 Dec 2019 22:23:50 +0000 (08:53 +1030)]
ubsan: v850: left shift cannot be represented in type 'long'
* v850-dis.c (get_operand_value): Use unsigned arithmetic. Don't
sign extend using shifts.
Alan Modra [Tue, 10 Dec 2019 22:22:22 +0000 (08:52 +1030)]
ubsan: tic6x: shift left of int
* tic6x-dis.c (tic6x_extract_32): Avoid signed overflow.
Alan Modra [Tue, 10 Dec 2019 22:17:35 +0000 (08:47 +1030)]
ubsan: tic4x: segv and signed shifts
* tic4x-dis.c (tic4x_print_register): Formatting. Don't segfault
on NULL registertable entry.
(tic4x_hash_opcode): Use unsigned arithmetic.
Alan Modra [Tue, 10 Dec 2019 22:07:53 +0000 (08:37 +1030)]
ubsan: s12z: left shift cannot be represented in type 'int'
* s12z-opc.c (z_decode_signed_value): Avoid signed overflow.
Alan Modra [Tue, 10 Dec 2019 22:04:57 +0000 (08:34 +1030)]
ubsan: ns32k: left shift cannot be represented in type 'int'
* ns32k-dis.c (bit_extract): Use unsigned arithmetic.
(bit_extract_simple, sign_extend): Likewise.
Alan Modra [Tue, 10 Dec 2019 22:02:18 +0000 (08:32 +1030)]
ubsan: nios2: left shift cannot be represented in type 'int'
* nios2-dis.c (nios2_print_insn_arg): Use 1u << 31.
Alan Modra [Tue, 10 Dec 2019 21:56:58 +0000 (08:26 +1030)]
ubsan: moxie: left shift of negative value
* moxie-dis.c (INST2OFFSET): Don't sign extend using shifts.