Help with pad in gdbprintlib.cpp

7 views
Skip to first unread message

Matthew Vincent - NOAA Federal

unread,
Oct 21, 2021, 6:57:21 PM10/21/21
to us...@admb-project.org
Hello,

I have been working on debugging a model in ADMB and came across the pad functionality using gdb online in the ADMB documentation. I have compiled the program in emacs using the -g flag to create the file. I've also tried to put  #include gdbprintlib.cpp or #include gdbprintlib.h into the global section. However, whenever I try to use pad in the gdb command line in emacs I get the error: Undefined command: "pad".  Try "help".

I notice on the page that describes the function that it says 'To use the functions in a GDB session, ADMB must have been built from source in debug mode, typically using the command 'make debug''
I'm using version 12.3 on windows from the installer. Does this include the functionality to use the debugger in gdb or do I need to compile in some different way? Any help to figure out how to use this would be greatly appreciated. If you need any additional information from me please let me know.
Thank you

Matthew T. Vincent
Research Fish Biologist,

NOAA Fisheries, SEFSC, NOAA Beaufort Lab
matthew...@noaa.gov
www.nmfs.noaa.gov

 

Jim Ianelli - NOAA Federal

unread,
Oct 21, 2021, 7:48:48 PM10/21/21
to Matthew Vincent - NOAA Federal, ADMB
am a "vi" person so can't help w/ emacs part...but pad from the debugger is a little odd. I find if I want the contents of an object (other than say an integer) typing;
"print pad(obj)"
works. Is that the syntax you're using?

Cheers,
 


--
To unsubscribe from this group and stop receiving emails from it, send an email to users+un...@admb-project.org.


--

James Ianelli
NMFS/NOAA Building 4
7600 Sand Pt Way NE
Seattle WA 98115

 206 526 6510

Visit the ADMB project http://admb-project.org/

Also see Alaska groundfish stock assessments

Johnoel Ancheta

unread,
Oct 21, 2021, 8:09:00 PM10/21/21
to Jim Ianelli - NOAA Federal, Matthew Vincent - NOAA Federal, ADMB
Thanks Jim,

Matthew, if you need a tutorial, please read




Dave Fournier

unread,
Oct 21, 2021, 8:33:05 PM10/21/21
to Johnoel Ancheta, Jim Ianelli - NOAA Federal, Matthew Vincent - NOAA Federal, ADMB
That's a pretty brain dead discussion on using gdb with ADMB.

Johnoel Ancheta

unread,
Oct 21, 2021, 8:36:53 PM10/21/21
to Dave Fournier, ADMB
Ohh, hello Dave

Matthew Vincent - NOAA Federal

unread,
Oct 22, 2021, 2:49:13 PM10/22/21
to Dave Fournier, Johnoel Ancheta, Jim Ianelli - NOAA Federal, ADMB
Yea I guess it was a pretty easy question about syntax that was not apparent from the documentation of the code here: http://api.admb-project.org/gdbprintlib_8cpp.html
Thank you Johnoel for the tutorial, I hadn't seen that before and it was what I needed.
Cheers
Matt

Johnoel Ancheta

unread,
Oct 22, 2021, 6:59:05 PM10/22/21
to ADMB
Btw, Dave Fournier recommends that if you get an error message like the one below,
it is best to set a gdb breakpoint instead of stepping through the program line by line.

Incompatible bounds in dvar_vector& dvar_vector::operator = (const dvar_vector& t)

Below is the command to set a breakpoint in gdb.

(gdb) break ad_boundf

ad_boundf is a function that gets called right before the program exits.  In fact, it calls the exit function.

Then you run,

(gdb) run

If the program does stop at the ad_boundf function, you can print out the function call stack using the
command below.

(gdb) backtrace

The call stack history will give you clues to find the line of code that is causing the incompatible bounds
error.

For simplicity, you could put the command break ad_boundf into the users home directory .gdbinit file.  This
will automatically set the breakpoints and other commands.  In the admb/utilities directory is a .gdbinit file
written by Chris Grandin from DFO that you can use.

Thanks Dave for pointing out a simpler way.

Let me know if you have other questions,

JOhnoel

Jim Ianelli - NOAA Federal

unread,
Oct 23, 2021, 1:41:04 AM10/23/21
to Johnoel Ancheta, ADMB
Yea. That goes without saying re setting breakpoint, sorry o missed that in response. Basic ADMB 101. 

Jim

From: Johnoel Ancheta <joh...@hawaii.edu>
Sent: Friday, October 22, 2021 3:57:18 PM
To: ADMB <us...@admb-project.org>
Subject: Re: [ADMB Users] Help with pad in gdbprintlib.cpp
 

Matthew Vincent - NOAA Federal

unread,
Jan 11, 2022, 1:33:11 PM1/11/22
to Dave Fournier, Johnoel Ancheta, Jim Ianelli - NOAA Federal, ADMB
Hello All,
Thank you for the previous help with getting the correct syntax to use pad. It has helped for using the debugger for most derived variables. However, whenever I attempt to print out the value of an estimated bound vector or bounded number I get the following error : Cannot resolve function pad to any overloaded instance. I thought that this was due to there not being a defined overload of the function for the parameter types. When I attempted to see the class of a variable defined by init_number the output was  
type = class param_init_number {
    <incomplete type>
}
I found this was the same for init_vector, init_bounded_number, init_bounded_vector, sdreport_number, sdreport_vector and sdreport_matrix. 
My knowledge of C++ is quite infantile and thus I needed to do some google searches to see what an incomplete type is and found this. https://stackoverflow.com/questions/44963201/when-does-an-incomplete-type-error-occur-in-c
Is there is a way to print out the value of estimated parameters without print pad and to get around the incomplete type for debugging purposes?

Cheers
Matt
I'm using ADMB 12.3

Reply all
Reply to author
Forward
0 new messages