Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: gdb/tracepoint.c

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gdb/tracepoint.h ('k') | gdb/tui/tui-data.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Tracing functionality for remote targets in custom GDB protocol 1 /* Tracing functionality for remote targets in custom GDB protocol
2 2
3 Copyright (C) 1997-2012 Free Software Foundation, Inc. 3 Copyright (C) 1997-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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include "gdbthread.h" 45 #include "gdbthread.h"
46 #include "stack.h" 46 #include "stack.h"
47 #include "gdbcore.h" 47 #include "gdbcore.h"
48 #include "remote.h" 48 #include "remote.h"
49 #include "source.h" 49 #include "source.h"
50 #include "ax.h" 50 #include "ax.h"
51 #include "ax-gdb.h" 51 #include "ax-gdb.h"
52 #include "memrange.h" 52 #include "memrange.h"
53 #include "exceptions.h" 53 #include "exceptions.h"
54 #include "cli/cli-utils.h" 54 #include "cli/cli-utils.h"
55 #include "probe.h"
55 56
56 /* readline include files */ 57 /* readline include files */
57 #include "readline/readline.h" 58 #include "readline/readline.h"
58 #include "readline/history.h" 59 #include "readline/history.h"
59 60
60 /* readline defines this. */ 61 /* readline defines this. */
61 #undef savestring 62 #undef savestring
62 63
63 #ifdef HAVE_UNISTD_H 64 #ifdef HAVE_UNISTD_H
64 #include <unistd.h> 65 #include <unistd.h>
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 struct trace_state_variable *tsv; 341 struct trace_state_variable *tsv;
341 int ix; 342 int ix;
342 343
343 for (ix = 0; VEC_iterate (tsv_s, tvariables, ix, tsv); ++ix) 344 for (ix = 0; VEC_iterate (tsv_s, tvariables, ix, tsv); ++ix)
344 if (strcmp (name, tsv->name) == 0) 345 if (strcmp (name, tsv->name) == 0)
345 return tsv; 346 return tsv;
346 347
347 return NULL; 348 return NULL;
348 } 349 }
349 350
350 void 351 static void
351 delete_trace_state_variable (const char *name) 352 delete_trace_state_variable (const char *name)
352 { 353 {
353 struct trace_state_variable *tsv; 354 struct trace_state_variable *tsv;
354 int ix; 355 int ix;
355 356
356 for (ix = 0; VEC_iterate (tsv_s, tvariables, ix, tsv); ++ix) 357 for (ix = 0; VEC_iterate (tsv_s, tvariables, ix, tsv); ++ix)
357 if (strcmp (name, tsv->name) == 0) 358 if (strcmp (name, tsv->name) == 0)
358 { 359 {
359 xfree ((void *)tsv->name); 360 xfree ((void *)tsv->name);
360 VEC_unordered_remove (tsv_s, tvariables, ix); 361 VEC_unordered_remove (tsv_s, tvariables, ix);
361 return; 362 return;
362 } 363 }
363 364
364 warning (_("No trace variable named \"$%s\", not deleting"), name); 365 warning (_("No trace variable named \"$%s\", not deleting"), name);
365 } 366 }
366 367
367 /* The 'tvariable' command collects a name and optional expression to 368 /* The 'tvariable' command collects a name and optional expression to
368 evaluate into an initial value. */ 369 evaluate into an initial value. */
369 370
370 void 371 static void
371 trace_variable_command (char *args, int from_tty) 372 trace_variable_command (char *args, int from_tty)
372 { 373 {
373 struct expression *expr; 374 struct expression *expr;
374 struct cleanup *old_chain; 375 struct cleanup *old_chain;
375 struct internalvar *intvar = NULL; 376 struct internalvar *intvar = NULL;
376 LONGEST initval = 0; 377 LONGEST initval = 0;
377 struct trace_state_variable *tsv; 378 struct trace_state_variable *tsv;
378 379
379 if (!args || !*args) 380 if (!args || !*args)
380 error_no_arg (_("trace state variable name")); 381 error_no_arg (_("trace state variable name"));
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 tsv = create_trace_state_variable (internalvar_name (intvar)); 423 tsv = create_trace_state_variable (internalvar_name (intvar));
423 tsv->initial_value = initval; 424 tsv->initial_value = initval;
424 425
425 printf_filtered (_("Trace state variable $%s " 426 printf_filtered (_("Trace state variable $%s "
426 "created, with initial value %s.\n"), 427 "created, with initial value %s.\n"),
427 tsv->name, plongest (tsv->initial_value)); 428 tsv->name, plongest (tsv->initial_value));
428 429
429 do_cleanups (old_chain); 430 do_cleanups (old_chain);
430 } 431 }
431 432
432 void 433 static void
433 delete_trace_variable_command (char *args, int from_tty) 434 delete_trace_variable_command (char *args, int from_tty)
434 { 435 {
435 int ix; 436 int ix;
436 char **argv; 437 char **argv;
437 struct cleanup *back_to; 438 struct cleanup *back_to;
438 439
439 if (args == NULL) 440 if (args == NULL)
440 { 441 {
441 if (query (_("Delete all trace state variables? "))) 442 if (query (_("Delete all trace state variables? ")))
442 VEC_free (tsv_s, tvariables); 443 VEC_free (tsv_s, tvariables);
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 { 727 {
727 p = strchr (p, ','); 728 p = strchr (p, ',');
728 continue; 729 continue;
729 } 730 }
730 /* else fall thru, treat p as an expression and parse it! */ 731 /* else fall thru, treat p as an expression and parse it! */
731 } 732 }
732 tmp_p = p; 733 tmp_p = p;
733 for (loc = t->base.loc; loc; loc = loc->next) 734 for (loc = t->base.loc; loc; loc = loc->next)
734 { 735 {
735 p = tmp_p; 736 p = tmp_p;
736 » exp = parse_exp_1 (&p, block_for_pc (loc->address), 1); 737 » exp = parse_exp_1 (&p, loc->address,
738 » » » » block_for_pc (loc->address), 1);
737 old_chain = make_cleanup (free_current_contents, &exp); 739 old_chain = make_cleanup (free_current_contents, &exp);
738 740
739 if (exp->elts[0].opcode == OP_VAR_VALUE) 741 if (exp->elts[0].opcode == OP_VAR_VALUE)
740 { 742 {
741 if (SYMBOL_CLASS (exp->elts[2].symbol) == LOC_CONST) 743 if (SYMBOL_CLASS (exp->elts[2].symbol) == LOC_CONST)
742 { 744 {
743 » » error (_("constant `%s' (value %ld) " 745 » » error (_("constant `%s' (value %s) "
744 "will not be collected."), 746 "will not be collected."),
745 SYMBOL_PRINT_NAME (exp->elts[2].symbol), 747 SYMBOL_PRINT_NAME (exp->elts[2].symbol),
746 » » » SYMBOL_VALUE (exp->elts[2].symbol)); 748 » » » plongest (SYMBOL_VALUE (exp->elts[2].symbol)));
747 } 749 }
748 else if (SYMBOL_CLASS (exp->elts[2].symbol) 750 else if (SYMBOL_CLASS (exp->elts[2].symbol)
749 == LOC_OPTIMIZED_OUT) 751 == LOC_OPTIMIZED_OUT)
750 { 752 {
751 error (_("`%s' is optimized away " 753 error (_("`%s' is optimized away "
752 "and cannot be collected."), 754 "and cannot be collected."),
753 SYMBOL_PRINT_NAME (exp->elts[2].symbol)); 755 SYMBOL_PRINT_NAME (exp->elts[2].symbol));
754 } 756 }
755 } 757 }
756 758
(...skipping 22 matching lines...) Expand all
779 { /* Repeat over a comma-separated list. */ 781 { /* Repeat over a comma-separated list. */
780 QUIT; /* Allow user to bail out with ^C. */ 782 QUIT; /* Allow user to bail out with ^C. */
781 while (isspace ((int) *p)) 783 while (isspace ((int) *p))
782 p++; 784 p++;
783 785
784 tmp_p = p; 786 tmp_p = p;
785 for (loc = t->base.loc; loc; loc = loc->next) 787 for (loc = t->base.loc; loc; loc = loc->next)
786 { 788 {
787 p = tmp_p; 789 p = tmp_p;
788 /* Only expressions are allowed for this action. */ 790 /* Only expressions are allowed for this action. */
789 » exp = parse_exp_1 (&p, block_for_pc (loc->address), 1); 791 » exp = parse_exp_1 (&p, loc->address,
792 » » » » block_for_pc (loc->address), 1);
790 old_chain = make_cleanup (free_current_contents, &exp); 793 old_chain = make_cleanup (free_current_contents, &exp);
791 794
792 /* We have something to evaluate, make sure that the expr to 795 /* We have something to evaluate, make sure that the expr to
793 bytecode translator can handle it and that it's not too 796 bytecode translator can handle it and that it's not too
794 long. */ 797 long. */
795 aexpr = gen_eval_for_expr (loc->address, exp); 798 aexpr = gen_eval_for_expr (loc->address, exp);
796 make_cleanup_free_agent_expr (aexpr); 799 make_cleanup_free_agent_expr (aexpr);
797 800
798 if (aexpr->len > MAX_AGENT_EXPR_LEN) 801 if (aexpr->len > MAX_AGENT_EXPR_LEN)
799 error (_("Expression is too complicated.")); 802 error (_("Expression is too complicated."));
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 976
974 len = TYPE_LENGTH (check_typedef (SYMBOL_TYPE (sym))); 977 len = TYPE_LENGTH (check_typedef (SYMBOL_TYPE (sym)));
975 switch (SYMBOL_CLASS (sym)) 978 switch (SYMBOL_CLASS (sym))
976 { 979 {
977 default: 980 default:
978 printf_filtered ("%s: don't know symbol class %d\n", 981 printf_filtered ("%s: don't know symbol class %d\n",
979 SYMBOL_PRINT_NAME (sym), 982 SYMBOL_PRINT_NAME (sym),
980 SYMBOL_CLASS (sym)); 983 SYMBOL_CLASS (sym));
981 break; 984 break;
982 case LOC_CONST: 985 case LOC_CONST:
983 printf_filtered ("constant %s (value %ld) will not be collected.\n", 986 printf_filtered ("constant %s (value %s) will not be collected.\n",
984 » » SYMBOL_PRINT_NAME (sym), SYMBOL_VALUE (sym)); 987 » » SYMBOL_PRINT_NAME (sym), plongest (SYMBOL_VALUE (sym)));
985 break; 988 break;
986 case LOC_STATIC: 989 case LOC_STATIC:
987 offset = SYMBOL_VALUE_ADDRESS (sym); 990 offset = SYMBOL_VALUE_ADDRESS (sym);
988 if (info_verbose) 991 if (info_verbose)
989 { 992 {
990 char tmp[40]; 993 char tmp[40];
991 994
992 sprintf_vma (tmp, offset); 995 sprintf_vma (tmp, offset);
993 printf_filtered ("LOC_STATIC %s: collect %ld bytes at %s.\n", 996 printf_filtered ("LOC_STATIC %s: collect %ld bytes at %s.\n",
994 SYMBOL_PRINT_NAME (sym), len, 997 SYMBOL_PRINT_NAME (sym), len,
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
1444 { 1447 {
1445 add_static_trace_data (collect); 1448 add_static_trace_data (collect);
1446 action_exp = strchr (action_exp, ','); /* more? */ 1449 action_exp = strchr (action_exp, ','); /* more? */
1447 } 1450 }
1448 else 1451 else
1449 { 1452 {
1450 unsigned long addr, len; 1453 unsigned long addr, len;
1451 struct cleanup *old_chain = NULL; 1454 struct cleanup *old_chain = NULL;
1452 struct cleanup *old_chain1 = NULL; 1455 struct cleanup *old_chain1 = NULL;
1453 1456
1454 » » exp = parse_exp_1 (&action_exp, 1457 » » exp = parse_exp_1 (&action_exp, tloc->address,
1455 block_for_pc (tloc->address), 1); 1458 block_for_pc (tloc->address), 1);
1456 old_chain = make_cleanup (free_current_contents, &exp); 1459 old_chain = make_cleanup (free_current_contents, &exp);
1457 1460
1458 switch (exp->elts[0].opcode) 1461 switch (exp->elts[0].opcode)
1459 { 1462 {
1460 case OP_REGISTER: 1463 case OP_REGISTER:
1461 { 1464 {
1462 const char *name = &exp->elts[2].string; 1465 const char *name = &exp->elts[2].string;
1463 1466
1464 i = user_reg_map_name_to_regnum (tloc->gdbarch, 1467 i = user_reg_map_name_to_regnum (tloc->gdbarch,
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1534 do 1537 do
1535 { /* Repeat over a comma-separated list. */ 1538 { /* Repeat over a comma-separated list. */
1536 QUIT; /* Allow user to bail out with ^C. */ 1539 QUIT; /* Allow user to bail out with ^C. */
1537 while (isspace ((int) *action_exp)) 1540 while (isspace ((int) *action_exp))
1538 action_exp++; 1541 action_exp++;
1539 1542
1540 { 1543 {
1541 struct cleanup *old_chain = NULL; 1544 struct cleanup *old_chain = NULL;
1542 struct cleanup *old_chain1 = NULL; 1545 struct cleanup *old_chain1 = NULL;
1543 1546
1544 » » exp = parse_exp_1 (&action_exp, 1547 » » exp = parse_exp_1 (&action_exp, tloc->address,
1545 block_for_pc (tloc->address), 1); 1548 block_for_pc (tloc->address), 1);
1546 old_chain = make_cleanup (free_current_contents, &exp); 1549 old_chain = make_cleanup (free_current_contents, &exp);
1547 1550
1548 aexpr = gen_eval_for_expr (tloc->address, exp); 1551 aexpr = gen_eval_for_expr (tloc->address, exp);
1549 old_chain1 = make_cleanup_free_agent_expr (aexpr); 1552 old_chain1 = make_cleanup_free_agent_expr (aexpr);
1550 1553
1551 ax_reqs (aexpr); 1554 ax_reqs (aexpr);
1552 report_agent_reqs_errors (aexpr); 1555 report_agent_reqs_errors (aexpr);
1553 1556
1554 discard_cleanups (old_chain1); 1557 discard_cleanups (old_chain1);
(...skipping 15 matching lines...) Expand all
1570 1573
1571 encode_actions_1 (action->body_list[0], t, tloc, frame_reg, 1574 encode_actions_1 (action->body_list[0], t, tloc, frame_reg,
1572 frame_offset, stepping_list, NULL); 1575 frame_offset, stepping_list, NULL);
1573 } 1576 }
1574 else 1577 else
1575 error (_("Invalid tracepoint command '%s'"), action->line); 1578 error (_("Invalid tracepoint command '%s'"), action->line);
1576 } /* for */ 1579 } /* for */
1577 } 1580 }
1578 1581
1579 /* Render all actions into gdb protocol. */ 1582 /* Render all actions into gdb protocol. */
1580 /*static*/ void 1583
1584 void
1581 encode_actions (struct breakpoint *t, struct bp_location *tloc, 1585 encode_actions (struct breakpoint *t, struct bp_location *tloc,
1582 char ***tdp_actions, char ***stepping_actions) 1586 char ***tdp_actions, char ***stepping_actions)
1583 { 1587 {
1584 static char tdp_buff[2048], step_buff[2048]; 1588 static char tdp_buff[2048], step_buff[2048];
1585 char *default_collect_line = NULL; 1589 char *default_collect_line = NULL;
1586 struct command_line *actions; 1590 struct command_line *actions;
1587 struct command_line *default_collect_action = NULL; 1591 struct command_line *default_collect_action = NULL;
1588 int frame_reg; 1592 int frame_reg;
1589 LONGEST frame_offset; 1593 LONGEST frame_offset;
1590 struct cleanup *back_to; 1594 struct cleanup *back_to;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1709 /* No point in tracing without any tracepoints... */ 1713 /* No point in tracing without any tracepoints... */
1710 if (VEC_length (breakpoint_p, tp_vec) == 0) 1714 if (VEC_length (breakpoint_p, tp_vec) == 0)
1711 { 1715 {
1712 VEC_free (breakpoint_p, tp_vec); 1716 VEC_free (breakpoint_p, tp_vec);
1713 error (_("No tracepoints defined, not starting trace")); 1717 error (_("No tracepoints defined, not starting trace"));
1714 } 1718 }
1715 1719
1716 for (ix = 0; VEC_iterate (breakpoint_p, tp_vec, ix, b); ix++) 1720 for (ix = 0; VEC_iterate (breakpoint_p, tp_vec, ix, b); ix++)
1717 { 1721 {
1718 struct tracepoint *t = (struct tracepoint *) b; 1722 struct tracepoint *t = (struct tracepoint *) b;
1723 struct bp_location *loc;
1719 1724
1720 if (b->enable_state == bp_enabled) 1725 if (b->enable_state == bp_enabled)
1721 any_enabled = 1; 1726 any_enabled = 1;
1722 1727
1723 if ((b->type == bp_fast_tracepoint 1728 if ((b->type == bp_fast_tracepoint
1724 ? may_insert_fast_tracepoints 1729 ? may_insert_fast_tracepoints
1725 : may_insert_tracepoints)) 1730 : may_insert_tracepoints))
1726 ++num_to_download; 1731 ++num_to_download;
1727 else 1732 else
1728 warning (_("May not insert %stracepoints, skipping tracepoint %d"), 1733 warning (_("May not insert %stracepoints, skipping tracepoint %d"),
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1771 /* Since tracepoint locations are never duplicated, `inserted' 1776 /* Since tracepoint locations are never duplicated, `inserted'
1772 flag should be zero. */ 1777 flag should be zero. */
1773 gdb_assert (!loc->inserted); 1778 gdb_assert (!loc->inserted);
1774 1779
1775 target_download_tracepoint (loc); 1780 target_download_tracepoint (loc);
1776 1781
1777 loc->inserted = 1; 1782 loc->inserted = 1;
1778 } 1783 }
1779 1784
1780 t->number_on_target = b->number; 1785 t->number_on_target = b->number;
1786
1787 for (loc = b->loc; loc; loc = loc->next)
1788 if (loc->probe != NULL)
1789 loc->probe->pops->set_semaphore (loc->probe, loc->gdbarch);
1781 } 1790 }
1782 VEC_free (breakpoint_p, tp_vec); 1791 VEC_free (breakpoint_p, tp_vec);
1783 1792
1784 /* Send down all the trace state variables too. */ 1793 /* Send down all the trace state variables too. */
1785 for (ix = 0; VEC_iterate (tsv_s, tvariables, ix, tsv); ++ix) 1794 for (ix = 0; VEC_iterate (tsv_s, tvariables, ix, tsv); ++ix)
1786 { 1795 {
1787 target_download_trace_state_variable (tsv); 1796 target_download_trace_state_variable (tsv);
1788 } 1797 }
1789 1798
1790 /* Tell target to treat text-like sections as transparent. */ 1799 /* Tell target to treat text-like sections as transparent. */
1791 target_trace_set_readonly_regions (); 1800 target_trace_set_readonly_regions ();
1792 /* Set some mode flags. */ 1801 /* Set some mode flags. */
1793 target_set_disconnected_tracing (disconnected_tracing); 1802 target_set_disconnected_tracing (disconnected_tracing);
1794 target_set_circular_trace_buffer (circular_trace_buffer); 1803 target_set_circular_trace_buffer (circular_trace_buffer);
1795 1804
1796 if (!notes) 1805 if (!notes)
1797 notes = trace_notes; 1806 notes = trace_notes;
1798 ret = target_set_trace_notes (trace_user, notes, NULL); 1807 ret = target_set_trace_notes (trace_user, notes, NULL);
1799 1808
1800 if (!ret && (trace_user || notes)) 1809 if (!ret && (trace_user || notes))
1801 warning ("Target does not support trace user/notes, info ignored"); 1810 warning (_("Target does not support trace user/notes, info ignored"));
1802 1811
1803 /* Now insert traps and begin collecting data. */ 1812 /* Now insert traps and begin collecting data. */
1804 target_trace_start (); 1813 target_trace_start ();
1805 1814
1806 /* Reset our local state. */ 1815 /* Reset our local state. */
1807 set_traceframe_num (-1); 1816 set_traceframe_num (-1);
1808 set_tracepoint_num (-1); 1817 set_tracepoint_num (-1);
1809 set_traceframe_context (NULL); 1818 set_traceframe_context (NULL);
1810 current_trace_status()->running = 1; 1819 current_trace_status()->running = 1;
1811 clear_traceframe_info (); 1820 clear_traceframe_info ();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1843 if (!current_trace_status ()->running) 1852 if (!current_trace_status ()->running)
1844 error (_("Trace is not running.")); 1853 error (_("Trace is not running."));
1845 1854
1846 stop_tracing (args); 1855 stop_tracing (args);
1847 } 1856 }
1848 1857
1849 void 1858 void
1850 stop_tracing (char *note) 1859 stop_tracing (char *note)
1851 { 1860 {
1852 int ret; 1861 int ret;
1862 VEC(breakpoint_p) *tp_vec = NULL;
1863 int ix;
1864 struct breakpoint *t;
1853 1865
1854 target_trace_stop (); 1866 target_trace_stop ();
1855 1867
1868 tp_vec = all_tracepoints ();
1869 for (ix = 0; VEC_iterate (breakpoint_p, tp_vec, ix, t); ix++)
1870 {
1871 struct bp_location *loc;
1872
1873 if ((t->type == bp_fast_tracepoint
1874 ? !may_insert_fast_tracepoints
1875 : !may_insert_tracepoints))
1876 continue;
1877
1878 for (loc = t->loc; loc; loc = loc->next)
1879 {
1880 /* GDB can be totally absent in some disconnected trace scenarios,
1881 but we don't really care if this semaphore goes out of sync.
1882 That's why we are decrementing it here, but not taking care
1883 in other places. */
1884 if (loc->probe != NULL)
1885 loc->probe->pops->clear_semaphore (loc->probe, loc->gdbarch);
1886 }
1887 }
1888
1889 VEC_free (breakpoint_p, tp_vec);
1890
1856 if (!note) 1891 if (!note)
1857 note = trace_stop_notes; 1892 note = trace_stop_notes;
1858 ret = target_set_trace_notes (NULL, NULL, note); 1893 ret = target_set_trace_notes (NULL, NULL, note);
1859 1894
1860 if (!ret && note) 1895 if (!ret && note)
1861 warning ("Target does not support trace notes, note ignored"); 1896 warning (_("Target does not support trace notes, note ignored"));
1862 1897
1863 /* Should change in response to reply? */ 1898 /* Should change in response to reply? */
1864 current_trace_status ()->running = 0; 1899 current_trace_status ()->running = 0;
1865 } 1900 }
1866 1901
1867 /* tstatus command */ 1902 /* tstatus command */
1868 static void 1903 static void
1869 trace_status_command (char *args, int from_tty) 1904 trace_status_command (char *args, int from_tty)
1870 { 1905 {
1871 struct trace_status *ts = current_trace_status (); 1906 struct trace_status *ts = current_trace_status ();
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
2452 if (args == 0 || *args == 0) 2487 if (args == 0 || *args == 0)
2453 { 2488 {
2454 sal = find_pc_line (get_frame_pc (get_current_frame ()), 0); 2489 sal = find_pc_line (get_frame_pc (get_current_frame ()), 0);
2455 sals.nelts = 1; 2490 sals.nelts = 1;
2456 sals.sals = (struct symtab_and_line *) 2491 sals.sals = (struct symtab_and_line *)
2457 xmalloc (sizeof (struct symtab_and_line)); 2492 xmalloc (sizeof (struct symtab_and_line));
2458 sals.sals[0] = sal; 2493 sals.sals[0] = sal;
2459 } 2494 }
2460 else 2495 else
2461 { 2496 {
2462 sals = decode_line_spec (args, DECODE_LINE_FUNFIRSTLINE); 2497 sals = decode_line_with_current_source (args, DECODE_LINE_FUNFIRSTLINE);
2463 sal = sals.sals[0]; 2498 sal = sals.sals[0];
2464 } 2499 }
2465 2500
2466 old_chain = make_cleanup (xfree, sals.sals); 2501 old_chain = make_cleanup (xfree, sals.sals);
2467 if (sal.symtab == 0) 2502 if (sal.symtab == 0)
2468 error (_("No line number information available.")); 2503 error (_("No line number information available."));
2469 2504
2470 if (sal.line > 0 && find_line_pc_range (sal, &start_pc, &end_pc)) 2505 if (sal.line > 0 && find_line_pc_range (sal, &start_pc, &end_pc))
2471 { 2506 {
2472 if (start_pc == end_pc) 2507 if (start_pc == end_pc)
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
2570 } 2605 }
2571 2606
2572 /* info scope command: list the locals for a scope. */ 2607 /* info scope command: list the locals for a scope. */
2573 static void 2608 static void
2574 scope_info (char *args, int from_tty) 2609 scope_info (char *args, int from_tty)
2575 { 2610 {
2576 struct symtabs_and_lines sals; 2611 struct symtabs_and_lines sals;
2577 struct symbol *sym; 2612 struct symbol *sym;
2578 struct minimal_symbol *msym; 2613 struct minimal_symbol *msym;
2579 struct block *block; 2614 struct block *block;
2580 char *symname, *save_args = args; 2615 const char *symname;
2581 struct dict_iterator iter; 2616 char *save_args = args;
2617 struct block_iterator iter;
2582 int j, count = 0; 2618 int j, count = 0;
2583 struct gdbarch *gdbarch; 2619 struct gdbarch *gdbarch;
2584 int regno; 2620 int regno;
2585 2621
2586 if (args == 0 || *args == 0) 2622 if (args == 0 || *args == 0)
2587 error (_("requires an argument (function, " 2623 error (_("requires an argument (function, "
2588 "line or *addr) to define a scope")); 2624 "line or *addr) to define a scope"));
2589 2625
2590 sals = decode_line_1 (&args, DECODE_LINE_FUNFIRSTLINE, NULL, 0); 2626 sals = decode_line_1 (&args, DECODE_LINE_FUNFIRSTLINE, NULL, 0);
2591 if (sals.nelts == 0) 2627 if (sals.nelts == 0)
(...skipping 22 matching lines...) Expand all
2614 printf_filtered ("Symbol %s is ", symname); 2650 printf_filtered ("Symbol %s is ", symname);
2615 switch (SYMBOL_CLASS (sym)) 2651 switch (SYMBOL_CLASS (sym))
2616 { 2652 {
2617 default: 2653 default:
2618 case LOC_UNDEF: /* Messed up symbol? */ 2654 case LOC_UNDEF: /* Messed up symbol? */
2619 printf_filtered ("a bogus symbol, class %d.\n", 2655 printf_filtered ("a bogus symbol, class %d.\n",
2620 SYMBOL_CLASS (sym)); 2656 SYMBOL_CLASS (sym));
2621 count--; /* Don't count this one. */ 2657 count--; /* Don't count this one. */
2622 continue; 2658 continue;
2623 case LOC_CONST: 2659 case LOC_CONST:
2624 » printf_filtered ("a constant with value %ld (0x%lx)", 2660 » printf_filtered ("a constant with value %s (%s)",
2625 » » » SYMBOL_VALUE (sym), SYMBOL_VALUE (sym)); 2661 » » » plongest (SYMBOL_VALUE (sym)),
2662 » » » hex_string (SYMBOL_VALUE (sym)));
2626 break; 2663 break;
2627 case LOC_CONST_BYTES: 2664 case LOC_CONST_BYTES:
2628 printf_filtered ("constant bytes: "); 2665 printf_filtered ("constant bytes: ");
2629 if (SYMBOL_TYPE (sym)) 2666 if (SYMBOL_TYPE (sym))
2630 for (j = 0; j < TYPE_LENGTH (SYMBOL_TYPE (sym)); j++) 2667 for (j = 0; j < TYPE_LENGTH (SYMBOL_TYPE (sym)); j++)
2631 fprintf_filtered (gdb_stdout, " %02x", 2668 fprintf_filtered (gdb_stdout, " %02x",
2632 (unsigned) SYMBOL_VALUE_BYTES (sym)[j]); 2669 (unsigned) SYMBOL_VALUE_BYTES (sym)[j]);
2633 break; 2670 break;
2634 case LOC_STATIC: 2671 case LOC_STATIC:
2635 printf_filtered ("in static storage at address "); 2672 printf_filtered ("in static storage at address ");
(...skipping 12 matching lines...) Expand all
2648 gdbarch); 2685 gdbarch);
2649 2686
2650 if (SYMBOL_IS_ARGUMENT (sym)) 2687 if (SYMBOL_IS_ARGUMENT (sym))
2651 printf_filtered ("an argument in register $%s", 2688 printf_filtered ("an argument in register $%s",
2652 gdbarch_register_name (gdbarch, regno)); 2689 gdbarch_register_name (gdbarch, regno));
2653 else 2690 else
2654 printf_filtered ("a local variable in register $%s", 2691 printf_filtered ("a local variable in register $%s",
2655 gdbarch_register_name (gdbarch, regno)); 2692 gdbarch_register_name (gdbarch, regno));
2656 break; 2693 break;
2657 case LOC_ARG: 2694 case LOC_ARG:
2658 » printf_filtered ("an argument at stack/frame offset %ld", 2695 » printf_filtered ("an argument at stack/frame offset %s",
2659 » » » SYMBOL_VALUE (sym)); 2696 » » » plongest (SYMBOL_VALUE (sym)));
2660 break; 2697 break;
2661 case LOC_LOCAL: 2698 case LOC_LOCAL:
2662 » printf_filtered ("a local variable at frame offset %ld", 2699 » printf_filtered ("a local variable at frame offset %s",
2663 » » » SYMBOL_VALUE (sym)); 2700 » » » plongest (SYMBOL_VALUE (sym)));
2664 break; 2701 break;
2665 case LOC_REF_ARG: 2702 case LOC_REF_ARG:
2666 » printf_filtered ("a reference argument at offset %ld", 2703 » printf_filtered ("a reference argument at offset %s",
2667 » » » SYMBOL_VALUE (sym)); 2704 » » » plongest (SYMBOL_VALUE (sym)));
2668 break; 2705 break;
2669 case LOC_REGPARM_ADDR: 2706 case LOC_REGPARM_ADDR:
2670 /* Note comment at LOC_REGISTER. */ 2707 /* Note comment at LOC_REGISTER. */
2671 regno = SYMBOL_REGISTER_OPS (sym)->register_number (sym, 2708 regno = SYMBOL_REGISTER_OPS (sym)->register_number (sym,
2672 gdbarch); 2709 gdbarch);
2673 printf_filtered ("the address of an argument, in register $%s", 2710 printf_filtered ("the address of an argument, in register $%s",
2674 gdbarch_register_name (gdbarch, regno)); 2711 gdbarch_register_name (gdbarch, regno));
2675 break; 2712 break;
2676 case LOC_TYPEDEF: 2713 case LOC_TYPEDEF:
2677 printf_filtered ("a typedef.\n"); 2714 printf_filtered ("a typedef.\n");
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
3159 3196
3160 static void 3197 static void
3161 set_trace_user (char *args, int from_tty, 3198 set_trace_user (char *args, int from_tty,
3162 struct cmd_list_element *c) 3199 struct cmd_list_element *c)
3163 { 3200 {
3164 int ret; 3201 int ret;
3165 3202
3166 ret = target_set_trace_notes (trace_user, NULL, NULL); 3203 ret = target_set_trace_notes (trace_user, NULL, NULL);
3167 3204
3168 if (!ret) 3205 if (!ret)
3169 warning ("Target does not support trace notes, user ignored"); 3206 warning (_("Target does not support trace notes, user ignored"));
3170 } 3207 }
3171 3208
3172 static void 3209 static void
3173 set_trace_notes (char *args, int from_tty, 3210 set_trace_notes (char *args, int from_tty,
3174 struct cmd_list_element *c) 3211 struct cmd_list_element *c)
3175 { 3212 {
3176 int ret; 3213 int ret;
3177 3214
3178 ret = target_set_trace_notes (NULL, trace_notes, NULL); 3215 ret = target_set_trace_notes (NULL, trace_notes, NULL);
3179 3216
3180 if (!ret) 3217 if (!ret)
3181 warning ("Target does not support trace notes, note ignored"); 3218 warning (_("Target does not support trace notes, note ignored"));
3182 } 3219 }
3183 3220
3184 static void 3221 static void
3185 set_trace_stop_notes (char *args, int from_tty, 3222 set_trace_stop_notes (char *args, int from_tty,
3186 struct cmd_list_element *c) 3223 struct cmd_list_element *c)
3187 { 3224 {
3188 int ret; 3225 int ret;
3189 3226
3190 ret = target_set_trace_notes (NULL, NULL, trace_stop_notes); 3227 ret = target_set_trace_notes (NULL, NULL, trace_stop_notes);
3191 3228
3192 if (!ret) 3229 if (!ret)
3193 warning ("Target does not support trace notes, stop note ignored"); 3230 warning (_("Target does not support trace notes, stop note ignored"));
3194 } 3231 }
3195 3232
3196 /* Convert the memory pointed to by mem into hex, placing result in buf. 3233 /* Convert the memory pointed to by mem into hex, placing result in buf.
3197 * Return a pointer to the last char put in buf (null) 3234 * Return a pointer to the last char put in buf (null)
3198 * "stolen" from sparc-stub.c 3235 * "stolen" from sparc-stub.c
3199 */ 3236 */
3200 3237
3201 static const char hexchars[] = "0123456789abcdef"; 3238 static const char hexchars[] = "0123456789abcdef";
3202 3239
3203 static char * 3240 static char *
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
3335 { 3372 {
3336 next_one = (*utpp)->next; 3373 next_one = (*utpp)->next;
3337 xfree (*utpp); 3374 xfree (*utpp);
3338 *utpp = next_one; 3375 *utpp = next_one;
3339 } 3376 }
3340 } 3377 }
3341 3378
3342 /* Given a number and address, return an uploaded tracepoint with that 3379 /* Given a number and address, return an uploaded tracepoint with that
3343 number, creating if necessary. */ 3380 number, creating if necessary. */
3344 3381
3345 struct uploaded_tsv * 3382 static struct uploaded_tsv *
3346 get_uploaded_tsv (int num, struct uploaded_tsv **utsvp) 3383 get_uploaded_tsv (int num, struct uploaded_tsv **utsvp)
3347 { 3384 {
3348 struct uploaded_tsv *utsv; 3385 struct uploaded_tsv *utsv;
3349 3386
3350 for (utsv = *utsvp; utsv; utsv = utsv->next) 3387 for (utsv = *utsvp; utsv; utsv = utsv->next)
3351 if (utsv->number == num) 3388 if (utsv->number == num)
3352 return utsv; 3389 return utsv;
3353 utsv = (struct uploaded_tsv *) xmalloc (sizeof (struct uploaded_tsv)); 3390 utsv = (struct uploaded_tsv *) xmalloc (sizeof (struct uploaded_tsv));
3354 memset (utsv, 0, sizeof (struct uploaded_tsv)); 3391 memset (utsv, 0, sizeof (struct uploaded_tsv));
3355 utsv->number = num; 3392 utsv->number = num;
(...skipping 26 matching lines...) Expand all
3382 return (str1 == str2); 3419 return (str1 == str2);
3383 3420
3384 return (strcmp (str1, str2) == 0); 3421 return (strcmp (str1, str2) == 0);
3385 } 3422 }
3386 3423
3387 /* Look for an existing tracepoint that seems similar enough to the 3424 /* Look for an existing tracepoint that seems similar enough to the
3388 uploaded one. Enablement isn't compared, because the user can 3425 uploaded one. Enablement isn't compared, because the user can
3389 toggle that freely, and may have done so in anticipation of the 3426 toggle that freely, and may have done so in anticipation of the
3390 next trace run. Return the location of matched tracepoint. */ 3427 next trace run. Return the location of matched tracepoint. */
3391 3428
3392 struct bp_location * 3429 static struct bp_location *
3393 find_matching_tracepoint_location (struct uploaded_tp *utp) 3430 find_matching_tracepoint_location (struct uploaded_tp *utp)
3394 { 3431 {
3395 VEC(breakpoint_p) *tp_vec = all_tracepoints (); 3432 VEC(breakpoint_p) *tp_vec = all_tracepoints ();
3396 int ix; 3433 int ix;
3397 struct breakpoint *b; 3434 struct breakpoint *b;
3398 struct bp_location *loc; 3435 struct bp_location *loc;
3399 3436
3400 for (ix = 0; VEC_iterate (breakpoint_p, tp_vec, ix, b); ix++) 3437 for (ix = 0; VEC_iterate (breakpoint_p, tp_vec, ix, b); ix++)
3401 { 3438 {
3402 struct tracepoint *t = (struct tracepoint *) b; 3439 struct tracepoint *t = (struct tracepoint *) b;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
3465 if (t) 3502 if (t)
3466 t->number_on_target = utp->number; 3503 t->number_on_target = utp->number;
3467 } 3504 }
3468 3505
3469 free_uploaded_tps (uploaded_tps); 3506 free_uploaded_tps (uploaded_tps);
3470 } 3507 }
3471 3508
3472 /* Trace state variables don't have much to identify them beyond their 3509 /* Trace state variables don't have much to identify them beyond their
3473 name, so just use that to detect matches. */ 3510 name, so just use that to detect matches. */
3474 3511
3475 struct trace_state_variable * 3512 static struct trace_state_variable *
3476 find_matching_tsv (struct uploaded_tsv *utsv) 3513 find_matching_tsv (struct uploaded_tsv *utsv)
3477 { 3514 {
3478 if (!utsv->name) 3515 if (!utsv->name)
3479 return NULL; 3516 return NULL;
3480 3517
3481 return find_trace_state_variable (utsv->name); 3518 return find_trace_state_variable (utsv->name);
3482 } 3519 }
3483 3520
3484 struct trace_state_variable * 3521 static struct trace_state_variable *
3485 create_tsv_from_upload (struct uploaded_tsv *utsv) 3522 create_tsv_from_upload (struct uploaded_tsv *utsv)
3486 { 3523 {
3487 const char *namebase; 3524 const char *namebase;
3488 char *buf; 3525 char *buf;
3489 int try_num = 0; 3526 int try_num = 0;
3490 struct trace_state_variable *tsv; 3527 struct trace_state_variable *tsv;
3491 struct cleanup *old_chain; 3528 struct cleanup *old_chain;
3492 3529
3493 if (utsv->name) 3530 if (utsv->name)
3494 { 3531 {
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after
4379 } 4416 }
4380 4417
4381 /* Look for a block of saved registers in the traceframe, and get the 4418 /* Look for a block of saved registers in the traceframe, and get the
4382 requested register from it. */ 4419 requested register from it. */
4383 4420
4384 static void 4421 static void
4385 tfile_fetch_registers (struct target_ops *ops, 4422 tfile_fetch_registers (struct target_ops *ops,
4386 struct regcache *regcache, int regno) 4423 struct regcache *regcache, int regno)
4387 { 4424 {
4388 struct gdbarch *gdbarch = get_regcache_arch (regcache); 4425 struct gdbarch *gdbarch = get_regcache_arch (regcache);
4389 char block_type; 4426 int offset, regn, regsize, pc_regno;
4390 int pos, offset, regn, regsize, pc_regno;
4391 unsigned short mlen;
4392 char *regs; 4427 char *regs;
4393 4428
4394 /* An uninitialized reg size says we're not going to be 4429 /* An uninitialized reg size says we're not going to be
4395 successful at getting register blocks. */ 4430 successful at getting register blocks. */
4396 if (!trace_regblock_size) 4431 if (!trace_regblock_size)
4397 return; 4432 return;
4398 4433
4399 set_tfile_traceframe (); 4434 set_tfile_traceframe ();
4400 4435
4401 regs = alloca (trace_regblock_size); 4436 regs = alloca (trace_regblock_size);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
4505 /* If the block includes the first part of the desired 4540 /* If the block includes the first part of the desired
4506 range, return as much it has; GDB will re-request the 4541 range, return as much it has; GDB will re-request the
4507 remainder, which might be in a different block of this 4542 remainder, which might be in a different block of this
4508 trace frame. */ 4543 trace frame. */
4509 if (maddr <= offset && offset < (maddr + mlen)) 4544 if (maddr <= offset && offset < (maddr + mlen))
4510 { 4545 {
4511 amt = (maddr + mlen) - offset; 4546 amt = (maddr + mlen) - offset;
4512 if (amt > len) 4547 if (amt > len)
4513 amt = len; 4548 amt = len;
4514 4549
4550 if (maddr != offset)
4551 lseek (trace_fd, offset - maddr, SEEK_CUR);
4515 tfile_read (readbuf, amt); 4552 tfile_read (readbuf, amt);
4516 return amt; 4553 return amt;
4517 } 4554 }
4518 4555
4519 /* Skip over this block. */ 4556 /* Skip over this block. */
4520 pos += (8 + 2 + mlen); 4557 pos += (8 + 2 + mlen);
4521 } 4558 }
4522 } 4559 }
4523 4560
4524 /* It's unduly pedantic to refuse to look at the executable for 4561 /* It's unduly pedantic to refuse to look at the executable for
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
4692 tfile_ops.to_stratum = process_stratum; 4729 tfile_ops.to_stratum = process_stratum;
4693 tfile_ops.to_has_all_memory = tfile_has_all_memory; 4730 tfile_ops.to_has_all_memory = tfile_has_all_memory;
4694 tfile_ops.to_has_memory = tfile_has_memory; 4731 tfile_ops.to_has_memory = tfile_has_memory;
4695 tfile_ops.to_has_stack = tfile_has_stack; 4732 tfile_ops.to_has_stack = tfile_has_stack;
4696 tfile_ops.to_has_registers = tfile_has_registers; 4733 tfile_ops.to_has_registers = tfile_has_registers;
4697 tfile_ops.to_traceframe_info = tfile_traceframe_info; 4734 tfile_ops.to_traceframe_info = tfile_traceframe_info;
4698 tfile_ops.to_thread_alive = tfile_thread_alive; 4735 tfile_ops.to_thread_alive = tfile_thread_alive;
4699 tfile_ops.to_magic = OPS_MAGIC; 4736 tfile_ops.to_magic = OPS_MAGIC;
4700 } 4737 }
4701 4738
4739 void
4740 free_current_marker (void *arg)
4741 {
4742 struct static_tracepoint_marker **marker_p = arg;
4743
4744 if (*marker_p != NULL)
4745 {
4746 release_static_tracepoint_marker (*marker_p);
4747 xfree (*marker_p);
4748 }
4749 else
4750 *marker_p = NULL;
4751 }
4752
4702 /* Given a line of text defining a static tracepoint marker, parse it 4753 /* Given a line of text defining a static tracepoint marker, parse it
4703 into a "static tracepoint marker" object. Throws an error is 4754 into a "static tracepoint marker" object. Throws an error is
4704 parsing fails. If PP is non-null, it points to one past the end of 4755 parsing fails. If PP is non-null, it points to one past the end of
4705 the parsed marker definition. */ 4756 the parsed marker definition. */
4706 4757
4707 void 4758 void
4708 parse_static_tracepoint_marker_definition (char *line, char **pp, 4759 parse_static_tracepoint_marker_definition (char *line, char **pp,
4709 struct static_tracepoint_marker *mark er) 4760 struct static_tracepoint_marker *mark er)
4710 { 4761 {
4711 char *p, *endp; 4762 char *p, *endp;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
4754 static void 4805 static void
4755 print_one_static_tracepoint_marker (int count, 4806 print_one_static_tracepoint_marker (int count,
4756 struct static_tracepoint_marker *marker) 4807 struct static_tracepoint_marker *marker)
4757 { 4808 {
4758 struct command_line *l; 4809 struct command_line *l;
4759 struct symbol *sym; 4810 struct symbol *sym;
4760 4811
4761 char wrap_indent[80]; 4812 char wrap_indent[80];
4762 char extra_field_indent[80]; 4813 char extra_field_indent[80];
4763 struct ui_out *uiout = current_uiout; 4814 struct ui_out *uiout = current_uiout;
4764 struct ui_stream *stb = ui_out_stream_new (uiout);
4765 struct cleanup *old_chain = make_cleanup_ui_out_stream_delete (stb);
4766 struct cleanup *bkpt_chain; 4815 struct cleanup *bkpt_chain;
4767 VEC(breakpoint_p) *tracepoints; 4816 VEC(breakpoint_p) *tracepoints;
4768 4817
4769 struct symtab_and_line sal; 4818 struct symtab_and_line sal;
4770 4819
4771 init_sal (&sal); 4820 init_sal (&sal);
4772 4821
4773 sal.pc = marker->address; 4822 sal.pc = marker->address;
4774 4823
4775 tracepoints = static_tracepoints_here (marker->address); 4824 tracepoints = static_tracepoints_here (marker->address);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
4862 4911
4863 if (ui_out_is_mi_like_p (uiout)) 4912 if (ui_out_is_mi_like_p (uiout))
4864 ui_out_field_int (uiout, "number-of-tracepoints", 4913 ui_out_field_int (uiout, "number-of-tracepoints",
4865 VEC_length(breakpoint_p, tracepoints)); 4914 VEC_length(breakpoint_p, tracepoints));
4866 else 4915 else
4867 ui_out_text (uiout, "\n"); 4916 ui_out_text (uiout, "\n");
4868 } 4917 }
4869 VEC_free (breakpoint_p, tracepoints); 4918 VEC_free (breakpoint_p, tracepoints);
4870 4919
4871 do_cleanups (bkpt_chain); 4920 do_cleanups (bkpt_chain);
4872 do_cleanups (old_chain);
4873 } 4921 }
4874 4922
4875 static void 4923 static void
4876 info_static_tracepoint_markers_command (char *arg, int from_tty) 4924 info_static_tracepoint_markers_command (char *arg, int from_tty)
4877 { 4925 {
4878 VEC(static_tracepoint_marker_p) *markers; 4926 VEC(static_tracepoint_marker_p) *markers;
4879 struct cleanup *old_chain; 4927 struct cleanup *old_chain;
4880 struct static_tracepoint_marker *marker; 4928 struct static_tracepoint_marker *marker;
4881 struct ui_out *uiout = current_uiout; 4929 struct ui_out *uiout = current_uiout;
4882 int i; 4930 int i;
4883 4931
4932 /* We don't have to check target_can_use_agent and agent's capability on
4933 static tracepoint here, in order to be compatible with older GDBserver.
4934 We don't check USE_AGENT is true or not, because static tracepoints
4935 don't work without in-process agent, so we don't bother users to type
4936 `set agent on' when to use static tracepoint. */
4937
4884 old_chain 4938 old_chain
4885 = make_cleanup_ui_out_table_begin_end (uiout, 5, -1, 4939 = make_cleanup_ui_out_table_begin_end (uiout, 5, -1,
4886 "StaticTracepointMarkersTable"); 4940 "StaticTracepointMarkersTable");
4887 4941
4888 ui_out_table_header (uiout, 7, ui_left, "counter", "Cnt"); 4942 ui_out_table_header (uiout, 7, ui_left, "counter", "Cnt");
4889 4943
4890 ui_out_table_header (uiout, 40, ui_left, "marker-id", "ID"); 4944 ui_out_table_header (uiout, 40, ui_left, "marker-id", "ID");
4891 4945
4892 ui_out_table_header (uiout, 3, ui_left, "enabled", "Enb"); 4946 ui_out_table_header (uiout, 3, ui_left, "enabled", "Enb");
4893 if (gdbarch_addr_bit (target_gdbarch) <= 32) 4947 if (gdbarch_addr_bit (target_gdbarch) <= 32)
(...skipping 23 matching lines...) Expand all
4917 for sure type of the value until we actually have a chance to fetch 4971 for sure type of the value until we actually have a chance to fetch
4918 the data --- the size of the object depends on what has been 4972 the data --- the size of the object depends on what has been
4919 collected. We solve this by making $_sdata be an internalvar that 4973 collected. We solve this by making $_sdata be an internalvar that
4920 creates a new value on access. */ 4974 creates a new value on access. */
4921 4975
4922 /* Return a new value with the correct type for the sdata object of 4976 /* Return a new value with the correct type for the sdata object of
4923 the current trace frame. Return a void value if there's no object 4977 the current trace frame. Return a void value if there's no object
4924 available. */ 4978 available. */
4925 4979
4926 static struct value * 4980 static struct value *
4927 sdata_make_value (struct gdbarch *gdbarch, struct internalvar *var) 4981 sdata_make_value (struct gdbarch *gdbarch, struct internalvar *var,
4982 » » void *ignore)
4928 { 4983 {
4929 LONGEST size; 4984 LONGEST size;
4930 gdb_byte *buf; 4985 gdb_byte *buf;
4931 4986
4932 /* We need to read the whole object before we know its size. */ 4987 /* We need to read the whole object before we know its size. */
4933 size = target_read_alloc (&current_target, 4988 size = target_read_alloc (&current_target,
4934 TARGET_OBJECT_STATIC_TRACE_DATA, 4989 TARGET_OBJECT_STATIC_TRACE_DATA,
4935 NULL, &buf); 4990 NULL, &buf);
4936 if (size >= 0) 4991 if (size >= 0)
4937 { 4992 {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
5043 do_cleanups (back_to); 5098 do_cleanups (back_to);
5044 return NULL; 5099 return NULL;
5045 } 5100 }
5046 5101
5047 #endif /* HAVE_LIBEXPAT */ 5102 #endif /* HAVE_LIBEXPAT */
5048 5103
5049 /* Returns the traceframe_info object for the current traceframe. 5104 /* Returns the traceframe_info object for the current traceframe.
5050 This is where we avoid re-fetching the object from the target if we 5105 This is where we avoid re-fetching the object from the target if we
5051 already have it cached. */ 5106 already have it cached. */
5052 5107
5053 struct traceframe_info * 5108 static struct traceframe_info *
5054 get_traceframe_info (void) 5109 get_traceframe_info (void)
5055 { 5110 {
5056 if (traceframe_info == NULL) 5111 if (traceframe_info == NULL)
5057 traceframe_info = target_traceframe_info (); 5112 traceframe_info = target_traceframe_info ();
5058 5113
5059 return traceframe_info; 5114 return traceframe_info;
5060 } 5115 }
5061 5116
5062 /* If the target supports the query, return in RESULT the set of 5117 /* If the target supports the query, return in RESULT the set of
5063 collected memory in the current traceframe, found within the LEN 5118 collected memory in the current traceframe, found within the LEN
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
5096 nr->length = min (hi1, hi2) - nr->start; 5151 nr->length = min (hi1, hi2) - nr->start;
5097 } 5152 }
5098 5153
5099 normalize_mem_ranges (*result); 5154 normalize_mem_ranges (*result);
5100 return 1; 5155 return 1;
5101 } 5156 }
5102 5157
5103 return 0; 5158 return 0;
5104 } 5159 }
5105 5160
5161 /* Implementation of `sdata' variable. */
5162
5163 static const struct internalvar_funcs sdata_funcs =
5164 {
5165 sdata_make_value,
5166 NULL,
5167 NULL
5168 };
5169
5106 /* module initialization */ 5170 /* module initialization */
5107 void 5171 void
5108 _initialize_tracepoint (void) 5172 _initialize_tracepoint (void)
5109 { 5173 {
5110 struct cmd_list_element *c; 5174 struct cmd_list_element *c;
5111 5175
5112 /* Explicitly create without lookup, since that tries to create a 5176 /* Explicitly create without lookup, since that tries to create a
5113 value with a void typed value, and when we get here, gdbarch 5177 value with a void typed value, and when we get here, gdbarch
5114 isn't initialized yet. At this point, we're quite sure there 5178 isn't initialized yet. At this point, we're quite sure there
5115 isn't another convenience variable of the same name. */ 5179 isn't another convenience variable of the same name. */
5116 create_internalvar_type_lazy ("_sdata", sdata_make_value); 5180 create_internalvar_type_lazy ("_sdata", &sdata_funcs, NULL);
5117 5181
5118 traceframe_number = -1; 5182 traceframe_number = -1;
5119 tracepoint_number = -1; 5183 tracepoint_number = -1;
5120 5184
5121 if (tracepoint_list.list == NULL) 5185 if (tracepoint_list.list == NULL)
5122 { 5186 {
5123 tracepoint_list.listsize = 128; 5187 tracepoint_list.listsize = 128;
5124 tracepoint_list.list = xmalloc 5188 tracepoint_list.list = xmalloc
5125 (tracepoint_list.listsize * sizeof (struct memrange)); 5189 (tracepoint_list.listsize * sizeof (struct memrange));
5126 } 5190 }
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
5333 &trace_stop_notes, _("\ 5397 &trace_stop_notes, _("\
5334 Set notes string to use for future tstop commands"), _("\ 5398 Set notes string to use for future tstop commands"), _("\
5335 Show the notes string to use for future tstop commands"), NULL, 5399 Show the notes string to use for future tstop commands"), NULL,
5336 set_trace_stop_notes, NULL, 5400 set_trace_stop_notes, NULL,
5337 &setlist, &showlist); 5401 &setlist, &showlist);
5338 5402
5339 init_tfile_ops (); 5403 init_tfile_ops ();
5340 5404
5341 add_target (&tfile_ops); 5405 add_target (&tfile_ops);
5342 } 5406 }
OLDNEW
« no previous file with comments | « gdb/tracepoint.h ('k') | gdb/tui/tui-data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698