(module, export_map, section_name)
| 195 | |
| 196 | |
| 197 | def get_section_strings(module, export_map, section_name): |
| 198 | start_name = f'__start_{section_name}' |
| 199 | stop_name = f'__stop_{section_name}' |
| 200 | if start_name not in export_map or stop_name not in export_map: |
| 201 | logger.debug(f'no start/stop symbols found for section: {section_name}') |
| 202 | return {} |
| 203 | |
| 204 | start = export_map[start_name] |
| 205 | end = export_map[stop_name] |
| 206 | start_global = module.get_global(start.index) |
| 207 | end_global = module.get_global(end.index) |
| 208 | start_addr = to_unsigned(get_global_value(start_global)) |
| 209 | end_addr = to_unsigned(get_global_value(end_global)) |
| 210 | |
| 211 | seg = find_segment_with_address(module, start_addr) |
| 212 | if not seg: |
| 213 | exit_with_error(f'unable to find segment starting at __start_{section_name}: {start_addr}') |
| 214 | seg, seg_offset = seg |
| 215 | |
| 216 | asm_strings = {} |
| 217 | str_start = seg_offset |
| 218 | data = module.read_at(seg.offset, seg.size) |
| 219 | size = end_addr - start_addr |
| 220 | end = seg_offset + size |
| 221 | while str_start < end: |
| 222 | str_end = data.find(b'\0', str_start) |
| 223 | asm_strings[start_addr - seg_offset + str_start] = data_to_string(data[str_start:str_end]) |
| 224 | str_start = str_end + 1 |
| 225 | return asm_strings |
| 226 | |
| 227 | |
| 228 | def get_main_reads_params(module, export_map): |
no test coverage detected