+2018-03-22 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * linux-tdep.c (linux_info_proc): For "info proc cmdline", print
+ command line args instead of emitting a warning.
+
2018-03-22 Simon Marchi <simon.marchi@polymtl.ca>
* tracepoint.h (struct static_tracepoint_marker): Initialize
if (cmdline_f)
{
xsnprintf (filename, sizeof filename, "/proc/%ld/cmdline", pid);
- gdb::unique_xmalloc_ptr<char> cmdline
- = target_fileio_read_stralloc (NULL, filename);
- if (cmdline)
- printf_filtered ("cmdline = '%s'\n", cmdline.get ());
+ gdb_byte *buffer;
+ ssize_t len = target_fileio_read_alloc (NULL, filename, &buffer);
+
+ if (len > 0)
+ {
+ gdb::unique_xmalloc_ptr<char> cmdline ((char *) buffer);
+ ssize_t pos;
+
+ for (pos = 0; pos < len - 1; pos++)
+ {
+ if (buffer[pos] == '\0')
+ buffer[pos] = ' ';
+ }
+ buffer[len - 1] = '\0';
+ printf_filtered ("cmdline = '%s'\n", buffer);
+ }
else
warning (_("unable to open /proc file '%s'"), filename);
}
+2018-03-22 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * gdb.base/info-proc.exp: Add test for "info proc cmdline".
+
2018-03-20 Stephen Roberts <stephen.roberts@arm.com>
* gdb.perf/template-breakpoints.cc: New file.
}
}
+# Set command line arguments to be verified later with "info proc
+# cmdline". However, if we're using a stub, then "set args" would not
+# have any effect, so then just skip this.
+
+set cmdline ""
+if { ! [use_gdb_stub] } {
+ set cmdline "-i foo bar -o baz 1234"
+ gdb_test_no_output "set args $cmdline" "set args"
+}
+
if { ! [ runto_main ] } then {
untested "could not run to main"
return -1
"info proc mapping"
if {[istarget "*-*-linux*"]} {
+ if { $cmdline != "" } {
+ gdb_test "info proc cmdline" "cmdline = '.* $cmdline'"
+ }
set gcorefile [standard_output_file $testfile.gcore]
if {[gdb_gcore_cmd $gcorefile "save a core file"]} {
clean_restart $binfile