@@ -321,8 +321,6 @@ static char *c_name_of_child (struct varobj *parent, int index);
321
321
322
322
static char * c_path_expr_of_child (struct varobj * child );
323
323
324
- static struct value * c_value_of_root (struct varobj * * var_handle );
325
-
326
324
static struct value * c_value_of_child (struct varobj * parent , int index );
327
325
328
326
static struct type * c_type_of_child (struct varobj * parent , int index );
@@ -342,8 +340,6 @@ static char *cplus_name_of_child (struct varobj *parent, int index);
342
340
343
341
static char * cplus_path_expr_of_child (struct varobj * child );
344
342
345
- static struct value * cplus_value_of_root (struct varobj * * var_handle );
346
-
347
343
static struct value * cplus_value_of_child (struct varobj * parent , int index );
348
344
349
345
static struct type * cplus_type_of_child (struct varobj * parent , int index );
@@ -361,8 +357,6 @@ static char *java_name_of_child (struct varobj *parent, int index);
361
357
362
358
static char * java_path_expr_of_child (struct varobj * child );
363
359
364
- static struct value * java_value_of_root (struct varobj * * var_handle );
365
-
366
360
static struct value * java_value_of_child (struct varobj * parent , int index );
367
361
368
362
static struct type * java_type_of_child (struct varobj * parent , int index );
@@ -380,8 +374,6 @@ static char *ada_name_of_child (struct varobj *parent, int index);
380
374
381
375
static char * ada_path_expr_of_child (struct varobj * child );
382
376
383
- static struct value * ada_value_of_root (struct varobj * * var_handle );
384
-
385
377
static struct value * ada_value_of_child (struct varobj * parent , int index );
386
378
387
379
static struct type * ada_type_of_child (struct varobj * parent , int index );
@@ -411,9 +403,6 @@ struct language_specific
411
403
obtain that has some parent. */
412
404
char * (* path_expr_of_child ) (struct varobj * child );
413
405
414
- /* The ``struct value *'' of the root variable ROOT. */
415
- struct value * (* value_of_root ) (struct varobj * * root_handle );
416
-
417
406
/* The ``struct value *'' of the INDEX'th child of PARENT. */
418
407
struct value * (* value_of_child ) (struct varobj * parent , int index );
419
408
@@ -458,7 +447,6 @@ static struct language_specific languages[vlang_end] = {
458
447
c_name_of_variable ,
459
448
c_name_of_child ,
460
449
c_path_expr_of_child ,
461
- c_value_of_root ,
462
450
c_value_of_child ,
463
451
c_type_of_child ,
464
452
c_value_of_variable ,
@@ -471,7 +459,6 @@ static struct language_specific languages[vlang_end] = {
471
459
cplus_name_of_variable ,
472
460
cplus_name_of_child ,
473
461
cplus_path_expr_of_child ,
474
- cplus_value_of_root ,
475
462
cplus_value_of_child ,
476
463
cplus_type_of_child ,
477
464
cplus_value_of_variable ,
@@ -484,7 +471,6 @@ static struct language_specific languages[vlang_end] = {
484
471
java_name_of_variable ,
485
472
java_name_of_child ,
486
473
java_path_expr_of_child ,
487
- java_value_of_root ,
488
474
java_value_of_child ,
489
475
java_type_of_child ,
490
476
java_value_of_variable ,
@@ -496,7 +482,6 @@ static struct language_specific languages[vlang_end] = {
496
482
ada_name_of_variable ,
497
483
ada_name_of_child ,
498
484
ada_path_expr_of_child ,
499
- ada_value_of_root ,
500
485
ada_value_of_child ,
501
486
ada_type_of_child ,
502
487
ada_value_of_variable ,
@@ -2710,6 +2695,86 @@ name_of_child (struct varobj *var, int index)
2710
2695
return (* var -> root -> lang -> name_of_child ) (var , index );
2711
2696
}
2712
2697
2698
+ /* If frame associated with VAR can be found, switch
2699
+ to it and return 1. Otherwise, return 0. */
2700
+
2701
+ static int
2702
+ check_scope (struct varobj * var )
2703
+ {
2704
+ struct frame_info * fi ;
2705
+ int scope ;
2706
+
2707
+ fi = frame_find_by_id (var -> root -> frame );
2708
+ scope = fi != NULL ;
2709
+
2710
+ if (fi )
2711
+ {
2712
+ CORE_ADDR pc = get_frame_pc (fi );
2713
+
2714
+ if (pc < BLOCK_START (var -> root -> valid_block ) ||
2715
+ pc >= BLOCK_END (var -> root -> valid_block ))
2716
+ scope = 0 ;
2717
+ else
2718
+ select_frame (fi );
2719
+ }
2720
+ return scope ;
2721
+ }
2722
+
2723
+ /* Helper function to value_of_root. */
2724
+
2725
+ static struct value *
2726
+ value_of_root_1 (struct varobj * * var_handle )
2727
+ {
2728
+ struct value * new_val = NULL ;
2729
+ struct varobj * var = * var_handle ;
2730
+ int within_scope = 0 ;
2731
+ struct cleanup * back_to ;
2732
+
2733
+ /* Only root variables can be updated... */
2734
+ if (!is_root_p (var ))
2735
+ /* Not a root var. */
2736
+ return NULL ;
2737
+
2738
+ back_to = make_cleanup_restore_current_thread ();
2739
+
2740
+ /* Determine whether the variable is still around. */
2741
+ if (var -> root -> valid_block == NULL || var -> root -> floating )
2742
+ within_scope = 1 ;
2743
+ else if (var -> root -> thread_id == 0 )
2744
+ {
2745
+ /* The program was single-threaded when the variable object was
2746
+ created. Technically, it's possible that the program became
2747
+ multi-threaded since then, but we don't support such
2748
+ scenario yet. */
2749
+ within_scope = check_scope (var );
2750
+ }
2751
+ else
2752
+ {
2753
+ ptid_t ptid = thread_id_to_pid (var -> root -> thread_id );
2754
+ if (in_thread_list (ptid ))
2755
+ {
2756
+ switch_to_thread (ptid );
2757
+ within_scope = check_scope (var );
2758
+ }
2759
+ }
2760
+
2761
+ if (within_scope )
2762
+ {
2763
+ volatile struct gdb_exception except ;
2764
+
2765
+ /* We need to catch errors here, because if evaluate
2766
+ expression fails we want to just return NULL. */
2767
+ TRY_CATCH (except , RETURN_MASK_ERROR )
2768
+ {
2769
+ new_val = evaluate_expression (var -> root -> exp );
2770
+ }
2771
+ }
2772
+
2773
+ do_cleanups (back_to );
2774
+
2775
+ return new_val ;
2776
+ }
2777
+
2713
2778
/* What is the ``struct value *'' of the root variable VAR?
2714
2779
For floating variable object, evaluation can get us a value
2715
2780
of different type from what is stored in varobj already. In
@@ -2787,7 +2852,7 @@ value_of_root (struct varobj **var_handle, int *type_changed)
2787
2852
{
2788
2853
struct value * value ;
2789
2854
2790
- value = ( * var -> root -> lang -> value_of_root ) (var_handle );
2855
+ value = value_of_root_1 (var_handle );
2791
2856
if (var -> value == NULL || value == NULL )
2792
2857
{
2793
2858
/* For root varobj-s, a NULL value indicates a scoping issue.
@@ -3382,83 +3447,6 @@ c_path_expr_of_child (struct varobj *child)
3382
3447
return child -> path_expr ;
3383
3448
}
3384
3449
3385
- /* If frame associated with VAR can be found, switch
3386
- to it and return 1. Otherwise, return 0. */
3387
- static int
3388
- check_scope (struct varobj * var )
3389
- {
3390
- struct frame_info * fi ;
3391
- int scope ;
3392
-
3393
- fi = frame_find_by_id (var -> root -> frame );
3394
- scope = fi != NULL ;
3395
-
3396
- if (fi )
3397
- {
3398
- CORE_ADDR pc = get_frame_pc (fi );
3399
-
3400
- if (pc < BLOCK_START (var -> root -> valid_block ) ||
3401
- pc >= BLOCK_END (var -> root -> valid_block ))
3402
- scope = 0 ;
3403
- else
3404
- select_frame (fi );
3405
- }
3406
- return scope ;
3407
- }
3408
-
3409
- static struct value *
3410
- c_value_of_root (struct varobj * * var_handle )
3411
- {
3412
- struct value * new_val = NULL ;
3413
- struct varobj * var = * var_handle ;
3414
- int within_scope = 0 ;
3415
- struct cleanup * back_to ;
3416
-
3417
- /* Only root variables can be updated... */
3418
- if (!is_root_p (var ))
3419
- /* Not a root var. */
3420
- return NULL ;
3421
-
3422
- back_to = make_cleanup_restore_current_thread ();
3423
-
3424
- /* Determine whether the variable is still around. */
3425
- if (var -> root -> valid_block == NULL || var -> root -> floating )
3426
- within_scope = 1 ;
3427
- else if (var -> root -> thread_id == 0 )
3428
- {
3429
- /* The program was single-threaded when the variable object was
3430
- created. Technically, it's possible that the program became
3431
- multi-threaded since then, but we don't support such
3432
- scenario yet. */
3433
- within_scope = check_scope (var );
3434
- }
3435
- else
3436
- {
3437
- ptid_t ptid = thread_id_to_pid (var -> root -> thread_id );
3438
- if (in_thread_list (ptid ))
3439
- {
3440
- switch_to_thread (ptid );
3441
- within_scope = check_scope (var );
3442
- }
3443
- }
3444
-
3445
- if (within_scope )
3446
- {
3447
- volatile struct gdb_exception except ;
3448
-
3449
- /* We need to catch errors here, because if evaluate
3450
- expression fails we want to just return NULL. */
3451
- TRY_CATCH (except , RETURN_MASK_ERROR )
3452
- {
3453
- new_val = evaluate_expression (var -> root -> exp );
3454
- }
3455
- }
3456
-
3457
- do_cleanups (back_to );
3458
-
3459
- return new_val ;
3460
- }
3461
-
3462
3450
static struct value *
3463
3451
c_value_of_child (struct varobj * parent , int index )
3464
3452
{
@@ -3892,12 +3880,6 @@ cplus_path_expr_of_child (struct varobj *child)
3892
3880
return child -> path_expr ;
3893
3881
}
3894
3882
3895
- static struct value *
3896
- cplus_value_of_root (struct varobj * * var_handle )
3897
- {
3898
- return c_value_of_root (var_handle );
3899
- }
3900
-
3901
3883
static struct value *
3902
3884
cplus_value_of_child (struct varobj * parent , int index )
3903
3885
{
@@ -3982,12 +3964,6 @@ java_path_expr_of_child (struct varobj *child)
3982
3964
return NULL ;
3983
3965
}
3984
3966
3985
- static struct value *
3986
- java_value_of_root (struct varobj * * var_handle )
3987
- {
3988
- return cplus_value_of_root (var_handle );
3989
- }
3990
-
3991
3967
static struct value *
3992
3968
java_value_of_child (struct varobj * parent , int index )
3993
3969
{
@@ -4040,12 +4016,6 @@ ada_path_expr_of_child (struct varobj *child)
4040
4016
child -> index );
4041
4017
}
4042
4018
4043
- static struct value *
4044
- ada_value_of_root (struct varobj * * var_handle )
4045
- {
4046
- return c_value_of_root (var_handle );
4047
- }
4048
-
4049
4019
static struct value *
4050
4020
ada_value_of_child (struct varobj * parent , int index )
4051
4021
{
0 commit comments