• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

Revisión124aceb46dfd1f836f35d6075ead4e00e705f6f3 (tree)
Tiempo2017-09-16 01:02:51
AutorSimon Marchi <simon.marchi@eric...>
CommiterSimon Marchi

Log Message

gdbserver: Remove thread_to_gdb_id

As explained in the previous patch, the gdb_id concept is no longer
relevant. The function thread_to_gdb_id is trivial, it returns the
thread's ptid. Remove it and replace its usage with ptid_of.

The changes in nto-low.c and lynx-low.c are fairly straightforward, but
I was not able to build test them.

gdb/gdbserver/ChangeLog:

* inferiors.h (thread_to_gdb_id): Remove.
* inferiors.c (thread_to_gdb_id): Remove.
* server.c (handle_qxfer_threads_worker, handle_query): Adjust.
* lynx-low.c (lynx_resume, lynx_wait_1, lynx_fetch_registers,
lynx_store_registers, lynx_read_memory, lynx_write_memory):
Likewise.
* nto-low.c (nto_fetch_registers, nto_store_registers,
nto_stopped_by_watchpoint, nto_stopped_data_address): Likewise.

Cambiar Resumen

Diferencia incremental

--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,5 +1,16 @@
11 2017-09-15 Simon Marchi <simon.marchi@ericsson.com>
22
3+ * inferiors.h (thread_to_gdb_id): Remove.
4+ * inferiors.c (thread_to_gdb_id): Remove.
5+ * server.c (handle_qxfer_threads_worker, handle_query): Adjust.
6+ * lynx-low.c (lynx_resume, lynx_wait_1, lynx_fetch_registers,
7+ lynx_store_registers, lynx_read_memory, lynx_write_memory):
8+ Likewise.
9+ * nto-low.c (nto_fetch_registers, nto_store_registers,
10+ nto_stopped_by_watchpoint, nto_stopped_data_address): Likewise.
11+
12+2017-09-15 Simon Marchi <simon.marchi@ericsson.com>
13+
314 * inferiors.h (gdb_id_to_thread_id): Remove.
415 * inferiors.c (gdb_id_to_thread_id): Remove.
516 * server.c (process_serial_event): Adjust to gdb_id_to_thread_id
--- a/gdb/gdbserver/inferiors.c
+++ b/gdb/gdbserver/inferiors.c
@@ -121,12 +121,6 @@ add_thread (ptid_t thread_id, void *target_data)
121121 return new_thread;
122122 }
123123
124-ptid_t
125-thread_to_gdb_id (struct thread_info *thread)
126-{
127- return thread->entry.id;
128-}
129-
130124 /* Wrapper around get_first_inferior to return a struct thread_info *. */
131125
132126 struct thread_info *
--- a/gdb/gdbserver/inferiors.h
+++ b/gdb/gdbserver/inferiors.h
@@ -143,8 +143,6 @@ struct process_info *find_process_pid (int pid);
143143 int have_started_inferiors_p (void);
144144 int have_attached_inferiors_p (void);
145145
146-ptid_t thread_to_gdb_id (struct thread_info *);
147-
148146 void clear_inferiors (void);
149147 struct inferior_list_entry *find_inferior
150148 (struct inferior_list *,
--- a/gdb/gdbserver/lynx-low.c
+++ b/gdb/gdbserver/lynx-low.c
@@ -350,7 +350,7 @@ lynx_resume (struct thread_resume *resume_info, size_t n)
350350 the moment we resume its execution for the first time. It is
351351 fine to use the current_thread's ptid in those cases. */
352352 if (ptid_equal (ptid, minus_one_ptid))
353- ptid = thread_to_gdb_id (current_thread);
353+ ptid = ptid_of (current_thread);
354354
355355 regcache_invalidate_pid (ptid_get_pid (ptid));
356356
@@ -423,7 +423,7 @@ lynx_wait_1 (ptid_t ptid, struct target_waitstatus *status, int options)
423423 ptid_t new_ptid;
424424
425425 if (ptid_equal (ptid, minus_one_ptid))
426- pid = lynx_ptid_get_pid (thread_to_gdb_id (current_thread));
426+ pid = lynx_ptid_get_pid (ptid_of (current_thread));
427427 else
428428 pid = BUILDPID (lynx_ptid_get_pid (ptid), lynx_ptid_get_tid (ptid));
429429
@@ -612,7 +612,7 @@ static void
612612 lynx_fetch_registers (struct regcache *regcache, int regno)
613613 {
614614 struct lynx_regset_info *regset = lynx_target_regsets;
615- ptid_t inferior_ptid = thread_to_gdb_id (current_thread);
615+ ptid_t inferior_ptid = ptid_of (current_thread);
616616
617617 lynx_debug ("lynx_fetch_registers (regno = %d)", regno);
618618
@@ -637,7 +637,7 @@ static void
637637 lynx_store_registers (struct regcache *regcache, int regno)
638638 {
639639 struct lynx_regset_info *regset = lynx_target_regsets;
640- ptid_t inferior_ptid = thread_to_gdb_id (current_thread);
640+ ptid_t inferior_ptid = ptid_of (current_thread);
641641
642642 lynx_debug ("lynx_store_registers (regno = %d)", regno);
643643
@@ -673,7 +673,7 @@ lynx_read_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len)
673673 int buf;
674674 const int xfer_size = sizeof (buf);
675675 CORE_ADDR addr = memaddr & -(CORE_ADDR) xfer_size;
676- ptid_t inferior_ptid = thread_to_gdb_id (current_thread);
676+ ptid_t inferior_ptid = ptid_of (current_thread);
677677
678678 while (addr < memaddr + len)
679679 {
@@ -706,7 +706,7 @@ lynx_write_memory (CORE_ADDR memaddr, const unsigned char *myaddr, int len)
706706 int buf;
707707 const int xfer_size = sizeof (buf);
708708 CORE_ADDR addr = memaddr & -(CORE_ADDR) xfer_size;
709- ptid_t inferior_ptid = thread_to_gdb_id (current_thread);
709+ ptid_t inferior_ptid = ptid_of (current_thread);
710710
711711 while (addr < memaddr + len)
712712 {
@@ -742,7 +742,7 @@ lynx_write_memory (CORE_ADDR memaddr, const unsigned char *myaddr, int len)
742742 static void
743743 lynx_request_interrupt (void)
744744 {
745- ptid_t inferior_ptid = thread_to_gdb_id (get_first_thread ());
745+ ptid_t inferior_ptid = ptid_of (get_first_thread ());
746746
747747 kill (lynx_ptid_get_pid (inferior_ptid), SIGINT);
748748 }
--- a/gdb/gdbserver/nto-low.c
+++ b/gdb/gdbserver/nto-low.c
@@ -620,7 +620,6 @@ nto_fetch_registers (struct regcache *regcache, int regno)
620620 {
621621 int regsize;
622622 procfs_greg greg;
623- ptid_t ptid;
624623
625624 TRACE ("%s (regno=%d)\n", __func__, regno);
626625 if (regno >= the_low_target.num_regs)
@@ -631,7 +630,7 @@ nto_fetch_registers (struct regcache *regcache, int regno)
631630 TRACE ("current_thread is NULL\n");
632631 return;
633632 }
634- ptid = thread_to_gdb_id (current_thread);
633+ ptid_t ptid = ptid_of (current_thread);
635634 if (!nto_set_thread (ptid))
636635 return;
637636
@@ -669,7 +668,6 @@ nto_store_registers (struct regcache *regcache, int regno)
669668 {
670669 procfs_greg greg;
671670 int err;
672- ptid_t ptid;
673671
674672 TRACE ("%s (regno:%d)\n", __func__, regno);
675673
@@ -678,7 +676,7 @@ nto_store_registers (struct regcache *regcache, int regno)
678676 TRACE ("current_thread is NULL\n");
679677 return;
680678 }
681- ptid = thread_to_gdb_id (current_thread);
679+ ptid_t ptid = ptid_of (current_thread);
682680 if (!nto_set_thread (ptid))
683681 return;
684682
@@ -867,9 +865,7 @@ nto_stopped_by_watchpoint (void)
867865 TRACE ("%s\n", __func__);
868866 if (nto_inferior.ctl_fd != -1 && current_thread != NULL)
869867 {
870- ptid_t ptid;
871-
872- ptid = thread_to_gdb_id (current_thread);
868+ ptid_t ptid = ptid_of (current_thread);
873869 if (nto_set_thread (ptid))
874870 {
875871 const int watchmask = _DEBUG_FLAG_TRACE_RD | _DEBUG_FLAG_TRACE_WR
@@ -899,9 +895,7 @@ nto_stopped_data_address (void)
899895 TRACE ("%s\n", __func__);
900896 if (nto_inferior.ctl_fd != -1 && current_thread != NULL)
901897 {
902- ptid_t ptid;
903-
904- ptid = thread_to_gdb_id (current_thread);
898+ ptid_t ptid = ptid_of (current_thread);
905899
906900 if (nto_set_thread (ptid))
907901 {
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -1687,7 +1687,7 @@ handle_qxfer_threads_worker (struct inferior_list_entry *inf, void *arg)
16871687 {
16881688 struct thread_info *thread = (struct thread_info *) inf;
16891689 struct buffer *buffer = (struct buffer *) arg;
1690- ptid_t ptid = thread_to_gdb_id (thread);
1690+ ptid_t ptid = ptid_of (thread);
16911691 char ptid_s[100];
16921692 int core = target_core_of_thread (ptid);
16931693 char core_s[21];
@@ -2171,21 +2171,20 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
21712171 /* Reply the current thread id. */
21722172 if (strcmp ("qC", own_buf) == 0 && !disable_packet_qC)
21732173 {
2174- ptid_t gdb_id;
2174+ ptid_t ptid;
21752175 require_running_or_return (own_buf);
21762176
2177- if (!ptid_equal (general_thread, null_ptid)
2178- && !ptid_equal (general_thread, minus_one_ptid))
2179- gdb_id = general_thread;
2177+ if (general_thread != null_ptid && general_thread != minus_one_ptid)
2178+ ptid = general_thread;
21802179 else
21812180 {
21822181 thread_ptr = get_first_inferior (&all_threads);
2183- gdb_id = thread_to_gdb_id ((struct thread_info *)thread_ptr);
2182+ ptid = thread_ptr->id;
21842183 }
21852184
21862185 sprintf (own_buf, "QC");
21872186 own_buf += 2;
2188- write_ptid (own_buf, gdb_id);
2187+ write_ptid (own_buf, ptid);
21892188 return;
21902189 }
21912190
@@ -2241,28 +2240,22 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
22412240 {
22422241 if (strcmp ("qfThreadInfo", own_buf) == 0)
22432242 {
2244- ptid_t gdb_id;
2245-
22462243 require_running_or_return (own_buf);
22472244 thread_ptr = get_first_inferior (&all_threads);
22482245
22492246 *own_buf++ = 'm';
2250- gdb_id = thread_to_gdb_id ((struct thread_info *)thread_ptr);
2251- write_ptid (own_buf, gdb_id);
2247+ write_ptid (own_buf, thread_ptr->id);
22522248 thread_ptr = thread_ptr->next;
22532249 return;
22542250 }
22552251
22562252 if (strcmp ("qsThreadInfo", own_buf) == 0)
22572253 {
2258- ptid_t gdb_id;
2259-
22602254 require_running_or_return (own_buf);
22612255 if (thread_ptr != NULL)
22622256 {
22632257 *own_buf++ = 'm';
2264- gdb_id = thread_to_gdb_id ((struct thread_info *)thread_ptr);
2265- write_ptid (own_buf, gdb_id);
2258+ write_ptid (own_buf, thread_ptr->id);
22662259 thread_ptr = thread_ptr->next;
22672260 return;
22682261 }