ubsan: nds32: left shift cannot be represented in type 'int'
[deliverable/binutils-gdb.git] / gdb / source-cache.c
index 18e2be989b4b14349ee74815b97d9c169da505e8..1fe6da81326a5773642acaba2ef250d6f4c0fc2d 100644 (file)
@@ -190,14 +190,14 @@ source_cache::ensure (struct symtab *s)
             conditional compilation in source-cache.h.  */
          static srchilite::SourceHighlight *highlighter;
 
-         if (highlighter == nullptr)
-           {
-             highlighter = new srchilite::SourceHighlight ("esc.outlang");
-             highlighter->setStyleFile ("esc.style");
-           }
-
          try
            {
+             if (highlighter == nullptr)
+               {
+                 highlighter = new srchilite::SourceHighlight ("esc.outlang");
+                 highlighter->setStyleFile ("esc.style");
+               }
+
              std::istringstream input (contents);
              std::ostringstream output;
              highlighter->highlight (input, output, lang_name, fullname);
@@ -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 ())
+      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 ());
+       }
+
+      *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,
This page took 0.031103 seconds and 4 git commands to generate.