aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2014-06-05 21:40:43 +0000
committerDmitry V. Levin <ldv@altlinux.org>2014-06-05 21:40:43 +0000
commitc12eb1117c8d91773ea0c138eb220addec1448d0 (patch)
treeebee67282b354a43f9ff1d7c8b2acc5090e6798d
parentc903c822ee94478bff1732eb80744e201c074d26 (diff)
downloadstrace-c12eb1117c8d91773ea0c138eb220addec1448d0.tar.gz
unwind: fix a bug in range updating of binary search
* unwind.c (print_stacktrace): Fix another off-by-one error in binary search.
-rw-r--r--unwind.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/unwind.c b/unwind.c
index d23fef66..0ebec928 100644
--- a/unwind.c
+++ b/unwind.c
@@ -291,7 +291,7 @@ stacktrace_walk(struct tcb *tcp,
unw_word_t function_off_set;
int stack_depth = 0, ret_val;
/* these are used for the binary search through the mmap_chace */
- unsigned int lower, upper, mid;
+ int lower, upper, mid;
size_t symbol_name_size = 40;
char * symbol_name;
struct mmap_cache_t* cur_mmap_cache;
@@ -318,7 +318,7 @@ stacktrace_walk(struct tcb *tcp,
}
lower = 0;
- upper = tcp->mmap_cache_size - 1;
+ upper = (int) tcp->mmap_cache_size - 1;
while (lower <= upper) {
/* find the mmap_cache and print the stack frame */
@@ -371,7 +371,7 @@ stacktrace_walk(struct tcb *tcp,
goto ret;
}
else if (ip < cur_mmap_cache->start_addr)
- upper = mid;
+ upper = mid - 1;
else
lower = mid + 1;