Skip to content

Commit

Permalink
Add SBTarget::add_module().
Browse files Browse the repository at this point in the history
  • Loading branch information
vadimcn committed May 29, 2020
1 parent cbe3cc7 commit 25820f5
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 0 deletions.
2 changes: 2 additions & 0 deletions adapter2/deps/lldb/src/lldb.rs
Expand Up @@ -135,6 +135,7 @@ mod sblaunchinfo;
mod sblinenetry;
mod sblistener;
mod sbmodule;
mod sbmodulespec;
mod sbplatform;
mod sbprocess;
mod sbstream;
Expand Down Expand Up @@ -169,6 +170,7 @@ pub use sblaunchinfo::*;
pub use sblinenetry::*;
pub use sblistener::*;
pub use sbmodule::*;
pub use sbmodulespec::*;
pub use sbplatform::*;
pub use sbprocess::*;
pub use sbstream::*;
Expand Down
64 changes: 64 additions & 0 deletions adapter2/deps/lldb/src/sbmodulespec.rs
@@ -0,0 +1,64 @@
use super::*;

cpp_class!(pub unsafe struct SBModuleSpec as "SBModuleSpec");

unsafe impl Send for SBModuleSpec {}

impl SBModuleSpec {
pub fn new() -> SBModuleSpec {
cpp!(unsafe [] -> SBModuleSpec as "SBModuleSpec" { return SBModuleSpec(); })
}
pub fn clear(&self) {
cpp!(unsafe [self as "SBModuleSpec*"] {
self->Clear();
})
}
pub fn filespec(&self) -> SBFileSpec {
cpp!(unsafe [self as "SBModuleSpec*"] -> SBFileSpec as "SBFileSpec" {
return self->GetFileSpec();
})
}
pub fn set_filespec(&self, filespec: &SBFileSpec) {
cpp!(unsafe [self as "SBModuleSpec*", filespec as "const SBFileSpec*"] {
self->SetFileSpec(*filespec);
})
}
pub fn platform_filespec(&self) -> SBFileSpec {
cpp!(unsafe [self as "SBModuleSpec*"] -> SBFileSpec as "SBFileSpec" {
return self->GetPlatformFileSpec();
})
}
pub fn set_platform_filespec(&self, filespec: &SBFileSpec) {
cpp!(unsafe [self as "SBModuleSpec*", filespec as "const SBFileSpec*"] {
self->SetPlatformFileSpec(*filespec);
})
}
pub fn symbol_filespec(&self) -> SBFileSpec {
cpp!(unsafe [self as "SBModuleSpec*"] -> SBFileSpec as "SBFileSpec" {
return self->GetSymbolFileSpec();
})
}
pub fn set_symbol_filespec(&self, filespec: &SBFileSpec) {
cpp!(unsafe [self as "SBModuleSpec*", filespec as "const SBFileSpec*"] {
self->SetSymbolFileSpec(*filespec);
})
}
}

impl IsValid for SBModuleSpec {
fn is_valid(&self) -> bool {
cpp!(unsafe [self as "SBModuleSpec*"] -> bool as "bool" {
return self->IsValid();
})
}
}

impl fmt::Debug for SBModuleSpec {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
debug_descr(f, |descr| {
cpp!(unsafe [self as "SBModuleSpec*", descr as "SBStream*"] -> bool as "bool" {
return self->GetDescription(*descr);
})
})
}
}
5 changes: 5 additions & 0 deletions adapter2/deps/lldb/src/sbtarget.rs
Expand Up @@ -45,6 +45,11 @@ impl SBTarget {
return self->GetExecutable();
})
}
pub fn add_module(&self, modulespec: &SBModuleSpec) -> SBModule {
cpp!(unsafe [self as "SBTarget*", modulespec as "const SBModuleSpec*"] -> SBModule as "SBModule" {
return self->AddModule(*modulespec);
})
}
pub fn launch(&self, launch_info: &SBLaunchInfo) -> Result<SBProcess, SBError> {
let mut error = SBError::new();
let process = cpp!(unsafe [self as "SBTarget*", launch_info as "SBLaunchInfo*", mut error as "SBError"] -> SBProcess as "SBProcess" {
Expand Down

0 comments on commit 25820f5

Please sign in to comment.