Re: [lldb-dev] Accessing attached process environment variables with SBAPI
The SBEnvironment classes and the setting for the environment are currently used just for launching processes. lldb doesn’t keep track of the “live” state of the environment in a process - which can change as the program runs. It would certainly be useful to have a “printenv” function in lldb that fetched the current process environment, however. Please file an enhancement request or propose a patch. Jim > On Jan 28, 2022, at 4:35 PM, Ivan Hernandez via lldb-dev > wrote: > > Hi all, > > I'm trying to read the value of an environment variable that a process was > launched with but to which lldb attached to after it launched. SBEnvironment > looked interesting but I tried using > ``` > script > print(lldb.debugger.GetSelectedTarget().GetEnvironment().Get("PRINT_ME") > ``` > and that prints 'None'. > > I am able to get the value using > ``` > script addr = lldb.debugger.GetSelectedTarget().EvaluateExpression("(char > *)getenv(\"PRINT_ME\")").GetValueAsUnsigned() > script err = lldb.SBError() > script > print(lldb.debugger.GetSelectedTarget().GetProcess().ReadCStringFromMemory(addr, > 1024, err)) > ``` > but that seems like overkill for reading an environment variable. Is there a > better way to do this that I'm missing? > > I'm using the following program to quickly test things: > ``` > #include > #include > #include > int main() { > raise(SIGSTOP); > printf("%s\n", getenv("PRINT_ME")); > } > ``` > ___ > lldb-dev mailing list > lldb-dev@lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev ___ lldb-dev mailing list lldb-dev@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
Re: [lldb-dev] Mailman->Discourse Migration on February 1, 10am PST
Thank you Paul for pointing this out. I will get this information updated tonight. -Tanya > On Jan 29, 2022, at 9:58 AM, Paul Smith wrote: > > On Sat, 2022-01-29 at 08:29 -0800, Tanya Lattner via lldb-dev wrote: >> We will use the Discourse Migration website to communicate where we >> are in the process. > > Just to point out that the "Setting up email interactions" section on > this page could use some attention. > > For example the first bullet links to a Mozilla help page which is > obsolete; it describes modifying user preferences which don't exist in > the current LLVM Discourse (maybe LLVM is using a newer version?), or > at least they don't exist in my account. I can't find any setting > related to "Send me email notifications when I am active on the site", > nor can I find any setting like "Mark posts as read when I'm emailed > about them". > > Also the link at "Quoting previous topics in an reply" points to an > issue where the answer appears to be changing a site-wide setting, not > a per-user setting, so there's not much that we can do about it > individually. > ___ lldb-dev mailing list lldb-dev@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev