[Lldb-commits] [lldb] r121803 - in /lldb/trunk: lldb.xcodeproj/project.pbxproj source/Commands/CommandObjectCall.cpp source/Commands/CommandObjectCall.h
Greg Clayton
gclayton at apple.com
Tue Dec 14 15:13:52 PST 2010
Author: gclayton
Date: Tue Dec 14 17:13:51 2010
New Revision: 121803
URL: http://llvm.org/viewvc/llvm-project?rev=121803&view=rev
Log:
Removed unused files that were out of date and causing issues with the
linux build.
Removed:
lldb/trunk/source/Commands/CommandObjectCall.cpp
lldb/trunk/source/Commands/CommandObjectCall.h
Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=121803&r1=121802&r2=121803&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Tue Dec 14 17:13:51 2010
@@ -989,8 +989,6 @@
4C98D3DB118FB96F00E575D0 /* RecordingMemoryManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RecordingMemoryManager.cpp; path = source/Expression/RecordingMemoryManager.cpp; sourceTree = "<group>"; };
4C98D3E0118FB98F00E575D0 /* ClangFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ClangFunction.h; path = include/lldb/Expression/ClangFunction.h; sourceTree = "<group>"; };
4C98D3E1118FB98F00E575D0 /* RecordingMemoryManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RecordingMemoryManager.h; path = include/lldb/Expression/RecordingMemoryManager.h; sourceTree = "<group>"; };
- 4C98D3E4118FB9B100E575D0 /* CommandObjectCall.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectCall.cpp; path = source/Commands/CommandObjectCall.cpp; sourceTree = "<group>"; };
- 4C98D3E5118FB9B100E575D0 /* CommandObjectCall.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectCall.h; path = source/Commands/CommandObjectCall.h; sourceTree = "<group>"; };
4CA9637911B6E99A00780E28 /* CommandObjectApropos.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectApropos.cpp; path = source/Commands/CommandObjectApropos.cpp; sourceTree = "<group>"; };
4CA9637A11B6E99A00780E28 /* CommandObjectApropos.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectApropos.h; path = source/Commands/CommandObjectApropos.h; sourceTree = "<group>"; };
4CAFCE001101216B00CA63DB /* ThreadPlanRunToAddress.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadPlanRunToAddress.h; path = include/lldb/Target/ThreadPlanRunToAddress.h; sourceTree = "<group>"; };
@@ -1892,8 +1890,6 @@
26BC7E2D10F1B84700F91463 /* CommandObjectBreakpoint.cpp */,
9A42976111861A9F00FE05CD /* CommandObjectBreakpointCommand.h */,
9A42976211861AA600FE05CD /* CommandObjectBreakpointCommand.cpp */,
- 4C98D3E5118FB9B100E575D0 /* CommandObjectCall.h */,
- 4C98D3E4118FB9B100E575D0 /* CommandObjectCall.cpp */,
4C5DBBC711E3FEC60035160F /* CommandObjectCommands.h */,
4C5DBBC611E3FEC60035160F /* CommandObjectCommands.cpp */,
26BC7D1710F1B76300F91463 /* CommandObjectDisassemble.h */,
@@ -2459,7 +2455,6 @@
isa = PBXProject;
buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "lldb" */;
compatibilityVersion = "Xcode 3.1";
- developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
en,
Removed: lldb/trunk/source/Commands/CommandObjectCall.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCall.cpp?rev=121802&view=auto
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectCall.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectCall.cpp (removed)
@@ -1,341 +0,0 @@
-//===-- CommandObjectCall.cpp -----------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "CommandObjectCall.h"
-
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Interpreter/Args.h"
-#include "lldb/Core/Value.h"
-#include "lldb/Expression/ClangExpression.h"
-#include "lldb/Expression/ClangExpressionVariable.h"
-#include "lldb/Expression/ClangFunction.h"
-#include "lldb/Host/Host.h"
-#include "lldb/Interpreter/CommandInterpreter.h"
-#include "lldb/Core/Debugger.h"
-#include "lldb/Interpreter/CommandReturnObject.h"
-#include "lldb/Symbol/ObjectFile.h"
-#include "lldb/Symbol/Variable.h"
-#include "lldb/Target/Process.h"
-#include "lldb/Target/Target.h"
-#include "lldb/Target/StackFrame.h"
-
-using namespace lldb;
-using namespace lldb_private;
-
-// This command is a toy. I'm just using it to have a way to construct the arguments to
-// calling functions.
-//
-
-CommandObjectCall::CommandOptions::CommandOptions () :
- Options()
-{
- // Keep only one place to reset the values to their defaults
- ResetOptionValues();
-}
-
-
-CommandObjectCall::CommandOptions::~CommandOptions ()
-{
-}
-
-Error
-CommandObjectCall::CommandOptions::SetOptionValue (int option_idx, const char *option_arg)
-{
- Error error;
-
- char short_option = (char) m_getopt_table[option_idx].val;
-
- switch (short_option)
- {
- case 'l':
- if (language.SetLanguageFromCString (option_arg) == false)
- {
- error.SetErrorStringWithFormat("Invalid language option argument '%s'.\n", option_arg);
- }
- break;
-
- case 'g':
- debug = true;
- break;
-
- case 'f':
- error = Args::StringToFormat(option_arg,format);
- break;
-
- case 'n':
- noexecute = true;
- break;
-
- case 'a':
- use_abi = true;
- break;
-
- default:
- error.SetErrorStringWithFormat("Invalid short option character '%c'.\n", short_option);
- break;
- }
-
- return error;
-}
-
-void
-CommandObjectCall::CommandOptions::ResetOptionValues ()
-{
- Options::ResetOptionValues();
- language.Clear();
- debug = false;
- format = eFormatDefault;
- show_types = true;
- show_summary = true;
- noexecute = false;
- use_abi = false;
-}
-
-const lldb::OptionDefinition*
-CommandObjectCall::CommandOptions::GetDefinitions ()
-{
- return g_option_table;
-}
-
-CommandObjectCall::CommandObjectCall () :
- CommandObject (
- "call",
- "Call a function.",
- //"call <return_type> <function-name> [[<arg1-type> <arg1-value>] ... <argn-type> <argn-value>] [<cmd-options>]",
- NULL,
- eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
-{
- CommandArgumentEntry arg1;
- CommandArgumentEntry arg2;
- CommandArgumentEntry arg3;
- CommandArgumentData return_type_arg;
- CommandArgumentData function_name_arg;
- CommandArgumentData arg_type_arg;
- CommandArgumentData arg_value_arg;
-
- // Define the first (and only) variant of this arg.
- return_type_arg.arg_type = eArgTypeType;
- return_type_arg.arg_repetition = eArgRepeatPlain;
-
- arg1.push_back (return_type_arg);
-
- function_name_arg.arg_type = eArgTypeFunctionName;
- function_name_arg.arg_repetition = eArgTypePlain;
-
- arg2.push_back (function_name_arg);
-
- arg_type_arg.arg_type = eArgTypeArgType;
- arg_type_arg.arg_repetition = eArgRepeatPairRangeOptional;
-
- arg_value_arg.arg_type = eArgTypeValue;
- arg_value_arg.arg_repetition = eArgRepeatPairRangeOptional;
-
- arg3.push_back (arg_type_arg);
- arg3.push_back (arg_value_arg);
-
- // Push the data for the first argument into the m_arguments vector.
- m_arguments.push_back (arg1);
- m_arguments.push_back (arg2);
- m_arguments.push_back (arg3);
-}
-
-CommandObjectCall::~CommandObjectCall ()
-{
-}
-
-Options *
-CommandObjectCall::GetOptions ()
-{
- return &m_options;
-}
-
-bool
-CommandObjectCall::Execute
-(
- Args &command,
- CommandReturnObject &result
-)
-{
- ConstString target_triple;
- int num_args = command.GetArgumentCount();
-
- ExecutionContext exe_ctx(interpreter.GetDebugger().GetExecutionContext());
- if (exe_ctx.target)
- exe_ctx.target->GetTargetTriple(target_triple);
-
- if (!target_triple)
- target_triple = Host::GetTargetTriple ();
-
- if (exe_ctx.thread == NULL || exe_ctx.frame == NULL)
- {
- result.AppendError ("No currently selected thread and frame.");
- result.SetStatus (eReturnStatusFailed);
- return false;
- }
-
- if (num_args < 2)
- {
- result.AppendErrorWithFormat ("Invalid usage, should be: %s.\n", GetSyntax());
- result.SetStatus (eReturnStatusFailed);
- return false;
- }
-
- if ((num_args - 2) %2 != 0)
- {
- result.AppendErrorWithFormat ("Invalid usage - unmatched args & types, should be: %s.\n", GetSyntax());
- result.SetStatus (eReturnStatusFailed);
- return false;
- }
-
- if (target_triple)
- {
- //const char *return_type = command.GetArgumentAtIndex(0);
- const char *function_name = command.GetArgumentAtIndex(1);
- // Look up the called function:
-
- Function *target_fn = NULL;
-
- SymbolContextList sc_list;
-
- exe_ctx.frame->GetSymbolContext(eSymbolContextEverything).FindFunctionsByName(ConstString(function_name), false, sc_list);
-
- if (sc_list.GetSize() > 0)
- {
- SymbolContext sc;
- sc_list.GetContextAtIndex(0, sc);
- target_fn = sc.function;
- }
-
- // FIXME: If target_fn is NULL, we should look up the name as a symbol and use it and the provided
- // return type.
-
- if (target_fn == NULL)
- {
- result.AppendErrorWithFormat ("Could not find function '%s'.\n", function_name);
- result.SetStatus (eReturnStatusFailed);
- return false;
- }
-
- ValueList value_list;
- // Okay, now parse arguments. For now we only accept basic types.
- for (int i = 2; i < num_args; i+= 2)
- {
- const char *type_str = command.GetArgumentAtIndex(i);
- const char *value_str = command.GetArgumentAtIndex(i + 1);
- bool success;
- if (strcmp(type_str, "int") == 0
- || strcmp(type_str, "int32_t") == 0)
- {
- value_list.PushValue(Value(Args::StringToSInt32(value_str, 0, 0, &success)));
- }
- else if (strcmp (type_str, "int64_t") == 0)
- {
- value_list.PushValue(Value(Args::StringToSInt64(value_str, 0, 0, &success)));
- }
- else if (strcmp(type_str, "uint") == 0
- || strcmp(type_str, "uint32_t") == 0)
- {
- value_list.PushValue(Value(Args::StringToUInt32(value_str, 0, 0, &success)));
- }
- else if (strcmp (type_str, "uint64_t") == 0)
- {
- value_list.PushValue(Value(Args::StringToUInt64(value_str, 0, 0, &success)));
- }
- else if (strcmp (type_str, "cstr") == 0)
- {
- Value val ((intptr_t)value_str);
- val.SetValueType (Value::eValueTypeHostAddress);
-
-
- void *cstr_type = exe_ctx.target->GetScratchClangASTContext()->GetCStringType(true);
- val.SetContext (Value::eContextTypeClangType, cstr_type);
- value_list.PushValue(val);
-
- success = true;
- }
-
- if (!success)
- {
- result.AppendErrorWithFormat ("Could not convert value: '%s' to type '%s'.\n", value_str, type_str);
- result.SetStatus (eReturnStatusFailed);
- return false;
- }
- }
- // Okay, we have the function and the argument list and the return type. Now make a ClangFunction object and
- // run it:
-
- StreamString errors;
- ClangFunction clang_fun (target_triple.GetCString(), *target_fn, exe_ctx.target->GetScratchClangASTContext(), value_list);
- if (m_options.noexecute)
- {
- // Now write down the argument values for this call.
- lldb::addr_t args_addr = LLDB_INVALID_ADDRESS;
- if (!clang_fun.InsertFunction (exe_ctx, args_addr, errors))
- {
- result.AppendErrorWithFormat("Error inserting function: '%s'.\n", errors.GetData());
- result.SetStatus (eReturnStatusFailed);
- return false;
- }
- else
- {
- result.Succeeded();
- return true;
- }
- }
-
- Process::ExecutionResults return_status;
- Value return_value;
-
- bool stop_others = true;
- return_status = clang_fun.ExecuteFunction(exe_ctx, errors, stop_others, NULL, return_value);
-
- // Now figure out what to do with the return value.
- if (return_status == Process::eExecutionSetupError)
- {
- result.AppendErrorWithFormat("Error setting up function execution: '%s'.\n", errors.GetData());
- result.SetStatus (eReturnStatusFailed);
- return false;
- }
- else if (return_status != Process::eExecutionCompleted)
- {
- result.AppendWarningWithFormat("Interrupted while calling function: '%s'.\n", errors.GetData());
- result.SetStatus(eReturnStatusSuccessFinishNoResult);
- return true;
- }
- else
- {
- // Now print out the result.
- result.GetOutputStream().Printf("Return value: ");
- return_value.Dump(&(result.GetOutputStream()));
- result.Succeeded();
- }
-
- }
- else
- {
- result.AppendError ("invalid target triple");
- result.SetStatus (eReturnStatusFailed);
- }
- return result.Succeeded();
-}
-
-lldb::OptionDefinition
-CommandObjectCall::CommandOptions::g_option_table[] =
-{
-{ LLDB_OPT_SET_1, false, "language", 'l', required_argument, NULL, 0, "[c|c++|objc|objc++]", "Sets the language to use when parsing the expression."},
-{ LLDB_OPT_SET_1, false, "format", 'f', required_argument, NULL, 0, "[ [bool|b] | [bin] | [char|c] | [oct|o] | [dec|i|d|u] | [hex|x] | [float|f] | [cstr|s] ]", "Specify the format that the expression output should use."},
-{ LLDB_OPT_SET_1, false, "debug", 'g', no_argument, NULL, 0, NULL, "Enable verbose debug logging of the expression parsing and evaluation."},
-{ LLDB_OPT_SET_1, false, "noexecute", 'n', no_argument, NULL, 0, "no execute", "Only JIT and copy the wrapper & arguments, but don't execute."},
-{ LLDB_OPT_SET_1, false, "use-abi", 'a', no_argument, NULL, 0, NULL, "Use the ABI instead of the JIT to marshall arguments."},
-{ 0, false, NULL, 0, 0, NULL, NULL, NULL, NULL }
-};
-
Removed: lldb/trunk/source/Commands/CommandObjectCall.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCall.h?rev=121802&view=auto
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectCall.h (original)
+++ lldb/trunk/source/Commands/CommandObjectCall.h (removed)
@@ -1,82 +0,0 @@
-//===-- CommandObjectCall.h -------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_CommandObjectCall_h_
-#define liblldb_CommandObjectCall_h_
-
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Interpreter/CommandObject.h"
-#include "lldb/Interpreter/Options.h"
-#include "lldb/Core/Language.h"
-
-namespace lldb_private {
-
-class CommandObjectCall : public CommandObject
-{
-public:
-
- class CommandOptions : public Options
- {
- public:
-
- CommandOptions ();
-
- virtual
- ~CommandOptions ();
-
- virtual Error
- SetOptionValue (int option_idx, const char *option_arg);
-
- void
- ResetOptionValues ();
-
- const lldb::OptionDefinition*
- GetDefinitions ();
-
- // Options table: Required for subclasses of Options.
-
- static lldb::OptionDefinition g_option_table[];
- Language language;
- lldb::Encoding encoding;
- lldb::Format format;
- bool debug;
- bool show_types;
- bool show_summary;
- bool noexecute;
- bool use_abi;
- };
-
- CommandObjectCall ();
-
- virtual
- ~CommandObjectCall ();
-
- virtual
- Options *
- GetOptions ();
-
-
- virtual bool
- Execute (Args& command,
- CommandReturnObject &result);
-
- virtual bool
- WantsRawCommandString() { return false; }
-
-protected:
-
- CommandOptions m_options;
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_CommandObjectCall_h_
More information about the lldb-commits
mailing list