[Lldb-commits] [PATCH] D32732: "target variable" not showing all global variable if we print any global variable before execution starts

vignesh balu via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed May 3 23:46:21 PDT 2017


vbalu added a comment.

i am confused as I dont see it is similar way when i don't print global variable before strting inferior. 
For the c file  "lldbsuite/test/functionalities/target_command/globals.c" i see "target variable" behaves differently as below.

**Without printing global variable before starting inferior:**

  (lldb) target create "global"
  Current executable set to 'global' (x86_64).
  (lldb) b main
  Breakpoint 1: where = global`main + 30 at globals.c:18, address = 0x000000000040074e
  (lldb) r
  Process 37645 launching
  Process 37645 launched: '/b/vignesh/lldb_temp/global' (x86_64)
  Process 37645 stopped
  * thread #1, name = 'global', stop reason = breakpoint 1.1
      frame #0: 0x000000000040074e global`main(argc=1, argv=0x00007fffffffe9d0) at globals.c:18
     15
     16   int main (int argc, char const *argv[])
     17   {
  -> 18           int a =0;
     19           int b =0;
     20
     21       printf("global char: %c\n", my_global_char);
  (lldb) target variable
  Global variables for /b/vignesh/lldb_temp/globals.c in /b/vignesh/lldb_temp/global:
  (char) my_global_char = 'X'
  (const char *) my_global_str = 0x0000000000400806 "abc"
  (const char **) my_global_str_ptr = 0x0000000000600af0
  (int) my_static_int = 228
  (lldb)

**With printing global variable before starting inferior**

  (lldb) target create "global"
  Current executable set to 'global' (x86_64).
  (lldb) target variable my_global_char
  (char) my_global_char = 'X'
  (lldb) b main
  Breakpoint 1: where = global`main + 30 at globals.c:18, address = 0x000000000040074e
  (lldb) r
  Process 37681 launching
  Process 37681 launched: '/b/vignesh/lldb_temp/global' (x86_64)
  Process 37681 stopped
  * thread #1, name = 'global', stop reason = breakpoint 1.1
      frame #0: 0x000000000040074e global`main(argc=1, argv=0x00007fffffffe9d0) at globals.c:18
     15
     16   int main (int argc, char const *argv[])
     17   {
  -> 18           int a =0;
     19           int b =0;
     20
     21       printf("global char: %c\n", my_global_char);
  lldb) target variable
  Global variables for /b/vignesh/lldb_temp/globals.c in /b/vignesh/lldb_temp/global:
  (char) my_global_char = 'X'
  (lldb)

Please let me know if above change in behavior is expected. If so Please explain.


Repository:
  rL LLVM

https://reviews.llvm.org/D32732





More information about the lldb-commits mailing list