• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

Revisione5343fde2046fbc19b9ac91326d5829d40066872 (tree)
Time2015-10-21 02:11:53
AuthorAleksandar Ristovski <aristovski@qnx....>
CommiterAleksandar Ristovski

Log Message

[nto] Implement procfs_pid_to_exec_file.

gdb/ChangeLog:

* gdb/nto-procfs.c (procfs_pid_to_exec_file): New function.
(init_procfs_targets): Wire new function.

Change Summary

Incremental Difference

--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
11 2015-10-20 Aleksandar Ristovski <aristovski@qnx.com>
22
3+ * gdb/nto-procfs.c (procfs_pid_to_exec_file): New function.
4+ (init_procfs_targets): Wire new function.
5+
6+2015-10-20 Aleksandar Ristovski <aristovski@qnx.com>
7+
38 * nto-procfs.c (sys/auxv.h): Include.
49 (procfs_xfer_partial): Implement TARGET_OBJECT_AUXV.
510 * nto-tdep.c (nto_read_auxv_from_initial_stack): New function.
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -617,6 +617,33 @@ procfs_files_info (struct target_ops *ignore)
617617 (nodestr != NULL) ? nodestr : "local node");
618618 }
619619
620+/* Target to_pid_to_exec_file implementation. */
621+
622+static char *
623+procfs_pid_to_exec_file (struct target_ops *ops, const int pid)
624+{
625+ int proc_fd;
626+ static char proc_path[PATH_MAX];
627+ ssize_t rd;
628+
629+ /* Read exe file name. */
630+ snprintf (proc_path, sizeof (proc_path), "%s/proc/%d/exefile",
631+ (nodestr != NULL) ? nodestr : "", pid);
632+ proc_fd = open (proc_path, O_RDONLY);
633+ if (proc_fd == -1)
634+ return NULL;
635+
636+ rd = read (proc_fd, proc_path, sizeof (proc_path) - 1);
637+ close (proc_fd);
638+ if (rd <= 0)
639+ {
640+ proc_path[0] = '\0';
641+ return NULL;
642+ }
643+ proc_path[rd] = '\0';
644+ return proc_path;
645+}
646+
620647 /* Attach to process PID, then initialize for debugging it. */
621648 static void
622649 procfs_attach (struct target_ops *ops, const char *args, int from_tty)
@@ -1491,6 +1518,7 @@ init_procfs_targets (void)
14911518 t->to_interrupt = procfs_interrupt;
14921519 t->to_have_continuable_watchpoint = 1;
14931520 t->to_extra_thread_info = nto_extra_thread_info;
1521+ t->to_pid_to_exec_file = procfs_pid_to_exec_file;
14941522
14951523 nto_native_ops = t;
14961524