Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(458)

Unified Diff: runtime/bin/main.cc

Issue 9240014: Set breakpoint at url, line number (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/include/dart_debugger_api.h » ('j') | runtime/include/dart_debugger_api.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/main.cc
===================================================================
--- runtime/bin/main.cc (revision 3366)
+++ runtime/bin/main.cc (working copy)
@@ -359,6 +359,43 @@
}
+static Dart_Handle SetBreakpoint(const char* breakpoint_at,
+ Dart_Handle library) {
siva 2012/01/18 01:32:03 indentation?
hausner 2012/01/18 23:26:38 Done.
+ Dart_Handle result;
+ if (strchr(breakpoint_at, ':')) {
+ Dart_Handle url;
+ Dart_Handle line_number;
+ char* bpt_line = strdup(breakpoint_at);
+ char* colon = strchr(bpt_line, ':');
+ ASSERT(colon != NULL);
+ *colon = '\0';
+ url = Dart_NewString(bpt_line);
siva 2012/01/18 01:32:03 Dart_Handle url = ....;
hausner 2012/01/18 23:26:38 Done.
+ line_number = Dart_NewInteger(atoi(colon + 1));
siva 2012/01/18 01:32:03 Dart_Handle line_number = ...; Also we may want t
hausner 2012/01/18 23:26:38 This is really just a make-shift UI for me to test
+ free(bpt_line);
+ Dart_Breakpoint bpt;
+ result = Dart_SetBreakpointAtLine(url, line_number, &bpt);
+ } else {
+ char* bpt_function = strdup(breakpoint_at);
+ Dart_Handle class_name;
+ Dart_Handle function_name;
+ char* dot = strchr(bpt_function, '.');
+ if (dot == NULL) {
+ class_name = Dart_NewString("");
+ function_name = Dart_NewString(breakpoint_at);
+ } else {
+ *dot = '\0';
+ class_name = Dart_NewString(bpt_function);
+ function_name = Dart_NewString(dot + 1);
siva 2012/01/18 01:32:03 We may want to protect against input strings of th
hausner 2012/01/18 23:26:38 Ditto
+ }
+ free(bpt_function);
+ Dart_Breakpoint bpt;
+ result = Dart_SetBreakpointAtEntry(
+ library, class_name, function_name, &bpt);
+ }
+ return result;
+}
+
+
int main(int argc, char** argv) {
char* script_name;
CommandLineOptions vm_options(argc);
@@ -453,22 +490,7 @@
}
// Set debug breakpoint if specified on the command line.
if (breakpoint_at != NULL) {
- char* bpt_function = strdup(breakpoint_at);
- Dart_Handle class_name;
- Dart_Handle function_name;
- char* dot = strchr(bpt_function, '.');
- if (dot == NULL) {
- class_name = Dart_NewString("");
- function_name = Dart_NewString(breakpoint_at);
- } else {
- *dot = '\0';
- class_name = Dart_NewString(bpt_function);
- function_name = Dart_NewString(dot + 1);
- }
- free(bpt_function);
- Dart_Breakpoint bpt;
- result = Dart_SetBreakpointAtEntry(
- library, class_name, function_name, &bpt);
+ result = SetBreakpoint(breakpoint_at, library);
if (Dart_IsError(result)) {
fprintf(stderr, "Error setting breakpoint at '%s': %s\n",
breakpoint_at,
« no previous file with comments | « no previous file | runtime/include/dart_debugger_api.h » ('j') | runtime/include/dart_debugger_api.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698