GDB (xrefs)
Loading...
Searching...
No Matches
expop.h
Go to the documentation of this file.
1/* Definitions for expressions in GDB
2
3 Copyright (C) 2020-2023 Free Software Foundation, Inc.
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20#ifndef EXPOP_H
21#define EXPOP_H
22
23#include "c-lang.h"
24#include "cp-abi.h"
25#include "expression.h"
26#include "language.h"
27#include "objfiles.h"
28#include "gdbsupport/traits.h"
29#include "gdbsupport/enum-flags.h"
30
31struct agent_expr;
32struct axs_value;
33
34extern void gen_expr_binop (struct expression *exp,
35 enum exp_opcode op,
37 struct agent_expr *ax, struct axs_value *value);
38extern void gen_expr_structop (struct expression *exp,
39 enum exp_opcode op,
40 expr::operation *lhs,
41 const char *name,
42 struct agent_expr *ax, struct axs_value *value);
43extern void gen_expr_unop (struct expression *exp,
44 enum exp_opcode op,
45 expr::operation *lhs,
46 struct agent_expr *ax, struct axs_value *value);
47
48extern struct value *eval_op_scope (struct type *expect_type,
49 struct expression *exp,
50 enum noside noside,
51 struct type *type, const char *string);
52extern struct value *eval_op_var_msym_value (struct type *expect_type,
53 struct expression *exp,
54 enum noside noside,
55 bool outermost_p,
56 bound_minimal_symbol msymbol);
57extern struct value *eval_op_var_entry_value (struct type *expect_type,
58 struct expression *exp,
59 enum noside noside, symbol *sym);
60extern struct value *eval_op_func_static_var (struct type *expect_type,
61 struct expression *exp,
62 enum noside noside,
63 value *func, const char *var);
64extern struct value *eval_op_register (struct type *expect_type,
65 struct expression *exp,
66 enum noside noside, const char *name);
67extern struct value *eval_op_structop_struct (struct type *expect_type,
68 struct expression *exp,
69 enum noside noside,
70 struct value *arg1,
71 const char *string);
72extern struct value *eval_op_structop_ptr (struct type *expect_type,
73 struct expression *exp,
74 enum noside noside,
75 struct value *arg1,
76 const char *string);
77extern struct value *eval_op_member (struct type *expect_type,
78 struct expression *exp,
79 enum noside noside,
80 struct value *arg1, struct value *arg2);
81extern struct value *eval_op_add (struct type *expect_type,
82 struct expression *exp,
83 enum noside noside,
84 struct value *arg1, struct value *arg2);
85extern struct value *eval_op_sub (struct type *expect_type,
86 struct expression *exp,
87 enum noside noside,
88 struct value *arg1, struct value *arg2);
89extern struct value *eval_op_binary (struct type *expect_type,
90 struct expression *exp,
91 enum noside noside, enum exp_opcode op,
92 struct value *arg1, struct value *arg2);
93extern struct value *eval_op_subscript (struct type *expect_type,
94 struct expression *exp,
95 enum noside noside, enum exp_opcode op,
96 struct value *arg1,
97 struct value *arg2);
98extern struct value *eval_op_equal (struct type *expect_type,
99 struct expression *exp,
100 enum noside noside, enum exp_opcode op,
101 struct value *arg1,
102 struct value *arg2);
103extern struct value *eval_op_notequal (struct type *expect_type,
104 struct expression *exp,
105 enum noside noside, enum exp_opcode op,
106 struct value *arg1,
107 struct value *arg2);
108extern struct value *eval_op_less (struct type *expect_type,
109 struct expression *exp,
110 enum noside noside, enum exp_opcode op,
111 struct value *arg1,
112 struct value *arg2);
113extern struct value *eval_op_gtr (struct type *expect_type,
114 struct expression *exp,
115 enum noside noside, enum exp_opcode op,
116 struct value *arg1,
117 struct value *arg2);
118extern struct value *eval_op_geq (struct type *expect_type,
119 struct expression *exp,
120 enum noside noside, enum exp_opcode op,
121 struct value *arg1,
122 struct value *arg2);
123extern struct value *eval_op_leq (struct type *expect_type,
124 struct expression *exp,
125 enum noside noside, enum exp_opcode op,
126 struct value *arg1,
127 struct value *arg2);
128extern struct value *eval_op_repeat (struct type *expect_type,
129 struct expression *exp,
130 enum noside noside, enum exp_opcode op,
131 struct value *arg1,
132 struct value *arg2);
133extern struct value *eval_op_plus (struct type *expect_type,
134 struct expression *exp,
135 enum noside noside, enum exp_opcode op,
136 struct value *arg1);
137extern struct value *eval_op_neg (struct type *expect_type,
138 struct expression *exp,
139 enum noside noside, enum exp_opcode op,
140 struct value *arg1);
141extern struct value *eval_op_complement (struct type *expect_type,
142 struct expression *exp,
143 enum noside noside,
144 enum exp_opcode op,
145 struct value *arg1);
146extern struct value *eval_op_lognot (struct type *expect_type,
147 struct expression *exp,
148 enum noside noside,
149 enum exp_opcode op,
150 struct value *arg1);
151extern struct value *eval_op_preinc (struct type *expect_type,
152 struct expression *exp,
153 enum noside noside,
154 enum exp_opcode op,
155 struct value *arg1);
156extern struct value *eval_op_predec (struct type *expect_type,
157 struct expression *exp,
158 enum noside noside,
159 enum exp_opcode op,
160 struct value *arg1);
161extern struct value *eval_op_postinc (struct type *expect_type,
162 struct expression *exp,
163 enum noside noside,
164 enum exp_opcode op,
165 struct value *arg1);
166extern struct value *eval_op_postdec (struct type *expect_type,
167 struct expression *exp,
168 enum noside noside,
169 enum exp_opcode op,
170 struct value *arg1);
171extern struct value *eval_op_ind (struct type *expect_type,
172 struct expression *exp,
173 enum noside noside,
174 struct value *arg1);
175extern struct value *eval_op_type (struct type *expect_type,
176 struct expression *exp,
177 enum noside noside, struct type *type);
178extern struct value *eval_op_alignof (struct type *expect_type,
179 struct expression *exp,
180 enum noside noside,
181 struct value *arg1);
182extern struct value *eval_op_memval (struct type *expect_type,
183 struct expression *exp,
184 enum noside noside,
185 struct value *arg1, struct type *type);
186extern struct value *eval_binop_assign_modify (struct type *expect_type,
187 struct expression *exp,
188 enum noside noside,
189 enum exp_opcode op,
190 struct value *arg1,
191 struct value *arg2);
192
193namespace expr
194{
195
196class ada_component;
197
198/* The check_objfile overloads are used to check whether a particular
199 component of some operation references an objfile. The passed-in
200 objfile will never be a debug objfile. */
201
202/* See if EXP_OBJFILE matches OBJFILE. */
203static inline bool
204check_objfile (struct objfile *exp_objfile, struct objfile *objfile)
205{
206 if (exp_objfile->separate_debug_objfile_backlink)
207 exp_objfile = exp_objfile->separate_debug_objfile_backlink;
208 return exp_objfile == objfile;
209}
210
211static inline bool
213{
214 struct objfile *ty_objfile = type->objfile_owner ();
215 if (ty_objfile != nullptr)
216 return check_objfile (ty_objfile, objfile);
217 return false;
218}
219
220static inline bool
221check_objfile (struct symbol *sym, struct objfile *objfile)
222{
223 return check_objfile (sym->objfile (), objfile);
224}
225
226extern bool check_objfile (const struct block *block,
227 struct objfile *objfile);
228
229static inline bool
231{
232 return (check_objfile (sym.symbol, objfile)
233 || check_objfile (sym.block, objfile));
234}
235
236static inline bool
238{
239 return check_objfile (minsym.objfile, objfile);
240}
241
242static inline bool
244{
245 return false;
246}
247
248static inline bool
249check_objfile (const std::string &str, struct objfile *objfile)
250{
251 return false;
252}
253
254static inline bool
256{
257 return op->uses_objfile (objfile);
258}
259
260static inline bool
262{
263 return false;
264}
265
266static inline bool
267check_objfile (ULONGEST val, struct objfile *objfile)
268{
269 return false;
270}
271
272static inline bool
274{
275 return false;
276}
277
278template<typename T>
279static inline bool
280check_objfile (enum_flags<T> val, struct objfile *objfile)
281{
282 return false;
283}
284
285template<typename T>
286static inline bool
287check_objfile (const std::vector<T> &collection, struct objfile *objfile)
288{
289 for (const auto &item : collection)
290 {
291 if (check_objfile (item, objfile))
292 return true;
293 }
294 return false;
295}
296
297template<typename S, typename T>
298static inline bool
299check_objfile (const std::pair<S, T> &item, struct objfile *objfile)
300{
301 return (check_objfile (item.first, objfile)
302 || check_objfile (item.second, objfile));
303}
304
305extern bool check_objfile (const std::unique_ptr<ada_component> &comp,
306 struct objfile *objfile);
307
308static inline void
309dump_for_expression (struct ui_file *stream, int depth,
310 const operation_up &op)
311{
312 if (op == nullptr)
313 gdb_printf (stream, _("%*snullptr\n"), depth, "");
314 else
315 op->dump (stream, depth);
316}
317
318extern void dump_for_expression (struct ui_file *stream, int depth,
319 enum exp_opcode op);
320extern void dump_for_expression (struct ui_file *stream, int depth,
321 const std::string &str);
322extern void dump_for_expression (struct ui_file *stream, int depth,
323 struct type *type);
324extern void dump_for_expression (struct ui_file *stream, int depth,
325 CORE_ADDR addr);
326extern void dump_for_expression (struct ui_file *stream, int depth,
327 const gdb_mpz &addr);
328extern void dump_for_expression (struct ui_file *stream, int depth,
329 internalvar *ivar);
330extern void dump_for_expression (struct ui_file *stream, int depth,
331 symbol *sym);
332extern void dump_for_expression (struct ui_file *stream, int depth,
333 const block_symbol &sym);
334extern void dump_for_expression (struct ui_file *stream, int depth,
336extern void dump_for_expression (struct ui_file *stream, int depth,
337 const block *bl);
338extern void dump_for_expression (struct ui_file *stream, int depth,
339 type_instance_flags flags);
340extern void dump_for_expression (struct ui_file *stream, int depth,
342extern void dump_for_expression (struct ui_file *stream, int depth,
343 enum range_flag flags);
344extern void dump_for_expression (struct ui_file *stream, int depth,
345 const std::unique_ptr<ada_component> &comp);
346
347template<typename T>
348void
349dump_for_expression (struct ui_file *stream, int depth,
350 const std::vector<T> &vals)
351{
352 gdb_printf (stream, _("%*sVector:\n"), depth, "");
353 for (auto &item : vals)
354 dump_for_expression (stream, depth + 1, item);
355}
356
357template<typename X, typename Y>
358void
359dump_for_expression (struct ui_file *stream, int depth,
360 const std::pair<X, Y> &vals)
361{
362 dump_for_expression (stream, depth, vals.first);
363 dump_for_expression (stream, depth, vals.second);
364}
365
366/* Base class for most concrete operations. This class holds data,
367 specified via template parameters, and supplies generic
368 implementations of the 'dump' and 'uses_objfile' methods. */
369template<typename... Arg>
371{
372public:
373
374 explicit tuple_holding_operation (Arg... args)
375 : m_storage (std::forward<Arg> (args)...)
376 {
377 }
378
380
381 bool uses_objfile (struct objfile *objfile) const override
382 {
383 return do_check_objfile<0, Arg...> (objfile, m_storage);
384 }
385
386 void dump (struct ui_file *stream, int depth) const override
387 {
388 dump_for_expression (stream, depth, opcode ());
389 do_dump<0, Arg...> (stream, depth + 1, m_storage);
390 }
391
392protected:
393
394 /* Storage for the data. */
395 std::tuple<Arg...> m_storage;
396
397private:
398
399 /* do_dump does the work of dumping the data. */
400 template<int I, typename... T>
401 typename std::enable_if<I == sizeof... (T), void>::type
402 do_dump (struct ui_file *stream, int depth, const std::tuple<T...> &value)
403 const
404 {
405 }
406
407 template<int I, typename... T>
408 typename std::enable_if<I < sizeof... (T), void>::type
409 do_dump (struct ui_file *stream, int depth, const std::tuple<T...> &value)
410 const
411 {
412 dump_for_expression (stream, depth, std::get<I> (value));
413 do_dump<I + 1, T...> (stream, depth, value);
414 }
415
416 /* do_check_objfile does the work of checking whether this object
417 refers to OBJFILE. */
418 template<int I, typename... T>
419 typename std::enable_if<I == sizeof... (T), bool>::type
420 do_check_objfile (struct objfile *objfile, const std::tuple<T...> &value)
421 const
422 {
423 return false;
424 }
425
426 template<int I, typename... T>
427 typename std::enable_if<I < sizeof... (T), bool>::type
428 do_check_objfile (struct objfile *objfile, const std::tuple<T...> &value)
429 const
430 {
431 if (check_objfile (std::get<I> (value), objfile))
432 return true;
433 return do_check_objfile<I + 1, T...> (objfile, value);
434 }
435};
436
437/* The check_constant overloads are used to decide whether a given
438 concrete operation is a constant. This is done by checking the
439 operands. */
440
441static inline bool
443{
444 return item->constant_p ();
445}
446
447static inline bool
449{
450 return false;
451}
452
453static inline bool
455{
456 return true;
457}
458
459static inline bool
461{
462 return true;
463}
464
465static inline bool
466check_constant (const std::string &str)
467{
468 return true;
469}
470
471static inline bool
472check_constant (ULONGEST cst)
473{
474 return true;
475}
476
477static inline bool
479{
480 return true;
481}
482
483static inline bool
485{
486 enum address_class sc = sym->aclass ();
487 return (sc == LOC_BLOCK
488 || sc == LOC_CONST
489 || sc == LOC_CONST_BYTES
490 || sc == LOC_LABEL);
491}
492
493static inline bool
495{
496 /* We know the block is constant, so we only need to check the
497 symbol. */
498 return check_constant (sym.symbol);
499}
500
501template<typename T>
502static inline bool
503check_constant (const std::vector<T> &collection)
504{
505 for (const auto &item : collection)
506 if (!check_constant (item))
507 return false;
508 return true;
509}
510
511template<typename S, typename T>
512static inline bool
513check_constant (const std::pair<S, T> &item)
514{
515 return check_constant (item.first) && check_constant (item.second);
516}
517
518/* Base class for concrete operations. This class supplies an
519 implementation of 'constant_p' that works by checking the
520 operands. */
521template<typename... Arg>
523 : public tuple_holding_operation<Arg...>
524{
525public:
526
528
529 bool constant_p () const override
530 {
531 return do_check_constant<0, Arg...> (this->m_storage);
532 }
533
534private:
535
536 template<int I, typename... T>
537 typename std::enable_if<I == sizeof... (T), bool>::type
538 do_check_constant (const std::tuple<T...> &value) const
539 {
540 return true;
541 }
542
543 template<int I, typename... T>
544 typename std::enable_if<I < sizeof... (T), bool>::type
545 do_check_constant (const std::tuple<T...> &value) const
546 {
547 if (!check_constant (std::get<I> (value)))
548 return false;
549 return do_check_constant<I + 1, T...> (value);
550 }
551};
552
553/* A floating-point constant. The constant is encoded in the target
554 format. */
555
556typedef std::array<gdb_byte, 16> float_data;
557
558/* An operation that holds a floating-point constant of a given
559 type.
560
561 This does not need the facilities provided by
562 tuple_holding_operation, so it does not use it. */
564 : public operation
565{
566public:
567
569 : m_type (type),
570 m_data (data)
571 {
572 }
573
574 value *evaluate (struct type *expect_type,
575 struct expression *exp,
576 enum noside noside) override
577 {
578 return value_from_contents (m_type, m_data.data ());
579 }
580
581 enum exp_opcode opcode () const override
582 { return OP_FLOAT; }
583
584 bool constant_p () const override
585 { return true; }
586
587 void dump (struct ui_file *stream, int depth) const override;
588
589private:
590
591 struct type *m_type;
593};
594
596 : public maybe_constant_operation<struct type *, std::string>
597{
598public:
599
600 using maybe_constant_operation::maybe_constant_operation;
601
602 value *evaluate (struct type *expect_type,
603 struct expression *exp,
604 enum noside noside) override
605 {
606 return eval_op_scope (expect_type, exp, noside,
607 std::get<0> (m_storage),
608 std::get<1> (m_storage).c_str ());
609 }
610
612 enum noside noside) override;
613
614 value *evaluate_funcall (struct type *expect_type,
615 struct expression *exp,
616 enum noside noside,
617 const std::vector<operation_up> &args) override;
618
619 enum exp_opcode opcode () const override
620 { return OP_SCOPE; }
621
622protected:
623
624 void do_generate_ax (struct expression *exp,
625 struct agent_expr *ax,
626 struct axs_value *value,
627 struct type *cast_type)
628 override;
629};
630
631/* Compute the value of a variable. */
633 : public maybe_constant_operation<block_symbol>
634{
635public:
636
637 using maybe_constant_operation::maybe_constant_operation;
638
639 value *evaluate (struct type *expect_type,
640 struct expression *exp,
641 enum noside noside) override;
642
644 enum noside noside) override;
645
647 override;
648
649 value *evaluate_for_cast (struct type *expect_type,
650 struct expression *exp,
651 enum noside noside) override;
652
654 override;
655
656 value *evaluate_funcall (struct type *expect_type,
657 struct expression *exp,
658 enum noside noside,
659 const std::vector<operation_up> &args) override;
660
661 enum exp_opcode opcode () const override
662 { return OP_VAR_VALUE; }
663
664 /* Return the symbol referenced by this object. */
666 {
667 return std::get<0> (m_storage).symbol;
668 }
669
670protected:
671
672 void do_generate_ax (struct expression *exp,
673 struct agent_expr *ax,
674 struct axs_value *value,
675 struct type *cast_type)
676 override;
677};
678
680 : public tuple_holding_operation<struct type *, gdb_mpz>
681{
682public:
683
685
686 long_const_operation (struct type *type, LONGEST val)
688 { }
689
690 value *evaluate (struct type *expect_type,
691 struct expression *exp,
692 enum noside noside) override
693 {
694 return value_from_mpz (std::get<0> (m_storage), std::get<1> (m_storage));
695 }
696
697 enum exp_opcode opcode () const override
698 { return OP_LONG; }
699
700 bool constant_p () const override
701 { return true; }
702
703protected:
704
705 LONGEST as_longest () const
706 { return std::get<1> (m_storage).as_integer_truncate<LONGEST> (); }
707
708 void do_generate_ax (struct expression *exp,
709 struct agent_expr *ax,
710 struct axs_value *value,
711 struct type *cast_type)
712 override;
713};
714
716 : public maybe_constant_operation<bound_minimal_symbol>
717{
718public:
719
720 using maybe_constant_operation::maybe_constant_operation;
721
722 value *evaluate (struct type *expect_type,
723 struct expression *exp,
724 enum noside noside) override
725 {
726 return eval_op_var_msym_value (expect_type, exp, noside, m_outermost,
727 std::get<0> (m_storage));
728 }
729
731 override;
732
734 override;
735
736 value *evaluate_for_cast (struct type *expect_type,
737 struct expression *exp,
738 enum noside noside) override;
739
740 value *evaluate_funcall (struct type *expect_type,
741 struct expression *exp,
742 enum noside noside,
743 const std::vector<operation_up> &args) override
744 {
745 const char *name = std::get<0> (m_storage).minsym->print_name ();
746 return operation::evaluate_funcall (expect_type, exp, noside, name, args);
747 }
748
749 enum exp_opcode opcode () const override
750 { return OP_VAR_MSYM_VALUE; }
751
752 void set_outermost () override
753 {
754 m_outermost = true;
755 }
756
757protected:
758
759 /* True if this is the outermost operation in the expression. */
760 bool m_outermost = false;
761
762 void do_generate_ax (struct expression *exp,
763 struct agent_expr *ax,
764 struct axs_value *value,
765 struct type *cast_type)
766 override;
767};
768
770 : public tuple_holding_operation<symbol *>
771{
772public:
773
775
776 value *evaluate (struct type *expect_type,
777 struct expression *exp,
778 enum noside noside) override
779 {
780 return eval_op_var_entry_value (expect_type, exp, noside,
781 std::get<0> (m_storage));
782 }
783
784 enum exp_opcode opcode () const override
785 { return OP_VAR_ENTRY_VALUE; }
786};
787
789 : public maybe_constant_operation<operation_up, std::string>
790{
791public:
792
793 using maybe_constant_operation::maybe_constant_operation;
794
795 value *evaluate (struct type *expect_type,
796 struct expression *exp,
797 enum noside noside) override
798 {
799 value *func = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
800 return eval_op_func_static_var (expect_type, exp, noside, func,
801 std::get<1> (m_storage).c_str ());
802 }
803
804 enum exp_opcode opcode () const override
805 { return OP_FUNC_STATIC_VAR; }
806};
807
809 : public tuple_holding_operation<int>
810{
811public:
812
814
815 value *evaluate (struct type *expect_type,
816 struct expression *exp,
817 enum noside noside) override
818 {
819 return access_value_history (std::get<0> (m_storage));
820 }
821
822 enum exp_opcode opcode () const override
823 { return OP_LAST; }
824};
825
827 : public tuple_holding_operation<std::string>
828{
829public:
830
832
833 value *evaluate (struct type *expect_type,
834 struct expression *exp,
835 enum noside noside) override
836 {
837 return eval_op_register (expect_type, exp, noside,
838 std::get<0> (m_storage).c_str ());
839 }
840
841 enum exp_opcode opcode () const override
842 { return OP_REGISTER; }
843
844 /* Return the name of the register. */
845 const char *get_name () const
846 {
847 return std::get<0> (m_storage).c_str ();
848 }
849
850protected:
851
852 void do_generate_ax (struct expression *exp,
853 struct agent_expr *ax,
854 struct axs_value *value,
855 struct type *cast_type)
856 override;
857};
858
860 : public tuple_holding_operation<bool>
861{
862public:
863
865
866 value *evaluate (struct type *expect_type,
867 struct expression *exp,
868 enum noside noside) override
869 {
870 struct type *type = language_bool_type (exp->language_defn, exp->gdbarch);
871 return value_from_longest (type, std::get<0> (m_storage));
872 }
873
874 enum exp_opcode opcode () const override
875 { return OP_BOOL; }
876
877 bool constant_p () const override
878 { return true; }
879};
880
882 : public tuple_holding_operation<internalvar *>
883{
884public:
885
887
888 value *evaluate (struct type *expect_type,
889 struct expression *exp,
890 enum noside noside) override
891 {
892 return value_of_internalvar (exp->gdbarch,
893 std::get<0> (m_storage));
894 }
895
897 {
898 return std::get<0> (m_storage);
899 }
900
901 enum exp_opcode opcode () const override
902 { return OP_INTERNALVAR; }
903
904protected:
905
906 void do_generate_ax (struct expression *exp,
907 struct agent_expr *ax,
908 struct axs_value *value,
909 struct type *cast_type)
910 override;
911};
912
914 : public tuple_holding_operation<std::string>
915{
916public:
917
919
920 value *evaluate (struct type *expect_type,
921 struct expression *exp,
922 enum noside noside) override;
923
924 enum exp_opcode opcode () const override
925 { return OP_STRING; }
926};
927
929 : public maybe_constant_operation<operation_up, operation_up, operation_up>
930{
931public:
932
933 using maybe_constant_operation::maybe_constant_operation;
934
935 value *evaluate (struct type *expect_type,
936 struct expression *exp,
937 enum noside noside) override;
938
939 enum exp_opcode opcode () const override
940 { return TERNOP_SLICE; }
941};
942
944 : public maybe_constant_operation<operation_up, operation_up, operation_up>
945{
946public:
947
948 using maybe_constant_operation::maybe_constant_operation;
949
950 value *evaluate (struct type *expect_type,
951 struct expression *exp,
952 enum noside noside) override
953 {
954 struct value *val
955 = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
956
957 if (value_logical_not (val))
958 return std::get<2> (m_storage)->evaluate (nullptr, exp, noside);
959 return std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
960 }
961
962 enum exp_opcode opcode () const override
963 { return TERNOP_COND; }
964
965protected:
966
967 void do_generate_ax (struct expression *exp,
968 struct agent_expr *ax,
969 struct axs_value *value,
970 struct type *cast_type)
971 override;
972};
973
975 : public maybe_constant_operation<operation_up, operation_up, struct type *>
976{
977public:
978
979 using maybe_constant_operation::maybe_constant_operation;
980
981 value *evaluate (struct type *expect_type,
982 struct expression *exp,
983 enum noside noside) override
984 {
985 value *real = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
986 value *imag = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
987 return value_literal_complex (real, imag,
988 std::get<2> (m_storage));
989 }
990
991 enum exp_opcode opcode () const override
992 { return OP_COMPLEX; }
993};
994
996 : public tuple_holding_operation<operation_up, std::string>
997{
998public:
999
1000 /* Used for completion. Return the field name. */
1001 const std::string &get_string () const
1002 {
1003 return std::get<1> (m_storage);
1004 }
1005
1006 value *evaluate_funcall (struct type *expect_type,
1007 struct expression *exp,
1008 enum noside noside,
1009 const std::vector<operation_up> &args) override;
1010
1011 /* Try to complete this operation in the context of EXP. TRACKER is
1012 the completion tracker to update. Return true if completion was
1013 possible, false otherwise. */
1014 virtual bool complete (struct expression *exp, completion_tracker &tracker)
1015 {
1016 return complete (exp, tracker, "");
1017 }
1018
1019protected:
1020
1021 /* Do the work of the public 'complete' method. PREFIX is prepended
1022 to each result. */
1023 bool complete (struct expression *exp, completion_tracker &tracker,
1024 const char *prefix);
1025
1027};
1028
1031{
1032public:
1033
1034 using structop_base_operation::structop_base_operation;
1035
1036 value *evaluate (struct type *expect_type,
1037 struct expression *exp,
1038 enum noside noside) override
1039 {
1040 value *val =std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
1041 return eval_op_structop_struct (expect_type, exp, noside, val,
1042 std::get<1> (m_storage).c_str ());
1043 }
1044
1045 enum exp_opcode opcode () const override
1046 { return STRUCTOP_STRUCT; }
1047
1048protected:
1049
1050 void do_generate_ax (struct expression *exp,
1051 struct agent_expr *ax,
1052 struct axs_value *value,
1053 struct type *cast_type)
1054 override
1055 {
1056 gen_expr_structop (exp, STRUCTOP_STRUCT,
1057 std::get<0> (this->m_storage).get (),
1058 std::get<1> (this->m_storage).c_str (),
1059 ax, value);
1060 }
1061};
1062
1065{
1066public:
1067
1068 using structop_base_operation::structop_base_operation;
1069
1070 value *evaluate (struct type *expect_type,
1071 struct expression *exp,
1072 enum noside noside) override
1073 {
1074 value *val = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
1075 return eval_op_structop_ptr (expect_type, exp, noside, val,
1076 std::get<1> (m_storage).c_str ());
1077 }
1078
1079 enum exp_opcode opcode () const override
1080 { return STRUCTOP_PTR; }
1081
1082protected:
1083
1084 void do_generate_ax (struct expression *exp,
1085 struct agent_expr *ax,
1086 struct axs_value *value,
1087 struct type *cast_type)
1088 override
1089 {
1090 gen_expr_structop (exp, STRUCTOP_PTR,
1091 std::get<0> (this->m_storage).get (),
1092 std::get<1> (this->m_storage).c_str (),
1093 ax, value);
1094 }
1095};
1096
1098 : public tuple_holding_operation<operation_up, operation_up>
1099{
1100public:
1101
1103
1104 value *evaluate_funcall (struct type *expect_type,
1105 struct expression *exp,
1106 enum noside noside,
1107 const std::vector<operation_up> &args) override;
1108};
1109
1111 : public structop_member_base
1112{
1113public:
1114
1115 using structop_member_base::structop_member_base;
1116
1117 value *evaluate (struct type *expect_type,
1118 struct expression *exp,
1119 enum noside noside) override
1120 {
1121 value *lhs
1122 = std::get<0> (m_storage)->evaluate_for_address (exp, noside);
1123 value *rhs
1124 = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
1125 return eval_op_member (expect_type, exp, noside, lhs, rhs);
1126 }
1127
1128 enum exp_opcode opcode () const override
1129 { return STRUCTOP_MEMBER; }
1130};
1131
1133 : public structop_member_base
1134{
1135public:
1136
1137 using structop_member_base::structop_member_base;
1138
1139 value *evaluate (struct type *expect_type,
1140 struct expression *exp,
1141 enum noside noside) override
1142 {
1143 value *lhs
1144 = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
1145 value *rhs
1146 = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
1147 return eval_op_member (expect_type, exp, noside, lhs, rhs);
1148 }
1149
1150 enum exp_opcode opcode () const override
1151 { return STRUCTOP_MPTR; }
1152};
1153
1155 : public maybe_constant_operation<operation_up, operation_up>
1156{
1157public:
1158
1159 using maybe_constant_operation::maybe_constant_operation;
1160
1161 value *evaluate (struct type *expect_type,
1162 struct expression *exp,
1163 enum noside noside) override
1164 {
1165 value *lhs
1166 = std::get<0> (m_storage)->evaluate_with_coercion (exp, noside);
1167 value *rhs
1168 = std::get<1> (m_storage)->evaluate_with_coercion (exp, noside);
1169 return value_concat (lhs, rhs);
1170 }
1171
1172 enum exp_opcode opcode () const override
1173 { return BINOP_CONCAT; }
1174};
1175
1177 : public maybe_constant_operation<operation_up, operation_up>
1178{
1179public:
1180
1181 using maybe_constant_operation::maybe_constant_operation;
1182
1183 value *evaluate (struct type *expect_type,
1184 struct expression *exp,
1185 enum noside noside) override
1186 {
1187 value *lhs
1188 = std::get<0> (m_storage)->evaluate_with_coercion (exp, noside);
1189 value *rhs
1190 = std::get<1> (m_storage)->evaluate_with_coercion (exp, noside);
1191 return eval_op_add (expect_type, exp, noside, lhs, rhs);
1192 }
1193
1194 enum exp_opcode opcode () const override
1195 { return BINOP_ADD; }
1196
1197protected:
1198
1199 void do_generate_ax (struct expression *exp,
1200 struct agent_expr *ax,
1201 struct axs_value *value,
1202 struct type *cast_type)
1203 override
1204 {
1205 gen_expr_binop (exp, BINOP_ADD,
1206 std::get<0> (this->m_storage).get (),
1207 std::get<1> (this->m_storage).get (),
1208 ax, value);
1209 }
1210};
1211
1213 : public maybe_constant_operation<operation_up, operation_up>
1214{
1215public:
1216
1217 using maybe_constant_operation::maybe_constant_operation;
1218
1219 value *evaluate (struct type *expect_type,
1220 struct expression *exp,
1221 enum noside noside) override
1222 {
1223 value *lhs
1224 = std::get<0> (m_storage)->evaluate_with_coercion (exp, noside);
1225 value *rhs
1226 = std::get<1> (m_storage)->evaluate_with_coercion (exp, noside);
1227 return eval_op_sub (expect_type, exp, noside, lhs, rhs);
1228 }
1229
1230 enum exp_opcode opcode () const override
1231 { return BINOP_SUB; }
1232
1233protected:
1234
1235 void do_generate_ax (struct expression *exp,
1236 struct agent_expr *ax,
1237 struct axs_value *value,
1238 struct type *cast_type)
1239 override
1240 {
1241 gen_expr_binop (exp, BINOP_SUB,
1242 std::get<0> (this->m_storage).get (),
1243 std::get<1> (this->m_storage).get (),
1244 ax, value);
1245 }
1246};
1247
1248typedef struct value *binary_ftype (struct type *expect_type,
1249 struct expression *exp,
1250 enum noside noside, enum exp_opcode op,
1251 struct value *arg1, struct value *arg2);
1252
1253template<enum exp_opcode OP, binary_ftype FUNC>
1255 : public maybe_constant_operation<operation_up, operation_up>
1256{
1257public:
1258
1259 using maybe_constant_operation::maybe_constant_operation;
1260
1261 value *evaluate (struct type *expect_type,
1262 struct expression *exp,
1263 enum noside noside) override
1264 {
1265 value *lhs
1266 = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
1267 value *rhs
1268 = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
1269 return FUNC (expect_type, exp, noside, OP, lhs, rhs);
1270 }
1271
1272 enum exp_opcode opcode () const override
1273 { return OP; }
1274};
1275
1276template<enum exp_opcode OP, binary_ftype FUNC>
1278 : public binop_operation<OP, FUNC>
1279{
1280public:
1281
1282 using binop_operation<OP, FUNC>::binop_operation;
1283
1284protected:
1285
1286 void do_generate_ax (struct expression *exp,
1287 struct agent_expr *ax,
1288 struct axs_value *value,
1289 struct type *cast_type)
1290 override
1291 {
1292 gen_expr_binop (exp, OP,
1293 std::get<0> (this->m_storage).get (),
1294 std::get<1> (this->m_storage).get (),
1295 ax, value);
1296 }
1297};
1298
1302
1314
1316 : public usual_ax_binop_operation<BINOP_SUBSCRIPT, eval_op_subscript>
1317{
1318public:
1319 using usual_ax_binop_operation<BINOP_SUBSCRIPT,
1320 eval_op_subscript>::usual_ax_binop_operation;
1321
1322 value *evaluate_for_sizeof (struct expression *exp,
1323 enum noside noside) override;
1324};
1326/* Implementation of comparison operations. */
1327template<enum exp_opcode OP, binary_ftype FUNC>
1329 : public usual_ax_binop_operation<OP, FUNC>
1330{
1331public:
1333 using usual_ax_binop_operation<OP, FUNC>::usual_ax_binop_operation;
1334
1335 value *evaluate (struct type *expect_type,
1336 struct expression *exp,
1337 enum noside noside) override
1338 {
1339 value *lhs
1340 = std::get<0> (this->m_storage)->evaluate (nullptr, exp, noside);
1341 value *rhs
1342 = std::get<1> (this->m_storage)->evaluate (lhs->type (), exp,
1343 noside);
1344 return FUNC (expect_type, exp, noside, OP, lhs, rhs);
1346};
1347
1348class equal_operation
1349 : public comparison_operation<BINOP_EQUAL, eval_op_equal>
1350{
1351public:
1353 using comparison_operation::comparison_operation;
1354
1355 operation *get_lhs () const
1356 {
1357 return std::get<0> (m_storage).get ();
1358 }
1359
1360 operation *get_rhs () const
1361 {
1362 return std::get<1> (m_storage).get ();
1372
1373/* Implement the GDB '@' repeat operator. */
1374class repeat_operation
1375 : public binop_operation<BINOP_REPEAT, eval_op_repeat>
1376{
1377 using binop_operation<BINOP_REPEAT, eval_op_repeat>::binop_operation;
1378
1379protected:
1380
1381 void do_generate_ax (struct expression *exp,
1382 struct agent_expr *ax,
1383 struct axs_value *value,
1384 struct type *cast_type)
1385 override;
1386};
1387
1388/* C-style comma operator. */
1389class comma_operation
1390 : public maybe_constant_operation<operation_up, operation_up>
1391{
1392public:
1393
1394 using maybe_constant_operation::maybe_constant_operation;
1395
1396 value *evaluate (struct type *expect_type,
1397 struct expression *exp,
1398 enum noside noside) override
1399 {
1400 /* The left-hand-side is only evaluated for side effects, so don't
1401 bother in other modes. */
1402 if (noside == EVAL_NORMAL)
1403 std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
1404 return std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
1405 }
1406
1407 enum exp_opcode opcode () const override
1408 { return BINOP_COMMA; }
1409
1410protected:
1411
1412 void do_generate_ax (struct expression *exp,
1413 struct agent_expr *ax,
1414 struct axs_value *value,
1415 struct type *cast_type)
1416 override;
1417};
1418
1419typedef struct value *unary_ftype (struct type *expect_type,
1420 struct expression *exp,
1421 enum noside noside, enum exp_opcode op,
1422 struct value *arg1);
1423
1424/* Base class for unary operations. */
1425template<enum exp_opcode OP, unary_ftype FUNC>
1426class unop_operation
1427 : public maybe_constant_operation<operation_up>
1428{
1429public:
1430
1431 using maybe_constant_operation::maybe_constant_operation;
1432
1433 value *evaluate (struct type *expect_type,
1434 struct expression *exp,
1435 enum noside noside) override
1436 {
1437 value *val = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
1438 return FUNC (expect_type, exp, noside, OP, val);
1439 }
1440
1441 enum exp_opcode opcode () const override
1442 { return OP; }
1443};
1445/* Unary operations that can also be turned into agent expressions in
1446 the "usual" way. */
1447template<enum exp_opcode OP, unary_ftype FUNC>
1449 : public unop_operation<OP, FUNC>
1450{
1451 using unop_operation<OP, FUNC>::unop_operation;
1452
1453protected:
1454
1455 void do_generate_ax (struct expression *exp,
1456 struct agent_expr *ax,
1457 struct axs_value *value,
1458 struct type *cast_type)
1459 override
1460 {
1461 gen_expr_unop (exp, OP,
1462 std::get<0> (this->m_storage).get (),
1463 ax, value);
1473
1474/* Handle pre- and post- increment and -decrement. */
1475template<enum exp_opcode OP, unary_ftype FUNC>
1477 : public tuple_holding_operation<operation_up>
1478{
1479public:
1480
1482
1483 value *evaluate (struct type *expect_type,
1484 struct expression *exp,
1485 enum noside noside) override
1486 {
1487 value *val = std::get<0> (m_storage)->evaluate (expect_type, exp, noside);
1488 return FUNC (expect_type, exp, noside, OP, val);
1491 enum exp_opcode opcode () const override
1492 { return OP; }
1493};
1494
1497using predec_operation
1503
1504/* Base class for implementations of UNOP_IND. */
1506 : public tuple_holding_operation<operation_up>
1507{
1508public:
1509
1511
1512 value *evaluate (struct type *expect_type,
1513 struct expression *exp,
1514 enum noside noside) override
1515 {
1516 if (expect_type != nullptr && expect_type->code () == TYPE_CODE_PTR)
1517 expect_type = check_typedef (expect_type)->target_type ();
1518 value *val = std::get<0> (m_storage)->evaluate (expect_type, exp, noside);
1519 return eval_op_ind (expect_type, exp, noside, val);
1520 }
1521
1523 enum noside noside) override;
1524
1525 value *evaluate_for_sizeof (struct expression *exp,
1526 enum noside noside) override;
1527
1528 enum exp_opcode opcode () const override
1529 { return UNOP_IND; }
1530};
1531
1532/* Ordinary UNOP_IND implementation. */
1535{
1536public:
1537
1538 using unop_ind_base_operation::unop_ind_base_operation;
1539
1540protected:
1541
1542 void do_generate_ax (struct expression *exp,
1543 struct agent_expr *ax,
1544 struct axs_value *value,
1545 struct type *cast_type)
1546 override
1547 {
1548 gen_expr_unop (exp, UNOP_IND,
1549 std::get<0> (this->m_storage).get (),
1550 ax, value);
1551 }
1553
1554/* Implement OP_TYPE. */
1555class type_operation
1556 : public tuple_holding_operation<struct type *>
1557{
1558public:
1561
1562 value *evaluate (struct type *expect_type,
1563 struct expression *exp,
1564 enum noside noside) override
1565 {
1566 return eval_op_type (expect_type, exp, noside, std::get<0> (m_storage));
1568
1569 enum exp_opcode opcode () const override
1570 { return OP_TYPE; }
1571
1572 bool constant_p () const override
1573 { return true; }
1575
1576/* Implement the "typeof" operation. */
1577class typeof_operation
1578 : public maybe_constant_operation<operation_up>
1579{
1580public:
1581
1582 using maybe_constant_operation::maybe_constant_operation;
1583
1584 value *evaluate (struct type *expect_type,
1585 struct expression *exp,
1586 enum noside noside) override
1587 {
1589 return std::get<0> (m_storage)->evaluate (nullptr, exp,
1591 else
1592 error (_("Attempt to use a type as an expression"));
1593 }
1594
1595 enum exp_opcode opcode () const override
1596 { return OP_TYPEOF; }
1598
1599/* Implement 'decltype'. */
1601 : public maybe_constant_operation<operation_up>
1602{
1603public:
1604
1605 using maybe_constant_operation::maybe_constant_operation;
1606
1607 value *evaluate (struct type *expect_type,
1608 struct expression *exp,
1609 enum noside noside) override
1610 {
1612 {
1613 value *result
1614 = std::get<0> (m_storage)->evaluate (nullptr, exp,
1616 enum exp_opcode sub_op = std::get<0> (m_storage)->opcode ();
1617 if (sub_op == BINOP_SUBSCRIPT
1618 || sub_op == STRUCTOP_MEMBER
1619 || sub_op == STRUCTOP_MPTR
1620 || sub_op == UNOP_IND
1621 || sub_op == STRUCTOP_STRUCT
1622 || sub_op == STRUCTOP_PTR
1623 || sub_op == OP_SCOPE)
1624 {
1625 struct type *type = result->type ();
1626
1627 if (!TYPE_IS_REFERENCE (type))
1628 {
1631 }
1632 }
1633
1634 return result;
1636 else
1637 error (_("Attempt to use a type as an expression"));
1638 }
1639
1640 enum exp_opcode opcode () const override
1641 { return OP_DECLTYPE; }
1643
1644/* Implement 'typeid'. */
1645class typeid_operation
1646 : public tuple_holding_operation<operation_up>
1647{
1648public:
1649
1651
1652 value *evaluate (struct type *expect_type,
1653 struct expression *exp,
1654 enum noside noside) override
1655 {
1656 enum exp_opcode sub_op = std::get<0> (m_storage)->opcode ();
1657 enum noside sub_noside
1658 = ((sub_op == OP_TYPE || sub_op == OP_DECLTYPE || sub_op == OP_TYPEOF)
1661
1662 value *result = std::get<0> (m_storage)->evaluate (nullptr, exp,
1663 sub_noside);
1666 return cplus_typeid (result);
1667 }
1668
1669 enum exp_opcode opcode () const override
1670 { return OP_TYPEID; }
1672
1673/* Implement the address-of operation. */
1675 : public maybe_constant_operation<operation_up>
1676{
1677public:
1678
1679 using maybe_constant_operation::maybe_constant_operation;
1680
1681 value *evaluate (struct type *expect_type,
1682 struct expression *exp,
1683 enum noside noside) override
1684 {
1685 /* C++: check for and handle pointer to members. */
1686 return std::get<0> (m_storage)->evaluate_for_address (exp, noside);
1687 }
1688
1689 enum exp_opcode opcode () const override
1690 { return UNOP_ADDR; }
1691
1692 /* Return the subexpression. */
1693 const operation_up &get_expression () const
1694 {
1695 return std::get<0> (m_storage);
1696 }
1697
1698protected:
1699
1700 void do_generate_ax (struct expression *exp,
1701 struct agent_expr *ax,
1702 struct axs_value *value,
1703 struct type *cast_type)
1704 override
1705 {
1706 gen_expr_unop (exp, UNOP_ADDR,
1707 std::get<0> (this->m_storage).get (),
1708 ax, value);
1709 }
1711
1712/* Implement 'sizeof'. */
1714 : public maybe_constant_operation<operation_up>
1715{
1716public:
1718 using maybe_constant_operation::maybe_constant_operation;
1719
1720 value *evaluate (struct type *expect_type,
1721 struct expression *exp,
1722 enum noside noside) override
1723 {
1724 return std::get<0> (m_storage)->evaluate_for_sizeof (exp, noside);
1725 }
1726
1727 enum exp_opcode opcode () const override
1728 { return UNOP_SIZEOF; }
1729
1730protected:
1731
1732 void do_generate_ax (struct expression *exp,
1733 struct agent_expr *ax,
1734 struct axs_value *value,
1735 struct type *cast_type)
1736 override;
1738
1739/* Implement 'alignof'. */
1741 : public maybe_constant_operation<operation_up>
1742{
1743public:
1744
1745 using maybe_constant_operation::maybe_constant_operation;
1747 value *evaluate (struct type *expect_type,
1748 struct expression *exp,
1749 enum noside noside) override
1750 {
1751 value *val = std::get<0> (m_storage)->evaluate (nullptr, exp,
1753 return eval_op_alignof (expect_type, exp, noside, val);
1754 }
1755
1756 enum exp_opcode opcode () const override
1757 { return UNOP_ALIGNOF; }
1759
1760/* Implement UNOP_MEMVAL. */
1762 : public tuple_holding_operation<operation_up, struct type *>
1763{
1764public:
1765
1767
1768 value *evaluate (struct type *expect_type,
1769 struct expression *exp,
1770 enum noside noside) override
1771 {
1772 value *val = std::get<0> (m_storage)->evaluate (expect_type, exp, noside);
1773 return eval_op_memval (expect_type, exp, noside, val,
1774 std::get<1> (m_storage));
1775 }
1776
1778 enum noside noside) override;
1779
1781 enum noside noside) override;
1782
1783 enum exp_opcode opcode () const override
1784 { return UNOP_MEMVAL; }
1785
1786 /* Return the type referenced by this object. */
1787 struct type *get_type () const
1788 {
1789 return std::get<1> (m_storage);
1790 }
1791
1792protected:
1793
1794 void do_generate_ax (struct expression *exp,
1795 struct agent_expr *ax,
1796 struct axs_value *value,
1797 struct type *cast_type)
1798 override;
1800
1801/* Implement UNOP_MEMVAL_TYPE. */
1803 : public tuple_holding_operation<operation_up, operation_up>
1804{
1805public:
1806
1808
1809 value *evaluate (struct type *expect_type,
1810 struct expression *exp,
1811 enum noside noside) override
1812 {
1813 value *typeval
1814 = std::get<0> (m_storage)->evaluate (expect_type, exp,
1816 struct type *type = typeval->type ();
1817 value *val = std::get<1> (m_storage)->evaluate (expect_type, exp, noside);
1818 return eval_op_memval (expect_type, exp, noside, val, type);
1819 }
1820
1821 value *evaluate_for_sizeof (struct expression *exp,
1822 enum noside noside) override;
1823
1825 enum noside noside) override;
1826
1827 enum exp_opcode opcode () const override
1828 { return UNOP_MEMVAL_TYPE; }
1829
1830protected:
1831
1832 void do_generate_ax (struct expression *exp,
1833 struct agent_expr *ax,
1834 struct axs_value *value,
1835 struct type *cast_type)
1836 override;
1838
1839/* Implement the 'this' expression. */
1841 : public tuple_holding_operation<>
1842{
1843public:
1846
1847 value *evaluate (struct type *expect_type,
1848 struct expression *exp,
1849 enum noside noside) override
1850 {
1851 return value_of_this (exp->language_defn);
1852 }
1853
1854 enum exp_opcode opcode () const override
1855 { return OP_THIS; }
1856
1857protected:
1858
1859 void do_generate_ax (struct expression *exp,
1860 struct agent_expr *ax,
1861 struct axs_value *value,
1862 struct type *cast_type)
1863 override;
1864};
1865
1866/* Implement the "type instance" operation. */
1868 : public tuple_holding_operation<type_instance_flags, std::vector<type *>,
1869 operation_up>
1870{
1871public:
1872
1875 value *evaluate (struct type *expect_type,
1876 struct expression *exp,
1877 enum noside noside) override;
1878
1879 enum exp_opcode opcode () const override
1880 { return TYPE_INSTANCE; }
1882
1883/* The assignment operator. */
1884class assign_operation
1885 : public tuple_holding_operation<operation_up, operation_up>
1886{
1887public:
1888
1890
1891 value *evaluate (struct type *expect_type,
1892 struct expression *exp,
1893 enum noside noside) override
1894 {
1895 value *lhs = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
1896 /* Special-case assignments where the left-hand-side is a
1897 convenience variable -- in these, don't bother setting an
1898 expected type. This avoids a weird case where re-assigning a
1899 string or array to an internal variable could error with "Too
1900 many array elements". */
1901 struct type *xtype = (lhs->lval () == lval_internalvar
1902 ? nullptr
1903 : lhs->type ());
1904 value *rhs = std::get<1> (m_storage)->evaluate (xtype, exp, noside);
1905
1907 return lhs;
1908 if (binop_user_defined_p (BINOP_ASSIGN, lhs, rhs))
1909 return value_x_binop (lhs, rhs, BINOP_ASSIGN, OP_NULL, noside);
1910 else
1911 return value_assign (lhs, rhs);
1912 }
1913
1914 enum exp_opcode opcode () const override
1915 { return BINOP_ASSIGN; }
1916
1917 /* Return the left-hand-side of the assignment. */
1918 operation *get_lhs () const
1919 {
1920 return std::get<0> (m_storage).get ();
1921 }
1922
1923protected:
1924
1925 void do_generate_ax (struct expression *exp,
1926 struct agent_expr *ax,
1927 struct axs_value *value,
1928 struct type *cast_type)
1929 override;
1931
1932/* Assignment with modification, like "+=". */
1934 : public tuple_holding_operation<exp_opcode, operation_up, operation_up>
1935{
1936public:
1937
1939
1940 value *evaluate (struct type *expect_type,
1941 struct expression *exp,
1942 enum noside noside) override
1943 {
1944 value *lhs = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
1945 value *rhs = std::get<2> (m_storage)->evaluate (expect_type, exp, noside);
1946 return eval_binop_assign_modify (expect_type, exp, noside,
1947 std::get<0> (m_storage), lhs, rhs);
1948 }
1949
1950 enum exp_opcode opcode () const override
1951 { return BINOP_ASSIGN_MODIFY; }
1952
1953protected:
1954
1955 void do_generate_ax (struct expression *exp,
1956 struct agent_expr *ax,
1957 struct axs_value *value,
1958 struct type *cast_type)
1959 override;
1960};
1961
1962/* Not a cast! Extract a value of a given type from the contents of a
1963 value. The new value is extracted from the least significant bytes
1964 of the old value. The new value's type must be no bigger than the
1965 old values type. */
1967 : public maybe_constant_operation<operation_up, struct type *>
1968{
1969public:
1971 using maybe_constant_operation::maybe_constant_operation;
1972
1973 value *evaluate (struct type *expect_type, struct expression *exp,
1974 enum noside noside) override;
1975
1976 enum exp_opcode opcode () const override
1977 { return UNOP_EXTRACT; }
1978
1979 /* Return the type referenced by this object. */
1980 struct type *get_type () const
1981 {
1982 return std::get<1> (m_storage);
1983 }
1985protected:
1986
1987 void do_generate_ax (struct expression *exp,
1988 struct agent_expr *ax,
1989 struct axs_value *value,
1990 struct type *cast_type) override;
1992
1993/* A type cast. */
1995 : public maybe_constant_operation<operation_up, struct type *>
1996{
1997public:
1998
1999 using maybe_constant_operation::maybe_constant_operation;
2000
2001 value *evaluate (struct type *expect_type,
2002 struct expression *exp,
2003 enum noside noside) override
2004 {
2005 return std::get<0> (m_storage)->evaluate_for_cast (std::get<1> (m_storage),
2006 exp, noside);
2007 }
2008
2009 enum exp_opcode opcode () const override
2010 { return UNOP_CAST; }
2011
2012 /* Return the type referenced by this object. */
2013 struct type *get_type () const
2014 {
2015 return std::get<1> (m_storage);
2016 }
2017
2018protected:
2020 void do_generate_ax (struct expression *exp,
2021 struct agent_expr *ax,
2022 struct axs_value *value,
2023 struct type *cast_type)
2024 override;
2025};
2027/* A cast, but the type comes from an expression, not a "struct
2028 type". */
2030 : public maybe_constant_operation<operation_up, operation_up>
2031{
2032public:
2033
2034 using maybe_constant_operation::maybe_constant_operation;
2035
2036 value *evaluate (struct type *expect_type,
2037 struct expression *exp,
2038 enum noside noside) override
2039 {
2040 value *val = std::get<0> (m_storage)->evaluate (nullptr, exp,
2042 return std::get<1> (m_storage)->evaluate_for_cast (val->type (),
2043 exp, noside);
2044 }
2045
2046 enum exp_opcode opcode () const override
2047 { return UNOP_CAST_TYPE; }
2049protected:
2050
2051 void do_generate_ax (struct expression *exp,
2052 struct agent_expr *ax,
2054 struct type *cast_type)
2055 override;
2056};
2057
2058typedef value *cxx_cast_ftype (struct type *, value *);
2059
2060/* This implements dynamic_cast and reinterpret_cast. static_cast and
2061 const_cast are handled by the ordinary case operations. */
2062template<exp_opcode OP, cxx_cast_ftype FUNC>
2064 : public maybe_constant_operation<operation_up, operation_up>
2065{
2066public:
2067
2068 using maybe_constant_operation::maybe_constant_operation;
2069
2070 value *evaluate (struct type *expect_type,
2071 struct expression *exp,
2072 enum noside noside) override
2073 {
2074 value *val = std::get<0> (m_storage)->evaluate (nullptr, exp,
2076 struct type *type = val->type ();
2077 value *rhs = std::get<1> (m_storage)->evaluate (type, exp, noside);
2078 return FUNC (type, rhs);
2079 }
2080
2081 enum exp_opcode opcode () const override
2082 { return OP; }
2083};
2084
2085using dynamic_cast_operation = cxx_cast_operation<UNOP_DYNAMIC_CAST,
2087using reinterpret_cast_operation = cxx_cast_operation<UNOP_REINTERPRET_CAST,
2089
2090/* Multi-dimensional subscripting. */
2091class multi_subscript_operation
2092 : public tuple_holding_operation<operation_up, std::vector<operation_up>>
2093{
2094public:
2095
2098 value *evaluate (struct type *expect_type,
2099 struct expression *exp,
2100 enum noside noside) override;
2101
2102 enum exp_opcode opcode () const override
2103 { return MULTI_SUBSCRIPT; }
2104};
2105
2106/* The "&&" operator. */
2107class logical_and_operation
2108 : public maybe_constant_operation<operation_up, operation_up>
2109{
2110public:
2111
2112 using maybe_constant_operation::maybe_constant_operation;
2113
2114 value *evaluate (struct type *expect_type,
2115 struct expression *exp,
2116 enum noside noside) override;
2117
2118 enum exp_opcode opcode () const override
2119 { return BINOP_LOGICAL_AND; }
2120
2121protected:
2122
2123 void do_generate_ax (struct expression *exp,
2124 struct agent_expr *ax,
2125 struct axs_value *value,
2126 struct type *cast_type)
2127 override;
2128};
2129
2130/* The "||" operator. */
2132 : public maybe_constant_operation<operation_up, operation_up>
2133{
2134public:
2135
2136 using maybe_constant_operation::maybe_constant_operation;
2137
2138 value *evaluate (struct type *expect_type,
2139 struct expression *exp,
2140 enum noside noside) override;
2141
2142 enum exp_opcode opcode () const override
2143 { return BINOP_LOGICAL_OR; }
2144
2145protected:
2146
2147 void do_generate_ax (struct expression *exp,
2148 struct agent_expr *ax,
2149 struct axs_value *value,
2150 struct type *cast_type)
2151 override;
2152};
2153
2154/* This class implements ADL (aka Koenig) function calls for C++. It
2155 holds the name of the function to call, the block in which the
2156 lookup should be done, and a vector of arguments. */
2158 : public tuple_holding_operation<std::string, const block *,
2159 std::vector<operation_up>>
2160{
2161public:
2162
2165 value *evaluate (struct type *expect_type,
2166 struct expression *exp,
2167 enum noside noside) override;
2168
2169 enum exp_opcode opcode () const override
2170 { return OP_ADL_FUNC; }
2171};
2172
2173/* The OP_ARRAY operation. */
2174class array_operation
2175 : public tuple_holding_operation<int, int, std::vector<operation_up>>
2176{
2177public:
2178
2180
2181 value *evaluate (struct type *expect_type,
2182 struct expression *exp,
2183 enum noside noside) override;
2184
2185 enum exp_opcode opcode () const override
2186 { return OP_ARRAY; }
2188private:
2189
2190 struct value *evaluate_struct_tuple (struct value *struct_val,
2191 struct expression *exp,
2192 enum noside noside, int nargs);
2193};
2195/* A function call. This holds the callee operation and the
2196 arguments. */
2198 : public tuple_holding_operation<operation_up, std::vector<operation_up>>
2199{
2200public:
2201
2204 value *evaluate (struct type *expect_type,
2205 struct expression *exp,
2206 enum noside noside) override
2207 {
2208 return std::get<0> (m_storage)->evaluate_funcall (expect_type, exp, noside,
2209 std::get<1> (m_storage));
2210 }
2211
2212 enum exp_opcode opcode () const override
2213 { return OP_FUNCALL; }
2214};
2215
2216} /* namespace expr */
2217
2218#endif /* EXPOP_H */
constexpr string_view get()
Definition 70483.cc:49
const char *const name
void gen_expr_structop(struct expression *exp, enum exp_opcode op, expr::operation *lhs, const char *name, struct agent_expr *ax, struct axs_value *value)
Definition ax-gdb.c:2247
void gen_expr_binop(struct expression *exp, enum exp_opcode op, expr::operation *lhs, expr::operation *rhs, struct agent_expr *ax, struct axs_value *value)
Definition ax-gdb.c:2230
void gen_expr_unop(struct expression *exp, enum exp_opcode op, expr::operation *lhs, struct agent_expr *ax, struct axs_value *value)
Definition ax-gdb.c:2268
c_string_type_values
Definition c-lang.h:40
enum exp_opcode opcode() const override
Definition expop.h:1194
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:1183
void do_generate_ax(struct expression *exp, struct agent_expr *ax, struct axs_value *value, struct type *cast_type) override
Definition expop.h:1199
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition eval.c:2313
enum exp_opcode opcode() const override
Definition expop.h:2159
enum exp_opcode opcode() const override
Definition expop.h:2175
struct value * evaluate_struct_tuple(struct value *struct_val, struct expression *exp, enum noside noside, int nargs)
Definition eval.c:2339
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition eval.c:2401
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:1930
void do_generate_ax(struct expression *exp, struct agent_expr *ax, struct axs_value *value, struct type *cast_type) override
Definition ax-gdb.c:1948
enum exp_opcode opcode() const override
Definition expop.h:1940
operation * get_lhs() const
Definition expop.h:1908
void do_generate_ax(struct expression *exp, struct agent_expr *ax, struct axs_value *value, struct type *cast_type) override
Definition ax-gdb.c:1919
enum exp_opcode opcode() const override
Definition expop.h:1904
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:1881
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:1261
enum exp_opcode opcode() const override
Definition expop.h:1272
enum exp_opcode opcode() const override
Definition expop.h:874
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:866
bool constant_p() const override
Definition expop.h:877
enum exp_opcode opcode() const override
Definition expop.h:1403
void do_generate_ax(struct expression *exp, struct agent_expr *ax, struct axs_value *value, struct type *cast_type) override
Definition ax-gdb.c:1780
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:1392
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:1332
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:981
enum exp_opcode opcode() const override
Definition expop.h:991
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:1161
enum exp_opcode opcode() const override
Definition expop.h:1172
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:2060
enum exp_opcode opcode() const override
Definition expop.h:2071
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:1597
enum exp_opcode opcode() const override
Definition expop.h:1630
operation * get_rhs() const
Definition expop.h:1357
operation * get_lhs() const
Definition expop.h:1352
void dump(struct ui_file *stream, int depth) const override
Definition expprint.c:212
struct type * m_type
Definition expop.h:591
enum exp_opcode opcode() const override
Definition expop.h:581
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:574
bool constant_p() const override
Definition expop.h:584
float_const_operation(struct type *type, float_data data)
Definition expop.h:568
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:795
enum exp_opcode opcode() const override
Definition expop.h:804
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:2194
enum exp_opcode opcode() const override
Definition expop.h:2202
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:888
void do_generate_ax(struct expression *exp, struct agent_expr *ax, struct axs_value *value, struct type *cast_type) override
Definition ax-gdb.c:1676
enum exp_opcode opcode() const override
Definition expop.h:901
internalvar * get_internalvar() const
Definition expop.h:896
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:815
enum exp_opcode opcode() const override
Definition expop.h:822
void do_generate_ax(struct expression *exp, struct agent_expr *ax, struct axs_value *value, struct type *cast_type) override
Definition ax-gdb.c:2021
enum exp_opcode opcode() const override
Definition expop.h:2108
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition eval.c:2254
enum exp_opcode opcode() const override
Definition expop.h:2132
void do_generate_ax(struct expression *exp, struct agent_expr *ax, struct axs_value *value, struct type *cast_type) override
Definition ax-gdb.c:2051
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition eval.c:2283
bool constant_p() const override
Definition expop.h:700
LONGEST as_longest() const
Definition expop.h:705
long_const_operation(struct type *type, LONGEST val)
Definition expop.h:686
void do_generate_ax(struct expression *exp, struct agent_expr *ax, struct axs_value *value, struct type *cast_type) override
Definition ax-gdb.c:1626
enum exp_opcode opcode() const override
Definition expop.h:697
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:690
std::enable_if< I==sizeof...(T), bool >::type do_check_constant(const std::tuple< T... > &value) const
Definition expop.h:538
bool constant_p() const override
Definition expop.h:529
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition eval.c:2240
enum exp_opcode opcode() const override
Definition expop.h:2092
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:1837
enum exp_opcode opcode() const override
Definition expop.h:1844
void do_generate_ax(struct expression *exp, struct agent_expr *ax, struct axs_value *value, struct type *cast_type) override
Definition ax-gdb.c:1894
virtual value * evaluate_funcall(struct type *expect_type, struct expression *exp, enum noside noside, const std::vector< operation_up > &args)
Definition expression.h:131
operation()=default
virtual enum exp_opcode opcode() const =0
enum exp_opcode opcode() const override
Definition expop.h:841
const char * get_name() const
Definition expop.h:845
void do_generate_ax(struct expression *exp, struct agent_expr *ax, struct axs_value *value, struct type *cast_type) override
Definition ax-gdb.c:1653
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:833
void do_generate_ax(struct expression *exp, struct agent_expr *ax, struct axs_value *value, struct type *cast_type) override
Definition ax-gdb.c:1741
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:602
void do_generate_ax(struct expression *exp, struct agent_expr *ax, struct axs_value *value, struct type *cast_type) override
Definition ax-gdb.c:1613
value * evaluate_for_address(struct expression *exp, enum noside noside) override
Definition eval.c:2587
enum exp_opcode opcode() const override
Definition expop.h:619
value * evaluate_funcall(struct type *expect_type, struct expression *exp, enum noside noside, const std::vector< operation_up > &args) override
Definition eval.c:711
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition eval.c:1148
enum exp_opcode opcode() const override
Definition expop.h:924
value * evaluate_funcall(struct type *expect_type, struct expression *exp, enum noside noside, const std::vector< operation_up > &args) override
Definition eval.c:848
const std::string & get_string() const
Definition expop.h:1001
virtual bool complete(struct expression *exp, completion_tracker &tracker)
Definition expop.h:1014
value * evaluate_funcall(struct type *expect_type, struct expression *exp, enum noside noside, const std::vector< operation_up > &args) override
Definition eval.c:785
enum exp_opcode opcode() const override
Definition expop.h:1128
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:1117
enum exp_opcode opcode() const override
Definition expop.h:1150
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:1139
enum exp_opcode opcode() const override
Definition expop.h:1045
void do_generate_ax(struct expression *exp, struct agent_expr *ax, struct axs_value *value, struct type *cast_type) override
Definition expop.h:1050
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:1036
enum exp_opcode opcode() const override
Definition expop.h:1079
void do_generate_ax(struct expression *exp, struct agent_expr *ax, struct axs_value *value, struct type *cast_type) override
Definition expop.h:1084
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:1070
void do_generate_ax(struct expression *exp, struct agent_expr *ax, struct axs_value *value, struct type *cast_type) override
Definition expop.h:1235
enum exp_opcode opcode() const override
Definition expop.h:1230
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:1219
value * evaluate_for_sizeof(struct expression *exp, enum noside noside) override
Definition eval.c:2739
enum exp_opcode opcode() const override
Definition expop.h:962
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:950
void do_generate_ax(struct expression *exp, struct agent_expr *ax, struct axs_value *value, struct type *cast_type) override
Definition ax-gdb.c:1701
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition eval.c:1159
enum exp_opcode opcode() const override
Definition expop.h:939
bool uses_objfile(struct objfile *objfile) const override
Definition expop.h:381
DISABLE_COPY_AND_ASSIGN(tuple_holding_operation)
std::enable_if(stream, depth, value)
std::tuple< Arg... > m_storage
Definition expop.h:395
std::enable_if< I==sizeof...(T), bool >::type do_check_objfile(struct objfile *objfile, const std::tuple< T... > &value) const
Definition expop.h:420
tuple_holding_operation(Arg... args)
Definition expop.h:374
std::enable_if< I==sizeof...(T), void >::type do_dump(struct ui_file *stream, int depth, const std::tuple< T... > &value) const
Definition expop.h:402
void dump(struct ui_file *stream, int depth) const override
Definition expop.h:386
enum exp_opcode opcode() const override
Definition expop.h:1869
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition eval.c:503
enum exp_opcode opcode() const override
Definition expop.h:1559
bool constant_p() const override
Definition expop.h:1562
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:1552
enum exp_opcode opcode() const override
Definition expop.h:1659
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:1642
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:1574
enum exp_opcode opcode() const override
Definition expop.h:1585
void do_generate_ax(struct expression *exp, struct agent_expr *ax, struct axs_value *value, struct type *cast_type) override
Definition expop.h:1690
const operation_up & get_expression() const
Definition expop.h:1683
enum exp_opcode opcode() const override
Definition expop.h:1679
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:1671
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:1737
enum exp_opcode opcode() const override
Definition expop.h:1746
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:1991
void do_generate_ax(struct expression *exp, struct agent_expr *ax, struct axs_value *value, struct type *cast_type) override
Definition ax-gdb.c:1825
struct type * get_type() const
Definition expop.h:2003
enum exp_opcode opcode() const override
Definition expop.h:1999
void do_generate_ax(struct expression *exp, struct agent_expr *ax, struct axs_value *value, struct type *cast_type) override
Definition ax-gdb.c:1989
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:2026
enum exp_opcode opcode() const override
Definition expop.h:2036
void do_generate_ax(struct expression *exp, struct agent_expr *ax, struct axs_value *value, struct type *cast_type) override
Definition ax-gdb.c:1835
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition eval.c:2526
enum exp_opcode opcode() const override
Definition expop.h:1966
struct type * get_type() const
Definition expop.h:1970
enum exp_opcode opcode() const override
Definition expop.h:1485
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:1477
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:1502
value * evaluate_for_sizeof(struct expression *exp, enum noside noside) override
Definition eval.c:2772
value * evaluate_for_address(struct expression *exp, enum noside noside) override
Definition eval.c:2599
enum exp_opcode opcode() const override
Definition expop.h:1518
void do_generate_ax(struct expression *exp, struct agent_expr *ax, struct axs_value *value, struct type *cast_type) override
Definition expop.h:1532
struct type * get_type() const
Definition expop.h:1777
void do_generate_ax(struct expression *exp, struct agent_expr *ax, struct axs_value *value, struct type *cast_type) override
Definition ax-gdb.c:1854
enum exp_opcode opcode() const override
Definition expop.h:1773
value * evaluate_for_sizeof(struct expression *exp, enum noside noside) override
Definition eval.c:2790
value * evaluate_for_address(struct expression *exp, enum noside noside) override
Definition eval.c:2630
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:1758
void do_generate_ax(struct expression *exp, struct agent_expr *ax, struct axs_value *value, struct type *cast_type) override
Definition ax-gdb.c:1871
enum exp_opcode opcode() const override
Definition expop.h:1817
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:1799
value * evaluate_for_sizeof(struct expression *exp, enum noside noside) override
Definition eval.c:2797
value * evaluate_for_address(struct expression *exp, enum noside noside) override
Definition eval.c:2638
enum exp_opcode opcode() const override
Definition expop.h:1437
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:1429
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:1710
enum exp_opcode opcode() const override
Definition expop.h:1717
void do_generate_ax(struct expression *exp, struct agent_expr *ax, struct axs_value *value, struct type *cast_type) override
Definition ax-gdb.c:1802
void do_generate_ax(struct expression *exp, struct agent_expr *ax, struct axs_value *value, struct type *cast_type) override
Definition expop.h:1286
void do_generate_ax(struct expression *exp, struct agent_expr *ax, struct axs_value *value, struct type *cast_type) override
Definition expop.h:1451
Definition expop.h:771
enum exp_opcode opcode() const override
Definition expop.h:784
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:776
value * evaluate_for_sizeof(struct expression *exp, enum noside noside) override
Definition eval.c:2722
value * evaluate_for_address(struct expression *exp, enum noside noside) override
Definition eval.c:2615
value * evaluate_for_cast(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition eval.c:2829
value * evaluate_funcall(struct type *expect_type, struct expression *exp, enum noside noside, const std::vector< operation_up > &args) override
Definition expop.h:740
void set_outermost() override
Definition expop.h:752
enum exp_opcode opcode() const override
Definition expop.h:749
void do_generate_ax(struct expression *exp, struct agent_expr *ax, struct axs_value *value, struct type *cast_type) override
Definition ax-gdb.c:1636
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition expop.h:722
value * evaluate_funcall(struct type *expect_type, struct expression *exp, enum noside noside, const std::vector< operation_up > &args) override
Definition eval.c:683
enum exp_opcode opcode() const override
Definition expop.h:661
symbol * get_symbol() const
Definition expop.h:665
value * evaluate_for_cast(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition eval.c:2852
value * evaluate_for_sizeof(struct expression *exp, enum noside noside) override
Definition eval.c:2806
value * evaluate_with_coercion(struct expression *exp, enum noside noside) override
Definition eval.c:2676
value * evaluate_for_address(struct expression *exp, enum noside noside) override
Definition eval.c:2649
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
Definition eval.c:554
void do_generate_ax(struct expression *exp, struct agent_expr *ax, struct axs_value *value, struct type *cast_type) override
Definition ax-gdb.c:2001
struct type * cplus_typeid_type(struct gdbarch *gdbarch)
Definition cp-abi.c:196
struct value * cplus_typeid(struct value *value)
Definition cp-abi.c:186
@ lval_internalvar
Definition defs.h:367
struct value * eval_op_var_msym_value(struct type *expect_type, struct expression *exp, enum noside noside, bool outermost_p, bound_minimal_symbol msymbol)
Definition eval.c:1085
struct value * eval_op_memval(struct type *expect_type, struct expression *exp, enum noside noside, struct value *arg1, struct type *type)
Definition eval.c:1708
struct value * eval_op_func_static_var(struct type *expect_type, struct expression *exp, enum noside noside, value *func, const char *var)
Definition eval.c:1102
struct value * eval_op_var_entry_value(struct type *expect_type, struct expression *exp, enum noside noside, symbol *sym)
Definition eval.c:1067
struct value * eval_op_structop_ptr(struct type *expect_type, struct expression *exp, enum noside noside, struct value *arg1, const char *string)
Definition eval.c:1206
struct value * eval_op_alignof(struct type *expect_type, struct expression *exp, enum noside noside, struct value *arg1)
Definition eval.c:1692
struct value * eval_op_register(struct type *expect_type, struct expression *exp, enum noside noside, const char *name)
Definition eval.c:1117
struct value * eval_op_scope(struct type *expect_type, struct expression *exp, enum noside noside, struct type *type, const char *string)
Definition eval.c:1053
struct value * eval_op_add(struct type *expect_type, struct expression *exp, enum noside noside, struct value *arg1, struct value *arg2)
Definition eval.c:1304
struct value * eval_op_ind(struct type *expect_type, struct expression *exp, enum noside noside, struct value *arg1)
Definition eval.c:1642
struct value * eval_op_structop_struct(struct type *expect_type, struct expression *exp, enum noside noside, struct value *arg1, const char *string)
Definition eval.c:1192
struct value * eval_op_member(struct type *expect_type, struct expression *exp, enum noside noside, struct value *arg1, struct value *arg2)
Definition eval.c:1262
struct value * eval_op_subscript(struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, struct value *arg1, struct value *arg2)
Definition eval.c:1397
struct value * eval_op_sub(struct type *expect_type, struct expression *exp, enum noside noside, struct value *arg1, struct value *arg2)
Definition eval.c:1326
struct value * eval_binop_assign_modify(struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, struct value *arg1, struct value *arg2)
Definition eval.c:1863
struct value * eval_op_type(struct type *expect_type, struct expression *exp, enum noside noside, struct type *type)
Definition eval.c:1851
struct value * eval_op_repeat(struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, struct value *arg1, struct value *arg2)
Definition eval.c:1557
struct value * eval_op_var_msym_value(struct type *expect_type, struct expression *exp, enum noside noside, bool outermost_p, bound_minimal_symbol msymbol)
Definition eval.c:1085
struct value * eval_op_memval(struct type *expect_type, struct expression *exp, enum noside noside, struct value *arg1, struct type *type)
Definition eval.c:1708
struct value * eval_op_func_static_var(struct type *expect_type, struct expression *exp, enum noside noside, value *func, const char *var)
Definition eval.c:1102
struct value * eval_op_var_entry_value(struct type *expect_type, struct expression *exp, enum noside noside, symbol *sym)
Definition eval.c:1067
struct value * eval_op_geq(struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, struct value *arg1, struct value *arg2)
Definition eval.c:1515
struct value * eval_op_preinc(struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, struct value *arg1)
Definition eval.c:1721
struct value * eval_op_postdec(struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, struct value *arg1)
Definition eval.c:1817
struct value * eval_op_less(struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, struct value *arg1, struct value *arg2)
Definition eval.c:1473
struct value * eval_op_lognot(struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, struct value *arg1)
Definition eval.c:1625
struct value * eval_op_gtr(struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, struct value *arg1, struct value *arg2)
Definition eval.c:1494
struct value * eval_op_neg(struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, struct value *arg1)
Definition eval.c:1593
struct value * eval_op_notequal(struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, struct value *arg1, struct value *arg2)
Definition eval.c:1452
struct value * eval_op_structop_ptr(struct type *expect_type, struct expression *exp, enum noside noside, struct value *arg1, const char *string)
Definition eval.c:1206
struct value * eval_op_alignof(struct type *expect_type, struct expression *exp, enum noside noside, struct value *arg1)
Definition eval.c:1692
void gen_expr_structop(struct expression *exp, enum exp_opcode op, expr::operation *lhs, const char *name, struct agent_expr *ax, struct axs_value *value)
Definition ax-gdb.c:2247
struct value * eval_op_register(struct type *expect_type, struct expression *exp, enum noside noside, const char *name)
Definition eval.c:1117
struct value * eval_op_binary(struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, struct value *arg1, struct value *arg2)
Definition eval.c:1352
struct value * eval_op_complement(struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, struct value *arg1)
Definition eval.c:1609
struct value * eval_op_scope(struct type *expect_type, struct expression *exp, enum noside noside, struct type *type, const char *string)
Definition eval.c:1053
struct value * eval_op_add(struct type *expect_type, struct expression *exp, enum noside noside, struct value *arg1, struct value *arg2)
Definition eval.c:1304
void gen_expr_binop(struct expression *exp, enum exp_opcode op, expr::operation *lhs, expr::operation *rhs, struct agent_expr *ax, struct axs_value *value)
Definition ax-gdb.c:2230
struct value * eval_op_ind(struct type *expect_type, struct expression *exp, enum noside noside, struct value *arg1)
Definition eval.c:1642
struct value * eval_op_equal(struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, struct value *arg1, struct value *arg2)
Definition eval.c:1431
struct value * eval_op_structop_struct(struct type *expect_type, struct expression *exp, enum noside noside, struct value *arg1, const char *string)
Definition eval.c:1192
struct value * eval_op_plus(struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, struct value *arg1)
Definition eval.c:1577
struct value * eval_op_postinc(struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, struct value *arg1)
Definition eval.c:1783
struct value * eval_op_member(struct type *expect_type, struct expression *exp, enum noside noside, struct value *arg1, struct value *arg2)
Definition eval.c:1262
struct value * eval_op_leq(struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, struct value *arg1, struct value *arg2)
Definition eval.c:1536
void gen_expr_unop(struct expression *exp, enum exp_opcode op, expr::operation *lhs, struct agent_expr *ax, struct axs_value *value)
Definition ax-gdb.c:2268
struct value * eval_op_predec(struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, struct value *arg1)
Definition eval.c:1752
struct value * eval_op_subscript(struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, struct value *arg1, struct value *arg2)
Definition eval.c:1397
struct value * eval_op_sub(struct type *expect_type, struct expression *exp, enum noside noside, struct value *arg1, struct value *arg2)
Definition eval.c:1326
struct value * eval_binop_assign_modify(struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, struct value *arg1, struct value *arg2)
Definition eval.c:1863
struct value * eval_op_type(struct type *expect_type, struct expression *exp, enum noside noside, struct type *type)
Definition eval.c:1851
struct value * eval_op_repeat(struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, struct value *arg1, struct value *arg2)
Definition eval.c:1557
#define OP(name)
exp_opcode
Definition expression.h:45
noside
Definition expression.h:56
@ EVAL_NORMAL
Definition expression.h:57
@ EVAL_AVOID_SIDE_EFFECTS
Definition expression.h:58
range_flag
Definition expression.h:370
struct type * lookup_lvalue_reference_type(struct type *type)
Definition gdbtypes.c:518
struct type * check_typedef(struct type *type)
Definition gdbtypes.c:2966
#define TYPE_IS_REFERENCE(t)
Definition gdbtypes.h:139
mach_port_t kern_return_t mach_port_t mach_msg_type_name_t msgportsPoly mach_port_t kern_return_t pid_t pid mach_port_t kern_return_t mach_port_t task mach_port_t kern_return_t int flags
Definition gnu-nat.c:1861
@ I
Definition ia64-tdep.c:81
struct type * language_bool_type(const struct language_defn *la, struct gdbarch *gdbarch)
Definition language.c:888
Definition ada-exp.h:87
cxx_cast_operation< UNOP_DYNAMIC_CAST, value_dynamic_cast > dynamic_cast_operation
Definition expop.h:2075
std::unique_ptr< operation > operation_up
Definition expression.h:82
bool check_objfile(const std::unique_ptr< ada_component > &comp, struct objfile *objfile)
Definition ada-lang.c:9386
std::array< gdb_byte, 16 > float_data
Definition expop.h:556
static void dump_for_expression(struct ui_file *stream, int depth, const operation_up &op)
Definition expop.h:309
struct value * binary_ftype(struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, struct value *arg1, struct value *arg2)
Definition expop.h:1248
value * cxx_cast_ftype(struct type *, value *)
Definition expop.h:2048
cxx_cast_operation< UNOP_REINTERPRET_CAST, value_reinterpret_cast > reinterpret_cast_operation
Definition expop.h:2077
struct value * unary_ftype(struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, struct value *arg1)
Definition expop.h:1415
static bool check_constant(const operation_up &item)
Definition expop.h:442
Definition aarch64.h:67
#define prefix(a, b, R, do)
Definition ppc64-tdep.c:52
int value
Definition py-param.c:79
void(* func)(remote_target *remote, char *)
Definition 1.cc:26
const struct block * block
Definition symtab.h:1537
struct symbol * symbol
Definition symtab.h:1533
Definition block.h:109
struct objfile * objfile
Definition minsyms.h:54
const struct language_defn * language_defn
Definition expression.h:235
struct gdbarch * gdbarch
Definition expression.h:237
struct objfile * separate_debug_objfile_backlink
Definition objfiles.h:830
address_class aclass() const
Definition symtab.h:1274
struct objfile * objfile() const
Definition symtab.c:6482
symbol()
Definition symtab.h:1237
struct type * target_type() const
Definition gdbtypes.h:1037
type_code code() const
Definition gdbtypes.h:956
struct objfile * objfile_owner() const
Definition gdbtypes.h:1379
Definition value.h:130
static struct value * allocate(struct type *type)
Definition value.c:957
struct type * type() const
Definition value.h:180
enum lval_type lval() const
Definition value.h:332
address_class
Definition symtab.h:968
@ LOC_BLOCK
Definition symtab.h:1028
@ LOC_LABEL
Definition symtab.h:1022
@ LOC_CONST
Definition symtab.h:975
@ LOC_CONST_BYTES
Definition symtab.h:1033
void gdb_printf(struct ui_file *stream, const char *format,...)
Definition utils.c:1886
bool value_logical_not(struct value *arg1)
Definition valarith.c:1501
struct value * value_x_binop(struct value *arg1, struct value *arg2, enum exp_opcode op, enum exp_opcode otherop, enum noside noside)
Definition valarith.c:396
int binop_user_defined_p(enum exp_opcode op, struct value *arg1, struct value *arg2)
Definition valarith.c:304
struct value * value_concat(struct value *arg1, struct value *arg2)
Definition valarith.c:684
struct value * value_assign(struct value *toval, struct value *fromval)
Definition valops.c:1085
struct value * value_literal_complex(struct value *arg1, struct value *arg2, struct type *type)
Definition valops.c:4092
struct value * value_dynamic_cast(struct type *type, struct value *arg)
Definition valops.c:814
struct value * value_of_this(const struct language_defn *lang)
Definition valops.c:3985
struct value * value_reinterpret_cast(struct type *type, struct value *arg)
Definition valops.c:667
struct value * value_of_internalvar(struct gdbarch *gdbarch, struct internalvar *var)
Definition value.c:2016
struct value * value_from_longest(struct type *type, LONGEST num)
Definition value.c:3438
struct value * value_from_contents(struct type *type, const gdb_byte *contents)
Definition value.c:3581
struct value * value_from_mpz(struct type *type, const gdb_mpz &v)
Definition value.c:3462
struct value * access_value_history(int num)
Definition value.c:1709
#define nullptr
Definition x86-cpuid.h:28