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