LinuxÒÁµéÔ°ÂÛ̳'s Archiver

yuan1984 ·¢±íÓÚ 2006-9-8 17:31

¡¾ÇóÖú¡¿gdbµ÷ÊÔµÄÎÊÌâ

ÓÃgdbµ÷ÊÔ³ÌÐòÈçÏÂ5`^r;|'YG-]v
#include <stdio.h>ME'Tv&X;@
void my_print (char *string)
,E*Jz r(V4_0kkl/va#` {
U2G9TBm printf ("The string is %s\n", string);
^6POiK2x!b }
v,ik8BMC3m void my_print2 (char *string)
5C.s%T&fg*wA&l Z\+pn {
Q2N{bIo.\'] char *string2;q,y%M P+L_
int size, i;
6ASJ kDe5]#gJEb7f size = strlen (string);
k g ^"gRl:uJh"s string2 = (char *) malloc (size + 1);
]6D8{(Q3z \tH6J for (i = 0; i < size; i++)q'`"W B`wG!t
string2[size - i] = string[i];
Yle2TGh tcW q/CK%[ string2[size+1] = '\0';
y7t5jW No`Er-w printf ("The string printed backward is %s\n", string2);
X/S-p/?X0Fce0a6MJ })a U0l0B5?/s
main () e?HWU^I^w
{M"W*V;_ {8l
char my_string[] = "hello there";
a d!}PnE-GA(K my_print (my_string);
xk%V7LN9b my_print2 (my_string);
l7I ~4`!i }
5c nPZW x)C)L ÔÚstring2[size - i] = string[i];ÕâÐÐÓÃbreakÉè¶Ïµã
a U?giDh ÓÃwatch¹Û²ì±äÁ¿string2£Ûsize£­i£Ý:oP\k6i
ÔÙÊäÈënextºó°´»Ø³µ£¬È´ÏÔʾ
-}&g~+k3gQ(@!LZ (gdb) next$t2l[L;f\
warning: Could not remove hardware watchpoint 2.
UP6bS ^-e Warning:
`"h]G+]3E8huh d Could not insert hardware watchpoint 2.VVt!|+Z1j!Q
Could not insert hardware breakpoints:6D.WW `1@6z
You may have requested too many hardware breakpoints/watchpoints.C/{l5o mB
ÇëÎʸ÷룬ÄÄÀï³ö´íÁË

flag ·¢±íÓÚ 2006-9-11 09:31

²Ù×÷ÎÊÌ⣿û¼û¹ýÕâÖÖ´í£¬ÖØÐµ÷ÊÔÄØ£¿

thornybird ·¢±íÓÚ 2006-9-14 22:12

#include <stdio.h>
+zMz@9| 8LP1Q$o*i B'i
char *string;
N!srE+Xxl void my_print (char *string)qbL C5CS6^
{gqL/M"U)G'J&a
printf ("The string is %s\n", string);;u:VN]D2a
}
[ v!|5v#[/r
2B r%d&B(E,s F void my_print2 (char *string)
J-}a;I@h,\b {#\n u+K7fnSG:K.us3b ]`

n*S \M0f rt1w X7[.@;[)O int size, i;
4c~I4b~JU3wz size = strlen (string);Yd @0z@R)lO;c$K
string = (char *) malloc (size + 1);
/V2o(V3p{~{"Wh(c for (i = 0; i < size; i++)n(Iq/M1CA
string[size - i] = string[i];
rk;e3cqVh string[size+1] = '\0';
s:e7OKDJ ?#c ] printf ("The string printed backward is %s\n", string);odR.} B;N|
}(o/XvW2d

J)c%e-Lu,t main () Dd _x _ n4ZX
{
pQb,[#XD{$_ char my_string[] = "hello there";z_c[ DA
my_print (my_string);
%hW4V m,o{]abI;j my_print2 (my_string);
|M;j(R$u*m };v!jn.z q]

4@L+a;L7|4`:n Z)jz1A"v M#k2^8B?nEF
ÎÒÕâÑù¸ÄÁË£¬Êä³öÊÇ£º
xrL0mV$uX? The string is hello there
A,@3c4rZV5y3P;{K The string printed backward is

Ò³: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.