aboutsummaryrefslogtreecommitdiff
path: root/gdb
AgeCommit message (Collapse)AuthorFilesLines
2014-12-02python/py-infthread.c: Whitespace fixes.Doug Evans2-8/+10
gdb/ChangeLog: * python/py-infthread.c: Whitespace fixes.
2014-12-02execl-update-breakpoints.exp: Move whole segment instead of .text sectionAndreas Arnez2-8/+28
The test case builds two copies of the program, one with the compile option "ldflags=-Wl,-Ttext=0x1000000" and the other with the address changed to 0x2000000. However, when linking with ld.bfd, the resulting executables crash early in ld.so on S390 and i386. Analysis of the crash: The default linker script establishes a certain order of loadable sections, and the option "-Ttext" effectively splits these into an "unaffected" lot (everything before .text) and an "affected" lot. The affected lot is placed at the given address, whereas the unaffected lot stays at its default address. The unaffected lot starts at an aligned address plus Elf header sizes, which is good if it is the first LOAD segment (like on AMD64). But if the affected lot comes first instead (like on S390 and i386), the PHDR doesn't fit there and is placed *outside* any LOAD segments. Then the PHDR is not mapped when the loader gets control, and the loader runs into a segmentation fault while trying to access it. Since we are lucky about the order of segments on AMD64, the test succeeds there, but the resulting binaries are unusually large -- 2.1M each, with lots of padding within. When replacing '-Ttext' by '-Ttext-segment', the linker moves all segments consistently, the binaries have normal sizes, and the test case succeeds on all mentioned platforms. Since old versions of the gold linker don't support '-Ttext-segment', the patch also adds logic for falling back to '-Ttext'. gdb/testsuite/ChangeLog: * gdb.base/execl-update-breakpoints.exp: Specify the link address with '-Ttext-segment' instead of '-Ttext'. Fall back to '-Ttext' if the linker doesn't understand this.
2014-12-02S390: Fix 'expedite' for s390-te-linux64Andreas Arnez3-2/+8
Fix a typo in the expedited registers for s390-te-linux64. gdb/ChangeLog: * features/Makefile (s390-te-linux64-expedite): Replace non-existant r14 and r15 by r14l and r15l, respectively. * regformats/s390-te-linux64.dat: Regenerate.
2014-12-01Remove duplicate commentSimon Marchi2-4/+4
gdb/ChangeLog: * objfiles.c (allocate_objfile): Remove duplicate comment.
2014-12-01Fix Python help() test for Python 3Simon Marchi2-1/+5
The message displayed when using help() changed a bit with time, so this adjusts the test accordingly. gdb/testsuite/ChangeLog: * gdb.python/python.exp: Change expected reply to help().
2014-12-01Use core regset iterators on GNU HurdUlrich Weigand4-38/+36
Remove native-only core file handling on GNU Hurd. Instead, enable the x86 target generic core regset logic on the Hurd by providing an appropriate register offset map. Thanks to Samuel Thibault for testing! gdb/ * config/i386/i386gnu.mh (NATDEPFILES): Remove core-regset.o. * i386gnu-nat.c: Do not include <sys/procfs.h> or "gregset.h". (CREG_OFFSET, creg_offset, CREG_ADDR): Remove. (supply_gregset, supply_fpregset): Remove. * i386gnu-tdep.c (i386gnu_gregset_reg_offset): New variable. (i386gnu_init_abi): Set tdep->gregset_reg_offset, gregset_num_regs, and sizeof_gregset.
2014-12-01Don't enable gdbtk in testsuiteYao Qi3-195/+7
When I skim configure.ac and Makefile.in in gdb/testsuite, I happen to see that directory gdb.gdbtk is added to subdirs, however it doesn't exist. gdb/testsuite/gdb.gdbtk was removed by the patch below, [rfa] git repo fixup: delete gdb/testsuite/gdb.gdbtk http://thread.gmane.org/gmane.comp.gdb.patches/61489 and we should cleanup configure.ac accordingly. gdb/testsuite: 2014-12-01 Yao Qi <yao@codesourcery.com> * configure.ac: Remove AC_ARG_ENABLE for gdbtk. Don't invoke AC_CONFIG_SUBDIRS(gdb.gdbtk). * configure: Re-generated.
2014-11-30Add add-auto-load-scripts-directory.Jan Kratochvil5-0/+50
There is already "add-auto-load-safe-path" which works like "set auto-load safe-path" but in append mode. There was missing an append equivalent for "set auto-load scripts-directory". ABRT has directory /var/cache/abrt-di/ as an alternative one to /usr/lib/debug/ . Therefore ABRT needs to use -iex parameters to add this /var/cache/abrt-di/ directory as a first-class debuginfo directory. Using absolute "set auto-load scripts-directory" would hard-code the path possibly overriding local system directory additions; besides it would not be nice anyway. gdb/ChangeLog 2014-11-30 Jan Kratochvil <jan.kratochvil@redhat.com> Add add-auto-load-scripts-directory. * NEWS (Changes since GDB 7.8): Add add-auto-load-scripts-directory. * auto-load.c (add_auto_load_dir): New function. (_initialize_auto_load): Install it. gdb/doc/ChangeLog 2014-11-30 Jan Kratochvil <jan.kratochvil@redhat.com> Add add-auto-load-scripts-directory. * gdb.texinfo (Auto-loading): Add add-auto-load-scripts-directory link. (objfile-gdbdotext file): Add add-auto-load-scripts-directory.
2014-11-30Fix add-auto-load-safe-path typo.Jan Kratochvil2-3/+8
gdb/doc/ChangeLog 2014-11-30 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.texinfo (Auto-loading safe path): Fix add-auto-load-safe-path description typo.
2014-11-30frame.c: Fix the check for FID_STACK_INVALID in frame_id_eq()Martin Galvan2-1/+6
I noticed in frame_id_eq() we were checking for the "l" frame_id being invalid twice instead of checking both "l" and "r", so this patch corrects it. gdb/ChangeLog: * frame.c (frame_id_eq): Fix the check for FID_STACK_INVALID.
2014-11-29Check that thread stack temps are not already enabled before enabling them.Siva Chandra2-1/+7
This fixes a regression introduced by 6c659fc2c7cd2da6d2b9a3d7c38597ad3821832a. gdb/ChangeLog: * eval.c (evaluate_subexp): Check that thread stack temporaries are not already enabled before enabling them.
2014-11-29[arm] compute framereg and framesize when neededYao Qi2-16/+23
I find local variables framereg and framesize is only used when cache isn't NULL. This patch to move the code into "if (cache)" block. gdb: 2014-11-29 Yao Qi <yao@codesourcery.com> * arm-tdep.c (arm_analyze_prologue): Move local variables 'framereg' and 'framesize' to inner block. Move code to inner block too.
2014-11-28Enable chained function calls in C++ expressions.Siva Chandra13-24/+523
gdb/ChangeLog: * eval.c: Include gdbthread.h. (evaluate_subexp): Enable thread stack temporaries before evaluating a complete expression and clean them up after the evaluation is complete. * gdbthread.h: Include common/vec.h. (value_ptr): New typedef. (VEC (value_ptr)): New vector type. (value_vec): New typedef. (struct thread_info): Add new fields stack_temporaries_enabled and stack_temporaries. (enable_thread_stack_temporaries) (thread_stack_temporaries_enabled_p, push_thread_stack_temporary) (get_last_thread_stack_temporary) (value_in_thread_stack_temporaries): Declare. * gdbtypes.c (class_or_union_p): New function. * gdbtypes.h (class_or_union_p): Declare. * infcall.c (call_function_by_hand): Store return values of class type as temporaries on stack. * thread.c (enable_thread_stack_temporaries): New function. (thread_stack_temporaries_enabled_p, push_thread_stack_temporary) (get_last_thread_stack_temporary): Likewise. (value_in_thread_stack_temporaries): Likewise. * value.c (value_force_lval): New function. * value.h (value_force_lval): Declare. gdb/testsuite/ChangeLog: * gdb.cp/chained-calls.cc: New file. * gdb.cp/chained-calls.exp: New file. * gdb.cp/smartp.exp: Remove KFAIL for "p c2->inta".
2014-11-28Fix prints in tests for Python 3Simon Marchi9-30/+41
Python 3's print requires to use parentheses, so this patch adds them where they were missing. gdb/testsuite/ChangeLog: * gdb.ada/py_range.exp: Add parentheses to calls to print. * gdb.dwarf2/symtab-producer.exp: Same. * gdb.gdb/python-interrupts.exp: Same. * gdb.gdb/python-selftest.exp: Same. * gdb.python/py-linetable.exp: Same. * gdb.python/py-type.exp: Same. * gdb.python/py-value-cc.exp: Same. * gdb.python/py-value.exp: Same.
2014-11-28Fix amd64 dwarf register number mapping (MMX register and higher)Pierre Muller2-1/+13
Dwarf register numbers are defined in "System V Application Binary Interface AMD64 Architecture Processor Supplement Draft Version 0.99.6" The amd64_dwarf_regmap array is missing the 8 MMX registers in Figure 3.36: DWARF Register Number Mapping page 57. This leads to a wrong value for the registers past this point. gdb/ChangeLog: Pushed by Joel Brobecker <brobecker@adacore.com>. * amd64-tdep.c (amd64_dwarf_regmap array): Add missing MMX registers. Tested on x86_64-linux.
2014-11-28Remove (dead-code) native core file sniffers on Linux targetsUlrich Weigand5-73/+11
Since Andreas Arnez' recent patch series, all Linux targets install gdbarch_iterate_over_regset_sections routines. This means that on Linux native targets, old-style core sniffers are never used. Most Linux targets haven't been using such sniffers for a long time anyway, but a couple remain: ia64 and sparc use core-regset.o, and m68k installs its own core_fns. All this is now dead code, which this commit removes. gdb/ 2014-11-28 Ulrich Weigand  <uweigand@de.ibm.com> * config/ia64/linux.mh (NATDEPFILES): Remove core-regset.o. * config/sparc/linux.mh (NATDEPFILES): Likewise. * config/sparc/linux64.mh (NATDEPFILES): Likewise. * m68klinux-nat.c (fetch_core_registers): Remove. (linux_elf_core_fns): Remove. (_initialize_m68k_linux_nat): Do not call deprecated_add_core_fns.
2014-11-28gdb_realpath: Rework comment about handling on Windows.Joel Brobecker2-9/+32
Rework the comment to explain why we're still relying on GetFullPathName even though gnulib ensures that canonicalize_file_name is now available on all platforms, including Windows. gdb/ChangeLog: * utils.c (gdb_realpath): Rework comment about handling on Windows.
2014-11-28Import rename moduleYao Qi24-35/+4303
This patch is to import rename module. gdb: 2014-11-28 Yao Qi <yao@codesourcery.com> * gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add rename. * gnulib/aclocal.m4: Re-generated. * gnulib/config.in: Re-generated. * gnulib/configure: Re-generated. * gnulib/import/Makefile.am: Re-generated. * gnulib/import/Makefile.in: Re-generated. * gnulib/import/m4/gnulib-cache.m4: Re-generated. * gnulib/import/m4/gnulib-comp.m4: Re-generated. * import/basename-lgpl.c: New file. * import/dirname-lgpl.c: New file. * import/dirname.h: New file. * import/m4/dirname.m4: New file. * import/m4/malloc.m4: New file. * import/m4/rename.m4: New file. * import/m4/rmdir.m4: New file. * import/m4/stdio_h.m4: New file. * import/malloc.c: New file. * import/rename.c: New file. * import/rmdir.c: New file. * import/same-inode.h: New file. * import/stdio.c: New file. * import/stdio.in.h: New file. * import/stripslash.c: New file.
2014-11-28Use canonicalize_file_name unconditionallyYao Qi5-69/+19
gdb: 2014-11-28 Yao Qi <yao@codesourcery.com> * configure.ac (AC_CHECK_FUNCS): Remove canonicalize_file_name and realpath. * config.in: Re-generated. * configure: Re-generated. * utils.c (gdb_realpath): Remove code calling realpath, canonicalize_file_name and pathconf. [!_WIN32]: Call canonicalize_file_name.
2014-11-28Import canonicalize-lgplYao Qi21-67/+3315
This patch is to import canonicalize-lgpl module, which provides readlpath and canonicalize_file_name. gdb: 2014-11-28 Yao Qi <yao@codesourcery.com> * gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add canonicalize-lgpl. * aclocal.m4: Re-generated. * config.in: Re-generated. * configure: Re-generated. * import/Makefile.am: Re-generated. * import/Makefile.in: Re-generated. * import/m4/gnulib-cache.m4: Re-generated. * import/m4/gnulib-comp.m4: Re-generated. * import/canonicalize-lgpl.c: New file. * import/extra/snippet/_Noreturn.h: New file. * import/m4/canonicalize.m4: New file. * import/m4/double-slash-root.m4: New file. * import/m4/eealloc.m4: New file. * import/m4/malloca.m4: New file. * import/m4/nocrash.m4: New file. * import/m4/stdlib_h.m4: New file. * import/malloca.c: New file. * import/malloca.h: New file. * import/malloca.valgrind: New file.
2014-11-28Use lstat unconditionallyYao Qi5-7/+9
Since lstat gnulib module is imported, we can use it unconditionally. lstat usage was introduced by this patch https://sourceware.org/ml/gdb-patches/2012-01/msg00390.html during the review, it was suggested to import gnulib lstat module, but we didn't do that. gdb: 2014-11-28 Yao Qi <yao@codesourcery.com> * configure.ac (AC_CHECK_FUNCS): Remove lstat. * config.in, configure: Regenerate. * symfile.c (find_separate_debug_file_by_debuglink): Remove code checking HAVE_LSTAT is defined.
2014-11-28Import lstatYao Qi11-79/+400
This patch is to import lstat gnulib module. gdb: 2014-11-28 Yao Qi <yao@codesourcery.com> * gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add lstat. * gnulib/aclocal.m4: Re-generated. * gnulib/config.in: Re-generated. * gnulib/configure: Re-generated. * gnulib/import/Makefile.am: Re-generated. * gnulib/import/Makefile.in: Re-generated. * gnulib/import/m4/gnulib-cache.m4: Re-generated. * gnulib/import/m4/gnulib-comp.m4: Re-generated. * gnulib/import/lstat.c: New file. * gnulib/import/m4/lstat.m4: New file.
2014-11-28Use readlink unconditionallyYao Qi10-15/+19
Since readlink module is imported, we can use it unconditionally. This patch is to remove configure checks and HAVE_READLINK checks in code. It was mentioned in the patch below [RFA/commit] gdbserver: return ENOSYS if readlink not supported. https://sourceware.org/ml/gdb-patches/2012-02/msg00148.html to use readlink in gdbserver, but we chose something simple at that moment. gdb: 2014-11-28 Yao Qi <yao@codesourcery.com> * configure.ac (AC_CHECK_FUNCS): Remove readlink. * config.in, configure: Re-generate. * inf-child.c (inf_child_fileio_readlink): Don't check HAVE_READLINK is defined. gdb/gdbserver: 2014-11-28 Yao Qi <yao@codesourcery.com> * configure.ac(AC_CHECK_FUNCS): Remove readlink. * config.in, configure: Re-generate. * hostio.c (handle_unlink): Remove code checking HAVE_READLINK is defined.
2014-11-28Import readlinkYao Qi15-67/+1245
This patch is to import readlink gnulib module. stat module is imported too, but it isn't used by gdb. gdb: 2014-11-28 Yao Qi <yao@codesourcery.com> * gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add readlink. * gnulib/aclocal.m4: Re-generated. * gnulib/config.in: Likewise. * gnulib/configure: Likewise. * gnulib/import/Makefile.am: Likewise. * gnulib/import/Makefile.in: Likewise. * gnulib/import/m4/gnulib-cache.m4: Likewise. * gnulib/import/m4/gnulib-comp.m4: Likewise. * gnulib/import/dosname.h: New file * gnulib/import/m4/largefile.m4: New file. * gnulib/import/m4/readlink.m4: New file. * gnulib/import/m4/stat.m4: New file. * gnulib/import/readlink.c: New file. * gnulib/import/stat.c: New file.
2014-11-28Fix date in changelogYao Qi1-1/+1
2014-11-28Match library name prefixed with sysrootYao Qi2-1/+14
We enable systemtap probe in glibc recently, and see the following gdb fail, (gdb) set solib-absolute-prefix /. ... Stopped due to shared library event:^M Inferior loaded /./foo/bar/gdb.base/break-probes-solib.so ... (gdb) FAIL: gdb.base/break-probes.exp: run til our library loads (the program exited) $binfile_lib is /foo/bar/gdb.base/break-probes-solib.so, but the sysroot is prefixed in solib.c:solib_find, as comments described: Global variable GDB_SYSROOT is used as a prefix directory to search for shared libraries if they have an absolute path. so the output becomes "/./foo/bar/gdb.base/break-probes-solib.so", which is still correct. However, the test repeatedly continue the program and tries to match $binfile_lib, finally, the program exits and the test fails. This patch is to adjust the pattern to match $sysroot$binfile_lib instead of $binfile_lib. gdb/testsuite: 2014-11-28 Yao Qi <yao@codesourcery.com> * gdb.base/break-probes.exp: Match library name prefixed with sysroot.
2014-11-27Fix test always passing in python/py-linetable.expSimon Marchi2-2/+8
The following test is found in python/py-linetable.exp: gdb_test "python print sorted(fset)" \ "\[20L, 21L, 22L, 24L, 25L, 28L, 29L, 30L, 32L, 33L, 37L, 39L, 40L, 42L, 44L, 45L, 46L\].*" \ "Test frozen set contains line numbers" I noticed that it passed when using Python 3, even though it should fail because of the missing parentheses for the call print. There needs to be more escaping of the square brackets. Currently, it is interpreted as "any one character from this big list of characters, followed by .*". When adding the required amount of backslashes, the test starts failing as it should. Moreover, both in Python 2.7 and Python 3.3 the numbers don't have the L suffix, so now the test fails because of that. Anybody knows why they were there in the first place? I just tested with Python 2.4 and there are no Ls. gdb/testsuite/ChangeLog: * gdb.python/py-linetable.exp: Escape properly sorted(fset) test expected output. Add parentheses for the call to print. Remove L suffix from integers. Signed-off-by: Simon Marchi <simon.marchi@ericsson.com>
2014-11-26gdb.dwarf2/dw2-op-out-param.S: Fix comment.Doug Evans2-1/+5
gdb/ChangeLog: * gdb.dwarf2/dw2-op-out-param.S: Fix comment.
2014-11-26Recognize new DWARFv5 C11, C++11 and C++14 DW_LANG constants.Mark Wielaard2-0/+8
gdb/ChangeLog * dwarf2read.c (set_cu_language): Recognize DW_LANG_C11, DW_LANG_C_plus_plus_11, DW_LANG_C_plus_plus_14. include/ChangeLog * dwarf2.h: Add DW_LANG_C_plus_plus_11, DW_LANG_C11 and DW_LANG_C_plus_plus_14.
2014-11-25Fix Nios II prologue analyzer to handle multiple stack adjustments.Sandra Loosemore2-8/+31
2014-11-25 Sandra Loosemore <sandra@codesourcery.com> gdb/ * nios2-tdep.c (nios2_analyze_prologue): Replace restriction that there can be only one stack adjustment in the prologue with tests to detect specific disallowed stack adjustments.
2014-11-25Fix Nios II GDB epilogue detection to handle multiple stack adjustments.Sandra Loosemore2-17/+47
2014-11-25 Sandra Loosemore <sandra@codesourcery.com> gdb/ * nios2-tdep.c (nios2_in_epilogue_p): Handle multiple stack adjustments.
2014-11-25Refactor Nios II GDB support to use helper functions for disassembly andSandra Loosemore2-308/+581
instruction matching. 2014-11-25 Sandra Loosemore <sandra@codesourcery.com> gdb/ * nios2-tdep.c (nios2_fetch_insn): Move up in file. Disassemble the instruction as well as reading it from memory. (nios2_match_add): New. (nios2_match_sub): New. (nios2_match_addi): New. (nios2_match_orhi): New. (nios2_match_stw): New. (nios2_match_ldw): New. (nios2_match_rdctl): New. (enum branch_condition): New. (nios2_match_branch): New. (nios2_match_jmpi): New. (nios2_match_calli): New. (nios2_match_jmpr): New. (nios2_match_callr): New. (nios2_match_break): New. (nios2_match_trap): New. (nios2_in_epilogue_p): Rewrite to use new functions. (nios2_analyze_prologue): Likewise. (nios2_skip_prologue): Delete unused local limit_pc. (nios2_breakpoint_from_pc): Make R1-specific encodings explicit. (nios2_get_next_pc): Rewrite to use new functions.
2014-11-24Reindent code (resolve_dynamic_type_internal).Jan Kratochvil2-20/+24
gdb/ChangeLog 2014-11-24 Jan Kratochvil <jan.kratochvil@redhat.com> * gdbtypes.c (resolve_dynamic_type_internal): Reindent the code.
2014-11-24[Hurd] Fix deallocation after proc_getprocinfo callSamuel Thibault2-3/+14
2014-11-24 Samuel Thibault <samuel.thibault@ens-lyon.org> * gdb/gnu-nat.c (inf_validate_procinfo): Multiply the number of elements pi_len by the size of the elements before calling vm_deallocate. (inf_validate_task_sc): Likewise, and properly deallocate the noise array.
2014-11-23Fix dumping of function arguments.Doug Evans2-7/+15
gdb/ChangeLog: * gdbtypes.c (print_args): Renamed from print_arg_types. Print arg number and name if present. All callers updated. (dump_fn_fieldlists): Fix indentation of args.
2014-11-23Add myself as write-after-approval GDB maintainerPatrick Palka2-0/+5
gdb/ChangeLog: * MAINTAINERS (Write After Approval): Add myself.
2014-11-23Always consider infcall breakpoints as non-permanent.Joel Brobecker2-0/+19
A recent change... commit 1a853c5224e2b8fedfac6d029365522b83080b40 Date: Wed Nov 12 10:10:49 2014 +0000 Subject: make "permanent breakpoints" per location and disableable ... broke function calls on sparc-elf when running over QEMU. Any function call should demonstrate the problem. For instance, seen from the debugger: (gdb) call pn(1234) [Inferior 1 (Remote target) exited normally] The program being debugged exited while in a function called from GDB. Evaluation of the expression containing the function And seen from QEMU: qemu: fatal: Trap 0x02 while interrupts disabled, Error state [register dump removed] What happens in this case is that GDB sets the inferior function call by not only creating the dummy frame, but also writing a breakpoint instruction at the return address for our function call. See infcall.c: /* Write a legitimate instruction at the point where the infcall breakpoint is going to be inserted. While this instruction is never going to be executed, a user investigating the memory from GDB would see this instruction instead of random uninitialized bytes. We chose the breakpoint instruction as it may look as the most logical one to the user and also valgrind 3.7.0 needs it for proper vgdb inferior calls. If software breakpoints are unsupported for this target we leave the user visible memory content uninitialized. */ bp_addr_as_address = bp_addr; bp_bytes = gdbarch_breakpoint_from_pc (gdbarch, &bp_addr_as_address, &bp_size); if (bp_bytes != NULL) write_memory (bp_addr_as_address, bp_bytes, bp_size); This instruction triggers a change introduced by the commit above, where we consider bp locations as being permanent breakpoints if there is already a breakpoint instruction at that address: + if (bp_loc_is_permanent (loc)) + { + loc->inserted = 1; + loc->permanent = 1; + } As a result, when resuming the program's execution for the inferior function call, GDB decides that it does not need to insert a breakpoint at this address, expecting the target to just report a SIGTRAP when trying to execute that instruction. But unfortunately for us, at least some versions of QEMU for SPARC just terminate the execution entirely instead of reporting a breakpoint, thus producing the behavior reported here. Although it appears like QEMU might be misbehaving and should therefore be fixed (to be verified) from the user's point of view, the recent change does introduce a regression. So this patch tries to mitigate a bit the damage by handling such infcall breakpoints as special and making sure that they are never considered permanent, thus restoring the previous behavior specifically for those breakpoints. The option of not writing the breakpoint instructions in the first place was considered, and would probably work also. But the comment associated to it seems to indicate that there is still reason to keep it. gdb/ChangeLog: * breakpoint.c (bp_loc_is_permanent): Return 0 if LOC corresponds to a bp_call_dummy breakpoint type. Tested on x86_64-linux. Also testing on sparc-elf/QEMU using AdaCore's testsuite.
2014-11-23Specify SA_RESTART when registering the SIGWINCH signal handlerPatrick Palka2-0/+8
SA_RESTART allows system calls to be restarted across a signal handler. By specifying this flag we fix the issue where if the user is being prompted to answer yes or no, and the terminal gets resized in the meantime, the prompt will think that the user sent an EOF and so it will take the default action for that prompt (in the case of the quit prompt, it will quit GDB). gdb/ChangeLog: * tui/tui-win.c (tui_initialize_win): Specify SA_RESTART when registering the signal handler.
2014-11-23Fix the processing of Meta-key commands in TUIPatrick Palka4-2/+49
This patch fixes the annoying bug where key sequences such as Alt_F or Alt_B (go forward or backwards by a word) do not behave promptly in TUI. You have to press a third key in order for the key sequence to register. This is mostly ncurses' fault. Calling wgetch() normally causes ncurses to read only a single key from stdin. However if the key read is the start-sequence key (^[ a.k.a. ESC) then wgetch() reads TWO keys from stdin, storing the 2nd key into an internal FIFO buffer and returning the start-sequence key. The extraneous read of the 2nd key makes us miss its corresponding stdin event, so the event loop blocks until a third key is pressed. This explains why such key sequences do not behave promptly in TUI. To fix this issue, we must somehow compensate for the missed stdin event corresponding to the 2nd byte of a key sequence. This patch achieves this by hacking up the stdin event handler to conditionally execute the readline callback multiple times in a row. This is done via a new global variable, call_stdin_event_handler_again_p, which is set from tui_getc() when we receive a start-sequence key and notice extra pending input in the ncurses buffer. Tested on x86_64-unknown-linux-gnu. gdb/ChangeLog: * event-top.h (call_stdin_event_handler_again_p): Declare. * event-top.c (call_stdin_event_handler_again_p): Define. (stdin_event_handler): Use it. * tui/tui-io.c (tui_getc): Prepare to call the stdin event handler again if there is pending input following a start sequence.
2014-11-23checkpoint: print index of new checkpoint in response messagePatrick Palka2-3/+11
This way the user can know the index of the latest checkpoint without having to run "info checkpoints" afterwards. gdb/ChangeLog: * linux-fork.c (checkpoint_command): Print index of new checkpoint in response message.
2014-11-23Refine read_stringYao Qi2-15/+19
In read_string, we have this line chunksize = (len == -1 ? min (8, fetchlimit) : fetchlimit); but chunksize is only used in the block that lne == -1, so IWBN to move chunksize to the block in which it is used, and simplify the condition setting chunksize. This patch also moves 'found_nul' to inner block. This patch also splits a paragraph of comment into two, and move them to different condition blocks (len > 0 and len == -1) respectively. gdb: 2014-11-23 Yao Qi <yao@codesourcery.com> * valprint.c (read_string): Move local variables 'found_nul', 'chunksize' and 'limit' to inner scope. Update comments.
2014-11-22symtab.c: Comment and whitespace improvements.Doug Evans2-4/+15
gdb/ChangeLog: * symtab.c (lookup_symbol_in_objfile_from_linkage_name): Improve function comment. (search_symbols): Fix comments and whitespace.
2014-11-22cp-namespace.c (cp_lookup_symbol_nonlocal): Fix comment.Doug Evans2-3/+5
gdb/ChangeLog: * cp-namespace.c (cp_lookup_symbol_nonlocal): Fix comment.
2014-11-22Use MACRO_AT_func in entry-values.expYao Qi3-78/+25
MACRO_AT_func can be used in gdb.trace/entry-values.exp to correctly get function's address in generated debug info. As a result, the test is more friendly to clang. Currently, there are some fails in entry-values.exp when the test is compiled by clang. With this patch applied, all fails go away. gdb/testsuite: 2014-11-22 Yao Qi <yao@codesourcery.com> * gdb.trace/entry-values.c: Remove asms. (foo): Add foo_label. (bar): Add bar_label. * gdb.trace/entry-values.exp: Remove code computing foo's length and bar's length. (Dwarf::assemble): Invoke function_range for bar and use MACRO_AT_func for foo.
2014-11-22[arm] Fix fails in dw2-compdir-oldgcc.expYao Qi2-4/+12
This patch fixes two fails in dw2-compdir-oldgcc.exp I've seen on arm target thumb mode. FAIL: gdb.dwarf2/dw2-compdir-oldgcc.exp: info source gcc42 FAIL: gdb.dwarf2/dw2-compdir-oldgcc.exp: info source gcc43 When fill in DW_AT_low_pc, the label should be used rather than the function, otherwise, the LSB bit of the address in DW_AT_low_pc is set and the debug info is wrong. This patch is to add two labels for functions gcc42 and gcc43 respectively, and use them. These two fails are fixed. gdb/testsuite: 2014-11-22 Yao Qi <yao@codesourcery.com> * gdb.dwarf2/dw2-compdir-oldgcc.S: Define label .Lgcc42_procstart and .Lgcc43_procstart. Use .Lgcc42_procstart instead of gcc42. Use .Lgcc43_procstart instead of gcc43.
2014-11-21psymtab.c (psymtab_search_name): Fix whitespace.Doug Evans2-6/+10
gdb/ChangeLog: * psymtab.c (psymtab_search_name): Fix whitespace.
2014-11-21Import errno explicitlyYao Qi5-3/+13
errno.h is included in common/common-defs.h, and gnulib errno module was imported to gdb. This patch is to import it explicitly. gdb: * gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add errno. * gnulib/import/Makefile.am: Re-generated. * gnulib/import/Makefile.in: Likewise. * gnulib/import/m4/gnulib-cache.m4: Likewise.
2014-11-21Include wchar.h and wctype.h unconditionallyYao Qi2-5/+12
As gnulib modules wchar and wctype is imported, we can include wchar.h and wctype.h unconditionally. This patch is also to remove HAVE_WCHAR_H check. gdb: 2014-11-21 Yao Qi <yao@codesourcery.com> * gdb_wchar.h: Include wchar.h and wctype.h. [HAVE_ICONV && HAVE_BTOWC]: Don't check HAVE_WCHAR_T and don't include wchar.h and wctype.h. Don't check HAVE_WCHAR_H.
2014-11-21Import wchar and wctype-h explicitlyYao Qi5-3/+15
gnulib module wchar and wctype-h was imported as a dependency, but they are used by gdb_wchar.h too. This patch is to import them explicitly. gdb: * gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add wchar and wctype-h. * gnulib/import/Makefile.am: Re-generated. * gnulib/import/Makefile.in: Likewise. * gnulib/import/m4/gnulib-cache.m4: Likewise.
2014-11-21Import memchr explicitlyYao Qi5-3/+13
memchr has been used in gdb source and gnulib memchr module was imported as a dependency. This patch is to import it explicitly. gdb: * gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add memchr. * gnulib/import/Makefile.am: Re-generated. * gnulib/import/Makefile.in: Likewise. * gnulib/import/m4/gnulib-cache.m4: Likewise.