Commit 449cb549 authored by Sergey Ulanov's avatar Sergey Ulanov Committed by Commit Bot

[Fuchsia] Bugfixes in stacktrace handling

1. Updated the max limit on number for entries in link map when
   reporting a stack trace from 64 to 512. 64 is not enough, e.g.
   component builds of content_unittests load 158 libs.
2. Fixed the code to handle the case when the limit is reached
   Previously that code was using sizeof() to get array size.
3. Update regex in runner_common.py to handle the case when pc_offset
   part is missing.

Bug: 706592
Change-Id: Iededea88c86206b247948c789043c4f4dfd8a8d9
Reviewed-on: https://chromium-review.googlesource.com/815155
Commit-Queue: Sergey Ulanov <sergeyu@chromium.org>
Reviewed-by: default avatarWez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#523847}
parent 1386bee6
...@@ -63,7 +63,9 @@ class SymbolMap { ...@@ -63,7 +63,9 @@ class SymbolMap {
Entry* GetForAddress(void* address); Entry* GetForAddress(void* address);
private: private:
static const size_t kMaxMapEntries = 64; // Component builds of Chrome pull about 250 shared libraries (on Linux), so
// 512 entries should be enough in most cases.
static const size_t kMaxMapEntries = 512;
void Populate(); void Populate();
...@@ -116,7 +118,6 @@ void SymbolMap::Populate() { ...@@ -116,7 +118,6 @@ void SymbolMap::Populate() {
} }
// Retrieve the debug info struct. // Retrieve the debug info struct.
constexpr size_t map_capacity = sizeof(entries_);
uintptr_t debug_addr; uintptr_t debug_addr;
status = zx_object_get_property(process, ZX_PROP_PROCESS_DEBUG_ADDR, status = zx_object_get_property(process, ZX_PROP_PROCESS_DEBUG_ADDR,
&debug_addr, sizeof(debug_addr)); &debug_addr, sizeof(debug_addr));
...@@ -135,7 +136,7 @@ void SymbolMap::Populate() { ...@@ -135,7 +136,7 @@ void SymbolMap::Populate() {
// Copy the contents of the link map linked list to |entries_|. // Copy the contents of the link map linked list to |entries_|.
while (lmap != nullptr) { while (lmap != nullptr) {
if (count_ == map_capacity) { if (count_ >= arraysize(entries_)) {
break; break;
} }
SymbolMap::Entry* next_entry = &entries_[count_]; SymbolMap::Entry* next_entry = &entries_[count_];
......
...@@ -567,9 +567,9 @@ def _HandleOutputFromProcess(process, symbols_mapping): ...@@ -567,9 +567,9 @@ def _HandleOutputFromProcess(process, symbols_mapping):
# Back-trace line matcher/parser assumes that 'pc' is always present, and # Back-trace line matcher/parser assumes that 'pc' is always present, and
# expects that 'sp' and ('binary','pc_offset') may also be provided. # expects that 'sp' and ('binary','pc_offset') may also be provided.
backtrace_entry = re.compile( backtrace_entry = re.compile(
r'pc 0(?:x[0-9a-f]+)? ' + r'pc 0(?:x[0-9a-f]+)?' +
r'(?:sp 0x[0-9a-f]+ )?' + r'(?: sp 0x[0-9a-f]+)?' +
r'(?:\((?P<binary>\S+),(?P<pc_offset>0x[0-9a-f]+)\))?$') r'(?: \((?P<binary>\S+),(?P<pc_offset>0x[0-9a-f]+)\))?$')
# A buffer of backtrace entries awaiting symbolization, stored as dicts: # A buffer of backtrace entries awaiting symbolization, stored as dicts:
# raw: The original back-trace line that followed the prefix. # raw: The original back-trace line that followed the prefix.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment