blob: ed196475a0b19717e62b4e41dc41a97a01fd7fd2 [file] [log] [blame]
Chris Lattner24943d22010-06-08 16:52:24 +00001//===-- CommandObjectImage.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 "CommandObjectImage.h"
11
12// C Includes
13// C++ Includes
14// Other libraries and framework includes
15// Project includes
Greg Clayton63094e02010-06-23 01:19:29 +000016#include "lldb/Core/Debugger.h"
Greg Clayton5f54ac32011-02-08 05:05:52 +000017#include "lldb/Host/FileSpec.h"
Greg Clayton63094e02010-06-23 01:19:29 +000018#include "lldb/Core/Module.h"
Chris Lattner24943d22010-06-08 16:52:24 +000019#include "lldb/Core/RegularExpression.h"
20#include "lldb/Core/Stream.h"
Greg Clayton63094e02010-06-23 01:19:29 +000021#include "lldb/Interpreter/Args.h"
22#include "lldb/Interpreter/Options.h"
23#include "lldb/Interpreter/CommandCompletions.h"
24#include "lldb/Interpreter/CommandInterpreter.h"
25#include "lldb/Interpreter/CommandReturnObject.h"
26#include "lldb/Symbol/LineTable.h"
27#include "lldb/Symbol/ObjectFile.h"
Chris Lattner24943d22010-06-08 16:52:24 +000028#include "lldb/Symbol/SymbolFile.h"
29#include "lldb/Symbol/SymbolVendor.h"
Chris Lattner24943d22010-06-08 16:52:24 +000030#include "lldb/Target/Process.h"
31#include "lldb/Target/Target.h"
Chris Lattner24943d22010-06-08 16:52:24 +000032
33using namespace lldb;
34using namespace lldb_private;
35
36//----------------------------------------------------------------------
37// Static Helper functions
38//----------------------------------------------------------------------
39static void
40DumpModuleArchitecture (Stream &strm, Module *module, uint32_t width)
41{
42 if (module)
43 {
44 if (width)
Greg Clayton940b1032011-02-23 00:35:02 +000045 strm.Printf("%-*s", width, module->GetArchitecture().GetArchitectureName());
Chris Lattner24943d22010-06-08 16:52:24 +000046 else
Greg Clayton940b1032011-02-23 00:35:02 +000047 strm.PutCString(module->GetArchitecture().GetArchitectureName());
Chris Lattner24943d22010-06-08 16:52:24 +000048 }
49}
50
51static void
52DumpModuleUUID (Stream &strm, Module *module)
53{
54 module->GetUUID().Dump (&strm);
55}
56
57static uint32_t
58DumpCompileUnitLineTable
59(
Greg Clayton63094e02010-06-23 01:19:29 +000060 CommandInterpreter &interpreter,
Chris Lattner24943d22010-06-08 16:52:24 +000061 Stream &strm,
62 Module *module,
63 const FileSpec &file_spec,
64 bool load_addresses
65)
66{
67 uint32_t num_matches = 0;
68 if (module)
69 {
70 SymbolContextList sc_list;
71 num_matches = module->ResolveSymbolContextsForFileSpec (file_spec,
72 0,
73 false,
74 eSymbolContextCompUnit,
75 sc_list);
76
77 for (uint32_t i=0; i<num_matches; ++i)
78 {
79 SymbolContext sc;
80 if (sc_list.GetContextAtIndex(i, sc))
81 {
82 if (i > 0)
83 strm << "\n\n";
84
Johnny Chencff44fd2010-10-29 22:18:43 +000085 strm << "Line table for " << *static_cast<FileSpec*> (sc.comp_unit) << " in `"
Chris Lattner24943d22010-06-08 16:52:24 +000086 << module->GetFileSpec().GetFilename() << "\n";
87 LineTable *line_table = sc.comp_unit->GetLineTable();
88 if (line_table)
Greg Clayton63094e02010-06-23 01:19:29 +000089 line_table->GetDescription (&strm,
Greg Claytoneea26402010-09-14 23:36:40 +000090 interpreter.GetDebugger().GetExecutionContext().target,
Greg Clayton63094e02010-06-23 01:19:29 +000091 lldb::eDescriptionLevelBrief);
Chris Lattner24943d22010-06-08 16:52:24 +000092 else
93 strm << "No line table";
94 }
95 }
96 }
97 return num_matches;
98}
99
100static void
101DumpFullpath (Stream &strm, const FileSpec *file_spec_ptr, uint32_t width)
102{
103 if (file_spec_ptr)
104 {
105 if (width > 0)
106 {
107 char fullpath[PATH_MAX];
108 if (file_spec_ptr->GetPath(fullpath, sizeof(fullpath)))
109 {
110 strm.Printf("%-*s", width, fullpath);
111 return;
112 }
113 }
114 else
115 {
116 file_spec_ptr->Dump(&strm);
117 return;
118 }
119 }
120 // Keep the width spacing correct if things go wrong...
121 if (width > 0)
122 strm.Printf("%-*s", width, "");
123}
124
125static void
126DumpDirectory (Stream &strm, const FileSpec *file_spec_ptr, uint32_t width)
127{
128 if (file_spec_ptr)
129 {
130 if (width > 0)
131 strm.Printf("%-*s", width, file_spec_ptr->GetDirectory().AsCString(""));
132 else
133 file_spec_ptr->GetDirectory().Dump(&strm);
134 return;
135 }
136 // Keep the width spacing correct if things go wrong...
137 if (width > 0)
138 strm.Printf("%-*s", width, "");
139}
140
141static void
142DumpBasename (Stream &strm, const FileSpec *file_spec_ptr, uint32_t width)
143{
144 if (file_spec_ptr)
145 {
146 if (width > 0)
147 strm.Printf("%-*s", width, file_spec_ptr->GetFilename().AsCString(""));
148 else
149 file_spec_ptr->GetFilename().Dump(&strm);
150 return;
151 }
152 // Keep the width spacing correct if things go wrong...
153 if (width > 0)
154 strm.Printf("%-*s", width, "");
155}
156
157
158static void
Greg Claytonb3448432011-03-24 21:19:54 +0000159DumpModuleSymtab (CommandInterpreter &interpreter, Stream &strm, Module *module, SortOrder sort_order)
Chris Lattner24943d22010-06-08 16:52:24 +0000160{
161 if (module)
162 {
163 ObjectFile *objfile = module->GetObjectFile ();
164 if (objfile)
165 {
166 Symtab *symtab = objfile->GetSymtab();
167 if (symtab)
Greg Clayton8d3802d2010-10-08 04:20:14 +0000168 symtab->Dump(&strm, interpreter.GetDebugger().GetExecutionContext().target, sort_order);
Chris Lattner24943d22010-06-08 16:52:24 +0000169 }
170 }
171}
172
173static void
Greg Clayton63094e02010-06-23 01:19:29 +0000174DumpModuleSections (CommandInterpreter &interpreter, Stream &strm, Module *module)
Chris Lattner24943d22010-06-08 16:52:24 +0000175{
176 if (module)
177 {
178 ObjectFile *objfile = module->GetObjectFile ();
179 if (objfile)
180 {
181 SectionList *section_list = objfile->GetSectionList();
182 if (section_list)
Greg Clayton3fed8b92010-10-08 00:21:05 +0000183 {
184 strm.PutCString ("Sections for '");
185 strm << module->GetFileSpec();
Greg Clayton940b1032011-02-23 00:35:02 +0000186 strm.Printf ("' (%s):\n", module->GetArchitecture().GetArchitectureName());
Greg Clayton3fed8b92010-10-08 00:21:05 +0000187 strm.IndentMore();
Greg Clayton58e844b2010-12-08 05:08:21 +0000188 section_list->Dump(&strm, interpreter.GetDebugger().GetExecutionContext().target, true, UINT32_MAX);
Greg Clayton3fed8b92010-10-08 00:21:05 +0000189 strm.IndentLess();
190 }
Chris Lattner24943d22010-06-08 16:52:24 +0000191 }
192 }
193}
194
195static bool
196DumpModuleSymbolVendor (Stream &strm, Module *module)
197{
198 if (module)
199 {
200 SymbolVendor *symbol_vendor = module->GetSymbolVendor(true);
201 if (symbol_vendor)
202 {
203 symbol_vendor->Dump(&strm);
204 return true;
205 }
206 }
207 return false;
208}
209
210static bool
Greg Clayton960d6a42010-08-03 00:35:52 +0000211LookupAddressInModule
212(
213 CommandInterpreter &interpreter,
214 Stream &strm,
215 Module *module,
216 uint32_t resolve_mask,
217 lldb::addr_t raw_addr,
218 lldb::addr_t offset,
219 bool verbose
220)
Chris Lattner24943d22010-06-08 16:52:24 +0000221{
222 if (module)
223 {
224 lldb::addr_t addr = raw_addr - offset;
225 Address so_addr;
226 SymbolContext sc;
Greg Claytoneea26402010-09-14 23:36:40 +0000227 Target *target = interpreter.GetDebugger().GetExecutionContext().target;
228 if (target && !target->GetSectionLoadList().IsEmpty())
Chris Lattner24943d22010-06-08 16:52:24 +0000229 {
Greg Claytoneea26402010-09-14 23:36:40 +0000230 if (!target->GetSectionLoadList().ResolveLoadAddress (addr, so_addr))
Chris Lattner24943d22010-06-08 16:52:24 +0000231 return false;
232 else if (so_addr.GetModule() != module)
233 return false;
234 }
235 else
236 {
237 if (!module->ResolveFileAddress (addr, so_addr))
238 return false;
239 }
240
241 // If an offset was given, print out the address we ended up looking up
242 if (offset)
Greg Clayton7e2f91c2011-01-29 07:10:55 +0000243 strm.Printf("File Address: 0x%llx\n", addr);
Chris Lattner24943d22010-06-08 16:52:24 +0000244
Greg Clayton63094e02010-06-23 01:19:29 +0000245 ExecutionContextScope *exe_scope = interpreter.GetDebugger().GetExecutionContext().GetBestExecutionContextScope();
Greg Clayton12bec712010-06-28 21:30:43 +0000246 strm.IndentMore();
247 strm.Indent (" Address: ");
248 so_addr.Dump (&strm, exe_scope, Address::DumpStyleSectionNameOffset);
249 strm.EOL();
Greg Clayton70436352010-06-30 23:03:03 +0000250 strm.Indent (" Summary: ");
Greg Clayton3c126042011-02-08 02:40:32 +0000251 const uint32_t save_indent = strm.GetIndentLevel ();
252 strm.SetIndentLevel (save_indent + 11);
Chris Lattner24943d22010-06-08 16:52:24 +0000253 so_addr.Dump (&strm, exe_scope, Address::DumpStyleResolvedDescription);
Greg Clayton3c126042011-02-08 02:40:32 +0000254 strm.SetIndentLevel (save_indent);
Greg Clayton70436352010-06-30 23:03:03 +0000255 strm.EOL();
Greg Clayton960d6a42010-08-03 00:35:52 +0000256 // Print out detailed address information when verbose is enabled
257 if (verbose)
258 {
259 if (so_addr.Dump (&strm, exe_scope, Address::DumpStyleDetailedSymbolContext))
260 strm.EOL();
261 }
Greg Clayton12bec712010-06-28 21:30:43 +0000262 strm.IndentLess();
Chris Lattner24943d22010-06-08 16:52:24 +0000263 return true;
264 }
265
266 return false;
267}
268
269static uint32_t
Greg Clayton63094e02010-06-23 01:19:29 +0000270LookupSymbolInModule (CommandInterpreter &interpreter, Stream &strm, Module *module, const char *name, bool name_is_regex)
Chris Lattner24943d22010-06-08 16:52:24 +0000271{
272 if (module)
273 {
274 SymbolContext sc;
275
276 ObjectFile *objfile = module->GetObjectFile ();
277 if (objfile)
278 {
279 Symtab *symtab = objfile->GetSymtab();
280 if (symtab)
281 {
282 uint32_t i;
283 std::vector<uint32_t> match_indexes;
284 ConstString symbol_name (name);
285 uint32_t num_matches = 0;
286 if (name_is_regex)
287 {
288 RegularExpression name_regexp(name);
Greg Clayton7c36fa02010-09-11 03:13:28 +0000289 num_matches = symtab->AppendSymbolIndexesMatchingRegExAndType (name_regexp,
290 eSymbolTypeAny,
Chris Lattner24943d22010-06-08 16:52:24 +0000291 match_indexes);
292 }
293 else
294 {
295 num_matches = symtab->AppendSymbolIndexesWithName (symbol_name, match_indexes);
296 }
297
298
299 if (num_matches > 0)
300 {
301 strm.Indent ();
302 strm.Printf("%u symbols match %s'%s' in ", num_matches,
303 name_is_regex ? "the regular expression " : "", name);
304 DumpFullpath (strm, &module->GetFileSpec(), 0);
305 strm.PutCString(":\n");
306 strm.IndentMore ();
307 Symtab::DumpSymbolHeader (&strm);
308 for (i=0; i < num_matches; ++i)
309 {
310 Symbol *symbol = symtab->SymbolAtIndex(match_indexes[i]);
311 strm.Indent ();
Greg Claytoneea26402010-09-14 23:36:40 +0000312 symbol->Dump (&strm, interpreter.GetDebugger().GetExecutionContext().target, i);
Chris Lattner24943d22010-06-08 16:52:24 +0000313 }
314 strm.IndentLess ();
315 return num_matches;
316 }
317 }
318 }
319 }
320 return 0;
321}
322
323
324static void
Greg Clayton63094e02010-06-23 01:19:29 +0000325DumpSymbolContextList (CommandInterpreter &interpreter, Stream &strm, SymbolContextList &sc_list, bool prepend_addr)
Chris Lattner24943d22010-06-08 16:52:24 +0000326{
327 strm.IndentMore ();
328 uint32_t i;
329 const uint32_t num_matches = sc_list.GetSize();
330
331 for (i=0; i<num_matches; ++i)
332 {
333 SymbolContext sc;
334 if (sc_list.GetContextAtIndex(i, sc))
335 {
336 strm.Indent();
337 if (prepend_addr)
338 {
339 if (sc.line_entry.range.GetBaseAddress().IsValid())
340 {
Greg Claytoneea26402010-09-14 23:36:40 +0000341 lldb::addr_t vm_addr = sc.line_entry.range.GetBaseAddress().GetLoadAddress(interpreter.GetDebugger().GetExecutionContext().target);
Chris Lattner24943d22010-06-08 16:52:24 +0000342 int addr_size = sizeof (addr_t);
Greg Clayton63094e02010-06-23 01:19:29 +0000343 Process *process = interpreter.GetDebugger().GetExecutionContext().process;
Chris Lattner24943d22010-06-08 16:52:24 +0000344 if (process)
Greg Clayton395fc332011-02-15 21:59:32 +0000345 addr_size = process->GetTarget().GetArchitecture().GetAddressByteSize();
Chris Lattner24943d22010-06-08 16:52:24 +0000346 if (vm_addr != LLDB_INVALID_ADDRESS)
347 strm.Address (vm_addr, addr_size);
348 else
349 sc.line_entry.range.GetBaseAddress().Dump (&strm, NULL, Address::DumpStyleSectionNameOffset);
350
351 strm.PutCString(" in ");
352 }
353 }
Greg Clayton72b71582010-09-02 21:44:10 +0000354 sc.DumpStopContext(&strm, interpreter.GetDebugger().GetExecutionContext().process, sc.line_entry.range.GetBaseAddress(), true, true, false);
Chris Lattner24943d22010-06-08 16:52:24 +0000355 }
356 }
357 strm.IndentLess ();
358}
359
360static uint32_t
Greg Clayton63094e02010-06-23 01:19:29 +0000361LookupFunctionInModule (CommandInterpreter &interpreter, Stream &strm, Module *module, const char *name, bool name_is_regex)
Chris Lattner24943d22010-06-08 16:52:24 +0000362{
363 if (module && name && name[0])
364 {
365 SymbolContextList sc_list;
Greg Clayton28d5fcc2011-01-27 06:44:37 +0000366 const bool include_symbols = false;
367 const bool append = true;
368 uint32_t num_matches = 0;
369 if (name_is_regex)
Chris Lattner24943d22010-06-08 16:52:24 +0000370 {
Greg Clayton28d5fcc2011-01-27 06:44:37 +0000371 RegularExpression function_name_regex (name);
372 num_matches = module->FindFunctions (function_name_regex,
373 include_symbols,
374 append,
375 sc_list);
Chris Lattner24943d22010-06-08 16:52:24 +0000376 }
Greg Clayton28d5fcc2011-01-27 06:44:37 +0000377 else
378 {
379 ConstString function_name (name);
380 num_matches = module->FindFunctions (function_name,
381 eFunctionNameTypeBase | eFunctionNameTypeFull | eFunctionNameTypeMethod | eFunctionNameTypeSelector,
382 include_symbols,
383 append,
384 sc_list);
385 }
386
387 if (num_matches)
388 {
389 strm.Indent ();
390 strm.Printf("%u match%s found in ", num_matches, num_matches > 1 ? "es" : "");
391 DumpFullpath (strm, &module->GetFileSpec(), 0);
392 strm.PutCString(":\n");
393 DumpSymbolContextList (interpreter, strm, sc_list, true);
394 }
395 return num_matches;
Chris Lattner24943d22010-06-08 16:52:24 +0000396 }
397 return 0;
398}
399
400static uint32_t
Greg Clayton960d6a42010-08-03 00:35:52 +0000401LookupTypeInModule
402(
403 CommandInterpreter &interpreter,
404 Stream &strm,
405 Module *module,
406 const char *name_cstr,
407 bool name_is_regex
408)
409{
410 if (module && name_cstr && name_cstr[0])
411 {
412 SymbolContextList sc_list;
413
414 SymbolVendor *symbol_vendor = module->GetSymbolVendor();
415 if (symbol_vendor)
416 {
417 TypeList type_list;
418 uint32_t num_matches = 0;
419 SymbolContext sc;
420// if (name_is_regex)
421// {
422// RegularExpression name_regex (name_cstr);
423// num_matches = symbol_vendor->FindFunctions(sc, name_regex, true, UINT32_MAX, type_list);
424// }
425// else
426// {
427 ConstString name(name_cstr);
428 num_matches = symbol_vendor->FindTypes(sc, name, true, UINT32_MAX, type_list);
429// }
430
431 if (num_matches)
432 {
433 strm.Indent ();
434 strm.Printf("%u match%s found in ", num_matches, num_matches > 1 ? "es" : "");
435 DumpFullpath (strm, &module->GetFileSpec(), 0);
436 strm.PutCString(":\n");
437 const uint32_t num_types = type_list.GetSize();
438 for (uint32_t i=0; i<num_types; ++i)
439 {
440 TypeSP type_sp (type_list.GetTypeAtIndex(i));
441 if (type_sp)
442 {
443 // Resolve the clang type so that any forward references
444 // to types that haven't yet been parsed will get parsed.
Greg Clayton04c9c7b2011-02-16 23:00:21 +0000445 type_sp->GetClangFullType ();
Greg Clayton960d6a42010-08-03 00:35:52 +0000446 type_sp->GetDescription (&strm, eDescriptionLevelFull, true);
447 }
448 strm.EOL();
449 }
450 }
451 return num_matches;
452 }
453 }
454 return 0;
455}
456
457static uint32_t
Greg Clayton63094e02010-06-23 01:19:29 +0000458LookupFileAndLineInModule (CommandInterpreter &interpreter, Stream &strm, Module *module, const FileSpec &file_spec, uint32_t line, bool check_inlines)
Chris Lattner24943d22010-06-08 16:52:24 +0000459{
460 if (module && file_spec)
461 {
462 SymbolContextList sc_list;
463 const uint32_t num_matches = module->ResolveSymbolContextsForFileSpec(file_spec, line, check_inlines,
464 eSymbolContextEverything, sc_list);
465 if (num_matches > 0)
466 {
467 strm.Indent ();
468 strm.Printf("%u match%s found in ", num_matches, num_matches > 1 ? "es" : "");
469 strm << file_spec;
470 if (line > 0)
471 strm.Printf (":%u", line);
472 strm << " in ";
473 DumpFullpath (strm, &module->GetFileSpec(), 0);
474 strm.PutCString(":\n");
Greg Clayton63094e02010-06-23 01:19:29 +0000475 DumpSymbolContextList (interpreter, strm, sc_list, true);
Chris Lattner24943d22010-06-08 16:52:24 +0000476 return num_matches;
477 }
478 }
479 return 0;
480
481}
482
483
484//----------------------------------------------------------------------
485// Image symbol table dumping command
486//----------------------------------------------------------------------
487
488class CommandObjectImageDumpModuleList : public CommandObject
489{
490public:
491
Greg Clayton238c0a12010-09-18 01:14:36 +0000492 CommandObjectImageDumpModuleList (CommandInterpreter &interpreter,
493 const char *name,
Greg Clayton63094e02010-06-23 01:19:29 +0000494 const char *help,
495 const char *syntax) :
Greg Clayton238c0a12010-09-18 01:14:36 +0000496 CommandObject (interpreter, name, help, syntax)
Chris Lattner24943d22010-06-08 16:52:24 +0000497 {
Caroline Tice43b014a2010-10-04 22:28:36 +0000498 CommandArgumentEntry arg;
499 CommandArgumentData file_arg;
500
501 // Define the first (and only) variant of this arg.
502 file_arg.arg_type = eArgTypeFilename;
503 file_arg.arg_repetition = eArgRepeatStar;
504
505 // There is only one variant this argument could be; put it into the argument entry.
506 arg.push_back (file_arg);
507
508 // Push the data for the first argument into the m_arguments vector.
509 m_arguments.push_back (arg);
Chris Lattner24943d22010-06-08 16:52:24 +0000510 }
511
512 virtual
513 ~CommandObjectImageDumpModuleList ()
514 {
515 }
516
517 virtual int
Greg Clayton238c0a12010-09-18 01:14:36 +0000518 HandleArgumentCompletion (Args &input,
Greg Clayton63094e02010-06-23 01:19:29 +0000519 int &cursor_index,
520 int &cursor_char_position,
521 OptionElementVector &opt_element_vector,
522 int match_start_point,
523 int max_return_elements,
Jim Ingham802f8b02010-06-30 05:02:46 +0000524 bool &word_complete,
Greg Clayton63094e02010-06-23 01:19:29 +0000525 StringList &matches)
Chris Lattner24943d22010-06-08 16:52:24 +0000526 {
527 // Arguments are the standard module completer.
528 std::string completion_str (input.GetArgumentAtIndex(cursor_index));
529 completion_str.erase (cursor_char_position);
530
Greg Clayton238c0a12010-09-18 01:14:36 +0000531 CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter,
Greg Clayton63094e02010-06-23 01:19:29 +0000532 CommandCompletions::eModuleCompletion,
533 completion_str.c_str(),
534 match_start_point,
535 max_return_elements,
536 NULL,
Jim Ingham802f8b02010-06-30 05:02:46 +0000537 word_complete,
Greg Clayton63094e02010-06-23 01:19:29 +0000538 matches);
Chris Lattner24943d22010-06-08 16:52:24 +0000539 return matches.GetSize();
540 }
541};
542
543class CommandObjectImageDumpSourceFileList : public CommandObject
544{
545public:
546
Greg Clayton238c0a12010-09-18 01:14:36 +0000547 CommandObjectImageDumpSourceFileList (CommandInterpreter &interpreter,
548 const char *name,
Greg Clayton63094e02010-06-23 01:19:29 +0000549 const char *help,
550 const char *syntax) :
Greg Clayton238c0a12010-09-18 01:14:36 +0000551 CommandObject (interpreter, name, help, syntax)
Chris Lattner24943d22010-06-08 16:52:24 +0000552 {
Caroline Tice43b014a2010-10-04 22:28:36 +0000553 CommandArgumentEntry arg;
554 CommandArgumentData source_file_arg;
555
556 // Define the first (and only) variant of this arg.
557 source_file_arg.arg_type = eArgTypeSourceFile;
558 source_file_arg.arg_repetition = eArgRepeatPlus;
559
560 // There is only one variant this argument could be; put it into the argument entry.
561 arg.push_back (source_file_arg);
562
563 // Push the data for the first argument into the m_arguments vector.
564 m_arguments.push_back (arg);
Chris Lattner24943d22010-06-08 16:52:24 +0000565 }
566
567 virtual
568 ~CommandObjectImageDumpSourceFileList ()
569 {
570 }
571
572 virtual int
Greg Clayton238c0a12010-09-18 01:14:36 +0000573 HandleArgumentCompletion (Args &input,
Greg Clayton63094e02010-06-23 01:19:29 +0000574 int &cursor_index,
575 int &cursor_char_position,
576 OptionElementVector &opt_element_vector,
577 int match_start_point,
578 int max_return_elements,
Greg Clayton54e7afa2010-07-09 20:39:50 +0000579 bool &word_complete,
Greg Clayton63094e02010-06-23 01:19:29 +0000580 StringList &matches)
Chris Lattner24943d22010-06-08 16:52:24 +0000581 {
582 // Arguments are the standard source file completer.
583 std::string completion_str (input.GetArgumentAtIndex(cursor_index));
584 completion_str.erase (cursor_char_position);
585
Greg Clayton238c0a12010-09-18 01:14:36 +0000586 CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter,
Greg Clayton63094e02010-06-23 01:19:29 +0000587 CommandCompletions::eSourceFileCompletion,
588 completion_str.c_str(),
589 match_start_point,
590 max_return_elements,
591 NULL,
Jim Ingham802f8b02010-06-30 05:02:46 +0000592 word_complete,
Greg Clayton63094e02010-06-23 01:19:29 +0000593 matches);
Chris Lattner24943d22010-06-08 16:52:24 +0000594 return matches.GetSize();
595 }
596};
597
598
599class CommandObjectImageDumpSymtab : public CommandObjectImageDumpModuleList
600{
601public:
Greg Clayton238c0a12010-09-18 01:14:36 +0000602 CommandObjectImageDumpSymtab (CommandInterpreter &interpreter) :
603 CommandObjectImageDumpModuleList (interpreter,
604 "image dump symtab",
605 "Dump the symbol table from one or more executable images.",
Caroline Tice43b014a2010-10-04 22:28:36 +0000606 NULL)
Chris Lattner24943d22010-06-08 16:52:24 +0000607 {
608 }
609
610 virtual
611 ~CommandObjectImageDumpSymtab ()
612 {
613 }
614
615 virtual bool
Greg Clayton238c0a12010-09-18 01:14:36 +0000616 Execute (Args& command,
Chris Lattner24943d22010-06-08 16:52:24 +0000617 CommandReturnObject &result)
618 {
Greg Clayton238c0a12010-09-18 01:14:36 +0000619 Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
Chris Lattner24943d22010-06-08 16:52:24 +0000620 if (target == NULL)
621 {
622 result.AppendError ("invalid target, set executable file using 'file' command");
623 result.SetStatus (eReturnStatusFailed);
624 return false;
625 }
626 else
627 {
628 uint32_t num_dumped = 0;
629
630 uint32_t addr_byte_size = target->GetArchitecture().GetAddressByteSize();
631 result.GetOutputStream().SetAddressByteSize(addr_byte_size);
632 result.GetErrorStream().SetAddressByteSize(addr_byte_size);
633
634 if (command.GetArgumentCount() == 0)
635 {
636 // Dump all sections for all modules images
637 const uint32_t num_modules = target->GetImages().GetSize();
638 if (num_modules > 0)
639 {
640 result.GetOutputStream().Printf("Dumping symbol table for %u modules.\n", num_modules);
641 for (uint32_t image_idx = 0; image_idx<num_modules; ++image_idx)
642 {
Greg Clayton8d3802d2010-10-08 04:20:14 +0000643 if (num_dumped > 0)
644 {
645 result.GetOutputStream().EOL();
646 result.GetOutputStream().EOL();
647 }
Chris Lattner24943d22010-06-08 16:52:24 +0000648 num_dumped++;
Greg Clayton8d3802d2010-10-08 04:20:14 +0000649 DumpModuleSymtab (m_interpreter, result.GetOutputStream(), target->GetImages().GetModulePointerAtIndex(image_idx), m_options.m_sort_order);
Chris Lattner24943d22010-06-08 16:52:24 +0000650 }
651 }
652 else
653 {
654 result.AppendError ("the target has no associated executable images");
655 result.SetStatus (eReturnStatusFailed);
656 return false;
657 }
658 }
659 else
660 {
661 // Dump specified images (by basename or fullpath)
662 const char *arg_cstr;
663 for (int arg_idx = 0; (arg_cstr = command.GetArgumentAtIndex(arg_idx)) != NULL; ++arg_idx)
664 {
Greg Clayton537a7a82010-10-20 20:54:39 +0000665 FileSpec image_file(arg_cstr, false);
Chris Lattner24943d22010-06-08 16:52:24 +0000666 ModuleList matching_modules;
Greg Clayton661825b2010-06-28 23:51:11 +0000667 size_t num_matching_modules = target->GetImages().FindModules(&image_file, NULL, NULL, NULL, matching_modules);
Chris Lattner24943d22010-06-08 16:52:24 +0000668
Greg Clayton661825b2010-06-28 23:51:11 +0000669 // Not found in our module list for our target, check the main
670 // shared module list in case it is a extra file used somewhere
671 // else
672 if (num_matching_modules == 0)
673 num_matching_modules = ModuleList::FindSharedModules (image_file,
674 target->GetArchitecture(),
675 NULL,
676 NULL,
677 matching_modules);
678
Chris Lattner24943d22010-06-08 16:52:24 +0000679 if (num_matching_modules > 0)
680 {
681 for (size_t i=0; i<num_matching_modules; ++i)
682 {
683 Module *image_module = matching_modules.GetModulePointerAtIndex(i);
684 if (image_module)
685 {
Greg Clayton8d3802d2010-10-08 04:20:14 +0000686 if (num_dumped > 0)
687 {
688 result.GetOutputStream().EOL();
689 result.GetOutputStream().EOL();
690 }
Chris Lattner24943d22010-06-08 16:52:24 +0000691 num_dumped++;
Greg Clayton8d3802d2010-10-08 04:20:14 +0000692 DumpModuleSymtab (m_interpreter, result.GetOutputStream(), image_module, m_options.m_sort_order);
Chris Lattner24943d22010-06-08 16:52:24 +0000693 }
694 }
695 }
696 else
697 result.AppendWarningWithFormat("Unable to find an image that matches '%s'.\n", arg_cstr);
698 }
699 }
700
701 if (num_dumped > 0)
702 result.SetStatus (eReturnStatusSuccessFinishResult);
703 else
704 {
705 result.AppendError ("no matching executable images found");
706 result.SetStatus (eReturnStatusFailed);
707 }
708 }
709 return result.Succeeded();
710 }
Greg Clayton8d3802d2010-10-08 04:20:14 +0000711
712 virtual Options *
713 GetOptions ()
714 {
715 return &m_options;
716 }
717
718 class CommandOptions : public Options
719 {
720 public:
Chris Lattner24943d22010-06-08 16:52:24 +0000721
Greg Clayton8d3802d2010-10-08 04:20:14 +0000722 CommandOptions () :
723 Options(),
724 m_sort_order (eSortOrderNone)
725 {
726 }
727
728 virtual
729 ~CommandOptions ()
730 {
731 }
732
733 virtual Error
734 SetOptionValue (int option_idx, const char *option_arg)
735 {
736 Error error;
737 char short_option = (char) m_getopt_table[option_idx].val;
738
739 switch (short_option)
740 {
741 case 's':
742 {
743 bool found_one = false;
Greg Claytonb3448432011-03-24 21:19:54 +0000744 m_sort_order = (SortOrder) Args::StringToOptionEnum (option_arg,
Greg Clayton8d3802d2010-10-08 04:20:14 +0000745 g_option_table[option_idx].enum_values,
746 eSortOrderNone,
747 &found_one);
748 if (!found_one)
749 error.SetErrorStringWithFormat("Invalid enumeration value '%s' for option '%c'.\n",
750 option_arg,
751 short_option);
752 }
753 break;
754
755 default:
756 error.SetErrorStringWithFormat("Invalid short option character '%c'.\n", short_option);
757 break;
758
759 }
760 return error;
761 }
762
763 void
764 ResetOptionValues ()
765 {
766 Options::ResetOptionValues();
767 m_sort_order = eSortOrderNone;
768 }
769
Greg Claytonb3448432011-03-24 21:19:54 +0000770 const OptionDefinition*
Greg Clayton8d3802d2010-10-08 04:20:14 +0000771 GetDefinitions ()
772 {
773 return g_option_table;
774 }
775
776 // Options table: Required for subclasses of Options.
Greg Claytonb3448432011-03-24 21:19:54 +0000777 static OptionDefinition g_option_table[];
Greg Clayton8d3802d2010-10-08 04:20:14 +0000778
779 SortOrder m_sort_order;
780 };
781
782protected:
783
784 CommandOptions m_options;
Chris Lattner24943d22010-06-08 16:52:24 +0000785};
786
Greg Claytonb3448432011-03-24 21:19:54 +0000787static OptionEnumValueElement
Greg Clayton8d3802d2010-10-08 04:20:14 +0000788g_sort_option_enumeration[4] =
789{
790 { eSortOrderNone, "none", "No sorting, use the original symbol table order."},
791 { eSortOrderByAddress, "address", "Sort output by symbol address."},
792 { eSortOrderByName, "name", "Sort output by symbol name."},
793 { 0, NULL, NULL }
794};
795
796
Greg Claytonb3448432011-03-24 21:19:54 +0000797OptionDefinition
Greg Clayton8d3802d2010-10-08 04:20:14 +0000798CommandObjectImageDumpSymtab::CommandOptions::g_option_table[] =
799{
800{ LLDB_OPT_SET_1, false, "sort", 's', required_argument, g_sort_option_enumeration, 0, eArgTypeSortOrder, "Supply a sort order when dumping the symbol table."},
801{ 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
802};
803
804
Chris Lattner24943d22010-06-08 16:52:24 +0000805//----------------------------------------------------------------------
806// Image section dumping command
807//----------------------------------------------------------------------
808class CommandObjectImageDumpSections : public CommandObjectImageDumpModuleList
809{
810public:
Greg Clayton238c0a12010-09-18 01:14:36 +0000811 CommandObjectImageDumpSections (CommandInterpreter &interpreter) :
812 CommandObjectImageDumpModuleList (interpreter,
813 "image dump sections",
Greg Clayton63094e02010-06-23 01:19:29 +0000814 "Dump the sections from one or more executable images.",
Caroline Tice43b014a2010-10-04 22:28:36 +0000815 //"image dump sections [<file1> ...]")
816 NULL)
Chris Lattner24943d22010-06-08 16:52:24 +0000817 {
818 }
819
820 virtual
821 ~CommandObjectImageDumpSections ()
822 {
823 }
824
825 virtual bool
Greg Clayton238c0a12010-09-18 01:14:36 +0000826 Execute (Args& command,
Chris Lattner24943d22010-06-08 16:52:24 +0000827 CommandReturnObject &result)
828 {
Greg Clayton238c0a12010-09-18 01:14:36 +0000829 Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
Chris Lattner24943d22010-06-08 16:52:24 +0000830 if (target == NULL)
831 {
832 result.AppendError ("invalid target, set executable file using 'file' command");
833 result.SetStatus (eReturnStatusFailed);
834 return false;
835 }
836 else
837 {
838 uint32_t num_dumped = 0;
839
840 uint32_t addr_byte_size = target->GetArchitecture().GetAddressByteSize();
841 result.GetOutputStream().SetAddressByteSize(addr_byte_size);
842 result.GetErrorStream().SetAddressByteSize(addr_byte_size);
843
844 if (command.GetArgumentCount() == 0)
845 {
846 // Dump all sections for all modules images
847 const uint32_t num_modules = target->GetImages().GetSize();
848 if (num_modules > 0)
849 {
850 result.GetOutputStream().Printf("Dumping sections for %u modules.\n", num_modules);
851 for (uint32_t image_idx = 0; image_idx<num_modules; ++image_idx)
852 {
853 num_dumped++;
Greg Clayton238c0a12010-09-18 01:14:36 +0000854 DumpModuleSections (m_interpreter, result.GetOutputStream(), target->GetImages().GetModulePointerAtIndex(image_idx));
Chris Lattner24943d22010-06-08 16:52:24 +0000855 }
856 }
857 else
858 {
859 result.AppendError ("the target has no associated executable images");
860 result.SetStatus (eReturnStatusFailed);
861 return false;
862 }
863 }
864 else
865 {
866 // Dump specified images (by basename or fullpath)
867 const char *arg_cstr;
868 for (int arg_idx = 0; (arg_cstr = command.GetArgumentAtIndex(arg_idx)) != NULL; ++arg_idx)
869 {
Greg Clayton537a7a82010-10-20 20:54:39 +0000870 FileSpec image_file(arg_cstr, false);
Chris Lattner24943d22010-06-08 16:52:24 +0000871 ModuleList matching_modules;
Greg Clayton661825b2010-06-28 23:51:11 +0000872 size_t num_matching_modules = target->GetImages().FindModules(&image_file, NULL, NULL, NULL, matching_modules);
Chris Lattner24943d22010-06-08 16:52:24 +0000873
Greg Clayton661825b2010-06-28 23:51:11 +0000874 // Not found in our module list for our target, check the main
875 // shared module list in case it is a extra file used somewhere
876 // else
877 if (num_matching_modules == 0)
878 num_matching_modules = ModuleList::FindSharedModules (image_file,
879 target->GetArchitecture(),
880 NULL,
881 NULL,
882 matching_modules);
883
Chris Lattner24943d22010-06-08 16:52:24 +0000884 if (num_matching_modules > 0)
885 {
886 for (size_t i=0; i<num_matching_modules; ++i)
887 {
888 Module * image_module = matching_modules.GetModulePointerAtIndex(i);
889 if (image_module)
890 {
891 num_dumped++;
Greg Clayton238c0a12010-09-18 01:14:36 +0000892 DumpModuleSections (m_interpreter, result.GetOutputStream(), image_module);
Chris Lattner24943d22010-06-08 16:52:24 +0000893 }
894 }
895 }
896 else
897 result.AppendWarningWithFormat("Unable to find an image that matches '%s'.\n", arg_cstr);
898 }
899 }
900
901 if (num_dumped > 0)
902 result.SetStatus (eReturnStatusSuccessFinishResult);
903 else
904 {
905 result.AppendError ("no matching executable images found");
906 result.SetStatus (eReturnStatusFailed);
907 }
908 }
909 return result.Succeeded();
910 }
911};
912
913//----------------------------------------------------------------------
914// Image debug symbol dumping command
915//----------------------------------------------------------------------
916class CommandObjectImageDumpSymfile : public CommandObjectImageDumpModuleList
917{
918public:
Greg Clayton238c0a12010-09-18 01:14:36 +0000919 CommandObjectImageDumpSymfile (CommandInterpreter &interpreter) :
920 CommandObjectImageDumpModuleList (interpreter,
921 "image dump symfile",
922 "Dump the debug symbol file for one or more executable images.",
Caroline Tice43b014a2010-10-04 22:28:36 +0000923 //"image dump symfile [<file1> ...]")
924 NULL)
Chris Lattner24943d22010-06-08 16:52:24 +0000925 {
926 }
927
928 virtual
929 ~CommandObjectImageDumpSymfile ()
930 {
931 }
932
933 virtual bool
Greg Clayton238c0a12010-09-18 01:14:36 +0000934 Execute (Args& command,
Chris Lattner24943d22010-06-08 16:52:24 +0000935 CommandReturnObject &result)
936 {
Greg Clayton238c0a12010-09-18 01:14:36 +0000937 Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
Chris Lattner24943d22010-06-08 16:52:24 +0000938 if (target == NULL)
939 {
940 result.AppendError ("invalid target, set executable file using 'file' command");
941 result.SetStatus (eReturnStatusFailed);
942 return false;
943 }
944 else
945 {
946 uint32_t num_dumped = 0;
947
948 uint32_t addr_byte_size = target->GetArchitecture().GetAddressByteSize();
949 result.GetOutputStream().SetAddressByteSize(addr_byte_size);
950 result.GetErrorStream().SetAddressByteSize(addr_byte_size);
951
952 if (command.GetArgumentCount() == 0)
953 {
954 // Dump all sections for all modules images
955 const uint32_t num_modules = target->GetImages().GetSize();
956 if (num_modules > 0)
957 {
958 result.GetOutputStream().Printf("Dumping debug symbols for %u modules.\n", num_modules);
959 for (uint32_t image_idx = 0; image_idx<num_modules; ++image_idx)
960 {
961 if (DumpModuleSymbolVendor (result.GetOutputStream(), target->GetImages().GetModulePointerAtIndex(image_idx)))
962 num_dumped++;
963 }
964 }
965 else
966 {
967 result.AppendError ("the target has no associated executable images");
968 result.SetStatus (eReturnStatusFailed);
969 return false;
970 }
971 }
972 else
973 {
974 // Dump specified images (by basename or fullpath)
975 const char *arg_cstr;
976 for (int arg_idx = 0; (arg_cstr = command.GetArgumentAtIndex(arg_idx)) != NULL; ++arg_idx)
977 {
Greg Clayton537a7a82010-10-20 20:54:39 +0000978 FileSpec image_file(arg_cstr, false);
Chris Lattner24943d22010-06-08 16:52:24 +0000979 ModuleList matching_modules;
Greg Clayton661825b2010-06-28 23:51:11 +0000980 size_t num_matching_modules = target->GetImages().FindModules(&image_file, NULL, NULL, NULL, matching_modules);
Chris Lattner24943d22010-06-08 16:52:24 +0000981
Greg Clayton661825b2010-06-28 23:51:11 +0000982 // Not found in our module list for our target, check the main
983 // shared module list in case it is a extra file used somewhere
984 // else
985 if (num_matching_modules == 0)
986 num_matching_modules = ModuleList::FindSharedModules (image_file,
987 target->GetArchitecture(),
988 NULL,
989 NULL,
990 matching_modules);
991
Chris Lattner24943d22010-06-08 16:52:24 +0000992 if (num_matching_modules > 0)
993 {
994 for (size_t i=0; i<num_matching_modules; ++i)
995 {
996 Module * image_module = matching_modules.GetModulePointerAtIndex(i);
997 if (image_module)
998 {
999 if (DumpModuleSymbolVendor (result.GetOutputStream(), image_module))
1000 num_dumped++;
1001 }
1002 }
1003 }
1004 else
1005 result.AppendWarningWithFormat("Unable to find an image that matches '%s'.\n", arg_cstr);
1006 }
1007 }
1008
1009 if (num_dumped > 0)
1010 result.SetStatus (eReturnStatusSuccessFinishResult);
1011 else
1012 {
1013 result.AppendError ("no matching executable images found");
1014 result.SetStatus (eReturnStatusFailed);
1015 }
1016 }
1017 return result.Succeeded();
1018 }
1019};
1020
1021//----------------------------------------------------------------------
1022// Image debug symbol dumping command
1023//----------------------------------------------------------------------
1024class CommandObjectImageDumpLineTable : public CommandObjectImageDumpSourceFileList
1025{
1026public:
Greg Clayton238c0a12010-09-18 01:14:36 +00001027 CommandObjectImageDumpLineTable (CommandInterpreter &interpreter) :
1028 CommandObjectImageDumpSourceFileList (interpreter,
1029 "image dump line-table",
1030 "Dump the debug symbol file for one or more executable images.",
Caroline Tice43b014a2010-10-04 22:28:36 +00001031 NULL)
Chris Lattner24943d22010-06-08 16:52:24 +00001032 {
1033 }
1034
1035 virtual
1036 ~CommandObjectImageDumpLineTable ()
1037 {
1038 }
1039
1040 virtual bool
Greg Clayton238c0a12010-09-18 01:14:36 +00001041 Execute (Args& command,
Chris Lattner24943d22010-06-08 16:52:24 +00001042 CommandReturnObject &result)
1043 {
Greg Clayton238c0a12010-09-18 01:14:36 +00001044 Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
Chris Lattner24943d22010-06-08 16:52:24 +00001045 if (target == NULL)
1046 {
1047 result.AppendError ("invalid target, set executable file using 'file' command");
1048 result.SetStatus (eReturnStatusFailed);
1049 return false;
1050 }
1051 else
1052 {
Greg Clayton238c0a12010-09-18 01:14:36 +00001053 ExecutionContext exe_ctx(m_interpreter.GetDebugger().GetExecutionContext());
Chris Lattner24943d22010-06-08 16:52:24 +00001054 uint32_t total_num_dumped = 0;
1055
1056 uint32_t addr_byte_size = target->GetArchitecture().GetAddressByteSize();
1057 result.GetOutputStream().SetAddressByteSize(addr_byte_size);
1058 result.GetErrorStream().SetAddressByteSize(addr_byte_size);
1059
1060 if (command.GetArgumentCount() == 0)
1061 {
1062 result.AppendErrorWithFormat ("\nSyntax: %s\n", m_cmd_syntax.c_str());
1063 result.SetStatus (eReturnStatusFailed);
1064 }
1065 else
1066 {
1067 // Dump specified images (by basename or fullpath)
1068 const char *arg_cstr;
1069 for (int arg_idx = 0; (arg_cstr = command.GetArgumentAtIndex(arg_idx)) != NULL; ++arg_idx)
1070 {
Greg Clayton537a7a82010-10-20 20:54:39 +00001071 FileSpec file_spec(arg_cstr, false);
Chris Lattner24943d22010-06-08 16:52:24 +00001072 const uint32_t num_modules = target->GetImages().GetSize();
1073 if (num_modules > 0)
1074 {
1075 uint32_t num_dumped = 0;
1076 for (uint32_t i = 0; i<num_modules; ++i)
1077 {
Greg Clayton238c0a12010-09-18 01:14:36 +00001078 if (DumpCompileUnitLineTable (m_interpreter,
Chris Lattner24943d22010-06-08 16:52:24 +00001079 result.GetOutputStream(),
1080 target->GetImages().GetModulePointerAtIndex(i),
1081 file_spec,
1082 exe_ctx.process != NULL && exe_ctx.process->IsAlive()))
1083 num_dumped++;
1084 }
1085 if (num_dumped == 0)
1086 result.AppendWarningWithFormat ("No source filenames matched '%s'.\n", arg_cstr);
1087 else
1088 total_num_dumped += num_dumped;
1089 }
1090 }
1091 }
1092
1093 if (total_num_dumped > 0)
1094 result.SetStatus (eReturnStatusSuccessFinishResult);
1095 else
1096 {
1097 result.AppendError ("no source filenames matched any command arguments");
1098 result.SetStatus (eReturnStatusFailed);
1099 }
1100 }
1101 return result.Succeeded();
1102 }
1103};
1104
1105//----------------------------------------------------------------------
1106// Dump multi-word command
1107//----------------------------------------------------------------------
1108class CommandObjectImageDump : public CommandObjectMultiword
1109{
1110public:
1111
1112 //------------------------------------------------------------------
1113 // Constructors and Destructors
1114 //------------------------------------------------------------------
Greg Clayton63094e02010-06-23 01:19:29 +00001115 CommandObjectImageDump(CommandInterpreter &interpreter) :
Greg Clayton238c0a12010-09-18 01:14:36 +00001116 CommandObjectMultiword (interpreter,
1117 "image dump",
Caroline Ticeabb507a2010-09-08 21:06:11 +00001118 "A set of commands for dumping information about one or more executable images; 'line-table' expects a source file name",
Greg Clayton63094e02010-06-23 01:19:29 +00001119 "image dump [symtab|sections|symfile|line-table] [<file1> <file2> ...]")
Chris Lattner24943d22010-06-08 16:52:24 +00001120 {
Greg Clayton238c0a12010-09-18 01:14:36 +00001121 LoadSubCommand ("symtab", CommandObjectSP (new CommandObjectImageDumpSymtab (interpreter)));
1122 LoadSubCommand ("sections", CommandObjectSP (new CommandObjectImageDumpSections (interpreter)));
1123 LoadSubCommand ("symfile", CommandObjectSP (new CommandObjectImageDumpSymfile (interpreter)));
1124 LoadSubCommand ("line-table", CommandObjectSP (new CommandObjectImageDumpLineTable (interpreter)));
Chris Lattner24943d22010-06-08 16:52:24 +00001125 }
1126
1127 virtual
1128 ~CommandObjectImageDump()
1129 {
1130 }
1131};
1132
1133//----------------------------------------------------------------------
1134// List images with associated information
1135//----------------------------------------------------------------------
1136class CommandObjectImageList : public CommandObject
1137{
1138public:
1139
1140 class CommandOptions : public Options
1141 {
1142 public:
1143
1144 CommandOptions () :
1145 Options(),
1146 m_format_array()
1147 {
1148 }
1149
1150 virtual
1151 ~CommandOptions ()
1152 {
1153 }
1154
1155 virtual Error
1156 SetOptionValue (int option_idx, const char *option_arg)
1157 {
1158 char short_option = (char) m_getopt_table[option_idx].val;
1159 uint32_t width = 0;
1160 if (option_arg)
1161 width = strtoul (option_arg, NULL, 0);
1162 m_format_array.push_back(std::make_pair(short_option, width));
1163 Error error;
1164 return error;
1165 }
1166
1167 void
1168 ResetOptionValues ()
1169 {
1170 Options::ResetOptionValues();
1171 m_format_array.clear();
1172 }
1173
Greg Claytonb3448432011-03-24 21:19:54 +00001174 const OptionDefinition*
Chris Lattner24943d22010-06-08 16:52:24 +00001175 GetDefinitions ()
1176 {
1177 return g_option_table;
1178 }
1179
1180 // Options table: Required for subclasses of Options.
1181
Greg Claytonb3448432011-03-24 21:19:54 +00001182 static OptionDefinition g_option_table[];
Chris Lattner24943d22010-06-08 16:52:24 +00001183
1184 // Instance variables to hold the values for command options.
1185 typedef std::vector< std::pair<char, uint32_t> > FormatWidthCollection;
1186 FormatWidthCollection m_format_array;
1187 };
1188
Greg Clayton238c0a12010-09-18 01:14:36 +00001189 CommandObjectImageList (CommandInterpreter &interpreter) :
1190 CommandObject (interpreter,
1191 "image list",
1192 "List current executable and dependent shared library images.",
1193 "image list [<cmd-options>]")
Chris Lattner24943d22010-06-08 16:52:24 +00001194 {
1195 }
1196
1197 virtual
1198 ~CommandObjectImageList ()
1199 {
1200 }
1201
1202 virtual
1203 Options *
1204 GetOptions ()
1205 {
1206 return &m_options;
1207 }
1208
1209 virtual bool
Greg Clayton238c0a12010-09-18 01:14:36 +00001210 Execute (Args& command,
Chris Lattner24943d22010-06-08 16:52:24 +00001211 CommandReturnObject &result)
1212 {
Greg Clayton238c0a12010-09-18 01:14:36 +00001213 Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
Chris Lattner24943d22010-06-08 16:52:24 +00001214 if (target == NULL)
1215 {
1216 result.AppendError ("invalid target, set executable file using 'file' command");
1217 result.SetStatus (eReturnStatusFailed);
1218 return false;
1219 }
1220 else
1221 {
1222 uint32_t addr_byte_size = target->GetArchitecture().GetAddressByteSize();
1223 result.GetOutputStream().SetAddressByteSize(addr_byte_size);
1224 result.GetErrorStream().SetAddressByteSize(addr_byte_size);
1225 // Dump all sections for all modules images
1226 const uint32_t num_modules = target->GetImages().GetSize();
1227 if (num_modules > 0)
1228 {
1229 Stream &strm = result.GetOutputStream();
1230
1231 for (uint32_t image_idx = 0; image_idx<num_modules; ++image_idx)
1232 {
1233 Module *module = target->GetImages().GetModulePointerAtIndex(image_idx);
1234 strm.Printf("[%3u] ", image_idx);
1235
1236 if (m_options.m_format_array.empty())
1237 {
1238 DumpFullpath(strm, &module->GetFileSpec(), 0);
1239 }
1240 else
1241 {
1242 const size_t num_entries = m_options.m_format_array.size();
1243 for (size_t i=0; i<num_entries; ++i)
1244 {
1245 if (i > 0)
1246 strm.PutChar(' ');
1247 char format_char = m_options.m_format_array[i].first;
1248 uint32_t width = m_options.m_format_array[i].second;
1249 switch (format_char)
1250 {
1251 case 'a':
1252 DumpModuleArchitecture (strm, module, width);
1253 break;
1254
1255 case 'f':
1256 DumpFullpath (strm, &module->GetFileSpec(), width);
1257 break;
1258
1259 case 'd':
1260 DumpDirectory (strm, &module->GetFileSpec(), width);
1261 break;
1262
1263 case 'b':
1264 DumpBasename (strm, &module->GetFileSpec(), width);
1265 break;
1266
1267 case 's':
1268 case 'S':
1269 {
1270 SymbolVendor *symbol_vendor = module->GetSymbolVendor();
1271 if (symbol_vendor)
1272 {
1273 SymbolFile *symbol_file = symbol_vendor->GetSymbolFile();
1274 if (symbol_file)
1275 {
1276 if (format_char == 'S')
1277 DumpBasename(strm, &symbol_file->GetObjectFile()->GetFileSpec(), width);
1278 else
1279 DumpFullpath (strm, &symbol_file->GetObjectFile()->GetFileSpec(), width);
1280 break;
1281 }
1282 }
1283 strm.Printf("%.*s", width, "<NONE>");
1284 }
1285 break;
1286
1287 case 'u':
1288 DumpModuleUUID(strm, module);
1289 break;
1290
1291 default:
1292 break;
1293 }
1294 }
1295 }
1296 strm.EOL();
1297 }
1298 result.SetStatus (eReturnStatusSuccessFinishResult);
1299 }
1300 else
1301 {
1302 result.AppendError ("the target has no associated executable images");
1303 result.SetStatus (eReturnStatusFailed);
1304 return false;
1305 }
1306 }
1307 return result.Succeeded();
1308 }
1309protected:
1310
1311 CommandOptions m_options;
1312};
1313
Greg Claytonb3448432011-03-24 21:19:54 +00001314OptionDefinition
Chris Lattner24943d22010-06-08 16:52:24 +00001315CommandObjectImageList::CommandOptions::g_option_table[] =
1316{
Caroline Tice4d6675c2010-10-01 19:59:14 +00001317{ LLDB_OPT_SET_1, false, "arch", 'a', optional_argument, NULL, 0, eArgTypeWidth, "Display the architecture when listing images."},
Greg Clayton0467c782011-02-04 18:53:10 +00001318{ LLDB_OPT_SET_1, false, "uuid", 'u', no_argument, NULL, 0, eArgTypeNone, "Display the UUID when listing images."},
Caroline Tice4d6675c2010-10-01 19:59:14 +00001319{ LLDB_OPT_SET_1, false, "fullpath", 'f', optional_argument, NULL, 0, eArgTypeWidth, "Display the fullpath to the image object file."},
1320{ LLDB_OPT_SET_1, false, "directory", 'd', optional_argument, NULL, 0, eArgTypeWidth, "Display the directory with optional width for the image object file."},
1321{ LLDB_OPT_SET_1, false, "basename", 'b', optional_argument, NULL, 0, eArgTypeWidth, "Display the basename with optional width for the image object file."},
1322{ LLDB_OPT_SET_1, false, "symfile", 's', optional_argument, NULL, 0, eArgTypeWidth, "Display the fullpath to the image symbol file with optional width."},
1323{ LLDB_OPT_SET_1, false, "symfile-basename", 'S', optional_argument, NULL, 0, eArgTypeWidth, "Display the basename to the image symbol file with optional width."},
1324{ 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
Chris Lattner24943d22010-06-08 16:52:24 +00001325};
1326
1327
1328
1329//----------------------------------------------------------------------
1330// Lookup information in images
1331//----------------------------------------------------------------------
1332class CommandObjectImageLookup : public CommandObject
1333{
1334public:
1335
1336 enum
1337 {
1338 eLookupTypeInvalid = -1,
1339 eLookupTypeAddress = 0,
1340 eLookupTypeSymbol,
1341 eLookupTypeFileLine, // Line is optional
1342 eLookupTypeFunction,
Greg Clayton960d6a42010-08-03 00:35:52 +00001343 eLookupTypeType,
Chris Lattner24943d22010-06-08 16:52:24 +00001344 kNumLookupTypes
1345 };
1346
1347 class CommandOptions : public Options
1348 {
1349 public:
1350
1351 CommandOptions () :
1352 Options()
1353 {
1354 ResetOptionValues();
1355 }
1356
1357 virtual
1358 ~CommandOptions ()
1359 {
1360 }
1361
1362 virtual Error
1363 SetOptionValue (int option_idx, const char *option_arg)
1364 {
1365 Error error;
1366
1367 char short_option = (char) m_getopt_table[option_idx].val;
1368
1369 switch (short_option)
1370 {
1371 case 'a':
1372 m_type = eLookupTypeAddress;
1373 m_addr = Args::StringToUInt64(option_arg, LLDB_INVALID_ADDRESS);
1374 if (m_addr == LLDB_INVALID_ADDRESS)
1375 error.SetErrorStringWithFormat ("Invalid address string '%s'.\n", option_arg);
1376 break;
1377
1378 case 'o':
1379 m_offset = Args::StringToUInt64(option_arg, LLDB_INVALID_ADDRESS);
1380 if (m_offset == LLDB_INVALID_ADDRESS)
1381 error.SetErrorStringWithFormat ("Invalid offset string '%s'.\n", option_arg);
1382 break;
1383
1384 case 's':
1385 m_str = option_arg;
1386 m_type = eLookupTypeSymbol;
1387 break;
1388
1389 case 'f':
Greg Clayton537a7a82010-10-20 20:54:39 +00001390 m_file.SetFile (option_arg, false);
Chris Lattner24943d22010-06-08 16:52:24 +00001391 m_type = eLookupTypeFileLine;
1392 break;
1393
1394 case 'i':
1395 m_check_inlines = false;
1396 break;
1397
1398 case 'l':
1399 m_line_number = Args::StringToUInt32(option_arg, UINT32_MAX);
1400 if (m_line_number == UINT32_MAX)
1401 error.SetErrorStringWithFormat ("Invalid line number string '%s'.\n", option_arg);
1402 else if (m_line_number == 0)
1403 error.SetErrorString ("Zero is an invalid line number.");
1404 m_type = eLookupTypeFileLine;
1405 break;
1406
1407 case 'n':
1408 m_str = option_arg;
1409 m_type = eLookupTypeFunction;
1410 break;
1411
Greg Clayton960d6a42010-08-03 00:35:52 +00001412 case 't':
1413 m_str = option_arg;
1414 m_type = eLookupTypeType;
1415 break;
1416
1417 case 'v':
1418 m_verbose = 1;
1419 break;
1420
Chris Lattner24943d22010-06-08 16:52:24 +00001421 case 'r':
1422 m_use_regex = true;
1423 break;
1424 }
1425
1426 return error;
1427 }
1428
1429 void
1430 ResetOptionValues ()
1431 {
1432 Options::ResetOptionValues();
1433 m_type = eLookupTypeInvalid;
1434 m_str.clear();
1435 m_file.Clear();
1436 m_addr = LLDB_INVALID_ADDRESS;
1437 m_offset = 0;
1438 m_line_number = 0;
1439 m_use_regex = false;
1440 m_check_inlines = true;
Greg Clayton960d6a42010-08-03 00:35:52 +00001441 m_verbose = false;
Chris Lattner24943d22010-06-08 16:52:24 +00001442 }
1443
Greg Claytonb3448432011-03-24 21:19:54 +00001444 const OptionDefinition*
Chris Lattner24943d22010-06-08 16:52:24 +00001445 GetDefinitions ()
1446 {
1447 return g_option_table;
1448 }
1449
1450 // Options table: Required for subclasses of Options.
1451
Greg Claytonb3448432011-03-24 21:19:54 +00001452 static OptionDefinition g_option_table[];
Chris Lattner24943d22010-06-08 16:52:24 +00001453 int m_type; // Should be a eLookupTypeXXX enum after parsing options
1454 std::string m_str; // Holds name lookup
1455 FileSpec m_file; // Files for file lookups
1456 lldb::addr_t m_addr; // Holds the address to lookup
1457 lldb::addr_t m_offset; // Subtract this offset from m_addr before doing lookups.
1458 uint32_t m_line_number; // Line number for file+line lookups
1459 bool m_use_regex; // Name lookups in m_str are regular expressions.
1460 bool m_check_inlines;// Check for inline entries when looking up by file/line.
Greg Clayton960d6a42010-08-03 00:35:52 +00001461 bool m_verbose; // Enable verbose lookup info
1462
Chris Lattner24943d22010-06-08 16:52:24 +00001463 };
1464
Greg Clayton238c0a12010-09-18 01:14:36 +00001465 CommandObjectImageLookup (CommandInterpreter &interpreter) :
1466 CommandObject (interpreter,
1467 "image lookup",
1468 "Look up information within executable and dependent shared library images.",
Caroline Tice43b014a2010-10-04 22:28:36 +00001469 NULL)
Chris Lattner24943d22010-06-08 16:52:24 +00001470 {
Caroline Tice43b014a2010-10-04 22:28:36 +00001471 CommandArgumentEntry arg;
1472 CommandArgumentData file_arg;
1473
1474 // Define the first (and only) variant of this arg.
1475 file_arg.arg_type = eArgTypeFilename;
1476 file_arg.arg_repetition = eArgRepeatStar;
1477
1478 // There is only one variant this argument could be; put it into the argument entry.
1479 arg.push_back (file_arg);
1480
1481 // Push the data for the first argument into the m_arguments vector.
1482 m_arguments.push_back (arg);
Chris Lattner24943d22010-06-08 16:52:24 +00001483 }
1484
1485 virtual
1486 ~CommandObjectImageLookup ()
1487 {
1488 }
1489
Greg Clayton8d3802d2010-10-08 04:20:14 +00001490 virtual Options *
Chris Lattner24943d22010-06-08 16:52:24 +00001491 GetOptions ()
1492 {
1493 return &m_options;
1494 }
1495
1496
1497 bool
Greg Clayton63094e02010-06-23 01:19:29 +00001498 LookupInModule (CommandInterpreter &interpreter, Module *module, CommandReturnObject &result, bool &syntax_error)
Chris Lattner24943d22010-06-08 16:52:24 +00001499 {
1500 switch (m_options.m_type)
1501 {
1502 case eLookupTypeAddress:
1503 if (m_options.m_addr != LLDB_INVALID_ADDRESS)
1504 {
Greg Clayton238c0a12010-09-18 01:14:36 +00001505 if (LookupAddressInModule (m_interpreter,
Greg Clayton960d6a42010-08-03 00:35:52 +00001506 result.GetOutputStream(),
1507 module,
1508 eSymbolContextEverything,
1509 m_options.m_addr,
1510 m_options.m_offset,
1511 m_options.m_verbose))
Chris Lattner24943d22010-06-08 16:52:24 +00001512 {
1513 result.SetStatus(eReturnStatusSuccessFinishResult);
1514 return true;
1515 }
1516 }
1517 break;
1518
1519 case eLookupTypeSymbol:
1520 if (!m_options.m_str.empty())
1521 {
Greg Clayton238c0a12010-09-18 01:14:36 +00001522 if (LookupSymbolInModule (m_interpreter, result.GetOutputStream(), module, m_options.m_str.c_str(), m_options.m_use_regex))
Chris Lattner24943d22010-06-08 16:52:24 +00001523 {
1524 result.SetStatus(eReturnStatusSuccessFinishResult);
1525 return true;
1526 }
1527 }
1528 break;
1529
1530 case eLookupTypeFileLine:
1531 if (m_options.m_file)
1532 {
1533
Greg Clayton238c0a12010-09-18 01:14:36 +00001534 if (LookupFileAndLineInModule (m_interpreter,
Chris Lattner24943d22010-06-08 16:52:24 +00001535 result.GetOutputStream(),
1536 module,
1537 m_options.m_file,
1538 m_options.m_line_number,
1539 m_options.m_check_inlines))
1540 {
1541 result.SetStatus(eReturnStatusSuccessFinishResult);
1542 return true;
1543 }
1544 }
1545 break;
1546
1547 case eLookupTypeFunction:
1548 if (!m_options.m_str.empty())
1549 {
Greg Clayton238c0a12010-09-18 01:14:36 +00001550 if (LookupFunctionInModule (m_interpreter,
Chris Lattner24943d22010-06-08 16:52:24 +00001551 result.GetOutputStream(),
1552 module,
1553 m_options.m_str.c_str(),
1554 m_options.m_use_regex))
1555 {
1556 result.SetStatus(eReturnStatusSuccessFinishResult);
1557 return true;
1558 }
1559 }
1560 break;
1561
Greg Clayton960d6a42010-08-03 00:35:52 +00001562 case eLookupTypeType:
1563 if (!m_options.m_str.empty())
1564 {
Greg Clayton238c0a12010-09-18 01:14:36 +00001565 if (LookupTypeInModule (m_interpreter,
Greg Clayton960d6a42010-08-03 00:35:52 +00001566 result.GetOutputStream(),
1567 module,
1568 m_options.m_str.c_str(),
1569 m_options.m_use_regex))
1570 {
1571 result.SetStatus(eReturnStatusSuccessFinishResult);
1572 return true;
1573 }
1574 }
1575 break;
1576
Chris Lattner24943d22010-06-08 16:52:24 +00001577 default:
Greg Clayton238c0a12010-09-18 01:14:36 +00001578 m_options.GenerateOptionUsage (m_interpreter, result.GetErrorStream(), this);
Chris Lattner24943d22010-06-08 16:52:24 +00001579 syntax_error = true;
1580 break;
1581 }
1582
1583 result.SetStatus (eReturnStatusFailed);
1584 return false;
1585 }
1586
1587 virtual bool
Greg Clayton238c0a12010-09-18 01:14:36 +00001588 Execute (Args& command,
Chris Lattner24943d22010-06-08 16:52:24 +00001589 CommandReturnObject &result)
1590 {
Greg Clayton238c0a12010-09-18 01:14:36 +00001591 Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
Chris Lattner24943d22010-06-08 16:52:24 +00001592 if (target == NULL)
1593 {
1594 result.AppendError ("invalid target, set executable file using 'file' command");
1595 result.SetStatus (eReturnStatusFailed);
1596 return false;
1597 }
1598 else
1599 {
1600 bool syntax_error = false;
1601 uint32_t i;
1602 uint32_t num_successful_lookups = 0;
1603 uint32_t addr_byte_size = target->GetArchitecture().GetAddressByteSize();
1604 result.GetOutputStream().SetAddressByteSize(addr_byte_size);
1605 result.GetErrorStream().SetAddressByteSize(addr_byte_size);
1606 // Dump all sections for all modules images
1607
1608 if (command.GetArgumentCount() == 0)
1609 {
1610 // Dump all sections for all modules images
1611 const uint32_t num_modules = target->GetImages().GetSize();
1612 if (num_modules > 0)
1613 {
1614 for (i = 0; i<num_modules && syntax_error == false; ++i)
1615 {
Greg Clayton238c0a12010-09-18 01:14:36 +00001616 if (LookupInModule (m_interpreter, target->GetImages().GetModulePointerAtIndex(i), result, syntax_error))
Chris Lattner24943d22010-06-08 16:52:24 +00001617 {
1618 result.GetOutputStream().EOL();
1619 num_successful_lookups++;
1620 }
1621 }
1622 }
1623 else
1624 {
1625 result.AppendError ("the target has no associated executable images");
1626 result.SetStatus (eReturnStatusFailed);
1627 return false;
1628 }
1629 }
1630 else
1631 {
1632 // Dump specified images (by basename or fullpath)
1633 const char *arg_cstr;
1634 for (i = 0; (arg_cstr = command.GetArgumentAtIndex(i)) != NULL && syntax_error == false; ++i)
1635 {
Greg Clayton537a7a82010-10-20 20:54:39 +00001636 FileSpec image_file(arg_cstr, false);
Chris Lattner24943d22010-06-08 16:52:24 +00001637 ModuleList matching_modules;
Greg Clayton661825b2010-06-28 23:51:11 +00001638 size_t num_matching_modules = target->GetImages().FindModules(&image_file, NULL, NULL, NULL, matching_modules);
Chris Lattner24943d22010-06-08 16:52:24 +00001639
Greg Clayton661825b2010-06-28 23:51:11 +00001640 // Not found in our module list for our target, check the main
1641 // shared module list in case it is a extra file used somewhere
1642 // else
1643 if (num_matching_modules == 0)
1644 num_matching_modules = ModuleList::FindSharedModules (image_file,
1645 target->GetArchitecture(),
1646 NULL,
1647 NULL,
1648 matching_modules);
1649
Chris Lattner24943d22010-06-08 16:52:24 +00001650 if (num_matching_modules > 0)
1651 {
Greg Claytonbef15832010-07-14 00:18:15 +00001652 for (size_t j=0; j<num_matching_modules; ++j)
Chris Lattner24943d22010-06-08 16:52:24 +00001653 {
Greg Claytonbef15832010-07-14 00:18:15 +00001654 Module * image_module = matching_modules.GetModulePointerAtIndex(j);
Chris Lattner24943d22010-06-08 16:52:24 +00001655 if (image_module)
1656 {
Greg Clayton238c0a12010-09-18 01:14:36 +00001657 if (LookupInModule (m_interpreter, image_module, result, syntax_error))
Chris Lattner24943d22010-06-08 16:52:24 +00001658 {
1659 result.GetOutputStream().EOL();
1660 num_successful_lookups++;
1661 }
1662 }
1663 }
1664 }
1665 else
1666 result.AppendWarningWithFormat("Unable to find an image that matches '%s'.\n", arg_cstr);
1667 }
1668 }
1669
1670 if (num_successful_lookups > 0)
1671 result.SetStatus (eReturnStatusSuccessFinishResult);
1672 else
1673 result.SetStatus (eReturnStatusFailed);
1674 }
1675 return result.Succeeded();
1676 }
1677protected:
1678
1679 CommandOptions m_options;
1680};
1681
Greg Claytonb3448432011-03-24 21:19:54 +00001682OptionDefinition
Chris Lattner24943d22010-06-08 16:52:24 +00001683CommandObjectImageLookup::CommandOptions::g_option_table[] =
1684{
Caroline Tice4d6675c2010-10-01 19:59:14 +00001685{ LLDB_OPT_SET_1, true, "address", 'a', required_argument, NULL, 0, eArgTypeAddress, "Lookup an address in one or more executable images."},
1686{ LLDB_OPT_SET_1, false, "offset", 'o', required_argument, NULL, 0, eArgTypeOffset, "When looking up an address subtract <offset> from any addresses before doing the lookup."},
1687{ LLDB_OPT_SET_2, true, "symbol", 's', required_argument, NULL, 0, eArgTypeSymbol, "Lookup a symbol by name in the symbol tables in one or more executable images."},
1688{ LLDB_OPT_SET_2, false, "regex", 'r', no_argument, NULL, 0, eArgTypeNone, "The <name> argument for name lookups are regular expressions."},
1689{ LLDB_OPT_SET_3, true, "file", 'f', required_argument, NULL, 0, eArgTypeFilename, "Lookup a file by fullpath or basename in one or more executable images."},
1690{ LLDB_OPT_SET_3, false, "line", 'l', required_argument, NULL, 0, eArgTypeLineNum, "Lookup a line number in a file (must be used in conjunction with --file)."},
1691{ LLDB_OPT_SET_3, false, "no-inlines", 'i', no_argument, NULL, 0, eArgTypeNone, "Check inline line entries (must be used in conjunction with --file)."},
1692{ LLDB_OPT_SET_4, true, "function", 'n', required_argument, NULL, 0, eArgTypeFunctionName, "Lookup a function by name in the debug symbols in one or more executable images."},
1693{ LLDB_OPT_SET_5, true, "type", 't', required_argument, NULL, 0, eArgTypeName, "Lookup a type by name in the debug symbols in one or more executable images."},
1694{ LLDB_OPT_SET_ALL, false, "verbose", 'v', no_argument, NULL, 0, eArgTypeNone, "Enable verbose lookup information."},
1695{ 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
Chris Lattner24943d22010-06-08 16:52:24 +00001696};
1697
1698
1699
1700
1701
1702//----------------------------------------------------------------------
1703// CommandObjectImage constructor
1704//----------------------------------------------------------------------
Greg Clayton63094e02010-06-23 01:19:29 +00001705CommandObjectImage::CommandObjectImage(CommandInterpreter &interpreter) :
Greg Clayton238c0a12010-09-18 01:14:36 +00001706 CommandObjectMultiword (interpreter,
1707 "image",
Caroline Ticec1ad82e2010-09-07 22:38:08 +00001708 "A set of commands for accessing information for one or more executable images.",
1709 "image <sub-command> ...")
Chris Lattner24943d22010-06-08 16:52:24 +00001710{
Greg Clayton238c0a12010-09-18 01:14:36 +00001711 LoadSubCommand ("dump", CommandObjectSP (new CommandObjectImageDump (interpreter)));
1712 LoadSubCommand ("list", CommandObjectSP (new CommandObjectImageList (interpreter)));
1713 LoadSubCommand ("lookup", CommandObjectSP (new CommandObjectImageLookup (interpreter)));
Chris Lattner24943d22010-06-08 16:52:24 +00001714}
1715
1716//----------------------------------------------------------------------
1717// Destructor
1718//----------------------------------------------------------------------
1719CommandObjectImage::~CommandObjectImage()
1720{
1721}
1722