1/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef _LIBUNWINDSTACK_DWARF_OP_H
18#define _LIBUNWINDSTACK_DWARF_OP_H
19
20#include <stdint.h>
21
22#include <deque>
23#include <string>
24#include <type_traits>
25#include <vector>
26
27#include <unwindstack/DwarfError.h>
28
29#include "DwarfEncoding.h"
30#include "RegsInfo.h"
31
32namespace unwindstack {
33
34// Forward declarations.
35class DwarfMemory;
36class Memory;
37template <typename AddressType>
38class RegsImpl;
39
40template <typename AddressType>
41class DwarfOp {
42  // Signed version of AddressType
43  typedef typename std::make_signed<AddressType>::type SignedType;
44
45  struct OpCallback {
46    const char* name;
47    bool (DwarfOp::*handle_func)();
48    uint8_t num_required_stack_values;
49    uint8_t num_operands;
50    uint8_t operands[2];
51  };
52
53 public:
54  DwarfOp(DwarfMemory* memory, Memory* regular_memory)
55      : memory_(memory), regular_memory_(regular_memory) {}
56  virtual ~DwarfOp() = default;
57
58  bool Decode();
59
60  bool Eval(uint64_t start, uint64_t end);
61
62  void GetLogInfo(uint64_t start, uint64_t end, std::vector<std::string>* lines);
63
64  AddressType StackAt(size_t index) { return stack_[index]; }
65  size_t StackSize() { return stack_.size(); }
66
67  void set_regs_info(RegsInfo<AddressType>* regs_info) { regs_info_ = regs_info; }
68
69  const DwarfErrorData& last_error() { return last_error_; }
70  DwarfErrorCode LastErrorCode() { return last_error_.code; }
71  uint64_t LastErrorAddress() { return last_error_.address; }
72
73  bool dex_pc_set() { return dex_pc_set_; }
74
75  bool is_register() { return is_register_; }
76
77  uint8_t cur_op() { return cur_op_; }
78
79  Memory* regular_memory() { return regular_memory_; }
80
81 protected:
82  AddressType OperandAt(size_t index) { return operands_[index]; }
83  size_t OperandsSize() { return operands_.size(); }
84
85  AddressType StackPop() {
86    AddressType value = stack_.front();
87    stack_.pop_front();
88    return value;
89  }
90
91 private:
92  DwarfMemory* memory_;
93  Memory* regular_memory_;
94
95  RegsInfo<AddressType>* regs_info_;
96  bool dex_pc_set_ = false;
97  bool is_register_ = false;
98  DwarfErrorData last_error_{DWARF_ERROR_NONE, 0};
99  uint8_t cur_op_;
100  std::vector<AddressType> operands_;
101  std::deque<AddressType> stack_;
102
103  inline AddressType bool_to_dwarf_bool(bool value) { return value ? 1 : 0; }
104
105  // Op processing functions.
106  bool op_deref();
107  bool op_deref_size();
108  bool op_push();
109  bool op_dup();
110  bool op_drop();
111  bool op_over();
112  bool op_pick();
113  bool op_swap();
114  bool op_rot();
115  bool op_abs();
116  bool op_and();
117  bool op_div();
118  bool op_minus();
119  bool op_mod();
120  bool op_mul();
121  bool op_neg();
122  bool op_not();
123  bool op_or();
124  bool op_plus();
125  bool op_plus_uconst();
126  bool op_shl();
127  bool op_shr();
128  bool op_shra();
129  bool op_xor();
130  bool op_bra();
131  bool op_eq();
132  bool op_ge();
133  bool op_gt();
134  bool op_le();
135  bool op_lt();
136  bool op_ne();
137  bool op_skip();
138  bool op_lit();
139  bool op_reg();
140  bool op_regx();
141  bool op_breg();
142  bool op_bregx();
143  bool op_nop();
144  bool op_not_implemented();
145
146  constexpr static OpCallback kCallbackTable[256] = {
147      {nullptr, nullptr, 0, 0, {}},  // 0x00 illegal op
148      {nullptr, nullptr, 0, 0, {}},  // 0x01 illegal op
149      {nullptr, nullptr, 0, 0, {}},  // 0x02 illegal op
150      {
151          // 0x03 DW_OP_addr
152          "DW_OP_addr",
153          &DwarfOp::op_push,
154          0,
155          1,
156          {DW_EH_PE_absptr},
157      },
158      {nullptr, nullptr, 0, 0, {}},  // 0x04 illegal op
159      {nullptr, nullptr, 0, 0, {}},  // 0x05 illegal op
160      {
161          // 0x06 DW_OP_deref
162          "DW_OP_deref",
163          &DwarfOp::op_deref,
164          1,
165          0,
166          {},
167      },
168      {nullptr, nullptr, 0, 0, {}},  // 0x07 illegal op
169      {
170          // 0x08 DW_OP_const1u
171          "DW_OP_const1u",
172          &DwarfOp::op_push,
173          0,
174          1,
175          {DW_EH_PE_udata1},
176      },
177      {
178          // 0x09 DW_OP_const1s
179          "DW_OP_const1s",
180          &DwarfOp::op_push,
181          0,
182          1,
183          {DW_EH_PE_sdata1},
184      },
185      {
186          // 0x0a DW_OP_const2u
187          "DW_OP_const2u",
188          &DwarfOp::op_push,
189          0,
190          1,
191          {DW_EH_PE_udata2},
192      },
193      {
194          // 0x0b DW_OP_const2s
195          "DW_OP_const2s",
196          &DwarfOp::op_push,
197          0,
198          1,
199          {DW_EH_PE_sdata2},
200      },
201      {
202          // 0x0c DW_OP_const4u
203          "DW_OP_const4u",
204          &DwarfOp::op_push,
205          0,
206          1,
207          {DW_EH_PE_udata4},
208      },
209      {
210          // 0x0d DW_OP_const4s
211          "DW_OP_const4s",
212          &DwarfOp::op_push,
213          0,
214          1,
215          {DW_EH_PE_sdata4},
216      },
217      {
218          // 0x0e DW_OP_const8u
219          "DW_OP_const8u",
220          &DwarfOp::op_push,
221          0,
222          1,
223          {DW_EH_PE_udata8},
224      },
225      {
226          // 0x0f DW_OP_const8s
227          "DW_OP_const8s",
228          &DwarfOp::op_push,
229          0,
230          1,
231          {DW_EH_PE_sdata8},
232      },
233      {
234          // 0x10 DW_OP_constu
235          "DW_OP_constu",
236          &DwarfOp::op_push,
237          0,
238          1,
239          {DW_EH_PE_uleb128},
240      },
241      {
242          // 0x11 DW_OP_consts
243          "DW_OP_consts",
244          &DwarfOp::op_push,
245          0,
246          1,
247          {DW_EH_PE_sleb128},
248      },
249      {
250          // 0x12 DW_OP_dup
251          "DW_OP_dup",
252          &DwarfOp::op_dup,
253          1,
254          0,
255          {},
256      },
257      {
258          // 0x13 DW_OP_drop
259          "DW_OP_drop",
260          &DwarfOp::op_drop,
261          1,
262          0,
263          {},
264      },
265      {
266          // 0x14 DW_OP_over
267          "DW_OP_over",
268          &DwarfOp::op_over,
269          2,
270          0,
271          {},
272      },
273      {
274          // 0x15 DW_OP_pick
275          "DW_OP_pick",
276          &DwarfOp::op_pick,
277          0,
278          1,
279          {DW_EH_PE_udata1},
280      },
281      {
282          // 0x16 DW_OP_swap
283          "DW_OP_swap",
284          &DwarfOp::op_swap,
285          2,
286          0,
287          {},
288      },
289      {
290          // 0x17 DW_OP_rot
291          "DW_OP_rot",
292          &DwarfOp::op_rot,
293          3,
294          0,
295          {},
296      },
297      {
298          // 0x18 DW_OP_xderef
299          "DW_OP_xderef",
300          &DwarfOp::op_not_implemented,
301          2,
302          0,
303          {},
304      },
305      {
306          // 0x19 DW_OP_abs
307          "DW_OP_abs",
308          &DwarfOp::op_abs,
309          1,
310          0,
311          {},
312      },
313      {
314          // 0x1a DW_OP_and
315          "DW_OP_and",
316          &DwarfOp::op_and,
317          2,
318          0,
319          {},
320      },
321      {
322          // 0x1b DW_OP_div
323          "DW_OP_div",
324          &DwarfOp::op_div,
325          2,
326          0,
327          {},
328      },
329      {
330          // 0x1c DW_OP_minus
331          "DW_OP_minus",
332          &DwarfOp::op_minus,
333          2,
334          0,
335          {},
336      },
337      {
338          // 0x1d DW_OP_mod
339          "DW_OP_mod",
340          &DwarfOp::op_mod,
341          2,
342          0,
343          {},
344      },
345      {
346          // 0x1e DW_OP_mul
347          "DW_OP_mul",
348          &DwarfOp::op_mul,
349          2,
350          0,
351          {},
352      },
353      {
354          // 0x1f DW_OP_neg
355          "DW_OP_neg",
356          &DwarfOp::op_neg,
357          1,
358          0,
359          {},
360      },
361      {
362          // 0x20 DW_OP_not
363          "DW_OP_not",
364          &DwarfOp::op_not,
365          1,
366          0,
367          {},
368      },
369      {
370          // 0x21 DW_OP_or
371          "DW_OP_or",
372          &DwarfOp::op_or,
373          2,
374          0,
375          {},
376      },
377      {
378          // 0x22 DW_OP_plus
379          "DW_OP_plus",
380          &DwarfOp::op_plus,
381          2,
382          0,
383          {},
384      },
385      {
386          // 0x23 DW_OP_plus_uconst
387          "DW_OP_plus_uconst",
388          &DwarfOp::op_plus_uconst,
389          1,
390          1,
391          {DW_EH_PE_uleb128},
392      },
393      {
394          // 0x24 DW_OP_shl
395          "DW_OP_shl",
396          &DwarfOp::op_shl,
397          2,
398          0,
399          {},
400      },
401      {
402          // 0x25 DW_OP_shr
403          "DW_OP_shr",
404          &DwarfOp::op_shr,
405          2,
406          0,
407          {},
408      },
409      {
410          // 0x26 DW_OP_shra
411          "DW_OP_shra",
412          &DwarfOp::op_shra,
413          2,
414          0,
415          {},
416      },
417      {
418          // 0x27 DW_OP_xor
419          "DW_OP_xor",
420          &DwarfOp::op_xor,
421          2,
422          0,
423          {},
424      },
425      {
426          // 0x28 DW_OP_bra
427          "DW_OP_bra",
428          &DwarfOp::op_bra,
429          1,
430          1,
431          {DW_EH_PE_sdata2},
432      },
433      {
434          // 0x29 DW_OP_eq
435          "DW_OP_eq",
436          &DwarfOp::op_eq,
437          2,
438          0,
439          {},
440      },
441      {
442          // 0x2a DW_OP_ge
443          "DW_OP_ge",
444          &DwarfOp::op_ge,
445          2,
446          0,
447          {},
448      },
449      {
450          // 0x2b DW_OP_gt
451          "DW_OP_gt",
452          &DwarfOp::op_gt,
453          2,
454          0,
455          {},
456      },
457      {
458          // 0x2c DW_OP_le
459          "DW_OP_le",
460          &DwarfOp::op_le,
461          2,
462          0,
463          {},
464      },
465      {
466          // 0x2d DW_OP_lt
467          "DW_OP_lt",
468          &DwarfOp::op_lt,
469          2,
470          0,
471          {},
472      },
473      {
474          // 0x2e DW_OP_ne
475          "DW_OP_ne",
476          &DwarfOp::op_ne,
477          2,
478          0,
479          {},
480      },
481      {
482          // 0x2f DW_OP_skip
483          "DW_OP_skip",
484          &DwarfOp::op_skip,
485          0,
486          1,
487          {DW_EH_PE_sdata2},
488      },
489      {
490          // 0x30 DW_OP_lit0
491          "DW_OP_lit0",
492          &DwarfOp::op_lit,
493          0,
494          0,
495          {},
496      },
497      {
498          // 0x31 DW_OP_lit1
499          "DW_OP_lit1",
500          &DwarfOp::op_lit,
501          0,
502          0,
503          {},
504      },
505      {
506          // 0x32 DW_OP_lit2
507          "DW_OP_lit2",
508          &DwarfOp::op_lit,
509          0,
510          0,
511          {},
512      },
513      {
514          // 0x33 DW_OP_lit3
515          "DW_OP_lit3",
516          &DwarfOp::op_lit,
517          0,
518          0,
519          {},
520      },
521      {
522          // 0x34 DW_OP_lit4
523          "DW_OP_lit4",
524          &DwarfOp::op_lit,
525          0,
526          0,
527          {},
528      },
529      {
530          // 0x35 DW_OP_lit5
531          "DW_OP_lit5",
532          &DwarfOp::op_lit,
533          0,
534          0,
535          {},
536      },
537      {
538          // 0x36 DW_OP_lit6
539          "DW_OP_lit6",
540          &DwarfOp::op_lit,
541          0,
542          0,
543          {},
544      },
545      {
546          // 0x37 DW_OP_lit7
547          "DW_OP_lit7",
548          &DwarfOp::op_lit,
549          0,
550          0,
551          {},
552      },
553      {
554          // 0x38 DW_OP_lit8
555          "DW_OP_lit8",
556          &DwarfOp::op_lit,
557          0,
558          0,
559          {},
560      },
561      {
562          // 0x39 DW_OP_lit9
563          "DW_OP_lit9",
564          &DwarfOp::op_lit,
565          0,
566          0,
567          {},
568      },
569      {
570          // 0x3a DW_OP_lit10
571          "DW_OP_lit10",
572          &DwarfOp::op_lit,
573          0,
574          0,
575          {},
576      },
577      {
578          // 0x3b DW_OP_lit11
579          "DW_OP_lit11",
580          &DwarfOp::op_lit,
581          0,
582          0,
583          {},
584      },
585      {
586          // 0x3c DW_OP_lit12
587          "DW_OP_lit12",
588          &DwarfOp::op_lit,
589          0,
590          0,
591          {},
592      },
593      {
594          // 0x3d DW_OP_lit13
595          "DW_OP_lit13",
596          &DwarfOp::op_lit,
597          0,
598          0,
599          {},
600      },
601      {
602          // 0x3e DW_OP_lit14
603          "DW_OP_lit14",
604          &DwarfOp::op_lit,
605          0,
606          0,
607          {},
608      },
609      {
610          // 0x3f DW_OP_lit15
611          "DW_OP_lit15",
612          &DwarfOp::op_lit,
613          0,
614          0,
615          {},
616      },
617      {
618          // 0x40 DW_OP_lit16
619          "DW_OP_lit16",
620          &DwarfOp::op_lit,
621          0,
622          0,
623          {},
624      },
625      {
626          // 0x41 DW_OP_lit17
627          "DW_OP_lit17",
628          &DwarfOp::op_lit,
629          0,
630          0,
631          {},
632      },
633      {
634          // 0x42 DW_OP_lit18
635          "DW_OP_lit18",
636          &DwarfOp::op_lit,
637          0,
638          0,
639          {},
640      },
641      {
642          // 0x43 DW_OP_lit19
643          "DW_OP_lit19",
644          &DwarfOp::op_lit,
645          0,
646          0,
647          {},
648      },
649      {
650          // 0x44 DW_OP_lit20
651          "DW_OP_lit20",
652          &DwarfOp::op_lit,
653          0,
654          0,
655          {},
656      },
657      {
658          // 0x45 DW_OP_lit21
659          "DW_OP_lit21",
660          &DwarfOp::op_lit,
661          0,
662          0,
663          {},
664      },
665      {
666          // 0x46 DW_OP_lit22
667          "DW_OP_lit22",
668          &DwarfOp::op_lit,
669          0,
670          0,
671          {},
672      },
673      {
674          // 0x47 DW_OP_lit23
675          "DW_OP_lit23",
676          &DwarfOp::op_lit,
677          0,
678          0,
679          {},
680      },
681      {
682          // 0x48 DW_OP_lit24
683          "DW_OP_lit24",
684          &DwarfOp::op_lit,
685          0,
686          0,
687          {},
688      },
689      {
690          // 0x49 DW_OP_lit25
691          "DW_OP_lit25",
692          &DwarfOp::op_lit,
693          0,
694          0,
695          {},
696      },
697      {
698          // 0x4a DW_OP_lit26
699          "DW_OP_lit26",
700          &DwarfOp::op_lit,
701          0,
702          0,
703          {},
704      },
705      {
706          // 0x4b DW_OP_lit27
707          "DW_OP_lit27",
708          &DwarfOp::op_lit,
709          0,
710          0,
711          {},
712      },
713      {
714          // 0x4c DW_OP_lit28
715          "DW_OP_lit28",
716          &DwarfOp::op_lit,
717          0,
718          0,
719          {},
720      },
721      {
722          // 0x4d DW_OP_lit29
723          "DW_OP_lit29",
724          &DwarfOp::op_lit,
725          0,
726          0,
727          {},
728      },
729      {
730          // 0x4e DW_OP_lit30
731          "DW_OP_lit30",
732          &DwarfOp::op_lit,
733          0,
734          0,
735          {},
736      },
737      {
738          // 0x4f DW_OP_lit31
739          "DW_OP_lit31",
740          &DwarfOp::op_lit,
741          0,
742          0,
743          {},
744      },
745      {
746          // 0x50 DW_OP_reg0
747          "DW_OP_reg0",
748          &DwarfOp::op_reg,
749          0,
750          0,
751          {},
752      },
753      {
754          // 0x51 DW_OP_reg1
755          "DW_OP_reg1",
756          &DwarfOp::op_reg,
757          0,
758          0,
759          {},
760      },
761      {
762          // 0x52 DW_OP_reg2
763          "DW_OP_reg2",
764          &DwarfOp::op_reg,
765          0,
766          0,
767          {},
768      },
769      {
770          // 0x53 DW_OP_reg3
771          "DW_OP_reg3",
772          &DwarfOp::op_reg,
773          0,
774          0,
775          {},
776      },
777      {
778          // 0x54 DW_OP_reg4
779          "DW_OP_reg4",
780          &DwarfOp::op_reg,
781          0,
782          0,
783          {},
784      },
785      {
786          // 0x55 DW_OP_reg5
787          "DW_OP_reg5",
788          &DwarfOp::op_reg,
789          0,
790          0,
791          {},
792      },
793      {
794          // 0x56 DW_OP_reg6
795          "DW_OP_reg6",
796          &DwarfOp::op_reg,
797          0,
798          0,
799          {},
800      },
801      {
802          // 0x57 DW_OP_reg7
803          "DW_OP_reg7",
804          &DwarfOp::op_reg,
805          0,
806          0,
807          {},
808      },
809      {
810          // 0x58 DW_OP_reg8
811          "DW_OP_reg8",
812          &DwarfOp::op_reg,
813          0,
814          0,
815          {},
816      },
817      {
818          // 0x59 DW_OP_reg9
819          "DW_OP_reg9",
820          &DwarfOp::op_reg,
821          0,
822          0,
823          {},
824      },
825      {
826          // 0x5a DW_OP_reg10
827          "DW_OP_reg10",
828          &DwarfOp::op_reg,
829          0,
830          0,
831          {},
832      },
833      {
834          // 0x5b DW_OP_reg11
835          "DW_OP_reg11",
836          &DwarfOp::op_reg,
837          0,
838          0,
839          {},
840      },
841      {
842          // 0x5c DW_OP_reg12
843          "DW_OP_reg12",
844          &DwarfOp::op_reg,
845          0,
846          0,
847          {},
848      },
849      {
850          // 0x5d DW_OP_reg13
851          "DW_OP_reg13",
852          &DwarfOp::op_reg,
853          0,
854          0,
855          {},
856      },
857      {
858          // 0x5e DW_OP_reg14
859          "DW_OP_reg14",
860          &DwarfOp::op_reg,
861          0,
862          0,
863          {},
864      },
865      {
866          // 0x5f DW_OP_reg15
867          "DW_OP_reg15",
868          &DwarfOp::op_reg,
869          0,
870          0,
871          {},
872      },
873      {
874          // 0x60 DW_OP_reg16
875          "DW_OP_reg16",
876          &DwarfOp::op_reg,
877          0,
878          0,
879          {},
880      },
881      {
882          // 0x61 DW_OP_reg17
883          "DW_OP_reg17",
884          &DwarfOp::op_reg,
885          0,
886          0,
887          {},
888      },
889      {
890          // 0x62 DW_OP_reg18
891          "DW_OP_reg18",
892          &DwarfOp::op_reg,
893          0,
894          0,
895          {},
896      },
897      {
898          // 0x63 DW_OP_reg19
899          "DW_OP_reg19",
900          &DwarfOp::op_reg,
901          0,
902          0,
903          {},
904      },
905      {
906          // 0x64 DW_OP_reg20
907          "DW_OP_reg20",
908          &DwarfOp::op_reg,
909          0,
910          0,
911          {},
912      },
913      {
914          // 0x65 DW_OP_reg21
915          "DW_OP_reg21",
916          &DwarfOp::op_reg,
917          0,
918          0,
919          {},
920      },
921      {
922          // 0x66 DW_OP_reg22
923          "DW_OP_reg22",
924          &DwarfOp::op_reg,
925          0,
926          0,
927          {},
928      },
929      {
930          // 0x67 DW_OP_reg23
931          "DW_OP_reg23",
932          &DwarfOp::op_reg,
933          0,
934          0,
935          {},
936      },
937      {
938          // 0x68 DW_OP_reg24
939          "DW_OP_reg24",
940          &DwarfOp::op_reg,
941          0,
942          0,
943          {},
944      },
945      {
946          // 0x69 DW_OP_reg25
947          "DW_OP_reg25",
948          &DwarfOp::op_reg,
949          0,
950          0,
951          {},
952      },
953      {
954          // 0x6a DW_OP_reg26
955          "DW_OP_reg26",
956          &DwarfOp::op_reg,
957          0,
958          0,
959          {},
960      },
961      {
962          // 0x6b DW_OP_reg27
963          "DW_OP_reg27",
964          &DwarfOp::op_reg,
965          0,
966          0,
967          {},
968      },
969      {
970          // 0x6c DW_OP_reg28
971          "DW_OP_reg28",
972          &DwarfOp::op_reg,
973          0,
974          0,
975          {},
976      },
977      {
978          // 0x6d DW_OP_reg29
979          "DW_OP_reg29",
980          &DwarfOp::op_reg,
981          0,
982          0,
983          {},
984      },
985      {
986          // 0x6e DW_OP_reg30
987          "DW_OP_reg30",
988          &DwarfOp::op_reg,
989          0,
990          0,
991          {},
992      },
993      {
994          // 0x6f DW_OP_reg31
995          "DW_OP_reg31",
996          &DwarfOp::op_reg,
997          0,
998          0,
999          {},
1000      },
1001      {
1002          // 0x70 DW_OP_breg0
1003          "DW_OP_breg0",
1004          &DwarfOp::op_breg,
1005          0,
1006          1,
1007          {DW_EH_PE_sleb128},
1008      },
1009      {
1010          // 0x71 DW_OP_breg1
1011          "DW_OP_breg1",
1012          &DwarfOp::op_breg,
1013          0,
1014          1,
1015          {DW_EH_PE_sleb128},
1016      },
1017      {
1018          // 0x72 DW_OP_breg2
1019          "DW_OP_breg2",
1020          &DwarfOp::op_breg,
1021          0,
1022          1,
1023          {DW_EH_PE_sleb128},
1024      },
1025      {
1026          // 0x73 DW_OP_breg3
1027          "DW_OP_breg3",
1028          &DwarfOp::op_breg,
1029          0,
1030          1,
1031          {DW_EH_PE_sleb128},
1032      },
1033      {
1034          // 0x74 DW_OP_breg4
1035          "DW_OP_breg4",
1036          &DwarfOp::op_breg,
1037          0,
1038          1,
1039          {DW_EH_PE_sleb128},
1040      },
1041      {
1042          // 0x75 DW_OP_breg5
1043          "DW_OP_breg5",
1044          &DwarfOp::op_breg,
1045          0,
1046          1,
1047          {DW_EH_PE_sleb128},
1048      },
1049      {
1050          // 0x76 DW_OP_breg6
1051          "DW_OP_breg6",
1052          &DwarfOp::op_breg,
1053          0,
1054          1,
1055          {DW_EH_PE_sleb128},
1056      },
1057      {
1058          // 0x77 DW_OP_breg7
1059          "DW_OP_breg7",
1060          &DwarfOp::op_breg,
1061          0,
1062          1,
1063          {DW_EH_PE_sleb128},
1064      },
1065      {
1066          // 0x78 DW_OP_breg8
1067          "DW_OP_breg8",
1068          &DwarfOp::op_breg,
1069          0,
1070          1,
1071          {DW_EH_PE_sleb128},
1072      },
1073      {
1074          // 0x79 DW_OP_breg9
1075          "DW_OP_breg9",
1076          &DwarfOp::op_breg,
1077          0,
1078          1,
1079          {DW_EH_PE_sleb128},
1080      },
1081      {
1082          // 0x7a DW_OP_breg10
1083          "DW_OP_breg10",
1084          &DwarfOp::op_breg,
1085          0,
1086          1,
1087          {DW_EH_PE_sleb128},
1088      },
1089      {
1090          // 0x7b DW_OP_breg11
1091          "DW_OP_breg11",
1092          &DwarfOp::op_breg,
1093          0,
1094          1,
1095          {DW_EH_PE_sleb128},
1096      },
1097      {
1098          // 0x7c DW_OP_breg12
1099          "DW_OP_breg12",
1100          &DwarfOp::op_breg,
1101          0,
1102          1,
1103          {DW_EH_PE_sleb128},
1104      },
1105      {
1106          // 0x7d DW_OP_breg13
1107          "DW_OP_breg13",
1108          &DwarfOp::op_breg,
1109          0,
1110          1,
1111          {DW_EH_PE_sleb128},
1112      },
1113      {
1114          // 0x7e DW_OP_breg14
1115          "DW_OP_breg14",
1116          &DwarfOp::op_breg,
1117          0,
1118          1,
1119          {DW_EH_PE_sleb128},
1120      },
1121      {
1122          // 0x7f DW_OP_breg15
1123          "DW_OP_breg15",
1124          &DwarfOp::op_breg,
1125          0,
1126          1,
1127          {DW_EH_PE_sleb128},
1128      },
1129      {
1130          // 0x80 DW_OP_breg16
1131          "DW_OP_breg16",
1132          &DwarfOp::op_breg,
1133          0,
1134          1,
1135          {DW_EH_PE_sleb128},
1136      },
1137      {
1138          // 0x81 DW_OP_breg17
1139          "DW_OP_breg17",
1140          &DwarfOp::op_breg,
1141          0,
1142          1,
1143          {DW_EH_PE_sleb128},
1144      },
1145      {
1146          // 0x82 DW_OP_breg18
1147          "DW_OP_breg18",
1148          &DwarfOp::op_breg,
1149          0,
1150          1,
1151          {DW_EH_PE_sleb128},
1152      },
1153      {
1154          // 0x83 DW_OP_breg19
1155          "DW_OP_breg19",
1156          &DwarfOp::op_breg,
1157          0,
1158          1,
1159          {DW_EH_PE_sleb128},
1160      },
1161      {
1162          // 0x84 DW_OP_breg20
1163          "DW_OP_breg20",
1164          &DwarfOp::op_breg,
1165          0,
1166          1,
1167          {DW_EH_PE_sleb128},
1168      },
1169      {
1170          // 0x85 DW_OP_breg21
1171          "DW_OP_breg21",
1172          &DwarfOp::op_breg,
1173          0,
1174          1,
1175          {DW_EH_PE_sleb128},
1176      },
1177      {
1178          // 0x86 DW_OP_breg22
1179          "DW_OP_breg22",
1180          &DwarfOp::op_breg,
1181          0,
1182          1,
1183          {DW_EH_PE_sleb128},
1184      },
1185      {
1186          // 0x87 DW_OP_breg23
1187          "DW_OP_breg23",
1188          &DwarfOp::op_breg,
1189          0,
1190          1,
1191          {DW_EH_PE_sleb128},
1192      },
1193      {
1194          // 0x88 DW_OP_breg24
1195          "DW_OP_breg24",
1196          &DwarfOp::op_breg,
1197          0,
1198          1,
1199          {DW_EH_PE_sleb128},
1200      },
1201      {
1202          // 0x89 DW_OP_breg25
1203          "DW_OP_breg25",
1204          &DwarfOp::op_breg,
1205          0,
1206          1,
1207          {DW_EH_PE_sleb128},
1208      },
1209      {
1210          // 0x8a DW_OP_breg26
1211          "DW_OP_breg26",
1212          &DwarfOp::op_breg,
1213          0,
1214          1,
1215          {DW_EH_PE_sleb128},
1216      },
1217      {
1218          // 0x8b DW_OP_breg27
1219          "DW_OP_breg27",
1220          &DwarfOp::op_breg,
1221          0,
1222          1,
1223          {DW_EH_PE_sleb128},
1224      },
1225      {
1226          // 0x8c DW_OP_breg28
1227          "DW_OP_breg28",
1228          &DwarfOp::op_breg,
1229          0,
1230          1,
1231          {DW_EH_PE_sleb128},
1232      },
1233      {
1234          // 0x8d DW_OP_breg29
1235          "DW_OP_breg29",
1236          &DwarfOp::op_breg,
1237          0,
1238          1,
1239          {DW_EH_PE_sleb128},
1240      },
1241      {
1242          // 0x8e DW_OP_breg30
1243          "DW_OP_breg30",
1244          &DwarfOp::op_breg,
1245          0,
1246          1,
1247          {DW_EH_PE_sleb128},
1248      },
1249      {
1250          // 0x8f DW_OP_breg31
1251          "DW_OP_breg31",
1252          &DwarfOp::op_breg,
1253          0,
1254          1,
1255          {DW_EH_PE_sleb128},
1256      },
1257      {
1258          // 0x90 DW_OP_regx
1259          "DW_OP_regx",
1260          &DwarfOp::op_regx,
1261          0,
1262          1,
1263          {DW_EH_PE_uleb128},
1264      },
1265      {
1266          // 0x91 DW_OP_fbreg
1267          "DW_OP_fbreg",
1268          &DwarfOp::op_not_implemented,
1269          0,
1270          1,
1271          {DW_EH_PE_sleb128},
1272      },
1273      {
1274          // 0x92 DW_OP_bregx
1275          "DW_OP_bregx",
1276          &DwarfOp::op_bregx,
1277          0,
1278          2,
1279          {DW_EH_PE_uleb128, DW_EH_PE_sleb128},
1280      },
1281      {
1282          // 0x93 DW_OP_piece
1283          "DW_OP_piece",
1284          &DwarfOp::op_not_implemented,
1285          0,
1286          1,
1287          {DW_EH_PE_uleb128},
1288      },
1289      {
1290          // 0x94 DW_OP_deref_size
1291          "DW_OP_deref_size",
1292          &DwarfOp::op_deref_size,
1293          1,
1294          1,
1295          {DW_EH_PE_udata1},
1296      },
1297      {
1298          // 0x95 DW_OP_xderef_size
1299          "DW_OP_xderef_size",
1300          &DwarfOp::op_not_implemented,
1301          0,
1302          1,
1303          {DW_EH_PE_udata1},
1304      },
1305      {
1306          // 0x96 DW_OP_nop
1307          "DW_OP_nop",
1308          &DwarfOp::op_nop,
1309          0,
1310          0,
1311          {},
1312      },
1313      {
1314          // 0x97 DW_OP_push_object_address
1315          "DW_OP_push_object_address",
1316          &DwarfOp::op_not_implemented,
1317          0,
1318          0,
1319          {},
1320      },
1321      {
1322          // 0x98 DW_OP_call2
1323          "DW_OP_call2",
1324          &DwarfOp::op_not_implemented,
1325          0,
1326          1,
1327          {DW_EH_PE_udata2},
1328      },
1329      {
1330          // 0x99 DW_OP_call4
1331          "DW_OP_call4",
1332          &DwarfOp::op_not_implemented,
1333          0,
1334          1,
1335          {DW_EH_PE_udata4},
1336      },
1337      {
1338          // 0x9a DW_OP_call_ref
1339          "DW_OP_call_ref",
1340          &DwarfOp::op_not_implemented,
1341          0,
1342          0,  // Has a different sized operand (4 bytes or 8 bytes).
1343          {},
1344      },
1345      {
1346          // 0x9b DW_OP_form_tls_address
1347          "DW_OP_form_tls_address",
1348          &DwarfOp::op_not_implemented,
1349          0,
1350          0,
1351          {},
1352      },
1353      {
1354          // 0x9c DW_OP_call_frame_cfa
1355          "DW_OP_call_frame_cfa",
1356          &DwarfOp::op_not_implemented,
1357          0,
1358          0,
1359          {},
1360      },
1361      {
1362          // 0x9d DW_OP_bit_piece
1363          "DW_OP_bit_piece",
1364          &DwarfOp::op_not_implemented,
1365          0,
1366          2,
1367          {DW_EH_PE_uleb128, DW_EH_PE_uleb128},
1368      },
1369      {
1370          // 0x9e DW_OP_implicit_value
1371          "DW_OP_implicit_value",
1372          &DwarfOp::op_not_implemented,
1373          0,
1374          1,
1375          {DW_EH_PE_uleb128},
1376      },
1377      {
1378          // 0x9f DW_OP_stack_value
1379          "DW_OP_stack_value",
1380          &DwarfOp::op_not_implemented,
1381          1,
1382          0,
1383          {},
1384      },
1385      {nullptr, nullptr, 0, 0, {}},  // 0xa0 illegal op
1386      {nullptr, nullptr, 0, 0, {}},  // 0xa1 illegal op
1387      {nullptr, nullptr, 0, 0, {}},  // 0xa2 illegal op
1388      {nullptr, nullptr, 0, 0, {}},  // 0xa3 illegal op
1389      {nullptr, nullptr, 0, 0, {}},  // 0xa4 illegal op
1390      {nullptr, nullptr, 0, 0, {}},  // 0xa5 illegal op
1391      {nullptr, nullptr, 0, 0, {}},  // 0xa6 illegal op
1392      {nullptr, nullptr, 0, 0, {}},  // 0xa7 illegal op
1393      {nullptr, nullptr, 0, 0, {}},  // 0xa8 illegal op
1394      {nullptr, nullptr, 0, 0, {}},  // 0xa9 illegal op
1395      {nullptr, nullptr, 0, 0, {}},  // 0xaa illegal op
1396      {nullptr, nullptr, 0, 0, {}},  // 0xab illegal op
1397      {nullptr, nullptr, 0, 0, {}},  // 0xac illegal op
1398      {nullptr, nullptr, 0, 0, {}},  // 0xad illegal op
1399      {nullptr, nullptr, 0, 0, {}},  // 0xae illegal op
1400      {nullptr, nullptr, 0, 0, {}},  // 0xaf illegal op
1401      {nullptr, nullptr, 0, 0, {}},  // 0xb0 illegal op
1402      {nullptr, nullptr, 0, 0, {}},  // 0xb1 illegal op
1403      {nullptr, nullptr, 0, 0, {}},  // 0xb2 illegal op
1404      {nullptr, nullptr, 0, 0, {}},  // 0xb3 illegal op
1405      {nullptr, nullptr, 0, 0, {}},  // 0xb4 illegal op
1406      {nullptr, nullptr, 0, 0, {}},  // 0xb5 illegal op
1407      {nullptr, nullptr, 0, 0, {}},  // 0xb6 illegal op
1408      {nullptr, nullptr, 0, 0, {}},  // 0xb7 illegal op
1409      {nullptr, nullptr, 0, 0, {}},  // 0xb8 illegal op
1410      {nullptr, nullptr, 0, 0, {}},  // 0xb9 illegal op
1411      {nullptr, nullptr, 0, 0, {}},  // 0xba illegal op
1412      {nullptr, nullptr, 0, 0, {}},  // 0xbb illegal op
1413      {nullptr, nullptr, 0, 0, {}},  // 0xbc illegal op
1414      {nullptr, nullptr, 0, 0, {}},  // 0xbd illegal op
1415      {nullptr, nullptr, 0, 0, {}},  // 0xbe illegal op
1416      {nullptr, nullptr, 0, 0, {}},  // 0xbf illegal op
1417      {nullptr, nullptr, 0, 0, {}},  // 0xc0 illegal op
1418      {nullptr, nullptr, 0, 0, {}},  // 0xc1 illegal op
1419      {nullptr, nullptr, 0, 0, {}},  // 0xc2 illegal op
1420      {nullptr, nullptr, 0, 0, {}},  // 0xc3 illegal op
1421      {nullptr, nullptr, 0, 0, {}},  // 0xc4 illegal op
1422      {nullptr, nullptr, 0, 0, {}},  // 0xc5 illegal op
1423      {nullptr, nullptr, 0, 0, {}},  // 0xc6 illegal op
1424      {nullptr, nullptr, 0, 0, {}},  // 0xc7 illegal op
1425      {nullptr, nullptr, 0, 0, {}},  // 0xc8 illegal op
1426      {nullptr, nullptr, 0, 0, {}},  // 0xc9 illegal op
1427      {nullptr, nullptr, 0, 0, {}},  // 0xca illegal op
1428      {nullptr, nullptr, 0, 0, {}},  // 0xcb illegal op
1429      {nullptr, nullptr, 0, 0, {}},  // 0xcc illegal op
1430      {nullptr, nullptr, 0, 0, {}},  // 0xcd illegal op
1431      {nullptr, nullptr, 0, 0, {}},  // 0xce illegal op
1432      {nullptr, nullptr, 0, 0, {}},  // 0xcf illegal op
1433      {nullptr, nullptr, 0, 0, {}},  // 0xd0 illegal op
1434      {nullptr, nullptr, 0, 0, {}},  // 0xd1 illegal op
1435      {nullptr, nullptr, 0, 0, {}},  // 0xd2 illegal op
1436      {nullptr, nullptr, 0, 0, {}},  // 0xd3 illegal op
1437      {nullptr, nullptr, 0, 0, {}},  // 0xd4 illegal op
1438      {nullptr, nullptr, 0, 0, {}},  // 0xd5 illegal op
1439      {nullptr, nullptr, 0, 0, {}},  // 0xd6 illegal op
1440      {nullptr, nullptr, 0, 0, {}},  // 0xd7 illegal op
1441      {nullptr, nullptr, 0, 0, {}},  // 0xd8 illegal op
1442      {nullptr, nullptr, 0, 0, {}},  // 0xd9 illegal op
1443      {nullptr, nullptr, 0, 0, {}},  // 0xda illegal op
1444      {nullptr, nullptr, 0, 0, {}},  // 0xdb illegal op
1445      {nullptr, nullptr, 0, 0, {}},  // 0xdc illegal op
1446      {nullptr, nullptr, 0, 0, {}},  // 0xdd illegal op
1447      {nullptr, nullptr, 0, 0, {}},  // 0xde illegal op
1448      {nullptr, nullptr, 0, 0, {}},  // 0xdf illegal op
1449      {nullptr, nullptr, 0, 0, {}},  // 0xe0 DW_OP_lo_user
1450      {nullptr, nullptr, 0, 0, {}},  // 0xe1 illegal op
1451      {nullptr, nullptr, 0, 0, {}},  // 0xe2 illegal op
1452      {nullptr, nullptr, 0, 0, {}},  // 0xe3 illegal op
1453      {nullptr, nullptr, 0, 0, {}},  // 0xe4 illegal op
1454      {nullptr, nullptr, 0, 0, {}},  // 0xe5 illegal op
1455      {nullptr, nullptr, 0, 0, {}},  // 0xe6 illegal op
1456      {nullptr, nullptr, 0, 0, {}},  // 0xe7 illegal op
1457      {nullptr, nullptr, 0, 0, {}},  // 0xe8 illegal op
1458      {nullptr, nullptr, 0, 0, {}},  // 0xe9 illegal op
1459      {nullptr, nullptr, 0, 0, {}},  // 0xea illegal op
1460      {nullptr, nullptr, 0, 0, {}},  // 0xeb illegal op
1461      {nullptr, nullptr, 0, 0, {}},  // 0xec illegal op
1462      {nullptr, nullptr, 0, 0, {}},  // 0xed illegal op
1463      {nullptr, nullptr, 0, 0, {}},  // 0xee illegal op
1464      {nullptr, nullptr, 0, 0, {}},  // 0xef illegal op
1465      {nullptr, nullptr, 0, 0, {}},  // 0xf0 illegal op
1466      {nullptr, nullptr, 0, 0, {}},  // 0xf1 illegal op
1467      {nullptr, nullptr, 0, 0, {}},  // 0xf2 illegal op
1468      {nullptr, nullptr, 0, 0, {}},  // 0xf3 illegal op
1469      {nullptr, nullptr, 0, 0, {}},  // 0xf4 illegal op
1470      {nullptr, nullptr, 0, 0, {}},  // 0xf5 illegal op
1471      {nullptr, nullptr, 0, 0, {}},  // 0xf6 illegal op
1472      {nullptr, nullptr, 0, 0, {}},  // 0xf7 illegal op
1473      {nullptr, nullptr, 0, 0, {}},  // 0xf8 illegal op
1474      {nullptr, nullptr, 0, 0, {}},  // 0xf9 illegal op
1475      {nullptr, nullptr, 0, 0, {}},  // 0xfa illegal op
1476      {nullptr, nullptr, 0, 0, {}},  // 0xfb illegal op
1477      {nullptr, nullptr, 0, 0, {}},  // 0xfc illegal op
1478      {nullptr, nullptr, 0, 0, {}},  // 0xfd illegal op
1479      {nullptr, nullptr, 0, 0, {}},  // 0xfe illegal op
1480      {nullptr, nullptr, 0, 0, {}},  // 0xff DW_OP_hi_user
1481  };
1482};
1483
1484}  // namespace unwindstack
1485
1486#endif  // _LIBUNWINDSTACK_DWARF_OP_H
1487