@@ -259,20 +259,6 @@ extern void symbol_file_command (char *,
/* * Remote targets may wish to use this as their load function. */
extern void generic_load (const char *name, int from_tty);
-/* * Report on STREAM the performance of memory transfer operation,
- such as 'load'.
- @param DATA_COUNT is the number of bytes transferred.
- @param WRITE_COUNT is the number of separate write operations, or 0,
- if that information is not available.
- @param START_TIME is the time at which an operation was started.
- @param END_TIME is the time at which an operation ended. */
-struct timeval;
-extern void print_transfer_performance (struct ui_file *stream,
- unsigned long data_count,
- unsigned long write_count,
- const struct timeval *start_time,
- const struct timeval *end_time);
-
/* From top.c */
typedef void initialize_file_ftype (void);
@@ -22,6 +22,7 @@
#include <sys/time.h>
#include <time.h>
#include "gdb_bfd.h"
+#include "gdb_timeval.h"
extern int remote_debug;
@@ -189,7 +189,7 @@ static struct
int num_fds;
/* Time structure for calls to select(). */
- struct timeval select_timeout;
+ TIMEVAL select_timeout;
/* Flag to tell whether the timeout should be used. */
int timeout_valid;
@@ -809,8 +809,8 @@ gdb_wait_for_event (int block)
}
else
{
- struct timeval select_timeout;
- struct timeval *timeout_p;
+ TIMEVAL select_timeout;
+ TIMEVAL *timeout_p;
if (block)
timeout_p = gdb_notifier.timeout_valid
@@ -28,9 +28,11 @@
#ifdef USE_WIN32API
#include <winsock2.h>
+#else
+typedef struct timeval TIMEVAL;
#endif
extern int gdb_select (int n, fd_set *readfds, fd_set *writefds,
- fd_set *exceptfds, struct timeval *timeout);
+ fd_set *exceptfds, TIMEVAL *timeout);
#endif /* !defined(GDB_SELECT_H) */
@@ -0,0 +1,45 @@
+/* Declarations using struct timeval.
+ Copyright (C) 2014 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef GDB_TIMEVAL_H
+#define GDB_TIMEVAL_H
+
+/* For struct timeval. */
+#include <sys/time.h>
+
+/* From utils.c. */
+
+/* Return the time spent in prompt_for_continue. */
+struct timeval get_prompt_for_continue_wait_time (void);
+
+/* From symfile.c. */
+
+/* * Report on STREAM the performance of memory transfer operation,
+ such as 'load'.
+ @param DATA_COUNT is the number of bytes transferred.
+ @param WRITE_COUNT is the number of separate write operations, or 0,
+ if that information is not available.
+ @param START_TIME is the time at which an operation was started.
+ @param END_TIME is the time at which an operation ended. */
+extern void print_transfer_performance (struct ui_file *stream,
+ unsigned long data_count,
+ unsigned long write_count,
+ const struct timeval *start_time,
+ const struct timeval *end_time);
+
+#endif /* GDB_TIMEVAL_H */
@@ -24,7 +24,7 @@
int
gdb_usleep (int usec)
{
- struct timeval delay;
+ TIMEVAL delay;
int retval;
delay.tv_sec = usec / 1000000;
@@ -59,6 +59,8 @@
#if USE_WIN32API
#include <winsock2.h>
+#else
+typedef struct timeval TIMEVAL;
#endif
#if __QNX__
@@ -727,7 +729,7 @@ static void
input_interrupt (int unused)
{
fd_set readset;
- struct timeval immediate = { 0, 0 };
+ TIMEVAL immediate = { 0, 0 };
/* Protect against spurious interrupts. This has been observed to
be a problem under NetBSD 1.4 and 1.5. */
@@ -39,6 +39,7 @@
#include "regcache.h"
#include "gdb_bfd.h"
#include "cli/cli-utils.h"
+#include "gdb_timeval.h"
/*
* All this stuff just to get my host computer's IP address!
@@ -41,6 +41,7 @@
#include "top.h"
#include "timeval-utils.h"
#include "maint.h"
+#include "gdb_timeval.h"
#include "cli/cli-decode.h"
#include "cli/cli-utils.h"
@@ -101,7 +101,7 @@ windows_get_absolute_argv0 (const char *
int
gdb_select (int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
- struct timeval *timeout)
+ TIMEVAL *timeout)
{
static HANDLE never_handle;
HANDLE handles[MAXIMUM_WAIT_OBJECTS];
@@ -40,6 +40,7 @@
#include <time.h>
#include "gdb_bfd.h"
#include "cli/cli-utils.h"
+#include "gdb_timeval.h"
#include "serial.h"
@@ -205,7 +205,7 @@ ser_base_wait_for (struct serial *scb, i
while (1)
{
int numfds;
- struct timeval tv;
+ TIMEVAL tv;
fd_set readfds, exceptfds;
/* NOTE: Some OS's can scramble the READFDS when the select()
@@ -85,7 +85,7 @@ static unsigned int tcp_retry_limit = 15
static int
wait_for_connect (struct serial *scb, unsigned int *polls)
{
- struct timeval t;
+ TIMEVAL t;
int n;
/* While we wait for the connect to complete,
@@ -56,6 +56,7 @@
#include "stack.h"
#include "gdb_bfd.h"
#include "cli/cli-utils.h"
+#include "gdb_timeval.h"
#include <sys/types.h>
#include <fcntl.h>
@@ -3541,12 +3542,12 @@ overlay_command (char *args, int from_tt
In this simple implementation, the target data structures are as follows:
unsigned _novlys; /# number of overlay sections #/
unsigned _ovly_table[_novlys][4] = {
- {VMA, SIZE, LMA, MAPPED}, /# one entry per overlay section #/
+ {VMA, OSIZE, LMA, MAPPED}, /# one entry per overlay section #/
{..., ..., ..., ...},
}
unsigned _novly_regions; /# number of overlay regions #/
unsigned _ovly_region_table[_novly_regions][3] = {
- {VMA, SIZE, MAPPED_TO_LMA}, /# one entry per overlay region #/
+ {VMA, OSIZE, MAPPED_TO_LMA}, /# one entry per overlay region #/
{..., ..., ...},
}
These functions will attempt to update GDB's mappedness state in the
@@ -3564,7 +3565,7 @@ static unsigned cache_novlys = 0;
static CORE_ADDR cache_ovly_table_base = 0;
enum ovly_index
{
- VMA, SIZE, LMA, MAPPED
+ VMA, OSIZE, LMA, MAPPED
};
/* Throw away the cached copy of _ovly_table. */
@@ -3664,14 +3665,14 @@ simple_overlay_update_1 (struct obj_sect
for (i = 0; i < cache_novlys; i++)
if (cache_ovly_table[i][VMA] == bfd_section_vma (obfd, bsect)
&& cache_ovly_table[i][LMA] == bfd_section_lma (obfd, bsect)
- /* && cache_ovly_table[i][SIZE] == size */ )
+ /* && cache_ovly_table[i][OSIZE] == size */ )
{
read_target_long_array (cache_ovly_table_base + i * word_size,
(unsigned int *) cache_ovly_table[i],
4, word_size, byte_order);
if (cache_ovly_table[i][VMA] == bfd_section_vma (obfd, bsect)
&& cache_ovly_table[i][LMA] == bfd_section_lma (obfd, bsect)
- /* && cache_ovly_table[i][SIZE] == size */ )
+ /* && cache_ovly_table[i][OSIZE] == size */ )
{
osect->ovly_mapped = cache_ovly_table[i][MAPPED];
return 1;
@@ -3737,7 +3738,7 @@ simple_overlay_update (struct obj_sectio
for (i = 0; i < cache_novlys; i++)
if (cache_ovly_table[i][VMA] == bfd_section_vma (obfd, bsect)
&& cache_ovly_table[i][LMA] == bfd_section_lma (obfd, bsect)
- /* && cache_ovly_table[i][SIZE] == size */ )
+ /* && cache_ovly_table[i][OSIZE] == size */ )
{ /* obj_section matches i'th entry in ovly_table. */
osect->ovly_mapped = cache_ovly_table[i][MAPPED];
break; /* finished with inner for loop: break out. */
@@ -37,8 +37,11 @@
#include <pc.h>
#endif
-#include <signal.h>
+/* For struct timeval for timeval-utils.h. */
+#include <sys/time.h>
#include "timeval-utils.h"
+
+#include <signal.h>
#include "gdbcmd.h"
#include "serial.h"
#include "bfd.h"
@@ -55,6 +58,7 @@
#include "top.h"
#include "main.h"
#include "solist.h"
+#include "gdb_timeval.h"
#include "inferior.h" /* for signed_pointer_to_address */
@@ -54,9 +54,7 @@ extern const char *gdb_bfd_errmsg (bfd_e
/* Reset the prompt_for_continue clock. */
void reset_prompt_for_continue_wait_time (void);
-/* Return the time spent in prompt_for_continue. */
-struct timeval get_prompt_for_continue_wait_time (void);
-
+
/* Parsing utilites. */
extern int parse_pid_to_attach (const char *args);