Alan Modra [Tue, 10 Jun 2014 12:20:21 +0000 (21:50 +0930)]
Unwrap symbols for debug information
Fixes issues with dwz multi-file (-m) and ld's -wrap option.
Symbols referenced from DWARF debug info in a separate file, eg. to
specify low and high pc, must use the real symbol. The DWARF info
is specifying attributes of the real function, not one interposed
with --wrap.
include/
* bfdlink.h (unwrap_hash_lookup): Declare.
bfd/
* linker.c (unwrap_hash_lookup): New function.
* elf-bfd (RELOC_FOR_GLOBAL_SYMBOL): Call unwrap_hash_lookup.
* elf32-i370.c (i370_elf_relocate_section): Likewise.
* elf32-m32c.c (m32c_elf_relocate_section): Likewise.
* elf32-m32r.c (m32r_elf_relocate_section): Likewise.
* elf32-score.c (s3_bfd_score_elf_relocate_section): Likewise.
* elf32-score7.c (s7_bfd_score_elf_relocate_section): Likewise.
* elf32-spu.c (spu_elf_relocate_section): Likewise.
* elf64-hppa.c (elf64_hppa_relocate_section): Likewise.
Joel Brobecker [Fri, 6 Jun 2014 15:28:27 +0000 (11:28 -0400)]
thinko in serial.c::serial_write debug trace
I noticed that, when using 'set debug serial 1', the "write" traces
would always be NUL characters:
[
w \x00][\x00][\x00][\x00][\x00][etc]
This is due to a small thinko in the loop that output each character,
where we accidently used the loop boundary instead of the loop index
to index the character to be printed.
After this patch is applied, the output now becomes:
[
w $][v][C][o][n][t][?][#][4][9]
gdb/ChangeLog:
* serial.c (serial_write): Fix index of character to be printed
in call to serial_logchar when serial debug traces are enabled.
Joel Brobecker [Tue, 10 Jun 2014 08:48:16 +0000 (10:48 +0200)]
gdbtypes.resolve_dynamic_range: Add function description.
gdb/ChangeLog:
* gdbtypes (resolve_dynamic_range): Add function description.
Alan Modra [Tue, 10 Jun 2014 00:00:40 +0000 (09:30 +0930)]
daily update
Cary Coutant [Mon, 9 Jun 2014 21:55:02 +0000 (14:55 -0700)]
Add check to keep from segfaulting on a corrupt .debug_pubnames section.
gold/
* dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
unit_length is within section bounds.
Cary Coutant [Mon, 9 Jun 2014 19:57:31 +0000 (12:57 -0700)]
Print unattached sections in the link map.
gold/
PR gold/16980
* layout.cc (Layout::print_to_mapfile): Print unattached sections in
map.
Siva Chandra [Mon, 9 Jun 2014 13:47:22 +0000 (06:47 -0700)]
Add space before the opening parenthesis in function descriptions.
gdb/doc
* python.texi (Xmethod API): Add space before the opening
parenthesis in function descriptions.
Romain Chastenet [Mon, 9 Jun 2014 14:06:58 +0000 (15:06 +0100)]
Correctly save and recall the CFA saved register state.
PR binutils/16252
* dwarf.c (display_debug_frames): Remember the state of the
cfa_offset, cfa_reg, ra and cfa_exp field
Ryan Mansfield [Mon, 9 Jun 2014 14:04:01 +0000 (15:04 +0100)]
Remove reference to GASp from linker testsuite configuration.
* config/default.exp (GASP): Remove.
Nick Clifton [Mon, 9 Jun 2014 10:04:41 +0000 (11:04 +0100)]
Update expected disassembly of MSP430X instructions now that the disassembler
correcctly interprets an extension word with zero index offsets.
* gas/msp430/msp430x.d: Update to match revised assembler output.
Pedro Alves [Mon, 9 Jun 2014 13:53:51 +0000 (14:53 +0100)]
Fix a bunch of fork related regressions.
I'm seeing a ton of new FAILs in fork-related tests. Like, these and
many more:
+FAIL: gdb.base/disp-step-syscall.exp: vfork: continue to vfork (2nd time) (timeout)
+FAIL: gdb.base/disp-step-syscall.exp: vfork: display/i $pc (timeout)
...
-PASS: gdb.base/foll-vfork.exp: exec: vfork parent follow, through step: step
+FAIL: gdb.base/foll-vfork.exp: exec: vfork parent follow, through step: step (timeout)
-PASS: gdb.base/foll-vfork.exp: exec: vfork parent follow, to bp: continue to bp
+FAIL: gdb.base/foll-vfork.exp: exec: vfork parent follow, to bp: continue to bp (timeout)
...
FAIL: gdb.threads/watchpoint-fork.exp: parent: multithreaded: breakpoint (A) after the first fork (timeout)
FAIL: gdb.threads/watchpoint-fork.exp: parent: multithreaded: watchpoint A after the first fork (timeout)
FAIL: gdb.base/fileio.exp: System(3) call (timeout)
FAIL: gdb.threads/watchpoint-fork.exp: parent: multithreaded: watchpoint B after the first fork (timeout)
-PASS: gdb.base/multi-forks.exp: run to exit 2
+FAIL: gdb.base/multi-forks.exp: run to exit 2 (timeout)
...
PASS: gdb.base/watch-vfork.exp: Watchpoint on global variable (hw)
-PASS: gdb.base/watch-vfork.exp: Watchpoint triggers after vfork (hw)
+FAIL: gdb.base/watch-vfork.exp: Watchpoint triggers after vfork (hw) (timeout)
PASS: gdb.base/watch-vfork.exp: Watchpoint on global variable (sw)
-PASS: gdb.base/watch-vfork.exp: Watchpoint triggers after vfork (sw)
+FAIL: gdb.base/watch-vfork.exp: Watchpoint triggers after vfork (sw) (timeout)
Three issues with
https://sourceware.org/ml/gdb-patches/2014-06/msg00348.html
(
c077881a).
- The inner 'status' local is shadowing the outer 'status' local,
thus PTRACE_DETACH is never seeing the status it intends to pass on
the inferior.
- With that fixed, we then try to pass down the SIGTRAP that results
from the step to the inferior. Need to filter out signals that are
in nopass state.
- For software single-step archs, the current code is equivalent to:
int status = 0;
if (WIFSTOPPED (status))
ptrace (PTRACE_DETACH, child_pid, 0, WSTOPSIG (status));
... and status == 0 is WIFEXITED, not WIFSTOPPED, so we're never
detaching.
gdb/
2014-06-09 Pedro Alves <palves@redhat.com>
* linux-nat.c (linux_child_follow_fork): Initialize status with
W_STOPCODE (0) instead of 0. Remove shodowing 'status' local from
inner block. Only pass the signal to PTRACE_DETACH if in pass
state.
Gary Benson [Mon, 9 Jun 2014 09:34:33 +0000 (10:34 +0100)]
Separate out ANSI-standard signals
This commit reorders various pieces of code to separate ANSI-standard
signals from other signals that need checking. Comments are added to
document this, and to document the ordering of the signals.
gdb/
2014-06-09 Gary Benson <gbenson@redhat.com>
* common/signals.c (gdb_signal_from_host): Reorder to separate
the always-available ANSI-standard signals from the signals that
require checking.
(do_gdb_signal_to_host): Likewise.
* proc-events.c (signal_table): Likewise.
gdb/testsuite/
2014-06-09 Gary Benson <gbenson@redhat.com>
* gdb.base/sigall.c [Functions to send signals]: Reorder to
separate the always-available ANSI-standard signals from the
signals that require checking.
(main): Likewise.
* gdb.reverse/sigall-reverse.c [Functions to send signals]:
Likewise.
(main): Likewise.
Alan Modra [Mon, 9 Jun 2014 00:00:37 +0000 (09:30 +0930)]
daily update
Hui Zhu [Sun, 8 Jun 2014 11:11:09 +0000 (19:11 +0800)]
Fix gdb.base/watch-vfork.exp: Watchpoint triggers after vfork (sw) (timeout) with Linux 2.6.32 and older version
https://sourceware.org/ml/gdb-patches/2014-04/msg00047.html
Got gdb.base/watch-vfork.exp: Watchpoint triggers after vfork (sw)
(timeout) with Linux 2.6.32 and older version.
The rootcause is after the test use "set can-use-hw-watchpoints 0" let GDB
doesn't use hardware breakpoint and set a watchpoint on "global", GDB
continue will keep single step inside function "vfork".
The Linux 2.6.32 and older version doesn't have commit
6580807da14c423f0d0a708108e6df6ebc8bc83d (get more info please goto
http://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/?id=
6580807da14c423f0d0a708108e6df6ebc8bc83d).
When the function "vfork" do syscall, the single step flag TIF_SINGLESTEP
will copy to child process.
Then GDB detach it, child process and parent process will be hanged.
So I make a patch that do a single step before detach. Then TIF_SINGLESTEP
of child process in old Linux kernel will be cleared before detach.
Child process in new Linux kernel will not be affected by this single step.
2014-06-08 Hui Zhu <hui@codesourcery.com>
* common/linux-ptrace.c (linux_disable_event_reporting): New
function.
* common/linux-ptrace.h (linux_disable_event_reporting): New
declaration.
* linux-nat.c (linux_child_follow_fork): Do a single step before
detach.
Alan Modra [Sun, 8 Jun 2014 00:00:45 +0000 (09:30 +0930)]
daily update
Keith Seitz [Sat, 7 Jun 2014 17:40:39 +0000 (10:40 -0700)]
Revert patchset for c++/16253: it causes a large performance regression.
See the bug for further information.
Alan Modra [Sat, 7 Jun 2014 04:28:53 +0000 (13:58 +0930)]
PROVIDE in linker script vs. built-in symbols
* ldexp.c (exp_fold_tree_1 <etree_provide>): Make PROVIDEd
linker script symbol value override a built-in linker symbol.
Alan Modra [Sat, 7 Jun 2014 02:39:04 +0000 (12:09 +0930)]
Allow both signed and unsigned fields in PowerPC cmpli insn
There are legitimate reasons to allow a signed value in a cmpli insn
field, for example to test for a "stw r1,lock@sdarel(r13)" instruction
in user code, a kernel might use
subis r3,r3,STW_R1_0R13@ha # subtract off high part
cmplwi r3,lock@sdarel # is low part accessing lock?
Since the lock@sdarel may take a range of -32768 to 32767,
the allowed range of cmpli immediate must be at least [-32768,65535].
bfd/
* elf32-ppc.c (ppc_elf_relocate_section): Treat field of cmpli
insn as a bitfield; Use complain_overflow_bitfield.
* elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
opcodes/
* ppc-opc.c (UISIGNOPT): Define and use with cmpli.
gas/
* config/tc-ppc.c (ppc_insert_operand): Handle PPC_OPERAND_SIGNOPT
on unsigned fields. Comment on PPC_OPERAND_SIGNOPT signed fields
in 64-bit mode.
gold/
* powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
Alan Modra [Sat, 7 Jun 2014 00:00:54 +0000 (09:30 +0930)]
daily update
Cary Coutant [Fri, 6 Jun 2014 23:23:21 +0000 (16:23 -0700)]
Strip .debug_gnu_pubnames and .debug_gnu_pubtypes when building .gdb_index.
When not stripping those sections, there was a bug where gold was incorrectly
adjusting section-relative offsets by the offset of the input section within
the output section. That adjustment was both unnecessary and wrong, causing
gold to miss a number of debug entries that should have been added to
.gdb_index. (With stripping, the adjustment was always 0, so the bug in
dwarf_reader.cc would have been hidden by the change to layout.cc.)
gold/
* dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
* dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
(Dwarf_pubnames_table::read_header): Likewise.
* layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
.debug_gnu_pubtypes.
Doug Evans [Fri, 6 Jun 2014 23:08:54 +0000 (16:08 -0700)]
fix email address of previous checkins
Doug Evans [Fri, 6 Jun 2014 22:57:03 +0000 (15:57 -0700)]
Add support for guile 2.0.5.
* guile/guile-internal.h (gdbscm_guile_major_version): Declare.
(gdbscm_guile_minor_version, gdbscm_guile_micro_version): Declare.
(gdbscm_guile_version_is_at_least): Declare.
(gdbscm_scm_string_to_int): Declare.
* guile/guile.c (gdbscm_guile_major_version): New global.
(gdbscm_guile_minor_version, gdbscm_guile_micro_version): New globals.
(guile_datadir): New static global.
(gdbscm_guile_data_directory): New function.
(initialize_scheme_side): Update.
(misc_guile_functions): Add guile-data-directory.
(initialize_gdb_module): Fetch guile version number.
* guile/lib/gdb.scm: Remove call to add-to-load-path.
* guile/lib/gdb/init.scm (%initialize!): Ditto.
* guile/lib/gdb/boot.scm: Use guile-data-directory.
* guile/scm-exception.c (gdbscm_print_exception_with_stack): Fix
comments.
* guile/scm-string.c (gdbscm_scm_string_to_int): New function.
* guile/scm-utils.c (gdbscm_guile_version_is_at_least): New function.
* guile/scm-value.c (gdbscm_value_to_string): Only call
scm_port_conversion_strategy if Guile version >= 2.0.6.
doc/
* guile.texi (Guile Configuration): Document guile-data-directory.
Doug Evans [Fri, 6 Jun 2014 22:41:09 +0000 (15:41 -0700)]
* gdb.guile/scm-frame-args.c (foo): Tweak to work with gcc 4.6.3.
Pedro Alves [Fri, 6 Jun 2014 18:59:21 +0000 (19:59 +0100)]
sss-bp-on-user-bp-2.exp sometimes fails on native GNU/Linux.
I noticed that sss-bp-on-user-bp-2.exp is racy on native GNU/Linux. I
sometimes still see an int3 in the disassembly:
(gdb) PASS: gdb.base/sss-bp-on-user-bp-2.exp: set debug target 0
disassemble test
Dump of assembler code for function test:
0x0000000000400590 <+0>: push %rbp
0x0000000000400591 <+1>: mov %rsp,%rbp
0x0000000000400594 <+4>: nop
=> 0x0000000000400595 <+5>: int3
0x0000000000400596 <+6>: pop %rbp
0x0000000000400597 <+7>: retq
End of assembler dump.
(gdb) FAIL: gdb.base/sss-bp-on-user-bp-2.exp: before/after disassembly matches
Enabling infrun/target debug logs, we can see the problem.
Simplified, that's:
(gdb) PASS: gdb.base/sss-bp-on-user-bp-2.exp: define stepi_del_break
stepi_del_break
infrun: clear_proceed_status_thread (process 25311)
infrun: resume (step=1, signal=GDB_SIGNAL_0), trap_expected=0, current thread [process 25311] at 0x400594
LLR: PTRACE_SINGLESTEP process 25311, 0 (resume event thread)
target_resume (25311, step, 0)
native:target_xfer_partial (3, (null), 0x0, 0x32dce4c, 0x400595, 1) = 0, 0
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(gdb) linux_nat_wait: [process -1], [TARGET_WNOHANG]
0x400595 is the address of the breakpoint, and "= 0" is
TARGET_XFER_EOF. That's default_memory_remove_breakpoint trying to
remove the breakpoint, but failing.
The problem is that we had just resumed the target and the native
GNU/Linux target can't read memory off of a running thread. Most of
the time, we get "lucky", because we manage to read memory before the
kernel actually schedules the target to run.
So just give up and skip the test on any target that uses hardware
stepping, not just remote targets.
gdb/testsuite/
2014-06-06 Pedro Alves <palves@redhat.com>
* gdb.base/sss-bp-on-user-bp-2.exp: Look for target_resume(step)
in target debug output instead of looking at RSP packets,
disabling the test on any target that uses hardware stepping.
Update comments.
Pedro Alves [Fri, 6 Jun 2014 14:52:24 +0000 (15:52 +0100)]
break-unload-file.exp: Fix typo.
s/is not pending/is pending/
gdb/testsuite/
2014-06-06 Pedro Alves <palves@redhat.com>
* gdb.base/break-unload-file.exp: Fix typo.
Yao Qi [Fri, 6 Jun 2014 11:16:47 +0000 (19:16 +0800)]
Restrict the pattern in gdb.base/jit.exp
I see the following fail in some thumb multi-lib in arm-none-linux-gnueabi,
info function jit_function^M
All functions matching regular expression "jit_function":^M
^M
Non-debugging symbols:^M
0x00000790 __real_jit_function_XXXX^M
0x0000079c __jit_function_XXXX_from_arm^M
0x0000079c jit_function_0000^M
0x00000790 __real_jit_function_XXXX^M
0x0000079c __jit_function_XXXX_from_arm^M
0x0000079c jit_function_0001^M
(gdb) FAIL: gdb.base/jit.exp: one_jit_test-2: info function jit_function
the test expects to see only jit_function_0000 and jit_function_0001
one_jit_test 2 "${hex} jit_function_0000\[\r\n\]+${hex} jit_function_0001"
Symbols with the prefix "__real_" or suffix "_from_arm" is generated
by gcc/ld for arm/thumb interworking.
This patch is to restrict the pattern from "jit_function" to
"^jit_function", the output becomes expected.
gdb/testsuite:
2014-06-06 Yao Qi <yao@codesourcery.com>
* gdb.base/jit.exp (one_jit_test): Restrict the pattern
from "jit_function" to "^jit_function".
Yao Qi [Fri, 6 Jun 2014 06:32:42 +0000 (14:32 +0800)]
Tweak gdb.base/async.exp
I see two fails in async.exp on arm-none-eabi target:
nexti&^M
(gdb) 0x000001ba 14 x = 5; x = 5;^M
completed.^M
FAIL: gdb.base/async.exp: nexti&
finish&^M
Run till exit from #0 0x000001ba in foo () at /scratch/yqi/arm-none-eabi-lite/src/gdb-trunk/gdb/testsuite/gdb.base/async.c:14^M
(gdb) 0x000001e6 in main () at /scratch/yqi/arm-none-eabi-lite/src/gdb-trunk/gdb/testsuite/gdb.base/async.c:32^M
32 y = foo ();^M
Value returned is $1 = 8^M
completed.^M
FAIL: gdb.base/async.exp: finish&
The corresponding test is "test_background "nexti&" "" ".*y = 3.*"",
and it assumes that GDB "nexti" into the next source line. It is wrong
on arm. After "nexti", it still stops at the same source line, and it
fails.
When gdb does "finish", if the PC is in the middle of a source line,
the PC address is printed too. See stack.c:print_frame,
if (opts.addressprint)
if (!sal.symtab
|| frame_show_address (frame, sal)
|| print_what == LOC_AND_ADDRESS)
{
annotate_frame_address ();
if (pc_p)
ui_out_field_core_addr (uiout, "addr", gdbarch, pc);
else
ui_out_field_string (uiout, "addr", "<unavailable>");
annotate_frame_address_end ();
ui_out_text (uiout, " in ");
}
frame_show_address checks whether PC is the middle of a source line.
Since after "nexti", the inferior stops at the middle of a source line,
when we do "finish" the PC address is displayed.
In sum, GDB works well, but test case needs update. This patch is to
add a statement at the same line to make sure "nexti" doesn't go to
the new line, match the next instruction address in the output and
match the hex address the output of "finish".
gdb/testsuite:
2014-06-06 Yao Qi <yao@codesourcery.com>
* gdb.base/async.c (foo): Add one statement.
* gdb.base/async.exp: Get the next instruction address and
match the output of "nexti" by instruction address. Match
the hex address in the output of "finish".
xmj [Fri, 6 Jun 2014 09:51:30 +0000 (17:51 +0800)]
update ChangeLog
Gary Benson [Fri, 6 Jun 2014 09:32:12 +0000 (10:32 +0100)]
Remove preprocessor conditionals for ANSI-standard signals
The six signals SIGINT, SIGILL, SIGABRT, SIGFPE, SIGSEGV and SIGTERM
are ANSI-standard and thus guaranteed to be available. This patch
removes all preprocessor conditionals relating to these symbols.
gdb/
2014-06-06 Gary Benson <gbenson@redhat.com>
* common/signals.c: Remove preprocessor conditionals for
always-defined signals SIGINT, SIGILL, SIGABRT, SIGFPE,
SIGSEGV and SIGTERM.
* proc-events.c: Likewise.
gdb/testsuite/
2014-06-06 Gary Benson <gbenson@redhat.com>
* gdb.base/call-signals.c: Remove preprocessor conditionals
for always-defined signals SIGINT, SIGILL, SIGABRT, SIGFPE,
SIGSEGV and SIGTERM.
* gdb.base/sigall.c: Likewise.
* gdb.base/unwindonsignal.c: Likewise.
* gdb.reverse/sigall-reverse.c: Likewise.
xmj [Fri, 6 Jun 2014 09:28:19 +0000 (17:28 +0800)]
add -q in help info and doc
Yao Qi [Fri, 6 Jun 2014 03:05:05 +0000 (11:05 +0800)]
Skip hbreak-unmapped.exp if memory at address 0 is readable
hbreak-unmapped.exp assumes that memory at address 0 is unmapped or
unreadable, but on bare metal or uclinux targets, memory at address
0 is readable. For example, on arm-none-eabi, the vector table base
address is 0x0.
hbreak *0^M
Hardware assisted breakpoint 3 at 0x0: file
/scratch/yqi/arm-none-eabi-lite/obj/cs3-2014.11-999999-arm-none-eabi-i686-pc-linux-gnu/generated/arm-vector.S,
line 25.^M
(gdb) FAIL: gdb.base/hbreak-unmapped.exp: hbreak *0
info break^M
Num Type Disp Enb Address What^M
3 hw breakpoint keep y 0x00000000
/scratch/yqi/arm-none-eabi-lite/obj/cs3-2014.11-999999-arm-none-eabi-i686-pc-linux-gnu/generated/arm-vector.S:25^M
(gdb) FAIL: gdb.base/hbreak-unmapped.exp: info break shows hw breakpoint
delete $bpnum
This patch is to check whether address 0 is readable via command 'x 0'.
If it is, skip the test.
gdb/testsuite:
2014-06-06 Yao Qi <yao@codesourcery.com>
* gdb.base/hbreak-unmapped.exp: Read memory at address 0. If
readable, skip the test.
Markus Metzger [Mon, 2 Jun 2014 09:35:22 +0000 (11:35 +0200)]
symfile, vdso: remove target sections
Target sections added by the add-symbol-file-from-memory command are not
removed when the process exits. In fact, they are not removed, at all.
This causes GDB to crash in gdb.base/break-interp.exp.
Change the owner of those target sections to the object file generated in
symbol_file_add_from_memory and generalize the free_objfile observer in
symfile.c to remove target sections of any freed object file.
Martin Storsjo [Fri, 6 Jun 2014 06:29:19 +0000 (07:29 +0100)]
[AArch64] Fix the documentation on :pg_hi21:
Yao Qi [Thu, 5 Jun 2014 07:07:47 +0000 (15:07 +0800)]
Fix the race in gdb.threads/staticthreads.exp
The code in gdb.threads/staticthreads.exp about checking the value of
tlsvar in main thread is racy, because when child thread hits
breakpoint, the main thread may not go into pthread_join yet, and
may not be unwind to main.
This patch is to move the line setting breakpoint on after sem_wait,
so that the child thread will hit breakpoint after main thread calls
sem_post. IOW, when child thread hits breakpoint, the main thread is
in either sem_post or pthread_join. "up 10" can unwind main thread to
main.
gdb/testsuite:
2014-06-06 Yao Qi <yao@codesourcery.com>
* gdb.threads/staticthreads.c (thread_function): Move the line
setting breakpoint on forward.
* gdb.threads/staticthreads.exp: Update comments.
Alan Modra [Fri, 6 Jun 2014 00:00:43 +0000 (09:30 +0930)]
daily update
Ludovic Courtès [Thu, 5 Jun 2014 22:02:33 +0000 (00:02 +0200)]
guile: Type-check the argument to 'history-append!'.
gdb/
2014-06-05 Ludovic Courtès <ludo@gnu.org>
* guile/scm-value.c (gdbscm_history_append_x): Use
'vlscm_get_value_smob_arg_unsafe' instead of
'vlscm_scm_to_value'.
gdb/testsuite/
2014-06-05 Ludovic Courtès <ludo@gnu.org>
* gdb.guile/scm-value.exp (test_value_in_inferior): Add test
"history-append! type error".
Simon Marchi [Mon, 2 Jun 2014 21:10:36 +0000 (17:10 -0400)]
PR mi/15806: Fix quoting of async events
Original patch:
https://sourceware.org/ml/gdb-patches/2014-04/msg00552.html
New in v2:
* In remote.c:escape_buffer, pass '\\' to fputstrn_unfiltered/printchar to
make sure backslashes are escaped in remote debug output.
* Updated function documentation for printchar.
See updated ChangeLog below.
--------------------
The quoting in whatever goes in the event_channel of MI is little bit broken.
Link for the lazy:
https://sourceware.org/bugzilla/show_bug.cgi?id=15806
Here is an example of a =library-loaded event with an ill-named directory,
/tmp/how"are\you (the problem is present with every directory on Windows since
it uses backslashes as a path separator). The result will be the following:
=library-loaded,id="/tmp/how"are\\you/libexpat.so.1",...
The " between 'how' and 'are' should be escaped.
Another bad behavior is double escaping in =breakpoint-created, for example:
=breakpoint-created,bkpt={...,fullname="/tmp/how\\"are\\\\you/test.c",...}
The two backslashes before 'how' should be one and the four before 'you' should
be two.
The reason for this is that when sending something to an MI console, escaping
can take place at two different moments (the actual escaping work is always
done in the printchar function):
1. When generating the content, if ui_out_field_* functions are used. Here,
fields are automatically quoted with " and properly escaped. At least
mi_field_string does it, not sure about mi_field_fmt, I need to investigate
further.
2. When gdb_flush is called, to send the data in the buffer of the console to
the actual output (stdout). At this point, mi_console_raw_packet takes the
whole string in the buffer, quotes it, and escapes all occurences of the
quoting character and backslashes. The event_channel does not specify a quoting
character, so quotes are not escaped here, only backslashes.
The problem with =library-loaded is that it does use fprintf_unfiltered, which
doesn't do escaping (so, no #1). When gdb_flush is called, backslashes are
escaped (#2).
The problem with =breakpoint-created is that it first uses ui_out_field_*
functions to generate its output, so backslashes and quotes are escaped there
(#1). backslashes are escaped again in #2, leading to an overdose of
backslashes.
In retrospect, there is no way escaping can be done reliably in
mi_console_raw_packet for data that is already formatted, such as
event_channel. At this point, there is no way to differentiate quotes that
delimit field values from those that should be escaped. In the case of other MI
consoles, it is ok since mi_console_raw_packet receives one big string that
should be quoted and escaped as a whole.
So, first part of the fix: for the MI channels that specify no quoting
character, no escaping at all should be done in mi_console_raw_packet (that's
the change in printchar, thanks to Yuanhui Zhang for this). For those channels,
whoever generates the content is responsible for proper quoting and escaping.
This will fix the =breakpoint-created kind of problem.
Second part of the fix is to make =library-loaded generate content that is
properly escaped. For this, we use ui_out_field_* functions, instead of one big
fprintf_unfiltered. =library-unloaded suffered from the same problem so it is
modified as well. There might be other events that need fixing too, but that's
all I found with a quick scan. Those that use fprintf_unfiltered but whose sole
variable data is a %d are not critical, since it won't generate a " or a \.
Finally, a test has been fixed, as it was expecting an erroneous output.
Otherwise, all other tests that were previously passing still pass (x86-64
linux).
gdb/ChangeLog:
2014-06-02 Simon Marchi <simon.marchi@ericsson.com>
PR mi/15806
* utils.c (printchar): Don't escape at all if quoter is NUL.
Update function documentation to clarify effect of parameter
QUOTER.
* remote.c (escape_buffer): Pass '\\' as the quoter to
fputstrn_unfiltered.
* mi/mi-interp.c (mi_solib_loaded): Use ui_out_field_* functions to
generate the output.
(mi_solib_unloaded): Same.
gdb/testsuite/ChangeLog:
2014-06-02 Simon Marchi <simon.marchi@ericsson.com>
* gdb.mi/mi-breakpoint-changed.exp (test_insert_delete_modify): Fix
erroneous dprintf expected input.
Joel Brobecker [Mon, 19 May 2014 21:46:01 +0000 (14:46 -0700)]
Make it easy to make --disable-werror the default for both binutils and gdb
The goal of this patch is to provide an easy way to make
--disable-werror the default when building binutils, or the parts
of binutils that need to get built when building GDB. In development
mode, we want to continue making -Werror the default with GCC.
But, when making releases, I think we want to make it as easy as
possible for regular users to successfully build from sources.
GDB already has this kind of feature to turn -Werror as well as
the use of the libmcheck library. As GDB Release Manager, I take
advantage of it to turn those off after having cut the branch.
I'd like to be able to do the same for the binutils bits. And
perhaps Tristan will want to do the same for his releases too
(not sure, binutils builders might be a little savvier than GDB
builders).
This patch introduces a new file, called development.sh, which
just sets a variable called $development. In our development branches
(Eg. "master"), it's set to true. But setting it to false would allow
us to change the default behavior of various development-related
features to be turned off; in this case, it turns off the use of
-Werror by default (use --enable-werror to turn it back on).
bfd/ChangeLog:
* development.sh: New file.
* warning.m4 (AM_BINUTILS_WARNINGS): Source bfd/development.sh.
Make -Werror the default with GCC only if DEVELOPMENT is true.
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add
$(srcdir)/development.sh.
* Makefile.in, configure: Regenerate.
binutils/ChangeLog:
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on
bfd's development.sh.
* Makefile.in, configure: Regenerate.
gas/ChangeLog:
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on
bfd's development.sh.
* Makefile.in, configure: Regenerate.
gold/ChangeLog:
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
* Makefile.in, configure: Regenerate.
gprof/ChangeLog:
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on
bfd's development.sh.
* Makefile.in, configure: Regenerate.
ld/ChangeLog:
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on
bfd's development.sh.
* Makefile.in, configure: Regenerate.
opcodes/ChangeLog:
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on
bfd's development.sh.
* Makefile.in, configure: Regenerate.
gdb/ChangeLog:
* development.sh: Delete.
* Makefile.in (config.status): Adjust dependency on development.sh.
* configure.ac: Adjust development.sh source call.
* configure: Regenerate.
gdb/gdbserver/ChangeLog:
* configure.ac: Adjust development.sh source call.
* Makefile.in (config.status): Adjust dependency on development.sh.
* configure: Regenerate.
Tested on x86_64-linux by building two ways: One with DEVELOPMENT
set to true, and one with DEVELOPMENT set to false. In the first
case, I could see the use of -Werror, while it disappeared in
the second case.
Doug Evans [Thu, 5 Jun 2014 03:01:40 +0000 (20:01 -0700)]
Delete scm-generics.exp.
Support for smobs as goops classes is changing in guile 2.2.
We may eventually switch to using structs instead of smobs,
so remove any claim we support goops or generics for now.
* gdb.guile/scm-generics.exp: Delete.
Doug Evans [Thu, 5 Jun 2014 02:44:30 +0000 (19:44 -0700)]
Split create-breakpoint! into make-breakpoint, register-breakpoint!.
Rename breakpoint-delete! to delete-breakpoint!.
* guile/scm-breakpoint.c (struct gdbscm_breakpoint_object): New members
is_scheme_bkpt, spec.
(bpscm_make_breakpoint_smob): Initialize new members.
(gdbscm_create_breakpoint_x): Split into two ...
(gdbscm_make_breakpoint, gdbscm_register_breakpoint_x): New functions.
(bpscm_breakpoint_deleted): Reset breakpoint number and stop function.
(scheme_function breakpoint_functions): Update.
* guile/lib/gdb.scm: Delete create-breakpoint!. Rename
breakpoint-delete! to delete-breakpoint!. Add make-breakpoint,
register-breakpoint!.
testsuite/
* gdb.guile/scm-breakpoint.exp: Update.
Add tests for breakpoint registration.
doc/
* guile.texi (Breakpoints In Guile): Update.
Alan Modra [Thu, 5 Jun 2014 00:01:07 +0000 (09:31 +0930)]
daily update
Joel Brobecker [Wed, 4 Jun 2014 18:03:22 +0000 (14:03 -0400)]
gdbserver crash if the_target->supports_z_point_type is NULL
When debugging on LynxOS targets (and probably on SPU targets as well),
inserting a breakpoint and resuming the program's execution causes
GDBserver to crash.
The crash occurs while handling the Z0 packet sent by GDB to insert
our breakpoint, because z_type_supported calls
the_target->supports_z_point_type without checking that it is not NULL
This patch fixes the issue by making z_type_supported return false if
the_target->supports_z_point_type is NULL.
gdb/gdbserver/ChangeLog:
PR server/17023
* mem-break.c (z_type_supported): Return zero if
THE_TARGET->SUPPORTS_Z_POINT_TYPE is NULL.
Tested on ppx-lynx5.
Tom Tromey [Thu, 8 May 2014 17:26:44 +0000 (11:26 -0600)]
handle VLA in a struct or union
It is valid in GNU C to have a VLA in a struct or union type, but gdb
did not handle this.
This patch adds support for these cases in the obvious way.
Built and regtested on x86-64 Fedora 20.
New tests included.
2014-06-04 Tom Tromey <tromey@redhat.com>
* ada-lang.c (ada_template_to_fixed_record_type_1): Use
value_from_contents_and_address_unresolved.
(ada_template_to_fixed_record_type_1): Likewise.
(ada_which_variant_applies): Likewise.
* value.h (value_from_contents_and_address_unresolved): Declare.
* value.c (value_from_contents_and_address_unresolved): New
function.
* gdbtypes.c (is_dynamic_type, resolve_dynamic_type)
<TYPE_CODE_STRUCT, TYPE_CODE_UNION>: New cases.
(resolve_dynamic_struct, resolve_dynamic_union): New functions.
2014-06-04 Tom Tromey <tromey@redhat.com>
* gdb.base/vla-datatypes.exp: Add tests for VLA-in-structure and
VLA-in-union.
* gdb.base/vla-datatypes.c (vla_factory): Add vla_struct,
inner_vla_struct, vla_union types. Initialize objects of those
types and compute their sizes.
Tom Tromey [Thu, 8 May 2014 16:10:43 +0000 (10:10 -0600)]
minor cleanups in is_dynamic_type
I noticed that gdbtypes.c:is_dynamic_type has some unneeded "break"s.
This patch cleans up the function a bit, removing those and removing
the switch's default case so that the end of the function is a bit
clearer.
2014-06-04 Tom Tromey <tromey@redhat.com>
* gdbtypes.c (is_dynamic_type): Remove unneeded "break"s.
Tom Tromey [Mon, 15 Apr 2013 15:40:57 +0000 (09:40 -0600)]
constify to_attach
This constifies the "args" argument to the target_ops to_attach
method.
I updated all instances of the method. I could not compile all of
them but I hand-inspected them. In all cases either the argument is
ignored, or it is passed to parse_pid_to_attach. (linux-nat does some
extra stuff, but that one I built...)
If you want to try it on your host of choice, please do so.
The code in parse_pid_to_attach seems a little bogus to me. If there
is a platform with a broken strtoul, we have better methods for fixing
the issue now. However, I left the code as is since it is clearly ok
to do so.
Built and regtested on x86-64 Fedora 20.
2014-06-04 Tom Tromey <tromey@redhat.com>
* procfs.c (procfs_attach): Make "args" const.
* windows-nat.c (windows_attach): Make "args" const.
* nto-procfs.c (procfs_attach): Make "args" const.
* inf-ttrace.c (inf_ttrace_attach): Make "args" const.
* go32-nat.c (go32_attach): Make "args" const.
* gnu-nat.c (gnu_attach): Make "args" const.
* darwin-nat.c (darwin_attach): Make "args" const.
* inf-ptrace.c (inf_ptrace_attach): Make "args" const.
* linux-nat.c (linux_nat_attach): Make "args" const.
* remote.c (extended_remote_attach_1, extended_remote_attach):
Make "args" const.
* target.h (struct target_ops) <to_attach>: Make "args" const.
(find_default_attach): Likewise.
* utils.c (parse_pid_to_attach): Make "args" const.
* utils.h (parse_pid_to_attach): Update.
Tom Tromey [Fri, 21 Feb 2014 17:33:42 +0000 (10:33 -0700)]
convert to_thread_address_space to use TARGET_DEFAULT_FUNC
This converts to_thread_address_space to use TARGET_DEFAULT_FUNC.
This method was one of a handful not using the normal target
delegation approach. The only rationale here is consistency in the
target vector.
Built and regtested on x86-64 Fedora 20.
2014-06-04 Tom Tromey <tromey@redhat.com>
* target-delegates.c: Rebuild.
* target.c (default_thread_address_space): New function.
(target_thread_address_space): Simplify.
* target.h (struct target_ops) <to_thread_address_space>: Add
TARGET_DEFAULT_FUNC.
Yao Qi [Wed, 4 Jun 2014 05:03:19 +0000 (13:03 +0800)]
Tweak sss-bp-on-user-bp.exp
sss-bp-on-user-bp.c has an assumption that write to integer can be
compiled to a single instruction, which isn't true on some arch, such
as arm. This test requires setting two breakpoints on two consecutive
instructions, so this patch is to get the address of the next
instruction via disassemble and set the 2nd breakpoint there. This
approach is portable.
This patch fixes the fails in sss-bp-on-user-bp.exp on arm-none-abi
target. There is no change in x86 test results. I also revert the
patch to PR breakpoints/17000, and verified that the patched
sss-bp-on-user-bp.exp still trigger the fail on
x86-with-software-single-step.
gdb/testsuite:
2014-06-04 Yao Qi <yao@codesourcery.com>
* gdb.base/sss-bp-on-user-bp.c (main): Remove comments.
* gdb.base/sss-bp-on-user-bp.exp: Don't set breakpoint on
"set bar break here". Get the next instruction address and
set breakpoint there. Remove "bar break" from the regexp
patterns.
Will Newton [Wed, 21 May 2014 15:49:57 +0000 (16:49 +0100)]
bfd/elfnn-aarch64.c: Cleanup a couple of TLS functions
Add an assert and remove an unused line of code.
bfd/ChangeLog:
2014-06-04 Will Newton <will.newton@linaro.org>
* elfnn-aarch64.c (tpoff_base): Make test of tls_sec
being non-NULL into an assert.
(elfNN_aarch64_tls_relax): Remove unused code.
Doug Evans [Wed, 4 Jun 2014 07:26:03 +0000 (00:26 -0700)]
* guile/scm-type.c (type_smob): Remove duplicate typedef.
Markus Metzger [Mon, 2 Jun 2014 08:25:44 +0000 (10:25 +0200)]
btrace: async support
Add support for async command execution. This fixes the gdb.btrace tests.
* record-btrace.c: Include event-loop.h and inf-loop.h.
(record_btrace_resume_exec_dir)
(record_btrace_async_inferior_event_handler)
(record_btrace_handle_async_inferior_event): New.
(record_btrace_open): Create async event handler.
(record_btrace_close): Delete async event handler.
(record_btrace_resume): Set record_btrace_resume_exec_dir,
Mark async event handler.
(record_btrace_execution_direction): New.
(init_record_btrace_ops): Initialize to_execution_direction.
Hui Zhu [Wed, 4 Jun 2014 06:37:34 +0000 (14:37 +0800)]
Add system test before "set remote system-call-allowed 1" to fileio.exp
This patch is update version according to the discussion in
https://www.sourceware.org/ml/gdb-patches/2009-11/msg00090.html.
If test get the target doesn't support fileio system according to the
remote log. It will set this test as "unsupported".
Before I made this patch, I want add a check before all of tests in this
file. But I found that the target maybe support one call but not others.
For example: my target support Fwrite, Fopen and so on. But not Fgettimeofday.
And it doesn't support Fsystem NULL but it support Fsystem not NULL.
So I think if we want to check target support fileio, we need check them
one by one.
2014-06-04 Nathan Sidwell <nathan@codesourcery.com>
Hui Zhu <hui@codesourcery.com>
* gdb.base/fileio.exp: Add test for shell not available as well as
available.
* gdb.base/fileio.c (test_system): Check for shell twice.
Yao Qi [Tue, 3 Jun 2014 05:20:56 +0000 (13:20 +0800)]
Fix a regexp pattern in gdb.base/auto-connect-native-target.exp
When I test gdb head (for 7.8 release) on arm-none-eabi, I find the
following this failure, which are caused by the improper regexp
pattern in the test.
(gdb) help target native^M
Undefined target command: "native". Try "help target".^M
(gdb) FAIL: gdb.base/auto-connect-native-target.exp: help target native
The space in front of "$gdb_prompt $" looks redundant, and this patch
is to remove it from the regexp pattern.
gdb/testsuite:
2014-06-04 Yao Qi <yao@codesourcery.com>
* gdb.base/auto-connect-native-target.exp: Remove redundant
space from the regexp pattern.
Yao Qi [Tue, 3 Jun 2014 05:17:42 +0000 (13:17 +0800)]
Fix regexp pattern in gdb.base/default.exp
I see this failure on arm-none-eabi gdb testing.
target native^M
Undefined target command: "native". Try "help target".^M
(gdb) FAIL: gdb.base/default.exp: target native
This patch is to update the regexp pattern to match "native" instead of
"child".
gdb/testsuite:
2014-06-04 Yao Qi <yao@codesourcery.com>
* gdb.base/default.exp: Replace "child" with "native" in
regexp pattern.
Doug Evans [Wed, 4 Jun 2014 03:37:56 +0000 (20:37 -0700)]
* guile/scm-param.c (pascm_make_param_smob): Add ARI comment.
(gdbscm_make_parameter): Ditto.
Alan Modra [Wed, 4 Jun 2014 00:00:43 +0000 (09:30 +0930)]
daily update
Doug Evans [Tue, 3 Jun 2014 20:48:12 +0000 (13:48 -0700)]
resize_section_table cleanup
* exec.c (exec_close_1): Call clear_section_table instead of
resize_section_table.
(clear_section_table): New function.
(resize_section_table): Make static. Rename arg num_added to
adjustment.
* exec.h (clear_section_table): Declare.
(resize_section_table): Delete.
* progspace.c (release_program_space): Call clear_section_table
instead of resize_section_table.
DJ Delorie [Tue, 3 Jun 2014 20:23:21 +0000 (16:23 -0400)]
* elf32-rx.c (rx_table_map): Use BFD_VMA_FMT for portability.
Joel Brobecker [Tue, 3 Jun 2014 17:39:03 +0000 (10:39 -0700)]
gdb/doc/python.texi: Fix reference to "Progspaces In Python".
A recent change broke the documentation build due to a think-o
in a reference. Fixed thusly.
gdb/doc/ChangeLog:
* python.texi (Xmethod API): Fix reference to "Progspaces In
Python".
Tested by rebuilding all documentation formats.
Siva Chandra [Sun, 30 Mar 2014 23:24:50 +0000 (16:24 -0700)]
Documentation of the xmethod support in GDB Python API.
* NEWS (Python Scripting): Add entry about the new xmethods
feature.
doc/
* python.texi (Xmethods In Python, XMethod API)
(Writing an Xmethod): New nodes.
(Python API): New menu entries "Xmethods In Python",
"Xmethod API", "Writing an Xmethod".
Siva Chandra [Tue, 20 May 2014 13:53:04 +0000 (06:53 -0700)]
Xmethod support in Python.
* python/py-xmethods.c: New file.
* python/py-objfile.c (objfile_object): New field 'xmethods'.
(objfpy_dealloc): XDECREF on the new xmethods field.
(objfpy_new, objfile_to_objfile_object): Initialize xmethods
field.
(objfpy_get_xmethods): New function.
(objfile_getset): New entry 'xmethods'.
* python/py-progspace.c (pspace_object): New field 'xmethods'.
(pspy_dealloc): XDECREF on the new xmethods field.
(pspy_new, pspace_to_pspace_object): Initialize xmethods
field.
(pspy_get_xmethods): New function.
(pspace_getset): New entry 'xmethods'.
* python/python-internal.h: Add declarations for new functions.
* python/python.c (_initialize_python): Invoke
gdbpy_initialize_xmethods.
* python/lib/gdb/__init__.py (xmethods): New
attribute.
* python/lib/gdb/xmethod.py: New file.
* python/lib/gdb/command/xmethods.py: New file.
testuite/
* gdb.python/py-xmethods.cc: New testcase to test xmethods.
* gdb.python/py-xmethods.exp: New tests to test xmethods.
* gdb.python/py-xmethods.py: Python script supporting the
new testcase and tests.
Siva Chandra [Tue, 3 Jun 2014 16:56:58 +0000 (09:56 -0700)]
Missed ChangeLog entry in the previous commit.
Siva Chandra [Tue, 20 May 2014 13:41:39 +0000 (06:41 -0700)]
Lookup and invoke debug methods of C++ classes if they are the best match.
* eval.c (evaluate_subexp_standard): Call the xmethod if the
best match method returned by find_overload_match is an xmethod.
* valarith.c (value_x_binop, value_x_unop): Call the xmethod if
the best matching operator returned by find_overload_match is an
xmethod.
* valops.c: #include "extension.h".
(find_method_list): Add "fn_list" and "xm_worker_vec" arguments.
Return void. The list of matching source methods is returned in
"fn_list" and a vector of matching debug method workers is
returned in "xm_worker_vec". Update all callers.
(value_find_oload_method_list): Likewise.
(find_oload_champ): Add "xm_worker_vec" parameter. If it is
non-NULL, then the index of the best matching method in this
vector is returned. Update all callers.
(find_overload_match): Include xmethods while performing overload
resolution.
Siva Chandra [Tue, 20 May 2014 13:30:29 +0000 (06:30 -0700)]
Add xmethod interface to the extension language API.
* defs.h (enum lval_type): New enumerator "lval_xcallable".
* extension-priv.h (struct extension_language_ops): Add the
xmethod interface.
* extension.c (new_xmethod_worker, clone_xmethod_worker,
get_matching_xmethod_workers, get_xmethod_argtypes,
invoke_xmethod, free_xmethod_worker,
free_xmethod_worker_vec): New functions.
* extension.h: #include "common/vec.h".
New function declarations.
(struct xmethod_worker): New struct.
(VEC (xmethod_worker_ptr)): New vector type.
(xmethod_worker_ptr): New typedef.
(xmethod_worker_vec): Likewise.
* gdbtypes.c (gdbtypes_post_init): Initialize "xmethod" field of
builtin_type.
* gdbtypes.h (enum type_code): New enumerator TYPE_CODE_XMETHOD.
(struct builtin_type): New field "xmethod".
* valarith.c (value_ptradd): Assert that the value argument is not
lval_xcallable.
* valops.c (value_must_coerce_to_target): Return 0 for
lval_xcallable values.
* value.c (struct value): New field XM_WORKER in the field
LOCATION.
(value_address, value_raw_address): Return 0 for lval_xcallable
values.
(set_value_address): Assert that the value is not an
lval_xcallable.
(value_free): Free the associated xmethod worker when freeing
lval_xcallable values.
(set_value_component_location): Assert that the WHOLE value is not
lval_xcallable.
(value_of_xmethod, call_xmethod): New functions.
* value.h: Declare "struct xmethod_worker".
Declare new functions value_of_xmethod, call_xmethod.
Joel Brobecker [Tue, 3 Jun 2014 16:42:19 +0000 (17:42 +0100)]
User breakpoint ignored if software-single-step at same location
with the following code...
12 Nested; -- break #1
13 return I; -- break #2
14 end;
(line 12 is a call to function Nested)
... we have noticed the following errorneous behavior on ppc-aix,
where, after having inserted a breakpoint at line 12 and line 13,
and continuing from the breakpoint at line 12, the program never
stops at line 13, running away until the program terminates:
% gdb -q func
(gdb) b func.adb:12
Breakpoint 1 at 0x10000a24: file func.adb, line 12.
(gdb) b func.adb:13
Breakpoint 2 at 0x10000a28: file func.adb, line 13.
(gdb) run
Starting program: /[...]/func
Breakpoint 1, func () at func.adb:12
12 Nested; -- break #1
(gdb) c
Continuing.
[Inferior 1 (process
4128872) exited with code 02]
When resuming from the first breakpoint, GDB first tries to step out
of that first breakpoint. We rely on software single-stepping on this
platform, and it just so happens that the address of the first
software single-step breakpoint is the same as the user's breakpoint
#2 (0x10000a28). So, with infrun and target traces turned on (but
uninteresting traces snip'ed off), the "continue" operation looks like
this:
(gdb) c
### First, we insert the user breakpoints (the second one is an internal
### breakpoint on __pthread_init). The first user breakpoint is not
### inserted as we need to step out of it first.
target_insert_breakpoint (0x0000000010000a28, xxx) = 0
target_insert_breakpoint (0x00000000d03f3800, xxx) = 0
### Then we proceed with the step-out-of-breakpoint...
infrun: resume (step=1, signal=GDB_SIGNAL_0), trap_expected=1, current thread [process
15335610] at 0x10000a24
### That's when we insert the SSS breakpoints...
target_insert_breakpoint (0x0000000010000a28, xxx) = 0
target_insert_breakpoint (0x00000000100009ac, xxx) = 0
### ... then let the inferior resume...
target_resume (
15335610, continue, 0)
infrun: wait_for_inferior ()
target_wait (-1, status, options={}) =
15335610, status->kind = stopped, signal = GDB_SIGNAL_TRAP
infrun: target_wait (-1, status) =
infrun:
15335610 [process
15335610],
infrun: status->kind = stopped, signal = GDB_SIGNAL_TRAP
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x100009ac
### At this point, we stopped at the second SSS breakpoint...
target_stopped_by_watchpoint () = 0
### We remove the SSS breakpoints...
target_remove_breakpoint (0x0000000010000a28, xxx) = 0
target_remove_breakpoint (0x00000000100009ac, xxx) = 0
target_stopped_by_watchpoint () = 0
### We find that we're not done, so we resume....
infrun: no stepping, continue
### And thus insert the user breakpoints again, except we're not
### inserting the second breakpoint?!?
target_insert_breakpoint (0x0000000010000a24, xxx) = 0
infrun: resume (step=0, signal=GDB_SIGNAL_0), trap_expected=0, current thread [process
15335610] at 0x100009ac
target_resume (-1, continue, 0)
infrun: prepare_to_wait
target_wait (-1, status, options={}) =
15335610, status->kind = exited, status = 2
What happens is that the removal of the software single-step
breakpoints effectively removed the breakpoint instruction from
inferior memory. But because such breakpoints are inserted directly
as raw breakpoints rather than through the normal chain of
breakpoints, we fail to notice that one of the user breakpoints points
to the same address and that this user breakpoint is therefore
effectively un-inserted. When resuming after the single-step, GDB
thinks that the user breakpoint is still inserted and therefore does
not need to insert it again.
This patch teaches the insert and remove routines of both regular and
raw breakpoints to be aware of each other. Special care needs to be
applied in case the target supports evaluation of breakpoint
conditions or commands.
gdb/ChangeLog:
PR breakpoints/17000
* breakpoint.c (find_non_raw_software_breakpoint_inserted_here):
New function, extracted from software_breakpoint_inserted_here_p.
(software_breakpoint_inserted_here_p): Replace factored out code
by call to find_non_raw_software_breakpoint_inserted_here.
(bp_target_info_copy_insertion_state): New function.
(bkpt_insert_location): Handle the case of a single-step
breakpoint already inserted at the same address.
(bkpt_remove_location): Handle the case of a single-step
breakpoint still inserted at the same address.
(deprecated_insert_raw_breakpoint): Handle the case of non-raw
breakpoint already inserted at the same address.
(deprecated_remove_raw_breakpoint): Handle the case of a
non-raw breakpoint still inserted at the same address.
(find_single_step_breakpoint): New function, extracted from
single_step_breakpoint_inserted_here_p.
(find_single_step_breakpoint): New function,
factored out from single_step_breakpoint_inserted_here_p.
(single_step_breakpoint_inserted_here_p): Reimplement.
gdb/testsuite/ChangeLog:
PR breakpoints/17000
* gdb.base/sss-bp-on-user-bp.exp: Remove kfail.
* gdb.base/sss-bp-on-user-bp-2.exp: Remove kfail.
Tested on ppc-aix with AdaCore's testsuite. Tested on x86_64-linux,
(native and gdbserver) with the official testsuite. Also tested on
x86_64-linux through Pedro's branch enabling software single-stepping
on that platform (native and gdbserver).
Nick Clifton [Tue, 3 Jun 2014 16:18:27 +0000 (17:18 +0100)]
This is to fix a further problem with merging resource sections. It turns
out that the section is supposed to be page-aligned, but the newly merged
section was not being padded out to a page boundary. This meant that when
the executable was stripped a badly sized .rsrc section was written out.
PR ld/16807
* peXXigen.c (rsrc_process_section): Page align the new contents
befgore writing out.
Brad Mouring [Mon, 2 Jun 2014 20:55:10 +0000 (15:55 -0500)]
gdb/source.c: Fix matching path substitute rule listing
The check for the source (or "from") directory snippet in listing
matching path substitution rules currently will not match anything
other than a direct match of the "from" field in a substitution rule,
resulting in the incorrect behavior below:
...
(gdb) set substitute-path /a/path /another/path
(gdb) show substitute-path
List of all source path substitution rules:
`/a/path' -> `/another/path'.
(gdb) show substitute-path /a/path/to/a/file.ext
Source path substitution rule matching `/a/path/to/a/file.ext':
(gdb) show substitute-path /a/path
Source path substitution rule matching `/a/path':
`/a/path' -> `/another/path'.
...
This change effects the following behavior by (sanely) checking
with the length of the "from" portion of a rule and ensuring that
the next character of the path considered for substitution is a path
delimiter (or NULL). With this change, the following behavior is
garnered:
...
(gdb) set substitute-path /a/path /another/path
(gdb) show substitute-path
List of all source path substitution rules:
`/a/path' -> `/another/path'.
(gdb) show substitute-path /a/path/to/a/file.ext
Source path substitution rule matching `/a/path/to/a/file.ext':
`/a/path' -> `/another/path'.
(gdb) show substitute-path /a/pathological/case/that/should/fail.err
Source path substitution rule matching `/a/pathological/case/that/should/fail.err':
(gdb)
Also included is a couple of tests added to subst.exp to verify
this behavior in the test suite.
gdb/ChangeLog:
* source.c (show_substitute_path_command): Fix display of matching
substitution rules.
gdb/testsuite/ChangeLog:
* gdb.ada/subst.exp: Add tests to verify partial path matching
output.
This was tested on x86_64 Linux.
Pedro Alves [Tue, 3 Jun 2014 13:04:48 +0000 (14:04 +0100)]
Skip sss-bp-on-user-bp-2.exp on remote hardware step targets.
gdb/testsuite/
2014-06-03 Pedro Alves <palves@redhat.com>
* gdb.base/sss-bp-on-user-bp-2.exp: Skip if testing with a remote
target that doesn't use software single-stepping.
Gary Benson [Tue, 3 Jun 2014 12:49:20 +0000 (13:49 +0100)]
This patch replaces a call to cplus_demangle with a call to
gdb_demangle. This change was included in an RFC from last
March [1] but omitted from the eventual commit.
[1] https://sourceware.org/ml/gdb-patches/2013-03/msg00235.html
2014-06-03 Gary Benson <gbenson@redhat.com>
* gnu-v2-abi.c (gnuv2_value_rtti_type): Use gdb_demangle.
Pedro Alves [Tue, 3 Jun 2014 11:46:46 +0000 (12:46 +0100)]
PR breakpoints/17000: user breakpoint not inserted if software-single-step at same location - test
GDB gets confused when removing a software single-step breakpoint that
is at the same address as another breakpoint. Add another kfailed
test.
gdb/testsuite/
2014-06-03 Pedro Alves <palves@redhat.com>
PR breakpoints/17000
* gdb.base/sss-bp-on-user-bp-2.c: New file.
* gdb.base/sss-bp-on-user-bp-2.exp: New file.
Doug Evans [Tue, 3 Jun 2014 08:58:15 +0000 (01:58 -0700)]
Add parameter support for Guile.
* Makefile.in (SUBDIR_GUILE_OBS): Add scm-param.o.
(SUBDIR_GUILE_SRCS): Add scm-param.c.
(scm-param.o): New rule.
* guile/guile-internal.h (gdbscm_gc_dup_argv): Declare.
(gdbscm_misc_error): Declare.
(gdbscm_canonicalize_command_name): Declare.
(gdbscm_scm_to_host_string): Declare.
(gdbscm_scm_from_host_string): Declare.
(gdbscm_initialize_parameters): Declare.
* guile/guile.c (initialize_gdb_module): Call
gdbscm_initialize_parameters.
* guile/lib/gdb.scm: Export parameter symbols.
* guile/scm-cmd.c (gdbscm_canonicalize_command_name): Renamed from
cmdscm_canonicalize_name and made public. All callers updated.
* guile/scm-exception.c (gdbscm_misc_error): New function.
* guile/scm-param.c: New file.
* guile/scm-string.c (gdbscm_scm_to_string): Add comments.
(gdbscm_scm_to_host_string): New function.
(gdbscm_scm_from_host_string): New function.
* scm-utils.c (gdbscm_gc_dup_argv): New function.
testsuite/
* gdb.guile/scm-parameter.exp: New file.
doc/
* guile.texi (Guile API): Add entry for Parameters In Guile.
(GDB Scheme Data Types): Mention <gdb:parameter> object.
(Parameters In Guile): New node.
Nick Clifton [Tue, 3 Jun 2014 08:00:57 +0000 (09:00 +0100)]
Fix a small but in the emulation of the MSP430 hardware multiply.
* msp430-sim.c (get_op): Handle reads of low result register when
in MAC mode.
(put_op): Copy MAC result into result words.
Handle writes to the low result register.
Nick Clifton [Tue, 3 Jun 2014 07:54:04 +0000 (08:54 +0100)]
Fix the disassembly of MSP430 extended index addressing mode.
* msp430-dis.c (msp430_doubleoperand): Use extension_word to
decide when extended addressing is being used.
Nick Clifton [Tue, 3 Jun 2014 07:49:02 +0000 (08:49 +0100)]
Change -mz command line option to -my for the MSP430 port of GAS.
* config/tc-msp430.c (OPTION_WARN_INTR_NOPS): Use y instead of z.
(OPTION_NO_WARN_INTR_NOPS): Use Y instead of Z.
* doc/c-msp430.texi: Update command line option description.
* gas/msp430/bad.d: Use -my not -mz.
Nick Clifton [Tue, 3 Jun 2014 07:37:29 +0000 (08:37 +0100)]
If the binutils testsuite is run on an installed toolchain the tests involving
the bfdtest1 and bfdtest2 executables will fail because they are not installed.
Since the programs only exist to be used by the testsuite it does not make sense
to install them, so instead I have chosen to create a patch which skips the tests
when they are not present.
* binutils-all/ar.exp: Skip tests involving bfdtest1 and bfdtest2
if these executables are not present.
Doug Evans [Tue, 3 Jun 2014 07:29:49 +0000 (00:29 -0700)]
Add command support for Guile.
* Makefile.in (SUBDIR_GUILE_OBS): Add scm-cmd.o.
(SUBDIR_GUILE_SRCS): Add scm-cmd.c.
(scm-cmd.o): New rule.
* guile/guile-internal.h (gdbscm_gc_xstrdup): Declare.
(gdbscm_user_error_p): Declare.
(gdbscm_parse_command_name): Declare.
(gdbscm_valid_command_class_p): Declare.
(gdbscm_initialize_commands): Declare.
* guile/guile.c (initialize_gdb_module): Call
gdbscm_initialize_commands.
* guile/lib/gdb.scm: Export command symbols.
* guile/lib/gdb/init.scm (%exception-keys): Add gdb:user-error.
(throw-user-error): New function.
* guile/scm-cmd.c: New file.
* guile/scm-exception.c (user_error_symbol): New static global.
(gdbscm_user_error_p): New function.
(gdbscm_initialize_exceptions): Set user_error_symbol.
* scm-utils.c (gdbscm_gc_xstrdup): New function.
testsuite/
* gdb.guile/scm-cmd.c: New file.
* gdb.guile/scm-cmd.exp: New file.
doc/
* guile.texi (Guile API): Add entry for Commands In Guile.
(Basic Guile) <parse-and-eval>: Add reference.
(Basic Guile) <string->argv>: Move definition to Commands In Guile.
(GDB Scheme Data Types): Mention <gdb:command> object.
(Commands In Guile): New node.
Phil Muldoon [Tue, 3 Jun 2014 07:01:39 +0000 (00:01 -0700)]
Don't remove #-comments.
When using the multi-line feature, we don't want the gdb CLI to remove
comments from the command list, as this will remove things like
"#define".
* top.c (command_loop): Handle comments here...
(command_line_input): ... not here.
Doug Evans [Tue, 3 Jun 2014 06:46:27 +0000 (23:46 -0700)]
Add progspace support for Guile.
* Makefile.in (SUBDIR_GUILE_OBS): Add scm-progspace.o.
(SUBDIR_GUILE_SRCS): Add scm-progspace.c.
(scm-progspace.o): New rule.
* guile/guile-internal.h (pspace_smob): New typedef.
(psscm_pspace_smob_pretty_printers): Declare.
(psscm_pspace_smob_from_pspace): Declare.
(psscm_scm_from_pspace): Declare.
* guile/guile.c (initialize_gdb_module): Call
gdbscm_initialize_pspaces.
* guile/lib/gdb.scm: Export progspace symbols.
* guile/lib/gdb/printing.scm (prepend-pretty-printer!): Add progspace
support.
(append-pretty-printer!): Ditto.
* guile/scm-pretty-print.c (ppscm_find_pretty_printer_from_progspace):
Implement.
* guile/scm-progspace.c: New file.
doc/
* guile.texi (Guile API): Add entry for Progspaces In Guile.
(GDB Scheme Data Types): Mention <gdb:progspace> object.
(Progspaces In Guile): New node.
testsuite/
* gdb.guile/scm-pretty-print.exp: Add tests for objfile and progspace
pretty-printer lookup.
* gdb.guile/scm-pretty-print.scm (pp_s-printer): New function.
(make-pp_s-printer): Call it.
(make-pretty-printer-from-dict): New function.
(lookup-pretty-printer-maker-from-dict): New function.
(*pretty-printer*): Simplify.
(make-objfile-pp_s-printer): New function.
(install-objfile-pretty-printers!): New function.
(make-progspace-pp_s-printer): New function.
(install-progspace-pretty-printers!): New function.
* gdb.guile/scm-progspace.c: New file.
* gdb.guile/scm-progspace.exp: New file.
Alan Modra [Tue, 3 Jun 2014 01:25:29 +0000 (10:55 +0930)]
Support fusion for ELFv2 stubs
Power8 fuses addis,addi and addis,ld sequences when the target of the
addis is the same as the addi/ld. Thus
addis r12,r2,xxx@ha
addi r12,r12,xxx@l / ld r12,xxx@l(r12)
is faster than
addis r11,r2,xxx@ha
addi r12,r11,xxx@l / ld r12,xxx@l(r11)
So use the form that allows fusion in plt call and branch stubs.
bfd/
* elf64-ppc.c (ADDIS_R12_R2): Define.
(build_plt_stub): Support fusion on ELFv2 stub.
(ppc_build_one_stub): Likewise for plt branch stubs.
gold/
* powerpc.cc (addis_12_2): Define.
(Stub_table::do_write): Support fusion on ELFv2 stubs.
ld/testsuite/
* ld-powerpc/elfv2exe.d: Update for changed plt call stubs.
gdb/
* ppc64-tdep.c (ppc64_standard_linkage8): New.
(ppc64_skip_trampoline_code): Recognise ELFv2 stub supporting fusion.
Alan Modra [Tue, 3 Jun 2014 01:17:55 +0000 (10:47 +0930)]
Fix gold plugin_test failures on PowerPC64 ELFv2
readelf output for ELFv2 includes st_other bits specifying a
function's local entry offset.
* testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
st_other output.
Doug Evans [Tue, 3 Jun 2014 00:16:07 +0000 (17:16 -0700)]
Add support for skeletonless type units.
* dwarf2read.c (struct dwarf2_per_objfile): New member
n_allocated_type_units.
(struct dwarf2_per_objfile) <tu_stats>: New member
nr_all_type_units_reallocs.
(create_signatured_type_table_from_index): Initialize
n_allocated_type_units
(create_all_type_units): Ditto.
(add_type_unit): Move up in file. New arg slot.
All callers updated. Increase space for all_type_units more
efficiently.
(fill_in_sig_entry_from_dwo_entry): Handle psymtabs.
(lookup_dwo_signatured_type): Handle skeletonless TUs.
(lookup_dwp_signatured_type): Ditto.
(init_tu_and_read_dwo_dies): New arg use_existing_cu.
All callers updated.
(build_type_psymtabs_1): Leave type_unit_groups as
NULL if no TUs present.
(print_tu_stats): New function.
(process_skeletonless_type_unit): New function.
(process_dwo_file_for_skeletonless_type_units): New
function.
(process_skeletonless_type_units): New function.
(dwarf2_build_psymtabs_hard): Handle skeletonless TUs.
Call print tu_stats if debugging enabled.
Alan Modra [Tue, 3 Jun 2014 00:01:13 +0000 (09:31 +0930)]
daily update
Pedro Alves [Mon, 2 Jun 2014 21:27:33 +0000 (22:27 +0100)]
Installing a breakpoint on top of a dprintf makes GDB lose control.
While the full fix for PR 15180 isn't in, it's best if we at least
make sure that GDB doesn't lose control when a breakpoint is set at
the same address as a dprintf.
gdb/
2014-06-02 Pedro Alves <palves@redhat.com>
* breakpoint.c (build_target_command_list): Don't build a command
list if we have any duplicate location that isn't a dprintf.
gdb/testsuite/
2014-06-02 Pedro Alves <palves@redhat.com>
* gdb.base/dprintf-bp-same-addr.c: New file.
* gdb.base/dprintf-bp-same-addr.exp: New file.
Pedro Alves [Mon, 2 Jun 2014 21:27:32 +0000 (22:27 +0100)]
dprintf-style agent can't explain a trap.
If some event happens to trigger at the same address as a dprintf-style
agent dprintf is installed, GDB will complain, like:
(gdb) continue
Continuing.
May only run agent-printf on the target
(gdb)
Such dprintfs are completely handled on the target side, so they can't
explain a stop, but GDB is currently putting then on the bpstat chain
anyway, because they currently unconditionally use bkpt_breakpoint_hit
as breakpoint_hit method.
gdb/
2014-06-02 Pedro Alves <palves@redhat.com>
* breakpoint.c (dprintf_breakpoint_hit): New function.
(initialize_breakpoint_ops): Install it as dprintf's
breakpoint_hit method.
Pedro Alves [Mon, 2 Jun 2014 21:27:32 +0000 (22:27 +0100)]
gdbserver: on GDB breakpoint reinsertion, also delete the breakpoint's commands.
If GDB decides to change the breakpoint's conditions or commands,
it'll reinsert the same breakpoint again, with the new options
attached, without deleting the previous breakpoint. E.g.,
(gdb) set breakpoint always-inserted on
(gdb) b main if 0
Breakpoint 1 at 0x400594: file foo.c, line 21.
Sending packet: $Z0,400594,1;X3,220027#68...Packet received: OK
(gdb) b main
Breakpoint 15 at 0x400594: file foo.c, line 21.
Sending packet: $Z0,400594,1#49...Packet received: OK
GDBserver understands this and deletes the breakpoint's previous
conditions. But, it forgets to delete the previous commands.
gdb/gdbserver/
2014-06-02 Pedro Alves <palves@redhat.com>
* ax.c (gdb_free_agent_expr): New function.
* ax.h (gdb_free_agent_expr): New declaration.
* mem-break.c (delete_gdb_breakpoint_1): Also clear the commands
list.
(clear_breakpoint_conditions, clear_breakpoint_commands): Make
static.
(clear_breakpoint_conditions_and_commands): New function.
* mem-break.h (clear_breakpoint_conditions): Delete declaration.
(clear_breakpoint_conditions_and_commands): New declaration.
Edjunior Barbosa Machado [Mon, 2 Jun 2014 16:57:27 +0000 (13:57 -0300)]
gdb/testsuite/
2014-06-02 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
* gdb.arch/powerpc-power.exp: Add power8 instructions to the testcase.
* gdb.arch/powerpc-power.s: Likewise.
Joel Brobecker [Tue, 27 May 2014 21:03:11 +0000 (14:03 -0700)]
Unnecessary restore of timeout global at end of gdb.base/completion.exp
This patch removes some code in gdb.base/compilation.exp which
is aimed at restoring the original timeout global value after having
changed it for this testcase. Restoring the timeout global is not
necessary as this is taken care of by gdb_init, which is called
at the start of each testing.
gdb/testsuite/ChangeLog:
* gdb.base/completion.exp: Remove code aimed at restoring TIMEOUT.
Joel Brobecker [Mon, 2 Jun 2014 15:34:25 +0000 (08:34 -0700)]
simplify substitute_path_rule_matches using filename_ncmp
At the time this function was written, there was no filename_ncmp,
only FILENAME_CMP. So, in order to do an n-cmp, we had to make a local
copy of the first n characters of our string and use that to perform
the comparison. This patch simplifies the function's implementation,
now that we have filename_ncmp.
gdb/ChangeLog:
* source.c (substitute_path_rule_matches): Simplify using
filename_ncmp instead of FILENAME_CMP.
Tested on x86_64-linux.
Joel Brobecker [Mon, 2 Jun 2014 15:23:50 +0000 (08:23 -0700)]
Remove some trailing spaces in source.c
gdb/ChangeLog:
* source.c (substitute_path_rule_matches): Remove trailing spaces.
Eric Botcazou [Mon, 2 Jun 2014 11:11:17 +0000 (13:11 +0200)]
This fixes a thinko in the LEON support recently added to the assembler.
opcodes/
* sparc-opc.c (cas): Disable for LEON.
(casl): Likewise.
Alan Modra [Mon, 2 Jun 2014 06:28:49 +0000 (15:58 +0930)]
fix typos in ChangeLog
Alan Modra [Mon, 2 Jun 2014 04:24:54 +0000 (13:54 +0930)]
fix 2014-05-28 ld Makefile.am changes
bfin, msp, and score all used an extra parameter to genscripts.sh
to select a "customizer_script" different from the standard one
named from the emulation. This patch renames the scripts to avoid
the need, tidying them in the process.
* emulparams/elf32bfin.sh: Rename from bfin.sh.
* emulparams/elf32bfinfd.sh: Update to suit.
* emulparams/: Delete.
* emulparams/msp430.sh: Rename from msp430all.sh. Remove
MSP430_NAME and msp430X vars.
* emulparams/msp430X.sh: New.
* emulparams/: Delete.
* emulparams/score3_elf.sh: Rename from scoreelf.sh. Remove
SCORE_NAME and score7_elf ARCH setting.
* emulparams/score7_elf.sh: New.
* Makefile.am (eelf32bfin.c, eelf32bfinfd.c): Update dependencies.
(emsp430.c, emsp430X.c, escore3_elf.c, escore7_elf.c): Likewise.
* Makefile.in: Regenerate.
* genscripts.sh: Delete customizer_script param.
Alan Modra [Mon, 2 Jun 2014 00:00:41 +0000 (09:30 +0930)]
daily update
Alan Modra [Sun, 1 Jun 2014 12:31:44 +0000 (22:01 +0930)]
Fix PowerPC64 ELFv2 icf_safe failures
ELFv2 doesn't use .opd, so folding function code can't be allowed
in safe mode if a function's address might be taken.
* powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
Only ignore relocs on ELFv1.
(Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
Ludovic Courtès [Tue, 27 May 2014 12:02:21 +0000 (14:02 +0200)]
guile: Allow compilation with Guile <= 2.0.5.
gdb/
2014-06-01 Ludovic Courtès <ludo@gnu.org>
* configure.ac: When Guile is available, check for the
availability of 'scm_new_smob'.
* configure, config.h.in: Regenerate.
* guile/guile-internal.h (scm_new_smob) [!HAVE_SCM_NEW_SMOB]: New
function.
Kai Tietz [Sun, 1 Jun 2014 20:11:56 +0000 (22:11 +0200)]
2014-06-01 Ray Donnelly <mingw.android@gmail.com>
* pex-win32.c (argv_to_cmdline): Don't quote
args unnecessarily.
Yao Qi [Wed, 28 May 2014 04:38:52 +0000 (12:38 +0800)]
Skip test 'watch -location nullptr->p->x' if null pointer can be dereferenced
gdb.base/watchpoint.exp has a test below which expects to see "Cannot
access memory at address 0x0" when a null pointer is dereferenced.
gdb_test "watch -location nullptr->p->x" \
"Cannot access memory at address 0x0"
This assumption is not true when the target is no-mmu, so we get
watch -location nullptr->p->x
Hardware watchpoint 28: -location nullptr->p->x
(gdb) FAIL: gdb.base/watchpoint.exp: watch -location nullptr->p->x
This patch is to check whether null pointer can be dereferenced first
and then do the test.
gdb/testsuite:
2014-06-01 Yao Qi <yao@codesourcery.com>
* gdb.base/watchpoint.exp (test_watch_location): Check null
pointer can be dereferenced. If not, do the test, otherwise
skip it.
Alan Modra [Sun, 1 Jun 2014 00:00:39 +0000 (09:30 +0930)]
daily update
Alan Modra [Sat, 31 May 2014 00:00:42 +0000 (09:30 +0930)]
daily update
Andrew Burgess [Wed, 28 May 2014 22:34:43 +0000 (23:34 +0100)]
Add a TRY_CATCH to get_prev_frame_always to better manage errors during unwind.
https://sourceware.org/ml/gdb-patches/2014-05/msg00737.html
Currently a MEMORY_ERROR raised during unwinding a frame will cause the
unwind to stop with an error message, for example:
(gdb) bt
#0 breakpt () at amd64-invalid-stack-middle.c:27
#1 0x00000000004008f0 in func5 () at amd64-invalid-stack-middle.c:32
#2 0x0000000000400900 in func4 () at amd64-invalid-stack-middle.c:38
#3 0x0000000000400910 in func3 () at amd64-invalid-stack-middle.c:44
#4 0x0000000000400928 in func2 () at amd64-invalid-stack-middle.c:50
Cannot access memory at address 0x2aaaaaab0000
However, frame #4 is marked as being the end of the stack unwind, so a
subsequent request for the backtrace looses the error message, such as:
(gdb) bt
#0 breakpt () at amd64-invalid-stack-middle.c:27
#1 0x00000000004008f0 in func5 () at amd64-invalid-stack-middle.c:32
#2 0x0000000000400900 in func4 () at amd64-invalid-stack-middle.c:38
#3 0x0000000000400910 in func3 () at amd64-invalid-stack-middle.c:44
#4 0x0000000000400928 in func2 () at amd64-invalid-stack-middle.c:50
When fetching the backtrace, or requesting the stack depth using the MI
interface the situation is even worse, the first time a request is made
we encounter the memory error and so the MI returns an error instead of
the correct result, for example:
(gdb) -stack-info-depth
^error,msg="Cannot access memory at address 0x2aaaaaab0000"
Or,
(gdb) -stack-list-frames
^error,msg="Cannot access memory at address 0x2aaaaaab0000"
However, once one of these commands has been used gdb has, internally,
walked the stack and figured that out that frame #4 is the bottom of the
stack, so the second time an MI command is tried you'll get the "expected"
result:
(gdb) -stack-info-depth
^done,depth="5"
Or,
(gdb) -stack-list-frames
^done,stack=[frame={level="0", .. snip lots .. }]
After this patch the MEMORY_ERROR encountered during the frame unwind is
attached to frame #4 as the stop reason, and is displayed in the CLI each
time the backtrace is requested. In the MI, catching the error means that
the "expected" result is returned the first time the MI command is issued.
So, from the CLI the results of the backtrace will be:
(gdb) bt
#0 breakpt () at amd64-invalid-stack-middle.c:27
#1 0x00000000004008f0 in func5 () at amd64-invalid-stack-middle.c:32
#2 0x0000000000400900 in func4 () at amd64-invalid-stack-middle.c:38
#3 0x0000000000400910 in func3 () at amd64-invalid-stack-middle.c:44
#4 0x0000000000400928 in func2 () at amd64-invalid-stack-middle.c:50
Backtrace stopped: Cannot access memory at address 0x2aaaaaab0000
Each and every time that the backtrace is requested, while the MI output
will similarly be consistently:
(gdb) -stack-info-depth
^done,depth="5"
Or,
(gdb) -stack-list-frames
^done,stack=[frame={level="0", .. snip lots .. }]
gdb/ChangeLog:
* frame.c (struct frame_info): Add stop_string field.
(get_prev_frame_always_1): Renamed from get_prev_frame_always.
(get_prev_frame_always): Old content moved into
get_prev_frame_always_1. Call get_prev_frame_always_1 inside
TRY_CATCH, handle MEMORY_ERROR exceptions.
(frame_stop_reason_string): New function definition.
* frame.h (unwind_stop_reason_to_string): Extend comment to
mention frame_stop_reason_string.
(frame_stop_reason_string): New function declaration.
* stack.c (frame_info): Switch to frame_stop_reason_string.
(backtrace_command_1): Switch to frame_stop_reason_string.
* unwind_stop_reason.def: Add UNWIND_MEMORY_ERROR.
(LAST_ENTRY): Changed to UNWIND_MEMORY_ERROR.
* guile/lib/gdb.scm: Add FRAME_UNWIND_MEMORY_ERROR to export list.
gdb/doc/ChangeLog:
* guile.texi (Frames In Guile): Mention FRAME_UNWIND_MEMORY_ERROR.
* python.texi (Frames In Python): Mention
gdb.FRAME_UNWIND_MEMORY_ERROR.
gdb/testsuite/ChangeLog:
* gdb.arch/amd64-invalid-stack-middle.exp: Update expected results.
* gdb.arch/amd64-invalid-stack-top.exp: Likewise.
Andrew Burgess [Wed, 28 May 2014 21:46:33 +0000 (22:46 +0100)]
Rename frame_stop_reason_string to unwind_stop_reason_to_string.
https://sourceware.org/ml/gdb-patches/2014-05/msg00721.html
This function is confusingly named, the "frame_" in the name implies it
somehow is frame dependent, when in reality the function just converts an
'enum unwind_stop_reason' value to a string.
gdb/ChangeLog:
* frame.c (frame_stop_reason_string): Rename to ...
(unwind_stop_reason_to_string): this.
* frame.h (frame_stop_reason_string): Rename to ...
(unwind_stop_reason_to_string): this.
* stack.c (frame_info): Update call to frame_stop_reason_string.
(backtrace_command_1): Likewise.
* guile/scm-frame.c (gdbscm_unwind_stop_reason_string): Likewise.
* python/py-frame.c (gdbpy_frame_stop_reason_string): Likewise.