Gdb Error 0377
your question and get tips & solutions from a community of 418,553 IT Pros process exited with code 0377 & Developers. It's quick & easy. Problem - program exited with gdb cheat sheet code 0377 P: n/a Seo Jae Ick Hi? My name is Seo Jae Ick. I have a problem with running a program on Linux RedHat 8.0. GDB have reported this, program exited with code 0377 I think, this statement comes when 1) explicit call in process exit(-1) <- 0377(octet) = -1(decimal) 2) return -1 in main function (any other case exists?) I have searched exit(-1)in whole codes, but not exists. And I changed main function's return value to another number (like 128) Finally, I added exit handler, ExitHandler by calling atexit(ExitHandler) But, gdb reports same statement(program exited with code 0377) and, breakpoint in ExitHandler skipped. Somebody knows the reason of this problem? Thanks in advance! Seo Jae Ick Nov 14 '05 #1 Post Reply Share this Question 5 Replies P: n/a Mark McIntyre On 14 Feb 2004 20:31:31 -0800, in comp.lang.c , se*******@hotmail.com (Seo Jae Ick) wrote: Hi? My name is Seo Jae Ick.I have a problem with running a program on Linux RedHat 8.0.GDB have reported this,program exited with code 0377I think, this statement comes when1) explicit call in process exit(-1) <- 0377(octet) = -1(decimal)2) return -1 in main function(any other case exists?) your program crashed, and returned garbage to teh OS, which decided to interpret it as meaning -1. Somebody knows the reason of this problem? You have a bug in your program. You need to find the bug, and fix it. Narrow down the location, post a (small) piece of code that causes the crash, and maybe someone here can help fix it. -- Mark McIntyre CLC FAQ
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: https://bytes.com/topic/c/answers/216185-problem-program-exited-code-0377-a Sign up How to use GDB to debug a big project? up vote 1 down vote favorite Now I have a c language project which include three directories /bin, /inc and /src. All of header files (.h) are included in /inc and all of source(.c) files are stored in /src, i.e. a.c, b.c, c.c..., the final generated executable file will locate in /bin. http://stackoverflow.com/questions/1715053/how-to-use-gdb-to-debug-a-big-project after compling with makefile, all of obj files will be generated in /src/obj like a.o, b.o, c.o, d....! Moreover an final.exe executable file will be generated in the /bin directory. Now if I want to debug it with GDB, how can I do it??? To debug those obj files in /src/obj? or somewhat else? Many thanks for the kind help! debugging gdb project share|improve this question edited Apr 10 '13 at 4:24 Emrakul 3,78452659 asked Nov 11 '09 at 13:02 MaiTiano 1852620 there is a mistakes in the above question. Actually, all of generated obj files locate in /obj directory which in the same level with /bin, /inc and /src. In other words, there are 4 folders after compling, /bin, /inc, /src and /obj. –MaiTiano Nov 11 '09 at 13:59 add a comment| 2 Answers 2 active oldest votes up vote 3 down vote accepted You can either debug an application by starting it with GDB %> gdb
you have to exit from one before starting another). In the most general case, you can have multiple threads of execution in each of multiple processes, launched from multiple https://sourceware.org/gdb/onlinedocs/gdb/Inferiors-and-Programs.html executables. gdb represents the state of each program execution with an object called an inferior. An inferior typically corresponds to a process, but is more general and applies also to targets that do not have processes. Inferiors may be created before a process runs, and may be retained after a process exits. Inferiors have unique identifiers that are different from process ids. Usually each gdb error inferior will also have its own distinct address space, although some embedded targets may have several inferiors running in different parts of a single address space. Each inferior may in turn have multiple threads running in it. To find out what inferiors exist at any moment, use infoinferiors: info inferiorsPrint a list of all inferiors currently being managed by gdb. gdb displays for each inferior gdb error 0377 (in this order): the inferior number assigned by gdb the target system's inferior identifier the name of the executable the inferior is running. An asterisk ‘*’ preceding the gdb inferior number indicates the current inferior. For example, (gdb) info inferiors Num Description Executable 2 process 2307 hello * 1 process 3401 goodbye To switch focus between inferiors, use the inferior command: inferior infnoMake inferior number infno the current inferior. The argument infno is the inferior number assigned by gdb, as shown in the first field of the ‘info inferiors’ display. The debugger convenience variable ‘$_inferior’ contains the number of the current inferior. You may find this useful in writing breakpoint conditional expressions, command scripts, and so forth. See Convenience Variables, for general information on convenience variables. You can get multiple executables into a debugging session via the add-inferior and clone-inferior commands. On some systems gdb can add inferiors to the debug session automatically by following calls to fork and exec. To remove inferiors from the debugging session use the remove-inferiors command. add-inferior [ -copies n ] [ -exec executable ]Adds n inferiors to be run using executable as the executable;