This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch][python] Fix some unguarded GDB calls.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]