mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2026-08-27 00:26:02 -04:00
No description
The previous commit added a type trait which identifies types that should not be used within Python objects, that is, types that are not trivially default constructible. As a result of this, it was discovered that pending_frame_object includes a frame_info_ptr field. The problem with frame_info_ptr is that its constructor registers the new frame_info_ptr with the global frame_list. It is by this registration that invalidation of frame_info_ptr objects is performed. As Python is written in C, C++ constructors are not called, so when a pending_frame_object is created the constructor for the nested frame_info_ptr field is never run, and the frame_info_ptr is never registered with the global frame_list. As a result the frame_info_ptr will never be invalidated if the frame cache is flushed, this can then lead to problems where we make use of the 'frame_info *' within the frame_info_ptr, even though it is no longer valid. In this commit I change the frame_info_ptr within pending_frame_object to a 'frame_info_ptr *' and allocate the frame_info_ptr object on the heap, releasing the object, and resetting the point to NULL, when we are done with it. As the pending_frame_object only needs to remain valid for the duration of frame_unwind_python::sniff, the 'new' and 'delete' both performed within the function. We can now check that a pending_frame_object is valid by checking if the 'frame_info_ptr *' is NULL or not. As the frame_info_ptr is created in a valid state, and the point is set back to NULL when we are done with it, we no longer need to compare the frame_info_ptr object itself against NULL. The remaining changes in this patch are to dereference the 'frame_info_ptr *' in places where we need the actual object. In some cases I need to move the dereference later within a function, after a validity check, in order to avoid dereferencing a NULL pointer. Finally, I can add the static_assert that guarantees that pending_frame_object is now safe for allocation by Python. I discovered this bug while looking at PR gdb/32120. That bug is about a user's custom frame unwinder that triggers a flush of the frame cache during the sniffer phase (the RemoteTargetConnection.send_packet call switches thread, which triggers the frame cache flush). While looking at that bug I noticed that the frame_info_ptr within the pending_frame_object wasn't being reset when the frame cache was flushed. Fixing this does not resolve the user's issue, but I thought it was still worth tagging this commit with the bug link. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32120 Approved-By: Tom Tromey <tom@tromey.com> |
||
|---|---|---|
| bfd | ||
| binutils | ||
| config | ||
| contrib | ||
| cpu | ||
| elfcpp | ||
| etc | ||
| gas | ||
| gdb | ||
| gdbserver | ||
| gdbsupport | ||
| gnulib | ||
| gold | ||
| gprof | ||
| gprofng | ||
| include | ||
| ld | ||
| libbacktrace | ||
| libctf | ||
| libdecnumber | ||
| libiberty | ||
| libsframe | ||
| opcodes | ||
| readline | ||
| sim | ||
| texinfo | ||
| zlib | ||
| .clang-format | ||
| .cvsignore | ||
| .editorconfig | ||
| .gitattributes | ||
| .gitignore | ||
| .pre-commit-config.yaml | ||
| ar-lib | ||
| ChangeLog | ||
| compile | ||
| config-ml.in | ||
| config.guess | ||
| config.rpath | ||
| config.sub | ||
| configure | ||
| configure.ac | ||
| COPYING | ||
| COPYING.LIB | ||
| COPYING.LIBGLOSS | ||
| COPYING.NEWLIB | ||
| COPYING3 | ||
| COPYING3.LIB | ||
| depcomp | ||
| djunpack.bat | ||
| install-sh | ||
| libtool.m4 | ||
| ltgcc.m4 | ||
| ltmain.sh | ||
| ltoptions.m4 | ||
| ltsugar.m4 | ||
| ltversion.m4 | ||
| lt~obsolete.m4 | ||
| MAINTAINERS | ||
| Makefile.def | ||
| Makefile.in | ||
| Makefile.tpl | ||
| makefile.vms | ||
| missing | ||
| mkdep | ||
| mkinstalldirs | ||
| move-if-change | ||
| multilib.am | ||
| README | ||
| README-maintainer-mode | ||
| SECURITY.txt | ||
| setup.com | ||
| src-release.sh | ||
| symlink-tree | ||
| test-driver | ||
| ylwrap | ||
README for GNU development tools This directory contains various GNU compilers, assemblers, linkers, debuggers, etc., plus their support routines, definitions, and documentation. If you are receiving this as part of a GDB release, see the file gdb/README. If with a binutils release, see binutils/README, and so on. That'll give you info about this package -- supported targets, how to use it, how to report bugs, etc. It is now possible to automatically configure and build a variety of tools with one command. To build all of the tools contained herein, run the ``configure'' script here, e.g.: ./configure make To install them (by default in /usr/local/bin, /usr/local/lib, etc), then do: make install (If the configure script can't determine your type of computer, give it the name as an argument, for instance ``./configure sun4''. You can use the script ``config.sub'' to test whether a name is recognized; if it is, config.sub translates it to a triplet specifying CPU, vendor, and OS.) If you have more than one compiler on your system, it is often best to explicitly set CC in the environment before running configure, and to also set CC when running make. For example (assuming sh/bash/ksh): CC=gcc ./configure make A similar example using csh: setenv CC gcc ./configure make Much of the code and documentation enclosed is copyright by the Free Software Foundation, Inc. See the file COPYING or COPYING.LIB in the various directories, for a description of the GNU General Public License terms under which you can copy the files. REPORTING BUGS: Again, see gdb/README, binutils/README, etc., for info on where and how to report problems.