Alan Modra [Wed, 9 Jul 2014 10:34:40 +0000 (20:04 +0930)]
Account for trailing bytes read from bfd_bread
* cache.c (cache_bread_1): Don't return -1 when fread returns
a positive value.
Alan Modra [Wed, 9 Jul 2014 05:23:00 +0000 (14:53 +0930)]
tidy elf_merge_st_other
So that we munge isym->st_other once per symbol.
* elflink.c (elf_merge_st_other): Update comments. Simplify
visibility handling. Make isym const. Move code modifying
isym->st_other for --exclude-libs to..
(elf_link_add_object_symbols): ..here.
Alan Modra [Tue, 15 Jul 2014 00:00:48 +0000 (09:30 +0930)]
daily update
Edjunior Barbosa Machado [Mon, 14 Jul 2014 23:18:10 +0000 (20:18 -0300)]
2014-07-14 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
* ppc-linux-nat.c (ppc_linux_can_use_hw_breakpoint): Report no hardware
breakpoint support correctly.
Pedro Alves [Mon, 14 Jul 2014 19:39:53 +0000 (20:39 +0100)]
Add missing ChangeLog entry for
15cd413a
Put GDB's terminal settings into effect when paginating
gdb/
2014-07-14 Pedro Alves <palves@redhat.com>
* utils.c (prompt_for_continue): Call target_terminal_ours.
gdb/testsuite/
2014-07-14 Pedro Alves <palves@redhat.com>
* gdb.base/paginate-after-ctrl-c-running.c: New file.
* gdb.base/paginate-after-ctrl-c-running.exp: New file.
Pedro Alves [Mon, 14 Jul 2014 18:55:32 +0000 (19:55 +0100)]
Put GDB's terminal settings into effect when paginating
When the target is resumed in the foreground, we put the inferior's
terminal settings into effect, and remove stdin from the event loop.
When the target stops, we put GDB's terminal settings into effect
again, and re-register stdin in the event loop, ready for user input.
The former is done by target_terminal_inferior, and the latter by
target_terminal_ours.
There's an intermediate -- target_terminal_ours_for_output -- that is
called when printing output related to target events, and we don't
know yet whether we'll stop the program. That puts our terminal
settings into effect, enough to get proper results from our output,
but leaves input wired into the inferior.
If such output paginates, then we need the full target_terminal_ours
in order for the user to be able to provide input to answer the
pagination query.
The test in this commit hangs in async-capable targets without the fix
(as the user/test can't answer the pagination query). It doesn't hang
on sync targets because on those we don't unregister stdin from the
event loop while the target is running (because we block in
target_wait instead of in the event loop in that case).
gdb/
2014-07-14 Pedro Alves <palves@redhat.com>
* utils.c (prompt_for_continue): Call target_terminal_ours.
gdb/testsuite/
2014-07-14 Pedro Alves <palves@redhat.com>
* gdb.base/paginate-after-ctrl-c-running.c: New file.
* gdb.base/paginate-after-ctrl-c-running.exp: New file.
Pedro Alves [Mon, 14 Jul 2014 18:55:32 +0000 (19:55 +0100)]
Fix double prompt
If an error is thrown while handling a target event (within
fetch_inferior_event), and, the interpreter is not async (but the
target is), then GDB prints the prompt twice.
One way to see that in action is throw a QUIT while in a pagination
prompt issued from within fetch_inferior_event (or one of its
callees). E.g. from the test:
---Type <return> to continue, or q <return> to quit---
^CQuit
(gdb) (gdb) p 1
^^^^^^^^^^^
$1 = 1
(gdb)
The issue is that inferior_event_handler swallows errors and notifies
the observers (the interpreters) about the command error, even if the
interpreter is forced sync while we're handling a nested event loop
(for execute_command). The observers print a prompt, and then when we
get back to the top event loop, we print another (in
start_event_loop).
I see no reason the error should be swallowed here. Just cancel the
execution related bits and let the error propagate to the top level
(start_event_loop), which re-enables stdin and notifies observers.
gdb/
2014-07-14 Pedro Alves <palves@redhat.com>
* inf-loop.c (inferior_event_handler): Use TRY_CATCH instead of
catch_errors. Don't re-enable stdin or notify observers where,
and rethrow error.
(fetch_inferior_event_wrapper): Delete.
gdb/testsuite/
2014-07-14 Pedro Alves <palves@redhat.com>
* gdb.base/double-prompt-target-event-error.c: New file.
* gdb.base/double-prompt-target-event-error.exp: New file.
Pedro Alves [Mon, 14 Jul 2014 18:55:32 +0000 (19:55 +0100)]
Remove the target from the event loop while in secondary prompts
If a pagination prompt triggers while the target is running, and the
target exits before the user responded to the pagination query, this
happens:
Starting program: foo
---Type <return> to continue, or q <return> to quit---No unwaited-for children left.
Couldn't get registers: No such process.
Couldn't get registers: No such process.
Couldn't get registers: No such process.
(gdb) Couldn't get registers: No such process.
(gdb)
To reiterate, the user hasn't replied to the pagination prompt above.
A pagination query nests an event loop (in gdb_readline_wrapper). In
async mode, in addition to stdin and signal handlers, we'll have the
target also installed in the event loop still. So if the target
reports an event, that wakes up the nested event loop, which calls
into fetch_inferior_event etc. to handle the event which generates
further output, all while we should be waiting for pagination
confirmation...
(TBC, any target event that generates output ends up spuriously waking
up the pagination, though exits seem to be the worse kind.)
I've played with a couple different approaches to fixing this, while
at the same time trying to avoid being invasive. Both revolve around
not listening to target events while in a pagination prompt (doing
anything else I think would be a much bigger change).
The approach taken just removes the target from the event loop while
within gdb_readline_wrapper. The other approach used gdb_select
directly, with only input_fd installed, but that had the issue that it
didn't handle the async signal handlers, and turned out to be a bit
more code than the first version.
gdb/
2014-07-14 Pedro Alves <palves@redhat.com>
PR gdb/17072
* top.c: Include "inf-loop.h".
(struct gdb_readline_wrapper_cleanup) <target_is_async_orig>: New
field.
(gdb_readline_wrapper_cleanup): Make the target async again, if it
was async before.
(gdb_readline_wrapper): Store whether the target is async, and
make it sync.
gdb/testsuite/
2014-07-14 Pedro Alves <palves@redhat.com>
PR gdb/17072
* gdb.base/paginate-inferior-exit.c: New file.
* gdb.base/paginate-inferior-exit.exp: New file.
Pedro Alves [Mon, 14 Jul 2014 18:55:32 +0000 (19:55 +0100)]
Background execution + pagination aborts readline/gdb
If pagination occurs as result of output sent as response to a target
event while the target is executing in the background, subsequent
input aborts readline/gdb:
$ gdb program
...
(gdb) continue&
Continuing.
(gdb)
---Type <return> to continue, or q <return> to quit---
*return*
---Type <return> to continue, or q <return> to quit---
Breakpoint 2, after_sleep () at paginate-bg-execution.c:21
---Type <return> to continue, or q <return> to quit---
21 return; /* after sleep */
p 1
readline: readline_callback_read_char() called with no handler!
*abort/SIGABRT*
$
gdb_readline_wrapper_line removes the handler after a line is
processed. Usually, we'll end up re-displaying the prompt, and that
reinstalls the handler. But if the output is coming out of handling
a stop event, we don't re-display the prompt, and nothing restores the
handler. So the next input wakes up the event loop and calls into
readline, which aborts.
We should do better with the prompt handling while the target is
running (I think we should coordinate with readline, and
hide/redisplay it around output), but that's a more invasive change
better done post 7.8, so this patch is conservative and just
reinstalls the handler as soon as we're out of the readline line
callback.
gdb/
2014-07-14 Pedro Alves <palves@redhat.com>
PR gdb/17072
* top.c (gdb_readline_wrapper_line): Tweak comment.
(gdb_readline_wrapper_cleanup): If readline is enabled, reinstall
the input handler callback.
gdb/testsuite/
2014-07-14 Pedro Alves <palves@redhat.com>
PR gdb/17072
* gdb.base/paginate-bg-execution.c: New file.
* gdb.base/paginate-bg-execution.exp: New file.
Pedro Alves [Mon, 14 Jul 2014 18:55:31 +0000 (19:55 +0100)]
Canceling pagination caused by execution command from command line aborts readline/gdb
This fixes:
$ ./gdb program -ex "set height 2" -ex "start"
...
Reading symbols from /home/pedro/gdb/tests/threads...done.
---Type <return> to continue, or q <return> to quit---^CQuit << ctrl-c triggers a Quit
*type something*
readline: readline_callback_read_char() called with no handler!
Aborted
$
Usually, if an error propagates all the way to the top level, we'll
re-enable stdin, in case the command that was running was a
synchronous command. That's done in the event loop's actual loop
(event-loop.c:start_event_loop). However, if a foreground execution
command is run before the event loop starts and throws, nothing is
presently reenabling stdin, which leaves sync_execution set.
When we do start the event loop, because sync_execution is still
(mistakenly) set, display_gdb_prompt removes the readline input
callback, even though stdin is registered in the event loop. Any
input from here on results in readline aborting.
Such commands are run through catch_command_errors,
catch_command_errors_const, so add the tweak there.
gdb/
2014-07-14 Pedro Alves <palves@redhat.com>
PR gdb/17072
* main.c: Include event-top.h.
(handle_command_errors): New function.
(catch_command_errors, catch_command_errors_const): Use it.
gdb/testsuite/
2014-07-14 Pedro Alves <palves@redhat.com>
PR gdb/17072
* gdb.base/paginate-execution-startup.c: New file.
* gdb.base/paginate-execution-startup.exp: New file.
* lib/gdb.exp (pagination_prompt): New global.
(default_gdb_spawn): New procedure, factored out from
default_gdb_spawn.
(default_gdb_start): Adjust to call default_gdb_spawn.
(gdb_spawn): New procedure.
Pedro Alves [Mon, 14 Jul 2014 18:55:31 +0000 (19:55 +0100)]
testsuite: Introduce gdb_assert
Often we'll do something like:
if {$ok} {
fail "whatever"
} else {
pass "whatever"
}
This adds a helper procedure for that, and converts one random place
to use it, as an example.
2014-07-14 Pedro Alves <palves@redhat.com>
* lib/gdb.exp (gdb_assert): New procedure.
* gdb.trace/backtrace.exp (gdb_backtrace_tdp_4): Use it.
Pedro Alves [Mon, 14 Jul 2014 18:55:31 +0000 (19:55 +0100)]
Move catch_command_errors and catch_command_errors_const to main.c
We'll need to add error handling code to commands run before the event
loop starts (commands in .gdbinit, -ex commands, etc.). Turns out
those are run through catch_command_errors, and, catch_command_errors
is used nowhere else. Move it (and the _const variant) to main.c, so
that we can further specialize it freely.
gdb/
2014-07-14 Pedro Alves <palves@redhat.com>
* exceptions.c (catch_command_errors, catch_command_errors_const):
Moved to main.c.
* exceptions.h (catch_command_errors_ftype)
(catch_command_errors_const_ftype): Moved to main.c.
(catch_command_errors, catch_command_errors_const): Delete
declarations.
* main.c (catch_command_errors_ftype)
(catch_command_errors_const_ftype): Moved here from exceptions.h.
(catch_command_errors, catch_command_errors_const)): Moved here
from exceptions.c and make static.
Pedro Alves [Mon, 14 Jul 2014 18:55:30 +0000 (19:55 +0100)]
Eliminate exceptions.c:print_any_exception.
exception_print and exception_fprintf call print_flush, which does all the
same flushing and annotation things that print_any_exception does, and more.
gdb/
2014-07-14 Pedro Alves <palves@redhat.com>
* exceptions.c (print_any_exception): Delete.
(catch_exceptions_with_msg): Use exception_print instead of
print_any_exception.
(catch_errors): Use exception_fprintf instead of
print_any_exception.
(catch_command_errors, catch_command_errors_const): Use
exception_print instead of print_any_exception.
Pedro Alves [Mon, 14 Jul 2014 18:55:30 +0000 (19:55 +0100)]
Put the inferior's terminal settings in effect while running (fg) infcalls
The "call" and "print" commands presently always run synchronously, in
the foreground, but GDB currently forgets to put the inferior's
terminal settings into effect while running them, on async-capable
targets, resulting in:
(gdb) print func ()
hello world
Program received signal SIGTTOU, Stopped (tty output).
0x000000373bceb8d0 in __libc_tcdrain (fd=1) at ../sysdeps/unix/sysv/linux/tcdrain.c:29
29 return INLINE_SYSCALL (ioctl, 3, fd, TCSBRK, 1);
The program being debugged was signaled while in a function called from GDB.
GDB remains in the frame where the signal was received.
To change this behavior use "set unwindonsignal on".
Evaluation of the expression containing the function
(func) will be abandoned.
When the function is done executing, GDB will silently stop.
(gdb)
That's because target_terminal_inferior skips actually doing anything
if running in the background, and, nothing is setting sync_execution
while running infcalls:
void
target_terminal_inferior (void)
{
/* A background resume (``run&'') should leave GDB in control of the
terminal. Use target_can_async_p, not target_is_async_p, since at
this point the target is not async yet. However, if sync_execution
is not set, we know it will become async prior to resume. */
if (target_can_async_p () && !sync_execution)
return;
This would best be all cleaned up by making GDB not even call
target_terminal_inferior and try to pass the terminal to the inferior
if running in the background, but that's a more invasive fix that is
better done post-7.8.
This was originally caught by a patch later in this series that makes
catch_command_errors use exception_print instead of
print_any_exception. Note that print_flush calls serial_drain_output
while print_any_exception doesnt't have that bit. And,
gdb.gdb/python-selftest.exp does:
gdb_test "call catch_command_errors(execute_command, \"python print 5\", 0, RETURN_MASK_ALL)" \
"Python not initialized.* = 0"
which without this fix results in SIGTTOU...
gdb/
2014-07-14 Pedro Alves <palves@redhat.com>
* infcall.c (run_inferior_call): Set 'sync_execution' while
running the inferior call.
gdb/testsuite/
2014-07-14 Pedro Alves <palves@redhat.com>
* gdb.base/execution-termios.c: New file.
* gdb.base/execution-termios.exp: New file.
Pedro Alves [Mon, 14 Jul 2014 17:48:09 +0000 (18:48 +0100)]
Garbage collect value_contents_equal.
Hasn't been used in years.
gdb/
2014-07-14 Pedro Alves <palves@redhat.com>
* value.c (value_contents_equal): Delete function.
* value.h (value_contents_equal): Delete declaration.
Tom Tromey [Wed, 2 Jul 2014 21:53:31 +0000 (15:53 -0600)]
fix PR 17106
This fixes PR 17106, a regression in printing.
The bug is that resolve_dynamic_type follows struct members and
references, but doesn't consider the possibility of infinite
recursion.
This patch fixes the problem by limiting reference following to the
topmost layer of calls -- that is, reference-typed struct members are
never considered as being VLAs.
Built and regtested on x86-64 Fedora 20.
New test case included.
2014-07-14 Tom Tromey <tromey@redhat.com>
PR exp/17106:
* gdbtypes.c (is_dynamic_type_internal): New function, from
is_dynamic_type.
(is_dynamic_type): Rewrite.
(resolve_dynamic_union): Use resolve_dynamic_type_internal.
(resolve_dynamic_struct): Likewise.
(resolve_dynamic_type_internal): New function, from
resolve_dynamic_type.
(resolve_dynamic_type): Rewrite.
2014-07-14 Tom Tromey <tromey@redhat.com>
* gdb.cp/vla-cxx.cc: New file.
* gdb.cp/vla-cxx.exp: New file.
Tom Tromey [Tue, 1 Jul 2014 17:43:00 +0000 (11:43 -0600)]
fix record "run" regression
This fixes the record "run" regression pointed out by Marc Khouzam:
https://sourceware.org/ml/gdb/2014-06/msg00096.html
The bug is that target_require_runnable must agree with the handling
of the "run" target, but currently it is out of sync. This patch
fixes the problem by changing target_require_runnable to also ignore
the record_stratum.
Built and regtested on x86-64 Fedora 20.
New test case included.
2014-07-14 Tom Tromey <tromey@redhat.com>
* target.c (target_require_runnable): Also check record_stratum.
Update comment.
2014-07-14 Tom Tromey <tromey@redhat.com>
* gdb.reverse/rerun-prec.c: New file.
* gdb.reverse/rerun-prec.exp: New file.
Alan Modra [Mon, 14 Jul 2014 00:00:59 +0000 (09:30 +0930)]
daily update
Alan Modra [Sun, 13 Jul 2014 00:00:58 +0000 (09:30 +0930)]
daily update
Alan Modra [Sat, 12 Jul 2014 07:35:35 +0000 (17:05 +0930)]
Don't force "set" symbols local for PE
gas/
* read.c (assign_symbol): Don't force "set" symbols local for PE.
gas/testsuite/
* gas/pe/set.s, * gas/pe/set.d: New test.
* gas/pe/pe.exp: Run it.
Maciej W. Rozycki [Sat, 12 Jul 2014 00:22:25 +0000 (01:22 +0100)]
gdb/testsuite: Add a way to send multiple init commands
Right now we provide a board info entry, `gdb_init_command', that allows
one to send a single command to GDB before the program to be debugged is
started. This is useful e.g. for slow remote targets to change the
default "remotetimeout" setting. Occasionally I found a need to send
multiple commands instead, however this cannot be achieved with
`gdb_init_command'.
This change therefore extends the mechanism by adding a TCL list of GDB
commands to send, via a board info entry called `gdb_init_commands'.
There is no limit as to the number of commands put there. The old
`gdb_init_command' mechanism remains supported for compatibility with
existing people's environments.
* lib/gdb-utils.exp: New file.
* lib/gdb.exp (gdb_run_cmd): Call gdb_init_commands, replacing
inline `gdb_init_command' processing.
(gdb_start_cmd): Likewise.
* lib/mi-support.exp (mi_run_cmd): Likewise.
* README: Document `gdb_init_command' and `gdb_init_commands'.
Alan Modra [Sat, 12 Jul 2014 00:01:38 +0000 (09:31 +0930)]
daily update
Jan Kratochvil [Fri, 11 Jul 2014 15:26:42 +0000 (17:26 +0200)]
Fix false argv0-symlink.exp FAIL running under a very long directory name
Starting program: /home/jkratoch/redhat/gdb-test-fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff/gdb/testsuite/gdb.base/argv0-symlink-filelink ^M
[...]
(gdb) print argv[0]^M
$1 = 0x7fffffffda39 "/home/jkratoch/redhat/gdb-test-", 'f' <repeats 169 times>...^M
(gdb) FAIL: gdb.base/argv0-symlink.exp: kept file symbolic link name
after "set print repeats 10000":
print argv[0]^M
$1 = 0x7fffffffda39 "/home/jkratoch/redhat/gdb-test-fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"...^M
(gdb) FAIL: gdb.base/argv0-symlink.exp: kept file symbolic link name
after "set print elements 10000":
print argv[0]^M
$1 = 0x7fffffffda39 "/home/jkratoch/redhat/gdb-test-fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff/gdb/testsuite/gdb.base/argv0-symlink-filelink"^M
(gdb) PASS: gdb.base/argv0-symlink.exp: kept file symbolic link name
gdb/testsuite/
2014-07-11 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix false FAIL running under a very long directory name.
* gdb.base/argv0-symlink.exp: Add "set print repeats 10000"
and "set print elements 10000". Twice.
Maks Naumov [Fri, 11 Jul 2014 14:25:30 +0000 (23:55 +0930)]
Fix typo in _bfd_elf_strtab_add
PR 17141
* elf.c (_bfd_elf_strtab_add): Check strtab name for failure.
Yao Qi [Wed, 2 Jul 2014 07:16:26 +0000 (15:16 +0800)]
Stop prologue analysis when past the epilogue
We see a fail in gdb.trace/entry-values.exp on armv4t thumb,
bt^M
#0 0x000086fc in foo (i=0, i@entry=<optimized out>, j=2, j@entry=<optimized out>)^M
#1 0x00000002 in ?? ()^M
Backtrace stopped: previous frame identical to this frame (corrupt stack?)^M
(gdb) FAIL: gdb.trace/entry-values.exp: bt (1) (pattern 1)
The fail is caused by incorrect prologue analysis, which can be illustrated by
setting a breakpoint on function foo,
(gdb) disassemble foo
Dump of assembler code for function foo:
0x000086e8 <+0>: push {r7, lr}
0x000086ea <+2>: sub sp, #8
0x000086ec <+4>: add r7, sp, #0
0x000086ee <+6>: str r0, [r7, #4]
0x000086f0 <+8>: str r1, [r7, #0]
0x000086f2 <+10>: movs r3, #0
0x000086f4 <+12>: adds r0, r3, #0
0x000086f6 <+14>: mov sp, r7
0x000086f8 <+16>: add sp, #8
0x000086fa <+18>: pop {r7}
0x000086fc <+20>: pop {r1}
0x000086fe <+22>: bx r1
End of assembler dump.
(gdb) b foo
Breakpoint 1 at 0x86fc
As we can see, GDB analyzes the prologue and skip the prologue to the last
instruction but one. The breakpoint is set within the epilogue, and GDB
skips too many instruction for prologue. This patch teaches GDB to stop
prologue analysis when goes into the epilogue. With this patch applied,
GDB is able to unwind correctly,
(gdb) bt
#0 0x000086f6 in foo (i=0, i@entry=2, j=2, j@entry=3)
#1 0x00008718 in bar (i=<optimized out>)
#2 0x00008758 in main ()
gdb:
2014-07-11 Yao Qi <yao@codesourcery.com>
* arm-tdep.c (thumb_analyze_prologue): Break the loop if
thumb_instruction_restores_sp return true.
Yao Qi [Wed, 2 Jul 2014 06:45:12 +0000 (14:45 +0800)]
Match instruction adjusts SP in thumb
This is a refactor patch, that moves matching instructions adjusting
SP into a new function, thumb_instruction_restores_sp. The second
call to thumb_instruction_restores_sp in thumb_in_function_epilogue_p
is a little different from the original. The original code matches
'POP <registers> without PC', but thumb_in_function_epilogue_p matches
'POP <registers> (with and without PC)'. However, GDB found one
instruction about return and is scanning the previous instruction,
which should be an instruction about return too, so the code change
doesn't affect the functionality.
gdb:
2014-07-11 Yao Qi <yao@codesourcery.com>
* arm-tdep.c (thumb_instruction_restores_sp): New function.
(thumb_in_function_epilogue_p): Call
thumb_instruction_restores_sp.
Yao Qi [Tue, 1 Jul 2014 07:36:44 +0000 (15:36 +0800)]
Restrict matching add/sub sp, #imm
Currently, GDB matches both add/sub sp, #imm in prologue and epilogue,
which is not very precise. On the instruction level, the immediate
number in both instruction can't be negative, so 'sub sp, #imm' only
appears in prologue while 'add sp, #imm' only appears in epilogue.
Note that on assembly level, we can write 'add sp, -8', but gas will
translate to 'sub sp, 8' instruction.
This patch is to only match 'sub sp, #imm' in prologue and match
'add sp, #immm' in epilogue. It paves the way for the following
patch.
gdb:
2014-07-11 Yao Qi <yao@codesourcery.com>
* arm-tdep.c (thumb_analyze_prologue): Don't match instruction
'add sp, #imm'.
(thumb_in_function_epilogue_p): Don't match 'sub sp, #imm'.
Gary Benson [Fri, 27 Jun 2014 08:52:29 +0000 (09:52 +0100)]
Tidy #include lists
This commit tidies up the #include lists in {i386,amd64}-linux-nat.c,
removing headers that are no longer required and reordering some lines
so that both files roughly match. Additionally, an unused definition
was removed from the middle of the #include list in i386-linux-nat.c.
gdb/
2014-07-11 Gary Benson <gbenson@redhat.com>
* amd64-linux-nat.c (gdbcore.h): Remove include.
(regset.h): Likewise.
(nat/linux-btrace.h): Likewise.
(btrace.h): Likewise.
(gdb_assert.h): Likewise.
(string.h): Likewise.
(sys/uio.h): Likewise.
(sys/debugreg.h): Likewise.
(sys/syscall.h): Likewise.
(sys/procfs.h): Likewise.
(sys/user.h): Likewise.
(asm/ptrace.h): Likewise.
(i386-nat.h): Likewise.
* i386-linux-nat.c (i386-nat.h): Likewise.
(regset.h): Likewise.
(target.h): Likewise.
(linux-nat.h): Likewise.
(nat/linux-btrace.h): Likewise.
(btrace.h): Likewise.
(gdb_assert.h): Likewise.
(string.h): Likewise.
(sys/uio.h): Likewise.
(sys/user.h): Likewise.
(sys/procfs.h): Likewise.
(sys/reg.h): Likewise.
(sys/debugreg.h): Likewise.
(ORIG_EAX): Remove definition.
Gary Benson [Thu, 10 Jul 2014 14:43:56 +0000 (15:43 +0100)]
Move duplicated code into new files
This commit moves the duplicated code in {i386,amd64}-linux-nat.c
into the new files x86-linux-nat.[ch]. Additionally, a new
file i386-linux-nat.h was required to expose a value required
by the 32-bit code in x86-linux-nat.c.
gdb/
2014-07-11 Gary Benson <gbenson@redhat.com>
* i386-linux-nat.h: New file.
* x86-linux-nat.h: Likewise.
* x86-linux-nat.c: Likewise.
* Makefile.in (HFILES_NO_SRCDIR): Add the above new headers.
* config/i386/linux.mh (NATDEPFILES): Add x86-linux-nat.o.
* config/i386/linux64.mh (NATDEPFILES): Likewise.
* amd64-linux-nat.c (x86-linux-nat.h): New include.
(PTRACE_GETREGSET): Now in x86-linux-nat.h.
(PTRACE_SETREGSET): Likewise.
(arch_lwp_info): Now in x86-linux-nat.c.
(have_ptrace_getregset): Now in x86-linux-nat.h.
(x86_linux_dr_get): Now in x86-linux-nat.c.
(x86_linux_dr_set): Likewise.
(x86_linux_dr_get_addr): Likewise.
(x86_linux_dr_get_control): Likewise.
(x86_linux_dr_get_status): Likewise.
(update_debug_registers_callback): Likewise.
(x86_linux_dr_set_control): Likewise.
(x86_linux_dr_set_addr): Likewise.
(x86_linux_prepare_to_resume): Likewise.
(x86_linux_new_thread): Likewise.
(x86_linux_new_fork): Likewise.
(x86_linux_get_thread_area): Likewise.
(super_post_startup_inferior): Likewise.
(x86_linux_child_post_startup_inferior): Likewise.
(AMD64_LINUX_USER64_CS): Likewise.
(AMD64_LINUX_X32_DS): Likewise.
(x86_linux_read_description): Likewise.
(x86_linux_enable_btrace): Likewise.
(x86_linux_disable_btrace): Likewise.
(x86_linux_teardown_btrace): Likewise.
(x86_linux_read_btrace): Likewise.
(x86_linux_create_target): Likewise.
(x86_linux_add_target): Likewise.
* i386-linux-nat.c (x86-linux-nat.h): New include.
(PTRACE_GETREGSET): Now in x86-linux-nat.h.
(PTRACE_SETREGSET): Likewise.
(arch_lwp_info): Now in x86-linux-nat.c.
(have_ptrace_getregset): Now in x86-linux-nat.h.
(x86_linux_dr_get): Now in x86-linux-nat.c.
(x86_linux_dr_set): Likewise.
(x86_linux_dr_get_addr): Likewise.
(x86_linux_dr_get_control): Likewise.
(x86_linux_dr_get_status): Likewise.
(update_debug_registers_callback): Likewise.
(x86_linux_dr_set_control): Likewise.
(x86_linux_dr_set_addr): Likewise.
(x86_linux_prepare_to_resume): Likewise.
(x86_linux_new_thread): Likewise.
(x86_linux_new_fork): Likewise.
(x86_linux_get_thread_area): Likewise.
(super_post_startup_inferior): Likewise.
(x86_linux_child_post_startup_inferior): Likewise.
(AMD64_LINUX_USER64_CS): Likewise.
(AMD64_LINUX_X32_DS): Likewise.
(x86_linux_read_description): Likewise.
(x86_linux_enable_btrace): Likewise.
(x86_linux_disable_btrace): Likewise.
(x86_linux_teardown_btrace): Likewise.
(x86_linux_read_btrace): Likewise.
(x86_linux_create_target): Likewise.
(x86_linux_add_target): Likewise.
Gary Benson [Wed, 25 Jun 2014 13:57:42 +0000 (14:57 +0100)]
Comment and whitespace changes
This commit merges the comments and whitespace in the common
parts of i386-linux-nat.c and amd64-linux-nat.c.
gdb/
2014-07-11 Gary Benson <gbenson@redhat.com>
* amd64-linux-nat.c: Comment and whitespace changes.
* i386-linux-nat.c: Comment and whitespace changes.
Gary Benson [Tue, 24 Jun 2014 12:43:30 +0000 (13:43 +0100)]
Pull out common parts of _initialize_{i386,amd64}_linux_nat
This commit adds two new helpers, x86_linux_create_target and
x86_linux_add_target, to hold the parts of _initialize_i386_linux_nat
and _initialize_amd64_linux_nat which are common.
gdb/
2014-07-11 Gary Benson <gbenson@redhat.com>
* amd64-linux-nat.c (x86_linux_create_target): New function.
(x86_linux_add_target): Likewise.
(_initialize_amd64_linux_nat): Delegate to the above new functions.
* i386-linux-nat.c (x86_linux_create_target): New function.
(x86_linux_add_target): Likewise.
(_initialize_i386_linux_nat): Delegate to the above new functions.
Gary Benson [Wed, 25 Jun 2014 10:49:55 +0000 (11:49 +0100)]
Merge ps_get_thread_area
This commit adds a new helper, x86_linux_get_thread_area, to
hold the common parts of the ps_get_thread_area functions in
i386-linux-nat.c and amd64-linux-nat.c.
gdb/
2014-07-11 Gary Benson <gbenson@redhat.com>
* amd64-linux-nat.c (x86_linux_get_thread_area): New function.
(ps_get_thread_area): Delegate to the above in 32-bit mode.
* i386-linux-nat.c (x86_linux_get_thread_area): New function.
(ps_get_thread_area): Delegate to the above.
Gary Benson [Fri, 27 Jun 2014 08:29:06 +0000 (09:29 +0100)]
Merge {i386,amd64}_linux_read_description
This commit merges i386_ and amd64_linux_read_description, renaming
both to x86_linux_read_description.
gdb/
2014-07-11 Gary Benson <gbenson@redhat.com>
* amd64-linux-nat.c (amd64_linux_read_description): Renamed to
x86_linux_read_description. All uses updated. amd64-specific
code conditionalized. Conditionalized i386-specific code added.
Redundant cast removed.
* i386-linux-nat.c (i386_linux_read_description): Renamed to
x86_linux_read_description. All uses updated. i386-specific
code conditionalized. Conditionalized amd64-specific code added.
One sizeof replaced with the actual type it is describing.
Gary Benson [Tue, 24 Jun 2014 09:07:12 +0000 (10:07 +0100)]
Rename identical functions
amd64-linux-nat.c and i386-linux-nat.c contain a number of functions
which are identical but for prefix on their names. This commit
renames all such functions to have the prefix x86_ instead of the
prefixes amd64_ or i386_ and updates all uses of those functions.
The now-identical x86_ functions will be pulled out to a separate
shared file in a later commit.
gdb/
2014-07-11 Gary Benson <gbenson@redhat.com>
* amd64-linux-nat.c (amd64_linux_dr_get): Renamed to
x86_linux_dr_get. All uses updated.
(amd64_linux_dr_set): Renamed to
x86_linux_dr_set. All uses updated.
(amd64_linux_dr_get_addr): Renamed to
x86_linux_dr_get_addr. All uses updated.
(amd64_linux_dr_get_control): Renamed to
x86_linux_dr_get_control. All uses updated.
(amd64_linux_dr_get_status): Renamed to
x86_linux_dr_get_status. All uses updated.
(amd64_linux_dr_set_control): Renamed to
x86_linux_dr_set_control. All uses updated.
(amd64_linux_dr_set_addr): Renamed to
x86_linux_dr_set_addr. All uses updated.
(amd64_linux_prepare_to_resume): Renamed to
x86_linux_prepare_to_resume. All uses updated.
(amd64_linux_new_thread): Renamed to
x86_linux_new_thread. All uses updated.
(amd64_linux_new_fork): Renamed to
x86_linux_new_fork. All uses updated.
(amd64_linux_child_post_startup_inferior): Renamed to
x86_linux_child_post_startup_inferior. All uses updated.
(amd64_linux_enable_btrace): Renamed to
x86_linux_enable_btrace. All uses updated.
(amd64_linux_disable_btrace): Renamed to
x86_linux_disable_btrace. All uses updated.
(amd64_linux_teardown_btrace): Renamed to
x86_linux_teardown_btrace. All uses updated.
(amd64_linux_read_btrace): Renamed to
x86_linux_read_btrace. All uses updated.
* i386-linux-nat.c (i386_linux_dr_get): Renamed to
x86_linux_dr_get. All uses updated.
(i386_linux_dr_set): Renamed to
x86_linux_dr_set. All uses updated.
(i386_linux_dr_get_addr): Renamed to
x86_linux_dr_get_addr. All uses updated.
(i386_linux_dr_get_control): Renamed to
x86_linux_dr_get_control. All uses updated.
(i386_linux_dr_get_status): Renamed to
x86_linux_dr_get_status. All uses updated.
(i386_linux_dr_set_control): Renamed to
x86_linux_dr_set_control. All uses updated.
(i386_linux_dr_set_addr): Renamed to
x86_linux_dr_set_addr. All uses updated.
(i386_linux_prepare_to_resume): Renamed to
x86_linux_prepare_to_resume. All uses updated.
(i386_linux_new_thread): Renamed to
x86_linux_new_thread. All uses updated.
(i386_linux_new_fork): Renamed to
x86_linux_new_fork. All uses updated.
(i386_linux_child_post_startup_inferior): Renamed to
x86_linux_child_post_startup_inferior. All uses updated.
(i386_linux_enable_btrace): Renamed to
x86_linux_enable_btrace. All uses updated.
(i386_linux_disable_btrace): Renamed to
x86_linux_disable_btrace. All uses updated.
(i386_linux_teardown_btrace): Renamed to
x86_linux_teardown_btrace. All uses updated.
(i386_linux_read_btrace): Renamed to
x86_linux_read_btrace. All uses updated.
Yao Qi [Fri, 11 Jul 2014 10:46:33 +0000 (18:46 +0800)]
Don't print symbol on address 0x0
We see the following fails on arm-none-eabi target,
print (void*)v_signed_char^M
$190 = (void *) 0x0 <_ftext>^M
(gdb) FAIL: gdb.base/exprs.exp: print (void*)v_signed_char (print
(void*)v_signed_char)
GDB behaves correctly but the test assumes there is no symbol on
address 0x0. This patch is set print symbol off, so that tests below
can match the address only.
gdb/testsuite:
2014-07-11 Yao Qi <yao@codesourcery.com>
* gdb.base/exprs.exp: "set print symbol off".
Pedro Alves [Fri, 11 Jul 2014 10:07:13 +0000 (11:07 +0100)]
GDBserver crashes when killing a multi-thread process
Here's an example, with the new test:
gdbserver :9999 gdb.threads/kill
gdb gdb.threads/kill
(gdb) b 52
Breakpoint 1 at 0x4007f4: file kill.c, line 52.
Continuing.
Breakpoint 1, main () at kill.c:52
52 return 0; /* set break here */
(gdb) k
Kill the program being debugged? (y or n) y
gdbserver :9999 gdb.threads/kill
Process gdb.base/watch_thread_num created; pid = 9719
Listening on port 1234
Remote debugging from host 127.0.0.1
Killing all inferiors
Segmentation fault (core dumped)
Backtrace:
(gdb) bt
#0 0x00000000004068a0 in find_inferior (list=0x66b060 <all_threads>, func=0x427637 <kill_one_lwp_callback>, arg=0x7fffffffd3fc) at src/gdb/gdbserver/inferiors.c:199
#1 0x00000000004277b6 in linux_kill (pid=15708) at src/gdb/gdbserver/linux-low.c:966
#2 0x000000000041354d in kill_inferior (pid=15708) at src/gdb/gdbserver/target.c:163
#3 0x00000000004107e9 in kill_inferior_callback (entry=0x6704f0) at src/gdb/gdbserver/server.c:2934
#4 0x0000000000406522 in for_each_inferior (list=0x66b050 <all_processes>, action=0x4107a6 <kill_inferior_callback>) at src/gdb/gdbserver/inferiors.c:57
#5 0x0000000000412377 in process_serial_event () at src/gdb/gdbserver/server.c:3767
#6 0x000000000041267c in handle_serial_event (err=0, client_data=0x0) at src/gdb/gdbserver/server.c:3880
#7 0x00000000004189ff in handle_file_event (event_file_desc=4) at src/gdb/gdbserver/event-loop.c:434
#8 0x00000000004181c6 in process_event () at src/gdb/gdbserver/event-loop.c:189
#9 0x0000000000418f45 in start_event_loop () at src/gdb/gdbserver/event-loop.c:552
#10 0x0000000000411272 in main (argc=3, argv=0x7fffffffd8d8) at src/gdb/gdbserver/server.c:3283
The problem is that linux_wait_for_event deletes lwps that have exited
(even those not passed in as lwps of interest), while the lwp/thread
list is being walked on with find_inferior. find_inferior can handle
the current iterated inferior being deleted, but not others.
When killing lwps, we don't really care about any of the pending
status handling of linux_wait_for_event. We can just waitpid the lwps
directly, which is also what GDB does (see
linux-nat.c:kill_wait_callback). This way the lwps are not deleted
while we're walking the list. They'll be deleted by linux_mourn
afterwards.
This crash triggers several times when running the testsuite against
GDBserver with the native-gdbserver board (target remote), but as GDB
can't distinguish between GDBserver crashing and "kill" being
sucessful, as in both cases the connection is closed (the 'k' packet
doesn't require a reply), and the inferior is gone, that results in no
FAIL.
The patch adds a generic test that catches the issue with
extended-remote mode (and works fine with native testing too). Here's
how it fails with the native-extended-gdbserver board without the fix:
(gdb) info threads
Id Target Id Frame
6 Thread 15367.15374 0x000000373bcbc98d in nanosleep () at ../sysdeps/unix/syscall-template.S:81
5 Thread 15367.15373 0x000000373bcbc98d in nanosleep () at ../sysdeps/unix/syscall-template.S:81
4 Thread 15367.15372 0x000000373bcbc98d in nanosleep () at ../sysdeps/unix/syscall-template.S:81
3 Thread 15367.15371 0x000000373bcbc98d in nanosleep () at ../sysdeps/unix/syscall-template.S:81
2 Thread 15367.15370 0x000000373bcbc98d in nanosleep () at ../sysdeps/unix/syscall-template.S:81
* 1 Thread 15367.15367 main () at .../gdb.threads/kill.c:52
(gdb) kill
Kill the program being debugged? (y or n) y
Remote connection closed
^^^^^^^^^^^^^^^^^^^^^^^^
(gdb) FAIL: gdb.threads/kill.exp: kill
Extended remote should remain connected after the kill.
gdb/gdbserver/
2014-07-11 Pedro Alves <palves@redhat.com>
* linux-low.c (kill_wait_lwp): New function, based on
kill_one_lwp_callback, but use my_waitpid directly.
(kill_one_lwp_callback, linux_kill): Use it.
gdb/testsuite/
2014-07-11 Pedro Alves <palves@redhat.com>
* gdb.threads/kill.c: New file.
* gdb.threads/kill.exp: New file.
Adrian Sendroiu [Fri, 11 Jul 2014 09:51:48 +0000 (10:51 +0100)]
remote: call remote_check_symbols after attaching
When debugging a remote bare-metal target with "target
extended-remote" + attach, GDB won't send a qSymbol packet to initiate
symbol lookup. This happens because all the previous places in which
GDB might have done this are guarded by conditions that don't hold in
the said scenario: there are no shared libraries, no vsyscall page and
the binary file didn't change in the time passed between the "file"
and the "attach" commands.
To solve this problem remote_check_symbols is called in the
target_post_attach hook.
gdb/
2014-07-11 Adrian Sendroiu <adrian.sendroiu@freescale.com>
* remote.c (extended_remote_post_attach): New function.
(init_extended_remote_ops): Install it as to_post_attach method.
Alan Modra [Fri, 11 Jul 2014 00:01:14 +0000 (09:31 +0930)]
daily update
Doug Evans [Thu, 10 Jul 2014 19:30:05 +0000 (12:30 -0700)]
Revert gdbthread.h (any_running): Declare.
Not properly marked as 1/2.
This reverts commit
1a76d598884a052dacd8feb49f1999e1a0d537f1.
Doug Evans [Thu, 10 Jul 2014 18:15:32 +0000 (11:15 -0700)]
* gdbthread.h (any_running): Declare.
* thread.c (any_running): New function.
Max Filippov [Wed, 9 Jul 2014 21:47:33 +0000 (01:47 +0400)]
Fix xtensa ld segfault when linking linux modules
is_inconsistent_linkonce_section makes an assumption that section name
that starts with ".gnu.linkonce.prop." has one more dot in its suffix.
However gas generates such section name by insertion of "prop." right
after ".gnu.linkonce." part of the name of the original section. So, for
section named ".gnu.linkonce.this_module" corresponding property section
name does not satisfy the assumption. Such section names are common in
linux modules. This bug was exposed by the patch "
a35d5e8 Fix alignment
for the first section frag on xtensa", that makes gas produce property
section for each section that has ".align" directive in it.
Use suffix that immediately follows ".gnu.linkonce.prop." when there are
no more dots following it.
2014-07-10 Max Filippov <jcmvbkbc@gmail.com>
ld/
* emultempl/xtensaelf.em (is_inconsistent_linkonce_section):
correctly handle missing dot in section name after
".gnu.linkonce.prop.".
Will Newton [Tue, 8 Jul 2014 09:23:27 +0000 (10:23 +0100)]
gas/ARM: Fix testsuite failure for arm-elf
At some point the arm-elf output became the same as arm-eabi. Remove
the special handling of arm-elf.
gas/testsuite/ChangeLog:
2014-07-10 Will Newton <will.newton@linaro.org>
* gas/elf/elf.exp: Remove special handling of arm-elf for
section2 test.
* gas/elf/section2.e-armeabi: Rename to...
* gas/elf/section2.e-arm: ...here.
* gas/elf/section2.e-armelf: Remove file.
Will Newton [Mon, 7 Jul 2014 16:33:34 +0000 (17:33 +0100)]
Fix tests when configured for arm-linux and arm-elf
With this change all gas and most ld tests pass when configured for
arm-linux. It doesn't look like these configurations have been
tested in a long time but this attempts to stem the bit-rot slightly.
gas/testsuite/ChangeLog:
2014-07-10 Will Newton <will.newton@linaro.org>
* gas/arm/bl-local-2.d: Only enable the test on EABI and
NaCl configurations.
* gas/arm/bl-local-v4t.d: Likewise.
* gas/arm/blx-local.d: Likewise.
* gas/arm/branch-reloc.d: Likewise.
ld/testsuite/ChangeLog:
2014-07-10 Will Newton <will.newton@linaro.org>
* ld-arm/arm-elf.exp (armelftests_nonacl): Move Cortex-A8 fix
tests, IFUNC tests and other EABI requiring tests to...
(armeabitests_nonacl): ...here.
* ld-arm/arm-app-abs32.d: Loosen regex for architecture type
to allow test to pass on configurations without an attributes
section.
* ld-arm/arm-app.d: Likewise.
* ld-arm/arm-lib-plt32.d: Likewise.
* ld-arm/arm-lib.d: Likewise.
* ld-arm/arm-static-app.d: Likewise.
* ld-arm/armthumb-lib.d: Likewise.
* ld-arm/cortex-a8-far.d: Likewise.
* ld-arm/farcall-mixed-app.d: Likewise.
* ld-arm/farcall-mixed-lib-v4t.d: Likewise.
* ld-arm/farcall-mixed-lib.d: Likewise.
* ld-arm/mixed-app-v5.d: Likewise.
* ld-arm/mixed-app.d: Likewise.
* ld-arm/mixed-lib.d: Likewise.
* ld-arm/tls-app.d: Likewise.
* ld-arm/tls-descrelax-be32.d: Likewise.
* ld-arm/tls-descrelax.d: Likewise.
* ld-arm/tls-descseq.d: Likewise.
* ld-arm/tls-gdesc-got.d: Likewise.
* ld-arm/tls-gdesc.d: Likewise.
* ld-arm/tls-gdierelax.d: Likewise.
* ld-arm/tls-gdierelax2.d: Likewise.
* ld-arm/tls-gdlerelax.d: Likewise.
* ld-arm/tls-lib-loc.d: Likewise.
* ld-arm/tls-lib.d: Likewise.
* ld-arm/tls-thumb1.d: Likewise.
Will Newton [Mon, 7 Jul 2014 16:26:48 +0000 (17:26 +0100)]
binutils/testsuite: Disable strip-10 test on ARM non-EABI
Non-EABI ARM targets set OSABI to ARM regardless of whether or not GNU
features have been used which causes this test to fail.
binutils/testsuite/ChangeLog:
2014-07-10 Will Newton <will.newton@linaro.org>
* binutils-all/objcopy.exp: Disable the strip-10 test on
non-EABI ARM configurations.
Will Newton [Mon, 7 Jul 2014 16:30:58 +0000 (17:30 +0100)]
ld/testsuite: Disable non-PIC shared library tests on ARM
ARM doesn't support non-PIC shared libraries so don't run those
tests.
ld/testsuite/ChangeLog:
2014-07-10 Will Newton <will.newton@linaro.org>
* ld-elfvers/vers.exp: Set pic to yes for ARM targets.
Yao Qi [Mon, 30 Jun 2014 03:47:51 +0000 (11:47 +0800)]
Tweak gdb.trace/tfile.c for thumb mode
We see the fail below happens on thumb related multi-libs
(-mthumb -march={armv4t,armv7-a}),
target tfile tfile-basic.tf ^M
warning: Uploaded tracepoint 1 has no source location, using raw address^M
warning: Breakpoint address adjusted from 0x00008959 to 0x00008958.^M
Tracepoint 3 at 0x8958: file /scratch/yqi/arm-none-linux-gnueabi/src/gdb-trunk/gdb/testsuite/gdb.trace/tfile.c, line 91.^M
Created tracepoint 3 for target's tracepoint 1 at 0x8959.^M
warning: Breakpoint address adjusted from 0x00008959 to 0x00008958.^M
warning: Breakpoint address adjusted from 0x00008959 to 0x00008958.^M
warning: Breakpoint address adjusted from 0x00008959 to 0x00008958.^M
(gdb) FAIL: gdb.trace/tfile.exp: complete-command 'target tfile'
The address of write_basic_trace_file is two-bytes aligned,
(gdb) p write_basic_trace_file
$1 = {void (void)} 0x8958 <write_basic_trace_file>
but the ld sets the LSB of every reference to the function address
(indicating the address is in thumb mode), so "&write_basic_trace_file"
in the program becomes 0x8959, which is saved in the trace file. That
is why the warnnings are emitted.
This patch is to clear the LSB of the function address written to trace
file in thumb and thumb2 mode. This patch fixes the fail above.
gdb/testsuite:
2014-07-10 Yao Qi <yao@codesourcery.com>
* gdb.trace/tfile.c (write_basic_trace_file)
[__thumb__||__thumb2__]: Clear the Thumb bit of the function
address written to trace file.
Alan Modra [Thu, 10 Jul 2014 00:01:24 +0000 (09:31 +0930)]
daily update
Pedro Alves [Wed, 9 Jul 2014 14:59:02 +0000 (15:59 +0100)]
Fix "attach" command vs user input race
On async targets, a synchronous attach is done like this:
#1 - target_attach is called (PTRACE_ATTACH is issued)
#2 - a continuation is installed
#3 - we go back to the event loop
#4 - target reports stop (SIGSTOP), event loop wakes up, and
attach continuation is called
#5 - among other things, the continuation calls
target_terminal_inferior, which removes stdin from the event
loop
Note that in #3, GDB is still processing user input. If the user is
fast enough, e.g., with something like:
echo -e "attach PID\nset xxx=1" | gdb
... then the "set" command is processed before the attach completes.
We get worse behavior even, if input is a tty and therefore
readline/editing is enabled, with e.g.,:
(gdb) attach PID\nset xxx=1
we then crash readline/gdb, with:
Attaching to program: attach-wait-input, process 14537
readline: readline_callback_read_char() called with no handler!
Aborted
$
Fix this by calling target_terminal_inferior before #3 above.
The test covers both scenarios by running with editing/readline forced
to both on and off.
gdb/
2014-07-09 Pedro Alves <palves@redhat.com>
* infcmd.c (attach_command_post_wait): Don't call
target_terminal_inferior here.
(attach_command): Call it here instead.
gdb/testsuite/
2014-07-09 Pedro Alves <palves@redhat.com>
* gdb.base/attach-wait-input.exp: New file.
* gdb.base/attach-wait-input.c: New file.
Andrew Burgess [Mon, 7 Jul 2014 18:22:36 +0000 (19:22 +0100)]
Improve MI -var-info-path-expression for nested struct/union case.
https://sourceware.org/ml/gdb-patches/2014-05/msg00383.html
The MI command -var-info-path-expression currently does not handle
non-anonymous structs / unions nested within other structs / unions,
it will skip parts of the expression. Consider this example:
## START EXAMPLE ##
$ cat ex.c
#include <string.h>
int
main ()
{
struct s1
{
int a;
};
struct ss
{
struct s1 x;
};
struct ss an_ss;
memset (&an_ss, 0, sizeof (an_ss));
return 0;
}
$ gcc -g -o ex.x ex.c
$ gdb ex.x
(gdb) break 18
Breakpoint 1 at 0x80483ba: file ex.c, line 18.
(gdb) run
Starting program: /home/user/ex.x
Breakpoint 1, main () at ex.c:18
18 return 0;
(gdb) interpreter-exec mi "-var-create an_ss * an_ss"
(gdb) interpreter-exec mi "-var-list-children an_ss"
^done,numchild="1",children=[child={name="an_ss.x",exp="x",numchild="1",type="struct s1",thread-id="1"}],has_more="0"
(gdb) interpreter-exec mi "-var-list-children an_ss.x"
^done,numchild="1",children=[child={name="an_ss.x.a",exp="a",numchild="0",type="int",thread-id="1"}],has_more="0"
(gdb) interpreter-exec mi "-var-list-children an_ss.x.a"
^done,numchild="0",has_more="0"
(gdb) interpreter-exec mi "-var-info-path-expression an_ss.x.a"
^done,path_expr="(an_ss).a"
(gdb) print (an_ss).a
There is no member named a.
## END EXAMPLE ##
Notice that the path expression returned is wrong, and as a result
the print command fails.
This patch adds a new method to the varobj_ops structure called
is_path_expr_parent, to allow language specific control over finding
the parent varobj, the current logic becomes the C/C++ version and is
extended to handle the nested cases. No other language currently uses
this code, so all other languages just get a default method.
With this patch, the above example now finishes like this:
## START EXAMPLE ##
$ gdb ex.x
(gdb) break 18
Breakpoint 1 at 0x80483ba: file ex.c, line 18.
(gdb) run
Starting program: /home/user/ex.x
Breakpoint 1, main () at ex.c:18
18 return 0;
(gdb) interpreter-exec mi "-var-list-children an_ss"
^done,numchild="1",children=[child={name="an_ss.x",exp="x",numchild="1",type="struct s1",thread-id="1"}],has_more="0"
(gdb) interpreter-exec mi "-var-list-children an_ss.x"
^done,numchild="1",children=[child={name="an_ss.x.a",exp="a",numchild="0",type="int",thread-id="1"}],has_more="0"
(gdb) interpreter-exec mi "-var-list-children an_ss.x.a"
^done,numchild="0",has_more="0"
(gdb) interpreter-exec mi "-var-info-path-expression an_ss.x.a"
^done,path_expr="((an_ss).x).a"
(gdb) print ((an_ss).x).a
$1 = 0
## END EXAMPLE ##
Notice that the path expression is now correct, and the print is a
success.
gdb/ChangeLog:
* ada-varobj.c (ada_varobj_ops): Fill in is_path_expr_parent
field.
* c-varobj.c (c_is_path_expr_parent): New function, moved core
from varobj.c, with additional checks.
(c_varobj_ops): Fill in is_path_expr_parent field.
(cplus_varobj_ops): Fill in is_path_expr_parent field.
* jv-varobj.c (java_varobj_ops): Fill in is_path_expr_parent
field.
* varobj.c (is_path_expr_parent): Call is_path_expr_parent varobj
ops method.
(varobj_default_is_path_expr_parent): New function.
* varobj.h (lang_varobj_ops): Add is_path_expr_parent field.
(varobj_default_is_path_expr_parent): Declare new function.
gdb/testsuite/ChangeLog:
* gdb.mi/var-cmd.c (do_nested_struct_union_tests): New function
setting up test structures.
(main): Call new test function.
* gdb.mi/mi2-var-child.exp: Create additional breakpoint in new
test function, continue into test function and walk test
structures.
Cary Coutant [Wed, 9 Jul 2014 05:34:27 +0000 (22:34 -0700)]
Fix --defsym to copy symbol attributes.
Alan Modra committed a patch to Gnu ld to fix a problem encountered on
PPC where the --defsym option wasn't copying the st_other bits to the
newly-defined symbol.
https://sourceware.org/ml/binutils/2014-07/msg00094.html
Gold has the same problem, and additionally wasn't copying the symbol type.
This patch fixes both problems, by copying the symbol type, visibility, and
the remaining st_other bits to the new symbol for --defsym=sym1=sym2
assignments.
gold/
* expression.cc (struct Expression::Expression_eval_info): Add
new fields type_pointer, vis_pointer, and nonvis_pointer.
(Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
nonvis_pointer parameters. Adjust all calls.
(Symbol_expression::value): Update type, visibility, and nonvis bits
in caller.
* script.cc (Symbol_assignment::sized_finalize): Update type,
visibility, and remaining st_other bits for new symbol.
* script.h: (Expression::eval_maybe_dot): Add type_pointer,
vis_pointer, and nonvis_pointer parameters.
* symtab.h (Symbol::set_type): New method.
* testsuite/Makefile.am (defsym_test): New test.
* testsuite/Makefile.in: Regenerate.
* testsuite/defsym_test.c: New file.
* testsuite/defsym_test.sh: New file.
Alan Modra [Wed, 9 Jul 2014 00:01:22 +0000 (09:31 +0930)]
daily update
Cary Coutant [Mon, 7 Jul 2014 17:14:45 +0000 (10:14 -0700)]
Fix internal error with LTO on ARM.
This prevents the target-specific do_read_symbols methods from being called
twice when do_layout_deferred_sections needs to layout an .eh_frame section.
gold/
PR gold/15639
* dynobj.h (Sized_dynobj::base_read_symbols): New method.
* dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
(Sized_dynobj::base_read_symbols): ...new method.
* object.h (Sized_relobj_file::base_read_symbols): New method.
* object.cc (Sized_relobj_file::do_read_symbols): Move body to...
(Sized_relobj_file::base_read_symbols): ...new method.
* arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
* mips.cc: (Mips_relobj::do_read_symbols): Likewise.
* powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
Denis Chertykov [Tue, 8 Jul 2014 16:15:18 +0000 (20:15 +0400)]
* scripttempl/avr.sc: Remove KEEP for .data and
force .bss VMA to end of .data VMA.
Nick Clifton [Tue, 8 Jul 2014 15:20:48 +0000 (16:20 +0100)]
This fixes PR 17110 which shows that the SH section relocation code can be called
for input BFDs as well as output BFDs.
PR ld/17110
* elf32-sh.c (sh_elf_osec_to_segment): Do not look for output
segments in input bfds.
Ilya Tocar [Tue, 8 Jul 2014 09:45:43 +0000 (13:45 +0400)]
Fix disasm of vmovsd/vmovss with different length values.
gas/testsuite
* gas/i386/evex-lig256-intel.d: Updated.
* gas/i386/evex-lig256.d: Updated.
* gas/i386/evex-lig512-intel.d: Updated.
* gas/i386/evex-lig512-intel.d: Updated.
* gas/i386/x86-64-evex-lig256-intel.d: Updated.
* gas/i386/x86-64-evex-lig256.d: Updated.
* gas/i386/x86-64-evex-lig512-intel.d: Updated.
* gas/i386/x86-64-evex-lig512-intel.d: Updated.
opcodes
* i386-dis-evex.h (EVEX_W_0F10_P_1_M_1): Fix vmovss.
(EVEX_W_0F10_P_3_M_1): Fix vmovsd.
Will Newton [Thu, 26 Jun 2014 14:23:31 +0000 (15:23 +0100)]
ld/ARM: Increase maximum page size to 64kB
Increase the maximum page size to 64kB and align the TEXT_START_ADDR
to a 64kB boundary. This brings AArch32 in line with AArch64 and
improves compatability under certain conditions.
bfd/ChangeLog:
2014-07-08 Will Newton <will.newton@linaro.org>
* elf32-arm.c (ELF_MAXPAGESIZE): Increase the default
value to 64kB and remove custom setting for NaCl.
ld/ChangeLog:
2014-07-08 Will Newton <will.newton@linaro.org>
* emulparams/armelf_linux.sh (TEXT_START_ADDR): Increase
alignment to 64kB boundary.
ld/testsuite/ChangeLog:
2014-07-08 Will Newton <will.newton@linaro.org>
* ld-arm/arm-lib.ld: Increase MAXPAGESIZE value to
match bfd.
* ld-arm/cortex-a8-fix-bl-rel-plt.d: Update offsets to
take into account increased segment alignment.
* ld-arm/ifunc-gdesc.r: Likewise.
* ld-arm/tls-lib.d: Likewise.
Jiong Wang [Tue, 8 Jul 2014 11:14:56 +0000 (12:14 +0100)]
Fix PR 16722 by adding support for 8-byte vector constants.
* config/tc-arm.c (literal_pool): New field "alignment".
(find_or_make_literal_pool): Initialize "alignment" to 2.
(s_ltorg): Align the pool using value of "alignment"
(parse_big_immediate): New parameter "in_exp". Return
parsed expression if "in_exp" is not null.
(parse_address_main): Invoke "parse_big_immediate" for
constant parameter.
(add_to_lit_pool): Add one parameter 'nbytes'.
Split 8 byte entry into two 4 byte entry.
Add padding to align 8 byte entry to 8 byte boundary.
(encode_arm_cp_address): Generate literal pool entry if possible.
(move_or_literal_pool): Generate entry for vldr case.
(enum lit_type): New enum type.
(do_ldst): Use new enum type.
(do_ldstv4): Likewise.
(do_t_ldst): Likewise.
(neon_write_immbits): Support Thumb-2 mode.
* gas/arm/ldconst.s: Add test cases for symbol literal.
* gas/arm/ldconst.d: Likewise.
* gas/arm/vldconst.s: Add test cases for vldr.
* gas/arm/thumb2_vpool.s: Likewise.
* gas/arm/vldconst.d: New pattern for little-endian.
* gas/arm/thumb2_vpool.d: Likewise.
* gas/arm/vldconst_be.d: New pattern for big-endian.
* gas/arm/thumb2_vpool_be.d: Likewise.
Alan Modra [Tue, 8 Jul 2014 05:54:06 +0000 (15:24 +0930)]
Copy st_other for linker script symbol assignments
This fixes a problem seen on powerpc64le ELFv2 when creating a
function symbol alias with ld --defsym. st_other needs to be copied
from the source symbol to the alias in order to set up the local entry
offset for the alias. I decided to make this change in the generic
ELF code rather than in elf64-ppc.c since it looks like other targets
that use st_other bits might benefit too.
bfd/
* elflink.c (_bfd_elf_copy_link_hash_symbol_type): Copy st_other
bits from source to dest.
* linker.c (_bfd_generic_copy_link_hash_symbol_type): Update comment.
* targets.c (struct bfd_target <_bfd_copy_link_hash_symbol_type>):
Likewise.
* bfd-in2.h: Regenerate.
ld/testsuite/
* ld-powerpc/defsym.s, * ld-powerpc/defsym.d: New test.
* ld-powerpc/powerpc.exp: Run it.
Yao Qi [Tue, 1 Jul 2014 11:30:54 +0000 (19:30 +0800)]
Fix gdb.trace/entry-values.exp for thumb mode
We see some fails in gdb.trace/entry-values.exp in thumb mode
(-mthumb -march={armv4t,armv7-a}).
In thumb mode, the lsb of references to 'foo' and 'bar' in the assembly
(produced by dwarf assember) is set, so the generated debug
information is incorrect.
This patch copies the approach used by
[PATCH 4/4] Fix dw2-ifort-parameter.exp on PPC64
https://sourceware.org/ml/gdb-patches/2014-03/msg00202.html
to introduce new labels 'foo_start' and 'bar_start' which are about
the correct function address (without lsb set). This patch fixes
these fails we've seen.
gdb/testsuite:
2014-07-08 Yao Qi <yao@codesourcery.com>
* gdb.trace/entry-values.c: Define labels 'foo_start' and
'bar_start' at the beginning of functions 'foo' and 'bar'
respectively.
* gdb.trace/entry-values.exp: Use 'foo_start' and 'bar_start'
instead of 'foo' and 'bar'.
Jiong Wang [Tue, 8 Jul 2014 08:29:06 +0000 (09:29 +0100)]
Enable elf_backend_rela_normal for AArch64
If we are generating non-relocatable object and --emit-relocs specified,
aarch64 ld is actually generating wrong addend for rela entry when
relocate against local symbol.
for example, for simple testcase
foo.c
===
const char * const a = "foo";
const char *
foo ()
{
return a;
}
bar.c
===
const char * const b = "bar";
const char * bar ()
{
return b;
}
aarch64-none-linux-gnu-ld --emit-relocs -o x.o foo.o bar.o
aarch64-none-linux-gnu-readelf -r x.o
... R_AARCH64_ADR_PRE
0000000000400018 .rodata + 0
... R_AARCH64_ADD_ABS
0000000000400018 .rodata + 0
... R_AARCH64_ADR_PRE
0000000000400018 .rodata + 0
... R_AARCH64_ADD_ABS
0000000000400018 .rodata + 0
while it should be:
... R_AARCH64_ADR_PRE
0000000000400018 .rodata + 0
... R_AARCH64_ADD_ABS
0000000000400018 .rodata + 0
... R_AARCH64_ADR_PRE
0000000000400018 .rodata + 10
... R_AARCH64_ADD_ABS
0000000000400018 .rodata + 10
bfd generic code could actually handle this properly, but only when
elf_backend_rela_normal set to '1'.
this patch enable this and remove those target specific hack.
bfd/
* elfnn-aarch64.c (elf_backend_rela_normal): Set to 1.
(elfNN_aarch64_relocate_section): Remove duplicated addend adjustment
when info->relocatable be true.
ld/testsuite/
* ld-aarch64/emit-relocs-local-addend-bar.s: * New source file.
* ld-aarch64/emit-relocs-local-addend-foo.s: * Likewise.
* ld-aarch64/emit-relocs-local-addend.d: * New testcase.
* ld-aarch64/local-addend-r.d: Likewise.
Markus Metzger [Mon, 30 Jun 2014 09:47:30 +0000 (11:47 +0200)]
reverse-finish: turn internal error into normal error
The reverse-finish command results in an internal error if it cannot determine
the current function.
(gdb) c
Continuing.
Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) reverse-finish
Run back to call of #0 0x0000000000000000 in ?? ()
gdb/infcmd.c:1576: internal-error: Finish: couldn't find function.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) y
This is not an internal error case since the command may be used in scenarios
where there is no function at the current PC, e.g. after calling through a bad
function pointer.
Turn this into a normal error.
gdb/
* infcmd.c (finish_backward): Turn internal error into normal error.
testsuite/
* gdb.btrace/segv.c: New.
* gdb.btrace/segv.exp: New.
Alan Modra [Sat, 5 Jul 2014 02:35:01 +0000 (12:05 +0930)]
Run ar with --plugin for LTO 11 test
Objects built with -fno-fat-lto-objects (the default for gcc-4.9) have
no normal symbols, except things like __gnu_lto_slim. These useless
symbols are the ones put into the archive index, and of course nothing
references them so no objects are extracted by the linker. Running
ar with --plugin changes ar behaviour to put the lto symbols into the
archive index.
PR 17112
* ld-plugin/lto.exp: When building liblti-11.a, pass
--plugin path_to_gcc/liblto_plugin.so to ar.
Alan Modra [Tue, 8 Jul 2014 00:00:45 +0000 (09:30 +0930)]
daily update
Pedro Alves [Mon, 7 Jul 2014 18:05:04 +0000 (19:05 +0100)]
Mention PR gdb/17096 in ChangeLog
Pedro Alves [Mon, 7 Jul 2014 16:51:04 +0000 (17:51 +0100)]
PR gdb/17096: async support breaks remote debugging on Windows
On Windows, with "maint set target-async on" (the default since
a09dd441), Ctrl-C fails to stop a remote target.
With maint target-async on, the SIGINT signal handler doesn't send the
remote interrupt request immediately. Instead, it marks an async
handler as ready, and then the main event loop wakes up and notices
that the SIGINT async signal handler token was set, and calls the
corresponding event handler, which sends the remote interrupt request.
On POSIX-like systems, the SIGINT signal makes the select/poll in the
main event loop wake up / return with EINTR. However, on Windows,
signal handlers run on a separate thread, and Windows doesn't really
have a concept of EINTR. So, just marking the async handler
(effectively just setting a flag) does not wake up gdb_select.
Instead, we need to call gdb_call_async_signal_handler from the signal
handler. The Windows version (in mingw-hdep.c) sets a Windows event
that gdb_select's WaitForMultipleObjects is waiting for.
Confirmed that with this, Ctrl-C interrupts the remote target on
Windows. Also regression tested on x86_64 Fedora 20 against
GDBserver.
gdb/
2014-07-07 Pedro Alves <palves@redhat.com>
* remote.c (async_handle_remote_sigint)
(async_handle_remote_sigint_twice): Call
gdb_call_async_signal_handler instead of
mark_async_signal_handler.
Nick Clifton [Mon, 7 Jul 2014 16:46:05 +0000 (17:46 +0100)]
Remove an accidental commit.
* readelf.c (get_symbol_type): Revert accidental change to
detection of thumb function symbols.
Barney Stratford [Mon, 7 Jul 2014 15:15:19 +0000 (16:15 +0100)]
Adds support for writing values to AVR system I/O registers.
* elf32-avr.c: Handle R_AVR_PORT5 and R_AVR_PORT6.
* reloc.c: Add BFD_RELOC_AVR_PORT5 and BFD_RELOC_AVR_PORT6.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
* avr.h: Add R_AVR_PORT5 and R_AVR_PORT6.
* config/tc-avr.c (avr_operand): Permit referring to r26-r31 by
name as [xyz][hl]. Permit using a symbol whoes name begins with
`r' to refer to a register.
Allow arbitrary expressions for the P and p operators.
(md_apply_fix): Check the BFD_RELOC_AVR_PORT5 and
BFD_RELOC_AVR_PORT6 relocations.
Tom Tromey [Wed, 25 Jun 2014 16:23:35 +0000 (10:23 -0600)]
change to_info_record to use target delegation
This changes to_info_record to use target delegation.
Also, target_info_record was unused, so this patch removes it.
2014-07-07 Tom Tromey <tromey@redhat.com>
* target-delegates.c: Rebuild.
* target.c (target_info_record): Remove.
* record.c (info_record_command): Unconditionally call
to_info_record.
* target.h (struct target_ops) <to_info_record>: Use
TARGET_DEFAULT_IGNORE.
(target_info_record): Remove.
Tom Tromey [Wed, 25 Jun 2014 16:16:55 +0000 (10:16 -0600)]
convert to_get_thread_local_address to use target delegation
This converts to_get_thread_local_address to use
TARGET_DEFAULT_NORETURN. One possible oddity is that this changes the
text of the kind of exception thrown in some cases. This doesn't seem
to be a problem; in fact perhaps the final call to 'error' in
target_translate_tls_address should be changed to call
generic_tls_error.
2014-07-07 Tom Tromey <tromey@redhat.com>
* target.h (struct target_ops) <to_get_thread_local_address>: Use
TARGET_DEFAULT_NORETURN.
* target.c (generic_tls_error): New function.
(target_translate_tls_address): Don't search target stack.
* target-delegates.c: Rebuild.
* ppc-linux-tdep.c (ppc_linux_spe_context): Don't search target
stack.
* linux-thread-db.c (thread_db_get_thread_local_address):
Unconditionally call beneath target.
Alan Modra [Mon, 7 Jul 2014 14:12:45 +0000 (23:42 +0930)]
Reinstate compiler check
* lib/ld-lib.exp (check_lto_shared_available): Reinstate compiler
check here too.
Nick Clifton [Mon, 7 Jul 2014 13:41:10 +0000 (14:41 +0100)]
This patch prevents a linker testsuite error if the checks are run with a
toolchain that just contains the binutils - ie without a compiler.
* lib/ld-lib.exp (check_lto_available): Check that a compiler is
available before testing for LTO support.
Alan Modra [Mon, 7 Jul 2014 04:07:16 +0000 (13:37 +0930)]
Ensure ld testsuite gcc -B options precede $CC -B options
Various ld-elf/shared.exp and ld-plugin/lto.exp tests simply appended
the testsuite -B options intended to force gcc use the linker under test.
This fails if $CC itself has -B options, as when setting CC to run gcc
out of a build directory. Net result is that tests were run using
the gcc build dir collect-ld.
* config/default.exp: Don't make tmpdir/gas. Put as symlink into
tmpdir/ld.
(gcc_gas_flag, gcc_ld_flag): Delete.
(gcc_B_opt, ld_L_opt): New globals.
ld-elf/shared.exp: Remove all refs to gcc_gas_flag and gcc_ld_flag.
ld-plugin/lto.exp: Likewise.
lib/ld-lib.exp (run_host_cmd): Add gcc_B_opt and ld_L_opt here.
(ld_simple_link): Remove -B handling now that this is done in
run_host_cmd. Simplify.
(default_ld_compile): Simplify.
(check_lto_available): Use run_host_cmd_yesno.
(check_lto_shared_available): Likewise.
Alan Modra [Mon, 7 Jul 2014 00:00:39 +0000 (09:30 +0930)]
daily update
Alan Modra [Sun, 6 Jul 2014 00:00:56 +0000 (09:30 +0930)]
daily update
Alan Modra [Sat, 5 Jul 2014 02:29:53 +0000 (11:59 +0930)]
Rid libdummy.a from lto.exp
libdummy.a is used to make run_cc_link_tests compile objects and
archive them. libdummy.a isn't used. What we're really doing is
preventing a final link. So do that directly.
* lib/ld-lib.exp (run_ld_link_tests): Stop after assembling objects
if binfile is empty.
(run_ld_link_exec_tests, run_cc_link_tests): Likewise. Tidy
status checks.
* ld-plugin/lto.exp: Don't use libdummy.a trick to compile objects.
Instead use an empty output file.
Alan Modra [Sat, 5 Jul 2014 00:01:46 +0000 (09:31 +0930)]
daily update
Alan Modra [Fri, 4 Jul 2014 05:36:40 +0000 (15:06 +0930)]
Update "configure.in" in comments and doco
bfd/
* Makefile.am: Update "configure.in" comments.
* PORTING: Likewise.
* aoutx.h: Likewise.
* configure.host: Likewise.
* doc/bfdint.texi: Likewise.
* targets.c: Likewise.
* warning.m4: Likewise.
* Makefile.in: Regenerate.
gas/
* doc/internals.texi: Update "configure.in" comments.
* acinclude.m4: Likewise.
* config/tc-sparc.c: Likewise.
ld/
* configure.ac: Update "configure.in" comments.
* configure: Regenerate.
Alan Modra [Fri, 4 Jul 2014 03:29:42 +0000 (12:59 +0930)]
Rename configure.in to configure.ac
bfd/
* configure.ac: Rename from configure.in.
* Makefile.in: Regenerate.
* config.in: Regenerate.
* doc/Makefile.in: Regenerate.
opcodes/
* configure.ac: Rename from configure.in.
* Makefile.in: Regenerate.
* config.in: Regenerate.
binutils/
* configure.ac: Rename from configure.in.
* Makefile.in: Regenerate.
* config.in: Regenerate.
* doc/Makefile.in: Regenerate.
gas/
* configure.ac: Rename from configure.in.
* Makefile.in: Regenerate.
* config.in: Regenerate.
* doc/Makefile.in: Regenerate.
gprof/
* configure.ac: Rename from configure.in.
* configure.ac: Rename from configure.in.
* Makefile.in: Regenerate.
* gconfig.in: Regenerate.
ld/
* configure.ac: Rename from configure.in.
* Makefile.in: Regenerate.
* config.in: Regenerate.
Alan Modra [Fri, 4 Jul 2014 03:42:07 +0000 (13:12 +0930)]
Remove some more bfd/configure.in dependencies
Missed from
2e98a7bd
bfd/
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Remove configure.in.
* Makefile.in: Regenerate.
gas/
* doc/Makefile.am (CONFIG_STATUS_DEPENDENCIES): Delete.
* doc/Makefile.in: Regenerate.
Alan Modra [Fri, 4 Jul 2014 02:05:16 +0000 (11:35 +0930)]
Use modern AC_INIT in configure.in
This removes usage of the obsolete AC_INIT and AM_INIT_AUTOMAKE in all
binutils configure.in files. The BFD version is now in bfd/version.m4
rather than bfd/configure.in, which allows automake to automatically
track this dependency.
bfd/
* version.m4: New file.
* configure.in: Include version.m4.
(AC_INIT): Update.
* Makefile.am (RELEASE): Delete.
(bfdver.h): Depend on development.sh, use instead of RELEASE.
* Makefile.in: Regenerate.
* doc/Makefile.in: Regenerate.
opcodes/
* configure.in: Include bfd/version.m4.
(AC_INIT, AM_INIT_AUTOMAKE): Use modern form.
(BFD_VERSION): Delete.
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Remove bfd/configure.in.
* configure: Regenerate.
* Makefile.in: Regenerate.
binutils/
* configure.in: Include bfd/version.m4.
(AC_INIT, AM_INIT_AUTOMAKE): Use modern form.
(BFD_VERSION): Delete.
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Remove bfd/configure.in.
* configure: Regenerate.
* Makefile.in: Regenerate.
* doc/Makefile.in: Regenerate.
gas/
* configure.in: Include bfd/version.m4.
(AC_INIT, AM_INIT_AUTOMAKE): Use modern form.
(BFD_VERSION): Delete.
* configure.com: Get bfd version from bfd/version.m4.
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Remove bfd/configure.in.
* configure: Regenerate.
* Makefile.in: Regenerate.
* doc/Makefile.in: Regenerate.
gprof/
* configure.in: Include bfd/version.m4.
(AC_INIT, AM_INIT_AUTOMAKE): Use modern form.
(BFD_VERSION): Delete.
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Remove bfd/configure.in.
* configure: Regenerate.
* Makefile.in: Regenerate.
ld/
* configure.in: Include bfd/version.m4.
(AC_INIT, AM_INIT_AUTOMAKE): Use modern form.
(BFD_VERSION): Delete.
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Remove bfd/configure.in.
* configure: Regenerate.
* Makefile.in: Regenerate.
Alan Modra [Fri, 4 Jul 2014 02:03:38 +0000 (11:33 +0930)]
Update gold POTFILES.in
for recent aarch64 and mips support.
* po/POTFILES.in: Regenerate
Alan Modra [Fri, 4 Jul 2014 00:01:17 +0000 (09:31 +0930)]
daily update
Marc Khouzam [Thu, 3 Jul 2014 18:55:36 +0000 (14:55 -0400)]
Assign 'targerr' instead of 'targ' to gdb_stdtargerr.
Tristan Gingold [Thu, 3 Jul 2014 15:30:49 +0000 (17:30 +0200)]
Clarify doc on addr2line output.
binutils/
* doc/binutils.texi: Clarify addr2line output.
Andrew Burgess [Thu, 3 Jul 2014 13:26:04 +0000 (14:26 +0100)]
Update email address in MAINTAINERS list.
Alan Modra [Thu, 3 Jul 2014 07:02:45 +0000 (16:32 +0930)]
Reload --as-needed libraries inside groups
When a shared library appears within --start-group/--end-group ld may
only discover a need for loading the library on the second or
subsequent pass over archive libraries, as more objects are extracted.
ld/
PR 17068
* ldlang.c (load_symbols): Always check flags.reload.
(open_input_bfds): Always reload --as-needed shared libraries,
not just when rescanning.
* ldlang.h (struct lang_input_statement_flags): Update reload comment.
* plugin.c (plugin_should_reload): Assume shared library arg.
* plugin.h (plugin_should_reload): Update comment.
ld/testsuite
* ld-elf/pr17068.s: New.
* ld-elf/pr17068a.s: New.
* ld-elf/pr17068b.s: New.
* ld-elf/pr17068c.s: New.
* ld-elf/pr17068d.s: New.
* ld-elf/pr17068e.s: New.
* ld-elf/pr17068ez.s: New.
* ld-elf/elf.exp: Run new test.
Alan Modra [Thu, 3 Jul 2014 00:01:38 +0000 (09:31 +0930)]
daily update
Jing Yu [Wed, 2 Jul 2014 23:21:23 +0000 (16:21 -0700)]
2014-07-02 Jing Yu <jingyu@google.com>
Initial patch to enable gold aarch64 backend.
This patch is just a skeleton which almost does nothing.
It does not support ILP32 now.
gold/ChangeLog:
* aarch64.cc: New file
* Makefile.am (TARGETSOURCES): Add aarch64.cc
(ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
* Makefile.in: Regenerate.
* configure.tgt: Add entries for aarch64*.
* configure.ac: Likewise.
* configure: Likewise.
elfcpp/ChangeLog:
* aarch64.h: New file. New enums for aarch64-elf64 relocations.
* elfcpp.h (EM_AARCH64, SHT_AARCH64_ATTRIBUTES, PT_AARCH64_ARCHEXT,
PT_AARCH64_UNWIND): New enum constant.
Luis Machado [Wed, 2 Jul 2014 10:59:02 +0000 (11:59 +0100)]
This testcase currently does not handle powerpc branches. It kinda
does in a way, because the arm/aarch64 branch instruction is the
same as powerpc's, but the target triplet pattern is not there.
In summary, the testcase fails to locate the branch offset and causes
a failure and the early termination of the test.
The following patch adds a separate conditional block for powerpc (to keep
things organized), allowing the testcase to continue.
2014-07-02 Luis Machado <lgustavo@codesourcery.com>
* gdb.trace/entry-values.exp: Handle powerpc-specific branch
instruction.
Alan Modra [Wed, 2 Jul 2014 05:37:18 +0000 (15:07 +0930)]
Taking an undefined function's address in an executable
doesn't always mean you need to define a function symbol on plt code.
If all references are in read-write sections, then using dynamic relocs
is OK.
bfd/
* elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Clear
pointer_equality_needed when !readonly_dynrelocs.
* elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise.
ld/testsuite/
* ld-powerpc/ambiguousv1.d: Match symbol table too.
* ld-powerpc/ambiguousv2.d: Likewise.
* ld-powerpc/ambiguousv1b.d: New.
* ld-powerpc/ambiguousv2b.d: New.
* ld-powerpc/powerpc.exp: Run new tests.
Gary Benson [Tue, 1 Jul 2014 14:07:24 +0000 (15:07 +0100)]
Remove unused Linux libthread_db callbacks
gdb/proc-service.c includes several libthread_db callbacks that do not
exist in gdb/gdbserver/proc-service.c. Other than in proc_service.h,
there is no reference to any of these callbacks in any revision of
nptl_db or linuxthreads_db in glibc's git repo so it seems likely that
these functions have never been called. This commit removes them.
gdb/
2014-07-02 Gary Benson <gbenson@redhat.com>
* proc-service.c (ps_xfer_memory): Update comment.
(ps_pstop): Remove unused function.
(ps_pcontinue): Likewise.
(ps_lstop): Likewise.
(ps_lcontinue): Likewise.
(ps_lgetxregsize): Likewise.
(ps_lgetxregs): Likewise.
(ps_lsetxregs): Likewise.
(ps_plog): Likewise.
(ps_ptread): Likewise.
(ps_ptwrite): Likewise.
Alan Modra [Wed, 2 Jul 2014 04:34:21 +0000 (14:04 +0930)]
Set DF_STATIC_TLS for PIEs
If we can dlopen an object then DF_STATIC_TLS is relevant.
* elf32-ppc.c (ppc_elf_check_relocs): Set DF_STATIC_TLS for PIEs too.
* elf64-ppc.c (ppc64_elf_check_relocs): Likewise.
Alan Modra [Wed, 2 Jul 2014 00:01:18 +0000 (09:31 +0930)]
daily update
Mark Wielaard [Mon, 30 Jun 2014 21:21:52 +0000 (23:21 +0200)]
Handle volatile array types in dwarf2read.c.
read_tag_const_type propagates the cv-qualifier to the array element type,
but read_tag_volatile_type didn't. Make sure that both cv-qualifiers that
apply to array types are handled the same.
gdb/ChangeLog
* dwarf2read.c (add_array_cv_type): New function.
(read_tag_const_type): Call add_array_cv_type for TYPE_CODE_ARRAY.
(read_tag_volatile_type): Likewise.
gdb/testsuite/ChangeLog
* gdb.base/constvars.c (violent, violet, vips, virgen, vulgar,
vulture, vilify, villar): New volatile array constants.
(vindictive, vegetation): New const volatile array constants.
* gdb.base/volatile.exp: Test volatile and const volatile array
types.
Tom Tromey [Mon, 19 Nov 2012 02:24:22 +0000 (19:24 -0700)]
use cmd_sfunc_ftype and cmd_cfunc_ftype more
This patch changes a few more spots to use either cmd_sfunc_ftype or
cmd_cfunc_ftype, as appropriate. This is a bit cleaner.
Tested by rebuilding.
2014-07-01 Tom Tromey <tromey@redhat.com>
* breakpoint.c (add_catch_command): Use cmd_sfunc_ftype.
* breakpoint.h (add_catch_command): Use cmd_sfunc_ftype.
* cli/cli-decode.c (cmd_cfunc_eq, add_cmd, add_prefix_cmd)
(add_abbrev_prefix_cmd, add_info, add_com): Use cmd_cfunc_ftype.
* command.h (cmd_cfunc_ftype): Move earlier.
(add_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, cmd_cfunc_eq)
(add_com, add_info): Use cmd_cfunc_ftype.
Alan Modra [Tue, 1 Jul 2014 11:13:14 +0000 (20:43 +0930)]
Reorganise struct bfd
for better packing. Removes a field and a flag that are never set.
bfd/
* bfd.c (struct bfd): Reorganise for better packing. Delete
"ifd" field. Make "format", "direction" and "flags" bitfields.
(HAS_LOAD_PAGE): Delete, renumber following flags.
* bfd-in2.h: Regenerate.
* coff-tic4x.c: Remove HAS_LOAD_PAGE from extra flags in target vecs.
binutils/
* objdump.c (dump_bfd_header): Don't print HAS_LOAD_PAGE.
Alan Modra [Tue, 1 Jul 2014 10:02:25 +0000 (19:32 +0930)]
Add symbols for global entry stub, and report stats
The undefined function symbols (with non-zero value) on global entry
stubs are discarded by objdump when disassembling, so give objdump
another symbol to mark the stubs.
Also fixes a couple of bugs:
- entry_section was set to .opd for ELFv2, which meant a hard error
rather than a warning when _start wasn't defined.
- global entry stubs were not built if they were the only type of
stub in an executable.
bfd/
* elf64-ppc.c (ppc_stub_type): Add ppc_stub_global_entry.
(struct ppc_link_hash_table): Increase size of stub_count array.
(build_global_entry_stubs): Emit symbol on global entry stub.
(ppc64_elf_build_stubs): NULL check htab->brlt. Add global entry
stub stats.
ld/
* emultempl/ppc64elf.em (stub_added): Delete.
(gld${EMULATION_NAME}_finish): Call ppc64_elf_build_stubs even when
none of the usual stubs have been added. Only change entry_section
for ELFv1.
Alan Modra [Tue, 1 Jul 2014 08:40:25 +0000 (18:10 +0930)]
Don't include sys/param.h
sys/param.h on recent versions of powerpc glibc ends up including
asm/elf.h via asm/sigcontex.h. asm/elf.h defines R_PPC_* and R_PPC64_*
macros, which clash with our include/elf/ppc.h and include/elf/ppc64.h.
It turns out that no current source uses LD_PATHMAX, so there is no
need for limits.h or sys/param.h, except for one occurrence of UINT_MAX.
I don't have a quarrel with limits.h, but it seems unnecessary just
for UINT_MAX.
* sysdep.h: Don't include limits.h and sys/param.h. Don't
include unistd.h twice.
(LD_PATHMAX): Don't define.
* ldlang.c (lang_common): Don't use UINT_MAX.
Alan Modra [Tue, 1 Jul 2014 03:36:20 +0000 (13:06 +0930)]
Linker foreign output format support for PowerPC64 ELFv2
Makes the ld srec tests pass. Uses a horrible scan through symbols to
find ELF fields for symbol definitions, but the generic linker doesn't
offer anything better. Might be slow. Anyway, sane people will link
to ELF output then objcopy to convert formats.
* elf64-ppc.c (abiversion, set_abiversion): Move earlier.
(ppc64_elf_branch_reloc): Adjust addend for ELFv2 local offset.
(ppc64_elf_set_toc): Set ".TOC." symbol value when using
generic linker.
(ppc64_elf_relocate_section): Disable ELFv2 function entry
optimisation when --traditional-format.
Barney Stratford [Tue, 1 Jul 2014 09:20:17 +0000 (10:20 +0100)]
Add support for the AVR Tiny series of microcontrollers.
* archures.c: add avrtiny architecture for avr target.
* bfd-in2.h: Regenerate.
* cpu-avr.c (arch_info_struct): add avrtiny arch info.
* elf32-avr.c (elf_avr_howto_table): new relocation R_AVR_LDS_STS_16
added for 16 bit LDS/STS instruction of avrtiny arch.
(avr_reloc_map): reloc R_AVR_LDS_STS_16 is mapped to
BFD_RELOC_AVR_LDS_STS_16.
(bfd_elf_avr_final_write_processing): select machine number avrtiny arch.
(elf32_avr_object_p): set machine number for avrtiny arch.
* libbfd.h: Regenerate.
* reloc.c: Add documentation for BFD_RELOC_AVR_LDS_STS_16 reloc.
* config/tc-avr.c (mcu_types): Add avrtiny arch.
Add avrtiny arch devices attiny4, attiny5, attiny9, attiny10, attiny20
and attiny40.
(md_show_usage): Add avrtiny arch in usage message.
(avr_operand): validate and issue error for invalid register for avrtiny.
add new reloc exp for 16 bit lds/sts instruction.
(md_apply_fix): check 16 bit lds/sts operand for out of range and encode.
(md_assemble): check ISA for arch and issue diagnostic.
* include/elf/avr.h (E_AVR_MACH_AVRTINY): define avrtiny machine number.
(R_AVR_LDS_STS_16): define 16 bit lds/sts reloc number.
* include/opcode/avr.h (AVR_ISA_TINY): define avrtiny specific ISA.
(AVR_ISA_2xxxa): define ISA without LPM.
(AVR_ISA_AVRTINY): define avrtiny arch ISA.
Add doc for contraint used in 16 bit lds/sts.
Adjust ISA group for icall, ijmp, pop and push.
Add 16 bit lds/sts encoding and update 32 bit lds/sts constraints.
* opcodes/avr-dis.c (avr_operand): Handle constraint j for 16 bit lds/sts.
(print_insn_avr): do not select opcode if insn ISA is avrtiny and machine
is not avrtiny.
* Makefile.am (ALL_EMULATION_SOURCES): add avrtiny emulation source.
(eavrtiny.c): add rules for avrtiny emulation source.
* Makefile.in: Regenerate.
* configure.tgt: Add avrtiny to avr target emulations.
* scripttempl/avrtiny.sc: New file.
linker script template for avrtiny arch.
* emulparams/avrtiny.sh: New file.
emulation parameters for avrtiny arch.