aboutsummaryrefslogtreecommitdiff
path: root/gdb/common/buffer.c
diff options
context:
space:
mode:
authorStan Shebs <shebs@codesourcery.com>2012-05-11 22:24:24 +0000
committerStan Shebs <shebs@codesourcery.com>2012-05-11 22:24:24 +0000
commit85d4a676956f3c83d6f03d6105ebf1a67bf5f494 (patch)
tree6cc105aa2d421de5ad8b64c22a094e63b9e19ef8 /gdb/common/buffer.c
parentf24afd6d9f4a38630a3f2ee05a455da840d8aa92 (diff)
downloadgdb-85d4a676956f3c83d6f03d6105ebf1a67bf5f494.zip
gdb-85d4a676956f3c83d6f03d6105ebf1a67bf5f494.tar.gz
gdb-85d4a676956f3c83d6f03d6105ebf1a67bf5f494.tar.bz2
2012-05-11 Stan Shebs <stan@codesourcery.com>
Kwok Cheung Yeung <kcy@codesourcery.com> * NEWS: Describe new info os commands. * common/linux-osdata.c (PID_T, TIME_T): Define. (MAX_PID_T_STRLEN): New. (linux_common_core_of_thread): Add comment. Change to use PID_T and MAX_PID_T_STRLEN. (command_from_pid): Add comment. Change to use PID_T. (commandline_from_pid): Change to use PID_T. (user_from_pid): Add comment. (get_process_owner): Add comment. Change to use PID_T and MAX_PID_T_STRLEN. (get_number_of_cpu_cores): Add comment. (get_cores_used_by_process): Add comment. Change to use PID_T and MAX_PID_T_STRLEN. (linux_xfer_osdata_processes): Change to use PID_T and MAX_PID_T_STRLEN. (compare_processes): New function. (linux_xfer_osdata_processgroups): New function. (linux_xfer_osdata_threads): Change to use PID_T. (linux_xfer_osdata_fds): New function. (format_socket_state, print_sockets): New functions. (union socket_addr): New union. (linux_xfer_osdata_isockets): New function. (time_from_time_t, group_from_gid): New functions. (linux_xfer_osdata_shm): New function. (linux_xfer_osdata_sem): New function. (linux_xfer_osdata_msg): New function. (linux_xfer_osdata_modules): New function. (osdata_table): Add new entries. * common/buffer.c (buffer_xml_printf): Add support for long and long long format specifiers. * gdb.texinfo (Operating System Auxiliary Information): Document new 'info os' subcommands. * gdb.base/info-os.exp: New file. * gdb.base/info-os.c: New file.
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);