OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.1/] [gdb/] [python/] [python-internal.h] - Blame information for rev 227

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 227 jeremybenn
/* Gdb/Python header for private use by Python module.
2
 
3
   Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
4
 
5
   This file is part of GDB.
6
 
7
   This program is free software; you can redistribute it and/or modify
8
   it under the terms of the GNU General Public License as published by
9
   the Free Software Foundation; either version 3 of the License, or
10
   (at your option) any later version.
11
 
12
   This program is distributed in the hope that it will be useful,
13
   but WITHOUT ANY WARRANTY; without even the implied warranty of
14
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
   GNU General Public License for more details.
16
 
17
   You should have received a copy of the GNU General Public License
18
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
19
 
20
#ifndef GDB_PYTHON_INTERNAL_H
21
#define GDB_PYTHON_INTERNAL_H
22
 
23
/* Python 2.4 doesn't include stdint.h soon enough to get {u,}intptr_t
24
   needed by pyport.h.  */
25
#include <stdint.h>
26
 
27
/* /usr/include/features.h on linux systems will define _POSIX_C_SOURCE
28
   if it sees _GNU_SOURCE (which config.h will define).
29
   pyconfig.h defines _POSIX_C_SOURCE to a different value than
30
   /usr/include/features.h does causing compilation to fail.
31
   To work around this, undef _POSIX_C_SOURCE before we include Python.h.  */
32
#undef _POSIX_C_SOURCE
33
 
34
#if HAVE_LIBPYTHON2_4
35
#include "python2.4/Python.h"
36
#include "python2.4/frameobject.h"
37
/* Py_ssize_t is not defined until 2.5.
38
   Logical type for Py_ssize_t is Py_intptr_t, but that fails in 64-bit
39
   compilation due to several apparent mistakes in python2.4 API, so we
40
   use 'int' instead.  */
41
typedef int Py_ssize_t;
42
#elif HAVE_LIBPYTHON2_5
43
#include "python2.5/Python.h"
44
#include "python2.5/frameobject.h"
45
#elif HAVE_LIBPYTHON2_6
46
#include "python2.6/Python.h"
47
#include "python2.6/frameobject.h"
48
#else
49
#error "Unable to find usable Python.h"
50
#endif
51
 
52
/* If Python.h does not define WITH_THREAD, then the various
53
   GIL-related functions will not be defined.  However,
54
   PyGILState_STATE will be.  */
55
#ifndef WITH_THREAD
56
#define PyGILState_Ensure() ((PyGILState_STATE) 0)
57
#define PyGILState_Release(ARG) ((void)(ARG))
58
#define PyEval_InitThreads() 0
59
#define PyThreadState_Swap(ARG) ((void)(ARG))
60
#define PyEval_InitThreads() 0
61
#define PyEval_ReleaseLock() 0
62
#endif
63
 
64
struct value;
65
struct language_defn;
66
 
67
extern PyObject *gdb_module;
68
extern PyTypeObject value_object_type;
69
 
70
PyObject *gdbpy_history (PyObject *self, PyObject *args);
71
PyObject *gdbpy_frame_stop_reason_string (PyObject *, PyObject *);
72
PyObject *gdbpy_selected_frame (PyObject *self, PyObject *args);
73
PyObject *gdbpy_lookup_type (PyObject *self, PyObject *args, PyObject *kw);
74
PyObject *gdbpy_create_lazy_string_object (CORE_ADDR address, long length,
75
                                           const char *encoding, struct type *type);
76
 
77
PyObject *value_to_value_object (struct value *v);
78
PyObject *type_to_type_object (struct type *);
79
PyObject *objfile_to_objfile_object (struct objfile *);
80
 
81
PyObject *objfpy_get_printers (PyObject *, void *);
82
 
83
struct value *value_object_to_value (PyObject *self);
84
struct value *convert_value_from_python (PyObject *obj);
85
struct type *type_object_to_type (PyObject *obj);
86
 
87
void gdbpy_initialize_values (void);
88
void gdbpy_initialize_frames (void);
89
void gdbpy_initialize_commands (void);
90
void gdbpy_initialize_types (void);
91
void gdbpy_initialize_functions (void);
92
void gdbpy_initialize_objfile (void);
93
void gdbpy_initialize_lazy_string (void);
94
 
95
struct cleanup *make_cleanup_py_decref (PyObject *py);
96
 
97
struct cleanup *ensure_python_env (struct gdbarch *gdbarch,
98
                                   const struct language_defn *language);
99
 
100
extern struct gdbarch *python_gdbarch;
101
extern const struct language_defn *python_language;
102
 
103
/* Use this after a TRY_EXCEPT to throw the appropriate Python
104
   exception.  */
105
#define GDB_PY_HANDLE_EXCEPTION(Exception)                              \
106
    do {                                                                \
107
      if (Exception.reason < 0)                                          \
108
        return PyErr_Format (Exception.reason == RETURN_QUIT            \
109
                             ? PyExc_KeyboardInterrupt : PyExc_RuntimeError, \
110
                             "%s", Exception.message);                  \
111
    } while (0)
112
 
113
 
114
void gdbpy_print_stack (void);
115
 
116
PyObject *python_string_to_unicode (PyObject *obj);
117
char *unicode_to_target_string (PyObject *unicode_str);
118
char *python_string_to_target_string (PyObject *obj);
119
PyObject *python_string_to_target_python_string (PyObject *obj);
120
char *python_string_to_host_string (PyObject *obj);
121
PyObject *target_string_to_unicode (const gdb_byte *str, int length);
122
int gdbpy_is_string (PyObject *obj);
123
int gdbpy_is_lazy_string (PyObject *result);
124
gdb_byte *gdbpy_extract_lazy_string (PyObject *string,
125
                                     struct type **str_type,
126
                                     long *length, char **encoding);
127
 
128
/* Note that these are declared here, and not in python.h with the
129
   other pretty-printer functions, because they refer to PyObject.  */
130
PyObject *apply_varobj_pretty_printer (PyObject *print_obj,
131
                                       struct value **replacement);
132
PyObject *gdbpy_get_varobj_pretty_printer (struct value *value);
133
char *gdbpy_get_display_hint (PyObject *printer);
134
PyObject *gdbpy_default_visualizer (PyObject *self, PyObject *args);
135
 
136
extern PyObject *gdbpy_doc_cst;
137
extern PyObject *gdbpy_children_cst;
138
extern PyObject *gdbpy_to_string_cst;
139
extern PyObject *gdbpy_display_hint_cst;
140
 
141
#endif /* GDB_PYTHON_INTERNAL_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.