From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Cc: Joel Brobecker <brobecker@adacore.com>
Subject: [VxWorks 04/20] New general purpose routines in utils.c
Date: Fri, 04 Mar 2011 06:22:00 -0000 [thread overview]
Message-ID: <1299219720-13398-5-git-send-email-brobecker@adacore.com> (raw)
In-Reply-To: <1299219720-13398-1-git-send-email-brobecker@adacore.com>
These are some general-purpose routines that were added for the VxWorks
port... Hopefully other parts of the GDB code will make use of them.
gdb/ChangeLog:
* utils.c (have_dos_based_filesystem, is_regular_file):
New functions.
* source.c (is_regular_file): Delete. Moved to utils.c.
* defs.h (have_dos_based_filesystem, is_regular_file):
Add declaration.
---
gdb/defs.h | 4 ++++
gdb/source.c | 18 ------------------
gdb/utils.c | 31 +++++++++++++++++++++++++++++++
3 files changed, 35 insertions(+), 18 deletions(-)
diff --git a/gdb/defs.h b/gdb/defs.h
index 9409dde..11178f8 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -421,6 +421,10 @@ extern const char *gdb_bfd_errmsg (bfd_error_type error_tag, char **matching);
extern int parse_pid_to_attach (char *args);
+extern int have_dos_based_filesystem (void);
+
+extern int is_regular_file (const char *name);
+
/* From demangle.c */
extern void set_demangling_style (char *);
diff --git a/gdb/source.c b/gdb/source.c
index a14a802..9e35dd9 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -657,24 +657,6 @@ source_info (char *ignore, int from_tty)
}
\f
-/* Return True if the file NAME exists and is a regular file. */
-static int
-is_regular_file (const char *name)
-{
- struct stat st;
- const int status = stat (name, &st);
-
- /* Stat should never fail except when the file does not exist.
- If stat fails, analyze the source of error and return True
- unless the file does not exist, to avoid returning false results
- on obscure systems where stat does not work as expected. */
-
- if (status != 0)
- return (errno != ENOENT);
-
- return S_ISREG (st.st_mode);
-}
-
/* Open a file named STRING, searching path PATH (dir names sep by some char)
using mode MODE in the calls to open. You cannot use this function to
create files (O_CREAT).
diff --git a/gdb/utils.c b/gdb/utils.c
index 91e6af4..042ced1 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -74,6 +74,7 @@
#include "gdb_usleep.h"
#include "interps.h"
#include "gdb_regex.h"
+#include "gdb_stat.h"
#if !HAVE_DECL_MALLOC
extern PTR malloc (); /* ARI: PTR */
@@ -3987,6 +3988,36 @@ parse_pid_to_attach (char *args)
return pid;
}
+/* Return non-zero if the host has a dos-based file system. */
+
+int
+have_dos_based_filesystem (void)
+{
+#ifdef HAVE_DOS_BASED_FILE_SYSTEM
+ return 1;
+#else
+ return 0;
+#endif
+}
+
+/* Return True if the file NAME exists and is a regular file. */
+
+int
+is_regular_file (const char *name)
+{
+ struct stat st;
+ const int status = stat (name, &st);
+
+ /* Stat should never fail except when the file does not exist.
+ If stat fails, analyze the source of error and return True
+ unless the file does not exist, to avoid returning false results
+ on obscure systems where stat does not work as expected. */
+ if (status != 0)
+ return (errno != ENOENT);
+
+ return S_ISREG (st.st_mode);
+}
+
/* Provide a prototype to silence -Wmissing-prototypes. */
extern initialize_file_ftype _initialize_utils;
--
1.7.0.4
next prev parent reply other threads:[~2011-03-04 6:22 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-04 6:22 Add support for VxWorks (v3) Joel Brobecker
2011-03-04 6:22 ` Joel Brobecker [this message]
2011-03-04 6:22 ` [VxWorks 05/20] more parsing routines in cli/cli-utils Joel Brobecker
2011-03-04 6:22 ` [VxWorks 02/20] Some ada-lang/ada-tasks routines needed by the VxWorks target Joel Brobecker
2011-03-04 6:22 ` [VxWorks 01/20] fix parameter names in cli/cli-utils.h Joel Brobecker
2011-03-04 6:22 ` [VxWorks 03/20] New toplevel_command_post observer Joel Brobecker
2011-03-04 6:23 ` [VxWorks 08/20] New modules gdb_dlfcn and remote-wtx-utils Joel Brobecker
2011-03-04 6:23 ` [VxWorks 06/20] add new "unload" command (symetry of existing "load" command) Joel Brobecker
2011-03-04 6:23 ` [VxWorks 10/20] Add options to control Vxworks related settings Joel Brobecker
2011-03-04 6:23 ` [VxWorks 07/20] new struct bp_target_info target_private_data field Joel Brobecker
2011-03-04 6:24 ` [VxWorks 09/20] remote-wtxapi: The WTX API abstraction layer Joel Brobecker
2011-03-04 6:24 ` [VxWorks 13/20] Add partition support Joel Brobecker
2011-03-04 6:24 ` [VxWorks 11/20] VxWorks breakpoint-handling module Joel Brobecker
2011-03-04 6:24 ` [VxWorks 14/20] remote-wtx-hw: register fetch/store support Joel Brobecker
2011-03-04 6:24 ` [VxWorks 12/20] "multi-tasks-mode" support Joel Brobecker
2011-03-04 6:25 ` [VxWorks 20/20] document the new VxWorks port Joel Brobecker
2011-03-04 6:25 ` [VxWorks 17/20] Add support for VxWorks 6 Joel Brobecker
2011-03-04 6:25 ` [VxWorks 15/20] Add new "wtx" target Joel Brobecker
2011-03-04 6:25 ` [VxWorks 19/20] Configury and Makefile updates for VxWorks Joel Brobecker
2011-03-04 6:25 ` [VxWorks 18/20] Add tdep files for x86 and powerpc Joel Brobecker
2011-03-04 6:25 ` [VxWorks 16/20] WTX-TCL support module Joel Brobecker
2011-03-04 9:36 ` Add support for VxWorks (v3) Pedro Alves
2011-03-04 10:05 ` Joel Brobecker
2011-03-04 10:45 ` Pedro Alves
2011-03-04 12:10 ` Joel Brobecker
2011-03-07 19:49 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1299219720-13398-5-git-send-email-brobecker@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox