| OLD | NEW |
| 1 /* Remote target communications for serial-line targets in custom GDB protocol | 1 /* Remote target communications for serial-line targets in custom GDB protocol |
| 2 | 2 |
| 3 Copyright (C) 1988-2012 Free Software Foundation, Inc. | 3 Copyright (C) 1988-2012 Free Software Foundation, Inc. |
| 4 | 4 |
| 5 This file is part of GDB. | 5 This file is part of GDB. |
| 6 | 6 |
| 7 This program is free software; you can redistribute it and/or modify | 7 This program is free software; you can redistribute it and/or modify |
| 8 it under the terms of the GNU General Public License as published by | 8 it under the terms of the GNU General Public License as published by |
| 9 the Free Software Foundation; either version 3 of the License, or | 9 the Free Software Foundation; either version 3 of the License, or |
| 10 (at your option) any later version. | 10 (at your option) any later version. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 #include "remote-fileio.h" | 58 #include "remote-fileio.h" |
| 59 #include "gdb/fileio.h" | 59 #include "gdb/fileio.h" |
| 60 #include "gdb_stat.h" | 60 #include "gdb_stat.h" |
| 61 #include "xml-support.h" | 61 #include "xml-support.h" |
| 62 | 62 |
| 63 #include "memory-map.h" | 63 #include "memory-map.h" |
| 64 | 64 |
| 65 #include "tracepoint.h" | 65 #include "tracepoint.h" |
| 66 #include "ax.h" | 66 #include "ax.h" |
| 67 #include "ax-gdb.h" | 67 #include "ax-gdb.h" |
| 68 #include "agent.h" |
| 68 | 69 |
| 69 /* Temp hacks for tracepoint encoding migration. */ | 70 /* Temp hacks for tracepoint encoding migration. */ |
| 70 static char *target_buf; | 71 static char *target_buf; |
| 71 static long target_buf_size; | 72 static long target_buf_size; |
| 72 /*static*/ void | |
| 73 encode_actions (struct breakpoint *t, struct bp_location *tloc, | |
| 74 char ***tdp_actions, char ***stepping_actions); | |
| 75 | 73 |
| 76 /* The size to align memory write packets, when practical. The protocol | 74 /* The size to align memory write packets, when practical. The protocol |
| 77 does not guarantee any alignment, and gdb will generate short | 75 does not guarantee any alignment, and gdb will generate short |
| 78 writes and unaligned writes, but even as a best-effort attempt this | 76 writes and unaligned writes, but even as a best-effort attempt this |
| 79 can improve bulk transfers. For instance, if a write is misaligned | 77 can improve bulk transfers. For instance, if a write is misaligned |
| 80 relative to the target's data bus, the stub may need to make an extra | 78 relative to the target's data bus, the stub may need to make an extra |
| 81 round trip fetching data from the target. This doesn't make a | 79 round trip fetching data from the target. This doesn't make a |
| 82 huge difference, but it's easy to do, so we try to be helpful. | 80 huge difference, but it's easy to do, so we try to be helpful. |
| 83 | 81 |
| 84 The alignment chosen is arbitrary; usually data bus width is | 82 The alignment chosen is arbitrary; usually data bus width is |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 | 233 |
| 236 static void remote_async_inferior_event_handler (gdb_client_data); | 234 static void remote_async_inferior_event_handler (gdb_client_data); |
| 237 static void remote_async_get_pending_events_handler (gdb_client_data); | 235 static void remote_async_get_pending_events_handler (gdb_client_data); |
| 238 | 236 |
| 239 static void remote_terminal_ours (void); | 237 static void remote_terminal_ours (void); |
| 240 | 238 |
| 241 static int remote_read_description_p (struct target_ops *target); | 239 static int remote_read_description_p (struct target_ops *target); |
| 242 | 240 |
| 243 static void remote_console_output (char *msg); | 241 static void remote_console_output (char *msg); |
| 244 | 242 |
| 243 static int remote_supports_cond_breakpoints (void); |
| 244 |
| 245 static int remote_can_run_breakpoint_commands (void); |
| 246 |
| 245 /* The non-stop remote protocol provisions for one pending stop reply. | 247 /* The non-stop remote protocol provisions for one pending stop reply. |
| 246 This is where we keep it until it is acknowledged. */ | 248 This is where we keep it until it is acknowledged. */ |
| 247 | 249 |
| 248 static struct stop_reply *pending_stop_reply = NULL; | 250 static struct stop_reply *pending_stop_reply = NULL; |
| 249 | 251 |
| 250 /* For "remote". */ | 252 /* For "remote". */ |
| 251 | 253 |
| 252 static struct cmd_list_element *remote_cmdlist; | 254 static struct cmd_list_element *remote_cmdlist; |
| 253 | 255 |
| 254 /* For "set remote" and "show remote". */ | 256 /* For "set remote" and "show remote". */ |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 | 314 |
| 313 /* True if the stub reports support for non-stop mode. */ | 315 /* True if the stub reports support for non-stop mode. */ |
| 314 int non_stop_aware; | 316 int non_stop_aware; |
| 315 | 317 |
| 316 /* True if the stub reports support for vCont;t. */ | 318 /* True if the stub reports support for vCont;t. */ |
| 317 int support_vCont_t; | 319 int support_vCont_t; |
| 318 | 320 |
| 319 /* True if the stub reports support for conditional tracepoints. */ | 321 /* True if the stub reports support for conditional tracepoints. */ |
| 320 int cond_tracepoints; | 322 int cond_tracepoints; |
| 321 | 323 |
| 324 /* True if the stub reports support for target-side breakpoint |
| 325 conditions. */ |
| 326 int cond_breakpoints; |
| 327 |
| 328 /* True if the stub reports support for target-side breakpoint |
| 329 commands. */ |
| 330 int breakpoint_commands; |
| 331 |
| 322 /* True if the stub reports support for fast tracepoints. */ | 332 /* True if the stub reports support for fast tracepoints. */ |
| 323 int fast_tracepoints; | 333 int fast_tracepoints; |
| 324 | 334 |
| 325 /* True if the stub reports support for static tracepoints. */ | 335 /* True if the stub reports support for static tracepoints. */ |
| 326 int static_tracepoints; | 336 int static_tracepoints; |
| 327 | 337 |
| 328 /* True if the stub reports support for installing tracepoint while | 338 /* True if the stub reports support for installing tracepoint while |
| 329 tracing. */ | 339 tracing. */ |
| 330 int install_in_trace; | 340 int install_in_trace; |
| 331 | 341 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 356 free_private_thread_info (struct private_thread_info *info) | 366 free_private_thread_info (struct private_thread_info *info) |
| 357 { | 367 { |
| 358 xfree (info->extra); | 368 xfree (info->extra); |
| 359 xfree (info); | 369 xfree (info); |
| 360 } | 370 } |
| 361 | 371 |
| 362 /* Returns true if the multi-process extensions are in effect. */ | 372 /* Returns true if the multi-process extensions are in effect. */ |
| 363 static int | 373 static int |
| 364 remote_multi_process_p (struct remote_state *rs) | 374 remote_multi_process_p (struct remote_state *rs) |
| 365 { | 375 { |
| 366 return rs->extended && rs->multi_process_aware; | 376 return rs->multi_process_aware; |
| 367 } | 377 } |
| 368 | 378 |
| 369 /* This data could be associated with a target, but we do not always | 379 /* This data could be associated with a target, but we do not always |
| 370 have access to the current target when we need it, so for now it is | 380 have access to the current target when we need it, so for now it is |
| 371 static. This will be fine for as long as only one target is in use | 381 static. This will be fine for as long as only one target is in use |
| 372 at a time. */ | 382 at a time. */ |
| 373 static struct remote_state remote_state; | 383 static struct remote_state remote_state; |
| 374 | 384 |
| 375 static struct remote_state * | 385 static struct remote_state * |
| 376 get_remote_state_raw (void) | 386 get_remote_state_raw (void) |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 org_to = to; | 482 org_to = to; |
| 473 | 483 |
| 474 TRY_CATCH (ex, RETURN_MASK_ALL) | 484 TRY_CATCH (ex, RETURN_MASK_ALL) |
| 475 { | 485 { |
| 476 gdbarch_relocate_instruction (target_gdbarch, &to, from); | 486 gdbarch_relocate_instruction (target_gdbarch, &to, from); |
| 477 } | 487 } |
| 478 if (ex.reason >= 0) | 488 if (ex.reason >= 0) |
| 479 { | 489 { |
| 480 adjusted_size = to - org_to; | 490 adjusted_size = to - org_to; |
| 481 | 491 |
| 482 » sprintf (buf, "qRelocInsn:%x", adjusted_size); | 492 » xsnprintf (buf, *sizeof_buf, "qRelocInsn:%x", adjusted_size); |
| 483 putpkt (buf); | 493 putpkt (buf); |
| 484 } | 494 } |
| 485 else if (ex.reason < 0 && ex.error == MEMORY_ERROR) | 495 else if (ex.reason < 0 && ex.error == MEMORY_ERROR) |
| 486 { | 496 { |
| 487 /* Propagate memory errors silently back to the target. | 497 /* Propagate memory errors silently back to the target. |
| 488 The stub may have limited the range of addresses we | 498 The stub may have limited the range of addresses we |
| 489 can write to, for example. */ | 499 can write to, for example. */ |
| 490 putpkt ("E01"); | 500 putpkt ("E01"); |
| 491 } | 501 } |
| 492 else | 502 else |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 | 749 |
| 740 /* Allow the user to specify what sequence to send to the remote | 750 /* Allow the user to specify what sequence to send to the remote |
| 741 when he requests a program interruption: Although ^C is usually | 751 when he requests a program interruption: Although ^C is usually |
| 742 what remote systems expect (this is the default, here), it is | 752 what remote systems expect (this is the default, here), it is |
| 743 sometimes preferable to send a break. On other systems such | 753 sometimes preferable to send a break. On other systems such |
| 744 as the Linux kernel, a break followed by g, which is Magic SysRq g | 754 as the Linux kernel, a break followed by g, which is Magic SysRq g |
| 745 is required in order to interrupt the execution. */ | 755 is required in order to interrupt the execution. */ |
| 746 const char interrupt_sequence_control_c[] = "Ctrl-C"; | 756 const char interrupt_sequence_control_c[] = "Ctrl-C"; |
| 747 const char interrupt_sequence_break[] = "BREAK"; | 757 const char interrupt_sequence_break[] = "BREAK"; |
| 748 const char interrupt_sequence_break_g[] = "BREAK-g"; | 758 const char interrupt_sequence_break_g[] = "BREAK-g"; |
| 749 static const char *interrupt_sequence_modes[] = | 759 static const char *const interrupt_sequence_modes[] = |
| 750 { | 760 { |
| 751 interrupt_sequence_control_c, | 761 interrupt_sequence_control_c, |
| 752 interrupt_sequence_break, | 762 interrupt_sequence_break, |
| 753 interrupt_sequence_break_g, | 763 interrupt_sequence_break_g, |
| 754 NULL | 764 NULL |
| 755 }; | 765 }; |
| 756 static const char *interrupt_sequence_mode = interrupt_sequence_control_c; | 766 static const char *interrupt_sequence_mode = interrupt_sequence_control_c; |
| 757 | 767 |
| 758 static void | 768 static void |
| 759 show_interrupt_sequence (struct ui_file *file, int from_tty, | 769 show_interrupt_sequence (struct ui_file *file, int from_tty, |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1232 PACKET_vCont = 0, | 1242 PACKET_vCont = 0, |
| 1233 PACKET_X, | 1243 PACKET_X, |
| 1234 PACKET_qSymbol, | 1244 PACKET_qSymbol, |
| 1235 PACKET_P, | 1245 PACKET_P, |
| 1236 PACKET_p, | 1246 PACKET_p, |
| 1237 PACKET_Z0, | 1247 PACKET_Z0, |
| 1238 PACKET_Z1, | 1248 PACKET_Z1, |
| 1239 PACKET_Z2, | 1249 PACKET_Z2, |
| 1240 PACKET_Z3, | 1250 PACKET_Z3, |
| 1241 PACKET_Z4, | 1251 PACKET_Z4, |
error: old chunk mismatch |
None
| OLD | NEW |