Skip to content

Commit 9513a4b

Browse files
debuginfo: Try to get minimal version of LLDB autotest framework running without crash with old LLDB version: Apply workaround for archive loading crash in LLDB, improve breakpoint listener timeout handling, reactivate breakpoint reaction
1 parent f693f26 commit 9513a4b

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

src/etc/lldb_batchmode.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ def execute_command(command_interpreter, command):
8282
if res.HasResult():
8383
print(normalize_whitespace(res.GetOutput()), end = '\n')
8484

85-
time.sleep(0.2)
86-
8785
# If the command introduced any breakpoints, make sure to register them with the breakpoint
8886
# callback
8987
while len(new_breakpoints) > 0:
@@ -114,18 +112,18 @@ def start_breakpoint_listener(target):
114112
def listen():
115113
print_debug("Started listening...")
116114
event = lldb.SBEvent()
117-
wait_count = 0
115+
listening_start_time_secs = time.clock()
116+
MAX_LISTENING_TIME_SECS = 10
118117
try:
119-
while wait_count < 5:
118+
while time.clock() < (listening_start_time_secs + MAX_LISTENING_TIME_SECS):
120119
if listener.WaitForEvent(1, event):
121120
if lldb.SBBreakpoint.EventIsBreakpointEvent(event) and \
122121
lldb.SBBreakpoint.GetBreakpointEventTypeFromEvent(event) == \
123122
lldb.eBreakpointEventTypeAdded:
124123
global new_breakpoints
125124
breakpoint = lldb.SBBreakpoint.GetBreakpointFromEvent(event)
126125
print_debug("breakpoint added (not really...), id = " + str(breakpoint.id))
127-
# new_breakpoints.append(breakpoint.id)
128-
wait_count += 1
126+
new_breakpoints.append(breakpoint.id)
129127
except:
130128
print_debug("breakpoint listener shutting down")
131129

src/librustc/back/link.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,10 +1055,21 @@ fn link_rlib<'a>(sess: &'a Session,
10551055
let bc_deflated = obj_filename.with_extension("bytecode.deflate");
10561056
match fs::File::open(&bc).read_to_end().and_then(|data| {
10571057
fs::File::create(&bc_deflated)
1058-
.write(match flate::deflate_bytes(data.as_slice()) {
1059-
Some(compressed) => compressed,
1060-
None => sess.fatal("failed to compress bytecode")
1061-
}.as_slice())
1058+
.write({
1059+
let compressed = match flate::deflate_bytes(data.as_slice()) {
1060+
Some(compressed) => compressed,
1061+
None => sess.fatal("failed to compress bytecode")
1062+
};
1063+
1064+
let mut data_copy: Vec<u8> = Vec::with_capacity(compressed.as_slice().len() + 1);
1065+
data_copy.push_all(compressed.as_slice());
1066+
1067+
if compressed.as_slice().len() % 2 != 0 {
1068+
data_copy.push(0u8);
1069+
}
1070+
1071+
data_copy
1072+
}.as_slice())
10621073
}) {
10631074
Ok(()) => {}
10641075
Err(e) => {

0 commit comments

Comments
 (0)