pike.git / lib / master.pike.in

version» Context lines:

pike.git/lib/master.pike.in:24:   #define GETCWD_CACHE   //#define FILE_STAT_CACHE      // This define is searched and replaced by bin/install.pike.   #undef PIKE_MODULE_RELOC      #ifndef PIKE_WARNINGS   #define PIKE_WARNINGS 1   #endif /* PIKE_WARNINGS */    + int want_load_announcements = 0; + #define PROGRAM_LOADED(A,B,C) (want_load_announcements?(A[B]=program_loaded(B, (C))):(A[B]=(C)))      // --- Global constants and variables      // Used by describe_backtrace() et al.   #if !defined(BT_MAX_STRING_LEN) || (BT_MAX_STRING_LEN <= 0)   #undef BT_MAX_STRING_LEN   #define BT_MAX_STRING_LEN 200   #endif /* !defined(BT_MAX_STRING_LEN) || (BT_MAX_STRING_LEN <= 0) */   constant bt_max_string_len = BT_MAX_STRING_LEN;   
pike.git/lib/master.pike.in:1699:    resolv_debug ("low_findprog %s: decoding dumped\n", fname);    INC_RESOLV_MSG_DEPTH();    decoded = decode_value(read_precompiled (oname),    (handler?->get_codec ||    get_codec)(fname, mkobj, handler));    DEC_RESOLV_MSG_DEPTH();    resolv_debug ("low_findprog %s: dump decode ok\n", fname);    if (decoded?->this_program_does_not_exist) {    resolv_debug ("low_findprog %s: program claims not to exist\n",    fname); -  return programs[fname] = 0; +  return PROGRAM_LOADED(programs, fname, 0);    }    else {    if (objectp(decoded)) {    resolv_debug("low_findprog %s: decoded object %O\n",    fname, decoded);    objects[ret = object_program(decoded)] = decoded;    } else {    ret = decoded;    }    resolv_debug("low_findprog %s: returning %O\n", fname, ret); -  return programs[fname]=ret; +  return PROGRAM_LOADED(programs, fname, ret);    }    };    DEC_RESOLV_MSG_DEPTH();    resolv_debug ("low_findprog %s: dump decode failed\n", fname); -  programs[fname] = no_value; +  PROGRAM_LOADED(programs, fname, no_value);    call_compile_warning (handler, oname,    "Decode failed: " +    call_describe_error(err));    // handle_error(err);    } else if (out_of_date_warning) {    call_compile_warning (handler, oname,    "Compiled file is out of date");    }    }    }       resolv_debug ("low_findprog %s: compiling, mkobj: %O\n", fname, mkobj);    INC_RESOLV_MSG_DEPTH(); -  programs[fname]=ret=__empty_program(0, fname); +  PROGRAM_LOADED(programs, fname, ret=__empty_program(0, fname));    AUTORELOAD_CHECK_FILE (fname);    string src;    if (array|object err = catch (src = master_read_file (fname))) {    DEC_RESOLV_MSG_DEPTH();    resolv_debug ("low_findprog %s: failed to read file\n", fname);    objects[ret] = no_value; -  ret=programs[fname]=0; // Negative cache. +  PROGRAM_LOADED(programs, fname, ret=0); // Negative cache.    compile_cb_rethrow (err);    }    if ( mixed e=catch {    ret=compile_string(src, fname, handler,    ret,    mkobj? (objects[ret]=__null_program()) : 0);    } )    {    DEC_RESOLV_MSG_DEPTH();    resolv_debug ("low_findprog %s: compilation failed\n", fname);    objects[ret] = no_value; -  ret=programs[fname]=0; // Negative cache. +  PROGRAM_LOADED(programs, fname, ret=0); // Negative cache.    destruct(compiler_lock);    throw(e);    }    destruct(compiler_lock);    DEC_RESOLV_MSG_DEPTH();    resolv_debug ("low_findprog %s: compilation ok\n", fname);    break;      #if constant(load_module)    case ".so":    if (fname == "") {    werror( "low_findprog(%O, %O) => load_module(\"\")\n"    "%s\n", pname, ext, call_describe_backtrace(backtrace()) );    }       if (array|object err = catch (ret = load_module(fakeroot(fname)))) {    DEC_RESOLV_MSG_DEPTH();    resolv_debug ("low_findprog %s: failed to load binary\n", fname);    objects[ret] = no_value; -  ret=programs[fname]=0; // Negative cache. +  PROGRAM_LOADED(programs, fname, ret=0); // Negative cache.    if (objectp (err) && err->is_module_load_error)    // Do not treat errors from dlopen(3) as exceptions since in    // a dist we can have .so files that are dynamically linked    // against libraries that don't exist on the system, and in    // that case we should just treat the module as nonexisting.    //    // What we really want is to do this only for errors that    // are due to nonexisting files, but the error reporting    // from dlerror(3) doesn't allow us to tell those from other    // errors.
pike.git/lib/master.pike.in:1793:    }    else    resolv_debug ("low_findprog %s: loaded binary\n", fname);   #endif /* load_module */    }       AUTORELOAD_FINISH(ret,programs,fname);       if (ret?->this_program_does_not_exist) {    resolv_debug ("low_findprog %s: program says it doesn't exist\n", fname); -  return programs[fname] = 0; +  PROGRAM_LOADED(programs, fname, ret=0); +  return ret;    }    else {    if(!ret)    resolv_debug("low_findprog %s: dependencies failed.\n", fname);    else    resolv_debug("low_findprog %s: returning %O\n", fname, ret); -  return programs[fname]=ret; +  PROGRAM_LOADED(programs, fname, ret); +  return ret;    }    }       resolv_debug ("low_findprog %s: file not found\n", fname);    return 0;   }      //   // This function is called by the compiler when a delayed compilation   // error occurs in the given program. It should remove all references
pike.git/lib/master.pike.in:1823:   void unregister(program p)   {    // werror("Unregistering %O...\n", p);    object compiler_lock = DefaultCompilerEnvironment->lock();       if(string fname=rev_programs[p] || search(programs,p)) {    resolv_debug("unregister %s\n", fname);    if (m_delete (rev_programs, p))    m_delete (programs, fname);    else -  programs[fname] = no_value; +  PROGRAM_LOADED(programs, fname, no_value);       string name = program_path_to_name (fname);    mixed n = has_value (name, '.') ?    resolv ((name / ".")[..<1] * ".") :    get_root_module();    if (is_dirnode(n) || is_joinnode(n))    n->delete_value (p);       fname = dirname (fname);    if ( fname!="" && objectp (n = fc[fname]) )
pike.git/lib/master.pike.in:3630:   mapping(string:string) initial_predefines = ([]);      protected mixed main_resolv(string sym, CompatResolver|void resolver) {    mixed v = (resolver||this)->resolv(sym);    if(!v)    error("Could not resolve %s. "    "(Perhaps the installed pike tree has been moved.)\n", sym);    return v;   };    + // TODO: this seems like a backward approach. The debugger should register its completer on startup. + // callback for completing breakpoint registration for programs which weren't loaded + // at the time of the breakpoint's creation. + function deferred_breakpoint_completer; + mixed program_loaded(string fn, mixed c) {if(deferred_breakpoint_completer) deferred_breakpoint_completer(fn, c); return c;} +    void load_debugger(int wait_seconds) { -  +  want_load_announcements = 1;    set_debugger(1);    // load the debugger support    function d;       mixed err = catch {    function f = main_resolv("Debug.debug",    get_compilation_handler(compat_major, compat_minor));    };    if(err) {    werror("Debugging is only available when Pike is compiled with RTL debug.\n");    exit(1);    }       err = catch { -  +  deferred_breakpoint_completer = main_resolv("Debug.Debugger.deferred_breakpoint_completer", +  get_compilation_handler(compat_major, compat_minor)); +  }; +  +  if(err) { +  werror("Unable to load the deferred breakpoint completer\n"); +  werror(describe_backtrace(err)); +  exit(1); +  } +  +  err = catch {    d = main_resolv("Debug.Debugger.debug_server",    get_compilation_handler(compat_major, compat_minor));    };       if(!d){ werror("Unable to load debugger.\n");    throw(d);    }    debugger = d();    debugger->load_breakpoint(wait_seconds);   }
pike.git/lib/master.pike.in:4092:    if (objectp (err) && err->is_cpp_or_compilation_error)    exit(1, "Pike: Failed to compile script.\n");    else    exit(1, "Pike: Failed to compile script:\n"    "%s", call_describe_backtrace(err));    }       // Don't list the program with its real path in the programs    // mapping, so that reverse lookups (typically by the codec)    // always find the canonical "/main" instead. -  programs[argv[0]] = no_value; +  PROGRAM_LOADED(programs, argv[0], no_value);    }    -  programs["/main"] = prog; +  PROGRAM_LOADED(programs, "/main", prog);       // FIXME: Can this occur at all?    if(!prog)    error("Pike: Couldn't find script to execute\n(%O)\n", argv[0]);      #if constant(_debug)    if(debug) _debug(debug);   #endif    if(trace) trace = predef::trace(trace);    mixed ret;
pike.git/lib/master.pike.in:5727:       object __register_new_program(program p)    {    DEC_MSG ("__register_new_program (%O)\n", p);    // NB: decode_value() has already locked the compiler, so we    // should not need to lock it here.    if(unregistered && fname)    {    unregistered = 0;    resolv_debug("register %s\n", fname); -  programs[fname]=p; +  PROGRAM_LOADED(programs, fname, p);    if (mkobj)    DEC_RETURN (objectp (objects[p]) ? objects[p] : (objects[p]=__null_program()));    }    DEC_RETURN (0);    }       protected mixed thingof (string|array what)    {    mixed res;    array sublist;