mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-26 03:38:25 +08:00
firmware: fix crash on exception with host message (#2017)
This commit is contained in:
parent
3c7a394eff
commit
454ae39c5d
@ -452,18 +452,22 @@ fn process_kern_message(io: &Io, aux_mutex: &Mutex,
|
|||||||
let exceptions_with_channel: Vec<Option<eh::eh_artiq::Exception>> = exceptions.iter()
|
let exceptions_with_channel: Vec<Option<eh::eh_artiq::Exception>> = exceptions.iter()
|
||||||
.map(|exception| {
|
.map(|exception| {
|
||||||
if let Some(exn) = exception {
|
if let Some(exn) = exception {
|
||||||
let msg = str::from_utf8(unsafe{slice::from_raw_parts(exn.message.as_ptr(), exn.message.len())})
|
if exn.message.len() == usize::MAX { // host string
|
||||||
.unwrap()
|
Some(exn.clone())
|
||||||
.replace("{rtio_channel_info:0}", &format!("{}:{}", exn.param[0], resolve_channel_name(exn.param[0] as u32)));
|
} else {
|
||||||
Some(eh::eh_artiq::Exception {
|
let msg = str::from_utf8(unsafe { slice::from_raw_parts(exn.message.as_ptr(), exn.message.len()) })
|
||||||
id: exn.id,
|
.unwrap()
|
||||||
file: exn.file,
|
.replace("{rtio_channel_info:0}", &format!("{}:{}", exn.param[0], resolve_channel_name(exn.param[0] as u32)));
|
||||||
line: exn.line,
|
Some(eh::eh_artiq::Exception {
|
||||||
column: exn.column,
|
id: exn.id,
|
||||||
function: exn.function,
|
file: exn.file,
|
||||||
message: unsafe {CSlice::new(msg.as_ptr(), msg.len())},
|
line: exn.line,
|
||||||
param: exn.param
|
column: exn.column,
|
||||||
})
|
function: exn.function,
|
||||||
|
message: unsafe { CSlice::new(msg.as_ptr(), msg.len()) },
|
||||||
|
param: exn.param,
|
||||||
|
})
|
||||||
|
}
|
||||||
} else { None }
|
} else { None }
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
Loading…
Reference in New Issue
Block a user