]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdb/ChangeLog
gdb: add assert in cmd_list_element::set_context
authorSimon Marchi <simon.marchi@polymtl.ca>
Sat, 26 Jun 2021 01:38:51 +0000 (21:38 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Sat, 26 Jun 2021 01:38:51 +0000 (21:38 -0400)
commitd6ff04a343f97026f7d23bb036e0f858b21f3bfd
treefba88a27803f0729e6e5193e3a62eef51e5df8fb
parent0f8e2034128e4a73e02cb8311eeeea7e886a5985
gdb: add assert in cmd_list_element::set_context

If something tries to set a context pointer on a cmd_list_element and
m_context is not nullptr, it's likely that two parts of the code are
trying to set different contexts, and one will overwrite the other.
This is almost guaranteed to lead to bad behavior or a crash, as one of
the spots will not be using the data it expects.  This happened to me
during development, so I think having this assert would be useful to
catch this problem earlier.

gdb/ChangeLog:

* cli/cli-decode.h (struct cmd_list_element) <set_context>: Add
assert.

Change-Id: I1f2e9fda1bf2bec1b732c9b90e7d7910a97f2ac6
gdb/ChangeLog
gdb/cli/cli-decode.h