Esempio n. 1
0
static SCM
frscm_scm_from_frame (struct frame_info *frame, struct inferior *inferior)
{
    frame_smob *f_smob, f_smob_for_lookup;
    SCM f_scm;
    htab_t htab;
    eqable_gdb_smob **slot;
    struct frame_id frame_id = null_frame_id;
    struct gdbarch *gdbarch = NULL;
    int frame_id_is_next = 0;

    /* If we've already created a gsmob for this frame, return it.
       This makes frames eq?-able.  */
    htab = frscm_inferior_frame_map (inferior);
    f_smob_for_lookup.frame_id = get_frame_id (frame);
    f_smob_for_lookup.inferior = inferior;
    slot = gdbscm_find_eqable_gsmob_ptr_slot (htab, &f_smob_for_lookup.base);
    if (*slot != NULL)
        return (*slot)->containing_scm;

    TRY
    {
        /* Try to get the previous frame, to determine if this is the last frame
        in a corrupt stack.  If so, we need to store the frame_id of the next
         frame and not of this one (which is possibly invalid).  */
        if (get_prev_frame (frame) == NULL
        && get_frame_unwind_stop_reason (frame) != UNWIND_NO_REASON
        && get_next_frame (frame) != NULL)
        {
            frame_id = get_frame_id (get_next_frame (frame));
            frame_id_is_next = 1;
        }
        else
        {
            frame_id = get_frame_id (frame);
            frame_id_is_next = 0;
        }
        gdbarch = get_frame_arch (frame);
    }
    CATCH (except, RETURN_MASK_ALL)
    {
        return gdbscm_scm_from_gdb_exception (except);
    }
    END_CATCH

    f_scm = frscm_make_frame_smob ();
    f_smob = (frame_smob *) SCM_SMOB_DATA (f_scm);
    f_smob->frame_id = frame_id;
    f_smob->gdbarch = gdbarch;
    f_smob->inferior = inferior;
    f_smob->frame_id_is_next = frame_id_is_next;

    gdbscm_fill_eqable_gsmob_ptr_slot (slot, &f_smob->base);

    return f_scm;
}
Esempio n. 2
0
static char *
tyscm_type_name (struct type *type, SCM *excp)
{
  char *name = NULL;

  TRY
    {
      struct cleanup *old_chain;
      struct ui_file *stb;

      stb = mem_fileopen ();
      old_chain = make_cleanup_ui_file_delete (stb);

      LA_PRINT_TYPE (type, "", stb, -1, 0, &type_print_raw_options);

      name = ui_file_xstrdup (stb, NULL);
      do_cleanups (old_chain);
    }
  CATCH (except, RETURN_MASK_ALL)
    {
      *excp = gdbscm_scm_from_gdb_exception (except);
      return NULL;
    }
Esempio n. 3
0
void
gdbscm_throw_gdb_exception (struct gdb_exception exception)
{
  gdbscm_throw (gdbscm_scm_from_gdb_exception (exception));
}
Esempio n. 4
0
 CATCH (except, RETURN_MASK_ALL)
   {
     SCM excp = gdbscm_scm_from_gdb_exception (except);
     gdbscm_throw (excp);
   }