gdb - how could the const char * changed? -
i writing program can print directory recursively, below gdb debug segment
note d_path (it const char * passed parameter print_dir_tree) "/home/cifer/.gftp" before step "if (dr == null) {" however, printed "/home/cifer/!\200" after clause
who can tell me why? lot!
breakpoint 1, print_dir_tree (d_path=0x805b058 "/home/cifer/.gftp", depth=4) @ dir_demo.c:15 15 dir *dr = opendir(d_path); (gdb) print d_path $2 = 0x805b058 "/home/cifer/.gftp" (gdb) print d_path $3 = 0x805b058 "/home/cifer/.gftp" (gdb) step 16 if (dr == null) { (gdb) print d_path $4 = 0x805b058 "/home/cifer/!\200" (gdb) step 20 struct dirent *de = null; (gdb) print d_path $5 = 0x805b058 "/home/cifer/!\200" (gdb) step 21 while((de = readdir(dr)) != null) { (gdb) print d_path $6 = 0x805b058 "/home/cifer/!\200" (gdb)
i need see code tell sure if asking if const can changed answer yes. if asking how can changed, simple, treated regular variable give warning when changed. if trying change , avoid warning can copy variable , make changes it.
Comments
Post a Comment