Re: Fwd: error in variable dereferencing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/22/06, Andrew Haley <aph@xxxxxxxxxxx> wrote:> Thibaud GUERIN writes:>  > On 4/21/06, Andrew Haley <aph@xxxxxxxxxxx> wrote:>  > > Thibaud GUERIN writes:>  > >  > >>  > >>  > > OK, so we've got rid of the asms and casting away const, and the code>  > > still doesn't work.>  > >>  > > So, your code is now, at last, legal C.  Let's have a look at the>  > > assembly code generated for my_own_printf (use gcc -S).  Be sure to>  > > include the exact command line you used.>>  > my_own_printf:>> Args are just below sp.>>  >      pushl   %ebp>  >      movl    %esp, %ebp>> ebp points to:  frame, retaddr, arg0>>  >      subl    $8, %esp>  >      leal    8(%ebp), %eax>> eax contains ebp+8: it points to arg0>>  >      movl    %eax, -4(%ebp)>> save eax on the stack>>  >      movl    -4(%ebp), %eax>> restore it>>  >      movl    (%eax), %eax>> load eax from arg0>>  >      cmpl    8(%ebp), %eax>> compare eax with the memory at ebp+8>>  >      jne     .L33>> So, the memory word at ebp+8 is compared with the memory at ebp+8.>> Do you have a debuuger that can single-step through this code, one> insn at a time?
Sorry no debugger... this is a part of the 1st program running (well... trying to run)
The only debug ways usable in the code right now are some things like :i = (long)(fmt);__asm__ volatile ("mov %0, %%eax\n":: "m"(i));__asm__ volatile ("l1: jmp l1");
which are really dirty i agree...
--Thibaud

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux