This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


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: GDB Python support


On Tuesday 15 March 2011 02:10:55 Bryce Schober wrote:
> This is what I mean. It requires specifying gdb's configure option
> "—with-python" (my cursory glance at crosstool's configs left me with
> the impression that there was no place to plug in that option),

There is currently no way to add user-supplied options to gdb's
./configure.

Here is attached a untested patch. Care to report, please?
  

There are two places to enable python support:
- for the cross-gdb: we can use the python available on the host
- the native gdb: it is a bit more complex, as it requires an existing
  python to run on the target, *and* an exiting python devel env to run
  on the target. Obviously, we can't readily have this target python,
  as we're still building the toolchain. And, no-no-no, I won't add a
  python devel env in the toolchain.

So, for the native gdb to run on the target:
- either it does not support python scripting,
- or the user will have to build it on his/her own.

> and 
> implies dependencies. I assume that in the context of crosstool, one
> would prefer it to compile its own minimal version of python for that
> purpose. I haven't gone very far down the chain of implications
> myself, but I've scanned through the Qt Creator process for the
> python-enabled gdb that they ship
> (http://developer.qt.nokia.com/wiki/QtCreatorBuildGdb), and at least
> their Linux build process doesn't look too obtuse.

For the cross-gdb, we can assume that the host laready has the python devel
env (headers+libs). For the native gdb, that's a no-no in crostool-NG.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
diff --git a/config/debug/gdb.in.cross b/config/debug/gdb.in.cross
--- a/config/debug/gdb.in.cross
+++ b/config/debug/gdb.in.cross
@@ -24,4 +24,28 @@
       That way, you can share the cross-gdb without installing a toolchain
       on every machine that will be used to debug target programs.
 
+config GDB_CROSS_PYTHON
+    bool
+    prompt "Enable python scripting"
+    default n
+    help
+      If you say 'y' here, then you will be able to call to python from the
+      gdb prompt.
+
+config GDB_CROSS_PYTHON_PATH
+    string
+    prompt "Path to python"
+    default ""
+    depends on GDB_CROSS_PYTHON
+    help
+      By default, gdb's ./configure will search $PATH to find python, and
+      deduce the python headers and libs.
+      
+      If your python is not in the standard places, you can enter here any of:
+      - the full path to the python executable
+      - the prefix you gave when you ./configured python
+      - just the name of the python executable
+      
+      If you are not sure, just leave this empty.
+
 endif # GDB_CROSS
diff --git a/scripts/build/debug/300-gdb.sh b/scripts/build/debug/300-gdb.sh
--- a/scripts/build/debug/300-gdb.sh
+++ b/scripts/build/debug/300-gdb.sh
@@ -112,6 +112,9 @@
             none)   cross_extra_config+=("--disable-threads");;
             *)      cross_extra_config+=("--enable-threads");;
         esac
+        if [ "${CT_GDB_CROSS_PYTHON}" = "y" ]; then
+            cross_extra_config+=("--with-python=${CT_GDB_CROSS_PYTHON_PATH}")
+        fi
 
         CC_for_gdb=
         LD_for_gdb=

--
For unsubscribe information see http://sourceware.org/lists.html#faq

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