Skip to content
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

FW/child_debug: use std::string #482

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

thiagomacieira
Copy link
Contributor

This changes both the Unix and Windows child-debuggers to use std::string more instead of writing to file descriptors. This should improve performance a bit because we don't make system calls to store our content as it's being built. It also allows us to remove the LoggingStream class (was added in #286's 040bc36 to replace the FILE *-based API).

Using the API added in #479, this removes open_memstream() on Unix systems and more importantly, removes the need for an actual temporary file on Windows.

So we can use it where no formatting is needed elsewhere in the
framework.

Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
This removes `open_memstream()` on Unix systems and more importantly,
removes the need for an actual temporary file on Windows.

Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
We were using a plain file descriptor because that allowed us to use
`splice()` straight from the pipe to the backing file, in case the
backtrace was big. But that's really unnecessary and was a source of
bugs because the non-Linux code was never tested.

Replace with direct std::string and move up the location where we call
the logging functions to outside of the GDB communication loop.

Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
This removes the last user of LoggingStream.

Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
All its uses have been replaced with `log_message_preformatted()`.
That's slighty less efficient because we must read into our own buffers
before writing to the log file, something we are going to do anyway. But
it simplifies the codebase and reduces the number of system calls.

Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant