Skip to content

Commit 68946df

Browse files
rmacnak-googlecommit-bot@chromium.org
authored andcommitted
[vm] Also print version information in assertion failures, not just faults.
Populate the dynamic symbol table for gen_snapshot. Change-Id: Ib4712d2f481948f646ba4f5e353e0837b6391eab Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95682 Reviewed-by: Régis Crelier <[email protected]> Commit-Queue: Ryan Macnak <[email protected]>
1 parent 0c23106 commit 68946df

File tree

6 files changed

+23
-15
lines changed

6 files changed

+23
-15
lines changed

runtime/bin/BUILD.gn

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,13 @@ template("build_gen_snapshot") {
179179
]
180180
}
181181

182+
if (!is_win) {
183+
# Adds all symbols to the dynamic symbol table, not just used ones.
184+
# This is needed to make native extensions work. It is also needed to get
185+
# symbols in VM-generated backtraces and profiles.
186+
ldflags = [ "-rdynamic" ]
187+
}
188+
182189
if (is_win) {
183190
libs = [
184191
"iphlpapi.lib",
@@ -730,7 +737,8 @@ template("dart_executable") {
730737
ldflags = [ "/EXPORT:Dart_True" ]
731738
} else {
732739
# Adds all symbols to the dynamic symbol table, not just used ones.
733-
# This is needed to make native extensions work.
740+
# This is needed to make native extensions work. It is also needed to get
741+
# symbols in VM-generated backtraces and profiles.
734742
ldflags = [ "-rdynamic" ]
735743
}
736744

@@ -943,6 +951,9 @@ executable("run_vm_tests") {
943951
] + builtin_impl_tests + vm_tests + compiler_tests + heap_tests
944952

945953
if (!is_win) {
954+
# Adds all symbols to the dynamic symbol table, not just used ones.
955+
# This is needed to make native extensions work. It is also needed to get
956+
# symbols in VM-generated backtraces and profiles.
946957
ldflags = [ "-rdynamic" ]
947958
}
948959

runtime/bin/platform_android.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,9 @@ char** Platform::argv_ = NULL;
2828
static void segv_handler(int signal, siginfo_t* siginfo, void* context) {
2929
Log::PrintErr(
3030
"\n===== CRASH =====\n"
31-
"version=%s\n"
3231
"si_signo=%s(%d), si_code=%d, si_addr=%p\n",
33-
Dart_VersionString(), strsignal(siginfo->si_signo), siginfo->si_signo,
34-
siginfo->si_code, siginfo->si_addr);
32+
strsignal(siginfo->si_signo), siginfo->si_signo, siginfo->si_code,
33+
siginfo->si_addr);
3534
Dart_DumpNativeStackTrace(context);
3635
abort();
3736
}

runtime/bin/platform_linux.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,9 @@ char** Platform::argv_ = NULL;
2828
static void segv_handler(int signal, siginfo_t* siginfo, void* context) {
2929
Log::PrintErr(
3030
"\n===== CRASH =====\n"
31-
"version=%s\n"
3231
"si_signo=%s(%d), si_code=%d, si_addr=%p\n",
33-
Dart_VersionString(), strsignal(siginfo->si_signo), siginfo->si_signo,
34-
siginfo->si_code, siginfo->si_addr);
32+
strsignal(siginfo->si_signo), siginfo->si_signo, siginfo->si_code,
33+
siginfo->si_addr);
3534
Dart_DumpNativeStackTrace(context);
3635
abort();
3736
}

runtime/bin/platform_macos.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,9 @@ char** Platform::argv_ = NULL;
3636
static void segv_handler(int signal, siginfo_t* siginfo, void* context) {
3737
Log::PrintErr(
3838
"\n===== CRASH =====\n"
39-
"version=%s\n"
4039
"si_signo=%s(%d), si_code=%d, si_addr=%p\n",
41-
Dart_VersionString(), strsignal(siginfo->si_signo), siginfo->si_signo,
42-
siginfo->si_code, siginfo->si_addr);
40+
strsignal(siginfo->si_signo), siginfo->si_signo, siginfo->si_code,
41+
siginfo->si_addr);
4342
Dart_DumpNativeStackTrace(context);
4443
abort();
4544
}

runtime/bin/platform_win.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,8 @@ class PlatformWin {
7575
EXCEPTION_ILLEGAL_INSTRUCTION)) {
7676
Log::PrintErr(
7777
"\n===== CRASH =====\n"
78-
"version=%s\n"
7978
"ExceptionCode=%d, ExceptionFlags=%d, ExceptionAddress=%p\n",
80-
Dart_VersionString(), ExceptionInfo->ExceptionRecord->ExceptionCode,
79+
ExceptionInfo->ExceptionRecord->ExceptionCode,
8180
ExceptionInfo->ExceptionRecord->ExceptionFlags,
8281
ExceptionInfo->ExceptionRecord->ExceptionAddress);
8382
Dart_DumpNativeStackTrace(ExceptionInfo->ContextRecord);

runtime/vm/profiler.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "vm/signal_handler.h"
2424
#include "vm/simulator.h"
2525
#include "vm/stack_frame.h"
26+
#include "vm/version.h"
2627

2728
namespace dart {
2829

@@ -1117,9 +1118,9 @@ void Profiler::DumpStackTrace(uword sp, uword fp, uword pc, bool for_crash) {
11171118
ASSERT(os_thread != NULL);
11181119
Isolate* isolate = Isolate::Current();
11191120
const char* name = isolate == NULL ? NULL : isolate->name();
1120-
OS::PrintErr("thread=%" Pd ", isolate=%s(%p)\n",
1121-
OSThread::ThreadIdToIntPtr(os_thread->trace_id()), name,
1122-
isolate);
1121+
OS::PrintErr(
1122+
"version=%s\nthread=%" Pd ", isolate=%s(%p)\n", Version::String(),
1123+
OSThread::ThreadIdToIntPtr(os_thread->trace_id()), name, isolate);
11231124

11241125
if (!InitialRegisterCheck(pc, fp, sp)) {
11251126
OS::PrintErr("Stack dump aborted because InitialRegisterCheck failed.\n");

0 commit comments

Comments
 (0)