aboutsummaryrefslogtreecommitdiff
path: root/gdb
AgeCommit message (Collapse)AuthorFilesLines
2017-05-17Add nowarnings in gdb.base/fileio.expYao Qi2-1/+5
I see the following warning in gdb.base/fileio.c, testsuite/gdb.base/fileio.c:297:3: warning: null argument where non-null required (argument 1) [-Wnonnull] ret = stat (NULL, &st); ^ This patch adds "nowarnings" to the list passed to gdb_compile. gdb/testsuite: 2017-05-17 Yao Qi <yao.qi@linaro.org> * gdb.base/fileio.exp: Pass nowarnings to gdb_compile.
2017-05-17Add alias command to cmd_list_elementYao Qi6-15/+48
When we add alias command, we call add_alias_cmd and pass the alias name and command name. This implicitly requires the command and its prefix commands are already added to cmdlist. This may not be true, for example, add_com_alias ("tty", "set inferior-tty", class_alias, 0); "inferior-tty" command is added to setlist, but setlist may not be added to cmdlist (It depends on the order of related _initialize_XXX functions called) so that we can't find "set inferior-tty" from cmdlist. This patch fixes this problem by passing cmd_list_element of "inferior-tty" to add_alias_cmd, so that cmd_list_element of "inferior-tty" doesn't have to be reachable from cmdlist at that moment. gdb: 2017-05-17 Yao Qi <yao.qi@linaro.org> * cli/cli-decode.c (add_alias_cmd): New function. * command.h (add_alias_cmd): Declare. * infcmd.c (_initialize_infcmd): Don't call add_com_alias, instead call add_alias_cmd. gdb/testsuite: 2017-05-17 Simon Marchi <simon.marchi@ericsson.com> * gdb.base/set-inferior-tty.exp (test_set_inferior_tty): Add argument command. (top-level): Invoke test_set_inferior_tty.
2017-05-17nat_extra_makefile_frag -> nat_makefile_fragPedro Alves5-10/+19
gdb/ChangeLog: 2017-05-17 Pedro Alves <palves@redhat.com> * Makefile.in (nat_extra_makefile_frag): Rename to ... (nat_makefile_frag): ... this. All references updated. * configure.ac: Likewise. * configure.nat: Likewise. Enhance comments. * configure: Regenerate.
2017-05-15Fix gdb procfs.c compilation on SolarisRainer Orth2-2/+7
Prompted by the creation of the gdb 8.0 branch, I tried to build it on x86_64-pc-solaris2.12, but failed: /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/procfs.c: In function `target_ops* procfs_target()': /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/procfs.c:186:27: error: invalid conversion from `void (*)(target_ops*, char*, char*, char**, int)' to `void (*)(target_ops*, const char*, const string&, char**, int) {aka void (*)(target_ops*, const char*, const std::__cxx11::basic_string<char>&, char**, int)}' [-fpermissive] t->to_create_inferior = procfs_create_inferior; ^~~~~~~~~~~~~~~~~~~~~~ /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/procfs.c: At global scope: /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/procfs.c:125:13: warning: `void procfs_create_inferior(target_ops*, char*, char*, char**, int)' declared `static' but never defined [-Wunused-function] static void procfs_create_inferior (struct target_ops *, char *, ^~~~~~~~~~~~~~~~~~~~~~ /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/procfs.c:4529:1: warning: `void procfs_create_inferior(target_ops*, const char*, const string&, char**, int)' defined but not used [-Wunused-function] procfs_create_inferior (struct target_ops *ops, const char *exec_file, ^~~~~~~~~~~~~~~~~~~~~~ This can easily be fixed by the following patch. * procfs.c (procfs_create_inferior): Change prototype to match definition.
2017-05-13Avoid compiler warning in MinGW buildEli Zaretskii2-1/+6
gdb: 2017-05-13 Eli Zaretskii <eliz@gnu.org> * tui/tui.c (tui_enable): Cast "unknown" to 'char *' to avoid a C++ compiler warning.
2017-05-12Avoid exponential behavior in rust_evaluate_subexpTom Tromey2-8/+13
The STRUCTOP_STRUCT case in rust_evaluate_subexp would evaluate its LHS, and then, if it did not need Rust-specific treatment, it would back up and re-evaluate the entire STRUCTOP_STRUCT part of the expression using evaluate_subexp_standard. This yields exponential behavior and causes some expressions to evaluate extremely slowly. The fix is to simply do the needed work inline. This is PR rust/21483. ChangeLog 2017-05-12 Tom Tromey <tom@tromey.com> PR rust/21483: * rust-lang.c (rust_evaluate_subexp) <STRUCTOP_STRUCT>: Don't recurse, just call value_struct_elt directly.
2017-05-12Fix rust_dump_subexp_bodyTom Tromey2-2/+8
rust_dump_subexp_body was not correct in a couple of cases. While debugging the bug I was really interested in, this caused a crash. This patch fixes the problems. No test case because, IIRC there generally aren't tests for expression dumping. ChangeLog 2017-05-12 Tom Tromey <tom@tromey.com> * rust-lang.c (rust_dump_subexp_body) <STRUCTOP_ANONYMOUS, OP_RUST_ARRAY>: Fix.
2017-05-12Replace "return" with "break"Tom Tromey2-1/+5
This replaces a "return" with a "break" in rust_print_subexp, for consistency. ChangeLog 2017-05-12 Tom Tromey <tom@tromey.com> * rust-lang.c (rust_print_subexp): Replace "return" with "break".
2017-05-09Use std::forward_list for current_regcacheYao Qi2-45/+32
gdb: 2017-05-09 Yao Qi <yao.qi@linaro.org> * regcache.c: Include <forward_list>. (struct regcache_list): Remove. (current_regcache): Update. (get_thread_arch_aspace_regcache): Update for std::forward_list. (regcache_thread_ptid_changed): Likewise. (registers_changed_ptid): Likewise. (current_regcache_size): Likewise.
2017-05-09Add current_regcache unit testYao Qi2-1/+81
This patch adds a unit test to current_regcache, to make sure it is correctly updated by get_thread_arch_aspace_regcache and registers_changed_ptid. gdb: 2017-05-09 Yao Qi <yao.qi@linaro.org> * regcache.c [GDB_SELF_TEST]: Include selftest.h. (current_regcache_size): New function. (current_regcache_test): New function. (_initialize_regcache) [GDB_SELF_TEST]: Register the unit test.
2017-05-08Remove some uses of MAX_REGISTER_SIZE from mips-tdep.cAlan Hayward2-3/+11
gdb/ * mips-tdep.c (mips_o32_return_value): Remove unused buffer. (print_gp_register_row): Use get_frame_register_value.
2017-05-08Remove some uses of MAX_REGISTER_SIZE from mips-linux-tdep.cAlan Hayward2-14/+10
gdb/ * mips-linux-tdep.c (mips_supply_gregset): Use raw_supply_zeroed. (mips_supply_fpregset): Likewise. (mips64_supply_gregset): Likewise.
2017-05-08Remove some uses of MAX_REGISTER_SIZE uses from mn10300-linux-tdep.cAlan Hayward2-12/+10
gdb/ * mn10300-linux-tdep.c (am33_supply_gregset_method): Use regcache->raw_supply_zeroed.
2017-05-06Rearrange gdb/configure.nat to make it simpler and less redundantSergio Durigan Junior2-528/+415
The previous commit introduced gdb/configure.nat, but it was just a copy-and-past (with the necessary adjustments) from the files under gdb/config/. We can do better than that. Instead of using one big 'case' statement that matches the ${gdb_host_cpu} and then match each ${gdb_host}, it is possible to remove a lof of redundancy by matching the most common ${gdb_host}'s first, setting the common variables for each, and then proceed to matching specific ${gdb_host}'s and ${gdb_host_cpu}'s. In other words, reverse the order of the 'case's and take advantage of the fact that a lot of parameters are the same for each host. This commit was tested on x86_64 without regressions. gdb/ChangeLog: 2017-05-06 Sergio Durigan Junior <sergiodj@redhat.com> * configure.nat: Rearrange 'case' statements to match host before cpu.
2017-05-06Introduce "gdb/configure.nat" (and delete "gdb/config/*/*.mh" files)Sergio Durigan Junior63-491/+733
Due to my ongoing work to make it possible for gdbserver to start the inferior using the shell, I had to share the fork_inferior function under the "nat/" directory. In order to do that, I created a new file and put the function there; however, this meant that I now had to update some of the *.mh files (under "gdb/config") and add the new file as a dependency to be built natively. Bleh... After talking a bit to Pedro about this, the idea came up to write a new "gdb/configure.nat" file, a la "gdb/configure.tgt", which would concentrate all of the native settings for each host/system. I decided to tackle this issue. The patch is simple. All of the previous Makefile variables that were being declared inside the *.mh files are now inside "gdb/Makefile.in", and "gdb/configure" is responsible for AC_SUBST'ing them. The definitions of these variables were put inside "gdb/configure.nat", so now they're shell variables. For excerpts of Makefile code, one must create a file under "gdb/config/${gdb_cpu_host}" and reference it on the "nat_extra_makefile_frag" variable. It should now be easier to update the native dependencies of hosts in this single file. This has been tested on x86_64 without regressions. gdb/ChangeLog: 2017-05-06 Sergio Durigan Junior <sergiodj@redhat.com> * Makefile.in: Remove "@host_makefile_frag@". Add variables NAT_FILE, NATDEPFILES, NAT_CDEPS, LOADLIBES, MH_CFLAGS, XM_CLIBS, NAT_GENERATED_FILES, HAVE_NATIVE_GCORE_HOST. Add "@nat_extra_makefile_frag@". (Makefile): Remove dependency on "@frags@". ($(GNULIB_BUILDDIR)/Makefile): Likewise. (data-directory/Makefile): Likewise. * config/aarch64/linux.mh: Deleted; moved contents to "gdb/configure.nat". * config/alpha/alpha-linux.mh: Likewise. * config/alpha/nbsd.mh: Likewise. * config/arm/linux.mh: Likewise. * config/arm/nbsdelf.mh: Likewise. * config/i386/cygwin.mh: Likewise. * config/i386/cygwin64.mh: Likewise. * config/i386/darwin.mh: Likewise. * config/i386/fbsd.mh: Likewise. * config/i386/fbsd64.mh: Likewise. * config/i386/go32.mh: Likewise. * config/i386/i386gnu.mh: Likewise. * config/i386/i386sol2.mh: Likewise. * config/i386/linux.mh: Likewise. * config/i386/linux64.mh: Likewise. * config/i386/mingw.mh: Likewise. * config/i386/mingw64.mh: Likewise. * config/i386/nbsd64.mh: Likewise. * config/i386/nbsdelf.mh: Likewise. * config/i386/nto.mh: Likewise. * config/i386/obsd.mh: Likewise. * config/i386/obsd64.mh: Likewise. * config/i386/sol2-64.mh: Likewise. * config/ia64/linux.mh: Likewise. * config/m32r/linux.mh: Likewise. * config/m68k/linux.mh: Likewise. * config/m68k/nbsdelf.mh: Likewise. * config/m68k/obsd.mh: Likewise. * config/m88k/obsd.mh: Likewise. * config/mips/fbsd.mh: Likewise. * config/mips/linux.mh: Likewise. * config/mips/nbsd.mh: Likewise. * config/mips/obsd64.mh: Likewise. * config/pa/linux.mh: Likewise. * config/pa/nbsd.mh: Likewise. * config/pa/obsd.mh: Likewise. * config/powerpc/aix.mh: Likewise. * config/powerpc/fbsd.mh: Likewise. * config/powerpc/linux.mh: Likewise. * config/powerpc/nbsd.mh: Likewise. * config/powerpc/obsd.mh: Likewise. * config/powerpc/ppc64-linux.mh: Likewise. * config/powerpc/spu-linux.mh: Likewise. * config/s390/linux.mh: Likewise. * config/sh/nbsd.mh: Likewise. * config/sparc/fbsd.mh: Likewise. * config/sparc/linux.mh: Likewise. * config/sparc/linux64.mh: Likewise. * config/sparc/nbsd64.mh: Likewise. * config/sparc/nbsdelf.mh: Likewise. * config/sparc/obsd64.mh: Likewise. * config/sparc/sol2.mh: Likewise. * config/tilegx/linux.mh: Likewise. * config/vax/nbsdelf.mh: Likewise. * config/vax/obsd.mh: Likewise. * config/xtensa/linux.mh: Likewise. * config/i386/i386gnu.mn: New file, with excerpts from "config/i386/i386gnu.mh". * configure: Regenerate. * configure.ac: Rewrite code to use "gdb/configure.nat" instead of *.mh files under "gdb/config". * configure.nat: New file, with contents from the "gdb/config/*/*.mh" files. gdb/doc/ChangeLog: 2017-05-06 Sergio Durigan Junior <sergiodj@redhat.com> * Makefile: Remove "@host_makefile_frag@".
2017-05-05btrace: Fix memory leak in btrace_clear.Tim Wiederhake2-0/+5
2017-05-05gdb: Disable -Werror for -Wmaybe-uninitializedPedro Alves5-3/+12
Newer GCCs are triggering false-positive -Wmaybe-uninitialized warnings around code that uses gdb::optional: https://sourceware.org/ml/gdb-patches/2017-05/msg00118.html Using std::optional wouldn't help, it triggers the same warnings: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635 Initializing the variables to quiet the warning would defeat the purpose of gdb::optional. Making the optional ctor memset its storage would be a pessimization. Wrapping gdb::optional's internals with "#pragma GCC diagnostic push/ignored/pop" doesn't work, we'd have to wrap uses of gdb::optional instead, which I think would get unwieldy and ugly as we start using gdb::optional more and more. The -Wmaybe-uninitialized warning is documented as producing false positives (unlike -Wuninialized), so until we find a better workaround, disable -Werror for this warning. You'll still see the warning when building gdb, but it won't cause a build failure. Tested by building with gcc 4.8.5, 5.3.1, and gcc trunk (20170428). gdb/ChangeLog: 2017-05-05 Pedro Alves <palves@redhat.com> * warning.m4 (build_warnings): Add -Wno-error=maybe-uninitialized. * configure: Regenerate. gdb/gdbserver/ChangeLog: 2017-05-05 Pedro Alves <palves@redhat.com> * configure: Regenerate.
2017-05-04Fix gdb.python/py-record-btrace-threads.exp with Python 3Pedro Alves2-2/+7
Fix several instances of: ... python print not f1calls File "<string>", line 1 print not f1calls ^ SyntaxError: Missing parentheses in call to 'print' Error while executing Python code. (gdb) FAIL: gdb.python/py-record-btrace-threads.exp: thread=1: checking thread 1: python print not f1calls ... gdb/testsuite/ChangeLog: 2017-05-04 Pedro Alves <palves@redhat.com> * gdb.python/py-record-btrace-threads.exp (check_insn_for_thread): Add parens to print call for Python 3.
2017-05-04RAII-fy make_cleanup_restore_current_thread & friendsPedro Alves21-415/+453
After all the make_cleanup_restore_current_thread fixing, I thought I'd convert that and its relatives (which are all cleanups) to RAII classes. scoped_restore_current_pspace_and_thread was put in a separate file to avoid a circular dependency. Tested on x86-64 Fedora 23, native and gdbserver. gdb/ChangeLog: 2017-05-04 Pedro Alves <palves@redhat.com> * Makefile.in (SFILES): Add progspace-and-thread.c. (HFILES_NO_SRCDIR): Add progspace-and-thread.h. (COMMON_OBS): Add progspace-and-thread.o. * breakpoint.c: Include "progspace-and-thread.h". (update_inserted_breakpoint_locations) (insert_breakpoint_locations, create_longjmp_master_breakpoint): Use scoped_restore_current_pspace_and_thread. (create_std_terminate_master_breakpoint): Use scoped_restore_current_program_space. (remove_breakpoint): Use scoped_restore_current_pspace_and_thread. (print_breakpoint_location): Use scoped_restore_current_program_space. (bp_loc_is_permanent): Use scoped_restore_current_pspace_and_thread. (resolve_sal_pc): Use scoped_restore_current_pspace_and_thread. (download_tracepoint_locations): Use scoped_restore_current_pspace_and_thread. (breakpoint_re_set): Use scoped_restore_current_pspace_and_thread. * exec.c (exec_close_1): Use scoped_restore_current_program_space. (enum step_over_calls_kind): Moved from inferior.h. (class scoped_restore_current_thread): New class. * gdbthread.h (make_cleanup_restore_current_thread): Delete declaration. (scoped_restore_current_thread): New class. * infcmd.c: Include "common/gdb_optional.h". (continue_1, proceed_after_attach): Use scoped_restore_current_thread. (notice_new_inferior): Use scoped_restore_current_thread. * inferior.c: Include "progspace-and-thread.h". (restore_inferior, save_current_inferior): Delete. (add_inferior_command, clone_inferior_command): Use scoped_restore_current_pspace_and_thread. * inferior.h (scoped_restore_current_inferior): New class. * infrun.c: Include "progspace-and-thread.h" and "common/gdb_optional.h". (follow_fork_inferior): Use scoped_restore_current_pspace_and_thread. (scoped_restore_exited_inferior): New class. (handle_vfork_child_exec_or_exit): Use scoped_restore_exited_inferior, scoped_restore_current_pspace_and_thread, scoped_restore_current_thread and scoped_restore. (fetch_inferior_event): Use scoped_restore_current_thread. * linespec.c (decode_line_full, decode_line_1): Use scoped_restore_current_program_space. * mi/mi-main.c: Include "progspace-and-thread.h". (exec_continue): Use scoped_restore_current_thread. (mi_cmd_exec_run): Use scoped_restore_current_pspace_and_thread. (mi_cmd_trace_frame_collected): Use scoped_restore_current_thread. * proc-service.c (ps_pglobal_lookup): Use scoped_restore_current_program_space. * progspace-and-thread.c: New file. * progspace-and-thread.h: New file. * progspace.c (release_program_space, clone_program_space): Use scoped_restore_current_program_space. (restore_program_space, save_current_program_space) (save_current_space_and_thread): Delete. (switch_to_program_space_and_thread): Moved to progspace-and-thread.c. * progspace.h (save_current_program_space) (save_current_space_and_thread): Delete declarations. (scoped_restore_current_program_space): New class. * remote.c (remote_btrace_maybe_reopen): Use scoped_restore_current_thread. * symtab.c: Include "progspace-and-thread.h". (skip_prologue_sal): Use scoped_restore_current_pspace_and_thread. * thread.c (print_thread_info_1): Use scoped_restore_current_thread. (struct current_thread_cleanup): Delete. (do_restore_current_thread_cleanup) (restore_current_thread_cleanup_dtor): Rename/convert both to ... (scoped_restore_current_thread::~scoped_restore_current_thread): ... this new dtor. (make_cleanup_restore_current_thread): Rename/convert to ... (scoped_restore_current_thread::scoped_restore_current_thread): ... this new ctor. (thread_apply_all_command): Use scoped_restore_current_thread. (thread_apply_command): Use scoped_restore_current_thread. * tracepoint.c (tdump_command): Use scoped_restore_current_thread. * varobj.c (value_of_root_1): Use scoped_restore_current_thread.
2017-05-04make_cleanup_restore_current_thread: Look up thread earlierPedro Alves2-5/+12
The unconditional is_stopped call already asserts that the thread exists. gdb/ChangeLog: 2017-05-04 Pedro Alves <palves@redhat.com> * thread.c (make_cleanup_restore_current_thread): Move find_thread_ptid call before the is_stopped call. Assert that the thread is found. Replace is_stopped call by checking the thread's state directly. Remove unnecessary NULL-thread check.
2017-05-04Fix get_core_register_section leak, introduce thread_section_namePedro Alves2-23/+58
This plugs a leak introduced in the previous change to get_core_register_section, which removed an xfree call that is actually necessary because the 'section_name' local is static. From [1] it looks like the reason the variable was made static to begin with, was just "laziness" to avoid having to think about freeing it on every function return path: https://sourceware.org/ml/gdb-patches/2005-03/msg00237.html The easiest to fix that nowadays is to use a std::string. I don't see a need to xstrdup the section name in the single-threaded case though, and also there's more than one place that computes a multi-threaded section name in the same way. So put the section name computation in a wrapper class with state. gdb/ChangeLog: 2017-05-04 Pedro Alves <palves@redhat.com> * corelow.c (thread_section_name): New class. (get_core_register_section, get_core_siginfo): Use it.
2017-05-04Remove some superfluous code in corelow.cAndreas Arnez2-4/+7
In corelow.c I stumbled upon an extra semicolon and an xfree of a NULL pointer. Remove them. gdb/ChangeLog: * corelow.c (sniff_core_bfd): Remove extra semicolon. (get_core_register_section): Remove xfree of NULL pointer.
2017-05-03Make sure malloc is linked into gdb.cp/oranking.cc.Keith Seitz2-0/+22
On some platforms, e.g., arm-eabi-none, we need to make certain that malloc is linked into the program because the test suite uses function calls requiring malloc: (gdb) p foo101("abc") evaluation of this expression requires the program to have a function "malloc". gdb/testsuite/ChangeLog * gdb.cp/oranking.cc (dummy): New function to grab malloc. (main): Call it.
2017-05-03Remove MAX_REGISTER_SIZE from frv-linux-tdep.cAlan Hayward4-5/+30
gdb/ * frv-linux-tdep.c (frv_linux_supply_gregset): Use raw_supply_zeroed. * regcache.c (regcache::raw_supply_zeroed): New function. * regcache.h (regcache::raw_supply_zeroed): New declaration.
2017-05-03gdbarch.sh: Remove commented out TARGET_CHAR_BIT definitionSimon Marchi3-9/+7
As Pedro commented on the patch "Change field separator in gdbarch.sh", this commented out definition is probably not useful and should be removed. It has been commented out for basically forever, and it probably serves the same intent as addressable_memory_unit_size. gdb/ChangeLog: * gdbarch.sh: Remove commented out definition of TARGET_CHAR_BIT. * gdbarch.h: Re-generate.
2017-05-03Regenerate gdb/{,gdbserver/}configure (for commit ↵Sergio Durigan Junior4-2/+10
be628ab814f1c90e185d7482d27aa8a991ab5837) On commit be628ab814f1c90e185d7482d27aa8a991ab5837, both common/common.m4 was modified in order to check for the presence of 'termios.h', 'termio.h' and 'sgtty.h'. However, I forgot to regenerate both gdb/configure and gdb/gdbserver/configure. This commit does that. gdb/ChangeLog: 2017-05-03 Sergio Durigan Junior <sergiodj@redhat.com> * configure: Regenerate. gdb/gdbserver/ChangeLog: 2017-05-03 Sergio Durigan Junior <sergiodj@redhat.com> * configure: Regenerate.
2017-05-02solib-target: Remove local variablesSimon Marchi2-13/+14
Now that we use std::vector, these local variables are not very useful. They're not much shorter than the expressions they stand for. gdb/ChangeLog: * solib-target.c (solib_target_relocate_section_addresses): Remove num_section_bases, num_bases, segment_bases variables.
2017-05-02Remove definition of VEC (CORE_ADDR)Simon Marchi2-2/+4
gdb/ChangeLog: * common/gdb_vecs.h (DEF_VEC_I (CORE_ADDR)): Remove.
2017-05-02Use std::vector in lm_info_targetSimon Marchi2-29/+26
Replace the two VEC fields with std::vector. gdb/ChangeLog: * solib-target.c: Include <vector> (struct lm_info_target) <~lm_info_target>: Remove. <segment_bases, section_bases>: Change type to std::vector<CORE_ADDR>. (library_list_start_segment, library_list_start_section, library_list_end_library, solib_target_relocate_section_addresses): Adjust.
2017-05-02Change return type of gdbarch_software_single_step to vector<CORE_ADDR>Simon Marchi29-222/+223
This is a relatively straightforward patch that changes gdbarch_software_single_step so it returns an std::vector<CORE_ADDR> instead of a VEC (CORE_ADDR). gdb/ChangeLog: * gdbarch.sh (software_single_step): Change return type to std::vector<CORE_ADDR>. * gdbarch.c, gdbarch.h: Re-generate. * arch/arm-get-next-pcs.c (thumb_deal_with_atomic_sequence_raw): Adjust. (arm_deal_with_atomic_sequence_raw): Adjust. (thumb_get_next_pcs_raw): Adjust. (arm_get_next_pcs_raw): Adjust. (arm_get_next_pcs): Adjust. * arch/arm-get-next-pcs.h (arm_get_next_pcs): Adjust. * aarch64-tdep.c (aarch64_software_single_step): Adjust. * alpha-tdep.c (alpha_deal_with_atomic_sequence): Adjust. (alpha_software_single_step): Adjust. * alpha-tdep.h (alpha_software_single_step): Adjust. * arm-linux-tdep.c (arm_linux_software_single_step): Adjust. * arm-tdep.c (arm_software_single_step): Adjust. (arm_breakpoint_kind_from_current_state): Adjust. * arm-tdep.h (arm_software_single_step): Adjust. * breakpoint.c (insert_single_step_breakpoint): Adjust. * cris-tdep.c (cris_software_single_step): Adjust. * mips-tdep.c (mips_deal_with_atomic_sequence): Adjust. (micromips_deal_with_atomic_sequence): Adjust. (deal_with_atomic_sequence): Adjust. (mips_software_single_step): Adjust. * mips-tdep.h (mips_software_single_step): Adjust. * moxie-tdep.c (moxie_software_single_step): Adjust. * nios2-tdep.c (nios2_software_single_step): Adjust. * ppc-tdep.h (ppc_deal_with_atomic_sequence): Adjust. * rs6000-aix-tdep.c (rs6000_software_single_step): Adjust. * rs6000-tdep.c (ppc_deal_with_atomic_sequence): Adjust. * s390-linux-tdep.c (s390_software_single_step): Adjust. * sparc-tdep.c (sparc_software_single_step): Adjust. * spu-tdep.c (spu_software_single_step): Adjust. * tic6x-tdep.c (tic6x_software_single_step): Adjust. gdb/gdbserver/ChangeLog: * linux-arm-low.c (arm_gdbserver_get_next_pcs): Adjust to software_single_step change of return type to std::vector<CORE_ADDR>. * linux-low.c (install_software_single_step_breakpoints): Likewise. * linux-low.h (install_software_single_step_breakpoints): Likewise.
2017-05-02Change field separator in gdbarch.shSimon Marchi3-194/+199
The fields in the description of the gdbarch interface are separated using colons. That becomes a problem if we want to use things like std::vector in it. This patch changes the field separator to use semicolons instead. I think there's very little chance we'll ever want to use a semicolon in one of the fields, but if you think another character would be more appropriate, let me know. gdb/ChangeLog: * gdbarch.sh: Use semi-colon as field separator instead of colon. * gdbarch.h: Re-generate.
2017-05-02Python: Introduce gdb.Instruction classTim Wiederhake9-19/+143
This adds a generic instruction class to Python and has gdb.RecordInstruction inherit from it.
2017-05-02Python: Move and rename gdb.BtraceFunctionTim Wiederhake9-221/+309
Remove gdb.BtraceFunctionCall and replace by gdb.FunctionSegment. Additionally, rename prev_segment and next_segment to prev and next.
2017-05-02Python: Move and rename gdb.BtraceInstructionTim Wiederhake7-166/+388
Remove gdb.BtraceInstruction and replace by gdb.RecordInstruction.
2017-05-02Python: Introduce gdb.RecordGap classTim Wiederhake8-62/+182
As discussed here: https://sourceware.org/ml/gdb-patches/2017-04/msg00157.html A gap is not an instruction and it should not pretend to be one. gdb.Record.instruction_history is now a list of gdb.RecordInstruction and gdb.RecordGap objects. This allows the user to deal with Gaps in the record in a more sane way.
2017-05-02Python: Remove ptid from gdb.Record interfaceTim Wiederhake6-19/+13
As discussed here: https://sourceware.org/ml/gdb-patches/2017-04/msg00166.html
2017-05-02Python: Use correct ptid in btrace recordingTim Wiederhake8-29/+224
The user would always get the instruction_history and function_call_history objects of the current thread, not the thread for which the gdb.Record object was created. The attached testcase fails without this patch and passes with the patch.
2017-05-02Python: Fix indentation in py-record-btrace.cTim Wiederhake2-30/+36
2017-05-01gdb/MAINTAINERS: Move Daniel J and Mark to the Past Maintainers section.Joel Brobecker2-13/+9
gdb/ChangeLog: * MAINTAINERS: Move Daniel Jacobowitz and Mark Kettenis to the past maintainers section.
2017-04-28Make environ.exp run on all platforms (and create info-program.exp)Sergio Durigan Junior3-252/+106
This has been on my TODO list for a while. There's a really old bug about this (PR testsuite/8595), and there was no reason for environ.exp to be specific for hppa* targets. So this patch removes this constraint, modernizes the testcase, and cleans up some things. Most of the tests remained, and some were rewritten (especially the one that checks if "show environment" works, which is something kind of hard to do). As a bonus, I'm adding a separated info-program.exp file containing all the tests related to "info program" that were present on environ.exp. Tested locally, everything still passes. gdb/testsuite/ChangeLog: 2017-04-28 Sergio Durigan Junior <sergiodj@redhat.com> PR testsuite/8595 * gdb.base/environ.exp: Make test available in all architectures. Move bits related to "info program" testing to gdb.base/info-program.exp. Rewrite tests to use the two new procedures mentione below. (test_set_show_env_var) New procedure. (test_set_show_env_var_equal): Likewise. * gdb.base/info-program.exp: New file.
2017-04-28Remove cleanup in get_return_valueYao Qi2-11/+8
With regcache ctor, we can use it to create local object in get_return_value (), so that the cleanup can be removed. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * infcmd.c (get_return_value): Use regcache ctor, and remove cleanup.
2017-04-28Use tag dispatch regcache ctor in regcache_dupYao Qi3-17/+34
This patch adds a tag dispatch ctor to create read-only regcache from a write-through regcache, also this patch deletes copy ctor and assignment operator. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> Pedro Alves <palves@redhat.com> * regcache.c (regcache::regcache): New tag dispatch ctor. (do_cooked_read): Moved above. (regcache_dup): Use the tag dispatch ctor.. * regcache.h (regcache): Declare ctor, delete copy ctor and assignment operator, remove friend regcache_dup.
2017-04-28Simplify regcache_dupYao Qi3-1/+11
regcache_dup, in fact, is to create a readonly regcache from a non-readonly regcache. This patch adds an assert that src is not readonly. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (regcache_dup): Assert !src->m_readonly_p and call method save instead of regcache_cpy. * regcache.h (struct regcache): Make regcache_dup a friend.
2017-04-28Class-fy regcacheYao Qi4-334/+627
This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28Class-ify lm_info_windowsSimon Marchi2-4/+11
This patch makes lm_info_windows a "real" class. It initializes the field and replaces XCNEW/xfree with new/delete. gdb/ChangeLog: * windows-nat.c (struct lm_info_windows): Initialize field. (windows_make_so): Allocate lm_info_windows with new. (windows_free_so): Free lm_info_windows with delete.
2017-04-28Class-ify lm_info_darwinSimon Marchi2-3/+12
This patch makes lm_info_darwin a "real" class. It initializes the field and replaces XCNEW/xfree with new/delete. gdb/ChangeLog: * solib-darwin.c (struct lm_info_darwin): Initialize field. (darwin_current_sos): Allocate lm_info_darwin with new, remove cleanup. (darwin_free_so): Free lm_info_darwin with delete.
2017-04-28Class-ify lm_info_svr4Simon Marchi3-10/+23
This patch makes lm_info_svr4 a "real" class. It initializes fields, uses bool and replaces XCNEW/xfree with new/delete. The memcpy in svr4_copy_library_list is replaced by a usage of the default copy constructor. gdb/ChangeLog: * solib-svr4.h (struct lm_info_svr4): Initialize fields. <l_addr_p>: Change type to bool. * solib-svr4.c (lm_info_read): Allocate lm_info_svr4 with new. (svr4_free_so): Free lm_info_svr4 with delete. (svr4_copy_library_list): Replace memcpy with call to copy constructor. (library_list_start_library, svr4_default_sos): Allocate lm_info_svr4 with new.
2017-04-28Class-ify lm_info_targetSimon Marchi2-19/+31
This patch makes lm_info_target a "real" class. It adds a destructor, uses std::string, initializes the fields and replaces XCNEW/xfree with new/delete. gdb/ChangeLog: * solib-target.c (struct lm_info_target): Add destructor, initialize fields. <name>: Change type to std::string. (library_list_start_library): Allocate lm_info_target with new. (solib_target_free_library_list): Free lm_info_target with delete. (solib_target_current_sos): Adapt to std::string. (solib_target_free_so): Free lm_info_target with delete.
2017-04-28Class-ify lm_info_frvSimon Marchi2-23/+28
This patches makes lm_info_frv a "real" class. It adds a destructor, initializes the fields and replaces XCNEW/xfree with new/delete. gdb/ChangeLog: * solib-frv.c (struct lm_info_frv): Add destructor, initialize fields. (frv_current_sos): Allocate lm_info_frv with new. (frv_relocate_main_executable): Free lm_info_frv with delete, allocate with new. (frv_clear_solib, frv_free_so): Free lm_info_frv with delete.
2017-04-28Fix indentation of lm_info_frvSimon Marchi2-23/+28
This patch fixes the indentation of lm_info_frv, so that the real changes of the following patch are not lost in the reformatting. gdb/ChangeLog: * solib-frv.c (struct lm_info_frv): Fix indentation.