public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Adrian Sendroiu <adrian.sendroiu@freescale.com>,
	       "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
	       "tromey@redhat.com" <tromey@redhat.com>
Subject: Re: [PATCH v2 2/2] mi-out: Implement mi redirection using a stack.
Date: Wed, 30 Jul 2014 12:05:00 -0000	[thread overview]
Message-ID: <53D8DA80.8010603@redhat.com> (raw)
In-Reply-To: <f97e74554a0b462ab9eba17c90559a1f@BLUPR03MB136.namprd03.prod.outlook.com>

On 07/30/2014 09:37 AM, Adrian Sendroiu wrote:
>> -----Original Message-----
>> From: Pedro Alves [mailto:palves@redhat.com]
>> Sent: Tuesday, July 29, 2014 5:55 PM
>> To: Sendroiu Adrian-B46904; gdb-patches@sourceware.org;
>> tromey@redhat.com
>> Subject: Re: [PATCH v2 2/2] mi-out: Implement mi redirection using a
>> stack.
>>
>> I'm guessing we can trigger this by using "save breakpoints" while
>> logging is enabled, like gdb.base/ui-redirect.exp ?
>> I think it'd be very good if a test to the testsuite was added.
>> Sounds like gdb.mi/mi-logging.exp would be a good place?
>>
>> --
>> Thanks,
>> Pedro Alves
> 
> This won't trigger the bug, because the logging code doesn't call ui_out_redirect if the interpreter is MI. The way I caught it was through some python script that executes commands and catches their output into a string. For example, if you have 
> 
> gdb.execute("break main", False, True)
> 
> The call sequence will be something like:
> execute_command_to_string
>   ui_out_redirect
>   execute_command
>   ...
>     mi_breakpoint_created
>       ui_out_redirect
> 
> Then, after executing this, the mi_uiout->data->buffer will incorrectly point to a freed ui_file structure, and any subsequent command will overwrite the pointers inside this ui_file with random data, causing a crash.
> 
> Do you have any suggestions on how to make a test case from this scenario?

I'm not sure what specific suggestion you're looking after.  :-)

Sound like you'd add a test that does that exactly ?

You'd either base on, or add to mi-logging.exp, and do something like:

  mi_gdb_test "python gdb.execute("break main", False, True)" ...

  mi_gdb_test <some MI command that causes a crash> ...

(and skip the test if skip_python_tests is true)


Thanks,
Pedro Alves

  reply	other threads:[~2014-07-30 11:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-23 14:26 [PATCH 0/2] Reimplement redirection for MI Adrian Sendroiu
2014-07-23 14:26 ` [PATCH 2/2] mi-out: Implement mi redirection using a stack Adrian Sendroiu
2014-07-24 20:34   ` Tom Tromey
2014-07-25 11:43     ` [PATCH v2 " Adrian Sendroiu
2014-07-29 15:16       ` Pedro Alves
2014-07-30  8:38         ` Adrian Sendroiu
2014-07-30 12:05           ` Pedro Alves [this message]
2014-07-31 16:23             ` Adrian Sendroiu
2014-07-31 17:11               ` Pedro Alves
2014-08-05 13:54                 ` Adrian Sendroiu
2014-08-28 11:33                   ` Adrian Sendroiu
2014-09-05 16:06                   ` Pedro Alves
2014-09-07 15:45                     ` Adrian Sendroiu
2014-09-08 13:19                   ` Pedro Alves
2014-09-08 18:59                     ` Sergio Durigan Junior
2014-09-09 14:03                     ` Adrian Sendroiu
2014-09-26  9:25                       ` Adrian Sendroiu
2014-09-26 12:51                         ` Pedro Alves
2014-07-23 14:37 ` [PATCH 1/2] cli/cli-logging.c: don't call ui_out_redirect for MI when disabling logging Adrian Sendroiu
2014-07-24 18:19   ` Tom Tromey
2015-08-17 18:47 ` [PATCH 0/2] Reimplement redirection for MI Doug Evans

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=53D8DA80.8010603@redhat.com \
    --to=palves@redhat.com \
    --cc=adrian.sendroiu@freescale.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).