Modernize wasm debug symbol generation

Rolling a few suggested split debug changes from
https://developer.chrome.com/blog/faster-wasm-debugging/ into our code.

Added emdwp after linker line, to collect .dwo DWARF info into one
single file (otherwise Chrome lacks local variable support)

Still not working:
* -gdwarf-5 does not work yet with neither -O1 nor -Og
* -Og results in massive binary sizes, -O1 still required to not blow
  up browser mem right after load

Change-Id: Ibf9ea42882df88d947f9bb3881430f0745c0df54
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168562
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
This commit is contained in:
Thorsten Behrens
2024-06-07 23:53:25 +02:00
parent 57c228803e
commit 8ecdff7ac3
3 changed files with 5 additions and 2 deletions
+1 -1
View File
@@ -4984,7 +4984,7 @@ if test "$enable_split_debug" != no; then
fi
if test -n "$use_split_debug"; then
if test "$_os" = "Emscripten"; then
TEST_CC_FLAG=-gseparate-dwarf
TEST_CC_FLAG=-gsplit-dwarf -gpubnames
else
TEST_CC_FLAG=-gsplit-dwarf
fi
@@ -48,7 +48,7 @@ gb_LINKERSTRIPDEBUGFLAGS :=
gb_DEBUGINFO_FLAGS = -g
ifeq ($(HAVE_EXTERNAL_DWARF),TRUE)
gb_DEBUGINFO_FLAGS += -gseparate-dwarf
gb_DEBUGINFO_FLAGS += -gsplit-dwarf -gpubnames
endif
gb_COMPILEROPTFLAGS := -O3
@@ -65,6 +65,7 @@ $(call gb_LinkTarget_add_auxtargets,$(2),\
$(patsubst %.lib,%.wasm,$(3)) \
$(patsubst %.lib,%.js,$(3)) \
$(patsubst %.lib,%.worker.js,$(3)) \
$(patsubst %.lib,%.wasm.dwp,$(3)) \
)
endef
@@ -75,6 +76,7 @@ $(call gb_LinkTarget_add_auxtargets,$(2),\
$(patsubst %.lib,%.wasm,$(3)) \
$(patsubst %.lib,%.js,$(3)) \
$(patsubst %.lib,%.worker.js,$(3)) \
$(patsubst %.lib,%.wasm.dwp,$(3)) \
)
endef
+1
View File
@@ -171,6 +171,7 @@ $(call gb_Helper_abbreviate_dirs,\
) \
-o $(1) \
$(if $(SOVERSIONSCRIPT),&& ln -sf ../../program/$(notdir $(1)) $(ILIBTARGET)) \
$(if $(filter EMSCRIPTEN,$(OS)),$(if $(filter TRUE,$(HAVE_EXTERNAL_DWARF)),&& emdwp -e $(patsubst %.html,%.wasm,$(1)) -o $(patsubst %.html,%.wasm.dwp,$(1)))) \
$(if $(call gb_LinkTarget__WantLock,$(2)),; RC=$$? ; rm -f $(gb_LinkTarget__Lock); if test $$RC -ne 0; then exit $$RC; fi))
$(if $(filter Library,$(TARGETTYPE)), $(call gb_Helper_abbreviate_dirs,\