Commit c09d99cf authored by Milian Wolff's avatar Milian Wolff
Browse files

Be less strict about named and unnamed arguments.

Recent GDB versions can report multiple breakpoints
but do so using an invalid MI format, see e.g. the
upstream bug report:
http://sourceware.org/bugzilla/show_bug.cgi?id=9659

Since we cannot expect GDB to be fixed anytime soon,
just make our parser less strict. This was actually
the recommendation in #gdb on freenode IRC as well...

BUG: 304730
parent 71ebc3a4
......@@ -161,17 +161,23 @@ bool MIParser::parseResultRecord(Record *&record)
bool MIParser::parseResult(Result *&result)
{
MATCH(Token_identifier);
QString variable = m_lex->currentTokenText();
m_lex->nextToken();
// be less strict about the format, see e.g.:
// https://bugs.kde.org/show_bug.cgi?id=304730
// http://sourceware.org/bugzilla/show_bug.cgi?id=9659
std::auto_ptr<Result> res(new Result);
res->variable = variable;
if (m_lex->lookAhead() != '=')
return true;
if (m_lex->lookAhead() == Token_identifier) {
res->variable = m_lex->currentTokenText();
m_lex->nextToken();
m_lex->nextToken();
if (m_lex->lookAhead() != '=') {
result = res.release();
return true;
}
m_lex->nextToken();
}
Value *value = 0;
if (!parseValue(value))
......
......@@ -46,6 +46,8 @@
#include "gdbcommand.h"
#include "debugsession.h"
#include "gdbframestackmodel.h"
#include <mi/milexer.h>
#include <mi/miparser.h>
using KDevelop::AutoTestShell;
......@@ -1564,6 +1566,34 @@ void GdbTest::testCatchpoint()
}
void GdbTest::parseBug304730()
{
FileSymbol file;
file.contents = QByteArray("^done,bkpt={"
"number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"<MULTIPLE>\",times=\"0\","
"original-location=\"/media/portable/Projects/BDSInpainting/PatchMatch/PatchMatch.hpp:231\"},"
"{number=\"1.1\",enabled=\"y\",addr=\"0x081d84aa\","
"func=\"PatchMatch<itk::Image<itk::CovariantVector<unsigned char, 3u>, 2u> >"
"::Propagation<ForwardPropagationNeighbors>(ForwardPropagationNeighbors)\","
"file=\"/media/portable/Projects/BDSInpainting/Drivers/../PatchMatch/PatchMatch.hpp\","
"fullname=\"/media/portable/Projects/BDSInpainting/PatchMatch/PatchMatch.hpp\",line=\"231\"},"
"{number=\"1.2\",enabled=\"y\",addr=\"0x081d8ae2\","
"func=\"PatchMatch<itk::Image<itk::CovariantVector<unsigned char, 3u>, 2u> >"
"::Propagation<BackwardPropagationNeighbors>(BackwardPropagationNeighbors)\","
"file=\"/media/portable/Projects/BDSInpainting/Drivers/../PatchMatch/PatchMatch.hpp\","
"fullname=\"/media/portable/Projects/BDSInpainting/PatchMatch/PatchMatch.hpp\",line=\"231\"},"
"{number=\"1.3\",enabled=\"y\",addr=\"0x081d911a\","
"func=\"PatchMatch<itk::Image<itk::CovariantVector<unsigned char, 3u>, 2u> >"
"::Propagation<AllowedPropagationNeighbors>(AllowedPropagationNeighbors)\","
"file=\"/media/portable/Projects/BDSInpainting/Drivers/../PatchMatch/PatchMatch.hpp\","
"fullname=\"/media/portable/Projects/BDSInpainting/PatchMatch/PatchMatch.hpp\",line=\"231\"}");
MIParser parser;
QScopedPointer<GDBMI::Record> record(parser.parse(&file));
QVERIFY(!record.isNull());
}
void GdbTest::waitForState(GDBDebugger::DebugSession *session, DebugSession::DebuggerState state,
const char *file, int line, bool expectFail)
{
......
......@@ -82,6 +82,7 @@ private Q_SLOTS:
void testBreakpointWithSpaceInPath();
void testBreakpointDisabledOnStart();
void testCatchpoint();
void parseBug304730();
private:
void waitForState(GDBDebugger::DebugSession *session,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment