aboutsummaryrefslogtreecommitdiff
path: root/gdb
AgeCommit message (Collapse)AuthorFilesLines
2014-05-21SCORE: Replace regset_alloc() invocation by a static regset structure.Andreas Arnez3-20/+17
Since this changes makes the only member of the tdep structure obsolete, the tdep structure is removed.
2014-05-21MN10300: Replace regset_alloc() invocations by static regset structures.Andreas Arnez2-9/+19
On this architecture the change may fix a small memory leak.
2014-05-21MIPS: Replace regset_alloc() invocations by static regset structures.Andreas Arnez4-41/+36
After removal of the regset_alloc invocations, the appropriate tdep fields become obsolete and are thus removed.
2014-05-21X86: Replace regset_alloc() invocations by static regset structures.Andreas Arnez8-77/+80
After removal of the regset_alloc invocations, the appropriate tdep fields become obsolete and are thus removed.
2014-05-21ARM: Replace regset_alloc() invocations by static regset structures.Andreas Arnez3-23/+27
After removal of the regset_alloc invocations, the appropriate tdep fields become obsolete and are thus removed.
2014-05-21AARCH64: Replace regset_alloc() invocations by static regset structures.Andreas Arnez3-18/+24
After removal of the regset_alloc invocations, the tdep fields 'gregset' and 'fpregset' become obsolete and are thus removed.
2014-05-21Remove 'arch' field from regset structure.Andreas Arnez10-27/+41
Removes the 'arch' field from the regset structure, since it represents the only "dynamic" data in a regset. It was referenced in some regset supply- and collect routines, to get access to the gdbarch associated with the regset. Naturally, the affected routines always have access to the regcache to be supplied to or collected from. Thus the gdbarch associated with that regcache can be used instead.
2014-05-21Constify regset structures.Andreas Arnez25-39/+71
2014-05-21gdb/testsuite: Handle underlying type in gdb.cp/var-tag.exp.Mark Wielaard2-3/+13
* gdb.cp/var-tag.exp (do_global_tests): Handle underlying type.
2014-05-21Fix TLS access for -static -pthreadJan Kratochvil9-32/+131
I have posted: TLS variables access for -static -lpthread executables https://sourceware.org/ml/libc-help/2014-03/msg00024.html and the GDB patch below has been confirmed as OK for current glibcs. Further work should be done for newer glibcs: Improve TLS variables glibc compatibility https://sourceware.org/bugzilla/show_bug.cgi?id=16954 Still the patch below implements the feature in a fully functional way backward compatible with current glibcs, it depends on the following glibc source line: csu/libc-tls.c main_map->l_tls_modid = 1; gdb/ 2014-05-21 Jan Kratochvil <jan.kratochvil@redhat.com> Fix TLS access for -static -pthread. * linux-thread-db.c (struct thread_db_info): Add td_thr_tlsbase_p. (try_thread_db_load_1): Initialize it. (thread_db_get_thread_local_address): Call it if LM is zero. * target.c (target_translate_tls_address): Remove LM_ADDR zero check. * target.h (struct target_ops) (to_get_thread_local_address): Add load_module_addr comment. gdb/gdbserver/ 2014-05-21 Jan Kratochvil <jan.kratochvil@redhat.com> Fix TLS access for -static -pthread. * gdbserver/thread-db.c (struct thread_db): Add td_thr_tlsbase_p. (thread_db_get_tls_address): Call it if LOAD_MODULE is zero. (thread_db_load_search, try_thread_db_load_1): Initialize it. gdb/testsuite/ 2014-05-21 Jan Kratochvil <jan.kratochvil@redhat.com> Fix TLS access for -static -pthread. * gdb.threads/staticthreads.c <HAVE_TLS> (tlsvar): New. <HAVE_TLS> (thread_function, main): Initialize it. * gdb.threads/staticthreads.exp: Try gdb_compile_pthreads for $have_tls. Add clean_restart. <$have_tls != "">: Check TLSVAR. Message-ID: <20140410115204.GB16411@host2.jankratochvil.net>
2014-05-21Make the dcache (code/stack cache) handle line reading errors betterPedro Alves5-2/+190
The dcache (code/stack cache) is supposed to be transparent, but it's actually not in one case. dcache tries to read chunks (cache lines) at a time off of the target. This may end up trying to read unaccessible or unavailable memory. Currently the caller gets an xfer error in this case. But if the specific bits of memory the caller actually wanted are available and accessible, then the caller should get the memory it wanted, not an error. gdb/ 2014-05-21 Pedro Alves <palves@redhat.com> * dcache.c (dcache_read_memory_partial): If reading the cache line fails, fallback to reading just the memory the caller wanted. gdb/testsuite/ 2014-05-21 Pedro Alves <palves@redhat.com> * gdb.base/dcache-line-read-error.c: New. * gdb.base/dcache-line-read-error.exp: New.
2014-05-20Fix gdb.multi/base.exp failures.Doug Evans2-1/+15
UNRESOLVED: gdb.multi/base.exp: remove-inferiors 2-3 UNRESOLVED: gdb.multi/base.exp: check remove-inferiors gdb is crashing because it's accessing/freeing already freed memory. ==16368== Invalid read of size 4 ==16368== at 0x660A9D: find_pc_section (binutils-gdb/gdb/objfiles.c:1349) ==16368== by 0x663ECB: lookup_minimal_symbol_by_pc_section (binutils-gdb/gdb/minsyms.c:734) ==16368== by 0x5D987A: find_pc_sect_symtab (binutils-gdb/gdb/symtab.c:2153) ==16368== by 0x5D4D77: blockvector_for_pc_sect (binutils-gdb/gdb/block.c:168) ==16368== by 0x5D4F59: block_for_pc_sect (binutils-gdb/gdb/block.c:246) ==16368== by 0x5D4F9B: block_for_pc (binutils-gdb/gdb/block.c:258) ==16368== by 0x734C5D: inline_frame_sniffer (binutils-gdb/gdb/inline-frame.c:218) ==16368== by 0x732104: frame_unwind_try_unwinder (binutils-gdb/gdb/frame-unwind.c:108) ==16368== by 0x73223F: frame_unwind_find_by_frame (binutils-gdb/gdb/frame-unwind.c:159) ==16368== by 0x72D5AA: compute_frame_id (binutils-gdb/gdb/frame.c:453) ==16368== by 0x7300EC: get_prev_frame_if_no_cycle (binutils-gdb/gdb/frame.c:1758) ==16368== by 0x73079A: get_prev_frame_always (binutils-gdb/gdb/frame.c:1931) ==16368== Address 0x5b13500 is 16 bytes inside a block of size 24 free'd ==16368== at 0x403072E: free (valgrind/coregrind/m_replacemalloc/vg_replace_malloc.c:445) ==16368== by 0x762134: xfree (binutils-gdb/gdb/common/common-utils.c:108) ==16368== by 0x65DACF: objfiles_pspace_data_cleanup (binutils-gdb/gdb/objfiles.c:91) ==16368== by 0x75E546: program_spaceregistry_callback_adaptor (binutils-gdb/gdb/progspace.c:45) ==16368== by 0x7644F6: registry_clear_data (binutils-gdb/gdb/registry.c:82) ==16368== by 0x7645AB: registry_container_free_data (binutils-gdb/gdb/registry.c:95) ==16368== by 0x75E5B4: program_space_free_data (binutils-gdb/gdb/progspace.c:45) ==16368== by 0x75E9BA: release_program_space (binutils-gdb/gdb/progspace.c:167) ==16368== by 0x75EB9B: prune_program_spaces (binutils-gdb/gdb/progspace.c:269) ==16368== by 0x75303D: remove_inferior_command (binutils-gdb/gdb/inferior.c:792) ==16368== by 0x50B5FD: do_cfunc (binutils-gdb/gdb/cli/cli-decode.c:107) ==16368== by 0x50E6F2: cmd_func (binutils-gdb/gdb/cli/cli-decode.c:1886) The problem originates from the get_current_arch call in py-progspace.c:py_free_pspace. The inferior associated with the pspace is gone, and the current inferior is a different one and is running. Therefore get_current_arch tries to read the current frame which causes reads of data in the current program space which we've just deleted. * python/py-progspace.c (py_free_pspace): Call target_gdbarch instead of get_current_arch.
2014-05-20Make compare-sections work against all targets; add compare-sections [-r] tests.Pedro Alves11-40/+316
This does two things: 1. Adds a test. Recently compare-sections got a new "-r" switch, but given no test existed for compare-sections, the patch was allowed in with no testsuite addition. This now adds a test for both compare-sections and compare-sections -r. 2. Makes the compare-sections command work against all targets. Currently, compare-sections only works with remote targets, and only those that support the qCRC packet. The patch makes it so that if the target doesn't support accelerating memory verification, then GDB falls back to comparing memory itself. This is of course slower, but it's better than nothing, IMO. While testing against extended-remote GDBserver I noticed that we send the qCRC request to the target if we're connected, but not yet running a program. That can't work of course -- the patch fixes that. This all also goes in the direction of bridging the local/remote parity gap. I didn't decouple 1. from 2., because that would mean that the test would need to handle the case of the target not supporting the command. Tested on x86_64 Fedora 17, native, remote GDBserver, and extended-remote GDBserver. I also hack-disabled qCRC support to make sure the fallback paths in remote.c work. gdb/doc/ 2014-05-20 Pedro Alves <palves@redhat.com> * gdb.texinfo (Memory) <compare-sections>: Generalize comments to not be remote specific. Add cross reference to the qCRC packet. (Separate Debug Files): Update cross reference to the qCRC packet. (General Query Packets) <qCRC packet>: Add anchor. gdb/ 2014-05-20 Pedro Alves <palves@redhat.com> * NEWS: Mention that compare-sections now works with all targets. * remote.c (PACKET_qCRC): New enum value. (remote_verify_memory): Don't send qCRC if the target has no execution. Use packet_support/packet_ok. If the target doesn't support the qCRC packet, fallback to a deep memory copy. (compare_sections_command): Say "target image" instead of "remote executable". (_initialize_remote): Add PACKET_qCRC to the list of config packets that have no associated command. Extend comment. * target.c (simple_verify_memory, default_verify_memory): New function. * target.h (struct target_ops) <to_verify_memory>: Default to default_verify_memory. (simple_verify_memory): New declaration. * target-delegates.c: Regenerate. gdb/testsuite/ 2014-05-20 Pedro Alves <palves@redhat.com> * gdb.base/compare-sections.c: New file. * gdb.base/compare-sections.exp: New file.
2014-05-20[GDBserver] Make Zx/zx packet handling idempotent.Pedro Alves25-411/+1300
This patch fixes hardware breakpoint regressions exposed by my fix for "PR breakpoints/7143 - Watchpoint does not trigger when first set", at https://sourceware.org/ml/gdb-patches/2014-03/msg00167.html The testsuite caught them on Linux/x86_64, at least. gdb.sum: gdb.sum: FAIL: gdb.base/hbreak2.exp: next over recursive call FAIL: gdb.base/hbreak2.exp: backtrace from factorial(5.1) FAIL: gdb.base/hbreak2.exp: continue until exit at recursive next test gdb.log: (gdb) next Program received signal SIGTRAP, Trace/breakpoint trap. factorial (value=4) at ../../../src/gdb/testsuite/gdb.base/break.c:113 113 if (value > 1) { /* set breakpoint 7 here */ (gdb) FAIL: gdb.base/hbreak2.exp: next over recursive call Actually, that patch just exposed a latent issue to "breakpoints always-inserted off" mode, not really caused it. After that patch, GDB no longer removes breakpoints at each internal event, thus making some scenarios behave like breakpoint always-inserted on. The bug is easy to trigger with always-inserted on. The issue is that since the target-side breakpoint conditions support, if the stub/server supports evaluating breakpoint conditions on the target side, then GDB is sending duplicate Zx packets to the target without removing them before, and GDBserver is not really expecting that for Z packets other than Z0/z0. E.g., with "set breakpoint always-inserted on" and "set debug remote 1": (gdb) b main Sending packet: $m410943,1#ff...Packet received: 48 Breakpoint 4 at 0x410943: file ../../../src/gdb/gdbserver/server.c, line 3028. Sending packet: $Z0,410943,1#48...Packet received: OK ^^^^^^^^^^^^ (gdb) b main Note: breakpoint 4 also set at pc 0x410943. Sending packet: $m410943,1#ff...Packet received: 48 Breakpoint 5 at 0x410943: file ../../../src/gdb/gdbserver/server.c, line 3028. Sending packet: $Z0,410943,1#48...Packet received: OK ^^^^^^^^^^^^ (gdb) b main Note: breakpoints 4 and 5 also set at pc 0x410943. Sending packet: $m410943,1#ff...Packet received: 48 Breakpoint 6 at 0x410943: file ../../../src/gdb/gdbserver/server.c, line 3028. Sending packet: $Z0,410943,1#48...Packet received: OK ^^^^^^^^^^^^ (gdb) del Delete all breakpoints? (y or n) y Sending packet: $Z0,410943,1#48...Packet received: OK Sending packet: $Z0,410943,1#48...Packet received: OK Sending packet: $z0,410943,1#68...Packet received: OK And for Z1, similarly: (gdb) hbreak main Sending packet: $m410943,1#ff...Packet received: 48 Hardware assisted breakpoint 4 at 0x410943: file ../../../src/gdb/gdbserver/server.c, line 3028. Sending packet: $Z1,410943,1#49...Packet received: OK ^^^^^^^^^^^^ Packet Z1 (hardware-breakpoint) is supported (gdb) hbreak main Note: breakpoint 4 also set at pc 0x410943. Sending packet: $m410943,1#ff...Packet received: 48 Hardware assisted breakpoint 5 at 0x410943: file ../../../src/gdb/gdbserver/server.c, line 3028. Sending packet: $Z1,410943,1#49...Packet received: OK ^^^^^^^^^^^^ (gdb) hbreak main Note: breakpoints 4 and 5 also set at pc 0x410943. Sending packet: $m410943,1#ff...Packet received: 48 Hardware assisted breakpoint 6 at 0x410943: file ../../../src/gdb/gdbserver/server.c, line 3028. Sending packet: $Z1,410943,1#49...Packet received: OK ^^^^^^^^^^^^ (gdb) del Delete all breakpoints? (y or n) y Sending packet: $Z1,410943,1#49...Packet received: OK ^^^^^^^^^^^^ Sending packet: $Z1,410943,1#49...Packet received: OK ^^^^^^^^^^^^ Sending packet: $z1,410943,1#69...Packet received: OK ^^^^^^^^^^^^ So GDB sent a bunch of Z1 packets, and then when finally removing the breakpoint, only one z1 packet was sent. On the GDBserver side (with monitor set debug-hw-points 1), in the Z1 case, we see: $ ./gdbserver :9999 ./gdbserver Process ./gdbserver created; pid = 8629 Listening on port 9999 Remote debugging from host 127.0.0.1 insert_watchpoint (addr=410943, len=1, type=instruction-execute): CONTROL (DR7): 00000101 STATUS (DR6): 00000000 DR0: addr=0x410943, ref.count=1 DR1: addr=0x0, ref.count=0 DR2: addr=0x0, ref.count=0 DR3: addr=0x0, ref.count=0 insert_watchpoint (addr=410943, len=1, type=instruction-execute): CONTROL (DR7): 00000101 STATUS (DR6): 00000000 DR0: addr=0x410943, ref.count=2 DR1: addr=0x0, ref.count=0 DR2: addr=0x0, ref.count=0 DR3: addr=0x0, ref.count=0 insert_watchpoint (addr=410943, len=1, type=instruction-execute): CONTROL (DR7): 00000101 STATUS (DR6): 00000000 DR0: addr=0x410943, ref.count=3 DR1: addr=0x0, ref.count=0 DR2: addr=0x0, ref.count=0 DR3: addr=0x0, ref.count=0 insert_watchpoint (addr=410943, len=1, type=instruction-execute): CONTROL (DR7): 00000101 STATUS (DR6): 00000000 DR0: addr=0x410943, ref.count=4 DR1: addr=0x0, ref.count=0 DR2: addr=0x0, ref.count=0 DR3: addr=0x0, ref.count=0 insert_watchpoint (addr=410943, len=1, type=instruction-execute): CONTROL (DR7): 00000101 STATUS (DR6): 00000000 DR0: addr=0x410943, ref.count=5 DR1: addr=0x0, ref.count=0 DR2: addr=0x0, ref.count=0 DR3: addr=0x0, ref.count=0 remove_watchpoint (addr=410943, len=1, type=instruction-execute): CONTROL (DR7): 00000101 STATUS (DR6): 00000000 DR0: addr=0x410943, ref.count=4 DR1: addr=0x0, ref.count=0 DR2: addr=0x0, ref.count=0 DR3: addr=0x0, ref.count=0 That's one insert_watchpoint call for each Z1 packet, and then one remove_watchpoint call for the z1 packet. Notice how ref.count increased for each insert_watchpoint call, and then in the end, after GDB told GDBserver to forget about the hardware breakpoint, GDBserver ends with the the first debug register still with ref.count=4! IOW, the hardware breakpoint is left armed on the target, while on the GDB end it's gone. If the program happens to execute 0x410943 afterwards, then the CPU traps, GDBserver reports the trap to GDB, and GDB not having a breakpoint set at that address anymore, reports to the user a spurious SIGTRAP. This is exactly what is happening in the hbreak2.exp test, though in that case, it's a shared library event that triggers a breakpoint_re_set, when breakpoints are still inserted (because nowadays GDB doesn't remove breakpoints while handling internal events), and that recreates breakpoint locations, which likewise forces breakpoint reinsertion and Zx packet resends... That is a lot of bogus Zx duplication that should possibly be addressed on the GDB side. GDB resends Zx packets because the way to change the target-side condition, is to resend the breakpoint to the server with the new condition. (That's an option in the packet: e.g., "Z1,410943,1;X3,220027" for "hbreak main if 0". The packets in the examples above are shorter because the breakpoints don't have conditions attached). GDB doesn't remove the breakpoint first before reinserting it because that'd be bad for non-stop, as it'd open a window where the inferior could miss the breakpoint. The conditions actually haven't changed between the resends, but GDB isn't smart enough to realize that. (TBC, if the target doesn't support target-side conditions, then GDB doesn't trigger these resends (init_bp_location calls mark_breakpoint_location_modified, and that does nothing if condition evaluation is on the host side. The resends are caused by the 'loc->condition_changed = condition_modified.' line.) But, even if GDB was made smarter, GDBserver should really still handle the resends anyway. So target-side conditions also aren't really to blame. The documentation of the Z/z packets says: "To avoid potential problems with duplicate packets, the operations should be implemented in an idempotent way." As such, we may want to fix GDB, but we should definitely fix GDBserver. The fix is a prerequisite for target-side conditions on hardware breakpoints anyway (and while at it, on watchpoints too). GDBserver indeed already treats duplicate Z0 packets in an idempotent way. mem-break.c has the concept of high-level and low-level breakpoints, somewhat similar to GDB's split of breakpoints vs breakpoint locations, and keeps track of multiple breakpoints referencing the same address/location, for the case of an internal GDBserver breakpoint or a tracepoint being set at the same address as a GDB breakpoint. But, it only allows GDB to ever contribute one reference to a software breakpoint location. IOW, if gdbserver sees a Z0 packet for the same address where it already had a GDB breakpoint set, then GDBserver won't create another high-level GDB breakpoint. However, mem-break.c only tracks GDB Z0 breakpoints. The same logic should apply to all kinds of Zx packets. Currently, gdbserver passes down each duplicate Zx (other than Z0) request directly to the target->insert_point routine. The x86 watchpoint support itself refcounts watchpoint / hw breakpoint requests, to handle overlapping watchpoints, and save debug registers. But that code doesn't (and really shouldn't) handle the duplicate requests, assuming that for each insert there will be a corresponding remove. So the fix is to generalize mem-break.c to track all kinds of Zx breakpoints, and filter out duplicates. As mentioned, this ends up adding support for target-side conditions on hardware breakpoints and watchpoints too (though GDB itself doesn't support the latter yet). Probably the least obvious change in the patch is that it kind of turns the breakpoint insert/remove APIs inside out. Before, the target methods were only called for GDB breakpoints. The internal breakpoint set/delete methods inserted memory breakpoints directly bypassing the insert/remove target methods. That's not good when the target should use a debug API to set software breakpoints, instead of relying on GDBserver patching memory with breakpoint instructions, as is the case of NTO. Now removal/insertion of all kinds of breakpoints/watchpoints, either internal, or from GDB, always go through the target methods. The insert_point/remove_point methods no longer get passed a Z packet type, but an internal/raw breakpoint type. They're also passed a pointer to the raw breakpoint itself (note that's still opaque outside mem-break.c), so that insert_memory_breakpoint / remove_memory_breakpoint have access to the breakpoint's shadow buffer. I first tried passing down a new structure based on GDB's "struct bp_target_info" (actually with that name exactly), but then decided against it as unnecessary complication. As software/memory breakpoints work by poking at memory, when setting a GDB Z0 breakpoint (but not internal breakpoints, as those can assume the conditions are already right), we need to tell the target to prepare to access memory (which on Linux means stop threads). If that operation fails, we need to return error to GDB. Seeing an error, if this is the first breakpoint of that type that GDB tries to insert, GDB would then assume the breakpoint type is supported, but it may actually not be. So we need to check whether the type is supported at all before preparing to access memory. And to solve that, the patch adds a new target->supports_z_point_type method that is called before actually trying to insert the breakpoint. Other than that, hopefully the change is more or less obvious. New test added that exercises the hbreak2.exp regression in a more direct way, without relying on a breakpoint re-set happening before main is reached. Tested by building GDBserver for: aarch64-linux-gnu arm-linux-gnueabihf i686-pc-linux-gnu i686-w64-mingw32 m68k-linux-gnu mips-linux-gnu mips-uclinux nios2-linux-gnu powerpc-linux-gnu sh-linux-gnu tilegx-unknown-linux-gnu x86_64-redhat-linux x86_64-w64-mingw32 And also regression tested on x86_64 Fedora 20. gdb/gdbserver/ 2014-05-20 Pedro Alves <palves@redhat.com> * linux-aarch64-low.c (aarch64_insert_point) (aarch64_remove_point): No longer check whether the type is supported here. Adjust to new interface. (the_low_target): Install aarch64_supports_z_point_type as supports_z_point_type method. * linux-arm-low.c (raw_bkpt_type_to_arm_hwbp_type): New function. (arm_linux_hw_point_initialize): Take an enum raw_bkpt_type instead of a Z packet char. Adjust. (arm_supports_z_point_type): New function. (arm_insert_point, arm_remove_point): Adjust to new interface. (the_low_target): Install arm_supports_z_point_type. * linux-crisv32-low.c (cris_supports_z_point_type): New function. (cris_insert_point, cris_remove_point): Adjust to new interface. Don't check whether the type is supported here. (the_low_target): Install cris_supports_z_point_type. * linux-low.c (linux_supports_z_point_type): New function. (linux_insert_point, linux_remove_point): Adjust to new interface. * linux-low.h (struct linux_target_ops) <insert_point, remove_point>: Take an enum raw_bkpt_type instead of a char. Add raw_breakpoint pointer parameter. <supports_z_point_type>: New method. * linux-mips-low.c (mips_supports_z_point_type): New function. (mips_insert_point, mips_remove_point): Adjust to new interface. Use mips_supports_z_point_type. (the_low_target): Install mips_supports_z_point_type. * linux-ppc-low.c (the_low_target): Install NULL as supports_z_point_type method. * linux-s390-low.c (the_low_target): Install NULL as supports_z_point_type method. * linux-sparc-low.c (the_low_target): Install NULL as supports_z_point_type method. * linux-x86-low.c (x86_supports_z_point_type): New function. (x86_insert_point): Adjust to new insert_point interface. Use insert_memory_breakpoint. Adjust to new i386_low_insert_watchpoint interface. (x86_remove_point): Adjust to remove_point interface. Use remove_memory_breakpoint. Adjust to new i386_low_remove_watchpoint interface. (the_low_target): Install x86_supports_z_point_type. * lynx-low.c (lynx_target_ops): Install NULL as supports_z_point_type callback. * nto-low.c (nto_supports_z_point_type): New. (nto_insert_point, nto_remove_point): Adjust to new interface. (nto_target_ops): Install nto_supports_z_point_type. * mem-break.c: Adjust intro comment. (struct raw_breakpoint) <raw_type, size>: New fields. <inserted>: Update comment. <shlib_disabled>: Delete field. (enum bkpt_type) <gdb_breakpoint>: Delete value. <gdb_breakpoint_Z0, gdb_breakpoint_Z1, gdb_breakpoint_Z2, gdb_breakpoint_Z3, gdb_breakpoint_Z4>: New values. (raw_bkpt_type_to_target_hw_bp_type): New function. (find_enabled_raw_code_breakpoint_at): New function. (find_raw_breakpoint_at): New type and size parameters. Use them. (insert_memory_breakpoint): New function, based off set_raw_breakpoint_at. (remove_memory_breakpoint): New function. (set_raw_breakpoint_at): Reimplement. (set_breakpoint): New, based on set_breakpoint_at. (set_breakpoint_at): Reimplement. (delete_raw_breakpoint): Go through the_target->remove_point instead of assuming memory breakpoints. (find_gdb_breakpoint_at): Delete. (Z_packet_to_bkpt_type, Z_packet_to_raw_bkpt_type): New functions. (find_gdb_breakpoint): New function. (set_gdb_breakpoint_at): Delete. (z_type_supported): New function. (set_gdb_breakpoint_1): New function, loosely based off set_gdb_breakpoint_at. (check_gdb_bp_preconditions, set_gdb_breakpoint): New functions. (delete_gdb_breakpoint_at): Delete. (delete_gdb_breakpoint_1): New function, loosely based off delete_gdb_breakpoint_at. (delete_gdb_breakpoint): New function. (clear_gdb_breakpoint_conditions): Rename to ... (clear_breakpoint_conditions): ... this. Don't handle a NULL breakpoint. (add_condition_to_breakpoint): Make static. (add_breakpoint_condition): Take a struct breakpoint pointer instead of an address. Adjust. (gdb_condition_true_at_breakpoint): Rename to ... (gdb_condition_true_at_breakpoint_z_type): ... this, and add z_type parameter. (gdb_condition_true_at_breakpoint): Reimplement. (add_breakpoint_commands): Take a struct breakpoint pointer instead of an address. Adjust. (gdb_no_commands_at_breakpoint): Rename to ... (gdb_no_commands_at_breakpoint_z_type): ... this. Add z_type parameter. Return true if no breakpoint was found. Change debug output. (gdb_no_commands_at_breakpoint): Reimplement. (run_breakpoint_commands): Rename to ... (run_breakpoint_commands_z_type): ... this. Add z_type parameter, and change return type to boolean. (run_breakpoint_commands): New function. (gdb_breakpoint_here): Also check for Z1 breakpoints. (uninsert_raw_breakpoint): Don't try to reinsert a disabled breakpoint. Go through the_target->remove_point instead of assuming memory breakpoint. (uninsert_breakpoints_at, uninsert_all_breakpoints): Uninsert software and hardware breakpoints. (reinsert_raw_breakpoint): Go through the_target->insert_point instead of assuming memory breakpoint. (reinsert_breakpoints_at, reinsert_all_breakpoints): Reinsert software and hardware breakpoints. (check_breakpoints, breakpoint_here, breakpoint_inserted_here): Check both software and hardware breakpoints. (validate_inserted_breakpoint): Assert the breakpoint is a software breakpoint. Set the inserted flag to -1 instead of setting shlib_disabled. (delete_disabled_breakpoints): Adjust. (validate_breakpoints): Only validate software breakpoints. Adjust to inserted flag change. (check_mem_read, check_mem_write): Skip breakpoint types other than software breakpoints. Adjust to inserted flag change. * mem-break.h (enum raw_bkpt_type): New enum. (raw_breakpoint, struct process_info): Forward declare. (Z_packet_to_target_hw_bp_type): Delete declaration. (raw_bkpt_type_to_target_hw_bp_type, Z_packet_to_raw_bkpt_type) (set_gdb_breakpoint, delete_gdb_breakpoint) (clear_breakpoint_conditions): New declarations. (set_gdb_breakpoint_at, clear_gdb_breakpoint_conditions): Delete. (breakpoint_inserted_here): Update comment. (add_breakpoint_condition, add_breakpoint_commands): Replace address parameter with a breakpoint pointer parameter. (gdb_breakpoint_here): Update comment. (delete_gdb_breakpoint_at): Delete. (insert_memory_breakpoint, remove_memory_breakpoint): Declare. * server.c (process_point_options): Take a struct breakpoint pointer instead of an address. Adjust. (process_serial_event) <Z/z packets>: Use set_gdb_breakpoint and delete_gdb_breakpoint. * spu-low.c (spu_target_ops): Install NULL as supports_z_point_type method. * target.h: Include mem-break.h. (struct target_ops) <prepare_to_access_memory>: Update comment. <supports_z_point_type>: New field. <insert_point, remove_point>: Take an enum raw_bkpt_type argument instead of a char. Also take a raw breakpoint pointer. * win32-arm-low.c (the_low_target): Install NULL as supports_z_point_type. * win32-i386-low.c (i386_supports_z_point_type): New function. (i386_insert_point, i386_remove_point): Adjust to new interface. (the_low_target): Install i386_supports_z_point_type. * win32-low.c (win32_supports_z_point_type): New function. (win32_insert_point, win32_remove_point): Adjust to new interface. (win32_target_ops): Install win32_supports_z_point_type. * win32-low.h (struct win32_target_ops): <supports_z_point_type>: New method. <insert_point, remove_point>: Take an enum raw_bkpt_type argument instead of a char. Also take a raw breakpoint pointer. gdb/testsuite/ 2014-05-20 Pedro Alves <palves@redhat.com> * gdb.base/break-idempotent.c: New file. * gdb.base/break-idempotent.exp: New file.
2014-05-20[GDBserver] Move Z packet defines and type convertion routines to shared code.Pedro Alves9-81/+62
The Aarch64, MIPS and x86 Linux backends all have Z packet number defines and corresponding protocol number to internal type convertion routines. Factor them all out to gdbserver's core code, so we only have one shared copy. Tested on x86_64 Fedora 20, and also cross built for aarch64-linux-gnu and mips-linux-gnu. gdb/gdbserver/ 2014-05-20 Pedro Alves <palves@redhat.com> * mem-break.h: Include break-common.h. (Z_PACKET_SW_BP, Z_PACKET_HW_BP, Z_PACKET_WRITE_WP) (Z_PACKET_READ_WP, Z_PACKET_ACCESS_WP): New defines. (Z_packet_to_target_hw_bp_type): New declaration. * mem-break.c (Z_packet_to_target_hw_bp_type): New function. * i386-low.c (Z_PACKET_HW_BP, Z_PACKET_WRITE_WP, Z_PACKET_READ_WP) (Z_PACKET_ACCESS_WP): Delete macros. (Z_packet_to_hw_type): Delete function. * i386-low.h: Don't include break-common.h here. (Z_packet_to_hw_type): Delete declaration. * linux-x86-low.c (x86_insert_point, x86_insert_point): Call Z_packet_to_target_hw_bp_type instead of Z_packet_to_hw_type. * win32-i386-low.c (i386_insert_point, i386_remove_point): Call Z_packet_to_target_hw_bp_type instead of Z_packet_to_hw_type. * linux-aarch64-low.c: Don't include break-common.h here. (Z_PACKET_SW_BP, Z_PACKET_HW_BP, Z_PACKET_WRITE_WP) (Z_PACKET_READ_WP, Z_PACKET_ACCESS_WP): Delete macros. (Z_packet_to_target_hw_bp_type): Delete function. * linux-mips-low.c (rsp_bp_type_to_target_hw_bp_type): Delete function. (mips_insert_point, mips_remove_point): Use Z_packet_to_target_hw_bp_type.
2014-05-20[GDBserver][AArch64] Make watchpoint support use target_hw_bp_type.Pedro Alves2-39/+82
This makes linux-aarch64-low.c use target_hw_bp_type, like gdb's aarch64-linux-nat.c. The original motivation is decoupling insert_point/remove_point from Z packet numbers, but I think making the files a little bit more similar is a good thing on its own right. Ideally we'd merge these files even... The aarch64_point_encode_ctrl_reg change is taken straight from GDB's copy. I confirmed with a cross compiler that this builds, but it's otherwise untested. gdb/gdbserver/ 2014-05-20 Pedro Alves <palves@redhat.com> * linux-aarch64-low.c: Include break-common.h. (enum target_point_type): Delete. (Z_packet_to_point_type): Rename to ... (Z_packet_to_target_hw_bp_type): ... this, and return a target_hw_bp_type instead. (aarch64_show_debug_reg_state): Take an enum target_hw_bp_type instead of an enum target_point_type. (aarch64_point_encode_ctrl_reg): Likewise. Compute type mask from breakpoint type. (aarch64_dr_state_insert_one_point) (aarch64_dr_state_remove_one_point, aarch64_handle_breakpoint) (aarch64_handle_aligned_watchpoint) (aarch64_handle_unaligned_watchpoint, aarch64_handle_watchpoint): Take an enum target_hw_bp_type instead of an enum target_point_type. (aarch64_supports_z_point_type): New function. (aarch64_insert_point, aarch64_remove_point): Use it. Adjust to use Z_packet_to_target_hw_bp_type.
2014-05-20Do not build gdbserver with -Werror by default if development=falseJoel Brobecker3-4/+10
On GDB release branches, we change $development in gdb/development.sh to false, in order to build the GDB release without -Werror by default, thus avoiding harmless compiler warnings from breaking the build of someone who's only interested in building GDB rather than working on it. This patch implements the same strategy for gdbserver, using the exact same method. gdb/gdbserver/ChangeLog: * configure.ac: Only use -Werror by default when DEVELOPMENT is true. * configure: Regenerate. Tested on x86_64-linux, by rebuilding GDBserver first with development set to true, and then doing it again with development set to false. Werror was used in the first case, but not in the second.
2014-05-20btrace: no replay without historyMarkus Metzger4-0/+58
When using a reverse execution command without execution history, GDB might end up in a state where replaying has been started but remains at the current instruction. This state is illegal. Do not step if there is no execution history to avoid this. 2014-05-20 Markus Metzger <markus.t.metzger@intel.com> * record-btrace.c (record_btrace_step_thread): Check for empty history. testsuite/ * gdb.btrace/nohist.exp: New.
2014-05-20Set timeout for gdb.reverse/*.exp test casesYao Qi3-0/+21
Hi, This patch is to add a new board setting gdb_reverse_timeout, which is used to set timeout for all gdb.reverse test cases, which are usually very slow and cause some TIMEOUT failures, for example, on some arm boards. We have some alternatives to this approach, but I am not satisfied with them: - Increase the timeout value. This is the global change, and it may cause some delay where actual failures happen. - Set timeout by gdb_reverse_timeout in every gdb.reverse/*.exp. Then, we have to touch every file under gdb.reverse. In this patch, we choose a central place to set timeout for all tests in gdb.reverse, which is convenient. gdb/testsuite: 2014-05-20 Yao Qi <yao@codesourcery.com> * lib/gdb.exp (gdb_init): Set timeout if test file is under gdb.reverse directory and gdb_reverse_timeout exists in board setting. * README: Document gdb_reverse_timeout.
2014-05-20gdb_init argument ARGS is a string rather than a listYao Qi2-10/+12
The argument ARGS of gdb_init is passed from dejagnu is a string, the test file name. In dejagnu/runtest.exp: proc runtest { test_file_name } { .... .... if [info exists tool] { if { [info procs "${tool}_init"] != "" } { ${tool}_init $test_file_name; } } .... } but inn default_gdb_init (callee of gdb_init), we have set gdb_test_file_name [file rootname [file tail [lindex $args 0]]] In tcl, all actual arguments are combined to a list and assigned to args. This code here isn't wrong, but unnecessary, because its caller (proc runtest) only passes one string to it, and IMO, we don't need such tricky tcl "args". I doubt that "[lindex $args 0]" is to be backward compatible with old dejagnu, but dejagnu-1.4 release started to pass $test_file_name to ${too}_init, as I showed above. dejagnu-1.4 was released in 2001, and it should be old enough. I also tried to check whether gdb testusite works with dejagnu-1.3 or not, but failed to build dejagnu-1.3 on my machine. Supposing GDB testsuite requires at least dejagnu-1.4, this change should be safe. This patch is update default_gdb_init to treat ARGS as a string instead of a list. Then, 'args' sounds like a list, and this patch also renames it by 'test_file_name', to align with dejagnu. gdb/testsuite: 2014-05-20 Yao Qi <yao@codesourcery.com> * lib/gdb.exp (default_gdb_init): Rename argument 'args' by 'test_file_name'. Treat args as a string instead of a list. (gdb_init): Rename argument 'args' by 'test_file_name'.
2014-05-20Fix issue #15778: GDB Aarch64 signal frame unwinder issueHui Zhu2-29/+41
The root cause of this issue is unwinder of "#3 <signal handler called>" doesn't supply right values of registers. When GDB want to get the previous frame of "#3 <signal handler called>", it will call cache init function of unwinder "aarch64_linux_sigframe_init". The address or the value of the registers is get from this function. So the bug is inside thie function. I check the asm code of "#3 <signal handler called>": (gdb) frame 3 (gdb) p $pc $1 = (void (*)()) 0x7f931fa4d0 (gdb) disassemble $pc, +10 Dump of assembler code from 0x7f931fa4d0 to 0x7f931fa4da: => 0x0000007f931fa4d0: mov x8, #0x8b // #139 0x0000007f931fa4d4: svc #0x0 0x0000007f931fa4d8: nop This is the syscall sys_rt_sigreturn, Linux kernel function "restore_sigframe" will set the frame: for (i = 0; i < 31; i++) __get_user_error(regs->regs[i], &sf->uc.uc_mcontext.regs[i], err); __get_user_error(regs->sp, &sf->uc.uc_mcontext.sp, err); __get_user_error(regs->pc, &sf->uc.uc_mcontext.pc, err); The struct of uc_mcontext is: struct sigcontext { __u64 fault_address; /* AArch64 registers */ __u64 regs[31]; __u64 sp; __u64 pc; __u64 pstate; /* 4K reserved for FP/SIMD state and future expansion */ __u8 __reserved[4096] __attribute__((__aligned__(16))); }; But in GDB function "aarch64_linux_sigframe_init", the code the get address of registers is: for (i = 0; i < 31; i++) { trad_frame_set_reg_addr (this_cache, AARCH64_X0_REGNUM + i, sigcontext_addr + AARCH64_SIGCONTEXT_XO_OFFSET + i * AARCH64_SIGCONTEXT_REG_SIZE); } trad_frame_set_reg_addr (this_cache, AARCH64_FP_REGNUM, fp); trad_frame_set_reg_addr (this_cache, AARCH64_LR_REGNUM, fp + 8); trad_frame_set_reg_addr (this_cache, AARCH64_PC_REGNUM, fp + 8); The code that get pc and sp is not right, so I change the code according to Linux kernel code: trad_frame_set_reg_addr (this_cache, AARCH64_SP_REGNUM, sigcontext_addr + AARCH64_SIGCONTEXT_XO_OFFSET + 31 * AARCH64_SIGCONTEXT_REG_SIZE); trad_frame_set_reg_addr (this_cache, AARCH64_PC_REGNUM, sigcontext_addr + AARCH64_SIGCONTEXT_XO_OFFSET + 32 * AARCH64_SIGCONTEXT_REG_SIZE); The issue was fixed by this change, and I did the regression test. It also fixed a lot of other XFAIL and FAIL. 2014-05-20 Hui Zhu <hui@codesourcery.com> Yao Qi <yao@codesourcery.com> PR backtrace/16558 * aarch64-linux-tdep.c (aarch64_linux_sigframe_init): Update comments and change address of sp and pc.
2014-05-19build_type_unit_groups and moved closer to only caller and renamedDoug Evans2-158/+164
* dwarf2read.c (build_type_psymtabs_1): Renamed from build_type_unit_groups and moved closer to only caller. Remove arguments. All references updated. Remove outdated .gdb_index comment. (struct tu_abbrev_offset, sort_tu_by_abbrev_offset): Move with build_type_psymtabs_1.
2014-05-19fix two latent type errorsTom Tromey3-4/+7
I'm checking this in as obvious. I was looking at instances of "alloc.*sizeof" and noticed a couple where the types in question are incorrect. In gdbtypes, the code allocates sizeof(int) to represent a struct rank. In mi-cmds, the code uses "struct mi_cmd **" -- one "*" too many. In both cases the problems are latent because in practice the sizes are the same as the sizes of the correct types. Still, it's better to be correct. I think gdb would be improved by a wholesale change from explicit sizeofs to using the libiberty.h allocation macros. In most cases they are both shorter and have better type safety. However, the resulting patch is rather large. Built and regtested on x86-64 Fedora 20. 2014-05-19 Tom Tromey <tromey@redhat.com> * gdbtypes.c (rank_function): Use XNEWVEC. * mi/mi-cmds.c (build_table): Use XCNEWVEC.
2014-05-19Remove all_type_unit_groups, unused.Doug Evans2-79/+31
* dwarf2read.c (struct dwarf2_per_objfile): Delete unused members n_type_unit_groups, all_type_unit_groups. All uses removed. (get_type_unit_group, build_type_unit_groups): Delete forward decls. (dw2_get_cutu): Renamed from dw2_get_cu. All callers updated. (dw2_get_cu): Renamed from dw2_get_primary_cu. All callers updated. (add_type_unit_group_to_table): Delete.
2014-05-19Fix gdbserver qGetTLSAddr for x86_64 -m32Jan Kratochvil2-0/+11
gdbserver makes libthread_db to access uninitialized memory. Surprisingly it does not harm normally, even -fsanitize=address works with current gdbserver. I have found just valgrind detects it as a very first warning for gdbserver: Syscall param ptrace(addr) contains uninitialised byte(s) at 0x3721EECEBE: ptrace (ptrace.c:45) by 0x436EE5: ps_get_thread_area (linux-x86-low.c:252) by 0x5559D02: __td_ta_lookup_th_unique (td_ta_map_lwp2thr.c:157) by 0x5559EC3: td_ta_map_lwp2thr (td_ta_map_lwp2thr.c:207) by 0x43F87D: find_one_thread (thread-db.c:281) by 0x440038: thread_db_get_tls_address (thread-db.c:505) by 0x40F6D0: handle_query (server.c:2004) by 0x4124CF: process_serial_event (server.c:3445) by 0x4136B6: handle_serial_event (server.c:3889) by 0x419571: handle_file_event (event-loop.c:434) by 0x418D38: process_event (event-loop.c:189) by 0x419AB7: start_event_loop (event-loop.c:552) Reproducible with: cd gdb/testsuite g++ -o gdb.threads/tls gdb.threads/tls{,2}.c -m32 -pthread ../gdbserver/gdbserver :1234 gdb.threads/tls ../gdb -batch gdb.threads/tls -ex 'target remote :1234' -ex 'b spin' -ex c -ex 'p a_thread_local' It is more easily reproducible even without valgrind using s/0x00/0xff/ in the attached patch. It will then turn the output of reproducer above: $1 = 0 -> Cannot find thread-local storage for Thread 29044, executable file .../gdb/testsuite/gdb.threads/tls: Remote target failed to process qGetTLSAddr request gdb/gdbserver/ 2014-05-19 Jan Kratochvil <jan.kratochvil@redhat.com> Fix gdbserver qGetTLSAddr for x86_64 -m32. * linux-x86-low.c (X86_64_USER_REGS): New. (x86_fill_gregset): Call memset for BUF first in x86_64 -m32 case. Message-ID: <20140410114901.GA16411@host2.jankratochvil.net>
2014-05-19* eval.c (evaluate_subexp_standard): Add some comments.Doug Evans2-3/+14
2014-05-19[testsuite patch] Test power{5,6,7} disassemblyJan Kratochvil3-0/+324
Power5, Power6 and Power7 disassembly testing. gdb/testsuite/ 2014-05-19 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.arch/powerpc-power.exp: New file. * gdb.arch/powerpc-power.s: New file. Message-ID: <20140514205425.GA15398@host2.jankratochvil.net>
2014-05-17 * progspace.c (remove_program_space): Delete, unused.Doug Evans3-27/+5
* progspace.h (remove_program_space): Ditto.
2014-05-17 * inferior.c (prune_inferiors): Fix comment.Doug Evans2-2/+9
(remove_inferior_command): Call prune_program_spaces.
2014-05-17Copy over changes from guile.texi.Doug Evans2-146/+126
* python.texi (Basic Python) <gdb.execute>: Add text. (Basic Python) <gdb.post_event>: Remove "main" from "main GDB thread". (Values From Inferior) <Python string>: Add text. (Values From Inferior) <Value.string>: Clarify string length handling. (Pretty Printing API): Add cindex. (Types In Python) <TYPE_CODE_*>: Use vtable instead of table. Remove unnecessary index of gdb.TYPE_CODE_*. Replace @findex with @vindex. (Commands In Python) <COMPLETE_*>: Similarly. (Symbols In Python) <SYMBOL_*>: Similarly. (Breakpoints In Python) <WP_*>: Similarly. (Breakpoints In Python) <BP_*>: Similarly.
2014-05-17Improve docs of qfThreadInfo packet.David Taylor2-0/+11
gdb/doc/gdb.texinfo (General Query Packets): Add a note about thread IDs mentioned in the qfThreadInfo reply.
2014-05-16 * gdb.base/completion.exp: Check that all expected files existDoug Evans2-1/+5
before doing file completion.
2014-05-16* gdb.base/Makefile.in (EXECUTABLES): Add completion.Doug Evans2-1/+5
2014-05-16New command line option -D.Doug Evans9-6/+100
* NEWS: Mention it. * main.c (set_gdb_data_directory): New function. (captured_main): Recognize -D. Flag error for --data-directory "". Call set_gdb_data_directory. (print_gdb_help): Print --data-directory, -D. * main.h (set_gdb_data_directory): Declare. * top.c (staged_gdb_datadir): New static global. (set_gdb_datadir): Call set_gdb_data_directory (show_gdb_datadir): New function. (init_main): Update init of data-directory parameter. testsuite/ * gdb.base/catch-syscall.exp (test_catch_syscall_fail_nodatadir): Update. (do_syscall_tests_without_xml): Update. doc/ * gdb.texinfo (Mode Options): Add -D.
2014-05-16Import the "dirfd" gnulib module.Gregory Fong13-22/+1215
2014-05-16 Gregory Fong <gregory.0xf0@gmail.com> Import the "dirfd" gnulib module. * gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add dirfd. * gnulib/aclocal.m4: Update. * gnulib/config.in: Update. * gnulib/configure: Update. * gnulib/import/Makefile.am: Update. * gnulib/import/Makefile.in: Update. * gnulib/import/dirfd.c: New. * gnulib/import/m4/dirfd.m4: New. * gnulib/import/m4/gnulib-cache.m4: Update. * gnulib/import/m4/gnulib-comp.m4: Update.
2014-05-16mi-support.exp: Fix some pastos.Pedro Alves2-4/+9
gdb/testsuite/ 2014-05-16 Pedro Alves <palves@redhat.com> * lib/mi-support.exp (mi_expect_stop): On timeout, say "timeout" instead of "unknown output after running".
2014-05-16Copy file1.txt to remote host in dw2-filename.exp and dw2-anonymous-func.expYao Qi3-0/+17
Some gdb.dwarf2/*.exp tests copy file1.txt to host via gdb_remote_download but dw2-filename.exp and dw2-anonymous-func.exp don't do that. Looks like an oversight in this patch https://sourceware.org/ml/gdb-patches/2013-08/msg00365.html There are some fails in remote host testing. FAIL: gdb.dwarf2/dw2-anonymous-func.exp: list file1.txt FAIL: gdb.dwarf2/dw2-filename.exp: interpreter-exec mi -file-list-exec-source-files FAIL: gdb.dwarf2/dw2-filename.exp: info sources This patch is to invoke gdb_remote_download to copy file1.txt to host and remote it at the end. This patch fixes these fails above. gdb/testsuite: 2014-05-16 Yao Qi <yao@codesourcery.com> * gdb.dwarf2/dw2-filename.exp: Copy file1.txt to host. Remove file1.txt from host at the end. * gdb.dwarf2/dw2-anonymous-func.exp: Likewise.
2014-05-16Fix display of tabulation character for mingw hosts.Yao Qi2-59/+70
Pierre proposed this patch https://sourceware.org/ml/gdb-patches/2013-10/msg00011.html and Tom gave a suggestion that it's better to do check \t in print_wchar <https://sourceware.org/ml/gdb-patches/2013-11/msg00148.html> However, I don't see the follow-up to this discussion. We encounter two fails in printcmds.exp on mingw host, and Pierre's patch fixes them. I pick it up, update a little per Tom's comments, and post it here for review. This patch fixes these fails below on mingw32 host. FAIL: gdb.base/charset.exp: print string in ASCII FAIL: gdb.base/charset.exp: try printing '\t' in ASCII FAIL: gdb.base/charset.exp: print string in ISO-8859-1 FAIL: gdb.base/charset.exp: try printing '\t' in ISO-8859-1 FAIL: gdb.base/charset.exp: print string in UTF-32 FAIL: gdb.base/charset.exp: try printing '\t' in UTF-32 FAIL: gdb.base/printcmds.exp: p ctable1[9] FAIL: gdb.base/printcmds.exp: p &ctable1[1*8] Also regression tested on x86_64-linux. Is it OK? gdb: 2014-05-16 Pierre Muller <muller@sourceware.org> Yao Qi <yao@codesourcery.com> * valprint.c (print_wchar): Move the code on checking whether W is a printable wide char to the default branch of switch statement below. Call wchar_printable instead of gdb_iswprint.
2014-05-16Fix changelong entry.Yao Qi1-1/+1
Each changelog entry should be tab-prefixed.
2014-05-16Fix prologue analysis for ldr.w and ldrd instructionTaimoor Mirza2-2/+7
Prologue analysis for ldr.w and ldrd instruction obtains offset from first two bytes that contains opcode of instruction. It should obtain offset from next two bytes that actually contain operands. * arm-tdep.c (thumb_analyze_prologue): Fix offset calculation for ldr.w and ldrd instructions. Signed-off-by: Taimoor Mirza <tmirza@codesourcery.com>
2014-05-15Make more robust when run in parallel mode.Doug Evans3-3/+18
Since we're not compiling with gcc, we don't know where the DWO file will ultimately be built. It could be built in testsuite/gdb.dwarf2/foo (non-parallel mode) or testsuite/outputs/gdb.dwarf2/foo (parallel mode). * gdb.dwarf2/fission-reread.S: Remove directory from .dwo file path. * gdb.dwarf2/fission-reread.exp: Set debug-file-directory before loading file. Add test for TU lookup.
2014-05-15* dwarf2read.c (read_structure_type): Delete outdated comments.Doug Evans2-9/+8
2014-05-15Fix argument passing in mi_run_cmd_fullSimon Marchi2-1/+18
Passing arguments did not work when use_mi_command was set. gdb/testsuite/ChangeLog: 2014-05-13 Simon Marchi <simon.marchi@ericsson.com> * lib/mi-support.exp (mi_run_cmd_full): Set arguments by calling "-exec-arguments" or "set args" before running the inferior.
2014-05-15Fix mi_expect_stop for non-zero exit codesSimon Marchi2-0/+19
The message displayed by gdb is different when the inferior exits with zero and non-zero values, this fix takes that into account. gdb/testsuite/ChangeLog: 2014-05-13 Simon Marchi <simon.marchi@ericsson.com> * lib/mi-support.exp (mi_expect_stop): Expect message for inferiors that exit with non-zero exit code.
2014-05-14reindent print_macro_definitionTom Tromey2-24/+28
I happened to notice that print_macro_definition is indented improperly. All the lines were a few extra spaces to the right. This patch fixes the indentation. Tested by rebuilding, committed. 2014-05-14 Tom Tromey <tromey@redhat.com> * macrocmd.c (print_macro_definition): Reindent.
2014-05-14Fix mi-file.exp fails on remote hostYao Qi2-2/+13
This patch fixes mi-file.exp fails on remote host. First, we can't assume ${srcdir}/${subdir}/${srcfile} directory exists on remote host, so this patch changes it to match ${srcfile} only on remote host. Second, regexp pattern ".*/${srcfile}" isn't friendly to Windows path. The file name is "basics.c" in my test env and can't match the pattern due to "/" in it. Remove "/" from the pattern. gdb/testsuite: 2014-05-14 Yao Qi <yao@codesourcery.com> * gdb.mi/mi-file.exp (test_file_list_exec_source_file): Don't match absolute path on remote host. (test_file_list_exec_source_files): Remove "/" from the pattern.
2014-05-14Overwrite ${board}_file in local-remote-hostYao Qi2-0/+12
After I run test like this, $ make check RUNTESTFLAGS='--host_board=local-remote-host dw2-basic.exp' gdb.dwarf2/file1.txt in source tree was removed. In some gdb.dwarf2/*.exp, file1.txt is copied to host and then removed at the end. However, in local-remote-host-notty.exp, ${board}_download doesn't copy the file but return the absolute path of the src file. 'remote_file host delete' at the end will remove the file in source tree. This patch is to overwrite ${board}_file, and specially make "delete" option do nothing. This approach is used in gdbserver-base.exp and remote-stdio-gdbserver.exp too. gdb/testsuite: 2014-05-14 Yao Qi <yao@codesourcery.com> * boards/local-remote-host-notty.exp (${board}_file): New proc.
2014-05-13* python/py-cmd.c (cmdpy_completer): Add comment.Doug Evans2-2/+9
(completers): Make const.
2014-05-13Remove unused variableSimon Marchi2-74/+74
should_resume is set to 1 at the beginning and never changed. gdb/ChangeLog: 2014-05-13 Simon Marchi <simon.marchi@ericsson.com> * infrun.c (resume): Remove should_resume (unused). Move up declaration of resume_ptid.
2014-05-13remove an unused macro and an unused declarationTom Tromey2-6/+5
This patch removes an unused macro from language.h. It also removes the declaration of a function which is not defined. I'm checking this in as obvious. Tested by rebuilding. 2014-05-13 Tom Tromey <tromey@redhat.com> * language.h (unop_type_check): Remove. (binop_type_check): Don't declare.