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

Side by Side Diff: src/platform-linux.cc

Issue 159538: - getc returns an int. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 void OS::LogSharedLibraryAddresses() { 226 void OS::LogSharedLibraryAddresses() {
227 #ifdef ENABLE_LOGGING_AND_PROFILING 227 #ifdef ENABLE_LOGGING_AND_PROFILING
228 FILE *fp; 228 FILE *fp;
229 fp = fopen("/proc/self/maps", "r"); 229 fp = fopen("/proc/self/maps", "r");
230 if (fp == NULL) return; 230 if (fp == NULL) return;
231 while (true) { 231 while (true) {
232 uintptr_t start, end; 232 uintptr_t start, end;
233 char attr_r, attr_w, attr_x, attr_p; 233 char attr_r, attr_w, attr_x, attr_p;
234 if (fscanf(fp, "%" V8PRIxPTR "-%" V8PRIxPTR, &start, &end) != 2) break; 234 if (fscanf(fp, "%" V8PRIxPTR "-%" V8PRIxPTR, &start, &end) != 2) break;
235 if (fscanf(fp, " %c%c%c%c", &attr_r, &attr_w, &attr_x, &attr_p) != 4) break; 235 if (fscanf(fp, " %c%c%c%c", &attr_r, &attr_w, &attr_x, &attr_p) != 4) break;
236 char c; 236 int c;
237 if (attr_r == 'r' && attr_x == 'x') { 237 if (attr_r == 'r' && attr_x == 'x') {
238 while (c = getc(fp), c != EOF && c != '\n' && c != '/'); 238 while (c = getc(fp), (c != EOF) && (c != '\n') && (c != '/'));
239 char lib_name[1024]; 239 char lib_name[1024];
240 bool lib_has_name = false; 240 bool lib_has_name = false;
241 if (c == '/') { 241 if (c == '/') {
242 ungetc(c, fp); 242 ungetc(c, fp);
243 lib_has_name = fgets(lib_name, sizeof(lib_name), fp) != NULL; 243 lib_has_name = fgets(lib_name, sizeof(lib_name), fp) != NULL;
244 } 244 }
245 if (lib_has_name && strlen(lib_name) > 0) { 245 if (lib_has_name && strlen(lib_name) > 0) {
246 lib_name[strlen(lib_name) - 1] = '\0'; 246 lib_name[strlen(lib_name) - 1] = '\0';
247 } else { 247 } else {
248 snprintf(lib_name, sizeof(lib_name), 248 snprintf(lib_name, sizeof(lib_name),
249 "%08" V8PRIxPTR "-%08" V8PRIxPTR, start, end); 249 "%08" V8PRIxPTR "-%08" V8PRIxPTR, start, end);
250 } 250 }
251 LOG(SharedLibraryEvent(lib_name, start, end)); 251 LOG(SharedLibraryEvent(lib_name, start, end));
252 } 252 }
253 while (c = getc(fp), c != EOF && c != '\n'); 253 while (c = getc(fp), (c != EOF) && (c != '\n'));
254 } 254 }
255 fclose(fp); 255 fclose(fp);
256 #endif 256 #endif
257 } 257 }
258 258
259 259
260 int OS::StackWalk(Vector<OS::StackFrame> frames) { 260 int OS::StackWalk(Vector<OS::StackFrame> frames) {
261 // backtrace is a glibc extension. 261 // backtrace is a glibc extension.
262 #ifdef __GLIBC__ 262 #ifdef __GLIBC__
263 int frames_size = frames.length(); 263 int frames_size = frames.length();
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 } 682 }
683 683
684 // This sampler is no longer the active sampler. 684 // This sampler is no longer the active sampler.
685 active_sampler_ = NULL; 685 active_sampler_ = NULL;
686 active_ = false; 686 active_ = false;
687 } 687 }
688 688
689 #endif // ENABLE_LOGGING_AND_PROFILING 689 #endif // ENABLE_LOGGING_AND_PROFILING
690 690
691 } } // namespace v8::internal 691 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698