Re: using objdump to debug some n/w code in kernel

Alex Pennace (alex@pennace.org)
Sun, 28 Oct 2001 01:39:39 -0500


On Sun, Oct 28, 2001 at 01:25:06AM -0500, Amit Kucheria wrote:
> I am using the 'makelst' script in the scripts directory to generate
> interleaved source code and assembly listing. This script uses 'objdump'
>
> Now my problem is that the original C code and the .lst files dont seem to
> match. They are listed below.
[...]
> Can anybody throw any light on this 'phenomena' ?
> BTW, the string ': "memory");' seems to be repeating in a lot of
> places in the .lst file. Is there something about objdump that i havent
> read up on.
>
> Regards,
> Amit
>
> Original code:
> -------------
> /* .......
> So host > network > gateway entries.
> */
> for (i=0; i < MAX_ROUTING_ENTRIES; i++)
> {
> /* copy the routing entry into our local variable..just to be safe
> We will optimize later by doing without this copy */
> memcpy(&tmp_entry, ptr_route, sizeof(struct routing_entry));
>
> switch(tmp_entry.rt_flag)
> {
> case 'H':
> /* if dest ip is a host entry */
> ----- end original code -----------------
>
> Code generated using 'makelst:
> -------------------------------
> /* ....
> So host > network > gateway entries.
> */
> for (i=0; i < MAX_ROUTING_ENTRIES; i++)
> c01b3206: 31 ed xor %ebp,%ebp
> c01b3208: 8d 5c 24 48 lea 0x48(%esp,1),%ebx
> c01b320c: 8d 54 24 68 lea 0x68(%esp,1),%edx
> c01b3210: 8b 49 5c mov 0x5c(%ecx),%ecx
> c01b3213: 89 4c 24 18 mov %ecx,0x18(%esp,1)
> c01b3217: 89 54 24 10 mov %edx,0x10(%esp,1)
> c01b321b: 8d 4c 24 28 lea 0x28(%esp,1),%ecx
> c01b321f: 89 4c 24 14 mov %ecx,0x14(%esp,1)
> c01b3223: 90 nop
> : "memory");
> {
> int d0, d1, d2;
> switch (n % 4) {
> case 0: COMMON(""); return to;
[...]

memcpy is a macro. See linux/include/asm-i386/string.h.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/