This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH][gdbserver] Check for sys/dir.h and sys.user.h in configuration.
ChangeLog:
I think sys/dir.h can also be unconditionally removed since it is only
provided for BSD compatibility. If the code in linux-low.c needs to
use the dirent and related macros, it should include <dirent.h>
instead. So here is the final patch. If you do not object, I will
find someone to submit this for me later.
Thanks.
-Doug
2008-07-25 Doug Kwan <dougkwan@google.com>
* linux-low.c (sys/dir.h, sys/user.h): Remove includes.
(linux_write_memory): Remove declaration of errno.
Index: gdb/gdbserver/linux-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/linux-low.c,v
retrieving revision 1.78
diff -u -u -p -r1.78 linux-low.c
--- gdb/gdbserver/linux-low.c 12 Jul 2008 22:22:42 -0000 1.78
+++ gdb/gdbserver/linux-low.c 25 Jul 2008 23:24:40 -0000
@@ -23,9 +23,7 @@
#include <sys/wait.h>
#include <stdio.h>
#include <sys/param.h>
-#include <sys/dir.h> #include <sys/ptrace.h>
-#include <sys/user.h>
#include <signal.h> #include <sys/ioctl.h>
#include <fcntl.h>
@@ -1704,7 +1702,6 @@ linux_write_memory (CORE_ADDR memaddr, c
= (((memaddr + len) - addr) + sizeof (PTRACE_XFER_TYPE) - 1) / sizeof (PTRACE
_XFER_TYPE);
/* Allocate buffer of that many longwords. */
register PTRACE_XFER_TYPE *buffer = (PTRACE_XFER_TYPE *) alloca (count * size
of (PTRACE_XFER_TYPE));
- extern int errno;
if (debug_threads)
{
2008/7/25 Doug Kwan (Ãö®¶¼w) <dougkwan@google.com>:
> sys/user.h may be removed. I grepped for "struct.*user" in gdb/gdb
> server and found no reference to any structures defined in the header.
> I did the same for macros and also found no reference. I am not sure
> about sys/dir.h though.
>
> -Doug
>
> 2008/7/25 Doug Kwan (Ãö®¶¼w) <dougkwan@google.com>:
>> Hi,
>>
>> 2008/7/25 Daniel Jacobowitz <drow@false.org>:
>>
>>> Just one question: if removing sys/user.h and sys/dir.h doesn't break
>>> anything on android, does it break anything on other GNU/Linux
>>> targets?
>>
>> Android is not quite Linux. The C library is not glibc so what works
>> on Android may not work on a GNU/Linux system. I don't know if that
>> works for all GNU/Linux but I tried an ubuntu system and gdbserver
>> built correctly for the target i686-unknown-linux-gnu. So the headers
>> may be unncessary but I cannot say this for all Linux distributions.
>>
>>> Removing the errno declaration is fine. Removing the includes is fine
>>> if they're not actually necessary, otherwise this patch is OK.
>>
>> My patch does not remove the includes unconditionally. Are you
>> suggesting I should just remove the includes? If so, I don't need to
>> change configure.ac and other related files.
>>
>> -Doug
>>
>