[Lldb-commits] [lldb] [llvm] [lldb][RISCV] function calls support in lldb expressions (PR #99336)
via lldb-commits
lldb-commits at lists.llvm.org
Tue Sep 10 05:20:16 PDT 2024
================
@@ -0,0 +1,62 @@
+//===--- DirectCallReplacementPass.h - RISC-V specific pass ---------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SOURCE_PLUGINS_ARCHITECTURE_RISCV_DIRECTCALLREPLACEMENTPASS_H
+#define LLDB_SOURCE_PLUGINS_ARCHITECTURE_RISCV_DIRECTCALLREPLACEMENTPASS_H
+
+#include "lldb/lldb-types.h"
+
+#include "llvm/IR/Instructions.h"
+#include "llvm/Pass.h"
+
+namespace lldb_private {
+
+class ExecutionContext;
+
+// During the lldb expression execution lldb wraps a user expression, jittes
+// fabricated code and then puts it into the stack memory. Thus, if user tried
----------------
dlav-sc wrote:
> Are you sure it's using stack memory? This would require the stack to be executable.
Generally we find a way to memory map some chunk and use that instead.
Well, maybe it's not always true, lldb searches suitable place in memory for mapping as you've said, but according to logs, usually stack memory is used (please, take a look https://github.com/llvm/llvm-project/pull/99336#discussion_r1692134445, https://github.com/llvm/llvm-project/pull/99336#issuecomment-2242837459)
> Maybe you're referring to jumps from that JIT'd code back to code in the binary, that those jumps may be too large?
Yep. Even if lldb hasn't used stack memory exactly, we can't guarantee that selected region will be close enough to code in the binary to make a jump.
https://github.com/llvm/llvm-project/pull/99336
More information about the lldb-commits
mailing list