From: Daniel Gutson <daniel.gutson@tallertechnologies.com>
To: gdb-patches@sourceware.org
Subject: [PATCH] Small segfault fix when there is no python
Date: Thu, 20 Mar 2014 16:33:00 -0000 [thread overview]
Message-ID: <CAF5HaEU+9uQn=P37F=c8WxausmA3BPL9SKXoTVZh+2SNA1V1cw@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 639 bytes --]
Hi,
the small attached patch prevents gdb to segfault when an extension
language definition has no ops,
which e.g. occurs when HAVE_PYTHON is not defined so
extension_language_python remains with ops in NULL.
This causes the line
if (extlang->ops->eval_from_control_command != NULL)
(in eval_ext_lang_from_control_command) to dereference a null pointer.
Please commit it for me if approved since I don't have write access.
Thanks,
Daniel.
2014-03-20 Daniel Gutson (daniel.gutson@tallertechnologies.com)
gdb/
* extension.c: (eval_ext_lang_from_control_command) Added check to
prevent dereference of null pointer.
[-- Attachment #2: python.patch --]
[-- Type: text/x-patch, Size: 768 bytes --]
diff --git a/gdb/extension.c b/gdb/extension.c
index c2f502b..8357ee8 100644
--- a/gdb/extension.c
+++ b/gdb/extension.c
@@ -342,11 +342,14 @@ eval_ext_lang_from_control_command (struct command_line *cmd)
{
if (extlang->cli_control_type == cmd->control_type)
{
- if (extlang->ops->eval_from_control_command != NULL)
- {
- extlang->ops->eval_from_control_command (extlang, cmd);
- return;
- }
+ if (extlang->ops != NULL)
+ {
+ if (extlang->ops->eval_from_control_command != NULL)
+ {
+ extlang->ops->eval_from_control_command (extlang, cmd);
+ return;
+ }
+ }
/* The requested extension language is not supported in this GDB. */
throw_ext_lang_unsupported (extlang);
}
next reply other threads:[~2014-03-20 16:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-20 16:33 Daniel Gutson [this message]
2014-03-20 17:31 ` Sergio Durigan Junior
2014-03-20 17:52 ` Doug Evans
2014-03-21 16:24 ` Daniel Gutson
2014-03-22 7:02 ` Doug Evans
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='CAF5HaEU+9uQn=P37F=c8WxausmA3BPL9SKXoTVZh+2SNA1V1cw@mail.gmail.com' \
--to=daniel.gutson@tallertechnologies.com \
--cc=gdb-patches@sourceware.org \
/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