Emscripten: Put back -gseparate-dwarf
...which had been replaced with -gsplit-dwarf in
8ecdff7ac3 "Modernize wasm debug symbol
generation". But -gseparate-dwarf and -gsplit-dwarf are apparently orthogonal:
-gseparate-dwarf adds a supplementary *.wasm.debug.wasm (whose relative URL is
recorded in an external_debug_info section in the original *.wasm), and the
original *.wasm and the supplementary *.wasm.debug.wasm have exactly the same
content, except that only the supplementary *.wasm.debug.wasm contains any of
the .debug_* sections (and only the original *.wasm contains the
external_debug_info section). That way, the original *.wasm stays small (so
that it does not exceed any limits of the browser's JS WebAssembly instantiation
machinery), while the browser's debugger (like Chrome's "C/C++ DevTools Support
(DWARF)" extension) uses the supplementary *.wasm.debug.wasm. This is
especially relevant when building LO with e.g. -fsanitize=address, where the
resulting soffice.wasm would otherwise easily grow too large.
-gsplit-dwarf, on the other hand, leaves certain debug information in .debug_*
sections in the original *.wasm and offloads further debug data to an auxiliary
*.wasm.dwp (which the browser's debugger will then load and use in addition to
using the original *.wasm's debug information). When combined with
-gseparate-dwarf, there's an overall three files now: the original *.wasm (used
by the browser's JS WebAssembly instantiation machinery; lacking any debug
information), the supplementary *.wasm.debug.wasm (used by the browser's
debugger; containing some debug information), and the auxiliary
*.wasm.debug.wasm.dwp (used by the browser's debugger; containing further debug
information). (One might assume that when using -gseparate-dwarf there would be
no benefit from additionally using -gsplit-dwarf. But when I tried that with at
least Chrome version 138.0.7204.100 and the "C/C++ DevTools Support (DWARF)"
extension version 0.2.5854.1, it would still sometimes fail with
> [C/C++ DevTools Support (DWARF)] Loading debug symbols for http://localhost:6931/soffice.wasm (via soffice.wasm.debug.wasm)…
> [C/C++ DevTools Support (DWARF)] Failed to load debug symbols for http://localhost:6931/soffice.wasm (TypeError: Failed to fetch)
and the emrun server reporting
> 127.0.0.1 - - [15/Jul/2025 22:41:58] code 404, message File not found: /home/sberg/cowasm/core/workdir/installation/LibreOffice/emscripten/soffice.wasm.debug.wasm.dwp
> 127.0.0.1 - - [15/Jul/2025 22:41:58] "GET /soffice.wasm.debug.wasm.dwp HTTP/1.1" 404 -
making it look like it wanted to access a non-existing auxiliary
soffice.wasm.debug.wasm.dwp for some unclear reason. So, at least for now, it
looks better to just use a setup that provides that auxiliary file anyway.)
Change-Id: I72352479c864c8d89cc63cc228aa676c7c2d8ccf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187953
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
This commit is contained in:
+1
-1
@@ -5178,7 +5178,7 @@ if test "$enable_split_debug" != no; then
|
||||
fi
|
||||
if test -n "$use_split_debug"; then
|
||||
if test "$_os" = "Emscripten"; then
|
||||
TEST_CC_FLAG='-gsplit-dwarf -gpubnames'
|
||||
TEST_CC_FLAG='-gseparate-dwarf -gsplit-dwarf -gpubnames'
|
||||
else
|
||||
TEST_CC_FLAG=-gsplit-dwarf
|
||||
fi
|
||||
|
||||
@@ -19,7 +19,9 @@ emscripten_install_files := \
|
||||
soffice.js \
|
||||
soffice.wasm \
|
||||
$(if $(EMSCRIPTEN_WORKERJS),soffice.worker.js) \
|
||||
$(if $(ENABLE_SYMBOLS_FOR),soffice.wasm.dwp) \
|
||||
$(if $(ENABLE_SYMBOLS_FOR), \
|
||||
soffice.wasm.debug.wasm \
|
||||
soffice.wasm.debug.wasm.dwp) \
|
||||
$(if $(DISABLE_GUI),, \
|
||||
qt_soffice.html \
|
||||
qtloader.js \
|
||||
|
||||
@@ -76,7 +76,7 @@ gb_LINKERSTRIPDEBUGFLAGS :=
|
||||
gb_DEBUGINFO_FLAGS = -g
|
||||
|
||||
ifeq ($(HAVE_EXTERNAL_DWARF),TRUE)
|
||||
gb_DEBUGINFO_FLAGS += -gsplit-dwarf -gpubnames
|
||||
gb_DEBUGINFO_FLAGS += -gseparate-dwarf -gsplit-dwarf -gpubnames
|
||||
endif
|
||||
|
||||
gb_COMPILEROPTFLAGS := -O3
|
||||
@@ -92,7 +92,8 @@ $(call gb_LinkTarget_add_auxtargets,$(2),\
|
||||
$(patsubst %.lib,%.linkdeps,$(3)) \
|
||||
$(patsubst %.lib,%.wasm,$(3)) \
|
||||
$(if $(EMSCRIPTEN_WORKERJS),$(patsubst %.lib,%.worker.js,$(3))) \
|
||||
$(patsubst %.lib,%.wasm.dwp,$(3)) \
|
||||
$(patsubst %.lib,%.wasm.debug.wasm,$(3)) \
|
||||
$(patsubst %.lib,%.wasm.debug.wasm.dwp,$(3)) \
|
||||
)
|
||||
|
||||
endef
|
||||
@@ -102,7 +103,8 @@ $(call gb_LinkTarget_add_auxtargets,$(2),\
|
||||
$(patsubst %.lib,%.linkdeps,$(3)) \
|
||||
$(patsubst %.lib,%.wasm,$(3)) \
|
||||
$(if $(EMSCRIPTEN_WORKERJS),$(patsubst %.lib,%.worker.js,$(3))) \
|
||||
$(patsubst %.lib,%.wasm.dwp,$(3)) \
|
||||
$(patsubst %.lib,%.wasm.debug.wasm,$(3)) \
|
||||
$(patsubst %.lib,%.wasm.debug.wasm.dwp,$(3)) \
|
||||
)
|
||||
|
||||
endef
|
||||
|
||||
@@ -172,7 +172,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 %$(gb_Executable_EXT),%.wasm,$(1)) -o $(patsubst %$(gb_Executable_EXT),%.wasm.dwp,$(1)))) \
|
||||
$(if $(filter EMSCRIPTEN,$(OS)),$(if $(filter TRUE,$(HAVE_EXTERNAL_DWARF)),&& emdwp -e $(patsubst %$(gb_Executable_EXT),%.wasm.debug.wasm,$(1)) -o $(patsubst %$(gb_Executable_EXT),%.wasm.debug.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,\
|
||||
|
||||
Reference in New Issue
Block a user