[uClinux-dev] gdbserver kills the shell?

Stuart Hughes stuarth at freescale.com
Thu Oct 6 04:05:15 EDT 2005


Hi John,

I looked at your patches.  They are similar to what I have now (except I
removed the v850 code).

For the m68knommu platform I'm working on, it doesn't have entries in
ptrace.h for: PT_TEXT_ADDR, PT_DATA_ADDR, PT_TEXT_LEN

Rather than try to put that into my kernel source, I did it this way:

+#if defined(__m68k__)
+/********************************************************************
+   Note that some architectures define the following in ptrace.h
+   For an example see: include/asm-v850/ptrace.h in the kernel
+*********************************************************************/
+#define PT_TEXT_ADDR 49*4
+#define PT_TEXT_LEN  50*4
+#define PT_DATA_ADDR 51*4
+#endif
+
+/* Some linux-specific handling for extended 'q' packets.  */
+static int
+linux_handle_query (char *own_buf)
+{
+#if defined(PT_TEXT_ADDR) && defined(PT_DATA_ADDR) && defined(PT_TEXT_LEN)
+  /* Under uClinux, programs are loaded at non-zero offsets, which we need
+     to tell gdb about.  */
+  if (strcmp ("qOffsets", own_buf) == 0)
+    {
+      unsigned long text, text_len, real_data;
+      int pid = get_thread_process (current_inferior)->head.id;
+
+
+      errno = 0;
+
+      text = ptrace (PTRACE_PEEKUSER, pid, (long)PT_TEXT_ADDR, 0);
+      text_len = ptrace (PTRACE_PEEKUSER, pid, (long)PT_TEXT_LEN, 0);
+      real_data = ptrace (PTRACE_PEEKUSER, pid, (long)PT_DATA_ADDR, 0);


I suspect there is a better way of doing it than hard coding the
constants in the linux-low.c file, but I couldn't think of a simple way.

Regards, Stuart


Stuart Hughes wrote:
> Hi John,
> 
> I sent a second patch yesterday which is much closer to the one you have 
> just sent (as it's based on Miles' patches).  Did you see my second 
> posting ?
> 
> The difference in the 2 sets of patches I sent can be explained by the 
> fact the first was extracted from the older 
> uClinux-dist-20041215.tar.bz2 and the second on 
> uClinux-dist-test-20050906.tar.bz2 (Miles Bader based).
> 
> I'll try your patches and let you know.
> 
> Regards, Stuart
> 
> 
> John Williams wrote:
> 
>> Hi Stuart,
>>
>> Stuart Hughes wrote:
>>
>>> Here's a patch based on Miles Bader's.  I've removed the v850 sections
>>> to try to make it just a nommu patch.
>>>
>>> Again, this is against vanilla gdb-6.0.
>>
>>
>>
>> The version of gdb now in the uClinux-dist (/usr/gdb) appears to be 6.3.
>>  I manually merged Miles' older patches into this without too much
>> trouble, and it seems to work ok for microblaze at least.  The main
>> changes are the fork->vrofk, adding config.srv target, and introducing
>> support for the qOffset remote packet type.
>>
>> What's odd is the way this was done in his original patches is quite
>> different in form (if not function) to the patch that you have sent.
>>
>> One notable difference in the version you have is use of hard coded
>> ptrace(PTRACE_PEEKUSR,...)  offsets for the TEXT, DATA and BSS queries,
>> rather than the PT_TEXT_ADDR, _DATA_ADDR and _BSS_ADDR macros that are
>> defined in linux-2.4.x/include/asm/ptrace.h
>>
>> I guess this is just versionitis, both on patches and base gdb versions.
>>  I agree with DaveM's sentiments that we should track the latest,
>> whatever that may be.  From where I'm sitting, that looks like gdb6.3
>> that is currently in uClinux-dist.  I've attached my patches, can you
>> try them at your end, and see how they look?
>>
> _______________________________________________
> uClinux-dev mailing list
> uClinux-dev at uclinux.org
> http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
> This message was resent by uclinux-dev at uclinux.org
> 





More information about the uClinux-dev mailing list