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] sys.argv and ipython (interactive python) support in GDB/Python


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,


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