summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFernando Nasser <fnasser@redhat.com>2001-01-31 23:37:20 +0000
committerFernando Nasser <fnasser@redhat.com>2001-01-31 23:37:20 +0000
commitef05bcb855b5aa3fa8eed539a0ba4b1f5500af70 (patch)
tree14467e591408f7b4c93f1c6d10e1bf47bda70f2d
parent06a053af180af8937873fd2892e6b594f0e42b3b (diff)
downloadgdb-ef05bcb855b5aa3fa8eed539a0ba4b1f5500af70.tar.gz
2001-01-31 Fernando Nasser <fnasser@redhat.com>
* library/plugins/rhabout.tcl: Add load for optional sample C command procedure. * library/plugins/rhabout/rhabout.itcl (constructor): Try calling optional sample C command procedure rhabout_extra_text. * library/plugins/rhabout/rhabout.c: New file. Implement an example plug-in shared library with a sample C command procedure. * library/plugins/rhabout/Makefile: New file. Makefile for the sample shared library above (Linux only).
-rw-r--r--gdb/gdbtk/ChangeLog11
-rw-r--r--gdb/gdbtk/library/plugins/rhabout.tcl1
-rw-r--r--gdb/gdbtk/library/plugins/rhabout/Makefile9
-rw-r--r--gdb/gdbtk/library/plugins/rhabout/rhabout.c34
-rw-r--r--gdb/gdbtk/library/plugins/rhabout/rhabout.itcl9
5 files changed, 63 insertions, 1 deletions
diff --git a/gdb/gdbtk/ChangeLog b/gdb/gdbtk/ChangeLog
index 0edd3d1c979..89f7d66e0d1 100644
--- a/gdb/gdbtk/ChangeLog
+++ b/gdb/gdbtk/ChangeLog
@@ -1,3 +1,14 @@
+2001-01-31 Fernando Nasser <fnasser@redhat.com>
+
+ * library/plugins/rhabout.tcl: Add load for optional sample C command
+ procedure.
+ * library/plugins/rhabout/rhabout.itcl (constructor): Try calling
+ optional sample C command procedure rhabout_extra_text.
+ * library/plugins/rhabout/rhabout.c: New file. Implement an example
+ plug-in shared library with a sample C command procedure.
+ * library/plugins/rhabout/Makefile: New file. Makefile for the sample
+ shared library above (Linux only).
+
2001-01-28 Fernando Nasser <fnasser@redhat.com>
* library/plugins: New directory. Sample plug-in directory to help
diff --git a/gdb/gdbtk/library/plugins/rhabout.tcl b/gdb/gdbtk/library/plugins/rhabout.tcl
index 4d73faa44dd..cd594867293 100644
--- a/gdb/gdbtk/library/plugins/rhabout.tcl
+++ b/gdb/gdbtk/library/plugins/rhabout.tcl
@@ -1,3 +1,4 @@
package provide RHABOUT 1.0
set dirname [file dirname [info script]]
lappend auto_path [file join $dirname rhabout]
+catch {load [file join $dirname rhabout rhabout.so]}
diff --git a/gdb/gdbtk/library/plugins/rhabout/Makefile b/gdb/gdbtk/library/plugins/rhabout/Makefile
new file mode 100644
index 00000000000..4feced47561
--- /dev/null
+++ b/gdb/gdbtk/library/plugins/rhabout/Makefile
@@ -0,0 +1,9 @@
+TCL_CFLAGS = -I/home/fnasser/DEVO/insight-sourceware/src/tcl/generic
+TCL = -L/home/fnasser/BUILD/insight-sourceware/native/tcl/unix -ltcl8.0
+
+PRE=
+POS= ".so"
+
+rhabout: rhabout.c
+ gcc -fPIC $(TCL_CFLAGS) -I. -o rhabout.o -c rhabout.c
+ gcc -shared -o rhabout$(POS) rhabout.o $(TCL)
diff --git a/gdb/gdbtk/library/plugins/rhabout/rhabout.c b/gdb/gdbtk/library/plugins/rhabout/rhabout.c
new file mode 100644
index 00000000000..3f9030ef48f
--- /dev/null
+++ b/gdb/gdbtk/library/plugins/rhabout/rhabout.c
@@ -0,0 +1,34 @@
+/* Sample command procedure library for a plug-in. */
+
+/* You have to include the Tcl headers, of course. */
+#include <tcl.h>
+
+/* Define the functions that implement your commands as required by Tcl */
+
+int extra_text (ClientData clientData,
+ Tcl_Interp *interp,
+ int argc, char *argv[]);
+
+/* Here you actually do whatever you want, like calling your target
+ libraries etc. Here we just return a string. */
+
+int
+extra_text (ClientData clientData,
+ Tcl_Interp *interp,
+ int argc, char *argv[])
+{
+ interp->result = "\nThis is a sample plug-in\n";
+ return TCL_OK;
+}
+
+/* Initialization function required in Tcl libraries. */
+
+int
+Rhabout_Init (Tcl_Interp *interp)
+{
+ /* Register your command as a Tcl command with this interpreter. */
+ Tcl_CreateCommand (interp, "rhabout_extra_text", extra_text,
+ (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
+
+ return TCL_OK;
+}
diff --git a/gdb/gdbtk/library/plugins/rhabout/rhabout.itcl b/gdb/gdbtk/library/plugins/rhabout/rhabout.itcl
index fd22e510e51..96e9adce341 100644
--- a/gdb/gdbtk/library/plugins/rhabout/rhabout.itcl
+++ b/gdb/gdbtk/library/plugins/rhabout/rhabout.itcl
@@ -5,7 +5,14 @@ class RHAbout {
set f [frame $itk_interior.f]
label $f.image1 -bg white -image \
[image create photo -file [file join $gdb_ImageDir insight.gif]]
- message $f.m -bg white -fg black -text [gdb_cmd {show version}] -aspect 500 -relief flat
+
+ # Here we call an interface function provided by GDBTCL
+ set text [gdb_cmd {show version}]
+
+ # Here we call a command procedure that we created, if it exists
+ catch {append text [rhabout_extra_text]}
+
+ message $f.m -bg white -fg black -text $text -aspect 500 -relief flat
pack $f.image1 $f.m $itk_interior.f -fill both -expand yes
pack $itk_interior
bind $f.image1 <1> [code $this unpost]