blob: cd6474c658e98dc49d3f4422c2cd6ee625bdaedd [file] [log] [blame]
Chris Lattner24943d22010-06-08 16:52:24 +00001//===-- CommandObjectExpression.cpp -----------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "CommandObjectExpression.h"
11
12// C Includes
13// C++ Includes
14// Other libraries and framework includes
15// Project includes
Sean Callanan841026f2010-07-23 00:16:21 +000016#include "lldb/Interpreter/Args.h"
Chris Lattner24943d22010-06-08 16:52:24 +000017#include "lldb/Core/Value.h"
18#include "lldb/Core/InputReader.h"
Jim Ingham324067b2010-09-30 00:54:27 +000019#include "lldb/Core/ValueObjectVariable.h"
Chris Lattner24943d22010-06-08 16:52:24 +000020#include "lldb/Expression/ClangExpressionVariable.h"
Sean Callanan65dafa82010-08-27 01:01:44 +000021#include "lldb/Expression/ClangUserExpression.h"
Stephen Wilson63c468c2010-07-23 21:47:22 +000022#include "lldb/Expression/ClangFunction.h"
Chris Lattner24943d22010-06-08 16:52:24 +000023#include "lldb/Expression/DWARFExpression.h"
24#include "lldb/Host/Host.h"
Sean Callanan841026f2010-07-23 00:16:21 +000025#include "lldb/Core/Debugger.h"
Greg Clayton63094e02010-06-23 01:19:29 +000026#include "lldb/Interpreter/CommandInterpreter.h"
Chris Lattner24943d22010-06-08 16:52:24 +000027#include "lldb/Interpreter/CommandReturnObject.h"
Jim Ingham324067b2010-09-30 00:54:27 +000028#include "lldb/Target/ObjCLanguageRuntime.h"
Chris Lattner24943d22010-06-08 16:52:24 +000029#include "lldb/Symbol/ObjectFile.h"
30#include "lldb/Symbol/Variable.h"
31#include "lldb/Target/Process.h"
32#include "lldb/Target/StackFrame.h"
33#include "lldb/Target/Target.h"
Greg Claytonabe0fed2011-04-18 08:33:37 +000034#include "lldb/Target/Thread.h"
Sean Callanan841026f2010-07-23 00:16:21 +000035#include "llvm/ADT/StringRef.h"
Chris Lattner24943d22010-06-08 16:52:24 +000036
37using namespace lldb;
38using namespace lldb_private;
39
Greg Claytonf15996e2011-04-07 22:46:35 +000040CommandObjectExpression::CommandOptions::CommandOptions (CommandInterpreter &interpreter) :
Johnny Chen93356432011-04-08 22:39:17 +000041 Options(interpreter)
Chris Lattner24943d22010-06-08 16:52:24 +000042{
43 // Keep only one place to reset the values to their defaults
Greg Clayton143fcc32011-04-13 00:18:08 +000044 OptionParsingStarting();
Chris Lattner24943d22010-06-08 16:52:24 +000045}
46
47
48CommandObjectExpression::CommandOptions::~CommandOptions ()
49{
50}
51
52Error
Greg Clayton143fcc32011-04-13 00:18:08 +000053CommandObjectExpression::CommandOptions::SetOptionValue (uint32_t option_idx, const char *option_arg)
Chris Lattner24943d22010-06-08 16:52:24 +000054{
55 Error error;
56
57 char short_option = (char) m_getopt_table[option_idx].val;
58
59 switch (short_option)
60 {
Caroline Ticec1ad82e2010-09-07 22:38:08 +000061 //case 'l':
62 //if (language.SetLanguageFromCString (option_arg) == false)
63 //{
64 // error.SetErrorStringWithFormat("Invalid language option argument '%s'.\n", option_arg);
65 //}
66 //break;
Chris Lattner24943d22010-06-08 16:52:24 +000067
68 case 'g':
69 debug = true;
70 break;
71
72 case 'f':
Greg Clayton56bbdaf2011-04-28 20:55:26 +000073 error = Args::StringToFormat(option_arg, format, NULL);
Chris Lattner24943d22010-06-08 16:52:24 +000074 break;
Jim Ingham324067b2010-09-30 00:54:27 +000075
76 case 'o':
77 print_object = true;
78 break;
Jim Inghamea9d4262010-11-05 19:25:48 +000079
Jim Inghame41494a2011-04-16 00:01:13 +000080 case 'd':
81 {
82 bool success;
83 bool result;
84 result = Args::StringToBoolean(option_arg, true, &success);
85 if (!success)
86 error.SetErrorStringWithFormat("Invalid dynamic value setting: \"%s\".\n", option_arg);
87 else
88 {
89 if (result)
Greg Clayton82f07462011-05-30 00:49:24 +000090 use_dynamic = eLazyBoolYes;
Jim Inghame41494a2011-04-16 00:01:13 +000091 else
92 use_dynamic = eLazyBoolNo;
93 }
94 }
95 break;
96
Jim Inghamea9d4262010-11-05 19:25:48 +000097 case 'u':
Sean Callanan47dc4572011-09-15 02:13:07 +000098 {
99 bool success;
100 unwind_on_error = Args::StringToBoolean(option_arg, true, &success);
101 if (!success)
102 error.SetErrorStringWithFormat("Could not convert \"%s\" to a boolean value.", option_arg);
103 break;
104 }
Chris Lattner24943d22010-06-08 16:52:24 +0000105 default:
106 error.SetErrorStringWithFormat("Invalid short option character '%c'.\n", short_option);
107 break;
108 }
109
110 return error;
111}
112
113void
Greg Clayton143fcc32011-04-13 00:18:08 +0000114CommandObjectExpression::CommandOptions::OptionParsingStarting ()
Chris Lattner24943d22010-06-08 16:52:24 +0000115{
Caroline Ticec1ad82e2010-09-07 22:38:08 +0000116 //language.Clear();
Chris Lattner24943d22010-06-08 16:52:24 +0000117 debug = false;
118 format = eFormatDefault;
Jim Ingham324067b2010-09-30 00:54:27 +0000119 print_object = false;
Jim Inghame41494a2011-04-16 00:01:13 +0000120 use_dynamic = eLazyBoolCalculate;
Jim Inghamea9d4262010-11-05 19:25:48 +0000121 unwind_on_error = true;
Chris Lattner24943d22010-06-08 16:52:24 +0000122 show_types = true;
123 show_summary = true;
124}
125
Greg Claytonb3448432011-03-24 21:19:54 +0000126const OptionDefinition*
Chris Lattner24943d22010-06-08 16:52:24 +0000127CommandObjectExpression::CommandOptions::GetDefinitions ()
128{
129 return g_option_table;
130}
131
Greg Clayton238c0a12010-09-18 01:14:36 +0000132CommandObjectExpression::CommandObjectExpression (CommandInterpreter &interpreter) :
133 CommandObject (interpreter,
134 "expression",
Johnny Chen106a7372010-09-30 18:16:58 +0000135 "Evaluate a C/ObjC/C++ expression in the current program context, using variables currently in scope.",
Caroline Tice43b014a2010-10-04 22:28:36 +0000136 NULL),
Greg Claytonf15996e2011-04-07 22:46:35 +0000137 m_options (interpreter),
Johnny Chencc112ac2010-09-30 18:30:25 +0000138 m_expr_line_count (0),
Chris Lattner24943d22010-06-08 16:52:24 +0000139 m_expr_lines ()
140{
141 SetHelpLong(
142"Examples: \n\
143\n\
144 expr my_struct->a = my_array[3] \n\
145 expr -f bin -- (index * 8) + 5 \n\
146 expr char c[] = \"foo\"; c[0]\n");
Caroline Tice43b014a2010-10-04 22:28:36 +0000147
148 CommandArgumentEntry arg;
149 CommandArgumentData expression_arg;
150
151 // Define the first (and only) variant of this arg.
152 expression_arg.arg_type = eArgTypeExpression;
153 expression_arg.arg_repetition = eArgRepeatPlain;
154
155 // There is only one variant this argument could be; put it into the argument entry.
156 arg.push_back (expression_arg);
157
158 // Push the data for the first argument into the m_arguments vector.
159 m_arguments.push_back (arg);
Chris Lattner24943d22010-06-08 16:52:24 +0000160}
161
162CommandObjectExpression::~CommandObjectExpression ()
163{
164}
165
166Options *
167CommandObjectExpression::GetOptions ()
168{
169 return &m_options;
170}
171
172
173bool
174CommandObjectExpression::Execute
175(
176 Args& command,
Chris Lattner24943d22010-06-08 16:52:24 +0000177 CommandReturnObject &result
178)
179{
180 return false;
181}
182
183
184size_t
185CommandObjectExpression::MultiLineExpressionCallback
186(
187 void *baton,
Greg Clayton63094e02010-06-23 01:19:29 +0000188 InputReader &reader,
Chris Lattner24943d22010-06-08 16:52:24 +0000189 lldb::InputReaderAction notification,
190 const char *bytes,
191 size_t bytes_len
192)
193{
Chris Lattner24943d22010-06-08 16:52:24 +0000194 CommandObjectExpression *cmd_object_expr = (CommandObjectExpression *) baton;
Caroline Tice892fadd2011-06-16 16:27:19 +0000195 bool batch_mode = reader.GetDebugger().GetCommandInterpreter().GetBatchCommandMode();
196
Chris Lattner24943d22010-06-08 16:52:24 +0000197 switch (notification)
198 {
199 case eInputReaderActivate:
Caroline Tice892fadd2011-06-16 16:27:19 +0000200 if (!batch_mode)
Caroline Tice2b5e4e62011-06-15 19:35:17 +0000201 {
Greg Clayton234981a2011-07-20 03:41:06 +0000202 StreamSP async_strm_sp(reader.GetDebugger().GetAsyncOutputStream());
203 if (async_strm_sp)
204 {
205 async_strm_sp->PutCString("Enter expressions, then terminate with an empty line to evaluate:\n");
206 async_strm_sp->Flush();
207 }
Caroline Tice2b5e4e62011-06-15 19:35:17 +0000208 }
Chris Lattner24943d22010-06-08 16:52:24 +0000209 // Fall through
210 case eInputReaderReactivate:
Chris Lattner24943d22010-06-08 16:52:24 +0000211 break;
212
213 case eInputReaderDeactivate:
214 break;
215
Caroline Tice4a348082011-05-02 20:41:46 +0000216 case eInputReaderAsynchronousOutputWritten:
217 break;
218
Chris Lattner24943d22010-06-08 16:52:24 +0000219 case eInputReaderGotToken:
220 ++cmd_object_expr->m_expr_line_count;
221 if (bytes && bytes_len)
222 {
223 cmd_object_expr->m_expr_lines.append (bytes, bytes_len + 1);
224 }
225
226 if (bytes_len == 0)
Greg Clayton63094e02010-06-23 01:19:29 +0000227 reader.SetIsDone(true);
Chris Lattner24943d22010-06-08 16:52:24 +0000228 break;
229
Caroline Ticec4f55fe2010-11-19 20:47:54 +0000230 case eInputReaderInterrupt:
231 cmd_object_expr->m_expr_lines.clear();
232 reader.SetIsDone (true);
Caroline Tice892fadd2011-06-16 16:27:19 +0000233 if (!batch_mode)
Caroline Tice2b5e4e62011-06-15 19:35:17 +0000234 {
Greg Clayton234981a2011-07-20 03:41:06 +0000235 StreamSP async_strm_sp (reader.GetDebugger().GetAsyncOutputStream());
236 if (async_strm_sp)
237 {
238 async_strm_sp->PutCString("Expression evaluation cancelled.\n");
239 async_strm_sp->Flush();
240 }
Caroline Tice2b5e4e62011-06-15 19:35:17 +0000241 }
Caroline Ticec4f55fe2010-11-19 20:47:54 +0000242 break;
243
244 case eInputReaderEndOfFile:
245 reader.SetIsDone (true);
246 break;
247
Chris Lattner24943d22010-06-08 16:52:24 +0000248 case eInputReaderDone:
Caroline Ticec4f55fe2010-11-19 20:47:54 +0000249 if (cmd_object_expr->m_expr_lines.size() > 0)
Chris Lattner24943d22010-06-08 16:52:24 +0000250 {
Caroline Tice87e1f772011-06-13 20:20:29 +0000251 StreamSP output_stream = reader.GetDebugger().GetAsyncOutputStream();
252 StreamSP error_stream = reader.GetDebugger().GetAsyncErrorStream();
Chris Lattner24943d22010-06-08 16:52:24 +0000253 cmd_object_expr->EvaluateExpression (cmd_object_expr->m_expr_lines.c_str(),
Caroline Tice87e1f772011-06-13 20:20:29 +0000254 output_stream.get(),
255 error_stream.get());
256 output_stream->Flush();
257 error_stream->Flush();
Chris Lattner24943d22010-06-08 16:52:24 +0000258 }
259 break;
260 }
261
262 return bytes_len;
263}
264
265bool
Greg Clayton66ed2fb2010-10-05 00:00:42 +0000266CommandObjectExpression::EvaluateExpression
267(
268 const char *expr,
Caroline Tice87e1f772011-06-13 20:20:29 +0000269 Stream *output_stream,
270 Stream *error_stream,
Greg Clayton66ed2fb2010-10-05 00:00:42 +0000271 CommandReturnObject *result
272)
Chris Lattner24943d22010-06-08 16:52:24 +0000273{
Sean Callanan77e93942010-10-29 00:29:03 +0000274 if (m_exe_ctx.target)
Chris Lattner24943d22010-06-08 16:52:24 +0000275 {
Greg Clayton427f2902010-12-14 02:59:59 +0000276 lldb::ValueObjectSP result_valobj_sp;
Greg Clayton11730f32010-10-06 03:09:11 +0000277
Greg Claytonb3448432011-03-24 21:19:54 +0000278 ExecutionResults exe_results;
Sean Callanan6a925532011-01-13 08:53:35 +0000279
280 bool keep_in_memory = true;
Jim Ingham10de7d12011-05-04 03:43:18 +0000281 lldb::DynamicValueType use_dynamic;
Jim Inghame41494a2011-04-16 00:01:13 +0000282 // If use dynamic is not set, get it from the target:
283 switch (m_options.use_dynamic)
284 {
285 case eLazyBoolCalculate:
Jim Ingham10de7d12011-05-04 03:43:18 +0000286 use_dynamic = m_exe_ctx.target->GetPreferDynamicValue();
Jim Inghame41494a2011-04-16 00:01:13 +0000287 break;
288 case eLazyBoolYes:
Jim Ingham10de7d12011-05-04 03:43:18 +0000289 use_dynamic = lldb::eDynamicCanRunTarget;
Jim Inghame41494a2011-04-16 00:01:13 +0000290 break;
291 case eLazyBoolNo:
Jim Ingham10de7d12011-05-04 03:43:18 +0000292 use_dynamic = lldb::eNoDynamicValues;
Jim Inghame41494a2011-04-16 00:01:13 +0000293 break;
294 }
Sean Callanan6a925532011-01-13 08:53:35 +0000295
Sean Callanan47dc4572011-09-15 02:13:07 +0000296 exe_results = m_exe_ctx.target->EvaluateExpression(expr,
297 m_exe_ctx.frame,
298 eExecutionPolicyOnlyWhenNeeded,
299 m_options.unwind_on_error,
300 keep_in_memory,
301 use_dynamic,
302 result_valobj_sp);
Greg Clayton427f2902010-12-14 02:59:59 +0000303
304 if (exe_results == eExecutionInterrupted && !m_options.unwind_on_error)
Jim Ingham360f53f2010-11-30 02:22:11 +0000305 {
Greg Claytonabe0fed2011-04-18 08:33:37 +0000306 uint32_t start_frame = 0;
307 uint32_t num_frames = 1;
308 uint32_t num_frames_with_source = 0;
Jim Ingham360f53f2010-11-30 02:22:11 +0000309 if (m_exe_ctx.thread)
Greg Claytonabe0fed2011-04-18 08:33:37 +0000310 {
311 m_exe_ctx.thread->GetStatus (result->GetOutputStream(),
312 start_frame,
313 num_frames,
314 num_frames_with_source);
315 }
316 else if (m_exe_ctx.process)
317 {
318 bool only_threads_with_stop_reason = true;
319 m_exe_ctx.process->GetThreadStatus (result->GetOutputStream(),
320 only_threads_with_stop_reason,
321 start_frame,
322 num_frames,
323 num_frames_with_source);
324 }
Greg Clayton427f2902010-12-14 02:59:59 +0000325 }
326
327 if (result_valobj_sp)
328 {
329 if (result_valobj_sp->GetError().Success())
330 {
331 if (m_options.format != eFormatDefault)
332 result_valobj_sp->SetFormat (m_options.format);
333
Caroline Tice87e1f772011-06-13 20:20:29 +0000334 ValueObject::DumpValueObject (*(output_stream),
Greg Clayton427f2902010-12-14 02:59:59 +0000335 result_valobj_sp.get(), // Variable object to dump
336 result_valobj_sp->GetName().GetCString(),// Root object name
337 0, // Pointer depth to traverse (zero means stop at pointers)
338 0, // Current depth, this is the top most, so zero...
339 UINT32_MAX, // Max depth to go when dumping concrete types, dump everything...
340 m_options.show_types, // Show types when dumping?
341 false, // Show locations of variables, no since this is a host address which we don't care to see
342 m_options.print_object, // Print the objective C object?
Jim Inghame41494a2011-04-16 00:01:13 +0000343 use_dynamic,
Enrico Granatae4e3e2c2011-07-22 00:16:08 +0000344 true, // Use synthetic children if available
Greg Clayton427f2902010-12-14 02:59:59 +0000345 true, // Scope is already checked. Const results are always in scope.
Enrico Granata7f163b32011-07-16 01:22:04 +0000346 false, // Don't flatten output
Enrico Granata018921d2011-08-12 02:00:06 +0000347 0, // Always use summaries (you might want an option --no-summary like there is for frame variable)
348 false); // Do not show more children than settings allow
Greg Clayton427f2902010-12-14 02:59:59 +0000349 if (result)
350 result->SetStatus (eReturnStatusSuccessFinishResult);
351 }
352 else
353 {
Sean Callanan24312442011-08-23 21:20:51 +0000354 if (result_valobj_sp->GetError().GetError() == ClangUserExpression::kNoResult)
Greg Claytonfe1b47d2011-06-24 22:31:10 +0000355 {
Sean Callanan24312442011-08-23 21:20:51 +0000356 error_stream->PutCString("<no result>\n");
357
358 if (result)
359 result->SetStatus (eReturnStatusSuccessFinishResult);
Greg Claytonfe1b47d2011-06-24 22:31:10 +0000360 }
361 else
362 {
Sean Callanan24312442011-08-23 21:20:51 +0000363 const char *error_cstr = result_valobj_sp->GetError().AsCString();
364 if (error_cstr && error_cstr[0])
365 {
366 int error_cstr_len = strlen (error_cstr);
367 const bool ends_with_newline = error_cstr[error_cstr_len - 1] == '\n';
368 if (strstr(error_cstr, "error:") != error_cstr)
369 error_stream->PutCString ("error: ");
370 error_stream->Write(error_cstr, error_cstr_len);
371 if (!ends_with_newline)
372 error_stream->EOL();
373 }
374 else
375 {
376 error_stream->PutCString ("error: unknown error\n");
377 }
378
379 if (result)
380 result->SetStatus (eReturnStatusFailed);
Greg Claytonfe1b47d2011-06-24 22:31:10 +0000381 }
Jim Ingham360f53f2010-11-30 02:22:11 +0000382 }
383 }
Greg Clayton427f2902010-12-14 02:59:59 +0000384 }
385 else
386 {
Caroline Tice87e1f772011-06-13 20:20:29 +0000387 error_stream->Printf ("error: invalid execution context for expression\n");
Greg Clayton427f2902010-12-14 02:59:59 +0000388 return false;
Sean Callanan841026f2010-07-23 00:16:21 +0000389 }
Sean Callanan82b74c82010-08-12 01:56:52 +0000390
Sean Callanan841026f2010-07-23 00:16:21 +0000391 return true;
Chris Lattner24943d22010-06-08 16:52:24 +0000392}
393
394bool
395CommandObjectExpression::ExecuteRawCommandString
396(
397 const char *command,
Chris Lattner24943d22010-06-08 16:52:24 +0000398 CommandReturnObject &result
399)
400{
Greg Claytonb72d0f02011-04-12 05:54:46 +0000401 m_exe_ctx = m_interpreter.GetExecutionContext();
Chris Lattner24943d22010-06-08 16:52:24 +0000402
Greg Clayton143fcc32011-04-13 00:18:08 +0000403 m_options.NotifyOptionParsingStarting();
Chris Lattner24943d22010-06-08 16:52:24 +0000404
405 const char * expr = NULL;
406
407 if (command[0] == '\0')
408 {
409 m_expr_lines.clear();
410 m_expr_line_count = 0;
411
Greg Clayton238c0a12010-09-18 01:14:36 +0000412 InputReaderSP reader_sp (new InputReader(m_interpreter.GetDebugger()));
Chris Lattner24943d22010-06-08 16:52:24 +0000413 if (reader_sp)
414 {
415 Error err (reader_sp->Initialize (CommandObjectExpression::MultiLineExpressionCallback,
416 this, // baton
417 eInputReaderGranularityLine, // token size, to pass to callback function
Greg Clayton63094e02010-06-23 01:19:29 +0000418 NULL, // end token
Chris Lattner24943d22010-06-08 16:52:24 +0000419 NULL, // prompt
420 true)); // echo input
421 if (err.Success())
422 {
Greg Clayton238c0a12010-09-18 01:14:36 +0000423 m_interpreter.GetDebugger().PushInputReader (reader_sp);
Chris Lattner24943d22010-06-08 16:52:24 +0000424 result.SetStatus (eReturnStatusSuccessFinishNoResult);
425 }
426 else
427 {
428 result.AppendError (err.AsCString());
429 result.SetStatus (eReturnStatusFailed);
430 }
431 }
432 else
433 {
434 result.AppendError("out of memory");
435 result.SetStatus (eReturnStatusFailed);
436 }
437 return result.Succeeded();
438 }
439
440 if (command[0] == '-')
441 {
442 // We have some options and these options MUST end with --.
443 const char *end_options = NULL;
444 const char *s = command;
445 while (s && s[0])
446 {
447 end_options = ::strstr (s, "--");
448 if (end_options)
449 {
450 end_options += 2; // Get past the "--"
451 if (::isspace (end_options[0]))
452 {
453 expr = end_options;
454 while (::isspace (*expr))
455 ++expr;
456 break;
457 }
458 }
459 s = end_options;
460 }
461
462 if (end_options)
463 {
Greg Clayton63094e02010-06-23 01:19:29 +0000464 Args args (command, end_options - command);
Greg Clayton238c0a12010-09-18 01:14:36 +0000465 if (!ParseOptions (args, result))
Chris Lattner24943d22010-06-08 16:52:24 +0000466 return false;
Greg Clayton143fcc32011-04-13 00:18:08 +0000467
468 Error error (m_options.NotifyOptionParsingFinished());
469 if (error.Fail())
470 {
471 result.AppendError (error.AsCString());
472 result.SetStatus (eReturnStatusFailed);
473 return false;
474 }
Chris Lattner24943d22010-06-08 16:52:24 +0000475 }
476 }
477
Chris Lattner24943d22010-06-08 16:52:24 +0000478 if (expr == NULL)
479 expr = command;
Sean Callanan46b62492010-06-24 00:16:27 +0000480
Caroline Tice87e1f772011-06-13 20:20:29 +0000481 if (EvaluateExpression (expr, &(result.GetOutputStream()), &(result.GetErrorStream()), &result))
Johnny Chen0deefc72010-08-13 00:42:30 +0000482 return true;
483
484 result.SetStatus (eReturnStatusFailed);
485 return false;
Chris Lattner24943d22010-06-08 16:52:24 +0000486}
487
Greg Claytonb3448432011-03-24 21:19:54 +0000488OptionDefinition
Chris Lattner24943d22010-06-08 16:52:24 +0000489CommandObjectExpression::CommandOptions::g_option_table[] =
490{
Johnny Chen2bc9eb32011-07-19 19:48:13 +0000491//{ LLDB_OPT_SET_ALL, false, "language", 'l', required_argument, NULL, 0, "[c|c++|objc|objc++]", "Sets the language to use when parsing the expression."},
Caroline Tice4d6675c2010-10-01 19:59:14 +0000492//{ 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."},
Johnny Chen2bc9eb32011-07-19 19:48:13 +0000493{ LLDB_OPT_SET_1, false, "format", 'f', required_argument, NULL, 0, eArgTypeExprFormat, "Specify the format that the expression output should use."},
494{ LLDB_OPT_SET_2, false, "object-description", 'o', no_argument, NULL, 0, eArgTypeNone, "Print the object description of the value resulting from the expression."},
495{ LLDB_OPT_SET_2, false, "dynamic-value", 'd', required_argument, NULL, 0, eArgTypeBoolean, "Upcast the value resulting from the expression to its dynamic type if available."},
496{ LLDB_OPT_SET_ALL, false, "unwind-on-error", 'u', required_argument, NULL, 0, eArgTypeBoolean, "Clean up program state if the expression causes a crash, breakpoint hit or signal."},
497{ LLDB_OPT_SET_ALL, false, "debug", 'g', no_argument, NULL, 0, eArgTypeNone, "Enable verbose debug logging of the expression parsing and evaluation."},
Johnny Chen2bc9eb32011-07-19 19:48:13 +0000498{ 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
Chris Lattner24943d22010-06-08 16:52:24 +0000499};
500