]> git.ipfire.org Git - thirdparty/binutils-gdb.git/log
thirdparty/binutils-gdb.git
11 years agoAIX 32-bit core loading, high section addresses.
Pedro Alves [Wed, 12 Mar 2014 10:28:59 +0000 (10:28 +0000)] 
AIX 32-bit core loading, high section addresses.

I noticed GDB was failing to enable threading support for 32-bit AIX
cores.  I traced it to failure to read variables from libpthreads.a.
The issue is that data for that library is loaded at a high address,
and bfd is sign extending the section addresses:

 (gdb) info files
 Symbols from "/home/palves/crash".
 Local core dump file:
 `/home/palves/core', file type aixcoff-rs6000.
 0x2ff22000 - 0x2ff23000 is .stack
 0x20000000 - 0x200316e0 is .data
 0x20000e90 - 0x200016c0 is .data
 0xfffffffff0254000 - 0xfffffffff0297920 is .data
 0xfffffffff07b46a8 - 0xfffffffff07b47c8 is .data
 0xfffffffff0298000 - 0xfffffffff029bfcc is .data
 0xfffffffff06dafe0 - 0xfffffffff07b3838 is .data
 Local exec file:
 `/home/palves/crash', file type aixcoff-rs6000.
 Entry point: 0x20001394
 0x10000150 - 0x10000e90 is .text
 0x20000e90 - 0x2000149c is .data
 0x2000149c - 0x200016c0 is .bss
 0xd053b124 - 0xd053e15f is .text in /usr/lib/libpthreads.a(shr_comm.o)
 0xf0254000 - 0xf0297920 is .data in /usr/lib/libpthreads.a(shr_comm.o)
 0xf0254450 - 0xf0297920 is .bss in /usr/lib/libpthreads.a(shr_comm.o)
 0xd053a280 - 0xd053aabe is .text in /usr/lib/libcrypt.a(shr.o)
 0xf07b46a8 - 0xf07b47c8 is .data in /usr/lib/libcrypt.a(shr.o)
 0xf07b47c8 - 0xf07b47c8 is .bss in /usr/lib/libcrypt.a(shr.o)
 0xd04fb180 - 0xd053917e is .text in /usr/lib/libpthreads.a(shr_xpg5.o)
 0xf0298000 - 0xf029bfcc is .data in /usr/lib/libpthreads.a(shr_xpg5.o)
 0xf029bf64 - 0xf029bfcc is .bss in /usr/lib/libpthreads.a(shr_xpg5.o)
 0xd0100900 - 0xd04fa39c is .text in /usr/lib/libc.a(shr.o)
 0xf06dafe0 - 0xf07b3838 is .data in /usr/lib/libc.a(shr.o)
 0xf0751e94 - 0xf07b3838 is .bss in /usr/lib/libc.a(shr.o)

Notice:
...
0xfffffffff0298000 - 0xfffffffff029bfcc is .data
...

Those are the bfd section start/end addresses.  It't not visible here:

         ...
 0xf0298000 - 0xf029bfcc is .data in /usr/lib/libpthreads.a(shr_xpg5.o)
         ...

... just because GDB trims that number to 32-bit when printing.

GDB then fails to find the memory for libpthreads.a variables in the
core, and falls back to reading it directly from the executable (which
yields the values as originally initialized in the code).

E.g.:

 (gdb) p &__n_pthreads
 $2 = (<data variable, no debug info> *) 0xf074fda8 <__n_pthreads>
 (gdb) p __n_pthreads
 $1 = -1

That should have returned 2 instead of -1.

bfd/
2014-03-12  Pedro Alves  <palves@redhat.com>

PR gdb/16696
* rs6000-core.c (rs6000coff_core_p): Cast pointers to bfd_vma
through ptr_to_uint instead of through long.

11 years agoAutomatic date update in version.in
GDB Administrator [Wed, 12 Mar 2014 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Tue, 11 Mar 2014 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Mon, 10 Mar 2014 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Sun, 9 Mar 2014 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Sat, 8 Mar 2014 00:00:09 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Fri, 7 Mar 2014 00:00:09 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Thu, 6 Mar 2014 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoPR gdb/16575: stale breakpoint instructions in the code cache
Pedro Alves [Wed, 5 Mar 2014 14:18:28 +0000 (14:18 +0000)] 
PR gdb/16575: stale breakpoint instructions in the code cache

In non-stop mode, or rather, breakpoints always-inserted mode, the
code cache can easily end up with stale breakpoint instructions:

All it takes is filling a cache line when breakpoints already exist in
that memory region, and then delete the breakpoint.

Vis. (from the new test):

 (gdb) set breakpoint always-inserted on
 (gdb) b 23
 Breakpoint 2 at 0x400540: file ../../../src/gdb/testsuite/gdb.base/breakpoint-shadow.c, line 23.
 (gdb) b 24
 Breakpoint 3 at 0x400547: file ../../../src/gdb/testsuite/gdb.base/breakpoint-shadow.c, line 24.
 disass main
 Dump of assembler code for function main:
    0x000000000040053c <+0>:     push   %rbp
    0x000000000040053d <+1>:     mov    %rsp,%rbp
 => 0x0000000000400540 <+4>:     movl   $0x1,-0x4(%rbp)
    0x0000000000400547 <+11>:    movl   $0x2,-0x4(%rbp)
    0x000000000040054e <+18>:    mov    $0x0,%eax
    0x0000000000400553 <+23>:    pop    %rbp
    0x0000000000400554 <+24>:    retq
 End of assembler dump.

So far so good.  Now flush the code cache:

 (gdb) set code-cache off
 (gdb) set code-cache on

Requesting a disassembly works as expected, breakpoint shadowing is
applied:

 (gdb) disass main
 Dump of assembler code for function main:
    0x000000000040053c <+0>:     push   %rbp
    0x000000000040053d <+1>:     mov    %rsp,%rbp
 => 0x0000000000400540 <+4>:     movl   $0x1,-0x4(%rbp)
    0x0000000000400547 <+11>:    movl   $0x2,-0x4(%rbp)
    0x000000000040054e <+18>:    mov    $0x0,%eax
    0x0000000000400553 <+23>:    pop    %rbp
    0x0000000000400554 <+24>:    retq
 End of assembler dump.

However, now delete the breakpoints:

 (gdb) delete
 Delete all breakpoints? (y or n) y

And disassembly shows the old breakpoint instructions:

 (gdb) disass main
 Dump of assembler code for function main:
    0x000000000040053c <+0>:     push   %rbp
    0x000000000040053d <+1>:     mov    %rsp,%rbp
 => 0x0000000000400540 <+4>:     int3
    0x0000000000400541 <+5>:     rex.RB cld
    0x0000000000400543 <+7>:     add    %eax,(%rax)
    0x0000000000400545 <+9>:     add    %al,(%rax)
    0x0000000000400547 <+11>:    int3
    0x0000000000400548 <+12>:    rex.RB cld
    0x000000000040054a <+14>:    add    (%rax),%al
    0x000000000040054c <+16>:    add    %al,(%rax)
    0x000000000040054e <+18>:    mov    $0x0,%eax
    0x0000000000400553 <+23>:    pop    %rbp
    0x0000000000400554 <+24>:    retq
 End of assembler dump.

Those breakpoint instructions are no longer installed in target memory
they're stale in the code cache.  Easily confirmed by just disabling
the code cache:

 (gdb) set code-cache off
 (gdb) disass main
 Dump of assembler code for function main:
    0x000000000040053c <+0>:     push   %rbp
    0x000000000040053d <+1>:     mov    %rsp,%rbp
 => 0x0000000000400540 <+4>:     movl   $0x1,-0x4(%rbp)
    0x0000000000400547 <+11>:    movl   $0x2,-0x4(%rbp)
    0x000000000040054e <+18>:    mov    $0x0,%eax
    0x0000000000400553 <+23>:    pop    %rbp
    0x0000000000400554 <+24>:    retq
 End of assembler dump.

I stumbled upon this when writing a patch to infrun.c, that made
handle_inferior_event & co fill in the cache before breakpoints were
removed from the target.  Recall that wait_for_inferior flushes the
dcache for every event.  So in that case, always-inserted mode was not
necessary to trigger this.  It's just a convenient way to expose the
issue.

The dcache works at the raw memory level.  We need to update it
whenever memory is written, no matter what kind of target memory
object was originally passed down by the caller.  The issue is that
the dcache update code isn't reached when a caller explicitly writes
raw memory.  Breakpoint insertion/removal is one such case --
mem-break.c uses target_write_read_memory/target_write_raw_memory.

The fix is to move the dcache update code from memory_xfer_partial_1
to raw_memory_xfer_partial so that it's always reachable.

When we do that, we can actually simplify a series of things.
memory_xfer_partial_1 no longer needs to handle writes for any kind of
memory object, and therefore dcache_xfer_memory no longer needs to
handle writes either.  So the latter (dcache_xfer_memory) and its
callees can be simplified to only care about reads.  While we're
touching dcache_xfer_memory's prototype, might as well rename it to
reflect that fact that it only handles reads.

Currently dcache_xfer_memory handles the case of a write failing.  The
whole cache line is invalidated when that happens.  However,
dcache_update, the sole mechanism for handling writes that will remain
after the patch, does not presently handle that scenario.  That's a
bug.  The patch makes it handle that, by passing down the
to_xfer_partial result from the caller, so that it can better decide
what to do itself.  While I was changing the function's prototype, I
constified the myaddr parameter, getting rid of the need for the cast
as seen in its existing caller.

Tested on x86_64 Fedora 17, native and gdbserver.

gdb/
2014-03-05  Pedro Alves  <palves@redhat.com>

PR gdb/16575
* dcache.c (dcache_poke_byte): Constify ptr parameter.  Return
void.  Update comment.
(dcache_xfer_memory): Delete.
(dcache_read_memory_partial): New, based on the read bits of
dcache_xfer_memory.
(dcache_update): Add status parameter.  Use ULONGEST for len, and
adjust.  Discard cache lines if the reason for the update was
error.
* dcache.h (dcache_xfer_memory): Delete declaration.
(dcache_read_memory_partial): New declaration.
(dcache_update): Update prototype.
* target.c (raw_memory_xfer_partial): Update the dcache here.
(memory_xfer_partial_1): Don't handle dcache writes here.

gdb/testsuite/
2014-03-05  Pedro Alves  <palves@redhat.com>

PR gdb/16575
* gdb.base/breakpoint-shadow.exp (compare_disassembly): New
procedure.
(top level): Adjust to use it.  Add tests that exercise breakpoint
interaction with the code-cache.

11 years agoAutomatic date update in version.in
GDB Administrator [Wed, 5 Mar 2014 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Tue, 4 Mar 2014 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Mon, 3 Mar 2014 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Sun, 2 Mar 2014 00:00:06 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Sat, 1 Mar 2014 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Fri, 28 Feb 2014 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Thu, 27 Feb 2014 00:00:10 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoMake sure we don't resume the stepped thread by accident.
Pedro Alves [Wed, 26 Feb 2014 16:52:24 +0000 (16:52 +0000)] 
Make sure we don't resume the stepped thread by accident.

Say:

<stopped at a breakpoint in thread 2>
(gdb) thread 3
(gdb) step

The above triggers the prepare_to_proceed/deferred_step_ptid process,
which switches back to thread 2, to step over its breakpoint before
getting back to thread 3 and "step" it.

If while stepping over the breakpoint in thread 2, a signal arrives,
and it is set to pass/nostop, we'll set a step-resume breakpoint at
the supposed signal-handler resume address, and call keep_going.  The
problem is that we were supposedly stepping thread 3, and that
keep_going delivers a signal to thread 2, and due to scheduler-locking
off, resumes everything else, _including_ thread 3, the thread we want
stepping.  This means that we lose control of thread 3 until the next
event, when we stop everything.  The end result for the user, is that
GDB lost control of the "step".

Here's the current infrun debug output of the above, with the testcase
in the patch below:

infrun: clear_proceed_status_thread (Thread 0x2aaaab8f5700 (LWP 11663))
infrun: clear_proceed_status_thread (Thread 0x2aaaab6f4700 (LWP 11662))
infrun: clear_proceed_status_thread (Thread 0x2aaaab4f2b20 (LWP 11659))
infrun: proceed (addr=0xffffffffffffffff, signal=144, step=1)
infrun: prepare_to_proceed (step=1), switched to [Thread 0x2aaaab6f4700 (LWP 11662)]
infrun: resume (step=1, signal=0), trap_expected=1, current thread [Thread 0x2aaaab6f4700 (LWP 11662)] at 0x40098f
infrun: wait_for_inferior ()
infrun: target_wait (-1, status) =
infrun:   11659 [Thread 0x2aaaab6f4700 (LWP 11662)],
infrun:   status->kind = stopped, signal = SIGUSR1
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x40098f
infrun: random signal 30

Program received signal SIGUSR1, User defined signal 1.
infrun: signal arrived while stepping over breakpoint
infrun: inserting step-resume breakpoint at 0x40098f
infrun: resume (step=0, signal=30), trap_expected=0, current thread [Thread 0x2aaaab6f4700 (LWP 11662)] at 0x40098f

^^^ this is a wildcard resume.

infrun: prepare_to_wait
infrun: target_wait (-1, status) =
infrun:   11659 [Thread 0x2aaaab6f4700 (LWP 11662)],
infrun:   status->kind = stopped, signal = SIGTRAP
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x40098f
infrun: BPSTAT_WHAT_STEP_RESUME
infrun: resume (step=1, signal=0), trap_expected=1, current thread [Thread 0x2aaaab6f4700 (LWP 11662)] at 0x40098f

^^^ step-resume hit, meaning the handler returned, so we go back to stepping thread 3.

infrun: prepare_to_wait
infrun: target_wait (-1, status) =
infrun:   11659 [Thread 0x2aaaab6f4700 (LWP 11662)],
infrun:   status->kind = stopped, signal = SIGTRAP
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED

infrun: stop_pc = 0x40088b
infrun: switching back to stepped thread
infrun: Switching context from Thread 0x2aaaab6f4700 (LWP 11662) to Thread 0x2aaaab8f5700 (LWP 11663)
infrun: resume (step=1, signal=0), trap_expected=0, current thread [Thread 0x2aaaab8f5700 (LWP 11663)] at 0x400938
infrun: prepare_to_wait
infrun: target_wait (-1, status) =
infrun:   11659 [Thread 0x2aaaab8f5700 (LWP 11663)],
infrun:   status->kind = stopped, signal = SIGTRAP
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x40093a
infrun: keep going
infrun: resume (step=1, signal=0), trap_expected=0, current thread [Thread 0x2aaaab8f5700 (LWP 11663)] at 0x40093a
infrun: prepare_to_wait
infrun: target_wait (-1, status) =
infrun:   11659 [Thread 0x2aaaab8f5700 (LWP 11663)],
infrun:   status->kind = stopped, signal = SIGTRAP
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x40091e
infrun: stepped to a different line
infrun: stop_stepping
[Switching to Thread 0x2aaaab8f5700 (LWP 11663)]
69            (*myp) ++; /* set breakpoint child_two here */

^^^ we stopped at the wrong line.  We still stepped a bit because the
test is running in a loop, and when we got back to stepping thread 3,
it happened to be in the stepping range.  (The loop increments a
counter, and the test makes sure it increments exactly once.  Without
the fix, the counter increments a bunch, since the user-stepped thread
runs free without GDB noticing.)

The fix is to switch to the stepping thread before continuing for the
step-resume breakpoint.

gdb/
2014-02-26  Pedro Alves  <palves@redhat.com>

PR breakpoints/16292
* infrun.c (handle_signal_stop) <signal arrives while stepping
over a breakpoint>: Switch back to the stepping thread.

gdb/testsuite/
2014-02-26  Pedro Alves  <pedro@codesourcery.com>
    Pedro Alves  <palves@redhat.com>

PR breakpoints/16292
* gdb.threads/signal-while-stepping-over-bp-other-thread.c: New
file.
* gdb.threads/signal-while-stepping-over-bp-other-threadexp: New
file.

11 years agoAutomatic date update in version.in
GDB Administrator [Wed, 26 Feb 2014 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoPR gdb/16626
Jan Kratochvil [Tue, 25 Feb 2014 19:47:09 +0000 (20:47 +0100)] 
PR gdb/16626

gdb/testsuite/
2014-02-25  Jan Kratochvil  <jan.kratochvil@redhat.com>

PR gdb/16626
* gdb.base/auto-load.exp: Fix out-of-srctree run.

Message-ID: <87k3cjt3jl.fsf@fleche.redhat.com>

11 years agoPR gdb/16626
Jan Kratochvil [Tue, 25 Feb 2014 17:32:32 +0000 (18:32 +0100)] 
PR gdb/16626

Fix auto-load 7.7 regression,
the regression affects any loading from /usr/share/gdb/auto-load .

5b2bf9471f1499bee578fcd60c05afe85794e280 is the first bad commit
commit 5b2bf9471f1499bee578fcd60c05afe85794e280
Author: Doug Evans <xdje42@gmail.com>
Date:   Fri Nov 29 21:29:26 2013 -0800
    Move .debug_gdb_script processing to auto-load.c.
    Simplify handling of auto-loaded objfile scripts.

Fedora 20 x86_64
$ gdb -q /usr/lib64/libgobject-2.0.so
Reading symbols from /usr/lib64/libglib-2.0.so.0.3800.2...Reading symbols from
/usr/lib/debug/usr/lib64/libglib-2.0.so.0.3800.2.debug...done.
done.
(gdb) _

Fedora Rawhide x86_64
$ gdb -q /usr/lib64/libgobject-2.0.so
Reading symbols from /usr/lib64/libglib-2.0.so...Reading symbols from
/usr/lib/debug/usr/lib64/libglib-2.0.so.0.3990.0.debug...done.
done.
warning: File "/usr/lib64/libglib-2.0.so.0.3990.0-gdb.py" auto-loading has been declined by your `auto-load safe-path'
set to "$debugdir:$datadir/auto-load:/usr/bin/mono-gdb.py".
To enable execution of this file add
        add-auto-load-safe-path /usr/lib64/libglib-2.0.so.0.3990.0-gdb.py
line to your configuration file "/home/jkratoch/.gdbinit".
To completely disable this security protection add
        set auto-load safe-path /
line to your configuration file "/home/jkratoch/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
        info "(gdb)Auto-loading safe path"
(gdb) _

That is it tries to load "forbidden"
/usr/lib64/libglib-2.0.so.0.3990.0-gdb.py
but it should load instead
/usr/share/gdb/auto-load/usr/lib64/libglib-2.0.so.0.3990.0-gdb.py*
Although that is also not exactly this way, there does not exist any
/usr/lib64/libglib-2.0.so.0.3990.0-gdb.py
despite regressed GDB says so.

gdb/
2014-02-24  Jan Kratochvil  <jan.kratochvil@redhat.com>

PR gdb/16626
* auto-load.c (auto_load_objfile_script_1): Change filename to
debugfile.

gdb/testsuite/
2014-02-24  Jan Kratochvil  <jan.kratochvil@redhat.com>

PR gdb/16626
* gdb.base/auto-load-script: New file.
* gdb.base/auto-load.c: New file.
* gdb.base/auto-load.exp: New file.

Message-ID: <20140223212400.GA8831@host2.jankratochvil.net>

11 years agoAutomatic date update in version.in
GDB Administrator [Tue, 25 Feb 2014 00:00:09 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Mon, 24 Feb 2014 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Sun, 23 Feb 2014 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Sat, 22 Feb 2014 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Fri, 21 Feb 2014 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Thu, 20 Feb 2014 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Wed, 19 Feb 2014 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Tue, 18 Feb 2014 00:00:09 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Mon, 17 Feb 2014 00:00:10 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Sun, 16 Feb 2014 00:00:10 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Sat, 15 Feb 2014 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Fri, 14 Feb 2014 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Thu, 13 Feb 2014 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Wed, 12 Feb 2014 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Tue, 11 Feb 2014 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years ago PR build/16550
Rainer Orth [Mon, 10 Feb 2014 15:25:56 +0000 (16:25 +0100)] 
PR build/16550
* cache.c (bfd_cache_max_open): Cast RLIM_INFINITY to rlim_t.

11 years agoAutomatic date update in version.in
GDB Administrator [Mon, 10 Feb 2014 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoFix Python stack corruption
Jan Kratochvil [Sun, 9 Feb 2014 17:47:40 +0000 (18:47 +0100)] 
Fix Python stack corruption

The fix is obvious.

gdb/
2014-02-09  Jan Kratochvil  <jan.kratochvil@redhat.com>

Fix Python stack corruption.
* python/py-linetable.c (ltpy_get_pcs_for_line, ltpy_has_line): Use
gdb_py_longest.

Message-ID: <20140207171701.GA25187@host2.jankratochvil.net>

11 years agoAutomatic date update in version.in
GDB Administrator [Sun, 9 Feb 2014 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Sat, 8 Feb 2014 00:00:09 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Fri, 7 Feb 2014 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoBump GDB version number to 7.7.0.DATE-cvs.
Joel Brobecker [Thu, 6 Feb 2014 02:52:05 +0000 (06:52 +0400)] 
Bump GDB version number to 7.7.0.DATE-cvs.

gdb/ChangeLog:

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

11 years agoDocument the GDB 7.7 release in gdb/ChangeLog
Joel Brobecker [Thu, 6 Feb 2014 02:48:07 +0000 (06:48 +0400)] 
Document the GDB 7.7 release in gdb/ChangeLog

gdb/ChangeLog:

GDB 7.7 released.

11 years agoSet GDB version number to 7.7. gdb-7.7-release
Joel Brobecker [Thu, 6 Feb 2014 02:21:29 +0000 (06:21 +0400)] 
Set GDB version number to 7.7.

gdb/ChangeLog:

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

11 years agoNEWS: Rename "Changes since GDB 7.6" into "Changes in GDB 7.7"
Joel Brobecker [Thu, 6 Feb 2014 02:24:55 +0000 (06:24 +0400)] 
NEWS: Rename "Changes since GDB 7.6" into "Changes in GDB 7.7"

gdb/ChangeLog:

        * NEWS: Change "Changes since GDB 7.6" to "Changes in GDB 7.7".

11 years agoAutomatic date update in version.in
GDB Administrator [Thu, 6 Feb 2014 00:00:06 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoCreate inferior for ctf target.
Yao Qi [Thu, 30 Jan 2014 02:09:11 +0000 (10:09 +0800)] 
Create inferior for ctf target.

This patch creates inferior when GDB opens a ctf trace data, to be
consistent with tfile target.  A test case is added to test for
live target, tfile and ctf target.

gdb:

2014-02-05  Yao Qi  <yao@codesourcery.com>

* ctf.c: Include "inferior.h" and "gdbthread.h".
(CTF_PID): A new macro.
(ctf_open): Call inferior_appeared and add_thread_silent.
(ctf_close): Call exit_inferior_silent and set inferior_ptid.
(ctf_thread_alive): New function.
(init_ctf_ops): Install ctf_thread_alive to to_thread_alive.

gdb/testsuite:

2014-02-05  Yao Qi  <yao@codesourcery.com>

* gdb.trace/report.exp (use_collected_data): Test the output
of "info threads" and "info inferiors".

11 years agoCreate inferior for tfile target
Yao Qi [Thu, 30 Jan 2014 00:37:05 +0000 (08:37 +0800)] 
Create inferior for tfile target

When a trace file is loaded in Eclipse, it is expected to see thread
and process (=thread-group-started and =thread-created).  Create an
inferior and add a thread for this purpose.

This patch just reverts my previous patch.

gdb/testsuite:

2014-02-05  Yao Qi  <yao@codesourcery.com>

Revert this patch:

2013-05-24  Yao Qi  <yao@codesourcery.com>

* gdb.trace/tfile.exp: Test inferior and thread.

gdb:

2014-02-05  Yao Qi  <yao@codesourcery.com>

Revert this patch:

2013-05-24  Yao Qi  <yao@codesourcery.com>

* tracepoint.c (TFILE_PID): Remove.
(tfile_open): Don't add thread and inferior.
(tfile_close): Don't set 'inferior_ptid'.  Don't call
exit_inferior_silent.
(tfile_thread_alive): Remove.
(init_tfile_ops): Don't set field 'to_thread_alive' of
tfile_ops.

11 years agoAutomatic date update in version.in
GDB Administrator [Wed, 5 Feb 2014 00:00:06 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Tue, 4 Feb 2014 00:00:14 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Mon, 3 Feb 2014 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoFix shift for AVX512F gather/scatter instructions
Michael Zolotukhin [Thu, 30 Jan 2014 15:38:09 +0000 (07:38 -0800)] 
Fix shift for AVX512F gather/scatter instructions

opcodes/

2014-01-30  Michael Zolotukhin  <michael.v.zolotukhin@gmail.com>
    Jan Beulich  <jbeulich@suse.com>

PR binutils/16490
* i386-dis.c (OP_E_memory): Fix shift computation for
vex_vsib_q_w_dq_mode.

gas/testsuite/

2014-01-30  Michael Zolotukhin  <michael.v.zolotukhin@gmail.com>
    Jan Beulich  <jbeulich@suse.com>

PR binutils/16490
* gas/i386/avx512f.d: Fix test output.
* gas/i386/avx512f-intel.d: Likewise.
* gas/i386/x86-64-avx512f.d: Likewise.
* gas/i386/x86-64-avx512f-intel.d: Likewise.

Conflicts:
gas/testsuite/ChangeLog

11 years agoAutomatic date update in version.in
GDB Administrator [Sun, 2 Feb 2014 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Sat, 1 Feb 2014 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Fri, 31 Jan 2014 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Thu, 30 Jan 2014 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Wed, 29 Jan 2014 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoFix info-shared.exp testcase to expect the leading `.' found on ppc64's symbols.
Edjunior Barbosa Machado [Tue, 28 Jan 2014 17:14:40 +0000 (15:14 -0200)] 
Fix info-shared.exp testcase to expect the leading `.' found on ppc64's symbols.

gdb/testsuite/
2014-01-28  Edjunior Barbosa Machado  <emachado@linux.vnet.ibm.com>

* gdb.base/info-shared.exp: Expect leading `.' on ppc64's symbols.

11 years agoFix typo in ppc64_standard_linkage7
Ulrich Weigand [Tue, 28 Jan 2014 16:49:13 +0000 (17:49 +0100)] 
Fix typo in ppc64_standard_linkage7

The ppc64_standard_linkage7 pattern added by Alan's recent patch:
https://sourceware.org/ml/gdb-patches/2013-11/msg00274.html
contains a typo: the ELFv2 TOC slot offset is 24, not 40.
This was correct in the comment, but not the actual code.

ChangeLog:

* ppc64-tdep.c (ppc64_standard_linkage7): Fix typo.

11 years agoAutomatic date update in version.in
GDB Administrator [Tue, 28 Jan 2014 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Mon, 27 Jan 2014 00:00:11 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Sun, 26 Jan 2014 00:00:09 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Sat, 25 Jan 2014 00:00:09 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Fri, 24 Jan 2014 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoavoid python exception in FrameDecorator.py
Tom Tromey [Wed, 22 Jan 2014 15:52:15 +0000 (08:52 -0700)] 
avoid python exception in FrameDecorator.py

This fixes a bug in FrameDecorator.py.

FrameVars seems to assume that Frame.block can return None if there is
no block.  However, it actually throws an exception.

I saw this bug while developing a frame filter, but unfortunately I
don't know how to reproduce it.  It seems to me that the SAL tests in
_is_limited_frame should exclude the bad cases; and in my attempts to
write a test they do.

Nevertheless I think the fix is reasonably obvious and ought to go in.

2014-01-23  Tom Tromey  <tromey@redhat.com>

PR python/16485:
* python/lib/gdb/FrameDecorator.py: (FrameVars.fetch_frame_args):
Handle exception from frame.block.
(FrameVars.fetch_frame_locals): Likewise.

11 years agofix erroneous error-handling in frame filter code
Tom Tromey [Wed, 22 Jan 2014 15:44:41 +0000 (08:44 -0700)] 
fix erroneous error-handling in frame filter code

This fixes PR python/16487.

The bug here is that the function-name-handling code in py_print_frame
had a small logic error (really a misplaced closing brace).  This
error could lead to a Py_DECREF(NULL), which crashes.

This patch fixes the bug in the obvious way.

Built and regtested on x86-64 Fedora 18.  New test case included.

2014-01-23  Tom Tromey  <tromey@redhat.com>

PR python/16487:
* python/py-framefilter.c (py_print_frame): Don't call Py_DECREF
on a NULL pointer.  Move "goto error" to correct place.

2014-01-23  Tom Tromey  <tromey@redhat.com>

PR python/16487:
* gdb.python/py-framefilter.exp: Add test using "Error" filter.
* gdb.python/py-framefilter.py (ErrorInName, ErrorFilter): New
classes.

11 years agofix crash in frame filters
Tom Tromey [Wed, 22 Jan 2014 15:10:01 +0000 (08:10 -0700)] 
fix crash in frame filters

apply_frame_filter calls ensure_python_env before computing the
gdbarch to use.  This means that python_gdbarch can be NULL while in
Python code, and if a frame filter depends on this somehow (easy to
do), gdb will crash.

The fix is to compute the gdbarch first.

Built and regtested on x86-64 Fedora 18.
New test case included.

2014-01-23  Tom Tromey  <tromey@redhat.com>

PR python/16491:
* python/py-framefilter.c (apply_frame_filter): Call
ensure_python_env after computing gdbarch.

2014-01-23  Tom Tromey  <tromey@redhat.com>

PR python/16491:
* gdb.python/py-framefilter.py (Reverse_Function.function): Read a
string from an inferior frame.
* gdb.python/py-framefilter-mi.exp: Update.

11 years agoAutomatic date update in version.in
GDB Administrator [Thu, 23 Jan 2014 00:00:09 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agogdb: xtensa: fix on 64-bit hosts
Baruch Siach [Wed, 22 Jan 2014 13:02:29 +0000 (15:02 +0200)] 
gdb: xtensa: fix on 64-bit hosts

On 64-bit hosts unsigned long is 64 bit.  Use uint32_t instead.

gdb/
2014-01-22  Baruch Siach  <baruch@tkos.co.il>

* xtensa-tdep.h (xtensa_elf_greg_t): Change type to uint32_t.

11 years agoxtensa-config.c: missing defs.h include.
Pedro Alves [Wed, 22 Jan 2014 12:17:26 +0000 (12:17 +0000)] 
xtensa-config.c: missing defs.h include.

All .c files must start by including defs.h.

2014-01-22  Pedro Alves  <palves@redhat.com>

* xtensa-config.c: Include defs.h.

11 years agogdb: xtensa: fix linux ptrace includes
Baruch Siach [Wed, 22 Jan 2014 12:18:29 +0000 (12:18 +0000)] 
gdb: xtensa: fix linux ptrace includes

Currently, xtensa code using the Linux ptrace interface only include
sys/ptrace.h.  This file comes from the C library (glibc and uClibc,
at least), and includes a declaration of the ptrace() functions, along
with some cross architecture constants that are mostly copied from the
file located at include/uapi/linux/ptrace.h in recent Linux kernels.

For xtensa specific constants like PTRACE_GETXTREGS and
PTRACE_SETXTREGS the asm/ptrace.h include from the Linux kernel UAPI
is needed.  The code in gdbserver xtensa specific part doesn't call
ptrace() directly, so we can remove the unneeded sys/ptrace.h include.
The gdb xtensa specific code needs both headers, since it calls
ptrace().

gdb/
* xtensa-linux-nat.c: Include asm/ptrace.h.

gdb/gdbserver/
* linux-xtensa-low.c: Include asm/ptrace.h instead of
sys/ptrace.h.

11 years agoAutomatic date update in version.in
GDB Administrator [Wed, 22 Jan 2014 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agogdb: Support install-strip target
Roland McGrath [Tue, 21 Jan 2014 19:01:04 +0000 (11:01 -0800)] 
gdb: Support install-strip target

gdb/
* configure.ac: Call AM_PROG_INSTALL_STRIP.
* configure: Regenerate.
* aclocal.m4: Regenerate.
* Makefile.in (install_sh, INSTALL_STRIP_PROGRAM, STRIP):
New substituted variables.
(install-strip): New target.
(INSTALL_SCRIPT): New substituted variable.
(FLAGS_TO_PASS): Add it.
(install-only): Use $(INSTALL_SCRIPT) rather than
$(INSTALL_PROGRAM) for gcore.

(cherry picked from commit 4869db5e97b2062a3adf81158577171990248ef3)

11 years agoAutomatic date update in version.in
GDB Administrator [Tue, 21 Jan 2014 00:00:10 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Mon, 20 Jan 2014 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Sun, 19 Jan 2014 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Sat, 18 Jan 2014 00:00:10 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Fri, 17 Jan 2014 00:00:09 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agodwarf2read.c (open_and_init_dwp_file): Fix typo in comment.
Doug Evans [Thu, 16 Jan 2014 17:33:00 +0000 (09:33 -0800)] 
dwarf2read.c (open_and_init_dwp_file): Fix typo in comment.

11 years agoFix go32-nat.c build fallout from to_detach constification.
Pedro Alves [Wed, 15 Jan 2014 12:53:04 +0000 (12:53 +0000)] 
Fix go32-nat.c build fallout from to_detach constification.

The recent constification of to_detach missed updating the forward
declaration of go32_detach, breaking the build:

 ../../src/gdb/go32-nat.c:387:1: error: conflicting types for 'go32_detach'
 ../../src/gdb/go32-nat.c:240:13: note: previous declaration of 'go32_detach' was here

go32_detach is actually defined before it's ever used, making the
forward declaration is unnecessary.  So we can just remove it instead
of updating it.  While at it, remove all others in the same situation.
Tested by building a djgpp gdb.

gdb/
2014-01-16  Pedro Alves  <palves@redhat.com>

* go32-nat.c (go32_open, go32_close, go32_attach, go32_detach)
(go32_resume, go32_fetch_registers, store_register)
(go32_store_registers, go32_prepare_to_store)
(go32_xfer_memory, go32_files_info, go32_kill_inferior)
(go32_create_inferior, go32_can_run, go32_terminal_init)
(go32_terminal_inferior, go32_terminal_ours): Delete forward
declarations.

11 years agoAutomatic date update in version.in
GDB Administrator [Thu, 16 Jan 2014 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years ago* dwarf2read.c (open_and_init_dwp_file): Use pulongest to print uint32_t.
Doug Evans [Wed, 15 Jan 2014 21:19:08 +0000 (13:19 -0800)] 
* dwarf2read.c (open_and_init_dwp_file): Use pulongest to print uint32_t.

11 years agoFix small style violation in py-value.c:get_field_type
Joel Brobecker [Wed, 15 Jan 2014 12:40:22 +0000 (16:40 +0400)] 
Fix small style violation in py-value.c:get_field_type

gdb/ChangeLog:

        * python/py-value.c (get_field_type): Remove unnecessary curly
        braces for single-statement if block.

Tested on x86_64-linux.

11 years agoAdd missing empty line after declarations in "if" block (py-type.c).
Joel Brobecker [Wed, 15 Jan 2014 12:28:08 +0000 (16:28 +0400)] 
Add missing empty line after declarations in "if" block (py-type.c).

This patch fixes a small coding-style violation...

gdb/ChangeLog:

        * python/py-type.c (convert_field): Add missing empty line
        after declarations.

11 years agoUse bitpos and type to lookup a gdb.Field object when its name is 'None'.
Siva Chandra [Fri, 27 Dec 2013 20:20:59 +0000 (12:20 -0800)] 
Use bitpos and type to lookup a gdb.Field object when its name is 'None'.

PR python/15464
PR python/16113
* valops.c (value_struct_elt_bitpos): New function
* py-type.c (convert_field): Set 'name' attribute of a gdb.Field
object to 'None' if the field name is an empty string ("").
* python/py-value.c (valpy_getitem): Use 'bitpos' and 'type'
attribute to look for a field when 'name' is 'None'.
(get_field_type): New function

testsuite/
* gdb.python/py-type.c: Enhance test case.
* gdb.python/py-value-cc.cc: Likewise
* gdb.python/py-type.exp: Add new tests.
* gdb.python/py-value-cc.exp: Likewise

11 years agoAutomatic date update in version.in
GDB Administrator [Wed, 15 Jan 2014 00:00:09 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoPR symtab/16426
Doug Evans [Tue, 14 Jan 2014 22:49:25 +0000 (14:49 -0800)] 
PR symtab/16426

* dwarf2read.c (dwarf2_get_dwz_file): Call gdb_bfd_record_inclusion.
(try_open_dwop_file): Ditto.
* gdb_bfd.c: #include "vec.h".
(bfdp): New typedef.
(struct gdb_bfd_data): New member included_bfds.
(gdb_bfd_unref): Unref all included bfds.
(gdb_bfd_record_inclusion): New function.
* gdb_bfd.h (gdb_bfd_record_inclusion): Declare.

11 years agoAutomatic date update in version.in
GDB Administrator [Tue, 14 Jan 2014 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoFix set auto-load safe-path false warning regression (PR 16216)
Jan Kratochvil [Mon, 13 Jan 2014 20:20:21 +0000 (21:20 +0100)] 
Fix set auto-load safe-path false warning regression (PR 16216)

gdb/
2014-01-07  Jan Kratochvil  <jan.kratochvil@redhat.com>

PR threads/16216
* linux-thread-db.c (try_thread_db_load): Add parameter
check_auto_load_safe.  Move here the file_is_auto_load_safe call.
(try_thread_db_load_from_pdir_1): Move it there from here.
(try_thread_db_load_from_sdir): Update caller.
(try_thread_db_load_from_dir): Move it there from here.

11 years agoFix the ChangeLog's EOL format screwed up by cherry-pick.
Eli Zaretskii [Mon, 13 Jan 2014 19:08:37 +0000 (21:08 +0200)] 
Fix the ChangeLog's EOL format screwed up by cherry-pick.

11 years agoFix MinGW compilation errors in gdbserver/.
Eli Zaretskii [Mon, 13 Jan 2014 18:54:47 +0000 (20:54 +0200)] 
Fix MinGW compilation errors in gdbserver/.

gdb/gdbserver/Makefile.in (INCLUDE_CFLAGS): Remove trailing slash from
"-I$(srcdir)/../".  Fixes MinGW compilation errors with old GCC versions.

11 years agoAutomatic date update in version.in
GDB Administrator [Mon, 13 Jan 2014 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Sun, 12 Jan 2014 00:00:11 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Sat, 11 Jan 2014 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoAutomatic date update in version.in
GDB Administrator [Fri, 10 Jan 2014 00:00:09 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoFix buffer underrun in i386-dis.c.
Roland McGrath [Thu, 9 Jan 2014 18:13:10 +0000 (10:13 -0800)] 
Fix buffer underrun in i386-dis.c.

opcodes/
* i386-dis.c (print_insn): Do not touch all_prefixes[-1] when
last_rex_prefix is -1.

(cherry picked from commit e2e6193d65a20e6b7fccba288e5d1bc45b78d194)

11 years agoAutomatic date update in version.in
GDB Administrator [Thu, 9 Jan 2014 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

11 years agoBump GDB version number to 7.6.90.DATE-cvs.
Joel Brobecker [Wed, 8 Jan 2014 10:01:48 +0000 (14:01 +0400)] 
Bump GDB version number to 7.6.90.DATE-cvs.

gdb/ChangeLog:

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

11 years agoDocument the GDB 7.6.90 release in gdb/ChangeLog
Joel Brobecker [Wed, 8 Jan 2014 10:01:33 +0000 (14:01 +0400)] 
Document the GDB 7.6.90 release in gdb/ChangeLog

gdb/ChangeLog:

GDB 7.6.90 released.

11 years agoSet GDB version number to 7.6.90.
Joel Brobecker [Wed, 8 Jan 2014 09:46:59 +0000 (13:46 +0400)] 
Set GDB version number to 7.6.90.

gdb/ChangeLog:

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