Make the segfault handler attempt to symbolize Dart frames.

R=fschneider@google.com

Review-Url: https://codereview.chromium.org/2668443004 .
This commit is contained in:
Ryan Macnak
2017-01-30 16:38:50 -08:00
parent ac5a77e3a1
commit dfd471eea2
3 changed files with 22 additions and 20 deletions
+4
View File
@@ -54,6 +54,10 @@ bool Platform::Initialize() {
perror("sigaction() failed.");
return false;
}
if (sigaction(SIGTRAP, &act, NULL) != 0) {
perror("sigaction() failed.");
return false;
}
return true;
}
+4
View File
@@ -59,6 +59,10 @@ bool Platform::Initialize() {
perror("sigaction() failed.");
return false;
}
if (sigaction(SIGTRAP, &act, NULL) != 0) {
perror("sigaction() failed.");
return false;
}
return true;
}
+14 -20
View File
@@ -330,6 +330,20 @@ void ClearProfileVisitor::VisitSample(Sample* sample) {
static void DumpStackFrame(intptr_t frame_index, uword pc) {
Isolate* isolate = Isolate::Current();
if ((isolate != NULL) && isolate->is_runnable()) {
Code& code = Code::Handle(Code::LookupCodeInVmIsolate(pc));
if (!code.IsNull()) {
OS::PrintErr(" [0x%" Pp "] %s\n", pc, code.QualifiedName());
return;
}
code = Code::LookupCode(pc);
if (!code.IsNull()) {
OS::PrintErr(" [0x%" Pp "] %s\n", pc, code.QualifiedName());
return;
}
}
uintptr_t start = 0;
char* native_symbol_name = NativeSymbolResolver::LookupSymbolName(pc, &start);
if (native_symbol_name == NULL) {
@@ -341,16 +355,6 @@ static void DumpStackFrame(intptr_t frame_index, uword pc) {
}
static void DumpStackFrame(intptr_t frame_index, uword pc, const Code& code) {
if (code.IsNull()) {
DumpStackFrame(frame_index, pc);
} else {
OS::PrintErr("Frame[%" Pd "] = Dart:`%s` [0x%" Px "]\n", frame_index,
code.ToCString(), pc);
}
}
class ProfilerStackWalker : public ValueObject {
public:
ProfilerStackWalker(Isolate* isolate,
@@ -370,16 +374,6 @@ class ProfilerStackWalker : public ValueObject {
}
}
bool Append(uword pc, const Code& code) {
if (sample_ == NULL) {
DumpStackFrame(frame_index_, pc, code);
frame_index_++;
total_frames_++;
return true;
}
return Append(pc);
}
bool Append(uword pc) {
if (sample_ == NULL) {
DumpStackFrame(frame_index_, pc);