Skip to content

Commit 2b5246a

Browse files
author
git apple-llvm automerger
committed
Merge commit '0fb245aa96ea' from apple/stable/20190619 into swift/master
2 parents 0216e23 + 0fb245a commit 2b5246a

File tree

4 files changed

+167
-25
lines changed

4 files changed

+167
-25
lines changed

lldb/examples/python/crashlog.py

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,22 @@ class CrashLog(symbolication.Symbolicator):
101101
thread_regex = re.compile('^Thread ([0-9]+)([^:]*):(.*)')
102102
app_backtrace_regex = re.compile(
103103
'^Application Specific Backtrace ([0-9]+)([^:]*):(.*)')
104-
frame_regex = re.compile('^([0-9]+)\s+(.+?)\s+(0x[0-9a-fA-F]{7}[0-9a-fA-F]+) +(.*)')
105-
null_frame_regex = re.compile('^([0-9]+)\s+\?\?\?\s+(0{7}0+) +(.*)')
106-
image_regex_uuid = re.compile(
107-
'(0x[0-9a-fA-F]+)[-\s]+(0x[0-9a-fA-F]+)\s+[+]?(.+?)\s+(\(.+\))?\s?(<([-0-9a-fA-F]+)>)? (.*)')
104+
version = r'(\(.+\)|(arm|x86_)[0-9a-z]+)\s+'
105+
frame_regex = re.compile(r'^([0-9]+)' r'\s' # id
106+
r'+(.+?)' r'\s+' # img_name
107+
r'(' +version+ r')?' # img_version
108+
r'(0x[0-9a-fA-F]{7}[0-9a-fA-F]+)' # addr
109+
r' +(.*)' # offs
110+
)
111+
null_frame_regex = re.compile(r'^([0-9]+)\s+\?\?\?\s+(0{7}0+) +(.*)')
112+
image_regex_uuid = re.compile(r'(0x[0-9a-fA-F]+)' # img_lo
113+
r'\s+' '-' r'\s+' # -
114+
r'(0x[0-9a-fA-F]+)' r'\s+' # img_hi
115+
r'[+]?(.+?)' r'\s+' # img_name
116+
r'(' +version+ ')?' # img_version
117+
r'(<([-0-9a-fA-F]+)>\s+)?' # img_uuid
118+
r'(/.*)' # img_path
119+
)
108120
empty_line_regex = re.compile('^$')
109121

110122
class Thread:
@@ -489,18 +501,20 @@ def __init__(self, path, verbose):
489501
continue
490502
frame_match = self.frame_regex.search(line)
491503
if frame_match:
492-
ident = frame_match.group(2)
504+
(frame_id, frame_img_name, _, frame_img_version, _,
505+
frame_addr, frame_ofs) = frame_match.groups()
506+
ident = frame_img_name
493507
thread.add_ident(ident)
494508
if ident not in self.idents:
495509
self.idents.append(ident)
496-
thread.frames.append(CrashLog.Frame(int(frame_match.group(1)), int(
497-
frame_match.group(3), 0), frame_match.group(4)))
510+
thread.frames.append(CrashLog.Frame(int(frame_id), int(
511+
frame_addr, 0), frame_ofs))
498512
else:
499513
print('error: frame regex failed for line: "%s"' % line)
500514
elif parse_mode == PARSE_MODE_IMAGES:
501515
image_match = self.image_regex_uuid.search(line)
502516
if image_match:
503-
(img_lo, img_hi, img_name, img_version,
517+
(img_lo, img_hi, img_name, _, img_version, _,
504518
_, img_uuid, img_path) = image_match.groups()
505519
image = CrashLog.DarwinImage(int(img_lo, 0), int(img_hi, 0),
506520
img_name.strip(),

lldb/packages/Python/lldbsuite/test/decorators.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,9 @@ def is_remote():
518518
def skipIfNoSBHeaders(func):
519519
"""Decorate the item to mark tests that should be skipped when LLDB is built with no SB API headers."""
520520
def are_sb_headers_missing():
521+
if lldb.remote_platform:
522+
return "skip because SBHeaders tests make no sense remotely"
523+
521524
if lldbplatformutil.getHostPlatform() == 'darwin':
522525
header = os.path.join(
523526
os.environ["LLDB_LIB_DIR"],
Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,14 @@
1-
CC ?= clang
2-
ifeq "$(ARCH)" ""
3-
ARCH = x86_64
4-
endif
5-
6-
ifeq "$(OS)" ""
7-
OS = $(shell uname -s)
8-
endif
1+
C_SOURCES = main.c
92

10-
CFLAGS ?= -g -O0
3+
include Makefile.rules
114

12-
ifeq "$(OS)" "Darwin"
13-
CFLAGS += -arch $(ARCH)
14-
endif
5+
all: a.out.dSYM hide.app/Contents/a.out.dSYM
156

16-
all: main.c clean
7+
hide.app/Contents/a.out.dSYM:
178
mkdir hide.app
189
mkdir hide.app/Contents
19-
$(CC) $(CFLAGS) -g $<
2010
mv a.out.dSYM hide.app/Contents
2111
strip -x a.out
22-
23-
clean:
24-
rm -rf a.out a.out.dSYM hide.app
12+
ifneq "$(CODESIGN)" ""
13+
$(CODESIGN) -fs - a.out
14+
endif

lldb/test/Shell/Python/crashlog.test

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# -*- python -*-
2+
# REQUIRES: system-darwin
3+
# DEBUG: cd %S/../../../examples/python && cat %s | %lldb && false
4+
# RUN: cd %S/../../../examples/python && cat %s | %lldb | FileCheck %s
5+
# CHECK-LABEL: {{S}}KIP BEYOND CHECKS
6+
script
7+
import crashlog
8+
cl = crashlog.CrashLog
9+
images = [
10+
"0x10b60b000 - 0x10f707fff com.apple.LLDB.framework (1.1000.11.38.2 - 1000.11.38.2) <96E36F5C-1A83-39A1-8713-5FDD9701C3F1> /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/LLDB",
11+
# CHECK: 0x10b60b000
12+
# CHECK: 0x10f707fff
13+
# CHECK: com.apple.LLDB.framework
14+
# CHECK: 96E36F5C-1A83-39A1-8713-5FDD9701C3F1
15+
# CHECK: /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/LLDB
16+
17+
"0x104591000 - 0x1055cfff7 +llvm-dwarfdump (0) <B104CFA1-046A-36A6-8EB4-07DDD7CC2DF3> /Users/USER 1/Documents/*/llvm-dwarfdump",
18+
# CHECK: 0x104591000
19+
# CHECK: 0x1055cfff7
20+
# CHECK: llvm-dwarfdump
21+
# CHECK: (0)
22+
# CHECK: B104CFA1-046A-36A6-8EB4-07DDD7CC2DF3
23+
# CHECK: /Users/USER 1/Documents/*/llvm-dwarfdump
24+
25+
"0x7fff63f20000 - 0x7fff63f77ff7 libc++.1.dylib (400.9.4) <D4AB366F-48A9-3C7D-91BD-41198F69DD57> /usr/lib/libc++.1.dylib",
26+
# CHECK: 0x7fff63f20000
27+
# CHECK: 0x7fff63f77ff7
28+
# CHECK: libc++.1.dylib
29+
# CHECK: (400.9.4)
30+
# CHECK: D4AB366F-48A9-3C7D-91BD-41198F69DD57
31+
# CHECK: /usr/lib/libc++.1.dylib
32+
33+
"0x1111111 - 0x22222 +MyApp Pro arm64 <01234> /tmp/MyApp Pro.app/MyApp Pro",
34+
# CHECK: 0x1111111
35+
# CHECK: 0x22222
36+
# CHECK: MyApp Pro
37+
# CHECK: arm64
38+
# CHECK: 01234
39+
# CHECK: /tmp/MyApp Pro.app/MyApp Pro
40+
41+
"0x1111111 - 0x22222 +MyApp Pro (0) <01234> /tmp/MyApp Pro.app/MyApp Pro",
42+
# CHECK: 0x1111111
43+
# CHECK: 0x22222
44+
# CHECK: MyApp Pro
45+
# CHECK: (0)
46+
# CHECK: 01234
47+
# CHECK: /tmp/MyApp Pro.app/MyApp Pro
48+
49+
"0x1111111 - 0x2222222 MyFramework Plus.dylib (1.11 - MyFramework 1.11) <01234> /tmp/MyFramework Plus.dylib",
50+
# CHECK: 0x1111111
51+
# CHECK: 0x2222222
52+
# CHECK: MyFramework Plus.dylib
53+
# CHECK: ({{.*}}
54+
# CHECK: 1.11 - MyFramework 1.11
55+
# CHECK: <{{.*}}
56+
# CHECK: 01234
57+
# CHECK: /tmp/MyFramework Plus.dylib
58+
59+
"0x1111111 - 0x2222222 MyFramework-dev.dylib (1.0.0svn - 1.0.0svn) <01234> /MyFramework-dev.dylib",
60+
# CHECK: 0x1111111
61+
# CHECK: 0x2222222
62+
# CHECK: MyFramework-dev.dylib
63+
# CHECK: ({{.*}}
64+
# CHECK: 1.0.0svn - 1.0.0svn
65+
# CHECK: <{{.*}}
66+
# CHECK: 01234
67+
# CHECK: /MyFramework-dev.dylib
68+
69+
"0x7fff63f20000 - 0x7fff63f77ff7 libc++.1.dylib (400.9.4) /usr/lib/libc++.1.dylib",
70+
# CHECK: 0x7fff63f20000
71+
# CHECK: 0x7fff63f77ff7
72+
# CHECK: libc++.1.dylib
73+
# CHECK: ({{.*}}
74+
# CHECK: 400.9.4
75+
# CHECK: None
76+
# CHECK: None
77+
# CHECK: /usr/lib/libc++.1.dylib
78+
79+
"0x1047b8000 - 0x10481ffff dyld arm64e <cfa789d10da63f9a8996daf84ed9d04f> /usr/lib/dyld"
80+
# CHECK: 0x1047b8000
81+
# CHECK: 0x10481ffff
82+
# CHECK: dyld
83+
# CHECK: {{.*}}
84+
# CHECK: arm64e
85+
# CHECK: <{{.*}}
86+
# CHECK: cfa789d10da63f9a8996daf84ed9d04f
87+
# CHECK: /usr/lib/dyld
88+
]
89+
# CHECK-LABEL: FRAMES
90+
frames = [
91+
"0 libsystem_kernel.dylib 0x00007fff684b78a6 read + 10",
92+
# CHECK: 0
93+
# CHECK: libsystem_kernel.dylib
94+
# CHECK: 0x00007fff684b78a6
95+
# CHECK: read + 10
96+
"1 com.apple.LLDB.framework 0x000000010f7954af lldb_private::HostNativeThreadBase::ThreadCreateTrampoline(void*) + 105",
97+
# CHECK: 1
98+
# CHECK: com.apple.LLDB.framework
99+
# CHECK: 0x000000010f7954af
100+
# CHECK: lldb_private{{.*}} + 105
101+
"2 MyApp Pro arm64 0x000000019b0db3a8 foo + 72",
102+
# CHECK: 2
103+
# CHECK: MyApp Pro
104+
# CHECK: a
105+
# CHECK: arm64
106+
# CHECK: a
107+
# CHECK: 0x000000019b0db3a8
108+
# CHECK: foo + 72
109+
"3 He 0x1 0x000000019b0db3a8 foo + 72"
110+
# CHECK: 3
111+
# CHECK: He 0x1
112+
# CHECK: 0x000000019b0db3a8
113+
# CHECK: foo + 72
114+
]
115+
116+
117+
# Avoid matching the text inside the input.
118+
print("SKIP BEYOND CHECKS")
119+
for image in images:
120+
print('"%s"'%image)
121+
print("--------------")
122+
match = cl.image_regex_uuid.search(image)
123+
for group in match.groups():
124+
print(group)
125+
126+
print("FRAMES")
127+
for frame in frames:
128+
print('"%s"'%frame)
129+
print("--------------")
130+
match = cl.frame_regex.search(frame)
131+
for group in match.groups():
132+
print(group)
133+
134+
exit()
135+
quit

0 commit comments

Comments
 (0)