[patch] Darwin build fix for unused prototypes

Josh Matthews
2012-03-08T18:37:17Z

[-- Attachment #1: Type: text/plain, Size: 568 bytes --]

2012-03-08 Josh Matthews <josh@joshmatthews.net>

* darwin-nat-info.c: Add missing prototype for
_initialize_darwin_info_commands. Make darwin_debug_port_info static.
* darwin-nat.c: Add missing prototype for _initialize_darwin_infereior.
* i386-darwin-nat.c: Remove unused functions
i386_darwin_dr_set, i386_darwin_dr_get, i386_darwin_set_control,
i386_darwin_get_control, i386_darwin_dr_set_addr,
i386_darwin_get_addr, i386_darwin_get_status, i386_darwin_get_control.
* machoread.c: Add missing prototype for _initialize_machoread.

[-- Attachment #2: darwin_prototypes.diff --]
[-- Type: application/octet-stream, Size: 5230 bytes --]

diff --git a/gdb/darwin-nat-info.c b/gdb/darwin-nat-info.c
index 9170e14..9741538 100644
--- a/gdb/darwin-nat-info.c
+++ b/gdb/darwin-nat-info.c
@@ -301,7 +301,7 @@ info_mach_ports_command (char *args, int from_tty)
}

-void
+static void
darwin_debug_port_info (task_t task, mach_port_t port)
{
kern_return_t kret;
@@ -843,6 +843,9 @@ info_mach_exceptions_command (char *args, int from_tty)
}
}

+/* -Wmissing-prototypes */
+extern initialize_file_ftype _initialize_darwin_info_commands;
+
void
_initialize_darwin_info_commands (void)
{
diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index 0feebe3..de661a3 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -2015,6 +2015,9 @@ darwin_supports_multi_process (void)
return 1;
}

+/* -Wmissing-prototypes */
+extern initialize_file_ftype _initialize_darwin_inferior;
+
void
_initialize_darwin_inferior (void)
{
diff --git a/gdb/i386-darwin-nat.c b/gdb/i386-darwin-nat.c
index b452f1e..b127da9 100644
--- a/gdb/i386-darwin-nat.c
+++ b/gdb/i386-darwin-nat.c
@@ -260,157 +260,6 @@ i386_darwin_store_inferior_registers (struct target_ops *ops,
}
}

-
-/* Support for debug registers, boosted mostly from i386-linux-nat.c. */
-
-static void
-i386_darwin_dr_set (int regnum, uint32_t value)
-{
- int current_pid;
- thread_t current_thread;
- x86_debug_state_t dr_regs;
- kern_return_t ret;
- unsigned int dr_count = x86_DEBUG_STATE_COUNT;
-
- gdb_assert (regnum >= 0 && regnum <= DR_CONTROL);
-
- current_thread = ptid_get_tid (inferior_ptid);
-
- dr_regs.dsh.flavor = x86_DEBUG_STATE32;
- dr_regs.dsh.count = x86_DEBUG_STATE32_COUNT;
- dr_count = x86_DEBUG_STATE_COUNT;
- ret = thread_get_state (current_thread, x86_DEBUG_STATE,
- (thread_state_t) &dr_regs, &dr_count);
-
- if (ret != KERN_SUCCESS)
- {
- printf_unfiltered (_("Error reading debug registers "
- "thread 0x%x via thread_get_state\n"),
- (int) current_thread);
- MACH_CHECK_ERROR (ret);
- }
-
- switch (regnum)
- {
- case 0:
- dr_regs.uds.ds32.__dr0 = value;
- break;
- case 1:
- dr_regs.uds.ds32.__dr1 = value;
- break;
- case 2:
- dr_regs.uds.ds32.__dr2 = value;
- break;
- case 3:
- dr_regs.uds.ds32.__dr3 = value;
- break;
- case 4:
- dr_regs.uds.ds32.__dr4 = value;
- break;
- case 5:
- dr_regs.uds.ds32.__dr5 = value;
- break;
- case 6:
- dr_regs.uds.ds32.__dr6 = value;
- break;
- case 7:
- dr_regs.uds.ds32.__dr7 = value;
- break;
- }
-
- ret = thread_set_state (current_thread, x86_DEBUG_STATE,
- (thread_state_t) &dr_regs, dr_count);
-
- if (ret != KERN_SUCCESS)
- {
- printf_unfiltered (_("Error writing debug registers "
- "thread 0x%x via thread_get_state\n"),
- (int) current_thread);
- MACH_CHECK_ERROR (ret);
- }
-}
-
-static uint32_t
-i386_darwin_dr_get (int regnum)
-{
- thread_t current_thread;
- x86_debug_state_t dr_regs;
- kern_return_t ret;
- unsigned int dr_count = x86_DEBUG_STATE_COUNT;
-
- gdb_assert (regnum >= 0 && regnum <= DR_CONTROL);
-
- current_thread = ptid_get_tid (inferior_ptid);
-
- dr_regs.dsh.flavor = x86_DEBUG_STATE32;
- dr_regs.dsh.count = x86_DEBUG_STATE32_COUNT;
- dr_count = x86_DEBUG_STATE_COUNT;
- ret = thread_get_state (current_thread, x86_DEBUG_STATE,
- (thread_state_t) &dr_regs, &dr_count);
-
- if (ret != KERN_SUCCESS)
- {
- printf_unfiltered (_("Error reading debug registers "
- "thread 0x%x via thread_get_state\n"),
- (int) current_thread);
- MACH_CHECK_ERROR (ret);
- }
-
- switch (regnum)
- {
- case 0:
- return dr_regs.uds.ds32.__dr0;
- case 1:
- return dr_regs.uds.ds32.__dr1;
- case 2:
- return dr_regs.uds.ds32.__dr2;
- case 3:
- return dr_regs.uds.ds32.__dr3;
- case 4:
- return dr_regs.uds.ds32.__dr4;
- case 5:
- return dr_regs.uds.ds32.__dr5;
- case 6:
- return dr_regs.uds.ds32.__dr6;
- case 7:
- return dr_regs.uds.ds32.__dr7;
- default:
- return -1;
- }
-}
-
-void
-i386_darwin_dr_set_control (unsigned long control)
-{
- i386_darwin_dr_set (DR_CONTROL, control);
-}
-
-void
-i386_darwin_dr_set_addr (int regnum, CORE_ADDR addr)
-{
- gdb_assert (regnum >= 0 && regnum <= DR_LASTADDR - DR_FIRSTADDR);
-
- i386_darwin_dr_set (DR_FIRSTADDR + regnum, addr);
-}
-
-CORE_ADDR
-i386_darwin_dr_get_addr (int regnum)
-{
- return i386_darwin_dr_get (regnum);
-}
-
-unsigned long
-i386_darwin_dr_get_status (void)
-{
- return i386_darwin_dr_get (DR_STATUS);
-}
-
-unsigned long
-i386_darwin_dr_get_control (void)
-{
- return i386_darwin_dr_get (DR_CONTROL);
-}
-
void
darwin_check_osabi (darwin_inferior *inf, thread_t thread)
{
diff --git a/gdb/machoread.c b/gdb/machoread.c
index 88ce612..8a6b500 100644
--- a/gdb/machoread.c
+++ b/gdb/machoread.c
@@ -1035,6 +1035,9 @@ static const struct sym_fns macho_sym_fns = {
&psym_functions
};

+/* -Wmissing-prototypes */
+extern initialize_file_ftype _initialize_machoread;
+
void
_initialize_machoread ()
{