platform/upstream/binutils.git
10 years agoAdd "#..."
H.J. Lu [Thu, 12 Dec 2013 21:48:54 +0000 (13:48 -0800)]
Add "#..."

* ld-elf/ehdr_start-userdef.d: Add "#...".

10 years agoAdd @cindex for section documenting the -list-features GDB/MI command.
Joel Brobecker [Tue, 10 Dec 2013 11:51:38 +0000 (12:51 +0100)]
Add @cindex for section documenting the -list-features GDB/MI command.

gdb/doc/ChangeLog:

        * gdb.texinfo (GDB/MI Miscellaneous Commands): Add @cindex
        entry for section docuumenting the -list-features GDB/MI command.

10 years agoSet ET_EXEC for -pie -Ttext-segment=
H.J. Lu [Thu, 12 Dec 2013 15:41:27 +0000 (07:41 -0800)]
Set ET_EXEC for -pie -Ttext-segment=

bfd/

* elf.c (assign_file_positions_except_relocs): Set e_type in ELF
header to ET_EXEC for -pie -Ttext-segment=.

2013-12-10  H.J. Lu  <hongjiu.lu@intel.com>

* ld-pie/vaddr-0.d: New file.
* ld-pie/vaddr-1.d: Likewise.
* ld-pie/vaddr.s: Likewise.

10 years agobreakpoint.c:insert_bp_location: Constify local.
Pedro Alves [Thu, 12 Dec 2013 10:44:42 +0000 (10:44 +0000)]
breakpoint.c:insert_bp_location: Constify local.

gdb/
2013-12-12  Pedro Alves  <palves@redhat.com>

* breakpoint.c (insert_bp_location): Make 'hw_bp_err_string' local
const, and remove casts.

10 years agoEliminate UNSUPPORTED_ERROR.
Pedro Alves [Wed, 11 Dec 2013 09:49:08 +0000 (09:49 +0000)]
Eliminate UNSUPPORTED_ERROR.

I have a case that could use an exception for "unsupported feature".
I found UNSUPPORTED_ERROR, but looking deeper, I think as is, reusing
it for other things would be fragile.  E.g., if the Python script
sourced by source_script_from_stream triggers any other missing
functionality that would result in UNSUPPORTED_ERROR being propagated
out to source_script_from_stream, that would confuse the error for
Python not being built into GDB.

This patch thus redoes things a little.  Instead of using an exception
for the "No Python" scenario, check whether Python is configured in
before actually trying to source the file.  It adds a new function
instead of using #ifdef HAVE_PYTHON directly, as that is better at
avoiding bitrot, as both Python and !Python paths are visible to the
compiler this way.

Tested on Fedora 17, with and without Python.

gdb/
2013-12-12  Pedro Alves  <palves@redhat.com>

* cli/cli-cmds.c (source_script_from_stream) Use have_python
instead of catching UNSUPPORTED_ERROR.
* exceptions.h (UNSUPPORTED_ERROR): Delete.
* python/python.c (source_python_script) [!HAVE_PYTHON]: Internal
error if called.
* python/python.h (have_python): New static inline function.

10 years ago * dwarf2read.c (lookup_dwo_cutu): Include name of dwp file in
Doug Evans [Wed, 11 Dec 2013 23:52:12 +0000 (15:52 -0800)]
* dwarf2read.c (lookup_dwo_cutu): Include name of dwp file in
"can't find DWO" warning.

10 years agodaily update
Alan Modra [Wed, 11 Dec 2013 23:00:48 +0000 (09:30 +1030)]
daily update

10 years agold/testsuite/ld-aarch64: Fixup IFUNC tests to work on all targets
Will Newton [Tue, 10 Dec 2013 22:02:05 +0000 (22:02 +0000)]
ld/testsuite/ld-aarch64: Fixup IFUNC tests to work on all targets

Make the ifunc-21 and ifunc-22 tests more generic to support
aarch64_be and ELF targets.

ld/testsuite/ChangeLog:

2013-12-11  Will Newton  <will.newton@linaro.org>

* ld-aarch64/ifunc-21.d: Make test more generic to support
aarch64_be and ELF targets.
* ld-aarch64/ifunc-22.d: Likewise.

10 years agoRemove shared object from -Ttext-segment
H.J. Lu [Wed, 11 Dec 2013 18:28:02 +0000 (10:28 -0800)]
Remove shared object from -Ttext-segment

* ld.texinfo: Remove shared object from -Ttext-segment.

10 years agoAdd a test for --as-needed with symbol versioning
H.J. Lu [Wed, 11 Dec 2013 16:00:34 +0000 (08:00 -0800)]
Add a test for --as-needed with symbol versioning

* ld-elf/shared.exp (build_tests): Add libneeded2a.so,
libneeded2b.so, libneeded2c.o and needed2.

* ld-elf/needed2.ver: New file.
* ld-elf/needed2a.c: Likewise.
* ld-elf/needed2b.c: Likewise.
* ld-elf/needed2c.c: Likewise.

10 years agoSanitize access to gdbarch on the SDT probe API (and fix ARM bug)
Sergio Durigan Junior [Wed, 11 Dec 2013 01:53:25 +0000 (23:53 -0200)]
Sanitize access to gdbarch on the SDT probe API (and fix ARM bug)

This patch sanitizes the access to gdbarch made by various functions of
the SDT probe API.  Before this patch, gdbarch was being accessed via
the probe's objfile; however, this proved to cause a bug on 32-bit ARM
targets because during the parsing of the probe's arguments the code
needed to access some pseudo-registers of the architecture, and this
information is not fully correct on the objfile's gdbarch.

Basically, the approach taken was to instead pass the current/selected
frame to the parsing and evaluation functions, so that they can extract
the gdbarch directly from the frame.  It solved the ARM bug reported
above, and also contributed to make the API cleaner.

Tested on x86_64 and 32-bit ARM.

2013-12-11  Sergio Durigan Junior  <sergiodj@redhat.com>

* break-catch-throw.c (fetch_probe_arguments): Pass selected frame
to get_probe_argument_count and evaluate_probe_argument.
* probe.c (get_probe_argument_count): Adjust declaration to accept
frame.  Pass frame to probe_ops's get_probe_argument_count.
(evaluate_probe_argument): Likewise, for evaluate_probe_argument.
(probe_safe_evaluate_at_pc): Pass frame to
get_probe_argument_count and evaluate_probe_argument.
* probe.h (struct probe_ops) <get_probe_argument_count,
evaluate_probe_argument>: Adjust declarations to accept frame.
(get_probe_argument_count, evaluate_probe_argument): Likewise.
* solib-svr4.c (solib_event_probe_action): Get current frame.
Pass it to get_probe_argument_count.
(svr4_handle_solib_event): Get current frame.  Pass it to
get_probe_argument_count and evaluate_probe_argument.
* stap-probe.c (stap_parse_probe_arguments): Adjust declaration to
accept gdbarch.  Do not obtain it from the probe's objfile.
(stap_get_probe_argument_count): Adjust declaration to accept
frame.  Obtain gdbarch from the frame.  Call generic
can_evaluate_probe_arguments.  Pass gdbarch to
stap_parse_probe_arguments.
(stap_get_arg): Adjust declaration to accept gdbarch.  Pass it to
stap_parse_probe_arguments.
(stap_evaluate_probe_argument): Adjust declaration to accept
frame.  Obtain gdbarch from the frame.  Pass gdbarch to
stap_get_arg.
(stap_compile_to_ax): Pass agent_expr's gdbarch to stap_get_arg.
(compute_probe_arg): Obtain gdbarch from frame.  Pass frame to
get_probe_argument_count and evaluate_probe_argument.

10 years agoFix a bug in matching notifications.
Yao Qi [Tue, 10 Dec 2013 13:59:20 +0000 (21:59 +0800)]
Fix a bug in matching notifications.

Due to copy-n-paste, the problem caused PR remote/15974 also exists
in gdbserver.  This patch fixes it in the same way.  Patch to fix
remote/15974 can be found:

  https://sourceware.org/ml/gdb-patches/2013-12/msg00014.html

gdb/gdbserver:

2013-12-11  Yao Qi  <yao@codesourcery.com>

* notif.c (handle_notif_ack): Return 0 if no notification
matches.

10 years agoadd missing PR# to previous entry
Doug Evans [Wed, 11 Dec 2013 00:21:41 +0000 (16:21 -0800)]
add missing PR# to previous entry

10 years agoPR 16286
Doug Evans [Wed, 11 Dec 2013 00:20:08 +0000 (16:20 -0800)]
PR 16286

* c-lang.c (c_get_string): Ignore the declared size of the object
if a specific length is requested.

testsuite/
* gdb.python/py-value.c: #include stdlib.h, string.h.
(str): New struct.
(main): New local xstr.
* gdb.python/py-value.exp (test_value_in_inferior): Add test to
fetch a value as a string with a length beyond the declared length
of the array.

10 years agoDelete interp_exec_p.
Doug Evans [Wed, 11 Dec 2013 00:06:53 +0000 (16:06 -0800)]
Delete interp_exec_p.

     * interps.h (interp_exec_p): Delete.
     * interps.c (interp_exec_p): Delete.
     (interp_exec): Update.  Assert interp->procs->exec_proc != NULL.
     * mi/mi-interp.c (mi_cmd_interpreter_exec): Update.

10 years agoUse $(INSTALL_PROGRAM_ENV) consistently.
Roland McGrath [Tue, 10 Dec 2013 22:01:01 +0000 (14:01 -0800)]
Use $(INSTALL_PROGRAM_ENV) consistently.

binutils/
* Makefile.am (install-exec-local): Prefix libtool invocation with
$(INSTALL_PROGRAM_ENV).
* Makefile.in: Regenerate.

gas/
* Makefile.am (install-exec-bindir): Prefix libtool invocation
with $(INSTALL_PROGRAM_ENV).
(install-exec-tooldir): Likewise.
* Makefile.in: Regenerate.

gold/
* Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
with $(INSTALL_PROGRAM_ENV).
* Makefile.in: Regenerate.

ld/
* Makefile.am (install-exec-local): Prefix libtool invocation with
$(INSTALL_PROGRAM_ENV).
* Makefile.in: Regenerate.

10 years agodaily update
Alan Modra [Tue, 10 Dec 2013 23:00:38 +0000 (09:30 +1030)]
daily update

10 years agoAdd call to get_compiler_info to gdb_compile_shlib.
Andrew Burgess [Tue, 10 Dec 2013 17:04:17 +0000 (17:04 +0000)]
Add call to get_compiler_info to gdb_compile_shlib.

    https://sourceware.org/ml/gdb-patches/2013-12/msg00374.html

gdb/testsuite/ChangeLog

* lib/gdb.exp (gdb_compile_shlib): Add call to get_compiler_info,
update comment.

10 years agoUse target_read_code in skip_prologue (amd64)
Yao Qi [Wed, 23 Oct 2013 13:49:32 +0000 (21:49 +0800)]
Use target_read_code in skip_prologue (amd64)

gdb:

2013-12-10  Yao Qi  <yao@codesourcery.com>

* amd64-tdep.c (amd64_analyze_stack_align): Call
target_read_code instead of target_read_memory.
(amd64_analyze_prologue): Call read_code_unsigned_integer
instead of read_memory_unsigned_integer.  Call read_code
instead of read_memory.
(amd64_skip_xmm_prologue): Likewise.

10 years agoUse target_read_code in skip_prologue (i386)
Yao Qi [Fri, 18 Oct 2013 09:36:11 +0000 (17:36 +0800)]
Use target_read_code in skip_prologue (i386)

GDB is able to cache memory accesses requested in target_read_code,
so target_read_code is more efficient than general target_read_memory.

This patch uses target_read_code and its variants to read target
memory in the functions related to i386_skip_prologue.  It improves
the performance when doing 'b foo' (foo is a function) in remote
debugging.

Nowadays, when we set a breakpoint on function f1, GDB will fetch the
code in f1 to determine the start of the function body (say skip the
prologue), it requests read from target many times.  With this patch
applied, the number of RSP 'm' packets are reduced.

gdb:

2013-12-10  Yao Qi  <yao@codesourcery.com>

* corefile.c (read_code): New function.
(read_code_integer): New function.
(read_code_unsigned_integer): New function.
* gdbcore.h (read_code): Declare.
(read_code_integer): Declare.
(read_code_unsigned_integer): Declare.
* i386-tdep.c (i386_follow_jump): Call target_read_code instead
of target_read_memory.  Call read_code_unsigned_integer instead
of read_memory_unsigned_integer.
(i386_analyze_struct_return): Likewise.
(i386_skip_probe): Likewise.
(i386_analyze_stack_align): Likewise.
(i386_match_pattern): Likewise.
(i386_skip_noop): Likewise.
(i386_analyze_frame_setup): Likewise.
(i386_analyze_register_saves): Likewise.
(i386_skip_prologue): Likewise.
(i386_skip_main_prologue): Likewise.
(i386_frame_cache_1): Likewise.

10 years agoInvalidate target cache before starting to handle event.
Yao Qi [Wed, 4 Dec 2013 01:28:44 +0000 (09:28 +0800)]
Invalidate target cache before starting to handle event.

gdb:

2013-12-10  Yao Qi  <yao@codesourcery.com>

* infrun.c: Include "target-dcache.h".
(prepare_for_detach): Call target_dcache_invalidate.
(wait_for_inferior): Likewise.
(fetch_inferior_event): Likewise.
(infrun_thread_stop_requested_callback): Likewise.  Set
overlay_cache_invalid to 1.

10 years agoSet language for Ada minimal symbols.
Joel Brobecker [Thu, 7 Nov 2013 04:35:35 +0000 (08:35 +0400)]
Set language for Ada minimal symbols.

This helps with the following issue: Given an Ada program defining
a global variable:

    package Pck is
       Watch : Integer := 1974;
    end Pck;

When printing the address of this variable, GDB also tries to print
the associated symbol name:

    (gdb) p watch'address
    $1 = (access integer) 0x6139d8 <pck__watch>
                                       ^^
                                       ||

The problem is that GDB prints the variable's linkage name, instead
of its natural name. This is because the language of the associated
minimal symbol never really gets set.

This patch adds handling for Ada symbols in symbol_find_demangled_name.
After this patch, we now get:

    (gdb) p watch'address
    $1 = (access integer) 0x6139d8 <pck.watch>
                                       ^
                                       |

gdb/ChangeLog:

        * symtab.c (symbol_find_demangled_name): Add handling of
        Ada symbols.

gdb/testsuite/ChangeLog:

        * gdb.ada/int_deref.exp: Add test verifying that we print
        the decoded symbol name when printing the address of Ada
        symbols.

10 years agoGDB/MI: Document support for -exec-run --start in -list-features
Joel Brobecker [Tue, 3 Dec 2013 06:04:32 +0000 (10:04 +0400)]
GDB/MI: Document support for -exec-run --start in -list-features

This adds "exec-run-start-option" in the output of the -list-features
commands, allowing front-ends to easily determine whether -exec-run
supports the --start option.

gdb/ChangeLog:

        * mi/mi-main.c (mi_cmd_list_features): add "exec-run-start-option".
        * NEWS: Expand the entry documenting the new -exec-run --start
        option to mention the corresponding new entry in the output of
        "-list-features".

gdb/doc/ChangeLog:

* gdb.texinfo (GDB/MI Miscellaneous Commands): Document the new
"exec-run-start-option" entry in the output of the "-list-features"
command.

gdb/testsuite/ChangeLog:

        * gdb.mi/mi-start.exp: Add test verifying that -list-features
        contains "exec-run-start-option".

10 years agonameless LOAD_DLL_DEBUG_EVENT causes ntdll.dll to be missing
Joel Brobecker [Wed, 20 Nov 2013 17:43:20 +0000 (12:43 -0500)]
nameless LOAD_DLL_DEBUG_EVENT causes ntdll.dll to be missing

We observed on Windows 2012 that we were unable to unwind past
exception handlers. For instance, with any Ada program raising
an exception that does not get handled:

    % gnatmake -g a -bargs -shared
    % gdb a
    (gdb) start
    (gdb) catch exception unhandled
    Catchpoint 2: unhandled Ada exceptions
    (gdb) c
    Catchpoint 2, unhandled CONSTRAINT_ERROR at <__gnat_unhandled_exception> (
        e=0x645ff820 <constraint_error>) at s-excdeb.adb:53
    53      s-excdeb.adb: No such file or directory.

At this point, we can already see that something went wrong, since
the frame selected by the debugger corresponds to a runtime function
rather than the function in the user code that caused the exception
to be raised (in our case procedure A).

This is further confirmed by the fact that we are unable to unwind
all the way to procedure A:

    (gdb) bt
    #0  <__gnat_unhandled_exception> (e=0x645ff820 <constraint_error>)
        at s-excdeb.adb:53
    #1  0x000000006444e9a3 in <__gnat_notify_unhandled_exception> (excep=0x284d2
+0)
        at a-exextr.adb:144
    #2  0x00000000645f106a in __gnat_personality_imp ()
       from C:\[...]\libgnat-7.3.dll
    #3  0x000000006144d1b7 in _GCC_specific_handler (ms_exc=0x242fab0,
        this_frame=0x242fe60, ms_orig_context=0x242f5c0, ms_disp=0x242ef70,
        gcc_per=0x645f0960 <__gnat_personality_imp>)
        at ../../../src/libgcc/unwind-seh.c:289
    #4  0x00000000645f1211 in __gnat_personality_seh0 ()
       from C:\[...]\libgnat-7.3.dll
    #5  0x000007fad3879f4d in ?? ()
    Backtrace stopped: previous frame inner to this frame (corrupt stack?)

It turns out that the unwinder has been doing its job flawlessly
up until frame #5. The address in frame #5 is correct, but GDB
is not able to associate it with any symbol or unwind record.

And this is because this address is inside ntdll.dll, and when
we received the LOAD_DLL_DEBUG_EVENT for that DLL, the system
was not able to tell us the name of the library, thus causing us
to silently ignoring the event. Because GDB does not know about
ntdll.dll, it is unable to access the unwind information from it.
And because the function at that address does not use a frame
pointer, the unwinding becomes impossible.

This patch helps recovering ntdll.dll at the end of the "run/attach"
phase, simply by trying to locate that specific DLL again.

In terms of our medium to long term planning, it seems to me that
we should be able to simplify the code by ignoring LOAD_DLL_DEBUG_EVENT
during the startup phase, and modify windows_ensure_ntdll_loaded
to then detect and report all shared libraries after we've finished
inferior creation.  But for a change just before 7.7 branch creation,
I thought it was safest to just handle ntdll.dll specifically. This
is less intrusive, and ntdll is the only DLL affected by the problem
I know so far.

gdb/ChangeLog:

* windows-nat.c (handle_load_dll): Add comments.
        (windows_ensure_ntdll_loaded): New function.
(do_initial_windows_stuff): Use windows_ensure_ntdll_loaded.
        Add FIXME comment.

10 years agodaily update
Alan Modra [Mon, 9 Dec 2013 23:00:46 +0000 (09:30 +1030)]
daily update

10 years agodaily update
Alan Modra [Sun, 8 Dec 2013 23:00:52 +0000 (09:30 +1030)]
daily update

10 years agoFix gdb/ChangeLog date in last entry.
Joel Brobecker [Sun, 8 Dec 2013 08:28:10 +0000 (12:28 +0400)]
Fix gdb/ChangeLog date in last entry.

10 years agoUse gdb_produce_source
Yao Qi [Tue, 24 Sep 2013 09:52:27 +0000 (17:52 +0800)]
Use gdb_produce_source

We added a new proc gdb_produce_source recently, and it can be used
more widely in lib/gdb.exp to generate source file.

gdb/testsuite:

2013-12-08  Yao Qi  <yao@codesourcery.com>

* lib/gdb.exp (support_complex_tests): Use gdb_produce_source.
(is_elf_target, is_ilp32_target, is_ilp64_target): Likewise.
(is_64_target, is_amd64_regs_target): Likewise.
(skip_altivec_tests, skip_vsx_tests, skip_btrace_tests): Likewise.

10 years agocorrect file reference
Alan Modra [Sun, 8 Dec 2013 05:10:43 +0000 (15:40 +1030)]
correct file reference

10 years agoFix --as-needed undefined symbol references from dynamic libraries.
Alan Modra [Sun, 8 Dec 2013 04:56:12 +0000 (15:26 +1030)]
Fix --as-needed undefined symbol references from dynamic libraries.

libx.so refers to some_sym, liby.so provides some_sym@some_version
wasn't seen as satisfying the reference.

* elf64-ppc.c (_bfd_elf_add_default_symbol): Set dynamic_def
and ref_dynamic_nonweak when chaining together indirect
symbols.

10 years agoDocument the GDB 7.6.2 release in gdb/ChangeLog
Joel Brobecker [Sun, 8 Dec 2013 04:40:37 +0000 (08:40 +0400)]
Document the GDB 7.6.2 release in gdb/ChangeLog

gdb/ChangeLog:

GDB 7.6.2 released.

10 years agoAvoid "may be used uninitialized" warning
Yao Qi [Sun, 8 Dec 2013 02:34:34 +0000 (10:34 +0800)]
Avoid "may be used uninitialized" warning

Hi,
I see such warning below on one compiler I am using.

cc1: warnings being treated as errors
../../workspace/gdb/stack.c: In function 'frame_info':
../../workspace/gdb/stack.c:1519:20: error: 'caller_pc' may be used uninitialized in this function

Go through the gdb-patches archives and find the "canonical" way to
fix this warning is to initialize the variable.

gdb:

2013-12-08  Yao Qi  <yao@codesourcery.com>

* stack.c (frame_info): Initialize variable caller_pc.

10 years agodaily update
Alan Modra [Sat, 7 Dec 2013 23:00:56 +0000 (09:30 +1030)]
daily update

10 years agosim: bfin: tests: make run-tests.sh executable
Mike Frysinger [Wed, 3 Jul 2013 15:27:46 +0000 (11:27 -0400)]
sim: bfin: tests: make run-tests.sh executable

I meant for this script to be +x, but missed when doing the initial CVS
commit.  It wasn't possible to fix w/CVS, but it is w/git, so do it.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-12-03  Mike Frysinger  <vapier@gentoo.org>

* run-tests.sh: Add +x file mode.

10 years agostrip off +x bits on non-executable/script files
Mike Frysinger [Wed, 4 Dec 2013 00:40:24 +0000 (19:40 -0500)]
strip off +x bits on non-executable/script files

These files are source files and have no business being +x.  We couldn't
easily fix it in CVS (you need login+write access to the raw rcs files),
but we can fix this w/git.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
10 years agogdb: testsuite: fix ksh shebang to use sh
Mike Frysinger [Wed, 4 Dec 2013 00:32:17 +0000 (19:32 -0500)]
gdb: testsuite: fix ksh shebang to use sh

These scripts use /bin/ksh, but they're dirt simple and can be used with
/bin/sh, so just change the shebang.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
10 years agodaily update
Alan Modra [Fri, 6 Dec 2013 23:46:29 +0000 (10:16 +1030)]
daily update

10 years agoFix "info frame" in the outermost frame.
Pedro Alves [Fri, 6 Dec 2013 19:48:00 +0000 (19:48 +0000)]
Fix "info frame" in the outermost frame.

Doing "info frame" in the outermost frame, when that was indicated by
the next frame saying the unwound PC is undefined/not saved, results
in error and incomplete output:

 (gdb) bt
 #0  thread_function0 (arg=0x0) at threads.c:63
 #1  0x00000034cf407d14 in start_thread (arg=0x7ffff7fcb700) at pthread_create.c:309
 #2  0x000000323d4f168d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115

 (gdb) frame 2
 #2  0x000000323d4f168d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115
 115             call    *%rax

 (gdb) info frame
 Stack level 2, frame at 0x0:
  rip = 0x323d4f168d in clone (../sysdeps/unix/sysv/linux/x86_64/clone.S:115); saved rip Register 16 was not saved
 (gdb)

Not saved register values are treated as optimized out values
internally throughout.  stack.c:frame_info is handing unvailable
values, but not optimized out ones.  The patch deletes the
frame_unwind_caller_pc_if_available wrapper function and instead lets
errors propagate to frame_info (it's only user).

As frame_unwind_pc now needs to be able to handle and cache two
different error scenarios, the prev_pc.p variable is replaced with an
enumeration.

(FWIW, I looked into making gdbarch_unwind_pc or a variant return
struct value's instead, but it results in lots of boxing and unboxing
for no real gain -- e.g., the mips and arm implementations need to do
computation on the unboxed PC value.  Might as well throw an error on
first attempt to get at invalid contents.)

After the patch, we get:

 (gdb) info frame
 Stack level 2, frame at 0x0:
  rip = 0x323d4f168d in clone (../sysdeps/unix/sysv/linux/x86_64/clone.S:115); saved rip = <not saved>
  Outermost frame: outermost
  caller of frame at 0x7ffff7fcafc0
  source language asm.
  Arglist at 0x7ffff7fcafb8, args:
  Locals at 0x7ffff7fcafb8, Previous frame's sp is 0x7ffff7fcafc8
 (gdb)

A new test is added.  It's based off dw2-reg-undefined.exp, and tweaked to
mark the return address (rip) of "stop_frame" as undefined.

Tested on x86_64 Fedora 17.

gdb/
2013-12-06  Pedro Alves  <palves@redhat.com>

* frame.c (enum cached_copy_status): New enum.
(struct frame_info) <prev_pc.p>: Change type to enum
cached_copy_status.
(fprint_frame): Handle not saved and unavailable prev_pc values.
(frame_unwind_pc_if_available): Delete and merge contents into ...
(frame_unwind_pc): ... here.  Handle OPTIMIZED_OUT_ERROR.  Adjust
to use enum cached_copy_status.
(frame_unwind_caller_pc_if_available): Delete.
(create_new_frame): Adjust.
* frame.h (frame_unwind_caller_pc_if_available): Delete
declaration.
* stack.c (frame_info): Use frame_unwind_caller_pc instead of
frame_unwind_caller_pc_if_available, and handle
NOT_AVAILABLE_ERROR and OPTIMIZED_OUT_ERROR errors.
* valprint.c (val_print_optimized_out): Use val_print_not_saved.
(val_print_not_saved): New function.
* valprint.h (val_print_not_saved): Declare.

gdb/testsuite/
2013-12-06  Pedro Alves  <palves@redhat.com>

* gdb.dwarf2/dw2-undefined-ret-addr.S: New file.
* gdb.dwarf2/dw2-undefined-ret-addr.c: New file.
* gdb.dwarf2/dw2-undefined-ret-addr.exp: New file.

10 years agoNew OPTIMIZED_OUT_ERROR error code.
Pedro Alves [Fri, 6 Dec 2013 19:48:54 +0000 (19:48 +0000)]
New OPTIMIZED_OUT_ERROR error code.

In order to catch <optimized out> errors like we catch <unavailable>
errors, this adds a new OPTIMIZED_OUT_ERROR error code, and throws it
in various places.

gdb/ChangeLog
2013-12-06  Andrew Burgess  <aburgess@broadcom.com>
    Pedro Alves  <palves@redhat.com>

* exceptions.h (errors): Add OPTIMIZED_OUT_ERROR.
* dwarf2loc.c (write_pieced_value): Throw OPTIMIZED_OUT_ERROR.
* frame.c (frame_unwind_register): Throw OPTIMIZED_OUT_ERROR.
* spu-tdep.c (spu_software_single_step): Throw
OPTIMIZED_OUT_ERROR.
* valops.c (value_assign): Throw OPTIMIZED_OUT_ERROR.

10 years agoupdate free_objfile comment
Tom Tromey [Tue, 26 Nov 2013 21:39:08 +0000 (14:39 -0700)]
update free_objfile comment

The introductory comment to free_objfile is obsolete.
This patch fixes it by removing all the obsolete bits.

2013-12-06  Tom Tromey  <tromey@redhat.com>

* objfiles.c (free_objfile): Update comment.

10 years agoremove objfile_to_front
Tom Tromey [Mon, 25 Nov 2013 16:53:06 +0000 (09:53 -0700)]
remove objfile_to_front

I happened to notice that nothing uses objfile_to_front.
This patch removes it.

2013-12-06  Tom Tromey  <tromey@redhat.com>

* objfiles.h (objfile_to_front): Remove.
* objfiles.c (objfile_to_front): Remove.

10 years agoremove unnecessary declaration
Tom Tromey [Mon, 25 Nov 2013 16:51:25 +0000 (09:51 -0700)]
remove unnecessary declaration

This removes an unnecessary declaration from minsyms.c.

2013-12-06  Tom Tromey  <tromey@redhat.com>

* minsyms.c (get_symbol_leading_char): Remove unnecessary
declaration.

10 years agopack partial_symtab for space
Tom Tromey [Mon, 25 Nov 2013 16:34:49 +0000 (09:34 -0700)]
pack partial_symtab for space

This improves the packing of struct partial_symtab.  I noticed with
pahole that were were a couple of holes.  This consolidates the holes
without, I think, affecting readability -- it just moves the "user"
field a bit earlier in the struct.  This change saves a small amount
of memory.

2013-12-06  Tom Tromey  <tromey@redhat.com>

* psympriv.h (struct partial_symtab) <user>: Move earlier.

10 years agofix a couple of FIXMEs
Tom Tromey [Mon, 25 Nov 2013 15:47:51 +0000 (08:47 -0700)]
fix a couple of FIXMEs

This fixes a couple of old "32x64" FIXME comments by using paddress
with current_gdbarch rather than hex_string and a cast to long.

2013-12-06  Tom Tromey  <tromey@redhat.com>

* cli/cli-cmds.c (edit_command): Use paddress, not hex_string.
(list_command): Likewise.

10 years agoput the psymtab filename in the filename bcache
Tom Tromey [Mon, 25 Nov 2013 14:55:23 +0000 (07:55 -0700)]
put the psymtab filename in the filename bcache

This puts the psymtab filename in the filename bcache.
This saves a small amount of memory.

2013-12-06  Tom Tromey  <tromey@redhat.com>

* psymtab.c (allocate_psymtab): Put the filename in the filename
bcache.

10 years agomake symtab::dirname const
Tom Tromey [Mon, 25 Nov 2013 14:40:05 +0000 (07:40 -0700)]
make symtab::dirname const

This makes symtab::dirname const and updates one spot to avoid an
intermediate constless result.

2013-12-06  Tom Tromey  <tromey@redhat.com>

* buildsym.c (end_symtab_from_static_block): Use obstack_copy0.
* symtab.h (struct symtab) <dirname>: Now const.

10 years agomake symtab::filename const
Tom Tromey [Mon, 25 Nov 2013 14:32:35 +0000 (07:32 -0700)]
make symtab::filename const

This makes symtab::filename const and removes a newly unnecessary
cast.

2013-12-06  Tom Tromey  <tromey@redhat.com>

* symfile.c (allocate_symtab): Remove cast.
* symtab.h (struct symtab) <filename>: Now const.

10 years ago * gdb.base/break.exp: Fix setting of $baz.
Doug Evans [Fri, 6 Dec 2013 18:19:01 +0000 (10:19 -0800)]
* gdb.base/break.exp: Fix setting of $baz.

10 years agoremove some sym_probe_fns methods
Tom Tromey [Mon, 2 Dec 2013 19:13:29 +0000 (12:13 -0700)]
remove some sym_probe_fns methods

While looking into the probe API, it seemed to me that there were a
number of methods in sym_probe_fns that were not needed.  This patch
removes them.

Specifically, it seems to me that sym_probe_fns ought to be concerned
with the API for constructing the probes.  Any method relating to some
aspect of an individual probe can be handled via the probe's own
vtable.  That is, the double indirection here doesn't seem useful --
it certainly isn't in fact used, but also I couldn't think of a
potential use.

2013-12-06  Tom Tromey  <tromey@redhat.com>

* break-catch-throw.c (fetch_probe_arguments): Use
get_probe_argument_count and evaluate_probe_argument.
* elfread.c (elf_get_probe_argument_count)
(elf_can_evaluate_probe_arguments, elf_evaluate_probe_argument)
(elf_compile_to_ax): Remove.
(elf_probe_fns): Update.
* probe.c (get_probe_argument_count, can_evaluate_probe_arguments)
(evaluate_probe_argument): Call method on probe, not via sym
functions.
* stap-probe.c (compute_probe_arg): Use get_probe_argument_count,
evaluate_probe_argument.
(compile_probe_arg): Use get_probe_argument_count.  Call method on
probe, not via sym functions.
* symfile-debug.c (debug_sym_get_probe_argument_count)
(debug_can_evaluate_probe_arguments)
(debug_sym_evaluate_probe_argument, debug_sym_compile_to_ax):
Remove.
(debug_sym_probe_fns): Remove.
* symfile.h (struct sym_probe_fns) <sym_get_probe_argument_count,
can_evaluate_probe_arguments, sym_evaluate_probe_argument,
sym_compile_to_ax>: Remove fields.

10 years agoAdd support for DW_OP_bit_piece and DW_OP_plus_uconst to DWARF assembler.
Andrew Burgess [Fri, 6 Dec 2013 13:27:24 +0000 (13:27 +0000)]
Add support for DW_OP_bit_piece and DW_OP_plus_uconst to DWARF assembler.

  https://sourceware.org/ml/gdb-patches/2013-12/msg00143.html

gdb/testsuite/ChangeLog

* lib/dwarf.exp: (Dwarf::_location): Handle DW_OP_bit_piece and
DW_OP_plus_uconst.

10 years agoAdd epilog unwind for x86_64 pe/coff
Tristan Gingold [Wed, 4 Dec 2013 13:53:12 +0000 (14:53 +0100)]
Add epilog unwind for x86_64 pe/coff

include/coff/
2013-12-06  Tristan Gingold  <gingold@adacore.com>

* pe.h (UWOP_EPILOG, UWOP_PARE): Define.

bfd/
2013-12-06  Tristan Gingold  <gingold@adacore.com>

* pei-x86_64.c (pex64_xdata_print_uwd_codes): Add argument rf.
Display epilog opcode.
(pex64_dump_xdata): Add argument rf; make addr a local variable.
Adjust call to pex64_xdata_print_uwd_codes.
(pex64_bfd_print_pdata): Display code range, adjust call to
pex64_dump_xdata.

10 years agotestsuite: introduce index in varobj child eval.
Keven Boell [Thu, 21 Nov 2013 09:54:47 +0000 (10:54 +0100)]
testsuite: introduce index in varobj child eval.

In some languages, e.g. fortran, arrays start with index 1
instead 0. This patch changes the MI library to support testing
varobj children of fortran arrays.

2013-11-21  Keven Boell  <keven.boell@intel.com>

testsuite/

* lib/mi-support.exp (mi_list_varobj_children_range): Add
call to mi_list_array_varobj_children_with_index.
(mi_list_array_varobj_children_with_index): New function.
Add parameter to specify array start.

10 years ago Fix completion for pascal language.
Pierre Muller [Sun, 17 Nov 2013 19:42:16 +0000 (20:42 +0100)]
   Fix completion for pascal language.
       * p-exp.y (exp : field_exp name): Do not call mark_struct_expression.
       (exp : field_exp name COMPLETE): New rule.
       (exp : SIZEOF): Set correct current_type.
       (last_was_structop): Remove static variable.
       (yylex): Remove saw_structop local variable.
       Adapt code to removal of variables above.

10 years agoUninitialized variable "this_id" in frame.c:get_prev_frame_1.
Joel Brobecker [Thu, 5 Dec 2013 12:17:40 +0000 (13:17 +0100)]
Uninitialized variable "this_id" in frame.c:get_prev_frame_1.

With a simple Ada program where I have 3 functions, one just calling
the next, the backtrace is currently broken when GDB is compiled
at -O2:

   #0  hello.first () at hello.adb:5
   #1  0x0000000100001475 in hello.second () at hello.adb:10
   Backtrace stopped: previous frame inner to this frame (corrupt stack?)

It turns out that a recent patch deleted the assignment of variable
this_id, making it an unitialized variable:

        * frame-unwind.c (default_frame_unwind_stop_reason): Return
        UNWIND_OUTERMOST if the frame's ID is outer_frame_id.
        * frame.c (get_prev_frame_1): Remove outer_frame_id check.

The hunk in question starts with:

-  /* Check that this frame is not the outermost.  If it is, don't try
-     to unwind to the prev frame.  */
-  this_id = get_frame_id (this_frame);
-  if (frame_id_eq (this_id, outer_frame_id))

(the code was removed as redundant - but removing the assignment
was in fact not intentional).

There is no other code in this function that sets the variable.
Instead of re-adding the statement in the lone section where it is
actually used, I inlined it, and then got rid of the variable
altogether.  This way, and until we start needing this frame ID
in another location within that function, we dont' have to worry
about the variable's validity/lifetime.

gdb/ChangeLog:

        * frame.c (get_prev_frame_1): Delete variable "this_id".
        Replace its use by a call to get_frame_id.

10 years agodaily update
Alan Modra [Thu, 5 Dec 2013 23:00:02 +0000 (09:30 +1030)]
daily update

10 years agoAdd software single step support to moxie port
Anthony Green [Thu, 5 Dec 2013 15:25:03 +0000 (10:25 -0500)]
Add software single step support to moxie port

10 years agoinclude/ * longlong.h: New file.
rsandifo [Wed, 4 Dec 2013 10:49:14 +0000 (10:49 +0000)]
include/ * longlong.h: New file.

libgcc/
* longlong.h: Delete (moved to include/).

libquadmath/
* Makefile.am (AM_CPPFLAGS): Define.
* Makefile.in: Regenerate.
* printf/gmp-impl.h: Remove path from longlong.h include.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205659 138bc75d-0d04-0410-961f-82ee72b054a4

10 years ago * s390-mkopc.c (dumpTable): Provide a format string to printf so
Nick Clifton [Thu, 5 Dec 2013 13:36:17 +0000 (13:36 +0000)]
* s390-mkopc.c (dumpTable): Provide a format string to printf so
that compiling with -Werror=format-security does not produce an
error.

10 years agoClear allocated target data.
Tristan Gingold [Thu, 5 Dec 2013 10:15:09 +0000 (11:15 +0100)]
Clear allocated target data.

2013-12-05  Tristan Gingold  <gingold@adacore.com>

* mach-o.c (bfd_mach_o_mkobject_init): Use bfd_zalloc.

10 years agofix date in previous entry
Doug Evans [Thu, 5 Dec 2013 06:12:54 +0000 (22:12 -0800)]
fix date in previous entry

10 years ago * auto-load.c (load_auto_scripts_for_objfile): Add some comments.
Doug Evans [Thu, 5 Dec 2013 06:08:38 +0000 (22:08 -0800)]
* auto-load.c (load_auto_scripts_for_objfile): Add some comments.

10 years agoAllow Windows UNWIND_INFO version 2.
Joel Brobecker [Wed, 20 Nov 2013 17:57:33 +0000 (12:57 -0500)]
Allow Windows UNWIND_INFO version 2.

We've observed in Windows 2012 that ntdll.dll contains some unwind
records with the version field set to 2.  This patch adjusts the
decoder to accept records flagged with this version as well.

Version 2 appears to still be largely undocumented at this stage.
However, apart from a mysterious opcode 6, everything else still
seems to remain the same. So this patch also changes the decoder
to ignore those opcodes; before this change, the debugger would
silently stop the decoding, and let the frame unwinder make do
with what it the decoder managed to decode up to that point.

It's unclear at this point what we're losing by not being able to
decode that opcode. But the information does not appear to be critical,
at least as far as call unwinding is concerned.

gdb/ChangeLog:

(from Tristan Gingold  <gingold@adacore.com>)
(from Joel Brobecker  <brobecker@adacore.com>)
* amd64-windows-tdep.c (amd64_windows_frame_decode_insns):
Accept version 2.  Ignore operations using opcode 6.

10 years agoMinor coding-style fixes in ada-lex.l:find_dot_all.
Joel Brobecker [Wed, 27 Nov 2013 15:10:14 +0000 (19:10 +0400)]
Minor coding-style fixes in ada-lex.l:find_dot_all.

gdb/ChangeLog:

        * ada-lex.l (find_dot_all): Fix coding style violations.

10 years agodaily update
Alan Modra [Wed, 4 Dec 2013 23:00:01 +0000 (09:30 +1030)]
daily update

10 years agoFix the manual more thoroughly.
Eli Zaretskii [Wed, 4 Dec 2013 17:44:30 +0000 (19:44 +0200)]
Fix the manual more thoroughly.

10 years agodoc/gdb.texinfo (i386): Fix yesterday's commit.
Eli Zaretskii [Wed, 4 Dec 2013 16:12:16 +0000 (18:12 +0200)]
doc/gdb.texinfo (i386): Fix yesterday's commit.

10 years agodaily update
Alan Modra [Tue, 3 Dec 2013 23:00:18 +0000 (09:30 +1030)]
daily update

10 years agoadd @kindex for catchpoints
Tom Tromey [Tue, 3 Dec 2013 20:04:16 +0000 (13:04 -0700)]
add @kindex for catchpoints

I wanted to find the docs for "catch load" the other day, and I found
out that this isn't in the index.  It seems to me that each command
ought to be in the index for quick reference like this, so this patch
adds an @kindex (chosen because it seems to be what the rest of the
manual does) for each "catch" subcommand.

2013-12-03  Tom Tromey  <tromey@redhat.com>

* gdb.texinfo (Set Catchpoints): Add @kindex for each command
documented here.

10 years agoadd "dir" menu item for gdbserver
Tom Tromey [Tue, 3 Dec 2013 20:02:48 +0000 (13:02 -0700)]
add "dir" menu item for gdbserver

I happened to notice that the gdbserver program doesn't appear in the
top-level "dir" file.  This adds an entry for it to the gdb manual.

2013-12-03  Tom Tromey  <tromey@redhat.com>

* gdb.texinfo (@direntry): Add menu item for gdbserver.

10 years agoFix crash on intelbad.
Tristan Gingold [Tue, 3 Dec 2013 15:46:59 +0000 (16:46 +0100)]
Fix crash on intelbad.

gas/
2013-12-03  Tristan Gingold  <gingold@adacore.com>

* config/tc-i386-intel.c (i386_intel_simplify): Avoid arithmetic
overflow on pointers.

10 years ago * peXXigen.c (pe_print_resource_entries): New function: Displays
Nick Clifton [Tue, 3 Dec 2013 13:57:56 +0000 (13:57 +0000)]
* peXXigen.c (pe_print_resource_entries): New function: Displays
an entry in a .rsrc section.
(pe_print_resource_directory): New function: Displays a directory
in a .rsrc section.
(pe_print_rsrc): New function: Displays the contents of .rsrc
section.
(_bfd_XX_print_private_bfd_data_common): Call pe_print_rsrc.

* binutils-all/windres/windres.exp: Run for x86_64-pc-cygwin.
Add test of "objump -p" output.

10 years agoDocumentation for MPX.
Walfred Tedeschi [Tue, 3 Dec 2013 13:31:03 +0000 (13:31 +0000)]
Documentation for MPX.

2013-11-20  Walfred Tedeschi  <walfred.tedeschi@intel.com>

* NEWS:  Add section for Intel(R) Architecture Instructions
Extesions mentioning MPX.
doc/
* gdb.texinfo (i386 Features): Add MPX feature registers.
(x86 Specific featuresx86 Architecture-specific Issues): Adds
a subsubsection for MPX and describes the display of the
boundary registers.

Signed-off-by: Walfred Tedeschi <walfred.tedeschi@intel.com>
10 years agoFixed typo in date in testsuite/ChangeLog entry
Jose E. Marchesi [Tue, 3 Dec 2013 12:41:30 +0000 (04:41 -0800)]
Fixed typo in date in testsuite/ChangeLog entry

10 years agotestsuite: handle SIGLOST/SIGPWR conflict in sparc64-*-linux-gnu targets.
Jose E. Marchesi [Tue, 3 Dec 2013 12:29:02 +0000 (04:29 -0800)]
testsuite: handle SIGLOST/SIGPWR conflict in sparc64-*-linux-gnu targets.

2013-10-03  Jose E. Marchesi  <jose.marchesi@oracle.com>

* gdb.base/sigall.exp (test_one_sig): gdb identifies SIGLOST as a
SIGPWR in sparc64.

* gdb.base/sigall.c (main): In some targets SIGLOST and SIGPWR
have the same signal number.  Handle this situation.

10 years agoAda: Reserved word "all" should not need to be spelled in lowercase.
Joel Brobecker [Wed, 27 Nov 2013 14:47:40 +0000 (18:47 +0400)]
Ada: Reserved word "all" should not need to be spelled in lowercase.

Consider the following code:

   type Ptr is access all Integer;
   IP : Ptr := new Integer'(123);

IP is the Ada exception of a pointer to an integer. To dereference
the pointer and get its value, the user uses the reserved word "all"
as follow:

    (gdb) p ip.all
    $1 = 123

Ada being a case-insensitive language, the casing should not matter.
Unfortunately, for the reserved word "all", things don't work. For
instance:

    (gdb) p ip.ALL
    Type integer is not a structure or union type

This patch fixes the problem.

gdb/ChangeLog:

* ada-lex.l (find_dot_all): Use strncasecmp instead of strncmp.

gdb/testsuite/ChangeLog:

        * gdb.ada/dot_all: New testcase.

10 years agocrash evaluating bogus exception condition expression (sparc-solaris)
Joel Brobecker [Tue, 29 Oct 2013 10:36:58 +0000 (11:36 +0100)]
crash evaluating bogus exception condition expression (sparc-solaris)

With a program raising an exception, trying to debug that program
in GDB/MI mode can yield a crash:

    % gdb -i=mi foo
    (gdb)
    -catch-exception -e "Program_Error"
    ^done,bkptno="2",bkpt={number="2",type="breakpoint",[...]
    (gdb)
    -exec-continue
    ^running
    *running,thread-id="all"
    (gdb)
    =library-loaded,id=[...]
    &"warning: failed to reevaluate internal exception condition for catchpoint 2: Error in expression, near `'.\n"
    zsh: 22956 bus error (core dumped)  gdb -q -i=mi foo

The problem is triggered by a problem in the compiler which causes
EXP in the following TRY_CATCH block to change unexpectedly when
parse_exp_1 throws an error :

   |      TRY_CATCH (e, RETURN_MASK_ERROR)
   |        {
   |          exp = parse_exp_1 (&s, bl->address,
   |                             block_for_pc (bl->address), 0);
   |        }

In ada-lang.c:create_excep_cond_exprs, EXP is initialized to NULL,
and is expected to remain NULL if parse_exp_1 throws.  Instead,
its value gets changed to something invalid.  This later crashes
the debugger, when trying to evaluate the bogus expression.

This patch works around the issue by simply forcing EXP back to NULL
when an exception was thrown. A comment explaining why, and the sort
of timeline we're looking at for a fix, is also added.

gdb/ChangeLog:

        * ada-lang.c (create_excep_cond_exprs): Force EXP to NULL
        when parse_exp_1 threw an error.  Add comment.

10 years agoNEWS: Extend documentation of the new GDB/MI --language option.
Joel Brobecker [Tue, 3 Dec 2013 04:58:47 +0000 (08:58 +0400)]
NEWS: Extend documentation of the new GDB/MI --language option.

This patch extends a bit the news entry we added which documents
general support of the --language option, to add a small reference
to the associated entry which was also added to the "-list-features"
command output.

gdb/ChangeLog:

        * NEWS: Mention "-list-features" in the entry documenting
        the support for the "--language" option.

10 years agoMore PowerPC64 ELFv2 --just-symbols fixes
Alan Modra [Tue, 3 Dec 2013 07:18:31 +0000 (17:48 +1030)]
More PowerPC64 ELFv2 --just-symbols fixes

I don't know what I was thinking here to omit the save of r2.
Possibly I was looking at -msave-toc-indirect code at the time, where
r2 is saved in the function prologue.

* elf64-ppc.c (ppc_build_one_stub <ppc_stub_plt_branch_r2off>):
Don't omit saving of r2 for ELFv2.  Don't addi 2,2,0.
(ppc_size_one_stub <ppc_stub_plt_branch_r2off>): Adjust to suit.

10 years agoResurrect gdb-add-index as a contrib script
Samuel Bronson [Fri, 15 Nov 2013 21:09:33 +0000 (16:09 -0500)]
Resurrect gdb-add-index as a contrib script

This includes changes made in Fedora's gdb packaging[1], Doug's
robustness patch[2] from before gdb-add-index was dropped, some
corrections, and some more changes Doug accumulated in the
meantime[3].

[1]: http://pkgs.fedoraproject.org/cgit/gdb.git/log/gdb-gdb-add-index-script.patch?id=fe74423b0812bae6d7bb027584e401a2ac37d24d
[2]: https://sourceware.org/ml/gdb-patches/2010-09/msg00130.html
[3]: https://sourceware.org/ml/gdb-patches/2013-11/msg00297.html

It would be a good idea to mention the existance of this script
in (info "(gdb) Index Files"), but I'm boycotting invariant
sections/cover texts because non-free docs are a PITA, so somebody
else would need to do that.

Summary of previous activity:

97924a9 Actual removal
c29c521 Attempted removal (accidentally left gdb-add-index.sh in place)
c2bbed2 Addition

10 years agoMAINTAINERS (Write After Approval): Add myself to the list.
Samuel Bronson [Thu, 21 Nov 2013 20:47:47 +0000 (15:47 -0500)]
MAINTAINERS (Write After Approval): Add myself to the list.

10 years agoRemove "ada-exceptions" from -list-features output.
Joel Brobecker [Tue, 3 Dec 2013 04:35:13 +0000 (08:35 +0400)]
Remove "ada-exceptions" from -list-features output.

Now that the -info-gdb-mi-command is available, there is no need for
this entry. The entry and associated new commands were added recently
enough that no front-end out there should be depending on it yet.

gdb/ChangeLog:

        * mi/mi-main.c (mi_cmd_list_features): Remove "ada-exceptions".

gdb/doc/ChangeLog:

        * gdb.texinfo (GDB/MI Miscellaneous Commands): Remove the
        documentation of the "ada-exceptions" entry.

10 years agoRemove all trailing spaces in mi/mi-main.c.
Joel Brobecker [Tue, 3 Dec 2013 04:15:08 +0000 (08:15 +0400)]
Remove all trailing spaces in mi/mi-main.c.

No code change, just a mechanical cleanup.

gdb/ChangeLog:

        * mi/mi-main.c: Remove trailing spaces throughout.

10 years agoPowerPC64 linking of --just-symbols objects (klibc)
Alan Modra [Tue, 3 Dec 2013 04:31:20 +0000 (15:01 +1030)]
PowerPC64 linking of --just-symbols objects (klibc)

With -mcmodel=medium we can't assume that a -R object doesn't use
toc-relative addressing if there's no toc.  Lots of things are
accessed via r2, not just the toc/got section.  Also, testing for
.opd is plain wrong for ELFv2.

* elf64-ppc.c (ppc64_elf_link_just_syms): Remove .got check.
Handle ELFv2.

10 years agoAdd "undefined-command" error code at end of ^error result...
Joel Brobecker [Mon, 18 Nov 2013 12:55:16 +0000 (16:55 +0400)]
Add "undefined-command" error code at end of ^error result...

... when trying to execute an undefined GDB/MI command. When trying
to execute a GDB/MI command which does not exist, the current error
result record looks like this:

    -unsupported
    ^error,msg="Undefined MI command: unsupported"

The only indication that the command does not exist is the error
message. It would be a little fragile for a consumer to rely solely
on the contents of the error message in order to determine whether
a command exists or not.

This patch improves the situation by adding concept of error
code, starting with one well-defined error code ("undefined-command")
identifying errors due to a non-existant command. Here is the new
output:

    -unsupported
    ^error,msg="Undefined MI command: unsupported",code="undefined-command"

This error code is only displayed when the corresponding error
condition is met. Otherwise, the error record remains unchanged.
For instance:

    -symbol-list-lines foo.adb
    ^error,msg="-symbol-list-lines: Unknown source file name."

For frontends to be able to know whether they can rely on this
variable, a new entry "undefined-command-error-code" has been
added to the "-list-features" command.  Another option would be
to always generate an error="..." variable (for the default case,
we could decide for instance that the error code is the empty string).
But it seems more efficient to provide that info in "-list-features"
and then only add the error code when meaningful.

gdb/ChangeLog:

        (from Pedro Alves  <palves@redhat.com>)
        (from Joel Brobecker  <brobecker@adacore.com>)
        * exceptions.h (enum_errors) <UNDEFINED_COMMAND_ERROR>: New enum.
        * mi/mi-parse.c (mi_parse): Throw UNDEFINED_COMMAND_ERROR instead
        of a regular error when the GDB/MI command does not exist.
        * mi/mi-main.c (mi_cmd_list_features): Add
        "undefined-command-error-code".
        (mi_print_exception): Print an "undefined-command"
        error code if EXCEPTION.ERROR is UNDEFINED_COMMAND_ERROR.
        * NEWS: Add entry documenting the new "code" variable in
        "^error" result records.

gdb/doc/ChangeLog:

        * gdb.texinfo (GDB/MI Result Records): Fix the syntax of the
        "^error" result record concerning the error message.  Document
        the error code that may also be part of that result record.
        (GDB/MI Miscellaneous Commands): Document the
        "undefined-command-error-code" element in the output of
        the "-list-features" GDB/MI command.

gdb/testsuite/ChangeLog:

        * gdb.mi/mi-undefined-cmd.exp: New testcase.

10 years agoNew GDB/MI command "-info-gdb-mi-command"
Joel Brobecker [Tue, 12 Nov 2013 10:51:30 +0000 (14:51 +0400)]
New GDB/MI command "-info-gdb-mi-command"

This patch adds a new GDB/MI command meant for graphical frontends
trying to determine whether a given GDB/MI command exists or not.

Examples:

    -info-gdb-mi-command unsupported-command
    ^done,command={exists="false"}
    (gdb)
    -info-gdb-mi-command symbol-list-lines
    ^done,command={exists="true"}
    (gdb)

At the moment, this is the only piece of information that this
command returns.

Eventually, and if needed, we can extend it to provide
command-specific pieces of information, such as updates to
the command's syntax since inception.  This could become,
for instance:

    -info-gdb-mi-command symbol-list-lines
    ^done,command={exists="true",features=[]}
    (gdb)
    -info-gdb-mi-command catch-assert
    ^done,command={exists="true",features=["conditions"]}

In the first case, it would mean that no extra features,
while in the second, it announces that the -catch-assert
command in this version of the debugger supports a feature
called "condition" - exact semantics to be documented with
combined with the rest of the queried command's documentation.

But for now, we start small, and only worry about existance.
And to bootstrap the process, I have added an entry in the
output of the -list-features command as well ("info-gdb-mi-command"),
allowing the graphical frontends to go through the following process:

  1. Send -list-features, collect info from there as before;
  2. Check if the output contains "info-gdb-mi-command".
     If it does, then support for various commands can be
     queried though -info-gdb-mi-command. Newer commands
     will be expected to always be checked via this new
     -info-gdb-mi-command.

gdb/ChangeLog:

        * mi/mi-cmds.h (mi_cmd_info_gdb_mi_command): Declare.
        * mi/mi-cmd-info.c (mi_cmd_info_gdb_mi_command): New function.
        * mi/mi-cmds.c (mi_cmds): Add -info-gdb-mi-command command.
        * mi/mi-main.c (mi_cmd_list_features): Add "info-gdb-mi-command"
        field to output of "-list-features".

        * NEWS: Add entry for new -info-gdb-mi-command.

gdb/doc/ChangeLog:

        * gdb.texinfo (GDB/MI Miscellaneous Commands): Document
        the new -info-gdb-mi-command GDB/MI command.  Document
        the meaning of "-info-gdb-mi-command" in the output of
        -list-features.

gdb/testsuite/ChangeLog:

        * gdb.mi/mi-i-cmd.exp: New file.

10 years agodaily update
Alan Modra [Mon, 2 Dec 2013 23:00:01 +0000 (09:30 +1030)]
daily update

10 years agoRecord objfile->original_name as an absolute path
Jan Kratochvil [Mon, 2 Dec 2013 21:24:32 +0000 (22:24 +0100)]
Record objfile->original_name as an absolute path

gdb/
2013-12-02  Doug Evans  <dje@google.com>
    Jan Kratochvil  <jan.kratochvil@redhat.com>

* objfiles.c (allocate_objfile): Save original_name as an absolute
path.
* objfiles.h (struct objfile): Expand comment on original_name.
* source.c (openp): Call gdb_abspath.
* utils.c (gdb_abspath): New function.
* utils.h (gdb_abspath): Declare.

gdb/testsuite/
2013-12-02  Doug Evans  <dje@google.com>

* gdb.dwarf/dwp-symlink.c: Fake out gdb to not load debug info
at start.
* gdb.dwarf/dwp-symlink.exp: Test trying to load dwp when the binary
has been specified with a relative path and we have chdir'd before
accessing the debug info.

10 years agoAdd new target_read_raw_memory function, and consolidate comments.
Pedro Alves [Mon, 2 Dec 2013 10:12:24 +0000 (10:12 +0000)]
Add new target_read_raw_memory function, and consolidate comments.

Tested on x86_64 Fedora 17.

gdb/
2013-12-02  Pedro Alves  <palves@redhat.com>

* dcache.c (dcache_read_line): Use target_read_raw_memory.
* target.c (target_read_raw_memory): New function.
(target_read_stack, target_write_memory, target_write_raw_memory):
Update comment.
(target_read_code): Add comment.
* target.h (target_read_raw_memory): Declare.

10 years agognulib's sys/stat.h always defines S_IRGRP, S_IXGRP, S_IXOTH.
Pedro Alves [Mon, 2 Dec 2013 11:09:24 +0000 (11:09 +0000)]
gnulib's sys/stat.h always defines S_IRGRP, S_IXGRP, S_IXOTH.

Confirmed that cross building a mingw gdb still works, and also made
sure it was gnulib's sys/stat.h that was defining the values, by
hacking the header with #errors where the macros are defined.

gdb/
2013-12-02  Pedro Alves  <palves@redhat.com>

* ctf.c (ctf_start): Use S_IRGRP, S_IXGRP, S_IXOTH
unconditionally.

10 years agoHandle 'k' packet TARGET_CLOSE_ERROR gracefully.
Pedro Alves [Sat, 30 Nov 2013 18:22:49 +0000 (18:22 +0000)]
Handle 'k' packet TARGET_CLOSE_ERROR gracefully.

Remote servers may cut the connection abruptly since they are not
required to reply to a 'k' (Kill) packet sent from GDB.

This patch addresses any issues arising from such scenario, which
leads to a GDB internal error due to an attempt to pop the target more
than once.  With the patch, this failure is handled gracefully.

Here's the GDB backtrace Maciej got running the testsuite against
QEMU.  Full paths edited out for brevity.

#0  0x55573430 in __kernel_vsyscall ()
#1  0x557a2951 in raise () from /lib32/libc.so.6
#2  0x557a5d82 in abort () from /lib32/libc.so.6
#3  0x0826e2e4 in dump_core ()
    at .../gdb/utils.c:635
#4  0x0826e5b6 in internal_vproblem (problem=0x85200c0,
    file=0x8416be8 ".../gdb/target.c", line=2861,
    fmt=0x84174ac "could not find a target to follow mourn inferior",
    ap=0xffa4796c "\f")
    at .../gdb/utils.c:804
#5  0x0826e5fb in internal_verror (
    file=0x8416be8 ".../gdb/target.c", line=2861,
    fmt=0x84174ac "could not find a target to follow mourn inferior",
    ap=0xffa4796c "\f")
    at .../gdb/utils.c:820
#6  0x0826e633 in internal_error (
    file=0x8416be8 ".../gdb/target.c", line=2861,
    string=0x84174ac "could not find a target to follow mourn inferior")
    at .../gdb/utils.c:830
#7  0x081b4ad0 in target_mourn_inferior ()
    at .../gdb/target.c:2861
#8  0x08082283 in remote_kill (ops=0x85245e0)
    at .../gdb/remote.c:7840
#9  0x081b06d1 in target_kill ()
    at .../gdb/target.c:486
#10 0x081b42f6 in dispose_inferior (inf=0xa501c60, args=0x0)
    at .../gdb/target.c:2570
#11 0x08290cfc in iterate_over_inferiors (
    callback=0x81b42af <dispose_inferior>, data=0x0)
    at .../gdb/inferior.c:396
#12 0x081b435a in target_preopen (from_tty=1)
    at .../gdb/target.c:2591
#13 0x0807c2c6 in remote_open_1 (name=0xa5538b6 "localhost:1237", from_tty=1,
    target=0x85245e0, extended_p=0)
    at .../gdb/remote.c:4292
#14 0x0807b7a8 in remote_open (name=0xa5538b6 "localhost:1237", from_tty=1)
    at .../gdb/remote.c:3655
#15 0x080a23d4 in do_cfunc (c=0xa464f30, args=0xa5538b6 "localhost:1237",
    from_tty=1)
    at .../gdb/cli/cli-decode.c:107
#16 0x080a4c3b in cmd_func (cmd=0xa464f30, args=0xa5538b6 "localhost:1237",
    from_tty=1)
    at .../gdb/cli/cli-decode.c:1882
#17 0x0826bebf in execute_command (p=0xa5538c3 "7", from_tty=1)
    at .../gdb/top.c:467
#18 0x08193f2d in command_handler (command=0xa5538a8 "")
    at .../gdb/event-top.c:435
#19 0x08194463 in command_line_handler (
    rl=0xa778198 "target remote localhost:1237")
    at .../gdb/event-top.c:633
#20 0x082ba92b in rl_callback_read_char ()
    at .../readline/callback.c:220
#21 0x08193adf in rl_callback_read_char_wrapper (client_data=0x0)
    at .../gdb/event-top.c:164
#22 0x08193e57 in stdin_event_handler (error=0, client_data=0x0)
    at .../gdb/event-top.c:375
#23 0x08192f29 in handle_file_event (data=...)
    at .../gdb/event-loop.c:768
#24 0x0819266a in process_event ()
    at .../gdb/event-loop.c:342
#25 0x08192708 in gdb_do_one_event ()
    at .../gdb/event-loop.c:394
#26 0x08192781 in start_event_loop ()
    at .../gdb/event-loop.c:431
#27 0x08193b08 in cli_command_loop (data=0x0)
    at .../gdb/event-top.c:179
#28 0x0818bc26 in current_interp_command_loop ()
    at .../gdb/interps.c:327
#29 0x0818c4e5 in captured_command_loop (data=0x0)
    at .../gdb/main.c:267
#30 0x0818a37f in catch_errors (func=0x818c4d0 <captured_command_loop>,
    func_args=0x0, errstring=0x8402108 "", mask=RETURN_MASK_ALL)
    at .../gdb/exceptions.c:524
#31 0x0818d736 in captured_main (data=0xffa47f10)
    at .../gdb/main.c:1067
#32 0x0818a37f in catch_errors (func=0x818c723 <captured_main>,
    func_args=0xffa47f10, errstring=0x8402108 "", mask=RETURN_MASK_ALL)
    at .../gdb/exceptions.c:524
#33 0x0818d76c in gdb_main (args=0xffa47f10)
    at .../gdb/main.c:1076
#34 0x0804dd1b in main (argc=5, argv=0xffa47fd4)
    at .../gdb/gdb.c:34

The corresponding gdb.log excerpt:

(gdb) PASS: gdb.base/bitfields.exp: bitfield uniqueness (u9)
cont
Continuing.

Breakpoint 1, break1 () at .../gdb/testsuite/gdb.base/bitfields.c:44
44 }
(gdb) PASS: gdb.base/bitfields.exp: continuing to break1 #9
print flags
$10 = {uc = 0 '\000', s1 = 0, u1 = 0, s2 = 0, u2 = 0, s3 = 0, u3 = 0, s9 = 0, u9 = 0, sc = 1 '\001'}
(gdb) PASS: gdb.base/bitfields.exp: bitfield uniqueness (sc)
delete breakpoints
Delete all breakpoints? (y or n) y
(gdb) info breakpoints
No breakpoints or watchpoints.
(gdb) delete breakpoints
(gdb) info breakpoints
No breakpoints or watchpoints.
(gdb) break break2
Breakpoint 2 at 0x85f8: file .../gdb/testsuite/gdb.base/bitfields.c, line 48.
(gdb) entering gdb_reload
target remote localhost:1235
A program is being debugged already.  Kill it? (y or n) y
Remote connection closed
.../gdb/target.c:2861: internal-error: could not find a target to follow mourn inferior
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) ^Ccontinue
Please answer y or n.
.../gdb/target.c:2861: internal-error: could not find a target to follow mourn inferior
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) Resyncing due to internal error.
n
.../gdb/target.c:2861: internal-error: could not find a target to follow mourn inferior
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) y
Command aborted.
(gdb) print/x flags
$11 = {uc = 0x0, s1 = 0x0, u1 = 0x0, s2 = 0x0, u2 = 0x0, s3 = 0x0, u3 = 0x0, s9 = 0x0, u9 = 0x0, sc = 0x0}
(gdb) FAIL: gdb.base/bitfields.exp: bitfield containment #1
cont
The program is not being run.
(gdb) FAIL: gdb.base/bitfields.exp: continuing to break2 (the program is no longer running)
print/x flags
$12 = {uc = 0x0, s1 = 0x0, u1 = 0x0, s2 = 0x0, u2 = 0x0, s3 = 0x0, u3 = 0x0, s9 = 0x0, u9 = 0x0, sc = 0x0}
(gdb) FAIL: gdb.base/bitfields.exp: bitfield containment #2
delete breakpoints
Delete all breakpoints? (y or n) y
(gdb) info breakpoints
No breakpoints or watchpoints.
(gdb) delete breakpoints
(gdb) info breakpoints
No breakpoints or watchpoints.
(gdb) break break3
Breakpoint 3 at 0x8604: file .../gdb/testsuite/gdb.base/bitfields.c, line 52.
(gdb) entering gdb_reload
target remote localhost:1236
Remote debugging using localhost:1236
Reading symbols from .../lib/ld-linux.so.3...done.
Loaded symbols for .../lib/ld-linux.so.3
0x41001b80 in _start () from .../lib/ld-linux.so.3
(gdb) continue
Continuing.

Breakpoint 3, break3 () at .../gdb/testsuite/gdb.base/bitfields.c:52
52 }
(gdb) print flags
$13 = {uc = 0 '\000', s1 = 0, u1 = 1, s2 = 0, u2 = 3, s3 = 0, u3 = 7, s9 = 0, u9 = 511, sc = 0 '\000'}
(gdb) PASS: gdb.base/bitfields.exp: unsigned bitfield ranges

gdb/
2013-12-02  Pedro Alves  <pedro@codesourcery.com>
            Maciej W. Rozycki  <macro@codesourcery.com>

* remote.c (putpkt_for_catch_errors): Remove function.
(remote_kill): Handle TARGET_CLOSE_ERROR from the kill packet
gracefully.

10 years agoFix PR remote/15974
Yao Qi [Thu, 15 Aug 2013 01:09:08 +0000 (09:09 +0800)]
Fix PR remote/15974

In remote-notif.c:handle_notification, we have a loop,

  for (i = 0; i < ARRAY_SIZE (notifs); i++)
    {
      nc = notifs[i];
      if (strncmp (buf, nc->name, strlen (nc->name)) == 0
  && buf[strlen (nc->name)] == ':')
break;
    }

  /* We ignore notifications we don't recognize, for compatibility
     with newer stubs.  */
  if (nc == NULL)
    return;

If the notification is not in the list 'notifs', the last entry is
used, which is wrong.  It should be NULL.  This patch fixes it.

gdb:

2013-12-02  Pedro Alves  <palves@redhat.com>

PR remote/15974
* remote-notif.c (handle_notification): Return early if no
notification is found.

10 years agoFix filestuff.c build error if RLIMIT_NOFILE not defined.
Joel Brobecker [Sun, 17 Nov 2013 03:50:09 +0000 (22:50 -0500)]
Fix filestuff.c build error if RLIMIT_NOFILE  not defined.

Not all systems supporting getrlimit also support RLIMIT_NOFILE
(Eg. All LynxOS systems appear to be lacking support for this).
So check its existance before using it.

gdb/ChangeLog:

        * common/filestuff.c (fdwalk): Add "defined(RLIMIT_NOFILE)"
        preprocessor check.

10 years agoMakefile.in (HFILES_NO_SRCDIR): Remove "common/gdb_dirent.h".
Joel Brobecker [Mon, 2 Dec 2013 03:10:29 +0000 (07:10 +0400)]
Makefile.in (HFILES_NO_SRCDIR): Remove "common/gdb_dirent.h".

This file no longer exists.

gdb/ChangeLog:

* Makefile.in (HFILES_NO_SRCDIR): Remove "common/gdb_dirent.h".

10 years agoRemove last traces of gdb_stat.h.
Joel Brobecker [Mon, 2 Dec 2013 03:05:10 +0000 (07:05 +0400)]
Remove last traces of gdb_stat.h.

This file no longer exists.

gdb/ChangeLog:

        * Makefile.in (HFILES_NO_SRCDIR): Remove "common/gdb_stat.h".
        * ctf.c (ctf_start): Remove obsolete comment.

10 years agoMakefile.in (HFILES_NO_SRCDIR): Remove "common/gdb_string.h".
Joel Brobecker [Mon, 2 Dec 2013 02:57:38 +0000 (06:57 +0400)]
Makefile.in (HFILES_NO_SRCDIR): Remove "common/gdb_string.h".

This file no longer exists...

gdb/ChangeLog:

* Makefile.in (HFILES_NO_SRCDIR): Remove "common/gdb_string.h".

10 years agodaily update
Alan Modra [Sun, 1 Dec 2013 23:00:01 +0000 (09:30 +1030)]
daily update

10 years agodaily update
Alan Modra [Sat, 30 Nov 2013 23:00:01 +0000 (09:30 +1030)]
daily update

10 years agoMove .debug_gdb_script processing to auto-load.c.
Doug Evans [Sat, 30 Nov 2013 05:29:26 +0000 (21:29 -0800)]
Move .debug_gdb_script processing to auto-load.c.
Simplify handling of auto-loaded objfile scripts.

.debug_gdb_scripts was always intended to handle more than just python,
thus the rightful home for the code that processes it is not in py-foo.c.
This is just a cleanup to move the code to a better place.

This also simplifies the handling of the ${objfile}-${suffix} auto-loaded
scripts.  There's no need for each of the the handlers to do is-safe-to-load
checking, or call maybe_add_script.  Doing it in the caller removes the
duplication.

* auto-load.h (script_language): New members name, auto_load_enabled.
Add missing comments on struct members.
(auto_load_objfile_script): Delete.
* auto-load.c: #include "cli/cli-cmds.h".
(auto_load_gdb_scripts_enabled): New function.
(script_language_gdb): Update, add new members.
(source_gdb_script_for_objfile): Simplify, auto-load safe-checking
and call to maybe_add_script moved to caller.
(auto_load_objfile_script_1): Auto-load safe-checking and
call to maybe_add_script moved here.
(auto_load_objfile_script): Make static.  Early exit if support for
scripting language hasn't been compiled in, or auto-loading has been
disabled.
(source_section_scripts): Argument "source_name" renamed to
"section_name".  All uses updated.  Replace uses of AUTO_SECTION_NAME
with section_name.  Skip loading script if support for scripting
language hasn't been compiled in, or auto-loading has been disabled.
Call language->source_script_for_objfile instead of calling
source_python_script_for_objfile directly.
(load_auto_scripts_for_objfile): Update.
* python/py-auto-load.c: Delete #include "cli/cli-cmds.h".
(gdbpy_load_auto_script_for_objfile): Delete.
(auto_load_python_scripts_enabled): New function.
(script_language_python): Update, add new members.
(gdbpy_script_language_defn): New function.
* python/python.h (gdbpy_load_auto_scripts_for_objfile): Delete.
(gdbpy_script_language_defn): Declare.

* auto-load.c (AUTO_SECTION_NAME): Moved here and renamed from
py-auto-load.c, GDBPY_AUTO_SECTION_NAME.
(source_section_scripts): Moved here from py-auto-load.c.
(auto_load_section_scripts): Ditto.
* python/py-auto-load.c (GDBPY_AUTO_SECTION_NAME): Moved to
auto-load.c, renamed AUTO_SECTION_NAME.
(source_section_scripts, auto_load_section_scripts): Moved to
auto-load.c.

10 years agoFix typo "checksm"
Yao Qi [Tue, 27 Nov 2012 09:59:49 +0000 (17:59 +0800)]
Fix typo "checksm"

Fix typo "checksm".

gdb:

2013-11-30  Yao Qi  <yao@codesourcery.com>

* remote.c (getpkt_or_notif_sane_1): Fix typo "checksm".

10 years agodaily update
Alan Modra [Fri, 29 Nov 2013 23:00:01 +0000 (09:30 +1030)]
daily update