本文整理汇总了C++中SBError::GetCString方法的典型用法代码示例。如果您正苦于以下问题:C++ SBError::GetCString方法的具体用法?C++ SBError::GetCString怎么用?C++ SBError::GetCString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SBError
的用法示例。
在下文中一共展示了SBError::GetCString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: error
int
main (int argc, char const *argv[], const char *envp[])
{
SBDebugger::Initialize();
SBHostOS::ThreadCreated ("<lldb.driver.main-thread>");
signal (SIGPIPE, SIG_IGN);
signal (SIGWINCH, sigwinch_handler);
signal (SIGINT, sigint_handler);
signal (SIGTSTP, sigtstp_handler);
signal (SIGCONT, sigcont_handler);
// Create a scope for driver so that the driver object will destroy itself
// before SBDebugger::Terminate() is called.
{
Driver driver;
bool exiting = false;
SBError error (driver.ParseArgs (argc, argv, stdout, exiting));
if (error.Fail())
{
const char *error_cstr = error.GetCString ();
if (error_cstr)
::fprintf (stderr, "error: %s\n", error_cstr);
}
else if (!exiting)
{
driver.MainLoop ();
}
}
SBDebugger::Terminate();
return 0;
}
示例2: listener_func
void listener_func() {
while (!g_done) {
SBEvent event;
bool got_event = g_listener.WaitForEvent(1, event);
if (got_event) {
if (!event.IsValid())
throw Exception("event is not valid in listener thread");
SBProcess process = SBProcess::GetProcessFromEvent(event);
if (process.GetState() == eStateStopped) {
SBError error = process.Continue();
if (!error.Success())
throw Exception(string("Cannot continue process from listener thread: ")
+ error.GetCString());
g_process_started.push(true);
}
}
}
}
示例3: if
//.........这里部分代码省略.........
{
commands_stream.Printf ("process attach --name %s", EscapeString(m_option_data.m_process_name).c_str());
if (m_option_data.m_wait_for)
commands_stream.Printf(" --waitfor");
commands_stream.Printf("\n");
}
else if (LLDB_INVALID_PROCESS_ID != m_option_data.m_process_pid)
{
commands_stream.Printf ("process attach --pid %" PRIu64 "\n", m_option_data.m_process_pid);
}
WriteCommandsForSourcing(eCommandPlacementAfterFile, commands_stream);
if (GetDebugMode())
{
result.PutError(m_debugger.GetErrorFileHandle());
result.PutOutput(m_debugger.GetOutputFileHandle());
}
bool handle_events = true;
bool spawn_thread = false;
if (m_option_data.m_repl)
{
const char *repl_options = NULL;
if (!m_option_data.m_repl_options.empty())
repl_options = m_option_data.m_repl_options.c_str();
SBError error (m_debugger.RunREPL(m_option_data.m_repl_lang, repl_options));
if (error.Fail())
{
const char *error_cstr = error.GetCString();
if (error_cstr && error_cstr[0])
fprintf (stderr, "error: %s\n", error_cstr);
else
fprintf (stderr, "error: %u\n", error.GetError());
}
}
else
{
// Check if we have any data in the commands stream, and if so, save it to a temp file
// so we can then run the command interpreter using the file contents.
const char *commands_data = commands_stream.GetData();
const size_t commands_size = commands_stream.GetSize();
// The command file might have requested that we quit, this variable will track that.
bool quit_requested = false;
bool stopped_for_crash = false;
if (commands_data && commands_size)
{
int initial_commands_fds[2];
bool success = true;
FILE *commands_file = PrepareCommandsForSourcing (commands_data, commands_size, initial_commands_fds);
if (commands_file)
{
m_debugger.SetInputFileHandle (commands_file, true);
// Set the debugger into Sync mode when running the command file. Otherwise command files
// that run the target won't run in a sensible way.
bool old_async = m_debugger.GetAsync();
m_debugger.SetAsync(false);
int num_errors;
SBCommandInterpreterRunOptions options;
示例4: debugger
//.........这里部分代码省略.........
printf ("[0x%16.16llx - 0x%16.16llx) ", lo_pc, hi_pc);
}
SBType function_type = function.GetType();
SBType return_type = function_type.GetFunctionReturnType();
if (canonical)
return_type = return_type.GetCanonicalType();
if (func_mangled_name &&
func_mangled_name[0] == '_' &&
func_mangled_name[1] == 'Z')
{
printf ("%s %s\n", return_type.GetName(), func_demangled_name);
}
else
{
SBTypeList function_args = function_type.GetFunctionArgumentTypes();
const size_t num_function_args = function_args.GetSize();
if (is_objc_method)
{
const char *class_name_start = func_demangled_name + 2;
if (num_function_args == 0)
{
printf("%c(%s)[%s\n", func_demangled_name[0], return_type.GetName(), class_name_start);
}
else
{
const char *class_name_end = strchr(class_name_start,' ');
const int class_name_len = class_name_end - class_name_start;
printf ("%c(%s)[%*.*s", func_demangled_name[0], return_type.GetName(), class_name_len, class_name_len, class_name_start);
const char *selector_pos = class_name_end + 1;
for (uint32_t function_arg_idx = 0; function_arg_idx < num_function_args; ++function_arg_idx)
{
const char *selector_end = strchr(selector_pos, ':') + 1;
const int selector_len = selector_end - selector_pos;
SBType function_arg_type = function_args.GetTypeAtIndex(function_arg_idx);
if (canonical)
function_arg_type = function_arg_type.GetCanonicalType();
printf (" %*.*s", selector_len, selector_len, selector_pos);
if (function_arg_type.IsValid())
{
printf ("(%s)", function_arg_type.GetName());
}
else
{
printf ("(?)");
}
selector_pos = selector_end;
}
printf ("]\n");
}
}
else
{
printf ("%s ", return_type.GetName());
if (strchr (func_demangled_name, '('))
printf ("(*)(");
else
printf ("%s(", func_demangled_name);
for (uint32_t function_arg_idx = 0; function_arg_idx < num_function_args; ++function_arg_idx)
{
SBType function_arg_type = function_args.GetTypeAtIndex(function_arg_idx);
if (canonical)
function_arg_type = function_arg_type.GetCanonicalType();
if (function_arg_type.IsValid())
{
printf ("%s%s", function_arg_idx > 0 ? ", " : "", function_arg_type.GetName());
}
else
{
printf ("%s???", function_arg_idx > 0 ? ", " : "");
}
}
printf (")\n");
}
}
}
}
}
}
}
}
}
else
{
fprintf (stderr, "error: %s\n", error.GetCString());
exit(1);
}
}
return 0;
}