summaryrefslogtreecommitdiff
path: root/Userland/Utilities/strace.cpp
AgeCommit message (Collapse)Author
2023-01-13strace: Fix ignored errors in formattingMacDue
2023-01-07Everywhere: Remove "LibC/" includes, add lint-rule against itBen Wiederhake
2023-01-02Everywhere: Remove unused includes of LibC/stdlib.hBen Wiederhake
These instances were detected by searching for files that include stdlib.h, but don't match the regex: \\b(_abort|abort|abs|aligned_alloc|arc4random|arc4random_buf|arc4random_ uniform|atexit|atof|atoi|atol|atoll|bsearch|calloc|clearenv|div|div_t|ex it|_Exit|EXIT_FAILURE|EXIT_SUCCESS|free|getenv|getprogname|grantpt|labs| ldiv|ldiv_t|llabs|lldiv|lldiv_t|malloc|malloc_good_size|malloc_size|mble n|mbstowcs|mbtowc|mkdtemp|mkstemp|mkstemps|mktemp|posix_memalign|posix_o penpt|ptsname|ptsname_r|putenv|qsort|qsort_r|rand|RAND_MAX|random|reallo c|realpath|secure_getenv|serenity_dump_malloc_stats|serenity_setenv|sete nv|setprogname|srand|srandom|strtod|strtof|strtol|strtold|strtoll|strtou l|strtoull|system|unlockpt|unsetenv|wcstombs|wctomb)\\b (Without the linebreaks.) This regex is pessimistic, so there might be more files that don't actually use anything from the stdlib. In theory, one might use LibCPP to detect things like this automatically, but let's do this one step after another.
2022-12-28strace: Propagate errorsKyle Lanmon
2022-12-28Kernel+Userland: Remove dependency on i386-specific registersLiav A
2022-12-28Userland: Remove i686 supportLiav A
2022-12-06Everywhere: Rename to_{string => deprecated_string}() where applicableLinus Groh
This will make it easier to support both string types at the same time while we convert code, and tracking down remaining uses. One big exception is Value::to_string() in LibJS, where the name is dictated by the ToString AO.
2022-12-06AK+Everywhere: Rename String to DeprecatedStringLinus Groh
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
2022-12-03Everywhere: Run clang-formatLinus Groh
2022-11-19strace: Port to Core::StreamSam Atkins
2022-10-14AK+Userland: Stub out code that isn't currently implemented on AARCH64Gunnar Beutner
Even though this almost certainly wouldn't run properly even if we had a working kernel for AARCH64 this at least lets us build all the userland binaries.
2022-08-20strace: Pledge `rpath` for searching binariesTim Schumacher
After commit 91a03bc6ae134f76560c8bba49b6704b1bbbeaae we no longer try to discover files for exec-ing by simply trying to exec on them, but we check for the files existence by using `Core::file::exists()` first. Contrary to the old solution, this now requires the `rpath` pledge, so pledge it to keep `strace` from crashing when using non-absolute paths.
2022-07-27Everywhere: Make the codebase more architecture awareUndefine
2022-07-12Everywhere: Add sv suffix to strings relying on StringView(char const*)sin-ack
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
2022-07-12Everywhere: Split Error::from_string_literal and Error::from_string_viewsin-ack
Error::from_string_literal now takes direct char const*s, while Error::from_string_view does what Error::from_string_literal used to do: taking StringViews. This change will remove the need to insert `sv` after error strings when returning string literal errors once StringView(char const*) is removed. No functional changes.
2022-07-12Everywhere: Explicitly specify the size in StringView constructorssin-ack
This commit moves the length calculations out to be directly on the StringView users. This is an important step towards the goal of removing StringView(char const*), as it moves the responsibility of calculating the size of the string to the user of the StringView (which will prevent naive uses causing OOB access).
2022-05-05Everywhere: Purge all support and usage of framebuffer devicesLiav A
Long live the DisplayConnector object!
2022-05-05Everywhere: Rename FB prefix name ioctls => GRAPHICSLiav A
2022-05-02Kernel: Stop requiring working malloc for syscall.h includesPatrick Meyer
Fixes #13869
2022-04-11strace: Use Core::System::exec()Sam Atkins
2022-04-01Everywhere: Run clang-formatIdan Horowitz
2022-02-12strace: Add a chdir formatterAli Mohammad Pur
2022-01-24Everywhere: Convert ByteBuffer factory methods from Optional -> ErrorOrSam Atkins
Apologies for the enormous commit, but I don't see a way to split this up nicely. In the vast majority of cases it's a simple change. A few extra places can use TRY instead of manual error checking though. :^)
2022-01-08Kernel: Remove EWHYTHO error code :^)Andreas Kling
This error code was a hack for catching error handling mistakes in the kernel. It's no longer used anywhere.
2021-12-25strace: Port to LibMain :^)Andreas Kling
2021-12-23strace: Fix out-of-bounds read when formatting realpath()Daniel Bertalan
The actual length of the resulting string is encoded in the return value; treating the entire buffer as a string leads to reading uninitialized memory.
2021-12-23Kernel+UE: Add MAP_FIXED_NOREPLACE mmap() flagDaniel Bertalan
This feature was introduced in version 4.17 of the Linux kernel, and while it's not specified by POSIX, I think it will be a nice addition to our system. MAP_FIXED_NOREPLACE provides a less error-prone alternative to MAP_FIXED: while regular fixed mappings would cause any intersecting ranges to be unmapped, MAP_FIXED_NOREPLACE returns EEXIST instead. This ensures that we don't corrupt our process's address space if something is already at the requested address. Note that the more portable way to do this is to use regular MAP_ANONYMOUS, and check afterwards whether the returned address matches what we wanted. This, however, has a large performance impact on programs like Wine which try to reserve large portions of the address space at once, as the non-matching addresses have to be unmapped separately.
2021-12-12strace: Remove formatting support for SC_selectJean-Baptiste Boric
2021-12-12strace: Add formatting support for SC_pollJean-Baptiste Boric
2021-12-12strace: Sort syscalls formatters in alphabetic orderJean-Baptiste Boric
2021-12-05strace: Handle strings more gracefullyBen Wiederhake
In particular, strace can now stomach memory errors while copying invalid strings. Example with a valid string: dbgputstr("95.976 traceme(38:38) Well, Hello Friends!") = 55 Example with an invalid string: dbgputstr(Error(errno=14){0x00012345, 678b}) = -14 EFAULT (ANSI escapes removed for readability.)
2021-12-05strace: Use new PT_PEEKBUF functionBen Wiederhake
This necessarily introduces some usages (and benefits!) of the new ErrorOr<> pattern. To keep commits atomic, I do not yet rewrite the entire program to use ErrorOr<> correctly.
2021-12-05LibC: Add a couple of missing errno codesIdan Horowitz
These are required to compile a port.
2021-12-05Kernel: Add support for the MSG_WAITALL sys$recvmsg flagIdan Horowitz
2021-12-05Kernel: Add support for the MSG_DONTROUTE sys$sendmsg flagIdan Horowitz
2021-11-24strace: Implement get_process_name and gettidBen Wiederhake
2021-11-24strace: Implement dbgputstr syscallBen Wiederhake
2021-11-17AK: Convert AK::Format formatting helpers to returning ErrorOr<void>Andreas Kling
This isn't a complete conversion to ErrorOr<void>, but a good chunk. The end goal here is to propagate buffer allocation failures to the caller, and allow the use of TRY() with formatting functions.
2021-11-10strace: Interpret errno codes for pointer-like return codesBen Wiederhake
2021-11-10strace: Switch to new flag handler, support more flagsBen Wiederhake
In particular, strace now supports all O_*, MSG_*, MAP_*, and PROT_* flags, as well as a more context-dependent default value (e.g. "PROT_NONE").
2021-11-10strace: Better support for bitflags, show unrecognized flagsBen Wiederhake
2021-10-31strace: Teach mmap() pretty-printer about more MAP_FOO flagsAndreas Kling
2021-10-27Kernel + WindowServer: Re-define the interface to framebuffer devicesLiav A
We create a base class called GenericFramebufferDevice, which defines all the virtual functions that must be implemented by a FramebufferDevice. Then, we make the VirtIO FramebufferDevice and other FramebufferDevice implementations inherit from it. The most important consequence of rearranging the classes is that we now have one IOCTL method, so all drivers should be committed to not override the IOCTL method or make their own IOCTLs of FramebufferDevice. All graphical IOCTLs are known to all FramebufferDevices, and it's up to the specific implementation whether to support them or discard them (so we require extensive usage of KResult and KResultOr, together with virtual characteristic functions). As a result, the interface is much cleaner and understandable to read.
2021-10-12strace: Add command line options to filter syscallsRodrigo Tobar
By default strace outputs all system calls the monitored process invokes, but it's sometimes useful to either exclude some calls, or to include only some others. This commit adds two new command line options to specify two exclusion/inclusion command-delimited lists of system calls. These are then used to decide if an intercepted system call should be displayed in the output or not.
2021-10-12strace: Show sun_path on AF_UNIX socket addressesRodrigo Tobar
2021-10-12strace: Add support for get{u,eu,g,eg,p,pp}id syscallsRodrigo Tobar
All these take no arguments so there's no formatting to be done.
2021-10-12strace: Add formatting for clock_gettimeRodrigo Tobar
2021-10-12strace: Add initial ioctl formattingRodrigo Tobar
This is useful in general, but adding it is what finally helped uncovering #10438.
2021-10-08Utilities: Fix -Wunreachable-code warnings from clangNico Weber
2021-10-07Strace: Add formatting for misc syscallsRodrigo Tobar
These are exit, realpath and getrandom. This required a bit of extra infrastructure to deal with exit's void return type.