(entries)
| 179 | |
| 180 | |
| 181 | def remove_dead_entries(entries): |
| 182 | # Remove entries for dead functions. It is a heuristics to ignore data if the |
| 183 | # function starting address near to 0 (is equal to its size field length). |
| 184 | block_start = 0 |
| 185 | cur_entry = 0 |
| 186 | while cur_entry < len(entries): |
| 187 | if not entries[cur_entry]['eos']: |
| 188 | cur_entry += 1 |
| 189 | continue |
| 190 | fn_start = entries[block_start]['address'] |
| 191 | # Calculate the LEB encoded function size (including size field) |
| 192 | fn_size_length = floor(log(entries[cur_entry]['address'] - fn_start + 1, 128)) + 1 |
| 193 | min_live_offset = 1 + fn_size_length # 1 byte is for code section entries |
| 194 | if fn_start < min_live_offset: |
| 195 | # Remove dead code debug info block. |
| 196 | del entries[block_start:cur_entry + 1] |
| 197 | cur_entry = block_start |
| 198 | continue |
| 199 | cur_entry += 1 |
| 200 | block_start = cur_entry |
| 201 | |
| 202 | |
| 203 | # Given a string that has non-ASCII UTF-8 bytes 128-255 stored as octal sequences (\200 - \377), decode |
no test coverage detected