aboutsummaryrefslogtreecommitdiff
path: root/proc.c
AgeCommit message (Collapse)Author
2013-10-23Move several os_ declarations before corresponding arch_ declarationsPetr Machata
2013-03-19The same work needs to be done on attach as when _start is hitPetr Machata
- Extract the logic to a separate function, called from open_pid and entry_breakpoint_on_hit. - Since there is no other way to get on dyn_addr in open_pid anyway, simply look for the main library, and read it there. That means we don't need to track that information at entry_breakpoint anymore, and we can get rid of struct entry_breakpoint.
2013-03-19Use CBS_STOP_IF instead of hand-coding the samePetr Machata
- In cb_breakpoint_for_symbol, we would need CBS_FAIL_IF. But CBS_FAIL isn't properly handled anywhere. The iterator client user must provide alternate means of signalling errors anyway (e.g. a flag passed in data) anyway. So convert this to CBS_STOP_IF, the caller already assumes all stops are failures.
2013-03-19open_one_pid doesn't return boolean, but <0 on errorPetr Machata
- This compiles down to the exact same code, but we want to be clear about the calling convention.
2013-03-12Fix compilationPetr Machata
- GCC points out that the constant in dict.c that we use for computing string hashes is not implicitly unsigned. - When building without unwinding support, we can't access ifdef'd-out fields. I remember having writted it this way to increase exposure of the error handling code for syntax checks, but it can't work.
2013-03-12Drop useless argument from breakpoint_clonePetr Machata
2013-03-11Add proc_read_8Petr Machata
2013-03-08Fix error message in proc_add_library, when latent symbol activation failsPetr Machata
- In fact, libsym->name would cause a SIGSEGV.
2013-03-08proc_each_library should iterate from passed-in iterator non-inclusivePetr Machata
- the semantics should be start_after, as in other cases in ltrace
2013-03-08Fix cleanup in process_clone fail pathPetr Machata
The original code was releasing the original memory, not the clone, and single block would be released potentially many times. This led to severe memory errors.
2013-03-08Properly handle partial success when cloning a libraryPetr Machata
The cloned library may have been allocated, but not initialized. It is not correct to destroy such library, only the memory needs to be released.
2013-03-08Unlist the process if its addition failsPetr Machata
- add_process returns -1 on failures - in process_bare_init, when we fail to initialize the process, but it already was added, unlist it before bailing out.
2013-03-08Fix formatting of error messages in proc_add_libraryPetr Machata
2013-03-08Tolarate failures in initialization of unwindingPetr Machata
Output should verify whether unwinding was properly initialized. Said initialization should be skipped altogether unless requested on command line.
2013-03-08Change DICT_FIND to DICT_FIND_{REF,VAL}Petr Machata
- In many places, DICT_FIND was awkward to use, as it required the use of pointers even in cases that the dictionary already stored pointers. For those cases, add DICT_FIND_VAL. - Rename the original DICT_FIND to DICT_FIND_REF to make the disctinction clear. That is useful if the dictionary holds actual structures.
2013-03-08Rewrite dict module to be more in line with vectPetr Machata
It's now a bit more strongly typed, can grow and shrink on demand, and has a more complete interface. It uses open addressing scheme to store hashes.
2013-01-15Move byte-reading routines from PPC backend to generic codePetr Machata
- Use backend hook umovebytes to read the bytes from inferior.
2012-12-17struct Process becomes struct processPetr Machata
This is for consistency with other structures, and ultimately with Linux coding style. The typedef ("Process") was dropped as well for this reason. This opportunity was used to fix coding style around the impacted lines.
2012-11-12Work around MIPS requesting two symbolic breakpoints on the same addressPetr Machata
2012-11-03Drop unused piece of codePetr Machata
The same is inlined in the for() initializer.
2012-10-31Debug messages around latent and delayed symbolsPetr Machata
2012-10-31New function proc_each_symbolPetr Machata
2012-10-27Libraries and breakpoints should be cloned from original's leaderPetr Machata
This pops up when a thread calls vfork. In that case there are no libraries assigned to the process itself, but newly-vfork'd process is itself a leader, and therefore needs its own libraries and breakpoints.
2012-10-27Extract processed stack element to a variable in process_clonePetr Machata
This makes the code less verbose. Also add a note related to extraction to future callstack.c.
2012-10-27Corrections in cleanup code in process_clonePetr Machata
Since we are done cloning the generic part of the process, it is proper to simply call private_process_destroy on failures. If os_process_clone passed, but arch_process_clone fails, os_process_destroy must be called.
2012-10-27In clone_single_bp, don't overwrite error status, instead use it to shortcutPetr Machata
2012-10-27Add proc_find_symbol, use it to find corresponding symbols for clonesPetr Machata
The code in breakpoint_clone was buggy--it looked through old_proc's symbols. It was also needlessly verbose, proc_find_symbol uses library key to find the right library. Instead use the new interface and call it on new_proc to find the new symbol. We also didn't relink symbols in stack elements of a cloned process in process_clone. Use proc_find_symbol for this as well.
2012-10-27Fix memory handling of pid2name resultPetr Machata
This plugs a leak.
2012-10-26Add os_process_data and relatedPetr Machata
This is meant to be the same for per-OS configuration as arch_process_data is for per-arch configuration.
2012-10-26Call arch_process_destroy before destroying main process dataPetr Machata
That in case that arch_process_destroy needs the global state. Unlikely, but we do it that way for exec, so let's be consistent.
2012-10-26Pop remaining stack before the process exitsPetr Machata
This plugs a leak
2012-10-26Release unwind dataPetr Machata
This plugs a leak
2012-10-01mipsel: Replace LS_TOPLT_GOTONLY with delayed symsEdgar E. Iglesias
Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
2012-10-01When a new library is mapped, activate latent PLT entries in other librariesPetr Machata
2012-10-01Support latent and delayed symbolsPetr Machata
Neither latent, nor delayed symbols are given a breakpoint. The difference is in who's responsible for the state. Latent symbols are (will be) used by ltrace core. Delayed symbols are used by backends. Only when both of these flags are cleared is a breakpoint enabled for the symbol.
2012-09-27mipsel: Add mips specific symbol info loadingEdgar E. Iglesias
MIPS needs a backend specific way to load symbol info. We add fields to the symbol representation to keep track of the state of the dynamic symbol. At arch_dynlink_done we go through the symbols that are connected to a GOT entry but that where not resolved at startup time (e.g function pointers to external syms). Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
2012-09-27proc: Add missing sym2addr mappingsEdgar E. Iglesias
Not all arch's (e.g MIPS) have a direct mapping to sym->enter_addr. Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
2012-08-29Track elf class in struct ProcessPetr Machata
Technically only s390 needs this at the moment, but it seems general enough that it should be alongside the e_machine flag. Eventually it is desirable to replace both fields with either a backend-provided ABI enum, or with an ABI object that would implement the interesting back end calls.
2012-08-29Fix compilationPetr Machata
2012-08-29Add backend.h for backend interfacesPetr Machata
2012-08-29Move event-que declarations to sysdeps, new backend interface process_removedPetr Machata
- the reason being that the que-handling was declared on global level, but was only implemented in one back end. If this is deemed generally useful, it should all be moved to front end, but as things are it's all the same, so I'm preferring the less invasive change
2012-08-29Add fetch.c/fetch.h, a module for fetching function argumentsPetr Machata
- this is now a thin wrapper over gimme_arg, ideally the backends will eventually use this right interface - in display_args.c, strip one layer of pointer wrapping, which is now done in output.c
2012-08-29Add expr.c, expr.h, plug in properlyPetr Machata
- in callstack_pop, we don't free arch_ptr. That's because this doesn't get copied over the clone. It's a mere coincidence that fork() doesn't need to save register arguments, and this works. - added copyright notices to files that this touches. This is based on git blame. Only contributors of 10+ lines are added - test suite adjusted to not include "void" type as "don't show this int". Back ends in general need to know the exact type, so this never worked anyway.
2012-05-05Drop process_get_entry, which is not useful right nowPetr Machata
2012-05-03Don't call remove_process in process_bare_destroyPetr Machata
This does many things, we only care obout the unlisting.
2012-04-25Replace some uses of error with fprintfPetr Machata
error is not standard so it has no business being used in generic code. The linux-gnu back end is useful for android, and that doesn't have that interface either.
2012-04-24Only destroy breakpoints in leaderPetr Machata
Also use proc_each_breakpoint instead of dict_apply_to_all.
2012-04-24Call process_destroy, free in remove_processPetr Machata
2012-04-19Clone struct Process.e_machine in process_clonePetr Machata
2012-04-19Implement proc_remove_breakpointPetr Machata