diff options
Diffstat (limited to 'elfutils/libdwfl/dwfl_addrmodule.c')
-rw-r--r-- | elfutils/libdwfl/dwfl_addrmodule.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/elfutils/libdwfl/dwfl_addrmodule.c b/elfutils/libdwfl/dwfl_addrmodule.c index 98c4b39f..54d9a3d9 100644 --- a/elfutils/libdwfl/dwfl_addrmodule.c +++ b/elfutils/libdwfl/dwfl_addrmodule.c @@ -1,5 +1,5 @@ /* Find module containing address. - Copyright (C) 2005, 2006 Red Hat, Inc. + Copyright (C) 2005, 2006, 2007 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -55,6 +55,8 @@ dwfl_addrmodule (Dwfl *dwfl, Dwarf_Addr address) if (dwfl == NULL || dwfl->modules == NULL) return NULL; + Dwfl_Module *boundary = NULL; + /* Do binary search on the array indexed by module load address. */ size_t l = 0, u = dwfl->nmodules; while (l < u) @@ -64,11 +66,18 @@ dwfl_addrmodule (Dwfl *dwfl, Dwarf_Addr address) if (address < m->low_addr) u = idx; else if (address >= m->high_addr) - l = idx + 1; + { + l = idx + 1; + if (address == m->high_addr) + /* If the high bound of this module is not the low bound of + another, then consider the boundary address to be inside + this module. */ + boundary = m; + } else return m; } - return NULL; + return boundary; } INTDEF (dwfl_addrmodule) |