stackgetter get recordname by GetRecordNameWithSymbol

issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I7KQG9

Signed-off-by: Chongwei Su <suchongwei@huawei.com>
This commit is contained in:
Chongwei Su 2023-07-12 20:58:11 +08:00
parent 11c5ad5924
commit fe86bbf709
3 changed files with 16 additions and 3 deletions

View File

@ -81,9 +81,9 @@ bool JsStackGetter::ParseMethodInfo(struct MethodKey &methodKey,
return false;
}
// record name
CString recordNameStr = MethodLiteral::GetRecordName(jsPandaFile, methodId);
if (!recordNameStr.empty()) {
if (!CheckAndCopy(codeEntry.recordName, sizeof(codeEntry.recordName), recordNameStr.c_str())) {
const char *recordName = MethodLiteral::GetRecordNameWithSymbol(jsPandaFile, methodId);
if (strlen(recordName) != 0) {
if (!CheckAndCopy(codeEntry.recordName, sizeof(codeEntry.recordName), recordName)) {
return false;
}
}

View File

@ -121,6 +121,18 @@ CString MethodLiteral::GetRecordName(const JSPandaFile *jsPandaFile, EntityId me
return JSPandaFile::ParseEntryPoint(desc);
}
const char *MethodLiteral::GetRecordNameWithSymbol(const JSPandaFile *jsPandaFile, EntityId methodId)
{
if (jsPandaFile == nullptr) {
return "";
}
const panda_file::File *pf = jsPandaFile->GetPandaFile();
panda_file::MethodDataAccessor mda(*pf, methodId);
panda_file::ClassDataAccessor cda(*pf, mda.GetClassId());
return utf::Mutf8AsCString(cda.GetDescriptor());
}
uint32_t MethodLiteral::GetCodeSize(const JSPandaFile *jsPandaFile, EntityId methodId)
{
if (jsPandaFile == nullptr) {

View File

@ -297,6 +297,7 @@ public:
static std::string PUBLIC_API ParseFunctionName(const JSPandaFile *jsPandaFile, EntityId methodId);
static uint32_t GetCodeSize(const JSPandaFile *jsPandaFile, EntityId methodId);
static CString GetRecordName(const JSPandaFile *jsPandaFile, EntityId methodId);
static const char PUBLIC_API *GetRecordNameWithSymbol(const JSPandaFile *jsPandaFile, EntityId methodId);
const uint8_t *GetBytecodeArray() const
{