| 332 | self.structs = structs |
| 333 | |
| 334 | def parse_expr(self, expr): |
| 335 | stm = BytesIO(bytelist2string(expr)) |
| 336 | parsed = [] |
| 337 | |
| 338 | while True: |
| 339 | # Get the next opcode from the stream. If nothing is left in the |
| 340 | # stream, we're done. |
| 341 | byte = stm.read(1) |
| 342 | if len(byte) == 0: |
| 343 | break |
| 344 | |
| 345 | # Decode the opcode and its name. |
| 346 | op = ord(byte) |
| 347 | op_name = DW_OP_opcode2name.get(op, 'OP:0x%x' % op) |
| 348 | |
| 349 | if op <= 4 or op == 0x80: |
| 350 | args = [struct_parse(self.structs.Dwarf_target_addr(''), stm),] |
| 351 | else: |
| 352 | args = [] |
| 353 | |
| 354 | parsed.append(DWARFExprOp(op=op, op_name=op_name, args=args, offset=stm.tell())) |
| 355 | |
| 356 | return parsed |
| 357 | |
| 358 | |
| 359 | class DWARFInfoV1(object): |