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