mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-22 02:50:08 +08:00
Introduce string_operation
This adds string_operation, which implements OP_STRING for most languages (C has its own variant). gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class string_operation): New. * eval.c (eval_op_string): No longer static.
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
|
* expop.h (class string_operation): New.
|
||||||
|
* eval.c (eval_op_string): No longer static.
|
||||||
|
|
||||||
2021-03-08 Tom Tromey <tom@tromey.com>
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
* expop.h (class internalvar_operation): New.
|
* expop.h (class internalvar_operation): New.
|
||||||
|
@ -1284,7 +1284,7 @@ eval_op_register (struct type *expect_type, struct expression *exp,
|
|||||||
|
|
||||||
/* Helper function that implements the body of OP_STRING. */
|
/* Helper function that implements the body of OP_STRING. */
|
||||||
|
|
||||||
static struct value *
|
struct value *
|
||||||
eval_op_string (struct type *expect_type, struct expression *exp,
|
eval_op_string (struct type *expect_type, struct expression *exp,
|
||||||
enum noside noside, int len, const char *string)
|
enum noside noside, int len, const char *string)
|
||||||
{
|
{
|
||||||
|
24
gdb/expop.h
24
gdb/expop.h
@ -61,6 +61,10 @@ extern struct value *eval_op_func_static_var (struct type *expect_type,
|
|||||||
extern struct value *eval_op_register (struct type *expect_type,
|
extern struct value *eval_op_register (struct type *expect_type,
|
||||||
struct expression *exp,
|
struct expression *exp,
|
||||||
enum noside noside, const char *name);
|
enum noside noside, const char *name);
|
||||||
|
extern struct value *eval_op_string (struct type *expect_type,
|
||||||
|
struct expression *exp,
|
||||||
|
enum noside noside, int len,
|
||||||
|
const char *string);
|
||||||
|
|
||||||
namespace expr
|
namespace expr
|
||||||
{
|
{
|
||||||
@ -681,6 +685,26 @@ protected:
|
|||||||
override;
|
override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class string_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
|
||||||
|
{
|
||||||
|
const std::string &str = std::get<0> (m_storage);
|
||||||
|
return eval_op_string (expect_type, exp, noside,
|
||||||
|
str.size (), str.c_str ());
|
||||||
|
}
|
||||||
|
|
||||||
|
enum exp_opcode opcode () const override
|
||||||
|
{ return OP_STRING; }
|
||||||
|
};
|
||||||
|
|
||||||
} /* namespace expr */
|
} /* namespace expr */
|
||||||
|
|
||||||
#endif /* EXPOP_H */
|
#endif /* EXPOP_H */
|
||||||
|
Reference in New Issue
Block a user