MCPcopy Index your code
hub / github.com/encounter/objdiff / get_string_data

Function get_string_data

objdiff-core/src/arch/ppc/flow_analysis.rs:518–530  ·  view source on GitHub ↗

Note: This function only supports MWCC ASCII strings. Other encodings and other compilers are currently not supported.

(obj: &Object, symbol_index: usize, offset: Simm)

Source from the content-addressed store, hash-verified

516// Note: This function only supports MWCC ASCII strings.
517// Other encodings and other compilers are currently not supported.
518fn get_string_data(obj: &Object, symbol_index: usize, offset: Simm) -> Option<&str> {
519 if let Some(sym) = obj.symbols.get(symbol_index)
520 && sym.name.starts_with("@stringBase")
521 && offset.0 != 0
522 && let Some(data) = obj.symbol_data(symbol_index)
523 {
524 let bytes = &data[offset.0 as usize..];
525 if let Ok(Ok(str)) = CStr::from_bytes_until_nul(bytes).map(|x| x.to_str()) {
526 return Some(str);
527 }
528 }
529 None
530}
531
532// Write the relevant part of the flow analysis out into the FlowAnalysisResult
533// the rest of the application will use to query results of the flow analysis.

Callers 1

Calls 2

getMethod · 0.80
symbol_dataMethod · 0.80

Tested by

no test coverage detected