everyone,when use "next" instruction within gdb,i found each line of sourcecode display twice-----i am quite sure,these code are not in any loop.this is the phenomenon:
(gdb) frame
#0 ap_get_client_block (r=0x8560d48,
buffer=0xb68501b7 "<?xml version=\"1.0\" encoding=\"utf-8\"?><Root><OperCode>SMS101</OperCode><AppId>SMSMsgFilterReq</AppId><Req><UserMobile>13925237429</UserMobile><SendMsg>abc圲34¨圲23a露07\214圲21¢<237朲11?东215圲10°<214朲27¥応227露07\214正常,hao"..., bufsiz=81920) at http_filters.c:1540
1540 if (r->remaining < 0 || (!r->read_chunked && r->remaining == 0)) {
(gdb) n
1544 bb = apr_brigade_create(r->pool, r->connection->bucket_alloc);
(gdb)
1545 if (bb == NULL) {
(gdb)
1544 bb = apr_brigade_create(r->pool, r->connection->bucket_alloc);
(gdb)
1545 if (bb == NULL) {
-----the line 1544,1545 are not in any loop,but they got repeated. May anybody enlighten me?
Setting breakpoints A breakpoint is like a stop sign in your code -- whenever gdb gets to a breakpoint it halts execution of your program and allows you to examine it. To set breakpoints, type "break [filename]:[linenumber]". For example, if you wanted to set a breakpoint at line 55 of main.
It is often useful to do ' display/i $pc ' when stepping by machine instructions. This makes GDB automatically display the next instruction to be executed, each time your program stops.
The usual way to examine data in your program is with the print command (abbreviated p ), or its synonym inspect . It evaluates and prints the value of an expression of the language your program is written in (see section Using GDB with Different Languages). expr is an expression (in the source language).
With the clear command you can delete breakpoints according to where they are in your program. With the delete command you can delete individual breakpoints, watchpoints, or catchpoints by specifying their breakpoint numbers.
What level of optimisation did you have when you compiled this?
Even a minimal level of optimisation can cause your debugger to jump around the source lines like crazy as the compiler inlines, reorders and generally plays with your code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With