This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] allow nested sourced commands


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]