Compare commits

...

101 Commits

Author SHA1 Message Date
Joel Brobecker
4bd8fc3a13 Set GDB version number to 7.7.1.
gdb/ChangeLog:

	* version.in: Set GDB version number to 7.7.1.
2014-05-05 14:51:25 -07:00
GDB Administrator
48583b3e99 Automatic date update in version.in 2014-05-05 00:00:09 +00:00
GDB Administrator
a3d7b4db0f Automatic date update in version.in 2014-05-04 00:00:08 +00:00
GDB Administrator
a2ef434fa3 Automatic date update in version.in 2014-05-03 00:00:07 +00:00
GDB Administrator
d49b013545 Automatic date update in version.in 2014-05-02 00:00:12 +00:00
GDB Administrator
1aaa02526a Automatic date update in version.in 2014-05-01 00:00:08 +00:00
GDB Administrator
9c644de58e Automatic date update in version.in 2014-04-30 00:00:07 +00:00
GDB Administrator
f105c30654 Automatic date update in version.in 2014-04-29 00:00:08 +00:00
GDB Administrator
12c9d71bb0 Automatic date update in version.in 2014-04-28 00:00:07 +00:00
GDB Administrator
fd2d29157c Automatic date update in version.in 2014-04-27 00:00:07 +00:00
GDB Administrator
a4e669de9b Automatic date update in version.in 2014-04-26 00:00:06 +00:00
GDB Administrator
ca70682781 Automatic date update in version.in 2014-04-25 00:00:07 +00:00
Nick Clifton
8a90a4ef6a Following up on Tom's suggestion I am checking in a patch to replace the various
bfd_xxx_set macros with static inline functions, so that we can avoid compile time
warnings about comma expressions with unused values.

	PR build/16873
	* bfd-in.h (bfd_set_section_vma): Delete.
	(bfd_set_section_alignment): Delete.
	(bfd_set_section_userdata): Delete.
	(bfd_set_cacheable): Delete.
	* bfd.c (bfd_set_cacheable): New static inline function.
	* section.c (bfd_set_section_userdata): Likewise.
	(bfd_set_section_vma): Likewise.
	(bfd_set_section_alignment): Likewise.
	* bfd-in2.h: Regenerate.
2014-04-24 20:07:40 -03:00
GDB Administrator
87a1630ead Automatic date update in version.in 2014-04-24 00:00:08 +00:00
GDB Administrator
60180965bc Automatic date update in version.in 2014-04-23 00:00:08 +00:00
GDB Administrator
2efbb06d22 Automatic date update in version.in 2014-04-22 00:00:07 +00:00
GDB Administrator
c21d327c0c Automatic date update in version.in 2014-04-21 00:00:06 +00:00
GDB Administrator
4e608f2e34 Automatic date update in version.in 2014-04-20 00:00:08 +00:00
Eli Zaretskii
230109e7ff PR gdb/14018 -- avoid "PC register not available" errors.
gdb/windows-nat.c (thread_rec): Don't display a warning when
SuspendThread fails with ERROR_ACCESS_DENIED.  If SuspendThread
fails for any reason, set th->suspended to -1, so that we don't
try to resume such a thread.  Also, don't return NULL in these
cases, to avoid completely ruin the session due to "PC register is
not available" error.
(do_windows_fetch_inferior_registers): Check errors in
GetThreadContext call.
(windows_continue): Accept an additional argument KILLED; if not
zero, ignore errors in the SetThreadContext call, since the
inferior was killed and is shutting down.
(windows_resume, get_windows_debug_event)
(windows_create_inferior, windows_mourn_inferior)
(windows_kill_inferior): All callers of windows_continue changed
to adjust to its new calling sequence.
2014-04-19 11:24:46 +03:00
GDB Administrator
b4a18502ba Automatic date update in version.in 2014-04-19 00:00:07 +00:00
GDB Administrator
8fe73b351d Automatic date update in version.in 2014-04-18 00:00:07 +00:00
GDB Administrator
41683d52d5 Automatic date update in version.in 2014-04-17 00:00:07 +00:00
GDB Administrator
3dfbfcef59 Automatic date update in version.in 2014-04-16 00:00:07 +00:00
GDB Administrator
24e98d1dd3 Automatic date update in version.in 2014-04-15 00:00:08 +00:00
GDB Administrator
68e9e29c82 Automatic date update in version.in 2014-04-14 00:00:08 +00:00
GDB Administrator
b21f3065f4 Automatic date update in version.in 2014-04-13 00:00:08 +00:00
GDB Administrator
cc5d52b482 Automatic date update in version.in 2014-04-12 00:00:08 +00:00
Pierre Langlois
999686dbc1 Erroneous backtrace on AVR.
PR backtrace/16721
	PR backtrace/16832
	* avr-tdep.c (struct gdbarch_tdep): Mention avrxmega in the comment.
	(avr_gdbarch_init): Add xmega architectures given by bfd_architecture
	when setting the size of call_length.
	(avr_scan_prologue): Accept push r1 instruction for small stack
	allocation.
	* MAINTAINERS (Write After Approval): Add "Pierre Langlois".
2014-04-11 10:31:26 +01:00
GDB Administrator
7456303a04 Automatic date update in version.in 2014-04-11 00:00:08 +00:00
GDB Administrator
385bdf6339 Automatic date update in version.in 2014-04-10 00:00:12 +00:00
GDB Administrator
ac8c178f3c Automatic date update in version.in 2014-04-09 00:00:10 +00:00
GDB Administrator
eb7e3e2de0 Automatic date update in version.in 2014-04-08 00:00:09 +00:00
GDB Administrator
7b3ae47652 Automatic date update in version.in 2014-04-07 00:00:07 +00:00
GDB Administrator
7cdb9e50cd Automatic date update in version.in 2014-04-06 00:00:07 +00:00
GDB Administrator
a799b84bec Automatic date update in version.in 2014-04-05 00:00:07 +00:00
GDB Administrator
2130bcaff7 Automatic date update in version.in 2014-04-04 00:00:07 +00:00
GDB Administrator
d4a0e7b071 Automatic date update in version.in 2014-04-03 00:00:07 +00:00
GDB Administrator
157b39bcf7 Automatic date update in version.in 2014-04-02 00:00:07 +00:00
GDB Administrator
9f5dbd6b28 Automatic date update in version.in 2014-04-01 00:00:07 +00:00
GDB Administrator
e2373c51c1 Automatic date update in version.in 2014-03-31 00:00:07 +00:00
GDB Administrator
85edbe3d78 Automatic date update in version.in 2014-03-30 00:00:08 +00:00
GDB Administrator
7a2b89eb22 Automatic date update in version.in 2014-03-29 00:00:08 +00:00
GDB Administrator
c3db1309cf Automatic date update in version.in 2014-03-28 00:00:07 +00:00
GDB Administrator
f0632b0cc5 Automatic date update in version.in 2014-03-27 00:00:06 +00:00
GDB Administrator
71882adabe Automatic date update in version.in 2014-03-26 00:00:07 +00:00
GDB Administrator
917084c994 Automatic date update in version.in 2014-03-25 00:00:09 +00:00
GDB Administrator
0de9013b39 Automatic date update in version.in 2014-03-24 00:00:07 +00:00
GDB Administrator
ca1fa2152d Automatic date update in version.in 2014-03-23 00:00:08 +00:00
GDB Administrator
c6961503c0 Automatic date update in version.in 2014-03-22 00:00:08 +00:00
GDB Administrator
e54718a504 Automatic date update in version.in 2014-03-21 00:00:08 +00:00
GDB Administrator
5525b6a9b6 Automatic date update in version.in 2014-03-20 00:00:07 +00:00
GDB Administrator
d580d76896 Automatic date update in version.in 2014-03-19 00:00:09 +00:00
GDB Administrator
2b87046f7f Automatic date update in version.in 2014-03-18 00:00:11 +00:00
GDB Administrator
c9b40b66ff Automatic date update in version.in 2014-03-17 00:00:08 +00:00
GDB Administrator
a1f93fc6fd Automatic date update in version.in 2014-03-16 00:00:07 +00:00
GDB Administrator
c782ba4621 Automatic date update in version.in 2014-03-15 00:00:08 +00:00
GDB Administrator
abd81597b3 Automatic date update in version.in 2014-03-14 00:00:07 +00:00
GDB Administrator
fc9ec34d8a Automatic date update in version.in 2014-03-13 00:00:07 +00:00
Pedro Alves
0136e467ea 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.
2014-03-12 10:28:59 +00:00
GDB Administrator
e80f9a926c Automatic date update in version.in 2014-03-12 00:00:07 +00:00
GDB Administrator
e7e3187f9a Automatic date update in version.in 2014-03-11 00:00:07 +00:00
GDB Administrator
133152d027 Automatic date update in version.in 2014-03-10 00:00:07 +00:00
GDB Administrator
444f0736e7 Automatic date update in version.in 2014-03-09 00:00:08 +00:00
GDB Administrator
70e0687e90 Automatic date update in version.in 2014-03-08 00:00:09 +00:00
GDB Administrator
630cfb3be8 Automatic date update in version.in 2014-03-07 00:00:09 +00:00
GDB Administrator
3f5670f01b Automatic date update in version.in 2014-03-06 00:00:07 +00:00
Pedro Alves
66bb3d16d4 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.
2014-03-05 14:43:32 +00:00
GDB Administrator
79a33da92a Automatic date update in version.in 2014-03-05 00:00:08 +00:00
GDB Administrator
489f6a8faf Automatic date update in version.in 2014-03-04 00:00:08 +00:00
GDB Administrator
6136a7464c Automatic date update in version.in 2014-03-03 00:00:08 +00:00
GDB Administrator
7c8dd2a40d Automatic date update in version.in 2014-03-02 00:00:06 +00:00
GDB Administrator
0bbe110888 Automatic date update in version.in 2014-03-01 00:00:07 +00:00
GDB Administrator
b0f2293c3d Automatic date update in version.in 2014-02-28 00:00:07 +00:00
GDB Administrator
e1e2bfeaaf Automatic date update in version.in 2014-02-27 00:00:10 +00:00
Pedro Alves
8fd1f4997c 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.
2014-02-26 16:52:24 +00:00
GDB Administrator
95bffc909f Automatic date update in version.in 2014-02-26 00:00:07 +00:00
Jan Kratochvil
c978954597 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>
2014-02-25 20:49:13 +01:00
Jan Kratochvil
5b91e80ee9 PR gdb/16626
Fix auto-load 7.7 regression,
the regression affects any loading from /usr/share/gdb/auto-load .

5b2bf9471f is the first bad commit
commit 5b2bf9471f
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>
2014-02-25 18:37:30 +01:00
GDB Administrator
599c9f4265 Automatic date update in version.in 2014-02-25 00:00:09 +00:00
GDB Administrator
bd3f479188 Automatic date update in version.in 2014-02-24 00:00:07 +00:00
GDB Administrator
e282c38bad Automatic date update in version.in 2014-02-23 00:00:08 +00:00
GDB Administrator
870c6c4dba Automatic date update in version.in 2014-02-22 00:00:07 +00:00
GDB Administrator
4cd5f720b1 Automatic date update in version.in 2014-02-21 00:00:08 +00:00
GDB Administrator
88024e5aa4 Automatic date update in version.in 2014-02-20 00:00:08 +00:00
GDB Administrator
0c42885255 Automatic date update in version.in 2014-02-19 00:00:07 +00:00
GDB Administrator
6f3d2e63a9 Automatic date update in version.in 2014-02-18 00:00:09 +00:00
GDB Administrator
82b4c46a06 Automatic date update in version.in 2014-02-17 00:00:10 +00:00
GDB Administrator
2f41abfbe3 Automatic date update in version.in 2014-02-16 00:00:10 +00:00
GDB Administrator
5c653ddab9 Automatic date update in version.in 2014-02-15 00:00:08 +00:00
GDB Administrator
ee54ba5aa1 Automatic date update in version.in 2014-02-14 00:00:08 +00:00
GDB Administrator
0b6558d052 Automatic date update in version.in 2014-02-13 00:00:07 +00:00
GDB Administrator
f3ce66c80c Automatic date update in version.in 2014-02-12 00:00:07 +00:00
GDB Administrator
e317dab76a Automatic date update in version.in 2014-02-11 00:00:07 +00:00
Rainer Orth
db269beda4 PR build/16550
* cache.c (bfd_cache_max_open): Cast RLIM_INFINITY to rlim_t.
2014-02-10 16:25:56 +01:00
GDB Administrator
d0be77a38c Automatic date update in version.in 2014-02-10 00:00:08 +00:00
Jan Kratochvil
e661fce02d 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>
2014-02-09 18:51:59 +01:00
GDB Administrator
83c94bab29 Automatic date update in version.in 2014-02-09 00:00:08 +00:00
GDB Administrator
d5577c7a9c Automatic date update in version.in 2014-02-08 00:00:09 +00:00
GDB Administrator
3a8074179a Automatic date update in version.in 2014-02-07 00:00:07 +00:00
Joel Brobecker
1d272e5ce4 Bump GDB version number to 7.7.0.DATE-cvs.
gdb/ChangeLog:

	* version.in: Set GDB version number to 7.7.0.DATE-cvs.
2014-02-06 06:52:05 +04:00
Joel Brobecker
684d4bcc6b Document the GDB 7.7 release in gdb/ChangeLog
gdb/ChangeLog:

	GDB 7.7 released.
2014-02-06 06:48:07 +04:00
26 changed files with 690 additions and 138 deletions

View File

@@ -1,3 +1,28 @@
2014-04-24 Nick Clifton <nickc@redhat.com>
2014-01-29 Nick Clifton <nickc@redhat.com>
PR build/16873
* bfd-in.h (bfd_set_section_vma): Delete.
(bfd_set_section_alignment): Delete.
(bfd_set_section_userdata): Delete.
(bfd_set_cacheable): Delete.
* bfd.c (bfd_set_cacheable): New static inline function.
* section.c (bfd_set_section_userdata): Likewise.
(bfd_set_section_vma): Likewise.
(bfd_set_section_alignment): Likewise.
* bfd-in2.h: Regenerate.
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.
2014-02-17 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
PR build/16550
* cache.c (bfd_cache_max_open): Cast RLIM_INFINITY to rlim_t.
2014-01-07 Tom Tromey <tromey@redhat.com>
* elf32-xtensa.c (vsprint_msg): Don't use old VA_* compatibility

View File

@@ -292,9 +292,6 @@ typedef struct bfd_section *sec_ptr;
#define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = TRUE), TRUE)
#define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),TRUE)
#define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),TRUE)
/* Find the address one past the end of SEC. */
#define bfd_get_section_limit(bfd, sec) \
(((bfd)->direction != write_direction && (sec)->rawsize != 0 \
@@ -517,8 +514,6 @@ extern void warn_deprecated (const char *, const char *, int, const char *);
#define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char)
#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = bool), TRUE)
extern bfd_boolean bfd_cache_close
(bfd *abfd);
/* NB: This declaration should match the autogenerated one in libbfd.h. */

View File

@@ -299,9 +299,6 @@ typedef struct bfd_section *sec_ptr;
#define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = TRUE), TRUE)
#define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),TRUE)
#define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),TRUE)
/* Find the address one past the end of SEC. */
#define bfd_get_section_limit(bfd, sec) \
(((bfd)->direction != write_direction && (sec)->rawsize != 0 \
@@ -524,8 +521,6 @@ extern void warn_deprecated (const char *, const char *, int, const char *);
#define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char)
#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = bool), TRUE)
extern bfd_boolean bfd_cache_close
(bfd *abfd);
/* NB: This declaration should match the autogenerated one in libbfd.h. */
@@ -1029,7 +1024,7 @@ bfd *bfd_openr (const char *filename, const char *target);
bfd *bfd_fdopenr (const char *filename, const char *target, int fd);
bfd *bfd_openstreamr (const char *, const char *, void *);
bfd *bfd_openstreamr (const char * filename, const char * target, void * stream);
bfd *bfd_openr_iovec (const char *filename, const char *target,
void *(*open_func) (struct bfd *nbfd,
@@ -1596,6 +1591,32 @@ struct relax_table {
int size;
};
/* Note: the following are provided as inline functions rather than macros
because not all callers use the return value. A macro implementation
would use a comma expression, eg: "((ptr)->foo = val, TRUE)" and some
compilers will complain about comma expressions that have no effect. */
static inline bfd_boolean
bfd_set_section_userdata (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, void * val)
{
ptr->userdata = val;
return TRUE;
}
static inline bfd_boolean
bfd_set_section_vma (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, bfd_vma val)
{
ptr->vma = ptr->lma = val;
ptr->user_set_vma = TRUE;
return TRUE;
}
static inline bfd_boolean
bfd_set_section_alignment (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, unsigned int val)
{
ptr->alignment_power = val;
return TRUE;
}
/* These sections are global, and are managed by BFD. The application
and target back end are not permitted to change the values in
these sections. */
@@ -6415,6 +6436,14 @@ struct bfd
unsigned int selective_search : 1;
};
/* See note beside bfd_set_section_userdata. */
static inline bfd_boolean
bfd_set_cacheable (bfd * abfd, bfd_boolean val)
{
abfd->cacheable = val;
return TRUE;
}
typedef enum bfd_error
{
bfd_error_no_error = 0,

View File

@@ -311,6 +311,14 @@ CODE_FRAGMENT
. unsigned int selective_search : 1;
.};
.
.{* See note beside bfd_set_section_userdata. *}
.static inline bfd_boolean
.bfd_set_cacheable (bfd * abfd, bfd_boolean val)
.{
. abfd->cacheable = val;
. return TRUE;
.}
.
*/
#include "sysdep.h"

View File

@@ -82,7 +82,7 @@ bfd_cache_max_open (void)
#ifdef HAVE_GETRLIMIT
struct rlimit rlim;
if (getrlimit (RLIMIT_NOFILE, &rlim) == 0
&& rlim.rlim_cur != RLIM_INFINITY)
&& rlim.rlim_cur != (rlim_t) RLIM_INFINITY)
max = rlim.rlim_cur / 8;
else
#endif /* HAVE_GETRLIMIT */

View File

@@ -585,7 +585,7 @@ rs6000coff_core_p (bfd *abfd)
{
ldi_core = ldinfo.l32.ldinfo_core;
ldi_datasize = ldinfo.l32.ldinfo_datasize;
ldi_dataorg = (bfd_vma) (long) ldinfo.l32.ldinfo_dataorg;
ldi_dataorg = (bfd_vma) (ptr_to_uint) ldinfo.l32.ldinfo_dataorg;
ldi_next = ldinfo.l32.ldinfo_next;
}
@@ -627,7 +627,7 @@ rs6000coff_core_p (bfd *abfd)
}
else
{
vminfo_addr = (bfd_vma) (long) vminfo.old.vminfo_addr;
vminfo_addr = (bfd_vma) (ptr_to_uint) vminfo.old.vminfo_addr;
vminfo_size = vminfo.old.vminfo_size;
vminfo_offset = vminfo.old.vminfo_offset;
}

View File

@@ -542,6 +542,32 @@ CODE_FRAGMENT
. int size;
.};
.
.{* Note: the following are provided as inline functions rather than macros
. because not all callers use the return value. A macro implementation
. would use a comma expression, eg: "((ptr)->foo = val, TRUE)" and some
. compilers will complain about comma expressions that have no effect. *}
.static inline bfd_boolean
.bfd_set_section_userdata (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, void * val)
.{
. ptr->userdata = val;
. return TRUE;
.}
.
.static inline bfd_boolean
.bfd_set_section_vma (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, bfd_vma val)
.{
. ptr->vma = ptr->lma = val;
. ptr->user_set_vma = TRUE;
. return TRUE;
.}
.
.static inline bfd_boolean
.bfd_set_section_alignment (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, unsigned int val)
.{
. ptr->alignment_power = val;
. return TRUE;
.}
.
.{* These sections are global, and are managed by BFD. The application
. and target back end are not permitted to change the values in
. these sections. *}

View File

@@ -1,4 +1,4 @@
#define BFD_VERSION_DATE 20140206
#define BFD_VERSION_DATE 20140505
#define BFD_VERSION @bfd_version@
#define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@
#define REPORT_BUGS_TO @report_bugs_to@

View File

@@ -1,3 +1,80 @@
2014-05-05 Joel Brobecker <brobecker@adacore.com>
* version.in: Set GDB version number to 7.7.1.
2014-04-19 Eli Zaretskii <eliz@gnu.org>
PR gdb/14018
* windows-nat.c (thread_rec): Don't display a warning when
SuspendThread fails with ERROR_ACCESS_DENIED. If SuspendThread
fails for any reason, set th->suspended to -1, so that we don't
try to resume such a thread. Also, don't return NULL in these
cases, to avoid completely ruin the session due to "PC register is
not available" error.
(do_windows_fetch_inferior_registers): Check errors in
GetThreadContext call.
(windows_continue): Accept an additional argument KILLED; if not
zero, ignore errors in the SetThreadContext call, since the
inferior was killed and is shutting down.
(windows_resume, get_windows_debug_event)
(windows_create_inferior, windows_mourn_inferior)
(windows_kill_inferior): All callers of windows_continue changed
to adjust to its new calling sequence.
2014-04-11 Pierre Langlois <pierre.langlois@embecosm.com>
PR backtrace/16721
PR backtrace/16832
* avr-tdep.c (struct gdbarch_tdep): Mention avrxmega in the comment.
(avr_gdbarch_init): Add xmega architectures given by bfd_architecture
when setting the size of call_length.
(avr_scan_prologue): Accept push r1 instruction for small stack
allocation.
* MAINTAINERS (Write After Approval): Add "Pierre Langlois".
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.
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.
2014-02-25 Jan Kratochvil <jan.kratochvil@redhat.com>
PR gdb/16626
* auto-load.c (auto_load_objfile_script_1): Change filename to
debugfile.
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.
2014-02-06 Joel Brobecker <brobecker@adacore.com>
* version.in: Set GDB version number to 7.7.0.DATE-cvs.
2014-02-06 Joel Brobecker <brobecker@adacore.com>
GDB 7.7 released.
2014-02-06 Joel Brobecker <brobecker@adacore.com>
* version.in: Set GDB version number to 7.7.

View File

@@ -546,6 +546,7 @@ Jim Kingdon kingdon@panix.com
Paul Koning paul_koning@dell.com
Jan Kratochvil jan.kratochvil@redhat.com
Maxim Kuvyrkov maxim@kugelworks.com
Pierre Langlois pierre.langlois@embecosm.com
Jonathan Larmour jifl@ecoscentric.com
Jeff Law law@redhat.com
Justin Lebar justin.lebar@gmail.com

View File

@@ -791,17 +791,17 @@ auto_load_objfile_script_1 (struct objfile *objfile, const char *realname,
make_cleanup_fclose (input);
is_safe
= file_is_auto_load_safe (filename,
= file_is_auto_load_safe (debugfile,
_("auto-load: Loading %s script \"%s\""
" by extension for objfile \"%s\".\n"),
language->name, filename,
language->name, debugfile,
objfile_name (objfile));
/* Add this script to the hash table too so
"info auto-load ${lang}-scripts" can print it. */
pspace_info
= get_auto_load_pspace_data_for_loading (current_program_space);
maybe_add_script (pspace_info, is_safe, filename, filename, language);
maybe_add_script (pspace_info, is_safe, debugfile, debugfile, language);
/* To preserve existing behaviour we don't check for whether the
script was already in the table, and always load it.

View File

@@ -179,7 +179,7 @@ struct avr_unwind_cache
struct gdbarch_tdep
{
/* Number of bytes stored to the stack by call instructions.
2 bytes for avr1-5, 3 bytes for avr6. */
2 bytes for avr1-5 and avrxmega1-5, 3 bytes for avr6 and avrxmega6-7. */
int call_length;
/* Type for void. */
@@ -719,7 +719,7 @@ avr_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR pc_beg, CORE_ADDR pc_end,
info->size += gdbarch_tdep (gdbarch)->call_length;
vpc += 2;
}
else if (insn == 0x920f) /* push r0 */
else if (insn == 0x920f || insn == 0x921f) /* push r0 or push r1 */
{
info->size += 1;
vpc += 2;
@@ -1355,14 +1355,21 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
switch (info.bfd_arch_info->mach)
{
case bfd_mach_avr1:
case bfd_mach_avrxmega1:
case bfd_mach_avr2:
case bfd_mach_avrxmega2:
case bfd_mach_avr3:
case bfd_mach_avrxmega3:
case bfd_mach_avr4:
case bfd_mach_avrxmega4:
case bfd_mach_avr5:
case bfd_mach_avrxmega5:
default:
call_length = 2;
break;
case bfd_mach_avr6:
case bfd_mach_avrxmega6:
case bfd_mach_avrxmega7:
call_length = 3;
break;
}

View File

@@ -413,24 +413,20 @@ dcache_peek_byte (DCACHE *dcache, CORE_ADDR addr, gdb_byte *ptr)
/* Write the byte at PTR into ADDR in the data cache.
The caller is responsible for also promptly writing the data
through to target memory.
The caller should have written the data through to target memory
already.
If addr is not in cache, this function does nothing; writing to
an area of memory which wasn't present in the cache doesn't cause
it to be loaded in.
If ADDR is not in cache, this function does nothing; writing to an
area of memory which wasn't present in the cache doesn't cause it
to be loaded in. */
Always return 1 (meaning success) to simplify dcache_xfer_memory. */
static int
dcache_poke_byte (DCACHE *dcache, CORE_ADDR addr, gdb_byte *ptr)
static void
dcache_poke_byte (DCACHE *dcache, CORE_ADDR addr, const gdb_byte *ptr)
{
struct dcache_block *db = dcache_hit (dcache, addr);
if (db)
db->data[XFORM (dcache, addr)] = *ptr;
return 1;
}
static int
@@ -467,26 +463,16 @@ dcache_init (void)
}
/* Read or write LEN bytes from inferior memory at MEMADDR, transferring
to or from debugger address MYADDR. Write to inferior if SHOULD_WRITE is
nonzero.
Return the number of bytes actually transfered, or -1 if the
transfer is not supported or otherwise fails. Return of a non-negative
value less than LEN indicates that no further transfer is possible.
NOTE: This is different than the to_xfer_partial interface, in which
positive values less than LEN mean further transfers may be possible. */
/* Read LEN bytes from dcache memory at MEMADDR, transferring to
debugger address MYADDR. If the data is presently cached, this
fills the cache. Arguments/return are like the target_xfer_partial
interface. */
int
dcache_xfer_memory (struct target_ops *ops, DCACHE *dcache,
CORE_ADDR memaddr, gdb_byte *myaddr,
int len, int should_write)
dcache_read_memory_partial (struct target_ops *ops, DCACHE *dcache,
CORE_ADDR memaddr, gdb_byte *myaddr, ULONGEST len)
{
int i;
int res;
int (*xfunc) (DCACHE *dcache, CORE_ADDR addr, gdb_byte *ptr);
xfunc = should_write ? dcache_poke_byte : dcache_peek_byte;
ULONGEST i;
/* If this is a different inferior from what we've recorded,
flush the cache. */
@@ -497,35 +483,18 @@ dcache_xfer_memory (struct target_ops *ops, DCACHE *dcache,
dcache->ptid = inferior_ptid;
}
/* Do write-through first, so that if it fails, we don't write to
the cache at all. */
if (should_write)
{
res = target_write (ops, TARGET_OBJECT_RAW_MEMORY,
NULL, myaddr, memaddr, len);
if (res <= 0)
return res;
/* Update LEN to what was actually written. */
len = res;
}
for (i = 0; i < len; i++)
{
if (!xfunc (dcache, memaddr + i, myaddr + i))
if (!dcache_peek_byte (dcache, memaddr + i, myaddr + i))
{
/* That failed. Discard its cache line so we don't have a
partially read line. */
dcache_invalidate_line (dcache, memaddr + i);
/* If we're writing, we still wrote LEN bytes. */
if (should_write)
return len;
else
return i;
break;
}
}
return len;
return i == 0 ? -1 : i;
}
/* FIXME: There would be some benefit to making the cache write-back and
@@ -537,17 +506,26 @@ dcache_xfer_memory (struct target_ops *ops, DCACHE *dcache,
"logically" connected but not actually a single call to one of the
memory transfer functions. */
/* Just update any cache lines which are already present. This is called
by memory_xfer_partial in cases where the access would otherwise not go
through the cache. */
/* Just update any cache lines which are already present. This is
called by the target_xfer_partial machinery when writing raw
memory. */
void
dcache_update (DCACHE *dcache, CORE_ADDR memaddr, gdb_byte *myaddr, int len)
dcache_update (DCACHE *dcache, int status,
CORE_ADDR memaddr, const gdb_byte *myaddr,
ULONGEST len)
{
int i;
ULONGEST i;
for (i = 0; i < len; i++)
dcache_poke_byte (dcache, memaddr + i, myaddr + i);
if (status > 0)
dcache_poke_byte (dcache, memaddr + i, myaddr + i);
else
{
/* Discard the whole cache line so we don't have a partially
valid line. */
dcache_invalidate_line (dcache, memaddr + i);
}
}
/* Print DCACHE line INDEX. */

View File

@@ -32,12 +32,12 @@ DCACHE *dcache_init (void);
/* Free a DCACHE. */
void dcache_free (DCACHE *);
/* Simple to call from <remote>_xfer_memory. */
int dcache_read_memory_partial (struct target_ops *ops, DCACHE *dcache,
CORE_ADDR memaddr, gdb_byte *myaddr,
ULONGEST len);
int dcache_xfer_memory (struct target_ops *ops, DCACHE *cache, CORE_ADDR mem,
gdb_byte *my, int len, int should_write);
void dcache_update (DCACHE *dcache, CORE_ADDR memaddr, gdb_byte *myaddr,
int len);
void dcache_update (DCACHE *dcache, int status,
CORE_ADDR memaddr, const gdb_byte *myaddr,
ULONGEST len);
#endif /* DCACHE_H */

View File

@@ -4379,7 +4379,11 @@ handle_signal_stop (struct execution_control_state *ecs)
ecs->event_thread->step_after_step_resume_breakpoint = 1;
/* Reset trap_expected to ensure breakpoints are re-inserted. */
ecs->event_thread->control.trap_expected = 0;
keep_going (ecs);
/* If we were nexting/stepping some other thread, switch to
it, so that we don't continue it, losing control. */
if (!switch_back_to_stepped_thread (ecs))
keep_going (ecs);
return;
}

View File

@@ -168,7 +168,7 @@ static PyObject *
ltpy_get_pcs_for_line (PyObject *self, PyObject *args)
{
struct symtab *symtab;
int py_line;
gdb_py_longest py_line;
struct linetable_entry *best_entry = NULL;
linetable_entry_object *result;
VEC (CORE_ADDR) *pcs = NULL;
@@ -200,7 +200,7 @@ static PyObject *
ltpy_has_line (PyObject *self, PyObject *args)
{
struct symtab *symtab;
int py_line;
gdb_py_longest py_line;
int index;
LTPY_REQUIRE_VALID (self, symtab);

View File

@@ -1418,6 +1418,23 @@ raw_memory_xfer_partial (struct target_ops *ops, void *readbuf,
}
while (ops != NULL);
/* The cache works at the raw memory level. Make sure the cache
gets updated with raw contents no matter what kind of memory
object was originally being written. Note we do write-through
first, so that if it fails, we don't write to the cache contents
that never made it to the target. */
if (writebuf != NULL
&& !ptid_equal (inferior_ptid, null_ptid)
&& target_dcache_init_p ()
&& (stack_cache_enabled_p () || code_cache_enabled_p ()))
{
DCACHE *dcache = target_dcache_get ();
/* Note that writing to an area of memory which wasn't present
in the cache doesn't cause it to be loaded in. */
dcache_update (dcache, res, memaddr, writebuf, len);
}
return res;
}
@@ -1565,6 +1582,7 @@ memory_xfer_partial_1 (struct target_ops *ops, enum target_object object,
inf = NULL;
if (inf != NULL
&& readbuf != NULL
/* The dcache reads whole cache lines; that doesn't play well
with reading from a trace buffer, because reading outside of
the collected memory range fails. */
@@ -1575,18 +1593,8 @@ memory_xfer_partial_1 (struct target_ops *ops, enum target_object object,
{
DCACHE *dcache = target_dcache_get_or_init ();
if (readbuf != NULL)
res = dcache_xfer_memory (ops, dcache, memaddr, readbuf, reg_len, 0);
else
/* FIXME drow/2006-08-09: If we're going to preserve const
correctness dcache_xfer_memory should take readbuf and
writebuf. */
res = dcache_xfer_memory (ops, dcache, memaddr, (void *) writebuf,
reg_len, 1);
if (res <= 0)
return -1;
else
return res;
return dcache_read_memory_partial (ops, dcache, memaddr, readbuf,
reg_len);
}
/* If none of those methods found the memory we wanted, fall back
@@ -1597,23 +1605,6 @@ memory_xfer_partial_1 (struct target_ops *ops, enum target_object object,
object which can be read from more than one valid target. */
res = raw_memory_xfer_partial (ops, readbuf, writebuf, memaddr, reg_len);
/* Make sure the cache gets updated no matter what - if we are writing
to the stack. Even if this write is not tagged as such, we still need
to update the cache. */
if (res > 0
&& inf != NULL
&& writebuf != NULL
&& target_dcache_init_p ()
&& !region->attrib.cache
&& ((stack_cache_enabled_p () && object != TARGET_OBJECT_STACK_MEMORY)
|| (code_cache_enabled_p () && object != TARGET_OBJECT_CODE_MEMORY)))
{
DCACHE *dcache = target_dcache_get ();
dcache_update (dcache, memaddr, (void *) writebuf, res);
}
/* If we still haven't got anything, return the last error. We
give up. */
return res;

View File

@@ -1,3 +1,30 @@
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.
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-thread.exp: New
file.
2014-02-25 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.
PR gdb/16626
* gdb.base/auto-load.exp: Fix out-of-srctree run.
2014-02-05 Yao Qi <yao@codesourcery.com>
* gdb.trace/report.exp (use_collected_data): Test the output

View File

@@ -0,0 +1,17 @@
# Copyright 2014 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
echo script_loaded\n
set $script_loaded=42

View File

@@ -0,0 +1,22 @@
/* This testcase is part of GDB, the GNU debugger.
Copyright 2014 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
int
main (void)
{
return 0;
}

View File

@@ -0,0 +1,41 @@
# Copyright 2014 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
standard_testfile
if [is_remote host] {
return 0
}
set targetdir "${binfile}.dir"
set sourcescript "${srcdir}/${subdir}/${testfile}-script"
set targetscriptdir "${targetdir}/[file dirname ${binfile}]"
set targetscript "${targetscriptdir}/${testfile}-gdb.gdb"
remote_exec host "rm -rf ${targetdir}"
if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } {
return -1
}
remote_exec host "mkdir -p ${targetscriptdir}"
remote_exec host "cp ${sourcescript} ${targetscript}"
gdb_test_no_output "set auto-load scripts-directory ${targetdir}" "set auto-load scripts-directory"
gdb_test_no_output "set auto-load safe-path ${targetscript}" "set auto-load safe-path"
gdb_load ${binfile}
gdb_test {print $script_loaded} " = 42"

View File

@@ -44,14 +44,36 @@ gdb_test_multiple "disass main" $test {
gdb_test "b [gdb_get_line_number "break-first"]" "Breakpoint \[0-9\] at .*" "First breakpoint placed"
gdb_test "b [gdb_get_line_number "break-second"]" "Breakpoint \[0-9\] at .*" "Second breakpoint placed"
set test "disassembly with breakpoints"
gdb_test_multiple "disass main" $test {
-re $match {
set got $expect_out(1,string)
if [string equal -nocase $orig $got] {
pass $test
} else {
fail $test
# Disassemble main, and compare the output to the original output
# before breakpoints were inserted. TEST is used as test message.
proc test_disassembly {test} {
global match orig
gdb_test_multiple "disass main" $test {
-re $match {
set got $expect_out(1,string)
if [string equal -nocase $orig $got] {
pass $test
} else {
fail $test
}
}
}
}
test_disassembly "disassembly with breakpoints"
# Now check the interaction between the code cache and breakpoint
# always-inserted mode.
# Recreate the code cache when breakpoints are already inserted.
gdb_test_no_output "set code-cache off"
gdb_test_no_output "set code-cache on"
test_disassembly "disassembly with breakpoints, fresh code cache"
# Delete breakpoints. This should update the code cache as well.
delete_breakpoints
test_disassembly "disassembly without breakpoints, no stale breakpoints"

View File

@@ -0,0 +1,145 @@
/* This testcase is part of GDB, the GNU debugger.
Copyright 2009-2014 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <pthread.h>
#include <unistd.h>
#include <stdlib.h>
#include <signal.h>
unsigned int args[2];
pid_t pid;
pthread_barrier_t barrier;
pthread_t child_thread_2, child_thread_3;
void
handler (int signo)
{
/* so that thread 3 is sure to run, in case the bug is present. */
usleep (10);
}
void
callme (void)
{
}
void
block_signals (void)
{
sigset_t mask;
sigfillset (&mask);
sigprocmask (SIG_BLOCK, &mask, NULL);
}
void
unblock_signals (void)
{
sigset_t mask;
sigfillset (&mask);
sigprocmask (SIG_UNBLOCK, &mask, NULL);
}
void *
child_function_3 (void *arg)
{
int my_number = (long) arg;
volatile int *myp = (int *) &args[my_number];
pthread_barrier_wait (&barrier);
while (*myp > 0)
{
(*myp) ++; /* set breakpoint child_two here */
callme ();
}
pthread_exit (NULL);
}
void *
child_function_2 (void *arg)
{
int my_number = (long) arg;
volatile int *myp = (int *) &args[my_number];
unblock_signals ();
pthread_barrier_wait (&barrier);
while (*myp > 0)
{
(*myp) ++;
callme (); /* set breakpoint child_one here */
}
*myp = 1;
while (*myp > 0)
{
(*myp) ++;
callme ();
}
pthread_exit (NULL);
}
int
main ()
{
int res;
long i;
/* Block signals in all threads but one, so that we're sure which
thread gets the signal we send from the command line. */
block_signals ();
signal (SIGUSR1, handler);
/* Call these early so that PLTs for these are resolved soon,
instead of in the threads. RTLD_NOW should work as well. */
usleep (0);
pthread_barrier_init (&barrier, NULL, 1);
pthread_barrier_wait (&barrier);
pthread_barrier_init (&barrier, NULL, 2);
/* The test uses this global to know where to send the signal
to. */
pid = getpid ();
i = 0;
args[i] = 1;
res = pthread_create (&child_thread_2,
NULL, child_function_2, (void *) i);
pthread_barrier_wait (&barrier);
callme (); /* set wait-thread-2 breakpoint here */
i = 1;
args[i] = 1;
res = pthread_create (&child_thread_3,
NULL, child_function_3, (void *) i);
pthread_barrier_wait (&barrier);
callme (); /* set wait-thread-3 breakpoint here */
pthread_join (child_thread_2, NULL);
pthread_join (child_thread_3, NULL);
exit(EXIT_SUCCESS);
}

View File

@@ -0,0 +1,120 @@
# Copyright (C) 2011-2014 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Test that GDB doesn't inadvertently resume the stepped thread when a
# signal arrives while stepping over the breakpoint that last caused a
# stop, when the thread that hit that breakpoint is not the stepped
# thread.
standard_testfile
set executable ${testfile}
if [target_info exists gdb,nosignals] {
verbose "Skipping ${testfile}.exp because of nosignals."
return -1
}
# Test uses host "kill".
if { [is_remote target] } {
return -1
}
if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
executable [list debug "incdir=${objdir}"]] != "" } {
return -1
}
proc get_value {var test} {
global expect_out
global gdb_prompt
global decimal
set value -1
gdb_test_multiple "print $var" "$test" {
-re ".*= ($decimal).*\r\n$gdb_prompt $" {
set value $expect_out(1,string)
pass "$test"
}
}
return ${value}
}
# Start with a fresh gdb.
clean_restart $executable
if ![runto_main] {
return -1
}
gdb_breakpoint [gdb_get_line_number "set wait-thread-2 breakpoint here"]
gdb_continue_to_breakpoint "run to wait-thread-2 breakpoint"
gdb_test "info threads" "" "info threads with thread 2"
gdb_breakpoint [gdb_get_line_number "set wait-thread-3 breakpoint here"]
gdb_continue_to_breakpoint "run to breakpoint"
gdb_test "info threads" "" "info threads with thread 3"
set testpid [get_value "pid" "get pid of inferior"]
gdb_test "set scheduler-locking on"
gdb_breakpoint [gdb_get_line_number "set breakpoint child_two here"]
gdb_breakpoint [gdb_get_line_number "set breakpoint child_one here"]
gdb_test "thread 3" "" "switch to thread 3 to run to its breakpoint"
gdb_continue_to_breakpoint "run to breakpoint in thread 3"
gdb_test "thread 2" "" "switch to thread 2 to run to its breakpoint"
gdb_continue_to_breakpoint "run to breakpoint in thread 2"
delete_breakpoints
gdb_test "b *\$pc" "" "set breakpoint to be stepped over"
# Make sure the first loop breaks without hitting the breakpoint
# again.
gdb_test "p *myp = 0" " = 0" "force loop break in thread 2"
# We want "print" to make sure the target reports the signal to the
# core.
gdb_test "handle SIGUSR1 print nostop pass" "" ""
# Queue a signal in thread 2.
remote_exec host "kill -SIGUSR1 ${testpid}"
gdb_test "thread 3" "" "switch to thread 3 for stepping"
set my_number [get_value "my_number" "get my_number"]
set cnt_before [get_value "args\[$my_number\]" "get count before step"]
gdb_test "set scheduler-locking off"
# Make sure we're exercising the paths we want to.
gdb_test "set debug infrun 1"
gdb_test \
"step" \
".*prepare_to_proceed \\(step=1\\), switched to.*signal arrived while stepping over breakpoint.*switching back to stepped thread.*stepped to a different line.*callme.*" \
"step"
set cnt_after [get_value "args\[$my_number\]" "get count after step"]
# Test that GDB doesn't inadvertently resume the stepped thread when a
# signal arrives while stepping over a breakpoint in another thread.
set test "stepped thread under control"
if { $cnt_before + 1 == $cnt_after } {
pass $test
} else {
fail $test
}

View File

@@ -1 +1 @@
7.7
7.7.1

View File

@@ -310,12 +310,18 @@ thread_rec (DWORD id, int get_context)
{
DWORD err = GetLastError ();
warning (_("SuspendThread (tid=0x%x) failed."
" (winerr %u)"),
(unsigned) id, (unsigned) err);
return NULL;
/* We get Access Denied (5) when trying to suspend
threads that Windows started on behalf of the
debuggee, usually when those threads are just
about to exit. */
if (err != ERROR_ACCESS_DENIED)
warning (_("SuspendThread (tid=0x%x) failed."
" (winerr %u)"),
(unsigned) id, (unsigned) err);
th->suspended = -1;
}
th->suspended = 1;
else
th->suspended = 1;
}
else if (get_context < 0)
th->suspended = -1;
@@ -445,7 +451,7 @@ do_windows_fetch_inferior_registers (struct regcache *regcache, int r)
{
thread_info *th = current_thread;
th->context.ContextFlags = CONTEXT_DEBUGGER_DR;
GetThreadContext (th->h, &th->context);
CHECK (GetThreadContext (th->h, &th->context));
/* Copy dr values from that thread.
But only if there were not modified since last stop.
PR gdb/2388 */
@@ -1266,10 +1272,12 @@ handle_exception (struct target_waitstatus *ourstatus)
return 1;
}
/* Resume all artificially suspended threads if we are continuing
execution. */
/* Resume thread specified by ID, or all artificially suspended
threads, if we are continuing execution. KILLED non-zero means we
have killed the inferior, so we should ignore weird errors due to
threads shutting down. */
static BOOL
windows_continue (DWORD continue_status, int id)
windows_continue (DWORD continue_status, int id, int killed)
{
int i;
thread_info *th;
@@ -1297,7 +1305,16 @@ windows_continue (DWORD continue_status, int id)
}
if (th->context.ContextFlags)
{
CHECK (SetThreadContext (th->h, &th->context));
DWORD ec = 0;
if (GetExitCodeThread (th->h, &ec)
&& ec == STILL_ACTIVE)
{
BOOL status = SetThreadContext (th->h, &th->context);
if (!killed)
CHECK (status);
}
th->context.ContextFlags = 0;
}
if (th->suspended > 0)
@@ -1425,9 +1442,9 @@ windows_resume (struct target_ops *ops,
Otherwise complain. */
if (resume_all)
windows_continue (continue_status, -1);
windows_continue (continue_status, -1, 0);
else
windows_continue (continue_status, ptid_get_tid (ptid));
windows_continue (continue_status, ptid_get_tid (ptid), 0);
}
/* Ctrl-C handler used when the inferior is not run in the same console. The
@@ -1645,7 +1662,7 @@ get_windows_debug_event (struct target_ops *ops,
if (continue_status == -1)
windows_resume (ops, minus_one_ptid, 0, 1);
else
CHECK (windows_continue (continue_status, -1));
CHECK (windows_continue (continue_status, -1, 0));
}
else
{
@@ -2382,13 +2399,13 @@ windows_create_inferior (struct target_ops *ops, char *exec_file,
do_initial_windows_stuff (ops, pi.dwProcessId, 0);
/* windows_continue (DBG_CONTINUE, -1); */
/* windows_continue (DBG_CONTINUE, -1, 0); */
}
static void
windows_mourn_inferior (struct target_ops *ops)
{
(void) windows_continue (DBG_CONTINUE, -1);
(void) windows_continue (DBG_CONTINUE, -1, 0);
i386_cleanup_dregs();
if (open_process_used)
{
@@ -2456,7 +2473,7 @@ windows_kill_inferior (struct target_ops *ops)
for (;;)
{
if (!windows_continue (DBG_CONTINUE, -1))
if (!windows_continue (DBG_CONTINUE, -1, 1))
break;
if (!WaitForDebugEvent (&current_event, INFINITE))
break;