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

Side by Side Diff: tests/standalone/dwarf_stack_trace_test.dart

Issue 2762313003: Dwarf tools interpret line number table pc's as start boundries instead of end boundries. (Closed)
Patch Set: test Created 3 years, 9 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
« no previous file with comments | « runtime/vm/object.cc ('k') | 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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 /// VMOptions=--dwarf-stack-traces
6
7 import 'package:unittest/unittest.dart';
8 import 'dart:io';
9
10 bar() {
11 // Keep the 'throw' and its argument on separate lines.
12 throw
13 "Hello, Dwarf!";
14 }
15
16 foo() {
17 bar();
18 }
19
20 main() {
21 String rawStack;
22 try {
23 foo();
24 } catch (e, st) {
25 rawStack = st.toString();
26 }
27 print(rawStack);
28
29 if (Platform.isAndroid) {
30 // Attempts to execute 'file' etc fail with security exceptions on
31 // Android.
32 print("Skipping test on Android");
33 return;
34 }
35
36 ProcessResult result = Process.runSync("file", ["--version"]);
37 if (result.exitCode != 0) {
38 print("Skipping test because 'file' is not present");
Cutch 2017/03/22 14:04:37 you should fail here and update the status file ac
39 return;
40 }
41
42 result = Process.runSync("addr2line", ["--version"]);
43 if (result.exitCode != 0) {
44 print("Skipping test because 'addr2line' is not present");
Cutch 2017/03/22 14:04:37 you should fail here and update the status file ac
45 return;
46 }
47
48 result = Process.runSync("file", [Platform.script.toFilePath()]);
49 if (result.exitCode != 0) {
50 print(result.stdout);
51 print(result.stderr);
52 throw "'file' failed";
53 return;
54 }
55 if (!result.stdout.contains("shared object")) {
56 print("Skipping test because we are not running from a dylib");
Cutch 2017/03/22 14:04:37 you should fail here and update the status file ac
57 return;
58 }
59
60 var frameRegex = new RegExp("pc ([0-9a-z]+) ([0-9a-zA-Z/\._]+)");
61 var symbolizedStack = new StringBuffer();
62 for (var frameMatch in frameRegex.allMatches(rawStack)) {
63 var framePC = frameMatch[1];
64 var frameDSO = frameMatch[2];
65 print(framePC);
66 print(frameDSO);
67 result = Process.runSync("addr2line",
68 ["--exe", frameDSO,
69 "--functions",
70 "--inlines",
71 framePC]);
72 if (result.exitCode != 0) {
73 print(result.stdout);
74 print(result.stderr);
75 throw "'addr2line' failed";
76 }
77 print(result.stdout);
78 symbolizedStack.write(result.stdout);
79 }
80
81 print(symbolizedStack);
82 var symbolizedLines = symbolizedStack.toString().split("\n");
Cutch 2017/03/22 14:04:37 use stringContainsInOrder expect(symbolizedStack.
rmacnak 2017/03/22 17:28:15 Done.
83 expect(symbolizedLines.length, greaterThan(8));
84 expect(symbolizedLines[0], equals("bar"));
85 expect(symbolizedLines[1], endsWith("dwarf_stack_trace_test.dart:12"));
86 expect(symbolizedLines[2], equals("foo"));
87 expect(symbolizedLines[3], endsWith("dwarf_stack_trace_test.dart:17"));
88 expect(symbolizedLines[4], equals("main"));
89 expect(symbolizedLines[5], endsWith("dwarf_stack_trace_test.dart:23"));
90 expect(symbolizedLines[6], equals("main")); // dispatcher
91 expect(symbolizedLines[7], endsWith("dwarf_stack_trace_test.dart:20"));
92 }
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698