diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2021-04-24 19:26:04 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2021-04-24 19:26:41 -0400 |
commit | c90e7d6352b2e16ac007d08b2e03ae10081147b5 (patch) | |
tree | 2ca6bb8a1d338ff48f2eed24dcb25300e4204f54 /gdb/unittests | |
parent | ec098003e27d67bca9e9880320e26ab8ad30fe31 (diff) | |
download | gdb-c90e7d6352b2e16ac007d08b2e03ae10081147b5.zip gdb-c90e7d6352b2e16ac007d08b2e03ae10081147b5.tar.gz gdb-c90e7d6352b2e16ac007d08b2e03ae10081147b5.tar.bz2 |
gdbsupport, gdb: give names to observers
Give a name to each observer, this will help produce more meaningful
debug message.
gdbsupport/ChangeLog:
* observable.h (class observable) <struct observer> <observer>:
Add name parameter.
<name>: New field.
<attach>: Add name parameter, update all callers.
Change-Id: Ie0cc4664925215b8d2b09e026011b7803549fba0
Diffstat (limited to 'gdb/unittests')
-rw-r--r-- | gdb/unittests/observable-selftests.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/gdb/unittests/observable-selftests.c b/gdb/unittests/observable-selftests.c index e19eaf8..0e3b53f 100644 --- a/gdb/unittests/observable-selftests.c +++ b/gdb/unittests/observable-selftests.c @@ -73,7 +73,7 @@ run_tests () const gdb::observers::token token1 {}, token2 {} , token3 {}; /* Now, attach one observer, and send a notification. */ - test_notification.attach (&test_second_notification_function, token2); + test_notification.attach (&test_second_notification_function, token2, "test"); notify_check_counters (0, 1, 0); /* Remove the observer, and send a notification. */ @@ -81,15 +81,15 @@ run_tests () notify_check_counters (0, 0, 0); /* With a new observer. */ - test_notification.attach (&test_first_notification_function, token1); + test_notification.attach (&test_first_notification_function, token1, "test"); notify_check_counters (1, 0, 0); /* With 2 observers. */ - test_notification.attach (&test_second_notification_function, token2); + test_notification.attach (&test_second_notification_function, token2, "test"); notify_check_counters (1, 1, 0); /* With 3 observers. */ - test_notification.attach (&test_third_notification_function, token3); + test_notification.attach (&test_third_notification_function, token3, "test"); notify_check_counters (1, 1, 1); /* Remove middle observer. */ @@ -106,9 +106,9 @@ run_tests () /* Go back to 3 observers, and remove them in a different order... */ - test_notification.attach (&test_first_notification_function, token1); - test_notification.attach (&test_second_notification_function, token2); - test_notification.attach (&test_third_notification_function, token3); + test_notification.attach (&test_first_notification_function, token1, "test"); + test_notification.attach (&test_second_notification_function, token2, "test"); + test_notification.attach (&test_third_notification_function, token3, "test"); notify_check_counters (1, 1, 1); /* Remove the third observer. */ |