GDB Print print any number in the array

Source: Internet
Author: User
Tags print print

(GDB)
25 void init_mutex (void)
26 {
27 pthread_mutex_init (& g_mutex_thread, null );
28}
29
30 static void func (void)
31 {
32 static int32_t i32num = 0;
33 static char P [10] = {'A', 'B', 'C', 'D', 'E', 'F', 'G ', 'H', 'I', 'J '};
34
(GDB)
35 while (1 ){
36 pthread_mutex_lock (& g_mutex_thread );
37
38 printf ("g_stpid = [% d] i32num = [% d] \ n", (uint32_t) g_stpid, i32num ++ );
39
40 pthread_mutex_unlock (& g_mutex_thread );
41 sleep (1 );
42}
43}
44
(GDB) print * P @ 5 ------------------ print the first five digits of the array
$4 = "ABCDE"
(GDB) print * (p + 5) @ 5 ------------------- print the last five digits of the array starting from the 6th element (p + 5)
$5 = "fghij"
(GDB)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.