aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Evans <xdje42@gmail.com>2014-07-26 18:16:27 -0700
committerDoug Evans <xdje42@gmail.com>2014-07-26 18:16:27 -0700
commite76c5d173bbf7137555919dd136004a7c0118af7 (patch)
tree92e8106c379879427bb0ce570c3d0dece75dc020 /gdb/guile/lib
parentPR guile/17146 preparatory work. (diff)
downloadbinutils-gdb-e76c5d173bbf7137555919dd136004a7c0118af7.tar.gz
binutils-gdb-e76c5d173bbf7137555919dd136004a7c0118af7.tar.bz2
binutils-gdb-e76c5d173bbf7137555919dd136004a7c0118af7.zip
PR guile/17146
* acinclude.m4 (GDB_GUILE_PROGRAM_NAMES): New macro. (GDB_GUILD_TARGET_FLAG, GDB_TRY_GUILD): New macros. * configure.ac: Try to use guild to compile an scm file, if it fails then disable guile support. * configure: Regenerate. * data-directory/Makefile.in (GUILE_SOURCE_FILES): Renamed from GUILE_FILE_LIST. (GUILE_COMPILED_FILES): New variable. (GUILE_FILES) Update. (GUILD, GUILD_TARGET_FLAG, GUILD_COMPILE_FLAGS): New variables. (stamp-guile): Compile scm files. * guile/guile.c (boot_guile_support): New function. (standard_throw_args_p): New function. (print_standard_throw_error, print_throw_error): New functions. (handle_boot_error): New function. (initialize_scheme_side): Rewrite to call boot_guile_support. * guile/lib/gdb/boot.scm: Update %load-compiled-path. Load gdb.go. * guile/lib/gdb/init.scm (%silence-compiler-warnings%): New function.
Diffstat (limited to 'gdb/guile/lib')
-rw-r--r--gdb/guile/lib/gdb/boot.scm17
-rw-r--r--gdb/guile/lib/gdb/init.scm6
2 files changed, 20 insertions, 3 deletions
diff --git a/gdb/guile/lib/gdb/boot.scm b/gdb/guile/lib/gdb/boot.scm
index 6159354d209..9463f101638 100644
--- a/gdb/guile/lib/gdb/boot.scm
+++ b/gdb/guile/lib/gdb/boot.scm
@@ -21,9 +21,20 @@
;; loaded with it are not compiled. So we do very little here, and do
;; most of the initialization elsewhere.
-;; guile-data-directory is provided by the C code.
-(add-to-load-path (guile-data-directory))
-(load-from-path "gdb.scm")
+;; Initialize the source and compiled file search paths.
+;; Note: 'guile-data-directory' is provided by the C code.
+(let ((module-dir (guile-data-directory)))
+ (set! %load-path (cons module-dir %load-path))
+ (set! %load-compiled-path (cons module-dir %load-compiled-path)))
+
+;; Load the (gdb) module. This needs to be done here because C code relies on
+;; the availability of Scheme bindings such as '%print-exception-with-stack'.
+;; Note: as of Guile 2.0.11, 'primitive-load' evaluates the code and 'load'
+;; somehow ignores the '.go', hence 'load-compiled'.
+(let ((gdb-go-file (search-path %load-compiled-path "gdb.go")))
+ (if gdb-go-file
+ (load-compiled gdb-go-file)
+ (error "Unable to find gdb.go file.")))
;; Now that the Scheme side support is loaded, initialize it.
(let ((init-proc (@@ (gdb) %initialize!)))
diff --git a/gdb/guile/lib/gdb/init.scm b/gdb/guile/lib/gdb/init.scm
index 98888ed3ac9..53cce2eddba 100644
--- a/gdb/guile/lib/gdb/init.scm
+++ b/gdb/guile/lib/gdb/init.scm
@@ -147,6 +147,12 @@
(set! %orig-input-port (set-current-input-port (input-port)))
(set! %orig-output-port (set-current-output-port (output-port)))
(set! %orig-error-port (set-current-error-port (error-port))))
+
+;; Dummy routine to silence "possibly unused local top-level variable"
+;; warnings from the compiler.
+
+(define-public (%silence-compiler-warnings%)
+ (list %print-exception-with-stack %initialize!))
;; Public routines.