aboutsummaryrefslogtreecommitdiff
path: root/gdb
AgeCommit message (Collapse)AuthorFilesLines
2016-11-23Makefiles: Flatten and sort file listsSimon Marchi7-426/+1347
I find the big file lists in the Makefiles a bit ugly and not very practical. Since there are multiple filenames on each line (as much as fits in 80 columns), it's not easy to add, remove or change a name in the middle. As a result, we have a mix of long and short lines in no particular order (ALL_TARGET_OBS is a good example). I therefore suggest flattening the lists (one name per line) and keeping them in alphabetical order. The diffs will be much clearer and merge conflicts will be easier to resolve. A nice (IMO) side-effect I observed is that the files are compiled alphabetically by make, so it gives a rough idea of the progress of the build. I added a comment in gdb/Makefile.in to mention to keep the file lists ordered, and gave the general guidelines on what order to respect. I added a comment in other Makefiles which refers to gdb/Makefile.in, to avoid duplication. Running the patch through the buildbot found that gdb.base/default.exp started to fail. The languages in the error message shown when typing "set language" have changed order. We could probably improve gdb so that it prints them in a stable order, regardless of the order of the object list passed to the linked, but just fixing the test is easier for now. New in v2: - Change ordering style, directories go at the end. - Cleanup gdbserver's and data-directory's Makefile as well. - Add comments at top of Makefiles about the ordering. - Remove wrong trailing backslahes. - Fix test gdb.base/default.exp. gdb/ChangeLog: * Makefile.in: Add comment about file lists ordering. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_MI_OBS, SUBDIR_MI_SRCS, SUBDIR_TUI_OBS, SUBDIR_TUI_SRCS, SUBDIR_GCC_COMPILE_OBS, SUBDIR_GCC_COMPILE_SRCS, SUBDIR_GUILE_OBS, SUBDIR_GUILE_SRCS, SUBDIR_PYTHON_OBS, SUBDIR_PYTHON_SRCS, SUBDIR_GDBTK_OBS, SUBDIR_GDBTK_SRCS, XMLFILES, REMOTE_OBS, ALL_64_TARGET_OBS, ALL_TARGET_OBS, SFILES, HFILES_NO_SRCDIR, HFILES_WITH_SRCDIR, COMMON_OBS, YYFILES, YYOBJ, generated_files, ALLDEPFILES): Flatten list and order alphabetically. * data-directory/Makefile.in: Add comment about file lists ordering. (GEN_SYSCALLS_FILES, PYTHON_FILE_LIST): Flatten list and order alphabetically. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES, OBS): Flatten list and order alphabetically. gdb/testsuite/ChangeLog: * gdb.base/default.exp: Fix output of "set language".
2016-11-23gdbserver: Use warning for warningsPedro Alves4-8/+13
gdb/gdbserver/ChangeLog: 2016-11-23 Pedro Alves <palves@redhat.com> * event-loop.c (handle_file_event): Use warning. * linux-low.c (linux_resume_one_lwp_throw): Use warning. * mem-break.c (add_breakpoint_condition, add_breakpoint_commands): Use warning.
2016-11-23gdbserver: Use debug_printf for debug outputPedro Alves6-35/+43
gdb/gdbserver/ChangeLog: 2016-11-23 Pedro Alves <palves@redhat.com> * linux-low.c (check_zombie_leaders): Use debug_printf for debug output. * notif.c (handle_notif_ack, notif_event_enque): Likewise. * remote-utils.c (putpkt_binary_1, readchar, getpkt): Use debug_printf and debug_flush for debug output. * server.c (handle_general_set): Likewise. * thread-db.c (try_thread_db_load): Use debug_printf for debug output.
2016-11-22Fix spelling mistakes in comments in shell scriptsAmbrogino Modigliani4-4/+10
gdb/ChangeLog: 2016-11-22 Ambrogino Modigliani <ambrogino.modigliani@gmail.com> * contrib/expect-read1.sh: Fix spelling in comments. * gdb_buildall.sh: Fix spelling in comments. * gdb_mbuild.sh: Fix spelling in comments.
2016-11-22Fix spelling mistakes in comments in configure scriptsAmbrogino Modigliani3-2/+7
All changes are limited to comments, and no run-time behavior is affected. bfd/ChangeLog: 2016-11-22 Ambrogino Modigliani <ambrogino.modigliani@gmail.com> * warning.m4: Fix spelling in comments. * configure.ac: Fix spelling in comments. * configure: Regenerate. binutils/ChangeLog: 2016-11-22 Ambrogino Modigliani <ambrogino.modigliani@gmail.com> * configure: Regenerate. gdb/ChangeLog: 2016-11-22 Ambrogino Modigliani <ambrogino.modigliani@gmail.com> * configure.ac: Fix spelling in comments. * configure: Regenerate. gas/ChangeLog: 2016-11-22 Ambrogino Modigliani <ambrogino.modigliani@gmail.com> * configure: Regenerate. gold/ChangeLog: 2016-11-22 Ambrogino Modigliani <ambrogino.modigliani@gmail.com> * configure: Regenerate. gprof/ChangeLog: 2016-11-22 Ambrogino Modigliani <ambrogino.modigliani@gmail.com> * configure: Regenerate. ld/ChangeLog: 2016-11-22 Ambrogino Modigliani <ambrogino.modigliani@gmail.com> * configure: Regenerate. opcodes/ChangeLog: 2016-11-22 Ambrogino Modigliani <ambrogino.modigliani@gmail.com> * configure: Regenerate.
2016-11-22Change gdbarch software_single_step frame_info to regcacheYao Qi23-42/+57
This patch changes gdbarch method software_single_step's parameter from "struct frame_info *" to "struct regcache *, IOW, software_single_step starts to use current regcache rather than current frame for software single. gdb: 2016-11-22 Yao Qi <yao.qi@linaro.org> * gdbarch.sh (software_single_step): Change parameter from frame_info to regcache. * gdbarch.c, gdbarch.h: Regenerated. * aarch64-tdep.c (aarch64_software_single_step): Change parameter from frame_info to regcache. Don't call get_current_regcache. * alpha-tdep.c (alpha_deal_with_atomic_sequence): Likewise. (alpha_software_single_step): Likewise. * alpha-tdep.h (alpha_software_single_step): Update declaration. * arm-linux-tdep.c (arm_linux_software_single_step): Likewise. * arm-tdep.c (arm_software_single_step): Likewise. * arm-tdep.h (arm_software_single_step): Likewise. * breakpoint.c (insert_single_step_breakpoint): Pass regcache to gdbarch_software_single_step. * cris-tdep.c (cris_software_single_step): Change parameter from frame_info to regcache. Don't call get_current_regcache. * mips-tdep.c (mips_software_single_step): Likewise. * mips-tdep.h (mips_software_single_step): Update declaration. * moxie-tdep.c (moxie_software_single_step): Likewise. * nios2-tdep.c (nios2_software_single_step): Likewise. * ppc-tdep.h (ppc_deal_with_atomic_sequence): Update declaration. * rs6000-aix-tdep.c (rs6000_software_single_step): Likewise. * rs6000-tdep.c (ppc_deal_with_atomic_sequence): Likewise. * s390-linux-tdep.c (s390_software_single_step): Likewise. * sparc-tdep.c (sparc_software_single_step): Likewise. * spu-tdep.c (spu_software_single_step): Likewise. * tic6x-tdep.c (tic6x_software_single_step): Likewise.
2016-11-22gdbarch software_single_step frame_info to regcache: spuYao Qi2-4/+12
gdb: 2016-11-22 Yao Qi <yao.qi@linaro.org> * spu-tdep.c (spu_software_single_step): Call get_regcache_arch instead of get_frame_arch. Call regcache_read_pc instead of get_frame_pc. Call regcache_raw_get_unsigned instead of get_frame_register_unsigned.
2016-11-22gdbarch software_single_step frame_info to regcache: tic6xYao Qi2-11/+19
gdb: 2016-11-22 Yao Qi <yao.qi@linaro.org> * tic6x-tdep.c (tic6x_condition_true): Replace frame with regcache. Call regcache_raw_get_signed instead of get_frame_register_signed. (tic6x_get_next_pc): Likewise. Caller updated.
2016-11-22gdbarch software_single_step frame_info to regcache: rs6000Yao Qi3-17/+32
gdb: 2016-11-22 Yao Qi <yao.qi@linaro.org> * rs6000-aix-tdep.c (branch_dest): Replace parameter frame with regcache. Call get_regcache_arch instead of get_frame_arch. Call regcache_raw_get_unsigned instead of get_frame_register_unsigned. (rs6000_software_single_step): Likewise. * rs6000-tdep.c (ppc_deal_with_atomic_sequence): Call get_regcache_arch instead of get_frame_arch. Call regcache_read_pc instead of get_frame_pc.
2016-11-22gdbarch software_single_step frame_info to regcache: s390Yao Qi2-3/+9
gdb: 2016-11-22 Yao Qi <yao.qi@linaro.org> * s390-linux-tdep.c (s390_software_single_step): Call get_regcache_arch instead of get_frame_arch. Call regcache_read_pc instead of get_frame_pc.
2016-11-22gdbarch software_single_step frame_info to regcache: sparcYao Qi2-7/+18
gdb: 2016-11-22 Yao Qi <yao.qi@linaro.org> * sparc-tdep.c (sparc_analyze_control_transfer): Replace parameter frame with regcache. Call get_current_frame. (sparc_software_single_step): Call get_regcache_arch instead of get_frame_arch. Call regcache_raw_get_unsigned instead of get_frame_register_unsigned.
2016-11-22gdbarch software_single_step frame_info to regcache: nios2Yao Qi2-12/+21
gdb: 2016-11-22 Yao Qi <yao.qi@linaro.org> * nios2-tdep.c (nios2_get_next_pc): Replace parameter frame with regcache. Call regcache_raw_get_signed instead of get_frame_register_unsigned. (nios2_software_single_step): Call get_regcache_arch instead of get_frame_arch.
2016-11-22gdbarch software_single_step frame_info to regcache: moxieYao Qi2-3/+9
gdb: 2016-11-22 Yao Qi <yao.qi@linaro.org> * moxie-tdep.c (moxie_software_single_step): Call get_regcache_arch instead of get_frame_arch. Call regcache_read_pc instead of get_frame_pc.
2016-11-22gdbarch software_single_step frame_info to regcache: mipsYao Qi2-69/+85
gdb: 2016-11-22 Yao Qi <yao.qi@linaro.org> * mips-tdep.c (mips32_bc1_pc): Replace parameter frame with regcache. Call regcache_raw_get_unsigned instead of get_frame_register_unsigned. (mips32_next_pc): Likewise. (micromips_bc1_pc): Likewise. (micromips_next_pc): Likewise. (extended_mips16_next_pc): Likewise. (mips16_next_pc): Likewise. (mips_next_pc): Likewise. (mips_software_single_step): Call get_regcache_arch instead of get_frame_arch.
2016-11-22gdbarch software_single_step frame_info to regcache: crisYao Qi2-6/+16
gdb: 2016-11-22 Yao Qi <yao.qi@linaro.org> * cris-tdep.c (find_step_target): Replace parameter frame with regcache. Call get_regcache_arch instead of get_frame_arch. Call regcache_raw_get_unsigned instead of get_frame_register_unsigned. (cris_software_single_step): Call get_regcache_arch instead of get_frame_arch.
2016-11-22gdbarch software_single_step frame_info to regcache: alphaYao Qi2-9/+20
gdb: 2016-11-22 Yao Qi <yao.qi@linaro.org> * alpha-tdep.c (alpha_deal_with_atomic_sequence): Call get_regcache_arch instead of get_frame_arch. Call regcache_read_pc instead of get_frame_pc. (alpha_next_pc): Replace parameter frame with regcache. Call regcache_raw_get_unsigned instead of get_frame_register_unsigned.
2016-11-22gdbarch software_single_step frame_info to regcache: aarch64Yao Qi2-2/+9
Use regcache in software_single_step. gdb: 2016-11-22 Yao Qi <yao.qi@linaro.org> * aarch64-tdep.c (aarch64_software_single_step): Call get_regcache_arch instead of get_frame_arch. Call regcache_read_pc instead of get_frame_pc.
2016-11-22New regcache_raw_get_signedYao Qi3-0/+24
This patch adds a new regcache api regcache_raw_get_signed. gdb: 2016-11-22 Yao Qi <yao.qi@linaro.org> * regcache.c (regcache_raw_get_signed): New function. * regcache.h (regcache_raw_get_signed): Declare.
2016-11-22Use VALUE_NEXT_FRAME_ID in value_from_componentYao Qi2-1/+6
We renamed VALUE_FRAME_ID to VALUE_NEXT_FRAME_ID recently, https://sourceware.org/ml/gdb-patches/2016-11/msg00018.html and we should use VALUE_NEXT_FRAME_ID in value_from_component too. gdb: 2016-11-22 Yao Qi <yao.qi@linaro.org> * value.c (value_from_component): Use VALUE_NEXT_FRAME_ID instead of VALUE_FROM_ID.
2016-11-21Add missing POSTCOMPILE step to mi/ file generation rulesSimon Marchi2-0/+6
A little oversight from my part, it caused the Makefile not to track the dependencies from mi/*.c files. gdb/ChangeLog: * Makefile.in (%o: $(srcdir)/mi/%.c): Add missing POSTCOMPILE step.
2016-11-21Create subobject value in pretty printerYao Qi6-36/+42
Nowadays, we create a value of subobject in pretty printer with 'address' being used, value = value_from_contents_and_address (type, valaddr + embedded_offset, address + embedded_offset); set_value_component_location (value, val); /* set_value_component_location resets the address, so we may need to set it again. */ if (VALUE_LVAL (value) != lval_internalvar && VALUE_LVAL (value) != lval_internalvar_component && VALUE_LVAL (value) != lval_computed) set_value_address (value, address + embedded_offset); value_from_contents_and_address creates a value from memory, but the value we are pretty-printing may not from memory at all. Instead of using value_from_contents_and_address, we create a value of subobject with the same location as object's but different offset. We avoid using address in this way. As a result, parameter 'address' in apply_val_pretty_printer is no longer needed, we can remove it in next step. We've already had the location of the 'whole' value, so it is safe to assume we can create a value of 'component' or 'suboject' value at the same location but with different offset. gdb: 2016-11-21 Yao Qi <yao.qi@linaro.org> * guile/scm-pretty-print.c (gdbscm_apply_val_pretty_printer): Don't call value_from_contents_and_address and set_value_address. Call value_from_component. * python/py-prettyprint.c (gdbpy_apply_val_pretty_printer): Likewise. * value.c (value_from_component): New function. * value.h (value_from_component): Likewise. * valarith.c (value_subscripted_rvalue): Call value_from_component.
2016-11-19ARI: Add detection of printf_vma and sprintf_vmaJoel Brobecker2-0/+21
We shouldn't be using these, since their output goes straight to stdout, which doesn't allow redirection. So this patch updates the ARI to detect any such use. gdb/ChangeLog: * contrib/ari/gdb_ari.sh: Add detection of printf_vma and sprintf_vma.
2016-11-18Makefile: fix typoSimon Marchi2-1/+5
Thanks to Patrick Monnerat for reporting this typo. gdb/ChangeLog: * Makefile.in (%.o: $(srcdir)/gdbtk/generic/%.c): Fix typo.
2016-11-18gdb/doc: Add missing comma after xrefAndreas Arnez2-1/+6
Get rid of a warning for missing punctuation after xref. gdb/doc/ChangeLog: * gdb.texinfo (GDB/MI Async Records): Add missing comma after xref.
2016-11-17Makefile: Replace explicit subdir rules with pattern rulesSimon Marchi2-733/+236
When adding a .c file in subdirectory (e.g. mi/), the current practice is to add an explicit rule, such as: mi-cmd-break.o: $(srcdir)/mi/mi-cmd-break.c $(COMPILE) $(srcdir)/mi/mi-cmd-break.c $(POSTCOMPILE) I find it a bit verbose and cumbersome. Since we now require GNU make, we can change those rules with pattern rules, one for each subdirectory. For example, the following rule works for all files under mi: %.o: $(srcdir)/mi/%.c $(COMPILE) $< $(POSTCOMPILE) Those pattern rules assume that the source and target files have the same stem (foo.c and foo.o). In one case, common-agent.o is generated from common/agent.c, to avoid a conflict with the agent.o in gdb/. In this case, I kept the explicit rule, which takes precedence over the pattern rule. We could also rename common/agent.c to common/common-agent.c to get rid of the special case and still avoid the clash, as it is done with common/common-regcache.c, for example. This strategy was the least intrusive I found, as it only requires changing the rules, not the target names. I also considered two other solutions, which I did not like because I would have had to change target names a bit everywhere. - Replicate the source directory structure in the build directory, which would generate common/agent.o from common/agent.c. However, something was not right with the dependency tracking (the .deps directory). It's probably not hard to fix, but I did not investigate further. - Name the object files after the directory they are in, so that common/agent.c would generate common_agent.c. GDBserver can benefit from the same treatment, but I'll do it in another patch. Built-tested with --enable-targets=all. New in v2: - Regroup pattern rules for .c -> .o compilation in a single place. - Add comment about common-agent.o. gdb/ChangeLog: (PYTHON_CFLAGS): Move up. (%.o: $(srcdir)/arch/%.c): New rule. (%.o: $(srcdir)/cli/%.c): New rule. (%.o: $(srcdir)/common/%.c): New rule. (%.o: $(srcdir)/compile/%.c): New rule. (%.o: $(srcdir)/gdbtk/generic/%.c): New rule. (%.o: $(srcdir)/guile/%.c): New rule. (%.o: $(srcdir)/mi/%.c): New rule. (%.o: $(srcdir)/nat/%.c): New rule. (%.o: $(srcdir)/python/%.c): New rule. (%.o: $(srcdir)/target/%.c): New rule. (%.o: $(srcdir)/tui/%.c): New rule. (cli-cmds.o): Remove. (cli-decode.o): Likewise. (cli-dump.o): Likewise. (cli-interp.o): Likewise. (cli-logging.o): Likewise. (cli-script.o): Likewise. (cli-setshow.o): Likewise. (cli-utils.o): Likewise. (compile.o): Likewise. (compile-c-types.o): Likewise. (compile-c-symbols.o): Likewise. (compile-object-load.o): Likewise. (compile-object-run.o): Likewise. (compile-loc2c.o): Likewise. (compile-c-support.o): Likewise. (gdbtk.o): Likewise. (gdbtk-bp.o): Likewise. (gdbtk-cmds.o): Likewise. (gdbtk-hooks.o): Likewise. (gdbtk-interp.o): Likewise. (gdbtk-main.o): Likewise. (gdbtk-register.o): Likewise. (gdbtk-stack.o): Likewise. (gdbtk-varobj.o): Likewise. (gdbtk-wrapper.o): Likewise. (mi-cmd-break.o): Likewise. (mi-cmd-catch.o): Likewise. (mi-cmd-disas.o): Likewise. (mi-cmd-env.o): Likewise. (mi-cmd-file.o): Likewise. (mi-cmd-info.o): Likewise. (mi-cmds.o): Likewise. (mi-cmd-stack.o): Likewise. (mi-cmd-target.o): Likewise. (mi-cmd-var.o): Likewise. (mi-console.o): Likewise. (mi-getopt.o): Likewise. (mi-interp.o): Likewise. (mi-main.o): Likewise. (mi-out.o): Likewise. (mi-parse.o): Likewise. (mi-symbol-cmds.o): Likewise. (mi-common.o): Likewise. (signals.o): Likewise. (common-utils.o): Likewise. (gdb_vecs.o): Likewise. (xml-utils.o): Likewise. (ptid.o): Likewise. (buffer.o): Likewise. (filestuff.o): Likewise. (format.o): Likewise. (vec.o): Likewise. (print-utils.o): Likewise. (rsp-low.o): Likewise. (errors.o): Likewise. (common-debug.o): Likewise. (cleanups.o): Likewise. (common-exceptions.o (posix-strerror.o): Likewise. (mingw-strerror.o): Likewise. (btrace-common.o): Likewise. (fileio.o): Likewise. (common-regcache.o): Likewise. (signals-state-save-restore.o): Likewise. (new-op.o): Likewise. (waitstatus.o): Likewise. (arm.o): Likewise. (arm-linux.o): Likewise. (arm-get-next-pcs.o): Likewise. (x86-dregs.o): Likewise. (linux-btrace.o): Likewise. (linux-osdata.o): Likewise. (linux-procfs.o): Likewise. (linux-ptrace.o): Likewise. (linux-waitpid.o): Likewise. (mips-linux-watch.o): Likewise. (ppc-linux.o): Likewise. (linux-personality.o): Likewise. (x86-linux.o): Likewise. (x86-linux-dregs.o): Likewise. (amd64-linux-siginfo.o): Likewise. (linux-namespaces.o): Likewise. (aarch64-linux-hw-point.o): Likewise. (aarch64-linux.o): Likewise. (aarch64-insn.o): Likewise. (tui.o): Likewise. (tui-command.o): Likewise. (tui-data.o): Likewise. (tui-disasm.o): Likewise. (tui-file.o): Likewise. (tui-hooks.o): Likewise. (tui-interp.o): Likewise. (tui-io.o): Likewise. (tui-layout.o): Likewise. (tui-out.o): Likewise. (tui-regs.o): Likewise. (tui-source.o): Likewise. (tui-stack.o): Likewise. (tui-win.o): Likewise. (tui-windata.o): Likewise. (tui-wingeneral.o): Likewise. (tui-winsource.o): Likewise. (guile.o): Likewise. (scm-arch.o): Likewise. (scm-auto-load.o): Likewise. (scm-block.o): Likewise. (scm-breakpoint.o): Likewise. (scm-cmd.o): Likewise. (scm-disasm.o): Likewise. (scm-exception.o): Likewise. (scm-frame.o): Likewise. (scm-gsmob.o): Likewise. (scm-iterator.o): Likewise. (scm-lazy-string.o): Likewise. (scm-math.o): Likewise. (scm-objfile.o): Likewise. (scm-param.o): Likewise. (scm-ports.o): Likewise. (scm-pretty-print.o): Likewise. (scm-progspace.o): Likewise. (scm-safe-call.o): Likewise. (scm-string.o): Likewise. (scm-symbol.o): Likewise. (scm-symtab.o): Likewise. (scm-type.o): Likewise. (scm-utils.o): Likewise. (scm-value.o): Likewise. (python.o): Likewise. (py-arch.o): Likewise. (py-auto-load.o): Likewise. (py-block.o): Likewise. (py-bpevent.o): Likewise. (py-breakpoint.o): Likewise. (py-cmd.o): Likewise. (py-continueevent.o): Likewise. (py-xmethods.o): Likewise. (py-event.o): Likewise. (py-evtregistry.o): Likewise. (py-evts.o): Likewise. (py-exitedevent.o): Likewise. (py-finishbreakpoint.o): Likewise. (py-frame.o): Likewise. (py-framefilter.o): Likewise. (py-function.o): Likewise. (py-gdb-readline.o): Likewise. (py-inferior.o): Likewise. (py-infevents.o): Likewise. (py-infthread.o): Likewise. (py-lazy-string.o): Likewise. (py-linetable.o): Likewise. (py-newobjfileevent.o): Likewise. (py-objfile.o): Likewise. (py-param.o): Likewise. (py-prettyprint.o): Likewise. (py-progspace.o): Likewise. (py-signalevent.o): Likewise. (py-stopevent.o): Likewise. (py-symbol.o): Likewise. (py-symtab.o): Likewise. (py-threadevent.o): Likewise. (py-type.o): Likewise. (py-unwind.o): Likewise. (py-utils.o): Likewise. (py-value.o): Likewise. (py-varobj.o): Likewise.
2016-11-17Makefile: Replace old suffix rules with pattern rulesSimon Marchi4-8/+25
As mentioned here [1], suffix rules are obsolete and have been superseeded with pattern rules. People (myself included, before writing this patch) are more likely to know what pattern rules are than suffix rules. AFAIK, .SUFFIXES targets are only used for those rules, and can be removed as well. New in v2: - Replace rule in gdbserver/Makefile.in as well. [1] https://www.gnu.org/software/make/manual/html_node/Suffix-Rules.html gdb/ChangeLog: * Makefile.in (.c.o): Replace rule with ... (%.o: %.c): ... this one. (.po.gmo): Replace rule with ... (%.gmo: %.po): ... this one. (.po.pox): Replace rule with ... (%.pox: %.po): ... this one. (.y.c): Replace rule with ... (%.c: %.y): ... this one. (.l.c): Replace rule with ... (%.c: %.l): ... this one. (.SUFFIXES): Remove all instances. gdb/gdbserver/ChangeLog: * Makefile.in (.c.o): Replace rule with ... (%.o: %.c): ... this one.
2016-11-17Remove code that checks for GNU/non-GNU makeSimon Marchi12-408/+98
Since GNU make is now required to build GDB, we can remove everything that checks whether the current make implemention is the GNU one or not. I simply removed the @GMAKE_TRUE@ prefixes and removed the whole lines that were prefixed with @GMAKE_FALSE@. I removed the code in the configure scripts that set those variables. I also removed the following bits from the configure scripts: AC_CHECK_PROGS(MAKE, make): GNU make already defines a MAKE variable internally to be used when invoking Makefiles recursively. I don't see this variable being used anywhere else (in scripts for example), so I think it's safe for removal. AC_PROG_MAKE_SET: This macro defines a SET_MAKE output variable, which is meant to be used in Makefiles to define the MAKE variable when using an implementation of make that doesn't already define it. Since we are now requiring GNU make, we don't need it anymore. Plus, I don't see SET_MAKE being used anywhere, so I don't think it was actually doing anything... gdb/ChangeLog: * Makefile.in: Remove @GMAKE_TRUE@ prefixes and removes lines prefixed with @GMAKE_FALSE@. Update comment related to non-GNU make. * configure.ac: Remove checks for the make program. * configure: Re-generate. gdb/gdbserver/ChangeLog: * Makefile.in: Remove @GMAKE_TRUE@ prefixes and removes lines prefixed with @GMAKE_FALSE@. Update comment related to non-GNU make. * configure.ac: Remove checks for the make program. * configure: Re-generate. gdb/testsuite/ChangeLog: * Makefile.in: Remove @GMAKE_TRUE@ prefixes and removes lines prefixed with @GMAKE_FALSE@. Update comment related to non-GNU make. * configure.ac: Remove checks for the make program. * configure: Re-generate.
2016-11-17Document new hard requirement on GNU makeSimon Marchi2-0/+9
As discussed in [1], it would be benificial for the GDB project to start requiring GNU make to build its software. It would allow using useful GNU-specific constructs, such as pattern rules. It would also allow removing the alternative code paths in the Makefiles (guarded by GMAKE_TRUE/GMAKE_FALSE), simplifying the Makefile code. [1] https://sourceware.org/ml/gdb-patches/2016-11/msg00331.html gdb/ChangeLog: * NEWS: Mention requirement of GNU make.
2016-11-17gdb/c-exp.y: fprintf -> parser_fprintfPedro Alves2-14/+18
Switching GDB to make use of gnulib's C++ namespace support mode revealed these direct uses of fprintf in the C parser, where parser_fprintf should be used to handle rewiring stderr to gdb_stderr: ..../src/gdb/c-exp.y: In function ‘void c_print_token(FILE*, int, YYSTYPE)’: ..../src/gdb/c-exp.y:3220:45: error: call to ‘fprintf’ declared with attribute warning: The symbol ::fprintf refers to the system function. Use gnulib::fprintf instead. [-Werror] pulongest (value.typed_val_int.val)); ^ ..../src/gdb/c-exp.y:3231:62: error: call to ‘fprintf’ declared with attribute warning: The symbol ::fprintf refers to the system function. Use gnulib::fprintf instead. [-Werror] fprintf (file, "tsval<type=%d, %s>", value.tsval.type, copy); ^ ..../src/gdb/c-exp.y:3237:57: error: call to ‘fprintf’ declared with attribute warning: The symbol ::fprintf refers to the system function. Use gnulib::fprintf instead. [-Werror] fprintf (file, "sval<%s>", copy_name (value.sval)); ^ ..../src/gdb/c-exp.y:3243:39: error: call to ‘fprintf’ declared with attribute warning: The symbol ::fprintf refers to the system function. Use gnulib::fprintf instead. [-Werror] copy_name (value.tsym.stoken)); ^ ..../src/gdb/c-exp.y:3254:39: error: call to ‘fprintf’ declared with attribute warning: The symbol ::fprintf refers to the system function. Use gnulib::fprintf instead. [-Werror] value.ssym.is_a_field_of_this); ^ ..../src/gdb/c-exp.y:3258:70: error: call to ‘fprintf’ declared with attribute warning: The symbol ::fprintf refers to the system function. Use gnulib::fprintf instead. [-Werror] fprintf (file, "bval<%s>", host_address_to_string (value.bval)); ^ gdb/ChangeLog: 2016-11-17 Pedro Alves <palves@redhat.com> * c-exp.y (c_print_token): Use parser_fprintf instead of fprintf.
2016-11-17gdb/ctf.c: Get rid of mkdir redefinitionPedro Alves2-5/+4
Making GDB use gnulib's C++ namespace support shows this build error on mingw: ../../src/gdb/ctf.c: In function 'void ctf_start(trace_file_writer*, const char*)': ../../src/gdb/ctf.c:309:46: error: no match for call to '(const gnulib::_gl_mkdir_wrapper) (const char*&)' #define mkdir(pathname, mode) mkdir (pathname) ^ ../../src/gdb/ctf.c:327:15: note: in expansion of macro 'mkdir' if (gnulib::mkdir (dirname, hmode) && errno != EEXIST) ^ ../../src/gdb/ctf.c:309:46: note: candidate: gnulib::_gl_mkdir_wrapper::type {aka int (*)(const char*, short unsigned int)} <conversion> #define mkdir(pathname, mode) mkdir (pathname) ^ ../../src/gdb/ctf.c:327:15: note: in expansion of macro 'mkdir' if (gnulib::mkdir (dirname, hmode) && errno != EEXIST) ^ ../../src/gdb/ctf.c:309:46: note: candidate expects 3 arguments, 2 provided #define mkdir(pathname, mode) mkdir (pathname) ^ ../../src/gdb/ctf.c:327:15: note: in expansion of macro 'mkdir' if (gnulib::mkdir (dirname, hmode) && errno != EEXIST) ^ The problem is the '#define mkdir ...' Fortunately, we can just remove it, since gnulib's sys/stat.h replacement already takes care of the Windows mkdir prototype quirk: ~~~ /* mingw's _mkdir() function has 1 argument, but we pass 2 arguments. Additionally, it declares _mkdir (and depending on compile flags, an alias mkdir), only in the nonstandard includes <direct.h> and <io.h>, which are included above. */ # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ # if !GNULIB_defined_rpl_mkdir static int rpl_mkdir (char const *name, mode_t mode) { return _mkdir (name); } ~~~ That's sys_stat.in.h, part of the sys_stat module, which we explictly pull in nowadays. It wasn't being pulled when this macro was added: https://sourceware.org/ml/gdb-patches/2013-03/msg00736.html That patch was partially reverted meanwhile here: https://sourceware.org/ml/gdb-patches/2013-12/msg00023.html But the mkdir macro had been left behind unnoticed. gdb/ChangeLog: 2016-11-17 Pedro Alves <palves@redhat.com> * ctf.c [USE_WIN32API] (mkdir): Delete.
2016-11-17gdb/ada-lang.c: one malloc -> unique_ptr<[]>Pedro Alves2-9/+10
Switching gdb to use gnulib's C++ namespace mode reveals we're calling malloc instead of xmalloc here: ..../src/gdb/ada-lang.c: In function ‘value* ada_value_primitive_packed_val(value*, const gdb_byte*, long int, int, int, type*)’: ..../src/gdb/ada-lang.c:2592:50: error: call to ‘malloc’ declared with attribute warning: The symbol ::malloc refers to the system function. Use gnulib::malloc instead. [-Werror] staging = (gdb_byte *) malloc (staging_len); ^ We're unconditionaly using the result afterwards -- so it's not a case of gracefully handling huge allocations. Since we want to get rid of all cleanups, fix this by switching to new[] and unique_ptr<[]> instead, while at it. Regtested on Fedora 23. gdb/ChangeLog: 2016-11-16 Pedro Alves <palves@redhat.com> * ada-lang.c (ada_value_primitive_packed_val): Use unique_ptr and new gdb_byte[] instead of malloc and cleanups.
2016-11-17gdb/tracepoint.c: Don't use printf_vmaPedro Alves3-33/+40
I noticed that bfd's printf_vma prints to stdout directly: bfd-in2.h:202:#define printf_vma(x) fprintf_vma(stdout,x) This is a bad idea in gdb, where we should use gdb_stdout/gdb_stderr/gdb_stdlog, etc., to support redirection. Eliminate uses of sprintf_vma too while at it. Tested on Fedora 23, w/ gdbserver. gdb/ChangeLog: 2016-11-17 Pedro Alves <palves@redhat.com> * tracepoint.c (collection_list::add_memrange): Add gdbarch parameter. Use paddress instead of printf_vma. Adjust recursive calls. (collection_list::stringify): Use paddress and phex_nz instead of sprintf_vma. Adjust add_memrange call. * tracepoint.h (collection_list::add_memrange): Add gdbarch parameter.
2016-11-16Stash frame id of current frame before stashing frame id for previous frameKevin Buettner2-0/+16
This patch ensures that the frame id for the current frame is stashed before that of the previous frame (to the current frame). First, it should be noted that the frame id for the current frame is not stashed by get_current_frame(). The current frame's frame id is lazily computed and stashed via calls to get_frame_id(). However, it's possible for get_prev_frame() to be called without first stashing the current frame. The frame stash is used not only to speed up frame lookups, but also to detect cycles. When attempting to compute the frame id for a "previous" frame (in get_prev_frame_if_no_cycle), a cycle is detected if the computed frame id is already in the stash. If it should happen that a previous frame id is stashed which should represent a cycle for the current frame, then an assertion failure will trigger should get_frame_id() be later called to determine the frame id for the current frame. As of late 2016, with the "Tweak meaning of VALUE_FRAME_ID" patch in place, this actually occurs when running the gdb.dwarf2/dw2-dup-frame.exp test. While attempting to generate a backtrace, the python frame filter code is invoked, leading to frame_info_to_frame_object() (in python/py-frame.c) being called. That function will potentially call get_prev_frame() before get_frame_id() is called. The call to get_prev_frame() can eventually end up in get_prev_frame_if_no_cycle() which, in turn, calls compute_frame_id(), after which the frame id is stashed for the previous frame. If the frame id for the current frame is stashed, the cycle detection code (which relies on the frame stash) in get_prev_frame_if_no_cycle() will be triggered for a cycle starting with the current frame. If the current frame's id is not stashed, the cycle detecting code can't operate as designed. Instead, when get_frame_id() is called on the current frame at some later point, the current frame's id will found to be already in the stash, triggering an assertion failure. Below is an in depth examination of the failure which lead to this change. I've shortened pathnames for brevity and readability. Here's the portion of the log file showing the failure/internal error: (gdb) break stop_frame Breakpoint 1 at 0x40059a: file dw2-dup-frame.c, line 22. (gdb) run Starting program: testsuite/outputs/gdb.dwarf2/dw2-dup-frame/dw2-dup-frame Breakpoint 1, stop_frame () at dw2-dup-frame.c:22 22 } (gdb) bt gdb/frame.c:544: internal-error: frame_id get_frame_id(frame_info*): Assertion `stashed' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) FAIL: gdb.dwarf2/dw2-dup-frame.exp: backtrace from stop_frame (GDB internal error) Here's a partial backtrace from the internal error, showing the frames which I think are relevant, plus several extra to provide context: #0 internal_error ( file=0x932b98 "gdb/frame.c", line=544, fmt=0x932b20 "%s: Assertion `%s' failed.") at gdb/common/errors.c:54 #1 0x000000000072207e in get_frame_id (fi=0xe5a760) at gdb/frame.c:544 #2 0x00000000004eb50d in frame_info_to_frame_object (frame=0xe5a760) at gdb/python/py-frame.c:390 #3 0x00000000004ef5be in bootstrap_python_frame_filters (frame=0xe5a760, frame_low=0, frame_high=-1) at gdb/python/py-framefilter.c:1453 #4 0x00000000004ef7a9 in gdbpy_apply_frame_filter ( extlang=0x8857e0 <extension_language_python>, frame=0xe5a760, flags=7, args_type=CLI_SCALAR_VALUES, out=0xf6def0, frame_low=0, frame_high=-1) at gdb/python/py-framefilter.c:1548 #5 0x00000000005f2c5a in apply_ext_lang_frame_filter (frame=0xe5a760, flags=7, args_type=CLI_SCALAR_VALUES, out=0xf6def0, frame_low=0, frame_high=-1) at gdb/extension.c:572 #6 0x00000000005ea896 in backtrace_command_1 (count_exp=0x0, show_locals=0, no_filters=0, from_tty=1) at gdb/stack.c:1834 Examination of the code in frame_info_to_frame_object(), which is in python/py-frame.c, is key to understanding this problem: if (get_prev_frame (frame) == NULL && get_frame_unwind_stop_reason (frame) != UNWIND_NO_REASON && get_next_frame (frame) != NULL) { frame_obj->frame_id = get_frame_id (get_next_frame (frame)); frame_obj->frame_id_is_next = 1; } else { frame_obj->frame_id = get_frame_id (frame); frame_obj->frame_id_is_next = 0; } I will first note that the frame id for frame has not been computed yet. (This was verified by placing a breakpoint on compute_frame_id().) The call to get_prev_frame() causes the the frame id to (eventually) be computed for the previous frame. Here's a backtrace showing how we get there: #0 compute_frame_id (fi=0x10e2810) at gdb/frame.c:496 #1 0x0000000000724a67 in get_prev_frame_if_no_cycle (this_frame=0xe5a760) at gdb/frame.c:1871 #2 0x0000000000725136 in get_prev_frame_always_1 (this_frame=0xe5a760) at gdb/frame.c:2045 #3 0x000000000072516b in get_prev_frame_always (this_frame=0xe5a760) at gdb/frame.c:2061 #4 0x000000000072570f in get_prev_frame (this_frame=0xe5a760) at gdb/frame.c:2303 #5 0x00000000004eb471 in frame_info_to_frame_object (frame=0xe5a760) at gdb/python/py-frame.c:381 For this particular case, we end up in the else clause of the code above which calls get_frame_id (frame). It's at this point that the frame id for frame is computed. Again, here's a backtrace: #0 compute_frame_id (fi=0xe5a760) at gdb/frame.c:496 #1 0x000000000072203d in get_frame_id (fi=0xe5a760) at gdb/frame.c:539 #2 0x00000000004eb50d in frame_info_to_frame_object (frame=0xe5a760) at gdb/python/py-frame.c:390 The test in question, dw2-dup-frame.exp, deliberately creates a broken (cyclic) stack. So, in this instance, the frame id for the prev `frame' will be the same as that for `frame'. But that particular frame id ended up in the stash during the previous frame operation. When, just a few lines later, we compute the frame id for `frame', the id in question is already in the stash, thus triggering the assertion failure. I considered two other solutions to solving this problem: We could prevent get_prev_frame() from being called before get_frame_id() in frame_info_to_frame_object(). (See above for the snippet of code where this happens.) A call to get_frame_id (frame) could be placed ahead of that code snippet above. I have tested this approach and, while it does work, I can't be certain that get_prev_frame() isn't called ahead of stashing the current frame somewhere else in GDB, but in a less obvious way. Another approach is to stash the current frame's id by calling get_frame_id() in get_current_frame(). This approach is conceptually simpler, but when importing a python unwinder, has the unwelcome side effect of causing the unwinder to be called during import. A cleaner looking fix would be to place this code after code corresponding to the "Don't compute the frame id of the current frame yet..." comment in get_prev_frame_if_no_cycle(). Sadly, this does not work though; by the time we get to this point, the frame state for the prev frame has been modified just enough to cause an internal error to occur when attempting to compute the (current) frame id for inline frames. (The unexpected failure count increases by roughly 130 failures.) Therefore, I decided to place it as early as possible in get_prev_frame(). gdb/ChangeLog: * frame.c (get_prev_frame): Stash frame id for current frame prior to computing frame id for previous frame.
2016-11-16Make gdb.PendingFrame.read_register handle "user" registers.Kevin Buettner2-1/+11
The C function, pending_framepy_read_register(), which implements the python interface gdb.PendingFrame.read_register does not handle the so called "user" registers like "pc". An assertion error is triggered due to the user registers having numbers larger than or equal to gdbarch_num_regs(gdbarch). With the VALUE_FRAME_ID tweak in place, the call to get_frame_register_value() can simply be replaced by a call to value_of_register(), which handles both real registers as well as the user registers. gdb/ChangeLog: * python/py-unwind.c (pending_framepy_read_register): Use value_of_register() instead of get_frame_register_value().
2016-11-16Change meaning of VALUE_FRAME_ID; rename to VALUE_NEXT_FRAME_IDKevin Buettner11-38/+140
The VALUE_FRAME_ID macro provides access to a member in struct value that's used to hold the frame id that's used when determining a register's value or when assigning to a register. The underlying member has a long and obscure name. I won't refer to it here, but will simply refer to VALUE_FRAME_ID as if it's the struct value member instead of being a convenient macro. At the moment, without this patch in place, VALUE_FRAME_ID is set in value_of_register_lazy() and several other locations to hold the frame id of the frame passed to those functions. VALUE_FRAME_ID is used in the lval_register case of value_fetch_lazy(). To fetch the register's value, it calls get_frame_register_value() which, in turn, calls frame_unwind_register_value() with frame->next. A python based unwinder may wish to determine the value of a register or evaluate an expression containing a register. When it does this, value_fetch_lazy() will be called under some circumstances. It will attempt to determine the frame id associated with the frame passed to it. In so doing, it will end up back in the frame sniffer of the very same python unwinder that's attempting to learn the value of a register as part of the sniffing operation. This recursion is not desirable. As noted above, when value_fetch_lazy() wants to fetch a register's value, it does so (indirectly) by unwinding from frame->next. With this in mind, a solution suggests itself: Change VALUE_FRAME_ID to hold the frame id associated with the next frame. Then, when it comes time to obtain the value associated with the register, we can simply unwind from the frame corresponding to the frame id stored in VALUE_FRAME_ID. This neatly avoids the python unwinder recursion problem by changing when the "next" operation occurs. Instead of the "next" operation occuring when the register value is fetched, it occurs earlier on when assigning a frame id to VALUE_FRAME_ID. (Thanks to Pedro for this suggestion.) This patch implements this idea. It builds on the patch "Distinguish sentinel frame from null frame". Without that work in place, it's necessary to check for null_id at several places and then obtain the sentinel frame. It also renames most occurences of VALUE_FRAME_ID to VALUE_NEXT_FRAME_ID to reflect the new meaning of this field. There are several uses of VALUE_FRAME_ID which were not changed. In each case, the original meaning of VALUE_FRAME_ID is required to get correct results. In all but one of these uses, either put_frame_register_bytes() or get_frame_register_bytes() is being called with the frame value obtained from VALUE_FRAME_ID. Both of these functions perform some unwinding by performing a "->next" operation on the frame passed to it. If we were to use the new VALUE_NEXT_FRAME_ID macro, this would effectively do two "->next" operations, which is not what we want. The VALUE_FRAME_ID macro has been redefined in terms of VALUE_NEXT_FRAME_ID. It simply fetches the previous frame's id, providing this id as the value of the macro. gdb/ChangeLog: * value.h (VALUE_FRAME_ID): Rename to VALUE_NEXT_FRAME_ID. Update comment. Create new VALUE_FRAME_ID which is defined in terms of VALUE_NEXT_FRAME_ID. (deprecated_value_frame_id_hack): Rename to deprecated_value_next_frame_id_hack. * dwarf2loc.c, findvar.c, frame-unwind.c, sentinel-frame.c, valarith.c, valops.c, value.c: Adjust nearly all occurences of VALUE_FRAME_ID to VALUE_NEXT_FRAME_ID. Add comments for those which did not change. * value.c (struct value): Rename frame_id field to next_frame_id. Update comment. (deprecated_value_frame_id_hack): Rename to deprecated_value_next_frame_id_hack. (value_fetch_lazy): Call frame_unwind_register_value() instead of get_frame_register_value(). * frame.c (get_prev_frame_id_by_id): New function. * frame.h (get_prev_frame_id_by_id): Declare. * dwarf2loc.c (dwarf2_evaluate_loc_desc_full): Make VALUE_NEXT_FRAME_ID refer to the next frame. * findvar.c (value_of_register_lazy): Likewise. (default_value_from_register): Likewise. (value_from_register): Likewise. * frame_unwind.c (frame_unwind_got_optimized): Likewise. * sentinel-frame.c (sentinel_frame_prev_register): Likewise. * value.h (VALUE_FRAME_ID): Update comment describing this macro.
2016-11-16Distinguish sentinel frame from null frame.Kevin Buettner3-35/+94
This patch replaces the `current_frame' static global in frame.c with `sentinel_frame'. It also makes the sentinel frame id unique and different from the null frame. By itself, there is not much point to this patch, but it makes the code cleaner for the VALUE_FRAME_ID changes in another patch. Since we now allow "navigation" to the sentinel frame, it removes the necessity of adding special cases to other parts of GDB. Note that a new function, get_next_frame_sentinel_okay, is introduced in this patch. It will be used by the VALUE_FRAME_ID changes that I've made. Thanks to Pedro Alves for this suggestion. gdb/ChangeLog: * frame.h (enum frame_id_stack_status): Add FID_STACK_SENTINEL. (struct frame_id): Increase number of bits required for storing stack status to 3 from 2. (sentinel_frame_id): New declaration. (get_next_frame_sentinel_okay): Declare. (frame_find_by_id_sentinel_okay): Declare. * frame.c (current_frame): Rename this static global to... (sentinel_frame): ...this static global, which has also been moved an earlier location in the file. (fprint_frame_id): Add case for sentinel frame id. (get_frame_id): Return early for sentinel frame. (sentinel_frame_id): Define. (frame_find_by_id): Add case for sentinel_frame_id. (create_sentinel_frame): Use sentinel_frame_id for this_id.value instead of null_frame_id. (get_current_frame): Add local declaration for `current_frame'. Remove local declaration for `sentinel_frame.' (get_next_frame_sentinel_okay): New function. (reinit_frame_cache): Use `sentinel_frame' in place of `current_frame'.
2016-11-16Extend test gdb.python/py-recurse-unwind.expKevin Buettner4-29/+79
This patch modifies the unwinder (sniffer) defined in py-recurse-unwind.py so that, depending upon the value of one of its class variables, it will take different paths through the code, testing different functionality. The original test attempted to obtain the value of an undefined symbol. This somewhat expanded test checks to see if 'pc' can be read via gdb.PendingFrame.read_register() and also via gdb.parse_and_eval(). gdb/testsuite/ChangeLog: * gdb.python/py-recurse-unwind.c (main): Add loop. * gdb.python/py-recurse-unwind.py (TestUnwinder): Add calls to read_register() and gdb.parse_and_eval(). Make each code call a separate case that can be individually tested. * gdb.python/py-recurse-unwind.exp (cont_and_backtrace): New proc. Call cont_and_backtrace for each of the code paths that we want to test in the unwinder.
2016-11-15gdb: update gnulib to pull in C++ namespace support fixesPedro Alves13-33/+140
I've been experimenting with making use of gnulib's C++ namespace support: https://www.gnu.org/software/gnulib/manual/html_node/A-C_002b_002b-namespace-for-gnulib.html That stumbled on a few gnulib issues, which I've fixed upstream: [PATCH] Fix gnulib C++ namespace support and std::frexp https://lists.gnu.org/archive/html/bug-gnulib/2016-11/msg00039.html [PATCH] Fix real-floating argument functions in C++ mode https://lists.gnu.org/archive/html/bug-gnulib/2016-11/msg00049.html [PATCH] Avoid having GNULIB_NAMESPACE::func always inject references to rpl_func https://lists.gnu.org/archive/html/bug-gnulib/2016-11/msg00040.html [PATCH] C++: "#define timeval rpl_timeval" -> typedef in GNULIB_NAMESPACE https://lists.gnu.org/archive/html/bug-gnulib/2016-11/msg00058.html This merge pulls those in. gdb/ChangeLog: 2016-11-15 Pedro Alves <palves@redhat.com> * gnulib/update-gnulib.sh (GNULIB_COMMIT_SHA1): Set to 38237baf99386101934cd93278023aa4ae523ec0. * gnulib/configure, gnulib/config.in: Regenerate. * gnulib/import/Makefile.am: Regenerate. * gnulib/import/Makefile.in: Regenerate. * gnulib/import/canonicalize-lgpl.c: Update. * gnulib/import/extra/snippet/c++defs.h: Update. * gnulib/import/m4/stdint.m4: Update. * gnulib/import/m4/stdlib_h.m4: Update. * gnulib/import/math.in.h: Update. * gnulib/import/stdlib.in.h: Update. * gnulib/import/sys_time.in.h: Update.
2016-11-15Delete gdb::unique_ptr/gdb::movePedro Alves3-348/+14
Now that we require C++11 and all uses of gdb::unique_ptr and gdb::move are gone, let's remove their definitions... With my lazy hat on, I repurposed the header for "generally useful unique_ptr specializations", and left gdb::unique_xmalloc_ptr in there. Not sure whether we it'd be better move it out of the gdb namespace or leave it be. I left it because it's less work and avoids disrupting yet-unmerged patches that use it. gdb/ChangeLog: 2016-11-15 Pedro Alves <palves@redhat.com> * common/common-defs.h: Update comment. * common/gdb_unique_ptr.h: Update header comment and copyright year. (gdb::unique_ptr, gdb::move): Delete.
2016-11-15gdb::{unique_ptr,move} -> std::{unique_ptr,move}Pedro Alves10-11/+31
Now that we require C++11, use std::unique_ptr and std::move directly. gdb/ChangeLog: 2016-11-15 Pedro Alves <palves@redhat.com> * ada-lang.c (create_excep_cond_exprs): Use std::move instead of gdb::move. * break-catch-throw.c (handle_gnu_v3_exceptions): Use std::unique_ptr instead of gdb::unique_ptr. * breakpoint.c (watch_command_1): Use std::move instead of gdb::move. * cli/cli-dump.c (dump_memory_to_file, restore_binary_file): Use std::unique_ptr instead of gdb::unique_ptr. * dtrace-probe.c (dtrace_process_dof_probe): Use std::move instead of gdb::move. * elfread.c (elf_read_minimal_symbols): Use std::unique_ptr instead of gdb::unique_ptr. * mi/mi-main.c (mi_cmd_data_read_memory): Use std::unique_ptr instead of gdb::unique_ptr. * parse.c (parse_expression_for_completion): Use std::move instead of gdb::move. * printcmd.c (display_command): std::move instead of gdb::move.
2016-11-15bitfield-parent-optimized-out: Fix struct definitionAndreas Arnez2-3/+7
The "struct S" type in bitfield-parent-optimized-out.exp is declared to have a size of 4 bytes but to hold two 4-byte members: an int-based bitfield and a 4-byte int. Also, both members have the same data_member_location 2, causing them to overlap and to reach 2 bytes beyond the structure's boundary. This is fixed by increasing the structure size to 8 and setting the first and second member's data_member_location to 0 and 4, respectively. gdb/testsuite/ChangeLog: * gdb.dwarf2/bitfield-parent-optimized-out.exp: Fix DWARF code for the definition of struct S.
2016-11-14btrace: read entire aux bufferMarkus Metzger2-4/+20
The data_head of a perf event data buffer grows indefinitely. Users are expected to compute data_head % data_size to find the location inside the perf event data buffer. The aux_head of a perf event aux buffer wraps around and always stays within the perf event aux buffer. Well, at least that's the behaviour for BTS and PT - where BTS uses the data buffer and PT the aux buffer. GDB does not read beyond data_head or aux_head. This is OK for BTS but wrong for PT. It causes only a portion of the trace to be considered by GDB. In the extreme case, the buffer may appear (almost) empty. Thanks to Tim Wiederhake <tim.wiederhake@intel.com> for reporting the anomaly. Change it to read the entire aux buffer for PT. The buffer is initially zero so any extra zeroes we read before aux_head wraps around the first time will be ignored when searching for the first PSB packet in order to synchronize onto the trace stream. gdb/ * nat/linux-btrace.c (perf_event_read): Allow data_head < size. * nat/linux-btrace.c (perf_event_read_all): Do not adjust size. Change-Id: If4f8049a2080a5f16f336309450b32a3eb1e3ec9
2016-11-12Remove some cleanups from the rust codeTom Tromey3-63/+47
This removes some cleanups from the rust code, in favor of C++ objects with destructors. 2016-11-12 Tom Tromey <tom@tromey.com> * rust-exp.y (super_name): Use std::vector. (lex_number): Use std::string. (convert_params_to_types): Return std::vector. (convert_ast_to_type, convert_name): Update. * rust-lang.c (rust_get_disr_info): Use unique_xmalloc_ptr.
2016-11-12Use std::string in rust_get_disr_infoTom Tromey2-1/+6
This changes rust_get_disr_info to use std::string in one more spot, avoiding a memory leak. 2016-11-12 Tom Tromey <tom@tromey.com> * rust-lang.c (rust_get_disr_info): Use std::string in one more spot.
2016-11-11Don't handle unavailable/optimized-out in spu_software_single_stepYao Qi2-18/+7
When we do software single step, frame is always the innermost one, so it is impossible to get unavailable/optimized-out errors. gdb: 2016-11-11 Yao Qi <yao.qi@linaro.org> * spu-tdep.c (spu_software_single_step): Don't call get_frame_register_bytes, call get_frame_register_unsigned instead.
2016-11-11 Identify verilog dump tests as such.Catherine Moore2-2/+6
A couple of the verilog dump tests were marked as ihex tests. This patch identifies the tests as verilog format dump tests.
2016-11-11Remove apply_val_pretty_printer parameter valaddrYao Qi10-40/+51
This patch removes the parameter valaddr of extension_language_ops::apply_val_pretty_printer and remove const from "struct value *val". valaddr can be got in each extension language's implementation of apply_val_pretty_printer. gdb: 2016-11-11 Yao Qi <yao.qi@linaro.org> * cp-valprint.c (cp_print_value): Remove local base_valaddr. * extension-priv.h (struct extension_language_ops) <apply_val_pretty_printer>: Remove the second parameter. Remove const from "struct value *". Callers updated. * extension.c (apply_ext_lang_val_pretty_printer): Update comments. Remove parameter valaddr. Remove const from "struct value *". * extension.h (apply_ext_lang_val_pretty_printer): Update declaration. * guile/guile-internal.h (gdbscm_apply_val_pretty_printer): Update declaration. * guile/scm-pretty-print.c (gdbscm_apply_val_pretty_printer): Remove parameter valaddr. Remove const from "struct value *". * python/py-prettyprint.c (gdbpy_apply_val_pretty_printer): Likewise. * python/python-internal.h (gdbpy_apply_val_pretty_printer): Update declaration.
2016-11-11Remove parameter valaddr from c print functionsYao Qi4-9/+19
This patch removes parameter valaddr from some c print functions. gdb: 2016-11-11 Yao Qi <yao.qi@linaro.org> * c-lang.h (cp_print_value_fields): Update declaration. * cp-valprint.c (cp_print_value): Update declaration. (cp_print_value_fields): Remove parameter valaddr. Callers updated. (cp_print_value): Likewise.
2016-11-09Use unique_xmalloc_ptr in Python codeTom Tromey19-225/+207
This changes some utility functions in the Python code to return unique_xmalloc_ptr, and then fixes up the callers. I chose unique_xmalloc_ptr rather than std::string because at a few call points the xmalloc'd string is released and ownership transferred elsewhere. This patch found a few existing memory leaks. For example, py-unwind.c called gdbpy_obj_to_string but never freed the result. Built and regression tested on the buildbot. 2016-11-09 Tom Tromey <tom@tromey.com> * varobj.h (varobj_get_display_hint): Change return type. * varobj.c (varobj_get_display_hint): Return unique_xmalloc_ptr. (varobj_value_get_print_value): Update. * python/python.c (gdbpy_before_prompt_hook, gdbpy_print_stack) (gdbpy_apply_type_printers): Update. * python/python-internal.h (unicode_to_target_string) (python_string_to_target_string, python_string_to_host_string) (gdbpy_obj_to_string, gdbpy_exception_to_string) (gdbpy_get_display_hint): Change return types. * python/py-varobj.c (py_varobj_iter_next): Update. * python/py-value.c (valpy_getitem, convert_value_from_python): Update. * python/py-utils.c (unicode_to_encoded_string) (unicode_to_target_string, python_string_to_target_string) (python_string_to_host_string, gdbpy_obj_to_string) (gdbpy_exception_to_string): Return unique_xmalloc_ptr. * python/py-unwind.c (pyuw_parse_register_id): Update. * python/py-type.c (typy_getitem): Update. * python/py-prettyprint.c (gdbpy_get_display_hint) (print_stack_unless_memory_error, print_children) (gdbpy_apply_val_pretty_printer): Update. * python/py-param.c (set_parameter_value): Update. (get_doc_string, call_doc_function): Return unique_xmalloc_ptr. (get_set_value, get_show_value, compute_enum_values, parmpy_init): Update. * python/py-infthread.c (thpy_set_name): Update. * python/py-function.c (fnpy_call, fnpy_init): Update. * python/py-framefilter.c (extract_sym): Change "name" to unique_xmalloc_ptr. (enumerate_args, enumerate_locals): Update. (py_print_frame): Use unique_xmalloc_ptr. * python/py-frame.c (frapy_read_var): Update. Remove cleanup. * python/py-cmd.c (cmdpy_function, cmdpy_completer, cmdpy_init): Update. * python/py-breakpoint.c (bppy_set_condition): Use unique_xmalloc_ptr. (bppy_init): Likewise. Remove cleanup. (local_setattro): Update. * mi/mi-cmd-var.c (print_varobj, mi_cmd_var_list_children) (varobj_update_one): Update.
2016-11-09Further cleanup/modernization of gdb.base/commands.expPedro Alves3-121/+274
- Use multi_line for matching multi-line GDB output. - Add a multi_line_input variant of multi_line to build GDB input and use it throughout. (The two changes above make the tests much more readable, IMO.) - Add a new valnum_re global to get rid of the multiple "\\\$\[0-9\]*". - Remove gdb_stop_suppressing_tests uses. - tighten a few regexps. - Replace send_gdb/gdb_expect with gdb_test_multiple and simplify, making pass/fail messages the same. gdb/ChangeLog: 2016-11-09 Pedro Alves <palves@redhat.com> * gdb.base/commands.exp (runto_or_return): New procedure. (gdbvar_simple_if_test, gdbvar_simple_while_test) (gdbvar_complex_if_while_test, progvar_simple_if_test) (progvar_simple_while_test, progvar_complex_if_while_test) (if_while_breakpoint_command_test) (infrun_breakpoint_command_test, breakpoint_command_test) (user_defined_command_test, watchpoint_command_test) (test_command_prompt_position, redefine_hook_test) (stray_arg0_test, error_clears_commands_left, redefine_hook_test) (redefine_backtrace_test): Use runto_or_return, $valnum_re, multi_line_input and multi_line. Remove gdb_expect and gdb_stop_suppressing_tests uses. * lib/gdb.exp (valnum_re): New global. * lib/gdb.exp (valnum_re): New global. (multi_line_input): New procedure.