OLD | NEW |
1 // Copyright (c) 2010 Google Inc. | 1 // Copyright (c) 2010 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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 BasicSourceLineResolver::Function* | 293 BasicSourceLineResolver::Function* |
294 BasicSourceLineResolver::Module::ParseFunction(char *function_line) { | 294 BasicSourceLineResolver::Module::ParseFunction(char *function_line) { |
295 // FUNC <address> <size> <stack_param_size> <name> | 295 // FUNC <address> <size> <stack_param_size> <name> |
296 function_line += 5; // skip prefix | 296 function_line += 5; // skip prefix |
297 | 297 |
298 vector<char*> tokens; | 298 vector<char*> tokens; |
299 if (!Tokenize(function_line, kWhitespace, 4, &tokens)) { | 299 if (!Tokenize(function_line, kWhitespace, 4, &tokens)) { |
300 return NULL; | 300 return NULL; |
301 } | 301 } |
302 | 302 |
303 u_int64_t address = strtoull(tokens[0], NULL, 16); | 303 uint64_t address = strtoull(tokens[0], NULL, 16); |
304 u_int64_t size = strtoull(tokens[1], NULL, 16); | 304 uint64_t size = strtoull(tokens[1], NULL, 16); |
305 int stack_param_size = strtoull(tokens[2], NULL, 16); | 305 int stack_param_size = strtoull(tokens[2], NULL, 16); |
306 char *name = tokens[3]; | 306 char *name = tokens[3]; |
307 | 307 |
308 return new Function(name, address, size, stack_param_size); | 308 return new Function(name, address, size, stack_param_size); |
309 } | 309 } |
310 | 310 |
311 BasicSourceLineResolver::Line* BasicSourceLineResolver::Module::ParseLine( | 311 BasicSourceLineResolver::Line* BasicSourceLineResolver::Module::ParseLine( |
312 char *line_line) { | 312 char *line_line) { |
313 // <address> <line number> <source file id> | 313 // <address> <line number> <source file id> |
314 vector<char*> tokens; | 314 vector<char*> tokens; |
315 if (!Tokenize(line_line, kWhitespace, 4, &tokens)) { | 315 if (!Tokenize(line_line, kWhitespace, 4, &tokens)) { |
316 return NULL; | 316 return NULL; |
317 } | 317 } |
318 | 318 |
319 u_int64_t address = strtoull(tokens[0], NULL, 16); | 319 uint64_t address = strtoull(tokens[0], NULL, 16); |
320 u_int64_t size = strtoull(tokens[1], NULL, 16); | 320 uint64_t size = strtoull(tokens[1], NULL, 16); |
321 int line_number = atoi(tokens[2]); | 321 int line_number = atoi(tokens[2]); |
322 int source_file = atoi(tokens[3]); | 322 int source_file = atoi(tokens[3]); |
323 if (line_number <= 0) { | 323 if (line_number <= 0) { |
324 return NULL; | 324 return NULL; |
325 } | 325 } |
326 | 326 |
327 return new Line(address, size, source_file, line_number); | 327 return new Line(address, size, source_file, line_number); |
328 } | 328 } |
329 | 329 |
330 bool BasicSourceLineResolver::Module::ParsePublicSymbol(char *public_line) { | 330 bool BasicSourceLineResolver::Module::ParsePublicSymbol(char *public_line) { |
331 // PUBLIC <address> <stack_param_size> <name> | 331 // PUBLIC <address> <stack_param_size> <name> |
332 | 332 |
333 // Skip "PUBLIC " prefix. | 333 // Skip "PUBLIC " prefix. |
334 public_line += 7; | 334 public_line += 7; |
335 | 335 |
336 vector<char*> tokens; | 336 vector<char*> tokens; |
337 if (!Tokenize(public_line, kWhitespace, 3, &tokens)) { | 337 if (!Tokenize(public_line, kWhitespace, 3, &tokens)) { |
338 return false; | 338 return false; |
339 } | 339 } |
340 | 340 |
341 u_int64_t address = strtoull(tokens[0], NULL, 16); | 341 uint64_t address = strtoull(tokens[0], NULL, 16); |
342 int stack_param_size = strtoull(tokens[1], NULL, 16); | 342 int stack_param_size = strtoull(tokens[1], NULL, 16); |
343 char *name = tokens[2]; | 343 char *name = tokens[2]; |
344 | 344 |
345 // A few public symbols show up with an address of 0. This has been seen | 345 // A few public symbols show up with an address of 0. This has been seen |
346 // in the dumped output of ntdll.pdb for symbols such as _CIlog, _CIpow, | 346 // in the dumped output of ntdll.pdb for symbols such as _CIlog, _CIpow, |
347 // RtlDescribeChunkLZNT1, and RtlReserveChunkLZNT1. They would conflict | 347 // RtlDescribeChunkLZNT1, and RtlReserveChunkLZNT1. They would conflict |
348 // with one another if they were allowed into the public_symbols_ map, | 348 // with one another if they were allowed into the public_symbols_ map, |
349 // but since the address is obviously invalid, gracefully accept them | 349 // but since the address is obviously invalid, gracefully accept them |
350 // as input without putting them into the map. | 350 // as input without putting them into the map. |
351 if (address == 0) { | 351 if (address == 0) { |
(...skipping 14 matching lines...) Expand all Loading... |
366 while (*stack_info_line == ' ') | 366 while (*stack_info_line == ' ') |
367 stack_info_line++; | 367 stack_info_line++; |
368 const char *platform = stack_info_line; | 368 const char *platform = stack_info_line; |
369 while (!strchr(kWhitespace, *stack_info_line)) | 369 while (!strchr(kWhitespace, *stack_info_line)) |
370 stack_info_line++; | 370 stack_info_line++; |
371 *stack_info_line++ = '\0'; | 371 *stack_info_line++ = '\0'; |
372 | 372 |
373 // MSVC stack frame info. | 373 // MSVC stack frame info. |
374 if (strcmp(platform, "WIN") == 0) { | 374 if (strcmp(platform, "WIN") == 0) { |
375 int type = 0; | 375 int type = 0; |
376 u_int64_t rva, code_size; | 376 uint64_t rva, code_size; |
377 linked_ptr<WindowsFrameInfo> | 377 linked_ptr<WindowsFrameInfo> |
378 stack_frame_info(WindowsFrameInfo::ParseFromString(stack_info_line, | 378 stack_frame_info(WindowsFrameInfo::ParseFromString(stack_info_line, |
379 type, | 379 type, |
380 rva, | 380 rva, |
381 code_size)); | 381 code_size)); |
382 if (stack_frame_info == NULL) | 382 if (stack_frame_info == NULL) |
383 return false; | 383 return false; |
384 | 384 |
385 // TODO(mmentovai): I wanted to use StoreRange's return value as this | 385 // TODO(mmentovai): I wanted to use StoreRange's return value as this |
386 // method's return value, but MSVC infrequently outputs stack info that | 386 // method's return value, but MSVC infrequently outputs stack info that |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 // This record has the form "STACK <address> <rules...>". | 442 // This record has the form "STACK <address> <rules...>". |
443 char *address_field = init_or_address; | 443 char *address_field = init_or_address; |
444 char *delta_rules = strtok_r(NULL, "\r\n", &cursor); | 444 char *delta_rules = strtok_r(NULL, "\r\n", &cursor); |
445 if (!delta_rules) return false; | 445 if (!delta_rules) return false; |
446 MemAddr address = strtoul(address_field, NULL, 16); | 446 MemAddr address = strtoul(address_field, NULL, 16); |
447 cfi_delta_rules_[address] = delta_rules; | 447 cfi_delta_rules_[address] = delta_rules; |
448 return true; | 448 return true; |
449 } | 449 } |
450 | 450 |
451 } // namespace google_breakpad | 451 } // namespace google_breakpad |
OLD | NEW |