1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Bug 507336 - Dynamic Printf parameters format may not be clear

The Properties dialog displayed for a Dynamic printf breakpoint
display a "printf ("  field, however the end parenthesis is not added
and not expected as part of the parameter list as the ending parenthesis
is added internally.

If the user adds it to complete the opening parenthesis the printf does
not work.

This update adds a validation to this field so if the user adds a final
parenthesis, the dialog will display an error message and the OK button
will be disabled.

Change-Id: Ib25c5a11176c6f92c7367246483be0f703e145bd
This commit is contained in:
Alvaro Sanchez-Leon 2016-12-09 12:02:37 -05:00
parent 2e780a54f1
commit 1afc08fea8
5 changed files with 12 additions and 2 deletions

View file

@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName Bundle-Name: %pluginName
Bundle-Vendor: %providerName Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.cdt.dsf.gdb;singleton:=true Bundle-SymbolicName: org.eclipse.cdt.dsf.gdb;singleton:=true
Bundle-Version: 5.2.0.qualifier Bundle-Version: 5.3.0.qualifier
Bundle-Activator: org.eclipse.cdt.dsf.gdb.internal.GdbPlugin Bundle-Activator: org.eclipse.cdt.dsf.gdb.internal.GdbPlugin
Bundle-Localization: plugin Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime, Require-Bundle: org.eclipse.core.runtime,

View file

@ -11,7 +11,7 @@
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<version>5.2.0-SNAPSHOT</version> <version>5.3.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.dsf.gdb</artifactId> <artifactId>org.eclipse.cdt.dsf.gdb</artifactId>
<packaging>eclipse-plugin</packaging> <packaging>eclipse-plugin</packaging>
</project> </project>

View file

@ -49,6 +49,11 @@ public class GDBDynamicPrintfUtils {
return; return;
} }
if (str.charAt(str.length() - 1) == ')') {
fErrorMessage = Messages.DynamicPrintf_Printf_not_expecting_a_closing_parenthesis;
return;
}
// Now go through the string and look for two things: // Now go through the string and look for two things:
// 1- count the number of % (but ignore any %%) // 1- count the number of % (but ignore any %%)
// 2- find the closing double-quote (but ignore any \") // 2- find the closing double-quote (but ignore any \")

View file

@ -17,6 +17,10 @@ public class Messages extends NLS {
public static String DynamicPrintf_Invalid_string; public static String DynamicPrintf_Invalid_string;
public static String DynamicPrintf_Printf_must_start_with_quote; public static String DynamicPrintf_Printf_must_start_with_quote;
public static String DynamicPrintf_Printf_missing_closing_quote; public static String DynamicPrintf_Printf_missing_closing_quote;
/**
* @since 5.3
*/
public static String DynamicPrintf_Printf_not_expecting_a_closing_parenthesis;
public static String DynamicPrintf_Missing_comma; public static String DynamicPrintf_Missing_comma;
public static String DynamicPrintf_Empty_arg; public static String DynamicPrintf_Empty_arg;
public static String DynamicPrintf_Extra_arg; public static String DynamicPrintf_Extra_arg;

View file

@ -12,6 +12,7 @@
DynamicPrintf_Invalid_string=Invalid printf string DynamicPrintf_Invalid_string=Invalid printf string
DynamicPrintf_Printf_must_start_with_quote=Printf string must start with a " DynamicPrintf_Printf_must_start_with_quote=Printf string must start with a "
DynamicPrintf_Printf_missing_closing_quote=Printf string is missing its closing " DynamicPrintf_Printf_missing_closing_quote=Printf string is missing its closing "
DynamicPrintf_Printf_not_expecting_a_closing_parenthesis=Specify Printf parameters without a closing parenthesis
DynamicPrintf_Missing_comma=Printf string can only have a , after its closing " DynamicPrintf_Missing_comma=Printf string can only have a , after its closing "
DynamicPrintf_Empty_arg=Printf string should not have empty arguments DynamicPrintf_Empty_arg=Printf string should not have empty arguments
DynamicPrintf_Extra_arg={0} extra arguments in printf specification DynamicPrintf_Extra_arg={0} extra arguments in printf specification