Skip to content
Snippets Groups Projects
  1. Jan 01, 2023
  2. Mar 23, 2022
    • Simon Marchi's avatar
      gdb/python: remove Python 2/3 compatibility macros · 5aee4587
      Simon Marchi authored
      New in this version:
      
       - Rebase on master, fix a few more issues that appeared.
      
      python-internal.h contains a number of macros that helped make the code
      work with both Python 2 and 3.  Remove them and adjust the code to use
      the Python 3 functions.
      
      Change-Id: I99a3d80067fb2d65de4f69f6473ba6ffd16efb2d
      5aee4587
    • Simon Marchi's avatar
      gdb/python: remove Python 2 support · edae3fd6
      Simon Marchi authored
      New in this version:
      
       - Add a PY_MAJOR_VERSION check in configure.ac / AC_TRY_LIBPYTHON.  If
         the user passes --with-python=python2, this will cause a configure
         failure saying that GDB only supports Python 3.
      
      Support for Python 2 is a maintenance burden for any patches touching
      Python support.  Among others, the differences between Python 2 and 3
      string and integer types are subtle.  It requires a lot of effort and
      thinking to get something that behaves correctly on both.  And that's if
      the author and reviewer of the patch even remember to test with Python
      2.
      
      See this thread for an example:
      
        https://sourceware.org/pipermail/gdb-patches/2021-December/184260.html
      
      So, remove Python 2 support.  Update the documentation to state that GDB
      can be built against Python 3 (as opposed to Python 2 or 3).
      
      Update all the spots that use:
      
       - sys.version_info
       - IS_PY3K
       - PY_MAJOR_VERSION
       - gdb_py_is_py3k
      
      ... to only keep the Python 3 portions and drop the use of some
      now-removed compatibility macros.
      
      I did not update the configure script more than just removing the
      explicit references to Python 2.  We could maybe do more there, like
      check the Python version and reject it if that version is not
      supported.  Otherwise (with this patch), things will only fail at
      compile time, so it won't really be clear to the user that they are
      trying to use an unsupported Python version.  But I'm a bit lost in the
      configure code that checks for Python, so I kept that for later.
      
      Change-Id: I75b0f79c148afbe3c07ac664cfa9cade052c0c62
      edae3fd6
  3. Jan 01, 2022
  4. Jan 21, 2021
    • Simon Marchi's avatar
      gdb: make some variables static · 6bd434d6
      Simon Marchi authored
      I'm trying to enable clang's -Wmissing-variable-declarations warning.
      This patch fixes all the obvious spots where we can simply add "static"
      (at least, found when building on x86-64 Linux).
      
      gdb/ChangeLog:
      
      	* aarch64-linux-tdep.c (aarch64_linux_record_tdep): Make static.
      	* aarch64-tdep.c (tdesc_aarch64_list, aarch64_prologue_unwind,
      	aarch64_stub_unwind, aarch64_normal_base, ): Make static.
      	* arm-linux-tdep.c (arm_prologue_unwind): Make static.
      	* arm-tdep.c (struct frame_unwind): Make static.
      	* auto-load.c (auto_load_safe_path_vec): Make static.
      	* csky-tdep.c (csky_stub_unwind): Make static.
      	* gdbarch.c (gdbarch_data_registry): Make static.
      	* gnu-v2-abi.c (gnu_v2_abi_ops): Make static.
      	* i386-netbsd-tdep.c (i386nbsd_mc_reg_offset): Make static.
      	* i386-tdep.c (i386_frame_setup_skip_insns,
      	i386_tramp_chain_in_reg_insns, i386_tramp_chain_on_stack_insns):
      	Make static.
      	* infrun.c (observer_mode): Make static.
      	* linux-nat.c (sigchld_action): Make static.
      	* linux-thread-db.c (thread_db_list): Make static.
      	* maint-test-options.c (maintenance_test_options_list):
      	* mep-tdep.c (mep_csr_registers): Make static.
      	* mi/mi-cmds.c (struct mi_cmd_stats): Remove struct type name.
      	(stats): Make static.
      	* nat/linux-osdata.c (struct osdata_type): Make static.
      	* ppc-netbsd-tdep.c (ppcnbsd_reg_offsets): Make static.
      	* progspace.c (last_program_space_num): Make static.
      	* python/py-param.c (struct parm_constant): Remove struct type
      	name.
      	(parm_constants): Make static.
      	* python/py-record-btrace.c (btpy_list_methods): Make static.
      	* python/py-record.c (recpy_gap_type): Make static.
      	* record.c (record_goto_cmdlist): Make static.
      	* regcache.c (regcache_descr_handle): Make static.
      	* registry.h (DEFINE_REGISTRY): Make definition static.
      	* symmisc.c (std_in, std_out, std_err): Make static.
      	* top.c (previous_saved_command_line): Make static.
      	* tracepoint.c (trace_user, trace_notes, trace_stop_notes): Make
      	static.
      	* unittests/command-def-selftests.c (nr_duplicates,
      	nr_invalid_prefixcmd, lists): Make static.
      	* unittests/observable-selftests.c (test_notification): Make
      	static.
      	* unittests/optional/assignment/1.cc (counter): Make static.
      	* unittests/optional/assignment/2.cc (counter): Make static.
      	* unittests/optional/assignment/3.cc (counter): Make static.
      	* unittests/optional/assignment/4.cc (counter): Make static.
      	* unittests/optional/assignment/5.cc (counter): Make static.
      	* unittests/optional/assignment/6.cc (counter): Make static.
      
      gdbserver/ChangeLog:
      
      	* ax.cc (bytecode_address_table): Make static.
      	* debug.cc (debug_file): Make static.
      	* linux-low.cc (stopping_threads): Make static.
      	(step_over_bkpt): Make static.
      	* linux-x86-low.cc (amd64_emit_ops, i386_emit_ops): Make static.
      	* tracepoint.cc (stop_tracing_bkpt, flush_trace_buffer_bkpt,
      	alloced_trace_state_variables, trace_buffer_ctrl,
      	tracing_start_time, tracing_stop_time, tracing_user_name,
      	tracing_notes, tracing_stop_note): Make static.
      
      Change-Id: Ic1d8034723b7802502bda23770893be2338ab020
      6bd434d6
  5. Jan 01, 2021
  6. Dec 04, 2020
    • Tom Tromey's avatar
      Remove redundant typedefs · f99b5177
      Tom Tromey authored
      I was inspired by this patch of Simon's:
      
      https://sourceware.org/pipermail/gdb-patches/2020-November/173522.html
      
      ... to remove other typedefs that are no longer necessary now that gdb
      uses C++.
      
      I didn't remove absolutely every one -- I didn't touch the tdep files.
      However, I removed many of them.  In some cases, I removed an existing
      different struct tag.
      
      2020-12-04  Tom Tromey  <tromey@adacore.com>
      
      	* linespec.c (struct linespec_token): Rename; remove typedef.
      	* guile/scm-block.c (struct block_smob): Remove typedef.
      	(struct block_syms_progress_smob): Likewise.
      	* guile/scm-symbol.c (struct symbol_smob): Remove typedef.
      	* guile/scm-symtab.c (symtab_smob): Remove typedef.
      	(struct sal_smob): Remove typedef.
      	* guile/scm-param.c (struct param_smob): Remove typedef.
      	* guile/scm-progspace.c (struct pspace_smob): Rename.
      	* guile/scm-objfile.c (struct objfile_smob): Rename.
      	* guile/scm-iterator.c (struct iterator_smob): Rename.
      	* guile/scm-frame.c (struct frame_smob): Rename.
      	* guile/scm-arch.c (struct arch_smob): Rename.
      	* guile/scm-type.c (struct field_smob): Remove typedef.
      	(struct type_smob): Rename.
      	* guile/scm-cmd.c (struct command_smob): Remove typedef.
      	* guile/scm-ports.c (struct ioscm_memory_port): Remove typedef.
      	* guile/scm-value.c (struct value_smob): Remove typedef.
      	* guile/scm-lazy-string.c (lazy_string_smob): Remove typedef.
      	* guile/guile-internal.h (struct scheme_variable)
      	(struct scheme_function, struct scheme_integer_constant)
      	(struct gdb_smob, struct chained_gdb_smob)
      	(struct eqable_gdb_smob, arch_smob, frame_smob, iterator_smob)
      	(objfile_smob, pspace_smob, type_smob): Remove typedef.
      	* guile/scm-pretty-print.c (pretty_printer_smob): Remove typedef.
      	(struct pretty_printer_worker_smob): Remove typedef.
      	* guile/scm-exception.c (struct exception_smob): Remove typedef.
      	* python/py-block.c (struct block_object): Remove typedef.
      	(block_syms_iterator_object): Update.
      	(set_block): Update.
      	(block_syms_iterator_object): Remove typedef.
      	* python/py-inferior.c (struct membuf_object): Remove typedef.
      	* python/py-symtab.c (struct symtab_object): Remove typedef.
      	(set_symtab): Update.
      	(sal_object): Remove typedef.
      	(set_sal): Update.
      	* python/py-frame.c (frame_object): Remove typedef.
      	* python/py-record-btrace.c (struct btpy_list_object): Remove
      	typedef.
      	* python/py-arch.c (struct arch_object): Remove typedef.
      	* python/py-linetable.c (struct linetable_entry_object)
      	(linetable_object, struct ltpy_iterator_object): Remove typedef.
      	* python/py-events.h (eventregistry_object): Remove typedef.
      	(struct events_object): Remove typedef.
      	* python/python-internal.h (gdbpy_breakpoint_object): Remove
      	typedef.
      	(thread_object): Remove typedef.
      	* python/py-progspace.c (pspace_object): Remove typedef.
      	* python/py-value.c (struct value_object): Remove typedef.
      	* python/py-record.h (recpy_record_object): Remove typedef.
      	(struct recpy_element_object): Remove typedef.
      	* python/py-lazy-string.c (lazy_string_object): Remove typedef.
      	* python/py-objfile.c (objfile_object): Remove typedef.
      	* python/py-cmd.c (struct cmdpy_object): Remove typedef.
      	* python/py-type.c (type_object): Remove typedef.
      	(typy_iterator_object): Update.
      	(set_type): Update.
      	(field_object): Remove typedef.
      	(typy_iterator_object): Remove typedef.
      	* python/py-registers.c (register_descriptor_iterator_object):
      	Remove typedef.
      	(struct register_descriptor_object)
      	(struct reggroup_iterator_object, struct reggroup_object): Remove
      	typedef.
      	* python/py-record.c (recpy_gap_object): Remove typedef.
      	* python/py-symbol.c (symbol_object): Remove typedef.
      	(set_symbol): Update.
      	* python/py-event.h (event_object): Remove typedef.
      	* python/py-param.c (parmpy_object): Remove typedef.
      	* python/py-instruction.c (struct py_insn_obj): Remove typedef.
      	* python/py-unwind.c (struct pending_frame_object): Remove typedef.
      	(unwind_info_object, struct cached_frame_info): Likewise.
      f99b5177
  7. Sep 15, 2020
    • Tom Tromey's avatar
      Don't use PyInt_FromLong · 47f0e2ff
      Tom Tromey authored
      Avoid the use of PyInt_FromLong, preferring gdb_py_object_from_longest
      instead.  I found found another spot that was incorrectly handling
      errors (see gdbpy_create_ptid_object) while writing this patch; it is
      fixed here.
      
      gdb/ChangeLog
      2020-09-15  Tom Tromey  <tromey@adacore.com>
      
      	* python/python-internal.h (PyInt_FromLong): Remove define.
      	* python/py-value.c (convert_value_from_python): Use
      	gdb_py_object_from_longest.
      	* python/py-type.c (typy_get_code): Use
      	gdb_py_object_from_longest.
      	* python/py-symtab.c (salpy_get_line): Use
      	gdb_py_object_from_longest.
      	* python/py-symbol.c (sympy_get_addr_class, sympy_line): Use
      	gdb_py_object_from_longest.
      	* python/py-record.c (recpy_gap_reason_code): Use
      	gdb_py_object_from_longest.
      	* python/py-record-btrace.c (recpy_bt_insn_size)
      	(recpy_bt_func_level, btpy_list_count): Use
      	gdb_py_object_from_longest.
      	* python/py-infthread.c (gdbpy_create_ptid_object): Use
      	gdb_py_object_from_longest.  Fix error handling.
      	* python/py-framefilter.c (bootstrap_python_frame_filters): Use
      	gdb_py_object_from_longest.
      	* python/py-frame.c (frapy_type, frapy_unwind_stop_reason): Use
      	gdb_py_object_from_longest.
      	* python/py-breakpoint.c (bppy_get_type, bppy_get_number)
      	(bppy_get_thread, bppy_get_task, bppy_get_hit_count)
      	(bppy_get_ignore_count): Use gdb_py_object_from_longest.
      47f0e2ff
    • Tom Tromey's avatar
      Don't use gdb_py_long_from_ulongest · d1cab987
      Tom Tromey authored
      Remove the gdb_py_long_from_ulongest defines and change the Python
      layer to prefer gdb_py_object_from_ulongest.  While writing this I
      noticed that the error handling in archpy_disassemble was incorrect --
      it could call PyDict_SetItemString with a NULL value.  This patch also
      fixes this bug.
      
      gdb/ChangeLog
      2020-09-15  Tom Tromey  <tromey@adacore.com>
      
      	* python/python-internal.h (gdb_py_long_from_ulongest): Remove
      	defines.
      	* python/py-value.c (valpy_long): Use
      	gdb_py_object_from_ulongest.
      	* python/py-symtab.c (salpy_get_pc): Use
      	gdb_py_object_from_ulongest.
      	(salpy_get_last): Likewise.
      	* python/py-record-btrace.c (recpy_bt_insn_pc): Use
      	gdb_py_object_from_ulongest.
      	* python/py-lazy-string.c (stpy_get_address): Use
      	gdb_py_object_from_ulongest.
      	* python/py-frame.c (frapy_pc): Use gdb_py_object_from_ulongest.
      	* python/py-arch.c (archpy_disassemble): Use
      	gdb_py_object_from_ulongest and gdb_py_object_from_longest.  Fix
      	error handling.
      d1cab987
    • Tom Tromey's avatar
      Don't use gdb_py_long_from_longest · 4bde49dc
      Tom Tromey authored
      Change the Python layer to avoid gdb_py_long_from_longest, and remove
      the defines.
      
      gdb/ChangeLog
      2020-09-15  Tom Tromey  <tromey@adacore.com>
      
      	* python/python-internal.h (gdb_py_long_from_longest): Remove
      	defines.
      	* python/py-value.c (valpy_long): Use gdb_py_object_from_longest.
      	* python/py-type.c (convert_field, typy_get_sizeof): Use
      	gdb_py_object_from_longest.
      	* python/py-record-btrace.c (btpy_list_index): Use
      	gdb_py_object_from_longest.
      4bde49dc
  8. Jan 16, 2020
    • Christian Biesinger's avatar
      Fix some spelling errors. · 40c94099
      Christian Biesinger authored
      I noticed those from a lintian run:
      https://salsa.debian.org/cbiesinger-guest/gdb/-/jobs/514119
      
      gdb/ChangeLog:
      
      2020-01-16  Christian Biesinger  <cbiesinger@google.com>
      
              * btrace.c (btrace_compute_ftrace_1): Fix spelling error (Unkown).
              (btrace_stitch_trace): Likewise.
              * charset.c (intermediate_encoding): Likewise (vaild).
              * nat/linux-btrace.c (linux_read_pt): Likewise (Unkown).
              * python/py-record-btrace.c (struct PyMethodDef): Likewise (occurences).
              * record-btrace.c (record_btrace_print_conf): Likewise (unkown).
      
      gdb/testsuite/ChangeLog:
      
      2020-01-16  Christian Biesinger  <cbiesinger@google.com>
      
              * lib/gdb.exp: Fix spelling error (seperatelly).
      
      Change-Id: I2a44936bac295020f217fb6c78b99b0a8d09cf9a
      40c94099
  9. Jan 01, 2020
  10. Jul 10, 2019
    • Tom Tromey's avatar
      Don't include gdbarch.h from defs.h · 0d12e84c
      Tom Tromey authored
      I touched symtab.h and was surprised to see how many files were
      rebuilt.  I looked into it a bit, and found that defs.h includes
      gdbarch.h, which in turn includes many things.
      
      gdbarch.h is only needed by a minority ofthe files in gdb, so this
      patch removes the include from defs.h and updates the fallout.
      
      I did "wc -l" on the files in build/gdb/.deps; this patch reduces the
      line count from 139935 to 137030; so there are definitely future
      build-time savings here.
      
      Note that while I configured with --enable-targets=all, it's possible
      that some *-nat.c file needs an update.  I could not test all of
      these.  The buildbot caught a few problems along these lines.
      
      gdb/ChangeLog
      2019-07-10  Tom Tromey  <tom@tromey.com>
      
      	* defs.h: Don't include gdbarch.h.
      	* aarch64-ravenscar-thread.c, aarch64-tdep.c, alpha-bsd-tdep.h,
      	alpha-linux-tdep.c, alpha-mdebug-tdep.c, arch-utils.h, arm-tdep.h,
      	ax-general.c, btrace.c, buildsym-legacy.c, buildsym.h, c-lang.c,
      	cli/cli-decode.h, cli/cli-dump.c, cli/cli-script.h,
      	cli/cli-style.h, coff-pe-read.h, compile/compile-c-support.c,
      	compile/compile-cplus.h, compile/compile-loc2c.c, corefile.c,
      	cp-valprint.c, cris-linux-tdep.c, ctf.c, d-lang.c, d-namespace.c,
      	dcache.c, dicos-tdep.c, dictionary.c, disasm-selftests.c,
      	dummy-frame.c, dummy-frame.h, dwarf2-frame-tailcall.c,
      	dwarf2expr.c, expression.h, f-lang.c, frame-base.c,
      	frame-unwind.c, frv-linux-tdep.c, gdbarch-selftests.c, gdbtypes.h,
      	go-lang.c, hppa-nbsd-tdep.c, hppa-obsd-tdep.c, i386-dicos-tdep.c,
      	i386-tdep.h, ia64-vms-tdep.c, interps.h, language.c,
      	linux-record.c, location.h, m2-lang.c, m32r-linux-tdep.c,
      	mem-break.c, memattr.c, mn10300-linux-tdep.c, nios2-linux-tdep.c,
      	objfiles.h, opencl-lang.c, or1k-linux-tdep.c, p-lang.c,
      	parser-defs.h, ppc-tdep.h, probe.h, python/py-record-btrace.c,
      	record-btrace.c, record.h, regcache-dump.c, regcache.h,
      	riscv-fbsd-tdep.c, riscv-linux-tdep.c, rust-exp.y,
      	sh-linux-tdep.c, sh-nbsd-tdep.c, source-cache.c,
      	sparc-nbsd-tdep.c, sparc-obsd-tdep.c, sparc-ravenscar-thread.c,
      	sparc64-fbsd-tdep.c, std-regs.c, target-descriptions.h,
      	target-float.c, tic6x-linux-tdep.c, tilegx-linux-tdep.c, top.c,
      	tracefile.c, trad-frame.c, type-stack.h, ui-style.c, utils.c,
      	utils.h, valarith.c, valprint.c, varobj.c, x86-tdep.c,
      	xml-support.h, xtensa-linux-tdep.c, cli/cli-cmds.h: Update.
      	* s390-linux-nat.c, procfs.c, inf-ptrace.c: Likewise.
      0d12e84c
  11. Apr 08, 2019
    • Tom Tromey's avatar
      Rename gdb exception types · 230d2906
      Tom Tromey authored
      This renames the gdb exception types.  The old types were only needed
      due to the macros in common-exception.h that are now gone.
      
      The intermediate layer of gdb_exception_RETURN_MASK_ALL did not seem
      needed, so this patch removes it entirely.
      
      gdb/ChangeLog
      2019-04-08  Tom Tromey  <tom@tromey.com>
      
      	* common/common-exceptions.h (gdb_exception_RETURN_MASK_ALL):
      	Remove.
      	(gdb_exception_error): Rename from
      	gdb_exception_RETURN_MASK_ERROR.
      	(gdb_exception_quit): Rename from gdb_exception_RETURN_MASK_QUIT.
      	(gdb_quit_bad_alloc): Update.
      	* aarch64-tdep.c: Update.
      	* ada-lang.c: Update.
      	* ada-typeprint.c: Update.
      	* ada-valprint.c: Update.
      	* amd64-tdep.c: Update.
      	* arch-utils.c: Update.
      	* break-catch-throw.c: Update.
      	* breakpoint.c: Update.
      	* btrace.c: Update.
      	* c-varobj.c: Update.
      	* cli/cli-cmds.c: Update.
      	* cli/cli-interp.c: Update.
      	* cli/cli-script.c: Update.
      	* common/common-exceptions.c: Update.
      	* common/new-op.c: Update.
      	* common/selftest.c: Update.
      	* compile/compile-c-symbols.c: Update.
      	* compile/compile-cplus-symbols.c: Update.
      	* compile/compile-object-load.c: Update.
      	* compile/compile-object-run.c: Update.
      	* completer.c: Update.
      	* corelow.c: Update.
      	* cp-abi.c: Update.
      	* cp-support.c: Update.
      	* cp-valprint.c: Update.
      	* darwin-nat.c: Update.
      	* disasm-selftests.c: Update.
      	* dtrace-probe.c: Update.
      	* dwarf-index-cache.c: Update.
      	* dwarf-index-write.c: Update.
      	* dwarf2-frame-tailcall.c: Update.
      	* dwarf2-frame.c: Update.
      	* dwarf2loc.c: Update.
      	* dwarf2read.c: Update.
      	* eval.c: Update.
      	* event-loop.c: Update.
      	* event-top.c: Update.
      	* exec.c: Update.
      	* f-valprint.c: Update.
      	* fbsd-tdep.c: Update.
      	* frame-unwind.c: Update.
      	* frame.c: Update.
      	* gdbtypes.c: Update.
      	* gnu-v3-abi.c: Update.
      	* guile/guile-internal.h: Update.
      	* guile/scm-block.c: Update.
      	* guile/scm-breakpoint.c: Update.
      	* guile/scm-cmd.c: Update.
      	* guile/scm-disasm.c: Update.
      	* guile/scm-frame.c: Update.
      	* guile/scm-lazy-string.c: Update.
      	* guile/scm-math.c: Update.
      	* guile/scm-param.c: Update.
      	* guile/scm-ports.c: Update.
      	* guile/scm-pretty-print.c: Update.
      	* guile/scm-symbol.c: Update.
      	* guile/scm-symtab.c: Update.
      	* guile/scm-type.c: Update.
      	* guile/scm-value.c: Update.
      	* i386-linux-tdep.c: Update.
      	* i386-tdep.c: Update.
      	* inf-loop.c: Update.
      	* infcall.c: Update.
      	* infcmd.c: Update.
      	* infrun.c: Update.
      	* jit.c: Update.
      	* language.c: Update.
      	* linespec.c: Update.
      	* linux-fork.c: Update.
      	* linux-nat.c: Update.
      	* linux-tdep.c: Update.
      	* linux-thread-db.c: Update.
      	* main.c: Update.
      	* mi/mi-cmd-break.c: Update.
      	* mi/mi-cmd-stack.c: Update.
      	* mi/mi-interp.c: Update.
      	* mi/mi-main.c: Update.
      	* objc-lang.c: Update.
      	* p-valprint.c: Update.
      	* parse.c: Update.
      	* ppc-linux-tdep.c: Update.
      	* printcmd.c: Update.
      	* python/py-arch.c: Update.
      	* python/py-breakpoint.c: Update.
      	* python/py-cmd.c: Update.
      	* python/py-finishbreakpoint.c: Update.
      	* python/py-frame.c: Update.
      	* python/py-framefilter.c: Update.
      	* python/py-gdb-readline.c: Update.
      	* python/py-inferior.c: Update.
      	* python/py-infthread.c: Update.
      	* python/py-lazy-string.c: Update.
      	* python/py-linetable.c: Update.
      	* python/py-objfile.c: Update.
      	* python/py-param.c: Update.
      	* python/py-prettyprint.c: Update.
      	* python/py-progspace.c: Update.
      	* python/py-record-btrace.c: Update.
      	* python/py-record.c: Update.
      	* python/py-symbol.c: Update.
      	* python/py-type.c: Update.
      	* python/py-unwind.c: Update.
      	* python/py-utils.c: Update.
      	* python/py-value.c: Update.
      	* python/python.c: Update.
      	* record-btrace.c: Update.
      	* record-full.c: Update.
      	* remote-fileio.c: Update.
      	* remote.c: Update.
      	* riscv-tdep.c: Update.
      	* rs6000-aix-tdep.c: Update.
      	* rs6000-tdep.c: Update.
      	* rust-exp.y: Update.
      	* rust-lang.c: Update.
      	* s390-tdep.c: Update.
      	* selftest-arch.c: Update.
      	* solib-dsbt.c: Update.
      	* solib-frv.c: Update.
      	* solib-spu.c: Update.
      	* solib-svr4.c: Update.
      	* solib.c: Update.
      	* sparc64-linux-tdep.c: Update.
      	* stack.c: Update.
      	* symfile-mem.c: Update.
      	* symmisc.c: Update.
      	* target.c: Update.
      	* thread.c: Update.
      	* top.c: Update.
      	* tracefile-tfile.c: Update.
      	* tui/tui.c: Update.
      	* typeprint.c: Update.
      	* unittests/cli-utils-selftests.c: Update.
      	* unittests/parse-connection-spec-selftests.c: Update.
      	* valops.c: Update.
      	* valprint.c: Update.
      	* value.c: Update.
      	* varobj.c: Update.
      	* windows-nat.c: Update.
      	* x86-linux-nat.c: Update.
      	* xml-support.c: Update.
      
      gdb/gdbserver/ChangeLog
      2019-04-08  Tom Tromey  <tom@tromey.com>
      
      	* gdbreplay.c: Update.
      	* linux-low.c: Update.
      	* server.c: Update.
      230d2906
    • Tom Tromey's avatar
      Rewrite TRY/CATCH · a70b8144
      Tom Tromey authored
      This rewrites gdb's TRY/CATCH to plain C++ try/catch.  The patch was
      largely written by script, though one change (to a comment in
      common-exceptions.h) was reverted by hand.
      
      gdb/ChangeLog
      2019-04-08  Tom Tromey  <tom@tromey.com>
      
      	* xml-support.c: Use C++ exception handling.
      	* x86-linux-nat.c: Use C++ exception handling.
      	* windows-nat.c: Use C++ exception handling.
      	* varobj.c: Use C++ exception handling.
      	* value.c: Use C++ exception handling.
      	* valprint.c: Use C++ exception handling.
      	* valops.c: Use C++ exception handling.
      	* unittests/parse-connection-spec-selftests.c: Use C++ exception
      	handling.
      	* unittests/cli-utils-selftests.c: Use C++ exception handling.
      	* typeprint.c: Use C++ exception handling.
      	* tui/tui.c: Use C++ exception handling.
      	* tracefile-tfile.c: Use C++ exception handling.
      	* top.c: Use C++ exception handling.
      	* thread.c: Use C++ exception handling.
      	* target.c: Use C++ exception handling.
      	* symmisc.c: Use C++ exception handling.
      	* symfile-mem.c: Use C++ exception handling.
      	* stack.c: Use C++ exception handling.
      	* sparc64-linux-tdep.c: Use C++ exception handling.
      	* solib.c: Use C++ exception handling.
      	* solib-svr4.c: Use C++ exception handling.
      	* solib-spu.c: Use C++ exception handling.
      	* solib-frv.c: Use C++ exception handling.
      	* solib-dsbt.c: Use C++ exception handling.
      	* selftest-arch.c: Use C++ exception handling.
      	* s390-tdep.c: Use C++ exception handling.
      	* rust-lang.c: Use C++ exception handling.
      	* rust-exp.y: Use C++ exception handling.
      	* rs6000-tdep.c: Use C++ exception handling.
      	* rs6000-aix-tdep.c: Use C++ exception handling.
      	* riscv-tdep.c: Use C++ exception handling.
      	* remote.c: Use C++ exception handling.
      	* remote-fileio.c: Use C++ exception handling.
      	* record-full.c: Use C++ exception handling.
      	* record-btrace.c: Use C++ exception handling.
      	* python/python.c: Use C++ exception handling.
      	* python/py-value.c: Use C++ exception handling.
      	* python/py-utils.c: Use C++ exception handling.
      	* python/py-unwind.c: Use C++ exception handling.
      	* python/py-type.c: Use C++ exception handling.
      	* python/py-symbol.c: Use C++ exception handling.
      	* python/py-record.c: Use C++ exception handling.
      	* python/py-record-btrace.c: Use C++ exception handling.
      	* python/py-progspace.c: Use C++ exception handling.
      	* python/py-prettyprint.c: Use C++ exception handling.
      	* python/py-param.c: Use C++ exception handling.
      	* python/py-objfile.c: Use C++ exception handling.
      	* python/py-linetable.c: Use C++ exception handling.
      	* python/py-lazy-string.c: Use C++ exception handling.
      	* python/py-infthread.c: Use C++ exception handling.
      	* python/py-inferior.c: Use C++ exception handling.
      	* python/py-gdb-readline.c: Use C++ exception handling.
      	* python/py-framefilter.c: Use C++ exception handling.
      	* python/py-frame.c: Use C++ exception handling.
      	* python/py-finishbreakpoint.c: Use C++ exception handling.
      	* python/py-cmd.c: Use C++ exception handling.
      	* python/py-breakpoint.c: Use C++ exception handling.
      	* python/py-arch.c: Use C++ exception handling.
      	* printcmd.c: Use C++ exception handling.
      	* ppc-linux-tdep.c: Use C++ exception handling.
      	* parse.c: Use C++ exception handling.
      	* p-valprint.c: Use C++ exception handling.
      	* objc-lang.c: Use C++ exception handling.
      	* mi/mi-main.c: Use C++ exception handling.
      	* mi/mi-interp.c: Use C++ exception handling.
      	* mi/mi-cmd-stack.c: Use C++ exception handling.
      	* mi/mi-cmd-break.c: Use C++ exception handling.
      	* main.c: Use C++ exception handling.
      	* linux-thread-db.c: Use C++ exception handling.
      	* linux-tdep.c: Use C++ exception handling.
      	* linux-nat.c: Use C++ exception handling.
      	* linux-fork.c: Use C++ exception handling.
      	* linespec.c: Use C++ exception handling.
      	* language.c: Use C++ exception handling.
      	* jit.c: Use C++ exception handling.
      	* infrun.c: Use C++ exception handling.
      	* infcmd.c: Use C++ exception handling.
      	* infcall.c: Use C++ exception handling.
      	* inf-loop.c: Use C++ exception handling.
      	* i386-tdep.c: Use C++ exception handling.
      	* i386-linux-tdep.c: Use C++ exception handling.
      	* guile/scm-value.c: Use C++ exception handling.
      	* guile/scm-type.c: Use C++ exception handling.
      	* guile/scm-symtab.c: Use C++ exception handling.
      	* guile/scm-symbol.c: Use C++ exception handling.
      	* guile/scm-pretty-print.c: Use C++ exception handling.
      	* guile/scm-ports.c: Use C++ exception handling.
      	* guile/scm-param.c: Use C++ exception handling.
      	* guile/scm-math.c: Use C++ exception handling.
      	* guile/scm-lazy-string.c: Use C++ exception handling.
      	* guile/scm-frame.c: Use C++ exception handling.
      	* guile/scm-disasm.c: Use C++ exception handling.
      	* guile/scm-cmd.c: Use C++ exception handling.
      	* guile/scm-breakpoint.c: Use C++ exception handling.
      	* guile/scm-block.c: Use C++ exception handling.
      	* guile/guile-internal.h: Use C++ exception handling.
      	* gnu-v3-abi.c: Use C++ exception handling.
      	* gdbtypes.c: Use C++ exception handling.
      	* frame.c: Use C++ exception handling.
      	* frame-unwind.c: Use C++ exception handling.
      	* fbsd-tdep.c: Use C++ exception handling.
      	* f-valprint.c: Use C++ exception handling.
      	* exec.c: Use C++ exception handling.
      	* event-top.c: Use C++ exception handling.
      	* event-loop.c: Use C++ exception handling.
      	* eval.c: Use C++ exception handling.
      	* dwarf2read.c: Use C++ exception handling.
      	* dwarf2loc.c: Use C++ exception handling.
      	* dwarf2-frame.c: Use C++ exception handling.
      	* dwarf2-frame-tailcall.c: Use C++ exception handling.
      	* dwarf-index-write.c: Use C++ exception handling.
      	* dwarf-index-cache.c: Use C++ exception handling.
      	* dtrace-probe.c: Use C++ exception handling.
      	* disasm-selftests.c: Use C++ exception handling.
      	* darwin-nat.c: Use C++ exception handling.
      	* cp-valprint.c: Use C++ exception handling.
      	* cp-support.c: Use C++ exception handling.
      	* cp-abi.c: Use C++ exception handling.
      	* corelow.c: Use C++ exception handling.
      	* completer.c: Use C++ exception handling.
      	* compile/compile-object-run.c: Use C++ exception handling.
      	* compile/compile-object-load.c: Use C++ exception handling.
      	* compile/compile-cplus-symbols.c: Use C++ exception handling.
      	* compile/compile-c-symbols.c: Use C++ exception handling.
      	* common/selftest.c: Use C++ exception handling.
      	* common/new-op.c: Use C++ exception handling.
      	* cli/cli-script.c: Use C++ exception handling.
      	* cli/cli-interp.c: Use C++ exception handling.
      	* cli/cli-cmds.c: Use C++ exception handling.
      	* c-varobj.c: Use C++ exception handling.
      	* btrace.c: Use C++ exception handling.
      	* breakpoint.c: Use C++ exception handling.
      	* break-catch-throw.c: Use C++ exception handling.
      	* arch-utils.c: Use C++ exception handling.
      	* amd64-tdep.c: Use C++ exception handling.
      	* ada-valprint.c: Use C++ exception handling.
      	* ada-typeprint.c: Use C++ exception handling.
      	* ada-lang.c: Use C++ exception handling.
      	* aarch64-tdep.c: Use C++ exception handling.
      
      gdb/gdbserver/ChangeLog
      2019-04-08  Tom Tromey  <tom@tromey.com>
      
      	* server.c: Use C++ exception handling.
      	* linux-low.c: Use C++ exception handling.
      	* gdbreplay.c: Use C++ exception handling.
      a70b8144
  12. Jan 01, 2019
    • Joel Brobecker's avatar
      Update copyright year range in all GDB files. · 42a4f53d
      Joel Brobecker authored
      This commit applies all changes made after running the gdb/copyright.py
      script.
      
      Note that one file was flagged by the script, due to an invalid
      copyright header
      (gdb/unittests/basic_string_view/element_access/char/empty.cc).
      As the file was copied from GCC's libstdc++-v3 testsuite, this commit
      leaves this file untouched for the time being; a patch to fix the header
      was sent to gcc-patches first.
      
      gdb/ChangeLog:
      
      	Update copyright year range in all GDB files.
      42a4f53d
  13. Dec 27, 2018
    • Tom Tromey's avatar
      Remove more calls to xfree from Python · 075c55e0
      Tom Tromey authored
      This changes the Python code to remove some more calls to xfree, in
      favor of self-managing data structures.
      
      Tested on x86-64 Fedora 28.
      
      gdb/ChangeLog
      2018-12-27  Tom Tromey  <tom@tromey.com>
      
      	* python/python.c (python_interactive_command): Use std::string.
      	(gdbpy_parameter): Likewise.
      	* python/py-utils.c (unicode_to_encoded_string): Update comment.
      	* python/py-symtab.c (salpy_str): Use PyString_FromFormat.
      	* python/py-record-btrace.c (recpy_bt_insn_data): Use
      	byte_vector.
      	* python/py-objfile.c (objfpy_get_build_id): Use
      	unique_xmalloc_ptr.
      	* python/py-inferior.c (infpy_read_memory): Use
      	unique_xmalloc_ptr.
      	* python/py-cmd.c (gdbpy_parse_command_name): Use std::string.
      075c55e0
  14. Oct 05, 2018
    • Tom de Vries's avatar
      [gdb/python] Fix cpychecker error in recpy_bt_goto · 96b1ad86
      Tom de Vries authored
      When using cpychecker, we run into this error:
      ...
      gdb/python/py-record-btrace.c: \
        In function ‘PyObject* recpy_bt_goto(PyObject*, PyObject*)’:
      gdb/python/py-record-btrace.c:783:25: error: Mismatching type in call to \
        PyArg_ParseTuple with format code "O" [-Werror]
         if (!PyArg_ParseTuple (args, "O", &obj))
        argument 3 ("&obj") had type
          "const struct recpy_element_object * *"
        but was expecting
          "struct PyObject * *"
        for format code "O"
      ...
      
      Fix this by using a new variable of the expected type instead.
      
      Build and reg-tested on x86_64-linux.
      
      2018-10-05  Tom de Vries  <tdevries@suse.de>
      
      	* python/py-record-btrace.c (recpy_bt_goto): Fix type mismatch in
      	PyArg_ParseTuple call.
      96b1ad86
  15. Jun 21, 2018
    • Pedro Alves's avatar
      Use thread_info and inferior pointers more throughout · 00431a78
      Pedro Alves authored
      This is more preparation bits for multi-target support.
      
      In a multi-target scenario, we need to address the case of different
      processes/threads running on different targets that happen to have the
      same PID/PTID.  E.g., we can have both process 123 in target 1, and
      process 123 in target 2, while they're in reality different processes
      running on different machines.  Or maybe we've loaded multiple
      instances of the same core file.  Etc.
      
      To address this, in my WIP multi-target branch, threads and processes
      are uniquely identified by the (process_stratum target_ops *, ptid_t)
      and (process_stratum target_ops *, pid) tuples respectively.  I.e.,
      each process_stratum instance has its own thread/process number space.
      
      As you can imagine, that requires passing around target_ops * pointers
      in a number of functions where we're currently passing only a ptid_t
      or an int.  E.g., when we look up a thread_info object by ptid_t in
      find_thread_ptid, the ptid_t alone isn't sufficient.
      
      In many cases though, we already have the thread_info or inferior
      pointer handy, but we "lose" it somewhere along the call stack, only
      to look it up again by ptid_t/pid.  Since thread_info or inferior
      objects know their parent target, if we pass around thread_info or
      inferior pointers when possible, we avoid having to add extra
      target_ops parameters to many functions, and also, we eliminate a
      number of by ptid_t/int lookups.
      
      So that's what this patch does.  In a bit more detail:
      
      - Changes a number of functions and methods to take a thread_info or
        inferior pointer instead of a ptid_t or int parameter.
      
      - Changes a number of structure fields from ptid_t/int to inferior or
        thread_info pointers.
      
      - Uses the inferior_thread() function whenever possible instead of
        inferior_ptid.
      
      - Uses thread_info pointers directly when possible instead of the
        is_running/is_stopped etc. routines that require a lookup.
      
      - A number of functions are eliminated along the way, such as:
      
        int valid_gdb_inferior_id (int num);
        int pid_to_gdb_inferior_id (int pid);
        int gdb_inferior_id_to_pid (int num);
        int in_inferior_list (int pid);
      
      - A few structures and places hold a thread_info pointer across
        inferior execution, so now they take a strong reference to the
        (refcounted) thread_info object to avoid the thread_info pointer
        getting stale.  This is done in enable_thread_stack_temporaries and
        in the infcall.c code.
      
      - Related, there's a spot in infcall.c where using a RAII object to
        handle the refcount would be handy, so a gdb::ref_ptr specialization
        for thread_info is added (thread_info_ref, in gdbthread.h), along
        with a gdb_ref_ptr policy that works for all refcounted_object types
        (in common/refcounted-object.h).
      
      gdb/ChangeLog:
      2018-06-21  Pedro Alves  <palves@redhat.com>
      
      	* ada-lang.h (ada_get_task_number): Take a thread_info pointer
      	instead of a ptid_t.  All callers adjusted.
      	* ada-tasks.c (ada_get_task_number): Likewise.  All callers
      	adjusted.
      	(print_ada_task_info, display_current_task_id, task_command_1):
      	Adjust.
      	* breakpoint.c (watchpoint_in_thread_scope): Adjust to use
      	inferior_thread.
      	(breakpoint_kind): Adjust.
      	(remove_breakpoints_pid): Rename to ...
      	(remove_breakpoints_inf): ... this.  Adjust to take an inferior
      	pointer.  All callers adjusted.
      	(bpstat_clear_actions): Use inferior_thread.
      	(get_bpstat_thread): New.
      	(bpstat_do_actions): Use it.
      	(bpstat_check_breakpoint_conditions, bpstat_stop_status): Adjust
      	to take a thread_info pointer.  All callers adjusted.
      	(set_longjmp_breakpoint_for_call_dummy, set_momentary_breakpoint)
      	(breakpoint_re_set_thread): Use inferior_thread.
      	* breakpoint.h (struct inferior): Forward declare.
      	(bpstat_stop_status): Update.
      	(remove_breakpoints_pid): Delete.
      	(remove_breakpoints_inf): New.
      	* bsd-uthread.c (bsd_uthread_target::wait)
      	(bsd_uthread_target::update_thread_list): Use find_thread_ptid.
      	* btrace.c (btrace_add_pc, btrace_enable, btrace_fetch)
      	(maint_btrace_packet_history_cmd)
      	(maint_btrace_clear_packet_history_cmd): Adjust.
      	(maint_btrace_clear_cmd, maint_info_btrace_cmd): Adjust to use
      	inferior_thread.
      	* cli/cli-interp.c: Include "inferior.h".
      	* common/refcounted-object.h (struct
      	refcounted_object_ref_policy): New.
      	* compile/compile-object-load.c: Include gdbthread.h.
      	(store_regs): Use inferior_thread.
      	* corelow.c (core_target::close): Use current_inferior.
      	(core_target_open): Adjust to use first_thread_of_inferior and use
      	the current inferior.
      	* ctf.c (ctf_target::close): Adjust to use current_inferior.
      	* dummy-frame.c (dummy_frame_id) <ptid>: Delete, replaced by ...
      	<thread>: ... this new field.  All references adjusted.
      	(dummy_frame_pop, dummy_frame_discard, register_dummy_frame_dtor):
      	Take a thread_info pointer instead of a ptid_t.
      	* dummy-frame.h (dummy_frame_push, dummy_frame_pop)
      	(dummy_frame_discard, register_dummy_frame_dtor): Take a
      	thread_info pointer instead of a ptid_t.
      	* elfread.c: Include "inferior.h".
      	(elf_gnu_ifunc_resolver_stop, elf_gnu_ifunc_resolver_return_stop):
      	Use inferior_thread.
      	* eval.c (evaluate_subexp): Likewise.
      	* frame.c (frame_pop, has_stack_frames, find_frame_sal): Use
      	inferior_thread.
      	* gdb_proc_service.h (struct thread_info): Forward declare.
      	(struct ps_prochandle) <ptid>: Delete, replaced by ...
      	<thread>: ... this new field.  All references adjusted.
      	* gdbarch.h, gdbarch.c: Regenerate.
      	* gdbarch.sh (get_syscall_number): Replace 'ptid' parameter with a
      	'thread' parameter.  All implementations and callers adjusted.
      	* gdbthread.h (thread_info) <set_running>: New method.
      	(delete_thread, delete_thread_silent): Take a thread_info pointer
      	instead of a ptid.
      	(global_thread_id_to_ptid, ptid_to_global_thread_id): Delete.
      	(first_thread_of_process): Delete, replaced by ...
      	(first_thread_of_inferior): ... this new function.  All callers
      	adjusted.
      	(any_live_thread_of_process): Delete, replaced by ...
      	(any_live_thread_of_inferior): ... this new function.  All callers
      	adjusted.
      	(switch_to_thread, switch_to_no_thread): Declare.
      	(is_executing): Delete.
      	(enable_thread_stack_temporaries): Update comment.
      	<enable_thread_stack_temporaries>: Take a thread_info pointer
      	instead of a ptid_t.  Incref the thread.
      	<~enable_thread_stack_temporaries>: Decref the thread.
      	<m_ptid>: Delete
      	<m_thr>: New.
      	(thread_stack_temporaries_enabled_p, push_thread_stack_temporary)
      	(get_last_thread_stack_temporary)
      	(value_in_thread_stack_temporaries, can_access_registers_thread):
      	Take a thread_info pointer instead of a ptid_t.  All callers
      	adjusted.
      	* infcall.c (get_call_return_value): Use inferior_thread.
      	(run_inferior_call): Work with thread pointers instead of ptid_t.
      	(call_function_by_hand_dummy): Work with thread pointers instead
      	of ptid_t.  Use thread_info_ref.
      	* infcmd.c (proceed_thread_callback): Access thread's state
      	directly.
      	(ensure_valid_thread, ensure_not_running): Use inferior_thread,
      	access thread's state directly.
      	(continue_command): Use inferior_thread.
      	(info_program_command): Use find_thread_ptid and access thread
      	state directly.
      	(proceed_after_attach_callback): Use thread state directly.
      	(notice_new_inferior): Take a thread_info pointer instead of a
      	ptid_t.  All callers adjusted.
      	(exit_inferior): Take an inferior pointer instead of a pid.  All
      	callers adjusted.
      	(exit_inferior_silent): New.
      	(detach_inferior): Delete.
      	(valid_gdb_inferior_id, pid_to_gdb_inferior_id)
      	(gdb_inferior_id_to_pid, in_inferior_list): Delete.
      	(detach_inferior_command, kill_inferior_command): Use
      	find_inferior_id instead of valid_gdb_inferior_id and
      	gdb_inferior_id_to_pid.
      	(inferior_command): Use inferior and thread pointers.
      	* inferior.h (struct thread_info): Forward declare.
      	(notice_new_inferior): Take a thread_info pointer instead of a
      	ptid_t.  All callers adjusted.
      	(detach_inferior): Delete declaration.
      	(exit_inferior, exit_inferior_silent): Take an inferior pointer
      	instead of a pid.  All callers adjusted.
      	(gdb_inferior_id_to_pid, pid_to_gdb_inferior_id, in_inferior_list)
      	(valid_gdb_inferior_id): Delete.
      	* infrun.c (follow_fork_inferior, proceed_after_vfork_done)
      	(handle_vfork_child_exec_or_exit, follow_exec): Adjust.
      	(struct displaced_step_inferior_state) <pid>: Delete, replaced by
      	...
      	<inf>: ... this new field.
      	<step_ptid>: Delete, replaced by ...
      	<step_thread>: ... this new field.
      	(get_displaced_stepping_state): Take an inferior pointer instead
      	of a pid.  All callers adjusted.
      	(displaced_step_in_progress_any_inferior): Adjust.
      	(displaced_step_in_progress_thread): Take a thread pointer instead
      	of a ptid_t.  All callers adjusted.
      	(displaced_step_in_progress, add_displaced_stepping_state): Take
      	an inferior pointer instead of a pid.  All callers adjusted.
      	(get_displaced_step_closure_by_addr): Adjust.
      	(remove_displaced_stepping_state): Take an inferior pointer
      	instead of a pid.  All callers adjusted.
      	(displaced_step_prepare_throw, displaced_step_prepare)
      	(displaced_step_fixup): Take a thread pointer instead of a ptid_t.
      	All callers adjusted.
      	(start_step_over): Adjust.
      	(infrun_thread_ptid_changed): Remove bit updating ptids in the
      	displaced step queue.
      	(do_target_resume): Adjust.
      	(fetch_inferior_event): Use inferior_thread.
      	(context_switch, get_inferior_stop_soon): Take an
      	execution_control_state pointer instead of a ptid_t.  All callers
      	adjusted.
      	(switch_to_thread_cleanup): Delete.
      	(stop_all_threads): Use scoped_restore_current_thread.
      	* inline-frame.c: Include "gdbthread.h".
      	(inline_state) <inline_state>: Take a thread pointer instead of a
      	ptid_t.  All callers adjusted.
      	<ptid>: Delete, replaced by ...
      	<thread>: ... this new field.
      	(find_inline_frame_state): Take a thread pointer instead of a
      	ptid_t.  All callers adjusted.
      	(skip_inline_frames, step_into_inline_frame)
      	(inline_skipped_frames, inline_skipped_symbol): Take a thread
      	pointer instead of a ptid_t.  All callers adjusted.
      	* inline-frame.h (skip_inline_frames, step_into_inline_frame)
      	(inline_skipped_frames, inline_skipped_symbol): Likewise.
      	* linux-fork.c (delete_checkpoint_command): Adjust to use thread
      	pointers directly.
      	* linux-nat.c (get_detach_signal): Likewise.
      	* linux-thread-db.c (thread_from_lwp): New 'stopped' parameter.
      	(thread_db_notice_clone): Adjust.
      	(thread_db_find_new_threads_silently)
      	(thread_db_find_new_threads_2, thread_db_find_new_threads_1): Take
      	a thread pointer instead of a ptid_t.  All callers adjusted.
      	* mi/mi-cmd-var.c: Include "inferior.h".
      	(mi_cmd_var_update_iter): Update to use thread pointers.
      	* mi/mi-interp.c (mi_new_thread): Update to use the thread's
      	inferior directly.
      	(mi_output_running_pid, mi_inferior_count): Delete, bits factored
      	out to ...
      	(mi_output_running): ... this new function.
      	(mi_on_resume_1): Adjust to use it.
      	(mi_user_selected_context_changed): Adjust to use inferior_thread.
      	* mi/mi-main.c (proceed_thread): Adjust to use thread pointers
      	directly.
      	(interrupt_thread_callback): : Adjust to use thread and inferior
      	pointers.
      	* proc-service.c: Include "gdbthread.h".
      	(ps_pglobal_lookup): Adjust to use the thread's inferior directly.
      	* progspace-and-thread.c: Include "inferior.h".
      	* progspace.c: Include "inferior.h".
      	* python/py-exitedevent.c (create_exited_event_object): Adjust to
      	hold a reference to an inferior_object.
      	* python/py-finishbreakpoint.c (bpfinishpy_init): Adjust to use
      	inferior_thread.
      	* python/py-inferior.c (struct inferior_object): Give the type a
      	tag name instead of a typedef.
      	(python_on_normal_stop): No need to check if the current thread is
      	listed.
      	(inferior_to_inferior_object): Change return type to
      	inferior_object.  All callers adjusted.
      	(find_thread_object): Delete, bits factored out to ...
      	(thread_to_thread_object): ... this new function.
      	* python/py-infthread.c (create_thread_object): Use
      	inferior_to_inferior_object.
      	(thpy_is_stopped): Use thread pointer directly.
      	(gdbpy_selected_thread): Use inferior_thread.
      	* python/py-record-btrace.c (btpy_list_object) <ptid>: Delete
      	field, replaced with ...
      	<thread>: ... this new field.  All users adjusted.
      	(btpy_insn_or_gap_new): Drop const.
      	(btpy_list_new): Take a thread pointer instead of a ptid_t.  All
      	callers adjusted.
      	* python/py-record.c: Include "gdbthread.h".
      	(recpy_insn_new, recpy_func_new): Take a thread pointer instead of
      	a ptid_t.  All callers adjusted.
      	(gdbpy_current_recording): Use inferior_thread.
      	* python/py-record.h (recpy_record_object) <ptid>: Delete
      	field, replaced with ...
      	<thread>: ... this new field.  All users adjusted.
      	(recpy_element_object) <ptid>: Delete
      	field, replaced with ...
      	<thread>: ... this new field.  All users adjusted.
      	(recpy_insn_new, recpy_func_new): Take a thread pointer instead of
      	a ptid_t.  All callers adjusted.
      	* python/py-threadevent.c: Include "gdbthread.h".
      	(get_event_thread): Use thread_to_thread_object.
      	* python/python-internal.h (struct inferior_object): Forward
      	declare.
      	(find_thread_object, find_inferior_object): Delete declarations.
      	(thread_to_thread_object, inferior_to_inferior_object): New
      	declarations.
      	* record-btrace.c: Include "inferior.h".
      	(require_btrace_thread): Use inferior_thread.
      	(record_btrace_frame_sniffer)
      	(record_btrace_tailcall_frame_sniffer): Use inferior_thread.
      	(get_thread_current_frame): Use scoped_restore_current_thread and
      	switch_to_thread.
      	(get_thread_current_frame): Use thread pointer directly.
      	(record_btrace_replay_at_breakpoint): Use thread's inferior
      	pointer directly.
      	* record-full.c: Include "inferior.h".
      	* regcache.c: Include "gdbthread.h".
      	(get_thread_arch_regcache): Use the inferior's address space
      	directly.
      	(get_thread_regcache, registers_changed_thread): New.
      	* regcache.h (get_thread_regcache(thread_info *thread)): New
      	overload.
      	(registers_changed_thread): New.
      	(remote_target) <remote_detach_1>: Swap order of parameters.
      	(remote_add_thread): <remote_add_thread>: Return the new thread.
      	(get_remote_thread_info(ptid_t)): New overload.
      	(remote_target::remote_notice_new_inferior): Use thread pointers
      	directly.
      	(remote_target::process_initial_stop_replies): Use
      	thread_info::set_running.
      	(remote_target::remote_detach_1, remote_target::detach)
      	(extended_remote_target::detach): Adjust.
      	* stack.c (frame_show_address): Use inferior_thread.
      	* target-debug.h (target_debug_print_thread_info_pp): New.
      	* target-delegates.c: Regenerate.
      	* target.c (default_thread_address_space): Delete.
      	(memory_xfer_partial_1): Use current_inferior.
      	(target_detach): Use current_inferior.
      	(target_thread_address_space): Delete.
      	(generic_mourn_inferior): Use current_inferior.
      	* target.h (struct target_ops) <thread_address_space>: Delete.
      	(target_thread_address_space): Delete.
      	* thread.c (init_thread_list): Use ALL_THREADS_SAFE.  Use thread
      	pointers directly.
      	(delete_thread_1, delete_thread, delete_thread_silent): Take a
      	thread pointer instead of a ptid_t.  Adjust all callers.
      	(ptid_to_global_thread_id, global_thread_id_to_ptid): Delete.
      	(first_thread_of_process): Delete, replaced by ...
      	(first_thread_of_inferior): ... this new function.  All callers
      	adjusted.
      	(any_thread_of_process): Rename to ...
      	(any_thread_of_inferior): ... this, and take an inferior pointer.
      	(any_live_thread_of_process): Rename to ...
      	(any_live_thread_of_inferior): ... this, and take an inferior
      	pointer.
      	(thread_stack_temporaries_enabled_p, push_thread_stack_temporary)
      	(value_in_thread_stack_temporaries)
      	(get_last_thread_stack_temporary): Take a thread pointer instead
      	of a ptid_t.  Adjust all callers.
      	(thread_info::set_running): New.
      	(validate_registers_access): Use inferior_thread.
      	(can_access_registers_ptid): Rename to ...
      	(can_access_registers_thread): ... this, and take a thread
      	pointer.
      	(print_thread_info_1): Adjust to compare thread pointers instead
      	of ptids.
      	(switch_to_no_thread, switch_to_thread): Make extern.
      	(scoped_restore_current_thread::~scoped_restore_current_thread):
      	Use m_thread pointer directly.
      	(scoped_restore_current_thread::scoped_restore_current_thread):
      	Use inferior_thread.
      	(thread_command): Use thread pointer directly.
      	(thread_num_make_value_helper): Use inferior_thread.
      	* top.c (execute_command): Use inferior_thread.
      	* tui/tui-interp.c: Include "inferior.h".
      	* varobj.c (varobj_create): Use inferior_thread.
      	(value_of_root_1): Use find_thread_global_id instead of
      	global_thread_id_to_ptid.
      00431a78
  16. Apr 13, 2018
    • Markus Metzger's avatar
      btrace: set/show record btrace cpu · 4a4495d6
      Markus Metzger authored
      Add new set/show commands to set the processor that is used for enabling
      errata workarounds when decoding branch trace.
      
      The general format is "<vendor>:<identifier>" but we also allow two
      special values "auto" and "none".
      
      The default is "auto", which is the current behaviour of having GDB
      determine the processor on which the trace was recorded.
      
      If that cpu is not known to the trace decoder, e.g. when using an old
      decoder on a new system, decode may fail with "unknown cpu".  In most
      cases it should suffice to 'downgrade' decode to assume an older cpu.
      Unfortunately, we can't do this automatically.
      
      The other special value, "none", disables errata workarounds.
      
      gdb/
      	* NEWS (New options): announce set/show record btrace cpu.
      	* btrace.c: Include record-btrace.h.
      	(btrace_compute_ftrace_pt): Skip enabling errata workarounds if
      	the vendor is unknown.
      	(btrace_compute_ftrace_1): Add cpu parameter.  Update callers.
      	Maybe overwrite the btrace configuration's cpu.
      	(btrace_compute_ftrace): Add cpu parameter.  Update callers.
      	(btrace_fetch): Add cpu parameter.  Update callers.
      	(btrace_maint_update_pt_packets): Call record_btrace_get_cpu.
      	Maybe overwrite the btrace configuration's cpu.  Skip enabling
      	errata workarounds if the vendor is unknown.
      	* python/py-record-btrace.c: Include record-btrace.h.
      	(recpy_bt_begin, recpy_bt_end, recpy_bt_instruction_history)
      	(recpy_bt_function_call_history): Call record_btrace_get_cpu.
      	* record-btrace.c (record_btrace_cpu_state_kind): New.
      	(record_btrace_cpu): New.
      	(set_record_btrace_cpu_cmdlist): New.
      	(record_btrace_get_cpu): New.
      	(require_btrace_thread, record_btrace_info)
      	(record_btrace_resume_thread): Call record_btrace_get_cpu.
      	(cmd_set_record_btrace_cpu_none): New.
      	(cmd_set_record_btrace_cpu_auto): New.
      	(cmd_set_record_btrace_cpu): New.
      	(cmd_show_record_btrace_cpu): New.
      	(_initialize_record_btrace): Initialize set/show record btrace cpu
      	commands.
      	* record-btrace.h (record_btrace_get_cpu): New.
      
      testsuite/
      	* gdb.btrace/cpu.exp: New.
      
      doc/
      	* gdb.texinfo: Document set/show record btrace cpu.
      4a4495d6
  17. Jan 02, 2018
  18. Dec 05, 2017
    • Simon Marchi's avatar
      Remove some unused variables · 798a7429
      Simon Marchi authored
      This patch removes some unused variables, found with -Wunused.  I have
      not removed everything reported by -Wunused, because some expressions
      such as
      
        struct type *arg_type = check_typedef (value_type);
      
      in bfin-tdep.c could have an unexpected but important side-effect.  I
      removed others that I considered more low-risk, such as:
      
        struct gdbarch *gdbarch = get_objfile_arch (objfile);
      
      I tested building with Python 2/Python 3/no Python, with/without expat,
      with/without libipt and with/without babeltrace.
      
      gdb/ChangeLog:
      
      	* ada-lang.c (ada_collect_symbol_completion_matches): Remove
      	unused variables.
      	(ada_is_redundant_range_encoding): Likewise.
      	* ada-varobj.c (ada_varobj_get_value_of_array_variable):
      	Likewise.
      	* alpha-tdep.c (alpha_software_single_step): Likewise.
      	* arm-tdep.c (_initialize_arm_tdep): Likewise.
      	* auto-load.c (info_auto_load_cmd): Likewise.
      	* break-catch-syscall.c (insert_catch_syscall): Likewise.
      	(remove_catch_syscall): Likewise.
      	* breakpoint.c (condition_completer): Likewise.
      	(clear_command): Likewise.
      	(update_breakpoint_locations): Likewise.
      	* btrace.c (btrace_disable): Likewise.
      	(btrace_teardown): Likewise.
      	(btrace_maint_update_pt_packets): Likewise.
      	(maint_btrace_clear_cmd): Likewise.
      	* cli/cli-decode.c (lookup_cmd_1): Likewise.
      	(lookup_cmd_composition): Likewise.
      	* cli/cli-dump.c (scan_filename): Likewise.
      	(restore_command): Likewise.
      	* compile/compile-loc2c.c (compute_stack_depth): Likewise.
      	* compile/compile-object-load.c (compile_object_load): Likewise.
      	* compile/compile-object-run.c (compile_object_run): Likewise.
      	* compile/compile.c (compile_to_object): Likewise.
      	* completer.c (filename_completer): Likewise.
      	(complete_files_symbols): Likewise.
      	(complete_expression): Likewise.
      	* corelow.c (core_open): Likewise.
      	* ctf.c (ctf_start): Likewise.
      	(ctf_write_status): Likewise.
      	(ctf_write_uploaded_tsv): Likewise.
      	(ctf_write_definition_end): Likewise.
      	(ctf_open_dir): Likewise.
      	(ctf_xfer_partial): Likewise.
      	(ctf_trace_find): Likewise.
      	* disasm.c (gdb_pretty_print_disassembler::pretty_print_insn):
      	Likewise.
      	* dwarf2loc.c (allocate_piece_closure): Likewise.
      	(indirect_pieced_value): Likewise.
      	(dwarf2_evaluate_loc_desc_full): Likewise.
      	* dwarf2read.c (dw2_expand_marked_cus): Likewise.
      	(dw2_expand_symtabs_matching): Likewise.
      	(dw2_map_symbol_filenames): Likewise.
      	(read_and_check_comp_unit_head): Likewise.
      	(read_cutu_die_from_dwo): Likewise.
      	(lookup_dwo_unit): Likewise.
      	(read_comp_units_from_section): Likewise.
      	(dwarf2_compute_name): Likewise.
      	(handle_DW_AT_stmt_list): Likewise.
      	(create_cus_hash_table): Likewise.
      	(create_dwp_v2_section): Likewise.
      	(dwarf2_rnglists_process): Likewise.
      	(dwarf2_ranges_process): Likewise.
      	(dwarf2_record_block_ranges): Likewise.
      	(is_vtable_name): Likewise.
      	(read_formatted_entries): Likewise.
      	(skip_form_bytes): Likewise.
      	* elfread.c (elf_symtab_read): Likewise.
      	* exec.c (exec_file_command): Likewise.
      	* f-valprint.c (f_val_print): Likewise.
      	(info_common_command_for_block): Likewise.
      	* guile/guile.c (initialize_scheme_side): Likewise.
      	* guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Likewise.
      	* guile/scm-cmd.c (cmdscm_completer): Likewise.
      	(gdbscm_register_command_x): Likewise.
      	* guile/scm-frame.c (gdbscm_frame_read_var): Likewise.
      	* guile/scm-param.c (gdbscm_parameter_value): Likewise.
      	* guile/scm-ports.c (file_port_magic): Likewise.
      	* guile/scm-pretty-print.c (ppscm_search_pp_list): Likewise.
      	(ppscm_pretty_print_one_value): Likewise.
      	(ppscm_print_children): Likewise.
      	* guile/scm-string.c (gdbscm_string_to_argv): Likewise.
      	* guile/scm-symtab.c (gdbscm_sal_symtab): Likewise.
      	* guile/scm-type.c (gdbscm_type_next_field_x): Likewise.
      	* guile/scm-utils.c (gdbscm_parse_function_args): Likewise.
      	* i386-tdep.c (i386_register_reggroup_p): Likewise.
      	* infcmd.c (run_command_1): Likewise.
      	(until_next_fsm_clean_up): Likewise.
      	* linespec.c (linespec_complete): Likewise.
      	(find_label_symbols): Likewise.
      	* m2-valprint.c (m2_val_print): Likewise.
      	* memattr.c (require_user_regions): Likewise.
      	(lookup_mem_region): Likewise.
      	(disable_mem_command): Likewise.
      	(mem_delete): Likewise.
      	* mep-tdep.c (mep_register_name): Likewise.
      	(mep_analyze_prologue): Likewise.
      	* mi/mi-cmd-file.c (mi_cmd_file_list_shared_libraries): Likewise.
      	* mi/mi-interp.c (mi_on_sync_execution_done): Likewise.
      	* mi/mi-main.c (mi_cmd_trace_frame_collected): Likewise.
      	* microblaze-linux-tdep.c (microblaze_linux_init_abi): Likewise.
      	* minidebug.c (lzma_open): Likewise.
      	* minsyms.c (lookup_minimal_symbol): Likewise.
      	* mips-linux-tdep.c (mips64_fill_fpregset): Likewise.
      	* mips-tdep.c (mips_stub_frame_sniffer): Likewise.
      	(mips_o64_return_value): Likewise.
      	(mips_single_step_through_delay): Likewise.
      	(_initialize_mips_tdep): Likewise.
      	* nios2-tdep.c (nios2_push_dummy_call): Likewise.
      	(nios2_software_single_step): Likewise.
      	* parse.c (find_minsym_type_and_address): Likewise.
      	* psymtab.c (psym_relocate): Likewise.
      	* python/py-breakpoint.c (bppy_get_commands): Likewise.
      	(gdbpy_breakpoint_modified): Likewise.
      	* python/py-infevents.c (create_inferior_call_event_object):
      	Likewise.
      	* python/py-record-btrace.c (btpy_list_item): Likewise.
      	* python/py-type.c (typy_str): Likewise.
      	* python/py-value.c (valpy_call): Likewise.
      	* python/python.c (do_start_initialization): Likewise.
      	* record-btrace.c (record_btrace_insn_history_range): Likewise.
      	(record_btrace_call_history_range): Likewise.
      	(record_btrace_record_method): Likewise.
      	(record_btrace_xfer_partial): Likewise.
      	(btrace_get_frame_function): Likewise.
      	* record-full.c (record_full_open): Likewise.
      	* record.c (get_context_size): Likewise.
      	* registry.h (DEFINE_REGISTRY): Likewise.
      	* remote-fileio.c (remote_fileio_request): Likewise.
      	* remote.c (remote_update_thread_list): Likewise.
      	(remote_check_symbols): Likewise.
      	(remote_commit_resume): Likewise.
      	(remote_interrupt): Likewise.
      	(remote_insert_breakpoint): Likewise.
      	(compare_sections_command): Likewise.
      	* rust-exp.y (super_name): Likewise.
      	(lex_string): Likewise.
      	(convert_ast_to_type): Likewise.
      	(convert_ast_to_expression): Likewise.
      	* rust-lang.c (rust_print_struct_def): Likewise.
      	(rust_print_type): Likewise.
      	(rust_evaluate_subexp): Likewise.
      	* rx-tdep.c (rx_register_type): Likewise.
      	* ser-event.c (serial_event_clear): Likewise.
      	* serial.c (serial_open): Likewise.
      	* spu-tdep.c (spu_overlay_new_objfile): Likewise.
      	* symfile.c (section_is_overlay): Likewise.
      	(overlay_unmapped_address): Likewise.
      	(overlay_mapped_address): Likewise.
      	(simple_overlay_update_1): Likewise.
      	(simple_overlay_update): Likewise.
      	* symtab.c (symbol_find_demangled_name): Likewise.
      	(search_symbols): Likewise.
      	* target-descriptions.c (tdesc_predefined_type): Likewise.
      	* target.c (target_commit_resume): Likewise.
      	* thread.c (print_selected_thread_frame): Likewise.
      	* top.c (new_ui_command): Likewise.
      	(gdb_readline_no_editing): Likewise.
      	* tracefile-tfile.c (tfile_open): Likewise.
      	* tracepoint.c (create_tsv_from_upload): Likewise.
      	* utils.c (quit): Likewise.
      	(defaulted_query): Likewise.
      	* valarith.c (value_concat): Likewise.
      	* xml-syscall.c (xml_list_syscalls_by_group): Likewise.
      	* xml-tdesc.c (target_fetch_description_xml): Likewise.
      	* xtensa-tdep.c (xtensa_pseudo_register_read): Likewise.
      	(xtensa_pseudo_register_write): Likewise.
      
      gdb/gdbserver/ChangeLog:
      
      	* regcache.c (registers_to_string): Remove unused variable.
      798a7429
  19. Sep 04, 2017
    • Simon Marchi's avatar
      btrace: Store btrace_insn in an std::vector · 0860c437
      Simon Marchi authored
      Because it contains a non-POD type field (flags), the type btrace_insn
      should be new'ed/delete'd.  Replace the VEC (btrace_insn_s) in
      btrace_function with an std::vector.
      
      gdb/ChangeLog:
      
      	* btrace.h (btrace_insn_s, DEF_VEC_O (btrace_insn_s)): Remove.
      	(btrace_function) <insn>: Change type to use std::vector.
      	* btrace.c (ftrace_debug, ftrace_call_num_insn,
      	ftrace_find_call, ftrace_new_gap, ftrace_update_function,
      	ftrace_update_insns, ftrace_compute_global_level_offset,
      	btrace_stitch_bts, btrace_clear, btrace_insn_get,
      	btrace_insn_end, btrace_insn_next, btrace_insn_prev): Adjust to
      	change to std::vector.
      	(ftrace_update_insns): Adjust to change to std::vector, change
      	type of INSN parameter.
      	(btrace_compute_ftrace_bts): Adjust call to ftrace_update_insns.
      	* record-btrace.c (btrace_call_history_insn_range,
      	btrace_compute_src_line_range,
      	record_btrace_frame_prev_register): Adjust to change to
      	std::vector.
      	* python/py-record-btrace.c (recpy_bt_func_instructions): Adjust
      	to change to std::vector.
      0860c437
  20. May 30, 2017
  21. May 02, 2017
  22. Apr 05, 2017
    • Pedro Alves's avatar
      -Wwrite-strings: Wrap PyGetSetDef for construction with string literals · 0d1f4ceb
      Pedro Alves authored
      Unfortunately, PyGetSetDef's 'name' and 'doc' members are 'char *'
      instead of 'const char *', meaning that in order to list-initialize
      PyGetSetDef arrays using string literals requires writing explicit
      'char *' casts.  For example:
      
          static PyGetSetDef value_object_getset[] = {
         -  { "address", valpy_get_address, NULL, "The address of the value.",
         +  { (char *) "address", valpy_get_address, NULL,
         +    (char *) "The address of the value.",
      	NULL },
         -  { "is_optimized_out", valpy_get_is_optimized_out, NULL,
         -    "Boolean telling whether the value is optimized "
         +  { (char *) "is_optimized_out", valpy_get_is_optimized_out, NULL,
         +    (char *) "Boolean telling whether the value is optimized "
      	"out (i.e., not available).",
      	NULL },
         -  { "type", valpy_get_type, NULL, "Type of the value.", NULL },
         -  { "dynamic_type", valpy_get_dynamic_type, NULL,
         -    "Dynamic type of the value.", NULL },
         -  { "is_lazy", valpy_get_is_lazy, NULL,
         -    "Boolean telling whether the value is lazy (not fetched yet\n\
         +  { (char *) "type", valpy_get_type, NULL,
         +    (char *) "Type of the value.", NULL },
         +  { (char *) "dynamic_type", valpy_get_dynamic_type, NULL,
         +    (char *) "Dynamic type of the value.", NULL },
         +  { (char *) "is_lazy", valpy_get_is_lazy, NULL,
         +    (char *) "Boolean telling whether the value is lazy (not fetched yet\n\
          from the inferior).  A lazy value is fetched when needed, or when\n\
          the \"fetch_lazy()\" method is called.", NULL },
            {NULL}  /* Sentinel */
      
      We have ~20 such arrays, and I first wrote a patch that fixed all of
      them like that...  It's not pretty...
      
      One way to make these a bit less ugly would be add a new macro that
      hides the casts, like:
      
        #define GDBPY_GSDEF(NAME, GET, SET, DOC, CLOSURE) \
           { (char *) NAME, GET, SET, (char *) DOC, CLOSURE }
      
      and then use it like:
      
          static PyGetSetDef value_object_getset[] = {
             GDBPY_GSDEF ("address", valpy_get_address, NULL,
             		    "The address of the value.", NULL),
             GDBPY_GSDEF ("is_optimized_out", valpy_get_is_optimized_out, NULL,
             		    "Boolean telling whether the value is optimized ", NULL),
            {NULL}  /* Sentinel */
          };
      
      But since we have C++11, which gives us constexpr and list
      initialization, I thought of a way that requires no changes where the
      arrays are initialized:
      
      We add a new type that extends PyGetSetDef (called gdb_PyGetSetDef),
      and add constexpr constructors that accept const 'name' and 'doc', and
      then list/aggregate initialization simply "calls" these matching
      constructors instead.
      
      I put "calls" in quotes, because given "constexpr", it's all done at
      compile time, and there's no overhead either in binary size or at run
      time.  In fact, we get identical binaries, before/after this change.
      
      Unlike the fixes that fix some old Python API to match the API of more
      recent Python, this switches to using explicit "gdb_PyGetSetDef"
      everywhere, just to be clear that we are using our own version of it.
      
      gdb/ChangeLog:
      2017-04-05  Pedro Alves  <palves@redhat.com>
      
      	* python/python-internal.h (gdb_PyGetSetDef): New type.
      	* python/py-block.c (block_object_getset)
      	(breakpoint_object_getset): Now a gdb_PyGetSetDef array.
      	* python/py-event.c (event_object_getset)
      	(finish_breakpoint_object_getset): Likewise.
      	* python/py-inferior.c (inferior_object_getset): Likewise.
      	* python/py-infthread.c (thread_object_getset): Likewise.
      	* python/py-lazy-string.c (lazy_string_object_getset): Likewise.
      	* python/py-linetable.c (linetable_entry_object_getset): Likewise.
      	* python/py-objfile.c (objfile_getset): Likewise.
      	* python/py-progspace.c (pspace_getset): Likewise.
      	* python/py-record-btrace.c (btpy_insn_getset, btpy_call_getset):
      	Likewise.
      	* python/py-record.c (recpy_record_getset): Likewise.
      	* python/py-symbol.c (symbol_object_getset): Likewise.
      	* python/py-symtab.c (symtab_object_getset, sal_object_getset):
      	Likewise.
      	* python/py-type.c (type_object_getset, field_object_getset):
      	Likewise.
      	* python/py-value.c (value_object_getset): Likewise.
      0d1f4ceb
  23. Mar 21, 2017
    • Tim Wiederhake's avatar
      Fix break on Python 2 · cee59b3f
      Tim Wiederhake authored
      This changes the return type of "gdb.BtraceInstruction.data ()" from
      "memoryview" to "buffer" on Python 2.7 and below, similar to what
      "gdb.Inferior.read_memory ()" does.
      cee59b3f
  24. Feb 14, 2017
    • Tim Wiederhake's avatar
      python: Implement btrace Python bindings for record history. · 75c0bdf4
      Tim Wiederhake authored
      
      This patch implements the gdb.Record Python object methods and fields for
      record target btrace.  Also, implement a stub for record target full.
      
      Signed-off-by: default avatarTim Wiederhake <tim.wiederhake@intel.com>
      
      gdb/ChangeLog:
      
      	* Makefile.in (SUBDIR_PYTHON_OBS): Add py-record-btrace.o,
      	py-record-full.o.
      	(SUBDIR_PYTHON_SRCS): Add py-record-btrace.c, py-record-full.c.
      	* python/py-record-btrace.c, python/py-record-btrace.h,
      	python/py-record-full.c, python/py-record-full.h: New file.
      	* python/py-record.c: Add include for py-record-btrace.h and
      	py-record-full.h.
      	(recpy_method, recpy_format, recpy_goto, recpy_replay_position,
      	recpy_instruction_history, recpy_function_call_history, recpy_begin,
      	recpy_end): Use functions from py-record-btrace.c and py-record-full.c.
      	* python/python-internal.h (PyInt_FromSsize_t, PyInt_AsSsize_t):
      	New definition.
      	(gdbpy_initialize_btrace): New export.
      	* python/python.c (_initialize_python): Add gdbpy_initialize_btrace.
      
      Change-Id: I8bd893672ffc7e619cc1386767897249e125973a
      75c0bdf4
Loading