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.

System-call implementations do not handle format values

See original GitHub issue

We’ve overloaded $error etc to allow us to provide a consistent logging mechanism.

Unfortunately this implementation doesn’t handle format values appropriately.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
eric-wiesercommented, Aug 24, 2019

We might have to port the extremely heavyweight implementation of get_display from iverilog:

https://github.com/steveicarus/iverilog/blob/9d0d1938dc66b715b1ac6693913a9e79d3cb401c/vpi/sys_display.c#L960-L1137

@pgfarley I think your last point is a non-issue, it can be solved with code like:

// this doesn't use C varargs, but VPI iteration
char *str = format_using_verilog_semantics(args_from_vpi);

// no formatting or varargs needed here
gpi_log(..., "%s", str);

free(str);
1reaction
pgfarleycommented, Dec 12, 2018

It looks to me like this is unfortunately going to be a more involved fix than handling the arguments over to vasprintf .

Issues:

  • verilog $display type functions support verilog specific format characters like %m (hierarchical name) and and %T (simulation time).
  • As part of iterating over the vpiArgument we’ll need to do the same Verilog to C type conversion of the arguments that a simulator would have to do.
  • It’s not obvious to me how we can get the runtime iterated arguments into va_list to hand off for formatting.

So I think we’ll need to implement the string interpolation/formatting ourselves similar to what a simulator would do if it were handling the call to $info, $error, etc.

I can work on this but, as it’s a non trivial amount of new code, I wanted to run it by the list to see if anyone had a better idea.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CS 45 — Lab 2: Implementing System Calls
If your attempt to test a system call tells you "Function not implemented", it means the OS doesn't know of any system call...
Read more >
2.4. System Call Interface — Computer Systems Fundamentals
system call, which expects three arguments: the file handle to write to, the address of the message to write, and the length of...
Read more >
System calls in the Linux kernel. Part 1. - 0xax
This system call gets only one parameter: Return value. and handles the way our program exits. We can pass the program name of...
Read more >
System call - Wikipedia
In computing, a system call (commonly abbreviated to syscall) is the programmatic way in which a computer program requests a service from the...
Read more >
What is meant by "a system call" if not the implementation in ...
System calls per se are a concept. They represent actions that processes can ask the kernel to perform. Those system calls are implemented...
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