aboutsummaryrefslogtreecommitdiff
path: root/gdb/source-cache.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/source-cache.c')
-rw-r--r--gdb/source-cache.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/gdb/source-cache.c b/gdb/source-cache.c
index 18e2be9..7a52ce9 100644
--- a/gdb/source-cache.c
+++ b/gdb/source-cache.c
@@ -231,19 +231,26 @@ bool
source_cache::get_line_charpos (struct symtab *s,
const std::vector<off_t> **offsets)
{
- std::string fullname = symtab_to_fullname (s);
+ try
+ {
+ std::string fullname = symtab_to_fullname (s);
+
+ auto iter = m_offset_cache.find (fullname);
+ if (iter == m_offset_cache.end ())
+ {
+ ensure (s);
+ iter = m_offset_cache.find (fullname);
+ /* cache_source_text ensured this was entered. */
+ gdb_assert (iter != m_offset_cache.end ());
+ }
- auto iter = m_offset_cache.find (fullname);
- if (iter == m_offset_cache.end ())
+ *offsets = &iter->second;
+ return true;
+ }
+ catch (const gdb_exception_error &e)
{
- ensure (s);
- iter = m_offset_cache.find (fullname);
- /* cache_source_text ensured this was entered. */
- gdb_assert (iter != m_offset_cache.end ());
+ return false;
}
-
- *offsets = &iter->second;
- return true;
}
/* A helper function that extracts the desired source lines from TEXT,