]> git.ipfire.org Git - thirdparty/binutils-gdb.git/log
thirdparty/binutils-gdb.git
9 years ago[gdb/ax] small "setv" fix and documentation's adjustment. gdb-7.9.0-release
David Taylor [Thu, 19 Feb 2015 14:53:50 +0000 (18:53 +0400)] 
[gdb/ax] small "setv" fix and documentation's adjustment.

gdb/doc/agentexpr.texi documents the "setv" opcode as follow:

    @item @code{setv} (0x2d) @var{n}: @result{} @var{v}
    Set trace state variable number @var{n} to the value found on the top
    of the stack.  The stack is unchanged, so that the value is readily
    available if the assignment is part of a larger expression.  The
    handling of @var{n} is as described for @code{getv}.

The @item line is incorrect (and does not match with its
description), so this patch fixes it.

Additionally, in gdb/common/ax.def we find the line:

    DEFOP (setv, 2, 0, 0, 1, 0x2d)

From the comment earlier in the file:

       Each line is of the form:

       DEFOP (name, size, data_size, consumed, produced, opcode)
[...]
       CONSUMED is the number of stack elements consumed.
       PRODUCED is the number of stack elements produced.

which is saying that nothing is consumed and one item is produced.
Both should be 0 or both should be 1.

This patch sets them both to 1, which seems better since if nothing
is on the stack an error will occur.

gdb/ChangeLog:

        * common/ax.def (setv): Fix consumed entry in setv DEFOP.

gdb/doc/ChangeLog:

        * agentexpr.texi (Bytecode Descriptions): Fix summary line for setv.

Tested on x86_64-linux.

9 years agoFix internal error when core file section is too big
Andreas Arnez [Wed, 14 Jan 2015 12:01:38 +0000 (12:01 +0000)] 
Fix internal error when core file section is too big

As reported in PR 17808, a test case with a forged (invalid) core file
can crash GDB with an assertion failure.  In that particular case the
prstatus of an i386 core file looks like that from an AMD64 core file.
Consequently the respective regset supply function i386_supply_gregset
is invoked with a larger buffer than usual.  But i386_supply_gregset
asserts a specific buffer size, and this assertion fails.

The patch relaxes all buffer size assertions in regset supply
functions such that they merely check for a sufficiently large buffer.
For consistency the regset collect functions are adjusted as well.

gdb/ChangeLog:

PR corefiles/17808:
* gdbarch.sh (iterate_over_regset_sections_cb): Document this
function type, particularly its SIZE parameter.
* gdbarch.h: Regenerate.
* amd64-tdep.c (amd64_supply_fpregset): In gdb_assert, compare
actual against required size using ">=" instead of "==".
(amd64_collect_fpregset): Likewise.
* i386-tdep.c (i386_supply_gregset): Likewise.
(i386_collect_gregset): Likewise.
(i386_supply_fpregset): Likewise.
(i386_collect_fpregset): Likewise.
* mips-linux-tdep.c (mips_supply_gregset_wrapper): Likewise.
(mips_fill_gregset_wrapper): Likewise.
(mips_supply_fpregset_wrapper): Likewise.
(mips_fill_fpregset_wrapper): Likewise.
(mips64_supply_gregset_wrapper): Likewise.
(mips64_fill_gregset_wrapper): Likewise.
(mips64_supply_fpregset_wrapper): Likewise.
(mips64_fill_fpregset_wrapper): Likewise.
* mn10300-linux-tdep.c (am33_supply_gregset_method): Likewise.
(am33_supply_fpregset_method): Likewise.
(am33_collect_gregset_method): Likewise.
(am33_collect_fpregset_method): Likewise.

9 years agoAutomatic date update in version.in
GDB Administrator [Fri, 20 Feb 2015 00:00:27 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 years agoFix the gdb version number ("7.9" instead of "str 7.9").
Joel Brobecker [Thu, 19 Feb 2015 12:16:34 +0000 (16:16 +0400)] 
Fix the gdb version number ("7.9" instead of "str 7.9").

This fixes an obvious error in the previous change to this file.

gdb/ChangeLog:

        * version.in: Change to "7.9" instead of "str 7.9".

9 years agoSet GDB version number to str 7.9.
Joel Brobecker [Thu, 19 Feb 2015 12:03:11 +0000 (16:03 +0400)] 
Set GDB version number to str 7.9.

gdb/ChangeLog:

* version.in: Set GDB version number to str 7.9.

9 years agogdb/NEWS: "Changes since GDB 7.8" -> "Changes in GDB 7.9".
Joel Brobecker [Thu, 19 Feb 2015 11:59:43 +0000 (15:59 +0400)] 
gdb/NEWS: "Changes since GDB 7.8" -> "Changes in GDB 7.9".

gdb/ChangeLog:

        * NEWS: Rewrite "Changes since GDB 7.8" into "Changes in GDB 7.9".

9 years agoAutomatic date update in version.in
GDB Administrator [Thu, 19 Feb 2015 00:00:31 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 years agoAutomatic date update in version.in
GDB Administrator [Wed, 18 Feb 2015 00:00:29 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 years agoSimplify event-loop core, remove two-step event processing
Pedro Alves [Tue, 17 Feb 2015 11:38:54 +0000 (11:38 +0000)] 
Simplify event-loop core, remove two-step event processing

Even with the previous patch installed, we'll still see
sigall-reverse.exp occasionally fail.  The problem is that the event
loop's event handling processing is done in two steps:

 #1 - poll all event sources, and push new event objects to the event
  queue, until all event sources are drained.

 #2 - go through the event queue, processing each event object at a
  time.  For each event, call the associated callback, and deletes the
  event object from the queue.

and then bad things happen if between #1 and #2 something decides that
events from an event source that has already queued events shouldn't
be processed yet.  To do that, we either remove the event source from
the list of event sources, or clear its "have events" flag.  However,
if an event for that source has meanwhile already been pushed in the
event queue, #2 will still process it and call the associated
callback...

One way to fix it that I considered was to do something to the event
objects already in the event queue when an event source is no longer
interesting.  But then I couldn't find any good reason for the
two-step process in the first place.  It's much simpler (and less
code) to call the event source callbacks as we poll the sources and
find events.

Tested on x86-64 Fedora 20, native and gdbserver.

gdb/
2015-02-17  Pedro Alves  <palves@redhat.com>

* event-loop.c: Don't declare nor define a queue type for
gdb_event_p.
(event_queue): Delete.
(create_event, create_file_event, gdb_event_xfree)
(initialize_event_loop, process_event): Delete.
(gdb_do_one_event): Return as soon as one event is handled.
(handle_file_event): Change prototype.  Used the passed in
file_handler pointer and ready_mask instead of looping over all
file handlers.
(gdb_wait_for_event): Update the poll/select timeouts before
blocking.  Run event handlers directly instead of queueing events.
Return as soon as one event is handled.
(struct async_event_handler_data): Delete.
(invoke_async_event_handler): Delete.
(check_async_event_handlers): Change return type to int.  Run
event handlers directly instead of queueing events.  Return as
soon as one event is handled.
(handle_timer_event): Delete.
(update_wait_timeout): New function, factored out from
poll_timers.
(poll_timers): Reimplement.
* event-loop.h (initialize_event_loop): Delete declaration.
* top.c (gdb_init): Don't call initialize_event_loop.

9 years agoWhen disabling target async, remove all target event sources from the event loop
Pedro Alves [Tue, 17 Feb 2015 11:36:54 +0000 (11:36 +0000)] 
When disabling target async, remove all target event sources from the event loop

The sigall-reverse.exp test occasionally fails with something like this:

 (gdb) PASS: gdb.reverse/sigall-reverse.exp: send signal TERM
 continue
 Continuing.
 The next instruction is syscall exit_group.  It will make the program exit.  Do you want to stop the program?([y] or n) FAIL: gdb.reverse/sigall-reverse.exp: continue to signal exit (timeout)
 FAIL: gdb.reverse/sigall-reverse.exp: reverse to handler of TERM (timeout)
 FAIL: gdb.reverse/sigall-reverse.exp: reverse to gen_TERM (timeout)

This is another event-loop/async related problem exposed by the patch
that made 'query' use gdb_readline_wrapper (588dcc3edbde19f9).

The problem is that even though gdb_readline_wrapper disables
target-async while the secondary prompt is in progress, the record
target's async event source is left marked.  So when
gdb_readline_wrapper nests an event loop to process input, it may
happen that that event loop ends up processing a target event while
GDB is not really ready for it.  Here's the relevant part of the
backtrace showing the root issue in action:

...
 #14 0x000000000061cb48 in fetch_inferior_event (client_data=0x0) at src/gdb/infrun.c:4158
 #15 0x0000000000642917 in inferior_event_handler (event_type=INF_REG_EVENT, client_data=0x0) at src/gdb/inf-loop.c:57
 #16 0x000000000077ca5c in record_full_async_inferior_event_handler (data=0x0) at src/gdb/record-full.c:791
 #17 0x0000000000640fdf in invoke_async_event_handler (data=...) at src/gdb/event-loop.c:1067
 #18 0x000000000063fb01 in process_event () at src/gdb/event-loop.c:339
 #19 0x000000000063fb2a in gdb_do_one_event () at src/gdb/event-loop.c:360
 #20 0x000000000074d607 in gdb_readline_wrapper (prompt=0x3588f40 "The next instruction is syscall exit_group.  It will make the program exit.  Do you want to stop the program?([y] or n) ") at src/gdb/top.c:842
 #21 0x0000000000750bd9 in defaulted_query (ctlstr=0x8c6588 "The next instruction is syscall exit_group.  It will make the program exit.  Do you want to stop the program?", defchar=121 'y', args=0x7fff70524410) at src/gdb/utils.c:1279
 #22 0x0000000000750e4c in yquery (ctlstr=0x8c6588 "The next instruction is syscall exit_group.  It will make the program exit.  Do you want to stop the program?") at src/gdb/utils.c:1358
 #23 0x00000000004b020e in record_linux_system_call (syscall=gdb_sys_exit_group, regcache=0x3529450, tdep=0xd6c840 <amd64_linux_record_tdep>) at src/gdb/linux-record.c:1933

With my all-stop-on-top-of-non-stop series, I'm also seeing
gdb.server/ext-attach.exp fail occasionally due to the same issue.

The first part of the fix is for target_async implementations to make
sure to remove/unmark all target-related event sources from the event
loop.

Tested on x86_64 Fedora 20, native and gdbserver.

gdb/
2015-02-17  Pedro Alves  <palves@redhat.com>

* event-loop.c (clear_async_event_handler): New function.
* event-loop.h (clear_async_event_handler): New declaration.
* record-btrace.c (record_btrace_async): New function.
(init_record_btrace_ops): Install record_btrace_async.
* record-full.c (record_full_async): New function.
(record_full_resume): Don't mark the async event source here.
(init_record_full_ops): Install record_full_async.
(record_full_core_resume): Don't mark the async event source here.
(init_record_full_core_ops): Install record_full_async.
* remote.c (remote_async): Mark and clear the async stop reply
queue event-loop token as appropriate.

9 years agoFix up some target is-async vs can-async confusions
Pedro Alves [Tue, 17 Feb 2015 11:36:53 +0000 (11:36 +0000)] 
Fix up some target is-async vs can-async confusions

In all these cases we're interested in whether the target is currently
async, with its event sources installed in the event loop, not whether
it can async if needed.  Also, I'm not seeing the point of the
target_async call from within linux_nat_wait.  That's normally done on
resume instead, which this target already does.

Tested on x86_64 Fedora 20, native and gdbserver.

gdb/
2015-02-17  Pedro Alves  <palves@redhat.com>

* linux-nat.c (linux_child_follow_fork, linux_nat_wait_1): Use
target_is_async_p instead of target_can_async.
(linux_nat_wait): Use target_is_async_p instead of
target_can_async.  Don't enable async here.
* remote.c (interrupt_query, remote_wait, putpkt_binary): Use
target_is_async_p instead of target_can_async.

9 years agoAutomatic date update in version.in
GDB Administrator [Tue, 17 Feb 2015 00:00:26 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 years agoAutomatic date update in version.in
GDB Administrator [Mon, 16 Feb 2015 00:00:31 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 years agoAutomatic date update in version.in
GDB Administrator [Sun, 15 Feb 2015 00:00:31 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 years agoAutomatic date update in version.in
GDB Administrator [Sat, 14 Feb 2015 00:00:40 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 years agoAutomatic date update in version.in
GDB Administrator [Fri, 13 Feb 2015 00:00:24 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 years agoAutomatic date update in version.in
GDB Administrator [Thu, 12 Feb 2015 00:00:28 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 years agoframefilter quit: New test
Jan Kratochvil [Wed, 11 Feb 2015 13:55:13 +0000 (14:55 +0100)] 
framefilter quit: New test

It definitely does not test all the RETURN_MASK_ERROR cases.  But it tests at
least two of them.

gdb/testsuite/ChangeLog
2015-02-11  Jan Kratochvil  <jan.kratochvil@redhat.com>

* gdb.python/py-framefilter.exp (pagination quit - *): New tests.

9 years agoframefilter quit: Use RETURN_MASK_ERROR
Jan Kratochvil [Wed, 11 Feb 2015 13:51:36 +0000 (14:51 +0100)] 
framefilter quit: Use RETURN_MASK_ERROR

Now when the code is exception safe we can let RETURN_QUIT to pass through as
all the installed cleanups with handle that.

gdb/ChangeLog
2015-02-11  Jan Kratochvil  <jan.kratochvil@redhat.com>

* python/py-framefilter.c (py_print_single_arg, enumerate_locals)
(py_print_frame): Use RETURN_MASK_ERROR.

9 years agoframefilter quit: Make it exception safe
Jan Kratochvil [Wed, 11 Feb 2015 13:45:17 +0000 (14:45 +0100)] 
framefilter quit: Make it exception safe

gdb/ChangeLog
2015-02-11  Jan Kratochvil  <jan.kratochvil@redhat.com>

* python/py-framefilter.c (py_print_frame): Mention RETURN_QUIT in
function comment.  Wrap all function that can throw in cleanups.
(gdbpy_apply_frame_filter): Wrap all function that can throw in
cleanups.

9 years agoframefilter quit: Code cleanup: Avoid gotos
Jan Kratochvil [Wed, 11 Feb 2015 13:42:22 +0000 (14:42 +0100)] 
framefilter quit: Code cleanup: Avoid gotos

goto error patters are sometimes AFAIK used in C for the cases like:
int retval=-1;
if (!(a=malloc())) goto error;
if (!(b=malloc())) goto error_a;
if (!(c=malloc())) goto error_b;
retval=0;
error_c: free(c);
error_b: free(b);
error_a: free(a);
error: return retval;

But here there is single error label with one do_cleanups() which I do not find
it worth the goto complication.  Without goto one can then furher merge code in
the exit paths in the next patches and ... after all it is all the same, just
without a goto.

gdb/ChangeLog
2015-02-11  Jan Kratochvil  <jan.kratochvil@redhat.com>

* python/py-framefilter.c (py_print_frame): Substitute goto error.
Remove the error label.

9 years agoframefilter quit: Code cleanup: Reindentation
Jan Kratochvil [Wed, 11 Feb 2015 13:38:56 +0000 (14:38 +0100)] 
framefilter quit: Code cleanup: Reindentation

Nothing significant but I find code more clear with less deep indentation.

gdb/ChangeLog
2015-02-11  Jan Kratochvil  <jan.kratochvil@redhat.com>

* python/py-framefilter.c (py_print_frame): Put conditional code paths
with goto first, indent the former else codepath left.  Put variable
'elided' to a new inner block.

9 years agoframefilter quit: Obvious whitespacing fixes
Jan Kratochvil [Wed, 11 Feb 2015 13:35:52 +0000 (14:35 +0100)] 
framefilter quit: Obvious whitespacing fixes

gdb/ChangeLog
2015-02-11  Jan Kratochvil  <jan.kratochvil@redhat.com>

* python/py-framefilter.c (py_print_frame): Whitespacing fixes.

9 years agoAutomatic date update in version.in
GDB Administrator [Wed, 11 Feb 2015 00:00:31 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 years agoAutomatic date update in version.in
GDB Administrator [Tue, 10 Feb 2015 00:00:28 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 years agoAutomatic date update in version.in
GDB Administrator [Mon, 9 Feb 2015 00:00:27 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 years agoAutomatic date update in version.in
GDB Administrator [Sun, 8 Feb 2015 00:00:32 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 years agoAutomatic date update in version.in
GDB Administrator [Sat, 7 Feb 2015 00:00:26 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 years agoAutomatic date update in version.in
GDB Administrator [Fri, 6 Feb 2015 00:00:33 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 years agoAutomatic date update in version.in
GDB Administrator [Thu, 5 Feb 2015 00:00:29 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 years agoSpeed up GDB's TUI output
Doug Evans [Wed, 4 Feb 2015 12:04:30 +0000 (13:04 +0100)] 
Speed up GDB's TUI output

In the TUI mode, we call wrefresh after outputting every single
character.  This results in the I/O becoming very slow.  Fix this by
delaying refreshing the console window until an explicit flush of
gdb_stdout is requested, a write to any other (unbuffered) file is
done.

2015-02-04  Doug Evans  <dje@google.com>
    Pedro Alves  <palves@redhat.com>
    Eli Zaretskii  <eliz@gnu.org>

PR tui/17810
* tui/tui-command.c (tui_refresh_cmd_win): New function.
* tui/tui-command.c (tui_refresh_cmd_win): Declare.
* tui/tui-file.c: #include tui/tui-command.h.
(tui_file_fputs): Refresh command window if stream is not gdb_stdout.
(tui_file_flush): Refresh command window if stream is gdb_stdout.
* tui/tui-io.c (tui_puts): Remove calls to wrefresh, fflush.
(tui_readline_output): Call tui_refresh_cmd_win.
(print_filename): Likewise.
(tui_rl_display_match_list): Likewise.

9 years agoAutomatic date update in version.in
GDB Administrator [Wed, 4 Feb 2015 00:00:27 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 years agocompile: Filter out -fpreprocessed
Jan Kratochvil [Tue, 3 Feb 2015 17:20:49 +0000 (18:20 +0100)] 
compile: Filter out -fpreprocessed

With global system gcc-5.0 if one also installs ccache (needing a different
patch
https://bugzilla.samba.org/show_bug.cgi?id=11060
for -fplugin=libcc1plugin) it breaks as GDB will read from inferior
DW_AT_producer containing -fpreprocessed (due to ccache used to compile the
inferior).
    <c>   DW_AT_producer    : (indirect string, offset: 0x52): GNU C11 5.0.0 20150114 (Red Hat 5.0.0-0.1) -fpreprocessed -mtune=generic -
march=x86-64 -g

It is wrong that gcc puts -fpreprocessed into DW_AT_producer - fixed it in
trunk GCCs:
https://gcc.gnu.org/ml/gcc-patches/2015-01/msg01495.html
But even with that fix there are already built inferiors out there which GDB
could be compatible (for the 'compile' mode) with.

gdb/ChangeLog
2015-02-03  Jan Kratochvil  <jan.kratochvil@redhat.com>

Filter out inferior gcc option -fpreprocessed.
* compile/compile.c (filter_args): New function.
(get_args): Use it.

9 years agoAutomatic date update in version.in
GDB Administrator [Tue, 3 Feb 2015 00:00:44 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 years ago[Ada] Do not re-cache symbol-lookup result found from cache lookup.
Joel Brobecker [Mon, 2 Feb 2015 03:28:12 +0000 (07:28 +0400)] 
[Ada] Do not re-cache symbol-lookup result found from cache lookup.

When ada-lang.c:ada_lookup_symbol_list_worker finds a match in
the symbol cache, it caches the result again, which is unecessary.
This patch fixes the code to avoid that.

gdb/ChangeLog:

        PR gdb/17856:
        * ada-lang.c (ada_lookup_symbol_list_worker): Do not re-cache
        results found in the cache.

Tested on x86_64-linux, no regression.

9 years ago[Ada] pspace_data->sym_cache is always NULL
Joel Brobecker [Mon, 2 Feb 2015 03:20:58 +0000 (07:20 +0400)] 
[Ada] pspace_data->sym_cache is always NULL

The Ada symbol cache has been designed to have one instance of that
of that cache per program space, and for each instance to be created
on-demand. ada_get_symbol_cache is the function responsible for both
lookup and creation on demand.

Unfortunately, ada_get_symbol_cache forgot to store the reference
to newly created caches, thus causing it to:
  - Leak old caches;
  - Allocate a new cache each time the cache is being searched or
    a new entry is to be inserted.

This patch fixes the issue by avoiding the use of the local variable,
which indirectly allowed the bug to happen. We manipulate the reference
in the program-space data instead.

gdb/ChangeLog:

        PR gdb/17854:
        * ada-lang.c (ada_get_symbol_cache): Set pspace_data->sym_cache
        when allocating a new one.

9 years agoAutomatic date update in version.in
GDB Administrator [Mon, 2 Feb 2015 00:00:30 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 years agoAutomatic date update in version.in
GDB Administrator [Sun, 1 Feb 2015 00:00:31 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 years agoPR symtab/17855
Joel Brobecker [Sat, 31 Jan 2015 21:04:51 +0000 (13:04 -0800)] 
PR symtab/17855

gdb/ChangeLog:

PR symtab/17855
* symfile.c (clear_symtab_users): Move call to breakpoint_re_set
to end.

9 years agoMake sure TABs are expanded in TUI windows on MS-Windows.
Eli Zaretskii [Sat, 31 Jan 2015 08:47:14 +0000 (10:47 +0200)] 
Make sure TABs are expanded in TUI windows on MS-Windows.

gdb/
2015-01-31  Eli Zaretskii  <eliz@gnu.org>

* tui/tui-io.c (tui_expand_tabs): New function.
(tui_puts, tui_redisplay_readline): Expand TABs into the
appropriate number of spaces.
* tui/tui-regs.c: Include tui-io.h.
(tui_register_format): Call tui_expand_tabs to expand TABs into
the appropriate number of spaces.
* tui/tui-io.h: Add prototype for tui_expand_tabs.

(cherry picked from commit 312809f8838911dabff84d7ad3ccf341307d2b19)

9 years agoAutomatic date update in version.in
GDB Administrator [Sat, 31 Jan 2015 00:00:31 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 years agoAutomatic date update in version.in
GDB Administrator [Fri, 30 Jan 2015 00:01:14 +0000 (00:01 +0000)] 
Automatic date update in version.in

9 years agoPR symtab/17890
Doug Evans [Thu, 29 Jan 2015 18:31:21 +0000 (10:31 -0800)] 
PR symtab/17890

gdb/ChangeLog:

PR symtab/17890
* dwarf2read.c (dwarf_decode_line_header): Punt if version > 4.

9 years agoAutomatic date update in version.in
GDB Administrator [Thu, 29 Jan 2015 00:00:49 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 years agoAutomatic date update in version.in
GDB Administrator [Wed, 28 Jan 2015 00:00:52 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 years agoAutomatic date update in version.in
GDB Administrator [Tue, 27 Jan 2015 00:00:56 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 years agoAdd missing comments in rs6000-tdep.c, ppc64-tdep.c and ppc-linux-tdep.c.
Wei-cheng Wang [Mon, 19 Jan 2015 15:34:07 +0000 (23:34 +0800)] 
Add missing comments in rs6000-tdep.c, ppc64-tdep.c and ppc-linux-tdep.c.

gdb/ChangeLog

Backport from mainline:

* ppc-linux-tdep.c (ppc_skip_trampoline_code,
ppc_canonicalize_syscall, ppc_linux_syscall_record,
ppc_linux_record_signal, ppc_init_linux_record_tdep): Add comments.
* ppc64-tdep.c (ppc64_skip_trampoline_code): Likewise.
* rs6000-tdep.c (rs6000_epilogue_frame_cache,
rs6000_epilogue_frame_this_id, rs6000_epilogue_frame_prev_register,
rs6000_epilogue_frame_sniffer, ppc_record_vsr, ppc_process_record_op4,
ppc_process_record_op19, ppc_process_record_op31,
ppc_process_record_op59, ppc_process_record_op60,
ppc_process_record_op63): Likewise.

9 years agoFix format warning in rs6000t-dep.c
Wei-cheng Wang [Sun, 18 Jan 2015 07:20:46 +0000 (15:20 +0800)] 
Fix format warning in rs6000t-dep.c

gdb/ChangeLog

Backport from mainline:

* rs6000-tdep.c (ppc_process_record_op4, ppc_process_record_op19,
ppc_process_record_op31, ppc_process_record_op59,
ppc_process_record_op60, ppc_process_record_op63,
ppc_process_record): Fix -Wformat warning.
* rs6000-tdep.c (rs6000_epilogue_frame_cache, ppc_process_record_op60):
Remove unused variables.

9 years agoSkip-trampoline for PowerPC reverse-stepping.
Wei-cheng Wang [Sat, 17 Jan 2015 06:30:59 +0000 (14:30 +0800)] 
Skip-trampoline for PowerPC reverse-stepping.

gdb/ChangeLog

Backport from mainline:

* ppc-linux-tdep.c (ppc_skip_trampoline_code):
Scan PLT stub backward for reverse debugging.
* ppc64-tdep.c (ppc64_skip_trampoline_code): Likewise.

9 years agoReverse debugging for PowerPC.
Wei-cheng Wang [Sat, 17 Jan 2015 06:30:33 +0000 (14:30 +0800)] 
Reverse debugging for PowerPC.

gdb/ChangeLog

Backport from mainline:

* configure.tgt (powerpc*-*-linux): Add linux-record.o to
gdb_target_obs.
(ppc_linux_record_tdep, ppc64_linux_record_tdep): New for linux syscall
record.
(ppc_canonicalize_syscall, ppc_linux_syscall_record,
ppc_linux_record_signal, ppc_init_linux_record_tdep): New functions.
(ppc_linux_init_abi): Set process_record, process_record_signal.
* ppc-tdep.h (struct gdbarch_tdep): Add ppc_syscall_record and
ppc_linux_record_tdep to gdbarch_tdep.
(ppc_process_record): New declaration.
* rs6000-tdep.c (ppc_record_vsr, ppc_process_record_op4,
ppc_process_record_op19, ppc_process_record_op31,
ppc_process_record_op59, ppc_process_record_op60,
ppc_process_record_op63, ppc_process_record): New functions.

gdb/testsuite/ChangeLog

Backport from mainline:

* lib/gdb.exp (supports_process_record): Return true for
powerpc*-*-linux*.
(supports_reverse): Likewise.

9 years agoEpilogue unwinder for PowerPC.
Wei-cheng Wang [Sat, 17 Jan 2015 06:29:16 +0000 (14:29 +0800)] 
Epilogue unwinder for PowerPC.

gdb/ChangeLog

Backport from mainline:

* rs6000-tdep.c (rs6000_in_function_epilogue_p): Rename to
rs6000_in_function_epilogue_frame_p and add an argument
for frame_info.
(rs6000_epilogue_frame_cache, rs6000_epilogue_frame_this_id,
rs6000_epilogue_frame_prev_register, rs6000_epilogue_frame_sniffer):
New functions.
(rs6000_epilogue_frame_unwind): New.
(rs6000_gdbarch_init): Append epilogue unwinder.

9 years agoAutomatic date update in version.in
GDB Administrator [Mon, 26 Jan 2015 00:02:38 +0000 (00:02 +0000)] 
Automatic date update in version.in

9 years agoFix 100x slowdown regression on DWZ files
Jan Kratochvil [Sun, 25 Jan 2015 07:57:01 +0000 (08:57 +0100)] 
Fix 100x slowdown regression on DWZ files

Since Fedora started to use DWZ DWARF compressor:
http://fedoraproject.org/wiki/Features/DwarfCompressor
GDB has slowed down a lot.  To make it clear - DWZ is DWARF structure
rearrangement, "compressor" does not mean any zlib style data compression.

This patch reduces LibreOffice backtrace from 5 minutes to 3 seconds (100x)
and it also reduces memory consumption 20x.
[ benchmark is at the bottom of this mail ]

Example of DWZ output:
------------------------------------------------------------------------------
  Compilation Unit @ offset 0xc4:
 <0><cf>: Abbrev Number: 17 (DW_TAG_partial_unit)
    <d0>   DW_AT_stmt_list   : 0x0
    <d4>   DW_AT_comp_dir    : (indirect string, offset: 0x6f): /usr/src/debug/gdb-7.7.1/build-x86_64-redhat-linux-gnu/gdb
 <1><d8>: Abbrev Number: 9 (DW_TAG_typedef)
    <d9>   DW_AT_name        : (indirect string, offset: 0x827dc): size_t
    <dd>   DW_AT_decl_file   : 4
    <de>   DW_AT_decl_line   : 212
    <df>   DW_AT_type        : <0xae>

  Compilation Unit @ offset 0xe4:
 <0><ef>: Abbrev Number: 13 (DW_TAG_partial_unit)
    <f0>   DW_AT_stmt_list   : 0x0
    <f4>   DW_AT_comp_dir    : (indirect string, offset: 0x6f): /usr/src/debug/gdb-7.7.1/build-x86_64-redhat-linux-gnu/gdb
 <1><f8>: Abbrev Number: 45 (DW_TAG_typedef)
    <f9>   DW_AT_name        : (indirect string, offset: 0x251): __off_t
    <fd>   DW_AT_decl_file   : 3
    <fe>   DW_AT_decl_line   : 131
    <ff>   DW_AT_type        : <0x68>

  Compilation Unit @ offset 0x62d9f9:
 <0><62da04>: Abbrev Number: 20 (DW_TAG_compile_unit)
[...]
    <62da12>   DW_AT_low_pc  : 0x807e10
    <62da1a>   DW_AT_high_pc     : 134
    <62da1c>   DW_AT_stmt_list   : 0xf557e
 <1><62da20>: Abbrev Number: 7 (DW_TAG_imported_unit)
    <62da21>   DW_AT_import  : <0xcf> [Abbrev Number: 17]
------------------------------------------------------------------------------

One can see all DW_TAG_partial_unit have DW_AT_stmt_list 0x0 which causes
repeated decoding of that .debug_line unit on each DW_TAG_imported_unit.

This was OK before as each DW_TAG_compile_unit has its own .debug_line unit.
But since the introduction of DW_TAG_partial_unit by DWZ one should cache
read-in DW_AT_stmt_list .debug_line units.

Fortunately one does not need to cache whole
        struct linetable *symtab->linetable
and other data from .debug_line mapping PC<->lines
------------------------------------------------------------------------------
 Line Number Statements:
  Extended opcode 2: set Address to 0x45c880
  Advance Line by 25 to 26
  Copy
------------------------------------------------------------------------------
as the only part of .debug_line which GDB needs for DW_TAG_partial_unit is:
------------------------------------------------------------------------------
 The Directory Table:
  ../../gdb
  /usr/include/bits
[...]
 The File Name Table:
  Entry Dir     Time    Size    Name
  1     1 0 0 gdb.c
  2     2 0 0 string3.h
[...]
------------------------------------------------------------------------------
specifically referenced in GDB for DW_AT_decl_file at a single place:
------------------------------------------------------------------------------
              fe = &cu->line_header->file_names[file_index - 1];
              SYMBOL_SYMTAB (sym) = fe->symtab;
------------------------------------------------------------------------------

This is because for some reason DW_TAG_partial_unit never contains PC-related
DWARF information.  I do not know exactly why, the compression ratio is a bit
lower due to it but thanksfully currently it is that way:
dwz.c:
------------------------------------------------------------------------------
        /* These attributes reference code, prevent moving
           DIEs with them.  */
        case DW_AT_low_pc:
        case DW_AT_high_pc:
        case DW_AT_entry_pc:
        case DW_AT_ranges:
          die->die_ck_state = CK_BAD;
+
  /* State of checksum computation.  Not computed yet, computed and
     suitable for moving into partial units, currently being computed
     and finally determined unsuitable for moving into partial units.  */
  enum { CK_UNKNOWN, CK_KNOWN, CK_BEING_COMPUTED, CK_BAD } die_ck_state : 2;
------------------------------------------------------------------------------
I have also verified also real-world Fedora debuginfo files really comply with
that assumption with dwgrep
https://github.com/pmachata/dwgrep
using:
------------------------------------------------------------------------------
dwgrep -e 'entry ?DW_TAG_partial_unit child* ( ?DW_AT_low_pc , ?DW_AT_high_pc , ?DW_AT_ranges )' /usr/lib/debug/**
------------------------------------------------------------------------------

BTW I think GDB already does not support the whole DW_TAG_imported_unit and
DW_TAG_partial_unit usage possibilities as specified by the DWARF standard.
I think GDB would not work if DW_TAG_imported_unit was used in some inner
level and not at the CU level (readelf -wi level <1>) - this is how DWZ is
using DW_TAG_imported_unit.  Therefore I do not think further assumptions
about DW_TAG_imported_unit and DW_TAG_partial_unit usage by DWZ are a problem
for GDB.

One could save the whole .debug_line decoded PC<->lines mapping (and not just
the DW_AT_decl_file table) but:
 * there are some problematic corner cases so one could do it incorrectly
 * there are no real world data to really test such patch extension
 * such extension could be done perfectly incrementally on top of this patch

------------------------------------------------------------------------------

benchmark - on Fedora 20 x86_64 and FSF GDB HEAD:
echo -e 'thread apply all bt\nset confirm no\nq'|./gdb -p `pidof soffice.bin` -ex 'set pagination off' -ex 'maintenance set per-command
space' -ex 'maintenance set per-command symtab' -ex 'maintenance set per-command time'

FSF GDB HEAD ("thread apply all bt"):
Command execution time: 333.693000 (cpu), 335.587539 (wall)
                                          ---sec
Space used: 1736404992 (+1477189632 for this command)
                         ----MB
vs.
THIS PATCH ("thread apply all bt"):
Command execution time: 2.595000 (cpu), 2.607573 (wall)
                                        -sec
Space used: 340058112 (+85917696 for this command)
                        --MB

FSF GDB HEAD ("thread apply all bt full"):
Command execution time: 466.751000 (cpu), 468.345837 (wall)
                                          ---sec
Space used: 2330132480 (+2070974464 for this command)
                         ----MB
vs.
THIS PATCH ("thread apply all bt full"):
Command execution time: 18.907000 (cpu), 18.964125 (wall)
                                         --sec
Space used: 364462080 (+110325760 for this command)
                        ---MB

------------------------------------------------------------------------------

gdb/ChangeLog
2015-01-25  Jan Kratochvil  <jan.kratochvil@redhat.com>

Fix 100x slowdown regression on DWZ files.
* dwarf2read.c (struct dwarf2_per_objfile): Add line_header_hash.
(struct line_header): Add offset and offset_in_dwz.
(dwarf_decode_lines): Add parameter decode_mapping to the declaration.
(free_line_header_voidp): New declaration.
(line_header_hash, line_header_hash_voidp, line_header_eq_voidp): New
functions.
(dwarf2_build_include_psymtabs): Update dwarf_decode_lines caller.
(handle_DW_AT_stmt_list): Use line_header_hash.
(free_line_header_voidp): New function.
(dwarf_decode_line_header): Initialize offset and offset_in_dwz.
(dwarf_decode_lines): New parameter decode_mapping, use it.
(dwarf2_free_objfile): Free line_header_hash.

9 years agoAutomatic date update in version.in
GDB Administrator [Sun, 25 Jan 2015 00:01:19 +0000 (00:01 +0000)] 
Automatic date update in version.in

9 years agoAutomatic date update in version.in
GDB Administrator [Sat, 24 Jan 2015 00:00:51 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 years agoLinux: make target_is_async_p return false when async is off
Pedro Alves [Fri, 23 Jan 2015 11:21:56 +0000 (11:21 +0000)] 
Linux: make target_is_async_p return false when async is off

linux_nat_is_async_p currently always returns true, even when the
target is _not_ async.  That confuses
gdb_readline_wrapper/gdb_readline_wrapper_cleanup, which
force-disables target-async while the secondary prompt is active.  As
a result, when gdb_readline_wrapper returns, the target is left async,
even through it was sync to begin with.

That can result in weird bugs, like the one the test added by this
commit exposes.

Ref: https://sourceware.org/ml/gdb-patches/2015-01/msg00592.html

gdb/ChangeLog:
2015-01-23  Pedro Alves  <palves@redhat.com>

* linux-nat.c (linux_is_async_p): New macro.
(linux_nat_is_async_p):
(linux_nat_terminal_inferior): Check whether the target can async
instead of whether it is already async.
(linux_nat_terminal_ours): Don't check whether the target is
async.
(linux_async_pipe): Use linux_is_async_p.

gdb/testsuite/ChangeLog:
2015-01-23  Pedro Alves  <palves@redhat.com>

* gdb.threads/continue-pending-after-query.c: New file.
* gdb.threads/continue-pending-after-query.exp: New file.

9 years agocompile: Fix function pointers
Jan Kratochvil [Fri, 23 Jan 2015 09:52:55 +0000 (10:52 +0100)] 
compile: Fix function pointers

TBH while I always comment reasons for each of the compilation options in
reality I tried them all and chose that combination that needs the most simple
compile/compile-object-load.c (ld.so emulation) implementation.

gdb/ChangeLog
2015-01-23  Jan Kratochvil  <jan.kratochvil@redhat.com>

* compile/compile.c (_initialize_compile): Use -fPIE for compile_args.

gdb/testsuite/ChangeLog
2015-01-23  Jan Kratochvil  <jan.kratochvil@redhat.com>

* gdb.compile/compile.exp (pointer to jit function): New test.

9 years agoFix filename in one of the recent gdb/ChangeLog entries (remove "gdb/").
Joel Brobecker [Fri, 23 Jan 2015 07:13:49 +0000 (08:13 +0100)] 
Fix filename in one of the recent gdb/ChangeLog entries (remove "gdb/").

9 years agoAutomatic date update in version.in
GDB Administrator [Fri, 23 Jan 2015 00:00:52 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 years agomingw32: fix windows-termcap/curses check
Pedro Alves [Thu, 22 Jan 2015 18:41:33 +0000 (18:41 +0000)] 
mingw32: fix windows-termcap/curses check

When GDB is configured with "--without-tui --with-curses" or "--with-tui",
$prefer_curses is set to yes.  But, that still doesn't mean that curses
will be used.  configure will still search for the curses library, and
continue building without it.  That's done here:

 curses_found=no
 if test x"$prefer_curses" = xyes; then
 ...
   AC_SEARCH_LIBS(waddstr, [ncurses cursesX curses])

   if test "$ac_cv_search_waddstr" != no; then
     curses_found=yes
   fi
 fi

So if waddstr is not found, meaning curses is not really
available, even though it'd be preferred, $prefer_curses is
'yes', but $curses_found is 'no'.

So the right fix to tell whether we're linking with curses is
$curses_found=yes.

gdb/ChangeLog:
2015-01-22  Pedro Alves  <palves@redhat.com>

* configure.ac [*mingw32*]: Check $curses_found instead of
$prefer_curses.
* configure: Regenerate.
* windows-termcap.c: Remove HAVE_CURSES_H, HAVE_NCURSES_H and
HAVE_NCURSES_NCURSES_H checks.

9 years agoFix MinGW TUI build
Eli Zaretskii [Thu, 22 Jan 2015 18:23:12 +0000 (20:23 +0200)] 
Fix MinGW TUI build

gdb/
2015-01-22  Eli Zaretskii  <eliz@gnu.org>

* gdb/tui/tui.c (tui_enable) [__MINGW32__]: If the call to 'newterm'
fails with the 1st arg NULL, try again with "unknown".  Don't test
the "cup" capability: it isn't supported by the Windows port of
ncurses, but the Windows console driver is still capable of
supporting TUI.

(cherry picked from commit 6b8a872ff1038e2b8618ea33bb1113b78f39976d)

9 years agoPartial fix for "make TAGS".
Eli Zaretskii [Thu, 22 Jan 2015 18:05:59 +0000 (20:05 +0200)] 
Partial fix for "make TAGS".

gdb/
2015-01-22  Eli Zaretskii  <eliz@gnu.org>

* Makefile.in (HFILES_NO_SRCDIR): Remove ada-varobj.h.
(ALLDEPFILES): Remove irix5-nat.c.  These two are part of the
reason that "make TAGS" is broken.

(cherry picked from commit 82a864f96aff83edb0c8bb21ead5c28cd10363fe)

9 years agoAutomatic date update in version.in
GDB Administrator [Thu, 22 Jan 2015 00:00:46 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 years agoAutomatic date update in version.in
GDB Administrator [Wed, 21 Jan 2015 00:00:44 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 years agoAutomatic date update in version.in
GDB Administrator [Tue, 20 Jan 2015 00:00:37 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 years agoDon't use windows-termcap.c when linking against a curses library
Eli Zaretskii [Mon, 19 Jan 2015 15:34:29 +0000 (16:34 +0100)] 
Don't use windows-termcap.c when linking against a curses library

gdb/
2015-01-17  Eli Zaretskii  <eliz@gnu.org>

        * configure.ac [*mingw32*]: Only add windows-termcap.o to
        CONFIG_OBS if not building with a curses library.
        * configure: Regenerate.

        * windows-termcap.c: Include defs.h.  Make the whole body empty if
        either one of HAVE_CURSES_H or HAVE_NCURSES_H or
        HAVE_NCURSES_NCURSES_H is defined.

(cherry picked from commit 63413d85873c450fa4ed2494f21fb1a65bdaf554)

9 years agostrerror.c: Do not declare sys_nerr or sys_errlist if already macros
Joel Brobecker [Mon, 19 Jan 2015 15:29:07 +0000 (16:29 +0100)] 
strerror.c: Do not declare sys_nerr or sys_errlist if already macros

This fixes a MinGW warning in libiberty/strerror.c.

2015-01-19  Eli Zaretskii  <eliz@gnu.org>

        * strerror.c <sys_nerr, sys_errlist>: Declare only if they aren't
        macros.

(cherry picked from commit 1f99f6d0689d20db44c0c7d88e8af1ebe900d187)

9 years agoAutomatic date update in version.in
GDB Administrator [Mon, 19 Jan 2015 00:00:33 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 years agoAutomatic date update in version.in
GDB Administrator [Sun, 18 Jan 2015 00:01:30 +0000 (00:01 +0000)] 
Automatic date update in version.in

9 years agoAutomatic date update in version.in
GDB Administrator [Sat, 17 Jan 2015 00:00:45 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 years agoReally add a prototype for tui_rehighlight_all.
Eli Zaretskii [Fri, 16 Jan 2015 17:55:40 +0000 (19:55 +0200)] 
Really add a prototype for tui_rehighlight_all.

(cherry picked from commit 2ef60e94e7d10fb9dd5afaf246b960cb4fdf404e)

9 years agoMake setting TUI border attributes take effect immediately
Eli Zaretskii [Fri, 16 Jan 2015 16:24:16 +0000 (18:24 +0200)] 
Make setting TUI border attributes take effect immediately

gdb/
2015-01-16  Eli Zaretskii  <eliz@gnu.org>

     * tui/tui-win.c (tui_rehighlight_all, tui_set_var_cmd): New
     functions.
     (_initialize_tui_win) <border-kind, border-mode>:
     <active-border-mode>: Use tui_set_var_cmd as the "set" function.
     * tui/tui-win.h: Add prototype for tui_rehighlight_all.

(cherry picked from commit 6cdb25f4df143e8d98bd71bf943bbe61c702e239)

9 years agoMake the change of tab size in TUI mode effective immediately
Eli Zaretskii [Fri, 16 Jan 2015 15:54:46 +0000 (17:54 +0200)] 
Make the change of tab size in TUI mode effective immediately

gdb/ChangeLog:
2015-01-16  Eli Zaretskii  <eliz@gnu.org>

    * tui/tui-win.c (tui_set_tab_width_command): Delete and
    recreate the source and the disassembly windows, to show the
    effect of the changed tab size immediately.

(cherry picked from commit cb86fcc13bea494007a103424c8a61f1cb372717)

9 years agoFix TUI-related documentation.
Eli Zaretskii [Fri, 16 Jan 2015 11:31:36 +0000 (13:31 +0200)] 
Fix TUI-related documentation.

tui/tui-win.c (tui_scroll_left_command, tui_scroll_right_command):
Doc fix.
doc/gdb.texinfo (TUI Commands): Document the possible
values of NAME argument to 'winheight' command.  Explain the
effect of 'tabset' setting better.

(cherry picked from commit bf555842fccfc0e2cdc4a2f329df6358f991732c)

9 years agoLeave more space in TUI mode for thread ID.
Eli Zaretskii [Fri, 16 Jan 2015 11:24:20 +0000 (13:24 +0200)] 
Leave more space in TUI mode for thread ID.

gdb/tui/tui-data.h (LINE_PREFIX): Make shorter
(MAX_PID_WIDTH): Enlarge from 14 to 19, to leave enough space for
"Thread NNNNN.XXXX" thread ID notation on Windows.

(cherry picked from commit 9f2850baa3ce341f0ba42bd9519cb3c1bf1287c7)

9 years agoAutomatic date update in version.in
GDB Administrator [Fri, 16 Jan 2015 00:00:34 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 years agoBuild failure in sim/rx/gdb-if.c on windows
Joel Brobecker [Thu, 15 Jan 2015 03:14:45 +0000 (07:14 +0400)] 
Build failure in sim/rx/gdb-if.c on windows

This should fix a build failure reported on x86_64-mingw32 by Daniel
Calcoen due to conflicting declarations of "open".  This patch just
renames the static global in sim/rx/gdb-if.c into "rx_sim_is_open".

sim/rx/ChangeLog:

* gdb-if.c (open): Rename to...
(rx_sim_is_open): This. Replace all uses of "open" by uses of
"rx_sim_is_open" throughout.

Tested by rebuilding on x86_64-linux.

9 years agoAutomatic date update in version.in
GDB Administrator [Thu, 15 Jan 2015 00:00:48 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 years agoMerge include/libiberty.h from GCC
Jan-Benedict Glaw [Wed, 14 Jan 2015 21:10:15 +0000 (22:10 +0100)] 
Merge include/libiberty.h from GCC

This pulls in some missing prototypes and also adds corresponding entries
to the ChangeLog file. Please note that for one function, strverscmp(),
the ChangeLog entry was already there, but the actual prototype wasn't.

  These ChangeLog entries are added:

2014-10-28  Yury Gribov  <y.gribov@samsung.com>

       * libiberty.h (strtol, strtoul, strtoll, strtoull): New prototypes.

2014-10-15  David Malcolm  <dmalcolm@redhat.com>

       * libiberty.h (choose_tmpdir): New prototype.

9 years agoPR17525 - breakpoint commands not executed when program run from -x script
Pedro Alves [Wed, 14 Jan 2015 12:38:47 +0000 (12:38 +0000)] 
PR17525 - breakpoint commands not executed when program run from -x script

Executing a gdb script that runs the inferior (from the command line
with -x), and has it hit breakpoints with breakpoint commands that
themselves run the target, is currently broken on async targets
(Linux, remote).

While we're executing a command list or a script, we force the
interpreter to be sync, which results in some functions nesting an
event loop and waiting for the target to stop, instead of returning
immediately and having the top level event loop handle the stop.

The issue with this bug is simply that bpstat_do_actions misses
checking whether the interpreter is sync.  When we get here, in the
case of executing a script (or, when the interpreter is sync), the
program has already advanced to the next breakpoint, through
maybe_wait_sync_command_done.  We need to process its breakpoints
immediately, just like with a sync target.

Tested on x86_64 Fedora 20.

gdb/
2015-01-14  Pedro Alves  <palves@redhat.com>

PR gdb/17525
* breakpoint.c: Include "interps.h".
(bpstat_do_actions_1): Also check whether the interpreter is
async.

gdb/testsuite/
2015-01-14  Pedro Alves  <palves@redhat.com>
    Joel Brobecker  <brobecker@adacore.com>

PR gdb/17525
* gdb.base/bp-cmds-execution-x-script.c: New file.
* gdb.base/bp-cmds-execution-x-script.exp: New file.
* gdb.base/bp-cmds-execution-x-script.gdb: New file.

9 years agoPR cli/17828: -batch -ex r breaks terminal
Pedro Alves [Wed, 14 Jan 2015 12:38:47 +0000 (12:38 +0000)] 
PR cli/17828: -batch -ex r breaks terminal

Commit d3d4baed (PR python/17372 - Python hangs when displaying
help()) had the side effect of causing 'gdb -batch' to leave the
terminal in the wrong state if the program was run.  E.g,.

 $ echo 'main(){*(int*)0=0;}' | gcc -x c -; ./gdb/gdb -batch -ex r ./a.out
 Program received signal SIGSEGV, Segmentation fault.
 0x00000000004004ff in main ()
 $

If you start typing the next command, seemingly nothing happens - GDB
left the terminal with echo disabled.

The issue is that that "r" ends up in fetch_inferior_event, which
calls reinstall_readline_callback_handler_cleanup, which causes
readline to prep the terminal (raw, echo disabled).  But "-batch"
causes GDB to exit before the top level event loop is first started,
and then nothing de-preps the terminal.

The reinstall_readline_callback_handler_cleanup function's intro
comment mentions:

 "Need to do this as we go back to the event loop, ready to process
 further input."

but the implementation forgets the case of when the interpreter is
sync, which indicates we won't return to the event loop yet, or as in
the case of -batch, we have not started it yet.

The fix is to not install the readline callback in that case.

For the test, in this case, checking that command echo still works is
sufficient.  Comparing stty output before/after running GDB is even
better.  Because stty may not be available, the test tries both ways.
In any case, since expect's spawn (what we use to start gdb) creates a
new pseudo tty, another expect spawn or tcl exec after GDB exits would
not see the wrong terminal settings.  So instead, the test spawns a
shell and runs stty and GDB in it.

Tested on x86_64 Fedora 20.

gdb/
2015-01-14  Pedro Alves  <palves@redhat.com>

PR cli/17828
* infrun.c (reinstall_readline_callback_handler_cleanup): Don't
reinstall if the interpreter is sync.

gdb/testsuite/
2015-01-14  Pedro Alves  <palves@redhat.com>

PR cli/17828
* gdb.base/batch-preserve-term-settings.c: New file.
* gdb.base/batch-preserve-term-settings.exp: New file.

9 years agoAutomatic date update in version.in
GDB Administrator [Wed, 14 Jan 2015 00:00:30 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 years agoBump GDB version number to 7.8.90.DATE-cvs.
Joel Brobecker [Tue, 13 Jan 2015 15:40:53 +0000 (19:40 +0400)] 
Bump GDB version number to 7.8.90.DATE-cvs.

gdb/ChangeLog:

* version.in: Set GDB version number to 7.8.90.DATE-cvs.

9 years agoDocument the GDB 7.8.90 release in gdb/ChangeLog
Joel Brobecker [Tue, 13 Jan 2015 15:40:41 +0000 (19:40 +0400)] 
Document the GDB 7.8.90 release in gdb/ChangeLog

gdb/ChangeLog:

GDB 7.8.90 released.

9 years agogdb/testsuite: Make clean mostlyclean should not delete *.py.
Joel Brobecker [Tue, 13 Jan 2015 14:59:32 +0000 (18:59 +0400)] 
gdb/testsuite: Make clean mostlyclean should not delete *.py.

A sanity-check in my release scripts caught something: After having
created the tarballs, I verify that no checked-in file disappeared
in the process, and lo and behod, it found that the following file
got wiped:

    - gdb/testsuite/dg-extract-results.py:

And it's not part of the tarball either.

I don't understand while we delete all *.py files in gdb/testsuite,
since I don't see a rule that expected to create one. A run of the
testsuite also doesn't seem to be creating .py files there.
I traced this to the following commit, which unfortunately provided
no explanation. Perhaps we used to run some tests in the gdb/testsuite
directory and caused files to be left behind there. Perhaps we still
do today?

In the meantime, Executive Decision: In order to allow me to create
tarballs without losing files, I removed it. It's easy to put something
back if we find out why it might still be needed.

gdb/testsuite/ChangeLog:

        * Makefile.in (clean mostlyclean): Do not delete *.py.

Tested on x86_64-linux by running the src-release.sh script again,
and this time, dg-extract-results.py no longer gets wiped.

9 years agoSet GDB version number to 7.8.90.
Joel Brobecker [Tue, 13 Jan 2015 14:14:09 +0000 (18:14 +0400)] 
Set GDB version number to 7.8.90.

gdb/ChangeLog:

* version.in: Set GDB version number to 7.8.90.

9 years agoSet development mode to "off" by default.
Joel Brobecker [Tue, 13 Jan 2015 12:16:23 +0000 (16:16 +0400)] 
Set development mode to "off" by default.

bfd/ChangeLog:

* development.sh (development): Set to false.

9 years agoBump version to 7.8.90.DATE-cvs.
Joel Brobecker [Tue, 13 Jan 2015 12:15:27 +0000 (16:15 +0400)] 
Bump version to 7.8.90.DATE-cvs.

Now that the GDB 7.9 branch has been created, we can
bump the version number.

gdb/ChangeLog:

GDB 7.9 branch created (92fc2e6978d9a7c8324c7e851dbee59e22ec7a37):
* version.in: Bump version to 7.8.90.DATE-cvs.

9 years ago[ARI] Remove trailing new-line in argument of call to warning. gdb-7.9-branchpoint
Joel Brobecker [Tue, 13 Jan 2015 10:36:34 +0000 (14:36 +0400)] 
[ARI] Remove trailing new-line in argument of call to warning.

gdb/ChangeLog:

        * nat/linux-procfs.c (linux_proc_attach_tgid_threads):
        Remove trailing new-line in argument of call to warning.

9 years ago[ARI] Remove trailing new-line in argument of call to warning.
Joel Brobecker [Tue, 13 Jan 2015 10:35:49 +0000 (14:35 +0400)] 
[ARI] Remove trailing new-line in argument of call to warning.

gdb/ChangeLog:

* linux-nat.c (attach_proc_task_lwp_callback): Remove trailing
new-line in argument of call to "warning".

9 years ago[python/Ada] gdb.lookup_type fails to looking primitive type
Joel Brobecker [Mon, 12 Jan 2015 11:46:34 +0000 (15:46 +0400)] 
[python/Ada] gdb.lookup_type fails to looking primitive type

The following change...

    commit 1994afbf19892c9e614a034fbf1a5233e9addce3
    Date:   Tue Dec 23 07:55:39 2014 -0800
    Subject: Look up primitive types as symbols.

... caused the following regression:

    % gdb
    (gdb) set lang ada
    (gdb) python print gdb.lookup_type('character')
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    gdb.error: No type named character.
    Error while executing Python code.

This is because the language_lookup_primitive_type_as_symbol call
was moved to the la_lookup_symbol_nonlocal hook. A couple of
implementations have been upated accordingly, but the Ada version
has not. This patch fixes this omission.

gdb/ChangeLog:

        * ada-lang.c (ada_lookup_symbol_nonlocal): If name not found
        in static block, then try searching for primitive types.

gdb/testsuite/ChangeLog:

        * gdb.python/py-lookup-type.exp: New file.

9 years agoAutomatic date update in version.in
GDB Administrator [Tue, 13 Jan 2015 00:00:13 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 years agoAppend to input history file instead of overwriting it
Patrick Palka [Mon, 12 Jan 2015 22:51:33 +0000 (17:51 -0500)] 
Append to input history file instead of overwriting it

This patch makes readline append new history lines to the GDB history
file on exit instead of overwriting the entire history file on exit.
This change allows us to run multiple simultaneous GDB sessions without
having each session overwrite the added history of each other session on
exit.

Care must be taken to ensure that the history file doesn't get corrupted
when multiple GDB processes are trying to simultaneously append to and
then truncate it.  Safety is achieved in such a situation by using an
intermediate local history file to mutually exclude multiple processes
from simultaneously performing write operations on the global history
file.

gdb/ChangeLog:

* top.h (gdb_add_history): Declare.
* top.c (command_count): New variable.
(gdb_add_history): New function.
(gdb_safe_append_history): New static function.
(quit_force): Call it.
(command_line_input): Use gdb_add_history instead of
add_history.
* event-top.c (command_line_handler): Likewise.

9 years agoProperly check abbrev size
H.J. Lu [Mon, 12 Jan 2015 21:34:24 +0000 (13:34 -0800)] 
Properly check abbrev size

abbrev_base is independent of abbrev_size.  We should use abbrev_base +
abbrev_size to check abbrev section size.

* dwarf.c (process_debug_info): Properly check abbrev size.

9 years agoAnother fix for memory access errors trigegred by running readelf on a corrupt binary.
Nick Clifton [Mon, 12 Jan 2015 17:28:55 +0000 (17:28 +0000)] 
Another fix for memory access errors trigegred by running readelf on a corrupt binary.

PR binutils/17531
* dwarf.c (display_debug_addr): Use xcalloc to allocate the debug_addr_info
array.  Check for an address_base that is too large.

9 years ago[darwin/gdb] Use <setjmp.h> instead of <machine/setjmp.h>
James Clarke [Mon, 12 Jan 2015 17:13:54 +0000 (21:13 +0400)] 
[darwin/gdb] Use <setjmp.h> instead of <machine/setjmp.h>

The `machine/setjmp.h' header is no longer present on OS X 10.10, and is
non-standard. Instead, `darwin-nat.c' should be using the standard
`setjmp.h' header.

gdb/ChangeLog:

2015-01-12  James Clarke  <jrtc27@jrtc27.com>  (tiny patch)

PR gdb/17046
* darwin-nat.c: Replace <machine/setjmp.h> #include by
<setjmp.h> #include.

9 years agogdb.python/py-prompt.exp: restore GDBFLAGS
Pedro Alves [Mon, 12 Jan 2015 17:10:06 +0000 (17:10 +0000)] 
gdb.python/py-prompt.exp: restore GDBFLAGS

The previous change to py-prompt.exp made it return without restoring
GDBFLAGS, resulting in breaking the following tests:

  $ make check RUNTESTFLAGS="--target_board=native-gdbserver --directory=gdb.python"
  ...
  Running src/gdb/testsuite/gdb.python/py-prompt.exp ...
  Running src/gdb/testsuite/gdb.python/py-section-script.exp ...
  ERROR: (timeout) GDB never initialized after 10 seconds.
  ERROR: no fileid for gdbuild
  ERROR: Couldn't send python print ('test') to GDB.
  ERROR: no fileid for gdbuild
  ERROR: Couldn't send python print (sys.version_info[0]) to GDB.
  ERROR: no fileid for gdbuild
  ERROR: Couldn't send python print (sys.version_info[1]) to GDB.
  ERROR: no fileid for gdbuild
  ERROR: no fileid for gdbuild
  ...

gdb/testsuite/
2015-01-12  Pedro Alves  <palves@redhat.com>

* gdb.python/py-prompt.exp: When the board can't spawn for attach,
restore GDBFLAGS before returning.

9 years agoMore fixes for memory access errors when running readelf on fuzzed binaries.
Nick Clifton [Mon, 12 Jan 2015 16:08:41 +0000 (16:08 +0000)] 
More fixes for memory access errors when running readelf on fuzzed binaries.

PR binutils/17531
* dwarf.c (process_debug_info): Check for abbrev_base being larger
than the section size.
(process_cu_tu_index): Use xcalloc2 to allocate the CU and TU
arrays.
(xcalloc2): New function.  Like xcalloc, but checks for overflow.
* dwarf.h (xcalloc2): Prototype.

9 years agogas: allow labeling of CFI instructions
Jan Beulich [Mon, 12 Jan 2015 14:24:20 +0000 (15:24 +0100)] 
gas: allow labeling of CFI instructions

When runtime patching code (like e.g. done by the Linux kernel) there
may be cases where the set of stack frame alterations differs between
unpatched and patched code. Consequently the corresponding unwind data
needs patching too. Locating the right places within an FDE, however,
is rather cumbersome without a way to insert labels in the resulting
section. Hence this patch introduces a new directive, .cfi_label. Note
that with the way CFI data gets emitted currently (at the end of the
assembly process) this can't support local FB- and dollar-labels.

gas/
2015-01-12  Jan Beulich  <jbeulich@suse.com>

* gas/dw2gencfi.c (cfi_add_label, dot_cfi_label): New.
(cfi_pseudo_table): Add "cfi_label".
(output_cfi_insn): Handle CFI_label.
(select_cie_for_fde): Als terminate CIE when encountering
CFI_label.
* dw2gencfi.h (cfi_add_label): Declare.
(struct cfi_insn_data): New member "sym_name".
(CFI_label): New.
* read.c (read_symbol_name): Drop "static".
* read.h (read_symbol_name): Declare.

gas/testsuite/
2015-01-12  Jan Beulich  <jbeulich@suse.com>

gas/cfi/cfi-label.d, gas/cfi/cfi-label.s: New.
gas/cfi/cfi.exp: Run new tests.

9 years agoFix GDB crash caused by discarding grouped debug sections
Terry Guo [Mon, 12 Jan 2015 11:00:00 +0000 (21:30 +1030)] 
Fix GDB crash caused by discarding grouped debug sections

Keep a group containing just debug sections or the other special
sections we currently mark against garbage collection.

* elflink.c (_bfd_elf_gc_mark_debug_special_section_group): New
function.
(_bfd_elf_gc_mark_extra_sections): Use it.