o Exposed SBFileSpec to the Python APIs in lldb.py.

o Fixed a crasher when getting it via SBTarget.GetExecutable().

>>> filespec = target.GetExecutable()
Segmentation fault

o And renamed SBFileSpec::GetFileName() to GetFilename() to be consistent with FileSpec::GetFilename().

llvm-svn: 112308
This commit is contained in:
Johnny Chen 2010-08-27 22:35:26 +00:00
parent 1ba644575d
commit 23fd10cb4e
5 changed files with 8 additions and 5 deletions

View File

@ -37,7 +37,7 @@ public:
Exists () const;
const char *
GetFileName() const;
GetFilename() const;
const char *
GetDirectory() const;

View File

@ -42,6 +42,7 @@ HEADER_FILES="${SRC_ROOT}/include/lldb/lldb-types.h"\
" ${SRC_ROOT}/include/lldb/API/SBDebugger.h"\
" ${SRC_ROOT}/include/lldb/API/SBError.h"\
" ${SRC_ROOT}/include/lldb/API/SBEvent.h"\
" ${SRC_ROOT}/include/lldb/API/SBFileSpec.h"\
" ${SRC_ROOT}/include/lldb/API/SBFrame.h"\
" ${SRC_ROOT}/include/lldb/API/SBFunction.h"\
" ${SRC_ROOT}/include/lldb/API/SBLineEntry.h"\

View File

@ -83,6 +83,7 @@
#include "lldb/API/SBDebugger.h"
#include "lldb/API/SBError.h"
#include "lldb/API/SBEvent.h"
#include "lldb/API/SBFileSpec.h"
#include "lldb/API/SBFrame.h"
#include "lldb/API/SBFunction.h"
#include "lldb/API/SBLineEntry.h"
@ -136,6 +137,7 @@ typedef int StopReason;
%include "lldb/API/SBDebugger.h"
%include "lldb/API/SBError.h"
%include "lldb/API/SBEvent.h"
%include "lldb/API/SBFileSpec.h"
%include "lldb/API/SBFrame.h"
%include "lldb/API/SBFunction.h"
%include "lldb/API/SBLineEntry.h"

View File

@ -24,7 +24,7 @@ SBFileSpec::SBFileSpec (const SBFileSpec &rhs) :
m_opaque_ap()
{
if (rhs.m_opaque_ap.get())
m_opaque_ap.reset (new FileSpec (*m_opaque_ap));
m_opaque_ap.reset (new FileSpec (rhs.get()));
}
SBFileSpec::SBFileSpec (const char *path) :
@ -69,7 +69,7 @@ SBFileSpec::ResolvePath (const char *src_path, char *dst_path, size_t dst_len)
}
const char *
SBFileSpec::GetFileName() const
SBFileSpec::GetFilename() const
{
if (m_opaque_ap.get())
return m_opaque_ap->GetFilename().AsCString();

View File

@ -163,7 +163,7 @@ IOChannel::IOChannel
m_err_file (err),
m_command_queue (),
m_completion_key ("\t"),
m_edit_line (::el_init (SBHostOS::GetProgramFileSpec().GetFileName(), in, out, err)),
m_edit_line (::el_init (SBHostOS::GetProgramFileSpec().GetFilename(), in, out, err)),
m_history (history_init()),
m_history_event(),
m_getting_command (false)
@ -213,7 +213,7 @@ IOChannel::HistorySaveLoad (bool save)
if (m_history != NULL)
{
char history_path[PATH_MAX];
::snprintf (history_path, sizeof(history_path), "~/.%s-history", SBHostOS::GetProgramFileSpec().GetFileName());
::snprintf (history_path, sizeof(history_path), "~/.%s-history", SBHostOS::GetProgramFileSpec().GetFilename());
if ((size_t)SBFileSpec::ResolvePath (history_path, history_path, sizeof(history_path)) < sizeof(history_path) - 1)
{
const char *path_ptr = history_path;