* dwarf2read.c (build_type_psymtabs_1): Renamed from
build_type_unit_groups and moved closer to only caller. Remove
arguments. All references updated. Remove outdated .gdb_index
comment.
(struct tu_abbrev_offset, sort_tu_by_abbrev_offset): Move with
build_type_psymtabs_1.
I'm checking this in as obvious.
I was looking at instances of "alloc.*sizeof" and noticed a couple
where the types in question are incorrect.
In gdbtypes, the code allocates sizeof(int) to represent a struct rank.
In mi-cmds, the code uses "struct mi_cmd **" -- one "*" too many.
In both cases the problems are latent because in practice the sizes
are the same as the sizes of the correct types. Still, it's better to
be correct.
I think gdb would be improved by a wholesale change from explicit
sizeofs to using the libiberty.h allocation macros. In most cases
they are both shorter and have better type safety. However, the
resulting patch is rather large.
Built and regtested on x86-64 Fedora 20.
2014-05-19 Tom Tromey <tromey@redhat.com>
* gdbtypes.c (rank_function): Use XNEWVEC.
* mi/mi-cmds.c (build_table): Use XCNEWVEC.
gdbserver makes libthread_db to access uninitialized memory. Surprisingly it
does not harm normally, even -fsanitize=address works with current gdbserver.
I have found just valgrind detects it as a very first warning for gdbserver:
Syscall param ptrace(addr) contains uninitialised byte(s)
at 0x3721EECEBE: ptrace (ptrace.c:45)
by 0x436EE5: ps_get_thread_area (linux-x86-low.c:252)
by 0x5559D02: __td_ta_lookup_th_unique (td_ta_map_lwp2thr.c:157)
by 0x5559EC3: td_ta_map_lwp2thr (td_ta_map_lwp2thr.c:207)
by 0x43F87D: find_one_thread (thread-db.c:281)
by 0x440038: thread_db_get_tls_address (thread-db.c:505)
by 0x40F6D0: handle_query (server.c:2004)
by 0x4124CF: process_serial_event (server.c:3445)
by 0x4136B6: handle_serial_event (server.c:3889)
by 0x419571: handle_file_event (event-loop.c:434)
by 0x418D38: process_event (event-loop.c:189)
by 0x419AB7: start_event_loop (event-loop.c:552)
Reproducible with:
cd gdb/testsuite
g++ -o gdb.threads/tls gdb.threads/tls{,2}.c -m32 -pthread
../gdbserver/gdbserver :1234 gdb.threads/tls
../gdb -batch gdb.threads/tls -ex 'target remote :1234' -ex 'b spin' -ex c -ex 'p a_thread_local'
It is more easily reproducible even without valgrind using s/0x00/0xff/ in the
attached patch. It will then turn the output of reproducer above:
$1 = 0
->
Cannot find thread-local storage for Thread 29044, executable file .../gdb/testsuite/gdb.threads/tls:
Remote target failed to process qGetTLSAddr request
gdb/gdbserver/
2014-05-19 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix gdbserver qGetTLSAddr for x86_64 -m32.
* linux-x86-low.c (X86_64_USER_REGS): New.
(x86_fill_gregset): Call memset for BUF first in x86_64 -m32 case.
Message-ID: <20140410114901.GA16411@host2.jankratochvil.net>
* ld-elf/shared.exp: Introduce the extralibs variable to control
the libraries to be linked. Don't link -ldl on *-*-freebsd*.
* ld-bootstrap/bootstrap.exp: Do not add -ldl to the extralibs on
*-*-freebsd*.
handle a ctoff() pseudo-op when running in RH850 ABI mode.
PR gas/16946
* config/tc-v850.c (handle_ctoff): Generate an error if called
when using the RH850 ABI.
original patches were posted:
pe/coff: Display GUID build-id in the conventional way
pe/coff: Don't interpret debug directory in section with no contents
pe/coff: Keep .build-id with --only-keep-debug
pe/coff: Don't break .build-id with objcopy/strip
* peXXigen.c (pe_print_debugdata): Don't interpret debug directory
in a section with no contents.
(is_vma_in_section, find_section_by_vma): New functions.
(_bfd_XX_bfd_copy_private_bfd_data_common): Recalculate file
offsets in the debug directory.
(_bfd_XXi_slurp_codeview_record, _bfd_XXi_write_codeview_record):
Byte-swap GUID from little-endian to big-endian order for
consistent and conventional display.
* objcopy.c (is_nondebug_keep_contents_section): New function.
(setup_section): Use it.
or 64-bit doubles. It also makes the linker complain if the user attempts
to link together binaries with different sized doubles.
* elf32-rl78.c (rl78_elf_merge_private_bfd_data): Complain if
64-bit doubles objects mix with 32-bit doubles objects.
(rl78_elf_print_private_bfd_data): Describe 64-bit doubles flag.
* readelf.c (get_machine_flags): Handle RL78 64-bit doubles flag.
* config/tc-rl78.c (enum options): Add OPTION_32BIT_DOUBLES
and OPTION_64BIT_DOUBLES.
(md_longopts): Add -m32bit-doubles and -m64bit-doubles.
(md_parse_option): Parse -m32bit-doubles and -m64bit-doubles.
(md_show_usage): Show all of the RL78 options.
(rl78_float_cons): New static functions.
(md_pseudo_table): Update handler for "double".
gdb/testsuite/
2014-05-16 Pedro Alves <palves@redhat.com>
* lib/mi-support.exp (mi_expect_stop): On timeout, say "timeout"
instead of "unknown output after running".
Some gdb.dwarf2/*.exp tests copy file1.txt to host via gdb_remote_download
but dw2-filename.exp and dw2-anonymous-func.exp don't do that. Looks like
an oversight in this patch
https://sourceware.org/ml/gdb-patches/2013-08/msg00365.html
There are some fails in remote host testing.
FAIL: gdb.dwarf2/dw2-anonymous-func.exp: list file1.txt
FAIL: gdb.dwarf2/dw2-filename.exp: interpreter-exec mi -file-list-exec-source-files
FAIL: gdb.dwarf2/dw2-filename.exp: info sources
This patch is to invoke gdb_remote_download to copy file1.txt to host
and remote it at the end. This patch fixes these fails above.
gdb/testsuite:
2014-05-16 Yao Qi <yao@codesourcery.com>
* gdb.dwarf2/dw2-filename.exp: Copy file1.txt to host. Remove
file1.txt from host at the end.
* gdb.dwarf2/dw2-anonymous-func.exp: Likewise.
Pierre proposed this patch
https://sourceware.org/ml/gdb-patches/2013-10/msg00011.html and
Tom gave a suggestion that it's better to do check \t in print_wchar
<https://sourceware.org/ml/gdb-patches/2013-11/msg00148.html>
However, I don't see the follow-up to this discussion.
We encounter two fails in printcmds.exp on mingw host, and Pierre's
patch fixes them. I pick it up, update a little per Tom's
comments, and post it here for review. This patch fixes these fails
below on mingw32 host.
FAIL: gdb.base/charset.exp: print string in ASCII
FAIL: gdb.base/charset.exp: try printing '\t' in ASCII
FAIL: gdb.base/charset.exp: print string in ISO-8859-1
FAIL: gdb.base/charset.exp: try printing '\t' in ISO-8859-1
FAIL: gdb.base/charset.exp: print string in UTF-32
FAIL: gdb.base/charset.exp: try printing '\t' in UTF-32
FAIL: gdb.base/printcmds.exp: p ctable1[9]
FAIL: gdb.base/printcmds.exp: p &ctable1[1*8]
Also regression tested on x86_64-linux. Is it OK?
gdb:
2014-05-16 Pierre Muller <muller@sourceware.org>
Yao Qi <yao@codesourcery.com>
* valprint.c (print_wchar): Move the code on checking whether
W is a printable wide char to the default branch of switch
statement below. Call wchar_printable instead of gdb_iswprint.
Prologue analysis for ldr.w and ldrd instruction obtains offset from
first two bytes that contains opcode of instruction. It should obtain
offset from next two bytes that actually contain operands.
* arm-tdep.c (thumb_analyze_prologue): Fix offset calculation for
ldr.w and ldrd instructions.
Signed-off-by: Taimoor Mirza <tmirza@codesourcery.com>
Since we're not compiling with gcc, we don't know where the
DWO file will ultimately be built. It could be built in
testsuite/gdb.dwarf2/foo (non-parallel mode) or
testsuite/outputs/gdb.dwarf2/foo (parallel mode).
* gdb.dwarf2/fission-reread.S: Remove directory from .dwo file path.
* gdb.dwarf2/fission-reread.exp: Set debug-file-directory before
loading file. Add test for TU lookup.
Passing arguments did not work when use_mi_command was set.
gdb/testsuite/ChangeLog:
2014-05-13 Simon Marchi <simon.marchi@ericsson.com>
* lib/mi-support.exp (mi_run_cmd_full): Set arguments by calling
"-exec-arguments" or "set args" before running the inferior.
The message displayed by gdb is different when the inferior exits with
zero and non-zero values, this fix takes that into account.
gdb/testsuite/ChangeLog:
2014-05-13 Simon Marchi <simon.marchi@ericsson.com>
* lib/mi-support.exp (mi_expect_stop): Expect message for
inferiors that exit with non-zero exit code.
When linking statically, it's possible to hit this warning with IFUNC
or very large executables, due to .glink being unused.
* powerpc.cc (do_plt_fde_location): Handle zero length .glink.
Compare FDE contents with DW_CFA_nop rather than 0.
I happened to notice that print_macro_definition is indented
improperly. All the lines were a few extra spaces to the right.
This patch fixes the indentation.
Tested by rebuilding, committed.
2014-05-14 Tom Tromey <tromey@redhat.com>
* macrocmd.c (print_macro_definition): Reindent.
This patch fixes mi-file.exp fails on remote host. First, we can't
assume ${srcdir}/${subdir}/${srcfile} directory exists on remote host,
so this patch changes it to match ${srcfile} only on remote host.
Second, regexp pattern ".*/${srcfile}" isn't friendly to Windows path.
The file name is "basics.c" in my test env and can't match the pattern
due to "/" in it. Remove "/" from the pattern.
gdb/testsuite:
2014-05-14 Yao Qi <yao@codesourcery.com>
* gdb.mi/mi-file.exp (test_file_list_exec_source_file): Don't
match absolute path on remote host.
(test_file_list_exec_source_files): Remove "/" from the
pattern.
After I run test like this,
$ make check RUNTESTFLAGS='--host_board=local-remote-host dw2-basic.exp'
gdb.dwarf2/file1.txt in source tree was removed. In some gdb.dwarf2/*.exp,
file1.txt is copied to host and then removed at the end. However, in
local-remote-host-notty.exp, ${board}_download doesn't copy the file but
return the absolute path of the src file. 'remote_file host delete' at
the end will remove the file in source tree.
This patch is to overwrite ${board}_file, and specially make "delete"
option do nothing. This approach is used in gdbserver-base.exp and
remote-stdio-gdbserver.exp too.
gdb/testsuite:
2014-05-14 Yao Qi <yao@codesourcery.com>
* boards/local-remote-host-notty.exp (${board}_file): New
proc.
should_resume is set to 1 at the beginning and never changed.
gdb/ChangeLog:
2014-05-13 Simon Marchi <simon.marchi@ericsson.com>
* infrun.c (resume): Remove should_resume (unused). Move up
declaration of resume_ptid.
to access a global as it expects a GOTPCREL relocation. This is really not
necessary as the linker could use a copy relocation to get around it. This
patch enables copy relocations with pie.
Context:
This is useful because currently the GCC compiler with option -fpie makes
every extern global access go through the GOT. That is because the compiler
cannot tell if a global will end up being defined in the executable or not
and is conservative. This ends up hurting performance when the binary is linked
as mostly static where most of the globals do end up being defined in the
executable. By allowing copy relocs with fPIE, the compiler need not generate
a GOTPCREL(GOT access) for any global access. It can safely assume that all
globals will be defined in the executable and generate a PC-relative access
instead. Gold can then create a copy reloc for only the undefined globals.
gold/
* symtab.h (may_need_copy_reloc): Remove check for position independent
code.
* x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
position independence before pc absolute may_need_copy_reloc call.
Add check for executable output befor pc relative may_need_copy_reloc
call.
* i386.cc: Ditto.
* arm.cc: Ditto.
* sparc.cc: Ditto.
* tilegx.cc: Ditto.
* powerpc.cc: Add check for no position independence before
may_need_copy_reloc calls.
* testsuite/pie_copyrelocs_test.cc: New file.
* testsuite/pie_copyrelocs_shared_test.cc: New file.
* Makefile.am (pie_copyrelocs_test): New test.
* Makefile.in: Regenerate.
This patch removes an unused macro from language.h. It also removes
the declaration of a function which is not defined.
I'm checking this in as obvious.
Tested by rebuilding.
2014-05-13 Tom Tromey <tromey@redhat.com>
* language.h (unop_type_check): Remove.
(binop_type_check): Don't declare.
With -pie and x86, the linker complains if it sees a PC-relative relocation
to access a global as it expects a GOTPCREL relocation. This is really not
necessary as the linker could use a copy relocation to get around it. This
patch enables copy relocations with pie.
Context:
This is useful because currently the GCC compiler with option -fpie makes
every extern global access go through the GOT. That is because the compiler
cannot tell if a global will end up being defined in the executable or not
and is conservative. This ends up hurting performance when the binary is linked
as mostly static where most of the globals do end up being defined in the
executable. By allowing copy relocs with fPIE, the compiler need not generate
a GOTPCREL(GOT access) for any global access. It can safely assume that all
globals will be defined in the executable and generate a PC-relative access
instead. Gold can then create a copy reloc for only the undefined globals.
gas/
* config/tc-mips.c (mips_set_options): Rename gp32 to gp throughout.
(HAVE_32BIT_GPRS, HAVE_64BIT_GPRS): Remove. Re-implement via GPR_SIZE.
(HAVE_32BIT_FPRS, HAVE_64BIT_FPRS): Remove. Re-implement via FPR_SIZE.
(GPR_SIZE, FPR_SIZE): New macros. Use throughout.