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

Side by Side Diff: tests/gdb/gdb_test_guest.c

Issue 10896004: Don't modify memory access right when changing data in debug stub. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 #include <assert.h> 7 #include <assert.h>
8 #include <string.h> 8 #include <string.h>
9 #include <alloca.h> 9 #include <alloca.h>
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 int local_var = arg - 1; 47 int local_var = arg - 1;
48 global_var = local_var; 48 global_var = local_var;
49 /* 49 /*
50 * Force using frame pointer for this function by calling alloca. 50 * Force using frame pointer for this function by calling alloca.
51 * This allows to test skipping %esp modifying instructions when they 51 * This allows to test skipping %esp modifying instructions when they
52 * are located in the middle of the function. 52 * are located in the middle of the function.
53 */ 53 */
54 global_ptr = alloca(arg); 54 global_ptr = alloca(arg);
55 } 55 }
56 56
57 int test_call(int arg) {
58 global_var += arg;
59 return global_var;
60 }
61
57 int main(int argc, char **argv) { 62 int main(int argc, char **argv) {
58 assert(argc >= 2); 63 assert(argc >= 2);
59 64
60 if (strcmp(argv[1], "break_inside_function") == 0) { 65 if (strcmp(argv[1], "break_inside_function") == 0) {
61 test_two_line_function(1); 66 test_two_line_function(1);
62 return 0; 67 return 0;
63 } 68 }
64 if (strcmp(argv[1], "stepi_after_break") == 0) { 69 if (strcmp(argv[1], "stepi_after_break") == 0) {
65 test_stepi_after_break(); 70 test_stepi_after_break();
66 return 0; 71 return 0;
67 } 72 }
68 if (strcmp(argv[1], "print_symbol") == 0) { 73 if (strcmp(argv[1], "print_symbol") == 0) {
69 return test_print_symbol(); 74 return test_print_symbol();
70 } 75 }
71 if (strcmp(argv[1], "stack_trace") == 0) { 76 if (strcmp(argv[1], "stack_trace") == 0) {
72 nested_calls(1); 77 nested_calls(1);
73 return 0; 78 return 0;
74 } 79 }
75 if (strcmp(argv[1], "step_from_func_start") == 0) { 80 if (strcmp(argv[1], "step_from_func_start") == 0) {
76 global_var = 0; 81 global_var = 0;
77 test_step_from_function_start(2); 82 test_step_from_function_start(2);
78 return 0; 83 return 0;
79 } 84 }
85 if (strcmp(argv[1], "call") == 0) {
86 global_var = 0;
87 test_call(1);
88 return 0;
89 }
80 return 1; 90 return 1;
81 } 91 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698