mirror of
https://gitee.com/openharmony/arkcompiler_runtime_core
synced 2024-11-27 00:41:14 +00:00
!2669 Fix the line number of debuginfo in release
Merge pull request !2669 from ElevenDuan/fix_line
This commit is contained in:
commit
327699dd82
@ -62,9 +62,9 @@ _GLOBAL_1584 { 10 [ tag_value:5, string:"NestedLiteralArray", tag_value:6, metho
|
||||
nop # line: 18446744073709551615 # column: 0
|
||||
asyncfunctionenter # line: 18446744073709551615 # column: 0
|
||||
sta v0 # line: 18446744073709551615 # column: 0
|
||||
label@3: ldundefined # line: 86 # column: 0
|
||||
label@3: ldundefined # line: 18446744073709551615 # column: 0
|
||||
asyncfunctionresolve v0 # line: 18446744073709551615 # column: 0
|
||||
return # line: 18446744073709551615 # column: 0
|
||||
return # line: 86 # column: 0
|
||||
label@6: sta v1 # line: 86 # column: 0
|
||||
lda v1 # line: 86 # column: 0
|
||||
asyncfunctionreject v0 # line: 86 # column: 0
|
||||
@ -85,13 +85,13 @@ _GLOBAL_1584 { 10 [ tag_value:5, string:"NestedLiteralArray", tag_value:6, metho
|
||||
sta v0 # line: 18446744073709551615 # column: 0
|
||||
label@3: ldai 0x1 # line: 18446744073709551615 # column: 0
|
||||
sta v2 # line: 18446744073709551615 # column: 0
|
||||
ldundefined # line: 83 # column: 0
|
||||
ldundefined # line: 18446744073709551615 # column: 0
|
||||
suspendgenerator v0 # line: 18446744073709551615 # column: 0
|
||||
lda v0 # line: 18446744073709551615 # column: 0
|
||||
resumegenerator # line: 18446744073709551615 # column: 0
|
||||
lda v0 # line: 18446744073709551615 # column: 0
|
||||
getresumemode # line: 18446744073709551615 # column: 0
|
||||
lda.str hello # line: 18446744073709551615 # column: 0
|
||||
lda.str hello # line: 83 # column: 0
|
||||
asyncfunctionawaituncaught v0 # line: 83 # column: 0
|
||||
suspendgenerator v0 # line: 83 # column: 0
|
||||
lda v0 # line: 83 # column: 0
|
||||
@ -138,26 +138,26 @@ _GLOBAL_1584 { 10 [ tag_value:5, string:"NestedLiteralArray", tag_value:6, metho
|
||||
lda v0 # line: 83 # column: 0
|
||||
setgeneratorstate 0x4 # line: 83 # column: 0
|
||||
asyncgeneratorresolve v0, v3, v2 # line: 83 # column: 0
|
||||
return # line: 83 # column: 0
|
||||
return # line: 84 # column: 0
|
||||
label@59: lda v2 # line: 83 # column: 0
|
||||
eq 0x3, v4 # line: 83 # column: 0
|
||||
jeqz label@64 # line: 84 # column: 0
|
||||
jeqz label@64 # line: 83 # column: 0
|
||||
lda v3 # line: 83 # column: 0
|
||||
throw # line: 83 # column: 0
|
||||
label@64: ldundefined # line: 83 # column: 0
|
||||
sta v2 # line: 83 # column: 0
|
||||
ldtrue # line: 83 # column: 0
|
||||
sta v3 # line: 83 # column: 0
|
||||
label@64: ldundefined # line: 18446744073709551615 # column: 0
|
||||
sta v2 # line: 18446744073709551615 # column: 0
|
||||
ldtrue # line: 18446744073709551615 # column: 0
|
||||
sta v3 # line: 18446744073709551615 # column: 0
|
||||
lda v0 # line: 18446744073709551615 # column: 0
|
||||
setgeneratorstate 0x4 # line: 18446744073709551615 # column: 0
|
||||
asyncgeneratorresolve v0, v2, v3 # line: 18446744073709551615 # column: 0
|
||||
return # line: 18446744073709551615 # column: 0
|
||||
label@72: sta v1 # line: 18446744073709551615 # column: 0
|
||||
lda v0 # line: 18446744073709551615 # column: 0
|
||||
setgeneratorstate 0x4 # line: 18446744073709551615 # column: 0
|
||||
lda v1 # line: 84 # column: 0
|
||||
asyncgeneratorreject v0 # line: 84 # column: 0
|
||||
return # line: 83 # column: 0
|
||||
return # line: 84 # column: 0
|
||||
label@72: sta v1 # line: 82 # column: 0
|
||||
lda v0 # line: 82 # column: 0
|
||||
setgeneratorstate 0x4 # line: 82 # column: 0
|
||||
lda v1 # line: 82 # column: 0
|
||||
asyncgeneratorreject v0 # line: 82 # column: 0
|
||||
return # line: 84 # column: 0
|
||||
.catchall :
|
||||
try_begin_label : label@3
|
||||
try_end_label : label@72
|
||||
@ -175,73 +175,73 @@ _GLOBAL_1584 { 10 [ tag_value:5, string:"NestedLiteralArray", tag_value:6, metho
|
||||
label@3: ldai 0xb # line: 40 # column: 0
|
||||
mov v3, v0 # line: 40 # column: 0
|
||||
mov v1, v0 # line: 40 # column: 0
|
||||
trystglobalbyname 0x0, varA # line: 40 # column: 0
|
||||
ldai 0x16 # line: 40 # column: 0
|
||||
trystglobalbyname 0x1, x # line: 41 # column: 0
|
||||
label@9: ldai 0x1 # line: 41 # column: 0
|
||||
trystglobalbyname 0x2, varA # line: 42 # column: 0
|
||||
label@11: jmp label@20 # line: 42 # column: 0
|
||||
label@12: lda.str inner catch # line: 44 # column: 0
|
||||
trystglobalbyname 0x3, msg # line: 42 # column: 0
|
||||
tryldglobalbyname 0x4, print # line: 43 # column: 0
|
||||
sta v4 # line: 43 # column: 0
|
||||
tryldglobalbyname 0x5, msg # line: 45 # column: 0
|
||||
sta v5 # line: 45 # column: 0
|
||||
trystglobalbyname 0x0, varA # line: 41 # column: 0
|
||||
ldai 0x16 # line: 41 # column: 0
|
||||
trystglobalbyname 0x1, x # line: 42 # column: 0
|
||||
label@9: ldai 0x1 # line: 42 # column: 0
|
||||
trystglobalbyname 0x2, varA # line: 44 # column: 0
|
||||
label@11: jmp label@20 # line: 44 # column: 0
|
||||
label@12: lda.str inner catch # line: 46 # column: 0
|
||||
trystglobalbyname 0x3, msg # line: 46 # column: 0
|
||||
tryldglobalbyname 0x4, print # line: 47 # column: 0
|
||||
sta v4 # line: 47 # column: 0
|
||||
tryldglobalbyname 0x5, msg # line: 47 # column: 0
|
||||
sta v5 # line: 47 # column: 0
|
||||
lda v4 # line: 47 # column: 0
|
||||
callarg1 0x6, v5 # line: 47 # column: 0
|
||||
label@20: mov v3, v0 # line: 47 # column: 0
|
||||
mov v1, v0 # line: 47 # column: 0
|
||||
tryldglobalbyname 0x8, varA # line: 47 # column: 0
|
||||
sta v0 # line: 47 # column: 0
|
||||
lda.str # line: 47 # column: 0
|
||||
stricteq 0x9, v0 # line: 47 # column: 0
|
||||
jeqz label@29 # line: 47 # column: 0
|
||||
lda.str null # line: 42 # column: 0
|
||||
throw # line: 49 # column: 0
|
||||
label@29: tryldglobalbyname 0xa, x # line: 49 # column: 0
|
||||
tryldglobalbyname 0x8, varA # line: 49 # column: 0
|
||||
sta v0 # line: 49 # column: 0
|
||||
ldai 0x64 # line: 49 # column: 0
|
||||
greater 0xb, v0 # line: 49 # column: 0
|
||||
jeqz label@36 # line: 50 # column: 0
|
||||
lda.str max # line: 50 # column: 0
|
||||
throw # line: 42 # column: 0
|
||||
label@36: lda.str min # line: 52 # column: 0
|
||||
throw # line: 52 # column: 0
|
||||
label@38: mov v1, v3 # line: 52 # column: 0
|
||||
lda.str outter catch # line: 53 # column: 0
|
||||
trystglobalbyname 0xc, masg # line: 53 # column: 0
|
||||
tryldglobalbyname 0xd, print # line: 53 # column: 0
|
||||
sta v0 # line: 53 # column: 0
|
||||
tryldglobalbyname 0xe, msg # line: 55 # column: 0
|
||||
sta v4 # line: 55 # column: 0
|
||||
lda v0 # line: 40 # column: 0
|
||||
callarg1 0xf, v4 # line: 40 # column: 0
|
||||
lda.str # line: 49 # column: 0
|
||||
stricteq 0x9, v0 # line: 49 # column: 0
|
||||
jeqz label@29 # line: 49 # column: 0
|
||||
lda.str null # line: 50 # column: 0
|
||||
throw # line: 50 # column: 0
|
||||
label@29: tryldglobalbyname 0xa, x # line: 52 # column: 0
|
||||
sta v0 # line: 52 # column: 0
|
||||
ldai 0x64 # line: 52 # column: 0
|
||||
greater 0xb, v0 # line: 52 # column: 0
|
||||
jeqz label@36 # line: 52 # column: 0
|
||||
lda.str max # line: 53 # column: 0
|
||||
throw # line: 53 # column: 0
|
||||
label@36: lda.str min # line: 55 # column: 0
|
||||
throw # line: 55 # column: 0
|
||||
label@38: mov v1, v3 # line: 55 # column: 0
|
||||
lda.str outter catch # line: 59 # column: 0
|
||||
trystglobalbyname 0xc, masg # line: 59 # column: 0
|
||||
tryldglobalbyname 0xd, print # line: 60 # column: 0
|
||||
sta v0 # line: 60 # column: 0
|
||||
tryldglobalbyname 0xe, msg # line: 60 # column: 0
|
||||
sta v4 # line: 60 # column: 0
|
||||
lda v0 # line: 60 # column: 0
|
||||
callarg1 0xf, v4 # line: 60 # column: 0
|
||||
label@47: ldhole # line: 40 # column: 0
|
||||
sta v0 # line: 40 # column: 0
|
||||
mov v1, v3 # line: 40 # column: 0
|
||||
mov v2, v0 # line: 40 # column: 0
|
||||
jmp label@53 # line: 40 # column: 0
|
||||
label@52: sta v2 # line: 59 # column: 0
|
||||
label@53: ldundefined # line: 60 # column: 0
|
||||
eq 0x11, v1 # line: 60 # column: 0
|
||||
jeqz label@64 # line: 60 # column: 0
|
||||
lda.str error # line: 60 # column: 0
|
||||
trystglobalbyname 0x12, msg # line: 40 # column: 0
|
||||
tryldglobalbyname 0x13, print # line: 40 # column: 0
|
||||
sta v0 # line: 40 # column: 0
|
||||
tryldglobalbyname 0x14, msg # line: 40 # column: 0
|
||||
sta v1 # line: 40 # column: 0
|
||||
lda v0 # line: 40 # column: 0
|
||||
callarg1 0x15, v1 # line: 40 # column: 0
|
||||
label@52: sta v2 # line: 40 # column: 0
|
||||
label@53: ldundefined # line: 40 # column: 0
|
||||
eq 0x11, v1 # line: 40 # column: 0
|
||||
jeqz label@64 # line: 40 # column: 0
|
||||
lda.str error # line: 63 # column: 0
|
||||
trystglobalbyname 0x12, msg # line: 63 # column: 0
|
||||
tryldglobalbyname 0x13, print # line: 64 # column: 0
|
||||
sta v0 # line: 64 # column: 0
|
||||
tryldglobalbyname 0x14, msg # line: 64 # column: 0
|
||||
sta v1 # line: 64 # column: 0
|
||||
lda v0 # line: 64 # column: 0
|
||||
callarg1 0x15, v1 # line: 64 # column: 0
|
||||
label@64: ldhole # line: 40 # column: 0
|
||||
sta v0 # line: 40 # column: 0
|
||||
lda v2 # line: 40 # column: 0
|
||||
noteq 0x17, v0 # line: 40 # column: 0
|
||||
jeqz label@71 # line: 40 # column: 0
|
||||
lda v2 # line: 63 # column: 0
|
||||
throw # line: 63 # column: 0
|
||||
label@71: ldundefined # line: 64 # column: 0
|
||||
returnundefined # line: 64 # column: 0
|
||||
lda v2 # line: 40 # column: 0
|
||||
throw # line: 40 # column: 0
|
||||
label@71: ldundefined # line: 18446744073709551615 # column: 0
|
||||
returnundefined # line: 66 # column: 0
|
||||
.catchall :
|
||||
try_begin_label : label@9
|
||||
try_end_label : label@11
|
||||
@ -288,8 +288,8 @@ _GLOBAL_1584 { 10 [ tag_value:5, string:"NestedLiteralArray", tag_value:6, metho
|
||||
jeqz label@25 # line: 18446744073709551615 # column: 0
|
||||
lda v3 # line: 18446744073709551615 # column: 0
|
||||
throw # line: 18446744073709551615 # column: 0
|
||||
label@25: lda.str hello # line: 18446744073709551615 # column: 0
|
||||
sta v3 # line: 18446744073709551615 # column: 0
|
||||
label@25: lda.str hello # line: 79 # column: 0
|
||||
sta v3 # line: 79 # column: 0
|
||||
ldfalse # line: 79 # column: 0
|
||||
sta v4 # line: 79 # column: 0
|
||||
createiterresultobj v3, v4 # line: 79 # column: 0
|
||||
@ -303,18 +303,18 @@ _GLOBAL_1584 { 10 [ tag_value:5, string:"NestedLiteralArray", tag_value:6, metho
|
||||
lda v1 # line: 79 # column: 0
|
||||
eq 0x2, v2 # line: 79 # column: 0
|
||||
jeqz label@42 # line: 79 # column: 0
|
||||
lda v3 # line: 79 # column: 0
|
||||
return # line: 79 # column: 0
|
||||
label@42: lda v5 # line: 80 # column: 0
|
||||
eq 0x3, v2 # line: 80 # column: 0
|
||||
lda v3 # line: 80 # column: 0
|
||||
return # line: 80 # column: 0
|
||||
label@42: lda v5 # line: 79 # column: 0
|
||||
eq 0x3, v2 # line: 79 # column: 0
|
||||
jeqz label@47 # line: 79 # column: 0
|
||||
lda v3 # line: 79 # column: 0
|
||||
throw # line: 79 # column: 0
|
||||
label@47: ldundefined # line: 79 # column: 0
|
||||
return # line: 79 # column: 0
|
||||
label@49: sta v0 # line: 79 # column: 0
|
||||
lda v0 # line: 79 # column: 0
|
||||
throw # line: 79 # column: 0
|
||||
label@47: ldundefined # line: 18446744073709551615 # column: 0
|
||||
return # line: 80 # column: 0
|
||||
label@49: sta v0 # line: 78 # column: 0
|
||||
lda v0 # line: 78 # column: 0
|
||||
throw # line: 78 # column: 0
|
||||
.catchall :
|
||||
try_begin_label : label@1
|
||||
try_end_label : label@49
|
||||
@ -336,7 +336,7 @@ _GLOBAL_1584 { 10 [ tag_value:5, string:"NestedLiteralArray", tag_value:6, metho
|
||||
.function any .#*#hoo(any a0, any a1, any a2) {
|
||||
fldai 1.230000e+00 # line: 71 # column: 0
|
||||
trystglobalbyname 0x0, varA # line: 71 # column: 0
|
||||
createobjectwithbuffer 0x1, _GLOBAL_1517 # line: 72 # column: 0
|
||||
createobjectwithbuffer 0x1, _GLOBAL_1518 # line: 72 # column: 0
|
||||
ldundefined # line: 18446744073709551615 # column: 0
|
||||
returnundefined # line: 73 # column: 0
|
||||
}
|
||||
@ -348,7 +348,7 @@ _GLOBAL_1584 { 10 [ tag_value:5, string:"NestedLiteralArray", tag_value:6, metho
|
||||
nop # line: 18446744073709551615 # column: 0
|
||||
createasyncgeneratorobj a0 # line: 18446744073709551615 # column: 0
|
||||
sta v0 # line: 18446744073709551615 # column: 0
|
||||
label@3: ldundefined # line: 72 # column: 0
|
||||
label@3: ldundefined # line: 18446744073709551615 # column: 0
|
||||
suspendgenerator v0 # line: 18446744073709551615 # column: 0
|
||||
lda v0 # line: 18446744073709551615 # column: 0
|
||||
resumegenerator # line: 18446744073709551615 # column: 0
|
||||
@ -361,7 +361,7 @@ _GLOBAL_1584 { 10 [ tag_value:5, string:"NestedLiteralArray", tag_value:6, metho
|
||||
lda v0 # line: 18446744073709551615 # column: 0
|
||||
setgeneratorstate 0x4 # line: 18446744073709551615 # column: 0
|
||||
asyncgeneratorresolve v0, v2, v3 # line: 18446744073709551615 # column: 0
|
||||
return # line: 18446744073709551615 # column: 0
|
||||
return # line: 72 # column: 0
|
||||
label@17: sta v1 # line: 72 # column: 0
|
||||
lda v0 # line: 72 # column: 0
|
||||
setgeneratorstate 0x4 # line: 72 # column: 0
|
||||
@ -419,10 +419,10 @@ _GLOBAL_1584 { 10 [ tag_value:5, string:"NestedLiteralArray", tag_value:6, metho
|
||||
lda v2 # line: 18446744073709551615 # column: 0
|
||||
throw # line: 18446744073709551615 # column: 0
|
||||
label@21: ldundefined # line: 18446744073709551615 # column: 0
|
||||
return # line: 18446744073709551615 # column: 0
|
||||
label@23: sta v0 # line: 18446744073709551615 # column: 0
|
||||
lda v0 # line: 18446744073709551615 # column: 0
|
||||
throw # line: 18446744073709551615 # column: 0
|
||||
return # line: 26 # column: 0
|
||||
label@23: sta v0 # line: 26 # column: 0
|
||||
lda v0 # line: 26 # column: 0
|
||||
throw # line: 26 # column: 0
|
||||
.catchall :
|
||||
try_begin_label : label@1
|
||||
try_end_label : label@23
|
||||
@ -470,15 +470,15 @@ _GLOBAL_1584 { 10 [ tag_value:5, string:"NestedLiteralArray", tag_value:6, metho
|
||||
stmodulevar 0x0 # line: 17 # column: 0
|
||||
ldhole # line: 21 # column: 0
|
||||
sta v3 # line: 21 # column: 0
|
||||
defineclasswithbuffer 0x5, .#~@0=#HelloWorld, _GLOBAL_1534, 0x0, v3 # line: 21 # column: 0
|
||||
defineclasswithbuffer 0x5, .#~@0=#HelloWorld, _GLOBAL_1535, 0x0, v3 # line: 21 # column: 0
|
||||
ldobjbyname 0x6, prototype # line: 21 # column: 0
|
||||
ldhole # line: 25 # column: 0
|
||||
sta v3 # line: 25 # column: 0
|
||||
defineclasswithbuffer 0x8, .#~@1=#Lit, _GLOBAL_1543, 0x0, v3 # line: 25 # column: 0
|
||||
defineclasswithbuffer 0x8, .#~@1=#Lit, _GLOBAL_1544, 0x0, v3 # line: 25 # column: 0
|
||||
ldobjbyname 0x9, prototype # line: 25 # column: 0
|
||||
ldhole # line: 29 # column: 0
|
||||
sta v3 # line: 29 # column: 0
|
||||
callruntime.definesendableclass 0xb, .#~@2=#NestedLiteralArray, _GLOBAL_1584, 0x0, v3 # line: 29 # column: 0
|
||||
callruntime.definesendableclass 0xb, .#~@2=#NestedLiteralArray, _GLOBAL_1585, 0x0, v3 # line: 29 # column: 0
|
||||
lda.str # line: 37 # column: 0
|
||||
trystglobalbyname 0xc, string # line: 37 # column: 0
|
||||
definefunc 0xd, .#*#add, 0x2 # line: 75 # column: 0
|
||||
|
@ -1756,6 +1756,10 @@ void Function::BuildLineNumberProgram(panda_file::DebugInfoItem *debug_item, con
|
||||
do {
|
||||
size_t end = emit_debug_info && iter != local_variable_info.end() ? iter->insn_order : num_ins;
|
||||
for (size_t i = start; i < end; i++) {
|
||||
/**
|
||||
* If you change the continue condition of this loop, you need to synchronously modify the same condition
|
||||
* of the BuildMapFromPcToIns method in the optimizer-bytecode.cpp.
|
||||
**/
|
||||
if (ins[i].opcode == Opcode::INVALID) {
|
||||
continue;
|
||||
}
|
||||
|
@ -110,11 +110,19 @@ void BuildMapFromPcToIns(pandasm::Function &function, BytecodeOptIrInterface &ir
|
||||
pc_ins_map->reserve(function.ins.size());
|
||||
auto instructions_buf = graph->GetRuntime()->GetMethodCode(method_ptr);
|
||||
compiler::BytecodeInstructions instructions(instructions_buf, graph->GetRuntime()->GetMethodCodeSize(method_ptr));
|
||||
size_t idx = 0;
|
||||
for (auto insn : instructions) {
|
||||
pandasm::Ins &ins = function.ins[idx++];
|
||||
pc_ins_map->emplace(instructions.GetPc(insn), &ins);
|
||||
if (idx >= function.ins.size()) {
|
||||
compiler::BytecodeIterator insn_iter = instructions.begin();
|
||||
for (pandasm::Ins &ins : function.ins) {
|
||||
/**
|
||||
* pc_ins_map is built with instructions data from the emitted abc file and the original function assembly.
|
||||
* Instructions of invalid opcode will be removed during emitter, but kept within function assembly structure,
|
||||
* therefore these instructions need to be skipped here
|
||||
**/
|
||||
if (ins.opcode == pandasm::Opcode::INVALID) {
|
||||
continue;
|
||||
}
|
||||
pc_ins_map->emplace(instructions.GetPc(*insn_iter), &ins);
|
||||
++insn_iter;
|
||||
if (insn_iter == instructions.end()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -34,11 +34,17 @@ struct BytecodeIterator {
|
||||
{
|
||||
return inst_;
|
||||
}
|
||||
|
||||
bool operator!=(const BytecodeIterator &rhs)
|
||||
{
|
||||
return inst_.GetAddress() != rhs.inst_.GetAddress();
|
||||
}
|
||||
|
||||
bool operator==(const BytecodeIterator &rhs)
|
||||
{
|
||||
return inst_.GetAddress() == rhs.inst_.GetAddress();
|
||||
}
|
||||
|
||||
private:
|
||||
BytecodeInstruction inst_;
|
||||
};
|
||||
@ -61,6 +67,7 @@ struct BytecodeInstructions {
|
||||
{
|
||||
return INST.GetAddress() - data_;
|
||||
}
|
||||
|
||||
size_t GetSize() const
|
||||
{
|
||||
return size_;
|
||||
|
@ -42,6 +42,8 @@ disasm_column_test_js_files = [
|
||||
"line-number5",
|
||||
]
|
||||
|
||||
disasm_line_release_test_ts_files = [ "line_number_release" ]
|
||||
|
||||
disasm_test_js_files = [
|
||||
"slot-number-annotation",
|
||||
"script-string1",
|
||||
@ -65,6 +67,20 @@ foreach(file, disasm_column_test_js_files) {
|
||||
}
|
||||
}
|
||||
|
||||
test_ts_path = "//arkcompiler/runtime_core/disassembler/tests/ts/"
|
||||
|
||||
foreach(file, disasm_line_release_test_ts_files) {
|
||||
es2abc_gen_abc("gen_${file}_abc") {
|
||||
test_ts = "${test_ts_path}${file}.ts"
|
||||
test_abc = "$target_out_dir/${file}.abc"
|
||||
src_js = rebase_path(test_ts)
|
||||
dst_file = rebase_path(test_abc)
|
||||
extra_args = [ "--module" ]
|
||||
in_puts = [ test_ts ]
|
||||
out_puts = [ test_abc ]
|
||||
}
|
||||
}
|
||||
|
||||
disasm_annotation_test_files = [
|
||||
"declaration-3d-array-boolean",
|
||||
"declaration-3d-array-enum-number",
|
||||
@ -214,6 +230,20 @@ host_unittest_action("DisasmDebugTest") {
|
||||
}
|
||||
}
|
||||
|
||||
host_unittest_action("DisasmReleaseTest") {
|
||||
module_out_path = module_output_path
|
||||
sources = script_sources
|
||||
include_dirs = disasm_include_dirs
|
||||
configs = disasm_test_configs
|
||||
deps = disasm_test_deps
|
||||
test_abc_dir = rebase_path(target_out_dir)
|
||||
defines = [ "GRAPH_TEST_ABC_DIR=\"${test_abc_dir}/\"" ]
|
||||
|
||||
foreach(file, disasm_line_release_test_ts_files) {
|
||||
deps += [ ":gen_${file}_abc" ]
|
||||
}
|
||||
}
|
||||
|
||||
annotations_sources = [ "disassembler_user_annotations_test.cpp" ]
|
||||
|
||||
host_unittest_action("DisasmUserAnnotationsTest") {
|
||||
@ -258,6 +288,7 @@ group("host_unittest") {
|
||||
":DisasmDebugTestAction",
|
||||
":DisasmImmTestAction",
|
||||
":DisasmModuleTestAction",
|
||||
":DisasmReleaseTestAction",
|
||||
":DisasmScriptTestAction",
|
||||
":DisasmUserAnnotationsTest",
|
||||
]
|
||||
|
@ -134,4 +134,26 @@ HWTEST_F(DisasmTest, disassembler_line_number_test_005, TestSize.Level1)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: disassembler_line_release_test_001
|
||||
* @tc.desc: Check abc file line number function in release.
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: file path and name
|
||||
*/
|
||||
HWTEST_F(DisasmTest, disassembler_line_release_test_001, TestSize.Level1)
|
||||
{
|
||||
const std::string file_name = GRAPH_TEST_ABC_DIR "line_number_release.abc";
|
||||
panda::disasm::Disassembler disasm {};
|
||||
disasm.Disassemble(file_name, false, false);
|
||||
disasm.CollectInfo();
|
||||
// The known line number in the abc file
|
||||
|
||||
std::vector<size_t> expectedLineNumber = {17, 18, 20, 22, -1, 15, -1};
|
||||
std::vector<size_t> lineNumber = disasm.GetLineNumber();
|
||||
ASSERT_EQ(expectedLineNumber.size(), lineNumber.size());
|
||||
for (size_t i = 0; i < lineNumber.size(); ++i) {
|
||||
EXPECT_EQ(expectedLineNumber[i], lineNumber[i]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
23
disassembler/tests/ts/line_number_release.ts
Normal file
23
disassembler/tests/ts/line_number_release.ts
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
let flag = false;
|
||||
function testRelease() {
|
||||
if (flag) {
|
||||
flag = !flag;
|
||||
}
|
||||
let jsonObj = JSON.parse("");
|
||||
return jsonObj;
|
||||
}
|
Loading…
Reference in New Issue
Block a user