-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Linkle's DWARF implementation for target_env = "devkita64" (#361
) * Disable libbacktrace on DevkitA64 * Force noop symbolizer on DevkitA64 (for now) * Add support for linkle's DWARF format to gimli symbolizer * fmt * Address review * Subtract bias from len, revert back to wrapping_add * Use Vec::with_capacity in mmap_fake * fmt
- Loading branch information
Showing
2 changed files
with
67 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use super::{mystd::io::Read, File}; | ||
use alloc::vec::Vec; | ||
use core::ops::Deref; | ||
|
||
pub struct Mmap { | ||
vec: Vec<u8>, | ||
} | ||
|
||
impl Mmap { | ||
pub unsafe fn map(mut file: &File, len: usize) -> Option<Mmap> { | ||
let mut mmap = Mmap { | ||
vec: Vec::with_capacity(len), | ||
}; | ||
file.read_to_end(&mut mmap.vec).ok()?; | ||
Some(mmap) | ||
} | ||
} | ||
|
||
impl Deref for Mmap { | ||
type Target = [u8]; | ||
|
||
fn deref(&self) -> &[u8] { | ||
&self.vec[..] | ||
} | ||
} |