[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / lldb / examples / python / templates / scripted_process.py
blob3ddcebd128eaa6ecaf703354b95db24e7d1e519a
1 from abc import ABCMeta, abstractmethod
3 import lldb
4 import json, struct, signal
7 class ScriptedProcess(metaclass=ABCMeta):
9 """
10 The base class for a scripted process.
12 Most of the base class methods are `@abstractmethod` that need to be
13 overwritten by the inheriting class.
15 DISCLAIMER: THIS INTERFACE IS STILL UNDER DEVELOPMENT AND NOT STABLE.
16 THE METHODS EXPOSED MIGHT CHANGE IN THE FUTURE.
17 """
19 capabilities = None
20 memory_regions = None
21 loaded_images = None
22 threads = None
23 metadata = None
25 @abstractmethod
26 def __init__(self, exe_ctx, args):
27 """Construct a scripted process.
29 Args:
30 exe_ctx (lldb.SBExecutionContext): The execution context for the scripted process.
31 args (lldb.SBStructuredData): A Dictionary holding arbitrary
32 key/value pairs used by the scripted process.
33 """
34 target = None
35 self.target = None
36 self.args = None
37 self.arch = None
38 if isinstance(exe_ctx, lldb.SBExecutionContext):
39 target = exe_ctx.target
40 if isinstance(target, lldb.SBTarget) and target.IsValid():
41 self.target = target
42 triple = self.target.triple
43 if triple:
44 self.arch = triple.split("-")[0]
45 self.dbg = target.GetDebugger()
46 if isinstance(args, lldb.SBStructuredData) and args.IsValid():
47 self.args = args
48 self.threads = {}
49 self.loaded_images = []
50 self.metadata = {}
51 self.capabilities = {}
52 self.pid = 42
54 def get_capabilities(self):
55 """Get a dictionary containing the process capabilities.
57 Returns:
58 Dict[str:bool]: The dictionary of capability, with the capability
59 name as the key and a boolean flag as the value.
60 The dictionary can be empty.
61 """
62 return self.capabilities
64 def get_memory_region_containing_address(self, addr):
65 """Get the memory region for the scripted process, containing a
66 specific address.
68 Args:
69 addr (int): Address to look for in the scripted process memory
70 regions.
72 Returns:
73 lldb.SBMemoryRegionInfo: The memory region containing the address.
74 None if out of bounds.
75 """
76 return None
78 def get_threads_info(self):
79 """Get the dictionary describing the process' Scripted Threads.
81 Returns:
82 Dict: The dictionary of threads, with the thread ID as the key and
83 a Scripted Thread instance as the value.
84 The dictionary can be empty.
85 """
86 return self.threads
88 @abstractmethod
89 def read_memory_at_address(self, addr, size, error):
90 """Get a memory buffer from the scripted process at a certain address,
91 of a certain size.
93 Args:
94 addr (int): Address from which we should start reading.
95 size (int): Size of the memory to read.
96 error (lldb.SBError): Error object.
98 Returns:
99 lldb.SBData: An `lldb.SBData` buffer with the target byte size and
100 byte order storing the memory read.
102 pass
104 def write_memory_at_address(self, addr, data, error):
105 """Write a buffer to the scripted process memory.
107 Args:
108 addr (int): Address from which we should start reading.
109 data (lldb.SBData): An `lldb.SBData` buffer to write to the
110 process memory.
111 error (lldb.SBError): Error object.
113 Returns:
114 size (int): Size of the memory to read.
116 error.SetErrorString(
117 "%s doesn't support memory writes." % self.__class__.__name__
119 return 0
121 def get_loaded_images(self):
122 """Get the list of loaded images for the scripted process.
125 scripted_image = {
126 uuid = "c6ea2b64-f77c-3d27-9528-74f507b9078b",
127 path = "/usr/lib/dyld"
128 load_addr = 0xbadc0ffee
132 Returns:
133 List[scripted_image]: A list of `scripted_image` dictionaries
134 containing for each entry the library UUID or its file path
135 and its load address.
136 None if the list is empty.
138 return self.loaded_images
140 def get_process_id(self):
141 """Get the scripted process identifier.
143 Returns:
144 int: The scripted process identifier.
146 return self.pid
148 def launch(self):
149 """Simulate the scripted process launch.
151 Returns:
152 lldb.SBError: An `lldb.SBError` with error code 0.
154 return lldb.SBError()
156 def attach(self, attach_info):
157 """Simulate the scripted process attach.
159 Args:
160 attach_info (lldb.SBAttachInfo): The information related to the
161 process we're attaching to.
163 Returns:
164 lldb.SBError: An `lldb.SBError` with error code 0.
166 return lldb.SBError()
168 def resume(self, should_stop=True):
169 """Simulate the scripted process resume.
171 Args:
172 should_stop (bool): If True, resume will also force the process
173 state to stopped after running it.
175 Returns:
176 lldb.SBError: An `lldb.SBError` with error code 0.
178 process = self.target.GetProcess()
179 if not process:
180 error = lldb.SBError()
181 error.SetErrorString("Invalid process.")
182 return error
184 process.ForceScriptedState(lldb.eStateRunning)
185 if should_stop:
186 process.ForceScriptedState(lldb.eStateStopped)
187 return lldb.SBError()
189 @abstractmethod
190 def is_alive(self):
191 """Check if the scripted process is alive.
193 Returns:
194 bool: True if scripted process is alive. False otherwise.
196 pass
198 @abstractmethod
199 def get_scripted_thread_plugin(self):
200 """Get scripted thread plugin name.
202 Returns:
203 str: Name of the scripted thread plugin.
205 return None
207 def get_process_metadata(self):
208 """Get some metadata for the scripted process.
210 Returns:
211 Dict: A dictionary containing metadata for the scripted process.
212 None if the process as no metadata.
214 return self.metadata
216 def create_breakpoint(self, addr, error):
217 """Create a breakpoint in the scripted process from an address.
218 This is mainly used with interactive scripted process debugging.
220 Args:
221 addr (int): Address at which the breakpoint should be set.
222 error (lldb.SBError): Error object.
224 Returns:
225 SBBreakpoint: A valid breakpoint object that was created a the specified
226 address. None if the breakpoint creation failed.
228 error.SetErrorString(
229 "%s doesn't support creating breakpoints." % self.__class__.__name__
231 return False
234 class ScriptedThread(metaclass=ABCMeta):
237 The base class for a scripted thread.
239 Most of the base class methods are `@abstractmethod` that need to be
240 overwritten by the inheriting class.
242 DISCLAIMER: THIS INTERFACE IS STILL UNDER DEVELOPMENT AND NOT STABLE.
243 THE METHODS EXPOSED MIGHT CHANGE IN THE FUTURE.
246 @abstractmethod
247 def __init__(self, process, args):
248 """Construct a scripted thread.
250 Args:
251 process (ScriptedProcess/lldb.SBProcess): The process owning this thread.
252 args (lldb.SBStructuredData): A Dictionary holding arbitrary
253 key/value pairs used by the scripted thread.
255 self.target = None
256 self.originating_process = None
257 self.process = None
258 self.args = None
259 self.idx = 0
260 self.tid = 0
261 self.idx = None
262 self.name = None
263 self.queue = None
264 self.state = None
265 self.stop_reason = None
266 self.register_info = None
267 self.register_ctx = {}
268 self.frames = []
269 self.extended_info = []
271 if (
272 isinstance(process, ScriptedProcess)
273 or isinstance(process, lldb.SBProcess)
274 and process.IsValid()
276 self.target = process.target
277 self.originating_process = process
278 self.process = self.target.GetProcess()
279 self.get_register_info()
281 def get_thread_idx(self):
282 """Get the scripted thread index.
284 Returns:
285 int: The index of the scripted thread in the scripted process.
287 return self.idx
289 def get_thread_id(self):
290 """Get the scripted thread identifier.
292 Returns:
293 int: The identifier of the scripted thread.
295 return self.tid
297 def get_name(self):
298 """Get the scripted thread name.
300 Returns:
301 str: The name of the scripted thread.
303 return self.name
305 def get_state(self):
306 """Get the scripted thread state type.
308 eStateStopped, ///< Process or thread is stopped and can be examined.
309 eStateRunning, ///< Process or thread is running and can't be examined.
310 eStateStepping, ///< Process or thread is in the process of stepping and can
311 /// not be examined.
312 eStateCrashed, ///< Process or thread has crashed and can be examined.
314 Returns:
315 int: The state type of the scripted thread.
316 Returns lldb.eStateStopped by default.
318 return lldb.eStateStopped
320 def get_queue(self):
321 """Get the scripted thread associated queue name.
322 This method is optional.
324 Returns:
325 str: The queue name associated with the scripted thread.
327 return self.queue
329 @abstractmethod
330 def get_stop_reason(self):
331 """Get the dictionary describing the stop reason type with some data.
332 This method is optional.
334 Returns:
335 Dict: The dictionary holding the stop reason type and the possibly
336 the stop reason data.
338 pass
340 def get_stackframes(self):
341 """Get the list of stack frames for the scripted thread.
344 scripted_frame = {
345 idx = 0,
346 pc = 0xbadc0ffee
350 Returns:
351 List[scripted_frame]: A list of `scripted_frame` dictionaries
352 containing at least for each entry, the frame index and
353 the program counter value for that frame.
354 The list can be empty.
356 return self.frames
358 def get_register_info(self):
359 if self.register_info is None:
360 self.register_info = dict()
361 if self.originating_process.arch == "x86_64":
362 self.register_info["sets"] = ["General Purpose Registers"]
363 self.register_info["registers"] = INTEL64_GPR
364 elif "arm64" in self.originating_process.arch:
365 self.register_info["sets"] = ["General Purpose Registers"]
366 self.register_info["registers"] = ARM64_GPR
367 else:
368 raise ValueError("Unknown architecture", self.originating_process.arch)
369 return self.register_info
371 @abstractmethod
372 def get_register_context(self):
373 """Get the scripted thread register context
375 Returns:
376 str: A byte representing all register's value.
378 pass
380 def get_extended_info(self):
381 """Get scripted thread extended information.
383 Returns:
384 List: A list containing the extended information for the scripted process.
385 None if the thread as no extended information.
387 return self.extended_info
390 class PassthroughScriptedProcess(ScriptedProcess):
391 driving_target = None
392 driving_process = None
394 def __init__(self, exe_ctx, args, launched_driving_process=True):
395 super().__init__(exe_ctx, args)
397 self.driving_target = None
398 self.driving_process = None
400 self.driving_target_idx = args.GetValueForKey("driving_target_idx")
401 if self.driving_target_idx and self.driving_target_idx.IsValid():
402 idx = self.driving_target_idx.GetUnsignedIntegerValue(42)
403 self.driving_target = self.target.GetDebugger().GetTargetAtIndex(idx)
405 if launched_driving_process:
406 self.driving_process = self.driving_target.GetProcess()
407 for driving_thread in self.driving_process:
408 structured_data = lldb.SBStructuredData()
409 structured_data.SetFromJSON(
410 json.dumps(
412 "driving_target_idx": idx,
413 "thread_idx": driving_thread.GetIndexID(),
418 self.threads[
419 driving_thread.GetThreadID()
420 ] = PassthroughScriptedThread(self, structured_data)
422 for module in self.driving_target.modules:
423 path = module.file.fullpath
424 load_addr = module.GetObjectFileHeaderAddress().GetLoadAddress(
425 self.driving_target
427 self.loaded_images.append({"path": path, "load_addr": load_addr})
429 def get_memory_region_containing_address(self, addr):
430 mem_region = lldb.SBMemoryRegionInfo()
431 error = self.driving_process.GetMemoryRegionInfo(addr, mem_region)
432 if error.Fail():
433 return None
434 return mem_region
436 def read_memory_at_address(self, addr, size, error):
437 data = lldb.SBData()
438 bytes_read = self.driving_process.ReadMemory(addr, size, error)
440 if error.Fail():
441 return data
443 data.SetDataWithOwnership(
444 error,
445 bytes_read,
446 self.driving_target.GetByteOrder(),
447 self.driving_target.GetAddressByteSize(),
450 return data
452 def write_memory_at_address(self, addr, data, error):
453 return self.driving_process.WriteMemory(
454 addr, bytearray(data.uint8.all()), error
457 def get_process_id(self):
458 return self.driving_process.GetProcessID()
460 def is_alive(self):
461 return True
463 def get_scripted_thread_plugin(self):
464 return f"{PassthroughScriptedThread.__module__}.{PassthroughScriptedThread.__name__}"
467 class PassthroughScriptedThread(ScriptedThread):
468 def __init__(self, process, args):
469 super().__init__(process, args)
470 driving_target_idx = args.GetValueForKey("driving_target_idx")
471 thread_idx = args.GetValueForKey("thread_idx")
473 # TODO: Change to Walrus operator (:=) with oneline if assignment
474 # Requires python 3.8
475 val = thread_idx.GetUnsignedIntegerValue()
476 if val is not None:
477 self.idx = val
479 self.driving_target = None
480 self.driving_process = None
481 self.driving_thread = None
483 # TODO: Change to Walrus operator (:=) with oneline if assignment
484 # Requires python 3.8
485 val = driving_target_idx.GetUnsignedIntegerValue()
486 if val is not None:
487 self.driving_target = self.target.GetDebugger().GetTargetAtIndex(val)
488 self.driving_process = self.driving_target.GetProcess()
489 self.driving_thread = self.driving_process.GetThreadByIndexID(self.idx)
491 if self.driving_thread:
492 self.id = self.driving_thread.GetThreadID()
494 def get_thread_id(self):
495 return self.id
497 def get_name(self):
498 return f"{PassthroughScriptedThread.__name__}.thread-{self.idx}"
500 def get_stop_reason(self):
501 stop_reason = {"type": lldb.eStopReasonInvalid, "data": {}}
503 if (
504 self.driving_thread
505 and self.driving_thread.IsValid()
506 and self.get_thread_id() == self.driving_thread.GetThreadID()
508 stop_reason["type"] = lldb.eStopReasonNone
510 # TODO: Passthrough stop reason from driving process
511 if self.driving_thread.GetStopReason() != lldb.eStopReasonNone:
512 if "arm64" in self.originating_process.arch:
513 stop_reason["type"] = lldb.eStopReasonException
514 stop_reason["data"][
515 "desc"
516 ] = self.driving_thread.GetStopDescription(100)
517 elif self.originating_process.arch == "x86_64":
518 stop_reason["type"] = lldb.eStopReasonSignal
519 stop_reason["data"]["signal"] = signal.SIGTRAP
520 else:
521 stop_reason["type"] = self.driving_thread.GetStopReason()
523 return stop_reason
525 def get_register_context(self):
526 if not self.driving_thread or self.driving_thread.GetNumFrames() == 0:
527 return None
528 frame = self.driving_thread.GetFrameAtIndex(0)
530 GPRs = None
531 registerSet = frame.registers # Returns an SBValueList.
532 for regs in registerSet:
533 if "general purpose" in regs.name.lower():
534 GPRs = regs
535 break
537 if not GPRs:
538 return None
540 for reg in GPRs:
541 self.register_ctx[reg.name] = int(reg.value, base=16)
543 return struct.pack(f"{len(self.register_ctx)}Q", *self.register_ctx.values())
546 ARM64_GPR = [
548 "name": "x0",
549 "bitsize": 64,
550 "offset": 0,
551 "encoding": "uint",
552 "format": "hex",
553 "set": 0,
554 "gcc": 0,
555 "dwarf": 0,
556 "generic": "arg0",
557 "alt-name": "arg0",
560 "name": "x1",
561 "bitsize": 64,
562 "offset": 8,
563 "encoding": "uint",
564 "format": "hex",
565 "set": 0,
566 "gcc": 1,
567 "dwarf": 1,
568 "generic": "arg1",
569 "alt-name": "arg1",
572 "name": "x2",
573 "bitsize": 64,
574 "offset": 16,
575 "encoding": "uint",
576 "format": "hex",
577 "set": 0,
578 "gcc": 2,
579 "dwarf": 2,
580 "generic": "arg2",
581 "alt-name": "arg2",
584 "name": "x3",
585 "bitsize": 64,
586 "offset": 24,
587 "encoding": "uint",
588 "format": "hex",
589 "set": 0,
590 "gcc": 3,
591 "dwarf": 3,
592 "generic": "arg3",
593 "alt-name": "arg3",
596 "name": "x4",
597 "bitsize": 64,
598 "offset": 32,
599 "encoding": "uint",
600 "format": "hex",
601 "set": 0,
602 "gcc": 4,
603 "dwarf": 4,
604 "generic": "arg4",
605 "alt-name": "arg4",
608 "name": "x5",
609 "bitsize": 64,
610 "offset": 40,
611 "encoding": "uint",
612 "format": "hex",
613 "set": 0,
614 "gcc": 5,
615 "dwarf": 5,
616 "generic": "arg5",
617 "alt-name": "arg5",
620 "name": "x6",
621 "bitsize": 64,
622 "offset": 48,
623 "encoding": "uint",
624 "format": "hex",
625 "set": 0,
626 "gcc": 6,
627 "dwarf": 6,
628 "generic": "arg6",
629 "alt-name": "arg6",
632 "name": "x7",
633 "bitsize": 64,
634 "offset": 56,
635 "encoding": "uint",
636 "format": "hex",
637 "set": 0,
638 "gcc": 7,
639 "dwarf": 7,
640 "generic": "arg7",
641 "alt-name": "arg7",
644 "name": "x8",
645 "bitsize": 64,
646 "offset": 64,
647 "encoding": "uint",
648 "format": "hex",
649 "set": 0,
650 "gcc": 8,
651 "dwarf": 8,
654 "name": "x9",
655 "bitsize": 64,
656 "offset": 72,
657 "encoding": "uint",
658 "format": "hex",
659 "set": 0,
660 "gcc": 9,
661 "dwarf": 9,
664 "name": "x10",
665 "bitsize": 64,
666 "offset": 80,
667 "encoding": "uint",
668 "format": "hex",
669 "set": 0,
670 "gcc": 10,
671 "dwarf": 10,
674 "name": "x11",
675 "bitsize": 64,
676 "offset": 88,
677 "encoding": "uint",
678 "format": "hex",
679 "set": 0,
680 "gcc": 11,
681 "dwarf": 11,
684 "name": "x12",
685 "bitsize": 64,
686 "offset": 96,
687 "encoding": "uint",
688 "format": "hex",
689 "set": 0,
690 "gcc": 12,
691 "dwarf": 12,
694 "name": "x13",
695 "bitsize": 64,
696 "offset": 104,
697 "encoding": "uint",
698 "format": "hex",
699 "set": 0,
700 "gcc": 13,
701 "dwarf": 13,
704 "name": "x14",
705 "bitsize": 64,
706 "offset": 112,
707 "encoding": "uint",
708 "format": "hex",
709 "set": 0,
710 "gcc": 14,
711 "dwarf": 14,
714 "name": "x15",
715 "bitsize": 64,
716 "offset": 120,
717 "encoding": "uint",
718 "format": "hex",
719 "set": 0,
720 "gcc": 15,
721 "dwarf": 15,
724 "name": "x16",
725 "bitsize": 64,
726 "offset": 128,
727 "encoding": "uint",
728 "format": "hex",
729 "set": 0,
730 "gcc": 16,
731 "dwarf": 16,
734 "name": "x17",
735 "bitsize": 64,
736 "offset": 136,
737 "encoding": "uint",
738 "format": "hex",
739 "set": 0,
740 "gcc": 17,
741 "dwarf": 17,
744 "name": "x18",
745 "bitsize": 64,
746 "offset": 144,
747 "encoding": "uint",
748 "format": "hex",
749 "set": 0,
750 "gcc": 18,
751 "dwarf": 18,
754 "name": "x19",
755 "bitsize": 64,
756 "offset": 152,
757 "encoding": "uint",
758 "format": "hex",
759 "set": 0,
760 "gcc": 19,
761 "dwarf": 19,
764 "name": "x20",
765 "bitsize": 64,
766 "offset": 160,
767 "encoding": "uint",
768 "format": "hex",
769 "set": 0,
770 "gcc": 20,
771 "dwarf": 20,
774 "name": "x21",
775 "bitsize": 64,
776 "offset": 168,
777 "encoding": "uint",
778 "format": "hex",
779 "set": 0,
780 "gcc": 21,
781 "dwarf": 21,
784 "name": "x22",
785 "bitsize": 64,
786 "offset": 176,
787 "encoding": "uint",
788 "format": "hex",
789 "set": 0,
790 "gcc": 22,
791 "dwarf": 22,
794 "name": "x23",
795 "bitsize": 64,
796 "offset": 184,
797 "encoding": "uint",
798 "format": "hex",
799 "set": 0,
800 "gcc": 23,
801 "dwarf": 23,
804 "name": "x24",
805 "bitsize": 64,
806 "offset": 192,
807 "encoding": "uint",
808 "format": "hex",
809 "set": 0,
810 "gcc": 24,
811 "dwarf": 24,
814 "name": "x25",
815 "bitsize": 64,
816 "offset": 200,
817 "encoding": "uint",
818 "format": "hex",
819 "set": 0,
820 "gcc": 25,
821 "dwarf": 25,
824 "name": "x26",
825 "bitsize": 64,
826 "offset": 208,
827 "encoding": "uint",
828 "format": "hex",
829 "set": 0,
830 "gcc": 26,
831 "dwarf": 26,
834 "name": "x27",
835 "bitsize": 64,
836 "offset": 216,
837 "encoding": "uint",
838 "format": "hex",
839 "set": 0,
840 "gcc": 27,
841 "dwarf": 27,
844 "name": "x28",
845 "bitsize": 64,
846 "offset": 224,
847 "encoding": "uint",
848 "format": "hex",
849 "set": 0,
850 "gcc": 28,
851 "dwarf": 28,
854 "name": "x29",
855 "bitsize": 64,
856 "offset": 232,
857 "encoding": "uint",
858 "format": "hex",
859 "set": 0,
860 "gcc": 29,
861 "dwarf": 29,
862 "generic": "fp",
863 "alt-name": "fp",
866 "name": "x30",
867 "bitsize": 64,
868 "offset": 240,
869 "encoding": "uint",
870 "format": "hex",
871 "set": 0,
872 "gcc": 30,
873 "dwarf": 30,
874 "generic": "lr",
875 "alt-name": "lr",
878 "name": "sp",
879 "bitsize": 64,
880 "offset": 248,
881 "encoding": "uint",
882 "format": "hex",
883 "set": 0,
884 "gcc": 31,
885 "dwarf": 31,
886 "generic": "sp",
887 "alt-name": "sp",
890 "name": "pc",
891 "bitsize": 64,
892 "offset": 256,
893 "encoding": "uint",
894 "format": "hex",
895 "set": 0,
896 "gcc": 32,
897 "dwarf": 32,
898 "generic": "pc",
899 "alt-name": "pc",
902 "name": "cpsr",
903 "bitsize": 32,
904 "offset": 264,
905 "encoding": "uint",
906 "format": "hex",
907 "set": 0,
908 "gcc": 33,
909 "dwarf": 33,
913 INTEL64_GPR = [
915 "name": "rax",
916 "bitsize": 64,
917 "offset": 0,
918 "encoding": "uint",
919 "format": "hex",
920 "set": 0,
921 "gcc": 0,
922 "dwarf": 0,
925 "name": "rbx",
926 "bitsize": 64,
927 "offset": 8,
928 "encoding": "uint",
929 "format": "hex",
930 "set": 0,
931 "gcc": 3,
932 "dwarf": 3,
935 "name": "rcx",
936 "bitsize": 64,
937 "offset": 16,
938 "encoding": "uint",
939 "format": "hex",
940 "set": 0,
941 "gcc": 2,
942 "dwarf": 2,
943 "generic": "arg4",
944 "alt-name": "arg4",
947 "name": "rdx",
948 "bitsize": 64,
949 "offset": 24,
950 "encoding": "uint",
951 "format": "hex",
952 "set": 0,
953 "gcc": 1,
954 "dwarf": 1,
955 "generic": "arg3",
956 "alt-name": "arg3",
959 "name": "rdi",
960 "bitsize": 64,
961 "offset": 32,
962 "encoding": "uint",
963 "format": "hex",
964 "set": 0,
965 "gcc": 5,
966 "dwarf": 5,
967 "generic": "arg1",
968 "alt-name": "arg1",
971 "name": "rsi",
972 "bitsize": 64,
973 "offset": 40,
974 "encoding": "uint",
975 "format": "hex",
976 "set": 0,
977 "gcc": 4,
978 "dwarf": 4,
979 "generic": "arg2",
980 "alt-name": "arg2",
983 "name": "rbp",
984 "bitsize": 64,
985 "offset": 48,
986 "encoding": "uint",
987 "format": "hex",
988 "set": 0,
989 "gcc": 6,
990 "dwarf": 6,
991 "generic": "fp",
992 "alt-name": "fp",
995 "name": "rsp",
996 "bitsize": 64,
997 "offset": 56,
998 "encoding": "uint",
999 "format": "hex",
1000 "set": 0,
1001 "gcc": 7,
1002 "dwarf": 7,
1003 "generic": "sp",
1004 "alt-name": "sp",
1007 "name": "r8",
1008 "bitsize": 64,
1009 "offset": 64,
1010 "encoding": "uint",
1011 "format": "hex",
1012 "set": 0,
1013 "gcc": 8,
1014 "dwarf": 8,
1015 "generic": "arg5",
1016 "alt-name": "arg5",
1019 "name": "r9",
1020 "bitsize": 64,
1021 "offset": 72,
1022 "encoding": "uint",
1023 "format": "hex",
1024 "set": 0,
1025 "gcc": 9,
1026 "dwarf": 9,
1027 "generic": "arg6",
1028 "alt-name": "arg6",
1031 "name": "r10",
1032 "bitsize": 64,
1033 "offset": 80,
1034 "encoding": "uint",
1035 "format": "hex",
1036 "set": 0,
1037 "gcc": 10,
1038 "dwarf": 10,
1041 "name": "r11",
1042 "bitsize": 64,
1043 "offset": 88,
1044 "encoding": "uint",
1045 "format": "hex",
1046 "set": 0,
1047 "gcc": 11,
1048 "dwarf": 11,
1051 "name": "r12",
1052 "bitsize": 64,
1053 "offset": 96,
1054 "encoding": "uint",
1055 "format": "hex",
1056 "set": 0,
1057 "gcc": 12,
1058 "dwarf": 12,
1061 "name": "r13",
1062 "bitsize": 64,
1063 "offset": 104,
1064 "encoding": "uint",
1065 "format": "hex",
1066 "set": 0,
1067 "gcc": 13,
1068 "dwarf": 13,
1071 "name": "r14",
1072 "bitsize": 64,
1073 "offset": 112,
1074 "encoding": "uint",
1075 "format": "hex",
1076 "set": 0,
1077 "gcc": 14,
1078 "dwarf": 14,
1081 "name": "r15",
1082 "bitsize": 64,
1083 "offset": 120,
1084 "encoding": "uint",
1085 "format": "hex",
1086 "set": 0,
1087 "gcc": 15,
1088 "dwarf": 15,
1091 "name": "rip",
1092 "bitsize": 64,
1093 "offset": 128,
1094 "encoding": "uint",
1095 "format": "hex",
1096 "set": 0,
1097 "gcc": 16,
1098 "dwarf": 16,
1099 "generic": "pc",
1100 "alt-name": "pc",
1103 "name": "rflags",
1104 "bitsize": 64,
1105 "offset": 136,
1106 "encoding": "uint",
1107 "format": "hex",
1108 "set": 0,
1109 "generic": "flags",
1110 "alt-name": "flags",
1113 "name": "cs",
1114 "bitsize": 64,
1115 "offset": 144,
1116 "encoding": "uint",
1117 "format": "hex",
1118 "set": 0,
1121 "name": "fs",
1122 "bitsize": 64,
1123 "offset": 152,
1124 "encoding": "uint",
1125 "format": "hex",
1126 "set": 0,
1129 "name": "gs",
1130 "bitsize": 64,
1131 "offset": 160,
1132 "encoding": "uint",
1133 "format": "hex",
1134 "set": 0,
1138 ARM64_GPR = [
1140 "name": "x0",
1141 "bitsize": 64,
1142 "offset": 0,
1143 "encoding": "uint",
1144 "format": "hex",
1145 "set": 0,
1146 "gcc": 0,
1147 "dwarf": 0,
1148 "generic": "arg0",
1149 "alt-name": "arg0",
1152 "name": "x1",
1153 "bitsize": 64,
1154 "offset": 8,
1155 "encoding": "uint",
1156 "format": "hex",
1157 "set": 0,
1158 "gcc": 1,
1159 "dwarf": 1,
1160 "generic": "arg1",
1161 "alt-name": "arg1",
1164 "name": "x2",
1165 "bitsize": 64,
1166 "offset": 16,
1167 "encoding": "uint",
1168 "format": "hex",
1169 "set": 0,
1170 "gcc": 2,
1171 "dwarf": 2,
1172 "generic": "arg2",
1173 "alt-name": "arg2",
1176 "name": "x3",
1177 "bitsize": 64,
1178 "offset": 24,
1179 "encoding": "uint",
1180 "format": "hex",
1181 "set": 0,
1182 "gcc": 3,
1183 "dwarf": 3,
1184 "generic": "arg3",
1185 "alt-name": "arg3",
1188 "name": "x4",
1189 "bitsize": 64,
1190 "offset": 32,
1191 "encoding": "uint",
1192 "format": "hex",
1193 "set": 0,
1194 "gcc": 4,
1195 "dwarf": 4,
1196 "generic": "arg4",
1197 "alt-name": "arg4",
1200 "name": "x5",
1201 "bitsize": 64,
1202 "offset": 40,
1203 "encoding": "uint",
1204 "format": "hex",
1205 "set": 0,
1206 "gcc": 5,
1207 "dwarf": 5,
1208 "generic": "arg5",
1209 "alt-name": "arg5",
1212 "name": "x6",
1213 "bitsize": 64,
1214 "offset": 48,
1215 "encoding": "uint",
1216 "format": "hex",
1217 "set": 0,
1218 "gcc": 6,
1219 "dwarf": 6,
1220 "generic": "arg6",
1221 "alt-name": "arg6",
1224 "name": "x7",
1225 "bitsize": 64,
1226 "offset": 56,
1227 "encoding": "uint",
1228 "format": "hex",
1229 "set": 0,
1230 "gcc": 7,
1231 "dwarf": 7,
1232 "generic": "arg7",
1233 "alt-name": "arg7",
1236 "name": "x8",
1237 "bitsize": 64,
1238 "offset": 64,
1239 "encoding": "uint",
1240 "format": "hex",
1241 "set": 0,
1242 "gcc": 8,
1243 "dwarf": 8,
1246 "name": "x9",
1247 "bitsize": 64,
1248 "offset": 72,
1249 "encoding": "uint",
1250 "format": "hex",
1251 "set": 0,
1252 "gcc": 9,
1253 "dwarf": 9,
1256 "name": "x10",
1257 "bitsize": 64,
1258 "offset": 80,
1259 "encoding": "uint",
1260 "format": "hex",
1261 "set": 0,
1262 "gcc": 10,
1263 "dwarf": 10,
1266 "name": "x11",
1267 "bitsize": 64,
1268 "offset": 88,
1269 "encoding": "uint",
1270 "format": "hex",
1271 "set": 0,
1272 "gcc": 11,
1273 "dwarf": 11,
1276 "name": "x12",
1277 "bitsize": 64,
1278 "offset": 96,
1279 "encoding": "uint",
1280 "format": "hex",
1281 "set": 0,
1282 "gcc": 12,
1283 "dwarf": 12,
1286 "name": "x13",
1287 "bitsize": 64,
1288 "offset": 104,
1289 "encoding": "uint",
1290 "format": "hex",
1291 "set": 0,
1292 "gcc": 13,
1293 "dwarf": 13,
1296 "name": "x14",
1297 "bitsize": 64,
1298 "offset": 112,
1299 "encoding": "uint",
1300 "format": "hex",
1301 "set": 0,
1302 "gcc": 14,
1303 "dwarf": 14,
1306 "name": "x15",
1307 "bitsize": 64,
1308 "offset": 120,
1309 "encoding": "uint",
1310 "format": "hex",
1311 "set": 0,
1312 "gcc": 15,
1313 "dwarf": 15,
1316 "name": "x16",
1317 "bitsize": 64,
1318 "offset": 128,
1319 "encoding": "uint",
1320 "format": "hex",
1321 "set": 0,
1322 "gcc": 16,
1323 "dwarf": 16,
1326 "name": "x17",
1327 "bitsize": 64,
1328 "offset": 136,
1329 "encoding": "uint",
1330 "format": "hex",
1331 "set": 0,
1332 "gcc": 17,
1333 "dwarf": 17,
1336 "name": "x18",
1337 "bitsize": 64,
1338 "offset": 144,
1339 "encoding": "uint",
1340 "format": "hex",
1341 "set": 0,
1342 "gcc": 18,
1343 "dwarf": 18,
1346 "name": "x19",
1347 "bitsize": 64,
1348 "offset": 152,
1349 "encoding": "uint",
1350 "format": "hex",
1351 "set": 0,
1352 "gcc": 19,
1353 "dwarf": 19,
1356 "name": "x20",
1357 "bitsize": 64,
1358 "offset": 160,
1359 "encoding": "uint",
1360 "format": "hex",
1361 "set": 0,
1362 "gcc": 20,
1363 "dwarf": 20,
1366 "name": "x21",
1367 "bitsize": 64,
1368 "offset": 168,
1369 "encoding": "uint",
1370 "format": "hex",
1371 "set": 0,
1372 "gcc": 21,
1373 "dwarf": 21,
1376 "name": "x22",
1377 "bitsize": 64,
1378 "offset": 176,
1379 "encoding": "uint",
1380 "format": "hex",
1381 "set": 0,
1382 "gcc": 22,
1383 "dwarf": 22,
1386 "name": "x23",
1387 "bitsize": 64,
1388 "offset": 184,
1389 "encoding": "uint",
1390 "format": "hex",
1391 "set": 0,
1392 "gcc": 23,
1393 "dwarf": 23,
1396 "name": "x24",
1397 "bitsize": 64,
1398 "offset": 192,
1399 "encoding": "uint",
1400 "format": "hex",
1401 "set": 0,
1402 "gcc": 24,
1403 "dwarf": 24,
1406 "name": "x25",
1407 "bitsize": 64,
1408 "offset": 200,
1409 "encoding": "uint",
1410 "format": "hex",
1411 "set": 0,
1412 "gcc": 25,
1413 "dwarf": 25,
1416 "name": "x26",
1417 "bitsize": 64,
1418 "offset": 208,
1419 "encoding": "uint",
1420 "format": "hex",
1421 "set": 0,
1422 "gcc": 26,
1423 "dwarf": 26,
1426 "name": "x27",
1427 "bitsize": 64,
1428 "offset": 216,
1429 "encoding": "uint",
1430 "format": "hex",
1431 "set": 0,
1432 "gcc": 27,
1433 "dwarf": 27,
1436 "name": "x28",
1437 "bitsize": 64,
1438 "offset": 224,
1439 "encoding": "uint",
1440 "format": "hex",
1441 "set": 0,
1442 "gcc": 28,
1443 "dwarf": 28,
1446 "name": "x29",
1447 "bitsize": 64,
1448 "offset": 232,
1449 "encoding": "uint",
1450 "format": "hex",
1451 "set": 0,
1452 "gcc": 29,
1453 "dwarf": 29,
1454 "generic": "fp",
1455 "alt-name": "fp",
1458 "name": "x30",
1459 "bitsize": 64,
1460 "offset": 240,
1461 "encoding": "uint",
1462 "format": "hex",
1463 "set": 0,
1464 "gcc": 30,
1465 "dwarf": 30,
1466 "generic": "lr",
1467 "alt-name": "lr",
1470 "name": "sp",
1471 "bitsize": 64,
1472 "offset": 248,
1473 "encoding": "uint",
1474 "format": "hex",
1475 "set": 0,
1476 "gcc": 31,
1477 "dwarf": 31,
1478 "generic": "sp",
1479 "alt-name": "sp",
1482 "name": "pc",
1483 "bitsize": 64,
1484 "offset": 256,
1485 "encoding": "uint",
1486 "format": "hex",
1487 "set": 0,
1488 "gcc": 32,
1489 "dwarf": 32,
1490 "generic": "pc",
1491 "alt-name": "pc",
1494 "name": "cpsr",
1495 "bitsize": 32,
1496 "offset": 264,
1497 "encoding": "uint",
1498 "format": "hex",
1499 "set": 0,
1500 "gcc": 33,
1501 "dwarf": 33,
1505 INTEL64_GPR = [
1507 "name": "rax",
1508 "bitsize": 64,
1509 "offset": 0,
1510 "encoding": "uint",
1511 "format": "hex",
1512 "set": 0,
1513 "gcc": 0,
1514 "dwarf": 0,
1517 "name": "rbx",
1518 "bitsize": 64,
1519 "offset": 8,
1520 "encoding": "uint",
1521 "format": "hex",
1522 "set": 0,
1523 "gcc": 3,
1524 "dwarf": 3,
1527 "name": "rcx",
1528 "bitsize": 64,
1529 "offset": 16,
1530 "encoding": "uint",
1531 "format": "hex",
1532 "set": 0,
1533 "gcc": 2,
1534 "dwarf": 2,
1535 "generic": "arg4",
1536 "alt-name": "arg4",
1539 "name": "rdx",
1540 "bitsize": 64,
1541 "offset": 24,
1542 "encoding": "uint",
1543 "format": "hex",
1544 "set": 0,
1545 "gcc": 1,
1546 "dwarf": 1,
1547 "generic": "arg3",
1548 "alt-name": "arg3",
1551 "name": "rdi",
1552 "bitsize": 64,
1553 "offset": 32,
1554 "encoding": "uint",
1555 "format": "hex",
1556 "set": 0,
1557 "gcc": 5,
1558 "dwarf": 5,
1559 "generic": "arg1",
1560 "alt-name": "arg1",
1563 "name": "rsi",
1564 "bitsize": 64,
1565 "offset": 40,
1566 "encoding": "uint",
1567 "format": "hex",
1568 "set": 0,
1569 "gcc": 4,
1570 "dwarf": 4,
1571 "generic": "arg2",
1572 "alt-name": "arg2",
1575 "name": "rbp",
1576 "bitsize": 64,
1577 "offset": 48,
1578 "encoding": "uint",
1579 "format": "hex",
1580 "set": 0,
1581 "gcc": 6,
1582 "dwarf": 6,
1583 "generic": "fp",
1584 "alt-name": "fp",
1587 "name": "rsp",
1588 "bitsize": 64,
1589 "offset": 56,
1590 "encoding": "uint",
1591 "format": "hex",
1592 "set": 0,
1593 "gcc": 7,
1594 "dwarf": 7,
1595 "generic": "sp",
1596 "alt-name": "sp",
1599 "name": "r8",
1600 "bitsize": 64,
1601 "offset": 64,
1602 "encoding": "uint",
1603 "format": "hex",
1604 "set": 0,
1605 "gcc": 8,
1606 "dwarf": 8,
1607 "generic": "arg5",
1608 "alt-name": "arg5",
1611 "name": "r9",
1612 "bitsize": 64,
1613 "offset": 72,
1614 "encoding": "uint",
1615 "format": "hex",
1616 "set": 0,
1617 "gcc": 9,
1618 "dwarf": 9,
1619 "generic": "arg6",
1620 "alt-name": "arg6",
1623 "name": "r10",
1624 "bitsize": 64,
1625 "offset": 80,
1626 "encoding": "uint",
1627 "format": "hex",
1628 "set": 0,
1629 "gcc": 10,
1630 "dwarf": 10,
1633 "name": "r11",
1634 "bitsize": 64,
1635 "offset": 88,
1636 "encoding": "uint",
1637 "format": "hex",
1638 "set": 0,
1639 "gcc": 11,
1640 "dwarf": 11,
1643 "name": "r12",
1644 "bitsize": 64,
1645 "offset": 96,
1646 "encoding": "uint",
1647 "format": "hex",
1648 "set": 0,
1649 "gcc": 12,
1650 "dwarf": 12,
1653 "name": "r13",
1654 "bitsize": 64,
1655 "offset": 104,
1656 "encoding": "uint",
1657 "format": "hex",
1658 "set": 0,
1659 "gcc": 13,
1660 "dwarf": 13,
1663 "name": "r14",
1664 "bitsize": 64,
1665 "offset": 112,
1666 "encoding": "uint",
1667 "format": "hex",
1668 "set": 0,
1669 "gcc": 14,
1670 "dwarf": 14,
1673 "name": "r15",
1674 "bitsize": 64,
1675 "offset": 120,
1676 "encoding": "uint",
1677 "format": "hex",
1678 "set": 0,
1679 "gcc": 15,
1680 "dwarf": 15,
1683 "name": "rip",
1684 "bitsize": 64,
1685 "offset": 128,
1686 "encoding": "uint",
1687 "format": "hex",
1688 "set": 0,
1689 "gcc": 16,
1690 "dwarf": 16,
1691 "generic": "pc",
1692 "alt-name": "pc",
1695 "name": "rflags",
1696 "bitsize": 64,
1697 "offset": 136,
1698 "encoding": "uint",
1699 "format": "hex",
1700 "set": 0,
1701 "generic": "flags",
1702 "alt-name": "flags",
1705 "name": "cs",
1706 "bitsize": 64,
1707 "offset": 144,
1708 "encoding": "uint",
1709 "format": "hex",
1710 "set": 0,
1713 "name": "fs",
1714 "bitsize": 64,
1715 "offset": 152,
1716 "encoding": "uint",
1717 "format": "hex",
1718 "set": 0,
1721 "name": "gs",
1722 "bitsize": 64,
1723 "offset": 160,
1724 "encoding": "uint",
1725 "format": "hex",
1726 "set": 0,