blob: b545d3ebd270de17c50b8694e3e4b1e55a33b0b7 [file] [log] [blame]
Johnny Chen01acfa72011-09-22 18:04:58 +00001//===-- CommandObjectWatchpoint.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 "CommandObjectWatchpoint.h"
Johnny Chenf3ec4612012-08-09 23:09:42 +000011#include "CommandObjectWatchpointCommand.h"
Johnny Chen01acfa72011-09-22 18:04:58 +000012
13// C Includes
14// C++ Includes
15// Other libraries and framework includes
16// Project includes
Johnny Chenecd4feb2011-10-14 00:42:25 +000017#include "lldb/Breakpoint/Watchpoint.h"
18#include "lldb/Breakpoint/WatchpointList.h"
Johnny Chen01acfa72011-09-22 18:04:58 +000019#include "lldb/Core/StreamString.h"
Johnny Chen55a2d5a2012-01-30 21:46:17 +000020#include "lldb/Core/ValueObject.h"
21#include "lldb/Core/ValueObjectVariable.h"
Johnny Chen01acfa72011-09-22 18:04:58 +000022#include "lldb/Interpreter/CommandInterpreter.h"
23#include "lldb/Interpreter/CommandReturnObject.h"
Johnny Chen01acfa72011-09-22 18:04:58 +000024#include "lldb/Interpreter/CommandCompletions.h"
Johnny Chen55a2d5a2012-01-30 21:46:17 +000025#include "lldb/Symbol/Variable.h"
26#include "lldb/Symbol/VariableList.h"
27#include "lldb/Target/Target.h"
Johnny Chen01acfa72011-09-22 18:04:58 +000028
29#include <vector>
30
31using namespace lldb;
32using namespace lldb_private;
33
34static void
Johnny Chenecd4feb2011-10-14 00:42:25 +000035AddWatchpointDescription(Stream *s, Watchpoint *wp, lldb::DescriptionLevel level)
Johnny Chen01acfa72011-09-22 18:04:58 +000036{
37 s->IndentMore();
Johnny Chenecd4feb2011-10-14 00:42:25 +000038 wp->GetDescription(s, level);
Johnny Chen01acfa72011-09-22 18:04:58 +000039 s->IndentLess();
40 s->EOL();
41}
42
43static bool
44CheckTargetForWatchpointOperations(Target *target, CommandReturnObject &result)
45{
46 if (target == NULL)
47 {
48 result.AppendError ("Invalid target. No existing target or watchpoints.");
49 result.SetStatus (eReturnStatusFailed);
50 return false;
51 }
52 bool process_is_valid = target->GetProcessSP() && target->GetProcessSP()->IsAlive();
53 if (!process_is_valid)
54 {
55 result.AppendError ("Thre's no process or it is not alive.");
56 result.SetStatus (eReturnStatusFailed);
57 return false;
58 }
59 // Target passes our checks, return true.
60 return true;
61}
62
Jim Inghamda26bd22012-06-08 21:56:10 +000063// FIXME: This doesn't seem to be the right place for this functionality.
Johnny Chen01acfa72011-09-22 18:04:58 +000064#include "llvm/ADT/StringRef.h"
Jim Inghamda26bd22012-06-08 21:56:10 +000065static inline void StripLeadingSpaces(llvm::StringRef &Str)
66{
67 while (!Str.empty() && isspace(Str[0]))
68 Str = Str.substr(1);
69}
70static inline llvm::StringRef StripOptionTerminator(llvm::StringRef &Str, bool with_dash_w, bool with_dash_x)
71{
72 llvm::StringRef ExprStr = Str;
73
74 // Get rid of the leading spaces first.
75 StripLeadingSpaces(ExprStr);
76
77 // If there's no '-w' and no '-x', we can just return.
78 if (!with_dash_w && !with_dash_x)
79 return ExprStr;
80
81 // Otherwise, split on the "--" option terminator string, and return the rest of the string.
82 ExprStr = ExprStr.split("--").second;
83 StripLeadingSpaces(ExprStr);
84 return ExprStr;
85}
86
Johnny Chen01acfa72011-09-22 18:04:58 +000087
88// Equivalent class: {"-", "to", "To", "TO"} of range specifier array.
89static const char* RSA[4] = { "-", "to", "To", "TO" };
90
91// Return the index to RSA if found; otherwise -1 is returned.
92static int32_t
93WithRSAIndex(llvm::StringRef &Arg)
94{
95
96 uint32_t i;
97 for (i = 0; i < 4; ++i)
98 if (Arg.find(RSA[i]) != llvm::StringRef::npos)
99 return i;
100 return -1;
101}
102
103// Return true if wp_ids is successfully populated with the watch ids.
104// False otherwise.
Johnny Chen10320892012-06-19 22:12:58 +0000105bool
106CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(Args &args, std::vector<uint32_t> &wp_ids)
Johnny Chen01acfa72011-09-22 18:04:58 +0000107{
108 // Pre-condition: args.GetArgumentCount() > 0.
109 assert(args.GetArgumentCount() > 0);
110
111 llvm::StringRef Minus("-");
112 std::vector<llvm::StringRef> StrRefArgs;
113 std::pair<llvm::StringRef, llvm::StringRef> Pair;
114 size_t i;
115 int32_t idx;
116 // Go through the argments and make a canonical form of arg list containing
117 // only numbers with possible "-" in between.
118 for (i = 0; i < args.GetArgumentCount(); ++i) {
119 llvm::StringRef Arg(args.GetArgumentAtIndex(i));
120 if ((idx = WithRSAIndex(Arg)) == -1) {
121 StrRefArgs.push_back(Arg);
122 continue;
123 }
124 // The Arg contains the range specifier, split it, then.
125 Pair = Arg.split(RSA[idx]);
126 if (!Pair.first.empty())
127 StrRefArgs.push_back(Pair.first);
128 StrRefArgs.push_back(Minus);
129 if (!Pair.second.empty())
130 StrRefArgs.push_back(Pair.second);
131 }
132 // Now process the canonical list and fill in the vector of uint32_t's.
133 // If there is any error, return false and the client should ignore wp_ids.
134 uint32_t beg, end, id;
135 size_t size = StrRefArgs.size();
136 bool in_range = false;
137 for (i = 0; i < size; ++i) {
138 llvm::StringRef Arg = StrRefArgs[i];
139 if (in_range) {
140 // Look for the 'end' of the range. Note StringRef::getAsInteger()
141 // returns true to signify error while parsing.
142 if (Arg.getAsInteger(0, end))
143 return false;
144 // Found a range! Now append the elements.
145 for (id = beg; id <= end; ++id)
146 wp_ids.push_back(id);
147 in_range = false;
148 continue;
149 }
150 if (i < (size - 1) && StrRefArgs[i+1] == Minus) {
151 if (Arg.getAsInteger(0, beg))
152 return false;
153 // Turn on the in_range flag, we are looking for end of range next.
154 ++i; in_range = true;
155 continue;
156 }
157 // Otherwise, we have a simple ID. Just append it.
158 if (Arg.getAsInteger(0, beg))
159 return false;
160 wp_ids.push_back(beg);
161 }
162 // It is an error if after the loop, we're still in_range.
163 if (in_range)
164 return false;
165
166 return true; // Success!
167}
168
169//-------------------------------------------------------------------------
Jim Inghamda26bd22012-06-08 21:56:10 +0000170// CommandObjectWatchpointList
171//-------------------------------------------------------------------------
172#pragma mark List
173
174class CommandObjectWatchpointList : public CommandObjectParsed
175{
176public:
177 CommandObjectWatchpointList (CommandInterpreter &interpreter) :
178 CommandObjectParsed (interpreter,
179 "watchpoint list",
180 "List all watchpoints at configurable levels of detail.",
181 NULL),
182 m_options(interpreter)
183 {
184 CommandArgumentEntry arg;
185 CommandObject::AddIDsArgumentData(arg, eArgTypeWatchpointID, eArgTypeWatchpointIDRange);
186 // Add the entry for the first argument for this command to the object's arguments vector.
187 m_arguments.push_back(arg);
188 }
189
190 virtual
191 ~CommandObjectWatchpointList () {}
192
193 virtual Options *
194 GetOptions ()
195 {
196 return &m_options;
197 }
198
199 class CommandOptions : public Options
200 {
201 public:
202
203 CommandOptions (CommandInterpreter &interpreter) :
204 Options(interpreter),
205 m_level(lldb::eDescriptionLevelBrief) // Watchpoint List defaults to brief descriptions
206 {
207 }
208
209 virtual
210 ~CommandOptions () {}
211
212 virtual Error
213 SetOptionValue (uint32_t option_idx, const char *option_arg)
214 {
215 Error error;
216 char short_option = (char) m_getopt_table[option_idx].val;
217
218 switch (short_option)
219 {
220 case 'b':
221 m_level = lldb::eDescriptionLevelBrief;
222 break;
223 case 'f':
224 m_level = lldb::eDescriptionLevelFull;
225 break;
226 case 'v':
227 m_level = lldb::eDescriptionLevelVerbose;
228 break;
229 default:
230 error.SetErrorStringWithFormat("unrecognized option '%c'", short_option);
231 break;
232 }
233
234 return error;
235 }
236
237 void
238 OptionParsingStarting ()
239 {
240 m_level = lldb::eDescriptionLevelFull;
241 }
242
243 const OptionDefinition *
244 GetDefinitions ()
245 {
246 return g_option_table;
247 }
248
249
250 // Options table: Required for subclasses of Options.
251
252 static OptionDefinition g_option_table[];
253
254 // Instance variables to hold the values for command options.
255
256 lldb::DescriptionLevel m_level;
257 };
258
259protected:
260 virtual bool
261 DoExecute (Args& command, CommandReturnObject &result)
262 {
263 Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
264 if (target == NULL)
265 {
266 result.AppendError ("Invalid target. No current target or watchpoints.");
267 result.SetStatus (eReturnStatusSuccessFinishNoResult);
268 return true;
269 }
270
271 if (target->GetProcessSP() && target->GetProcessSP()->IsAlive())
272 {
273 uint32_t num_supported_hardware_watchpoints;
274 Error error = target->GetProcessSP()->GetWatchpointSupportInfo(num_supported_hardware_watchpoints);
275 if (error.Success())
276 result.AppendMessageWithFormat("Number of supported hardware watchpoints: %u\n",
277 num_supported_hardware_watchpoints);
278 }
279
280 const WatchpointList &watchpoints = target->GetWatchpointList();
281 Mutex::Locker locker;
282 target->GetWatchpointList().GetListMutex(locker);
283
284 size_t num_watchpoints = watchpoints.GetSize();
285
286 if (num_watchpoints == 0)
287 {
288 result.AppendMessage("No watchpoints currently set.");
289 result.SetStatus(eReturnStatusSuccessFinishNoResult);
290 return true;
291 }
292
293 Stream &output_stream = result.GetOutputStream();
294
295 if (command.GetArgumentCount() == 0)
296 {
297 // No watchpoint selected; show info about all currently set watchpoints.
298 result.AppendMessage ("Current watchpoints:");
299 for (size_t i = 0; i < num_watchpoints; ++i)
300 {
301 Watchpoint *wp = watchpoints.GetByIndex(i).get();
302 AddWatchpointDescription(&output_stream, wp, m_options.m_level);
303 }
304 result.SetStatus(eReturnStatusSuccessFinishNoResult);
305 }
306 else
307 {
308 // Particular watchpoints selected; enable them.
309 std::vector<uint32_t> wp_ids;
Johnny Chen10320892012-06-19 22:12:58 +0000310 if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(command, wp_ids))
Jim Inghamda26bd22012-06-08 21:56:10 +0000311 {
312 result.AppendError("Invalid watchpoints specification.");
313 result.SetStatus(eReturnStatusFailed);
314 return false;
315 }
316
317 const size_t size = wp_ids.size();
318 for (size_t i = 0; i < size; ++i)
319 {
320 Watchpoint *wp = watchpoints.FindByID(wp_ids[i]).get();
321 if (wp)
322 AddWatchpointDescription(&output_stream, wp, m_options.m_level);
323 result.SetStatus(eReturnStatusSuccessFinishNoResult);
324 }
325 }
326
327 return result.Succeeded();
328 }
329
330private:
331 CommandOptions m_options;
332};
333
334//-------------------------------------------------------------------------
335// CommandObjectWatchpointList::Options
336//-------------------------------------------------------------------------
337#pragma mark List::CommandOptions
338OptionDefinition
339CommandObjectWatchpointList::CommandOptions::g_option_table[] =
340{
341 { LLDB_OPT_SET_1, false, "brief", 'b', no_argument, NULL, 0, eArgTypeNone,
342 "Give a brief description of the watchpoint (no location info)."},
343
344 { LLDB_OPT_SET_2, false, "full", 'f', no_argument, NULL, 0, eArgTypeNone,
345 "Give a full description of the watchpoint and its locations."},
346
347 { LLDB_OPT_SET_3, false, "verbose", 'v', no_argument, NULL, 0, eArgTypeNone,
348 "Explain everything we know about the watchpoint (for debugging debugger bugs)." },
349
350 { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
351};
352
353//-------------------------------------------------------------------------
354// CommandObjectWatchpointEnable
355//-------------------------------------------------------------------------
356#pragma mark Enable
357
358class CommandObjectWatchpointEnable : public CommandObjectParsed
359{
360public:
361 CommandObjectWatchpointEnable (CommandInterpreter &interpreter) :
362 CommandObjectParsed (interpreter,
363 "enable",
364 "Enable the specified disabled watchpoint(s). If no watchpoints are specified, enable all of them.",
365 NULL)
366 {
367 CommandArgumentEntry arg;
368 CommandObject::AddIDsArgumentData(arg, eArgTypeWatchpointID, eArgTypeWatchpointIDRange);
369 // Add the entry for the first argument for this command to the object's arguments vector.
370 m_arguments.push_back(arg);
371 }
372
373 virtual
374 ~CommandObjectWatchpointEnable () {}
375
376protected:
377 virtual bool
378 DoExecute (Args& command,
379 CommandReturnObject &result)
380 {
381 Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
382 if (!CheckTargetForWatchpointOperations(target, result))
383 return false;
384
385 Mutex::Locker locker;
386 target->GetWatchpointList().GetListMutex(locker);
387
388 const WatchpointList &watchpoints = target->GetWatchpointList();
389
390 size_t num_watchpoints = watchpoints.GetSize();
391
392 if (num_watchpoints == 0)
393 {
394 result.AppendError("No watchpoints exist to be enabled.");
395 result.SetStatus(eReturnStatusFailed);
396 return false;
397 }
398
399 if (command.GetArgumentCount() == 0)
400 {
401 // No watchpoint selected; enable all currently set watchpoints.
402 target->EnableAllWatchpoints();
403 result.AppendMessageWithFormat("All watchpoints enabled. (%lu watchpoints)\n", num_watchpoints);
404 result.SetStatus(eReturnStatusSuccessFinishNoResult);
405 }
406 else
407 {
408 // Particular watchpoints selected; enable them.
409 std::vector<uint32_t> wp_ids;
Johnny Chen10320892012-06-19 22:12:58 +0000410 if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(command, wp_ids))
Jim Inghamda26bd22012-06-08 21:56:10 +0000411 {
412 result.AppendError("Invalid watchpoints specification.");
413 result.SetStatus(eReturnStatusFailed);
414 return false;
415 }
416
417 int count = 0;
418 const size_t size = wp_ids.size();
419 for (size_t i = 0; i < size; ++i)
420 if (target->EnableWatchpointByID(wp_ids[i]))
421 ++count;
422 result.AppendMessageWithFormat("%d watchpoints enabled.\n", count);
423 result.SetStatus(eReturnStatusSuccessFinishNoResult);
424 }
425
426 return result.Succeeded();
427 }
428
429private:
430};
431
432//-------------------------------------------------------------------------
433// CommandObjectWatchpointDisable
434//-------------------------------------------------------------------------
435#pragma mark Disable
436
437class CommandObjectWatchpointDisable : public CommandObjectParsed
438{
439public:
440 CommandObjectWatchpointDisable (CommandInterpreter &interpreter) :
441 CommandObjectParsed (interpreter,
442 "watchpoint disable",
443 "Disable the specified watchpoint(s) without removing it/them. If no watchpoints are specified, disable them all.",
444 NULL)
445 {
446 CommandArgumentEntry arg;
447 CommandObject::AddIDsArgumentData(arg, eArgTypeWatchpointID, eArgTypeWatchpointIDRange);
448 // Add the entry for the first argument for this command to the object's arguments vector.
449 m_arguments.push_back(arg);
450 }
451
452
453 virtual
454 ~CommandObjectWatchpointDisable () {}
455
456protected:
457 virtual bool
458 DoExecute (Args& command, CommandReturnObject &result)
459 {
460 Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
461 if (!CheckTargetForWatchpointOperations(target, result))
462 return false;
463
464 Mutex::Locker locker;
465 target->GetWatchpointList().GetListMutex(locker);
466
467 const WatchpointList &watchpoints = target->GetWatchpointList();
468 size_t num_watchpoints = watchpoints.GetSize();
469
470 if (num_watchpoints == 0)
471 {
472 result.AppendError("No watchpoints exist to be disabled.");
473 result.SetStatus(eReturnStatusFailed);
474 return false;
475 }
476
477 if (command.GetArgumentCount() == 0)
478 {
479 // No watchpoint selected; disable all currently set watchpoints.
480 if (target->DisableAllWatchpoints())
481 {
482 result.AppendMessageWithFormat("All watchpoints disabled. (%lu watchpoints)\n", num_watchpoints);
483 result.SetStatus(eReturnStatusSuccessFinishNoResult);
484 }
485 else
486 {
487 result.AppendError("Disable all watchpoints failed\n");
488 result.SetStatus(eReturnStatusFailed);
489 }
490 }
491 else
492 {
493 // Particular watchpoints selected; disable them.
494 std::vector<uint32_t> wp_ids;
Johnny Chen10320892012-06-19 22:12:58 +0000495 if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(command, wp_ids))
Jim Inghamda26bd22012-06-08 21:56:10 +0000496 {
497 result.AppendError("Invalid watchpoints specification.");
498 result.SetStatus(eReturnStatusFailed);
499 return false;
500 }
501
502 int count = 0;
503 const size_t size = wp_ids.size();
504 for (size_t i = 0; i < size; ++i)
505 if (target->DisableWatchpointByID(wp_ids[i]))
506 ++count;
507 result.AppendMessageWithFormat("%d watchpoints disabled.\n", count);
508 result.SetStatus(eReturnStatusSuccessFinishNoResult);
509 }
510
511 return result.Succeeded();
512 }
513
514};
515
516//-------------------------------------------------------------------------
517// CommandObjectWatchpointDelete
518//-------------------------------------------------------------------------
519#pragma mark Delete
520
521class CommandObjectWatchpointDelete : public CommandObjectParsed
522{
523public:
524 CommandObjectWatchpointDelete (CommandInterpreter &interpreter) :
525 CommandObjectParsed(interpreter,
526 "watchpoint delete",
527 "Delete the specified watchpoint(s). If no watchpoints are specified, delete them all.",
528 NULL)
529 {
530 CommandArgumentEntry arg;
531 CommandObject::AddIDsArgumentData(arg, eArgTypeWatchpointID, eArgTypeWatchpointIDRange);
532 // Add the entry for the first argument for this command to the object's arguments vector.
533 m_arguments.push_back(arg);
534 }
535
536 virtual
537 ~CommandObjectWatchpointDelete () {}
538
539protected:
540 virtual bool
541 DoExecute (Args& command, CommandReturnObject &result)
542 {
543 Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
544 if (!CheckTargetForWatchpointOperations(target, result))
545 return false;
546
547 Mutex::Locker locker;
548 target->GetWatchpointList().GetListMutex(locker);
549
550 const WatchpointList &watchpoints = target->GetWatchpointList();
551
552 size_t num_watchpoints = watchpoints.GetSize();
553
554 if (num_watchpoints == 0)
555 {
556 result.AppendError("No watchpoints exist to be deleted.");
557 result.SetStatus(eReturnStatusFailed);
558 return false;
559 }
560
561 if (command.GetArgumentCount() == 0)
562 {
563 if (!m_interpreter.Confirm("About to delete all watchpoints, do you want to do that?", true))
564 {
565 result.AppendMessage("Operation cancelled...");
566 }
567 else
568 {
569 target->RemoveAllWatchpoints();
570 result.AppendMessageWithFormat("All watchpoints removed. (%lu watchpoints)\n", num_watchpoints);
571 }
572 result.SetStatus (eReturnStatusSuccessFinishNoResult);
573 }
574 else
575 {
576 // Particular watchpoints selected; delete them.
577 std::vector<uint32_t> wp_ids;
Johnny Chen10320892012-06-19 22:12:58 +0000578 if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(command, wp_ids))
Jim Inghamda26bd22012-06-08 21:56:10 +0000579 {
580 result.AppendError("Invalid watchpoints specification.");
581 result.SetStatus(eReturnStatusFailed);
582 return false;
583 }
584
585 int count = 0;
586 const size_t size = wp_ids.size();
587 for (size_t i = 0; i < size; ++i)
588 if (target->RemoveWatchpointByID(wp_ids[i]))
589 ++count;
590 result.AppendMessageWithFormat("%d watchpoints deleted.\n",count);
591 result.SetStatus (eReturnStatusSuccessFinishNoResult);
592 }
593
594 return result.Succeeded();
595 }
596
597};
598
599//-------------------------------------------------------------------------
600// CommandObjectWatchpointIgnore
601//-------------------------------------------------------------------------
602
603class CommandObjectWatchpointIgnore : public CommandObjectParsed
604{
605public:
606 CommandObjectWatchpointIgnore (CommandInterpreter &interpreter) :
607 CommandObjectParsed (interpreter,
608 "watchpoint ignore",
609 "Set ignore count on the specified watchpoint(s). If no watchpoints are specified, set them all.",
610 NULL),
611 m_options (interpreter)
612 {
613 CommandArgumentEntry arg;
614 CommandObject::AddIDsArgumentData(arg, eArgTypeWatchpointID, eArgTypeWatchpointIDRange);
615 // Add the entry for the first argument for this command to the object's arguments vector.
616 m_arguments.push_back(arg);
617 }
618
619 virtual
620 ~CommandObjectWatchpointIgnore () {}
621
622 virtual Options *
623 GetOptions ()
624 {
625 return &m_options;
626 }
627
628 class CommandOptions : public Options
629 {
630 public:
631
632 CommandOptions (CommandInterpreter &interpreter) :
633 Options (interpreter),
634 m_ignore_count (0)
635 {
636 }
637
638 virtual
639 ~CommandOptions () {}
640
641 virtual Error
642 SetOptionValue (uint32_t option_idx, const char *option_arg)
643 {
644 Error error;
645 char short_option = (char) m_getopt_table[option_idx].val;
646
647 switch (short_option)
648 {
649 case 'i':
650 {
651 m_ignore_count = Args::StringToUInt32(option_arg, UINT32_MAX, 0);
652 if (m_ignore_count == UINT32_MAX)
653 error.SetErrorStringWithFormat ("invalid ignore count '%s'", option_arg);
654 }
655 break;
656 default:
657 error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
658 break;
659 }
660
661 return error;
662 }
663
664 void
665 OptionParsingStarting ()
666 {
667 m_ignore_count = 0;
668 }
669
670 const OptionDefinition *
671 GetDefinitions ()
672 {
673 return g_option_table;
674 }
675
676
677 // Options table: Required for subclasses of Options.
678
679 static OptionDefinition g_option_table[];
680
681 // Instance variables to hold the values for command options.
682
683 uint32_t m_ignore_count;
684 };
685
686protected:
687 virtual bool
688 DoExecute (Args& command,
689 CommandReturnObject &result)
690 {
691 Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
692 if (!CheckTargetForWatchpointOperations(target, result))
693 return false;
694
695 Mutex::Locker locker;
696 target->GetWatchpointList().GetListMutex(locker);
697
698 const WatchpointList &watchpoints = target->GetWatchpointList();
699
700 size_t num_watchpoints = watchpoints.GetSize();
701
702 if (num_watchpoints == 0)
703 {
704 result.AppendError("No watchpoints exist to be ignored.");
705 result.SetStatus(eReturnStatusFailed);
706 return false;
707 }
708
709 if (command.GetArgumentCount() == 0)
710 {
711 target->IgnoreAllWatchpoints(m_options.m_ignore_count);
712 result.AppendMessageWithFormat("All watchpoints ignored. (%lu watchpoints)\n", num_watchpoints);
713 result.SetStatus (eReturnStatusSuccessFinishNoResult);
714 }
715 else
716 {
717 // Particular watchpoints selected; ignore them.
718 std::vector<uint32_t> wp_ids;
Johnny Chen10320892012-06-19 22:12:58 +0000719 if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(command, wp_ids))
Jim Inghamda26bd22012-06-08 21:56:10 +0000720 {
721 result.AppendError("Invalid watchpoints specification.");
722 result.SetStatus(eReturnStatusFailed);
723 return false;
724 }
725
726 int count = 0;
727 const size_t size = wp_ids.size();
728 for (size_t i = 0; i < size; ++i)
729 if (target->IgnoreWatchpointByID(wp_ids[i], m_options.m_ignore_count))
730 ++count;
731 result.AppendMessageWithFormat("%d watchpoints ignored.\n",count);
732 result.SetStatus (eReturnStatusSuccessFinishNoResult);
733 }
734
735 return result.Succeeded();
736 }
737
738private:
739 CommandOptions m_options;
740};
741
742#pragma mark Ignore::CommandOptions
743OptionDefinition
744CommandObjectWatchpointIgnore::CommandOptions::g_option_table[] =
745{
746 { LLDB_OPT_SET_ALL, true, "ignore-count", 'i', required_argument, NULL, NULL, eArgTypeCount, "Set the number of times this watchpoint is skipped before stopping." },
747 { 0, false, NULL, 0 , 0, NULL, 0, eArgTypeNone, NULL }
748};
749
750
751//-------------------------------------------------------------------------
752// CommandObjectWatchpointModify
753//-------------------------------------------------------------------------
754#pragma mark Modify
755
756class CommandObjectWatchpointModify : public CommandObjectParsed
757{
758public:
759
760 CommandObjectWatchpointModify (CommandInterpreter &interpreter) :
761 CommandObjectParsed (interpreter,
762 "watchpoint modify",
763 "Modify the options on a watchpoint or set of watchpoints in the executable. "
764 "If no watchpoint is specified, act on the last created watchpoint. "
765 "Passing an empty argument clears the modification.",
766 NULL),
767 m_options (interpreter)
768 {
769 CommandArgumentEntry arg;
770 CommandObject::AddIDsArgumentData(arg, eArgTypeWatchpointID, eArgTypeWatchpointIDRange);
771 // Add the entry for the first argument for this command to the object's arguments vector.
772 m_arguments.push_back (arg);
773 }
774
775 virtual
776 ~CommandObjectWatchpointModify () {}
777
778 virtual Options *
779 GetOptions ()
780 {
781 return &m_options;
782 }
783
784 class CommandOptions : public Options
785 {
786 public:
787
788 CommandOptions (CommandInterpreter &interpreter) :
789 Options (interpreter),
790 m_condition (),
791 m_condition_passed (false)
792 {
793 }
794
795 virtual
796 ~CommandOptions () {}
797
798 virtual Error
799 SetOptionValue (uint32_t option_idx, const char *option_arg)
800 {
801 Error error;
802 char short_option = (char) m_getopt_table[option_idx].val;
803
804 switch (short_option)
805 {
806 case 'c':
807 if (option_arg != NULL)
808 m_condition.assign (option_arg);
809 else
810 m_condition.clear();
811 m_condition_passed = true;
812 break;
813 default:
814 error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
815 break;
816 }
817
818 return error;
819 }
820
821 void
822 OptionParsingStarting ()
823 {
824 m_condition.clear();
825 m_condition_passed = false;
826 }
827
828 const OptionDefinition*
829 GetDefinitions ()
830 {
831 return g_option_table;
832 }
833
834 // Options table: Required for subclasses of Options.
835
836 static OptionDefinition g_option_table[];
837
838 // Instance variables to hold the values for command options.
839
840 std::string m_condition;
841 bool m_condition_passed;
842 };
843
844protected:
845 virtual bool
846 DoExecute (Args& command, CommandReturnObject &result)
847 {
848 Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
849 if (!CheckTargetForWatchpointOperations(target, result))
850 return false;
851
852 Mutex::Locker locker;
853 target->GetWatchpointList().GetListMutex(locker);
854
855 const WatchpointList &watchpoints = target->GetWatchpointList();
856
857 size_t num_watchpoints = watchpoints.GetSize();
858
859 if (num_watchpoints == 0)
860 {
861 result.AppendError("No watchpoints exist to be modified.");
862 result.SetStatus(eReturnStatusFailed);
863 return false;
864 }
865
866 if (command.GetArgumentCount() == 0)
867 {
868 WatchpointSP wp_sp = target->GetLastCreatedWatchpoint();
869 wp_sp->SetCondition(m_options.m_condition.c_str());
870 result.SetStatus (eReturnStatusSuccessFinishNoResult);
871 }
872 else
873 {
874 // Particular watchpoints selected; set condition on them.
875 std::vector<uint32_t> wp_ids;
Johnny Chen10320892012-06-19 22:12:58 +0000876 if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(command, wp_ids))
Jim Inghamda26bd22012-06-08 21:56:10 +0000877 {
878 result.AppendError("Invalid watchpoints specification.");
879 result.SetStatus(eReturnStatusFailed);
880 return false;
881 }
882
883 int count = 0;
884 const size_t size = wp_ids.size();
885 for (size_t i = 0; i < size; ++i)
886 {
887 WatchpointSP wp_sp = watchpoints.FindByID(wp_ids[i]);
888 if (wp_sp)
889 {
890 wp_sp->SetCondition(m_options.m_condition.c_str());
891 ++count;
892 }
893 }
894 result.AppendMessageWithFormat("%d watchpoints modified.\n",count);
895 result.SetStatus (eReturnStatusSuccessFinishNoResult);
896 }
897
898 return result.Succeeded();
899 }
900
901private:
902 CommandOptions m_options;
903};
904
905#pragma mark Modify::CommandOptions
906OptionDefinition
907CommandObjectWatchpointModify::CommandOptions::g_option_table[] =
908{
909{ LLDB_OPT_SET_ALL, false, "condition", 'c', required_argument, NULL, NULL, eArgTypeExpression, "The watchpoint stops only if this condition expression evaluates to true."},
910{ 0, false, NULL, 0 , 0, NULL, 0, eArgTypeNone, NULL }
911};
912
913//-------------------------------------------------------------------------
914// CommandObjectWatchpointSetVariable
915//-------------------------------------------------------------------------
916#pragma mark SetVariable
917
918class CommandObjectWatchpointSetVariable : public CommandObjectParsed
919{
920public:
921
922 CommandObjectWatchpointSetVariable (CommandInterpreter &interpreter) :
923 CommandObjectParsed (interpreter,
924 "watchpoint set variable",
925 "Set a watchpoint on a variable. "
926 "Use the '-w' option to specify the type of watchpoint and "
927 "the '-x' option to specify the byte size to watch for. "
Johnny Chen26a24b72012-06-29 19:35:01 +0000928 "If no '-w' option is specified, it defaults to write. "
Jim Inghamda26bd22012-06-08 21:56:10 +0000929 "If no '-x' option is specified, it defaults to the variable's "
930 "byte size. "
931 "Note that there are limited hardware resources for watchpoints. "
932 "If watchpoint setting fails, consider disable/delete existing ones "
933 "to free up resources.",
934 NULL,
935 eFlagProcessMustBeLaunched | eFlagProcessMustBePaused),
936 m_option_group (interpreter),
937 m_option_watchpoint ()
938 {
939 SetHelpLong(
940 "Examples: \n\
941 \n\
942 watchpoint set variable -w read_wriate my_global_var \n\
943 # Watch my_global_var for read/write access, with the region to watch corresponding to the byte size of the data type.\n");
944
945 CommandArgumentEntry arg;
946 CommandArgumentData var_name_arg;
947
948 // Define the only variant of this arg.
949 var_name_arg.arg_type = eArgTypeVarName;
950 var_name_arg.arg_repetition = eArgRepeatPlain;
951
952 // Push the variant into the argument entry.
953 arg.push_back (var_name_arg);
954
955 // Push the data for the only argument into the m_arguments vector.
956 m_arguments.push_back (arg);
957
958 // Absorb the '-w' and '-x' options into our option group.
959 m_option_group.Append (&m_option_watchpoint, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
960 m_option_group.Finalize();
961 }
962
963 virtual
964 ~CommandObjectWatchpointSetVariable () {}
965
966 virtual Options *
967 GetOptions ()
968 {
969 return &m_option_group;
970 }
971
972protected:
973 virtual bool
974 DoExecute (Args& command,
975 CommandReturnObject &result)
976 {
977 Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
978 ExecutionContext exe_ctx(m_interpreter.GetExecutionContext());
979 StackFrame *frame = exe_ctx.GetFramePtr();
980 if (frame == NULL)
981 {
982 result.AppendError ("you must be stopped in a valid stack frame to set a watchpoint.");
983 result.SetStatus (eReturnStatusFailed);
984 return false;
985 }
986
987 // If no argument is present, issue an error message. There's no way to set a watchpoint.
988 if (command.GetArgumentCount() <= 0)
989 {
990 result.GetErrorStream().Printf("error: required argument missing; specify your program variable to watch for\n");
991 result.SetStatus(eReturnStatusFailed);
992 return false;
993 }
994
Johnny Chen26a24b72012-06-29 19:35:01 +0000995 // If no '-w' is specified, default to '-w write'.
Jim Inghamda26bd22012-06-08 21:56:10 +0000996 if (!m_option_watchpoint.watch_type_specified)
997 {
Johnny Chen26a24b72012-06-29 19:35:01 +0000998 m_option_watchpoint.watch_type = OptionGroupWatchpoint::eWatchWrite;
Jim Inghamda26bd22012-06-08 21:56:10 +0000999 }
1000
1001 // We passed the sanity check for the command.
1002 // Proceed to set the watchpoint now.
1003 lldb::addr_t addr = 0;
1004 size_t size = 0;
1005
1006 VariableSP var_sp;
1007 ValueObjectSP valobj_sp;
1008 Stream &output_stream = result.GetOutputStream();
1009
1010 // A simple watch variable gesture allows only one argument.
1011 if (command.GetArgumentCount() != 1) {
1012 result.GetErrorStream().Printf("error: specify exactly one variable to watch for\n");
1013 result.SetStatus(eReturnStatusFailed);
1014 return false;
1015 }
1016
1017 // Things have checked out ok...
1018 Error error;
Greg Claytonb3a1a2b2012-07-14 00:53:55 +00001019 uint32_t expr_path_options = StackFrame::eExpressionPathOptionCheckPtrVsMember |
1020 StackFrame::eExpressionPathOptionsAllowDirectIVarAccess;
Jim Inghamda26bd22012-06-08 21:56:10 +00001021 valobj_sp = frame->GetValueForVariableExpressionPath (command.GetArgumentAtIndex(0),
1022 eNoDynamicValues,
1023 expr_path_options,
1024 var_sp,
1025 error);
1026 if (valobj_sp) {
1027 AddressType addr_type;
1028 addr = valobj_sp->GetAddressOf(false, &addr_type);
1029 if (addr_type == eAddressTypeLoad) {
1030 // We're in business.
1031 // Find out the size of this variable.
1032 size = m_option_watchpoint.watch_size == 0 ? valobj_sp->GetByteSize()
1033 : m_option_watchpoint.watch_size;
1034 }
1035 } else {
1036 const char *error_cstr = error.AsCString(NULL);
1037 if (error_cstr)
1038 result.GetErrorStream().Printf("error: %s\n", error_cstr);
1039 else
1040 result.GetErrorStream().Printf ("error: unable to find any variable expression path that matches '%s'\n",
1041 command.GetArgumentAtIndex(0));
1042 return false;
1043 }
1044
1045 // Now it's time to create the watchpoint.
1046 uint32_t watch_type = m_option_watchpoint.watch_type;
1047 error.Clear();
1048 Watchpoint *wp = target->CreateWatchpoint(addr, size, watch_type, error).get();
1049 if (wp) {
1050 if (var_sp && var_sp->GetDeclaration().GetFile()) {
1051 StreamString ss;
1052 // True to show fullpath for declaration file.
1053 var_sp->GetDeclaration().DumpStopContext(&ss, true);
1054 wp->SetDeclInfo(ss.GetString());
1055 }
1056 StreamString ss;
1057 output_stream.Printf("Watchpoint created: ");
1058 wp->GetDescription(&output_stream, lldb::eDescriptionLevelFull);
1059 output_stream.EOL();
1060 result.SetStatus(eReturnStatusSuccessFinishResult);
1061 } else {
1062 result.AppendErrorWithFormat("Watchpoint creation failed (addr=0x%llx, size=%lu).\n",
1063 addr, size);
1064 if (error.AsCString(NULL))
1065 result.AppendError(error.AsCString());
1066 result.SetStatus(eReturnStatusFailed);
1067 }
1068
1069 return result.Succeeded();
1070 }
1071
1072private:
1073 OptionGroupOptions m_option_group;
1074 OptionGroupWatchpoint m_option_watchpoint;
1075};
1076
1077//-------------------------------------------------------------------------
1078// CommandObjectWatchpointSetExpression
1079//-------------------------------------------------------------------------
1080#pragma mark Set
1081
1082class CommandObjectWatchpointSetExpression : public CommandObjectRaw
1083{
1084public:
1085
1086 CommandObjectWatchpointSetExpression (CommandInterpreter &interpreter) :
1087 CommandObjectRaw (interpreter,
1088 "watchpoint set expression",
1089 "Set a watchpoint on an address by supplying an expression. "
1090 "Use the '-w' option to specify the type of watchpoint and "
1091 "the '-x' option to specify the byte size to watch for. "
Johnny Chen26a24b72012-06-29 19:35:01 +00001092 "If no '-w' option is specified, it defaults to write. "
Jim Inghamda26bd22012-06-08 21:56:10 +00001093 "If no '-x' option is specified, it defaults to the target's "
1094 "pointer byte size. "
1095 "Note that there are limited hardware resources for watchpoints. "
1096 "If watchpoint setting fails, consider disable/delete existing ones "
1097 "to free up resources.",
1098 NULL,
1099 eFlagProcessMustBeLaunched | eFlagProcessMustBePaused),
1100 m_option_group (interpreter),
1101 m_option_watchpoint ()
1102 {
1103 SetHelpLong(
1104 "Examples: \n\
1105 \n\
1106 watchpoint set expression -w write -x 1 -- foo + 32\n\
1107 # Watch write access for the 1-byte region pointed to by the address 'foo + 32'.\n");
1108
1109 CommandArgumentEntry arg;
1110 CommandArgumentData expression_arg;
1111
1112 // Define the only variant of this arg.
1113 expression_arg.arg_type = eArgTypeExpression;
1114 expression_arg.arg_repetition = eArgRepeatPlain;
1115
1116 // Push the only variant into the argument entry.
1117 arg.push_back (expression_arg);
1118
1119 // Push the data for the only argument into the m_arguments vector.
1120 m_arguments.push_back (arg);
1121
1122 // Absorb the '-w' and '-x' options into our option group.
1123 m_option_group.Append (&m_option_watchpoint, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
1124 m_option_group.Finalize();
1125 }
1126
1127
1128 virtual
1129 ~CommandObjectWatchpointSetExpression () {}
1130
1131 // Overrides base class's behavior where WantsCompletion = !WantsRawCommandString.
1132 virtual bool
1133 WantsCompletion() { return true; }
1134
1135 virtual Options *
1136 GetOptions ()
1137 {
1138 return &m_option_group;
1139 }
1140
1141protected:
1142 virtual bool
1143 DoExecute (const char *raw_command, CommandReturnObject &result)
1144 {
1145 Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
1146 ExecutionContext exe_ctx(m_interpreter.GetExecutionContext());
1147 StackFrame *frame = exe_ctx.GetFramePtr();
1148 if (frame == NULL)
1149 {
1150 result.AppendError ("you must be stopped in a valid stack frame to set a watchpoint.");
1151 result.SetStatus (eReturnStatusFailed);
1152 return false;
1153 }
1154
1155 Args command(raw_command);
1156
1157 // Process possible options.
1158 if (!ParseOptions (command, result))
1159 return false;
1160
1161 // If no argument is present, issue an error message. There's no way to set a watchpoint.
1162 if (command.GetArgumentCount() <= 0)
1163 {
1164 result.GetErrorStream().Printf("error: required argument missing; specify an expression to evaulate into the addres to watch for\n");
1165 result.SetStatus(eReturnStatusFailed);
1166 return false;
1167 }
1168
1169 bool with_dash_w = m_option_watchpoint.watch_type_specified;
1170 bool with_dash_x = (m_option_watchpoint.watch_size != 0);
1171
Johnny Chen26a24b72012-06-29 19:35:01 +00001172 // If no '-w' is specified, default to '-w write'.
Jim Inghamda26bd22012-06-08 21:56:10 +00001173 if (!with_dash_w)
1174 {
Johnny Chen26a24b72012-06-29 19:35:01 +00001175 m_option_watchpoint.watch_type = OptionGroupWatchpoint::eWatchWrite;
Jim Inghamda26bd22012-06-08 21:56:10 +00001176 }
1177
1178 // We passed the sanity check for the command.
1179 // Proceed to set the watchpoint now.
1180 lldb::addr_t addr = 0;
1181 size_t size = 0;
1182
1183 VariableSP var_sp;
1184 ValueObjectSP valobj_sp;
1185 Stream &output_stream = result.GetOutputStream();
1186
1187 // We will process the raw command string to rid of the '-w', '-x', or '--'
1188 llvm::StringRef raw_expr_str(raw_command);
1189 std::string expr_str = StripOptionTerminator(raw_expr_str, with_dash_w, with_dash_x).str();
1190
1191 // Sanity check for when the user forgets to terminate the option strings with a '--'.
1192 if ((with_dash_w || with_dash_w) && expr_str.empty())
1193 {
1194 result.GetErrorStream().Printf("error: did you forget to enter the option terminator string \"--\"?\n");
1195 result.SetStatus(eReturnStatusFailed);
1196 return false;
1197 }
1198
1199 // Use expression evaluation to arrive at the address to watch.
1200 const bool coerce_to_id = true;
1201 const bool unwind_on_error = true;
1202 const bool keep_in_memory = false;
1203 ExecutionResults expr_result = target->EvaluateExpression (expr_str.c_str(),
1204 frame,
1205 eExecutionPolicyOnlyWhenNeeded,
1206 coerce_to_id,
1207 unwind_on_error,
1208 keep_in_memory,
1209 eNoDynamicValues,
Enrico Granata6cca9692012-07-16 23:10:35 +00001210 valobj_sp,
1211 0 /* no timeout */);
Jim Inghamda26bd22012-06-08 21:56:10 +00001212 if (expr_result != eExecutionCompleted) {
1213 result.GetErrorStream().Printf("error: expression evaluation of address to watch failed\n");
1214 result.GetErrorStream().Printf("expression evaluated: %s\n", expr_str.c_str());
1215 result.SetStatus(eReturnStatusFailed);
1216 return false;
1217 }
1218
1219 // Get the address to watch.
1220 bool success = false;
1221 addr = valobj_sp->GetValueAsUnsigned(0, &success);
1222 if (!success) {
1223 result.GetErrorStream().Printf("error: expression did not evaluate to an address\n");
1224 result.SetStatus(eReturnStatusFailed);
1225 return false;
1226 }
1227 size = with_dash_x ? m_option_watchpoint.watch_size
1228 : target->GetArchitecture().GetAddressByteSize();
1229
1230 // Now it's time to create the watchpoint.
1231 uint32_t watch_type = m_option_watchpoint.watch_type;
1232 Error error;
1233 Watchpoint *wp = target->CreateWatchpoint(addr, size, watch_type, error).get();
1234 if (wp) {
1235 if (var_sp && var_sp->GetDeclaration().GetFile()) {
1236 StreamString ss;
1237 // True to show fullpath for declaration file.
1238 var_sp->GetDeclaration().DumpStopContext(&ss, true);
1239 wp->SetDeclInfo(ss.GetString());
1240 }
1241 StreamString ss;
1242 output_stream.Printf("Watchpoint created: ");
1243 wp->GetDescription(&output_stream, lldb::eDescriptionLevelFull);
1244 output_stream.EOL();
1245 result.SetStatus(eReturnStatusSuccessFinishResult);
1246 } else {
1247 result.AppendErrorWithFormat("Watchpoint creation failed (addr=0x%llx, size=%lu).\n",
1248 addr, size);
1249 if (error.AsCString(NULL))
1250 result.AppendError(error.AsCString());
1251 result.SetStatus(eReturnStatusFailed);
1252 }
1253
1254 return result.Succeeded();
1255 }
1256
1257private:
1258 OptionGroupOptions m_option_group;
1259 OptionGroupWatchpoint m_option_watchpoint;
1260};
1261
1262//-------------------------------------------------------------------------
1263// CommandObjectWatchpointSet
1264//-------------------------------------------------------------------------
1265#pragma mark Set
1266
1267class CommandObjectWatchpointSet : public CommandObjectMultiword
1268{
1269public:
1270
1271 CommandObjectWatchpointSet (CommandInterpreter &interpreter) :
1272 CommandObjectMultiword (interpreter,
1273 "watchpoint set",
1274 "A set of commands for setting a watchpoint.",
1275 "watchpoint set <subcommand> [<subcommand-options>]")
1276 {
1277
1278 LoadSubCommand ("variable", CommandObjectSP (new CommandObjectWatchpointSetVariable (interpreter)));
1279 LoadSubCommand ("expression", CommandObjectSP (new CommandObjectWatchpointSetExpression (interpreter)));
1280 }
1281
1282
1283 virtual
1284 ~CommandObjectWatchpointSet () {}
1285
1286};
1287
1288//-------------------------------------------------------------------------
Johnny Chen01acfa72011-09-22 18:04:58 +00001289// CommandObjectMultiwordWatchpoint
1290//-------------------------------------------------------------------------
1291#pragma mark MultiwordWatchpoint
1292
1293CommandObjectMultiwordWatchpoint::CommandObjectMultiwordWatchpoint(CommandInterpreter &interpreter) :
1294 CommandObjectMultiword (interpreter,
1295 "watchpoint",
1296 "A set of commands for operating on watchpoints.",
1297 "watchpoint <command> [<command-options>]")
1298{
Johnny Chen01acfa72011-09-22 18:04:58 +00001299 CommandObjectSP list_command_object (new CommandObjectWatchpointList (interpreter));
1300 CommandObjectSP enable_command_object (new CommandObjectWatchpointEnable (interpreter));
1301 CommandObjectSP disable_command_object (new CommandObjectWatchpointDisable (interpreter));
1302 CommandObjectSP delete_command_object (new CommandObjectWatchpointDelete (interpreter));
Johnny Chene14cf4e2011-10-05 21:35:46 +00001303 CommandObjectSP ignore_command_object (new CommandObjectWatchpointIgnore (interpreter));
Johnny Chenf3ec4612012-08-09 23:09:42 +00001304 CommandObjectSP command_command_object (new CommandObjectWatchpointCommand (interpreter));
Johnny Chen712a6282011-10-17 18:58:00 +00001305 CommandObjectSP modify_command_object (new CommandObjectWatchpointModify (interpreter));
Johnny Chen55a2d5a2012-01-30 21:46:17 +00001306 CommandObjectSP set_command_object (new CommandObjectWatchpointSet (interpreter));
Johnny Chen01acfa72011-09-22 18:04:58 +00001307
1308 list_command_object->SetCommandName ("watchpoint list");
1309 enable_command_object->SetCommandName("watchpoint enable");
1310 disable_command_object->SetCommandName("watchpoint disable");
1311 delete_command_object->SetCommandName("watchpoint delete");
Johnny Chene14cf4e2011-10-05 21:35:46 +00001312 ignore_command_object->SetCommandName("watchpoint ignore");
Johnny Chenf3ec4612012-08-09 23:09:42 +00001313 command_command_object->SetCommandName ("watchpoint command");
Johnny Chen712a6282011-10-17 18:58:00 +00001314 modify_command_object->SetCommandName("watchpoint modify");
Johnny Chen55a2d5a2012-01-30 21:46:17 +00001315 set_command_object->SetCommandName("watchpoint set");
Johnny Chen01acfa72011-09-22 18:04:58 +00001316
Greg Clayton4a379b12012-07-17 03:23:13 +00001317 LoadSubCommand ("list", list_command_object);
1318 LoadSubCommand ("enable", enable_command_object);
1319 LoadSubCommand ("disable", disable_command_object);
1320 LoadSubCommand ("delete", delete_command_object);
1321 LoadSubCommand ("ignore", ignore_command_object);
Johnny Chenf3ec4612012-08-09 23:09:42 +00001322 LoadSubCommand ("command", command_command_object);
Greg Clayton4a379b12012-07-17 03:23:13 +00001323 LoadSubCommand ("modify", modify_command_object);
1324 LoadSubCommand ("set", set_command_object);
Johnny Chen01acfa72011-09-22 18:04:58 +00001325}
1326
1327CommandObjectMultiwordWatchpoint::~CommandObjectMultiwordWatchpoint()
1328{
1329}
1330