debugging - gdb ignores my breakpoints and more -
i have situation set breakpoint in gdb, doesn't have impact , programme continues run.
if run programme shell, prints @ syslog (line 483).
so, run same programme in gdb, set breakpoint @ line (483) , nail run, instead of stopping @ line, programme continues run until end.
... reading symbols /usr/src/scannedonly-0.21/src/scannedonlyd_clamav...done. (gdb) b 483 breakpoint 1 @ 0x804a8f1: file scannedonlyd_clamav.c, line 483. (gdb) run -n starting program: /usr/src/scannedonly-0.21/src/scannedonlyd_clamav [thread debugging using libthread_db enabled] have_libclamav_cl_init: 1 main mark mark2 mark3 load_engine() load_engine() libclamav error: can't load /usr/local/share/clamav/daily.cvd: can't allocate memory programme exited code 02. (gdb)
here part of source:
469 static struct cl_engine *load_engine() ... 480 cl_engine_set_num(tmp, cl_engine_max_scansize, (long long) 1024 * 1024 * 1024 * 5); 481 cl_engine_set_num(tmp, cl_engine_max_filesize, (long long) 1024 * 1024 * 1024 * 5); 482 if ((ret = cl_load(cl_retdbdir(), tmp, &sigs, cl_db_stdopt)) != cl_success) { 483 syslog(log_crit, "warning2: loading clamav database failed: %s", cl_strerror(ret)); 484 cl_engine_free(tmp); 485 homecoming null;
if set breakpoint function load_engine(), looks sets breakpoint source file.
the news stops @ breakpoint, it's runs within block-comment (lines 493, 497):
reading symbols /usr/src/scannedonly-0.21/src/scannedonlyd_clamav...done. (gdb) b load_engine breakpoint 1 @ 0x80496f7: file /usr/include/bits/stdio2.h, line 105. (gdb) run -n starting program: /usr/src/scannedonly-0.21/src/scannedonlyd_clamav -n [thread debugging using libthread_db enabled] have_libclamav_cl_init: 1 main mark mark2 mark3 load_engine() breakpoint 1, load_engine () @ /usr/include/bits/stdio2.h:105 105 homecoming __printf_chk (__use_fortify_level - 1, __fmt, __va_arg_pack ()); (gdb) n 493 #else (gdb) n 105 homecoming __printf_chk (__use_fortify_level - 1, __fmt, __va_arg_pack ()); (gdb) n load_engine() 497 } (gdb) list 492 /* 493 #else 494 if ((ret = cl_load(cl_retdbdir(), &tmp, &sigs, cl_db_stdopt))) { 495 syslog(log_crit, "warning: loading clamav database failed: %s", cl_strerror(ret)); 496 homecoming null; 497 } 498 if ((ret = cl_build(tmp))) { 499 syslog(log_crit, "warning: building clamav engine failed: %s", cl_strerror(ret)); 500 cl_free(tmp); 501 homecoming null;
if set breakpoint @ line (1200) in main(), stops @ right line on hitting next, programme flow skips lines. goes line 1200 1208 on single "next", although shouldn't (i'm posting "list" can see source):
reading symbols /usr/src/scannedonly-0.21/src/scannedonlyd_clamav...done. (gdb) b 1200 breakpoint 1 @ 0x804b97e: file scannedonlyd_clamav.c, line 1200. (gdb) run -n starting program: /usr/src/scannedonly-0.21/src/scannedonlyd_clamav -n [thread debugging using libthread_db enabled] have_libclamav_cl_init: 1 main mark mark2 mark3 breakpoint 1, main (argc=2, argv=0xbffff794) @ scannedonlyd_clamav.c:1200 1200 #endif (gdb) list 1195 #ifdef have_libclamav_cl_init 1196 if (cl_init(cl_init_default) != cl_success) { 1197 syslog(log_crit, "abort, failed initialize libclamav"); 1198 exit(3); 1199 } 1200 #endif 1201 debug_msg("about load_engine()\n"); 1202 engine[0] = load_engine(); 1203 engine[1] = null; 1204 current_engine = 0; (gdb) n 1208 } (gdb) list 1203 engine[1] = null; 1204 current_engine = 0; 1205 if (engine[0] == null) { 1206 syslog(log_crit, "abort, exiting: no clam engine"); 1207 exit(2); 1208 } 1209 memset(&dbstat, 0, sizeof(struct cl_stat)); 1210 cl_statinidir(cl_retdbdir(), &dbstat); 1211 #ifndef have_libclamav_cl_init 1212 memset(&limits, 0, sizeof(struct cl_limits));
am doing wrong? ideas?
btw, "run -n" argument of programme print msgs in console.
the problem after \r characters in source. removing them solves problem.
debugging gdb
No comments:
Post a Comment