Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Luis Gustavo <luis_gustavo@mentor.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: General regressions in gdbserver mode  [Re: [rfc target-side break conditions 0/5 v2]  General info]
Date: Sat, 25 Feb 2012 19:40:00 -0000	[thread overview]
Message-ID: <4F49277A.70400@mentor.com> (raw)
In-Reply-To: <20120225170610.GA31657@host2.jankratochvil.net>

[-- Attachment #1: Type: text/plain, Size: 1549 bytes --]

On 02/25/2012 03:06 PM, Jan Kratochvil wrote:
> On Sat, 25 Feb 2012 16:39:55 +0100, Luis Gustavo wrote:
>> What kind of setup you're using?
>
> Fedora 17 x86_64.  It does not crash for me without -lmcheck but it does crash
> for gdbserver linked with -lmcheck, gdbserver dumps core then.
>
> With valgrind gdbserver prints:
>
> Invalid read of size 8
>     at: clear_gdb_breakpoint_conditions (mem-break.c:741)
>     by: delete_gdb_breakpoint_at (mem-break.c:715)
>     by: x86_remove_point (linux-x86-low.c:593)
>     by: linux_remove_point (linux-low.c:4463)
>     by: process_serial_event (server.c:3207)
>     by: handle_serial_event (server.c:3340)
>     by: handle_file_event (event-loop.c:489)
>     by: process_event (event-loop.c:244)
>     by: start_event_loop (event-loop.c:607)
>     by: main (server.c:2773)
>   Address 0x56242c8 is 8 bytes inside a block of size 16 free'd
>     at: free (vg_replace_malloc.c:427)
>     by: clear_gdb_breakpoint_conditions (mem-break.c:740)
>     by: delete_gdb_breakpoint_at (mem-break.c:715)
>     by: x86_remove_point (linux-x86-low.c:593)
>     by: linux_remove_point (linux-low.c:4463)
>     by: process_serial_event (server.c:3207)
>     by: handle_serial_event (server.c:3340)
>     by: handle_file_event (event-loop.c:489)
>     by: process_event (event-loop.c:244)
>     by: start_event_loop (event-loop.c:607)
>     by: main (server.c:2773)
>
>
> Thanks,
> Jan

Could please try the following on your side?

I reproduced the crash with -lmcheck and this patch fixed it for me.

Thanks,
Luis


[-- Attachment #2: mem_fix.diff --]
[-- Type: text/x-patch, Size: 868 bytes --]

2012-02-25  Luis Machado  <lgustavo@codesourcery.com>

	* mem-break.c (clear_gdb_breakpoint_conditions): Fix de-allocation
	of conditions.

diff --git a/gdb/gdbserver/mem-break.c b/gdb/gdbserver/mem-break.c
index c9a6035..69265cb 100644
--- a/gdb/gdbserver/mem-break.c
+++ b/gdb/gdbserver/mem-break.c
@@ -726,20 +726,19 @@ void
 clear_gdb_breakpoint_conditions (CORE_ADDR addr)
 {
   struct breakpoint *bp = find_gdb_breakpoint_at (addr);
-  struct point_cond_list *cond, **cond_p;
+  struct point_cond_list *cond, *cond_next;
 
   if (bp == NULL || bp->cond_list == NULL)
     return;
 
   cond = bp->cond_list;
-  cond_p = &bp->cond_list->next;
 
   while (cond != NULL)
     {
+      cond_next = cond->next;
       free (cond->cond);
       free (cond);
-      cond = *cond_p;
-      cond_p = &cond->next;
+      cond = cond_next;
     }
 
   bp->cond_list = NULL;

  parent reply	other threads:[~2012-02-25 18:25 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-27 20:33 [rfc target-side break conditions 0/5 v2] General info Luis Gustavo
2012-02-06 13:33 ` [ping] " Luis Gustavo
2012-02-07 21:32 ` Stan Shebs
2012-02-08 23:05   ` Luis Gustavo
2012-02-24 15:28 ` Luis Gustavo
2012-02-25 15:40   ` General regressions in gdbserver mode [Re: [rfc target-side break conditions 0/5 v2] General info] Jan Kratochvil
2012-02-25 15:57     ` Luis Gustavo
2012-02-25 17:19       ` Jan Kratochvil
2012-02-25 18:25         ` Luis Gustavo
2012-02-25 19:40         ` Luis Gustavo [this message]
2012-02-25 19:41           ` Jan Kratochvil
2012-02-25 20:08             ` Luis Gustavo
2012-02-26 22:57               ` Regressions in gdbserver mode #2 [Re: General regressions in gdbserver mode] Jan Kratochvil
2012-02-26 23:09                 ` Luis Gustavo
2012-02-28 16:19                   ` Jan Kratochvil
2012-02-27  4:46                 ` Luis Gustavo
2012-02-27  5:55                   ` Jan Kratochvil
2012-02-27 16:23                     ` Luis Gustavo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F49277A.70400@mentor.com \
    --to=luis_gustavo@mentor.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox