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

Side by Side Diff: third_party/tcmalloc/chromium/src/windows/nm-pdb.c

Issue 9320005: [NOT TO COMMIT!] Replace third_party/tcmalloc/chromium with tcmalloc r136 (the latest). (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 8 years, 10 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 /* Copyright (c) 2008, Google Inc. 1 /* Copyright (c) 2008, Google Inc.
2 * All rights reserved. 2 * All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 #endif 173 #endif
174 174
175 /* Contents */ 175 /* Contents */
176 #ifdef VC8_OR_ABOVE /* TODO(csilvers): figure out how to tell */ 176 #ifdef VC8_OR_ABOVE /* TODO(csilvers): figure out how to tell */
177 PrintAvailability("Line numbers", module_info.LineNumbers); 177 PrintAvailability("Line numbers", module_info.LineNumbers);
178 PrintAvailability("Global symbols", module_info.GlobalSymbols); 178 PrintAvailability("Global symbols", module_info.GlobalSymbols);
179 PrintAvailability("Type information", module_info.TypeInfo); 179 PrintAvailability("Type information", module_info.TypeInfo);
180 #endif 180 #endif
181 } 181 }
182 182
183 void usage() {
184 fprintf(stderr, "usage: nm-pdb [-C|--demangle] <module or filename>\n");
185 }
186
183 int main(int argc, char *argv[]) { 187 int main(int argc, char *argv[]) {
184 DWORD error; 188 DWORD error;
185 HANDLE process; 189 HANDLE process;
186 ULONG64 module_base; 190 ULONG64 module_base;
187 SYM_CONTEXT ctx; 191 SYM_CONTEXT ctx;
188 int i; 192 int i;
189 char* search; 193 char* search;
190 char* filename = NULL; 194 char* filename = NULL;
191 int rv = 0; 195 int rv = 0;
192 /* We may add SYMOPT_UNDNAME if --demangle is specified: */ 196 /* We may add SYMOPT_UNDNAME if --demangle is specified: */
193 DWORD symopts = SYMOPT_DEFERRED_LOADS | SYMOPT_DEBUG; 197 DWORD symopts = SYMOPT_DEFERRED_LOADS | SYMOPT_DEBUG;
194 198
195 for (i = 1; i < argc; i++) { 199 for (i = 1; i < argc; i++) {
196 if (strcmp(argv[i], "--demangle") == 0 || strcmp(argv[i], "-C") == 0) { 200 if (strcmp(argv[i], "--demangle") == 0 || strcmp(argv[i], "-C") == 0) {
197 symopts |= SYMOPT_UNDNAME; 201 symopts |= SYMOPT_UNDNAME;
202 } else if (strcmp(argv[i], "--help") == 0) {
203 usage();
204 exit(0);
198 } else { 205 } else {
199 break; 206 break;
200 } 207 }
201 } 208 }
202 if (i != argc - 1) { 209 if (i != argc - 1) {
203 fprintf(stderr, "usage: nm-pdb [-C|--demangle] <module or filename>\n"); 210 usage();
204 exit(1); 211 exit(1);
205 } 212 }
206 filename = argv[i]; 213 filename = argv[i];
207 214
208 process = GetCurrentProcess(); 215 process = GetCurrentProcess();
209 216
210 if (!SymInitialize(process, NULL, FALSE)) { 217 if (!SymInitialize(process, NULL, FALSE)) {
211 error = GetLastError(); 218 error = GetLastError();
212 fprintf(stderr, "SymInitialize returned error : %d\n", error); 219 fprintf(stderr, "SymInitialize returned error : %d\n", error);
213 return 1; 220 return 1;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 qsort(ctx.syms, ctx.syms_len, sizeof(ctx.syms[0]), sym_cmp); 264 qsort(ctx.syms, ctx.syms_len, sizeof(ctx.syms[0]), sym_cmp);
258 for (j = 0; j < ctx.syms_len; j++) { 265 for (j = 0; j < ctx.syms_len; j++) {
259 printf("%016I64x X %s\n", ctx.syms[j].addr, ctx.syms[j].name); 266 printf("%016I64x X %s\n", ctx.syms[j].addr, ctx.syms[j].name);
260 } 267 }
261 /* In a perfect world, maybe we'd clean up ctx's memory? */ 268 /* In a perfect world, maybe we'd clean up ctx's memory? */
262 } 269 }
263 SymUnloadModule64(process, module_base); 270 SymUnloadModule64(process, module_base);
264 SymCleanup(process); 271 SymCleanup(process);
265 return rv; 272 return rv;
266 } 273 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698