From fed6a2d0ef5be5e67fdd45a571ceced8b4ec707d Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Fri, 25 Aug 2023 20:43:34 +0200 Subject: [PATCH] wasm: change language in DWARF from Java to C++ This is due to weird issue in lldb (from which Chrome dev tools are derived), which does not parse DWARF functions if there's no support for language "type system" --- .../java/org/teavm/backend/wasm/dwarf/DwarfConstants.java | 1 + .../java/org/teavm/backend/wasm/generate/DwarfGenerator.java | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/teavm/backend/wasm/dwarf/DwarfConstants.java b/core/src/main/java/org/teavm/backend/wasm/dwarf/DwarfConstants.java index 10d82d7da..21bb8d131 100644 --- a/core/src/main/java/org/teavm/backend/wasm/dwarf/DwarfConstants.java +++ b/core/src/main/java/org/teavm/backend/wasm/dwarf/DwarfConstants.java @@ -54,6 +54,7 @@ public final class DwarfConstants { public static final int DW_ATE_UTF = 0x10; public static final int DW_LANG_JAVA = 0x0b; + public static final int DW_LANG_C_PLUS_PLUS = 0x04; public static final int DW_CHILDREN_YES = 1; public static final int DW_CHILDREN_NO = 0; diff --git a/core/src/main/java/org/teavm/backend/wasm/generate/DwarfGenerator.java b/core/src/main/java/org/teavm/backend/wasm/generate/DwarfGenerator.java index b92b1cf2e..3bc4a33f9 100644 --- a/core/src/main/java/org/teavm/backend/wasm/generate/DwarfGenerator.java +++ b/core/src/main/java/org/teavm/backend/wasm/generate/DwarfGenerator.java @@ -26,7 +26,7 @@ import static org.teavm.backend.wasm.dwarf.DwarfConstants.DW_FORM_ADDR; import static org.teavm.backend.wasm.dwarf.DwarfConstants.DW_FORM_DATA2; import static org.teavm.backend.wasm.dwarf.DwarfConstants.DW_FORM_SEC_OFFSET; import static org.teavm.backend.wasm.dwarf.DwarfConstants.DW_FORM_STRP; -import static org.teavm.backend.wasm.dwarf.DwarfConstants.DW_LANG_JAVA; +import static org.teavm.backend.wasm.dwarf.DwarfConstants.DW_LANG_C_PLUS_PLUS; import static org.teavm.backend.wasm.dwarf.DwarfConstants.DW_TAG_COMPILE_UNIT; import static org.teavm.backend.wasm.dwarf.DwarfConstants.DW_UT_COMPILE; import java.util.ArrayList; @@ -82,7 +82,7 @@ public class DwarfGenerator { data.writeLEB(DW_AT_HIGH_PC).writeLEB(DW_FORM_ADDR); })); infoWriter.writeInt(strings.stringRef("TeaVM")); - infoWriter.writeShort(DW_LANG_JAVA); + infoWriter.writeShort(DW_LANG_C_PLUS_PLUS); infoWriter.writeInt(strings.stringRef("classes.wasm")); infoWriter.writeInt(0); infoWriter.writeInt(0);