OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /// VMOptions=--dwarf-stack-traces | 5 /// VMOptions=--dwarf-stack-traces |
6 | 6 |
7 import 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 | 9 |
10 bar() { | 10 bar() { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 print(result.stdout); | 64 print(result.stdout); |
65 print(result.stderr); | 65 print(result.stderr); |
66 throw "'file' failed"; | 66 throw "'file' failed"; |
67 return; | 67 return; |
68 } | 68 } |
69 if (!result.stdout.contains("shared object")) { | 69 if (!result.stdout.contains("shared object")) { |
70 print("Skipping test because we are not running from a dylib"); | 70 print("Skipping test because we are not running from a dylib"); |
71 return; | 71 return; |
72 } | 72 } |
73 | 73 |
74 var frameRegex = new RegExp("pc ([0-9a-z]+) ([0-9a-zA-Z/\._]+)"); | 74 var frameRegex = new RegExp("pc ([0-9a-z]+) ([0-9a-zA-Z/\._-]+)"); |
75 var symbolizedStack = new StringBuffer(); | 75 var symbolizedStack = new StringBuffer(); |
76 for (var frameMatch in frameRegex.allMatches(rawStack)) { | 76 for (var frameMatch in frameRegex.allMatches(rawStack)) { |
77 var framePC = frameMatch[1]; | 77 var framePC = frameMatch[1]; |
78 var frameDSO = frameMatch[2]; | 78 var frameDSO = frameMatch[2]; |
79 print(framePC); | 79 print(framePC); |
80 print(frameDSO); | 80 print(frameDSO); |
81 result = Process.runSync("addr2line", | 81 result = Process.runSync("addr2line", |
82 ["--exe", frameDSO, | 82 ["--exe", frameDSO, |
83 "--functions", | 83 "--functions", |
84 "--inlines", | 84 "--inlines", |
(...skipping 13 matching lines...) Expand all Loading... |
98 expect(symbolizedStack.toString(), | 98 expect(symbolizedStack.toString(), |
99 stringContainsInOrder(["bar", | 99 stringContainsInOrder(["bar", |
100 "dwarf_stack_trace_test.dart:12", | 100 "dwarf_stack_trace_test.dart:12", |
101 "foo", | 101 "foo", |
102 "dwarf_stack_trace_test.dart:17", | 102 "dwarf_stack_trace_test.dart:17", |
103 "main", | 103 "main", |
104 "dwarf_stack_trace_test.dart:23", | 104 "dwarf_stack_trace_test.dart:23", |
105 "main", // dispatcher | 105 "main", // dispatcher |
106 "dwarf_stack_trace_test.dart:20"])); | 106 "dwarf_stack_trace_test.dart:20"])); |
107 } | 107 } |
OLD | NEW |