This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
[gdbserver][WinCE][ARM] gdbserver crash: issue with GetThreadContext???
- From: Matthieu H <maat_h at yahoo dot fr>
- To: gdb at sourceware dot org
- Date: Thu, 10 Feb 2011 10:59:29 +0000 (GMT)
- Subject: [gdbserver][WinCE][ARM] gdbserver crash: issue with GetThreadContext???
- Reply-to: Matthieu H <mhameau at yahoo dot fr>
Hello guys,
I'm trying to do a remote debug using following tools:
HOST is a PC => gdb v6.8 compiled with gcc (i686 mingw32) under latest cygwin
environment
TARGET is a HTC Windows Mobile 6.5 phone (based on WinCE 5.2) powered by ARM11
MSM7227 => gdbserver v6.8 compiled under Ubuntu 10.0 with cegcc v0.55
(arm-mingw32ce)
I'm having an issue with gdbserver, it is crashing immediately when I launch it.
Here are the traces I get (without my debug messages):
> Starting inferior
> Process /haret/haret-debug.exe created; pid = 2012847982
then process crash without further message.
It is not even listening to connections, I even dont launch gdb on host side, it
crashs by itself without any help :-)
I put some traces, and I figured out that the call to function
GetThreadContext(), in arm_get_thread_context() in win32-arm-low.c was somehow
corrupting the "current_inferior" ptid global data, causing the function
"current_inferior_ptid()" to return 0.
The program crashes in child_fetch_inferior_registers() at this line:
> win32_thread_info *th = thread_rec (current_inferior_ptid (), TRUE);
Call to current_inferior_pid() returns 0, causing thread_rec(...) to crash when
trying to get the thread data context.
I tried many things:
- looking for known bugs in gdb bug database (nothing found)
- looking for this kind of bug in gdb mailing list (nothing found)
- looking the different revisions of source code in gdb CVS and trying different
modifications (not worked)
- i tried with gbdserver v6.7, v6.8, v7.2 but no success
I'm running out of solutions here...
The only workaround I found was to replace this line by this one:
/* Fetch register(s) from the current thread context. */
static void
child_fetch_inferior_registers (struct regcache *regcache, int r)
{
int regno;
- win32_thread_info *th = thread_rec (current_inferior_ptid (), TRUE);
+ win32_thread_info *th = thread_rec (current_inferior_ptid (), FALSE);
This tells gdbserver not to load the context of the thread (=it does not call
GetThreadContext() so "current_inferior" is not corrupted)
It's a dirty workaround cause I believe the thread context is required when
debugging!
But at least I can connect using gdb on my host PC.
The program crash later anyway, I believe the workaround is not good :-)
Can you please help me?
Any idea what could be wrong?
GetThreadContext returns value "TRUE", meaning function succeed... maybe
arguments are wrong... but I'm not expert in gdb enough to say that.
Many thanks for your kind help
Matthieu