From 951681cfba4c98e80e37ef041b1d8b84adf24065 Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Mon, 30 May 2022 17:16:55 -0700 Subject: [PATCH] MAINT Improve debug settings in Makefile.envs (#2648) --- Makefile | 5 +++++ Makefile.envs | 19 ++++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index c75337a62..fce9cd974 100644 --- a/Makefile +++ b/Makefile @@ -50,6 +50,11 @@ dist/pyodide.asm.js: \ [ -d dist ] || mkdir dist $(CXX) -o dist/pyodide.asm.js $(filter %.o,$^) \ $(MAIN_MODULE_LDFLAGS) + + if [[ -n $${PYODIDE_SOURCEMAP+x} ]] || [[ -n $${PYODIDE_SYMBOLS+x} ]]; then \ + cd dist && npx prettier -w pyodide.asm.js ; \ + fi + # Strip out C++ symbols which all start __Z. # There are 4821 of these and they have VERY VERY long names. # To show some stats on the symbols you can use the following: diff --git a/Makefile.envs b/Makefile.envs index 49e91dbb3..cbfaf12a8 100644 --- a/Makefile.envs +++ b/Makefile.envs @@ -55,12 +55,21 @@ export DBG_LDFLAGS_SOURCEMAPDEBUG=-gseparate-dwarf export DBGFLAGS=$(DBGFLAGS_NODEBUG) -# Include debug symbols but no source maps (most useful) -#export DBGFLAGS=$(DBGFLAGS_WASMDEBUG) +ifdef PYODIDE_SOURCEMAP + # Debug with source maps (less useful than WASMDEBUG but easier if it helps) + export DBGFLAGS=$(DBGFLAGS_SOURCEMAPDEBUG) + export DBG_LDFLAGS=$(DBG_LDFLAGS_SOURCEMAPDEBUG) +else + ifdef PYODIDE_SYMBOLS + # Include debug symbols but no source maps (most useful) + export DBGFLAGS=$(DBGFLAGS_WASMDEBUG) + endif +endif + +ifdef PYODIDE_ASSERTIONS + EXTRA_CFLAGS+=" -DDEBUG_F" +endif -# Debug with source maps (less useful than WASMDEBUG but easier if it helps) -#export DBGFLAGS=$(DBGFLAGS_SOURCEMAPDEBUG) -#export DBG_LDFLAGS=$(DBG_LDFLAGS_SOURCEMAPDEBUG) export OPTFLAGS=-O2 export CFLAGS_BASE=\