Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: gdb/common/buffer.c

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gdb/common/ax.def ('k') | gdb/common/format.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gdb/common/buffer.c
diff --git a/gdb/common/buffer.c b/gdb/common/buffer.c
index 37b7b55f7488d35899cd0546a2e15177b1dd03a1..2f63eecaebce84f455e558f45773d75a133c53ec 100644
--- a/gdb/common/buffer.c
+++ b/gdb/common/buffer.c
@@ -25,10 +25,12 @@
#include "xml-utils.h"
#include "buffer.h"
+#include "inttypes.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
+#include <stdint.h>
void
buffer_grow (struct buffer *buffer, const char *data, size_t size)
@@ -47,8 +49,6 @@ buffer_grow (struct buffer *buffer, const char *data, size_t size)
while (buffer->used_size + size > new_buffer_size)
new_buffer_size *= 2;
new_buffer = xrealloc (buffer->buffer, new_buffer_size);
- if (!new_buffer)
- abort ();
memcpy (new_buffer + buffer->used_size, data, size);
buffer->buffer = new_buffer;
buffer->buffer_size = new_buffer_size;
@@ -101,6 +101,7 @@ buffer_xml_printf (struct buffer *buffer, const char *format, ...)
char buf[32];
char *p;
char *str = buf;
+ const char *f_old = f;
switch (*f)
{
@@ -119,14 +120,60 @@ buffer_xml_printf (struct buffer *buffer, const char *format, ...)
case 'o':
sprintf (str, "%o", va_arg (ap, unsigned int));
break;
+ case 'l':
+ f++;
+ switch (*f)
+ {
+ case 'd':
+ sprintf (str, "%ld", va_arg (ap, long));
+ break;
+ case 'u':
+ sprintf (str, "%lu", va_arg (ap, unsigned long));
+ break;
+ case 'x':
+ sprintf (str, "%lx", va_arg (ap, unsigned long));
+ break;
+ case 'o':
+ sprintf (str, "%lo", va_arg (ap, unsigned long));
+ break;
+ case 'l':
+ f++;
+ switch (*f)
+ {
+ case 'd':
+ sprintf (str, "%" PRId64,
+ (int64_t) va_arg (ap, long long));
+ break;
+ case 'u':
+ sprintf (str, "%" PRIu64,
+ (uint64_t) va_arg (ap, unsigned long long));
+ break;
+ case 'x':
+ sprintf (str, "%" PRIx64,
+ (uint64_t) va_arg (ap, unsigned long long));
+ break;
+ case 'o':
+ sprintf (str, "%" PRIo64,
+ (uint64_t) va_arg (ap, unsigned long long));
+ break;
+ default:
+ str = 0;
+ break;
+ }
+ break;
+ default:
+ str = 0;
+ break;
+ }
+ break;
default:
str = 0;
break;
}
-
+
if (str)
{
- buffer_grow (buffer, prev, f - prev - 1);
+ buffer_grow (buffer, prev, f_old - prev - 1);
p = xml_escape_text (str);
buffer_grow_str (buffer, p);
xfree (p);
« no previous file with comments | « gdb/common/ax.def ('k') | gdb/common/format.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698