On Wed, Sep 17, 2025 at 4:01 PM HAGIO KAZUHITO(萩尾 一仁) <k-hagio...@nec.com> wrote:
> On 2025/09/17 16:20, lijiang wrote: > > On Wed, Sep 17, 2025 at 2:17 PM HAGIO KAZUHITO(萩尾 一仁) > > <k-hagio...@nec.com <mailto:k-hagio...@nec.com>> wrote: > > > > Hi Lianbo, > > > > Thank you for fixing it quickly. > > > > btw, seeing 99bb57ac98af, I had a couple of questions, is there a > > way to > > print the original (not mangled) log buffer? > > > > > > Good questions, Kazu. > > Add an option(E.g -R) to the log command that can help solve it. For > > example: > > The log will print original messages. > > crash> log > > The log -R will print demangled Rust symbol names if there are any > > mangled Rust symbol names. > > crash> log -R > > > > also, if the log buffer has lines like "_R ... +" which are not rust > > symbols unexpectedly, how are they printed? > > > > > > For this case, the rust_demangle() will fail, and still print the > > original messages. > > > > res = rust_demangle(mangled, DMGL_RUST); > > if (res) { > > snprintf(demangled+slen, BUFSIZE-slen, "%s%s", > > res, p2); > > fprintf(fp, "%s",demangled); > > free(res); > > } else > > fprintf(fp, "%s", buf); > > How about the above solutions? Kazu. > > Thank you for considering, these look good to me. > > also, if text_len is limited to BUFSIZE for this function, maybe it > should be only when "log -R" ? > > Sure. > > > > BWT: Originally I tried the following code, but it looks ugly. So > > simplify this one. > > > > char *p1 = strstr(buf, "_R"); > > if (!p1) > > p1 = strstr(buf, "_ZN"); > > char *p2 = strrchr(buf, '+'); > > if (p1 && p2) { > > char mangled[BUFSIZE] = {0}; > > char demangled[BUFSIZE] = {0}; > > char *res; > > size_t slen = p1 - buf; > > > > if (slen) > > memcpy(demangled, buf, slen); > > > > memcpy(mangled, p1, p2-p1); > > res = rust_demangle(mangled, DMGL_RUST); > > if (res) { > > snprintf(demangled+slen, BUFSIZE-slen, "%s%s", > > res, p2); > > if (CRASHDEBUG(1)) > > fprintf(fp, "%s", buf); > > else > > fprintf(fp, "%s",demangled); > > free(res); > > } else > > fprintf(fp, "%s", buf); > > } else > > fprintf(fp, "%s", buf); > > > > I did not realize that the original messages(mangled Rust symbols names) > > are still helpful to you. > > It's just confusing that we see different logs in crash "log" and > vmcore-dmesg.txt etc, and like this time, if there is a bug in the > demangling process, then we would like to check the original messages. > > Make sense. I will post a patch later. Thank you for your suggestions, Kazu. > Thanks, > Kazu > > > > > Thanks > > Lianbo > > > > (nice function, but maybe such function should be an option imho..) > > > > Thanks, > > Kazu >
-- Crash-utility mailing list -- devel@lists.crash-utility.osci.io To unsubscribe send an email to devel-le...@lists.crash-utility.osci.io https://${domain_name}/admin/lists/devel.lists.crash-utility.osci.io/ Contribution Guidelines: https://github.com/crash-utility/crash/wiki