System notice: In light of the Debian OpenSSL security issue we've regenerated the server keys. See this thread for instructions and the new key fingerprints.

Commit 08528fd94dcb16cc65d736c609969460e9ad6ffd

Remove casts to PyCFunction in PyMethodDef structs

(Explicitly casting self to the proper object type in each method
is cleaner, IMHO.)

Commit diff

gdb/python/breakpoint.c

 
3232
3333typedef struct breakpoint_object breakpoint_object;
3434
35static PyObject *bppy_is_valid (breakpoint_object *);
36static PyObject *bppy_is_enabled (breakpoint_object *);
37static PyObject *bppy_is_silent (breakpoint_object *);
38static PyObject *bppy_set_enabled (breakpoint_object *, PyObject *);
39static PyObject *bppy_set_silent (breakpoint_object *, PyObject *);
40static PyObject *bppy_get_location (breakpoint_object *);
41static PyObject *bppy_get_condition (breakpoint_object *);
42static PyObject *bppy_get_commands (breakpoint_object *);
35static PyObject *bppy_is_valid (PyObject *, PyObject *);
36static PyObject *bppy_is_enabled (PyObject *, PyObject *);
37static PyObject *bppy_is_silent (PyObject *, PyObject *);
38static PyObject *bppy_set_enabled (PyObject *, PyObject *);
39static PyObject *bppy_set_silent (PyObject *, PyObject *);
40static PyObject *bppy_get_location (PyObject *, PyObject *);
41static PyObject *bppy_get_condition (PyObject *, PyObject *);
42static PyObject *bppy_get_commands (PyObject *, PyObject *);
4343
4444
4545/* A dynamically allocated vector of breakpoint objects. Each
8686
8787static PyMethodDef breakpoint_object_methods[] =
8888{
89 { "is_valid", (PyCFunction) bppy_is_valid, METH_NOARGS,
89 { "is_valid", bppy_is_valid, METH_NOARGS,
9090 "Return true if this breakpoint is valid, false if not." },
91 { "is_enabled", (PyCFunction) bppy_is_enabled, METH_NOARGS,
91 { "is_enabled", bppy_is_enabled, METH_NOARGS,
9292 "Return true if this breakpoint is enabled, false if disabled." },
93 { "is_silent", (PyCFunction) bppy_is_silent, METH_NOARGS,
93 { "is_silent", bppy_is_silent, METH_NOARGS,
9494 "Return true if this breakpoint is silent, false if verbose." },
9595
96 { "set_enabled", (PyCFunction) bppy_set_enabled, METH_O,
96 { "set_enabled", bppy_set_enabled, METH_O,
9797 "Enable or disable this breakpoint" },
98 { "set_silent", (PyCFunction) bppy_set_silent, METH_O,
98 { "set_silent", bppy_set_silent, METH_O,
9999 "Make this breakpoint quiet or verbose" },
100100
101 { "get_location", (PyCFunction) bppy_get_location, METH_NOARGS,
101 { "get_location", bppy_get_location, METH_NOARGS,
102102 "Return the location of this breakpoint, as specified by the user"},
103 { "get_condition", (PyCFunction) bppy_get_condition, METH_NOARGS,
103 { "get_condition", bppy_get_condition, METH_NOARGS,
104104 "Return the condition of this breakpoint, as specified by the user.\n\
105105Returns None if no condition set."},
106 { "get_commands", (PyCFunction) bppy_get_commands, METH_NOARGS,
106 { "get_commands", bppy_get_commands, METH_NOARGS,
107107 "Return the commands of this breakpoint, as specified by the user"},
108108
109109 { 0 }
143143};
144144
145145static PyObject *
146bppy_is_valid (breakpoint_object *self)
146bppy_is_valid (PyObject *self, PyObject *args)
147147{
148 if (self->bp)
148 if (((breakpoint_object *) self)->bp)
149149 Py_RETURN_TRUE;
150150 Py_RETURN_FALSE;
151151}
152152
153153static PyObject *
154bppy_is_enabled (breakpoint_object *self)
154bppy_is_enabled (PyObject *self, PyObject *args)
155155{
156 if (! self->bp)
156 if (! ((breakpoint_object *) self)->bp)
157157 Py_RETURN_FALSE;
158158 /* Not clear what we really want here. */
159 if (self->bp->enable_state == bp_enabled)
159 if (((breakpoint_object *) self)->bp->enable_state == bp_enabled)
160160 Py_RETURN_TRUE;
161161 Py_RETURN_FALSE;
162162}
163163
164164static PyObject *
165bppy_is_silent (breakpoint_object *self)
165bppy_is_silent (PyObject *self, PyObject *args)
166166{
167 BPPY_REQUIRE_VALID (self);
168 if (self->bp->silent)
167 BPPY_REQUIRE_VALID ((breakpoint_object *) self);
168 if (((breakpoint_object *) self)->bp->silent)
169169 Py_RETURN_TRUE;
170170 Py_RETURN_FALSE;
171171}
172172
173173static PyObject *
174bppy_set_enabled (breakpoint_object *self, PyObject *newvalue)
174bppy_set_enabled (PyObject *self, PyObject *newvalue)
175175{
176 BPPY_REQUIRE_VALID (self);
176 breakpoint_object *self_bp = (breakpoint_object *) self;
177
178 BPPY_REQUIRE_VALID (self_bp);
177179 if (! PyBool_Check (newvalue))
178180 return PyErr_Format (PyExc_RuntimeError, "argument must be boolean");
179181
180182 if (newvalue == Py_True)
181 enable_breakpoint (self->bp);
183 enable_breakpoint (self_bp->bp);
182184 else
183 disable_breakpoint (self->bp);
185 disable_breakpoint (self_bp->bp);
184186
185187 Py_RETURN_NONE;
186188}
187189
188190static PyObject *
189bppy_set_silent (breakpoint_object *self, PyObject *newvalue)
191bppy_set_silent (PyObject *self, PyObject *newvalue)
190192{
191 BPPY_REQUIRE_VALID (self);
193 breakpoint_object *self_bp = (breakpoint_object *) self;
194
195 BPPY_REQUIRE_VALID (self_bp);
192196 if (! PyBool_Check (newvalue))
193197 return PyErr_Format (PyExc_RuntimeError, "argument must be boolean");
194198
195 self->bp->silent = (newvalue == Py_True);
199 self_bp->bp->silent = (newvalue == Py_True);
196200
197201 Py_RETURN_NONE;
198202}
199203
200204static PyObject *
201bppy_get_location (breakpoint_object *self)
205bppy_get_location (PyObject *self, PyObject *args)
202206{
203207 char *str;
204 BPPY_REQUIRE_VALID (self);
205 str = self->bp->addr_string;
208
209 BPPY_REQUIRE_VALID ((breakpoint_object *) self);
210 str = ((breakpoint_object *) self)->bp->addr_string;
206211 /* FIXME: watchpoints? tracepoints? */
207212 if (! str)
208213 str = "";
216216}
217217
218218static PyObject *
219bppy_get_condition (breakpoint_object *self)
219bppy_get_condition (PyObject *self, PyObject *args)
220220{
221221 char *str;
222 BPPY_REQUIRE_VALID (self);
222 BPPY_REQUIRE_VALID ((breakpoint_object *) self);
223223
224 str = self->bp->cond_string;
224 str = ((breakpoint_object *) self)->bp->cond_string;
225225 if (! str)
226226 Py_RETURN_NONE;
227227 return PyString_Decode (str, strlen (str), host_charset (),
229229}
230230
231231static PyObject *
232bppy_get_commands (breakpoint_object *self)
232bppy_get_commands (PyObject *self, PyObject *args)
233233{
234 breakpoint_object *self_bp = (breakpoint_object *) self;
234235 long length;
235236 volatile struct gdb_exception except;
236237 struct ui_file *string_file;
239239 PyObject *result;
240240 char *cmdstr;
241241
242 BPPY_REQUIRE_VALID (self);
242 BPPY_REQUIRE_VALID (self_bp);
243243
244 if (! self->bp->commands)
244 if (! self_bp->bp->commands)
245245 Py_RETURN_NONE;
246246
247247 string_file = mem_fileopen ();
252252 /* FIXME: this can fail. Maybe we need to be making a new
253253 ui_out object here? */
254254 ui_out_redirect (uiout, string_file);
255 print_command_lines (uiout, self->bp->commands, 0);
255 print_command_lines (uiout, self_bp->bp->commands, 0);
256256 ui_out_redirect (uiout, NULL);
257257 }
258258 cmdstr = ui_file_xstrdup (string_file, &length);
toggle raw diff

gdb/python/cmd.c

 
4444
4545static PyMethodDef cmdpy_object_methods[] =
4646{
47 { "dont_repeat", (PyCFunction) cmdpy_dont_repeat, METH_NOARGS,
47 { "dont_repeat", cmdpy_dont_repeat, METH_NOARGS,
4848 "Prevent command repetition when user enters empty line." },
4949
5050 { 0 }
toggle raw diff

gdb/python/frame.c

 
4545static struct frame_info *frame_object_to_frame_info (frame_object *frame_obj);
4646
4747static PyObject *frapy_str (PyObject *self);
48static PyObject *frapy_equal_p (frame_object *self, PyObject *args);
49static PyObject *frapy_inner_p (frame_object *self, PyObject *args);
50static PyObject *frapy_is_valid (frame_object *self);
51static PyObject *frapy_get_name (frame_object *self);
52static PyObject *frapy_get_type (frame_object *self);
53static PyObject *frapy_get_unwind_stop_reason (frame_object *self);
54static PyObject *frapy_get_pc (frame_object *self);
48static PyObject *frapy_equal_p (PyObject *self, PyObject *args);
49static PyObject *frapy_inner_p (PyObject *self, PyObject *args);
50static PyObject *frapy_is_valid (PyObject *self, PyObject *args);
51static PyObject *frapy_get_name (PyObject *self, PyObject *args);
52static PyObject *frapy_get_type (PyObject *self, PyObject *args);
53static PyObject *frapy_get_unwind_stop_reason (PyObject *self, PyObject *args);
54static PyObject *frapy_get_pc (PyObject *self, PyObject *args);
5555static PyObject *frapy_get_address_in_block (PyObject *self, PyObject *args);
56static PyObject *frapy_get_prev (frame_object *self);
57static PyObject *frapy_get_next (frame_object *self);
58static PyObject *frapy_find_sal (frame_object *self);
56static PyObject *frapy_get_prev (PyObject *self, PyObject *args);
57static PyObject *frapy_get_next (PyObject *self, PyObject *args);
58static PyObject *frapy_find_sal (PyObject *self, PyObject *args);
5959
6060#define FRAPY_REQUIRE_VALID(frame_obj, frame) \
6161 do { \
6868 } while (0)
6969
7070static PyMethodDef frame_object_methods[] = {
71 { "equals", (PyCFunction) frapy_equal_p, METH_VARARGS,
72 "Compare frames." },
73 { "is_inner_than", (PyCFunction) frapy_inner_p, METH_VARARGS,
71 { "equals", frapy_equal_p, METH_VARARGS, "Compare frames." },
72 { "is_inner_than", frapy_inner_p, METH_VARARGS,
7473 "Return true if this frame is strictly inner than the other frame." },
75 { "is_valid.", (PyCFunction) frapy_is_valid, METH_NOARGS,
74 { "is_valid.", frapy_is_valid, METH_NOARGS,
7675 "Return true if this frame is valid, false if not." },
77 { "get_name", (PyCFunction) frapy_get_name, METH_NOARGS,
76 { "get_name", frapy_get_name, METH_NOARGS,
7877 "Return the function name of the frame." },
79 { "get_type", (PyCFunction) frapy_get_type, METH_NOARGS,
80 "Return the type of the frame." },
81 { "get_unwind_stop_reason", (PyCFunction) frapy_get_unwind_stop_reason,
78 { "get_type", frapy_get_type, METH_NOARGS, "Return the type of the frame." },
79 { "get_unwind_stop_reason", frapy_get_unwind_stop_reason,
8280 METH_NOARGS, "Return the function name of the frame." },
83 { "get_pc", (PyCFunction) frapy_get_pc, METH_NOARGS,
84 "Return the frame's resume address." },
81 { "get_pc", frapy_get_pc, METH_NOARGS, "Return the frame's resume address." },
8582 { "get_address_in_block", frapy_get_address_in_block, METH_NOARGS,
8683 "Return an address which falls within the frame's code block." },
87 { "get_prev", (PyCFunction) frapy_get_prev, METH_NOARGS,
84 { "get_prev", frapy_get_prev, METH_NOARGS,
8885 "Return the previous (outer) frame." },
89 { "get_next", (PyCFunction) frapy_get_next, METH_NOARGS,
90 "Return the next (inner) frame." },
91 { "find_sal", (PyCFunction) frapy_find_sal, METH_NOARGS,
86 { "get_next", frapy_get_next, METH_NOARGS, "Return the next (inner) frame." },
87 { "find_sal", frapy_find_sal, METH_NOARGS,
9288 "Return the frame's symtab and line." },
9389 {NULL} /* Sentinel */
9490};
123123
124124
125125static PyObject *
126frapy_is_valid (frame_object *self)
127{
128 struct frame_info *frame;
129
130 frame = frame_object_to_frame_info (self);
131 if (frame == NULL)
132 Py_RETURN_FALSE;
133
134 Py_RETURN_TRUE;
135}
136
137static PyObject *
138126frapy_str (PyObject *self)
139127{
140128 char *s;
140140}
141141
142142static PyObject *
143frapy_equal_p (frame_object *self, PyObject *args)
143frapy_is_valid (PyObject *self, PyObject *args)
144{
145 struct frame_info *frame;
146
147 frame = frame_object_to_frame_info ((frame_object *) self);
148 if (frame == NULL)
149 Py_RETURN_FALSE;
150
151 Py_RETURN_TRUE;
152}
153
154static PyObject *
155frapy_equal_p (PyObject *self, PyObject *args)
144156{
145157 int equalp = 0; /* Initialize to appease gcc warning. */
158 frame_object *self_frame = (frame_object *) self;
146159 frame_object *other;
147160 volatile struct gdb_exception except;
148161
164164
165165 TRY_CATCH (except, RETURN_MASK_ALL)
166166 {
167 equalp = frame_id_eq (self->frame_id, other->frame_id);
167 equalp = frame_id_eq (self_frame->frame_id, other->frame_id);
168168 }
169169 GDB_PY_HANDLE_EXCEPTION (except);
170170
175175}
176176
177177static PyObject *
178frapy_inner_p (frame_object *self, PyObject *args)
178frapy_inner_p (PyObject *self, PyObject *args)
179179{
180180 int innerp = 0; /* Initialize to appease gcc warning. */
181 frame_object *self_frame = (frame_object *) self;
181182 frame_object *other;
182183 volatile struct gdb_exception except;
183184
188188 TRY_CATCH (except, RETURN_MASK_ALL)
189189 {
190190 /* It doesn't make sense to compare frames from different arches. */
191 if (self->gdbarch != other->gdbarch)
191 if (self_frame->gdbarch != other->gdbarch)
192192 {
193193 PyErr_SetString (PyExc_ValueError,
194194 "Frames are from different architectures.");
195195 return NULL;
196196 }
197197
198 innerp = frame_id_inner (self->gdbarch, self->frame_id, other->frame_id);
198 innerp = frame_id_inner (self_frame->gdbarch,
199 self_frame->frame_id, other->frame_id);
199200 }
200201 GDB_PY_HANDLE_EXCEPTION (except);
201202
207207}
208208
209209static PyObject *
210frapy_get_name (frame_object *self)
210frapy_get_name (PyObject *self, PyObject *args)
211211{
212212 struct frame_info *frame;
213213 char *name;
217217
218218 TRY_CATCH (except, RETURN_MASK_ALL)
219219 {
220 FRAPY_REQUIRE_VALID (self, frame);
220 FRAPY_REQUIRE_VALID ((frame_object *) self, frame);
221221
222222 find_frame_funname (frame, &name, &lang);
223223 }
236236}
237237
238238static PyObject *
239frapy_get_type (frame_object *self)
239frapy_get_type (PyObject *self, PyObject *args)
240240{
241241 struct frame_info *frame;
242242 enum frame_type type = NORMAL_FRAME;/* Initialize to appease gcc warning. */
244244
245245 TRY_CATCH (except, RETURN_MASK_ALL)
246246 {
247 FRAPY_REQUIRE_VALID (self, frame);
247 FRAPY_REQUIRE_VALID ((frame_object *) self, frame);
248248
249249 type = get_frame_type (frame);
250250 }
254254}
255255
256256static PyObject *
257frapy_get_unwind_stop_reason (frame_object *self)
257frapy_get_unwind_stop_reason (PyObject *self, PyObject *args)
258258{
259259 struct frame_info *frame = NULL; /* Initialize to appease gcc warning. */
260260 volatile struct gdb_exception except;
262262
263263 TRY_CATCH (except, RETURN_MASK_ALL)
264264 {
265 FRAPY_REQUIRE_VALID (self, frame);
265 FRAPY_REQUIRE_VALID ((frame_object *) self, frame);
266266 }
267267 GDB_PY_HANDLE_EXCEPTION (except);
268268
272272}
273273
274274static PyObject *
275frapy_get_pc (frame_object *self)
275frapy_get_pc (PyObject *self, PyObject *args)
276276{
277277 CORE_ADDR pc = 0; /* Initialize to appease gcc warning. */
278278 struct frame_info *frame;
280280
281281 TRY_CATCH (except, RETURN_MASK_ALL)
282282 {
283 FRAPY_REQUIRE_VALID (self, frame);
283 FRAPY_REQUIRE_VALID ((frame_object *) self, frame);
284284
285285 pc = get_frame_pc (frame);
286286 }
292292static PyObject *
293293frapy_get_address_in_block (PyObject *self, PyObject *args)
294294{
295 frame_object *frame_obj = (frame_object *) self;
296295 CORE_ADDR pc = 0; /* Initialize to appease gcc warning. */
297296 struct frame_info *frame;
298297 volatile struct gdb_exception except;
299298
300299 TRY_CATCH (except, RETURN_MASK_ALL)
301300 {
302 FRAPY_REQUIRE_VALID (frame_obj, frame);
301 FRAPY_REQUIRE_VALID ((frame_object *) self, frame);
303302
304303 pc = get_frame_address_in_block (frame);
305304 }
356356}
357357
358358static PyObject *
359frapy_get_prev (frame_object *self)
359frapy_get_prev (PyObject *self, PyObject *args)
360360{
361361 struct frame_info *frame, *prev;
362362 volatile struct gdb_exception except;
364364
365365 TRY_CATCH (except, RETURN_MASK_ALL)
366366 {
367 FRAPY_REQUIRE_VALID (self, frame);
367 FRAPY_REQUIRE_VALID ((frame_object *) self, frame);
368368
369369 prev = get_prev_frame (frame);
370370 if (prev)
381381}
382382
383383static PyObject *
384frapy_get_next (frame_object *self)
384frapy_get_next (PyObject *self, PyObject *args)
385385{
386386 struct frame_info *frame, *next;
387387 volatile struct gdb_exception except;
389389
390390 TRY_CATCH (except, RETURN_MASK_ALL)
391391 {
392 FRAPY_REQUIRE_VALID (self, frame);
392 FRAPY_REQUIRE_VALID ((frame_object *) self, frame);
393393
394394 next = get_next_frame (frame);
395395 if (next)
406406}
407407
408408static PyObject *
409frapy_find_sal (frame_object *self)
409frapy_find_sal (PyObject *self, PyObject *args)
410410{
411411 struct frame_info *frame;
412412 struct symtab_and_line sal;
415415
416416 TRY_CATCH (except, RETURN_MASK_ALL)
417417 {
418 FRAPY_REQUIRE_VALID (self, frame);
418 FRAPY_REQUIRE_VALID ((frame_object *) self, frame);
419419
420420 find_frame_sal (frame, &sal);
421421 sal_obj = symtab_and_line_to_sal_object (sal);
toggle raw diff

gdb/python/symtab.c

 
2929} symtab_object;
3030
3131static PyObject *stpy_str (PyObject *self);
32static PyObject *stpy_filename (symtab_object *self);
33static PyObject *stpy_to_fullname (symtab_object *self);
32static PyObject *stpy_filename (PyObject *self, PyObject *args);
33static PyObject *stpy_to_fullname (PyObject *self, PyObject *args);
3434
3535static PyMethodDef symtab_object_methods[] = {
36 { "get_filename", (PyCFunction) stpy_filename, METH_NOARGS,
36 { "get_filename", stpy_filename, METH_NOARGS,
3737 "Return the symtab's source filename." },
38 { "to_fullname", (PyCFunction) stpy_to_fullname, METH_NOARGS,
38 { "to_fullname", stpy_to_fullname, METH_NOARGS,
3939 "Return the symtab's full source filename." },
4040 {NULL} /* Sentinel */
4141};
7878 struct symtab_and_line *sal;
7979} sal_object;
8080
81static void salpy_dealloc (sal_object *self);
82static int salpy_setsymtab (sal_object *self, void *closure);
81static void salpy_dealloc (PyObject *self);
82static int salpy_setsymtab (PyObject *self, PyObject *value, void *closure);
8383static PyObject *salpy_str (PyObject *self);
84static PyObject *salpy_getsymtab (sal_object *self, void *closure);
85static PyObject *salpy_pc (sal_object *self);
86static PyObject *salpy_line (sal_object *self);
84static PyObject *salpy_getsymtab (PyObject *self, void *closure);
85static PyObject *salpy_pc (PyObject *self, PyObject *args);
86static PyObject *salpy_line (PyObject *self, PyObject *args);
8787
8888static PyGetSetDef sal_object_getseters[] = {
89 { "symtab", (getter) salpy_getsymtab, (setter) salpy_setsymtab,
90 "Symtab object.", NULL },
89 { "symtab", salpy_getsymtab, salpy_setsymtab, "Symtab object.", NULL },
9190 {NULL} /* Sentinel */
9291};
9392
9493static PyMethodDef sal_object_methods[] = {
95 { "get_pc", (PyCFunction) salpy_pc, METH_NOARGS,
94 { "get_pc", salpy_pc, METH_NOARGS,
9695 "Return the symtab_and_line's pc." },
97 { "get_line", (PyCFunction) salpy_line, METH_NOARGS,
96 { "get_line", salpy_line, METH_NOARGS,
9897 "Return the symtab_and_line's line." },
9998 {NULL} /* Sentinel */
10099};
104104 "gdb.Symtab_and_line", /*tp_name*/
105105 sizeof (sal_object), /*tp_basicsize*/
106106 0, /*tp_itemsize*/
107 (destructor) salpy_dealloc, /*tp_dealloc*/
107 salpy_dealloc, /*tp_dealloc*/
108108 0, /*tp_print*/
109109 0, /*tp_getattr*/
110110 0, /*tp_setattr*/
140140 char *s;
141141 PyObject *result;
142142
143 ret = asprintf(&s, "symbol table for %s",
144 ((symtab_object *) self)->symtab->filename);
143 ret = asprintf (&s, "symbol table for %s",
144 ((symtab_object *) self)->symtab->filename);
145145 if (ret < 0)
146146 Py_RETURN_NONE;
147147
153153
154154/* FIXME: maybe this should be an attribute instead of a method? */
155155static PyObject *
156stpy_filename (symtab_object *self)
156stpy_filename (PyObject *self, PyObject *args)
157157{
158 symtab_object *self_symtab = (symtab_object *) self;
158159 PyObject *str_obj;
159160
160161 /* FIXME: Can symtab->filename really be NULL? */
161 if (self->symtab->filename)
162 str_obj = PyString_Decode (self->symtab->filename,
163 strlen (self->symtab->filename), host_charset (),
164 NULL /* FIXME */);
162 if (self_symtab->symtab->filename)
163 str_obj = PyString_Decode (self_symtab->symtab->filename,
164 strlen (self_symtab->symtab->filename),
165 host_charset (), NULL /* FIXME */);
165166 else
166167 {
167168 str_obj = Py_None;
173173}
174174
175175static PyObject *
176stpy_to_fullname (symtab_object *self)
176stpy_to_fullname (PyObject *self, PyObject *args)
177177{
178178 char *fullname;
179179
180 fullname = symtab_to_fullname (self->symtab);
180 fullname = symtab_to_fullname (((symtab_object *) self)->symtab);
181181 if (fullname)
182182 return PyString_Decode (fullname, strlen (fullname), host_charset (),
183183 NULL /* FIXME */);
196196 sal_obj = (sal_object *) self;
197197 filename = (sal_obj->symtab == (symtab_object *) Py_None)? "<unknown>" :
198198 sal_obj->symtab->symtab->filename;
199 ret = asprintf(&s, "symbol and line for %s, line %d", filename,
200 sal_obj->sal->line);
199 ret = asprintf (&s, "symbol and line for %s, line %d", filename,
200 sal_obj->sal->line);
201201 if (ret < 0)
202202 Py_RETURN_NONE;
203203
208208}
209209
210210static PyObject *
211salpy_pc (sal_object *self)
211salpy_pc (PyObject *self, PyObject *args)
212212{
213 return PyLong_FromUnsignedLongLong (self->sal->pc);
213 return PyLong_FromUnsignedLongLong (((sal_object *) self)->sal->pc);
214214}
215215
216216static PyObject *
217salpy_line (sal_object *self)
217salpy_line (PyObject *self, PyObject *args)
218218{
219 return PyLong_FromUnsignedLongLong (self->sal->line);
219 return PyLong_FromUnsignedLongLong (((sal_object *) self)->sal->line);
220220}
221221
222222static PyObject *
223salpy_getsymtab (sal_object *self, void *closure)
223salpy_getsymtab (PyObject *self, void *closure)
224224{
225 Py_INCREF (self->symtab);
225 sal_object *self_sal = (sal_object *) self;
226226
227 return (PyObject *) self->symtab;
227 Py_INCREF (self_sal->symtab);
228
229 return (PyObject *) self_sal->symtab;
228230}
229231
230232static int
231salpy_setsymtab (sal_object *self, void *closure)
233salpy_setsymtab (PyObject *self, PyObject *value, void *closure)
232234{
233 PyErr_SetString(PyExc_TypeError, "The symtab attribute can't be modified.");
235 PyErr_SetString (PyExc_TypeError, "The symtab attribute can't be modified.");
234236
235237 return -1;
236238}
237239
238240static void
239salpy_dealloc (sal_object *self)
241salpy_dealloc (PyObject *self)
240242{
241 Py_DECREF (self->symtab);
242 xfree (self->sal);
243 self->ob_type->tp_free((PyObject*)self);
243 sal_object *self_sal = (sal_object *) self;
244
245 Py_DECREF (self_sal->symtab);
246 xfree (self_sal->sal);
247 self_sal->ob_type->tp_free (self);
244248}
245249
246250PyObject *
317317 return;
318318
319319 P