зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1353810 - add a --enable-rust-debug option; r=chmanchester
For people working on Rust code, compiling in debug mode (Cargo's "dev" profile) is convenient: debug assertions are turned on, optimization is turned off, and parallel compilation inside of rustc itself can be used. These things make the build faster and the debugging experience more pleasant. To obtain that currently, one needs to --enable-debug at the Gecko toplevel, which turns on debug assertions for the entire browser, which makes things run unreasonably slowly. So it would be desirable to be able to turn *off* debug mode for the entirety of the browser, but turn on debug mode for the Rust code only. Hence this added switch, --enable-rust-debug, which does what it suggests and defaults to the value of --enable-debug. For our own sanity and because we judge it a non-existent use case, we do not support --enable-debug --disable-rust-debug.
This commit is contained in:
Родитель
6f4c78cd5e
Коммит
2989feb7d7
|
@ -906,7 +906,7 @@ cargo_target_flag := --target=$(RUST_TARGET)
|
|||
|
||||
# Permit users to pass flags to cargo from their mozconfigs (e.g. --color=always).
|
||||
cargo_build_flags = $(CARGOFLAGS)
|
||||
ifndef MOZ_DEBUG
|
||||
ifndef MOZ_DEBUG_RUST
|
||||
cargo_build_flags += --release
|
||||
endif
|
||||
cargo_build_flags += --frozen
|
||||
|
@ -936,8 +936,8 @@ endif
|
|||
ifndef MOZ_OPTIMIZE
|
||||
rustflags = -C opt-level=0
|
||||
# Unfortunately, -C opt-level=0 implies -C debug-assertions, so we need
|
||||
# to explicitly disable them when MOZ_DEBUG is not set.
|
||||
ifndef MOZ_DEBUG
|
||||
# to explicitly disable them when MOZ_DEBUG_RUST is not set.
|
||||
ifndef MOZ_DEBUG_RUST
|
||||
rustflags += -C debug-assertions=no
|
||||
endif
|
||||
rustflags_override = RUSTFLAGS='$(rustflags)'
|
||||
|
|
|
@ -88,7 +88,7 @@ Gecko_IsInDocument(RawGeckoNodeBorrowed aNode)
|
|||
return aNode->IsInComposedDoc();
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef MOZ_DEBUG_RUST
|
||||
bool
|
||||
Gecko_FlattenedTreeParentIsParent(RawGeckoNodeBorrowed aNode)
|
||||
{
|
||||
|
|
|
@ -103,6 +103,20 @@ js_option('--enable-debug',
|
|||
add_old_configure_assignment('MOZ_DEBUG',
|
||||
depends('--enable-debug')(lambda v: bool(v)))
|
||||
|
||||
imply_option('--enable-rust-debug',
|
||||
depends('--enable-debug')(lambda v: bool(v) or None))
|
||||
|
||||
js_option('--enable-rust-debug',
|
||||
help='Build Rust code with debug assertions turned on.')
|
||||
|
||||
@depends('--enable-rust-debug')
|
||||
def debug_rust(debug):
|
||||
if debug:
|
||||
return True
|
||||
|
||||
set_config('MOZ_DEBUG_RUST', debug_rust)
|
||||
set_define('MOZ_DEBUG_RUST', debug_rust)
|
||||
|
||||
include('build/moz.configure/pkg.configure')
|
||||
# Make this assignment here rather than in pkg.configure to avoid
|
||||
# requiring this file in unit tests.
|
||||
|
|
|
@ -425,7 +425,7 @@ def cargo_output_directory(context, target_var):
|
|||
# in those directories. The directory structure depends not only
|
||||
# on the target, but also what sort of build we are doing.
|
||||
rust_build_kind = 'release'
|
||||
if context.config.substs.get('MOZ_DEBUG'):
|
||||
if context.config.substs.get('MOZ_DEBUG_RUST'):
|
||||
rust_build_kind = 'debug'
|
||||
return mozpath.join(context.config.substs[target_var], rust_build_kind)
|
||||
|
||||
|
|
|
@ -378,6 +378,10 @@ void Gecko_IncrementStringAdoptCount(void* aData)
|
|||
{
|
||||
MOZ_LOG_CTOR(aData, "StringAdopt", 1);
|
||||
}
|
||||
#elif defined(MOZ_DEBUG_RUST)
|
||||
void Gecko_IncrementStringAdoptCount(void *aData)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
void Gecko_FinalizeCString(nsACString* aThis)
|
||||
|
|
Загрузка…
Ссылка в новой задаче