From abd7d9ea223b759ae549c44df99fca41f8ed3b25 Mon Sep 17 00:00:00 2001 From: Daniel Beer Date: Tue, 18 May 2010 18:42:16 +1200 Subject: [PATCH] Show containing function when querying cgraph for address. --- rtools.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rtools.c b/rtools.c index a0071fa..beb832a 100644 --- a/rtools.c +++ b/rtools.c @@ -815,10 +815,11 @@ static void cgraph_func_info(struct call_graph *graph, cproc_t cp, u_int16_t offset; struct cg_node *n; - while (i < graph->node_list.size && - CG_NODE(graph, i)->offset < addr) + while (i + 1 < graph->node_list.size && + CG_NODE(graph, i + 1)->offset <= addr) i++; - if (i >= graph->node_list.size) { + if (i >= graph->node_list.size || + CG_NODE(graph, i)->offset > addr) { printf("No information for address 0x%04x\n", addr); return; }