Error evaluating number see info editor for details name frame is not defined

import imgaug.augmenters as iaa import cv2 import glob from tkinter import Frame from tkinter import Text from tkinter import Label # 1. Load Dataset images = [] images_path = glob.glob("imag...
import imgaug.augmenters as iaa
import cv2
import glob
from tkinter import Frame
from tkinter import Text
from tkinter import Label

# 1. Load Dataset
images = []
images_path = glob.glob("images/*.jpg")
for img_path in images_path:
    img = cv2.imread(img_path)
    images.append(img)
# 2. Image Augmentation
augmentation = iaa.Sequential([
    # 1. Flip
    iaa.Fliplr(0.5),
    iaa.Flipud(0.5),
    # 2. Affine
    iaa.Affine(translate_percent={"x": (-0.2, 0.2), "y": (-0.2, 0.2)},
               rotate=(-30, 30),
               scale=(0.5, 1.5)),
    # 3. Multiply
    iaa.Multiply((0.8, 1.2)),
    # 4. Linearcontrast
    iaa.LinearContrast((0.6, 1.4)),
    # Perform methods below only sometimes
    iaa.Sometimes(0.5,
        # 5. GaussianBlur
        iaa.GaussianBlur((0.0, 3.0))
        )
])


 # 3. Show Images
counter = 0
while True:
    augmented_images = augmentation(images=images)
    for img in augmented_images:
        counter += 1
        cv2.imwrite(str(counter) + ".jpg", frame)

        cv2.imwrite('Desktop/images/dog.jpg', img)  # desired save location
        cv2.waitKey(0)

«Traceback (most recent call last):
File «C:/Users/MC/PycharmProjects/pythonProject/Python_Augmentation.py», line 48, in
cv2.imwrite(str(counter) + «.jpg», frame)
NameError: name ‘frame’ is not defined»

The image augmentation code ran well, but when I tried to save the augmented images this error occurred. I also used capital ‘F’ instead of ‘f’ (frame), but I got another error.

«Traceback (most recent call last):
File «C:/Users/MC/PycharmProjects/pythonProject/Python_Augmentation.py», line 49, in
cv2.imwrite(str(counter) + «.jpg», Frame)
cv2.error: OpenCV(4.5.4-dev) :-1: error: (-5:Bad argument) in function ‘imwrite’

Overload resolution failed:

  • img is not a numpy array, neither a scalar
  • Expected Ptr<cv::UMat> for argument ‘img'»

Any type of help is appreciatable. Thanks in advance.

The problem isn’t with the specific driver you’ve implemented, but with python scripts in general. The automatic execution of all python scripts is disabled by default.

From the Blender 2.90 Manual:

The ability to include Python scripts within blend-files is valuable
for advanced tasks such as rigging and automation. However, it poses a
security risk since Python does not restrict what a script can do.

Therefore, you should only run scripts from sources you know and
trust.

Automatic execution is disabled by default, however, some blend-files
need this to function properly.

This is mostly an issue when you are opening a Blender file which you didn’t yourself make. It could contain any conceivable script.

In Blender Preferences > Save & Load there is a checkbox to Auto Run Python Scripts. You can add excluded paths to, for example, your downloads folder, so that foreign blend files are still restricted.

You can also manually enable scripts in specific blend files as you open then, by checking the Trusted Source box in the File Browser.

  • Remove From My Forums
  • Question

  • Help me please ! 

    from azureml import Workspace 
    ws = Workspace(
        workspace_id=’bc32e2d9f65c4ebe87ac31b546de0832′,
        authorization_token=’9kZC8Zf+KoUUzU8I/qBaXih+3nyNjsk6jBG1O4JcjfCzoT1pvgGxdigrsAiCfnVcwyY8oVzdS2naiGzvi8YBVw==’,
        endpoint=’https://europewest.studioapi.azureml.net’
    )
    experiment = ws.experiments[‘bc32e2d9f65c4ebe87ac31b546de0832.f-id.8b526115007848868251c64c0dbebe6a’]
    ds = experiment.get_intermediate_dataset(
        node_id=’e99badf1-4d8c-4705-9689-27df305c59bd-319′,
        port_name=’Results dataset’,
        data_type_id=’GenericCSV’
    )
    ds = ws.datasets[‘doctors.csv’]
    ds = ws.datasets[‘diabetes.csv’]
    frame = ds.to_dataframe()

    frame

    ---------------------------------------------------------------------------
    NameError                                 Traceback (most recent call last)
    <ipython-input-4-32725ef162e5> in <module>()
    ----> 1 frame
    
    NameError: name 'frame' is not defined

August 12, 2013 at 07:50

#602

I’m using a Linux license to remote debug a remote linux program. When I start debugging and set a breakpoint in the multi-threaded application, VS2012 cannot find the current stack frame in a loaded module. The source cannot be shown for this location.

I’m using VGDB 3.1, Windows 7, Visual Studio 2012, Linux target with GDB 7.2-52

This is the log file:

gdb –interpreter mi –args “/tmp/VisualGDB/Archos/ArchosProject/Debug/Archos”
-list-features
=thread-group-added,id=”i1″
~”GNU gdb (GDB) Fedora (7.2-52.fc14)n”
~”Copyright (C) 2010 Free Software Foundation, Inc.n”
~”License GPLv3+: GNU GPL version 3 or later < http://gnu.org/licenses/gpl.html>nThis is free software: you are free to change and redistribute it.nThere is NO WARRANTY, to the extent permitted by law. Type “show copying”nand “show warranty” for details.n”
~”This GDB was configured as “i686-redhat-linux-gnu”.nFor bug reporting instructions, please see:n”
~”< http://www.gnu.org/software/gdb/bugs/>…n”
~”Reading symbols from /tmp/VisualGDB/Archos/ArchosProject/Debug/Archos…”
~”done.n”
^done,features=[“frozen-varobjs”,”pending-breakpoints”,”thread-info”,”python”]
-gdb-set stop-on-solib-events 1
^done
^done
-inferior-tty-set /dev/pts/1
^done
-data-list-register-names
^done,register-names=[“eax”,”ecx”,”edx”,”ebx”,”esp”,”ebp”,”esi”,”edi”,”eip”,”eflags”,”cs”,”ss”,”ds”,”es”,”fs”,”gs”,”st0″,”st1″,”st2″,”st3″,”st4″,”st5″,”st6″,”st7″,”fctrl”,”fstat”,”ftag”,”fiseg”,”fioff”,”foseg”,”fooff”,”fop”,”xmm0″,”xmm1″,”xmm2″,”xmm3″,”xmm4″,”xmm5″,”xmm6″,”xmm7″,”mxcsr”,””,””,””,””,””,””,””,””,”orig_eax”,”al”,”cl”,”dl”,”bl”,”ah”,”ch”,”dh”,”bh”,”ax”,”cx”,”dx”,”bx”,””,”bp”,”si”,”di”,”mm0″,”mm1″,”mm2″,”mm3″,”mm4″,”mm5″,”mm6″,”mm7″]
-gdb-set disassembly-flavor intel
^done
^done
-gdb-set print demangle off
^done
-gdb-version
~”GNU gdb (GDB) Fedora (7.2-52.fc14)n”
~”Copyright (C) 2010 Free Software Foundation, Inc.n”
~”License GPLv3+: GNU GPL version 3 or later < http://gnu.org/licenses/gpl.html>nThis is free software: you are free to change and redistribute it.nThere is NO WARRANTY, to the extent permitted by law. Type “show copying”nand “show warranty” for details.n”
~”This GDB was configured as “i686-redhat-linux-gnu”.nFor bug reporting instructions, please see:n”
~”< http://www.gnu.org/software/gdb/bugs/>.n”
^done
-break-insert -f main
^done,bkpt={number=”1″,type=”breakpoint”,disp=”keep”,enabled=”y”,addr=”0x08058057″,func=”main(int, char**)”,file=”../Main/main.cpp”,fullname=”/tmp/VisualGDB/Archos/Main/main.cpp”,line=”50″,times=”0″,original-location=”main”}
info target
&”info targetn”
~”Symbols from “/tmp/VisualGDB/Archos/ArchosProject/Debug/Archos”.n”
~”Local exec file:n”
~”t`/tmp/VisualGDB/Archos/ArchosProject/Debug/Archos’, file type elf32-i386.n”
~”tEntry point: 0x8049fc0n”
~”t0x08048134 – 0x08048147 is .interpn”
~”t0x08048148 – 0x08048168 is .note.ABI-tagn”
~”t0x08048168 – 0x0804818c is .note.gnu.build-idn”
~”t0x0804818c – 0x080481f0 is .gnu.hashn”
~”t0x080481f0 – 0x08048b00 is .dynsymn”
~”t0x08048b00 – 0x0804924c is .dynstrn”
~”t0x0804924c – 0x0804936e is .gnu.versionn”
~”t0x08049370 – 0x08049460 is .gnu.version_rn”
~”t0x08049460 – 0x08049488 is .rel.dynn”
~”t0x08049488 – 0x08049830 is .rel.pltn”
~”t0x08049830 – 0x08049860 is .initn”
~”t0x08049860 – 0x08049fc0 is .pltn”
~”t0x08049fc0 – 0x08059bdb is .textn”
~”t0x08059bdc – 0x08059bf8 is .finin”
~”t0x08059c00 – 0x0805b61c is .rodatan”
~”t0x0805b61c – 0x0805c858 is .eh_frame_hdrn”
~”t0x0805c858 – 0x080617ac is .eh_framen”
~”t0x080617ac – 0x080625b9 is .gcc_except_tablen”
~”t0x080635bc – 0x080635fc is .ctorsn”
~”t0x080635fc – 0x08063604 is .dtorsn”
~”t0x08063604 – 0x08063608 is .jcrn”
~”t0x08063608 – 0x08063718 is .dynamicn”
~”t0x08063718 – 0x0806371c is .gotn”
~”t0x0806371c – 0x080638fc is .got.pltn”
~”t0x08063900 – 0x08063b68 is .bssn”
^done
-exec-run
=thread-group-started,id=”i1″,pid=”1557″
=thread-created,id=”1″,group-id=”i1″
^running
*running,thread-id=”all”
=library-loaded,id=”/lib/ld-linux.so.2″,target-name=”/lib/ld-linux.so.2″,host-name=”/lib/ld-linux.so.2″,symbols-loaded=”0″,thread-group=”i1″
~”Stopped due to shared library eventn”
*stopped,thread-id=”1″,stopped-threads=”all”,core=”0″
-break-list
^done,BreakpointTable={nr_rows=”1″,nr_cols=”6″,hdr=[{width=”7″,alignment=”-1″,col_name=”number”,colhdr=”Num”},{width=”14″,alignment=”-1″,col_name=”type”,colhdr=”Type”},{width=”4″,alignment=”-1″,col_name=”disp”,colhdr=”Disp”},{width=”3″,alignment=”-1″,col_name=”enabled”,colhdr=”Enb”},{width=”10″,alignment=”-1″,col_name=”addr”,colhdr=”Address”},{width=”40″,alignment=”2″,col_name=”what”,colhdr=”What”}],body=[bkpt={number=”1″,type=”breakpoint”,disp=”keep”,enabled=”y”,addr=”0x08058057″,func=”main(int, char**)”,file=”../Main/main.cpp”,fullname=”/tmp/VisualGDB/Archos/Main/main.cpp”,line=”50″,times=”0″,original-location=”main”}]}
^done,BreakpointTable={nr_rows=”1″,nr_cols=”6″,hdr=[{width=”7″,alignment=”-1″,col_name=”number”,colhdr=”Num”},{width=”14″,alignment=”-1″,col_name=”type”,colhdr=”Type”},{width=”4″,alignment=”-1″,col_name=”disp”,colhdr=”Disp”},{width=”3″,alignment=”-1″,col_name=”enabled”,colhdr=”Enb”},{width=”10″,alignment=”-1″,col_name=”addr”,colhdr=”Address”},{width=”40″,alignment=”2″,col_name=”what”,colhdr=”What”}],body=[bkpt={number=”1″,type=”breakpoint”,disp=”keep”,enabled=”y”,addr=”0x08058057″,func=”main(int, char**)”,file=”../Main/main.cpp”,fullname=”/tmp/VisualGDB/Archos/Main/main.cpp”,line=”50″,times=”0″,original-location=”main”}]}
info shared
&”info sharedn”
~”From To Syms Read Shared Object Libraryn”
~”0x00510850 0x00527b3f Yes /lib/ld-linux.so.2n”
^done
-exec-continue
^running
*running,thread-id=”1″
=library-loaded,id=”/lib/libncurses.so.5″,target-name=”/lib/libncurses.so.5″,host-name=”/lib/libncurses.so.5″,symbols-loaded=”0″,thread-group=”i1″
=library-loaded,id=”/lib/libtinfo.so.5″,target-name=”/lib/libtinfo.so.5″,host-name=”/lib/libtinfo.so.5″,symbols-loaded=”0″,thread-group=”i1″
=library-loaded,id=”/opt/simplon/lib/liblv.simplon.so”,target-name=”/opt/simplon/lib/liblv.simplon.so”,host-name=”/opt/simplon/lib/liblv.simplon.so”,symbols-loaded=”0″,thread-group=”i1″
=library-loaded,id=”/opt/simplon/lib/liblv.imgproc.so”,target-name=”/opt/simplon/lib/liblv.imgproc.so”,host-name=”/opt/simplon/lib/liblv.imgproc.so”,symbols-loaded=”0″,thread-group=”i1″
=library-loaded,id=”/usr/lib/libstdc++.so.6″,target-name=”/usr/lib/libstdc++.so.6″,host-name=”/usr/lib/libstdc++.so.6″,symbols-loaded=”0″,thread-group=”i1″
=library-loaded,id=”/lib/libm.so.6″,target-name=”/lib/libm.so.6″,host-name=”/lib/libm.so.6″,symbols-loaded=”0″,thread-group=”i1″
=library-loaded,id=”/lib/libgcc_s.so.1″,target-name=”/lib/libgcc_s.so.1″,host-name=”/lib/libgcc_s.so.1″,symbols-loaded=”0″,thread-group=”i1″
=library-loaded,id=”/lib/libpthread.so.0″,target-name=”/lib/libpthread.so.0″,host-name=”/lib/libpthread.so.0″,symbols-loaded=”0″,thread-group=”i1″
=library-loaded,id=”/lib/libc.so.6″,target-name=”/lib/libc.so.6″,host-name=”/lib/libc.so.6″,symbols-loaded=”0″,thread-group=”i1″
=library-loaded,id=”/lib/libdl.so.2″,target-name=”/lib/libdl.so.2″,host-name=”/lib/libdl.so.2″,symbols-loaded=”0″,thread-group=”i1″
=library-loaded,id=”/opt/simplon/lib/liblv.osdep.so”,target-name=”/opt/simplon/lib/liblv.osdep.so”,host-name=”/opt/simplon/lib/liblv.osdep.so”,symbols-loaded=”0″,thread-group=”i1″
=library-loaded,id=”/opt/simplon/lib/liblv.log.so”,target-name=”/opt/simplon/lib/liblv.log.so”,host-name=”/opt/simplon/lib/liblv.log.so”,symbols-loaded=”0″,thread-group=”i1″
=library-loaded,id=”/opt/simplon/lib/liblv.ini.so”,target-name=”/opt/simplon/lib/liblv.ini.so”,host-name=”/opt/simplon/lib/liblv.ini.so”,symbols-loaded=”0″,thread-group=”i1″
=library-loaded,id=”/lib/librt.so.1″,target-name=”/lib/librt.so.1″,host-name=”/lib/librt.so.1″,symbols-loaded=”0″,thread-group=”i1″
=library-loaded,id=”/opt/simplon/lib/liblv.jpeg.so”,target-name=”/opt/simplon/lib/liblv.jpeg.so”,host-name=”/opt/simplon/lib/liblv.jpeg.so”,symbols-loaded=”0″,thread-group=”i1″
~”[Thread debugging using libthread_db enabled]n”
~”Stopped due to shared library eventn”
*stopped,thread-id=”1″,stopped-threads=”all”,core=”0″
-break-list
^done,BreakpointTable={nr_rows=”1″,nr_cols=”6″,hdr=[{width=”7″,alignment=”-1″,col_name=”number”,colhdr=”Num”},{width=”14″,alignment=”-1″,col_name=”type”,colhdr=”Type”},{width=”4″,alignment=”-1″,col_name=”disp”,colhdr=”Disp”},{width=”3″,alignment=”-1″,col_name=”enabled”,colhdr=”Enb”},{width=”10″,alignment=”-1″,col_name=”addr”,colhdr=”Address”},{width=”40″,alignment=”2″,col_name=”what”,colhdr=”What”}],body=[bkpt={number=”1″,type=”breakpoint”,disp=”keep”,enabled=”y”,addr=”0x08058057″,func=”main(int, char**)”,file=”../Main/main.cpp”,fullname=”/tmp/VisualGDB/Archos/Main/main.cpp”,line=”50″,times=”0″,original-location=”main”}]}
info shared
&”info sharedn”
~”From To Syms Read Shared Object Libraryn”
~”0x00510850 0x00527b3f Yes /lib/ld-linux.so.2n”
~”0x04cb3e80 0x04ccd198 Yes /lib/libncurses.so.5n”
~”0x04a9cd00 0x04aa7768 Yes /lib/libtinfo.so.5n”
~”0xb7fd6ea0 0xb7fe1534 Yes /opt/simplon/lib/liblv.simplon.son”
~”0xb7f23b50 0xb7f6e3b4 Yes /opt/simplon/lib/liblv.imgproc.son”
~”0x04403b30 0x044768c8 Yes /usr/lib/libstdc++.so.6n”
~”0x006ef470 0x00709b68 Yes /lib/libm.so.6n”
~”0x00719f90 0x00730818 Yes /lib/libgcc_s.so.1n”
~”0x006c1600 0x006cd4e8 Yes /lib/libpthread.so.0n”
~”0x00547c10 0x006649c4 Yes /lib/libc.so.6n”
~”0x006daa60 0x006dba88 Yes /lib/libdl.so.2n”
~”0xb7f10b20 0xb7f14214 Yes /opt/simplon/lib/liblv.osdep.son”
~”0xb7f00890 0xb7f077b4 Yes /opt/simplon/lib/liblv.log.son”
~”0xb7eea650 0xb7efa594 Yes /opt/simplon/lib/liblv.ini.son”
~”0x006e2880 0x006e6638 Yes /lib/librt.so.1n”
~”0xb7ea6380 0xb7ee4b44 Yes /opt/simplon/lib/liblv.jpeg.son”
^done
-exec-continue
^running
*running,thread-id=”1″
=thread-created,id=”2″,group-id=”i1″
~”[New Thread 0xb7e9fb70 (LWP 1560)]n”
*running,thread-id=”all”
*stopped,reason=”breakpoint-hit”,disp=”keep”,bkptno=”1″,frame={addr=”0x08058057″,func=”main”,args=[{name=”argc”,value=”1″},{name=”argv”,value=”0xbffffc04″}],file=”../Main/main.cpp”,fullname=”/tmp/VisualGDB/Archos/Main/main.cpp”,line=”50″},thread-id=”1″,stopped-threads=”all”,core=”1″
-break-delete 1
^done
-exec-continue
^running
*running,thread-id=”all”
&”Detaching after fork from child process 1561.n”
=thread-created,id=”3″,group-id=”i1″
~”[New Thread 0xb74ffb70 (LWP 1562)]n”
*running,thread-id=”all”
~”[Switching to Thread 0xb74ffb70 (LWP 1562)]n”
*stopped,reason=”signal-received”,signal-name=”SIGSEGV”,signal-meaning=”Segmentation fault”,frame={addr=”0x08055cab”,func=”_ZN3Lib7ImgProc9CLightBar15DetectEdgesFastEPN6Camera10TImageInfoE”,args=[]},thread-id=”3″,stopped-threads=”all”,core=”0″
=thread-selected,id=”3″
-stack-list-frames –thread 3
^done,stack=[frame={level=”0″,addr=”0x08055cab”,func=”_ZN3Lib7ImgProc9CLightBar15DetectEdgesFastEPN6Camera10TImageInfoE”},frame={level=”1″,addr=”0x08055b19″,func=”_ZN3Lib7ImgProc9CLightBar11DetectEdgesEPN6Camera10TImageInfoE”},frame={level=”2″,addr=”0x0804b225″,func=”Application::WidthMonitor::CApplication_WidthMonitor::RunStateMachine”,file=”../Application/WidthMonitor/Src/Application_WidthMonitor.cpp”,fullname=”/tmp/VisualGDB/Archos/Application/WidthMonitor/Src/Application_WidthMonitor.cpp”,line=”115″},frame={level=”3″,addr=”0x0804a6bd”,func=”_ZN11Application12CApplication10ThreadMainEv”},frame={level=”4″,addr=”0x0804a63f”,func=”_ZN11Application12CApplication17ThreadMain_StaticEPv”},frame={level=”5″,addr=”0x006c2e99″,func=”start_thread”,file=”pthread_create.c”,fullname=”/usr/src/debug/glibc-2.13-13-g943515f/nptl/pthread_create.c”,line=”301″},frame={level=”6″,addr=”0x00608d2e”,func=”clone”,file=”../sysdeps/unix/sysv/linux/i386/clone.S”,fullname=”/usr/src/debug/glibc-2.13-13-g943515f/sysdeps/unix/sysv/linux/i386/clone.S”,line=”133″}]
-stack-list-arguments –thread 3 1
^done,stack-args=[frame={level=”0″,args=[]},frame={level=”1″,args=[]},frame={level=”2″,args=[{name=”this”,value=”0x807c698″}]},frame={level=”3″,args=[]},frame={level=”4″,args=[]},frame={level=”5″,args=[{name=”arg”,value=”0xb74ffb70″}]},frame={level=”6″,args=[]}]
-thread-info
=thread-created,id=”4″,group-id=”i1″
~”[New Thread 0xb6cfeb70 (LWP 1563)]n”
^done,threads=[{id=”4″,target-id=”Thread 0xb6cfeb70 (LWP 1563)”,frame={level=”0″,addr=”0x00608d18″,func=”clone”,args=[],file=”../sysdeps/unix/sysv/linux/i386/clone.S”,fullname=”/usr/src/debug/glibc-2.13-13-g943515f/sysdeps/unix/sysv/linux/i386/clone.S”,line=”111″},state=”stopped”,core=”0″},{id=”3″,target-id=”Thread 0xb74ffb70 (LWP 1562)”,frame={level=”0″,addr=”0x08055cab”,func=”_ZN3Lib7ImgProc9CLightBar15DetectEdgesFastEPN6Camera10TImageInfoE”,args=[]},state=”stopped”,core=”0″},{id=”2″,target-id=”Thread 0xb7e9fb70 (LWP 1560)”,frame={level=”0″,addr=”0xb7fff424″,func=”__kernel_vsyscall”,args=[]},state=”stopped”,core=”1″},{id=”1″,target-id=”Thread 0xb7ea1ac0 (LWP 1557)”,frame={level=”0″,addr=”0x00608d18″,func=”clone”,args=[],file=”../sysdeps/unix/sysv/linux/i386/clone.S”,fullname=”/usr/src/debug/glibc-2.13-13-g943515f/sysdeps/unix/sysv/linux/i386/clone.S”,line=”111″},state=”stopped”,core=”0″}],current-thread-id=”3″
-data-evaluate-expression “sizeof(void *)”
^done,value=”4″
-data-evaluate-expression “sizeof(int)”
^done,value=”4″
-data-evaluate-expression “sizeof(short)”
^done,value=”2″
-data-evaluate-expression “sizeof(long)”
^done,value=”4″
-data-evaluate-expression “sizeof(long long)”
^done,value=”8″
-data-evaluate-expression “sizeof(char)”
^done,value=”1″
-data-evaluate-expression “sizeof(wchar_t)”
^done,value=”4″
-data-evaluate-expression “sizeof(float)”
^done,value=”4″
-data-evaluate-expression “sizeof(double)”
^done,value=”8″
-data-evaluate-expression “sizeof(long double)”
^done,value=”12″
-thread-info
^done,threads=[{id=”4″,target-id=”Thread 0xb6cfeb70 (LWP 1563)”,frame={level=”0″,addr=”0x00608d18″,func=”clone”,args=[],file=”../sysdeps/unix/sysv/linux/i386/clone.S”,fullname=”/usr/src/debug/glibc-2.13-13-g943515f/sysdeps/unix/sysv/linux/i386/clone.S”,line=”111″},state=”stopped”,core=”0″},{id=”3″,target-id=”Thread 0xb74ffb70 (LWP 1562)”,frame={level=”0″,addr=”0x08055cab”,func=”_ZN3Lib7ImgProc9CLightBar15DetectEdgesFastEPN6Camera10TImageInfoE”,args=[]},state=”stopped”,core=”0″},{id=”2″,target-id=”Thread 0xb7e9fb70 (LWP 1560)”,frame={level=”0″,addr=”0xb7fff424″,func=”__kernel_vsyscall”,args=[]},state=”stopped”,core=”1″},{id=”1″,target-id=”Thread 0xb7ea1ac0 (LWP 1557)”,frame={level=”0″,addr=”0x00608d18″,func=”clone”,args=[],file=”../sysdeps/unix/sysv/linux/i386/clone.S”,fullname=”/usr/src/debug/glibc-2.13-13-g943515f/sysdeps/unix/sysv/linux/i386/clone.S”,line=”111″},state=”stopped”,core=”0″}],current-thread-id=”3″
-thread-info
^done,threads=[{id=”4″,target-id=”Thread 0xb6cfeb70 (LWP 1563)”,frame={level=”0″,addr=”0x00608d18″,func=”clone”,args=[],file=”../sysdeps/unix/sysv/linux/i386/clone.S”,fullname=”/usr/src/debug/glibc-2.13-13-g943515f/sysdeps/unix/sysv/linux/i386/clone.S”,line=”111″},state=”stopped”,core=”0″},{id=”3″,target-id=”Thread 0xb74ffb70 (LWP 1562)”,frame={level=”0″,addr=”0x08055cab”,func=”_ZN3Lib7ImgProc9CLightBar15DetectEdgesFastEPN6Camera10TImageInfoE”,args=[]},state=”stopped”,core=”0″},{id=”2″,target-id=”Thread 0xb7e9fb70 (LWP 1560)”,frame={level=”0″,addr=”0xb7fff424″,func=”__kernel_vsyscall”,args=[]},state=”stopped”,core=”1″},{id=”1″,target-id=”Thread 0xb7ea1ac0 (LWP 1557)”,frame={level=”0″,addr=”0x00608d18″,func=”clone”,args=[],file=”../sysdeps/unix/sysv/linux/i386/clone.S”,fullname=”/usr/src/debug/glibc-2.13-13-g943515f/sysdeps/unix/sysv/linux/i386/clone.S”,line=”111″},state=”stopped”,core=”0″}],current-thread-id=”3″
-stack-list-frames –thread 3
^done,stack=[frame={level=”0″,addr=”0x08055cab”,func=”_ZN3Lib7ImgProc9CLightBar15DetectEdgesFastEPN6Camera10TImageInfoE”},frame={level=”1″,addr=”0x08055b19″,func=”_ZN3Lib7ImgProc9CLightBar11DetectEdgesEPN6Camera10TImageInfoE”},frame={level=”2″,addr=”0x0804b225″,func=”Application::WidthMonitor::CApplication_WidthMonitor::RunStateMachine”,file=”../Application/WidthMonitor/Src/Application_WidthMonitor.cpp”,fullname=”/tmp/VisualGDB/Archos/Application/WidthMonitor/Src/Application_WidthMonitor.cpp”,line=”115″},frame={level=”3″,addr=”0x0804a6bd”,func=”_ZN11Application12CApplication10ThreadMainEv”},frame={level=”4″,addr=”0x0804a63f”,func=”_ZN11Application12CApplication17ThreadMain_StaticEPv”},frame={level=”5″,addr=”0x006c2e99″,func=”start_thread”,file=”pthread_create.c”,fullname=”/usr/src/debug/glibc-2.13-13-g943515f/nptl/pthread_create.c”,line=”301″},frame={level=”6″,addr=”0x00608d2e”,func=”clone”,file=”../sysdeps/unix/sysv/linux/i386/clone.S”,fullname=”/usr/src/debug/glibc-2.13-13-g943515f/sysdeps/unix/sysv/linux/i386/clone.S”,line=”133″}]
-stack-list-arguments –thread 3 0
^done,stack-args=[frame={level=”0″,args=[]},frame={level=”1″,args=[]},frame={level=”2″,args=[name=”this”]},frame={level=”3″,args=[]},frame={level=”4″,args=[]},frame={level=”5″,args=[name=”arg”]},frame={level=”6″,args=[]}]
-thread-info
^done,threads=[{id=”4″,target-id=”Thread 0xb6cfeb70 (LWP 1563)”,frame={level=”0″,addr=”0x00608d18″,func=”clone”,args=[],file=”../sysdeps/unix/sysv/linux/i386/clone.S”,fullname=”/usr/src/debug/glibc-2.13-13-g943515f/sysdeps/unix/sysv/linux/i386/clone.S”,line=”111″},state=”stopped”,core=”0″},{id=”3″,target-id=”Thread 0xb74ffb70 (LWP 1562)”,frame={level=”0″,addr=”0x08055cab”,func=”_ZN3Lib7ImgProc9CLightBar15DetectEdgesFastEPN6Camera10TImageInfoE”,args=[]},state=”stopped”,core=”0″},{id=”2″,target-id=”Thread 0xb7e9fb70 (LWP 1560)”,frame={level=”0″,addr=”0xb7fff424″,func=”__kernel_vsyscall”,args=[]},state=”stopped”,core=”1″},{id=”1″,target-id=”Thread 0xb7ea1ac0 (LWP 1557)”,frame={level=”0″,addr=”0x00608d18″,func=”clone”,args=[],file=”../sysdeps/unix/sysv/linux/i386/clone.S”,fullname=”/usr/src/debug/glibc-2.13-13-g943515f/sysdeps/unix/sysv/linux/i386/clone.S”,line=”111″},state=”stopped”,core=”0″}],current-thread-id=”3″
-stack-list-frames –thread 4
^done,stack=[frame={level=”0″,addr=”0x00608d18″,func=”clone”,file=”../sysdeps/unix/sysv/linux/i386/clone.S”,fullname=”/usr/src/debug/glibc-2.13-13-g943515f/sysdeps/unix/sysv/linux/i386/clone.S”,line=”111″},frame={level=”1″,addr=”0x003d0f00″,func=”??”},frame={level=”2″,addr=”0x00000000″,func=”??”}]
-stack-list-arguments –thread 4 0
^done,stack-args=[frame={level=”0″,args=[]},frame={level=”1″,args=[]},frame={level=”2″,args=[]}]
-stack-list-frames –thread 4
^done,stack=[frame={level=”0″,addr=”0x00608d18″,func=”clone”,file=”../sysdeps/unix/sysv/linux/i386/clone.S”,fullname=”/usr/src/debug/glibc-2.13-13-g943515f/sysdeps/unix/sysv/linux/i386/clone.S”,line=”111″},frame={level=”1″,addr=”0x003d0f00″,func=”??”},frame={level=”2″,addr=”0x00000000″,func=”??”}]
-stack-list-arguments –thread 4 0
^done,stack-args=[frame={level=”0″,args=[]},frame={level=”1″,args=[]},frame={level=”2″,args=[]}]
-stack-list-frames –thread 3
^done,stack=[frame={level=”0″,addr=”0x08055cab”,func=”_ZN3Lib7ImgProc9CLightBar15DetectEdgesFastEPN6Camera10TImageInfoE”},frame={level=”1″,addr=”0x08055b19″,func=”_ZN3Lib7ImgProc9CLightBar11DetectEdgesEPN6Camera10TImageInfoE”},frame={level=”2″,addr=”0x0804b225″,func=”Application::WidthMonitor::CApplication_WidthMonitor::RunStateMachine”,file=”../Application/WidthMonitor/Src/Application_WidthMonitor.cpp”,fullname=”/tmp/VisualGDB/Archos/Application/WidthMonitor/Src/Application_WidthMonitor.cpp”,line=”115″},frame={level=”3″,addr=”0x0804a6bd”,func=”_ZN11Application12CApplication10ThreadMainEv”},frame={level=”4″,addr=”0x0804a63f”,func=”_ZN11Application12CApplication17ThreadMain_StaticEPv”},frame={level=”5″,addr=”0x006c2e99″,func=”start_thread”,file=”pthread_create.c”,fullname=”/usr/src/debug/glibc-2.13-13-g943515f/nptl/pthread_create.c”,line=”301″},frame={level=”6″,addr=”0x00608d2e”,func=”clone”,file=”../sysdeps/unix/sysv/linux/i386/clone.S”,fullname=”/usr/src/debug/glibc-2.13-13-g943515f/sysdeps/unix/sysv/linux/i386/clone.S”,line=”133″}]
-stack-list-arguments –thread 3 0
^done,stack-args=[frame={level=”0″,args=[]},frame={level=”1″,args=[]},frame={level=”2″,args=[name=”this”]},frame={level=”3″,args=[]},frame={level=”4″,args=[]},frame={level=”5″,args=[name=”arg”]},frame={level=”6″,args=[]}]
-stack-list-frames –thread 2
^done,stack=[frame={level=”0″,addr=”0xb7fff424″,func=”__kernel_vsyscall”},frame={level=”1″,addr=”0x006c9765″,func=”sem_wait@@GLIBC_2.1″,file=”../nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S”,fullname=”/usr/src/debug/glibc-2.13-13-g943515f/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S”,line=”80″},frame={level=”2″,addr=”0xb7f12bfd”,func=”LvOsWaitForSemaphore”,from=”/opt/simplon/lib/liblv.osdep.so”},frame={level=”3″,addr=”0xb7f06220″,func=”??”,from=”/opt/simplon/lib/liblv.log.so”},frame={level=”4″,addr=”0xb7f0301b”,func=”??”,from=”/opt/simplon/lib/liblv.log.so”},frame={level=”5″,addr=”0x006c2e99″,func=”start_thread”,file=”pthread_create.c”,fullname=”/usr/src/debug/glibc-2.13-13-g943515f/nptl/pthread_create.c”,line=”301″},frame={level=”6″,addr=”0x00608d2e”,func=”clone”,file=”../sysdeps/unix/sysv/linux/i386/clone.S”,fullname=”/usr/src/debug/glibc-2.13-13-g943515f/sysdeps/unix/sysv/linux/i386/clone.S”,line=”133″}]
-stack-list-arguments –thread 2 0
^done,stack-args=[frame={level=”0″,args=[]},frame={level=”1″,args=[]},frame={level=”2″,args=[]},frame={level=”3″,args=[]},frame={level=”4″,args=[]},frame={level=”5″,args=[name=”arg”]},frame={level=”6″,args=[]}]
-stack-list-frames –thread 2
^done,stack=[frame={level=”0″,addr=”0xb7fff424″,func=”__kernel_vsyscall”},frame={level=”1″,addr=”0x006c9765″,func=”sem_wait@@GLIBC_2.1″,file=”../nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S”,fullname=”/usr/src/debug/glibc-2.13-13-g943515f/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S”,line=”80″},frame={level=”2″,addr=”0xb7f12bfd”,func=”LvOsWaitForSemaphore”,from=”/opt/simplon/lib/liblv.osdep.so”},frame={level=”3″,addr=”0xb7f06220″,func=”??”,from=”/opt/simplon/lib/liblv.log.so”},frame={level=”4″,addr=”0xb7f0301b”,func=”??”,from=”/opt/simplon/lib/liblv.log.so”},frame={level=”5″,addr=”0x006c2e99″,func=”start_thread”,file=”pthread_create.c”,fullname=”/usr/src/debug/glibc-2.13-13-g943515f/nptl/pthread_create.c”,line=”301″},frame={level=”6″,addr=”0x00608d2e”,func=”clone”,file=”../sysdeps/unix/sysv/linux/i386/clone.S”,fullname=”/usr/src/debug/glibc-2.13-13-g943515f/sysdeps/unix/sysv/linux/i386/clone.S”,line=”133″}]
-stack-list-arguments –thread 2 0
^done,stack-args=[frame={level=”0″,args=[]},frame={level=”1″,args=[]},frame={level=”2″,args=[]},frame={level=”3″,args=[]},frame={level=”4″,args=[]},frame={level=”5″,args=[name=”arg”]},frame={level=”6″,args=[]}]
-stack-list-frames –thread 1
^done,stack=[frame={level=”0″,addr=”0x00608d18″,func=”clone”,file=”../sysdeps/unix/sysv/linux/i386/clone.S”,fullname=”/usr/src/debug/glibc-2.13-13-g943515f/sysdeps/unix/sysv/linux/i386/clone.S”,line=”111″},frame={level=”1″,addr=”0x00000000″,func=”??”}]
-stack-list-arguments –thread 1 0
^done,stack-args=[frame={level=”0″,args=[]},frame={level=”1″,args=[]}]
-stack-list-frames –thread 1
^done,stack=[frame={level=”0″,addr=”0x00608d18″,func=”clone”,file=”../sysdeps/unix/sysv/linux/i386/clone.S”,fullname=”/usr/src/debug/glibc-2.13-13-g943515f/sysdeps/unix/sysv/linux/i386/clone.S”,line=”111″},frame={level=”1″,addr=”0x00000000″,func=”??”}]
-stack-list-arguments –thread 1 0
^done,stack-args=[frame={level=”0″,args=[]},frame={level=”1″,args=[]}]
-thread-info
^done,threads=[{id=”4″,target-id=”Thread 0xb6cfeb70 (LWP 1563)”,frame={level=”0″,addr=”0x00608d18″,func=”clone”,args=[],file=”../sysdeps/unix/sysv/linux/i386/clone.S”,fullname=”/usr/src/debug/glibc-2.13-13-g943515f/sysdeps/unix/sysv/linux/i386/clone.S”,line=”111″},state=”stopped”,core=”0″},{id=”3″,target-id=”Thread 0xb74ffb70 (LWP 1562)”,frame={level=”0″,addr=”0x08055cab”,func=”_ZN3Lib7ImgProc9CLightBar15DetectEdgesFastEPN6Camera10TImageInfoE”,args=[]},state=”stopped”,core=”0″},{id=”2″,target-id=”Thread 0xb7e9fb70 (LWP 1560)”,frame={level=”0″,addr=”0xb7fff424″,func=”__kernel_vsyscall”,args=[]},state=”stopped”,core=”1″},{id=”1″,target-id=”Thread 0xb7ea1ac0 (LWP 1557)”,frame={level=”0″,addr=”0x00608d18″,func=”clone”,args=[],file=”../sysdeps/unix/sysv/linux/i386/clone.S”,fullname=”/usr/src/debug/glibc-2.13-13-g943515f/sysdeps/unix/sysv/linux/i386/clone.S”,line=”111″},state=”stopped”,core=”0″}],current-thread-id=”1″
-stack-list-frames –thread 3
^done,stack=[frame={level=”0″,addr=”0x08055cab”,func=”_ZN3Lib7ImgProc9CLightBar15DetectEdgesFastEPN6Camera10TImageInfoE”},frame={level=”1″,addr=”0x08055b19″,func=”_ZN3Lib7ImgProc9CLightBar11DetectEdgesEPN6Camera10TImageInfoE”},frame={level=”2″,addr=”0x0804b225″,func=”Application::WidthMonitor::CApplication_WidthMonitor::RunStateMachine”,file=”../Application/WidthMonitor/Src/Application_WidthMonitor.cpp”,fullname=”/tmp/VisualGDB/Archos/Application/WidthMonitor/Src/Application_WidthMonitor.cpp”,line=”115″},frame={level=”3″,addr=”0x0804a6bd”,func=”_ZN11Application12CApplication10ThreadMainEv”},frame={level=”4″,addr=”0x0804a63f”,func=”_ZN11Application12CApplication17ThreadMain_StaticEPv”},frame={level=”5″,addr=”0x006c2e99″,func=”start_thread”,file=”pthread_create.c”,fullname=”/usr/src/debug/glibc-2.13-13-g943515f/nptl/pthread_create.c”,line=”301″},frame={level=”6″,addr=”0x00608d2e”,func=”clone”,file=”../sysdeps/unix/sysv/linux/i386/clone.S”,fullname=”/usr/src/debug/glibc-2.13-13-g943515f/sysdeps/unix/sysv/linux/i386/clone.S”,line=”133″}]
-stack-list-frames –thread 3
^done,stack=[frame={level=”0″,addr=”0x08055cab”,func=”_ZN3Lib7ImgProc9CLightBar15DetectEdgesFastEPN6Camera10TImageInfoE”},frame={level=”1″,addr=”0x08055b19″,func=”_ZN3Lib7ImgProc9CLightBar11DetectEdgesEPN6Camera10TImageInfoE”},frame={level=”2″,addr=”0x0804b225″,func=”Application::WidthMonitor::CApplication_WidthMonitor::RunStateMachine”,file=”../Application/WidthMonitor/Src/Application_WidthMonitor.cpp”,fullname=”/tmp/VisualGDB/Archos/Application/WidthMonitor/Src/Application_WidthMonitor.cpp”,line=”115″},frame={level=”3″,addr=”0x0804a6bd”,func=”_ZN11Application12CApplication10ThreadMainEv”},frame={level=”4″,addr=”0x0804a63f”,func=”_ZN11Application12CApplication17ThreadMain_StaticEPv”},frame={level=”5″,addr=”0x006c2e99″,func=”start_thread”,file=”pthread_create.c”,fullname=”/usr/src/debug/glibc-2.13-13-g943515f/nptl/pthread_create.c”,line=”301″},frame={level=”6″,addr=”0x00608d2e”,func=”clone”,file=”../sysdeps/unix/sysv/linux/i386/clone.S”,fullname=”/usr/src/debug/glibc-2.13-13-g943515f/sysdeps/unix/sysv/linux/i386/clone.S”,line=”133″}]
-var-create –frame 2 –thread 3 – * “!$lineinfo”
^done,name=”var1″,numchild=”0″,value=”true”,type=”bool”,has_more=”0″

Anybody an idea?

Hi,

Looks like gdb cannot find the file for the frame, each of the frames below without the file defined cannot find the source file.

^done,stack=[frame={level=«0»,addr=«0x08055cab»,func=«_ZN3Lib7ImgProc9CLightBar15DetectEdgesFastEPN6Camera10TImageInfoE»},frame={level=«1»,addr=«0x08055b19»,func=«_ZN3Lib7ImgProc9CLightBar11DetectEdgesEPN6Camera10TImageInfoE»},frame={level=«2»,addr=«0x0804b225»,func=«Application::WidthMonitor::CApplication_WidthMonitor::RunStateMachine»,file=«../Application/WidthMonitor/Src/Application_WidthMonitor.cpp»,fullname=«/tmp/VisualGDB/Archos/Application/WidthMonitor/Src/Application_WidthMonitor.cpp»,line=«115»},frame={level=«3»,addr=«0x0804a6bd»,func=«_ZN11Application12CApplication10ThreadMainEv»},frame={level=«4»,addr=«0x0804a63f»,func=«_ZN11Application12CApplication17ThreadMain_StaticEPv»},frame={level=«5»,addr=«0x006c2e99»,func=«start_thread»,file=«pthread_create.c»,fullname=«/usr/src/debug/glibc-2.13-13-g943515f/nptl/pthread_create.c»,line=«301»},frame={level=«6»,addr=«0x00608d2e»,func=«clone»,file=«../sysdeps/unix/sysv/linux/i386/clone.S»,fullname=«/usr/src/debug/glibc-2.13-13-g943515f/sysdeps/unix/sysv/linux/i386/clone.S»,line=«133»}]

Translated through c++filt, the mangled function names are (in order of appearance):

Lib::ImgProc::CLightBar::DetectEdgesFast(Camera::TImageInfo*), Lib::ImgProc::CLightBar::DetectEdges(Camera::TImageInfo*), Application::CApplication::ThreadMain(), Application::CApplication::ThreadMain_Static(void*)

.

Find out where these functions are defined and why those files were compiled without debugging symbols for GDB (GCC flag -ggdb). Then recompile them with debugging symbols to be able to set breakpoints in those files.

August 13, 2013 at 08:56

#2514

Hi Ket,

Thanks for your fast reply. These files already have debug symbols. The following makefile options are set:

Makefile Debug symbols:
Lib::ImgProc::CLightBar::DetectEdgesFast(Camera::TImageInfo*) :
$(BINARYDIR)/LightBar.o : ../Lib/ImgProc/Src/LightBar.cpp $(all_make_files) |$(BINARYDIR)
$(CXX) $(CXXFLAGS) -c $< -o $@ -MD -MF $(@:.o=.dep)

Lib::ImgProc::CLightBar::DetectEdges(Camera::TImageInfo*) :
$(BINARYDIR)/LightBar.o : ../Lib/ImgProc/Src/LightBar.cpp $(all_make_files) |$(BINARYDIR)
$(CXX) $(CXXFLAGS) -c $< -o $@ -MD -MF $(@:.o=.dep)

Application::CApplication::ThreadMain() :
$(BINARYDIR)/Application.o : ../Application/Src/Application.cpp $(all_make_files) |$(BINARYDIR)
$(CXX) $(CXXFLAGS) -c $< -o $@ -MD -MF $(@:.o=.dep)

Application::CApplication::ThreadMain_Static(void*) :
$(BINARYDIR)/Application.o : ../Application/Src/Application.cpp $(all_make_files) |$(BINARYDIR)
$(CXX) $(CXXFLAGS) -c $< -o $@ -MD -MF $(@:.o=.dep)

Flags are:
CFLAGS := -ggdb -ffunction-sections
DEBUG_CFLAGS := -O0
RELEASE_CFLAGS := -O3

CXXFLAGS := $(CFLAGS) -ffunction-sections
DEBUG_CXXFLAGS := $(DEBUG_CFLAGS)
RELEASE_CXXFLAGS := $(RELEASE_CFLAGS)

August 13, 2013 at 23:07

#2516

Hi,

The flags look to be set correctly. Firstly, are you building and debugging on different machines or using a cross-compiler?

Try the following:
1. Start debugging, pause the debugging or stop at a breakpoint.
2. Enter into the GDB Session window for each of the function names:

info line <full function name here></full>

Copy the responses here.
3. Enter into the GDB Session window:

Are the source files for these functions listed there?

If the functions cannot be found or the source files are not listed, then gdb cannot find debugging symbols for these functions/files. Then run objdump for your project executable on the Linux machine to see if the debugging symbols are there (source code lines for the functions). Use the following command, and then look into the result to see whether these functions have symbols:

objdump d S <your executable name here></your>

You can also run the same command on individual o files, the symbols should be present in both the o files and the executable.

August 15, 2013 at 09:33

#2517

Hi ket,

Yes I’m building and debugging remotely on a different Linux machine.

GDBSession can’t find a function line, see the message:
info line int i = mPixel2MM.Initialise(((char *)CPixel2MMap::STR_INI_FILE.c_str()), ((char *)CPixel2MMap::STR_INI_SECTION.c_str()));
&”info line int i = mPixel2MM.Initialise(((char *)CPixel2MMap::STR_INI_FILE.c_str()), ((char *)CPixel2MMap::STR_INI_SECTION.c_str())); n”
&”Function “int i = mPixel2MM.Initialise(((char *)CPixel2MMap::STR_INI_FILE.c_str()), ((char *)CPixel2MMap::STR_INI_SECTION.c_str()));” not defined.n”
Function “int i = mPixel2MM.Initialise(((char *)CPixel2MMap::STR_INI_FILE.c_str()), ((char *)CPixel2MMap::STR_INI_SECTION.c_str()));” not defined.
-var-create: unable to create variable object

info sources shows the file of the source function :
&”info sourcesn”
Source files for which symbols have been read in:
/tmp/VisualGDB/Archos/Application/Src/Application.cpp, /tmp/VisualGDB/Archos/ArchosProject/, /tmp/VisualGDB/Archos/Application/Inc/Application.h, /tmp/VisualGDB/Archos/Camera/Inc/Camera.h, /tmp/VisualGDB/Archos/DataStores/Settings/Inc/SettingFile.h, /tmp/VisualGDB/Archos/DataStores/Settings/Inc/SettingGroup.h, /tmp/VisualGDB/Archos/DataStores/LiveValues/Inc/LiveValueGroup.h, /tmp/VisualGDB/Archos/DataStores/Commands/Inc/CommandGroup.h, /usr/include/c++/4.5.1/bits/vector.tcc, /tmp/VisualGDB/Archos/DataStores/LiveValues/Inc/LiveValueType.h, /usr/include/c++/4.5.1/bits/basic_string.tcc, /usr/include/c++/4.5.1/i686-redhat-linux/bits/atomic_word.h, /usr/include/locale.h, /usr/include/c++/4.5.1/bits/char_traits.h, /usr/include/c++/4.5.1/ext/numeric_traits.h, /usr/include/c++/4.5.1/bits/allocator.h, /usr/include/c++/4.5.1/debug/debug.h, /usr/include/c++/4.5.1/ext/new_allocator.h, /usr/include/c++/4.5.1/bits/cpp_type_traits.h, /usr/include/c++/4.5.1/bits/stringfwd.h, /usr/include/c++/4.5.1/bits/stl_vector.h, /usr/include/c++/4.5.1/bits/basic_string.h, /usr/include/c++/4.5.1/clocale, /usr/include/c++/4.5.1/cwchar, /usr/include/c++/4.5.1/cstddef, /tmp/VisualGDB/Archos/Camera/Inc/ImageInfo.h, /usr/lib/gcc/i686-redhat-linux/4.5.1/include/stdarg.h, /usr/include/wchar.h, /usr/include/stdio.h, /usr/include/libio.h, /usr/include/bits/pthreadtypes.h, /usr/include/time.h, /usr/include/bits/types.h, /usr/lib/gcc/i686-redhat-linux/4.5.1/include/stddef.h, /tmp/VisualGDB/Archos/DataStores/Commands/Inc/ICommandObserver.h, /tmp/VisualGDB/Archos/DataStores/Settings/Inc/ISettingGroupObserver.h, /tmp/VisualGDB/Archos/Application/Src/ApplicationFactory.cpp, /tmp/VisualGDB/Archos/Lib/Filters/Inc/histogram.h, /tmp/VisualGDB/Archos/Lib/Filters/Inc/filterfactory.h, /tmp/VisualGDB/Archos/Lib/Filters/Inc/lowpassfilter.h, /tmp/VisualGDB/Archos/Lib/Filters/Inc/filter.h, /tmp/VisualGDB/Archos/Lib/Filters/Inc/cyclebuf.h, /tmp/VisualGDB/Archos/Lib/VmiErr/Inc/vmierr.h, /tmp/VisualGDB/Archos/Application/Inc/ApplicationFactory.h, /tmp/VisualGDB/Archos/Application/WidthMonitor/Inc/Application_WidthMonitor.h, /tmp/VisualGDB/Archos/Application/WidthMonitor/Src/Application_WidthMonitor.cpp, /usr/include/c++/4.5.1/ext/type_traits.h, /usr/include/c++/4.5.1/bits/stl_iterator_base_types.h, /tmp/VisualGDB/Archos/Lib/ImgProc/Inc/pixel2mmap.h, /tmp/VisualGDB/Archos/Lib/ImgProc/Inc/ImgProc.h, /tmp/VisualGDB/Archos/Lib/Filters/Inc/Polynomial.h, /usr/include/c++/4.5.1/bits/stl_algobase.h, /usr/include/c++/4.5.1/bits/stl_uninitialized.h, /usr/include/c++/4.5.1/bits/stl_iterator.h, /tmp/VisualGDB/Archos/Lib/Filters/Inc/stddev.h, /tmp/VisualGDB/Archos/Lib/Filters/Inc/mediaan.h, /usr/include/c++/4.5.1/bits/stl_construct.h, /tmp/VisualGDB/Archos/Lib/Filters/Inc/mediaanstd.h, /tmp/VisualGDB/Archos/Main/main.cpp, /tmp/VisualGDB/Archos/Motion/Inc/Motion.h, /tmp/VisualGDB/Archos/UserInterfaces/ConsoleUI/Inc/ConsoleUI.h
Source files for which symbols will be read in on demand:
/usr/include/c++/4.5.1/ext/new_allocator.h, /usr/include/c++/4.5.1/bits/allocator.h, /usr/include/c++/4.5.1/bits/stl_construct.h, /usr/include/c++/4.5.1/bits/stl_vector.h, /tmp/VisualGDB/Archos/UserInterfaces/ConsoleUI/Src/ConsoleUI.cpp, /tmp/VisualGDB/Archos/Motion/Src/MotionFactory.cpp, /tmp/VisualGDB/Archos/DataStores/Settings/Inc/ISettingGroupObserver.h, /tmp/VisualGDB/Archos/Motion/Src/Motion.cpp, /tmp/VisualGDB/Archos/Motion/Linmot/Src/Motion_Linmot.cpp, /tmp/VisualGDB/Archos/Lib/VmiErr/Src/vmierr.cpp, /tmp/VisualGDB/Archos/Lib/VmiErr/Src/datetimewrapper.cpp, /tmp/VisualGDB/Archos/Lib/Timer/Src/timer.cpp, /tmp/VisualGDB/Archos/Lib/Ini/Src/minIni.c, /tmp/VisualGDB/Archos/Lib/Ini/Src/libini.c, /usr/include/c++/4.5.1/bits/stl_algobase.h, /usr/include/c++/4.5.1/bits/stl_uninitialized.h, /usr/include/c++/4.5.1/bits/vector.tcc, /usr/include/c++/4.5.1/bits/stl_iterator.h, /tmp/VisualGDB/Archos/Lib/ImgProc/Src/pixel2mmap.cpp, /tmp/VisualGDB/Archos/Lib/Filters/Inc/minmaxfilter.h, /usr/include/c++/4.5.1/bits/basic_string.h, /tmp/VisualGDB/Archos/Lib/Filters/Inc/cascadefilter.h, /tmp/VisualGDB/Archos/Lib/Filters/Inc/averagefilter.h, /tmp/VisualGDB/Archos/Lib/Filters/Inc/edgefilter.h, /tmp/VisualGDB/Archos/Lib/Filters/Inc/lowpassfilter.h, /tmp/VisualGDB/Archos/Lib/Filters/Inc/mediaan.h, /tmp/VisualGDB/Archos/Lib/Filters/Inc/cyclebuf.h, /tmp/VisualGDB/Archos/Lib/Filters/Inc/filter.h, /tmp/VisualGDB/Archos/Lib/Filters/Inc/filterfactory.h, /usr/include/c++/4.5.1/new, /tmp/VisualGDB/Archos/Lib/ImgProc/Src/LightBar.cpp, /tmp/VisualGDB/Archos/Lib/Filters/Inc/weighedavg.h, /tmp/VisualGDB/Archos/Lib/Filters/Inc/pixelfilter.h, /tmp/VisualGDB/Archos/Lib/Filters/Src/weighedavg.cpp, /tmp/VisualGDB/Archos/Lib/Filters/Src/Polynomial.cpp, /tmp/VisualGDB/Archos/Lib/Filters/Src/pixelfilterfactory.cpp, /tmp/VisualGDB/Archos/Lib/Filters/Src/pixelfilter.cpp, /tmp/VisualGDB/Archos/Lib/Filters/Inc/mediaan_static.h, /tmp/VisualGDB/Archos/Lib/Filters/Src/mediaan_static.cpp, /tmp/VisualGDB/Archos/Lib/Filters/Inc/mediaan5.h, /tmp/VisualGDB/Archos/Lib/Filters/Src/mediaan5.cpp, /tmp/VisualGDB/Archos/Lib/Filters/Src/histogram2D.cpp, /tmp/VisualGDB/Archos/Lib/Filters/Src/histogram.cpp, /tmp/VisualGDB/Archos/Lib/Filters/Src/ClassPID.cpp, /tmp/VisualGDB/Archos/Lib/Filters/Src/ClassLKK.cpp, /tmp/VisualGDB/Archos/Lib/Comm/Cell/Inc/VmiCellWrapper.cpp, /tmp/VisualGDB/Archos/DataStores/Settings/Src/Setting_UInt.cpp, /tmp/VisualGDB/Archos/DataStores/Settings/Src/Setting_String.cpp, /tmp/VisualGDB/Archos/DataStores/Settings/Src/Setting_Int.cpp, /tmp/VisualGDB/Archos/DataStores/Settings/Src/Setting_Float.cpp, /usr/include/c++/4.5.1/bits/char_traits.h, /tmp/VisualGDB/Archos/DataStores/Settings/Src/SettingGroup.cpp, /tmp/VisualGDB/Archos/DataStores/Settings/Src/SettingFile.cpp, /tmp/VisualGDB/Archos/DataStores/Settings/Src/SettingContainer.cpp, /tmp/VisualGDB/Archos/DataStores/Settings/Src/Setting.cpp, /tmp/VisualGDB/Archos/DataStores/LiveValues/Src/LiveValue_String.cpp, /tmp/VisualGDB/Archos/DataStores/LiveValues/Src/LiveValue_Long.cpp, /tmp/VisualGDB/Archos/DataStores/LiveValues/Src/LiveValue_Int.cpp, /tmp/VisualGDB/Archos/DataStores/LiveValues/Src/LiveValue_Hex.cpp, /tmp/VisualGDB/Archos/DataStores/LiveValues/Src/LiveValue_Char.cpp, /tmp/VisualGDB/Archos/DataStores/LiveValues/Src/LiveValueGroup.cpp, /tmp/VisualGDB/Archos/DataStores/LiveValues/Src/LiveValueContainer.cpp, /tmp/VisualGDB/Archos/DataStores/LiveValues/Src/LiveValue.cpp, /tmp/VisualGDB/Archos/DataStores/Commands/Src/CommandGroup.cpp, /tmp/VisualGDB/Archos/DataStores/Commands/Src/CommandContainer.cpp, /tmp/VisualGDB/Archos/DataStores/Commands/Src/Command.cpp, /tmp/VisualGDB/Archos/Camera/Src/CameraFactory.cpp, /tmp/VisualGDB/Archos/Camera/Src/Camera.cpp, /tmp/VisualGDB/Archos/Camera/NET/Src/Camera_NET.cpp, /tmp/VisualGDB/Archos/Lib/Filters/Inc/stddev.h, /tmp/VisualGDB/Archos/Lib/Filters/Inc/mediaanstd.h, /tmp/VisualGDB/Archos/DataStores/Commands/Inc/ICommandObserver.h
OK

It looks like the Application_Widtmonitor::Initialise() function can find the symbol to mPixel2MM.Initialise(); function:
Disassembly of section .text._ZN11Application12WidthMonitor25CApplication_WidthMonitor10InitializeEv:

00000000 <_zn11application12widthmonitor25capplication_widthmonitor10initializeev>:
Implementation of Initialize
@todo implement
*/
#pragma endregion
bool CApplication_WidthMonitor::Initialize(void)
{
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 53 push %ebx
4: 83 ec 24 sub $0x24,%esp
// @TODO calibration
int i = mPixel2MM.Initialise(((char *)CPixel2MMap::STR_INI_FILE.c_str()), ((char *)CPixel2MMap::STR_INI_SECTION.c_str()));
7: c7 04 24 00 00 00 00 movl $0x0,(%esp)
e: e8 fc ff ff ff call f <_zn11application12widthmonitor25capplication_widthmonitor10initializeev +0xf>
13: 89 c3 mov %eax,%ebx
15: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1c: e8 fc ff ff ff call 1d <_zn11application12widthmonitor25capplication_widthmonitor10initializeev +0x1d>
21: 8b 55 08 mov 0x8(%ebp),%edx
24: 81 c2 38 1c 00 00 add $0x1c38,%edx
2a: 89 5c 24 08 mov %ebx,0x8(%esp)
2e: 89 44 24 04 mov %eax,0x4(%esp)
32: 89 14 24 mov %edx,(%esp)
35: e8 fc ff ff ff call 36 <_zn11application12widthmonitor25capplication_widthmonitor10initializeev +0x36>
3a: 89 45 f4 mov %eax,-0xc(%ebp)

mCycleStep = STEP0_IDLE;
3d: 8b 45 08 mov 0x8(%ebp),%eax
40: c7 80 84 03 00 00 00 movl $0x0,0x384(%eax)
47: 00 00 00
//LightBar = new CLightBar();

return false;
4a: b8 00 00 00 00 mov $0x0,%eax
}
4f: 83 c4 24 add $0x24,%esp
52: 5b pop %ebx
53: 5d pop %ebp
54: c3 ret

I don’t know where to find the problem, but it seems it cannot find the source of some funtions in a file and other function he can find in the same file. 😮

August 15, 2013 at 15:49

#2518

Hi,

According to the log you posted, GDB can find the symbols for Application::WidthMonitor::CApplication_WidthMonitor class and cannot find symbols for Lib::ImgProc::CLightBar::DetectEdgesFast(Camera::TImageInfo*).
Please check whether the Lib::ImgProc::CLightBar::DetectEdgesFast(Camera::TImageInfo*) function (can be also mentioned as _ZN3Lib7ImgProc9CLightBar11DetectEdgesEPN6Camera10TImageInfoE) contains the source code in the disassembly file. If no, please run objdump on the .o file corresponding to the cpp file containing the Lib::ImgProc::CLightBar::DetectEdgesFast(Camera::TImageInfo*) function and see whether the source is displayed when dumping the .o file.

Please note that when running the “info line” command you should put the function name, not the function calling statement, e.g.:

info line Lib::ImgProc::CLightBar::DetectEdgesFast

The “info line” command will display the source line number that corresponds to a given function and can be used to determine whether the source line information is available for the given module.

August 16, 2013 at 14:20

#2519

Hi,

I have changed the location of DetectEdgesFast to the Application_WidthMonitor class. I can debug function like ProcessImage(), but i can’t debug DetectEdgesFast() of same class Application_WidthMonitor.
When I call info line, the gdb session can’t find the function:
info line DetectEdgesFast
&”info line DetectEdgesFastn”
&”Function “DetectEdgesFast” not defined.n”
Function “DetectEdgesFast” not defined.

When I search in the objdump of application_withmonitor.o I found the following that looks like he can find the symbol:
Disassembly of section .text._ZN11Application12WidthMonitor25CApplication_WidthMonitor12ProcessImageEPN6Camera10TImageInfoE:

00000000 <_zn11application12widthmonitor25capplication_widthmonitor12processimageepn6camera10timageinfoe>:
Implementation of ProcessImage
@todo implement
*/
#pragma endregion
void CApplication_WidthMonitor::ProcessImage(TImageInfo* apImageInfo)
{
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 53 push %ebx
4: 83 ec 44 sub $0x44,%esp
DetectEdgesFast(apImageInfo);
7: 8b 45 0c mov 0xc(%ebp),%eax
a: 89 44 24 04 mov %eax,0x4(%esp)
e: 8b 45 08 mov 0x8(%ebp),%eax
11: 89 04 24 mov %eax,(%esp)
14: e8 fc ff ff ff call 15 <_zn11application12widthmonitor25capplication_widthmonitor12processimageepn6camera10timageinfoe +0x15>

lftEdgePos = (edgeCount > 1 && edges[0].type == EDGE_TYPE_POS) ? mPixel2MM.Pixel2MM(edges[0].posPX, edges[0].type) : -99999;
19: 8b 45 08 mov 0x8(%ebp),%eax
1c: 8b 80 b0 03 00 00 mov 0x3b0(%eax),%eax
22: 83 f8 01 cmp $0x1,%eax
25: 76 74 jbe 9b <_zn11application12widthmonitor25capplication_widthmonitor12processimageepn6camera10timageinfoe +0x9b>
27: 8b 45 08 mov 0x8(%ebp),%eax
2a: 05 a4 03 00 00 add $0x3a4,%eax
2f: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
36: 00
37: 89 04 24 mov %eax,(%esp)
3a: e8 fc ff ff ff call 3b <_zn11application12widthmonitor25capplication_widthmonitor12processimageepn6camera10timageinfoe +0x3b>
3f: 8b 00 mov (%eax),%eax
41: 85 c0 test %eax,%eax
43: 75 56 jne 9b <_zn11application12widthmonitor25capplication_widthmonitor12processimageepn6camera10timageinfoe +0x9b>
45: 8b 45 08 mov 0x8(%ebp),%eax
48: 05 a4 03 00 00 add $0x3a4,%eax
4d: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
54: 00
55: 89 04 24 mov %eax,(%esp)
58: e8 fc ff ff ff call 59 <_zn11application12widthmonitor25capplication_widthmonitor12processimageepn6camera10timageinfoe +0x59>
5d: 8b 18 mov (%eax),%ebx
5f: 8b 45 08 mov 0x8(%ebp),%eax
62: 05 a4 03 00 00 add $0x3a4,%eax
67: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
6e: 00
6f: 89 04 24 mov %eax,(%esp)
72: e8 fc ff ff ff call 73 <_zn11application12widthmonitor25capplication_widthmonitor12processimageepn6camera10timageinfoe +0x73>
77: 8b 40 04 mov 0x4(%eax),%eax
7a: 8b 55 08 mov 0x8(%ebp),%edx
7d: 81 c2 40 1c 00 00 add $0x1c40,%edx
83: 89 5c 24 08 mov %ebx,0x8(%esp)
87: 89 44 24 04 mov %eax,0x4(%esp)
8b: 89 14 24 mov %edx,(%esp)
8e: e8 fc ff ff ff call 8f <_zn11application12widthmonitor25capplication_widthmonitor12processimageepn6camera10timageinfoe +0x8f>
93: d9 5d d4 fstps -0x2c(%ebp)
96: 8b 45 d4 mov -0x2c(%ebp),%eax
99: eb 05 jmp a0 <_zn11application12widthmonitor25capplication_widthmonitor12processimageepn6camera10timageinfoe +0xa0>
9b: b8 80 4f c3 c7 mov $0xc7c34f80,%eax
a0: 8b 55 08 mov 0x8(%ebp),%edx
a3: 89 82 7c 07 00 00 mov %eax,0x77c(%edx)
rhtEdgePos = (edgeCount > 1 && edgeCount < edges.size() && edges[edgeCount-1].type == EDGE_TYPE_NEG) ? mPixel2MM.Pixel2MM(edges[edgeCount-1].posPX, edges[edgeCount-1].type) : -99999;
a9: 8b 45 08 mov 0x8(%ebp),%eax
ac: 8b 80 b0 03 00 00 mov 0x3b0(%eax),%eax
b2: 83 f8 01 cmp $0x1,%eax
b5: 0f 86 ae 00 00 00 jbe 169 <_zn11application12widthmonitor25capplication_widthmonitor12processimageepn6camera10timageinfoe +0x169>
bb: 8b 45 08 mov 0x8(%ebp),%eax
be: 8b 98 b0 03 00 00 mov 0x3b0(%eax),%ebx
c4: 8b 45 08 mov 0x8(%ebp),%eax
c7: 05 a4 03 00 00 add $0x3a4,%eax
cc: 89 04 24 mov %eax,(%esp)
cf: e8 fc ff ff ff call d0 <_zn11application12widthmonitor25capplication_widthmonitor12processimageepn6camera10timageinfoe +0xd0>
d4: 39 c3 cmp %eax,%ebx
d6: 0f 83 8d 00 00 00 jae 169 <_zn11application12widthmonitor25capplication_widthmonitor12processimageepn6camera10timageinfoe +0x169>
dc: 8b 45 08 mov 0x8(%ebp),%eax
df: 8b 80 b0 03 00 00 mov 0x3b0(%eax),%eax
e5: 8d 50 ff lea -0x1(%eax),%edx
e8: 8b 45 08 mov 0x8(%ebp),%eax
eb: 05 a4 03 00 00 add $0x3a4,%eax
f0: 89 54 24 04 mov %edx,0x4(%esp)
f4: 89 04 24 mov %eax,(%esp)
f7: e8 fc ff ff ff call f8 <_zn11application12widthmonitor25capplication_widthmonitor12processimageepn6camera10timageinfoe +0xf8>
fc: 8b 00 mov (%eax),%eax
fe: 83 f8 01 cmp $0x1,%eax
101: 75 66 jne 169 <_zn11application12widthmonitor25capplication_widthmonitor12processimageepn6camera10timageinfoe +0x169>
103: 8b 45 08 mov 0x8(%ebp),%eax
106: 8b 80 b0 03 00 00 mov 0x3b0(%eax),%eax
10c: 8d 50 ff lea -0x1(%eax),%edx
10f: 8b 45 08 mov 0x8(%ebp),%eax
112: 05 a4 03 00 00 add $0x3a4,%eax
117: 89 54 24 04 mov %edx,0x4(%esp)
11b: 89 04 24 mov %eax,(%esp)
11e: e8 fc ff ff ff call 11f <_zn11application12widthmonitor25capplication_widthmonitor12processimageepn6camera10timageinfoe +0x11f>
123: 8b 18 mov (%eax),%ebx
125: 8b 45 08 mov 0x8(%ebp),%eax
128: 8b 80 b0 03 00 00 mov 0x3b0(%eax),%eax
12e: 8d 50 ff lea -0x1(%eax),%edx
131: 8b 45 08 mov 0x8(%ebp),%eax
134: 05 a4 03 00 00 add $0x3a4,%eax
139: 89 54 24 04 mov %edx,0x4(%esp)
13d: 89 04 24 mov %eax,(%esp)
140: e8 fc ff ff ff call 141 <_zn11application12widthmonitor25capplication_widthmonitor12processimageepn6camera10timageinfoe +0x141>
145: 8b 40 04 mov 0x4(%eax),%eax
148: 8b 55 08 mov 0x8(%ebp),%edx
14b: 81 c2 40 1c 00 00 add $0x1c40,%edx
151: 89 5c 24 08 mov %ebx,0x8(%esp)
155: 89 44 24 04 mov %eax,0x4(%esp)
159: 89 14 24 mov %edx,(%esp)
15c: e8 fc ff ff ff call 15d <_zn11application12widthmonitor25capplication_widthmonitor12processimageepn6camera10timageinfoe +0x15d>
161: d9 5d d4 fstps -0x2c(%ebp)
164: 8b 45 d4 mov -0x2c(%ebp),%eax
167: eb 05 jmp 16e <_zn11application12widthmonitor25capplication_widthmonitor12processimageepn6camera10timageinfoe +0x16e>
169: b8 80 4f c3 c7 mov $0xc7c34f80,%eax
16e: 8b 55 08 mov 0x8(%ebp),%edx
171: 89 82 80 07 00 00 mov %eax,0x780(%edx)
lftEdgeFound = (edgeCount == 2 && edges[0].type == EDGE_TYPE_POS) ? true : false;
177: 8b 45 08 mov 0x8(%ebp),%eax
17a: 8b 80 b0 03 00 00 mov 0x3b0(%eax),%eax
180: 83 f8 02 cmp $0x2,%eax
183: 75 25 jne 1aa <_zn11application12widthmonitor25capplication_widthmonitor12processimageepn6camera10timageinfoe +0x1aa>
185: 8b 45 08 mov 0x8(%ebp),%eax
188: 05 a4 03 00 00 add $0x3a4,%eax
18d: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
194: 00
195: 89 04 24 mov %eax,(%esp)
198: e8 fc ff ff ff call 199 <_zn11application12widthmonitor25capplication_widthmonitor12processimageepn6camera10timageinfoe +0x199>
19d: 8b 00 mov (%eax),%eax
19f: 85 c0 test %eax,%eax
1a1: 75 07 jne 1aa <_zn11application12widthmonitor25capplication_widthmonitor12processimageepn6camera10timageinfoe +0x1aa>
1a3: b8 01 00 00 00 mov $0x1,%eax
1a8: eb 05 jmp 1af <_zn11application12widthmonitor25capplication_widthmonitor12processimageepn6camera10timageinfoe +0x1af>
1aa: b8 00 00 00 00 mov $0x0,%eax
1af: 8b 55 08 mov 0x8(%ebp),%edx
1b2: 88 82 a4 07 00 00 mov %al,0x7a4(%edx)
rhtEdgeFound = (edgeCount == 2 && edges[1].type == EDGE_TYPE_NEG) ? true : false;
1b8: 8b 45 08 mov 0x8(%ebp),%eax
1bb: 8b 80 b0 03 00 00 mov 0x3b0(%eax),%eax
1c1: 83 f8 02 cmp $0x2,%eax
1c4: 75 26 jne 1ec <_zn11application12widthmonitor25capplication_widthmonitor12processimageepn6camera10timageinfoe +0x1ec>
1c6: 8b 45 08 mov 0x8(%ebp),%eax
1c9: 05 a4 03 00 00 add $0x3a4,%eax
1ce: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
1d5: 00
1d6: 89 04 24 mov %eax,(%esp)
1d9: e8 fc ff ff ff call 1da <_zn11application12widthmonitor25capplication_widthmonitor12processimageepn6camera10timageinfoe +0x1da>
1de: 8b 00 mov (%eax),%eax
1e0: 83 f8 01 cmp $0x1,%eax
1e3: 75 07 jne 1ec <_zn11application12widthmonitor25capplication_widthmonitor12processimageepn6camera10timageinfoe +0x1ec>
1e5: b8 01 00 00 00 mov $0x1,%eax
1ea: eb 05 jmp 1f1 <_zn11application12widthmonitor25capplication_widthmonitor12processimageepn6camera10timageinfoe +0x1f1>
1ec: b8 00 00 00 00 mov $0x0,%eax
1f1: 8b 55 08 mov 0x8(%ebp),%edx
1f4: 88 82 a5 07 00 00 mov %al,0x7a5(%edx)
center_position = (lftEdgeFound && rhtEdgeFound) ? (int)((lftEdgePos + rhtEdgePos) / 2) : -22222;
1fa: 8b 45 08 mov 0x8(%ebp),%eax
1fd: 0f b6 80 a4 07 00 00 movzbl 0x7a4(%eax),%eax
204: 84 c0 test %al,%al
206: 74 45 je 24d <_zn11application12widthmonitor25capplication_widthmonitor12processimageepn6camera10timageinfoe +0x24d>
208: 8b 45 08 mov 0x8(%ebp),%eax
20b: 0f b6 80 a5 07 00 00 movzbl 0x7a5(%eax),%eax
212: 84 c0 test %al,%al
214: 74 37 je 24d <_zn11application12widthmonitor25capplication_widthmonitor12processimageepn6camera10timageinfoe +0x24d>
216: 8b 45 08 mov 0x8(%ebp),%eax
219: d9 80 7c 07 00 00 flds 0x77c(%eax)
21f: 8b 45 08 mov 0x8(%ebp),%eax
222: d9 80 80 07 00 00 flds 0x780(%eax)
228: de c1 faddp %st,%st(1)
22a: d9 05 c8 01 00 00 flds 0x1c8
230: de f9 fdivrp %st,%st(1)
232: d9 7d e6 fnstcw -0x1a(%ebp)
235: 0f b7 45 e6 movzwl -0x1a(%ebp),%eax
239: b4 0c mov $0xc,%ah
23b: 66 89 45 e4 mov %ax,-0x1c(%ebp)
23f: d9 6d e4 fldcw -0x1c(%ebp)
242: db 5d e0 fistpl -0x20(%ebp)
245: d9 6d e6 fldcw -0x1a(%ebp)
248: 8b 45 e0 mov -0x20(%ebp),%eax
24b: eb 05 jmp 252 <_zn11application12widthmonitor25capplication_widthmonitor12processimageepn6camera10timageinfoe +0x252>
24d: b8 32 a9 ff ff mov $0xffffa932,%eax
252: 8b 55 08 mov 0x8(%ebp),%edx
255: 89 82 fc 1d 00 00 mov %eax,0x1dfc(%edx)

if (center_position == -22222)
25b: 8b 45 08 mov 0x8(%ebp),%eax
25e: 8b 80 fc 1d 00 00 mov 0x1dfc(%eax),%eax
264: 3d 32 a9 ff ff cmp $0xffffa932,%eax
269: 75 67 jne 2d2 <_zn11application12widthmonitor25capplication_widthmonitor12processimageepn6camera10timageinfoe +0x2d2>
{
FILE* myfp = fopen(“virt_line.csv”,”w”);
26b: c7 44 24 04 3c 00 00 movl $0x3c,0x4(%esp)
272: 00
273: c7 04 24 3e 00 00 00 movl $0x3e,(%esp)
27a: e8 fc ff ff ff call 27b <_zn11application12widthmonitor25capplication_widthmonitor12processimageepn6camera10timageinfoe +0x27b>
27f: 89 45 f0 mov %eax,-0x10(%ebp)

// printf(“vritual_line”);
for(int i =0; i < apImageInfo->Width; i++)
282: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
289: eb 2c jmp 2b7 <_zn11application12widthmonitor25capplication_widthmonitor12processimageepn6camera10timageinfoe +0x2b7>
{
fprintf(myfp, “%dn”,mVirtualLine);
28b: 8b 45 08 mov 0x8(%ebp),%eax
28e: 03 45 f4 add -0xc(%ebp),%eax
291: 05 e0 07 00 00 add $0x7e0,%eax
296: 0f b6 00 movzbl (%eax),%eax
299: 0f b6 c0 movzbl %al,%eax
29c: 89 44 24 08 mov %eax,0x8(%esp)
2a0: c7 44 24 04 4c 00 00 movl $0x4c,0x4(%esp)
2a7: 00
2a8: 8b 45 f0 mov -0x10(%ebp),%eax
2ab: 89 04 24 mov %eax,(%esp)
2ae: e8 fc ff ff ff call 2af <_zn11application12widthmonitor25capplication_widthmonitor12processimageepn6camera10timageinfoe +0x2af>
if (center_position == -22222)
{
FILE* myfp = fopen(“virt_line.csv”,”w”);

// printf(“vritual_line”);
for(int i =0; i < apImageInfo->Width; i++)
2b3: 83 45 f4 01 addl $0x1,-0xc(%ebp)
2b7: 8b 45 0c mov 0xc(%ebp),%eax
2ba: 8b 40 10 mov 0x10(%eax),%eax
2bd: 3b 45 f4 cmp -0xc(%ebp),%eax
2c0: 0f 9f c0 setg %al
2c3: 84 c0 test %al,%al
2c5: 75 c4 jne 28b <_zn11application12widthmonitor25capplication_widthmonitor12processimageepn6camera10timageinfoe +0x28b>
{
fprintf(myfp, “%dn”,mVirtualLine);
}
fclose(myfp);
2c7: 8b 45 f0 mov -0x10(%ebp),%eax
2ca: 89 04 24 mov %eax,(%esp)
2cd: e8 fc ff ff ff call 2ce <_zn11application12widthmonitor25capplication_widthmonitor12processimageepn6camera10timageinfoe +0x2ce>
case STEP7_CHECKCALIB:
//mpCalibration->ProcessImage(imagePtr);
break;
}
*/
}
2d2: 83 c4 44 add $0x44,%esp
2d5: 5b pop %ebx
2d6: 5d pop %ebp
2d7: c3 ret

August 16, 2013 at 17:20

#2520

Hi,

When using info line, please use the full name including the namespace and class, otherwise the function cannot be found. If you changed the location to the CApplication_WidthMonitor class, then you probably need to use the following command:

info line Application::WidthMonitor::CApplication_WidthMonitor::DetectEdgesFast

The objdump you have included shows that there are symbols for the CApplication_WidthMonitor::ProcessImage(TImageInfo* apImageInfo) function, but it does not show the symbols for the DetectEdgesFast function. Having a call to DetectEdgesFast inside another function does not mean that there are symbols for DetectEdgesFast. Please find where the DetectEdgesFast function is defined inside the objdump of the o file.

August 19, 2013 at 06:36

#2521

Hi Ket,

Sorry for posting the wrong info. For now the info line works and result in the following:

info line Application::WidthMonitor::CApplication_WidthMonitor::DetectEdgesFast
&”info line Application::WidthMonitor::CApplication_WidthMonitor::DetectEdgesFastn”
No line number information available for address 0x804c190 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe>
OK

Here is the DetectEdgesFast function in Application_WidthMonitor.o:

Disassembly of section .text._ZN11Application12WidthMonitor25CApplication_WidthMonitor15DetectEdgesFastEPN6Camera10TImageInfoE:

00000000 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe>:

void CApplication_WidthMonitor::DetectEdgesFast(TImageInfo* image)
{
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 53 push %ebx
4: 81 ec 84 00 00 00 sub $0x84,%esp
// @ TODO implement Intensityfilter
if (mpIntensityFilter) { mpIntensityFilter->Initialise(); }
a: 8b 45 08 mov 0x8(%ebp),%eax
d: 8b 80 c8 07 00 00 mov 0x7c8(%eax),%eax
13: 85 c0 test %eax,%eax
15: 74 1e je 35 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x35>
17: 8b 45 08 mov 0x8(%ebp),%eax
1a: 8b 80 c8 07 00 00 mov 0x7c8(%eax),%eax
20: 8b 00 mov (%eax),%eax
22: 83 c0 08 add $0x8,%eax
25: 8b 10 mov (%eax),%edx
27: 8b 45 08 mov 0x8(%ebp),%eax
2a: 8b 80 c8 07 00 00 mov 0x7c8(%eax),%eax
30: 89 04 24 mov %eax,(%esp)
33: ff d2 call *%edx
TImagePtr columPtr;
int inc;

if (mLeftsideRight)
35: 8b 45 08 mov 0x8(%ebp),%eax
38: 0f b6 80 3c 1c 00 00 movzbl 0x1c3c(%eax),%eax
3f: 84 c0 test %al,%al
41: 74 40 je 83 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x83>
{
columPtr = image->Image + ROIOffsetX + image->Width – 1 + ROIOffsetY * image->Pitch;
43: 8b 45 0c mov 0xc(%ebp),%eax
46: 8b 10 mov (%eax),%edx
48: 8b 45 08 mov 0x8(%ebp),%eax
4b: 8b 80 c4 07 00 00 mov 0x7c4(%eax),%eax
51: 89 c1 mov %eax,%ecx
53: 8b 45 0c mov 0xc(%ebp),%eax
56: 8b 40 10 mov 0x10(%eax),%eax
59: 8d 1c 01 lea (%ecx,%eax,1),%ebx
5c: 8b 45 08 mov 0x8(%ebp),%eax
5f: 8b 88 c0 07 00 00 mov 0x7c0(%eax),%ecx
65: 8b 45 0c mov 0xc(%ebp),%eax
68: 8b 40 18 mov 0x18(%eax),%eax
6b: 0f af c1 imul %ecx,%eax
6e: 8d 04 03 lea (%ebx,%eax,1),%eax
71: 83 e8 01 sub $0x1,%eax
74: 8d 04 02 lea (%edx,%eax,1),%eax
77: 89 45 f4 mov %eax,-0xc(%ebp)
inc = -1;
7a: c7 45 f0 ff ff ff ff movl $0xffffffff,-0x10(%ebp)
81: eb 32 jmp b5 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0xb5>
}
else
{
columPtr = image->Image + ROIOffsetX + ROIOffsetY * image->Pitch;
83: 8b 45 0c mov 0xc(%ebp),%eax
86: 8b 10 mov (%eax),%edx
88: 8b 45 08 mov 0x8(%ebp),%eax
8b: 8b 80 c4 07 00 00 mov 0x7c4(%eax),%eax
91: 89 c1 mov %eax,%ecx
93: 8b 45 08 mov 0x8(%ebp),%eax
96: 8b 98 c0 07 00 00 mov 0x7c0(%eax),%ebx
9c: 8b 45 0c mov 0xc(%ebp),%eax
9f: 8b 40 18 mov 0x18(%eax),%eax
a2: 0f af c3 imul %ebx,%eax
a5: 8d 04 01 lea (%ecx,%eax,1),%eax
a8: 8d 04 02 lea (%edx,%eax,1),%eax
ab: 89 45 f4 mov %eax,-0xc(%ebp)
inc = 1;
ae: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
}

unsigned int delay=mpIntensityFilter==NULL ? 0 : (unsigned int)mpIntensityFilter->Delay();
b5: 8b 45 08 mov 0x8(%ebp),%eax
b8: 8b 80 c8 07 00 00 mov 0x7c8(%eax),%eax
be: 85 c0 test %eax,%eax
c0: 74 2f je f1 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0xf1>
c2: 8b 45 08 mov 0x8(%ebp),%eax
c5: 8b 80 c8 07 00 00 mov 0x7c8(%eax),%eax
cb: 89 04 24 mov %eax,(%esp)
ce: e8 fc ff ff ff call cf <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0xcf>
d3: d9 7d b6 fnstcw -0x4a(%ebp)
d6: 0f b7 45 b6 movzwl -0x4a(%ebp),%eax
da: b4 0c mov $0xc,%ah
dc: 66 89 45 b4 mov %ax,-0x4c(%ebp)
e0: d9 6d b4 fldcw -0x4c(%ebp)
e3: df 7d a8 fistpll -0x58(%ebp)
e6: d9 6d b6 fldcw -0x4a(%ebp)
e9: 8b 45 a8 mov -0x58(%ebp),%eax
ec: 8b 55 ac mov -0x54(%ebp),%edx
ef: eb 05 jmp f6 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0xf6>
f1: b8 00 00 00 00 mov $0x0,%eax
f6: 89 45 c4 mov %eax,-0x3c(%ebp)
unsigned char minIntensity = 255;
f9: c6 45 ef ff movb $0xff,-0x11(%ebp)
unsigned char maxIntensity = 0;
fd: c6 45 ee 00 movb $0x0,-0x12(%ebp)

// @TODO Implement treshold value from ini setting
//unsigned char threshold = (unsigned char) (float)(pScanSettings->mLimHigh + pScanSettings->mLimLow)/2;
unsigned char threshold = 50;
101: c6 45 c3 32 movb $0x32,-0x3d(%ebp)
TEdgeDetectionState prvState = EDGE_DETECTION_STABLE;
105: c7 45 e8 00 00 00 00 movl $0x0,-0x18(%ebp)
unsigned char prvFilteredIntensity = 0;
10c: c6 45 e7 00 movb $0x0,-0x19(%ebp)

bool pendingPosEdge = false;
110: c6 45 e6 00 movb $0x0,-0x1a(%ebp)
bool pendingNegEdge = false;
114: c6 45 e5 00 movb $0x0,-0x1b(%ebp)
unsigned char edge_maximum = 0;
118: c6 45 e4 00 movb $0x0,-0x1c(%ebp)
unsigned char edge_minimum = 0;
11c: c6 45 e3 00 movb $0x0,-0x1d(%ebp)
unsigned char local_max = 0;
120: c6 45 e2 00 movb $0x0,-0x1e(%ebp)
unsigned char local_min = 0;
124: c6 45 e1 00 movb $0x0,-0x1f(%ebp)

for (unsigned int i=0; iWidth; i++)
128: c7 45 dc 00 00 00 00 movl $0x0,-0x24(%ebp)
12f: e9 0c 03 00 00 jmp 440 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x440>
{
int sum = 0;
134: c7 45 d8 00 00 00 00 movl $0x0,-0x28(%ebp)
TImagePtr pixel = columPtr;
13b: 8b 45 f4 mov -0xc(%ebp),%eax
13e: 89 45 d4 mov %eax,-0x2c(%ebp)

if (imageHeight==1)
141: 8b 45 08 mov 0x8(%ebp),%eax
144: 8b 80 b0 07 00 00 mov 0x7b0(%eax),%eax
14a: 83 f8 01 cmp $0x1,%eax
14d: 75 16 jne 165 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x165>
{
mVirtualLine = *pixel;
14f: 8b 45 d4 mov -0x2c(%ebp),%eax
152: 0f b6 00 movzbl (%eax),%eax
155: 8b 55 08 mov 0x8(%ebp),%edx
158: 03 55 dc add -0x24(%ebp),%edx
15b: 81 c2 e0 07 00 00 add $0x7e0,%edx
161: 88 02 mov %al,(%edx)
163: eb 5a jmp 1bf <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x1bf>
}
else
{
for (unsigned int j=0; j
165: c7 45 d0 00 00 00 00 movl $0x0,-0x30(%ebp)
16c: eb 19 jmp 187 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x187>
{
sum+=*pixel;
16e: 8b 45 d4 mov -0x2c(%ebp),%eax
171: 0f b6 00 movzbl (%eax),%eax
174: 0f b6 c0 movzbl %al,%eax
177: 01 45 d8 add %eax,-0x28(%ebp)
pixel+=image->Pitch;
17a: 8b 45 0c mov 0xc(%ebp),%eax
17d: 8b 40 18 mov 0x18(%eax),%eax
180: 01 45 d4 add %eax,-0x2c(%ebp)
{
mVirtualLine = *pixel;
}
else
{
for (unsigned int j=0; j
183: 83 45 d0 01 addl $0x1,-0x30(%ebp)
187: 8b 45 08 mov 0x8(%ebp),%eax
18a: 8b 80 b0 07 00 00 mov 0x7b0(%eax),%eax
190: 3b 45 d0 cmp -0x30(%ebp),%eax
193: 0f 97 c0 seta %al
196: 84 c0 test %al,%al
198: 75 d4 jne 16e <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x16e>
{
sum+=*pixel;
pixel+=image->Pitch;
}
mVirtualLine = sum / imageHeight;
19a: 8b 45 08 mov 0x8(%ebp),%eax
19d: 8b 80 b0 07 00 00 mov 0x7b0(%eax),%eax
1a3: 89 45 a4 mov %eax,-0x5c(%ebp)
1a6: 8b 45 d8 mov -0x28(%ebp),%eax
1a9: 89 c2 mov %eax,%edx
1ab: c1 fa 1f sar $0x1f,%edx
1ae: f7 7d a4 idivl -0x5c(%ebp)
1b1: 8b 55 08 mov 0x8(%ebp),%edx
1b4: 03 55 dc add -0x24(%ebp),%edx
1b7: 81 c2 e0 07 00 00 add $0x7e0,%edx
1bd: 88 02 mov %al,(%edx)
}
}
*/

unsigned char filteredIntensity;
if (mpIntensityFilter)
1bf: 8b 45 08 mov 0x8(%ebp),%eax
1c2: 8b 80 c8 07 00 00 mov 0x7c8(%eax),%eax
1c8: 85 c0 test %eax,%eax
1ca: 74 49 je 215 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x215>
{
mpIntensityFilter->Update(mVirtualLine);
1cc: 8b 45 08 mov 0x8(%ebp),%eax
1cf: 8b 80 c8 07 00 00 mov 0x7c8(%eax),%eax
1d5: 8b 00 mov (%eax),%eax
1d7: 83 c0 18 add $0x18,%eax
1da: 8b 08 mov (%eax),%ecx
1dc: 8b 45 08 mov 0x8(%ebp),%eax
1df: 03 45 dc add -0x24(%ebp),%eax
1e2: 05 e0 07 00 00 add $0x7e0,%eax
1e7: 0f b6 00 movzbl (%eax),%eax
1ea: 0f b6 d0 movzbl %al,%edx
1ed: 8b 45 08 mov 0x8(%ebp),%eax
1f0: 8b 80 c8 07 00 00 mov 0x7c8(%eax),%eax
1f6: 89 54 24 04 mov %edx,0x4(%esp)
1fa: 89 04 24 mov %eax,(%esp)
1fd: ff d1 call *%ecx
filteredIntensity = mpIntensityFilter->Get();
1ff: 8b 45 08 mov 0x8(%ebp),%eax
202: 8b 80 c8 07 00 00 mov 0x7c8(%eax),%eax
208: 89 04 24 mov %eax,(%esp)
20b: e8 fc ff ff ff call 20c <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x20c>
210: 88 45 cf mov %al,-0x31(%ebp)
213: eb 11 jmp 226 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x226>
}
else
{
filteredIntensity = mVirtualLine;
215: 8b 45 08 mov 0x8(%ebp),%eax
218: 03 45 dc add -0x24(%ebp),%eax
21b: 05 e0 07 00 00 add $0x7e0,%eax
220: 0f b6 00 movzbl (%eax),%eax
223: 88 45 cf mov %al,-0x31(%ebp)
}
mFilteredLine
= filteredIntensity;
226: 8b 45 08 mov 0x8(%ebp),%eax
229: 8d 90 20 1c 00 00 lea 0x1c20(%eax),%edx
22f: 8b 45 dc mov -0x24(%ebp),%eax
232: 89 44 24 04 mov %eax,0x4(%esp)
236: 89 14 24 mov %edx,(%esp)
239: e8 fc ff ff ff call 23a <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x23a>
23e: 0f b6 55 cf movzbl -0x31(%ebp),%edx
242: 88 10 mov %dl,(%eax)

if (i==0) { prvFilteredIntensity = filteredIntensity; }
244: 83 7d dc 00 cmpl $0x0,-0x24(%ebp)
248: 75 07 jne 251 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x251>
24a: 0f b6 45 cf movzbl -0x31(%ebp),%eax
24e: 88 45 e7 mov %al,-0x19(%ebp)

if (filteredIntensity < minIntensity) { minIntensity = (unsigned char)filteredIntensity; }
251: 0f b6 45 cf movzbl -0x31(%ebp),%eax
255: 3a 45 ef cmp -0x11(%ebp),%al
258: 73 07 jae 261 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x261>
25a: 0f b6 45 cf movzbl -0x31(%ebp),%eax
25e: 88 45 ef mov %al,-0x11(%ebp)
if (filteredIntensity > maxIntensity) { maxIntensity = (unsigned char)filteredIntensity; }
261: 0f b6 45 cf movzbl -0x31(%ebp),%eax
265: 3a 45 ee cmp -0x12(%ebp),%al
268: 76 07 jbe 271 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x271>
26a: 0f b6 45 cf movzbl -0x31(%ebp),%eax
26e: 88 45 ee mov %al,-0x12(%ebp)

TEdgeDetectionState state = EDGE_DETECTION_STABLE;
271: c7 45 c8 00 00 00 00 movl $0x0,-0x38(%ebp)

//rising
if (filteredIntensity-prvFilteredIntensity > 0)
278: 0f b6 55 cf movzbl -0x31(%ebp),%edx
27c: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
280: 89 d1 mov %edx,%ecx
282: 29 c1 sub %eax,%ecx
284: 89 c8 mov %ecx,%eax
286: 85 c0 test %eax,%eax
288: 7e 5b jle 2e5 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x2e5>
{
state = EDGE_DETECTION_RISING;
28a: c7 45 c8 01 00 00 00 movl $0x1,-0x38(%ebp)
local_max = filteredIntensity;
291: 0f b6 45 cf movzbl -0x31(%ebp),%eax
295: 88 45 e2 mov %al,-0x1e(%ebp)
if (prvState != EDGE_DETECTION_RISING)
298: 83 7d e8 01 cmpl $0x1,-0x18(%ebp)
29c: 74 47 je 2e5 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x2e5>
{
if (prvState == EDGE_DETECTION_FALLING) { local_min = prvFilteredIntensity; }
29e: 83 7d e8 02 cmpl $0x2,-0x18(%ebp)
2a2: 75 07 jne 2ab <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x2ab>
2a4: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
2a8: 88 45 e1 mov %al,-0x1f(%ebp)

if (pendingPosEdge)
2ab: 80 7d e6 00 cmpb $0x0,-0x1a(%ebp)
2af: 74 34 je 2e5 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x2e5>
{
//add pos edge
pendingPosEdge = false;
2b1: c6 45 e6 00 movb $0x0,-0x1a(%ebp)
edge_minimum = local_min;
2b5: 0f b6 45 e1 movzbl -0x1f(%ebp),%eax
2b9: 88 45 e3 mov %al,-0x1d(%ebp)
AddPosEdge(i, edge_minimum, edge_maximum, delay);
2bc: 0f b6 55 e4 movzbl -0x1c(%ebp),%edx
2c0: 0f b6 45 e3 movzbl -0x1d(%ebp),%eax
2c4: 8b 4d c4 mov -0x3c(%ebp),%ecx
2c7: 89 4c 24 10 mov %ecx,0x10(%esp)
2cb: 89 54 24 0c mov %edx,0xc(%esp)
2cf: 89 44 24 08 mov %eax,0x8(%esp)
2d3: 8b 45 dc mov -0x24(%ebp),%eax
2d6: 89 44 24 04 mov %eax,0x4(%esp)
2da: 8b 45 08 mov 0x8(%ebp),%eax
2dd: 89 04 24 mov %eax,(%esp)
2e0: e8 fc ff ff ff call 2e1 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x2e1>
}
}
}

//falling
if (filteredIntensity-prvFilteredIntensity < 0)
2e5: 0f b6 55 cf movzbl -0x31(%ebp),%edx
2e9: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
2ed: 89 d1 mov %edx,%ecx
2ef: 29 c1 sub %eax,%ecx
2f1: 89 c8 mov %ecx,%eax
2f3: 85 c0 test %eax,%eax
2f5: 79 5b jns 352 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x352>
{
state = EDGE_DETECTION_FALLING;
2f7: c7 45 c8 02 00 00 00 movl $0x2,-0x38(%ebp)
local_min = filteredIntensity;
2fe: 0f b6 45 cf movzbl -0x31(%ebp),%eax
302: 88 45 e1 mov %al,-0x1f(%ebp)
if (prvState != EDGE_DETECTION_FALLING)
305: 83 7d e8 02 cmpl $0x2,-0x18(%ebp)
309: 74 47 je 352 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x352>
{
if (prvState == EDGE_DETECTION_RISING) { local_max = prvFilteredIntensity; }
30b: 83 7d e8 01 cmpl $0x1,-0x18(%ebp)
30f: 75 07 jne 318 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x318>
311: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
315: 88 45 e2 mov %al,-0x1e(%ebp)

if (pendingNegEdge)
318: 80 7d e5 00 cmpb $0x0,-0x1b(%ebp)
31c: 74 34 je 352 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x352>
{
//add neg edge
pendingNegEdge = false;
31e: c6 45 e5 00 movb $0x0,-0x1b(%ebp)
edge_maximum = local_max;
322: 0f b6 45 e2 movzbl -0x1e(%ebp),%eax
326: 88 45 e4 mov %al,-0x1c(%ebp)
AddNegEdge(i, edge_minimum, edge_maximum, delay);
329: 0f b6 55 e4 movzbl -0x1c(%ebp),%edx
32d: 0f b6 45 e3 movzbl -0x1d(%ebp),%eax
331: 8b 4d c4 mov -0x3c(%ebp),%ecx
334: 89 4c 24 10 mov %ecx,0x10(%esp)
338: 89 54 24 0c mov %edx,0xc(%esp)
33c: 89 44 24 08 mov %eax,0x8(%esp)
340: 8b 45 dc mov -0x24(%ebp),%eax
343: 89 44 24 04 mov %eax,0x4(%esp)
347: 8b 45 08 mov 0x8(%ebp),%eax
34a: 89 04 24 mov %eax,(%esp)
34d: e8 fc ff ff ff call 34e <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x34e>
}
}
}

//nor falling, nor rising
if (filteredIntensity-prvFilteredIntensity == 0)
352: 0f b6 45 cf movzbl -0x31(%ebp),%eax
356: 3a 45 e7 cmp -0x19(%ebp),%al
359: 0f 85 8e 00 00 00 jne 3ed <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x3ed>
{
//check for pending edges

//negative edge:
if (prvState != EDGE_DETECTION_FALLING) { local_max = prvFilteredIntensity; }
35f: 83 7d e8 02 cmpl $0x2,-0x18(%ebp)
363: 74 07 je 36c <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x36c>
365: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
369: 88 45 e2 mov %al,-0x1e(%ebp)

if (pendingNegEdge)
36c: 80 7d e5 00 cmpb $0x0,-0x1b(%ebp)
370: 74 34 je 3a6 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x3a6>
{
//add neg edge
pendingNegEdge = false;
372: c6 45 e5 00 movb $0x0,-0x1b(%ebp)
edge_maximum = local_max;
376: 0f b6 45 e2 movzbl -0x1e(%ebp),%eax
37a: 88 45 e4 mov %al,-0x1c(%ebp)
AddNegEdge(i, edge_minimum, edge_maximum, delay);
37d: 0f b6 55 e4 movzbl -0x1c(%ebp),%edx
381: 0f b6 45 e3 movzbl -0x1d(%ebp),%eax
385: 8b 4d c4 mov -0x3c(%ebp),%ecx
388: 89 4c 24 10 mov %ecx,0x10(%esp)
38c: 89 54 24 0c mov %edx,0xc(%esp)
390: 89 44 24 08 mov %eax,0x8(%esp)
394: 8b 45 dc mov -0x24(%ebp),%eax
397: 89 44 24 04 mov %eax,0x4(%esp)
39b: 8b 45 08 mov 0x8(%ebp),%eax
39e: 89 04 24 mov %eax,(%esp)
3a1: e8 fc ff ff ff call 3a2 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x3a2>
}

//positive edge
if (prvState != EDGE_DETECTION_RISING) { local_min = prvFilteredIntensity; }
3a6: 83 7d e8 01 cmpl $0x1,-0x18(%ebp)
3aa: 74 07 je 3b3 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x3b3>
3ac: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
3b0: 88 45 e1 mov %al,-0x1f(%ebp)

if (pendingPosEdge)
3b3: 80 7d e6 00 cmpb $0x0,-0x1a(%ebp)
3b7: 74 34 je 3ed <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x3ed>
{
//add pos edge
pendingPosEdge = false;
3b9: c6 45 e6 00 movb $0x0,-0x1a(%ebp)
edge_minimum = local_min;
3bd: 0f b6 45 e1 movzbl -0x1f(%ebp),%eax
3c1: 88 45 e3 mov %al,-0x1d(%ebp)
AddPosEdge(i, edge_minimum, edge_maximum, delay);
3c4: 0f b6 55 e4 movzbl -0x1c(%ebp),%edx
3c8: 0f b6 45 e3 movzbl -0x1d(%ebp),%eax
3cc: 8b 4d c4 mov -0x3c(%ebp),%ecx
3cf: 89 4c 24 10 mov %ecx,0x10(%esp)
3d3: 89 54 24 0c mov %edx,0xc(%esp)
3d7: 89 44 24 08 mov %eax,0x8(%esp)
3db: 8b 45 dc mov -0x24(%ebp),%eax
3de: 89 44 24 04 mov %eax,0x4(%esp)
3e2: 8b 45 08 mov 0x8(%ebp),%eax
3e5: 89 04 24 mov %eax,(%esp)
3e8: e8 fc ff ff ff call 3e9 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x3e9>
}
}

if (filteredIntensity > threshold && prvFilteredIntensity < = threshold )
3ed: 0f b6 45 cf movzbl -0x31(%ebp),%eax
3f1: 3a 45 c3 cmp -0x3d(%ebp),%al
3f4: 76 16 jbe 40c <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x40c>
3f6: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
3fa: 3a 45 c3 cmp -0x3d(%ebp),%al
3fd: 77 0d ja 40c <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x40c>
{
pendingNegEdge = true;
3ff: c6 45 e5 01 movb $0x1,-0x1b(%ebp)
edge_minimum = local_min;
403: 0f b6 45 e1 movzbl -0x1f(%ebp),%eax
407: 88 45 e3 mov %al,-0x1d(%ebp)
40a: eb 1d jmp 429 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x429>
}
else if (filteredIntensity < threshold && prvFilteredIntensity >= threshold )
40c: 0f b6 45 cf movzbl -0x31(%ebp),%eax
410: 3a 45 c3 cmp -0x3d(%ebp),%al
413: 73 14 jae 429 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x429>
415: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
419: 3a 45 c3 cmp -0x3d(%ebp),%al
41c: 72 0b jb 429 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x429>
{
pendingPosEdge = true;
41e: c6 45 e6 01 movb $0x1,-0x1a(%ebp)
edge_maximum = local_max;
422: 0f b6 45 e2 movzbl -0x1e(%ebp),%eax
426: 88 45 e4 mov %al,-0x1c(%ebp)
}

prvState = state;
429: 8b 45 c8 mov -0x38(%ebp),%eax
42c: 89 45 e8 mov %eax,-0x18(%ebp)
prvFilteredIntensity = filteredIntensity;
42f: 0f b6 45 cf movzbl -0x31(%ebp),%eax
433: 88 45 e7 mov %al,-0x19(%ebp)
columPtr += inc;
436: 8b 45 f0 mov -0x10(%ebp),%eax
439: 01 45 f4 add %eax,-0xc(%ebp)
unsigned char edge_maximum = 0;
unsigned char edge_minimum = 0;
unsigned char local_max = 0;
unsigned char local_min = 0;

for (unsigned int i=0; iWidth; i++)
43c: 83 45 dc 01 addl $0x1,-0x24(%ebp)
440: 8b 45 0c mov 0xc(%ebp),%eax
443: 8b 40 10 mov 0x10(%eax),%eax
446: 3b 45 dc cmp -0x24(%ebp),%eax
449: 0f 97 c0 seta %al
44c: 84 c0 test %al,%al
44e: 0f 85 e0 fc ff ff jne 134 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x134>
prvState = state;
prvFilteredIntensity = filteredIntensity;
columPtr += inc;
}

diagMinPixelVal = minIntensity;
454: 0f b6 55 ef movzbl -0x11(%ebp),%edx
458: 8b 45 08 mov 0x8(%ebp),%eax
45b: 89 90 d8 07 00 00 mov %edx,0x7d8(%eax)
diagMaxPixelVal = maxIntensity;
461: 0f b6 55 ee movzbl -0x12(%ebp),%edx
465: 8b 45 08 mov 0x8(%ebp),%eax
468: 89 90 dc 07 00 00 mov %edx,0x7dc(%eax)
}
46e: 81 c4 84 00 00 00 add $0x84,%esp
474: 5b pop %ebx
475: 5d pop %ebp
476: c3 ret

August 19, 2013 at 16:13

#2522

Hi,

Based on the info line command, gdb cannot find the function source file. However, based on the o file, the symbols of the function are there. Now run the objdump command on your executable, not the o file, look if symbols for CApplication_WidthMonitor::DetectEdgesFast are present:

objdump d S <your executable name here></your>

If yes, this could be a GDB bug. If no, the symbols are discarded during your build process and analyzing the exact commands ran to build the executable from the .o files should provide enough clues.

August 20, 2013 at 08:06

#2523

Hi Ket,

Yes I found the following in the binary executable:

0804c1e0 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe>:

void CApplication_WidthMonitor::DetectEdgesFast(TImageInfo* image)
{
804c1e0: 55 push %ebp
804c1e1: 89 e5 mov %esp,%ebp
804c1e3: 53 push %ebx
804c1e4: 81 ec 84 00 00 00 sub $0x84,%esp
// @ TODO implement Intensityfilter
if (mpIntensityFilter) { mpIntensityFilter->Initialise(); }
804c1ea: 8b 45 08 mov 0x8(%ebp),%eax
804c1ed: 8b 80 c8 07 00 00 mov 0x7c8(%eax),%eax
804c1f3: 85 c0 test %eax,%eax
804c1f5: 74 1e je 804c215 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x35>
804c1f7: 8b 45 08 mov 0x8(%ebp),%eax
804c1fa: 8b 80 c8 07 00 00 mov 0x7c8(%eax),%eax
804c200: 8b 00 mov (%eax),%eax
804c202: 83 c0 08 add $0x8,%eax
804c205: 8b 10 mov (%eax),%edx
804c207: 8b 45 08 mov 0x8(%ebp),%eax
804c20a: 8b 80 c8 07 00 00 mov 0x7c8(%eax),%eax
804c210: 89 04 24 mov %eax,(%esp)
804c213: ff d2 call *%edx
TImagePtr columPtr;
int inc;

if (mLeftsideRight)
804c215: 8b 45 08 mov 0x8(%ebp),%eax
804c218: 0f b6 80 3c 1c 00 00 movzbl 0x1c3c(%eax),%eax
804c21f: 84 c0 test %al,%al
804c221: 74 40 je 804c263 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x83>
{
columPtr = image->Image + ROIOffsetX + image->Width – 1 + ROIOffsetY * image->Pitch;
804c223: 8b 45 0c mov 0xc(%ebp),%eax
804c226: 8b 10 mov (%eax),%edx
804c228: 8b 45 08 mov 0x8(%ebp),%eax
804c22b: 8b 80 c4 07 00 00 mov 0x7c4(%eax),%eax
804c231: 89 c1 mov %eax,%ecx
804c233: 8b 45 0c mov 0xc(%ebp),%eax
804c236: 8b 40 10 mov 0x10(%eax),%eax
804c239: 8d 1c 01 lea (%ecx,%eax,1),%ebx
804c23c: 8b 45 08 mov 0x8(%ebp),%eax
804c23f: 8b 88 c0 07 00 00 mov 0x7c0(%eax),%ecx
804c245: 8b 45 0c mov 0xc(%ebp),%eax
804c248: 8b 40 18 mov 0x18(%eax),%eax
804c24b: 0f af c1 imul %ecx,%eax
804c24e: 8d 04 03 lea (%ebx,%eax,1),%eax
804c251: 83 e8 01 sub $0x1,%eax
804c254: 8d 04 02 lea (%edx,%eax,1),%eax
804c257: 89 45 f4 mov %eax,-0xc(%ebp)
inc = -1;
804c25a: c7 45 f0 ff ff ff ff movl $0xffffffff,-0x10(%ebp)
804c261: eb 32 jmp 804c295 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0xb5>
}
else
{
columPtr = image->Image + ROIOffsetX + ROIOffsetY * image->Pitch;
804c263: 8b 45 0c mov 0xc(%ebp),%eax
804c266: 8b 10 mov (%eax),%edx
804c268: 8b 45 08 mov 0x8(%ebp),%eax
804c26b: 8b 80 c4 07 00 00 mov 0x7c4(%eax),%eax
804c271: 89 c1 mov %eax,%ecx
804c273: 8b 45 08 mov 0x8(%ebp),%eax
804c276: 8b 98 c0 07 00 00 mov 0x7c0(%eax),%ebx
804c27c: 8b 45 0c mov 0xc(%ebp),%eax
804c27f: 8b 40 18 mov 0x18(%eax),%eax
804c282: 0f af c3 imul %ebx,%eax
804c285: 8d 04 01 lea (%ecx,%eax,1),%eax
804c288: 8d 04 02 lea (%edx,%eax,1),%eax
804c28b: 89 45 f4 mov %eax,-0xc(%ebp)
inc = 1;
804c28e: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
}

unsigned int delay=mpIntensityFilter==NULL ? 0 : (unsigned int)mpIntensityFilter->Delay();
804c295: 8b 45 08 mov 0x8(%ebp),%eax
804c298: 8b 80 c8 07 00 00 mov 0x7c8(%eax),%eax
804c29e: 85 c0 test %eax,%eax
804c2a0: 74 2f je 804c2d1 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0xf1>
804c2a2: 8b 45 08 mov 0x8(%ebp),%eax
804c2a5: 8b 80 c8 07 00 00 mov 0x7c8(%eax),%eax
804c2ab: 89 04 24 mov %eax,(%esp)
804c2ae: e8 f5 07 00 00 call 804caa8 <_zn7cfilterihe5delayev>
804c2b3: d9 7d b6 fnstcw -0x4a(%ebp)
804c2b6: 0f b7 45 b6 movzwl -0x4a(%ebp),%eax
804c2ba: b4 0c mov $0xc,%ah
804c2bc: 66 89 45 b4 mov %ax,-0x4c(%ebp)
804c2c0: d9 6d b4 fldcw -0x4c(%ebp)
804c2c3: df 7d a8 fistpll -0x58(%ebp)
804c2c6: d9 6d b6 fldcw -0x4a(%ebp)
804c2c9: 8b 45 a8 mov -0x58(%ebp),%eax
804c2cc: 8b 55 ac mov -0x54(%ebp),%edx
804c2cf: eb 05 jmp 804c2d6 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0xf6>
804c2d1: b8 00 00 00 00 mov $0x0,%eax
804c2d6: 89 45 c4 mov %eax,-0x3c(%ebp)
unsigned char minIntensity = 255;
804c2d9: c6 45 ef ff movb $0xff,-0x11(%ebp)
unsigned char maxIntensity = 0;
804c2dd: c6 45 ee 00 movb $0x0,-0x12(%ebp)

// @TODO Implement treshold value from ini setting
//unsigned char threshold = (unsigned char) (float)(pScanSettings->mLimHigh + pScanSettings->mLimLow)/2;
unsigned char threshold = 50;
804c2e1: c6 45 c3 32 movb $0x32,-0x3d(%ebp)
TEdgeDetectionState prvState = EDGE_DETECTION_STABLE;
804c2e5: c7 45 e8 00 00 00 00 movl $0x0,-0x18(%ebp)
unsigned char prvFilteredIntensity = 0;
804c2ec: c6 45 e7 00 movb $0x0,-0x19(%ebp)

bool pendingPosEdge = false;
804c2f0: c6 45 e6 00 movb $0x0,-0x1a(%ebp)
bool pendingNegEdge = false;
804c2f4: c6 45 e5 00 movb $0x0,-0x1b(%ebp)
unsigned char edge_maximum = 0;
804c2f8: c6 45 e4 00 movb $0x0,-0x1c(%ebp)
unsigned char edge_minimum = 0;
804c2fc: c6 45 e3 00 movb $0x0,-0x1d(%ebp)
unsigned char local_max = 0;
804c300: c6 45 e2 00 movb $0x0,-0x1e(%ebp)
unsigned char local_min = 0;
804c304: c6 45 e1 00 movb $0x0,-0x1f(%ebp)

for (unsigned int i=0; iWidth; i++)
804c308: c7 45 dc 00 00 00 00 movl $0x0,-0x24(%ebp)
804c30f: e9 0c 03 00 00 jmp 804c620 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x440>
{
int sum = 0;
804c314: c7 45 d8 00 00 00 00 movl $0x0,-0x28(%ebp)
TImagePtr pixel = columPtr;
804c31b: 8b 45 f4 mov -0xc(%ebp),%eax
804c31e: 89 45 d4 mov %eax,-0x2c(%ebp)

if (imageHeight==1)
804c321: 8b 45 08 mov 0x8(%ebp),%eax
804c324: 8b 80 b0 07 00 00 mov 0x7b0(%eax),%eax
804c32a: 83 f8 01 cmp $0x1,%eax
804c32d: 75 16 jne 804c345 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x165>
{
mVirtualLine = *pixel;
804c32f: 8b 45 d4 mov -0x2c(%ebp),%eax
804c332: 0f b6 00 movzbl (%eax),%eax
804c335: 8b 55 08 mov 0x8(%ebp),%edx
804c338: 03 55 dc add -0x24(%ebp),%edx
804c33b: 81 c2 e0 07 00 00 add $0x7e0,%edx
804c341: 88 02 mov %al,(%edx)
804c343: eb 5a jmp 804c39f <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x1bf>
}
else
{
for (unsigned int j=0; j
804c345: c7 45 d0 00 00 00 00 movl $0x0,-0x30(%ebp)
804c34c: eb 19 jmp 804c367 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x187>
{
sum+=*pixel;
804c34e: 8b 45 d4 mov -0x2c(%ebp),%eax
804c351: 0f b6 00 movzbl (%eax),%eax
804c354: 0f b6 c0 movzbl %al,%eax
804c357: 01 45 d8 add %eax,-0x28(%ebp)
pixel+=image->Pitch;
804c35a: 8b 45 0c mov 0xc(%ebp),%eax
804c35d: 8b 40 18 mov 0x18(%eax),%eax
804c360: 01 45 d4 add %eax,-0x2c(%ebp)
{
mVirtualLine = *pixel;
}
else
{
for (unsigned int j=0; j
804c363: 83 45 d0 01 addl $0x1,-0x30(%ebp)
804c367: 8b 45 08 mov 0x8(%ebp),%eax
804c36a: 8b 80 b0 07 00 00 mov 0x7b0(%eax),%eax
804c370: 3b 45 d0 cmp -0x30(%ebp),%eax
804c373: 0f 97 c0 seta %al
804c376: 84 c0 test %al,%al
804c378: 75 d4 jne 804c34e <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x16e>
{
sum+=*pixel;
pixel+=image->Pitch;
}
mVirtualLine = sum / imageHeight;
804c37a: 8b 45 08 mov 0x8(%ebp),%eax
804c37d: 8b 80 b0 07 00 00 mov 0x7b0(%eax),%eax
804c383: 89 45 a4 mov %eax,-0x5c(%ebp)
804c386: 8b 45 d8 mov -0x28(%ebp),%eax
804c389: 89 c2 mov %eax,%edx
804c38b: c1 fa 1f sar $0x1f,%edx
804c38e: f7 7d a4 idivl -0x5c(%ebp)
804c391: 8b 55 08 mov 0x8(%ebp),%edx
804c394: 03 55 dc add -0x24(%ebp),%edx
804c397: 81 c2 e0 07 00 00 add $0x7e0,%edx
804c39d: 88 02 mov %al,(%edx)
}
}
*/

unsigned char filteredIntensity;
if (mpIntensityFilter)
804c39f: 8b 45 08 mov 0x8(%ebp),%eax
804c3a2: 8b 80 c8 07 00 00 mov 0x7c8(%eax),%eax
804c3a8: 85 c0 test %eax,%eax
804c3aa: 74 49 je 804c3f5 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x215>
{
mpIntensityFilter->Update(mVirtualLine);
804c3ac: 8b 45 08 mov 0x8(%ebp),%eax
804c3af: 8b 80 c8 07 00 00 mov 0x7c8(%eax),%eax
804c3b5: 8b 00 mov (%eax),%eax
804c3b7: 83 c0 18 add $0x18,%eax
804c3ba: 8b 08 mov (%eax),%ecx
804c3bc: 8b 45 08 mov 0x8(%ebp),%eax
804c3bf: 03 45 dc add -0x24(%ebp),%eax
804c3c2: 05 e0 07 00 00 add $0x7e0,%eax
804c3c7: 0f b6 00 movzbl (%eax),%eax
804c3ca: 0f b6 d0 movzbl %al,%edx
804c3cd: 8b 45 08 mov 0x8(%ebp),%eax
804c3d0: 8b 80 c8 07 00 00 mov 0x7c8(%eax),%eax
804c3d6: 89 54 24 04 mov %edx,0x4(%esp)
804c3da: 89 04 24 mov %eax,(%esp)
804c3dd: ff d1 call *%ecx
filteredIntensity = mpIntensityFilter->Get();
804c3df: 8b 45 08 mov 0x8(%ebp),%eax
804c3e2: 8b 80 c8 07 00 00 mov 0x7c8(%eax),%eax
804c3e8: 89 04 24 mov %eax,(%esp)
804c3eb: e8 cc 06 00 00 call 804cabc <_zn7cfilterihe3getev>
804c3f0: 88 45 cf mov %al,-0x31(%ebp)
804c3f3: eb 11 jmp 804c406 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x226>
}
else
{
filteredIntensity = mVirtualLine;
804c3f5: 8b 45 08 mov 0x8(%ebp),%eax
804c3f8: 03 45 dc add -0x24(%ebp),%eax
804c3fb: 05 e0 07 00 00 add $0x7e0,%eax
804c400: 0f b6 00 movzbl (%eax),%eax
804c403: 88 45 cf mov %al,-0x31(%ebp)
}
mFilteredLine
= filteredIntensity;
804c406: 8b 45 08 mov 0x8(%ebp),%eax
804c409: 8d 90 20 1c 00 00 lea 0x1c20(%eax),%edx
804c40f: 8b 45 dc mov -0x24(%ebp),%eax
804c412: 89 44 24 04 mov %eax,0x4(%esp)
804c416: 89 14 24 mov %edx,(%esp)
804c419: e8 aa 06 00 00 call 804cac8 <_znst6vectorihsaiheeixej>
804c41e: 0f b6 55 cf movzbl -0x31(%ebp),%edx
804c422: 88 10 mov %dl,(%eax)

if (i==0) { prvFilteredIntensity = filteredIntensity; }
804c424: 83 7d dc 00 cmpl $0x0,-0x24(%ebp)
804c428: 75 07 jne 804c431 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x251>
804c42a: 0f b6 45 cf movzbl -0x31(%ebp),%eax
804c42e: 88 45 e7 mov %al,-0x19(%ebp)

if (filteredIntensity < minIntensity) { minIntensity = (unsigned char)filteredIntensity; }
804c431: 0f b6 45 cf movzbl -0x31(%ebp),%eax
804c435: 3a 45 ef cmp -0x11(%ebp),%al
804c438: 73 07 jae 804c441 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x261>
804c43a: 0f b6 45 cf movzbl -0x31(%ebp),%eax
804c43e: 88 45 ef mov %al,-0x11(%ebp)
if (filteredIntensity > maxIntensity) { maxIntensity = (unsigned char)filteredIntensity; }
804c441: 0f b6 45 cf movzbl -0x31(%ebp),%eax
804c445: 3a 45 ee cmp -0x12(%ebp),%al
804c448: 76 07 jbe 804c451 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x271>
804c44a: 0f b6 45 cf movzbl -0x31(%ebp),%eax
804c44e: 88 45 ee mov %al,-0x12(%ebp)

TEdgeDetectionState state = EDGE_DETECTION_STABLE;
804c451: c7 45 c8 00 00 00 00 movl $0x0,-0x38(%ebp)

//rising
if (filteredIntensity-prvFilteredIntensity > 0)
804c458: 0f b6 55 cf movzbl -0x31(%ebp),%edx
804c45c: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
804c460: 89 d1 mov %edx,%ecx
804c462: 29 c1 sub %eax,%ecx
804c464: 89 c8 mov %ecx,%eax
804c466: 85 c0 test %eax,%eax
804c468: 7e 5b jle 804c4c5 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x2e5>
{
state = EDGE_DETECTION_RISING;
804c46a: c7 45 c8 01 00 00 00 movl $0x1,-0x38(%ebp)
local_max = filteredIntensity;
804c471: 0f b6 45 cf movzbl -0x31(%ebp),%eax
804c475: 88 45 e2 mov %al,-0x1e(%ebp)
if (prvState != EDGE_DETECTION_RISING)
804c478: 83 7d e8 01 cmpl $0x1,-0x18(%ebp)
804c47c: 74 47 je 804c4c5 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x2e5>
{
if (prvState == EDGE_DETECTION_FALLING) { local_min = prvFilteredIntensity; }
804c47e: 83 7d e8 02 cmpl $0x2,-0x18(%ebp)
804c482: 75 07 jne 804c48b <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x2ab>
804c484: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
804c488: 88 45 e1 mov %al,-0x1f(%ebp)

if (pendingPosEdge)
804c48b: 80 7d e6 00 cmpb $0x0,-0x1a(%ebp)
804c48f: 74 34 je 804c4c5 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x2e5>
{
//add pos edge
pendingPosEdge = false;
804c491: c6 45 e6 00 movb $0x0,-0x1a(%ebp)
edge_minimum = local_min;
804c495: 0f b6 45 e1 movzbl -0x1f(%ebp),%eax
804c499: 88 45 e3 mov %al,-0x1d(%ebp)
AddPosEdge(i, edge_minimum, edge_maximum, delay);
804c49c: 0f b6 55 e4 movzbl -0x1c(%ebp),%edx
804c4a0: 0f b6 45 e3 movzbl -0x1d(%ebp),%eax
804c4a4: 8b 4d c4 mov -0x3c(%ebp),%ecx
804c4a7: 89 4c 24 10 mov %ecx,0x10(%esp)
804c4ab: 89 54 24 0c mov %edx,0xc(%esp)
804c4af: 89 44 24 08 mov %eax,0x8(%esp)
804c4b3: 8b 45 dc mov -0x24(%ebp),%eax
804c4b6: 89 44 24 04 mov %eax,0x4(%esp)
804c4ba: 8b 45 08 mov 0x8(%ebp),%eax
804c4bd: 89 04 24 mov %eax,(%esp)
804c4c0: e8 93 01 00 00 call 804c658 <_zn11application12widthmonitor25capplication_widthmonitor10addposedgeejhhj>
}
}
}

//falling
if (filteredIntensity-prvFilteredIntensity < 0)
804c4c5: 0f b6 55 cf movzbl -0x31(%ebp),%edx
804c4c9: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
804c4cd: 89 d1 mov %edx,%ecx
804c4cf: 29 c1 sub %eax,%ecx
804c4d1: 89 c8 mov %ecx,%eax
804c4d3: 85 c0 test %eax,%eax
804c4d5: 79 5b jns 804c532 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x352>
{
state = EDGE_DETECTION_FALLING;
804c4d7: c7 45 c8 02 00 00 00 movl $0x2,-0x38(%ebp)
local_min = filteredIntensity;
804c4de: 0f b6 45 cf movzbl -0x31(%ebp),%eax
804c4e2: 88 45 e1 mov %al,-0x1f(%ebp)
if (prvState != EDGE_DETECTION_FALLING)
804c4e5: 83 7d e8 02 cmpl $0x2,-0x18(%ebp)
804c4e9: 74 47 je 804c532 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x352>
{
if (prvState == EDGE_DETECTION_RISING) { local_max = prvFilteredIntensity; }
804c4eb: 83 7d e8 01 cmpl $0x1,-0x18(%ebp)
804c4ef: 75 07 jne 804c4f8 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x318>
804c4f1: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
804c4f5: 88 45 e2 mov %al,-0x1e(%ebp)

if (pendingNegEdge)
804c4f8: 80 7d e5 00 cmpb $0x0,-0x1b(%ebp)
804c4fc: 74 34 je 804c532 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x352>
{
//add neg edge
pendingNegEdge = false;
804c4fe: c6 45 e5 00 movb $0x0,-0x1b(%ebp)
edge_maximum = local_max;
804c502: 0f b6 45 e2 movzbl -0x1e(%ebp),%eax
804c506: 88 45 e4 mov %al,-0x1c(%ebp)
AddNegEdge(i, edge_minimum, edge_maximum, delay);
804c509: 0f b6 55 e4 movzbl -0x1c(%ebp),%edx
804c50d: 0f b6 45 e3 movzbl -0x1d(%ebp),%eax
804c511: 8b 4d c4 mov -0x3c(%ebp),%ecx
804c514: 89 4c 24 10 mov %ecx,0x10(%esp)
804c518: 89 54 24 0c mov %edx,0xc(%esp)
804c51c: 89 44 24 08 mov %eax,0x8(%esp)
804c520: 8b 45 dc mov -0x24(%ebp),%eax
804c523: 89 44 24 04 mov %eax,0x4(%esp)
804c527: 8b 45 08 mov 0x8(%ebp),%eax
804c52a: 89 04 24 mov %eax,(%esp)
804c52d: e8 3e 02 00 00 call 804c770 <_zn11application12widthmonitor25capplication_widthmonitor10addnegedgeejhhj>
}
}
}

//nor falling, nor rising
if (filteredIntensity-prvFilteredIntensity == 0)
804c532: 0f b6 45 cf movzbl -0x31(%ebp),%eax
804c536: 3a 45 e7 cmp -0x19(%ebp),%al
804c539: 0f 85 8e 00 00 00 jne 804c5cd <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x3ed>
{
//check for pending edges

//negative edge:
if (prvState != EDGE_DETECTION_FALLING) { local_max = prvFilteredIntensity; }
804c53f: 83 7d e8 02 cmpl $0x2,-0x18(%ebp)
804c543: 74 07 je 804c54c <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x36c>
804c545: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
804c549: 88 45 e2 mov %al,-0x1e(%ebp)

if (pendingNegEdge)
804c54c: 80 7d e5 00 cmpb $0x0,-0x1b(%ebp)
804c550: 74 34 je 804c586 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x3a6>
{
//add neg edge
pendingNegEdge = false;
804c552: c6 45 e5 00 movb $0x0,-0x1b(%ebp)
edge_maximum = local_max;
804c556: 0f b6 45 e2 movzbl -0x1e(%ebp),%eax
804c55a: 88 45 e4 mov %al,-0x1c(%ebp)
AddNegEdge(i, edge_minimum, edge_maximum, delay);
804c55d: 0f b6 55 e4 movzbl -0x1c(%ebp),%edx
804c561: 0f b6 45 e3 movzbl -0x1d(%ebp),%eax
804c565: 8b 4d c4 mov -0x3c(%ebp),%ecx
804c568: 89 4c 24 10 mov %ecx,0x10(%esp)
804c56c: 89 54 24 0c mov %edx,0xc(%esp)
804c570: 89 44 24 08 mov %eax,0x8(%esp)
804c574: 8b 45 dc mov -0x24(%ebp),%eax
804c577: 89 44 24 04 mov %eax,0x4(%esp)
804c57b: 8b 45 08 mov 0x8(%ebp),%eax
804c57e: 89 04 24 mov %eax,(%esp)
804c581: e8 ea 01 00 00 call 804c770 <_zn11application12widthmonitor25capplication_widthmonitor10addnegedgeejhhj>
}

//positive edge
if (prvState != EDGE_DETECTION_RISING) { local_min = prvFilteredIntensity; }
804c586: 83 7d e8 01 cmpl $0x1,-0x18(%ebp)
804c58a: 74 07 je 804c593 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x3b3>
804c58c: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
804c590: 88 45 e1 mov %al,-0x1f(%ebp)

if (pendingPosEdge)
804c593: 80 7d e6 00 cmpb $0x0,-0x1a(%ebp)
804c597: 74 34 je 804c5cd <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x3ed>
{
//add pos edge
pendingPosEdge = false;
804c599: c6 45 e6 00 movb $0x0,-0x1a(%ebp)
edge_minimum = local_min;
804c59d: 0f b6 45 e1 movzbl -0x1f(%ebp),%eax
804c5a1: 88 45 e3 mov %al,-0x1d(%ebp)
AddPosEdge(i, edge_minimum, edge_maximum, delay);
804c5a4: 0f b6 55 e4 movzbl -0x1c(%ebp),%edx
804c5a8: 0f b6 45 e3 movzbl -0x1d(%ebp),%eax
804c5ac: 8b 4d c4 mov -0x3c(%ebp),%ecx
804c5af: 89 4c 24 10 mov %ecx,0x10(%esp)
804c5b3: 89 54 24 0c mov %edx,0xc(%esp)
804c5b7: 89 44 24 08 mov %eax,0x8(%esp)
804c5bb: 8b 45 dc mov -0x24(%ebp),%eax
804c5be: 89 44 24 04 mov %eax,0x4(%esp)
804c5c2: 8b 45 08 mov 0x8(%ebp),%eax
804c5c5: 89 04 24 mov %eax,(%esp)
804c5c8: e8 8b 00 00 00 call 804c658 <_zn11application12widthmonitor25capplication_widthmonitor10addposedgeejhhj>
}
}

if (filteredIntensity > threshold && prvFilteredIntensity < = threshold )
804c5cd: 0f b6 45 cf movzbl -0x31(%ebp),%eax
804c5d1: 3a 45 c3 cmp -0x3d(%ebp),%al
804c5d4: 76 16 jbe 804c5ec <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x40c>
804c5d6: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
804c5da: 3a 45 c3 cmp -0x3d(%ebp),%al
804c5dd: 77 0d ja 804c5ec <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x40c>
{
pendingNegEdge = true;
804c5df: c6 45 e5 01 movb $0x1,-0x1b(%ebp)
edge_minimum = local_min;
804c5e3: 0f b6 45 e1 movzbl -0x1f(%ebp),%eax
804c5e7: 88 45 e3 mov %al,-0x1d(%ebp)
804c5ea: eb 1d jmp 804c609 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x429>
}
else if (filteredIntensity < threshold && prvFilteredIntensity >= threshold )
804c5ec: 0f b6 45 cf movzbl -0x31(%ebp),%eax
804c5f0: 3a 45 c3 cmp -0x3d(%ebp),%al
804c5f3: 73 14 jae 804c609 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x429>
804c5f5: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
804c5f9: 3a 45 c3 cmp -0x3d(%ebp),%al
804c5fc: 72 0b jb 804c609 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x429>
{
pendingPosEdge = true;
804c5fe: c6 45 e6 01 movb $0x1,-0x1a(%ebp)
edge_maximum = local_max;
804c602: 0f b6 45 e2 movzbl -0x1e(%ebp),%eax
804c606: 88 45 e4 mov %al,-0x1c(%ebp)
}

prvState = state;
804c609: 8b 45 c8 mov -0x38(%ebp),%eax
804c60c: 89 45 e8 mov %eax,-0x18(%ebp)
prvFilteredIntensity = filteredIntensity;
804c60f: 0f b6 45 cf movzbl -0x31(%ebp),%eax
804c613: 88 45 e7 mov %al,-0x19(%ebp)
columPtr += inc;
804c616: 8b 45 f0 mov -0x10(%ebp),%eax
804c619: 01 45 f4 add %eax,-0xc(%ebp)
unsigned char edge_maximum = 0;
unsigned char edge_minimum = 0;
unsigned char local_max = 0;
unsigned char local_min = 0;

for (unsigned int i=0; iWidth; i++)
804c61c: 83 45 dc 01 addl $0x1,-0x24(%ebp)
804c620: 8b 45 0c mov 0xc(%ebp),%eax
804c623: 8b 40 10 mov 0x10(%eax),%eax
804c626: 3b 45 dc cmp -0x24(%ebp),%eax
804c629: 0f 97 c0 seta %al
804c62c: 84 c0 test %al,%al
804c62e: 0f 85 e0 fc ff ff jne 804c314 <_zn11application12widthmonitor25capplication_widthmonitor15detectedgesfastepn6camera10timageinfoe +0x134>
prvState = state;
prvFilteredIntensity = filteredIntensity;
columPtr += inc;
}

diagMinPixelVal = minIntensity;
804c634: 0f b6 55 ef movzbl -0x11(%ebp),%edx
804c638: 8b 45 08 mov 0x8(%ebp),%eax
804c63b: 89 90 d8 07 00 00 mov %edx,0x7d8(%eax)
diagMaxPixelVal = maxIntensity;
804c641: 0f b6 55 ee movzbl -0x12(%ebp),%edx
804c645: 8b 45 08 mov 0x8(%ebp),%eax
804c648: 89 90 dc 07 00 00 mov %edx,0x7dc(%eax)
}
804c64e: 81 c4 84 00 00 00 add $0x84,%esp
804c654: 5b pop %ebx
804c655: 5d pop %ebp
804c656: c3 ret
804c657: 90 nop

Do you got a solution for this GDB bug?

August 20, 2013 at 16:43

#2524

Hi,

Try updating your gdb to a newer version, if there is no built newer version available, then build one from the latest sources (version 7.6 is latest currently).

August 21, 2013 at 06:25

#2512

Hi Ket,

Ii already had build the newest version of GDB, I am using version 7.6.

August 22, 2013 at 04:45

#2525

Hi,

In that case try understanding what causes the problem.

You say that you can set breakpoints and see the source of other functions in the same file, stop the execution at some breakpoint and try the info line command on all the other functions in the file DetectEdgesFast is declared. Is source for all the other functions found, is there a pattern?

Secondly, try renaming the DetectEdgesFast function to something else.

Last but not least, is your gdb and gcc compatible i.e. is gcc adding symbols that gdb can understand? Make sure that your gcc and gdb are meant for the same target and that their versions are roughly the same age i.e. not that the gdb is newest and gcc is ancient.

August 26, 2013 at 10:33

#2526

Hi Ket,

Before I want to update GCC , I updated the bin-utils (ld linker).
This fixed my debugging issue, to find the source files while debugging.

I was using ld version 2.20 and updated it to 2.23.

Thanks for all your help!

NameError — одна из самых распространенных ошибок в Python. Начинающих она может пугать, но в ней нет ничего сложного. Это ошибка говорит о том, что вы попробовали использовать переменную, которой не существует.

В этом руководстве поговорим об ошибке «NameError name is not defined». Разберем несколько примеров и разберемся, как эту ошибку решать.

NameError возникает в тех случаях, когда вы пытаетесь использовать несуществующие имя переменной или функции.

В Python код запускается сверху вниз. Это значит, что переменную нельзя объявить уже после того, как она была использована. Python просто не будет знать о ее существовании.

Самая распространенная NameError выглядит вот так:

NameError: name 'some_name' is not defined

Разберем частые причина возникновения этой ошибки.

Причина №1: ошибка в написании имени переменной или функции

Для человека достаточно просто сделать опечатку. Также просто для него — найти ее. Но это не настолько просто для Python.

Язык способен интерпретировать только те имена, которые были введены корректно. Именно поэтому важно следить за правильностью ввода всех имен в коде.

Если ошибку не исправить, то возникнет исключение. Возьмем в качестве примера следующий код:

books = ["Near Dark", "The Order", "Where the Crawdads Sing"]
print(boooks)

Он вернет:

Traceback (most recent call last):
  File "main.py", line 3, in 
	print(boooks)
NameError: name 'boooks' is not defined

Для решения проблемы опечатку нужно исправить. Если ввести print(books), то код вернет список книг.

Таким образом при возникновении ошибки с именем в первую очередь нужно проверить, что все имена переменных и функций введены верно.

Причина №2: вызов функции до объявления

Функции должны использоваться после объявления по аналогии с переменными. Это связано с тем, что Python читает код сверху вниз.

Напишем программу, которая вызывает функцию до объявления:

books = ["Near Dark", "The Order", "Where the Crawdads Sing"]

print_books(books)

def print_books(books):
	for b in books:
		print(b)

Код вернет:

Traceback (most recent call last):
  File "main.py", line 3, in 
	print_books(books)
NameError: name 'print_books' is not defined

На 3 строке мы пытаемся вызвать print_books(). Однако эта функция объявляется позже.

Чтобы исправить эту ошибку, нужно перенести функцию выше:

def print_books(books):
	for b in books:
		print(b)

books = ["Near Dark", "The Order", "Where the Crawdads Sing"]

print_books(books)

Причина №3: переменная не объявлена

Программы становятся больше, и порой легко забыть определить переменную. В таком случае возникнет ошибка. Причина в том, что Python не способен работать с необъявленными переменными.

Посмотрим на программу, которая выводит список книг:

Такой код вернет:

Traceback (most recent call last):
  File "main.py", line 1, in 
	for b in books:
NameError: name 'books' is not defined

Переменная books объявлена не была.

Для решения проблемы переменную нужно объявить в коде:

books = ["Near Dark", "The Order", "Where the Crawdads Sing"]

for b in books:
    print(b)

Причина №4: попытка вывести одно слово

Чтобы вывести одно слово, нужно заключить его в двойные скобки. Таким образом мы сообщаем Python, что это строка. Если этого не сделать, язык будет считать, что это часть программы. Рассмотрим такую инструкцию print():

Этот код пытается вывести слово «Books» в консоль. Вместо этого он вернет ошибку:

Traceback (most recent call last):
  File "main.py", line 1, in 
	print(Books)
NameError: name 'Books' is not defined

Python воспринимает «Books» как имя переменной. Для решения проблемы нужно заключить имя в скобки:

Теперь Python знает, что нужно вывести в консоли строку, и код возвращает Books.

Причина №5: объявление переменной вне области видимости

Есть две области видимости переменных: локальная и глобальная. Локальные переменные доступны внутри функций или классов, где они были объявлены. Глобальные переменные доступны во всей программе.

Если попытаться получить доступ к локальной переменной вне ее области видимости, то возникнет ошибка.

Следующий код пытается вывести список книг вместе с их общим количеством:

def print_books():
  books = ["Near Dark", "The Order", "Where the Crawdads Sing"]
  for b in books:
      print(b)

print(len(books))

Код возвращает:

Traceback (most recent call last):
  File "main.py", line 5, in 
	print(len(books))
NameError: name 'books' is not defined

Переменная books была объявлена, но она была объявлена внутри функции print_books(). Это значит, что получить к ней доступ нельзя в остальной части программы.

Для решения этой проблемы нужно объявить переменную в глобальной области видимости:

books = ["Near Dark", "The Order", "Where the Crawdads Sing"]

def print_books():
  for b in books:
      print(b)


print(len(books))

Код выводит название каждой книги из списка books. После этого выводится общее количество книг в списке с помощью метода len().

Первый шаг в исправлении ошибок при написании кода — понять, что именно пошло не так. И хотя некоторые сообщения об ошибках могут показаться запутанными, большинство из них помогут вам понять, что же не работает в вашей программе. В этой статье мы поговорим о том, как исправить ошибку NameError в Python. Мы рассмотрим несколько примеров кода, показывающих, как и почему возникает эта ошибка, и покажем, как ее исправить.

В Python ошибка NameError возникает, когда вы пытаетесь использовать переменную, функцию или модуль, которые не существуют, или использовать их недопустимым образом.

Некоторые из распространенных причин, вызывающих эту ошибку:

  • Использование имени переменной или функции, которое еще не определено
  • Неправильное написание имени переменной/функции при её вызове
  • Использование модуля в Python без импорта этого модуля и т. д.

Как исправить «NameError: Name Is Not Defined» в Python

В этом разделе мы рассмотрим, как исправить ошибку NameError: Name is Not Defined в Python.

Мы начнем с блоков кода, вызывающих ошибку, а затем посмотрим, как их исправить.

[python_ad_block]

Пример №1. Имя переменной не определено

name = "John"

print(age)
# NameError: name 'age' is not defined

В приведенном выше коде мы определили переменную name, но далее попытались вывести переменную age, которая ещё не была определена.

Мы получили сообщение об ошибке: NameError: name 'age' is not defined. Это означает, что переменная age не существует, мы её не задали.

Чтобы исправить это, мы можем создать переменную, и наш код будет работать нормально. К примеру, это можно сделать следующим образом:

name = "John"
age = 12

print(age)
# 12

Теперь значение переменной age выводится без проблем.

Точно так же эта ошибка может возникнуть, если мы неправильно напишем имя нашей переменной. Например, сделаем так:

name = "John"

print(nam)
# NameError: name 'nam' is not defined

В коде выше мы написали nam вместо name. Чтобы исправить подобную ошибку, вам просто нужно правильно написать имя вашей переменной.

Пример №2. Имя функции не определено

def sayHello():
    print("Hello World!")
    
sayHelloo()
# NameError: name 'sayHelloo' is not defined

В приведенном выше примере мы добавили лишнюю букву o при вызове функции — sayHelloo() вместо sayHello(). Это просто опечатка, однако она вызовет ошибку, потому что функции с таким именем не существует.

Итак, мы получили ошибку: NameError: name 'sayHelloo' is not defined. Подобные орфографические ошибки очень легко пропустить. Сообщение об ошибке обычно помогает исправить это.

Вот правильный способ вызова данной функции:

def sayHello():
    print("Hello World!")
    
sayHello()
# Hello World!

Как мы видели в предыдущем разделе, вызов переменной, которая еще не определена, вызывает ошибку. То же самое относится и к функциям.

К примеру, это может выглядеть так:

def sayHello():
    print("Hello World!")
    
sayHello()
# Hello World!

addTWoNumbers()
# NameError: name 'addTWoNumbers' is not defined

В приведенном выше коде мы вызвали функцию addTWoNumbers(), которая еще не была определена в программе. Чтобы исправить это, вы можете создать функцию, если она вам нужна, или просто избавиться от нее.

Обратите внимание, что вызов функции перед ее созданием приведет к той же ошибке. То есть такой код также выдаст вам ошибку:

sayHello()

def sayHello():
    print("Hello World!")
    
# NameError: name 'sayHello' is not defined

Поэтому вы всегда должны определять свои функции перед их вызовом.

Пример №3. Использование модуля без его импорта

x = 5.5

print(math.ceil(x))
# NameError: name 'math' is not defined

В приведенном выше примере мы используем метод математической библиотеки Python math.ceil(). Однако до этого мы не импортировали модуль math.

В результате возникает следующая ошибка: NameError: name 'math' is not defined. Это произошло потому, что интерпретатор не распознал ключевое слово math.

Таким образом, если мы хотим использовать функции библиотеки math в Python, мы должны сначала импортировать соответствующий модуль.

Вот так будет выглядеть исправленный код:

import math

x = 5.5

print(math.ceil(x))
# 6

В первой строке кода мы импортировали математический модуль math. Теперь, когда вы запустите приведенный выше код, вы получите результат 6. То же самое относится и ко всем остальным библиотекам. Сначала нужно импортировать библиотеку с помощью ключевого слова import, а потом уже можно использовать весь функционал этой библиотеки. Подробнее про импорт модулей можно узнать в статье «Как импортировать в Python?»

Заключение

В этой статье мы поговорили о том, как исправить ошибку NameError в Python.

Мы выяснили, что собой представляет NameError. Затем мы разобрали несколько примеров, которые могли вызвать ошибку NameError при работе с переменными, функциями и модулями в Python. Также мы показали, как можно исправить эти ошибки.

Надеемся, данная статья была вам полезна! Успехов в написании кода!

Перевод статьи «NameError: Name plot_cases_simple is Not Defined – How to Fix this Python Error».

You execute your Python program and you see an error, “NameError: name … is not defined”. What does it mean?

In this article I will explain you what this error is and how you can quickly fix it.

What causes a Python NameError?

The Python NameError occurs when Python cannot recognise a name in your program. A name can be either related to a built-in function or to something you define in your program (e.g. a variable or a function).

Let’s have a look at some examples of this error, to do that I will create a simple program and I will show you common ways in which this error occurs during the development of a Python program.

Ready?

A Simple Program to Print the Fibonacci Sequence

We will go through the creation of a program that prints the Fibonacci sequence and while doing that we will see 4 different ways in which the Python NameError can appear.

First of all, to understand the program we are creating let’s quickly introduce the Fibonacci sequence.

In the Fibonacci sequence every number is the sum of the two preceding numbers in the sequence. The sequence starts with 0 and 1.

Below you can see the first 10 numbers in the sequence:

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, …

That’s pretty much everything we need to know to create a Python program that generates this sequence.

Let’s get started!

To simplify things our Python program will print the sequence starting from the number 1.

Here is the meaning of the variables n1, n2 and n:

Variable Meaning
n nth term of the sequence
n1 (n-1)th term of the sequence
n2 (n-2)th term of the sequence

And here is our program.

At each iteration of the while loop we:

  • Calculate the nth term as the sum of the (n-2)th and (n-1)th terms.
  • Assign the value of the (n-1)th terms to the (n-2)th terms.
  • Assign the value of the nth terms to the (n-1)th terms.

We assign the values to the (n-2)th and (n-1)th terms so we can use them in the next iteration of the while loop to calculate the value of the nth term.

number_of_terms = int(input("How many terms do you want for the sequence? "))
n1 = 1
n2 = 0

while count < number_of_terms:
    n = n1 + n2
    print(n)
    n2 = n1
    n1 = n
    count += 1

I run the program, and….

How many terms do you want for the sequence? 5
Traceback (most recent call last):
  File "fibonacci.py", line 5, in <module>
    while count < number_of_terms:
NameError: name 'count' is not defined

What happened?

This syntax error is telling us that the name count is not defined.

It basically means that the count variable is not defined.

So in this specific case we are using the variable count in the condition of the while loop without declaring it before. And because of that Python generates this error.

Let’s define count at the beginning of our program and try again.

number_of_terms = int(input("How many terms do you want for the sequence? "))
count = 0
n1 = 1
n2 = 0
.....
....
...

And if we run the program, we get…

How many terms do you want for the sequence? 5
1
2
3
5
8

So, all good.

Lesson 1: The Python NameError happens if you use a variable without declaring it.

Order Really Counts in a Python Program

Now I want to create a separate function that calculates the value of the nth term of the sequence.

In this way we can simply call that function inside the while loop.

In this case our function is very simple, but this is just an example to show you how we can extract part of our code into a function.

This makes our code easier to read (imagine if the calculate_nth_term function was 50 lines long):

number_of_terms = int(input("How many terms do you want for the sequence? "))
count = 0
n1 = 1
n2 = 0

while count < number_of_terms:
    n = calculate_nth_term(n1, n2)
    print(n)
    n2 = n1
    n1 = n
    count += 1

def calculate_nth_term(n1, n2):
    n = n1 + n2
    return n

And here is the output of the program…

How many terms do you want for the sequence? 5
Traceback (most recent call last):
  File "fibonacci.py", line 7, in <module>
    n = calculate_nth_term(n1, n2)
NameError: name 'calculate_nth_term' is not defined

Wait…a NameError again!?!

We have defined the function we are calling so why the error?

Because we are calling the function calculate_nth_term before defining that same function.

We need to make sure the function is defined before being used.

So, let’s move the function before the line in which we call it and see what happens:

number_of_terms = int(input("How many terms do you want for the sequence? "))
count = 0
n1 = 1
n2 = 0

def calculate_nth_term(n1, n2):
    n = n1 + n2
    return n

while count < number_of_terms:
    n = calculate_nth_term(n1, n2)
    print(n)
    n2 = n1
    n1 = n
    count += 1
How many terms do you want for the sequence? 4
1
2
3
5

Our program works well this time!

Lesson 2: Make sure a variable or function is declared before being used in your code (and not after).

Name Error With Built-in Functions

I want to improve our program and stop its execution if the user provides an input that is not a number.

With the current version of the program this is what happens if something that is not a number is passed as input:

How many terms do you want for the sequence? not_a_number
Traceback (most recent call last):
  File "fibonacci.py", line 1, in <module>
    number_of_terms = int(input("How many terms do you want for the sequence? "))
ValueError: invalid literal for int() with base 10: 'not_a_number'

That’s not a great way to handle errors.

A user of our program wouldn’t know what to do with this error…

We want to exit the program with a clear message for our user if something different that a number is passed as input to the program.

To stop the execution of our program we can use the exit() function that belongs to the Python sys module.

The exit function takes an optional argument, an integer that represents the exit status status of the program (the default is zero).

Let’s handle the exception thrown when we don’t pass a number to our program. We will do it with the try except statement

try:
    number_of_terms = int(input("How many terms do you want for the sequence? "))
except ValueError:
    print("Unable to continue. Please provide a valid number.")
    sys.exit(1)

Let’s run it!

How many terms do you want for the sequence? not_a_number
Unable to continue. Please provide a valid number.
Traceback (most recent call last):
  File "fibonacci.py", line 2, in <module>
    number_of_terms = int(input("How many terms do you want for the sequence? "))
ValueError: invalid literal for int() with base 10: 'not_a_number'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "fibonacci.py", line 5, in <module>
    sys.exit(1)
NameError: name 'sys' is not defined

Bad news, at the end you can see another NameError…it says that sys is not defined.

That’s because I have used the exit() function of the sys module without importing the sys module at the beginning of my program. Let’s do that.

Here is the final program:

import sys
  
try:
    number_of_terms = int(input("How many terms do you want for the sequence? "))
except ValueError:
    print("Unable to continue. Please provide a valid number.")
    sys.exit(1)

count = 0
n1 = 1
n2 = 0

def calculate_nth_term(n1, n2):
    n = n1 + n2
    return n

while count < number_of_terms:
    n = calculate_nth_term(n1, n2)
    print(n)
    n2 = n1
    n1 = n
    count += 1

And when I run it I can see that the exception is handled correctly:

How many terms do you want for the sequence? not_a_number
Unable to continue. Please provide a valid number.

Lesson 3: Remember to import any modules that you use in your Python program.

Catch Any Misspellings

The NameError can also happen if you misspell something in your program.

For instance, let’s say when I call the function to calculate the nth term of the Fibonacci sequence I write the following:

n = calculate_nt_term(n1, n2)

As you can see, I missed the ‘h’ in ‘nth’:

How many terms do you want for the sequence? 5
Traceback (most recent call last):
  File "fibonacci.py", line 18, in <module>
    n = calculate_nt_term(n1, n2)
NameError: name 'calculate_nt_term' is not defined

Python cannot find the name “calculate_nt_term” in the program because of the misspelling.

This can be harder to find if you have written a very long program.

Lesson 4: Verify that there are no misspellings in your program when you define or use a variable or a function. This also applies to Python built-in functions.

Conclusion

You now have a guide to understand why the error “NameError: name … is not defined” is raised by Python during the execution of your programs.

Let’s recap the scenarios I have explained:

  • The Python NameError happens if you use a variable without declaring it.
  • Make sure a variable or function is declared before being used in your code (and not after).
  • Remember to import any modules that you use in your Python program.
  • Verify that there are no misspellings in your program when you define or use a variable or a function. This also applies to Python built-in functions.

Does it make sense?

If you have any questions feel free to post them in the comments below 🙂

I have put together for you the code we have created in this tutorial, you can get it here.

And if you are just getting started with Python have a look at this free checklist I created to build your Python knowledge.

Related posts:

I’m a Tech Lead, Software Engineer and Programming Coach. I want to help you in your journey to become a Super Developer!

Имеется проект на JavaScript + Node.JS + Ant.

Тесты для JavaScript-кода написаны на Karma + Jasmine.

Для оценки покрытия кода тестами используется Istanbul.

После ввода команды:
istanbul cover someFile.js
появляется ошибка:
«[path to the file]someFile.js:9
__cov_lhpa2MzHG9ur0fWhNQ3HsA.s[‘1’]++;define(‘some’,function(){__cov_lhpa2MzHG

ReferenceError: define is not defined»

Код внутри файла someFile.js:

define('someFile', function() {

    describe("Base64", function () {

        it('Base64_TestEncode', function () {

            expect( "TXkgZW5nbGlzaCBiYWQ=" ).toEqual( $ws.single.base64.encode( "someText" ) );

        });

    });

});

Подскажите, пожалуйста, как решить проблему?

UPD:

Добавил в начало файла код:

if (typeof define !== 'function') {
    var define = require('amdefine')(module);
}

Теперь выводится ошибка:
«[path to the file]someFile.js:9
pa2MzHG9ur0fWhNQ3HsA.f[‘1’]++;__cov_lhpa2MzHG9ur0fWhNQ3HsA.s[‘4’]++;describe(‘

ReferenceError: describe is not defined»

UPD_2:

Istanbul изначально поддерживается Karma.

Добавил в karma.konf.js строки:

preprocessors = {
  '<путь до файла someFile.js>': 'coverage'
}

reporters: ['progress', 'coverage']

coverageReporter: {
        type : 'html',
        dir : 'coverage/'
}

Если запустить karma.konf.js в WebStorm, то тесты проходят, но покрытие кода не выполняется (папка coverage не создается).

Если запустить karma.konf.js в PHPStorm, предварительно установив плагин «karma», то тесты проходят и покрытие кода выполняется (папка coverage создается).

Не смотря на это, в консоли при выполнении команды:
«istanbul cover <путь до файл someFile.js>»

появляются ошибки, описанные в начале вопроса.

Понравилась статья? Поделить с друзьями:
  • Error etc nginx conf d default conf differs from the packaged version
  • Error enumeration value not handled in switch
  • Error entity mod
  • Error estimate перевод
  • Error establishing a database connection что это значит