MCPcopy Create free account
hub / github.com/bytedance/android-inline-hook / parse_trace

Function parse_trace

tools/record_parser.py:166–294  ·  view source on GitHub ↗
(trace)

Source from the content-addressed store, hash-verified

164
165
166def parse_trace(trace):
167 global g_more_info
168
169 items = trace.split(";")
170
171 arch = ''
172 hub_addr = ''
173 for item in items:
174 if item.startswith('H|'):
175 hub_addr = item.split("|")[1]
176
177 v = find_val(items, 'S')
178 if v:
179 print(f" * ELF info")
180 print(f" * load bias : 0x{v[0]}")
181 load_bias = int(v[0], 16)
182 for gap in v[1:]:
183 r = gap.split("-")
184 start = load_bias + int(r[0], 16)
185 end = load_bias + int(r[1], 16)
186 print(f" * gap : [{start:#x}, {end:#x}) , [0x{r[0]}, 0x{r[1]}) , size {end - start}")
187 v = find_val(items, 'B')
188 if v:
189 print(f" * hook info")
190 print(f" * arch : {v[0]}")
191 print(f" * op : {v[1]}")
192 arch = v[0]
193 v = find_val(items, 'T')
194 if v:
195 print(f" * target")
196 print(f" * address : 0x{v[0]}")
197 if arch != 'arm64': print(f" * arch : {arch}")
198 print(f" * length : {len(v[1]) // 2}")
199 print(f" * original instr")
200 parse_instr(v[1], v[0], arch)
201 if arch == 'thumb': print(f" * length : {len(v[2]) // 2}")
202 print(f" * new instr")
203 parse_instr(v[2], v[0], arch)
204 v = find_val(items, 'X')
205 if v:
206 print(f" * island exit")
207 print(f" * address : 0x{v[0]}")
208 if arch != 'arm64': print(f" * arch : {arch}")
209 print(f" * type : {parse_memory_type(v[1])}")
210 print(f" * length : {len(v[2]) // 2}")
211 print(f" * instr")
212 parse_instr(v[2], v[0], arch)
213 v = find_val(items, 'N')
214 if v:
215 print(f" * new")
216 print(f" * address : 0x{v[0]}")
217 v = find_val(items, 'L')
218 if v:
219 print(f" * glue launcher")
220 print(f" * address : 0x{v[0]}")
221 if arch != 'arm64': print(f" * arch : arm")
222 print(f" * length : {len(v[1]) // 2}")
223 print(f" * instr")

Callers 1

parse_lineFunction · 0.85

Calls 3

find_valFunction · 0.85
parse_instrFunction · 0.85
parse_memory_typeFunction · 0.85

Tested by

no test coverage detected