old-cross-binutils/gdb/testsuite/gdb.trace/actions.c
Stan Shebs f196051f5e * NEWS: Mention tracepoint additions.
* breakpoint.h (struct tracepoint): New field traceframe_usage.
	* breakpoint.c (print_one_breakpoint_location): Identify
	tracepoints as such when reporting hit counts, report
	trace buffer usage.
	(create_tracepoint_from_upload): Copy status info.
	* tracepoint.h (struct trace_status): Rename error_desc to stop_desc,
	add fields user_name, notes, start_time, stop_time.
	(struct uploaded_tp): Add fields hit_count, traceframe_usage.
	* tracepoint.c (trace_user): New global.
	(trace_notes): New global.
	(trace_stop_notes): New global.
	(start_tracing): Add argument and trace note handling.
	(stop_tracing): Ditto.
	(trace_start_command): Add notes argument.
	(trace_stop_command): Ditto.
	(trace_status_command): Report additional status info.
	(trace_status_mi): Similarly.
	(trace_save): Update, record tracepoint status.
	(set_disconnected_tracing): Call target method directly.
	(send_disconnected_tracing_value): Remove.
	(set_trace_user): New function.
	(set_trace_notes): New function.
	(set_trace_stop_notes): New function.
	(parse_trace_status): Handle additional status.
	(parse_tracepoint_status): New function.
	(parse_tracepoint_definition): Call it.
	(tfile_get_tracepoint_status): New function.
	(init_tfile_ops): Use it.
	(_initialize_tracepoint): Add new setshows.
	* target.h (struct target_ops): New methods to_get_tracepoint_status
	and to_set_trace_notes.
	(target_get_tracepoint_status): New macro.
	(target_set_trace_notes): New macro.
	* target.c (update_current_target): Add new methods.
	* remote.c (remote_get_tracepoint_status): New function.
	(remote_set_trace_notes): New function.
	(init_remote_ops): Add them.
	* mi/mi-main.c (mi_cmd_trace_start): Add argument to call.
	(mi_cmd_trace_stop): Ditto.

	* tracepoint.c (struct tracepoint): New field traceframe_usage.
	(tracing_start_time): New global.
	(tracing_stop_time): New global.
	(tracing_user_name): New global.
	(tracing_notes): New global.
	(tracing_stop_note): New global.
	(cmd_qtstart): Set traceframe_usage, start_time.
	(stop_tracing): Set stop_time.
	(cmd_qtstatus): Report additional status.
	(cmd_qtp): New function.
	(handle_tracepoint_query): Call it.
	(cmd_qtnotes): New function.
	(handle_tracepoint_general_set): Call it.
	(get_timestamp): Rename from tsv_get_timestamp.

	* gdb.texinfo (Starting and Stopping Trace Experiments): Document
	note-related options and variables.
	(Tracepoint Packets): Document packet changes.

	* gdb.trace/tstatus.exp: New.
	* gdb.trace/actions.c: Include string.h.
2011-11-20 23:59:49 +00:00

136 lines
3.7 KiB
C

/*
* Test program for trace action commands
*/
#include <string.h>
static char gdb_char_test;
static short gdb_short_test;
static long gdb_long_test;
static char gdb_arr_test[25];
static struct GDB_STRUCT_TEST
{
char c;
short s;
long l;
int bfield : 11; /* collect bitfield */
char arr[25];
struct GDB_STRUCT_TEST *next;
} gdb_struct1_test, gdb_struct2_test, *gdb_structp_test, **gdb_structpp_test;
static union GDB_UNION_TEST
{
char c;
short s;
long l;
int bfield : 11; /* collect bitfield */
char arr[4];
union GDB_UNION_TEST *next;
} gdb_union1_test;
void gdb_recursion_test (int, int, int, int, int, int, int);
void gdb_recursion_test (int depth,
int q1,
int q2,
int q3,
int q4,
int q5,
int q6)
{ /* gdb_recursion_test line 0 */
int q = q1; /* gdbtestline 1 */
q1 = q2; /* gdbtestline 2 */
q2 = q3; /* gdbtestline 3 */
q3 = q4; /* gdbtestline 4 */
q4 = q5; /* gdbtestline 5 */
q5 = q6; /* gdbtestline 6 */
q6 = q; /* gdbtestline 7 */
if (depth--) /* gdbtestline 8 */
gdb_recursion_test (depth, q1, q2, q3, q4, q5, q6); /* gdbtestline 9 */
}
unsigned long gdb_c_test( unsigned long *parm )
{
char *p = "gdb_c_test";
char *ridiculously_long_variable_name_with_equally_long_string_assignment;
register long local_reg = 7;
static unsigned long local_static, local_static_sizeof;
long local_long;
unsigned long *stack_ptr;
unsigned long end_of_stack;
ridiculously_long_variable_name_with_equally_long_string_assignment =
"ridiculously long variable name with equally long string assignment";
local_static = 9;
local_static_sizeof = sizeof (struct GDB_STRUCT_TEST);
local_long = local_reg + 1;
stack_ptr = (unsigned long *) &local_long;
end_of_stack =
(unsigned long) &stack_ptr + sizeof(stack_ptr) + sizeof(end_of_stack) - 1;
gdb_char_test = gdb_struct1_test.c = (char) ((long) parm[1] & 0xff);
gdb_short_test = gdb_struct1_test.s = (short) ((long) parm[2] & 0xffff);
gdb_long_test = gdb_struct1_test.l = (long) ((long) parm[3] & 0xffffffff);
gdb_union1_test.l = (long) parm[4];
gdb_arr_test[0] = gdb_struct1_test.arr[0] = (char) ((long) parm[1] & 0xff);
gdb_arr_test[1] = gdb_struct1_test.arr[1] = (char) ((long) parm[2] & 0xff);
gdb_arr_test[2] = gdb_struct1_test.arr[2] = (char) ((long) parm[3] & 0xff);
gdb_arr_test[3] = gdb_struct1_test.arr[3] = (char) ((long) parm[4] & 0xff);
gdb_arr_test[4] = gdb_struct1_test.arr[4] = (char) ((long) parm[5] & 0xff);
gdb_arr_test[5] = gdb_struct1_test.arr[5] = (char) ((long) parm[6] & 0xff);
gdb_struct1_test.bfield = 144;
gdb_struct1_test.next = &gdb_struct2_test;
gdb_structp_test = &gdb_struct1_test;
gdb_structpp_test = &gdb_structp_test;
gdb_recursion_test (3, (long) parm[1], (long) parm[2], (long) parm[3],
(long) parm[4], (long) parm[5], (long) parm[6]);
gdb_char_test = gdb_short_test = gdb_long_test = 0;
gdb_structp_test = (void *) 0;
gdb_structpp_test = (void *) 0;
memset ((char *) &gdb_struct1_test, 0, sizeof (gdb_struct1_test));
memset ((char *) &gdb_struct2_test, 0, sizeof (gdb_struct2_test));
local_static_sizeof = 0;
local_static = 0;
return ( (unsigned long) 0 );
}
static void gdb_asm_test (void)
{
}
static void begin () /* called before anything else */
{
}
static void end () /* called after everything else */
{
}
int
main (argc, argv, envp)
int argc;
char *argv[], **envp;
{
int i;
unsigned long myparms[10];
#ifdef usestubs
set_debug_traps ();
breakpoint ();
#endif
begin ();
for (i = 0; i < sizeof (myparms) / sizeof (myparms[0]); i++)
myparms[i] = i;
gdb_c_test (&myparms[0]);
end ();
return 0;
}