mirror of
https://github.com/revanced/smali.git
synced 2025-05-16 22:17:07 +02:00
Add support to smali for a .source directive with no source file
This commit is contained in:
parent
3e4e5ec7a4
commit
b6435e7a47
@ -49,7 +49,6 @@ public class SetSourceFileMethodItem extends DebugMethodItem {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean writeTo(IndentingWriter writer) throws IOException {
|
public boolean writeTo(IndentingWriter writer) throws IOException {
|
||||||
//TODO: make sure smali can handle an empty .source directive
|
|
||||||
writer.write(".source");
|
writer.write(".source");
|
||||||
|
|
||||||
if (sourceFile != null) {
|
if (sourceFile != null) {
|
||||||
|
@ -269,7 +269,7 @@ public class DebugInfoPool {
|
|||||||
public void emitSetSourceFile(@Nonnull SetSourceFile setSourceFile) throws IOException {
|
public void emitSetSourceFile(@Nonnull SetSourceFile setSourceFile) throws IOException {
|
||||||
emitAdvancePC(setSourceFile.getCodeAddress());
|
emitAdvancePC(setSourceFile.getCodeAddress());
|
||||||
writer.write(9);
|
writer.write(9);
|
||||||
writer.write(dexFile.stringPool.getIndexNullable(setSourceFile.getSourceFile()));
|
writer.writeUleb128(dexFile.stringPool.getIndexNullable(setSourceFile.getSourceFile()) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int LINE_BASE = -4;
|
private static final int LINE_BASE = -4;
|
||||||
|
@ -807,8 +807,8 @@ epilogue_directive
|
|||||||
-> ^(I_EPILOGUE[$start, "I_EPILOGUE"] I_ADDRESS[$start, Integer.toString($method::currentAddress)]);
|
-> ^(I_EPILOGUE[$start, "I_EPILOGUE"] I_ADDRESS[$start, Integer.toString($method::currentAddress)]);
|
||||||
|
|
||||||
source_directive
|
source_directive
|
||||||
: SOURCE_DIRECTIVE STRING_LITERAL
|
: SOURCE_DIRECTIVE STRING_LITERAL?
|
||||||
-> ^(I_SOURCE[$start, "I_SOURCE"] STRING_LITERAL I_ADDRESS[$start, Integer.toString($method::currentAddress)]);
|
-> ^(I_SOURCE[$start, "I_SOURCE"] STRING_LITERAL? I_ADDRESS[$start, Integer.toString($method::currentAddress)]);
|
||||||
|
|
||||||
instruction_format12x
|
instruction_format12x
|
||||||
: INSTRUCTION_FORMAT12x
|
: INSTRUCTION_FORMAT12x
|
||||||
|
@ -702,7 +702,7 @@ epilogue returns[DebugItem debugItem]
|
|||||||
};
|
};
|
||||||
|
|
||||||
source returns[DebugItem debugItem]
|
source returns[DebugItem debugItem]
|
||||||
: ^(I_SOURCE string_literal address)
|
: ^(I_SOURCE string_literal? address)
|
||||||
{
|
{
|
||||||
$debugItem = new ImmutableSetSourceFile($address.address, $string_literal.value);
|
$debugItem = new ImmutableSetSourceFile($address.address, $string_literal.value);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user