This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch][python] Fix some unguarded GDB calls.
- From: Phil Muldoon <pmuldoon at redhat dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 20 Mar 2013 16:41:51 +0000
- Subject: Re: [patch][python] Fix some unguarded GDB calls.
- References: <5149BAA9 dot 8020902 at redhat dot com> <87hak69jqg dot fsf at fleche dot redhat dot com>
On 20/03/13 15:25, Tom Tromey wrote:
>>>>>> "Phil" == Phil Muldoon <pmuldoon@redhat.com> writes:
>
> Phil> 2013-03-20 Phil Muldoon <pmuldoon@redhat.com>
> Phil> * python/py-utils.c (get_addr_from_python): Use exception handler
> Phil> for value_as_address.
> Phil> * python/py-cmd.c (gdbpy_parse_command_name): Use exception
> Phil> handler for lookup_cmd_1..
> Phil> * python/python.c (execute_gdb_command): Move bpstat_do_actions
> Phil> into exception handler.
>
> Phil> + if (except.reason < 0)
> Phil> + {
> Phil> + gdbpy_convert_exception (except);
> Phil> + return NULL;
> Phil> + }
>
> Use GDB_PY_HANDLE_EXCEPTION instead.
Can't as this function returns char *. I did check the callers, and
they do a null check though, and deal with python exceptions. I get
this if I use that macro:
../../gdb/gdb/python/py-cmd.c: In function gdbpy_parse_command_name:
../../gdb/gdb/python/py-cmd.c:367:3: error: return from incompatible pointer type [-Werror]
> Phil> get_addr_from_python (PyObject *obj, CORE_ADDR *addr)
>
> This is documented as being able to throw gdb exceptions.
> It is fine by me if you want to fix that (it certainly looks simpler
> than fixing the one caller in infpy_search_memory), but then the intro
> comment for the function needs an update.
Yeah I can fix that.
Cheers
Phil