From 33b4be1d7ca14b25d0d57b5a2032971294980996 Mon Sep 17 00:00:00 2001 From: Johnny Chen Date: Fri, 8 Jul 2011 23:02:33 +0000 Subject: o TestEvents.py: Add a usage example of SBEvent APIs. o SBEvent.h and SBListener.h: Add method docstrings for SBEvent.h and SBListener.h, and example usage of SBEvent into the class docstring of SBEvent. o lldb.swig: Add typemap for SBEvent::SBEvent (uint32_t event, const char *cstr, uint32_t cstr_len) so that we can use, in Python, obj2 = lldb.SBEvent(0, "abc") to create an SBEvent. git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@134766 91177308-0d34-0410-b5e6-96231b3b80d8 --- scripts/lldb.swig | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'scripts/lldb.swig') diff --git a/scripts/lldb.swig b/scripts/lldb.swig index 206dd3480..9683971bc 100644 --- a/scripts/lldb.swig +++ b/scripts/lldb.swig @@ -102,7 +102,16 @@ o SBLineEntry: Specifies an association with a contiguous range of instructions // typemap for an outgoing buffer -// See also SBProcess::WriteMemory. +// See also SBEvent::SBEvent(uint32_t event, const char *cstr, uint32_t cstr_len). +%typemap(in) (const char *cstr, uint32_t cstr_len) { + if (!PyString_Check($input)) { + PyErr_SetString(PyExc_ValueError, "Expecting a string"); + return NULL; + } + $1 = (char *) PyString_AsString($input); + $2 = PyString_Size($input); +} +// And SBProcess::WriteMemory. %typemap(in) (const void *buf, size_t size) { if (!PyString_Check($input)) { PyErr_SetString(PyExc_ValueError, "Expecting a string"); -- cgit v1.2.3