Skip to content

Commit 9b00242

Browse files
committed
Make protocol spec mandatory in orbtop when source is set
1 parent 4a13f87 commit 9b00242

5 files changed

Lines changed: 22 additions & 16 deletions

File tree

.github/workflows/build-osx.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ on:
66

77
jobs:
88
osx:
9-
runs-on: macos-12
9+
runs-on: macos-14
1010
steps:
11+
- run: python3 -m pip config set global.break-system-packages true
1112
- run: brew install zmq sdl2 libelf
1213
- run: pip3 install meson
1314
- run: pip3 install ninja

Inc/generics.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ extern "C" {
2020
#endif
2121

2222
/* Error return codes .. may already be defined by ncurses */
23+
typedef int errcode;
2324
#ifndef OK
2425
#define OK 0
2526
#endif

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,8 @@ line for orbtop would be;
737737

738738
One useful command line option for orbtop (and indeed, for the majority of the rest of the
739739
suite) is `-s localhost:2332`, which will connect directly to any source you might have exporting
740-
SWO data on its TCP its port, with no requirement for the orbuculum multiplexer in the way.
740+
SWO data on its TCP its port, with no requirement for the orbuculum multiplexer in the way. If
741+
you set the source explicitly, you also need to set the protocol explicitly using `-p`.
741742

742743
Command line options for orbtop are;
743744

@@ -769,6 +770,10 @@ Command line options for orbtop are;
769770

770771
`-O, --objdump-opts [opts]`: Set options to pass directly to objdump
771772

773+
`-p, --protocol [OFLOW|ITM]`: Protocol to communicate. Must be set explicitly if -s is set
774+
775+
`-P, --pace <microseconds>`: Delay in block of data transmission to clients
776+
772777
`-r, --routines <routines>`: Number of lines to record in history file
773778

774779
`-R, --report-file [filename]`: Report filenames as part of function discriminator

Src/orbtop.c

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,7 @@ static struct option _longOptions[] =
953953
{NULL, no_argument, NULL, 0}
954954
};
955955
// ====================================================================================================
956-
bool _processOptions( int argc, char *argv[] )
956+
errcode _processOptions( int argc, char *argv[] )
957957

958958
{
959959
int c, optionIndex = 0;
@@ -1053,7 +1053,7 @@ bool _processOptions( int argc, char *argv[] )
10531053
if ( options.protocol == PROT_UNKNOWN )
10541054
{
10551055
genericsReport( V_ERROR, "Unrecognised protocol type" EOL );
1056-
return false;
1056+
return ERR;
10571057
}
10581058

10591059
break;
@@ -1066,7 +1066,7 @@ bool _processOptions( int argc, char *argv[] )
10661066
if ( options.paceDelay <= 0 )
10671067
{
10681068
genericsReport( V_ERROR, "paceDelay is out of range" EOL );
1069-
return false;
1069+
return ERR;
10701070
}
10711071

10721072
break;
@@ -1082,7 +1082,7 @@ bool _processOptions( int argc, char *argv[] )
10821082
if ( !isdigit( *optarg ) )
10831083
{
10841084
genericsReport( V_ERROR, "-v requires a numeric argument." EOL );
1085-
return false;
1085+
return ERR;
10861086
}
10871087

10881088
genericsSetReportLevel( atoi( optarg ) );
@@ -1132,7 +1132,7 @@ bool _processOptions( int argc, char *argv[] )
11321132
// ------------------------------------
11331133
case 'V':
11341134
_printVersion();
1135-
return -EINVAL;
1135+
return ERR;
11361136

11371137
// ------------------------------------
11381138
case '?':
@@ -1145,25 +1145,26 @@ bool _processOptions( int argc, char *argv[] )
11451145
genericsReport( V_ERROR, "Unknown option character `\\x%x'." EOL, optopt );
11461146
}
11471147

1148-
return -EINVAL;
1148+
return ERR;
11491149

11501150
// ------------------------------------
11511151
default:
11521152
genericsReport( V_ERROR, "Unknown option %c" EOL, optopt );
1153-
return -EINVAL;
1153+
return ERR;
11541154
// ------------------------------------
11551155
}
11561156

11571157
/* If we set an explicit server and port and didn't set a protocol chances are we want ITM, not OFLOW */
11581158
if ( serverExplicit && !protExplicit )
11591159
{
1160-
options.protocol = PROT_ITM;
1160+
genericsReport( V_ERROR, "Protocol must be explicit when server is explicit" EOL );
1161+
return ERR;
11611162
}
11621163

11631164
if ( !options.elffile )
11641165
{
11651166
genericsReport( V_ERROR, "Elf File not specified" EOL );
1166-
exit( -EBADF );
1167+
return ERR;
11671168
}
11681169

11691170
genericsReport( V_INFO, "orbtop version " GIT_DESCRIBE EOL );
@@ -1197,14 +1198,14 @@ bool _processOptions( int argc, char *argv[] )
11971198
break;
11981199

11991200
default:
1200-
genericsReport( V_INFO, "Decoding unknown" EOL );
1201-
return false;
1201+
genericsReport( V_ERROR, "Decoding unknown" EOL );
1202+
return ERR;
12021203
}
12031204

12041205
if ( ( options.paceDelay ) && ( !options.file ) )
12051206
{
12061207
genericsReport( V_ERROR, "Pace Delay only makes sense when input is from a file" EOL );
1207-
return false;
1208+
return ERR;
12081209
}
12091210

12101211
return OK;

Src/symbols.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -950,8 +950,6 @@ bool SymbolLookup( struct SymbolSet *s, uint32_t addr, struct nameEntry *n )
950950
return true;
951951
}
952952

953-
954-
printf("%08x ",addr);
955953
n->fileindex = n->functionindex = n->line = 0;
956954
n->source = "";
957955
n->assy = NULL;

0 commit comments

Comments
 (0)