Tom Tromey [Fri, 22 Nov 2013 19:08:15 +0000 (12:08 -0700)]
update comment in dw2-bad-cfi.S.
Pedro asked me to add a comment to dw2-bad-cfi.S explaining the nature
of the badness.
I'm checking this in.
2013-11-22 Tom Tromey <tromey@redhat.com>
* gdb.dwarf2/dw2-bad-cfi.S: Update comment.
Tom Tromey [Wed, 13 Nov 2013 18:10:55 +0000 (11:10 -0700)]
handle an unspecified return address column
Debugging PR 16155 further, I found that the DWARF unwinder found the
function in question, but thought it had no registers saved
(fs->regs.num_regs == 0).
It seems to me that if a frame does not specify the return address
column, or if the return address column is explicitly marked as
DWARF2_FRAME_REG_UNSPECIFIED, then we should set the
"undefined_retaddr" flag and let the DWARF unwinder gracefully stop.
This patch implements that idea.
With this patch the backtrace works properly:
(gdb) bt
#0 0x0000007fb7ed485c in nanosleep () from /lib64/libc.so.6
#1 0x0000007fb7ed4508 in sleep () from /lib64/libc.so.6
#2 0x00000000004008bc in thread_function (arg=0x4) at threadapply.c:73
#3 0x0000007fb7fad950 in start_thread () from /lib64/libpthread.so.0
#4 0x0000007fb7f0956c in clone () from /lib64/libc.so.6
2013-11-22 Tom Tromey <tromey@redhat.com>
PR backtrace/16155:
* dwarf2-frame.c (dwarf2_frame_cache): Set undefined_retaddr if
the return address column is unspecified.
2013-11-22 Tom Tromey <tromey@redhat.com>
* gdb.dwarf2/dw2-bad-cfi.c: New file.
* gdb.dwarf2/dw2-bad-cfi.exp: New file.
* gdb.dwarf2/dw2-bad-cfi.S: New file.
Tom Tromey [Fri, 22 Nov 2013 17:38:44 +0000 (17:38 +0000)]
Detect infinite loop in value_fetch_lazy's lval_register handling.
If value_fetch_lazy loops infinitely while unwrapping lval_register
values, it means we either somehow ended up with two frames with the
same ID in the frame chain, or some code is trying to unwind behind
get_prev_frame's back (e.g., a frame unwind sniffer trying to unwind).
In any case, it should always be an internal error to end up in this
situation.
This patch adds a check and throws an internal error if the same frame
is returned.
2013-11-22 Tom Tromey <tromey@redhat.com>
Pedro Alves <palves@redhat.com>
PR backtrace/16155
* value.c (value_fetch_lazy): Internal error if
get_frame_register_value returns the same register.
Cory Fields [Fri, 22 Nov 2013 14:54:33 +0000 (14:54 +0000)]
* windres.c (define_resource): Use zero for timestamp, making
output deterministic. time.h include is no longer needed.
* resres.c (res_append_resource): Likewise.
* pe-dll.c (fill_edata): Only use a real timestamp if
--insert-timestamp was used.
* emultempl/pe.em: Add the --insert-timestamp option.
* emultempl/pep.em: Likewise for 64bit.
* ld.texinfo: Document the --insert-timestamp option.
* libcoff-in.h: Add insert_timestamp flag to the pe_data struct.
* libcoff.h: Regenerate.
* peXXigen.c (_bfd_XXi_only_swap_filehdr_out): Only use a real
timestamp if --insert-timestamp was used.
Pedro Alves [Thu, 21 Nov 2013 15:20:09 +0000 (15:20 +0000)]
Make use of the frame stash to detect wider stack cycles.
Given we already have the frame id stash, which holds the ids of all
frames in the chain, detecting corrupted stacks with wide stack cycles
with non-consecutive dup frame ids is just as cheap as just detecting
cycles in consecutive frames:
#0 frame_id1
#1 frame_id2
#2 frame_id3
#3 frame_id1
#4 frame_id2
#5 frame_id3
#6 frame_id1
... forever ...
We just need to check whether the stash already knows about a given
frame id instead of comparing the ids of the previous/this frames.
Tested on x86_64 Fedora 17.
gdb/
2013-11-22 Pedro Alves <palves@redhat.com>
Tom Tromey <tromey@redhat.com>
* frame.c (frame_stash_add): Now returns whether a frame with the
same ID was already known.
(compute_frame_id): New function, factored out from get_frame_id.
(get_frame_id): No longer lazilly compute the frame id here.
(get_prev_frame_if_no_cycle): New function. Detects wider stack
cycles.
(get_prev_frame_1): Use it instead of get_prev_frame_raw directly,
and checking for stack cycles here.
Pedro Alves [Fri, 22 Nov 2013 11:51:59 +0000 (11:51 +0000)]
Don't let two frames with the same id end up in the frame chain.
The UNWIND_SAME_ID check is done between THIS_FRAME and the next frame
when we go try to unwind the previous frame. But at this point, it's
already too late -- we ended up with two frames with the same ID in
the frame chain. Each frame having its own ID is an invariant assumed
throughout GDB. This patch applies the UNWIND_SAME_ID detection
earlier, right after the previous frame is unwound, discarding the dup
frame if a cycle is detected.
The patch includes a new test that fails before the change. Before
the patch, the test causes an infinite loop in GDB, after the patch,
the UNWIND_SAME_ID logic kicks in and makes the backtrace stop with:
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
The test uses dwarf CFI to emulate a corrupted stack with a cycle. It
has a function with registers marked DW_CFA_same_value (most
importantly RSP/RIP), so that GDB computes the same ID for that frame
and its caller. IOW, something like this:
#0 - frame_id_1
#1 - frame_id_2
#2 - frame_id_3
#3 - frame_id_4
#4 - frame_id_4 <<<< outermost (UNWIND_SAME_ID).
(The test's code is just a copy of dw2-reg-undefined.S /
dw2-reg-undefined.c, adjusted to use DW_CFA_same_value instead of
DW_CFA_undefined, and to mark a different set of registers.)
The infinite loop is here, in value_fetch_lazy:
while (VALUE_LVAL (new_val) == lval_register && value_lazy (new_val))
{
frame = frame_find_by_id (VALUE_FRAME_ID (new_val));
...
new_val = get_frame_register_value (frame, regnum);
}
get_frame_register_value can return a lazy register value pointing to
the next frame. This means that the register wasn't clobbered by
FRAME; the debugger should therefore retrieve its value from the next
frame.
To be clear, get_frame_register_value unwinds the value in question
from the next frame:
struct value *
get_frame_register_value (struct frame_info *frame, int regnum)
{
return frame_unwind_register_value (frame->next, regnum);
^^^^^^^^^^^
}
In other words, if we get a lazy lval_register, it should have the
frame ID of the _next_ frame, never of FRAME.
At this point in value_fetch_lazy, the whole relevant chunk of the
stack up to frame #4 has already been unwound. The loop always
"unlazies" lval_registers in the "next/innermost" direction, not in
the "prev/unwind further/outermost" direction.
So say we're looking at frame #4. get_frame_register_value in frame
#4 can return a lazy register value of frame #3. So the next
iteration, frame_find_by_id tries to read the register from frame #3.
But, since frame #4 happens to have same id as frame #3,
frame_find_by_id returns frame #4 instead. Rinse, repeat, and we have
an infinite loop.
This is an old latent problem, exposed by the recent addition of the
frame stash. Before we had a stash, frame_find_by_id(frame_id_4)
would walk over all frames starting at the current frame, and would
always find #3 first. The stash happens to return #4 instead:
struct frame_info *
frame_find_by_id (struct frame_id id)
{
struct frame_info *frame, *prev_frame;
...
/* Try using the frame stash first. Finding it there removes the need
to perform the search by looping over all frames, which can be very
CPU-intensive if the number of frames is very high (the loop is O(n)
and get_prev_frame performs a series of checks that are relatively
expensive). This optimization is particularly useful when this function
is called from another function (such as value_fetch_lazy, case
VALUE_LVAL (val) == lval_register) which already loops over all frames,
making the overall behavior O(n^2). */
frame = frame_stash_find (id);
if (frame)
return frame;
for (frame = get_current_frame (); ; frame = prev_frame)
{
gdb/
2013-11-22 Pedro Alves <palves@redhat.com>
PR 16155
* frame.c (get_prev_frame_1): Do the UNWIND_SAME_ID check between
this frame and the new previous frame, not between this frame and
the next frame.
gdb/testsuite/
2013-11-22 Pedro Alves <palves@redhat.com>
PR 16155
* gdb.dwarf2/dw2-dup-frame.S: New file.
* gdb.dwarf2/dw2-dup-frame.c: New file.
* gdb.dwarf2/dw2-dup-frame.exp: New file.
Pedro Alves [Fri, 22 Nov 2013 13:17:46 +0000 (13:17 +0000)]
Eliminate dwarf2_frame_cache recursion, don't unwind from the dwarf2 sniffer (move dwarf2_tailcall_sniffer_first elsewhere).
Two rationales, same patch.
TL;DR 1:
dwarf2_frame_cache recursion is evil. dwarf2_frame_cache calls
dwarf2_tailcall_sniffer_first which then recurses into
dwarf2_frame_cache.
TL;DR 2:
An unwinder trying to unwind is evil. dwarf2_frame_sniffer calls
dwarf2_frame_cache which calls dwarf2_tailcall_sniffer_first which
then tries to unwind the PC of the previous frame.
Avoid all that by deferring dwarf2_tailcall_sniffer_first until it's
really necessary.
Rationale 1
===========
A frame sniffer should not try to unwind, because that bypasses all
the validation checks done by get_prev_frame. The UNWIND_SAME_ID
scenario is one such case where GDB is currently broken because (in
part) of this (the next patch adds a test that would fail without
this).
GDB goes into an infinite loop in value_fetch_lazy, here:
while (VALUE_LVAL (new_val) == lval_register && value_lazy (new_val))
{
frame = frame_find_by_id (VALUE_FRAME_ID (new_val));
...
new_val = get_frame_register_value (frame, regnum);
}
(top-gdb) bt
#0 value_fetch_lazy (val=0x11516d0) at ../../src/gdb/value.c:3510
#1 0x0000000000584bd8 in value_optimized_out (value=0x11516d0) at ../../src/gdb/value.c:1096
#2 0x00000000006fe7a1 in frame_register_unwind (frame=0x1492600, regnum=16, optimizedp=0x7fffffffcdec, unavailablep=0x7fffffffcde8, lvalp=0x7fffffffcdd8, addrp=
0x7fffffffcde0, realnump=0x7fffffffcddc, bufferp=0x7fffffffce10 "@\316\377\377\377\177") at ../../src/gdb/frame.c:940
#3 0x00000000006fea3a in frame_unwind_register (frame=0x1492600, regnum=16, buf=0x7fffffffce10 "@\316\377\377\377\177") at ../../src/gdb/frame.c:990
#4 0x0000000000473b9b in i386_unwind_pc (gdbarch=0xf54660, next_frame=0x1492600) at ../../src/gdb/i386-tdep.c:1771
#5 0x0000000000601dfa in gdbarch_unwind_pc (gdbarch=0xf54660, next_frame=0x1492600) at ../../src/gdb/gdbarch.c:2870
#6 0x0000000000693db5 in dwarf2_tailcall_sniffer_first (this_frame=0x1492600, tailcall_cachep=0x14926f0, entry_cfa_sp_offsetp=0x7fffffffcf00)
at ../../src/gdb/dwarf2-frame-tailcall.c:389
#7 0x0000000000690928 in dwarf2_frame_cache (this_frame=0x1492600, this_cache=0x1492618) at ../../src/gdb/dwarf2-frame.c:1245
#8 0x0000000000690f46 in dwarf2_frame_sniffer (self=0x8e4980, this_frame=0x1492600, this_cache=0x1492618) at ../../src/gdb/dwarf2-frame.c:1423
#9 0x000000000070203b in frame_unwind_find_by_frame (this_frame=0x1492600, this_cache=0x1492618) at ../../src/gdb/frame-unwind.c:112
#10 0x00000000006fd681 in get_frame_id (fi=0x1492600) at ../../src/gdb/frame.c:408
#11 0x00000000007006c2 in get_prev_frame_1 (this_frame=0xdc1860) at ../../src/gdb/frame.c:1826
#12 0x0000000000700b7a in get_prev_frame (this_frame=0xdc1860) at ../../src/gdb/frame.c:2056
#13 0x0000000000514588 in frame_info_to_frame_object (frame=0xdc1860) at ../../src/gdb/python/py-frame.c:322
#14 0x000000000051784c in bootstrap_python_frame_filters (frame=0xdc1860, frame_low=0, frame_high=-1) at ../../src/gdb/python/py-framefilter.c:1396
#15 0x0000000000517a6f in apply_frame_filter (frame=0xdc1860, flags=7, args_type=CLI_SCALAR_VALUES, out=0xed7a90, frame_low=0, frame_high=-1)
at ../../src/gdb/python/py-framefilter.c:1492
#16 0x00000000005e77b0 in backtrace_command_1 (count_exp=0x0, show_locals=0, no_filters=0, from_tty=1) at ../../src/gdb/stack.c:1777
#17 0x00000000005e7c0f in backtrace_command (arg=0x0, from_tty=1) at ../../src/gdb/stack.c:1891
#18 0x00000000004e37a7 in do_cfunc (c=0xda4fa0, args=0x0, from_tty=1) at ../../src/gdb/cli/cli-decode.c:107
#19 0x00000000004e683c in cmd_func (cmd=0xda4fa0, args=0x0, from_tty=1) at ../../src/gdb/cli/cli-decode.c:1882
#20 0x00000000006f35ed in execute_command (p=0xcc66c2 "", from_tty=1) at ../../src/gdb/top.c:468
#21 0x00000000005f8853 in command_handler (command=0xcc66c0 "bt") at ../../src/gdb/event-top.c:435
#22 0x00000000005f8e12 in command_line_handler (rl=0xfe05f0 "@") at ../../src/gdb/event-top.c:632
#23 0x000000000074d2c6 in rl_callback_read_char () at ../../src/readline/callback.c:220
#24 0x00000000005f8375 in rl_callback_read_char_wrapper (client_data=0x0) at ../../src/gdb/event-top.c:164
#25 0x00000000005f876a in stdin_event_handler (error=0, client_data=0x0) at ../../src/gdb/event-top.c:375
#26 0x00000000005f72fa in handle_file_event (data=...) at ../../src/gdb/event-loop.c:768
#27 0x00000000005f67a3 in process_event () at ../../src/gdb/event-loop.c:342
#28 0x00000000005f686a in gdb_do_one_event () at ../../src/gdb/event-loop.c:406
#29 0x00000000005f68bb in start_event_loop () at ../../src/gdb/event-loop.c:431
#30 0x00000000005f83a7 in cli_command_loop (data=0x0) at ../../src/gdb/event-top.c:179
#31 0x00000000005eeed3 in current_interp_command_loop () at ../../src/gdb/interps.c:327
#32 0x00000000005ef8ff in captured_command_loop (data=0x0) at ../../src/gdb/main.c:267
#33 0x00000000005ed2f6 in catch_errors (func=0x5ef8e4 <captured_command_loop>, func_args=0x0, errstring=0x8b6554 "", mask=RETURN_MASK_ALL)
at ../../src/gdb/exceptions.c:524
#34 0x00000000005f0d21 in captured_main (data=0x7fffffffd9e0) at ../../src/gdb/main.c:1067
#35 0x00000000005ed2f6 in catch_errors (func=0x5efb9b <captured_main>, func_args=0x7fffffffd9e0, errstring=0x8b6554 "", mask=RETURN_MASK_ALL)
at ../../src/gdb/exceptions.c:524
#36 0x00000000005f0d57 in gdb_main (args=0x7fffffffd9e0) at ../../src/gdb/main.c:1076
#37 0x000000000045bb6a in main (argc=4, argv=0x7fffffffdae8) at ../../src/gdb/gdb.c:34
(top-gdb)
GDB is trying to unwind the PC register of the previous frame (frame
#5 above), starting from the frame being sniffed (the THIS frame).
But the THIS frame's unwinder says the PC of the previous frame is
actually the same as the previous's frame's next frame (which is the
same frame we started with, the THIS frame), therefore it returns an
lval_register lazy value with frame set to THIS frame. And so the
value_fetch_lazy loop never ends.
Rationale 2
===========
As an experiment, I tried making dwarf2-frame.c:read_addr_from_reg use
address_from_register. That caused a bunch of regressions, but it
actually took me a long while to figure out what was going on. Turns
out dwarf2-frame.c:read_addr_from_reg is called while computing the
frame's CFA, from within dwarf2_frame_cache. address_from_register
wants to create a register with frame_id set to the frame being
constructed. To create the frame id, we again call dwarf2_frame_cache,
which given:
static struct dwarf2_frame_cache *
dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache)
{
...
if (*this_cache)
return *this_cache;
returns an incomplete object to the caller:
static void
dwarf2_frame_this_id (struct frame_info *this_frame, void **this_cache,
struct frame_id *this_id)
{
struct dwarf2_frame_cache *cache =
dwarf2_frame_cache (this_frame, this_cache);
...
(*this_id) = frame_id_build (cache->cfa, get_frame_func (this_frame));
}
As cache->cfa is still 0 (we were trying to compute it!), and
get_frame_id recalls this id from here on, we end up with a broken
frame id in recorded for this frame. Later, when inspecting locals,
the dwarf machinery needs to know the selected frame's base, which
calls get_frame_base:
CORE_ADDR
get_frame_base (struct frame_info *fi)
{
return get_frame_id (fi).stack_addr;
}
which as seen above then returns 0 ...
So I gave up using address_from_register.
But, the pain of investigating this made me want to have GDB itself
assert that recursion never happens here. So I wrote a patch to do
that. But, it triggers on current mainline, because
dwarf2_tailcall_sniffer_first, called from dwarf2_frame_cache, unwinds
the this_frame.
A sniffer shouldn't be trying to unwind, exactly because of this sort
of tricky issue. The patch defers calling
dwarf2_tailcall_sniffer_first until it's really necessary, in
dwarf2_frame_prev_register (thus actually outside the sniffer path).
As this makes the call to dwarf2_frame_sniffer in dwarf2_frame_cache
unnecessary again, the patch removes that too.
Tested on x86_64 Fedora 17.
gdb/
2013-11-22 Pedro Alves <palves@redhat.com>
PR 16155
* dwarf2-frame.c (struct dwarf2_frame_cache)
<checked_tailcall_bottom, entry_cfa_sp_offset,
entry_cfa_sp_offset_p>: New fields.
(dwarf2_frame_cache): Adjust to use the new cache fields instead
of locals. Don't call dwarf2_tailcall_sniffer_first here.
(dwarf2_frame_prev_register): Call it here, but only once.
Pedro Alves [Fri, 22 Nov 2013 13:46:51 +0000 (13:46 +0000)]
Revert "Don't let two frames with the same id end up in the frame chain."
This reverts commit
be2c48b4d50b992ba83bc51f086e316621a03a14.
Pedro Alves [Fri, 22 Nov 2013 13:46:43 +0000 (13:46 +0000)]
Revert "Make use of the frame stash to detect wider stack cycles."
This reverts commit
f5b0ed3c8ce42b0dd6b6caa0b3d7b7e734311afe.
Pedro Alves [Fri, 22 Nov 2013 13:46:35 +0000 (13:46 +0000)]
Revert "Eliminate dwarf2_frame_cache recursion, don't unwind from the dwarf2 sniffer (move dwarf2_tailcall_sniffer_first elsewhere)."
This reverts commit
1dc8686c48e72fc02723d44ee0fecde0d233c74e.
Pedro Alves [Fri, 22 Nov 2013 13:17:46 +0000 (13:17 +0000)]
Eliminate dwarf2_frame_cache recursion, don't unwind from the dwarf2 sniffer (move dwarf2_tailcall_sniffer_first elsewhere).
Two rationales, same patch.
TL;DR 1:
dwarf2_frame_cache recursion is evil. dwarf2_frame_cache calls
dwarf2_tailcall_sniffer_first which then recurses into
dwarf2_frame_cache.
TL;DR 2:
An unwinder trying to unwind is evil. dwarf2_frame_sniffer calls
dwarf2_frame_cache which calls dwarf2_tailcall_sniffer_first which
then tries to unwind the PC of the previous frame.
Avoid all that by deferring dwarf2_tailcall_sniffer_first until it's
really necessary.
Rationale 1
===========
A frame sniffer should not try to unwind, because that bypasses all
the validation checks done by get_prev_frame. The UNWIND_SAME_ID
scenario is one such case where GDB is currently broken because (in
part) of this (the next patch adds a test that would fail without
this).
GDB goes into an infinite loop in value_fetch_lazy, here:
while (VALUE_LVAL (new_val) == lval_register && value_lazy (new_val))
{
frame = frame_find_by_id (VALUE_FRAME_ID (new_val));
...
new_val = get_frame_register_value (frame, regnum);
}
(top-gdb) bt
#0 value_fetch_lazy (val=0x11516d0) at ../../src/gdb/value.c:3510
#1 0x0000000000584bd8 in value_optimized_out (value=0x11516d0) at ../../src/gdb/value.c:1096
#2 0x00000000006fe7a1 in frame_register_unwind (frame=0x1492600, regnum=16, optimizedp=0x7fffffffcdec, unavailablep=0x7fffffffcde8, lvalp=0x7fffffffcdd8, addrp=
0x7fffffffcde0, realnump=0x7fffffffcddc, bufferp=0x7fffffffce10 "@\316\377\377\377\177") at ../../src/gdb/frame.c:940
#3 0x00000000006fea3a in frame_unwind_register (frame=0x1492600, regnum=16, buf=0x7fffffffce10 "@\316\377\377\377\177") at ../../src/gdb/frame.c:990
#4 0x0000000000473b9b in i386_unwind_pc (gdbarch=0xf54660, next_frame=0x1492600) at ../../src/gdb/i386-tdep.c:1771
#5 0x0000000000601dfa in gdbarch_unwind_pc (gdbarch=0xf54660, next_frame=0x1492600) at ../../src/gdb/gdbarch.c:2870
#6 0x0000000000693db5 in dwarf2_tailcall_sniffer_first (this_frame=0x1492600, tailcall_cachep=0x14926f0, entry_cfa_sp_offsetp=0x7fffffffcf00)
at ../../src/gdb/dwarf2-frame-tailcall.c:389
#7 0x0000000000690928 in dwarf2_frame_cache (this_frame=0x1492600, this_cache=0x1492618) at ../../src/gdb/dwarf2-frame.c:1245
#8 0x0000000000690f46 in dwarf2_frame_sniffer (self=0x8e4980, this_frame=0x1492600, this_cache=0x1492618) at ../../src/gdb/dwarf2-frame.c:1423
#9 0x000000000070203b in frame_unwind_find_by_frame (this_frame=0x1492600, this_cache=0x1492618) at ../../src/gdb/frame-unwind.c:112
#10 0x00000000006fd681 in get_frame_id (fi=0x1492600) at ../../src/gdb/frame.c:408
#11 0x00000000007006c2 in get_prev_frame_1 (this_frame=0xdc1860) at ../../src/gdb/frame.c:1826
#12 0x0000000000700b7a in get_prev_frame (this_frame=0xdc1860) at ../../src/gdb/frame.c:2056
#13 0x0000000000514588 in frame_info_to_frame_object (frame=0xdc1860) at ../../src/gdb/python/py-frame.c:322
#14 0x000000000051784c in bootstrap_python_frame_filters (frame=0xdc1860, frame_low=0, frame_high=-1) at ../../src/gdb/python/py-framefilter.c:1396
#15 0x0000000000517a6f in apply_frame_filter (frame=0xdc1860, flags=7, args_type=CLI_SCALAR_VALUES, out=0xed7a90, frame_low=0, frame_high=-1)
at ../../src/gdb/python/py-framefilter.c:1492
#16 0x00000000005e77b0 in backtrace_command_1 (count_exp=0x0, show_locals=0, no_filters=0, from_tty=1) at ../../src/gdb/stack.c:1777
#17 0x00000000005e7c0f in backtrace_command (arg=0x0, from_tty=1) at ../../src/gdb/stack.c:1891
#18 0x00000000004e37a7 in do_cfunc (c=0xda4fa0, args=0x0, from_tty=1) at ../../src/gdb/cli/cli-decode.c:107
#19 0x00000000004e683c in cmd_func (cmd=0xda4fa0, args=0x0, from_tty=1) at ../../src/gdb/cli/cli-decode.c:1882
#20 0x00000000006f35ed in execute_command (p=0xcc66c2 "", from_tty=1) at ../../src/gdb/top.c:468
#21 0x00000000005f8853 in command_handler (command=0xcc66c0 "bt") at ../../src/gdb/event-top.c:435
#22 0x00000000005f8e12 in command_line_handler (rl=0xfe05f0 "@") at ../../src/gdb/event-top.c:632
#23 0x000000000074d2c6 in rl_callback_read_char () at ../../src/readline/callback.c:220
#24 0x00000000005f8375 in rl_callback_read_char_wrapper (client_data=0x0) at ../../src/gdb/event-top.c:164
#25 0x00000000005f876a in stdin_event_handler (error=0, client_data=0x0) at ../../src/gdb/event-top.c:375
#26 0x00000000005f72fa in handle_file_event (data=...) at ../../src/gdb/event-loop.c:768
#27 0x00000000005f67a3 in process_event () at ../../src/gdb/event-loop.c:342
#28 0x00000000005f686a in gdb_do_one_event () at ../../src/gdb/event-loop.c:406
#29 0x00000000005f68bb in start_event_loop () at ../../src/gdb/event-loop.c:431
#30 0x00000000005f83a7 in cli_command_loop (data=0x0) at ../../src/gdb/event-top.c:179
#31 0x00000000005eeed3 in current_interp_command_loop () at ../../src/gdb/interps.c:327
#32 0x00000000005ef8ff in captured_command_loop (data=0x0) at ../../src/gdb/main.c:267
#33 0x00000000005ed2f6 in catch_errors (func=0x5ef8e4 <captured_command_loop>, func_args=0x0, errstring=0x8b6554 "", mask=RETURN_MASK_ALL)
at ../../src/gdb/exceptions.c:524
#34 0x00000000005f0d21 in captured_main (data=0x7fffffffd9e0) at ../../src/gdb/main.c:1067
#35 0x00000000005ed2f6 in catch_errors (func=0x5efb9b <captured_main>, func_args=0x7fffffffd9e0, errstring=0x8b6554 "", mask=RETURN_MASK_ALL)
at ../../src/gdb/exceptions.c:524
#36 0x00000000005f0d57 in gdb_main (args=0x7fffffffd9e0) at ../../src/gdb/main.c:1076
#37 0x000000000045bb6a in main (argc=4, argv=0x7fffffffdae8) at ../../src/gdb/gdb.c:34
(top-gdb)
GDB is trying to unwind the PC register of the previous frame (frame
#5 above), starting from the frame being sniffed (the THIS frame).
But the THIS frame's unwinder says the PC of the previous frame is
actually the same as the previous's frame's next frame (which is the
same frame we started with, the THIS frame), therefore it returns an
lval_register lazy value with frame set to THIS frame. And so the
value_fetch_lazy loop never ends.
Rationale 2
===========
As an experiment, I tried making dwarf2-frame.c:read_addr_from_reg use
address_from_register. That caused a bunch of regressions, but it
actually took me a long while to figure out what was going on. Turns
out dwarf2-frame.c:read_addr_from_reg is called while computing the
frame's CFA, from within dwarf2_frame_cache. address_from_register
wants to create a register with frame_id set to the frame being
constructed. To create the frame id, we again call dwarf2_frame_cache,
which given:
static struct dwarf2_frame_cache *
dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache)
{
...
if (*this_cache)
return *this_cache;
returns an incomplete object to the caller:
static void
dwarf2_frame_this_id (struct frame_info *this_frame, void **this_cache,
struct frame_id *this_id)
{
struct dwarf2_frame_cache *cache =
dwarf2_frame_cache (this_frame, this_cache);
...
(*this_id) = frame_id_build (cache->cfa, get_frame_func (this_frame));
}
As cache->cfa is still 0 (we were trying to compute it!), and
get_frame_id recalls this id from here on, we end up with a broken
frame id in recorded for this frame. Later, when inspecting locals,
the dwarf machinery needs to know the selected frame's base, which
calls get_frame_base:
CORE_ADDR
get_frame_base (struct frame_info *fi)
{
return get_frame_id (fi).stack_addr;
}
which as seen above then returns 0 ...
So I gave up using address_from_register.
But, the pain of investigating this made me want to have GDB itself
assert that recursion never happens here. So I wrote a patch to do
that. But, it triggers on current mainline, because
dwarf2_tailcall_sniffer_first, called from dwarf2_frame_cache, unwinds
the this_frame.
A sniffer shouldn't be trying to unwind, exactly because of this sort
of tricky issue. The patch defers calling
dwarf2_tailcall_sniffer_first until it's really necessary, in
dwarf2_frame_prev_register (thus actually outside the sniffer path).
As this makes the call to dwarf2_frame_sniffer in dwarf2_frame_cache
unnecessary again, the patch removes that too.
Tested on x86_64 Fedora 17.
gdb/
2013-11-22 Pedro Alves <palves@redhat.com>
PR 16155
* dwarf2-frame.c (struct dwarf2_frame_cache)
<checked_tailcall_bottom, entry_cfa_sp_offset,
entry_cfa_sp_offset_p>: New fields.
(dwarf2_frame_cache): Adjust to use the new cache fields instead
of locals. Don't call dwarf2_tailcall_sniffer_first here.
(dwarf2_frame_prev_register): Call it here, but only once.
Pedro Alves [Thu, 21 Nov 2013 15:20:09 +0000 (15:20 +0000)]
Make use of the frame stash to detect wider stack cycles.
Tested on x86_64 Fedora 17.
gdb/
2013-11-22 Pedro Alves <palves@redhat.com>
Tom Tromey <tromey@redhat.com>
* frame.c (frame_stash_add): Now returns whether a frame with the
same ID was already known.
(compute_frame_id): New function, factored out from get_frame_id.
(get_frame_id): No longer lazilly compute the frame id here.
(get_prev_frame_if_no_cycle): New function. Detects wider stack
cycles.
(get_prev_frame_1): Use it instead of get_prev_frame_raw directly,
and checking for stack cycles here.
Pedro Alves [Fri, 22 Nov 2013 11:51:59 +0000 (11:51 +0000)]
Don't let two frames with the same id end up in the frame chain.
The UNWIND_SAME_ID check is done between THIS_FRAME and the next frame
when we go try to unwind the previous frame. But at this point, it's
already too late -- we ended up with two frames with the same ID in
the frame chain. Each frame having its own ID is an invariant assumed
throughout GDB. This patch applies the UNWIND_SAME_ID detection
earlier, right after the previous frame is unwound, discarding the dup
frame if a cycle is detected.
The patch includes a new test that fails before the change. Before
the patch, the test causes an infinite loop in GDB, after the patch,
the UNWIND_SAME_ID logic kicks in and makes the backtrace stop with:
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
The test uses dwarf CFI to emulate a corrupted stack with a cycle. It
has a function with registers marked DW_CFA_same_value (most
importantly RSP/RIP), so that GDB computes the same ID for that frame
and its caller. IOW, something like this:
#0 - frame_id_1
#1 - frame_id_2
#2 - frame_id_3
#3 - frame_id_4
#4 - frame_id_4 <<<< outermost (UNWIND_SAME_ID).
(The test's code is just a copy of dw2-reg-undefined.S /
dw2-reg-undefined.c, adjusted to use DW_CFA_same_value instead of
DW_CFA_undefined, and to mark a different set of registers.)
The infinite loop is here, in value_fetch_lazy:
while (VALUE_LVAL (new_val) == lval_register && value_lazy (new_val))
{
frame = frame_find_by_id (VALUE_FRAME_ID (new_val));
...
new_val = get_frame_register_value (frame, regnum);
}
get_frame_register_value can return a lazy register value pointing to
the next frame. This means that the register wasn't clobbered by
FRAME; the debugger should therefore retrieve its value from the next
frame.
To be clear, get_frame_register_value unwinds the value in question
from the next frame:
struct value *
get_frame_register_value (struct frame_info *frame, int regnum)
{
return frame_unwind_register_value (frame->next, regnum);
^^^^^^^^^^^
}
In other words, if we get a lazy lval_register, it should have the
frame ID of the _next_ frame, never of FRAME.
At this point in value_fetch_lazy, the whole relevant chunk of the
stack up to frame #4 has already been unwound. The loop always
"unlazies" lval_registers in the "next/innermost" direction, not in
the "prev/unwind further/outermost" direction.
So say we're looking at frame #4. get_frame_register_value in frame
#4 can return a lazy register value of frame #3. So the next
iteration, frame_find_by_id tries to read the register from frame #3.
But, since frame #4 happens to have same id as frame #3,
frame_find_by_id returns frame #4 instead. Rinse, repeat, and we have
an infinite loop.
This is an old latent problem, exposed by the recent addition of the
frame stash. Before we had a stash, frame_find_by_id(frame_id_4)
would walk over all frames starting at the current frame, and would
always find #3 first. The stash happens to return #4 instead:
struct frame_info *
frame_find_by_id (struct frame_id id)
{
struct frame_info *frame, *prev_frame;
...
/* Try using the frame stash first. Finding it there removes the need
to perform the search by looping over all frames, which can be very
CPU-intensive if the number of frames is very high (the loop is O(n)
and get_prev_frame performs a series of checks that are relatively
expensive). This optimization is particularly useful when this function
is called from another function (such as value_fetch_lazy, case
VALUE_LVAL (val) == lval_register) which already loops over all frames,
making the overall behavior O(n^2). */
frame = frame_stash_find (id);
if (frame)
return frame;
for (frame = get_current_frame (); ; frame = prev_frame)
{
gdb/
2013-11-22 Pedro Alves <palves@redhat.com>
PR 16155
* frame.c (get_prev_frame_1): Do the UNWIND_SAME_ID check between
this frame and the new previous frame, not between this frame and
the next frame.
gdb/testsuite/
2013-11-22 Pedro Alves <palves@redhat.com>
PR 16155
* gdb.dwarf2/dw2-dup-frame.S: New file.
* gdb.dwarf2/dw2-dup-frame.c: New file.
* gdb.dwarf2/dw2-dup-frame.exp: New file.
Senthil Kumar Selvaraj [Fri, 22 Nov 2013 12:00:55 +0000 (12:00 +0000)]
* scripttempl/avr.sc: Set .data section's LMA to next available
address in text region.
Doug Evans [Fri, 22 Nov 2013 04:28:35 +0000 (20:28 -0800)]
Move types_deeply_equal from py-type.c to gdbtypes.c.
* gdbtypes.c: #include bcache.h, dwarf2loc.h.
(type_equality_entry): Move here from python/py-type.c.
(type_equality_entry_d): Ditto.
(compare_maybe_null_strings, check_types_equal): Ditto.
(check_types_worklist, types_deeply_equal): Ditto.
* gdbtypes.h (types_deeply_equal): Declare.
* python/py-type.c: Remove inclusion of bcache.h, dwarf2loc.h.
(typy_richcompare): Update.
Yao Qi [Sun, 10 Nov 2013 02:31:09 +0000 (10:31 +0800)]
Check has_more in mi_create_dynamic_varobj
Hi,
I find "has_more" is not checked when a dynamic varobj is created in
proc mi_create_dynamic_varobj. This patch adds the check to
"has_more".
gdb/testsuite:
2013-11-22 Yao Qi <yao@codesourcery.com>
* lib/mi-support.exp (mi_create_dynamic_varobj): Update
comment and add one more argument "has_more".
* gdb.python/py-mi.exp: Callers update.
Yao Qi [Sun, 10 Nov 2013 02:30:46 +0000 (10:30 +0800)]
Use mi_create_floating_varobj
In gdb.python/py-mi.exp, two varobjs container and nscont are created
when pretty-printing is still not enabled, so they are not dynamic
varobj, IIUC. In this patch, we use mi_create_floating_varobj instead
of mi_create_dynamic_varobj.
gdb/testsuite:
2013-11-22 Yao Qi <yao@codesourcery.com>
* gdb.python/py-mi.exp: Use mi_create_floating_varobj instead
of mi_create_dynamic_varobj.
Alan Modra [Thu, 21 Nov 2013 23:00:06 +0000 (09:30 +1030)]
daily update
Andrew Pinski [Thu, 21 Nov 2013 00:56:20 +0000 (16:56 -0800)]
ld/ChangeLog:
* Makefile.am (ALL_64_EMULATION_SOURCES): Add eaarch64linux32.c
and eaarch64linux32b.c
(eaarch64linux32.c): New target.
(eaarch64linux32b.c): Likewise.
* Makefile.in: Regenerate.
* configure.tgt (aarch64_be-*-linux*): Add
aarch64linux32 and aarch64linux32b to targ_extra_libpath.
(aarch64-*-linux*): Likewise.
* emulparams/aarch64elf32.sh (SEPARATE_GOTPLT): Change to 12 (3 words).
* emulparams/aarch64linux32.sh: New file.
* emulparams/aarch64linux32b.sh: New file.
Andrew Pinski [Thu, 21 Nov 2013 00:36:36 +0000 (16:36 -0800)]
ld/ChangeLog:
* configure.tgt (aarch64_be-*-linux*): Split out the linux targets
into targ_extra_libpath.
(aarch64-*-linux*): Likewise.
schwab [Fri, 15 Nov 2013 17:49:36 +0000 (17:49 +0000)]
config/ * picflag.m4 (m68k-*-*): Use default PIC flag.
gcc/
* configure: Regenerate.
libada/
* configure: Regenerate.
libgcc/
* configure: Regenerate.
libiberty/
* configure: Regenerate.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204854
138bc75d-0d04-0410-961f-
82ee72b054a4
Nick Clifton [Thu, 21 Nov 2013 13:29:47 +0000 (13:29 +0000)]
PR ld/16192
* pe-dll.c (pe_create_runtime_relocator_reference): Zero the
newly allocated idata5 block.
Conrad Hoffmann [Thu, 21 Nov 2013 13:13:06 +0000 (13:13 +0000)]
* gprof.c (inline_file_names): New variable.
(OPTION_INLINE_FILE_NAMES): Define.
(long_options): Add --inline-file-names.
(usage): Likewise.
(main): Process --inline-file-names.
* gprof.h: Add prototype for inline_file_names.
* utils.c (print_name_only): Handle inline_file_names.
* gprof.texi: Document new command line option.
H.J. Lu [Thu, 21 Nov 2013 12:53:05 +0000 (04:53 -0800)]
Add bnd-branch-1 test
* ld-x86-64/mpx.exp: Run bnd-branch-1.
* ld-x86-64/bnd-branch-1.d: New file.
* ld-x86-64/bnd-branch-1.s: Likewise.
Tristan Gingold [Tue, 19 Nov 2013 13:52:05 +0000 (14:52 +0100)]
Fix version.dll binutils test on non native platforms
2013-11-21 Tristan Gingold <gingold@adacore.com>
* binutils-all/dlltool.exp: Add dlltool_gas_flag to version.dll test.
Yao Qi [Tue, 19 Nov 2013 11:11:21 +0000 (19:11 +0800)]
Doc 'dynamic' for command -var-list-children
Hi,
I find "dynamic=1" appear in the result of each child of the output of
-var-list-children,
-var-list-children ss1
^done,numchild="2",children=[child={name="ss1.a",exp="a",numchild="0",type="struct s",thread-id="1",dynamic="1"},child={name="ss1.b",exp="b",numchild="0",type="struct s",thread-id="1",dynamic="1"}],has_more="0"
but the doc doesn't mention this. This patch is to copy the description
of "dynamic=1" here.
gdb/doc:
2013-11-21 Yao Qi <yao@codesourcery.com>
* gdb.texinfo (GDB/MI Variable Objects): Add attribute 'dynamic'
for the output of command -var-list-children.
Yao Qi [Wed, 20 Nov 2013 03:38:49 +0000 (11:38 +0800)]
s/see @pxref/@pxref in doc
Looks "see" is unnecessary before @pxref.
gdb/doc:
2013-11-21 Yao Qi <yao@codesourcery.com>
* gdb.texinfo (Caching Target Data): Remove "see" before
@pxref.
Doug Evans [Thu, 21 Nov 2013 01:32:33 +0000 (17:32 -0800)]
* linux-low.c (linux_set_resume_request): Fix comment.
Doug Evans [Thu, 21 Nov 2013 00:31:48 +0000 (16:31 -0800)]
* linux-low.c (resume_status_pending_p): Tweak comment.
Alan Modra [Wed, 20 Nov 2013 23:00:01 +0000 (09:30 +1030)]
daily update
H.J. Lu [Wed, 20 Nov 2013 20:35:10 +0000 (12:35 -0800)]
Add mpx1static, mpx2 and mpx2static tests
* ld-x86-64/mpx.exp (build_tests): Add libmpx2a.a, libmpx2b.a
and libmpx2c.a.
(run_tests): Add mpx1static, mpx2 and mpx2static.
* ld-x86-64/mpx2.out: Likewise.
* ld-x86-64/mpx2a.c: Likewise.
* ld-x86-64/mpx2a.rd: Likewise.
* ld-x86-64/mpx2b.c: Likewise.
* ld-x86-64/mpx2c.c: Likewise.
* ld-x86-64/mpx2c.rd: Likewise.
Pedro Alves [Wed, 20 Nov 2013 17:23:39 +0000 (17:23 +0000)]
Add missing ChangeLog entry.
2013-11-20 Pedro Alves <palves@redhat.com>
* gdb.base/maint.exp (maint print objfiles): Consume one line at a
time, and run it through all three milestone regexes.
Joel Brobecker [Tue, 19 Nov 2013 02:56:00 +0000 (06:56 +0400)]
get rid of py-value.c:is_intlike (use is_integral_type instead)
is_intlike was mostly duplicating is_integral_type, with the exception
of the handling of TYPE_CODE_PTR when parameter PTR_OK is nonzero.
This patches deletes the is_intlike function, using is_integral_type
instead, and adjusting the two locations where this function gets
called.
The code should remain strictly equivalent.
gdb/ChangeLog:
* python/py-value.c (is_intlike): Delete.
(valpy_int): Replace use of CHECK_TYPEDEF and is_intlike
by use of is_integral_type.
(valpy_long): Replace use of CHECK_TYPEDEF and is_intlike
by use of is_integral_type and check for TYPE_CODE_PTR.
Pedro Alves [Wed, 20 Nov 2013 17:12:37 +0000 (17:12 +0000)]
Make the maint.exp:'maint print objfiles' test less fragile.
I was "lucky" enough that an unrelated patch changed how many symtabs
GDB expands in a plain run to main, and that triggered a latent issue
in this test:
PASS: gdb.base/maint.exp: maint print objfiles: header
PASS: gdb.base/maint.exp: maint print objfiles: psymtabs
FAIL: gdb.base/maint.exp: maint print objfiles: symtabs
The problem is in my case, expect is managing to alway put in the
buffer chunks like this:
Psymtabs:
../../../src/gdb/testsuite/gdb.base/break1.c at 0x1ed2280, ../../../src/gdb/testsuite/gdb.base/break.c at 0x1ed21d0,
Symtabs:
../../../src/gdb/testsuite/gdb.base/break.c at 0x1f044f0, /usr/include/stdio.h at 0x1ed25a0, /usr/include/libio.h at 0x1ed2510, /usr/include/bits/types.h at 0x1ed2480, /usr/lib/gcc/x86_64-redhat-linux/4.7.2/include/stddef.h at 0x1ed23f0,
Object file /usr/lib/debug/lib64/ld-2.15.so.debug: Objfile at 0x1f4bff0, bfd at 0x1f2d940, 0 minsyms
Psymtabs:
bsearch.c at 0x1f65340, ../sysdeps/x86_64/multiarch/init-arch.c at
0x1f65290, ...
Note: Psymtabs:/Symtabs:/Psymtabs:.
So, the loop matches the first Psymtabs in the buffer. Then we're
left with
../../../src/gdb/testsuite/gdb.base/break1.c at 0x1ed2280, ../../../src/gdb/testsuite/gdb.base/break.c at 0x1ed21d0,
Symtabs:
../../../src/gdb/testsuite/gdb.base/break.c at 0x1f044f0, /usr/include/stdio.h at 0x1ed25a0, /usr/include/libio.h at 0x1ed2510, /usr/include/bits/types.h at 0x1ed2480, /usr/lib/gcc/x86_64-redhat-linux/4.7.2/include/stddef.h at 0x1ed23f0,
Object file /usr/lib/debug/lib64/ld-2.15.so.debug: Objfile at 0x1f4bff0, bfd at 0x1f2d940, 0 minsyms
Psymtabs:
bsearch.c at 0x1f65340, ../sysdeps/x86_64/multiarch/init-arch.c at
0x1f65290, ...
In the next iteration, because the psymtabs regex comes first, we
match with the Psymtabs: line, then of course, end up with just
bsearch.c at 0x1f65340, ../sysdeps/x86_64/multiarch/init-arch.c at
0x1f65290, ...
in the buffer. The "Symtabs:" line is lost. expect then reads more
gdb output, and manages to again retrieve the same pattern. Rinse,
repeat, and the test never matches any "Symtab:" line.
We don't know the order the matches lines will appear, so the fix is
to consume one line at a time, and run it through all three milestone
regexes.
gdb/testsuite/
2013-11-20 Pedro Alves <palves@redhat.com>
* gdb.base/maint.exp (maint print objfiles): Consume one line at a
time, and run it through all three milestone regexes.
Nick Clifton [Wed, 20 Nov 2013 16:51:21 +0000 (16:51 +0000)]
* scripttempl/elf32msp430.sc (.data): Set the based on the next
free location in the text memory region, not a computation based
upon the size of the text section. Orphaned sections or other
linker scripts might insert new sections between the .text section
and the .data section.
* scripttempl/elf32msp430_3.sc (.data): Likewise.
Tom Tromey [Wed, 20 Nov 2013 15:19:05 +0000 (08:19 -0700)]
remove strerror module
This fixes the mingw build breakage reported by Pierre.
I found that the gnulib strerror module somehow requires us to pull in
the gethostname module. However, pulling in the gethostname module
makes many things break.
I've sent a bug report to gnulib.
Meanwhile, removing the strerror module should not harm gdb and fixes
the build.
I'm checking this in.
2013-11-20 Tom Tromey <tromey@redhat.com>
* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Remove
strerror module.
* gnulib/aclocal.m4: Update.
* gnulib/config.in: Update.
* gnulib/configure: Update.
* gnulib/import/Makefile.am: Update.
* gnulib/import/Makefile.in: Update.
* gnulib/import/errno.in.h: Remove.
* gnulib/import/intprops.h: Remove.
* gnulib/import/m4/errno_h.m4: Remove.
* gnulib/import/m4/gnulib-cache.m4: Update.
* gnulib/import/m4/gnulib-comp.m4: Update.
* gnulib/import/m4/strerror.m4: Remove.
* gnulib/import/m4/sys_socket_h.m4: Remove.
* gnulib/import/strerror-override.c: Remove.
* gnulib/import/strerror-override.h: Remove.
* gnulib/import/strerror.c: Remove.
* gnulib/update-gnulib.sh: Update.
Sanimir Agovic [Wed, 20 Nov 2013 13:45:36 +0000 (13:45 +0000)]
test: test eval routines with EVAL_AVOID_SIDE_EFFECTS flag set
Ensure that certain commands (e.g. whatis/ptype) and sizeof intrinsic
have no side effects (variables cannot be altered).
2013-11-20 Sanimir Agovic <sanimir.agovic@intel.com>
testsuite/
* gdb.base/eval-avoid-side-effects.exp: New test.
Yao Qi [Wed, 20 Nov 2013 12:59:47 +0000 (20:59 +0800)]
set_address_space_data if dcache is NULL.
gdb:
2013-11-20 Yao Qi <yao@codesourcery.com>
* target-dcache.c (target_dcache_get_or_init): Call
set_address_space_data if 'dcache' is NULL.
Walfred Tedeschi [Thu, 5 Sep 2013 09:09:23 +0000 (09:09 +0000)]
Add MPX registers tests.
2013-11-20 Walfred Tedeschi <walfred.tedeschi@intel.com>
* common/i386-gcc-cpuid.h (bit_MPX): Synchronize with gcc file.
testsuite/
* gdb.arch/i386-mpx.c: New file
* gdb.arch/i386-mpx.exp: New file.
Change-Id: Ica4c9ee823c8210ca876e31f27dcd8583b660a9f
Signed-off-by: Walfred Tedeschi <walfred.tedeschi@intel.com>
Walfred Tedeschi [Wed, 20 Nov 2013 12:03:07 +0000 (13:03 +0100)]
Add pretty-printer for MPX bnd registers.
Boundary length is simpler implemented by means of a pretty
printer. This simplifies users life when examining a bound register.
Changelog:
2013-11-20 Walfred Tedeschi <walfred.tedeschi@intel.com>
* python/lib/gdb/command/bound_register.py: New file.
* gdb/data-directory/Makefile.in: copy bond_register.py to the right path to
be initialized at gdb startup.
testsuite/
* gdb.python/py-pp-maint.exp: Consider new pretty-print added for registers.
Change-Id: Id4f39845e5ece56c370a1fd4343648909f08b731
Signed-off-by: Walfred Tedeschi <walfred.tedeschi@intel.com>
Conflicts:
gdb/ChangeLog
Walfred Tedeschi [Thu, 10 Oct 2013 07:12:49 +0000 (07:12 +0000)]
Add MPX support to gdbserver.
2013-05-22 Walfred Tedeschi <walfred.tedeschi@intel.com>
gdbserver/
* Makefile.in: Add i386-mpx.c, i386-mpx-linux.c, amd64-mpx.c,
amd64-mpx-linux.c, x32-mpx.c and x32-mpx-linux.c generation.
* configure.srv (srv_i386_regobj): Add i386-mpx.o.
(srv_i386_linux_regobj): Add i386-mpx-linux.o.
(srv_amd64_regobj): Add amd64-mpx.o.
(srv_amd64_linux_regobj): Add amd64-mpx-linux.o.
(srv_i386_32bit_xmlfiles): Add i386/32bit-mpx.xml.
(srv_i386_64bit_xmlfiles): Add i386/64bit-mpx.xml.
* i387-fp.c (num_pl_bnd_register) Added constant.
(num_pl_bnd_cfg_registers) Added constant.
(struct i387_xsave) Added reserved area and MPX fields.
(i387_cache_to_xsave, i387_xsave_to_cache) Add MPX.
* linux-x86-low.c (init_registers_i386_mpx_linux): Declare new
function.
(tdesc_i386_mpx_linux): Add MPX amd64 target.
(init_registers_amd64_mpx_linux): Declare new function.
(tdesc_amd64_mpx_linux): Add MPX amd64 target.
(x86_64_regmap): Add MPX registers.
(x86_linux_read_description): Add MPX case.
(initialize_low_arch): Initialize MPX targets.
Change-Id: I394d81afa76d11375ce792cefad0ceb9825fb379
Signed-off-by: Walfred Tedeschi <walfred.tedeschi@intel.com>
Walfred Tedeschi [Wed, 20 Nov 2013 12:02:37 +0000 (13:02 +0100)]
MPX for amd64
2013-06-24 Walfred Tedeschi <walfred.tedeschi@intel.com>
* amd64-linux-nat.c (amd64_linux_gregset32_reg_offset):
Add MPX registers.
(amd64_linux_read_description): Add initialization for MPX and
AVX independently.
* amd64-linux-tdep.c: Includes features/i386/amd64-mpx-linux.c.
(amd64_linux_gregset_reg_offset): Add MPX registers.
(amd64_linux_core_read_description): Add initialization for MPX
registers.
(_initialize_amd64_linux_tdep): Initialize MPX targets.
* amd64-linux-tdep.h (AMD64_LINUX_RAX_REGNUM): Set it to the last
register on the list.
(tdesc_amd64_mpx_linux) Add new target for MPX.
* amd64-tdep.c: Includes features/i386/amd64-mpx.c.
(amd64_mpx_names): MPX register names.
(amd64_init_abi): Add MPX register while initializing the ABI.
(_initialize_amd64_tdep): Initialize MPX targets.
* amd64-tdep.h (amd64_regnum): Add MPX registers.
(AMD64_NUM_REGS): Set number of registers taking MPX into account.
Change-Id: I4a785c181e2fb45e4086650b2f87426caeb2f800
Signed-off-by: Walfred Tedeschi <walfred.tedeschi@intel.com>
Conflicts:
gdb/ChangeLog
Walfred Tedeschi [Wed, 20 Nov 2013 12:02:00 +0000 (13:02 +0100)]
Add MPX support for i386
2013-11-20 Walfred Tedeschi <walfred.tedeschi@intel.com>
* i386-linux-nat.c (GETXSTATEREGS_SUPPLIES): Add MPX
registers on the range of registers to be read from
xsave buffer.
(i386_linux_read_description): Add case for MPX.
* i386-linux-tdep.c: Include features/i386/i386-mpx-linux.c.
(i386_linux_gregset_reg_offset): Add MPX registers.
(i386_linux_core_read_description): Initialize also MPX.
(_initialize_i386_linux_tdep): Add mpx initialization.
* i386-tdep.h (gdbarch_tdep): Add fields bnd0r_regnum, bnd0_regnum,
mpx_register_names.
(i386_regnum): Add MPX registers.
(I386_MPX_NUM_REGS): New macro.
(i386_bnd_regnum_p): New function.
* i386-linux-tdep.h (I386_LINUX_NUM_REGS): Set
number of registers to be the number of BNDSTATUS.
(tdesc_i386_mpx_linux): Add description for MPX Linux registers.
* i386-tdep.c: Include features/i386/i386-mpx.c.
(i386_mpx_names): Add MPX register names array.
(i386_bnd_names): Add bnd pseudo register names array.
(i386_bndr_regnum_p): Lookup register numbers for bnd raw
registers.
(i386_bndr_regnum_p): Lookup register numbers for bnd raw registers.
(386_mpx_ctrl_regnum_p): Lookup register numbers for MPX control
registers.
(i386_bnd_type): New function.
(i386_pseudo_register_type): Use i386_bnd_type for bnd pseudo
register types.
(i386_pseudo_register_read_into_value): Add bnd case.
(i386_pseudo_register_write): Add bnd pseudo registers.
(i386_register_reggroup_p): Add MPX register to the group all.
(i386_validate_tdesc_p): Add MPX to the target description
validation.
(i386_pseudo_register_name): Add bnd pseudo registers.
(i386_gdbarch_init): Add MPX for architecture initialization.
(_initia_initialize_i386_tdep): Add mpx initialization.
* i387-tdep.c (xsave_mpx_offset): New vector for MPX offsets on
XSAVE buffer.
(XSAVE_MPX_ADDR): New macro.
(i387_supply_xsave): Add MPX case.
(i387_collect_xsave): Add MPX case.
* i387-tdep.h (I387_BND0R_REGNUM): New macro.
(I387_BNDCFGU_REGNUM): New macro.
(I387_NUM_MPX_REGS): New macro.
(I387_NUM_BND_REGS): New macro.
(I387_NUM_MPX_CTRL_REGS): New macro.
(I387_MPXEND_REGNUM): New macro.
* common/i386-xstate.h (I386_XSTATE_BNDREGS): New macro.
(I386_XSTATE_BNDCFG): Likewise.
(I386_XSTATE_MPX_MASK): Likewise.
(I386_XSTATE_ALL_MASK): New macro represents flags for all states.
(I386_XSTATE_BNDREGS_SIZE): New macro.
(I386_XSTATE_BNDCFG_SIZE): Likewise.
(I386_XSTATE_SIZE): Adapt for MPX.
(I386_XSTATE_MAX_SIZE): Likewise.
Change-Id: I9ddb7d49434d86fa18eb6b99515203d7c567aefd
Signed-off-by: Walfred Tedeschi <walfred.tedeschi@intel.com>
Conflicts:
gdb/ChangeLog
Walfred Tedeschi [Wed, 20 Nov 2013 12:01:09 +0000 (13:01 +0100)]
Add MPX registers XML files.
2013-11-20 Walfred Tedeschi <walfred.tedeschi@intel.com>
* features/i386/Makefile: Adapts for using MPX registers.
* features/i386/32bit-mpx.xml: New file.
* features/i386/64bit-mpx.xml: Likewise.
* features/i386/amd64-mpx-linux.c: Likewise.
* features/i386/amd64-mpx-linux.xml: Likewise.
* features/i386/amd64-mpx.c: Likewise.
* features/i386/amd64-mpx.xml: Likewise.
* features/i386/i386-mpx-linux.c: Likewise.
* features/i386/i386-mpx-linux.xml: Likewise.
* features/i386/i386-mpx.c: Likewise.
* features/i386/i386-mpx.xml: Likewise.
* regformats/i386/amd64-mpx-linux.dat: New file.
* regformats/i386/amd64-mpx.dat: Likewise.
* regformats/i386/i386-mpx-linux.dat: Likewise.
* regformats/i386/i386-mpx.dat: Likewise.
Walfred Tedeschi [Tue, 19 Nov 2013 12:19:30 +0000 (12:19 +0000)]
Fix conditions in creating a bitfield.
Bitfields are represented by intervals [start, begin]. It means that for an
interval comprised by only one bit start and end will be equal.
The present condition does not always hold. On the other hand in target-description.c
(tdesc_gdb_type) bitfield is created when "f->type" is null. The routine
maint_print_maint_print_c_tdesc_cmd is modified to follow the same strategy.
2013-11-20 Walfred Tedeschi <walfred.tedeschi@intel.com>
* target-descriptions.c (maint_print_maint_print_c_tdesc_cmd):
Modified logic of creating a bitfield to be in sync with
tdesc_gdb_type.
testsuite/
* gdb.xml/maint_print_struct.xml (bitfield): Added bitfield having
start and end equal 0.
Change-Id: I8c62db049995f0c0c30606d9696b86afe237cbb9
Yufeng Zhang [Wed, 20 Nov 2013 11:22:40 +0000 (11:22 +0000)]
gas/testsuite/
* gas/aarch64/msr.s: Add tests.
* gas/aarch64/msr.d: Update.
include/opcode
* aarch64.h (aarch64_pstatefields): Change element type to
aarch64_sys_reg.
opcodes/
* aarch64-opc.c (aarch64_pstatefields): Update.
Yufeng Zhang [Tue, 19 Nov 2013 18:11:03 +0000 (18:11 +0000)]
Revert "Do not issue error messages when parsing a PSTATE register".
This reverts commit
03e621be975dacc9cec9f5782698bdb098f6a49c.
Will Newton [Fri, 8 Nov 2013 16:26:10 +0000 (16:26 +0000)]
gdb/arm-tdep.c: Remove "Infinite loop detected" error message.
Since as far back as the beginning of the sourceware repository
the ARM port has printed an error "Infinite loop detected" when
the next_pc calculated is the same as the current one, for example
when encountering a branch to the current PC address.
This causes the test gdb.base/random-signal.exp as the error message
is not expected. I have not been able to find a good reason for the
message to be here so remove it and let the test pass.
gdb/ChangeLog:
2013-11-20 Will Newton <will.newton@linaro.org>
* arm-tdep.c (arm_get_next_pc): Remove "Infinite loop detected"
error message.
Yao Qi [Thu, 31 Oct 2013 14:18:10 +0000 (22:18 +0800)]
Associate target_dcache to address_space.
Hi,
Nowadays, 'target_dcache' is a global variable in GDB, which is not
necessary. It can be a per-address-space variable. In this patch, we
associate target_dcache to address_space.
gdb/doc:
2013-11-20 Yao Qi <yao@codesourcery.com>
* gdb.texinfo (Caching Target Data): Update doc for
per-address-space dcache.
gdb:
2013-11-20 Yao Qi <yao@codesourcery.com>
* progspace.h (struct address_space_data): Declare.
* target-dcache.c: Include "progspace.h".
(target_dache): Remove.
(target_dcache_aspace_key): New.
(target_dcache_cleanup): New function.
(target_dcache_init_p): Get data through
target_dcache_aspace_key.
(target_dcache_invalidate): Likewise.
(target_dcache_get): Likewise.
(target_dcache_get_or_init): Likewise.
(_initialize_target_dcache): Initialize
target_dcache_aspace_key.
Yao Qi [Mon, 21 Oct 2013 08:31:17 +0000 (16:31 +0800)]
Add REGISTRY for struct address_space.
This patch adds REGISTRY for struct address_space.
gdb:
2013-11-20 Yao Qi <yao@codesourcery.com>
* progspace.c (struct address_space): Update comments.
<REGISTRY_FIELDS>: New fields.
DEFINE_REGISTRY for address_space.
(new_address_space): Call address_space_alloc_data.
(free_address_space): Call address_space_free_data.
* progspace.h: Use DECLARE_REGISTRY.
Yao Qi [Thu, 31 Oct 2013 12:49:49 +0000 (20:49 +0800)]
Don't stress 'remote' in "Data Caching" in doc
When I try to describe the cache and its related commands (in a
cache-per-address-space world), I find hard to add, because
existing doc is focused on remote debugging, while data cache is used
regardless of the target. More precisely, GDB cache target data,
instead of remote data.
gdb/doc:
2013-11-20 Yao Qi <yao@codesourcery.com>
* gdb.texinfo (Data): Rename menu item.
(Caching Remote Data): Rename to ...
(Caching Target Data): ... it. Update.
Yao Qi [Thu, 31 Oct 2013 08:50:15 +0000 (16:50 +0800)]
Move target-dcache out of target.c
This patch moves target_dcache related code out of target.c.
gdb:
2013-11-20 Yao Qi <yao@codesourcery.com>
* Makefile.in (SFILES):Add target-dcache.c.
(HFILES_NO_SRCDIR): Add target-dcache.h.
(COMMON_OBS): Add target-dcache.o.
* dcache.c: Remove inclusion to "target.h". Include
"target-dcache.h".
* memattr.c: Include "target-dcache.h".
* top.c: Likewise.
* tracepoint.c: Likewise.
* target.c: (stack_cache_enabled_p_1): Move to
target-dcache.c.
(stack_cache_enabled_p): Likewise.
(set_stack_cache_enabled_p): Likewise.
(show_stack_cache_enabled_p): Likewise.
(target_dcache, target_dcache_init_p): Likewise.
(target_dcache_invalidate): Likewise.
(target_dcache_get, target_dcache_get_or_init): Likewise.
(memory_xfer_partial_1): Call function stack_cache_enabled.
(initialize_target): Move code to target-dcache.c.
* target.h (target_dcache_invalidate): Move to
target-dcache.h.
(target_dcache_get): Likewise.
* target-dcache.c: New.
* target-dcache.h: New.
Yao Qi [Thu, 31 Oct 2013 07:01:33 +0000 (15:01 +0800)]
Don't update target_dcache if it is not initialized
After previous patch, 'target_dcache' is initialized lazily. It is
possible that 'target_dcache' is still NULL when GDB writes to memory.
In this case, update to 'target_dcache' can be skipped.
gdb:
2013-11-20 Yao Qi <yao@codesourcery.com>
* target.c (memory_xfer_partial_1): Update 'target_dcache' if
it is initialized.
Yao Qi [Tue, 29 Oct 2013 13:34:20 +0000 (21:34 +0800)]
Remove last_cache
This patch removes global variable 'last_cache', and initialize
'target_dcache' lazily, so that 'target_dcache' can replace
'last_cache'. No functionalities should be changed after this patch.
gdb:
2013-11-20 Yao Qi <yao@codesourcery.com>
* dcache.c (last_cache): Remove.
(dcache_free, dcache_init): Update.
(dcache_update):
(dcache_print_line): Add parameter 'dcache'. Replace
'target_dcache' with 'dcache'.
(dcache_info): Move code to dcache_info_1. Call
'dcache_info_1'.
(dcache_info_1): New function.
(set_dcache_size): Call target_dcache_invalidate.
(set_dcache_line_size): Call target_dcache_invalidate.
* target.c (target_dcache_init_p): New function.
(target_dcache_invalidate): Check target_dcache_init_p first.
(target_dcache_get, target_dcache_get_or_init): New function.
(memory_xfer_partial_1): Adjust.
(initialize_target): Don't initialize 'target_dcache'.
* target.h (struct dcache_struct): Declare.
(target_dcache_get): Declare.
Yao Qi [Wed, 20 Nov 2013 03:02:17 +0000 (11:02 +0800)]
Move changelog entry to the right ChangeLog
Roland McGrath [Tue, 19 Nov 2013 22:57:54 +0000 (14:57 -0800)]
Fix *-nacl* target objcopy/strip of binary made with custom linker script
bfd/
* elf-nacl.c (nacl_modify_segment_map): Calculate SIZEOF_HEADERS
when not doing linking (i.e. INFO is a null pointer).
Alan Modra [Tue, 19 Nov 2013 23:00:01 +0000 (09:30 +1030)]
daily update
H.J. Lu [Tue, 19 Nov 2013 21:00:42 +0000 (13:00 -0800)]
Re-indent elf_x86_64_section_from_shdr
* elf64-x86-64.c (elf_x86_64_section_from_shdr): Re-indent.
Roland McGrath [Tue, 19 Nov 2013 18:54:00 +0000 (10:54 -0800)]
Fix references to __ehdr_start when it cannot be defined
ld/
* emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation):
Don't use bfd_elf_record_link_assignment to mark __ehdr_start
hidden. Instead, just do it directly here, and only if it was
referenced but not defined.
ld/testsuite/
* ld-elf/ehdr_start-userdef.t: New file.
* ld-elf/ehdr_start-userdef.d: New file.
* ld-elf/ehdr_start-strongref.s: New file.
* ld-elf/ehdr_start-missing.t: New file.
* ld-elf/ehdr_start-missing.d: New file.
* ld-elf/ehdr_start-weak.d: New file.
* ld-mips-elf/ehdr_start-2.nd: Expect __ehdr_start to be global.
Nick Clifton [Tue, 19 Nov 2013 17:40:31 +0000 (17:40 +0000)]
* config/tc-aarch64.c (parse_sys_reg): Do not issue error messages
for deprecated system registers when parsing pstate fields.
Yao Qi [Wed, 13 Nov 2013 13:01:47 +0000 (21:01 +0800)]
Remove unnecessary '\'.
Hi,
In proc mi_child_regexp, \(,thread-id=\"\[0-9\]+\") is appended to
children_exp, while the first '\' is not necessary. This patch
is to remove it. With this patch applied, Emacs can find the right
left paren.
gdb/testsuite:
2013-11-19 Yao Qi <yao@codesourcery.com>
* lib/mi-support.exp (mi_child_regexp): Remove unnecessary '\'.
Yao Qi [Fri, 8 Nov 2013 13:33:26 +0000 (21:33 +0800)]
Fix format issues in lib/mi-support.exp
There are some format issues in lib/mi-support.exp, such as using
spaces instead of tab and trailing spaces. This patch is to fix them.
gdb/testsuite:
2013-11-19 Yao Qi <yao@codesourcery.com>
* lib/mi-support.exp: Fix format.
Catherine Moore [Tue, 19 Nov 2013 13:25:32 +0000 (05:25 -0800)]
2013-11-19 Catherine Moore <clm@codesourcery.com>
* micromips-opc.c (LM): Define.
(micromips_opcodes): Add LM to load instructions.
* mips-opc.c (prefe): Add LM attribute.
Catherine Moore [Tue, 19 Nov 2013 12:44:59 +0000 (04:44 -0800)]
2013-11-19 Catherine Moore <clm@codesourcery.com>
gas/
* config/tc-mips.c (mips_fix_pmc_rm7000): Declare.
(options): Add OPTION_FIX_PMC_RM7000 and OPTION_NO_FIX_PMC_RM7000.
(md_longopts): Add mfix-pmc-rm7000 and mno-fix-pmc-rm7000.
(INSN_DMULT): Define.
(INSN_DMULTU): Define.
(insns_between): Detect PMC RM7000 errata.
(md_parse_option): Supprt OPTION_FIX_PMC_RM7000 and
OPTION_NO_FIX_PMC_RM7000.
* doc/as.texinfo: Document new options.
* doc/c-mips.texi: Likewise.
gas/testsuite/
* gas/mips/fix-pmc-rm7000-1.d: New.
* gas/mips/fix-pmc-rm7000-1.s: New.
* gas/mips/fix-pmc-rm7000-2.d: New.
* gas/mips/fix-pmc-rm7000-2.s: New.
* gas/mips/micromips@fix-pmc-rm7000-1.d: New.
* gas/mips/micromips@fix-pmc-rm7000-2.d: New.
* gas/mips/mips.exp: Run new tests.
Alexey Makhalov [Tue, 19 Nov 2013 08:19:21 +0000 (08:19 +0000)]
PR gas/16109
* app.c (do_scrub_chars): Only insert a newline character if
end-of-file has been reached.
Yao Qi [Wed, 13 Nov 2013 12:57:40 +0000 (20:57 +0800)]
Remove 'whatever' in lib/mi-support.exp
Variable 'whatever' is not used at all. This patch is to remove it.
gdb/testsuite:
2013-11-19 Yao Qi <yao@codesourcery.com>
* lib/mi-support.exp (mi_child_regexp): Remove 'whatever'.
(mi_list_varobj_children_range): Likewise.
Yao Qi [Thu, 12 Sep 2013 13:21:16 +0000 (21:21 +0800)]
Fix typo
Hi,
"It's" should be "Its". This patch is to fix it. Committed as
obvious.
gdb:
2013-11-19 Yao Qi <yao@codesourcery.com>
* varobj.c (varobj_get_type): Fix typo.
Joel Brobecker [Mon, 18 Nov 2013 08:05:02 +0000 (12:05 +0400)]
Fix int() builtin with range type gdb.Value objects.
Consider the following variable:
type Small is range -128 .. 127;
SR : Small := 48;
Trying to get its value as an integer within Python code yields:
(gdb) python sr = gdb.parse_and_eval('sr')
(gdb) python print int(sr)
Traceback (most recent call last):
File "<string>", line 1, in <module>
gdb.error: Cannot convert value to int.
Error while executing Python code.
This is happening because our variable is a range type, and
py-value's is_intlike does not handle TYPE_CODE_RANGE. This
patch fixes this.
gdb/ChangeLog:
* python/py-value.c (is_intlike): Add TYPE_CODE_RANGE handling.
gdb/testsuite/ChangeLog:
* gdb.ada/py_range: New testcase.
Joel Brobecker [Tue, 19 Nov 2013 02:36:13 +0000 (06:36 +0400)]
gdb_ari.sh: Remove entries for dirent.h and stat.h.
The corresponding gdb_dirent.h and gdb_stat.h no longer exist.
We rely on gnulib for those, now.
gdb/ChangeLog:
* contrib/ari/gdb_ari.sh: Remove checks for "dirent.h" and
"stat.h".
Alan Modra [Mon, 18 Nov 2013 23:00:03 +0000 (09:30 +1030)]
daily update
H.J. Lu [Mon, 18 Nov 2013 22:37:23 +0000 (14:37 -0800)]
Update x86 gas tests for mingw
* gas/i386/avx512f-nondef.d: Updated for mingw.
* gas/i386/mpx-add-bnd-prefix.d: Likewise.
* gas/i386/x86-64-avx512f-nondef.d: Likewise.
* gas/i386/x86-64-mpx-add-bnd-prefix.d: Likewise.
* gas/i386/x86-64-mpx-addr32.d: Likewise.
* gas/i386/x86-64-opcode.d: Likewise.
* gas/i386/x86-64-sha.d: Likewise.
Tom Tromey [Wed, 6 Nov 2013 14:55:51 +0000 (07:55 -0700)]
remove gdb_stat.h
This patch is purely mechanical. It removes gdb_stat.h and changes
the code to use sys/stat.h.
2013-11-18 Tom Tromey <tromey@redhat.com>
* common/gdb_stat.h: Remove.
* ada-lang.c: Use sys/stat.h, not gdb_stat.h.
* common/filestuff.c: Use sys/stat.h, not gdb_stat.h.
* common/linux-osdata.c: Use sys/stat.h, not gdb_stat.h.
* corefile.c: Use sys/stat.h, not gdb_stat.h.
* ctf.c: Use sys/stat.h, not gdb_stat.h.
* darwin-nat.c: Use sys/stat.h, not gdb_stat.h.
* dbxread.c: Use sys/stat.h, not gdb_stat.h.
* dwarf2read.c: Use sys/stat.h, not gdb_stat.h.
* exec.c: Use sys/stat.h, not gdb_stat.h.
* gdbserver/linux-low.c: Use sys/stat.h, not gdb_stat.h.
* gdbserver/remote-utils.c: Use sys/stat.h, not gdb_stat.h.
* inf-child.c: Use sys/stat.h, not gdb_stat.h.
* jit.c: Use sys/stat.h, not gdb_stat.h.
* linux-nat.c: Use sys/stat.h, not gdb_stat.h.
* m68klinux-nat.c: Use sys/stat.h, not gdb_stat.h.
* main.c: Use sys/stat.h, not gdb_stat.h.
* mdebugread.c: Use sys/stat.h, not gdb_stat.h.
* mi/mi-cmd-env.c: Use sys/stat.h, not gdb_stat.h.
* nto-tdep.c: Use sys/stat.h, not gdb_stat.h.
* objfiles.c: Use sys/stat.h, not gdb_stat.h.
* procfs.c: Use sys/stat.h, not gdb_stat.h.
* remote-fileio.c: Use sys/stat.h, not gdb_stat.h.
* remote-mips.c: Use sys/stat.h, not gdb_stat.h.
* remote.c: Use sys/stat.h, not gdb_stat.h.
* rs6000-nat.c: Use sys/stat.h, not gdb_stat.h.
* sol-thread.c: Use sys/stat.h, not gdb_stat.h.
* solib-spu.c: Use sys/stat.h, not gdb_stat.h.
* source.c: Use sys/stat.h, not gdb_stat.h.
* symfile.c: Use sys/stat.h, not gdb_stat.h.
* symmisc.c: Use sys/stat.h, not gdb_stat.h.
* symtab.c: Use sys/stat.h, not gdb_stat.h.
* top.c: Use sys/stat.h, not gdb_stat.h.
* xcoffread.c: Use sys/stat.h, not gdb_stat.h.
Tom Tromey [Wed, 6 Nov 2013 14:49:44 +0000 (07:49 -0700)]
import gnulib sys/stat.h module
This imports the gnulib sys/stat.h module.
It doesn't make any other changes to gdb.
2013-11-18 Tom Tromey <tromey@redhat.com>
* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add
sys_stat.
* gnulib/aclocal.m4: Update.
* gnulib/config.in: Update.
* gnulib/configure: Update.
* gnulib/import/Makefile.am: Update.
* gnulib/import/Makefile.in: Update.
* gnulib/import/m4/gnulib-cache.m4: Update.
* gnulib/import/m4/gnulib-comp.m4: Update.
* gnulib/import/m4/sys_stat_h.m4: New.
* gnulib/import/m4/time_h.m4: New.
* gnulib/import/sys_stat.in.h: New.
* gnulib/import/time.in.h: New.
Tom Tromey [Wed, 6 Nov 2013 14:47:29 +0000 (07:47 -0700)]
sys/types.h cleanup
configure doesn't check for sys/types.h any more, but it still tries
to use the result of the check. This removes that use as well.
2013-11-18 Tom Tromey <tromey@redhat.com>
* configure: Rebuild.
* configure.ac: Remove check of HAVE_SYS_TYPES_H.
Tom Tromey [Wed, 6 Nov 2013 14:46:09 +0000 (07:46 -0700)]
don't check for unistd.h
We don't use the result of checking for unistd.h, so this removes the
check.
2013-11-18 Tom Tromey <tromey@redhat.com>
* configure: Rebuild.
* configure.ac: Don't check for unistd.h.
Tom Tromey [Wed, 6 Nov 2013 14:42:51 +0000 (07:42 -0700)]
stdlib.h is universal too
stdlib.h is universal as well, so there is no need to check for it.
2013-11-18 Tom Tromey <tromey@redhat.com>
* configure: Rebuild.
* configure.ac: Don't check for stdlib.h
* defs.h: Include stdlib.h unconditionally.
2013-11-18 Tom Tromey <tromey@redhat.com>
* configure: Rebuild.
* configure.ac: Don't check for stdlib.h.
* gdbreplay.c: Unconditionally include stdlib.h.
Tom Tromey [Wed, 6 Nov 2013 14:36:46 +0000 (07:36 -0700)]
don't check for stddef.h
gdb already unconditionally includes stddef.h in many places.
I think there is no reason to check for its existence.
Also, Zack Weinberg's header file survey agrees:
http://hacks.owlfolio.org/header-survey/
This patch removes the configure check and the inclusion guards.
It also removes a redundant inclusion that I noticed in defs.h.
2013-11-18 Tom Tromey <tromey@redhat.com>
* config.in: Rebuild.
* configure: Rebuild.
* configure.ac: Don't check for stddef.h.
* defs.h: Unconditionally include stddef.h. Remove duplicate
inclusion.
Tom Tromey [Wed, 6 Nov 2013 14:28:57 +0000 (07:28 -0700)]
remove gdb_dirent.h
This removes gdb_dirent.h and updates the code to use dirent.h
instead. It also removes the now-useless configure checks.
2013-11-18 Tom Tromey <tromey@redhat.com>
* common/common.m4 (GDB_AC_COMMON): Don't use AC_HEADER_DIRENT.
* common/gdb_dirent.h: Remove.
* common/filestuff.c: Use dirent.h.
* common/linux-osdata.c: Use dirent.h.
(NAMELEN): Define.
* config.in: Rebuild.
* configure: Rebuild.
* configure.ac: Don't use AC_HEADER_DIRENT.
* linux-fork.c: Use dirent.h
* linux-nat.c: Use dirent.h.
* nto-procfs.c: Use dirent.h.
* procfs.c: Use dirent.h.
2013-11-18 Tom Tromey <tromey@redhat.com>
* config.in: Rebuild.
* configure: Rebuild.
* configure.ac: Don't use AC_HEADER_DIRENT.
Tom Tromey [Wed, 6 Nov 2013 14:20:41 +0000 (07:20 -0700)]
import gnulib dirent module
This imports the gnulib dirent module. It doesn't make any other
changes to gdb.
2013-11-18 Tom Tromey <tromey@redhat.com>
* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add dirent.
* gnulib/aclocal.m4: Update.
* gnulib/config.in: Update.
* gnulib/configure: Update.
* gnulib/import/Makefile.am: Update.
* gnulib/import/Makefile.in: Update.
* gnulib/import/dirent.in.h: New.
* gnulib/import/m4/dirent_h.m4: New.
* gnulib/import/m4/gnulib-cache.m4: Update.
* gnulib/import/m4/gnulib-comp.m4: Update.
Tom Tromey [Wed, 6 Nov 2013 14:17:47 +0000 (07:17 -0700)]
don't check for string.h or strings.h
Now that we are using the gnulib string.h module, we don't need to
check for string.h or strings.h. This removes the last few checks
from the source and from the configure scripts.
2013-11-18 Tom Tromey <tromey@redhat.com>
* configure: Rebuild.
* common/common.m4 (GDB_AC_COMMON): Don't check for string.h or
strings.h.
2013-11-18 Tom Tromey <tromey@redhat.com>
* server.h: Don't check HAVE_STRING_H.
* gdbreplay.c: Don't check HAVE_STRING_H.
* configure: Rebuild.
Tom Tromey [Wed, 6 Nov 2013 14:14:23 +0000 (07:14 -0700)]
remove gdb_string.h
This removes gdb_string.h. This patch is purely mechanical. I
created it by running the two commands:
git rm common/gdb_string.h
perl -pi -e's/"gdb_string.h"/<string.h>/;' *.[chyl] */*.[chyl]
2013-11-18 Tom Tromey <tromey@redhat.com>
* common/gdb_string.h: Remove.
* aarch64-tdep.c: Use string.h, not gdb_string.h.
* ada-exp.y: Use string.h, not gdb_string.h.
* ada-lang.c: Use string.h, not gdb_string.h.
* ada-lex.l: Use string.h, not gdb_string.h.
* ada-typeprint.c: Use string.h, not gdb_string.h.
* ada-valprint.c: Use string.h, not gdb_string.h.
* aix-thread.c: Use string.h, not gdb_string.h.
* alpha-linux-tdep.c: Use string.h, not gdb_string.h.
* alpha-mdebug-tdep.c: Use string.h, not gdb_string.h.
* alpha-nat.c: Use string.h, not gdb_string.h.
* alpha-osf1-tdep.c: Use string.h, not gdb_string.h.
* alpha-tdep.c: Use string.h, not gdb_string.h.
* alphanbsd-tdep.c: Use string.h, not gdb_string.h.
* amd64-dicos-tdep.c: Use string.h, not gdb_string.h.
* amd64-linux-nat.c: Use string.h, not gdb_string.h.
* amd64-linux-tdep.c: Use string.h, not gdb_string.h.
* amd64-nat.c: Use string.h, not gdb_string.h.
* amd64-sol2-tdep.c: Use string.h, not gdb_string.h.
* amd64fbsd-tdep.c: Use string.h, not gdb_string.h.
* amd64obsd-tdep.c: Use string.h, not gdb_string.h.
* arch-utils.c: Use string.h, not gdb_string.h.
* arm-linux-nat.c: Use string.h, not gdb_string.h.
* arm-linux-tdep.c: Use string.h, not gdb_string.h.
* arm-tdep.c: Use string.h, not gdb_string.h.
* arm-wince-tdep.c: Use string.h, not gdb_string.h.
* armbsd-tdep.c: Use string.h, not gdb_string.h.
* armnbsd-nat.c: Use string.h, not gdb_string.h.
* armnbsd-tdep.c: Use string.h, not gdb_string.h.
* armobsd-tdep.c: Use string.h, not gdb_string.h.
* avr-tdep.c: Use string.h, not gdb_string.h.
* ax-gdb.c: Use string.h, not gdb_string.h.
* ax-general.c: Use string.h, not gdb_string.h.
* bcache.c: Use string.h, not gdb_string.h.
* bfin-tdep.c: Use string.h, not gdb_string.h.
* breakpoint.c: Use string.h, not gdb_string.h.
* build-id.c: Use string.h, not gdb_string.h.
* buildsym.c: Use string.h, not gdb_string.h.
* c-exp.y: Use string.h, not gdb_string.h.
* c-lang.c: Use string.h, not gdb_string.h.
* c-typeprint.c: Use string.h, not gdb_string.h.
* c-valprint.c: Use string.h, not gdb_string.h.
* charset.c: Use string.h, not gdb_string.h.
* cli-out.c: Use string.h, not gdb_string.h.
* cli/cli-cmds.c: Use string.h, not gdb_string.h.
* cli/cli-decode.c: Use string.h, not gdb_string.h.
* cli/cli-dump.c: Use string.h, not gdb_string.h.
* cli/cli-interp.c: Use string.h, not gdb_string.h.
* cli/cli-logging.c: Use string.h, not gdb_string.h.
* cli/cli-script.c: Use string.h, not gdb_string.h.
* cli/cli-setshow.c: Use string.h, not gdb_string.h.
* cli/cli-utils.c: Use string.h, not gdb_string.h.
* coffread.c: Use string.h, not gdb_string.h.
* common/common-utils.c: Use string.h, not gdb_string.h.
* common/filestuff.c: Use string.h, not gdb_string.h.
* common/linux-procfs.c: Use string.h, not gdb_string.h.
* common/linux-ptrace.c: Use string.h, not gdb_string.h.
* common/signals.c: Use string.h, not gdb_string.h.
* common/vec.h: Use string.h, not gdb_string.h.
* core-regset.c: Use string.h, not gdb_string.h.
* corefile.c: Use string.h, not gdb_string.h.
* corelow.c: Use string.h, not gdb_string.h.
* cp-abi.c: Use string.h, not gdb_string.h.
* cp-support.c: Use string.h, not gdb_string.h.
* cp-valprint.c: Use string.h, not gdb_string.h.
* cris-tdep.c: Use string.h, not gdb_string.h.
* d-lang.c: Use string.h, not gdb_string.h.
* dbxread.c: Use string.h, not gdb_string.h.
* dcache.c: Use string.h, not gdb_string.h.
* demangle.c: Use string.h, not gdb_string.h.
* dicos-tdep.c: Use string.h, not gdb_string.h.
* disasm.c: Use string.h, not gdb_string.h.
* doublest.c: Use string.h, not gdb_string.h.
* dsrec.c: Use string.h, not gdb_string.h.
* dummy-frame.c: Use string.h, not gdb_string.h.
* dwarf2-frame.c: Use string.h, not gdb_string.h.
* dwarf2loc.c: Use string.h, not gdb_string.h.
* dwarf2read.c: Use string.h, not gdb_string.h.
* elfread.c: Use string.h, not gdb_string.h.
* environ.c: Use string.h, not gdb_string.h.
* eval.c: Use string.h, not gdb_string.h.
* event-loop.c: Use string.h, not gdb_string.h.
* exceptions.c: Use string.h, not gdb_string.h.
* exec.c: Use string.h, not gdb_string.h.
* expprint.c: Use string.h, not gdb_string.h.
* f-exp.y: Use string.h, not gdb_string.h.
* f-lang.c: Use string.h, not gdb_string.h.
* f-typeprint.c: Use string.h, not gdb_string.h.
* f-valprint.c: Use string.h, not gdb_string.h.
* fbsd-nat.c: Use string.h, not gdb_string.h.
* findcmd.c: Use string.h, not gdb_string.h.
* findvar.c: Use string.h, not gdb_string.h.
* fork-child.c: Use string.h, not gdb_string.h.
* frame.c: Use string.h, not gdb_string.h.
* frv-linux-tdep.c: Use string.h, not gdb_string.h.
* frv-tdep.c: Use string.h, not gdb_string.h.
* gdb.c: Use string.h, not gdb_string.h.
* gdb_bfd.c: Use string.h, not gdb_string.h.
* gdbarch.c: Use string.h, not gdb_string.h.
* gdbtypes.c: Use string.h, not gdb_string.h.
* gnu-nat.c: Use string.h, not gdb_string.h.
* gnu-v2-abi.c: Use string.h, not gdb_string.h.
* gnu-v3-abi.c: Use string.h, not gdb_string.h.
* go-exp.y: Use string.h, not gdb_string.h.
* go-lang.c: Use string.h, not gdb_string.h.
* go32-nat.c: Use string.h, not gdb_string.h.
* hppa-hpux-tdep.c: Use string.h, not gdb_string.h.
* hppa-linux-nat.c: Use string.h, not gdb_string.h.
* hppanbsd-tdep.c: Use string.h, not gdb_string.h.
* hppaobsd-tdep.c: Use string.h, not gdb_string.h.
* i386-cygwin-tdep.c: Use string.h, not gdb_string.h.
* i386-dicos-tdep.c: Use string.h, not gdb_string.h.
* i386-linux-nat.c: Use string.h, not gdb_string.h.
* i386-linux-tdep.c: Use string.h, not gdb_string.h.
* i386-nto-tdep.c: Use string.h, not gdb_string.h.
* i386-sol2-tdep.c: Use string.h, not gdb_string.h.
* i386-tdep.c: Use string.h, not gdb_string.h.
* i386bsd-tdep.c: Use string.h, not gdb_string.h.
* i386gnu-nat.c: Use string.h, not gdb_string.h.
* i386nbsd-tdep.c: Use string.h, not gdb_string.h.
* i386obsd-tdep.c: Use string.h, not gdb_string.h.
* i387-tdep.c: Use string.h, not gdb_string.h.
* ia64-libunwind-tdep.c: Use string.h, not gdb_string.h.
* ia64-linux-nat.c: Use string.h, not gdb_string.h.
* inf-child.c: Use string.h, not gdb_string.h.
* inf-ptrace.c: Use string.h, not gdb_string.h.
* inf-ttrace.c: Use string.h, not gdb_string.h.
* infcall.c: Use string.h, not gdb_string.h.
* infcmd.c: Use string.h, not gdb_string.h.
* inflow.c: Use string.h, not gdb_string.h.
* infrun.c: Use string.h, not gdb_string.h.
* interps.c: Use string.h, not gdb_string.h.
* iq2000-tdep.c: Use string.h, not gdb_string.h.
* irix5-nat.c: Use string.h, not gdb_string.h.
* jv-exp.y: Use string.h, not gdb_string.h.
* jv-lang.c: Use string.h, not gdb_string.h.
* jv-typeprint.c: Use string.h, not gdb_string.h.
* jv-valprint.c: Use string.h, not gdb_string.h.
* language.c: Use string.h, not gdb_string.h.
* linux-fork.c: Use string.h, not gdb_string.h.
* linux-nat.c: Use string.h, not gdb_string.h.
* lm32-tdep.c: Use string.h, not gdb_string.h.
* m2-exp.y: Use string.h, not gdb_string.h.
* m2-typeprint.c: Use string.h, not gdb_string.h.
* m32c-tdep.c: Use string.h, not gdb_string.h.
* m32r-linux-nat.c: Use string.h, not gdb_string.h.
* m32r-linux-tdep.c: Use string.h, not gdb_string.h.
* m32r-rom.c: Use string.h, not gdb_string.h.
* m32r-tdep.c: Use string.h, not gdb_string.h.
* m68hc11-tdep.c: Use string.h, not gdb_string.h.
* m68k-tdep.c: Use string.h, not gdb_string.h.
* m68kbsd-tdep.c: Use string.h, not gdb_string.h.
* m68klinux-nat.c: Use string.h, not gdb_string.h.
* m68klinux-tdep.c: Use string.h, not gdb_string.h.
* m88k-tdep.c: Use string.h, not gdb_string.h.
* macrocmd.c: Use string.h, not gdb_string.h.
* main.c: Use string.h, not gdb_string.h.
* mdebugread.c: Use string.h, not gdb_string.h.
* mem-break.c: Use string.h, not gdb_string.h.
* memattr.c: Use string.h, not gdb_string.h.
* memory-map.c: Use string.h, not gdb_string.h.
* mep-tdep.c: Use string.h, not gdb_string.h.
* mi/mi-cmd-break.c: Use string.h, not gdb_string.h.
* mi/mi-cmd-disas.c: Use string.h, not gdb_string.h.
* mi/mi-cmd-env.c: Use string.h, not gdb_string.h.
* mi/mi-cmd-stack.c: Use string.h, not gdb_string.h.
* mi/mi-cmd-var.c: Use string.h, not gdb_string.h.
* mi/mi-cmds.c: Use string.h, not gdb_string.h.
* mi/mi-console.c: Use string.h, not gdb_string.h.
* mi/mi-getopt.c: Use string.h, not gdb_string.h.
* mi/mi-interp.c: Use string.h, not gdb_string.h.
* mi/mi-main.c: Use string.h, not gdb_string.h.
* mi/mi-parse.c: Use string.h, not gdb_string.h.
* microblaze-rom.c: Use string.h, not gdb_string.h.
* microblaze-tdep.c: Use string.h, not gdb_string.h.
* mingw-hdep.c: Use string.h, not gdb_string.h.
* minidebug.c: Use string.h, not gdb_string.h.
* minsyms.c: Use string.h, not gdb_string.h.
* mips-irix-tdep.c: Use string.h, not gdb_string.h.
* mips-linux-tdep.c: Use string.h, not gdb_string.h.
* mips-tdep.c: Use string.h, not gdb_string.h.
* mips64obsd-tdep.c: Use string.h, not gdb_string.h.
* mipsnbsd-tdep.c: Use string.h, not gdb_string.h.
* mipsread.c: Use string.h, not gdb_string.h.
* mn10300-linux-tdep.c: Use string.h, not gdb_string.h.
* mn10300-tdep.c: Use string.h, not gdb_string.h.
* monitor.c: Use string.h, not gdb_string.h.
* moxie-tdep.c: Use string.h, not gdb_string.h.
* mt-tdep.c: Use string.h, not gdb_string.h.
* nbsd-tdep.c: Use string.h, not gdb_string.h.
* nios2-linux-tdep.c: Use string.h, not gdb_string.h.
* nto-procfs.c: Use string.h, not gdb_string.h.
* nto-tdep.c: Use string.h, not gdb_string.h.
* objc-lang.c: Use string.h, not gdb_string.h.
* objfiles.c: Use string.h, not gdb_string.h.
* opencl-lang.c: Use string.h, not gdb_string.h.
* osabi.c: Use string.h, not gdb_string.h.
* osdata.c: Use string.h, not gdb_string.h.
* p-exp.y: Use string.h, not gdb_string.h.
* p-lang.c: Use string.h, not gdb_string.h.
* p-typeprint.c: Use string.h, not gdb_string.h.
* parse.c: Use string.h, not gdb_string.h.
* posix-hdep.c: Use string.h, not gdb_string.h.
* ppc-linux-nat.c: Use string.h, not gdb_string.h.
* ppc-sysv-tdep.c: Use string.h, not gdb_string.h.
* ppcfbsd-tdep.c: Use string.h, not gdb_string.h.
* ppcnbsd-tdep.c: Use string.h, not gdb_string.h.
* ppcobsd-tdep.c: Use string.h, not gdb_string.h.
* printcmd.c: Use string.h, not gdb_string.h.
* procfs.c: Use string.h, not gdb_string.h.
* prologue-value.c: Use string.h, not gdb_string.h.
* python/py-auto-load.c: Use string.h, not gdb_string.h.
* python/py-gdb-readline.c: Use string.h, not gdb_string.h.
* ravenscar-thread.c: Use string.h, not gdb_string.h.
* regcache.c: Use string.h, not gdb_string.h.
* registry.c: Use string.h, not gdb_string.h.
* remote-fileio.c: Use string.h, not gdb_string.h.
* remote-m32r-sdi.c: Use string.h, not gdb_string.h.
* remote-mips.c: Use string.h, not gdb_string.h.
* remote-sim.c: Use string.h, not gdb_string.h.
* remote.c: Use string.h, not gdb_string.h.
* reverse.c: Use string.h, not gdb_string.h.
* rs6000-aix-tdep.c: Use string.h, not gdb_string.h.
* ser-base.c: Use string.h, not gdb_string.h.
* ser-go32.c: Use string.h, not gdb_string.h.
* ser-mingw.c: Use string.h, not gdb_string.h.
* ser-pipe.c: Use string.h, not gdb_string.h.
* ser-tcp.c: Use string.h, not gdb_string.h.
* ser-unix.c: Use string.h, not gdb_string.h.
* serial.c: Use string.h, not gdb_string.h.
* sh-tdep.c: Use string.h, not gdb_string.h.
* sh64-tdep.c: Use string.h, not gdb_string.h.
* shnbsd-tdep.c: Use string.h, not gdb_string.h.
* skip.c: Use string.h, not gdb_string.h.
* sol-thread.c: Use string.h, not gdb_string.h.
* solib-dsbt.c: Use string.h, not gdb_string.h.
* solib-frv.c: Use string.h, not gdb_string.h.
* solib-osf.c: Use string.h, not gdb_string.h.
* solib-spu.c: Use string.h, not gdb_string.h.
* solib-target.c: Use string.h, not gdb_string.h.
* solib.c: Use string.h, not gdb_string.h.
* somread.c: Use string.h, not gdb_string.h.
* source.c: Use string.h, not gdb_string.h.
* sparc-nat.c: Use string.h, not gdb_string.h.
* sparc-sol2-tdep.c: Use string.h, not gdb_string.h.
* sparc-tdep.c: Use string.h, not gdb_string.h.
* sparc64-tdep.c: Use string.h, not gdb_string.h.
* sparc64fbsd-tdep.c: Use string.h, not gdb_string.h.
* sparc64nbsd-tdep.c: Use string.h, not gdb_string.h.
* sparcnbsd-tdep.c: Use string.h, not gdb_string.h.
* spu-linux-nat.c: Use string.h, not gdb_string.h.
* spu-multiarch.c: Use string.h, not gdb_string.h.
* spu-tdep.c: Use string.h, not gdb_string.h.
* stabsread.c: Use string.h, not gdb_string.h.
* stack.c: Use string.h, not gdb_string.h.
* std-regs.c: Use string.h, not gdb_string.h.
* symfile.c: Use string.h, not gdb_string.h.
* symmisc.c: Use string.h, not gdb_string.h.
* symtab.c: Use string.h, not gdb_string.h.
* target.c: Use string.h, not gdb_string.h.
* thread.c: Use string.h, not gdb_string.h.
* tilegx-linux-nat.c: Use string.h, not gdb_string.h.
* tilegx-tdep.c: Use string.h, not gdb_string.h.
* top.c: Use string.h, not gdb_string.h.
* tracepoint.c: Use string.h, not gdb_string.h.
* tui/tui-command.c: Use string.h, not gdb_string.h.
* tui/tui-data.c: Use string.h, not gdb_string.h.
* tui/tui-disasm.c: Use string.h, not gdb_string.h.
* tui/tui-file.c: Use string.h, not gdb_string.h.
* tui/tui-layout.c: Use string.h, not gdb_string.h.
* tui/tui-out.c: Use string.h, not gdb_string.h.
* tui/tui-regs.c: Use string.h, not gdb_string.h.
* tui/tui-source.c: Use string.h, not gdb_string.h.
* tui/tui-stack.c: Use string.h, not gdb_string.h.
* tui/tui-win.c: Use string.h, not gdb_string.h.
* tui/tui-windata.c: Use string.h, not gdb_string.h.
* tui/tui-winsource.c: Use string.h, not gdb_string.h.
* typeprint.c: Use string.h, not gdb_string.h.
* ui-file.c: Use string.h, not gdb_string.h.
* ui-out.c: Use string.h, not gdb_string.h.
* user-regs.c: Use string.h, not gdb_string.h.
* utils.c: Use string.h, not gdb_string.h.
* v850-tdep.c: Use string.h, not gdb_string.h.
* valarith.c: Use string.h, not gdb_string.h.
* valops.c: Use string.h, not gdb_string.h.
* valprint.c: Use string.h, not gdb_string.h.
* value.c: Use string.h, not gdb_string.h.
* varobj.c: Use string.h, not gdb_string.h.
* vax-tdep.c: Use string.h, not gdb_string.h.
* vaxnbsd-tdep.c: Use string.h, not gdb_string.h.
* vaxobsd-tdep.c: Use string.h, not gdb_string.h.
* windows-nat.c: Use string.h, not gdb_string.h.
* xcoffread.c: Use string.h, not gdb_string.h.
* xml-support.c: Use string.h, not gdb_string.h.
* xstormy16-tdep.c: Use string.h, not gdb_string.h.
* xtensa-linux-nat.c: Use string.h, not gdb_string.h.
Tom Tromey [Tue, 5 Nov 2013 21:53:48 +0000 (14:53 -0700)]
import strstr and strerror modules
This imports the gnulib strstr and strerror modules. It doesn't make
any other changes to gdb; I found it simpler to work with the branch
if I made the changes more indepdendent than I had previously.
2013-11-18 Tom Tromey <tromey@redhat.com>
* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add strerror
and strstr.
* gnulib/aclocal.m4: Update.
* gnulib/config.in: Update.
* gnulib/configure: Update.
* gnulib/import/Makefile.am: Update.
* gnulib/import/Makefile.in: Update.
* gnulib/import/errno.in.h: New.
* gnulib/import/intprops.h: New.
* gnulib/import/m4/errno_h.m4: New.
* gnulib/import/m4/gnulib-cache.m4: Update.
* gnulib/import/m4/gnulib-comp.m4: Update.
* gnulib/import/m4/strerror.m4: New.
* gnulib/import/m4/strstr.m4: New.
* gnulib/import/m4/sys_socket_h.m4: New.
* gnulib/import/strerror-override.c: New.
* gnulib/import/strerror-override.h: New.
* gnulib/import/strerror.c: New.
* gnulib/import/strstr.c: New.
Tom Tromey [Tue, 5 Nov 2013 21:49:14 +0000 (14:49 -0700)]
change how list of modules is computed
While adding modules I found that the current approach of listing all
the modules on one line made it harder to experiment -- any conflicts
from git were a pain to resolve.
This patch splits the list of modules so that there is one module per
line.
2013-11-18 Tom Tromey <tromey@redhat.com>
* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Split into
multiple lines.
Tom Tromey [Wed, 6 Nov 2013 15:48:03 +0000 (08:48 -0700)]
link gdbreplay against gnulib
Later patches in this series will make changes to gdb and gdbserver
configury, necessitating the use of gnulib in gdbreplay. This patch
introduces the dependency early, so that subsequent patches don't
break the build.
2013-11-18 Tom Tromey <tromey@redhat.com>
* Makefile.in (gdbreplay$(EXEEXT)): Depend on and link against
LIBGNU.
H.J. Lu [Mon, 18 Nov 2013 20:16:16 +0000 (12:16 -0800)]
Add a dummy "int bnd_prefix" argument
* config/tc-i386.c (lex_got): Add a dummy "int bnd_prefix"
argument.
H.J. Lu [Sun, 17 Nov 2013 18:30:28 +0000 (10:30 -0800)]
Add R_X86_64_PC32_BND/R_X86_64_PLT32_BND suppor to gold
elfcpp/
* x86_64.h (R_X86_64_PC32_BND): New.
(R_X86_64_PLT32_BND): Likewise.
gold/
* x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
R_X86_64_PC32 and R_X86_64_PLT32, respectively.
(Target_x86_64<size>::Scan::local): Likewise.
(Target_x86_64<size>::Scan::global): Likewise.
(Target_x86_64<size>::Relocate::relocate): Likewise.
(Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
Likewise.
(Target_x86_64<size>::Scan::check_non_pic(): Handle
R_X86_64_PC32_BND.
* testsuite/Makefile.am (check_PROGRAMS): Add
exception_x86_64_bnd_test.
(exception_x86_64_bnd_test_SOURCES): New macro.
(exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
(exception_x86_64_bnd_test_LDFLAGS): Likewise.
(exception_x86_64_bnd_test_LDADD): Likewise.
(exception_x86_64_bnd_1.o): New rule.
(exception_x86_64_bnd_2.o): Likewise.
* testsuite/Makefile.in: Regenerated.
Yufeng Zhang [Mon, 18 Nov 2013 17:23:33 +0000 (17:23 +0000)]
Add support for armv7ve to gas.
gas/
* config/tc-arm.c (arm_archs): New armv7ve architecture option.
(arm_cpus): Replace ARM_ARCH_V7A_IDIV_MP_SEC_VIRT with
ARM_ARCH_V7VE for cortex-a7, cortex-a12 and cortex-a15.
(cpu_arch_ver): Likewise.
* doc/c-arm.texi: Document armv7ve.
gas/testsuite/
* gas/arm/attr-march-armv7ve.d: New test case for armv7ve.
include/opcode/
* arm.h (ARM_AEXT_V7VE): New define.
(ARM_ARCH_V7VE): New define.
(ARM_ARCH_V7A_IDIV_MP_SEC_VIRT): Removed.
Chung-Lin Tang [Mon, 18 Nov 2013 14:57:28 +0000 (06:57 -0800)]
Separate emulations for nios2-elf and nios2-linux.
2013-11-18 Chung-Lin Tang <cltang@codesourcery.com>
* emulparams/nios2linux.sh: New emulation file.
* configure.tgt: Add nios2*-*-linux* emulation case.
* Makefile.am (enios2linux.c): New emulation entry.
* Makefile.in: Regenerate.
Jose E. Marchesi [Mon, 18 Nov 2013 12:37:05 +0000 (04:37 -0800)]
sparc: support single-stepping over longjmp calls.
2013-11-18 Jose E. Marchesi <jose.marchesi@oracle.com>
* sparc-tdep.c (sparc_is_annulled_branch_insn): New function.
* sparc-tdep.h: And its prototype.
* sparc64-linux-tdep.c (sparc64_linux_get_longjmp_target): New
function.
(sparc64_linux_init_abi): Register the get_longjmp_target hook.
Pedro Alves [Mon, 18 Nov 2013 12:05:11 +0000 (12:05 +0000)]
Simplify dwarf2-frame.c:read_addr_from_reg.
Since 'struct dwarf_expr_context_funcs::read_addr_from_reg' is now
only used for addresses, we can make it use unpack_pointer. And since
we now have 'struct dwarf_expr_context_funcs'::get_reg_value, there's
no need for speculation about using values here.
Tested on x86_64 Fedora 17.
gdb/
2013-11-18 Pedro Alves <palves@redhat.com>
* dwarf2-frame.c (read_addr_from_reg): Remove stale comment and
use unpack_pointer.
Joel Brobecker [Mon, 18 Nov 2013 11:56:54 +0000 (15:56 +0400)]
mi-language.exp: Check "langauge-option" in -list-features output.
gdb/testsuite/ChangeLog:
* mi-language.exp: Add "-list-features" test verifying that
its output contains "language-option".
Yufeng Zhang [Mon, 18 Nov 2013 11:34:43 +0000 (11:34 +0000)]
gas/
* config/tc-aarch64.c (parse_sys_reg): Support
S2_<op1>_<Cn>_<Cm>_<op2>.
gas/testsuite/
* gas/testsuite/sysreg.s: Add test.
* gas/testsuite/sysreg.d: Update.
Yufeng Zhang [Mon, 18 Nov 2013 11:21:35 +0000 (11:21 +0000)]
Revert "Add support for AArch64 trace unit registers."
This reverts commit
75468c93c14e9f14dd9020712538c5303a455876.
Joel Brobecker [Thu, 14 Nov 2013 10:57:01 +0000 (14:57 +0400)]
Add "language-option" to -list-features
Following the addition of the --language optiton to all GDB/MI
commands, I realized that there was no easy way for front-ends
to figure out whether this features is available or not. So I added
a "language-option" entry to -list-features.
gdb/ChangeLog:
* mi/mi-main.c (mi_cmd_list_features): Add "language-options"
to -list-features output.
gdb/doc/ChangeLog:
* gdb.texinfo (GDB/MI Miscellaneous Commands): Document the new
"language-option" entry in the output of the "-list-features"
command.
Alan Modra [Sun, 17 Nov 2013 23:00:01 +0000 (09:30 +1030)]
daily update
H.J. Lu [Tue, 12 Nov 2013 23:46:55 +0000 (15:46 -0800)]
Add R_X86_64_PC32_BND and R_X86_64_PLT32_BND
bfd/
* elf64-x86-64.c (x86_64_elf_howto_table): Add R_X86_64_PC32_BND
and R_X86_64_PLT32_BND.
(R_X86_64_standard): Replace R_X86_64_RELATIVE64 with
R_X86_64_PLT32_BND.
(IS_X86_64_PCREL_TYPE): Add R_X86_64_PLT32_BND.
(x86_64_reloc_map): Add BFD_RELOC_X86_64_PC32_BND and
BFD_RELOC_X86_64_PLT32_BND.
(elf_x86_64_check_relocs): Handle R_X86_64_PC32_BND and
R_X86_64_PLT32_BND.
(elf_x86_64_gc_sweep_hook): Likewise.
(elf_x86_64_relocate_section): Likewise.
* reloc.c (bfd_reloc_code_real): Add BFD_RELOC_X86_64_PC32_BND
and BFD_RELOC_X86_64_PLT32_BND.
* bfd-in2.h: Regenerated.
* libbfd.h: Likewise.
gas/
* config/tc-i386.c (reloc): Add an argument, bnd_prefix, to
indicate if instruction has the BND prefix. Return
BFD_RELOC_X86_64_PC32_BND instead of BFD_RELOC_32_PCREL if
bnd_prefix isn't zero.
(output_branch): Pass BFD_RELOC_X86_64_PC32_BND to frag_var
if needed.
(output_jump): Update reloc call.
(output_interseg_jump): Likewise.
(output_disp): Likewise.
(output_imm): Likewise.
(x86_cons_fix_new): Likewise.
(lex_got): Add an argument, bnd_prefix, to indicate if
instruction has the BND prefix. Use BFD_RELOC_X86_64_PLT32_BND
if needed.
(x86_cons): Update lex_got call.
(i386_immediate): Likewise.
(i386_displacement): Likewise.
(md_apply_fix): Handle BFD_RELOC_X86_64_PC32_BND and
BFD_RELOC_X86_64_PLT32_BND.
(tc_gen_reloc): Likewise.
* config/tc-i386-intel.c (i386_operator): Update lex_got call.
gas/testsuite/
* gas/i386/i386.exp: Run x86-64-mpx-branch-1 and
x86-64-mpx-branch-2 on 64-bit ELF targets.
* gas/i386/x86-64-mpx-branch-1.d: New file.
* gas/i386/x86-64-mpx-branch-1.s: Likewise.
* gas/i386/x86-64-mpx-branch-2.d: Likewise.
* gas/i386/x86-64-mpx-branch-2.s: Likewise.
include/elf/
* x86-64.h: Add R_X86_64_PC32_BND and R_X86_64_PLT32_BND.
ld/testsuite/
* ld-x86-64/mpx.exp: New file.
* ld-x86-64/mpx1.out: Likewise.
* ld-x86-64/mpx1a.c: Likewise.
* ld-x86-64/mpx1a.rd: Likewise.
* ld-x86-64/mpx1b.c: Likewise.
* ld-x86-64/mpx1c.c: Likewise.
* ld-x86-64/mpx1c.rd: Likewise.
Joel Brobecker [Sat, 16 Nov 2013 03:33:36 +0000 (07:33 +0400)]
Rename "read_reg" into "read_addr_from_reg" in struct dwarf_expr_context_funcs
This is to help make it slightly clearer how this method is expected
to extract data from the given register.
gdb/ChangeLog:
* dwarf2expr.h (struct dwarf_expr_context_funcs)
<read_addr_from_reg>: Renames "read_reg".
* dwarf2-frame.c (read_addr_from_reg): Renames "read_reg".
Adjust comment.
(dwarf2_frame_ctx_funcs, execute_stack_op, dwarf2_frame_cache):
Use read_addr_from_reg in place of read_reg.
* dwarf2expr.c (execute_stack_op): Use read_addr_from_reg
in place of read_reg.
* dwarf2loc.c (dwarf_expr_read_addr_from_reg): Renames
dwarf_expr_read_reg.
(dwarf_expr_ctx_funcs): Replace dwarf_expr_read_reg
with dwarf_expr_read_addr_from_reg.
(needs_frame_read_addr_from_reg): Renames needs_frame_read_reg.
(needs_frame_ctx_funcs): Replace needs_frame_read_reg with
needs_frame_read_addr_from_reg.
Alan Modra [Sat, 16 Nov 2013 23:00:03 +0000 (09:30 +1030)]
daily update
Joel Brobecker [Fri, 15 Nov 2013 17:46:34 +0000 (21:46 +0400)]
gdb.ada/info_exc.exp,mi_exc_info.exp: Use more unique exception name.
In the case where the GNAT runtime was built with full debugging info,
several of the exceptions defined there might have a name contain
the word "global". To make this less likely, this patch renames
the exception name, replacing "Global" by "Global_GDB". It still
keeps the exeption name relatively short, while it is unlikely that
the GNAT runtime has an exception whose name explicitly mentions GDB,
and even less likely that it contains "Global_GDB".
gdb/testsuite/ChangeLog:
* info_exc/const.ads (Aint_Global_GDB_E): Renames Aint_Global_E.
* info_exc/foo.adb: Adjust to new exception name.
* info_exc.exp: Adjust after exception renaming in const.ads.
Update "info exception global" test to test "info exceptions
global_gdb" instead.
* mi_exc_info/const.ads (Aint_Global_GDB_E): Renames Aint_Global_E.
* mi_exc_info/foo.adb (Adjust to new exception name.
* mi_exc_info.exp: Adjust after exception renaming in const.ads.
Update "-info-ada-exceptions global" test to test
"-info-ada-exceptions global_gdb" instead.
Yufeng Zhang [Fri, 15 Nov 2013 23:40:34 +0000 (23:40 +0000)]
gas/
* config/tc-aarch64.c (set_other_error): New function.
(parse_sys_reg): Add new parameter 'sys_reg' and if non-NULL set
the variable to which it points with 'o'.
(parse_operands): Update; check for write to read-only system
registers or read from write-only ones.
gas/testsuite/
* gas/aarch64/diagnostic.s: Add tests.
* gas/aarch64/diagnostic.l: Update.
* gas/aarch64/tracereg-illegal.d: New file.
* gas/aarch64/tracereg-illegal.l: Ditto.
* gas/aarch64/tracereg-illegal.s: Ditto.
* gas/aarch64/tracereg.d: Ditto.
* gas/aarch64/tracereg.s: Ditto.
include/opcode
* aarch64.h (aarch64_sys_reg_readonly_p): New declaration.
(aarch64_sys_reg_writeonly_p): Ditto.
opcodes/
* aarch64-opc.c (CPENT): New define.
(F_READONLY, F_WRITEONLY): Likewise.
(aarch64_sys_regs): Add trace unit registers.
(aarch64_sys_reg_readonly_p): New function.
(aarch64_sys_reg_writeonly_p): Ditto.