Commit 2916249
committed
[lldb][Mach-O] Handle shared cache binaries correctly (llvm#117832)
The Mach-O load commands have an LC_SYMTAB / struct symtab_command which
represents the offset of the symbol table (nlist records) and string
table for this binary. In a mach-o binary on disk, these are file
offsets. If a mach-o binary is loaded in memory with all segments
consecutive, the `symoff` and `stroff` are the offsets from the TEXT
segment (aka the mach-o header) virtual address to the virtual address
of the start of these tables.
However, if a Mach-O binary is a part of the shared cache, then the
segments will be separated -- they will have different slide values. And
it is possible for the LINKEDIT segment to be greater than 4GB away from
the TEXT segment in the virtual address space, so these 32-bit offsets
cannot express the offset from TEXT segment to these tables.
Create separate uint64_t variables to track the offset to the symbol
table and string table, instead of reusing the 32-bit ones in the
symtab_command structure.
rdar://140432279
(cherry picked from commit 448ac7d)1 parent 510f9bb commit 2916249
File tree
2 files changed
+26
-5
lines changed- lldb/source/Plugins/ObjectFile/Mach-O
2 files changed
+26
-5
lines changedLines changed: 13 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2243 | 2243 | | |
2244 | 2244 | | |
2245 | 2245 | | |
2246 | | - | |
2247 | 2246 | | |
2248 | 2247 | | |
2249 | 2248 | | |
2250 | 2249 | | |
| 2250 | + | |
2251 | 2251 | | |
2252 | 2252 | | |
2253 | 2253 | | |
| |||
2284 | 2284 | | |
2285 | 2285 | | |
2286 | 2286 | | |
| 2287 | + | |
| 2288 | + | |
| 2289 | + | |
| 2290 | + | |
| 2291 | + | |
| 2292 | + | |
| 2293 | + | |
| 2294 | + | |
2287 | 2295 | | |
2288 | 2296 | | |
2289 | | - | |
2290 | | - | |
2291 | | - | |
2292 | | - | |
| 2297 | + | |
| 2298 | + | |
| 2299 | + | |
| 2300 | + | |
2293 | 2301 | | |
2294 | 2302 | | |
2295 | 2303 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
256 | 256 | | |
257 | 257 | | |
258 | 258 | | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
259 | 272 | | |
260 | 273 | | |
261 | 274 | | |
| |||
0 commit comments