PageRenderTime 42ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/eclipse-cdt-8.1.0/org.eclipse.cdt-CDT_8_1_0/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIBreakInsert.java

#
Java | 138 lines | 77 code | 9 blank | 52 comment | 18 complexity | ca56ca33dcf1acb07a415c8b3bec9c51 MD5 | raw file
Possible License(s): GPL-3.0, LGPL-2.1
  1. /*******************************************************************************
  2. * Copyright (c) 2000, 2006 QNX Software Systems and others.
  3. * All rights reserved. This program and the accompanying materials
  4. * are made available under the terms of the Eclipse Public License v1.0
  5. * which accompanies this distribution, and is available at
  6. * http://www.eclipse.org/legal/epl-v10.html
  7. *
  8. * Contributors:
  9. * QNX Software Systems - Initial API and implementation
  10. *******************************************************************************/
  11. package org.eclipse.cdt.debug.mi.core.command;
  12. import org.eclipse.cdt.debug.mi.core.MIException;
  13. import org.eclipse.cdt.debug.mi.core.output.MIBreakInsertInfo;
  14. import org.eclipse.cdt.debug.mi.core.output.MIInfo;
  15. import org.eclipse.cdt.debug.mi.core.output.MIOutput;
  16. /**
  17. *
  18. * -break-insert [ -t ] [ -h ] [ -r ]
  19. * [ -c CONDITION ] [ -i IGNORE-COUNT ]
  20. * [ -p THREAD ] [ LINE | ADDR ]
  21. *
  22. * If specified, LINE, can be one of:
  23. *
  24. * * function
  25. *
  26. * * filename:linenum
  27. *
  28. * * filename:function
  29. *
  30. * * *address
  31. *
  32. * The possible optional parameters of this command are:
  33. *
  34. * `-t'
  35. * Insert a tempoary breakpoint.
  36. *
  37. * `-h'
  38. * Insert a hardware breakpoint.
  39. *
  40. * `-c CONDITION'
  41. * Make the breakpoint conditional on CONDITION.
  42. *
  43. * `-i IGNORE-COUNT'
  44. * Initialize the IGNORE-COUNT.
  45. *
  46. * `-r'
  47. *
  48. * Insert a regular breakpoint in all the functions whose names match
  49. * the given regular expression. Other flags are not applicable to
  50. * regular expresson.
  51. *
  52. * The result is in the form:
  53. *
  54. * ^done,bkptno="NUMBER",func="FUNCNAME",
  55. * file="FILENAME",line="LINENO"
  56. *
  57. */
  58. public class MIBreakInsert extends MICommand
  59. {
  60. public MIBreakInsert(String miVersion, String func) {
  61. this(miVersion, false, false, null, 0, func, 0);
  62. }
  63. public MIBreakInsert(String miVersion, boolean isTemporary, boolean isHardware,
  64. String condition, int ignoreCount, String line, int tid) {
  65. super(miVersion, "-break-insert"); //$NON-NLS-1$
  66. int i = 0;
  67. if (isTemporary) {
  68. i++;
  69. }
  70. if (isHardware) {
  71. i++;
  72. }
  73. if (condition != null && condition.length() > 0) {
  74. i += 2;
  75. }
  76. if (ignoreCount > 0) {
  77. i += 2;
  78. }
  79. if (tid > 0) {
  80. i += 2;
  81. }
  82. String[] opts = new String[i];
  83. i = 0;
  84. if (isTemporary) {
  85. opts[i] = "-t"; //$NON-NLS-1$
  86. i++;
  87. }
  88. if (isHardware) {
  89. opts[i] = "-h"; //$NON-NLS-1$
  90. i++;
  91. }
  92. if (condition != null && condition.length() > 0) {
  93. opts[i] = "-c"; //$NON-NLS-1$
  94. i++;
  95. opts[i] = condition;
  96. i++;
  97. }
  98. if (ignoreCount > 0) {
  99. opts[i] = "-i"; //$NON-NLS-1$
  100. i++;
  101. opts[i] = Integer.toString(ignoreCount);
  102. i++;
  103. }
  104. if (tid > 0) {
  105. opts[i] = "-p"; //$NON-NLS-1$
  106. i++;
  107. opts[i] = Integer.toString(tid);
  108. }
  109. if (opts.length > 0) {
  110. setOptions(opts);
  111. }
  112. setParameters(new String[]{line});
  113. }
  114. public MIBreakInsertInfo getMIBreakInsertInfo() throws MIException {
  115. return (MIBreakInsertInfo)getMIInfo();
  116. }
  117. @Override
  118. public MIInfo getMIInfo() throws MIException {
  119. MIInfo info = null;
  120. MIOutput out = getMIOutput();
  121. if (out != null) {
  122. info = new MIBreakInsertInfo(out);
  123. if (info.isError()) {
  124. throwMIException(info, out);
  125. }
  126. }
  127. return info;
  128. }
  129. }