Revert pr 682

Issue:   #IAI0Q4
This reverts commit 6bb8d59770.
Signed-off-by: yang-19970325 <yangyang585@huawei.com>
This commit is contained in:
yang-19970325 2024-08-05 22:45:42 +08:00
parent 4194b8a047
commit ff9e36d642
4 changed files with 11 additions and 28 deletions

View File

@ -124,10 +124,6 @@ bool DebuggerImpl::NotifyScriptParsed(ScriptId scriptId, const std::string &file
// Store parsed script in map
scripts_[script->GetScriptId()] = std::move(script);
// Store parsed file url, used by hook to determine
// whether a Break_on_start pause is needed
parsedFileNames_.emplace(url);
return true;
}
@ -404,7 +400,8 @@ void DebuggerImpl::InitializeExtendedProtocolsList()
"setNativeRange",
"resetSingleStepper",
"callFunctionOn",
"smartStepInto"
"smartStepInto",
"callFunctionOn"
};
debuggerExtendedProtocols_ = std::move(debuggerProtocolList);
}

View File

@ -273,16 +273,6 @@ private:
return recordName;
}
void RemoveUrlFromParsedSet(std::string &url)
{
parsedFileNames_.erase(url);
}
bool IsUrlFoundInParsedSet(std::string &url)
{
return parsedFileNames_.find(url) != parsedFileNames_.end();
}
class Frontend {
public:
explicit Frontend(ProtocolChannel *channel) : channel_(channel) {}
@ -334,7 +324,6 @@ private:
JsDebuggerManager::SingleStepperFunc stepperFunc_ {nullptr};
JsDebuggerManager::ReturnNativeFunc returnNative_ {nullptr};
std::vector<std::string> debuggerExtendedProtocols_ {};
CUnorderedSet<std::string> parsedFileNames_ {};
friend class JSPtHooks;
friend class test::TestHooks;

View File

@ -16,7 +16,6 @@
#include "backend/js_pt_hooks.h"
#include "agent/debugger_impl.h"
#include "ecmascript/jspandafile/js_pandafile_manager.h"
namespace panda::ecmascript::tooling {
void JSPtHooks::DebuggerStmt([[maybe_unused]] const JSPtLocation &location)
@ -48,16 +47,13 @@ bool JSPtHooks::SingleStep(const JSPtLocation &location)
LOG_DEBUGGER(VERBOSE) << "JSPtHooks: SingleStep => " << location.GetBytecodeOffset();
[[maybe_unused]] LocalScope scope(debugger_->vm_);
if (!debugger_->parsedFileNames_.empty()) {
auto jsPandaFile = location.GetJsPandaFile();
DebugInfoExtractor *extractor = JSPandaFileManager::GetInstance()->GetJSPtExtractor(jsPandaFile);
std::string url = extractor->GetSourceFile(location.GetMethodId());
if (debugger_->IsUrlFoundInParsedSet(url)) {
debugger_->RemoveUrlFromParsedSet(url);
if (UNLIKELY(firstTime_)) {
firstTime_ = false;
debugger_->NotifyPaused({}, BREAK_ON_START);
return false;
}
}
// pause or step complete
if (debugger_->NotifySingleStep(location)) {
debugger_->NotifyPaused({}, OTHER);
@ -88,8 +84,8 @@ void JSPtHooks::LoadModule(std::string_view pandaFileName, std::string_view entr
[[maybe_unused]] LocalScope scope(debugger_->vm_);
static uint32_t scriptId = 0;
if (!debugger_->NotifyScriptParsed(scriptId++, pandaFileName.data(), entryPoint)) {
LOG_DEBUGGER(DEBUG) << "JSPtHooks: LoadModule: " << pandaFileName << " NotifyParsed fail";
if (debugger_->NotifyScriptParsed(scriptId++, pandaFileName.data(), entryPoint)) {
firstTime_ = true;
}
}

View File

@ -46,6 +46,7 @@ private:
NO_MOVE_SEMANTIC(JSPtHooks);
DebuggerImpl *debugger_ {nullptr};
bool firstTime_ {true};
};
} // namespace panda::ecmascript::tooling
#endif // ECMASCRIPT_TOOLING_BACKEND_JS_PT_HOOKS_H