-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revive qemu logs - and extend the FAQ #1978
Conversation
The idea is good and I planned to do this for a while. However, the logging functionality doesn't have a switch in cmake to be enabled. Meanwhile, there is a magic environment variables designed for this:
So the logging will be only shown for developers. |
Cool - good to know :)
I am not quite sure if NDEBUG is the right approach, as we assume now that only DEBUG builds I wanted to add that to the CMakefiles, but - they are quite huge. The target_compile_definitions is the way to add that to the right target I think, so I do not want to mix up the CMAKE_CXX_FLAGS and CMAKE_C_FLAGS flags directly.
That's nice, but I prefer reading it once during instancing UC (or let it automatically be called when a log is processed). What do you think? Do we need a way to check again and again if the logging has been activated For reading it once, storing it into a static variable would be a way to go I guess. Something like: bool logging_enabled()
{
static const char* env_data = getenv("UNICORN_DEBUG");
return env_data != NULL;
} Or something, which checks the pointer and try to parse the value behind the env_data. (more complex, not needed?) Update: I see - the "getenv" approach is used at two places, which might have a huge negative impact for debug builds. If we think a little bit further, the "UNICORN_DEBUG" might have a value assigned to it (or UNICORN_DEBUG_LEVEL) which can be used to set the debug level (which is now a preprocessor constant) Update 2: I have reworked it a little bit - and removed a lot of the macro magic. |
7a56f45
to
85dd642
Compare
85dd642
to
6670841
Compare
@wtdcode Is there an easy way to execute the pipeline locally? I would not dare to ask you to trigger it again if I could do that locally - but ... here we go. |
Sorry for late.
Personally, I used https://github.com/nektos/act to do this. |
* @fmt: printf-style format string | ||
* @args: optional arguments for format string | ||
/* To verbose logging, enable the next line. */ | ||
//#define LOGGING_ENABLED // to enable logging |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can add a cmake variable for this. If you are not familiar, I can do this for you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to append an commit on top - the cmake files are quite huge and I am little bit too scared right now by them 😆
I thought I had seen a refactoring of the CMake files as PR somewhere, but that might be a different project.
Anyway, I would like to see a “cmake” folder that abstracts each CPU architecture and the required files into multiple cmakefiles - instead of a monolithic approach. There are reasons doing it like this I think, and I did not thought about that (or have looked deeper into the CMakefiles.)
But that's a different topic and shouldn't be clarified here.
Yes I have seen that project too - but I did not used it before. Not familiar with the github logic or terminology, but are there "shareable and free" "git-runners" available, which might execute the pipeline (workflow) for a PR automatically? |
In that way, you need to fork it and enable actions in your forks. |
Merged, nice work! |
The qemu logs can be quite useful to understand, why the emulation does (not) work.
As an example, there is an open issue I had looked in (because I was curious) and did not find an easy way to
see the qemu logging - till I understood there arent anything compiled in.
I could write that script in cpp code and debug it - but I would like to have a "quick" way to figure out whats going on
with pyhton scripts too.
This PR revives the qemu_log for a "special" build - where you might want to try to find the bug or whats going on.
Example: Take the issue #1971 and try to figure out whats going on with this PR and the enabled logs. You will see a message like:
It's more like to help developers to print useful log messages so we can figure out what's going on faster.
In the future, the logging should be used more and more so we gain back knowledge about things pretty easly.