This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] gdb.server testcases (resend)


> Yes, this will not work.  The correct way to handle this is to wait
> until I have implemented the available target features proposal I've
> posted on gdb@, and then I can make gdbserver inform GDB that 64-bit
> registers are available so that it will expect them.

So you are going to add a command for gdbserver to notify remote gdb 
the availability of 64-bit registers?  That is good.  But I am also
thinking of other ways.  The first solution I thought of is to let 
gdbserver choose which set of registers to use according to the
arch (32-bit or 64-bit) of the debuggee.  The other solution I could 
thought of is to let host-side gdb accept 64-bit register as well.
I even tried some coding with the second method.  It seems that it 
worked sorta, at least I can set breakpoint, continue the process 
and so on.  But I did met problems with "next" and "step" commands,
which didn't go on with executing the process at all.  

Because I am not that familar with the code of gdb/gdbserver, so I
am not very sure where to find the root cause of these problems.  I
am also not sure whether these two methods are workable?  Would you
please help evaluate this?  If it is really workable, what is the 
pros and cons of these methods compared to your proposal?  Thanks 
a lot! 

> This will require some surgery in GDB, I'm sure.  The way MIPS
> implements this is not very reliable.
> 
> > Program received signal SIGFPE, Arithmetic exception.
> > 0x000000800013fd64 in .vfprintf () from /lib64/tls/libc.so.6
> > (gdb) 
> > 
> 
> I have no idea what causes this one, sorry.

That SIGFPE error disappeared after applying your patch to latest
GDB cvs tree.  But I met with another strange problem when debugging
gdb.base/break, which defines the following function:

int factorial (value)
int value;
#endif
{
  if (value > 1) {  /* set breakpoint 7 here */
        value *= factorial (value - 1);
    }
    return (value); /* set breakpoint 19 here */
}

normally factorial(6) will recursively call itself 5 times and return
720.  However while using 64-bit gdbserver on 64-bit binary, it doesn't
call factorial(5) at all, return directly 6 as the result.

I am suspecting that "value > 1" doesn't get executed, so I change the
conditional statement to "if (value - 1)", it worked!  So it turn out
that "value > 1" always return 0 in this running context.  That is really
odd.  Any clues you could thought of?  Thanks in advance.  

Cheers
- Wu Zhou


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]