* Use xvasprintf instead od xstrvprintf as the later only appeared in GDB 6.2

* Also auto-reply to 'Discard symbol table' query if reset_command is true.

git-svn-id: trunk@19875 -
This commit is contained in:
pierre 2011-12-19 13:01:49 +00:00
parent 19a7e17361
commit 3da5c78e30

View File

@ -1625,7 +1625,10 @@ var
{ used for gdb_stdout and gdb_stderr }
function xmalloc(size : longint) : pointer;cdecl;external;
{ used for QueryHook }
function xstrvprintf(msg : pchar) : pchar; varargs; cdecl; external;
{ xvasprintf is present at least from GDB 5.3
while xstrvprintf only appears in version 6.2,
so only use xvasprintf function }
function xvasprintf(ret : ppchar; msg : pchar) : pchar; varargs; cdecl; external;
procedure xfree(p : pointer); cdecl; external;
function find_pc_line(i:CORE_ADDR;l:longint):symtab_and_line;cdecl;external;
function find_pc_function(i:CORE_ADDR):psymbol;cdecl;external;
@ -2508,11 +2511,15 @@ begin
QueryHook:=0
else
begin
if curr_gdb^.reset_command and (pos('Kill',question)>0) then
if curr_gdb^.reset_command and ((pos('Kill',question)>0) or
(pos('Discard symbol table',question)>0)) then
QueryHook:=1
else if pos('%',question)>0 then
begin
local:=xstrvprintf(question,arg);
xvasprintf(@local,question,arg);
{ xvasprintf can failed, in that case local is set to nil }
if not assigned(local) then
local:=question;
QueryHook:=curr_gdb^.Query(local, nil);
xfree(local);
end