* GDB/MI escape characters
@ 2014-07-28 1:03 Bob Rossi
2014-07-30 10:45 ` Bob Rossi
0 siblings, 1 reply; 2+ messages in thread
From: Bob Rossi @ 2014-07-28 1:03 UTC (permalink / raw)
To: gdb
Hi,
Does anyone know what characters GDB escapes in the GDB/MI protocol
above and beyond what would otherwise be escaped from the CLI?
For instance if i print the variable p,
char *p = "aaa\"aaa\naaa\raaa\\aaa";
from the cli I get,
(gdb) p p
$1 = 0x400584 "aaa\"aaa\naaa\raaa\\aaa"
from MI I get,
p p
~"$2 = 0x400584 \"aaa\\\"aaa\\naaa\\raaa\\\\aaa\""
From the output I can see that \ and " are escaped in MI output above
and beyond what is escaped in the CLI. Are there other characters that
would be?
The function mi-out.c:mi_field_string might be a clue?
Thanks,
Bob Rossi
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: GDB/MI escape characters
2014-07-28 1:03 GDB/MI escape characters Bob Rossi
@ 2014-07-30 10:45 ` Bob Rossi
0 siblings, 0 replies; 2+ messages in thread
From: Bob Rossi @ 2014-07-30 10:45 UTC (permalink / raw)
To: gdb
On Sun, Jul 27, 2014 at 09:03:03PM -0400, Bob Rossi wrote:
> Hi,
>
> Does anyone know what characters GDB escapes in the GDB/MI protocol
> above and beyond what would otherwise be escaped from the CLI?
>
> For instance if i print the variable p,
> char *p = "aaa\"aaa\naaa\raaa\\aaa";
> from the cli I get,
> (gdb) p p
> $1 = 0x400584 "aaa\"aaa\naaa\raaa\\aaa"
> from MI I get,
> p p
> ~"$2 = 0x400584 \"aaa\\\"aaa\\naaa\\raaa\\\\aaa\""
>
> From the output I can see that \ and " are escaped in MI output above
> and beyond what is escaped in the CLI. Are there other characters that
> would be?
>
> The function mi-out.c:mi_field_string might be a clue?
I've determined that the quoting explicitely happens for c-string's
rules in the grammar here,
https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Output-Syntax.html#GDB_002fMI-Output-Syntax
I was debugging gdb and got to utils.c, this function,
http://pastie.org/private/hcabdm4q81jdrt4yhpghwg#6
the quoter parameter is ".
So I think I've determined that in general, gdb will escape \ to \\
and " to \" so the gdb/mi client has to undo that. Make sense?
I was pretty suprised to see in that example that the ESC character goes
to \e, but only in some situations.
Thanks,
Bob Rossi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-07-30 10:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-28 1:03 GDB/MI escape characters Bob Rossi
2014-07-30 10:45 ` Bob Rossi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox