Skip to content

Commit

Permalink
Make protocol spec mandatory in orbtop when source is set
Browse files Browse the repository at this point in the history
  • Loading branch information
mubes committed Dec 23, 2024
1 parent 4a13f87 commit 139a2e0
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 16 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build-osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ on:

jobs:
osx:
runs-on: macos-12
runs-on: macos-14
steps:
- run: rm /usr/lib/python3.11/EXTERNALLY-MANAGED
- run: brew install zmq sdl2 libelf
- run: pip3 install meson
- run: pip3 install ninja
Expand Down
1 change: 1 addition & 0 deletions Inc/generics.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ extern "C" {
#endif

/* Error return codes .. may already be defined by ncurses */
typedef int errcode;
#ifndef OK
#define OK 0
#endif
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,8 @@ line for orbtop would be;

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

Command line options for orbtop are;

Expand Down Expand Up @@ -769,6 +770,10 @@ Command line options for orbtop are;

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

`-p, --protocol [OFLOW|ITM]`: Protocol to communicate. Must be set explicitly if -s is set

`-P, --pace <microseconds>`: Delay in block of data transmission to clients

`-r, --routines <routines>`: Number of lines to record in history file

`-R, --report-file [filename]`: Report filenames as part of function discriminator
Expand Down
25 changes: 13 additions & 12 deletions Src/orbtop.c
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,7 @@ static struct option _longOptions[] =
{NULL, no_argument, NULL, 0}
};
// ====================================================================================================
bool _processOptions( int argc, char *argv[] )
errcode _processOptions( int argc, char *argv[] )

{
int c, optionIndex = 0;
Expand Down Expand Up @@ -1053,7 +1053,7 @@ bool _processOptions( int argc, char *argv[] )
if ( options.protocol == PROT_UNKNOWN )
{
genericsReport( V_ERROR, "Unrecognised protocol type" EOL );
return false;
return ERR;
}

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

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

genericsSetReportLevel( atoi( optarg ) );
Expand Down Expand Up @@ -1132,7 +1132,7 @@ bool _processOptions( int argc, char *argv[] )
// ------------------------------------
case 'V':
_printVersion();
return -EINVAL;
return ERR;

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

return -EINVAL;
return ERR;

// ------------------------------------
default:
genericsReport( V_ERROR, "Unknown option %c" EOL, optopt );
return -EINVAL;
return ERR;
// ------------------------------------
}

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

if ( !options.elffile )
{
genericsReport( V_ERROR, "Elf File not specified" EOL );
exit( -EBADF );
return ERR;
}

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

default:
genericsReport( V_INFO, "Decoding unknown" EOL );
return false;
genericsReport( V_ERROR, "Decoding unknown" EOL );
return ERR;
}

if ( ( options.paceDelay ) && ( !options.file ) )
{
genericsReport( V_ERROR, "Pace Delay only makes sense when input is from a file" EOL );
return false;
return ERR;
}

return OK;
Expand Down
2 changes: 0 additions & 2 deletions Src/symbols.c
Original file line number Diff line number Diff line change
Expand Up @@ -950,8 +950,6 @@ bool SymbolLookup( struct SymbolSet *s, uint32_t addr, struct nameEntry *n )
return true;
}


printf("%08x ",addr);
n->fileindex = n->functionindex = n->line = 0;
n->source = "";
n->assy = NULL;
Expand Down

0 comments on commit 139a2e0

Please sign in to comment.