From 0d9bc48e145195b9ce04dedb3ca75ee93d90a32c Mon Sep 17 00:00:00 2001 From: Slava Barinov Date: Wed, 4 Jul 2018 10:20:42 +0300 Subject: [PATCH] Check if /proc is usable on gdbserver start Add check if procfs is mount and can be accessed by gdbserver. gdbserver/ * linux-low.c (initialize_low): Add /proc check. Signed-off-by: Slava Barinov --- gdb/gdbserver/linux-low.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index 6e026f1aab..28273da1b9 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -7553,6 +7553,13 @@ void initialize_low (void) { struct sigaction sigchld_action; + struct stat st; + + if (stat ("/proc/self", &st) != 0) + { + fprintf (stderr, "/proc is not accessible.\n"); + exit (1); + } memset (&sigchld_action, 0, sizeof (sigchld_action)); set_target_ops (&linux_target_ops); -- 2.18.0