* Build the trampoline bytes. */
| 745 | * Build the trampoline bytes. |
| 746 | */ |
| 747 | static void buildBytes(const Binary *B, const Trampoline *T, const Instr *I, |
| 748 | intptr_t addr, bool last, const BreakInfo &breaks, const LabelSet &labels, |
| 749 | Buffer &buf) |
| 750 | { |
| 751 | for (unsigned i = 0; i < T->num_entries; i++) |
| 752 | { |
| 753 | const Entry &entry = T->entries[i]; |
| 754 | switch (entry.kind) |
| 755 | { |
| 756 | case ENTRY_DEBUG: |
| 757 | if (I != nullptr && I->debug) |
| 758 | buf.push(/*int3=*/0xcc); |
| 759 | continue; |
| 760 | case ENTRY_BYTES: |
| 761 | buf.push(entry.bytes, entry.length); |
| 762 | continue; |
| 763 | case ENTRY_ZEROES: |
| 764 | for (unsigned i = 0; i < entry.length; i++) |
| 765 | buf.push(0x0); |
| 766 | continue; |
| 767 | case ENTRY_INT8: case ENTRY_INT16: case ENTRY_INT32: |
| 768 | case ENTRY_INT64: |
| 769 | { |
| 770 | int64_t val = 0; |
| 771 | if (entry.use) |
| 772 | { |
| 773 | val = lookupLabel(B, entry.label, I, addr + buf.size(), |
| 774 | labels); |
| 775 | val += (addr + buf.size()); |
| 776 | } |
| 777 | else |
| 778 | val = (int64_t)entry.uint64; |
| 779 | switch (entry.kind) |
| 780 | { |
| 781 | case ENTRY_INT8: |
| 782 | buf.push((uint8_t)val); |
| 783 | break; |
| 784 | case ENTRY_INT16: |
| 785 | buf.push((uint8_t *)&val, sizeof(uint16_t)); |
| 786 | break; |
| 787 | case ENTRY_INT32: |
| 788 | buf.push((uint8_t *)&val, sizeof(uint32_t)); |
| 789 | break; |
| 790 | case ENTRY_INT64: |
| 791 | buf.push((uint8_t *)&val, sizeof(uint64_t)); |
| 792 | break; |
| 793 | default: |
| 794 | break; |
| 795 | } |
| 796 | continue; |
| 797 | } |
| 798 | |
| 799 | case ENTRY_LABEL: |
| 800 | continue; |
| 801 | |
| 802 | case ENTRY_MACRO: |
| 803 | { |
| 804 | const Trampoline *U = expandMacro(B, I->metadata, |
no test coverage detected