1

I am trying to debug (gdb, 8.1.1) the code which is written in Veins (4.7). To do that I use the OMNeT++ IDE (MacOS) and its debug option. However, the Omnet generates me an error "Errors within Debug UI"

Error within Debug UI: 
java.lang.reflect.InvocationTargetException

I checked Google but up to now not successful to solve this problem. Any suggestion is appreciated.

Regards.

kingspeech
  • 1,776
  • 2
  • 14
  • 24
  • Have you tried debugging your simulation via the command line (either using gdb or lldb). Maybe this can help track down the error. – Christoph Sommer Feb 07 '19 at 15:27
  • @ChristophSommer could you please direct me how to run veins simulation with gdb command line support? I go to examples/veins folder and run opp_run -r 0 -m -u Cmdenv -n .:../../src/veins --image-path=../../images -l ../../src/veins omnetpp.ini. However, the "opp_run command not found" message is generated. Any link and/or tutorial is appreciated. Thanks. – kingspeech May 08 '19 at 19:20
  • How to do this will depend on your platform (i.e., are you running OMNeT++ natively on Windows, Mac, Linux, are you using Instant Veins, ...) and on how you opened the command line (clicking on something in a menu, running a script, ...) – Christoph Sommer May 09 '19 at 06:03
  • @ChristophSommer I am using Omnet++ and running codes on Linux. I just open a new terminal and go to examples/veins folder and run the Omnet++ generated opp_run command on that folder (as Omnet++ console shows). Thanks. – kingspeech May 09 '19 at 16:52
  • @ChristophSommer I just correct now and I can run omnetpp and opp_run on the console (path and source ~/.bashrc problem). I am using Mac to run the codes. Could you please now direct me to run the gdb from the console? Thanks for your directives. – kingspeech May 09 '19 at 21:17
  • 1
    @ChristophSommer Sorry for the confusion. My bad. I am using Mac and I want to debug my code. However, from Omnet++ when I right click the omnet.ini file and Debug As the Omnet generates the message "Error within Debug UI..". So, based on your suggestion, I want to debug from the console (not from Omnet++). I open the terminal just searching the Terminal from MacOS and go to examples/veins folder. There, I run opp_run now. So I want to wrap the opp_run command with gdb to further debug my code. Thanks for your help. – kingspeech May 10 '19 at 15:59

2 Answers2

0

Debugging with gdb on macOS has been problematic for a while now. This guide might help you getting it to work: https://1.ieee802.org/protocol-simulations/omnet-installation-hints-for-mac-os/

Attila
  • 1,445
  • 1
  • 11
  • 21
  • 1
    Thanks for your message. I follow the instructions but the error is still the same. I think the error is related with omnet GUI related components. Thanks for your message again. – kingspeech Feb 06 '19 at 18:12
0

If you want to give debugging on the command line a shot, run the simulation in the IDE and take note of the command it uses for launching the simulation (for example "opp_run_dbg -l../../src/veins...-u Cmdenv").

On Mac OS X, debugging is best done in lldb (using gdb on a Mac, as the other comment noted, is a bit complicated). Open a terminal and install lldb (see here for a brief description). Then prefix the command for launching the simulation with the words lldb and -- (for example, "lldb -- opp_run_dbg -l../../src/veins...-u Cmdenv").

On the lldb prompt, type process launch to run the simulation.

You can find a quick reference of lldb commands (also noting equivalent gdb commands) here.

Christoph Sommer
  • 6,893
  • 1
  • 17
  • 35