Mercurial > libpst
annotate src/debug.c @ 174:9bbc834d5f3e
new debianization from hggdh
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Tue, 07 Apr 2009 13:45:20 -0700 |
parents | 6954d315aaa8 |
children | ac6e22c8a9cf |
rev | line source |
---|---|
48 | 1 #include "define.h" |
16 | 2 |
46 | 3 struct pst_debug_item { |
4 int type; | |
5 char * function; | |
6 unsigned int line; | |
7 char * file; | |
8 char * text; | |
9 struct pst_debug_item *next; | |
172
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
10 }; |
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
11 |
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
12 static struct pst_debug_item *item_head=NULL, *item_tail=NULL, *item_ptr=NULL, *info_ptr=NULL, *temp_list=NULL; |
16 | 13 |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
14 |
46 | 15 struct pst_debug_func { |
16 char * name; | |
17 struct pst_debug_func *next; | |
172
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
18 }; |
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
19 |
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
20 static struct pst_debug_func *func_head=NULL, *func_ptr=NULL; |
16 | 21 |
22 | |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
23 void pst_debug_write_msg(struct pst_debug_item *item, const char *fmt, va_list *ap, int size); |
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
24 void pst_debug_write_hex(struct pst_debug_item *item, char *buf, size_t size, int col); |
172
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
25 void * pst_malloc(size_t size); |
16 | 26 |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
27 size_t pst_debug_fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream) { |
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
28 return fwrite(ptr, size, nitems, stream); |
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
29 } |
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
30 |
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
31 |
16 | 32 // the largest text size we will store in memory. Otherwise we |
33 // will do a debug_write, then create a new record, and write the | |
34 // text body directly to the file | |
35 #define MAX_MESSAGE_SIZE 4096 | |
36 | |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
37 void pst_debug(const char *fmt, ...) { |
46 | 38 va_list ap; |
39 va_start(ap,fmt); | |
40 vfprintf(stderr, fmt, ap); | |
41 va_end(ap); | |
16 | 42 } |
43 | |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
44 |
16 | 45 #define NUM_COL 30 |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
46 void pst_debug_hexdumper(FILE *out, char *buf, size_t size, int col, int delta) { |
70
b12f4e50e2e8
Patch from Joachim Metz <joachim.metz@gmail.com> for 64 bit compile.
Carl Byington <carl@five-ten-sg.com>
parents:
48
diff
changeset
|
47 size_t off = 0, toff; |
46 | 48 int count = 0; |
16 | 49 |
46 | 50 if (!out) return; // no file |
51 if (col == -1) col = NUM_COL; | |
52 fprintf(out, "\n"); | |
53 while (off < size) { | |
125
23a36ac0514d
recover dropped pragma pack line, use int64_t rather than off_t to avoid forcing users of the shared library to enable large file support.
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
54 fprintf(out, "%06"PRIx64"\t:", (int64_t)(off+delta)); |
46 | 55 toff = off; |
56 while (count < col && off < size) { | |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
57 fprintf(out, "%02hhx ", (unsigned char)buf[off]); |
46 | 58 off++; count++; |
59 } | |
60 off = toff; | |
61 while (count < col) { | |
62 // only happens at end of block to pad the text over to the text column | |
63 fprintf(out, " "); | |
64 count++; | |
65 } | |
66 count = 0; | |
67 fprintf(out, ":"); | |
68 while (count < col && off < size) { | |
69 fprintf(out, "%c", isgraph(buf[off])?buf[off]:'.'); | |
70 off++; count ++; | |
71 } | |
16 | 72 |
46 | 73 fprintf(out, "\n"); |
74 count=0; | |
75 } | |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
76 |
46 | 77 fprintf(out, "\n"); |
16 | 78 } |
79 | |
80 | |
172
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
81 static FILE *debug_fp = NULL; |
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
82 static unsigned int max_items=DEBUG_MAX_ITEMS, curr_items=0; |
16 | 83 |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
84 |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
85 void pst_debug_init(const char* fname) { |
46 | 86 unsigned char version = DEBUG_VERSION; |
87 item_head = item_tail = NULL; | |
88 curr_items = 0; | |
89 if (debug_fp) pst_debug_close(); | |
90 if (!fname) return; | |
91 if ((debug_fp = fopen(fname, "wb")) == NULL) { | |
92 fprintf(stderr, "Opening of file %s failed\n", fname); | |
93 exit(1); | |
94 } | |
101
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
95 pst_debug_fwrite(&version, sizeof(char), 1, debug_fp); |
16 | 96 } |
97 | |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
98 |
46 | 99 // function must be called before pst_debug_msg. It sets up the |
16 | 100 // structure for the function that follows |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
101 void pst_debug_msg_info(int line, const char* file, int type) { |
46 | 102 char *x; |
103 if (!debug_fp) return; // no file | |
172
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
104 info_ptr = (struct pst_debug_item*) pst_malloc(sizeof(struct pst_debug_item)); |
46 | 105 info_ptr->type = type; |
106 info_ptr->line = line; | |
107 x = (func_head==NULL?"No Function":func_head->name); | |
172
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
108 info_ptr->function = (char*) pst_malloc(strlen(x)+1); |
46 | 109 strcpy(info_ptr->function, x); |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
110 |
172
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
111 info_ptr->file = (char*) pst_malloc(strlen(file)+1); |
46 | 112 strcpy(info_ptr->file, file); |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
113 |
46 | 114 //put the current record on a temp linked list |
115 info_ptr->next = temp_list; | |
116 temp_list = info_ptr; | |
16 | 117 } |
118 | |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
119 |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
120 void pst_debug_msg_text(const char* fmt, ...) { |
46 | 121 va_list ap; |
122 int f, g; | |
123 char x[2]; | |
79
56fa05fd5271
Patch from Robert Simpson for encryption type 2.
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
124 #ifdef _WIN32 |
56fa05fd5271
Patch from Robert Simpson for encryption type 2.
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
125 char *buf = NULL; |
56fa05fd5271
Patch from Robert Simpson for encryption type 2.
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
126 #endif |
46 | 127 struct pst_debug_item *temp; |
128 if (!debug_fp) return; // no file | |
129 // get the record off of the temp_list | |
130 info_ptr = temp_list; | |
131 if (info_ptr) | |
132 temp_list = info_ptr->next; | |
133 else { | |
134 fprintf(stderr, "NULL info_ptr. ERROR!!\n"); | |
135 exit(-2); | |
136 } | |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
137 |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
138 #ifdef _WIN32 |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
139 // vsnprintf trick doesn't work on msvc. |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
140 g = 2000; |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
141 f = -1; |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
142 while (f < 0) { |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
143 buf = realloc(buf, g+1); |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
144 va_start(ap, fmt); |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
145 f = vsnprintf(buf, g, fmt, ap); |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
146 va_end(ap); |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
147 g += g/2; |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
148 } |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
149 free(buf); |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
150 #else |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
151 // according to glibc 2.1, this should return the req. number of bytes for |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
152 // the string |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
153 va_start(ap, fmt); |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
154 f = vsnprintf(x, 1, fmt, ap); |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
155 va_end(ap); |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
156 #endif |
16 | 157 |
46 | 158 if (f > 0 && f < MAX_MESSAGE_SIZE) { |
172
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
159 info_ptr->text = (char*) pst_malloc(f+1); |
46 | 160 va_start(ap, fmt); |
161 if ((g = vsnprintf(info_ptr->text, f, fmt, ap)) == -1) { | |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
162 fprintf(stderr, "_debug_msg: Dying! vsnprintf returned -1 for format \"%s\"\n", fmt); |
46 | 163 exit(-2); |
164 } | |
165 va_end(ap); | |
166 info_ptr->text[g] = '\0'; | |
167 if (f != g) { | |
168 fprintf(stderr, "_debug_msg: f != g\n"); | |
169 } | |
170 } else if (f > 0) { // it is over the max_message_size then | |
171 f += strlen(info_ptr->file)+strlen(info_ptr->function); | |
172 temp = info_ptr; | |
173 pst_debug_write(); // dump the current messages | |
174 info_ptr = temp; | |
175 va_start(ap, fmt); | |
176 pst_debug_write_msg(info_ptr, fmt, &ap, f); | |
177 va_end(ap); | |
178 free(info_ptr->function); | |
179 free(info_ptr->file); | |
180 free(info_ptr); | |
181 info_ptr = NULL; | |
182 return; | |
183 } else { | |
184 fprintf(stderr, "_debug_msg: error getting requested size of debug message\n"); | |
185 info_ptr->text = "ERROR Saving\n"; | |
186 } | |
16 | 187 |
101
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
188 // add to the linked list of pending items |
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
189 if (!item_head) item_head = info_ptr; |
46 | 190 info_ptr->next = NULL; |
191 if (item_tail) item_tail->next = info_ptr; | |
192 item_tail = info_ptr; | |
16 | 193 |
46 | 194 if (++curr_items == max_items) { |
195 // here we will jump off and save the contents | |
196 pst_debug_write(); | |
197 info_ptr = NULL; | |
198 } | |
16 | 199 } |
200 | |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
201 |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
202 void pst_debug_hexdump(char *x, size_t y, int cols, int delta) { |
46 | 203 struct pst_debug_item *temp; |
204 if (!debug_fp) return; // no file | |
205 info_ptr = temp_list; | |
206 if (info_ptr) temp_list = info_ptr->next; | |
207 temp = info_ptr; | |
208 pst_debug_write(); | |
209 info_ptr = temp; | |
210 pst_debug_write_hex(info_ptr, x, y, cols); | |
211 free(info_ptr->function); | |
212 free(info_ptr->file); | |
213 free(info_ptr); | |
214 info_ptr = NULL; | |
16 | 215 } |
216 | |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
217 |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
218 void pst_debug_func(const char *function) { |
172
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
219 func_ptr = pst_malloc (sizeof(struct pst_debug_func)); |
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
220 func_ptr->name = pst_malloc(strlen(function)+1); |
46 | 221 strcpy(func_ptr->name, function); |
222 func_ptr->next = func_head; | |
223 func_head = func_ptr; | |
16 | 224 } |
225 | |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
226 |
46 | 227 void pst_debug_func_ret() { |
228 //remove the head item | |
229 func_ptr = func_head; | |
230 if (func_head) { | |
231 func_head = func_head->next; | |
232 free(func_ptr->name); | |
233 free(func_ptr); | |
234 } else { | |
235 DIE(("function list is empty!\n")); | |
236 } | |
16 | 237 } |
238 | |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
239 |
46 | 240 void pst_debug_close(void) { |
241 pst_debug_write(); | |
242 while (func_head) { | |
243 func_ptr = func_head; | |
244 func_head = func_head->next; | |
245 free(func_ptr->name); | |
246 free(func_ptr); | |
247 } | |
248 if (debug_fp) fclose(debug_fp); | |
249 debug_fp = NULL; | |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
250 } |
16 | 251 |
252 | |
46 | 253 void pst_debug_write() { |
254 size_t size, ptr, funcname, filename, text, end; | |
255 char *buf = NULL, rec_type; | |
256 if (!debug_fp) return; // no file | |
125
23a36ac0514d
recover dropped pragma pack line, use int64_t rather than off_t to avoid forcing users of the shared library to enable large file support.
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
257 int64_t index_pos = ftello(debug_fp); |
23a36ac0514d
recover dropped pragma pack line, use int64_t rather than off_t to avoid forcing users of the shared library to enable large file support.
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
258 int64_t file_pos = index_pos; |
46 | 259 // add 2. One for the pointer to the next index, |
260 // one for the count of this index | |
125
23a36ac0514d
recover dropped pragma pack line, use int64_t rather than off_t to avoid forcing users of the shared library to enable large file support.
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
261 int index_size = ((curr_items+2) * sizeof(int64_t)); |
23a36ac0514d
recover dropped pragma pack line, use int64_t rather than off_t to avoid forcing users of the shared library to enable large file support.
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
262 int64_t *index; |
46 | 263 int index_ptr = 0; |
264 struct pst_debug_file_rec_m mfile_rec; | |
265 struct pst_debug_file_rec_l lfile_rec; | |
16 | 266 |
46 | 267 if (curr_items == 0) return; // no items to write. |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
268 |
172
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
269 index = (int64_t*)pst_malloc(index_size); |
46 | 270 memset(index, 0, index_size); // valgrind, avoid writing uninitialized data |
271 file_pos += index_size; | |
272 // write the index first, we will re-write it later, but | |
273 // we want to allocate the space | |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
274 pst_debug_fwrite(index, index_size, 1, debug_fp); |
46 | 275 index[index_ptr++] = curr_items; |
16 | 276 |
46 | 277 item_ptr = item_head; |
278 while (item_ptr) { | |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
279 file_pos = ftello(debug_fp); |
46 | 280 index[index_ptr++] = file_pos; |
281 size = strlen(item_ptr->function) + | |
282 strlen(item_ptr->file) + | |
283 strlen(item_ptr->text) + 3; //for the three \0s | |
284 if (buf) free(buf); | |
172
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
285 buf = pst_malloc(size+1); |
46 | 286 ptr = 0; |
287 funcname=ptr; | |
288 ptr += sprintf(&(buf[ptr]), "%s", item_ptr->function)+1; | |
289 filename=ptr; | |
290 ptr += sprintf(&(buf[ptr]), "%s", item_ptr->file)+1; | |
291 text=ptr; | |
292 ptr += sprintf(&(buf[ptr]), "%s", item_ptr->text)+1; | |
293 end=ptr; | |
294 if (end > USHRT_MAX) { // bigger than can be stored in a short | |
295 rec_type = 'L'; | |
101
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
296 pst_debug_fwrite(&rec_type, sizeof(char), 1, debug_fp); |
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
297 lfile_rec.type = item_ptr->type; |
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
298 lfile_rec.line = item_ptr->line; |
46 | 299 lfile_rec.funcname = funcname; |
300 lfile_rec.filename = filename; | |
101
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
301 lfile_rec.text = text; |
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
302 lfile_rec.end = end; |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
303 pst_debug_fwrite(&lfile_rec, sizeof(lfile_rec), 1, debug_fp); |
46 | 304 } else { |
305 rec_type = 'M'; | |
101
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
306 pst_debug_fwrite(&rec_type, sizeof(char), 1, debug_fp); |
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
307 mfile_rec.type = item_ptr->type; |
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
308 mfile_rec.line = item_ptr->line; |
46 | 309 mfile_rec.funcname = funcname; |
310 mfile_rec.filename = filename; | |
101
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
311 mfile_rec.text = text; |
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
312 mfile_rec.end = end; |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
313 pst_debug_fwrite(&mfile_rec, sizeof(mfile_rec), 1, debug_fp); |
46 | 314 } |
101
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
315 pst_debug_fwrite(buf, ptr, 1, debug_fp); |
46 | 316 if (buf) free(buf); buf = NULL; |
317 item_head = item_ptr->next; | |
318 free(item_ptr->function); | |
319 free(item_ptr->file); | |
320 free(item_ptr->text); | |
321 free(item_ptr); | |
322 item_ptr = item_head; | |
323 } | |
324 curr_items = 0; | |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
325 index[index_ptr] = ftello(debug_fp); |
16 | 326 |
46 | 327 // we should now have a complete index |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
328 fseeko(debug_fp, index_pos, SEEK_SET); |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
329 pst_debug_fwrite(index, index_size, 1, debug_fp); |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
330 fseeko(debug_fp, 0, SEEK_END); |
46 | 331 item_ptr = item_head = item_tail = NULL; |
332 free(index); | |
333 if (buf) free(buf); | |
16 | 334 } |
335 | |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
336 |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
337 void pst_debug_write_msg(struct pst_debug_item *item, const char *fmt, va_list *ap, int size) { |
46 | 338 struct pst_debug_file_rec_l lfile_rec; |
339 struct pst_debug_file_rec_m mfile_rec; | |
340 unsigned char rec_type; | |
125
23a36ac0514d
recover dropped pragma pack line, use int64_t rather than off_t to avoid forcing users of the shared library to enable large file support.
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
341 int index_size = 3 * sizeof(int64_t); |
23a36ac0514d
recover dropped pragma pack line, use int64_t rather than off_t to avoid forcing users of the shared library to enable large file support.
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
342 int64_t index[3]; |
23a36ac0514d
recover dropped pragma pack line, use int64_t rather than off_t to avoid forcing users of the shared library to enable large file support.
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
343 int64_t index_pos, file_pos; |
101
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
344 char zero = '\0'; |
46 | 345 unsigned int end; |
346 if (!debug_fp) return; // no file | |
101
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
347 index[0] = 1; // only one item in this index |
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
348 index[1] = 0; // valgrind, avoid writing uninitialized data |
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
349 index[2] = 0; // "" |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
350 index_pos = ftello(debug_fp); |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
351 pst_debug_fwrite(index, index_size, 1, debug_fp); |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
352 |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
353 index[1] = ftello(debug_fp); |
16 | 354 |
46 | 355 if (size > USHRT_MAX) { // bigger than can be stored in a short |
356 rec_type = 'L'; | |
101
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
357 pst_debug_fwrite(&rec_type, sizeof(char), 1, debug_fp); |
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
358 lfile_rec.type = item->type; |
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
359 lfile_rec.line = item->line; |
46 | 360 lfile_rec.funcname = 0; |
361 lfile_rec.filename = strlen(item->function)+1; | |
101
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
362 lfile_rec.text = lfile_rec.filename+strlen(item->file)+1; |
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
363 lfile_rec.end = 0; // valgrind, avoid writing uninitialized data |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
364 pst_debug_fwrite(&lfile_rec, sizeof(lfile_rec), 1, debug_fp); |
46 | 365 } else { |
366 rec_type = 'M'; | |
101
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
367 pst_debug_fwrite(&rec_type, sizeof(char), 1, debug_fp); |
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
368 mfile_rec.type = item->type; |
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
369 mfile_rec.line = item->line; |
46 | 370 mfile_rec.funcname = 0; |
371 mfile_rec.filename = strlen(item->function)+1; | |
101
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
372 mfile_rec.text = mfile_rec.filename+strlen(item->file)+1; |
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
373 mfile_rec.end = 0; // valgrind, avoid writing uninitialized data |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
374 pst_debug_fwrite(&mfile_rec, sizeof(mfile_rec), 1, debug_fp); |
46 | 375 } |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
376 file_pos = ftello(debug_fp); |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
377 pst_debug_fwrite(item->function, strlen(item->function)+1, 1, debug_fp); |
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
378 pst_debug_fwrite(item->file, strlen(item->file)+1, 1, debug_fp); |
46 | 379 vfprintf(debug_fp, fmt, *ap); |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
380 pst_debug_fwrite(&zero, 1, 1, debug_fp); |
16 | 381 |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
382 end = (unsigned int) (ftello(debug_fp) - file_pos); |
16 | 383 |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
384 index[2] = ftello(debug_fp); |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
385 fseeko(debug_fp, index_pos, SEEK_SET); |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
386 pst_debug_fwrite(index, index_size, 1, debug_fp); |
46 | 387 if (size > USHRT_MAX) { |
101
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
388 pst_debug_fwrite(&rec_type, sizeof(char), 1, debug_fp); |
46 | 389 lfile_rec.end = end; |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
390 pst_debug_fwrite(&lfile_rec, sizeof(lfile_rec), 1, debug_fp); |
46 | 391 } else { |
101
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
392 pst_debug_fwrite(&rec_type, sizeof(char), 1, debug_fp); |
46 | 393 mfile_rec.end = end; |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
394 pst_debug_fwrite(&mfile_rec, sizeof(mfile_rec), 1, debug_fp); |
46 | 395 } |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
396 fseeko(debug_fp, 0, SEEK_END); |
16 | 397 } |
398 | |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
399 |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
400 void pst_debug_write_hex(struct pst_debug_item *item, char *buf, size_t size, int col) { |
46 | 401 struct pst_debug_file_rec_l lfile_rec; |
402 unsigned char rec_type; | |
125
23a36ac0514d
recover dropped pragma pack line, use int64_t rather than off_t to avoid forcing users of the shared library to enable large file support.
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
403 int index_size = 3 * sizeof(int64_t); |
23a36ac0514d
recover dropped pragma pack line, use int64_t rather than off_t to avoid forcing users of the shared library to enable large file support.
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
404 int64_t index_pos, file_pos, index[3]; |
46 | 405 char zero='\0'; |
406 if (!debug_fp) return; // no file | |
407 index[0] = 1; // only one item in this index run | |
408 index[1] = 0; // valgrind, avoid writing uninitialized data | |
409 index[2] = 0; // "" | |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
410 index_pos = ftello(debug_fp); |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
411 pst_debug_fwrite(index, index_size, 1, debug_fp); |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
412 index[1] = ftello(debug_fp); |
16 | 413 |
46 | 414 // always use the long |
415 rec_type = 'L'; | |
101
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
416 pst_debug_fwrite(&rec_type, sizeof(char), 1, debug_fp); |
46 | 417 lfile_rec.funcname = 0; |
418 lfile_rec.filename = strlen(item->function)+1; | |
419 lfile_rec.text = lfile_rec.filename+strlen(item->file)+1; | |
420 lfile_rec.end = 0; // valgrind, avoid writing uninitialized data | |
421 lfile_rec.line = item->line; | |
422 lfile_rec.type = item->type; | |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
423 pst_debug_fwrite(&lfile_rec, sizeof(lfile_rec), 1, debug_fp); |
16 | 424 |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
425 file_pos = ftello(debug_fp); |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
426 pst_debug_fwrite(item->function, strlen(item->function)+1, 1, debug_fp); |
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
427 pst_debug_fwrite(item->file, strlen(item->file)+1, 1, debug_fp); |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
428 |
46 | 429 pst_debug_hexdumper(debug_fp, buf, size, col, 0); |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
430 pst_debug_fwrite(&zero, 1, 1, debug_fp); |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
431 lfile_rec.end = ftello(debug_fp) - file_pos; |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
432 |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
433 index[2] = ftello(debug_fp); |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
434 fseeko(debug_fp, index_pos, SEEK_SET); |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
435 pst_debug_fwrite(index, index_size, 1, debug_fp); |
101
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
436 pst_debug_fwrite(&rec_type, sizeof(char), 1, debug_fp); |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
437 pst_debug_fwrite(&lfile_rec, sizeof(lfile_rec), 1, debug_fp); |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
438 fseeko(debug_fp, 0, SEEK_END); |
16 | 439 } |
440 | |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
441 |
172
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
442 void *pst_malloc(size_t size) { |
46 | 443 void *mem = malloc(size); |
444 if (!mem) { | |
172
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
445 fprintf(stderr, "pst_malloc: Out Of memory [req: %ld]\n", (long)size); |
46 | 446 exit(1); |
447 } | |
448 return mem; | |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
449 } |
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
450 |