[PATCH] sys.argv and ipython (interactive python) support in GDB/Python
Taisuke Yamada
tai@rakugaki.org
Fri Jul 1 14:10:00 GMT 2011
Hi.
>> + char *argv[] = { "gdb", NULL };
>
> As Kevin noted, this needs to be placed in the declarations part of the function.
Yes...I'm now too used to C99 and was too sloppy to move declaration upward :-)
>> Py_Initialize ();
>> + PySys_SetArgvEx (1, argv, 0);
>
> Isn't your first argument of argv the executable GDB?
Not really. I'm just setting "gdb" as a text label to use when generating
log message both in python and python library. Just like in C, it *usually*
points to executing script itself, but after all, there's nothing that
gurantees that.
Alternatively, you can do "PySys_SetArgvEx (0, NULL, 0);", but then
python will automatically generate empty (= "") argv[0]. That means any
logs generated will be somewhat odd, so my idea was to have something
instead. If you're concerned, maybe "python-gdb" would be better.
Best Regards,
More information about the Gdb-patches
mailing list