Fix for any command that passes strings to gdb for evaluation,

where the string contains a parentheses-within-parentheses
expression along with a ">" or ">>" operator inside the outermost
set of parentheses.  Without the patch, a command such as the
following fails like so:

  crash> p ((1+1) >> 1)
  p: gdb request failed: p ((1+1)
  crash>

(anderson@redhat.com)
This commit is contained in:
Dave Anderson 2015-05-21 17:28:11 -04:00
parent 042639e3f5
commit 3cbecbcd3c

View File

@ -1,8 +1,8 @@
/* cmdline.c - core analysis suite
*
* Copyright (C) 1999, 2000, 2001, 2002 Mission Critical Linux, Inc.
* Copyright (C) 2002-2014 David Anderson
* Copyright (C) 2002-2014 Red Hat, Inc. All rights reserved.
* Copyright (C) 2002-2015 David Anderson
* Copyright (C) 2002-2015 Red Hat, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -497,13 +497,14 @@ setup_redirect(int origin)
if (FIRSTCHAR(p) == '|' || FIRSTCHAR(p) == '!')
pc->redirect |= REDIRECT_SHELL_COMMAND;
expression = string = FALSE;
expression = 0;
string = FALSE;
while (*p) {
if (*p == '(')
expression = TRUE;
expression++;
if (*p == ')')
expression = FALSE;
expression--;
if ((*p == '"') || (*p == '\''))
string = !string;