Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | James Kuyper <jameskuyper@verizon.net> |
|---|---|
| Newsgroups | comp.std.c |
| Subject | Re: what may make the address of the member of the argument changed when doing function call? |
| Date | 2011-08-02 11:10 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <j1940v$983$1@dont-email.me> (permalink) |
| References | <de86f4f5-4a2b-4021-bd07-b59308cdba86@y19g2000pre.googlegroups.com> |
On 08/02/2011 10:10 AM, stefan wrote:
> hi,everyone,
> i have a problem, what may make the address of the member of the
> argument changed when doing function call?
>
> here is the gdb status:
>
>
> 2 Breakpoint 1, ngx_http_core_content_phase (r=0x9743058,
> ph=0x976a804) at src/http/ngx_http_core_module.c:1353
> 3 1353 if (r->content_handler) {
...
> 6 (gdb) p r->connection
> 7 $26 = (ngx_connection_t *) 0x97e400c8
...
> 14 (gdb) p &r->connection->log
> 15 $30 = (ngx_log_t **) 0x97e400f4
> 16 (gdb) n
> 17 1354 r->write_event_handler =
> ngx_http_request_empty_handler;
> 18 (gdb) n
> 19 1355 ngx_http_finalize_request(r, r-
>> content_handler(r));
...
> 28 (gdb) p r->connection
> 29 $33 = (ngx_connection_t *) 0x97e400c8
...
> 34 (gdb) p &r->connection->log
> 35 $36 = (ngx_log_t **) 0x97e400f0
>
> the address of [r->connection->log] changed when doing funciton call,
I would expect that
(char*)(&r->connection->log) - (char*)(r->connection)
== offsetof(nqx_connection_t, log)
and I would not the validity of that identity would be something that
could be changed by calling a subroutine, not even if, as a result of
that call, some memory got corrupted. Technically, I can't be sure what
the value of that difference is, just by looking at the print outs of
the values of the pointers. However, in practice those values often have
a very obvious meaning. If so, then unless the debugger you're using is
seriously malfunctioning, it would appear my expectations are incorrect,
which suggests that I'm missing something, probably something very
simple that will cause me a lot of embarrassment when I figure out what
it is.
To help me figure out what I'm missing, could you print out the values
of the left and right operands of the above equality comparison, both
before and after executing line 1355?
> here is the code snip:
Code is a LOT easier to read without line numbers. Also, for some
reason, every single one of your lines seems to have wrapped, even the
short ones, which makes the code even harder to read. In any event, I
didn't identify any obvious problem by looking at your code. However, it
would help if, in the future, you printed it out without line numbers
and without unintentional wrapping. Use comments to tell us the
important line numbers, such as /* Line 1355. */.
--
James Kuyper
Back to comp.std.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
what may make the address of the member of the argument changed when doing function call? stefan <pengli.hust@gmail.com> - 2011-08-02 07:10 -0700
Re: what may make the address of the member of the argument changed when doing function call? James Kuyper <jameskuyper@verizon.net> - 2011-08-02 11:10 -0400
Re: what may make the address of the member of the argument changed when doing function call? Wojtek Lerch <wojtek_l@yahoo.ca> - 2011-08-02 16:55 -0400
Re: what may make the address of the member of the argument changed when doing function call? James Kuyper <jameskuyper@verizon.net> - 2011-08-03 10:18 -0400
Re: what may make the address of the member of the argument changed when doing function call? "dSpam@arcor.de" <dSpam@arcor.de> - 2011-08-24 05:10 -0700
csiph-web