* Commit a patch. */
| 114 | * Commit a patch. |
| 115 | */ |
| 116 | static void commit(Binary &B, Patch *P) |
| 117 | { |
| 118 | switch (P->tactic) |
| 119 | { |
| 120 | case TACTIC_B0: |
| 121 | stat_num_B0++; |
| 122 | break; |
| 123 | case TACTIC_B1: |
| 124 | stat_num_B1++; |
| 125 | break; |
| 126 | case TACTIC_B2: |
| 127 | stat_num_B2++; |
| 128 | break; |
| 129 | case TACTIC_T0: |
| 130 | stat_num_T0++; |
| 131 | break; |
| 132 | case TACTIC_T1: |
| 133 | stat_num_T1++; |
| 134 | break; |
| 135 | case TACTIC_T2: |
| 136 | stat_num_T2++; |
| 137 | break; |
| 138 | case TACTIC_T3: |
| 139 | stat_num_T3++; |
| 140 | break; |
| 141 | } |
| 142 | |
| 143 | if (P->tactic == TACTIC_B0) |
| 144 | B.Traps.push_back(P->A); |
| 145 | |
| 146 | while (P != nullptr) |
| 147 | { |
| 148 | if (P->A != nullptr) |
| 149 | setTrampolineEntry(B.Es, P->I, P->A->lb + P->A->entry); |
| 150 | |
| 151 | // Delete the P (we do not need it anymore) |
| 152 | Patch *Q = P; |
| 153 | P = P->next; |
| 154 | delete Q; |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | /* |
| 159 | * Undo the application of a patch. |
no test coverage detected