summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-03-14 18:21:07 +0100
committerLudovic Courtès <ludo@gnu.org>2020-03-17 22:57:41 +0100
commit40f9a44c1b8c24c46488bcf1474d70125c0aee8f (patch)
tree9f3fa2305edbcb90f4062a1f379037c591ed32ce
parent77f9c49eaf7aa85b4fc75c414d9da72e4b58f3ca (diff)
downloadguile-40f9a44c1b8c24c46488bcf1474d70125c0aee8f.tar.gz
gdb: Delay type lookups.
This avoids errors while loading the file when types are not in scope. * libguile/libguile-3.0-gdb.scm (%gdb-memory-backend)[void*]: Turn into a promise and adjust user accordingly. (ip-type, fp-type, sp-type, uint-type): Remove. (vm-frame)[ip-type, uint-type]: New variables.
-rw-r--r--libguile/libguile-3.0-gdb.scm17
1 files changed, 9 insertions, 8 deletions
diff --git a/libguile/libguile-3.0-gdb.scm b/libguile/libguile-3.0-gdb.scm
index e0b573a20..9989c9f55 100644
--- a/libguile/libguile-3.0-gdb.scm
+++ b/libguile/libguile-3.0-gdb.scm
@@ -1,6 +1,6 @@
;;; GDB debugging support for Guile.
;;;
-;;; Copyright 2014, 2015, 2017 Free Software Foundation, Inc.
+;;; Copyright 2014, 2015, 2017, 2020 Free Software Foundation, Inc.
;;;
;;; This program is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
@@ -70,12 +70,15 @@ if the information is not available."
(define %gdb-memory-backend
;; The GDB back-end to access the inferior's memory.
- (let ((void* (type-pointer (lookup-type "void"))))
+
+ ;; When run through 'rr replay', even the 'void' type is initially
+ ;; unavailable. Thus, delay lookup until it's actually needed.
+ (let ((void* (delay (type-pointer (lookup-type "void")))))
(define (dereference-word address)
;; Return the word at ADDRESS.
(value->integer
(value-dereference (value-cast (make-value address)
- (type-pointer void*)))))
+ (type-pointer (force void*))))))
(define (open address size)
;; Return a port to the SIZE bytes starting at ADDRESS.
@@ -167,11 +170,6 @@ if the information is not available."
;;; VM stack walking.
;;;
-(define ip-type (type-pointer (lookup-type "scm_t_uint32")))
-(define fp-type (type-pointer (lookup-type "SCM")))
-(define sp-type (type-pointer (lookup-type "SCM")))
-(define uint-type (type-pointer (lookup-type "scm_t_uintptr")))
-
(define-record-type <vm-frame>
(make-vm-frame ip sp fp saved-ip saved-fp)
vm-frame?
@@ -184,6 +182,9 @@ if the information is not available."
;; See libguile/frames.h.
(define* (vm-frame ip sp fp #:optional (backend %gdb-memory-backend))
"Return the components of the stack frame at FP."
+ (define ip-type (type-pointer (lookup-type "scm_t_uint32")))
+ (define uint-type (type-pointer (lookup-type "scm_t_uintptr")))
+
(make-vm-frame ip
sp
fp