Module: remote-nub Synopsis: The CORBA Debugger Nub of the Remote Debugger Author: Nosa Omo Copyright: Original Code is Copyright (c) 1995-2004 Functional Objects, Inc. All rights reserved. License: Functional Objects Library Public License Version 1.0 Dual-license: GNU Lesser General Public License Warranty: Distributed WITHOUT WARRANTY OF ANY KIND define constant $max-spy-function-arguments = 16; define constant $max-stepping-locations = 512; define variable *remote-debugger-nub* = #f; define class (Rtmgr/) slot nub-process :: Rtmgr/RemoteNub/; constant slot nub-process-id :: , required-init-keyword: id:; slot remote-process :: ; constant slot spy-function-argument-vector :: = make(, element-count: $max-spy-function-arguments); constant slot stepping-locations-vector :: = make(, element-count: $max-stepping-locations); slot nub-reference :: Rtmgr/; slot nub-access-path :: Rtmgr/; slot nub-server :: Rtmgr/; constant slot nub-ior-file, required-init-keyword: ior-file:; constant slot nub-orb :: corba/, required-init-keyword: orb:; end class; define method Rtmgr/RemoteNub/process (rnub :: ) => (result :: Rtmgr/RemoteNub/) rnub.nub-process end method; define inline method process-setter (process :: Rtmgr/RemoteNub/, rnub :: ) => (result :: Rtmgr/RemoteNub/) rnub.remote-process := export-(process); rnub.nub-process := process; end method; define method Rtmgr/RemoteNub/access-path (rnub :: ) => (ap :: Rtmgr/) rnub.nub-access-path end method; define method Rtmgr/RemoteNub/OpenNub (rnub :: , path :: Rtmgr/) => () rnub.nub-access-path := path; end method; define method Rtmgr/RemoteNub/CloseNub (rnub :: ) => () Rtmgr/RemoteNub/close-application(rnub); let event = create-application-event (concatenate(DebuggerNubEvent, rnub.nub-process-id)); // create a separate thread to shut down the nub make(, function: method () // Wait for the Debugger Server to prompt // us to shut down on return from this operation // to avoid race conditions and deadlocks with POA threads wait-for-application-event(event); exit-application(0); end method); end method; define constant $nub-directory = as(, temp-directory() | ""); define constant $nub-server-ior-file = concatenate($nub-directory, "nub-server.ior"); define constant DebuggerNubEvent = "Functional Developer Debugger Nub "; define method main () => () let orb = corba/orb-init(make(corba/), "Functional Developer ORB"); let root-poa = corba/orb/resolve-initial-references(orb, "RootPOA"); let poa = PortableServer/POA/create-poa(root-poa, "Rnub POA", #f, lifespan-policy: #"transient"); let application-args = application-arguments(); let ior-file :: = first(application-args); let process-id :: = second(application-args); let rnub = make(, ior-file: ior-file, orb: orb, id: process-id); let reference = portableserver/poa/servant-to-reference(poa, rnub); *remote-debugger-nub* := rnub; rnub.nub-reference := as(Rtmgr/, reference); corba/orb/object-to-file(orb, rnub.nub-ior-file, reference); // Signal the Debugger Server that it can now read // in our reference signal-application-event (concatenate(DebuggerNubEvent, process-id)); // Read in the Debugger Server reference let server = as(Rtmgr/, corba/orb/file-to-object(orb, $nub-server-ior-file)); rnub.nub-server := server; let poa-manager = PortableServer/POA/the-poamanager(poa); PortableServer/POAManager/activate(poa-manager); corba/orb/run(orb); end method main; begin main(); end;