From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Maxim Levitsky <mlevitsk@redhat.com>
Subject: Re: [PATCH] kconfig: qconf: make debug links work again
Date: Sun, 28 Jun 2020 18:20:53 +0200 [thread overview]
Message-ID: <20200628182053.18bfe307@coco.lan> (raw)
In-Reply-To: <CAK7LNARnDe0ToxYj9mMpocxzmrUvp6yf14iDRxgG8nGuGcxFKw@mail.gmail.com>
Em Sun, 28 Jun 2020 23:41:46 +0900
Masahiro Yamada <masahiroy@kernel.org> escreveu:
> On Sun, Jun 28, 2020 at 9:21 PM Mauro Carvalho Chehab
> <mchehab+huawei@kernel.org> wrote:
> >
> > The Qt5 conversion broke support for debug info links.
> >
> > Restore the behaviour added by changeset
> > ab45d190fd4a ("kconfig: create links in info window").
> >
> > Reported-by: Maxim Levitsky <mlevitsk@redhat.com>
> > Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
>
>
> I tested this patch, but this caused
> segmentation fault.
>
>
> I enabled 'Show Debug Info',
> and then clicked
> dep: <symbol name>.
>
> Then, xconfig crashed.
>
> (without this patch, it did not cause
> segfault at least)
>
> Did you see this?
Could you please try the attached version? It should validate again the
symbols, instead of relying on a pointer passed via an URL.
This version still passes pointers via URLs for menus, though,
as it doesn't implement any logic for seeking the menu->prompt
string.
With this version, if something bad happens when parsing a
symbol internal URL, the code will print a message and ignore
it.
Thanks,
Mauro
[PATCH] kconfig: qconf: make debug links work again
The Qt5 conversion broke support for debug info links.
Restore the behaviour added by changeset
ab45d190fd4a ("kconfig: create links in info window").
Reported-by: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 631e19659504..7dae5c5989db 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -7,6 +7,7 @@
#include <QAction>
#include <QApplication>
#include <QCloseEvent>
+#include <QDebug>
#include <QDesktopWidget>
#include <QFileDialog>
#include <QLabel>
@@ -1012,7 +1013,7 @@ ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
: Parent(parent), sym(0), _menu(0)
{
setObjectName(name);
-
+ setOpenLinks(false);
if (!objectName().isEmpty()) {
configSettings->beginGroup(objectName());
@@ -1085,7 +1086,7 @@ void ConfigInfoView::menuInfo(void)
if (sym->name) {
head += " (";
if (showDebug())
- head += QString().sprintf("<a href=\"s%p\">", sym);
+ head += QString().sprintf("<a href=\"s%s\">", sym->name);
head += print_filter(sym->name);
if (showDebug())
head += "</a>";
@@ -1094,7 +1095,7 @@ void ConfigInfoView::menuInfo(void)
} else if (sym->name) {
head += "<big><b>";
if (showDebug())
- head += QString().sprintf("<a href=\"s%p\">", sym);
+ head += QString().sprintf("<a href=\"s%s\">", sym->name);
head += print_filter(sym->name);
if (showDebug())
head += "</a>";
@@ -1217,13 +1218,56 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char
QString str2 = print_filter(str);
if (sym && sym->name && !(sym->flags & SYMBOL_CONST)) {
- *text += QString().sprintf("<a href=\"s%p\">", sym);
+ *text += QString().sprintf("<a href=\"s%s\">", sym->name);
*text += str2;
*text += "</a>";
} else
*text += str2;
}
+void ConfigInfoView::clicked(const QUrl &url)
+{
+ QByteArray str = url.toEncoded();
+ const std::size_t count = str.size();
+ char *hex = new char[count + 1];
+ char type;
+ struct symbol **result;
+
+ if (count < 1) {
+ qInfo() << "Clicked link is empty";
+ return;
+ }
+
+ memcpy(hex, str.constData(), count);
+ type = hex[0];
+
+ if (type == 's') {
+ /* Seek for exact match */
+ hex[0] = '^';
+ strcat(hex, "$");
+ result = sym_re_search(hex);
+ if (!result) {
+ qInfo() << "Clicked symbol is invalid";
+ return;
+ }
+
+ sym = *result;
+ symbolInfo();
+ } else {
+ unsigned long p = (int)strtol(hex + 1, NULL, 16);
+ if (!p) {
+ qInfo() << "Clicked menu is invalid";
+ return;
+ }
+
+ struct menu *m = (struct menu *)p;
+
+ _menu = m;
+ menuInfo();
+ }
+ emit showDebugChanged(true);
+}
+
QMenu* ConfigInfoView::createStandardContextMenu(const QPoint & pos)
{
QMenu* popup = Parent::createStandardContextMenu(pos);
@@ -1497,6 +1541,9 @@ ConfigMainWindow::ConfigMainWindow(void)
helpMenu->addAction(showIntroAction);
helpMenu->addAction(showAboutAction);
+ connect (helpText, SIGNAL (anchorClicked (const QUrl &)),
+ helpText, SLOT (clicked (const QUrl &)) );
+
connect(configList, SIGNAL(menuChanged(struct menu *)),
helpText, SLOT(setInfo(struct menu *)));
connect(configList, SIGNAL(menuSelected(struct menu *)),
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index d913a02967ae..a193137f2314 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -250,6 +250,7 @@ public slots:
void setInfo(struct menu *menu);
void saveSettings(void);
void setShowDebug(bool);
+ void clicked (const QUrl &url);
signals:
void showDebugChanged(bool);
prev parent reply other threads:[~2020-06-28 16:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-28 12:21 [PATCH] kconfig: qconf: make debug links work again Mauro Carvalho Chehab
2020-06-28 12:25 ` Maxim Levitsky
2020-06-28 14:41 ` Masahiro Yamada
2020-06-28 14:48 ` Maxim Levitsky
2020-06-28 14:58 ` Masahiro Yamada
2020-06-28 15:51 ` Mauro Carvalho Chehab
2020-06-28 16:20 ` Mauro Carvalho Chehab [this message]
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=20200628182053.18bfe307@coco.lan \
--to=mchehab+huawei@kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=mlevitsk@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.