question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Looping with First cause segmentation fault (modelsim)

See original GitHub issue

Hello,

I am writing a test-bench to parse an asynchronous signal. Among the various checks, I need to get whether the monitored signal shows a rising edge, a falling edge or simply never arrive (timeout) transition. To achieve this I used the cocotb.triggers.First method.

When I yield this method in a for loop I always get a segmentation error after the first few iterations.

I attached a simple counter test to reproduce the issue. I think it is related to the way the scheduler cleans up the not-yet-fired triggers in the First method list (I do not understand a lot of the code behind its implementation).

dummy_counter.zip

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:20 (20 by maintainers)

github_iconTop GitHub Comments

2reactions
sfavazza-duagoncommented, Feb 3, 2020

Should I ever manage to miraculously debug code in python, would it be worth to add the procedure to the Troubleshooting section of the CoCoTb guide?

1reaction
sfavazza-duagoncommented, Feb 3, 2020

Ok will make a pull request to update the guide.

Btw I managed to connect to a debugger in remote (I report the receipt for your convenience):

  1. Install remote_pdb python package
  2. In the file to be debugged define a remote breakpoint:
from remote_pdb import RemotePdb
RemotePdb('127.0.0.1', 4444).set_trace()
  1. open the simulator with GUI=1
  2. open a terminal and connect through telnet:
telnet.exe 127.0.0.1 4444

At this point you should see a pdb instance being opened.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Segmentation fault in a for loop [duplicate] - Stack Overflow
When I run gdb, it says I'm getting the segmentation fault at line 25, which is the first for loop. Edit: So I've...
Read more >
ModelSim User's Manual - Microsemi
Tcl while Loop . ... Fatal Signal Segmentation Violation (SIGSEGV) . ... The primary access point in the ModelSim GUI is called the...
Read more >
Segmentation Fault During Elaboration with ModelSim SE - Intel
If you run the ld or elab commandsin the msim_setup.tcl script for a UniPHY-based IPcore in ModelSim SE, you may encounter a segmentation...
Read more >
Identify what's causing segmentation faults (segfaults)
A segmentation fault (aka segfault) is a common condition that causes programs to crash; they are often associated with a file named core...
Read more >
ModelSim® User's Manual
Fatal Signal Segmentation Violation (SIGSEGV) . ... In order to detect the presence of these loops, ModelSim defines a limit, the “iteration limit", ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found