;; This hardcoded 2 matches the one in gc_find_freeish_pages. It's not
;; really worth genesifying.
#+gencgc
- (* 2 sb-vm:gencgc-page-size))
+ (* 2 sb-vm:gencgc-page-bytes))
(declaim (type number *alloc-region-size*))
(defvar *samples* nil)
(with-alien ((scp (* os-context-t) :local scp))
(let* ((pc-ptr (sb-vm:context-pc scp))
(fp (sb-vm::context-register scp #.sb-vm::ebp-offset)))
- ;; For some reason completely bogus small values for the
- ;; frame pointer are returned every now and then, leading
- ;; to segfaults. Try to avoid these cases.
- ;;
- ;; FIXME: Do a more thorough sanity check on ebp, or figure
- ;; out why this is happening.
- ;; -- JES, 2005-01-11
- (when (< fp 4096)
+ ;; foreign code might not have a useful frame
+ ;; pointer in ebp/rbp, so make sure it looks
+ ;; reasonable before walking the stack
+ (unless (sb-di::control-stack-pointer-valid-p (sb-sys:int-sap fp))
+ (record samples pc-ptr)
(return-from sigprof-handler nil))
(incf (samples-trace-count samples))
(pushnew self (samples-sampled-threads samples))