aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-event.h
AgeCommit message (Collapse)AuthorFilesLines
2024-02-20gdb: pass frames as `const frame_info_ptr &`Simon Marchi1-1/+1
We currently pass frames to function by value, as `frame_info_ptr`. This is somewhat expensive: - the size of `frame_info_ptr` is 64 bytes, which is a bit big to pass by value - the constructors and destructor link/unlink the object in the global `frame_info_ptr::frame_list` list. This is an `intrusive_list`, so it's not so bad: it's just assigning a few points, there's no memory allocation as if it was `std::list`, but still it's useless to do that over and over. As suggested by Tom Tromey, change many function signatures to accept `const frame_info_ptr &` instead of `frame_info_ptr`. Some functions reassign their `frame_info_ptr` parameter, like: void the_func (frame_info_ptr frame) { for (; frame != nullptr; frame = get_prev_frame (frame)) { ... } } I wondered what to do about them, do I leave them as-is or change them (and need to introduce a separate local variable that can be re-assigned). I opted for the later for consistency. It might not be clear why some functions take `const frame_info_ptr &` while others take `frame_info_ptr`. Also, if a function took a `frame_info_ptr` because it did re-assign its parameter, I doubt that we would think to change it to `const frame_info_ptr &` should the implementation change such that it doesn't need to take `frame_info_ptr` anymore. It seems better to have a simple rule and apply it everywhere. Change-Id: I59d10addef687d157f82ccf4d54f5dde9a963fd0 Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-01-12Update copyright year range in header of all files managed by GDBAndrew Burgess1-1/+1
This commit is the result of the following actions: - Running gdb/copyright.py to update all of the copyright headers to include 2024, - Manually updating a few files the copyright.py script told me to update, these files had copyright headers embedded within the file, - Regenerating gdbsupport/Makefile.in to refresh it's copyright date, - Using grep to find other files that still mentioned 2023. If these files were updated last year from 2022 to 2023 then I've updated them this year to 2024. I'm sure I've probably missed some dates. Feel free to fix them up as you spot them.
2023-10-05gdb: add program_space parameter to emit_clear_objfiles_eventSimon Marchi1-1/+1
Add program_space space parameters to emit_clear_objfiles_event and create_clear_objfiles_event_object, making the reference to current_program_space bubble up a bit. Change-Id: I5fde2071712781e5d45971fa0ab34d85d3a49a71 Approved-By: Tom Tromey <tom@tromey.com>
2023-06-19gdb/Python: Added ThreadExitedEventSimon Farre1-0/+3
v6: Fix comments. Fix copyright Remove unnecessary test suite stuff. save_var had to stay, as it mutates some test suite state that otherwise fails. v5: Did what Tom Tromey requested in v4; which can be found here: https://pi.simark.ca/gdb-patches/87pmjm0xar.fsf@tromey.com/ v4: Doc formatting fixed. v3: Eli: Updated docs & NEWS to reflect new changes. Added a reference from the .ptid attribute of the ThreadExitedEvent to the ptid attribute of InferiorThread. To do this, I've added an anchor to that attribute. Tom: Tom requested that I should probably just emit the thread object; I ran into two issues for this, which I could not resolve in this patch; 1 - The Thread Object (the python type) checks it's own validity by doing a comparison of it's `thread_info* thread` to nullptr. This means that any access of it's attributes may (probably, since we are in "async" land) throw Python exceptions because the thread has been removed from the thread object. Therefore I've decided in v3 of this patch to just emit most of the same fields that gdb.InferiorThread has, namely global_num, name, num and ptid (the 3-attribute tuple provided by gdb.InferiorThread.ptid). 2 - A python user can hold a global reference to an exiting thread. Thus in order to have a ThreadExit event that can provide attribute access reliably (both as a global reference, but also inside the thread exit handler, as we can never guarantee that it's executed _before_ the thread_info pointer is removed from the gdbpy thread object), the `thread_info *` thread pointer must not be null. However, this comes at the cost of gdb.InferiorThread believing it is "valid" - which means, that if a user holds takes a global reference to that exiting event thread object, they can some time later do `t.switch()` at which point GDB will 'explode' so to speak. v2: Fixed white space issues and NULL/nullptr stuff, as requested by Tom Tromey. v1: Currently no event is emitted for a thread exit. This adds this functionality by emitting a new gdb.ThreadExitedEvent. It currently provides four attributes: - global_num: The GDB assigned global thread number - num: the per-inferior thread number - name: name of the thread or none if not set - ptid: the PTID of the thread, a 3-attribute tuple, identical to InferiorThread.ptid attribute Added info to docs & the NEWS file as well. Added test to test suite. Fixed formatting. Feedback wanted and appreciated.
2023-01-01Update copyright year range in header of all files managed by GDBJoel Brobecker1-1/+1
This commit is the result of running the gdb/copyright.py script, which automated the update of the copyright year range for all source files managed by the GDB project to be updated to include year 2023.
2022-10-10Change GDB to use frame_info_ptrTom Tromey1-1/+1
This changes GDB to use frame_info_ptr instead of frame_info * The substitution was done with multiple sequential `sed` commands: sed 's/^struct frame_info;/class frame_info_ptr;/' sed 's/struct frame_info \*/frame_info_ptr /g' - which left some issues in a few files, that were manually fixed. sed 's/\<frame_info \*/frame_info_ptr /g' sed 's/frame_info_ptr $/frame_info_ptr/g' - used to remove whitespace problems. The changed files were then manually checked and some 'sed' changes undone, some constructors and some gets were added, according to what made sense, and what Tromey originally did Co-Authored-By: Bruno Larsen <blarsen@redhat.com> Approved-by: Tom Tomey <tom@tromey.com>
2022-07-18Add gdb.free_objfile event registryTom Tromey1-0/+1
Currently, Python code can use event registries to detect when gdb loads a new objfile, and when gdb clears the objfile list. However, there's no way to detect the removal of an objfile, say when the inferior calls dlclose. This patch adds a gdb.free_objfile event registry and arranges for an event to be emitted in this case.
2022-04-28Remove "typedef enum ..."Tom Tromey1-2/+2
I noticed a few spots in GDB that use "typedef enum". However, in C++ this isn't as useful, as the tag is automatically entered as a typedef. This patch removes most uses of "typedef enum" -- the exceptions being in some nat-* code I can't compile, and glibc_thread_db.h, which I think is more or less a copy of some C code from elsewhere. Tested by rebuilding.
2022-01-01Automatic Copyright Year update after running gdb/copyright.pyJoel Brobecker1-1/+1
This commit brings all the changes made by running gdb/copyright.py as per GDB's Start of New Year Procedure. For the avoidance of doubt, all changes in this commits were performed by the script.
2021-01-01Update copyright year range in all GDB filesJoel Brobecker1-1/+1
This commits the result of running gdb/copyright.py as per our Start of New Year procedure... gdb/ChangeLog Update copyright year range in copyright header of all GDB files.
2020-12-04Remove redundant typedefsTom Tromey1-2/+2
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.
2020-11-02gdb, gdbserver, gdbsupport: fix leading space vs tabs issuesSimon Marchi1-4/+4
Many spots incorrectly use only spaces for indentation (for example, there are a lot of spots in ada-lang.c). I've always found it awkward when I needed to edit one of these spots: do I keep the original wrong indentation, or do I fix it? What if the lines around it are also wrong, do I fix them too? I probably don't want to fix them in the same patch, to avoid adding noise to my patch. So I propose to fix as much as possible once and for all (hopefully). One typical counter argument for this is that it makes code archeology more difficult, because git-blame will show this commit as the last change for these lines. My counter counter argument is: when git-blaming, you often need to do "blame the file at the parent commit" anyway, to go past some other refactor that touched the line you are interested in, but is not the change you are looking for. So you already need a somewhat efficient way to do this. Using some interactive tool, rather than plain git-blame, makes this trivial. For example, I use "tig blame <file>", where going back past the commit that changed the currently selected line is one keystroke. It looks like Magit in Emacs does it too (though I've never used it). Web viewers of Github and Gitlab do it too. My point is that it won't really make archeology more difficult. The other typical counter argument is that it will cause conflicts with existing patches. That's true... but it's a one time cost, and those are not conflicts that are difficult to resolve. I have also tried "git rebase --ignore-whitespace", it seems to work well. Although that will re-introduce the faulty indentation, so one needs to take care of fixing the indentation in the patch after that (which is easy). gdb/ChangeLog: * aarch64-linux-tdep.c: Fix indentation. * aarch64-ravenscar-thread.c: Fix indentation. * aarch64-tdep.c: Fix indentation. * aarch64-tdep.h: Fix indentation. * ada-lang.c: Fix indentation. * ada-lang.h: Fix indentation. * ada-tasks.c: Fix indentation. * ada-typeprint.c: Fix indentation. * ada-valprint.c: Fix indentation. * ada-varobj.c: Fix indentation. * addrmap.c: Fix indentation. * addrmap.h: Fix indentation. * agent.c: Fix indentation. * aix-thread.c: Fix indentation. * alpha-bsd-nat.c: Fix indentation. * alpha-linux-tdep.c: Fix indentation. * alpha-mdebug-tdep.c: Fix indentation. * alpha-nbsd-tdep.c: Fix indentation. * alpha-obsd-tdep.c: Fix indentation. * alpha-tdep.c: Fix indentation. * amd64-bsd-nat.c: Fix indentation. * amd64-darwin-tdep.c: Fix indentation. * amd64-linux-nat.c: Fix indentation. * amd64-linux-tdep.c: Fix indentation. * amd64-nat.c: Fix indentation. * amd64-obsd-tdep.c: Fix indentation. * amd64-tdep.c: Fix indentation. * amd64-windows-tdep.c: Fix indentation. * annotate.c: Fix indentation. * arc-tdep.c: Fix indentation. * arch-utils.c: Fix indentation. * arch/arm-get-next-pcs.c: Fix indentation. * arch/arm.c: Fix indentation. * arm-linux-nat.c: Fix indentation. * arm-linux-tdep.c: Fix indentation. * arm-nbsd-tdep.c: Fix indentation. * arm-pikeos-tdep.c: Fix indentation. * arm-tdep.c: Fix indentation. * arm-tdep.h: Fix indentation. * arm-wince-tdep.c: Fix indentation. * auto-load.c: Fix indentation. * auxv.c: Fix indentation. * avr-tdep.c: Fix indentation. * ax-gdb.c: Fix indentation. * ax-general.c: Fix indentation. * bfin-linux-tdep.c: Fix indentation. * block.c: Fix indentation. * block.h: Fix indentation. * blockframe.c: Fix indentation. * bpf-tdep.c: Fix indentation. * break-catch-sig.c: Fix indentation. * break-catch-syscall.c: Fix indentation. * break-catch-throw.c: Fix indentation. * breakpoint.c: Fix indentation. * breakpoint.h: Fix indentation. * bsd-uthread.c: Fix indentation. * btrace.c: Fix indentation. * build-id.c: Fix indentation. * buildsym-legacy.h: Fix indentation. * buildsym.c: Fix indentation. * c-typeprint.c: Fix indentation. * c-valprint.c: Fix indentation. * c-varobj.c: Fix indentation. * charset.c: Fix indentation. * cli/cli-cmds.c: Fix indentation. * cli/cli-decode.c: Fix indentation. * cli/cli-decode.h: Fix indentation. * cli/cli-script.c: Fix indentation. * cli/cli-setshow.c: Fix indentation. * coff-pe-read.c: Fix indentation. * coffread.c: Fix indentation. * compile/compile-cplus-types.c: Fix indentation. * compile/compile-object-load.c: Fix indentation. * compile/compile-object-run.c: Fix indentation. * completer.c: Fix indentation. * corefile.c: Fix indentation. * corelow.c: Fix indentation. * cp-abi.h: Fix indentation. * cp-namespace.c: Fix indentation. * cp-support.c: Fix indentation. * cp-valprint.c: Fix indentation. * cris-linux-tdep.c: Fix indentation. * cris-tdep.c: Fix indentation. * darwin-nat-info.c: Fix indentation. * darwin-nat.c: Fix indentation. * darwin-nat.h: Fix indentation. * dbxread.c: Fix indentation. * dcache.c: Fix indentation. * disasm.c: Fix indentation. * dtrace-probe.c: Fix indentation. * dwarf2/abbrev.c: Fix indentation. * dwarf2/attribute.c: Fix indentation. * dwarf2/expr.c: Fix indentation. * dwarf2/frame.c: Fix indentation. * dwarf2/index-cache.c: Fix indentation. * dwarf2/index-write.c: Fix indentation. * dwarf2/line-header.c: Fix indentation. * dwarf2/loc.c: Fix indentation. * dwarf2/macro.c: Fix indentation. * dwarf2/read.c: Fix indentation. * dwarf2/read.h: Fix indentation. * elfread.c: Fix indentation. * eval.c: Fix indentation. * event-top.c: Fix indentation. * exec.c: Fix indentation. * exec.h: Fix indentation. * expprint.c: Fix indentation. * f-lang.c: Fix indentation. * f-typeprint.c: Fix indentation. * f-valprint.c: Fix indentation. * fbsd-nat.c: Fix indentation. * fbsd-tdep.c: Fix indentation. * findvar.c: Fix indentation. * fork-child.c: Fix indentation. * frame-unwind.c: Fix indentation. * frame-unwind.h: Fix indentation. * frame.c: Fix indentation. * frv-linux-tdep.c: Fix indentation. * frv-tdep.c: Fix indentation. * frv-tdep.h: Fix indentation. * ft32-tdep.c: Fix indentation. * gcore.c: Fix indentation. * gdb_bfd.c: Fix indentation. * gdbarch.sh: Fix indentation. * gdbarch.c: Re-generate * gdbarch.h: Re-generate. * gdbcore.h: Fix indentation. * gdbthread.h: Fix indentation. * gdbtypes.c: Fix indentation. * gdbtypes.h: Fix indentation. * glibc-tdep.c: Fix indentation. * gnu-nat.c: Fix indentation. * gnu-nat.h: Fix indentation. * gnu-v2-abi.c: Fix indentation. * gnu-v3-abi.c: Fix indentation. * go32-nat.c: Fix indentation. * guile/guile-internal.h: Fix indentation. * guile/scm-cmd.c: Fix indentation. * guile/scm-frame.c: Fix indentation. * guile/scm-iterator.c: Fix indentation. * guile/scm-math.c: Fix indentation. * guile/scm-ports.c: Fix indentation. * guile/scm-pretty-print.c: Fix indentation. * guile/scm-value.c: Fix indentation. * h8300-tdep.c: Fix indentation. * hppa-linux-nat.c: Fix indentation. * hppa-linux-tdep.c: Fix indentation. * hppa-nbsd-nat.c: Fix indentation. * hppa-nbsd-tdep.c: Fix indentation. * hppa-obsd-nat.c: Fix indentation. * hppa-tdep.c: Fix indentation. * hppa-tdep.h: Fix indentation. * i386-bsd-nat.c: Fix indentation. * i386-darwin-nat.c: Fix indentation. * i386-darwin-tdep.c: Fix indentation. * i386-dicos-tdep.c: Fix indentation. * i386-gnu-nat.c: Fix indentation. * i386-linux-nat.c: Fix indentation. * i386-linux-tdep.c: Fix indentation. * i386-nto-tdep.c: Fix indentation. * i386-obsd-tdep.c: Fix indentation. * i386-sol2-nat.c: Fix indentation. * i386-tdep.c: Fix indentation. * i386-tdep.h: Fix indentation. * i386-windows-tdep.c: Fix indentation. * i387-tdep.c: Fix indentation. * i387-tdep.h: Fix indentation. * ia64-libunwind-tdep.c: Fix indentation. * ia64-libunwind-tdep.h: Fix indentation. * ia64-linux-nat.c: Fix indentation. * ia64-linux-tdep.c: Fix indentation. * ia64-tdep.c: Fix indentation. * ia64-tdep.h: Fix indentation. * ia64-vms-tdep.c: Fix indentation. * infcall.c: Fix indentation. * infcmd.c: Fix indentation. * inferior.c: Fix indentation. * infrun.c: Fix indentation. * iq2000-tdep.c: Fix indentation. * language.c: Fix indentation. * linespec.c: Fix indentation. * linux-fork.c: Fix indentation. * linux-nat.c: Fix indentation. * linux-tdep.c: Fix indentation. * linux-thread-db.c: Fix indentation. * lm32-tdep.c: Fix indentation. * m2-lang.c: Fix indentation. * m2-typeprint.c: Fix indentation. * m2-valprint.c: Fix indentation. * m32c-tdep.c: Fix indentation. * m32r-linux-tdep.c: Fix indentation. * m32r-tdep.c: Fix indentation. * m68hc11-tdep.c: Fix indentation. * m68k-bsd-nat.c: Fix indentation. * m68k-linux-nat.c: Fix indentation. * m68k-linux-tdep.c: Fix indentation. * m68k-tdep.c: Fix indentation. * machoread.c: Fix indentation. * macrocmd.c: Fix indentation. * macroexp.c: Fix indentation. * macroscope.c: Fix indentation. * macrotab.c: Fix indentation. * macrotab.h: Fix indentation. * main.c: Fix indentation. * mdebugread.c: Fix indentation. * mep-tdep.c: Fix indentation. * mi/mi-cmd-catch.c: Fix indentation. * mi/mi-cmd-disas.c: Fix indentation. * mi/mi-cmd-env.c: Fix indentation. * mi/mi-cmd-stack.c: Fix indentation. * mi/mi-cmd-var.c: Fix indentation. * mi/mi-cmds.c: Fix indentation. * mi/mi-main.c: Fix indentation. * mi/mi-parse.c: Fix indentation. * microblaze-tdep.c: Fix indentation. * minidebug.c: Fix indentation. * minsyms.c: Fix indentation. * mips-linux-nat.c: Fix indentation. * mips-linux-tdep.c: Fix indentation. * mips-nbsd-tdep.c: Fix indentation. * mips-tdep.c: Fix indentation. * mn10300-linux-tdep.c: Fix indentation. * mn10300-tdep.c: Fix indentation. * moxie-tdep.c: Fix indentation. * msp430-tdep.c: Fix indentation. * namespace.h: Fix indentation. * nat/fork-inferior.c: Fix indentation. * nat/gdb_ptrace.h: Fix indentation. * nat/linux-namespaces.c: Fix indentation. * nat/linux-osdata.c: Fix indentation. * nat/netbsd-nat.c: Fix indentation. * nat/x86-dregs.c: Fix indentation. * nbsd-nat.c: Fix indentation. * nbsd-tdep.c: Fix indentation. * nios2-linux-tdep.c: Fix indentation. * nios2-tdep.c: Fix indentation. * nto-procfs.c: Fix indentation. * nto-tdep.c: Fix indentation. * objfiles.c: Fix indentation. * objfiles.h: Fix indentation. * opencl-lang.c: Fix indentation. * or1k-tdep.c: Fix indentation. * osabi.c: Fix indentation. * osabi.h: Fix indentation. * osdata.c: Fix indentation. * p-lang.c: Fix indentation. * p-typeprint.c: Fix indentation. * p-valprint.c: Fix indentation. * parse.c: Fix indentation. * ppc-linux-nat.c: Fix indentation. * ppc-linux-tdep.c: Fix indentation. * ppc-nbsd-nat.c: Fix indentation. * ppc-nbsd-tdep.c: Fix indentation. * ppc-obsd-nat.c: Fix indentation. * ppc-ravenscar-thread.c: Fix indentation. * ppc-sysv-tdep.c: Fix indentation. * ppc64-tdep.c: Fix indentation. * printcmd.c: Fix indentation. * proc-api.c: Fix indentation. * producer.c: Fix indentation. * producer.h: Fix indentation. * prologue-value.c: Fix indentation. * prologue-value.h: Fix indentation. * psymtab.c: Fix indentation. * python/py-arch.c: Fix indentation. * python/py-bpevent.c: Fix indentation. * python/py-event.c: Fix indentation. * python/py-event.h: Fix indentation. * python/py-finishbreakpoint.c: Fix indentation. * python/py-frame.c: Fix indentation. * python/py-framefilter.c: Fix indentation. * python/py-inferior.c: Fix indentation. * python/py-infthread.c: Fix indentation. * python/py-objfile.c: Fix indentation. * python/py-prettyprint.c: Fix indentation. * python/py-registers.c: Fix indentation. * python/py-signalevent.c: Fix indentation. * python/py-stopevent.c: Fix indentation. * python/py-stopevent.h: Fix indentation. * python/py-threadevent.c: Fix indentation. * python/py-tui.c: Fix indentation. * python/py-unwind.c: Fix indentation. * python/py-value.c: Fix indentation. * python/py-xmethods.c: Fix indentation. * python/python-internal.h: Fix indentation. * python/python.c: Fix indentation. * ravenscar-thread.c: Fix indentation. * record-btrace.c: Fix indentation. * record-full.c: Fix indentation. * record.c: Fix indentation. * reggroups.c: Fix indentation. * regset.h: Fix indentation. * remote-fileio.c: Fix indentation. * remote.c: Fix indentation. * reverse.c: Fix indentation. * riscv-linux-tdep.c: Fix indentation. * riscv-ravenscar-thread.c: Fix indentation. * riscv-tdep.c: Fix indentation. * rl78-tdep.c: Fix indentation. * rs6000-aix-tdep.c: Fix indentation. * rs6000-lynx178-tdep.c: Fix indentation. * rs6000-nat.c: Fix indentation. * rs6000-tdep.c: Fix indentation. * rust-lang.c: Fix indentation. * rx-tdep.c: Fix indentation. * s12z-tdep.c: Fix indentation. * s390-linux-tdep.c: Fix indentation. * score-tdep.c: Fix indentation. * ser-base.c: Fix indentation. * ser-mingw.c: Fix indentation. * ser-uds.c: Fix indentation. * ser-unix.c: Fix indentation. * serial.c: Fix indentation. * sh-linux-tdep.c: Fix indentation. * sh-nbsd-tdep.c: Fix indentation. * sh-tdep.c: Fix indentation. * skip.c: Fix indentation. * sol-thread.c: Fix indentation. * solib-aix.c: Fix indentation. * solib-darwin.c: Fix indentation. * solib-frv.c: Fix indentation. * solib-svr4.c: Fix indentation. * solib.c: Fix indentation. * source.c: Fix indentation. * sparc-linux-tdep.c: Fix indentation. * sparc-nbsd-tdep.c: Fix indentation. * sparc-obsd-tdep.c: Fix indentation. * sparc-ravenscar-thread.c: Fix indentation. * sparc-tdep.c: Fix indentation. * sparc64-linux-tdep.c: Fix indentation. * sparc64-nbsd-tdep.c: Fix indentation. * sparc64-obsd-tdep.c: Fix indentation. * sparc64-tdep.c: Fix indentation. * stabsread.c: Fix indentation. * stack.c: Fix indentation. * stap-probe.c: Fix indentation. * stubs/ia64vms-stub.c: Fix indentation. * stubs/m32r-stub.c: Fix indentation. * stubs/m68k-stub.c: Fix indentation. * stubs/sh-stub.c: Fix indentation. * stubs/sparc-stub.c: Fix indentation. * symfile-mem.c: Fix indentation. * symfile.c: Fix indentation. * symfile.h: Fix indentation. * symmisc.c: Fix indentation. * symtab.c: Fix indentation. * symtab.h: Fix indentation. * target-float.c: Fix indentation. * target.c: Fix indentation. * target.h: Fix indentation. * tic6x-tdep.c: Fix indentation. * tilegx-linux-tdep.c: Fix indentation. * tilegx-tdep.c: Fix indentation. * top.c: Fix indentation. * tracefile-tfile.c: Fix indentation. * tracepoint.c: Fix indentation. * tui/tui-disasm.c: Fix indentation. * tui/tui-io.c: Fix indentation. * tui/tui-regs.c: Fix indentation. * tui/tui-stack.c: Fix indentation. * tui/tui-win.c: Fix indentation. * tui/tui-winsource.c: Fix indentation. * tui/tui.c: Fix indentation. * typeprint.c: Fix indentation. * ui-out.h: Fix indentation. * unittests/copy_bitwise-selftests.c: Fix indentation. * unittests/memory-map-selftests.c: Fix indentation. * utils.c: Fix indentation. * v850-tdep.c: Fix indentation. * valarith.c: Fix indentation. * valops.c: Fix indentation. * valprint.c: Fix indentation. * valprint.h: Fix indentation. * value.c: Fix indentation. * value.h: Fix indentation. * varobj.c: Fix indentation. * vax-tdep.c: Fix indentation. * windows-nat.c: Fix indentation. * windows-tdep.c: Fix indentation. * xcoffread.c: Fix indentation. * xml-syscall.c: Fix indentation. * xml-tdesc.c: Fix indentation. * xstormy16-tdep.c: Fix indentation. * xtensa-config.c: Fix indentation. * xtensa-linux-nat.c: Fix indentation. * xtensa-linux-tdep.c: Fix indentation. * xtensa-tdep.c: Fix indentation. gdbserver/ChangeLog: * ax.cc: Fix indentation. * dll.cc: Fix indentation. * inferiors.h: Fix indentation. * linux-low.cc: Fix indentation. * linux-nios2-low.cc: Fix indentation. * linux-ppc-ipa.cc: Fix indentation. * linux-ppc-low.cc: Fix indentation. * linux-x86-low.cc: Fix indentation. * linux-xtensa-low.cc: Fix indentation. * regcache.cc: Fix indentation. * server.cc: Fix indentation. * tracepoint.cc: Fix indentation. gdbsupport/ChangeLog: * common-exceptions.h: Fix indentation. * event-loop.cc: Fix indentation. * fileio.cc: Fix indentation. * filestuff.cc: Fix indentation. * gdb-dlfcn.cc: Fix indentation. * gdb_string_view.h: Fix indentation. * job-control.cc: Fix indentation. * signals.cc: Fix indentation. Change-Id: I4bad7ae6be0fbe14168b8ebafb98ffe14964a695
2020-01-01Update copyright year range in all GDB files.Joel Brobecker1-1/+1
gdb/ChangeLog: Update copyright year range in all GDB files.
2019-02-07Normalize include guards in gdbTom Tromey1-3/+3
While working on my other scripts to deal with gdb headers, I noticed that some files were missing include guards. I wrote a script to add the missing ones, but found that using the obvious names for the guards ran into clashes -- for example, gdb/nat/linux-nat.h used "LINUX_NAT_H", but this was also the script's choice for gdb/linux-nat.h. So, I changed the script to normalize all include guards in gdb. This patch is the result. As usual the script is available here: https://github.com/tromey/gdb-refactoring-scripts Tested by rebuilding; I also ran it through "Fedora-x86_64-m64" on the buildbot. gdb/ChangeLog 2019-02-07 Tom Tromey <tom@tromey.com> * yy-remap.h: Add include guard. * xtensa-tdep.h: Add include guard. * xcoffread.h: Rename include guard. * varobj-iter.h: Add include guard. * tui/tui.h: Rename include guard. * tui/tui-winsource.h: Rename include guard. * tui/tui-wingeneral.h: Rename include guard. * tui/tui-windata.h: Rename include guard. * tui/tui-win.h: Rename include guard. * tui/tui-stack.h: Rename include guard. * tui/tui-source.h: Rename include guard. * tui/tui-regs.h: Rename include guard. * tui/tui-out.h: Rename include guard. * tui/tui-layout.h: Rename include guard. * tui/tui-io.h: Rename include guard. * tui/tui-hooks.h: Rename include guard. * tui/tui-file.h: Rename include guard. * tui/tui-disasm.h: Rename include guard. * tui/tui-data.h: Rename include guard. * tui/tui-command.h: Rename include guard. * tic6x-tdep.h: Add include guard. * target/waitstatus.h: Rename include guard. * target/wait.h: Rename include guard. * target/target.h: Rename include guard. * target/resume.h: Rename include guard. * target-float.h: Rename include guard. * stabsread.h: Add include guard. * rs6000-tdep.h: Add include guard. * riscv-fbsd-tdep.h: Add include guard. * regformats/regdef.h: Rename include guard. * record.h: Rename include guard. * python/python.h: Rename include guard. * python/python-internal.h: Rename include guard. * python/py-stopevent.h: Rename include guard. * python/py-ref.h: Rename include guard. * python/py-record.h: Rename include guard. * python/py-record-full.h: Rename include guard. * python/py-record-btrace.h: Rename include guard. * python/py-instruction.h: Rename include guard. * python/py-events.h: Rename include guard. * python/py-event.h: Rename include guard. * procfs.h: Add include guard. * proc-utils.h: Add include guard. * p-lang.h: Add include guard. * or1k-tdep.h: Rename include guard. * observable.h: Rename include guard. * nto-tdep.h: Rename include guard. * nat/x86-linux.h: Rename include guard. * nat/x86-linux-dregs.h: Rename include guard. * nat/x86-gcc-cpuid.h: Add include guard. * nat/x86-dregs.h: Rename include guard. * nat/x86-cpuid.h: Rename include guard. * nat/ppc-linux.h: Rename include guard. * nat/mips-linux-watch.h: Rename include guard. * nat/linux-waitpid.h: Rename include guard. * nat/linux-ptrace.h: Rename include guard. * nat/linux-procfs.h: Rename include guard. * nat/linux-osdata.h: Rename include guard. * nat/linux-nat.h: Rename include guard. * nat/linux-namespaces.h: Rename include guard. * nat/linux-btrace.h: Rename include guard. * nat/glibc_thread_db.h: Rename include guard. * nat/gdb_thread_db.h: Rename include guard. * nat/gdb_ptrace.h: Rename include guard. * nat/fork-inferior.h: Rename include guard. * nat/amd64-linux-siginfo.h: Rename include guard. * nat/aarch64-sve-linux-sigcontext.h: Rename include guard. * nat/aarch64-sve-linux-ptrace.h: Rename include guard. * nat/aarch64-linux.h: Rename include guard. * nat/aarch64-linux-hw-point.h: Rename include guard. * mn10300-tdep.h: Add include guard. * mips-linux-tdep.h: Add include guard. * mi/mi-parse.h: Rename include guard. * mi/mi-out.h: Rename include guard. * mi/mi-main.h: Rename include guard. * mi/mi-interp.h: Rename include guard. * mi/mi-getopt.h: Rename include guard. * mi/mi-console.h: Rename include guard. * mi/mi-common.h: Rename include guard. * mi/mi-cmds.h: Rename include guard. * mi/mi-cmd-break.h: Rename include guard. * m2-lang.h: Add include guard. * location.h: Rename include guard. * linux-record.h: Rename include guard. * linux-nat.h: Add include guard. * linux-fork.h: Add include guard. * i386-darwin-tdep.h: Rename include guard. * hppa-linux-offsets.h: Add include guard. * guile/guile.h: Rename include guard. * guile/guile-internal.h: Rename include guard. * gnu-nat.h: Rename include guard. * gdb-stabs.h: Rename include guard. * frv-tdep.h: Add include guard. * f-lang.h: Add include guard. * event-loop.h: Add include guard. * darwin-nat.h: Rename include guard. * cp-abi.h: Rename include guard. * config/sparc/nm-sol2.h: Rename include guard. * config/nm-nto.h: Rename include guard. * config/nm-linux.h: Add include guard. * config/i386/nm-i386gnu.h: Rename include guard. * config/djgpp/nl_types.h: Rename include guard. * config/djgpp/langinfo.h: Rename include guard. * compile/gcc-cp-plugin.h: Add include guard. * compile/gcc-c-plugin.h: Add include guard. * compile/compile.h: Rename include guard. * compile/compile-object-run.h: Rename include guard. * compile/compile-object-load.h: Rename include guard. * compile/compile-internal.h: Rename include guard. * compile/compile-cplus.h: Rename include guard. * compile/compile-c.h: Rename include guard. * common/xml-utils.h: Rename include guard. * common/x86-xstate.h: Rename include guard. * common/version.h: Rename include guard. * common/vec.h: Rename include guard. * common/tdesc.h: Rename include guard. * common/selftest.h: Rename include guard. * common/scoped_restore.h: Rename include guard. * common/scoped_mmap.h: Rename include guard. * common/scoped_fd.h: Rename include guard. * common/safe-iterator.h: Rename include guard. * common/run-time-clock.h: Rename include guard. * common/refcounted-object.h: Rename include guard. * common/queue.h: Rename include guard. * common/ptid.h: Rename include guard. * common/print-utils.h: Rename include guard. * common/preprocessor.h: Rename include guard. * common/pathstuff.h: Rename include guard. * common/observable.h: Rename include guard. * common/netstuff.h: Rename include guard. * common/job-control.h: Rename include guard. * common/host-defs.h: Rename include guard. * common/gdb_wait.h: Rename include guard. * common/gdb_vecs.h: Rename include guard. * common/gdb_unlinker.h: Rename include guard. * common/gdb_unique_ptr.h: Rename include guard. * common/gdb_tilde_expand.h: Rename include guard. * common/gdb_sys_time.h: Rename include guard. * common/gdb_string_view.h: Rename include guard. * common/gdb_splay_tree.h: Rename include guard. * common/gdb_setjmp.h: Rename include guard. * common/gdb_ref_ptr.h: Rename include guard. * common/gdb_optional.h: Rename include guard. * common/gdb_locale.h: Rename include guard. * common/gdb_assert.h: Rename include guard. * common/filtered-iterator.h: Rename include guard. * common/filestuff.h: Rename include guard. * common/fileio.h: Rename include guard. * common/environ.h: Rename include guard. * common/common-utils.h: Rename include guard. * common/common-types.h: Rename include guard. * common/common-regcache.h: Rename include guard. * common/common-inferior.h: Rename include guard. * common/common-gdbthread.h: Rename include guard. * common/common-exceptions.h: Rename include guard. * common/common-defs.h: Rename include guard. * common/common-debug.h: Rename include guard. * common/cleanups.h: Rename include guard. * common/buffer.h: Rename include guard. * common/btrace-common.h: Rename include guard. * common/break-common.h: Rename include guard. * cli/cli-utils.h: Rename include guard. * cli/cli-style.h: Rename include guard. * cli/cli-setshow.h: Rename include guard. * cli/cli-script.h: Rename include guard. * cli/cli-interp.h: Rename include guard. * cli/cli-decode.h: Rename include guard. * cli/cli-cmds.h: Rename include guard. * charset-list.h: Add include guard. * buildsym-legacy.h: Rename include guard. * bfin-tdep.h: Add include guard. * ax.h: Rename include guard. * arm-linux-tdep.h: Add include guard. * arm-fbsd-tdep.h: Add include guard. * arch/xtensa.h: Rename include guard. * arch/tic6x.h: Add include guard. * arch/i386.h: Add include guard. * arch/arm.h: Rename include guard. * arch/arm-linux.h: Rename include guard. * arch/arm-get-next-pcs.h: Rename include guard. * arch/amd64.h: Add include guard. * arch/aarch64-insn.h: Rename include guard. * arch-utils.h: Rename include guard. * annotate.h: Add include guard. * amd64-darwin-tdep.h: Rename include guard. * aarch64-linux-tdep.h: Add include guard. * aarch64-fbsd-tdep.h: Add include guard. * aarch32-linux-nat.h: Add include guard. gdb/gdbserver/ChangeLog 2019-02-07 Tom Tromey <tom@tromey.com> * x86-tdesc.h: Rename include guard. * x86-low.h: Add include guard. * wincecompat.h: Rename include guard. * win32-low.h: Add include guard. * utils.h: Rename include guard. * tracepoint.h: Rename include guard. * tdesc.h: Rename include guard. * target.h: Rename include guard. * server.h: Rename include guard. * remote-utils.h: Rename include guard. * regcache.h: Rename include guard. * nto-low.h: Rename include guard. * notif.h: Add include guard. * mem-break.h: Rename include guard. * lynx-low.h: Add include guard. * linux-x86-tdesc.h: Add include guard. * linux-s390-tdesc.h: Add include guard. * linux-ppc-tdesc-init.h: Add include guard. * linux-low.h: Add include guard. * linux-aarch64-tdesc.h: Add include guard. * linux-aarch32-low.h: Add include guard. * inferiors.h: Rename include guard. * i387-fp.h: Rename include guard. * hostio.h: Rename include guard. * gdbthread.h: Rename include guard. * gdb_proc_service.h: Rename include guard. * event-loop.h: Rename include guard. * dll.h: Rename include guard. * debug.h: Rename include guard. * ax.h: Rename include guard.
2019-01-22Do not include py-ref.h in most filesTom Tromey1-1/+0
py-ref.h can really only be included from a specific spot in python-internal.h. The other includes are not useful, and cause compilation errors if the includes are ever sorted. So, remove these includes. Arguably, py-ref.h should simply not be a separate header. gdb/ChangeLog 2019-01-22 Tom Tromey <tom@tromey.com> * python/py-arch.c: Do not include py-ref.h. * python/py-bpevent.c: Do not include py-ref.h. * python/py-cmd.c: Do not include py-ref.h. * python/py-continueevent.c: Do not include py-ref.h. * python/py-event.h: Do not include py-ref.h. * python/py-evtregistry.c: Do not include py-ref.h. * python/py-finishbreakpoint.c: Do not include py-ref.h. * python/py-frame.c: Do not include py-ref.h. * python/py-framefilter.c: Do not include py-ref.h. * python/py-function.c: Do not include py-ref.h. * python/py-infevents.c: Do not include py-ref.h. * python/py-linetable.c: Do not include py-ref.h. * python/py-objfile.c: Do not include py-ref.h. * python/py-param.c: Do not include py-ref.h. * python/py-prettyprint.c: Do not include py-ref.h. * python/py-progspace.c: Do not include py-ref.h. * python/py-symbol.c: Do not include py-ref.h. * python/py-symtab.c: Do not include py-ref.h. * python/py-type.c: Do not include py-ref.h. * python/py-unwind.c: Do not include py-ref.h. * python/py-utils.c: Do not include py-ref.h. * python/py-value.c: Do not include py-ref.h. * python/py-varobj.c: Do not include py-ref.h. * python/py-xmethods.c: Do not include py-ref.h. * python/python.c: Do not include py-ref.h. * varobj.c: Do not include py-ref.h.
2019-01-01Update copyright year range in all GDB files.Joel Brobecker1-1/+1
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.
2018-09-16Change thread_to_thread_object to return a new referenceTom Tromey1-3/+2
This changes thread_to_thread_object to return a new reference and fixes up all the callers. gdb/ChangeLog 2018-09-16 Tom Tromey <tom@tromey.com> * python/python-internal.h (thread_to_thread_object): Change return type. * python/py-inferior.c (thread_to_thread_object): Return a new reference. (infpy_thread_from_thread_handle): Update. * python/py-infthread.c (gdbpy_selected_thread): Update. * python/py-stopevent.c (create_stop_event_object): Update. * python/py-threadevent.c (py_get_event_thread): Return a new reference. (py_get_event_thread): Update. * python/py-event.h (py_get_event_thread): Change return type. * python/py-continueevent.c (create_continue_event_object): Update.
2018-08-24Fix 8.2 regression in gdb.python/py-evthreads.exp w/ gdbserver (PR gdb/23379)Pedro Alves1-1/+11
This commit fixes a 8.1->8.2 regression exposed by gdb.python/py-evthreads.exp when testing with --target_board=native-gdbserver. gdb.log shows: src/gdb/thread.c:93: internal-error: thread_info* inferior_thread(): Assertion `tp' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) FAIL: gdb.python/py-evthreads.exp: run to breakpoint 1 (GDB internal error) A backtrace shows (frames #2 and #10 highlighted) that the assertion fails when GDB is setting up the connection to the remote target, in non-stop mode: #0 0x0000000000622ff0 in internal_error(char const*, int, char const*, ...) (file=0xc1ad98 "src/gdb/thread.c", line=93, fmt=0xc1ad20 "%s: Assertion `%s' failed.") at src/gdb/common/errors.c:54 #1 0x000000000089567e in inferior_thread() () at src/gdb/thread.c:93 = #2 0x00000000004da91d in get_event_thread() () at src/gdb/python/py-threadevent.c:38 #3 0x00000000004da9b7 in create_thread_event_object(_typeobject*, _object*) (py_type=0x11574c0 <continue_event_object_type>, thread=0x0) at src/gdb/python/py-threadevent.c:60 #4 0x00000000004bf6fe in create_continue_event_object() () at src/gdb/python/py-continueevent.c:27 #5 0x00000000004bf738 in emit_continue_event(ptid_t) (ptid=...) at src/gdb/python/py-continueevent.c:40 #6 0x00000000004c7d47 in python_on_resume(ptid_t) (ptid=...) at src/gdb/python/py-inferior.c:108 #7 0x0000000000485bfb in std::_Function_handler<void (ptid_t), void (*)(ptid_t)>::_M_invoke(std::_Any_data const&, ptid_t&&) (__functor=..., __args#0=...) at /usr/include/c++/7/bits/std_function.h:316 #8 0x000000000089b416 in std::function<void (ptid_t)>::operator()(ptid_t) const (this=0x12aa600, __args#0=...) at /usr/include/c++/7/bits/std_function.h:706 #9 0x000000000089aa0e in gdb::observers::observable<ptid_t>::notify(ptid_t) const (this=0x118a7a0 <gdb::observers::target_resumed>, args#0=...) at src/gdb/common/observable.h:106 = #10 0x0000000000896fbe in set_running(ptid_t, int) (ptid=..., running=1) at src/gdb/thread.c:880 #11 0x00000000007f750f in remote_target::remote_add_thread(ptid_t, bool, bool) (this=0x12c5440, ptid=..., running=true, executing=true) at src/gdb/remote.c:2434 #12 0x00000000007f779d in remote_target::remote_notice_new_inferior(ptid_t, int) (this=0x12c5440, currthread=..., executing=1) at src/gdb/remote.c:2515 #13 0x00000000007f9c44 in remote_target::update_thread_list() (this=0x12c5440) at src/gdb/remote.c:3831 #14 0x00000000007fb922 in remote_target::start_remote(int, int) (this=0x12c5440, from_tty=0, extended_p=0) at src/gdb/remote.c:4655 #15 0x00000000007fd102 in remote_target::open_1(char const*, int, int) (name=0x1a4f45e "localhost:2346", from_tty=0, extended_p=0) at src/gdb/remote.c:5638 #16 0x00000000007fbec1 in remote_target::open(char const*, int) (name=0x1a4f45e "localhost:2346", from_tty=0) at src/gdb/remote.c:4862 So on frame #10, we're marking a newly-discovered thread as running, and that causes the Python API to emit a gdb.ContinueEvent. gdb.ContinueEvent is a gdb.ThreadEvent, and as such includes the event thread as the "inferior_thread" attribute. The problem is that when we get to frame #3/#4, we lost all references to the thread that is being marked as running. create_continue_event_object assumes that it is the current thread, which is not true in this case. Fix this by passing down the right thread in create_continue_event_object. Also remove create_thread_event_object's default argument and have the only other caller left pass down the right thread explicitly too. gdb/ChangeLog: 2018-08-24 Pedro Alves <palves@redhat.com> Simon Marchi <simon.marchi@ericsson.com> PR gdb/23379 * python/py-continueevent.c: Include "gdbthread.h". (create_continue_event_object): Add intro comment. Add 'ptid' parameter. Use it to find thread to pass to create_thread_event_object. (emit_continue_event): Pass PTID down to create_continue_event_object. * python/py-event.h (py_get_event_thread): Declare. (create_thread_event_object): Remove default from 'thread' parameter. * python/py-stopevent.c (create_stop_event_object): Use py_get_event_thread. * python/py-threadevent.c (get_event_thread): Rename to ... (py_get_event_thread): ... this, make extern, add 'ptid' parameter and use it to find the thread. (create_thread_event_object): Assert that THREAD isn't null. Don't find the event thread here.
2018-01-02Update copyright year range in all GDB filesJoel Brobecker1-1/+1
gdb/ChangeLog: Update copyright year range in all GDB files
2017-09-11Make it simpler to add events to PythonTom Tromey1-68/+6
The first patch in this series went through several iterations as I'd forgotten how many places had to be touched to add a new event and a new event type. This patch simplifies the process using two new ".def" files. Now, a new event type can be added by adding a line to "py-event-types.def", and a new event registry can be added by adding a line to "py-all-events.def". ChangeLog 2017-09-11 Tom Tromey <tom@tromey.com> * python/python.c (do_start_initialization): Use py-event-types.def to initialize types. Define all object type structures. * python/python-internal.h: Don't declare event initialization functions. * python/py-threadevent.c (thread_event_object_type): Don't define. * python/py-stopevent.c (stop_event_object_type): Don't define. * python/py-signalevent.c (signal_event_object_type): Don't declare or define. * python/py-newobjfileevent.c (new_objfile_event_object_type) (clear_objfiles_event_object_type): Don't declare or define. * python/py-infevents.c (inferior_call_pre_event_object_type) (inferior_call_post_event_object_type) (register_changed_event_object_type) (memory_changed_event_object_type): Don't declare or define. * python/py-inferior.c (new_thread_event_object_type) (new_inferior_event_object_type) (inferior_deleted_event_object_type): Don't declare or define. * python/py-exitedevent.c (exited_event_object_type): Don't declare or define. * python/py-evts.c (gdbpy_initialize_py_events): Use py-all-events.def. * python/py-events.h (thread_event_object_type): Don't declare. (events_object): Use py-all-events.def. * python/py-event.h (GDBPY_NEW_EVENT_TYPE): Remove. Use py-event-types.def. * python/py-event-types.def: New file. * python/py-continueevent.c (create_continue_event_object): Don't declare or define. * python/py-bpevent.c (breakpoint_event_object_type): Don't declare or define. * python/py-all-events.def: New file.
2017-09-11Small event ownership clean up in Python layerTom Tromey1-3/+3
It seems cleaner to me for functions like create_thread_event_object, which pass object ownership to their callers, to directly return a gdb_ref<>. This way the ownership transfer is part of the API. This patch makes this change. ChangeLog 2017-09-11 Tom Tromey <tom@tromey.com> * python/py-threadevent.c (create_thread_event_object): Return gdbpy_ref. * python/py-stopevent.h (create_stop_event_object) (create_breakpoint_event_object, create_signal_event_object): Update. * python/py-stopevent.c (create_stop_event_object): Return gdbpy_ref. (emit_stop_event): Update. * python/py-signalevent.c (create_signal_event_object): Return gdbpy_ref. * python/py-infevents.c (create_inferior_call_event_object): Update. * python/py-event.h (create_event_object) (create_thread_event_object): Update. * python/py-event.c (create_event_object): Return gdbpy_ref. * python/py-continueevent.c: Return gdbpy_ref. * python/py-bpevent.c (create_breakpoint_event_object): Return gdbpy_ref.
2017-09-11Add new_inferior, inferior_deleted, and new_thread eventsTom Tromey1-1/+2
This adds a few new events to gdb's Python layer: new_inferior, inferior_deleted, and new_thread. I wanted to be able to add a combined inferior/thread display window to my GUI, and I needed a few events to make this work. This is PR python/15622. ChangeLog 2017-09-11 Tom Tromey <tom@tromey.com> PR python/15622: * NEWS: Add entry. * python/python.c (do_start_initialization): Initialize new event types. * python/python-internal.h (gdbpy_initialize_new_inferior_event) (gdbpy_initialize_inferior_deleted_event) (gdbpy_initialize_new_thread_event): Declare. * python/py-threadevent.c (create_thread_event_object): Add option "thread" parameter. * python/py-inferior.c (new_thread_event_object_type) (new_inferior_event_object_type) (inferior_deleted_event_object_type): Declare. (python_new_inferior, python_inferior_deleted): New functions. (add_thread_object): Emit new_thread event. (gdbpy_initialize_inferior): Attach new functions to corresponding observers. (new_thread, new_inferior, inferior_deleted): Define new event types. * python/py-evts.c (gdbpy_initialize_py_events): Add new registries. * python/py-events.h (events_object) <new_inferior, inferior_deleted, new_thread>: New fields. * python/py-event.h (create_thread_event_breakpoint): Add optional "thread" parameter. doc/ChangeLog 2017-09-11 Tom Tromey <tom@tromey.com> * python.texi (Events In Python): Document new events. testsuite/ChangeLog 2017-09-11 Tom Tromey <tom@tromey.com> * gdb.python/py-infthread.exp: Add tests for new_thread event. * gdb.python/py-inferior.exp: Add tests for new inferior events.
2017-04-05-Wwrite-strings: The RestPedro Alves1-2/+2
This is the remainder boring constification that all looks more of less borderline obvious IMO. gdb/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * ada-exp.y (yyerror): Constify. * ada-lang.c (bound_name, get_selections) (ada_variant_discrim_type) (ada_variant_discrim_name, ada_value_struct_elt) (ada_lookup_struct_elt_type, is_unchecked_variant) (ada_which_variant_applies, standard_exc, ada_get_next_arg) (catch_ada_exception_command_split) (catch_ada_assert_command_split, catch_assert_command) (ada_op_name): Constify. * ada-lang.h (ada_yyerror, get_selections) (ada_variant_discrim_name, ada_value_struct_elt): Constify. * arc-tdep.c (arc_print_frame_cache): Constify. * arm-tdep.c (arm_skip_stub): Constify. * ax-gdb.c (gen_binop, gen_struct_ref_recursive, gen_struct_ref) (gen_aggregate_elt_ref): Constify. * bcache.c (print_bcache_statistics): Constify. * bcache.h (print_bcache_statistics): Constify. * break-catch-throw.c (catch_exception_command_1): * breakpoint.c (struct ep_type_description::description): Constify. (add_solib_catchpoint): Constify. (catch_fork_command_1): Add cast. (add_catch_command): Constify. * breakpoint.h (add_catch_command, add_solib_catchpoint): Constify. * bsd-uthread.c (bsd_uthread_state): Constify. * buildsym.c (patch_subfile_names): Constify. * buildsym.h (next_symbol_text_func, patch_subfile_names): Constify. * c-exp.y (yyerror): Constify. (token::oper): Constify. * c-lang.h (c_yyerror, cp_print_class_member): Constify. * c-varobj.c (cplus_describe_child): Constify. * charset.c (find_charset_names): Add cast. (find_charset_names): Constify array and add const_cast. * cli/cli-cmds.c (complete_command, cd_command): Constify. (edit_command): Constify. * cli/cli-decode.c (lookup_cmd): Constify. * cli/cli-dump.c (dump_memory_command, dump_value_command): Constify. (struct dump_context): Constify. (add_dump_command, restore_command): Constify. * cli/cli-script.c (get_command_line): Constify. * cli/cli-script.h (get_command_line): Constify. * cli/cli-utils.c (check_for_argument): Constify. * cli/cli-utils.h (check_for_argument): Constify. * coff-pe-read.c (struct read_pe_section_data): Constify. * command.h (lookup_cmd): Constify. * common/print-utils.c (decimal2str): Constify. * completer.c (gdb_print_filename): Constify. * corefile.c (set_gnutarget): Constify. * cp-name-parser.y (yyerror): Constify. * cp-valprint.c (cp_print_class_member): Constify. * cris-tdep.c (cris_register_name, crisv32_register_name): Constify. * d-exp.y (yyerror): Constify. (struct token::oper): Constify. * d-lang.h (d_yyerror): Constify. * dbxread.c (struct header_file_location::name): Constify. (add_old_header_file, add_new_header_file, last_function_name) (dbx_next_symbol_text, add_bincl_to_list) (find_corresponding_bincl_psymtab, set_namestring) (find_stab_function_addr, read_dbx_symtab, start_psymtab) (dbx_end_psymtab, read_ofile_symtab, process_one_symbol): * defs.h (command_line_input, print_address_symbolic) (deprecated_readline_begin_hook): Constify. * dwarf2read.c (anonymous_struct_prefix, dwarf_bool_name): Constify. * event-top.c (handle_line_of_input): Constify and add cast. * exceptions.c (catch_errors): Constify. * exceptions.h (catch_errors): Constify. * expprint.c (print_subexp_standard, op_string, op_name) (op_name_standard, dump_raw_expression, dump_raw_expression): * expression.h (op_name, op_string, dump_raw_expression): Constify. * f-exp.y (yyerror): Constify. (struct token::oper): Constify. (struct f77_boolean_val::name): Constify. * f-lang.c (f_word_break_characters): Constify. * f-lang.h (f_yyerror): Constify. * fork-child.c (fork_inferior): Add cast. * frv-tdep.c (struct gdbarch_tdep::register_names): Constify. (new_variant): Constify. * gdbarch.sh (pstring_ptr, pstring_list): Constify. * gdbarch.c: Regenerate. * gdbcore.h (set_gnutarget): Constify. * go-exp.y (yyerror): Constify. (token::oper): Constify. * go-lang.h (go_yyerror): Constify. * go32-nat.c (go32_sysinfo): Constify. * guile/scm-breakpoint.c (gdbscm_breakpoint_expression): Constify. * guile/scm-cmd.c (cmdscm_function): Constify. * guile/scm-param.c (pascm_param_value): Constify. * h8300-tdep.c (h8300_register_name, h8300s_register_name) (h8300sx_register_name): Constify. * hppa-tdep.c (hppa32_register_name, hppa64_register_name): Constify. * ia64-tdep.c (ia64_register_names): Constify. * infcmd.c (construct_inferior_arguments): Constify. (path_command, attach_post_wait): Constify. * language.c (show_range_command, show_case_command) (unk_lang_error): Constify. * language.h (language_defn::la_error) (language_defn::la_name_of_this): Constify. * linespec.c (decode_line_2): Constify. * linux-thread-db.c (thread_db_err_str): Constify. * lm32-tdep.c (lm32_register_name): Constify. * m2-exp.y (yyerror): Constify. * m2-lang.h (m2_yyerror): Constify. * m32r-tdep.c (m32r_register_names): Constify and make static. * m68hc11-tdep.c (m68hc11_register_names): Constify. * m88k-tdep.c (m88k_register_name): Constify. * macroexp.c (appendmem): Constify. * mdebugread.c (fdr_name, add_data_symbol, parse_type) (upgrade_type, parse_external, parse_partial_symbols) (mdebug_next_symbol_text, cross_ref, mylookup_symbol, new_psymtab) (new_symbol): Constify. * memattr.c (mem_info_command): Constify. * mep-tdep.c (register_name_from_keyword): Constify. * mi/mi-cmd-env.c (mi_cmd_env_path, _initialize_mi_cmd_env): Constify. * mi/mi-cmd-stack.c (list_args_or_locals): Constify. * mi/mi-cmd-var.c (mi_cmd_var_show_attributes): Constify. * mi/mi-main.c (captured_mi_execute_command): Constify and add cast. (mi_execute_async_cli_command): Constify. * mips-tdep.c (mips_register_name): Constify. * mn10300-tdep.c (register_name, mn10300_generic_register_name) (am33_register_name, am33_2_register_name) * moxie-tdep.c (moxie_register_names): Constify. * nat/linux-osdata.c (osdata_type): Constify fields. * nto-tdep.c (nto_parse_redirection): Constify. * objc-lang.c (lookup_struct_typedef, lookup_objc_class) (lookup_child_selector): Constify. (objc_methcall::name): Constify. * objc-lang.h (lookup_objc_class, lookup_child_selector) (lookup_struct_typedef): Constify. * objfiles.c (pc_in_section): Constify. * objfiles.h (pc_in_section): Constify. * p-exp.y (struct token::oper): Constify. (yyerror): Constify. * p-lang.h (pascal_yyerror): Constify. * parser-defs.h (op_name_standard): Constify. (op_print::string): Constify. (exp_descriptor::op_name): Constify. * printcmd.c (print_address_symbolic): Constify. * psymtab.c (print_partial_symbols): Constify. * python/py-breakpoint.c (stop_func): Constify. (bppy_get_expression): Constify. * python/py-cmd.c (cmdpy_completer::name): Constify. (cmdpy_function): Constify. * python/py-event.c (evpy_add_attribute) (gdbpy_initialize_event_generic): Constify. * python/py-event.h (evpy_add_attribute) (gdbpy_initialize_event_generic): Constify. * python/py-evts.c (add_new_registry): Constify. * python/py-finishbreakpoint.c (outofscope_func): Constify. * python/py-framefilter.c (get_py_iter_from_func): Constify. * python/py-inferior.c (get_buffer): Add cast. * python/py-param.c (parm_constant::name): Constify. * python/py-unwind.c (fprint_frame_id): Constify. * python/python.c (gdbpy_parameter_value): Constify. * remote-fileio.c (remote_fio_func_map): Make 'name' const. * remote.c (memory_packet_config::name): Constify. (show_packet_config_cmd, remote_write_bytes) (remote_buffer_add_string): * reverse.c (exec_reverse_once): Constify. * rs6000-tdep.c (variant::name, variant::description): Constify. * rust-exp.y (rustyyerror): Constify. * rust-lang.c (rust_op_name): Constify. * rust-lang.h (rustyyerror): Constify. * serial.h (serial_ops::name): Constify. * sh-tdep.c (sh_sh_register_name, sh_sh3_register_name) (sh_sh3e_register_name, sh_sh2e_register_name) (sh_sh2a_register_name, sh_sh2a_nofpu_register_name) (sh_sh_dsp_register_name, sh_sh3_dsp_register_name) (sh_sh4_register_name, sh_sh4_nofpu_register_name) (sh_sh4al_dsp_register_name): Constify. * sh64-tdep.c (sh64_register_name): Constify. * solib-darwin.c (lookup_symbol_from_bfd): Constify. * spu-tdep.c (spu_register_name, info_spu_dma_cmdlist): Constify. * stabsread.c (patch_block_stabs, read_type_number) (ref_map::stabs, ref_add, process_reference) (symbol_reference_defined, define_symbol, define_symbol) (error_type, read_type, read_member_functions, read_cpp_abbrev) (read_one_struct_field, read_struct_fields, read_baseclasses) (read_tilde_fields, read_struct_type, read_array_type) (read_enum_type, read_sun_builtin_type, read_sun_floating_type) (read_huge_number, read_range_type, read_args, common_block_start) (find_name_end): Constify. * stabsread.h (common_block_start, define_symbol) (process_one_symbol, symbol_reference_defined, ref_add): * symfile.c (get_section_index, add_symbol_file_command): * symfile.h (get_section_index): Constify. * target-descriptions.c (tdesc_type::name): Constify. (tdesc_free_type): Add cast. * target.c (find_default_run_target): (add_deprecated_target_alias, find_default_run_target) (target_announce_detach): Constify. (do_option): Constify. * target.h (add_deprecated_target_alias): Constify. * thread.c (print_thread_info_1): Constify. * top.c (deprecated_readline_begin_hook, command_line_input): Constify. (init_main): Add casts. * top.h (handle_line_of_input): Constify. * tracefile-tfile.c (tfile_write_uploaded_tsv): Constify. * tracepoint.c (tvariables_info_1, trace_status_mi): Constify. (tfind_command): Rename to ... (tfind_command_1): ... this and constify. (tfind_command): New function. (tfind_end_command, tfind_start_command): Adjust. (encode_source_string): Constify. * tracepoint.h (encode_source_string): Constify. * tui/tui-data.c (tui_partial_win_by_name): Constify. * tui/tui-data.h (tui_partial_win_by_name): Constify. * tui/tui-source.c (tui_set_source_content_nil): Constify. * tui/tui-source.h (tui_set_source_content_nil): Constify. * tui/tui-win.c (parse_scrolling_args): Constify. * tui/tui-windata.c (tui_erase_data_content): Constify. * tui/tui-windata.h (tui_erase_data_content): Constify. * tui/tui-winsource.c (tui_erase_source_content): Constify. * tui/tui.c (tui_enable): Add cast. * utils.c (defaulted_query): Constify. (init_page_info): Add cast. (puts_debug, subset_compare): Constify. * utils.h (subset_compare): Constify. * varobj.c (varobj_format_string): Constify. * varobj.h (varobj_format_string): Constify. * vax-tdep.c (vax_register_name): Constify. * windows-nat.c (windows_detach): Constify. * xcoffread.c (process_linenos, xcoff_next_symbol_text): Constify. * xml-support.c (gdb_xml_end_element): Constify. * xml-tdesc.c (tdesc_start_reg): Constify. * xstormy16-tdep.c (xstormy16_register_name): Constify. * xtensa-tdep.c (xtensa_find_register_by_name): Constify. * xtensa-tdep.h (xtensa_register_t::name): Constify. gdb/gdbserver/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * gdbreplay.c (sync_error): Constify. * linux-x86-low.c (push_opcode): Constify.
2017-01-10Change event code to use gdbpy_refTom Tromey1-2/+2
This changes the event code in the Python layer to use gdbpy_ref, simplifying the logic in many places. It also changes evpy_emit_event not to steal a reference to its argument. This is simpler to do now that gdbpy_ref is in use; it's also a reasonable cleanup in its own right. While doing this I realized that evpy_emit_event should not be calling gdbpy_print_stack (all the outermost callers do this if needed), so I removed this as well. 2017-01-10 Tom Tromey <tom@tromey.com> * python/py-threadevent.c (create_thread_event_object): Use gdbpy_ref. * python/py-stopevent.c (create_stop_event_object): Simplify. (emit_stop_event): Use gdbpy_ref. * python/py-signalevent.c (create_signal_event_object): Use gdbpy_ref. * python/py-newobjfileevent.c (create_new_objfile_event_object) (emit_new_objfile_event, create_clear_objfiles_event_object) (emit_clear_objfiles_event): Use gdbpy_ref. * python/py-infevents.c (create_inferior_call_event_object) (create_register_changed_event_object) (create_memory_changed_event_object, emit_inferior_call_event) (emit_memory_changed_event, emit_register_changed_event): Use gdbpy_ref. * python/py-exitedevent.c (create_exited_event_object) (emit_exited_event): Use gdbpy_ref. * python/py-event.h (evpy_emit_event): Remove CPYCHECKER_STEALS_REFERENCE_TO_ARG annotation. * python/py-event.c (evpy_emit_event): Use gdbpy_ref. * python/py-continueevent.c (emit_continue_event): Use gdbpy_ref. * python/py-breakpoint.c (gdbpy_breakpoint_created) (gdbpy_breakpoint_deleted, gdbpy_breakpoint_modified): Use gdbpy_ref. * python/py-bpevent.c (create_breakpoint_event_object): Use gdbpy_ref.
2017-01-01update copyright year range in GDB filesJoel Brobecker1-1/+1
This applies the second part of GDB's End of Year Procedure, which updates the copyright year range in all of GDB's files. gdb/ChangeLog: Update copyright year range in all GDB files.
2016-01-01GDB copyright headers update after running GDB's copyright.py script.Joel Brobecker1-1/+1
gdb/ChangeLog: Update year range in copyright notice of all files.
2015-02-11Fix redefinition errors in C++ modeTom Tromey1-3/+2
In C, we can forward declare static structure instances. That doesn't work in C++ though. C++ treats these as definitions. So then the compiler complains about symbol redefinition, like: src/gdb/elfread.c:1569:29: error: redefinition of ‘const sym_fns elf_sym_fns_lazy_psyms’ src/gdb/elfread.c:53:29: error: ‘const sym_fns elf_sym_fns_lazy_psyms’ previously declared here The intent of static here is naturally to avoid making these objects visible outside the compilation unit. The equivalent in C++ would be to instead define the objects in the anonymous namespace. But given that it's desirable to leave the codebase compiling as both C and C++ for a while, this just makes the objects extern. (base_breakpoint_ops is already declared in breakpoint.h, so we can just remove the forward declare from breakpoint.c) gdb/ChangeLog: 2015-02-11 Tom Tromey <tromey@redhat.com> Pedro Alves <palves@redhat.com> * breakpoint.c (base_breakpoint_ops): Delete. * dwarf2loc.c (dwarf_expr_ctx_funcs): Make extern. * elfread.c (elf_sym_fns_gdb_index, elf_sym_fns_lazy_psyms): Make extern. * guile/guile.c (guile_extension_script_ops, guile_extension_ops): Make extern. * ppcnbsd-tdep.c (ppcnbsd2_sigtramp): Make extern. * python/py-arch.c (arch_object_type): Make extern. * python/py-block.c (block_syms_iterator_object_type): Make extern. * python/py-bpevent.c (breakpoint_event_object_type): Make extern. * python/py-cmd.c (cmdpy_object_type): Make extern. * python/py-continueevent.c (continue_event_object_type) * python/py-event.h (GDBPY_NEW_EVENT_TYPE): Remove 'qual' parameter. Update all callers. * python/py-evtregistry.c (eventregistry_object_type): Make extern. * python/py-exitedevent.c (exited_event_object_type): Make extern. * python/py-finishbreakpoint.c (finish_breakpoint_object_type): Make extern. * python/py-function.c (fnpy_object_type): Make extern. * python/py-inferior.c (inferior_object_type, membuf_object_type): Make extern. * python/py-infevents.c (call_pre_event_object_type) (inferior_call_post_event_object_type). (memory_changed_event_object_type): Make extern. * python/py-infthread.c (thread_object_type): Make extern. * python/py-lazy-string.c (lazy_string_object_type): Make extern. * python/py-linetable.c (linetable_entry_object_type) (linetable_object_type, ltpy_iterator_object_type): Make extern. * python/py-newobjfileevent.c (new_objfile_event_object_type) (clear_objfiles_event_object_type): Make extern. * python/py-objfile.c (objfile_object_type): Make extern. * python/py-param.c (parmpy_object_type): Make extern. * python/py-progspace.c (pspace_object_type): Make extern. * python/py-signalevent.c (signal_event_object_type): Make extern. * python/py-symtab.c (symtab_object_type, sal_object_type): Make extern. * python/py-type.c (type_object_type, field_object_type) (type_iterator_object_type): Make extern. * python/python.c (python_extension_script_ops) (python_extension_ops): Make extern. * stap-probe.c (stap_probe_ops): Make extern.
2015-01-01Update year range in copyright notice of all files owned by the GDB project.Joel Brobecker1-1/+1
gdb/ChangeLog: Update year range in copyright notice of all files.
2014-12-02New python events: inferior call, register/memory changed.Nick Bull1-0/+16
gdb/ChangeLog: * NEWS: Mention new Python events. * Makefile.in (SUBDIR_PYTHON_OBS): Add py-infevents.o. (SUBDIR_PYTHON_SRCS): Add py-infevents.c. (py-infevents.o): New rule. * doc/observer.texi (inferior_call_pre, inferior_call_post) (memory_changed, register_changed): New observers. * infcall.c (call_function_by_hand): Notify observer before and after inferior call. * python/py-event.h (inferior_call_kind): New enum. (emit_inferior_call_event): New prototype. (emit_register_changed_event): New prototype. (emit_memory_changed_event): New prototype. * python/py-events.h (events_object): New registries inferior_call, memory_changed and register_changed. * python/py-evts.c (gdbpy_initialize_py_events): Add the inferior_call, memory_changed and register_changed registries. * python/py-infevents.c: New. * python/py-inferior.c (python_on_inferior_call_pre) (python_on_inferior_call_post, python_on_register_change) (python_on_memory_change): New functions. (gdbpy_initialize_inferior): Attach python handler to new observers. * python/py-infthread.c(gdbpy_create_ptid_object): New. (thpy_get_ptid) Use gdbpy_create_ptid_object. * python/python-internal.h: (gdbpy_create_ptid_object) (gdbpy_initialize_inferior_call_pre_event) (gdbpy_initialize_inferior_call_post_event) (gdbpy_initialize_register_changed_event) (gdbpy_initialize_memory_changed_event): New prototypes. * python/python.c (_initialize_python): Initialize new events. * valops.c (value_assign): Notify register_changed observer. gdb/doc/ChangeLog: * python.texi (Events In Python): Document new events InferiorCallPreEvent, InferiorCallPostEvent, MemoryChangedEvent and RegisterChangedEvent. gdb/testsuite/ChangeLog: * gdb.python/py-events.py (inferior_call_handler): New. (register_changed_handler, memory_changed_handler): New. (test_events.invoke): Register new handlers. * gdb.python/py-events.exp: Add tests for inferior call, memory_changed and register_changed events.
2014-12-02revert previous patch so that I can re-commit with correct authorDoug Evans1-16/+0
2014-12-02New python events: infcall, register/memory changed.Doug Evans1-0/+16
gdb/ChangeLog: * NEWS: Mention new Python events. * Makefile.in (SUBDIR_PYTHON_OBS): Add py-infevents.o. (SUBDIR_PYTHON_SRCS): Add py-infevents.c. (py-infevents.o): New rule. * doc/observer.texi (inferior_call_pre, inferior_call_post) (memory_changed, register_changed): New observers. * infcall.c (call_function_by_hand): Notify observer before and after inferior call. * python/py-event.h (inferior_call_kind): New enum. (emit_inferior_call_event): New prototype. (emit_register_changed_event): New prototype. (emit_memory_changed_event): New prototype. * python/py-events.h (events_object): New registries inferior_call, memory_changed and register_changed. * python/py-evts.c (gdbpy_initialize_py_events): Add the inferior_call, memory_changed and register_changed registries. * python/py-infevents.c: New. * python/py-inferior.c (python_on_inferior_call_pre) (python_on_inferior_call_post, python_on_register_change) (python_on_memory_change): New functions. (gdbpy_initialize_inferior): Attach python handler to new observers. * python/py-infthread.c(gdbpy_create_ptid_object): New. (thpy_get_ptid) Use gdbpy_create_ptid_object. * python/python-internal.h: (gdbpy_create_ptid_object) (gdbpy_initialize_inferior_call_pre_event) (gdbpy_initialize_inferior_call_post_event) (gdbpy_initialize_register_changed_event) (gdbpy_initialize_memory_changed_event): New prototypes. * python/python.c (_initialize_python): Initialize new events. * valops.c (value_assign): Notify register_changed observer. gdb/doc/ChangeLog: * python.texi (Events In Python): Document new events InferiorCallPreEvent, InferiorCallPostEvent, MemoryChangedEvent and RegisterChangedEvent. gdb/testsuite/ChangeLog: * gdb.python/py-events.py (inferior_call_handler): New. (register_changed_handler, memory_changed_handler): New. (test_events.invoke): Register new handlers. * gdb.python/py-events.exp: Add tests for inferior call, memory_changed and register_changed events.
2014-10-17New python event "clear_objfiles".Doug Evans1-0/+1
If one is watching new_objfile events in python, it helps to know when the list of objfiles is cleared. This patch adds a new clear_objfiles event to support this. This patch is all just cut-n-paste-n-tweak derived from the new_objfiles event. gdb/ChangeLog: * NEWS: Mention new event gdb.clear_objfiles. * python/py-event.h (emit_clear_objfiles_event): Clear * python/py-events.h (events_object): New member clear_objfiles. * python/py-evts.c (gdbpy_initialize_py_events): Add clear_objfiles event. * python/py-inferior.c (python_new_objfile): If objfile is NULL, emit clear_objfiles event. * python/py-newobjfileevent.c (create_clear_objfiles_event_object): New function. (emit_clear_objfiles_event): New function. (clear_objfiles): New event. * python/python-internal.h (gdbpy_initialize_clear_objfiles_event): Declare. * python/python.c (_initialize_python): Call gdbpy_initialize_clear_objfiles_event. gdb/doc/ChangeLog: * python.texi (Events In Python): Document clear_objfiles event. gdb/testsuite/ChangeLog: * gdb.python/py-events.exp: Update expected output for clear_objfiles event. * gdb.python/py-events.py: Add clear_objfiles event.
2014-01-01Update Copyright year range in all files maintained by GDB.Joel Brobecker1-1/+1
2013-05-20 * python/py-arch.c (gdbpy_initialize_arch): Return 'int'.Tom Tromey1-3/+3
Check errors. * python/py-auto-load.c (gdbpy_initialize_auto_load): Return 'int'. * python/py-block.c (gdbpy_initialize_blocks): Return 'int'. Check errors. * python/py-breakpoint.c (gdbpy_initialize_breakpoints): Return 'int'. Check errors. * python/py-cmd.c (gdbpy_initialize_commands): Return 'int'. Check errors. * python/py-event.c (gdbpy_initialize_event): Return 'int'. Check errors. * python/py-event.h (GDBPY_NEW_EVENT_TYPE): Change generated init function to return 'int'. * python/py-evtregistry.c (gdbpy_initialize_eventregistry): Return 'int'. Check errors. * python/py-evts.c (gdbpy_initialize_py_events): Return 'int'. Check errors. * python/py-finishbreakpoint.c (gdbpy_initialize_finishbreakpoints): Return 'int'. Check errors. * python/py-frame.c (gdbpy_initialize_frames): Return 'int'. Check errors. * python/py-function.c (gdbpy_initialize_functions): Return 'int'. Check errors. * python/py-gdb-readline.c (gdbpy_initialize_gdb_readline): Check errors. * python/py-inferior.c (gdbpy_initialize_inferior): Return 'int'. Check errors. * python/py-infthread.c (gdbpy_initialize_thread): Return 'int'. Check errors. * python/py-lazy-string.c (gdbpy_initialize_lazy_string): Return 'int'. Check errors. * python/py-objfile.c (gdbpy_initialize_objfile): Return 'int'. Check errors. * python/py-param.c (gdbpy_initialize_parameters): Return 'int'. Check errors. * python/py-progspace.c (gdbpy_initialize_pspace): Return 'int'. Check errors. * python/py-symbol.c (gdbpy_initialize_symbols): Return 'int'. Check errors. * python/py-symtab.c (gdbpy_initialize_symtabs): Return 'int'. Check errors. * python/py-type.c (gdbpy_initialize_types): Return 'int'. Check errors. * python/py-value.c (gdbpy_initialize_values): Return 'int'. Check errors. * python/python-internal.h (gdbpy_initialize_auto_load, gdbpy_initialize_values, gdbpy_initialize_frames, gdbpy_initialize_symtabs, gdbpy_initialize_commands, gdbpy_initialize_symbols, gdbpy_initialize_symtabs, gdbpy_initialize_blocks, gdbpy_initialize_types, gdbpy_initialize_functions, gdbpy_initialize_pspace, gdbpy_initialize_objfile, gdbpy_initialize_breakpoints, gdbpy_initialize_finishbreakpoints, gdbpy_initialize_lazy_string, gdbpy_initialize_parameters, gdbpy_initialize_thread, gdbpy_initialize_inferior, gdbpy_initialize_eventregistry, gdbpy_initialize_event, gdbpy_initialize_py_events, gdbpy_initialize_stop_event, gdbpy_initialize_signal_event, gdbpy_initialize_breakpoint_event, gdbpy_initialize_continue_event, gdbpy_initialize_exited_event, gdbpy_initialize_thread_event, gdbpy_initialize_new_objfile_event, gdbpy_initialize_arch): Update. Use CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION. * python/python.c (gdb_python_initialized): New global. (gdbpy_initialize_events): Return 'int'. Check errors. (_initialize_python): Check errors. Set gdb_python_initialized.
2013-05-20 * python/py-event.h (gdbpy_initialize_event_generic): UseTom Tromey1-3/+4
CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION. * python/py-evts.c (add_new_registry): Use CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION. * python/python-internal.h (CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION): New macro.
2013-05-20 * python/py-event.h (evpy_emit_event): UseTom Tromey1-1/+2
CPYCHECKER_STEALS_REFERENCE_TO_ARG. * python/python-internal.h (CPYCHECKER_STEALS_REFERENCE_TO_ARG): New macro.
2013-05-20 * python/py-arch.c (arch_object_type): UseTom Tromey1-2/+3
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF. * python/py-block.c (block_syms_iterator_object_type): Use CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF. * python/py-bpevent.c (breakpoint_event_object_type): Use CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF. * python/py-cmd.c (cmdpy_object_type): Use CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF. * python/py-continueevent.c (continue_event_object_type): Use CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF. * python/py-event.h (GDBPY_NEW_EVENT_TYPE): Use CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF. * python/py-events.h (thread_event_object_type): Use CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF. * python/py-evtregistry.c (eventregistry_object_type): Use CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF. * python/py-exitedevent.c (exited_event_object_type): Use CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF. * python/py-finishbreakpoint.c (finish_breakpoint_object_type): Use CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF. * python/py-function.c (fnpy_object_type): Use CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF. * python/py-inferior.c (inferior_object_type, membuf_object_type): Use CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF. * python/py-infthread.c (thread_object_type): Use CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF. * python/py-lazy-string.c (lazy_string_object_type): Use CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF. * python/py-newobjfileevent.c (new_objfile_event_object_type): Use CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF. * python/py-objfile.c (objfile_object_type): Use CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF. * python/py-param.c (parmpy_object_type): Use CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF. * python/py-progspace.c (pspace_object_type): Use CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF. * python/py-signalevent.c (signal_event_object_type): Use CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF. * python/py-symtab.c (symtab_object_type, sal_object_type): Use CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF. * python/py-type.c (type_object_type, field_object_type) (type_iterator_object_type): Use CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF. * python/py-internal.h (CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF): New define. (value_object_type, block_object_type, symbol_object_type) (event_object_type, stop_event_object_type, breakpoint_object_type) (frame_object_type): Use CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF.
2013-01-01Update years in copyright notice for the GDB files.Joel Brobecker1-1/+1
Two modifications: 1. The addition of 2013 to the copyright year range for every file; 2. The use of a single year range, instead of potentially multiple year ranges, as approved by the FSF.
2012-12-12Add support for Python 3.Paul Koning1-2/+1
* NEWS: Mention Python 3 support. * varobj.c (value_get_print_value): Use python_string_to_target_string. * python/py-block.c: Use PyVarObject_HEAD_INIT in initialization of type objects. * python/py-breakpoint.c: Ditto. * python/py-cmd.c: Ditto. * python/py-event.c: Ditto. * python/py-event.h: Ditto. * python/py-evtregistry.c: Ditto. * python/py-finishbreakpoint.c: Ditto. * python/py-frame.c: Ditto. * python/py-function.c: Ditto. * python/py-infthread.c: Ditto. * python/py-lazy-string.c: Ditto. * python/py-progspace.c: Ditto. * /python/py-symbol.c: Ditto. * python/py-evts.c: (gdbpy_initialize_py_events): Add module initialization for Python 3. * python/py-inferior.c: Use PyVarObject_HEAD_INIT in initialization of type objects. (infpy_read_memory): Return memoryview object if Python 3. (infpy_write_memory): Use "s*" operand parsing code for Python 3. (infpy_search_memory): Ditto. (get_buffer): New function for Python 3. * python/py-objfile.c: Use PyVarObject_HEAD_INIT in initialization of type objects. (objfpy_dealloc): Use Py_TYPE to call tp_free. * python/py-param.c: Use PyVarObject_HEAD_INIT in initialization of type objects. (get_attr): Use PyUnicode_CompareWithASCIIString if Python 3. (set_attr): Ditto. * python/py-prettyprint.c (print_string_repr): use PyBytes methods instead of PyString methods if Python 3. (print_children): Skip push_dummy_python_frame call if Python 3. * python/py-symtab.c: Use PyVarObject_HEAD_INIT in initialization of type objects. (salpy_dealloc): Use Py_TYPE to call tp_free. * python/py-type.c: Use PyVarObject_HEAD_INIT in initialization of type objects. (field_dealloc): Use Py_TYPE to call tp_free. (typy_dealloc): Ditto. (type_object_as_number): Adjust struct initializations for differences in layout for Python 2 vs. Python 3. * python/py-utils.c (python_string_to_unicode): Omit non-Unicode string case for Python 3. (unicode_to_encoded_python_string): Shorten code (no functional change). (python_string_to_target_python_string): Comment that in Python 3 returned value is a Python "bytes" type. (gdbpy_is_string): Omit non-Unicode string check in Python 3. (gdb_py_object_from_longest): Omit non-long integer case in Python 3. (gdb_py_object_from_ulongest): Ditto. * python/py-value.c: Use PyVarObject_HEAD_INIT in initialization of type objects. (valpy_dealloc): Use Py_TYPE to call tp_free. (valpy_int): Omit function if Python 3. (convert_value_from_python): Use "%S" format (Python object as a string) if Python 3. (value_object_as_number): Adjust struct initializations for differences in layout for Python 2 vs. Python 3. * python/python-config.py: Adjust syntax for Python 3 compatibility. Include "sys.abiflags" string as part of python library name, if that attribute exists (Python 3). * python/python-internal.h (IS_PY3): Define if Python 3. (Py_TPFLAGS_HAVE_ITER, Py_TPFLAGS_CHECKTYPES): Define with placeholder value if Python 3. (PyInt_Check, PyInt_FromLong, PyInt_AsLong, PyString_FromString, PyString_Decode, PyString_FromFormat, PyString_Check): Define as analogous Python 3 API function if Python 3. (PyVarObject_HEAD_INIT): Define if not already defined. (Py_TYPE): Ditto. * python/python.c (eval_python_command): Omit Py_FlushLine call if Python 3. Check return values of all Python API calls for error. Supply dummy "python" and "python-interactive" commands if Python initialization failed. (_initialize_python): Convert argc to wchar_t** if Python 3. Add module initialization for Python 3. (finish_python_initialization): Pass wchar_t * argument to PySys_SetPath if Python 3. * python/lib/gdb/__init__.py: Define "reload" if Python 3. (_GdbFile): New class for common output file behavior. (GdbOutFile): Subclass from _GdbFile. (GdbOutputErrorFile): Ditto. (auto_load_packages): Adjust syntax for Python 3 compatibility. * python/lib/gdb/printing.py: Define basestr and int if Python 3. * python/lib/gdb/prompt.py: Use sorted() function rather than sort() method. * python/lib/gdb/command/explore.py: Define raw_input if Python 3. Adjust syntax for Python 3 compatibility. * python/lib/gdb/command/pretty_printers.py: Use sorted() function rather than sort() method. Adjust syntax for Python 3 compatibility. * python/lib/gdb/command/type_printers.py: Ditto. * doc/gdb.texinfo (Inferior.read_memory): Mention that the return value is a memoryview object if Python 3.
2012-11-08 * python/py-bpevent.c: Include defs.h.Tom Tromey1-1/+0
* python/py-continueevent.c: Include defs.h. * python/py-event.c: Include defs.h. * python/py-event.h: Don't include defs.h. * python/py-events.h: Don't include defs.h. * python/py-evts.c: Include defs.h. * python/py-exitedevent.c: Include defs.h. * python/py-newobjfileevent.c: Include defs.h. * python/py-signalevent.c: Include defs.h. * python/py-stopevent.c: Include defs.h. * python/py-threadevent.c: Include defs.h.
2012-01-04Copyright year update in most files of the GDB Project.Joel Brobecker1-1/+1
gdb/ChangeLog: Copyright year update in most files of the GDB Project.
2011-10-07 Allow Python notification of new object-file loadings.Kevin Pouget1-0/+1
* Makefile.in (SUBDIR_PYTHON_SRCS): Add py-newobjfilevent.c. (SUBDIR_PYTHON_OBS): Add py-newobjfileevent.o. Add build rule for this file. * python/py-event.h (emit_new_objfile_event): New prototype. (newobjfile): New Python event emitter. * python/py-evts.c (gdbpy_initialize_py_events): Add new_objfile to Python event registry. * python/py-inferior.c: Include objfiles.h (python_new_objfile): New function. (gdbpy_initialize_inferior): Add python_new_objfile to the new objfile observers. * python/py-newobjfileevent.c: New file. * python-internal.h (gdbpy_initialize_new_objfile_event): New prototype. * python/python.c (_initialize_python): Add gdbpy_initialize_new_objfile_event call. * NEWS: Add item for new Python event "gdb.newobjfile" 2011-10-06 Kevin Pouget <kevin.pouget@st.com> Allow Python notification of new object-file loadings. * gdb.texinfo (Events In Python): Document `gdb.NewObjFileEvent' event type. 2011-10-06 Kevin Pouget <kevin.pouget@st.com> Allow Python notification of new object-file loadings. * gdb.python/py-events.exp: Test newobjfile event. * gdb.python/py-events.py: Register newobjfile callback. * gdb.python/py-events.c: Add call to shared library * gdb.python/py-events-shlib.c: New file.
2011-10-042011-10-04 Kevin Pouget <kevin.pouget@st.com>Kevin Pouget1-1/+1
PR python/12691: Add the inferior to Python exited event * python/py-exitedevent.c (create_exited_event_object): Add inferior to exited_event. * python/py-event.h (emit_exited_event): Likewise * python/-inferior.c (python_inferior_exit): Likewise 2011-10-04 Kevin Pouget <kevin.pouget@st.com> PR python/12691: Add the inferior to Python exited event * gdb.python/py-events.exp: Test the inferior attribute of exited event with a fork. * gdb.python/py-events.py: Print inferior number on exit. * gdb.python/py-events.c: Fork the inferior. 2011-10-04 Kevin Pouget <kevin.pouget@st.com> PR python/12691: Add the inferior to Python exited event * gdb.texinfo (Events In Python): Describe exited inferior attribute.
2011-06-03gdbTom Tromey1-1/+1
* python/py-inferior.c (python_inferior_exit): Use inferior's exit code fields. * python/py-exitedevent.c (create_exited_event_object): Change type of 'exit_code'. Optionally add exit_code attribute. (emit_exited_event): Change type of 'exit_code'. * python/py-event.h (emit_exited_event): Update. * mi/mi-interp.c (mi_inferior_exit): Print exit code. * infrun.c (handle_inferior_event): Set exit code fields on inferior. * inferior.h (struct inferior) <has_exit_code, exit_code>: New fields. * inferior.c (exit_inferior_1): Initialize new fields. gdb/doc * gdb.texinfo (GDB/MI Async Records): Document 'exit-code' field. (Events In Python): Note that exit_code is optional.
2011-02-05Add the file that prev commit forget.Hui Zhu1-0/+121