This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] allow nested sourced commands
- From: Andrew STUBBS <andrew dot stubbs at st dot com>
- To: GDB Patches <gdb-patches at sourceware dot org>
- Date: Tue, 04 Apr 2006 11:24:25 +0100
- Subject: [PATCH] allow nested sourced commands
- References: <442BD6F1.8070804@st.com>
Andrew Stubbs wrote:
I have discovered a problem in the GDB command line reading code.
command_line_input() uses a static buffer to hold the current command.
This means that it is not properly re-entrant - commands that contain
other commands, such as user defined commands, are not handled safely.
See http://sources.redhat.com/ml/gdb-patches/2006-03/msg00356.html
The attached patch should fix the problem.
I tried to fix the problem in command_line_input, but there were too
many ways for the string to leak, so I have opted for the simpler fix,
even though it feels like treating the symptoms, not the problem.
Anyway, with this patch it no longer attempts to read data that has been
overwritten, so everything works fine. Valgrind reports no problems with
the test case I posted before.
Andrew Stubbs