/// @param err_str
/// The new custom error string to copy and cache.
//------------------------------------------------------------------
- void SetErrorString(const char *err_str);
+ void SetErrorString(llvm::StringRef err_str);
//------------------------------------------------------------------
/// Set the current error string to a formatted error string.
virtual ~Log();
virtual void PutCString(const char *cstr);
+ virtual void PutString(llvm::StringRef str);
// CLEANUP: Add llvm::raw_ostream &Stream() function.
virtual void Printf(const char *format, ...)
/// @return
/// Number of bytes written.
//------------------------------------------------------------------
+ // TODO: Convert this function to take ArrayRef<uint8_t>
int PutEscapedBytes(const void *s, size_t src_len);
};
bool Empty() const;
- const char *GetData() const;
-
size_t GetSize() const;
size_t GetSizeOfLastLine() const;
- std::string &GetString();
+ llvm::StringRef GetString() const;
- const std::string &GetString() const;
+ const char *GetData() const { return m_packet.c_str(); }
void FillLastLineToColumn(uint32_t column, char fill_char);
public:
TypeNameSpecifierImpl() : m_is_regex(false), m_type() {}
- TypeNameSpecifierImpl(const char *name, bool is_regex)
+ TypeNameSpecifierImpl(llvm::StringRef name, bool is_regex)
: m_is_regex(is_regex), m_type() {
- if (name)
- m_type.m_type_name.assign(name);
+ m_type.m_type_name = name;
}
// if constructing with a given type, is_regex cannot be true since we are
// giving an exact type to match
TypeNameSpecifierImpl(lldb::TypeSP type) : m_is_regex(false), m_type() {
if (type) {
- m_type.m_type_name.assign(type->GetName().GetCString());
+ m_type.m_type_name = type->GetName().GetStringRef();
m_type.m_type_pair.SetType(type);
}
}
//------------------------------------------------------------------
static Error ShellExpandArguments(ProcessLaunchInfo &launch_info);
+ // TODO: Convert this function to take a StringRef.
static Error RunShellCommand(
const char *command, // Shouldn't be NULL
const FileSpec &working_dir, // Pass empty FileSpec to use the current
#include "lldb/Core/StreamTee.h"
#include "lldb/lldb-private.h"
+#include "llvm/ADT/StringRef.h"
+
+#include <memory>
+
namespace lldb_private {
class CommandReturnObject {
~CommandReturnObject();
- const char *GetOutputData() {
+ llvm::StringRef GetOutputData() {
lldb::StreamSP stream_sp(m_out_stream.GetStreamAtIndex(eStreamStringIndex));
if (stream_sp)
- return static_cast<StreamString *>(stream_sp.get())->GetData();
- return "";
+ return static_pointer_cast<StreamString>(stream_sp)->GetString();
+ return llvm::StringRef();
}
- const char *GetErrorData() {
+ llvm::StringRef GetErrorData() {
lldb::StreamSP stream_sp(m_err_stream.GetStreamAtIndex(eStreamStringIndex));
if (stream_sp)
- return static_cast<StreamString *>(stream_sp.get())->GetData();
- else
- return "";
+ return static_pointer_cast<StreamString>(stream_sp)->GetString();
+ return llvm::StringRef();
}
Stream &GetOutputStream() {
/// @return
/// The number of bytes that were actually written.
//------------------------------------------------------------------
+ // TODO: change this to take an ArrayRef<uint8_t>
size_t WriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size,
Error &error);
with recording(self, trace) as sbuf:
print("looking at:", output, file=sbuf)
+ if output is None:
+ output = ""
# The heading says either "Expecting" or "Not expecting".
heading = "Expecting" if matching else "Not expecting"
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
if (m_opaque_ap) {
+ llvm::StringRef output = m_opaque_ap->GetOutputData();
+ ConstString result(output.empty() ? llvm::StringRef("") : output);
+
if (log)
log->Printf("SBCommandReturnObject(%p)::GetOutput () => \"%s\"",
- static_cast<void *>(m_opaque_ap.get()),
- m_opaque_ap->GetOutputData());
+ static_cast<void *>(m_opaque_ap.get()), result.AsCString());
- return m_opaque_ap->GetOutputData();
+ return result.AsCString();
}
if (log)
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
if (m_opaque_ap) {
+ llvm::StringRef output = m_opaque_ap->GetErrorData();
+ ConstString result(output.empty() ? llvm::StringRef("") : output);
if (log)
log->Printf("SBCommandReturnObject(%p)::GetError () => \"%s\"",
- static_cast<void *>(m_opaque_ap.get()),
- m_opaque_ap->GetErrorData());
+ static_cast<void *>(m_opaque_ap.get()), result.AsCString());
- return m_opaque_ap->GetErrorData();
+ return result.AsCString();
}
if (log)
}
size_t SBCommandReturnObject::GetOutputSize() {
- return (m_opaque_ap ? strlen(m_opaque_ap->GetOutputData()) : 0);
+ return (m_opaque_ap ? m_opaque_ap->GetOutputData().size() : 0);
}
size_t SBCommandReturnObject::GetErrorSize() {
- return (m_opaque_ap ? strlen(m_opaque_ap->GetErrorData()) : 0);
+ return (m_opaque_ap ? m_opaque_ap->GetErrorData().size() : 0);
}
size_t SBCommandReturnObject::PutOutput(FILE *fh) {
"SBFrame::EvaluateExpression (expr = \"%s\", fetch_dynamic_value "
"= %u) %s",
expr, options.GetFetchDynamicValue(),
- frame_description.GetString().c_str());
+ frame_description.GetData());
}
exe_results = target->EvaluateExpression(expr, frame, expr_value_sp,
// See if we have any locally backed data. If so, copy it so we can then
// redirect it to the file so we don't lose the data
if (!m_is_file)
- local_data.swap(
- static_cast<StreamString *>(m_opaque_ap.get())->GetString());
+ local_data = static_cast<StreamString *>(m_opaque_ap.get())->GetString();
}
StreamFile *stream_file = new StreamFile;
uint32_t open_options = File::eOpenOptionWrite | File::eOpenOptionCanCreate;
// See if we have any locally backed data. If so, copy it so we can then
// redirect it to the file so we don't lose the data
if (!m_is_file)
- local_data.swap(
- static_cast<StreamString *>(m_opaque_ap.get())->GetString());
+ local_data = static_cast<StreamString *>(m_opaque_ap.get())->GetString();
}
m_opaque_ap.reset(new StreamFile(fh, transfer_fh_ownership));
// See if we have any locally backed data. If so, copy it so we can then
// redirect it to the file so we don't lose the data
if (!m_is_file)
- local_data.swap(
- static_cast<StreamString *>(m_opaque_ap.get())->GetString());
+ local_data = static_cast<StreamString *>(m_opaque_ap.get())->GetString();
}
m_opaque_ap.reset(new StreamFile(::fdopen(fd, "w"), transfer_fh_ownership));
if (m_is_file)
m_opaque_ap.reset();
else
- static_cast<StreamString *>(m_opaque_ap.get())->GetString().clear();
+ static_cast<StreamString *>(m_opaque_ap.get())->Clear();
}
}
"SBTarget::EvaluateExpression (expr = \"%s\", fetch_dynamic_value = "
"%u) %s",
expr, options.GetFetchDynamicValue(),
- frame_description.GetString().c_str());
+ frame_description.GetString().str().c_str());
#endif
exe_results =
target->EvaluateExpression(expr, frame, expr_value_sp, options.ref());
if (num_cleared > 0) {
Stream &output_stream = result.GetOutputStream();
output_stream.Printf("%d breakpoints cleared:\n", num_cleared);
- output_stream << ss.GetData();
+ output_stream << ss.GetString();
output_stream.EOL();
result.SetStatus(eReturnStatusSuccessFinishNoResult);
} else {
StreamString s;
bp_sp->GetDescription(&s, eDescriptionLevelBrief);
s.EOL();
- result.AppendMessage(s.GetData());
+ result.AppendMessage(s.GetString());
}
}
CommandObjectHelp::GenerateAdditionalHelpAvenuesMessage(
&error_msg_stream, command_name, nullptr, nullptr, generate_apropos,
generate_type_lookup);
- result.AppendErrorWithFormat("%s", error_msg_stream.GetData());
+ result.AppendError(error_msg_stream.GetString());
result.SetStatus(eReturnStatusFailed);
}
else {
StreamString stream;
stream.Printf("For more information run 'help %s'", name.c_str());
- SetHelp(stream.GetData());
+ SetHelp(stream.GetString());
}
}
} else {
// Don't change the status if the command already set it...
if (result.GetStatus() == eReturnStatusInvalid) {
- if (result.GetOutputData() == nullptr ||
- result.GetOutputData()[0] == '\0')
+ if (result.GetOutputData().empty())
result.SetStatus(eReturnStatusSuccessFinishNoResult);
else
result.SetStatus(eReturnStatusSuccessFinishResult);
m_fetched_help_long(false) {
StreamString stream;
stream.Printf("For more information run 'help %s'", name.c_str());
- SetHelp(stream.GetData());
+ SetHelp(stream.GetString());
if (ScriptInterpreter *scripter = m_interpreter.GetScriptInterpreter())
GetFlags().Set(scripter->GetFlagsForCommandObject(cmd_obj_sp));
}
} else {
// Don't change the status if the command already set it...
if (result.GetStatus() == eReturnStatusInvalid) {
- if (result.GetOutputData() == nullptr ||
- result.GetOutputData()[0] == '\0')
+ if (result.GetOutputData().empty())
result.SetStatus(eReturnStatusSuccessFinishNoResult);
else
result.SetStatus(eReturnStatusSuccessFinishResult);
s.Printf("\n\t%s", matches.GetStringAtIndex(match_idx));
}
s.Printf("\n");
- result.AppendError(s.GetData());
+ result.AppendError(s.GetString());
result.SetStatus(eReturnStatusFailed);
return false;
} else if (!sub_cmd_obj) {
GenerateAdditionalHelpAvenuesMessage(
&error_msg_stream, cmd_string.c_str(),
m_interpreter.GetCommandPrefix(), sub_command.c_str());
- result.AppendErrorWithFormat("%s", error_msg_stream.GetData());
+ result.AppendError(error_msg_stream.GetString());
result.SetStatus(eReturnStatusFailed);
return false;
} else {
GenerateAdditionalHelpAvenuesMessage(&error_msg_stream,
command.GetArgumentAtIndex(0),
m_interpreter.GetCommandPrefix());
- result.AppendErrorWithFormat("%s", error_msg_stream.GetData());
+ result.AppendError(error_msg_stream.GetString());
result.SetStatus(eReturnStatusFailed);
}
}
} else {
result.AppendErrorWithFormat(
"failed to create a value object for: (%s) %s\n",
- view_as_type_cstr, name_strm.GetString().c_str());
+ view_as_type_cstr, name_strm.GetData());
result.SetStatus(eReturnStatusFailed);
return false;
}
if (!buffer.GetString().empty()) {
Error error;
- if (process->WriteMemory(addr, buffer.GetString().c_str(),
+ if (process->WriteMemory(addr, buffer.GetString().data(),
buffer.GetString().size(),
error) == buffer.GetString().size())
return true;
complete_command_name << prefix << " " << command_name;
if (sub_cmd_obj->HelpTextContainsWord(search_word)) {
- commands_found.AppendString(complete_command_name.GetData());
+ commands_found.AppendString(complete_command_name.GetString());
commands_help.AppendString(sub_cmd_obj->GetHelp());
}
// a chance to call PushProcessIOHandler().
process_sp->SyncIOHandler(0, 2000);
- const char *data = stream.GetData();
- if (data && strlen(data) > 0)
- result.AppendMessage(stream.GetData());
+ llvm::StringRef data = stream.GetString();
+ if (!data.empty())
+ result.AppendMessage(data);
const char *archname =
exe_module_sp->GetArchitecture().GetArchitectureName();
result.AppendMessageWithFormat(
if (error.Success()) {
ProcessSP process_sp(target->GetProcessSP());
if (process_sp) {
- if (stream.GetData())
- result.AppendMessage(stream.GetData());
+ result.AppendMessage(stream.GetString());
result.SetStatus(eReturnStatusSuccessFinishNoResult);
result.SetDidChangeProcessState(true);
result.SetAbnormalStopWasExpected(true);
if (synchronous_execution) {
// If any state changed events had anything to say, add that to the
// result
- if (stream.GetData())
- result.AppendMessage(stream.GetData());
+ result.AppendMessage(stream.GetString());
result.SetDidChangeProcessState(true);
result.SetStatus(eReturnStatusSuccessFinishNoResult);
message.Printf("Quitting LLDB will %s one or more processes. Do you really "
"want to proceed",
(is_a_detach ? "detach from" : "kill"));
- if (!m_interpreter.Confirm(message.GetData(), true)) {
+ if (!m_interpreter.Confirm(message.GetString(), true)) {
result.SetStatus(eReturnStatusFailed);
return false;
}
result.AppendErrorWithFormat(
"Unable to create the executable or symbol file with "
"UUID %s with path %s and symbol file %s",
- strm.GetString().c_str(),
+ strm.GetData(),
module_spec.GetFileSpec().GetPath().c_str(),
module_spec.GetSymbolFileSpec().GetPath().c_str());
} else {
result.AppendErrorWithFormat(
"Unable to create the executable or symbol file with "
"UUID %s with path %s",
- strm.GetString().c_str(),
+ strm.GetData(),
module_spec.GetFileSpec().GetPath().c_str());
}
} else {
result.AppendErrorWithFormat("Unable to create the executable "
"or symbol file with UUID %s",
- strm.GetString().c_str());
+ strm.GetData());
}
result.SetStatus(eReturnStatusFailed);
return false;
module_spec.GetUUID().Dump(&strm);
result.AppendErrorWithFormat(
"Unable to locate the executable or symbol file with UUID %s",
- strm.GetString().c_str());
+ strm.GetData());
result.SetStatus(eReturnStatusFailed);
return false;
}
error_strm.PutCString(
"unable to find debug symbols for the current frame");
}
- result.AppendError(error_strm.GetData());
+ result.AppendError(error_strm.GetString());
}
} else {
result.AppendError("one or more symbol file paths must be specified, "
if (synchronous_execution) {
// If any state changed events had anything to say, add that to the
// result
- if (stream.GetData())
- result.AppendMessage(stream.GetData());
+ if (stream.GetSize() > 0)
+ result.AppendMessage(stream.GetString());
process->GetThreadList().SetSelectedThreadByID(thread->GetID());
result.SetDidChangeProcessState(true);
if (synchronous_execution) {
// If any state changed events had anything to say, add that to the
// result
- if (stream.GetData())
- result.AppendMessage(stream.GetData());
+ if (stream.GetSize() > 0)
+ result.AppendMessage(stream.GetString());
result.SetDidChangeProcessState(true);
result.SetStatus(eReturnStatusSuccessFinishNoResult);
if (synchronous_execution) {
// If any state changed events had anything to say, add that to the
// result
- if (stream.GetData())
- result.AppendMessage(stream.GetData());
+ if (stream.GetSize() > 0)
+ result.AppendMessage(stream.GetString());
result.SetDidChangeProcessState(true);
result.SetStatus(eReturnStatusSuccessFinishNoResult);
m_discovery_function(discovery_func) {
StreamString name;
name.Printf("type %s info", formatter_name);
- SetCommandName(name.GetData());
+ SetCommandName(name.GetString());
StreamString help;
help.Printf("This command evaluates the provided expression and shows "
"which %s is applied to the resulting value (if any).",
formatter_name);
- SetHelp(help.GetData());
+ SetHelp(help.GetString());
StreamString syntax;
syntax.Printf("type %s info <expr>", formatter_name);
- SetSyntax(syntax.GetData());
+ SetSyntax(syntax.GetString());
}
~CommandObjectFormatterInfo() override = default;
DumpStyleResolvedDescription,
DumpStyleInvalid, addr_size)) {
s->Address(dereferenced_load_addr, addr_size, " -> ", " ");
- s->Write(strm.GetData(), strm.GetSize());
+ s->Write(strm.GetString().data(), strm.GetSize());
return true;
}
}
if ((count % num_per_line) == 0) {
// Print out any previous string
if (sstr.GetSize() > 0) {
- log->Printf("%s", sstr.GetData());
+ log->PutString(sstr.GetString());
sstr.Clear();
}
// Reset string offset and fill the current line string with address:
}
}
- if (sstr.GetSize() > 0)
- log->Printf("%s", sstr.GetData());
+ if (!sstr.Empty())
+ log->PutString(sstr.GetString());
return offset; // Return the offset at which we ended up
}
stream_sp->Printf("%s\n", error.AsCString());
}
if (feedback_stream.GetSize())
- stream_sp->Printf("%s", feedback_stream.GetData());
+ stream_sp->PutCString(feedback_stream.GetString());
}
}
}
ss.PutCString(" ; ");
ss.PutCString(m_comment);
}
- s->Write(ss.GetData(), ss.GetSize());
+ s->PutCString(ss.GetString());
}
bool Instruction::DumpEmulation(const ArchSpec &arch) {
StreamString strm(Stream::eBinary, GetAddressByteSize(), GetByteOrder());
strm.PutMaxHex64(uval, uval_byte_size);
- size_t bytes_written = m_write_mem_callback(this, m_baton, context, addr,
- strm.GetData(), uval_byte_size);
+ size_t bytes_written = m_write_mem_callback(
+ this, m_baton, context, addr, strm.GetString().data(), uval_byte_size);
return (bytes_written == uval_byte_size);
}
// The error string value will remain until the error value is
// cleared or a new error value/type is assigned.
//----------------------------------------------------------------------
-void Error::SetErrorString(const char *err_str) {
- if (err_str != nullptr && err_str[0]) {
- // If we have an error string, we should always at least have
- // an error set to a generic value.
+void Error::SetErrorString(llvm::StringRef err_str) {
+ if (!err_str.empty()) {
+ // If we have an error string, we should always at least have an error
+ // set to a generic value.
if (Success())
SetErrorToGenericError();
- m_string = err_str;
- } else
- m_string.clear();
+ }
+ m_string = err_str;
}
//------------------------------------------------------------------
static_cast<const void *>(this),
static_cast<void *>(broadcaster),
broadcaster->GetBroadcasterName().GetCString(), m_type,
- event_name.GetString().c_str());
+ event_name.GetData());
else
s->Printf("%p Event: broadcaster = %p (%s), type = 0x%8.8x, data = ",
static_cast<const void *>(this),
bitfield_name.Printf("%s:%d", target->GetTypeName().AsCString(),
target->GetBitfieldBitSize());
lldb::TypeNameSpecifierImplSP type_sp(
- new TypeNameSpecifierImpl(bitfield_name.GetData(), false));
+ new TypeNameSpecifierImpl(bitfield_name.GetString(), false));
if (val_obj_display ==
ValueObject::eValueObjectRepresentationStyleSummary &&
!DataVisualization::GetSummaryForType(type_sp))
// should not happen
if (success)
- s << str_temp.GetData();
+ s << str_temp.GetString();
return true;
} else {
if (was_plain_var) // if ${var}
sc, exe_ctx, Language::FunctionNameRepresentation::eName, ss);
}
if (language_plugin_handled) {
- s.PutCString(ss.GetData());
+ s << ss.GetString();
return true;
} else {
const char *name = nullptr;
ss);
}
if (language_plugin_handled) {
- s.PutCString(ss.GetData());
+ s << ss.GetString();
return true;
} else {
ConstString name;
sc, exe_ctx, Language::FunctionNameRepresentation::eNameWithArgs, ss);
}
if (language_plugin_handled) {
- s.PutCString(ss.GetData());
+ s << ss.GetString();
return true;
} else {
// Print the function name with arguments in it
ValueObjectSP var_value_sp(
ValueObjectVariable::Create(exe_scope, var_sp));
StreamString ss;
- const char *var_representation = nullptr;
+ llvm::StringRef var_representation;
const char *var_name = var_value_sp->GetName().GetCString();
if (var_value_sp->GetCompilerType().IsValid()) {
if (var_value_sp && exe_scope->CalculateTarget())
"");
format.FormatObject(var_value_sp.get(), buffer,
TypeSummaryOptions());
- var_representation = buffer.c_str();
+ var_representation = buffer;
} else
var_value_sp->DumpPrintableRepresentation(
ss, ValueObject::ValueObjectRepresentationStyle::
false);
}
- if (ss.GetData() && ss.GetSize())
- var_representation = ss.GetData();
+ if (!ss.GetString().empty())
+ var_representation = ss.GetString();
if (arg_idx > 0)
s.PutCString(", ");
if (var_value_sp->GetError().Success()) {
- if (var_representation)
- s.Printf("%s=%s", var_name, var_representation);
+ if (!var_representation.empty())
+ s.Printf("%s=%s", var_name, var_representation.str().c_str());
else
s.Printf("%s=%s at %s", var_name,
var_value_sp->GetTypeName().GetCString(),
"access one of its children: ",
entry_def->name);
DumpCommaSeparatedChildEntryNames(error_strm, entry_def);
- error.SetErrorStringWithFormat("%s",
- error_strm.GetString().c_str());
+ error.SetErrorStringWithFormat("%s", error_strm.GetData());
} else if (sep_char == ':') {
// Any value whose separator is a with a ':' means this value has a
// string argument
error_strm.Printf("invalid member '%s' in '%s'. Valid members are: ",
key.str().c_str(), parent->name);
DumpCommaSeparatedChildEntryNames(error_strm, parent);
- error.SetErrorStringWithFormat("%s", error_strm.GetString().c_str());
+ error.SetErrorStringWithFormat("%s", error_strm.GetData());
return error;
}
if (FormatEntity::Format(m_format, strm, &sc, &exe_ctx, nullptr,
nullptr, false, false)) {
int right_pad = 1;
- window.PutCStringTruncated(strm.GetString().c_str(), right_pad);
+ window.PutCStringTruncated(strm.GetString().str().c_str(), right_pad);
}
}
}
if (FormatEntity::Format(m_format, strm, nullptr, &exe_ctx, nullptr,
nullptr, false, false)) {
int right_pad = 1;
- window.PutCStringTruncated(strm.GetString().c_str(), right_pad);
+ window.PutCStringTruncated(strm.GetString().str().c_str(), right_pad);
}
}
}
if (FormatEntity::Format(m_format, strm, nullptr, &exe_ctx, nullptr,
nullptr, false, false)) {
int right_pad = 1;
- window.PutCStringTruncated(strm.GetString().c_str(), right_pad);
+ window.PutCStringTruncated(strm.GetString().str().c_str(), right_pad);
}
}
}
StreamString key_description;
key_description.Printf("%10s - %s", CursesKeyToCString(key->ch),
key->description);
- m_text.AppendString(std::move(key_description.GetString()));
+ m_text.AppendString(key_description.GetString());
}
}
}
thread_menu_title.Printf(" %s", queue_name);
}
menu.AddSubmenu(
- MenuSP(new Menu(thread_menu_title.GetString().c_str(), nullptr,
- menu_char, thread_sp->GetID())));
+ MenuSP(new Menu(thread_menu_title.GetString().str().c_str(),
+ nullptr, menu_char, thread_sp->GetID())));
}
} else if (submenus.size() > 7) {
// Remove the separator and any other thread submenu items
if (thread && FormatEntity::Format(m_format, strm, nullptr, &exe_ctx,
nullptr, nullptr, false, false)) {
window.MoveCursor(40, 0);
- window.PutCStringTruncated(strm.GetString().c_str(), 1);
+ window.PutCStringTruncated(strm.GetString().str().c_str(), 1);
}
window.MoveCursor(60, 0);
window.AttributeOn(A_REVERSE);
window.MoveCursor(1, 1);
window.PutChar(' ');
- window.PutCStringTruncated(m_title.GetString().c_str(), 1);
+ window.PutCStringTruncated(m_title.GetString().str().c_str(), 1);
int x = window.GetCursorX();
if (x < window_width - 1) {
window.Printf("%*s", window_width - x - 1, "");
strm.Printf("%s", mnemonic);
int right_pad = 1;
- window.PutCStringTruncated(strm.GetString().c_str(), right_pad);
+ window.PutCStringTruncated(strm.GetData(), right_pad);
if (is_pc_line && frame_sp &&
frame_sp->GetConcreteFrameIndex() == 0) {
const Flags &Log::GetMask() const { return m_mask_bits; }
void Log::PutCString(const char *cstr) { Printf("%s", cstr); }
+void Log::PutString(llvm::StringRef str) { PutCString(str.str().c_str()); }
//----------------------------------------------------------------------
// Simple variable argument logging with flags.
if (m_objfile_sp) {
StreamString s;
s.Printf("0x%16.16" PRIx64, header_addr);
- m_object_name.SetCString(s.GetData());
+ m_object_name.SetString(s.GetString());
// Once we get the object file, update our module with the object
// file's
if (last_char != '\n' || last_char != '\r')
strm.EOL();
}
- Host::SystemLog(Host::eSystemLogError, "%s", strm.GetString().c_str());
+ Host::SystemLog(Host::eSystemLogError, "%s", strm.GetData());
}
}
}
strm.PutCString("The debug session should be aborted as the original "
"debug information has been overwritten.\n");
- Host::SystemLog(Host::eSystemLogError, "%s", strm.GetString().c_str());
+ Host::SystemLog(Host::eSystemLogError, "%s", strm.GetData());
}
}
}
if (last_char != '\n' || last_char != '\r')
strm.EOL();
}
- Host::SystemLog(Host::eSystemLogWarning, "%s", strm.GetString().c_str());
+ Host::SystemLog(Host::eSystemLogWarning, "%s", strm.GetData());
}
}
va_start(args, format);
log_message.PrintfVarArg(format, args);
va_end(args);
- log->PutCString(log_message.GetString().c_str());
+ log->PutCString(log_message.GetData());
}
}
llvm::sys::PrintStackTrace(stream);
log_message.PutCString(back_trace);
}
- log->PutCString(log_message.GetString().c_str());
+ log->PutCString(log_message.GetData());
}
}
format_string.Printf("%%%us", reg_name_right_align_at);
else
format_string.Printf("%%s");
- const char *fmt = format_string.GetData();
+ std::string fmt = format_string.GetString();
if (prefix_with_name) {
if (reg_info->name) {
- s->Printf(fmt, reg_info->name);
+ s->Printf(fmt.c_str(), reg_info->name);
name_printed = true;
} else if (reg_info->alt_name) {
- s->Printf(fmt, reg_info->alt_name);
+ s->Printf(fmt.c_str(), reg_info->alt_name);
prefix_with_alt_name = false;
name_printed = true;
}
if (name_printed)
s->PutChar('/');
if (reg_info->alt_name) {
- s->Printf(fmt, reg_info->alt_name);
+ s->Printf(fmt.c_str(), reg_info->alt_name);
name_printed = true;
} else if (!name_printed) {
// No alternate name but we were asked to display a name, so show the
// main name
- s->Printf(fmt, reg_info->name);
+ s->Printf(fmt.c_str(), reg_info->name);
name_printed = true;
}
}
bool StreamString::Empty() const { return GetSize() == 0; }
-const char *StreamString::GetData() const { return m_packet.c_str(); }
-
size_t StreamString::GetSize() const { return m_packet.size(); }
size_t StreamString::GetSizeOfLastLine() const {
}
}
-std::string &StreamString::GetString() { return m_packet; }
-
-const std::string &StreamString::GetString() const { return m_packet; }
+llvm::StringRef StreamString::GetString() const { return m_packet; }
void StreamString::FillLastLineToColumn(uint32_t column, char fill_char) {
const size_t length = m_packet.size();
strm << item_preamble;
strm << GetStringAtIndex(i);
}
- return std::string(strm.GetData());
+ return strm.GetString();
}
StringList &StringList::operator<<(const char *str) {
-//===---------------------StructuredData.cpp ---------------------*- C++
-//-*-===//
+//===---------------------StructuredData.cpp ---------------------*- C++-*-===//
//
// The LLVM Compiler Infrastructure
//
void StructuredData::Object::DumpToStdout(bool pretty_print) const {
StreamString stream;
Dump(stream, pretty_print);
- printf("%s\n", stream.GetString().c_str());
+ printf("%s\n", stream.GetData());
}
void StructuredData::Array::Dump(Stream &s, bool pretty_print) const {
uint32_t addr_nibble_size = data.GetAddressByteSize() * 2;
sstr.Printf("0x%*.*llx", addr_nibble_size, addr_nibble_size,
value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS));
- m_location_str.swap(sstr.GetString());
+ m_location_str = sstr.GetString();
} break;
}
}
static bool CopyStringDataToBufferSP(const StreamString &source,
lldb::DataBufferSP &destination) {
destination.reset(new DataBufferHeap(source.GetSize() + 1, 0));
- memcpy(destination->GetBytes(), source.GetString().c_str(), source.GetSize());
+ memcpy(destination->GetBytes(), source.GetString().data(), source.GetSize());
return true;
}
}
if (runtime && runtime->GetObjectDescription(s, *this)) {
- m_object_desc_str.append(s.GetData());
+ m_object_desc_str.append(s.GetString());
}
if (m_object_desc_str.empty())
bool var_success = false;
{
- const char *cstr = NULL;
+ llvm::StringRef str;
// this is a local stream that we are using to ensure that the data pointed
- // to by cstr survives
- // long enough for us to copy it to its destination - it is necessary to
- // have this temporary storage
- // area for cases where our desired output is not backed by some other
- // longer-term storage
+ // to by cstr survives long enough for us to copy it to its destination - it
+ // is necessary to have this temporary storage area for cases where our
+ // desired output is not backed by some other longer-term storage
StreamString strm;
if (custom_format != eFormatInvalid)
switch (val_obj_display) {
case eValueObjectRepresentationStyleValue:
- cstr = GetValueAsCString();
+ str = GetValueAsCString();
break;
case eValueObjectRepresentationStyleSummary:
- cstr = GetSummaryAsCString();
+ str = GetSummaryAsCString();
break;
case eValueObjectRepresentationStyleLanguageSpecific:
- cstr = GetObjectDescription();
+ str = GetObjectDescription();
break;
case eValueObjectRepresentationStyleLocation:
- cstr = GetLocationAsCString();
+ str = GetLocationAsCString();
break;
case eValueObjectRepresentationStyleChildrenCount:
strm.Printf("%" PRIu64 "", (uint64_t)GetNumChildren());
- cstr = strm.GetString().c_str();
+ str = strm.GetString();
break;
case eValueObjectRepresentationStyleType:
- cstr = GetTypeName().AsCString();
+ str = GetTypeName().GetStringRef();
break;
case eValueObjectRepresentationStyleName:
- cstr = GetName().AsCString();
+ str = GetName().GetStringRef();
break;
case eValueObjectRepresentationStyleExpressionPath:
GetExpressionPath(strm, false);
- cstr = strm.GetString().c_str();
+ str = strm.GetString();
break;
}
- if (!cstr) {
+ if (str.empty()) {
if (val_obj_display == eValueObjectRepresentationStyleValue)
- cstr = GetSummaryAsCString();
+ str = GetSummaryAsCString();
else if (val_obj_display == eValueObjectRepresentationStyleSummary) {
if (!CanProvideValue()) {
strm.Printf("%s @ %s", GetTypeName().AsCString(),
GetLocationAsCString());
- cstr = strm.GetString().c_str();
+ str = strm.GetString();
} else
- cstr = GetValueAsCString();
+ str = GetValueAsCString();
}
}
- if (cstr)
- s.PutCString(cstr);
+ if (!str.empty())
+ s << str;
else {
if (m_error.Fail()) {
if (do_dump_error)
if (is_pointer_or_reference_type)
error.SetErrorStringWithFormat("dereference failed: (%s) %s",
GetTypeName().AsCString("<invalid type>"),
- strm.GetString().c_str());
+ strm.GetData());
else
error.SetErrorStringWithFormat("not a pointer or reference type: (%s) %s",
GetTypeName().AsCString("<invalid type>"),
- strm.GetString().c_str());
+ strm.GetData());
return ValueObjectSP();
}
}
StreamString expr_path_strm;
GetExpressionPath(expr_path_strm, true);
error.SetErrorStringWithFormat("'%s' is not in memory",
- expr_path_strm.GetString().c_str());
+ expr_path_strm.GetData());
} break;
case eAddressTypeFile:
StreamString expr_path_strm;
GetExpressionPath(expr_path_strm, true);
error.SetErrorStringWithFormat("'%s' doesn't have a valid address",
- expr_path_strm.GetString().c_str());
+ expr_path_strm.GetData());
}
return m_addr_of_valobj_sp;
-//===-- FormatManager.cpp -------------------------------------------*- C++
-//-*-===//
+//===-- FormatManager.cpp ----------------------------------------*- C++-*-===//
//
// The LLVM Compiler Infrastructure
//
if (valobj.GetBitfieldBitSize() > 0) {
StreamString sstring;
sstring.Printf("%s:%d", type_name.AsCString(), valobj.GetBitfieldBitSize());
- ConstString bitfieldname = ConstString(sstring.GetData());
+ ConstString bitfieldname(sstring.GetString());
entries.push_back(
{bitfieldname, 0, did_strip_ptr, did_strip_ref, did_strip_typedef});
reason |= lldb_private::eFormatterChoiceCriterionStrippedBitField;
-//===-- TypeCategory.cpp -------------------------------------------*- C++
-//-*-===//
+//===-- TypeCategory.cpp -----------------------------------------*- C++-*-===//
//
// The LLVM Compiler Infrastructure
//
idx + 1 < GetNumLanguages() ? ", " : "");
}
if (print_lang)
- stream.Printf("%s", lang_stream.GetData());
+ stream.PutCString(lang_stream.GetString());
stream.PutChar(')');
- return stream.GetData();
+ return stream.GetString();
}
data.Dump(®_sstr, 0, GetFormat(), reg_info->byte_size, 1, UINT32_MAX,
LLDB_INVALID_ADDRESS, 0, 0,
exe_ctx.GetBestExecutionContextScope());
- dest.swap(reg_sstr.GetString());
+ dest = reg_sstr.GetString();
}
} else {
CompilerType compiler_type = value.GetCompilerType();
// return from here, but that's about as severe as we get
// CompilerType::DumpTypeValue() should always return
// something, even if that something is an error message
- if (sstr.GetString().empty())
- dest.clear();
- else
- dest.swap(sstr.GetString());
+ dest = sstr.GetString();
}
}
return !dest.empty();
data.GetByteSize(), 0, 0,
exe_ctx.GetBestExecutionContextScope());
if (!sstr.GetString().empty())
- dest.swap(sstr.GetString());
+ dest = sstr.GetString();
return !dest.empty();
}
if (IsOneLiner()) {
ValueObjectPrinter printer(valobj, &s, DumpValueObjectOptions());
printer.PrintChildrenOneLiner(HideNames(valobj));
- retval.assign(s.GetData());
+ retval = s.GetString();
return true;
} else {
if (FormatEntity::Format(m_format, s, &sc, &exe_ctx,
StreamString stream;
if (!m_impl || m_impl(*valobj, stream, options) == false)
return false;
- dest.assign(stream.GetData());
+ dest = stream.GetString();
return true;
}
-//===-- ValueObjectPrinter.cpp -------------------------------------*- C++
-//-*-===//
+//===-- ValueObjectPrinter.cpp -----------------------------------*- C++-*-===//
//
// The LLVM Compiler Infrastructure
//
}
if (m_options.m_decl_printing_helper) {
- ConstString type_name_cstr(typeName.GetData());
- ConstString var_name_cstr(varName.GetData());
+ ConstString type_name_cstr(typeName.GetString());
+ ConstString var_name_cstr(varName.GetString());
StreamString dest_stream;
if (m_options.m_decl_printing_helper(type_name_cstr, var_name_cstr,
m_options, dest_stream)) {
decl_printed = true;
- m_stream->Printf("%s", dest_stream.GetData());
+ m_stream->PutCString(dest_stream.GetString());
}
}
// if the helper failed, or there is none, do a default thing
if (!decl_printed) {
- if (typeName.GetSize())
+ if (!typeName.Empty())
m_stream->Printf("(%s) ", typeName.GetData());
- if (varName.GetSize())
+ if (!varName.Empty())
m_stream->Printf("%s =", varName.GetData());
else if (!m_options.m_hide_name)
m_stream->Printf(" =");
StreamString idx_name;
idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx);
- child_sp->SetName(ConstString(idx_name.GetData()));
+ child_sp->SetName(ConstString(idx_name.GetString()));
child_sp->SetFormat(m_item_format);
m_failed_lookups.clear();
- error.SetErrorString(ss.GetData());
+ error.SetErrorString(ss.GetString());
return;
}
StreamString ss;
if (!call_plan_sp || !call_plan_sp->ValidatePlan(&ss)) {
- diagnostic_manager.PutString(eDiagnosticSeverityError, ss.GetData());
+ diagnostic_manager.PutString(eDiagnosticSeverityError, ss.GetString());
return lldb::eExpressionSetupError;
}
}
}
- log->PutCString(dump_stream.GetData());
+ log->PutString(dump_stream.GetString());
}
void Wipe(IRMemoryMap &map, lldb::addr_t process_address) override {}
}
}
- log->PutCString(dump_stream.GetData());
+ log->PutString(dump_stream.GetString());
}
void Wipe(IRMemoryMap &map, lldb::addr_t process_address) override {
}
}
- log->PutCString(dump_stream.GetData());
+ log->PutString(dump_stream.GetString());
}
void Wipe(IRMemoryMap &map, lldb::addr_t process_address) override {
}
}
- log->PutCString(dump_stream.GetData());
+ log->PutString(dump_stream.GetString());
}
void Wipe(IRMemoryMap &map, lldb::addr_t process_address) override {}
}
}
- log->PutCString(dump_stream.GetData());
+ log->PutString(dump_stream.GetString());
}
void Wipe(IRMemoryMap &map, lldb::addr_t process_address) override {}
StreamString applescript_source;
- const char *tty_command = command.GetString().c_str();
// if (tty_name && tty_name[0])
// {
// applescript_source.Printf (applscript_in_existing_tty,
// }
// else
// {
- applescript_source.Printf(applscript_in_new_tty, tty_command);
+ applescript_source.Printf(applscript_in_new_tty,
+ command.GetString().str().c_str());
// }
- const char *script_source = applescript_source.GetString().c_str();
// puts (script_source);
NSAppleScript *applescript = [[NSAppleScript alloc]
- initWithSource:[NSString stringWithCString:script_source
+ initWithSource:[NSString stringWithCString:applescript_source.GetString()
+ .str()
+ .c_str()
encoding:NSUTF8StringEncoding]];
lldb::pid_t pid = LLDB_INVALID_PROCESS_ID;
if (format) {
va_list args;
va_start(args, format);
- g_crash_description.GetString().clear();
+ g_crash_description.GetString() = llvm::StringRef("");
g_crash_description.PrintfVarArg(format, args);
va_end(args);
__crashreporter_info__ = g_crash_description.GetData();
StreamString strm;
strm.Printf("connect://%s:%u", tcp_socket->GetRemoteIPAddress().c_str(),
tcp_socket->GetRemotePortNumber());
- m_uri.swap(strm.GetString());
+ m_uri = strm.GetString();
}
int status;
std::string output;
- RunShellCommand(expand_command.GetData(), launch_info.GetWorkingDirectory(),
- &status, nullptr, &output, 10);
+ std::string command = expand_command.GetString();
+ RunShellCommand(command.c_str(), launch_info.GetWorkingDirectory(), &status,
+ nullptr, &output, 10);
if (status != 0) {
error.SetErrorStringWithFormat("lldb-argdumper exited with error %d",
for (int i = 0; enum_values[i].string_value != nullptr; i++) {
strm.Printf("%s\"%s\"", i > 0 ? ", " : "", enum_values[i].string_value);
}
- error.SetErrorString(strm.GetData());
+ error.SetErrorString(strm.GetString());
return fail_value;
}
if (byte_size_ptr)
error_strm.PutCString(
"An optional byte size can precede the format character.\n");
- error.SetErrorString(error_strm.GetString().c_str());
+ error.SetErrorString(error_strm.GetString());
}
if (error.Fail())
int val;
while (1) {
int long_options_index = -1;
- val =
- OptionParser::Parse(GetArgumentCount(), GetArgumentVector(),
- sstr.GetData(), long_options, &long_options_index);
+ val = OptionParser::Parse(GetArgumentCount(), GetArgumentVector(),
+ sstr.GetString(), long_options,
+ &long_options_index);
if (val == -1)
break;
}
if (!option_arg)
option_arg = "<no-argument>";
- option_arg_vector->emplace_back(option_str.GetData(), has_arg, option_arg);
+ option_arg_vector->emplace_back(option_str.GetString(), has_arg,
+ option_arg);
// Find option in the argument list; also see if it was supposed to take
// an argument and if one was supplied. Remove option (and argument, if
translation_and_help.Printf(
"(%s) %s", sstr.GetData(),
GetUnderlyingCommand()->GetHelp().str().c_str());
- SetHelp(translation_and_help.GetData());
+ SetHelp(translation_and_help.GetString());
}
}
}
StreamString defaultshell;
defaultshell.Printf("--shell=%s --",
HostInfo::GetDefaultShell().GetPath().c_str());
- AddAlias("r", cmd_obj_sp, defaultshell.GetData());
- AddAlias("run", cmd_obj_sp, defaultshell.GetData());
+ AddAlias("r", cmd_obj_sp, defaultshell.GetString());
+ AddAlias("run", cmd_obj_sp, defaultshell.GetString());
#endif
#endif
}
result_str.Printf("%s", alias_cmd_obj->GetCommandName().str().c_str());
if (!option_arg_vector_sp.get()) {
- alias_result = result_str.GetData();
+ alias_result = result_str.GetString();
return alias_cmd_obj;
}
OptionArgVector *option_arg_vector = option_arg_vector_sp.get();
}
}
- alias_result = result_str.GetData();
+ alias_result = result_str.GetString();
return alias_cmd_obj;
}
scalar.GetValue(&value_strm, show_type);
size_t value_string_size = value_strm.GetSize();
if (value_string_size) {
- command.insert(start_backtick, value_strm.GetData(),
- value_string_size);
+ command.insert(start_backtick, value_strm.GetString());
pos = start_backtick + value_string_size;
continue;
} else {
}
if (!success || !tmp_result.Succeeded()) {
- const char *error_msg = tmp_result.GetErrorData();
- if (error_msg == nullptr || error_msg[0] == '\0')
+ llvm::StringRef error_msg = tmp_result.GetErrorData();
+ if (error_msg.empty())
error_msg = "<unknown error>.\n";
if (options.GetStopOnError()) {
result.AppendErrorWithFormat(
"Aborting reading of commands after command #%" PRIu64
": '%s' failed with %s",
- (uint64_t)idx, cmd, error_msg);
+ (uint64_t)idx, cmd, error_msg.str().c_str());
result.SetStatus(eReturnStatusFailed);
m_debugger.SetAsyncExecution(old_async_execution);
return;
} else if (options.GetPrintResults()) {
- result.AppendMessageWithFormat("Command #%" PRIu64
- " '%s' failed with %s",
- (uint64_t)idx + 1, cmd, error_msg);
+ result.AppendMessageWithFormat(
+ "Command #%" PRIu64 " '%s' failed with %s", (uint64_t)idx + 1, cmd,
+ error_msg.str().c_str());
}
}
StreamString prefix_stream;
prefix_stream.Printf(" %-*s %*s ", (int)max_word_len, word_text.data(),
(int)separator.size(), separator.data());
- OutputFormattedHelpText(strm, prefix_stream.GetData(), help_text);
+ OutputFormattedHelpText(strm, prefix_stream.GetString(), help_text);
+}
+
+LLVM_ATTRIBUTE_ALWAYS_INLINE
+static size_t nextWordLength(llvm::StringRef S) {
+ size_t pos = S.find_first_of(' ');
+ if (pos == llvm::StringRef::npos)
+ return S.size();
+ return pos;
}
void CommandInterpreter::OutputHelpText(Stream &strm, llvm::StringRef word_text,
const uint32_t max_columns = m_debugger.GetTerminalWidth();
- size_t len = text_strm.GetSize();
- const char *text = text_strm.GetData();
+ llvm::StringRef text = text_strm.GetString();
uint32_t chars_left = max_columns;
- for (uint32_t i = 0; i < len; i++) {
- if ((text[i] == ' ' && ::strchr((text + i + 1), ' ') &&
- chars_left < static_cast<uint32_t>(::strchr((text + i + 1), ' ') -
- (text + i))) ||
- text[i] == '\n') {
- chars_left = max_columns - indent_size;
+ while (!text.empty()) {
+ if (text.front() == '\n' ||
+ (text.front() == ' ' && nextWordLength(text.ltrim(' ')) < chars_left)) {
strm.EOL();
strm.Indent();
+ chars_left = max_columns - indent_size;
+ if (text.front() == '\n')
+ text = text.drop_front();
+ else
+ text = text.ltrim(' ');
} else {
- strm.PutChar(text[i]);
- chars_left--;
+ strm.PutChar(text.front());
+ --chars_left;
+ text = text.drop_front();
}
}
GetProcessOutput();
if (!result.GetImmediateOutputStream()) {
- const char *output = result.GetOutputData();
- if (output && output[0])
+ llvm::StringRef output = result.GetOutputData();
+ if (!output.empty())
io_handler.GetOutputStreamFile()->PutCString(output);
}
// Now emit the command error text from the command we just executed
if (!result.GetImmediateErrorStream()) {
- const char *error = result.GetErrorData();
- if (error && error[0])
+ llvm::StringRef error = result.GetErrorData();
+ if (!error.empty())
io_handler.GetErrorStreamFile()->PutCString(error);
}
}
for (uint32_t i = 0; i < num_matches; ++i) {
error_msg.Printf("\t%s\n", matches.GetStringAtIndex(i));
}
- result.AppendRawError(error_msg.GetString().c_str());
+ result.AppendRawError(error_msg.GetString());
} else {
// We didn't have only one match, otherwise we wouldn't get here.
assert(num_matches == 0);
std::string gdb_format_option("--gdb-format=");
gdb_format_option += (suffix.c_str() + 1);
- bool inserted = false;
- std::string &cmd = revised_command_line.GetString();
+ std::string cmd = revised_command_line.GetString();
size_t arg_terminator_idx = FindArgumentTerminator(cmd);
if (arg_terminator_idx != std::string::npos) {
// Insert the gdb format option before the "--" that terminates
// options
gdb_format_option.append(1, ' ');
cmd.insert(arg_terminator_idx, gdb_format_option);
- inserted = true;
- }
-
- if (!inserted)
+ revised_command_line.Clear();
+ revised_command_line.PutCString(cmd);
+ } else
revised_command_line.Printf(" %s", gdb_format_option.c_str());
if (wants_raw_input &&
revised_command_line.Printf(" %s", scratch_command.c_str());
if (cmd_obj != NULL)
- command_line = revised_command_line.GetData();
+ command_line = revised_command_line.GetString();
return cmd_obj;
}
syntax_str.PutCString("-- ");
GetFormattedCommandArguments(syntax_str);
}
- m_cmd_syntax = syntax_str.GetData();
+ m_cmd_syntax = syntax_str.GetString();
return m_cmd_syntax;
}
if (entry->help_function) {
llvm::StringRef help_text = entry->help_function();
if (!entry->help_function.self_formatting) {
- interpreter.OutputFormattedHelpText(str, name_str.GetData(), "--",
+ interpreter.OutputFormattedHelpText(str, name_str.GetString(), "--",
help_text, name_str.GetSize());
} else {
- interpreter.OutputHelpText(str, name_str.GetData(), "--", help_text,
+ interpreter.OutputHelpText(str, name_str.GetString(), "--", help_text,
name_str.GetSize());
}
} else
- interpreter.OutputFormattedHelpText(str, name_str.GetData(), "--",
+ interpreter.OutputFormattedHelpText(str, name_str.GetString(), "--",
entry->help_text, name_str.GetSize());
}
if (entry)
return entry->arg_name;
- StreamString str;
- str << "Arg name for type (" << arg_type << ") not in arg table!";
- return str.GetData();
+ return nullptr;
}
bool CommandObject::IsPairType(ArgumentRepetitionType arg_repeat_type) {
names.Printf(" | ");
names.Printf("%s", GetArgumentName(arg_entry[j].arg_type));
}
+
+ std::string name_str = names.GetString();
switch (arg_entry[0].arg_repetition) {
case eArgRepeatPlain:
- str.Printf("<%s>", names.GetData());
+ str.Printf("<%s>", name_str.c_str());
break;
case eArgRepeatPlus:
- str.Printf("<%s> [<%s> [...]]", names.GetData(), names.GetData());
+ str.Printf("<%s> [<%s> [...]]", name_str.c_str(), name_str.c_str());
break;
case eArgRepeatStar:
- str.Printf("[<%s> [<%s> [...]]]", names.GetData(), names.GetData());
+ str.Printf("[<%s> [<%s> [...]]]", name_str.c_str(), name_str.c_str());
break;
case eArgRepeatOptional:
- str.Printf("[<%s>]", names.GetData());
+ str.Printf("[<%s>]", name_str.c_str());
break;
case eArgRepeatRange:
- str.Printf("<%s_1> .. <%s_n>", names.GetData(), names.GetData());
+ str.Printf("<%s_1> .. <%s_n>", name_str.c_str(), name_str.c_str());
break;
// Explicitly test for all the rest of the cases, so if new types get
// added we will notice the
sstrm.PrintfVarArg(format, args);
va_end(args);
- GetOutputStream().Printf("%s", sstrm.GetData());
+ GetOutputStream() << sstrm.GetString();
}
void CommandReturnObject::AppendWarningWithFormat(const char *format, ...) {
sstrm.PrintfVarArg(format, args);
va_end(args);
- GetErrorStream().Printf("warning: %s", sstrm.GetData());
+ GetErrorStream() << "warning: " << sstrm.GetString();
}
void CommandReturnObject::AppendMessage(llvm::StringRef in_string) {
m_enumerations.GetCStringAtIndex(i).str().c_str());
}
}
- error.SetErrorString(error_strm.GetData());
+ error.SetErrorString(error_strm.GetString());
}
break;
}
error_strm.Printf("%s%s%s", " ",
Language::GetNameForLanguageType(language), "\n");
}
- error.SetErrorString(error_strm.GetData());
+ error.SetErrorString(error_strm.GetString());
}
} break;
if (cmd->WantsRawCommandString() && !only_print_args)
strm.Printf(" --");
- strm.Printf(" %s", args_str.GetData());
+ strm << " " << args_str.GetString();
if (only_print_args)
break;
}
if (!only_print_args)
strm.PutChar('\n');
strm.Indent(name);
- strm.Printf(" %s", arguments_str.GetData());
+ strm << " " << arguments_str.GetString();
}
strm.Printf("\n\n");
strm.EOL();
if (m_value_sp->DumpQualifiedName(qualified_name))
- strm.Printf("'%s' variables:\n\n", qualified_name.GetString().c_str());
+ strm.Printf("'%s' variables:\n\n", qualified_name.GetData());
sub_properties->DumpAllDescriptions(interpreter, strm);
} else {
if (display_qualified_name) {
StreamString qualified_name;
DumpQualifiedName(qualified_name);
- interpreter.OutputFormattedHelpText(
- strm, qualified_name.GetString().c_str(), "--", desc, output_width);
+ interpreter.OutputFormattedHelpText(strm, qualified_name.GetString(),
+ "--", desc, output_width);
} else {
- interpreter.OutputFormattedHelpText(strm, m_name.GetCString(), "--", desc,
- output_width);
+ interpreter.OutputFormattedHelpText(strm, m_name.GetStringRef(), "--",
+ desc, output_width);
}
}
}
for (size_t i = 0; i < args.size(); ++i)
s.Printf(", arg%d = 0x%" PRIx64, static_cast<int>(i + 1), args[i]);
s.PutCString(")");
- log->PutCString(s.GetString().c_str());
+ log->PutString(s.GetString());
}
const uint32_t pc_reg_num = reg_ctx->ConvertRegisterKindToRegisterNumber(
for (size_t i = 0; i < args.size(); ++i)
s.Printf(", arg%d = 0x%" PRIx64, static_cast<int>(i + 1), args[i]);
s.PutCString(")");
- log->PutCString(s.GetString().c_str());
+ log->PutString(s.GetString());
}
// x0 - x7 contain first 8 simple args
for (size_t i = 0; i < args.size(); ++i)
s.Printf(", arg%zd = 0x%" PRIx64, i + 1, args[i]);
s.PutCString(")");
- log->PutCString(s.GetString().c_str());
+ log->PutString(s.GetString());
}
RegisterContext *reg_ctx = thread.GetRegisterContext().get();
for (size_t i = 0; i < args.size(); ++i)
s.Printf(", arg%zd = 0x%" PRIx64, i + 1, args[i]);
s.PutCString(")");
- log->PutCString(s.GetString().c_str());
+ log->PutString(s.GetString());
}
RegisterContext *reg_ctx = thread.GetRegisterContext().get();
s.Printf(", arg%" PRIu64 " = 0x%" PRIx64, static_cast<uint64_t>(i + 1),
args[i]);
s.PutCString(")");
- log->PutCString(s.GetString().c_str());
+ log->PutString(s.GetString());
}
RegisterContext *reg_ctx = thread.GetRegisterContext().get();
s.Printf(", arg%" PRIu64 " = 0x%" PRIx64, static_cast<uint64_t>(i + 1),
args[i]);
s.PutCString(")");
- log->PutCString(s.GetString().c_str());
+ log->PutString(s.GetString());
}
RegisterContext *reg_ctx = thread.GetRegisterContext().get();
s.Printf(", arg%" PRIu64 " = 0x%" PRIx64, static_cast<uint64_t>(i + 1),
args[i]);
s.PutCString(")");
- log->PutCString(s.GetString().c_str());
+ log->PutString(s.GetString());
}
RegisterContext *reg_ctx = thread.GetRegisterContext().get();
s.Printf(", arg%" PRIu64 " = 0x%" PRIx64, static_cast<uint64_t>(i + 1),
args[i]);
s.PutCString(")");
- log->PutCString(s.GetString().c_str());
+ log->PutString(s.GetString());
}
RegisterContext *reg_ctx = thread.GetRegisterContext().get();
}
break;
}
- m_mnemonics.swap(mnemonic_strm.GetString());
+ m_mnemonics = mnemonic_strm.GetString();
return;
} else {
if (m_does_branch == eLazyBoolCalculate) {
ss.PutCString("\n");
}
- log->PutCString(ss.GetData());
+ log->PutString(ss.GetString());
}
return true;
// seen when we
// have multiple levels of inlined functions at an address, only show
// the first line.
- std::string &str(ss.GetString());
+ std::string str = ss.GetString();
size_t first_eol_char = str.find_first_of("\r\n");
if (first_eol_char != std::string::npos) {
str.erase(first_eol_char);
}
- m_inst->AppendComment(ss.GetString());
+ m_inst->AppendComment(str);
}
}
}
if (log)
log->Printf("DynamicLoaderPOSIXDYLD::%s - failed to resolve executable "
"with module spec \"%s\": %s",
- __FUNCTION__, stream.GetString().c_str(), error.AsCString());
+ __FUNCTION__, stream.GetData(), error.AsCString());
return;
}
-//===-- ClangASTSource.cpp ---------------------------------------*- C++
-//-*-===//
+//===-- ClangASTSource.cpp ---------------------------------------*- C++-*-===//
//
// The LLVM Compiler Infrastructure
//
}
ss.Flush();
- if (strstr(ss.GetData(), "$__lldb"))
+ if (ss.GetString().contains("$__lldb"))
return; // we don't need any results
- ConstString selector_name(ss.GetData());
+ ConstString selector_name(ss.GetString());
if (log)
log->Printf("ClangASTSource::FindObjCMethodDecls[%d] on (ASTContext*)%p "
StreamString ms;
ms.Printf("-[%s %s]", interface_name.c_str(), selector_name.AsCString());
ms.Flush();
- ConstString instance_method_name(ms.GetData());
+ ConstString instance_method_name(ms.GetString());
m_target->GetImages().FindFunctions(
instance_method_name, lldb::eFunctionNameTypeFull, include_symbols,
ms.Clear();
ms.Printf("+[%s %s]", interface_name.c_str(), selector_name.AsCString());
ms.Flush();
- ConstString class_method_name(ms.GetData());
+ ConstString class_method_name(ms.GetString());
m_target->GetImages().FindFunctions(
class_method_name, lldb::eFunctionNameTypeFull, include_symbols,
bool hasErrors() { return m_has_errors; }
- const std::string &getErrorString() { return m_error_stream.GetString(); }
+ llvm::StringRef getErrorString() { return m_error_stream.GetString(); }
};
class ClangDiagnosticManagerAdapter : public clang::DiagnosticConsumer {
diagnostic_manager.PutString(eDiagnosticSeverityError,
"while importing modules:");
diagnostic_manager.AppendMessageToDiagnostic(
- m_pp_callbacks->getErrorString().c_str());
+ m_pp_callbacks->getErrorString());
}
if (!num_errors) {
for (int i = 0; i < 16; ++i) {
sstr.Clear();
sstr.Printf("r%d", i);
- ConstString reg_name(sstr.GetData());
+ ConstString reg_name(sstr.GetString());
value_sp = reg_dict->GetValueForKey(reg_name);
if (value_sp.get() == NULL)
return false;
for (int i = 0; i < 32; ++i) {
sstr.Clear();
sstr.Printf("s%d", i);
- ConstString reg_name(sstr.GetData());
+ ConstString reg_name(sstr.GetString());
value_sp = reg_dict->GetValueForKey(reg_name);
if (value_sp.get() == NULL)
return false;
StreamString name;
name.Printf("[%" PRIu64 "]", (uint64_t)idx);
ValueObjectSP retval_sp(CreateValueObjectFromData(
- name.GetData(), DataExtractor(buffer_sp, process_sp->GetByteOrder(),
- process_sp->GetAddressByteSize()),
+ name.GetString(), DataExtractor(buffer_sp, process_sp->GetByteOrder(),
+ process_sp->GetAddressByteSize()),
m_exe_ctx_ref, m_bool_type));
if (retval_sp)
m_children[idx] = retval_sp;
offset = offset + m_start->GetValueAsUnsigned(0);
StreamString name;
name.Printf("[%" PRIu64 "]", (uint64_t)idx);
- return CreateValueObjectFromAddress(name.GetData(), offset,
+ return CreateValueObjectFromAddress(name.GetString(), offset,
m_backend.GetExecutionContextRef(),
m_element_type);
}
StreamString name;
name.Printf("[%" PRIu64 "]", (uint64_t)idx);
- return CreateValueObjectFromData(
- name.GetData(), data, m_backend.GetExecutionContextRef(), m_element_type);
+ return CreateValueObjectFromData(name.GetString(), data,
+ m_backend.GetExecutionContextRef(),
+ m_element_type);
}
bool lldb_private::formatters::LibcxxStdListSyntheticFrontEnd::Update() {
StreamString name;
name.Printf("[%" PRIu64 "]", (uint64_t)idx);
auto potential_child_sp = CreateValueObjectFromData(
- name.GetData(), data, m_backend.GetExecutionContextRef(), m_element_type);
+ name.GetString(), data, m_backend.GetExecutionContextRef(),
+ m_element_type);
if (potential_child_sp) {
switch (potential_child_sp->GetNumChildren()) {
case 1: {
break;
}
}
- potential_child_sp->SetName(ConstString(name.GetData()));
+ potential_child_sp->SetName(ConstString(name.GetString()));
}
m_iterators[idx] = iterator;
return potential_child_sp;
const bool thread_and_frame_only_if_stopped = true;
ExecutionContext exe_ctx = val_hash.first->GetExecutionContextRef().Lock(
thread_and_frame_only_if_stopped);
- return CreateValueObjectFromData(stream.GetData(), data, exe_ctx,
+ return CreateValueObjectFromData(stream.GetString(), data, exe_ctx,
val_hash.first->GetCompilerType());
}
offset = offset + m_start->GetValueAsUnsigned(0);
StreamString name;
name.Printf("[%" PRIu64 "]", (uint64_t)idx);
- return CreateValueObjectFromAddress(name.GetData(), offset,
+ return CreateValueObjectFromAddress(name.GetString(), offset,
m_backend.GetExecutionContextRef(),
m_element_type);
}
if (value_sp) {
StreamString name;
name.Printf("[%zd]", m_members.size());
- value_sp->SetName(ConstString(name.GetData()));
+ value_sp->SetName(ConstString(name.GetString()));
m_members.push_back(value_sp);
}
lldb::addr_t object_at_idx = m_base_data_address;
object_at_idx += idx * m_type.GetByteSize(nullptr);
cached = CreateValueObjectFromAddress(
- idx_name.GetData(), object_at_idx,
+ idx_name.GetString(), object_at_idx,
m_backend.GetExecutionContextRef(), m_type);
}
return cached;
DataExtractor data(buffer_sp, process_sp->GetByteOrder(),
process_sp->GetAddressByteSize());
return CreateValueObjectFromData(
- name.GetData(), data, valobj->GetExecutionContextRef(), element_type);
+ name.GetString(), data, valobj->GetExecutionContextRef(), element_type);
}
bool Update() override { return false; }
object_at_idx += (pyhs_idx * m_ptr_size);
StreamString idx_name;
idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx);
- return CreateValueObjectFromAddress(idx_name.GetData(), object_at_idx,
+ return CreateValueObjectFromAddress(idx_name.GetString(), object_at_idx,
m_exe_ctx_ref, m_id_type);
}
return lldb::ValueObjectSP();
StreamString idx_name;
idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx);
- return CreateValueObjectFromAddress(idx_name.GetData(), object_at_idx,
+ return CreateValueObjectFromAddress(idx_name.GetString(), object_at_idx,
m_exe_ctx_ref, m_id_type);
}
StreamString idx_name;
idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx);
DataExtractor data(buffer_sp, m_order, m_ptr_size);
- dict_item.valobj_sp = CreateValueObjectFromData(idx_name.GetData(), data,
+ dict_item.valobj_sp = CreateValueObjectFromData(idx_name.GetString(), data,
m_exe_ctx_ref, m_pair_type);
}
return dict_item.valobj_sp;
StreamString idx_name;
idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx);
DataExtractor data(buffer_sp, m_order, m_ptr_size);
- dict_item.valobj_sp = CreateValueObjectFromData(idx_name.GetData(), data,
+ dict_item.valobj_sp = CreateValueObjectFromData(idx_name.GetString(), data,
m_exe_ctx_ref, m_pair_type);
}
return dict_item.valobj_sp;
StreamString idx_name;
idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx);
- return ValueObjectConstResult::Create(m_process, v,
- ConstString(idx_name.GetData()));
+ return ValueObjectConstResult::Create(
+ m_process, v, ConstString(idx_name.GetString()));
}
void Clear() {
process_sp->GetAddressByteSize());
set_item.valobj_sp = CreateValueObjectFromData(
- idx_name.GetData(), data, m_exe_ctx_ref,
+ idx_name.GetString(), data, m_exe_ctx_ref,
m_backend.GetCompilerType().GetBasicTypeFromAST(
lldb::eBasicTypeObjCID));
}
process_sp->GetAddressByteSize());
set_item.valobj_sp = CreateValueObjectFromData(
- idx_name.GetData(), data, m_exe_ctx_ref,
+ idx_name.GetString(), data, m_exe_ctx_ref,
m_backend.GetCompilerType().GetBasicTypeFromAST(
lldb::eBasicTypeObjCID));
}
strm.PutChar('-');
strm.Printf("[%s %s]", GetClassName().GetCString(),
GetSelector().GetCString());
- return ConstString(strm.GetString().c_str());
+ return ConstString(strm.GetString());
}
if (!empty_if_no_category) {
if (category) {
strm.Printf("%c[%s %s]", is_class_method ? '+' : '-',
GetClassName().GetCString(), GetSelector().GetCString());
- names.push_back(ConstString(strm.GetString().c_str()));
+ names.emplace_back(strm.GetString());
}
} else {
const ConstString &class_name = GetClassName();
const ConstString &selector = GetSelector();
strm.Printf("+[%s %s]", class_name.GetCString(), selector.GetCString());
- names.push_back(ConstString(strm.GetString().c_str()));
+ names.emplace_back(strm.GetString());
strm.Clear();
strm.Printf("-[%s %s]", class_name.GetCString(), selector.GetCString());
- names.push_back(ConstString(strm.GetString().c_str()));
+ names.emplace_back(strm.GetString());
strm.Clear();
if (category) {
strm.Printf("+[%s(%s) %s]", class_name.GetCString(),
category.GetCString(), selector.GetCString());
- names.push_back(ConstString(strm.GetString().c_str()));
+ names.emplace_back(strm.GetString());
strm.Clear();
strm.Printf("-[%s(%s) %s]", class_name.GetCString(),
category.GetCString(), selector.GetCString());
- names.push_back(ConstString(strm.GetString().c_str()));
+ names.emplace_back(strm.GetString());
}
}
}
if (element.name.empty()) {
StreamString elem_name;
elem_name.Printf("__unnamed_%u", count);
- element.name = std::string(elem_name.GetData());
+ element.name = elem_name.GetString();
}
ClangASTContext::AddFieldToRecordType(
union_type, element.name.c_str(),
script->type = ScriptDetails::eScriptC;
script->cache_dir = cache_dir;
script->res_name = res_name;
- script->shared_lib = strm.GetData();
+ script->shared_lib = strm.GetString();
script->context = addr_t(args[eRsContext]);
}
options.SetLanguage(eLanguageTypeObjC_plus_plus);
ExpressionResults expr_result = UserExpression::Evaluate(
- exe_ctx, options, expr.GetData(), "", return_value_sp, eval_error);
+ exe_ctx, options, expr.GetString(), "", return_value_sp, eval_error);
if (expr_result != eExpressionCompleted) {
process_sp->GetTarget().GetDebugger().GetAsyncOutputStream()->Printf(
"Warning: Cannot evaluate AddressSanitizer expression:\n%s\n",
const size_t LC_THREAD_data_size = LC_THREAD_data.GetSize();
buffer.PutHex32(LC_THREAD);
buffer.PutHex32(8 + LC_THREAD_data_size); // cmd + cmdsize + data
- buffer.Write(LC_THREAD_data.GetData(), LC_THREAD_data_size);
+ buffer.Write(LC_THREAD_data.GetString().data(),
+ LC_THREAD_data_size);
}
// Write out all of the segment load commands
-//===-- OperatingSystemPython.cpp --------------------------------*- C++
-//-*-===//
+//===-- OperatingSystemPython.cpp --------------------------------*- C++-*-===//
//
// The LLVM Compiler Infrastructure
//
if (log) {
StreamString strm;
threads_list->Dump(strm);
- log->Printf("threads_list = %s", strm.GetString().c_str());
+ log->Printf("threads_list = %s", strm.GetData());
}
const uint32_t num_threads = threads_list->GetSize();
StreamString adb_command;
adb_command.Printf("shell:%s", command);
- error = SendMessage(adb_command.GetData(), false);
+ error = SendMessage(adb_command.GetString(), false);
if (error.Fail())
return error;
error.SetErrorStringWithFormat(
"'%s' doesn't contain any '%s' platform architectures: %s",
resolved_module_spec.GetFileSpec().GetPath().c_str(),
- GetPluginName().GetCString(), arch_names.GetString().c_str());
+ GetPluginName().GetCString(), arch_names.GetData());
} else {
error.SetErrorStringWithFormat(
"'%s' is not readable",
error.SetErrorStringWithFormat(
"'%s' doesn't contain any '%s' platform architectures: %s",
resolved_module_spec.GetFileSpec().GetPath().c_str(),
- GetPluginName().GetCString(), arch_names.GetString().c_str());
+ GetPluginName().GetCString(), arch_names.GetData());
} else {
error.SetErrorStringWithFormat(
"'%s' is not readable",
error.SetErrorStringWithFormat(
"'%s' doesn't contain any '%s' platform architectures: %s",
resolved_module_spec.GetFileSpec().GetPath().c_str(),
- GetPluginName().GetCString(), arch_names.GetString().c_str());
+ GetPluginName().GetCString(), arch_names.GetData());
} else {
error.SetErrorStringWithFormat(
"'%s' is not readable",
const FileAction *file_action;
while ((file_action = launch_info.GetFileActionAtIndex(i++)) != nullptr) {
file_action->Dump(stream);
- log->PutCString(stream.GetString().c_str());
+ log->PutCString(stream.GetData());
stream.Clear();
}
}
StreamString stream;
stream.Printf("lib%s.so", basename.GetCString());
- return ConstString(stream.GetData());
+ return ConstString(stream.GetString());
}
error.SetErrorStringWithFormat(
"'%s' doesn't contain any '%s' platform architectures: %s",
resolved_module_spec.GetFileSpec().GetPath().c_str(),
- GetPluginName().GetCString(), arch_names.GetString().c_str());
+ GetPluginName().GetCString(), arch_names.GetString().str().c_str());
} else {
error.SetErrorStringWithFormat(
"'%s' is not readable",
error.SetErrorStringWithFormat(
"'%s' doesn't contain any '%s' platform architectures: %s",
resolved_module_spec.GetFileSpec().GetPath().c_str(),
- GetPluginName().GetCString(), arch_names.GetString().c_str());
+ GetPluginName().GetCString(), arch_names.GetString().str().c_str());
} else {
error.SetErrorStringWithFormat(
"'%s' is not readable",
"%s/../Python/%s.py",
symfile_spec.GetDirectory().GetCString(),
original_module_basename.c_str());
- FileSpec script_fspec(path_string.GetData(), true);
- FileSpec orig_script_fspec(original_path_string.GetData(),
+ FileSpec script_fspec(path_string.GetString(), true);
+ FileSpec orig_script_fspec(original_path_string.GetString(),
true);
// if we did some replacements of reserved characters, and a
error.SetErrorStringWithFormat(
"'%s' doesn't contain any '%s' platform architectures: %s",
resolved_module_spec.GetFileSpec().GetPath().c_str(),
- GetPluginName().GetCString(), arch_names.GetString().c_str());
+ GetPluginName().GetCString(), arch_names.GetData());
} else {
error.SetErrorStringWithFormat(
"'%s' is not readable",
StreamString stream;
stream.Printf("lib%s.dylib", basename.GetCString());
- return ConstString(stream.GetData());
+ return ConstString(stream.GetString());
}
bool PlatformDarwin::GetOSVersion(uint32_t &major, uint32_t &minor,
versions[1]);
fspec.SetFile(sdk_path.GetString(), false);
if (fspec.Exists())
- return ConstString(sdk_path.GetString().c_str());
+ return ConstString(sdk_path.GetString());
}
if (!default_xcode_sdk.empty()) {
fspec.SetFile(default_xcode_sdk, false);
if (fspec.Exists())
- return ConstString(default_xcode_sdk.c_str());
+ return ConstString(default_xcode_sdk);
}
}
}
error.SetErrorStringWithFormat(
"'%s' doesn't contain any '%s' platform architectures: %s",
resolved_module_spec.GetFileSpec().GetPath().c_str(),
- GetPluginName().GetCString(), arch_names.GetString().c_str());
+ GetPluginName().GetCString(), arch_names.GetData());
} else {
error.SetErrorStringWithFormat(
"'%s' is not readable",
error.SetErrorStringWithFormat(
"'%s' doesn't contain any '%s' platform architectures: %s",
resolved_module_spec.GetFileSpec().GetPath().c_str(),
- GetPluginName().GetCString(), arch_names.GetString().c_str());
+ GetPluginName().GetCString(), arch_names.GetData());
} else {
error.SetErrorStringWithFormat(
"'%s' is not readable",
error.SetErrorStringWithFormat(
"'%s' doesn't contain any '%s' platform architectures: %s",
resolved_module_spec.GetFileSpec().GetPath().c_str(),
- GetPluginName().GetCString(), arch_names.GetString().c_str());
+ GetPluginName().GetCString(), arch_names.GetData());
} else {
error.SetErrorStringWithFormat(
"'%s' is not readable",
error.SetErrorStringWithFormat(
"'%s' doesn't contain any '%s' platform architectures: %s",
resolved_module_spec.GetFileSpec().GetPath().c_str(),
- GetPluginName().GetCString(), arch_names.GetString().c_str());
+ GetPluginName().GetCString(), arch_names.GetString().str().c_str());
} else {
error.SetErrorStringWithFormat(
"'%s' is not readable",
error.SetErrorStringWithFormat(
"'%s' doesn't contain any '%s' platform architectures: %s",
resolved_module_spec.GetFileSpec().GetPath().c_str(),
- GetPluginName().GetCString(), arch_names.GetString().c_str());
+ GetPluginName().GetCString(), arch_names.GetData());
} else {
error.SetErrorStringWithFormat(
"'%s' is not readable",
if (GetLocalCacheDirectory() && *GetLocalCacheDirectory())
stream.Printf("cache dir: %s", GetLocalCacheDirectory());
if (stream.GetSize())
- return stream.GetData();
+ return stream.GetString();
else
return "";
}
error.SetErrorStringWithFormat(
"'%s' doesn't contain any '%s' platform architectures: %s",
resolved_module_spec.GetFileSpec().GetPath().c_str(),
- GetPluginName().GetCString(), arch_names.GetString().c_str());
+ GetPluginName().GetCString(), arch_names.GetData());
} else {
error.SetErrorStringWithFormat(
"'%s' is not readable",
StreamString stream;
stream.Printf("%s.dll", basename.GetCString());
- return ConstString(stream.GetData());
+ return ConstString(stream.GetString());
}
error.SetErrorStringWithFormat(
"'%s' doesn't contain any '%s' platform architectures: %s",
resolved_module_spec.GetFileSpec().GetPath().c_str(),
- GetPluginName().GetCString(), arch_names.GetString().c_str());
+ GetPluginName().GetCString(), arch_names.GetData());
} else {
error.SetErrorStringWithFormat(
"'%s' is not readable",
log->Printf(
"PlatformRemoteGDBServer::%s - got module info for (%s:%s) : %s",
__FUNCTION__, module_path.c_str(), arch.GetTriple().getTriple().c_str(),
- stream.GetString().c_str());
+ stream.GetData());
}
return true;
packet.PutBytesAsRawHex8(
reply.GetDataStart(), reply.GetByteSize(),
endian::InlHostByteOrder(), endian::InlHostByteOrder());
- result.AppendMessage(packet.GetString().c_str());
+ result.AppendMessage(packet.GetString());
result.SetStatus(eReturnStatusSuccessFinishResult);
return true;
} else {
StreamString active_row_strm;
active_row->Dump(active_row_strm, m_full_unwind_plan_sp.get(), &m_thread,
m_start_pc.GetLoadAddress(exe_ctx.GetTargetPtr()));
- UnwindLogMsg("%s", active_row_strm.GetString().c_str());
+ UnwindLogMsg("%s", active_row_strm.GetData());
}
}
StreamString active_row_strm;
active_row->Dump(active_row_strm, m_fast_unwind_plan_sp.get(), &m_thread,
m_start_pc.GetLoadAddress(exe_ctx.GetTargetPtr()));
- UnwindLogMsg("active row: %s", active_row_strm.GetString().c_str());
+ UnwindLogMsg("active row: %s", active_row_strm.GetData());
}
} else {
m_full_unwind_plan_sp = GetFullUnwindPlanForFrame();
active_row->Dump(active_row_strm, m_full_unwind_plan_sp.get(),
&m_thread,
m_start_pc.GetLoadAddress(exe_ctx.GetTargetPtr()));
- UnwindLogMsg("active row: %s", active_row_strm.GetString().c_str());
+ UnwindLogMsg("active row: %s", active_row_strm.GetData());
}
}
}
if (m_exc_data_count > 0)
strm.PutChar(')');
- m_description.swap(strm.GetString());
+ m_description = strm.GetString();
}
return m_description.c_str();
}
Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PACKETS));
ConnectionStatus status = eConnectionStatusSuccess;
- const char *packet_data = packet.GetData();
+ // TODO: Don't shimmy through a std::string, just use StringRef.
+ std::string packet_str = packet.GetString();
+ const char *packet_data = packet_str.c_str();
const size_t packet_length = packet.GetSize();
size_t bytes_written = Write(packet_data, packet_length, status, NULL);
if (log) {
strm.Printf("\\x%2.2x", *p);
// Print the checksum
strm.Printf("%*s", (int)3, p);
- log->PutCString(strm.GetString().c_str());
+ log->PutString(strm.GetString());
} else
log->Printf("<%4" PRIu64 "> send packet: %.*s", (uint64_t)bytes_written,
(int)packet_length, packet_data);
// Packet footer...
strm.Printf("%c%c%c", m_bytes[total_length - 3],
m_bytes[total_length - 2], m_bytes[total_length - 1]);
- log->PutCString(strm.GetString().c_str());
+ log->PutString(strm.GetString());
} else {
if (CompressionIsEnabled())
log->Printf("<%4" PRIu64 ":%" PRIu64 "> read packet: %.*s",
Platform *const platform = nullptr;
launch_info.Dump(string_stream, platform);
log->Printf("launch info for gdb-remote stub:\n%s",
- string_stream.GetString().c_str());
+ string_stream.GetData());
}
error = Host::LaunchProcess(launch_info);
}
StringExtractorGDBRemote response;
- if (SendPacketAndWaitForResponse(packet.GetData(), response,
+ if (SendPacketAndWaitForResponse(packet.GetString(), response,
/*send_async=*/false) ==
PacketResult::Success) {
const char *response_cstr = response.GetStringRef().c_str();
GDBR_LOG_PROCESS | GDBR_LOG_PACKETS))
log->Printf("GDBRemoteCommunicationClient::%s: Didn't get sequence mutex "
"for %s packet.",
- __FUNCTION__, payload.GetString().c_str());
+ __FUNCTION__, payload.GetData());
return PacketResult::ErrorNoSequenceLock;
}
stream.PutHex32(file_permissions);
stream.PutChar(',');
stream.PutCStringAsRawHex8(path.c_str());
- const char *packet = stream.GetData();
+ llvm::StringRef packet = stream.GetString();
StringExtractorGDBRemote response;
if (SendPacketAndWaitForResponse(packet, response, false) !=
PacketResult::Success)
- return Error("failed to send '%s' packet", packet);
+ return Error("failed to send '%s' packet", packet.str().c_str());
if (response.GetChar() != 'F')
- return Error("invalid response to '%s' packet", packet);
+ return Error("invalid response to '%s' packet", packet.str().c_str());
return Error(response.GetU32(UINT32_MAX), eErrorTypePOSIX);
}
stream.PutHex32(file_permissions);
stream.PutChar(',');
stream.PutCStringAsRawHex8(path.c_str());
- const char *packet = stream.GetData();
+ llvm::StringRef packet = stream.GetString();
StringExtractorGDBRemote response;
if (SendPacketAndWaitForResponse(packet, response, false) !=
PacketResult::Success)
- return Error("failed to send '%s' packet", packet);
+ return Error("failed to send '%s' packet", stream.GetData());
if (response.GetChar() != 'F')
- return Error("invalid response to '%s' packet", packet);
+ return Error("invalid response to '%s' packet", stream.GetData());
return Error(response.GetU32(UINT32_MAX), eErrorTypePOSIX);
}
PacketResult::Success) {
if (response.GetChar() != 'F') {
error.SetErrorStringWithFormat("invalid response to '%s' packet",
- stream.GetString().c_str());
+ stream.GetData());
} else {
const uint32_t mode = response.GetS32(-1);
if (static_cast<int32_t>(mode) == -1) {
}
} else {
error.SetErrorStringWithFormat("failed to send '%s' packet",
- stream.GetString().c_str());
+ stream.GetData());
}
return error;
}
unescaped_payload.PutCString("jModulesInfo:");
module_array_sp->Write(unescaped_payload);
StreamGDBRemote payload;
- payload.PutEscapedBytes(unescaped_payload.GetData(),
+ payload.PutEscapedBytes(unescaped_payload.GetString().data(),
unescaped_payload.GetSize());
StringExtractorGDBRemote response;
m_supported_async_json_packets_sp->Dump(stream);
log->Printf("GDBRemoteCommunicationClient::%s(): supported async "
"JSON packets: %s",
- __FUNCTION__, stream.GetString().c_str());
+ __FUNCTION__, stream.GetData());
}
}
unescaped_stream.Flush();
// Add it to the stream in escaped fashion.
- stream.PutEscapedBytes(unescaped_stream.GetData(),
+ stream.PutEscapedBytes(unescaped_stream.GetString().data(),
unescaped_stream.GetSize());
}
stream.Flush();
StreamString response;
response_array_sp->Write(response);
StreamGDBRemote escaped_response;
- escaped_response.PutEscapedBytes(response.GetData(), response.GetSize());
+ escaped_response.PutEscapedBytes(response.GetString().data(),
+ response.GetSize());
return SendPacketNoLock(escaped_response.GetString());
}
server_list.Write(response);
StreamGDBRemote escaped_response;
- escaped_response.PutEscapedBytes(response.GetData(), response.GetSize());
+ escaped_response.PutEscapedBytes(response.GetString().data(),
+ response.GetSize());
return SendPacketNoLock(escaped_response.GetString());
}
m_async_broadcaster.BroadcastEvent(
eBroadcastBitAsyncContinue,
- new EventDataBytes(packet.GetData(), packet.GetSize()));
+ new EventDataBytes(packet.GetString().data(), packet.GetSize()));
} else
SetExitStatus(-1, error.AsCString());
}
if (continue_packet_error)
- continue_packet.GetString().clear();
+ continue_packet.Clear();
}
} else
continue_packet_error = true;
m_async_broadcaster.BroadcastEvent(
eBroadcastBitAsyncContinue,
- new EventDataBytes(continue_packet.GetData(),
+ new EventDataBytes(continue_packet.GetString().data(),
continue_packet.GetSize()));
if (listener_sp->WaitForEvent(std::chrono::seconds(5), event_sp) ==
else
error.SetErrorStringWithFormat(
"unexpected response to GDB server memory write packet '%s': '%s'",
- packet.GetString().c_str(), response.GetStringRef().c_str());
+ packet.GetData(), response.GetStringRef().c_str());
} else {
error.SetErrorStringWithFormat("failed to send packet: '%s'",
- packet.GetString().c_str());
+ packet.GetData());
}
return 0;
}
module_spec.Dump(stream);
log->Printf("ProcessGDBRemote::%s - got module info for (%s:%s) : %s",
__FUNCTION__, module_file_spec.GetPath().c_str(),
- arch.GetTriple().getTriple().c_str(),
- stream.GetString().c_str());
+ arch.GetTriple().getTriple().c_str(), stream.GetData());
}
m_cached_module_specs[key] = module_spec;
json_str.Flush();
log->Printf("ProcessGDBRemote::%s() "
"received Async StructuredData packet: %s",
- __FUNCTION__, json_str.GetString().c_str());
+ __FUNCTION__, json_str.GetData());
} else {
log->Printf("ProcessGDBRemote::%s"
"() received StructuredData packet:"
packet.GetString(), response, send_async);
result.SetStatus(eReturnStatusSuccessFinishResult);
Stream &output_strm = result.GetOutputStream();
- output_strm.Printf(" packet: %s\n", packet.GetString().c_str());
+ output_strm.Printf(" packet: %s\n", packet.GetData());
const std::string &response_str = response.GetStringRef();
if (response_str.empty())
// Create the function name & definition string.
sstr.Printf("class %s:", auto_generated_class_name.c_str());
- auto_generated_class.AppendString(sstr.GetData());
+ auto_generated_class.AppendString(sstr.GetString());
// Wrap everything up inside the class, increasing the indentation.
// we don't need to play any fancy indentation tricks here because there is no
for (int i = 0; i < num_lines; ++i) {
sstr.Clear();
sstr.Printf(" %s", user_input.GetStringAtIndex(i));
- auto_generated_class.AppendString(sstr.GetData());
+ auto_generated_class.AppendString(sstr.GetString());
}
// Verify that the results are valid Python.
StreamString str_stream;
str_stream.Printf(
"Function %s was not found. Containing module might be missing.", item);
- dest.assign(str_stream.GetData());
+ dest = str_stream.GetString();
return false;
}
}
" the property and relaunch the target binary to have"
" these messages excluded.",
source_name, source_name);
- result.AppendWarning(stream.GetString().c_str());
+ result.AppendWarning(stream.GetString());
}
bool DoExecute(Args &command, CommandReturnObject &result) override {
// Run the command.
CommandReturnObject return_object;
- interpreter.HandleCommand(command_stream.GetString().c_str(), eLazyBoolNo,
+ interpreter.HandleCommand(command_stream.GetData(), eLazyBoolNo,
return_object);
return return_object.Succeeded();
}
else
json_stream.PutCString("<null>");
log->Printf("StructuredDataDarwinLog::%s() called with json: %s",
- __FUNCTION__, json_stream.GetString().c_str());
+ __FUNCTION__, json_stream.GetData());
}
// Ignore empty structured data.
object.Dump(object_stream);
object_stream.Flush();
- error.SetErrorStringWithFormat("%s: %s", message,
- object_stream.GetString().c_str());
+ error.SetErrorStringWithFormat("%s: %s", message, object_stream.GetData());
}
Error StructuredDataDarwinLog::GetDescription(
}
stream.PutCString("] ");
- auto &result = stream.GetString();
- output_stream.PutCString(result);
+ output_stream.PutCString(stream.GetString());
- return result.size();
+ return stream.GetSize();
}
size_t StructuredDataDarwinLog::HandleDisplayOfEvent(
if (type_quals & clang::Qualifiers::Const)
sstr << " const";
- func_name.SetValue(ConstString(sstr.GetData()), false);
+ func_name.SetValue(ConstString(sstr.GetString()), false);
} else
func_name.SetValue(ConstString(name), false);
ss.Printf("set%c%s:", toupper(prop_name[0]), &prop_name[1]);
- fixed_setter.SetCString(ss.GetData());
+ fixed_setter.SetString(ss.GetString());
prop_setter_name = fixed_setter.GetCString();
}
}
strm.Printf("error: no DIE for compile unit");
else
m_die_array[0].Dump(m_dwarf2Data, this, strm, UINT32_MAX);
- verbose_log->PutCString(strm.GetString().c_str());
+ verbose_log->PutString(strm.GetString());
}
if (!m_dwo_symbol_file)
NULL);
GetObjectFile()->GetModule()->ReportError(
"0x%8.8x: %s has an invalid location: %s", die.GetOffset(),
- die.GetTagAsCString(), strm.GetString().c_str());
+ die.GetTagAsCString(), strm.GetData());
}
}
SymbolFileDWARFDebugMap *debug_map_symfile = GetDebugMapSymfile();
-//===-- UnwindAssemblyInstEmulation.cpp --------------------------*- C++
-//-*-===//
+//===-- UnwindAssemblyInstEmulation.cpp --------------------------*- C++-*-===//
//
// The LLVM Compiler Infrastructure
//
FormatEntity::Parse("${frame.pc}: ", format);
inst->Dump(&strm, inst_list.GetMaxOpcocdeByteSize(), show_address,
show_bytes, NULL, NULL, NULL, &format, 0);
- log->PutCString(strm.GetData());
+ log->PutString(strm.GetString());
}
last_condition = m_inst_emulator_ap->GetInstructionCondition();
strm.Printf("Resulting unwind rows for [0x%" PRIx64 " - 0x%" PRIx64 "):",
base_addr, base_addr + range.GetByteSize());
unwind_plan.Dump(strm, nullptr, base_addr);
- log->PutCString(strm.GetData());
+ log->PutString(strm.GetString());
}
return unwind_plan.GetRowCount() > 0;
}
", dst = %p, dst_len = %" PRIu64 ", context = ",
addr, dst, (uint64_t)dst_len);
context.Dump(strm, instruction);
- log->PutCString(strm.GetData());
+ log->PutString(strm.GetString());
}
memset(dst, 0, dst_len);
return dst_len;
data.Dump(&strm, 0, eFormatBytes, 1, dst_len, UINT32_MAX, addr, 0, 0);
strm.PutCString(", context = ");
context.Dump(strm, instruction);
- log->PutCString(strm.GetData());
+ log->PutString(strm.GetString());
}
const bool cant_replace = false;
"synthetic_value = %i, value = ",
reg_info->name, synthetic);
reg_value.Dump(&strm, reg_info, false, false, eFormatDefault);
- log->PutCString(strm.GetData());
+ log->PutString(strm.GetString());
}
return true;
}
reg_value.Dump(&strm, reg_info, false, false, eFormatDefault);
strm.PutCString(", context = ");
context.Dump(strm, instruction);
- log->PutCString(strm.GetData());
+ log->PutString(strm.GetString());
}
SetRegisterValue(*reg_info, reg_value);
ConstString file_name = GetModule()->GetFileSpec().GetFilename();
ss.Printf("___lldb_unnamed_symbol%u$$%s", ++m_synthetic_symbol_idx,
file_name.GetCString());
- return ConstString(ss.GetData());
+ return ConstString(ss.GetString());
}
else
s.Printf("%-10u ", m_egid);
- s.Printf("%-24s ", arch_strm.GetString().c_str());
+ s.Printf("%-24s ", arch_strm.GetData());
} else {
s.Printf("%-10s %-24s ", platform->GetUserName(m_euid),
- arch_strm.GetString().c_str());
+ arch_strm.GetData());
}
if (verbose || show_args) {
StreamString s;
s.PutCString("Thread state after unsuccessful completion: \n");
thread->GetStackFrameStatus(s, 0, UINT32_MAX, true, UINT32_MAX);
- log->PutCString(s.GetData());
+ log->PutString(s.GetString());
}
// Restore the thread state if we are going to discard the plan execution.
// There are three cases where this
error.SetErrorStringWithFormat(
"\"%s\" is a pointer and . was used to attempt to access "
"\"%s\". Did you mean \"%s->%s\"?",
- var_expr_path_strm.GetString().c_str(),
- child_name.GetCString(),
- var_expr_path_strm.GetString().c_str(), var_path.c_str());
+ var_expr_path_strm.GetData(), child_name.GetCString(),
+ var_expr_path_strm.GetData(), var_path.c_str());
else
error.SetErrorStringWithFormat(
"\"%s\" is not a pointer and -> was used to attempt to "
"access \"%s\". Did you mean \"%s.%s\"?",
- var_expr_path_strm.GetString().c_str(),
- child_name.GetCString(),
- var_expr_path_strm.GetString().c_str(), var_path.c_str());
+ var_expr_path_strm.GetData(), child_name.GetCString(),
+ var_expr_path_strm.GetData(), var_path.c_str());
return ValueObjectSP();
}
}
"\"%s\" is not a member of \"(%s) %s\"",
child_name.GetCString(),
valobj_sp->GetTypeName().AsCString("<invalid type>"),
- var_expr_path_strm.GetString().c_str());
+ var_expr_path_strm.GetData());
} else {
error.SetErrorStringWithFormat(
"incomplete expression path after \"%s\" in \"%s\"",
- var_expr_path_strm.GetString().c_str(), var_expr_cstr);
+ var_expr_path_strm.GetData(), var_expr_cstr);
}
}
return ValueObjectSP();
error.SetErrorStringWithFormat(
"could not dereference \"(%s) %s\"",
valobj_sp->GetTypeName().AsCString("<invalid type>"),
- var_expr_path_strm.GetString().c_str());
+ var_expr_path_strm.GetData());
return ValueObjectSP();
}
valobj_sp = temp;
error.SetErrorStringWithFormat(
"could not get item 0 for \"(%s) %s\"",
valobj_sp->GetTypeName().AsCString("<invalid type>"),
- var_expr_path_strm.GetString().c_str());
+ var_expr_path_strm.GetData());
return ValueObjectSP();
}
valobj_sp = temp;
"\"(%s) %s\" is an Objective-C pointer, and cannot be "
"subscripted",
valobj_sp->GetTypeName().AsCString("<invalid type>"),
- var_expr_path_strm.GetString().c_str());
+ var_expr_path_strm.GetData());
return ValueObjectSP();
} else if (is_objc_pointer) {
error.SetErrorStringWithFormat(
"\"(%s) %s\" is not an array type",
valobj_sp->GetTypeName().AsCString("<invalid type>"),
- var_expr_path_strm.GetString().c_str());
+ var_expr_path_strm.GetData());
} else if (
static_cast<uint32_t>(child_index) >=
synthetic
"array index %ld is not valid for \"(%s) %s\"",
child_index,
valobj_sp->GetTypeName().AsCString("<invalid type>"),
- var_expr_path_strm.GetString().c_str());
+ var_expr_path_strm.GetData());
} else {
child_valobj_sp =
synthetic->GetChildAtIndex(child_index, true);
"array index %ld is not valid for \"(%s) %s\"",
child_index, valobj_sp->GetTypeName().AsCString(
"<invalid type>"),
- var_expr_path_strm.GetString().c_str());
+ var_expr_path_strm.GetData());
}
}
} else {
"\"(%s) %s\"",
child_index,
valobj_sp->GetTypeName().AsCString("<invalid type>"),
- var_expr_path_strm.GetString().c_str());
+ var_expr_path_strm.GetData());
}
}
} else if (valobj_sp->GetCompilerType().IsArrayType(
"array index %ld is not valid for \"(%s) %s\"",
child_index,
valobj_sp->GetTypeName().AsCString("<invalid type>"),
- var_expr_path_strm.GetString().c_str());
+ var_expr_path_strm.GetData());
}
} else if (valobj_sp->GetCompilerType().IsScalarType()) {
// this is a bitfield asking to display just one bit
"bitfield range %ld-%ld is not valid for \"(%s) %s\"",
child_index, child_index,
valobj_sp->GetTypeName().AsCString("<invalid type>"),
- var_expr_path_strm.GetString().c_str());
+ var_expr_path_strm.GetData());
}
} else {
ValueObjectSP synthetic = valobj_sp->GetSyntheticValue();
error.SetErrorStringWithFormat(
"\"(%s) %s\" is not an array type",
valobj_sp->GetTypeName().AsCString("<invalid type>"),
- var_expr_path_strm.GetString().c_str());
+ var_expr_path_strm.GetData());
} else if (
static_cast<uint32_t>(child_index) >=
synthetic
"array index %ld is not valid for \"(%s) %s\"",
child_index,
valobj_sp->GetTypeName().AsCString("<invalid type>"),
- var_expr_path_strm.GetString().c_str());
+ var_expr_path_strm.GetData());
} else {
child_valobj_sp =
synthetic->GetChildAtIndex(child_index, true);
"array index %ld is not valid for \"(%s) %s\"",
child_index,
valobj_sp->GetTypeName().AsCString("<invalid type>"),
- var_expr_path_strm.GetString().c_str());
+ var_expr_path_strm.GetData());
}
}
}
error.SetErrorStringWithFormat(
"could not dereference \"(%s) %s\"",
valobj_sp->GetTypeName().AsCString("<invalid type>"),
- var_expr_path_strm.GetString().c_str());
+ var_expr_path_strm.GetData());
return ValueObjectSP();
}
valobj_sp = temp;
error.SetErrorStringWithFormat(
"could not get item 0 for \"(%s) %s\"",
valobj_sp->GetTypeName().AsCString("<invalid type>"),
- var_expr_path_strm.GetString().c_str());
+ var_expr_path_strm.GetData());
return ValueObjectSP();
}
valobj_sp = temp;
final_index,
valobj_sp->GetTypeName().AsCString("<invalid
type>"),
- var_expr_path_strm.GetString().c_str());
+ var_expr_path_strm.c_str());
}
}*/
"bitfield range %ld-%ld is not valid for \"(%s) %s\"",
child_index, final_index,
valobj_sp->GetTypeName().AsCString("<invalid type>"),
- var_expr_path_strm.GetString().c_str());
+ var_expr_path_strm.GetData());
}
}
}
} else {
error.SetErrorStringWithFormat(
"invalid square bracket encountered after \"%s\" in \"%s\"",
- var_expr_path_strm.GetString().c_str(), var_path.c_str());
+ var_expr_path_strm.GetData(), var_path.c_str());
}
return ValueObjectSP();
valobj_sp->GetExpressionPath(var_expr_path_strm, false);
error.SetErrorStringWithFormat(
"unexpected char '%c' encountered after \"%s\" in \"%s\"",
- separator_type, var_expr_path_strm.GetString().c_str(),
+ separator_type, var_expr_path_strm.GetData(),
var_path.c_str());
return ValueObjectSP();
frame_format = target->GetDebugger().GetFrameFormat();
if (frame_format && FormatEntity::Format(*frame_format, s, &m_sc, &exe_ctx,
nullptr, nullptr, false, false)) {
- strm->Write(s.GetData(), s.GetSize());
+ strm->PutCString(s.GetString());
} else {
Dump(strm, true, false);
strm->EOL();
prev_frame.GetStackID()); // TODO: remove this after some testing
m_variable_list_sp = prev_frame.m_variable_list_sp;
m_variable_list_value_objects.Swap(prev_frame.m_variable_list_value_objects);
- if (!m_disassembly.GetString().empty())
- m_disassembly.GetString().swap(m_disassembly.GetString());
+ if (!m_disassembly.GetString().empty()) {
+ m_disassembly.Clear();
+ m_disassembly.PutCString(prev_frame.m_disassembly.GetString());
+ }
}
void StackFrame::UpdatePreviousFrameFromCurrentFrame(StackFrame &curr_frame) {
strm.Printf("breakpoint ");
bp_site_sp->GetDescription(&strm, eDescriptionLevelBrief);
- m_description.swap(strm.GetString());
+ m_description = strm.GetString();
} else {
StreamString strm;
if (m_break_id != LLDB_INVALID_BREAK_ID) {
" which has been deleted - was at 0x%" PRIx64,
m_value, m_address);
- m_description.swap(strm.GetString());
+ m_description = strm.GetString();
}
}
}
if (m_description.empty()) {
StreamString strm;
strm.Printf("watchpoint %" PRIi64, m_value);
- m_description.swap(strm.GetString());
+ m_description = strm.GetString();
}
return m_description.c_str();
}
strm.Printf("signal %s", signal_name);
else
strm.Printf("signal %" PRIi64, m_value);
- m_description.swap(strm.GetString());
+ m_description = strm.GetString();
}
}
return m_description.c_str();
if (m_description.empty()) {
StreamString strm;
m_plan_sp->GetDescription(&strm, eDescriptionLevelBrief);
- m_description.swap(strm.GetString());
+ m_description = strm.GetString();
}
return m_description.c_str();
}
s->Indent("Thread:\n");
m_thread_spec_ap->GetDescription(&tmp, level);
s->SetIndentLevel(indent_level + 4);
- s->Indent(tmp.GetData());
+ s->Indent(tmp.GetString());
s->PutCString("\n");
s->SetIndentLevel(indent_level + 2);
}
error.SetErrorStringWithFormat(
"the specified architecture '%s' is not compatible with '%s' "
"in '%s'",
- platform_arch_strm.GetString().c_str(),
- module_arch_strm.GetString().c_str(),
+ platform_arch_strm.GetData(), module_arch_strm.GetData(),
module_spec.GetFileSpec().GetPath().c_str());
return error;
}
}
error_strm.Printf(
"), use the --platform option to specify a platform");
- error.SetErrorString(error_strm.GetString().c_str());
+ error.SetErrorString(error_strm.GetString());
return error;
}
}
StreamString sstr;
DumpAddressList(sstr, outside_function, target);
return Error("%s:%i has multiple candidate locations:\n%s",
- file.GetFilename().AsCString(), line,
- sstr.GetString().c_str());
+ file.GetFilename().AsCString(), line, sstr.GetData());
}
}
strm.EOL();
}
}
- log->PutCString(strm.GetData());
+ log->PutString(strm.GetString());
}
}
if (!m_valid) {
if (error) {
if (m_constructor_errors.GetSize() > 0)
- error->PutCString(m_constructor_errors.GetData());
+ error->PutCString(m_constructor_errors.GetString());
else
error->PutCString("Unknown error");
}
-//===-- ThreadPlanCallUserExpression.cpp ------------------------------*- C++
-//-*-===//
+//===-- ThreadPlanCallUserExpression.cpp -------------------------*- C++-*-===//
//
// The LLVM Compiler Infrastructure
//
"Stepping over inlined function \"%s\" in inlined stack: ",
name);
DumpRanges(&s);
- log->PutCString(s.GetData());
+ log->PutString(s.GetString());
}
}
}
-//===-- argdumper.cpp --------------------------------------------*- C++
-//-*-===//
+//===-- argdumper.cpp --------------------------------------------*- C++-*-===//
//
// The LLVM Compiler Infrastructure
//
// Test that creating a `PythonString` object works correctly with the
// string constructor
PythonString constructed_string(test_string2);
- EXPECT_STREQ(test_string2, constructed_string.GetString().str().c_str());
+ EXPECT_STREQ(test_string2, constructed_string.c_str());
}
TEST_F(PythonDataObjectsTest, TestPythonStringToStr) {
const char *c_str = "PythonDataObjectsTest::TestPythonStringToStr";
PythonString str(c_str);
- EXPECT_STREQ(c_str, str.GetString().str().c_str());
+ EXPECT_STREQ(c_str, str.c_str());
PythonString str_str = str.Str();
- EXPECT_STREQ(c_str, str_str.GetString().str().c_str());
+ EXPECT_STREQ(c_str, str_str.c_str());
}
TEST_F(PythonDataObjectsTest, TestPythonIntegerToStr) {}
PythonString chk_str(PyRefType::Borrowed, chk_value2.get());
EXPECT_EQ(long_value0, chk_int.GetInteger());
- EXPECT_STREQ(string_value1, chk_str.GetString().str().c_str());
+ EXPECT_STREQ(string_value1, chk_str.c_str());
}
TEST_F(PythonDataObjectsTest, TestPythonListManipulation) {
PythonString chk_str(PyRefType::Borrowed, chk_value2.get());
EXPECT_EQ(long_value0, chk_int.GetInteger());
- EXPECT_STREQ(string_value1, chk_str.GetString().str().c_str());
+ EXPECT_STREQ(string_value1, chk_str.c_str());
}
TEST_F(PythonDataObjectsTest, TestPythonListToStructuredList) {
PythonString chk_str(PyRefType::Borrowed, chk_value2.get());
EXPECT_EQ(value_0, chk_int.GetInteger());
- EXPECT_STREQ(value_1, chk_str.GetString().str().c_str());
+ EXPECT_STREQ(value_1, chk_str.c_str());
}
TEST_F(PythonDataObjectsTest, TestPythonDictionaryManipulation) {
PythonString chk_str(PyRefType::Borrowed, chk_value2.get());
EXPECT_EQ(value_0, chk_int.GetInteger());
- EXPECT_STREQ(value_1, chk_str.GetString().str().c_str());
+ EXPECT_STREQ(value_1, chk_str.c_str());
}
TEST_F(PythonDataObjectsTest, TestPythonDictionaryToStructuredDictionary) {