Commit Graph

93122 Commits

Author SHA1 Message Date
Yao Qi dc71152484 Remove mt port
This patch removes the MT port.  The removal was annoucned
https://sourceware.org/ml/gdb-announce/2017/msg00006.html
I'll remove MT from the top-level configure later.

gdb:

2018-01-22  Yao Qi  <yao.qi@linaro.org>

	* Makefile.in (ALL_TARGET_OBS): Remove mt-tdep.o.
	* configure.tgt: Remove target mt.
	* mt-tdep.c: Remove.
	* regcache.c (cooked_read_test): Remove the check for mt.
2018-01-22 11:02:49 +00:00
Yao Qi 3f5a868b22 Don't call gdbarch_pseudo_register_read_value in jit.c
gdbarch_pseudo_register_read_value is not implemented in every gdbarch, so
the predicate gdbarch_pseudo_register_read_value_p is needed before
calling it.  However, there is no such guard in jit_frame_prev_register, I
am wondering how does jit work on the arch without having gdbarch method
pseudo_register_read_value.

The proper way to get register value is to call cooked_read, and then
create the value object from the buffer.

gdb:

2018-01-22  Yao Qi  <yao.qi@linaro.org>

	* jit.c (jit_frame_prev_register): Call regcache::cooked_read
	instead of gdbarch_pseudo_register_read_value.
2018-01-22 11:02:48 +00:00
Joel Brobecker de4cb04a20 Ada/DWARF: Assume the Ada compiler produces descriptive type attributes
GCC was enhanced in 2011 to generate this attribute, so I think we can
now assume that it is available when using that compiler. Doing so
allows us to speed up what we call "parallel type" lookups when
processing certain types encoded using the GNAT encoding.

This patch changes need_gnat_info to always expect those attributes
to be generated when the language is Ada. This is an assumption
that on the surfcace looks like it might be a bit on the edge; but
in practice, it should be OK because this is only useful in the
context of handling GNAT-specific encodings. Other Ada compilers
would presumably produce debugging information using pure DWARF
constructs, so would not be impacted by this.

gdb/ChangeLog:

        * dwarf2read.c (need_gnat_info): Return nonzero if the cu's
        language is Ada.

Tested on x86_64-linux.
2018-01-21 23:23:34 -05:00
Joel Brobecker a9e408182d wrong line number in breakpoint location
Consider the following situation, where we have one file containing...

    $ cat -n body.inc
         1  i = i + 1;

... we include that file from some code, like so:

    $ cat -n cat -n small.c
        [...]
        17  int
        18  next (int i)
        19  {
        20  #include "body.inc"
        21    return i;
        22  }

When trying to insert a breakpoint on line 18, for instance:

    (gdb) b small.c:18
    Breakpoint 1 at 0x40049f: file body.inc, line 18.
                                                  ^^
                                                  ||

Here, the issue is that GDB reports the breakpoint to be in file
body.inc, which is true, but with the line number that corresponding
to the user-requested location, which is not correct.

Although the simple reproducer may look slightly artificial,
the above is simply one way to reproduce the same issue observed
when trying to insert a breakpoint on a function provided in
a .h files and then subsequently inlined in a C file.

What happens is the following:

  1. We resolve the small.c:18 linespec into a symtab_and_line which
     has "small.c" and 18 as the symtab and line number.

  2. Next, we call skip_prologue_sal, which calculates the PC
     past the prologue, and updates the symtab_and_line: PC,
     but also symtab (now body.inc) and the new line (now 1).

  3. However, right after that, we do:

            /* Make sure the line matches the request, not what was
               found.  */
            intermediate_results.sals[i].line = val.line;

We should either restore both symtab and line, or leave the actual
line to match the actual symtab.  This patch chose the latter.
This introduces a few changes in a few tests, which required some
updates, but looking at those change, I believe them to be expected.

gdb/ChangeLog:

        * linespec.c (create_sals_line_offset): Remove code that preserved
        the symtab_and_line's line number.

gdb/testsuite/ChangeLog:

        * gdb.base/break-include.c, gdb.base/break-include.inc,
        gdb.base/break-include.exp: New files.
        * gdb.base/ending-run.exp: Minor adaptations due to the breakpoint's
        line number now being the actual line number where the breakpoint
        was inserted.
        * gdb.mi/mi-break.exp: Likewise.
        * gdb.mi/mi-reverse.exp: Likewise.
        * gdb.mi/mi-simplerun.exp: Ditto.

Tested on x86_64-linux.
2018-01-21 23:14:50 -05:00
GDB Administrator 3b76a4a069 Automatic date update in version.in 2018-01-22 00:00:29 +00:00
Andrew Burgess e707fc445e gdb: Don't store a thread-id for floating varobj
When creating a varobj with -var-create a user can create either fixed
varobj, or floating varobj.

A fixed varobj will always be evaluated within the thread/frame/block in
which the varobj was created, if that thread/frame/block is no longer
available then the varobj is considered out of scope.

A floating varobj will always be evaluated within the current
thread/frame/block.

Despite never using them GDB was storing the thread/frame/block into a
floating varobj, and the thread-id would then be displayed when GDB
reported on the state of the varobj, this could confuse a user into
thinking that the thread-id was relevant.

This commit prevents GDB storing the thread/frame/block onto floating
varobj, and updates the few tests where this impacts the results.

gdb/ChangeLog:

	* varobj.c (varobj_create): Don't set valid_block when creating a
	floating varobj.

gdb/testsuite/ChangeLog:

	* gdb.python/py-mi.exp: Don't expect a thread-id for floating
	varobj.
	* gdb.mi/mi-var-create-rtti.exp: Likewise.
2018-01-21 15:47:28 +00:00
Andrew Burgess 03d0bf7b78 gdb: Remove out of date comment
Comment clean up.

gdb/ChangeLog:

	* varobj.c (varobj_create): Remove out of date comment.
2018-01-21 15:47:28 +00:00
Andrew Burgess ae45162705 gdb: PR mi/20395: Fix -var-update for registers in frames 1 and up
This patch fixes a problem with using the MI -var-update command
to access the values of registers in frames other than the current
frame.  The patch includes a test that demonstrates the problem:

* run so there are several frames on the stack
* create a fixed varobj for $pc in each frame, #'s 1 and above
* step one instruction, to modify the value of $pc
* call -var-update for each of the previously created varobjs
  to verify that they are not reported as having changed.

Without the patch, the -var-update command reported that $pc for all
frames 1 and above had changed to the value of $pc in frame 0.

A varobj is created as either fixed, the expression is evaluated within
the context of a specific frame, or floating, the expression is
evaluated within the current frame, whatever that may be.

When a varobj is created by -var-create we set two fields of the varobj
to track the context in which the varobj was created, these two fields
are varobj->root->frame and var->root->valid_block.

If a varobj is of type fixed, then, when we subsequently try to
reevaluate the expression associated with the varobj we must determine
if the original frame (and block) is still available, if it is not then
the varobj can no longer be evaluated.

The problem is that for register expressions varobj->root->valid_block
is not set correctly.  This block tracking is done using the global
'innermost_block' which is set in the various parser files (for example
c-exp.y).  However, this is not set for register expressions.

The fix then seems like it should be to just update the innermost block
when parsing register expressions, however, that solution causes several
test regressions.

The problem is that in some cases we rely on the expression parsing
code not updating the innermost block for registers, one example is
when we parse the expression for a 'display' command.  The display
commands treats registers like floating varobjs, but symbols are
treated like fixed varobjs.  So 'display $reg_name' will always show
the value of '$reg_name' even as the user moves from frame to frame,
while 'display my_variable' will only show 'my_variable' while it is
in the current frame and/or block, when the user moves to a new frame
and/or block (even one with a different 'my_variable' in) then the
display of 'my_variable' stops.  For the case of 'display', without
the option to force fixed or floating expressions, the current
behaviour is probably the best choice.  For the varobj system though,
we can choose between floating and fixed, and we should try to make
this work for registers.

There's only one existing test case that needs to be updated, in that
test a fixed varobj is created using a register, the MI output now
include the thread-id in which the varobj should be evaluated, which I
believe is correct behaviour.  I also added a new floating test case
into the same test script, however, right now this also includes the
thread-id in the expected output, which I believe is an existing gdb
bug, which I plan to fix next.

Tested on x86_64 Linux native and native-gdbserver, no regressions.

gdb/ChangeLog:

	PR mi/20395
	* ada-exp.y (write_var_from_sym): Pass extra parameter when
	updating innermost block.
	* parse.c (innermost_block_tracker::update): Take extra type
	parameter, and check types match before updating innermost block.
	(write_dollar_variable): Update innermost block for registers.
	* parser-defs.h (enum innermost_block_tracker_type): New enum.
	(innermost_block_tracker::innermost_block_tracker): Initialise
	m_types member.
	(innermost_block_tracker::reset): Take type parameter.
	(innermost_block_tracker::update): Take type parameter, and pass
	type through as needed.
	(innermost_block_tracker::m_types): New member.
	* varobj.c (varobj_create): Pass type when reseting innermost
	block.

gdb/testsuite/ChangeLog:

	* gdb.mi/basics.c: Add new global.
	* gdb.mi/mi-frame-regs.exp: New file.
	* gdb.mi/mi-var-create-rtti.exp: Update expected results, add new
	case.
2018-01-21 15:46:51 +00:00
Andrew Burgess aee1fcdf97 gdb: New API for tracking innermost block
This commit is preparation for a later change, at this point there
should be no user visible change.

We currently maintain a global innermost_block which tracks the most
inner block encountered when parsing an expression.

This commit wraps the innermost_block into a new class, and switches all
direct accesses to the variable to use the class API.

gdb/ChangeLog:

	* ada-exp.y (write_var_from_sym): Switch to innermost_block API.
	* ada-lang.c (resolve_subexp): Likewise.
	* breakpoint.c (set_breakpoint_condition) Likewise.
	(watch_command_1) Likewise.
	* c-exp.y (variable): Likewise.
	* d-exp.y (PrimaryExpression): Likewise.
	* f-exp.y (variable): Likewise.
	* go-exp.y (variable): Likewise.
	* m2-exp.y (variable): Likewise.
	* objfiles.c (objfile::~objfile): Likewise.
	* p-exp.y (variable): Likewise.
	* parse.c (innermost_block): Change type.
	* parser-defs.h (class innermost_block_tracker): New.
	(innermost_block): Change to innermost_block_tracker.
	* printcmd.c (display_command): Switch to innermost_block API.
	(do_one_display): Likewise.
	* rust-exp.y (do_one_display): Likewise.
	* symfile.c (clear_symtab_users): Likewise.
	* varobj.c (varobj_create): Switch to innermost_block API, replace
	use of innermost_block with block stored on varobj object.
2018-01-21 15:15:47 +00:00
Andrew Burgess 396af9a152 gdb: Remove duplicate declaration of global innermost_block
The global 'innermost_block' is declared in two header files.  Remove
one of the declarations, and add an include of the other header into
the one source file that could no longer see a declaration of
'innermost_block'.

gdb/ChangeLog:

	* expression.h (innermost_block): Remove declaration.
	* varobj.c: Add 'parser-defs.h' include.
2018-01-21 15:15:47 +00:00
Andrew Burgess b1b189e04c gdb: Add test for some error cases of @entry usage
Adds a test that using @entry for a non-parameter, or for an unknown
symbol, both give the expected error.  This error message was
previously untested.

gdb/testsuite/ChangeLog:

	* gdb.arch/amd64-entry-value.exp: Test using @entry on a
	non-parameter, and on an unknown symbol.
2018-01-21 15:06:05 +00:00
GDB Administrator f49464e428 Automatic date update in version.in 2018-01-21 00:00:35 +00:00
H.J. Lu 8a1b824af7 x86: Check the versioned __tls_get_addr symbol
We need to check the versioned __tls_get_addr symbol when looking up
"__tls_get_addr".

bfd/

	PR ld/22721
	* elfxx-x86.c (_bfd_x86_elf_link_check_relocs): Check the
	versioned __tls_get_addr symbol.

ld/

	PR ld/22721
	* testsuite/ld-plugin/lto.exp: Run PR ld/22721 tests.
	* testsuite/ld-plugin/pr22721.t: New file.
	* testsuite/ld-plugin/pr22721a.s: Likewise.
	* testsuite/ld-plugin/pr22721b.c: Likewise.
2018-01-20 14:29:36 -08:00
GDB Administrator 44301db1ac Automatic date update in version.in 2018-01-20 00:00:22 +00:00
Tom Tromey fcfcc37696 Fix qualified name lookup for Rust
In https://github.com/rust-lang/rust/pull/46457, "m4b" pointed out
that the Rust support in gdb doesn't properly handle the lookup of
qualified names.

In particular, as shown in the test case in this patch, something like
"::NAME" should be found in the global scope, but is not.

This turns out to happen because rust_lookup_symbol_nonlocal does not
search the global scope unless the name in question is unqualified.
However, lookup_symbol_aux does not search the global scope, and
appears to search the static scope only as a fallback (I wonder if
this is needed?).

This patch fixes the problem by changing rust_lookup_symbol_nonlocal
to search the static and global blocks in more cases.

Regression tested against various versions of the rust compiler on
Fedora 26 x86-64.  (Note that there are unrelated failures with newer
versions of rustc; I will be addressing those separately.)

2018-01-19  Tom Tromey  <tom@tromey.com>

	* rust-lang.c (rust_lookup_symbol_nonlocal): Look up qualified
	symbols in the static and global blocks.

2018-01-19  Tom Tromey  <tom@tromey.com>

	* gdb.rust/modules.rs (TWENTY_THREE): New global.
	* gdb.rust/modules.exp: Add ::-qualified lookup test.
2018-01-19 15:30:28 -07:00
Andreas Arnez 634c1c3109 S390: Fix infcalls in s390-vregs test case
GDB used to assume that functions without debug info return int.  It
accepted an expression containing such a function call and silently
interpreted the function's return value as int.  But nowadays GDB yields
an error message instead, see

  https://sourceware.org/ml/gdb-patches/2017-07/msg00139.html

This affects the s390-vregs test case, because it contains calls to
setrlimit64 and chdir.  When no glibc debug info is installed, these lead
to unnecessary FAILs.  Fix this by adding appropriate casts to the
inferior function calls.

gdb/testsuite/ChangeLog:

	* gdb.arch/s390-vregs.exp: Explicitly cast the return values of
	setrlimit and chdir to int.
2018-01-19 19:59:53 +01:00
James Clarke a0aad53764 gdb: Add missing #ifdef USE_THREAD_DB to gdbserver
Otherwise, linking fails with:

  [...]/linux-low.c:664: undefined reference to `thread_db_notice_clone(thread_info*, ptid_t)'

gdb/gdbserver/ChangeLog:

	* linux-low.c (handle_extended_wait): Surround call to
	thread_db_notice_clone with #ifdef USE_THREAD_DB.
2018-01-19 18:18:58 +00:00
James Clarke 5a6c3296a7 gdb: Fix ia64 defining TRAP_HWBKPT before including gdb_wait.h
On ia64, gdb_wait.h eventually includes siginfo-consts-arch.h, which
contains an enum with TRAP_HWBKPT, along with a #define. Thus we cannot
define TRAP_HWBKPT to 4 beforehand, and so gdb_wait.h must be included
earlier; include it from linux-ptrace.h so it can never come afterwards.

gdb/ChangeLog:

	* nat/linux-ptrace.c: Remove unnecessary reinclusion of
	gdb_ptrace.h, and move including gdb_wait.h ...
	* nat/linux-ptrace.h: ... to here.
2018-01-19 18:17:54 +00:00
Simon Marchi bc09b0c14f Make linux_nat_detach/thread_db_detach use the inferior parameter
This patch makes these two functions actually use the inferior parameter
added by the previous patch, instead of reading inferior_ptid.  I chose
these two, because they are the one actually used when I detach on my
GNU/Linux system, so they were easy to test.

I took the opportunity to pass the inferior being detached to
inf_ptrace_detach_success, so it could use it too.  From there, it made
sense to add an overload of detach_inferior that takes the inferior
directly rather than the pid, to avoid having to pass inf->pid only for
the callee to look up the inferior structure by pid.

gdb/ChangeLog:

	* inf-ptrace.c (inf_ptrace_detach): Adjust call to
	inf_ptrace_detach_success.
	(inf_ptrace_detach_success): Add inferior parameter, use it
	instead of inferior_ptid, pass it to detach_inferior.
	* inf-ptrace.h (inf_ptrace_detach_success): Add inferior
	parameter.
	* inferior.c (detach_inferior): Add overload that takes an
	inferior object.
	* inferior.h (detach_inferior): Likewise.
	* linux-nat.c (linux_nat_detach): Use the inf parameter, don't
	use inferior_ptid, adjust call to inf_ptrace_detach_success.
	* linux-thread-db.c (thread_db_detach): Use inf parameter.
2018-01-19 11:48:11 -05:00
Simon Marchi 6e1e1966ba Pass inferior down to target_detach and to_detach
The to_detach target_ops method implementations are currently expected
to work on current_inferior/inferior_ptid.  In order to make things more
explicit, and remove some "shadow" parameter passing through globals,
this patch adds an "inferior" parameter to to_detach.  Implementations
will be expected to use this instead of relying on the global.  However,
to keep things simple, this patch only does the minimum that is
necessary to add the parameter.  The following patch gives an example of
how one such implementation would be adapted.  If the approach is deemed
good, we can then look into adapting more implementations.  Until then,
they'll continue to work as they do currently.

gdb/ChangeLog:

	* target.h (struct target_ops) <to_detach>: Add inferior
	parameter.
	(target_detach): Likewise.
	* target.c (dispose_inferior): Pass inferior down.
	(target_detach): Pass inferior down.  Assert that it is equal to
	the current inferior.
	* aix-thread.c (aix_thread_detach): Pass inferior down.
	* corefile.c (core_file_command): Pass current_inferior() down.
	* corelow.c (core_detach): Add inferior parameter.
	* darwin-nat.c (darwin_detach): Likewise.
	* gnu-nat.c (gnu_detach): Likewise.
	* inf-ptrace.c (inf_ptrace_detach): Likewise.
	* infcmd.c (detach_command): Pass current_inferior() down to
	target_detach.
	* infrun.c (follow_fork_inferior): Pass parent_inf to
	target_detach.
	(handle_vfork_child_exec_or_exit): Pass inf->vfork_parent to
	target_detach.
	* linux-nat.c (linux_nat_detach): Add inferior parameter.
	* linux-thread-db.c (thread_db_detach): Likewise.
	* nto-procfs.c (procfs_detach): Likewise.
	* procfs.c (procfs_detach): Likewise.
	* record.c (record_detach): Likewise.
	* record.h (struct inferior): Forward-declare.
	(record_detach): Add inferior parameter.
	* remote-sim.c (gdbsim_detach): Likewise.
	* remote.c (remote_detach_1): Likewise.
	(remote_detach): Likewise.
	(extended_remote_detach): Likewise.
	* sol-thread.c (sol_thread_detach): Likewise.
	* target-debug.h (target_debug_print_inferior_p): New macro.
	* target-delegates.c: Re-generate.
	* top.c (kill_or_detach): Pass inferior down to target_detach.
	* windows-nat.c (windows_detach): Add inferior parameter.
2018-01-19 11:47:57 -05:00
Simon Marchi 6bd6f3b656 Remove args from target detach
I was looking into adding a parameter to target_detach, and was
wondering what the args parameter was.  It seems like in the distant
past, it was possible to specify a signal number when detaching.  That
signal was injected in the process before it was detached.  There is an
example of code handling this in linux_nat_detach.  With today's GDB, I
can't get this to work.  Doing "detach 15" (15 == SIGTERM) doesn't work,
because detach is a prefix command and doesn't recognize the sub-command
15.  Doing "detach inferiors 15" doesn't work because it expects a list
of inferior id to detach.  Therefore, I don't think there's a way of
invoking detach_command with a non-NULL args.  I also didn't find any
documentation related to this feature.

I assume that this feature stopped working when detach was made a prefix
command, which is in f73adfeb8b (sorry,
there's no commit title) from 2006.  Given that this feature was broken
for such a long time and we haven't heard anything (AFAIK, I did not
find any related bug), I think it's safe to remove it, as well as the
args parameter to target_detach.  If someone wants to re-introduce it, I
would suggest rethinking the user interface, and in particular would
suggest using signal name instead of numbers.

I tried to fix all the impacted code, but I might have forgotten some
spots.  It shouldn't be hard to fix if that's the case.  I also couldn't
build-test everything I changed, especially the nto and solaris stuff.

gdb/ChangeLog:

	* target.h (struct target_ops) <to_detach>: Remove args
	parameter.
	(target_detach): Likewise.
	* target.c (dispose_inferior): Adjust.
	(target_detach): Remove args parameter, adjust.
	* aix-thread.c (aix_thread_detach): Adjust.
	* corefile.c (core_file_command): Adjust.
	* corelow.c (core_detach): Adjust.
	* darwin-nat.c (darwin_detach): Adjust.
	* gnu-nat.c (gnu_detach): Adjust.
	* inf-ptrace.c (inf_ptrace_detach): Adjust.
	* infcmd.c (detach_command): Adjust
	* infrun.c (follow_fork_inferior): Adjust.
	(handle_vfork_child_exec_or_exit): Adjust.
	* linux-fork.c (linux_fork_detach): Remove args parameter.
	* linux-fork.h (linux_fork_detach): Likewise.
	* linux-nat.c (linux_nat_detach): Likewise, and adjust.
	* linux-thread-db.c (thread_db_detach): Likewise.
	* nto-procfs.c (procfs_detach): Likewise.
	* procfs.c (procfs_detach): Likewise.
	(do_detach): Remove signo parameter.
	* record.c (record_detach): Remove args parameter.
	* record.h (record_detach): Likewise.
	* remote-sim.c (gdbsim_detach): Likewise.
	* remote.c (remote_detach_1): Likewise.
	(remote_detach): Likewise.
	(extended_remote_detach): Likewise.
	* sol-thread.c (sol_thread_detach): Likewise.
	* target-delegates.c: Re-generate.
	* top.c (struct qt_args) <args>: Remove field.
	(kill_or_detach): Don't pass args.
	(quit_force): Don't set args.
	* windows-nat.c (windows_detach): Remove args parameter.
2018-01-19 11:47:24 -05:00
Thomas Preud'homme a3ab6cb019 [gas/ARM] Remove spurious comments
Remove spurious comments after the definition of ToC and ToU.

2018-01-19  Thomas Preud'homme  <thomas.preudhomme@arm.com>

gas/
	* config/tc-arm.c (ToC macro): Remove spurious comment.
	(ToU macro): Likewise.
2018-01-19 14:17:24 +00:00
Andreas Arnez d6ad07fdef S390: Improve comments for s390-tdbregs test case
This adds more explanation as to why the test case must be compiled with
the -msoft-float option.  It also documents the my_tbegin and my_tend
functions.

gdb/testsuite/ChangeLog:

	* gdb.arch/s390-tdbregs.c (my_tbegin): Add comment documenting the
	function.
	(my_tend): Likewise.
	* gdb.arch/s390-tdbregs.exp: Enhance comment; explain the
	rationale of avoiding FP- and vector instructions.
2018-01-19 14:14:07 +01:00
Nick Clifton ee3fbc1ebb Update French translation in bfd sub-directory 2018-01-19 10:50:06 +00:00
Yao Qi 88af8ea80b Don't pass -m32 to libcc1 on arm-linux
When I run gdb.compile/ tests on arm-linux, I get the following fails,

(gdb) compile code -- ;^M
arm-none-linux-gnueabihf-gcc: error: unrecognized command line option '-m32'; did you mean '-mbe32'?^M
Compilation failed.^M
(gdb) compile code (void) param^M
arm-none-linux-gnueabihf-gcc: error: unrecognized command line option '-m32'; did you mean '-mbe32'?^M
Compilation failed.^M
(gdb) FAIL: gdb.compile/compile-ops.exp: compile code (void) param

This patch fixes it by implementing gcc_target_options gdbarch method
for arm-linux to override option "-m32".

gdb:

2018-01-19  Yao Qi  <yao.qi@linaro.org>

	* arm-linux-tdep.c (arm_linux_gcc_target_options): New function.
	(arm_linux_init_abi): Install it.
2018-01-19 09:16:45 +00:00
Yao Qi dea445b940 Find arm-linux-gnueabi(hf)?-gcc in compile
GCC for arm-linux has different names on different distros.  It is
arm-linux-gnu-gcc on fedora.  Debian/Ubuntu has arm-linux-gnueabihf-gcc
and arm-linux-gnueabi-gcc.  So when I run gdb.compile/ tests on arm-linux,
I get,

(gdb) compile code -- ;
Could not find a compiler matching "^arm(-[^-]*)?-linux(-gnu)?-gcc$"

This patch extend the regexp to match both arm-linux-gnu-gcc and
arm-linux-gnueabihf-gcc.

gdb:

2018-01-19  Yao Qi  <yao.qi@linaro.org>

	* osabi.c (gdb_osabi_names): Extend the regexp for
	arm-linux-gnueabihf and arm-linux-gnueabi.
2018-01-19 09:08:36 +00:00
Ruslan Kabatsayev adf8243ba9 Make tests expect [ \t]+ pattern instead of \t for "info reg" command
This will allow to format output of "info reg" command as we wish,
without breaking the tests. In particular, it'll let us correctly align
raw and natural values of the registers using spaces instead of current
badly-working approach with tabs.

This change is forwards- and backwards-compatible, so that the amended
tests will work in the same way before and after reformatting patches
(unless the tests check formatting, of course, but I've not come across
any such tests).

Some tests already used this expected pattern, so they didn't
even have to be modified. Others are changed by this patch.

I've checked this on a i386 system, with no noticeable differences in
test results, so at least on i386 nothing seems to be broken by this.

gdb/testsuite/ChangeLog:

	* gdb.arch/powerpc-d128-regs.exp: Replace expected "\[\t\]*" from
	"info reg" with "\[ \t\]*".
	* gdb.arch/altivec-regs.exp: Replace expected "\t" from "info reg" with
	"\[ \t\]+".
	* gdb.arch/s390-multiarch.exp: Ditto.
	* gdb.base/pc-fp.exp: Ditto.
	* gdb.reverse/i386-precsave.exp: Ditto.
	* gdb.reverse/i386-reverse.exp: Ditto.
	* gdb.reverse/i387-env-reverse.exp: Ditto.
	* gdb.reverse/i387-stack-reverse.exp: Ditto.
2018-01-19 09:05:51 +03:00
H.J. Lu 1ebfa86a3c Also xfail ld-elf/group1.d for Solaris
Also xfail ld-elf/group1.d for Solaris since _GLOBAL_OFFSET_TABLE_ is
always generated for Solaris as a global symbol after

.*: 0+1000 +0 +(NOTYPE|OBJECT) +WEAK +DEFAULT +. foo

instead of appending "#..." which will weaken the test.

	* testsuite/ld-elf/group1.d: Also xfail Solaris.
2018-01-18 17:21:24 -08:00
H.J. Lu f7968f08b7 x86: Update ld-elf/linkinfo1[ab].d for Solaris/x86
Update ld-elf/linkinfo1[ab].d to accommodate slightly different PLT/GOT
order/layout for Solaris/x86 targets.

	* testsuite/ld-elf/linkinfo1a.d: Updated for slightly different
	PLT/GOT order/layout for Solaris/x86 targets.
	* testsuite/ld-elf/linkinfo1b.d: Likewise.
2018-01-18 16:23:51 -08:00
H.J. Lu c5bdb02260 solaris2.em: Fold after_allocation into before_allocation
Since all ELF linkers call check_relocs after opening all inputs, we
can fold after_allocation into before_allocation so that local dynamic
symbols will be placed before global dynamic symbols in .dynsym section.
This fixed:

FAIL: Common symbol override test (auxiliary shared object build)
FAIL: ld-elf/pr19617a
FAIL: ld-elf/pr19698

for i386-solaris2.12 and x86_64-solaris2.12 targets.

	PR ld/22728
	* emultempl/solaris2.em (elf_solaris2_after_allocation): Fold
	into ...
	(elf_solaris2_before_allocation): This.
	(LDEMUL_AFTER_ALLOCATION): Removed.
2018-01-18 16:22:13 -08:00
GDB Administrator 85ed4f7ece Automatic date update in version.in 2018-01-19 00:00:31 +00:00
Andreas Arnez dcc0692540 GDB testsuite: Re-enable -fdiagnostics-color=never
In August 2017 the GDB test suite was changed to always add the compile
option "-fdiagnostics-color=never", see:

  https://sourceware.org/ml/gdb-patches/2017-08/msg00150.html

Since this option is not understood by rustc, a commit from 09/2017
dropped its use in that case:

  https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=5eb5f850
  ("Don't use -fdiagnostics-color=never for rustc")

But that change goes overboard and stops using the option for other
languages as well.  Thus compiler diagnostics written into gdb.log may
contain colored output again.  This is fixed.

gdb/testsuite/ChangeLog:

	* lib/gdb.exp (gdb_compile): Re-enable use of
	universal_compile_options for languages other than Rust.
2018-01-18 19:42:46 +01:00
Andreas Arnez 25d4fd8093 S390: Use soft float in s390-tdbregs test case
The GDB test case s390-tdbregs.exp verifies GDB's handling of the
"transaction diagnostic block".  For simplicity, the test case uses the
"transaction begin" (TBEGIN) instruction with the "allow floating-point
operation" flag set to zero.  But some GCC versions may indeed emit
floating point or vector instructions for this test case.  If this happens
in the transaction, it aborts, and an endless loop results.

This change tells the compiler to produce a soft-float binary, so no
floating-point or vector registers are touched.

gdb/testsuite/ChangeLog:

	* gdb.arch/s390-tdbregs.exp: Add the compile option -msoft-float.
2018-01-18 19:41:16 +01:00
Yao Qi 4a17f7688f Make abbrev_table::abbrevs private
abbrev_table::abbrevs is only access within abbrev_table's methods, so
it can be private.  Add "m_" prefix.

gdb:

2018-01-18  Yao Qi  <yao.qi@linaro.org>

	* dwarf2read.c (abbrev_table) <abbrevs>: Rename it to
	m_abbrevs.
	(abbrev_table::add_abbrev): Update.
	(abbrev_table::lookup_abbrev): Update.
2018-01-18 15:29:31 +00:00
Yao Qi d679c21a43 Call cooked_read in ppu2spu_prev_register
The code in ppu2spu_prev_register is in fact regcache_cooked_read,
because spu doesn't have gdbarch method pseudo_register_read_value.

gdb:

2018-01-18  Yao Qi  <yao.qi@linaro.org>

	* ppc-linux-tdep.c (ppu2spu_prev_register): Call cooked_read.
2018-01-18 12:21:01 +00:00
Alan Modra 691d2e9af2 PowerPC PLT stub alignment fixes
Asking for ppc32 plt call stubs to be aligned at 32 byte boundaries
didn't quite work.  For ld.bfd they were spaced 32 bytes apart, but
only started on a 16 byte boundary.  ld.gold also didn't get it right.

Finding that bug made me check over the ppc64 plt stub alignment,
where I found that negative values for alignment (meaning align to
minimize boundary crossing) were not accepted.  Since no one has
complained about that, I guess I could have removed the feature from
ld.bfd documentation, but I've opted instead to correct the code.

I've also added an optional alignment paramenter for ppc32
--plt-align, for some consistency with gold and ppc64 ld.bfd.

bfd/
	* elf32-ppc.c (ppc_elf_create_glink): Correct alignment of .glink.
	* elf64-ppc.c (ppc64_elf_size_stubs): Handle negative plt_stub_align.
	(ppc64_elf_build_stubs): Likewise.
gold/
	* powerpc.cc (param_plt_align): New function supplying default
	--plt-align values.  Use it..
	(Stub_table::plt_call_align): ..here, and..
	(Output_data_glink::global_entry_align): ..here.
	(Stub_table::stub_align): Correct 32-bit minimum alignment.
ld/
	* emultempl/ppc32elf.em: Support optional --plt-align arg.
	* emultempl/ppc64elf.em: Support negative --plt-align arg.
2018-01-18 22:25:21 +10:30
Nick Clifton 7ab8203798 Update Bulgarian translation of the binutils sub-directory 2018-01-18 09:38:59 +00:00
GDB Administrator 2f89d95b71 Automatic date update in version.in 2018-01-18 00:00:24 +00:00
Sergio Durigan Junior 7d937cad0a Fix warning on gdb/compile/compile.c (C++-ify "triplet_rx")
This fixes a GCC warning that happens when compiling
gdb/compile/compile.c on some GCC versions (e.g., "gcc (GCC) 7.2.1
20180104 (Red Hat 7.2.1-6)"):

../../gdb/compile/compile.c: In function 'void eval_compile_command(command_line*, const char*, compile_i_scope_types, void*)':
../../gdb/compile/compile.c:548:19: warning: 'triplet_rx' may be used uninitialized in this function [-Wmaybe-uninitialized]
     error_message = compiler->fe->ops->set_arguments_v0 (compiler->fe, triplet_rx,
     ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         argc, argv);
         ~~~~~~~~~~~
../../gdb/compile/compile.c:466:9: note: 'triplet_rx' was declared here
   char *triplet_rx;
         ^~~~~~~~~~

It's a simple patch that converts "triplet_rx" from "char *" to
"std::string", thus guaranteeing that it will be always initialized.

I've regtested this patch and did not find any regressions.  OK to
apply on both master and 8.1 (after creating a bug for it)?

gdb/ChangeLog:
2018-01-17  Sergio Durigan Junior  <sergiodj@redhat.com>

	* compile/compile.c (compile_to_object): Convert "triplet_rx"
	to "std::string".
2018-01-17 18:05:42 -05:00
Jim Wilson e925c834ec RISC-V: Fix bug in prior addi/c.nop patch.
gas/
	* config/tc-riscv.c (validate_riscv_insn) <'z'>: New.
	(riscv_ip) <'z'>: New.
	opcodes/
	* riscv-opc.c (riscv_opcodes) <addi>: Use z instead of 0.
2018-01-17 14:04:16 -08:00
Tom Tromey 9e14690d06 Remove symbolp typedef
This removes the symbolp typedef from dwarf2read.c.  It is no longer
used.

2018-01-17  Tom Tromey  <tom@tromey.com>

	* dwarf2read.c (symbolp): Remove typedef.  Don't instantiate VEC.
2018-01-17 11:28:44 -07:00
Tom Tromey 50a820477b Remove objfile argument from add_dyn_prop
The objfile argument to add_dyn_prop is redundant, so this patch
removes it.

2018-01-17  Tom Tromey  <tom@tromey.com>

	* gdbtypes.h (add_dyn_prop): Remove objfile parameter.
	* gdbtypes.c (add_dyn_prop): Remove objfile parameter.
	(create_array_type_with_stride): Update.
	* dwarf2read.c (set_die_type): Update.
2018-01-17 11:28:44 -07:00
Tom Tromey c89b44cdc5 Change dwarf2_cu::method_info to be a std::vector
This changes the type of dwarf2_cu::method_info and fixes up the uses.
In order to remove cleanups from process_full_comp_unit and
process_full_type_unit, psymtab_include_file_name also had to be
changed to avoid leaving dangling cleanups.

2018-01-17  Tom Tromey  <tom@tromey.com>

	* dwarf2read.c (delayed_method_info): Remove typedef.
	(dwarf2_cu::method_info): Now a std::vector.
	(add_to_method_list): Update.
	(free_delayed_list): Remove.
	(compute_delayed_physnames): Update.
	(process_full_comp_unit, process_full_type_unit): Clear the method
	list.  Remove cleanups.
	(psymtab_include_file_name): Add name_holder parameter.  Use
	unique_xmalloc_ptr.
	(dwarf_decode_lines): Update.
2018-01-17 11:28:44 -07:00
Simon Marchi fcd3b13d80 Allocate dwarf2_cu with new
This changes dwarf2_cu to be allocated with new, and fixes up the
users.

2018-01-17  Tom Tromey  <tom@tromey.com>
	    Simon Marchi  <simon.marchi@ericsson.com>

	* dwarf2read.c (struct dwarf2_cu): Add constructor, destructor.
	(dwarf2_per_objfile::free_cached_comp_units)
	(init_tu_and_read_dwo_dies, init_cutu_and_read_dies)
	(init_cutu_and_read_dies_no_follow): Update.
	(dwarf2_cu::dwarf2_cu): Rename from init_one_comp_unit.
	(dwarf2_cu::~dwarf2_cu): New.
	(free_heap_comp_unit, free_stack_comp_unit): Remove.
	(age_cached_comp_units, free_one_cached_comp_unit): Update.
2018-01-17 11:28:44 -07:00
Tom Tromey 685af9cd22 Allocate abbrev_table with new
This changes dwarf2read.c to allocate abbrev tables using "new", and
then updates the users.

This version of the patch incorporates the changes that Simon
implemented.  These changes simplify the ownership rules for abbrev
tables.

2018-01-17  Tom Tromey  <tom@tromey.com>
	    Simon Marchi  <simon.marchi@ericsson.com>

	* dwarf2read.c (struct dwarf2_cu) <abbrev_table>: Remove.
	(struct die_reader_specs) <abbrev_table>: New member.
	(struct abbrev_table): Add constructor.
	<alloc_abbrev, add_abbrev, lookup_abbrev>: Declare.
	<abbrev_obstack>: Now an auto_obstack.
	(abbrev_table_up): New typedef.
	(init_cu_die_reader): Add abbrev_table parameter.
	(read_cutu_die_from_dwo): Remove abbrev_table_provided parameter.
	Add result_dwo_abbrev_table.
	(init_tu_and_read_dwo_dies, init_cutu_and_read_dies)
	(init_cutu_and_read_dies_no_follow, build_type_psymtabs_1):
	Update.
	(peek_die_abbrev): Take die_reader_specs, not dwarf_cu as
	parameter.
	(skip_children): Update.
	(abbrev_table::alloc_abbrev): Rename from
	abbrev_table_alloc_abbrev.
	(abbrev_table::add_abbrev): Rename from abbrev_table_add_abbrev.
	(abbrev_table::lookup_abbrev): Rename from
	abbrev_table_lookup_abbrev.
	(abbrev_table_read_table): Return abbrev_table_up.
	(abbrev_table_free, abbrev_table_free_cleanup)
	(dwarf2_read_abbrevs, dwarf2_free_abbrev_table): Remove.
	(load_partial_dies): Update.
2018-01-17 11:28:44 -07:00
Tom Tromey 5e2db402c8 Unify new_symbol and new_symbol_full
This patch unifies new_symbol with new_symbol_full, replacing a
wrapper function with a default parameter.

2018-01-17  Tom Tromey  <tom@tromey.com>

	* dwarf2read.c (dwarf2_compute_name): Update comment.
	(read_func_scope, read_variable): Update.
	(new_symbol): Remove.
	(new_symbol_full): Rename to new_symbol.
2018-01-17 11:28:44 -07:00
Simon Marchi ee7f689e15 Fix ChangeLog dates of previous commit 2018-01-17 12:59:51 -05:00
Mike Gulick 4166753056 Fix gdb segv when objfile can't be opened
This fixes PR 16577.

This patch changes gdb_bfd_map_section to issue a warning rather than an error
if it is unable to read the object file, and sets the size of the section/frame
that it attempted to read to 0 on error.

The description of gdb_bfd_map_section states that it will try to read or map
the contents of the section SECT, and if successful, the section data is
returned and *SIZE is set to the size of the section data.  This function was
throwing an error and leaving *SIZE as-is.  Setting the section size to 0
indicates to dwarf2_build_frame_info that there is no data to read, otherwise
it will try to read from an invalid frame pointer.

Changing the error to a warning allows this to be handled gracefully.
Additionally, the error was clobbering the breakpoint output indicating the
current frame (function name, arguments, source file, and line number).  E.g.

Thread 3 "foo" hit Breakpoint 1, BFD: reopening /tmp/jna-1013829440/jna2973250704389291330.tmp: No such file or directory
BFD: reopening /tmp/jna-1013829440/jna2973250704389291330.tmp: No such file or directory
(gdb)

While the "BFD: reopening ..." messages will still appear interspersed in the
breakpoint output, the current frame info is now displayed:

Thread 3 "foo" hit Breakpoint 1, BFD: reopening /tmp/jna-1013829440/jna1875755897659885075.tmp: No such file or directory
BFD: reopening /tmp/jna-1013829440/jna1875755897659885075.tmp: No such file or directory
warning: Can't read data for section '.eh_frame' in file '/tmp/jna-1013829440/jna1875755897659885075.tmp'
do_something () at file.cpp:80
80	{
(gdb)
2018-01-17 12:54:59 -05:00
Simon Marchi 4d9b86e175 Make linux_ptrace_attach_fail_reason return an std::string
This patch makes linux_ptrace_attach_fail_reason and
linux_ptrace_attach_fail_reason_string return std::string.  It also
replaces usages of struct buffer with std::string.  This allows getting
rid of a cleanup in in linux_ptrace_attach_fail_reason_string and
simplifies the code in general.

Something that looks odd to me is that in
linux_ptrace_attach_fail_reason, if the two messages are appended, there
is no separating space or \n, so the result won't be very nice.  I left
it as-is for now though.

gdb/ChangeLog:

	* nat/linux-ptrace.h (linux_ptrace_attach_fail_reason): Return
	std::string.
	(linux_ptrace_attach_fail_reason_string): Likewise.
	* nat/linux-ptrace.c (linux_ptrace_attach_fail_reason):
	Likewise.
	(linux_ptrace_attach_fail_reason_string): Likewise.
	* linux-nat.c (attach_proc_task_lwp_callback): Adjust.

gdb/gdbserver/ChangeLog:

	* linux-low.c (attach_proc_task_lwp_callback): Adjust to
	linux_ptrace_attach_fail_reason_string now returning an
	std::string.
	(linux_attach): Likewise.
	* thread-db.c (attach_thread): Likewise.
2018-01-17 12:34:50 -05:00
Simon Marchi a7b2d0fbeb linux-nat: Remove unnecessary xstrdup
I think this xstrdup is not useful.  We can pass ex.message directly to
throw_error instead.

gdb/ChangeLog:

	* linux-nat.c (linux_nat_attach): Remove xstrdup.
2018-01-17 12:33:45 -05:00