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

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

Issue 10826183: GDB: Test that we can step inside function. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: Created 8 years, 4 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
« no previous file with comments | « no previous file | tests/gdb/nacl.scons » ('j') | tests/gdb/nacl.scons » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 10
10 int global_var; 11 int global_var;
11 12
12 void test_two_line_function(int arg) { 13 void test_two_line_function(int arg) {
13 global_var = arg - 1; 14 global_var = arg - 1;
14 global_var = arg; 15 global_var = arg;
15 } 16 }
16 17
17 void test_stepi_after_break() { 18 void test_stepi_after_break() {
18 /* Something meaningful to step through. */ 19 /* Something meaningful to step through. */
(...skipping 14 matching lines...) Expand all
33 } 34 }
34 35
35 int test_print_symbol() { 36 int test_print_symbol() {
36 int local_var = 3; 37 int local_var = 3;
37 global_var = 2 + local_var * 0; /* Use local variable to prevent warning. */ 38 global_var = 2 + local_var * 0; /* Use local variable to prevent warning. */
38 set_global_var(1); 39 set_global_var(1);
39 nested_calls(1); 40 nested_calls(1);
40 return global_var; 41 return global_var;
41 } 42 }
42 43
44 void function_with_prolog(int arg) {
45 int local_var = arg - 1;
46 global_var = local_var;
47 alloca(1);
Mark Seaborn 2012/08/09 00:00:02 Please add a comment to explain what calling alloc
halyavin 2012/08/09 12:29:20 Done.
48 }
49
43 int main(int argc, char **argv) { 50 int main(int argc, char **argv) {
44 assert(argc >= 2); 51 assert(argc >= 2);
45 52
46 if (strcmp(argv[1], "break_inside_function") == 0) { 53 if (strcmp(argv[1], "break_inside_function") == 0) {
47 test_two_line_function(1); 54 test_two_line_function(1);
48 return 0; 55 return 0;
49 } 56 }
50 if (strcmp(argv[1], "stepi_after_break") == 0) { 57 if (strcmp(argv[1], "stepi_after_break") == 0) {
51 test_stepi_after_break(); 58 test_stepi_after_break();
52 return 0; 59 return 0;
53 } 60 }
54 if (strcmp(argv[1], "print_symbol") == 0) { 61 if (strcmp(argv[1], "print_symbol") == 0) {
55 return test_print_symbol(); 62 return test_print_symbol();
56 } 63 }
57 if (strcmp(argv[1], "stack_trace") == 0) { 64 if (strcmp(argv[1], "stack_trace") == 0) {
58 nested_calls(1); 65 nested_calls(1);
59 return 0; 66 return 0;
60 } 67 }
68 if (strcmp(argv[1], "step_from_func_start") == 0) {
Mark Seaborn 2012/08/09 00:00:02 Would it be easier to follow if the entry point na
halyavin 2012/08/09 12:29:20 Done.
69 global_var = 0;
70 function_with_prolog(2);
71 return 0;
72 }
61 return 1; 73 return 1;
62 } 74 }
OLDNEW
« no previous file with comments | « no previous file | tests/gdb/nacl.scons » ('j') | tests/gdb/nacl.scons » ('J')

Powered by Google App Engine
This is Rietveld 408576698