Re: Python pretty-printing [1/6]

Joel Brobecker
2009-04-07T18:24:50Z

Hi Tom,

I hope this isn't too late a review to bring this up. I looked at
this series of patches last Friday, but I didn't have an internet
connection back then.

> 2009-01-25 Sergio Durigan Junior <sergiodj@linux.vnet.ibm.com>
> Tom Tromey <tromey@redhat.com>
>
> * configure, config.in: Regenerate.
> * configure.ac: Support for relocatable GDB datadir. Add
> --with-pythondir.
> * python/python.c (_initialize_python): Set pythondir or datadir
> as needed. Update sys.path.
> * maint.c (_initialize_maint_cmds): Add "maint set gdb_datadir".
> * defs.h (gdb_datadir): Declare.
> * main.c (gdb_datadir): New global.
> (captured_main): Initialize gdb_datadir.

I'm wondering whether we could implement this slightly differently.
Right now, this patch adds code that is conditional on wether some
macros are defined or not. For instance:

> +#ifdef PYTHONDIR
> + PyModule_AddStringConstant (gdb_module, "pythondir", PYTHONDIR);
> +#else
> + if (gdb_datadir)
> + PyModule_AddStringConstant (gdb_module, "datadir", gdb_datadir);
> +#endif

Can we change that, for instance by assuming that we always have
PYTHONDIR, and that by default, configure will set to the datadir?

I was going to comment on the ..._RELOCATABLE macro, but I see that
we're already using that idiom for at least the system gdbinit file.

--
Joel