diff options
author | Tom Tromey <tom@tromey.com> | 2021-03-08 07:27:57 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2021-03-08 07:28:17 -0700 |
commit | 06dc61b9dfe5f76740b46be8f6e61ea699268fb1 (patch) | |
tree | 8bafb213924907721aca4f648c78f0300411dc09 | |
parent | 72d0a71134f9a7e4725d6ac490e1323cf7aa6ec2 (diff) | |
download | gdb-06dc61b9dfe5f76740b46be8f6e61ea699268fb1.zip gdb-06dc61b9dfe5f76740b46be8f6e61ea699268fb1.tar.gz gdb-06dc61b9dfe5f76740b46be8f6e61ea699268fb1.tar.bz2 |
Introduce objc_nsstring_operation
This adds class objc_nsstring_operation, which implements
OP_OBJC_NSSTRING.
gdb/ChangeLog
2021-03-08 Tom Tromey <tom@tromey.com>
* eval.c: Include c-exp.h.
* c-exp.h (class objc_nsstring_operation): New.
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/c-exp.h | 22 | ||||
-rw-r--r-- | gdb/eval.c | 1 |
3 files changed, 28 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5dd7666..2b7afb1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2021-03-08 Tom Tromey <tom@tromey.com> + * eval.c: Include c-exp.h. + * c-exp.h (class objc_nsstring_operation): New. + +2021-03-08 Tom Tromey <tom@tromey.com> + * c-lang.c (c_string_operation::evaluate): New method. * c-exp.h: New file. diff --git a/gdb/c-exp.h b/gdb/c-exp.h index 5558a77..a7b11b5 100644 --- a/gdb/c-exp.h +++ b/gdb/c-exp.h @@ -21,6 +21,7 @@ #define C_EXP_H #include "expop.h" +#include "objc-lang.h" namespace expr { @@ -41,6 +42,27 @@ public: { return OP_STRING; } }; +class objc_nsstring_operation + : public tuple_holding_operation<std::string> +{ +public: + + using tuple_holding_operation::tuple_holding_operation; + + value *evaluate (struct type *expect_type, + struct expression *exp, + enum noside noside) override + { + if (noside == EVAL_SKIP) + return eval_skip_value (exp); + const std::string &str = std::get<0> (m_storage); + return value_nsstring (exp->gdbarch, str.c_str (), str.size () + 1); + } + + enum exp_opcode opcode () const override + { return OP_OBJC_NSSTRING; } +}; + }/* namespace expr */ #endif /* C_EXP_H */ @@ -41,6 +41,7 @@ #include "typeprint.h" #include <ctype.h> #include "expop.h" +#include "c-exp.h" /* Prototypes for local functions. */ |