aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver/server.h
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/gdbserver/server.h')
-rw-r--r--gdb/gdbserver/server.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/gdb/gdbserver/server.h b/gdb/gdbserver/server.h
index 817b5c4..ca5530d 100644
--- a/gdb/gdbserver/server.h
+++ b/gdb/gdbserver/server.h
@@ -223,6 +223,40 @@ void monitor_output (const char *msg);
char *xml_escape_text (const char *text);
+/* Simple growing buffer. */
+
+struct buffer
+{
+ char *buffer;
+ size_t buffer_size; /* allocated size */
+ size_t used_size; /* actually used size */
+};
+
+/* Append DATA of size SIZE to the end of BUFFER. Grows the buffer to
+ accommodate the new data. */
+void buffer_grow (struct buffer *buffer, const char *data, size_t size);
+
+/* Release any memory held by BUFFER. */
+void buffer_free (struct buffer *buffer);
+
+/* Initialize BUFFER. BUFFER holds no memory afterwards. */
+void buffer_init (struct buffer *buffer);
+
+/* Return a pointer into BUFFER data, effectivelly transfering
+ ownership of the buffer memory to the caller. Calling buffer_free
+ afterwards has no effect on the returned data. */
+char* buffer_finish (struct buffer *buffer);
+
+/* Simple printf to BUFFER function. Current implemented formatters:
+ %s - grow an xml escaped text in OBSTACK. */
+void buffer_xml_printf (struct buffer *buffer, const char *format, ...)
+ ATTR_FORMAT (printf, 2, 3);;
+
+#define buffer_grow_str(BUFFER,STRING) \
+ buffer_grow (BUFFER, STRING, strlen (STRING))
+#define buffer_grow_str0(BUFFER,STRING) \
+ buffer_grow (BUFFER, STRING, strlen (STRING) + 1)
+
/* Functions from ``signals.c''. */
enum target_signal target_signal_from_host (int hostsig);
int target_signal_to_host_p (enum target_signal oursig);