@@ -67,8 +67,16 @@ Panda__SrcInfoPri *pandalog_src_info_pri_create(const char *src_filename, uint64
6767 si->ast_loc_id = ast_loc_id;
6868
6969 si->has_insertionpoint = 1 ;
70- // insert before
71- si->insertionpoint = 1 ;
70+
71+ auto it = stackoff.find (global_funcaddr);
72+ // Check if the iterator is NOT at the end of the map (i.e., key was found)
73+ if (it != stackoff.end ()) {
74+ // Key found: Use the value associated with the key
75+ si->insertionpoint = it->second ;
76+ } else {
77+ // Key not found: Use the fallback value
78+ si->insertionpoint = 1 ;
79+ }
7280 return si;
7381}
7482
@@ -373,20 +381,6 @@ Panda__SrcInfo *pandalog_src_info_create(PandaHypercallStruct phs) {
373381 si->astnodename = phs.src_ast_node_name ;
374382 si->linenum = phs.src_linenum ;
375383 si->has_insertionpoint = 0 ;
376- if (phs.insertion_point ) {
377- si->has_insertionpoint = 1 ;
378- // NOTE: Somehow hackish here, use `insertionpoint` to pass stack offset
379- // Find the key in the map
380- auto it = stackoff.find (global_funcaddr);
381- // Check if the iterator is NOT at the end of the map (i.e., key was found)
382- if (it != stackoff.end ()) {
383- // Key found: Use the value associated with the key
384- si->insertionpoint = it->second ;
385- } else {
386- // Key not found: Use the fallback value
387- si->insertionpoint = phs.insertion_point ;
388- }
389- }
390384 si->has_ast_loc_id = 1 ;
391385 si->ast_loc_id = phs.src_filename ;
392386 return si;
0 commit comments