binutils-gdb/gdb/cli
Simon Marchi d6ff04a343 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
2021-06-25 21:38:51 -04:00
..
cli-cmds.c gdb: remove add_alias_cmd overload that accepts a string 2021-05-27 14:00:08 -04:00
cli-cmds.h Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
cli-decode.c gdb: add context getter/setter to cmd_list_element 2021-06-25 21:35:40 -04:00
cli-decode.h gdb: add assert in cmd_list_element::set_context 2021-06-25 21:38:51 -04:00
cli-dump.c gdb: add context getter/setter to cmd_list_element 2021-06-25 21:35:40 -04:00
cli-interp.c gdbsupport, gdb: give names to observers 2021-04-24 19:26:41 -04:00
cli-interp.h Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
cli-logging.c gdb: generate the prefix name for prefix commands on demand 2021-05-12 11:19:22 +01:00
cli-option.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
cli-option.h Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
cli-script.c cli-script: use unique_ptr to not leak next struct 2021-05-20 21:03:47 +02:00
cli-script.h cli-script: use unique_ptr to not leak next struct 2021-05-20 21:03:47 +02:00
cli-setshow.c gdb: Pass std::strings to ui_out::field_string () where convenient 2021-05-19 13:58:41 +01:00
cli-setshow.h Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
cli-style.c gdb: add context getter/setter to cmd_list_element 2021-06-25 21:35:40 -04:00
cli-style.h gdb: generate the prefix name for prefix commands on demand 2021-05-12 11:19:22 +01:00
cli-utils.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
cli-utils.h Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00