Bug Summary

File:tools/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
Warning:line 715, column 39
Called C++ object pointer is null

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name ABISysV_mips64.cpp -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -ffunction-sections -fdata-sections -resource-dir /usr/lib/llvm-8/lib/clang/8.0.0 -D HAVE_ROUND -D LLDB_CONFIGURATION_RELEASE -D _DEBUG -D _GNU_SOURCE -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -I /build/llvm-toolchain-snapshot-8~svn345461/build-llvm/tools/lldb/source/Plugins/ABI/SysV-mips64 -I /build/llvm-toolchain-snapshot-8~svn345461/tools/lldb/source/Plugins/ABI/SysV-mips64 -I /build/llvm-toolchain-snapshot-8~svn345461/build-llvm/tools/lldb/include -I /build/llvm-toolchain-snapshot-8~svn345461/tools/lldb/include -I /build/llvm-toolchain-snapshot-8~svn345461/build-llvm/include -I /build/llvm-toolchain-snapshot-8~svn345461/include -I /usr/include/python2.7 -I /build/llvm-toolchain-snapshot-8~svn345461/tools/clang/include -I /build/llvm-toolchain-snapshot-8~svn345461/build-llvm/tools/lldb/../clang/include -I /build/llvm-toolchain-snapshot-8~svn345461/tools/lldb/source/. -U NDEBUG -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/x86_64-linux-gnu/c++/6.3.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/x86_64-linux-gnu/c++/6.3.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/backward -internal-isystem /usr/include/clang/8.0.0/include/ -internal-isystem /usr/local/include -internal-isystem /usr/lib/llvm-8/lib/clang/8.0.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -Wno-maybe-uninitialized -Wno-comment -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-deprecated-register -Wno-vla-extension -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /build/llvm-toolchain-snapshot-8~svn345461/build-llvm/tools/lldb/source/Plugins/ABI/SysV-mips64 -ferror-limit 19 -fmessage-length 0 -fvisibility-inlines-hidden -fobjc-runtime=gcc -fdiagnostics-show-option -vectorize-loops -vectorize-slp -analyzer-output=html -analyzer-config stable-report-filename=true -o /tmp/scan-build-2018-10-27-211344-32123-1 -x c++ /build/llvm-toolchain-snapshot-8~svn345461/tools/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp -faddrsig
1//===-- ABISysV_mips64.cpp --------------------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "ABISysV_mips64.h"
11
12// C Includes
13// C++ Includes
14// Other libraries and framework includes
15#include "llvm/ADT/STLExtras.h"
16#include "llvm/ADT/Triple.h"
17
18// Project includes
19#include "lldb/Core/Module.h"
20#include "lldb/Core/PluginManager.h"
21#include "lldb/Core/Value.h"
22#include "lldb/Core/ValueObjectConstResult.h"
23#include "lldb/Core/ValueObjectMemory.h"
24#include "lldb/Core/ValueObjectRegister.h"
25#include "lldb/Symbol/UnwindPlan.h"
26#include "lldb/Target/Process.h"
27#include "lldb/Target/RegisterContext.h"
28#include "lldb/Target/StackFrame.h"
29#include "lldb/Target/Target.h"
30#include "lldb/Target/Thread.h"
31#include "lldb/Utility/ConstString.h"
32#include "lldb/Utility/DataExtractor.h"
33#include "lldb/Utility/Log.h"
34#include "lldb/Utility/RegisterValue.h"
35#include "lldb/Utility/Status.h"
36
37using namespace lldb;
38using namespace lldb_private;
39
40enum dwarf_regnums {
41 dwarf_r0 = 0,
42 dwarf_r1,
43 dwarf_r2,
44 dwarf_r3,
45 dwarf_r4,
46 dwarf_r5,
47 dwarf_r6,
48 dwarf_r7,
49 dwarf_r8,
50 dwarf_r9,
51 dwarf_r10,
52 dwarf_r11,
53 dwarf_r12,
54 dwarf_r13,
55 dwarf_r14,
56 dwarf_r15,
57 dwarf_r16,
58 dwarf_r17,
59 dwarf_r18,
60 dwarf_r19,
61 dwarf_r20,
62 dwarf_r21,
63 dwarf_r22,
64 dwarf_r23,
65 dwarf_r24,
66 dwarf_r25,
67 dwarf_r26,
68 dwarf_r27,
69 dwarf_r28,
70 dwarf_r29,
71 dwarf_r30,
72 dwarf_r31,
73 dwarf_sr,
74 dwarf_lo,
75 dwarf_hi,
76 dwarf_bad,
77 dwarf_cause,
78 dwarf_pc
79};
80
81static const RegisterInfo g_register_infos_mips64[] = {
82 // NAME ALT SZ OFF ENCODING FORMAT EH_FRAME
83 // DWARF GENERIC PROCESS PLUGIN
84 // LLDB NATIVE
85 // ======== ====== == === ============= ========== =============
86 // ================= ==================== =================
87 // ====================
88 {"r0",
89 "zero",
90 8,
91 0,
92 eEncodingUint,
93 eFormatHex,
94 {dwarf_r0, dwarf_r0, LLDB_INVALID_REGNUM(4294967295U), LLDB_INVALID_REGNUM(4294967295U),
95 LLDB_INVALID_REGNUM(4294967295U)},
96 nullptr,
97 nullptr,
98 nullptr,
99 0},
100 {"r1",
101 "AT",
102 8,
103 0,
104 eEncodingUint,
105 eFormatHex,
106 {dwarf_r1, dwarf_r1, LLDB_INVALID_REGNUM(4294967295U), LLDB_INVALID_REGNUM(4294967295U),
107 LLDB_INVALID_REGNUM(4294967295U)},
108 nullptr,
109 nullptr,
110 nullptr,
111 0},
112 {"r2",
113 "v0",
114 8,
115 0,
116 eEncodingUint,
117 eFormatHex,
118 {dwarf_r2, dwarf_r2, LLDB_INVALID_REGNUM(4294967295U), LLDB_INVALID_REGNUM(4294967295U),
119 LLDB_INVALID_REGNUM(4294967295U)},
120 nullptr,
121 nullptr,
122 nullptr,
123 0},
124 {"r3",
125 "v1",
126 8,
127 0,
128 eEncodingUint,
129 eFormatHex,
130 {dwarf_r3, dwarf_r3, LLDB_INVALID_REGNUM(4294967295U), LLDB_INVALID_REGNUM(4294967295U),
131 LLDB_INVALID_REGNUM(4294967295U)},
132 nullptr,
133 nullptr,
134 nullptr,
135 0},
136 {"r4",
137 "arg1",
138 8,
139 0,
140 eEncodingUint,
141 eFormatHex,
142 {dwarf_r4, dwarf_r4, LLDB_REGNUM_GENERIC_ARG15, LLDB_INVALID_REGNUM(4294967295U),
143 LLDB_INVALID_REGNUM(4294967295U)},
144 nullptr,
145 nullptr,
146 nullptr,
147 0},
148 {"r5",
149 "arg2",
150 8,
151 0,
152 eEncodingUint,
153 eFormatHex,
154 {dwarf_r5, dwarf_r5, LLDB_REGNUM_GENERIC_ARG26, LLDB_INVALID_REGNUM(4294967295U),
155 LLDB_INVALID_REGNUM(4294967295U)},
156 nullptr,
157 nullptr,
158 nullptr,
159 0},
160 {"r6",
161 "arg3",
162 8,
163 0,
164 eEncodingUint,
165 eFormatHex,
166 {dwarf_r6, dwarf_r6, LLDB_REGNUM_GENERIC_ARG37, LLDB_INVALID_REGNUM(4294967295U),
167 LLDB_INVALID_REGNUM(4294967295U)},
168 nullptr,
169 nullptr,
170 nullptr,
171 0},
172 {"r7",
173 "arg4",
174 8,
175 0,
176 eEncodingUint,
177 eFormatHex,
178 {dwarf_r7, dwarf_r7, LLDB_REGNUM_GENERIC_ARG48, LLDB_INVALID_REGNUM(4294967295U),
179 LLDB_INVALID_REGNUM(4294967295U)},
180 nullptr,
181 nullptr,
182 nullptr,
183 0},
184 {"r8",
185 "arg5",
186 8,
187 0,
188 eEncodingUint,
189 eFormatHex,
190 {dwarf_r8, dwarf_r8, LLDB_REGNUM_GENERIC_ARG59, LLDB_INVALID_REGNUM(4294967295U),
191 LLDB_INVALID_REGNUM(4294967295U)},
192 nullptr,
193 nullptr,
194 nullptr,
195 0},
196 {"r9",
197 "arg6",
198 8,
199 0,
200 eEncodingUint,
201 eFormatHex,
202 {dwarf_r9, dwarf_r9, LLDB_REGNUM_GENERIC_ARG610, LLDB_INVALID_REGNUM(4294967295U),
203 LLDB_INVALID_REGNUM(4294967295U)},
204 nullptr,
205 nullptr,
206 nullptr,
207 0},
208 {"r10",
209 "arg7",
210 8,
211 0,
212 eEncodingUint,
213 eFormatHex,
214 {dwarf_r10, dwarf_r10, LLDB_REGNUM_GENERIC_ARG711, LLDB_INVALID_REGNUM(4294967295U),
215 LLDB_INVALID_REGNUM(4294967295U)},
216 nullptr,
217 nullptr,
218 nullptr,
219 0},
220 {"r11",
221 "arg8",
222 8,
223 0,
224 eEncodingUint,
225 eFormatHex,
226 {dwarf_r11, dwarf_r11, LLDB_REGNUM_GENERIC_ARG812, LLDB_INVALID_REGNUM(4294967295U),
227 LLDB_INVALID_REGNUM(4294967295U)},
228 nullptr,
229 nullptr,
230 nullptr,
231 0},
232 {"r12",
233 nullptr,
234 8,
235 0,
236 eEncodingUint,
237 eFormatHex,
238 {dwarf_r12, dwarf_r12, LLDB_INVALID_REGNUM(4294967295U), LLDB_INVALID_REGNUM(4294967295U),
239 LLDB_INVALID_REGNUM(4294967295U)},
240 nullptr,
241 nullptr,
242 nullptr,
243 0},
244 {"r13",
245 nullptr,
246 8,
247 0,
248 eEncodingUint,
249 eFormatHex,
250 {dwarf_r13, dwarf_r13, LLDB_INVALID_REGNUM(4294967295U), LLDB_INVALID_REGNUM(4294967295U),
251 LLDB_INVALID_REGNUM(4294967295U)},
252 nullptr,
253 nullptr,
254 nullptr,
255 0},
256 {"r14",
257 nullptr,
258 8,
259 0,
260 eEncodingUint,
261 eFormatHex,
262 {dwarf_r14, dwarf_r14, LLDB_INVALID_REGNUM(4294967295U), LLDB_INVALID_REGNUM(4294967295U),
263 LLDB_INVALID_REGNUM(4294967295U)},
264 nullptr,
265 nullptr,
266 nullptr,
267 0},
268 {"r15",
269 nullptr,
270 8,
271 0,
272 eEncodingUint,
273 eFormatHex,
274 {dwarf_r15, dwarf_r15, LLDB_INVALID_REGNUM(4294967295U), LLDB_INVALID_REGNUM(4294967295U),
275 LLDB_INVALID_REGNUM(4294967295U)},
276 nullptr,
277 nullptr,
278 nullptr,
279 0},
280 {"r16",
281 nullptr,
282 8,
283 0,
284 eEncodingUint,
285 eFormatHex,
286 {dwarf_r16, dwarf_r16, LLDB_INVALID_REGNUM(4294967295U), LLDB_INVALID_REGNUM(4294967295U),
287 LLDB_INVALID_REGNUM(4294967295U)},
288 nullptr,
289 nullptr,
290 nullptr,
291 0},
292 {"r17",
293 nullptr,
294 8,
295 0,
296 eEncodingUint,
297 eFormatHex,
298 {dwarf_r17, dwarf_r17, LLDB_INVALID_REGNUM(4294967295U), LLDB_INVALID_REGNUM(4294967295U),
299 LLDB_INVALID_REGNUM(4294967295U)},
300 nullptr,
301 nullptr,
302 nullptr,
303 0},
304 {"r18",
305 nullptr,
306 8,
307 0,
308 eEncodingUint,
309 eFormatHex,
310 {dwarf_r18, dwarf_r18, LLDB_INVALID_REGNUM(4294967295U), LLDB_INVALID_REGNUM(4294967295U),
311 LLDB_INVALID_REGNUM(4294967295U)},
312 nullptr,
313 nullptr,
314 nullptr,
315 0},
316 {"r19",
317 nullptr,
318 8,
319 0,
320 eEncodingUint,
321 eFormatHex,
322 {dwarf_r19, dwarf_r19, LLDB_INVALID_REGNUM(4294967295U), LLDB_INVALID_REGNUM(4294967295U),
323 LLDB_INVALID_REGNUM(4294967295U)},
324 nullptr,
325 nullptr,
326 nullptr,
327 0},
328 {"r20",
329 nullptr,
330 8,
331 0,
332 eEncodingUint,
333 eFormatHex,
334 {dwarf_r20, dwarf_r20, LLDB_INVALID_REGNUM(4294967295U), LLDB_INVALID_REGNUM(4294967295U),
335 LLDB_INVALID_REGNUM(4294967295U)},
336 nullptr,
337 nullptr,
338 nullptr,
339 0},
340 {"r21",
341 nullptr,
342 8,
343 0,
344 eEncodingUint,
345 eFormatHex,
346 {dwarf_r21, dwarf_r21, LLDB_INVALID_REGNUM(4294967295U), LLDB_INVALID_REGNUM(4294967295U),
347 LLDB_INVALID_REGNUM(4294967295U)},
348 nullptr,
349 nullptr,
350 nullptr,
351 0},
352 {"r22",
353 nullptr,
354 8,
355 0,
356 eEncodingUint,
357 eFormatHex,
358 {dwarf_r22, dwarf_r22, LLDB_INVALID_REGNUM(4294967295U), LLDB_INVALID_REGNUM(4294967295U),
359 LLDB_INVALID_REGNUM(4294967295U)},
360 nullptr,
361 nullptr,
362 nullptr,
363 0},
364 {"r23",
365 nullptr,
366 8,
367 0,
368 eEncodingUint,
369 eFormatHex,
370 {dwarf_r23, dwarf_r23, LLDB_INVALID_REGNUM(4294967295U), LLDB_INVALID_REGNUM(4294967295U),
371 LLDB_INVALID_REGNUM(4294967295U)},
372 nullptr,
373 nullptr,
374 nullptr,
375 0},
376 {"r24",
377 nullptr,
378 8,
379 0,
380 eEncodingUint,
381 eFormatHex,
382 {dwarf_r24, dwarf_r24, LLDB_INVALID_REGNUM(4294967295U), LLDB_INVALID_REGNUM(4294967295U),
383 LLDB_INVALID_REGNUM(4294967295U)},
384 nullptr,
385 nullptr,
386 nullptr,
387 0},
388 {"r25",
389 nullptr,
390 8,
391 0,
392 eEncodingUint,
393 eFormatHex,
394 {dwarf_r25, dwarf_r25, LLDB_INVALID_REGNUM(4294967295U), LLDB_INVALID_REGNUM(4294967295U),
395 LLDB_INVALID_REGNUM(4294967295U)},
396 nullptr,
397 nullptr,
398 nullptr,
399 0},
400 {"r26",
401 nullptr,
402 8,
403 0,
404 eEncodingUint,
405 eFormatHex,
406 {dwarf_r26, dwarf_r26, LLDB_INVALID_REGNUM(4294967295U), LLDB_INVALID_REGNUM(4294967295U),
407 LLDB_INVALID_REGNUM(4294967295U)},
408 nullptr,
409 nullptr,
410 nullptr,
411 0},
412 {"r27",
413 nullptr,
414 8,
415 0,
416 eEncodingUint,
417 eFormatHex,
418 {dwarf_r27, dwarf_r27, LLDB_INVALID_REGNUM(4294967295U), LLDB_INVALID_REGNUM(4294967295U),
419 LLDB_INVALID_REGNUM(4294967295U)},
420 nullptr,
421 nullptr,
422 nullptr,
423 0},
424 {"r28",
425 "gp",
426 8,
427 0,
428 eEncodingUint,
429 eFormatHex,
430 {dwarf_r28, dwarf_r28, LLDB_INVALID_REGNUM(4294967295U), LLDB_INVALID_REGNUM(4294967295U),
431 LLDB_INVALID_REGNUM(4294967295U)},
432 nullptr,
433 nullptr,
434 nullptr,
435 0},
436 {"r29",
437 "sp",
438 8,
439 0,
440 eEncodingUint,
441 eFormatHex,
442 {dwarf_r29, dwarf_r29, LLDB_REGNUM_GENERIC_SP1, LLDB_INVALID_REGNUM(4294967295U),
443 LLDB_INVALID_REGNUM(4294967295U)},
444 nullptr,
445 nullptr,
446 nullptr,
447 0},
448 {"r30",
449 "fp",
450 8,
451 0,
452 eEncodingUint,
453 eFormatHex,
454 {dwarf_r30, dwarf_r30, LLDB_REGNUM_GENERIC_FP2, LLDB_INVALID_REGNUM(4294967295U),
455 LLDB_INVALID_REGNUM(4294967295U)},
456 nullptr,
457 nullptr,
458 nullptr,
459 0},
460 {"r31",
461 "ra",
462 8,
463 0,
464 eEncodingUint,
465 eFormatHex,
466 {dwarf_r31, dwarf_r31, LLDB_REGNUM_GENERIC_RA3, LLDB_INVALID_REGNUM(4294967295U),
467 LLDB_INVALID_REGNUM(4294967295U)},
468 nullptr,
469 nullptr,
470 nullptr,
471 0},
472 {"sr",
473 nullptr,
474 4,
475 0,
476 eEncodingUint,
477 eFormatHex,
478 {dwarf_sr, dwarf_sr, LLDB_REGNUM_GENERIC_FLAGS4, LLDB_INVALID_REGNUM(4294967295U),
479 LLDB_INVALID_REGNUM(4294967295U)},
480 nullptr,
481 nullptr,
482 nullptr,
483 0},
484 {"lo",
485 nullptr,
486 8,
487 0,
488 eEncodingUint,
489 eFormatHex,
490 {dwarf_lo, dwarf_lo, LLDB_INVALID_REGNUM(4294967295U), LLDB_INVALID_REGNUM(4294967295U),
491 LLDB_INVALID_REGNUM(4294967295U)},
492 nullptr,
493 nullptr,
494 nullptr,
495 0},
496 {"hi",
497 nullptr,
498 8,
499 0,
500 eEncodingUint,
501 eFormatHex,
502 {dwarf_hi, dwarf_hi, LLDB_INVALID_REGNUM(4294967295U), LLDB_INVALID_REGNUM(4294967295U),
503 LLDB_INVALID_REGNUM(4294967295U)},
504 nullptr,
505 nullptr,
506 nullptr,
507 0},
508 {"bad",
509 nullptr,
510 8,
511 0,
512 eEncodingUint,
513 eFormatHex,
514 {dwarf_bad, dwarf_bad, LLDB_INVALID_REGNUM(4294967295U), LLDB_INVALID_REGNUM(4294967295U),
515 LLDB_INVALID_REGNUM(4294967295U)},
516 nullptr,
517 nullptr,
518 nullptr,
519 0},
520 {"cause",
521 nullptr,
522 8,
523 0,
524 eEncodingUint,
525 eFormatHex,
526 {dwarf_cause, dwarf_cause, LLDB_INVALID_REGNUM(4294967295U), LLDB_INVALID_REGNUM(4294967295U),
527 LLDB_INVALID_REGNUM(4294967295U)},
528 nullptr,
529 nullptr,
530 nullptr,
531 0},
532 {"pc",
533 nullptr,
534 8,
535 0,
536 eEncodingUint,
537 eFormatHex,
538 {dwarf_pc, dwarf_pc, LLDB_REGNUM_GENERIC_PC0, LLDB_INVALID_REGNUM(4294967295U),
539 LLDB_INVALID_REGNUM(4294967295U)},
540 nullptr,
541 nullptr,
542 nullptr,
543 0},
544};
545
546static const uint32_t k_num_register_infos =
547 llvm::array_lengthof(g_register_infos_mips64);
548
549const lldb_private::RegisterInfo *
550ABISysV_mips64::GetRegisterInfoArray(uint32_t &count) {
551 count = k_num_register_infos;
552 return g_register_infos_mips64;
553}
554
555size_t ABISysV_mips64::GetRedZoneSize() const { return 0; }
556
557//------------------------------------------------------------------
558// Static Functions
559//------------------------------------------------------------------
560
561ABISP
562ABISysV_mips64::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec &arch) {
563 static ABISP g_abi_sp;
564 const llvm::Triple::ArchType arch_type = arch.GetTriple().getArch();
565 if ((arch_type == llvm::Triple::mips64) ||
566 (arch_type == llvm::Triple::mips64el)) {
567 if (!g_abi_sp)
568 g_abi_sp.reset(new ABISysV_mips64(process_sp));
569 return g_abi_sp;
570 }
571 return ABISP();
572}
573
574bool ABISysV_mips64::PrepareTrivialCall(Thread &thread, addr_t sp,
575 addr_t func_addr, addr_t return_addr,
576 llvm::ArrayRef<addr_t> args) const {
577 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS(1u << 8)));
578
579 if (log) {
580 StreamString s;
581 s.Printf("ABISysV_mips64::PrepareTrivialCall (tid = 0x%" PRIx64"l" "x"
582 ", sp = 0x%" PRIx64"l" "x" ", func_addr = 0x%" PRIx64"l" "x"
583 ", return_addr = 0x%" PRIx64"l" "x",
584 thread.GetID(), (uint64_t)sp, (uint64_t)func_addr,
585 (uint64_t)return_addr);
586
587 for (size_t i = 0; i < args.size(); ++i)
588 s.Printf(", arg%zd = 0x%" PRIx64"l" "x", i + 1, args[i]);
589 s.PutCString(")");
590 log->PutString(s.GetString());
591 }
592
593 RegisterContext *reg_ctx = thread.GetRegisterContext().get();
594 if (!reg_ctx)
595 return false;
596
597 const RegisterInfo *reg_info = nullptr;
598
599 if (args.size() > 8) // TODO handle more than 8 arguments
600 return false;
601
602 for (size_t i = 0; i < args.size(); ++i) {
603 reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric,
604 LLDB_REGNUM_GENERIC_ARG15 + i);
605 if (log)
606 log->Printf("About to write arg%zd (0x%" PRIx64"l" "x" ") into %s", i + 1,
607 args[i], reg_info->name);
608 if (!reg_ctx->WriteRegisterFromUnsigned(reg_info, args[i]))
609 return false;
610 }
611
612 // First, align the SP
613
614 if (log)
615 log->Printf("16-byte aligning SP: 0x%" PRIx64"l" "x" " to 0x%" PRIx64"l" "x",
616 (uint64_t)sp, (uint64_t)(sp & ~0xfull));
617
618 sp &= ~(0xfull); // 16-byte alignment
619
620 Status error;
621 const RegisterInfo *pc_reg_info =
622 reg_ctx->GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC0);
623 const RegisterInfo *sp_reg_info =
624 reg_ctx->GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP1);
625 const RegisterInfo *ra_reg_info =
626 reg_ctx->GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_RA3);
627 const RegisterInfo *r25_info = reg_ctx->GetRegisterInfoByName("r25", 0);
628 const RegisterInfo *r0_info = reg_ctx->GetRegisterInfoByName("zero", 0);
629
630 if (log)
631 log->Printf("Writing R0: 0x%" PRIx64"l" "x", (uint64_t)0);
632
633 /* Write r0 with 0, in case we are stopped in syscall,
634 * such setting prevents automatic decrement of the PC.
635 * This clears the bug 23659 for MIPS.
636 */
637 if (!reg_ctx->WriteRegisterFromUnsigned(r0_info, (uint64_t)0))
638 return false;
639
640 if (log)
641 log->Printf("Writing SP: 0x%" PRIx64"l" "x", (uint64_t)sp);
642
643 // Set "sp" to the requested value
644 if (!reg_ctx->WriteRegisterFromUnsigned(sp_reg_info, sp))
645 return false;
646
647 if (log)
648 log->Printf("Writing RA: 0x%" PRIx64"l" "x", (uint64_t)return_addr);
649
650 // Set "ra" to the return address
651 if (!reg_ctx->WriteRegisterFromUnsigned(ra_reg_info, return_addr))
652 return false;
653
654 if (log)
655 log->Printf("Writing PC: 0x%" PRIx64"l" "x", (uint64_t)func_addr);
656
657 // Set pc to the address of the called function.
658 if (!reg_ctx->WriteRegisterFromUnsigned(pc_reg_info, func_addr))
659 return false;
660
661 if (log)
662 log->Printf("Writing r25: 0x%" PRIx64"l" "x", (uint64_t)func_addr);
663
664 // All callers of position independent functions must place the address of
665 // the called function in t9 (r25)
666 if (!reg_ctx->WriteRegisterFromUnsigned(r25_info, func_addr))
667 return false;
668
669 return true;
670}
671
672bool ABISysV_mips64::GetArgumentValues(Thread &thread,
673 ValueList &values) const {
674 return false;
675}
676
677Status ABISysV_mips64::SetReturnValueObject(lldb::StackFrameSP &frame_sp,
678 lldb::ValueObjectSP &new_value_sp) {
679 Status error;
680 if (!new_value_sp) {
1
Assuming the condition is false
2
Taking false branch
681 error.SetErrorString("Empty value object for return value.");
682 return error;
683 }
684
685 CompilerType compiler_type = new_value_sp->GetCompilerType();
686 if (!compiler_type) {
3
Taking false branch
687 error.SetErrorString("Null clang type for return value.");
688 return error;
689 }
690
691 Thread *thread = frame_sp->GetThread().get();
692
693 RegisterContext *reg_ctx = thread->GetRegisterContext().get();
4
'reg_ctx' initialized here
694
695 if (!reg_ctx)
5
Assuming 'reg_ctx' is null
6
Taking true branch
696 error.SetErrorString("no registers are available");
697
698 DataExtractor data;
699 Status data_error;
700 size_t num_bytes = new_value_sp->GetData(data, data_error);
701 if (data_error.Fail()) {
7
Assuming the condition is false
8
Taking false branch
702 error.SetErrorStringWithFormat(
703 "Couldn't convert return value to raw data: %s",
704 data_error.AsCString());
705 return error;
706 }
707
708 const uint32_t type_flags = compiler_type.GetTypeInfo(nullptr);
709
710 if (type_flags & eTypeIsScalar || type_flags & eTypeIsPointer) {
9
Assuming the condition is true
711 if (type_flags & eTypeIsInteger || type_flags & eTypeIsPointer) {
10
Assuming the condition is true
712 lldb::offset_t offset = 0;
713
714 if (num_bytes <= 16) {
11
Assuming 'num_bytes' is <= 16
12
Taking true branch
715 const RegisterInfo *r2_info = reg_ctx->GetRegisterInfoByName("r2", 0);
13
Called C++ object pointer is null
716 if (num_bytes <= 8) {
717 uint64_t raw_value = data.GetMaxU64(&offset, num_bytes);
718
719 if (!reg_ctx->WriteRegisterFromUnsigned(r2_info, raw_value))
720 error.SetErrorString("failed to write register r2");
721 } else {
722 uint64_t raw_value = data.GetMaxU64(&offset, 8);
723 if (reg_ctx->WriteRegisterFromUnsigned(r2_info, raw_value)) {
724 const RegisterInfo *r3_info =
725 reg_ctx->GetRegisterInfoByName("r3", 0);
726 raw_value = data.GetMaxU64(&offset, num_bytes - offset);
727
728 if (!reg_ctx->WriteRegisterFromUnsigned(r3_info, raw_value))
729 error.SetErrorString("failed to write register r3");
730 } else
731 error.SetErrorString("failed to write register r2");
732 }
733 } else {
734 error.SetErrorString("We don't support returning longer than 128 bit "
735 "integer values at present.");
736 }
737 } else if (type_flags & eTypeIsFloat) {
738 error.SetErrorString("TODO: Handle Float Types.");
739 }
740 } else if (type_flags & eTypeIsVector) {
741 error.SetErrorString("returning vector values are not supported");
742 }
743
744 return error;
745}
746
747ValueObjectSP ABISysV_mips64::GetReturnValueObjectSimple(
748 Thread &thread, CompilerType &return_compiler_type) const {
749 ValueObjectSP return_valobj_sp;
750 return return_valobj_sp;
751}
752
753ValueObjectSP ABISysV_mips64::GetReturnValueObjectImpl(
754 Thread &thread, CompilerType &return_compiler_type) const {
755 ValueObjectSP return_valobj_sp;
756 Value value;
757 Status error;
758
759 ExecutionContext exe_ctx(thread.shared_from_this());
760 if (exe_ctx.GetTargetPtr() == nullptr || exe_ctx.GetProcessPtr() == nullptr)
761 return return_valobj_sp;
762
763 value.SetCompilerType(return_compiler_type);
764
765 RegisterContext *reg_ctx = thread.GetRegisterContext().get();
766 if (!reg_ctx)
767 return return_valobj_sp;
768
769 Target *target = exe_ctx.GetTargetPtr();
770 const ArchSpec target_arch = target->GetArchitecture();
771 ByteOrder target_byte_order = target_arch.GetByteOrder();
772 const size_t byte_size = return_compiler_type.GetByteSize(nullptr);
773 const uint32_t type_flags = return_compiler_type.GetTypeInfo(nullptr);
774 uint32_t fp_flag =
775 target_arch.GetFlags() & lldb_private::ArchSpec::eMIPS_ABI_FP_mask;
776
777 const RegisterInfo *r2_info = reg_ctx->GetRegisterInfoByName("r2", 0);
778 const RegisterInfo *r3_info = reg_ctx->GetRegisterInfoByName("r3", 0);
779
780 if (type_flags & eTypeIsScalar || type_flags & eTypeIsPointer) {
781 value.SetValueType(Value::eValueTypeScalar);
782
783 bool success = false;
784 if (type_flags & eTypeIsInteger || type_flags & eTypeIsPointer) {
785 // Extract the register context so we can read arguments from registers
786 // In MIPS register "r2" (v0) holds the integer function return values
787
788 uint64_t raw_value = reg_ctx->ReadRegisterAsUnsigned(r2_info, 0);
789
790 const bool is_signed = (type_flags & eTypeIsSigned) != 0;
791 switch (byte_size) {
792 default:
793 break;
794
795 case sizeof(uint64_t):
796 if (is_signed)
797 value.GetScalar() = (int64_t)(raw_value);
798 else
799 value.GetScalar() = (uint64_t)(raw_value);
800 success = true;
801 break;
802
803 case sizeof(uint32_t):
804 if (is_signed)
805 value.GetScalar() = (int32_t)(raw_value & UINT32_MAX(4294967295U));
806 else
807 value.GetScalar() = (uint32_t)(raw_value & UINT32_MAX(4294967295U));
808 success = true;
809 break;
810
811 case sizeof(uint16_t):
812 if (is_signed)
813 value.GetScalar() = (int16_t)(raw_value & UINT16_MAX(65535));
814 else
815 value.GetScalar() = (uint16_t)(raw_value & UINT16_MAX(65535));
816 success = true;
817 break;
818
819 case sizeof(uint8_t):
820 if (is_signed)
821 value.GetScalar() = (int8_t)(raw_value & UINT8_MAX(255));
822 else
823 value.GetScalar() = (uint8_t)(raw_value & UINT8_MAX(255));
824 success = true;
825 break;
826 }
827 } else if (type_flags & eTypeIsFloat) {
828 if (type_flags & eTypeIsComplex) {
829 // Don't handle complex yet.
830 } else if (IsSoftFloat(fp_flag)) {
831 uint64_t raw_value = reg_ctx->ReadRegisterAsUnsigned(r2_info, 0);
832 switch (byte_size) {
833 case 4:
834 value.GetScalar() = *((float *)(&raw_value));
835 success = true;
836 break;
837 case 8:
838 value.GetScalar() = *((double *)(&raw_value));
839 success = true;
840 break;
841 case 16:
842 uint64_t result[2];
843 if (target_byte_order == eByteOrderLittle) {
844 result[0] = raw_value;
845 result[1] = reg_ctx->ReadRegisterAsUnsigned(r3_info, 0);
846 value.GetScalar() = *((long double *)(result));
847 } else {
848 result[0] = reg_ctx->ReadRegisterAsUnsigned(r3_info, 0);
849 result[1] = raw_value;
850 value.GetScalar() = *((long double *)(result));
851 }
852 success = true;
853 break;
854 }
855
856 } else {
857 if (byte_size <= sizeof(long double)) {
858 const RegisterInfo *f0_info = reg_ctx->GetRegisterInfoByName("f0", 0);
859
860 RegisterValue f0_value;
861 DataExtractor f0_data;
862
863 reg_ctx->ReadRegister(f0_info, f0_value);
864
865 f0_value.GetData(f0_data);
866
867 lldb::offset_t offset = 0;
868 if (byte_size == sizeof(float)) {
869 value.GetScalar() = (float)f0_data.GetFloat(&offset);
870 success = true;
871 } else if (byte_size == sizeof(double)) {
872 value.GetScalar() = (double)f0_data.GetDouble(&offset);
873 success = true;
874 } else if (byte_size == sizeof(long double)) {
875 const RegisterInfo *f2_info =
876 reg_ctx->GetRegisterInfoByName("f2", 0);
877 RegisterValue f2_value;
878 DataExtractor f2_data;
879 reg_ctx->ReadRegister(f2_info, f2_value);
880 DataExtractor *copy_from_extractor = nullptr;
881 DataBufferSP data_sp(new DataBufferHeap(16, 0));
882 DataExtractor return_ext(
883 data_sp, target_byte_order,
884 target->GetArchitecture().GetAddressByteSize());
885
886 if (target_byte_order == eByteOrderLittle) {
887 copy_from_extractor = &f0_data;
888 copy_from_extractor->CopyByteOrderedData(
889 0, 8, data_sp->GetBytes(), byte_size - 8, target_byte_order);
890 f2_value.GetData(f2_data);
891 copy_from_extractor = &f2_data;
892 copy_from_extractor->CopyByteOrderedData(
893 0, 8, data_sp->GetBytes() + 8, byte_size - 8,
894 target_byte_order);
895 } else {
896 copy_from_extractor = &f0_data;
897 copy_from_extractor->CopyByteOrderedData(
898 0, 8, data_sp->GetBytes() + 8, byte_size - 8,
899 target_byte_order);
900 f2_value.GetData(f2_data);
901 copy_from_extractor = &f2_data;
902 copy_from_extractor->CopyByteOrderedData(
903 0, 8, data_sp->GetBytes(), byte_size - 8, target_byte_order);
904 }
905
906 return_valobj_sp = ValueObjectConstResult::Create(
907 &thread, return_compiler_type, ConstString(""), return_ext);
908 return return_valobj_sp;
909 }
910 }
911 }
912 }
913
914 if (success)
915 return_valobj_sp = ValueObjectConstResult::Create(
916 thread.GetStackFrameAtIndex(0).get(), value, ConstString(""));
917 } else if (type_flags & eTypeIsStructUnion || type_flags & eTypeIsClass ||
918 type_flags & eTypeIsVector) {
919 // Any structure of up to 16 bytes in size is returned in the registers.
920 if (byte_size <= 16) {
921 DataBufferSP data_sp(new DataBufferHeap(16, 0));
922 DataExtractor return_ext(data_sp, target_byte_order,
923 target->GetArchitecture().GetAddressByteSize());
924
925 RegisterValue r2_value, r3_value, f0_value, f1_value, f2_value;
926 // Tracks how much bytes of r2 and r3 registers we've consumed so far
927 uint32_t integer_bytes = 0;
928
929 // True if return values are in FP return registers.
930 bool use_fp_regs = 0;
931 // True if we found any non floating point field in structure.
932 bool found_non_fp_field = 0;
933 // True if return values are in r2 register.
934 bool use_r2 = 0;
935 // True if return values are in r3 register.
936 bool use_r3 = 0;
937 // True if the result is copied into our data buffer
938 bool sucess = 0;
939 std::string name;
940 bool is_complex;
941 uint32_t count;
942 const uint32_t num_children = return_compiler_type.GetNumFields();
943
944 // A structure consisting of one or two FP values (and nothing else) will
945 // be returned in the two FP return-value registers i.e fp0 and fp2.
946 if (num_children <= 2) {
947 uint64_t field_bit_offset = 0;
948
949 // Check if this structure contains only floating point fields
950 for (uint32_t idx = 0; idx < num_children; idx++) {
951 CompilerType field_compiler_type =
952 return_compiler_type.GetFieldAtIndex(idx, name, &field_bit_offset,
953 nullptr, nullptr);
954
955 if (field_compiler_type.IsFloatingPointType(count, is_complex))
956 use_fp_regs = 1;
957 else
958 found_non_fp_field = 1;
959 }
960
961 if (use_fp_regs && !found_non_fp_field) {
962 // We have one or two FP-only values in this structure. Get it from
963 // f0/f2 registers.
964 DataExtractor f0_data, f1_data, f2_data;
965 const RegisterInfo *f0_info = reg_ctx->GetRegisterInfoByName("f0", 0);
966 const RegisterInfo *f1_info = reg_ctx->GetRegisterInfoByName("f1", 0);
967 const RegisterInfo *f2_info = reg_ctx->GetRegisterInfoByName("f2", 0);
968
969 reg_ctx->ReadRegister(f0_info, f0_value);
970 reg_ctx->ReadRegister(f2_info, f2_value);
971
972 f0_value.GetData(f0_data);
973
974 for (uint32_t idx = 0; idx < num_children; idx++) {
975 CompilerType field_compiler_type =
976 return_compiler_type.GetFieldAtIndex(
977 idx, name, &field_bit_offset, nullptr, nullptr);
978 const size_t field_byte_width =
979 field_compiler_type.GetByteSize(nullptr);
980
981 DataExtractor *copy_from_extractor = nullptr;
982 uint64_t return_value[2];
983 offset_t offset = 0;
984
985 if (idx == 0) {
986 // This case is for long double type.
987 if (field_byte_width == 16) {
988
989 // If structure contains long double type, then it is returned
990 // in fp0/fp1 registers.
991 if (target_byte_order == eByteOrderLittle) {
992 return_value[0] = f0_data.GetU64(&offset);
993 reg_ctx->ReadRegister(f1_info, f1_value);
994 f1_value.GetData(f1_data);
995 offset = 0;
996 return_value[1] = f1_data.GetU64(&offset);
997 } else {
998 return_value[1] = f0_data.GetU64(&offset);
999 reg_ctx->ReadRegister(f1_info, f1_value);
1000 f1_value.GetData(f1_data);
1001 offset = 0;
1002 return_value[0] = f1_data.GetU64(&offset);
1003 }
1004
1005 f0_data.SetData(return_value, field_byte_width,
1006 target_byte_order);
1007 }
1008 copy_from_extractor = &f0_data; // This is in f0, copy from
1009 // register to our result
1010 // structure
1011 } else {
1012 f2_value.GetData(f2_data);
1013 // This is in f2, copy from register to our result structure
1014 copy_from_extractor = &f2_data;
1015 }
1016
1017 // Sanity check to avoid crash
1018 if (!copy_from_extractor ||
1019 field_byte_width > copy_from_extractor->GetByteSize())
1020 return return_valobj_sp;
1021
1022 // copy the register contents into our data buffer
1023 copy_from_extractor->CopyByteOrderedData(
1024 0, field_byte_width,
1025 data_sp->GetBytes() + (field_bit_offset / 8), field_byte_width,
1026 target_byte_order);
1027 }
1028
1029 // The result is in our data buffer. Create a variable object out of
1030 // it
1031 return_valobj_sp = ValueObjectConstResult::Create(
1032 &thread, return_compiler_type, ConstString(""), return_ext);
1033
1034 return return_valobj_sp;
1035 }
1036 }
1037
1038 // If we reach here, it means this structure either contains more than
1039 // two fields or it contains at least one non floating point type. In
1040 // that case, all fields are returned in GP return registers.
1041 for (uint32_t idx = 0; idx < num_children; idx++) {
1042 uint64_t field_bit_offset = 0;
1043 bool is_signed;
1044 uint32_t padding;
1045
1046 CompilerType field_compiler_type = return_compiler_type.GetFieldAtIndex(
1047 idx, name, &field_bit_offset, nullptr, nullptr);
1048 const size_t field_byte_width =
1049 field_compiler_type.GetByteSize(nullptr);
1050
1051 // if we don't know the size of the field (e.g. invalid type), just
1052 // bail out
1053 if (field_byte_width == 0)
1054 break;
1055
1056 uint32_t field_byte_offset = field_bit_offset / 8;
1057
1058 if (field_compiler_type.IsIntegerOrEnumerationType(is_signed) ||
1059 field_compiler_type.IsPointerType() ||
1060 field_compiler_type.IsFloatingPointType(count, is_complex)) {
1061 padding = field_byte_offset - integer_bytes;
1062
1063 if (integer_bytes < 8) {
1064 // We have not yet consumed r2 completely.
1065 if (integer_bytes + field_byte_width + padding <= 8) {
1066 // This field fits in r2, copy its value from r2 to our result
1067 // structure
1068 integer_bytes = integer_bytes + field_byte_width +
1069 padding; // Increase the consumed bytes.
1070 use_r2 = 1;
1071 } else {
1072 // There isn't enough space left in r2 for this field, so this
1073 // will be in r3.
1074 integer_bytes = integer_bytes + field_byte_width +
1075 padding; // Increase the consumed bytes.
1076 use_r3 = 1;
1077 }
1078 }
1079 // We already have consumed at-least 8 bytes that means r2 is done,
1080 // and this field will be in r3. Check if this field can fit in r3.
1081 else if (integer_bytes + field_byte_width + padding <= 16) {
1082 integer_bytes = integer_bytes + field_byte_width + padding;
1083 use_r3 = 1;
1084 } else {
1085 // There isn't any space left for this field, this should not
1086 // happen as we have already checked the overall size is not
1087 // greater than 16 bytes. For now, return a nullptr return value
1088 // object.
1089 return return_valobj_sp;
1090 }
1091 }
1092 }
1093 // Vector types up to 16 bytes are returned in GP return registers
1094 if (type_flags & eTypeIsVector) {
1095 if (byte_size <= 8)
1096 use_r2 = 1;
1097 else {
1098 use_r2 = 1;
1099 use_r3 = 1;
1100 }
1101 }
1102
1103 if (use_r2) {
1104 reg_ctx->ReadRegister(r2_info, r2_value);
1105
1106 const size_t bytes_copied = r2_value.GetAsMemoryData(
1107 r2_info, data_sp->GetBytes(), r2_info->byte_size, target_byte_order,
1108 error);
1109 if (bytes_copied != r2_info->byte_size)
1110 return return_valobj_sp;
1111 sucess = 1;
1112 }
1113 if (use_r3) {
1114 reg_ctx->ReadRegister(r3_info, r3_value);
1115 const size_t bytes_copied = r3_value.GetAsMemoryData(
1116 r3_info, data_sp->GetBytes() + r2_info->byte_size,
1117 r3_info->byte_size, target_byte_order, error);
1118
1119 if (bytes_copied != r3_info->byte_size)
1120 return return_valobj_sp;
1121 sucess = 1;
1122 }
1123 if (sucess) {
1124 // The result is in our data buffer. Create a variable object out of
1125 // it
1126 return_valobj_sp = ValueObjectConstResult::Create(
1127 &thread, return_compiler_type, ConstString(""), return_ext);
1128 }
1129 return return_valobj_sp;
1130 }
1131
1132 // Any structure/vector greater than 16 bytes in size is returned in
1133 // memory. The pointer to that memory is returned in r2.
1134 uint64_t mem_address = reg_ctx->ReadRegisterAsUnsigned(
1135 reg_ctx->GetRegisterInfoByName("r2", 0), 0);
1136
1137 // We have got the address. Create a memory object out of it
1138 return_valobj_sp = ValueObjectMemory::Create(
1139 &thread, "", Address(mem_address, nullptr), return_compiler_type);
1140 }
1141 return return_valobj_sp;
1142}
1143
1144bool ABISysV_mips64::CreateFunctionEntryUnwindPlan(UnwindPlan &unwind_plan) {
1145 unwind_plan.Clear();
1146 unwind_plan.SetRegisterKind(eRegisterKindDWARF);
1147
1148 UnwindPlan::RowSP row(new UnwindPlan::Row);
1149
1150 // Our Call Frame Address is the stack pointer value
1151 row->GetCFAValue().SetIsRegisterPlusOffset(dwarf_r29, 0);
1152
1153 // The previous PC is in the RA
1154 row->SetRegisterLocationToRegister(dwarf_pc, dwarf_r31, true);
1155 unwind_plan.AppendRow(row);
1156
1157 // All other registers are the same.
1158
1159 unwind_plan.SetSourceName("mips64 at-func-entry default");
1160 unwind_plan.SetSourcedFromCompiler(eLazyBoolNo);
1161 unwind_plan.SetReturnAddressRegister(dwarf_r31);
1162 return true;
1163}
1164
1165bool ABISysV_mips64::CreateDefaultUnwindPlan(UnwindPlan &unwind_plan) {
1166 unwind_plan.Clear();
1167 unwind_plan.SetRegisterKind(eRegisterKindDWARF);
1168
1169 UnwindPlan::RowSP row(new UnwindPlan::Row);
1170
1171 row->GetCFAValue().SetIsRegisterPlusOffset(dwarf_r29, 0);
1172
1173 row->SetRegisterLocationToRegister(dwarf_pc, dwarf_r31, true);
1174
1175 unwind_plan.AppendRow(row);
1176 unwind_plan.SetSourceName("mips64 default unwind plan");
1177 unwind_plan.SetSourcedFromCompiler(eLazyBoolNo);
1178 unwind_plan.SetUnwindPlanValidAtAllInstructions(eLazyBoolNo);
1179 return true;
1180}
1181
1182bool ABISysV_mips64::RegisterIsVolatile(const RegisterInfo *reg_info) {
1183 return !RegisterIsCalleeSaved(reg_info);
1184}
1185
1186bool ABISysV_mips64::IsSoftFloat(uint32_t fp_flag) const {
1187 return (fp_flag == lldb_private::ArchSpec::eMIPS_ABI_FP_SOFT);
1188}
1189
1190bool ABISysV_mips64::RegisterIsCalleeSaved(const RegisterInfo *reg_info) {
1191 if (reg_info) {
1192 // Preserved registers are :
1193 // r16-r23, r28, r29, r30, r31
1194
1195 int reg = ((reg_info->byte_offset) / 8);
1196
1197 bool save = (reg >= 16) && (reg <= 23);
1198 save |= (reg >= 28) && (reg <= 31);
1199
1200 return save;
1201 }
1202 return false;
1203}
1204
1205void ABISysV_mips64::Initialize() {
1206 PluginManager::RegisterPlugin(
1207 GetPluginNameStatic(), "System V ABI for mips64 targets", CreateInstance);
1208}
1209
1210void ABISysV_mips64::Terminate() {
1211 PluginManager::UnregisterPlugin(CreateInstance);
1212}
1213
1214lldb_private::ConstString ABISysV_mips64::GetPluginNameStatic() {
1215 static ConstString g_name("sysv-mips64");
1216 return g_name;
1217}
1218
1219//------------------------------------------------------------------
1220// PluginInterface protocol
1221//------------------------------------------------------------------
1222
1223lldb_private::ConstString ABISysV_mips64::GetPluginName() {
1224 return GetPluginNameStatic();
1225}
1226
1227uint32_t ABISysV_mips64::GetPluginVersion() { return 1; }