mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-26 12:56:08 +00:00

working directory by default -- a typical security problem that we need to be more conservative about. It adds a new target setting, target.load-cwd-lldbinit which may be true (always read $cwd/.lldbinit), false (never read $cwd/.lldbinit) or warn (warn if there is a $cwd/.lldbinit and don't read it). The default is set to warn. If this is met with unhappiness, we can look at changing the default to true (to match current behavior) on a different platform. This does not affect reading of ~/.lldbinit - that will still be read, as before. If you run lldb in your home directory, it will not warn about the presence of a .lldbinit file there. I had to add two SB API - SBHostOS::GetUserHomeDirectory and SBFileSpec::AppendPathComponent - for the lldb driver code to be able to get the home directory path in an OS neutral manner. The warning text is There is a .lldbinit file in the current directory which is not being read. To silence this warning without sourcing in the local .lldbinit, add the following to the lldbinit file in your home directory: settings set target.load-cwd-lldbinit false To allow lldb to source .lldbinit files in the current working directory, set the value of this variable to true. Only do so if you understand and accept the security risk. <rdar://problem/24199163> llvm-svn: 261280
107 lines
3.4 KiB
C++
107 lines
3.4 KiB
C++
//===-- 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;
|
|
|
|
void
|
|
AppendPathComponent (const char *file_or_directory);
|
|
|
|
%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
|