On 21 Mar 2019, at 11:06, Thomas Dupriez wrote:
Hi Thomas,
Hello,
While looking at the DebugSession>>isContextPostMortem: method (code
below), I got three questions:
1) There is a check for whether the suspendedContext (top context) of
the process is nil. Does it even make sense for a process not to have
any top context?
Yes, only suspended processes have a suspendedContext. Also, the process
might have been terminated already.
2) It seems that all the last 3 lines are doing is to check whether
selectedContext is in the context chain of the process. Could they be
rewritten into this simpler one-liner? `|^ (suspendedContext
hasContext: selectedContext) not`|
Yes, I think that would work.
3) Overall, this method says that a context C is "post mortem" if the
process controlled by the DebugSession has a top context and C is not
in its context chain. That's the practical definition. Could someone
shed some light on the high-level definition of "post mortem"? Because
"post mortem" is like "after death", but the death of what? A context
that merely belongs to another context chain would be considered "post
mortem" by the practical definition, but there's no death in this
case...
||
You can create a copy of a process' stack. That stack will behave like a
process in the debugger but it can't run, as the VM doesn't have a
process to which the context are attached, hence it's considered
post-mortem.
```
|DebugSession>>isContextPostMortem: selectedContext "return whether
we're inspecting a frozen exception without a process attached" |
suspendedContext | suspendedContext := interruptedProcess
suspendedContext. suspendedContext ifNil: [ ^ false ].
(suspendedContext == selectedContext) ifTrue: [ ^ false ]. ^
(suspendedContext findContextSuchThat: [:c | c sender ==
selectedContext]) isNil ``` |
Does someone know the answer to some (or all) of these questions?
Thomas
Hope that helps.
Max