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.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/gdb/source-cache.c b/gdb/source-cache.c
index 9039f8f..18e2be9 100644
--- a/gdb/source-cache.c
+++ b/gdb/source-cache.c
@@ -135,8 +135,7 @@ get_language_name (enum language lang)
break;
case language_rust:
- /* Not handled by Source Highlight. */
- break;
+ return "rust.lang";
case language_ada:
return "ada.lang";
@@ -197,11 +196,22 @@ source_cache::ensure (struct symtab *s)
highlighter->setStyleFile ("esc.style");
}
- std::istringstream input (contents);
- std::ostringstream output;
- highlighter->highlight (input, output, lang_name, fullname);
-
- contents = output.str ();
+ try
+ {
+ std::istringstream input (contents);
+ std::ostringstream output;
+ highlighter->highlight (input, output, lang_name, fullname);
+ contents = output.str ();
+ }
+ catch (...)
+ {
+ /* Source Highlight will throw an exception if
+ highlighting fails. One possible reason it can fail
+ is if the language is unknown -- which matters to gdb
+ because Rust support wasn't added until after 3.1.8.
+ Ignore exceptions here and fall back to
+ un-highlighted text. */
+ }
}
}
#endif /* HAVE_SOURCE_HIGHLIGHT */