diff options
| author | Bruce Mitchener <bruce.mitchener@gmail.com> | 2015-04-24 00:38:53 +0000 |
|---|---|---|
| committer | Bruce Mitchener <bruce.mitchener@gmail.com> | 2015-04-24 00:38:53 +0000 |
| commit | 17d2730ee039692d0ae02ff2cfbea691bf8fcf11 (patch) | |
| tree | 482f6c3defc09989f23e6bb62859773f2ae63602 /lldb/scripts/interface/SBFileSpec.i | |
| parent | e1a67412cf1df672f9b12b040db390adfcbd6013 (diff) | |
| download | bcm5719-llvm-17d2730ee039692d0ae02ff2cfbea691bf8fcf11.tar.gz bcm5719-llvm-17d2730ee039692d0ae02ff2cfbea691bf8fcf11.zip | |
Start to share SWIG interface files between languages.
Summary:
Move scripts/Python/interface to scripts/interface so that we
can start making iterative improvements towards sharing the
interface files between multiple languages (each of which would
have their own directory as now).
Test Plan: Build and see.
Reviewers: zturner, emaste, clayborg
Reviewed By: clayborg
Subscribers: mjsabby, lldb-commits
Differential Revision: http://reviews.llvm.org/D9212
llvm-svn: 235676
Diffstat (limited to 'lldb/scripts/interface/SBFileSpec.i')
| -rw-r--r-- | lldb/scripts/interface/SBFileSpec.i | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/lldb/scripts/interface/SBFileSpec.i b/lldb/scripts/interface/SBFileSpec.i new file mode 100644 index 00000000000..c153f2bd86f --- /dev/null +++ b/lldb/scripts/interface/SBFileSpec.i @@ -0,0 +1,103 @@ +//===-- SWIG Interface for SBFileSpec ---------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +namespace lldb { + +%feature("docstring", +"Represents a file specification that divides the path into a directory and +basename. The string values of the paths are put into uniqued string pools +for fast comparisons and efficient memory usage. + +For example, the following code + + lineEntry = context.GetLineEntry() + self.expect(lineEntry.GetFileSpec().GetDirectory(), 'The line entry should have the correct directory', + exe=False, + substrs = [self.mydir]) + self.expect(lineEntry.GetFileSpec().GetFilename(), 'The line entry should have the correct filename', + exe=False, + substrs = ['main.c']) + self.assertTrue(lineEntry.GetLine() == self.line, + 'The line entry's line number should match ') + +gets the line entry from the symbol context when a thread is stopped. +It gets the file spec corresponding to the line entry and checks that +the filename and the directory matches what we expect. +") SBFileSpec; +class SBFileSpec +{ +public: + SBFileSpec (); + + SBFileSpec (const lldb::SBFileSpec &rhs); + + SBFileSpec (const char *path);// Deprecated, use SBFileSpec (const char *path, bool resolve) + + SBFileSpec (const char *path, bool resolve); + + ~SBFileSpec (); + + bool + IsValid() const; + + bool + Exists () const; + + bool + ResolveExecutableLocation (); + + const char * + GetFilename() const; + + const char * + GetDirectory() const; + + void + SetFilename(const char *filename); + + void + SetDirectory(const char *directory); + + uint32_t + GetPath (char *dst_path, size_t dst_len) const; + + static int + ResolvePath (const char *src_path, char *dst_path, size_t dst_len); + + bool + GetDescription (lldb::SBStream &description) const; + + %pythoncode %{ + def __get_fullpath__(self): + spec_dir = self.GetDirectory() + spec_file = self.GetFilename() + if spec_dir and spec_file: + return '%s/%s' % (spec_dir, spec_file) + elif spec_dir: + return spec_dir + elif spec_file: + return spec_file + return None + + __swig_getmethods__["fullpath"] = __get_fullpath__ + if _newclass: fullpath = property(__get_fullpath__, None, doc='''A read only property that returns the fullpath as a python string.''') + + __swig_getmethods__["basename"] = GetFilename + if _newclass: basename = property(GetFilename, None, doc='''A read only property that returns the path basename as a python string.''') + + __swig_getmethods__["dirname"] = GetDirectory + if _newclass: dirname = property(GetDirectory, None, doc='''A read only property that returns the path directory name as a python string.''') + + __swig_getmethods__["exists"] = Exists + if _newclass: exists = property(Exists, None, doc='''A read only property that returns a boolean value that indicates if the file exists.''') + %} + +}; + +} // namespace lldb |

