1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-01 20:30:28 +02:00

gdb: Support builds with SCM_DEBUG_TYPING_STRICTNESS=2.

* libguile/libguile-2.0-gdb.scm (scm-value->integer): New procedure.
  (%scm-pretty-printer): Use it instead of 'value->integer'.
This commit is contained in:
Ludovic Courtès 2015-06-02 21:08:03 +02:00
parent 2a4d21b5fa
commit 6bfd298c56

View file

@ -48,6 +48,18 @@ if the information is not available."
(name (value-field type-descr "name")))
(value->string name)))))
(define (scm-value->integer value)
"Return the integer value of VALUE, which is assumed to be a GDB value
corresponding to an 'SCM' object."
(let ((type (type-strip-typedefs (value-type value))))
(cond ((= (type-code type) TYPE_CODE_UNION)
;; SCM_DEBUG_TYPING_STRICTNESS = 2
(value->integer (value-field (value-field value "n")
"n")))
(else
;; SCM_DEBUG_TYPING_STRICTNESS = 1
(value->integer value)))))
(define %gdb-memory-backend
;; The GDB back-end to access the inferior's memory.
(let ((void* (type-pointer (lookup-type "void"))))
@ -130,7 +142,7 @@ if the information is not available."
(let ((name (type-name (value-type value))))
(and (and name (string=? name "SCM"))
(make-scm-pretty-printer-worker
(scm->object (value->integer value) %gdb-memory-backend)))))))
(scm->object (scm-value->integer value) %gdb-memory-backend)))))))
(define* (register-pretty-printer #:optional objfile)
(prepend-pretty-printer! objfile %scm-pretty-printer))