ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
had some experience with 'immediate window' in MSaccessBasic (with a lot of help from access user forums), but that was nice & simple. Never used a true source code debugger before.
With gdb, I know commands like b & d & infolocals, but the real 'programmers' commands like 's' are beyond me, and I can rarely get gdb to show me what's going on in called programs.
I don't think anyone mentioned to the OP that escape character precedes the character to be escaped. In many of the posted examples, the backslash seemed to follow the character to be escaped.
?
? cat literaStringsTest.c
#include <stdio.h>
#include <stdlib.h>
char literalString[] = "This literal string has a d-quote \" embedded in it.";
int main( int argc, char * argv[] ){
puts( "A literal string with a percent-D symbol: %d \n" );
printf( "A literal string with a percent-D symbol: %%d \n" );
exit(0);
}
?
Code:
?
? make CFLAGS+=-g literaStringsTest
cc -g literaStringsTest.c -o literaStringsTest
?
Code:
?
? gdb literaStringsTest
GNU gdb (GDB) 7.0.1-debian
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/bomr/Util/c/literaStringsTest...done.
(gdb) x /56c literalString
0x80496c0 <literalString>: 84 'T' 104 'h' 105 'i' 115 's' 32 ' ' 108 'l' 105 'i' 116 't'
0x80496c8 <literalString+8>: 101 'e' 114 'r' 97 'a' 108 'l' 32 ' ' 115 's' 116 't' 114 'r'
0x80496d0 <literalString+16>: 105 'i' 110 'n' 103 'g' 32 ' ' 104 'h' 97 'a' 115 's' 32 ' '
0x80496d8 <literalString+24>: 97 'a' 32 ' ' 100 'd' 45 '-' 113 'q' 117 'u' 111 'o' 116 't'
0x80496e0 <literalString+32>: 101 'e' 32 ' ' 34 '"' 32 ' ' 101 'e' 109 'm' 98 'b' 101 'e'
0x80496e8 <literalString+40>: 100 'd' 100 'd' 101 'e' 100 'd' 32 ' ' 105 'i' 110 'n' 32 ' '
0x80496f0 <literalString+48>: 105 'i' 116 't' 46 '.' 0 '\000' 0 '\000' 0 '\000' 0 '\000' 0 '\000'
(gdb) x /56xb literalString
0x80496c0 <literalString>: 0x54 0x68 0x69 0x73 0x20 0x6c 0x69 0x74
0x80496c8 <literalString+8>: 0x65 0x72 0x61 0x6c 0x20 0x73 0x74 0x72
0x80496d0 <literalString+16>: 0x69 0x6e 0x67 0x20 0x68 0x61 0x73 0x20
0x80496d8 <literalString+24>: 0x61 0x20 0x64 0x2d 0x71 0x75 0x6f 0x74
0x80496e0 <literalString+32>: 0x65 0x20 0x22 0x20 0x65 0x6d 0x62 0x65
0x80496e8 <literalString+40>: 0x64 0x64 0x65 0x64 0x20 0x69 0x6e 0x20
0x80496f0 <literalString+48>: 0x69 0x74 0x2e 0x00 0x00 0x00 0x00 0x00
(gdb)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.