Fix DAP stackTrace through frames without debuginfo

The DAP stackTrace implementation did not fully account for frames
without debuginfo.  Attemping this would yield a result like:

{"request_seq": 5, "type": "response", "command": "stackTrace", "success": false, "message": "'NoneType' object has no attribute 'filename'", "seq": 11}

This patch fixes the problem by adding another check for None.
This commit is contained in:
Tom Tromey
2023-02-14 09:25:55 -07:00
parent c52e4861c6
commit 68ca7890dd
4 changed files with 101 additions and 1 deletions

View File

@ -69,7 +69,7 @@ def _backtrace(thread_id, levels, startFrame):
"instructionPointerReference": hex(current_frame.pc()),
}
sal = _safe_sal(current_frame)
if sal is not None:
if sal is not None and sal.symtab is not None:
newframe["source"] = {
"name": os.path.basename(sal.symtab.filename),
"path": sal.symtab.filename,