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

Side by Side Diff: gdb/testsuite/gdb.trace/tfile.c

Issue 124383005: GDB 7.6.50 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@upstream
Patch Set: Created 6 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 unified diff | Download patch
« no previous file with comments | « gdb/testsuite/gdb.trace/strace.exp ('k') | gdb/testsuite/gdb.trace/tfile.exp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* This testcase is part of GDB, the GNU debugger.
2
3 Copyright 2010-2013 Free Software Foundation, Inc.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17
1 /* This program does two things; it generates valid trace files, and 18 /* This program does two things; it generates valid trace files, and
2 it can also be traced so as to test trace file creation from 19 it can also be traced so as to test trace file creation from
3 GDB. */ 20 GDB. */
4 21
5 #include <stdio.h> 22 #include <stdio.h>
6 #include <string.h> 23 #include <string.h>
7 #include <fcntl.h> 24 #include <fcntl.h>
8 #include <sys/stat.h> 25 #include <sys/stat.h>
9 26
10 char spbuf[200]; 27 char spbuf[200];
11 28
12 char trbuf[1000]; 29 char trbuf[1000];
13 char *trptr; 30 char *trptr;
14 char *tfsizeptr; 31 char *tfsizeptr;
15 32
33 /* These globals are put in the trace buffer. */
34
16 int testglob = 31415; 35 int testglob = 31415;
17 36
18 int testglob2 = 271828; 37 int testglob2 = 271828;
19 38
39 /* But these below are not. */
40
20 const int constglob = 10000; 41 const int constglob = 10000;
21 42
43 int nonconstglob = 14124;
44
22 int 45 int
23 start_trace_file (char *filename) 46 start_trace_file (char *filename)
24 { 47 {
25 int fd; 48 int fd;
26 49
27 fd = open (filename, O_WRONLY|O_CREAT|O_APPEND, 50 fd = open (filename, O_WRONLY|O_CREAT|O_APPEND,
28 S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); 51 S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
29 52
30 if (fd < 0) 53 if (fd < 0)
31 return fd; 54 return fd;
(...skipping 30 matching lines...) Expand all
62 memcpy (trptr, addr, size); 85 memcpy (trptr, addr, size);
63 trptr += size; 86 trptr += size;
64 } 87 }
65 88
66 void 89 void
67 write_basic_trace_file (void) 90 write_basic_trace_file (void)
68 { 91 {
69 int fd, int_x; 92 int fd, int_x;
70 short short_x; 93 short short_x;
71 94
72 fd = start_trace_file ("basic.tf"); 95 fd = start_trace_file (TFILE_DIR "tfile-basic.tf");
73 96
74 /* The next part of the file consists of newline-separated lines 97 /* The next part of the file consists of newline-separated lines
75 defining status, tracepoints, etc. The section is terminated by 98 defining status, tracepoints, etc. The section is terminated by
76 an empty line. */ 99 an empty line. */
77 100
78 /* Dump the size of the R (register) blocks in traceframes. */ 101 /* Dump the size of the R (register) blocks in traceframes. */
79 snprintf (spbuf, sizeof spbuf, "R %x\n", 500 /* FIXME get from arch */); 102 snprintf (spbuf, sizeof spbuf, "R %x\n", 500 /* FIXME get from arch */);
80 write (fd, spbuf, strlen (spbuf)); 103 write (fd, spbuf, strlen (spbuf));
81 104
82 /* Dump trace status, in the general form of the qTstatus reply. */ 105 /* Dump trace status, in the general form of the qTstatus reply. */
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 } 170 }
148 171
149 void 172 void
150 write_error_trace_file (void) 173 write_error_trace_file (void)
151 { 174 {
152 int fd; 175 int fd;
153 const char made_up[] = "made-up error"; 176 const char made_up[] = "made-up error";
154 int len = sizeof (made_up) - 1; 177 int len = sizeof (made_up) - 1;
155 char *hex = alloca (len * 2 + 1); 178 char *hex = alloca (len * 2 + 1);
156 179
157 fd = start_trace_file ("error.tf"); 180 fd = start_trace_file (TFILE_DIR "tfile-error.tf");
158 181
159 /* The next part of the file consists of newline-separated lines 182 /* The next part of the file consists of newline-separated lines
160 defining status, tracepoints, etc. The section is terminated by 183 defining status, tracepoints, etc. The section is terminated by
161 an empty line. */ 184 an empty line. */
162 185
163 /* Dump the size of the R (register) blocks in traceframes. */ 186 /* Dump the size of the R (register) blocks in traceframes. */
164 snprintf (spbuf, sizeof spbuf, "R %x\n", 500 /* FIXME get from arch */); 187 snprintf (spbuf, sizeof spbuf, "R %x\n", 500 /* FIXME get from arch */);
165 write (fd, spbuf, strlen (spbuf)); 188 write (fd, spbuf, strlen (spbuf));
166 189
167 bin2hex (made_up, hex, len); 190 bin2hex (made_up, hex, len);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 { 230 {
208 write_basic_trace_file (); 231 write_basic_trace_file ();
209 232
210 write_error_trace_file (); 233 write_error_trace_file ();
211 234
212 done_making_trace_files (); 235 done_making_trace_files ();
213 236
214 return 0; 237 return 0;
215 } 238 }
216 239
OLDNEW
« no previous file with comments | « gdb/testsuite/gdb.trace/strace.exp ('k') | gdb/testsuite/gdb.trace/tfile.exp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698