-
-/* Gets the language of the current frame. */
-
-enum language
-get_frame_language (void)
-{
- struct frame_info *frame = deprecated_safe_get_selected_frame ();
-
- if (frame)
- {
- volatile struct gdb_exception ex;
- CORE_ADDR pc = 0;
- struct symtab *s;
-
- /* We determine the current frame language by looking up its
- associated symtab. To retrieve this symtab, we use the frame
- PC. However we cannot use the frame PC as is, because it
- usually points to the instruction following the "call", which
- is sometimes the first instruction of another function. So
- we rely on get_frame_address_in_block(), it provides us with
- a PC that is guaranteed to be inside the frame's code
- block. */
-
- TRY_CATCH (ex, RETURN_MASK_ERROR)
- {
- pc = get_frame_address_in_block (frame);
- }
- if (ex.reason < 0)
- {
- if (ex.error != NOT_AVAILABLE_ERROR)
- throw_exception (ex);
- }
- else
- {
- s = find_pc_symtab (pc);
- if (s != NULL)
- return s->language;
- }
- }
-
- return language_unknown;
-}