public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug server/18130] New: gdbserver event loop is terminated by exception
@ 2015-03-16  9:17 qiyao at gcc dot gnu.org
  2015-03-16  9:32 ` [Bug server/18130] " qiyao at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: qiyao at gcc dot gnu.org @ 2015-03-16  9:17 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=18130

            Bug ID: 18130
           Summary: gdbserver event loop is terminated by exception
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: server
          Assignee: unassigned at sourceware dot org
          Reporter: qiyao at gcc dot gnu.org

On arm-linux, when I set hardware watchpoint on some address which doesn't meet
the kernel alignment requirement, like this,

(gdb) ./gdb -ex "target remote arm-linux:2346" -ex "b main" -ex "c" -ex "watch
*(buf.byte + 1 + 1)@1" -ex "stepi" -ex "quit"
gdb/testsuite/gdb.base/watchpoint-reuse-slot

the gdbserver is terminated like this:

Killing process(es): 9846
input_interrupt, count = 1 c = 36 ('$')
Can't determine port: Bad file descriptor.
Exiting

in gdbserver/linux-arm-low.c:arm_prepare_to_resume, hardware debugging
registers are updated by ptrace (PTRACE_SETHBPREGS), and if something is wrong,
exception is thrown out by perror_with_name.

      if (ptrace (PTRACE_SETHBPREGS, pid,
              (PTRACE_TYPE_ARG3) -((i << 1) + 2),
              &proc_info->wpts[i].control) < 0)
        perror_with_name ("Unexpected error setting watchpoint");
      }

The exception isn't caught and event loop is terminated as a result.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug server/18130] gdbserver event loop is terminated by exception
  2015-03-16  9:17 [Bug server/18130] New: gdbserver event loop is terminated by exception qiyao at gcc dot gnu.org
@ 2015-03-16  9:32 ` qiyao at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: qiyao at gcc dot gnu.org @ 2015-03-16  9:32 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=18130

--- Comment #1 from Yao Qi <qiyao at gcc dot gnu.org> ---
The exception can be either caught in the caller of
the_low_target.prepare_to_resume (lwp) or not thrown out from prepare_to_resume
hook in each backend.

I had a hacky patch for the former approach, and the event loop isn't
terminated by the exception.

diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 48d905b..65b7110 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -3560,8 +3560,16 @@ linux_resume_one_lwp (struct lwp_info *lwp,
       *p_sig = NULL;
     }

+  TRY
+    {
   if (the_low_target.prepare_to_resume != NULL)
     the_low_target.prepare_to_resume (lwp);
+    }
+  CATCH (exception, RETURN_MASK_ERROR)
+    {
+      /**/
+    }
+  END_CATCH

   regcache_invalidate_thread (thread);
   errno = 0;
-------------------------------------------

However, I still not sure what is the best way to fix this issue.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-16  9:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-16  9:17 [Bug server/18130] New: gdbserver event loop is terminated by exception qiyao at gcc dot gnu.org
2015-03-16  9:32 ` [Bug server/18130] " qiyao at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).