aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/python-internal.h
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2021-09-16 18:30:35 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2021-10-22 13:43:42 +0100
commit625f7b1cdc771befb362370c42e32a3476abdb85 (patch)
treea39ec69f519d1bcd69d3bc591c41b00c46ca4436 /gdb/python/python-internal.h
parent8b87fbe6bb5f682fef889630664884ea8e7d6444 (diff)
downloadbinutils-625f7b1cdc771befb362370c42e32a3476abdb85.zip
binutils-625f7b1cdc771befb362370c42e32a3476abdb85.tar.gz
binutils-625f7b1cdc771befb362370c42e32a3476abdb85.tar.bz2
gdb/python: move gdb.Membuf support into a new file
In a future commit I'm going to be creating gdb.Membuf objects from a new file within gdb/python/py*.c. Currently all gdb.Membuf objects are created directly within infpy_read_memory (as a result of calling gdb.Inferior.read_memory()). Initially I split out the Membuf creation code into a new function, and left the new function in gdb/python/py-inferior.c, however, it felt a little random that the Membuf creation code should live with the inferior handling code. So, then I moved all of the Membuf related code out into a new file, gdb/python/py-membuf.c, the interface is gdbpy_buffer_to_membuf, which wraps an array of bytes into a gdb.Membuf object. Most of the code is moved directly from py-inferior.c with only minor tweaks to layout and replacing NULL with nullptr, hence, I've left the copyright date on py-membuf.c as 2009-2021 to match py-inferior.c. Currently, the only user of this code is still py-inferior.c, but in later commits this will change. There should be no user visible changes after this commit.
Diffstat (limited to 'gdb/python/python-internal.h')
-rw-r--r--gdb/python/python-internal.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
index 2ad3bc9..24e28bc 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -479,6 +479,9 @@ gdbpy_ref<thread_object> create_thread_object (struct thread_info *tp);
gdbpy_ref<> thread_to_thread_object (thread_info *thr);;
gdbpy_ref<inferior_object> inferior_to_inferior_object (inferior *inf);
+PyObject *gdbpy_buffer_to_membuf (gdb::unique_xmalloc_ptr<gdb_byte> buffer,
+ CORE_ADDR address, ULONGEST length);
+
const struct block *block_object_to_block (PyObject *obj);
struct symbol *symbol_object_to_symbol (PyObject *obj);
struct value *value_object_to_value (PyObject *self);
@@ -550,6 +553,8 @@ int gdbpy_initialize_unwind (void)
CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
int gdbpy_initialize_tui ()
CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+int gdbpy_initialize_membuf ()
+ CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
/* A wrapper for PyErr_Fetch that handles reference counting for the
caller. */