summaryrefslogtreecommitdiff
path: root/src/console
diff options
context:
space:
mode:
authorYusuke Sato <yusuke-sato@apn.alpine.co.jp>2018-05-18 14:35:31 +0900
committerChristoph Lipka <clipka@users.noreply.github.com>2018-05-18 07:35:31 +0200
commitf549f5527148b32a15489aae75c9e4557e19cbd4 (patch)
treef6586dd95fb402bfd396b006e876c2d18dc5d38b /src/console
parent89639e55c39687af398bdf9fbaf000338a5cb7db (diff)
downloadDLT-daemon-f549f5527148b32a15489aae75c9e4557e19cbd4.tar.gz
Introduce controlling entire system trace status feature from dlt-control (#57)
* dlt-control: Provision to control entire system trace status 1. support for setting trace status using wildcards for both app and context 2. support for setting entire system trace status *This Logic is as same as for changing log level. (SHA: a966393ad7003d02870bceffa08df5ddf4bbf864 dlt-control: Provision to control entire system log level) * dlt-daemon: Fix control entire log level / trace status issue In previous, dlt-control could send request to set all log level / trace status with DLT_LOG_DEFAULT / DLT_TRACE_STATUS_DEFAULT(-1). However, dlt-daemon could not accept these value. This change fix this issue so that setting log level/trace status of all registered contexts become possible. Signed-off-by: Yusuke Sato <yusuke-sato@apn.alpine.co.jp>
Diffstat (limited to 'src/console')
-rw-r--r--src/console/dlt-control.c68
1 files changed, 50 insertions, 18 deletions
diff --git a/src/console/dlt-control.c b/src/console/dlt-control.c
index 9c309a9..7e90c7c 100644
--- a/src/console/dlt-control.c
+++ b/src/console/dlt-control.c
@@ -72,6 +72,7 @@
#define DLT_GLOGINFO_DATA_MAX 800
#define DLT_GET_LOG_INFO_HEADER 18 /*Get log info header size in response text */
#define DLT_INVALID_LOG_LEVEL 0xF
+#define DLT_INVALID_TRACE_STATUS 0xF
/* Option of GET_LOG_INFO */
#define DLT_SERVICE_GET_LOG_INFO_OPT7 7 /* get Apid, ApDescription, Ctid, CtDescription, loglevel, tracestatus */
@@ -217,7 +218,14 @@ void usage()
printf(" -l level -c xyz* (set level for all ctxts whose name starts with xyz)\n");
printf(" -l level -c ctxid (set level for the particular ctxt)\n");
printf(" -l level (set level for all the registered contexts)\n");
- printf(" -r tracestatus Set the trace status (0=off - 1=on,255=default)\n");
+ printf(" -r tracestatus Set the trace status (0=off - 1=on,255=default)\n");
+ printf(" supported options:\n");
+ printf(" -r tracestatus -a appid -c ctid\n");
+ printf(" -r tracestatus -a abc* (set status for all ctxts of apps name starts with abc)\n");
+ printf(" -r tracestatus -a appid (set status for all ctxts of this app)\n");
+ printf(" -r tracestatus -c xyz* (set status for all ctxts whose name starts with xyz)\n");
+ printf(" -r tracestatus -c ctxid (set status for the particular ctxt)\n");
+ printf(" -r tracestatus (set status for all the registered contexts)\n");
printf(" -d loglevel Set the default log level (0=off - 5=verbose)\n");
printf(" -f tracestatus Set the default trace status (0=off - 1=on)\n");
printf(" -i enable Enable timing packets (0=off - 1=on)\n");
@@ -293,7 +301,7 @@ int main(int argc, char* argv[])
dltdata.xvalue = 0;
dltdata.tvalue = 1000;
dltdata.lvalue = DLT_INVALID_LOG_LEVEL;
- dltdata.rvalue = -1;
+ dltdata.rvalue = DLT_INVALID_TRACE_STATUS;
dltdata.dvalue = -1;
dltdata.fvalue = -1;
dltdata.ivalue = -1;
@@ -384,8 +392,13 @@ int main(int argc, char* argv[])
}
case 'r':
{
- dltdata.rvalue = atoi(optarg);;
- break;
+ dltdata.rvalue = strtol(optarg, &endptr, 10);
+ if ((dltdata.rvalue < DLT_TRACE_STATUS_DEFAULT) || (dltdata.rvalue > DLT_TRACE_STATUS_ON))
+ {
+ fprintf (stderr, "invalid trace status, supported trace status -1, 0, 1\n");
+ return -1;
+ }
+ break;
}
case 'd':
{
@@ -615,22 +628,41 @@ int main(int argc, char* argv[])
}
}
}
- else if(dltdata.rvalue!=-1 && dltdata.avalue && dltdata.cvalue)
- {
- /* trace status */
- printf("Set trace status:\n");
- printf("AppId: %s\n",dltdata.avalue);
- printf("ConId: %s\n",dltdata.cvalue);
- printf("TraceStatus: %d\n",dltdata.rvalue);
- /* send control message in*/
- if (dlt_client_send_trace_status(&g_dltclient,
- dltdata.avalue,
- dltdata.cvalue,
- dltdata.rvalue) != DLT_RETURN_OK)
+ else if (dltdata.rvalue != DLT_INVALID_TRACE_STATUS)
+ {
+ if ((dltdata.avalue == 0) && (dltdata.cvalue == 0))
+ {
+ if (dltdata.vflag)
+ {
+ printf("Set all trace status:\n");
+ printf("Tracestatus: %d\n", dltdata.rvalue);
+ }
+ if (0 != dlt_client_send_all_trace_status(&g_dltclient,
+ dltdata.rvalue))
+ {
+ fprintf(stderr, "ERROR: Could not send trace status\n");
+ }
+ }
+ else
{
- fprintf(stderr, "ERROR: Could not send trace status\n");
+ /* trace status */
+ if (dltdata.vflag)
+ {
+ printf("Set trace status:\n");
+ printf("AppId: %s\n", dltdata.avalue);
+ printf("ConId: %s\n", dltdata.cvalue);
+ printf("Tracestatus: %d\n", dltdata.rvalue);
+ }
+ /* send control message*/
+ if (0 != dlt_client_send_trace_status(&g_dltclient,
+ dltdata.avalue,
+ dltdata.cvalue,
+ dltdata.rvalue))
+ {
+ fprintf(stderr, "ERROR: Could not send trace status\n");
+ }
}
- }
+ }
else if(dltdata.dvalue!=-1)
{
/* default log level */