strange behavior of GHashTable in GLib

46 Views Asked by At

i am writing an program like:

typedef struct _DsSourceBin {
  gint        index;
  gchar      *name;
  GstElement *bin;
  GstElement *src;
  gchar      *uri;
  GHashTable *config;
} DsSourceBin;

typedef struct _StreamContext {
  guint       num_source{0};
  DsSourceBin src_bin[16];
  GstElement *streammux;
  GstElement *sink;
  GstElement *primary_detector;
  GstElement *nvtile;
  GstElement *nvosd;
  gchar      *config_file;
} StreamContext;

when using a StreamContext, i wrote: StreamContext ctx;, so in gdb, in my understand, i should have seen the full structure of the DsSourceBin array (because of implicit initialization?), but i'm not: img

Unless i change my code like: GHashTable *config = NULL; why is this happening? Is there any clue like C standard, or lib rules that i missed?

I also tried deleting GHashTable* and i can get the full structure of StreamContext: img

1

There are 1 best solutions below

1
zgjja On BEST ANSWER

i work it out, this is actually the behavior of vscode C++ debugger: when using the release mode of GLib, some debug info will not available, so vscode will not show all of them, but there are little info that do exists, so using GDB in the debug console of VSCode will find the info I need.