diff --git a/tools/cabana/dbc/dbcfile.cc b/tools/cabana/dbc/dbcfile.cc
index 208c290844d0580..8357fbf3dc2ed1a 100644
--- a/tools/cabana/dbc/dbcfile.cc
+++ b/tools/cabana/dbc/dbcfile.cc
@@ -152,7 +152,7 @@ cabana::Msg *DBCFile::parseBO(const QString &line) {
}
void DBCFile::parseCM_BO(const QString &line, const QString &content, const QString &raw_line, const QTextStream &stream) {
- const static QRegularExpression msg_comment_regexp(R"(^CM_ BO_ *(\w+) *\"((?:[^"\\]|\\.)*)\"\s*;)");
+ const static QRegularExpression msg_comment_regexp(R"(^CM_ BO_ *(?
\w+) *\"(?(?:[^"\\]|\\.)*)\"\s*;)");
QString parse_line = line;
if (!parse_line.endsWith("\";")) {
@@ -161,10 +161,10 @@ void DBCFile::parseCM_BO(const QString &line, const QString &content, const QStr
}
auto match = msg_comment_regexp.match(parse_line);
if (!match.hasMatch())
- throw std::runtime_error("");
+ throw std::runtime_error("Invalid message comment format");
- if (auto m = (cabana::Msg *)msg(match.captured(1).toUInt()))
- m->comment = match.captured(2).trimmed().replace("\\\"", "\"");
+ if (auto m = (cabana::Msg *)msg(match.captured("address").toUInt()))
+ m->comment = match.captured("comment").trimmed().replace("\\\"", "\"");
}
cabana::Signal *DBCFile::parseSG(const QString &line, int &multiplexor_cnt) {
@@ -178,7 +178,7 @@ cabana::Signal *DBCFile::parseSG(const QString &line, int &multiplexor_cnt) {
offset = 1;
}
if (!match.hasMatch())
- throw std::runtime_error("");
+ throw std::runtime_error("Invalid SG_ line format");
auto name = match.captured(1);
// if (signal())
@@ -222,7 +222,7 @@ void DBCFile::parseCM_SG(const QString &line, const QString &content, const QStr
}
auto match = sg_comment_regexp.match(parse_line);
if (!match.hasMatch())
- throw std::runtime_error("");
+ throw std::runtime_error("Invalid CM_ SG_ line format");
if (auto s = signal(match.captured(1).toUInt(), match.captured(2))) {
s->comment = match.captured(3).trimmed().replace("\\\"", "\"");
@@ -234,7 +234,7 @@ void DBCFile::parseVAL(const QString &line) {
auto match = val_regexp.match(line);
if (!match.hasMatch())
- throw std::runtime_error("");
+ throw std::runtime_error("invalid VAL_ line format");
if (auto s = signal(match.captured(1).toUInt(), match.captured(2))) {
QStringList desc_list = match.captured(3).trimmed().split('"');