Help with pad in gdbprintlib.cpp

Skip to first unread message

Matthew Vincent - NOAA Federal

Oct 21, 2021, 6:57:21 PM10/21/21

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


Jim Ianelli - NOAA Federal

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?


To unsubscribe from this group and stop receiving emails from it, send an email to


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

 206 526 6510

Visit the ADMB project

Also see Alaska groundfish stock assessments

Johnoel Ancheta

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

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

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

Matthew Vincent - NOAA Federal

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:
Thank you Johnoel for the tutorial, I hadn't seen that before and it was what I needed.

Johnoel Ancheta

Oct 22, 2021, 6:59:05 PM10/22/21
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

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,


Jim Ianelli - NOAA Federal

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. 


From: Johnoel Ancheta <>
Sent: Friday, October 22, 2021 3:57:18 PM
To: ADMB <>
Subject: Re: [ADMB Users] Help with pad in gdbprintlib.cpp

Matthew Vincent - NOAA Federal

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.
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?

I'm using ADMB 12.3

Reply all
Reply to author
0 new messages