From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1569 invoked by alias); 22 Nov 2002 19:10:22 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 1553 invoked from network); 22 Nov 2002 19:10:22 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 22 Nov 2002 19:10:22 -0000 Received: from int-mx2.corp.redhat.com (nat-pool-rdu-dmz.redhat.com [172.16.52.200]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id gAMIkGP00586; Fri, 22 Nov 2002 13:46:16 -0500 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx2.corp.redhat.com (8.11.6/8.11.6) with ESMTP id gAMJAJs12382; Fri, 22 Nov 2002 14:10:20 -0500 Received: from redhat.com (reddwarf.sfbay.redhat.com [172.16.24.50]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id gAMJAJM24965; Fri, 22 Nov 2002 11:10:19 -0800 Message-ID: <3DDE811B.BD6AD364@redhat.com> Date: Fri, 22 Nov 2002 11:10:00 -0000 From: Michael Snyder Organization: Red Hat, Inc. X-Accept-Language: en MIME-Version: 1.0 To: gdb@sources.redhat.com CC: gdb-patches@sources.redhat.com Subject: Proposed enhancement to RDA, the remote debug agent Content-Type: multipart/mixed; boundary="------------1C5831C351E20B85988671BA" X-SW-Source: 2002-11/txt/msg00553.txt.bz2 This is a multi-part message in MIME format. --------------1C5831C351E20B85988671BA Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-length: 898 Hello, I'm looking for feedback, mostly on my infrastructure approach for the following addition to RDA. In one sentence, I'm going to add introspect support. The diff below probably won't apply cleanly, but will convey the sense of my proposed first-step. Basically, I'll add a new subdirectory rda/introspect, and tweak the top-level rda makefile and configure to include it. I'll make the top-level remote protocol parser recognize the 'Q' and 'q' msgs that implement introspect, and have it call functions that do all the work. Then I'll implement two separate libraries in the introspect directory -- one that simply provides empty stubs to satisfy those calls (for targets that don't implement introspect), and a second that actually implements introspect. The first check-in will include only the dummy library. Anybody suggest any improvements to this approach? Thanks, Michael --------------1C5831C351E20B85988671BA Content-Type: text/plain; charset=us-ascii; name="introspect.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="introspect.diff" Content-length: 16216 diff -rpN rda/Makefile.am rda.snap1/Makefile.am *** rda/Makefile.am Tue Aug 27 18:22:27 2002 --- rda.snap1/Makefile.am Wed Nov 20 11:51:32 2002 *************** WERROR_CFLAGS = @WERROR_CFLAGS@ *** 7,11 **** AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) APPL_DIRS = @targ_subdirs@ ! SUBDIRS = lib samples qe $(APPL_DIRS) --- 7,11 ---- AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) APPL_DIRS = @targ_subdirs@ ! SUBDIRS = lib introspect samples qe $(APPL_DIRS) diff -rpN rda/Makefile.in rda.snap1/Makefile.in *** rda/Makefile.in Mon Nov 4 10:48:56 2002 --- rda.snap1/Makefile.in Wed Nov 20 11:51:59 2002 *************** AUTOMAKE_OPTIONS = foreign *** 119,125 **** AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) APPL_DIRS = @targ_subdirs@ ! SUBDIRS = lib samples qe $(APPL_DIRS) subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs --- 119,125 ---- AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) APPL_DIRS = @targ_subdirs@ ! SUBDIRS = lib introspect samples qe $(APPL_DIRS) subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs diff -rpN rda/configure rda.snap1/configure *** rda/configure Mon Nov 4 10:48:56 2002 --- rda.snap1/configure Wed Nov 20 12:17:17 2002 *************** targ_subdirs= *** 4723,4729 **** case "$target" in ! *linux*) targ_subdirs="$targ_subdirs unix" ;; esac --- 4723,4729 ---- case "$target" in ! *linux*) targ_subdirs="$targ_subdirs introspect unix" ;; esac *************** echo "${ECHO_T}found xgettext programs i *** 5448,5454 **** ! ac_config_files="$ac_config_files Makefile lib/Makefile samples/Makefile qe/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure --- 5448,5454 ---- ! ac_config_files="$ac_config_files Makefile lib/Makefile samples/Makefile qe/Makefile introspect/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure *************** do *** 5948,5953 **** --- 5948,5954 ---- "lib/Makefile" ) CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; "samples/Makefile" ) CONFIG_FILES="$CONFIG_FILES samples/Makefile" ;; "qe/Makefile" ) CONFIG_FILES="$CONFIG_FILES qe/Makefile" ;; + "introspect/Makefile" ) CONFIG_FILES="$CONFIG_FILES introspect/Makefile" ;; "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h:config.in" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 diff -rpN rda/configure.in rda.snap1/configure.in *** rda/configure.in Tue Aug 27 18:22:27 2002 --- rda.snap1/configure.in Wed Nov 20 12:17:05 2002 *************** targ_subdirs= *** 90,96 **** case "$target" in ! *linux*) targ_subdirs="$targ_subdirs unix" ;; esac --- 90,96 ---- case "$target" in ! *linux*) targ_subdirs="$targ_subdirs introspect unix" ;; esac *************** AC_SUBST(targ_subdirs) *** 104,107 **** CY_WITH_NLS dnl Outputs ! AC_OUTPUT(Makefile lib/Makefile samples/Makefile qe/Makefile) --- 104,107 ---- CY_WITH_NLS dnl Outputs ! AC_OUTPUT(Makefile lib/Makefile samples/Makefile qe/Makefile introspect/Makefile) diff -rpN rda/include/gdbtrace.h rda.snap1/include/gdbtrace.h *** rda/include/gdbtrace.h Wed Dec 31 16:00:00 1969 --- rda.snap1/include/gdbtrace.h Wed Nov 20 17:05:32 2002 *************** *** 0 **** --- 1,38 ---- + /* trace-dummy.c + + Copyright 2000, 2001, 2002 Red Hat, Inc. + + This file is part of RDA, the Red Hat Debug Agent (and library). + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + + Alternative licenses for RDA may be arranged by contacting Red Hat, + Inc. */ + + /* + * Global interface to introspect trace agent. + */ + + extern void gdbtrace_status_query (struct gdbserv *); + extern void gdbtrace_limit_query (struct gdbserv *); + extern void gdbtrace_buffer_query (struct gdbserv *); + extern void gdbtrace_init (struct gdbserv *); + extern void gdbtrace_start (struct gdbserv *); + extern void gdbtrace_stop (struct gdbserv *); + extern void gdbtracepoint_define (struct gdbserv *); + extern void gdbtrace_frame_select (struct gdbserv *); + extern void gdbtrace_limit_set (struct gdbserv *); + extern void gdbtrace_buffer_set (struct gdbserv *); diff -rpN rda/introspect/ChangeLog rda.snap1/introspect/ChangeLog *** rda/introspect/ChangeLog Wed Dec 31 16:00:00 1969 --- rda.snap1/introspect/ChangeLog Tue Nov 19 17:02:03 2002 *************** *** 0 **** --- 1,14 ---- + 2002-11-19 Michael Snyder + + New directory "introspect" for introspect target tracing. + * trace-dummy.c: New file. Stubs for targets that + do not implement introspect trace. + * configure.in: New file, autoconf source. + * config.in: New file. Not generated by autoheader. + * aclocal.m4: New file. Not generated by aclocal. + * Makefile.am: New file, automake source. + * Makefile.in: New file, generated by automake. + * configure: New file, generated by autoconf. + + + diff -rpN rda/introspect/Makefile.am rda.snap1/introspect/Makefile.am *** rda/introspect/Makefile.am Wed Dec 31 16:00:00 1969 --- rda.snap1/introspect/Makefile.am Wed Nov 20 11:56:28 2002 *************** *** 0 **** --- 1,14 ---- + ## Process this with automake to create Makefile.in + + AUTOMAKE_OPTIONS = foreign + + # Create a libtool convenience archive + # ... and a plain library archive for non-libtool clients + noinst_LTLIBRARIES = libtrace_d.la + noinst_LIBRARIES = libtrace_d.a + + INCLUDES = -I$(srcdir) -I$(srcdir)/../include + + trace_SOURCES = trace-dummy.c + libtrace_d_la_SOURCES =$(trace_SOURCES) + libtrace_d_a_SOURCES =$(trace_SOURCES) diff -rpN rda/introspect/configure.in rda.snap1/introspect/configure.in *** rda/introspect/configure.in Wed Dec 31 16:00:00 1969 --- rda.snap1/introspect/configure.in Tue Nov 19 17:11:27 2002 *************** *** 0 **** --- 1,17 ---- + dnl Process this file with autoconf to produce a configure script. + AC_INIT(trace-dummy.c) + AC_CANONICAL_SYSTEM + AM_INIT_AUTOMAKE(rda,0.1) + AM_CONFIG_HEADER(config.h:config.in) + + dnl automake support + AM_MAINTAINER_MODE + AM_PROG_LIBTOOL + AC_EXEEXT + AC_LANG_C + + dnl headers + AC_CHECK_HEADERS(errno.h) + + dnl Outputs + AC_OUTPUT(Makefile) diff -rpN rda/introspect/trace-dummy.c rda.snap1/introspect/trace-dummy.c *** rda/introspect/trace-dummy.c Wed Dec 31 16:00:00 1969 --- rda.snap1/introspect/trace-dummy.c Wed Nov 20 17:07:47 2002 *************** *** 0 **** --- 1,92 ---- + /* trace-dummy.c + + Copyright 2002 Red Hat, Inc. + + This file is part of RDA, the Red Hat Debug Agent (and library). + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + + Alternative licenses for RDA may be arranged by contacting Red Hat, + Inc. */ + + /* + * Provide dummy stub functions for + * instances of RDA that do not implement introspect trace agent. + */ + + #include "gdbserv.h" + #include "gdbtrace.h" + + extern void + gdbtrace_status_query (struct gdbserv *not_used) + { + return; + } + + extern void + gdbtrace_limit_query (struct gdbserv *not_used) + { + return; + } + + extern void + gdbtrace_buffer_query (struct gdbserv *not_used) + { + return; + } + + extern void + gdbtrace_init (struct gdbserv *not_used) + { + return; + } + + extern void + gdbtrace_start (struct gdbserv *not_used) + { + return; + } + + extern void + gdbtrace_stop (struct gdbserv *not_used) + { + return; + } + + extern void + gdbtracepoint_define (struct gdbserv *not_used) + { + return; + } + + extern void + gdbtrace_frame_select (struct gdbserv *not_used) + { + return; + } + + extern void + gdbtrace_limit_set (struct gdbserv *not_used) + { + return; + } + + extern void + gdbtrace_buffer_set (struct gdbserv *not_used) + { + return; + } + diff -rpN rda/lib/gdbserv-state.c rda.snap1/lib/gdbserv-state.c *** rda/lib/gdbserv-state.c Tue Aug 27 18:22:28 2002 --- rda.snap1/lib/gdbserv-state.c Wed Nov 20 17:07:08 2002 *************** *** 32,37 **** --- 32,38 ---- #include "gdbserv-utils.h" #include "gdblog.h" #include "gdbserv-log.h" + #include "gdbtrace.h" static int output_thread_reg (struct gdbserv *gdbserv, struct gdbserv_thread *thread, *************** gdbserv_data_packet (struct gdbserv *gdb *** 685,690 **** --- 686,692 ---- gdbserv->target->process_rcmd (gdbserv, cmd, sizeof_cmd); } } + /* FIXME: add CRC: */ else if (gdbserv_input_string_match (gdbserv, "C") >= 0) { do_current_thread_query (gdbserv); *************** gdbserv_data_packet (struct gdbserv *gdb *** 701,706 **** --- 703,720 ---- { do_thread_extra_info_query (gdbserv); } + else if (gdbserv_input_string_match (gdbserv, "TStatus") >= 0) + { + gdbtrace_status_query (gdbserv); + } + else if (gdbserv_input_string_match (gdbserv, "TLimit:") >= 0) + { + gdbtrace_limit_query (gdbserv); + } + else if (gdbserv_input_string_match (gdbserv, "TBuffer:") >= 0) + { + gdbtrace_buffer_query (gdbserv); + } else if (gdbserv->target->process_get_gen) { gdbserv->target->process_get_gen (gdbserv); *************** gdbserv_data_packet (struct gdbserv *gdb *** 713,719 **** break; case 'Q': /* general set packet */ ! if (gdbserv->target->process_set_gen) gdbserv->target->process_set_gen (gdbserv); else { --- 727,761 ---- break; case 'Q': /* general set packet */ ! if (gdbserv_input_string_match (gdbserv, "Tinit") >= 0) ! { ! gdbtrace_init (gdbserv); ! } ! else if (gdbserv_input_string_match (gdbserv, "TStart") >= 0) ! { ! gdbtrace_start (gdbserv); ! } ! else if (gdbserv_input_string_match (gdbserv, "Tstop") >= 0) ! { ! gdbtrace_stop (gdbserv); ! } ! else if (gdbserv_input_string_match (gdbserv, "TDP:") >= 0) ! { ! do_tracepoint_define (gdbserv); ! } ! else if (gdbserv_input_string_match (gdbserv, "TFrame:") >= 0) ! { ! gdbtrace_frame_select (gdbserv); ! } ! else if (gdbserv_input_string_match (gdbserv, "TLimit:") >= 0) ! { ! gdbtrace_limit_set (gdbserv); ! } ! else if (gdbserv_input_string_match (gdbserv, "TBuffer:") >= 0) ! { ! gdbtrace_buffer_set (gdbserv); ! } ! else if (gdbserv->target->process_set_gen) gdbserv->target->process_set_gen (gdbserv); else { diff -rpN rda/samples/Makefile.am rda.snap1/samples/Makefile.am *** rda/samples/Makefile.am Tue Aug 27 18:22:28 2002 --- rda.snap1/samples/Makefile.am Wed Nov 20 12:27:33 2002 *************** INCLUDES = -I$(srcdir) -I$(srcdir)/../in *** 12,25 **** sample_SOURCES = main.c demo-target.c sample_DEPLIBS = ../lib/librda.la ! sample_LDADD = $(sample_DEPLIBS) $(INTLLIBS) sample_DEPENDENCIES = $(sample_DEPLIBS) $(INTLDEPS) async_SOURCES = async.c demo-target.c ! async_LDADD = ../lib/librda.la poll_SOURCES = poll.c demo-target.c ! poll_LDADD = ../lib/librda.la thread_SOURCES = thread.c demo-target.c ! thread_LDADD = ../lib/librda.la --- 12,25 ---- sample_SOURCES = main.c demo-target.c sample_DEPLIBS = ../lib/librda.la ! sample_LDADD = $(sample_DEPLIBS) $(INTLLIBS) ../introspect/libtrace_d.la sample_DEPENDENCIES = $(sample_DEPLIBS) $(INTLDEPS) async_SOURCES = async.c demo-target.c ! async_LDADD = ../lib/librda.la ../introspect/libtrace_d.la poll_SOURCES = poll.c demo-target.c ! poll_LDADD = ../lib/librda.la ../introspect/libtrace_d.la thread_SOURCES = thread.c demo-target.c ! thread_LDADD = ../lib/librda.la ../introspect/libtrace_d.la diff -rpN rda/samples/Makefile.in rda.snap1/samples/Makefile.in *** rda/samples/Makefile.in Mon Nov 4 10:48:57 2002 --- rda.snap1/samples/Makefile.in Wed Nov 20 12:27:24 2002 *************** INCLUDES = -I$(srcdir) -I$(srcdir)/../in *** 124,140 **** sample_SOURCES = main.c demo-target.c sample_DEPLIBS = ../lib/librda.la ! sample_LDADD = $(sample_DEPLIBS) $(INTLLIBS) sample_DEPENDENCIES = $(sample_DEPLIBS) $(INTLDEPS) async_SOURCES = async.c demo-target.c ! async_LDADD = ../lib/librda.la poll_SOURCES = poll.c demo-target.c ! poll_LDADD = ../lib/librda.la thread_SOURCES = thread.c demo-target.c ! thread_LDADD = ../lib/librda.la subdir = samples mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h --- 124,140 ---- sample_SOURCES = main.c demo-target.c sample_DEPLIBS = ../lib/librda.la ! sample_LDADD = $(sample_DEPLIBS) $(INTLLIBS) ../introspect/libtrace_d.la sample_DEPENDENCIES = $(sample_DEPLIBS) $(INTLDEPS) async_SOURCES = async.c demo-target.c ! async_LDADD = ../lib/librda.la ../introspect/libtrace_d.la poll_SOURCES = poll.c demo-target.c ! poll_LDADD = ../lib/librda.la ../introspect/libtrace_d.la thread_SOURCES = thread.c demo-target.c ! thread_LDADD = ../lib/librda.la ../introspect/libtrace_d.la subdir = samples mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h diff -rpN rda/unix/Makefile.am rda.snap1/unix/Makefile.am *** rda/unix/Makefile.am Tue Aug 27 18:22:28 2002 --- rda.snap1/unix/Makefile.am Wed Nov 20 12:19:07 2002 *************** rda_SOURCES = server.c *** 10,15 **** EXTRA_rda_SOURCES = linux-target.c solaris-target.c \ ptrace-target.c dummy-target.c TARGET_MODULES = @TARGET_MODULES@ ! rda_LDADD = $(TARGET_MODULES) ../lib/librda.la rda_DEPENDENCIES = $(server_OBJECTS) $(TARGET_MODULES) rda_LDFLAGS = -ldl -rdynamic --- 10,15 ---- EXTRA_rda_SOURCES = linux-target.c solaris-target.c \ ptrace-target.c dummy-target.c TARGET_MODULES = @TARGET_MODULES@ ! rda_LDADD = $(TARGET_MODULES) ../lib/librda.la ../introspect/libtrace_d.la rda_DEPENDENCIES = $(server_OBJECTS) $(TARGET_MODULES) rda_LDFLAGS = -ldl -rdynamic diff -rpN rda/unix/Makefile.in rda.snap1/unix/Makefile.in *** rda/unix/Makefile.in Tue Aug 27 18:22:28 2002 --- rda.snap1/unix/Makefile.in Wed Nov 20 12:19:03 2002 *************** EXTRA_rda_SOURCES = linux-target.c solar *** 87,93 **** ptrace-target.c dummy-target.c TARGET_MODULES = @TARGET_MODULES@ ! rda_LDADD = $(TARGET_MODULES) ../lib/librda.la rda_DEPENDENCIES = $(server_OBJECTS) $(TARGET_MODULES) rda_LDFLAGS = -ldl -rdynamic ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 --- 87,93 ---- ptrace-target.c dummy-target.c TARGET_MODULES = @TARGET_MODULES@ ! rda_LDADD = $(TARGET_MODULES) ../lib/librda.la ../introspect/libtrace_d.la rda_DEPENDENCIES = $(server_OBJECTS) $(TARGET_MODULES) rda_LDFLAGS = -ldl -rdynamic ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 --------------1C5831C351E20B85988671BA--