llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

lldb adding range has a base that is less than the function's low PC

Open iamanonymouscs opened this issue 3 years ago • 2 comments

$ cat small.c

volatile __PTRDIFF_TYPE__ v;

void
bar (char *p, char *q)
{
  v = q - p;
  v = p - q;
}

char global[10000] = {};

int
main ()
{
  /* Heap allocated memory.  */
  char *p = (char *)__builtin_malloc (42);
  bar (p, p + 20);
  __builtin_free (p);

  /* Global variable.  */
  bar (&global[0], &global[100]);
  bar (&global[1000], &global[9000]);
  bar (&global[500], &global[10]);
  bar (&global[0], &global[10000]);

  /* Stack variable.  */
  char stack[10000];
  bar (&stack[0], &stack[100]);
  bar (&stack[1000], &stack[9000]);
  bar (&stack[500], &stack[10]);

  return 0;
}

$ cat example.py

#!/usr/bin/env python3

import lldb

ci = lldb.debugger.GetCommandInterpreter()
ro = lldb.SBCommandReturnObject()

while lldb.debugger.GetSelectedTarget().GetProcess().GetState() != lldb.eStateExited:
    if lldb.debugger.GetSelectedTarget().GetProcess().GetState() == lldb.eStateStopped:
        ci.HandleCommand('stepi', ro)

$ clang -O0 -g small.c $ lldb --no-lldbinit -no-use-colors --file a.out --batch --one-line 'process launch --stop-at-entry' --one-line 'command script import example.py'

(lldb) target create "a.out"
Current executable set to '/root/devil/batch/a.out' (x86_64).
(lldb) process launch --stop-at-entry
Process 22141 launched: '/root/devil/batch/a.out' (x86_64)
(lldb) command script import example.py
warning: This version of LLDB has no plugin for the language "assembler". Inspection of frame variables will be limited.
error: ld-2.27.so 0x0000f808: adding range [0x0000000000007de2-0x0000000000007e53) which has a base that is less than the function's low PC 0x00000000000082e0. Please file a bug and attach the file at the start of this error message
error: ld-2.27.so 0x0000f808: adding range [0x0000000000007e56-0x0000000000007e59) which has a base that is less than the function's low PC 0x00000000000082e0. Please file a bug and attach the file at the start of this error message
error: ld-2.27.so 0x0000f808: adding range [0x0000000000007e5f-0x0000000000007fa2) which has a base that is less than the function's low PC 0x00000000000082e0. Please file a bug and attach the file at the start of this error message
error: ld-2.27.so 0x0000d073: adding range [0x0000000000008a27-0x0000000000008a30) which has a base that is less than the function's low PC 0x0000000000008fb0. Please file a bug and attach the file at the start of this error message
error: ld-2.27.so 0x0000d073: adding range [0x0000000000008b00-0x0000000000008b80) which has a base that is less than the function's low PC 0x0000000000008fb0. Please file a bug and attach the file at the start of this error message
error: ld-2.27.so 0x0000d073: adding range [0x0000000000008bb0-0x0000000000008bc9) which has a base that is less than the function's low PC 0x0000000000008fb0. Please file a bug and attach the file at the start of this error message
error: ld-2.27.so 0x0000d091: adding range [0x0000000000008a27-0x0000000000008a30) which has a base that is less than the function's low PC 0x0000000000008fb0. Please file a bug and attach the file at the start of this error message
error: ld-2.27.so 0x0000d091: adding range [0x0000000000008b00-0x0000000000008b73) which has a base that is less than the function's low PC 0x0000000000008fb0. Please file a bug and attach the file at the start of this error message
error: ld-2.27.so 0x0000d091: adding range [0x0000000000008bb0-0x0000000000008bc9) which has a base that is less than the function's low PC 0x0000000000008fb0. Please file a bug and attach the file at the start of this error message
...

iamanonymouscs avatar Apr 13 '23 05:04 iamanonymouscs

$ clang --version

Ubuntu clang version 17.0.0 (++20230412091519+75ef84bf5260-1~exp1~20230412091628.1170)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

$ lldb --version

lldb version 17.0.0

iamanonymouscs avatar Apr 13 '23 05:04 iamanonymouscs

@llvm/issue-subscribers-lldb

llvmbot avatar Apr 13 '23 15:04 llvmbot