Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Hui Zhu <teawater@gmail.com>
To: Tom Tromey <tromey@redhat.com>, Yao Qi <yao@codesourcery.com>
Cc: gdb-patches ml <gdb-patches@sourceware.org>,
	Joel Brobecker <brobecker@adacore.com>
Subject: Re: [PATCH/7.6] Fix wrong release (maybe crash GDB) in build_target_command_list
Date: Wed, 24 Apr 2013 19:13:00 -0000	[thread overview]
Message-ID: <CANFwon1pQsGrSc-jW=083V0xfJkDOJB8b459baoU-aoHjy1-UA@mail.gmail.com> (raw)
In-Reply-To: <87haiwngpr.fsf@fleche.redhat.com>

On Wed, Apr 24, 2013 at 10:30 PM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Hui" == Hui Zhu <teawater@gmail.com> writes:
>
> Hui> 2013-04-24  Hui Zhu  <hui@codesourcery.com>
>
> Hui>    * breakpoint.c (build_target_command_list): Change loc->cond_bytecode
> Hui>    to loc->cmd_bytecode.
>
> Is it possible to make a test case for this?

I tried but looks free conditions cannot crash GDB.  :(

>
> The patch looks good.
>
> I am curious about this code in build_target_command_list:
>
>               aexpr = parse_cmd_to_aexpr (bl->address,
>                                           loc->owner->extra_string);
>               loc->cmd_bytecode = aexpr;
>
>               if (!aexpr)
>                 continue;
>
> The "continue" seems to mean that null_command_or_parse_error will not
> be set in the "parse error" case.

I think it is right, because even if one of breakpoint loc doesn't
have commands.  GDB still need send other commands to target.

>
> Also, parse_cmd_to_aexpr calls 'error' in a few spots but then in
> another spot is careful not to.  This seems somewhat odd.

This function looks have something still not right.  I am just working
on 15180 to make it better.

On 04/24/2013 09:29 PM, Hui Zhu wrote:
-             if (!loc->cond_bytecode)
+             if (!loc->cmd_bytecode)

Nit:          "if (loc->cmd_bytecode == NULL)" is better.

Fixed.

Thanks,
Hui

>
> Tom

2013-04-24  Hui Zhu  <hui@codesourcery.com>

	* breakpoint.c (build_target_command_list): Change loc->cond_bytecode
	to loc->cmd_bytecode.

--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -2343,11 +2343,11 @@ build_target_command_list (struct bp_loc
 	    {
 	      /* Only go as far as the first NULL bytecode is
 		 located.  */
-	      if (!loc->cond_bytecode)
+	      if (loc->cmd_bytecode == NULL)
 		return;

-	      free_agent_expr (loc->cond_bytecode);
-	      loc->cond_bytecode = NULL;
+	      free_agent_expr (loc->cmd_bytecode);
+	      loc->cmd_bytecode = NULL;
 	    }
 	}
     }


  reply	other threads:[~2013-04-24 15:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-24 15:35 Hui Zhu
2013-04-24 17:48 ` Tom Tromey
2013-04-24 19:13   ` Hui Zhu [this message]
2013-04-24 20:36     ` Tom Tromey
2013-04-25 12:49       ` Hui Zhu
2013-04-25 15:18         ` Joel Brobecker
2013-04-25 17:25           ` Hui Zhu
2013-04-24 18:58 ` Yao Qi

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='CANFwon1pQsGrSc-jW=083V0xfJkDOJB8b459baoU-aoHjy1-UA@mail.gmail.com' \
    --to=teawater@gmail.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@redhat.com \
    --cc=yao@codesourcery.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