This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v1 03/13] script language API for GDB: python.[ch] changes
- From: Doug Evans <xdje42 at gmail dot com>
- To: Phil Muldoon <pmuldoon at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 06 Dec 2013 09:21:39 -0800
- Subject: Re: [PATCH v1 03/13] script language API for GDB: python.[ch] changes
- Authentication-results: sourceware.org; auth=none
- References: <52a1662d dot a601430a dot 7cf1 dot 61b3 at mx dot google dot com> <52A1C475 dot 4010901 at redhat dot com>
Phil Muldoon <pmuldoon@redhat.com> writes:
>> +
>> +extern int gdbpy_auto_load_enabled (const struct script_language_defn *);
>> +
>> +/* script_language_ops "methods". */
>> +
>> +extern int gdbpy_apply_val_pretty_printer
>> + (const struct script_language_defn *,
>> + struct type *type, const gdb_byte *valaddr,
>> + int embedded_offset, CORE_ADDR address,
>> + struct ui_file *stream, int recurse,
>> + const struct value *val,
>> + const struct value_print_options *options,
>> + const struct language_defn *language);
>> +extern enum script_bt_status gdbpy_apply_frame_filter
>> + (const struct script_language_defn *,
>> + struct frame_info *frame, int flags, enum script_frame_args args_type,
>> + struct ui_out *out, int frame_low, int frame_high);
>> +extern void gdbpy_preserve_values (const struct script_language_defn *,
>> + struct objfile *objfile,
>> + htab_t copied_types);
>> +extern enum scr_bp_stop gdbpy_breakpoint_cond_says_stop
>> + (const struct script_language_defn *, struct breakpoint *);
>> +extern int gdbpy_breakpoint_has_cond (const struct script_language_defn *,
>> + struct breakpoint *b);
>
> I did not ask in the previous patch, but why could not these functions
> have been kept in Python?
Not sure I understand the question. Can you elaborate?
>>
>> +/* Some code (e.g., MI) wants to know if a particular scripting language
>> + successfully initialized.
>> + Return non-zero if Python scripting successfully initialized. */
>> +
>> +int
>> +script_lang_python_initialized (void)
>> +{
>> + if (script_language_python.ops != NULL)
>> + return script_language_python.ops->initialized (&script_language_python);
>> + return 0;
>> +}
>> +
>
> I missed the convention here, but I thought that methods exported to
> the ops struct had a gdbpy_ prefix?
This one isn't exported through the ops struct.
OTOH, as noted in an earlier email, a better way to go would be
a general function that took a script_lang enum as an argument.