public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH c++ 01/12] Introduce ax_raw_byte and use it
@ 2015-10-26  3:49 Simon Marchi
  2015-10-26  4:17 ` [PATCH c++ 03/12] ctf_xfer_partial: Return TARGET_XFER_E_IO instead of -1 on error Simon Marchi
                   ` (9 more replies)
  0 siblings, 10 replies; 34+ messages in thread
From: Simon Marchi @ 2015-10-26  3:49 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

This patch was taken directly from Pedro's branch.

ax_simple is used to append an agent expression operator to an agent
expression string.  Therefore, it takes an enum agent_op as input.
There is an instance where it's called to append a raw byte, unrelated
to the enum.  It makes the build fail in C++ mode.

This patch introduces ax_raw_byte for that purpose and uses it.

gdb/ChangeLog:

	* ax.h (ax_raw_byte): New declaration.
	* ax-general.c (ax_raw_byte): New function.
	(ax_simple): Use ax_raw_byte.
	* ax-gdb.c (gen_printf): Likewise.
---
 gdb/ax-gdb.c     |  2 +-
 gdb/ax-general.c | 11 +++++++++--
 gdb/ax.h         |  3 +++
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index 817fa53..7091a4a 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -2564,7 +2564,7 @@ gen_printf (CORE_ADDR scope, struct gdbarch *gdbarch,
 
   /* Issue the printf bytecode proper.  */
   ax_simple (ax, aop_printf);
-  ax_simple (ax, nargs);
+  ax_raw_byte (ax, nargs);
   ax_string (ax, format, fmtlen);
 
   /* And terminate.  */
diff --git a/gdb/ax-general.c b/gdb/ax-general.c
index e5dc240..5c8a25b 100644
--- a/gdb/ax-general.c
+++ b/gdb/ax-general.c
@@ -133,13 +133,20 @@ read_const (struct agent_expr *x, int o, int n)
   return accum;
 }
 
+/* See ax.h.  */
+
+void
+ax_raw_byte (struct agent_expr *x, gdb_byte byte)
+{
+  grow_expr (x, 1);
+  x->buf[x->len++] = byte;
+}
 
 /* Append a simple operator OP to EXPR.  */
 void
 ax_simple (struct agent_expr *x, enum agent_op op)
 {
-  grow_expr (x, 1);
-  x->buf[x->len++] = op;
+  ax_raw_byte (x, op);
 }
 
 /* Append a pick operator to EXPR.  DEPTH is the stack item to pick,
diff --git a/gdb/ax.h b/gdb/ax.h
index eaa72dd..1714bb4 100644
--- a/gdb/ax.h
+++ b/gdb/ax.h
@@ -190,6 +190,9 @@ extern struct agent_expr *new_agent_expr (struct gdbarch *, CORE_ADDR);
 extern void free_agent_expr (struct agent_expr *);
 extern struct cleanup *make_cleanup_free_agent_expr (struct agent_expr *);
 
+/* Append a raw byte to EXPR.  */
+extern void ax_raw_byte (struct agent_expr *expr, gdb_byte byte);
+
 /* Append a simple operator OP to EXPR.  */
 extern void ax_simple (struct agent_expr *EXPR, enum agent_op OP);
 
-- 
2.6.2

^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2015-10-27 17:13 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-26  3:49 [PATCH c++ 01/12] Introduce ax_raw_byte and use it Simon Marchi
2015-10-26  4:17 ` [PATCH c++ 03/12] ctf_xfer_partial: Return TARGET_XFER_E_IO instead of -1 on error Simon Marchi
2015-10-27  9:54   ` Simon Marchi
2015-10-26  5:24 ` [PATCH c++ 06/12] Fix constness problem in ioscm_make_gdb_stdio_port Simon Marchi
2015-10-26 12:40   ` Doug Evans
2015-10-26 18:36   ` Pedro Alves
2015-10-27  1:30     ` Simon Marchi
2015-10-27  1:55       ` Pedro Alves
2015-10-27  2:02         ` Doug Evans
2015-10-27  2:07           ` Simon Marchi
2015-10-26  5:27 ` [PATCH c++ 08/12] scm-symbol.c: Add (domain_enum) casts Simon Marchi
2015-10-26 12:55   ` Doug Evans
2015-10-26  5:29 ` [PATCH c++ 05/12] guile: Constify gdbscm_with_guile return value Simon Marchi
2015-10-26 11:45   ` Doug Evans
2015-10-26 17:39     ` Simon Marchi
2015-10-26 20:34       ` Doug Evans
2015-10-27  9:31         ` Simon Marchi
2015-10-27 17:35           ` Doug Evans
2015-10-28 14:59             ` Simon Marchi
2015-10-26  5:30 ` [PATCH c++ 09/12] stap-probe.c: Add casts Simon Marchi
2015-10-27  9:54   ` Simon Marchi
2015-10-26  5:32 ` [PATCH c++ 10/12] symtab.c: Add cast Simon Marchi
2015-10-26 12:55   ` Doug Evans
2015-10-26  7:53 ` [PATCH c++ 04/12] Add scm_t_dynwind_flags casts Simon Marchi
2015-10-27 14:59   ` Pedro Alves
2015-10-27 16:02     ` Simon Marchi
2015-10-26  8:17 ` [PATCH c++ 07/12] gdbscm_memory_port_write: use local variable to avoid adding casts Simon Marchi
2015-10-26 12:55   ` Doug Evans
2015-10-26 10:03 ` [PATCH c++ 02/12] ctf.c: Fix int/enum implicit cast Simon Marchi
2015-10-27 15:17   ` Pedro Alves
2015-10-27 17:11     ` Yao Qi
2015-10-27 17:14       ` Simon Marchi
2015-10-27 15:08 ` [PATCH c++ 01/12] Introduce ax_raw_byte and use it Pedro Alves
2015-10-27 16:55   ` Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).