[v8windbg] Fix jsstack command to skip unavailable fields

Change-Id: I5682c2b1ac80e0f8cbdff5f841e61f08a99ca6bc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3022316
Reviewed-by: Seth Brenith <seth.brenith@microsoft.com>
Commit-Queue: Z Nguyen-Huu <duongn@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#75713}
This commit is contained in:
Z Nguyen-Huu 2021-07-12 15:48:11 -07:00 committed by V8 LUCI CQ
parent 374354bfe4
commit f50e72a5ac

View File

@ -94,22 +94,32 @@ HRESULT StackFrameIterator::PopulateFrameData() {
nullptr);
if (FAILED(hr)) continue;
// At this point, it is safe to add frame entry even though some fields
// might not be available.
WRL::ComPtr<IModelObject> sp_function_name, sp_script_name,
sp_script_source, sp_function_character_offset;
RETURN_IF_FAIL(sp_local_variables->GetKeyValue(L"script_name",
&sp_script_name, nullptr));
RETURN_IF_FAIL(sp_local_variables->GetKeyValue(L"script_source",
&sp_script_source, nullptr));
RETURN_IF_FAIL(sp_local_variables->GetKeyValue(L"function_name",
&sp_function_name, nullptr));
RETURN_IF_FAIL(sp_local_variables->GetKeyValue(
L"function_character_offset", &sp_function_character_offset, nullptr));
FrameData frame_entry;
frame_entry.script_name = sp_script_name;
frame_entry.script_source = sp_script_source;
frame_entry.function_name = sp_function_name;
frame_entry.function_character_offset = sp_function_character_offset;
hr = sp_local_variables->GetKeyValue(L"script_name", &sp_script_name,
nullptr);
if (SUCCEEDED(hr)) {
frame_entry.script_name = sp_script_name;
}
hr = sp_local_variables->GetKeyValue(L"script_source", &sp_script_source,
nullptr);
if (SUCCEEDED(hr)) {
frame_entry.script_source = sp_script_source;
}
hr = sp_local_variables->GetKeyValue(L"function_name", &sp_function_name,
nullptr);
if (SUCCEEDED(hr)) {
frame_entry.function_name = sp_function_name;
}
hr = sp_local_variables->GetKeyValue(
L"function_character_offset", &sp_function_character_offset, nullptr);
if (SUCCEEDED(hr)) {
frame_entry.function_character_offset = sp_function_character_offset;
}
frames_.push_back(frame_entry);
}
@ -160,7 +170,8 @@ HRESULT StackFrameIterator::GetAt(uint64_t index, IModelObject** result) const {
RETURN_IF_FAIL(
sp_data_model_manager->CreateSyntheticObject(sp_ctx_.Get(), &sp_value));
RETURN_IF_FAIL(
sp_value->SetKey(L"script_name", curr_frame.script_name.Get(), nullptr));
sp_value->SetKey(L"script_name", curr_frame.script_name.Get(),
nullptr));
RETURN_IF_FAIL(sp_value->SetKey(L"script_source",
curr_frame.script_source.Get(), nullptr));
RETURN_IF_FAIL(sp_value->SetKey(L"function_name",