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.

argv gets mangled with cadence xcelium

See original GitHub issue

I see that ARGV gets mangled when using excelium. cocotb crashes, complaining about invalid utf8 characters. The curious thing is: it only happens to the argument after the -f switch. I have modified VpiStartupCbHdl::run_callback() in VpiCbHdl.cpp to print info.argv and when i have

xrun -v93 -f xrun_files_cmd -timescale 1ns/1ps -licqueue ...

out comes: xrun -v93 -f ��� -timescale 1ns/1ps -licqueue ... If I move the -f option around, the filename stays mangled. If I have multiple -f options, i get multiple garbled filenames. All other options go through fine.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
eric-wiesercommented, May 1, 2020

Under my proposal, argv[n] == fname, argv[n].argv = ['flags', 'in', 'file'], recursively if needed

1reaction
marlonjamescommented, May 6, 2020

I think I found the answer to this.

From the 2001 standard:

The argument following a -f argument shall contain a pointer to a NULL terminated array of pointers to characters. This new array shall contain the parsed contents of the file. The value in entry zero shall contain the name of the file. The remaining entries shall contain pointers to NULL terminated character arrays containing the different options in the file. The last entry in this array shall be a NULL. If one of the options is a -f then the next pointer shall behave the same as described above.

From the 2005 standard (worded slightly differently):

The vendor tool may provide a command-line option to pass a file containing a set of options. In that case, the argument strings returned by vpi_get_vlog_info() shall contain the vendor option string name followed by a pointer to a NULL-terminated array of pointers to characters. This new array shall contain the parsed contents of the file. The value in entry zero shall contain the name of the file. The remaining entries shall contain pointers to NULL-terminated character arrays containing the different options in the file. The last entry in this array shall be NULL. If one of the options is the vendor file option, then the next pointer shall behave the same as described above.

So the number is a pointer to an array of pointers, each one of those a pointer to a string. Looks like 2001 indicates a -f option, but 2005 allows for other options.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Aargh!!! How Can I Read Arguments from the Command ...
Let's take as an example a user who would like to pass the name of a file which includes input parameters to the...
Read more >
A Digital Design Flow - From Concept to RTL Description, ...
To verify the code, Cadence's Xcelium will be used together with Mathworks' HDL Verification toolbox to simulate the produced code using.
Read more >
GLS | PDF | Hardware Description Language | Simulation
resolutions to the issues using the Cadence Xcelium simulator. Audience ... takes time, and is much slower than zero delay or unit delay...
Read more >
Verilator
This script takes the version number, and all remaining arguments are passed ... Mentor Questa/ModelSim (tm), Cadence Xcelium/Incisive/NC-.
Read more >
PC & Laptop - Cadence XCELIUM version 19.09.001
Cadence XCELIUM version 19.09.001 | 8.6 Gb Updated: Reupload due ... 2066940 CORE_COVERAGE Getting issue in dumping code coverage data base.
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