aboutsummaryrefslogtreecommitdiff
path: root/gdb/common/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/common/buffer.c')
-rw-r--r--gdb/common/buffer.c47
1 files changed, 45 insertions, 2 deletions
diff --git a/gdb/common/buffer.c b/gdb/common/buffer.c
index 37b7b55..059dd68 100644
--- a/gdb/common/buffer.c
+++ b/gdb/common/buffer.c
@@ -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,56 @@ 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, "%lld", va_arg (ap, long long));
+ break;
+ case 'u':
+ sprintf (str, "%llu", va_arg (ap, unsigned long long));
+ break;
+ case 'x':
+ sprintf (str, "%llx", va_arg (ap, unsigned long long));
+ break;
+ case 'o':
+ sprintf (str, "%llo", 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);