diff options
author | Bert Belder <bertbelder@gmail.com> | 2020-04-03 19:40:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-03 13:40:11 -0400 |
commit | c0cb198114ccc2dc4fa2764d307ad985c456882a (patch) | |
tree | d805b82639334dc2126dccd03dcbcfb62ef12f14 /cli/state.rs | |
parent | 3f489ae1aeff6f27b2214dc8201ed068abd5f973 (diff) |
Make inspector more robust, add --inspect-brk support (#4552)
Diffstat (limited to 'cli/state.rs')
-rw-r--r-- | cli/state.rs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/cli/state.rs b/cli/state.rs index 44ab73034..fe5aa1b74 100644 --- a/cli/state.rs +++ b/cli/state.rs @@ -33,6 +33,16 @@ use std::str; use std::thread::JoinHandle; use std::time::Instant; +#[derive(Copy, Clone, Eq, PartialEq)] +pub enum DebugType { + /// Can be debugged, will wait for debugger when --inspect-brk given. + Main, + /// Can be debugged, never waits for debugger. + Dependent, + /// No inspector instance is created. + Internal, +} + #[derive(Clone)] pub struct State(Rc<RefCell<StateInner>>); @@ -59,6 +69,7 @@ pub struct StateInner { pub seeded_rng: Option<StdRng>, pub resource_table: ResourceTable, pub target_lib: TargetLib, + pub debug_type: DebugType, } impl State { @@ -230,6 +241,7 @@ impl State { global_state: GlobalState, shared_permissions: Option<DenoPermissions>, main_module: ModuleSpecifier, + debug_type: DebugType, ) -> Result<Self, ErrBox> { let import_map: Option<ImportMap> = match global_state.flags.import_map_path.as_ref() { @@ -259,9 +271,9 @@ impl State { next_worker_id: 0, start_time: Instant::now(), seeded_rng, - resource_table: ResourceTable::default(), target_lib: TargetLib::Main, + debug_type, })); Ok(Self(state)) @@ -295,9 +307,9 @@ impl State { next_worker_id: 0, start_time: Instant::now(), seeded_rng, - resource_table: ResourceTable::default(), target_lib: TargetLib::Worker, + debug_type: DebugType::Dependent, })); Ok(Self(state)) @@ -370,6 +382,7 @@ impl State { GlobalState::mock(vec!["deno".to_string()]), None, module_specifier, + DebugType::Main, ) .unwrap() } |