Author Topic: backtrace function (vl-bt)  (Read 1506 times)

0 Members and 1 Guest are viewing this topic.

Grrr1337

  • Swamp Rat
  • Posts: 812
backtrace function (vl-bt)
« on: February 22, 2017, 03:44:50 PM »
Hi swampers,
Can anyone shed some light about what the results from the backtrace function mean?
I did 2 simple experiments:
Code - Auto/Visual Lisp: [Select]
  1. (defun C:test ( / *error* e enx o )
  2.   (defun *error* ( m ) (if m (vl-bt)) (princ) )
  3.   (setq e (car (entsel)))
  4.   (setq o (vlax-ename->vla-object e))
  5.   (setq enx (entget e))
  6.   (princ)
  7. )
  8.  
  9. (defun C:test2 ( / *error* )
  10.   (defun *error* ( m ) (if m (vl-bt)) (princ))
  11.   (princ)
  12. )

So the first result is (after not picking an entity on purpose):
Code: [Select]
; Command: test
; Select object: Backtrace:
; [0.49] (VL-BT)
; [1.45] (*ERROR* "bad argument type: lentityp nil") LAP+16
; [2.39] (_call-err-hook #<USUBR @000000876da154f8 *ERROR*> "bad argument type: lentityp nil")
; [3.33] (sys-error "bad argument type: lentityp nil")
; :ERROR-BREAK.28 "bad argument type: lentityp nil"
; [4.25] (vlax-ename->vla-object nil)
; [5.20] (C:TEST) LAP+56
; [6.15] (#<SUBR @000000876da15570 -rts_top->)
; [7.12] (#<SUBR @000000876b4a8700 veval-str-body> "(C:TEST)" T #<FILE internal>)
; :CALLBACK-ENTRY.6 (:CALLBACK-ENTRY)
; :ARQ-SUBR-CALLBACK.3 (nil 0)

From the second function the result is (trying to obtain an unexisting layer):
Code: [Select]
; Command: TEST2
; Backtrace:
; [0.64] (VL-BT)
; [1.60] (*ERROR* "Automation Error. Key not found") LAP+16
; [2.54] (_call-err-hook #<USUBR @000000876da155c0 *ERROR*> "Automation Error. Key not found")
; [3.48] (sys-error "Automation Error. Key not found")
; :ERROR-BREAK.43 "Automation Error. Key not found"
; [4.40] (intelligent-invoke #<VLA-OBJECT IAcadLayers 0000008f6e9ef528> "Item" 1 "Unexisting Layer")
; [5.32] (#<SUBR @000000876b5cb980 vlax-invoke-method> #<VLA-OBJECT IAcadLayers 0000008f6e9ef528> "Item" "Unexisting Layer")
; [6.26] (vla-Item #<VLA-OBJECT IAcadLayers 0000008f6e9ef528> "Unexisting Layer")
; [7.20] (C:TEST2) LAP+56
; [8.15] (#<SUBR @000000876da15660 -rts_top->)
; [9.12] (#<SUBR @000000876b4a8700 veval-str-body> "(C:TEST2)" T #<FILE internal>)
; :CALLBACK-ENTRY.6 (:CALLBACK-ENTRY)
; :ARQ-SUBR-CALLBACK.3 (nil 0)

Where from the first result only these provide some valid information for me (whats the error message and on what evaluation it did occur) :
Code: [Select]
; [1.45] (*ERROR* "bad argument type: lentityp nil")
; [4.25] (vlax-ename->vla-object nil)
And for the second:
Code: [Select]
; [1.60] (*ERROR* "Automation Error. Key not found")
; [4.40] (intelligent-invoke #<VLA-OBJECT IAcadLayers 0000008f6e9ef528> "Item" 1 "Unexisting Layer")


But what do the rest of the stuff mean?
And for what are the [#.##] digits prefix?
(vl-bt) is new for me, so I did not really tested it in a long code (but I'm guessing it could help to determine where and why the error occured - and somehow substitute the VLIDE's break on error functionality).  :thinking:
(apply ''((a b c)(a b c))
  '(
    (( f L ) (apply 'strcat (f L)))
    (( L ) (if L (cons (chr (car L)) (f (cdr L)))))
    (72 101 108 108 111 32 87 111 114 108 100)
  )
)
vevo.bg