示例#1
0
static void
source_script_from_stream (FILE *stream, const char *file)
{
  if (script_ext_mode != script_ext_off
      && strlen (file) > 3 && !strcmp (&file[strlen (file) - 3], ".py"))
    {
      volatile struct gdb_exception e;

      TRY_CATCH (e, RETURN_MASK_ERROR)
	{
	  source_python_script (stream, file);
	}
      if (e.reason < 0)
	{
	  /* Should we fallback to ye olde GDB script mode?  */
	  if (script_ext_mode == script_ext_soft
	      && e.reason == RETURN_ERROR && e.error == UNSUPPORTED_ERROR)
	    {
	      fseek (stream, 0, SEEK_SET);
	      script_from_file (stream, (char*) file);
	    }
	  else
	    {
	      /* Nope, just punt.  */
	      fclose (stream);
	      throw_exception (e);
	    }
	}
      else
	fclose (stream);
    }
示例#2
0
文件: extension.c 项目: neon12345/gdb
static void
source_gdb_objfile_script (const struct extension_language_defn *extlang,
			   struct objfile *objfile,
			   FILE *stream, const char *file)
{
  script_from_file (stream, file);
}