Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6818993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:14:44+00:00 2026-05-26T21:14:44+00:00

i have some problems on understanding gdb. i have a main function, i wrote

  • 0

i have some problems on understanding gdb.

i have a main function, i wrote this main function on myself.

Some lines in this main, call some functions in a library, i think library name is not important but it is tesseract-ocr.

my line in main which call a function, a constructor is here:

choiceItr = new tesseract::ChoiceIterator(itr);

i put a break point at gdb on above line, and run, when it stops on that line i use step command to go into the function.

Here is the library function who is called:

ChoiceIterator::ChoiceIterator(const ResultIterator& result_it) {
  ASSERT_HOST(result_it.it_->word() != NULL);
  tesseract_ = result_it.tesseract_;
  PAGE_RES_IT res_it(*result_it.it_);
  WERD_CHOICE* best_choice = res_it.word()->best_choice;
  BLOB_CHOICE_LIST_CLIST* choices = best_choice->blob_choices();
  if (choices != NULL) {
    BLOB_CHOICE_LIST_C_IT blob_choices_it(choices);
    for (int blob = 0; blob < result_it.blob_index_; ++blob)
      blob_choices_it.forward();
    choice_it_ = new BLOB_CHOICE_IT(blob_choices_it.data());
    choice_it_->mark_cycle_pt();
  } else {
    choice_it_ = NULL;
  }
}

then i use “next” command of gdb to walk in function.

here is my gdb console:

Breakpoint 1, pixsOfOneWord (langString=0x8049e7c "klm", 
    imageString=0x8049e71 "paket2.tif", outputData=0x8049c7b, 
    datapathString=0x8049e6f ".") at deneme234.cpp:161
161 choiceItr = new tesseract::ChoiceIterator(itr);
(gdb) step
tesseract::ChoiceIterator::ChoiceIterator (this=0x819e6f0, result_it=...)
    at resultiterator.cpp:234
234     choice_it_ = new BLOB_CHOICE_IT(blob_choices_it.data());
(gdb) next
225   ASSERT_HOST(result_it.it_->word() != NULL);
(gdb) list
220     return it_->word()->box_word->BlobPosition(blob_index_) == SP_DROPCAP;
221   return false;
222 }
223 
224 ChoiceIterator::ChoiceIterator(const ResultIterator& result_it) {
225   ASSERT_HOST(result_it.it_->word() != NULL);
226   tesseract_ = result_it.tesseract_;
227   PAGE_RES_IT res_it(*result_it.it_);
228   WERD_CHOICE* best_choice = res_it.word()->best_choice;
229   BLOB_CHOICE_LIST_CLIST* choices = best_choice->blob_choices();
(gdb) next
278 }  // namespace tesseract.
(gdb) next
226   tesseract_ = result_it.tesseract_;
(gdb) next
278 }  // namespace tesseract.
(gdb) next
226   tesseract_ = result_it.tesseract_;
(gdb) next
230   if (choices != NULL) {
(gdb) 

as you can see,

tesseract_ = result_it.tesseract_;

line has been called two times, why?

PAGE_RES_IT res_it(*result_it.it_);
WERD_CHOICE* best_choice = res_it.word()->best_choice;
BLOB_CHOICE_LIST_CLIST* choices = best_choice->blob_choices();

also when i “next”, above lines was not called, why?

Thanks in advnce.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T21:14:44+00:00Added an answer on May 26, 2026 at 9:14 pm

    The library you are stepping into has been built with optimization and debug symbols (most likely -g -O2, which is the default for Linux builds).

    Debugging optimized code is somewhat hard, as control flow optimization causes the code to “jump around”, some variables become “<optimized out>“, etc.

    You can rebuild the library with CXXFLAGS = -g -O0, or you can learn to debug with optimization on.

    The latter is a very useful skill, as many times your program will only crash in optimized mode, and you’ll have to debug it in that mode anyway.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to the Boost.MPL library, and have some beginners-problems Look at this sample:
i want to use .animate function but i have some problems i want to
Im having some problems understanding some code in a programme I have inherited. CGPoint
I'm having some problems using / understanding is_dir. (Yes, I have read the PHP
I have some understanding problems regarding the stringstream . Example: stringstream stream(commands); while (true)
I am not a native English speaker, so I have some problems understanding the
I'm a novice in iOS developing, and have some problems with understanding web service
I'm learning MEF and have some problems with understanding it. I have small project
I have some problems with Miktex installed on Windows Vista Business SP1/32 bit. I
I have some problems on a site with the concurrent access to a list.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.