@@ -43,6 +43,10 @@ static const ELFObjectInfo* object_info_for_region(const ELF::Core::MemoryRegion
43
43
return nullptr ;
44
44
45
45
auto image = make<ELF::Image>(file_or_error.value ()->bytes ());
46
+ #if !ARCH(I386)
47
+ // FIXME: Fix LibDebug
48
+ return nullptr ;
49
+ #endif
46
50
auto info = make<ELFObjectInfo>(file_or_error.release_value (), make<Debug::DebugInfo>(move (image)));
47
51
auto * info_ptr = info.ptr ();
48
52
s_debug_info_cache.set (path, move (info));
@@ -52,30 +56,33 @@ static const ELFObjectInfo* object_info_for_region(const ELF::Core::MemoryRegion
52
56
Backtrace::Backtrace (const Reader& coredump, const ELF::Core::ThreadInfo& thread_info)
53
57
: m_thread_info(move(thread_info))
54
58
{
59
+ FlatPtr* bp;
60
+ FlatPtr* ip;
55
61
#if ARCH(I386)
56
- uint32_t * ebp = (uint32_t *)m_thread_info.regs .ebp ;
57
- uint32_t * eip = (uint32_t *)m_thread_info.regs .eip ;
62
+ bp = (FlatPtr*)m_thread_info.regs .ebp ;
63
+ ip = (FlatPtr*)m_thread_info.regs .eip ;
64
+ #else
65
+ bp = (FlatPtr*)m_thread_info.regs .rbp ;
66
+ ip = (FlatPtr*)m_thread_info.regs .rip ;
67
+ #endif
68
+
58
69
bool first_frame = true ;
59
- while (ebp && eip ) {
70
+ while (bp && ip ) {
60
71
// We use eip - 1 because the return address from a function frame
61
72
// is the instruction that comes after the 'call' instruction.
62
73
// However, because the first frame represents the faulting
63
74
// instruction rather than the return address we don't subtract
64
75
// 1 there.
65
- VERIFY ((FlatPtr)eip > 0 );
66
- add_entry (coredump, (FlatPtr)eip - (first_frame ? 0 : 1 ));
76
+ VERIFY ((FlatPtr)ip > 0 );
77
+ add_entry (coredump, (FlatPtr)ip - (first_frame ? 0 : 1 ));
67
78
first_frame = false ;
68
- auto next_eip = coredump.peek_memory ((FlatPtr)(ebp + 1 ));
69
- auto next_ebp = coredump.peek_memory ((FlatPtr)(ebp ));
70
- if (!next_eip .has_value () || !next_ebp .has_value ())
79
+ auto next_ip = coredump.peek_memory ((FlatPtr)(bp + 1 ));
80
+ auto next_bp = coredump.peek_memory ((FlatPtr)(bp ));
81
+ if (!next_ip .has_value () || !next_bp .has_value ())
71
82
break ;
72
- eip = (uint32_t *)next_eip .value ();
73
- ebp = (uint32_t *)next_ebp .value ();
83
+ ip = (FlatPtr*)next_ip .value ();
84
+ bp = (FlatPtr*)next_bp .value ();
74
85
}
75
- #else
76
- (void )coredump;
77
- TODO ();
78
- #endif
79
86
}
80
87
81
88
Backtrace::~Backtrace ()
@@ -96,9 +103,14 @@ void Backtrace::add_entry(const Reader& coredump, FlatPtr eip)
96
103
if (!object_info)
97
104
return ;
98
105
106
+ #if ARCH(I386)
99
107
auto function_name = object_info->debug_info ->elf ().symbolicate (eip - region->region_start );
100
108
auto source_position = object_info->debug_info ->get_source_position_with_inlines (eip - region->region_start );
101
-
109
+ #else
110
+ // FIXME: Fix symbolication.
111
+ auto function_name = " " ;
112
+ Debug::DebugInfo::SourcePositionWithInlines source_position;
113
+ #endif
102
114
m_entries.append ({ eip, object_name, function_name, source_position });
103
115
}
104
116
0 commit comments